{
  "id": "floating-player-controls",
  "kind": "element",
  "title": "Floating player controls",
  "summary": "A glass video control bar you can drag anywhere over the picture, which fades away while playing and comes back when you move.",
  "url": "https://enrichr.dev/elements/floating-player-controls.html",
  "section": "page",
  "techniques": [
    "pointer-interaction"
  ],
  "stack": [
    "Vanilla JS",
    "CSS"
  ],
  "frameworks": [
    "React",
    "Next.js",
    "Vanilla"
  ],
  "mood": [
    "cinematic",
    "polished"
  ],
  "intents": [
    "custom video player controls",
    "draggable video control bar",
    "glassmorphism media player",
    "auto hide video controls",
    "floating play pause scrubber"
  ],
  "status": "tested",
  "params": [
    {
      "key": "photo",
      "label": "Photo",
      "type": "select",
      "options": [
        [
          "corgi-4",
          "Corgi and friend on a dirt road"
        ],
        [
          "corgi-1",
          "Corgi puppy, orange wall"
        ],
        [
          "corgi-2",
          "Corgi in a flower field"
        ],
        [
          "corgi-3",
          "Corgi on a rock, autumn"
        ],
        [
          "corgi-5",
          "Corgi lying on white"
        ],
        [
          "corgi-6",
          "Corgi standing on white"
        ]
      ],
      "value": "corgi-4"
    },
    {
      "key": "length",
      "label": "Clip length (s)",
      "type": "range",
      "min": 30,
      "max": 600,
      "step": 10,
      "value": 90
    },
    {
      "key": "autoplay",
      "label": "Autoplay",
      "type": "select",
      "options": [
        [
          "on",
          "Play on load"
        ],
        [
          "off",
          "Start paused"
        ]
      ],
      "value": "on"
    },
    {
      "key": "hide",
      "label": "Hide controls after (s, 0 keeps them shown)",
      "type": "range",
      "min": 0,
      "max": 10,
      "step": 0.5,
      "value": 2.5
    },
    {
      "key": "pan",
      "label": "Photo pan while playing (0 is still)",
      "type": "range",
      "min": 0,
      "max": 2,
      "step": 0.1,
      "value": 1
    },
    {
      "key": "accent",
      "label": "Progress colour",
      "type": "color",
      "value": "#e6ff55"
    },
    {
      "key": "button",
      "label": "Play button",
      "type": "color",
      "value": "#fbf8f1"
    },
    {
      "key": "ink",
      "label": "Play icon",
      "type": "color",
      "value": "#0c1e18"
    },
    {
      "key": "text",
      "label": "Text and icons",
      "type": "color",
      "value": "#fbf8f1"
    },
    {
      "key": "glass",
      "label": "Panel tint",
      "type": "color",
      "value": "#050d0a"
    }
  ],
  "license": "Free to use in personal and client projects during the preview. Final licence terms will be published here before any paid tier starts; ask before reselling the code as a collection.",
  "contract": "function mount(root, opts) -> { update(partialOpts), destroy() }; root must contain the element markup",
  "exports": {
    "claude": "Add the \"Floating player controls\" element to this project.\n\nThis is the \"Floating player controls\" element from the Enrichr Library: A glass video control bar you can drag anywhere over the picture, which fades away while playing and comes back when you move.\nPage: https://enrichr.dev/elements/floating-player-controls.html\nMachine-readable spec: https://enrichr.dev/elements/floating-player-controls.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nSteps:\n1. Look at the project first to see its framework and where components, styles and static files live. Follow its conventions.\n2. Fetch https://enrichr.dev/elements/floating-player-controls.json if you can read URLs (fields: source.markup, source.css, source.js, params); otherwise use the source at the end of this message.\n3. Add the files, mount it where I tell you (default: the top of the home page), and pass the settings below as the opts.\n4. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n5. Run the dev server and check it. with reduced motion on, nothing moves; it works at 375px wide and with touch only; there are no console errors; scrolling stays smooth; destroy() is called when it unmounts.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "chatgpt": "I want the \"Floating player controls\" element on my website. Below is its complete source. Please:\n1. Build one self-contained index.html that I can open locally to see it working (put the CSS in a <style> tag and the JavaScript in a <script> tag, with the markup in the body).\n2. Then explain, step by step, which parts go where in my own site, and how to mount it. My stack is: [tell me yours, or say \"plain HTML\"].\n3. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nThis is the \"Floating player controls\" element from the Enrichr Library: A glass video control bar you can drag anywhere over the picture, which fades away while playing and comes back when you move.\nPage: https://enrichr.dev/elements/floating-player-controls.html\nMachine-readable spec: https://enrichr.dev/elements/floating-player-controls.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}\n\nVerify: with reduced motion on, nothing moves; it works at 375px wide and with touch only; there are no console errors; scrolling stays smooth; destroy() is called when it unmounts.",
    "cursor": "Add the \"Floating player controls\" element to this codebase.\n\nThis is the \"Floating player controls\" element from the Enrichr Library: A glass video control bar you can drag anywhere over the picture, which fades away while playing and comes back when you move.\nPage: https://enrichr.dev/elements/floating-player-controls.html\nMachine-readable spec: https://enrichr.dev/elements/floating-player-controls.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nUse Composer / agent mode. First search the repo for how components, styles and scripts are organised, then add the files in the matching places, mount it on the page I name, and run the app to confirm it works. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}\n\nVerify: with reduced motion on, nothing moves; it works at 375px wide and with touch only; there are no console errors; scrolling stays smooth; destroy() is called when it unmounts.\n\nOptional: save this as .cursor/rules/enrichr-floating-player-controls.mdc so the rule stays with the project:\n---\ndescription: How to use the Enrichr Floating player controls element\nalwaysApply: false\n---\nmount(root, opts) expects the element markup inside root and returns { update, destroy }. Always call destroy() on unmount and never edit the ef- class names.",
    "v0": "Create a Next.js (App Router) client component for the \"Floating player controls\" element. Tailwind is available but this component needs no utility classes.\n\nThis is the \"Floating player controls\" element from the Enrichr Library: A glass video control bar you can drag anywhere over the picture, which fades away while playing and comes back when you move.\nPage: https://enrichr.dev/elements/floating-player-controls.html\nMachine-readable spec: https://enrichr.dev/elements/floating-player-controls.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nFiles to create:\n- floating-player-controls.js : the JavaScript below, with one line appended at the end: export { mount };  (and the markup exported as: export const markup = \"<the markup string>\";). If the project uses TypeScript and does not allow JS imports, put // @ts-nocheck on the first line.\n- the CSS below goes in your global stylesheet (or a plain .css file imported once at the app root). The class names are global and start with ef-.\n\nUse this component as the wrapper (adjust the import paths):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./floating-player-controls\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function FloatingPlayerControls(props: Record<string, unknown>) {\n  const ref = useRef<HTMLDivElement>(null);\n  const fx = useRef<{ update: (o: object) => void; destroy: () => void } | null>(null);\n  useEffect(() => {\n    const root = ref.current;\n    if (!root) return;\n    root.innerHTML = markup;\n    fx.current = mount(root, props);\n    return () => { fx.current?.destroy(); fx.current = null; root.innerHTML = \"\"; };\n  }, []);\n  useEffect(() => { fx.current?.update(props); }, [JSON.stringify(props)]);\n  return <div ref={ref} />;\n}\n```\n\nRender it on the home page so I can see it. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "lovable": "Add the \"Floating player controls\" element to this React + Vite + TypeScript + Tailwind project. Do not install any packages.\n\nThis is the \"Floating player controls\" element from the Enrichr Library: A glass video control bar you can drag anywhere over the picture, which fades away while playing and comes back when you move.\nPage: https://enrichr.dev/elements/floating-player-controls.html\nMachine-readable spec: https://enrichr.dev/elements/floating-player-controls.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nFiles to create:\n- floating-player-controls.js : the JavaScript below, with one line appended at the end: export { mount };  (and the markup exported as: export const markup = \"<the markup string>\";). If the project uses TypeScript and does not allow JS imports, put // @ts-nocheck on the first line.\n- the CSS below goes in your global stylesheet (or a plain .css file imported once at the app root). The class names are global and start with ef-.\n\nWrapper component (src/components/FloatingPlayerControls.tsx):\n```tsx\n\"use client\";\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./floating-player-controls\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function FloatingPlayerControls(props: Record<string, unknown>) {\n  const ref = useRef<HTMLDivElement>(null);\n  const fx = useRef<{ update: (o: object) => void; destroy: () => void } | null>(null);\n  useEffect(() => {\n    const root = ref.current;\n    if (!root) return;\n    root.innerHTML = markup;\n    fx.current = mount(root, props);\n    return () => { fx.current?.destroy(); fx.current = null; root.innerHTML = \"\"; };\n  }, []);\n  useEffect(() => { fx.current?.update(props); }, [JSON.stringify(props)]);\n  return <div ref={ref} />;\n}\n```\n\nRemove the \"use client\" line if it is not needed. Show it on the home page. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "bolt": "Create a small Vite project (vanilla JavaScript, no framework unless I already have one) that shows the \"Floating player controls\" element.\n\nThis is the \"Floating player controls\" element from the Enrichr Library: A glass video control bar you can drag anywhere over the picture, which fades away while playing and comes back when you move.\nPage: https://enrichr.dev/elements/floating-player-controls.html\nMachine-readable spec: https://enrichr.dev/elements/floating-player-controls.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nFiles: index.html (a container element, then a script tag), style.css (the CSS below), floating-player-controls.js (the JavaScript below) and main.js that sets the container's innerHTML to the markup and calls mount(container, opts) with the settings below. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}\n\nVerify: with reduced motion on, nothing moves; it works at 375px wide and with touch only; there are no console errors; scrolling stays smooth; destroy() is called when it unmounts.",
    "replit": "Create a new HTML, CSS and JavaScript Repl that shows the \"Floating player controls\" element. No packages, no server code.\n\nThis is the \"Floating player controls\" element from the Enrichr Library: A glass video control bar you can drag anywhere over the picture, which fades away while playing and comes back when you move.\nPage: https://enrichr.dev/elements/floating-player-controls.html\nMachine-readable spec: https://enrichr.dev/elements/floating-player-controls.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nFiles: index.html (a container element, link style.css, load floating-player-controls.js and then main.js), style.css (the CSS below), floating-player-controls.js (the JavaScript below), main.js (sets the container's innerHTML to the markup, then calls mount(container, opts) with the settings below). Press Run to preview. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "figma": "Designer handoff notes for the \"Floating player controls\" element (Enrichr Library). Figma cannot run this JavaScript inside a design file, so use it as a motion reference and hand the code to a developer.\n\nThis is the \"Floating player controls\" element from the Enrichr Library: A glass video control bar you can drag anywhere over the picture, which fades away while playing and comes back when you move.\nPage: https://enrichr.dev/elements/floating-player-controls.html\nMachine-readable spec: https://enrichr.dev/elements/floating-player-controls.json\n\nWhat it does: A clock stands in for the video: while playing it advances a 1:30 playhead that loops at the end, and each frame sets the scrubber, the time and the photo, which zooms from 1.1 to 1.16 and pans a few percent across the clip, so scrubbing moves the picture too. The bar fades in on load (0.4 s power3 out). While playing, 2.5 seconds without pointer movement fades it out and sinks it 15 pixels (0.6 s power2 in-out) and hides the cursor; any movement, tap or key brings it back, and it never hides while paused, hovered or focused. Dragging uses pointer events on the grip, as GSAP Draggable did in the original: the bar follows the pointer, can go past an edge at a fifth of the pointer speed (edge resistance 0.8), and snaps back inside on release, while it scales to 1.02 (0.2 s back out 1.7) and back (0.2 s power2 out). The play button pops from 0.85 (0.3 s back out 2), the skip buttons spin back from 30 degrees and 0.8 scale (0.4 s back out 1.5), and the mute button pops from 0.8.\nAccessibility: Every control is a real button or range slider with a label, the scrubber reports its time as text, and the play and mute buttons update their labels. The grip is a button too: the arrow keys move the bar (Shift for bigger steps) and Home puts it back. Keyboard focus inside the bar keeps it shown. With prefers-reduced-motion it starts paused, the bar stays in view, and the photo pan and button pops are off.\n\nTunable settings:\n- Photo: select (Corgi and friend on a dirt road / Corgi puppy, orange wall / Corgi in a flower field / Corgi on a rock, autumn / Corgi lying on white / Corgi standing on white), default corgi-4\n- Clip length (s): range 30 to 600, step 10, default 90\n- Autoplay: select (Play on load / Start paused), default on\n- Hide controls after (s, 0 keeps them shown): range 0 to 10, step 0.5, default 2.5\n- Photo pan while playing (0 is still): range 0 to 2, step 0.1, default 1\n- Progress colour: color, default #e6ff55\n- Play button: color, default #fbf8f1\n- Play icon: color, default #0c1e18\n- Text and icons: color, default #fbf8f1\n- Panel tint: color, default #050d0a\n\nCurrent settings:\n{{SETTINGS}}\n\nFor the developer: Element contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\nIn Figma:\n- Draw the resting state as a frame and the end state as a second frame; link them with Smart Animate to show the motion in a prototype.\n- Put the settings above in the frame's notes or Dev Mode annotations so the developer matches them.\n- Link https://enrichr.dev/elements/floating-player-controls.html in the handoff: the live demo and the copy-ready code are there. Developers can paste the prompts for Claude, Cursor or v0 from the Export menu.\nNothing is copied from another designer's file; this is original code from Enrichr.",
    "framer": "Add the \"Floating player controls\" element to Framer as a code component. Framer code components are React, so wrap the vanilla code like this. Check it in the Framer editor, as Framer's component API can change.\n\nThis is the \"Floating player controls\" element from the Enrichr Library: A glass video control bar you can drag anywhere over the picture, which fades away while playing and comes back when you move.\nPage: https://enrichr.dev/elements/floating-player-controls.html\nMachine-readable spec: https://enrichr.dev/elements/floating-player-controls.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\n1. In Framer: Assets > Code > New component. Name it FloatingPlayerControls.\n2. Paste the JavaScript below into a separate code file named floating-player-controls.js in the same project, with  export { mount };  and  export const markup = \"<the markup string>\";  added. Put the CSS into the component as a <style> tag.\n3. Component:\n```tsx\nimport { addPropertyControls, ControlType } from \"framer\"\nimport { useEffect, useRef } from \"react\";\nimport { markup, mount } from \"./floating-player-controls\"; // markup is the HTML string; mount is the JavaScript's mount function\n\nexport default function FloatingPlayerControls(props: any) {\n  const ref = useRef<HTMLDivElement>(null);\n  const fx = useRef<{ update: (o: object) => void; destroy: () => void } | null>(null);\n  useEffect(() => {\n    const root = ref.current;\n    if (!root) return;\n    root.innerHTML = markup;\n    fx.current = mount(root, props);\n    return () => { fx.current?.destroy(); fx.current = null; root.innerHTML = \"\"; };\n  }, []);\n  useEffect(() => { fx.current?.update(props); }, [JSON.stringify(props)]);\n  return <div ref={ref} />;\n}\n\naddPropertyControls(FloatingPlayerControls, {\n  photo: { type: ControlType.Enum, title: \"Photo\", options: [\"corgi-4\",\"corgi-1\",\"corgi-2\",\"corgi-3\",\"corgi-5\",\"corgi-6\"], optionTitles: [\"Corgi and friend on a dirt road\",\"Corgi puppy, orange wall\",\"Corgi in a flower field\",\"Corgi on a rock, autumn\",\"Corgi lying on white\",\"Corgi standing on white\"], defaultValue: \"corgi-4\" },\n  length: { type: ControlType.Number, title: \"Clip length\", min: 30, max: 600, step: 10, defaultValue: 90 },\n  autoplay: { type: ControlType.Enum, title: \"Autoplay\", options: [\"on\",\"off\"], optionTitles: [\"Play on load\",\"Start paused\"], defaultValue: \"on\" },\n  hide: { type: ControlType.Number, title: \"Hide controls after\", min: 0, max: 10, step: 0.5, defaultValue: 2.5 },\n  pan: { type: ControlType.Number, title: \"Photo pan while playing\", min: 0, max: 2, step: 0.1, defaultValue: 1 },\n  accent: { type: ControlType.Color, title: \"Progress colour\", defaultValue: \"#e6ff55\" },\n  button: { type: ControlType.Color, title: \"Play button\", defaultValue: \"#fbf8f1\" },\n  ink: { type: ControlType.Color, title: \"Play icon\", defaultValue: \"#0c1e18\" },\n  text: { type: ControlType.Color, title: \"Text and icons\", defaultValue: \"#fbf8f1\" },\n  glass: { type: ControlType.Color, title: \"Panel tint\", defaultValue: \"#050d0a\" },\n})\n```\n4. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}",
    "webflow": "Add the \"Floating player controls\" element to a Webflow site with an Embed element. Test it on the published or preview site: scripts in embeds may not run inside the Designer canvas.\n\nThis is the \"Floating player controls\" element from the Enrichr Library: A glass video control bar you can drag anywhere over the picture, which fades away while playing and comes back when you move.\nPage: https://enrichr.dev/elements/floating-player-controls.html\nMachine-readable spec: https://enrichr.dev/elements/floating-player-controls.json\n\nElement contract (vanilla JavaScript, no dependencies):\n- The JavaScript defines a function mount(root, opts).\n- root is an empty container element. Set root.innerHTML to the markup first, then call mount(root, opts).\n- It returns an object with update(partialOpts) and destroy(). Call destroy() when the element is removed. Some elements also return replay().\n- The CSS classes all start with \"ef-\" so they will not collide with your styles.\n\n1. Add an Embed element where it should appear. Paste a <style> block with the CSS, one container <div id=\"enrichr-floating-player-controls\"></div>, and a <script> block with the JavaScript followed by:\n   mount(document.getElementById(\"enrichr-floating-player-controls\"), { ...your settings... });\n   (set the container's innerHTML to the markup first, as in the contract).\n2. Embed elements have a size limit (check Webflow's current number). If the code is longer, host the JS and CSS as files and link them from Custom code in the page settings, then keep only the container and the mount call in the Embed.\n3. Keep the behaviour of the source unchanged. Do not add dependencies. Respect prefers-reduced-motion. Keep text as real HTML.\n\nSettings:\n{{SETTINGS}}\n\nSource:\n{{CODE}}"
  },
  "exportTools": [
    "claude",
    "chatgpt",
    "cursor",
    "v0",
    "lovable",
    "bolt",
    "replit",
    "figma",
    "framer",
    "webflow"
  ],
  "accessibility": "Every control is a real button or range slider with a label, the scrubber reports its time as text, and the play and mute buttons update their labels. The grip is a button too: the arrow keys move the bar (Shift for bigger steps) and Home puts it back. Keyboard focus inside the bar keeps it shown. With prefers-reduced-motion it starts paused, the bar stays in view, and the photo pan and button pops are off.",
  "performance": "One requestAnimationFrame loop drives the clock and the few tweens; each frame writes two transforms and one CSS variable. The photo is a single image moved with transform, so it stays on the compositor. The blur behind the bar is a CSS backdrop filter, which costs the most on slow phones; lower it in the CSS if needed. The clock stops off screen and in hidden tabs.",
  "dependencies": [],
  "codepen": "https://codepen.io/Enrichr-Dev/pen/WbpLKaq",
  "source": {
    "markup": "<div class=\"ef-fpc\">\n  <div class=\"ef-fpc__screen\"><img class=\"ef-fpc__img\" src=\"/img/library/corgi-4.jpg\" alt=\"A corgi and a shaggy dog on a dirt road, standing in for the video\" decoding=\"async\" draggable=\"false\"></div>\n  <div class=\"ef-fpc__bar\" role=\"group\" aria-label=\"Video controls\">\n    <div class=\"ef-fpc__top\">\n      <span class=\"ef-fpc__time ef-fpc__cur\" aria-hidden=\"true\">0:00</span>\n      <input type=\"range\" class=\"ef-fpc__range ef-fpc__timeline\" min=\"0\" max=\"90\" step=\"0.1\" value=\"0\" aria-label=\"Seek\">\n      <span class=\"ef-fpc__time ef-fpc__dur\" aria-hidden=\"true\">1:30</span>\n    </div>\n    <div class=\"ef-fpc__row\">\n      <button type=\"button\" class=\"ef-fpc__handle\" aria-label=\"Move the controls: drag, or use the arrow keys. Home puts them back.\" title=\"Drag to move\"><svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><g fill=\"currentColor\"><circle cx=\"8.8\" cy=\"5.6\" r=\"1.35\"/><circle cx=\"15.2\" cy=\"5.6\" r=\"1.35\"/><circle cx=\"8.8\" cy=\"12\" r=\"1.35\"/><circle cx=\"15.2\" cy=\"12\" r=\"1.35\"/><circle cx=\"8.8\" cy=\"18.4\" r=\"1.35\"/><circle cx=\"15.2\" cy=\"18.4\" r=\"1.35\"/></g></svg></button>\n      <div class=\"ef-fpc__mid\">\n        <button type=\"button\" class=\"ef-fpc__btn ef-fpc__back\" aria-label=\"Back 10 seconds\"><svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><g fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3.5 12a8.5 8.5 0 1 0 2.6-6.1L3.5 8.5\"/><path d=\"M3.5 3.8v4.7h4.7\"/><path d=\"M12 7.6V12l3 1.8\"/></g></svg></button>\n        <button type=\"button\" class=\"ef-fpc__play\" aria-label=\"Play\"><svg class=\"ef-fpc__i-play\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M7.5 4.9v14.2c0 .9 1 1.4 1.7 1l11.3-7.1c.7-.4.7-1.5 0-1.9L9.2 3.9c-.7-.5-1.7 0-1.7 1z\"/></svg><svg class=\"ef-fpc__i-pause\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><g fill=\"currentColor\"><rect x=\"5.8\" y=\"4\" width=\"4.6\" height=\"16\" rx=\"1.3\"/><rect x=\"13.6\" y=\"4\" width=\"4.6\" height=\"16\" rx=\"1.3\"/></g></svg></button>\n        <button type=\"button\" class=\"ef-fpc__btn ef-fpc__fwd\" aria-label=\"Forward 10 seconds\"><svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><g fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" transform=\"translate(24 0) scale(-1 1)\"><path d=\"M3.5 12a8.5 8.5 0 1 0 2.6-6.1L3.5 8.5\"/><path d=\"M3.5 3.8v4.7h4.7\"/><path d=\"M12 7.6V12l3 1.8\"/></g></svg></button>\n      </div>\n      <div class=\"ef-fpc__vol\">\n        <button type=\"button\" class=\"ef-fpc__mute\" aria-label=\"Mute\" data-level=\"high\"><svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M3.6 9h3.3l4.6-4c.6-.5 1.5-.1 1.5.7v12.6c0 .8-.9 1.2-1.5.7l-4.6-4H3.6c-.6 0-1.1-.5-1.1-1.1V10.1c0-.6.5-1.1 1.1-1.1z\"/><g fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.1\" stroke-linecap=\"round\"><path class=\"ef-fpc__w1\" d=\"M16 9.2a4 4 0 0 1 0 5.6\"/><path class=\"ef-fpc__w2\" d=\"M18.6 6.6a7.6 7.6 0 0 1 0 10.8\"/><path class=\"ef-fpc__x\" d=\"M16.2 9.4l5 5.2M21.2 9.4l-5 5.2\"/></g></svg></button>\n        <div class=\"ef-fpc__volwrap\"><input type=\"range\" class=\"ef-fpc__range ef-fpc__volume\" min=\"0\" max=\"100\" step=\"1\" value=\"100\" aria-label=\"Volume\"></div>\n      </div>\n    </div>\n  </div>\n</div>",
    "css": "/* Enrichr Library · https://enrichr.dev */\n.ef-fpc { --ef-fpc-acc: #e6ff55; --ef-fpc-btn: #fbf8f1; --ef-fpc-ink: #0c1e18; --ef-fpc-text: #fbf8f1; --ef-fpc-glass: #050d0a; --ef-fpc-mute: #e54c1e; position: relative; width: 100%; min-height: 26rem; box-sizing: border-box; overflow: hidden; border-radius: 1rem; background: #050d0a; color: var(--ef-fpc-text); font-family: 'Instrument Sans', system-ui, sans-serif; container-type: inline-size; }\n.ef-fpc.is-idle { cursor: none; }\n.ef-fpc .ef-fpc__screen { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }\n.ef-fpc .ef-fpc__img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 50%; will-change: transform; user-select: none; }\n.ef-fpc .ef-fpc__bar { position: absolute; left: 0; right: 0; bottom: 3rem; z-index: 1; box-sizing: border-box; width: min(420px, calc(100% - 1.5rem)); margin: 0 auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; border: 1px solid color-mix(in srgb, var(--ef-fpc-text) 10%, transparent); border-radius: 1.5rem; background: color-mix(in srgb, var(--ef-fpc-glass) 40%, transparent); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 0, 0, 0.2); opacity: 0; cursor: default; will-change: transform, opacity; }\n.ef-fpc .ef-fpc__top { display: flex; align-items: center; gap: 0.75rem; padding: 0 0.5rem; }\n.ef-fpc .ef-fpc__time { flex: none; width: 2.5rem; font-family: 'Fira Code', ui-monospace, monospace; font-size: 0.75rem; line-height: 1rem; color: color-mix(in srgb, var(--ef-fpc-text) 82%, transparent); font-variant-numeric: tabular-nums; }\n.ef-fpc .ef-fpc__cur { text-align: right; }\n.ef-fpc .ef-fpc__dur { text-align: left; }\n.ef-fpc .ef-fpc__row { display: flex; align-items: center; justify-content: space-between; }\n.ef-fpc .ef-fpc__mid { display: flex; align-items: center; gap: 1rem; }\n.ef-fpc .ef-fpc__vol { display: flex; align-items: center; gap: 0.5rem; padding-left: 1rem; }\n.ef-fpc .ef-fpc__volwrap { width: 4rem; overflow: hidden; display: flex; align-items: center; }\n.ef-fpc .ef-fpc__handle, .ef-fpc .ef-fpc__btn, .ef-fpc .ef-fpc__mute, .ef-fpc .ef-fpc__play { margin: 0; border: 0; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }\n.ef-fpc .ef-fpc__handle { display: flex; padding: 0.5rem; border-radius: 0.6rem; background: transparent; color: color-mix(in srgb, var(--ef-fpc-text) 62%, transparent); cursor: grab; touch-action: none; transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1); }\n.ef-fpc .ef-fpc__handle:hover, .ef-fpc .ef-fpc__handle.is-drag { color: var(--ef-fpc-text); }\n.ef-fpc .ef-fpc__handle.is-drag { cursor: grabbing; }\n.ef-fpc .ef-fpc__btn { display: flex; align-items: center; justify-content: center; padding: 0.5rem; border-radius: 9999px; background: transparent; color: color-mix(in srgb, var(--ef-fpc-text) 82%, transparent); transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1); }\n.ef-fpc .ef-fpc__btn:hover { color: var(--ef-fpc-text); background: color-mix(in srgb, var(--ef-fpc-text) 10%, transparent); }\n.ef-fpc .ef-fpc__play { display: flex; align-items: center; justify-content: center; flex: none; width: 3rem; height: 3rem; padding: 0; border-radius: 9999px; background: var(--ef-fpc-btn); color: var(--ef-fpc-ink); box-shadow: 0 0 15px color-mix(in srgb, var(--ef-fpc-btn) 40%, transparent); transition: scale 0.15s cubic-bezier(0.4, 0, 0.2, 1); }\n.ef-fpc .ef-fpc__play:hover { scale: 1.05; }\n.ef-fpc .ef-fpc__mute { display: flex; padding: 0; background: transparent; color: color-mix(in srgb, var(--ef-fpc-text) 82%, transparent); transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1); }\n.ef-fpc .ef-fpc__mute:hover { color: var(--ef-fpc-text); }\n.ef-fpc .ef-fpc__mute[data-level=\"off\"] { color: var(--ef-fpc-mute); }\n.ef-fpc .ef-fpc__bar svg { display: block; flex: none; }\n.ef-fpc .ef-fpc__handle svg, .ef-fpc .ef-fpc__btn svg, .ef-fpc .ef-fpc__play svg { width: 24px; height: 24px; }\n.ef-fpc .ef-fpc__mute svg { width: 20px; height: 20px; }\n.ef-fpc .ef-fpc__play .ef-fpc__i-pause, .ef-fpc .ef-fpc__play.is-playing .ef-fpc__i-play { display: none; }\n.ef-fpc .ef-fpc__play.is-playing .ef-fpc__i-pause { display: block; }\n.ef-fpc .ef-fpc__mute .ef-fpc__x, .ef-fpc .ef-fpc__mute[data-level=\"off\"] .ef-fpc__w1, .ef-fpc .ef-fpc__mute[data-level=\"off\"] .ef-fpc__w2, .ef-fpc .ef-fpc__mute[data-level=\"low\"] .ef-fpc__w2 { display: none; }\n.ef-fpc .ef-fpc__mute[data-level=\"off\"] .ef-fpc__x { display: inline; }\n.ef-fpc .ef-fpc__handle:focus-visible, .ef-fpc .ef-fpc__btn:focus-visible, .ef-fpc .ef-fpc__mute:focus-visible, .ef-fpc .ef-fpc__play:focus-visible { outline: 2px solid var(--ef-fpc-acc); outline-offset: 2px; }\n.ef-fpc .ef-fpc__range { --ef-fpc-p: 0%; --ef-fpc-fill: var(--ef-fpc-acc); -webkit-appearance: none; appearance: none; display: block; flex: 1 1 auto; min-width: 0; width: 100%; height: 16px; margin: 0; padding: 0; background: transparent; outline: none; cursor: pointer; }\n.ef-fpc .ef-fpc__volume { --ef-fpc-fill: var(--ef-fpc-text); }\n.ef-fpc .ef-fpc__range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--ef-fpc-fill) var(--ef-fpc-p), color-mix(in srgb, var(--ef-fpc-text) 20%, transparent) var(--ef-fpc-p)); }\n.ef-fpc .ef-fpc__range::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--ef-fpc-fill) var(--ef-fpc-p), color-mix(in srgb, var(--ef-fpc-text) 20%, transparent) var(--ef-fpc-p)); }\n.ef-fpc .ef-fpc__range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-top: -5px; border: 0; border-radius: 50%; background: var(--ef-fpc-text); box-shadow: 0 0 10px color-mix(in srgb, var(--ef-fpc-text) 60%, transparent); transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); }\n.ef-fpc .ef-fpc__range::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--ef-fpc-text); box-shadow: 0 0 10px color-mix(in srgb, var(--ef-fpc-text) 60%, transparent); transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); }\n.ef-fpc .ef-fpc__range::-webkit-slider-thumb:hover { transform: scale(1.3); }\n.ef-fpc .ef-fpc__range::-moz-range-thumb:hover { transform: scale(1.3); }\n.ef-fpc .ef-fpc__volume::-webkit-slider-thumb { opacity: 0; }\n.ef-fpc .ef-fpc__volume::-moz-range-thumb { opacity: 0; }\n.ef-fpc .ef-fpc__range:focus-visible::-webkit-slider-thumb { opacity: 1; box-shadow: 0 0 0 3px var(--ef-fpc-acc), 0 0 10px color-mix(in srgb, var(--ef-fpc-text) 60%, transparent); }\n.ef-fpc .ef-fpc__range:focus-visible::-moz-range-thumb { opacity: 1; box-shadow: 0 0 0 3px var(--ef-fpc-acc), 0 0 10px color-mix(in srgb, var(--ef-fpc-text) 60%, transparent); }\n@container (max-width: 360px) { .ef-fpc .ef-fpc__volwrap { display: none; } .ef-fpc .ef-fpc__vol { padding-left: 0.5rem; } }",
    "js": "// Enrichr Library · https://enrichr.dev\n// Floating player controls: a glass control bar that floats over a \"video\" and can be dragged anywhere inside it by its\n// grip. There is no real video: a clock plays a 1:30 clip, the scrubber and times follow it, and a corgi photo pans and\n// zooms slowly with the playhead, so scrubbing moves the picture too. The motion follows the original's GSAP set-up:\n// the bar fades in (0.4 s power3 out), hides after 2.5 s without pointer movement while playing (0.6 s power2 in-out,\n// fading and sinking 15 px) and comes back on any movement, tap or key. Dragging scales it to 1.02 (0.2 s back out 1.7),\n// lets it travel past the edges at a fifth of the pointer speed (edge resistance 0.8) and clamps it back inside on release.\n// The play button pops from 0.85 (back out 2), the skip buttons spin back from 30 degrees (back out 1.5) and the mute\n// button pops from 0.8. Every control is a real button or slider with a label; the grip also moves with the arrow keys.\n// Reduced motion starts paused, keeps the bar in view, and drops the pan and the pops. The clock stops off screen and in\n// hidden tabs.\n// mount(root, { photo (corgi-1 to corgi-6), length (clip length, s), autoplay (\"on\" or \"off\"), hide (s before the bar\n//               hides, 0 = never), pan (photo pan strength, 0 = still), accent (progress), button (play button),\n//               ink (play icon), text (text and icons), glass (panel tint) })\nfunction mount(root, o) {\n  var reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n  var box = root.querySelector(\".ef-fpc\");\n  var img = root.querySelector(\".ef-fpc__img\");\n  var bar = root.querySelector(\".ef-fpc__bar\");\n  var handle = root.querySelector(\".ef-fpc__handle\");\n  var play = root.querySelector(\".ef-fpc__play\");\n  var back = root.querySelector(\".ef-fpc__back\"), fwd = root.querySelector(\".ef-fpc__fwd\");\n  var mute = root.querySelector(\".ef-fpc__mute\");\n  var timeline = root.querySelector(\".ef-fpc__timeline\"), volume = root.querySelector(\".ef-fpc__volume\");\n  var cur = root.querySelector(\".ef-fpc__cur\"), dur = root.querySelector(\".ef-fpc__dur\");\n  var ALT = { \"corgi-1\": \"A corgi puppy against an orange wall\", \"corgi-2\": \"A corgi smiling in a field of flowers\", \"corgi-3\": \"A corgi sitting on a rock among autumn leaves\", \"corgi-4\": \"A corgi and a shaggy dog on a dirt road\", \"corgi-5\": \"A corgi lying on a white background\", \"corgi-6\": \"A corgi standing on a white background\" };\n\n  var opts = {}, raf = 0, last = 0, visible = true, destroyed = false, io = null, ro = null, offs = [], photo = \"\";\n  var t = 0, playing = false, muted = false, vol = 1, scrubbing = false, shownText = \"\";\n  var x = 0, y = 0, hy = 0, op = 0, sc = 1, idle = 0, hovering = false, focusIn = false, hidden = false, drag = null;\n  var tweens = {};\n\n  // GSAP's eases, written out\n  function power2InOut(p) { return p < 0.5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2; }\n  function power2Out(p) { return 1 - Math.pow(1 - p, 3); }\n  function power3Out(p) { return 1 - Math.pow(1 - p, 4); }\n  function backOut(s) { return function (p) { var q = p - 1; return 1 + (s + 1) * q * q * q + s * q * q; }; }\n  var back17 = backOut(1.7), back2 = backOut(2), back15 = backOut(1.5);\n\n  function num(v, d) { v = Number(v); return isFinite(v) ? v : d; }\n  function clamp(v, a, b) { return v < a ? a : v > b ? b : v; }\n  function fmt(s) { s = Math.max(0, s); var m = Math.floor(s / 60), r = Math.floor(s % 60); return m + \":\" + (r < 10 ? \"0\" : \"\") + r; }\n\n  // one running tween per key, all driven by the same frame loop\n  function tween(key, from, to, d, ease, apply) {\n    if (reduce) { apply(to); delete tweens[key]; return; }\n    tweens[key] = { from: from, to: to, d: Math.max(0.001, d), ease: ease, apply: apply, t: 0 };\n    apply(from);\n  }\n  function render() { bar.style.transform = \"translate3d(\" + x.toFixed(2) + \"px,\" + (y + hy).toFixed(2) + \"px,0) scale(\" + sc.toFixed(4) + \")\"; bar.style.opacity = op.toFixed(3); }\n  function setOp(v) { op = v; render(); }\n  function setHy(v) { hy = v; render(); }\n  function setSc(v) { sc = v; render(); }\n  function pop(el, key, r0, s0, d, ease) {\n    tween(key, 0, 1, d, ease, function (e) { el.style.transform = e >= 1 ? \"\" : \"rotate(\" + (r0 * (1 - e)).toFixed(2) + \"deg) scale(\" + (s0 + (1 - s0) * e).toFixed(4) + \")\"; });\n  }\n\n  function show() {\n    idle = 0;\n    box.classList.remove(\"is-idle\");\n    if (!hidden && op >= 1 && !tweens.op) return;\n    hidden = false;\n    tween(\"op\", op, 1, 0.4, power3Out, setOp);\n    tween(\"hy\", hy, 0, 0.4, power3Out, setHy);\n  }\n  function hide() {\n    if (hovering || focusIn || drag || !playing || reduce) return;\n    hidden = true;\n    tween(\"op\", op, 0, 0.6, power2InOut, setOp);\n    tween(\"hy\", hy, 15, 0.6, power2InOut, setHy);\n    box.classList.add(\"is-idle\");\n  }\n\n  function paint() {\n    var L = opts.length, p = L ? t / L : 0;\n    if (!scrubbing) timeline.value = String(t);\n    timeline.style.setProperty(\"--ef-fpc-p\", (p * 100).toFixed(3) + \"%\");\n    var txt = fmt(t);\n    if (txt !== shownText) { shownText = txt; cur.textContent = txt; timeline.setAttribute(\"aria-valuetext\", txt + \" of \" + fmt(L)); }\n    var k = reduce ? 0 : opts.pan;\n    img.style.transform = k ? \"scale(\" + (1 + k * (0.1 + 0.06 * p)).toFixed(4) + \") translate3d(\" + (k * (0.5 - p) * 6).toFixed(3) + \"%,\" + (k * (0.5 - p) * 1.5).toFixed(3) + \"%,0)\" : \"\";\n  }\n  function setPlaying(on) {\n    playing = on;\n    play.classList.toggle(\"is-playing\", on);\n    play.setAttribute(\"aria-label\", on ? \"Pause\" : \"Play\");\n    if (on) idle = 0; else show();\n  }\n  function volIcon(v) {\n    var lvl = v === 0 || muted ? \"off\" : v < 0.5 ? \"low\" : \"high\";\n    mute.setAttribute(\"data-level\", lvl);\n    mute.setAttribute(\"aria-label\", lvl === \"off\" ? \"Unmute\" : \"Mute\");\n  }\n  function setVolBar(v) { volume.value = String(v); volume.style.setProperty(\"--ef-fpc-p\", v + \"%\"); }\n\n  function tick(now) {\n    raf = requestAnimationFrame(tick);\n    var dt = Math.min(0.05, (now - last) / 1000 || 0); last = now;\n    if (!visible || document.hidden) return;\n    for (var k in tweens) {\n      var tw = tweens[k]; tw.t += dt;\n      var p = Math.min(1, tw.t / tw.d);\n      tw.apply(tw.from + (tw.to - tw.from) * tw.ease(p));\n      if (p >= 1) delete tweens[k];\n    }\n    if (playing) {\n      t += dt;\n      if (t >= opts.length) t -= opts.length; // the clip loops, like the original's looping video\n      paint();\n      if (opts.hide > 0 && !hidden && !hovering && !focusIn && !drag) { idle += dt; if (idle >= opts.hide) hide(); }\n    }\n  }\n\n  // controls\n  function onPlay() { pop(play, \"pPlay\", 0, 0.85, 0.3, back2); setPlaying(!playing); }\n  function skip(s) { t = clamp(t + s, 0, opts.length); paint(); }\n  function onBack() { pop(back, \"pBack\", -30, 0.8, 0.4, back15); skip(-10); }\n  function onFwd() { pop(fwd, \"pFwd\", 30, 0.8, 0.4, back15); skip(10); }\n  function onSeek() { t = clamp(num(timeline.value, 0), 0, opts.length); paint(); }\n  function onScrubStart() { scrubbing = true; }\n  function onScrubEnd() { scrubbing = false; }\n  function onVolume() { var v = num(volume.value, 0) / 100; vol = v; muted = v === 0; setVolBar(Math.round(v * 100)); volIcon(v); }\n  function onMute() {\n    pop(mute, \"pMute\", 0, 0.8, 0.3, back2);\n    if (muted || vol === 0) { muted = false; vol = 0.5; setVolBar(50); volIcon(0.5); }\n    else { muted = true; setVolBar(0); volIcon(0); }\n  }\n\n  // dragging by the grip: free inside the box, a fifth of the overshoot past an edge, clamped back on release\n  function bounds() {\n    return { x0: -bar.offsetLeft, x1: box.clientWidth - bar.offsetLeft - bar.offsetWidth, y0: -bar.offsetTop, y1: box.clientHeight - bar.offsetTop - bar.offsetHeight };\n  }\n  function resist(v, a, b) { return v < a ? a + (v - a) * 0.2 : v > b ? b + (v - b) * 0.2 : v; }\n  function onDown(e) {\n    if (e.button !== undefined && e.button !== 0) return;\n    e.preventDefault();\n    drag = { id: e.pointerId, sx: e.clientX, sy: e.clientY, x0: x, y0: y, b: bounds() };\n    try { handle.setPointerCapture(e.pointerId); } catch (err) {}\n    handle.classList.add(\"is-drag\");\n    show();\n    tween(\"sc\", sc, 1.02, 0.2, back17, setSc);\n  }\n  function onMove(e) {\n    if (!drag || e.pointerId !== drag.id) return;\n    var b = drag.b;\n    x = resist(drag.x0 + e.clientX - drag.sx, Math.min(b.x0, 0), Math.max(b.x1, 0));\n    y = resist(drag.y0 + e.clientY - drag.sy, Math.min(b.y0, 0), Math.max(b.y1, 0));\n    render();\n  }\n  function onUp(e) {\n    if (!drag || e.pointerId !== drag.id) return;\n    var b = drag.b;\n    drag = null;\n    handle.classList.remove(\"is-drag\");\n    x = clamp(x, Math.min(b.x0, 0), Math.max(b.x1, 0)); y = clamp(y, Math.min(b.y0, 0), Math.max(b.y1, 0));\n    tween(\"sc\", sc, 1, 0.2, power2Out, setSc);\n    render();\n    idle = 0;\n  }\n  function onHandleKey(e) {\n    var step = e.shiftKey ? 40 : 10, dx = 0, dy = 0;\n    if (e.key === \"ArrowLeft\") dx = -step; else if (e.key === \"ArrowRight\") dx = step;\n    else if (e.key === \"ArrowUp\") dy = -step; else if (e.key === \"ArrowDown\") dy = step;\n    else if (e.key === \"Home\") { e.preventDefault(); x = 0; y = 0; render(); return; }\n    else return;\n    e.preventDefault();\n    var b = bounds();\n    x = clamp(x + dx, Math.min(b.x0, 0), Math.max(b.x1, 0)); y = clamp(y + dy, Math.min(b.y0, 0), Math.max(b.y1, 0));\n    render();\n  }\n  function fit() { var b = bounds(); x = clamp(x, Math.min(b.x0, 0), Math.max(b.x1, 0)); y = clamp(y, Math.min(b.y0, 0), Math.max(b.y1, 0)); render(); }\n\n  // activity: any pointer movement, tap or key on the player brings the bar back and restarts the hide countdown\n  function onActive() { show(); }\n  function onEnter() { hovering = true; show(); }\n  function onLeave() { hovering = false; idle = 0; }\n  function onFocusIn() { focusIn = true; show(); }\n  function onFocusOut() { focusIn = bar.contains(document.activeElement); idle = 0; }\n  function on(el, ev, fn, opt) { el.addEventListener(ev, fn, opt); offs.push(function () { el.removeEventListener(ev, fn, opt); }); }\n\n  function update(partial) {\n    var prevAuto = opts.autoplay;\n    opts = Object.assign({ photo: \"corgi-4\", length: 90, autoplay: \"on\", hide: 2.5, pan: 1, accent: \"#e6ff55\", button: \"#fbf8f1\", ink: \"#0c1e18\", text: \"#fbf8f1\", glass: \"#050d0a\" }, opts, partial || {});\n    opts.length = Math.max(10, num(opts.length, 90)); opts.hide = Math.max(0, num(opts.hide, 2.5)); opts.pan = Math.max(0, num(opts.pan, 1));\n    opts.autoplay = opts.autoplay === \"off\" || opts.autoplay === false ? \"off\" : \"on\";\n    var s = box.style;\n    s.setProperty(\"--ef-fpc-acc\", opts.accent); s.setProperty(\"--ef-fpc-btn\", opts.button); s.setProperty(\"--ef-fpc-ink\", opts.ink);\n    s.setProperty(\"--ef-fpc-text\", opts.text); s.setProperty(\"--ef-fpc-glass\", opts.glass);\n    var ph = /^corgi-[1-6]$/.test(opts.photo) ? opts.photo : \"corgi-4\";\n    if (ph !== photo) { photo = ph; img.src = \"/img/library/\" + ph + \".jpg\"; img.alt = ALT[ph] + \", standing in for the video\"; }\n    timeline.max = String(opts.length);\n    dur.textContent = fmt(opts.length);\n    t = clamp(t, 0, opts.length);\n    if (opts.autoplay !== prevAuto) setPlaying(opts.autoplay === \"on\" && !reduce);\n    if (opts.hide === 0 || !playing) show();\n    shownText = \"\";\n    paint();\n  }\n\n  on(play, \"click\", onPlay);\n  on(back, \"click\", onBack);\n  on(fwd, \"click\", onFwd);\n  on(mute, \"click\", onMute);\n  on(timeline, \"input\", onSeek);\n  on(timeline, \"pointerdown\", onScrubStart);\n  on(timeline, \"pointerup\", onScrubEnd);\n  on(timeline, \"pointercancel\", onScrubEnd);\n  on(timeline, \"blur\", onScrubEnd);\n  on(volume, \"input\", onVolume);\n  on(handle, \"pointerdown\", onDown);\n  on(handle, \"pointermove\", onMove);\n  on(handle, \"pointerup\", onUp);\n  on(handle, \"pointercancel\", onUp);\n  on(handle, \"keydown\", onHandleKey);\n  on(box, \"pointermove\", onActive, { passive: true });\n  on(box, \"pointerdown\", onActive, { passive: true });\n  on(box, \"keydown\", onActive);\n  on(bar, \"pointerenter\", onEnter);\n  on(bar, \"pointerleave\", onLeave);\n  on(bar, \"focusin\", onFocusIn);\n  on(bar, \"focusout\", onFocusOut);\n\n  update(o);\n  setVolBar(100); volIcon(1);\n  if (reduce) { op = 1; render(); } else { tween(\"op\", 0, 1, 0.4, power3Out, setOp); } // the bar fades in on load\n  if (\"IntersectionObserver\" in window) { io = new IntersectionObserver(function (e) { visible = e[0].isIntersecting; }); io.observe(box); }\n  if (\"ResizeObserver\" in window) { ro = new ResizeObserver(function () { if (!destroyed && !drag) fit(); }); ro.observe(box); }\n  last = performance.now(); raf = requestAnimationFrame(tick);\n  return {\n    update: update,\n    destroy: function () {\n      destroyed = true; cancelAnimationFrame(raf); tweens = {};\n      offs.forEach(function (f) { f(); }); offs = [];\n      if (io) io.disconnect();\n      if (ro) ro.disconnect();\n    }\n  };\n}"
  }
}