hyperframes 0.8.205 → 0.8.206
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/dist/{add-BA4AU262.js → add-FFMNAJXJ.js} +12 -12
- package/dist/{animatedGifPrep-UNUCFGLQ.js → animatedGifPrep-BIIIIVWL.js} +16 -10
- package/dist/api.js +18 -18
- package/dist/{asset-KCDVTNC3.js → asset-IPUHGZSL.js} +2 -2
- package/dist/{assetCataloger-5FCVQ3N6.js → assetCataloger-M5FWXLAJ.js} +8 -8
- package/dist/{audio-KDBPEHRS.js → audio-VYWWM4DB.js} +15 -15
- package/dist/{auth-IMPBZZXJ.js → auth-GZQZCUPL.js} +1 -1
- package/dist/{autoUpdate-YE2RKCAG.js → autoUpdate-GJUDDLLO.js} +2 -2
- package/dist/{backgroundChecks-OWY2UFSR.js → backgroundChecks-BTMSW34Z.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-AN4HWKET.js → batchRender-LI2BJRGO.js} +4 -4
- package/dist/{beats-VTQJ4JH6.js → beats-H73CSYT4.js} +11 -11
- package/dist/{benchmark-PBEWHJ5K.js → benchmark-XT3A5REC.js} +9 -9
- package/dist/{browser-E7ANEHNU.js → browser-VIOK66YK.js} +5 -5
- package/dist/{bundleWithLocalizedFonts-I3BWMRSP.js → bundleWithLocalizedFonts-PFRVWYOO.js} +2 -2
- package/dist/{capture-MP7R72WU.js → capture-252WNPCD.js} +2 -2
- package/dist/{capture-XODFC4S4.js → capture-KKD5GMAF.js} +20 -20
- package/dist/{captureCompositionFrame-2OYGVDI3.js → captureCompositionFrame-YLYVGNN2.js} +13 -13
- package/dist/{catalog-ORVCCEQR.js → catalog-6IJGNN3T.js} +12 -12
- package/dist/{catch-up-SYAQOXTT.js → catch-up-BFW7Z35W.js} +4 -4
- package/dist/{check-6SQR6SSA.js → check-XUWBZASR.js} +39 -37
- package/dist/checkAudio-2NRR3VHQ.js +201 -0
- package/dist/{checkBrowser-HOTD3CDE.js → checkBrowser-JW74KWTF.js} +32 -31
- package/dist/{chunk-6NC4KBS2.js → chunk-2RT7MXFL.js} +1 -1
- package/dist/{chunk-JFNB4CMI.js → chunk-2S263R6D.js} +19 -7
- package/dist/{chunk-3N4T6I3O.js → chunk-36QE3P6B.js} +1 -1
- package/dist/{chunk-LSQM3NBR.js → chunk-3B2DBUQX.js} +1 -1
- package/dist/{chunk-H4MSJ2NZ.js → chunk-3CS6QYL7.js} +5 -5
- package/dist/{chunk-IKYXXIMP.js → chunk-3R6SXPHD.js} +2 -2
- package/dist/{chunk-RWOWD3PW.js → chunk-42KN6I6A.js} +2 -2
- package/dist/{chunk-75WNFDRU.js → chunk-4CY5RXXC.js} +1 -1
- package/dist/{chunk-LQUMMPGK.js → chunk-4DGLKB2H.js} +1 -1
- package/dist/{chunk-DQBY7FRR.js → chunk-543U46OR.js} +4 -1
- package/dist/{chunk-4UIEQIF4.js → chunk-5QKJPCQ4.js} +2 -2
- package/dist/{chunk-AECL3B23.js → chunk-63DGZRZP.js} +1 -1
- package/dist/{chunk-RQDVTUVD.js → chunk-6ZFDNEMY.js} +14 -14
- package/dist/{chunk-NF6KI46X.js → chunk-7SXL476O.js} +14 -12
- package/dist/{chunk-N7VQD4WB.js → chunk-AAX2A7LQ.js} +1 -1
- package/dist/{chunk-2FEOM3ZT.js → chunk-AEC4T4IF.js} +4 -4
- package/dist/{chunk-TZ7MTRVJ.js → chunk-AJSU6KGS.js} +13 -13
- package/dist/{chunk-MVXOY5RC.js → chunk-AXEEZKIL.js} +2 -2
- package/dist/{chunk-TOEIJ4WF.js → chunk-BBUK6A7Q.js} +5 -5
- package/dist/{chunk-CU76YDPX.js → chunk-CIHW6VM2.js} +1 -1
- package/dist/{chunk-MASFRPCB.js → chunk-CMDVJP4T.js} +10 -10
- package/dist/{chunk-BZ727KLT.js → chunk-CNVHMLPI.js} +1 -1
- package/dist/{chunk-BA7MQJXG.js → chunk-CPSGXAYD.js} +3 -3
- package/dist/{chunk-L6N2TLXR.js → chunk-CZYS6UKP.js} +83 -78
- package/dist/{chunk-EXRHI43B.js → chunk-DEVZJ4AL.js} +10 -9
- package/dist/{chunk-A42PDANH.js → chunk-DZG565OO.js} +1 -1
- package/dist/{chunk-KAIQPYCM.js → chunk-E2ZZSDDQ.js} +2 -2
- package/dist/{chunk-7V7OUKTU.js → chunk-FJW757TF.js} +1 -1
- package/dist/{chunk-I7IXUCKL.js → chunk-FMWACL3L.js} +1 -1
- package/dist/{chunk-GLBEBBS2.js → chunk-FNNGQ3DB.js} +2 -2
- package/dist/{chunk-GBQCTZON.js → chunk-FULMZCDW.js} +13 -43
- package/dist/chunk-G6QDFWDN.js +355 -0
- package/dist/{chunk-WB55EQNJ.js → chunk-G6W55MTX.js} +1 -1
- package/dist/{chunk-HADQPG7O.js → chunk-GAV56VJL.js} +2 -2
- package/dist/{chunk-FNBEYIZH.js → chunk-H4JO7VSI.js} +7 -6
- package/dist/{chunk-ZB6SCA4J.js → chunk-HEP5XMXV.js} +1 -1
- package/dist/{chunk-ZSUWGNIT.js → chunk-HJAJ6W4V.js} +2 -2
- package/dist/chunk-KLIPVNCO.js +4824 -0
- package/dist/{chunk-AECSY5LT.js → chunk-L5MFWGGU.js} +55 -65
- package/dist/{chunk-BHOGXIBO.js → chunk-MFHYBSJC.js} +57 -825
- package/dist/{chunk-LFGJWOVA.js → chunk-MNNK7RV5.js} +11 -8
- package/dist/{chunk-EUFBE5BW.js → chunk-N7ZMDVAK.js} +1 -1
- package/dist/{chunk-HQ3CFNHL.js → chunk-NNLQTG3M.js} +1 -1
- package/dist/{chunk-6YYFNGCS.js → chunk-NVLPW3DG.js} +7 -4
- package/dist/{chunk-SVVAUJPL.js → chunk-OFRRUYBA.js} +1 -1
- package/dist/{chunk-5F6B6KMK.js → chunk-OZUAVHFE.js} +18 -3
- package/dist/{chunk-BTYT3RT3.js → chunk-PNKLOMHQ.js} +2 -2
- package/dist/{chunk-XNAIYEKD.js → chunk-PQYWYBEQ.js} +1 -1
- package/dist/{chunk-TGS33LDU.js → chunk-QL4ZYSIB.js} +3 -3
- package/dist/{chunk-KBZSMKKD.js → chunk-QVTCXN42.js} +3 -3
- package/dist/{chunk-T2UR3T4L.js → chunk-RDDVQSNQ.js} +99 -22
- package/dist/{chunk-J2E3VVOS.js → chunk-RW4DMP2Y.js} +4 -4
- package/dist/{chunk-CUGADCIV.js → chunk-SFYLZX5C.js} +1 -1
- package/dist/{chunk-4RPCYGZG.js → chunk-T6SD37JZ.js} +1 -1
- package/dist/chunk-TQBQYO4L.js +55 -0
- package/dist/{chunk-26OI2B2X.js → chunk-TSJVPPXT.js} +1 -1
- package/dist/{chunk-C4LV6L4Q.js → chunk-UMUVGNOH.js} +3 -3
- package/dist/{chunk-GSTFETKE.js → chunk-VDVVQNTK.js} +2 -2
- package/dist/{chunk-G445Y3YG.js → chunk-VEA7Z4PZ.js} +2 -2
- package/dist/{chunk-32R2AFZ3.js → chunk-VHVSBOZH.js} +3 -3
- package/dist/{chunk-6GAYBX5C.js → chunk-VW2LVMKB.js} +19 -9
- package/dist/{chunk-UR6BAPOD.js → chunk-WHD5IAHI.js} +1 -1
- package/dist/{chunk-V2XXV2EH.js → chunk-WYB3VKLK.js} +2 -2
- package/dist/{chunk-57I5KNTL.js → chunk-X5HHHFTX.js} +3 -3
- package/dist/{chunk-V4K4BSCM.js → chunk-X7A7C4JS.js} +54 -2
- package/dist/chunk-X7RXXBYM.js +29 -0
- package/dist/{chunk-OB7QARSN.js → chunk-XOM3XTJ4.js} +1 -1
- package/dist/{chunk-UEOGIZ3Q.js → chunk-Z3XXLTVB.js} +2 -2
- package/dist/{chunk-ERUINDRT.js → chunk-ZF3R2IPC.js} +184 -183
- package/dist/{chunk-5PVPGWMH.js → chunk-ZNAOBFU5.js} +1 -1
- package/dist/{chunk-AII6P2TC.js → chunk-ZTEKVSZ6.js} +1 -1
- package/dist/{clean-BW7NHQS5.js → clean-N5VSKUVS.js} +19 -19
- package/dist/cli.js +54 -54
- package/dist/{cloud-TZVXTWZO.js → cloud-74NF5FXC.js} +4 -4
- package/dist/{cloudrun-KRIETALO.js → cloudrun-7UOH335V.js} +6 -6
- package/dist/{compare-WYWHJ4CR.js → compare-AY2LS2TZ.js} +32 -32
- package/dist/{compiler-ANIPXLJ7.js → compiler-4MHMC777.js} +11 -11
- package/dist/{component-CY7DCX56.js → component-CFWQOAZI.js} +3 -3
- package/dist/{compositions-5YEB24E3.js → compositions-DXLJTDSP.js} +14 -14
- package/dist/{delete-6642PDON.js → delete-GB4MS7LM.js} +2 -2
- package/dist/{deploy-NZP6TZLS.js → deploy-NXD3Q3KD.js} +4 -4
- package/dist/{deterministicFonts-HQYCUUAL.js → deterministicFonts-775YXAQ2.js} +2 -2
- package/dist/{dist-DGFC75NC.js → dist-3ZJMZU75.js} +11 -3
- package/dist/{dist-V2BGP46S.js → dist-ZY6IFESG.js} +2 -2
- package/dist/{doctor-ZW4A2FS3.js → doctor-CVY2XXKS.js} +14 -14
- package/dist/{events-XRCHY2F6.js → events-RYQYEWBV.js} +2 -2
- package/dist/{events-NJU4VFDA.js → events-T3CLIYRG.js} +3 -3
- package/dist/{feedback-NQLSZMES.js → feedback-K5ZMMLTA.js} +8 -8
- package/dist/{ffmpeg-RYDQLG3G.js → ffmpeg-UNDAJ2IC.js} +9 -9
- package/dist/{figma-TJAMP2CI.js → figma-MYYCX635.js} +3 -3
- package/dist/fontLocalizeCli.js +12 -11
- package/dist/{get-RRZ3O26X.js → get-JVIDYMVP.js} +2 -2
- package/dist/{gpuPolicy-4WLHUUS3.js → gpuPolicy-KEX7GDRJ.js} +8 -8
- package/dist/{grade-compare-P7PE3NAA.js → grade-compare-QEF6VASJ.js} +30 -30
- package/dist/{gsapParser-IEUSLYDJ.js → gsapParser-3H7ON3DO.js} +1 -1
- package/dist/heifImagePrep-A3ZPVQGU.js +53 -0
- package/dist/{help-6RELRVIW.js → help-XPPSLIRY.js} +1 -1
- package/dist/{history-GIIDYND3.js → history-OFOPRD27.js} +7 -7
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +66 -64
- package/dist/hyperframes-player.global.js +3 -3
- package/dist/hyperframes-slideshow.global.js +16 -16
- package/dist/{info-LBUA2DXE.js → info-7RF6FQX5.js} +8 -8
- package/dist/{init-QUPXBONY.js → init-NTIXWA3D.js} +30 -30
- package/dist/{inspect-CL42DJZ4.js → inspect-MYMCV5E7.js} +30 -29
- package/dist/inspection.js +4 -4
- package/dist/{installer-VR7XDLR3.js → installer-PYJIJ3PJ.js} +5 -5
- package/dist/{keyframes-LELLROMA.js → keyframes-UJ52PYE4.js} +6 -6
- package/dist/{lambda-I6KFXWOO.js → lambda-SBNUYEQE.js} +8 -8
- package/dist/{layout-NR6SNRZE.js → layout-IOMCOABO.js} +30 -29
- package/dist/{lint-DYEMSEQR.js → lint-AQWHHMPS.js} +8 -8
- package/dist/{lintProject-EA4NPL2X.js → lintProject-5A4SCW3S.js} +2 -2
- package/dist/{list-RDURYO5U.js → list-WKAJ5SP3.js} +2 -2
- package/dist/{login-VKLET5OL.js → login-3ZDK5JOA.js} +4 -4
- package/dist/{manager-7TSUZKXU.js → manager-F2YREC5X.js} +2 -2
- package/dist/{manager-IYT3THJN.js → manager-QYFYWZOK.js} +10 -10
- package/dist/{media-treatment-I4AFEQZ3.js → media-treatment-4OLWVHUY.js} +15 -15
- package/dist/{models-LLPVGC2E.js → models-MR55FAUX.js} +14 -14
- package/dist/{motionShot-6A6HH6IK.js → motionShot-DC47S7BT.js} +17 -17
- package/dist/{normalize-audio-KVQJBYLT.js → normalize-audio-M2TK4NG5.js} +8 -8
- package/dist/{open-J4ZT4X3C.js → open-YXWBWTKL.js} +12 -12
- package/dist/{parakeetRunner-FLUCIDIZ.js → parakeetRunner-J6QR3GTG.js} +15 -15
- package/dist/{pipeline-RRVLGALQ.js → pipeline-7MJ5H4SW.js} +10 -10
- package/dist/{play-QGJSXUVM.js → play-S562STR4.js} +33 -23
- package/dist/{preflight-SP2ZERBE.js → preflight-QWGXMISC.js} +11 -11
- package/dist/{present-UR4YBHMX.js → present-PGOHZT3L.js} +29 -19
- package/dist/{preview-6ENCRU4C.js → preview-JU75H4QN.js} +32 -29
- package/dist/{producer-OMHZRY6A.js → producer-H66OMZLW.js} +1 -1
- package/dist/{projectConfig-NGS7GJ47.js → projectConfig-COSP24YT.js} +7 -7
- package/dist/{publication-6NYQA22Y.js → publication-J3XYHPGB.js} +3 -3
- package/dist/{publish-E6RE5VHB.js → publish-7GCCEPJZ.js} +11 -11
- package/dist/{remove-background-66PQRA7R.js → remove-background-WRCGIU32.js} +11 -11
- package/dist/{render-ZLRJUFMX.js → render-5J5PP3UK.js} +21 -21
- package/dist/{render-SBAZWXPO.js → render-QS3YJCBR.js} +6 -6
- package/dist/{render-IMSGS6BD.js → render-VUVTK2JM.js} +36 -36
- package/dist/{render-batch-MO7LYZSP.js → render-batch-Q2LQ3D4P.js} +6 -6
- package/dist/renderSetupWorker.js +5 -5
- package/dist/{resolver-QMBVTAKT.js → resolver-QCBWPRSC.js} +5 -5
- package/dist/{sherpa-JZRDL3OE.js → sherpa-IZ22SC5W.js} +14 -14
- package/dist/{skills-YBTEWFYS.js → skills-3RFMPMJA.js} +5 -5
- package/dist/{skillsUpdateCheck-Z4HTDZJN.js → skillsUpdateCheck-DWBFVUBT.js} +3 -3
- package/dist/{snapshot-5F5UV6H5.js → snapshot-5PHA43DK.js} +53 -40
- package/dist/{src-WWXYV2TS.js → src-36BQVJL3.js} +16 -10
- package/dist/{src-UTW3F2PM.js → src-4YJKYMNF.js} +11 -7
- package/dist/{staticProjectServer-UHZ63C5O.js → staticProjectServer-3XFB76XS.js} +17 -17
- package/dist/studio/assets/hyperframes-player-lCVwx9d3.js +478 -0
- package/dist/studio/assets/{index-C8hp9Y7c.js → index-BNuxGFZK.js} +1 -1
- package/dist/studio/assets/{index-dy6GQJn4.js → index-CwreIGoq.js} +93 -93
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-BHZ3PHL2.js → studio-api-WL6EZ4KE.js} +10 -10
- package/dist/{studioSelectionClient-IUUPKUHZ.js → studioSelectionClient-D6VMGTKQ.js} +1 -1
- package/dist/{studioServer-AFUXWRB5.js → studioServer-ZS5RA6U3.js} +61 -52
- package/dist/{telemetry-UYKOT4OJ.js → telemetry-W3LRO3TB.js} +3 -3
- package/dist/{timeline-K5NLEMH4.js → timeline-BDO5DYWP.js} +18 -18
- package/dist/{tokens-FCOSWE2O.js → tokens-47CEMYFV.js} +2 -2
- package/dist/{transcribe-K2QTXDQR.js → transcribe-GEPVJO3A.js} +19 -19
- package/dist/{transcribe-SIFMTW5W.js → transcribe-XF3NL6JI.js} +13 -13
- package/dist/{tts-5I2AJNLM.js → tts-QM4RFE7U.js} +1 -1
- package/dist/{updateCheck-JZ6TBZVE.js → updateCheck-BON6ZFYP.js} +2 -2
- package/dist/{upgrade-TUPAJXQQ.js → upgrade-KIF5Z4J3.js} +2 -2
- package/dist/{urlDownloader-L4775QID.js → urlDownloader-UDRHVUWR.js} +7 -7
- package/dist/{validate-4HVVMEBV.js → validate-2OPSQT3W.js} +23 -23
- package/dist/{video-4OGPF3IE.js → video-ECWXMY4F.js} +8 -8
- package/dist/warmCheck.js +39 -37
- package/package.json +1 -1
- package/dist/chunk-ZUQZP6QD.js +0 -3986
- package/dist/studio/assets/hyperframes-player-DzdSmJdB.js +0 -478
- package/dist/{chunk-KVNXEAVT.js → chunk-2MLMO25E.js} +4 -4
- package/dist/{synthesize-PKTB5ATG.js → synthesize-QCRP3NI7.js} +4 -4
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
parseStrictFiniteTimingNumber,
|
|
10
10
|
resolveNaturalMediaTimelineDuration,
|
|
11
11
|
resolveTimedImageDurationSeconds
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KLIPVNCO.js";
|
|
13
13
|
import {
|
|
14
14
|
CANVAS_DIMENSIONS,
|
|
15
15
|
isCompositionElement,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
isTextElement,
|
|
18
18
|
keyframesToGsapAnimations,
|
|
19
19
|
serializeGsapAnimations
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-OFRRUYBA.js";
|
|
21
21
|
import {
|
|
22
22
|
COMPOSITION_ATTRIBUTES,
|
|
23
23
|
MEDIA_START_BASIS_ATTR,
|
|
@@ -479,6 +479,12 @@ function richTextHtml(content) {
|
|
|
479
479
|
return result.join("");
|
|
480
480
|
}
|
|
481
481
|
|
|
482
|
+
// ../core/dist/runtime/mediaClock.js
|
|
483
|
+
var MEDIA_ELEMENT_LEAD_SECONDS = 1e-5;
|
|
484
|
+
function mediaElementTime(sourceSeconds) {
|
|
485
|
+
return sourceSeconds + MEDIA_ELEMENT_LEAD_SECONDS;
|
|
486
|
+
}
|
|
487
|
+
|
|
482
488
|
// ../core/dist/generators/hyperframes.js
|
|
483
489
|
function escapeHtmlAttributeValue(value) {
|
|
484
490
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -619,7 +625,8 @@ function generateGsapTimelineScript(elements, totalDuration, options = {}) {
|
|
|
619
625
|
if (animations && animations.length > 0) {
|
|
620
626
|
const allAnimations = [...animations, ...keyframeAnimations];
|
|
621
627
|
gsapScript = serializeGsapAnimations(allAnimations, "tl", {
|
|
622
|
-
includeMediaSync: hasMedia
|
|
628
|
+
includeMediaSync: hasMedia,
|
|
629
|
+
mediaElementLeadSeconds: MEDIA_ELEMENT_LEAD_SECONDS
|
|
623
630
|
});
|
|
624
631
|
const prependAnimations = [initialPositionSets, visibilityAnimations].filter(Boolean).join("\n");
|
|
625
632
|
if (prependAnimations) {
|
|
@@ -631,7 +638,8 @@ ${prependAnimations}`);
|
|
|
631
638
|
}
|
|
632
639
|
} else if (keyframeAnimations.length > 0) {
|
|
633
640
|
gsapScript = serializeGsapAnimations(keyframeAnimations, "tl", {
|
|
634
|
-
includeMediaSync: hasMedia
|
|
641
|
+
includeMediaSync: hasMedia,
|
|
642
|
+
mediaElementLeadSeconds: MEDIA_ELEMENT_LEAD_SECONDS
|
|
635
643
|
});
|
|
636
644
|
const prependAnimations = [initialPositionSets, visibilityAnimations].filter(Boolean).join("\n");
|
|
637
645
|
if (prependAnimations) {
|
|
@@ -954,7 +962,7 @@ function generateDefaultGsapAnimations(elements, totalDuration, stageZoomKeyfram
|
|
|
954
962
|
const mediaTime = time - start;
|
|
955
963
|
if (time >= start && time < end) {
|
|
956
964
|
if (Math.abs(media.currentTime - mediaTime) > 0.1) {
|
|
957
|
-
media.currentTime = mediaTime;
|
|
965
|
+
media.currentTime = mediaTime + ${MEDIA_ELEMENT_LEAD_SECONDS};
|
|
958
966
|
}
|
|
959
967
|
if (media.paused && !tl.paused()) {
|
|
960
968
|
media.play().catch(function() {});
|
|
@@ -4560,14 +4568,14 @@ function createRuntimeStartTimeResolver(params) {
|
|
|
4560
4568
|
durationCache.set(element, resolved);
|
|
4561
4569
|
return resolved;
|
|
4562
4570
|
};
|
|
4563
|
-
const
|
|
4571
|
+
const COMPOSITION_HOST_SELECTOR = "[data-composition-src], [data-composition-id], [data-composition-file]";
|
|
4572
|
+
const isCompositionHost = (element) => element.matches(COMPOSITION_HOST_SELECTOR);
|
|
4564
4573
|
const inheritedTimingHost = (element) => {
|
|
4565
|
-
|
|
4566
|
-
if (!parent || !element.hasAttribute("data-composition-id"))
|
|
4574
|
+
if (!element.hasAttribute("data-composition-id"))
|
|
4567
4575
|
return null;
|
|
4568
4576
|
if (parseStartExpression(element.getAttribute("data-start")))
|
|
4569
4577
|
return null;
|
|
4570
|
-
return
|
|
4578
|
+
return element.parentElement?.closest(`[data-start], ${COMPOSITION_HOST_SELECTOR}`) ?? null;
|
|
4571
4579
|
};
|
|
4572
4580
|
const resolveCompositionOrigin = (compositionRoot, fallback) => compositionOriginSeconds(resolveStartForElementInternal(compositionRoot, fallback), inheritedTimingHost(compositionRoot) ?? compositionRoot);
|
|
4573
4581
|
const resolveHostOffsetForElement = (element, fallback) => {
|
|
@@ -5632,6 +5640,8 @@ export {
|
|
|
5632
5640
|
isAllowedHtmlAttribute,
|
|
5633
5641
|
isSafeAttributeValue,
|
|
5634
5642
|
sanitizeRichTextChildren,
|
|
5643
|
+
MEDIA_ELEMENT_LEAD_SECONDS,
|
|
5644
|
+
mediaElementTime,
|
|
5635
5645
|
generateHyperframesStyles,
|
|
5636
5646
|
generateGsapTimelineScript,
|
|
5637
5647
|
generateHyperframesHtml,
|
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
} from "./chunk-ELP5QZWL.js";
|
|
17
17
|
import {
|
|
18
18
|
rewriteSrcsetUrls
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-KLIPVNCO.js";
|
|
20
20
|
import {
|
|
21
21
|
decodeUrlPathVariants,
|
|
22
22
|
encodeUrlPath
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-OFRRUYBA.js";
|
|
24
24
|
import {
|
|
25
25
|
CSS_URL_RE,
|
|
26
26
|
isNonRelativeUrl,
|
|
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
stoppedByCancelSignal
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FNNGQ3DB.js";
|
|
10
10
|
import {
|
|
11
11
|
DEFAULT_MODEL,
|
|
12
12
|
ensureModel,
|
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
hasFFmpeg,
|
|
15
15
|
pinnedWhisperModel,
|
|
16
16
|
sha256File
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-2RT7MXFL.js";
|
|
18
18
|
import {
|
|
19
19
|
findFFmpeg,
|
|
20
20
|
findFFprobe,
|
|
21
21
|
getFFmpegInstallHint
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-5QKJPCQ4.js";
|
|
23
23
|
import {
|
|
24
24
|
findWavChunk
|
|
25
25
|
} from "./chunk-UOFAE5RF.js";
|
|
@@ -63,9 +63,59 @@ function renderSetupFailureFrom(stderr) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
// src/utils/cancellableProcess.ts
|
|
66
|
-
import { spawn } from "child_process";
|
|
66
|
+
import { spawn as spawn2 } from "child_process";
|
|
67
67
|
import { StringDecoder } from "string_decoder";
|
|
68
68
|
import { fileURLToPath } from "url";
|
|
69
|
+
|
|
70
|
+
// src/utils/childReaper.ts
|
|
71
|
+
import { spawn } from "child_process";
|
|
72
|
+
var REAPER = `const held = new Map();
|
|
73
|
+
let rest = "";
|
|
74
|
+
const kill = (pid, group) => {
|
|
75
|
+
try {
|
|
76
|
+
if (process.platform === "win32")
|
|
77
|
+
require("node:child_process").spawnSync("taskkill", ["/PID", pid, "/T", "/F"], { windowsHide: true, timeout: 10000 });
|
|
78
|
+
else process.kill(group ? -Number(pid) : Number(pid), "SIGKILL");
|
|
79
|
+
} catch {}
|
|
80
|
+
};
|
|
81
|
+
process.stdin.on("data", (data) => {
|
|
82
|
+
const lines = (rest + data).split("\\n");
|
|
83
|
+
rest = lines.pop();
|
|
84
|
+
for (const [op, pid, group] of lines.map((line) => line.split(" ")))
|
|
85
|
+
op === "+" ? held.set(pid, group === "g") : held.delete(pid);
|
|
86
|
+
});
|
|
87
|
+
const done = () => {
|
|
88
|
+
for (const [pid, group] of held) kill(pid, group);
|
|
89
|
+
process.exit(0);
|
|
90
|
+
};
|
|
91
|
+
process.stdin.on("end", done);
|
|
92
|
+
process.stdin.on("error", done);`;
|
|
93
|
+
var reaper;
|
|
94
|
+
function lifeline() {
|
|
95
|
+
if (!reaper) {
|
|
96
|
+
reaper = spawn(process.execPath, ["-e", REAPER], {
|
|
97
|
+
detached: true,
|
|
98
|
+
stdio: ["pipe", "ignore", "ignore"],
|
|
99
|
+
windowsHide: true
|
|
100
|
+
});
|
|
101
|
+
reaper.on("error", () => {
|
|
102
|
+
});
|
|
103
|
+
reaper.stdin?.on("error", () => {
|
|
104
|
+
});
|
|
105
|
+
reaper.unref();
|
|
106
|
+
reaper.stdin?.unref?.();
|
|
107
|
+
}
|
|
108
|
+
return reaper.stdin;
|
|
109
|
+
}
|
|
110
|
+
function killWithThisProcess(pid, group) {
|
|
111
|
+
const stdin = lifeline();
|
|
112
|
+
stdin?.write(`+ ${pid} ${group ? "g" : "p"}
|
|
113
|
+
`);
|
|
114
|
+
return () => void stdin?.write(`- ${pid}
|
|
115
|
+
`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// src/utils/cancellableProcess.ts
|
|
69
119
|
var CancellableProcessError = class extends Error {
|
|
70
120
|
code;
|
|
71
121
|
status;
|
|
@@ -98,11 +148,12 @@ function runCancellableProcess(command, args, options = {}) {
|
|
|
98
148
|
windowsHide: true,
|
|
99
149
|
detached
|
|
100
150
|
};
|
|
101
|
-
child =
|
|
151
|
+
child = spawn2(command, [...args], spawnOptions);
|
|
102
152
|
} catch (error) {
|
|
103
153
|
reject(error);
|
|
104
154
|
return;
|
|
105
155
|
}
|
|
156
|
+
const release = child.pid ? killWithThisProcess(child.pid, detached) : void 0;
|
|
106
157
|
if (child.pid) options.onSpawn?.(child.pid);
|
|
107
158
|
let stdout = "";
|
|
108
159
|
let stderr = "";
|
|
@@ -158,6 +209,7 @@ function runCancellableProcess(command, args, options = {}) {
|
|
|
158
209
|
});
|
|
159
210
|
child.once("error", (error) => void finishReject(error));
|
|
160
211
|
child.once("close", async (status, closeSignal) => {
|
|
212
|
+
release?.();
|
|
161
213
|
if (settled) return;
|
|
162
214
|
const trailingStdout = stdoutDecoder.end();
|
|
163
215
|
stdout += trailingStdout;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
loadProducer
|
|
9
|
+
} from "./chunk-CNVHMLPI.js";
|
|
10
|
+
import {
|
|
11
|
+
resolveProjectRelativeSrc
|
|
12
|
+
} from "./chunk-PBNWRWKA.js";
|
|
13
|
+
|
|
14
|
+
// src/utils/projectMedia.ts
|
|
15
|
+
async function collectProjectMedia(projectDir) {
|
|
16
|
+
const { bundleToSingleHtml } = await import("./compiler-4MHMC777.js");
|
|
17
|
+
const html = await bundleToSingleHtml(projectDir);
|
|
18
|
+
const producer = await loadProducer();
|
|
19
|
+
if (!producer.collectRenderMedia) throw new Error("Render media collector unavailable");
|
|
20
|
+
return { ...producer.collectRenderMedia(html), html };
|
|
21
|
+
}
|
|
22
|
+
function mediaPath(src, projectDir) {
|
|
23
|
+
return /^https?:\/\//i.test(src) ? src : resolveProjectRelativeSrc(src, projectDir, projectDir);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
collectProjectMedia,
|
|
28
|
+
mediaPath
|
|
29
|
+
};
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
DEFAULT_REGISTRY_URL,
|
|
9
9
|
fetchItemFile,
|
|
10
10
|
validRegistryItem
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4DGLKB2H.js";
|
|
12
12
|
import {
|
|
13
13
|
publishRegistryFile,
|
|
14
14
|
registryTargetPath
|
|
15
15
|
} from "./chunk-GMECXFAN.js";
|
|
16
16
|
import {
|
|
17
17
|
validateVariables
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-VW2LVMKB.js";
|
|
19
19
|
import {
|
|
20
20
|
realProjectRoot
|
|
21
21
|
} from "./chunk-OFQWTKPW.js";
|
|
@@ -8,85 +8,6 @@ import {
|
|
|
8
8
|
findFfBinary
|
|
9
9
|
} from "./chunk-VAS6HQX3.js";
|
|
10
10
|
|
|
11
|
-
// src/audio/analysis/decode.ts
|
|
12
|
-
import { execFile } from "child_process";
|
|
13
|
-
import { promisify } from "util";
|
|
14
|
-
var run = promisify(execFile);
|
|
15
|
-
function requiredBinary(name) {
|
|
16
|
-
const path = findFfBinary(name, { configuredMustExist: true });
|
|
17
|
-
if (!path) throw new Error(`${name} is required to analyze audio; run: npx hyperframes doctor`);
|
|
18
|
-
return path;
|
|
19
|
-
}
|
|
20
|
-
async function probeAudio(file) {
|
|
21
|
-
const { stdout } = await run(
|
|
22
|
-
requiredBinary("ffprobe"),
|
|
23
|
-
[
|
|
24
|
-
"-v",
|
|
25
|
-
"error",
|
|
26
|
-
"-select_streams",
|
|
27
|
-
"a:0",
|
|
28
|
-
"-show_streams",
|
|
29
|
-
"-show_format",
|
|
30
|
-
"-of",
|
|
31
|
-
"json",
|
|
32
|
-
"--",
|
|
33
|
-
file
|
|
34
|
-
],
|
|
35
|
-
{ maxBuffer: 8 * 1024 * 1024, windowsHide: true }
|
|
36
|
-
);
|
|
37
|
-
const parsed = JSON.parse(stdout);
|
|
38
|
-
const stream = parsed.streams?.[0];
|
|
39
|
-
if (!stream) return null;
|
|
40
|
-
return {
|
|
41
|
-
sampleRate: Number(stream.sample_rate),
|
|
42
|
-
channels: stream.channels ?? 1,
|
|
43
|
-
duration: Number(stream.duration ?? parsed.format?.duration ?? 0)
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
async function decodeAudio(file, window = {}, probed, format = {}) {
|
|
47
|
-
const probedInfo = probed ?? await probeAudio(file);
|
|
48
|
-
if (!probedInfo) return null;
|
|
49
|
-
const info = {
|
|
50
|
-
...probedInfo,
|
|
51
|
-
sampleRate: format.sampleRate ?? probedInfo.sampleRate,
|
|
52
|
-
channels: format.mono ? 1 : probedInfo.channels
|
|
53
|
-
};
|
|
54
|
-
const seek = window.from ? ["-ss", String(window.from)] : [];
|
|
55
|
-
const length = window.seconds === void 0 ? [] : ["-t", String(window.seconds)];
|
|
56
|
-
const { stdout } = await run(
|
|
57
|
-
requiredBinary("ffmpeg"),
|
|
58
|
-
[
|
|
59
|
-
"-v",
|
|
60
|
-
"error",
|
|
61
|
-
...seek,
|
|
62
|
-
"-i",
|
|
63
|
-
file,
|
|
64
|
-
...length,
|
|
65
|
-
"-map",
|
|
66
|
-
"0:a:0",
|
|
67
|
-
...format.mono ? ["-ac", "1"] : [],
|
|
68
|
-
...format.sampleRate ? ["-ar", String(format.sampleRate)] : [],
|
|
69
|
-
"-f",
|
|
70
|
-
"f32le",
|
|
71
|
-
"-acodec",
|
|
72
|
-
"pcm_f32le",
|
|
73
|
-
"-"
|
|
74
|
-
],
|
|
75
|
-
{ encoding: "buffer", maxBuffer: 2 * 1024 * 1024 * 1024, windowsHide: true }
|
|
76
|
-
);
|
|
77
|
-
const bytes = stdout.byteLength - stdout.byteLength % 4;
|
|
78
|
-
const interleaved = new Float32Array(
|
|
79
|
-
stdout.buffer.slice(stdout.byteOffset, stdout.byteOffset + bytes)
|
|
80
|
-
);
|
|
81
|
-
const frames = Math.floor(interleaved.length / info.channels);
|
|
82
|
-
const channels = Array.from({ length: info.channels }, (_, c) => {
|
|
83
|
-
const samples = new Float32Array(frames);
|
|
84
|
-
for (let i = 0; i < frames; i++) samples[i] = interleaved[i * info.channels + c];
|
|
85
|
-
return samples;
|
|
86
|
-
});
|
|
87
|
-
return { signal: { sampleRate: info.sampleRate, channels }, stream: info };
|
|
88
|
-
}
|
|
89
|
-
|
|
90
11
|
// ../core/dist/audioSteps.js
|
|
91
12
|
function finish(steps) {
|
|
92
13
|
for (; ; ) {
|
|
@@ -96,6 +17,43 @@ function finish(steps) {
|
|
|
96
17
|
}
|
|
97
18
|
}
|
|
98
19
|
|
|
20
|
+
// ../core/dist/fft.js
|
|
21
|
+
function fft(re, im) {
|
|
22
|
+
const n = re.length;
|
|
23
|
+
for (let i = 1, j = 0; i < n; i++) {
|
|
24
|
+
let bit = n >> 1;
|
|
25
|
+
for (; j & bit; bit >>= 1)
|
|
26
|
+
j ^= bit;
|
|
27
|
+
j ^= bit;
|
|
28
|
+
if (i < j) {
|
|
29
|
+
[re[i], re[j]] = [re[j], re[i]];
|
|
30
|
+
[im[i], im[j]] = [im[j], im[i]];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
for (let len = 2; len <= n; len <<= 1) {
|
|
34
|
+
const ang = -2 * Math.PI / len;
|
|
35
|
+
const wr = Math.cos(ang);
|
|
36
|
+
const wi = Math.sin(ang);
|
|
37
|
+
for (let i = 0; i < n; i += len) {
|
|
38
|
+
let cr = 1;
|
|
39
|
+
let ci = 0;
|
|
40
|
+
for (let k = 0; k < len / 2; k++) {
|
|
41
|
+
const ur = re[i + k];
|
|
42
|
+
const ui = im[i + k];
|
|
43
|
+
const vr = re[i + k + len / 2] * cr - im[i + k + len / 2] * ci;
|
|
44
|
+
const vi = re[i + k + len / 2] * ci + im[i + k + len / 2] * cr;
|
|
45
|
+
re[i + k] = ur + vr;
|
|
46
|
+
im[i + k] = ui + vi;
|
|
47
|
+
re[i + k + len / 2] = ur - vr;
|
|
48
|
+
im[i + k + len / 2] = ui - vi;
|
|
49
|
+
const ncr = cr * wr - ci * wi;
|
|
50
|
+
ci = cr * wi + ci * wr;
|
|
51
|
+
cr = ncr;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
99
57
|
// ../core/dist/audioResample.js
|
|
100
58
|
var ZERO_CROSSINGS = 8;
|
|
101
59
|
var STEPS_PER_CROSSING = 256;
|
|
@@ -136,43 +94,6 @@ function* resampleSteps(samples, from, to) {
|
|
|
136
94
|
return out;
|
|
137
95
|
}
|
|
138
96
|
|
|
139
|
-
// ../core/dist/fft.js
|
|
140
|
-
function fft(re, im) {
|
|
141
|
-
const n = re.length;
|
|
142
|
-
for (let i = 1, j = 0; i < n; i++) {
|
|
143
|
-
let bit = n >> 1;
|
|
144
|
-
for (; j & bit; bit >>= 1)
|
|
145
|
-
j ^= bit;
|
|
146
|
-
j ^= bit;
|
|
147
|
-
if (i < j) {
|
|
148
|
-
[re[i], re[j]] = [re[j], re[i]];
|
|
149
|
-
[im[i], im[j]] = [im[j], im[i]];
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
for (let len = 2; len <= n; len <<= 1) {
|
|
153
|
-
const ang = -2 * Math.PI / len;
|
|
154
|
-
const wr = Math.cos(ang);
|
|
155
|
-
const wi = Math.sin(ang);
|
|
156
|
-
for (let i = 0; i < n; i += len) {
|
|
157
|
-
let cr = 1;
|
|
158
|
-
let ci = 0;
|
|
159
|
-
for (let k = 0; k < len / 2; k++) {
|
|
160
|
-
const ur = re[i + k];
|
|
161
|
-
const ui = im[i + k];
|
|
162
|
-
const vr = re[i + k + len / 2] * cr - im[i + k + len / 2] * ci;
|
|
163
|
-
const vi = re[i + k + len / 2] * ci + im[i + k + len / 2] * cr;
|
|
164
|
-
re[i + k] = ur + vr;
|
|
165
|
-
im[i + k] = ui + vi;
|
|
166
|
-
re[i + k + len / 2] = ur - vr;
|
|
167
|
-
im[i + k + len / 2] = ui - vi;
|
|
168
|
-
const ncr = cr * wr - ci * wi;
|
|
169
|
-
ci = cr * wi + ci * wr;
|
|
170
|
-
cr = ncr;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
97
|
// ../core/dist/audioRhythm.js
|
|
177
98
|
var ANALYSIS_RATE = 22050;
|
|
178
99
|
var FRAME_SIZE = 1024;
|
|
@@ -560,73 +481,6 @@ function* rhythmSteps(signal) {
|
|
|
560
481
|
return entry.rhythm;
|
|
561
482
|
}
|
|
562
483
|
|
|
563
|
-
// ../core/dist/audioAnalysisLadder.js
|
|
564
|
-
function defaultLadder(capability, providers) {
|
|
565
|
-
return providers.filter((p) => p.capabilities.includes(capability)).map((p) => p.id);
|
|
566
|
-
}
|
|
567
|
-
function exclusion(provider, quality) {
|
|
568
|
-
if (quality === "fast" && !provider.signal)
|
|
569
|
-
return "quality fast allows signal processing only";
|
|
570
|
-
if (quality === "local" && !provider.local)
|
|
571
|
-
return "quality local keeps audio on this machine";
|
|
572
|
-
return null;
|
|
573
|
-
}
|
|
574
|
-
var message = (error) => error instanceof Error ? error.message : String(error);
|
|
575
|
-
async function availabilityOf(provider) {
|
|
576
|
-
try {
|
|
577
|
-
return provider.available ? await provider.available() : { ok: true };
|
|
578
|
-
} catch (error) {
|
|
579
|
-
return { ok: false, reason: message(error) };
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
async function blocked(id, candidate, capability, quality) {
|
|
583
|
-
if (!candidate?.capabilities.includes(capability))
|
|
584
|
-
return { provider: id, outcome: "unavailable", reason: `no provider ${id} for ${capability}` };
|
|
585
|
-
const excluded = exclusion(candidate, quality);
|
|
586
|
-
if (excluded)
|
|
587
|
-
return { provider: id, outcome: "excluded", reason: excluded };
|
|
588
|
-
const availability = await availabilityOf(candidate);
|
|
589
|
-
if (!availability.ok)
|
|
590
|
-
return { provider: id, outcome: "unavailable", reason: availability.reason };
|
|
591
|
-
return null;
|
|
592
|
-
}
|
|
593
|
-
function passedOver(capability, steps, answered) {
|
|
594
|
-
const skipped = steps.filter((s) => s.outcome === "unavailable" || s.outcome === "failed");
|
|
595
|
-
if (!skipped.length)
|
|
596
|
-
return null;
|
|
597
|
-
const why = skipped.map((s) => `${s.provider} ${s.outcome}${s.reason ? ` (${s.reason})` : ""}`).join("; ");
|
|
598
|
-
return answered ? `${capability}: used ${answered}; ${why}` : `${capability}: ${why}`;
|
|
599
|
-
}
|
|
600
|
-
async function runLadder(capability, input, providers, { quality = "best", ladder, provider, options = {} } = {}) {
|
|
601
|
-
const byId = new Map(providers.map((p) => [p.id, p]));
|
|
602
|
-
const order = provider ? [provider] : ladder ?? defaultLadder(capability, providers);
|
|
603
|
-
const steps = [];
|
|
604
|
-
for (const id of order) {
|
|
605
|
-
const candidate = byId.get(id);
|
|
606
|
-
const skip = await blocked(id, candidate, capability, quality);
|
|
607
|
-
if (skip) {
|
|
608
|
-
steps.push(skip);
|
|
609
|
-
continue;
|
|
610
|
-
}
|
|
611
|
-
try {
|
|
612
|
-
const value = await candidate.analyze(capability, input, options);
|
|
613
|
-
const warning = passedOver(capability, steps, id);
|
|
614
|
-
steps.push({ provider: id, outcome: "answered" });
|
|
615
|
-
return { value, provenance: id, steps, warnings: warning ? [warning] : [] };
|
|
616
|
-
} catch (error) {
|
|
617
|
-
steps.push({ provider: id, outcome: "failed", reason: message(error) });
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
const none = order.length ? "" : " (none offers it)";
|
|
621
|
-
const why = passedOver(capability, steps, null)?.slice(capability.length + 2);
|
|
622
|
-
return {
|
|
623
|
-
value: null,
|
|
624
|
-
provenance: null,
|
|
625
|
-
steps,
|
|
626
|
-
warnings: [`${capability}: no provider answered${none}${why ? `; ${why}` : ""}`]
|
|
627
|
-
};
|
|
628
|
-
}
|
|
629
|
-
|
|
630
484
|
// ../core/dist/audioSnap.js
|
|
631
485
|
function nearestIndex(sorted, t) {
|
|
632
486
|
let low = 0;
|
|
@@ -772,6 +626,73 @@ function sections(signal, options = {}) {
|
|
|
772
626
|
};
|
|
773
627
|
}
|
|
774
628
|
|
|
629
|
+
// ../core/dist/audioAnalysisLadder.js
|
|
630
|
+
function defaultLadder(capability, providers) {
|
|
631
|
+
return providers.filter((p) => p.capabilities.includes(capability)).map((p) => p.id);
|
|
632
|
+
}
|
|
633
|
+
function exclusion(provider, quality) {
|
|
634
|
+
if (quality === "fast" && !provider.signal)
|
|
635
|
+
return "quality fast allows signal processing only";
|
|
636
|
+
if (quality === "local" && !provider.local)
|
|
637
|
+
return "quality local keeps audio on this machine";
|
|
638
|
+
return null;
|
|
639
|
+
}
|
|
640
|
+
var message = (error) => error instanceof Error ? error.message : String(error);
|
|
641
|
+
async function availabilityOf(provider) {
|
|
642
|
+
try {
|
|
643
|
+
return provider.available ? await provider.available() : { ok: true };
|
|
644
|
+
} catch (error) {
|
|
645
|
+
return { ok: false, reason: message(error) };
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
async function blocked(id, candidate, capability, quality) {
|
|
649
|
+
if (!candidate?.capabilities.includes(capability))
|
|
650
|
+
return { provider: id, outcome: "unavailable", reason: `no provider ${id} for ${capability}` };
|
|
651
|
+
const excluded = exclusion(candidate, quality);
|
|
652
|
+
if (excluded)
|
|
653
|
+
return { provider: id, outcome: "excluded", reason: excluded };
|
|
654
|
+
const availability = await availabilityOf(candidate);
|
|
655
|
+
if (!availability.ok)
|
|
656
|
+
return { provider: id, outcome: "unavailable", reason: availability.reason };
|
|
657
|
+
return null;
|
|
658
|
+
}
|
|
659
|
+
function passedOver(capability, steps, answered) {
|
|
660
|
+
const skipped = steps.filter((s) => s.outcome === "unavailable" || s.outcome === "failed");
|
|
661
|
+
if (!skipped.length)
|
|
662
|
+
return null;
|
|
663
|
+
const why = skipped.map((s) => `${s.provider} ${s.outcome}${s.reason ? ` (${s.reason})` : ""}`).join("; ");
|
|
664
|
+
return answered ? `${capability}: used ${answered}; ${why}` : `${capability}: ${why}`;
|
|
665
|
+
}
|
|
666
|
+
async function runLadder(capability, input, providers, { quality = "best", ladder, provider, options = {} } = {}) {
|
|
667
|
+
const byId = new Map(providers.map((p) => [p.id, p]));
|
|
668
|
+
const order = provider ? [provider] : ladder ?? defaultLadder(capability, providers);
|
|
669
|
+
const steps = [];
|
|
670
|
+
for (const id of order) {
|
|
671
|
+
const candidate = byId.get(id);
|
|
672
|
+
const skip = await blocked(id, candidate, capability, quality);
|
|
673
|
+
if (skip) {
|
|
674
|
+
steps.push(skip);
|
|
675
|
+
continue;
|
|
676
|
+
}
|
|
677
|
+
try {
|
|
678
|
+
const value = await candidate.analyze(capability, input, options);
|
|
679
|
+
const warning = passedOver(capability, steps, id);
|
|
680
|
+
steps.push({ provider: id, outcome: "answered" });
|
|
681
|
+
return { value, provenance: id, steps, warnings: warning ? [warning] : [] };
|
|
682
|
+
} catch (error) {
|
|
683
|
+
steps.push({ provider: id, outcome: "failed", reason: message(error) });
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
const none = order.length ? "" : " (none offers it)";
|
|
687
|
+
const why = passedOver(capability, steps, null)?.slice(capability.length + 2);
|
|
688
|
+
return {
|
|
689
|
+
value: null,
|
|
690
|
+
provenance: null,
|
|
691
|
+
steps,
|
|
692
|
+
warnings: [`${capability}: no provider answered${none}${why ? `; ${why}` : ""}`]
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
|
|
775
696
|
// ../core/dist/audioAnalysis.js
|
|
776
697
|
var DB_FLOOR = -120;
|
|
777
698
|
var signalDuration = (signal) => (signal.channels[0]?.length ?? 0) / signal.sampleRate;
|
|
@@ -1207,6 +1128,85 @@ var signalProvider = {
|
|
|
1207
1128
|
}
|
|
1208
1129
|
};
|
|
1209
1130
|
|
|
1131
|
+
// src/audio/analysis/decode.ts
|
|
1132
|
+
import { execFile } from "child_process";
|
|
1133
|
+
import { promisify } from "util";
|
|
1134
|
+
var run = promisify(execFile);
|
|
1135
|
+
function requiredBinary(name) {
|
|
1136
|
+
const path = findFfBinary(name, { configuredMustExist: true });
|
|
1137
|
+
if (!path) throw new Error(`${name} is required to analyze audio; run: npx hyperframes doctor`);
|
|
1138
|
+
return path;
|
|
1139
|
+
}
|
|
1140
|
+
async function probeAudio(file) {
|
|
1141
|
+
const { stdout } = await run(
|
|
1142
|
+
requiredBinary("ffprobe"),
|
|
1143
|
+
[
|
|
1144
|
+
"-v",
|
|
1145
|
+
"error",
|
|
1146
|
+
"-select_streams",
|
|
1147
|
+
"a:0",
|
|
1148
|
+
"-show_streams",
|
|
1149
|
+
"-show_format",
|
|
1150
|
+
"-of",
|
|
1151
|
+
"json",
|
|
1152
|
+
"--",
|
|
1153
|
+
file
|
|
1154
|
+
],
|
|
1155
|
+
{ maxBuffer: 8 * 1024 * 1024, windowsHide: true }
|
|
1156
|
+
);
|
|
1157
|
+
const parsed = JSON.parse(stdout);
|
|
1158
|
+
const stream = parsed.streams?.[0];
|
|
1159
|
+
if (!stream) return null;
|
|
1160
|
+
return {
|
|
1161
|
+
sampleRate: Number(stream.sample_rate),
|
|
1162
|
+
channels: stream.channels ?? 1,
|
|
1163
|
+
duration: Number(stream.duration ?? parsed.format?.duration ?? 0)
|
|
1164
|
+
};
|
|
1165
|
+
}
|
|
1166
|
+
async function decodeAudio(file, window = {}, probed, format = {}) {
|
|
1167
|
+
const probedInfo = probed ?? await probeAudio(file);
|
|
1168
|
+
if (!probedInfo) return null;
|
|
1169
|
+
const info = {
|
|
1170
|
+
...probedInfo,
|
|
1171
|
+
sampleRate: format.sampleRate ?? probedInfo.sampleRate,
|
|
1172
|
+
channels: format.mono ? 1 : probedInfo.channels
|
|
1173
|
+
};
|
|
1174
|
+
const seek = window.from ? ["-ss", String(window.from)] : [];
|
|
1175
|
+
const length = window.seconds === void 0 ? [] : ["-t", String(window.seconds)];
|
|
1176
|
+
const { stdout } = await run(
|
|
1177
|
+
requiredBinary("ffmpeg"),
|
|
1178
|
+
[
|
|
1179
|
+
"-v",
|
|
1180
|
+
"error",
|
|
1181
|
+
...seek,
|
|
1182
|
+
"-i",
|
|
1183
|
+
file,
|
|
1184
|
+
...length,
|
|
1185
|
+
"-map",
|
|
1186
|
+
"0:a:0",
|
|
1187
|
+
...format.mono ? ["-ac", "1"] : [],
|
|
1188
|
+
...format.sampleRate ? ["-ar", String(format.sampleRate)] : [],
|
|
1189
|
+
"-f",
|
|
1190
|
+
"f32le",
|
|
1191
|
+
"-acodec",
|
|
1192
|
+
"pcm_f32le",
|
|
1193
|
+
"-"
|
|
1194
|
+
],
|
|
1195
|
+
{ encoding: "buffer", maxBuffer: 2 * 1024 * 1024 * 1024, windowsHide: true }
|
|
1196
|
+
);
|
|
1197
|
+
const bytes = stdout.byteLength - stdout.byteLength % 4;
|
|
1198
|
+
const interleaved = new Float32Array(
|
|
1199
|
+
stdout.buffer.slice(stdout.byteOffset, stdout.byteOffset + bytes)
|
|
1200
|
+
);
|
|
1201
|
+
const frames = Math.floor(interleaved.length / info.channels);
|
|
1202
|
+
const channels = Array.from({ length: info.channels }, (_, c) => {
|
|
1203
|
+
const samples = new Float32Array(frames);
|
|
1204
|
+
for (let i = 0; i < frames; i++) samples[i] = interleaved[i * info.channels + c];
|
|
1205
|
+
return samples;
|
|
1206
|
+
});
|
|
1207
|
+
return { signal: { sampleRate: info.sampleRate, channels }, stream: info };
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
1210
|
export {
|
|
1211
1211
|
finish,
|
|
1212
1212
|
medianInterval,
|
|
@@ -1219,6 +1219,7 @@ export {
|
|
|
1219
1219
|
signalDuration,
|
|
1220
1220
|
energyMixSteps,
|
|
1221
1221
|
envelope,
|
|
1222
|
+
silence,
|
|
1222
1223
|
signalProvider,
|
|
1223
1224
|
probeAudio,
|
|
1224
1225
|
decodeAudio
|