@pixodesk/svg-animator-core 1.0.44 → 1.0.45
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/{PxDocumentDiagnostic-n8yiyL0k.d.cts → PxDocumentDiagnostic-CBhVyNEi.d.cts} +22 -22
- package/dist/{PxDocumentDiagnostic-n8yiyL0k.d.ts → PxDocumentDiagnostic-CBhVyNEi.d.ts} +22 -22
- package/dist/chunk-5HEVTP2N.min.js +1 -0
- package/dist/{chunk-EFQLDGFY.js → chunk-YVKMPBHE.js} +1969 -64
- package/dist/chunk-YVKMPBHE.js.map +1 -0
- package/dist/index.cjs +116 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -1873
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.js +1 -1
- package/dist/internal.cjs +3209 -139
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +60 -3
- package/dist/internal.d.ts +60 -3
- package/dist/internal.js +53 -1
- package/dist/internal.js.map +1 -1
- package/dist/internal.min.cjs +1 -1
- package/dist/internal.min.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-EFQLDGFY.js.map +0 -1
- package/dist/chunk-YWBPS6E4.min.js +0 -1
|
@@ -2268,6 +2268,38 @@ function toDomProps(props) {
|
|
|
2268
2268
|
return propsCopy;
|
|
2269
2269
|
}
|
|
2270
2270
|
|
|
2271
|
+
// src/animation/PxStaticTransformMerge.ts
|
|
2272
|
+
function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
|
|
2273
|
+
if (!animDef) return animDef;
|
|
2274
|
+
const staticParts = staticTransform && typeof staticTransform === "object" && !Array.isArray(staticTransform) ? staticTransform : parseTransformParts(staticTransform);
|
|
2275
|
+
if (!staticParts || !Object.keys(staticParts).length) return animDef;
|
|
2276
|
+
const mergeKfValue = (v) => v && typeof v === "object" && !Array.isArray(v) ? __spreadValues(__spreadValues({}, staticParts), v) : v;
|
|
2277
|
+
const transformAnim = animDef[TRANSFORM_ATTR];
|
|
2278
|
+
if (transformAnim && typeof transformAnim === "object") {
|
|
2279
|
+
const anim = transformAnim;
|
|
2280
|
+
if (Array.isArray(anim.keyframes)) {
|
|
2281
|
+
const out = __spreadProps(__spreadValues({}, anim), {
|
|
2282
|
+
keyframes: anim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: mergeKfValue(kf.value) }))
|
|
2283
|
+
});
|
|
2284
|
+
if (out.value !== void 0) out.value = mergeKfValue(out.value);
|
|
2285
|
+
return __spreadProps(__spreadValues({}, animDef), { transform: out });
|
|
2286
|
+
}
|
|
2287
|
+
return animDef;
|
|
2288
|
+
}
|
|
2289
|
+
const channels = Object.keys(animDef).filter((k) => PX_TRANSFORM_FN_NAMES.has(k));
|
|
2290
|
+
if (channels.length !== 1) return animDef;
|
|
2291
|
+
const ch = channels[0];
|
|
2292
|
+
const chAnim = animDef[ch];
|
|
2293
|
+
if (!chAnim || typeof chAnim !== "object" || !Array.isArray(chAnim.keyframes)) return animDef;
|
|
2294
|
+
const lifted = __spreadProps(__spreadValues({}, chAnim), {
|
|
2295
|
+
keyframes: chAnim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: __spreadProps(__spreadValues({}, staticParts), { [ch]: kf.value }) }))
|
|
2296
|
+
});
|
|
2297
|
+
if (lifted.value !== void 0) lifted.value = __spreadProps(__spreadValues({}, staticParts), { [ch]: lifted.value });
|
|
2298
|
+
const rest = __spreadValues({}, animDef);
|
|
2299
|
+
delete rest[ch];
|
|
2300
|
+
return __spreadProps(__spreadValues({}, rest), { transform: lifted });
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2271
2303
|
// src/materialize/PxMotionPath.ts
|
|
2272
2304
|
function getKfTranslate(kf) {
|
|
2273
2305
|
const v = keyframeValue(kf);
|
|
@@ -2637,7 +2669,7 @@ function walkAndMaterialize(node, opts) {
|
|
|
2637
2669
|
let newAnimate;
|
|
2638
2670
|
const animBucket = node.animate;
|
|
2639
2671
|
if (animBucket && typeof animBucket === "object" && !Array.isArray(animBucket)) {
|
|
2640
|
-
const animDef = animBucket;
|
|
2672
|
+
const animDef = mergeStaticTransformIntoAnimDef(animBucket, node.transform);
|
|
2641
2673
|
const transformAnim = animDef.transform;
|
|
2642
2674
|
if (transformAnim && typeof transformAnim === "object" && propAnimIsMotionPath(transformAnim)) {
|
|
2643
2675
|
const materialized = materializeMotionPathInPropAnim(transformAnim, opts);
|
|
@@ -3151,36 +3183,6 @@ var _elementIdCounter = 0;
|
|
|
3151
3183
|
function generateElementId() {
|
|
3152
3184
|
return "_px_el_" + ++_elementIdCounter;
|
|
3153
3185
|
}
|
|
3154
|
-
function mergeStaticTransformIntoAnimDef(animDef, staticTransform) {
|
|
3155
|
-
if (!animDef) return animDef;
|
|
3156
|
-
const staticParts = staticTransform && typeof staticTransform === "object" && !Array.isArray(staticTransform) ? staticTransform : parseTransformParts(staticTransform);
|
|
3157
|
-
if (!staticParts || !Object.keys(staticParts).length) return animDef;
|
|
3158
|
-
const mergeKfValue = (v) => v && typeof v === "object" && !Array.isArray(v) ? __spreadValues(__spreadValues({}, staticParts), v) : v;
|
|
3159
|
-
const transformAnim = animDef[TRANSFORM_ATTR];
|
|
3160
|
-
if (transformAnim && typeof transformAnim === "object") {
|
|
3161
|
-
const anim = transformAnim;
|
|
3162
|
-
if (Array.isArray(anim.keyframes)) {
|
|
3163
|
-
const out = __spreadProps(__spreadValues({}, anim), {
|
|
3164
|
-
keyframes: anim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: mergeKfValue(kf.value) }))
|
|
3165
|
-
});
|
|
3166
|
-
if (out.value !== void 0) out.value = mergeKfValue(out.value);
|
|
3167
|
-
return __spreadProps(__spreadValues({}, animDef), { transform: out });
|
|
3168
|
-
}
|
|
3169
|
-
return animDef;
|
|
3170
|
-
}
|
|
3171
|
-
const channels = Object.keys(animDef).filter((k) => PX_TRANSFORM_FN_NAMES.has(k));
|
|
3172
|
-
if (channels.length !== 1) return animDef;
|
|
3173
|
-
const ch = channels[0];
|
|
3174
|
-
const chAnim = animDef[ch];
|
|
3175
|
-
if (!chAnim || typeof chAnim !== "object" || !Array.isArray(chAnim.keyframes)) return animDef;
|
|
3176
|
-
const lifted = __spreadProps(__spreadValues({}, chAnim), {
|
|
3177
|
-
keyframes: chAnim.keyframes.map((kf) => __spreadProps(__spreadValues({}, kf), { value: __spreadProps(__spreadValues({}, staticParts), { [ch]: kf.value }) }))
|
|
3178
|
-
});
|
|
3179
|
-
if (lifted.value !== void 0) lifted.value = __spreadProps(__spreadValues({}, staticParts), { [ch]: lifted.value });
|
|
3180
|
-
const rest = __spreadValues({}, animDef);
|
|
3181
|
-
delete rest[ch];
|
|
3182
|
-
return __spreadProps(__spreadValues({}, rest), { transform: lifted });
|
|
3183
|
-
}
|
|
3184
3186
|
function normalizeAnimationDefinition(animDef, duration, defs, engine = PxTimelineEngine.native) {
|
|
3185
3187
|
const normalized = {};
|
|
3186
3188
|
for (const [propName, propAnim] of Object.entries(animDef)) {
|
|
@@ -3263,7 +3265,7 @@ function getKeyframesPair(keyframes, progress) {
|
|
|
3263
3265
|
return { prevKf, nextKf };
|
|
3264
3266
|
}
|
|
3265
3267
|
function calcPropertyValue(propName, propAnim, progress) {
|
|
3266
|
-
var _a2, _b, _c, _d;
|
|
3268
|
+
var _a2, _b, _c, _d, _e;
|
|
3267
3269
|
const keyframes = propAnim.keyframes || [];
|
|
3268
3270
|
if (keyframes.length === 0) return null;
|
|
3269
3271
|
const { prevKf, nextKf } = getKeyframesPair(keyframes, progress);
|
|
@@ -3332,7 +3334,7 @@ function calcPropertyValue(propName, propAnim, progress) {
|
|
|
3332
3334
|
!!propAnim.autoOrient
|
|
3333
3335
|
);
|
|
3334
3336
|
partsResult.translate = [sample.translate[0], sample.translate[1]];
|
|
3335
|
-
if (sample.rotateDeg !== void 0) partsResult.rotate = sample.rotateDeg;
|
|
3337
|
+
if (sample.rotateDeg !== void 0) partsResult.rotate = sample.rotateDeg + ((_e = partsResult.rotate) != null ? _e : 0);
|
|
3336
3338
|
}
|
|
3337
3339
|
}
|
|
3338
3340
|
cssValue = composeTransformParts(partsResult, { withUnits: false });
|
|
@@ -3618,12 +3620,12 @@ function deepClonePxNode(value) {
|
|
|
3618
3620
|
for (const k of Object.keys(value)) out[k] = deepClonePxNode(value[k]);
|
|
3619
3621
|
return out;
|
|
3620
3622
|
}
|
|
3621
|
-
function regenerateIdsAndRewriteRefs(root,
|
|
3623
|
+
function regenerateIdsAndRewriteRefs(root, genId3) {
|
|
3622
3624
|
const oldToNew = /* @__PURE__ */ new Map();
|
|
3623
3625
|
const walkAssign = (n) => {
|
|
3624
3626
|
var _a2;
|
|
3625
3627
|
if (typeof n.id === "string") {
|
|
3626
|
-
const newId =
|
|
3628
|
+
const newId = genId3();
|
|
3627
3629
|
oldToNew.set(n.id, newId);
|
|
3628
3630
|
n.id = newId;
|
|
3629
3631
|
}
|
|
@@ -4409,6 +4411,1931 @@ function applyTextGlyphsAlongPath(node, ctx, pathD, startOffset, textLength, pat
|
|
|
4409
4411
|
return materializeGlyphTextAlongPath(node, pathD, startOffset, { glyphs: ctx.glyphs, warnings: ctx.warnings }, textLength, pathOverflow);
|
|
4410
4412
|
}
|
|
4411
4413
|
|
|
4414
|
+
// src/effects/transform/transformationEffect.ts
|
|
4415
|
+
function applyTransformByEffect(node, fx, ctx) {
|
|
4416
|
+
if (!fx) return node;
|
|
4417
|
+
delete node.transform;
|
|
4418
|
+
let n = node;
|
|
4419
|
+
n = wrapOrigin(
|
|
4420
|
+
n,
|
|
4421
|
+
fx.origin,
|
|
4422
|
+
/*invert=*/
|
|
4423
|
+
true
|
|
4424
|
+
);
|
|
4425
|
+
n = wrapTransformPart(n, "scale" /* Scale */, normalizeScale(fx.scale), ctx);
|
|
4426
|
+
n = wrapTransformPart(n, "skew" /* Skew */, fx.skew, ctx);
|
|
4427
|
+
n = wrapTransformPart(n, "rotate" /* Rotate */, fx.rotate, ctx);
|
|
4428
|
+
n = wrapOrigin(
|
|
4429
|
+
n,
|
|
4430
|
+
fx.origin,
|
|
4431
|
+
/*invert=*/
|
|
4432
|
+
false
|
|
4433
|
+
);
|
|
4434
|
+
if (translateHasAutoOrient(fx.translate)) {
|
|
4435
|
+
n = wrapOrigin(
|
|
4436
|
+
n,
|
|
4437
|
+
fx.origin,
|
|
4438
|
+
/*invert=*/
|
|
4439
|
+
true
|
|
4440
|
+
);
|
|
4441
|
+
n = wrapTransformPart(n, "translate" /* Translate */, fx.translate, ctx);
|
|
4442
|
+
n = wrapOrigin(
|
|
4443
|
+
n,
|
|
4444
|
+
fx.origin,
|
|
4445
|
+
/*invert=*/
|
|
4446
|
+
false
|
|
4447
|
+
);
|
|
4448
|
+
} else {
|
|
4449
|
+
n = wrapTransformPart(n, "translate" /* Translate */, fx.translate, ctx);
|
|
4450
|
+
}
|
|
4451
|
+
if (n !== node && node.id) {
|
|
4452
|
+
n.id = node.id;
|
|
4453
|
+
delete node.id;
|
|
4454
|
+
}
|
|
4455
|
+
return n;
|
|
4456
|
+
}
|
|
4457
|
+
function translateHasAutoOrient(translate) {
|
|
4458
|
+
if (!translate || typeof translate !== "object") return false;
|
|
4459
|
+
const obj = translate;
|
|
4460
|
+
if (obj.autoOrient) return true;
|
|
4461
|
+
return Array.isArray(obj.keyframes) && obj.keyframes.some((kf) => kf.tangentOut || kf.tangentIn);
|
|
4462
|
+
}
|
|
4463
|
+
function normalizeScale(raw) {
|
|
4464
|
+
return raw;
|
|
4465
|
+
}
|
|
4466
|
+
function wrapTransformPart(inner, part, raw, ctx) {
|
|
4467
|
+
if (raw === void 0) return inner;
|
|
4468
|
+
const v = readAnimatable(raw);
|
|
4469
|
+
if (v.kind === "static" /* Static */) {
|
|
4470
|
+
return { type: "g", transform: { value: partsRecord(part, v.value, void 0) }, children: [inner] };
|
|
4471
|
+
}
|
|
4472
|
+
if (v.kind === "animated" /* Animated */) {
|
|
4473
|
+
const animTr = { keyframes: v.keyframes.map((kf) => keyframeWith(kf, partsRecord(part, kf.value, void 0))) };
|
|
4474
|
+
if (v.autoOrient) animTr.autoOrient = true;
|
|
4475
|
+
if (v.loop !== void 0) animTr.loop = v.loop;
|
|
4476
|
+
return {
|
|
4477
|
+
type: "g",
|
|
4478
|
+
animate: { transform: animTr },
|
|
4479
|
+
children: [inner]
|
|
4480
|
+
};
|
|
4481
|
+
}
|
|
4482
|
+
return inner;
|
|
4483
|
+
}
|
|
4484
|
+
function wrapOrigin(inner, raw, invert) {
|
|
4485
|
+
if (raw === void 0) return inner;
|
|
4486
|
+
const v = readAnimatable(raw);
|
|
4487
|
+
const sign = (value) => invert ? [-value[0], -value[1]] : value;
|
|
4488
|
+
if (v.kind === "absent" /* Absent */) return inner;
|
|
4489
|
+
if (v.kind === "static" /* Static */) {
|
|
4490
|
+
if (v.value[0] === 0 && v.value[1] === 0) return inner;
|
|
4491
|
+
return { type: "g", transform: { value: { translate: sign(v.value) } }, children: [inner] };
|
|
4492
|
+
}
|
|
4493
|
+
if (v.kind === "animated" /* Animated */) {
|
|
4494
|
+
const animTr = { keyframes: v.keyframes.map((kf) => keyframeWith(kf, { translate: sign(kf.value) })) };
|
|
4495
|
+
if (v.loop !== void 0) animTr.loop = v.loop;
|
|
4496
|
+
return {
|
|
4497
|
+
type: "g",
|
|
4498
|
+
animate: { transform: animTr },
|
|
4499
|
+
children: [inner]
|
|
4500
|
+
};
|
|
4501
|
+
}
|
|
4502
|
+
return inner;
|
|
4503
|
+
}
|
|
4504
|
+
|
|
4505
|
+
// src/effects/reference/contentRefSplit.ts
|
|
4506
|
+
function identifyContentRefTargets(node, ctx, allocator) {
|
|
4507
|
+
var _a2, _b, _c;
|
|
4508
|
+
if (node.type === "use" && ((_b = (_a2 = node.effects) == null ? void 0 : _a2.clone) == null ? void 0 : _b.without) === "translate") {
|
|
4509
|
+
const sourceId = stripHash(node.effects.clone.source);
|
|
4510
|
+
if (typeof sourceId === "string" && sourceId && !ctx.contentRefInnerIds.has(sourceId)) {
|
|
4511
|
+
ctx.contentRefInnerIds.set(sourceId, allocator(sourceId));
|
|
4512
|
+
}
|
|
4513
|
+
}
|
|
4514
|
+
(_c = node.children) == null ? void 0 : _c.forEach((c) => identifyContentRefTargets(c, ctx, allocator));
|
|
4515
|
+
}
|
|
4516
|
+
function splitForContentRef(node, transformBy, originalId, innerId, ctx) {
|
|
4517
|
+
const outerBody = liftBodyTranslate(node, transformBy);
|
|
4518
|
+
if (typeof node.id === "string") delete node.id;
|
|
4519
|
+
const { outer: outerTr, inner: innerTr } = splitTransformByEffect(transformBy);
|
|
4520
|
+
let innerNode = node;
|
|
4521
|
+
innerNode = applyTransformByEffect(innerNode, innerTr, ctx);
|
|
4522
|
+
const innerWrapper = { type: "g", id: innerId, children: [innerNode] };
|
|
4523
|
+
let outerWrapper = { type: "g", id: originalId, children: [innerWrapper] };
|
|
4524
|
+
if (outerBody.transform !== void 0) outerWrapper.transform = outerBody.transform;
|
|
4525
|
+
if (outerBody.animate !== void 0) outerWrapper.animate = outerBody.animate;
|
|
4526
|
+
if (outerTr) {
|
|
4527
|
+
delete outerWrapper.id;
|
|
4528
|
+
outerWrapper = applyTransformByEffect(outerWrapper, outerTr, ctx);
|
|
4529
|
+
outerWrapper.id = originalId;
|
|
4530
|
+
}
|
|
4531
|
+
return outerWrapper;
|
|
4532
|
+
}
|
|
4533
|
+
function liftBodyTranslate(node, transformBy) {
|
|
4534
|
+
var _a2, _b, _c;
|
|
4535
|
+
const out = {};
|
|
4536
|
+
let didLiftAnimate = false;
|
|
4537
|
+
const animTr = (_a2 = node.animate) == null ? void 0 : _a2.transform;
|
|
4538
|
+
if (animTr && typeof animTr === "object" && Array.isArray(animTr.keyframes)) {
|
|
4539
|
+
const kfs = animTr.keyframes;
|
|
4540
|
+
const hasTranslate = kfs.some((kf) => kf.value && kf.value.translate);
|
|
4541
|
+
if (hasTranslate) {
|
|
4542
|
+
const outerHasOrigin = needsOriginOnOuter(animTr);
|
|
4543
|
+
const outerKfs = kfs.map((kf) => {
|
|
4544
|
+
const v = kf.value || {};
|
|
4545
|
+
const newValue = {};
|
|
4546
|
+
if (v.translate !== void 0) newValue.translate = v.translate;
|
|
4547
|
+
if (outerHasOrigin && v.origin !== void 0) newValue.origin = v.origin;
|
|
4548
|
+
const outerKf = { value: newValue };
|
|
4549
|
+
if (kf.time !== void 0) outerKf.time = kf.time;
|
|
4550
|
+
if (kf.easing !== void 0) outerKf.easing = kf.easing;
|
|
4551
|
+
if (kf.tangentOut !== void 0) outerKf.tangentOut = kf.tangentOut;
|
|
4552
|
+
if (kf.tangentIn !== void 0) outerKf.tangentIn = kf.tangentIn;
|
|
4553
|
+
return outerKf;
|
|
4554
|
+
});
|
|
4555
|
+
const outerAnimTr = { keyframes: outerKfs };
|
|
4556
|
+
if (animTr.autoOrient) outerAnimTr.autoOrient = true;
|
|
4557
|
+
const srcLoop = animTr.loop;
|
|
4558
|
+
if (srcLoop !== void 0) outerAnimTr.loop = srcLoop;
|
|
4559
|
+
out.animate = { transform: outerAnimTr };
|
|
4560
|
+
const innerHasPivotedPart = kfs.some((kf) => {
|
|
4561
|
+
const v = kf.value || {};
|
|
4562
|
+
return v.rotate !== void 0 || v.scale !== void 0;
|
|
4563
|
+
});
|
|
4564
|
+
const innerKfs = kfs.map((kf) => {
|
|
4565
|
+
const v = kf.value || {};
|
|
4566
|
+
const newValue = {};
|
|
4567
|
+
if (v.rotate !== void 0) newValue.rotate = v.rotate;
|
|
4568
|
+
if (v.scale !== void 0) newValue.scale = v.scale;
|
|
4569
|
+
if (v.origin !== void 0 && (!outerHasOrigin || innerHasPivotedPart)) newValue.origin = v.origin;
|
|
4570
|
+
const innerKf = { value: newValue };
|
|
4571
|
+
if (kf.time !== void 0) innerKf.time = kf.time;
|
|
4572
|
+
if (kf.easing !== void 0) innerKf.easing = kf.easing;
|
|
4573
|
+
return innerKf;
|
|
4574
|
+
});
|
|
4575
|
+
const allInnerEmpty = innerKfs.every((kf) => Object.keys(kf.value).length === 0);
|
|
4576
|
+
if (allInnerEmpty) {
|
|
4577
|
+
delete node.animate.transform;
|
|
4578
|
+
if (node.animate && Object.keys(node.animate).length === 0) delete node.animate;
|
|
4579
|
+
} else {
|
|
4580
|
+
const innerAnimTr = { keyframes: innerKfs };
|
|
4581
|
+
if (srcLoop !== void 0) innerAnimTr.loop = srcLoop;
|
|
4582
|
+
node.animate.transform = innerAnimTr;
|
|
4583
|
+
}
|
|
4584
|
+
didLiftAnimate = true;
|
|
4585
|
+
}
|
|
4586
|
+
}
|
|
4587
|
+
const transformationHasTranslate = (transformBy == null ? void 0 : transformBy.translate) !== void 0;
|
|
4588
|
+
const stripBodyTranslateOnly = didLiftAnimate || transformationHasTranslate;
|
|
4589
|
+
const liftedAnimateIsAutoOriented = didLiftAnimate && needsOriginOnOuter(((_b = node.animate) == null ? void 0 : _b.transform) || void 0) || didLiftAnimate && needsOriginOnOuter(((_c = out.animate) == null ? void 0 : _c.transform) || void 0);
|
|
4590
|
+
if (typeof node.transform === "string") {
|
|
4591
|
+
const split = splitTransformString(node.transform);
|
|
4592
|
+
if (stripBodyTranslateOnly) {
|
|
4593
|
+
if (split.translate !== void 0) {
|
|
4594
|
+
if (split.rest) node.transform = split.rest;
|
|
4595
|
+
else delete node.transform;
|
|
4596
|
+
} else if (isPureTranslateBody(node.transform)) {
|
|
4597
|
+
delete node.transform;
|
|
4598
|
+
} else if (liftedAnimateIsAutoOriented && isSingleMatrixBody(node.transform)) {
|
|
4599
|
+
delete node.transform;
|
|
4600
|
+
}
|
|
4601
|
+
} else if (split.translate) {
|
|
4602
|
+
out.transform = split.translate;
|
|
4603
|
+
if (split.rest) node.transform = split.rest;
|
|
4604
|
+
else delete node.transform;
|
|
4605
|
+
}
|
|
4606
|
+
} else if (node.transform && typeof node.transform === "object" && !Array.isArray(node.transform) && !node.transform.keyframes) {
|
|
4607
|
+
const wrapped = node.transform.value;
|
|
4608
|
+
const isWrapped = !!(wrapped && typeof wrapped === "object");
|
|
4609
|
+
const value = isWrapped ? wrapped : node.transform;
|
|
4610
|
+
const rewrap = (rec) => isWrapped ? { value: rec } : rec;
|
|
4611
|
+
if (Array.isArray(value.translate)) {
|
|
4612
|
+
const rest = __spreadValues({}, value);
|
|
4613
|
+
delete rest.translate;
|
|
4614
|
+
const hasRest = Object.keys(rest).length > 0;
|
|
4615
|
+
if (stripBodyTranslateOnly) {
|
|
4616
|
+
if (hasRest) node.transform = rewrap(rest);
|
|
4617
|
+
else delete node.transform;
|
|
4618
|
+
} else {
|
|
4619
|
+
out.transform = rewrap({ translate: value.translate });
|
|
4620
|
+
if (hasRest) node.transform = rewrap(rest);
|
|
4621
|
+
else delete node.transform;
|
|
4622
|
+
}
|
|
4623
|
+
}
|
|
4624
|
+
}
|
|
4625
|
+
return out;
|
|
4626
|
+
}
|
|
4627
|
+
function isSingleMatrixBody(s) {
|
|
4628
|
+
const re = /(translate|rotate|scale|matrix|skewX|skewY)\(([^)]*)\)/g;
|
|
4629
|
+
let count = 0;
|
|
4630
|
+
let isMatrix = false;
|
|
4631
|
+
let m;
|
|
4632
|
+
while (m = re.exec(s)) {
|
|
4633
|
+
count++;
|
|
4634
|
+
if (m[1] === "matrix") isMatrix = true;
|
|
4635
|
+
}
|
|
4636
|
+
return count === 1 && isMatrix;
|
|
4637
|
+
}
|
|
4638
|
+
function isPureTranslateBody(s) {
|
|
4639
|
+
const re = /(translate|rotate|scale|matrix|skewX|skewY)\(([^)]*)\)/g;
|
|
4640
|
+
const ops = [];
|
|
4641
|
+
let m;
|
|
4642
|
+
while (m = re.exec(s)) ops.push({ name: m[1], full: m[0] });
|
|
4643
|
+
if (ops.length !== 1) return false;
|
|
4644
|
+
if (ops[0].name === "translate") return true;
|
|
4645
|
+
if (ops[0].name !== "matrix") return false;
|
|
4646
|
+
const args = /matrix\(([^)]*)\)/.exec(ops[0].full);
|
|
4647
|
+
if (!args) return false;
|
|
4648
|
+
const nums = args[1].split(/[\s,]+/).filter(Boolean).map(Number);
|
|
4649
|
+
return nums.length >= 4 && nums[0] === 1 && nums[1] === 0 && nums[2] === 0 && nums[3] === 1;
|
|
4650
|
+
}
|
|
4651
|
+
function splitTransformString(s) {
|
|
4652
|
+
const ops = [];
|
|
4653
|
+
const re = /(translate|rotate|scale|matrix|skewX|skewY)\(([^)]*)\)/g;
|
|
4654
|
+
let m;
|
|
4655
|
+
while (m = re.exec(s)) ops.push({ name: m[1], full: m[0] });
|
|
4656
|
+
if (!ops.length) return { rest: s || void 0 };
|
|
4657
|
+
if (ops.every((o) => o.name === "translate")) {
|
|
4658
|
+
return { translate: ops.map((o) => o.full).join("") };
|
|
4659
|
+
}
|
|
4660
|
+
const leading = ops[0];
|
|
4661
|
+
const trailing = ops[ops.length - 1];
|
|
4662
|
+
if (trailing.name === "translate" && leading.name === "translate") {
|
|
4663
|
+
const trailingVec = parseTranslateArgs(trailing.full);
|
|
4664
|
+
const leadingVec = parseTranslateArgs(leading.full);
|
|
4665
|
+
const ox = -trailingVec[0];
|
|
4666
|
+
const oy = -trailingVec[1];
|
|
4667
|
+
const userTx = leadingVec[0] - ox;
|
|
4668
|
+
const userTy = leadingVec[1] - oy;
|
|
4669
|
+
if (userTx === 0 && userTy === 0) return { rest: s };
|
|
4670
|
+
const middleAndTrailing = "translate(" + ox + "," + oy + ")" + ops.slice(1).map((o) => o.full).join("");
|
|
4671
|
+
return { translate: "translate(" + userTx + "," + userTy + ")", rest: middleAndTrailing };
|
|
4672
|
+
}
|
|
4673
|
+
if (trailing.name === "translate") return { rest: s };
|
|
4674
|
+
const lifted = [];
|
|
4675
|
+
let i = 0;
|
|
4676
|
+
while (i < ops.length && ops[i].name === "translate") {
|
|
4677
|
+
lifted.push(ops[i].full);
|
|
4678
|
+
i++;
|
|
4679
|
+
}
|
|
4680
|
+
if (!lifted.length) return { rest: s };
|
|
4681
|
+
const rest = ops.slice(i).map((o) => o.full).join("");
|
|
4682
|
+
return {
|
|
4683
|
+
translate: lifted.join(""),
|
|
4684
|
+
rest: rest || void 0
|
|
4685
|
+
};
|
|
4686
|
+
}
|
|
4687
|
+
function parseTranslateArgs(translateOp) {
|
|
4688
|
+
const m = /translate\(([^)]*)\)/.exec(translateOp);
|
|
4689
|
+
if (!m) return [0, 0];
|
|
4690
|
+
const nums = m[1].split(/[\s,]+/).filter(Boolean).map(Number);
|
|
4691
|
+
return [nums[0] || 0, nums[1] || 0];
|
|
4692
|
+
}
|
|
4693
|
+
function splitTransformByEffect(fx) {
|
|
4694
|
+
if (!fx) return {};
|
|
4695
|
+
const originOnOuter = needsOriginOnOuter(fx.translate);
|
|
4696
|
+
const innerHasPivotedPart = fx.rotate !== void 0 || fx.scale !== void 0;
|
|
4697
|
+
const outer = {};
|
|
4698
|
+
const inner = {};
|
|
4699
|
+
if (fx.translate !== void 0) outer.translate = fx.translate;
|
|
4700
|
+
if (originOnOuter && fx.origin !== void 0) outer.origin = fx.origin;
|
|
4701
|
+
if (fx.rotate !== void 0) inner.rotate = fx.rotate;
|
|
4702
|
+
if (fx.scale !== void 0) inner.scale = fx.scale;
|
|
4703
|
+
if (fx.skew !== void 0) inner.skew = fx.skew;
|
|
4704
|
+
if (fx.origin !== void 0 && (!originOnOuter || innerHasPivotedPart)) inner.origin = fx.origin;
|
|
4705
|
+
return {
|
|
4706
|
+
outer: Object.keys(outer).length ? outer : void 0,
|
|
4707
|
+
inner: Object.keys(inner).length ? inner : void 0
|
|
4708
|
+
};
|
|
4709
|
+
}
|
|
4710
|
+
function needsOriginOnOuter(translateAnim) {
|
|
4711
|
+
if (!translateAnim || typeof translateAnim !== "object") return false;
|
|
4712
|
+
const obj = translateAnim;
|
|
4713
|
+
if (obj.autoOrient) return true;
|
|
4714
|
+
if (Array.isArray(obj.keyframes)) {
|
|
4715
|
+
return obj.keyframes.some((kf) => kf.tangentOut || kf.tangentIn);
|
|
4716
|
+
}
|
|
4717
|
+
return false;
|
|
4718
|
+
}
|
|
4719
|
+
|
|
4720
|
+
// src/effects/paint/gradientEffect.ts
|
|
4721
|
+
function applyFillGradientEffect(node, fx, ctx) {
|
|
4722
|
+
return applyGradient(node, fx, ctx, "fill");
|
|
4723
|
+
}
|
|
4724
|
+
function applyStrokeGradientEffect(node, fx, ctx) {
|
|
4725
|
+
return applyGradient(node, fx, ctx, "stroke");
|
|
4726
|
+
}
|
|
4727
|
+
function applyGradient(node, fx, ctx, attr) {
|
|
4728
|
+
if (!fx) return node;
|
|
4729
|
+
const id = genId(ctx, "grad");
|
|
4730
|
+
const def = synthesiseGradientDef(fx, id, ctx);
|
|
4731
|
+
ctx.defs.push(def);
|
|
4732
|
+
node[attr] = "url(#" + id + ")";
|
|
4733
|
+
return node;
|
|
4734
|
+
}
|
|
4735
|
+
function synthesiseGradientDef(fx, id, ctx) {
|
|
4736
|
+
const out = {
|
|
4737
|
+
type: fx.type === PxGradientType.radial ? "radialGradient" : "linearGradient",
|
|
4738
|
+
id
|
|
4739
|
+
};
|
|
4740
|
+
if (fx.type === PxGradientType.linear) {
|
|
4741
|
+
applyGeomVec(out, "x1", "y1", fx.start);
|
|
4742
|
+
applyGeomVec(out, "x2", "y2", fx.end);
|
|
4743
|
+
} else {
|
|
4744
|
+
applyGeomVec(out, "cx", "cy", fx.center);
|
|
4745
|
+
applyGeomNumber(out, "r", fx.radius);
|
|
4746
|
+
applyGeomVec(out, "fx", "fy", fx.focal);
|
|
4747
|
+
}
|
|
4748
|
+
if (fx.gradientUnits) out.gradientUnits = fx.gradientUnits;
|
|
4749
|
+
if (fx.spreadMethod) out.spreadMethod = fx.spreadMethod;
|
|
4750
|
+
if (fx.gradientTransform) out.gradientTransform = fx.gradientTransform;
|
|
4751
|
+
out.children = buildStopChildren(fx.stops, ctx);
|
|
4752
|
+
return out;
|
|
4753
|
+
}
|
|
4754
|
+
function applyGeomVec(out, xAttr, yAttr, raw) {
|
|
4755
|
+
var _a2, _b, _c;
|
|
4756
|
+
const read = readAnimatable(raw);
|
|
4757
|
+
if (read.kind === "absent" /* Absent */) return;
|
|
4758
|
+
if (read.kind === "static" /* Static */) {
|
|
4759
|
+
out[xAttr] = String(read.value[0]);
|
|
4760
|
+
out[yAttr] = String(read.value[1]);
|
|
4761
|
+
return;
|
|
4762
|
+
}
|
|
4763
|
+
const axisChannel = (idx) => {
|
|
4764
|
+
const block = {
|
|
4765
|
+
keyframes: read.keyframes.map((kf) => {
|
|
4766
|
+
const axisKf = { time: kf.time, value: Array.isArray(kf.value) ? kf.value[idx] : void 0 };
|
|
4767
|
+
if (kf.easing !== void 0) axisKf.easing = kf.easing;
|
|
4768
|
+
return axisKf;
|
|
4769
|
+
})
|
|
4770
|
+
};
|
|
4771
|
+
if (read.loop !== void 0) block.loop = read.loop;
|
|
4772
|
+
return block;
|
|
4773
|
+
};
|
|
4774
|
+
const animate = (_a2 = out.animate) != null ? _a2 : {};
|
|
4775
|
+
animate[xAttr] = axisChannel(0);
|
|
4776
|
+
animate[yAttr] = axisChannel(1);
|
|
4777
|
+
out.animate = animate;
|
|
4778
|
+
const baseline = (_c = read.base) != null ? _c : (_b = read.keyframes[0]) == null ? void 0 : _b.value;
|
|
4779
|
+
if (Array.isArray(baseline)) {
|
|
4780
|
+
out[xAttr] = String(baseline[0]);
|
|
4781
|
+
out[yAttr] = String(baseline[1]);
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
function applyGeomNumber(out, attrName, raw) {
|
|
4785
|
+
const read = readAnimatable(raw);
|
|
4786
|
+
if (read.kind === "absent" /* Absent */) return;
|
|
4787
|
+
writeAnimatableChannel(out, attrName, read, { asString: true });
|
|
4788
|
+
}
|
|
4789
|
+
function buildStopChildren(stops, ctx) {
|
|
4790
|
+
var _a2, _b;
|
|
4791
|
+
if (!stops) return [];
|
|
4792
|
+
const read = readAnimatable(stops);
|
|
4793
|
+
if (read.kind === "absent" /* Absent */) return [];
|
|
4794
|
+
if (read.kind === "static" /* Static */) return Array.isArray(read.value) ? read.value.map(staticStopNode) : [];
|
|
4795
|
+
const kfs = read.keyframes;
|
|
4796
|
+
if (!kfs.length) return [];
|
|
4797
|
+
const loopFromSource = read.loop;
|
|
4798
|
+
let stopCount = 0;
|
|
4799
|
+
for (const kf of kfs) {
|
|
4800
|
+
const v = keyframeValue(kf);
|
|
4801
|
+
if (Array.isArray(v) && v.length > stopCount) stopCount = v.length;
|
|
4802
|
+
}
|
|
4803
|
+
if (!stopCount) return [];
|
|
4804
|
+
const firstKfValue = keyframeValue(kfs[0]);
|
|
4805
|
+
const baselineStops = [];
|
|
4806
|
+
for (let i = 0; i < stopCount; i++) {
|
|
4807
|
+
const s = (_b = (_a2 = firstKfValue == null ? void 0 : firstKfValue[i]) != null ? _a2 : prevDefinedStop(kfs, 0, i)) != null ? _b : { offset: i / Math.max(1, stopCount - 1), color: "#000000" };
|
|
4808
|
+
baselineStops.push({ offset: s.offset, color: s.color });
|
|
4809
|
+
}
|
|
4810
|
+
return baselineStops.map((bs, i) => animatedStopNode(bs, kfs, i, ctx, loopFromSource));
|
|
4811
|
+
}
|
|
4812
|
+
function staticStopNode(s) {
|
|
4813
|
+
return {
|
|
4814
|
+
type: "stop",
|
|
4815
|
+
offset: formatOffset(s.offset),
|
|
4816
|
+
stopColor: s.color
|
|
4817
|
+
};
|
|
4818
|
+
}
|
|
4819
|
+
function animatedStopNode(baseline, kfs, stopIdx, _ctx, loop) {
|
|
4820
|
+
var _a2;
|
|
4821
|
+
const colorKfs = [];
|
|
4822
|
+
const offsetKfs = [];
|
|
4823
|
+
let offsetVaries = false;
|
|
4824
|
+
for (const kf of kfs) {
|
|
4825
|
+
const t = keyframeTime(kf);
|
|
4826
|
+
const arr = keyframeValue(kf);
|
|
4827
|
+
const sliced = (_a2 = arr == null ? void 0 : arr[stopIdx]) != null ? _a2 : prevDefinedStop(kfs, kfs.indexOf(kf), stopIdx);
|
|
4828
|
+
if (!sliced) continue;
|
|
4829
|
+
const easing = keyframeEasing(kf);
|
|
4830
|
+
const colorOut = { time: t, value: sliced.color };
|
|
4831
|
+
if (easing !== void 0) colorOut.easing = easing;
|
|
4832
|
+
colorKfs.push(colorOut);
|
|
4833
|
+
const offsetOut = { time: t, value: sliced.offset };
|
|
4834
|
+
if (easing !== void 0) offsetOut.easing = easing;
|
|
4835
|
+
offsetKfs.push(offsetOut);
|
|
4836
|
+
if (sliced.offset !== baseline.offset) offsetVaries = true;
|
|
4837
|
+
}
|
|
4838
|
+
const stop = {
|
|
4839
|
+
type: "stop",
|
|
4840
|
+
offset: formatOffset(baseline.offset),
|
|
4841
|
+
stopColor: baseline.color
|
|
4842
|
+
};
|
|
4843
|
+
const animate = {};
|
|
4844
|
+
if (colorKfs.length) {
|
|
4845
|
+
animate.stopColor = { keyframes: colorKfs };
|
|
4846
|
+
if (loop !== void 0) animate.stopColor.loop = loop;
|
|
4847
|
+
}
|
|
4848
|
+
if (offsetVaries && offsetKfs.length) {
|
|
4849
|
+
animate.offset = { keyframes: offsetKfs };
|
|
4850
|
+
if (loop !== void 0) animate.offset.loop = loop;
|
|
4851
|
+
}
|
|
4852
|
+
if (Object.keys(animate).length) stop.animate = animate;
|
|
4853
|
+
return stop;
|
|
4854
|
+
}
|
|
4855
|
+
function prevDefinedStop(kfs, fromIdx, stopIdx) {
|
|
4856
|
+
for (let i = fromIdx; i >= 0; i--) {
|
|
4857
|
+
const arr = keyframeValue(kfs[i]);
|
|
4858
|
+
if (arr == null ? void 0 : arr[stopIdx]) return arr[stopIdx];
|
|
4859
|
+
}
|
|
4860
|
+
for (let i = fromIdx + 1; i < kfs.length; i++) {
|
|
4861
|
+
const arr = keyframeValue(kfs[i]);
|
|
4862
|
+
if (arr == null ? void 0 : arr[stopIdx]) return arr[stopIdx];
|
|
4863
|
+
}
|
|
4864
|
+
return void 0;
|
|
4865
|
+
}
|
|
4866
|
+
function formatOffset(o) {
|
|
4867
|
+
const pct = Math.round(o * 1e3) / 10;
|
|
4868
|
+
return pct + "%";
|
|
4869
|
+
}
|
|
4870
|
+
|
|
4871
|
+
// src/effects/clipping/clipPathEffect.ts
|
|
4872
|
+
function applyClipPathEffect(node, fx, ctx) {
|
|
4873
|
+
if (!(fx == null ? void 0 : fx.pathData)) return node;
|
|
4874
|
+
const clipId = genId(ctx, "clip");
|
|
4875
|
+
const pathChild = { type: "path" };
|
|
4876
|
+
const read = readAnimatable(fx.pathData);
|
|
4877
|
+
if (read.kind !== "absent" /* Absent */) {
|
|
4878
|
+
if (read.kind === "static" /* Static */) {
|
|
4879
|
+
pathChild.d = pathString(read.value);
|
|
4880
|
+
} else {
|
|
4881
|
+
writeAnimatableChannel(pathChild, "d", read);
|
|
4882
|
+
if (pathChild.d !== void 0) pathChild.d = pathString(pathChild.d);
|
|
4883
|
+
}
|
|
4884
|
+
}
|
|
4885
|
+
ctx.defs.push({ type: "clipPath", id: clipId, children: [pathChild] });
|
|
4886
|
+
node.clipPath = "url(#" + clipId + ")";
|
|
4887
|
+
return node;
|
|
4888
|
+
}
|
|
4889
|
+
function pathString(v) {
|
|
4890
|
+
if (typeof v === "string") return v;
|
|
4891
|
+
if (v && typeof v === "object" && typeof v.pathData === "string") return v.pathData;
|
|
4892
|
+
return void 0;
|
|
4893
|
+
}
|
|
4894
|
+
|
|
4895
|
+
// src/effects/clipping/maskedByEffect.ts
|
|
4896
|
+
function applyMaskedByEffect(node, fx, transformBy, ctx) {
|
|
4897
|
+
if (!fx) return node;
|
|
4898
|
+
const sourceId = stripHash(fx.source);
|
|
4899
|
+
if (!sourceId) {
|
|
4900
|
+
ctx.errors.push("maskedBy.source missing \u2014 cannot build mask");
|
|
4901
|
+
return node;
|
|
4902
|
+
}
|
|
4903
|
+
const maskId = genId(ctx, "mask");
|
|
4904
|
+
let content = { type: "use", href: "#" + sourceId };
|
|
4905
|
+
if (transformBy) {
|
|
4906
|
+
content = wrapInverseTransform(content, transformBy, ctx);
|
|
4907
|
+
} else if (hasAnimateTransform(node)) {
|
|
4908
|
+
content = wrapInverseAnimatedBodyTransform(content, node, ctx);
|
|
4909
|
+
} else {
|
|
4910
|
+
const bodyStatic = readTransformationFromBody(node);
|
|
4911
|
+
if (bodyStatic) content = wrapInverseTransform(content, bodyStatic, ctx);
|
|
4912
|
+
}
|
|
4913
|
+
const includeTargetOwn = transformBy === void 0 && !nodeHasBodyTransform(node);
|
|
4914
|
+
content = wrapAncestorChainCompensation(content, node, sourceId, ctx, includeTargetOwn);
|
|
4915
|
+
const mask = { type: "mask", id: maskId, children: [content] };
|
|
4916
|
+
if (fx.maskType) mask.maskType = fx.maskType;
|
|
4917
|
+
if (fx.maskUnits) mask.maskUnits = fx.maskUnits;
|
|
4918
|
+
if (fx.maskContentUnits) mask.maskContentUnits = fx.maskContentUnits;
|
|
4919
|
+
if (fx.x !== void 0) mask.x = String(fx.x);
|
|
4920
|
+
if (fx.y !== void 0) mask.y = String(fx.y);
|
|
4921
|
+
if (fx.width !== void 0) mask.width = String(fx.width);
|
|
4922
|
+
if (fx.height !== void 0) mask.height = String(fx.height);
|
|
4923
|
+
ctx.defs.push(mask);
|
|
4924
|
+
node.mask = "url(#" + maskId + ")";
|
|
4925
|
+
return node;
|
|
4926
|
+
}
|
|
4927
|
+
function wrapInverseTransform(inner, fx, ctx) {
|
|
4928
|
+
if (!fx) return inner;
|
|
4929
|
+
const origin = readStaticOrigin(fx.origin, ctx);
|
|
4930
|
+
let n = inner;
|
|
4931
|
+
n = wrapInversePart(n, "translate" /* Translate */, fx.translate, void 0, ctx);
|
|
4932
|
+
n = wrapInversePart(n, "rotate" /* Rotate */, fx.rotate, origin, ctx);
|
|
4933
|
+
n = wrapInversePart(n, "scale" /* Scale */, fx.scale, origin, ctx);
|
|
4934
|
+
return n;
|
|
4935
|
+
}
|
|
4936
|
+
function wrapInversePart(inner, part, raw, origin, ctx) {
|
|
4937
|
+
if (raw === void 0) return inner;
|
|
4938
|
+
const normalizedRaw = part === "scale" /* Scale */ && Array.isArray(raw) ? [raw[0] / 100, raw[1] / 100] : raw;
|
|
4939
|
+
const v = readAnimatable(normalizedRaw);
|
|
4940
|
+
if (v.kind === "static" /* Static */) {
|
|
4941
|
+
return { type: "g", transform: { value: partsRecord(part, invertPartValue(part, v.value), origin) }, children: [inner] };
|
|
4942
|
+
}
|
|
4943
|
+
if (v.kind === "animated" /* Animated */) {
|
|
4944
|
+
const animTr = { keyframes: v.keyframes.map((kf) => {
|
|
4945
|
+
const out = keyframeWith(kf, partsRecord(part, invertPartValue(part, kf.value), origin));
|
|
4946
|
+
return part === "translate" /* Translate */ ? __spreadValues(__spreadValues({}, out), negatedSpatialTangents(kf)) : out;
|
|
4947
|
+
}) };
|
|
4948
|
+
if (v.loop !== void 0) animTr.loop = v.loop;
|
|
4949
|
+
return {
|
|
4950
|
+
type: "g",
|
|
4951
|
+
animate: { transform: animTr },
|
|
4952
|
+
children: [inner]
|
|
4953
|
+
};
|
|
4954
|
+
}
|
|
4955
|
+
return inner;
|
|
4956
|
+
}
|
|
4957
|
+
function invertPartValue(part, value) {
|
|
4958
|
+
if (part === "translate" /* Translate */) return [-value[0], -value[1]];
|
|
4959
|
+
if (part === "rotate" /* Rotate */) return -value;
|
|
4960
|
+
return [1 / value[0], 1 / value[1]];
|
|
4961
|
+
}
|
|
4962
|
+
function negatedSpatialTangents(kf) {
|
|
4963
|
+
var _a2, _b;
|
|
4964
|
+
const out = {};
|
|
4965
|
+
const to = (_a2 = kf.tangentOut) != null ? _a2 : kf.to;
|
|
4966
|
+
const ti = (_b = kf.tangentIn) != null ? _b : kf.ti;
|
|
4967
|
+
if (Array.isArray(to)) out.tangentOut = [-to[0], -to[1]];
|
|
4968
|
+
if (Array.isArray(ti)) out.tangentIn = [-ti[0], -ti[1]];
|
|
4969
|
+
return out;
|
|
4970
|
+
}
|
|
4971
|
+
function wrapInverseAnimatedBodyTransform(inner, node, _ctx) {
|
|
4972
|
+
var _a2;
|
|
4973
|
+
const animate = node.animate && typeof node.animate === "object" && !Array.isArray(node.animate) ? node.animate : void 0;
|
|
4974
|
+
const animTr = animate == null ? void 0 : animate.transform;
|
|
4975
|
+
const kfs = animTr && typeof animTr === "object" && Array.isArray(animTr.keyframes) ? animTr.keyframes : void 0;
|
|
4976
|
+
if (!kfs || !kfs.length) return inner;
|
|
4977
|
+
const translateKfs = [];
|
|
4978
|
+
const rotateKfs = [];
|
|
4979
|
+
const scaleKfs = [];
|
|
4980
|
+
for (const kf of kfs) {
|
|
4981
|
+
const v = ((_a2 = kf.value) != null ? _a2 : kf.v) || {};
|
|
4982
|
+
const baseKf = keyframeWith(kf, void 0);
|
|
4983
|
+
if (Array.isArray(v.translate)) {
|
|
4984
|
+
translateKfs.push(__spreadProps(__spreadValues(__spreadValues({}, baseKf), negatedSpatialTangents(kf)), { value: { translate: [-v.translate[0], -v.translate[1]] } }));
|
|
4985
|
+
}
|
|
4986
|
+
if (typeof v.rotate === "number") {
|
|
4987
|
+
const rec = { rotate: -v.rotate };
|
|
4988
|
+
if (Array.isArray(v.origin)) rec.origin = [v.origin[0], v.origin[1]];
|
|
4989
|
+
rotateKfs.push(__spreadProps(__spreadValues({}, baseKf), { value: rec }));
|
|
4990
|
+
}
|
|
4991
|
+
if (Array.isArray(v.scale)) {
|
|
4992
|
+
const rec = { scale: [1 / v.scale[0], 1 / v.scale[1]] };
|
|
4993
|
+
if (Array.isArray(v.origin)) rec.origin = [v.origin[0], v.origin[1]];
|
|
4994
|
+
scaleKfs.push(__spreadProps(__spreadValues({}, baseKf), { value: rec }));
|
|
4995
|
+
}
|
|
4996
|
+
}
|
|
4997
|
+
const srcLoop = animTr == null ? void 0 : animTr.loop;
|
|
4998
|
+
const withLoop = (kfs2) => {
|
|
4999
|
+
const block = { keyframes: kfs2 };
|
|
5000
|
+
if (srcLoop !== void 0) block.loop = srcLoop;
|
|
5001
|
+
return block;
|
|
5002
|
+
};
|
|
5003
|
+
let n = inner;
|
|
5004
|
+
if (translateKfs.length) n = { type: "g", animate: { transform: withLoop(translateKfs) }, children: [n] };
|
|
5005
|
+
if (rotateKfs.length) n = { type: "g", animate: { transform: withLoop(rotateKfs) }, children: [n] };
|
|
5006
|
+
if (scaleKfs.length) n = { type: "g", animate: { transform: withLoop(scaleKfs) }, children: [n] };
|
|
5007
|
+
return n;
|
|
5008
|
+
}
|
|
5009
|
+
function nodeHasBodyTransform(node) {
|
|
5010
|
+
if (typeof node.transform === "string") return true;
|
|
5011
|
+
if (node.transform && typeof node.transform === "object") return true;
|
|
5012
|
+
return hasAnimateTransform(node);
|
|
5013
|
+
}
|
|
5014
|
+
function hasAnimateTransform(node) {
|
|
5015
|
+
const animate = node.animate && typeof node.animate === "object" && !Array.isArray(node.animate) ? node.animate : void 0;
|
|
5016
|
+
return !!(animate && animate.transform);
|
|
5017
|
+
}
|
|
5018
|
+
function readTransformationFromBody(node) {
|
|
5019
|
+
if (typeof node.transform === "string") {
|
|
5020
|
+
const parts = parseTransformStringToParts(node.transform);
|
|
5021
|
+
if (!parts) return void 0;
|
|
5022
|
+
const out = {};
|
|
5023
|
+
if (parts.translate) out.translate = parts.translate;
|
|
5024
|
+
if (parts.rotate !== void 0) out.rotate = parts.rotate;
|
|
5025
|
+
if (parts.scale) out.scale = { value: parts.scale };
|
|
5026
|
+
if (parts.origin) out.origin = parts.origin;
|
|
5027
|
+
return Object.keys(out).length ? out : void 0;
|
|
5028
|
+
}
|
|
5029
|
+
if (node.transform && typeof node.transform === "object" && !node.transform.keyframes) {
|
|
5030
|
+
const wrapped = node.transform.value;
|
|
5031
|
+
const value = wrapped && typeof wrapped === "object" ? wrapped : node.transform;
|
|
5032
|
+
if (value && typeof value === "object") {
|
|
5033
|
+
const out = {};
|
|
5034
|
+
if (Array.isArray(value.translate)) out.translate = value.translate;
|
|
5035
|
+
if (typeof value.rotate === "number") out.rotate = value.rotate;
|
|
5036
|
+
if (typeof value.skew === "number") out.skew = value.skew;
|
|
5037
|
+
if (Array.isArray(value.scale)) out.scale = { value: value.scale };
|
|
5038
|
+
if (Array.isArray(value.origin)) out.origin = value.origin;
|
|
5039
|
+
return Object.keys(out).length ? out : void 0;
|
|
5040
|
+
}
|
|
5041
|
+
}
|
|
5042
|
+
return void 0;
|
|
5043
|
+
}
|
|
5044
|
+
function parseTransformStringToParts(s) {
|
|
5045
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
5046
|
+
const re = /([a-zA-Z]+)\s*\(([^)]*)\)/g;
|
|
5047
|
+
let m;
|
|
5048
|
+
const ops = [];
|
|
5049
|
+
while ((m = re.exec(s)) !== null) {
|
|
5050
|
+
const args = m[2].split(/[\s,]+/).filter((a) => a.length > 0).map(Number);
|
|
5051
|
+
ops.push({ name: m[1], args });
|
|
5052
|
+
}
|
|
5053
|
+
if (!ops.length) return void 0;
|
|
5054
|
+
const last = ops[ops.length - 1];
|
|
5055
|
+
if (last.name === "translate") {
|
|
5056
|
+
for (let j = ops.length - 2; j >= 0; j--) {
|
|
5057
|
+
const cand = ops[j];
|
|
5058
|
+
if (cand.name !== "translate") continue;
|
|
5059
|
+
const ox = (_a2 = cand.args[0]) != null ? _a2 : 0;
|
|
5060
|
+
const oy = (_b = cand.args[1]) != null ? _b : 0;
|
|
5061
|
+
const lx = (_c = last.args[0]) != null ? _c : 0;
|
|
5062
|
+
const ly = (_d = last.args[1]) != null ? _d : 0;
|
|
5063
|
+
if (lx !== -ox || ly !== -oy) continue;
|
|
5064
|
+
const out2 = {};
|
|
5065
|
+
out2.origin = [ox, oy];
|
|
5066
|
+
for (let k = 0; k < j; k++) {
|
|
5067
|
+
if (ops[k].name === "translate") {
|
|
5068
|
+
const tx = (_e = ops[k].args[0]) != null ? _e : 0;
|
|
5069
|
+
const ty = (_f = ops[k].args[1]) != null ? _f : 0;
|
|
5070
|
+
out2.translate = out2.translate ? [out2.translate[0] + tx, out2.translate[1] + ty] : [tx, ty];
|
|
5071
|
+
}
|
|
5072
|
+
}
|
|
5073
|
+
for (let k = j + 1; k < ops.length - 1; k++) {
|
|
5074
|
+
const op = ops[k];
|
|
5075
|
+
if (op.name === "rotate") out2.rotate = ((_g = out2.rotate) != null ? _g : 0) + ((_h = op.args[0]) != null ? _h : 0);
|
|
5076
|
+
else if (op.name === "scale") {
|
|
5077
|
+
const sx = (_i = op.args[0]) != null ? _i : 1;
|
|
5078
|
+
const sy = op.args.length > 1 ? op.args[1] : sx;
|
|
5079
|
+
out2.scale = out2.scale ? [out2.scale[0] * sx, out2.scale[1] * sy] : [sx, sy];
|
|
5080
|
+
}
|
|
5081
|
+
}
|
|
5082
|
+
return out2;
|
|
5083
|
+
}
|
|
5084
|
+
}
|
|
5085
|
+
let translate;
|
|
5086
|
+
let rotate;
|
|
5087
|
+
let scale;
|
|
5088
|
+
for (const op of ops) {
|
|
5089
|
+
if (op.name === "translate") {
|
|
5090
|
+
const dx = (_j = op.args[0]) != null ? _j : 0;
|
|
5091
|
+
const dy = (_k = op.args[1]) != null ? _k : 0;
|
|
5092
|
+
translate = translate ? [translate[0] + dx, translate[1] + dy] : [dx, dy];
|
|
5093
|
+
} else if (op.name === "rotate") {
|
|
5094
|
+
rotate = (rotate != null ? rotate : 0) + ((_l = op.args[0]) != null ? _l : 0);
|
|
5095
|
+
} else if (op.name === "scale") {
|
|
5096
|
+
const sx = (_m = op.args[0]) != null ? _m : 1;
|
|
5097
|
+
const sy = op.args.length > 1 ? op.args[1] : sx;
|
|
5098
|
+
scale = scale ? [scale[0] * sx, scale[1] * sy] : [sx, sy];
|
|
5099
|
+
}
|
|
5100
|
+
}
|
|
5101
|
+
const out = {};
|
|
5102
|
+
if (translate) out.translate = translate;
|
|
5103
|
+
if (rotate !== void 0) out.rotate = rotate;
|
|
5104
|
+
if (scale) out.scale = scale;
|
|
5105
|
+
return Object.keys(out).length ? out : void 0;
|
|
5106
|
+
}
|
|
5107
|
+
function wrapAncestorChainCompensation(inner, maskedNode, sourceId, ctx, includeTargetOwn) {
|
|
5108
|
+
const sourceNode = ctx.idMap.get(sourceId);
|
|
5109
|
+
const targetAncestors = ctx.maskAncestorChains.get(maskedNode) || [];
|
|
5110
|
+
const targetOwn = includeTargetOwn ? extractTranslateOnly(maskedNode, ctx) : void 0;
|
|
5111
|
+
const targetChain = targetOwn ? [...targetAncestors, targetOwn] : targetAncestors;
|
|
5112
|
+
const sourceChain = sourceNode && ctx.maskAncestorChains.get(sourceNode) || [];
|
|
5113
|
+
if (!targetChain.length && !sourceChain.length) return inner;
|
|
5114
|
+
const times = /* @__PURE__ */ new Set();
|
|
5115
|
+
for (const a of targetChain) if (a.translateKeyframes) for (const kf of a.translateKeyframes) times.add(kf.time);
|
|
5116
|
+
for (const a of sourceChain) if (a.translateKeyframes) for (const kf of a.translateKeyframes) times.add(kf.time);
|
|
5117
|
+
const animated = times.size > 0;
|
|
5118
|
+
if (!animated) {
|
|
5119
|
+
const tgt = sumStaticTranslate(targetChain);
|
|
5120
|
+
const src = sumStaticTranslate(sourceChain);
|
|
5121
|
+
const dx = src[0] - tgt[0];
|
|
5122
|
+
const dy = src[1] - tgt[1];
|
|
5123
|
+
if (dx === 0 && dy === 0) return inner;
|
|
5124
|
+
return { type: "g", transform: "translate(" + dx + "," + dy + ")", children: [inner] };
|
|
5125
|
+
}
|
|
5126
|
+
const sortedTimes = Array.from(times).sort((a, b) => a - b);
|
|
5127
|
+
const keyframes = sortedTimes.map((t) => {
|
|
5128
|
+
const tgt = sumTranslateAt(targetChain, t);
|
|
5129
|
+
const src = sumTranslateAt(sourceChain, t);
|
|
5130
|
+
return { time: t, value: { translate: [src[0] - tgt[0], src[1] - tgt[1]] } };
|
|
5131
|
+
});
|
|
5132
|
+
return { type: "g", animate: { transform: { keyframes } }, children: [inner] };
|
|
5133
|
+
}
|
|
5134
|
+
function sumStaticTranslate(chain) {
|
|
5135
|
+
let x = 0, y = 0;
|
|
5136
|
+
for (const a of chain) {
|
|
5137
|
+
if (a.translate) {
|
|
5138
|
+
x += a.translate[0];
|
|
5139
|
+
y += a.translate[1];
|
|
5140
|
+
}
|
|
5141
|
+
}
|
|
5142
|
+
return [x, y];
|
|
5143
|
+
}
|
|
5144
|
+
function sumTranslateAt(chain, t) {
|
|
5145
|
+
let x = 0, y = 0;
|
|
5146
|
+
for (const a of chain) {
|
|
5147
|
+
if (a.translateKeyframes && a.translateKeyframes.length) {
|
|
5148
|
+
const v = interpKfs(a.translateKeyframes, t);
|
|
5149
|
+
x += v[0];
|
|
5150
|
+
y += v[1];
|
|
5151
|
+
} else if (a.translate) {
|
|
5152
|
+
x += a.translate[0];
|
|
5153
|
+
y += a.translate[1];
|
|
5154
|
+
}
|
|
5155
|
+
}
|
|
5156
|
+
return [x, y];
|
|
5157
|
+
}
|
|
5158
|
+
function interpKfs(kfs, t) {
|
|
5159
|
+
if (t <= kfs[0].time) return kfs[0].value;
|
|
5160
|
+
if (t >= kfs[kfs.length - 1].time) return kfs[kfs.length - 1].value;
|
|
5161
|
+
for (let i = 1; i < kfs.length; i++) {
|
|
5162
|
+
if (t <= kfs[i].time) {
|
|
5163
|
+
const prev = kfs[i - 1];
|
|
5164
|
+
const cur = kfs[i];
|
|
5165
|
+
const a = (t - prev.time) / (cur.time - prev.time);
|
|
5166
|
+
return [prev.value[0] + (cur.value[0] - prev.value[0]) * a, prev.value[1] + (cur.value[1] - prev.value[1]) * a];
|
|
5167
|
+
}
|
|
5168
|
+
}
|
|
5169
|
+
return kfs[kfs.length - 1].value;
|
|
5170
|
+
}
|
|
5171
|
+
function collectMaskAncestorChains(root, ctx) {
|
|
5172
|
+
const interestingNodes = /* @__PURE__ */ new Set();
|
|
5173
|
+
const collectInterestingNodes = (n) => {
|
|
5174
|
+
var _a2, _b;
|
|
5175
|
+
const maskSourceId = stripHash((_b = (_a2 = n.effects) == null ? void 0 : _a2.maskedBy) == null ? void 0 : _b.source);
|
|
5176
|
+
if (typeof maskSourceId === "string") {
|
|
5177
|
+
interestingNodes.add(n);
|
|
5178
|
+
const sourceNode = ctx.idMap.get(maskSourceId);
|
|
5179
|
+
if (sourceNode) interestingNodes.add(sourceNode);
|
|
5180
|
+
}
|
|
5181
|
+
if (Array.isArray(n.children)) for (const ch of n.children) collectInterestingNodes(ch);
|
|
5182
|
+
};
|
|
5183
|
+
collectInterestingNodes(root);
|
|
5184
|
+
if (interestingNodes.size === 0) return;
|
|
5185
|
+
const walk = (node, chain) => {
|
|
5186
|
+
if (interestingNodes.has(node)) ctx.maskAncestorChains.set(node, chain);
|
|
5187
|
+
if (Array.isArray(node.children)) {
|
|
5188
|
+
const own = extractTranslateOnly(node, ctx);
|
|
5189
|
+
const next = own ? [...chain, own] : chain;
|
|
5190
|
+
for (const ch of node.children) walk(ch, next);
|
|
5191
|
+
}
|
|
5192
|
+
};
|
|
5193
|
+
walk(root, []);
|
|
5194
|
+
}
|
|
5195
|
+
function extractTranslateOnly(node, ctx) {
|
|
5196
|
+
var _a2, _b, _c;
|
|
5197
|
+
const tr = node.transform;
|
|
5198
|
+
const animateBlock = node.animate && typeof node.animate === "object" && !Array.isArray(node.animate) ? node.animate.transform : void 0;
|
|
5199
|
+
if (tr === void 0 && !animateBlock) return void 0;
|
|
5200
|
+
const out = {};
|
|
5201
|
+
if (typeof tr === "string") {
|
|
5202
|
+
const parts = parseTranslateOnlyFromString(tr, ctx);
|
|
5203
|
+
if (parts) out.translate = parts;
|
|
5204
|
+
} else if (tr && typeof tr === "object" && !tr.keyframes) {
|
|
5205
|
+
const wrapped = tr.value;
|
|
5206
|
+
const value = wrapped && typeof wrapped === "object" ? wrapped : tr;
|
|
5207
|
+
if (value && typeof value === "object" && Array.isArray(value.translate)) {
|
|
5208
|
+
out.translate = [value.translate[0] || 0, value.translate[1] || 0];
|
|
5209
|
+
}
|
|
5210
|
+
if (value && (value.rotate !== void 0 || value.scale !== void 0 || value.skew !== void 0)) {
|
|
5211
|
+
ctx.warnings.push("maskedBy ancestor: non-translate transform parts ignored (rotate/scale not yet supported)");
|
|
5212
|
+
}
|
|
5213
|
+
}
|
|
5214
|
+
if (animateBlock && Array.isArray(animateBlock.keyframes)) {
|
|
5215
|
+
const kfs = animateBlock.keyframes;
|
|
5216
|
+
const translateKfs = [];
|
|
5217
|
+
for (const kf of kfs) {
|
|
5218
|
+
const v = (_a2 = kf.value) != null ? _a2 : kf.v;
|
|
5219
|
+
const t = (_c = (_b = kf.time) != null ? _b : kf.t) != null ? _c : 0;
|
|
5220
|
+
if (v && typeof v === "object" && Array.isArray(v.translate)) {
|
|
5221
|
+
translateKfs.push({ time: t, value: [v.translate[0] || 0, v.translate[1] || 0] });
|
|
5222
|
+
if (v.rotate !== void 0 || v.scale !== void 0 || v.skew !== void 0) {
|
|
5223
|
+
ctx.warnings.push("maskedBy ancestor: animated non-translate parts ignored");
|
|
5224
|
+
}
|
|
5225
|
+
}
|
|
5226
|
+
}
|
|
5227
|
+
if (translateKfs.length) out.translateKeyframes = translateKfs;
|
|
5228
|
+
}
|
|
5229
|
+
return out.translate || out.translateKeyframes ? out : void 0;
|
|
5230
|
+
}
|
|
5231
|
+
function parseTranslateOnlyFromString(s, ctx) {
|
|
5232
|
+
const re = /([a-zA-Z]+)\s*\(([^)]*)\)/g;
|
|
5233
|
+
let m;
|
|
5234
|
+
let x = 0, y = 0;
|
|
5235
|
+
let seen = false;
|
|
5236
|
+
let droppedNonTranslate = false;
|
|
5237
|
+
while ((m = re.exec(s)) !== null) {
|
|
5238
|
+
const name = m[1];
|
|
5239
|
+
const args = m[2].split(/[\s,]+/).filter((a) => a.length > 0).map(Number);
|
|
5240
|
+
if (name === "translate") {
|
|
5241
|
+
x += args[0] || 0;
|
|
5242
|
+
y += args[1] || 0;
|
|
5243
|
+
seen = true;
|
|
5244
|
+
} else {
|
|
5245
|
+
droppedNonTranslate = true;
|
|
5246
|
+
}
|
|
5247
|
+
}
|
|
5248
|
+
if (droppedNonTranslate) ctx.warnings.push("maskedBy ancestor: non-translate transform in string ignored: " + s);
|
|
5249
|
+
return seen ? [x, y] : void 0;
|
|
5250
|
+
}
|
|
5251
|
+
|
|
5252
|
+
// src/effects/reference/refEffect.ts
|
|
5253
|
+
function applyRefHref(node, clone2, ctx) {
|
|
5254
|
+
if (!clone2) return;
|
|
5255
|
+
const sourceId = stripHash(clone2.source);
|
|
5256
|
+
if (!sourceId) {
|
|
5257
|
+
if (clone2.without === PxCloneWithout.translate) ctx.errors.push("clone: content ref missing `source`");
|
|
5258
|
+
return;
|
|
5259
|
+
}
|
|
5260
|
+
const targetId = clone2.without === PxCloneWithout.translate ? ctx.contentRefInnerIds.get(sourceId) || sourceId : sourceId;
|
|
5261
|
+
node.href = "#" + targetId;
|
|
5262
|
+
}
|
|
5263
|
+
function applyRefAndTransformationEffect(node, clone2, transformBy, ctx) {
|
|
5264
|
+
applyRefHref(node, clone2, ctx);
|
|
5265
|
+
return applyTransformByEffect(node, transformBy, ctx);
|
|
5266
|
+
}
|
|
5267
|
+
|
|
5268
|
+
// src/effects/transform/repeaterEffect.ts
|
|
5269
|
+
function applyRepeaterEffect(node, fx, ctx) {
|
|
5270
|
+
var _a2, _b;
|
|
5271
|
+
if (!fx) return node;
|
|
5272
|
+
const copies = (_a2 = fx.copies) != null ? _a2 : 1;
|
|
5273
|
+
if (copies < 1) {
|
|
5274
|
+
ctx.errors.push("repeater.copies invalid: " + fx.copies);
|
|
5275
|
+
return node;
|
|
5276
|
+
}
|
|
5277
|
+
const sharedTransform = node.transform;
|
|
5278
|
+
const sharedAnimTransform = (_b = node.animate) == null ? void 0 : _b.transform;
|
|
5279
|
+
const base = clone(node);
|
|
5280
|
+
delete base.transform;
|
|
5281
|
+
if (base.animate) {
|
|
5282
|
+
delete base.animate.transform;
|
|
5283
|
+
if (Object.keys(base.animate).length === 0) delete base.animate;
|
|
5284
|
+
}
|
|
5285
|
+
delete base.id;
|
|
5286
|
+
const children = [base];
|
|
5287
|
+
for (let i = 1; i < copies; i++) {
|
|
5288
|
+
const baseClone = clone(base);
|
|
5289
|
+
const synthFx = synthesisePerCopyFx(fx, i);
|
|
5290
|
+
const wrapped = synthFx ? applyTransformByEffect(baseClone, synthFx, ctx) : baseClone;
|
|
5291
|
+
children.push(wrapped);
|
|
5292
|
+
}
|
|
5293
|
+
const wrapper = { type: "g", children };
|
|
5294
|
+
if (node.id) wrapper.id = node.id;
|
|
5295
|
+
if (sharedTransform !== void 0) wrapper.transform = sharedTransform;
|
|
5296
|
+
if (sharedAnimTransform !== void 0) wrapper.animate = { transform: sharedAnimTransform };
|
|
5297
|
+
return wrapper;
|
|
5298
|
+
}
|
|
5299
|
+
function synthesisePerCopyFx(fx, i) {
|
|
5300
|
+
const out = {};
|
|
5301
|
+
if (fx.translate !== void 0) {
|
|
5302
|
+
out.translate = mapAnimatable(fx.translate, (v) => [v[0] * i, v[1] * i]);
|
|
5303
|
+
}
|
|
5304
|
+
if (fx.rotate !== void 0) {
|
|
5305
|
+
out.rotate = mapAnimatable(fx.rotate, (v) => v * i);
|
|
5306
|
+
}
|
|
5307
|
+
if (fx.skew !== void 0) {
|
|
5308
|
+
out.skew = mapAnimatable(fx.skew, (v) => v * i);
|
|
5309
|
+
}
|
|
5310
|
+
if (fx.scale !== void 0) {
|
|
5311
|
+
out.scale = synthesiseScale(fx.scale, i);
|
|
5312
|
+
}
|
|
5313
|
+
if (fx.origin !== void 0) {
|
|
5314
|
+
out.origin = fx.origin;
|
|
5315
|
+
}
|
|
5316
|
+
return Object.keys(out).length ? out : void 0;
|
|
5317
|
+
}
|
|
5318
|
+
function mapAnimatable(raw, fn, wrapStatic = false) {
|
|
5319
|
+
const read = readAnimatable(raw);
|
|
5320
|
+
if (read.kind === "absent" /* Absent */) return raw;
|
|
5321
|
+
if (read.kind === "static" /* Static */) {
|
|
5322
|
+
const mapped = fn(read.value);
|
|
5323
|
+
const wasRawStatic = typeof raw === "number" || Array.isArray(raw);
|
|
5324
|
+
return wasRawStatic && !wrapStatic ? mapped : { value: mapped };
|
|
5325
|
+
}
|
|
5326
|
+
const out = {
|
|
5327
|
+
keyframes: read.keyframes.map((kf) => kf && kf.value !== void 0 ? __spreadProps(__spreadValues({}, kf), { value: fn(kf.value) }) : kf)
|
|
5328
|
+
};
|
|
5329
|
+
if (read.loop !== void 0) out.loop = read.loop;
|
|
5330
|
+
if (read.autoOrient !== void 0) out.autoOrient = read.autoOrient;
|
|
5331
|
+
if (read.base !== void 0) out.value = fn(read.base);
|
|
5332
|
+
return out;
|
|
5333
|
+
}
|
|
5334
|
+
function synthesiseScale(raw, i) {
|
|
5335
|
+
const scalePower = (v) => [Math.pow(v[0], i), Math.pow(v[1], i)];
|
|
5336
|
+
return mapAnimatable(raw, scalePower, true);
|
|
5337
|
+
}
|
|
5338
|
+
|
|
5339
|
+
// src/effects/reference/retimeEffect.ts
|
|
5340
|
+
var RETIME_MATERIALIZATION_MODE_INLINE_G = false;
|
|
5341
|
+
function asRetime(r) {
|
|
5342
|
+
var _a2, _b;
|
|
5343
|
+
return { start: (_a2 = r.start) != null ? _a2 : 0, stretch: (_b = r.stretch) != null ? _b : 1 };
|
|
5344
|
+
}
|
|
5345
|
+
var CROP_EDGE_MS = 1;
|
|
5346
|
+
function applyTimeCrop(useNode, crop, ctx) {
|
|
5347
|
+
const [start, end] = crop;
|
|
5348
|
+
if (!Number.isFinite(start) || !Number.isFinite(end)) {
|
|
5349
|
+
ctx.warnings.push("retime: timeCrop is not a pair of finite numbers \u2014 ignored");
|
|
5350
|
+
return;
|
|
5351
|
+
}
|
|
5352
|
+
const keyframes = end <= start ? [{ time: 0, value: 0 }] : [
|
|
5353
|
+
...start > 0 ? [{ time: Math.max(0, start - CROP_EDGE_MS), value: 0 }] : [],
|
|
5354
|
+
{ time: Math.max(0, start), value: 1 },
|
|
5355
|
+
{ time: end, value: 1 },
|
|
5356
|
+
{ time: end + CROP_EDGE_MS, value: 0 }
|
|
5357
|
+
];
|
|
5358
|
+
const inner = __spreadValues({}, useNode);
|
|
5359
|
+
for (const k of Object.keys(useNode)) delete useNode[k];
|
|
5360
|
+
useNode.type = "g";
|
|
5361
|
+
useNode.children = [inner];
|
|
5362
|
+
useNode.animate = { opacity: { keyframes } };
|
|
5363
|
+
}
|
|
5364
|
+
function concatRetime(child, parent) {
|
|
5365
|
+
return {
|
|
5366
|
+
start: parent.start + parent.stretch * child.start,
|
|
5367
|
+
stretch: parent.stretch * child.stretch
|
|
5368
|
+
};
|
|
5369
|
+
}
|
|
5370
|
+
function readCloneRetime(n) {
|
|
5371
|
+
var _a2, _b;
|
|
5372
|
+
return (_b = (_a2 = n.effects) == null ? void 0 : _a2.clone) == null ? void 0 : _b.retime;
|
|
5373
|
+
}
|
|
5374
|
+
function clearCloneRetime(n) {
|
|
5375
|
+
var _a2;
|
|
5376
|
+
const clone2 = (_a2 = n.effects) == null ? void 0 : _a2.clone;
|
|
5377
|
+
if (!clone2) return;
|
|
5378
|
+
delete clone2.retime;
|
|
5379
|
+
if (Object.keys(clone2).length === 0) delete n.effects.clone;
|
|
5380
|
+
if (n.effects && Object.keys(n.effects).length === 0) delete n.effects;
|
|
5381
|
+
}
|
|
5382
|
+
function applyAllRetimeEffects(root, ctx) {
|
|
5383
|
+
ctx.idMap.clear();
|
|
5384
|
+
indexById(root, ctx.idMap);
|
|
5385
|
+
const sites = [];
|
|
5386
|
+
const collect = (n) => {
|
|
5387
|
+
var _a2;
|
|
5388
|
+
if (readCloneRetime(n)) sites.push(n);
|
|
5389
|
+
(_a2 = n.children) == null ? void 0 : _a2.forEach(collect);
|
|
5390
|
+
};
|
|
5391
|
+
collect(root);
|
|
5392
|
+
const reachCount = /* @__PURE__ */ new Map();
|
|
5393
|
+
for (const site of sites) {
|
|
5394
|
+
let count = 0;
|
|
5395
|
+
const visited = /* @__PURE__ */ new Set();
|
|
5396
|
+
const walk = (n) => {
|
|
5397
|
+
var _a2;
|
|
5398
|
+
if (!n) return;
|
|
5399
|
+
if (n !== site && readCloneRetime(n)) count++;
|
|
5400
|
+
if (n.type === "use" && n.href) {
|
|
5401
|
+
const id = stripHash(n.href);
|
|
5402
|
+
if (id && !visited.has(id)) {
|
|
5403
|
+
visited.add(id);
|
|
5404
|
+
walk(ctx.idMap.get(id));
|
|
5405
|
+
}
|
|
5406
|
+
}
|
|
5407
|
+
(_a2 = n.children) == null ? void 0 : _a2.forEach(walk);
|
|
5408
|
+
};
|
|
5409
|
+
const rootId = stripHash(site.href);
|
|
5410
|
+
if (rootId) {
|
|
5411
|
+
visited.add(rootId);
|
|
5412
|
+
walk(ctx.idMap.get(rootId));
|
|
5413
|
+
}
|
|
5414
|
+
reachCount.set(site, count);
|
|
5415
|
+
}
|
|
5416
|
+
sites.sort((a, b) => {
|
|
5417
|
+
var _a2, _b;
|
|
5418
|
+
return ((_a2 = reachCount.get(b)) != null ? _a2 : 0) - ((_b = reachCount.get(a)) != null ? _b : 0);
|
|
5419
|
+
});
|
|
5420
|
+
for (const useNode of sites) {
|
|
5421
|
+
const retime = readCloneRetime(useNode);
|
|
5422
|
+
if (!retime) continue;
|
|
5423
|
+
const crop = retime.timeCrop;
|
|
5424
|
+
clearCloneRetime(useNode);
|
|
5425
|
+
materializeRetime(useNode, asRetime(retime), ctx);
|
|
5426
|
+
if (crop) applyTimeCrop(useNode, crop, ctx);
|
|
5427
|
+
}
|
|
5428
|
+
}
|
|
5429
|
+
function materializeRetime(useNode, retime, ctx) {
|
|
5430
|
+
const targetId = stripHash(useNode.href);
|
|
5431
|
+
if (!targetId) {
|
|
5432
|
+
ctx.errors.push("retime: <use> has no href to follow");
|
|
5433
|
+
return;
|
|
5434
|
+
}
|
|
5435
|
+
const chainRootId = buildChainClone(targetId, retime, ctx, /* @__PURE__ */ new Set());
|
|
5436
|
+
if (!chainRootId) return;
|
|
5437
|
+
if (RETIME_MATERIALIZATION_MODE_INLINE_G) {
|
|
5438
|
+
const cloneNode = ctx.idMap.get(chainRootId);
|
|
5439
|
+
useNode.type = "g";
|
|
5440
|
+
delete useNode.href;
|
|
5441
|
+
useNode.children = [cloneNode];
|
|
5442
|
+
applyUseOffsetToG(useNode);
|
|
5443
|
+
ctx.defs = ctx.defs.filter((d) => d !== cloneNode);
|
|
5444
|
+
} else {
|
|
5445
|
+
useNode.href = "#" + chainRootId;
|
|
5446
|
+
}
|
|
5447
|
+
}
|
|
5448
|
+
function buildChainClone(targetId, accum, ctx, chain) {
|
|
5449
|
+
if (chain.has(targetId)) {
|
|
5450
|
+
ctx.errors.push('retime: loop via "' + targetId + '"');
|
|
5451
|
+
return void 0;
|
|
5452
|
+
}
|
|
5453
|
+
const target = ctx.idMap.get(targetId);
|
|
5454
|
+
if (!target) {
|
|
5455
|
+
ctx.warnings.push('retime: target "' + targetId + '" not found');
|
|
5456
|
+
return void 0;
|
|
5457
|
+
}
|
|
5458
|
+
const cloneNode = clone(target);
|
|
5459
|
+
regenerateIdsInClone(cloneNode, ctx);
|
|
5460
|
+
if (target.type === "use") {
|
|
5461
|
+
remapKeyframeTimesOnly(cloneNode, accum.start, accum.stretch);
|
|
5462
|
+
} else {
|
|
5463
|
+
remapKeyframeTimes(cloneNode, accum.start, accum.stretch);
|
|
5464
|
+
}
|
|
5465
|
+
clearCloneRetime(cloneNode);
|
|
5466
|
+
if (target.type === "use" && target.href) {
|
|
5467
|
+
const subId = stripHash(target.href);
|
|
5468
|
+
if (subId) {
|
|
5469
|
+
const innerRetime = readCloneRetime(target);
|
|
5470
|
+
const subAccum = innerRetime ? concatRetime(asRetime(innerRetime), accum) : accum;
|
|
5471
|
+
const subChain = new Set(chain);
|
|
5472
|
+
subChain.add(targetId);
|
|
5473
|
+
const subId2 = buildChainClone(subId, subAccum, ctx, subChain);
|
|
5474
|
+
if (subId2) cloneNode.href = "#" + subId2;
|
|
5475
|
+
}
|
|
5476
|
+
} else {
|
|
5477
|
+
materializeNestedRetimeUses(cloneNode, accum, ctx, chain, targetId);
|
|
5478
|
+
}
|
|
5479
|
+
ctx.defs.push(cloneNode);
|
|
5480
|
+
if (typeof cloneNode.id === "string") ctx.idMap.set(cloneNode.id, cloneNode);
|
|
5481
|
+
return typeof cloneNode.id === "string" ? cloneNode.id : void 0;
|
|
5482
|
+
}
|
|
5483
|
+
function materializeNestedRetimeUses(node, accum, ctx, chain, parentTargetId) {
|
|
5484
|
+
const visit = (n) => {
|
|
5485
|
+
var _a2;
|
|
5486
|
+
const retime = readCloneRetime(n);
|
|
5487
|
+
if (n.type === "use" && retime && n.href) {
|
|
5488
|
+
const subId = stripHash(n.href);
|
|
5489
|
+
if (subId) {
|
|
5490
|
+
const subAccum = concatRetime(asRetime(retime), accum);
|
|
5491
|
+
const subChain = new Set(chain);
|
|
5492
|
+
subChain.add(parentTargetId);
|
|
5493
|
+
const subId2 = buildChainClone(subId, subAccum, ctx, subChain);
|
|
5494
|
+
if (subId2) n.href = "#" + subId2;
|
|
5495
|
+
}
|
|
5496
|
+
clearCloneRetime(n);
|
|
5497
|
+
}
|
|
5498
|
+
(_a2 = n.children) == null ? void 0 : _a2.forEach(visit);
|
|
5499
|
+
};
|
|
5500
|
+
visit(node);
|
|
5501
|
+
}
|
|
5502
|
+
function remapKeyframeTimes(node, start, stretch) {
|
|
5503
|
+
var _a2;
|
|
5504
|
+
remapKeyframeTimesOnly(node, start, stretch);
|
|
5505
|
+
(_a2 = node.children) == null ? void 0 : _a2.forEach((c) => remapKeyframeTimes(c, start, stretch));
|
|
5506
|
+
}
|
|
5507
|
+
function remapKeyframeTimesOnly(node, start, stretch) {
|
|
5508
|
+
const remap2 = (kfs) => {
|
|
5509
|
+
for (const kf of kfs) if (typeof kf.time === "number") kf.time = start + kf.time * stretch;
|
|
5510
|
+
};
|
|
5511
|
+
if (node.transform && typeof node.transform === "object" && Array.isArray(node.transform.keyframes)) {
|
|
5512
|
+
remap2(node.transform.keyframes);
|
|
5513
|
+
}
|
|
5514
|
+
if (node.animate && typeof node.animate === "object") {
|
|
5515
|
+
for (const prop of Object.keys(node.animate)) {
|
|
5516
|
+
const anim = node.animate[prop];
|
|
5517
|
+
if (anim && Array.isArray(anim.keyframes)) remap2(anim.keyframes);
|
|
5518
|
+
}
|
|
5519
|
+
}
|
|
5520
|
+
}
|
|
5521
|
+
|
|
5522
|
+
// src/effects/stroke/strokeTrimEffect.ts
|
|
5523
|
+
function applyStrokeTrimEffect(node, strokeTrim, ctx) {
|
|
5524
|
+
if (!strokeTrim) return node;
|
|
5525
|
+
const combined = strokeTrim.subPaths === PxStrokeTrimSubPaths.combined;
|
|
5526
|
+
const leafEntries = [];
|
|
5527
|
+
const measure = (n) => {
|
|
5528
|
+
if (Array.isArray(n.children) && n.children.length > 0) {
|
|
5529
|
+
for (const ch of n.children) measure(ch);
|
|
5530
|
+
return;
|
|
5531
|
+
}
|
|
5532
|
+
const d = typeof n.d === "string" ? n.d : shapeToPathD(n);
|
|
5533
|
+
if (d === void 0) return;
|
|
5534
|
+
const subpaths = parseSvgPathToBezier(d);
|
|
5535
|
+
if (!subpaths.length) return;
|
|
5536
|
+
const entry = { leaf: n, subpaths: [] };
|
|
5537
|
+
for (const sp of subpaths) {
|
|
5538
|
+
const lengthPx = pxBezierPathLength(sp);
|
|
5539
|
+
entry.subpaths.push({ subpath: sp, lengthPx, startOffsetPx: 0 });
|
|
5540
|
+
}
|
|
5541
|
+
leafEntries.push(entry);
|
|
5542
|
+
};
|
|
5543
|
+
measure(node);
|
|
5544
|
+
if (!leafEntries.length) return node;
|
|
5545
|
+
let acc = 0;
|
|
5546
|
+
const iterOrder = combined ? [...leafEntries].reverse() : leafEntries;
|
|
5547
|
+
for (const entry of iterOrder) {
|
|
5548
|
+
for (const sp of entry.subpaths) {
|
|
5549
|
+
if (!combined) acc = 0;
|
|
5550
|
+
sp.startOffsetPx = acc;
|
|
5551
|
+
acc += sp.lengthPx;
|
|
5552
|
+
}
|
|
5553
|
+
}
|
|
5554
|
+
const chainLengthPx = acc;
|
|
5555
|
+
if (combined && chainLengthPx < 1e-3) return node;
|
|
5556
|
+
const offsetReadRaw = readAnimatable(strokeTrim.offset);
|
|
5557
|
+
const offsetRead = offsetReadRaw.kind === "absent" /* Absent */ ? { kind: "static" /* Static */, value: 0 } : offsetReadRaw;
|
|
5558
|
+
const rangeReadRaw = readRangeWithCrossings(strokeTrim.range);
|
|
5559
|
+
const rangeRead = rangeReadRaw.kind === "absent" /* Absent */ ? { kind: "static" /* Static */, value: [0, 1] } : rangeReadRaw;
|
|
5560
|
+
const offsetValues = readScalarValues(offsetRead);
|
|
5561
|
+
const minOffset = offsetValues.length ? Math.min(...offsetValues) : 0;
|
|
5562
|
+
const maxOffset = offsetValues.length ? Math.max(...offsetValues) : 0;
|
|
5563
|
+
const minMaxOffset = [minOffset, maxOffset];
|
|
5564
|
+
if (leafEntries.length === 1 && leafEntries[0].leaf === node && leafEntries[0].subpaths.length === 1) {
|
|
5565
|
+
const entry = leafEntries[0];
|
|
5566
|
+
const sp = entry.subpaths[0];
|
|
5567
|
+
const pathLengthPx = combined ? chainLengthPx : sp.lengthPx;
|
|
5568
|
+
if (pathLengthPx < 1e-3) return node;
|
|
5569
|
+
const startOffsetPct = combined ? sp.startOffsetPx / pathLengthPx : 0;
|
|
5570
|
+
return collapseLeafWithTrim(entry.leaf, pathLengthPx, startOffsetPct, minMaxOffset, offsetRead, rangeRead);
|
|
5571
|
+
}
|
|
5572
|
+
const replacements = /* @__PURE__ */ new Map();
|
|
5573
|
+
for (const entry of leafEntries) {
|
|
5574
|
+
const newChildren = [];
|
|
5575
|
+
for (const sp of entry.subpaths) {
|
|
5576
|
+
const pathLengthPx = combined ? chainLengthPx : sp.lengthPx;
|
|
5577
|
+
if (pathLengthPx < 1e-3) continue;
|
|
5578
|
+
const startOffsetPct = combined ? sp.startOffsetPx / pathLengthPx : 0;
|
|
5579
|
+
newChildren.push(...buildSubpathNodes(entry.leaf, sp.subpath, pathLengthPx, startOffsetPct, minMaxOffset, offsetRead, rangeRead, ctx));
|
|
5580
|
+
}
|
|
5581
|
+
replacements.set(entry.leaf, wrapLeafAsGroup(entry.leaf, newChildren));
|
|
5582
|
+
}
|
|
5583
|
+
const swap = (n) => {
|
|
5584
|
+
const r = replacements.get(n);
|
|
5585
|
+
if (r) return r;
|
|
5586
|
+
if (Array.isArray(n.children) && n.children.length > 0) {
|
|
5587
|
+
return __spreadProps(__spreadValues({}, n), { children: n.children.map(swap) });
|
|
5588
|
+
}
|
|
5589
|
+
return n;
|
|
5590
|
+
};
|
|
5591
|
+
return swap(node);
|
|
5592
|
+
}
|
|
5593
|
+
function wrapLeafAsGroup(leaf, children) {
|
|
5594
|
+
const wrapper = __spreadProps(__spreadValues({}, leaf), { type: "g", children });
|
|
5595
|
+
delete wrapper.d;
|
|
5596
|
+
delete wrapper.strokeDasharray;
|
|
5597
|
+
delete wrapper.strokeDashoffset;
|
|
5598
|
+
delete wrapper.effects;
|
|
5599
|
+
return wrapper;
|
|
5600
|
+
}
|
|
5601
|
+
function buildSubpathNodes(leaf, subpath, pathLengthPx, startOffsetPct, minMaxOffset, offsetRead, rangeRead, ctx) {
|
|
5602
|
+
const offsetToDashOffset = makeOffsetToDashOffset(startOffsetPct, pathLengthPx, minMaxOffset);
|
|
5603
|
+
const rangeToDasharray = makeRangeToDasharray(pathLengthPx, minMaxOffset);
|
|
5604
|
+
const dashOffsetAttr = computeAnimAttr(offsetRead, offsetToDashOffset);
|
|
5605
|
+
const dashArrayAttr = computeAnimAttr(rangeRead, rangeToDasharray);
|
|
5606
|
+
const strokeOpacityAttr = computeOpacityFromRange(rangeRead);
|
|
5607
|
+
const dStr = bezierToSvgPath(subpath);
|
|
5608
|
+
const base = makeBareSubpath(dStr);
|
|
5609
|
+
applyAttr(base, "strokeDasharray", dashArrayAttr);
|
|
5610
|
+
applyAttr(base, "strokeDashoffset", dashOffsetAttr);
|
|
5611
|
+
applyAttr(base, "strokeOpacity", strokeOpacityAttr);
|
|
5612
|
+
return [base];
|
|
5613
|
+
}
|
|
5614
|
+
function collapseLeafWithTrim(leaf, pathLengthPx, startOffsetPct, minMaxOffset, offsetRead, rangeRead) {
|
|
5615
|
+
const offsetToDashOffset = makeOffsetToDashOffset(startOffsetPct, pathLengthPx, minMaxOffset);
|
|
5616
|
+
const rangeToDasharray = makeRangeToDasharray(pathLengthPx, minMaxOffset);
|
|
5617
|
+
const node = __spreadValues({}, leaf);
|
|
5618
|
+
delete node.effects;
|
|
5619
|
+
applyAttr(node, "strokeDasharray", computeAnimAttr(rangeRead, rangeToDasharray));
|
|
5620
|
+
applyAttr(node, "strokeDashoffset", computeAnimAttr(offsetRead, offsetToDashOffset));
|
|
5621
|
+
applyAttr(node, "strokeOpacity", computeOpacityFromRange(rangeRead));
|
|
5622
|
+
return node;
|
|
5623
|
+
}
|
|
5624
|
+
function makeBareSubpath(dStr) {
|
|
5625
|
+
return { type: "path", d: dStr };
|
|
5626
|
+
}
|
|
5627
|
+
var SMALL_PADDING_PX = 1;
|
|
5628
|
+
function makeOffsetToDashOffset(startOffsetPct, pathLengthPx, minMaxOffset) {
|
|
5629
|
+
const [minIdx] = getOffsetIndexRange(minMaxOffset);
|
|
5630
|
+
return (offsetVal) => pathLengthPx * (-offsetVal - minIdx + startOffsetPct) + SMALL_PADDING_PX;
|
|
5631
|
+
}
|
|
5632
|
+
function makeRangeToDasharray(pathLengthPx, minMaxOffset) {
|
|
5633
|
+
const [minIdx, maxIdx] = getOffsetIndexRange(minMaxOffset);
|
|
5634
|
+
const repeats = maxIdx - minIdx + 1;
|
|
5635
|
+
return (rangeVal) => {
|
|
5636
|
+
const a = clamp(rangeVal[0], 0, 1);
|
|
5637
|
+
const b = clamp(rangeVal[1], 0, 1);
|
|
5638
|
+
const minR = Math.min(a, b);
|
|
5639
|
+
const maxR = Math.max(a, b);
|
|
5640
|
+
const out = [0];
|
|
5641
|
+
let gap = SMALL_PADDING_PX;
|
|
5642
|
+
for (let i = 0; i < repeats; i++) {
|
|
5643
|
+
out.push(gap + minR * pathLengthPx);
|
|
5644
|
+
out.push((maxR - minR) * pathLengthPx);
|
|
5645
|
+
gap = (1 - maxR) * pathLengthPx;
|
|
5646
|
+
}
|
|
5647
|
+
out.push(gap + SMALL_PADDING_PX);
|
|
5648
|
+
return out;
|
|
5649
|
+
};
|
|
5650
|
+
}
|
|
5651
|
+
function getOffsetIndexRange(minMaxOffset) {
|
|
5652
|
+
return [
|
|
5653
|
+
Math.floor(Math.min(-minMaxOffset[0], -minMaxOffset[1])),
|
|
5654
|
+
Math.ceil(Math.max(-minMaxOffset[0], -minMaxOffset[1]))
|
|
5655
|
+
];
|
|
5656
|
+
}
|
|
5657
|
+
function readScalarValues(r) {
|
|
5658
|
+
if (r.kind === "absent" /* Absent */) return [];
|
|
5659
|
+
if (r.kind === "static" /* Static */) return [r.value];
|
|
5660
|
+
const out = [];
|
|
5661
|
+
for (const kf of r.keyframes) {
|
|
5662
|
+
const v = keyframeValue(kf);
|
|
5663
|
+
if (typeof v === "number") out.push(v);
|
|
5664
|
+
}
|
|
5665
|
+
return out;
|
|
5666
|
+
}
|
|
5667
|
+
function computeAnimAttr(read, map) {
|
|
5668
|
+
if (read.kind === "absent" /* Absent */) return void 0;
|
|
5669
|
+
if (read.kind === "static" /* Static */) return { kind: "static" /* Static */, value: map(read.value) };
|
|
5670
|
+
return {
|
|
5671
|
+
kind: "animated" /* Animated */,
|
|
5672
|
+
keyframes: read.keyframes.map((kf) => ({
|
|
5673
|
+
time: keyframeTime(kf),
|
|
5674
|
+
value: map(keyframeValue(kf)),
|
|
5675
|
+
easing: keyframeEasing(kf)
|
|
5676
|
+
})),
|
|
5677
|
+
loop: read.loop
|
|
5678
|
+
};
|
|
5679
|
+
}
|
|
5680
|
+
function applyAttr(node, attrName, attr) {
|
|
5681
|
+
if (!attr) return;
|
|
5682
|
+
writeAnimatableChannel(node, attrName, attr);
|
|
5683
|
+
}
|
|
5684
|
+
var OPACITY_STEP_MS = 10;
|
|
5685
|
+
function computeOpacityFromRange(rangeRead) {
|
|
5686
|
+
const hide = (v) => v[0] === v[1];
|
|
5687
|
+
if (rangeRead.kind === "absent" /* Absent */) return void 0;
|
|
5688
|
+
if (rangeRead.kind === "static" /* Static */) return hide(rangeRead.value) ? { kind: "static" /* Static */, value: 0 } : void 0;
|
|
5689
|
+
const kfs = rangeRead.keyframes;
|
|
5690
|
+
let anyHide = false;
|
|
5691
|
+
let allHide = true;
|
|
5692
|
+
for (const kf of kfs) {
|
|
5693
|
+
if (hide(keyframeValue(kf))) anyHide = true;
|
|
5694
|
+
else allHide = false;
|
|
5695
|
+
}
|
|
5696
|
+
if (!anyHide) return void 0;
|
|
5697
|
+
if (allHide) return { kind: "static" /* Static */, value: 0 };
|
|
5698
|
+
const out = [];
|
|
5699
|
+
for (let i = 0; i < kfs.length; i++) {
|
|
5700
|
+
const kf = kfs[i];
|
|
5701
|
+
const prevKf = i > 0 ? kfs[i - 1] : void 0;
|
|
5702
|
+
const nextKf = i < kfs.length - 1 ? kfs[i + 1] : void 0;
|
|
5703
|
+
const t = keyframeTime(kf);
|
|
5704
|
+
const thisHide = hide(keyframeValue(kf));
|
|
5705
|
+
const prevHide = prevKf ? thisHide && hide(keyframeValue(prevKf)) : thisHide;
|
|
5706
|
+
const nextHide = nextKf ? thisHide && hide(keyframeValue(nextKf)) : thisHide;
|
|
5707
|
+
if (prevHide && !nextHide) {
|
|
5708
|
+
out.push({ time: t, value: 0 });
|
|
5709
|
+
out.push({ time: t + OPACITY_STEP_MS, value: 1 });
|
|
5710
|
+
} else if (!prevHide && nextHide) {
|
|
5711
|
+
out.push({ time: t - OPACITY_STEP_MS, value: 1 });
|
|
5712
|
+
out.push({ time: t, value: 0 });
|
|
5713
|
+
}
|
|
5714
|
+
}
|
|
5715
|
+
if (out.length <= 1) return void 0;
|
|
5716
|
+
return { kind: "animated" /* Animated */, keyframes: out };
|
|
5717
|
+
}
|
|
5718
|
+
function readRangeWithCrossings(raw) {
|
|
5719
|
+
const r = readAnimatable(raw);
|
|
5720
|
+
if (r.kind !== "animated" /* Animated */) return r;
|
|
5721
|
+
const kfs = r.keyframes.map((kf) => ({
|
|
5722
|
+
time: keyframeTime(kf),
|
|
5723
|
+
value: keyframeValue(kf),
|
|
5724
|
+
easing: keyframeEasing(kf)
|
|
5725
|
+
}));
|
|
5726
|
+
const hasReverse = kfs.some((kf) => kf.value[0] > kf.value[1]);
|
|
5727
|
+
if (!hasReverse) {
|
|
5728
|
+
return {
|
|
5729
|
+
kind: "animated" /* Animated */,
|
|
5730
|
+
keyframes: kfs.map((kf) => ({ time: kf.time, value: kf.value, easing: kf.easing }))
|
|
5731
|
+
};
|
|
5732
|
+
}
|
|
5733
|
+
const crossingTimes = [];
|
|
5734
|
+
for (let i = 1; i < kfs.length; i++) {
|
|
5735
|
+
const prev = kfs[i - 1];
|
|
5736
|
+
const cur = kfs[i];
|
|
5737
|
+
const dPrev = prev.value[1] - prev.value[0];
|
|
5738
|
+
const dCur = cur.value[1] - cur.value[0];
|
|
5739
|
+
if (dPrev * dCur < 0) {
|
|
5740
|
+
const t = bisectionForRangeCrossing(prev, cur);
|
|
5741
|
+
if (t !== null && t > prev.time && t < cur.time) {
|
|
5742
|
+
crossingTimes.push(Math.round(t));
|
|
5743
|
+
}
|
|
5744
|
+
}
|
|
5745
|
+
}
|
|
5746
|
+
const uniqueTs = Array.from(new Set(crossingTimes)).sort((a, b) => a - b);
|
|
5747
|
+
const out = [];
|
|
5748
|
+
let j = 0;
|
|
5749
|
+
for (const kf of kfs) {
|
|
5750
|
+
while (j < uniqueTs.length && uniqueTs[j] < kf.time) {
|
|
5751
|
+
const t = uniqueTs[j++];
|
|
5752
|
+
const v2 = interpolateRangeAt(kfs, t);
|
|
5753
|
+
const m = (v2[0] + v2[1]) / 2;
|
|
5754
|
+
out.push({ time: t, value: [m, m] });
|
|
5755
|
+
}
|
|
5756
|
+
const v = kf.value[0] > kf.value[1] ? [kf.value[1], kf.value[0]] : kf.value;
|
|
5757
|
+
out.push({ time: kf.time, value: v, easing: kf.easing });
|
|
5758
|
+
}
|
|
5759
|
+
while (j < uniqueTs.length) {
|
|
5760
|
+
const t = uniqueTs[j++];
|
|
5761
|
+
const v = interpolateRangeAt(kfs, t);
|
|
5762
|
+
const m = (v[0] + v[1]) / 2;
|
|
5763
|
+
out.push({ time: t, value: [m, m] });
|
|
5764
|
+
}
|
|
5765
|
+
return { kind: "animated" /* Animated */, keyframes: out };
|
|
5766
|
+
}
|
|
5767
|
+
function bisectionForRangeCrossing(prev, cur) {
|
|
5768
|
+
const f = (t) => {
|
|
5769
|
+
const a = (t - prev.time) / (cur.time - prev.time);
|
|
5770
|
+
const v0 = prev.value[0] + (cur.value[0] - prev.value[0]) * a;
|
|
5771
|
+
const v1 = prev.value[1] + (cur.value[1] - prev.value[1]) * a;
|
|
5772
|
+
return v1 - v0;
|
|
5773
|
+
};
|
|
5774
|
+
let lo = prev.time, hi = cur.time;
|
|
5775
|
+
let fLo = f(lo);
|
|
5776
|
+
if (fLo === 0) return lo;
|
|
5777
|
+
const fHi = f(hi);
|
|
5778
|
+
if (fHi === 0) return hi;
|
|
5779
|
+
if (fLo * fHi > 0) return null;
|
|
5780
|
+
for (let i = 0; i < 100; i++) {
|
|
5781
|
+
const mid = (lo + hi) / 2;
|
|
5782
|
+
const fMid = f(mid);
|
|
5783
|
+
if (fMid === 0 || Math.abs(hi - lo) < 1e-4) return mid;
|
|
5784
|
+
if (fLo * fMid < 0) {
|
|
5785
|
+
hi = mid;
|
|
5786
|
+
} else {
|
|
5787
|
+
lo = mid;
|
|
5788
|
+
fLo = fMid;
|
|
5789
|
+
}
|
|
5790
|
+
}
|
|
5791
|
+
return (lo + hi) / 2;
|
|
5792
|
+
}
|
|
5793
|
+
function interpolateRangeAt(kfs, t) {
|
|
5794
|
+
if (t <= kfs[0].time) return kfs[0].value;
|
|
5795
|
+
if (t >= kfs[kfs.length - 1].time) return kfs[kfs.length - 1].value;
|
|
5796
|
+
for (let i = 1; i < kfs.length; i++) {
|
|
5797
|
+
if (t <= kfs[i].time) {
|
|
5798
|
+
const prev = kfs[i - 1];
|
|
5799
|
+
const cur = kfs[i];
|
|
5800
|
+
const a = (t - prev.time) / (cur.time - prev.time);
|
|
5801
|
+
return [
|
|
5802
|
+
prev.value[0] + (cur.value[0] - prev.value[0]) * a,
|
|
5803
|
+
prev.value[1] + (cur.value[1] - prev.value[1]) * a
|
|
5804
|
+
];
|
|
5805
|
+
}
|
|
5806
|
+
}
|
|
5807
|
+
return kfs[kfs.length - 1].value;
|
|
5808
|
+
}
|
|
5809
|
+
function pxBezierPathLength(path) {
|
|
5810
|
+
const v = path.v;
|
|
5811
|
+
if (!v || v.length < 2) return 0;
|
|
5812
|
+
let total = 0;
|
|
5813
|
+
for (let i = 0; i < v.length - 1; i++) {
|
|
5814
|
+
total += segmentLength(path, i, i + 1);
|
|
5815
|
+
}
|
|
5816
|
+
if (path.c && v.length > 1) {
|
|
5817
|
+
total += segmentLength(path, v.length - 1, 0);
|
|
5818
|
+
}
|
|
5819
|
+
return total;
|
|
5820
|
+
}
|
|
5821
|
+
function segmentLength(path, from, to) {
|
|
5822
|
+
var _a2, _b, _c, _d;
|
|
5823
|
+
const v = path.v;
|
|
5824
|
+
const p0 = v[from];
|
|
5825
|
+
const p3 = v[to];
|
|
5826
|
+
const p1 = (_b = (_a2 = path.o) == null ? void 0 : _a2[from]) != null ? _b : p0;
|
|
5827
|
+
const p2 = (_d = (_c = path.i) == null ? void 0 : _c[to]) != null ? _d : p3;
|
|
5828
|
+
const lut = bezier2D_arcLengthLUT(p0, p1, p2, p3);
|
|
5829
|
+
return lut.ds[lut.ds.length - 1];
|
|
5830
|
+
}
|
|
5831
|
+
var ARC_KAPPA = 0.5522847498307936;
|
|
5832
|
+
function shapeToPathD(node) {
|
|
5833
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
5834
|
+
if (node.type === "rect") {
|
|
5835
|
+
const x = Number((_a2 = node.x) != null ? _a2 : 0), y = Number((_b = node.y) != null ? _b : 0);
|
|
5836
|
+
const w = Number((_c = node.width) != null ? _c : 0), h = Number((_d = node.height) != null ? _d : 0);
|
|
5837
|
+
return "M" + (x + w) + "," + y + "L" + (x + w) + "," + (y + h) + "L" + x + "," + (y + h) + "L" + x + "," + y + "L" + (x + w) + "," + y + "z";
|
|
5838
|
+
}
|
|
5839
|
+
if (node.type === "ellipse" || node.type === "circle") {
|
|
5840
|
+
const cx = Number((_e = node.cx) != null ? _e : 0), cy = Number((_f = node.cy) != null ? _f : 0);
|
|
5841
|
+
const rx = node.type === "circle" ? Number((_g = node.r) != null ? _g : 0) : Number((_h = node.rx) != null ? _h : 0);
|
|
5842
|
+
const ry = node.type === "circle" ? Number((_i = node.r) != null ? _i : 0) : Number((_j = node.ry) != null ? _j : 0);
|
|
5843
|
+
if (!(rx > 0) || !(ry > 0)) return void 0;
|
|
5844
|
+
const kx = rx * ARC_KAPPA, ky = ry * ARC_KAPPA;
|
|
5845
|
+
const c = (x1, y1, x2, y2, x, y) => "C" + x1 + "," + y1 + " " + x2 + "," + y2 + " " + x + "," + y;
|
|
5846
|
+
return "M" + (cx + rx) + "," + cy + c(cx + rx, cy + ky, cx + kx, cy + ry, cx, cy + ry) + c(cx - kx, cy + ry, cx - rx, cy + ky, cx - rx, cy) + c(cx - rx, cy - ky, cx - kx, cy - ry, cx, cy - ry) + c(cx + kx, cy - ry, cx + rx, cy - ky, cx + rx, cy) + "z";
|
|
5847
|
+
}
|
|
5848
|
+
return void 0;
|
|
5849
|
+
}
|
|
5850
|
+
|
|
5851
|
+
// src/effects/PlayerEffectsUtil.ts
|
|
5852
|
+
function materializeNodeEffects(root) {
|
|
5853
|
+
var _a2, _b;
|
|
5854
|
+
const ctx = {
|
|
5855
|
+
defs: [],
|
|
5856
|
+
warnings: [],
|
|
5857
|
+
errors: [],
|
|
5858
|
+
idMap: /* @__PURE__ */ new Map(),
|
|
5859
|
+
nextId: 0,
|
|
5860
|
+
contentRefInnerIds: /* @__PURE__ */ new Map(),
|
|
5861
|
+
maskAncestorChains: /* @__PURE__ */ new Map(),
|
|
5862
|
+
// Resolved engine: `frames` ONLY when explicitly set; auto/waapi/unset →
|
|
5863
|
+
// waapi (we're not 100% sure it's frames, and CSS/WAAPI need the inline form).
|
|
5864
|
+
engine: resolveTimelineEngine((_a2 = getAnimatorConfig(root)) == null ? void 0 : _a2.engine),
|
|
5865
|
+
glyphs: (_b = getDefinitions(root)) == null ? void 0 : _b.fonts
|
|
5866
|
+
};
|
|
5867
|
+
const working = clone(root);
|
|
5868
|
+
indexById(working, ctx.idMap);
|
|
5869
|
+
identifyContentRefTargets(working, ctx, () => genId(ctx, "inner"));
|
|
5870
|
+
collectMaskAncestorChains(working, ctx);
|
|
5871
|
+
const afterPass1 = applyPlayerEffects_exceptRetime(working, ctx);
|
|
5872
|
+
const out = applyPlayerEffects_retime(afterPass1, ctx);
|
|
5873
|
+
spliceDefs(out, ctx.defs);
|
|
5874
|
+
return { root: out, defs: ctx.defs, warnings: ctx.warnings, errors: ctx.errors };
|
|
5875
|
+
}
|
|
5876
|
+
function applyPlayerEffects_exceptRetime(node, ctx) {
|
|
5877
|
+
if (node.children) node.children = node.children.map((child) => applyPlayerEffects_exceptRetime(child, ctx));
|
|
5878
|
+
const fx = node.effects;
|
|
5879
|
+
const originalId = typeof node.id === "string" ? node.id : void 0;
|
|
5880
|
+
const innerIdForContentRef = originalId ? ctx.contentRefInnerIds.get(originalId) : void 0;
|
|
5881
|
+
if (!fx && !innerIdForContentRef) return node;
|
|
5882
|
+
const { transformBy, repeater, maskedBy, clipPath, strokeTrim, clone: cloneFx, fillGradient, strokeGradient, textPath, text } = fx != null ? fx : {};
|
|
5883
|
+
if (fx) delete node.effects;
|
|
5884
|
+
let n = node;
|
|
5885
|
+
let consumedByGlyphs = false;
|
|
5886
|
+
if (text == null ? void 0 : text.useGlyphs) {
|
|
5887
|
+
if (textPath) {
|
|
5888
|
+
const pathD = typeof textPath.pathData === "string" ? textPath.pathData : void 0;
|
|
5889
|
+
const glyphed = applyTextGlyphsAlongPath(n, ctx, pathD, textPath.startOffset, textPath.textLength, textPath.pathOverflow);
|
|
5890
|
+
if (glyphed) {
|
|
5891
|
+
n = glyphed;
|
|
5892
|
+
consumedByGlyphs = true;
|
|
5893
|
+
}
|
|
5894
|
+
} else {
|
|
5895
|
+
n = applyTextGlyphsEffect(n, text, ctx);
|
|
5896
|
+
consumedByGlyphs = true;
|
|
5897
|
+
}
|
|
5898
|
+
}
|
|
5899
|
+
if (!consumedByGlyphs) n = applyTextPathEffect(n, textPath, ctx);
|
|
5900
|
+
n = applyFillGradientEffect(n, fillGradient, ctx);
|
|
5901
|
+
n = applyStrokeGradientEffect(n, strokeGradient, ctx);
|
|
5902
|
+
n = applyStrokeTrimEffect(n, strokeTrim, ctx);
|
|
5903
|
+
n = applyRepeaterEffect(n, repeater, ctx);
|
|
5904
|
+
n = applyMaskedByEffect(n, maskedBy, transformBy, ctx);
|
|
5905
|
+
n = applyClipPathEffect(n, clipPath, ctx);
|
|
5906
|
+
if (innerIdForContentRef) {
|
|
5907
|
+
applyRefHref(n, cloneFx, ctx);
|
|
5908
|
+
n = splitForContentRef(n, transformBy, originalId, innerIdForContentRef, ctx);
|
|
5909
|
+
} else {
|
|
5910
|
+
n = applyRefAndTransformationEffect(n, cloneFx, transformBy, ctx);
|
|
5911
|
+
}
|
|
5912
|
+
if (cloneFx == null ? void 0 : cloneFx.retime) node.effects = { clone: { retime: cloneFx.retime } };
|
|
5913
|
+
if (originalId) ctx.idMap.set(originalId, n);
|
|
5914
|
+
return n;
|
|
5915
|
+
}
|
|
5916
|
+
function applyPlayerEffects_retime(node, ctx) {
|
|
5917
|
+
applyAllRetimeEffects(node, ctx);
|
|
5918
|
+
return node;
|
|
5919
|
+
}
|
|
5920
|
+
|
|
5921
|
+
// src/materialize/PxOffsetPathMaterializer.ts
|
|
5922
|
+
function cubicAt(p0, c1, c2, p1, t) {
|
|
5923
|
+
const u = 1 - t;
|
|
5924
|
+
const a = u * u * u, b = 3 * u * u * t, c = 3 * u * t * t, d = t * t * t;
|
|
5925
|
+
return [
|
|
5926
|
+
a * p0[0] + b * c1[0] + c * c2[0] + d * p1[0],
|
|
5927
|
+
a * p0[1] + b * c1[1] + c * c2[1] + d * p1[1]
|
|
5928
|
+
];
|
|
5929
|
+
}
|
|
5930
|
+
function cubicLength(p0, c1, c2, p1, steps = 64) {
|
|
5931
|
+
let len = 0;
|
|
5932
|
+
let prev = p0;
|
|
5933
|
+
for (let i = 1; i <= steps; i++) {
|
|
5934
|
+
const pt = cubicAt(p0, c1, c2, p1, i / steps);
|
|
5935
|
+
len += Math.hypot(pt[0] - prev[0], pt[1] - prev[1]);
|
|
5936
|
+
prev = pt;
|
|
5937
|
+
}
|
|
5938
|
+
return len;
|
|
5939
|
+
}
|
|
5940
|
+
var fmt2 = (n) => {
|
|
5941
|
+
const r = Math.round(n * 1e4) / 1e4;
|
|
5942
|
+
return Object.is(r, -0) ? "0" : String(r);
|
|
5943
|
+
};
|
|
5944
|
+
function buildOffsetPath(propAnim) {
|
|
5945
|
+
var _a2, _b, _c;
|
|
5946
|
+
if (propAnim.alongPathMode !== "offsetPath") return void 0;
|
|
5947
|
+
const kfs = propAnim.keyframes;
|
|
5948
|
+
if (!kfs || kfs.length < 2) return void 0;
|
|
5949
|
+
const first = keyframeValue(kfs[0]);
|
|
5950
|
+
const anchor = (first == null ? void 0 : first.origin) && first.origin.length >= 2 ? [first.origin[0], first.origin[1]] : [0, 0];
|
|
5951
|
+
const points = [];
|
|
5952
|
+
let keyframesCarryRotate = false;
|
|
5953
|
+
for (const kf of kfs) {
|
|
5954
|
+
const v = keyframeValue(kf);
|
|
5955
|
+
const tr = v == null ? void 0 : v.translate;
|
|
5956
|
+
if (!tr || tr.length < 2) return void 0;
|
|
5957
|
+
const parts = Object.keys(v);
|
|
5958
|
+
if (parts.some((p) => p !== TRANSFORM_PART.translate && p !== TRANSFORM_PART.origin && p !== TRANSFORM_PART.rotate)) return void 0;
|
|
5959
|
+
if ((v == null ? void 0 : v.rotate) !== void 0) {
|
|
5960
|
+
if (v.rotate !== 0) return void 0;
|
|
5961
|
+
keyframesCarryRotate = true;
|
|
5962
|
+
}
|
|
5963
|
+
const o = (_a2 = v == null ? void 0 : v.origin) != null ? _a2 : [0, 0];
|
|
5964
|
+
if (o[0] !== anchor[0] || o[1] !== anchor[1]) return void 0;
|
|
5965
|
+
points.push([tr[0] + anchor[0], tr[1] + anchor[1]]);
|
|
5966
|
+
}
|
|
5967
|
+
if (!kfs.some((kf) => keyframeTangentIn(kf) || keyframeTangentOut(kf))) return void 0;
|
|
5968
|
+
let d = "M" + fmt2(points[0][0]) + "," + fmt2(points[0][1]);
|
|
5969
|
+
const segLens = [];
|
|
5970
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
5971
|
+
const p0 = points[i], p1 = points[i + 1];
|
|
5972
|
+
const to = (_b = keyframeTangentOut(kfs[i])) != null ? _b : [0, 0];
|
|
5973
|
+
const ti = (_c = keyframeTangentIn(kfs[i + 1])) != null ? _c : [0, 0];
|
|
5974
|
+
const c1 = [p0[0] + to[0], p0[1] + to[1]];
|
|
5975
|
+
const c2 = [p1[0] + ti[0], p1[1] + ti[1]];
|
|
5976
|
+
d += "C" + fmt2(c1[0]) + "," + fmt2(c1[1]) + "," + fmt2(c2[0]) + "," + fmt2(c2[1]) + "," + fmt2(p1[0]) + "," + fmt2(p1[1]);
|
|
5977
|
+
segLens.push(cubicLength(p0, c1, c2, p1));
|
|
5978
|
+
}
|
|
5979
|
+
const total = segLens.reduce((a, b) => a + b, 0);
|
|
5980
|
+
if (!(total > 0)) return void 0;
|
|
5981
|
+
const distanceKfs = [];
|
|
5982
|
+
let cum = 0;
|
|
5983
|
+
for (let i = 0; i < kfs.length; i++) {
|
|
5984
|
+
if (i > 0) cum += segLens[i - 1];
|
|
5985
|
+
const out = { t: keyframeTime(kfs[i]), v: cum / total };
|
|
5986
|
+
const e = keyframeEasing(kfs[i]);
|
|
5987
|
+
if (e !== void 0) out.e = e;
|
|
5988
|
+
distanceKfs.push(out);
|
|
5989
|
+
}
|
|
5990
|
+
return { pathStr: d, distanceKfs, autoOrient: !!propAnim.autoOrient, anchor, keyframesCarryRotate };
|
|
5991
|
+
}
|
|
5992
|
+
function materializeOffsetPathsInTree(root) {
|
|
5993
|
+
const walk = (node) => {
|
|
5994
|
+
var _a2;
|
|
5995
|
+
let out = node;
|
|
5996
|
+
const anim = node.animate;
|
|
5997
|
+
const transform = anim == null ? void 0 : anim["transform"];
|
|
5998
|
+
if (transform) {
|
|
5999
|
+
const built = buildOffsetPath(transform);
|
|
6000
|
+
if (built) {
|
|
6001
|
+
const newAnimate = __spreadValues({}, anim);
|
|
6002
|
+
delete newAnimate[TRANSFORM_ATTR];
|
|
6003
|
+
const distance = { keyframes: built.distanceKfs };
|
|
6004
|
+
if (transform.loop !== void 0) distance.loop = transform.loop;
|
|
6005
|
+
newAnimate[OFFSET_DISTANCE_ATTR] = distance;
|
|
6006
|
+
const staticTr = node.transform;
|
|
6007
|
+
let newTransform = staticTr;
|
|
6008
|
+
if (staticTr && typeof staticTr === "object") {
|
|
6009
|
+
const t = __spreadValues({}, staticTr);
|
|
6010
|
+
delete t[TRANSFORM_PART.translate];
|
|
6011
|
+
delete t[TRANSFORM_PART.origin];
|
|
6012
|
+
if (built.keyframesCarryRotate) delete t[TRANSFORM_PART.rotate];
|
|
6013
|
+
newTransform = Object.keys(t).length ? t : void 0;
|
|
6014
|
+
}
|
|
6015
|
+
out = __spreadProps(__spreadValues({}, node), {
|
|
6016
|
+
animate: newAnimate,
|
|
6017
|
+
style: __spreadProps(__spreadValues({}, node.style), {
|
|
6018
|
+
offsetPath: "path('" + built.pathStr + "')",
|
|
6019
|
+
offsetAnchor: fmt2(built.anchor[0]) + "px " + fmt2(built.anchor[1]) + "px",
|
|
6020
|
+
offsetRotate: built.autoOrient ? "auto" : "0deg",
|
|
6021
|
+
offsetDistance: "0%"
|
|
6022
|
+
})
|
|
6023
|
+
});
|
|
6024
|
+
if (newTransform !== void 0) out.transform = newTransform;
|
|
6025
|
+
else delete out.transform;
|
|
6026
|
+
}
|
|
6027
|
+
}
|
|
6028
|
+
if ((_a2 = out.children) == null ? void 0 : _a2.length) {
|
|
6029
|
+
const children = out.children.map(walk);
|
|
6030
|
+
if (children.some((c, i) => c !== out.children[i])) out = __spreadProps(__spreadValues({}, out), { children });
|
|
6031
|
+
}
|
|
6032
|
+
return out;
|
|
6033
|
+
};
|
|
6034
|
+
return walk(root);
|
|
6035
|
+
}
|
|
6036
|
+
|
|
6037
|
+
// src/materialize/PxAnimatorUseMaterializer.ts
|
|
6038
|
+
function materializeAnimatedUseInstances(root) {
|
|
6039
|
+
var _a2;
|
|
6040
|
+
const idMap = buildIdMap(root);
|
|
6041
|
+
const animatedIds = computeAnimatedSubtreeIds(root, idMap);
|
|
6042
|
+
if (animatedIds.size === 0) return root;
|
|
6043
|
+
let idCounter = 0;
|
|
6044
|
+
const genId3 = () => "_lw_use_mat_" + ++idCounter;
|
|
6045
|
+
const rootViewport = readRootViewport(root);
|
|
6046
|
+
const defsCollector = [];
|
|
6047
|
+
const walked = walkAndMaterialize2(root, idMap, animatedIds, genId3, defsCollector, rootViewport);
|
|
6048
|
+
if (defsCollector.length === 0) return walked;
|
|
6049
|
+
const defsNode = { type: "defs", children: defsCollector };
|
|
6050
|
+
const newChildren = [...(_a2 = walked.children) != null ? _a2 : [], defsNode];
|
|
6051
|
+
return __spreadProps(__spreadValues({}, walked), { children: newChildren });
|
|
6052
|
+
}
|
|
6053
|
+
function readRootViewport(root) {
|
|
6054
|
+
const vb = parseViewBox(root.viewBox);
|
|
6055
|
+
if (vb) return [vb[2], vb[3]];
|
|
6056
|
+
const w = numericAttr(root.width);
|
|
6057
|
+
const h = numericAttr(root.height);
|
|
6058
|
+
if (w !== void 0 && h !== void 0) return [w, h];
|
|
6059
|
+
return [1, 1];
|
|
6060
|
+
}
|
|
6061
|
+
function numericAttr(v) {
|
|
6062
|
+
if (typeof v === "number") return v;
|
|
6063
|
+
if (typeof v === "string") {
|
|
6064
|
+
const n = parseFloat(v);
|
|
6065
|
+
return Number.isFinite(n) ? n : void 0;
|
|
6066
|
+
}
|
|
6067
|
+
return void 0;
|
|
6068
|
+
}
|
|
6069
|
+
function buildIdMap(root) {
|
|
6070
|
+
const map = /* @__PURE__ */ new Map();
|
|
6071
|
+
const visit = (n) => {
|
|
6072
|
+
var _a2;
|
|
6073
|
+
if (typeof n.id === "string") map.set(n.id, n);
|
|
6074
|
+
(_a2 = n.children) == null ? void 0 : _a2.forEach(visit);
|
|
6075
|
+
};
|
|
6076
|
+
visit(root);
|
|
6077
|
+
return map;
|
|
6078
|
+
}
|
|
6079
|
+
function computeAnimatedSubtreeIds(root, idMap) {
|
|
6080
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
6081
|
+
const result = /* @__PURE__ */ new Set();
|
|
6082
|
+
const hasAnim = (n, visiting) => {
|
|
6083
|
+
const cached = cache.get(n);
|
|
6084
|
+
if (cached !== void 0) return cached;
|
|
6085
|
+
if (visiting.has(n)) return false;
|
|
6086
|
+
visiting.add(n);
|
|
6087
|
+
let r = false;
|
|
6088
|
+
if (n.animate && typeof n.animate === "object" && !Array.isArray(n.animate)) {
|
|
6089
|
+
for (const _ in n.animate) {
|
|
6090
|
+
r = true;
|
|
6091
|
+
break;
|
|
6092
|
+
}
|
|
6093
|
+
}
|
|
6094
|
+
if (!r && n.children) {
|
|
6095
|
+
for (const ch of n.children) {
|
|
6096
|
+
if (hasAnim(ch, visiting)) {
|
|
6097
|
+
r = true;
|
|
6098
|
+
break;
|
|
6099
|
+
}
|
|
6100
|
+
}
|
|
6101
|
+
}
|
|
6102
|
+
if (!r && n.type === "use" && typeof n.href === "string") {
|
|
6103
|
+
const targetId = stripHash2(n.href);
|
|
6104
|
+
const target = targetId ? idMap.get(targetId) : void 0;
|
|
6105
|
+
if (target) r = hasAnim(target, visiting);
|
|
6106
|
+
}
|
|
6107
|
+
visiting.delete(n);
|
|
6108
|
+
cache.set(n, r);
|
|
6109
|
+
return r;
|
|
6110
|
+
};
|
|
6111
|
+
for (const [id, node] of idMap) {
|
|
6112
|
+
if (hasAnim(node, /* @__PURE__ */ new Set())) result.add(id);
|
|
6113
|
+
}
|
|
6114
|
+
return result;
|
|
6115
|
+
}
|
|
6116
|
+
function stripHash2(href) {
|
|
6117
|
+
if (typeof href !== "string") return void 0;
|
|
6118
|
+
return href.startsWith("#") ? href.slice(1) : href;
|
|
6119
|
+
}
|
|
6120
|
+
function materializeOneUse(useNode, target, idMap, animatedIds, genId3, defsCollector, rootViewport) {
|
|
6121
|
+
var _a2, _b, _c, _d;
|
|
6122
|
+
const clone2 = deepClonePxNode(target);
|
|
6123
|
+
regenerateIdsAndRewriteRefs(clone2, genId3);
|
|
6124
|
+
const symbolViewBox = clone2.type === "symbol" ? parseViewBox(clone2.viewBox) : void 0;
|
|
6125
|
+
const useW = (_b = (_a2 = numericAttr(useNode.width)) != null ? _a2 : symbolViewBox == null ? void 0 : symbolViewBox[2]) != null ? _b : rootViewport[0];
|
|
6126
|
+
const useH = (_d = (_c = numericAttr(useNode.height)) != null ? _c : symbolViewBox == null ? void 0 : symbolViewBox[3]) != null ? _d : rootViewport[1];
|
|
6127
|
+
const rewrittenClone = clone2.type === "symbol" ? rewriteSymbolRootToGroup(clone2, genId3, defsCollector, useW, useH) : clone2;
|
|
6128
|
+
const materializedClone = walkAndMaterialize2(rewrittenClone, idMap, animatedIds, genId3, defsCollector, rootViewport);
|
|
6129
|
+
const newNode = __spreadProps(__spreadValues({}, useNode), { type: "g", children: [materializedClone] });
|
|
6130
|
+
delete newNode.href;
|
|
6131
|
+
delete newNode.width;
|
|
6132
|
+
delete newNode.height;
|
|
6133
|
+
return applyUseOffsetToG(newNode);
|
|
6134
|
+
}
|
|
6135
|
+
function rewriteSymbolRootToGroup(symbolNode, genId3, defsCollector, useW, useH) {
|
|
6136
|
+
const viewBox = parseViewBox(symbolNode.viewBox);
|
|
6137
|
+
const g = __spreadProps(__spreadValues({}, symbolNode), { type: "g" });
|
|
6138
|
+
delete g.viewBox;
|
|
6139
|
+
delete g.preserveAspectRatio;
|
|
6140
|
+
delete g.width;
|
|
6141
|
+
delete g.height;
|
|
6142
|
+
if (!viewBox) return g;
|
|
6143
|
+
const [vbX, vbY, vbW, vbH] = viewBox;
|
|
6144
|
+
const scale = vbW > 0 && vbH > 0 ? Math.min(useW / vbW, useH / vbH) : 1;
|
|
6145
|
+
const xOff = (useW - vbW * scale) / 2;
|
|
6146
|
+
const yOff = (useH - vbH * scale) / 2;
|
|
6147
|
+
const parts = [];
|
|
6148
|
+
if (xOff !== 0 || yOff !== 0) parts.push("translate(" + xOff + "," + yOff + ")");
|
|
6149
|
+
if (scale !== 1) parts.push("scale(" + scale + ")");
|
|
6150
|
+
if (vbX !== 0 || vbY !== 0) parts.push("translate(" + -vbX + "," + -vbY + ")");
|
|
6151
|
+
if (parts.length) g.transform = parts.join("");
|
|
6152
|
+
const clipId = genId3();
|
|
6153
|
+
defsCollector.push({
|
|
6154
|
+
type: "clipPath",
|
|
6155
|
+
id: clipId,
|
|
6156
|
+
children: [{ type: "rect", x: vbX, y: vbY, width: vbW, height: vbH }]
|
|
6157
|
+
});
|
|
6158
|
+
g.clipPath = "url(#" + clipId + ")";
|
|
6159
|
+
return g;
|
|
6160
|
+
}
|
|
6161
|
+
function parseViewBox(v) {
|
|
6162
|
+
if (typeof v !== "string") return void 0;
|
|
6163
|
+
const parts = v.trim().split(/[\s,]+/).map(Number);
|
|
6164
|
+
if (parts.length < 4 || parts.some((n) => !Number.isFinite(n))) return void 0;
|
|
6165
|
+
return [parts[0], parts[1], parts[2], parts[3]];
|
|
6166
|
+
}
|
|
6167
|
+
function walkAndMaterialize2(node, idMap, animatedIds, genId3, defsCollector, rootViewport) {
|
|
6168
|
+
if (node.type === "use" && typeof node.href === "string") {
|
|
6169
|
+
const targetId = stripHash2(node.href);
|
|
6170
|
+
if (targetId && animatedIds.has(targetId)) {
|
|
6171
|
+
const target = idMap.get(targetId);
|
|
6172
|
+
if (target) return materializeOneUse(node, target, idMap, animatedIds, genId3, defsCollector, rootViewport);
|
|
6173
|
+
}
|
|
6174
|
+
}
|
|
6175
|
+
if (!node.children) return node;
|
|
6176
|
+
let changed = false;
|
|
6177
|
+
const newChildren = node.children.map((ch) => {
|
|
6178
|
+
const m = walkAndMaterialize2(ch, idMap, animatedIds, genId3, defsCollector, rootViewport);
|
|
6179
|
+
if (m !== ch) changed = true;
|
|
6180
|
+
return m;
|
|
6181
|
+
});
|
|
6182
|
+
return changed ? __spreadProps(__spreadValues({}, node), { children: newChildren }) : node;
|
|
6183
|
+
}
|
|
6184
|
+
|
|
6185
|
+
// src/materialize/PxRestPose.ts
|
|
6186
|
+
var TRANSFORM_CHANNEL = "transform";
|
|
6187
|
+
var REVERSED_DIRECTIONS = /* @__PURE__ */ new Set(["reverse", "alternate-reverse"]);
|
|
6188
|
+
var SCRATCH_ID_PREFIX = "__px_rest_";
|
|
6189
|
+
function materializeRestPosesInTree(root, engine) {
|
|
6190
|
+
var _a2;
|
|
6191
|
+
const out = deepClone(root);
|
|
6192
|
+
const config = getAnimatorConfig(out) || {};
|
|
6193
|
+
const duration = +(config.duration || PX_DEFAULT_DURATION_MS);
|
|
6194
|
+
const firstFrameTime = REVERSED_DIRECTIONS.has(String(config.direction)) ? duration : 0;
|
|
6195
|
+
const nodes = animatedNodes(out);
|
|
6196
|
+
if (!nodes.size) return out;
|
|
6197
|
+
const before = bindingsOf(out, engine);
|
|
6198
|
+
const added = /* @__PURE__ */ new Map();
|
|
6199
|
+
for (const [key, animate] of before) {
|
|
6200
|
+
const node = nodes.get(key);
|
|
6201
|
+
if (!node) continue;
|
|
6202
|
+
for (const channel of Object.keys(animate)) {
|
|
6203
|
+
if (!mayCarryRestPose(node, channel)) continue;
|
|
6204
|
+
const value = firstFrameValue(animate, channel, firstFrameTime);
|
|
6205
|
+
if (value === void 0) continue;
|
|
6206
|
+
node[channel] = value;
|
|
6207
|
+
added.set(key, [...(_a2 = added.get(key)) != null ? _a2 : [], channel]);
|
|
6208
|
+
}
|
|
6209
|
+
}
|
|
6210
|
+
if (added.size) {
|
|
6211
|
+
const after = bindingsOf(out, engine);
|
|
6212
|
+
for (const [key, channels] of added) {
|
|
6213
|
+
if (JSON.stringify(after.get(key)) === JSON.stringify(before.get(key))) continue;
|
|
6214
|
+
const node = nodes.get(key);
|
|
6215
|
+
if (node) for (const channel of channels) delete node[channel];
|
|
6216
|
+
}
|
|
6217
|
+
}
|
|
6218
|
+
return out;
|
|
6219
|
+
}
|
|
6220
|
+
function mayCarryRestPose(node, channel) {
|
|
6221
|
+
if (node[channel] !== void 0) return false;
|
|
6222
|
+
if (PX_TRANSFORM_FN_NAMES.has(channel)) return false;
|
|
6223
|
+
if (channel === TRANSFORM_CHANNEL) {
|
|
6224
|
+
for (const part of PX_TRANSFORM_FN_NAMES) if (node[part] !== void 0) return false;
|
|
6225
|
+
}
|
|
6226
|
+
return true;
|
|
6227
|
+
}
|
|
6228
|
+
function firstFrameValue(animate, channel, timeMs) {
|
|
6229
|
+
const values = Object.values(calcAnimationValues({ [channel]: animate[channel] }, timeMs));
|
|
6230
|
+
return values.length === 1 && values[0] !== "" ? values[0] : void 0;
|
|
6231
|
+
}
|
|
6232
|
+
function bindingsOf(tree, engine) {
|
|
6233
|
+
const scratch = deepClone(tree);
|
|
6234
|
+
const keyById = /* @__PURE__ */ new Map();
|
|
6235
|
+
for (const [key, node] of animatedNodes(scratch)) {
|
|
6236
|
+
if (node.id === void 0) node.id = SCRATCH_ID_PREFIX + key;
|
|
6237
|
+
keyById.set(String(node.id), key);
|
|
6238
|
+
}
|
|
6239
|
+
const out = /* @__PURE__ */ new Map();
|
|
6240
|
+
for (const binding of normalizeBindings(scratch, engine)) {
|
|
6241
|
+
const key = keyById.get(binding.id);
|
|
6242
|
+
if (key !== void 0) out.set(key, binding.animate);
|
|
6243
|
+
}
|
|
6244
|
+
return out;
|
|
6245
|
+
}
|
|
6246
|
+
function animatedNodes(tree) {
|
|
6247
|
+
const out = /* @__PURE__ */ new Map();
|
|
6248
|
+
let counter = 0;
|
|
6249
|
+
const visit = (node) => {
|
|
6250
|
+
if (node.animate) out.set(String(counter++), node);
|
|
6251
|
+
if (node.children) for (const child of node.children) visit(child);
|
|
6252
|
+
};
|
|
6253
|
+
if (tree.children) for (const child of tree.children) visit(child);
|
|
6254
|
+
return out;
|
|
6255
|
+
}
|
|
6256
|
+
|
|
6257
|
+
// src/materialize/PxAnimatorMaterializeAll.ts
|
|
6258
|
+
function materializeAllInTree(doc, engine, options) {
|
|
6259
|
+
var _a2, _b;
|
|
6260
|
+
let root = materializeNodeEffects(doc).root;
|
|
6261
|
+
root = materializeOffsetPathsInTree(root);
|
|
6262
|
+
const duration = (_b = (_a2 = getAnimatorConfig(root)) == null ? void 0 : _a2.duration) != null ? _b : PX_DEFAULT_DURATION_MS;
|
|
6263
|
+
root = materializeInternalLoopsInTree(root, duration);
|
|
6264
|
+
if (engine === PxTimelineEngine.native) {
|
|
6265
|
+
root = materializeMotionPathsInTree(root, options == null ? void 0 : options.motionPath);
|
|
6266
|
+
root = materializeAnimatedUseInstances(root);
|
|
6267
|
+
root = pruneUnreferencedDefs(root);
|
|
6268
|
+
}
|
|
6269
|
+
root = materializeRestPosesInTree(root, engine);
|
|
6270
|
+
return root;
|
|
6271
|
+
}
|
|
6272
|
+
function prepareDocumentForRender(doc) {
|
|
6273
|
+
var _a2;
|
|
6274
|
+
const engine = resolveTimelineEngine((_a2 = getAnimatorConfig(doc)) == null ? void 0 : _a2.engine);
|
|
6275
|
+
return generateNewIds(materializeAllInTree(doc, engine));
|
|
6276
|
+
}
|
|
6277
|
+
function pruneUnreferencedDefs(root) {
|
|
6278
|
+
const stripHash3 = (h) => h.startsWith("#") ? h.slice(1) : h;
|
|
6279
|
+
const walk = (n, fn) => {
|
|
6280
|
+
var _a2;
|
|
6281
|
+
fn(n);
|
|
6282
|
+
(_a2 = n.children) == null ? void 0 : _a2.forEach((c) => walk(c, fn));
|
|
6283
|
+
};
|
|
6284
|
+
let changed = true;
|
|
6285
|
+
while (changed) {
|
|
6286
|
+
changed = false;
|
|
6287
|
+
const referenced = /* @__PURE__ */ new Set();
|
|
6288
|
+
walk(root, (n) => {
|
|
6289
|
+
if (n.type === "use" && typeof n.href === "string") referenced.add(stripHash3(n.href));
|
|
6290
|
+
});
|
|
6291
|
+
walk(root, (n) => {
|
|
6292
|
+
if (!n.children) return;
|
|
6293
|
+
let kept = n.children;
|
|
6294
|
+
if (n.type === "defs") {
|
|
6295
|
+
kept = kept.filter((c) => !((c.type === "g" || c.type === "symbol") && typeof c.id === "string" && !referenced.has(c.id)));
|
|
6296
|
+
}
|
|
6297
|
+
kept = kept.filter((c) => !(c.type === "defs" && (!c.children || c.children.length === 0)));
|
|
6298
|
+
if (kept.length !== n.children.length) {
|
|
6299
|
+
n.children = kept;
|
|
6300
|
+
changed = true;
|
|
6301
|
+
}
|
|
6302
|
+
});
|
|
6303
|
+
}
|
|
6304
|
+
return root;
|
|
6305
|
+
}
|
|
6306
|
+
|
|
6307
|
+
// src/playback/PxDiagnosticCode.ts
|
|
6308
|
+
var PxDiagnosticCode = /* @__PURE__ */ ((PxDiagnosticCode2) => {
|
|
6309
|
+
PxDiagnosticCode2[PxDiagnosticCode2["buildFailed"] = 1001] = "buildFailed";
|
|
6310
|
+
PxDiagnosticCode2[PxDiagnosticCode2["invalidDocumentAtSrc"] = 1002] = "invalidDocumentAtSrc";
|
|
6311
|
+
PxDiagnosticCode2[PxDiagnosticCode2["loadFailed"] = 1003] = "loadFailed";
|
|
6312
|
+
PxDiagnosticCode2[PxDiagnosticCode2["animationBuildFailed"] = 1004] = "animationBuildFailed";
|
|
6313
|
+
PxDiagnosticCode2[PxDiagnosticCode2["effectsShape"] = 1101] = "effectsShape";
|
|
6314
|
+
PxDiagnosticCode2[PxDiagnosticCode2["timelineOverrideIgnored"] = 1102] = "timelineOverrideIgnored";
|
|
6315
|
+
PxDiagnosticCode2[PxDiagnosticCode2["blockedTag"] = 1103] = "blockedTag";
|
|
6316
|
+
PxDiagnosticCode2[PxDiagnosticCode2["unsupportedAnimatedAttrs"] = 1104] = "unsupportedAnimatedAttrs";
|
|
6317
|
+
PxDiagnosticCode2[PxDiagnosticCode2["noBindings"] = 1105] = "noBindings";
|
|
6318
|
+
PxDiagnosticCode2[PxDiagnosticCode2["unresolvedBinding"] = 1106] = "unresolvedBinding";
|
|
6319
|
+
PxDiagnosticCode2[PxDiagnosticCode2["triggersNoRoot"] = 1201] = "triggersNoRoot";
|
|
6320
|
+
PxDiagnosticCode2[PxDiagnosticCode2["noRootForSelector"] = 1202] = "noRootForSelector";
|
|
6321
|
+
PxDiagnosticCode2[PxDiagnosticCode2["noRootElement"] = 1203] = "noRootElement";
|
|
6322
|
+
PxDiagnosticCode2[PxDiagnosticCode2["noElementsForSelector"] = 1206] = "noElementsForSelector";
|
|
6323
|
+
PxDiagnosticCode2[PxDiagnosticCode2["setAttributeNoElement"] = 1207] = "setAttributeNoElement";
|
|
6324
|
+
PxDiagnosticCode2[PxDiagnosticCode2["scrollSmoothingNeedsOwnDriver"] = 1301] = "scrollSmoothingNeedsOwnDriver";
|
|
6325
|
+
PxDiagnosticCode2[PxDiagnosticCode2["scrollNativeUnavailable"] = 1302] = "scrollNativeUnavailable";
|
|
6326
|
+
PxDiagnosticCode2[PxDiagnosticCode2["scrollSubjectInvalid"] = 1303] = "scrollSubjectInvalid";
|
|
6327
|
+
PxDiagnosticCode2[PxDiagnosticCode2["scrollSubjectNoMatch"] = 1304] = "scrollSubjectNoMatch";
|
|
6328
|
+
PxDiagnosticCode2[PxDiagnosticCode2["scrollNoRootToObserve"] = 1305] = "scrollNoRootToObserve";
|
|
6329
|
+
PxDiagnosticCode2[PxDiagnosticCode2["scrollTriggerIgnored"] = 1306] = "scrollTriggerIgnored";
|
|
6330
|
+
PxDiagnosticCode2[PxDiagnosticCode2["rateRejected"] = 1401] = "rateRejected";
|
|
6331
|
+
PxDiagnosticCode2[PxDiagnosticCode2["controlPropsConflict"] = 1501] = "controlPropsConflict";
|
|
6332
|
+
PxDiagnosticCode2[PxDiagnosticCode2["rnCompileFailed"] = 1601] = "rnCompileFailed";
|
|
6333
|
+
PxDiagnosticCode2[PxDiagnosticCode2["rnRenderFailed"] = 1602] = "rnRenderFailed";
|
|
6334
|
+
PxDiagnosticCode2[PxDiagnosticCode2["rnBoundaryCaught"] = 1603] = "rnBoundaryCaught";
|
|
6335
|
+
PxDiagnosticCode2[PxDiagnosticCode2["rnUnsupported"] = 1604] = "rnUnsupported";
|
|
6336
|
+
return PxDiagnosticCode2;
|
|
6337
|
+
})(PxDiagnosticCode || {});
|
|
6338
|
+
|
|
4412
6339
|
// src/playback/PxDiagnostics.ts
|
|
4413
6340
|
var PxDiagnosticKind = {
|
|
4414
6341
|
/** The document is wrong — regenerate or repair the file. */
|
|
@@ -4476,6 +6403,7 @@ function reportDocumentDiagnostics(doc, where) {
|
|
|
4476
6403
|
export {
|
|
4477
6404
|
__spreadValues,
|
|
4478
6405
|
__spreadProps,
|
|
6406
|
+
__objRest,
|
|
4479
6407
|
PX_UNKNOWN_KEY_ERROR,
|
|
4480
6408
|
schemaKeys,
|
|
4481
6409
|
describeSchema,
|
|
@@ -4532,9 +6460,6 @@ export {
|
|
|
4532
6460
|
PxTextPathSpacing,
|
|
4533
6461
|
PxStrokeTrimSubPaths,
|
|
4534
6462
|
PX_TEXT_CONTENT_ATTR,
|
|
4535
|
-
TRANSFORM_ATTR,
|
|
4536
|
-
OFFSET_DISTANCE_ATTR,
|
|
4537
|
-
TRANSFORM_PART,
|
|
4538
6463
|
PX_TRANSFORM_PART_KEYS,
|
|
4539
6464
|
PxGradientSpreadMethod,
|
|
4540
6465
|
PxGradientType,
|
|
@@ -4547,11 +6472,8 @@ export {
|
|
|
4547
6472
|
getChildren,
|
|
4548
6473
|
PxKeyframeValueSchema,
|
|
4549
6474
|
PxKeyframeSchema,
|
|
4550
|
-
keyframeTime,
|
|
4551
6475
|
keyframeValue,
|
|
4552
6476
|
keyframeEasing,
|
|
4553
|
-
keyframeTangentIn,
|
|
4554
|
-
keyframeTangentOut,
|
|
4555
6477
|
PxLoopSchema,
|
|
4556
6478
|
PxPropertyAnimationSchema,
|
|
4557
6479
|
PxTransformPartsSchema,
|
|
@@ -4603,45 +6525,28 @@ export {
|
|
|
4603
6525
|
kebabToCamelCaseWord,
|
|
4604
6526
|
camelCaseToKebabWordIfNeeded,
|
|
4605
6527
|
clamp,
|
|
4606
|
-
bezier2D_arcLengthLUT,
|
|
4607
6528
|
PX_DISALLOWED_SVG_TAGS_LOWER,
|
|
4608
6529
|
PX_CSS_ONLY_STYLE_PROPS,
|
|
4609
6530
|
sanitizeAttributeValue,
|
|
4610
6531
|
toDomProps,
|
|
6532
|
+
mergeStaticTransformIntoAnimDef,
|
|
4611
6533
|
materializeMotionPathInPropAnim,
|
|
4612
|
-
materializeMotionPathsInTree,
|
|
4613
6534
|
PX_LOOP_JUMP_SHIFT_MS,
|
|
4614
|
-
parseSvgPathToBezier,
|
|
4615
6535
|
interpolateValue,
|
|
4616
|
-
materializeInternalLoopsInTree,
|
|
4617
|
-
mergeStaticTransformIntoAnimDef,
|
|
4618
6536
|
normalizeBindings,
|
|
4619
6537
|
calcAnimationValues,
|
|
4620
|
-
partsRecord,
|
|
4621
|
-
readAnimatable,
|
|
4622
|
-
writeAnimatableChannel,
|
|
4623
|
-
readStaticOrigin,
|
|
4624
|
-
keyframeWith,
|
|
4625
|
-
deepClonePxNode,
|
|
4626
|
-
regenerateIdsAndRewriteRefs,
|
|
4627
|
-
applyUseOffsetToG,
|
|
4628
|
-
genId,
|
|
4629
|
-
stripHash,
|
|
4630
|
-
indexById,
|
|
4631
|
-
spliceDefs,
|
|
4632
|
-
clone,
|
|
4633
|
-
regenerateIdsInClone,
|
|
4634
6538
|
createPathSampler,
|
|
4635
6539
|
extendedPathForBrowser,
|
|
4636
|
-
applyTextPathEffect,
|
|
4637
6540
|
layoutGlyphTextChars,
|
|
4638
6541
|
materializeGlyphTextAlongPath,
|
|
4639
6542
|
materializeGlyphText,
|
|
4640
|
-
|
|
4641
|
-
|
|
6543
|
+
materializeNodeEffects,
|
|
6544
|
+
materializeAllInTree,
|
|
6545
|
+
prepareDocumentForRender,
|
|
6546
|
+
PxDiagnosticCode,
|
|
4642
6547
|
PxDiagnosticKind,
|
|
4643
6548
|
createDiagnostics,
|
|
4644
6549
|
diagnoseDocument,
|
|
4645
6550
|
reportDocumentDiagnostics
|
|
4646
6551
|
};
|
|
4647
|
-
//# sourceMappingURL=chunk-
|
|
6552
|
+
//# sourceMappingURL=chunk-YVKMPBHE.js.map
|