@leafer-ui/worker 1.6.7 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.cjs +17 -11
- package/dist/worker.esm.js +17 -11
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +87 -62
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +87 -62
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/worker.js
CHANGED
|
@@ -46,7 +46,7 @@ var LeaferUI = (function (exports) {
|
|
|
46
46
|
};
|
|
47
47
|
const I$2 = IncrementId;
|
|
48
48
|
|
|
49
|
-
const { round: round$3, pow: pow$1, PI: PI$
|
|
49
|
+
const { round: round$3, pow: pow$1, PI: PI$3 } = Math;
|
|
50
50
|
const MathHelper = {
|
|
51
51
|
within(value, min, max) {
|
|
52
52
|
if (typeof min === 'object')
|
|
@@ -142,9 +142,9 @@ var LeaferUI = (function (exports) {
|
|
|
142
142
|
function randInt(num) {
|
|
143
143
|
return Math.round(Math.random() * num);
|
|
144
144
|
}
|
|
145
|
-
const OneRadian = PI$
|
|
146
|
-
const PI2 = PI$
|
|
147
|
-
const PI_2 = PI$
|
|
145
|
+
const OneRadian = PI$3 / 180;
|
|
146
|
+
const PI2 = PI$3 * 2;
|
|
147
|
+
const PI_2 = PI$3 / 2;
|
|
148
148
|
function getPointData() { return { x: 0, y: 0 }; }
|
|
149
149
|
function getBoundsData() { return { x: 0, y: 0, width: 0, height: 0 }; }
|
|
150
150
|
function getMatrixData() { return { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }; }
|
|
@@ -439,7 +439,7 @@ var LeaferUI = (function (exports) {
|
|
|
439
439
|
const M$6 = MatrixHelper;
|
|
440
440
|
|
|
441
441
|
const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3 } = MatrixHelper;
|
|
442
|
-
const { sin: sin$4, cos: cos$4, abs: abs$4, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2
|
|
442
|
+
const { sin: sin$4, cos: cos$4, abs: abs$4, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2 } = Math;
|
|
443
443
|
const PointHelper = {
|
|
444
444
|
defaultPoint: getPointData(),
|
|
445
445
|
tempPoint: {},
|
|
@@ -552,10 +552,11 @@ var LeaferUI = (function (exports) {
|
|
|
552
552
|
getRadianFrom(fromX, fromY, originX, originY, toX, toY, toOriginX, toOriginY) {
|
|
553
553
|
if (toOriginX === undefined)
|
|
554
554
|
toOriginX = originX, toOriginY = originY;
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
const
|
|
558
|
-
|
|
555
|
+
const a = fromX - originX;
|
|
556
|
+
const b = fromY - originY;
|
|
557
|
+
const c = toX - toOriginX;
|
|
558
|
+
const d = toY - toOriginY;
|
|
559
|
+
return Math.atan2(a * d - b * c, a * c + b * d);
|
|
559
560
|
},
|
|
560
561
|
getAtan2(t, to) {
|
|
561
562
|
return atan2$2(to.y - t.y, to.x - t.x);
|
|
@@ -3342,7 +3343,7 @@ var LeaferUI = (function (exports) {
|
|
|
3342
3343
|
const { arcTo } = PathCommandDataHelper;
|
|
3343
3344
|
const PathCorner = {
|
|
3344
3345
|
smooth(data, cornerRadius, _cornerSmoothing) {
|
|
3345
|
-
let command, commandLen;
|
|
3346
|
+
let command, lastCommand, commandLen;
|
|
3346
3347
|
let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
|
|
3347
3348
|
const len = data.length;
|
|
3348
3349
|
const smooth = [];
|
|
@@ -3380,8 +3381,10 @@ var LeaferUI = (function (exports) {
|
|
|
3380
3381
|
lastY = y;
|
|
3381
3382
|
break;
|
|
3382
3383
|
case Z:
|
|
3383
|
-
|
|
3384
|
-
|
|
3384
|
+
if (lastCommand !== Z) {
|
|
3385
|
+
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
|
|
3386
|
+
smooth.push(Z);
|
|
3387
|
+
}
|
|
3385
3388
|
i += 1;
|
|
3386
3389
|
break;
|
|
3387
3390
|
default:
|
|
@@ -3390,6 +3393,7 @@ var LeaferUI = (function (exports) {
|
|
|
3390
3393
|
smooth.push(data[i + j]);
|
|
3391
3394
|
i += commandLen;
|
|
3392
3395
|
}
|
|
3396
|
+
lastCommand = command;
|
|
3393
3397
|
}
|
|
3394
3398
|
if (command !== Z) {
|
|
3395
3399
|
smooth[1] = startX;
|
|
@@ -3886,12 +3890,12 @@ var LeaferUI = (function (exports) {
|
|
|
3886
3890
|
try {
|
|
3887
3891
|
if (transform && pattern.setTransform) {
|
|
3888
3892
|
pattern.setTransform(transform);
|
|
3889
|
-
transform =
|
|
3893
|
+
transform = undefined;
|
|
3890
3894
|
}
|
|
3891
3895
|
}
|
|
3892
3896
|
catch (_a) { }
|
|
3893
3897
|
if (paint)
|
|
3894
|
-
paint
|
|
3898
|
+
DataHelper.stintSet(paint, 'transform', transform);
|
|
3895
3899
|
return pattern;
|
|
3896
3900
|
}
|
|
3897
3901
|
destroy() {
|
|
@@ -3996,10 +4000,14 @@ var LeaferUI = (function (exports) {
|
|
|
3996
4000
|
}));
|
|
3997
4001
|
}
|
|
3998
4002
|
const pathType = boundsType;
|
|
3999
|
-
function affectStrokeBoundsType(defaultValue) {
|
|
4003
|
+
function affectStrokeBoundsType(defaultValue, useStroke) {
|
|
4000
4004
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
4001
4005
|
set(value) {
|
|
4002
|
-
this.__setAttr(key, value)
|
|
4006
|
+
if (this.__setAttr(key, value)) {
|
|
4007
|
+
doStrokeType(this);
|
|
4008
|
+
if (useStroke)
|
|
4009
|
+
this.__.__useStroke = true;
|
|
4010
|
+
}
|
|
4003
4011
|
}
|
|
4004
4012
|
}));
|
|
4005
4013
|
}
|
|
@@ -5425,6 +5433,8 @@ var LeaferUI = (function (exports) {
|
|
|
5425
5433
|
|
|
5426
5434
|
const LeafRender = {
|
|
5427
5435
|
__render(canvas, options) {
|
|
5436
|
+
if (options.shape)
|
|
5437
|
+
return this.__renderShape(canvas, options);
|
|
5428
5438
|
if (this.__worldOpacity) {
|
|
5429
5439
|
const data = this.__;
|
|
5430
5440
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
@@ -5434,12 +5444,10 @@ var LeaferUI = (function (exports) {
|
|
|
5434
5444
|
return this.__renderEraser(canvas, options);
|
|
5435
5445
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
5436
5446
|
this.__draw(tempCanvas, options, canvas);
|
|
5437
|
-
if (this.__worldFlipped)
|
|
5447
|
+
if (this.__worldFlipped)
|
|
5438
5448
|
canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true);
|
|
5439
|
-
|
|
5440
|
-
else {
|
|
5449
|
+
else
|
|
5441
5450
|
canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode);
|
|
5442
|
-
}
|
|
5443
5451
|
tempCanvas.recycle(this.__nowWorld);
|
|
5444
5452
|
}
|
|
5445
5453
|
else {
|
|
@@ -5449,6 +5457,12 @@ var LeaferUI = (function (exports) {
|
|
|
5449
5457
|
Debug.drawBounds(this, canvas, options);
|
|
5450
5458
|
}
|
|
5451
5459
|
},
|
|
5460
|
+
__renderShape(canvas, options) {
|
|
5461
|
+
if (this.__worldOpacity) {
|
|
5462
|
+
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5463
|
+
this.__drawShape(canvas, options);
|
|
5464
|
+
}
|
|
5465
|
+
},
|
|
5452
5466
|
__clip(canvas, options) {
|
|
5453
5467
|
if (this.__worldOpacity) {
|
|
5454
5468
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
@@ -5868,7 +5882,8 @@ var LeaferUI = (function (exports) {
|
|
|
5868
5882
|
__drawFast(_canvas, _options) { }
|
|
5869
5883
|
__draw(_canvas, _options, _originCanvas) { }
|
|
5870
5884
|
__clip(_canvas, _options) { }
|
|
5871
|
-
__renderShape(_canvas, _options
|
|
5885
|
+
__renderShape(_canvas, _options) { }
|
|
5886
|
+
__drawShape(_canvas, _options) { }
|
|
5872
5887
|
__updateWorldOpacity() { }
|
|
5873
5888
|
__updateChange() { }
|
|
5874
5889
|
__drawPath(_canvas) { }
|
|
@@ -6236,7 +6251,7 @@ var LeaferUI = (function (exports) {
|
|
|
6236
6251
|
}
|
|
6237
6252
|
}
|
|
6238
6253
|
|
|
6239
|
-
const version = "1.
|
|
6254
|
+
const version = "1.7.0";
|
|
6240
6255
|
|
|
6241
6256
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6242
6257
|
get allowBackgroundColor() { return true; }
|
|
@@ -7153,13 +7168,9 @@ var LeaferUI = (function (exports) {
|
|
|
7153
7168
|
else
|
|
7154
7169
|
return strokeWidth;
|
|
7155
7170
|
}
|
|
7156
|
-
get __hasStroke() { return this.stroke && this.strokeWidth; }
|
|
7157
|
-
get __hasHalf() { const t = this; return (t.stroke && t.strokeAlign === 'center' && t.strokeWidth % 2) || undefined; }
|
|
7158
7171
|
get __hasMultiPaint() {
|
|
7159
7172
|
const t = this;
|
|
7160
|
-
|
|
7161
|
-
return true;
|
|
7162
|
-
return t.fill && this.__hasStroke;
|
|
7173
|
+
return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect;
|
|
7163
7174
|
}
|
|
7164
7175
|
get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
|
|
7165
7176
|
get __hasSurface() { const t = this; return (t.fill || t.stroke); }
|
|
@@ -7450,15 +7461,18 @@ var LeaferUI = (function (exports) {
|
|
|
7450
7461
|
const UIRender = {
|
|
7451
7462
|
__updateChange() {
|
|
7452
7463
|
const data = this.__;
|
|
7464
|
+
if (data.__useStroke) {
|
|
7465
|
+
const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
|
|
7466
|
+
stintSet$1(this.__world, 'half', useStroke && data.strokeAlign === 'center' && data.strokeWidth % 2);
|
|
7467
|
+
stintSet$1(data, '__fillAfterStroke', useStroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7468
|
+
}
|
|
7453
7469
|
if (data.__useEffect) {
|
|
7454
7470
|
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7455
7471
|
stintSet$1(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !(shadow[0].box && data.__isTransparentFill) && fill && !(fill instanceof Array && fill.length > 1) && (this.useFastShadow || !stroke || (stroke && data.strokeAlign === 'inside')));
|
|
7456
7472
|
data.__useEffect = !!(shadow || otherEffect);
|
|
7457
7473
|
}
|
|
7458
|
-
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7459
|
-
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7460
7474
|
data.__checkSingle();
|
|
7461
|
-
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7475
|
+
stintSet$1(data, '__complex', (data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect));
|
|
7462
7476
|
},
|
|
7463
7477
|
__drawFast(canvas, options) {
|
|
7464
7478
|
drawFast(this, canvas, options);
|
|
@@ -7516,18 +7530,15 @@ var LeaferUI = (function (exports) {
|
|
|
7516
7530
|
this.__drawFast(canvas, options);
|
|
7517
7531
|
}
|
|
7518
7532
|
},
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
this.
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
if (stroke && !ignoreStroke)
|
|
7529
|
-
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7530
|
-
}
|
|
7533
|
+
__drawShape(canvas, options) {
|
|
7534
|
+
this.__drawRenderPath(canvas);
|
|
7535
|
+
const data = this.__, { fill, stroke } = data;
|
|
7536
|
+
if (fill && !options.ignoreFill)
|
|
7537
|
+
data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7538
|
+
if (data.__isCanvas)
|
|
7539
|
+
this.__drawAfterFill(canvas, options);
|
|
7540
|
+
if (stroke && !options.ignoreStroke)
|
|
7541
|
+
data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7531
7542
|
},
|
|
7532
7543
|
__drawAfterFill(canvas, options) {
|
|
7533
7544
|
if (this.__.__clipAfterFill) {
|
|
@@ -7652,12 +7663,14 @@ var LeaferUI = (function (exports) {
|
|
|
7652
7663
|
}
|
|
7653
7664
|
}
|
|
7654
7665
|
__updateRenderPath() {
|
|
7655
|
-
|
|
7656
|
-
|
|
7666
|
+
const data = this.__;
|
|
7667
|
+
if (data.path) {
|
|
7657
7668
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
7658
7669
|
if (data.__useArrow)
|
|
7659
7670
|
PathArrow.addArrows(this, !data.cornerRadius);
|
|
7660
7671
|
}
|
|
7672
|
+
else
|
|
7673
|
+
data.__pathForRender && (data.__pathForRender = undefined);
|
|
7661
7674
|
}
|
|
7662
7675
|
__drawRenderPath(canvas) {
|
|
7663
7676
|
canvas.beginPath();
|
|
@@ -7868,13 +7881,13 @@ var LeaferUI = (function (exports) {
|
|
|
7868
7881
|
surfaceType()
|
|
7869
7882
|
], exports.UI.prototype, "fill", void 0);
|
|
7870
7883
|
__decorate([
|
|
7871
|
-
strokeType()
|
|
7884
|
+
strokeType(undefined, true)
|
|
7872
7885
|
], exports.UI.prototype, "stroke", void 0);
|
|
7873
7886
|
__decorate([
|
|
7874
7887
|
strokeType('inside')
|
|
7875
7888
|
], exports.UI.prototype, "strokeAlign", void 0);
|
|
7876
7889
|
__decorate([
|
|
7877
|
-
strokeType(1)
|
|
7890
|
+
strokeType(1, true)
|
|
7878
7891
|
], exports.UI.prototype, "strokeWidth", void 0);
|
|
7879
7892
|
__decorate([
|
|
7880
7893
|
strokeType(false)
|
|
@@ -8301,7 +8314,7 @@ var LeaferUI = (function (exports) {
|
|
|
8301
8314
|
list.push(item);
|
|
8302
8315
|
this.requestRender();
|
|
8303
8316
|
}
|
|
8304
|
-
zoom(_zoomType,
|
|
8317
|
+
zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
|
|
8305
8318
|
return Plugin.need('view');
|
|
8306
8319
|
}
|
|
8307
8320
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
@@ -8346,7 +8359,7 @@ var LeaferUI = (function (exports) {
|
|
|
8346
8359
|
Leafer_1.list.remove(this);
|
|
8347
8360
|
try {
|
|
8348
8361
|
this.stop();
|
|
8349
|
-
this.
|
|
8362
|
+
this.emitLeafer(LeaferEvent.END);
|
|
8350
8363
|
this.__removeListenEvents();
|
|
8351
8364
|
this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
|
|
8352
8365
|
this.__controllers.length = 0;
|
|
@@ -8474,7 +8487,7 @@ var LeaferUI = (function (exports) {
|
|
|
8474
8487
|
}
|
|
8475
8488
|
__drawContent(canvas, options) {
|
|
8476
8489
|
this.__renderGroup(canvas, options);
|
|
8477
|
-
if (this.__.
|
|
8490
|
+
if (this.__.__useStroke) {
|
|
8478
8491
|
canvas.setWorld(this.__nowWorld);
|
|
8479
8492
|
this.__drawRenderPath(canvas);
|
|
8480
8493
|
}
|
|
@@ -8694,8 +8707,8 @@ var LeaferUI = (function (exports) {
|
|
|
8694
8707
|
for (let i = 1; i < sides; i++) {
|
|
8695
8708
|
lineTo$1(path, rx + rx * sin$1((i * 2 * PI$1) / sides), ry - ry * cos$1((i * 2 * PI$1) / sides));
|
|
8696
8709
|
}
|
|
8710
|
+
closePath$1(path);
|
|
8697
8711
|
}
|
|
8698
|
-
closePath$1(path);
|
|
8699
8712
|
}
|
|
8700
8713
|
__updateRenderPath() { }
|
|
8701
8714
|
__updateBoxBounds() { }
|
|
@@ -8933,6 +8946,11 @@ var LeaferUI = (function (exports) {
|
|
|
8933
8946
|
return;
|
|
8934
8947
|
super.__draw(canvas, options, originCanvas);
|
|
8935
8948
|
}
|
|
8949
|
+
__drawShape(canvas, options) {
|
|
8950
|
+
if (options.shape)
|
|
8951
|
+
this.__box && this.__box.__drawShape(canvas, options);
|
|
8952
|
+
super.__drawShape(canvas, options);
|
|
8953
|
+
}
|
|
8936
8954
|
destroy() {
|
|
8937
8955
|
if (this.boxStyle)
|
|
8938
8956
|
this.boxStyle = null;
|
|
@@ -9754,6 +9772,7 @@ var LeaferUI = (function (exports) {
|
|
|
9754
9772
|
delta: { x: 80 / 4, y: 8.0 },
|
|
9755
9773
|
},
|
|
9756
9774
|
pointer: {
|
|
9775
|
+
type: 'pointer',
|
|
9757
9776
|
snap: true,
|
|
9758
9777
|
hitRadius: 5,
|
|
9759
9778
|
tapTime: 120,
|
|
@@ -10297,7 +10316,7 @@ var LeaferUI = (function (exports) {
|
|
|
10297
10316
|
h.resize({ width, height, pixelRatio: 1 });
|
|
10298
10317
|
h.clear();
|
|
10299
10318
|
ImageManager.patternLocked = true;
|
|
10300
|
-
this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y)
|
|
10319
|
+
this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y), ignoreFill: !isHitPixelFill, ignoreStroke: !isHitPixelStroke });
|
|
10301
10320
|
ImageManager.patternLocked = false;
|
|
10302
10321
|
h.resetTransform();
|
|
10303
10322
|
data.__isHitPixel = true;
|
|
@@ -10701,7 +10720,7 @@ var LeaferUI = (function (exports) {
|
|
|
10701
10720
|
};
|
|
10702
10721
|
|
|
10703
10722
|
let origin = {};
|
|
10704
|
-
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate } = MatrixHelper;
|
|
10723
|
+
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
|
|
10705
10724
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
10706
10725
|
const transform = get$3();
|
|
10707
10726
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -10710,13 +10729,15 @@ var LeaferUI = (function (exports) {
|
|
|
10710
10729
|
rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
10711
10730
|
data.transform = transform;
|
|
10712
10731
|
}
|
|
10713
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
10732
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew) {
|
|
10714
10733
|
const transform = get$3();
|
|
10715
|
-
translate$1(transform, box.x + x, box.y + y);
|
|
10716
|
-
if (scaleX)
|
|
10717
|
-
scaleHelper(transform, scaleX, scaleY);
|
|
10718
10734
|
if (rotation)
|
|
10719
10735
|
rotate(transform, rotation);
|
|
10736
|
+
if (skew)
|
|
10737
|
+
skewHelper(transform, skew.x, skew.y);
|
|
10738
|
+
if (scaleX)
|
|
10739
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
10740
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
10720
10741
|
data.transform = transform;
|
|
10721
10742
|
}
|
|
10722
10743
|
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
@@ -10753,11 +10774,13 @@ var LeaferUI = (function (exports) {
|
|
|
10753
10774
|
const tempScaleData = {};
|
|
10754
10775
|
const tempImage = {};
|
|
10755
10776
|
function createData(leafPaint, image, paint, box) {
|
|
10756
|
-
const { changeful, sync } = paint;
|
|
10777
|
+
const { changeful, sync, editing } = paint;
|
|
10757
10778
|
if (changeful)
|
|
10758
10779
|
leafPaint.changeful = changeful;
|
|
10759
10780
|
if (sync)
|
|
10760
10781
|
leafPaint.sync = sync;
|
|
10782
|
+
if (editing)
|
|
10783
|
+
leafPaint.editing = editing;
|
|
10761
10784
|
leafPaint.data = getPatternData(paint, box, image);
|
|
10762
10785
|
}
|
|
10763
10786
|
function getPatternData(paint, box, image) {
|
|
@@ -10766,7 +10789,7 @@ var LeaferUI = (function (exports) {
|
|
|
10766
10789
|
if (paint.mode === 'strench')
|
|
10767
10790
|
paint.mode = 'stretch';
|
|
10768
10791
|
let { width, height } = image;
|
|
10769
|
-
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
10792
|
+
const { opacity, mode, align, offset, scale, size, rotation, skew, repeat, filters } = paint;
|
|
10770
10793
|
const sameBox = box.width === width && box.height === height;
|
|
10771
10794
|
const data = { mode };
|
|
10772
10795
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
@@ -10800,8 +10823,8 @@ var LeaferUI = (function (exports) {
|
|
|
10800
10823
|
break;
|
|
10801
10824
|
case 'normal':
|
|
10802
10825
|
case 'clip':
|
|
10803
|
-
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
10804
|
-
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10826
|
+
if (tempImage.x || tempImage.y || scaleX || rotation || skew)
|
|
10827
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew);
|
|
10805
10828
|
break;
|
|
10806
10829
|
case 'repeat':
|
|
10807
10830
|
if (!sameBox || scaleX || rotation)
|
|
@@ -10878,11 +10901,11 @@ var LeaferUI = (function (exports) {
|
|
|
10878
10901
|
}
|
|
10879
10902
|
onLoadSuccess(ui, event);
|
|
10880
10903
|
}
|
|
10881
|
-
leafPaint.loadId =
|
|
10904
|
+
leafPaint.loadId = undefined;
|
|
10882
10905
|
}, (error) => {
|
|
10883
10906
|
ignoreRender(ui, false);
|
|
10884
10907
|
onLoadError(ui, event, error);
|
|
10885
|
-
leafPaint.loadId =
|
|
10908
|
+
leafPaint.loadId = undefined;
|
|
10886
10909
|
});
|
|
10887
10910
|
if (ui.placeholderColor) {
|
|
10888
10911
|
if (!ui.placeholderDelay)
|
|
@@ -10948,6 +10971,8 @@ var LeaferUI = (function (exports) {
|
|
|
10948
10971
|
const { image, data } = paint;
|
|
10949
10972
|
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
|
|
10950
10973
|
if (sx) {
|
|
10974
|
+
sx = abs$1(sx);
|
|
10975
|
+
sy = abs$1(sy);
|
|
10951
10976
|
imageMatrix = get$1();
|
|
10952
10977
|
copy$1(imageMatrix, transform);
|
|
10953
10978
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
package/dist/worker.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("@leafer/core"),e=require("@leafer-ui/core"),n=require("@leafer-ui/draw");class i extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:n}=this;this.view.width=Math.ceil(t*n),this.view.height=Math.ceil(e*n),this.clientBounds=this.bounds}}t.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype);const{mineType:a}=t.FileHelper;function r(e,n){t.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,n)=>new Promise(((i,r)=>{t.convertToBlob({type:a(e),quality:n}).then((t=>{var e=new FileReader;e.onload=t=>i(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)})).catch((t=>{r(t)}))})),canvasToBolb:(t,e,n)=>t.convertToBlob({type:a(e),quality:n}),canvasSaveAs:(t,e,n)=>new Promise((t=>t())),download(t,e){},loadImage:e=>new Promise(((n,i)=>{let a=new XMLHttpRequest;a.open("GET",t.Platform.image.getRealURL(e),!0),a.responseType="blob",a.onload=()=>{createImageBitmap(a.response).then((t=>{n(t)})).catch((t=>{i(t)}))},a.onerror=t=>i(t),a.send()}))},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new i(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isWorker=!0,t.Platform.backgrounder=!0,t.Platform.requestRender=function(t){requestAnimationFrame(t)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:s}=navigator;s.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0):s.indexOf("Safari")>-1&&-1===s.indexOf("Chrome")&&(t.Platform.fullImageShadow=!0),s.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):s.indexOf("Mac")>-1?t.Platform.os="Mac":s.indexOf("Linux")>-1&&(t.Platform.os="Linux");class o{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(e,n){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,n&&(this.config=t.DataHelper.default(n,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(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,n=e.length;t<n;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[t.PropertyEvent.CHANGE,this.__onAttrChange,this],[[t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this],[t.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:l,updateBounds:d,updateChange:h}=t.LeafHelper,{pushAllChildBranch:c,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper;class p{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,e instanceof Array&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,f),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:g,updateAllChange:_}=t.LeafHelper,y=t.Debug.get("Layouter");class m{constructor(e,n){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,n&&(this.config=t.DataHelper.default(n,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:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){y.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?y.warn("layouting"):this.times>3?y.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const n=t.Run.start("PartLayout"),{target:i,__updatedList:a}=this,{BEFORE:r,LAYOUT:s,AFTER:o}=t.LayoutEvent,f=this.getBlocks(a);f.forEach((t=>t.setBefore())),i.emitEvent(new t.LayoutEvent(r,f,this.times)),this.extraBlock=null,a.sort(),function(t,e){let n;t.list.forEach((t=>{n=t.__layout,e.without(t)&&!n.proxyZoom&&(n.matrixChanged?(l(t,!0),e.add(t),t.isBranch&&c(t,e),u(t,e)):n.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))}))}(a,this.__levelList),function(t){let e,n,i;t.sort(!0),t.levels.forEach((a=>{e=t.levelMap[a];for(let t=0,a=e.length;t<a;t++){if(n=e[t],n.isBranch&&n.__tempNumber){i=n.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||d(i[t])}d(n)}}))}(this.__levelList),function(t){t.list.forEach(h)}(a),this.extraBlock&&f.push(this.extraBlock),f.forEach((t=>t.setAfter())),i.emitEvent(new t.LayoutEvent(s,f,this.times)),i.emitEvent(new t.LayoutEvent(o,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(n)}fullLayout(){const e=t.Run.start("FullLayout"),{target:n}=this,{BEFORE:i,LAYOUT:a,AFTER:r}=t.LayoutEvent,s=this.getBlocks(new t.LeafList(n));n.emitEvent(new t.LayoutEvent(i,s,this.times)),m.fullLayout(n),s.forEach((t=>{t.setAfter()})),n.emitEvent(new t.LayoutEvent(a,s,this.times)),n.emitEvent(new t.LayoutEvent(r,s,this.times)),this.addBlocks(s),t.Run.end(e)}static fullLayout(e){g(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:n}=this.extraBlock||(this.extraBlock=new p([]));e.length?n.add(t.__world):n.set(t.__world),e.add(t)}}createBlock(t){return new p(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_([[t.LayoutEvent.REQUEST,this.layout,this],[t.LayoutEvent.AGAIN,this.layoutAgain,this],[t.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const w=t.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,n,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=n,i&&(this.config=t.DataHelper.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(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:n}=this;this.times=0,this.totalBounds=new t.Bounds,w.log(n.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,w.error(t)}w.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return w.warn("rendering");if(this.times>3)return w.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.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(e){const n=t.Run.start("PartRender"),{canvas:i}=this,a=e.getIntersect(i.bounds),r=new t.Bounds(a);i.save(),a.spread(v.clipSpread).ceil(),i.clearWorld(a,!0),i.clipWorld(a,!0),this.__render(a,r),i.restore(),t.Run.end(n)}fullRender(){const e=t.Run.start("FullRender"),{canvas:n}=this;n.save(),n.clear(),this.__render(n.bounds),n.restore(),t.Run.end(e)}__render(e,n){const{canvas:i}=this,a=e.includes(this.target.__world),r=a?{includes:a}:{bounds:e,includes:a};this.needFill&&i.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(i,e),this.target.__render(i,r),this.renderBounds=n=n||e,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=n:this.totalBounds.add(n),i.updateRender(n)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const n=new t.Bounds;n.setList(e),e.length=0,e.push(n)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const n=this.requestTime=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-n))),this.requestTime=0,this.checkRender()}))}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:n,height:i}=e.old;if(!new t.Bounds(0,0,n,i).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(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||w.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(e,n,i){this.target.emitEvent(new t.RenderEvent(e,this.times,n,i))}__listenEvents(){this.__eventIds=[this.target.on_([[t.RenderEvent.REQUEST,this.update,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.AGAIN,this.renderAgain,this],[t.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}v.clipSpread=10;const{hitRadiusPoint:x}=t.BoundsHelper;class b{constructor(t,e){this.target=t,this.selector=e}getByPoint(e,n,i){n||(n=0),i||(i={});const a=i.through||!1,r=i.ignoreHittable||!1,s=i.target||this.target;this.exclude=i.exclude||null,this.point={x:e.x,y:e.y,radiusX:n,radiusY:n},this.findList=new t.LeafList(i.findList),i.findList||this.hitBranch(s);const{list:o}=this.findList,l=this.getBestMatchLeaf(o,i.bottomList,r),d=r?this.getPath(l):this.getHitablePath(l);return this.clear(),a?{path:d,target:l,throughPath:o.length?this.getThroughPath(o):d}:{path:d,target:l}}getBestMatchLeaf(e,n,i){if(e.length){let n;this.findList=new t.LeafList;const{x:a,y:r}=this.point,s={x:a,y:r,radiusX:0,radiusY:0};for(let a=0,r=e.length;a<r;a++)if(n=e[a],(i||t.LeafHelper.worldHittable(n))&&(this.hitChild(n,s),this.findList.length))return this.findList.list[0]}if(n)for(let t=0,e=n.length;t<e;t++)if(this.hitChild(n[t].target,this.point,n[t].proxy),this.findList.length)return this.findList.list[0];return e[0]}getPath(e){const n=new t.LeafList;for(;e;)n.add(e),e=e.parent;return this.target&&n.add(this.target),n}getHitablePath(e){const n=this.getPath(e&&e.hittable?e:null);let i,a=new t.LeafList;for(let t=n.list.length-1;t>-1&&(i=n.list[t],i.__.hittable)&&(a.addAt(i,0),i.__.hitChildren);t--);return a}getThroughPath(e){const n=new t.LeafList,i=[];for(let t=e.length-1;t>-1;t--)i.push(this.getPath(e[t]));let a,r,s;for(let t=0,e=i.length;t<e;t++){a=i[t],r=i[t+1];for(let t=0,e=a.length;t<e&&(s=a.list[t],!r||!r.has(s));t++)n.add(s)}return n}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let n,i;const{point:a}=this;for(let r=t.length-1;r>-1;r--)n=t[r],!n.__.visible||e&&!n.__.mask||(i=!!n.__.hitRadius||x(n.__world,a),n.isBranch?(i||n.__ignoreHitWorld)&&(this.eachFind(n.children,n.__onlyHitMask),n.isBranchLeaf&&this.hitChild(n,a)):i&&this.hitChild(n,a))}hitChild(t,e,n){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:i}=t;if(i&&i.__hasMask&&!t.__.mask&&!i.children.some((t=>t.__.mask&&t.__hitWorld(e))))return;this.findList.add(n||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class B{constructor(e,n){this.config={},n&&(this.config=t.DataHelper.default(n,this.config)),this.picker=new b(this.target=e,this),this.finder=t.Creator.finder&&t.Creator.finder()}getByPoint(e,n,i){const{target:a,picker:r}=this;return t.Platform.backgrounder&&a&&a.updateLayout(),r.getByPoint(e,n,i)}getBy(e,n,i,a){return this.finder?this.finder.getBy(e,n,i,a):t.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function E(t,e){const n=t.__,{rows:i,decorationY:a}=n.__textDrawData;let r;n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor);for(let t=0,n=i.length;t<n;t++)r=i[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach((t=>{e.fillText(t.char,t.x,r.y)}));if(a){const{decorationColor:t,decorationHeight:r}=n.__textDrawData;t&&(e.fillStyle=t),i.forEach((t=>a.forEach((n=>e.fillRect(t.x,t.y+n,t.width,r)))))}}function L(t,e){t.__.__font?E(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function R(t,e,n){switch(e.__.strokeAlign){case"center":k(t,1,e,n);break;case"inside":P(t,"inside",e,n);break;case"outside":e.__.__fillAfterStroke?k(t,2,e,n):P(t,"outside",e,n)}}function k(t,e,n,i){const a=n.__;i.setStroke(!a.__isStrokes&&t,a.strokeWidth*e,a),a.__isStrokes?A(t,!0,n,i):C(n,i)}function P(t,e,n,i){const a=i.getSameCanvas(!0,!0);a.font=n.__.__font,k(t,2,n,a),a.blendMode="outside"===e?"destination-out":"destination-in",E(n,a),a.blendMode="normal",S(i,a,n),a.recycle(n.__nowWorld)}function S(e,n,i){i.__worldFlipped||t.Platform.fullImageShadow?e.copyWorldByReset(n,i.__nowWorld):e.copyWorldToInner(n,i.__nowWorld,i.__layout.renderBounds)}function C(t,e){let n,i=t.__.__textDrawData;const{rows:a,decorationY:r}=i;for(let t=0,i=a.length;t<i;t++)n=a[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.strokeText(t.char,t.x,n.y)}));if(r){const{decorationHeight:t}=i;a.forEach((n=>r.forEach((i=>e.strokeRect(n.x,n.y+i,n.width,t)))))}}function A(t,e,i,a){let r;for(let s=0,o=t.length;s<o;s++)r=t[s],r.image&&n.PaintImage.checkImage(i,a,r,!1)||r.style&&(a.strokeStyle=r.style,r.blendMode?(a.saveBlendMode(r.blendMode),e?C(i,a):a.stroke(),a.restoreBlendMode()):e?C(i,a):a.stroke())}function O(t,e,n){const i=e.__;if(i.__strokeWidth)if(i.__font)R(t,e,n);else switch(i.strokeAlign){case"center":T(t,1,e,n);break;case"inside":!function(t,e,n){n.save(),n.clipUI(e),T(t,2,e,n),n.restore()}(t,e,n);break;case"outside":!function(t,e,n){const i=e.__;if(i.__fillAfterStroke)T(t,2,e,n);else{const{renderBounds:a}=e.__layout,r=n.getSameCanvas(!0,!0);e.__drawRenderPath(r),T(t,2,e,r),r.clipUI(i),r.clearWorld(a),S(n,r,e),r.recycle(e.__nowWorld)}}(t,e,n)}}function T(t,e,i,a){const r=i.__;a.setStroke(!r.__isStrokes&&t,r.__strokeWidth*e,r),r.__isStrokes?A(t,!1,i,a):a.stroke(),r.__useArrow&&n.Paint.strokeArrow(t,i,a)}Object.assign(t.Creator,{watcher:(t,e)=>new o(t,e),layouter:(t,e)=>new m(t,e),renderer:(t,e,n)=>new v(t,e,n),selector:(t,e)=>new B(t,e)}),t.Platform.layout=m.fullLayout;const{getSpread:W,getOuterOf:M,getByMove:I,getIntersectData:D}=t.BoundsHelper;let H;const{stintSet:F}=t.DataHelper,{hasTransparent:G}=n.ColorConvert;function j(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;let a;const{boxBounds:r}=i.__layout;switch(e.type){case"image":a=n.PaintImage.image(i,t,e,r,!H||!H[e.url]);break;case"linear":a=n.PaintGradient.linearGradient(e,r);break;case"radial":a=n.PaintGradient.radialGradient(e,r);break;case"angular":a=n.PaintGradient.conicGradient(e,r);break;case"solid":const{type:s,color:o,opacity:l}=e;a={type:s,style:n.ColorConvert.string(o,l)};break;default:void 0!==e.r&&(a={type:"solid",style:n.ColorConvert.string(e)})}return a&&("string"==typeof a.style&&G(a.style)&&(a.isTransparent=!0),e.blendMode&&(a.blendMode=e.blendMode)),a}const Y={compute:function(t,e){const i=e.__,a=[];let r,s,o=i.__input[t];o instanceof Array||(o=[o]),H=n.PaintImage.recycleImage(t,i);for(let n,i=0,r=o.length;i<r;i++)(n=j(t,o[i],e))&&a.push(n);i["_"+t]=a.length?a:void 0,a.length&&a.every((t=>t.isTransparent))&&(a.some((t=>t.image))&&(r=!0),s=!0),"fill"===t?(F(i,"__isAlphaPixelFill",r),F(i,"__isTransparentFill",s)):(F(i,"__isAlphaPixelStroke",r),F(i,"__isTransparentStroke",s))},fill:function(t,e,n){n.fillStyle=t,L(e,n)},fills:function(t,e,i){let a;for(let r=0,s=t.length;r<s;r++){if(a=t[r],a.image){if(n.PaintImage.checkImage(e,i,a,!e.__.__font))continue;if(!a.style){!r&&a.image.isPlacehold&&e.drawImagePlaceholder(i,a.image);continue}}i.fillStyle=a.style,a.transform?(i.save(),i.transform(a.transform),a.blendMode&&(i.blendMode=a.blendMode),L(e,i),i.restore()):a.blendMode?(i.saveBlendMode(a.blendMode),L(e,i),i.restoreBlendMode()):L(e,i)}},fillPathOrText:L,fillText:E,stroke:O,strokes:function(t,e,n){O(t,e,n)},strokeText:R,drawTextStroke:C,shape:function(t,e,n){const i=e.getSameCanvas(),a=t.__nowWorld;let r,s,o,l,{scaleX:d,scaleY:h}=a;if(d<0&&(d=-d),h<0&&(h=-h),e.bounds.includes(a))l=i,r=o=a;else{const{renderShapeSpread:i}=t.__layout,c=D(i?W(e.bounds,d===h?i*d:[i*h,i*d]):e.bounds,a);s=e.bounds.getFitMatrix(c);let{a:u,d:f}=s;if(s.a<1&&(l=e.getSameCanvas(),t.__renderShape(l,n),d*=u,h*=f),o=M(a,s),r=I(o,-s.e,-s.f),n.matrix){const{matrix:t}=n;s.multiply(t),u*=t.scaleX,f*=t.scaleY}n=Object.assign(Object.assign({},n),{matrix:s.withScale(u,f)})}return t.__renderShape(i,n),{canvas:i,matrix:s,bounds:r,worldCanvas:l,shapeBounds:o,scaleX:d,scaleY:h}}};let z={};const{get:U,rotateOfOuter:q,translate:N,scaleOfOuter:X,scale:V,rotate:Q}=t.MatrixHelper;function Z(t,e,n,i,a,r,s){const o=U();N(o,e.x+n,e.y+i),V(o,a,r),s&&q(o,{x:e.x+e.width/2,y:e.y+e.height/2},s),t.transform=o}function K(t,e,n,i,a,r,s){const o=U();N(o,e.x+n,e.y+i),a&&V(o,a,r),s&&Q(o,s),t.transform=o}function $(t,e,n,i,a,r,s,o,l,d){const h=U();if(l)if("center"===d)q(h,{x:n/2,y:i/2},l);else switch(Q(h,l),l){case 90:N(h,i,0);break;case 180:N(h,n,i);break;case 270:N(h,0,n)}z.x=e.x+a,z.y=e.y+r,N(h,z.x,z.y),s&&X(h,z,s,o),t.transform=h}const{get:J,translate:tt}=t.MatrixHelper,et=new t.Bounds,nt={},it={};function at(t,e,n,i){const{changeful:a,sync:r}=n;a&&(t.changeful=a),r&&(t.sync=r),t.data=rt(n,i,e)}function rt(e,n,i){e.padding&&(n=et.set(n).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");let{width:a,height:r}=i;const{opacity:s,mode:o,align:l,offset:d,scale:h,size:c,rotation:u,repeat:f,filters:p}=e,g=n.width===a&&n.height===r,_={mode:o},y="center"!==l&&(u||0)%180==90;let m,w;switch(t.BoundsHelper.set(it,0,0,y?r:a,y?a:r),o&&"cover"!==o&&"fit"!==o?((h||c)&&(t.MathHelper.getScaleData(h,c,i,nt),m=nt.scaleX,w=nt.scaleY),l&&(m&&t.BoundsHelper.scale(it,m,w,!0),t.AlignHelper.toPoint(l,it,n,it,!0,!0))):g&&!u||(m=w=t.BoundsHelper.getFitScale(n,it,"fit"!==o),t.BoundsHelper.put(n,i,l,m,!1,it),t.BoundsHelper.scale(it,m,w,!0)),d&&t.PointHelper.move(it,d),o){case"stretch":g||(a=n.width,r=n.height);break;case"normal":case"clip":(it.x||it.y||m||u)&&K(_,n,it.x,it.y,m,w,u);break;case"repeat":(!g||m||u)&&$(_,n,a,r,it.x,it.y,m,w,u,l),f||(_.repeat="repeat");break;default:m&&Z(_,n,it.x,it.y,m,w,u)}return _.transform||(n.x||n.y)&&(_.transform=J(),tt(_.transform,n.x,n.y)),m&&"stretch"!==o&&(_.scaleX=m,_.scaleY=w),_.width=a,_.height=r,s&&(_.opacity=s),p&&(_.filters=p),f&&(_.repeat="string"==typeof f?"x"===f?"repeat-x":"repeat-y":"repeat"),_}let st,ot=new t.Bounds;const{isSame:lt}=t.BoundsHelper;function dt(t,e,n,i,a,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return a.data||at(a,i,n,r),!0}function ht(e,n){ft(e,t.ImageEvent.LOAD,n)}function ct(e,n){ft(e,t.ImageEvent.LOADED,n)}function ut(e,n,i){n.error=i,e.forceUpdate("surface"),ft(e,t.ImageEvent.ERROR,n)}function ft(e,n,i){e.hasEvent(n)&&e.emitEvent(new t.ImageEvent(n,i))}function pt(t,e){const{leafer:n}=t;n&&n.viewReady&&(n.renderer.ignore=e)}const{get:gt,scale:_t,copy:yt}=t.MatrixHelper,{ceil:mt,abs:wt}=Math;function vt(e,n,i){let{scaleX:a,scaleY:r}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const s=a+"-"+r+"-"+i;if(n.patternId===s||e.destroyed)return!1;{a=wt(a),r=wt(r);const{image:e,data:o}=n;let l,d,{width:h,height:c,scaleX:u,scaleY:f,transform:p,repeat:g}=o;u&&(d=gt(),yt(d,p),_t(d,1/u,1/f),a*=u,r*=f),a*=i,r*=i,h*=a,c*=r;const _=h*c;if(!g&&_>t.Platform.image.maxCacheSize)return!1;let y=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;y>t&&(y=t)}_>y&&(l=Math.sqrt(_/y)),l&&(a/=l,r/=l,h/=l,c/=l),u&&(a/=u,r/=f),(p||1!==a||1!==r)&&(d||(d=gt(),p&&yt(d,p)),_t(d,1/a,1/r));const m=e.getCanvas(mt(h)||1,mt(c)||1,o.opacity,o.filters),w=e.getPattern(m,g||t.Platform.origin.noRepeat||"no-repeat",d,n);return n.style=w,n.patternId=s,!0}}function xt(t,e,n,i){return new(n||(n=Promise))((function(a,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,o)}l((i=i.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:bt}=Math;const Bt={image:function(e,n,i,a,r){let s,o;const l=t.ImageManager.get(i);return st&&i===st.paint&<(a,st.boxBounds)?s=st.leafPaint:(s={type:i.type,image:l},l.hasAlphaPixel&&(s.isTransparent=!0),st=l.use>1?{leafPaint:s,paint:i,boxBounds:ot.set(a)}:null),(r||l.loading)&&(o={image:l,attrName:n,attrValue:i}),l.ready?(dt(e,n,i,l,s,a),r&&(ht(e,o),ct(e,o))):l.error?r&&ut(e,o,l.error):(r&&(pt(e,!0),ht(e,o)),s.loadId=l.load((()=>{pt(e,!1),e.destroyed||(dt(e,n,i,l,s,a)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),ct(e,o)),s.loadId=null}),(t=>{pt(e,!1),ut(e,o,t),s.loadId=null})),e.placeholderColor&&(e.placeholderDelay?setTimeout((()=>{l.ready||(l.isPlacehold=!0,e.forceUpdate("surface"))}),e.placeholderDelay):l.isPlacehold=!0)),s},checkImage:function(e,i,a,r){const{scaleX:s,scaleY:o}=t.ImageManager.patternLocked?e.__world:e.__nowWorld,{pixelRatio:l}=i,{data:d}=a;if(!d||a.patternId===s+"-"+o+"-"+l&&!n.Export.running)return!1;if(r)if(d.repeat)r=!1;else if(!(a.changeful||t.ResizeEvent.isResizing(e)||n.Export.running)){let{width:e,height:n}=d;e*=bt(s)*l,n*=bt(o)*l,d.scaleX&&(e*=d.scaleX,n*=d.scaleY),r=e*n>t.Platform.image.maxCacheSize}return r?(function(t,e,n,i){e.save(),e.clipUI(t),n.blendMode&&(e.blendMode=n.blendMode);i.opacity&&(e.opacity*=i.opacity);i.transform&&e.transform(i.transform);e.drawImage(n.image.getFull(i.filters),0,0,i.width,i.height),e.restore()}(e,i,a,d),!0):(!a.style||a.sync||n.Export.running?vt(e,a,l):a.patternTask||(a.patternTask=t.ImageManager.patternTasker.add((()=>xt(this,void 0,void 0,(function*(){a.patternTask=null,i.bounds.hit(e.__nowWorld)&&vt(e,a,l),e.forceUpdate("surface")}))),300)),!1)},createPattern:vt,recycleImage:function(e,n){const i=n["_"+e];if(i instanceof Array){let a,r,s,o,l;for(let d=0,h=i.length;d<h;d++)a=i[d],r=a.image,l=r&&r.url,l&&(s||(s={}),s[l]=!0,t.ImageManager.recycle(r),r.loading&&(o||(o=n.__input&&n.__input[e]||[],o instanceof Array||(o=[o])),r.unload(i[d].loadId,!o.some((t=>t.url===l)))));return s}return null},createData:at,getPatternData:rt,fillOrFitMode:Z,clipMode:K,repeatMode:$},{toPoint:Et}=t.AroundHelper,{hasTransparent:Lt}=n.ColorConvert,Rt={},kt={};function Pt(t,e,i,a){if(i){let r,s,o,l;for(let t=0,d=i.length;t<d;t++)r=i[t],"string"==typeof r?(o=t/(d-1),s=n.ColorConvert.string(r,a)):(o=r.offset,s=n.ColorConvert.string(r.color,a)),e.addColorStop(o,s),!l&&Lt(s)&&(l=!0);l&&(t.isTransparent=!0)}}const{getAngle:St,getDistance:Ct}=t.PointHelper,{get:At,rotateOfOuter:Ot,scaleOfOuter:Tt}=t.MatrixHelper,{toPoint:Wt}=t.AroundHelper,Mt={},It={};function Dt(t,e,n,i,a){let r;const{width:s,height:o}=t;if(s!==o||i){const t=St(e,n);r=At(),a?(Tt(r,e,s/o*(i||1),1),Ot(r,e,t+90)):(Tt(r,e,1,s/o*(i||1)),Ot(r,e,t))}return r}const{getDistance:Ht}=t.PointHelper,{toPoint:Ft}=t.AroundHelper,Gt={},jt={};const Yt={linearGradient:function(e,n){let{from:i,to:a,type:r,opacity:s}=e;Et(i||"top",n,Rt),Et(a||"bottom",n,kt);const o=t.Platform.canvas.createLinearGradient(Rt.x,Rt.y,kt.x,kt.y),l={type:r,style:o};return Pt(l,o,e.stops,s),l},radialGradient:function(e,n){let{from:i,to:a,type:r,opacity:s,stretch:o}=e;Wt(i||"center",n,Mt),Wt(a||"bottom",n,It);const l=t.Platform.canvas.createRadialGradient(Mt.x,Mt.y,0,Mt.x,Mt.y,Ct(Mt,It)),d={type:r,style:l};Pt(d,l,e.stops,s);const h=Dt(n,Mt,It,o,!0);return h&&(d.transform=h),d},conicGradient:function(e,n){let{from:i,to:a,type:r,opacity:s,stretch:o}=e;Ft(i||"center",n,Gt),Ft(a||"bottom",n,jt);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,Gt.x,Gt.y):t.Platform.canvas.createRadialGradient(Gt.x,Gt.y,0,Gt.x,Gt.y,Ht(Gt,jt)),d={type:r,style:l};Pt(d,l,e.stops,s);const h=Dt(n,Gt,jt,o||1,t.Platform.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:Dt},{copy:zt,toOffsetOutBounds:Ut}=t.BoundsHelper,qt={},Nt={};function Xt(e,n,i,a){const{bounds:r,shapeBounds:s}=a;if(t.Platform.fullImageShadow){if(zt(qt,e.bounds),qt.x+=n.x-s.x,qt.y+=n.y-s.y,i){const{matrix:t}=a;qt.x-=(r.x+(t?t.e:0)+r.width/2)*(i-1),qt.y-=(r.y+(t?t.f:0)+r.height/2)*(i-1),qt.width*=i,qt.height*=i}e.copyWorld(a.canvas,e.bounds,qt)}else i&&(zt(qt,n),qt.x-=n.width/2*(i-1),qt.y-=n.height/2*(i-1),qt.width*=i,qt.height*=i),e.copyWorld(a.canvas,s,i?qt:n)}const{toOffsetOutBounds:Vt}=t.BoundsHelper,Qt={};const Zt={shadow:function(t,e,i){let a,r;const{__nowWorld:s,__layout:o}=t,{shadow:l}=t.__,{worldCanvas:d,bounds:h,shapeBounds:c,scaleX:u,scaleY:f}=i,p=e.getSameCanvas(),g=l.length-1;Ut(h,Nt),l.forEach(((l,_)=>{p.setWorldShadow(Nt.offsetX+l.x*u,Nt.offsetY+l.y*f,l.blur*u,n.ColorConvert.string(l.color)),r=l.spread?1+2*l.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,Xt(p,Nt,r,i),a=h,l.box&&(p.restore(),p.save(),d&&(p.copyWorld(p,h,s,"copy"),a=s),d?p.copyWorld(d,s,s,"destination-out"):p.copyWorld(i.canvas,c,h,"destination-out")),t.__worldFlipped?e.copyWorldByReset(p,a,s,l.blendMode):e.copyWorldToInner(p,a,o.renderBounds,l.blendMode),g&&_<g&&p.clearWorld(a,!0)})),p.recycle(a)},innerShadow:function(t,e,i){let a,r;const{__nowWorld:s,__layout:o}=t,{innerShadow:l}=t.__,{worldCanvas:d,bounds:h,shapeBounds:c,scaleX:u,scaleY:f}=i,p=e.getSameCanvas(),g=l.length-1;Vt(h,Qt),l.forEach(((l,_)=>{p.save(),p.setWorldShadow(Qt.offsetX+l.x*u,Qt.offsetY+l.y*f,l.blur*u),r=l.spread?1-2*l.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,Xt(p,Qt,r,i),p.restore(),d?(p.copyWorld(p,h,s,"copy"),p.copyWorld(d,s,s,"source-out"),a=s):(p.copyWorld(i.canvas,c,h,"source-out"),a=h),p.fillWorld(a,n.ColorConvert.string(l.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(p,a,s,l.blendMode):e.copyWorldToInner(p,a,o.renderBounds,l.blendMode),g&&_<g&&p.clearWorld(a,!0)})),p.recycle(a)},blur:function(t,e,n){const{blur:i}=t.__;n.setWorldBlur(i*t.__nowWorld.a),n.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),n.filter="none"},backgroundBlur:function(t,e,n){}},{excludeRenderBounds:Kt}=t.LeafBoundsHelper;function $t(t,e,n,i,a,r){switch(e){case"grayscale":a.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,n,i){const a=t.__nowWorld;n.resetTransform(),n.opacity=1,n.useMask(i,a),i.recycle(a),te(t,e,n,1)}(t,n,i,a);break;case"opacity-path":te(t,n,i,r);break;case"path":n.restore()}}function Jt(t){return t.getSameCanvas(!1,!0)}function te(t,e,n,i){const a=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(n,a),n.recycle(a)}n.Group.prototype.__renderMask=function(t,e){let n,i,a,r,s,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++)n=l[d],o=n.__.mask,o&&(s&&($t(this,s,t,a,i,r),i=a=null),"path"===o||"clipping-path"===o?(n.opacity<1?(s="opacity-path",r=n.opacity,a||(a=Jt(t))):(s="path",t.save()),n.__clip(a||t,e)):(s="grayscale"===o?"grayscale":"alpha",i||(i=Jt(t)),a||(a=Jt(t)),n.__render(i,e)),"clipping"!==o&&"clipping-path"!==o)||Kt(n,e)||n.__render(a||t,e);$t(this,s,t,a,i,r)};const ee=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ne=ee+"_#~&*+\\=|≮≯≈≠=…",ie=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 ae(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const re=ae("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),se=ae("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),oe=ae(ee),le=ae(ne),de=ae("- —/~|┆·");var he;!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"}(he||(he={}));const{Letter:ce,Single:ue,Before:fe,After:pe,Symbol:ge,Break:_e}=he;function ye(t){return re[t]?ce:de[t]?_e:se[t]?fe:oe[t]?pe:le[t]?ge:ie.test(t)?ue:ce}const me={trimRight(t){const{words:e}=t;let n,i=0,a=e.length;for(let r=a-1;r>-1&&(n=e[r].data[0]," "===n.char);r--)i++,t.width-=n.width;i&&e.splice(a-i,i)}};function we(t,e,n){switch(e){case"title":return n?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:ve}=me,{Letter:xe,Single:be,Before:Be,After:Ee,Symbol:Le,Break:Re}=he;let ke,Pe,Se,Ce,Ae,Oe,Te,We,Me,Ie,De,He,Fe,Ge,je,Ye,ze,Ue=[];function qe(t,e){Me&&!We&&(We=Me),ke.data.push({char:t,width:e}),Se+=e}function Ne(){Ce+=Se,ke.width=Se,Pe.words.push(ke),ke={data:[]},Se=0}function Xe(){Ge&&(je.paraNumber++,Pe.paraStart=!0,Ge=!1),Me&&(Pe.startCharSize=We,Pe.endCharSize=Me,We=0),Pe.width=Ce,Ye.width?ve(Pe):ze&&Ve(),Ue.push(Pe),Pe={words:[]},Ce=0}function Ve(){Ce>(je.maxWidth||0)&&(je.maxWidth=Ce)}const{top:Qe,right:Ze,bottom:Ke,left:$e}=t.Direction4;function Je(t,e,n){const{bounds:i,rows:a}=t;i[e]+=n;for(let t=0;t<a.length;t++)a[t][e]+=n}const tn={getDrawData:function(e,i){"string"!=typeof e&&(e=String(e));let a=0,r=0,s=i.__getInput("width")||0,o=i.__getInput("height")||0;const{textDecoration:l,__font:d,__padding:h}=i;h&&(s?(a=h[$e],s-=h[Ze]+h[$e]):i.autoSizeAlign||(a=h[$e]),o?(r=h[Qe],o-=h[Qe]+h[Ke]):i.autoSizeAlign||(r=h[Qe]));const c={bounds:{x:a,y:r,width:s,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=d};return function(e,n,i){je=e,Ue=e.rows,Ye=e.bounds,ze=!Ye.width&&!i.autoSizeAlign;const{__letterSpacing:a,paraIndent:r,textCase:s}=i,{canvas:o}=t.Platform,{width:l,height:d}=Ye;if(l||d||a||"none"!==s){const t="none"!==i.textWrap,e="break"===i.textWrap;Ge=!0,De=null,We=Te=Me=Se=Ce=0,ke={data:[]},Pe={words:[]},a&&(n=[...n]);for(let i=0,d=n.length;i<d;i++)Oe=n[i],"\n"===Oe?(Se&&Ne(),Pe.paraEnd=!0,Xe(),Ge=!0):(Ie=ye(Oe),Ie===xe&&"none"!==s&&(Oe=we(Oe,s,!Se)),Te=o.measureText(Oe).width,a&&(a<0&&(Me=Te),Te+=a),He=Ie===be&&(De===be||De===xe)||De===be&&Ie!==Ee,Fe=!(Ie!==Be&&Ie!==be||De!==Le&&De!==Ee),Ae=Ge&&r?l-r:l,t&&l&&Ce+Se+Te>Ae&&(e?(Se&&Ne(),Ce&&Xe()):(Fe||(Fe=Ie===xe&&De==Ee),He||Fe||Ie===Re||Ie===Be||Ie===be||Se+Te>Ae?(Se&&Ne(),Ce&&Xe()):Ce&&Xe()))," "===Oe&&!0!==Ge&&Ce+Se===0||(Ie===Re?(" "===Oe&&Se&&Ne(),qe(Oe,Te),Ne()):He||Fe?(Se&&Ne(),qe(Oe,Te)):qe(Oe,Te)),De=Ie);Se&&Ne(),Ce&&Xe(),Ue.length>0&&(Ue[Ue.length-1].paraEnd=!0)}else n.split("\n").forEach((t=>{je.paraNumber++,Ce=o.measureText(t).width,Ue.push({x:r||0,text:t,width:Ce,paraStart:!0}),ze&&Ve()}))}(c,e,i),h&&function(t,e,n,i,a){if(!i&&n.autoSizeAlign)switch(n.textAlign){case"left":Je(e,"x",t[$e]);break;case"right":Je(e,"x",-t[Ze])}if(!a&&n.autoSizeAlign)switch(n.verticalAlign){case"top":Je(e,"y",t[Qe]);break;case"bottom":Je(e,"y",-t[Ke])}}(h,c,i,s,o),function(t,e){const{rows:n,bounds:i}=t,a=n.length,{__lineHeight:r,__baseLine:s,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=i,y=r*a+(c?c*(t.paraNumber-1):0),m=s;if(l&&y>_)y=Math.max(_,r),a>1&&(t.overflow=a);else if(_||u)switch(h){case"middle":p+=(_-y)/2;break;case"bottom":p+=_-y}m+=p;let w,v,x,b=g||u?g:t.maxWidth;for(let s=0,h=a;s<h;s++){if(w=n[s],w.x=f,w.width<g||w.width>g&&!l)switch(d){case"center":w.x+=(b-w.width)/2;break;case"right":w.x+=b-w.width}w.paraStart&&c&&s>0&&(m+=c),w.y=m,m+=r,t.overflow>s&&m>y&&(w.isOverflow=!0,t.overflow=s+1),v=w.x,x=w.width,o<0&&(w.width<0?(x=-w.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<i.x&&(i.x=v),x>i.width&&(i.width=x),l&&g&&g<x&&(w.isOverflow=!0,t.overflow||(t.overflow=n.length))}i.y=p,i.height=y}(c,i),function(t,e,n){const{rows:i}=t,{textAlign:a,paraIndent:r,letterSpacing:s}=e;let o,l,d,h,c,u;i.forEach((t=>{t.words&&(d=r&&t.paraStart?r:0,u=t.words.length,l=n&&("justify"===a||"both"===a)&&u>1?(n-t.width-d)/(u-1):0,h=s||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!s&&(t.textMode=!0),2===h?(t.x+=d,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=d,o=t.x,t.data=[],t.words.forEach(((e,n)=>{1===h?(c={char:"",x:o},o=function(t,e,n){return t.forEach((t=>{n.char+=t.char,e+=t.width})),e}(e.data,o,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):o=function(t,e,n,i){return t.forEach((t=>{(i||" "!==t.char)&&(t.x=e,n.push(t)),e+=t.width})),e}(e.data,o,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==a||n===u-1||(o+=l,t.width+=l)}))),t.words=null)}))}(c,i,s),c.overflow&&function(e,n,i,a){if(!a)return;const{rows:r,overflow:s}=e;let{textOverflow:o}=n;if(r.splice(s),o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?t.Platform.canvas.measureText(o).width:0,h=i+a-d;("none"===n.textWrap?r:[r[s-1]]).forEach((t=>{if(t.isOverflow&&t.data){let n=t.data.length-1;for(let i=n;i>-1&&(e=t.data[i],l=e.x+e.width,!(i===n&&l<h));i--){if(l<h&&" "!==e.char||!i){t.data.splice(i+1),t.width-=e.width;break}t.width-=e.width}t.width+=d,t.data.push({char:o,x:l}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(c,i,a,s),"none"!==l&&function(t,e){let i;const{fontSize:a,textDecoration:r}=e;switch(t.decorationHeight=a/11,"object"==typeof r?(i=r.type,r.color&&(t.decorationColor=n.ColorConvert.string(r.color))):i=r,i){case"under":t.decorationY=[.15*a];break;case"delete":t.decorationY=[.35*-a];break;case"under-delete":t.decorationY=[.15*a,.35*-a]}}(c,i),c}};const en={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!n.ColorConvert.object)return t;t=n.ColorConvert.object(t)}let a=void 0===t.a?1:t.a;i&&(a*=e);const r=t.r+","+t.g+","+t.b;return 1===a?"rgb("+r+")":"rgba("+r+","+a+")"}};Object.assign(n.TextConvert,tn),Object.assign(n.ColorConvert,en),Object.assign(n.Paint,Y),Object.assign(n.PaintImage,Bt),Object.assign(n.PaintGradient,Yt),Object.assign(n.Effect,Zt),Object.assign(t.Creator,{interaction:(t,n,i,a)=>new e.InteractionBase(t,n,i,a),hitCanvas:(t,e)=>new i(t,e),hitCanvasManager:()=>new e.HitCanvasManager}),r(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=m,exports.LeaferCanvas=i,exports.Picker=b,exports.Renderer=v,exports.Selector=B,exports.Watcher=o,exports.useCanvas=r,Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(e).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
|
|
1
|
+
"use strict";var t=require("@leafer/core"),e=require("@leafer-ui/core"),n=require("@leafer-ui/draw");class i extends t.LeaferCanvasBase{get allowBackgroundColor(){return!0}init(){this.__createView(),this.__createContext(),this.resize(this.config)}__createView(){this.view=t.Platform.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:n}=this;this.view.width=Math.ceil(t*n),this.view.height=Math.ceil(e*n),this.clientBounds=this.bounds}}t.canvasPatch(OffscreenCanvasRenderingContext2D.prototype),t.canvasPatch(Path2D.prototype);const{mineType:a}=t.FileHelper;function r(e,n){t.Platform.origin={createCanvas:(t,e)=>new OffscreenCanvas(t,e),canvasToDataURL:(t,e,n)=>new Promise(((i,r)=>{t.convertToBlob({type:a(e),quality:n}).then((t=>{var e=new FileReader;e.onload=t=>i(t.target.result),e.onerror=t=>r(t),e.readAsDataURL(t)})).catch((t=>{r(t)}))})),canvasToBolb:(t,e,n)=>t.convertToBlob({type:a(e),quality:n}),canvasSaveAs:(t,e,n)=>new Promise((t=>t())),download(t,e){},loadImage:e=>new Promise(((n,i)=>{let a=new XMLHttpRequest;a.open("GET",t.Platform.image.getRealURL(e),!0),a.responseType="blob",a.onload=()=>{createImageBitmap(a.response).then((t=>{n(t)})).catch((t=>{i(t)}))},a.onerror=t=>i(t),a.send()}))},t.Platform.canvas=t.Creator.canvas(),t.Platform.conicGradientSupport=!!t.Platform.canvas.context.createConicGradient}Object.assign(t.Creator,{canvas:(t,e)=>new i(t,e),image:e=>new t.LeaferImage(e)}),t.Platform.name="web",t.Platform.isWorker=!0,t.Platform.backgrounder=!0,t.Platform.requestRender=function(t){requestAnimationFrame(t)},t.defineKey(t.Platform,"devicePixelRatio",{get:()=>1});const{userAgent:s}=navigator;s.indexOf("Firefox")>-1?(t.Platform.conicGradientRotate90=!0,t.Platform.intWheelDeltaY=!0):s.indexOf("Safari")>-1&&-1===s.indexOf("Chrome")&&(t.Platform.fullImageShadow=!0),s.indexOf("Windows")>-1?(t.Platform.os="Windows",t.Platform.intWheelDeltaY=!0):s.indexOf("Mac")>-1?t.Platform.os="Mac":s.indexOf("Linux")>-1&&(t.Platform.os="Linux");class o{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t.LeafList;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(e,n){this.totalTimes=0,this.config={},this.__updatedList=new t.LeafList,this.target=e,n&&(this.config=t.DataHelper.default(n,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(t.RenderEvent.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(e){e.type===t.ChildEvent.ADD?(this.hasAdd=!0,this.__pushChild(e.child)):(this.hasRemove=!0,this.__updatedList.add(e.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,n=e.length;t<n;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new t.WatchEvent(t.WatchEvent.DATA,{updatedList:this.updatedList})),this.__updatedList=new t.LeafList,this.totalTimes++,this.changed=this.hasVisible=this.hasRemove=this.hasAdd=!1}__listenEvents(){this.__eventIds=[this.target.on_([[t.PropertyEvent.CHANGE,this.__onAttrChange,this],[[t.ChildEvent.ADD,t.ChildEvent.REMOVE],this.__onChildEvent,this],[t.WatchEvent.REQUEST,this.__onRquestData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.__updatedList=null)}}const{updateAllMatrix:l,updateBounds:d,updateChange:h}=t.LeafHelper,{pushAllChildBranch:c,pushAllParent:u}=t.BranchHelper;const{worldBounds:f}=t.LeafBoundsHelper;class p{constructor(e){this.updatedBounds=new t.Bounds,this.beforeBounds=new t.Bounds,this.afterBounds=new t.Bounds,e instanceof Array&&(e=new t.LeafList(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,f)}setAfter(){this.afterBounds.setListWithFn(this.updatedList.list,f),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:g,updateAllChange:_}=t.LeafHelper,y=t.Debug.get("Layouter");class m{constructor(e,n){this.totalTimes=0,this.config={},this.__levelList=new t.LeafLevelList,this.target=e,n&&(this.config=t.DataHelper.default(n,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:e}=this;this.times=0;try{e.emit(t.LayoutEvent.START),this.layoutOnce(),e.emitEvent(new t.LayoutEvent(t.LayoutEvent.END,this.layoutedBlocks,this.times))}catch(t){y.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?y.warn("layouting"):this.times>3?y.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(t.WatchEvent.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var e;if(!(null===(e=this.__updatedList)||void 0===e?void 0:e.length))return;const n=t.Run.start("PartLayout"),{target:i,__updatedList:a}=this,{BEFORE:r,LAYOUT:s,AFTER:o}=t.LayoutEvent,f=this.getBlocks(a);f.forEach((t=>t.setBefore())),i.emitEvent(new t.LayoutEvent(r,f,this.times)),this.extraBlock=null,a.sort(),function(t,e){let n;t.list.forEach((t=>{n=t.__layout,e.without(t)&&!n.proxyZoom&&(n.matrixChanged?(l(t,!0),e.add(t),t.isBranch&&c(t,e),u(t,e)):n.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),u(t,e)))}))}(a,this.__levelList),function(t){let e,n,i;t.sort(!0),t.levels.forEach((a=>{e=t.levelMap[a];for(let t=0,a=e.length;t<a;t++){if(n=e[t],n.isBranch&&n.__tempNumber){i=n.children;for(let t=0,e=i.length;t<e;t++)i[t].isBranch||d(i[t])}d(n)}}))}(this.__levelList),function(t){t.list.forEach(h)}(a),this.extraBlock&&f.push(this.extraBlock),f.forEach((t=>t.setAfter())),i.emitEvent(new t.LayoutEvent(s,f,this.times)),i.emitEvent(new t.LayoutEvent(o,f,this.times)),this.addBlocks(f),this.__levelList.reset(),this.__updatedList=null,t.Run.end(n)}fullLayout(){const e=t.Run.start("FullLayout"),{target:n}=this,{BEFORE:i,LAYOUT:a,AFTER:r}=t.LayoutEvent,s=this.getBlocks(new t.LeafList(n));n.emitEvent(new t.LayoutEvent(i,s,this.times)),m.fullLayout(n),s.forEach((t=>{t.setAfter()})),n.emitEvent(new t.LayoutEvent(a,s,this.times)),n.emitEvent(new t.LayoutEvent(r,s,this.times)),this.addBlocks(s),t.Run.end(e)}static fullLayout(e){g(e,!0),e.isBranch?t.BranchHelper.updateBounds(e):t.LeafHelper.updateBounds(e),_(e)}addExtra(t){if(!this.__updatedList.has(t)){const{updatedList:e,beforeBounds:n}=this.extraBlock||(this.extraBlock=new p([]));e.length?n.add(t.__world):n.set(t.__world),e.add(t)}}createBlock(t){return new p(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_([[t.LayoutEvent.REQUEST,this.layout,this],[t.LayoutEvent.AGAIN,this.layoutAgain,this],[t.WatchEvent.DATA,this.__onReceiveWatchData,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const w=t.Debug.get("Renderer");class v{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(e,n,i){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=e,this.canvas=n,i&&(this.config=t.DataHelper.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(t.LayoutEvent.REQUEST)}checkRender(){if(this.running){const{target:e}=this;e.isApp&&(e.emit(t.RenderEvent.CHILD_START,e),e.children.forEach((t=>{t.renderer.FPS=this.FPS,t.renderer.checkRender()})),e.emit(t.RenderEvent.CHILD_END,e)),this.changed&&this.canvas.view&&this.render(),this.target.emit(t.RenderEvent.NEXT)}}render(e){if(!this.running||!this.canvas.view)return this.update();const{target:n}=this;this.times=0,this.totalBounds=new t.Bounds,w.log(n.innerName,"---\x3e");try{this.emitRender(t.RenderEvent.START),this.renderOnce(e),this.emitRender(t.RenderEvent.END,this.totalBounds),t.ImageManager.clearRecycled()}catch(t){this.rendering=!1,w.error(t)}w.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(e){if(this.rendering)return w.warn("rendering");if(this.times>3)return w.warn("render max times");if(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new t.Bounds,this.renderOptions={},e)this.emitRender(t.RenderEvent.BEFORE),e();else{if(this.requestLayout(),this.ignore)return void(this.ignore=this.rendering=!1);this.emitRender(t.RenderEvent.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()}this.emitRender(t.RenderEvent.RENDER,this.renderBounds,this.renderOptions),this.emitRender(t.RenderEvent.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(e){const n=t.Run.start("PartRender"),{canvas:i}=this,a=e.getIntersect(i.bounds),r=new t.Bounds(a);i.save(),a.spread(v.clipSpread).ceil(),i.clearWorld(a,!0),i.clipWorld(a,!0),this.__render(a,r),i.restore(),t.Run.end(n)}fullRender(){const e=t.Run.start("FullRender"),{canvas:n}=this;n.save(),n.clear(),this.__render(n.bounds),n.restore(),t.Run.end(e)}__render(e,n){const{canvas:i}=this,a=e.includes(this.target.__world),r=a?{includes:a}:{bounds:e,includes:a};this.needFill&&i.fillWorld(e,this.config.fill),t.Debug.showRepaint&&t.Debug.drawRepaint(i,e),this.target.__render(i,r),this.renderBounds=n=n||e,this.renderOptions=r,this.totalBounds.isEmpty()?this.totalBounds=n:this.totalBounds.add(n),i.updateRender(n)}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:e}=this;if(e){const n=new t.Bounds;n.setList(e),e.length=0,e.push(n)}}__requestRender(){const e=this.target;if(this.requestTime||!e)return;if(e.parentApp)return e.parentApp.requestRender(!1);const n=this.requestTime=Date.now();t.Platform.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-n))),this.requestTime=0,this.checkRender()}))}__onResize(e){if(!this.canvas.unreal){if(e.bigger||!e.samePixelRatio){const{width:n,height:i}=e.old;if(!new t.Bounds(0,0,n,i).includes(this.target.__world)||this.needFill||!e.samePixelRatio)return this.addBlock(this.canvas.bounds),void this.target.forceUpdate("surface")}this.addBlock(new t.Bounds(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||w.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(e,n,i){this.target.emitEvent(new t.RenderEvent(e,this.times,n,i))}__listenEvents(){this.__eventIds=[this.target.on_([[t.RenderEvent.REQUEST,this.update,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.AGAIN,this.renderAgain,this],[t.ResizeEvent.RESIZE,this.__onResize,this]])]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.canvas=this.config=null)}}v.clipSpread=10;const{hitRadiusPoint:x}=t.BoundsHelper;class b{constructor(t,e){this.target=t,this.selector=e}getByPoint(e,n,i){n||(n=0),i||(i={});const a=i.through||!1,r=i.ignoreHittable||!1,s=i.target||this.target;this.exclude=i.exclude||null,this.point={x:e.x,y:e.y,radiusX:n,radiusY:n},this.findList=new t.LeafList(i.findList),i.findList||this.hitBranch(s);const{list:o}=this.findList,l=this.getBestMatchLeaf(o,i.bottomList,r),d=r?this.getPath(l):this.getHitablePath(l);return this.clear(),a?{path:d,target:l,throughPath:o.length?this.getThroughPath(o):d}:{path:d,target:l}}getBestMatchLeaf(e,n,i){if(e.length){let n;this.findList=new t.LeafList;const{x:a,y:r}=this.point,s={x:a,y:r,radiusX:0,radiusY:0};for(let a=0,r=e.length;a<r;a++)if(n=e[a],(i||t.LeafHelper.worldHittable(n))&&(this.hitChild(n,s),this.findList.length))return this.findList.list[0]}if(n)for(let t=0,e=n.length;t<e;t++)if(this.hitChild(n[t].target,this.point,n[t].proxy),this.findList.length)return this.findList.list[0];return e[0]}getPath(e){const n=new t.LeafList;for(;e;)n.add(e),e=e.parent;return this.target&&n.add(this.target),n}getHitablePath(e){const n=this.getPath(e&&e.hittable?e:null);let i,a=new t.LeafList;for(let t=n.list.length-1;t>-1&&(i=n.list[t],i.__.hittable)&&(a.addAt(i,0),i.__.hitChildren);t--);return a}getThroughPath(e){const n=new t.LeafList,i=[];for(let t=e.length-1;t>-1;t--)i.push(this.getPath(e[t]));let a,r,s;for(let t=0,e=i.length;t<e;t++){a=i[t],r=i[t+1];for(let t=0,e=a.length;t<e&&(s=a.list[t],!r||!r.has(s));t++)n.add(s)}return n}hitBranch(t){this.eachFind(t.children,t.__onlyHitMask)}eachFind(t,e){let n,i;const{point:a}=this;for(let r=t.length-1;r>-1;r--)n=t[r],!n.__.visible||e&&!n.__.mask||(i=!!n.__.hitRadius||x(n.__world,a),n.isBranch?(i||n.__ignoreHitWorld)&&(this.eachFind(n.children,n.__onlyHitMask),n.isBranchLeaf&&this.hitChild(n,a)):i&&this.hitChild(n,a))}hitChild(t,e,n){if((!this.exclude||!this.exclude.has(t))&&t.__hitWorld(e)){const{parent:i}=t;if(i&&i.__hasMask&&!t.__.mask&&!i.children.some((t=>t.__.mask&&t.__hitWorld(e))))return;this.findList.add(n||t)}}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}class B{constructor(e,n){this.config={},n&&(this.config=t.DataHelper.default(n,this.config)),this.picker=new b(this.target=e,this),this.finder=t.Creator.finder&&t.Creator.finder()}getByPoint(e,n,i){const{target:a,picker:r}=this;return t.Platform.backgrounder&&a&&a.updateLayout(),r.getByPoint(e,n,i)}getBy(e,n,i,a){return this.finder?this.finder.getBy(e,n,i,a):t.Plugin.need("find")}destroy(){this.picker.destroy(),this.finder&&this.finder.destroy()}}function E(t,e){const n=t.__,{rows:i,decorationY:a}=n.__textDrawData;let r;n.__isPlacehold&&n.placeholderColor&&(e.fillStyle=n.placeholderColor);for(let t=0,n=i.length;t<n;t++)r=i[t],r.text?e.fillText(r.text,r.x,r.y):r.data&&r.data.forEach((t=>{e.fillText(t.char,t.x,r.y)}));if(a){const{decorationColor:t,decorationHeight:r}=n.__textDrawData;t&&(e.fillStyle=t),i.forEach((t=>a.forEach((n=>e.fillRect(t.x,t.y+n,t.width,r)))))}}function L(t,e){t.__.__font?E(t,e):t.__.windingRule?e.fill(t.__.windingRule):e.fill()}function k(t,e,n){switch(e.__.strokeAlign){case"center":R(t,1,e,n);break;case"inside":P(t,"inside",e,n);break;case"outside":e.__.__fillAfterStroke?R(t,2,e,n):P(t,"outside",e,n)}}function R(t,e,n,i){const a=n.__;i.setStroke(!a.__isStrokes&&t,a.strokeWidth*e,a),a.__isStrokes?A(t,!0,n,i):C(n,i)}function P(t,e,n,i){const a=i.getSameCanvas(!0,!0);a.font=n.__.__font,R(t,2,n,a),a.blendMode="outside"===e?"destination-out":"destination-in",E(n,a),a.blendMode="normal",S(i,a,n),a.recycle(n.__nowWorld)}function S(e,n,i){i.__worldFlipped||t.Platform.fullImageShadow?e.copyWorldByReset(n,i.__nowWorld):e.copyWorldToInner(n,i.__nowWorld,i.__layout.renderBounds)}function C(t,e){let n,i=t.__.__textDrawData;const{rows:a,decorationY:r}=i;for(let t=0,i=a.length;t<i;t++)n=a[t],n.text?e.strokeText(n.text,n.x,n.y):n.data&&n.data.forEach((t=>{e.strokeText(t.char,t.x,n.y)}));if(r){const{decorationHeight:t}=i;a.forEach((n=>r.forEach((i=>e.strokeRect(n.x,n.y+i,n.width,t)))))}}function A(t,e,i,a){let r;for(let s=0,o=t.length;s<o;s++)r=t[s],r.image&&n.PaintImage.checkImage(i,a,r,!1)||r.style&&(a.strokeStyle=r.style,r.blendMode?(a.saveBlendMode(r.blendMode),e?C(i,a):a.stroke(),a.restoreBlendMode()):e?C(i,a):a.stroke())}function O(t,e,n){const i=e.__;if(i.__strokeWidth)if(i.__font)k(t,e,n);else switch(i.strokeAlign){case"center":T(t,1,e,n);break;case"inside":!function(t,e,n){n.save(),n.clipUI(e),T(t,2,e,n),n.restore()}(t,e,n);break;case"outside":!function(t,e,n){const i=e.__;if(i.__fillAfterStroke)T(t,2,e,n);else{const{renderBounds:a}=e.__layout,r=n.getSameCanvas(!0,!0);e.__drawRenderPath(r),T(t,2,e,r),r.clipUI(i),r.clearWorld(a),S(n,r,e),r.recycle(e.__nowWorld)}}(t,e,n)}}function T(t,e,i,a){const r=i.__;a.setStroke(!r.__isStrokes&&t,r.__strokeWidth*e,r),r.__isStrokes?A(t,!1,i,a):a.stroke(),r.__useArrow&&n.Paint.strokeArrow(t,i,a)}Object.assign(t.Creator,{watcher:(t,e)=>new o(t,e),layouter:(t,e)=>new m(t,e),renderer:(t,e,n)=>new v(t,e,n),selector:(t,e)=>new B(t,e)}),t.Platform.layout=m.fullLayout;const{getSpread:W,getOuterOf:M,getByMove:I,getIntersectData:D}=t.BoundsHelper;let H;const{stintSet:F}=t.DataHelper,{hasTransparent:G}=n.ColorConvert;function j(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;let a;const{boxBounds:r}=i.__layout;switch(e.type){case"image":a=n.PaintImage.image(i,t,e,r,!H||!H[e.url]);break;case"linear":a=n.PaintGradient.linearGradient(e,r);break;case"radial":a=n.PaintGradient.radialGradient(e,r);break;case"angular":a=n.PaintGradient.conicGradient(e,r);break;case"solid":const{type:s,color:o,opacity:l}=e;a={type:s,style:n.ColorConvert.string(o,l)};break;default:void 0!==e.r&&(a={type:"solid",style:n.ColorConvert.string(e)})}return a&&("string"==typeof a.style&&G(a.style)&&(a.isTransparent=!0),e.blendMode&&(a.blendMode=e.blendMode)),a}const Y={compute:function(t,e){const i=e.__,a=[];let r,s,o=i.__input[t];o instanceof Array||(o=[o]),H=n.PaintImage.recycleImage(t,i);for(let n,i=0,r=o.length;i<r;i++)(n=j(t,o[i],e))&&a.push(n);i["_"+t]=a.length?a:void 0,a.length&&a.every((t=>t.isTransparent))&&(a.some((t=>t.image))&&(r=!0),s=!0),"fill"===t?(F(i,"__isAlphaPixelFill",r),F(i,"__isTransparentFill",s)):(F(i,"__isAlphaPixelStroke",r),F(i,"__isTransparentStroke",s))},fill:function(t,e,n){n.fillStyle=t,L(e,n)},fills:function(t,e,i){let a;for(let r=0,s=t.length;r<s;r++){if(a=t[r],a.image){if(n.PaintImage.checkImage(e,i,a,!e.__.__font))continue;if(!a.style){!r&&a.image.isPlacehold&&e.drawImagePlaceholder(i,a.image);continue}}i.fillStyle=a.style,a.transform?(i.save(),i.transform(a.transform),a.blendMode&&(i.blendMode=a.blendMode),L(e,i),i.restore()):a.blendMode?(i.saveBlendMode(a.blendMode),L(e,i),i.restoreBlendMode()):L(e,i)}},fillPathOrText:L,fillText:E,stroke:O,strokes:function(t,e,n){O(t,e,n)},strokeText:k,drawTextStroke:C,shape:function(t,e,n){const i=e.getSameCanvas(),a=t.__nowWorld;let r,s,o,l,{scaleX:d,scaleY:h}=a;if(d<0&&(d=-d),h<0&&(h=-h),e.bounds.includes(a))l=i,r=o=a;else{const{renderShapeSpread:i}=t.__layout,c=D(i?W(e.bounds,d===h?i*d:[i*h,i*d]):e.bounds,a);s=e.bounds.getFitMatrix(c);let{a:u,d:f}=s;if(s.a<1&&(l=e.getSameCanvas(),t.__renderShape(l,n),d*=u,h*=f),o=M(a,s),r=I(o,-s.e,-s.f),n.matrix){const{matrix:t}=n;s.multiply(t),u*=t.scaleX,f*=t.scaleY}n=Object.assign(Object.assign({},n),{matrix:s.withScale(u,f)})}return t.__renderShape(i,n),{canvas:i,matrix:s,bounds:r,worldCanvas:l,shapeBounds:o,scaleX:d,scaleY:h}}};let z={};const{get:U,rotateOfOuter:q,translate:N,scaleOfOuter:X,scale:V,rotate:Q,skew:Z}=t.MatrixHelper;function K(t,e,n,i,a,r,s){const o=U();N(o,e.x+n,e.y+i),V(o,a,r),s&&q(o,{x:e.x+e.width/2,y:e.y+e.height/2},s),t.transform=o}function $(t,e,n,i,a,r,s,o){const l=U();s&&Q(l,s),o&&Z(l,o.x,o.y),a&&V(l,a,r),N(l,e.x+n,e.y+i),t.transform=l}function J(t,e,n,i,a,r,s,o,l,d){const h=U();if(l)if("center"===d)q(h,{x:n/2,y:i/2},l);else switch(Q(h,l),l){case 90:N(h,i,0);break;case 180:N(h,n,i);break;case 270:N(h,0,n)}z.x=e.x+a,z.y=e.y+r,N(h,z.x,z.y),s&&X(h,z,s,o),t.transform=h}const{get:tt,translate:et}=t.MatrixHelper,nt=new t.Bounds,it={},at={};function rt(t,e,n,i){const{changeful:a,sync:r,editing:s}=n;a&&(t.changeful=a),r&&(t.sync=r),s&&(t.editing=s),t.data=st(n,i,e)}function st(e,n,i){e.padding&&(n=nt.set(n).shrink(e.padding)),"strench"===e.mode&&(e.mode="stretch");let{width:a,height:r}=i;const{opacity:s,mode:o,align:l,offset:d,scale:h,size:c,rotation:u,skew:f,repeat:p,filters:g}=e,_=n.width===a&&n.height===r,y={mode:o},m="center"!==l&&(u||0)%180==90;let w,v;switch(t.BoundsHelper.set(at,0,0,m?r:a,m?a:r),o&&"cover"!==o&&"fit"!==o?((h||c)&&(t.MathHelper.getScaleData(h,c,i,it),w=it.scaleX,v=it.scaleY),l&&(w&&t.BoundsHelper.scale(at,w,v,!0),t.AlignHelper.toPoint(l,at,n,at,!0,!0))):_&&!u||(w=v=t.BoundsHelper.getFitScale(n,at,"fit"!==o),t.BoundsHelper.put(n,i,l,w,!1,at),t.BoundsHelper.scale(at,w,v,!0)),d&&t.PointHelper.move(at,d),o){case"stretch":_||(a=n.width,r=n.height);break;case"normal":case"clip":(at.x||at.y||w||u||f)&&$(y,n,at.x,at.y,w,v,u,f);break;case"repeat":(!_||w||u)&&J(y,n,a,r,at.x,at.y,w,v,u,l),p||(y.repeat="repeat");break;default:w&&K(y,n,at.x,at.y,w,v,u)}return y.transform||(n.x||n.y)&&(y.transform=tt(),et(y.transform,n.x,n.y)),w&&"stretch"!==o&&(y.scaleX=w,y.scaleY=v),y.width=a,y.height=r,s&&(y.opacity=s),g&&(y.filters=g),p&&(y.repeat="string"==typeof p?"x"===p?"repeat-x":"repeat-y":"repeat"),y}let ot,lt=new t.Bounds;const{isSame:dt}=t.BoundsHelper;function ht(t,e,n,i,a,r){if("fill"===e&&!t.__.__naturalWidth){const e=t.__;if(e.__naturalWidth=i.width/e.pixelRatio,e.__naturalHeight=i.height/e.pixelRatio,e.__autoSide)return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",e.width),t.setProxyAttr("height",e.height)),!1}return a.data||rt(a,i,n,r),!0}function ct(e,n){pt(e,t.ImageEvent.LOAD,n)}function ut(e,n){pt(e,t.ImageEvent.LOADED,n)}function ft(e,n,i){n.error=i,e.forceUpdate("surface"),pt(e,t.ImageEvent.ERROR,n)}function pt(e,n,i){e.hasEvent(n)&&e.emitEvent(new t.ImageEvent(n,i))}function gt(t,e){const{leafer:n}=t;n&&n.viewReady&&(n.renderer.ignore=e)}const{get:_t,scale:yt,copy:mt}=t.MatrixHelper,{ceil:wt,abs:vt}=Math;function xt(e,n,i){let{scaleX:a,scaleY:r}=t.ImageManager.patternLocked?e.__world:e.__nowWorld;const s=a+"-"+r+"-"+i;if(n.patternId===s||e.destroyed)return!1;{a=vt(a),r=vt(r);const{image:e,data:o}=n;let l,d,{width:h,height:c,scaleX:u,scaleY:f,transform:p,repeat:g}=o;u&&(u=vt(u),f=vt(f),d=_t(),mt(d,p),yt(d,1/u,1/f),a*=u,r*=f),a*=i,r*=i,h*=a,c*=r;const _=h*c;if(!g&&_>t.Platform.image.maxCacheSize)return!1;let y=t.Platform.image.maxPatternSize;if(!e.isSVG){const t=e.width*e.height;y>t&&(y=t)}_>y&&(l=Math.sqrt(_/y)),l&&(a/=l,r/=l,h/=l,c/=l),u&&(a/=u,r/=f),(p||1!==a||1!==r)&&(d||(d=_t(),p&&mt(d,p)),yt(d,1/a,1/r));const m=e.getCanvas(wt(h)||1,wt(c)||1,o.opacity,o.filters),w=e.getPattern(m,g||t.Platform.origin.noRepeat||"no-repeat",d,n);return n.style=w,n.patternId=s,!0}}function bt(t,e,n,i){return new(n||(n=Promise))((function(a,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,o)}l((i=i.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const{abs:Bt}=Math;const Et={image:function(e,n,i,a,r){let s,o;const l=t.ImageManager.get(i);return ot&&i===ot.paint&&dt(a,ot.boxBounds)?s=ot.leafPaint:(s={type:i.type,image:l},l.hasAlphaPixel&&(s.isTransparent=!0),ot=l.use>1?{leafPaint:s,paint:i,boxBounds:lt.set(a)}:null),(r||l.loading)&&(o={image:l,attrName:n,attrValue:i}),l.ready?(ht(e,n,i,l,s,a),r&&(ct(e,o),ut(e,o))):l.error?r&&ft(e,o,l.error):(r&&(gt(e,!0),ct(e,o)),s.loadId=l.load((()=>{gt(e,!1),e.destroyed||(ht(e,n,i,l,s,a)&&(l.hasAlphaPixel&&(e.__layout.hitCanvasChanged=!0),e.forceUpdate("surface")),ut(e,o)),s.loadId=void 0}),(t=>{gt(e,!1),ft(e,o,t),s.loadId=void 0})),e.placeholderColor&&(e.placeholderDelay?setTimeout((()=>{l.ready||(l.isPlacehold=!0,e.forceUpdate("surface"))}),e.placeholderDelay):l.isPlacehold=!0)),s},checkImage:function(e,i,a,r){const{scaleX:s,scaleY:o}=t.ImageManager.patternLocked?e.__world:e.__nowWorld,{pixelRatio:l}=i,{data:d}=a;if(!d||a.patternId===s+"-"+o+"-"+l&&!n.Export.running)return!1;if(r)if(d.repeat)r=!1;else if(!(a.changeful||t.ResizeEvent.isResizing(e)||n.Export.running)){let{width:e,height:n}=d;e*=Bt(s)*l,n*=Bt(o)*l,d.scaleX&&(e*=d.scaleX,n*=d.scaleY),r=e*n>t.Platform.image.maxCacheSize}return r?(function(t,e,n,i){e.save(),e.clipUI(t),n.blendMode&&(e.blendMode=n.blendMode);i.opacity&&(e.opacity*=i.opacity);i.transform&&e.transform(i.transform);e.drawImage(n.image.getFull(i.filters),0,0,i.width,i.height),e.restore()}(e,i,a,d),!0):(!a.style||a.sync||n.Export.running?xt(e,a,l):a.patternTask||(a.patternTask=t.ImageManager.patternTasker.add((()=>bt(this,void 0,void 0,(function*(){a.patternTask=null,i.bounds.hit(e.__nowWorld)&&xt(e,a,l),e.forceUpdate("surface")}))),300)),!1)},createPattern:xt,recycleImage:function(e,n){const i=n["_"+e];if(i instanceof Array){let a,r,s,o,l;for(let d=0,h=i.length;d<h;d++)a=i[d],r=a.image,l=r&&r.url,l&&(s||(s={}),s[l]=!0,t.ImageManager.recycle(r),r.loading&&(o||(o=n.__input&&n.__input[e]||[],o instanceof Array||(o=[o])),r.unload(i[d].loadId,!o.some((t=>t.url===l)))));return s}return null},createData:rt,getPatternData:st,fillOrFitMode:K,clipMode:$,repeatMode:J},{toPoint:Lt}=t.AroundHelper,{hasTransparent:kt}=n.ColorConvert,Rt={},Pt={};function St(t,e,i,a){if(i){let r,s,o,l;for(let t=0,d=i.length;t<d;t++)r=i[t],"string"==typeof r?(o=t/(d-1),s=n.ColorConvert.string(r,a)):(o=r.offset,s=n.ColorConvert.string(r.color,a)),e.addColorStop(o,s),!l&&kt(s)&&(l=!0);l&&(t.isTransparent=!0)}}const{getAngle:Ct,getDistance:At}=t.PointHelper,{get:Ot,rotateOfOuter:Tt,scaleOfOuter:Wt}=t.MatrixHelper,{toPoint:Mt}=t.AroundHelper,It={},Dt={};function Ht(t,e,n,i,a){let r;const{width:s,height:o}=t;if(s!==o||i){const t=Ct(e,n);r=Ot(),a?(Wt(r,e,s/o*(i||1),1),Tt(r,e,t+90)):(Wt(r,e,1,s/o*(i||1)),Tt(r,e,t))}return r}const{getDistance:Ft}=t.PointHelper,{toPoint:Gt}=t.AroundHelper,jt={},Yt={};const zt={linearGradient:function(e,n){let{from:i,to:a,type:r,opacity:s}=e;Lt(i||"top",n,Rt),Lt(a||"bottom",n,Pt);const o=t.Platform.canvas.createLinearGradient(Rt.x,Rt.y,Pt.x,Pt.y),l={type:r,style:o};return St(l,o,e.stops,s),l},radialGradient:function(e,n){let{from:i,to:a,type:r,opacity:s,stretch:o}=e;Mt(i||"center",n,It),Mt(a||"bottom",n,Dt);const l=t.Platform.canvas.createRadialGradient(It.x,It.y,0,It.x,It.y,At(It,Dt)),d={type:r,style:l};St(d,l,e.stops,s);const h=Ht(n,It,Dt,o,!0);return h&&(d.transform=h),d},conicGradient:function(e,n){let{from:i,to:a,type:r,opacity:s,stretch:o}=e;Gt(i||"center",n,jt),Gt(a||"bottom",n,Yt);const l=t.Platform.conicGradientSupport?t.Platform.canvas.createConicGradient(0,jt.x,jt.y):t.Platform.canvas.createRadialGradient(jt.x,jt.y,0,jt.x,jt.y,Ft(jt,Yt)),d={type:r,style:l};St(d,l,e.stops,s);const h=Ht(n,jt,Yt,o||1,t.Platform.conicGradientRotate90);return h&&(d.transform=h),d},getTransform:Ht},{copy:Ut,toOffsetOutBounds:qt}=t.BoundsHelper,Nt={},Xt={};function Vt(e,n,i,a){const{bounds:r,shapeBounds:s}=a;if(t.Platform.fullImageShadow){if(Ut(Nt,e.bounds),Nt.x+=n.x-s.x,Nt.y+=n.y-s.y,i){const{matrix:t}=a;Nt.x-=(r.x+(t?t.e:0)+r.width/2)*(i-1),Nt.y-=(r.y+(t?t.f:0)+r.height/2)*(i-1),Nt.width*=i,Nt.height*=i}e.copyWorld(a.canvas,e.bounds,Nt)}else i&&(Ut(Nt,n),Nt.x-=n.width/2*(i-1),Nt.y-=n.height/2*(i-1),Nt.width*=i,Nt.height*=i),e.copyWorld(a.canvas,s,i?Nt:n)}const{toOffsetOutBounds:Qt}=t.BoundsHelper,Zt={};const Kt={shadow:function(t,e,i){let a,r;const{__nowWorld:s,__layout:o}=t,{shadow:l}=t.__,{worldCanvas:d,bounds:h,shapeBounds:c,scaleX:u,scaleY:f}=i,p=e.getSameCanvas(),g=l.length-1;qt(h,Xt),l.forEach(((l,_)=>{p.setWorldShadow(Xt.offsetX+l.x*u,Xt.offsetY+l.y*f,l.blur*u,n.ColorConvert.string(l.color)),r=l.spread?1+2*l.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,Vt(p,Xt,r,i),a=h,l.box&&(p.restore(),p.save(),d&&(p.copyWorld(p,h,s,"copy"),a=s),d?p.copyWorld(d,s,s,"destination-out"):p.copyWorld(i.canvas,c,h,"destination-out")),t.__worldFlipped?e.copyWorldByReset(p,a,s,l.blendMode):e.copyWorldToInner(p,a,o.renderBounds,l.blendMode),g&&_<g&&p.clearWorld(a,!0)})),p.recycle(a)},innerShadow:function(t,e,i){let a,r;const{__nowWorld:s,__layout:o}=t,{innerShadow:l}=t.__,{worldCanvas:d,bounds:h,shapeBounds:c,scaleX:u,scaleY:f}=i,p=e.getSameCanvas(),g=l.length-1;Qt(h,Zt),l.forEach(((l,_)=>{p.save(),p.setWorldShadow(Zt.offsetX+l.x*u,Zt.offsetY+l.y*f,l.blur*u),r=l.spread?1-2*l.spread/(o.boxBounds.width+2*(o.strokeBoxSpread||0)):0,Vt(p,Zt,r,i),p.restore(),d?(p.copyWorld(p,h,s,"copy"),p.copyWorld(d,s,s,"source-out"),a=s):(p.copyWorld(i.canvas,c,h,"source-out"),a=h),p.fillWorld(a,n.ColorConvert.string(l.color),"source-in"),t.__worldFlipped?e.copyWorldByReset(p,a,s,l.blendMode):e.copyWorldToInner(p,a,o.renderBounds,l.blendMode),g&&_<g&&p.clearWorld(a,!0)})),p.recycle(a)},blur:function(t,e,n){const{blur:i}=t.__;n.setWorldBlur(i*t.__nowWorld.a),n.copyWorldToInner(e,t.__nowWorld,t.__layout.renderBounds),n.filter="none"},backgroundBlur:function(t,e,n){}},{excludeRenderBounds:$t}=t.LeafBoundsHelper;function Jt(t,e,n,i,a,r){switch(e){case"grayscale":a.useGrayscaleAlpha(t.__nowWorld);case"alpha":!function(t,e,n,i){const a=t.__nowWorld;n.resetTransform(),n.opacity=1,n.useMask(i,a),i.recycle(a),ee(t,e,n,1)}(t,n,i,a);break;case"opacity-path":ee(t,n,i,r);break;case"path":n.restore()}}function te(t){return t.getSameCanvas(!1,!0)}function ee(t,e,n,i){const a=t.__nowWorld;e.resetTransform(),e.opacity=i,e.copyWorld(n,a),n.recycle(a)}n.Group.prototype.__renderMask=function(t,e){let n,i,a,r,s,o;const{children:l}=this;for(let d=0,h=l.length;d<h;d++)n=l[d],o=n.__.mask,o&&(s&&(Jt(this,s,t,a,i,r),i=a=null),"path"===o||"clipping-path"===o?(n.opacity<1?(s="opacity-path",r=n.opacity,a||(a=te(t))):(s="path",t.save()),n.__clip(a||t,e)):(s="grayscale"===o?"grayscale":"alpha",i||(i=te(t)),a||(a=te(t)),n.__render(i,e)),"clipping"!==o&&"clipping-path"!==o)||$t(n,e)||n.__render(a||t,e);Jt(this,s,t,a,i,r)};const ne=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",ie=ne+"_#~&*+\\=|≮≯≈≠=…",ae=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 re(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const se=re("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),oe=re("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),le=re(ne),de=re(ie),he=re("- —/~|┆·");var ce;!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"}(ce||(ce={}));const{Letter:ue,Single:fe,Before:pe,After:ge,Symbol:_e,Break:ye}=ce;function me(t){return se[t]?ue:he[t]?ye:oe[t]?pe:le[t]?ge:de[t]?_e:ae.test(t)?fe:ue}const we={trimRight(t){const{words:e}=t;let n,i=0,a=e.length;for(let r=a-1;r>-1&&(n=e[r].data[0]," "===n.char);r--)i++,t.width-=n.width;i&&e.splice(a-i,i)}};function ve(t,e,n){switch(e){case"title":return n?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:xe}=we,{Letter:be,Single:Be,Before:Ee,After:Le,Symbol:ke,Break:Re}=ce;let Pe,Se,Ce,Ae,Oe,Te,We,Me,Ie,De,He,Fe,Ge,je,Ye,ze,Ue,qe=[];function Ne(t,e){Ie&&!Me&&(Me=Ie),Pe.data.push({char:t,width:e}),Ce+=e}function Xe(){Ae+=Ce,Pe.width=Ce,Se.words.push(Pe),Pe={data:[]},Ce=0}function Ve(){je&&(Ye.paraNumber++,Se.paraStart=!0,je=!1),Ie&&(Se.startCharSize=Me,Se.endCharSize=Ie,Me=0),Se.width=Ae,ze.width?xe(Se):Ue&&Qe(),qe.push(Se),Se={words:[]},Ae=0}function Qe(){Ae>(Ye.maxWidth||0)&&(Ye.maxWidth=Ae)}const{top:Ze,right:Ke,bottom:$e,left:Je}=t.Direction4;function tn(t,e,n){const{bounds:i,rows:a}=t;i[e]+=n;for(let t=0;t<a.length;t++)a[t][e]+=n}const en={getDrawData:function(e,i){"string"!=typeof e&&(e=String(e));let a=0,r=0,s=i.__getInput("width")||0,o=i.__getInput("height")||0;const{textDecoration:l,__font:d,__padding:h}=i;h&&(s?(a=h[Je],s-=h[Ke]+h[Je]):i.autoSizeAlign||(a=h[Je]),o?(r=h[Ze],o-=h[Ze]+h[$e]):i.autoSizeAlign||(r=h[Ze]));const c={bounds:{x:a,y:r,width:s,height:o},rows:[],paraNumber:0,font:t.Platform.canvas.font=d};return function(e,n,i){Ye=e,qe=e.rows,ze=e.bounds,Ue=!ze.width&&!i.autoSizeAlign;const{__letterSpacing:a,paraIndent:r,textCase:s}=i,{canvas:o}=t.Platform,{width:l,height:d}=ze;if(l||d||a||"none"!==s){const t="none"!==i.textWrap,e="break"===i.textWrap;je=!0,He=null,Me=We=Ie=Ce=Ae=0,Pe={data:[]},Se={words:[]},a&&(n=[...n]);for(let i=0,d=n.length;i<d;i++)Te=n[i],"\n"===Te?(Ce&&Xe(),Se.paraEnd=!0,Ve(),je=!0):(De=me(Te),De===be&&"none"!==s&&(Te=ve(Te,s,!Ce)),We=o.measureText(Te).width,a&&(a<0&&(Ie=We),We+=a),Fe=De===Be&&(He===Be||He===be)||He===Be&&De!==Le,Ge=!(De!==Ee&&De!==Be||He!==ke&&He!==Le),Oe=je&&r?l-r:l,t&&l&&Ae+Ce+We>Oe&&(e?(Ce&&Xe(),Ae&&Ve()):(Ge||(Ge=De===be&&He==Le),Fe||Ge||De===Re||De===Ee||De===Be||Ce+We>Oe?(Ce&&Xe(),Ae&&Ve()):Ae&&Ve()))," "===Te&&!0!==je&&Ae+Ce===0||(De===Re?(" "===Te&&Ce&&Xe(),Ne(Te,We),Xe()):Fe||Ge?(Ce&&Xe(),Ne(Te,We)):Ne(Te,We)),He=De);Ce&&Xe(),Ae&&Ve(),qe.length>0&&(qe[qe.length-1].paraEnd=!0)}else n.split("\n").forEach((t=>{Ye.paraNumber++,Ae=o.measureText(t).width,qe.push({x:r||0,text:t,width:Ae,paraStart:!0}),Ue&&Qe()}))}(c,e,i),h&&function(t,e,n,i,a){if(!i&&n.autoSizeAlign)switch(n.textAlign){case"left":tn(e,"x",t[Je]);break;case"right":tn(e,"x",-t[Ke])}if(!a&&n.autoSizeAlign)switch(n.verticalAlign){case"top":tn(e,"y",t[Ze]);break;case"bottom":tn(e,"y",-t[$e])}}(h,c,i,s,o),function(t,e){const{rows:n,bounds:i}=t,a=n.length,{__lineHeight:r,__baseLine:s,__letterSpacing:o,__clipText:l,textAlign:d,verticalAlign:h,paraSpacing:c,autoSizeAlign:u}=e;let{x:f,y:p,width:g,height:_}=i,y=r*a+(c?c*(t.paraNumber-1):0),m=s;if(l&&y>_)y=Math.max(_,r),a>1&&(t.overflow=a);else if(_||u)switch(h){case"middle":p+=(_-y)/2;break;case"bottom":p+=_-y}m+=p;let w,v,x,b=g||u?g:t.maxWidth;for(let s=0,h=a;s<h;s++){if(w=n[s],w.x=f,w.width<g||w.width>g&&!l)switch(d){case"center":w.x+=(b-w.width)/2;break;case"right":w.x+=b-w.width}w.paraStart&&c&&s>0&&(m+=c),w.y=m,m+=r,t.overflow>s&&m>y&&(w.isOverflow=!0,t.overflow=s+1),v=w.x,x=w.width,o<0&&(w.width<0?(x=-w.width+e.fontSize+o,v-=x,x+=e.fontSize):x-=o),v<i.x&&(i.x=v),x>i.width&&(i.width=x),l&&g&&g<x&&(w.isOverflow=!0,t.overflow||(t.overflow=n.length))}i.y=p,i.height=y}(c,i),function(t,e,n){const{rows:i}=t,{textAlign:a,paraIndent:r,letterSpacing:s}=e;let o,l,d,h,c,u;i.forEach((t=>{t.words&&(d=r&&t.paraStart?r:0,u=t.words.length,l=n&&("justify"===a||"both"===a)&&u>1?(n-t.width-d)/(u-1):0,h=s||t.isOverflow?0:l>.01?1:2,t.isOverflow&&!s&&(t.textMode=!0),2===h?(t.x+=d,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=d,o=t.x,t.data=[],t.words.forEach(((e,n)=>{1===h?(c={char:"",x:o},o=function(t,e,n){return t.forEach((t=>{n.char+=t.char,e+=t.width})),e}(e.data,o,c),(t.isOverflow||" "!==c.char)&&t.data.push(c)):o=function(t,e,n,i){return t.forEach((t=>{(i||" "!==t.char)&&(t.x=e,n.push(t)),e+=t.width})),e}(e.data,o,t.data,t.isOverflow),!l||t.paraEnd&&"both"!==a||n===u-1||(o+=l,t.width+=l)}))),t.words=null)}))}(c,i,s),c.overflow&&function(e,n,i,a){if(!a)return;const{rows:r,overflow:s}=e;let{textOverflow:o}=n;if(r.splice(s),o&&"show"!==o){let e,l;"hide"===o?o="":"ellipsis"===o&&(o="...");const d=o?t.Platform.canvas.measureText(o).width:0,h=i+a-d;("none"===n.textWrap?r:[r[s-1]]).forEach((t=>{if(t.isOverflow&&t.data){let n=t.data.length-1;for(let i=n;i>-1&&(e=t.data[i],l=e.x+e.width,!(i===n&&l<h));i--){if(l<h&&" "!==e.char||!i){t.data.splice(i+1),t.width-=e.width;break}t.width-=e.width}t.width+=d,t.data.push({char:o,x:l}),t.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(t)}}))}}(c,i,a,s),"none"!==l&&function(t,e){let i;const{fontSize:a,textDecoration:r}=e;switch(t.decorationHeight=a/11,"object"==typeof r?(i=r.type,r.color&&(t.decorationColor=n.ColorConvert.string(r.color))):i=r,i){case"under":t.decorationY=[.15*a];break;case"delete":t.decorationY=[.35*-a];break;case"under-delete":t.decorationY=[.15*a,.35*-a]}}(c,i),c}};const nn={string:function(t,e){const i="number"==typeof e&&1!==e;if("string"==typeof t){if(!i||!n.ColorConvert.object)return t;t=n.ColorConvert.object(t)}let a=void 0===t.a?1:t.a;i&&(a*=e);const r=t.r+","+t.g+","+t.b;return 1===a?"rgb("+r+")":"rgba("+r+","+a+")"}};Object.assign(n.TextConvert,en),Object.assign(n.ColorConvert,nn),Object.assign(n.Paint,Y),Object.assign(n.PaintImage,Et),Object.assign(n.PaintGradient,zt),Object.assign(n.Effect,Kt),Object.assign(t.Creator,{interaction:(t,n,i,a)=>new e.InteractionBase(t,n,i,a),hitCanvas:(t,e)=>new i(t,e),hitCanvasManager:()=>new e.HitCanvasManager}),r(),Object.defineProperty(exports,"LeaferImage",{enumerable:!0,get:function(){return t.LeaferImage}}),exports.Layouter=m,exports.LeaferCanvas=i,exports.Picker=b,exports.Renderer=v,exports.Selector=B,exports.Watcher=o,exports.useCanvas=r,Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})})),Object.keys(e).forEach((function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})}));
|
|
2
2
|
//# sourceMappingURL=worker.min.cjs.map
|