motionary 10.1.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +61 -0
- package/CHANGELOG.md +14 -0
- package/README.md +37 -0
- package/dist/chunks/{keyframes-CyH_abhI.js → keyframes-W-474DMc.js} +2 -2
- package/dist/chunks/{keyframes-CyH_abhI.js.map → keyframes-W-474DMc.js.map} +1 -1
- package/dist/chunks/{keyframes-cUdsXSXQ.cjs → keyframes-ZheOkpt0.cjs} +2 -2
- package/dist/chunks/{keyframes-cUdsXSXQ.cjs.map → keyframes-ZheOkpt0.cjs.map} +1 -1
- package/dist/chunks/{registry-jF8VIA_9.js → registry-BIEjKngP.js} +2 -2
- package/dist/chunks/{registry-jF8VIA_9.js.map → registry-BIEjKngP.js.map} +1 -1
- package/dist/chunks/{registry-C0xLNq3-.cjs → registry-eJgpFAzI.cjs} +2 -2
- package/dist/chunks/{registry-C0xLNq3-.cjs.map → registry-eJgpFAzI.cjs.map} +1 -1
- package/dist/chunks/ticker-CM_56oVy.js +70 -0
- package/dist/chunks/ticker-CM_56oVy.js.map +1 -0
- package/dist/chunks/ticker-D4o6enH0.cjs +72 -0
- package/dist/chunks/ticker-D4o6enH0.cjs.map +1 -0
- package/dist/chunks/{tween-JEthWrjo.cjs → tween-CBuWYpI-.cjs} +5 -72
- package/dist/chunks/tween-CBuWYpI-.cjs.map +1 -0
- package/dist/chunks/{tween-DDObu9iA.js → tween-CqX1JBuj.js} +5 -71
- package/dist/chunks/tween-CqX1JBuj.js.map +1 -0
- package/dist/components/core.cjs +106 -0
- package/dist/components/core.cjs.map +1 -1
- package/dist/components/core.d.cts +44 -2
- package/dist/components/core.d.ts +44 -2
- package/dist/components/core.js +105 -1
- package/dist/components/core.js.map +1 -1
- package/dist/components/widgets.cjs +401 -198
- package/dist/components/widgets.cjs.map +1 -1
- package/dist/components/widgets.d.cts +146 -2
- package/dist/components/widgets.d.ts +146 -2
- package/dist/components/widgets.js +399 -199
- package/dist/components/widgets.js.map +1 -1
- package/dist/llms-full.txt +98 -1
- package/dist/llms.txt +6 -2
- package/dist/manifest.json +259 -1
- package/dist/runtime/format-css.cjs +4 -3
- package/dist/runtime/format-css.cjs.map +1 -1
- package/dist/runtime/format-css.js +4 -3
- package/dist/runtime/format-css.js.map +1 -1
- package/dist/runtime/format-motion.cjs +4 -3
- package/dist/runtime/format-motion.cjs.map +1 -1
- package/dist/runtime/format-motion.js +4 -3
- package/dist/runtime/format-motion.js.map +1 -1
- package/dist/runtime/format-svg.cjs +457 -0
- package/dist/runtime/format-svg.cjs.map +1 -0
- package/dist/runtime/format-svg.d.cts +214 -0
- package/dist/runtime/format-svg.d.ts +214 -0
- package/dist/runtime/format-svg.iife.js +2 -0
- package/dist/runtime/format-svg.iife.js.map +1 -0
- package/dist/runtime/format-svg.js +446 -0
- package/dist/runtime/format-svg.js.map +1 -0
- package/dist/runtime/scroll.cjs +301 -0
- package/dist/runtime/scroll.cjs.map +1 -0
- package/dist/runtime/scroll.d.cts +236 -0
- package/dist/runtime/scroll.d.ts +236 -0
- package/dist/runtime/scroll.iife.js +2 -0
- package/dist/runtime/scroll.iife.js.map +1 -0
- package/dist/runtime/scroll.js +292 -0
- package/dist/runtime/scroll.js.map +1 -0
- package/dist/runtime.cjs +5 -4
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.iife.js +1 -1
- package/dist/runtime.iife.js.map +1 -1
- package/dist/runtime.js +5 -4
- package/dist/runtime.js.map +1 -1
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/docs/ROADMAP.md +1 -1
- package/docs/ai-prompt-guide.md +54 -0
- package/docs/components/README.md +253 -0
- package/docs/components/usa-accordion.md +38 -0
- package/docs/components/usa-acrylic.md +38 -0
- package/docs/components/usa-add-to-cart.md +40 -0
- package/docs/components/usa-ambient.md +32 -0
- package/docs/components/usa-anim-icon.md +34 -0
- package/docs/components/usa-audio.md +38 -0
- package/docs/components/usa-aurora.md +36 -0
- package/docs/components/usa-auto-animate.md +44 -0
- package/docs/components/usa-auto-skeleton.md +38 -0
- package/docs/components/usa-avatar-stack.md +38 -0
- package/docs/components/usa-back-to-top.md +32 -0
- package/docs/components/usa-badge-wall.md +39 -0
- package/docs/components/usa-badge.md +36 -0
- package/docs/components/usa-bar-chart.md +33 -0
- package/docs/components/usa-bg-generator.md +32 -0
- package/docs/components/usa-blobs.md +32 -0
- package/docs/components/usa-bottom-sheet.md +32 -0
- package/docs/components/usa-button.md +78 -0
- package/docs/components/usa-card-stack.md +40 -0
- package/docs/components/usa-card.md +94 -0
- package/docs/components/usa-carousel-3d.md +40 -0
- package/docs/components/usa-carousel.md +40 -0
- package/docs/components/usa-cart-drawer.md +33 -0
- package/docs/components/usa-chapter-nav.md +40 -0
- package/docs/components/usa-chat-composer.md +33 -0
- package/docs/components/usa-check.md +32 -0
- package/docs/components/usa-checkbox.md +32 -0
- package/docs/components/usa-click.md +36 -0
- package/docs/components/usa-clock-control.md +37 -0
- package/docs/components/usa-code-export.md +36 -0
- package/docs/components/usa-color-picker.md +32 -0
- package/docs/components/usa-command-palette.md +39 -0
- package/docs/components/usa-compare.md +38 -0
- package/docs/components/usa-countdown.md +32 -0
- package/docs/components/usa-counter.md +32 -0
- package/docs/components/usa-cube-gallery.md +40 -0
- package/docs/components/usa-cube.md +36 -0
- package/docs/components/usa-cursor.md +32 -0
- package/docs/components/usa-date-picker.md +32 -0
- package/docs/components/usa-depth.md +44 -0
- package/docs/components/usa-dialog.md +40 -0
- package/docs/components/usa-disclosure.md +38 -0
- package/docs/components/usa-distort.md +36 -0
- package/docs/components/usa-dock.md +40 -0
- package/docs/components/usa-dot-network.md +32 -0
- package/docs/components/usa-double-tap.md +36 -0
- package/docs/components/usa-draggable.md +38 -0
- package/docs/components/usa-draw.md +36 -0
- package/docs/components/usa-drawer.md +34 -0
- package/docs/components/usa-equalizer.md +33 -0
- package/docs/components/usa-fab.md +40 -0
- package/docs/components/usa-festival-banner.md +32 -0
- package/docs/components/usa-field.md +34 -0
- package/docs/components/usa-file-drop.md +35 -0
- package/docs/components/usa-fullpage.md +38 -0
- package/docs/components/usa-fx.md +851 -0
- package/docs/components/usa-gauge.md +32 -0
- package/docs/components/usa-gen-art.md +32 -0
- package/docs/components/usa-gesture-fx.md +36 -0
- package/docs/components/usa-gesture-sticker.md +36 -0
- package/docs/components/usa-glitch.md +32 -0
- package/docs/components/usa-globe.md +33 -0
- package/docs/components/usa-gradient-text.md +32 -0
- package/docs/components/usa-grain.md +36 -0
- package/docs/components/usa-grid-glow.md +36 -0
- package/docs/components/usa-gyro-card.md +38 -0
- package/docs/components/usa-handwriting.md +32 -0
- package/docs/components/usa-hero-video.md +38 -0
- package/docs/components/usa-hold.md +32 -0
- package/docs/components/usa-hud-panel.md +38 -0
- package/docs/components/usa-hydrate.md +42 -0
- package/docs/components/usa-icon-morph.md +34 -0
- package/docs/components/usa-install-button.md +32 -0
- package/docs/components/usa-kanban.md +46 -0
- package/docs/components/usa-keyframe-editor.md +37 -0
- package/docs/components/usa-kpi.md +32 -0
- package/docs/components/usa-leaderboard.md +41 -0
- package/docs/components/usa-like.md +32 -0
- package/docs/components/usa-liquid-nav.md +36 -0
- package/docs/components/usa-liquid.md +36 -0
- package/docs/components/usa-loading-bar.md +35 -0
- package/docs/components/usa-location-card.md +34 -0
- package/docs/components/usa-lottie-icon.md +34 -0
- package/docs/components/usa-lottie.md +32 -0
- package/docs/components/usa-lyrics.md +38 -0
- package/docs/components/usa-magnetic.md +32 -0
- package/docs/components/usa-marquee.md +38 -0
- package/docs/components/usa-mask-reveal.md +36 -0
- package/docs/components/usa-masonry-flow.md +42 -0
- package/docs/components/usa-masonry.md +38 -0
- package/docs/components/usa-menu-toggle.md +34 -0
- package/docs/components/usa-menu.md +44 -0
- package/docs/components/usa-message-list.md +39 -0
- package/docs/components/usa-milestones.md +40 -0
- package/docs/components/usa-modal.md +42 -0
- package/docs/components/usa-morph.md +34 -0
- package/docs/components/usa-motion-inspector.md +32 -0
- package/docs/components/usa-motion-prefs.md +32 -0
- package/docs/components/usa-motion-spec.md +32 -0
- package/docs/components/usa-motion-switch.md +34 -0
- package/docs/components/usa-motion-theme.md +40 -0
- package/docs/components/usa-motion.md +42 -0
- package/docs/components/usa-music-player.md +36 -0
- package/docs/components/usa-native-preview.md +36 -0
- package/docs/components/usa-nav-morph.md +40 -0
- package/docs/components/usa-navbar.md +36 -0
- package/docs/components/usa-notification-bell.md +37 -0
- package/docs/components/usa-odometer.md +34 -0
- package/docs/components/usa-organic-card.md +36 -0
- package/docs/components/usa-otp.md +33 -0
- package/docs/components/usa-overscroll.md +36 -0
- package/docs/components/usa-pack.md +111 -0
- package/docs/components/usa-pagination.md +32 -0
- package/docs/components/usa-panorama.md +32 -0
- package/docs/components/usa-particles.md +32 -0
- package/docs/components/usa-pause-all.md +32 -0
- package/docs/components/usa-perf-monitor.md +32 -0
- package/docs/components/usa-pinch-zoom.md +36 -0
- package/docs/components/usa-player.md +38 -0
- package/docs/components/usa-plugin-card.md +61 -0
- package/docs/components/usa-plugin-store.md +36 -0
- package/docs/components/usa-popover.md +38 -0
- package/docs/components/usa-post-fx.md +36 -0
- package/docs/components/usa-presence.md +36 -0
- package/docs/components/usa-press.md +32 -0
- package/docs/components/usa-prize-wheel.md +32 -0
- package/docs/components/usa-product-gallery.md +40 -0
- package/docs/components/usa-progress-ring.md +38 -0
- package/docs/components/usa-progress.md +34 -0
- package/docs/components/usa-prop-panel.md +34 -0
- package/docs/components/usa-pull-cord.md +32 -0
- package/docs/components/usa-pull-refresh.md +37 -0
- package/docs/components/usa-radar.md +32 -0
- package/docs/components/usa-reactions.md +32 -0
- package/docs/components/usa-red-envelope.md +32 -0
- package/docs/components/usa-retro-button.md +34 -0
- package/docs/components/usa-reveal.md +36 -0
- package/docs/components/usa-ripple.md +32 -0
- package/docs/components/usa-scene.md +38 -0
- package/docs/components/usa-scramble.md +32 -0
- package/docs/components/usa-scroll-highlight.md +34 -0
- package/docs/components/usa-scroll-progress.md +36 -0
- package/docs/components/usa-scroll-scene.md +66 -0
- package/docs/components/usa-scrolly.md +40 -0
- package/docs/components/usa-segmented.md +40 -0
- package/docs/components/usa-shader.md +74 -0
- package/docs/components/usa-sheet.md +42 -0
- package/docs/components/usa-shimmer-text.md +32 -0
- package/docs/components/usa-shortcut.md +34 -0
- package/docs/components/usa-skeleton-reveal.md +42 -0
- package/docs/components/usa-skeleton.md +36 -0
- package/docs/components/usa-sketch-chart.md +32 -0
- package/docs/components/usa-slider.md +32 -0
- package/docs/components/usa-sparkline.md +32 -0
- package/docs/components/usa-spatial-card.md +40 -0
- package/docs/components/usa-spinner.md +34 -0
- package/docs/components/usa-splash.md +36 -0
- package/docs/components/usa-split-text.md +32 -0
- package/docs/components/usa-spotlight.md +40 -0
- package/docs/components/usa-spring.md +42 -0
- package/docs/components/usa-stagger.md +40 -0
- package/docs/components/usa-star-rating.md +34 -0
- package/docs/components/usa-stepper.md +42 -0
- package/docs/components/usa-sticky-stack.md +40 -0
- package/docs/components/usa-sticky-wall.md +40 -0
- package/docs/components/usa-stories.md +38 -0
- package/docs/components/usa-story.md +80 -0
- package/docs/components/usa-suggestion-chips.md +32 -0
- package/docs/components/usa-swipe-deck.md +40 -0
- package/docs/components/usa-swipeable.md +36 -0
- package/docs/components/usa-switch.md +32 -0
- package/docs/components/usa-tab-bar.md +46 -0
- package/docs/components/usa-tabs.md +40 -0
- package/docs/components/usa-terminal.md +38 -0
- package/docs/components/usa-text-rotate.md +32 -0
- package/docs/components/usa-theme-surface.md +36 -0
- package/docs/components/usa-theme-switcher.md +32 -0
- package/docs/components/usa-tilt.md +36 -0
- package/docs/components/usa-timeline.md +40 -0
- package/docs/components/usa-tip.md +44 -0
- package/docs/components/usa-toast-stack.md +36 -0
- package/docs/components/usa-toaster.md +36 -0
- package/docs/components/usa-typewriter.md +32 -0
- package/docs/components/usa-upload-progress.md +33 -0
- package/docs/components/usa-video-card.md +40 -0
- package/docs/components/usa-view-switch.md +38 -0
- package/docs/components/usa-voice-button.md +33 -0
- package/docs/components/usa-volume-knob.md +32 -0
- package/docs/components/usa-water-ripple.md +36 -0
- package/docs/components/usa-wave-text.md +32 -0
- package/docs/components/usa-weather-card.md +32 -0
- package/docs/components/usa-worker-canvas.md +32 -0
- package/docs/components/usa-xp-bar.md +33 -0
- package/docs/components.md +50 -0
- package/docs/runtime/format-svg.md +62 -0
- package/docs/runtime/scroll.md +61 -0
- package/package.json +25 -3
- package/dist/chunks/tween-DDObu9iA.js.map +0 -1
- package/dist/chunks/tween-JEthWrjo.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-svg.iife.js","sources":["../../src/runtime/format-svg.ts","../../src/runtime/iife/format-svg.ts"],"sourcesContent":["/**\n * `motionary/runtime/format-svg` (10.2) — SVG animation with the runtime\n * (original implementation):\n *\n * - **Path geometry** without the DOM (SSR / workers): `parsePath(d)` (all\n * commands, relative + absolute, arcs), `flattenPath(d)`, `pathLength(d)`,\n * `pointAtLength(d, len)`, `samplePath(d, n)`.\n * - **Path morphing**: `morphPath(from, to, { points })` → `(p) => d` — both\n * paths are resampled to the same number of points (any command mix, any\n * point counts), aligned to the closest start point, then interpolated.\n * - **SMIL playback**: `playSmil(svg)` reads `<animate>`, `<set>`,\n * `<animateTransform>` (translate / scale / rotate / skewX / skewY) and\n * `<animateMotion>` (`path` or `<mpath>`, `rotate=\"auto\"`) — `from` / `to` /\n * `by` / `values`, `keyTimes`, `keySplines` (`calcMode=\"spline\"`),\n * `calcMode=\"discrete\"`, `dur`, numeric `begin` offsets, `repeatCount`\n * (incl. `indefinite`), `fill=\"freeze\"` — and replays them as a runtime\n * timeline (seek, scrub, reverse, timeScale) instead of the browser's SMIL clock.\n * - CSS-animated SVG: use `motionary/runtime/format-css` (`@keyframes` in the SVG's `<style>`).\n *\n * Not supported (documented): event / syncbase `begin` values (`click`,\n * `a.end`), `accumulate` / `additive=\"sum\"`, `<animateColor>` (deprecated).\n */\nimport { RUNTIME_VERSION, type RuntimeModule } from './registry';\nimport { Playable, Timeline, parseValue } from './tween';\nimport { cubicBezier, type Ease } from './ease';\n\ntype Pt = [number, number];\nexport type PathCommand = [string, ...number[]];\n\nconst ARGS: Record<string, number> = { M: 2, L: 2, H: 1, V: 1, C: 6, S: 4, Q: 4, T: 2, A: 7, Z: 0 };\n\n/** Parse path data into absolute commands (M L C Q A Z; H/V/S/T expanded). */\nexport function parsePath(d: string): PathCommand[] {\n const toks = d.match(/[a-zA-Z]|[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?/g) || [];\n const out: PathCommand[] = [];\n let i = 0, cmd = '', x = 0, y = 0, sx = 0, sy = 0, lc: Pt | null = null, lq: Pt | null = null;\n const num = () => parseFloat(toks[i++]);\n while (i < toks.length) {\n if (/[a-zA-Z]/.test(toks[i])) cmd = toks[i++];\n else if (!cmd) throw new Error('[motionary] format-svg: path must start with a command');\n const C = cmd.toUpperCase(), rel = cmd !== C;\n const n = ARGS[C];\n if (n === undefined) throw new Error(`[motionary] format-svg: unknown path command \"${cmd}\"`);\n if (C === 'Z') {\n out.push(['Z']);\n x = sx; y = sy; lc = lq = null;\n continue;\n }\n const a: number[] = [];\n for (let k = 0; k < n; k++) a.push(num());\n if (a.some((v) => Number.isNaN(v))) break;\n const ox = rel ? x : 0, oy = rel ? y : 0;\n switch (C) {\n case 'M': x = a[0] + ox; y = a[1] + oy; sx = x; sy = y; out.push(['M', x, y]); cmd = rel ? 'l' : 'L'; lc = lq = null; break;\n case 'L': x = a[0] + ox; y = a[1] + oy; out.push(['L', x, y]); lc = lq = null; break;\n case 'H': x = a[0] + ox; out.push(['L', x, y]); lc = lq = null; break;\n case 'V': y = a[0] + (rel ? y : 0); out.push(['L', x, y]); lc = lq = null; break;\n case 'C': { const c = [a[0] + ox, a[1] + oy, a[2] + ox, a[3] + oy, a[4] + ox, a[5] + oy]; out.push(['C', ...c]); lc = [c[2], c[3]]; x = c[4]; y = c[5]; lq = null; break; }\n case 'S': { const c1: Pt = lc ? [2 * x - lc[0], 2 * y - lc[1]] : [x, y]; const c = [a[0] + ox, a[1] + oy, a[2] + ox, a[3] + oy]; out.push(['C', c1[0], c1[1], ...c]); lc = [c[0], c[1]]; x = c[2]; y = c[3]; lq = null; break; }\n case 'Q': { const c = [a[0] + ox, a[1] + oy, a[2] + ox, a[3] + oy]; out.push(['Q', ...c]); lq = [c[0], c[1]]; x = c[2]; y = c[3]; lc = null; break; }\n case 'T': { const c1: Pt = lq ? [2 * x - lq[0], 2 * y - lq[1]] : [x, y]; x = a[0] + ox; y = a[1] + oy; out.push(['Q', c1[0], c1[1], x, y]); lq = c1; lc = null; break; }\n case 'A': { x = a[5] + ox; y = a[6] + oy; out.push(['A', a[0], a[1], a[2], a[3], a[4], x, y]); lc = lq = null; break; }\n }\n }\n return out;\n}\n\n/** Endpoint-parameterised arc → points (SVG spec F.6.5 conversion). */\nfunction arcPoints(x1: number, y1: number, rx: number, ry: number, phiDeg: number, large: number, sweep: number, x2: number, y2: number, seg: number): Pt[] {\n if (!rx || !ry) return [[x2, y2]];\n rx = Math.abs(rx); ry = Math.abs(ry);\n const phi = (phiDeg * Math.PI) / 180, cos = Math.cos(phi), sin = Math.sin(phi);\n const dx = (x1 - x2) / 2, dy = (y1 - y2) / 2;\n const xp = cos * dx + sin * dy, yp = -sin * dx + cos * dy;\n const lam = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);\n if (lam > 1) { rx *= Math.sqrt(lam); ry *= Math.sqrt(lam); }\n const num = rx * rx * ry * ry - rx * rx * yp * yp - ry * ry * xp * xp;\n const den = rx * rx * yp * yp + ry * ry * xp * xp;\n let co = Math.sqrt(Math.max(0, num / den));\n if (large === sweep) co = -co;\n const cxp = (co * rx * yp) / ry, cyp = (-co * ry * xp) / rx;\n const cx = cos * cxp - sin * cyp + (x1 + x2) / 2, cy = sin * cxp + cos * cyp + (y1 + y2) / 2;\n const ang = (ux: number, uy: number, vx: number, vy: number) => Math.atan2(ux * vy - uy * vx, ux * vx + uy * vy);\n const t1 = ang(1, 0, (xp - cxp) / rx, (yp - cyp) / ry);\n let dt = ang((xp - cxp) / rx, (yp - cyp) / ry, (-xp - cxp) / rx, (-yp - cyp) / ry);\n if (!sweep && dt > 0) dt -= 2 * Math.PI;\n if (sweep && dt < 0) dt += 2 * Math.PI;\n const n = Math.max(2, Math.ceil((Math.abs(dt) / (Math.PI / 2)) * seg));\n const pts: Pt[] = [];\n for (let k = 1; k <= n; k++) {\n const t = t1 + (dt * k) / n;\n pts.push([cx + rx * Math.cos(t) * cos - ry * Math.sin(t) * sin, cy + rx * Math.cos(t) * sin + ry * Math.sin(t) * cos]);\n }\n return pts;\n}\n\n/** Flatten a path into polylines (one per subpath); `segments` points per curve. */\nexport function flattenPath(d: string | PathCommand[], segments = 16): Pt[][] {\n const cmds = typeof d === 'string' ? parsePath(d) : d;\n const subs: Pt[][] = [];\n let cur: Pt[] = [], x = 0, y = 0;\n for (const c of cmds) {\n const [k, ...a] = c;\n if (k === 'M') { if (cur.length) subs.push(cur); cur = [[a[0], a[1]]]; x = a[0]; y = a[1]; continue; }\n if (!cur.length) cur = [[x, y]];\n if (k === 'L') cur.push([a[0], a[1]]);\n else if (k === 'C') for (let i = 1; i <= segments; i++) { const t = i / segments, u = 1 - t; cur.push([u * u * u * x + 3 * u * u * t * a[0] + 3 * u * t * t * a[2] + t * t * t * a[4], u * u * u * y + 3 * u * u * t * a[1] + 3 * u * t * t * a[3] + t * t * t * a[5]]); }\n else if (k === 'Q') for (let i = 1; i <= segments; i++) { const t = i / segments, u = 1 - t; cur.push([u * u * x + 2 * u * t * a[0] + t * t * a[2], u * u * y + 2 * u * t * a[1] + t * t * a[3]]); }\n else if (k === 'A') cur.push(...arcPoints(x, y, a[0], a[1], a[2], a[3], a[4], a[5], a[6], segments / 4));\n else if (k === 'Z') { cur.push([cur[0][0], cur[0][1]]); subs.push(cur); x = cur[0][0]; y = cur[0][1]; cur = []; continue; }\n const last = cur[cur.length - 1];\n x = last[0]; y = last[1];\n }\n if (cur.length) subs.push(cur);\n return subs;\n}\n\nconst dist = (a: Pt, b: Pt) => Math.hypot(b[0] - a[0], b[1] - a[1]);\n\n/** Total length of a path. */\nexport function pathLength(d: string | PathCommand[]): number {\n return flattenPath(d, 48).reduce((s, pl) => s + pl.slice(1).reduce((t, p, i) => t + dist(pl[i], p), 0), 0);\n}\n\n/** Point (and tangent angle, degrees) at a distance along the path. */\nexport function pointAtLength(d: string | PathCommand[], len: number): { x: number; y: number; angle: number } {\n const pl = flattenPath(d, 48).flat();\n let acc = 0;\n for (let i = 1; i < pl.length; i++) {\n const s = dist(pl[i - 1], pl[i]);\n if (acc + s >= len || i === pl.length - 1) {\n const t = s ? Math.min(1, Math.max(0, (len - acc) / s)) : 0;\n return { x: pl[i - 1][0] + (pl[i][0] - pl[i - 1][0]) * t, y: pl[i - 1][1] + (pl[i][1] - pl[i - 1][1]) * t, angle: (Math.atan2(pl[i][1] - pl[i - 1][1], pl[i][0] - pl[i - 1][0]) * 180) / Math.PI };\n }\n acc += s;\n }\n return { x: pl[0]?.[0] ?? 0, y: pl[0]?.[1] ?? 0, angle: 0 };\n}\n\n/** `n` points evenly spaced along the path (all subpaths joined). */\nexport function samplePath(d: string | PathCommand[], n = 64): Pt[] {\n const total = pathLength(d);\n return Array.from({ length: n }, (_, i) => {\n const p = pointAtLength(d, (total * i) / (n - 1 || 1));\n return [p.x, p.y] as Pt;\n });\n}\n\nconst r3 = (v: number) => Math.round(v * 1000) / 1000;\nconst closed = (d: string) => /z\\s*$/i.test(d.trim());\n\n/**\n * Morph between two paths of any shape: `const f = morphPath(a, b); el.setAttribute('d', f(0.5))`.\n * Closed paths are rotated so their start points line up (less twisting).\n */\nexport function morphPath(from: string, to: string, o: { points?: number } = {}): (p: number) => string {\n const n = o.points ?? 64;\n const A = samplePath(from, n);\n let B = samplePath(to, n);\n const isClosed = closed(from) && closed(to);\n if (isClosed) {\n let best = 0, bestD = Infinity;\n for (let s = 0; s < n; s++) {\n let sum = 0;\n for (let i = 0; i < n; i += 4) sum += dist(A[i], B[(i + s) % n]);\n if (sum < bestD) { bestD = sum; best = s; }\n }\n B = B.map((_, i) => B[(i + best) % n]);\n }\n return (p) => {\n if (p <= 0) return from;\n if (p >= 1) return to;\n return 'M' + A.map((a, i) => `${r3(a[0] + (B[i][0] - a[0]) * p)} ${r3(a[1] + (B[i][1] - a[1]) * p)}`).join('L') + (isClosed ? 'Z' : '');\n };\n}\n\n/* ------------------------------------------------------------------ SMIL */\n\n/** '2s', '150ms', '1.5', 'indefinite' → ms (NaN for indefinite / unsupported). */\nexport function smilTime(v: string | null | undefined): number {\n if (!v) return NaN;\n const s = v.trim();\n const m = /^(-?[\\d.]+)(ms|s|min|h)?$/.exec(s);\n if (!m) {\n const c = /^(?:(\\d+):)?(\\d+):(\\d+(?:\\.\\d+)?)$/.exec(s);\n return c ? ((+(c[1] || 0) * 60 + +c[2]) * 60 + +c[3]) * 1000 : NaN;\n }\n const n = parseFloat(m[1]);\n return m[2] === 'ms' ? n : m[2] === 'min' ? n * 60000 : m[2] === 'h' ? n * 3600000 : n * 1000;\n}\n\ntype Interp = (a: string, b: string, p: number) => string;\nconst numList = (s: string) => s.trim().split(/[\\s,]+/).filter(Boolean).map(Number);\nconst lerpNumbers: Interp = (a, b, p) => {\n const x = numList(a), y = numList(b);\n return x.map((v, i) => r3(v + ((y[i] ?? v) - v) * p)).join(' ');\n};\nconst lerpAny: Interp = (a, b, p) => {\n try {\n const x = parseValue(a), y = parseValue(b);\n if ((x as { kind: string }).kind === 'str' || (y as { kind: string }).kind === 'str') throw 0; // number lists / keywords: handled below\n if (x.kind === 'col' || y.kind === 'col') {\n const ca = x.kind === 'col' ? x.c : [0, 0, 0, 1], cb = y.kind === 'col' ? y.c : [0, 0, 0, 1];\n const c = ca.map((v, i) => v + (cb[i] - v) * p);\n return `rgba(${Math.round(c[0])},${Math.round(c[1])},${Math.round(c[2])},${r3(c[3])})`;\n }\n return `${r3(x.v + (y.v - x.v) * p)}${y.u || x.u}`;\n } catch {\n if (/^[-\\d.\\s,e]+$/i.test(a) && /^[-\\d.\\s,e]+$/i.test(b)) return lerpNumbers(a, b, p);\n return p < 0.5 ? a : b;\n }\n};\n\nexport interface SmilAnimationInfo {\n kind: 'animate' | 'set' | 'animateTransform' | 'animateMotion';\n target: Element;\n attribute: string;\n begin: number;\n dur: number;\n repeat: number;\n freeze: boolean;\n values: string[];\n keyTimes: number[];\n calcMode: string;\n type?: string;\n}\n\n/** Read the SMIL animation elements of an SVG (without playing them). */\nexport function readSmil(svg: Element): SmilAnimationInfo[] {\n const out: SmilAnimationInfo[] = [];\n svg.querySelectorAll('animate, set, animateTransform, animateMotion').forEach((el) => {\n const kind = el.localName as SmilAnimationInfo['kind'];\n const href = el.getAttribute('href') || el.getAttribute('xlink:href');\n const target = href ? svg.querySelector(href) : el.parentElement;\n if (!target) return;\n const begin = smilTime((el.getAttribute('begin') || '0').split(';')[0]);\n const dur = kind === 'set' ? smilTime(el.getAttribute('dur')) || 0 : smilTime(el.getAttribute('dur'));\n const rc = el.getAttribute('repeatCount');\n const rd = smilTime(el.getAttribute('repeatDur'));\n let repeat = rc === 'indefinite' || el.getAttribute('repeatDur') === 'indefinite' ? -1 : rc ? Math.max(0, Math.ceil(parseFloat(rc)) - 1) : 0;\n if (!rc && rd > 0 && dur > 0) repeat = Math.ceil(rd / dur) - 1;\n const attribute = kind === 'animateTransform' ? 'transform' : kind === 'animateMotion' ? 'transform' : el.getAttribute('attributeName') || '';\n let values: string[];\n const v = el.getAttribute('values');\n if (kind === 'set') values = [el.getAttribute('to') || ''];\n else if (kind === 'animateMotion') {\n const mp = el.querySelector('mpath');\n const ref = mp && (mp.getAttribute('href') || mp.getAttribute('xlink:href'));\n values = [(ref && svg.querySelector(ref)?.getAttribute('d')) || el.getAttribute('path') || ''];\n } else if (v) values = v.split(';').map((s) => s.trim()).filter((s) => s !== '');\n else {\n const base = target.getAttribute(attribute) || (attribute === 'opacity' ? '1' : '0');\n const from = el.getAttribute('from') ?? base;\n const by = el.getAttribute('by');\n const to = el.getAttribute('to') ?? (by !== null ? numList(from).map((x, i) => x + (numList(by)[i] ?? 0)).join(' ') : base);\n values = [from, to];\n }\n const kt = el.getAttribute('keyTimes');\n out.push({ kind, target, attribute, begin: Number.isFinite(begin) ? begin : 0, dur: Number.isFinite(dur) ? dur : 0, repeat, freeze: el.getAttribute('fill') === 'freeze' || (kind === 'set' && !el.getAttribute('dur')) /* a <set> without dur holds its value */, values, keyTimes: kt ? kt.split(';').map(Number) : [], calcMode: el.getAttribute('calcMode') || (kind === 'animateMotion' ? 'paced' : 'linear'), type: el.getAttribute('type') || undefined, ...(el.getAttribute('rotate') ? { rotate: el.getAttribute('rotate') } : {}), ...(el.getAttribute('keySplines') ? { keySplines: el.getAttribute('keySplines') } : {}) } as SmilAnimationInfo);\n });\n return out;\n}\n\n/** One SMIL animation replayed as a runtime Playable. */\nclass SmilTrack extends Playable {\n private interp: Interp;\n private splines: Ease[];\n private base: string | null;\n private morphs: ((p: number) => string)[] = [];\n constructor(private info: SmilAnimationInfo & { rotate?: string; keySplines?: string }) {\n super({ repeat: info.repeat });\n this.base = info.target.getAttribute(info.attribute);\n this.interp = info.attribute === 'd' ? (a, b, p) => this.morph(a, b)(p) : info.kind === 'animateTransform' ? lerpNumbers : lerpAny;\n this.splines = (info.keySplines || '').split(';').filter((s) => s.trim()).map((s) => { const n = numList(s); return cubicBezier(n[0], n[1], n[2], n[3]); });\n }\n private morph(a: string, b: string): (p: number) => string {\n const key = a + '|' + b;\n const hit = (this.morphs as any)[key];\n return hit || ((this.morphs as any)[key] = morphPath(a, b));\n }\n get duration(): number {\n return this.info.dur;\n }\n private write(v: string): void {\n const { kind, target, type } = this.info;\n if (kind === 'animateTransform') target.setAttribute('transform', `${type || 'translate'}(${v})`);\n else target.setAttribute(this.info.attribute, v);\n }\n protected renderLocal(ms: number, ended: boolean): void {\n const i = this.info;\n if (ended && ms >= i.dur && !i.freeze && this.repeat >= 0) {\n if (this.base === null) i.target.removeAttribute(i.attribute);\n else i.target.setAttribute(i.attribute, this.base);\n return;\n }\n const p = i.dur ? Math.min(1, ms / i.dur) : 1;\n if (i.kind === 'set') return this.write(i.values[0]);\n if (i.kind === 'animateMotion') {\n const d = i.values[0];\n const len = pathLength(d);\n const pt = pointAtLength(d, len * p);\n const rot = (i as any).rotate;\n const a = rot === 'auto' ? pt.angle : rot === 'auto-reverse' ? pt.angle + 180 : parseFloat(rot) || 0;\n i.target.setAttribute('transform', `translate(${r3(pt.x)} ${r3(pt.y)})${a ? ` rotate(${r3(a)})` : ''}`);\n return;\n }\n const vals = i.values;\n if (vals.length === 1) return this.write(vals[0]);\n const kt = i.keyTimes.length === vals.length ? i.keyTimes : vals.map((_, k) => k / (vals.length - 1));\n if (i.calcMode === 'discrete') {\n const kd = i.keyTimes.length === vals.length ? i.keyTimes : vals.map((_, k) => k / vals.length);\n let k = 0;\n while (k < kd.length - 1 && p >= kd[k + 1]) k++;\n return this.write(vals[k]);\n }\n let k = 0;\n while (k < kt.length - 2 && p > kt[k + 1]) k++;\n const span = kt[k + 1] - kt[k] || 1;\n let local = Math.min(1, Math.max(0, (p - kt[k]) / span));\n if (i.calcMode === 'spline' && this.splines[k]) local = this.splines[k](local);\n this.write(this.interp(vals[k], vals[k + 1], local));\n }\n}\n\nexport interface SmilPlayer {\n timeline: Timeline;\n animations: SmilAnimationInfo[];\n /** Put the original SMIL elements back (the browser's clock takes over again). */\n restore(): void;\n}\n\n/**\n * Replay an SVG's SMIL animations with the runtime. The SMIL elements are\n * detached while the runtime drives the attributes (call `restore()` to put\n * them back). Playing unless `paused: true`.\n */\nexport function playSmil(svg: Element, o: { paused?: boolean; timeScale?: number } = {}): SmilPlayer {\n const animations = readSmil(svg);\n const els = Array.from(svg.querySelectorAll('animate, set, animateTransform, animateMotion'));\n const parents = els.map((e) => [e, e.parentNode, e.nextSibling] as const);\n els.forEach((e) => e.remove());\n const tl = new Timeline({});\n for (const a of animations) tl.add(new SmilTrack(a), a.begin);\n if (o.timeScale) tl.timeScale = o.timeScale;\n if (!o.paused) tl.play();\n return {\n timeline: tl,\n animations,\n restore() {\n tl.kill();\n parents.forEach(([e, p, next]) => p?.insertBefore(e, next && next.parentNode === p ? next : null));\n },\n };\n}\n\nexport interface FormatSvgApi {\n parsePath: typeof parsePath;\n flattenPath: typeof flattenPath;\n pathLength: typeof pathLength;\n pointAtLength: typeof pointAtLength;\n samplePath: typeof samplePath;\n morphPath: typeof morphPath;\n readSmil: typeof readSmil;\n playSmil: typeof playSmil;\n smilTime: typeof smilTime;\n}\n\n/** The module object for `use(formatSvg)`. */\nexport const formatSvg: RuntimeModule<FormatSvgApi> = { id: 'format-svg', version: RUNTIME_VERSION, requires: ['core'], api: { parsePath, flattenPath, pathLength, pointAtLength, samplePath, morphPath, readSmil, playSmil, smilTime } };\n","// CDN build: load runtime.iife.js first, then this file → registers motionary/runtime/format-svg and adds its API to window.MotionaryRuntime.\nimport { register } from '../registry';\nimport { formatSvg } from '../format-svg';\nexport * from '../format-svg';\nregister(formatSvg);\n"],"names":["ARGS","M","L","H","V","C","S","Q","T","A","Z","parsePath","d","toks","match","out","i","cmd","x","y","sx","sy","lc","lq","num","parseFloat","length","test","Error","toUpperCase","rel","n","undefined","push","a","k","some","v","Number","isNaN","ox","oy","c","c1","arcPoints","x1","y1","rx","ry","phiDeg","large","sweep","x2","y2","seg","Math","abs","phi","PI","cos","sin","dx","dy","xp","yp","lam","sqrt","den","co","max","cxp","cyp","cx","cy","ang","ux","uy","vx","vy","atan2","t1","dt","ceil","pts","t","flattenPath","segments","cmds","subs","cur","u","last","dist","b","hypot","pathLength","reduce","s","pl","slice","p","pointAtLength","len","flat","acc","min","angle","samplePath","total","Array","from","_","r3","round","closed","trim","morphPath","to","o","points","B","isClosed","best","bestD","Infinity","sum","map","join","smilTime","NaN","m","exec","numList","split","filter","Boolean","lerpNumbers","lerpAny","parseValue","kind","ca","cb","readSmil","svg","querySelectorAll","forEach","el","localName","href","getAttribute","target","querySelector","parentElement","begin","dur","rc","rd","repeat","attribute","values","mp","ref","base","by","kt","isFinite","freeze","keyTimes","calcMode","type","rotate","keySplines","SmilTrack","Playable","constructor","info","super","this","morphs","interp","morph","splines","cubicBezier","key","duration","write","setAttribute","renderLocal","ms","ended","removeAttribute","pt","rot","vals","kd","span","local","playSmil","animations","els","parents","e","parentNode","nextSibling","remove","tl","Timeline","add","timeScale","paused","play","timeline","restore","kill","next","insertBefore","formatSvg","id","version","RUNTIME_VERSION","requires","api","register"],"mappings":"gCA6BA,MAAMA,EAA+B,CAAEC,EAAG,EAAGC,EAAG,EAAGC,EAAG,EAAGC,EAAG,EAAGC,EAAG,EAAGC,EAAG,EAAGC,EAAG,EAAGC,EAAG,EAAGC,EAAG,EAAGC,EAAG,GAG1F,SAAUC,EAAUC,GACxB,MAAMC,EAAOD,EAAEE,MAAM,wDAA0D,GACzEC,EAAqB,GAC3B,IAAIC,EAAI,EAAGC,EAAM,GAAIC,EAAI,EAAGC,EAAI,EAAGC,EAAK,EAAGC,EAAK,EAAGC,EAAgB,KAAMC,EAAgB,KACzF,MAAMC,EAAM,IAAMC,WAAWZ,EAAKG,MAClC,KAAOA,EAAIH,EAAKa,QAAQ,CACtB,GAAI,WAAWC,KAAKd,EAAKG,IAAKC,EAAMJ,EAAKG,UACpC,IAAKC,EAAK,MAAM,IAAIW,MAAM,0DAC/B,MAAMvB,EAAIY,EAAIY,cAAeC,EAAMb,IAAQZ,EACrC0B,EAAI/B,EAAKK,GACf,QAAU2B,IAAND,EAAiB,MAAM,IAAIH,MAAM,iDAAiDX,MACtF,GAAU,MAANZ,EAAW,CACbU,EAAIkB,KAAK,CAAC,MACVf,EAAIE,EAAID,EAAIE,EAAIC,EAAKC,EAAK,KAC1B,QACF,CACA,MAAMW,EAAc,GACpB,IAAK,IAAIC,EAAI,EAA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nF,MAAMgF,EAAaxD,EAASC,GACtBwD,EAAM1F,MAAMC,KAAKiC,EAAIC,iBAAiB,kDACtCwD,EAAUD,EAAIzE,IAAK2E,GAAM,CAACA,EAAGA,EAAEC,WAAYD,EAAEE,cACnDJ,EAAItD,QAASwD,GAAMA,EAAEG,UACrB,MAAMC,EAAK,IAAIC,EAAAA,SAAS,IACxB,IAAK,MAAM5K,KAAKoK,EAAYO,EAAGE,IAAI,IAAInC,EAAU1I,GAAIA,EAAEuH,OAGvD,OAFInC,EAAE0F,YAAWH,EAAGG,UAAY1F,EAAE0F,WAC7B1F,EAAE2F,QAAQJ,EAAGK,OACX,CACLC,SAAUN,EACVP,aACA,OAAAc,GACEP,EAAGQ,OACHb,EAAQvD,QAAQ,EAAEwD,EAAGrG,EAAGkH,KAAUlH,GAAGmH,aAAad,EAAGa,GAAQA,EAAKZ,aAAetG,EAAIkH,EAAO,MAC9F,EAEJ,CAeO,MAAME,EAAyC,CAAEC,GAAI,aAAcC,QAASC,EAAAA,gBAAiBC,SAAU,CAAC,QAASC,IAAK,CAAElN,YAAW0E,cAAaU,aAAYM,gBAAeM,aAAYS,YAAW0B,WAAUuD,WAAUrE,aC5W7N8F,EAAAA,SAASN"}
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import { R as RUNTIME_VERSION } from '../chunks/registry-BIEjKngP.js';
|
|
2
|
+
import { T as Timeline, P as Playable, c as cubicBezier, d as parseValue } from '../chunks/tween-CqX1JBuj.js';
|
|
3
|
+
import '../chunks/ticker-CM_56oVy.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `motionary/runtime/format-svg` (10.2) — SVG animation with the runtime
|
|
7
|
+
* (original implementation):
|
|
8
|
+
*
|
|
9
|
+
* - **Path geometry** without the DOM (SSR / workers): `parsePath(d)` (all
|
|
10
|
+
* commands, relative + absolute, arcs), `flattenPath(d)`, `pathLength(d)`,
|
|
11
|
+
* `pointAtLength(d, len)`, `samplePath(d, n)`.
|
|
12
|
+
* - **Path morphing**: `morphPath(from, to, { points })` → `(p) => d` — both
|
|
13
|
+
* paths are resampled to the same number of points (any command mix, any
|
|
14
|
+
* point counts), aligned to the closest start point, then interpolated.
|
|
15
|
+
* - **SMIL playback**: `playSmil(svg)` reads `<animate>`, `<set>`,
|
|
16
|
+
* `<animateTransform>` (translate / scale / rotate / skewX / skewY) and
|
|
17
|
+
* `<animateMotion>` (`path` or `<mpath>`, `rotate="auto"`) — `from` / `to` /
|
|
18
|
+
* `by` / `values`, `keyTimes`, `keySplines` (`calcMode="spline"`),
|
|
19
|
+
* `calcMode="discrete"`, `dur`, numeric `begin` offsets, `repeatCount`
|
|
20
|
+
* (incl. `indefinite`), `fill="freeze"` — and replays them as a runtime
|
|
21
|
+
* timeline (seek, scrub, reverse, timeScale) instead of the browser's SMIL clock.
|
|
22
|
+
* - CSS-animated SVG: use `motionary/runtime/format-css` (`@keyframes` in the SVG's `<style>`).
|
|
23
|
+
*
|
|
24
|
+
* Not supported (documented): event / syncbase `begin` values (`click`,
|
|
25
|
+
* `a.end`), `accumulate` / `additive="sum"`, `<animateColor>` (deprecated).
|
|
26
|
+
*/
|
|
27
|
+
const ARGS = { M: 2, L: 2, H: 1, V: 1, C: 6, S: 4, Q: 4, T: 2, A: 7, Z: 0 };
|
|
28
|
+
/** Parse path data into absolute commands (M L C Q A Z; H/V/S/T expanded). */
|
|
29
|
+
function parsePath(d) {
|
|
30
|
+
const toks = d.match(/[a-zA-Z]|[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/g) || [];
|
|
31
|
+
const out = [];
|
|
32
|
+
let i = 0, cmd = '', x = 0, y = 0, sx = 0, sy = 0, lc = null, lq = null;
|
|
33
|
+
const num = () => parseFloat(toks[i++]);
|
|
34
|
+
while (i < toks.length) {
|
|
35
|
+
if (/[a-zA-Z]/.test(toks[i]))
|
|
36
|
+
cmd = toks[i++];
|
|
37
|
+
else if (!cmd)
|
|
38
|
+
throw new Error('[motionary] format-svg: path must start with a command');
|
|
39
|
+
const C = cmd.toUpperCase(), rel = cmd !== C;
|
|
40
|
+
const n = ARGS[C];
|
|
41
|
+
if (n === undefined)
|
|
42
|
+
throw new Error(`[motionary] format-svg: unknown path command "${cmd}"`);
|
|
43
|
+
if (C === 'Z') {
|
|
44
|
+
out.push(['Z']);
|
|
45
|
+
x = sx;
|
|
46
|
+
y = sy;
|
|
47
|
+
lc = lq = null;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const a = [];
|
|
51
|
+
for (let k = 0; k < n; k++)
|
|
52
|
+
a.push(num());
|
|
53
|
+
if (a.some((v) => Number.isNaN(v)))
|
|
54
|
+
break;
|
|
55
|
+
const ox = rel ? x : 0, oy = rel ? y : 0;
|
|
56
|
+
switch (C) {
|
|
57
|
+
case 'M':
|
|
58
|
+
x = a[0] + ox;
|
|
59
|
+
y = a[1] + oy;
|
|
60
|
+
sx = x;
|
|
61
|
+
sy = y;
|
|
62
|
+
out.push(['M', x, y]);
|
|
63
|
+
cmd = rel ? 'l' : 'L';
|
|
64
|
+
lc = lq = null;
|
|
65
|
+
break;
|
|
66
|
+
case 'L':
|
|
67
|
+
x = a[0] + ox;
|
|
68
|
+
y = a[1] + oy;
|
|
69
|
+
out.push(['L', x, y]);
|
|
70
|
+
lc = lq = null;
|
|
71
|
+
break;
|
|
72
|
+
case 'H':
|
|
73
|
+
x = a[0] + ox;
|
|
74
|
+
out.push(['L', x, y]);
|
|
75
|
+
lc = lq = null;
|
|
76
|
+
break;
|
|
77
|
+
case 'V':
|
|
78
|
+
y = a[0] + (rel ? y : 0);
|
|
79
|
+
out.push(['L', x, y]);
|
|
80
|
+
lc = lq = null;
|
|
81
|
+
break;
|
|
82
|
+
case 'C': {
|
|
83
|
+
const c = [a[0] + ox, a[1] + oy, a[2] + ox, a[3] + oy, a[4] + ox, a[5] + oy];
|
|
84
|
+
out.push(['C', ...c]);
|
|
85
|
+
lc = [c[2], c[3]];
|
|
86
|
+
x = c[4];
|
|
87
|
+
y = c[5];
|
|
88
|
+
lq = null;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
case 'S': {
|
|
92
|
+
const c1 = lc ? [2 * x - lc[0], 2 * y - lc[1]] : [x, y];
|
|
93
|
+
const c = [a[0] + ox, a[1] + oy, a[2] + ox, a[3] + oy];
|
|
94
|
+
out.push(['C', c1[0], c1[1], ...c]);
|
|
95
|
+
lc = [c[0], c[1]];
|
|
96
|
+
x = c[2];
|
|
97
|
+
y = c[3];
|
|
98
|
+
lq = null;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
case 'Q': {
|
|
102
|
+
const c = [a[0] + ox, a[1] + oy, a[2] + ox, a[3] + oy];
|
|
103
|
+
out.push(['Q', ...c]);
|
|
104
|
+
lq = [c[0], c[1]];
|
|
105
|
+
x = c[2];
|
|
106
|
+
y = c[3];
|
|
107
|
+
lc = null;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
case 'T': {
|
|
111
|
+
const c1 = lq ? [2 * x - lq[0], 2 * y - lq[1]] : [x, y];
|
|
112
|
+
x = a[0] + ox;
|
|
113
|
+
y = a[1] + oy;
|
|
114
|
+
out.push(['Q', c1[0], c1[1], x, y]);
|
|
115
|
+
lq = c1;
|
|
116
|
+
lc = null;
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
case 'A': {
|
|
120
|
+
x = a[5] + ox;
|
|
121
|
+
y = a[6] + oy;
|
|
122
|
+
out.push(['A', a[0], a[1], a[2], a[3], a[4], x, y]);
|
|
123
|
+
lc = lq = null;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return out;
|
|
129
|
+
}
|
|
130
|
+
/** Endpoint-parameterised arc → points (SVG spec F.6.5 conversion). */
|
|
131
|
+
function arcPoints(x1, y1, rx, ry, phiDeg, large, sweep, x2, y2, seg) {
|
|
132
|
+
if (!rx || !ry)
|
|
133
|
+
return [[x2, y2]];
|
|
134
|
+
rx = Math.abs(rx);
|
|
135
|
+
ry = Math.abs(ry);
|
|
136
|
+
const phi = (phiDeg * Math.PI) / 180, cos = Math.cos(phi), sin = Math.sin(phi);
|
|
137
|
+
const dx = (x1 - x2) / 2, dy = (y1 - y2) / 2;
|
|
138
|
+
const xp = cos * dx + sin * dy, yp = -sin * dx + cos * dy;
|
|
139
|
+
const lam = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);
|
|
140
|
+
if (lam > 1) {
|
|
141
|
+
rx *= Math.sqrt(lam);
|
|
142
|
+
ry *= Math.sqrt(lam);
|
|
143
|
+
}
|
|
144
|
+
const num = rx * rx * ry * ry - rx * rx * yp * yp - ry * ry * xp * xp;
|
|
145
|
+
const den = rx * rx * yp * yp + ry * ry * xp * xp;
|
|
146
|
+
let co = Math.sqrt(Math.max(0, num / den));
|
|
147
|
+
if (large === sweep)
|
|
148
|
+
co = -co;
|
|
149
|
+
const cxp = (co * rx * yp) / ry, cyp = (-co * ry * xp) / rx;
|
|
150
|
+
const cx = cos * cxp - sin * cyp + (x1 + x2) / 2, cy = sin * cxp + cos * cyp + (y1 + y2) / 2;
|
|
151
|
+
const ang = (ux, uy, vx, vy) => Math.atan2(ux * vy - uy * vx, ux * vx + uy * vy);
|
|
152
|
+
const t1 = ang(1, 0, (xp - cxp) / rx, (yp - cyp) / ry);
|
|
153
|
+
let dt = ang((xp - cxp) / rx, (yp - cyp) / ry, (-xp - cxp) / rx, (-yp - cyp) / ry);
|
|
154
|
+
if (!sweep && dt > 0)
|
|
155
|
+
dt -= 2 * Math.PI;
|
|
156
|
+
if (sweep && dt < 0)
|
|
157
|
+
dt += 2 * Math.PI;
|
|
158
|
+
const n = Math.max(2, Math.ceil((Math.abs(dt) / (Math.PI / 2)) * seg));
|
|
159
|
+
const pts = [];
|
|
160
|
+
for (let k = 1; k <= n; k++) {
|
|
161
|
+
const t = t1 + (dt * k) / n;
|
|
162
|
+
pts.push([cx + rx * Math.cos(t) * cos - ry * Math.sin(t) * sin, cy + rx * Math.cos(t) * sin + ry * Math.sin(t) * cos]);
|
|
163
|
+
}
|
|
164
|
+
return pts;
|
|
165
|
+
}
|
|
166
|
+
/** Flatten a path into polylines (one per subpath); `segments` points per curve. */
|
|
167
|
+
function flattenPath(d, segments = 16) {
|
|
168
|
+
const cmds = typeof d === 'string' ? parsePath(d) : d;
|
|
169
|
+
const subs = [];
|
|
170
|
+
let cur = [], x = 0, y = 0;
|
|
171
|
+
for (const c of cmds) {
|
|
172
|
+
const [k, ...a] = c;
|
|
173
|
+
if (k === 'M') {
|
|
174
|
+
if (cur.length)
|
|
175
|
+
subs.push(cur);
|
|
176
|
+
cur = [[a[0], a[1]]];
|
|
177
|
+
x = a[0];
|
|
178
|
+
y = a[1];
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (!cur.length)
|
|
182
|
+
cur = [[x, y]];
|
|
183
|
+
if (k === 'L')
|
|
184
|
+
cur.push([a[0], a[1]]);
|
|
185
|
+
else if (k === 'C')
|
|
186
|
+
for (let i = 1; i <= segments; i++) {
|
|
187
|
+
const t = i / segments, u = 1 - t;
|
|
188
|
+
cur.push([u * u * u * x + 3 * u * u * t * a[0] + 3 * u * t * t * a[2] + t * t * t * a[4], u * u * u * y + 3 * u * u * t * a[1] + 3 * u * t * t * a[3] + t * t * t * a[5]]);
|
|
189
|
+
}
|
|
190
|
+
else if (k === 'Q')
|
|
191
|
+
for (let i = 1; i <= segments; i++) {
|
|
192
|
+
const t = i / segments, u = 1 - t;
|
|
193
|
+
cur.push([u * u * x + 2 * u * t * a[0] + t * t * a[2], u * u * y + 2 * u * t * a[1] + t * t * a[3]]);
|
|
194
|
+
}
|
|
195
|
+
else if (k === 'A')
|
|
196
|
+
cur.push(...arcPoints(x, y, a[0], a[1], a[2], a[3], a[4], a[5], a[6], segments / 4));
|
|
197
|
+
else if (k === 'Z') {
|
|
198
|
+
cur.push([cur[0][0], cur[0][1]]);
|
|
199
|
+
subs.push(cur);
|
|
200
|
+
x = cur[0][0];
|
|
201
|
+
y = cur[0][1];
|
|
202
|
+
cur = [];
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
const last = cur[cur.length - 1];
|
|
206
|
+
x = last[0];
|
|
207
|
+
y = last[1];
|
|
208
|
+
}
|
|
209
|
+
if (cur.length)
|
|
210
|
+
subs.push(cur);
|
|
211
|
+
return subs;
|
|
212
|
+
}
|
|
213
|
+
const dist = (a, b) => Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
214
|
+
/** Total length of a path. */
|
|
215
|
+
function pathLength(d) {
|
|
216
|
+
return flattenPath(d, 48).reduce((s, pl) => s + pl.slice(1).reduce((t, p, i) => t + dist(pl[i], p), 0), 0);
|
|
217
|
+
}
|
|
218
|
+
/** Point (and tangent angle, degrees) at a distance along the path. */
|
|
219
|
+
function pointAtLength(d, len) {
|
|
220
|
+
const pl = flattenPath(d, 48).flat();
|
|
221
|
+
let acc = 0;
|
|
222
|
+
for (let i = 1; i < pl.length; i++) {
|
|
223
|
+
const s = dist(pl[i - 1], pl[i]);
|
|
224
|
+
if (acc + s >= len || i === pl.length - 1) {
|
|
225
|
+
const t = s ? Math.min(1, Math.max(0, (len - acc) / s)) : 0;
|
|
226
|
+
return { x: pl[i - 1][0] + (pl[i][0] - pl[i - 1][0]) * t, y: pl[i - 1][1] + (pl[i][1] - pl[i - 1][1]) * t, angle: (Math.atan2(pl[i][1] - pl[i - 1][1], pl[i][0] - pl[i - 1][0]) * 180) / Math.PI };
|
|
227
|
+
}
|
|
228
|
+
acc += s;
|
|
229
|
+
}
|
|
230
|
+
return { x: pl[0]?.[0] ?? 0, y: pl[0]?.[1] ?? 0, angle: 0 };
|
|
231
|
+
}
|
|
232
|
+
/** `n` points evenly spaced along the path (all subpaths joined). */
|
|
233
|
+
function samplePath(d, n = 64) {
|
|
234
|
+
const total = pathLength(d);
|
|
235
|
+
return Array.from({ length: n }, (_, i) => {
|
|
236
|
+
const p = pointAtLength(d, (total * i) / (n - 1 || 1));
|
|
237
|
+
return [p.x, p.y];
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
const r3 = (v) => Math.round(v * 1000) / 1000;
|
|
241
|
+
const closed = (d) => /z\s*$/i.test(d.trim());
|
|
242
|
+
/**
|
|
243
|
+
* Morph between two paths of any shape: `const f = morphPath(a, b); el.setAttribute('d', f(0.5))`.
|
|
244
|
+
* Closed paths are rotated so their start points line up (less twisting).
|
|
245
|
+
*/
|
|
246
|
+
function morphPath(from, to, o = {}) {
|
|
247
|
+
const n = o.points ?? 64;
|
|
248
|
+
const A = samplePath(from, n);
|
|
249
|
+
let B = samplePath(to, n);
|
|
250
|
+
const isClosed = closed(from) && closed(to);
|
|
251
|
+
if (isClosed) {
|
|
252
|
+
let best = 0, bestD = Infinity;
|
|
253
|
+
for (let s = 0; s < n; s++) {
|
|
254
|
+
let sum = 0;
|
|
255
|
+
for (let i = 0; i < n; i += 4)
|
|
256
|
+
sum += dist(A[i], B[(i + s) % n]);
|
|
257
|
+
if (sum < bestD) {
|
|
258
|
+
bestD = sum;
|
|
259
|
+
best = s;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
B = B.map((_, i) => B[(i + best) % n]);
|
|
263
|
+
}
|
|
264
|
+
return (p) => {
|
|
265
|
+
if (p <= 0)
|
|
266
|
+
return from;
|
|
267
|
+
if (p >= 1)
|
|
268
|
+
return to;
|
|
269
|
+
return 'M' + A.map((a, i) => `${r3(a[0] + (B[i][0] - a[0]) * p)} ${r3(a[1] + (B[i][1] - a[1]) * p)}`).join('L') + (isClosed ? 'Z' : '');
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/* ------------------------------------------------------------------ SMIL */
|
|
273
|
+
/** '2s', '150ms', '1.5', 'indefinite' → ms (NaN for indefinite / unsupported). */
|
|
274
|
+
function smilTime(v) {
|
|
275
|
+
if (!v)
|
|
276
|
+
return NaN;
|
|
277
|
+
const s = v.trim();
|
|
278
|
+
const m = /^(-?[\d.]+)(ms|s|min|h)?$/.exec(s);
|
|
279
|
+
if (!m) {
|
|
280
|
+
const c = /^(?:(\d+):)?(\d+):(\d+(?:\.\d+)?)$/.exec(s);
|
|
281
|
+
return c ? ((+(c[1] || 0) * 60 + +c[2]) * 60 + +c[3]) * 1000 : NaN;
|
|
282
|
+
}
|
|
283
|
+
const n = parseFloat(m[1]);
|
|
284
|
+
return m[2] === 'ms' ? n : m[2] === 'min' ? n * 60000 : m[2] === 'h' ? n * 3600000 : n * 1000;
|
|
285
|
+
}
|
|
286
|
+
const numList = (s) => s.trim().split(/[\s,]+/).filter(Boolean).map(Number);
|
|
287
|
+
const lerpNumbers = (a, b, p) => {
|
|
288
|
+
const x = numList(a), y = numList(b);
|
|
289
|
+
return x.map((v, i) => r3(v + ((y[i] ?? v) - v) * p)).join(' ');
|
|
290
|
+
};
|
|
291
|
+
const lerpAny = (a, b, p) => {
|
|
292
|
+
try {
|
|
293
|
+
const x = parseValue(a), y = parseValue(b);
|
|
294
|
+
if (x.kind === 'str' || y.kind === 'str')
|
|
295
|
+
throw 0; // number lists / keywords: handled below
|
|
296
|
+
if (x.kind === 'col' || y.kind === 'col') {
|
|
297
|
+
const ca = x.kind === 'col' ? x.c : [0, 0, 0, 1], cb = y.kind === 'col' ? y.c : [0, 0, 0, 1];
|
|
298
|
+
const c = ca.map((v, i) => v + (cb[i] - v) * p);
|
|
299
|
+
return `rgba(${Math.round(c[0])},${Math.round(c[1])},${Math.round(c[2])},${r3(c[3])})`;
|
|
300
|
+
}
|
|
301
|
+
return `${r3(x.v + (y.v - x.v) * p)}${y.u || x.u}`;
|
|
302
|
+
}
|
|
303
|
+
catch {
|
|
304
|
+
if (/^[-\d.\s,e]+$/i.test(a) && /^[-\d.\s,e]+$/i.test(b))
|
|
305
|
+
return lerpNumbers(a, b, p);
|
|
306
|
+
return p < 0.5 ? a : b;
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
/** Read the SMIL animation elements of an SVG (without playing them). */
|
|
310
|
+
function readSmil(svg) {
|
|
311
|
+
const out = [];
|
|
312
|
+
svg.querySelectorAll('animate, set, animateTransform, animateMotion').forEach((el) => {
|
|
313
|
+
const kind = el.localName;
|
|
314
|
+
const href = el.getAttribute('href') || el.getAttribute('xlink:href');
|
|
315
|
+
const target = href ? svg.querySelector(href) : el.parentElement;
|
|
316
|
+
if (!target)
|
|
317
|
+
return;
|
|
318
|
+
const begin = smilTime((el.getAttribute('begin') || '0').split(';')[0]);
|
|
319
|
+
const dur = kind === 'set' ? smilTime(el.getAttribute('dur')) || 0 : smilTime(el.getAttribute('dur'));
|
|
320
|
+
const rc = el.getAttribute('repeatCount');
|
|
321
|
+
const rd = smilTime(el.getAttribute('repeatDur'));
|
|
322
|
+
let repeat = rc === 'indefinite' || el.getAttribute('repeatDur') === 'indefinite' ? -1 : rc ? Math.max(0, Math.ceil(parseFloat(rc)) - 1) : 0;
|
|
323
|
+
if (!rc && rd > 0 && dur > 0)
|
|
324
|
+
repeat = Math.ceil(rd / dur) - 1;
|
|
325
|
+
const attribute = kind === 'animateTransform' ? 'transform' : kind === 'animateMotion' ? 'transform' : el.getAttribute('attributeName') || '';
|
|
326
|
+
let values;
|
|
327
|
+
const v = el.getAttribute('values');
|
|
328
|
+
if (kind === 'set')
|
|
329
|
+
values = [el.getAttribute('to') || ''];
|
|
330
|
+
else if (kind === 'animateMotion') {
|
|
331
|
+
const mp = el.querySelector('mpath');
|
|
332
|
+
const ref = mp && (mp.getAttribute('href') || mp.getAttribute('xlink:href'));
|
|
333
|
+
values = [(ref && svg.querySelector(ref)?.getAttribute('d')) || el.getAttribute('path') || ''];
|
|
334
|
+
}
|
|
335
|
+
else if (v)
|
|
336
|
+
values = v.split(';').map((s) => s.trim()).filter((s) => s !== '');
|
|
337
|
+
else {
|
|
338
|
+
const base = target.getAttribute(attribute) || (attribute === 'opacity' ? '1' : '0');
|
|
339
|
+
const from = el.getAttribute('from') ?? base;
|
|
340
|
+
const by = el.getAttribute('by');
|
|
341
|
+
const to = el.getAttribute('to') ?? (by !== null ? numList(from).map((x, i) => x + (numList(by)[i] ?? 0)).join(' ') : base);
|
|
342
|
+
values = [from, to];
|
|
343
|
+
}
|
|
344
|
+
const kt = el.getAttribute('keyTimes');
|
|
345
|
+
out.push({ kind, target, attribute, begin: Number.isFinite(begin) ? begin : 0, dur: Number.isFinite(dur) ? dur : 0, repeat, freeze: el.getAttribute('fill') === 'freeze' || (kind === 'set' && !el.getAttribute('dur')) /* a <set> without dur holds its value */, values, keyTimes: kt ? kt.split(';').map(Number) : [], calcMode: el.getAttribute('calcMode') || (kind === 'animateMotion' ? 'paced' : 'linear'), type: el.getAttribute('type') || undefined, ...(el.getAttribute('rotate') ? { rotate: el.getAttribute('rotate') } : {}), ...(el.getAttribute('keySplines') ? { keySplines: el.getAttribute('keySplines') } : {}) });
|
|
346
|
+
});
|
|
347
|
+
return out;
|
|
348
|
+
}
|
|
349
|
+
/** One SMIL animation replayed as a runtime Playable. */
|
|
350
|
+
class SmilTrack extends Playable {
|
|
351
|
+
constructor(info) {
|
|
352
|
+
super({ repeat: info.repeat });
|
|
353
|
+
this.info = info;
|
|
354
|
+
this.morphs = [];
|
|
355
|
+
this.base = info.target.getAttribute(info.attribute);
|
|
356
|
+
this.interp = info.attribute === 'd' ? (a, b, p) => this.morph(a, b)(p) : info.kind === 'animateTransform' ? lerpNumbers : lerpAny;
|
|
357
|
+
this.splines = (info.keySplines || '').split(';').filter((s) => s.trim()).map((s) => { const n = numList(s); return cubicBezier(n[0], n[1], n[2], n[3]); });
|
|
358
|
+
}
|
|
359
|
+
morph(a, b) {
|
|
360
|
+
const key = a + '|' + b;
|
|
361
|
+
const hit = this.morphs[key];
|
|
362
|
+
return hit || (this.morphs[key] = morphPath(a, b));
|
|
363
|
+
}
|
|
364
|
+
get duration() {
|
|
365
|
+
return this.info.dur;
|
|
366
|
+
}
|
|
367
|
+
write(v) {
|
|
368
|
+
const { kind, target, type } = this.info;
|
|
369
|
+
if (kind === 'animateTransform')
|
|
370
|
+
target.setAttribute('transform', `${type || 'translate'}(${v})`);
|
|
371
|
+
else
|
|
372
|
+
target.setAttribute(this.info.attribute, v);
|
|
373
|
+
}
|
|
374
|
+
renderLocal(ms, ended) {
|
|
375
|
+
const i = this.info;
|
|
376
|
+
if (ended && ms >= i.dur && !i.freeze && this.repeat >= 0) {
|
|
377
|
+
if (this.base === null)
|
|
378
|
+
i.target.removeAttribute(i.attribute);
|
|
379
|
+
else
|
|
380
|
+
i.target.setAttribute(i.attribute, this.base);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
const p = i.dur ? Math.min(1, ms / i.dur) : 1;
|
|
384
|
+
if (i.kind === 'set')
|
|
385
|
+
return this.write(i.values[0]);
|
|
386
|
+
if (i.kind === 'animateMotion') {
|
|
387
|
+
const d = i.values[0];
|
|
388
|
+
const len = pathLength(d);
|
|
389
|
+
const pt = pointAtLength(d, len * p);
|
|
390
|
+
const rot = i.rotate;
|
|
391
|
+
const a = rot === 'auto' ? pt.angle : rot === 'auto-reverse' ? pt.angle + 180 : parseFloat(rot) || 0;
|
|
392
|
+
i.target.setAttribute('transform', `translate(${r3(pt.x)} ${r3(pt.y)})${a ? ` rotate(${r3(a)})` : ''}`);
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
const vals = i.values;
|
|
396
|
+
if (vals.length === 1)
|
|
397
|
+
return this.write(vals[0]);
|
|
398
|
+
const kt = i.keyTimes.length === vals.length ? i.keyTimes : vals.map((_, k) => k / (vals.length - 1));
|
|
399
|
+
if (i.calcMode === 'discrete') {
|
|
400
|
+
const kd = i.keyTimes.length === vals.length ? i.keyTimes : vals.map((_, k) => k / vals.length);
|
|
401
|
+
let k = 0;
|
|
402
|
+
while (k < kd.length - 1 && p >= kd[k + 1])
|
|
403
|
+
k++;
|
|
404
|
+
return this.write(vals[k]);
|
|
405
|
+
}
|
|
406
|
+
let k = 0;
|
|
407
|
+
while (k < kt.length - 2 && p > kt[k + 1])
|
|
408
|
+
k++;
|
|
409
|
+
const span = kt[k + 1] - kt[k] || 1;
|
|
410
|
+
let local = Math.min(1, Math.max(0, (p - kt[k]) / span));
|
|
411
|
+
if (i.calcMode === 'spline' && this.splines[k])
|
|
412
|
+
local = this.splines[k](local);
|
|
413
|
+
this.write(this.interp(vals[k], vals[k + 1], local));
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Replay an SVG's SMIL animations with the runtime. The SMIL elements are
|
|
418
|
+
* detached while the runtime drives the attributes (call `restore()` to put
|
|
419
|
+
* them back). Playing unless `paused: true`.
|
|
420
|
+
*/
|
|
421
|
+
function playSmil(svg, o = {}) {
|
|
422
|
+
const animations = readSmil(svg);
|
|
423
|
+
const els = Array.from(svg.querySelectorAll('animate, set, animateTransform, animateMotion'));
|
|
424
|
+
const parents = els.map((e) => [e, e.parentNode, e.nextSibling]);
|
|
425
|
+
els.forEach((e) => e.remove());
|
|
426
|
+
const tl = new Timeline({});
|
|
427
|
+
for (const a of animations)
|
|
428
|
+
tl.add(new SmilTrack(a), a.begin);
|
|
429
|
+
if (o.timeScale)
|
|
430
|
+
tl.timeScale = o.timeScale;
|
|
431
|
+
if (!o.paused)
|
|
432
|
+
tl.play();
|
|
433
|
+
return {
|
|
434
|
+
timeline: tl,
|
|
435
|
+
animations,
|
|
436
|
+
restore() {
|
|
437
|
+
tl.kill();
|
|
438
|
+
parents.forEach(([e, p, next]) => p?.insertBefore(e, next && next.parentNode === p ? next : null));
|
|
439
|
+
},
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
/** The module object for `use(formatSvg)`. */
|
|
443
|
+
const formatSvg = { id: 'format-svg', version: RUNTIME_VERSION, requires: ['core'], api: { parsePath, flattenPath, pathLength, pointAtLength, samplePath, morphPath, readSmil, playSmil, smilTime } };
|
|
444
|
+
|
|
445
|
+
export { flattenPath, formatSvg, morphPath, parsePath, pathLength, playSmil, pointAtLength, readSmil, samplePath, smilTime };
|
|
446
|
+
//# sourceMappingURL=format-svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-svg.js","sources":["../../src/runtime/format-svg.ts"],"sourcesContent":["/**\n * `motionary/runtime/format-svg` (10.2) — SVG animation with the runtime\n * (original implementation):\n *\n * - **Path geometry** without the DOM (SSR / workers): `parsePath(d)` (all\n * commands, relative + absolute, arcs), `flattenPath(d)`, `pathLength(d)`,\n * `pointAtLength(d, len)`, `samplePath(d, n)`.\n * - **Path morphing**: `morphPath(from, to, { points })` → `(p) => d` — both\n * paths are resampled to the same number of points (any command mix, any\n * point counts), aligned to the closest start point, then interpolated.\n * - **SMIL playback**: `playSmil(svg)` reads `<animate>`, `<set>`,\n * `<animateTransform>` (translate / scale / rotate / skewX / skewY) and\n * `<animateMotion>` (`path` or `<mpath>`, `rotate=\"auto\"`) — `from` / `to` /\n * `by` / `values`, `keyTimes`, `keySplines` (`calcMode=\"spline\"`),\n * `calcMode=\"discrete\"`, `dur`, numeric `begin` offsets, `repeatCount`\n * (incl. `indefinite`), `fill=\"freeze\"` — and replays them as a runtime\n * timeline (seek, scrub, reverse, timeScale) instead of the browser's SMIL clock.\n * - CSS-animated SVG: use `motionary/runtime/format-css` (`@keyframes` in the SVG's `<style>`).\n *\n * Not supported (documented): event / syncbase `begin` values (`click`,\n * `a.end`), `accumulate` / `additive=\"sum\"`, `<animateColor>` (deprecated).\n */\nimport { RUNTIME_VERSION, type RuntimeModule } from './registry';\nimport { Playable, Timeline, parseValue } from './tween';\nimport { cubicBezier, type Ease } from './ease';\n\ntype Pt = [number, number];\nexport type PathCommand = [string, ...number[]];\n\nconst ARGS: Record<string, number> = { M: 2, L: 2, H: 1, V: 1, C: 6, S: 4, Q: 4, T: 2, A: 7, Z: 0 };\n\n/** Parse path data into absolute commands (M L C Q A Z; H/V/S/T expanded). */\nexport function parsePath(d: string): PathCommand[] {\n const toks = d.match(/[a-zA-Z]|[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?/g) || [];\n const out: PathCommand[] = [];\n let i = 0, cmd = '', x = 0, y = 0, sx = 0, sy = 0, lc: Pt | null = null, lq: Pt | null = null;\n const num = () => parseFloat(toks[i++]);\n while (i < toks.length) {\n if (/[a-zA-Z]/.test(toks[i])) cmd = toks[i++];\n else if (!cmd) throw new Error('[motionary] format-svg: path must start with a command');\n const C = cmd.toUpperCase(), rel = cmd !== C;\n const n = ARGS[C];\n if (n === undefined) throw new Error(`[motionary] format-svg: unknown path command \"${cmd}\"`);\n if (C === 'Z') {\n out.push(['Z']);\n x = sx; y = sy; lc = lq = null;\n continue;\n }\n const a: number[] = [];\n for (let k = 0; k < n; k++) a.push(num());\n if (a.some((v) => Number.isNaN(v))) break;\n const ox = rel ? x : 0, oy = rel ? y : 0;\n switch (C) {\n case 'M': x = a[0] + ox; y = a[1] + oy; sx = x; sy = y; out.push(['M', x, y]); cmd = rel ? 'l' : 'L'; lc = lq = null; break;\n case 'L': x = a[0] + ox; y = a[1] + oy; out.push(['L', x, y]); lc = lq = null; break;\n case 'H': x = a[0] + ox; out.push(['L', x, y]); lc = lq = null; break;\n case 'V': y = a[0] + (rel ? y : 0); out.push(['L', x, y]); lc = lq = null; break;\n case 'C': { const c = [a[0] + ox, a[1] + oy, a[2] + ox, a[3] + oy, a[4] + ox, a[5] + oy]; out.push(['C', ...c]); lc = [c[2], c[3]]; x = c[4]; y = c[5]; lq = null; break; }\n case 'S': { const c1: Pt = lc ? [2 * x - lc[0], 2 * y - lc[1]] : [x, y]; const c = [a[0] + ox, a[1] + oy, a[2] + ox, a[3] + oy]; out.push(['C', c1[0], c1[1], ...c]); lc = [c[0], c[1]]; x = c[2]; y = c[3]; lq = null; break; }\n case 'Q': { const c = [a[0] + ox, a[1] + oy, a[2] + ox, a[3] + oy]; out.push(['Q', ...c]); lq = [c[0], c[1]]; x = c[2]; y = c[3]; lc = null; break; }\n case 'T': { const c1: Pt = lq ? [2 * x - lq[0], 2 * y - lq[1]] : [x, y]; x = a[0] + ox; y = a[1] + oy; out.push(['Q', c1[0], c1[1], x, y]); lq = c1; lc = null; break; }\n case 'A': { x = a[5] + ox; y = a[6] + oy; out.push(['A', a[0], a[1], a[2], a[3], a[4], x, y]); lc = lq = null; break; }\n }\n }\n return out;\n}\n\n/** Endpoint-parameterised arc → points (SVG spec F.6.5 conversion). */\nfunction arcPoints(x1: number, y1: number, rx: number, ry: number, phiDeg: number, large: number, sweep: number, x2: number, y2: number, seg: number): Pt[] {\n if (!rx || !ry) return [[x2, y2]];\n rx = Math.abs(rx); ry = Math.abs(ry);\n const phi = (phiDeg * Math.PI) / 180, cos = Math.cos(phi), sin = Math.sin(phi);\n const dx = (x1 - x2) / 2, dy = (y1 - y2) / 2;\n const xp = cos * dx + sin * dy, yp = -sin * dx + cos * dy;\n const lam = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);\n if (lam > 1) { rx *= Math.sqrt(lam); ry *= Math.sqrt(lam); }\n const num = rx * rx * ry * ry - rx * rx * yp * yp - ry * ry * xp * xp;\n const den = rx * rx * yp * yp + ry * ry * xp * xp;\n let co = Math.sqrt(Math.max(0, num / den));\n if (large === sweep) co = -co;\n const cxp = (co * rx * yp) / ry, cyp = (-co * ry * xp) / rx;\n const cx = cos * cxp - sin * cyp + (x1 + x2) / 2, cy = sin * cxp + cos * cyp + (y1 + y2) / 2;\n const ang = (ux: number, uy: number, vx: number, vy: number) => Math.atan2(ux * vy - uy * vx, ux * vx + uy * vy);\n const t1 = ang(1, 0, (xp - cxp) / rx, (yp - cyp) / ry);\n let dt = ang((xp - cxp) / rx, (yp - cyp) / ry, (-xp - cxp) / rx, (-yp - cyp) / ry);\n if (!sweep && dt > 0) dt -= 2 * Math.PI;\n if (sweep && dt < 0) dt += 2 * Math.PI;\n const n = Math.max(2, Math.ceil((Math.abs(dt) / (Math.PI / 2)) * seg));\n const pts: Pt[] = [];\n for (let k = 1; k <= n; k++) {\n const t = t1 + (dt * k) / n;\n pts.push([cx + rx * Math.cos(t) * cos - ry * Math.sin(t) * sin, cy + rx * Math.cos(t) * sin + ry * Math.sin(t) * cos]);\n }\n return pts;\n}\n\n/** Flatten a path into polylines (one per subpath); `segments` points per curve. */\nexport function flattenPath(d: string | PathCommand[], segments = 16): Pt[][] {\n const cmds = typeof d === 'string' ? parsePath(d) : d;\n const subs: Pt[][] = [];\n let cur: Pt[] = [], x = 0, y = 0;\n for (const c of cmds) {\n const [k, ...a] = c;\n if (k === 'M') { if (cur.length) subs.push(cur); cur = [[a[0], a[1]]]; x = a[0]; y = a[1]; continue; }\n if (!cur.length) cur = [[x, y]];\n if (k === 'L') cur.push([a[0], a[1]]);\n else if (k === 'C') for (let i = 1; i <= segments; i++) { const t = i / segments, u = 1 - t; cur.push([u * u * u * x + 3 * u * u * t * a[0] + 3 * u * t * t * a[2] + t * t * t * a[4], u * u * u * y + 3 * u * u * t * a[1] + 3 * u * t * t * a[3] + t * t * t * a[5]]); }\n else if (k === 'Q') for (let i = 1; i <= segments; i++) { const t = i / segments, u = 1 - t; cur.push([u * u * x + 2 * u * t * a[0] + t * t * a[2], u * u * y + 2 * u * t * a[1] + t * t * a[3]]); }\n else if (k === 'A') cur.push(...arcPoints(x, y, a[0], a[1], a[2], a[3], a[4], a[5], a[6], segments / 4));\n else if (k === 'Z') { cur.push([cur[0][0], cur[0][1]]); subs.push(cur); x = cur[0][0]; y = cur[0][1]; cur = []; continue; }\n const last = cur[cur.length - 1];\n x = last[0]; y = last[1];\n }\n if (cur.length) subs.push(cur);\n return subs;\n}\n\nconst dist = (a: Pt, b: Pt) => Math.hypot(b[0] - a[0], b[1] - a[1]);\n\n/** Total length of a path. */\nexport function pathLength(d: string | PathCommand[]): number {\n return flattenPath(d, 48).reduce((s, pl) => s + pl.slice(1).reduce((t, p, i) => t + dist(pl[i], p), 0), 0);\n}\n\n/** Point (and tangent angle, degrees) at a distance along the path. */\nexport function pointAtLength(d: string | PathCommand[], len: number): { x: number; y: number; angle: number } {\n const pl = flattenPath(d, 48).flat();\n let acc = 0;\n for (let i = 1; i < pl.length; i++) {\n const s = dist(pl[i - 1], pl[i]);\n if (acc + s >= len || i === pl.length - 1) {\n const t = s ? Math.min(1, Math.max(0, (len - acc) / s)) : 0;\n return { x: pl[i - 1][0] + (pl[i][0] - pl[i - 1][0]) * t, y: pl[i - 1][1] + (pl[i][1] - pl[i - 1][1]) * t, angle: (Math.atan2(pl[i][1] - pl[i - 1][1], pl[i][0] - pl[i - 1][0]) * 180) / Math.PI };\n }\n acc += s;\n }\n return { x: pl[0]?.[0] ?? 0, y: pl[0]?.[1] ?? 0, angle: 0 };\n}\n\n/** `n` points evenly spaced along the path (all subpaths joined). */\nexport function samplePath(d: string | PathCommand[], n = 64): Pt[] {\n const total = pathLength(d);\n return Array.from({ length: n }, (_, i) => {\n const p = pointAtLength(d, (total * i) / (n - 1 || 1));\n return [p.x, p.y] as Pt;\n });\n}\n\nconst r3 = (v: number) => Math.round(v * 1000) / 1000;\nconst closed = (d: string) => /z\\s*$/i.test(d.trim());\n\n/**\n * Morph between two paths of any shape: `const f = morphPath(a, b); el.setAttribute('d', f(0.5))`.\n * Closed paths are rotated so their start points line up (less twisting).\n */\nexport function morphPath(from: string, to: string, o: { points?: number } = {}): (p: number) => string {\n const n = o.points ?? 64;\n const A = samplePath(from, n);\n let B = samplePath(to, n);\n const isClosed = closed(from) && closed(to);\n if (isClosed) {\n let best = 0, bestD = Infinity;\n for (let s = 0; s < n; s++) {\n let sum = 0;\n for (let i = 0; i < n; i += 4) sum += dist(A[i], B[(i + s) % n]);\n if (sum < bestD) { bestD = sum; best = s; }\n }\n B = B.map((_, i) => B[(i + best) % n]);\n }\n return (p) => {\n if (p <= 0) return from;\n if (p >= 1) return to;\n return 'M' + A.map((a, i) => `${r3(a[0] + (B[i][0] - a[0]) * p)} ${r3(a[1] + (B[i][1] - a[1]) * p)}`).join('L') + (isClosed ? 'Z' : '');\n };\n}\n\n/* ------------------------------------------------------------------ SMIL */\n\n/** '2s', '150ms', '1.5', 'indefinite' → ms (NaN for indefinite / unsupported). */\nexport function smilTime(v: string | null | undefined): number {\n if (!v) return NaN;\n const s = v.trim();\n const m = /^(-?[\\d.]+)(ms|s|min|h)?$/.exec(s);\n if (!m) {\n const c = /^(?:(\\d+):)?(\\d+):(\\d+(?:\\.\\d+)?)$/.exec(s);\n return c ? ((+(c[1] || 0) * 60 + +c[2]) * 60 + +c[3]) * 1000 : NaN;\n }\n const n = parseFloat(m[1]);\n return m[2] === 'ms' ? n : m[2] === 'min' ? n * 60000 : m[2] === 'h' ? n * 3600000 : n * 1000;\n}\n\ntype Interp = (a: string, b: string, p: number) => string;\nconst numList = (s: string) => s.trim().split(/[\\s,]+/).filter(Boolean).map(Number);\nconst lerpNumbers: Interp = (a, b, p) => {\n const x = numList(a), y = numList(b);\n return x.map((v, i) => r3(v + ((y[i] ?? v) - v) * p)).join(' ');\n};\nconst lerpAny: Interp = (a, b, p) => {\n try {\n const x = parseValue(a), y = parseValue(b);\n if ((x as { kind: string }).kind === 'str' || (y as { kind: string }).kind === 'str') throw 0; // number lists / keywords: handled below\n if (x.kind === 'col' || y.kind === 'col') {\n const ca = x.kind === 'col' ? x.c : [0, 0, 0, 1], cb = y.kind === 'col' ? y.c : [0, 0, 0, 1];\n const c = ca.map((v, i) => v + (cb[i] - v) * p);\n return `rgba(${Math.round(c[0])},${Math.round(c[1])},${Math.round(c[2])},${r3(c[3])})`;\n }\n return `${r3(x.v + (y.v - x.v) * p)}${y.u || x.u}`;\n } catch {\n if (/^[-\\d.\\s,e]+$/i.test(a) && /^[-\\d.\\s,e]+$/i.test(b)) return lerpNumbers(a, b, p);\n return p < 0.5 ? a : b;\n }\n};\n\nexport interface SmilAnimationInfo {\n kind: 'animate' | 'set' | 'animateTransform' | 'animateMotion';\n target: Element;\n attribute: string;\n begin: number;\n dur: number;\n repeat: number;\n freeze: boolean;\n values: string[];\n keyTimes: number[];\n calcMode: string;\n type?: string;\n}\n\n/** Read the SMIL animation elements of an SVG (without playing them). */\nexport function readSmil(svg: Element): SmilAnimationInfo[] {\n const out: SmilAnimationInfo[] = [];\n svg.querySelectorAll('animate, set, animateTransform, animateMotion').forEach((el) => {\n const kind = el.localName as SmilAnimationInfo['kind'];\n const href = el.getAttribute('href') || el.getAttribute('xlink:href');\n const target = href ? svg.querySelector(href) : el.parentElement;\n if (!target) return;\n const begin = smilTime((el.getAttribute('begin') || '0').split(';')[0]);\n const dur = kind === 'set' ? smilTime(el.getAttribute('dur')) || 0 : smilTime(el.getAttribute('dur'));\n const rc = el.getAttribute('repeatCount');\n const rd = smilTime(el.getAttribute('repeatDur'));\n let repeat = rc === 'indefinite' || el.getAttribute('repeatDur') === 'indefinite' ? -1 : rc ? Math.max(0, Math.ceil(parseFloat(rc)) - 1) : 0;\n if (!rc && rd > 0 && dur > 0) repeat = Math.ceil(rd / dur) - 1;\n const attribute = kind === 'animateTransform' ? 'transform' : kind === 'animateMotion' ? 'transform' : el.getAttribute('attributeName') || '';\n let values: string[];\n const v = el.getAttribute('values');\n if (kind === 'set') values = [el.getAttribute('to') || ''];\n else if (kind === 'animateMotion') {\n const mp = el.querySelector('mpath');\n const ref = mp && (mp.getAttribute('href') || mp.getAttribute('xlink:href'));\n values = [(ref && svg.querySelector(ref)?.getAttribute('d')) || el.getAttribute('path') || ''];\n } else if (v) values = v.split(';').map((s) => s.trim()).filter((s) => s !== '');\n else {\n const base = target.getAttribute(attribute) || (attribute === 'opacity' ? '1' : '0');\n const from = el.getAttribute('from') ?? base;\n const by = el.getAttribute('by');\n const to = el.getAttribute('to') ?? (by !== null ? numList(from).map((x, i) => x + (numList(by)[i] ?? 0)).join(' ') : base);\n values = [from, to];\n }\n const kt = el.getAttribute('keyTimes');\n out.push({ kind, target, attribute, begin: Number.isFinite(begin) ? begin : 0, dur: Number.isFinite(dur) ? dur : 0, repeat, freeze: el.getAttribute('fill') === 'freeze' || (kind === 'set' && !el.getAttribute('dur')) /* a <set> without dur holds its value */, values, keyTimes: kt ? kt.split(';').map(Number) : [], calcMode: el.getAttribute('calcMode') || (kind === 'animateMotion' ? 'paced' : 'linear'), type: el.getAttribute('type') || undefined, ...(el.getAttribute('rotate') ? { rotate: el.getAttribute('rotate') } : {}), ...(el.getAttribute('keySplines') ? { keySplines: el.getAttribute('keySplines') } : {}) } as SmilAnimationInfo);\n });\n return out;\n}\n\n/** One SMIL animation replayed as a runtime Playable. */\nclass SmilTrack extends Playable {\n private interp: Interp;\n private splines: Ease[];\n private base: string | null;\n private morphs: ((p: number) => string)[] = [];\n constructor(private info: SmilAnimationInfo & { rotate?: string; keySplines?: string }) {\n super({ repeat: info.repeat });\n this.base = info.target.getAttribute(info.attribute);\n this.interp = info.attribute === 'd' ? (a, b, p) => this.morph(a, b)(p) : info.kind === 'animateTransform' ? lerpNumbers : lerpAny;\n this.splines = (info.keySplines || '').split(';').filter((s) => s.trim()).map((s) => { const n = numList(s); return cubicBezier(n[0], n[1], n[2], n[3]); });\n }\n private morph(a: string, b: string): (p: number) => string {\n const key = a + '|' + b;\n const hit = (this.morphs as any)[key];\n return hit || ((this.morphs as any)[key] = morphPath(a, b));\n }\n get duration(): number {\n return this.info.dur;\n }\n private write(v: string): void {\n const { kind, target, type } = this.info;\n if (kind === 'animateTransform') target.setAttribute('transform', `${type || 'translate'}(${v})`);\n else target.setAttribute(this.info.attribute, v);\n }\n protected renderLocal(ms: number, ended: boolean): void {\n const i = this.info;\n if (ended && ms >= i.dur && !i.freeze && this.repeat >= 0) {\n if (this.base === null) i.target.removeAttribute(i.attribute);\n else i.target.setAttribute(i.attribute, this.base);\n return;\n }\n const p = i.dur ? Math.min(1, ms / i.dur) : 1;\n if (i.kind === 'set') return this.write(i.values[0]);\n if (i.kind === 'animateMotion') {\n const d = i.values[0];\n const len = pathLength(d);\n const pt = pointAtLength(d, len * p);\n const rot = (i as any).rotate;\n const a = rot === 'auto' ? pt.angle : rot === 'auto-reverse' ? pt.angle + 180 : parseFloat(rot) || 0;\n i.target.setAttribute('transform', `translate(${r3(pt.x)} ${r3(pt.y)})${a ? ` rotate(${r3(a)})` : ''}`);\n return;\n }\n const vals = i.values;\n if (vals.length === 1) return this.write(vals[0]);\n const kt = i.keyTimes.length === vals.length ? i.keyTimes : vals.map((_, k) => k / (vals.length - 1));\n if (i.calcMode === 'discrete') {\n const kd = i.keyTimes.length === vals.length ? i.keyTimes : vals.map((_, k) => k / vals.length);\n let k = 0;\n while (k < kd.length - 1 && p >= kd[k + 1]) k++;\n return this.write(vals[k]);\n }\n let k = 0;\n while (k < kt.length - 2 && p > kt[k + 1]) k++;\n const span = kt[k + 1] - kt[k] || 1;\n let local = Math.min(1, Math.max(0, (p - kt[k]) / span));\n if (i.calcMode === 'spline' && this.splines[k]) local = this.splines[k](local);\n this.write(this.interp(vals[k], vals[k + 1], local));\n }\n}\n\nexport interface SmilPlayer {\n timeline: Timeline;\n animations: SmilAnimationInfo[];\n /** Put the original SMIL elements back (the browser's clock takes over again). */\n restore(): void;\n}\n\n/**\n * Replay an SVG's SMIL animations with the runtime. The SMIL elements are\n * detached while the runtime drives the attributes (call `restore()` to put\n * them back). Playing unless `paused: true`.\n */\nexport function playSmil(svg: Element, o: { paused?: boolean; timeScale?: number } = {}): SmilPlayer {\n const animations = readSmil(svg);\n const els = Array.from(svg.querySelectorAll('animate, set, animateTransform, animateMotion'));\n const parents = els.map((e) => [e, e.parentNode, e.nextSibling] as const);\n els.forEach((e) => e.remove());\n const tl = new Timeline({});\n for (const a of animations) tl.add(new SmilTrack(a), a.begin);\n if (o.timeScale) tl.timeScale = o.timeScale;\n if (!o.paused) tl.play();\n return {\n timeline: tl,\n animations,\n restore() {\n tl.kill();\n parents.forEach(([e, p, next]) => p?.insertBefore(e, next && next.parentNode === p ? next : null));\n },\n };\n}\n\nexport interface FormatSvgApi {\n parsePath: typeof parsePath;\n flattenPath: typeof flattenPath;\n pathLength: typeof pathLength;\n pointAtLength: typeof pointAtLength;\n samplePath: typeof samplePath;\n morphPath: typeof morphPath;\n readSmil: typeof readSmil;\n playSmil: typeof playSmil;\n smilTime: typeof smilTime;\n}\n\n/** The module object for `use(formatSvg)`. */\nexport const formatSvg: RuntimeModule<FormatSvgApi> = { id: 'format-svg', version: RUNTIME_VERSION, requires: ['core'], api: { parsePath, flattenPath, pathLength, pointAtLength, samplePath, morphPath, readSmil, playSmil, smilTime } };\n"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAQH,MAAM,IAAI,GAA2B,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AAEnG;AACM,SAAU,SAAS,CAAC,CAAS,EAAA;IACjC,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,qDAAqD,CAAC,IAAI,EAAE;IACjF,MAAM,GAAG,GAAkB,EAAE;AAC7B,IAAA,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,GAAc,IAAI,EAAE,EAAE,GAAc,IAAI;AAC7F,IAAA,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;AACvC,IAAA,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE;QACtB,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAAE,YAAA,GAAG,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC;AACxC,aAAA,IAAI,CAAC,GAAG;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC;AACxF,QAAA,MAAM,CAAC,GAAG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