leafer-draw 1.0.0-rc.21 → 1.0.0-rc.23
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/web.esm.js +80 -54
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +363 -210
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +362 -210
- package/dist/web.module.min.js +1 -1
- package/package.json +2 -2
package/dist/web.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Debug, LeaferCanvasBase, Platform, DataHelper, canvasSizeAttrs, ResizeEvent, canvasPatch, Creator, LeaferImage, FileHelper, LeafList, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, Bounds, LeafBoundsHelper, LeafLevelList, LayoutEvent, Run, ImageManager, AnimateEvent, BoundsHelper, MatrixHelper, ImageEvent, PointHelper, Direction4, TwoPointBoundsHelper, TaskProcessor, Matrix } from '@leafer/core';
|
|
1
|
+
import { Debug, LeaferCanvasBase, Platform, DataHelper, canvasSizeAttrs, ResizeEvent, canvasPatch, Creator, LeaferImage, FileHelper, LeafList, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, Bounds, LeafBoundsHelper, LeafLevelList, LayoutEvent, Run, ImageManager, AnimateEvent, BoundsHelper, MatrixHelper, AlignHelper, ImageEvent, PointHelper, Direction4, TwoPointBoundsHelper, TaskProcessor, Matrix } from '@leafer/core';
|
|
2
2
|
export * from '@leafer/core';
|
|
3
3
|
export { LeaferImage } from '@leafer/core';
|
|
4
4
|
import { PaintImage, ColorConvert, PaintGradient, Export, Group, TextConvert, Paint, Effect } from '@leafer-ui/draw';
|
|
@@ -187,7 +187,7 @@ function useCanvas(_canvasType, _power) {
|
|
|
187
187
|
}
|
|
188
188
|
img.onload = () => { resolve(img); };
|
|
189
189
|
img.onerror = (e) => { reject(e); };
|
|
190
|
-
if (!src.startsWith('data:') && !src.startsWith('blob:')
|
|
190
|
+
if (suffix && !src.startsWith('data:') && !src.startsWith('blob:'))
|
|
191
191
|
src += (src.includes("?") ? "&" : "?") + suffix;
|
|
192
192
|
img.src = src;
|
|
193
193
|
});
|
|
@@ -749,8 +749,11 @@ class Renderer {
|
|
|
749
749
|
if (!bounds.includes(this.target.__world) || this.needFill || !e.samePixelRatio) {
|
|
750
750
|
this.addBlock(this.canvas.bounds);
|
|
751
751
|
this.target.forceUpdate('surface');
|
|
752
|
+
return;
|
|
752
753
|
}
|
|
753
754
|
}
|
|
755
|
+
this.addBlock(new Bounds(0, 0, 1, 1));
|
|
756
|
+
this.changed = true;
|
|
754
757
|
}
|
|
755
758
|
__onLayoutEnd(event) {
|
|
756
759
|
if (event.data)
|
|
@@ -1021,7 +1024,7 @@ function shape(ui, current, options) {
|
|
|
1021
1024
|
}
|
|
1022
1025
|
else {
|
|
1023
1026
|
const { renderShapeSpread: spread } = ui.__layout;
|
|
1024
|
-
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, spread * scaleX, spread *
|
|
1027
|
+
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, scaleX === scaleY ? spread * scaleX : [spread * scaleY, spread * scaleX]) : current.bounds, nowWorld);
|
|
1025
1028
|
fitMatrix = current.bounds.getFitMatrix(worldClipBounds);
|
|
1026
1029
|
let { a: fitScaleX, d: fitScaleY } = fitMatrix;
|
|
1027
1030
|
if (fitMatrix.a < 1) {
|
|
@@ -1104,79 +1107,75 @@ const PaintModule = {
|
|
|
1104
1107
|
|
|
1105
1108
|
let origin = {};
|
|
1106
1109
|
const { get: get$4, rotateOfOuter: rotateOfOuter$2, translate: translate$1, scaleOfOuter: scaleOfOuter$2, scale: scaleHelper, rotate } = MatrixHelper;
|
|
1107
|
-
function fillOrFitMode(data,
|
|
1110
|
+
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
1108
1111
|
const transform = get$4();
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
const sh = box.height / (swap ? width : height);
|
|
1112
|
-
const scale = mode === 'fit' ? Math.min(sw, sh) : Math.max(sw, sh);
|
|
1113
|
-
const x = box.x + (box.width - width * scale) / 2;
|
|
1114
|
-
const y = box.y + (box.height - height * scale) / 2;
|
|
1115
|
-
translate$1(transform, x, y);
|
|
1116
|
-
scaleHelper(transform, scale);
|
|
1112
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
1113
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
1117
1114
|
if (rotation)
|
|
1118
1115
|
rotateOfOuter$2(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
1119
|
-
data.scaleX = data.scaleY = scale;
|
|
1120
1116
|
data.transform = transform;
|
|
1121
1117
|
}
|
|
1122
1118
|
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
1123
1119
|
const transform = get$4();
|
|
1124
|
-
translate$1(transform, box.x, box.y);
|
|
1125
|
-
if (
|
|
1126
|
-
translate$1(transform, x, y);
|
|
1127
|
-
if (scaleX) {
|
|
1120
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
1121
|
+
if (scaleX)
|
|
1128
1122
|
scaleHelper(transform, scaleX, scaleY);
|
|
1129
|
-
data.scaleX = transform.a;
|
|
1130
|
-
data.scaleY = transform.d;
|
|
1131
|
-
}
|
|
1132
1123
|
if (rotation)
|
|
1133
1124
|
rotate(transform, rotation);
|
|
1134
1125
|
data.transform = transform;
|
|
1135
1126
|
}
|
|
1136
|
-
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation) {
|
|
1127
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
1137
1128
|
const transform = get$4();
|
|
1138
1129
|
if (rotation) {
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1130
|
+
if (align === 'center') {
|
|
1131
|
+
rotateOfOuter$2(transform, { x: width / 2, y: height / 2 }, rotation);
|
|
1132
|
+
}
|
|
1133
|
+
else {
|
|
1134
|
+
rotate(transform, rotation);
|
|
1135
|
+
switch (rotation) {
|
|
1136
|
+
case 90:
|
|
1137
|
+
translate$1(transform, height, 0);
|
|
1138
|
+
break;
|
|
1139
|
+
case 180:
|
|
1140
|
+
translate$1(transform, width, height);
|
|
1141
|
+
break;
|
|
1142
|
+
case 270:
|
|
1143
|
+
translate$1(transform, 0, width);
|
|
1144
|
+
break;
|
|
1145
|
+
}
|
|
1150
1146
|
}
|
|
1151
1147
|
}
|
|
1152
|
-
origin.x = box.x;
|
|
1153
|
-
origin.y = box.y;
|
|
1154
|
-
if (x || y)
|
|
1155
|
-
origin.x += x, origin.y += y;
|
|
1148
|
+
origin.x = box.x + x;
|
|
1149
|
+
origin.y = box.y + y;
|
|
1156
1150
|
translate$1(transform, origin.x, origin.y);
|
|
1157
|
-
if (scaleX)
|
|
1151
|
+
if (scaleX)
|
|
1158
1152
|
scaleOfOuter$2(transform, origin, scaleX, scaleY);
|
|
1159
|
-
data.scaleX = scaleX;
|
|
1160
|
-
data.scaleY = scaleY;
|
|
1161
|
-
}
|
|
1162
1153
|
data.transform = transform;
|
|
1163
1154
|
}
|
|
1164
1155
|
|
|
1165
1156
|
const { get: get$3, translate } = MatrixHelper;
|
|
1166
1157
|
const tempBox = new Bounds();
|
|
1158
|
+
const tempPoint = {};
|
|
1167
1159
|
function createData(leafPaint, image, paint, box) {
|
|
1168
1160
|
let { width, height } = image;
|
|
1169
1161
|
if (paint.padding)
|
|
1170
1162
|
box = tempBox.set(box).shrink(paint.padding);
|
|
1171
|
-
const { opacity, mode, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
1163
|
+
const { opacity, mode, align, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
1172
1164
|
const sameBox = box.width === width && box.height === height;
|
|
1173
1165
|
if (blendMode)
|
|
1174
1166
|
leafPaint.blendMode = blendMode;
|
|
1175
1167
|
const data = leafPaint.data = { mode };
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
if (
|
|
1168
|
+
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
1169
|
+
const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
|
|
1170
|
+
let x = 0, y = 0, scaleX, scaleY;
|
|
1171
|
+
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
1172
|
+
if (!sameBox || rotation) {
|
|
1173
|
+
const sw = box.width / swapWidth, sh = box.height / swapHeight;
|
|
1174
|
+
scaleX = scaleY = mode === 'fit' ? Math.min(sw, sh) : Math.max(sw, sh);
|
|
1175
|
+
x += (box.width - width * scaleX) / 2, y += (box.height - height * scaleY) / 2;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
else if (size) {
|
|
1180
1179
|
scaleX = (typeof size === 'number' ? size : size.width) / width;
|
|
1181
1180
|
scaleY = (typeof size === 'number' ? size : size.height) / height;
|
|
1182
1181
|
}
|
|
@@ -1184,26 +1183,36 @@ function createData(leafPaint, image, paint, box) {
|
|
|
1184
1183
|
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
1185
1184
|
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
1186
1185
|
}
|
|
1186
|
+
if (align) {
|
|
1187
|
+
const imageBounds = { x, y, width: swapWidth, height: swapHeight };
|
|
1188
|
+
if (scaleX)
|
|
1189
|
+
imageBounds.width *= scaleX, imageBounds.height *= scaleY;
|
|
1190
|
+
AlignHelper.toPoint(align, imageBounds, box, tempPoint, true);
|
|
1191
|
+
x += tempPoint.x, y += tempPoint.y;
|
|
1192
|
+
}
|
|
1193
|
+
if (offset)
|
|
1194
|
+
x += offset.x, y += offset.y;
|
|
1187
1195
|
switch (mode) {
|
|
1188
1196
|
case 'strench':
|
|
1189
1197
|
if (!sameBox)
|
|
1190
1198
|
width = box.width, height = box.height;
|
|
1191
1199
|
break;
|
|
1200
|
+
case 'normal':
|
|
1192
1201
|
case 'clip':
|
|
1193
|
-
if (
|
|
1202
|
+
if (x || y || scaleX || rotation)
|
|
1194
1203
|
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
1195
1204
|
break;
|
|
1196
1205
|
case 'repeat':
|
|
1197
1206
|
if (!sameBox || scaleX || rotation)
|
|
1198
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation);
|
|
1207
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
1199
1208
|
if (!repeat)
|
|
1200
1209
|
data.repeat = 'repeat';
|
|
1201
1210
|
break;
|
|
1202
1211
|
case 'fit':
|
|
1203
1212
|
case 'cover':
|
|
1204
1213
|
default:
|
|
1205
|
-
if (
|
|
1206
|
-
fillOrFitMode(data,
|
|
1214
|
+
if (scaleX)
|
|
1215
|
+
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
1207
1216
|
}
|
|
1208
1217
|
if (!data.transform) {
|
|
1209
1218
|
if (box.x || box.y) {
|
|
@@ -1211,6 +1220,10 @@ function createData(leafPaint, image, paint, box) {
|
|
|
1211
1220
|
translate(data.transform, box.x, box.y);
|
|
1212
1221
|
}
|
|
1213
1222
|
}
|
|
1223
|
+
if (scaleX && mode !== 'strench') {
|
|
1224
|
+
data.scaleX = scaleX;
|
|
1225
|
+
data.scaleY = scaleY;
|
|
1226
|
+
}
|
|
1214
1227
|
data.width = width;
|
|
1215
1228
|
data.height = height;
|
|
1216
1229
|
if (opacity)
|
|
@@ -2140,11 +2153,13 @@ function clipText(drawData, style) {
|
|
|
2140
2153
|
const { rows, overflow } = drawData;
|
|
2141
2154
|
let { textOverflow } = style;
|
|
2142
2155
|
rows.splice(overflow);
|
|
2143
|
-
if (textOverflow !== '
|
|
2144
|
-
if (textOverflow === '
|
|
2156
|
+
if (textOverflow && textOverflow !== 'show') {
|
|
2157
|
+
if (textOverflow === 'hide')
|
|
2158
|
+
textOverflow = '';
|
|
2159
|
+
else if (textOverflow === 'ellipsis')
|
|
2145
2160
|
textOverflow = '...';
|
|
2146
2161
|
let char, charRight;
|
|
2147
|
-
const ellipsisWidth = Platform.canvas.measureText(textOverflow).width;
|
|
2162
|
+
const ellipsisWidth = textOverflow ? Platform.canvas.measureText(textOverflow).width : 0;
|
|
2148
2163
|
const right = style.x + style.width - ellipsisWidth;
|
|
2149
2164
|
const list = style.textWrap === 'none' ? rows : [rows[overflow - 1]];
|
|
2150
2165
|
list.forEach(row => {
|
|
@@ -2298,6 +2313,13 @@ const ExportModule = {
|
|
|
2298
2313
|
resolve();
|
|
2299
2314
|
this.running = false;
|
|
2300
2315
|
};
|
|
2316
|
+
if (filename === 'json') {
|
|
2317
|
+
return over({ data: leaf.toJSON() });
|
|
2318
|
+
}
|
|
2319
|
+
else if (FileHelper.fileType(filename) === 'json') {
|
|
2320
|
+
Platform.origin.download('data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(leaf.toJSON())), filename);
|
|
2321
|
+
return over({ data: true });
|
|
2322
|
+
}
|
|
2301
2323
|
const { leafer } = leaf;
|
|
2302
2324
|
if (leafer) {
|
|
2303
2325
|
leafer.waitViewCompleted(() => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -2305,8 +2327,12 @@ const ExportModule = {
|
|
|
2305
2327
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
2306
2328
|
const { worldTransform, isLeafer, isFrame } = leaf;
|
|
2307
2329
|
const { slice, trim, onCanvas } = options;
|
|
2308
|
-
|
|
2309
|
-
|
|
2330
|
+
let scale = options.scale || 1;
|
|
2331
|
+
let pixelRatio = options.pixelRatio || 1;
|
|
2332
|
+
if (leaf.isApp) {
|
|
2333
|
+
scale *= pixelRatio;
|
|
2334
|
+
pixelRatio = leaf.app.pixelRatio;
|
|
2335
|
+
}
|
|
2310
2336
|
const screenshot = options.screenshot || leaf.isApp;
|
|
2311
2337
|
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
2312
2338
|
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
package/dist/web.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Debug as t,LeaferCanvasBase as e,Platform as i,DataHelper as s,canvasSizeAttrs as n,ResizeEvent as o,canvasPatch as a,Creator as r,LeaferImage as d,FileHelper as l,LeafList as h,RenderEvent as c,ChildEvent as u,WatchEvent as p,PropertyEvent as f,LeafHelper as _,BranchHelper as g,Bounds as w,LeafBoundsHelper as y,LeafLevelList as m,LayoutEvent as v,Run as x,ImageManager as b,AnimateEvent as B,BoundsHelper as R,MatrixHelper as k,ImageEvent as E,PointHelper as L,Direction4 as S,TwoPointBoundsHelper as O,TaskProcessor as A,Matrix as W}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{PaintImage as C,ColorConvert as T,PaintGradient as M,Export as D,Group as I,TextConvert as F,Paint as P,Effect as V}from"@leafer-ui/draw";export*from"@leafer-ui/draw";const z=t.get("LeaferCanvas");class Y extends e{init(){const{view:t}=this.config;t?this.__createViewFrom(t):this.__createView();const{style:e}=this.view;e.display||(e.display="block"),this.parentView=this.view.parentElement,this.parentView&&(this.parentView.style.userSelect="none"),i.syncDomFont&&!this.parentView&&(this.view.style.display="none",document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(this.config)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e="string"==typeof t?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const i=this.view;if(t.hasChildNodes()){const{style:e}=i;e.position="absolute",e.top=e.left="0px",t.style.position||(t.style.position="relative")}t.appendChild(i)}else z.error(`no id: ${t}`),this.__createView()}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:s}=this.view;s.width=t+"px",s.height=e+"px",this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(){this.clientBounds=this.view.getBoundingClientRect()}startAutoLayout(t,e){this.autoBounds=t,this.resizeListener=e;try{this.resizeObserver=new ResizeObserver((t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)}));const t=this.parentView;t&&(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect()))}catch(t){this.imitateResizeObserver()}}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),i.requestRender(this.imitateResizeObserver.bind(this)))}checkAutoBounds(t){const e=this.view,{x:i,y:a,width:r,height:d}=this.autoBounds.getBoundsFrom(t);if(r!==this.width||d!==this.height){const{style:t}=e,{pixelRatio:l}=this;t.marginLeft=i+"px",t.marginTop=a+"px";const h={width:r,height:d,pixelRatio:l},c={};s.copyAttrs(c,this,n),this.resize(h),void 0!==this.width&&this.resizeListener(new o(h,c))}}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}a(CanvasRenderingContext2D.prototype),a(Path2D.prototype);const{mineType:U,fileType:G}=l;function N(t,e){i.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>t.toDataURL(U(e),i),canvasToBolb:(t,e,i)=>new Promise((s=>t.toBlob(s,U(e),i))),canvasSaveAs:(t,e,s)=>{const n=t.toDataURL(U(G(e)),s);return i.origin.download(n,e)},download:(t,e)=>new Promise((i=>{let s=document.createElement("a");s.href=t,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),i()})),loadImage:t=>new Promise(((e,s)=>{const n=new Image,{suffix:o,crossOrigin:a}=i.image;a&&(n.setAttribute("crossOrigin",a),n.crossOrigin=a),n.onload=()=>{e(n)},n.onerror=t=>{s(t)},t.startsWith("data:")||t.startsWith("blob:")||!o||(t+=(t.includes("?")?"&":"?")+o),n.src=t}))},i.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},i.canvas=r.canvas(),i.conicGradientSupport=!!i.canvas.context.createConicGradient}Object.assign(r,{canvas:(t,e)=>new Y(t,e),image:t=>new d(t)}),i.name="web",i.isMobile="ontouchstart"in window,i.requestRender=function(t){window.requestAnimationFrame(t)},i.devicePixelRatio=Math.max(1,devicePixelRatio);const{userAgent:X}=navigator;X.indexOf("Firefox")>-1?(i.conicGradientRotate90=!0,i.intWheelDeltaY=!0,i.syncDomFont=!0):X.indexOf("Safari")>-1&&-1===X.indexOf("Chrome")&&(i.fullImageShadow=!0),X.indexOf("Windows")>-1?(i.os="Windows",i.intWheelDeltaY=!0):X.indexOf("Mac")>-1?i.os="Mac":X.indexOf("Linux")>-1&&(i.os="Linux");class j{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new h;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 h,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(c.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 p(p.DATA,{updatedList:this.updatedList})),this.__updatedList=new h,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(f.CHANGE,this.__onAttrChange,this),t.on_([u.ADD,u.REMOVE],this.__onChildEvent,this),t.on_(p.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:q,updateBounds:H,updateAllWorldOpacity:Q}=_,{pushAllChildBranch:Z,pushAllParent:$}=g;const{worldBounds:J}=y,K={x:0,y:0,width:1e5,height:1e5};class tt{constructor(t){this.updatedBounds=new w,this.beforeBounds=new w,this.afterBounds=new w,t instanceof Array&&(t=new h(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,J)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(K):this.afterBounds.setListWithFn(t,J),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:et,updateAllChange:it}=_,st=t.get("Layouter");class nt{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new m,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.running)return;const{target:t}=this;this.times=0;try{t.emit(v.START),this.layoutOnce(),t.emitEvent(new v(v.END,this.layoutedBlocks,this.times))}catch(t){st.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?st.warn("layouting"):this.times>3?st.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(p.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=x.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:a}=v,r=this.getBlocks(s);r.forEach((t=>t.setBefore())),i.emitEvent(new v(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?(q(t,!0),e.add(t),t.isBranch&&Z(t,e),$(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),$(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||H(s[t])}H(i)}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&Q(t),t.__updateChange()}))}(s),this.extraBlock&&r.push(this.extraBlock),r.forEach((t=>t.setAfter())),i.emitEvent(new v(o,r,this.times)),i.emitEvent(new v(a,r,this.times)),this.addBlocks(r),this.__levelList.reset(),this.__updatedList=null,x.end(e)}fullLayout(){const t=x.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:s,AFTER:n}=v,o=this.getBlocks(new h(e));e.emitEvent(new v(i,o,this.times)),nt.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new v(s,o,this.times)),e.emitEvent(new v(n,o,this.times)),this.addBlocks(o),x.end(t)}static fullLayout(t){et(t,!0),t.isBranch?g.updateBounds(t):_.updateBounds(t),it(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new tt([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new tt(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(){const{target:t}=this;this.__eventIds=[t.on_(v.REQUEST,this.layout,this),t.on_(v.AGAIN,this.layoutAgain,this),t.on_(p.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const ot=t.get("Renderer");class at{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(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(v.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new w,ot.log(e.innerName,"---\x3e");try{this.emitRender(c.START),this.renderOnce(t),this.emitRender(c.END,this.totalBounds),b.clearRecycled()}catch(t){this.rendering=!1,ot.error(t)}ot.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return ot.warn("rendering");if(this.times>3)return ot.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new w,this.renderOptions={},t)this.emitRender(c.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(c.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(c.RENDER,this.renderBounds,this.renderOptions),this.emitRender(c.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;if(!e)return ot.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(e){const i=x.start("PartRender"),{canvas:s}=this,n=e.getIntersect(s.bounds),o=e.includes(this.target.__world),a=new w(n);s.save(),o&&!t.showRepaint?s.clear():(n.spread(1+1/this.canvas.pixelRatio).ceil(),s.clearWorld(n,!0),s.clipWorld(n,!0)),this.__render(n,o,a),s.restore(),x.end(i)}fullRender(){const t=x.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds,!0),e.restore(),x.end(t)}__render(e,i,s){const n=e.includes(this.target.__world)?{includes:i}:{bounds:e,includes:i};this.needFill&&this.canvas.fillWorld(e,this.config.fill),t.showRepaint&&this.canvas.strokeWorld(e,"red"),this.target.__render(this.canvas,n),this.renderBounds=s||e,this.renderOptions=n,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),t.showHitView&&this.renderHitView(n),t.showBoundsView&&this.renderBoundsView(n),this.canvas.updateRender()}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new w;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=Date.now();i.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.running&&(this.target.emit(B.FRAME),this.changed&&this.canvas.view&&this.render(),this.target.emit(c.NEXT)),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:i}=t.old;new w(0,0,e,i).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("surface"))}}__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||ot.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 c(t,this.times,e,i))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(c.REQUEST,this.update,this),t.on_(v.END,this.__onLayoutEnd,this),t.on_(c.AGAIN,this.renderAgain,this),t.on_(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)}}function rt(t,e){let i;const{rows:s,decorationY:n,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=s.length;t<a;t++)i=s[t],i.text?e.fillText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.fillText(t.char,t.x,i.y)})),n&&e.fillRect(i.x,i.y+n,i.width,o)}function dt(t,e,i){const{strokeAlign:s}=e.__,n="string"!=typeof t;switch(s){case"center":i.setStroke(n?void 0:t,e.__.strokeWidth,e.__),n?ct(t,!0,e,i):ht(e,i);break;case"inside":lt("inside",t,n,e,i);break;case"outside":lt("outside",t,n,e,i)}}function lt(t,e,i,s,n){const{__strokeWidth:o,__font:a}=s.__,r=n.getSameCanvas(!0,!0);r.setStroke(i?void 0:e,2*o,s.__),r.font=a,i?ct(e,!0,s,r):ht(s,r),r.blendMode="outside"===t?"destination-out":"destination-in",rt(s,r),r.blendMode="normal",s.__worldFlipped?n.copyWorldByReset(r,s.__nowWorld):n.copyWorldToInner(r,s.__nowWorld,s.__layout.renderBounds),r.recycle(s.__nowWorld)}function ht(t,e){let i;const{rows:s,decorationY:n,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=s.length;t<a;t++)i=s[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)})),n&&e.strokeRect(i.x,i.y+n,i.width,o)}function ct(t,e,i,s){let n;for(let o=0,a=t.length;o<a;o++)n=t[o],n.image&&C.checkImage(i,s,n,!1)||n.style&&(s.strokeStyle=n.style,n.blendMode?(s.saveBlendMode(n.blendMode),e?ht(i,s):s.stroke(),s.restoreBlendMode()):e?ht(i,s):s.stroke())}Object.assign(r,{watcher:(t,e)=>new j(t,e),layouter:(t,e)=>new nt(t,e),renderer:(t,e,i)=>new at(t,e,i),selector:(t,e)=>{},interaction:(t,e,i,s)=>{}}),i.layout=nt.fullLayout;const{getSpread:ut,getOuterOf:pt,getByMove:ft,getIntersectData:_t}=R;let gt;function wt(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:s}=i.__layout;switch(e.type){case"solid":let{type:n,blendMode:o,color:a,opacity:r}=e;return{type:n,blendMode:o,style:T.string(a,r)};case"image":return C.image(i,t,e,s,!gt||!gt[e.url]);case"linear":return M.linearGradient(e,s);case"radial":return M.radialGradient(e,s);case"angular":return M.conicGradient(e,s);default:return e.r?{type:"solid",style:T.string(e)}:void 0}}const yt={compute:function(t,e){const i=e.__,s=[];let n,o=i.__input[t];o instanceof Array||(o=[o]),gt=C.recycleImage(t,i);for(let i,n=0,a=o.length;n<a;n++)i=wt(t,o[n],e),i&&s.push(i);i["_"+t]=s.length?s:void 0,s.length&&s[0].image&&(n=s[0].image.hasOpacityPixel),"fill"===t?i.__pixelFill=n:i.__pixelStroke=n},fill:function(t,e,i){i.fillStyle=t,e.__.__font?rt(e,i):e.__.windingRule?i.fill(e.__.windingRule):i.fill()},fills:function(t,e,i){let s;const{windingRule:n,__font:o}=e.__;for(let a=0,r=t.length;a<r;a++)s=t[a],s.image&&C.checkImage(e,i,s,!o)||s.style&&(i.fillStyle=s.style,s.transform?(i.save(),i.transform(s.transform),s.blendMode&&(i.blendMode=s.blendMode),o?rt(e,i):n?i.fill(n):i.fill(),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),o?rt(e,i):n?i.fill(n):i.fill(),i.restoreBlendMode()):o?rt(e,i):n?i.fill(n):i.fill())},fillText:rt,stroke:function(t,e,i){const s=e.__,{__strokeWidth:n,strokeAlign:o,__font:a}=s;if(n)if(a)dt(t,e,i);else switch(o){case"center":i.setStroke(t,n,s),i.stroke();break;case"inside":i.save(),i.setStroke(t,2*n,s),s.windingRule?i.clip(s.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const o=i.getSameCanvas(!0,!0);o.setStroke(t,2*n,s),e.__drawRenderPath(o),o.stroke(),s.windingRule?o.clip(s.windingRule):o.clip(),o.clearWorld(e.__layout.renderBounds),e.__worldFlipped?i.copyWorldByReset(o,e.__nowWorld):i.copyWorldToInner(o,e.__nowWorld,e.__layout.renderBounds),o.recycle(e.__nowWorld)}},strokes:function(t,e,i){const s=e.__,{__strokeWidth:n,strokeAlign:o,__font:a}=s;if(n)if(a)dt(t,e,i);else switch(o){case"center":i.setStroke(void 0,n,s),ct(t,!1,e,i);break;case"inside":i.save(),i.setStroke(void 0,2*n,s),s.windingRule?i.clip(s.windingRule):i.clip(),ct(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:o}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),a.setStroke(void 0,2*n,s),ct(t,!1,e,a),s.windingRule?a.clip(s.windingRule):a.clip(),a.clearWorld(o),e.__worldFlipped?i.copyWorldByReset(a,e.__nowWorld):i.copyWorldToInner(a,e.__nowWorld,o),a.recycle(e.__nowWorld)}},strokeText:dt,drawTextStroke:ht,shape:function(t,e,i){const s=e.getSameCanvas(),n=t.__nowWorld;let o,a,r,d,{scaleX:l,scaleY:h}=n;if(l<0&&(l=-l),h<0&&(h=-h),e.bounds.includes(n))d=s,o=r=n;else{const{renderShapeSpread:s}=t.__layout,c=_t(s?ut(e.bounds,s*l,s*h):e.bounds,n);a=e.bounds.getFitMatrix(c);let{a:u,d:p}=a;if(a.a<1&&(d=e.getSameCanvas(),t.__renderShape(d,i),l*=u,h*=p),r=pt(n,a),o=ft(r,-a.e,-a.f),i.matrix){const{matrix:t}=i;a.multiply(t),u*=t.scaleX,p*=t.scaleY}i=Object.assign(Object.assign({},i),{matrix:a.withScale(u,p)})}return t.__renderShape(s,i),{canvas:s,matrix:a,bounds:o,worldCanvas:d,shapeBounds:r,scaleX:l,scaleY:h}}};let mt={};const{get:vt,rotateOfOuter:xt,translate:bt,scaleOfOuter:Bt,scale:Rt,rotate:kt}=k;function Et(t,e,i,s,n,o){const a=vt(),r=o&&180!==o,d=i.width/(r?n:s),l=i.height/(r?s:n),h="fit"===e?Math.min(d,l):Math.max(d,l),c=i.x+(i.width-s*h)/2,u=i.y+(i.height-n*h)/2;bt(a,c,u),Rt(a,h),o&&xt(a,{x:i.x+i.width/2,y:i.y+i.height/2},o),t.scaleX=t.scaleY=h,t.transform=a}function Lt(t,e,i,s,n,o,a){const r=vt();bt(r,e.x,e.y),(i||s)&&bt(r,i,s),n&&(Rt(r,n,o),t.scaleX=r.a,t.scaleY=r.d),a&&kt(r,a),t.transform=r}function St(t,e,i,s,n,o,a,r,d){const l=vt();if(d)switch(kt(l,d),d){case 90:bt(l,s,0);break;case 180:bt(l,i,s);break;case 270:bt(l,0,i)}mt.x=e.x,mt.y=e.y,(n||o)&&(mt.x+=n,mt.y+=o),bt(l,mt.x,mt.y),a&&(Bt(l,mt,a,r),t.scaleX=a,t.scaleY=r),t.transform=l}const{get:Ot,translate:At}=k,Wt=new w;function Ct(t,e,i,s){let{width:n,height:o}=e;i.padding&&(s=Wt.set(s).shrink(i.padding));const{opacity:a,mode:r,offset:d,scale:l,size:h,rotation:c,blendMode:u,repeat:p}=i,f=s.width===n&&s.height===o;u&&(t.blendMode=u);const _=t.data={mode:r};let g,w,y,m;switch(d&&(g=d.x,w=d.y),h?(y=("number"==typeof h?h:h.width)/n,m=("number"==typeof h?h:h.height)/o):l&&(y="number"==typeof l?l:l.x,m="number"==typeof l?l:l.y),r){case"strench":f||(n=s.width,o=s.height);break;case"clip":(d||y||c)&&Lt(_,s,g,w,y,m,c);break;case"repeat":(!f||y||c)&&St(_,s,n,o,g,w,y,m,c),p||(_.repeat="repeat");break;default:f&&!c||Et(_,r,s,n,o,c)}_.transform||(s.x||s.y)&&(_.transform=Ot(),At(_.transform,s.x,s.y)),_.width=n,_.height=o,a&&(_.opacity=a),p&&(_.repeat="string"==typeof p?"x"===p?"repeat-x":"repeat-y":"repeat")}let Tt,Mt=new w;const{isSame:Dt}=R;function It(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||Ct(n,s,i,o),!0}function Ft(t,e){zt(t,E.LOAD,e)}function Pt(t,e){zt(t,E.LOADED,e)}function Vt(t,e,i){e.error=i,t.forceUpdate("surface"),zt(t,E.ERROR,e)}function zt(t,e,i){t.hasEvent(e)&&t.emitEvent(new E(e,i))}function Yt(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Ut,scale:Gt,copy:Nt}=k,{ceil:Xt,abs:jt}=Math;function qt(t,e,s){let{scaleX:n,scaleY:o}=b.patternLocked?t.__world:t.__nowWorld;const a=n+"-"+o;if(e.patternId===a||t.destroyed)return!1;{n=jt(n),o=jt(o);const{image:t,data:r}=e;let d,l,{width:h,height:c,scaleX:u,scaleY:p,opacity:f,transform:_,repeat:g}=r;u&&(l=Ut(),Nt(l,_),Gt(l,1/u,1/p),n*=u,o*=p),n*=s,o*=s,h*=n,c*=o;const w=h*c;if(!g&&w>i.image.maxCacheSize)return!1;let y=i.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;y>e&&(y=e)}w>y&&(d=Math.sqrt(w/y)),d&&(n/=d,o/=d,h/=d,c/=d),u&&(n/=u,o/=p),(_||1!==n||1!==o)&&(l||(l=Ut(),_&&Nt(l,_)),Gt(l,1/n,1/o));const m=t.getCanvas(Xt(h)||1,Xt(c)||1,f),v=t.getPattern(m,g||i.origin.noRepeat||"no-repeat",l,e);return e.style=v,e.patternId=a,!0}}function Ht(t,e,i,s){return new(i||(i=Promise))((function(n,o){function a(t){try{d(s.next(t))}catch(t){o(t)}}function r(t){try{d(s.throw(t))}catch(t){o(t)}}function d(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,r)}d((s=s.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:Qt}=Math;const Zt={image:function(t,e,i,s,n){let o,a;const r=b.get(i);return Tt&&i===Tt.paint&&Dt(s,Tt.boxBounds)?o=Tt.leafPaint:(o={type:i.type,image:r},Tt=r.use>1?{leafPaint:o,paint:i,boxBounds:Mt.set(s)}:null),(n||r.loading)&&(a={image:r,attrName:e,attrValue:i}),r.ready?(It(t,e,i,r,o,s),n&&(Ft(t,a),Pt(t,a))):r.error?n&&Vt(t,a,r.error):(Yt(t,!0),n&&Ft(t,a),o.loadId=r.load((()=>{Yt(t,!1),t.destroyed||(It(t,e,i,r,o,s)&&(r.hasOpacityPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),Pt(t,a)),o.loadId=null}),(e=>{Yt(t,!1),Vt(t,a,e),o.loadId=null}))),o},createData:Ct,fillOrFitMode:Et,clipMode:Lt,repeatMode:St,createPattern:qt,checkImage:function(t,e,s,n){const{scaleX:o,scaleY:a}=b.patternLocked?t.__world:t.__nowWorld;if(s.data&&s.patternId!==o+"-"+a){const{data:r}=s;if(n)if(r.repeat)n=!1;else{let{width:t,height:s}=r;t*=Qt(o)*e.pixelRatio,s*=Qt(a)*e.pixelRatio,r.scaleX&&(t*=r.scaleX,s*=r.scaleY),n=t*s>i.image.maxCacheSize}return n?(e.save(),e.clip(),s.blendMode&&(e.blendMode=s.blendMode),r.opacity&&(e.opacity*=r.opacity),r.transform&&e.transform(r.transform),e.drawImage(s.image.view,0,0,r.width,r.height),e.restore(),!0):(!s.style||D.running?qt(t,s,e.pixelRatio):s.patternTask||(s.patternTask=b.patternTasker.add((()=>Ht(this,void 0,void 0,(function*(){s.patternTask=null,e.bounds.hit(t.__nowWorld)&&qt(t,s,e.pixelRatio),t.forceUpdate("surface")}))),300)),!1)}return!1},recycleImage:function(t,e){const i=e["_"+t];if(i instanceof Array){let s,n,o,a;for(let r=0,d=i.length;r<d;r++)s=i[r].image,a=s&&s.url,a&&(n||(n={}),n[a]=!0,b.recycle(s),s.loading&&(o||(o=e.__input&&e.__input[t]||[],o instanceof Array||(o=[o])),s.unload(i[r].loadId,!o.some((t=>t.url===a)))));return n}return null}},$t={x:.5,y:0},Jt={x:.5,y:1};function Kt(t,e,i){let s;for(let n=0,o=e.length;n<o;n++)s=e[n],t.addColorStop(s.offset,T.string(s.color,i))}const{set:te,getAngle:ee,getDistance:ie}=L,{get:se,rotateOfOuter:ne,scaleOfOuter:oe}=k,ae={x:.5,y:.5},re={x:.5,y:1},de={},le={};const{set:he,getAngle:ce,getDistance:ue}=L,{get:pe,rotateOfOuter:fe,scaleOfOuter:_e}=k,ge={x:.5,y:.5},we={x:.5,y:1},ye={},me={};const ve={linearGradient:function(t,e){let{from:s,to:n,type:o,blendMode:a,opacity:r}=t;s||(s=$t),n||(n=Jt);const d=i.canvas.createLinearGradient(e.x+s.x*e.width,e.y+s.y*e.height,e.x+n.x*e.width,e.y+n.y*e.height);Kt(d,t.stops,r);const l={type:o,style:d};return a&&(l.blendMode=a),l},radialGradient:function(t,e){let{from:s,to:n,type:o,opacity:a,blendMode:r,stretch:d}=t;s||(s=ae),n||(n=re);const{x:l,y:h,width:c,height:u}=e;let p;te(de,l+s.x*c,h+s.y*u),te(le,l+n.x*c,h+n.y*u),(c!==u||d)&&(p=se(),oe(p,de,c/u*(d||1),1),ne(p,de,ee(de,le)+90));const f=i.canvas.createRadialGradient(de.x,de.y,0,de.x,de.y,ie(de,le));Kt(f,t.stops,a);const _={type:o,style:f,transform:p};return r&&(_.blendMode=r),_},conicGradient:function(t,e){let{from:s,to:n,type:o,opacity:a,blendMode:r,stretch:d}=t;s||(s=ge),n||(n=we);const{x:l,y:h,width:c,height:u}=e;he(ye,l+s.x*c,h+s.y*u),he(me,l+n.x*c,h+n.y*u);const p=pe(),f=ce(ye,me);i.conicGradientRotate90?(_e(p,ye,c/u*(d||1),1),fe(p,ye,f+90)):(_e(p,ye,1,c/u*(d||1)),fe(p,ye,f));const _=i.conicGradientSupport?i.canvas.createConicGradient(0,ye.x,ye.y):i.canvas.createRadialGradient(ye.x,ye.y,0,ye.x,ye.y,ue(ye,me));Kt(_,t.stops,a);const g={type:o,style:_,transform:p};return r&&(g.blendMode=r),g}},{copy:xe,toOffsetOutBounds:be}=R,Be={},Re={};function ke(t,e,s,n){const{bounds:o,shapeBounds:a}=n;if(i.fullImageShadow){if(xe(Be,t.bounds),Be.x+=e.x-a.x,Be.y+=e.y-a.y,s){const{matrix:t}=n;Be.x-=(o.x+(t?t.e:0)+o.width/2)*(s-1),Be.y-=(o.y+(t?t.f:0)+o.height/2)*(s-1),Be.width*=s,Be.height*=s}t.copyWorld(n.canvas,t.bounds,Be)}else s&&(xe(Be,e),Be.x-=e.width/2*(s-1),Be.y-=e.height/2*(s-1),Be.width*=s,Be.height*=s),t.copyWorld(n.canvas,a,s?Be:e)}const{toOffsetOutBounds:Ee}=R,Le={};const Se={shadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:a}=t,{shadow:r}=t.__,{worldCanvas:d,bounds:l,shapeBounds:h,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),f=r.length-1;be(l,Re),r.forEach(((r,_)=>{p.setWorldShadow(Re.offsetX+r.x*c,Re.offsetY+r.y*u,r.blur*c,r.color),n=r.spread?1+2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,ke(p,Re,n,i),s=l,r.box&&(p.restore(),p.save(),d&&(p.copyWorld(p,l,o,"copy"),s=o),d?p.copyWorld(d,o,o,"destination-out"):p.copyWorld(i.canvas,h,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(p,s,o,r.blendMode):e.copyWorldToInner(p,s,a.renderBounds,r.blendMode),f&&_<f&&p.clearWorld(s,!0)})),p.recycle(s)},innerShadow:function(t,e,i){let s,n;const{__nowWorld:o,__layout:a}=t,{innerShadow:r}=t.__,{worldCanvas:d,bounds:l,shapeBounds:h,scaleX:c,scaleY:u}=i,p=e.getSameCanvas(),f=r.length-1;Ee(l,Le),r.forEach(((r,_)=>{p.save(),p.setWorldShadow(Le.offsetX+r.x*c,Le.offsetY+r.y*u,r.blur*c),n=r.spread?1-2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,ke(p,Le,n,i),p.restore(),d?(p.copyWorld(p,l,o,"copy"),p.copyWorld(d,o,o,"source-out"),s=o):(p.copyWorld(i.canvas,h,l,"source-out"),s=l),p.fillWorld(s,r.color,"source-in"),t.__worldFlipped?e.copyWorldByReset(p,s,o,r.blendMode):e.copyWorldToInner(p,s,a.renderBounds,r.blendMode),f&&_<f&&p.clearWorld(s,!0)})),p.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:Oe}=y;function Ae(t,e,i,s,n,o){switch(e){case"alpha":!function(t,e,i,s){const n=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(s,n),s.recycle(n),Ce(t,e,i,1)}(t,i,s,n);break;case"opacity-path":Ce(t,i,s,o);break;case"path":i.restore()}}function We(t){return t.getSameCanvas(!1,!0)}function Ce(t,e,i,s){const n=t.__nowWorld;e.resetTransform(),e.opacity=s,e.copyWorld(i,n),i.recycle(n)}I.prototype.__renderMask=function(t,e){let i,s,n,o,a;const{children:r}=this;for(let d=0,l=r.length;d<l;d++)i=r[d],i.__.mask&&(a&&(Ae(this,a,t,n,s,o),s=n=null),"path"===i.__.maskType?(i.opacity<1?(a="opacity-path",o=i.opacity,n||(n=We(t))):(a="path",t.save()),i.__clip(n||t,e)):(a="alpha",s||(s=We(t)),n||(n=We(t)),i.__render(s,e)),"clipping"!==i.__.maskType)||Oe(i,e)||i.__render(n||t,e);Ae(this,a,t,n,s,o)};const Te=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Me=Te+"_#~&*+\\=|≮≯≈≠=…",De=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 Ie(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Fe=Ie("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Pe=Ie("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ve=Ie(Te),ze=Ie(Me),Ye=Ie("- —/~|┆·");var Ue;!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"}(Ue||(Ue={}));const{Letter:Ge,Single:Ne,Before:Xe,After:je,Symbol:qe,Break:He}=Ue;function Qe(t){return Fe[t]?Ge:Ye[t]?He:Pe[t]?Xe:Ve[t]?je:ze[t]?qe:De.test(t)?Ne:Ge}const Ze={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 $e(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:Je}=Ze,{Letter:Ke,Single:ti,Before:ei,After:ii,Symbol:si,Break:ni}=Ue;let oi,ai,ri,di,li,hi,ci,ui,pi,fi,_i,gi,wi,yi,mi,vi,xi=[];function bi(t,e){pi&&!ui&&(ui=pi),oi.data.push({char:t,width:e}),ri+=e}function Bi(){di+=ri,oi.width=ri,ai.words.push(oi),oi={data:[]},ri=0}function Ri(){yi&&(mi.paraNumber++,ai.paraStart=!0,yi=!1),pi&&(ai.startCharSize=ui,ai.endCharSize=pi,ui=0),ai.width=di,vi.width&&Je(ai),xi.push(ai),ai={words:[]},di=0}const ki=0,Ei=1,Li=2;const{top:Si,right:Oi,bottom:Ai,left:Wi}=S;function Ci(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 Ti={getDrawData:function(t,e){"string"!=typeof t&&(t=String(t));let s=0,n=0,o=e.__getInput("width")||0,a=e.__getInput("height")||0;const{textDecoration:r,__font:d,__padding:l}=e;l&&(o&&(s=l[Wi],o-=l[Oi]+l[Wi]),a&&(n=l[Si],a-=l[Si]+l[Ai]));const h={bounds:{x:s,y:n,width:o,height:a},rows:[],paraNumber:0,font:i.canvas.font=d};return function(t,e,s){mi=t,xi=t.rows,vi=t.bounds;const{__letterSpacing:n,paraIndent:o,textCase:a}=s,{canvas:r}=i,{width:d,height:l}=vi;if(d||l||n||"none"!==a){const t="none"!==s.textWrap,i="break"===s.textWrap;yi=!0,_i=null,ui=ci=pi=ri=di=0,oi={data:[]},ai={words:[]};for(let s=0,l=e.length;s<l;s++)hi=e[s],"\n"===hi?(ri&&Bi(),ai.paraEnd=!0,Ri(),yi=!0):(fi=Qe(hi),fi===Ke&&"none"!==a&&(hi=$e(hi,a,!ri)),ci=r.measureText(hi).width,n&&(n<0&&(pi=ci),ci+=n),gi=fi===ti&&(_i===ti||_i===Ke)||_i===ti&&fi!==ii,wi=!(fi!==ei&&fi!==ti||_i!==si&&_i!==ii),li=yi&&o?d-o:d,t&&d&&di+ri+ci>li&&(i?(ri&&Bi(),Ri()):(wi||(wi=fi===Ke&&_i==ii),gi||wi||fi===ni||fi===ei||fi===ti||ri+ci>li?(ri&&Bi(),Ri()):Ri()))," "===hi&&!0!==yi&&di+ri===0||(fi===ni?(" "===hi&&ri&&Bi(),bi(hi,ci),Bi()):gi||wi?(ri&&Bi(),bi(hi,ci)):bi(hi,ci)),_i=fi);ri&&Bi(),di&&Ri(),xi.length>0&&(xi[xi.length-1].paraEnd=!0)}else e.split("\n").forEach((t=>{mi.paraNumber++,xi.push({x:o||0,text:t,width:r.measureText(t).width,paraStart:!0})}))}(h,t,e),l&&function(t,e,i,s,n){if(!s)switch(i.textAlign){case"left":Ci(e,"x",t[Wi]);break;case"right":Ci(e,"x",-t[Oi])}if(!n)switch(i.verticalAlign){case"top":Ci(e,"y",t[Si]);break;case"bottom":Ci(e,"y",-t[Ai])}}(l,h,e,o,a),function(t,e){const{rows:i,bounds:s}=t,{__lineHeight:n,__baseLine:o,__letterSpacing:a,__clipText:r,textAlign:d,verticalAlign:l,paraSpacing:h}=e;let c,u,p,{x:f,y:_,width:g,height:w}=s,y=n*i.length+(h?h*(t.paraNumber-1):0),m=o;if(r&&y>w)y=Math.max(w,n),t.overflow=i.length;else switch(l){case"middle":_+=(w-y)/2;break;case"bottom":_+=w-y}m+=_;for(let o=0,l=i.length;o<l;o++){switch(c=i[o],c.x=f,d){case"center":c.x+=(g-c.width)/2;break;case"right":c.x+=g-c.width}c.paraStart&&h&&o>0&&(m+=h),c.y=m,m+=n,t.overflow>o&&m>y&&(c.isOverflow=!0,t.overflow=o+1),u=c.x,p=c.width,a<0&&(c.width<0?(p=-c.width+e.fontSize+a,u-=p,p+=e.fontSize):p-=a),u<s.x&&(s.x=u),p>s.width&&(s.width=p),r&&g&&g<p&&(c.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=_,s.height=y}(h,e),function(t,e,i,s){const{rows:n}=t,{textAlign:o,paraIndent:a,letterSpacing:r}=e;let d,l,h,c,u;n.forEach((t=>{t.words&&(h=a&&t.paraStart?a:0,l=i&&"justify"===o&&t.words.length>1?(i-t.width-h)/(t.words.length-1):0,c=r||t.isOverflow?ki:l>.01?Ei:Li,t.isOverflow&&!r&&(t.textMode=!0),c===Li?(t.x+=h,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=h,d=t.x,t.data=[],t.words.forEach((e=>{c===Ei?(u={char:"",x:d},d=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,d,u)," "!==u.char&&t.data.push(u)):d=function(t,e,i){return t.forEach((t=>{" "!==t.char&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,d,t.data),!t.paraEnd&&l&&(d+=l,t.width+=l)}))),t.words=null)}))}(h,e,o),h.overflow&&function(t,e){const{rows:s,overflow:n}=t;let{textOverflow:o}=e;if(s.splice(n),"hide"!==o){let t,a;"ellipsis"===o&&(o="...");const r=i.canvas.measureText(o).width,d=e.x+e.width-r;("none"===e.textWrap?s:[s[n-1]]).forEach((e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],a=t.x+t.width,!(s===i&&a<d));s--){if(a<d&&" "!==t.char){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=r,e.data.push({char:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(h,e),"none"!==r&&function(t,e){const{fontSize:i}=e;switch(t.decorationHeight=i/11,e.textDecoration){case"under":t.decorationY=.15*i;break;case"delete":t.decorationY=.35*-i}}(h,e),h}};const Mi={string:function(t,e){if("string"==typeof t)return t;let i=void 0===t.a?1:t.a;e&&(i*=e);const s=t.r+","+t.g+","+t.b;return 1===i?"rgb("+s+")":"rgba("+s+","+i+")"}},{setPoint:Di,addPoint:Ii,toBounds:Fi}=O;const Pi={export(t,e,i){return this.running=!0,function(t){Vi||(Vi=new A);return new Promise((e=>{Vi.add((()=>Ht(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((s=>new Promise((n=>{const o=t=>{s(t),n(),this.running=!1},{leafer:a}=t;a?a.waitViewCompleted((()=>Ht(this,void 0,void 0,(function*(){i=l.getExportOptions(i);let s,n,d=1,h=1;const{worldTransform:c,isLeafer:u,isFrame:p}=t,{slice:f,trim:_,onCanvas:g}=i,y=i.scale||1,m=i.pixelRatio||1,v=i.screenshot||t.isApp,x=u&&v&&void 0===i.fill?t.fill:i.fill,b=l.isOpaqueImage(e)||x,B=new W;if(v)s=!0===v?u?a.canvas.bounds:t.worldRenderBounds:v;else{let e=i.relative||(u?"inner":"local");switch(d=c.scaleX,h=c.scaleY,e){case"inner":B.set(c);break;case"local":B.set(c).divide(t.localTransform),d/=t.scaleX,h/=t.scaleY;break;case"world":d=1,h=1;break;case"page":e=t.leafer;default:B.set(c).divide(t.getTransform(e));const i=e.worldTransform;d/=d/i.scaleX,h/=h/i.scaleY}s=t.getBounds("render",e)}const{x:R,y:k,width:E,height:L}=new w(s).scale(y);let S=r.canvas({width:Math.round(E),height:Math.round(L),pixelRatio:m});const O={matrix:B.scale(1/y).invert().translate(-R,-k).withScale(1/d*y,1/h*y)};if(f&&(t=a,O.bounds=S.bounds),S.save(),p&&void 0!==x){const e=t.get("fill");t.fill="",t.__render(S,O),t.fill=e}else t.__render(S,O);if(S.restore(),_){n=function(t){const{width:e,height:i}=t.view,{data:s}=t.context.getImageData(0,0,e,i);let n,o,a,r=0;for(let t=0;t<s.length;t+=4)0!==s[t+3]&&(n=r%e,o=(r-n)/e,a?Ii(a,n,o):Di(a={},n,o)),r++;const d=new w;return Fi(a,d),d.scale(1/t.pixelRatio).ceil()}(S);const t=S,{width:e,height:i}=n,s={x:0,y:0,width:e,height:i,pixelRatio:m};S=r.canvas(s),S.copyWorld(t,n,s)}b&&S.fillWorld(S.bounds,x||"#FFFFFF","destination-over"),g&&g(S);const A="canvas"===e?S:yield S.export(e,i);o({data:A,width:S.pixelWidth,height:S.pixelHeight,renderBounds:s,trimBounds:n})})))):o({data:!1})}))))}};let Vi;const zi=e.prototype,Yi=t.get("@leafer-ui/export");zi.export=function(t,e){const{quality:i,blob:s}=l.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):s?this.toBlob(t,i):this.toDataURL(t,i)},zi.toBlob=function(t,e){return new Promise((s=>{i.origin.canvasToBolb(this.view,t,e).then((t=>{s(t)})).catch((t=>{Yi.error(t),s(null)}))}))},zi.toDataURL=function(t,e){return i.origin.canvasToDataURL(this.view,t,e)},zi.saveAs=function(t,e){return new Promise((s=>{i.origin.canvasSaveAs(this.view,t,e).then((()=>{s(!0)})).catch((t=>{Yi.error(t),s(!1)}))}))},Object.assign(F,Ti),Object.assign(T,Mi),Object.assign(P,yt),Object.assign(C,Zt),Object.assign(M,ve),Object.assign(V,Se),Object.assign(D,Pi),N();export{nt as Layouter,Y as LeaferCanvas,at as Renderer,j as Watcher,N as useCanvas};
|
|
1
|
+
import{Debug as t,LeaferCanvasBase as e,Platform as i,DataHelper as n,canvasSizeAttrs as s,ResizeEvent as o,canvasPatch as a,Creator as r,LeaferImage as d,FileHelper as l,LeafList as h,RenderEvent as c,ChildEvent as u,WatchEvent as f,PropertyEvent as p,LeafHelper as g,BranchHelper as _,Bounds as w,LeafBoundsHelper as y,LeafLevelList as m,LayoutEvent as v,Run as x,ImageManager as b,AnimateEvent as B,BoundsHelper as R,MatrixHelper as k,AlignHelper as E,ImageEvent as L,PointHelper as S,Direction4 as O,TwoPointBoundsHelper as A,TaskProcessor as W,Matrix as C}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{PaintImage as T,ColorConvert as M,PaintGradient as D,Export as I,Group as F,TextConvert as P,Paint as V,Effect as z}from"@leafer-ui/draw";export*from"@leafer-ui/draw";const Y=t.get("LeaferCanvas");class N extends e{init(){const{view:t}=this.config;t?this.__createViewFrom(t):this.__createView();const{style:e}=this.view;e.display||(e.display="block"),this.parentView=this.view.parentElement,this.parentView&&(this.parentView.style.userSelect="none"),i.syncDomFont&&!this.parentView&&(this.view.style.display="none",document.body.appendChild(this.view)),this.__createContext(),this.autoLayout||this.resize(this.config)}set backgroundColor(t){this.view.style.backgroundColor=t}get backgroundColor(){return this.view.style.backgroundColor}set hittable(t){this.view.style.pointerEvents=t?"auto":"none"}get hittable(){return"none"!==this.view.style.pointerEvents}__createView(){this.view=document.createElement("canvas")}__createViewFrom(t){let e="string"==typeof t?document.getElementById(t):t;if(e)if(e instanceof HTMLCanvasElement)this.view=e;else{let t=e;if(e===window||e===document){const e=document.createElement("div"),{style:i}=e;i.position="absolute",i.top=i.bottom=i.left=i.right="0px",document.body.appendChild(e),t=e}this.__createView();const i=this.view;if(t.hasChildNodes()){const{style:e}=i;e.position="absolute",e.top=e.left="0px",t.style.position||(t.style.position="relative")}t.appendChild(i)}else Y.error(`no id: ${t}`),this.__createView()}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this,{style:n}=this.view;n.width=t+"px",n.height=e+"px",this.view.width=Math.ceil(t*i),this.view.height=Math.ceil(e*i)}updateClientBounds(){this.clientBounds=this.view.getBoundingClientRect()}startAutoLayout(t,e){this.autoBounds=t,this.resizeListener=e;try{this.resizeObserver=new ResizeObserver((t=>{this.updateClientBounds();for(const e of t)this.checkAutoBounds(e.contentRect)}));const t=this.parentView;t&&(this.resizeObserver.observe(t),this.checkAutoBounds(t.getBoundingClientRect()))}catch(t){this.imitateResizeObserver()}}imitateResizeObserver(){this.autoLayout&&(this.parentView&&this.checkAutoBounds(this.parentView.getBoundingClientRect()),i.requestRender(this.imitateResizeObserver.bind(this)))}checkAutoBounds(t){const e=this.view,{x:i,y:a,width:r,height:d}=this.autoBounds.getBoundsFrom(t);if(r!==this.width||d!==this.height){const{style:t}=e,{pixelRatio:l}=this;t.marginLeft=i+"px",t.marginTop=a+"px";const h={width:r,height:d,pixelRatio:l},c={};n.copyAttrs(c,this,s),this.resize(h),void 0!==this.width&&this.resizeListener(new o(h,c))}}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}unrealCanvas(){if(!this.unreal&&this.parentView){const t=this.view;t&&t.remove(),this.view=this.parentView,this.unreal=!0}}destroy(){if(this.view){if(this.stopAutoLayout(),!this.unreal){const t=this.view;t.parentElement&&t.remove()}super.destroy()}}}a(CanvasRenderingContext2D.prototype),a(Path2D.prototype);const{mineType:U,fileType:G}=l;function X(t,e){i.origin={createCanvas(t,e){const i=document.createElement("canvas");return i.width=t,i.height=e,i},canvasToDataURL:(t,e,i)=>t.toDataURL(U(e),i),canvasToBolb:(t,e,i)=>new Promise((n=>t.toBlob(n,U(e),i))),canvasSaveAs:(t,e,n)=>{const s=t.toDataURL(U(G(e)),n);return i.origin.download(s,e)},download:(t,e)=>new Promise((i=>{let n=document.createElement("a");n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n),i()})),loadImage:t=>new Promise(((e,n)=>{const s=new Image,{suffix:o,crossOrigin:a}=i.image;a&&(s.setAttribute("crossOrigin",a),s.crossOrigin=a),s.onload=()=>{e(s)},s.onerror=t=>{n(t)},!o||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+o),s.src=t}))},i.event={stopDefault(t){t.preventDefault()},stopNow(t){t.stopImmediatePropagation()},stop(t){t.stopPropagation()}},i.canvas=r.canvas(),i.conicGradientSupport=!!i.canvas.context.createConicGradient}Object.assign(r,{canvas:(t,e)=>new N(t,e),image:t=>new d(t)}),i.name="web",i.isMobile="ontouchstart"in window,i.requestRender=function(t){window.requestAnimationFrame(t)},i.devicePixelRatio=Math.max(1,devicePixelRatio);const{userAgent:j}=navigator;j.indexOf("Firefox")>-1?(i.conicGradientRotate90=!0,i.intWheelDeltaY=!0,i.syncDomFont=!0):j.indexOf("Safari")>-1&&-1===j.indexOf("Chrome")&&(i.fullImageShadow=!0),j.indexOf("Windows")>-1?(i.os="Windows",i.intWheelDeltaY=!0):j.indexOf("Mac")>-1?i.os="Mac":j.indexOf("Linux")>-1&&(i.os="Linux");class q{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const t=new h;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 h,this.target=t,e&&(this.config=n.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(c.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 h,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(p.CHANGE,this.__onAttrChange,this),t.on_([u.ADD,u.REMOVE],this.__onChildEvent,this),t.on_(f.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:H,updateBounds:Q,updateAllWorldOpacity:J}=g,{pushAllChildBranch:Z,pushAllParent:$}=_;const{worldBounds:K}=y,tt={x:0,y:0,width:1e5,height:1e5};class et{constructor(t){this.updatedBounds=new w,this.beforeBounds=new w,this.afterBounds=new w,t instanceof Array&&(t=new h(t)),this.updatedList=t}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,K)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(tt):this.afterBounds.setListWithFn(t,K),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:it,updateAllChange:nt}=g,st=t.get("Layouter");class ot{constructor(t,e){this.totalTimes=0,this.config={},this.__levelList=new m,this.target=t,e&&(this.config=n.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.running)return;const{target:t}=this;this.times=0;try{t.emit(v.START),this.layoutOnce(),t.emitEvent(new v(v.END,this.layoutedBlocks,this.times))}catch(t){st.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?st.warn("layouting"):this.times>3?st.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=x.start("PartLayout"),{target:i,__updatedList:n}=this,{BEFORE:s,LAYOUT:o,AFTER:a}=v,r=this.getBlocks(n);r.forEach((t=>t.setBefore())),i.emitEvent(new v(s,r,this.times)),this.extraBlock=null,n.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(H(t,!0),e.add(t),t.isBranch&&Z(t,e),$(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),$(t,e)))}))}(n,this.__levelList),function(t){let e,i,n;t.sort(!0),t.levels.forEach((s=>{e=t.levelMap[s];for(let t=0,s=e.length;t<s;t++){if(i=e[t],i.isBranch&&i.__tempNumber){n=i.children;for(let t=0,e=n.length;t<e;t++)n[t].isBranch||Q(n[t])}Q(i)}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&J(t),t.__updateChange()}))}(n),this.extraBlock&&r.push(this.extraBlock),r.forEach((t=>t.setAfter())),i.emitEvent(new v(o,r,this.times)),i.emitEvent(new v(a,r,this.times)),this.addBlocks(r),this.__levelList.reset(),this.__updatedList=null,x.end(e)}fullLayout(){const t=x.start("FullLayout"),{target:e}=this,{BEFORE:i,LAYOUT:n,AFTER:s}=v,o=this.getBlocks(new h(e));e.emitEvent(new v(i,o,this.times)),ot.fullLayout(e),o.forEach((t=>{t.setAfter()})),e.emitEvent(new v(n,o,this.times)),e.emitEvent(new v(s,o,this.times)),this.addBlocks(o),x.end(t)}static fullLayout(t){it(t,!0),t.isBranch?_.updateBounds(t):g.updateBounds(t),nt(t)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:i}=this.extraBlock||(this.extraBlock=new et([]));e.length?i.add(t.__world):i.set(t.__world),e.add(t)}}createBlock(t){return new et(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(){const{target:t}=this;this.__eventIds=[t.on_(v.REQUEST,this.layout,this),t.on_(v.AGAIN,this.layoutAgain,this),t.on_(f.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const at=t.get("Renderer");class rt{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=n.default(i,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(v.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new w,at.log(e.innerName,"---\x3e");try{this.emitRender(c.START),this.renderOnce(t),this.emitRender(c.END,this.totalBounds),b.clearRecycled()}catch(t){this.rendering=!1,at.error(t)}at.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){if(this.rendering)return at.warn("rendering");if(this.times>3)return at.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new w,this.renderOptions={},t)this.emitRender(c.BEFORE),t();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(c.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(c.RENDER,this.renderBounds,this.renderOptions),this.emitRender(c.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;if(!e)return at.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(e){const i=x.start("PartRender"),{canvas:n}=this,s=e.getIntersect(n.bounds),o=e.includes(this.target.__world),a=new w(s);n.save(),o&&!t.showRepaint?n.clear():(s.spread(1+1/this.canvas.pixelRatio).ceil(),n.clearWorld(s,!0),n.clipWorld(s,!0)),this.__render(s,o,a),n.restore(),x.end(i)}fullRender(){const t=x.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds,!0),e.restore(),x.end(t)}__render(e,i,n){const s=e.includes(this.target.__world)?{includes:i}:{bounds:e,includes:i};this.needFill&&this.canvas.fillWorld(e,this.config.fill),t.showRepaint&&this.canvas.strokeWorld(e,"red"),this.target.__render(this.canvas,s),this.renderBounds=n||e,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),t.showHitView&&this.renderHitView(s),t.showBoundsView&&this.renderBoundsView(s),this.canvas.updateRender()}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new w;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=Date.now();i.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.running&&(this.target.emit(B.FRAME),this.changed&&this.canvas.view&&this.render(),this.target.emit(c.NEXT)),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal){if(t.bigger||!t.samePixelRatio){const{width:e,height:i}=t.old;if(!new w(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 w(0,0,1,1)),this.changed=!0}}__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||at.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 c(t,this.times,e,i))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(c.REQUEST,this.update,this),t.on_(v.END,this.__onLayoutEnd,this),t.on_(c.AGAIN,this.renderAgain,this),t.on_(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)}}function dt(t,e){let i;const{rows:n,decorationY:s,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=n.length;t<a;t++)i=n[t],i.text?e.fillText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.fillText(t.char,t.x,i.y)})),s&&e.fillRect(i.x,i.y+s,i.width,o)}function lt(t,e,i){const{strokeAlign:n}=e.__,s="string"!=typeof t;switch(n){case"center":i.setStroke(s?void 0:t,e.__.strokeWidth,e.__),s?ut(t,!0,e,i):ct(e,i);break;case"inside":ht("inside",t,s,e,i);break;case"outside":ht("outside",t,s,e,i)}}function ht(t,e,i,n,s){const{__strokeWidth:o,__font:a}=n.__,r=s.getSameCanvas(!0,!0);r.setStroke(i?void 0:e,2*o,n.__),r.font=a,i?ut(e,!0,n,r):ct(n,r),r.blendMode="outside"===t?"destination-out":"destination-in",dt(n,r),r.blendMode="normal",n.__worldFlipped?s.copyWorldByReset(r,n.__nowWorld):s.copyWorldToInner(r,n.__nowWorld,n.__layout.renderBounds),r.recycle(n.__nowWorld)}function ct(t,e){let i;const{rows:n,decorationY:s,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=n.length;t<a;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)})),s&&e.strokeRect(i.x,i.y+s,i.width,o)}function ut(t,e,i,n){let s;for(let o=0,a=t.length;o<a;o++)s=t[o],s.image&&T.checkImage(i,n,s,!1)||s.style&&(n.strokeStyle=s.style,s.blendMode?(n.saveBlendMode(s.blendMode),e?ct(i,n):n.stroke(),n.restoreBlendMode()):e?ct(i,n):n.stroke())}Object.assign(r,{watcher:(t,e)=>new q(t,e),layouter:(t,e)=>new ot(t,e),renderer:(t,e,i)=>new rt(t,e,i),selector:(t,e)=>{},interaction:(t,e,i,n)=>{}}),i.layout=ot.fullLayout;const{getSpread:ft,getOuterOf:pt,getByMove:gt,getIntersectData:_t}=R;let wt;function yt(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:n}=i.__layout;switch(e.type){case"solid":let{type:s,blendMode:o,color:a,opacity:r}=e;return{type:s,blendMode:o,style:M.string(a,r)};case"image":return T.image(i,t,e,n,!wt||!wt[e.url]);case"linear":return D.linearGradient(e,n);case"radial":return D.radialGradient(e,n);case"angular":return D.conicGradient(e,n);default:return e.r?{type:"solid",style:M.string(e)}:void 0}}const mt={compute:function(t,e){const i=e.__,n=[];let s,o=i.__input[t];o instanceof Array||(o=[o]),wt=T.recycleImage(t,i);for(let i,s=0,a=o.length;s<a;s++)i=yt(t,o[s],e),i&&n.push(i);i["_"+t]=n.length?n:void 0,n.length&&n[0].image&&(s=n[0].image.hasOpacityPixel),"fill"===t?i.__pixelFill=s:i.__pixelStroke=s},fill:function(t,e,i){i.fillStyle=t,e.__.__font?dt(e,i):e.__.windingRule?i.fill(e.__.windingRule):i.fill()},fills:function(t,e,i){let n;const{windingRule:s,__font:o}=e.__;for(let a=0,r=t.length;a<r;a++)n=t[a],n.image&&T.checkImage(e,i,n,!o)||n.style&&(i.fillStyle=n.style,n.transform?(i.save(),i.transform(n.transform),n.blendMode&&(i.blendMode=n.blendMode),o?dt(e,i):s?i.fill(s):i.fill(),i.restore()):n.blendMode?(i.saveBlendMode(n.blendMode),o?dt(e,i):s?i.fill(s):i.fill(),i.restoreBlendMode()):o?dt(e,i):s?i.fill(s):i.fill())},fillText:dt,stroke:function(t,e,i){const n=e.__,{__strokeWidth:s,strokeAlign:o,__font:a}=n;if(s)if(a)lt(t,e,i);else switch(o){case"center":i.setStroke(t,s,n),i.stroke();break;case"inside":i.save(),i.setStroke(t,2*s,n),n.windingRule?i.clip(n.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const o=i.getSameCanvas(!0,!0);o.setStroke(t,2*s,n),e.__drawRenderPath(o),o.stroke(),n.windingRule?o.clip(n.windingRule):o.clip(),o.clearWorld(e.__layout.renderBounds),e.__worldFlipped?i.copyWorldByReset(o,e.__nowWorld):i.copyWorldToInner(o,e.__nowWorld,e.__layout.renderBounds),o.recycle(e.__nowWorld)}},strokes:function(t,e,i){const n=e.__,{__strokeWidth:s,strokeAlign:o,__font:a}=n;if(s)if(a)lt(t,e,i);else switch(o){case"center":i.setStroke(void 0,s,n),ut(t,!1,e,i);break;case"inside":i.save(),i.setStroke(void 0,2*s,n),n.windingRule?i.clip(n.windingRule):i.clip(),ut(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:o}=e.__layout,a=i.getSameCanvas(!0,!0);e.__drawRenderPath(a),a.setStroke(void 0,2*s,n),ut(t,!1,e,a),n.windingRule?a.clip(n.windingRule):a.clip(),a.clearWorld(o),e.__worldFlipped?i.copyWorldByReset(a,e.__nowWorld):i.copyWorldToInner(a,e.__nowWorld,o),a.recycle(e.__nowWorld)}},strokeText:lt,drawTextStroke:ct,shape:function(t,e,i){const n=e.getSameCanvas(),s=t.__nowWorld;let o,a,r,d,{scaleX:l,scaleY:h}=s;if(l<0&&(l=-l),h<0&&(h=-h),e.bounds.includes(s))d=n,o=r=s;else{const{renderShapeSpread:n}=t.__layout,c=_t(n?ft(e.bounds,l===h?n*l:[n*h,n*l]):e.bounds,s);a=e.bounds.getFitMatrix(c);let{a:u,d:f}=a;if(a.a<1&&(d=e.getSameCanvas(),t.__renderShape(d,i),l*=u,h*=f),r=pt(s,a),o=gt(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(n,i),{canvas:n,matrix:a,bounds:o,worldCanvas:d,shapeBounds:r,scaleX:l,scaleY:h}}};let vt={};const{get:xt,rotateOfOuter:bt,translate:Bt,scaleOfOuter:Rt,scale:kt,rotate:Et}=k;function Lt(t,e,i,n,s,o,a){const r=xt();Bt(r,e.x+i,e.y+n),kt(r,s,o),a&&bt(r,{x:e.x+e.width/2,y:e.y+e.height/2},a),t.transform=r}function St(t,e,i,n,s,o,a){const r=xt();Bt(r,e.x+i,e.y+n),s&&kt(r,s,o),a&&Et(r,a),t.transform=r}function Ot(t,e,i,n,s,o,a,r,d,l){const h=xt();if(d)if("center"===l)bt(h,{x:i/2,y:n/2},d);else switch(Et(h,d),d){case 90:Bt(h,n,0);break;case 180:Bt(h,i,n);break;case 270:Bt(h,0,i)}vt.x=e.x+s,vt.y=e.y+o,Bt(h,vt.x,vt.y),a&&Rt(h,vt,a,r),t.transform=h}const{get:At,translate:Wt}=k,Ct=new w,Tt={};function Mt(t,e,i,n){let{width:s,height:o}=e;i.padding&&(n=Ct.set(n).shrink(i.padding));const{opacity:a,mode:r,align:d,offset:l,scale:h,size:c,rotation:u,blendMode:f,repeat:p}=i,g=n.width===s&&n.height===o;f&&(t.blendMode=f);const _=t.data={mode:r},w="center"!==d&&(u||0)%180==90,y=w?o:s,m=w?s:o;let v,x,b=0,B=0;if(r&&"cover"!==r&&"fit"!==r)c?(v=("number"==typeof c?c:c.width)/s,x=("number"==typeof c?c:c.height)/o):h&&(v="number"==typeof h?h:h.x,x="number"==typeof h?h:h.y);else if(!g||u){const t=n.width/y,e=n.height/m;v=x="fit"===r?Math.min(t,e):Math.max(t,e),b+=(n.width-s*v)/2,B+=(n.height-o*x)/2}if(d){const t={x:b,y:B,width:y,height:m};v&&(t.width*=v,t.height*=x),E.toPoint(d,t,n,Tt,!0),b+=Tt.x,B+=Tt.y}switch(l&&(b+=l.x,B+=l.y),r){case"strench":g||(s=n.width,o=n.height);break;case"normal":case"clip":(b||B||v||u)&&St(_,n,b,B,v,x,u);break;case"repeat":(!g||v||u)&&Ot(_,n,s,o,b,B,v,x,u,d),p||(_.repeat="repeat");break;default:v&&Lt(_,n,b,B,v,x,u)}_.transform||(n.x||n.y)&&(_.transform=At(),Wt(_.transform,n.x,n.y)),v&&"strench"!==r&&(_.scaleX=v,_.scaleY=x),_.width=s,_.height=o,a&&(_.opacity=a),p&&(_.repeat="string"==typeof p?"x"===p?"repeat-x":"repeat-y":"repeat")}let Dt,It=new w;const{isSame:Ft}=R;function Pt(t,e,i,n,s,o){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=n.width/e.pixelRatio,e.__naturalHeight=n.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return s.data||Mt(s,n,i,o),!0}function Vt(t,e){Nt(t,L.LOAD,e)}function zt(t,e){Nt(t,L.LOADED,e)}function Yt(t,e,i){e.error=i,t.forceUpdate("surface"),Nt(t,L.ERROR,e)}function Nt(t,e,i){t.hasEvent(e)&&t.emitEvent(new L(e,i))}function Ut(t,e){const{leafer:i}=t;i&&i.viewReady&&(i.renderer.ignore=e)}const{get:Gt,scale:Xt,copy:jt}=k,{ceil:qt,abs:Ht}=Math;function Qt(t,e,n){let{scaleX:s,scaleY:o}=b.patternLocked?t.__world:t.__nowWorld;const a=s+"-"+o;if(e.patternId===a||t.destroyed)return!1;{s=Ht(s),o=Ht(o);const{image:t,data:r}=e;let d,l,{width:h,height:c,scaleX:u,scaleY:f,opacity:p,transform:g,repeat:_}=r;u&&(l=Gt(),jt(l,g),Xt(l,1/u,1/f),s*=u,o*=f),s*=n,o*=n,h*=s,c*=o;const w=h*c;if(!_&&w>i.image.maxCacheSize)return!1;let y=i.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;y>e&&(y=e)}w>y&&(d=Math.sqrt(w/y)),d&&(s/=d,o/=d,h/=d,c/=d),u&&(s/=u,o/=f),(g||1!==s||1!==o)&&(l||(l=Gt(),g&&jt(l,g)),Xt(l,1/s,1/o));const m=t.getCanvas(qt(h)||1,qt(c)||1,p),v=t.getPattern(m,_||i.origin.noRepeat||"no-repeat",l,e);return e.style=v,e.patternId=a,!0}}function Jt(t,e,i,n){return new(i||(i=Promise))((function(s,o){function a(t){try{d(n.next(t))}catch(t){o(t)}}function r(t){try{d(n.throw(t))}catch(t){o(t)}}function d(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,r)}d((n=n.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:Zt}=Math;const $t={image:function(t,e,i,n,s){let o,a;const r=b.get(i);return Dt&&i===Dt.paint&&Ft(n,Dt.boxBounds)?o=Dt.leafPaint:(o={type:i.type,image:r},Dt=r.use>1?{leafPaint:o,paint:i,boxBounds:It.set(n)}:null),(s||r.loading)&&(a={image:r,attrName:e,attrValue:i}),r.ready?(Pt(t,e,i,r,o,n),s&&(Vt(t,a),zt(t,a))):r.error?s&&Yt(t,a,r.error):(Ut(t,!0),s&&Vt(t,a),o.loadId=r.load((()=>{Ut(t,!1),t.destroyed||(Pt(t,e,i,r,o,n)&&(r.hasOpacityPixel&&(t.__layout.hitCanvasChanged=!0),t.forceUpdate("surface")),zt(t,a)),o.loadId=null}),(e=>{Ut(t,!1),Yt(t,a,e),o.loadId=null}))),o},createData:Mt,fillOrFitMode:Lt,clipMode:St,repeatMode:Ot,createPattern:Qt,checkImage:function(t,e,n,s){const{scaleX:o,scaleY:a}=b.patternLocked?t.__world:t.__nowWorld;if(n.data&&n.patternId!==o+"-"+a){const{data:r}=n;if(s)if(r.repeat)s=!1;else{let{width:t,height:n}=r;t*=Zt(o)*e.pixelRatio,n*=Zt(a)*e.pixelRatio,r.scaleX&&(t*=r.scaleX,n*=r.scaleY),s=t*n>i.image.maxCacheSize}return s?(e.save(),e.clip(),n.blendMode&&(e.blendMode=n.blendMode),r.opacity&&(e.opacity*=r.opacity),r.transform&&e.transform(r.transform),e.drawImage(n.image.view,0,0,r.width,r.height),e.restore(),!0):(!n.style||I.running?Qt(t,n,e.pixelRatio):n.patternTask||(n.patternTask=b.patternTasker.add((()=>Jt(this,void 0,void 0,(function*(){n.patternTask=null,e.bounds.hit(t.__nowWorld)&&Qt(t,n,e.pixelRatio),t.forceUpdate("surface")}))),300)),!1)}return!1},recycleImage:function(t,e){const i=e["_"+t];if(i instanceof Array){let n,s,o,a;for(let r=0,d=i.length;r<d;r++)n=i[r].image,a=n&&n.url,a&&(s||(s={}),s[a]=!0,b.recycle(n),n.loading&&(o||(o=e.__input&&e.__input[t]||[],o instanceof Array||(o=[o])),n.unload(i[r].loadId,!o.some((t=>t.url===a)))));return s}return null}},Kt={x:.5,y:0},te={x:.5,y:1};function ee(t,e,i){let n;for(let s=0,o=e.length;s<o;s++)n=e[s],t.addColorStop(n.offset,M.string(n.color,i))}const{set:ie,getAngle:ne,getDistance:se}=S,{get:oe,rotateOfOuter:ae,scaleOfOuter:re}=k,de={x:.5,y:.5},le={x:.5,y:1},he={},ce={};const{set:ue,getAngle:fe,getDistance:pe}=S,{get:ge,rotateOfOuter:_e,scaleOfOuter:we}=k,ye={x:.5,y:.5},me={x:.5,y:1},ve={},xe={};const be={linearGradient:function(t,e){let{from:n,to:s,type:o,blendMode:a,opacity:r}=t;n||(n=Kt),s||(s=te);const d=i.canvas.createLinearGradient(e.x+n.x*e.width,e.y+n.y*e.height,e.x+s.x*e.width,e.y+s.y*e.height);ee(d,t.stops,r);const l={type:o,style:d};return a&&(l.blendMode=a),l},radialGradient:function(t,e){let{from:n,to:s,type:o,opacity:a,blendMode:r,stretch:d}=t;n||(n=de),s||(s=le);const{x:l,y:h,width:c,height:u}=e;let f;ie(he,l+n.x*c,h+n.y*u),ie(ce,l+s.x*c,h+s.y*u),(c!==u||d)&&(f=oe(),re(f,he,c/u*(d||1),1),ae(f,he,ne(he,ce)+90));const p=i.canvas.createRadialGradient(he.x,he.y,0,he.x,he.y,se(he,ce));ee(p,t.stops,a);const g={type:o,style:p,transform:f};return r&&(g.blendMode=r),g},conicGradient:function(t,e){let{from:n,to:s,type:o,opacity:a,blendMode:r,stretch:d}=t;n||(n=ye),s||(s=me);const{x:l,y:h,width:c,height:u}=e;ue(ve,l+n.x*c,h+n.y*u),ue(xe,l+s.x*c,h+s.y*u);const f=ge(),p=fe(ve,xe);i.conicGradientRotate90?(we(f,ve,c/u*(d||1),1),_e(f,ve,p+90)):(we(f,ve,1,c/u*(d||1)),_e(f,ve,p));const g=i.conicGradientSupport?i.canvas.createConicGradient(0,ve.x,ve.y):i.canvas.createRadialGradient(ve.x,ve.y,0,ve.x,ve.y,pe(ve,xe));ee(g,t.stops,a);const _={type:o,style:g,transform:f};return r&&(_.blendMode=r),_}},{copy:Be,toOffsetOutBounds:Re}=R,ke={},Ee={};function Le(t,e,n,s){const{bounds:o,shapeBounds:a}=s;if(i.fullImageShadow){if(Be(ke,t.bounds),ke.x+=e.x-a.x,ke.y+=e.y-a.y,n){const{matrix:t}=s;ke.x-=(o.x+(t?t.e:0)+o.width/2)*(n-1),ke.y-=(o.y+(t?t.f:0)+o.height/2)*(n-1),ke.width*=n,ke.height*=n}t.copyWorld(s.canvas,t.bounds,ke)}else n&&(Be(ke,e),ke.x-=e.width/2*(n-1),ke.y-=e.height/2*(n-1),ke.width*=n,ke.height*=n),t.copyWorld(s.canvas,a,n?ke:e)}const{toOffsetOutBounds:Se}=R,Oe={};const Ae={shadow:function(t,e,i){let n,s;const{__nowWorld:o,__layout:a}=t,{shadow:r}=t.__,{worldCanvas:d,bounds:l,shapeBounds:h,scaleX:c,scaleY:u}=i,f=e.getSameCanvas(),p=r.length-1;Re(l,Ee),r.forEach(((r,g)=>{f.setWorldShadow(Ee.offsetX+r.x*c,Ee.offsetY+r.y*u,r.blur*c,r.color),s=r.spread?1+2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,Le(f,Ee,s,i),n=l,r.box&&(f.restore(),f.save(),d&&(f.copyWorld(f,l,o,"copy"),n=o),d?f.copyWorld(d,o,o,"destination-out"):f.copyWorld(i.canvas,h,l,"destination-out")),t.__worldFlipped?e.copyWorldByReset(f,n,o,r.blendMode):e.copyWorldToInner(f,n,a.renderBounds,r.blendMode),p&&g<p&&f.clearWorld(n,!0)})),f.recycle(n)},innerShadow:function(t,e,i){let n,s;const{__nowWorld:o,__layout:a}=t,{innerShadow:r}=t.__,{worldCanvas:d,bounds:l,shapeBounds:h,scaleX:c,scaleY:u}=i,f=e.getSameCanvas(),p=r.length-1;Se(l,Oe),r.forEach(((r,g)=>{f.save(),f.setWorldShadow(Oe.offsetX+r.x*c,Oe.offsetY+r.y*u,r.blur*c),s=r.spread?1-2*r.spread/(a.boxBounds.width+2*(a.strokeBoxSpread||0)):0,Le(f,Oe,s,i),f.restore(),d?(f.copyWorld(f,l,o,"copy"),f.copyWorld(d,o,o,"source-out"),n=o):(f.copyWorld(i.canvas,h,l,"source-out"),n=l),f.fillWorld(n,r.color,"source-in"),t.__worldFlipped?e.copyWorldByReset(f,n,o,r.blendMode):e.copyWorldToInner(f,n,a.renderBounds,r.blendMode),p&&g<p&&f.clearWorld(n,!0)})),f.recycle(n)},blur:function(t,e,i){const{blur:n}=t.__;i.setWorldBlur(n*t.__nowWorld.a),i.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),i.filter="none"},backgroundBlur:function(t,e,i){}},{excludeRenderBounds:We}=y;function Ce(t,e,i,n,s,o){switch(e){case"alpha":!function(t,e,i,n){const s=t.__nowWorld;i.resetTransform(),i.opacity=1,i.useMask(n,s),n.recycle(s),Me(t,e,i,1)}(t,i,n,s);break;case"opacity-path":Me(t,i,n,o);break;case"path":i.restore()}}function Te(t){return t.getSameCanvas(!1,!0)}function Me(t,e,i,n){const s=t.__nowWorld;e.resetTransform(),e.opacity=n,e.copyWorld(i,s),i.recycle(s)}F.prototype.__renderMask=function(t,e){let i,n,s,o,a;const{children:r}=this;for(let d=0,l=r.length;d<l;d++)i=r[d],i.__.mask&&(a&&(Ce(this,a,t,s,n,o),n=s=null),"path"===i.__.maskType?(i.opacity<1?(a="opacity-path",o=i.opacity,s||(s=Te(t))):(a="path",t.save()),i.__clip(s||t,e)):(a="alpha",n||(n=Te(t)),s||(s=Te(t)),i.__render(n,e)),"clipping"!==i.__.maskType)||We(i,e)||i.__render(s||t,e);Ce(this,a,t,s,n,o)};const De=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Ie=De+"_#~&*+\\=|≮≯≈≠=…",Fe=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 Pe(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Ve=Pe("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ze=Pe("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Ye=Pe(De),Ne=Pe(Ie),Ue=Pe("- —/~|┆·");var Ge;!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"}(Ge||(Ge={}));const{Letter:Xe,Single:je,Before:qe,After:He,Symbol:Qe,Break:Je}=Ge;function Ze(t){return Ve[t]?Xe:Ue[t]?Je:ze[t]?qe:Ye[t]?He:Ne[t]?Qe:Fe.test(t)?je:Xe}const $e={trimRight(t){const{words:e}=t;let i,n=0,s=e.length;for(let o=s-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)n++,t.width-=i.width;n&&e.splice(s-n,n)}};function Ke(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:ti}=$e,{Letter:ei,Single:ii,Before:ni,After:si,Symbol:oi,Break:ai}=Ge;let ri,di,li,hi,ci,ui,fi,pi,gi,_i,wi,yi,mi,vi,xi,bi,Bi=[];function Ri(t,e){gi&&!pi&&(pi=gi),ri.data.push({char:t,width:e}),li+=e}function ki(){hi+=li,ri.width=li,di.words.push(ri),ri={data:[]},li=0}function Ei(){vi&&(xi.paraNumber++,di.paraStart=!0,vi=!1),gi&&(di.startCharSize=pi,di.endCharSize=gi,pi=0),di.width=hi,bi.width&&ti(di),Bi.push(di),di={words:[]},hi=0}const Li=0,Si=1,Oi=2;const{top:Ai,right:Wi,bottom:Ci,left:Ti}=O;function Mi(t,e,i){const{bounds:n,rows:s}=t;n[e]+=i;for(let t=0;t<s.length;t++)s[t][e]+=i}const Di={getDrawData:function(t,e){"string"!=typeof t&&(t=String(t));let n=0,s=0,o=e.__getInput("width")||0,a=e.__getInput("height")||0;const{textDecoration:r,__font:d,__padding:l}=e;l&&(o&&(n=l[Ti],o-=l[Wi]+l[Ti]),a&&(s=l[Ai],a-=l[Ai]+l[Ci]));const h={bounds:{x:n,y:s,width:o,height:a},rows:[],paraNumber:0,font:i.canvas.font=d};return function(t,e,n){xi=t,Bi=t.rows,bi=t.bounds;const{__letterSpacing:s,paraIndent:o,textCase:a}=n,{canvas:r}=i,{width:d,height:l}=bi;if(d||l||s||"none"!==a){const t="none"!==n.textWrap,i="break"===n.textWrap;vi=!0,wi=null,pi=fi=gi=li=hi=0,ri={data:[]},di={words:[]};for(let n=0,l=e.length;n<l;n++)ui=e[n],"\n"===ui?(li&&ki(),di.paraEnd=!0,Ei(),vi=!0):(_i=Ze(ui),_i===ei&&"none"!==a&&(ui=Ke(ui,a,!li)),fi=r.measureText(ui).width,s&&(s<0&&(gi=fi),fi+=s),yi=_i===ii&&(wi===ii||wi===ei)||wi===ii&&_i!==si,mi=!(_i!==ni&&_i!==ii||wi!==oi&&wi!==si),ci=vi&&o?d-o:d,t&&d&&hi+li+fi>ci&&(i?(li&&ki(),Ei()):(mi||(mi=_i===ei&&wi==si),yi||mi||_i===ai||_i===ni||_i===ii||li+fi>ci?(li&&ki(),Ei()):Ei()))," "===ui&&!0!==vi&&hi+li===0||(_i===ai?(" "===ui&&li&&ki(),Ri(ui,fi),ki()):yi||mi?(li&&ki(),Ri(ui,fi)):Ri(ui,fi)),wi=_i);li&&ki(),hi&&Ei(),Bi.length>0&&(Bi[Bi.length-1].paraEnd=!0)}else e.split("\n").forEach((t=>{xi.paraNumber++,Bi.push({x:o||0,text:t,width:r.measureText(t).width,paraStart:!0})}))}(h,t,e),l&&function(t,e,i,n,s){if(!n)switch(i.textAlign){case"left":Mi(e,"x",t[Ti]);break;case"right":Mi(e,"x",-t[Wi])}if(!s)switch(i.verticalAlign){case"top":Mi(e,"y",t[Ai]);break;case"bottom":Mi(e,"y",-t[Ci])}}(l,h,e,o,a),function(t,e){const{rows:i,bounds:n}=t,{__lineHeight:s,__baseLine:o,__letterSpacing:a,__clipText:r,textAlign:d,verticalAlign:l,paraSpacing:h}=e;let c,u,f,{x:p,y:g,width:_,height:w}=n,y=s*i.length+(h?h*(t.paraNumber-1):0),m=o;if(r&&y>w)y=Math.max(w,s),t.overflow=i.length;else switch(l){case"middle":g+=(w-y)/2;break;case"bottom":g+=w-y}m+=g;for(let o=0,l=i.length;o<l;o++){switch(c=i[o],c.x=p,d){case"center":c.x+=(_-c.width)/2;break;case"right":c.x+=_-c.width}c.paraStart&&h&&o>0&&(m+=h),c.y=m,m+=s,t.overflow>o&&m>y&&(c.isOverflow=!0,t.overflow=o+1),u=c.x,f=c.width,a<0&&(c.width<0?(f=-c.width+e.fontSize+a,u-=f,f+=e.fontSize):f-=a),u<n.x&&(n.x=u),f>n.width&&(n.width=f),r&&_&&_<f&&(c.isOverflow=!0,t.overflow||(t.overflow=i.length))}n.y=g,n.height=y}(h,e),function(t,e,i,n){const{rows:s}=t,{textAlign:o,paraIndent:a,letterSpacing:r}=e;let d,l,h,c,u;s.forEach((t=>{t.words&&(h=a&&t.paraStart?a:0,l=i&&"justify"===o&&t.words.length>1?(i-t.width-h)/(t.words.length-1):0,c=r||t.isOverflow?Li:l>.01?Si:Oi,t.isOverflow&&!r&&(t.textMode=!0),c===Oi?(t.x+=h,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=h,d=t.x,t.data=[],t.words.forEach((e=>{c===Si?(u={char:"",x:d},d=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,d,u)," "!==u.char&&t.data.push(u)):d=function(t,e,i){return t.forEach((t=>{" "!==t.char&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,d,t.data),!t.paraEnd&&l&&(d+=l,t.width+=l)}))),t.words=null)}))}(h,e,o),h.overflow&&function(t,e){const{rows:n,overflow:s}=t;let{textOverflow:o}=e;if(n.splice(s),o&&"show"!==o){let t,a;"hide"===o?o="":"ellipsis"===o&&(o="...");const r=o?i.canvas.measureText(o).width:0,d=e.x+e.width-r;("none"===e.textWrap?n:[n[s-1]]).forEach((e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let n=i;n>-1&&(t=e.data[n],a=t.x+t.width,!(n===i&&a<d));n--){if(a<d&&" "!==t.char){e.data.splice(n+1),e.width-=t.width;break}e.width-=t.width}e.width+=r,e.data.push({char:o,x:a}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(h,e),"none"!==r&&function(t,e){const{fontSize:i}=e;switch(t.decorationHeight=i/11,e.textDecoration){case"under":t.decorationY=.15*i;break;case"delete":t.decorationY=.35*-i}}(h,e),h}};const Ii={string:function(t,e){if("string"==typeof t)return t;let i=void 0===t.a?1:t.a;e&&(i*=e);const n=t.r+","+t.g+","+t.b;return 1===i?"rgb("+n+")":"rgba("+n+","+i+")"}},{setPoint:Fi,addPoint:Pi,toBounds:Vi}=A;const zi={export(t,e,n){return this.running=!0,function(t){Yi||(Yi=new W);return new Promise((e=>{Yi.add((()=>Jt(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((s=>new Promise((o=>{const a=t=>{s(t),o(),this.running=!1};if("json"===e)return a({data:t.toJSON()});if("json"===l.fileType(e))return i.origin.download("data:text/plain;charset=utf-8,"+encodeURIComponent(JSON.stringify(t.toJSON())),e),a({data:!0});const{leafer:d}=t;d?d.waitViewCompleted((()=>Jt(this,void 0,void 0,(function*(){n=l.getExportOptions(n);let i,s,o=1,h=1;const{worldTransform:c,isLeafer:u,isFrame:f}=t,{slice:p,trim:g,onCanvas:_}=n;let y=n.scale||1,m=n.pixelRatio||1;t.isApp&&(y*=m,m=t.app.pixelRatio);const v=n.screenshot||t.isApp,x=u&&v&&void 0===n.fill?t.fill:n.fill,b=l.isOpaqueImage(e)||x,B=new C;if(v)i=!0===v?u?d.canvas.bounds:t.worldRenderBounds:v;else{let e=n.relative||(u?"inner":"local");switch(o=c.scaleX,h=c.scaleY,e){case"inner":B.set(c);break;case"local":B.set(c).divide(t.localTransform),o/=t.scaleX,h/=t.scaleY;break;case"world":o=1,h=1;break;case"page":e=t.leafer;default:B.set(c).divide(t.getTransform(e));const i=e.worldTransform;o/=o/i.scaleX,h/=h/i.scaleY}i=t.getBounds("render",e)}const{x:R,y:k,width:E,height:L}=new w(i).scale(y);let S=r.canvas({width:Math.round(E),height:Math.round(L),pixelRatio:m});const O={matrix:B.scale(1/y).invert().translate(-R,-k).withScale(1/o*y,1/h*y)};if(p&&(t=d,O.bounds=S.bounds),S.save(),f&&void 0!==x){const e=t.get("fill");t.fill="",t.__render(S,O),t.fill=e}else t.__render(S,O);if(S.restore(),g){s=function(t){const{width:e,height:i}=t.view,{data:n}=t.context.getImageData(0,0,e,i);let s,o,a,r=0;for(let t=0;t<n.length;t+=4)0!==n[t+3]&&(s=r%e,o=(r-s)/e,a?Pi(a,s,o):Fi(a={},s,o)),r++;const d=new w;return Vi(a,d),d.scale(1/t.pixelRatio).ceil()}(S);const t=S,{width:e,height:i}=s,n={x:0,y:0,width:e,height:i,pixelRatio:m};S=r.canvas(n),S.copyWorld(t,s,n)}b&&S.fillWorld(S.bounds,x||"#FFFFFF","destination-over"),_&&_(S);const A="canvas"===e?S:yield S.export(e,n);a({data:A,width:S.pixelWidth,height:S.pixelHeight,renderBounds:i,trimBounds:s})})))):a({data:!1})}))))}};let Yi;const Ni=e.prototype,Ui=t.get("@leafer-ui/export");Ni.export=function(t,e){const{quality:i,blob:n}=l.getExportOptions(e);return t.includes(".")?this.saveAs(t,i):n?this.toBlob(t,i):this.toDataURL(t,i)},Ni.toBlob=function(t,e){return new Promise((n=>{i.origin.canvasToBolb(this.view,t,e).then((t=>{n(t)})).catch((t=>{Ui.error(t),n(null)}))}))},Ni.toDataURL=function(t,e){return i.origin.canvasToDataURL(this.view,t,e)},Ni.saveAs=function(t,e){return new Promise((n=>{i.origin.canvasSaveAs(this.view,t,e).then((()=>{n(!0)})).catch((t=>{Ui.error(t),n(!1)}))}))},Object.assign(P,Di),Object.assign(M,Ii),Object.assign(V,mt),Object.assign(T,$t),Object.assign(D,be),Object.assign(z,Ae),Object.assign(I,zi),X();export{ot as Layouter,N as LeaferCanvas,rt as Renderer,q as Watcher,X as useCanvas};
|