@vfrey/vfrey 0.0.1 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +33 -0
- package/README.md +78 -3
- package/accounts.example.json +61 -0
- package/accounts.first-run.json +41 -0
- package/bin/vfrey.mjs +36 -0
- package/integration-tools/README.md +43 -0
- package/integration-tools/image/pillow.md +32 -0
- package/integration-tools/image/playwright.md +33 -0
- package/integration-tools/image/resvg.md +36 -0
- package/integration-tools/image/satori.md +36 -0
- package/integration-tools/image/sharp.md +38 -0
- package/integration-tools/video/blender.md +34 -0
- package/integration-tools/video/ffmpeg.md +41 -0
- package/integration-tools/video/manim.md +37 -0
- package/integration-tools/video/motion-canvas.md +37 -0
- package/integration-tools/video/remotion.md +50 -0
- package/integration-tools/video/revideo.md +32 -0
- package/package.json +74 -6
- package/skills/vfrey-orchestrator/SKILL.md +15 -0
- package/skills/vfrey-orchestrator/channel-video/SKILL.md +41 -0
- package/skills/vfrey-product/SKILL.md +63 -0
- package/skills/vfrey-product/examples/concurrency-vs-parallelism/framey/cook-one.svg +14 -0
- package/skills/vfrey-product/examples/concurrency-vs-parallelism/framey/cook-two.svg +22 -0
- package/skills/vfrey-product/examples/concurrency-vs-parallelism/framey/index.html +70 -0
- package/skills/vfrey-product/examples/concurrency-vs-parallelism/remotion/cook-one.svg +14 -0
- package/skills/vfrey-product/examples/concurrency-vs-parallelism/remotion/cook-two.svg +22 -0
- package/skills/vfrey-product/examples/concurrency-vs-parallelism/remotion/index.tsx +49 -0
- package/skills/vfrey-product/examples/concurrency-vs-parallelism/script.json +15 -0
- package/skills/vfrey-product/examples/octopus-facts/index.html +60 -0
- package/skills/vfrey-product/examples/octopus-facts/octopus.svg +8 -0
- package/skills/vfrey-product/examples/octopus-facts/script.json +14 -0
- package/skills/vfrey-product/push/SKILL.md +15 -0
- package/skills/vfrey-product/scenes/NOTICE +5 -0
- package/skills/vfrey-product/scenes/blocks.md +57 -0
- package/skills/vfrey-product/scenes/craft.md +118 -0
- package/skills/vfrey-product/scenes/motion.md +88 -0
- package/src/analytics/dashboard.ts +109 -0
- package/src/analytics/index.ts +260 -0
- package/src/api/client.ts +282 -0
- package/src/api/commands.ts +330 -0
- package/src/api/config.ts +34 -0
- package/src/api/creators.ts +463 -0
- package/src/api/credentials.ts +152 -0
- package/src/api/mail.ts +333 -0
- package/src/api/topics.ts +207 -0
- package/src/api/types.ts +205 -0
- package/src/cli.ts +467 -0
- package/src/cloud/executor.ts +281 -0
- package/src/cloud/job.ts +106 -0
- package/src/cloud/render-job.ts +187 -0
- package/src/config.ts +309 -0
- package/src/dashboard-link.ts +180 -0
- package/src/dashboard-start.ts +103 -0
- package/src/desk/channel.ts +64 -0
- package/src/desk/cli.ts +216 -0
- package/src/desk/creators-route.ts +129 -0
- package/src/desk/fonts/JetBrainsMono-OFL.txt +93 -0
- package/src/desk/fonts/google-sans-flex-latin.woff2 +0 -0
- package/src/desk/fonts/jetbrains-mono-medium.woff2 +0 -0
- package/src/desk/http.ts +460 -0
- package/src/desk/mail-route.ts +103 -0
- package/src/desk/overlay.ts +112 -0
- package/src/desk/preview.ts +422 -0
- package/src/desk/screens.ts +149 -0
- package/src/desk/secrets.ts +143 -0
- package/src/desk/series.ts +127 -0
- package/src/desk/state.ts +77 -0
- package/src/desk/studio-route.ts +119 -0
- package/src/desk/tick-runner.ts +66 -0
- package/src/desk/tick.ts +56 -0
- package/src/desk/topics-route.ts +41 -0
- package/src/desk/ui/app.css +505 -0
- package/src/desk/ui/app.js +185 -0
- package/src/desk/ui/apple-icon.png +0 -0
- package/src/desk/ui/components.js +79 -0
- package/src/desk/ui/core.js +156 -0
- package/src/desk/ui/favicon.ico +0 -0
- package/src/desk/ui/icon.svg +1 -0
- package/src/desk/ui/icons.js +49 -0
- package/src/desk/ui/index.html +41 -0
- package/src/desk/ui/metrics-math.d.ts +22 -0
- package/src/desk/ui/metrics-math.js +135 -0
- package/src/desk/ui/theme.js +5 -0
- package/src/desk/ui/views-creators.js +209 -0
- package/src/desk/ui/views-keys.js +114 -0
- package/src/desk/ui/views-mail.js +188 -0
- package/src/desk/ui/views-misc.js +123 -0
- package/src/desk/ui/views-review.js +119 -0
- package/src/desk/ui/views-runs.js +350 -0
- package/src/desk/ui/views-screens.js +163 -0
- package/src/desk/ui/views-series.js +318 -0
- package/src/desk/ui/views-topics.js +87 -0
- package/src/desk/verbs.ts +361 -0
- package/src/doctor.ts +212 -0
- package/src/drain.ts +14 -0
- package/src/engage/index.ts +217 -0
- package/src/generate/index.ts +110 -0
- package/src/generate/script.ts +152 -0
- package/src/generate/title.ts +78 -0
- package/src/help.ts +233 -0
- package/src/home.ts +45 -0
- package/src/llm/client.ts +177 -0
- package/src/log.ts +7 -0
- package/src/oauth/tokens.ts +189 -0
- package/src/oauth/vault.ts +72 -0
- package/src/pipeline/review.ts +642 -0
- package/src/pipeline/run.ts +443 -0
- package/src/pipeline/series-guard.ts +26 -0
- package/src/pipeline/source-fetch.ts +69 -0
- package/src/pipeline/stages.ts +728 -0
- package/src/pipeline/topics-source.ts +90 -0
- package/src/product/commands.ts +296 -0
- package/src/product/config-file.ts +38 -0
- package/src/product/engine-choice.ts +89 -0
- package/src/product/engines.ts +103 -0
- package/src/product/insights.ts +50 -0
- package/src/product/keys.ts +67 -0
- package/src/product/paths.ts +18 -0
- package/src/product/probes.ts +88 -0
- package/src/product/push-flow.ts +90 -0
- package/src/product/render-video.ts +21 -0
- package/src/product/short.ts +62 -0
- package/src/product/update.ts +32 -0
- package/src/project/canonical.ts +14 -0
- package/src/project/commands.ts +177 -0
- package/src/project/dashboard-status.ts +28 -0
- package/src/project/discover.ts +19 -0
- package/src/project/index-file.ts +73 -0
- package/src/project/marker.ts +87 -0
- package/src/project/migrate.ts +201 -0
- package/src/project/names.ts +27 -0
- package/src/project/notice.ts +16 -0
- package/src/project/open.ts +88 -0
- package/src/project/scaffold.ts +112 -0
- package/src/project/templates.ts +42 -0
- package/src/project/videos.ts +64 -0
- package/src/publish/facebook.ts +91 -0
- package/src/publish/index.ts +12 -0
- package/src/publish/instagram.ts +97 -0
- package/src/publish/rate.ts +62 -0
- package/src/publish/session.ts +242 -0
- package/src/publish/tiktok.ts +202 -0
- package/src/publish/youtube.ts +177 -0
- package/src/queue/desk-ops.ts +1170 -0
- package/src/queue/seal.ts +3 -0
- package/src/queue/store.ts +1006 -0
- package/src/remotion/AiLabel.tsx +26 -0
- package/src/remotion/Root.tsx +73 -0
- package/src/remotion/defaults.ts +26 -0
- package/src/remotion/films/claude/ClaudeFilm.tsx +1014 -0
- package/src/remotion/films/engine/EngineMark.tsx +17 -0
- package/src/remotion/films/rea/ReaShort.tsx +552 -0
- package/src/remotion/films/rea/drawings.tsx +907 -0
- package/src/remotion/films/rea/timing.ts +144 -0
- package/src/remotion/index.ts +4 -0
- package/src/remotion/templates/EditorialSplit.tsx +39 -0
- package/src/remotion/templates/KineticType.tsx +39 -0
- package/src/remotion/templates/SignalBoard.tsx +50 -0
- package/src/remotion/timing.ts +22 -0
- package/src/render/chrome.ts +78 -0
- package/src/render/engine-mark.ts +29 -0
- package/src/render/framey-template.ts +130 -0
- package/src/render/html-engine.ts +149 -0
- package/src/render/node-crypto-stub.ts +11 -0
- package/src/render/probe.ts +29 -0
- package/src/render/props.ts +17 -0
- package/src/render/vertical-short.ts +35 -0
- package/src/render/webpack.ts +33 -0
- package/src/render/worker.ts +65 -0
- package/src/scene/assets/fonts/TitanOne-OFL.txt +94 -0
- package/src/scene/assets/fonts/titan-one.woff2 +0 -0
- package/src/scene/assets/gsap/LICENSE.txt +8 -0
- package/src/scene/assets/gsap/gsap.min.js +11 -0
- package/src/scene/audio.ts +54 -0
- package/src/scene/blocks/LICENSE +190 -0
- package/src/scene/blocks/NOTICE +5 -0
- package/src/scene/blocks/bar-chart-race/bar-chart-race.html +585 -0
- package/src/scene/blocks/beat-freeze-cut/beat-freeze-cut.html +874 -0
- package/src/scene/blocks/camcorder-hud/camcorder-hud.html +164 -0
- package/src/scene/blocks/camera-dolly-zoom/camera-dolly-zoom.html +355 -0
- package/src/scene/blocks/code-diff/code-diff.html +817 -0
- package/src/scene/blocks/code-snippet-apple-terminal-pro/code-snippet-apple-terminal-pro.html +248 -0
- package/src/scene/blocks/code-typing/code-typing.html +764 -0
- package/src/scene/blocks/data-chart/data-chart.html +452 -0
- package/src/scene/blocks/flowchart-vertical/flowchart-vertical.html +454 -0
- package/src/scene/blocks/hw-scribble-transition/hw-scribble-transition.html +153 -0
- package/src/scene/blocks/index.json +824 -0
- package/src/scene/blocks/lt-accent-underline/lt-accent-underline.html +107 -0
- package/src/scene/blocks/lt-bold-block/lt-bold-block.html +109 -0
- package/src/scene/blocks/lt-clean-bar/lt-clean-bar.html +112 -0
- package/src/scene/blocks/lt-dark-card/lt-dark-card.html +111 -0
- package/src/scene/blocks/lt-kicker-name/lt-kicker-name.html +114 -0
- package/src/scene/blocks/lt-mask-reveal/lt-mask-reveal.html +120 -0
- package/src/scene/blocks/lt-neon-border/lt-neon-border.html +391 -0
- package/src/scene/blocks/lt-stack-bars/lt-stack-bars.html +109 -0
- package/src/scene/blocks/macos-notification/macos-notification.html +194 -0
- package/src/scene/blocks/mk-background/mk-background.html +236 -0
- package/src/scene/blocks/mk-callout-highlight/mk-callout-highlight.html +183 -0
- package/src/scene/blocks/mk-clone-wall-transition/mk-clone-wall-transition.html +226 -0
- package/src/scene/blocks/mk-line-graph/mk-line-graph.html +293 -0
- package/src/scene/blocks/mk-progress-stat/mk-progress-stat.html +186 -0
- package/src/scene/blocks/mk-specs-list/mk-specs-list.html +223 -0
- package/src/scene/blocks/news-ticker/news-ticker.html +409 -0
- package/src/scene/blocks/organic-light-leak-overlay/organic-light-leak-overlay.html +126 -0
- package/src/scene/blocks/oscilloscope-trace/oscilloscope-trace.html +519 -0
- package/src/scene/blocks/snow/snow.html +205 -0
- package/src/scene/blocks/split-flap-board/split-flap-board.html +347 -0
- package/src/scene/blocks/spotify-card/spotify-card.html +294 -0
- package/src/scene/blocks/starfield/starfield.html +188 -0
- package/src/scene/blocks/thread-message-stack/thread-message-stack.html +239 -0
- package/src/scene/blocks/week-in-merges/week-in-merges.html +470 -0
- package/src/scene/blocks/x-post/x-post.html +437 -0
- package/src/scene/blocks/yt-comment-card/yt-comment-card.html +319 -0
- package/src/scene/blocks/yt-lcd-background/yt-lcd-background.html +307 -0
- package/src/scene/blocks/yt-prism-title/yt-prism-title.html +205 -0
- package/src/scene/blocks.ts +229 -0
- package/src/scene/command.ts +272 -0
- package/src/scene/figure.ts +181 -0
- package/src/scene/glyphs.ts +107 -0
- package/src/scene/init.ts +86 -0
- package/src/scene/inspect/css-tree.d.ts +6 -0
- package/src/scene/inspect/page-scripts.ts +272 -0
- package/src/scene/inspect/report.ts +405 -0
- package/src/scene/inspect/run.ts +200 -0
- package/src/scene/inspect/source.ts +236 -0
- package/src/scene/label.ts +131 -0
- package/src/scene/net-guard.ts +74 -0
- package/src/scene/render.ts +292 -0
- package/src/scene/runtime/browser.ts +199 -0
- package/src/scene/runtime/core.ts +181 -0
- package/src/scene/runtime/react.tsx +115 -0
- package/src/scene/runtime/transitions.ts +133 -0
- package/src/scene/sanitize.ts +181 -0
- package/src/scene/scene.ts +152 -0
- package/src/scene/studio-command.ts +48 -0
- package/src/scene/studio-skin.ts +59 -0
- package/src/scene/studio.ts +337 -0
- package/src/scene/supply.ts +111 -0
- package/src/scene/timing.ts +288 -0
- package/src/scene/transitions/LICENSE +190 -0
- package/src/scene/transitions/NOTICE +5 -0
- package/src/scene/transitions/SOURCE.json +24 -0
- package/src/scene/transitions/transitions.global.js +38 -0
- package/src/scene/transitions.ts +26 -0
- package/src/service/all-projects.ts +153 -0
- package/src/service/commands.ts +256 -0
- package/src/service/due.ts +82 -0
- package/src/service/lock.ts +101 -0
- package/src/service/log-file.ts +56 -0
- package/src/service/state.ts +41 -0
- package/src/service/units.ts +90 -0
- package/src/service/worker.ts +51 -0
- package/src/skill-agents.ts +74 -0
- package/src/skill-install.ts +334 -0
- package/src/sync-write.ts +21 -0
- package/src/tick-report.ts +205 -0
- package/src/tts.ts +124 -0
- package/vendor/@vfrey/contracts/dist/account.d.ts +97 -0
- package/vendor/@vfrey/contracts/dist/account.js +27 -0
- package/vendor/@vfrey/contracts/dist/checks.d.ts +8 -0
- package/vendor/@vfrey/contracts/dist/checks.js +1 -0
- package/vendor/@vfrey/contracts/dist/credentials/crypto.d.ts +4 -0
- package/vendor/@vfrey/contracts/dist/credentials/crypto.js +38 -0
- package/vendor/@vfrey/contracts/dist/domain/advice-persona.d.ts +10 -0
- package/vendor/@vfrey/contracts/dist/domain/advice-persona.js +24 -0
- package/vendor/@vfrey/contracts/dist/domain/backoff.d.ts +13 -0
- package/vendor/@vfrey/contracts/dist/domain/backoff.js +27 -0
- package/vendor/@vfrey/contracts/dist/domain/cadence.d.ts +29 -0
- package/vendor/@vfrey/contracts/dist/domain/cadence.js +95 -0
- package/vendor/@vfrey/contracts/dist/domain/creators.d.ts +146 -0
- package/vendor/@vfrey/contracts/dist/domain/creators.js +2 -0
- package/vendor/@vfrey/contracts/dist/domain/disclosure.d.ts +127 -0
- package/vendor/@vfrey/contracts/dist/domain/disclosure.js +250 -0
- package/vendor/@vfrey/contracts/dist/domain/errors.d.ts +34 -0
- package/vendor/@vfrey/contracts/dist/domain/errors.js +68 -0
- package/vendor/@vfrey/contracts/dist/domain/redact.d.ts +1 -0
- package/vendor/@vfrey/contracts/dist/domain/redact.js +21 -0
- package/vendor/@vfrey/contracts/dist/domain/revenue.d.ts +13 -0
- package/vendor/@vfrey/contracts/dist/domain/revenue.js +16 -0
- package/vendor/@vfrey/contracts/dist/domain/safety.d.ts +20 -0
- package/vendor/@vfrey/contracts/dist/domain/safety.js +61 -0
- package/vendor/@vfrey/contracts/dist/domain/similarity.d.ts +13 -0
- package/vendor/@vfrey/contracts/dist/domain/similarity.js +100 -0
- package/vendor/@vfrey/contracts/dist/domain/templates.d.ts +18 -0
- package/vendor/@vfrey/contracts/dist/domain/templates.js +67 -0
- package/vendor/@vfrey/contracts/dist/domain/tiktok-chunks.d.ts +19 -0
- package/vendor/@vfrey/contracts/dist/domain/tiktok-chunks.js +52 -0
- package/vendor/@vfrey/contracts/dist/domain/topics.d.ts +78 -0
- package/vendor/@vfrey/contracts/dist/domain/topics.js +4 -0
- package/vendor/@vfrey/contracts/dist/domain/types.d.ts +216 -0
- package/vendor/@vfrey/contracts/dist/domain/types.js +1 -0
- package/vendor/@vfrey/contracts/dist/domain/variation.d.ts +57 -0
- package/vendor/@vfrey/contracts/dist/domain/variation.js +278 -0
- package/vendor/@vfrey/contracts/dist/events.d.ts +20 -0
- package/vendor/@vfrey/contracts/dist/events.js +1 -0
- package/vendor/@vfrey/contracts/dist/http.d.ts +11 -0
- package/vendor/@vfrey/contracts/dist/http.js +37 -0
- package/vendor/@vfrey/contracts/dist/index.d.ts +22 -0
- package/vendor/@vfrey/contracts/dist/index.js +22 -0
- package/vendor/@vfrey/contracts/dist/log.d.ts +2 -0
- package/vendor/@vfrey/contracts/dist/log.js +10 -0
- package/vendor/@vfrey/contracts/dist/mail.d.ts +55 -0
- package/vendor/@vfrey/contracts/dist/mail.js +1 -0
- package/vendor/@vfrey/contracts/package.json +18 -0
- package/vendor/@vfrey/ingest/dist/index.d.ts +41 -0
- package/vendor/@vfrey/ingest/dist/index.js +221 -0
- package/vendor/@vfrey/ingest/dist/parse.d.ts +5 -0
- package/vendor/@vfrey/ingest/dist/parse.js +165 -0
- package/vendor/@vfrey/ingest/package.json +21 -0
- package/vendor/framey/LICENSE +190 -0
- package/vendor/framey/NOTICE +15 -0
- package/vendor/framey/SOURCE.json +24 -0
- package/vendor/framey/STUDIO-SOURCE.json +9 -0
- package/vendor/framey/bin/framey-localize-fonts.mjs +12 -0
- package/vendor/framey/bin/framey.mjs +16 -0
- package/vendor/framey/dist/add-VMJD5KBS.js +75 -0
- package/vendor/framey/dist/animatedGifPrep-QPKGJ6PM.js +43 -0
- package/vendor/framey/dist/api.d.ts +211 -0
- package/vendor/framey/dist/api.js +76 -0
- package/vendor/framey/dist/appHistory-WW56FZTT.js +31 -0
- package/vendor/framey/dist/asset-WQKGOELE.js +26 -0
- package/vendor/framey/dist/audio-RSJWVWRA.js +1936 -0
- package/vendor/framey/dist/batchRender-3HPICDCT.js +366 -0
- package/vendor/framey/dist/beats-HL2BDUZI.js +273 -0
- package/vendor/framey/dist/benchmark-RWCWHI5Z.js +230 -0
- package/vendor/framey/dist/browser-ECYET3Q2.js +206 -0
- package/vendor/framey/dist/bundleWithLocalizedFonts-ALYBQEQT.js +52 -0
- package/vendor/framey/dist/captureCompositionFrame-4DA6SEH2.js +94 -0
- package/vendor/framey/dist/catalog-5JVDEUWK.js +979 -0
- package/vendor/framey/dist/catch-up-NEBCL5NO.js +106 -0
- package/vendor/framey/dist/check-F5N544ML.js +111 -0
- package/vendor/framey/dist/checkBrowser-LZ66CMJG.js +110 -0
- package/vendor/framey/dist/chunk-2K7Z2HVP.js +372 -0
- package/vendor/framey/dist/chunk-2UZQHDM7.js +323 -0
- package/vendor/framey/dist/chunk-2X4PQEYM.js +34 -0
- package/vendor/framey/dist/chunk-3422KMTD.js +168 -0
- package/vendor/framey/dist/chunk-3FYD4YEK.js +72 -0
- package/vendor/framey/dist/chunk-3GXQPCJC.js +682 -0
- package/vendor/framey/dist/chunk-3LM6YPBR.js +179 -0
- package/vendor/framey/dist/chunk-442JNXRM.js +20 -0
- package/vendor/framey/dist/chunk-4BNN5FGX.js +182 -0
- package/vendor/framey/dist/chunk-4P7NX5BM.js +11532 -0
- package/vendor/framey/dist/chunk-4UMPIPCQ.js +88 -0
- package/vendor/framey/dist/chunk-4YYJOFKS.js +28 -0
- package/vendor/framey/dist/chunk-54HJ63Q2.js +29 -0
- package/vendor/framey/dist/chunk-5ETJX6WM.js +89 -0
- package/vendor/framey/dist/chunk-5SG54JRS.js +68 -0
- package/vendor/framey/dist/chunk-634HSJ3J.js +58 -0
- package/vendor/framey/dist/chunk-66LREXGS.js +48 -0
- package/vendor/framey/dist/chunk-6BEFEWFB.js +25 -0
- package/vendor/framey/dist/chunk-6BNTGNGD.js +286 -0
- package/vendor/framey/dist/chunk-6DDPOHMK.js +140 -0
- package/vendor/framey/dist/chunk-6GV5XSOR.js +214 -0
- package/vendor/framey/dist/chunk-6JR2XUEE.js +127 -0
- package/vendor/framey/dist/chunk-73QVATIM.js +362 -0
- package/vendor/framey/dist/chunk-7FMUTGOH.js +279 -0
- package/vendor/framey/dist/chunk-7JQFJ6JJ.js +291 -0
- package/vendor/framey/dist/chunk-AHPGAESX.js +113 -0
- package/vendor/framey/dist/chunk-AHX34EFP.js +15 -0
- package/vendor/framey/dist/chunk-AJ5CSAEZ.js +487 -0
- package/vendor/framey/dist/chunk-B7RJV74O.js +5047 -0
- package/vendor/framey/dist/chunk-BL4U6U52.js +254 -0
- package/vendor/framey/dist/chunk-BSQ7XANM.js +210 -0
- package/vendor/framey/dist/chunk-BZ56MTDX.js +6 -0
- package/vendor/framey/dist/chunk-C5BO7PMT.js +282 -0
- package/vendor/framey/dist/chunk-CFUCHO4T.js +358 -0
- package/vendor/framey/dist/chunk-CZGHFATT.js +31 -0
- package/vendor/framey/dist/chunk-DLA44CMS.js +5649 -0
- package/vendor/framey/dist/chunk-DPVXBVLL.js +31292 -0
- package/vendor/framey/dist/chunk-DQBY7FRR.js +397 -0
- package/vendor/framey/dist/chunk-EAMLBAHA.js +154 -0
- package/vendor/framey/dist/chunk-EOVYQ3IG.js +143 -0
- package/vendor/framey/dist/chunk-EVMY7IPL.js +612 -0
- package/vendor/framey/dist/chunk-FG4BBFZI.js +122 -0
- package/vendor/framey/dist/chunk-FI4I7CME.js +56 -0
- package/vendor/framey/dist/chunk-FLREUEHW.js +2081 -0
- package/vendor/framey/dist/chunk-FUFP7A7S.js +1126 -0
- package/vendor/framey/dist/chunk-FV3PIKGH.js +56 -0
- package/vendor/framey/dist/chunk-FXMKHHPO.js +123 -0
- package/vendor/framey/dist/chunk-GGZAM5VH.js +1187 -0
- package/vendor/framey/dist/chunk-GKZEVJIB.js +39 -0
- package/vendor/framey/dist/chunk-GMECXFAN.js +57 -0
- package/vendor/framey/dist/chunk-GNEFDLFB.js +621 -0
- package/vendor/framey/dist/chunk-GPMLSOEG.js +19274 -0
- package/vendor/framey/dist/chunk-GPYVT5EE.js +59 -0
- package/vendor/framey/dist/chunk-H6IEMZEV.js +40 -0
- package/vendor/framey/dist/chunk-HEFQCIXR.js +170 -0
- package/vendor/framey/dist/chunk-HFQ4CWHA.js +118 -0
- package/vendor/framey/dist/chunk-HPDTCOKE.js +304 -0
- package/vendor/framey/dist/chunk-HTUHQKDB.js +548 -0
- package/vendor/framey/dist/chunk-HU2SPFNG.js +103 -0
- package/vendor/framey/dist/chunk-HVW7ABXD.js +19 -0
- package/vendor/framey/dist/chunk-IG7NDKXO.js +26 -0
- package/vendor/framey/dist/chunk-II3J3WXK.js +246 -0
- package/vendor/framey/dist/chunk-IR35BCLK.js +13 -0
- package/vendor/framey/dist/chunk-ISN5GRYI.js +20 -0
- package/vendor/framey/dist/chunk-IUONB55J.js +669 -0
- package/vendor/framey/dist/chunk-IVSUQR2B.js +161 -0
- package/vendor/framey/dist/chunk-IXU6PQSW.js +259 -0
- package/vendor/framey/dist/chunk-IZCW2NKT.js +29 -0
- package/vendor/framey/dist/chunk-JGXJU5PF.js +68 -0
- package/vendor/framey/dist/chunk-JHOCK3DG.js +27 -0
- package/vendor/framey/dist/chunk-JVBRJMOP.js +121 -0
- package/vendor/framey/dist/chunk-K4MJX7SR.js +17 -0
- package/vendor/framey/dist/chunk-K4WKGXRC.js +18 -0
- package/vendor/framey/dist/chunk-KGPLIH7B.js +127 -0
- package/vendor/framey/dist/chunk-KLIKCX6Q.js +63 -0
- package/vendor/framey/dist/chunk-KXTKKBOC.js +61 -0
- package/vendor/framey/dist/chunk-KZI44OPA.js +185 -0
- package/vendor/framey/dist/chunk-LEKZNRKI.js +45 -0
- package/vendor/framey/dist/chunk-LFGJWOVA.js +61 -0
- package/vendor/framey/dist/chunk-LLMSX6V6.js +17 -0
- package/vendor/framey/dist/chunk-LTGTN2TH.js +195 -0
- package/vendor/framey/dist/chunk-M2WBOQ2Q.js +54 -0
- package/vendor/framey/dist/chunk-MI5FTLYK.js +399 -0
- package/vendor/framey/dist/chunk-MLQP2QUF.js +1809 -0
- package/vendor/framey/dist/chunk-MMQ52NIZ.js +956 -0
- package/vendor/framey/dist/chunk-ND46XKK3.js +742 -0
- package/vendor/framey/dist/chunk-NYEXNSHM.js +504 -0
- package/vendor/framey/dist/chunk-O4YRB27L.js +57 -0
- package/vendor/framey/dist/chunk-O7BGSQ5F.js +92 -0
- package/vendor/framey/dist/chunk-OFQWTKPW.js +117 -0
- package/vendor/framey/dist/chunk-P5ZBLXJ6.js +91 -0
- package/vendor/framey/dist/chunk-P6LJ4Y32.js +4662 -0
- package/vendor/framey/dist/chunk-PKZ7RK5N.js +281 -0
- package/vendor/framey/dist/chunk-PURHAXFL.js +15 -0
- package/vendor/framey/dist/chunk-Q5X2B5WT.js +29 -0
- package/vendor/framey/dist/chunk-QAMKOG67.js +248 -0
- package/vendor/framey/dist/chunk-R6YBK4XX.js +514 -0
- package/vendor/framey/dist/chunk-RGLQURIX.js +2997 -0
- package/vendor/framey/dist/chunk-RNV3DM4S.js +3573 -0
- package/vendor/framey/dist/chunk-ROEW726S.js +4638 -0
- package/vendor/framey/dist/chunk-RQVDTPGD.js +6 -0
- package/vendor/framey/dist/chunk-RVZHGOGR.js +26 -0
- package/vendor/framey/dist/chunk-RXATE6FZ.js +385 -0
- package/vendor/framey/dist/chunk-S3S4TGEH.js +424 -0
- package/vendor/framey/dist/chunk-SDYDNHEE.js +11202 -0
- package/vendor/framey/dist/chunk-SSWBU67I.js +173 -0
- package/vendor/framey/dist/chunk-ST35C4K6.js +28 -0
- package/vendor/framey/dist/chunk-SZNTYTIV.js +990 -0
- package/vendor/framey/dist/chunk-T2EUWCJE.js +29 -0
- package/vendor/framey/dist/chunk-T6AGUTZJ.js +444 -0
- package/vendor/framey/dist/chunk-THJALHFJ.js +11131 -0
- package/vendor/framey/dist/chunk-TIQB63MX.js +18128 -0
- package/vendor/framey/dist/chunk-U242RTCT.js +134 -0
- package/vendor/framey/dist/chunk-UJZREAV6.js +3901 -0
- package/vendor/framey/dist/chunk-UMD3V7CU.js +264 -0
- package/vendor/framey/dist/chunk-UOFAE5RF.js +42 -0
- package/vendor/framey/dist/chunk-UTEIUGAZ.js +29 -0
- package/vendor/framey/dist/chunk-VAS6HQX3.js +138 -0
- package/vendor/framey/dist/chunk-VC76R6W2.js +27 -0
- package/vendor/framey/dist/chunk-VFZ7W5W7.js +226 -0
- package/vendor/framey/dist/chunk-VHNLZAE2.js +348 -0
- package/vendor/framey/dist/chunk-VMC4WSH5.js +278 -0
- package/vendor/framey/dist/chunk-VORQIH64.js +108 -0
- package/vendor/framey/dist/chunk-VTXFRIHO.js +186 -0
- package/vendor/framey/dist/chunk-W2LGJSEN.js +182 -0
- package/vendor/framey/dist/chunk-WKBM7NDG.js +32 -0
- package/vendor/framey/dist/chunk-WMQNIQDJ.js +2057 -0
- package/vendor/framey/dist/chunk-WN4XZC5F.js +504 -0
- package/vendor/framey/dist/chunk-WQ6ZXHFQ.js +133 -0
- package/vendor/framey/dist/chunk-X7HBSTCZ.js +53 -0
- package/vendor/framey/dist/chunk-X7MTZ4T2.js +6 -0
- package/vendor/framey/dist/chunk-XPTOJZJF.js +308 -0
- package/vendor/framey/dist/chunk-XT6MXC7A.js +6 -0
- package/vendor/framey/dist/chunk-XT7X6QCP.js +6 -0
- package/vendor/framey/dist/chunk-XTMDWNEC.js +2820 -0
- package/vendor/framey/dist/chunk-XUHOIDKG.js +6 -0
- package/vendor/framey/dist/chunk-XX7LTW5Y.js +138 -0
- package/vendor/framey/dist/chunk-Y3YGTZEG.js +382 -0
- package/vendor/framey/dist/chunk-Y5SBSGN7.js +346 -0
- package/vendor/framey/dist/chunk-YCMVI4MZ.js +625 -0
- package/vendor/framey/dist/chunk-YOR4CTCE.js +261 -0
- package/vendor/framey/dist/chunk-YPRBGITP.js +2748 -0
- package/vendor/framey/dist/chunk-ZKDMAOFU.js +32 -0
- package/vendor/framey/dist/chunk-ZW6DURPF.js +1318 -0
- package/vendor/framey/dist/clean-ZJOGDKDM.js +336 -0
- package/vendor/framey/dist/cli.js +439 -0
- package/vendor/framey/dist/cloudrun-HGJ3B6ZV.js +767 -0
- package/vendor/framey/dist/commands/contrast-audit.browser.js +643 -0
- package/vendor/framey/dist/commands/layout-audit.browser.js +2914 -0
- package/vendor/framey/dist/commands/motion-sample.browser.js +74 -0
- package/vendor/framey/dist/commands/motion-signature.browser.js +475 -0
- package/vendor/framey/dist/compare-W7UY3BAZ.js +463 -0
- package/vendor/framey/dist/compiler-TM3W6GYF.js +136 -0
- package/vendor/framey/dist/component-QF5VGYMU.js +176 -0
- package/vendor/framey/dist/compositions-XT3PMNDF.js +238 -0
- package/vendor/framey/dist/contactSheet-7W6GYHBQ.js +24 -0
- package/vendor/framey/dist/deploy-6FJPWKF2.js +299 -0
- package/vendor/framey/dist/destroy-HE2RIPKZ.js +57 -0
- package/vendor/framey/dist/deterministicFonts-RADD3BSX.js +50 -0
- package/vendor/framey/dist/dist-4S2FGGVY.js +422 -0
- package/vendor/framey/dist/dist-BE4B2EZE.js +32 -0
- package/vendor/framey/dist/dist-EWXJGN63.js +129 -0
- package/vendor/framey/dist/docs-VKIRFEEX.js +131 -0
- package/vendor/framey/dist/doctor-2UNJ2G7U.js +74 -0
- package/vendor/framey/dist/dom-37K6YOH4.js +14 -0
- package/vendor/framey/dist/dotEnv-7PZQTVIM.js +54 -0
- package/vendor/framey/dist/events-ACY3P2PA.js +76 -0
- package/vendor/framey/dist/events-IHB3B2MK.js +69 -0
- package/vendor/framey/dist/ffmpeg-DR5LGGSK.js +63 -0
- package/vendor/framey/dist/figma-BODVUPHB.js +63 -0
- package/vendor/framey/dist/fontData.generated-NXAOI4GH.js +13 -0
- package/vendor/framey/dist/fontLocalizeCli.js +142 -0
- package/vendor/framey/dist/gpuPolicy-XLEXORZY.js +49 -0
- package/vendor/framey/dist/grade-compare-GAXFQ74C.js +661 -0
- package/vendor/framey/dist/gsapParser-IEUSLYDJ.js +2885 -0
- package/vendor/framey/dist/gsapParserAcorn-LZJKCFQI.js +30 -0
- package/vendor/framey/dist/help-VCB5X2HS.js +184 -0
- package/vendor/framey/dist/history-ENGZEVFT.js +471 -0
- package/vendor/framey/dist/hyperframe.manifest.json +22 -0
- package/vendor/framey/dist/hyperframe.runtime.iife.js +1132 -0
- package/vendor/framey/dist/hyperframes-player.global.js +478 -0
- package/vendor/framey/dist/hyperframes-slideshow.global.js +148 -0
- package/vendor/framey/dist/info-WPCJHBMU.js +182 -0
- package/vendor/framey/dist/init-G4WGLYGD.js +1176 -0
- package/vendor/framey/dist/inspect-5IQ6CNEQ.js +106 -0
- package/vendor/framey/dist/installer-ML4HWUV7.js +40 -0
- package/vendor/framey/dist/keyframes-Q6XJO7VW.js +2755 -0
- package/vendor/framey/dist/lambda-A7JC74JF.js +468 -0
- package/vendor/framey/dist/layout-YET6XNXA.js +95 -0
- package/vendor/framey/dist/lint-I7FZN2VJ.js +162 -0
- package/vendor/framey/dist/lintProject-PDB3UN72.js +30 -0
- package/vendor/framey/dist/manager-CD6LJ7ZN.js +45 -0
- package/vendor/framey/dist/manager-WA4F2GST.js +67 -0
- package/vendor/framey/dist/media-treatment-BXYS4WVA.js +1030 -0
- package/vendor/framey/dist/media-use-LWH3MANK.js +113 -0
- package/vendor/framey/dist/models-K363FYM4.js +195 -0
- package/vendor/framey/dist/motionShot-GPAVWXLH.js +640 -0
- package/vendor/framey/dist/normalize-FASIPBUM.js +24 -0
- package/vendor/framey/dist/normalize-audio-VDWYRHN6.js +268 -0
- package/vendor/framey/dist/open-E3TB6P6J.js +128 -0
- package/vendor/framey/dist/parakeetRunner-UP34UOI2.js +58 -0
- package/vendor/framey/dist/pipeline-VXIUYEBU.js +64 -0
- package/vendor/framey/dist/play-BUTDQ4DV.js +353 -0
- package/vendor/framey/dist/policies-OLDYGFK5.js +309 -0
- package/vendor/framey/dist/preflight-2KZ2GWAZ.js +55 -0
- package/vendor/framey/dist/present-GXYSM7NX.js +353 -0
- package/vendor/framey/dist/preview-EKZ33JOJ.js +1910 -0
- package/vendor/framey/dist/producer-SKU5EV3J.js +13 -0
- package/vendor/framey/dist/progress-ZWB4Z4ET.js +76 -0
- package/vendor/framey/dist/projectConfig-3MZAYVTS.js +60 -0
- package/vendor/framey/dist/publication-DTKWNF74.js +33 -0
- package/vendor/framey/dist/remove-background-OY5L7XN2.js +265 -0
- package/vendor/framey/dist/render-CDV4GDFX.js +187 -0
- package/vendor/framey/dist/render-YE5YAMOD.js +2620 -0
- package/vendor/framey/dist/render-batch-ZAMFPCLL.js +274 -0
- package/vendor/framey/dist/renderSetupWorker.js +120 -0
- package/vendor/framey/dist/resolver-D5BIPSEW.js +42 -0
- package/vendor/framey/dist/runtimeVersion.js +18 -0
- package/vendor/framey/dist/sam-WFZXI4F7.js +23 -0
- package/vendor/framey/dist/shaderTransitionWorker.js +44 -0
- package/vendor/framey/dist/sherpa-RQWLV7I3.js +79 -0
- package/vendor/framey/dist/sherpaWorker.js +84 -0
- package/vendor/framey/dist/sites-AMOVABTK.js +54 -0
- package/vendor/framey/dist/skill-ZHVLH7KX.js +15 -0
- package/vendor/framey/dist/slideshow-SJGK4RQS.js +24 -0
- package/vendor/framey/dist/snapshot-TUXL6LBQ.js +1515 -0
- package/vendor/framey/dist/src-JHQGB2S6.js +215 -0
- package/vendor/framey/dist/src-Z5PGEMXB.js +532 -0
- package/vendor/framey/dist/state-B6H3WHCF.js +28 -0
- package/vendor/framey/dist/staticProjectServer-DFVZOUGI.js +63 -0
- package/vendor/framey/dist/studio/assets/hyperframes-player-DLaKjw0L.js +478 -0
- package/vendor/framey/dist/studio/assets/index-BX3KHhGX.js +71 -0
- package/vendor/framey/dist/studio/assets/index-CYbvOVp-.css +1 -0
- package/vendor/framey/dist/studio/assets/index-Dp3QEUGL.js +402 -0
- package/vendor/framey/dist/studio/assets/index-qrTAXbqc.js +531 -0
- package/vendor/framey/dist/studio/favicon.svg +14 -0
- package/vendor/framey/dist/studio/icons/timeline/audio.svg +7 -0
- package/vendor/framey/dist/studio/icons/timeline/captions.svg +5 -0
- package/vendor/framey/dist/studio/icons/timeline/composition.svg +12 -0
- package/vendor/framey/dist/studio/icons/timeline/image.svg +18 -0
- package/vendor/framey/dist/studio/icons/timeline/music.svg +10 -0
- package/vendor/framey/dist/studio/icons/timeline/text.svg +3 -0
- package/vendor/framey/dist/studio/index.html +23 -0
- package/vendor/framey/dist/studio-api-2NECGRMB.js +179 -0
- package/vendor/framey/dist/studioSelectionClient-IUUPKUHZ.js +25 -0
- package/vendor/framey/dist/studioServer-N2OPUMOQ.js +1569 -0
- package/vendor/framey/dist/synthesize-PKTB5ATG.js +183 -0
- package/vendor/framey/dist/system-7F3UEHQT.js +27 -0
- package/vendor/framey/dist/telemetry-DQGPEKM6.js +145 -0
- package/vendor/framey/dist/telemetry-UN55N6U6.js +77 -0
- package/vendor/framey/dist/timeline-LHUUMK63.js +1295 -0
- package/vendor/framey/dist/tokens-OLECWDFK.js +92 -0
- package/vendor/framey/dist/transcribe-O7HQKMIV.js +331 -0
- package/vendor/framey/dist/transcribe-UJESPBT5.js +76 -0
- package/vendor/framey/dist/tts-YCCQHZD4.js +234 -0
- package/vendor/framey/dist/urlDownloader-H2LXLG4U.js +48 -0
- package/vendor/framey/dist/usage-HG4WMM7A.js +2167 -0
- package/vendor/framey/dist/validate-F2XMN6EV.js +87 -0
- package/vendor/framey/dist/vendor/npm/gsap@3.15.0/GSAP-LICENSE.txt +8 -0
- package/vendor/framey/dist/vendor/npm/gsap@3.15.0/dist/CustomEase.min.js +11 -0
- package/vendor/framey/dist/vendor/npm/gsap@3.15.0/dist/MotionPathPlugin.min.js +11 -0
- package/vendor/framey/dist/vendor/npm/gsap@3.15.0/dist/gsap.min.js +11 -0
- package/vendor/framey/dist/warmCheck.js +220 -0
- package/vendor/framey/dist/warmCheckClient.js +139 -0
- package/vendor/framey/dist/workspaceBuildCheck-XYD2YTFW.js +133 -0
- package/vendor/framey-player/LICENSE +190 -0
- package/vendor/framey-player/NOTICE +16 -0
- package/vendor/framey-player/SOURCE.json +6 -0
- package/vendor/framey-player/hyperframes-player.global.js +478 -0
- package/vendor/framey.pin +1 -0
- package/bin/index.js +0 -3
|
@@ -0,0 +1,669 @@
|
|
|
1
|
+
import { createRequire as __hf_createRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __hf_fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname as __hf_dirname } from "node:path";
|
|
4
|
+
var require = __hf_createRequire(import.meta.url);
|
|
5
|
+
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __hf_dirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
relinkSplitHalves
|
|
9
|
+
} from "./chunk-6JR2XUEE.js";
|
|
10
|
+
import {
|
|
11
|
+
EXCLUDED_TAGS,
|
|
12
|
+
ensureHfIds,
|
|
13
|
+
mintHfId,
|
|
14
|
+
walkCompositionDescendants
|
|
15
|
+
} from "./chunk-RNV3DM4S.js";
|
|
16
|
+
import {
|
|
17
|
+
isAllowedHtmlAttribute,
|
|
18
|
+
isSafeAttributeValue,
|
|
19
|
+
sanitizeRichTextChildren
|
|
20
|
+
} from "./chunk-DLA44CMS.js";
|
|
21
|
+
import {
|
|
22
|
+
decodedUrlPath,
|
|
23
|
+
removeElementWithGsapCascade
|
|
24
|
+
} from "./chunk-B7RJV74O.js";
|
|
25
|
+
import {
|
|
26
|
+
require_dist
|
|
27
|
+
} from "./chunk-4P7NX5BM.js";
|
|
28
|
+
import {
|
|
29
|
+
readClipTiming,
|
|
30
|
+
writeClipTiming
|
|
31
|
+
} from "./chunk-MMQ52NIZ.js";
|
|
32
|
+
import {
|
|
33
|
+
readMediaOffsetSeconds,
|
|
34
|
+
readPlaybackRate
|
|
35
|
+
} from "./chunk-BSQ7XANM.js";
|
|
36
|
+
import {
|
|
37
|
+
parseHTML
|
|
38
|
+
} from "./chunk-SDYDNHEE.js";
|
|
39
|
+
import {
|
|
40
|
+
__toESM
|
|
41
|
+
} from "./chunk-M2WBOQ2Q.js";
|
|
42
|
+
|
|
43
|
+
// ../core/dist/timelineAssetId.js
|
|
44
|
+
function trimIdUnderscores(value) {
|
|
45
|
+
let start = 0;
|
|
46
|
+
let end = value.length;
|
|
47
|
+
while (value[start] === "_")
|
|
48
|
+
start += 1;
|
|
49
|
+
while (end > start && value[end - 1] === "_")
|
|
50
|
+
end -= 1;
|
|
51
|
+
return value.slice(start, end);
|
|
52
|
+
}
|
|
53
|
+
function buildTimelineAssetId(assetPath, existingIds) {
|
|
54
|
+
const baseName = assetPath.slice(assetPath.lastIndexOf("/") + 1);
|
|
55
|
+
const normalized = baseName.replace(/\.[^.]+$/, "").replace(/[^a-zA-Z0-9_-]+/g, "_").toLowerCase();
|
|
56
|
+
const baseId = trimIdUnderscores(normalized) || "asset";
|
|
57
|
+
const ids = new Set(existingIds);
|
|
58
|
+
if (!ids.has(baseId))
|
|
59
|
+
return baseId;
|
|
60
|
+
let suffix = 2;
|
|
61
|
+
while (ids.has(`${baseId}_${suffix}`))
|
|
62
|
+
suffix += 1;
|
|
63
|
+
return `${baseId}_${suffix}`;
|
|
64
|
+
}
|
|
65
|
+
function referenceChildren(element) {
|
|
66
|
+
if (element.children.length > 0)
|
|
67
|
+
return element.children;
|
|
68
|
+
if (element.tagName.toLowerCase() !== "template")
|
|
69
|
+
return [];
|
|
70
|
+
const content = element.content;
|
|
71
|
+
return content ? content.children : [];
|
|
72
|
+
}
|
|
73
|
+
function documentElements(document) {
|
|
74
|
+
const elements = [];
|
|
75
|
+
const visit = (element) => {
|
|
76
|
+
elements.push(element);
|
|
77
|
+
for (const child of referenceChildren(element))
|
|
78
|
+
visit(child);
|
|
79
|
+
};
|
|
80
|
+
if (document.documentElement)
|
|
81
|
+
visit(document.documentElement);
|
|
82
|
+
return elements;
|
|
83
|
+
}
|
|
84
|
+
function decodeIdEscape(original, hex) {
|
|
85
|
+
const codePoint = Number.parseInt(hex, 16);
|
|
86
|
+
return codePoint <= 1114111 ? String.fromCodePoint(codePoint) : original;
|
|
87
|
+
}
|
|
88
|
+
function referencesId(value, id) {
|
|
89
|
+
const decoded = value.replace(/\\x([0-9a-f]{2})/gi, (original, hex) => decodeIdEscape(original, hex)).replace(/\\u\{([0-9a-f]+)\}|\\u([0-9a-f]{4})/gi, (original, braced, fixed) => decodeIdEscape(original, braced ?? fixed)).replace(/\\([0-9a-f]{1,6})\s?/gi, (original, hex) => decodeIdEscape(original, hex)).replace(/\\([^\r\n])/g, "$1");
|
|
90
|
+
return decoded.includes(id);
|
|
91
|
+
}
|
|
92
|
+
function decodeFragment(value) {
|
|
93
|
+
const fragment = value.split("#").slice(1).join("#");
|
|
94
|
+
try {
|
|
95
|
+
return decodeURIComponent(fragment);
|
|
96
|
+
} catch {
|
|
97
|
+
return fragment;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function attributeReferencesId(attribute, id) {
|
|
101
|
+
if (["id", "data-hf-id"].includes(attribute.name))
|
|
102
|
+
return false;
|
|
103
|
+
if (attribute.name === "src")
|
|
104
|
+
return referencesId(decodeFragment(attribute.value), id);
|
|
105
|
+
return referencesId(attribute.value, id);
|
|
106
|
+
}
|
|
107
|
+
function elementReferencesId(element, id) {
|
|
108
|
+
const code = ["script", "style"].includes(element.tagName.toLowerCase());
|
|
109
|
+
if (code && referencesId(element.textContent ?? "", id))
|
|
110
|
+
return true;
|
|
111
|
+
return Array.from(element.attributes).some((attribute) => attributeReferencesId(attribute, id));
|
|
112
|
+
}
|
|
113
|
+
function readMediaIdentity(element) {
|
|
114
|
+
const media = ["video", "audio", "img"].includes(element.tagName.toLowerCase());
|
|
115
|
+
const src = element.getAttribute("src");
|
|
116
|
+
const id = element.getAttribute("id");
|
|
117
|
+
if (!media || !src || !id)
|
|
118
|
+
return null;
|
|
119
|
+
return { id, src };
|
|
120
|
+
}
|
|
121
|
+
function matchesGeneratedId({ id, src }) {
|
|
122
|
+
const base = buildTimelineAssetId(decodedUrlPath(src), []);
|
|
123
|
+
const suffix = id.slice(base.length);
|
|
124
|
+
return id === base || id.startsWith(base) && /^_(?:[2-9]\d*|1\d+)$/.test(suffix);
|
|
125
|
+
}
|
|
126
|
+
function canRenameMedia(element, identity, newSrc) {
|
|
127
|
+
const authored = ["data-timeline-label", "data-label", "aria-label"].some((name) => element.getAttribute(name)?.trim());
|
|
128
|
+
return !authored && identity.src !== newSrc && matchesGeneratedId(identity);
|
|
129
|
+
}
|
|
130
|
+
function replacementTimelineAssetId(document, element, newSrc) {
|
|
131
|
+
const identity = readMediaIdentity(element);
|
|
132
|
+
if (!identity || !canRenameMedia(element, identity, newSrc))
|
|
133
|
+
return null;
|
|
134
|
+
const elements = documentElements(document);
|
|
135
|
+
if (elements.some((other) => elementReferencesId(other, identity.id)))
|
|
136
|
+
return null;
|
|
137
|
+
const ids = elements.filter((other) => other !== element).map((other) => other.getAttribute("id")).filter((value) => value !== null);
|
|
138
|
+
return buildTimelineAssetId(decodedUrlPath(newSrc), ids);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// ../studio-server/dist/chunk-BYVZQTMW.js
|
|
142
|
+
var import_postcss_selector_parser = __toESM(require_dist(), 1);
|
|
143
|
+
import postcss from "postcss";
|
|
144
|
+
function parseStyleDecls(style) {
|
|
145
|
+
const props = /* @__PURE__ */ new Map();
|
|
146
|
+
const order = [];
|
|
147
|
+
let i = 0;
|
|
148
|
+
while (i < style.length) {
|
|
149
|
+
let depth = 0;
|
|
150
|
+
let inSingle = false;
|
|
151
|
+
let inDouble = false;
|
|
152
|
+
const start = i;
|
|
153
|
+
while (i < style.length) {
|
|
154
|
+
const ch = style[i];
|
|
155
|
+
if (ch === "'" && !inDouble) inSingle = !inSingle;
|
|
156
|
+
else if (ch === '"' && !inSingle) inDouble = !inDouble;
|
|
157
|
+
else if (!inSingle && !inDouble) {
|
|
158
|
+
if (ch === "(") depth++;
|
|
159
|
+
else if (ch === ")") depth = Math.max(0, depth - 1);
|
|
160
|
+
else if (ch === ";" && depth === 0) break;
|
|
161
|
+
}
|
|
162
|
+
i++;
|
|
163
|
+
}
|
|
164
|
+
const decl = style.slice(start, i).trim();
|
|
165
|
+
i++;
|
|
166
|
+
if (!decl) continue;
|
|
167
|
+
const colon = decl.indexOf(":");
|
|
168
|
+
if (colon < 0) continue;
|
|
169
|
+
const key = decl.slice(0, colon).trim();
|
|
170
|
+
const val = decl.slice(colon + 1).trim();
|
|
171
|
+
if (!key) continue;
|
|
172
|
+
if (!props.has(key)) order.push(key);
|
|
173
|
+
props.set(key, val);
|
|
174
|
+
}
|
|
175
|
+
return { props, order };
|
|
176
|
+
}
|
|
177
|
+
function serializeStyleDecls(props, order) {
|
|
178
|
+
return order.map((k) => `${k}: ${props.get(k) ?? ""}`).filter((d) => d.trim()).join("; ");
|
|
179
|
+
}
|
|
180
|
+
function patchStyleAttrString(style, property, value) {
|
|
181
|
+
const { props, order } = parseStyleDecls(style);
|
|
182
|
+
if (value === null) {
|
|
183
|
+
props.delete(property);
|
|
184
|
+
const idx = order.indexOf(property);
|
|
185
|
+
if (idx >= 0) order.splice(idx, 1);
|
|
186
|
+
} else {
|
|
187
|
+
if (!props.has(property)) order.push(property);
|
|
188
|
+
props.set(property, value);
|
|
189
|
+
}
|
|
190
|
+
return serializeStyleDecls(props, order);
|
|
191
|
+
}
|
|
192
|
+
var pinnedInSource = /* @__PURE__ */ new WeakMap();
|
|
193
|
+
function parseSourceDocument(raw) {
|
|
194
|
+
const source = ensureHfIds(raw);
|
|
195
|
+
const hasDocumentShell = /<!doctype|<html[\s>]/i.test(source);
|
|
196
|
+
const document = hasDocumentShell ? parseHTML(source).document : parseHTML(`<!DOCTYPE html><html><head></head><body>${source}</body></html>`).document;
|
|
197
|
+
pinnedInSource.set(
|
|
198
|
+
document,
|
|
199
|
+
new Set(Array.from(raw.matchAll(/\bdata-hf-id\s*=\s*["']?([^"'\s>]+)/gi), (m) => m[1]))
|
|
200
|
+
);
|
|
201
|
+
return { document, wrappedFragment: !hasDocumentShell };
|
|
202
|
+
}
|
|
203
|
+
function duplicateCssRulesForId(document, originalId, newId) {
|
|
204
|
+
const idToken = `#${originalId}`;
|
|
205
|
+
const transform = (0, import_postcss_selector_parser.default)((selectors) => {
|
|
206
|
+
selectors.walkIds((node) => {
|
|
207
|
+
if (node.value === originalId) node.value = newId;
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
for (const styleEl of document.querySelectorAll("style")) {
|
|
211
|
+
const css = styleEl.textContent ?? "";
|
|
212
|
+
let root;
|
|
213
|
+
try {
|
|
214
|
+
root = postcss.parse(css);
|
|
215
|
+
} catch {
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
const clones = [];
|
|
219
|
+
root.walkRules((rule) => {
|
|
220
|
+
if (!rule.selector.includes(idToken)) return;
|
|
221
|
+
const newSelector = transform.processSync(rule.selector);
|
|
222
|
+
if (newSelector === rule.selector) return;
|
|
223
|
+
const clone = rule.clone({ selector: newSelector });
|
|
224
|
+
clones.push(clone);
|
|
225
|
+
});
|
|
226
|
+
if (clones.length > 0) {
|
|
227
|
+
for (const c of clones) root.append(c);
|
|
228
|
+
styleEl.textContent = root.toString();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function querySelectorAllWithTemplates(root, selector) {
|
|
233
|
+
const matches = Array.from(root.querySelectorAll(selector));
|
|
234
|
+
if (matches.length > 0) return matches;
|
|
235
|
+
const templates = Array.from(root.querySelectorAll("template"));
|
|
236
|
+
for (const tmpl of templates) {
|
|
237
|
+
const inner = querySelectorAllWithTemplates(tmpl, selector);
|
|
238
|
+
if (inner.length > 0) return inner;
|
|
239
|
+
}
|
|
240
|
+
return [];
|
|
241
|
+
}
|
|
242
|
+
function escapeCssAttrValue(value) {
|
|
243
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
244
|
+
}
|
|
245
|
+
function findByHfId(document, hfId) {
|
|
246
|
+
try {
|
|
247
|
+
const matches = querySelectorAllWithTemplates(
|
|
248
|
+
document,
|
|
249
|
+
`[data-hf-id="${escapeCssAttrValue(hfId)}"]`
|
|
250
|
+
);
|
|
251
|
+
if (matches.length > 1) {
|
|
252
|
+
console.warn(
|
|
253
|
+
`sourceMutation: data-hf-id "${hfId}" matched ${matches.length} elements; using the first. ids must be unique per document.`
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
return matches[0] ?? null;
|
|
257
|
+
} catch {
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function findTargetElement(document, target) {
|
|
262
|
+
if (target.hfId) {
|
|
263
|
+
const el = findByHfId(document, target.hfId);
|
|
264
|
+
if (el) return el;
|
|
265
|
+
}
|
|
266
|
+
const pinned = pinnedInSource.get(document);
|
|
267
|
+
const unlessPinnedElsewhere = (el) => el && !(target.hfId && pinned?.has(el.getAttribute("data-hf-id") ?? "")) ? el : null;
|
|
268
|
+
if (target.id) {
|
|
269
|
+
const byId = unlessPinnedElsewhere(document.getElementById(target.id));
|
|
270
|
+
if (byId) return byId;
|
|
271
|
+
}
|
|
272
|
+
if (!target.selector) return null;
|
|
273
|
+
try {
|
|
274
|
+
const matches = querySelectorAllWithTemplates(document, target.selector);
|
|
275
|
+
return unlessPinnedElsewhere(matches[target.selectorIndex ?? 0]);
|
|
276
|
+
} catch {
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
function removeElementsFromHtml(source, targets) {
|
|
281
|
+
const { document, wrappedFragment } = parseSourceDocument(source);
|
|
282
|
+
let removed = false;
|
|
283
|
+
for (const target of targets) {
|
|
284
|
+
const element = findTargetElement(document, target);
|
|
285
|
+
if (!element) continue;
|
|
286
|
+
removeElementWithGsapCascade(document, element);
|
|
287
|
+
removed = true;
|
|
288
|
+
}
|
|
289
|
+
if (!removed) return source;
|
|
290
|
+
return wrappedFragment ? document.body.innerHTML || "" : document.toString();
|
|
291
|
+
}
|
|
292
|
+
function removeElementFromHtml(source, target) {
|
|
293
|
+
return removeElementsFromHtml(source, [target]);
|
|
294
|
+
}
|
|
295
|
+
function isHTMLElement(el) {
|
|
296
|
+
const HTMLEl = el.ownerDocument?.defaultView?.HTMLElement;
|
|
297
|
+
return HTMLEl ? el instanceof HTMLEl : el.nodeType === 1 && "style" in el;
|
|
298
|
+
}
|
|
299
|
+
function mountsComposition(document, host, compositionId) {
|
|
300
|
+
if (host.hasAttribute("data-composition-src")) return true;
|
|
301
|
+
return host.children.length === 0 && querySelectorAllWithTemplates(document, "template").some(
|
|
302
|
+
(template) => template.id === `${compositionId}-template`
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
function dedupeClonedCompositionId(document, clone) {
|
|
306
|
+
const compositionId = clone.getAttribute("data-composition-id");
|
|
307
|
+
if (!compositionId || mountsComposition(document, clone, compositionId)) return;
|
|
308
|
+
const usedCompositionIds = new Set(
|
|
309
|
+
querySelectorAllWithTemplates(document, "[data-composition-id]").map(
|
|
310
|
+
(node) => node.getAttribute("data-composition-id")
|
|
311
|
+
)
|
|
312
|
+
);
|
|
313
|
+
const base = `${compositionId}-split`;
|
|
314
|
+
let nextCompositionId = base;
|
|
315
|
+
let suffix = 2;
|
|
316
|
+
while (usedCompositionIds.has(nextCompositionId)) nextCompositionId = `${base}-${suffix++}`;
|
|
317
|
+
clone.setAttribute("data-composition-id", nextCompositionId);
|
|
318
|
+
}
|
|
319
|
+
function resolveOperationTarget(parent, op) {
|
|
320
|
+
if (op.childSelector === void 0) return parent;
|
|
321
|
+
try {
|
|
322
|
+
const child = parent.querySelectorAll(op.childSelector)[op.childIndex ?? 0] ?? null;
|
|
323
|
+
return child && isHTMLElement(child) ? child : null;
|
|
324
|
+
} catch {
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function stampNewChildIds(parent) {
|
|
329
|
+
const assigned = /* @__PURE__ */ new Set();
|
|
330
|
+
const root = parent.ownerDocument?.body ?? parent;
|
|
331
|
+
walkCompositionDescendants(root, (el) => {
|
|
332
|
+
const id = el.getAttribute("data-hf-id");
|
|
333
|
+
if (id) assigned.add(id);
|
|
334
|
+
});
|
|
335
|
+
for (const el of parent.querySelectorAll("*")) {
|
|
336
|
+
if (el.getAttribute("data-hf-id")) continue;
|
|
337
|
+
if (EXCLUDED_TAGS.has(el.tagName.toLowerCase())) continue;
|
|
338
|
+
el.setAttribute("data-hf-id", mintHfId(el, assigned));
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function patchElementInHtml(source, target, operations, takenIds) {
|
|
342
|
+
const { document, wrappedFragment } = parseSourceDocument(source);
|
|
343
|
+
const el = findTargetElement(document, target);
|
|
344
|
+
if (!el || !isHTMLElement(el)) return { html: source, matched: false };
|
|
345
|
+
const htmlEl = el;
|
|
346
|
+
const originalHtml = wrappedFragment ? document.body.innerHTML || "" : document.toString();
|
|
347
|
+
const resolved = [];
|
|
348
|
+
for (const op of operations) {
|
|
349
|
+
const opTarget = resolveOperationTarget(htmlEl, op);
|
|
350
|
+
if (!opTarget) return { html: source, matched: false };
|
|
351
|
+
resolved.push({ op, target: opTarget });
|
|
352
|
+
}
|
|
353
|
+
for (const { op, target: opTarget } of resolved) {
|
|
354
|
+
switch (op.type) {
|
|
355
|
+
case "inline-style":
|
|
356
|
+
{
|
|
357
|
+
const raw = opTarget.getAttribute("style") ?? "";
|
|
358
|
+
const patched = patchStyleAttrString(raw, op.property, op.value);
|
|
359
|
+
opTarget.setAttribute("style", patched);
|
|
360
|
+
}
|
|
361
|
+
break;
|
|
362
|
+
case "attribute":
|
|
363
|
+
{
|
|
364
|
+
const fullAttr = op.property.startsWith("data-") ? op.property : `data-${op.property}`;
|
|
365
|
+
if (op.value != null) {
|
|
366
|
+
opTarget.setAttribute(fullAttr, op.value);
|
|
367
|
+
} else {
|
|
368
|
+
opTarget.removeAttribute(fullAttr);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
break;
|
|
372
|
+
case "html-attribute":
|
|
373
|
+
if (!isAllowedHtmlAttribute(op.property)) break;
|
|
374
|
+
if (op.value != null) {
|
|
375
|
+
if (!isSafeAttributeValue(op.property, op.value)) break;
|
|
376
|
+
const replacementId = op.property === "src" ? replacementTimelineAssetId(document, opTarget, op.value) : null;
|
|
377
|
+
if (replacementId !== null) opTarget.setAttribute("id", replacementId);
|
|
378
|
+
opTarget.setAttribute(op.property, op.value);
|
|
379
|
+
} else {
|
|
380
|
+
opTarget.removeAttribute(op.property);
|
|
381
|
+
}
|
|
382
|
+
break;
|
|
383
|
+
case "ensure-id":
|
|
384
|
+
if (opTarget.getAttribute("id") || !op.value) break;
|
|
385
|
+
opTarget.setAttribute("id", nextUniqueId(document, op.value, takenIds));
|
|
386
|
+
break;
|
|
387
|
+
case "text-content":
|
|
388
|
+
if (op.value != null) {
|
|
389
|
+
const inner = opTarget.children.length === 1 ? opTarget.firstElementChild : null;
|
|
390
|
+
const textTarget = inner && isHTMLElement(inner) ? inner : opTarget;
|
|
391
|
+
textTarget.textContent = op.value;
|
|
392
|
+
}
|
|
393
|
+
break;
|
|
394
|
+
// The one operation that can write markup, so the one that has to check
|
|
395
|
+
// it. Assigned first and sanitised after, rather than sanitising a
|
|
396
|
+
// string: parsing is what turns a payload into the tree the allowlist
|
|
397
|
+
// can actually judge, and linkedom never runs anything it parses.
|
|
398
|
+
case "rich-text":
|
|
399
|
+
if (op.value != null) {
|
|
400
|
+
opTarget.innerHTML = op.value;
|
|
401
|
+
sanitizeRichTextChildren(opTarget);
|
|
402
|
+
stampNewChildIds(opTarget);
|
|
403
|
+
}
|
|
404
|
+
break;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
const html = wrappedFragment ? document.body.innerHTML || "" : document.toString();
|
|
408
|
+
const elementId = htmlEl.getAttribute("id");
|
|
409
|
+
if (html === originalHtml) return { html: source, matched: true, elementId };
|
|
410
|
+
return { html: ensureHfIds(html), matched: true, elementId };
|
|
411
|
+
}
|
|
412
|
+
function nextUniqueId(document, base, takenIds) {
|
|
413
|
+
let id = base;
|
|
414
|
+
let suffix = 2;
|
|
415
|
+
while (document.getElementById(id) || takenIds?.has(id)) id = `${base}-${suffix++}`;
|
|
416
|
+
return id;
|
|
417
|
+
}
|
|
418
|
+
function probeElementsInSource(source, targets) {
|
|
419
|
+
const { document } = parseSourceDocument(source);
|
|
420
|
+
return targets.map((target) => {
|
|
421
|
+
if (!target.id && !target.hfId && !target.selector) return false;
|
|
422
|
+
const el = findTargetElement(document, target);
|
|
423
|
+
return el != null && isHTMLElement(el);
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
function probeElementInSource(source, target) {
|
|
427
|
+
return probeElementsInSource(source, [target])[0] ?? false;
|
|
428
|
+
}
|
|
429
|
+
function resolveElementTiming(el) {
|
|
430
|
+
const timing = readClipTiming(el);
|
|
431
|
+
return { start: timing.start ?? 0, duration: timing.duration ?? 0 };
|
|
432
|
+
}
|
|
433
|
+
function setElementDuration(el, start, duration, trackIndex) {
|
|
434
|
+
writeClipTiming(el, {
|
|
435
|
+
start: Math.round(start * 1e3) / 1e3,
|
|
436
|
+
duration: Math.round(duration * 1e3) / 1e3,
|
|
437
|
+
...trackIndex != null ? { trackIndex } : {}
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
function isWindowOf(media, row) {
|
|
441
|
+
if (media.duration <= 0) return false;
|
|
442
|
+
const near = (a, b) => Math.abs(a - b) < 1e-3;
|
|
443
|
+
return !row || near(media.start, row.start) && near(media.duration, row.duration);
|
|
444
|
+
}
|
|
445
|
+
function splitElementInHtml(source, target, splitTime, newId, fallbackTiming) {
|
|
446
|
+
const { document, wrappedFragment } = parseSourceDocument(source);
|
|
447
|
+
const el = findTargetElement(document, target);
|
|
448
|
+
if (!el || !isHTMLElement(el)) return { html: source, matched: false, newId: null };
|
|
449
|
+
const timedMediaSelector = "video[data-start], audio[data-start]";
|
|
450
|
+
const innerMedia = el.hasAttribute("data-start") || resolveElementTiming(el).duration > 0 || el.matches("[data-composition-src], [data-composition-id]") ? null : el.querySelector(timedMediaSelector);
|
|
451
|
+
const timedMedia = innerMedia && isWindowOf(resolveElementTiming(innerMedia), fallbackTiming) ? innerMedia : null;
|
|
452
|
+
const timed = timedMedia ?? el;
|
|
453
|
+
const timing = resolveElementTiming(timed);
|
|
454
|
+
let { start, duration } = timing;
|
|
455
|
+
if (duration <= 0 && fallbackTiming && fallbackTiming.duration > 0) {
|
|
456
|
+
start = fallbackTiming.start;
|
|
457
|
+
duration = fallbackTiming.duration;
|
|
458
|
+
}
|
|
459
|
+
if (duration <= 0 || splitTime <= start || splitTime >= start + duration) {
|
|
460
|
+
return { html: source, matched: false, newId: null };
|
|
461
|
+
}
|
|
462
|
+
newId = nextUniqueId(document, newId);
|
|
463
|
+
const firstDuration = splitTime - start;
|
|
464
|
+
const secondDuration = duration - firstDuration;
|
|
465
|
+
const clone = el.cloneNode(true);
|
|
466
|
+
if (!isHTMLElement(clone)) return { html: source, matched: false, newId: null };
|
|
467
|
+
clone.setAttribute("id", newId);
|
|
468
|
+
dedupeClonedCompositionId(document, clone);
|
|
469
|
+
clone.removeAttribute("data-hf-id");
|
|
470
|
+
for (const node of clone.querySelectorAll("[data-hf-id]")) node.removeAttribute("data-hf-id");
|
|
471
|
+
const clonedTimed = timedMedia ? clone.querySelector(timedMediaSelector) : clone;
|
|
472
|
+
if (timedMedia?.id) {
|
|
473
|
+
const mediaId = nextUniqueId(document, `${timedMedia.id}-split`, /* @__PURE__ */ new Set([newId]));
|
|
474
|
+
duplicateCssRulesForId(document, timedMedia.id, mediaId);
|
|
475
|
+
clonedTimed.setAttribute("id", mediaId);
|
|
476
|
+
}
|
|
477
|
+
setElementDuration(clonedTimed, splitTime, secondDuration, fallbackTiming?.track);
|
|
478
|
+
const playbackStartAttr = timed.hasAttribute("data-playback-start") ? "data-playback-start" : timed.hasAttribute("data-media-start") ? "data-media-start" : timed.matches("[data-composition-src], [data-composition-id]") ? "data-playback-start" : timed.matches("audio, video") ? "data-media-start" : null;
|
|
479
|
+
if (playbackStartAttr) {
|
|
480
|
+
const readAttr = (name) => timed.getAttribute(name);
|
|
481
|
+
const authoredTrim = timed.getAttribute(playbackStartAttr);
|
|
482
|
+
const currentTrim = authoredTrim !== null ? readMediaOffsetSeconds(readAttr) : fallbackTiming?.playbackStart ?? 0;
|
|
483
|
+
const rate = readPlaybackRate(readAttr, fallbackTiming?.playbackRate);
|
|
484
|
+
if (authoredTrim === null || Number(authoredTrim) !== currentTrim)
|
|
485
|
+
timed.setAttribute(playbackStartAttr, String(Math.round(currentTrim * 1e3) / 1e3));
|
|
486
|
+
clonedTimed.setAttribute(
|
|
487
|
+
playbackStartAttr,
|
|
488
|
+
String(Math.round((currentTrim + firstDuration * rate) * 1e3) / 1e3)
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
const originalId = el.getAttribute("id");
|
|
492
|
+
if (originalId) {
|
|
493
|
+
duplicateCssRulesForId(document, originalId, newId);
|
|
494
|
+
}
|
|
495
|
+
setElementDuration(timed, start, firstDuration, fallbackTiming?.track);
|
|
496
|
+
if (el.nextSibling) {
|
|
497
|
+
el.parentElement.insertBefore(clone, el.nextSibling);
|
|
498
|
+
} else {
|
|
499
|
+
el.parentElement.appendChild(clone);
|
|
500
|
+
}
|
|
501
|
+
const html = wrappedFragment ? document.body.innerHTML || "" : document.toString();
|
|
502
|
+
return {
|
|
503
|
+
// The split owns its new nodes' stable ids. Leaving the clone unstamped makes
|
|
504
|
+
// the next preview request persist different bytes after history is recorded.
|
|
505
|
+
html: ensureHfIds(html),
|
|
506
|
+
matched: true,
|
|
507
|
+
newId
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
function getInlineStylePx(el, property) {
|
|
511
|
+
const style = (isHTMLElement(el) ? el.getAttribute("style") : null) ?? "";
|
|
512
|
+
const { props } = parseStyleDecls(style);
|
|
513
|
+
const raw = props.get(property);
|
|
514
|
+
if (!raw) return 0;
|
|
515
|
+
const n = parseFloat(raw);
|
|
516
|
+
return Number.isFinite(n) ? n : 0;
|
|
517
|
+
}
|
|
518
|
+
function setInlineLeftTop(el, left, top) {
|
|
519
|
+
let style = el.getAttribute("style") ?? "";
|
|
520
|
+
style = patchStyleAttrString(style, "left", `${left}px`);
|
|
521
|
+
style = patchStyleAttrString(style, "top", `${top}px`);
|
|
522
|
+
el.setAttribute("style", style);
|
|
523
|
+
}
|
|
524
|
+
function uniqueGroupDomId(document, groupId) {
|
|
525
|
+
const base = groupId.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "group";
|
|
526
|
+
return nextUniqueId(document, base);
|
|
527
|
+
}
|
|
528
|
+
function wrapElementsInHtml(source, targets, groupId, bbox, rebases) {
|
|
529
|
+
const { document, wrappedFragment } = parseSourceDocument(source);
|
|
530
|
+
if (targets.length === 0) {
|
|
531
|
+
return { html: source, matched: false, groupId: null, error: "no targets" };
|
|
532
|
+
}
|
|
533
|
+
const els = [];
|
|
534
|
+
const seen = /* @__PURE__ */ new Set();
|
|
535
|
+
for (const target of targets) {
|
|
536
|
+
const el = findTargetElement(document, target);
|
|
537
|
+
if (!el || !isHTMLElement(el) || seen.has(el)) continue;
|
|
538
|
+
seen.add(el);
|
|
539
|
+
els.push(el);
|
|
540
|
+
}
|
|
541
|
+
if (els.length === 0) {
|
|
542
|
+
return { html: source, matched: false, groupId: null, error: "no targets matched" };
|
|
543
|
+
}
|
|
544
|
+
const parent = els[0]?.parentElement;
|
|
545
|
+
if (!parent || els.some((el) => el.parentElement !== parent)) {
|
|
546
|
+
return {
|
|
547
|
+
html: source,
|
|
548
|
+
matched: false,
|
|
549
|
+
groupId: null,
|
|
550
|
+
error: "grouped elements must share a single parent"
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
const memberSet = new Set(els);
|
|
554
|
+
const ordered = Array.from(parent.children).filter((c) => memberSet.has(c));
|
|
555
|
+
const rebaseByEl = /* @__PURE__ */ new Map();
|
|
556
|
+
for (const rebase of rebases) {
|
|
557
|
+
const el = findTargetElement(document, rebase.target);
|
|
558
|
+
if (el) rebaseByEl.set(el, { left: rebase.left, top: rebase.top, track: rebase.track });
|
|
559
|
+
}
|
|
560
|
+
const wrapper = document.createElement("div");
|
|
561
|
+
wrapper.setAttribute("data-hf-group", groupId);
|
|
562
|
+
wrapper.setAttribute("id", uniqueGroupDomId(document, groupId));
|
|
563
|
+
const memberZIndexes = ordered.map(
|
|
564
|
+
(el) => Number.parseInt(
|
|
565
|
+
parseStyleDecls(el.getAttribute("style") ?? "").props.get("z-index") ?? "",
|
|
566
|
+
10
|
|
567
|
+
)
|
|
568
|
+
).filter((z) => Number.isFinite(z));
|
|
569
|
+
const maxZ = memberZIndexes.length > 0 ? Math.max(...memberZIndexes) : null;
|
|
570
|
+
wrapper.setAttribute(
|
|
571
|
+
"style",
|
|
572
|
+
`position: absolute; left: ${bbox.left}px; top: ${bbox.top}px; width: ${bbox.width}px; height: ${bbox.height}px` + (maxZ !== null ? `; z-index: ${maxZ}` : "")
|
|
573
|
+
);
|
|
574
|
+
parent.insertBefore(wrapper, ordered[ordered.length - 1] ?? null);
|
|
575
|
+
for (const el of ordered) {
|
|
576
|
+
const rebase = rebaseByEl.get(el);
|
|
577
|
+
if (rebase) setInlineLeftTop(el, rebase.left, rebase.top);
|
|
578
|
+
if (rebase?.track != null) writeClipTiming(el, { trackIndex: Math.round(rebase.track) });
|
|
579
|
+
wrapper.appendChild(el);
|
|
580
|
+
}
|
|
581
|
+
return {
|
|
582
|
+
html: wrappedFragment ? document.body.innerHTML || "" : document.toString(),
|
|
583
|
+
matched: true,
|
|
584
|
+
groupId
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
function buildChildTrackMap(document, group, childTracks) {
|
|
588
|
+
const trackByEl = /* @__PURE__ */ new Map();
|
|
589
|
+
for (const entry of childTracks) {
|
|
590
|
+
const el = findTargetElement(document, entry.target);
|
|
591
|
+
if (el && group.contains(el) && entry.track != null) trackByEl.set(el, entry.track);
|
|
592
|
+
}
|
|
593
|
+
return trackByEl;
|
|
594
|
+
}
|
|
595
|
+
function relocateGroupChildren(group, parent, wLeft, wTop, trackByEl) {
|
|
596
|
+
const members = [];
|
|
597
|
+
for (const child of Array.from(group.children)) {
|
|
598
|
+
if (isHTMLElement(child)) {
|
|
599
|
+
const newLeft = getInlineStylePx(child, "left") + wLeft;
|
|
600
|
+
const newTop = getInlineStylePx(child, "top") + wTop;
|
|
601
|
+
setInlineLeftTop(child, newLeft, newTop);
|
|
602
|
+
const track = trackByEl.get(child);
|
|
603
|
+
if (track != null) writeClipTiming(child, { trackIndex: Math.round(track) });
|
|
604
|
+
if (child.id) {
|
|
605
|
+
members.push({
|
|
606
|
+
id: child.id,
|
|
607
|
+
cx: newLeft + getInlineStylePx(child, "width") / 2,
|
|
608
|
+
cy: newTop + getInlineStylePx(child, "height") / 2
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
parent.insertBefore(child, group);
|
|
613
|
+
}
|
|
614
|
+
return members;
|
|
615
|
+
}
|
|
616
|
+
function unwrapElementsFromHtml(source, groupTarget, childTracks = []) {
|
|
617
|
+
const { document, wrappedFragment } = parseSourceDocument(source);
|
|
618
|
+
const group = findTargetElement(document, groupTarget);
|
|
619
|
+
if (!group || !isHTMLElement(group)) return { html: source, unwrapped: false };
|
|
620
|
+
if (!group.hasAttribute("data-hf-group")) return { html: source, unwrapped: false };
|
|
621
|
+
const parent = group.parentElement;
|
|
622
|
+
if (!parent) return { html: source, unwrapped: false };
|
|
623
|
+
const trackByEl = buildChildTrackMap(document, group, childTracks);
|
|
624
|
+
const wLeft = getInlineStylePx(group, "left");
|
|
625
|
+
const wTop = getInlineStylePx(group, "top");
|
|
626
|
+
const groupCenter = {
|
|
627
|
+
cx: wLeft + getInlineStylePx(group, "width") / 2,
|
|
628
|
+
cy: wTop + getInlineStylePx(group, "height") / 2
|
|
629
|
+
};
|
|
630
|
+
const members = relocateGroupChildren(group, parent, wLeft, wTop, trackByEl);
|
|
631
|
+
const groupId = group.id || void 0;
|
|
632
|
+
group.remove();
|
|
633
|
+
return {
|
|
634
|
+
html: wrappedFragment ? document.body.innerHTML || "" : document.toString(),
|
|
635
|
+
unwrapped: true,
|
|
636
|
+
unwrappedGroupId: groupId,
|
|
637
|
+
members,
|
|
638
|
+
groupCenter
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
function relinkSplitHalvesInHtml(source, rightHalfIds) {
|
|
642
|
+
const { document, wrappedFragment } = parseSourceDocument(source);
|
|
643
|
+
const carriesPairing = (id) => {
|
|
644
|
+
const el = document.getElementById(id);
|
|
645
|
+
return Boolean(el?.hasAttribute("data-link") || el?.hasAttribute("data-sync-origin"));
|
|
646
|
+
};
|
|
647
|
+
if (!rightHalfIds.some(carriesPairing)) {
|
|
648
|
+
return source;
|
|
649
|
+
}
|
|
650
|
+
relinkSplitHalves(document, rightHalfIds);
|
|
651
|
+
return wrappedFragment ? document.body.innerHTML || "" : document.toString();
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
export {
|
|
655
|
+
parseSourceDocument,
|
|
656
|
+
findTargetElement,
|
|
657
|
+
removeElementsFromHtml,
|
|
658
|
+
removeElementFromHtml,
|
|
659
|
+
isHTMLElement,
|
|
660
|
+
dedupeClonedCompositionId,
|
|
661
|
+
patchElementInHtml,
|
|
662
|
+
nextUniqueId,
|
|
663
|
+
probeElementsInSource,
|
|
664
|
+
probeElementInSource,
|
|
665
|
+
splitElementInHtml,
|
|
666
|
+
wrapElementsInHtml,
|
|
667
|
+
unwrapElementsFromHtml,
|
|
668
|
+
relinkSplitHalvesInHtml
|
|
669
|
+
};
|