@pixodesk/svg-animator-vue 1.0.48 → 1.0.49

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/index.umd.js CHANGED
@@ -56761,7 +56761,7 @@ ${codeFrame}` : message);
56761
56761
  PixodeskSvgCssAnimator: () => PixodeskSvgCssAnimator_default
56762
56762
  });
56763
56763
 
56764
- // ../svg-animator-web/dist/chunk-ZEUVRAKS.js
56764
+ // ../svg-animator-web/dist/chunk-U5Z7OD2T.js
56765
56765
  var __defProp2 = Object.defineProperty;
56766
56766
  var __defProps = Object.defineProperties;
56767
56767
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -57915,7 +57915,7 @@ ${codeFrame}` : message);
57915
57915
  }));
57916
57916
  var PxStrokeGradientEffectSchema = PxFillGradientEffectSchema;
57917
57917
  var PxTextPathEffectSchema = implementsInterface()(px.object({
57918
- pathData: px.string(),
57918
+ pathData: PxAnimatableStringSchema,
57919
57919
  // `extend` is what an omitted pathOverflow means (glyphs continue along the tangent); the
57920
57920
  // other three are SVG's own initial values for the native <textPath> attributes.
57921
57921
  pathOverflow: px.enum([PxPathOverflow.clip, PxPathOverflow.extend], PxPathOverflow.extend).optional(),
@@ -59962,11 +59962,11 @@ ${codeFrame}` : message);
59962
59962
  const totalLength = cum[segs.length];
59963
59963
  const start = segs[0].P0, end = segs[segs.length - 1].P3;
59964
59964
  const closed = Math.hypot(end[0] - start[0], end[1] - start[1]) < 1e-3;
59965
- const sampleOn = (dist) => {
59965
+ const sampleOn = (dist22) => {
59966
59966
  let k = 0;
59967
- while (k < segs.length - 1 && dist > cum[k + 1]) k++;
59967
+ while (k < segs.length - 1 && dist22 > cum[k + 1]) k++;
59968
59968
  const seg = segs[k];
59969
- const local = dist - cum[k];
59969
+ const local = dist22 - cum[k];
59970
59970
  const t = seg.len > 0 ? bezier2D_tForDistance(seg.lut, local) : 0;
59971
59971
  const [x, y] = bezier2D_pointAt(seg.P0, seg.P1, seg.P2, seg.P3, t);
59972
59972
  const [dx, dy] = bezier2D_derivativeAt(seg.P0, seg.P1, seg.P2, seg.P3, t);
@@ -59975,17 +59975,17 @@ ${codeFrame}` : message);
59975
59975
  return {
59976
59976
  totalLength,
59977
59977
  closed,
59978
- sampleAtDistance(dist) {
59979
- if (closed && totalLength > 0 && (dist < 0 || dist > totalLength)) {
59980
- return sampleOn((dist % totalLength + totalLength) % totalLength);
59978
+ sampleAtDistance(dist22) {
59979
+ if (closed && totalLength > 0 && (dist22 < 0 || dist22 > totalLength)) {
59980
+ return sampleOn((dist22 % totalLength + totalLength) % totalLength);
59981
59981
  }
59982
- if (!closed && (dist < 0 || dist > totalLength)) {
59983
- const edge = dist < 0 ? 0 : totalLength;
59982
+ if (!closed && (dist22 < 0 || dist22 > totalLength)) {
59983
+ const edge = dist22 < 0 ? 0 : totalLength;
59984
59984
  const p = sampleOn(edge);
59985
- const over = dist - edge;
59985
+ const over = dist22 - edge;
59986
59986
  return { x: p.x + Math.cos(p.angle) * over, y: p.y + Math.sin(p.angle) * over, angle: p.angle };
59987
59987
  }
59988
- return sampleOn(clamp2(dist, 0, totalLength));
59988
+ return sampleOn(clamp2(dist22, 0, totalLength));
59989
59989
  }
59990
59990
  };
59991
59991
  }
@@ -60067,6 +60067,72 @@ ${codeFrame}` : message);
60067
60067
  if (kf.tangentIn !== void 0) out.tangentIn = kf.tangentIn;
60068
60068
  return out;
60069
60069
  }
60070
+ function pathString(v) {
60071
+ if (typeof v === "string") return v;
60072
+ if (v && typeof v === "object" && typeof v.pathData === "string") return v.pathData;
60073
+ return void 0;
60074
+ }
60075
+ function pathTrackOf(raw) {
60076
+ var _a22, _b;
60077
+ const r = readAnimatable(raw);
60078
+ if (r.kind === "absent") return void 0;
60079
+ if (r.kind === "static" || r.keyframes.length < 2) {
60080
+ const d = pathString(r.kind === "static" ? r.value : (_a22 = r.keyframes[0]) == null ? void 0 : _a22.value);
60081
+ if (!d) return void 0;
60082
+ return {
60083
+ animated: false,
60084
+ times: [],
60085
+ dAt: () => d,
60086
+ maxLength: (lengthOf) => lengthOf(d),
60087
+ moveBetween: () => 0
60088
+ };
60089
+ }
60090
+ const kfs = [...r.keyframes].map((kf) => ({ time: Number(kf.time) || 0, d: pathString(kf.value) })).filter((kf) => !!kf.d).sort((a, b) => a.time - b.time);
60091
+ if (kfs.length < 2) return pathTrackOf((_b = kfs[0]) == null ? void 0 : _b.d);
60092
+ const times = kfs.map((kf) => kf.time);
60093
+ const beziers = kfs.map((kf) => parseSvgPathToBezier(kf.d));
60094
+ const at = (t) => {
60095
+ if (t <= times[0]) return beziers[0];
60096
+ for (let i = 1; i < times.length; i++) {
60097
+ if (t <= times[i]) {
60098
+ const span = times[i] - times[i - 1];
60099
+ const f = span > 0 ? (t - times[i - 1]) / span : 1;
60100
+ return interpolateBeziers(beziers[i - 1], beziers[i], f);
60101
+ }
60102
+ }
60103
+ return beziers[beziers.length - 1];
60104
+ };
60105
+ return {
60106
+ animated: true,
60107
+ times,
60108
+ loop: r.loop,
60109
+ dAt: (t) => at(t).map((bz) => bezierToSvgPath(bz)).join(""),
60110
+ maxLength: (lengthOf) => Math.max(...kfs.map((kf) => lengthOf(kf.d))),
60111
+ moveBetween: (t0, t1) => maxPointMove(at(t0), at(t1))
60112
+ };
60113
+ }
60114
+ function maxPointMove(a, b) {
60115
+ var _a22, _b, _c, _d, _e, _f, _g, _h;
60116
+ let max = 0;
60117
+ const n = Math.min(a.length, b.length);
60118
+ for (let p = 0; p < n; p++) {
60119
+ const pa = a[p], pb = b[p];
60120
+ const count = Math.min(pa.v.length, pb.v.length);
60121
+ for (let k = 0; k < count; k++) {
60122
+ max = Math.max(
60123
+ max,
60124
+ dist(pa.v[k], pb.v[k]),
60125
+ dist((_b = (_a22 = pa.i) == null ? void 0 : _a22[k]) != null ? _b : pa.v[k], (_d = (_c = pb.i) == null ? void 0 : _c[k]) != null ? _d : pb.v[k]),
60126
+ dist((_f = (_e = pa.o) == null ? void 0 : _e[k]) != null ? _f : pa.v[k], (_h = (_g = pb.o) == null ? void 0 : _g[k]) != null ? _h : pb.v[k])
60127
+ );
60128
+ }
60129
+ }
60130
+ return max;
60131
+ }
60132
+ function dist(p, q) {
60133
+ var _a22, _b, _c, _d;
60134
+ return Math.hypot(((_a22 = q[0]) != null ? _a22 : 0) - ((_b = p[0]) != null ? _b : 0), ((_c = q[1]) != null ? _c : 0) - ((_d = p[1]) != null ? _d : 0));
60135
+ }
60070
60136
  function deepClonePxNode(value) {
60071
60137
  if (value === null || typeof value !== "object") return value;
60072
60138
  if (Array.isArray(value)) return value.map(deepClonePxNode);
@@ -60188,7 +60254,7 @@ ${codeFrame}` : message);
60188
60254
  }
60189
60255
  function extendedPathForBrowser(pathD, opts) {
60190
60256
  var _a22;
60191
- if (opts.pathOverflow === "clip") return { d: pathD, startShift: 0 };
60257
+ if (opts.pathOverflow === PxPathOverflow.clip) return { d: pathD, startShift: 0 };
60192
60258
  const sampler = createPathSampler(pathD);
60193
60259
  if (!sampler || sampler.closed || sampler.totalLength <= 0) return { d: pathD, startShift: 0 };
60194
60260
  const L = sampler.totalLength;
@@ -60215,20 +60281,30 @@ ${codeFrame}` : message);
60215
60281
  return { d, startShift: startExt };
60216
60282
  }
60217
60283
  function applyTextPathEffect(node, fx, ctx) {
60218
- var _a22;
60219
- if (!fx || typeof fx.pathData !== "string" || !fx.pathData) return node;
60284
+ var _a22, _b, _c, _d;
60285
+ if (!fx) return node;
60286
+ const read = readAnimatable(fx.pathData);
60287
+ if (read.kind === "absent") return node;
60288
+ const isAnimated = read.kind === "animated";
60289
+ const baseD = pathString(isAnimated ? (_b = read.base) != null ? _b : (_a22 = read.keyframes[0]) == null ? void 0 : _a22.value : read.value);
60290
+ if (!baseD) return node;
60220
60291
  const pathId = genId(ctx, "tpath");
60221
- const { d, startShift } = extendedPathForBrowser(fx.pathData, {
60222
- pathOverflow: fx.pathOverflow,
60292
+ const { d, startShift } = extendedPathForBrowser(baseD, {
60293
+ pathOverflow: isAnimated ? PxPathOverflow.clip : fx.pathOverflow,
60223
60294
  startOffset: fx.startOffset,
60224
60295
  textLength: fx.textLength,
60225
60296
  advance: estimateTextAdvance(node)
60226
60297
  });
60227
- ctx.defs.push({ type: "path", id: pathId, d });
60298
+ const pathDef = { type: "path", id: pathId, d };
60299
+ if (isAnimated) {
60300
+ writeAnimatableChannel(pathDef, "d", read);
60301
+ pathDef.d = (_c = pathString(pathDef.d)) != null ? _c : d;
60302
+ }
60303
+ ctx.defs.push(pathDef);
60228
60304
  const textPath = {
60229
60305
  type: "textPath",
60230
60306
  href: "#" + pathId,
60231
- children: (_a22 = node.children) != null ? _a22 : []
60307
+ children: (_d = node.children) != null ? _d : []
60232
60308
  };
60233
60309
  if (fx.lengthAdjust !== void 0) textPath.lengthAdjust = fx.lengthAdjust;
60234
60310
  if (fx.method !== void 0) textPath.method = fx.method;
@@ -60527,8 +60603,8 @@ ${codeFrame}` : message);
60527
60603
  walk(node, rootStyleOf(node));
60528
60604
  return { cells, width: adv };
60529
60605
  }
60530
- function alongAffine(sampler, dist, scale, widthEm, perp = 0) {
60531
- const { x, y, angle } = sampler.sampleAtDistance(dist);
60606
+ function alongAffine(sampler, dist22, scale, widthEm, perp = 0) {
60607
+ const { x, y, angle } = sampler.sampleAtDistance(dist22);
60532
60608
  const cos = Math.cos(angle), sin = Math.sin(angle), hw = widthEm / 2;
60533
60609
  return [scale * cos, scale * sin, -scale * sin, scale * cos, x - scale * cos * hw - perp * sin, y - scale * sin * hw + perp * cos];
60534
60610
  }
@@ -60540,9 +60616,12 @@ ${codeFrame}` : message);
60540
60616
  };
60541
60617
  }
60542
60618
  function materializeGlyphTextAlongPath(node, pathD, startOffset, opts, textLength, pathOverflow) {
60619
+ var _a22;
60543
60620
  const { glyphs, create = jsonElementFactory, warnings } = opts;
60544
- const sampler = pathD ? createPathSampler(pathD) : null;
60545
- if (!sampler) {
60621
+ const pathTrack = pathTrackOf(pathD);
60622
+ const samplerAt = pathTrack ? pathSamplers(pathTrack) : null;
60623
+ const sampler = (_a22 = samplerAt == null ? void 0 : samplerAt(0)) != null ? _a22 : null;
60624
+ if (!pathTrack || !samplerAt || !sampler) {
60546
60625
  warnings == null ? void 0 : warnings.push("textGlyphs: unparsable along-path geometry");
60547
60626
  return null;
60548
60627
  }
@@ -60554,11 +60633,11 @@ ${codeFrame}` : message);
60554
60633
  const tlTrack = numTrackOf(textLength);
60555
60634
  const kOf = (tl) => tl > 0 && width > 0 ? tl / width : 1;
60556
60635
  const isClip = pathOverflow === "clip" && !sampler.closed;
60557
- if (soTrack.animated || tlTrack.animated) {
60558
- const times = mergeTrackTimes(soTrack.times, tlTrack.times);
60636
+ if (soTrack.animated || tlTrack.animated || pathTrack.animated) {
60637
+ const times = mergeTrackTimes(mergeTrackTimes(pathTrack.times, soTrack.times), tlTrack.times);
60559
60638
  const distOf = (c, t) => alongOffset + soTrack.at(t) + kOf(tlTrack.at(t)) * c.midBase;
60560
- const loop = soTrack.animated ? soTrack.loop : tlTrack.loop;
60561
- return toGroup(node, buildAnimatedAlongPath(cells, sampler, distOf, times, loop, create, isClip, perp), create);
60639
+ const loop = pathTrack.animated && pathTrack.loop !== void 0 ? pathTrack.loop : soTrack.animated ? soTrack.loop : tlTrack.loop;
60640
+ return toGroup(node, buildAnimatedAlongPath(cells, samplerAt, pathTrack, distOf, times, loop, create, isClip, perp), create);
60562
60641
  }
60563
60642
  const k = kOf(tlTrack.at(0));
60564
60643
  const base = alongOffset + soTrack.at(0);
@@ -60613,15 +60692,39 @@ ${codeFrame}` : message);
60613
60692
  const f = __pow(10, n);
60614
60693
  return Math.round(v * f) / f;
60615
60694
  }
60616
- function buildAnimatedAlongPath(cells, sampler, distOf, times, loop, create, isClip, perp = 0) {
60617
- const step = Math.max(sampler.totalLength / ALONG_PATH_MAX_STEPS, 0.5);
60618
- const onPath = (dist) => dist >= 0 && dist <= sampler.totalLength;
60695
+ function pathSamplers(track) {
60696
+ if (!track.animated) {
60697
+ const one = createPathSampler(track.dAt(0));
60698
+ return () => one;
60699
+ }
60700
+ const byTime = /* @__PURE__ */ new Map();
60701
+ return (t) => {
60702
+ let s = byTime.get(t);
60703
+ if (s === void 0) {
60704
+ s = createPathSampler(track.dAt(t));
60705
+ byTime.set(t, s);
60706
+ }
60707
+ return s;
60708
+ };
60709
+ }
60710
+ function buildAnimatedAlongPath(cells, samplerAt, track, distOf, times, loop, create, isClip, perp = 0) {
60711
+ var _a22;
60712
+ const first = samplerAt((_a22 = times[0]) != null ? _a22 : 0);
60713
+ if (!first) return [];
60714
+ const at = (t) => {
60715
+ var _a3;
60716
+ return (_a3 = samplerAt(t)) != null ? _a3 : first;
60717
+ };
60718
+ const maxLength = track.animated ? Math.max(...track.times.map((t) => at(t).totalLength)) : first.totalLength;
60719
+ const step = Math.max(maxLength / ALONG_PATH_MAX_STEPS, 0.5);
60720
+ const onPath = (dist22, t) => dist22 >= 0 && dist22 <= at(t).totalLength;
60721
+ const moved = times.map((t, k) => k ? track.moveBetween(times[k - 1], t) : 0);
60619
60722
  const out = [];
60620
60723
  for (const c of cells) {
60621
60724
  const centered = [c.scale, 0, 0, c.scale, -c.scale * (c.widthEm / 2), 0];
60622
60725
  const d = transformPathData(c.glyphD, centered);
60623
- const sampleKf = (dist, time) => {
60624
- const { x, y, angle } = sampler.sampleAtDistance(dist);
60726
+ const sampleKf = (dist22, time) => {
60727
+ const { x, y, angle } = at(time).sampleAtDistance(dist22);
60625
60728
  const cos = Math.cos(angle), sin = Math.sin(angle);
60626
60729
  return {
60627
60730
  time,
@@ -60639,15 +60742,15 @@ ${codeFrame}` : message);
60639
60742
  };
60640
60743
  const kfs = [];
60641
60744
  const opKfs = [];
60642
- const pushKf = (dist, time) => {
60643
- kfs.push(sampleKf(dist, time));
60644
- if (isClip) opKfs.push({ time, value: onPath(dist) ? 1 : 0 });
60745
+ const pushKf = (dist22, time) => {
60746
+ kfs.push(sampleKf(dist22, time));
60747
+ if (isClip) opKfs.push({ time, value: onPath(dist22, time) ? 1 : 0 });
60645
60748
  };
60646
60749
  pushKf(distOf(c, times[0]), times[0]);
60647
60750
  for (let k = 1; k < times.length; k++) {
60648
60751
  const t0 = times[k - 1], t1 = times[k];
60649
60752
  const d0 = distOf(c, t0), d1 = distOf(c, t1);
60650
- const n = Math.min(ALONG_PATH_MAX_STEPS_PER_SEGMENT, Math.max(1, Math.ceil(Math.abs(d1 - d0) / step)));
60753
+ const n = Math.min(ALONG_PATH_MAX_STEPS_PER_SEGMENT, Math.max(1, Math.ceil(Math.abs(d1 - d0) / step), Math.ceil(moved[k] / step)));
60651
60754
  for (let s = 1; s <= n; s++) {
60652
60755
  const f = s / n;
60653
60756
  const t = t0 + f * (t1 - t0);
@@ -61200,11 +61303,6 @@ ${codeFrame}` : message);
61200
61303
  node.clipPath = "url(#" + clipId + ")";
61201
61304
  return node;
61202
61305
  }
61203
- function pathString(v) {
61204
- if (typeof v === "string") return v;
61205
- if (v && typeof v === "object" && typeof v.pathData === "string") return v.pathData;
61206
- return void 0;
61207
- }
61208
61306
  function applyMaskedByEffect(node, fx, transformBy, ctx) {
61209
61307
  if (!fx) return node;
61210
61308
  const sourceId = stripHash(fx.source);
@@ -62187,8 +62285,7 @@ ${codeFrame}` : message);
62187
62285
  let consumedByGlyphs = false;
62188
62286
  if (text == null ? void 0 : text.useGlyphs) {
62189
62287
  if (textPath) {
62190
- const pathD = typeof textPath.pathData === "string" ? textPath.pathData : void 0;
62191
- const glyphed = applyTextGlyphsAlongPath(n, ctx, pathD, textPath.startOffset, textPath.textLength, textPath.pathOverflow);
62288
+ const glyphed = applyTextGlyphsAlongPath(n, ctx, textPath.pathData, textPath.startOffset, textPath.textLength, textPath.pathOverflow);
62192
62289
  if (glyphed) {
62193
62290
  n = glyphed;
62194
62291
  consumedByGlyphs = true;
@@ -64406,7 +64503,7 @@ ${codeFrame}` : message);
64406
64503
  return proxy;
64407
64504
  }
64408
64505
 
64409
- // ../svg-animator-core/dist/chunk-J5V5JJDT.js
64506
+ // ../svg-animator-core/dist/chunk-NDANRP4J.js
64410
64507
  var __defProp3 = Object.defineProperty;
64411
64508
  var __defProps3 = Object.defineProperties;
64412
64509
  var __getOwnPropDescs3 = Object.getOwnPropertyDescriptors;
@@ -65550,7 +65647,7 @@ ${codeFrame}` : message);
65550
65647
  }));
65551
65648
  var PxStrokeGradientEffectSchema2 = PxFillGradientEffectSchema2;
65552
65649
  var PxTextPathEffectSchema2 = implementsInterface2()(px2.object({
65553
- pathData: px2.string(),
65650
+ pathData: PxAnimatableStringSchema2,
65554
65651
  // `extend` is what an omitted pathOverflow means (glyphs continue along the tangent); the
65555
65652
  // other three are SVG's own initial values for the native <textPath> attributes.
65556
65653
  pathOverflow: px2.enum([PxPathOverflow2.clip, PxPathOverflow2.extend], PxPathOverflow2.extend).optional(),
@@ -67509,11 +67606,11 @@ ${codeFrame}` : message);
67509
67606
  const totalLength = cum[segs.length];
67510
67607
  const start = segs[0].P0, end = segs[segs.length - 1].P3;
67511
67608
  const closed = Math.hypot(end[0] - start[0], end[1] - start[1]) < 1e-3;
67512
- const sampleOn = (dist) => {
67609
+ const sampleOn = (dist22) => {
67513
67610
  let k = 0;
67514
- while (k < segs.length - 1 && dist > cum[k + 1]) k++;
67611
+ while (k < segs.length - 1 && dist22 > cum[k + 1]) k++;
67515
67612
  const seg = segs[k];
67516
- const local = dist - cum[k];
67613
+ const local = dist22 - cum[k];
67517
67614
  const t = seg.len > 0 ? bezier2D_tForDistance2(seg.lut, local) : 0;
67518
67615
  const [x, y] = bezier2D_pointAt2(seg.P0, seg.P1, seg.P2, seg.P3, t);
67519
67616
  const [dx, dy] = bezier2D_derivativeAt2(seg.P0, seg.P1, seg.P2, seg.P3, t);
@@ -67522,17 +67619,17 @@ ${codeFrame}` : message);
67522
67619
  return {
67523
67620
  totalLength,
67524
67621
  closed,
67525
- sampleAtDistance(dist) {
67526
- if (closed && totalLength > 0 && (dist < 0 || dist > totalLength)) {
67527
- return sampleOn((dist % totalLength + totalLength) % totalLength);
67622
+ sampleAtDistance(dist22) {
67623
+ if (closed && totalLength > 0 && (dist22 < 0 || dist22 > totalLength)) {
67624
+ return sampleOn((dist22 % totalLength + totalLength) % totalLength);
67528
67625
  }
67529
- if (!closed && (dist < 0 || dist > totalLength)) {
67530
- const edge = dist < 0 ? 0 : totalLength;
67626
+ if (!closed && (dist22 < 0 || dist22 > totalLength)) {
67627
+ const edge = dist22 < 0 ? 0 : totalLength;
67531
67628
  const p = sampleOn(edge);
67532
- const over = dist - edge;
67629
+ const over = dist22 - edge;
67533
67630
  return { x: p.x + Math.cos(p.angle) * over, y: p.y + Math.sin(p.angle) * over, angle: p.angle };
67534
67631
  }
67535
- return sampleOn(clamp22(dist, 0, totalLength));
67632
+ return sampleOn(clamp22(dist22, 0, totalLength));
67536
67633
  }
67537
67634
  };
67538
67635
  }
@@ -67614,6 +67711,72 @@ ${codeFrame}` : message);
67614
67711
  if (kf.tangentIn !== void 0) out.tangentIn = kf.tangentIn;
67615
67712
  return out;
67616
67713
  }
67714
+ function pathString2(v) {
67715
+ if (typeof v === "string") return v;
67716
+ if (v && typeof v === "object" && typeof v.pathData === "string") return v.pathData;
67717
+ return void 0;
67718
+ }
67719
+ function pathTrackOf2(raw) {
67720
+ var _a22, _b;
67721
+ const r = readAnimatable2(raw);
67722
+ if (r.kind === "absent") return void 0;
67723
+ if (r.kind === "static" || r.keyframes.length < 2) {
67724
+ const d = pathString2(r.kind === "static" ? r.value : (_a22 = r.keyframes[0]) == null ? void 0 : _a22.value);
67725
+ if (!d) return void 0;
67726
+ return {
67727
+ animated: false,
67728
+ times: [],
67729
+ dAt: () => d,
67730
+ maxLength: (lengthOf) => lengthOf(d),
67731
+ moveBetween: () => 0
67732
+ };
67733
+ }
67734
+ const kfs = [...r.keyframes].map((kf) => ({ time: Number(kf.time) || 0, d: pathString2(kf.value) })).filter((kf) => !!kf.d).sort((a, b) => a.time - b.time);
67735
+ if (kfs.length < 2) return pathTrackOf2((_b = kfs[0]) == null ? void 0 : _b.d);
67736
+ const times = kfs.map((kf) => kf.time);
67737
+ const beziers = kfs.map((kf) => parseSvgPathToBezier2(kf.d));
67738
+ const at = (t) => {
67739
+ if (t <= times[0]) return beziers[0];
67740
+ for (let i = 1; i < times.length; i++) {
67741
+ if (t <= times[i]) {
67742
+ const span = times[i] - times[i - 1];
67743
+ const f = span > 0 ? (t - times[i - 1]) / span : 1;
67744
+ return interpolateBeziers2(beziers[i - 1], beziers[i], f);
67745
+ }
67746
+ }
67747
+ return beziers[beziers.length - 1];
67748
+ };
67749
+ return {
67750
+ animated: true,
67751
+ times,
67752
+ loop: r.loop,
67753
+ dAt: (t) => at(t).map((bz) => bezierToSvgPath2(bz)).join(""),
67754
+ maxLength: (lengthOf) => Math.max(...kfs.map((kf) => lengthOf(kf.d))),
67755
+ moveBetween: (t0, t1) => maxPointMove2(at(t0), at(t1))
67756
+ };
67757
+ }
67758
+ function maxPointMove2(a, b) {
67759
+ var _a22, _b, _c, _d, _e, _f, _g, _h;
67760
+ let max = 0;
67761
+ const n = Math.min(a.length, b.length);
67762
+ for (let p = 0; p < n; p++) {
67763
+ const pa = a[p], pb = b[p];
67764
+ const count = Math.min(pa.v.length, pb.v.length);
67765
+ for (let k = 0; k < count; k++) {
67766
+ max = Math.max(
67767
+ max,
67768
+ dist2(pa.v[k], pb.v[k]),
67769
+ dist2((_b = (_a22 = pa.i) == null ? void 0 : _a22[k]) != null ? _b : pa.v[k], (_d = (_c = pb.i) == null ? void 0 : _c[k]) != null ? _d : pb.v[k]),
67770
+ dist2((_f = (_e = pa.o) == null ? void 0 : _e[k]) != null ? _f : pa.v[k], (_h = (_g = pb.o) == null ? void 0 : _g[k]) != null ? _h : pb.v[k])
67771
+ );
67772
+ }
67773
+ }
67774
+ return max;
67775
+ }
67776
+ function dist2(p, q) {
67777
+ var _a22, _b, _c, _d;
67778
+ return Math.hypot(((_a22 = q[0]) != null ? _a22 : 0) - ((_b = p[0]) != null ? _b : 0), ((_c = q[1]) != null ? _c : 0) - ((_d = p[1]) != null ? _d : 0));
67779
+ }
67617
67780
  function deepClonePxNode2(value) {
67618
67781
  if (value === null || typeof value !== "object") return value;
67619
67782
  if (Array.isArray(value)) return value.map(deepClonePxNode2);
@@ -67735,7 +67898,7 @@ ${codeFrame}` : message);
67735
67898
  }
67736
67899
  function extendedPathForBrowser2(pathD, opts) {
67737
67900
  var _a22;
67738
- if (opts.pathOverflow === "clip") return { d: pathD, startShift: 0 };
67901
+ if (opts.pathOverflow === PxPathOverflow2.clip) return { d: pathD, startShift: 0 };
67739
67902
  const sampler = createPathSampler2(pathD);
67740
67903
  if (!sampler || sampler.closed || sampler.totalLength <= 0) return { d: pathD, startShift: 0 };
67741
67904
  const L = sampler.totalLength;
@@ -67762,20 +67925,30 @@ ${codeFrame}` : message);
67762
67925
  return { d, startShift: startExt };
67763
67926
  }
67764
67927
  function applyTextPathEffect2(node, fx, ctx) {
67765
- var _a22;
67766
- if (!fx || typeof fx.pathData !== "string" || !fx.pathData) return node;
67928
+ var _a22, _b, _c, _d;
67929
+ if (!fx) return node;
67930
+ const read = readAnimatable2(fx.pathData);
67931
+ if (read.kind === "absent") return node;
67932
+ const isAnimated = read.kind === "animated";
67933
+ const baseD = pathString2(isAnimated ? (_b = read.base) != null ? _b : (_a22 = read.keyframes[0]) == null ? void 0 : _a22.value : read.value);
67934
+ if (!baseD) return node;
67767
67935
  const pathId = genId2(ctx, "tpath");
67768
- const { d, startShift } = extendedPathForBrowser2(fx.pathData, {
67769
- pathOverflow: fx.pathOverflow,
67936
+ const { d, startShift } = extendedPathForBrowser2(baseD, {
67937
+ pathOverflow: isAnimated ? PxPathOverflow2.clip : fx.pathOverflow,
67770
67938
  startOffset: fx.startOffset,
67771
67939
  textLength: fx.textLength,
67772
67940
  advance: estimateTextAdvance2(node)
67773
67941
  });
67774
- ctx.defs.push({ type: "path", id: pathId, d });
67942
+ const pathDef = { type: "path", id: pathId, d };
67943
+ if (isAnimated) {
67944
+ writeAnimatableChannel2(pathDef, "d", read);
67945
+ pathDef.d = (_c = pathString2(pathDef.d)) != null ? _c : d;
67946
+ }
67947
+ ctx.defs.push(pathDef);
67775
67948
  const textPath = {
67776
67949
  type: "textPath",
67777
67950
  href: "#" + pathId,
67778
- children: (_a22 = node.children) != null ? _a22 : []
67951
+ children: (_d = node.children) != null ? _d : []
67779
67952
  };
67780
67953
  if (fx.lengthAdjust !== void 0) textPath.lengthAdjust = fx.lengthAdjust;
67781
67954
  if (fx.method !== void 0) textPath.method = fx.method;
@@ -68074,8 +68247,8 @@ ${codeFrame}` : message);
68074
68247
  walk(node, rootStyleOf2(node));
68075
68248
  return { cells, width: adv };
68076
68249
  }
68077
- function alongAffine2(sampler, dist, scale, widthEm, perp = 0) {
68078
- const { x, y, angle } = sampler.sampleAtDistance(dist);
68250
+ function alongAffine2(sampler, dist22, scale, widthEm, perp = 0) {
68251
+ const { x, y, angle } = sampler.sampleAtDistance(dist22);
68079
68252
  const cos = Math.cos(angle), sin = Math.sin(angle), hw = widthEm / 2;
68080
68253
  return [scale * cos, scale * sin, -scale * sin, scale * cos, x - scale * cos * hw - perp * sin, y - scale * sin * hw + perp * cos];
68081
68254
  }
@@ -68087,9 +68260,12 @@ ${codeFrame}` : message);
68087
68260
  };
68088
68261
  }
68089
68262
  function materializeGlyphTextAlongPath2(node, pathD, startOffset, opts, textLength, pathOverflow) {
68263
+ var _a22;
68090
68264
  const { glyphs, create = jsonElementFactory2, warnings } = opts;
68091
- const sampler = pathD ? createPathSampler2(pathD) : null;
68092
- if (!sampler) {
68265
+ const pathTrack = pathTrackOf2(pathD);
68266
+ const samplerAt = pathTrack ? pathSamplers2(pathTrack) : null;
68267
+ const sampler = (_a22 = samplerAt == null ? void 0 : samplerAt(0)) != null ? _a22 : null;
68268
+ if (!pathTrack || !samplerAt || !sampler) {
68093
68269
  warnings == null ? void 0 : warnings.push("textGlyphs: unparsable along-path geometry");
68094
68270
  return null;
68095
68271
  }
@@ -68101,11 +68277,11 @@ ${codeFrame}` : message);
68101
68277
  const tlTrack = numTrackOf2(textLength);
68102
68278
  const kOf = (tl) => tl > 0 && width > 0 ? tl / width : 1;
68103
68279
  const isClip = pathOverflow === "clip" && !sampler.closed;
68104
- if (soTrack.animated || tlTrack.animated) {
68105
- const times = mergeTrackTimes2(soTrack.times, tlTrack.times);
68280
+ if (soTrack.animated || tlTrack.animated || pathTrack.animated) {
68281
+ const times = mergeTrackTimes2(mergeTrackTimes2(pathTrack.times, soTrack.times), tlTrack.times);
68106
68282
  const distOf = (c, t) => alongOffset + soTrack.at(t) + kOf(tlTrack.at(t)) * c.midBase;
68107
- const loop = soTrack.animated ? soTrack.loop : tlTrack.loop;
68108
- return toGroup2(node, buildAnimatedAlongPath2(cells, sampler, distOf, times, loop, create, isClip, perp), create);
68283
+ const loop = pathTrack.animated && pathTrack.loop !== void 0 ? pathTrack.loop : soTrack.animated ? soTrack.loop : tlTrack.loop;
68284
+ return toGroup2(node, buildAnimatedAlongPath2(cells, samplerAt, pathTrack, distOf, times, loop, create, isClip, perp), create);
68109
68285
  }
68110
68286
  const k = kOf(tlTrack.at(0));
68111
68287
  const base = alongOffset + soTrack.at(0);
@@ -68160,15 +68336,39 @@ ${codeFrame}` : message);
68160
68336
  const f = __pow2(10, n);
68161
68337
  return Math.round(v * f) / f;
68162
68338
  }
68163
- function buildAnimatedAlongPath2(cells, sampler, distOf, times, loop, create, isClip, perp = 0) {
68164
- const step = Math.max(sampler.totalLength / ALONG_PATH_MAX_STEPS2, 0.5);
68165
- const onPath = (dist) => dist >= 0 && dist <= sampler.totalLength;
68339
+ function pathSamplers2(track) {
68340
+ if (!track.animated) {
68341
+ const one = createPathSampler2(track.dAt(0));
68342
+ return () => one;
68343
+ }
68344
+ const byTime = /* @__PURE__ */ new Map();
68345
+ return (t) => {
68346
+ let s = byTime.get(t);
68347
+ if (s === void 0) {
68348
+ s = createPathSampler2(track.dAt(t));
68349
+ byTime.set(t, s);
68350
+ }
68351
+ return s;
68352
+ };
68353
+ }
68354
+ function buildAnimatedAlongPath2(cells, samplerAt, track, distOf, times, loop, create, isClip, perp = 0) {
68355
+ var _a22;
68356
+ const first = samplerAt((_a22 = times[0]) != null ? _a22 : 0);
68357
+ if (!first) return [];
68358
+ const at = (t) => {
68359
+ var _a3;
68360
+ return (_a3 = samplerAt(t)) != null ? _a3 : first;
68361
+ };
68362
+ const maxLength = track.animated ? Math.max(...track.times.map((t) => at(t).totalLength)) : first.totalLength;
68363
+ const step = Math.max(maxLength / ALONG_PATH_MAX_STEPS2, 0.5);
68364
+ const onPath = (dist22, t) => dist22 >= 0 && dist22 <= at(t).totalLength;
68365
+ const moved = times.map((t, k) => k ? track.moveBetween(times[k - 1], t) : 0);
68166
68366
  const out = [];
68167
68367
  for (const c of cells) {
68168
68368
  const centered = [c.scale, 0, 0, c.scale, -c.scale * (c.widthEm / 2), 0];
68169
68369
  const d = transformPathData2(c.glyphD, centered);
68170
- const sampleKf = (dist, time) => {
68171
- const { x, y, angle } = sampler.sampleAtDistance(dist);
68370
+ const sampleKf = (dist22, time) => {
68371
+ const { x, y, angle } = at(time).sampleAtDistance(dist22);
68172
68372
  const cos = Math.cos(angle), sin = Math.sin(angle);
68173
68373
  return {
68174
68374
  time,
@@ -68186,15 +68386,15 @@ ${codeFrame}` : message);
68186
68386
  };
68187
68387
  const kfs = [];
68188
68388
  const opKfs = [];
68189
- const pushKf = (dist, time) => {
68190
- kfs.push(sampleKf(dist, time));
68191
- if (isClip) opKfs.push({ time, value: onPath(dist) ? 1 : 0 });
68389
+ const pushKf = (dist22, time) => {
68390
+ kfs.push(sampleKf(dist22, time));
68391
+ if (isClip) opKfs.push({ time, value: onPath(dist22, time) ? 1 : 0 });
68192
68392
  };
68193
68393
  pushKf(distOf(c, times[0]), times[0]);
68194
68394
  for (let k = 1; k < times.length; k++) {
68195
68395
  const t0 = times[k - 1], t1 = times[k];
68196
68396
  const d0 = distOf(c, t0), d1 = distOf(c, t1);
68197
- const n = Math.min(ALONG_PATH_MAX_STEPS_PER_SEGMENT2, Math.max(1, Math.ceil(Math.abs(d1 - d0) / step)));
68397
+ const n = Math.min(ALONG_PATH_MAX_STEPS_PER_SEGMENT2, Math.max(1, Math.ceil(Math.abs(d1 - d0) / step), Math.ceil(moved[k] / step)));
68198
68398
  for (let s = 1; s <= n; s++) {
68199
68399
  const f = s / n;
68200
68400
  const t = t0 + f * (t1 - t0);
@@ -68747,11 +68947,6 @@ ${codeFrame}` : message);
68747
68947
  node.clipPath = "url(#" + clipId + ")";
68748
68948
  return node;
68749
68949
  }
68750
- function pathString2(v) {
68751
- if (typeof v === "string") return v;
68752
- if (v && typeof v === "object" && typeof v.pathData === "string") return v.pathData;
68753
- return void 0;
68754
- }
68755
68950
  function applyMaskedByEffect2(node, fx, transformBy, ctx) {
68756
68951
  if (!fx) return node;
68757
68952
  const sourceId = stripHash3(fx.source);
@@ -69734,8 +69929,7 @@ ${codeFrame}` : message);
69734
69929
  let consumedByGlyphs = false;
69735
69930
  if (text == null ? void 0 : text.useGlyphs) {
69736
69931
  if (textPath) {
69737
- const pathD = typeof textPath.pathData === "string" ? textPath.pathData : void 0;
69738
- const glyphed = applyTextGlyphsAlongPath2(n, ctx, pathD, textPath.startOffset, textPath.textLength, textPath.pathOverflow);
69932
+ const glyphed = applyTextGlyphsAlongPath2(n, ctx, textPath.pathData, textPath.startOffset, textPath.textLength, textPath.pathOverflow);
69739
69933
  if (glyphed) {
69740
69934
  n = glyphed;
69741
69935
  consumedByGlyphs = true;