@editframe/elements 0.42.5 → 0.42.8

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 (86) hide show
  1. package/LICENSE-FULL.md +148 -0
  2. package/dist/elements/EFCaptions.d.ts +4 -4
  3. package/dist/elements/EFImage.d.ts +4 -4
  4. package/dist/elements/EFMedia.d.ts +2 -2
  5. package/dist/elements/EFTemporal.js +3 -1
  6. package/dist/elements/EFTemporal.js.map +1 -1
  7. package/dist/elements/EFText.d.ts +4 -4
  8. package/dist/elements/EFText.js +1 -0
  9. package/dist/elements/EFText.js.map +1 -1
  10. package/dist/elements/EFTextSegment.d.ts +4 -4
  11. package/dist/elements/EFTimegroup.js +12 -1
  12. package/dist/elements/EFTimegroup.js.map +1 -1
  13. package/dist/elements/EFWaveform.d.ts +4 -4
  14. package/dist/gui/EFActiveRootTemporal.d.ts +4 -4
  15. package/dist/gui/EFConfiguration.d.ts +4 -4
  16. package/dist/gui/EFDial.d.ts +4 -4
  17. package/dist/gui/EFFilmstrip.d.ts +4 -4
  18. package/dist/gui/EFOverlayItem.d.ts +4 -4
  19. package/dist/gui/EFOverlayLayer.d.ts +4 -4
  20. package/dist/gui/EFPause.d.ts +4 -4
  21. package/dist/gui/EFPlay.d.ts +4 -4
  22. package/dist/gui/EFPreview.d.ts +4 -4
  23. package/dist/gui/EFScrubber.d.ts +4 -4
  24. package/dist/gui/EFTimeDisplay.d.ts +4 -4
  25. package/dist/gui/EFTimelineRuler.d.ts +4 -4
  26. package/dist/gui/EFToggleLoop.d.ts +4 -4
  27. package/dist/gui/EFTogglePlay.d.ts +4 -4
  28. package/dist/gui/EFWorkbench.d.ts +4 -4
  29. package/dist/gui/hierarchy/EFHierarchy.d.ts +4 -4
  30. package/dist/gui/hierarchy/EFHierarchyItem.d.ts +2 -2
  31. package/dist/gui/timeline/EFTimeline.d.ts +2 -2
  32. package/dist/gui/timeline/EFTimeline.js +18 -1
  33. package/dist/gui/timeline/EFTimeline.js.map +1 -1
  34. package/dist/gui/timeline/TrimHandles.d.ts +4 -4
  35. package/dist/gui/timeline/tracks/EFThumbnailStrip.d.ts +4 -4
  36. package/dist/gui/tree/EFTree.d.ts +4 -4
  37. package/dist/gui/tree/EFTreeItem.d.ts +4 -4
  38. package/dist/preview/renderTimegroupToCanvas.js +9 -0
  39. package/dist/preview/renderTimegroupToCanvas.js.map +1 -1
  40. package/dist/preview/renderTimegroupToVideo.js +1 -1
  41. package/dist/preview/renderTimegroupToVideo.js.map +1 -1
  42. package/dist/preview/rendering/serializeTimelineDirect.js +2 -1
  43. package/dist/preview/rendering/serializeTimelineDirect.js.map +1 -1
  44. package/package.json +8 -3
  45. package/scripts/build-css.js +0 -44
  46. package/test/__cache__/GET__api_v1_transcode_audio_1_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__32da3954ba60c96ad732020c65a08ebc/data.bin +0 -0
  47. package/test/__cache__/GET__api_v1_transcode_audio_1_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__32da3954ba60c96ad732020c65a08ebc/metadata.json +0 -16
  48. package/test/__cache__/GET__api_v1_transcode_audio_2_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__b0b2b07efcf607de8ee0f650328c32f7/data.bin +0 -0
  49. package/test/__cache__/GET__api_v1_transcode_audio_2_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__b0b2b07efcf607de8ee0f650328c32f7/metadata.json +0 -16
  50. package/test/__cache__/GET__api_v1_transcode_audio_3_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__a75c2252b542e0c152c780e9a8d7b154/data.bin +0 -0
  51. package/test/__cache__/GET__api_v1_transcode_audio_3_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__a75c2252b542e0c152c780e9a8d7b154/metadata.json +0 -16
  52. package/test/__cache__/GET__api_v1_transcode_audio_4_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__a64ff1cfb1b52cae14df4b5dfa1e222b/data.bin +0 -0
  53. package/test/__cache__/GET__api_v1_transcode_audio_4_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__a64ff1cfb1b52cae14df4b5dfa1e222b/metadata.json +0 -16
  54. package/test/__cache__/GET__api_v1_transcode_audio_5_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__91e8a522f950809b9f09f4173113b4b0/data.bin +0 -0
  55. package/test/__cache__/GET__api_v1_transcode_audio_5_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__91e8a522f950809b9f09f4173113b4b0/metadata.json +0 -16
  56. package/test/__cache__/GET__api_v1_transcode_audio_init_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__e66d2c831d951e74ad0aeaa6489795d0/data.bin +0 -0
  57. package/test/__cache__/GET__api_v1_transcode_audio_init_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__e66d2c831d951e74ad0aeaa6489795d0/metadata.json +0 -16
  58. package/test/__cache__/GET__api_v1_transcode_high_1_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__26197f6f7c46cacb0a71134131c3f775/data.bin +0 -0
  59. package/test/__cache__/GET__api_v1_transcode_high_1_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__26197f6f7c46cacb0a71134131c3f775/metadata.json +0 -16
  60. package/test/__cache__/GET__api_v1_transcode_high_2_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__4cb6774cd3650ccf59c8f8dc6678c0b9/data.bin +0 -0
  61. package/test/__cache__/GET__api_v1_transcode_high_2_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__4cb6774cd3650ccf59c8f8dc6678c0b9/metadata.json +0 -16
  62. package/test/__cache__/GET__api_v1_transcode_high_3_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__0b3b2b1c8933f7fcf8a9ecaa88d58b41/data.bin +0 -0
  63. package/test/__cache__/GET__api_v1_transcode_high_3_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__0b3b2b1c8933f7fcf8a9ecaa88d58b41/metadata.json +0 -16
  64. package/test/__cache__/GET__api_v1_transcode_high_4_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__a6fb05a22b18d850f7f2950bbcdbdeed/data.bin +0 -0
  65. package/test/__cache__/GET__api_v1_transcode_high_4_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__a6fb05a22b18d850f7f2950bbcdbdeed/metadata.json +0 -16
  66. package/test/__cache__/GET__api_v1_transcode_high_5_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__a50058c7c3602e90879fe3428ed891f4/data.bin +0 -0
  67. package/test/__cache__/GET__api_v1_transcode_high_5_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__a50058c7c3602e90879fe3428ed891f4/metadata.json +0 -16
  68. package/test/__cache__/GET__api_v1_transcode_high_init_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__0798c479b44aaeef850609a430f6e613/data.bin +0 -0
  69. package/test/__cache__/GET__api_v1_transcode_high_init_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__0798c479b44aaeef850609a430f6e613/metadata.json +0 -16
  70. package/test/__cache__/GET__api_v1_transcode_manifest_json_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__3be92a0437de726b431ed5af2369158a/data.bin +0 -1
  71. package/test/__cache__/GET__api_v1_transcode_manifest_json_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__3be92a0437de726b431ed5af2369158a/metadata.json +0 -17
  72. package/test/__cache__/GET__api_v1_transcode_scrub_1_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__6ff5127ebeda578a679474347fbd6137/data.bin +0 -0
  73. package/test/__cache__/GET__api_v1_transcode_scrub_1_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__6ff5127ebeda578a679474347fbd6137/metadata.json +0 -16
  74. package/test/__cache__/GET__api_v1_transcode_scrub_init_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__f6d4793fc9ff854ee9a738917fb64a53/data.bin +0 -0
  75. package/test/__cache__/GET__api_v1_transcode_scrub_init_m4s_url_http_3A_2F_2Fweb_3A3000_2Fhead_moov_480p_mp4__f6d4793fc9ff854ee9a738917fb64a53/metadata.json +0 -16
  76. package/test/cache-integration-verification.browsertest.ts +0 -84
  77. package/test/constants.ts +0 -8
  78. package/test/createJitTestClips.ts +0 -425
  79. package/test/profilingPlugin.ts +0 -221
  80. package/test/recordReplayProxyPlugin.js +0 -428
  81. package/test/setup.ts +0 -71
  82. package/test/useAssetMSW.ts +0 -53
  83. package/test/useMSW.ts +0 -40
  84. package/test/useTranscodeMSW.ts +0 -191
  85. package/test/visualRegressionUtils.ts +0 -300
  86. package/tsdown.config.ts +0 -65
@@ -1 +1 @@
1
- {"version":3,"file":"serializeTimelineDirect.js","names":["rules: string[]","styleParts: string[]","styleStr","parts: Array<string | Promise<string>>","canvasJobs: CanvasJob[]"],"sources":["../../../src/preview/rendering/serializeTimelineDirect.ts"],"sourcesContent":["/**\n * Direct timeline serialization - no intermediate passive structure.\n *\n * Walks the timeline DOM once and builds XML string directly with promise parts\n * for async canvas encoding. 3x faster than DOM creation + XMLSerializer.\n *\n * Architecture:\n * 1. Walk timeline recursively\n * 2. Build array of string parts (some are promises for canvas encoding)\n * 3. Handle shadow DOM by serializing shadow content instead of light DOM\n * 4. Await all promises\n * 5. Join parts into final XML\n */\n\nimport { encodeCanvasesInParallel } from \"../encoding/canvasEncoder.js\";\nimport type { RenderContext } from \"../RenderContext.js\";\nimport { isTemporal, isVisibleAtTime } from \"../previewTypes.js\";\nimport { ScaleConfig } from \"./ScaleConfig.js\";\n\n/**\n * Collect document styles for shadow DOM injection.\n */\nfunction collectDocumentStyles(): string {\n const rules: string[] = [];\n try {\n for (const sheet of document.styleSheets) {\n try {\n if (sheet.cssRules) {\n for (const rule of sheet.cssRules) {\n rules.push(rule.cssText);\n }\n }\n } catch {\n // Expected: cross-origin stylesheets block cssRules access\n }\n }\n } catch (e) {\n console.warn(\n \"[collectDocumentStyles] Failed to access document.styleSheets:\",\n e,\n );\n }\n return rules.join(\"\\n\");\n}\n\n/**\n * Elements to skip entirely when serializing.\n * NOTE: SLOT is NOT skipped - it's handled specially to serialize light DOM children.\n */\nconst SKIP_TAGS = new Set([\n \"EF-AUDIO\",\n \"EF-THUMBNAIL-STRIP\",\n \"EF-FILMSTRIP\",\n \"EF-TIMELINE\",\n \"EF-WORKBENCH\",\n \"SCRIPT\",\n \"STYLE\",\n \"TEMPLATE\",\n]);\n\n/**\n * HTML void elements - these cannot have children and must be self-closing in XHTML.\n * Using `<br />` instead of `<br></br>`.\n */\nconst VOID_ELEMENTS = new Set([\n \"area\",\n \"base\",\n \"br\",\n \"col\",\n \"embed\",\n \"hr\",\n \"img\",\n \"input\",\n \"link\",\n \"meta\",\n \"param\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\n\n/**\n * CSS properties to serialize as inline styles.\n */\nconst SERIALIZED_STYLE_PROPERTIES = [\n \"display\",\n \"visibility\",\n \"opacity\",\n \"position\",\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n \"zIndex\",\n \"width\",\n \"height\",\n \"minWidth\",\n \"minHeight\",\n \"maxWidth\",\n \"maxHeight\",\n \"flexGrow\",\n \"flexShrink\",\n \"flexBasis\",\n \"flexDirection\",\n \"flexWrap\",\n \"justifyContent\",\n \"alignItems\",\n \"alignContent\",\n \"alignSelf\",\n \"gap\",\n \"gridTemplate\",\n \"gridColumn\",\n \"gridRow\",\n \"gridArea\",\n \"margin\",\n \"padding\",\n \"boxSizing\",\n \"border\",\n \"borderTop\",\n \"borderRight\",\n \"borderBottom\",\n \"borderLeft\",\n \"borderRadius\",\n \"background\",\n \"color\",\n \"boxShadow\",\n \"filter\",\n \"backdropFilter\",\n \"clipPath\",\n \"fontFamily\",\n \"fontSize\",\n \"fontWeight\",\n \"fontStyle\",\n \"fontVariant\",\n \"textAlign\",\n \"textDecoration\",\n \"textTransform\",\n \"letterSpacing\",\n \"wordSpacing\",\n \"whiteSpace\",\n \"textOverflow\",\n \"lineHeight\",\n \"verticalAlign\",\n \"transform\",\n \"transformOrigin\",\n \"transformStyle\",\n \"perspective\",\n \"perspectiveOrigin\",\n \"backfaceVisibility\",\n \"cursor\",\n \"pointerEvents\",\n \"userSelect\",\n \"overflow\",\n \"objectFit\",\n \"objectPosition\",\n] as const;\n\n/**\n * Caption child elements that should preserve display:none.\n * These use display:none for content visibility, not temporal visibility.\n */\nconst CAPTION_CHILD_TAGS = new Set([\n \"EF-CAPTIONS-ACTIVE-WORD\",\n \"EF-CAPTIONS-BEFORE-ACTIVE-WORD\",\n \"EF-CAPTIONS-AFTER-ACTIVE-WORD\",\n \"EF-CAPTIONS-SEGMENT\",\n]);\n\ninterface SerializationOptions {\n renderContext?: RenderContext;\n canvasScale: number;\n timeMs: number;\n}\n\ninterface InternalSerializationOptions {\n renderContext?: RenderContext;\n timeMs: number;\n scaleConfig: ScaleConfig;\n sourceMap: WeakMap<HTMLCanvasElement, Element>;\n}\n\ninterface CanvasJob {\n canvas: HTMLCanvasElement;\n sourceElement: Element;\n promiseIndex: number;\n}\n\n/**\n * Escape special XML characters.\n */\nfunction escapeXML(str: string): string {\n return str\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/'/g, \"&apos;\");\n}\n\n/**\n * Resolve the natural display value for an element that has display:none\n * set as an inline style (e.g., from temporal visibility via updateAnimations).\n *\n * Temporarily removes the inline display override so getComputedStyle falls\n * through to the element's stylesheet rules (including shadow DOM :host styles),\n * reads the natural value, then restores the override.\n */\nfunction resolveNaturalDisplay(element: Element): string {\n const htmlEl = element as HTMLElement;\n const inlineDisplay = htmlEl.style?.getPropertyValue(\"display\");\n if (inlineDisplay === \"none\" && htmlEl.style) {\n htmlEl.style.removeProperty(\"display\");\n const natural = getComputedStyle(element).getPropertyValue(\"display\");\n htmlEl.style.setProperty(\"display\", \"none\");\n return natural || \"block\";\n }\n return \"block\";\n}\n\n/**\n * Serialize computed styles as inline style string.\n * Handles display:none recovery for non-caption elements by resolving\n * the element's natural display value from its stylesheet rules.\n * @param element - The element to serialize styles for\n * @param styles - Optional pre-computed CSSStyleDeclaration (avoids redundant getComputedStyle calls)\n */\nfunction serializeComputedStyles(\n element: Element,\n styles?: CSSStyleDeclaration,\n): string {\n const computed = styles ?? getComputedStyle(element);\n const styleParts: string[] = [];\n const tagName = element.tagName;\n const isCaptionChild = CAPTION_CHILD_TAGS.has(tagName);\n\n // Check if the element has explicit width/height in its inline style.\n // For elements that auto-size to content (inline, inline-block text),\n // serializing the computed \"used\" pixel width/height would lock them to\n // exact dimensions that may not match the foreignObject rendering context,\n // causing text wrapping when font metrics differ slightly.\n const htmlEl = element as HTMLElement;\n const hasExplicitWidth = !!htmlEl.style?.getPropertyValue(\"width\");\n const hasExplicitHeight = !!htmlEl.style?.getPropertyValue(\"height\");\n\n for (const prop of SERIALIZED_STYLE_PROPERTIES) {\n // Convert camelCase to kebab-case first\n const kebab = prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);\n const value = computed.getPropertyValue(kebab);\n\n // Skip only truly empty values\n if (!value || value === \"\") {\n continue;\n }\n\n // Handle display property specially\n let finalValue = value;\n if (prop === \"display\") {\n // For non-caption elements, recover the natural display value when display:none\n // was set by the temporal visibility system (updateAnimations). This prevents\n // inline elements (like ef-text-segment) from being serialized as display:block.\n if (value === \"none\" && !isCaptionChild) {\n finalValue = resolveNaturalDisplay(element);\n }\n }\n\n // Force visibility:visible - the source container may have visibility:hidden\n // for off-screen rendering, but we want the serialized output to be visible\n if (prop === \"visibility\") {\n finalValue = \"visible\";\n }\n\n // Skip clipPath - clones always render without clip-path\n // (source may have clip-path: inset(100%) from proxy mode)\n if (prop === \"clipPath\") {\n continue;\n }\n\n // Skip width/height when not explicitly set on the element.\n // getComputedStyle returns \"used\" pixel values for width/height even when\n // the specified value is auto. Serializing these pixel values locks\n // content-sized elements (text segments, inline-block spans) to exact\n // dimensions, which breaks when the foreignObject context renders text\n // with different font metrics.\n if (prop === \"width\" && !hasExplicitWidth) {\n continue;\n }\n if (prop === \"height\" && !hasExplicitHeight) {\n continue;\n }\n\n styleParts.push(`${kebab}:${finalValue}`);\n }\n\n // Disable animations/transitions to prevent re-animation\n styleParts.push(\"animation:none\", \"transition:none\");\n\n return styleParts.join(\";\");\n}\n\n/**\n * Serialize element attributes (excluding style, id, xmlns, event handlers).\n */\nfunction serializeAttributes(\n element: Element,\n parts: Array<string | Promise<string>>,\n): void {\n for (const attr of element.attributes) {\n const name = attr.name.toLowerCase();\n // Skip: id, style, xmlns (namespace handled separately), event handlers\n if (\n name === \"id\" ||\n name === \"style\" ||\n name === \"xmlns\" ||\n name.startsWith(\"on\")\n ) {\n continue;\n }\n parts.push(` ${attr.name}=\"${escapeXML(attr.value)}\"`);\n }\n}\n\n/**\n * Check if a canvas element should preserve alpha channel.\n * EF-WAVEFORM always needs alpha, EF-IMAGE checks hasAlpha property.\n * EF-SURFACE needs alpha because:\n * 1. Without a target, its canvas is transparent and CSS background should show through\n * 2. The target element may have transparent content\n * Raw canvas elements must preserve alpha - we don't know what they contain.\n */\nfunction shouldPreserveAlpha(sourceElement: Element): boolean {\n const tagName = sourceElement.tagName;\n if (tagName === \"EF-WAVEFORM\") {\n return true;\n }\n if (tagName === \"EF-SURFACE\") {\n // Surface needs alpha to allow CSS background to show through empty areas\n return true;\n }\n if (tagName === \"EF-IMAGE\") {\n return (\n \"hasAlpha\" in sourceElement && (sourceElement as any).hasAlpha === true\n );\n }\n // Raw canvas elements must preserve alpha\n if (sourceElement instanceof HTMLCanvasElement) {\n return true;\n }\n return false;\n}\n\n/**\n * Find the capture proxy canvas for an offscreen-rendered canvas.\n * When a canvas is transferred to offscreen via transferControlToOffscreen(),\n * the main thread can no longer read pixels from it. OffscreenCompositionCanvas\n * creates a hidden capture canvas (marked with data-offscreen-capture) that\n * receives ImageBitmap frames from the worker.\n */\nfunction findCaptureProxy(canvas: HTMLCanvasElement): HTMLCanvasElement | null {\n const container = canvas.parentElement;\n if (!container) return null;\n return container.querySelector('canvas[data-offscreen-capture=\"true\"]');\n}\n\n/**\n * Read pixels directly from a WebGL canvas's drawing buffer via gl.readPixels().\n *\n * drawImage(webglCanvas) reads from the compositor's \"presented\" surface, which\n * is only refreshed during requestAnimationFrame / compositing cycles. In hidden\n * browser tabs, compositing is suspended, so drawImage returns stale pixels even\n * though gl.render() produced new content in the drawing buffer.\n *\n * readPixels() reads from the drawing buffer directly, bypassing the compositor.\n *\n * Returns null for non-WebGL canvases (getContext returns null when a different\n * context type is already active).\n */\nfunction readWebGLPixels(canvas: HTMLCanvasElement): Uint8ClampedArray | null {\n const gl = (canvas.getContext(\"webgl2\") ??\n canvas.getContext(\"webgl\")) as WebGLRenderingContext | null;\n if (!gl) return null;\n\n const width = canvas.width;\n const height = canvas.height;\n if (width === 0 || height === 0) return null;\n\n // Ensure we read from the drawing buffer, not a leftover FBO\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n const pixels = new Uint8Array(width * height * 4);\n gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels);\n\n // readPixels returns rows bottom-to-top; flip to top-to-bottom for ImageData\n const rowSize = width * 4;\n const halfHeight = Math.floor(height / 2);\n const temp = new Uint8Array(rowSize);\n for (let y = 0; y < halfHeight; y++) {\n const topOffset = y * rowSize;\n const bottomOffset = (height - 1 - y) * rowSize;\n temp.set(pixels.subarray(topOffset, topOffset + rowSize));\n pixels.set(\n pixels.subarray(bottomOffset, bottomOffset + rowSize),\n topOffset,\n );\n pixels.set(temp, bottomOffset);\n }\n\n return new Uint8ClampedArray(pixels.buffer);\n}\n\n/**\n * Create a snapshot copy of a canvas's current pixels.\n * This captures the pixels synchronously before any async encoding,\n * preventing race conditions where the source canvas is modified.\n *\n * For WebGL canvases, uses gl.readPixels() to bypass the compositor's\n * presentation layer (which is suspended in hidden browser tabs).\n *\n * For offscreen-rendered canvases, this automatically uses the capture proxy\n * canvas instead of the transferred display canvas.\n */\nfunction snapshotCanvas(\n canvas: HTMLCanvasElement,\n scale: number,\n preserveAlpha: boolean,\n): HTMLCanvasElement {\n // If this canvas was transferred to offscreen, use its capture proxy\n const captureProxy = findCaptureProxy(canvas);\n const sourceCanvas = captureProxy ?? canvas;\n\n const targetWidth = Math.max(1, Math.floor(sourceCanvas.width * scale));\n const targetHeight = Math.max(1, Math.floor(sourceCanvas.height * scale));\n\n const copy = document.createElement(\"canvas\");\n copy.width = targetWidth;\n copy.height = targetHeight;\n\n if (preserveAlpha) {\n copy.dataset.preserveAlpha = \"true\";\n }\n\n const ctx = copy.getContext(\"2d\");\n if (ctx && sourceCanvas.width > 0 && sourceCanvas.height > 0) {\n // Try reading directly from WebGL drawing buffer (bypasses compositor)\n // Only needed when page is hidden - compositor is suspended in hidden tabs\n const useGlBypass = document.hidden;\n const glPixels = useGlBypass ? readWebGLPixels(sourceCanvas) : null;\n if (glPixels) {\n const srcW = sourceCanvas.width;\n const srcH = sourceCanvas.height;\n const imageData = new ImageData(\n glPixels as unknown as Uint8ClampedArray<ArrayBuffer>,\n srcW,\n srcH,\n );\n\n if (targetWidth === srcW && targetHeight === srcH) {\n ctx.putImageData(imageData, 0, 0);\n } else {\n // putImageData doesn't scale — bounce through a temp canvas\n const temp = document.createElement(\"canvas\");\n temp.width = srcW;\n temp.height = srcH;\n temp.getContext(\"2d\")!.putImageData(imageData, 0, 0);\n ctx.drawImage(temp, 0, 0, targetWidth, targetHeight);\n }\n } else {\n // Non-WebGL canvas: drawImage is synchronous and correct\n ctx.drawImage(sourceCanvas, 0, 0, targetWidth, targetHeight);\n }\n }\n\n return copy;\n}\n\n/**\n * Serialize a canvas element as an <img> with base64 data URL.\n * Creates a snapshot of current pixels before async encoding to prevent race conditions.\n *\n * OPTIMIZATION: Calculate optimal encoding resolution based on:\n * 1. CSS display size (how big it actually appears)\n * 2. Video export scale (output resolution multiplier)\n * 3. Quality multiplier (for sharpness, default 1.5x)\n */\nfunction serializeCanvas(\n sourceElement: Element,\n canvas: HTMLCanvasElement,\n parts: Array<string | Promise<string>>,\n canvasJobs: CanvasJob[],\n options: InternalSerializationOptions,\n): void {\n // If this canvas was transferred to offscreen, use its capture proxy\n const captureProxy = findCaptureProxy(canvas);\n const sourceCanvas = captureProxy ?? canvas;\n\n // Use intrinsic canvas dimensions, not computed styles (which may be zoom-affected)\n const width = sourceCanvas.width;\n const height = sourceCanvas.height;\n\n // Skip empty canvases\n if (width === 0 || height === 0) {\n return;\n }\n\n // Get computed style once and reuse\n const computedStyle = getComputedStyle(sourceElement);\n const styleStr = serializeComputedStyles(sourceElement, computedStyle);\n\n // Get computed dimensions from source element (respects CSS like w-[420px])\n const computedWidth = computedStyle.width;\n const computedHeight = computedStyle.height;\n\n // Preserve the source element's object-fit and object-position for correct scaling.\n // These CSS properties control how the canvas content fits its container and must be\n // carried through to the serialized <img> to maintain visual fidelity.\n const styleParts = styleStr\n ? styleStr.split(\";\").filter((s) => s.trim())\n : [];\n\n // Remove width/height from computed styles (we'll set them explicitly from computed dimensions)\n const filteredParts = styleParts.filter((s) => {\n const trimmed = s.trim();\n return !trimmed.startsWith(\"width:\") && !trimmed.startsWith(\"height:\");\n });\n\n // Use host element dimensions if available, otherwise fall back to canvas natural dimensions\n const displayWidth = computedWidth || `${width}px`;\n const displayHeight = computedHeight || `${height}px`;\n\n filteredParts.push(`width:${displayWidth}`);\n filteredParts.push(`height:${displayHeight}`);\n filteredParts.push(`display:block`);\n\n const finalStyle = filteredParts.join(\";\");\n\n // Check if we need to preserve alpha channel\n const preserveAlpha = shouldPreserveAlpha(sourceElement);\n\n // CRITICAL: Calculate optimal encoding scale BEFORE creating snapshot.\n // This prevents encoding at full resolution when CSS display size is much smaller.\n let optimalScale = options.scaleConfig.exportScale; // Start with export scale as fallback\n\n try {\n const cssWidth = parseFloat(computedWidth) || sourceCanvas.width;\n const cssHeight = parseFloat(computedHeight) || sourceCanvas.height;\n\n // Use ScaleConfig to compute optimal canvas scale\n optimalScale = options.scaleConfig.computeCanvasScale({\n naturalWidth: sourceCanvas.width,\n naturalHeight: sourceCanvas.height,\n displayWidth: cssWidth,\n displayHeight: cssHeight,\n });\n } catch (e) {\n // Fallback to export scale if we can't get computed style\n console.warn(\n `[serializeCanvas] Failed to get computed style for ${sourceElement.tagName}:`,\n e,\n );\n }\n\n // CRITICAL: Create a snapshot of canvas pixels SYNCHRONOUSLY before any async work.\n // This prevents race conditions where concurrent renders overwrite the shared\n // shadow canvas while encoding is in progress.\n // Note: snapshotCanvas already handles finding the capture proxy internally\n const snapshot = snapshotCanvas(canvas, optimalScale, preserveAlpha);\n\n // Open img tag with all styles from source element\n parts.push(`<img style=\"${escapeXML(finalStyle)}\" src=\"`);\n\n // Kick off async encoding of the SNAPSHOT (not the live canvas)\n const promiseIndex = parts.length;\n options.sourceMap.set(snapshot, sourceElement);\n\n // Snapshot is already scaled, so encode at 1.0 scale\n const encodePromise = encodeCanvasesInParallel([snapshot], {\n scale: 1.0,\n renderContext: options.renderContext,\n sourceMap: options.sourceMap,\n }).then((results) => results[0]?.dataUrl || \"\");\n\n parts.push(encodePromise);\n canvasJobs.push({ canvas: snapshot, sourceElement, promiseIndex });\n\n // Close img tag\n parts.push('\" />');\n}\n\n/**\n * Serialize an image element as a canvas (for shadow DOM img elements).\n */\nfunction serializeImageAsCanvas(\n sourceElement: Element,\n img: HTMLImageElement,\n parts: Array<string | Promise<string>>,\n canvasJobs: CanvasJob[],\n options: InternalSerializationOptions,\n): void {\n // Convert img to canvas for serialization\n const canvas = document.createElement(\"canvas\");\n canvas.width = img.naturalWidth;\n canvas.height = img.naturalHeight;\n\n const ctx = canvas.getContext(\"2d\");\n if (ctx) {\n try {\n ctx.drawImage(img, 0, 0);\n } catch (e) {\n // Cross-origin image - skip\n return;\n }\n }\n\n serializeCanvas(sourceElement, canvas, parts, canvasJobs, options);\n}\n\n/**\n * Serialize slotted light DOM children of a host element.\n */\nfunction serializeSlottedContent(\n slotHost: Element,\n parts: Array<string | Promise<string>>,\n canvasJobs: CanvasJob[],\n options: InternalSerializationOptions,\n parentIsSVG: boolean,\n): void {\n for (const slottedChild of slotHost.childNodes) {\n if (slottedChild.nodeType === Node.TEXT_NODE) {\n const text = slottedChild.textContent;\n if (text && text.length > 0) {\n parts.push(escapeXML(text));\n }\n } else if (slottedChild.nodeType === Node.ELEMENT_NODE) {\n serializeElement(\n slottedChild as Element,\n parts,\n canvasJobs,\n options,\n parentIsSVG,\n null,\n );\n }\n }\n}\n\n/**\n * Recursively serialize an element and its children to XML parts.\n * @param slotHost - When serializing inside shadow DOM, the custom element whose light DOM children should be serialized for slots\n */\nfunction serializeElement(\n element: Element,\n parts: Array<string | Promise<string>>,\n canvasJobs: CanvasJob[],\n options: InternalSerializationOptions,\n parentIsSVG = false,\n slotHost: Element | null = null,\n): void {\n // Skip certain elements\n if (SKIP_TAGS.has(element.tagName)) {\n return;\n }\n\n // Handle SLOT elements - serialize light DOM children of the slot host\n if (element.tagName === \"SLOT\" && slotHost) {\n serializeSlottedContent(slotHost, parts, canvasJobs, options, parentIsSVG);\n return;\n }\n\n // Check temporal visibility - skip elements outside their time bounds\n // This is non-destructive (doesn't modify DOM)\n // NOTE: Ancestor checking is unnecessary - serializeElement walks top-down,\n // so if a parent is temporally invisible, its children are never visited\n if (!isVisibleAtTime(element, options.timeMs)) {\n return;\n }\n\n // Respect updateAnimations' visibility decision for temporal elements.\n // isVisibleAtTime uses inclusive end bounds, but updateAnimations uses\n // exclusive end for mid-composition elements (VisibilityPolicy). When\n // updateAnimations has set display:none, that is the authoritative decision.\n if (\n isTemporal(element) &&\n (element as HTMLElement).style?.getPropertyValue(\"display\") === \"none\"\n ) {\n return;\n }\n\n // Custom element with shadow DOM?\n const isCustom = element.tagName.includes(\"-\");\n if (isCustom && element.shadowRoot) {\n const shadowCanvas = element.shadowRoot.querySelector(\"canvas\");\n if (shadowCanvas) {\n serializeCanvas(element, shadowCanvas, parts, canvasJobs, options);\n return;\n }\n\n const shadowImg = element.shadowRoot.querySelector(\"img\");\n if (shadowImg?.complete && shadowImg.naturalWidth > 0) {\n serializeImageAsCanvas(element, shadowImg, parts, canvasJobs, options);\n return;\n }\n\n // Serialize custom element with its styles, then shadow DOM content inside\n // Use span for inline/inline-block/inline-flex elements to preserve inline behavior\n const computedStyle = getComputedStyle(element);\n let computedDisplay = computedStyle.display;\n // If display:none was set by temporal visibility, resolve the natural display\n // to determine the correct container tag (span vs div)\n if (computedDisplay === \"none\") {\n computedDisplay = resolveNaturalDisplay(element);\n }\n const isInline =\n computedDisplay === \"inline\" ||\n computedDisplay === \"inline-block\" ||\n computedDisplay === \"inline-flex\";\n const containerTag = isInline ? \"span\" : \"div\";\n\n let styleStr = serializeComputedStyles(element, computedStyle);\n\n parts.push(`<${containerTag}`);\n\n // Copy data attributes and class from custom element\n for (const attr of element.attributes) {\n const name = attr.name.toLowerCase();\n if (name === \"class\" || name.startsWith(\"data-\")) {\n parts.push(` ${attr.name}=\"${escapeXML(attr.value)}\"`);\n }\n }\n\n if (styleStr) {\n parts.push(` style=\"${escapeXML(styleStr)}\"`);\n }\n parts.push(\">\");\n\n // Serialize shadow DOM content with this element as the slot host\n for (const child of element.shadowRoot.childNodes) {\n if (child.nodeType === Node.TEXT_NODE) {\n const text = child.textContent;\n if (text && text.length > 0) {\n parts.push(escapeXML(text));\n }\n } else if (child.nodeType === Node.ELEMENT_NODE) {\n // Pass this element as slotHost so nested SLOTs can access light DOM children\n serializeElement(\n child as Element,\n parts,\n canvasJobs,\n options,\n parentIsSVG,\n element,\n );\n }\n }\n\n parts.push(`</${containerTag}>`);\n return;\n }\n\n // Raw canvas in light DOM\n if (element instanceof HTMLCanvasElement) {\n serializeCanvas(element, element, parts, canvasJobs, options);\n return;\n }\n\n // Standard element - serialize to XHTML\n const tagName = element.tagName.toLowerCase();\n const isSVG = element instanceof SVGElement;\n const isVoid = VOID_ELEMENTS.has(tagName);\n\n // Open tag with namespace (only add xmlns for root SVG elements, not children)\n if (isSVG && !parentIsSVG) {\n // Root SVG element - needs xmlns declaration\n parts.push(`<${tagName} xmlns=\"http://www.w3.org/2000/svg\"`);\n } else {\n parts.push(`<${tagName}`);\n }\n\n // Attributes\n serializeAttributes(element, parts);\n\n // Computed styles as inline style attribute\n const styleStr = serializeComputedStyles(element);\n if (styleStr) {\n parts.push(` style=\"${escapeXML(styleStr)}\"`);\n }\n\n // Void elements: self-close with /> (XHTML requirement)\n if (isVoid) {\n parts.push(\" />\");\n return;\n }\n\n parts.push(\">\");\n\n // Children (shadow or light)\n const children = element.shadowRoot?.childNodes || element.childNodes;\n for (const child of children) {\n if (child.nodeType === Node.TEXT_NODE) {\n const text = child.textContent;\n if (text && text.length > 0) {\n parts.push(escapeXML(text));\n }\n } else if (child.nodeType === Node.ELEMENT_NODE) {\n // Preserve slotHost when recursing into standard elements inside shadow DOM\n serializeElement(\n child as Element,\n parts,\n canvasJobs,\n options,\n isSVG,\n slotHost,\n );\n }\n }\n\n // Close tag\n parts.push(`</${tagName}>`);\n}\n\n/**\n * TextEncoder instance for SVG-to-base64 encoding.\n * encode() converts to UTF-8 bytes in a single native call, then we\n * base64-encode the bytes. ~33% overhead vs ~200% for percent-encoding.\n */\nconst textEncoder = new TextEncoder();\n\n/**\n * Synchronous DOM capture phase. Walks the element tree, snapshots canvas\n * pixels, and kicks off async encoding. Returns parts array containing\n * string fragments and encoding promises.\n *\n * After this function returns, the source element's DOM is no longer\n * referenced — the clone can safely be seeked to the next frame.\n *\n * SCALING ARCHITECTURE (unified via ScaleConfig):\n *\n * ScaleConfig centralizes all scaling logic and provides:\n * 1. Output SVG dimensions (width * exportScale, height * exportScale)\n * 2. DOM scaling wrapper (CSS transform:scale when exportScale < 1)\n * 3. Per-canvas optimal encoding scale via computeCanvasScale()\n *\n * Canvas scaling is independent from DOM scaling because:\n * - Canvas elements have intrinsic pixel dimensions and can be downsampled\n * efficiently before encoding (prevents encoding 1920px at full resolution\n * when displayed at 420px)\n * - DOM content has no intrinsic resolution and must be scaled via CSS\n * transforms, which the browser handles during SVG foreignObject rendering\n *\n * Example: 1920x1080 @ 0.5 export scale\n * - Output SVG: 960x540\n * - DOM wrapper: transform:scale(0.5) on 1920x1080 content\n * - Canvas (1920px displayed at 420px): encoded at ~0.16x (315px)\n * via computeCanvasScale(420/1920 * 0.5 * 1.5 quality = 0.164)\n */\nexport function captureElementParts(\n element: Element,\n width: number,\n height: number,\n options: SerializationOptions,\n): Array<string | Promise<string>> {\n const parts: Array<string | Promise<string>> = [];\n const canvasJobs: CanvasJob[] = [];\n const sourceMap = new WeakMap<HTMLCanvasElement, Element>();\n\n // Create ScaleConfig to centralize all scaling logic\n const scaleConfig = ScaleConfig.fromOptions(\n width,\n height,\n options.canvasScale,\n );\n\n const documentStyles =\n options.renderContext?.getCachedDocumentStyles() ?? collectDocumentStyles();\n if (options.renderContext && documentStyles) {\n options.renderContext.setCachedDocumentStyles(documentStyles);\n }\n\n parts.push(\n `<div xmlns=\"http://www.w3.org/1999/xhtml\" ` +\n `style=\"width:${scaleConfig.outputWidth}px;height:${scaleConfig.outputHeight}px;overflow:hidden;position:relative;\">`,\n );\n\n if (documentStyles) {\n parts.push(`<style type=\"text/css\"><![CDATA[${documentStyles}]]></style>`);\n }\n\n // Apply DOM scaling wrapper if needed\n const domTransform = scaleConfig.getDOMTransform();\n if (domTransform) {\n const wrapperDims = scaleConfig.getDOMWrapperDimensions();\n parts.push(\n `<div style=\"transform:${domTransform};transform-origin:0 0;` +\n `width:${wrapperDims.width}px;height:${wrapperDims.height}px;\">`,\n );\n }\n\n // Create internal options with ScaleConfig\n const internalOptions: InternalSerializationOptions = {\n renderContext: options.renderContext,\n timeMs: options.timeMs,\n scaleConfig,\n sourceMap,\n };\n\n serializeElement(element, parts, canvasJobs, internalOptions);\n\n if (domTransform) {\n parts.push(\"</div>\");\n }\n\n parts.push(\"</div>\");\n\n return parts;\n}\n\n/**\n * Serialize any element directly to XHTML string.\n *\n * @param element - The element to serialize (timegroup, temporal element, or plain DOM)\n * @param width - Output width\n * @param height - Output height\n * @param options - Serialization options (renderContext, canvasScale, timeMs)\n * @returns XHTML string with all canvases encoded as base64 data URLs\n */\nexport async function serializeElementToXHTML(\n element: Element,\n width: number,\n height: number,\n options: SerializationOptions,\n): Promise<string> {\n const parts = captureElementParts(element, width, height, options);\n const resolvedParts = await Promise.all(parts);\n return resolvedParts.join(\"\");\n}\n\n/**\n * Synchronous capture with deferred data URI encoding.\n *\n * Walks the DOM and snapshots canvas pixels synchronously, then returns\n * a promise that resolves to the SVG data URI once async canvas-to-base64\n * encoding completes. The source element is NOT referenced after this\n * function returns — the caller can immediately mutate/seek the clone.\n */\nexport function captureTimelineToDataUri(\n element: Element,\n width: number,\n height: number,\n options: SerializationOptions,\n): Promise<string> {\n // Create ScaleConfig to compute scaled dimensions\n const scaleConfig = ScaleConfig.fromOptions(\n width,\n height,\n options.canvasScale,\n );\n\n const parts = captureElementParts(element, width, height, options);\n\n return Promise.all(parts).then((resolvedParts) => {\n const xhtml = resolvedParts.join(\"\");\n const svg =\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${scaleConfig.outputWidth}\" height=\"${scaleConfig.outputHeight}\">` +\n `<foreignObject x=\"0\" y=\"0\" width=\"${scaleConfig.outputWidth}\" height=\"${scaleConfig.outputHeight}\">${xhtml}</foreignObject>` +\n `</svg>`;\n // Encode SVG to base64 data URI inline (avoids module-level function reference issues)\n const bytes = textEncoder.encode(svg);\n let binary = \"\";\n for (let i = 0; i < bytes.length; i += 8192) {\n binary += String.fromCharCode.apply(\n null,\n bytes.subarray(i, i + 8192) as unknown as number[],\n );\n }\n return `data:image/svg+xml;base64,${btoa(binary)}`;\n });\n}\n"],"mappings":";;;;;;;;AAsBA,SAAS,wBAAgC;CACvC,MAAMA,QAAkB,EAAE;AAC1B,KAAI;AACF,OAAK,MAAM,SAAS,SAAS,YAC3B,KAAI;AACF,OAAI,MAAM,SACR,MAAK,MAAM,QAAQ,MAAM,SACvB,OAAM,KAAK,KAAK,QAAQ;UAGtB;UAIH,GAAG;AACV,UAAQ,KACN,kEACA,EACD;;AAEH,QAAO,MAAM,KAAK,KAAK;;;;;;AAOzB,MAAM,YAAY,IAAI,IAAI;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;;AAMF,MAAM,gBAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,MAAM,8BAA8B;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;AAMD,MAAM,qBAAqB,IAAI,IAAI;CACjC;CACA;CACA;CACA;CACD,CAAC;;;;AAwBF,SAAS,UAAU,KAAqB;AACtC,QAAO,IACJ,QAAQ,MAAM,QAAQ,CACtB,QAAQ,MAAM,OAAO,CACrB,QAAQ,MAAM,OAAO,CACrB,QAAQ,MAAM,SAAS,CACvB,QAAQ,MAAM,SAAS;;;;;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AQ,YACT;CAED,MAAM,QAAQ,oBAAoB,SAAS,OAAO,QAAQ,QAAQ;AAElE,QAAO,QAAQ,IAAI,MAAM,CAAC,MAAM,kBAAkB;EAChD,MAAM,QAAQ,cAAc,KAAK,GAAG;EACpC,MAAM,MACJ,kDAAkD,YAAY,YAAY,YAAY,YAAY,aAAa,sCAC1E,YAAY,YAAY,YAAY,YAAY,aAAa,IAAI,MAAM;EAG9G,MAAM,QAAQ,YAAY,OAAO,IAAI;EACrC,IAAI,SAAS;AACb,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,KACrC,WAAU,OAAO,aAAa,MAC5B,MACA,MAAM,SAAS,GAAG,IAAI,KAAK,CAC5B;AAEH,SAAO,6BAA6B,KAAK,OAAO;GAChD"}
1
+ {"version":3,"file":"serializeTimelineDirect.js","names":["rules: string[]","styleParts: string[]","styleStr","parts: Array<string | Promise<string>>","canvasJobs: CanvasJob[]"],"sources":["../../../src/preview/rendering/serializeTimelineDirect.ts"],"sourcesContent":["/**\n * Direct timeline serialization - no intermediate passive structure.\n *\n * Walks the timeline DOM once and builds XML string directly with promise parts\n * for async canvas encoding. 3x faster than DOM creation + XMLSerializer.\n *\n * Architecture:\n * 1. Walk timeline recursively\n * 2. Build array of string parts (some are promises for canvas encoding)\n * 3. Handle shadow DOM by serializing shadow content instead of light DOM\n * 4. Await all promises\n * 5. Join parts into final XML\n */\n\nimport { encodeCanvasesInParallel } from \"../encoding/canvasEncoder.js\";\nimport type { RenderContext } from \"../RenderContext.js\";\nimport { isTemporal, isVisibleAtTime } from \"../previewTypes.js\";\nimport { ScaleConfig } from \"./ScaleConfig.js\";\n\n/**\n * Collect document styles for shadow DOM injection.\n */\nfunction collectDocumentStyles(): string {\n const rules: string[] = [];\n try {\n for (const sheet of document.styleSheets) {\n try {\n if (sheet.cssRules) {\n for (const rule of sheet.cssRules) {\n rules.push(rule.cssText);\n }\n }\n } catch {\n // Expected: cross-origin stylesheets block cssRules access\n }\n }\n } catch (e) {\n console.warn(\n \"[collectDocumentStyles] Failed to access document.styleSheets:\",\n e,\n );\n }\n return rules.join(\"\\n\");\n}\n\n/**\n * Elements to skip entirely when serializing.\n * NOTE: SLOT is NOT skipped - it's handled specially to serialize light DOM children.\n */\nconst SKIP_TAGS = new Set([\n \"EF-AUDIO\",\n \"EF-THUMBNAIL-STRIP\",\n \"EF-FILMSTRIP\",\n \"EF-TIMELINE\",\n \"EF-WORKBENCH\",\n \"SCRIPT\",\n \"STYLE\",\n \"TEMPLATE\",\n]);\n\n/**\n * HTML void elements - these cannot have children and must be self-closing in XHTML.\n * Using `<br />` instead of `<br></br>`.\n */\nconst VOID_ELEMENTS = new Set([\n \"area\",\n \"base\",\n \"br\",\n \"col\",\n \"embed\",\n \"hr\",\n \"img\",\n \"input\",\n \"link\",\n \"meta\",\n \"param\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\n\n/**\n * CSS properties to serialize as inline styles.\n */\nconst SERIALIZED_STYLE_PROPERTIES = [\n \"display\",\n \"visibility\",\n \"opacity\",\n \"position\",\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n \"zIndex\",\n \"width\",\n \"height\",\n \"minWidth\",\n \"minHeight\",\n \"maxWidth\",\n \"maxHeight\",\n \"flexGrow\",\n \"flexShrink\",\n \"flexBasis\",\n \"flexDirection\",\n \"flexWrap\",\n \"justifyContent\",\n \"alignItems\",\n \"alignContent\",\n \"alignSelf\",\n \"gap\",\n \"gridTemplate\",\n \"gridColumn\",\n \"gridRow\",\n \"gridArea\",\n \"margin\",\n \"padding\",\n \"boxSizing\",\n \"border\",\n \"borderTop\",\n \"borderRight\",\n \"borderBottom\",\n \"borderLeft\",\n \"borderRadius\",\n \"background\",\n \"color\",\n \"boxShadow\",\n \"filter\",\n \"backdropFilter\",\n \"clipPath\",\n \"fontFamily\",\n \"fontSize\",\n \"fontWeight\",\n \"fontStyle\",\n \"fontVariant\",\n \"textAlign\",\n \"textDecoration\",\n \"textShadow\",\n \"textTransform\",\n \"letterSpacing\",\n \"wordSpacing\",\n \"whiteSpace\",\n \"textOverflow\",\n \"lineHeight\",\n \"verticalAlign\",\n \"transform\",\n \"transformOrigin\",\n \"transformStyle\",\n \"perspective\",\n \"perspectiveOrigin\",\n \"backfaceVisibility\",\n \"cursor\",\n \"pointerEvents\",\n \"userSelect\",\n \"overflow\",\n \"objectFit\",\n \"objectPosition\",\n] as const;\n\n/**\n * Caption child elements that should preserve display:none.\n * These use display:none for content visibility, not temporal visibility.\n */\nconst CAPTION_CHILD_TAGS = new Set([\n \"EF-CAPTIONS-ACTIVE-WORD\",\n \"EF-CAPTIONS-BEFORE-ACTIVE-WORD\",\n \"EF-CAPTIONS-AFTER-ACTIVE-WORD\",\n \"EF-CAPTIONS-SEGMENT\",\n]);\n\ninterface SerializationOptions {\n renderContext?: RenderContext;\n canvasScale: number;\n timeMs: number;\n}\n\ninterface InternalSerializationOptions {\n renderContext?: RenderContext;\n timeMs: number;\n scaleConfig: ScaleConfig;\n sourceMap: WeakMap<HTMLCanvasElement, Element>;\n}\n\ninterface CanvasJob {\n canvas: HTMLCanvasElement;\n sourceElement: Element;\n promiseIndex: number;\n}\n\n/**\n * Escape special XML characters.\n */\nfunction escapeXML(str: string): string {\n return str\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/'/g, \"&apos;\");\n}\n\n/**\n * Resolve the natural display value for an element that has display:none\n * set as an inline style (e.g., from temporal visibility via updateAnimations).\n *\n * Temporarily removes the inline display override so getComputedStyle falls\n * through to the element's stylesheet rules (including shadow DOM :host styles),\n * reads the natural value, then restores the override.\n */\nfunction resolveNaturalDisplay(element: Element): string {\n const htmlEl = element as HTMLElement;\n const inlineDisplay = htmlEl.style?.getPropertyValue(\"display\");\n if (inlineDisplay === \"none\" && htmlEl.style) {\n htmlEl.style.removeProperty(\"display\");\n const natural = getComputedStyle(element).getPropertyValue(\"display\");\n htmlEl.style.setProperty(\"display\", \"none\");\n return natural || \"block\";\n }\n return \"block\";\n}\n\n/**\n * Serialize computed styles as inline style string.\n * Handles display:none recovery for non-caption elements by resolving\n * the element's natural display value from its stylesheet rules.\n * @param element - The element to serialize styles for\n * @param styles - Optional pre-computed CSSStyleDeclaration (avoids redundant getComputedStyle calls)\n */\nfunction serializeComputedStyles(\n element: Element,\n styles?: CSSStyleDeclaration,\n): string {\n const computed = styles ?? getComputedStyle(element);\n const styleParts: string[] = [];\n const tagName = element.tagName;\n const isCaptionChild = CAPTION_CHILD_TAGS.has(tagName);\n\n // Check if the element has explicit width/height in its inline style.\n // For elements that auto-size to content (inline, inline-block text),\n // serializing the computed \"used\" pixel width/height would lock them to\n // exact dimensions that may not match the foreignObject rendering context,\n // causing text wrapping when font metrics differ slightly.\n const htmlEl = element as HTMLElement;\n const hasExplicitWidth = !!htmlEl.style?.getPropertyValue(\"width\");\n const hasExplicitHeight = !!htmlEl.style?.getPropertyValue(\"height\");\n\n for (const prop of SERIALIZED_STYLE_PROPERTIES) {\n // Convert camelCase to kebab-case first\n const kebab = prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);\n const value = computed.getPropertyValue(kebab);\n\n // Skip only truly empty values\n if (!value || value === \"\") {\n continue;\n }\n\n // Handle display property specially\n let finalValue = value;\n if (prop === \"display\") {\n // For non-caption elements, recover the natural display value when display:none\n // was set by the temporal visibility system (updateAnimations). This prevents\n // inline elements (like ef-text-segment) from being serialized as display:block.\n if (value === \"none\" && !isCaptionChild) {\n finalValue = resolveNaturalDisplay(element);\n }\n }\n\n // Force visibility:visible - the source container may have visibility:hidden\n // for off-screen rendering, but we want the serialized output to be visible\n if (prop === \"visibility\") {\n finalValue = \"visible\";\n }\n\n // Skip the proxy-mode sentinel value: inset(100%) hides the element\n // off-screen while keeping it in the layout. All other clip-path values\n // are legitimate visual effects and must be preserved.\n if (prop === \"clipPath\" && value === \"inset(100%)\") {\n continue;\n }\n\n // Skip width/height when not explicitly set on the element.\n // getComputedStyle returns \"used\" pixel values for width/height even when\n // the specified value is auto. Serializing these pixel values locks\n // content-sized elements (text segments, inline-block spans) to exact\n // dimensions, which breaks when the foreignObject context renders text\n // with different font metrics.\n if (prop === \"width\" && !hasExplicitWidth) {\n continue;\n }\n if (prop === \"height\" && !hasExplicitHeight) {\n continue;\n }\n\n styleParts.push(`${kebab}:${finalValue}`);\n }\n\n // Disable animations/transitions to prevent re-animation\n styleParts.push(\"animation:none\", \"transition:none\");\n\n return styleParts.join(\";\");\n}\n\n/**\n * Serialize element attributes (excluding style, id, xmlns, event handlers).\n */\nfunction serializeAttributes(\n element: Element,\n parts: Array<string | Promise<string>>,\n): void {\n for (const attr of element.attributes) {\n const name = attr.name.toLowerCase();\n // Skip: id, style, xmlns (namespace handled separately), event handlers\n if (\n name === \"id\" ||\n name === \"style\" ||\n name === \"xmlns\" ||\n name.startsWith(\"on\")\n ) {\n continue;\n }\n parts.push(` ${attr.name}=\"${escapeXML(attr.value)}\"`);\n }\n}\n\n/**\n * Check if a canvas element should preserve alpha channel.\n * EF-WAVEFORM always needs alpha, EF-IMAGE checks hasAlpha property.\n * EF-SURFACE needs alpha because:\n * 1. Without a target, its canvas is transparent and CSS background should show through\n * 2. The target element may have transparent content\n * Raw canvas elements must preserve alpha - we don't know what they contain.\n */\nfunction shouldPreserveAlpha(sourceElement: Element): boolean {\n const tagName = sourceElement.tagName;\n if (tagName === \"EF-WAVEFORM\") {\n return true;\n }\n if (tagName === \"EF-SURFACE\") {\n // Surface needs alpha to allow CSS background to show through empty areas\n return true;\n }\n if (tagName === \"EF-IMAGE\") {\n return (\n \"hasAlpha\" in sourceElement && (sourceElement as any).hasAlpha === true\n );\n }\n // Raw canvas elements must preserve alpha\n if (sourceElement instanceof HTMLCanvasElement) {\n return true;\n }\n return false;\n}\n\n/**\n * Find the capture proxy canvas for an offscreen-rendered canvas.\n * When a canvas is transferred to offscreen via transferControlToOffscreen(),\n * the main thread can no longer read pixels from it. OffscreenCompositionCanvas\n * creates a hidden capture canvas (marked with data-offscreen-capture) that\n * receives ImageBitmap frames from the worker.\n */\nfunction findCaptureProxy(canvas: HTMLCanvasElement): HTMLCanvasElement | null {\n const container = canvas.parentElement;\n if (!container) return null;\n return container.querySelector('canvas[data-offscreen-capture=\"true\"]');\n}\n\n/**\n * Read pixels directly from a WebGL canvas's drawing buffer via gl.readPixels().\n *\n * drawImage(webglCanvas) reads from the compositor's \"presented\" surface, which\n * is only refreshed during requestAnimationFrame / compositing cycles. In hidden\n * browser tabs, compositing is suspended, so drawImage returns stale pixels even\n * though gl.render() produced new content in the drawing buffer.\n *\n * readPixels() reads from the drawing buffer directly, bypassing the compositor.\n *\n * Returns null for non-WebGL canvases (getContext returns null when a different\n * context type is already active).\n */\nfunction readWebGLPixels(canvas: HTMLCanvasElement): Uint8ClampedArray | null {\n const gl = (canvas.getContext(\"webgl2\") ??\n canvas.getContext(\"webgl\")) as WebGLRenderingContext | null;\n if (!gl) return null;\n\n const width = canvas.width;\n const height = canvas.height;\n if (width === 0 || height === 0) return null;\n\n // Ensure we read from the drawing buffer, not a leftover FBO\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n const pixels = new Uint8Array(width * height * 4);\n gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels);\n\n // readPixels returns rows bottom-to-top; flip to top-to-bottom for ImageData\n const rowSize = width * 4;\n const halfHeight = Math.floor(height / 2);\n const temp = new Uint8Array(rowSize);\n for (let y = 0; y < halfHeight; y++) {\n const topOffset = y * rowSize;\n const bottomOffset = (height - 1 - y) * rowSize;\n temp.set(pixels.subarray(topOffset, topOffset + rowSize));\n pixels.set(\n pixels.subarray(bottomOffset, bottomOffset + rowSize),\n topOffset,\n );\n pixels.set(temp, bottomOffset);\n }\n\n return new Uint8ClampedArray(pixels.buffer);\n}\n\n/**\n * Create a snapshot copy of a canvas's current pixels.\n * This captures the pixels synchronously before any async encoding,\n * preventing race conditions where the source canvas is modified.\n *\n * For WebGL canvases, uses gl.readPixels() to bypass the compositor's\n * presentation layer (which is suspended in hidden browser tabs).\n *\n * For offscreen-rendered canvases, this automatically uses the capture proxy\n * canvas instead of the transferred display canvas.\n */\nfunction snapshotCanvas(\n canvas: HTMLCanvasElement,\n scale: number,\n preserveAlpha: boolean,\n): HTMLCanvasElement {\n // If this canvas was transferred to offscreen, use its capture proxy\n const captureProxy = findCaptureProxy(canvas);\n const sourceCanvas = captureProxy ?? canvas;\n\n const targetWidth = Math.max(1, Math.floor(sourceCanvas.width * scale));\n const targetHeight = Math.max(1, Math.floor(sourceCanvas.height * scale));\n\n const copy = document.createElement(\"canvas\");\n copy.width = targetWidth;\n copy.height = targetHeight;\n\n if (preserveAlpha) {\n copy.dataset.preserveAlpha = \"true\";\n }\n\n const ctx = copy.getContext(\"2d\");\n if (ctx && sourceCanvas.width > 0 && sourceCanvas.height > 0) {\n // Try reading directly from WebGL drawing buffer (bypasses compositor)\n // Only needed when page is hidden - compositor is suspended in hidden tabs\n const useGlBypass = document.hidden;\n const glPixels = useGlBypass ? readWebGLPixels(sourceCanvas) : null;\n if (glPixels) {\n const srcW = sourceCanvas.width;\n const srcH = sourceCanvas.height;\n const imageData = new ImageData(\n glPixels as unknown as Uint8ClampedArray<ArrayBuffer>,\n srcW,\n srcH,\n );\n\n if (targetWidth === srcW && targetHeight === srcH) {\n ctx.putImageData(imageData, 0, 0);\n } else {\n // putImageData doesn't scale — bounce through a temp canvas\n const temp = document.createElement(\"canvas\");\n temp.width = srcW;\n temp.height = srcH;\n temp.getContext(\"2d\")!.putImageData(imageData, 0, 0);\n ctx.drawImage(temp, 0, 0, targetWidth, targetHeight);\n }\n } else {\n // Non-WebGL canvas: drawImage is synchronous and correct\n ctx.drawImage(sourceCanvas, 0, 0, targetWidth, targetHeight);\n }\n }\n\n return copy;\n}\n\n/**\n * Serialize a canvas element as an <img> with base64 data URL.\n * Creates a snapshot of current pixels before async encoding to prevent race conditions.\n *\n * OPTIMIZATION: Calculate optimal encoding resolution based on:\n * 1. CSS display size (how big it actually appears)\n * 2. Video export scale (output resolution multiplier)\n * 3. Quality multiplier (for sharpness, default 1.5x)\n */\nfunction serializeCanvas(\n sourceElement: Element,\n canvas: HTMLCanvasElement,\n parts: Array<string | Promise<string>>,\n canvasJobs: CanvasJob[],\n options: InternalSerializationOptions,\n): void {\n // If this canvas was transferred to offscreen, use its capture proxy\n const captureProxy = findCaptureProxy(canvas);\n const sourceCanvas = captureProxy ?? canvas;\n\n // Use intrinsic canvas dimensions, not computed styles (which may be zoom-affected)\n const width = sourceCanvas.width;\n const height = sourceCanvas.height;\n\n // Skip empty canvases\n if (width === 0 || height === 0) {\n return;\n }\n\n // Get computed style once and reuse\n const computedStyle = getComputedStyle(sourceElement);\n const styleStr = serializeComputedStyles(sourceElement, computedStyle);\n\n // Get computed dimensions from source element (respects CSS like w-[420px])\n const computedWidth = computedStyle.width;\n const computedHeight = computedStyle.height;\n\n // Preserve the source element's object-fit and object-position for correct scaling.\n // These CSS properties control how the canvas content fits its container and must be\n // carried through to the serialized <img> to maintain visual fidelity.\n const styleParts = styleStr\n ? styleStr.split(\";\").filter((s) => s.trim())\n : [];\n\n // Remove width/height from computed styles (we'll set them explicitly from computed dimensions)\n const filteredParts = styleParts.filter((s) => {\n const trimmed = s.trim();\n return !trimmed.startsWith(\"width:\") && !trimmed.startsWith(\"height:\");\n });\n\n // Use host element dimensions if available, otherwise fall back to canvas natural dimensions\n const displayWidth = computedWidth || `${width}px`;\n const displayHeight = computedHeight || `${height}px`;\n\n filteredParts.push(`width:${displayWidth}`);\n filteredParts.push(`height:${displayHeight}`);\n filteredParts.push(`display:block`);\n\n const finalStyle = filteredParts.join(\";\");\n\n // Check if we need to preserve alpha channel\n const preserveAlpha = shouldPreserveAlpha(sourceElement);\n\n // CRITICAL: Calculate optimal encoding scale BEFORE creating snapshot.\n // This prevents encoding at full resolution when CSS display size is much smaller.\n let optimalScale = options.scaleConfig.exportScale; // Start with export scale as fallback\n\n try {\n const cssWidth = parseFloat(computedWidth) || sourceCanvas.width;\n const cssHeight = parseFloat(computedHeight) || sourceCanvas.height;\n\n // Use ScaleConfig to compute optimal canvas scale\n optimalScale = options.scaleConfig.computeCanvasScale({\n naturalWidth: sourceCanvas.width,\n naturalHeight: sourceCanvas.height,\n displayWidth: cssWidth,\n displayHeight: cssHeight,\n });\n } catch (e) {\n // Fallback to export scale if we can't get computed style\n console.warn(\n `[serializeCanvas] Failed to get computed style for ${sourceElement.tagName}:`,\n e,\n );\n }\n\n // CRITICAL: Create a snapshot of canvas pixels SYNCHRONOUSLY before any async work.\n // This prevents race conditions where concurrent renders overwrite the shared\n // shadow canvas while encoding is in progress.\n // Note: snapshotCanvas already handles finding the capture proxy internally\n const snapshot = snapshotCanvas(canvas, optimalScale, preserveAlpha);\n\n // Open img tag with all styles from source element\n parts.push(`<img style=\"${escapeXML(finalStyle)}\" src=\"`);\n\n // Kick off async encoding of the SNAPSHOT (not the live canvas)\n const promiseIndex = parts.length;\n options.sourceMap.set(snapshot, sourceElement);\n\n // Snapshot is already scaled, so encode at 1.0 scale\n const encodePromise = encodeCanvasesInParallel([snapshot], {\n scale: 1.0,\n renderContext: options.renderContext,\n sourceMap: options.sourceMap,\n }).then((results) => results[0]?.dataUrl || \"\");\n\n parts.push(encodePromise);\n canvasJobs.push({ canvas: snapshot, sourceElement, promiseIndex });\n\n // Close img tag\n parts.push('\" />');\n}\n\n/**\n * Serialize an image element as a canvas (for shadow DOM img elements).\n */\nfunction serializeImageAsCanvas(\n sourceElement: Element,\n img: HTMLImageElement,\n parts: Array<string | Promise<string>>,\n canvasJobs: CanvasJob[],\n options: InternalSerializationOptions,\n): void {\n // Convert img to canvas for serialization\n const canvas = document.createElement(\"canvas\");\n canvas.width = img.naturalWidth;\n canvas.height = img.naturalHeight;\n\n const ctx = canvas.getContext(\"2d\");\n if (ctx) {\n try {\n ctx.drawImage(img, 0, 0);\n } catch (e) {\n // Cross-origin image - skip\n return;\n }\n }\n\n serializeCanvas(sourceElement, canvas, parts, canvasJobs, options);\n}\n\n/**\n * Serialize slotted light DOM children of a host element.\n */\nfunction serializeSlottedContent(\n slotHost: Element,\n parts: Array<string | Promise<string>>,\n canvasJobs: CanvasJob[],\n options: InternalSerializationOptions,\n parentIsSVG: boolean,\n): void {\n for (const slottedChild of slotHost.childNodes) {\n if (slottedChild.nodeType === Node.TEXT_NODE) {\n const text = slottedChild.textContent;\n if (text && text.length > 0) {\n parts.push(escapeXML(text));\n }\n } else if (slottedChild.nodeType === Node.ELEMENT_NODE) {\n serializeElement(\n slottedChild as Element,\n parts,\n canvasJobs,\n options,\n parentIsSVG,\n null,\n );\n }\n }\n}\n\n/**\n * Recursively serialize an element and its children to XML parts.\n * @param slotHost - When serializing inside shadow DOM, the custom element whose light DOM children should be serialized for slots\n */\nfunction serializeElement(\n element: Element,\n parts: Array<string | Promise<string>>,\n canvasJobs: CanvasJob[],\n options: InternalSerializationOptions,\n parentIsSVG = false,\n slotHost: Element | null = null,\n): void {\n // Skip certain elements\n if (SKIP_TAGS.has(element.tagName)) {\n return;\n }\n\n // Handle SLOT elements - serialize light DOM children of the slot host\n if (element.tagName === \"SLOT\" && slotHost) {\n serializeSlottedContent(slotHost, parts, canvasJobs, options, parentIsSVG);\n return;\n }\n\n // Check temporal visibility - skip elements outside their time bounds\n // This is non-destructive (doesn't modify DOM)\n // NOTE: Ancestor checking is unnecessary - serializeElement walks top-down,\n // so if a parent is temporally invisible, its children are never visited\n if (!isVisibleAtTime(element, options.timeMs)) {\n return;\n }\n\n // Respect updateAnimations' visibility decision for temporal elements.\n // isVisibleAtTime uses inclusive end bounds, but updateAnimations uses\n // exclusive end for mid-composition elements (VisibilityPolicy). When\n // updateAnimations has set display:none, that is the authoritative decision.\n if (\n isTemporal(element) &&\n (element as HTMLElement).style?.getPropertyValue(\"display\") === \"none\"\n ) {\n return;\n }\n\n // Custom element with shadow DOM?\n const isCustom = element.tagName.includes(\"-\");\n if (isCustom && element.shadowRoot) {\n const shadowCanvas = element.shadowRoot.querySelector(\"canvas\");\n if (shadowCanvas) {\n serializeCanvas(element, shadowCanvas, parts, canvasJobs, options);\n return;\n }\n\n const shadowImg = element.shadowRoot.querySelector(\"img\");\n if (shadowImg?.complete && shadowImg.naturalWidth > 0) {\n serializeImageAsCanvas(element, shadowImg, parts, canvasJobs, options);\n return;\n }\n\n // Serialize custom element with its styles, then shadow DOM content inside\n // Use span for inline/inline-block/inline-flex elements to preserve inline behavior\n const computedStyle = getComputedStyle(element);\n let computedDisplay = computedStyle.display;\n // If display:none was set by temporal visibility, resolve the natural display\n // to determine the correct container tag (span vs div)\n if (computedDisplay === \"none\") {\n computedDisplay = resolveNaturalDisplay(element);\n }\n const isInline =\n computedDisplay === \"inline\" ||\n computedDisplay === \"inline-block\" ||\n computedDisplay === \"inline-flex\";\n const containerTag = isInline ? \"span\" : \"div\";\n\n let styleStr = serializeComputedStyles(element, computedStyle);\n\n parts.push(`<${containerTag}`);\n\n // Copy data attributes and class from custom element\n for (const attr of element.attributes) {\n const name = attr.name.toLowerCase();\n if (name === \"class\" || name.startsWith(\"data-\")) {\n parts.push(` ${attr.name}=\"${escapeXML(attr.value)}\"`);\n }\n }\n\n if (styleStr) {\n parts.push(` style=\"${escapeXML(styleStr)}\"`);\n }\n parts.push(\">\");\n\n // Serialize shadow DOM content with this element as the slot host\n for (const child of element.shadowRoot.childNodes) {\n if (child.nodeType === Node.TEXT_NODE) {\n const text = child.textContent;\n if (text && text.length > 0) {\n parts.push(escapeXML(text));\n }\n } else if (child.nodeType === Node.ELEMENT_NODE) {\n // Pass this element as slotHost so nested SLOTs can access light DOM children\n serializeElement(\n child as Element,\n parts,\n canvasJobs,\n options,\n parentIsSVG,\n element,\n );\n }\n }\n\n parts.push(`</${containerTag}>`);\n return;\n }\n\n // Raw canvas in light DOM\n if (element instanceof HTMLCanvasElement) {\n serializeCanvas(element, element, parts, canvasJobs, options);\n return;\n }\n\n // Standard element - serialize to XHTML\n const tagName = element.tagName.toLowerCase();\n const isSVG = element instanceof SVGElement;\n const isVoid = VOID_ELEMENTS.has(tagName);\n\n // Open tag with namespace (only add xmlns for root SVG elements, not children)\n if (isSVG && !parentIsSVG) {\n // Root SVG element - needs xmlns declaration\n parts.push(`<${tagName} xmlns=\"http://www.w3.org/2000/svg\"`);\n } else {\n parts.push(`<${tagName}`);\n }\n\n // Attributes\n serializeAttributes(element, parts);\n\n // Computed styles as inline style attribute\n const styleStr = serializeComputedStyles(element);\n if (styleStr) {\n parts.push(` style=\"${escapeXML(styleStr)}\"`);\n }\n\n // Void elements: self-close with /> (XHTML requirement)\n if (isVoid) {\n parts.push(\" />\");\n return;\n }\n\n parts.push(\">\");\n\n // Children (shadow or light)\n const children = element.shadowRoot?.childNodes || element.childNodes;\n for (const child of children) {\n if (child.nodeType === Node.TEXT_NODE) {\n const text = child.textContent;\n if (text && text.length > 0) {\n parts.push(escapeXML(text));\n }\n } else if (child.nodeType === Node.ELEMENT_NODE) {\n // Preserve slotHost when recursing into standard elements inside shadow DOM\n serializeElement(\n child as Element,\n parts,\n canvasJobs,\n options,\n isSVG,\n slotHost,\n );\n }\n }\n\n // Close tag\n parts.push(`</${tagName}>`);\n}\n\n/**\n * TextEncoder instance for SVG-to-base64 encoding.\n * encode() converts to UTF-8 bytes in a single native call, then we\n * base64-encode the bytes. ~33% overhead vs ~200% for percent-encoding.\n */\nconst textEncoder = new TextEncoder();\n\n/**\n * Synchronous DOM capture phase. Walks the element tree, snapshots canvas\n * pixels, and kicks off async encoding. Returns parts array containing\n * string fragments and encoding promises.\n *\n * After this function returns, the source element's DOM is no longer\n * referenced — the clone can safely be seeked to the next frame.\n *\n * SCALING ARCHITECTURE (unified via ScaleConfig):\n *\n * ScaleConfig centralizes all scaling logic and provides:\n * 1. Output SVG dimensions (width * exportScale, height * exportScale)\n * 2. DOM scaling wrapper (CSS transform:scale when exportScale < 1)\n * 3. Per-canvas optimal encoding scale via computeCanvasScale()\n *\n * Canvas scaling is independent from DOM scaling because:\n * - Canvas elements have intrinsic pixel dimensions and can be downsampled\n * efficiently before encoding (prevents encoding 1920px at full resolution\n * when displayed at 420px)\n * - DOM content has no intrinsic resolution and must be scaled via CSS\n * transforms, which the browser handles during SVG foreignObject rendering\n *\n * Example: 1920x1080 @ 0.5 export scale\n * - Output SVG: 960x540\n * - DOM wrapper: transform:scale(0.5) on 1920x1080 content\n * - Canvas (1920px displayed at 420px): encoded at ~0.16x (315px)\n * via computeCanvasScale(420/1920 * 0.5 * 1.5 quality = 0.164)\n */\nexport function captureElementParts(\n element: Element,\n width: number,\n height: number,\n options: SerializationOptions,\n): Array<string | Promise<string>> {\n const parts: Array<string | Promise<string>> = [];\n const canvasJobs: CanvasJob[] = [];\n const sourceMap = new WeakMap<HTMLCanvasElement, Element>();\n\n // Create ScaleConfig to centralize all scaling logic\n const scaleConfig = ScaleConfig.fromOptions(\n width,\n height,\n options.canvasScale,\n );\n\n const documentStyles =\n options.renderContext?.getCachedDocumentStyles() ?? collectDocumentStyles();\n if (options.renderContext && documentStyles) {\n options.renderContext.setCachedDocumentStyles(documentStyles);\n }\n\n parts.push(\n `<div xmlns=\"http://www.w3.org/1999/xhtml\" ` +\n `style=\"width:${scaleConfig.outputWidth}px;height:${scaleConfig.outputHeight}px;overflow:hidden;position:relative;\">`,\n );\n\n if (documentStyles) {\n parts.push(`<style type=\"text/css\"><![CDATA[${documentStyles}]]></style>`);\n }\n\n // Apply DOM scaling wrapper if needed\n const domTransform = scaleConfig.getDOMTransform();\n if (domTransform) {\n const wrapperDims = scaleConfig.getDOMWrapperDimensions();\n parts.push(\n `<div style=\"transform:${domTransform};transform-origin:0 0;` +\n `width:${wrapperDims.width}px;height:${wrapperDims.height}px;\">`,\n );\n }\n\n // Create internal options with ScaleConfig\n const internalOptions: InternalSerializationOptions = {\n renderContext: options.renderContext,\n timeMs: options.timeMs,\n scaleConfig,\n sourceMap,\n };\n\n serializeElement(element, parts, canvasJobs, internalOptions);\n\n if (domTransform) {\n parts.push(\"</div>\");\n }\n\n parts.push(\"</div>\");\n\n return parts;\n}\n\n/**\n * Serialize any element directly to XHTML string.\n *\n * @param element - The element to serialize (timegroup, temporal element, or plain DOM)\n * @param width - Output width\n * @param height - Output height\n * @param options - Serialization options (renderContext, canvasScale, timeMs)\n * @returns XHTML string with all canvases encoded as base64 data URLs\n */\nexport async function serializeElementToXHTML(\n element: Element,\n width: number,\n height: number,\n options: SerializationOptions,\n): Promise<string> {\n const parts = captureElementParts(element, width, height, options);\n const resolvedParts = await Promise.all(parts);\n return resolvedParts.join(\"\");\n}\n\n/**\n * Synchronous capture with deferred data URI encoding.\n *\n * Walks the DOM and snapshots canvas pixels synchronously, then returns\n * a promise that resolves to the SVG data URI once async canvas-to-base64\n * encoding completes. The source element is NOT referenced after this\n * function returns — the caller can immediately mutate/seek the clone.\n */\nexport function captureTimelineToDataUri(\n element: Element,\n width: number,\n height: number,\n options: SerializationOptions,\n): Promise<string> {\n // Create ScaleConfig to compute scaled dimensions\n const scaleConfig = ScaleConfig.fromOptions(\n width,\n height,\n options.canvasScale,\n );\n\n const parts = captureElementParts(element, width, height, options);\n\n return Promise.all(parts).then((resolvedParts) => {\n const xhtml = resolvedParts.join(\"\");\n const svg =\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${scaleConfig.outputWidth}\" height=\"${scaleConfig.outputHeight}\">` +\n `<foreignObject x=\"0\" y=\"0\" width=\"${scaleConfig.outputWidth}\" height=\"${scaleConfig.outputHeight}\">${xhtml}</foreignObject>` +\n `</svg>`;\n // Encode SVG to base64 data URI inline (avoids module-level function reference issues)\n const bytes = textEncoder.encode(svg);\n let binary = \"\";\n for (let i = 0; i < bytes.length; i += 8192) {\n binary += String.fromCharCode.apply(\n null,\n bytes.subarray(i, i + 8192) as unknown as number[],\n );\n }\n return `data:image/svg+xml;base64,${btoa(binary)}`;\n });\n}\n"],"mappings":";;;;;;;;AAsBA,SAAS,wBAAgC;CACvC,MAAMA,QAAkB,EAAE;AAC1B,KAAI;AACF,OAAK,MAAM,SAAS,SAAS,YAC3B,KAAI;AACF,OAAI,MAAM,SACR,MAAK,MAAM,QAAQ,MAAM,SACvB,OAAM,KAAK,KAAK,QAAQ;UAGtB;UAIH,GAAG;AACV,UAAQ,KACN,kEACA,EACD;;AAEH,QAAO,MAAM,KAAK,KAAK;;;;;;AAOzB,MAAM,YAAY,IAAI,IAAI;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;;AAMF,MAAM,gBAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;AAKF,MAAM,8BAA8B;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;AAMD,MAAM,qBAAqB,IAAI,IAAI;CACjC;CACA;CACA;CACA;CACD,CAAC;;;;AAwBF,SAAS,UAAU,KAAqB;AACtC,QAAO,IACJ,QAAQ,MAAM,QAAQ,CACtB,QAAQ,MAAM,OAAO,CACrB,QAAQ,MAAM,OAAO,CACrB,QAAQ,MAAM,SAAS,CACvB,QAAQ,MAAM,SAAS;;;;;;;;;;AAW5B,SAAS,sBAAsB,SAA0B;CACvD,MAAM,SAAS;AAEf,KADsB,OAAO,OAAO,iBAAiB,UAAU,KACzC,UAAU,OAAO,OAAO;AAC5C,SAAO,MAAM,eAAe,UAAU;EACtC,MAAM,UAAU,iBAAiB,QAAQ,CAAC,iBAAiB,UAAU;AACrE,SAAO,MAAM,YAAY,WA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E,YAAY,YAAY,YAAY,YAAY,aAAa,IAAI,MAAM;EAG9G,MAAM,QAAQ,YAAY,OAAO,IAAI;EACrC,IAAI,SAAS;AACb,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,KACrC,WAAU,OAAO,aAAa,MAC5B,MACA,MAAM,SAAS,GAAG,IAAI,KAAK,CAC5B;AAEH,SAAO,6BAA6B,KAAK,OAAO;GAChD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editframe/elements",
3
- "version": "0.42.5",
3
+ "version": "0.42.8",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,10 +15,15 @@
15
15
  "typedoc": "(typedoc --json ./types.json --plugin typedoc-plugin-zod --excludeExternals ./src || true) && ([ -f ./types.json ] && jq -c . ./types.json > ./types.tmp.json && mv ./types.tmp.json ./types.json || true)"
16
16
  },
17
17
  "author": "",
18
- "license": "UNLICENSED",
18
+ "license": "SEE LICENSE IN LICENSE-FULL.md",
19
+ "files": [
20
+ "dist",
21
+ "types.json",
22
+ "LICENSE-FULL.md"
23
+ ],
19
24
  "dependencies": {
20
25
  "@bramus/style-observer": "^1.3.0",
21
- "@editframe/assets": "0.42.5",
26
+ "@editframe/assets": "0.42.8",
22
27
  "@lit/context": "^1.1.6",
23
28
  "@opentelemetry/api": "^1.9.0",
24
29
  "@opentelemetry/context-zone": "^1.26.0",
@@ -1,44 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { mkdirSync, readFileSync, writeFileSync, cpSync } from "node:fs";
4
- import { dirname, join } from "node:path";
5
- import { fileURLToPath } from "node:url";
6
- import autoprefixer from "autoprefixer";
7
- import postcss from "postcss";
8
- import tailwindcss from "tailwindcss";
9
-
10
- const __dirname = dirname(fileURLToPath(import.meta.url));
11
- const srcDir = join(__dirname, "..", "src");
12
- const distDir = join(__dirname, "..", "dist");
13
- const configPath = join(__dirname, "..", "tailwind.config.ts");
14
-
15
- // Ensure dist directory exists
16
- mkdirSync(distDir, { recursive: true });
17
- mkdirSync(join(distDir, "gui"), { recursive: true });
18
-
19
- // Read source CSS
20
- const cssPath = join(srcDir, "elements.css");
21
- const css = readFileSync(cssPath, "utf-8");
22
-
23
- // Process through PostCSS
24
- console.log("Processing CSS through Tailwind and PostCSS...");
25
-
26
- postcss([tailwindcss({ config: configPath }), autoprefixer()])
27
- .process(css, { from: cssPath, to: join(distDir, "style.css") })
28
- .then((result) => {
29
- writeFileSync(join(distDir, "style.css"), result.css);
30
- if (result.map) {
31
- writeFileSync(join(distDir, "style.css.map"), result.map.toString());
32
- }
33
- console.log("✅ CSS processed and written to dist/style.css");
34
-
35
- // Copy theme CSS file
36
- const themeCssPath = join(srcDir, "gui", "ef-theme.css");
37
- const themeDistPath = join(distDir, "gui", "ef-theme.css");
38
- cpSync(themeCssPath, themeDistPath);
39
- console.log("✅ Theme CSS copied to dist/gui/ef-theme.css");
40
- })
41
- .catch((error) => {
42
- console.error("❌ CSS processing failed:", error);
43
- process.exit(1);
44
- });
@@ -1,16 +0,0 @@
1
- {
2
- "statusCode": 200,
3
- "headers": {
4
- "access-control-allow-headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization, Range",
5
- "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
6
- "access-control-allow-origin": "*",
7
- "access-control-expose-headers": "Content-Length, Content-Range, X-Cache, X-Actual-Start-Time, X-Actual-Duration, X-Transcode-Time-Ms, X-Total-Server-Time-Ms",
8
- "cache-control": "public, max-age=3600",
9
- "content-length": "32957",
10
- "content-type": "video/iso.segment",
11
- "x-powered-by": "Express"
12
- },
13
- "url": "/api/v1/transcode/audio/1.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4",
14
- "method": "GET",
15
- "range": null
16
- }
@@ -1,16 +0,0 @@
1
- {
2
- "statusCode": 200,
3
- "headers": {
4
- "access-control-allow-headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization, Range",
5
- "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
6
- "access-control-allow-origin": "*",
7
- "access-control-expose-headers": "Content-Length, Content-Range, X-Cache, X-Actual-Start-Time, X-Actual-Duration, X-Transcode-Time-Ms, X-Total-Server-Time-Ms",
8
- "cache-control": "public, max-age=3600",
9
- "content-length": "32502",
10
- "content-type": "video/iso.segment",
11
- "x-powered-by": "Express"
12
- },
13
- "url": "/api/v1/transcode/audio/2.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4",
14
- "method": "GET",
15
- "range": null
16
- }
@@ -1,16 +0,0 @@
1
- {
2
- "statusCode": 200,
3
- "headers": {
4
- "access-control-allow-headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization, Range",
5
- "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
6
- "access-control-allow-origin": "*",
7
- "access-control-expose-headers": "Content-Length, Content-Range, X-Cache, X-Actual-Start-Time, X-Actual-Duration, X-Transcode-Time-Ms, X-Total-Server-Time-Ms",
8
- "cache-control": "public, max-age=3600",
9
- "content-length": "32196",
10
- "content-type": "video/iso.segment",
11
- "x-powered-by": "Express"
12
- },
13
- "url": "/api/v1/transcode/audio/3.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4",
14
- "method": "GET",
15
- "range": null
16
- }
@@ -1,16 +0,0 @@
1
- {
2
- "statusCode": 200,
3
- "headers": {
4
- "access-control-allow-headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization, Range",
5
- "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
6
- "access-control-allow-origin": "*",
7
- "access-control-expose-headers": "Content-Length, Content-Range, X-Cache, X-Actual-Start-Time, X-Actual-Duration, X-Transcode-Time-Ms, X-Total-Server-Time-Ms",
8
- "cache-control": "public, max-age=3600",
9
- "content-length": "32570",
10
- "content-type": "video/iso.segment",
11
- "x-powered-by": "Express"
12
- },
13
- "url": "/api/v1/transcode/audio/4.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4",
14
- "method": "GET",
15
- "range": null
16
- }
@@ -1,16 +0,0 @@
1
- {
2
- "statusCode": 200,
3
- "headers": {
4
- "access-control-allow-headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization, Range",
5
- "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
6
- "access-control-allow-origin": "*",
7
- "access-control-expose-headers": "Content-Length, Content-Range, X-Cache, X-Actual-Start-Time, X-Actual-Duration, X-Transcode-Time-Ms, X-Total-Server-Time-Ms",
8
- "cache-control": "public, max-age=3600",
9
- "content-length": "32922",
10
- "content-type": "video/iso.segment",
11
- "x-powered-by": "Express"
12
- },
13
- "url": "/api/v1/transcode/audio/5.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4",
14
- "method": "GET",
15
- "range": null
16
- }
@@ -1,16 +0,0 @@
1
- {
2
- "statusCode": 200,
3
- "headers": {
4
- "access-control-allow-headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization, Range",
5
- "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
6
- "access-control-allow-origin": "*",
7
- "access-control-expose-headers": "Content-Length, Content-Range, X-Cache, X-Actual-Start-Time, X-Actual-Duration, X-Transcode-Time-Ms, X-Total-Server-Time-Ms",
8
- "cache-control": "public, max-age=3600",
9
- "content-length": "728",
10
- "content-type": "video/iso.segment",
11
- "x-powered-by": "Express"
12
- },
13
- "url": "/api/v1/transcode/audio/init.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4",
14
- "method": "GET",
15
- "range": null
16
- }
@@ -1,16 +0,0 @@
1
- {
2
- "statusCode": 200,
3
- "headers": {
4
- "access-control-allow-headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization, Range",
5
- "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
6
- "access-control-allow-origin": "*",
7
- "access-control-expose-headers": "Content-Length, Content-Range, X-Cache, X-Actual-Start-Time, X-Actual-Duration, X-Transcode-Time-Ms, X-Total-Server-Time-Ms",
8
- "cache-control": "public, max-age=3600",
9
- "content-length": "2055451",
10
- "content-type": "video/iso.segment",
11
- "x-powered-by": "Express"
12
- },
13
- "url": "/api/v1/transcode/high/1.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4",
14
- "method": "GET",
15
- "range": null
16
- }
@@ -1,16 +0,0 @@
1
- {
2
- "statusCode": 200,
3
- "headers": {
4
- "access-control-allow-headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization, Range",
5
- "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
6
- "access-control-allow-origin": "*",
7
- "access-control-expose-headers": "Content-Length, Content-Range, X-Cache, X-Actual-Start-Time, X-Actual-Duration, X-Transcode-Time-Ms, X-Total-Server-Time-Ms",
8
- "cache-control": "public, max-age=3600",
9
- "content-length": "2192280",
10
- "content-type": "video/iso.segment",
11
- "x-powered-by": "Express"
12
- },
13
- "url": "/api/v1/transcode/high/2.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4",
14
- "method": "GET",
15
- "range": null
16
- }
@@ -1,16 +0,0 @@
1
- {
2
- "statusCode": 200,
3
- "headers": {
4
- "access-control-allow-headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization, Range",
5
- "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
6
- "access-control-allow-origin": "*",
7
- "access-control-expose-headers": "Content-Length, Content-Range, X-Cache, X-Actual-Start-Time, X-Actual-Duration, X-Transcode-Time-Ms, X-Total-Server-Time-Ms",
8
- "cache-control": "public, max-age=3600",
9
- "content-length": "2115680",
10
- "content-type": "video/iso.segment",
11
- "x-powered-by": "Express"
12
- },
13
- "url": "/api/v1/transcode/high/3.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4",
14
- "method": "GET",
15
- "range": null
16
- }
@@ -1,16 +0,0 @@
1
- {
2
- "statusCode": 200,
3
- "headers": {
4
- "access-control-allow-headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization, Range",
5
- "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
6
- "access-control-allow-origin": "*",
7
- "access-control-expose-headers": "Content-Length, Content-Range, X-Cache, X-Actual-Start-Time, X-Actual-Duration, X-Transcode-Time-Ms, X-Total-Server-Time-Ms",
8
- "cache-control": "public, max-age=3600",
9
- "content-length": "2217276",
10
- "content-type": "video/iso.segment",
11
- "x-powered-by": "Express"
12
- },
13
- "url": "/api/v1/transcode/high/4.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4",
14
- "method": "GET",
15
- "range": null
16
- }
@@ -1,16 +0,0 @@
1
- {
2
- "statusCode": 200,
3
- "headers": {
4
- "access-control-allow-headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization, Range",
5
- "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
6
- "access-control-allow-origin": "*",
7
- "access-control-expose-headers": "Content-Length, Content-Range, X-Cache, X-Actual-Start-Time, X-Actual-Duration, X-Transcode-Time-Ms, X-Total-Server-Time-Ms",
8
- "cache-control": "public, max-age=3600",
9
- "content-length": "2025221",
10
- "content-type": "video/iso.segment",
11
- "x-powered-by": "Express"
12
- },
13
- "url": "/api/v1/transcode/high/5.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4",
14
- "method": "GET",
15
- "range": null
16
- }
@@ -1,16 +0,0 @@
1
- {
2
- "statusCode": 200,
3
- "headers": {
4
- "access-control-allow-headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization, Range",
5
- "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
6
- "access-control-allow-origin": "*",
7
- "access-control-expose-headers": "Content-Length, Content-Range, X-Cache, X-Actual-Start-Time, X-Actual-Duration, X-Transcode-Time-Ms, X-Total-Server-Time-Ms",
8
- "cache-control": "public, max-age=3600",
9
- "content-length": "775",
10
- "content-type": "video/iso.segment",
11
- "x-powered-by": "Express"
12
- },
13
- "url": "/api/v1/transcode/high/init.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4",
14
- "method": "GET",
15
- "range": null
16
- }
@@ -1 +0,0 @@
1
- {"version":"1.0","type":"com.editframe/manifest","sourceUrl":"http://web:3000/head-moov-480p.mp4","duration":10,"durationMs":10000,"baseUrl":"http://localhost:63315","videoRenditions":[{"id":"high","width":1920,"height":1078,"bitrate":5000000,"codec":"avc1.640029","container":"video/mp4","mimeType":"video/mp4; codecs=\"avc1.640029,mp4a.40.2\"","segmentDuration":2,"segmentDurationMs":2000,"segmentDurationsMs":[2000,2000,2000,2000,2000],"frameRate":30,"profile":"High","level":"4.1"},{"id":"medium","width":1280,"height":718,"bitrate":2500000,"codec":"avc1.640029","container":"video/mp4","mimeType":"video/mp4; codecs=\"avc1.640029,mp4a.40.2\"","segmentDuration":2,"segmentDurationMs":2000,"segmentDurationsMs":[2000,2000,2000,2000,2000],"frameRate":30,"profile":"High","level":"4.1"},{"id":"low","width":854,"height":480,"bitrate":1000000,"codec":"avc1.640029","container":"video/mp4","mimeType":"video/mp4; codecs=\"avc1.640029,mp4a.40.2\"","segmentDuration":2,"segmentDurationMs":2000,"segmentDurationsMs":[2000,2000,2000,2000,2000],"frameRate":30,"profile":"High","level":"4.1"},{"id":"scrub","width":320,"height":180,"bitrate":100000,"codec":"avc1.640029","container":"video/mp4","mimeType":"video/mp4; codecs=\"avc1.640029\"","segmentDuration":30,"segmentDurationMs":30000,"segmentDurationsMs":[30000],"frameRate":15,"profile":"High","level":"4.1"}],"audioRenditions":[{"id":"audio","channels":1,"sampleRate":48000,"bitrate":128000,"codec":"mp4a.40.2","container":"audio/mp4","mimeType":"audio/mp4; codecs=\"mp4a.40.2\"","segmentDuration":2,"segmentDurationMs":2000,"segmentDurationsMs":[2026.66,2005.33,1984,2005.33,2026.66],"language":"en"}],"endpoints":{"initSegment":"http://localhost:63315/api/v1/transcode/{rendition}/init.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4","mediaSegment":"http://localhost:63315/api/v1/transcode/{rendition}/{segmentId}.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4"},"jitInfo":{"parallelTranscodingSupported":true,"expectedTranscodeLatency":500,"segmentCount":5,"scrubSegmentCount":1}}
@@ -1,17 +0,0 @@
1
- {
2
- "statusCode": 200,
3
- "headers": {
4
- "access-control-allow-headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization, Range",
5
- "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
6
- "access-control-allow-origin": "*",
7
- "access-control-expose-headers": "Content-Length, Content-Range, X-Cache, X-Actual-Start-Time, X-Actual-Duration, X-Transcode-Time-Ms, X-Total-Server-Time-Ms",
8
- "cache-control": "public, max-age=300",
9
- "content-length": "2045",
10
- "content-type": "application/json; charset=utf-8",
11
- "etag": "W/\"81b-HUWtw7SxFRSpD9Ic54e9i9HWJnc\"",
12
- "x-powered-by": "Express"
13
- },
14
- "url": "/api/v1/transcode/manifest.json?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4",
15
- "method": "GET",
16
- "range": null
17
- }
@@ -1,16 +0,0 @@
1
- {
2
- "statusCode": 200,
3
- "headers": {
4
- "access-control-allow-headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization, Range",
5
- "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
6
- "access-control-allow-origin": "*",
7
- "access-control-expose-headers": "Content-Length, Content-Range, X-Cache, X-Actual-Start-Time, X-Actual-Duration, X-Transcode-Time-Ms, X-Total-Server-Time-Ms",
8
- "cache-control": "public, max-age=3600",
9
- "content-length": "645445",
10
- "content-type": "video/iso.segment",
11
- "x-powered-by": "Express"
12
- },
13
- "url": "/api/v1/transcode/scrub/1.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4",
14
- "method": "GET",
15
- "range": null
16
- }
@@ -1,16 +0,0 @@
1
- {
2
- "statusCode": 200,
3
- "headers": {
4
- "access-control-allow-headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization, Range",
5
- "access-control-allow-methods": "GET, POST, PUT, DELETE, OPTIONS",
6
- "access-control-allow-origin": "*",
7
- "access-control-expose-headers": "Content-Length, Content-Range, X-Cache, X-Actual-Start-Time, X-Actual-Duration, X-Transcode-Time-Ms, X-Total-Server-Time-Ms",
8
- "cache-control": "public, max-age=3600",
9
- "content-length": "754",
10
- "content-type": "video/iso.segment",
11
- "x-powered-by": "Express"
12
- },
13
- "url": "/api/v1/transcode/scrub/init.m4s?url=http%3A%2F%2Fweb%3A3000%2Fhead-moov-480p.mp4",
14
- "method": "GET",
15
- "range": null
16
- }