@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,990 @@
|
|
|
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
|
+
inAgentSandbox,
|
|
9
|
+
isOneProcessOverPipe,
|
|
10
|
+
machServiceDenied,
|
|
11
|
+
oneProcessOverPipe,
|
|
12
|
+
pageNavigationTimeoutMs,
|
|
13
|
+
pipeLaunchClosedOnMac,
|
|
14
|
+
sandboxDeniedRemediation,
|
|
15
|
+
windowsChromeCrashRemediation
|
|
16
|
+
} from "./chunk-YOR4CTCE.js";
|
|
17
|
+
import {
|
|
18
|
+
resolveCompositionViewportFromHtml
|
|
19
|
+
} from "./chunk-LEKZNRKI.js";
|
|
20
|
+
import {
|
|
21
|
+
resolveCaptureBrowserGpuMode,
|
|
22
|
+
resolveLocalBrowserGpuMode,
|
|
23
|
+
resolveLocalWebGpu
|
|
24
|
+
} from "./chunk-WKBM7NDG.js";
|
|
25
|
+
import {
|
|
26
|
+
c
|
|
27
|
+
} from "./chunk-VORQIH64.js";
|
|
28
|
+
import {
|
|
29
|
+
requestCliExit
|
|
30
|
+
} from "./chunk-JVBRJMOP.js";
|
|
31
|
+
import {
|
|
32
|
+
assertWebGpuAdapterAvailable,
|
|
33
|
+
compositionRequiresWebGpu
|
|
34
|
+
} from "./chunk-TIQB63MX.js";
|
|
35
|
+
import {
|
|
36
|
+
normalizeErrorMessage
|
|
37
|
+
} from "./chunk-T2EUWCJE.js";
|
|
38
|
+
import {
|
|
39
|
+
withHyperframesBrowserMarker
|
|
40
|
+
} from "./chunk-K4MJX7SR.js";
|
|
41
|
+
import {
|
|
42
|
+
processIsAlive
|
|
43
|
+
} from "./chunk-KGPLIH7B.js";
|
|
44
|
+
|
|
45
|
+
// src/browser/windowsChromeWatchdog.ts
|
|
46
|
+
import { spawn } from "child_process";
|
|
47
|
+
import { realpathSync } from "fs";
|
|
48
|
+
var SWEEP = `$b=[int]$env:HF_CHROME_PID; $x=$env:HF_CHROME_EXE; $t=[DateTimeOffset]::FromUnixTimeMilliseconds([int64]$env:HF_CHROME_SINCE).UtcDateTime; Get-CimInstance Win32_Process | Where-Object { ($_.ProcessId -eq $b -or $_.ParentProcessId -eq $b) -and $_.ExecutablePath -eq $x -and $_.CreationDate.ToUniversalTime() -ge $t } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }`;
|
|
49
|
+
var WATCHDOG = `let clean = false;
|
|
50
|
+
const done = () => {
|
|
51
|
+
if (!clean) require("node:child_process").spawnSync("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", ${JSON.stringify(SWEEP)}], { windowsHide: true, timeout: 20000 });
|
|
52
|
+
process.exit(0);
|
|
53
|
+
};
|
|
54
|
+
process.stdin.on("data", (data) => { clean ||= String(data).includes("clean"); });
|
|
55
|
+
process.stdin.on("end", done);
|
|
56
|
+
process.stdin.on("error", done);`;
|
|
57
|
+
function executableOf(chrome) {
|
|
58
|
+
try {
|
|
59
|
+
return realpathSync.native(chrome.spawnfile);
|
|
60
|
+
} catch {
|
|
61
|
+
return void 0;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function watchChromeTree(chrome, launchedAt) {
|
|
65
|
+
const executable = process.platform === "win32" ? executableOf(chrome) : void 0;
|
|
66
|
+
if (!executable || chrome.pid === void 0) return void 0;
|
|
67
|
+
const watchdog = spawn(process.execPath, ["-e", WATCHDOG], {
|
|
68
|
+
detached: true,
|
|
69
|
+
env: {
|
|
70
|
+
...process.env,
|
|
71
|
+
HF_CHROME_PID: String(chrome.pid),
|
|
72
|
+
HF_CHROME_EXE: executable,
|
|
73
|
+
HF_CHROME_SINCE: String(launchedAt)
|
|
74
|
+
},
|
|
75
|
+
stdio: ["pipe", "ignore", "ignore"],
|
|
76
|
+
windowsHide: true
|
|
77
|
+
});
|
|
78
|
+
watchdog.on("error", () => {
|
|
79
|
+
});
|
|
80
|
+
watchdog.stdin?.on("error", () => {
|
|
81
|
+
});
|
|
82
|
+
watchdog.unref();
|
|
83
|
+
watchdog.stdin?.unref?.();
|
|
84
|
+
let released = false;
|
|
85
|
+
return {
|
|
86
|
+
release(clean) {
|
|
87
|
+
if (released) return;
|
|
88
|
+
released = true;
|
|
89
|
+
watchdog.stdin?.end(clean ? "clean" : "");
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// src/browser/launch.ts
|
|
95
|
+
var BrowserCleanupError = class extends AggregateError {
|
|
96
|
+
};
|
|
97
|
+
var browsers = /* @__PURE__ */ new Set();
|
|
98
|
+
var closing = /* @__PURE__ */ new WeakMap();
|
|
99
|
+
var watchdogs = /* @__PURE__ */ new WeakMap();
|
|
100
|
+
var pending = /* @__PURE__ */ new Map();
|
|
101
|
+
var sessionCleanups = /* @__PURE__ */ new Set();
|
|
102
|
+
var CLOSE_GRACE_MS = 1e3;
|
|
103
|
+
var LAUNCH_TIMEOUT_MS = 3e4;
|
|
104
|
+
var EXIT_POLL_MS = 50;
|
|
105
|
+
var listening = false;
|
|
106
|
+
var shutdown;
|
|
107
|
+
function stopForSignal(signal) {
|
|
108
|
+
if (shutdown) return;
|
|
109
|
+
shutdown = closeManagedBrowsers();
|
|
110
|
+
void shutdown.then(
|
|
111
|
+
() => requestCliExit(signal === "SIGINT" ? 130 : 143),
|
|
112
|
+
(error) => {
|
|
113
|
+
console.error("Browser shutdown failed:", error);
|
|
114
|
+
requestCliExit(1);
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
function ownSignals() {
|
|
119
|
+
if (listening) return;
|
|
120
|
+
listening = true;
|
|
121
|
+
process.on("SIGINT", () => stopForSignal("SIGINT"));
|
|
122
|
+
process.on("SIGTERM", () => stopForSignal("SIGTERM"));
|
|
123
|
+
}
|
|
124
|
+
async function resolveManagedGpuMode(requestedMode, chromePath, context = {}) {
|
|
125
|
+
ownSignals();
|
|
126
|
+
if (requestedMode === "auto" && inAgentSandbox()) return "software";
|
|
127
|
+
return resolveCaptureBrowserGpuMode(requestedMode, chromePath, {
|
|
128
|
+
launch: async (puppeteer, options) => {
|
|
129
|
+
context.signal?.throwIfAborted();
|
|
130
|
+
const browser = await launchManagedBrowser(puppeteer, {
|
|
131
|
+
...options,
|
|
132
|
+
...context.noListen ? oneProcessOverPipe(options) : {},
|
|
133
|
+
signal: context.signal
|
|
134
|
+
});
|
|
135
|
+
try {
|
|
136
|
+
context.onBrowser?.(browser);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
return rethrowAfterBrowserCleanup(browser, error);
|
|
139
|
+
}
|
|
140
|
+
return browser;
|
|
141
|
+
},
|
|
142
|
+
close: closeManagedBrowser
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
async function launchManagedBrowser(puppeteer, options) {
|
|
146
|
+
const sandboxed = isOneProcessOverPipe(options) || inAgentSandbox();
|
|
147
|
+
try {
|
|
148
|
+
return await launchOwnedBrowser(puppeteer, sandboxed ? oneProcessOverPipe(options) : options);
|
|
149
|
+
} catch (error) {
|
|
150
|
+
const unnamedSeatbelt = !sandboxed && (machServiceDenied(normalizeErrorMessage(error)) || pipeLaunchClosedOnMac(error));
|
|
151
|
+
if (!unnamedSeatbelt) throw withRemediation(error);
|
|
152
|
+
return launchOwnedBrowser(puppeteer, oneProcessOverPipe(options)).catch(
|
|
153
|
+
(retryError) => {
|
|
154
|
+
throw withRemediation(retryError);
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function withRemediation(error) {
|
|
160
|
+
const remediation = sandboxDeniedRemediation(normalizeErrorMessage(error));
|
|
161
|
+
return remediation ? new Error(remediation, { cause: error }) : error;
|
|
162
|
+
}
|
|
163
|
+
async function launchOwnedBrowser(puppeteer, options) {
|
|
164
|
+
if (shutdown) throw new Error("The CLI is stopping; no browser can start.");
|
|
165
|
+
ownSignals();
|
|
166
|
+
const abort = new AbortController();
|
|
167
|
+
const signal = options.signal ? AbortSignal.any([options.signal, abort.signal]) : abort.signal;
|
|
168
|
+
const launchedAt = Date.now();
|
|
169
|
+
const launch = untilLaunchOrAbort(
|
|
170
|
+
puppeteer.launch({
|
|
171
|
+
...options,
|
|
172
|
+
args: withHyperframesBrowserMarker(options.args),
|
|
173
|
+
pipe: true,
|
|
174
|
+
signal,
|
|
175
|
+
handleSIGINT: false,
|
|
176
|
+
handleSIGTERM: false
|
|
177
|
+
}),
|
|
178
|
+
signal
|
|
179
|
+
);
|
|
180
|
+
const limit = options.timeout ?? LAUNCH_TIMEOUT_MS;
|
|
181
|
+
const timer = limit > 0 ? setTimeout(
|
|
182
|
+
() => abort.abort(new Error(`The browser did not finish starting within ${limit} ms.`)),
|
|
183
|
+
limit
|
|
184
|
+
) : void 0;
|
|
185
|
+
pending.set(launch, abort);
|
|
186
|
+
try {
|
|
187
|
+
const browser = await launch;
|
|
188
|
+
const child = browser.process();
|
|
189
|
+
if (!child) throw new Error("A launched browser has no owned process.");
|
|
190
|
+
browsers.add(browser);
|
|
191
|
+
const watchdog = watchChromeTree(child, launchedAt);
|
|
192
|
+
if (watchdog) watchdogs.set(browser, watchdog);
|
|
193
|
+
child.once("exit", () => browsers.delete(browser));
|
|
194
|
+
return browser;
|
|
195
|
+
} finally {
|
|
196
|
+
clearTimeout(timer);
|
|
197
|
+
pending.delete(launch);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function untilLaunchOrAbort(launch, signal) {
|
|
201
|
+
const aborted = new Promise((_, reject) => {
|
|
202
|
+
if (signal.aborted) reject(signal.reason);
|
|
203
|
+
signal.addEventListener("abort", () => reject(signal.reason), { once: true });
|
|
204
|
+
});
|
|
205
|
+
void launch.then((late) => signal.aborted ? closeManagedBrowser(late) : void 0).catch(() => void 0);
|
|
206
|
+
return Promise.race([launch, aborted]);
|
|
207
|
+
}
|
|
208
|
+
async function closeManagedBrowsers() {
|
|
209
|
+
for (const abort of pending.values()) abort.abort();
|
|
210
|
+
await Promise.allSettled(pending.keys());
|
|
211
|
+
const results = await Promise.allSettled([...browsers].map(closeManagedBrowser));
|
|
212
|
+
results.push(...await Promise.allSettled([...sessionCleanups].map((cleanup) => cleanup())));
|
|
213
|
+
const errors = results.flatMap((result) => result.status === "rejected" ? [result.reason] : []);
|
|
214
|
+
if (errors.length) throw new AggregateError(errors, "Browser session shutdown failed.");
|
|
215
|
+
}
|
|
216
|
+
function closeManagedBrowser(browser) {
|
|
217
|
+
const existing = closing.get(browser);
|
|
218
|
+
if (existing) return existing;
|
|
219
|
+
const close = closeBrowser(browser);
|
|
220
|
+
closing.set(browser, close);
|
|
221
|
+
return close;
|
|
222
|
+
}
|
|
223
|
+
async function rethrowAfterBrowserCleanup(browser, error) {
|
|
224
|
+
if (browser) {
|
|
225
|
+
try {
|
|
226
|
+
await closeManagedBrowser(browser);
|
|
227
|
+
} catch (cleanupError) {
|
|
228
|
+
throw new BrowserCleanupError(
|
|
229
|
+
[error, cleanupError],
|
|
230
|
+
`${normalizeErrorMessage(error)}; browser cleanup failed: ${normalizeErrorMessage(cleanupError)}`
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
throw error;
|
|
235
|
+
}
|
|
236
|
+
async function closeBrowser(browser) {
|
|
237
|
+
let clean = false;
|
|
238
|
+
try {
|
|
239
|
+
clean = await closedWithoutKill(browser);
|
|
240
|
+
} finally {
|
|
241
|
+
watchdogs.get(browser)?.release(clean);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
async function closedWithoutKill(browser) {
|
|
245
|
+
const child = browser.process();
|
|
246
|
+
if (!child) throw new Error("A managed browser lost its owned process.");
|
|
247
|
+
if (child.exitCode !== null || child.signalCode !== null) return false;
|
|
248
|
+
const exited = new Promise((resolve) => child.once("exit", () => resolve()));
|
|
249
|
+
let timer;
|
|
250
|
+
let poll;
|
|
251
|
+
const grace = new Promise((resolve) => {
|
|
252
|
+
timer = setTimeout(resolve, CLOSE_GRACE_MS);
|
|
253
|
+
});
|
|
254
|
+
try {
|
|
255
|
+
await Promise.race([
|
|
256
|
+
browser.close().catch((error) => console.warn("Browser close failed:", error)),
|
|
257
|
+
grace
|
|
258
|
+
]);
|
|
259
|
+
const clean = child.exitCode !== null || child.signalCode !== null;
|
|
260
|
+
if (!clean) child.kill("SIGKILL");
|
|
261
|
+
clearTimeout(timer);
|
|
262
|
+
const exitLimit = new Promise((_, reject) => {
|
|
263
|
+
timer = setTimeout(
|
|
264
|
+
() => reject(new Error("Browser process did not exit after forced shutdown.")),
|
|
265
|
+
CLOSE_GRACE_MS
|
|
266
|
+
);
|
|
267
|
+
});
|
|
268
|
+
const goneBeforeExitEvent = new Promise((resolve) => {
|
|
269
|
+
poll = setInterval(() => {
|
|
270
|
+
if (child.pid === void 0 || !processIsAlive(child.pid)) resolve();
|
|
271
|
+
}, EXIT_POLL_MS);
|
|
272
|
+
});
|
|
273
|
+
await Promise.race([exited, goneBeforeExitEvent, exitLimit]);
|
|
274
|
+
return clean;
|
|
275
|
+
} finally {
|
|
276
|
+
clearTimeout(timer);
|
|
277
|
+
clearInterval(poll);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// src/capture/captureCompositionFrame.ts
|
|
282
|
+
import { spawn as spawn2 } from "child_process";
|
|
283
|
+
|
|
284
|
+
// src/capture/captureTimeout.ts
|
|
285
|
+
var StageBudgetTimeoutError = class extends Error {
|
|
286
|
+
budgetMs;
|
|
287
|
+
constructor(label, budgetMs) {
|
|
288
|
+
super(`stage budget exceeded while ${label} (${budgetMs}ms)`);
|
|
289
|
+
this.name = "StageBudgetTimeoutError";
|
|
290
|
+
this.budgetMs = budgetMs;
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
async function withRemainingBudget(work, remainingMs, label, timeoutError = () => new StageBudgetTimeoutError(label, Math.max(0, remainingMs))) {
|
|
294
|
+
if (!(remainingMs > 0)) {
|
|
295
|
+
throw timeoutError();
|
|
296
|
+
}
|
|
297
|
+
let timer;
|
|
298
|
+
try {
|
|
299
|
+
return await Promise.race([
|
|
300
|
+
work,
|
|
301
|
+
new Promise((_resolve, reject) => {
|
|
302
|
+
timer = setTimeout(() => {
|
|
303
|
+
reject(timeoutError());
|
|
304
|
+
}, remainingMs);
|
|
305
|
+
})
|
|
306
|
+
]);
|
|
307
|
+
} finally {
|
|
308
|
+
if (timer !== void 0) {
|
|
309
|
+
clearTimeout(timer);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// src/capture/navigateForCapture.ts
|
|
315
|
+
var PUPPETEER_LAUNCH_DEFAULT_TIMEOUT_MS = 3e4;
|
|
316
|
+
var PAGE_LOAD_BLOCKING_TYPES = /* @__PURE__ */ new Set(["Document", "Script", "Stylesheet"]);
|
|
317
|
+
var NAMED_BLOCKING_REQUESTS = 3;
|
|
318
|
+
var SENT_OR_ANSWERED_WITHOUT_NETWORK = [
|
|
319
|
+
"Network.requestWillBeSentExtraInfo",
|
|
320
|
+
"Network.responseReceived"
|
|
321
|
+
];
|
|
322
|
+
async function gotoWhenSent(page, url, timeoutMs, coldChromeFirstRequestTimeoutMs = PUPPETEER_LAUNCH_DEFAULT_TIMEOUT_MS) {
|
|
323
|
+
const { TimeoutError } = await import("puppeteer-core");
|
|
324
|
+
const cdp = await page.createCDPSession();
|
|
325
|
+
try {
|
|
326
|
+
await cdp.send("Network.enable");
|
|
327
|
+
const sent = documentRequestSent(cdp);
|
|
328
|
+
const unfinished = unfinishedPageLoadRequests(cdp);
|
|
329
|
+
const navigation = page.goto(url, { waitUntil: "domcontentloaded", timeout: 0 });
|
|
330
|
+
const navigationAwaitedBelow = navigation.catch(() => void 0);
|
|
331
|
+
await withRemainingBudget(
|
|
332
|
+
Promise.race([sent, navigationAwaitedBelow]),
|
|
333
|
+
coldChromeFirstRequestTimeoutMs,
|
|
334
|
+
"sending the page request",
|
|
335
|
+
() => new TimeoutError(
|
|
336
|
+
`Navigation timeout: Chrome did not send the page request within ${coldChromeFirstRequestTimeoutMs} ms`
|
|
337
|
+
)
|
|
338
|
+
);
|
|
339
|
+
return await withRemainingBudget(
|
|
340
|
+
navigation,
|
|
341
|
+
timeoutMs,
|
|
342
|
+
"loading the page",
|
|
343
|
+
() => new TimeoutError(pageLoadTimeoutMessage(timeoutMs, url, unfinished()))
|
|
344
|
+
);
|
|
345
|
+
} finally {
|
|
346
|
+
await cdp.detach().catch(() => void 0);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function documentRequestSent(cdp) {
|
|
350
|
+
const documents = /* @__PURE__ */ new Set();
|
|
351
|
+
const sent = /* @__PURE__ */ new Set();
|
|
352
|
+
return new Promise((resolve) => {
|
|
353
|
+
const settle = (requestId) => {
|
|
354
|
+
if (documents.has(requestId) && sent.has(requestId)) resolve();
|
|
355
|
+
};
|
|
356
|
+
cdp.on("Network.requestWillBeSent", ({ requestId, type }) => {
|
|
357
|
+
if (type === "Document") documents.add(requestId);
|
|
358
|
+
settle(requestId);
|
|
359
|
+
});
|
|
360
|
+
for (const event of SENT_OR_ANSWERED_WITHOUT_NETWORK) {
|
|
361
|
+
cdp.on(event, ({ requestId }) => {
|
|
362
|
+
sent.add(requestId);
|
|
363
|
+
settle(requestId);
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
function unfinishedPageLoadRequests(cdp) {
|
|
369
|
+
const unfinished = /* @__PURE__ */ new Map();
|
|
370
|
+
cdp.on("Network.requestWillBeSent", ({ requestId, request, type }) => {
|
|
371
|
+
if (type && PAGE_LOAD_BLOCKING_TYPES.has(type)) unfinished.set(requestId, request.url);
|
|
372
|
+
});
|
|
373
|
+
for (const event of ["Network.loadingFinished", "Network.loadingFailed"]) {
|
|
374
|
+
cdp.on(event, ({ requestId }) => unfinished.delete(requestId));
|
|
375
|
+
}
|
|
376
|
+
return () => [...unfinished.values()];
|
|
377
|
+
}
|
|
378
|
+
function urlWithoutSecrets(raw) {
|
|
379
|
+
try {
|
|
380
|
+
const url = new URL(raw);
|
|
381
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") return `${url.protocol}\u2026`;
|
|
382
|
+
return `${url.origin}${url.pathname}${url.search ? "?\u2026" : ""}`;
|
|
383
|
+
} catch {
|
|
384
|
+
return "(unreadable URL)";
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function originOf(raw) {
|
|
388
|
+
try {
|
|
389
|
+
return new URL(raw).origin;
|
|
390
|
+
} catch {
|
|
391
|
+
return null;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
function pageLoadTimeoutMessage(timeoutMs, pageUrl, waitingOn) {
|
|
395
|
+
const exceeded = `Navigation timeout of ${timeoutMs} ms exceeded`;
|
|
396
|
+
if (waitingOn.length === 0) return exceeded;
|
|
397
|
+
const named = waitingOn.slice(0, NAMED_BLOCKING_REQUESTS).map(urlWithoutSecrets).join(", ");
|
|
398
|
+
const unnamed = waitingOn.length - NAMED_BLOCKING_REQUESTS;
|
|
399
|
+
const more = unnamed > 0 ? ` and ${unnamed} more` : "";
|
|
400
|
+
const pageOrigin = new URL(pageUrl).origin;
|
|
401
|
+
const fromAnotherServer = waitingOn.some((request) => originOf(request) !== pageOrigin);
|
|
402
|
+
const advice = fromAnotherServer ? " A <script> or stylesheet from another server holds the page until it arrives; serve it from the project instead." : "";
|
|
403
|
+
return `${exceeded} while the page was still loading ${named}${more}.${advice}`;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// src/capture/captureCompositionFrame.ts
|
|
407
|
+
var SHADER_TRANSITIONS_TIMEOUT_MS = 9e4;
|
|
408
|
+
var CAPTURE_SETTLE_MS = 1500;
|
|
409
|
+
var NETWORK_IDLE_MS = 100;
|
|
410
|
+
var PREFERRED_SEEK_TARGET_WAIT_MS = 500;
|
|
411
|
+
var DEFAULT_POST_SEEK_FONT_WAIT_MS = 500;
|
|
412
|
+
var AUDIT_SEEK_OPTIONS = {
|
|
413
|
+
fallbackToBridgeAndTimelines: true,
|
|
414
|
+
animationFrameSettle: "double",
|
|
415
|
+
waitForFontsMs: 500
|
|
416
|
+
};
|
|
417
|
+
var SCREENSHOT_IMAGE_WAIT_MS = 3e3;
|
|
418
|
+
var SCREENSHOT_SEEK_OPTIONS = {
|
|
419
|
+
...AUDIT_SEEK_OPTIONS,
|
|
420
|
+
waitForImagesMs: SCREENSHOT_IMAGE_WAIT_MS
|
|
421
|
+
};
|
|
422
|
+
var ALL_IMAGES_SETTLED = { pending: [], failed: [] };
|
|
423
|
+
var DENSE_GEOMETRY_SEEK_OPTIONS = {
|
|
424
|
+
...AUDIT_SEEK_OPTIONS,
|
|
425
|
+
animationFrameSettle: "none",
|
|
426
|
+
waitForFontsMs: 0,
|
|
427
|
+
settleMs: 0,
|
|
428
|
+
waitForVideoFrames: false,
|
|
429
|
+
skipWebglDraws: true
|
|
430
|
+
};
|
|
431
|
+
function launchKey(html, noListen, options) {
|
|
432
|
+
const viewport = resolveCompositionViewportFromHtml(html);
|
|
433
|
+
const gpuMode = options.browserGpuMode ?? resolveCliChromeGpuMode();
|
|
434
|
+
return JSON.stringify([viewport, compositionRequiresWebGpu(html), noListen, gpuMode]);
|
|
435
|
+
}
|
|
436
|
+
function prelaunchCompositionBrowser(html, browserGpuMode) {
|
|
437
|
+
const abort = new AbortController();
|
|
438
|
+
const options = { browserGpuMode, signal: abort.signal };
|
|
439
|
+
const key = launchKey(html, false, options);
|
|
440
|
+
const launched = launchCompositionBrowser(html, false, options).catch(() => void 0);
|
|
441
|
+
let taken = false;
|
|
442
|
+
const discard = async () => {
|
|
443
|
+
if (taken) return;
|
|
444
|
+
taken = true;
|
|
445
|
+
abort.abort();
|
|
446
|
+
await (await launched)?.browser.close().catch(() => void 0);
|
|
447
|
+
};
|
|
448
|
+
return {
|
|
449
|
+
launched,
|
|
450
|
+
take: async (wanted) => {
|
|
451
|
+
if (wanted !== key) return discard().then(() => void 0);
|
|
452
|
+
taken = true;
|
|
453
|
+
const result = await launched;
|
|
454
|
+
if (result?.browser.connected) return result;
|
|
455
|
+
await result?.browser.close().catch(() => void 0);
|
|
456
|
+
return void 0;
|
|
457
|
+
},
|
|
458
|
+
discard
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
function resolveCliChromeGpuMode(envMode = process.env.PRODUCER_BROWSER_GPU_MODE) {
|
|
462
|
+
return resolveLocalBrowserGpuMode(void 0, envMode);
|
|
463
|
+
}
|
|
464
|
+
function compositionRuntimeReadyInBrowser() {
|
|
465
|
+
return Boolean(Reflect.get(window, "__renderReady")) || typeof Reflect.get(window, "__hfStartupError") === "string";
|
|
466
|
+
}
|
|
467
|
+
function shaderTransitionsReadyInBrowser() {
|
|
468
|
+
function shaderTransitionRegistryReady() {
|
|
469
|
+
const hf = Reflect.get(window, "__hf");
|
|
470
|
+
if (typeof hf !== "object" || hf === null) return void 0;
|
|
471
|
+
const shaderTransitions = Reflect.get(hf, "shaderTransitions");
|
|
472
|
+
if (typeof shaderTransitions !== "object" || shaderTransitions === null) return void 0;
|
|
473
|
+
for (const key of Object.keys(shaderTransitions)) {
|
|
474
|
+
const entry = Reflect.get(shaderTransitions, key);
|
|
475
|
+
if (typeof entry !== "object" || entry === null) return false;
|
|
476
|
+
if (Reflect.get(entry, "ready") !== true) return false;
|
|
477
|
+
}
|
|
478
|
+
return true;
|
|
479
|
+
}
|
|
480
|
+
function shaderLoadingOverlayReady() {
|
|
481
|
+
const overlay = document.querySelector("[data-hyper-shader-loading]");
|
|
482
|
+
if (!overlay) return true;
|
|
483
|
+
if (!(overlay instanceof HTMLElement)) return true;
|
|
484
|
+
return window.getComputedStyle(overlay).display === "none";
|
|
485
|
+
}
|
|
486
|
+
return shaderTransitionRegistryReady() ?? shaderLoadingOverlayReady();
|
|
487
|
+
}
|
|
488
|
+
async function waitForRuntimeReady(page, timeoutMs) {
|
|
489
|
+
const settled = await page.waitForFunction(compositionRuntimeReadyInBrowser, { timeout: timeoutMs }).then(() => true).catch(() => false);
|
|
490
|
+
const startupError = await page.evaluate(() => Reflect.get(window, "__hfStartupError")).catch(() => void 0);
|
|
491
|
+
if (typeof startupError === "string") throw new Error(startupError);
|
|
492
|
+
return settled;
|
|
493
|
+
}
|
|
494
|
+
async function waitForCompositionSettle(page, options) {
|
|
495
|
+
const runtimeReady = await waitForRuntimeReady(page, options.renderReadyTimeoutMs);
|
|
496
|
+
if (!runtimeReady) {
|
|
497
|
+
console.warn(
|
|
498
|
+
`
|
|
499
|
+
${c.warn("\u26A0")} Runtime did not become render-ready within ${options.renderReadyTimeoutMs}ms \u2014 ${options.renderReadyWarningSuffix}`
|
|
500
|
+
);
|
|
501
|
+
}
|
|
502
|
+
await page.waitForFunction(shaderTransitionsReadyInBrowser, {
|
|
503
|
+
timeout: SHADER_TRANSITIONS_TIMEOUT_MS
|
|
504
|
+
}).catch(() => {
|
|
505
|
+
console.warn(` ${c.warn("\u26A0")} Shader transitions did not finish pre-rendering`);
|
|
506
|
+
});
|
|
507
|
+
await waitForLateSubresources(page, options.lateSubresourceTimeoutMs ?? CAPTURE_SETTLE_MS);
|
|
508
|
+
const { resolveConfig, waitForImagesReady } = await import("./src-Z5PGEMXB.js");
|
|
509
|
+
const imageTimeoutMs = resolveConfig().playerReadyTimeout;
|
|
510
|
+
await waitForImagesReady(
|
|
511
|
+
page,
|
|
512
|
+
imageTimeoutMs,
|
|
513
|
+
(sources) => console.warn(
|
|
514
|
+
` ${c.warn("\u26A0")} Some images did not load within ${imageTimeoutMs}ms: ${sources}. They may show blank.`
|
|
515
|
+
)
|
|
516
|
+
);
|
|
517
|
+
return runtimeReady;
|
|
518
|
+
}
|
|
519
|
+
async function waitForLateSubresources(page, timeoutMs) {
|
|
520
|
+
let cap;
|
|
521
|
+
const deadline = Date.now() + timeoutMs;
|
|
522
|
+
const ready = (async () => {
|
|
523
|
+
await page.waitForFunction(() => document.readyState === "complete", {
|
|
524
|
+
timeout: timeoutMs
|
|
525
|
+
});
|
|
526
|
+
await page.waitForNetworkIdle({
|
|
527
|
+
idleTime: NETWORK_IDLE_MS,
|
|
528
|
+
timeout: Math.max(1, deadline - Date.now())
|
|
529
|
+
});
|
|
530
|
+
await page.evaluate(async () => {
|
|
531
|
+
await Promise.all(Array.from(document.images, (image) => image.decode().catch(() => {
|
|
532
|
+
})));
|
|
533
|
+
await document.fonts.ready;
|
|
534
|
+
});
|
|
535
|
+
})();
|
|
536
|
+
try {
|
|
537
|
+
await Promise.race([
|
|
538
|
+
ready,
|
|
539
|
+
new Promise((resolveCap) => {
|
|
540
|
+
cap = setTimeout(resolveCap, timeoutMs);
|
|
541
|
+
})
|
|
542
|
+
]);
|
|
543
|
+
} catch {
|
|
544
|
+
await new Promise((resolveCap) => setTimeout(resolveCap, Math.max(0, deadline - Date.now())));
|
|
545
|
+
} finally {
|
|
546
|
+
clearTimeout(cap);
|
|
547
|
+
ready.catch(() => {
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
async function installPageFunctionGuard(page) {
|
|
552
|
+
await page.evaluateOnNewDocument("self.__name = self.__name || ((fn) => fn);");
|
|
553
|
+
}
|
|
554
|
+
async function openSettledCompositionPage(html, url, options) {
|
|
555
|
+
const viewport = resolveCompositionViewportFromHtml(html);
|
|
556
|
+
const requiresWebGpu = compositionRequiresWebGpu(html);
|
|
557
|
+
const answer = (await import("./staticProjectServer-DFVZOUGI.js")).inProcessAnswer(url);
|
|
558
|
+
const noListen = answer !== void 0;
|
|
559
|
+
let chromeBrowser;
|
|
560
|
+
try {
|
|
561
|
+
const launched = await options.prelaunched?.take(launchKey(html, noListen, options)) ?? await launchCompositionBrowser(html, noListen, options);
|
|
562
|
+
chromeBrowser = launched.browser;
|
|
563
|
+
const softwareWebGpu = launched.softwareWebGpu;
|
|
564
|
+
options.onBrowser?.(chromeBrowser);
|
|
565
|
+
options.onBrowserReady?.();
|
|
566
|
+
const page = await chromeBrowser.newPage();
|
|
567
|
+
await installPageFunctionGuard(page);
|
|
568
|
+
const { installMediaRenderIdBridge } = await import("./src-Z5PGEMXB.js");
|
|
569
|
+
await installMediaRenderIdBridge(page);
|
|
570
|
+
await page.setViewport(viewport);
|
|
571
|
+
if (answer) await answerPageInProcess(page, url, answer);
|
|
572
|
+
await options.beforeNavigate?.(page);
|
|
573
|
+
await gotoWhenSent(page, url, pageNavigationTimeoutMs(options.navigationTimeoutMs));
|
|
574
|
+
await assertWebGpuAdapterAvailable(page, requiresWebGpu, softwareWebGpu);
|
|
575
|
+
options.onLoaded?.();
|
|
576
|
+
const renderReadyTimedOut = !await waitForCompositionSettle(page, options);
|
|
577
|
+
return { browser: chromeBrowser, page, renderReadyTimedOut };
|
|
578
|
+
} catch (err) {
|
|
579
|
+
return rethrowAfterBrowserCleanup(chromeBrowser, err);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
async function launchCompositionBrowser(html, noListen, options) {
|
|
583
|
+
const viewport = resolveCompositionViewportFromHtml(html);
|
|
584
|
+
const { ensureBrowser, findSystemBrowser } = await import("./manager-CD6LJ7ZN.js");
|
|
585
|
+
const browser = await ensureBrowser({ signal: options.signal });
|
|
586
|
+
const puppeteer = await import("puppeteer-core");
|
|
587
|
+
const { buildChromeArgs } = await import("./src-Z5PGEMXB.js");
|
|
588
|
+
const requestedGpuMode = options.browserGpuMode ?? resolveCliChromeGpuMode();
|
|
589
|
+
const requiresWebGpu = compositionRequiresWebGpu(html);
|
|
590
|
+
let softwareWebGpu = false;
|
|
591
|
+
const launch = async (executablePath) => {
|
|
592
|
+
options.signal?.throwIfAborted();
|
|
593
|
+
const resolvedGpuMode = await resolveManagedGpuMode(requestedGpuMode, executablePath, {
|
|
594
|
+
signal: options.signal,
|
|
595
|
+
onBrowser: options.onBrowser,
|
|
596
|
+
noListen
|
|
597
|
+
});
|
|
598
|
+
options.signal?.throwIfAborted();
|
|
599
|
+
const webGpu = resolveLocalWebGpu(resolvedGpuMode, requiresWebGpu);
|
|
600
|
+
softwareWebGpu = webGpu.softwareWebGpu;
|
|
601
|
+
const args = buildChromeArgs(
|
|
602
|
+
{ ...viewport, captureMode: "screenshot", requiresWebGpu },
|
|
603
|
+
webGpu.gpuConfig
|
|
604
|
+
);
|
|
605
|
+
return launchManagedBrowser(puppeteer.default, {
|
|
606
|
+
headless: true,
|
|
607
|
+
signal: options.signal,
|
|
608
|
+
executablePath,
|
|
609
|
+
...noListen ? oneProcessOverPipe({ args }) : { args }
|
|
610
|
+
});
|
|
611
|
+
};
|
|
612
|
+
let chromeBrowser;
|
|
613
|
+
try {
|
|
614
|
+
chromeBrowser = await launch(browser.executablePath);
|
|
615
|
+
} catch (launchError) {
|
|
616
|
+
const message = normalizeErrorMessage(launchError);
|
|
617
|
+
const remediation = windowsChromeCrashRemediation(message);
|
|
618
|
+
if (!remediation) throw launchError;
|
|
619
|
+
const systemBrowser = browser.source === "cache" || browser.source === "download" ? findSystemBrowser() : void 0;
|
|
620
|
+
if (!systemBrowser || systemBrowser.executablePath === browser.executablePath) {
|
|
621
|
+
throw new Error(`${message}
|
|
622
|
+
|
|
623
|
+
${remediation}`, { cause: launchError });
|
|
624
|
+
}
|
|
625
|
+
console.warn(
|
|
626
|
+
`[hyperframes] Managed chrome-headless-shell crashed at launch; retrying once with system Chrome at ${systemBrowser.executablePath}.`
|
|
627
|
+
);
|
|
628
|
+
try {
|
|
629
|
+
chromeBrowser = await launch(systemBrowser.executablePath);
|
|
630
|
+
} catch (fallbackError) {
|
|
631
|
+
throw new Error(
|
|
632
|
+
`System Chrome fallback also failed: ${normalizeErrorMessage(fallbackError)}
|
|
633
|
+
|
|
634
|
+
${remediation}`,
|
|
635
|
+
{ cause: fallbackError }
|
|
636
|
+
);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
return { browser: chromeBrowser, softwareWebGpu };
|
|
640
|
+
}
|
|
641
|
+
function seekInPage(t, fallbackToBridgeAndTimelines, exactTime, skipDraws) {
|
|
642
|
+
const getProperty = (target, key) => {
|
|
643
|
+
if ((typeof target !== "object" || target === null) && typeof target !== "function") {
|
|
644
|
+
return void 0;
|
|
645
|
+
}
|
|
646
|
+
return Reflect.get(target, key);
|
|
647
|
+
};
|
|
648
|
+
const call = (fn, receiver, args) => {
|
|
649
|
+
if (typeof fn !== "function") return false;
|
|
650
|
+
Reflect.apply(fn, receiver, args);
|
|
651
|
+
return true;
|
|
652
|
+
};
|
|
653
|
+
const player = Reflect.get(window, "__player");
|
|
654
|
+
if (!player && !fallbackToBridgeAndTimelines) return;
|
|
655
|
+
const safe = Math.max(0, Number(t) || 0);
|
|
656
|
+
const renderSeek = getProperty(player, "renderSeek");
|
|
657
|
+
const playerSeek = getProperty(player, "seek");
|
|
658
|
+
const hf = Reflect.get(window, "__hf");
|
|
659
|
+
const bridgeSeek = getProperty(hf, "seek");
|
|
660
|
+
const gsap = Reflect.get(window, "gsap");
|
|
661
|
+
const ticker = getProperty(gsap, "ticker");
|
|
662
|
+
const seekTo = (time) => {
|
|
663
|
+
if (call(renderSeek, player, exactTime ? [time, { exact: true }] : [time])) {
|
|
664
|
+
} else if (fallbackToBridgeAndTimelines && call(bridgeSeek, hf, [time])) {
|
|
665
|
+
} else if (call(playerSeek, player, [time])) {
|
|
666
|
+
} else if (fallbackToBridgeAndTimelines) {
|
|
667
|
+
const timelines = Reflect.get(window, "__timelines");
|
|
668
|
+
if (typeof timelines === "object" && timelines !== null) {
|
|
669
|
+
for (const key of Object.keys(timelines)) {
|
|
670
|
+
const timeline = Reflect.get(timelines, key);
|
|
671
|
+
call(getProperty(timeline, "pause"), timeline, []);
|
|
672
|
+
call(getProperty(timeline, "seek"), timeline, [time]);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
call(getProperty(ticker, "tick"), ticker, []);
|
|
677
|
+
};
|
|
678
|
+
const gateSlot = /* @__PURE__ */ Symbol.for("hyperframes.webglDrawGate");
|
|
679
|
+
let gate = Reflect.get(window, gateSlot);
|
|
680
|
+
if (skipDraws && !gate) {
|
|
681
|
+
const installed = { skip: false, skipped: false };
|
|
682
|
+
for (const name of ["WebGLRenderingContext", "WebGL2RenderingContext"]) {
|
|
683
|
+
const proto = getProperty(Reflect.get(window, name), "prototype");
|
|
684
|
+
if (!proto) continue;
|
|
685
|
+
for (const method of [
|
|
686
|
+
"clear",
|
|
687
|
+
"drawArrays",
|
|
688
|
+
"drawElements",
|
|
689
|
+
"drawArraysInstanced",
|
|
690
|
+
"drawElementsInstanced",
|
|
691
|
+
"drawRangeElements",
|
|
692
|
+
"blitFramebuffer"
|
|
693
|
+
]) {
|
|
694
|
+
const draw = getProperty(proto, method);
|
|
695
|
+
if (typeof draw !== "function") continue;
|
|
696
|
+
Reflect.set(proto, method, function(...args) {
|
|
697
|
+
if (!installed.skip) return Reflect.apply(draw, this, args);
|
|
698
|
+
installed.skipped = true;
|
|
699
|
+
return void 0;
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
Reflect.set(window, gateSlot, installed);
|
|
704
|
+
gate = installed;
|
|
705
|
+
}
|
|
706
|
+
const seekWithoutDraws = (time) => {
|
|
707
|
+
if (!gate) return seekTo(time);
|
|
708
|
+
gate.skip = true;
|
|
709
|
+
try {
|
|
710
|
+
seekTo(time);
|
|
711
|
+
} finally {
|
|
712
|
+
gate.skip = false;
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
if (skipDraws) {
|
|
716
|
+
seekWithoutDraws(safe);
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
if (gate?.skipped) {
|
|
720
|
+
seekWithoutDraws(safe >= 1e-3 ? safe - 1e-3 : safe + 1e-3);
|
|
721
|
+
gate.skipped = false;
|
|
722
|
+
}
|
|
723
|
+
seekTo(safe);
|
|
724
|
+
}
|
|
725
|
+
async function seekCompositionTimeline(page, timeSeconds, options = {}) {
|
|
726
|
+
await seekCompositionTimelineOnly(page, timeSeconds, options);
|
|
727
|
+
await settleCompositionSeek(page, options);
|
|
728
|
+
}
|
|
729
|
+
async function seekCompositionTimelineOnly(page, timeSeconds, options = {}) {
|
|
730
|
+
if (options.waitForPreferredSeekTargetMs !== void 0) {
|
|
731
|
+
await waitForPreferredSeekTarget(page, options.waitForPreferredSeekTargetMs);
|
|
732
|
+
}
|
|
733
|
+
await page.evaluate(
|
|
734
|
+
seekInPage,
|
|
735
|
+
timeSeconds,
|
|
736
|
+
options.fallbackToBridgeAndTimelines === true,
|
|
737
|
+
options.exactTime === true,
|
|
738
|
+
options.skipWebglDraws === true
|
|
739
|
+
);
|
|
740
|
+
}
|
|
741
|
+
async function settleCompositionSeek(page, options = {}) {
|
|
742
|
+
await page.evaluate(
|
|
743
|
+
async (barrier) => {
|
|
744
|
+
const waitForCompletion = Reflect.get(window, "__hfWaitForSeekCompletion");
|
|
745
|
+
if (typeof waitForCompletion === "function") {
|
|
746
|
+
await Reflect.apply(waitForCompletion, window, [barrier]);
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
{ videoFrames: options.waitForVideoFrames !== false }
|
|
750
|
+
);
|
|
751
|
+
const animationFrameSettle = options.animationFrameSettle ?? "race";
|
|
752
|
+
const waitForFontsMs = options.waitForFontsMs ?? DEFAULT_POST_SEEK_FONT_WAIT_MS;
|
|
753
|
+
if (animationFrameSettle === "race") {
|
|
754
|
+
await page.evaluate(`new Promise(function(r) {
|
|
755
|
+
var settled = false;
|
|
756
|
+
function finish() { if (settled) return; settled = true; r(); }
|
|
757
|
+
window.setTimeout(finish, 100);
|
|
758
|
+
requestAnimationFrame(function() { requestAnimationFrame(finish); });
|
|
759
|
+
})`);
|
|
760
|
+
} else if (animationFrameSettle === "double" && !(waitForFontsMs > 0)) {
|
|
761
|
+
await page.evaluate(
|
|
762
|
+
() => new Promise(
|
|
763
|
+
(resolveFrame) => requestAnimationFrame(() => requestAnimationFrame(() => resolveFrame()))
|
|
764
|
+
)
|
|
765
|
+
);
|
|
766
|
+
}
|
|
767
|
+
if (waitForFontsMs > 0) {
|
|
768
|
+
await waitForCompositionFonts(page, waitForFontsMs, animationFrameSettle === "double" ? 2 : 1);
|
|
769
|
+
}
|
|
770
|
+
const images = options.waitForImagesMs ? await waitForCompositionImages(page, options.waitForImagesMs) : ALL_IMAGES_SETTLED;
|
|
771
|
+
if (options.settleMs !== void 0) {
|
|
772
|
+
const settleMs = Math.max(0, options.settleMs);
|
|
773
|
+
await new Promise((resolveSettle) => setTimeout(resolveSettle, settleMs));
|
|
774
|
+
}
|
|
775
|
+
return images;
|
|
776
|
+
}
|
|
777
|
+
async function waitForPreferredSeekTarget(page, timeoutMs = PREFERRED_SEEK_TARGET_WAIT_MS) {
|
|
778
|
+
if (!page.waitForFunction) return;
|
|
779
|
+
try {
|
|
780
|
+
await page.waitForFunction(
|
|
781
|
+
() => {
|
|
782
|
+
const player = Reflect.get(window, "__player");
|
|
783
|
+
const hf = Reflect.get(window, "__hf");
|
|
784
|
+
const renderSeek = typeof player === "object" && player !== null ? Reflect.get(player, "renderSeek") : void 0;
|
|
785
|
+
const bridgeSeek = typeof hf === "object" && hf !== null ? Reflect.get(hf, "seek") : void 0;
|
|
786
|
+
return typeof renderSeek === "function" || typeof bridgeSeek === "function";
|
|
787
|
+
},
|
|
788
|
+
{ timeout: timeoutMs }
|
|
789
|
+
);
|
|
790
|
+
} catch {
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
async function waitForCompositionImages(page, timeoutMs) {
|
|
794
|
+
const unsettled = await page.evaluate(
|
|
795
|
+
// fallow-ignore-next-line complexity
|
|
796
|
+
async (ms) => {
|
|
797
|
+
const layers = /* @__PURE__ */ new Map();
|
|
798
|
+
const add = (src, image) => {
|
|
799
|
+
if (src && !layers.has(src)) layers.set(src, image ?? Object.assign(new Image(), { src }));
|
|
800
|
+
};
|
|
801
|
+
const absolute = (href) => new URL(href, document.baseURI).href;
|
|
802
|
+
for (const element of document.querySelectorAll("*")) {
|
|
803
|
+
const style = getComputedStyle(element);
|
|
804
|
+
if (style.display === "none" || style.visibility === "hidden") continue;
|
|
805
|
+
if (element instanceof HTMLImageElement) add(element.currentSrc || element.src, element);
|
|
806
|
+
if (element instanceof SVGImageElement && element.href.baseVal) {
|
|
807
|
+
add(absolute(element.href.baseVal));
|
|
808
|
+
}
|
|
809
|
+
for (const match of style.backgroundImage.matchAll(
|
|
810
|
+
/url\(\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\s*\)/g
|
|
811
|
+
)) {
|
|
812
|
+
const href = match[1] ?? match[2] ?? match[3];
|
|
813
|
+
if (href) add(absolute(href));
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
const state = /* @__PURE__ */ new Map();
|
|
817
|
+
const decodes = [...layers].map(([src, image]) => {
|
|
818
|
+
state.set(src, "pending");
|
|
819
|
+
return image.decode().then(
|
|
820
|
+
() => void state.set(src, "ready"),
|
|
821
|
+
() => void state.set(src, "failed")
|
|
822
|
+
);
|
|
823
|
+
});
|
|
824
|
+
let timer;
|
|
825
|
+
await Promise.race([
|
|
826
|
+
Promise.all(decodes),
|
|
827
|
+
new Promise((resolveWait) => {
|
|
828
|
+
timer = setTimeout(resolveWait, ms);
|
|
829
|
+
})
|
|
830
|
+
]);
|
|
831
|
+
clearTimeout(timer);
|
|
832
|
+
const named = (want) => [...state].filter(([, value]) => value === want).map(([src]) => src.startsWith("data:") ? `${src.slice(0, 40)}...` : src);
|
|
833
|
+
return { pending: named("pending"), failed: named("failed") };
|
|
834
|
+
},
|
|
835
|
+
timeoutMs
|
|
836
|
+
);
|
|
837
|
+
return unsettled;
|
|
838
|
+
}
|
|
839
|
+
async function waitForCompositionFonts(page, timeoutMs, frames = 1) {
|
|
840
|
+
await page.evaluate(
|
|
841
|
+
({ ms, frames: count }) => {
|
|
842
|
+
const fonts = Reflect.get(document, "fonts");
|
|
843
|
+
void document.body?.offsetHeight;
|
|
844
|
+
const afterFrames = (left, then) => {
|
|
845
|
+
requestAnimationFrame(() => left > 1 ? afterFrames(left - 1, then) : then());
|
|
846
|
+
};
|
|
847
|
+
return new Promise((resolveWait) => {
|
|
848
|
+
const deadline = setTimeout(resolveWait, ms);
|
|
849
|
+
afterFrames(count, () => {
|
|
850
|
+
const status = fonts ? Reflect.get(fonts, "status") : void 0;
|
|
851
|
+
const ready = fonts ? Reflect.get(fonts, "ready") : void 0;
|
|
852
|
+
if (status !== "loading" || !ready) {
|
|
853
|
+
clearTimeout(deadline);
|
|
854
|
+
resolveWait();
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
Promise.resolve(ready).then(() => {
|
|
858
|
+
clearTimeout(deadline);
|
|
859
|
+
resolveWait();
|
|
860
|
+
});
|
|
861
|
+
});
|
|
862
|
+
});
|
|
863
|
+
},
|
|
864
|
+
{ ms: timeoutMs, frames }
|
|
865
|
+
).catch(() => {
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
var ZOOM_REGION_PATTERN = /^-?\d+(?:\.\d+)?(?:,-?\d+(?:\.\d+)?){3}$/;
|
|
869
|
+
var DEFAULT_ZOOM_PADDING_PX = 24;
|
|
870
|
+
var DEFAULT_ZOOM_SCALE = 3;
|
|
871
|
+
function parseZoomTarget(value) {
|
|
872
|
+
const trimmed = value.trim();
|
|
873
|
+
if (ZOOM_REGION_PATTERN.test(trimmed)) {
|
|
874
|
+
const [x, y, width, height] = trimmed.split(",").map(Number);
|
|
875
|
+
return { kind: "region", region: { x, y, width, height } };
|
|
876
|
+
}
|
|
877
|
+
return { kind: "selector", selector: trimmed };
|
|
878
|
+
}
|
|
879
|
+
function clampCropRegion(region, canvas) {
|
|
880
|
+
const x = Math.max(0, Math.min(region.x, canvas.width));
|
|
881
|
+
const y = Math.max(0, Math.min(region.y, canvas.height));
|
|
882
|
+
const x2 = Math.max(x + 1, Math.min(region.x + region.width, canvas.width));
|
|
883
|
+
const y2 = Math.max(y + 1, Math.min(region.y + region.height, canvas.height));
|
|
884
|
+
return { x, y, width: x2 - x, height: y2 - y };
|
|
885
|
+
}
|
|
886
|
+
function padCropRegion(region, canvas, paddingPx) {
|
|
887
|
+
return clampCropRegion(
|
|
888
|
+
{
|
|
889
|
+
x: region.x - paddingPx,
|
|
890
|
+
y: region.y - paddingPx,
|
|
891
|
+
width: region.width + paddingPx * 2,
|
|
892
|
+
height: region.height + paddingPx * 2
|
|
893
|
+
},
|
|
894
|
+
canvas
|
|
895
|
+
);
|
|
896
|
+
}
|
|
897
|
+
var MIN_CROP_REGION_PX = 8;
|
|
898
|
+
async function resolveCropRegion(page, target, canvas, paddingPx = DEFAULT_ZOOM_PADDING_PX) {
|
|
899
|
+
if (target.kind === "region") return clampCropRegion(target.region, canvas);
|
|
900
|
+
const bbox = await page.evaluate((selector) => {
|
|
901
|
+
const element = document.querySelector(selector);
|
|
902
|
+
if (!element) return null;
|
|
903
|
+
const rect = element.getBoundingClientRect();
|
|
904
|
+
return { x: rect.x, y: rect.y, width: rect.width, height: rect.height };
|
|
905
|
+
}, target.selector);
|
|
906
|
+
if (!bbox) throw new Error(`--zoom selector matched no element: ${target.selector}`);
|
|
907
|
+
const region = padCropRegion(bbox, canvas, paddingPx);
|
|
908
|
+
if (region.width < MIN_CROP_REGION_PX || region.height < MIN_CROP_REGION_PX) return null;
|
|
909
|
+
return region;
|
|
910
|
+
}
|
|
911
|
+
async function captureRegionCrop(page, region, scale) {
|
|
912
|
+
const original = page.viewport();
|
|
913
|
+
if (original) await page.setViewport({ ...original, deviceScaleFactor: scale });
|
|
914
|
+
try {
|
|
915
|
+
const shot = await page.screenshot({ clip: region, type: "png", omitBackground: true });
|
|
916
|
+
return Buffer.isBuffer(shot) ? shot : Buffer.from(shot);
|
|
917
|
+
} finally {
|
|
918
|
+
if (original) await page.setViewport(original);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
async function runFfmpegOnce(ffmpegPath, args, timeoutMs) {
|
|
922
|
+
return await new Promise((resolvePromise) => {
|
|
923
|
+
const ff = spawn2(ffmpegPath, args, { windowsHide: true });
|
|
924
|
+
let stderr = "";
|
|
925
|
+
let timedOut = false;
|
|
926
|
+
const timer = setTimeout(() => {
|
|
927
|
+
timedOut = true;
|
|
928
|
+
ff.kill("SIGTERM");
|
|
929
|
+
}, timeoutMs);
|
|
930
|
+
ff.stderr.on("data", (data) => {
|
|
931
|
+
stderr += data.toString();
|
|
932
|
+
});
|
|
933
|
+
ff.on("close", (code) => {
|
|
934
|
+
clearTimeout(timer);
|
|
935
|
+
resolvePromise({ code, stderr, timedOut });
|
|
936
|
+
});
|
|
937
|
+
ff.on("error", () => {
|
|
938
|
+
clearTimeout(timer);
|
|
939
|
+
resolvePromise({ code: null, stderr: "ffmpeg spawn failed", timedOut });
|
|
940
|
+
});
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
async function answerPageInProcess(page, url, answer) {
|
|
944
|
+
const origin = new URL(url).origin;
|
|
945
|
+
await page.setRequestInterception(true);
|
|
946
|
+
page.on("request", (request) => {
|
|
947
|
+
if (request.isInterceptResolutionHandled()) return;
|
|
948
|
+
const target = new URL(request.url());
|
|
949
|
+
if (target.origin !== origin) return void request.continue().catch(() => {
|
|
950
|
+
});
|
|
951
|
+
answer({
|
|
952
|
+
method: request.method(),
|
|
953
|
+
path: target.pathname + target.search,
|
|
954
|
+
headers: request.headers()
|
|
955
|
+
}).then((response) => request.respond(response)).catch(() => request.abort("failed").catch(() => {
|
|
956
|
+
}));
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
export {
|
|
961
|
+
BrowserCleanupError,
|
|
962
|
+
resolveManagedGpuMode,
|
|
963
|
+
launchManagedBrowser,
|
|
964
|
+
closeManagedBrowser,
|
|
965
|
+
withRemainingBudget,
|
|
966
|
+
gotoWhenSent,
|
|
967
|
+
AUDIT_SEEK_OPTIONS,
|
|
968
|
+
SCREENSHOT_IMAGE_WAIT_MS,
|
|
969
|
+
SCREENSHOT_SEEK_OPTIONS,
|
|
970
|
+
DENSE_GEOMETRY_SEEK_OPTIONS,
|
|
971
|
+
prelaunchCompositionBrowser,
|
|
972
|
+
resolveCliChromeGpuMode,
|
|
973
|
+
waitForRuntimeReady,
|
|
974
|
+
installPageFunctionGuard,
|
|
975
|
+
openSettledCompositionPage,
|
|
976
|
+
seekInPage,
|
|
977
|
+
seekCompositionTimeline,
|
|
978
|
+
seekCompositionTimelineOnly,
|
|
979
|
+
settleCompositionSeek,
|
|
980
|
+
waitForPreferredSeekTarget,
|
|
981
|
+
waitForCompositionFonts,
|
|
982
|
+
DEFAULT_ZOOM_PADDING_PX,
|
|
983
|
+
DEFAULT_ZOOM_SCALE,
|
|
984
|
+
parseZoomTarget,
|
|
985
|
+
clampCropRegion,
|
|
986
|
+
padCropRegion,
|
|
987
|
+
resolveCropRegion,
|
|
988
|
+
captureRegionCrop,
|
|
989
|
+
runFfmpegOnce
|
|
990
|
+
};
|