motionary 10.6.0 → 10.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/AGENTS.md +2 -0
  2. package/CHANGELOG.md +16 -0
  3. package/README.md +35 -1
  4. package/bin/motionary-mcp.mjs +160 -11
  5. package/dist/chunks/{anim-image-DECLkPH4.cjs → anim-image-CFGpUX7t.cjs} +2 -2
  6. package/dist/chunks/{anim-image-DECLkPH4.cjs.map → anim-image-CFGpUX7t.cjs.map} +1 -1
  7. package/dist/chunks/{anim-image-DNghy017.js → anim-image-CXDD19FH.js} +2 -2
  8. package/dist/chunks/{anim-image-DNghy017.js.map → anim-image-CXDD19FH.js.map} +1 -1
  9. package/dist/chunks/{keyframes-CbUZjD_5.cjs → keyframes-DdwGY1gr.cjs} +2 -2
  10. package/dist/chunks/{keyframes-CbUZjD_5.cjs.map → keyframes-DdwGY1gr.cjs.map} +1 -1
  11. package/dist/chunks/{keyframes-F6vp6tZZ.js → keyframes-DwR6GPej.js} +2 -2
  12. package/dist/chunks/{keyframes-F6vp6tZZ.js.map → keyframes-DwR6GPej.js.map} +1 -1
  13. package/dist/chunks/{registry-D8LAoXI-.js → registry-D87dP_aR.js} +3 -3
  14. package/dist/chunks/{registry-D8LAoXI-.js.map → registry-D87dP_aR.js.map} +1 -1
  15. package/dist/chunks/{registry-dr1CPTk1.cjs → registry-DhKZCitb.cjs} +2 -2
  16. package/dist/chunks/{registry-dr1CPTk1.cjs.map → registry-DhKZCitb.cjs.map} +1 -1
  17. package/dist/chunks/{ticker-Do9bGsaV.js → ticker-CJYI5Pxc.js} +2 -2
  18. package/dist/chunks/{ticker-Do9bGsaV.js.map → ticker-CJYI5Pxc.js.map} +1 -1
  19. package/dist/chunks/{ticker-DaAlEyOd.cjs → ticker-jD9_A9Rh.cjs} +2 -2
  20. package/dist/chunks/{ticker-DaAlEyOd.cjs.map → ticker-jD9_A9Rh.cjs.map} +1 -1
  21. package/dist/chunks/{tween-CmkdSyaC.cjs → tween-Dk0QmNe9.cjs} +2 -2
  22. package/dist/chunks/{tween-CmkdSyaC.cjs.map → tween-Dk0QmNe9.cjs.map} +1 -1
  23. package/dist/chunks/{tween-BzCGq_Ba.js → tween-_Lld1MsF.js} +2 -2
  24. package/dist/chunks/{tween-BzCGq_Ba.js.map → tween-_Lld1MsF.js.map} +1 -1
  25. package/dist/components/ai.cjs +314 -0
  26. package/dist/components/ai.cjs.map +1 -0
  27. package/dist/components/ai.d.cts +58 -0
  28. package/dist/components/ai.d.ts +58 -0
  29. package/dist/components/ai.js +311 -0
  30. package/dist/components/ai.js.map +1 -0
  31. package/dist/components/widgets.cjs +598 -226
  32. package/dist/components/widgets.cjs.map +1 -1
  33. package/dist/components/widgets.d.cts +438 -35
  34. package/dist/components/widgets.d.ts +438 -35
  35. package/dist/components/widgets.js +596 -227
  36. package/dist/components/widgets.js.map +1 -1
  37. package/dist/llms-full.txt +98 -1
  38. package/dist/llms.txt +6 -2
  39. package/dist/manifest.json +238 -1
  40. package/dist/runtime/format-apng.cjs +4 -4
  41. package/dist/runtime/format-apng.js +4 -4
  42. package/dist/runtime/format-css.cjs +4 -4
  43. package/dist/runtime/format-css.js +4 -4
  44. package/dist/runtime/format-gif.cjs +4 -4
  45. package/dist/runtime/format-gif.js +4 -4
  46. package/dist/runtime/format-gltf.cjs +1 -1
  47. package/dist/runtime/format-gltf.js +1 -1
  48. package/dist/runtime/format-motion.cjs +4 -4
  49. package/dist/runtime/format-motion.js +4 -4
  50. package/dist/runtime/format-obj.cjs +1 -1
  51. package/dist/runtime/format-obj.js +1 -1
  52. package/dist/runtime/format-scene.cjs +241 -0
  53. package/dist/runtime/format-scene.cjs.map +1 -0
  54. package/dist/runtime/format-scene.d.cts +349 -0
  55. package/dist/runtime/format-scene.d.ts +349 -0
  56. package/dist/runtime/format-scene.iife.js +2 -0
  57. package/dist/runtime/format-scene.iife.js.map +1 -0
  58. package/dist/runtime/format-scene.js +233 -0
  59. package/dist/runtime/format-scene.js.map +1 -0
  60. package/dist/runtime/format-sprite.cjs +3 -3
  61. package/dist/runtime/format-sprite.js +3 -3
  62. package/dist/runtime/format-svg.cjs +3 -3
  63. package/dist/runtime/format-svg.js +3 -3
  64. package/dist/runtime/format-webp.cjs +4 -4
  65. package/dist/runtime/format-webp.js +4 -4
  66. package/dist/runtime/gl.cjs +1 -1
  67. package/dist/runtime/gl.js +1 -1
  68. package/dist/runtime/physics.cjs +739 -0
  69. package/dist/runtime/physics.cjs.map +1 -0
  70. package/dist/runtime/physics.d.cts +250 -0
  71. package/dist/runtime/physics.d.ts +250 -0
  72. package/dist/runtime/physics.iife.js +2 -0
  73. package/dist/runtime/physics.iife.js.map +1 -0
  74. package/dist/runtime/physics.js +731 -0
  75. package/dist/runtime/physics.js.map +1 -0
  76. package/dist/runtime/scroll.cjs +2 -2
  77. package/dist/runtime/scroll.js +2 -2
  78. package/dist/runtime/smooth.cjs +1 -1
  79. package/dist/runtime/smooth.js +1 -1
  80. package/dist/runtime/text.cjs +1 -1
  81. package/dist/runtime/text.js +1 -1
  82. package/dist/runtime/vector.cjs +3 -3
  83. package/dist/runtime/vector.js +3 -3
  84. package/dist/runtime.cjs +3 -3
  85. package/dist/runtime.d.cts +1 -1
  86. package/dist/runtime.d.ts +1 -1
  87. package/dist/runtime.iife.js +1 -1
  88. package/dist/runtime.iife.js.map +1 -1
  89. package/dist/runtime.js +5 -5
  90. package/dist/widgets.umd.js +1 -1
  91. package/dist/widgets.umd.js.map +1 -1
  92. package/docs/ROADMAP.md +1 -1
  93. package/docs/components/README.md +3 -1
  94. package/docs/components/usa-motion-prompt.md +32 -0
  95. package/docs/components/usa-physics-playground.md +63 -0
  96. package/docs/components.md +44 -0
  97. package/docs/runtime/format-scene.md +59 -0
  98. package/docs/runtime/physics.md +61 -0
  99. package/package.json +31 -1
@@ -1 +1 @@
1
- {"version":3,"file":"tween-BzCGq_Ba.js","sources":["../../src/runtime/tween.ts"],"sourcesContent":["/**\n * Tween + timeline engine (original implementation). Times are in\n * milliseconds. Targets are plain objects (numeric props) or elements\n * (CSS: numbers with units, colours, `opacity`, custom properties, and the\n * transform shorthands `x y rotate scale scaleX scaleY skewX skewY`,\n * composed in that order). Driven by the shared ticker; a tween placed in a\n * timeline is driven by the timeline instead.\n */\nimport { getTicker } from './ticker';\nimport { parseEase, type Ease } from './ease';\n\nexport type Target = object | Element;\nexport type Props = Record<string, number | string>;\n\nexport interface PlayOptions {\n /** Delay before the first iteration, ms. */\n delay?: number;\n /** Extra iterations (-1 = forever). */\n repeat?: number;\n /** Alternate direction on every other iteration. */\n yoyo?: boolean;\n /** Start paused (`play()` to start). */\n paused?: boolean;\n onUpdate?: (progress: number) => void;\n onComplete?: () => void;\n}\n\nexport interface TweenOptions extends PlayOptions {\n to?: Props;\n from?: Props;\n /** ms (default 600). */\n duration?: number;\n ease?: string | Ease;\n /** Delay added per target index (ms) when several targets are given. */\n stagger?: number;\n}\n\nconst TRANSFORM = ['x', 'y', 'rotate', 'scale', 'scaleX', 'scaleY', 'skewX', 'skewY'];\nconst DEFAULT_UNIT: Record<string, string> = { x: 'px', y: 'px', rotate: 'deg', skewX: 'deg', skewY: 'deg', scale: '', scaleX: '', scaleY: '' };\ntype TState = Record<string, { v: number; u: string }>;\nconst tstate = new WeakMap<Element, TState>();\n\nconst isEl = (t: unknown): t is HTMLElement => typeof Element !== 'undefined' && t instanceof Element;\n\ninterface Num { kind: 'num'; v: number; u: string }\ninterface Col { kind: 'col'; c: number[] }\n/** Any other string: its numbers are interpolated when both ends share the same text around them. */\ninterface Str { kind: 'str'; s: string; parts: string[]; nums: number[] }\ntype Val = Num | Col | Str;\nconst NUM_RE = /-?(?:\\d+\\.?\\d*|\\.\\d+)(?:e-?\\d+)?/gi;\n\n/** Parse '12px', '-3.5', '50%', '#0af', 'rgb(1 2 3 / .5)', 'rgba(…)'. */\nexport function parseValue(v: number | string): Val {\n if (typeof v === 'number') return { kind: 'num', v, u: '' };\n const s = v.trim();\n let m = /^#([0-9a-f]{3,8})$/i.exec(s);\n if (m) {\n let h = m[1];\n if (h.length <= 4) h = h.split('').map((c) => c + c).join('');\n const n = (i: number) => parseInt(h.slice(i, i + 2), 16);\n return { kind: 'col', c: [n(0), n(2), n(4), h.length === 8 ? n(6) / 255 : 1] };\n }\n m = /^rgba?\\(([^)]+)\\)$/i.exec(s);\n if (m) {\n const p = m[1].split(/[\\s,/]+/).filter(Boolean).map((x) => (x.endsWith('%') ? (parseFloat(x) / 100) * 255 : parseFloat(x)));\n return { kind: 'col', c: [p[0], p[1], p[2], p[3] === undefined ? 1 : p[3] > 1 ? p[3] / 255 : p[3]] };\n }\n if (s === 'transparent') return { kind: 'col', c: [0, 0, 0, 0] };\n m = /^(-?[\\d.]+(?:e-?\\d+)?)([a-z%]*)$/i.exec(s);\n if (m) return { kind: 'num', v: parseFloat(m[1]), u: m[2] };\n return { kind: 'str', s, parts: s.split(NUM_RE), nums: (s.match(NUM_RE) || []).map(Number) };\n}\n\nconst lerpVal = (a: Val, b: Val, p: number): string | number => {\n if (a.kind === 'str' || b.kind === 'str') {\n if (a.kind === 'str' && b.kind === 'str' && a.parts.join('\\u0000') === b.parts.join('\\u0000') && a.nums.length === b.nums.length) {\n return a.parts.map((t, i) => t + (i < a.nums.length ? +(a.nums[i] + (b.nums[i] - a.nums[i]) * p).toFixed(4) : '')).join('');\n }\n const src = p < 0.5 ? a : b;\n return src.kind === 'str' ? src.s : src.kind === 'num' ? (src.u ? src.v + src.u : src.v) : `rgba(${src.c.join(', ')})`;\n }\n if (a.kind === 'col' || b.kind === 'col') {\n const ca = a.kind === 'col' ? a.c : [0, 0, 0, 0], cb = b.kind === 'col' ? b.c : [0, 0, 0, 0];\n const c = ca.map((x, i) => x + (cb[i] - x) * p);\n return `rgba(${Math.round(c[0])}, ${Math.round(c[1])}, ${Math.round(c[2])}, ${+c[3].toFixed(3)})`;\n }\n const v = a.v + (b.v - a.v) * p;\n const u = b.u || a.u;\n return u ? `${+v.toFixed(4)}${u}` : +v.toFixed(6);\n};\n\nconst kebab = (k: string) => (k.startsWith('--') ? k : k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase()));\n\nfunction readProp(t: Target, k: string): number | string {\n if (!isEl(t)) return (t as any)[k] ?? 0;\n if (TRANSFORM.includes(k)) {\n const s = tstate.get(t)?.[k];\n return s ? s.v + s.u : k.startsWith('scale') ? 1 : 0;\n }\n const inline = t.style.getPropertyValue(kebab(k));\n if (inline) return inline;\n const cs = typeof getComputedStyle === 'function' ? getComputedStyle(t).getPropertyValue(kebab(k)) : '';\n return cs || (k === 'opacity' ? 1 : 0);\n}\n\nfunction writeTransform(el: HTMLElement): void {\n const s = tstate.get(el)!;\n const g = (k: string, d: number) => (s[k] ? s[k].v : d);\n const u = (k: string) => (s[k]?.u ?? DEFAULT_UNIT[k]);\n const parts: string[] = [];\n if (s.x || s.y) parts.push(`translate(${g('x', 0)}${u('x') || 'px'}, ${g('y', 0)}${u('y') || 'px'})`);\n if (s.rotate) parts.push(`rotate(${g('rotate', 0)}${u('rotate') || 'deg'})`);\n if (s.scale) parts.push(`scale(${g('scale', 1)})`);\n if (s.scaleX || s.scaleY) parts.push(`scale(${g('scaleX', 1)}, ${g('scaleY', 1)})`);\n if (s.skewX) parts.push(`skewX(${g('skewX', 0)}${u('skewX') || 'deg'})`);\n if (s.skewY) parts.push(`skewY(${g('skewY', 0)}${u('skewY') || 'deg'})`);\n el.style.transform = parts.join(' ');\n}\n\nfunction writeProp(t: Target, k: string, v: string | number): void {\n if (!isEl(t)) {\n (t as any)[k] = typeof v === 'string' && typeof (t as any)[k] === 'number' ? parseFloat(v) : v;\n return;\n }\n if (TRANSFORM.includes(k)) {\n const p = parseValue(v) as Num;\n if (p.kind !== 'num') throw new Error(`[motionary] ${k} needs a number (got \"${v}\")`);\n const s = tstate.get(t) || {};\n s[k] = { v: p.v, u: p.u };\n tstate.set(t, s);\n return;\n }\n t.style.setProperty(kebab(k), typeof v === 'number' && !['opacity', 'zIndex', 'z-index'].includes(k) && !k.startsWith('--') ? v + 'px' : String(v));\n}\n\n/** Common playback: delay, repeat, yoyo, direction, ticker attachment, promise. */\nexport abstract class Playable {\n delay: number;\n repeat: number;\n yoyo: boolean;\n /** Playback rate multiplier. */\n timeScale = 1;\n onUpdate?: (progress: number) => void;\n onComplete?: () => void;\n protected _t = 0;\n private _dir = 1;\n private _off: (() => void) | null = null;\n private _done = false;\n private _resolve!: () => void;\n /** Resolves on completion (forward end, or start when reversed). */\n finished: Promise<void>;\n /** Set when owned by a timeline (then the ticker never drives it). */\n parent: Timeline | null = null;\n\n constructor(o: PlayOptions) {\n this.delay = o.delay || 0;\n this.repeat = o.repeat || 0;\n this.yoyo = !!o.yoyo;\n this.onUpdate = o.onUpdate;\n this.onComplete = o.onComplete;\n this.finished = new Promise((r) => (this._resolve = r));\n }\n /** One iteration, ms. */\n abstract get duration(): number;\n /** Render at `ms` into one iteration. */\n protected abstract renderLocal(ms: number, iterationEnded: boolean): void;\n\n get totalDuration(): number {\n return this.repeat < 0 ? Infinity : this.delay + this.duration * (this.repeat + 1);\n }\n get time(): number {\n return this._t;\n }\n get progress(): number {\n const td = this.totalDuration;\n return td === Infinity ? ((this._t - this.delay) % this.duration) / this.duration : td ? this._t / td : 1;\n }\n set progress(p: number) {\n this.seek(p * (this.totalDuration === Infinity ? this.delay + this.duration : this.totalDuration));\n }\n get isActive(): boolean {\n return !!this._off;\n }\n get reversed(): boolean {\n return this._dir < 0;\n }\n\n /** Jump to `ms` (total time, including the delay) and render. */\n seek(ms: number): this {\n const td = this.totalDuration;\n this._t = Math.max(0, Math.min(ms, td));\n const t = this._t - this.delay;\n const d = this.duration || 0;\n if (t < 0) this.renderLocal(0, false);\n else if (!d) this.renderLocal(0, true);\n else {\n let it = d === Infinity ? 0 : Math.floor(t / d);\n let local = d === Infinity ? t : t - it * d;\n if (t >= td - this.delay && td !== Infinity) {\n it = this.repeat;\n local = d;\n }\n const back = this.yoyo && it % 2 === 1;\n this.renderLocal(back ? d - local : local, local === d);\n }\n this.onUpdate?.(this.progress);\n return this;\n }\n\n play(): this {\n this._dir = 1;\n if (this._t >= this.totalDuration) this._t = 0;\n return this.attach();\n }\n pause(): this {\n this._off?.();\n this._off = null;\n return this;\n }\n /** Play backwards from the current time. */\n reverse(): this {\n this._dir = -1;\n if (this._t <= 0) this._t = this.totalDuration === Infinity ? this.delay + this.duration : this.totalDuration;\n return this.attach();\n }\n restart(): this {\n this._done = false;\n this.seek(0);\n return this.play();\n }\n /** Stop and detach for good. */\n kill(): void {\n this.pause();\n this.parent?.remove(this);\n }\n /** Promise-like: `await tween(...)`. */\n then<R>(ok?: (v: void) => R, err?: (e: unknown) => R): Promise<R> {\n return this.finished.then(ok, err);\n }\n\n private attach(): this {\n if (this.parent || this._off) return this;\n this._done = false;\n this._off = getTicker().add((_, dt) => this.advance(dt));\n return this;\n }\n private advance(dt: number): void {\n const td = this.totalDuration;\n this.seek(this._t + dt * this._dir * this.timeScale);\n if ((this._dir > 0 && this._t >= td) || (this._dir < 0 && this._t <= 0)) this.complete();\n }\n protected complete(): void {\n this.pause();\n if (this._done) return;\n this._done = true;\n this.onComplete?.();\n this._resolve();\n }\n}\n\ninterface Track { k: string; from?: Val; to: Val; fromRaw?: number | string; toRaw: number | string }\n\n/** A tween of one target. */\nexport class Tween extends Playable {\n readonly target: Target;\n private _dur: number;\n private ease: Ease;\n private tracks: Track[] | null = null;\n private toProps: Props;\n private fromProps: Props;\n constructor(target: Target, o: TweenOptions) {\n super(o);\n this.target = target;\n this._dur = o.duration ?? 600;\n this.ease = parseEase(o.ease);\n this.toProps = o.to || {};\n this.fromProps = o.from || {};\n }\n get duration(): number {\n return this._dur;\n }\n /** Capture start values (first render). */\n private init(): Track[] {\n const keys = Array.from(new Set([...Object.keys(this.fromProps), ...Object.keys(this.toProps)]));\n return keys.map((k) => {\n const fromRaw = k in this.fromProps ? this.fromProps[k] : readProp(this.target, k);\n const toRaw = k in this.toProps ? this.toProps[k] : readProp(this.target, k);\n return { k, fromRaw, toRaw, from: parseValue(fromRaw), to: parseValue(toRaw) };\n });\n }\n protected renderLocal(ms: number, ended: boolean): void {\n this.tracks ||= this.init();\n const p = this._dur ? (ended ? this.ease(ms >= this._dur ? 1 : 0) : this.ease(ms / this._dur)) : 1;\n let tr = false;\n for (const t of this.tracks) {\n writeProp(this.target, t.k, lerpVal(t.from!, t.to, p));\n if (TRANSFORM.includes(t.k)) tr = true;\n }\n if (tr && isEl(this.target)) writeTransform(this.target);\n }\n}\n\ntype Child = { item: Playable | (() => void); start: number; fired?: boolean };\n\n/** Position: ms number, '<' (start of previous), '>' (end of previous, default), '+=200' / '-=200' (relative to the end), 'label', 'label+=100', '<+=100'. */\nexport type Position = number | string;\n\nexport interface TimelineOptions extends PlayOptions {\n /** Defaults merged into every `.to()`. */\n defaults?: Omit<TweenOptions, 'to' | 'from'>;\n}\n\n/** A sequence of tweens, nested timelines and callbacks. */\nexport class Timeline extends Playable {\n private children: Child[] = [];\n private labels: Record<string, number> = {};\n private prevStart = 0;\n private prevEnd = 0;\n private defaults: TimelineOptions['defaults'];\n private lastLocal = 0;\n constructor(o: TimelineOptions = {}) {\n super(o);\n this.defaults = o.defaults;\n }\n get duration(): number {\n let d = 0;\n for (const c of this.children) d = Math.max(d, c.start + (typeof c.item === 'function' ? 0 : c.item.totalDuration));\n return d;\n }\n private resolve(pos: Position | undefined): number {\n if (pos === undefined || pos === '>') return this.prevEnd;\n if (typeof pos === 'number') return Math.max(0, pos);\n const m = /^([<>]|[\\w-]+)?\\s*(?:([+-])=\\s*([\\d.]+))?$/.exec(pos.trim());\n if (!m) throw new Error(`[motionary] bad timeline position \"${pos}\"`);\n let base = this.prevEnd;\n if (m[1] === '<') base = this.prevStart;\n else if (m[1] && m[1] !== '>') {\n if (!(m[1] in this.labels)) throw new Error(`[motionary] unknown timeline label \"${m[1]}\"`);\n base = this.labels[m[1]];\n }\n const off = m[2] ? (m[2] === '+' ? 1 : -1) * parseFloat(m[3]) : 0;\n return Math.max(0, base + off);\n }\n /** Add a tween, timeline or callback at a position. */\n add(item: Playable | (() => void), position?: Position): this {\n const start = this.resolve(position);\n if (typeof item !== 'function') {\n item.pause();\n item.parent = this;\n }\n this.children.push({ item, start });\n this.prevStart = start;\n this.prevEnd = start + (typeof item === 'function' ? 0 : item.totalDuration);\n return this;\n }\n /** `tween(target, vars)` placed at `position` (stagger across several targets). */\n to(target: Target | Target[] | ArrayLike<Target>, vars: TweenOptions, position?: Position): this {\n const list = toList(target);\n const start = this.resolve(position);\n let end = start;\n list.forEach((t, i) => {\n const tw = new Tween(t, { ...this.defaults, ...vars, delay: (vars.delay || 0) + (vars.stagger || 0) * i, paused: true });\n tw.parent = this;\n this.children.push({ item: tw, start });\n end = Math.max(end, start + tw.totalDuration);\n });\n this.prevStart = start;\n this.prevEnd = end;\n return this;\n }\n call(fn: () => void, position?: Position): this {\n return this.add(fn, position);\n }\n label(name: string, position?: Position): this {\n this.labels[name] = this.resolve(position);\n return this;\n }\n /** Time of a label, ms. */\n labelTime(name: string): number | undefined {\n return this.labels[name];\n }\n remove(item: Playable): void {\n this.children = this.children.filter((c) => c.item !== item);\n }\n /** Children in start order (callbacks excluded). */\n getChildren(): Playable[] {\n return this.children.filter((c) => typeof c.item !== 'function').map((c) => c.item as Playable);\n }\n protected renderLocal(ms: number): void {\n const forward = ms >= this.lastLocal;\n const list = [...this.children].sort((a, b) => (forward ? a.start - b.start : b.start - a.start));\n for (const c of list) {\n if (typeof c.item === 'function') {\n if (forward && !c.fired && ms >= c.start && this.lastLocal <= c.start) {\n c.fired = true;\n c.item();\n } else if (!forward && ms < c.start) c.fired = false;\n continue;\n }\n const local = ms - c.start;\n const p = c.item as Playable & { _started?: boolean };\n if (local < 0) {\n if (p._started) p.seek(0);\n continue;\n }\n p._started = true;\n p.seek(Math.min(local, p.totalDuration));\n }\n this.lastLocal = ms;\n }\n}\n\nfunction toList(t: Target | Target[] | ArrayLike<Target>): Target[] {\n if (Array.isArray(t)) return t;\n if (t && typeof (t as ArrayLike<Target>).length === 'number' && !isEl(t)) return Array.from(t as ArrayLike<Target>);\n return [t as Target];\n}\n\n/**\n * Tween one or more targets. Returns a `Tween` (or a `Timeline` holding one\n * tween per target when several are given) that starts on the next frame\n * unless `paused`. `await` it for completion.\n */\nexport function tween(target: Target | Target[] | ArrayLike<Target>, o: TweenOptions): Playable {\n const list = toList(target);\n let p: Playable;\n if (list.length === 1) p = new Tween(list[0], o);\n else {\n const tl = new Timeline({ repeat: o.repeat, yoyo: o.yoyo, onUpdate: o.onUpdate, onComplete: o.onComplete, delay: o.delay });\n tl.to(list, { ...o, delay: 0, repeat: 0, yoyo: false, onUpdate: undefined, onComplete: undefined }, 0);\n p = tl;\n }\n if (!o.paused) p.play();\n return p;\n}\n\n/** A new timeline (plays on the next frame unless `paused`). */\nexport function timeline(o: TimelineOptions = {}): Timeline {\n const tl = new Timeline(o);\n if (!o.paused) tl.play();\n return tl;\n}\n"],"names":[],"mappings":";;;AAAA;;;;;;;AAOG;AA8BH,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC;AACrF,MAAM,YAAY,GAA2B,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;AAE/I,MAAM,MAAM,GAAG,IAAI,OAAO,EAAmB;AAE7C,MAAM,IAAI,GAAG,CAAC,CAAU,KAAuB,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,YAAY,OAAO;AAOrG,MAAM,MAAM,GAAG,oCAAoC;AAEnD;AACM,SAAU,UAAU,CAAC,CAAkB,EAAA;IAC3C,IAAI,OAAO,CAAC,KAAK,Q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AC,CAAC,EAAE,CAAC,CAAC;SAC3C;AACH,QAAA,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;AAC3H,QAAA,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;QACtG,CAAC,GAAG,EAAE;IACR;IACA,IAAI,CAAC,CAAC,CAAC,MAAM;QAAE,CAAC,CAAC,IAAI,EAAE;AACvB,IAAA,OAAO,CAAC;AACV;AAEA;AACM,SAAU,QAAQ,CAAC,CAAA,GAAqB,EAAE,EAAA;AAC9C,IAAA,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC;IAC1B,IAAI,CAAC,CAAC,CAAC,MAAM;QAAE,EAAE,CAAC,IAAI,EAAE;AACxB,IAAA,OAAO,EAAE;AACX;;"}
1
+ {"version":3,"file":"tween-_Lld1MsF.js","sources":["../../src/runtime/tween.ts"],"sourcesContent":["/**\n * Tween + timeline engine (original implementation). Times are in\n * milliseconds. Targets are plain objects (numeric props) or elements\n * (CSS: numbers with units, colours, `opacity`, custom properties, and the\n * transform shorthands `x y rotate scale scaleX scaleY skewX skewY`,\n * composed in that order). Driven by the shared ticker; a tween placed in a\n * timeline is driven by the timeline instead.\n */\nimport { getTicker } from './ticker';\nimport { parseEase, type Ease } from './ease';\n\nexport type Target = object | Element;\nexport type Props = Record<string, number | string>;\n\nexport interface PlayOptions {\n /** Delay before the first iteration, ms. */\n delay?: number;\n /** Extra iterations (-1 = forever). */\n repeat?: number;\n /** Alternate direction on every other iteration. */\n yoyo?: boolean;\n /** Start paused (`play()` to start). */\n paused?: boolean;\n onUpdate?: (progress: number) => void;\n onComplete?: () => void;\n}\n\nexport interface TweenOptions extends PlayOptions {\n to?: Props;\n from?: Props;\n /** ms (default 600). */\n duration?: number;\n ease?: string | Ease;\n /** Delay added per target index (ms) when several targets are given. */\n stagger?: number;\n}\n\nconst TRANSFORM = ['x', 'y', 'rotate', 'scale', 'scaleX', 'scaleY', 'skewX', 'skewY'];\nconst DEFAULT_UNIT: Record<string, string> = { x: 'px', y: 'px', rotate: 'deg', skewX: 'deg', skewY: 'deg', scale: '', scaleX: '', scaleY: '' };\ntype TState = Record<string, { v: number; u: string }>;\nconst tstate = new WeakMap<Element, TState>();\n\nconst isEl = (t: unknown): t is HTMLElement => typeof Element !== 'undefined' && t instanceof Element;\n\ninterface Num { kind: 'num'; v: number; u: string }\ninterface Col { kind: 'col'; c: number[] }\n/** Any other string: its numbers are interpolated when both ends share the same text around them. */\ninterface Str { kind: 'str'; s: string; parts: string[]; nums: number[] }\ntype Val = Num | Col | Str;\nconst NUM_RE = /-?(?:\\d+\\.?\\d*|\\.\\d+)(?:e-?\\d+)?/gi;\n\n/** Parse '12px', '-3.5', '50%', '#0af', 'rgb(1 2 3 / .5)', 'rgba(…)'. */\nexport function parseValue(v: number | string): Val {\n if (typeof v === 'number') return { kind: 'num', v, u: '' };\n const s = v.trim();\n let m = /^#([0-9a-f]{3,8})$/i.exec(s);\n if (m) {\n let h = m[1];\n if (h.length <= 4) h = h.split('').map((c) => c + c).join('');\n const n = (i: number) => parseInt(h.slice(i, i + 2), 16);\n return { kind: 'col', c: [n(0), n(2), n(4), h.length === 8 ? n(6) / 255 : 1] };\n }\n m = /^rgba?\\(([^)]+)\\)$/i.exec(s);\n if (m) {\n const p = m[1].split(/[\\s,/]+/).filter(Boolean).map((x) => (x.endsWith('%') ? (parseFloat(x) / 100) * 255 : parseFloat(x)));\n return { kind: 'col', c: [p[0], p[1], p[2], p[3] === undefined ? 1 : p[3] > 1 ? p[3] / 255 : p[3]] };\n }\n if (s === 'transparent') return { kind: 'col', c: [0, 0, 0, 0] };\n m = /^(-?[\\d.]+(?:e-?\\d+)?)([a-z%]*)$/i.exec(s);\n if (m) return { kind: 'num', v: parseFloat(m[1]), u: m[2] };\n return { kind: 'str', s, parts: s.split(NUM_RE), nums: (s.match(NUM_RE) || []).map(Number) };\n}\n\nconst lerpVal = (a: Val, b: Val, p: number): string | number => {\n if (a.kind === 'str' || b.kind === 'str') {\n if (a.kind === 'str' && b.kind === 'str' && a.parts.join('\\u0000') === b.parts.join('\\u0000') && a.nums.length === b.nums.length) {\n return a.parts.map((t, i) => t + (i < a.nums.length ? +(a.nums[i] + (b.nums[i] - a.nums[i]) * p).toFixed(4) : '')).join('');\n }\n const src = p < 0.5 ? a : b;\n return src.kind === 'str' ? src.s : src.kind === 'num' ? (src.u ? src.v + src.u : src.v) : `rgba(${src.c.join(', ')})`;\n }\n if (a.kind === 'col' || b.kind === 'col') {\n const ca = a.kind === 'col' ? a.c : [0, 0, 0, 0], cb = b.kind === 'col' ? b.c : [0, 0, 0, 0];\n const c = ca.map((x, i) => x + (cb[i] - x) * p);\n return `rgba(${Math.round(c[0])}, ${Math.round(c[1])}, ${Math.round(c[2])}, ${+c[3].toFixed(3)})`;\n }\n const v = a.v + (b.v - a.v) * p;\n const u = b.u || a.u;\n return u ? `${+v.toFixed(4)}${u}` : +v.toFixed(6);\n};\n\nconst kebab = (k: string) => (k.startsWith('--') ? k : k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase()));\n\nfunction readProp(t: Target, k: string): number | string {\n if (!isEl(t)) return (t as any)[k] ?? 0;\n if (TRANSFORM.includes(k)) {\n const s = tstate.get(t)?.[k];\n return s ? s.v + s.u : k.startsWith('scale') ? 1 : 0;\n }\n const inline = t.style.getPropertyValue(kebab(k));\n if (inline) return inline;\n const cs = typeof getComputedStyle === 'function' ? getComputedStyle(t).getPropertyValue(kebab(k)) : '';\n return cs || (k === 'opacity' ? 1 : 0);\n}\n\nfunction writeTransform(el: HTMLElement): void {\n const s = tstate.get(el)!;\n const g = (k: string, d: number) => (s[k] ? s[k].v : d);\n const u = (k: string) => (s[k]?.u ?? DEFAULT_UNIT[k]);\n const parts: string[] = [];\n if (s.x || s.y) parts.push(`translate(${g('x', 0)}${u('x') || 'px'}, ${g('y', 0)}${u('y') || 'px'})`);\n if (s.rotate) parts.push(`rotate(${g('rotate', 0)}${u('rotate') || 'deg'})`);\n if (s.scale) parts.push(`scale(${g('scale', 1)})`);\n if (s.scaleX || s.scaleY) parts.push(`scale(${g('scaleX', 1)}, ${g('scaleY', 1)})`);\n if (s.skewX) parts.push(`skewX(${g('skewX', 0)}${u('skewX') || 'deg'})`);\n if (s.skewY) parts.push(`skewY(${g('skewY', 0)}${u('skewY') || 'deg'})`);\n el.style.transform = parts.join(' ');\n}\n\nfunction writeProp(t: Target, k: string, v: string | number): void {\n if (!isEl(t)) {\n (t as any)[k] = typeof v === 'string' && typeof (t as any)[k] === 'number' ? parseFloat(v) : v;\n return;\n }\n if (TRANSFORM.includes(k)) {\n const p = parseValue(v) as Num;\n if (p.kind !== 'num') throw new Error(`[motionary] ${k} needs a number (got \"${v}\")`);\n const s = tstate.get(t) || {};\n s[k] = { v: p.v, u: p.u };\n tstate.set(t, s);\n return;\n }\n t.style.setProperty(kebab(k), typeof v === 'number' && !['opacity', 'zIndex', 'z-index'].includes(k) && !k.startsWith('--') ? v + 'px' : String(v));\n}\n\n/** Common playback: delay, repeat, yoyo, direction, ticker attachment, promise. */\nexport abstract class Playable {\n delay: number;\n repeat: number;\n yoyo: boolean;\n /** Playback rate multiplier. */\n timeScale = 1;\n onUpdate?: (progress: number) => void;\n onComplete?: () => void;\n protected _t = 0;\n private _dir = 1;\n private _off: (() => void) | null = null;\n private _done = false;\n private _resolve!: () => void;\n /** Resolves on completion (forward end, or start when reversed). */\n finished: Promise<void>;\n /** Set when owned by a timeline (then the ticker never drives it). */\n parent: Timeline | null = null;\n\n constructor(o: PlayOptions) {\n this.delay = o.delay || 0;\n this.repeat = o.repeat || 0;\n this.yoyo = !!o.yoyo;\n this.onUpdate = o.onUpdate;\n this.onComplete = o.onComplete;\n this.finished = new Promise((r) => (this._resolve = r));\n }\n /** One iteration, ms. */\n abstract get duration(): number;\n /** Render at `ms` into one iteration. */\n protected abstract renderLocal(ms: number, iterationEnded: boolean): void;\n\n get totalDuration(): number {\n return this.repeat < 0 ? Infinity : this.delay + this.duration * (this.repeat + 1);\n }\n get time(): number {\n return this._t;\n }\n get progress(): number {\n const td = this.totalDuration;\n return td === Infinity ? ((this._t - this.delay) % this.duration) / this.duration : td ? this._t / td : 1;\n }\n set progress(p: number) {\n this.seek(p * (this.totalDuration === Infinity ? this.delay + this.duration : this.totalDuration));\n }\n get isActive(): boolean {\n return !!this._off;\n }\n get reversed(): boolean {\n return this._dir < 0;\n }\n\n /** Jump to `ms` (total time, including the delay) and render. */\n seek(ms: number): this {\n const td = this.totalDuration;\n this._t = Math.max(0, Math.min(ms, td));\n const t = this._t - this.delay;\n const d = this.duration || 0;\n if (t < 0) this.renderLocal(0, false);\n else if (!d) this.renderLocal(0, true);\n else {\n let it = d === Infinity ? 0 : Math.floor(t / d);\n let local = d === Infinity ? t : t - it * d;\n if (t >= td - this.delay && td !== Infinity) {\n it = this.repeat;\n local = d;\n }\n const back = this.yoyo && it % 2 === 1;\n this.renderLocal(back ? d - local : local, local === d);\n }\n this.onUpdate?.(this.progress);\n return this;\n }\n\n play(): this {\n this._dir = 1;\n if (this._t >= this.totalDuration) this._t = 0;\n return this.attach();\n }\n pause(): this {\n this._off?.();\n this._off = null;\n return this;\n }\n /** Play backwards from the current time. */\n reverse(): this {\n this._dir = -1;\n if (this._t <= 0) this._t = this.totalDuration === Infinity ? this.delay + this.duration : this.totalDuration;\n return this.attach();\n }\n restart(): this {\n this._done = false;\n this.seek(0);\n return this.play();\n }\n /** Stop and detach for good. */\n kill(): void {\n this.pause();\n this.parent?.remove(this);\n }\n /** Promise-like: `await tween(...)`. */\n then<R>(ok?: (v: void) => R, err?: (e: unknown) => R): Promise<R> {\n return this.finished.then(ok, err);\n }\n\n private attach(): this {\n if (this.parent || this._off) return this;\n this._done = false;\n this._off = getTicker().add((_, dt) => this.advance(dt));\n return this;\n }\n private advance(dt: number): void {\n const td = this.totalDuration;\n this.seek(this._t + dt * this._dir * this.timeScale);\n if ((this._dir > 0 && this._t >= td) || (this._dir < 0 && this._t <= 0)) this.complete();\n }\n protected complete(): void {\n this.pause();\n if (this._done) return;\n this._done = true;\n this.onComplete?.();\n this._resolve();\n }\n}\n\ninterface Track { k: string; from?: Val; to: Val; fromRaw?: number | string; toRaw: number | string }\n\n/** A tween of one target. */\nexport class Tween extends Playable {\n readonly target: Target;\n private _dur: number;\n private ease: Ease;\n private tracks: Track[] | null = null;\n private toProps: Props;\n private fromProps: Props;\n constructor(target: Target, o: TweenOptions) {\n super(o);\n this.target = target;\n this._dur = o.duration ?? 600;\n this.ease = parseEase(o.ease);\n this.toProps = o.to || {};\n this.fromProps = o.from || {};\n }\n get duration(): number {\n return this._dur;\n }\n /** Capture start values (first render). */\n private init(): Track[] {\n const keys = Array.from(new Set([...Object.keys(this.fromProps), ...Object.keys(this.toProps)]));\n return keys.map((k) => {\n const fromRaw = k in this.fromProps ? this.fromProps[k] : readProp(this.target, k);\n const toRaw = k in this.toProps ? this.toProps[k] : readProp(this.target, k);\n return { k, fromRaw, toRaw, from: parseValue(fromRaw), to: parseValue(toRaw) };\n });\n }\n protected renderLocal(ms: number, ended: boolean): void {\n this.tracks ||= this.init();\n const p = this._dur ? (ended ? this.ease(ms >= this._dur ? 1 : 0) : this.ease(ms / this._dur)) : 1;\n let tr = false;\n for (const t of this.tracks) {\n writeProp(this.target, t.k, lerpVal(t.from!, t.to, p));\n if (TRANSFORM.includes(t.k)) tr = true;\n }\n if (tr && isEl(this.target)) writeTransform(this.target);\n }\n}\n\ntype Child = { item: Playable | (() => void); start: number; fired?: boolean };\n\n/** Position: ms number, '<' (start of previous), '>' (end of previous, default), '+=200' / '-=200' (relative to the end), 'label', 'label+=100', '<+=100'. */\nexport type Position = number | string;\n\nexport interface TimelineOptions extends PlayOptions {\n /** Defaults merged into every `.to()`. */\n defaults?: Omit<TweenOptions, 'to' | 'from'>;\n}\n\n/** A sequence of tweens, nested timelines and callbacks. */\nexport class Timeline extends Playable {\n private children: Child[] = [];\n private labels: Record<string, number> = {};\n private prevStart = 0;\n private prevEnd = 0;\n private defaults: TimelineOptions['defaults'];\n private lastLocal = 0;\n constructor(o: TimelineOptions = {}) {\n super(o);\n this.defaults = o.defaults;\n }\n get duration(): number {\n let d = 0;\n for (const c of this.children) d = Math.max(d, c.start + (typeof c.item === 'function' ? 0 : c.item.totalDuration));\n return d;\n }\n private resolve(pos: Position | undefined): number {\n if (pos === undefined || pos === '>') return this.prevEnd;\n if (typeof pos === 'number') return Math.max(0, pos);\n const m = /^([<>]|[\\w-]+)?\\s*(?:([+-])=\\s*([\\d.]+))?$/.exec(pos.trim());\n if (!m) throw new Error(`[motionary] bad timeline position \"${pos}\"`);\n let base = this.prevEnd;\n if (m[1] === '<') base = this.prevStart;\n else if (m[1] && m[1] !== '>') {\n if (!(m[1] in this.labels)) throw new Error(`[motionary] unknown timeline label \"${m[1]}\"`);\n base = this.labels[m[1]];\n }\n const off = m[2] ? (m[2] === '+' ? 1 : -1) * parseFloat(m[3]) : 0;\n return Math.max(0, base + off);\n }\n /** Add a tween, timeline or callback at a position. */\n add(item: Playable | (() => void), position?: Position): this {\n const start = this.resolve(position);\n if (typeof item !== 'function') {\n item.pause();\n item.parent = this;\n }\n this.children.push({ item, start });\n this.prevStart = start;\n this.prevEnd = start + (typeof item === 'function' ? 0 : item.totalDuration);\n return this;\n }\n /** `tween(target, vars)` placed at `position` (stagger across several targets). */\n to(target: Target | Target[] | ArrayLike<Target>, vars: TweenOptions, position?: Position): this {\n const list = toList(target);\n const start = this.resolve(position);\n let end = start;\n list.forEach((t, i) => {\n const tw = new Tween(t, { ...this.defaults, ...vars, delay: (vars.delay || 0) + (vars.stagger || 0) * i, paused: true });\n tw.parent = this;\n this.children.push({ item: tw, start });\n end = Math.max(end, start + tw.totalDuration);\n });\n this.prevStart = start;\n this.prevEnd = end;\n return this;\n }\n call(fn: () => void, position?: Position): this {\n return this.add(fn, position);\n }\n label(name: string, position?: Position): this {\n this.labels[name] = this.resolve(position);\n return this;\n }\n /** Time of a label, ms. */\n labelTime(name: string): number | undefined {\n return this.labels[name];\n }\n remove(item: Playable): void {\n this.children = this.children.filter((c) => c.item !== item);\n }\n /** Children in start order (callbacks excluded). */\n getChildren(): Playable[] {\n return this.children.filter((c) => typeof c.item !== 'function').map((c) => c.item as Playable);\n }\n protected renderLocal(ms: number): void {\n const forward = ms >= this.lastLocal;\n const list = [...this.children].sort((a, b) => (forward ? a.start - b.start : b.start - a.start));\n for (const c of list) {\n if (typeof c.item === 'function') {\n if (forward && !c.fired && ms >= c.start && this.lastLocal <= c.start) {\n c.fired = true;\n c.item();\n } else if (!forward && ms < c.start) c.fired = false;\n continue;\n }\n const local = ms - c.start;\n const p = c.item as Playable & { _started?: boolean };\n if (local < 0) {\n if (p._started) p.seek(0);\n continue;\n }\n p._started = true;\n p.seek(Math.min(local, p.totalDuration));\n }\n this.lastLocal = ms;\n }\n}\n\nfunction toList(t: Target | Target[] | ArrayLike<Target>): Target[] {\n if (Array.isArray(t)) return t;\n if (t && typeof (t as ArrayLike<Target>).length === 'number' && !isEl(t)) return Array.from(t as ArrayLike<Target>);\n return [t as Target];\n}\n\n/**\n * Tween one or more targets. Returns a `Tween` (or a `Timeline` holding one\n * tween per target when several are given) that starts on the next frame\n * unless `paused`. `await` it for completion.\n */\nexport function tween(target: Target | Target[] | ArrayLike<Target>, o: TweenOptions): Playable {\n const list = toList(target);\n let p: Playable;\n if (list.length === 1) p = new Tween(list[0], o);\n else {\n const tl = new Timeline({ repeat: o.repeat, yoyo: o.yoyo, onUpdate: o.onUpdate, onComplete: o.onComplete, delay: o.delay });\n tl.to(list, { ...o, delay: 0, repeat: 0, yoyo: false, onUpdate: undefined, onComplete: undefined }, 0);\n p = tl;\n }\n if (!o.paused) p.play();\n return p;\n}\n\n/** A new timeline (plays on the next frame unless `paused`). */\nexport function timeline(o: TimelineOptions = {}): Timeline {\n const tl = new Timeline(o);\n if (!o.paused) tl.play();\n return tl;\n}\n"],"names":[],"mappings":";;;AAAA;;;;;;;AAOG;AA8BH,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC;AACrF,MAAM,YAAY,GAA2B,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;AAE/I,MAAM,MAAM,GAAG,IAAI,OAAO,EAAmB;AAE7C,MAAM,IAAI,GAAG,CAAC,CAAU,KAAuB,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,YAAY,OAAO;AAOrG,MAAM,MAAM,GAAG,oCAAoC;AAEnD;AACM,SAAU,UAAU,CAAC,CAAkB,EAAA;IAC3C,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE;AAC3D,IAAA,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE;IAClB,IAAI,CAAC,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE;AACL,QAAA,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACZ,QAAA,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC;YAAE,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GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;QACtG,CAAC,GAAG,EAAE;IACR;IACA,IAAI,CAAC,CAAC,CAAC,MAAM;QAAE,CAAC,CAAC,IAAI,EAAE;AACvB,IAAA,OAAO,CAAC;AACV;AAEA;AACM,SAAU,QAAQ,CAAC,CAAA,GAAqB,EAAE,EAAA;AAC9C,IAAA,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAC;IAC1B,IAAI,CAAC,CAAC,CAAC,MAAM;QAAE,EAAE,CAAC,IAAI,EAAE;AACxB,IAAA,OAAO,EAAE;AACX;;"}
@@ -0,0 +1,314 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * `motionary/components/ai` (10.7, AI-assisted motion) — turns a short
5
+ * natural-language description ("fade the cards up slowly when they scroll
6
+ * into view, one after another") into a motion spec: effect, direction,
7
+ * distance, duration, delay, easing, trigger, repeat, stagger, Web
8
+ * Animations keyframes + options, a CSS rule and the Motionary components
9
+ * that do it. English and Chinese phrases. A small deterministic parser —
10
+ * no model, no network — shared by `<usa-motion-prompt>` and the
11
+ * `suggest_motion` tool of `motionary-mcp` (which runs an evaluation set of
12
+ * prompts against it in CI).
13
+ *
14
+ * Pure: no DOM access — safe in Node, workers and SSR.
15
+ */
16
+ const R = (re, v) => ({ re, v });
17
+ // effects, most specific first ("slide" before "fade" so "slide and fade in" picks slide as the main motion)
18
+ const EFFECTS = [
19
+ R(/type ?writer|typing|types? (?:out|in)|打字/, 'typewriter'),
20
+ R(/count(?:s|ing)? up|counter|tick(?:s|ing)? up|number(?:s)? (?:roll|count)|数字(?:滚动|增长)|计数/, 'count'),
21
+ R(/confetti|particles?|sparkles?|粒子|彩带|烟花/, 'particles'),
22
+ R(/marquee|ticker tape|scroll(?:s|ing)? (?:sideways|horizontally) (?:forever|endlessly)|跑马灯/, 'marquee'),
23
+ R(/parallax|视差/, 'parallax'),
24
+ R(/magnet(?:ic)?|follows? the (?:cursor|mouse|pointer)|磁吸|跟随(?:鼠标|光标)/, 'magnetic'),
25
+ R(/ripple|涟漪|水波/, 'ripple'),
26
+ R(/tilt|3d hover|倾斜/, 'tilt'),
27
+ R(/shake|wiggle|jiggle|wobble|tremble|抖动|摇晃|晃动/, 'shake'),
28
+ R(/pulse|pulsate|heartbeat|throb|breath(?:e|ing)|脉冲|呼吸|心跳/, 'pulse'),
29
+ R(/bounce|bouncing|bouncy entrance|弹跳|弹起|蹦/, 'bounce'),
30
+ R(/flip|翻转/, 'flip'),
31
+ R(/spin|rotate|rotating|rotation|turn(?:s|ing)? around|旋转|转动/, 'rotate'),
32
+ R(/reveal|wipe|unmask|clip(?:-| )path|揭示|遮罩|擦除/, 'reveal'),
33
+ R(/blur|unblur|focus in|模糊/, 'blur'),
34
+ R(/zoom|scale|grow|shrink|pop(?:s)? (?:in|out|up)|enlarge|缩放|放大|缩小|弹出/, 'zoom'),
35
+ R(/slide|slides|sliding|move(?:s)? in|fly(?:ing)? in|swoop|滑入|滑动|飞入|移入/, 'slide'),
36
+ R(/fade|fades|fading|appear|disappear|dissolve|淡入|淡出|渐显|渐隐|出现/, 'fade'),
37
+ ];
38
+ const DIRS = [
39
+ // explicit "from the …" first, so "slide in from the left" is not caught by the bare \bleft\b rule below
40
+ R(/from (?:the )?left|从左/, 'right'),
41
+ R(/from (?:the )?right|从右/, 'left'),
42
+ R(/from (?:the )?(?:top|above)|从上/, 'down'),
43
+ R(/from (?:the )?(?:bottom|below)|\bup\b|upward|rise|rises|从下(?:方|面)?|向上|上浮|升起/, 'up'),
44
+ R(/from (?:the )?(?:top|above)|\bdown\b|downward|drop(?:s)? (?:in|down)|fall(?:s)? in|从上(?:方|面)?|向下|落下/, 'down'),
45
+ R(/from (?:the )?right|\bleft(?:ward)?\b|向左|从右/, 'left'),
46
+ R(/from (?:the )?left|\bright(?:ward)?\b|向右|从左/, 'right'),
47
+ ];
48
+ const TRIGGERS = [
49
+ R(/hover|mouse ?over|on mouse|pointer (?:over|enter)|悬停|鼠标(?:移入|悬浮|经过)/, 'hover'),
50
+ R(/click|tap|press|点击|按下|轻触/, 'click'),
51
+ R(/scroll|in(?:to)? view|on screen|viewport|visible|as (?:you|the user) scroll|滚动|进入(?:视口|视野|屏幕)|可见/, 'scroll'),
52
+ R(/forever|infinite(?:ly)?|endless(?:ly)?|loop(?:s|ing)?|continuous(?:ly)?|repeat(?:s|edly|ing)?(?! once)|always|循环|一直|无限|反复/, 'loop'),
53
+ R(/on (?:page )?load|when the page loads|on (?:start|mount)|at start|页面加载|加载时|进入页面/, 'load'),
54
+ ];
55
+ const EASINGS = [
56
+ R(/spring(?:y)?|elastic|弹簧|弹性/, ['spring', 'cubic-bezier(0.34, 1.56, 0.64, 1)']),
57
+ R(/bouncy|overshoot|playful|回弹|俏皮/, ['bouncy', 'cubic-bezier(0.68, -0.55, 0.27, 1.55)']),
58
+ R(/linear(?:ly)?|constant speed|steady|匀速|线性/, ['linear', 'linear']),
59
+ R(/snappy|crisp|quick and sharp|干脆|利落/, ['snappy', 'cubic-bezier(0.2, 0.9, 0.1, 1)']),
60
+ R(/ease[- ]?in[- ]?out|smooth(?:ly)?|gentle|gently|soft(?:ly)?|subtle|平滑|柔和|顺滑|轻柔/, ['smooth', 'cubic-bezier(0.65, 0, 0.35, 1)']),
61
+ R(/ease[- ]?in\b|accelerat|speeds? up|加速/, ['ease-in', 'cubic-bezier(0.4, 0, 1, 1)']),
62
+ R(/ease[- ]?out|decelerat|slows? down|减速/, ['ease-out', 'cubic-bezier(0, 0, 0.2, 1)']),
63
+ ];
64
+ const num = (s) => parseFloat(s.replace(',', '.'));
65
+ function parseDuration(t, matched) {
66
+ const m = /(\d+(?:[.,]\d+)?)\s*(ms|milliseconds?|毫秒|s\b|secs?|seconds?|秒)/.exec(t);
67
+ if (m) {
68
+ matched.push(m[0]);
69
+ return Math.round(/^(ms|millisecond|毫秒)/.test(m[2]) ? num(m[1]) : num(m[1]) * 1000);
70
+ }
71
+ const w = [
72
+ [/very slow(?:ly)?|really slow|非常慢|很慢/, 1600],
73
+ [/slow(?:ly)?|leisurely|缓慢|慢慢|慢/, 1000],
74
+ [/very fast|really fast|instant(?:ly)?|非常快|很快|瞬间/, 180],
75
+ [/fast|quick(?:ly)?|rapid(?:ly)?|snappy|brisk|快速|快/, 300],
76
+ ];
77
+ for (const [re, v] of w) {
78
+ const x = re.exec(t);
79
+ if (x) {
80
+ matched.push(x[0]);
81
+ return v;
82
+ }
83
+ }
84
+ return null;
85
+ }
86
+ function parseDelay(t, matched) {
87
+ const m = /(?:after|delay(?:ed)?(?: by| of)?|wait(?:s|ing)?|延迟|等待)\s*(\d+(?:[.,]\d+)?)\s*(ms|毫秒|s\b|secs?|seconds?|秒)/.exec(t) ||
88
+ // "after a 300ms delay", "a 1 s delay", "延迟 300 毫秒" handled above; the number-first form here
89
+ /(?:after )?(?:a |an )?(\d+(?:[.,]\d+)?)\s*(ms|毫秒|s\b|secs?|seconds?|秒)\s*(?:-\s*)?(?:delay|pause|wait|后)/.exec(t);
90
+ if (!m)
91
+ return 0;
92
+ matched.push(m[0]);
93
+ return Math.round(/^(ms|毫秒)/.test(m[2]) ? num(m[1]) : num(m[1]) * 1000);
94
+ }
95
+ function parseStagger(t, matched) {
96
+ const m = /(\d+)\s*ms\s*(?:apart|between|stagger)|stagger(?:ed)?(?: by)?\s*(\d+)\s*ms/.exec(t);
97
+ if (m) {
98
+ matched.push(m[0]);
99
+ return +(m[1] || m[2]);
100
+ }
101
+ const w = /one (?:after|by) (?:another|one)|stagger(?:ed)?|in sequence|sequentially|each (?:card|item|word|letter|line) in turn|一个接一个|依次|逐个|交错/.exec(t);
102
+ if (w) {
103
+ matched.push(w[0]);
104
+ return 80;
105
+ }
106
+ return 0;
107
+ }
108
+ function parseIterations(t, trigger, matched) {
109
+ const m = /(\d+|once|twice|three times|一次|两次|三次)\s*(?:times|次)?/.exec(t.replace(/\d+(?:[.,]\d+)?\s*(?:ms|s\b|secs?|seconds?|毫秒|秒|px|%|deg|°)/g, ''));
110
+ if (trigger === 'loop')
111
+ return Infinity;
112
+ if (m && /once|一次/.test(m[1]))
113
+ return 1;
114
+ if (m && /twice|两次/.test(m[1]))
115
+ return (matched.push(m[0]), 2);
116
+ if (m && /three|三次/.test(m[1]))
117
+ return (matched.push(m[0]), 3);
118
+ if (m && /^\d+$/.test(m[1]) && /times|次/.test(m[0]))
119
+ return (matched.push(m[0]), +m[1]);
120
+ return 1;
121
+ }
122
+ function parseAmount(t, effect) {
123
+ const px = /(\d+)\s*(?:px|pixels?|像素)/.exec(t);
124
+ const deg = /(\d+)\s*(?:deg|degrees?|°|度)/.exec(t);
125
+ const pct = /(\d+)\s*%/.exec(t);
126
+ if (effect === 'slide' || effect === 'fade' || effect === 'bounce' || effect === 'shake')
127
+ return px ? +px[1] : effect === 'shake' ? 8 : effect === 'bounce' ? 24 : 32;
128
+ if (effect === 'rotate' || effect === 'flip')
129
+ return deg ? +deg[1] : effect === 'flip' ? 180 : /half/.test(t) ? 180 : 360;
130
+ if (effect === 'zoom') {
131
+ if (pct)
132
+ return +pct[1] / 100;
133
+ return /shrink|out\b|缩小/.test(t) ? 1.2 : 0.8;
134
+ }
135
+ if (effect === 'pulse')
136
+ return pct ? 1 + +pct[1] / 100 : 1.06;
137
+ if (effect === 'blur')
138
+ return px ? +px[1] : 8;
139
+ return 0;
140
+ }
141
+ const DIR_XY = { up: [0, 1], down: [0, -1], left: [1, 0], right: [-1, 0] };
142
+ function keyframesFor(i) {
143
+ const [dx, dy] = DIR_XY[i.direction || 'up'];
144
+ const fade = i.effect === 'fade' || i.also.includes('fade');
145
+ const from = {}, to = {};
146
+ const tf = [], tt = [];
147
+ switch (i.effect) {
148
+ case 'slide':
149
+ case 'fade':
150
+ if (i.effect === 'slide' || i.direction) {
151
+ tf.push(`translate(${dx * i.amount}px, ${dy * i.amount}px)`);
152
+ tt.push('translate(0px, 0px)');
153
+ }
154
+ break;
155
+ case 'zoom':
156
+ tf.push(`scale(${i.amount})`);
157
+ tt.push('scale(1)');
158
+ break;
159
+ case 'rotate':
160
+ tf.push(`rotate(${i.direction === 'left' ? -i.amount : i.amount}deg)`);
161
+ tt.push('rotate(0deg)');
162
+ break;
163
+ case 'flip':
164
+ tf.push(`perspective(600px) rotate${i.direction === 'left' || i.direction === 'right' ? 'Y' : 'X'}(${i.amount}deg)`);
165
+ tt.push(`perspective(600px) rotate${i.direction === 'left' || i.direction === 'right' ? 'Y' : 'X'}(0deg)`);
166
+ break;
167
+ case 'blur':
168
+ from.filter = `blur(${i.amount}px)`;
169
+ to.filter = 'blur(0px)';
170
+ break;
171
+ case 'reveal':
172
+ from.clipPath = i.direction === 'left' ? 'inset(0 0 0 100%)' : i.direction === 'right' ? 'inset(0 100% 0 0)' : i.direction === 'down' ? 'inset(0 0 100% 0)' : 'inset(100% 0 0 0)';
173
+ to.clipPath = 'inset(0 0 0 0)';
174
+ break;
175
+ case 'bounce':
176
+ return [
177
+ { transform: `translateY(${-i.amount}px)`, opacity: fade ? 0 : 1, offset: 0 },
178
+ { transform: 'translateY(0px)', opacity: 1, offset: 0.55 },
179
+ { transform: `translateY(${-i.amount * 0.35}px)`, offset: 0.75 },
180
+ { transform: 'translateY(0px)', offset: 1 },
181
+ ];
182
+ case 'shake':
183
+ return [0, 1, -1, 1, -1, 0].map((k, n, a) => ({ transform: `translateX(${k * i.amount}px)`, offset: n / (a.length - 1) }));
184
+ case 'pulse':
185
+ return [{ transform: 'scale(1)' }, { transform: `scale(${i.amount})` }, { transform: 'scale(1)' }];
186
+ }
187
+ if (i.also.includes('zoom') && i.effect !== 'zoom')
188
+ (tf.push('scale(0.85)'), tt.push('scale(1)'));
189
+ if (i.also.includes('rotate') && i.effect !== 'rotate')
190
+ (tf.push('rotate(-8deg)'), tt.push('rotate(0deg)'));
191
+ if (i.also.includes('blur') && i.effect !== 'blur')
192
+ (from.filter = 'blur(6px)'), (to.filter = 'blur(0px)');
193
+ if (tf.length)
194
+ (from.transform = tf.join(' ')), (to.transform = tt.join(' '));
195
+ if (fade || ['slide', 'zoom', 'blur', 'flip'].includes(i.effect))
196
+ (from.opacity = 0), (to.opacity = 1);
197
+ return [from, to];
198
+ }
199
+ const COMPONENTS = {
200
+ typewriter: [['usa-typewriter', 'types text out character by character', '<usa-typewriter text="Hello, Motionary"></usa-typewriter>']],
201
+ count: [['usa-counter', 'animates a number up when it scrolls into view', '<usa-counter to="1280" duration="1200"></usa-counter>']],
202
+ particles: [['usa-particles', 'particle field (Canvas 2D)', '<usa-particles count="80"></usa-particles>'], ['usa-gpu-particles', 'tens of thousands of GPU particles', '<usa-gpu-particles count="20000" mode="swirl"></usa-gpu-particles>']],
203
+ marquee: [['usa-marquee', 'endless horizontal scroller', '<usa-marquee speed="40"><span>…</span></usa-marquee>']],
204
+ parallax: [['usa-parallax-layers', 'layers move at different speeds while scrolling', '<usa-parallax-layers><img data-depth="0.2" src="…"></usa-parallax-layers>']],
205
+ magnetic: [['usa-magnetic', 'element follows the pointer a little', '<usa-magnetic><button>Hover me</button></usa-magnetic>']],
206
+ ripple: [['usa-ripple', 'material-style click ripple', '<usa-ripple><button>Click</button></usa-ripple>']],
207
+ tilt: [['usa-tilt', '3D tilt towards the pointer', '<usa-tilt><div class="card">…</div></usa-tilt>']],
208
+ reveal: [['usa-mask-reveal', 'clip-path reveal on scroll', '<usa-mask-reveal><img src="…"></usa-mask-reveal>'], ['usa-reveal', 'reveal on scroll', '<usa-reveal><div>…</div></usa-reveal>']],
209
+ scroll: [['usa-reveal', 'plays the entrance when the element scrolls into view', '<usa-reveal><div>…</div></usa-reveal>']],
210
+ };
211
+ /** Parse a natural-language motion description. */
212
+ function describeMotion(input) {
213
+ const text = String(input || '').trim();
214
+ const t = text.toLowerCase();
215
+ const matched = [];
216
+ const hits = EFFECTS.filter((r) => {
217
+ const m = r.re.exec(t);
218
+ if (m)
219
+ matched.push(m[0]);
220
+ return !!m;
221
+ }).map((r) => r.v);
222
+ let effect = hits[0] || 'fade';
223
+ // "fade in and slide up": the slide is the motion, the fade rides along
224
+ if (effect === 'fade' && hits.includes('slide'))
225
+ effect = 'slide';
226
+ const also = hits.filter((h) => h !== effect);
227
+ let direction = null;
228
+ for (const r of DIRS) {
229
+ const m = r.re.exec(t);
230
+ if (m && !/(?:in|out)$/.test(m[0]) && !(effect === 'zoom' && /\bup\b/.test(m[0]) && /pop/.test(t))) {
231
+ direction = r.v;
232
+ matched.push(m[0]);
233
+ break;
234
+ }
235
+ }
236
+ if (!direction && effect === 'slide')
237
+ direction = 'up';
238
+ let trigger = 'load';
239
+ const trig = TRIGGERS.filter((r) => r.re.test(t)).map((r) => r.v);
240
+ if (trig.length)
241
+ trigger = trig.includes('hover') ? 'hover' : trig.includes('click') ? 'click' : trig.includes('scroll') && !(trig.includes('loop') && /forever|infinite|endless|无限|一直/.test(t)) ? 'scroll' : trig[0];
242
+ if (['shake', 'pulse'].includes(effect) && trigger === 'load' && /attention|notify|提醒|注意/.test(t))
243
+ trigger = 'loop';
244
+ if (effect === 'marquee')
245
+ trigger = 'loop';
246
+ const easingHit = EASINGS.find((r) => r.re.test(t));
247
+ const easingName = easingHit ? easingHit.v[0] : effect === 'bounce' ? 'bouncy' : effect === 'shake' || effect === 'pulse' ? 'smooth' : 'ease-out';
248
+ const easing = easingHit ? easingHit.v[1] : easingName === 'bouncy' ? 'cubic-bezier(0.68, -0.55, 0.27, 1.55)' : easingName === 'smooth' ? 'cubic-bezier(0.65, 0, 0.35, 1)' : 'cubic-bezier(0, 0, 0.2, 1)';
249
+ if (easingHit)
250
+ matched.push(easingHit.re.exec(t)[0]);
251
+ const duration = parseDuration(t, matched) ?? (effect === 'shake' ? 500 : effect === 'pulse' ? 1200 : effect === 'typewriter' ? 1800 : effect === 'count' ? 1200 : 600);
252
+ const delay = parseDelay(t, matched);
253
+ const stagger = parseStagger(t, matched);
254
+ const iterations = parseIterations(t, trigger, matched);
255
+ const alternate = /back and forth|alternat|yoyo|ping[- ]?pong|往返|来回/.test(t) || (effect === 'pulse' && trigger === 'loop' && false);
256
+ const amount = parseAmount(t, effect);
257
+ const kf = keyframesFor({ effect, also, direction, amount });
258
+ const options = { duration, delay, easing, fill: 'both', iterations, ...(alternate ? { direction: 'alternate' } : {}) };
259
+ const css = cssFor(kf, options, trigger, stagger);
260
+ const comps = [];
261
+ for (const key of [effect, trigger])
262
+ for (const [tag, why, snippet] of COMPONENTS[key] || [])
263
+ if (!comps.some((c) => c.tag === tag))
264
+ comps.push({ tag, why, snippet });
265
+ if (stagger)
266
+ comps.push({ tag: 'usa-stagger', why: 'staggers its children', snippet: `<usa-stagger delay="${stagger}"><div>…</div><div>…</div></usa-stagger>` });
267
+ const understood = matched.join(' ').length;
268
+ const confidence = Math.max(0.1, Math.min(1, (hits.length ? 0.5 : 0.15) + Math.min(0.5, understood / Math.max(12, t.length))));
269
+ return { text, effect, also, direction, amount, duration, delay, easing, easingName, trigger, iterations, alternate, stagger, reducedMotion: 'respect', keyframes: kf, options, css, components: comps, confidence: Math.round(confidence * 100) / 100, matched };
270
+ }
271
+ const kebab = (k) => k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase());
272
+ function cssFor(kf, o, trigger, stagger) {
273
+ const name = 'usa-motion';
274
+ const frames = kf.map((f, i) => {
275
+ const pct = f.offset != null ? Math.round(f.offset * 100) : Math.round((i / Math.max(1, kf.length - 1)) * 100);
276
+ const props = Object.entries(f).filter(([k]) => k !== 'offset' && k !== 'easing').map(([k, v]) => `${kebab(k)}: ${v};`).join(' ');
277
+ return ` ${pct}% { ${props} }`;
278
+ });
279
+ const it = o.iterations === Infinity ? 'infinite' : String(o.iterations ?? 1);
280
+ const anim = `${name} ${o.duration}ms ${o.easing} ${o.delay || 0}ms ${it}${o.direction === 'alternate' ? ' alternate' : ''} both`;
281
+ const sel = trigger === 'hover' ? '.target:hover' : trigger === 'click' ? '.target.is-active' : trigger === 'scroll' ? '.target.is-visible' : '.target';
282
+ return [
283
+ `@keyframes ${name} {`,
284
+ ...frames,
285
+ '}',
286
+ `${sel} { animation: ${anim}; }`,
287
+ ...(stagger ? [`.target:nth-child(n) { animation-delay: calc(var(--i, 0) * ${stagger}ms); }`] : []),
288
+ '@media (prefers-reduced-motion: reduce) { .target { animation: none; } }',
289
+ ].join('\n');
290
+ }
291
+ /** Turn an intent into ready code for one element: CSS, WAAPI or a Motionary component. */
292
+ function motionSnippet(i, style = 'waapi') {
293
+ if (style === 'css')
294
+ return i.css;
295
+ if (style === 'component')
296
+ return i.components[0]?.snippet || `<usa-reveal><div class="target">…</div></usa-reveal>`;
297
+ const opts = JSON.stringify({ ...i.options, iterations: i.iterations === Infinity ? 'Infinity' : i.iterations }).replace('"Infinity"', 'Infinity');
298
+ const play = `el.animate(${JSON.stringify(i.keyframes)}, ${opts});`;
299
+ const guard = `if (!matchMedia('(prefers-reduced-motion: reduce)').matches) `;
300
+ switch (i.trigger) {
301
+ case 'hover':
302
+ return `const el = document.querySelector('.target');\nel.addEventListener('pointerenter', () => { ${guard}${play} });`;
303
+ case 'click':
304
+ return `const el = document.querySelector('.target');\nel.addEventListener('click', () => { ${guard}${play} });`;
305
+ case 'scroll':
306
+ return `const io = new IntersectionObserver((entries) => entries.forEach((e, n) => {\n if (!e.isIntersecting) return;\n const el = e.target; io.unobserve(el);\n ${guard}el.animate(${JSON.stringify(i.keyframes)}, { ...${opts}, delay: ${i.delay} + n * ${i.stagger} });\n}), { threshold: 0.2 });\ndocument.querySelectorAll('.target').forEach((el) => io.observe(el));`;
307
+ default:
308
+ return `const el = document.querySelector('.target');\n${guard}${play}`;
309
+ }
310
+ }
311
+
312
+ exports.describeMotion = describeMotion;
313
+ exports.motionSnippet = motionSnippet;
314
+ //# sourceMappingURL=ai.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.cjs","sources":["../../src/components/ai/index.ts"],"sourcesContent":["/**\n * `motionary/components/ai` (10.7, AI-assisted motion) — turns a short\n * natural-language description (\"fade the cards up slowly when they scroll\n * into view, one after another\") into a motion spec: effect, direction,\n * distance, duration, delay, easing, trigger, repeat, stagger, Web\n * Animations keyframes + options, a CSS rule and the Motionary components\n * that do it. English and Chinese phrases. A small deterministic parser —\n * no model, no network — shared by `<usa-motion-prompt>` and the\n * `suggest_motion` tool of `motionary-mcp` (which runs an evaluation set of\n * prompts against it in CI).\n *\n * Pure: no DOM access — safe in Node, workers and SSR.\n */\n\nexport type MotionEffect = 'fade' | 'slide' | 'zoom' | 'rotate' | 'flip' | 'bounce' | 'shake' | 'pulse' | 'blur' | 'reveal' | 'typewriter' | 'count' | 'tilt' | 'magnetic' | 'ripple' | 'parallax' | 'marquee' | 'particles';\nexport type MotionTrigger = 'load' | 'scroll' | 'hover' | 'click' | 'loop';\nexport type Direction = 'up' | 'down' | 'left' | 'right' | null;\n\nexport interface MotionIntent {\n /** The input, trimmed. */\n text: string;\n effect: MotionEffect;\n /** Secondary effects mentioned with the main one (\"fade and zoom\"). */\n also: MotionEffect[];\n direction: Direction;\n /** px for slides, scale factor for zooms, degrees for rotations / flips. */\n amount: number;\n duration: number;\n delay: number;\n easing: string;\n /** Named easing the text asked for ('spring', 'bouncy', 'smooth', 'linear', 'snappy', 'ease-out' …). */\n easingName: string;\n trigger: MotionTrigger;\n /** 1 = once, Infinity = forever. */\n iterations: number;\n alternate: boolean;\n /** ms between items for lists / groups (0 = none). */\n stagger: number;\n reducedMotion: 'respect';\n keyframes: Keyframe[];\n options: KeyframeAnimationOptions;\n css: string;\n /** Motionary components that implement it, best first. */\n components: { tag: string; why: string; snippet: string }[];\n /** 0–1: how much of the text was understood. */\n confidence: number;\n /** Words / phrases that drove each decision (for explanations). */\n matched: string[];\n}\n\ninterface Rule<T> { re: RegExp; v: T }\nconst R = <T>(re: RegExp, v: T): Rule<T> => ({ re, v });\n\n// effects, most specific first (\"slide\" before \"fade\" so \"slide and fade in\" picks slide as the main motion)\nconst EFFECTS: Rule<MotionEffect>[] = [\n R(/type ?writer|typing|types? (?:out|in)|打字/, 'typewriter'),\n R(/count(?:s|ing)? up|counter|tick(?:s|ing)? up|number(?:s)? (?:roll|count)|数字(?:滚动|增长)|计数/, 'count'),\n R(/confetti|particles?|sparkles?|粒子|彩带|烟花/, 'particles'),\n R(/marquee|ticker tape|scroll(?:s|ing)? (?:sideways|horizontally) (?:forever|endlessly)|跑马灯/, 'marquee'),\n R(/parallax|视差/, 'parallax'),\n R(/magnet(?:ic)?|follows? the (?:cursor|mouse|pointer)|磁吸|跟随(?:鼠标|光标)/, 'magnetic'),\n R(/ripple|涟漪|水波/, 'ripple'),\n R(/tilt|3d hover|倾斜/, 'tilt'),\n R(/shake|wiggle|jiggle|wobble|tremble|抖动|摇晃|晃动/, 'shake'),\n R(/pulse|pulsate|heartbeat|throb|breath(?:e|ing)|脉冲|呼吸|心跳/, 'pulse'),\n R(/bounce|bouncing|bouncy entrance|弹跳|弹起|蹦/, 'bounce'),\n R(/flip|翻转/, 'flip'),\n R(/spin|rotate|rotating|rotation|turn(?:s|ing)? around|旋转|转动/, 'rotate'),\n R(/reveal|wipe|unmask|clip(?:-| )path|揭示|遮罩|擦除/, 'reveal'),\n R(/blur|unblur|focus in|模糊/, 'blur'),\n R(/zoom|scale|grow|shrink|pop(?:s)? (?:in|out|up)|enlarge|缩放|放大|缩小|弹出/, 'zoom'),\n R(/slide|slides|sliding|move(?:s)? in|fly(?:ing)? in|swoop|滑入|滑动|飞入|移入/, 'slide'),\n R(/fade|fades|fading|appear|disappear|dissolve|淡入|淡出|渐显|渐隐|出现/, 'fade'),\n];\nconst DIRS: Rule<Direction>[] = [\n // explicit \"from the …\" first, so \"slide in from the left\" is not caught by the bare \\bleft\\b rule below\n R(/from (?:the )?left|从左/, 'right'),\n R(/from (?:the )?right|从右/, 'left'),\n R(/from (?:the )?(?:top|above)|从上/, 'down'),\n R(/from (?:the )?(?:bottom|below)|\\bup\\b|upward|rise|rises|从下(?:方|面)?|向上|上浮|升起/, 'up'),\n R(/from (?:the )?(?:top|above)|\\bdown\\b|downward|drop(?:s)? (?:in|down)|fall(?:s)? in|从上(?:方|面)?|向下|落下/, 'down'),\n R(/from (?:the )?right|\\bleft(?:ward)?\\b|向左|从右/, 'left'),\n R(/from (?:the )?left|\\bright(?:ward)?\\b|向右|从左/, 'right'),\n];\nconst TRIGGERS: Rule<MotionTrigger>[] = [\n R(/hover|mouse ?over|on mouse|pointer (?:over|enter)|悬停|鼠标(?:移入|悬浮|经过)/, 'hover'),\n R(/click|tap|press|点击|按下|轻触/, 'click'),\n R(/scroll|in(?:to)? view|on screen|viewport|visible|as (?:you|the user) scroll|滚动|进入(?:视口|视野|屏幕)|可见/, 'scroll'),\n R(/forever|infinite(?:ly)?|endless(?:ly)?|loop(?:s|ing)?|continuous(?:ly)?|repeat(?:s|edly|ing)?(?! once)|always|循环|一直|无限|反复/, 'loop'),\n R(/on (?:page )?load|when the page loads|on (?:start|mount)|at start|页面加载|加载时|进入页面/, 'load'),\n];\nconst EASINGS: Rule<[string, string]>[] = [\n R(/spring(?:y)?|elastic|弹簧|弹性/, ['spring', 'cubic-bezier(0.34, 1.56, 0.64, 1)']),\n R(/bouncy|overshoot|playful|回弹|俏皮/, ['bouncy', 'cubic-bezier(0.68, -0.55, 0.27, 1.55)']),\n R(/linear(?:ly)?|constant speed|steady|匀速|线性/, ['linear', 'linear']),\n R(/snappy|crisp|quick and sharp|干脆|利落/, ['snappy', 'cubic-bezier(0.2, 0.9, 0.1, 1)']),\n R(/ease[- ]?in[- ]?out|smooth(?:ly)?|gentle|gently|soft(?:ly)?|subtle|平滑|柔和|顺滑|轻柔/, ['smooth', 'cubic-bezier(0.65, 0, 0.35, 1)']),\n R(/ease[- ]?in\\b|accelerat|speeds? up|加速/, ['ease-in', 'cubic-bezier(0.4, 0, 1, 1)']),\n R(/ease[- ]?out|decelerat|slows? down|减速/, ['ease-out', 'cubic-bezier(0, 0, 0.2, 1)']),\n];\n\nconst num = (s: string) => parseFloat(s.replace(',', '.'));\nfunction parseDuration(t: string, matched: string[]): number | null {\n const m = /(\\d+(?:[.,]\\d+)?)\\s*(ms|milliseconds?|毫秒|s\\b|secs?|seconds?|秒)/.exec(t);\n if (m) {\n matched.push(m[0]);\n return Math.round(/^(ms|millisecond|毫秒)/.test(m[2]) ? num(m[1]) : num(m[1]) * 1000);\n }\n const w: [RegExp, number][] = [\n [/very slow(?:ly)?|really slow|非常慢|很慢/, 1600],\n [/slow(?:ly)?|leisurely|缓慢|慢慢|慢/, 1000],\n [/very fast|really fast|instant(?:ly)?|非常快|很快|瞬间/, 180],\n [/fast|quick(?:ly)?|rapid(?:ly)?|snappy|brisk|快速|快/, 300],\n ];\n for (const [re, v] of w) {\n const x = re.exec(t);\n if (x) {\n matched.push(x[0]);\n return v;\n }\n }\n return null;\n}\nfunction parseDelay(t: string, matched: string[]): number {\n const m =\n /(?:after|delay(?:ed)?(?: by| of)?|wait(?:s|ing)?|延迟|等待)\\s*(\\d+(?:[.,]\\d+)?)\\s*(ms|毫秒|s\\b|secs?|seconds?|秒)/.exec(t) ||\n // \"after a 300ms delay\", \"a 1 s delay\", \"延迟 300 毫秒\" handled above; the number-first form here\n /(?:after )?(?:a |an )?(\\d+(?:[.,]\\d+)?)\\s*(ms|毫秒|s\\b|secs?|seconds?|秒)\\s*(?:-\\s*)?(?:delay|pause|wait|后)/.exec(t);\n if (!m) return 0;\n matched.push(m[0]);\n return Math.round(/^(ms|毫秒)/.test(m[2]) ? num(m[1]) : num(m[1]) * 1000);\n}\nfunction parseStagger(t: string, matched: string[]): number {\n const m = /(\\d+)\\s*ms\\s*(?:apart|between|stagger)|stagger(?:ed)?(?: by)?\\s*(\\d+)\\s*ms/.exec(t);\n if (m) {\n matched.push(m[0]);\n return +(m[1] || m[2]);\n }\n const w = /one (?:after|by) (?:another|one)|stagger(?:ed)?|in sequence|sequentially|each (?:card|item|word|letter|line) in turn|一个接一个|依次|逐个|交错/.exec(t);\n if (w) {\n matched.push(w[0]);\n return 80;\n }\n return 0;\n}\nfunction parseIterations(t: string, trigger: MotionTrigger, matched: string[]): number {\n const m = /(\\d+|once|twice|three times|一次|两次|三次)\\s*(?:times|次)?/.exec(t.replace(/\\d+(?:[.,]\\d+)?\\s*(?:ms|s\\b|secs?|seconds?|毫秒|秒|px|%|deg|°)/g, ''));\n if (trigger === 'loop') return Infinity;\n if (m && /once|一次/.test(m[1])) return 1;\n if (m && /twice|两次/.test(m[1])) return (matched.push(m[0]), 2);\n if (m && /three|三次/.test(m[1])) return (matched.push(m[0]), 3);\n if (m && /^\\d+$/.test(m[1]) && /times|次/.test(m[0])) return (matched.push(m[0]), +m[1]);\n return 1;\n}\nfunction parseAmount(t: string, effect: MotionEffect): number {\n const px = /(\\d+)\\s*(?:px|pixels?|像素)/.exec(t);\n const deg = /(\\d+)\\s*(?:deg|degrees?|°|度)/.exec(t);\n const pct = /(\\d+)\\s*%/.exec(t);\n if (effect === 'slide' || effect === 'fade' || effect === 'bounce' || effect === 'shake') return px ? +px[1] : effect === 'shake' ? 8 : effect === 'bounce' ? 24 : 32;\n if (effect === 'rotate' || effect === 'flip') return deg ? +deg[1] : effect === 'flip' ? 180 : /half/.test(t) ? 180 : 360;\n if (effect === 'zoom') {\n if (pct) return +pct[1] / 100;\n return /shrink|out\\b|缩小/.test(t) ? 1.2 : 0.8;\n }\n if (effect === 'pulse') return pct ? 1 + +pct[1] / 100 : 1.06;\n if (effect === 'blur') return px ? +px[1] : 8;\n return 0;\n}\n\nconst DIR_XY: Record<string, [number, number]> = { up: [0, 1], down: [0, -1], left: [1, 0], right: [-1, 0] };\n\nfunction keyframesFor(i: Pick<MotionIntent, 'effect' | 'also' | 'direction' | 'amount'>): Keyframe[] {\n const out = /out\\b|disappear|exit|淡出|消失/;\n void out;\n const [dx, dy] = DIR_XY[i.direction || 'up'];\n const fade = i.effect === 'fade' || i.also.includes('fade');\n const from: Keyframe = {}, to: Keyframe = {};\n const tf: string[] = [], tt: string[] = [];\n switch (i.effect) {\n case 'slide':\n case 'fade':\n if (i.effect === 'slide' || i.direction) {\n tf.push(`translate(${dx * i.amount}px, ${dy * i.amount}px)`);\n tt.push('translate(0px, 0px)');\n }\n break;\n case 'zoom':\n tf.push(`scale(${i.amount})`);\n tt.push('scale(1)');\n break;\n case 'rotate':\n tf.push(`rotate(${i.direction === 'left' ? -i.amount : i.amount}deg)`);\n tt.push('rotate(0deg)');\n break;\n case 'flip':\n tf.push(`perspective(600px) rotate${i.direction === 'left' || i.direction === 'right' ? 'Y' : 'X'}(${i.amount}deg)`);\n tt.push(`perspective(600px) rotate${i.direction === 'left' || i.direction === 'right' ? 'Y' : 'X'}(0deg)`);\n break;\n case 'blur':\n from.filter = `blur(${i.amount}px)`;\n to.filter = 'blur(0px)';\n break;\n case 'reveal':\n from.clipPath = i.direction === 'left' ? 'inset(0 0 0 100%)' : i.direction === 'right' ? 'inset(0 100% 0 0)' : i.direction === 'down' ? 'inset(0 0 100% 0)' : 'inset(100% 0 0 0)';\n to.clipPath = 'inset(0 0 0 0)';\n break;\n case 'bounce':\n return [\n { transform: `translateY(${-i.amount}px)`, opacity: fade ? 0 : 1, offset: 0 },\n { transform: 'translateY(0px)', opacity: 1, offset: 0.55 },\n { transform: `translateY(${-i.amount * 0.35}px)`, offset: 0.75 },\n { transform: 'translateY(0px)', offset: 1 },\n ];\n case 'shake':\n return [0, 1, -1, 1, -1, 0].map((k, n, a) => ({ transform: `translateX(${k * i.amount}px)`, offset: n / (a.length - 1) }));\n case 'pulse':\n return [{ transform: 'scale(1)' }, { transform: `scale(${i.amount})` }, { transform: 'scale(1)' }];\n default:\n break;\n }\n if (i.also.includes('zoom') && i.effect !== 'zoom') (tf.push('scale(0.85)'), tt.push('scale(1)'));\n if (i.also.includes('rotate') && i.effect !== 'rotate') (tf.push('rotate(-8deg)'), tt.push('rotate(0deg)'));\n if (i.also.includes('blur') && i.effect !== 'blur') (from.filter = 'blur(6px)'), (to.filter = 'blur(0px)');\n if (tf.length) (from.transform = tf.join(' ')), (to.transform = tt.join(' '));\n if (fade || ['slide', 'zoom', 'blur', 'flip'].includes(i.effect)) (from.opacity = 0), (to.opacity = 1);\n return [from, to];\n}\n\nconst COMPONENTS: Partial<Record<MotionEffect | MotionTrigger, [string, string, string][]>> = {\n typewriter: [['usa-typewriter', 'types text out character by character', '<usa-typewriter text=\"Hello, Motionary\"></usa-typewriter>']],\n count: [['usa-counter', 'animates a number up when it scrolls into view', '<usa-counter to=\"1280\" duration=\"1200\"></usa-counter>']],\n particles: [['usa-particles', 'particle field (Canvas 2D)', '<usa-particles count=\"80\"></usa-particles>'], ['usa-gpu-particles', 'tens of thousands of GPU particles', '<usa-gpu-particles count=\"20000\" mode=\"swirl\"></usa-gpu-particles>']],\n marquee: [['usa-marquee', 'endless horizontal scroller', '<usa-marquee speed=\"40\"><span>…</span></usa-marquee>']],\n parallax: [['usa-parallax-layers', 'layers move at different speeds while scrolling', '<usa-parallax-layers><img data-depth=\"0.2\" src=\"…\"></usa-parallax-layers>']],\n magnetic: [['usa-magnetic', 'element follows the pointer a little', '<usa-magnetic><button>Hover me</button></usa-magnetic>']],\n ripple: [['usa-ripple', 'material-style click ripple', '<usa-ripple><button>Click</button></usa-ripple>']],\n tilt: [['usa-tilt', '3D tilt towards the pointer', '<usa-tilt><div class=\"card\">…</div></usa-tilt>']],\n reveal: [['usa-mask-reveal', 'clip-path reveal on scroll', '<usa-mask-reveal><img src=\"…\"></usa-mask-reveal>'], ['usa-reveal', 'reveal on scroll', '<usa-reveal><div>…</div></usa-reveal>']],\n scroll: [['usa-reveal', 'plays the entrance when the element scrolls into view', '<usa-reveal><div>…</div></usa-reveal>']],\n};\n\n/** Parse a natural-language motion description. */\nexport function describeMotion(input: string): MotionIntent {\n const text = String(input || '').trim();\n const t = text.toLowerCase();\n const matched: string[] = [];\n const hits = EFFECTS.filter((r) => {\n const m = r.re.exec(t);\n if (m) matched.push(m[0]);\n return !!m;\n }).map((r) => r.v);\n let effect: MotionEffect = hits[0] || 'fade';\n // \"fade in and slide up\": the slide is the motion, the fade rides along\n if (effect === 'fade' && hits.includes('slide')) effect = 'slide';\n const also = hits.filter((h) => h !== effect);\n let direction: Direction = null;\n for (const r of DIRS) {\n const m = r.re.exec(t);\n if (m && !/(?:in|out)$/.test(m[0]) && !(effect === 'zoom' && /\\bup\\b/.test(m[0]) && /pop/.test(t))) {\n direction = r.v;\n matched.push(m[0]);\n break;\n }\n }\n if (!direction && effect === 'slide') direction = 'up';\n let trigger: MotionTrigger = 'load';\n const trig = TRIGGERS.filter((r) => r.re.test(t)).map((r) => r.v);\n if (trig.length) trigger = trig.includes('hover') ? 'hover' : trig.includes('click') ? 'click' : trig.includes('scroll') && !(trig.includes('loop') && /forever|infinite|endless|无限|一直/.test(t)) ? 'scroll' : trig[0];\n if (['shake', 'pulse'].includes(effect) && trigger === 'load' && /attention|notify|提醒|注意/.test(t)) trigger = 'loop';\n if (effect === 'marquee') trigger = 'loop';\n const easingHit = EASINGS.find((r) => r.re.test(t));\n const easingName = easingHit ? easingHit.v[0] : effect === 'bounce' ? 'bouncy' : effect === 'shake' || effect === 'pulse' ? 'smooth' : 'ease-out';\n const easing = easingHit ? easingHit.v[1] : easingName === 'bouncy' ? 'cubic-bezier(0.68, -0.55, 0.27, 1.55)' : easingName === 'smooth' ? 'cubic-bezier(0.65, 0, 0.35, 1)' : 'cubic-bezier(0, 0, 0.2, 1)';\n if (easingHit) matched.push(easingHit.re.exec(t)![0]);\n const duration = parseDuration(t, matched) ?? (effect === 'shake' ? 500 : effect === 'pulse' ? 1200 : effect === 'typewriter' ? 1800 : effect === 'count' ? 1200 : 600);\n const delay = parseDelay(t, matched);\n const stagger = parseStagger(t, matched);\n const iterations = parseIterations(t, trigger, matched);\n const alternate = /back and forth|alternat|yoyo|ping[- ]?pong|往返|来回/.test(t) || (effect === 'pulse' && trigger === 'loop' && false);\n const amount = parseAmount(t, effect);\n const kf = keyframesFor({ effect, also, direction, amount });\n const options: KeyframeAnimationOptions = { duration, delay, easing, fill: 'both', iterations, ...(alternate ? { direction: 'alternate' } : {}) };\n const css = cssFor(kf, options, trigger, stagger);\n const comps: MotionIntent['components'] = [];\n for (const key of [effect, trigger] as (MotionEffect | MotionTrigger)[]) for (const [tag, why, snippet] of COMPONENTS[key] || []) if (!comps.some((c) => c.tag === tag)) comps.push({ tag, why, snippet });\n if (stagger) comps.push({ tag: 'usa-stagger', why: 'staggers its children', snippet: `<usa-stagger delay=\"${stagger}\"><div>…</div><div>…</div></usa-stagger>` });\n const understood = matched.join(' ').length;\n const confidence = Math.max(0.1, Math.min(1, (hits.length ? 0.5 : 0.15) + Math.min(0.5, understood / Math.max(12, t.length))));\n return { text, effect, also, direction, amount, duration, delay, easing, easingName, trigger, iterations, alternate, stagger, reducedMotion: 'respect', keyframes: kf, options, css, components: comps, confidence: Math.round(confidence * 100) / 100, matched };\n}\n\nconst kebab = (k: string) => k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase());\nfunction cssFor(kf: Keyframe[], o: KeyframeAnimationOptions, trigger: MotionTrigger, stagger: number): string {\n const name = 'usa-motion';\n const frames = kf.map((f, i) => {\n const pct = f.offset != null ? Math.round((f.offset as number) * 100) : Math.round((i / Math.max(1, kf.length - 1)) * 100);\n const props = Object.entries(f).filter(([k]) => k !== 'offset' && k !== 'easing').map(([k, v]) => `${kebab(k)}: ${v};`).join(' ');\n return ` ${pct}% { ${props} }`;\n });\n const it = o.iterations === Infinity ? 'infinite' : String(o.iterations ?? 1);\n const anim = `${name} ${o.duration}ms ${o.easing} ${o.delay || 0}ms ${it}${o.direction === 'alternate' ? ' alternate' : ''} both`;\n const sel = trigger === 'hover' ? '.target:hover' : trigger === 'click' ? '.target.is-active' : trigger === 'scroll' ? '.target.is-visible' : '.target';\n return [\n `@keyframes ${name} {`,\n ...frames,\n '}',\n `${sel} { animation: ${anim}; }`,\n ...(stagger ? [`.target:nth-child(n) { animation-delay: calc(var(--i, 0) * ${stagger}ms); }`] : []),\n '@media (prefers-reduced-motion: reduce) { .target { animation: none; } }',\n ].join('\\n');\n}\n\n/** Turn an intent into ready code for one element: CSS, WAAPI or a Motionary component. */\nexport function motionSnippet(i: MotionIntent, style: 'waapi' | 'css' | 'component' = 'waapi'): string {\n if (style === 'css') return i.css;\n if (style === 'component') return i.components[0]?.snippet || `<usa-reveal><div class=\"target\">…</div></usa-reveal>`;\n const opts = JSON.stringify({ ...i.options, iterations: i.iterations === Infinity ? 'Infinity' : i.iterations }).replace('\"Infinity\"', 'Infinity');\n const play = `el.animate(${JSON.stringify(i.keyframes)}, ${opts});`;\n const guard = `if (!matchMedia('(prefers-reduced-motion: reduce)').matches) `;\n switch (i.trigger) {\n case 'hover':\n return `const el = document.querySelector('.target');\\nel.addEventListener('pointerenter', () => { ${guard}${play} });`;\n case 'click':\n return `const el = document.querySelector('.target');\\nel.addEventListener('click', () => { ${guard}${play} });`;\n case 'scroll':\n return `const io = new IntersectionObserver((entries) => entries.forEach((e, n) => {\\n if (!e.isIntersecting) return;\\n const el = e.target; io.unobserve(el);\\n ${guard}el.animate(${JSON.stringify(i.keyframes)}, { ...${opts}, delay: ${i.delay} + n * ${i.stagger} });\\n}), { threshold: 0.2 });\\ndocument.querySelectorAll('.target').forEach((el) => io.observe(el));`;\n default:\n return `const el = document.querySelector('.target');\\n${guard}${play}`;\n }\n}\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;AAYG;AAuCH,MAAM,CAAC,GAAG,CAAI,EAAU,EAAE,CAAI,MAAe,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;AAEvD;AACA,MAAM,OAAO,GAAyB;AACpC,IAAA,CAAC,CAAC,0CAA0C,EAAE,YAAY,CAAC;AAC3D,IAAA,CAAC,CAAC,yFAAyF,EAAE,OAAO,CAAC;AACrG,IAAA,CAAC,CAAC,wCAAwC,EAAE,WAAW,CAAC;AACxD,IAAA,CAAC,CAAC,0FAA0F,EAAE,SAAS,CAAC;AACxG,IAAA,CAAC,CAAC,aAAa,EAAE,UAAU,CAAC;AAC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