hyperframes 0.8.164 → 0.8.166
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-5UR2S4ZU.js → add-MCSKPN2J.js} +11 -11
- package/dist/{animatedGifPrep-NUU6VMFL.js → animatedGifPrep-3HO4C3YA.js} +5 -5
- package/dist/api.js +11 -11
- package/dist/{asset-TB7K7OFL.js → asset-XVO3H37J.js} +2 -2
- package/dist/{assetCataloger-FE4K64GW.js → assetCataloger-RHSKUXJV.js} +5 -5
- package/dist/{audio-WH3XWV6N.js → audio-G4CPBGIP.js} +10 -10
- package/dist/{auth-4BBOL3DI.js → auth-GRFFMOB5.js} +1 -1
- package/dist/{autoUpdate-7LARILUN.js → autoUpdate-CHDEIEGO.js} +2 -2
- package/dist/{backgroundChecks-5A5VAWOQ.js → backgroundChecks-VAZLRTGT.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-GJ65EZ26.js → batchRender-ILOPDVDM.js} +3 -3
- package/dist/{beats-EVQOYYYQ.js → beats-B3BZKIWQ.js} +4 -4
- package/dist/{benchmark-5KE22VUG.js → benchmark-OAPEWN3B.js} +8 -8
- package/dist/{browser-BLGJSG23.js → browser-IG6NUNE2.js} +3 -3
- package/dist/{bundleWithLocalizedFonts-O3BXZLCD.js → bundleWithLocalizedFonts-ZUM7SYTY.js} +2 -2
- package/dist/{capture-PR52XOEQ.js → capture-4A3RN6PP.js} +2 -2
- package/dist/{capture-KSXWVLT7.js → capture-XXKHHDGW.js} +8 -8
- package/dist/{catalog-W3AG6ISP.js → catalog-OT6XSKQS.js} +11 -11
- package/dist/{catch-up-JLZUALKW.js → catch-up-JEU6V6DR.js} +4 -4
- package/dist/{check-PGH3VCIR.js → check-6FSM25VP.js} +30 -30
- package/dist/{checkBrowser-MNJBUCZD.js → checkBrowser-MECIATAM.js} +27 -27
- package/dist/{chunk-HYRDV7AL.js → chunk-25CSBTM2.js} +1 -1
- package/dist/{chunk-AFPGUKMN.js → chunk-2WYDNKVV.js} +4 -4
- package/dist/{chunk-R64V3KQN.js → chunk-4UNBVCLJ.js} +8 -8
- package/dist/{chunk-SYOB5Y35.js → chunk-6U47Q57N.js} +1 -1
- package/dist/{chunk-Q4XFXAQ3.js → chunk-7PYUADWL.js} +1 -1
- package/dist/{chunk-DSXDYQQV.js → chunk-AKBFKGJM.js} +1 -1
- package/dist/{chunk-Z6VBXCYN.js → chunk-AL7XYJTK.js} +2 -2
- package/dist/{chunk-WZSWLCEH.js → chunk-APTXSODN.js} +1 -1
- package/dist/{chunk-PRZDWAH3.js → chunk-ATF6UESJ.js} +1 -1
- package/dist/{chunk-VEAKQW4X.js → chunk-B4VG7PGX.js} +1 -1
- package/dist/{chunk-6DJLEE74.js → chunk-BIOWX4AM.js} +3 -3
- package/dist/{chunk-A356JY2J.js → chunk-BSXI5VWK.js} +2 -2
- package/dist/{chunk-H45RC6HN.js → chunk-BTTGDEGI.js} +1 -1
- package/dist/{chunk-KR3M4GKH.js → chunk-BTXLF6DV.js} +1 -1
- package/dist/{chunk-AXATVUCD.js → chunk-CABYCNUK.js} +3 -3
- package/dist/{chunk-QGYAHDOR.js → chunk-CQFNLIGE.js} +2 -2
- package/dist/{chunk-3TKNBY6K.js → chunk-DDEFEMA3.js} +2 -2
- package/dist/{chunk-JEW5CCRU.js → chunk-DOONKIF5.js} +2 -2
- package/dist/{chunk-UH4IL4K4.js → chunk-EUCDNWPK.js} +7 -7
- package/dist/{chunk-ULAB77ZO.js → chunk-F67VJSSH.js} +1 -1
- package/dist/{chunk-74H5SHQL.js → chunk-FALELQTO.js} +3 -3
- package/dist/{chunk-57SASPYR.js → chunk-FLTPIUGU.js} +1 -1
- package/dist/{chunk-H3JGPRWA.js → chunk-GDJGBAV6.js} +1 -1
- package/dist/{chunk-H46R2BND.js → chunk-HLCB2VAN.js} +1 -1
- package/dist/{chunk-G3QMPIFG.js → chunk-HTDDV7CM.js} +2 -2
- package/dist/{chunk-FTFWZHTZ.js → chunk-I3B4A3LF.js} +1 -1
- package/dist/{chunk-42AER3PM.js → chunk-KPPC3C4I.js} +1 -1
- package/dist/{chunk-LMHXUDSR.js → chunk-KX4VIWIV.js} +1 -1
- package/dist/{chunk-UF45OJ3N.js → chunk-L7PJO2A4.js} +6 -6
- package/dist/chunk-LGAKMIEX.js +3795 -0
- package/dist/{chunk-NZ7K76Y2.js → chunk-MMSCLNCJ.js} +5 -2
- package/dist/{chunk-D5PUMG2P.js → chunk-OBZWOV4Q.js} +1 -1
- package/dist/{chunk-3E3VMAAM.js → chunk-PORNXOQP.js} +1 -1
- package/dist/{chunk-GD7VU7CY.js → chunk-QNZQTITL.js} +1 -1
- package/dist/{chunk-5K5YH6M7.js → chunk-SZDHUSQ5.js} +1 -1
- package/dist/{chunk-NOVAH7N4.js → chunk-TAANFVLO.js} +1 -1
- package/dist/{chunk-3XJVN7MR.js → chunk-THA3FI4Z.js} +2 -2
- package/dist/{chunk-3KY7FUSS.js → chunk-TIZRYBKL.js} +2 -2
- package/dist/{chunk-4LXWLCIX.js → chunk-TPLNKI23.js} +1 -1
- package/dist/{chunk-CXVBPW5F.js → chunk-UKTXHF3Q.js} +6 -6
- package/dist/{chunk-XYDPJ3CQ.js → chunk-ULJB5UY4.js} +9 -9
- package/dist/{chunk-36CWAWB7.js → chunk-V652CBKA.js} +1 -1
- package/dist/{chunk-WE5X5AKF.js → chunk-W3SLIE72.js} +9 -9
- package/dist/{chunk-O2CXBATN.js → chunk-WC6QG6WU.js} +2 -2
- package/dist/{chunk-WLQII3K3.js → chunk-WP4QEC2Q.js} +2 -2
- package/dist/{chunk-GJOW6ZFW.js → chunk-ZH3TWH4D.js} +2 -2
- package/dist/{chunk-56RENSU4.js → chunk-ZIL7S3L6.js} +1 -1
- package/dist/{chunk-BHGIBGUZ.js → chunk-ZUQ2K4YF.js} +1 -1
- package/dist/{clean-R7BXTAFB.js → clean-QWXJ5QJQ.js} +11 -11
- package/dist/cli.js +53 -53
- package/dist/{cloud-IPXFPX7M.js → cloud-UCQ33ODM.js} +4 -4
- package/dist/{cloudrun-RMBT2JQK.js → cloudrun-2NQXQI4T.js} +3 -3
- package/dist/{compare-S3RMZBB4.js → compare-ZGW25GT6.js} +22 -22
- package/dist/{compiler-RKH75FZH.js → compiler-VQ7QYOSB.js} +2 -2
- package/dist/{component-VSOWEAK4.js → component-W2QGYUEG.js} +3 -3
- package/dist/{compositions-7LPCAY7M.js → compositions-DOIAPDMU.js} +9 -9
- package/dist/{delete-L32WDJGO.js → delete-PCSBLAVX.js} +2 -2
- package/dist/{dist-P5OHBFEV.js → dist-6TKXILZL.js} +2 -2
- package/dist/{doctor-7TSVAIF2.js → doctor-2FMEUV4B.js} +7 -7
- package/dist/{events-FDHKA6NV.js → events-QPODC7BK.js} +3 -3
- package/dist/{events-RFABFHWU.js → events-V2KF4OKH.js} +2 -2
- package/dist/{feedback-SDAJ2HAM.js → feedback-NC2YHCYF.js} +6 -6
- package/dist/{figma-KJBYCHXQ.js → figma-RP23MXHX.js} +3 -3
- package/dist/fontLocalizeCli.js +7 -7
- package/dist/{get-6Z3JCPJ6.js → get-FIWRIPCT.js} +2 -2
- package/dist/{gpuPolicy-SYV7N237.js → gpuPolicy-4YD2BS3P.js} +5 -5
- package/dist/{grade-compare-HAQXCQSE.js → grade-compare-HVLIDLEO.js} +22 -22
- package/dist/{help-WMMVG2PR.js → help-EDA6FXKG.js} +1 -1
- package/dist/{history-5AQNASLD.js → history-7Z763GGS.js} +6 -6
- package/dist/hyperframe-runtime.js +55 -55
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +55 -55
- package/dist/hyperframes-player.global.js +3 -3
- package/dist/{info-OUJ3HXTN.js → info-OHDJXJKQ.js} +7 -7
- package/dist/{init-NEEYHH7E.js → init-BKYY2CXY.js} +20 -20
- package/dist/{inspect-ZWBDYWTY.js → inspect-CX3AFG2K.js} +23 -23
- package/dist/{installer-QWK7EA5M.js → installer-5YWMYX5C.js} +4 -4
- package/dist/{keyframes-BA5R5Q7G.js → keyframes-LBK4Y2T2.js} +6 -6
- package/dist/{lambda-LQHGF3LK.js → lambda-HIC2Z3GQ.js} +4 -4
- package/dist/{layout-GJVLRWIJ.js → layout-NSIMPYKJ.js} +23 -23
- package/dist/{lint-FBH2BA2A.js → lint-YH6HNXVM.js} +6 -6
- package/dist/{list-XDZIX2PU.js → list-KZXJYWKZ.js} +2 -2
- package/dist/{login-CUHIF5GP.js → login-CBNG6TFS.js} +4 -4
- package/dist/{media-treatment-HZDD67IL.js → media-treatment-TZTGSXQW.js} +8 -8
- package/dist/{models-J2FZXHMD.js → models-6PJD6KNN.js} +8 -8
- package/dist/{motionShot-D2C44I6P.js → motionShot-ATCNOMLE.js} +11 -11
- package/dist/{normalize-audio-B6PKQGHV.js → normalize-audio-JYRAP3I5.js} +4 -4
- package/dist/{open-EIN2FH4D.js → open-2IWIMS7X.js} +4 -4
- package/dist/{parakeetRunner-NDIU5PKO.js → parakeetRunner-4RECECZC.js} +8 -8
- package/dist/{pipeline-UKGI44NN.js → pipeline-W5ON6TOA.js} +5 -5
- package/dist/{play-KLOHE5XH.js → play-UWEP74BP.js} +16 -16
- package/dist/{present-4K53KZ3P.js → present-LBW3UKGD.js} +12 -12
- package/dist/{preview-PSALQBNR.js → preview-ZJVWEZDQ.js} +15 -15
- package/dist/{producer-66MQWVVQ.js → producer-STNCPEUU.js} +1 -1
- package/dist/{projectConfig-EVBNJKPS.js → projectConfig-QIZWOCOO.js} +6 -6
- package/dist/{publication-F6BOBZMI.js → publication-YNDABZNC.js} +2 -2
- package/dist/{publish-6KTQDKL6.js → publish-4UNNKLPE.js} +7 -7
- package/dist/{remove-background-TJTKY3YM.js → remove-background-77IFDTYA.js} +6 -6
- package/dist/{render-2QY3DTYM.js → render-5LL5JCRH.js} +21 -21
- package/dist/{render-X4MWSR5L.js → render-NUZPUBQO.js} +3 -3
- package/dist/{render-NAJFHWUG.js → render-VFPSVKGX.js} +8 -8
- package/dist/{render-batch-VKFOIMV5.js → render-batch-QU7ZWEJZ.js} +3 -3
- package/dist/{resolver-VGAM26OR.js → resolver-SPF7J6MA.js} +4 -4
- package/dist/{sherpa-3OI5VMCY.js → sherpa-XPHQUCHY.js} +7 -7
- package/dist/{skills-ETYVJOLG.js → skills-FVEEVJS7.js} +5 -5
- package/dist/{skillsUpdateCheck-6P4VCFZZ.js → skillsUpdateCheck-C64VYL4I.js} +3 -3
- package/dist/{snapshot-P3RZFXUC.js → snapshot-IMGLO7XP.js} +25 -25
- package/dist/{src-LZXECBBQ.js → src-DG7XW5WW.js} +4 -4
- package/dist/{src-RQPKPFRO.js → src-ZUYRJWHE.js} +6 -6
- package/dist/{staticProjectServer-DMG2CER4.js → staticProjectServer-H6GKJPVR.js} +12 -12
- package/dist/studio/assets/{hyperframes-player-CQX9TDla.js → hyperframes-player-BhRLDR30.js} +1 -1
- package/dist/studio/assets/{index-BnU7S7oM.js → index-CCRXiiFo.js} +1 -1
- package/dist/studio/assets/{index-DHqUZqg6.js → index-DQ_I6X0d.js} +97 -97
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-KRPBPUYQ.js → studio-api-72FF3CQG.js} +6 -6
- package/dist/{studioServer-HF6ZCYQO.js → studioServer-2YBG4HV2.js} +34 -34
- package/dist/{telemetry-ASFTF5YV.js → telemetry-DCFWJC6H.js} +3 -3
- package/dist/{timeline-H7Q2K6ZQ.js → timeline-IN6TQ6AQ.js} +13 -13
- package/dist/{tokens-LWCXLQCR.js → tokens-2ELEYMMJ.js} +2 -2
- package/dist/{transcribe-HOLKYWY5.js → transcribe-GGNTXYJS.js} +6 -6
- package/dist/{transcribe-X2GOG3HZ.js → transcribe-KELKHOAQ.js} +12 -12
- package/dist/{updateCheck-EA7X36NI.js → updateCheck-IK3VKZ2E.js} +2 -2
- package/dist/{upgrade-Y6H3ZEEJ.js → upgrade-JND5YLA5.js} +2 -2
- package/dist/{urlDownloader-Z435W35E.js → urlDownloader-XCHPVCAE.js} +4 -4
- package/dist/{validate-TZAB2PVX.js → validate-4PJYWIXX.js} +17 -17
- package/dist/{video-LNLD2PKZ.js → video-53CDAVK2.js} +5 -5
- package/package.json +1 -1
- package/dist/chunk-ZJO4SLHC.js +0 -3795
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var HyperframesPlayer=(()=>{var We=Object.defineProperty;var Jn=Object.getOwnPropertyDescriptor;var Zn=Object.getOwnPropertyNames;var Qn=Object.prototype.hasOwnProperty;var ei=(n,e)=>{for(var t in e)We(n,t,{get:e[t],enumerable:!0})},ti=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Zn(e))!Qn.call(n,r)&&r!==t&&We(n,r,{get:()=>e[r],enumerable:!(i=Jn(e,r))||i.enumerable});return n};var ni=n=>ti(We({},"__esModule",{value:!0}),n);var zr={};ei(zr,{HyperframesPlayer:()=>He,SPEED_PRESETS:()=>ut,formatSpeed:()=>ae,formatTime:()=>Ie});var Dt=n=>n!==null&&Number.isFinite(n)&&n>0;function _e(n){let e=n.clipEndsSeconds.filter(i=>i===null).length;if(Dt(n.authoredDurationSeconds))return{seconds:n.authoredDurationSeconds,source:"authored",pendingClips:e};let t=n.clipEndsSeconds.filter(Dt);return t.length>0?{seconds:Math.max(...t),source:"derived",pendingClips:e}:{seconds:null,source:"unresolved",pendingClips:e,reason:e>0?"every clip's length is still pending":"no authored duration and no clip with a length"}}var ii="http://www.w3.org/1999/xhtml";function Ct(n){return n!=null&&n.nodeType===1}function Ge(n){return Ct(n)&&n.namespaceURI===ii}function Be(n,e){return Ge(n)&&n.localName===e}function ri(n){return Be(n,"video")}function oi(n){return Be(n,"audio")}function M(n){return ri(n)||oi(n)}function $e(n){return Be(n,"img")}function ye(n){if(n==null||n.trim()==="")return null;let e=Number.parseInt(n,10);return Number.isFinite(e)&&e>0?e:null}function ve(n=document){let e=n.querySelector('[data-composition-id][data-root="true"]');return Ge(e)?e:n.querySelector("[data-composition-id]")}var V=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),Jr=Object.freeze([V.start,V.duration,V.trackIndex]),Zr=Object.freeze([V.derivedEnd]),Qr=Object.freeze([V.derivedEnd,V.legacyTrack]);function ze(n){if(n==null||n.trim()==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}var Nt=n=>{let e=ze(n);return e!==null&&e>=0?e:null};function Ae(n){return Nt(n("data-playback-start"))??Nt(n("data-media-start"))??0}var X=.1,K=10;function je(n){return Number.isFinite(n)&&n>0?Math.max(X,Math.min(K,n)):1}function Pt(n,e=1){let t=Number.parseFloat(n("data-playback-rate")??"");return je(Number.isFinite(t)&&t>0?t:e)}function qe(n){let e=ze(n("data-duration"));return e!==null&&e>0?e:null}function Lt(n,e){let t=qe(n);if(t!==null)return t;let i=ze(n("data-end"));return i!==null?i-e:null}var ai=3;function Ye(n,e,t){return Number.isFinite(n)?Math.max(0,n-e)/je(t):null}function Xe(n){let{tag:e,authoredDurationSeconds:t,sourceDurationSeconds:i,mediaStartSeconds:r,playbackRate:o}=n;if(t!==null&&t>0)return{seconds:t,source:"authored"};if(e==="img")return{seconds:ai,source:"default"};if(i===null)return{seconds:null,source:"pending",reason:"source duration not yet probed"};let a=Ye(i,r,o);return a===null?{seconds:null,source:"pending",reason:"source reported a non-finite duration"}:{seconds:a,source:"media"}}var Ft="data-fx-chain",to=Ft.slice(5);var J=(n="frequency",e="Frequency",t=1e3,i=20,r=2e4)=>({kind:"number",key:n,label:e,unit:"Hz",min:i,max:r,step:1,default:t,scale:"log",automatable:!0}),Ke=(n=.707,e="Bandwidth: higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:n,scale:"log",automatable:!0,hint:e}),Se=(n=-40,e=40,t=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:n,max:e,step:.1,default:t,automatable:!0}),Ot={kind:"enum",key:"poles",label:"Slope",options:[{value:"1",label:"6 dB/oct"},{value:"2",label:"12 dB/oct"}],default:"2",hint:"Two poles is the usual biquad; one pole is gentler."},Vt=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[Se(-60,12,0)],web:"gain-node"},{id:"peaking",label:"Peaking EQ",group:"filter",description:"Boost or cut a band, leaving everything either side alone.",params:[J("frequency","Frequency",1e3),Se(-40,40,0),Ke(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[J("frequency","Frequency",200,20,2e3),Se(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[J("frequency","Frequency",4e3,500,2e4),Se(-40,40,0)],web:"biquad-highshelf"},{id:"highpass",label:"High-pass",group:"filter",description:"Remove low frequencies: the usual fix for rumble on a voice.",params:[J("frequency","Cutoff",300,20,2e4),Ke(.707),Ot],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies, which darkens or muffles a track.",params:[J("frequency","Cutoff",8e3,100,2e4),Ke(.707),Ot],web:"biquad-lowpass"},{id:"compressor",label:"Compressor",group:"dynamics",description:"Pull loud parts down so the quiet ones can come up.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-60,max:0,step:.5,default:-24,hint:"Level above which the compressor starts working."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:4},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:2e3,step:.1,default:20,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:250,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83,hint:"1 is a hard corner; higher eases into it."},{kind:"number",key:"makeup",label:"Makeup",unit:"dB",min:0,max:36,step:.1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1,hint:"Below 1 blends the dry signal back in."}],web:"worklet-compressor"},{id:"limiter",label:"Limiter",group:"dynamics",description:"Peak limiter that follows the signal's level. It has no lookahead, so a fast peak or an inter-sample peak can pass the ceiling; use the true-peak limiter for a delivery limit.",params:[{kind:"number",key:"limit",label:"Ceiling",unit:"dB",min:-24,max:0,step:.1,default:-1},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.1,max:80,step:.1,default:5},{kind:"number",key:"release",label:"Release",unit:"ms",min:1,max:8e3,step:1,default:50,scale:"log"},{kind:"number",key:"level_out",label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0}],web:"worklet-limiter"},{id:"truepeak",label:"True-peak limiter",group:"dynamics",description:"Lookahead limiter that holds a 4x estimate of the inter-sample peak at a dBTP ceiling; full-band noise can land up to about 1.7 dB above it. Adds lookahead plus about 0.3 ms of latency.",params:[{kind:"number",key:"ceiling",label:"Ceiling",unit:"dBTP",min:-24,max:0,step:.1,default:-1,hint:"Target true peak, measured on a 4x oversampled signal. Dense full-band sound can end up to about 1.7 dB above it."},{kind:"number",key:"lookahead",label:"Lookahead",unit:"ms",min:.5,max:10,step:.1,default:3,hint:"How far ahead the gain starts falling. Longer is smoother and adds the same latency."},{kind:"number",key:"release",label:"Release",unit:"ms",min:10,max:2e3,step:1,default:80,scale:"log"}],web:"worklet-truepeak"},{id:"gate",label:"Noise Gate",group:"dynamics",description:"Silence the track when it drops below the threshold.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-80,max:0,step:.5,default:-35},{kind:"number",key:"range",label:"Range",unit:"dB",min:-80,max:0,step:.5,default:-24,hint:"How far down the gate pulls when closed."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:10},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:9e3,step:.1,default:1,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:100,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83}],web:"worklet-gate"},{id:"saturate",label:"Saturation",group:"nonlinear",description:"Soft-clip the waveform for warmth or outright distortion.",params:[{kind:"enum",key:"type",label:"Curve",options:[{value:"tanh",label:"Tanh"},{value:"atan",label:"Arctan"},{value:"cubic",label:"Cubic"},{value:"exp",label:"Exponential"},{value:"alg",label:"Algebraic"},{value:"quintic",label:"Quintic"},{value:"sin",label:"Sine"},{value:"erf",label:"Error function"},{value:"hard",label:"Hard clip"}],default:"tanh"},{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-40,max:0,step:.1,default:-6},{kind:"number",key:"output",automatable:!0,label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0},{kind:"number",key:"oversample",label:"Oversample",unit:"x",min:1,max:8,step:1,default:4,hint:"Higher costs more but keeps aliasing down."}],web:"waveshaper"},{id:"bitcrush",label:"Bitcrush",group:"nonlinear",description:"Drop bit depth and sample rate for a lo-fi, digital sound.",params:[{kind:"number",key:"bits",label:"Bit depth",unit:"bit",min:1,max:32,step:.1,default:8},{kind:"number",key:"samples",label:"Sample hold",unit:"x",min:1,max:250,step:1,default:1,hint:"Repeats each sample N times, a crude downsample."},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-bitcrush"},{id:"pitchshift",label:"Pitch shift",group:"time",description:"Shifts pitch up or down without changing playback speed. Adds ~50 ms of latency.",params:[{kind:"number",key:"semitones",label:"Semitones",unit:"st",min:-12,max:12,step:1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-pitchshift"},{id:"delay",label:"Delay",group:"time",description:"Repeating echoes behind the dry signal.",params:[{kind:"number",key:"time",automatable:!0,label:"Time",unit:"ms",min:1,max:5e3,step:1,default:250,scale:"log"},{kind:"number",key:"feedback",automatable:!0,label:"Feedback",unit:"",min:.01,max:.95,step:.01,default:.35},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.4}],web:"delay-feedback"},{id:"chorus",label:"Chorus",group:"time",description:"Detuned copies of the signal for width and thickness.",params:[{kind:"number",key:"delay",automatable:!0,label:"Delay",unit:"ms",min:1,max:100,step:.1,default:7},{kind:"number",key:"depth",automatable:!0,label:"Depth",unit:"ms",min:0,max:10,step:.01,default:2},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.01,max:10,step:.01,default:1},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.5}],web:"chorus-lfo"},{id:"phaser",label:"Phaser",group:"time",description:"Sweeping notches moving through the spectrum.",params:[{kind:"number",key:"in_gain",automatable:!0,label:"Input",unit:"",min:0,max:1,step:.01,default:.4},{kind:"number",key:"out_gain",automatable:!0,label:"Output",unit:"",min:0,max:2,step:.01,default:.74},{kind:"number",key:"delay",label:"Delay",unit:"ms",min:.1,max:5,step:.1,default:3},{kind:"number",key:"decay",label:"Decay",unit:"",min:0,max:.99,step:.01,default:.4},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.1,max:2,step:.01,default:.5},{kind:"enum",key:"type",label:"Waveform",options:[{value:"0",label:"Triangular"},{value:"1",label:"Sinusoidal"}],default:"0"}],web:"allpass-phaser"},{id:"reverb",label:"Reverb",group:"time",description:"Room tail. Both ends convolve the same generated impulse, so preview matches render.",params:[{kind:"number",key:"size",label:"Room size",unit:"",min:.05,max:1,step:.01,default:.7},{kind:"number",key:"damping",label:"Damping",unit:"",min:0,max:1,step:.01,default:.5,hint:"Higher rolls the top off the tail faster."},{kind:"number",key:"wet",automatable:!0,label:"Wet",unit:"",min:0,max:1,step:.01,default:.35},{kind:"number",key:"dry",automatable:!0,label:"Dry",unit:"",min:0,max:1,step:.01,default:.7}],web:"convolver"}],no=new Map(Vt.map(n=>[n.id,n]));var io=Vt.map(n=>n.id);function si(n){return 10**(n/20)}var Ut=si(12);var Ze="data-automation",po=Ze.slice(5),Je=1,ui=512,I=class extends Error{constructor(e){super(e),this.name="AudioAutomationError"}},Ee="volume",Te="rate";function Ht(n){if(n===Ee)return{kind:"volume"};if(n===Te)return{kind:"rate"};let e=n.split(".");if(e.length===3&&e[0]==="fx"&&e[1]===li){let r=e[2];return r?{kind:"preset",presetId:r}:null}if(e.length!==3||e[0]!=="fx")return null;let[,t,i]=e;return!t||!i?null:{kind:"fx",nodeId:t,param:i}}var li="preset";var di={min:0,max:Ut,step:.01,unit:"",label:"Volume",scale:"linear",default:1},ci={min:X,max:K,step:.05,unit:"x",label:"Speed",scale:"log",default:1};function Z(n){if(typeof n=="number")return Number.isFinite(n)?n:null;if(typeof n=="string"&&n.trim()!==""){let e=Number(n);return Number.isFinite(e)?e:null}return null}function mi(n){let e=Z(n);return e===null||e===0?0:Math.min(1,Math.max(-1,e))}function Wt(n,e){let t=Z(n),i=Z(e);if(t===null||i===null)return null;let r=s=>Math.min(.999,Math.max(.001,s)),o=r(t),a=r(i);return Math.abs(o-a)<1e-6?null:{x:o,y:a}}function pi(n){let e=mi(n?.curve),t=Wt(n?.viaX,n?.viaY);return{...e?{curve:e}:{},...t?{viaX:t.x,viaY:t.y}:{}}}function fi(n,e){let t=Z(n?.t),i=Z(n?.v);if(t===null||i===null)return null;let r=e?Math.min(e.max,Math.max(e.min,i)):i;return{t:Math.max(0,t),v:r,...pi(n)}}function hi(n,e){let t=n.map(r=>fi(r,e)).filter(r=>r!==null).sort((r,o)=>r.t-o.t),i=[];for(let r of t)i.length>0&&i[i.length-1].t===r.t?i[i.length-1]=r:i.push(r);return i.slice(0,ui)}function bi(n){let e=[];for(let t of n.lanes){if(!Ht(t.target))continue;let i=t.target===Ee?di:t.target===Te?ci:null,r=hi(t.points??[],i);r.length>0&&e.push({target:t.target,points:r})}return{version:Je,lanes:e}}function Gt(n){let e;try{e=JSON.parse(n)}catch(r){throw new I(`Automation is not valid JSON: ${r.message}`)}if(typeof e!="object"||e===null)throw new I("Automation must be a JSON object.");let t=e;if(t.version!==Je)throw new I(`Unsupported automation version: ${String(t.version)}`);if(!Array.isArray(t.lanes))throw new I("Automation is missing a `lanes` array.");let i=t.lanes.map((r,o)=>{if(typeof r!="object"||r===null)throw new I(`Lane ${o} is not an object.`);let a=r;if(typeof a.target!="string"||!Ht(a.target))throw new I(`Lane ${o} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new I(`Lane ${o} is missing a \`points\` array.`);return{target:a.target,points:a.points}});return bi({version:Je,lanes:i})}function gi(n,e){return e?Math.pow(n,Math.pow(2,2*e)):n}function _i(n,e){let t=n-.5,i=e-.5,r=.999,o=1e6,a=t>0?t/(r-n):t<0?-t/(n-(1-r)):0,s=i>0?i/(r-e):i<0?-i/(e-(1-r)):0,u=Math.min(o,Math.max(1,a,s));return{cx:n+t/u,cy:e+i/u,w:u}}function yi(n,e,t){let{cx:i,cy:r,w:o}=_i(e,t),a=2-2*o,s=n*a-1+2*o*i,u=-n*a-2*o*i,d=vi(s,u,n),m=1-d,g=m*m+2*o*d*m+d*d;return g>0?(2*o*r*d*m+d*d)/g:n}function vi(n,e,t){if(Math.abs(n)<1e-12)return Math.abs(e)<1e-12?t:-t/e;let i=Math.sqrt(Math.max(0,e*e-4*n*t)),r=(-e+i)/(2*n),o=(-e-i)/(2*n),a=s=>s>=-1e-9&&s<=1+1e-9;return a(r)?Math.min(1,Math.max(0,r)):a(o)?Math.min(1,Math.max(0,o)):t}function Ai(n,e){let t=Wt(e.viaX,e.viaY);return t?yi(Math.min(1,Math.max(0,n)),t.x,t.y):gi(n,e.curve)}function Si(n,e,t,i){return i==="log"&&n>0&&e>0?Math.exp(Math.log(n)+(Math.log(e)-Math.log(n))*t):n+(e-n)*t}function Re(n,e,t="linear"){let i=n.points;if(i.length===0)return 0;let r=i[0];if(e<=r.t)return r.v;let o=i[i.length-1];if(e>=o.t)return o.v;let a=0,s=i.length-1;for(;s-a>1;){let g=a+s>>1;i[g].t<=e?a=g:s=g}let u=i[a],d=i[s],m=d.t-u.t;return m<=0?d.v:Si(u.v,d.v,Ai((e-u.t)/m,u),t)}var xe=new Map,Ei=64;function Bt(n,e=Ee){let t=`${e}\0${n}`,i=xe.get(t);if(i!==void 0)return i;let r=null;try{r=Gt(n).lanes.find(o=>o.target===e)??null}catch{r=null}return xe.size>Ei&&xe.clear(),xe.set(t,r),r}var $t=48,zt=new WeakMap;function Ti(n){let e=n.points,t=e[0].v,i=e[e.length-1].v,r=[0],o=[0],a=u=>{let d=r[r.length-1];if(u<=d)return;let m=Re(n,d,"log");r.push(u),o.push(o[o.length-1]+(m+Re(n,u,"log"))/2*(u-d))},s=Math.max(0,e[0].t);a(s);for(let u=1;u<e.length;u+=1){let d=e[u-1].t,m=e[u].t;if(!(m<=0))for(let g=1;g<=$t;g+=1)a(Math.max(d,0)+(m-d)*g/$t)}return{ts:Float64Array.from(r),ss:Float64Array.from(o),firstRate:t,lastRate:i}}function Ri(n){let e=zt.get(n);return e||(e=Ti(n),zt.set(n,e)),e}function xi(n){return typeof n!="number"&&n.points.length>0}function wi(n,e,t){let i=0,r=n.length-1;for(;r-i>1;){let o=i+r>>1;n[o]<=t?i=o:r=o}return e[i]+(e[r]-e[i])*(t-n[i])/(n[r]-n[i])}function Qe(n,e){if(typeof n=="number")return e/n;if(!xi(n))return e;let{ts:t,ss:i,firstRate:r,lastRate:o}=Ri(n),a=t.length-1;return e<=0?e/r:e>=i[a]?t[a]+(e-i[a])/o:wi(i,t,e)}function ki(n){return n?Bt(n,Te):null}function jt(n,e){return ki(n)??e}var vo=[{id:"montage",label:"Montage",points:[[0,.9],[.15,.3],[.5,2.5],[.85,.3],[1,.9]]},{id:"hero",label:"Hero",points:[[0,1],[.25,1.6],[.5,.25],[.75,1.6],[1,1]]},{id:"bullet",label:"Bullet",points:[[0,3],[.4,3],[.5,.15],[.6,3],[1,3]]},{id:"jump-cut",label:"Jump cut",points:[[0,.5],[.24,.5],[.26,3],[.5,3],[.52,.5],[.74,.5],[.76,3],[1,3]]},{id:"flash-in",label:"Flash in",points:[[0,.3],[.6,.6],[1,5]]},{id:"flash-out",label:"Flash out",points:[[0,5],[.4,.6],[1,.3]]},{id:"ramp-in",label:"Ramp in",points:[[0,.5],[1,1]]},{id:"ramp-out",label:"Ramp out",points:[[0,1],[1,.5]]},{id:"slowmo-middle",label:"Slow-mo middle",points:[[0,1],[1/3,.35],[2/3,.35],[1,1]]}];var v=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),So=Object.freeze([v.start,v.duration,v.trackIndex]),Eo=Object.freeze([v.derivedEnd]),To=Object.freeze([v.derivedEnd,v.legacyTrack]);function D(n){if(n==null||n.trim()==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}var Xt=/^[A-Za-z0-9_.:-]+$/;function Kt(n,e){let t=n.charCodeAt(e);return t>=48&&t<=57}function qt(n,e){let t=e;for(;t>=0&&Kt(n,t);)t--;return t}function Mi(n,e){let t=e;for(;t>=0&&(n[t]??"").trim()==="";)t--;return t}function Ii(n){let e=n.length-1;if(!Kt(n,e))return null;let t=qt(n,e);return n[t]==="."&&(t=qt(n,t-1)),t+1}function Di(n){let e=Ii(n);if(e==null)return null;let t=Mi(n,e-1),i=n[t];if(i!=="+"&&i!=="-")return null;let r=n.slice(0,t).trim();if(!Xt.test(r))return null;let o=Number(n.slice(e));return Number.isFinite(o)?{refId:r,operator:i,magnitude:o}:null}function Q(n){let e=(n??"").trim();if(!e)return null;let t=D(e);if(t!=null)return{kind:"absolute",value:t};if(Xt.test(e))return{kind:"reference",refId:e,offset:0};let i=Di(e);return i?{kind:"reference",refId:i.refId,offset:i.operator==="-"?-i.magnitude:i.magnitude}:null}function T(n,e,t,i){n.push({code:e,attribute:t,value:i})}function Ci(n,e,t,i){if(e==null||e.trim()==="")return t.defaultStart===void 0?0:t.defaultStart;if(!n)return T(i,"invalid-start",v.start,e),null;if(n.kind==="absolute")return Math.max(0,n.value);let r=t.resolveReferenceEnd?.(n.refId);return r==null||!Number.isFinite(r)?(T(i,"unresolved-start-reference",v.start,e),null):Math.max(0,r+n.offset)}var Ni=1e-9;function Pi(n,e){return Math.abs(n-e)<=Ni}function Li(n,e,t){let i=D(n);if(i==null){T(t,"deprecated-end",v.derivedEnd,n),T(t,"invalid-end",v.derivedEnd,n);return}if(e==null){T(t,"deprecated-end",v.derivedEnd,n);return}Pi(i,e)||(T(t,"deprecated-end",v.derivedEnd,n),T(t,"conflicting-end",v.derivedEnd,n))}function Oi(n,e,t){let i=D(n);return i==null||i<0?(T(t,"invalid-duration",v.duration,n),{duration:null,end:null,durationSource:"invalid"}):{duration:i,end:e==null?null:e+i,durationSource:"duration"}}function Fi(n,e,t){T(t,"deprecated-end",v.derivedEnd,n);let i=D(n);return i==null?(T(t,"invalid-end",v.derivedEnd,n),{duration:null,end:null,durationSource:"invalid"}):e==null?{duration:null,end:i,durationSource:"legacy-end"}:i<e?(T(t,"end-before-start",v.derivedEnd,n),{duration:null,end:null,durationSource:"invalid"}):{duration:i-e,end:i,durationSource:"legacy-end"}}function Vi(n,e,t){let i=n.getAttribute(v.duration),r=n.getAttribute(v.derivedEnd);if(i==null)return r==null?{duration:null,end:null,durationSource:"missing"}:Fi(r,e,t);let o=Oi(i,e,t);return r!=null&&Li(r,o.end,t),o}function Yt(n,e,t,i){let r=D(n);return r==null||!Number.isInteger(r)?(T(i,"invalid-track-index",e,n),{trackIndex:0,trackSource:"invalid"}):{trackIndex:r,trackSource:t}}function Ui(n,e){let t=n.getAttribute(v.trackIndex),i=n.getAttribute(v.legacyTrack);if(t==null&&i==null)return{trackIndex:0,trackSource:"default"};if(t==null&&i!=null)return T(e,"deprecated-layer",v.legacyTrack,i),Yt(i,v.legacyTrack,"legacy-layer",e);let r=Yt(t??"",v.trackIndex,"track-index",e);if(i==null)return r;T(e,"deprecated-layer",v.legacyTrack,i);let o=D(i);return o!=null&&o!==r.trackIndex&&T(e,"conflicting-layer",v.legacyTrack,i),r}function et(n,e={}){let t=[],i=n.getAttribute(v.start),r=Q(i),o=Ci(r,i,e,t),a=Vi(n,o,t),s=Ui(n,t);return{startExpression:r,start:o,...a,...s,diagnostics:t}}function P(n){return D(n)}function ee(n){return Pt(e=>n.getAttribute(e),M(n)?n.defaultPlaybackRate:1)}function tt(n){return jt(n.getAttribute("data-automation"),ee(n))}function nt(n){return Ae(e=>n.getAttribute(e))}function U(n,e){return Hi(e,nt(n),tt(n))}function it(n){let e=Xe({tag:"video",authoredDurationSeconds:qe(t=>n.getAttribute(t)),sourceDurationSeconds:Number.isFinite(n.duration)?n.duration:null,mediaStartSeconds:nt(n),playbackRate:ee(n)});return e.source==="media"?U(n,n.duration):e.seconds}function we(n,e=0){return!$e(n)||!n.hasAttribute("data-start")&&!n.hasAttribute("data-track-index")?null:Xe({tag:"img",authoredDurationSeconds:Lt(t=>n.getAttribute(t),e),sourceDurationSeconds:null,mediaStartSeconds:0,playbackRate:1}).seconds}function Hi(n,e,t){return typeof t=="number"?Ye(n,e,t):Number.isFinite(n)?Qe(t,Math.max(0,n-e)):null}function Jt(){return globalThis}function te(n,e){if(typeof window>"u")return;let t=Jt(),i=t.__hf?.onSwallowed;if(i)try{i({label:n,error:e})}catch(r){}(t.__hfDebug||t.__HYPERFRAMES_DEBUG)&&console.debug(`[hyperframes] ${n} swallowed:`,e)}function ne(n){try{if(typeof n?.duration!="function")return null;let e=Number(n.duration());return Number.isFinite(e)?e:null}catch(e){return te("runtime.timelineDuration",e),null}}var Zt="data-hf-authored-duration",Qt="data-hf-authored-end";function ie(n){if(n==null||typeof n=="string"&&n.trim()==="")return null;let e=typeof n=="number"?n:Number(n);return Number.isFinite(e)?e:null}function ke(n){let e=ie(n.start);if(e==null)return null;let t=Math.max(0,e),i=ie(n.duration),r=ie(n.authoredDuration),o=i!=null&&i>0?i:r!=null&&r>0?r:null;if(o!=null)return{start:t,duration:o,end:t+o};let a=ie(n.end),s=ie(n.authoredEnd),u=a!=null&&a>t?a:s!=null&&s>t?s:null;return{start:t,duration:u==null?null:u-t,end:u}}var en="data-hf-media-start-basis";function tn(n){return n?.trim().toLowerCase()==="global"?"global":"local"}function Wi(n){return tn(n.basis)==="global"?n.authoredStart:n.hostStart+n.authoredStart}function nn(n){return on(n)?Wi({authoredStart:n.authoredStart,hostStart:n.hostStart,basis:n.basis}):n.ordinaryStart()}function rn(n){return on(n)&&tn(n.basis)==="global"}function on(n){return!n.hasAutoStart&&n.authoredStart!=null&&n.hostStart!==0}function rt(n){return Ae(e=>n.getAttribute(e))}function an(n,e){return n-rt(e)}function H(n){let e=n.timelineRegistry??{},t=n.includeAuthoredTimingAttrs??!1,i=n.documentRef??document,r=new WeakMap,o=new WeakMap,a=new Set,s=l=>{let f=i.getElementById(l);return f||(Array.from(i.querySelectorAll("[data-composition-id]")).find(_=>_.getAttribute("data-composition-id")===l)??null)},u=(l,f)=>t?l.getAttribute(f):null,d=l=>ke({start:0,duration:l.getAttribute("data-duration"),authoredDuration:u(l,"data-hf-authored-duration")})?.duration??ke({start:R(l,0),end:l.getAttribute("data-end"),authoredEnd:u(l,"data-hf-authored-end")})?.duration??null,m=l=>l!=null&&Number.isFinite(l)&&l>0?l:null,g=l=>{let f=l.getAttribute("data-composition-id");return f?m(ne(e[f])):null},y=l=>{let f=o.get(l);if(f!==void 0)return f;let _=d(l)??m(M(l)?U(l,l.duration):null)??m(we(l))??g(l);return o.set(l,_),_},h=l=>l.hasAttribute("data-composition-src")||l.hasAttribute("data-composition-id")||l.hasAttribute("data-composition-file"),A=l=>{let f=l.parentElement;return!f||!l.hasAttribute("data-composition-id")||Q(l.getAttribute("data-start"))?null:h(f)?f:null},b=(l,f)=>an(R(l,f),A(l)??l),S=(l,f)=>{let _=l.hasAttribute("data-composition-id")?l.parentElement?.closest("[data-composition-id]"):l.closest("[data-composition-id]");return _?b(_,f):0},C=(l,f)=>{let _=Q(l.getAttribute("data-start"));if(!_){let Y=A(l);return Y?R(Y,f):f}if(_.kind==="absolute")return S(l,f)+Math.max(0,_.value);let w=s(_.refId);if(!w)return f;let L=R(w,0),fe=y(w)??0,he=Math.min(0,S(l,0));return Math.max(he,L+fe+_.offset)},R=(l,f)=>{let _=r.get(l);if(_!==void 0)return _??f;if(a.has(l))return f;a.add(l);try{let w=C(l,f);return r.set(l,w),w}finally{a.delete(l)}},k=l=>{let f=l.closest("[data-composition-id]");return{authoredStart:P(l.getAttribute("data-start")),hostStart:f?b(f,0):0,hasAutoStart:l.hasAttribute("data-hf-auto-start"),basis:l.getAttribute(en)}};return{resolveStartForElement:(l,f=0)=>R(l,Math.max(0,f)),resolveDurationForElement:l=>y(l),resolveMediaStartForElement:l=>{let f=k(l);return nn({...f,ordinaryStart:()=>R(l,f.hostStart)})},resolveHostStartForElement:l=>S(l,0),resolveHostSlotsForElement:l=>{let f=[];for(let _=l.parentElement;_;_=_.parentElement){if(!h(_)||A(_)||rt(_)<=0)continue;let w=R(_,0),L=d(_);f.push({start:w,end:L?w+L:1/0})}return f},isRootGlobalMediaStartForElement:l=>M(l)&&rn(k(l))}}function sn(){return{capturedTimeline:null,isPlaying:!1,currentTime:0,deterministicAdapters:[],canonicalFps:30,bridgeMuted:!1,bridgeVolume:1,mediaOutputMuted:!1,nativeMediaSyncDisabled:!1,webAudioMediaDisabled:!1,mediaAutoplayBlockedPosted:!1,mediaForceSyncNextTick:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,controlBridgeHandler:null,beforeUnloadHandler:null,injectedCompStyles:[],injectedCompScripts:[],injectedCompLinks:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,transportClock:null,transportRafId:null}}var un=7200,ot=1/60,re=n=>n!==null&&n>ot?n:null;function Gi(n){return{width:ye(n.getAttribute("data-width")),height:ye(n.getAttribute("data-height"))}}function Bi(n,e){let t=[];for(let i of n.querySelectorAll("video[data-start], audio[data-start]")){let r=e.mediaStart(i);if(!Number.isFinite(r))continue;let o=e.mediaDuration(i);o==null||o<=ot||t.push(Math.max(0,r)+o)}return re(_e({authoredDurationSeconds:null,clipEndsSeconds:t}).seconds)}function $i(n,e){let t=[];for(let r of n.querySelectorAll("[data-composition-id][data-start]")){if(r.parentElement?.closest("[data-composition-id]")!==n)continue;let o=e.resolveStartForElement(r,0),a=e.resolveDurationForElement(r);!Number.isFinite(o)||a==null||a<=0||t.push(Math.max(0,o)+a)}let i=P(n.getAttribute("data-duration"));return re(_e({authoredDurationSeconds:null,clipEndsSeconds:[i,...t]}).seconds)}var zi=n=>n.hasAttribute("data-composition-id")||n.hasAttribute("data-composition-src");function ji(n,e,{unregisteredLottie:t}){let i=[];for(let o of n.querySelectorAll("[data-start]")){let a=e.resolveStartForElement(o,0);if(!Number.isFinite(a))continue;let s=e.resolveDurationForElement(o);s!=null?i.push(Math.max(0,a)+s):(M(o)||zi(o))&&i.push(null)}(t||n.querySelector("[data-lottie-src]"))&&i.push(null);let r=_e({authoredDurationSeconds:null,clipEndsSeconds:i});return r.pendingClips>0?{...r,seconds:null,source:"unresolved",reason:"a clip's length is pending"}:r}function qi(n){if(n.declared!==null&&Number.isFinite(n.declared)&&n.declared>0)return n.declared;let e=re(n.timeline()),t=Math.max(0,...n.floors().map(u=>u??0)),i=Number.isFinite(n.fallback)&&n.fallback>ot?n.fallback:0,r=Math.max(t,i),a=e!==null&&e>=un&&re(r)!==null?null:e,s;return a!==null?s=Math.max(a,r):re(t)!==null?s=r:i>0?s=i:s=n.derived(),s>0?s:0}function ln(n){let e=ve(n);if(!e)return null;let t=H({timelineRegistry:{},includeAuthoredTimingAttrs:!0,documentRef:n}),i=qi({declared:P(e.getAttribute("data-duration")),timeline:()=>null,floors:()=>[Bi(n,{mediaStart:t.resolveMediaStartForElement,mediaDuration:it}),$i(e,t)],fallback:0,derived:()=>ji(e,t,{unregisteredLottie:!1}).seconds??0});return{...Gi(e),fps:sn().canonicalFps,durationSeconds:i}}var dn="hyperframes-studio-preview";var cn="__hfPreviewErrors";function mn(n){return n.hasRuntime||n.runtimeInjected?!1:!!(n.hasNestedCompositions||n.hasTimelines&&n.attempts>=5)}function W(n){return typeof n=="object"&&n!==null}function pn(n){return W(n)&&typeof n.getDuration=="function"}function fn(n){return W(n)&&typeof n.duration=="function"&&typeof n.time=="function"&&typeof n.seek=="function"&&typeof n.play=="function"&&typeof n.pause=="function"}var G="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.8.164/dist/hyperframe.runtime.iife.js";function oe(n){if(n===null)return null;let e=Number.parseInt(n,10);return Number.isFinite(e)&&e>0?e:null}function Yi(n){let e=n?.querySelector("[data-composition-id][data-width][data-height]")??n?.querySelector("[data-width][data-height]");if(!e)return null;let t=oe(e.getAttribute("data-width")),i=oe(e.getAttribute("data-height"));return t!==null&&i!==null?{width:t,height:i}:null}function Xi(n){return Array.isArray(n)?n.find(e=>typeof e=="string"&&e.trim()!==""&&e!=="[object Event]")??null:null}var Me=class{constructor(e,t){this._iframe=e;this._callbacks=t}_iframe;_callbacks;_interval=null;_runtimeInjected=!1;_runtimeScript=null;_failure=null;get failed(){return this._failure!==null&&this._failure.document===this._iframe.contentDocument}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._failure=null,this._runtimeInjected=!1;let e=0;this._interval=setInterval(()=>{e++;let t=null;try{t=this._poll(e)}catch(i){i instanceof DOMException&&i.name==="SecurityError"||(t={kind:"error",message:i instanceof Error?i.message:String(i)})}if(t){this.stop(),t.kind==="error"?(this._failure={document:this._iframe.contentDocument},this._callbacks.onError(t.message)):this._callbacks.onReady(t.result);return}e>=40&&(this.stop(),this._failure={document:this._iframe.contentDocument},this._callbacks.onError("Composition timeline not found after 8s"))},200)}_poll(e){let t=this._iframe.contentWindow;if(!t)return null;let i=Xi(Reflect.get(t,cn));if(i!==null)return{kind:"error",message:i};let r=this._iframe.contentDocument,o=Reflect.get(t,"__timelines"),a=this.hasRuntimeBridge(t);if(mn({hasRuntime:a,hasTimelines:W(o)&&Object.keys(o).length>0,hasNestedCompositions:!!r?.querySelector("[data-composition-src]"),runtimeInjected:this._runtimeInjected,attempts:e}))return this._injectRuntime(),null;if(this._runtimeInjected&&!a)return null;let s=this._resolveReadyResult(t,r);return s?{kind:"ready",result:s}:null}_resolveReadyResult(e,t){let i=this._resolvePlaybackDurationAdapter(e)??{kind:"document",getDuration:()=>0},r=i.getDuration();if(!Number.isFinite(r)||r<=0){if(i.kind==="direct-timeline")return null;r=t?ln(t)?.durationSeconds??0:0}return r<=0?null:{duration:r,adapter:{...i,getDuration:()=>r},compositionSize:Yi(t)}}stop(){this._runtimeScript&&(this._runtimeScript.onerror=null,this._runtimeScript=null),this.failed||(this._failure=null),this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{let e=this._iframe.contentWindow;return e?this._resolveDirectTimelineAdapterFromWindow(e):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(e){return this._resolveDirectTimelineAdapterFromWindow(e)}hasRuntimeBridge(e){return W(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=this._callbacks.resolveRuntimeUrl?.()??G,this._runtimeScript=t,t.onerror=()=>{this._runtimeScript!==t||this._iframe.contentDocument!==e||(this.stop(),this._failure={document:e},this._callbacks.onError("HyperFrames runtime failed to load from "+t.src))},(e.head||e.documentElement).appendChild(t),this._callbacks.onRuntimeInjected?.()}catch{}}_resolveDirectTimelineAdapterFromWindow(e){if(this.hasRuntimeBridge(e))return null;let t=Reflect.get(e,"__timelines");if(!W(t))return null;let i=Object.keys(t);if(i.length===0)return null;let r=this._iframe.contentDocument?.querySelector("[data-composition-id]")?.getAttribute("data-composition-id"),o=r&&r in t?r:i[i.length-1],a=t[o];return fn(a)?a:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(pn(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let i=this._resolveDirectTimelineAdapterFromWindow(e);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}};var hn=`
|
|
1
|
+
"use strict";var HyperframesPlayer=(()=>{var We=Object.defineProperty;var Jn=Object.getOwnPropertyDescriptor;var Zn=Object.getOwnPropertyNames;var Qn=Object.prototype.hasOwnProperty;var ei=(n,e)=>{for(var t in e)We(n,t,{get:e[t],enumerable:!0})},ti=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Zn(e))!Qn.call(n,r)&&r!==t&&We(n,r,{get:()=>e[r],enumerable:!(i=Jn(e,r))||i.enumerable});return n};var ni=n=>ti(We({},"__esModule",{value:!0}),n);var jr={};ei(jr,{HyperframesPlayer:()=>He,SPEED_PRESETS:()=>ut,formatSpeed:()=>ae,formatTime:()=>Ie});var Dt=n=>n!==null&&Number.isFinite(n)&&n>0;function _e(n){let e=n.clipEndsSeconds.filter(i=>i===null).length;if(Dt(n.authoredDurationSeconds))return{seconds:n.authoredDurationSeconds,source:"authored",pendingClips:e};let t=n.clipEndsSeconds.filter(Dt);return t.length>0?{seconds:Math.max(...t),source:"derived",pendingClips:e}:{seconds:null,source:"unresolved",pendingClips:e,reason:e>0?"every clip's length is still pending":"no authored duration and no clip with a length"}}var ii="http://www.w3.org/1999/xhtml";function Ct(n){return n!=null&&n.nodeType===1}function Ge(n){return Ct(n)&&n.namespaceURI===ii}function Be(n,e){return Ge(n)&&n.localName===e}function ri(n){return Be(n,"video")}function oi(n){return Be(n,"audio")}function M(n){return ri(n)||oi(n)}function $e(n){return Be(n,"img")}function ye(n){if(n==null||n.trim()==="")return null;let e=Number.parseInt(n,10);return Number.isFinite(e)&&e>0?e:null}function ve(n=document){let e=n.querySelector('[data-composition-id][data-root="true"]');return Ge(e)?e:n.querySelector("[data-composition-id]")}var V=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),Zr=Object.freeze([V.start,V.duration,V.trackIndex]),Qr=Object.freeze([V.derivedEnd]),eo=Object.freeze([V.derivedEnd,V.legacyTrack]);function ze(n){if(n==null||n.trim()==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}var Nt=n=>{let e=ze(n);return e!==null&&e>=0?e:null};function Ae(n){return Nt(n("data-playback-start"))??Nt(n("data-media-start"))??0}var X=.1,K=10;function je(n){return Number.isFinite(n)&&n>0?Math.max(X,Math.min(K,n)):1}function Pt(n,e=1){let t=Number.parseFloat(n("data-playback-rate")??"");return je(Number.isFinite(t)&&t>0?t:e)}function qe(n){let e=ze(n("data-duration"));return e!==null&&e>0?e:null}function Lt(n,e){let t=qe(n);if(t!==null)return t;let i=ze(n("data-end"));return i!==null?i-e:null}var ai=3;function Ye(n,e,t){return Number.isFinite(n)?Math.max(0,n-e)/je(t):null}function Xe(n){let{tag:e,authoredDurationSeconds:t,sourceDurationSeconds:i,mediaStartSeconds:r,playbackRate:o}=n;if(t!==null&&t>0)return{seconds:t,source:"authored"};if(e==="img")return{seconds:ai,source:"default"};if(i===null)return{seconds:null,source:"pending",reason:"source duration not yet probed"};let a=Ye(i,r,o);return a===null?{seconds:null,source:"pending",reason:"source reported a non-finite duration"}:{seconds:a,source:"media"}}var Ft="data-fx-chain",no=Ft.slice(5);var J=(n="frequency",e="Frequency",t=1e3,i=20,r=2e4)=>({kind:"number",key:n,label:e,unit:"Hz",min:i,max:r,step:1,default:t,scale:"log",automatable:!0}),Ke=(n=.707,e="Bandwidth: higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:n,scale:"log",automatable:!0,hint:e}),Se=(n=-40,e=40,t=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:n,max:e,step:.1,default:t,automatable:!0}),Ot={kind:"enum",key:"poles",label:"Slope",options:[{value:"1",label:"6 dB/oct"},{value:"2",label:"12 dB/oct"}],default:"2",hint:"Two poles is the usual biquad; one pole is gentler."},Vt=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[Se(-60,12,0)],web:"gain-node"},{id:"peaking",label:"Peaking EQ",group:"filter",description:"Boost or cut a band, leaving everything either side alone.",params:[J("frequency","Frequency",1e3),Se(-40,40,0),Ke(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[J("frequency","Frequency",200,20,2e3),Se(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[J("frequency","Frequency",4e3,500,2e4),Se(-40,40,0)],web:"biquad-highshelf"},{id:"highpass",label:"High-pass",group:"filter",description:"Remove low frequencies: the usual fix for rumble on a voice.",params:[J("frequency","Cutoff",300,20,2e4),Ke(.707),Ot],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies, which darkens or muffles a track.",params:[J("frequency","Cutoff",8e3,100,2e4),Ke(.707),Ot],web:"biquad-lowpass"},{id:"compressor",label:"Compressor",group:"dynamics",description:"Pull loud parts down so the quiet ones can come up.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-60,max:0,step:.5,default:-24,hint:"Level above which the compressor starts working."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:4},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:2e3,step:.1,default:20,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:250,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83,hint:"1 is a hard corner; higher eases into it."},{kind:"number",key:"makeup",label:"Makeup",unit:"dB",min:0,max:36,step:.1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1,hint:"Below 1 blends the dry signal back in."}],web:"worklet-compressor"},{id:"limiter",label:"Limiter",group:"dynamics",description:"Peak limiter that follows the signal's level. It has no lookahead, so a fast peak or an inter-sample peak can pass the ceiling; use the true-peak limiter for a delivery limit.",params:[{kind:"number",key:"limit",label:"Ceiling",unit:"dB",min:-24,max:0,step:.1,default:-1},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.1,max:80,step:.1,default:5},{kind:"number",key:"release",label:"Release",unit:"ms",min:1,max:8e3,step:1,default:50,scale:"log"},{kind:"number",key:"level_out",label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0}],web:"worklet-limiter"},{id:"truepeak",label:"True-peak limiter",group:"dynamics",description:"Lookahead limiter that holds a 4x estimate of the inter-sample peak at a dBTP ceiling; full-band noise can land up to about 1.7 dB above it. Adds lookahead plus about 0.3 ms of latency.",params:[{kind:"number",key:"ceiling",label:"Ceiling",unit:"dBTP",min:-24,max:0,step:.1,default:-1,hint:"Target true peak, measured on a 4x oversampled signal. Dense full-band sound can end up to about 1.7 dB above it."},{kind:"number",key:"lookahead",label:"Lookahead",unit:"ms",min:.5,max:10,step:.1,default:3,hint:"How far ahead the gain starts falling. Longer is smoother and adds the same latency."},{kind:"number",key:"release",label:"Release",unit:"ms",min:10,max:2e3,step:1,default:80,scale:"log"}],web:"worklet-truepeak"},{id:"gate",label:"Noise Gate",group:"dynamics",description:"Silence the track when it drops below the threshold.",params:[{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-80,max:0,step:.5,default:-35},{kind:"number",key:"range",label:"Range",unit:"dB",min:-80,max:0,step:.5,default:-24,hint:"How far down the gate pulls when closed."},{kind:"number",key:"ratio",label:"Ratio",unit:":1",min:1,max:20,step:.1,default:10},{kind:"number",key:"attack",label:"Attack",unit:"ms",min:.01,max:9e3,step:.1,default:1,scale:"log"},{kind:"number",key:"release",label:"Release",unit:"ms",min:.01,max:9e3,step:1,default:100,scale:"log"},{kind:"number",key:"knee",label:"Knee",unit:"",min:1,max:8,step:.01,default:2.83}],web:"worklet-gate"},{id:"saturate",label:"Saturation",group:"nonlinear",description:"Soft-clip the waveform for warmth or outright distortion.",params:[{kind:"enum",key:"type",label:"Curve",options:[{value:"tanh",label:"Tanh"},{value:"atan",label:"Arctan"},{value:"cubic",label:"Cubic"},{value:"exp",label:"Exponential"},{value:"alg",label:"Algebraic"},{value:"quintic",label:"Quintic"},{value:"sin",label:"Sine"},{value:"erf",label:"Error function"},{value:"hard",label:"Hard clip"}],default:"tanh"},{kind:"number",key:"threshold",label:"Threshold",unit:"dB",min:-40,max:0,step:.1,default:-6},{kind:"number",key:"output",automatable:!0,label:"Output",unit:"dB",min:-24,max:24,step:.1,default:0},{kind:"number",key:"oversample",label:"Oversample",unit:"x",min:1,max:8,step:1,default:4,hint:"Higher costs more but keeps aliasing down."}],web:"waveshaper"},{id:"bitcrush",label:"Bitcrush",group:"nonlinear",description:"Drop bit depth and sample rate for a lo-fi, digital sound.",params:[{kind:"number",key:"bits",label:"Bit depth",unit:"bit",min:1,max:32,step:.1,default:8},{kind:"number",key:"samples",label:"Sample hold",unit:"x",min:1,max:250,step:1,default:1,hint:"Repeats each sample N times, a crude downsample."},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-bitcrush"},{id:"pitchshift",label:"Pitch shift",group:"time",description:"Shifts pitch up or down without changing playback speed. Adds ~50 ms of latency.",params:[{kind:"number",key:"semitones",label:"Semitones",unit:"st",min:-12,max:12,step:1,default:0},{kind:"number",key:"mix",label:"Mix",unit:"",min:0,max:1,step:.01,default:1}],web:"worklet-pitchshift"},{id:"delay",label:"Delay",group:"time",description:"Repeating echoes behind the dry signal.",params:[{kind:"number",key:"time",automatable:!0,label:"Time",unit:"ms",min:1,max:5e3,step:1,default:250,scale:"log"},{kind:"number",key:"feedback",automatable:!0,label:"Feedback",unit:"",min:.01,max:.95,step:.01,default:.35},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.4}],web:"delay-feedback"},{id:"chorus",label:"Chorus",group:"time",description:"Detuned copies of the signal for width and thickness.",params:[{kind:"number",key:"delay",automatable:!0,label:"Delay",unit:"ms",min:1,max:100,step:.1,default:7},{kind:"number",key:"depth",automatable:!0,label:"Depth",unit:"ms",min:0,max:10,step:.01,default:2},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.01,max:10,step:.01,default:1},{kind:"number",key:"mix",automatable:!0,label:"Mix",unit:"",min:0,max:1,step:.01,default:.5}],web:"chorus-lfo"},{id:"phaser",label:"Phaser",group:"time",description:"Sweeping notches moving through the spectrum.",params:[{kind:"number",key:"in_gain",automatable:!0,label:"Input",unit:"",min:0,max:1,step:.01,default:.4},{kind:"number",key:"out_gain",automatable:!0,label:"Output",unit:"",min:0,max:2,step:.01,default:.74},{kind:"number",key:"delay",label:"Delay",unit:"ms",min:.1,max:5,step:.1,default:3},{kind:"number",key:"decay",label:"Decay",unit:"",min:0,max:.99,step:.01,default:.4},{kind:"number",key:"speed",automatable:!0,label:"Rate",unit:"Hz",min:.1,max:2,step:.01,default:.5},{kind:"enum",key:"type",label:"Waveform",options:[{value:"0",label:"Triangular"},{value:"1",label:"Sinusoidal"}],default:"0"}],web:"allpass-phaser"},{id:"reverb",label:"Reverb",group:"time",description:"Room tail. Both ends convolve the same generated impulse, so preview matches render.",params:[{kind:"number",key:"size",label:"Room size",unit:"",min:.05,max:1,step:.01,default:.7},{kind:"number",key:"damping",label:"Damping",unit:"",min:0,max:1,step:.01,default:.5,hint:"Higher rolls the top off the tail faster."},{kind:"number",key:"wet",automatable:!0,label:"Wet",unit:"",min:0,max:1,step:.01,default:.35},{kind:"number",key:"dry",automatable:!0,label:"Dry",unit:"",min:0,max:1,step:.01,default:.7}],web:"convolver"}],io=new Map(Vt.map(n=>[n.id,n]));var ro=Vt.map(n=>n.id);function si(n){return 10**(n/20)}var Ut=si(12);var Ze="data-automation",fo=Ze.slice(5),Je=1,ui=512,I=class extends Error{constructor(e){super(e),this.name="AudioAutomationError"}},Ee="volume",Te="rate";function Ht(n){if(n===Ee)return{kind:"volume"};if(n===Te)return{kind:"rate"};let e=n.split(".");if(e.length===3&&e[0]==="fx"&&e[1]===li){let r=e[2];return r?{kind:"preset",presetId:r}:null}if(e.length!==3||e[0]!=="fx")return null;let[,t,i]=e;return!t||!i?null:{kind:"fx",nodeId:t,param:i}}var li="preset";var di={min:0,max:Ut,step:.01,unit:"",label:"Volume",scale:"linear",default:1},ci={min:X,max:K,step:.05,unit:"x",label:"Speed",scale:"log",default:1};function Z(n){if(typeof n=="number")return Number.isFinite(n)?n:null;if(typeof n=="string"&&n.trim()!==""){let e=Number(n);return Number.isFinite(e)?e:null}return null}function mi(n){let e=Z(n);return e===null||e===0?0:Math.min(1,Math.max(-1,e))}function Wt(n,e){let t=Z(n),i=Z(e);if(t===null||i===null)return null;let r=s=>Math.min(.999,Math.max(.001,s)),o=r(t),a=r(i);return Math.abs(o-a)<1e-6?null:{x:o,y:a}}function pi(n){let e=mi(n?.curve),t=Wt(n?.viaX,n?.viaY);return{...e?{curve:e}:{},...t?{viaX:t.x,viaY:t.y}:{}}}function fi(n,e){let t=Z(n?.t),i=Z(n?.v);if(t===null||i===null)return null;let r=e?Math.min(e.max,Math.max(e.min,i)):i;return{t:Math.max(0,t),v:r,...pi(n)}}function hi(n,e){let t=n.map(r=>fi(r,e)).filter(r=>r!==null).sort((r,o)=>r.t-o.t),i=[];for(let r of t)i.length>0&&i[i.length-1].t===r.t?i[i.length-1]=r:i.push(r);return i.slice(0,ui)}function bi(n){let e=[];for(let t of n.lanes){if(!Ht(t.target))continue;let i=t.target===Ee?di:t.target===Te?ci:null,r=hi(t.points??[],i);r.length>0&&e.push({target:t.target,points:r})}return{version:Je,lanes:e}}function Gt(n){let e;try{e=JSON.parse(n)}catch(r){throw new I(`Automation is not valid JSON: ${r.message}`)}if(typeof e!="object"||e===null)throw new I("Automation must be a JSON object.");let t=e;if(t.version!==Je)throw new I(`Unsupported automation version: ${String(t.version)}`);if(!Array.isArray(t.lanes))throw new I("Automation is missing a `lanes` array.");let i=t.lanes.map((r,o)=>{if(typeof r!="object"||r===null)throw new I(`Lane ${o} is not an object.`);let a=r;if(typeof a.target!="string"||!Ht(a.target))throw new I(`Lane ${o} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new I(`Lane ${o} is missing a \`points\` array.`);return{target:a.target,points:a.points}});return bi({version:Je,lanes:i})}function gi(n,e){return e?Math.pow(n,Math.pow(2,2*e)):n}function _i(n,e){let t=n-.5,i=e-.5,r=.999,o=1e6,a=t>0?t/(r-n):t<0?-t/(n-(1-r)):0,s=i>0?i/(r-e):i<0?-i/(e-(1-r)):0,u=Math.min(o,Math.max(1,a,s));return{cx:n+t/u,cy:e+i/u,w:u}}function yi(n,e,t){let{cx:i,cy:r,w:o}=_i(e,t),a=2-2*o,s=n*a-1+2*o*i,u=-n*a-2*o*i,d=vi(s,u,n),m=1-d,g=m*m+2*o*d*m+d*d;return g>0?(2*o*r*d*m+d*d)/g:n}function vi(n,e,t){if(Math.abs(n)<1e-12)return Math.abs(e)<1e-12?t:-t/e;let i=Math.sqrt(Math.max(0,e*e-4*n*t)),r=(-e+i)/(2*n),o=(-e-i)/(2*n),a=s=>s>=-1e-9&&s<=1+1e-9;return a(r)?Math.min(1,Math.max(0,r)):a(o)?Math.min(1,Math.max(0,o)):t}function Ai(n,e){let t=Wt(e.viaX,e.viaY);return t?yi(Math.min(1,Math.max(0,n)),t.x,t.y):gi(n,e.curve)}function Si(n,e,t,i){return i==="log"&&n>0&&e>0?Math.exp(Math.log(n)+(Math.log(e)-Math.log(n))*t):n+(e-n)*t}function Re(n,e,t="linear"){let i=n.points;if(i.length===0)return 0;let r=i[0];if(e<=r.t)return r.v;let o=i[i.length-1];if(e>=o.t)return o.v;let a=0,s=i.length-1;for(;s-a>1;){let g=a+s>>1;i[g].t<=e?a=g:s=g}let u=i[a],d=i[s],m=d.t-u.t;return m<=0?d.v:Si(u.v,d.v,Ai((e-u.t)/m,u),t)}var xe=new Map,Ei=64;function Bt(n,e=Ee){let t=`${e}\0${n}`,i=xe.get(t);if(i!==void 0)return i;let r=null;try{r=Gt(n).lanes.find(o=>o.target===e)??null}catch{r=null}return xe.size>Ei&&xe.clear(),xe.set(t,r),r}var $t=48,zt=new WeakMap;function Ti(n){let e=n.points,t=e[0].v,i=e[e.length-1].v,r=[0],o=[0],a=u=>{let d=r[r.length-1];if(u<=d)return;let m=Re(n,d,"log");r.push(u),o.push(o[o.length-1]+(m+Re(n,u,"log"))/2*(u-d))},s=Math.max(0,e[0].t);a(s);for(let u=1;u<e.length;u+=1){let d=e[u-1].t,m=e[u].t;if(!(m<=0))for(let g=1;g<=$t;g+=1)a(Math.max(d,0)+(m-d)*g/$t)}return{ts:Float64Array.from(r),ss:Float64Array.from(o),firstRate:t,lastRate:i}}function Ri(n){let e=zt.get(n);return e||(e=Ti(n),zt.set(n,e)),e}function xi(n){return typeof n!="number"&&n.points.length>0}function wi(n,e,t){let i=0,r=n.length-1;for(;r-i>1;){let o=i+r>>1;n[o]<=t?i=o:r=o}return e[i]+(e[r]-e[i])*(t-n[i])/(n[r]-n[i])}function Qe(n,e){if(typeof n=="number")return e/n;if(!xi(n))return e;let{ts:t,ss:i,firstRate:r,lastRate:o}=Ri(n),a=t.length-1;return e<=0?e/r:e>=i[a]?t[a]+(e-i[a])/o:wi(i,t,e)}function ki(n){return n?Bt(n,Te):null}function jt(n,e){return ki(n)??e}var Ao=[{id:"montage",label:"Montage",points:[[0,.9],[.15,.3],[.5,2.5],[.85,.3],[1,.9]]},{id:"hero",label:"Hero",points:[[0,1],[.25,1.6],[.5,.25],[.75,1.6],[1,1]]},{id:"bullet",label:"Bullet",points:[[0,3],[.4,3],[.5,.15],[.6,3],[1,3]]},{id:"jump-cut",label:"Jump cut",points:[[0,.5],[.24,.5],[.26,3],[.5,3],[.52,.5],[.74,.5],[.76,3],[1,3]]},{id:"flash-in",label:"Flash in",points:[[0,.3],[.6,.6],[1,5]]},{id:"flash-out",label:"Flash out",points:[[0,5],[.4,.6],[1,.3]]},{id:"ramp-in",label:"Ramp in",points:[[0,.5],[1,1]]},{id:"ramp-out",label:"Ramp out",points:[[0,1],[1,.5]]},{id:"slowmo-middle",label:"Slow-mo middle",points:[[0,1],[1/3,.35],[2/3,.35],[1,1]]}];var v=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),Eo=Object.freeze([v.start,v.duration,v.trackIndex]),To=Object.freeze([v.derivedEnd]),Ro=Object.freeze([v.derivedEnd,v.legacyTrack]);function D(n){if(n==null||n.trim()==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}var Xt=/^[A-Za-z0-9_.:-]+$/;function Kt(n,e){let t=n.charCodeAt(e);return t>=48&&t<=57}function qt(n,e){let t=e;for(;t>=0&&Kt(n,t);)t--;return t}function Mi(n,e){let t=e;for(;t>=0&&(n[t]??"").trim()==="";)t--;return t}function Ii(n){let e=n.length-1;if(!Kt(n,e))return null;let t=qt(n,e);return n[t]==="."&&(t=qt(n,t-1)),t+1}function Di(n){let e=Ii(n);if(e==null)return null;let t=Mi(n,e-1),i=n[t];if(i!=="+"&&i!=="-")return null;let r=n.slice(0,t).trim();if(!Xt.test(r))return null;let o=Number(n.slice(e));return Number.isFinite(o)?{refId:r,operator:i,magnitude:o}:null}function Q(n){let e=(n??"").trim();if(!e)return null;let t=D(e);if(t!=null)return{kind:"absolute",value:t};if(Xt.test(e))return{kind:"reference",refId:e,offset:0};let i=Di(e);return i?{kind:"reference",refId:i.refId,offset:i.operator==="-"?-i.magnitude:i.magnitude}:null}function T(n,e,t,i){n.push({code:e,attribute:t,value:i})}function Ci(n,e,t,i){if(e==null||e.trim()==="")return t.defaultStart===void 0?0:t.defaultStart;if(!n)return T(i,"invalid-start",v.start,e),null;if(n.kind==="absolute")return Math.max(0,n.value);let r=t.resolveReferenceEnd?.(n.refId);return r==null||!Number.isFinite(r)?(T(i,"unresolved-start-reference",v.start,e),null):Math.max(0,r+n.offset)}var Ni=1e-9;function Pi(n,e){return Math.abs(n-e)<=Ni}function Li(n,e,t){let i=D(n);if(i==null){T(t,"deprecated-end",v.derivedEnd,n),T(t,"invalid-end",v.derivedEnd,n);return}if(e==null){T(t,"deprecated-end",v.derivedEnd,n);return}Pi(i,e)||(T(t,"deprecated-end",v.derivedEnd,n),T(t,"conflicting-end",v.derivedEnd,n))}function Oi(n,e,t){let i=D(n);return i==null||i<0?(T(t,"invalid-duration",v.duration,n),{duration:null,end:null,durationSource:"invalid"}):{duration:i,end:e==null?null:e+i,durationSource:"duration"}}function Fi(n,e,t){T(t,"deprecated-end",v.derivedEnd,n);let i=D(n);return i==null?(T(t,"invalid-end",v.derivedEnd,n),{duration:null,end:null,durationSource:"invalid"}):e==null?{duration:null,end:i,durationSource:"legacy-end"}:i<e?(T(t,"end-before-start",v.derivedEnd,n),{duration:null,end:null,durationSource:"invalid"}):{duration:i-e,end:i,durationSource:"legacy-end"}}function Vi(n,e,t){let i=n.getAttribute(v.duration),r=n.getAttribute(v.derivedEnd);if(i==null)return r==null?{duration:null,end:null,durationSource:"missing"}:Fi(r,e,t);let o=Oi(i,e,t);return r!=null&&Li(r,o.end,t),o}function Yt(n,e,t,i){let r=D(n);return r==null||!Number.isInteger(r)?(T(i,"invalid-track-index",e,n),{trackIndex:0,trackSource:"invalid"}):{trackIndex:r,trackSource:t}}function Ui(n,e){let t=n.getAttribute(v.trackIndex),i=n.getAttribute(v.legacyTrack);if(t==null&&i==null)return{trackIndex:0,trackSource:"default"};if(t==null&&i!=null)return T(e,"deprecated-layer",v.legacyTrack,i),Yt(i,v.legacyTrack,"legacy-layer",e);let r=Yt(t??"",v.trackIndex,"track-index",e);if(i==null)return r;T(e,"deprecated-layer",v.legacyTrack,i);let o=D(i);return o!=null&&o!==r.trackIndex&&T(e,"conflicting-layer",v.legacyTrack,i),r}function et(n,e={}){let t=[],i=n.getAttribute(v.start),r=Q(i),o=Ci(r,i,e,t),a=Vi(n,o,t),s=Ui(n,t);return{startExpression:r,start:o,...a,...s,diagnostics:t}}function P(n){return D(n)}function ee(n){return Pt(e=>n.getAttribute(e),M(n)?n.defaultPlaybackRate:1)}function tt(n){return jt(n.getAttribute("data-automation"),ee(n))}function nt(n){return Ae(e=>n.getAttribute(e))}function U(n,e){return Hi(e,nt(n),tt(n))}function it(n){let e=Xe({tag:"video",authoredDurationSeconds:qe(t=>n.getAttribute(t)),sourceDurationSeconds:Number.isFinite(n.duration)?n.duration:null,mediaStartSeconds:nt(n),playbackRate:ee(n)});return e.source==="media"?U(n,n.duration):e.seconds}function we(n,e=0){return!$e(n)||!n.hasAttribute("data-start")&&!n.hasAttribute("data-track-index")?null:Xe({tag:"img",authoredDurationSeconds:Lt(t=>n.getAttribute(t),e),sourceDurationSeconds:null,mediaStartSeconds:0,playbackRate:1}).seconds}function Hi(n,e,t){return typeof t=="number"?Ye(n,e,t):Number.isFinite(n)?Qe(t,Math.max(0,n-e)):null}function Jt(){return globalThis}function te(n,e){if(typeof window>"u")return;let t=Jt(),i=t.__hf?.onSwallowed;if(i)try{i({label:n,error:e})}catch(r){}(t.__hfDebug||t.__HYPERFRAMES_DEBUG)&&console.debug(`[hyperframes] ${n} swallowed:`,e)}var Wi=n=>n.paused?.()===!0?(n.startTime?.()??0)+(n.totalDuration?.()??0)/Math.abs(n.timeScale?.()||1):0;function ne(n){try{if(typeof n?.duration!="function")return null;let e=n.getChildren?.(!1,!1,!0),t=Array.isArray(e)?e:[],i=Math.max(Number(n.duration()),...t.map(Wi));return Number.isFinite(i)?i:null}catch(e){return te("runtime.timelineDuration",e),null}}var Zt="data-hf-authored-duration",Qt="data-hf-authored-end";function ie(n){if(n==null||typeof n=="string"&&n.trim()==="")return null;let e=typeof n=="number"?n:Number(n);return Number.isFinite(e)?e:null}function ke(n){let e=ie(n.start);if(e==null)return null;let t=Math.max(0,e),i=ie(n.duration),r=ie(n.authoredDuration),o=i!=null&&i>0?i:r!=null&&r>0?r:null;if(o!=null)return{start:t,duration:o,end:t+o};let a=ie(n.end),s=ie(n.authoredEnd),u=a!=null&&a>t?a:s!=null&&s>t?s:null;return{start:t,duration:u==null?null:u-t,end:u}}var en="data-hf-media-start-basis";function tn(n){return n?.trim().toLowerCase()==="global"?"global":"local"}function Gi(n){return tn(n.basis)==="global"?n.authoredStart:n.hostStart+n.authoredStart}function nn(n){return on(n)?Gi({authoredStart:n.authoredStart,hostStart:n.hostStart,basis:n.basis}):n.ordinaryStart()}function rn(n){return on(n)&&tn(n.basis)==="global"}function on(n){return!n.hasAutoStart&&n.authoredStart!=null&&n.hostStart!==0}function rt(n){return Ae(e=>n.getAttribute(e))}function an(n,e){return n-rt(e)}function H(n){let e=n.timelineRegistry??{},t=n.includeAuthoredTimingAttrs??!1,i=n.documentRef??document,r=new WeakMap,o=new WeakMap,a=new Set,s=l=>{let f=i.getElementById(l);return f||(Array.from(i.querySelectorAll("[data-composition-id]")).find(_=>_.getAttribute("data-composition-id")===l)??null)},u=(l,f)=>t?l.getAttribute(f):null,d=l=>ke({start:0,duration:l.getAttribute("data-duration"),authoredDuration:u(l,"data-hf-authored-duration")})?.duration??ke({start:R(l,0),end:l.getAttribute("data-end"),authoredEnd:u(l,"data-hf-authored-end")})?.duration??null,m=l=>l!=null&&Number.isFinite(l)&&l>0?l:null,g=l=>{let f=l.getAttribute("data-composition-id");return f?m(ne(e[f])):null},y=l=>{let f=o.get(l);if(f!==void 0)return f;let _=d(l)??m(M(l)?U(l,l.duration):null)??m(we(l))??g(l);return o.set(l,_),_},h=l=>l.hasAttribute("data-composition-src")||l.hasAttribute("data-composition-id")||l.hasAttribute("data-composition-file"),A=l=>{let f=l.parentElement;return!f||!l.hasAttribute("data-composition-id")||Q(l.getAttribute("data-start"))?null:h(f)?f:null},b=(l,f)=>an(R(l,f),A(l)??l),S=(l,f)=>{let _=l.hasAttribute("data-composition-id")?l.parentElement?.closest("[data-composition-id]"):l.closest("[data-composition-id]");return _?b(_,f):0},C=(l,f)=>{let _=Q(l.getAttribute("data-start"));if(!_){let Y=A(l);return Y?R(Y,f):f}if(_.kind==="absolute")return S(l,f)+Math.max(0,_.value);let w=s(_.refId);if(!w)return f;let L=R(w,0),fe=y(w)??0,he=Math.min(0,S(l,0));return Math.max(he,L+fe+_.offset)},R=(l,f)=>{let _=r.get(l);if(_!==void 0)return _??f;if(a.has(l))return f;a.add(l);try{let w=C(l,f);return r.set(l,w),w}finally{a.delete(l)}},k=l=>{let f=l.closest("[data-composition-id]");return{authoredStart:P(l.getAttribute("data-start")),hostStart:f?b(f,0):0,hasAutoStart:l.hasAttribute("data-hf-auto-start"),basis:l.getAttribute(en)}};return{resolveStartForElement:(l,f=0)=>R(l,Math.max(0,f)),resolveDurationForElement:l=>y(l),resolveMediaStartForElement:l=>{let f=k(l);return nn({...f,ordinaryStart:()=>R(l,f.hostStart)})},resolveHostStartForElement:l=>S(l,0),resolveHostSlotsForElement:l=>{let f=[];for(let _=l.parentElement;_;_=_.parentElement){if(!h(_)||A(_)||rt(_)<=0)continue;let w=R(_,0),L=d(_);f.push({start:w,end:L?w+L:1/0})}return f},isRootGlobalMediaStartForElement:l=>M(l)&&rn(k(l))}}function sn(){return{capturedTimeline:null,isPlaying:!1,currentTime:0,deterministicAdapters:[],canonicalFps:30,bridgeMuted:!1,bridgeVolume:1,mediaOutputMuted:!1,nativeMediaSyncDisabled:!1,webAudioMediaDisabled:!1,mediaAutoplayBlockedPosted:!1,mediaForceSyncNextTick:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,controlBridgeHandler:null,beforeUnloadHandler:null,injectedCompStyles:[],injectedCompScripts:[],injectedCompLinks:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,transportClock:null,transportRafId:null}}var un=7200,ot=1/60,re=n=>n!==null&&n>ot?n:null;function Bi(n){return{width:ye(n.getAttribute("data-width")),height:ye(n.getAttribute("data-height"))}}function $i(n,e){let t=[];for(let i of n.querySelectorAll("video[data-start], audio[data-start]")){let r=e.mediaStart(i);if(!Number.isFinite(r))continue;let o=e.mediaDuration(i);o==null||o<=ot||t.push(Math.max(0,r)+o)}return re(_e({authoredDurationSeconds:null,clipEndsSeconds:t}).seconds)}function zi(n,e){let t=[];for(let r of n.querySelectorAll("[data-composition-id][data-start]")){if(r.parentElement?.closest("[data-composition-id]")!==n)continue;let o=e.resolveStartForElement(r,0),a=e.resolveDurationForElement(r);!Number.isFinite(o)||a==null||a<=0||t.push(Math.max(0,o)+a)}let i=P(n.getAttribute("data-duration"));return re(_e({authoredDurationSeconds:null,clipEndsSeconds:[i,...t]}).seconds)}var ji=n=>n.hasAttribute("data-composition-id")||n.hasAttribute("data-composition-src");function qi(n,e,{unregisteredLottie:t}){let i=[];for(let o of n.querySelectorAll("[data-start]")){let a=e.resolveStartForElement(o,0);if(!Number.isFinite(a))continue;let s=e.resolveDurationForElement(o);s!=null?i.push(Math.max(0,a)+s):(M(o)||ji(o))&&i.push(null)}(t||n.querySelector("[data-lottie-src]"))&&i.push(null);let r=_e({authoredDurationSeconds:null,clipEndsSeconds:i});return r.pendingClips>0?{...r,seconds:null,source:"unresolved",reason:"a clip's length is pending"}:r}function Yi(n){if(n.declared!==null&&Number.isFinite(n.declared)&&n.declared>0)return n.declared;let e=re(n.timeline()),t=Math.max(0,...n.floors().map(u=>u??0)),i=Number.isFinite(n.fallback)&&n.fallback>ot?n.fallback:0,r=Math.max(t,i),a=e!==null&&e>=un&&re(r)!==null?null:e,s;return a!==null?s=Math.max(a,r):re(t)!==null?s=r:i>0?s=i:s=n.derived(),s>0?s:0}function ln(n){let e=ve(n);if(!e)return null;let t=H({timelineRegistry:{},includeAuthoredTimingAttrs:!0,documentRef:n}),i=Yi({declared:P(e.getAttribute("data-duration")),timeline:()=>null,floors:()=>[$i(n,{mediaStart:t.resolveMediaStartForElement,mediaDuration:it}),zi(e,t)],fallback:0,derived:()=>qi(e,t,{unregisteredLottie:!1}).seconds??0});return{...Bi(e),fps:sn().canonicalFps,durationSeconds:i}}var dn="hyperframes-studio-preview";var cn="__hfPreviewErrors";function mn(n){return n.hasRuntime||n.runtimeInjected?!1:!!(n.hasNestedCompositions||n.hasTimelines&&n.attempts>=5)}function W(n){return typeof n=="object"&&n!==null}function pn(n){return W(n)&&typeof n.getDuration=="function"}function fn(n){return W(n)&&typeof n.duration=="function"&&typeof n.time=="function"&&typeof n.seek=="function"&&typeof n.play=="function"&&typeof n.pause=="function"}var G="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.8.166/dist/hyperframe.runtime.iife.js";function oe(n){if(n===null)return null;let e=Number.parseInt(n,10);return Number.isFinite(e)&&e>0?e:null}function Xi(n){let e=n?.querySelector("[data-composition-id][data-width][data-height]")??n?.querySelector("[data-width][data-height]");if(!e)return null;let t=oe(e.getAttribute("data-width")),i=oe(e.getAttribute("data-height"));return t!==null&&i!==null?{width:t,height:i}:null}function Ki(n){return Array.isArray(n)?n.find(e=>typeof e=="string"&&e.trim()!==""&&e!=="[object Event]")??null:null}var Me=class{constructor(e,t){this._iframe=e;this._callbacks=t}_iframe;_callbacks;_interval=null;_runtimeInjected=!1;_runtimeScript=null;_failure=null;get failed(){return this._failure!==null&&this._failure.document===this._iframe.contentDocument}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._failure=null,this._runtimeInjected=!1;let e=0;this._interval=setInterval(()=>{e++;let t=null;try{t=this._poll(e)}catch(i){i instanceof DOMException&&i.name==="SecurityError"||(t={kind:"error",message:i instanceof Error?i.message:String(i)})}if(t){this.stop(),t.kind==="error"?(this._failure={document:this._iframe.contentDocument},this._callbacks.onError(t.message)):this._callbacks.onReady(t.result);return}e>=40&&(this.stop(),this._failure={document:this._iframe.contentDocument},this._callbacks.onError("Composition timeline not found after 8s"))},200)}_poll(e){let t=this._iframe.contentWindow;if(!t)return null;let i=Ki(Reflect.get(t,cn));if(i!==null)return{kind:"error",message:i};let r=this._iframe.contentDocument,o=Reflect.get(t,"__timelines"),a=this.hasRuntimeBridge(t);if(mn({hasRuntime:a,hasTimelines:W(o)&&Object.keys(o).length>0,hasNestedCompositions:!!r?.querySelector("[data-composition-src]"),runtimeInjected:this._runtimeInjected,attempts:e}))return this._injectRuntime(),null;if(this._runtimeInjected&&!a)return null;let s=this._resolveReadyResult(t,r);return s?{kind:"ready",result:s}:null}_resolveReadyResult(e,t){let i=this._resolvePlaybackDurationAdapter(e)??{kind:"document",getDuration:()=>0},r=i.getDuration();if(!Number.isFinite(r)||r<=0){if(i.kind==="direct-timeline")return null;r=t?ln(t)?.durationSeconds??0:0}return r<=0?null:{duration:r,adapter:{...i,getDuration:()=>r},compositionSize:Xi(t)}}stop(){this._runtimeScript&&(this._runtimeScript.onerror=null,this._runtimeScript=null),this.failed||(this._failure=null),this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{let e=this._iframe.contentWindow;return e?this._resolveDirectTimelineAdapterFromWindow(e):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(e){return this._resolveDirectTimelineAdapterFromWindow(e)}hasRuntimeBridge(e){return W(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=this._callbacks.resolveRuntimeUrl?.()??G,this._runtimeScript=t,t.onerror=()=>{this._runtimeScript!==t||this._iframe.contentDocument!==e||(this.stop(),this._failure={document:e},this._callbacks.onError("HyperFrames runtime failed to load from "+t.src))},(e.head||e.documentElement).appendChild(t),this._callbacks.onRuntimeInjected?.()}catch{}}_resolveDirectTimelineAdapterFromWindow(e){if(this.hasRuntimeBridge(e))return null;let t=Reflect.get(e,"__timelines");if(!W(t))return null;let i=Object.keys(t);if(i.length===0)return null;let r=this._iframe.contentDocument?.querySelector("[data-composition-id]")?.getAttribute("data-composition-id"),o=r&&r in t?r:i[i.length-1],a=t[o];return fn(a)?a:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(pn(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let i=this._resolveDirectTimelineAdapterFromWindow(e);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}};var hn=`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
position: relative;
|
|
@@ -469,5 +469,5 @@
|
|
|
469
469
|
background: var(--hfp-accent, #fff);
|
|
470
470
|
pointer-events: none;
|
|
471
471
|
}
|
|
472
|
-
`,bn='<svg width="24" height="24" viewBox="46 21 54 56" fill="currentColor"><path d="M87.5129 57.5141L56.9696 73.5433C52.8371 75.7098 48.7046 73.2553 49.6688 69.2104L58.9483 30.1391C59.9125 26.0942 65.2097 23.6397 68.3154 25.8062L91.2447 41.8354C96.4668 45.4796 94.4631 53.8699 87.5129 57.5141Z"/></svg>',gn='<svg width="24" height="24" viewBox="0 0 18 18" fill="currentColor"><rect x="3" y="2" width="4" height="14"/><rect x="11" y="2" width="4" height="14"/></svg>',at='<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M3 9v6h4l5 5V4L7 9H3z"/><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"/><path d="M14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>',st='<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M3 9v6h4l5 5V4L7 9H3z"/><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"/></svg>',_n='<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M3 9v6h4l5 5V4L7 9H3z"/><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z" opacity="0.3"/><line x1="18" y1="7" x2="14" y2="17" stroke="currentColor" stroke-width="2"/></svg>';var ut=[.25,.5,1,1.5,2,4];function ae(n){return Number.isInteger(n)?`${n}x`:`${n}x`}function Ie(n){if(!Number.isFinite(n)||n<0)return"0:00";let e=Math.floor(n),t=Math.floor(e/60),i=e%60;return`${t}:${i.toString().padStart(2,"0")}`}function yn(n,e,t={}){let i=t.speedPresets??ut,r=document.createElement("div");r.className="hfp-controls",r.addEventListener("click",c=>{c.stopPropagation()});let o=document.createElement("button");o.className="hfp-play-btn",o.type="button",o.innerHTML=`<span class="hfp-ico hfp-ico-play">${bn}</span><span class="hfp-ico hfp-ico-pause">${gn}</span>`,o.setAttribute("aria-label","Play");let a=document.createElement("div");a.className="hfp-scrubber";let s=document.createElement("div");s.className="hfp-progress",s.style.width="0%",a.appendChild(s);let u=document.createElement("span");u.className="hfp-time",u.textContent="0:00 / 0:00";let d=document.createElement("div");d.className="hfp-speed-wrap";let m=document.createElement("button");m.className="hfp-speed-btn",m.type="button",m.textContent="1x",m.setAttribute("aria-label","Playback speed");let g=document.createElement("div");g.className="hfp-speed-menu",g.setAttribute("role","menu");for(let c of i){let p=document.createElement("button");p.className="hfp-speed-option",p.type="button",p.setAttribute("role","menuitem"),p.dataset.speed=String(c),p.textContent=ae(c),c===1&&p.classList.add("hfp-active"),g.appendChild(p)}d.appendChild(g),d.appendChild(m);let y=document.createElement("div");y.className="hfp-volume-wrap";let h=document.createElement("button");h.className="hfp-mute-btn",h.type="button",h.innerHTML=at,h.setAttribute("aria-label","Mute");let A=document.createElement("div");A.className="hfp-volume-slider-wrap";let b=document.createElement("div");b.className="hfp-volume-slider",b.setAttribute("role","slider"),b.setAttribute("aria-label","Volume"),b.setAttribute("aria-valuemin","0"),b.setAttribute("aria-valuemax","100"),b.setAttribute("aria-valuenow","100"),b.tabIndex=0;let S=document.createElement("div");S.className="hfp-volume-fill",S.style.width="100%",b.appendChild(S),A.appendChild(b),y.appendChild(A),y.appendChild(h),t.audioLocked&&(y.style.display="none"),r.appendChild(o),r.appendChild(a),r.appendChild(u),r.appendChild(y),r.appendChild(d),n.appendChild(r);let C=!1,R=!1,k=1,F=null,j=i.indexOf(1);j===-1&&(j=0);let q=(c,p)=>c?_n:p===0?st:p<.5?st:at;o.addEventListener("click",c=>{c.stopPropagation(),C?e.onPause():e.onPlay()}),h.addEventListener("click",c=>{c.stopPropagation(),e.onMuteToggle()});let l=!1,f=c=>{let p=b.getBoundingClientRect(),E=Math.max(0,Math.min(1,(c-p.left)/p.width));k=E,S.style.width=`${E*100}%`,b.setAttribute("aria-valuenow",String(Math.round(E*100))),R&&E>0&&e.onMuteToggle(),h.innerHTML=q(R,E),e.onVolumeChange(E)};b.addEventListener("mousedown",c=>{c.stopPropagation(),l=!0,f(c.clientX)});let _=c=>{l&&f(c.clientX)},w=()=>{l=!1};document.addEventListener("mousemove",_),document.addEventListener("mouseup",w),b.addEventListener("touchstart",c=>{l=!0;let p=c.touches[0];p&&f(p.clientX)},{passive:!0});let L=c=>{if(l){let p=c.touches[0];p&&f(p.clientX)}},fe=()=>{l=!1};document.addEventListener("touchmove",L,{passive:!0}),document.addEventListener("touchend",fe);let he=.05;b.addEventListener("keydown",c=>{let p=k;if(c.key==="ArrowRight"||c.key==="ArrowUp")p=Math.min(1,k+he);else if(c.key==="ArrowLeft"||c.key==="ArrowDown")p=Math.max(0,k-he);else return;c.preventDefault(),c.stopPropagation(),k=p,S.style.width=`${p*100}%`,b.setAttribute("aria-valuenow",String(Math.round(p*100))),R&&p>0&&e.onMuteToggle(),h.innerHTML=q(R,p),e.onVolumeChange(p)});let Y=c=>{for(let p of g.querySelectorAll(".hfp-speed-option"))p.classList.toggle("hfp-active",p.dataset.speed===String(c))};m.addEventListener("click",c=>{c.stopPropagation();let p=g.classList.toggle("hfp-open");m.setAttribute("aria-expanded",String(p))}),g.addEventListener("click",c=>{c.stopPropagation();let p=c.target.closest(".hfp-speed-option");if(!p)return;let E=parseFloat(p.dataset.speed);j=i.indexOf(E),m.textContent=ae(E),Y(E),g.classList.remove("hfp-open"),m.setAttribute("aria-expanded","false"),e.onSpeedChange(E)});let Et=()=>{g.classList.remove("hfp-open"),m.setAttribute("aria-expanded","false")};document.addEventListener("click",Et);let be=c=>{let p=a.getBoundingClientRect(),E=Math.max(0,Math.min(1,(c-p.left)/p.width));e.onSeek(E)},N=!1;a.addEventListener("mousedown",c=>{c.stopPropagation(),N=!0,e.onScrubStart?.(),be(c.clientX)});let Tt=c=>{N&&be(c.clientX)},Rt=()=>{N&&(N=!1,e.onScrubEnd?.())};document.addEventListener("mousemove",Tt),document.addEventListener("mouseup",Rt),a.addEventListener("touchstart",c=>{N=!0,e.onScrubStart?.();let p=c.touches[0];p&&be(p.clientX)},{passive:!0});let xt=c=>{if(N){let p=c.touches[0];p&&be(p.clientX)}},wt=()=>{N&&(N=!1,e.onScrubEnd?.())};document.addEventListener("touchmove",xt,{passive:!0}),document.addEventListener("touchend",wt);let kt=()=>{F&&clearTimeout(F),F=setTimeout(()=>{C&&r.classList.add("hfp-hidden")},3e3)},ge=n instanceof ShadowRoot?n.host:n,Mt=()=>{r.classList.remove("hfp-hidden"),kt()},It=()=>{C&&r.classList.add("hfp-hidden")};return ge.addEventListener("mousemove",Mt),ge.addEventListener("mouseleave",It),{updateTime(c,p){let E=p>0?Math.min(c,p):c,Kn=p>0?E/p*100:0;s.style.width=`${Kn}%`,u.textContent=`${Ie(E)} / ${Ie(p)}`},updatePlaying(c){C=c,o.classList.toggle("hfp-playing",c),o.setAttribute("aria-label",c?"Pause":"Play"),c?kt():r.classList.remove("hfp-hidden")},updateSpeed(c){let p=i.indexOf(c);p!==-1&&(j=p),m.textContent=ae(c),Y(c)},updateMuted(c){R=c,h.innerHTML=q(c,k),h.setAttribute("aria-label",c?"Unmute":"Mute")},updateVolume(c){k=c,S.style.width=`${c*100}%`,b.setAttribute("aria-valuenow",String(Math.round(c*100))),h.innerHTML=q(R,c)},setVolumeControlsHidden(c){y.style.display=c?"none":""},show(){r.style.display=""},hide(){r.style.display="none"},destroy(){document.removeEventListener("mousemove",Tt),document.removeEventListener("mouseup",Rt),document.removeEventListener("touchmove",xt),document.removeEventListener("touchend",wt),document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",w),document.removeEventListener("touchmove",L),document.removeEventListener("touchend",fe),document.removeEventListener("click",Et),ge.removeEventListener("mousemove",Mt),ge.removeEventListener("mouseleave",It),F&&clearTimeout(F),r.remove()}}}function vn(n,e,t,i,r,o=!1){let a=i?i.split(",").map(Number).filter(d=>!isNaN(d)&&d>0):void 0,s={...a?{speedPresets:a}:{},audioLocked:o},u=yn(n,r,s);return u.updateMuted(e),u.updateVolume(t),u}function lt(n,e,t){return e?(t||(t=document.createElement("img"),t.className="hfp-poster",n.appendChild(t)),t.src=e,t):(t?.remove(),null)}function An(n){return n.composedPath().some(e=>e instanceof HTMLElement&&e.classList.contains("hfp-controls"))}var De=null;function Sn(n,e){if(typeof CSSStyleSheet<"u")try{De||(De=new CSSStyleSheet,De.replaceSync(e)),n.adoptedStyleSheets=[De];return}catch{}let t=document.createElement("style");t.textContent=e,n.appendChild(t)}function En(){let n=document.createElement("div");n.className="hfp-container";let e=document.createElement("iframe");return e.className="hfp-iframe",e.sandbox.add("allow-scripts","allow-same-origin"),e.allow="autoplay; fullscreen",e.referrerPolicy="no-referrer",e.title="HyperFrames Composition",n.appendChild(e),{container:n,iframe:e}}function Tn(n,e,t,i){let r=n.offsetWidth,o=n.offsetHeight;if(r===0||o===0)return!1;let a=Math.min(r/t,o/i);return e.style.width=`${t}px`,e.style.height=`${i}px`,e.style.transform=`translate(-50%, -50%) scale(${a})`,!0}function Ki(n,e,t){if(t.end<=0)return!1;let i=t.shown<t.end&&e>0?e+.001:0;return n+i>=t.end}var Ce=class{constructor(e){this._callbacks=e}_callbacks;_raf=null;_lastUpdateMs=0;_tick=null;start(e,t,i,r,o){this.stop();let a=null,s=0,u=0,d=()=>{if(r()){this._raf=null;return}let m;try{m=e.time()}catch{this._raf=null;return}let g=i(),y=o();y.end>0&&(m=Math.min(m,y.end));let h=a===null?0:m-a;h!==0&&(u=Math.min(h,s),s=h),a=m;let A=Ki(m,u,y);A&&(m=y.shown);let b=performance.now();if((b-this._lastUpdateMs>100||A)&&(this._lastUpdateMs=b,this._callbacks.onTimeUpdate(m,g)),A){if(this._callbacks.getLoop()){this._callbacks.restart();return}try{e.pause(),y.shown<y.end&&e.seek(y.shown,!1)}catch{}this._callbacks.onPaused(),this._raf=null;return}this._raf=requestAnimationFrame(d)};this._tick=d,this._raf=requestAnimationFrame(d)}poll(){this._raf===null||!this._tick||(cancelAnimationFrame(this._raf),this._tick())}stop(){this._raf!==null&&(cancelAnimationFrame(this._raf),this._raf=null)}get isRunning(){return this._raf!==null}};function Rn(n){let e=Array.from(n.querySelectorAll("[data-composition-id]"));if(e.length===0)return n.body?[n.body]:[];let t=[];for(let i of e)Zi(i)||t.push(i);return Ji(n),t}function Ji(n){let e=n.body;if(!e||typeof console>"u"||typeof console.warn!="function")return;let t=e.querySelectorAll("audio[data-start], video[data-start]");if(t.length===0)return;let i=[];for(let r of t)r.closest("[data-composition-id]")||i.push(r);i.length!==0&&console.warn(`[hyperframes-player] selectMediaObserverTargets: composition hosts are present, but ${i.length} body-level timed media element(s) sit outside every [data-composition-id] subtree and will not be observed. Move them inside a composition host or the parent-frame proxy will never adopt them.`,i)}function Zi(n){let e=n.parentElement;for(;e;){if(e.hasAttribute("data-composition-id"))return!0;e=e.parentElement}return!1}var Qi=n=>4*Number.EPSILON*Math.max(1,Math.abs(n));function Ne(n,e){return!Number.isFinite(n)||!Number.isFinite(e)?n===e:Math.abs(n-e)<=Qi(Math.max(Math.abs(n),Math.abs(e)))}var xn=(n,e)=>n>=e||Ne(n,e),Pe=(n,e,t)=>xn(n,e)&&n<t&&!Ne(n,t),er=1e-6,dt=(n,e,t,i)=>Pe(n,e,t)||xn(n,e)&&i>0&&t>=i-er;var nr="data-fade-in",ir="data-fade-out",La=nr.slice(5),Oa=ir.slice(5),rr=Object.freeze({fadeIn:0,fadeOut:0});var wn=':not([muted]):is(:not([data-has-audio]),[data-has-audio="true"])',Va=`audio[data-start], video[data-start]${wn}`;var Ss=1/16;var sr=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],ws=new Set([...sr,"contain","isolation","mask-border","mix-blend-mode","opacity"]);function ur(n){return Number.isFinite(n)&&n>0?n:30}function lr(n){return Number.isFinite(n)&&n>0?n:0}function kn(n,e){let t=ur(e),i=lr(n),r=i*t,o=Math.round(r);return Math.abs(r-o)<=.001?o/t:i}function Mn(n,e,t){return{start:kn(n,t),end:Number.isFinite(e)?kn(e,t):e}}var dr=["seconds-time","rational-fps","seek-keep-playing","composition-manifest-v1","runtime-data","play-range"];function cr(n,e){let t=Math.abs(n),i=Math.abs(e);for(;i!==0;){let r=t%i;t=i,i=r}return t||1}function mr(n){let e=Number.isFinite(n)&&n>0?n:30,t=Number.isInteger(e)?1:1e6,i=Math.round(e*t),r=cr(i,t);return{numerator:i/r,denominator:t/r}}function In(n,e,t){return Math.max(n,(Math.ceil(e*t-1e-6)-1)/t)}function pr(n){if(typeof n!="object"||n===null)return null;let e=n;return!Number.isFinite(e.numerator)||!Number.isFinite(e.denominator)||(e.numerator??0)<=0||(e.denominator??0)<=0?null:Number(e.numerator)/Number(e.denominator)}function ct(n){return{protocolVersion:1,capabilities:dr,fps:mr(n)}}function Dn(n){let e=n.offsetWidth,t=n.getBoundingClientRect().width;return e>0&&t>0?t/e:null}function fr(n){return Array.isArray(n)&&n.every(e=>typeof e=="string")}function Cn(n,e=30){if(typeof n!="object"||n===null)return{status:"legacy",fps:e};let t=n;if(t.protocolVersion===void 0)return{status:"legacy",fps:e};if(t.protocolVersion!==1)return{status:"unsupported",code:"unsupported_protocol_version",receivedVersion:t.protocolVersion};let i=pr(t.fps);return i===null||!fr(t.capabilities)?{status:"unsupported",code:"invalid_protocol_metadata",receivedVersion:t.protocolVersion}:{status:"supported",fps:i,metadata:t}}function Nn(n,e){let t=n.tagName.toLowerCase();if(t==="script"||t==="style"||t==="link"||t==="meta")return!1;let r=t==="video"||t==="audio"?e.resolver.resolveMediaStartForElement(n):e.resolver.resolveStartForElement(n,0),o=e.resolver.resolveDurationForElement(n),a=n.getAttribute("data-composition-id");if(a){let d=e.timelineRegistry[a],m=ne(d);!(n.hasAttribute("data-duration")||n.hasAttribute("data-end")||n.hasAttribute(Zt)||n.hasAttribute(Qt))&&(o==null||o<=0)&&m!=null&&m>0&&(o=m)}let s=o!=null&&o>0?r+o:Number.POSITIVE_INFINITY,u=e.exportRenderSeek?Mn(r,s,e.canonicalFps):{start:r,end:s};return dt(e.currentTime,u.start,u.end,e.compositionDuration)}var B="first-frame",hr=3;function se(n){let e=n.ownerDocument?.defaultView;return e&&n instanceof e.Element?!0:n instanceof Element}function x(n){if(!se(n)||n.tagName!=="AUDIO"&&n.tagName!=="VIDEO")return!1;let e=n.ownerDocument?.defaultView;return e&&n instanceof e.HTMLMediaElement?!0:n instanceof HTMLMediaElement}function br(n){return n.hasAttribute("data-start")||n.hasAttribute("data-track-index")}function gr(n,e,t){let i=n;for(;i;){if(br(i)&&!Nn(i,{currentTime:0,compositionDuration:Number.POSITIVE_INFINITY,canonicalFps:30,exportRenderSeek:!1,timelineRegistry:t,resolver:e}))return!1;i=i.parentElement}return!0}function Pn(n,e,t,i){return e==="all"?!0:gr(n,t,i)}function Le(n,{scope:e="all"}={}){let t=n.defaultView,i=H({documentRef:n,timelineRegistry:t?.__timelines,includeAuthoredTimingAttrs:!0}),r=n.querySelector(`meta[name="${dn}"]`)!==null,o=Array.from(n.querySelectorAll("video, audio")).filter(x).filter(u=>Pn(u,r&&u.preload!=="auto"?B:e,i,t?.__timelines??{})).filter(u=>u.readyState<hr),a=Array.from(n.querySelectorAll("img")).filter(u=>Pn(u,u.getAttribute("loading")?.toLowerCase()==="lazy"?B:e,i,t?.__timelines??{})).filter(u=>!u.complete),s=n.fonts?.status==="loading";return{pendingMedia:o,pendingImages:a,fontsLoading:s}}function _r(n,{pendingMedia:e,pendingImages:t,fontsLoading:i},r){let o=e.map(u=>new Promise(d=>{if(u.error){d();return}let m=()=>{u.removeEventListener("canplay",m),u.removeEventListener("error",m),r.removeEventListener("abort",m),d()};u.addEventListener("canplay",m),u.addEventListener("error",m),r.addEventListener("abort",m,{once:!0})})),a=t.map(u=>u.decode?u.decode().catch(()=>{}):Promise.resolve()),s=i&&n.fonts?n.fonts.ready.then(()=>{}):Promise.resolve();return Promise.all([...o,...a,s]).then(()=>{})}function yr(n,e,{scope:t="all"}={}){let i=Le(n,{scope:t});return i.pendingMedia.length===0&&i.pendingImages.length===0&&!i.fontsLoading?null:_r(n,i,e)}var vr=50;function Ar(n,e){let t=n.defaultView;return!t||t.__renderReady||!t.__hf?null:new Promise(i=>{let r,o=()=>{r!==void 0&&clearTimeout(r),e.removeEventListener("abort",o),i()};if(e.aborted){o();return}e.addEventListener("abort",o,{once:!0});let a=()=>{if(t.__renderReady){o();return}r=setTimeout(a,vr)};a()})}var Sr=50,Er=1.5,Tr=2,Rr=1500;function mt(n,e){return new Promise(t=>{if(e.aborted){t(-1);return}let i=0,r=()=>{n.cancelAnimationFrame?.(i),t(-1)};e.addEventListener("abort",r,{once:!0}),i=n.requestAnimationFrame(o=>{e.removeEventListener("abort",r),t(o)})})}function xr(n,e){let t=n.defaultView;return t?(async()=>{let i=await mt(t,e);if(e.aborted)return;let r=await mt(t,e),o=r-i,a=0;for(;!e.aborted&&a<Tr;){if(r-i>=Rr)return;let s=await mt(t,e);if(e.aborted)return;let u=s-r;o=Math.min(o,u),a=u<Sr||u<=o*Er?a+1:0,r=s}})():null}var wr=8e3;function kr(n,e,t={}){let i=t.inputs??[(d,m)=>yr(d,m,{scope:t.scope}),Ar,xr],r=new AbortController,o=i.map(d=>d(n,r.signal)).filter(d=>d!==null);if(o.length===0){e({timedOut:!1});return}let a=t.timeoutMs??wr,s,u=new Promise(d=>{s=setTimeout(()=>d("timed-out"),a)});Promise.race([Promise.all(o).then(()=>"done"),u]).then(d=>{clearTimeout(s),r.abort(),e({timedOut:d==="timed-out"})})}function Ln(n,e,t={}){kr(n,e,{...t,scope:B})}var Mr=.05,Ir=2,Oe=class{_entries=[];_mediaObserver;_playbackErrorPosted=!1;_audioOwner="runtime";_urlAudioEntry=null;_urlAudioSrc=null;_dispatchEvent;_getMuted;_getVolume;_getPlaybackRate;_getCurrentTime;_isPaused;constructor(e){this._dispatchEvent=e.dispatchEvent,this._getMuted=e.getMuted,this._getVolume=e.getVolume,this._getPlaybackRate=e.getPlaybackRate,this._getCurrentTime=e.getCurrentTime,this._isPaused=e.isPaused}get audioOwner(){return this._audioOwner}get entries(){return this._entries}resetForIframeLoad(){this._playbackErrorPosted=!1;let e=this._audioOwner==="parent";this._audioOwner="runtime",this.pauseAll();for(let t of this._entries)t!==this._urlAudioEntry&&(t.el.src="");this._entries=this._urlAudioEntry?[this._urlAudioEntry]:[],this._urlAudioSrc&&!this._urlAudioEntry&&(this._urlAudioEntry=this._createEntry(this._urlAudioSrc,"audio",0,1/0)),this.teardownObserver(),e&&this._dispatchEvent(new CustomEvent("audioownershipchange",{detail:{owner:"runtime",reason:"iframe-reload"}}))}destroy(){this.teardownObserver();for(let e of this._entries)e.el.pause(),e.el.src="";this._entries=[],this._urlAudioEntry=null,this._urlAudioSrc=null,this._audioOwner="runtime",this._playbackErrorPosted=!1}updateMuted(e){for(let t of this._entries)t.el.muted=e}updateVolume(e){for(let t of this._entries)t.el.volume=e}updatePlaybackRate(e){for(let t of this._entries)t.el.playbackRate=e}_playEntry(e){e.el.src&&e.el.play().catch(t=>this._reportPlaybackError(t))}_playEntryIfActive(e){this._refreshEntryBounds(e),this._inWindow(e,this._getCurrentTime())&&this._playEntry(e)}_refreshEntryBounds(e){if(!e.source?.isConnected)return;let t=et(e.source);e.start=t.start??0,e.duration=t.duration!=null&&t.duration>0?t.duration:Number.POSITIVE_INFINITY}_inWindow(e,t){return Pe(t,e.start,e.start+e.duration)}_gateEntryPlayback(e,t){return this._inWindow(e,t)?(this._audioOwner==="parent"&&!this._isPaused()&&e.el.paused&&this._playEntry(e),!0):(e.el.paused||e.el.pause(),e.driftSamples=0,!1)}playAll(){for(let e of this._entries)this._playEntryIfActive(e)}pauseAll(){for(let e of this._entries)e.el.pause()}stopAdoptedMedia(){for(let e of this._entries)e.source&&e.el.pause()}seekAll(e){for(let t of this._entries)this._refreshEntryBounds(t),this._inWindow(t,e)&&(t.el.currentTime=e-t.start)}scrubAll(e){for(let t of this._entries)this._refreshEntryBounds(t),this._inWindow(t,e)?(t.el.currentTime=e-t.start,this._playEntry(t)):t.el.paused||t.el.pause()}mirrorTime(e,t){let i=t?.force===!0;for(let r of this._entries){if(this._refreshEntryBounds(r),!this._gateEntryPlayback(r,e))continue;let o=e-r.start;Math.abs(r.el.currentTime-o)>Mr?(r.driftSamples+=1,(i||r.driftSamples>=Ir)&&(r.el.currentTime=o,r.driftSamples=0)):r.driftSamples=0}}promoteToParentProxy(e,t){if(this._audioOwner==="parent")return;if(this._audioOwner="parent",e)for(let r of e.querySelectorAll("video, audio"))x(r)&&(r.muted=!0);for(let r of[...this._entries])this._repointToSource(r);let i=this._getCurrentTime();t?t(i,{force:!0}):this.mirrorTime(i,{force:!0}),this._isPaused()||this.playAll(),this._dispatchEvent(new CustomEvent("audioownershipchange",{detail:{owner:"parent",reason:"autoplay-blocked"}}))}setupFromIframe(e){let t=e.querySelectorAll("audio[data-start], video[data-start]");for(let i of t)x(i)&&this._adoptIframeMedia(i);this._observeDynamicMedia(e)}setupFromUrl(e){if(this._urlAudioSrc===e&&this._urlAudioEntry)return;this.teardownUrlAudio();let t=this._createEntry(e,"audio",0,1/0);this._urlAudioEntry=t,this._urlAudioSrc=e,t&&this._audioOwner==="parent"&&!this._isPaused()&&(this.mirrorTime(this._getCurrentTime(),{force:!0}),this.playAll())}teardownUrlAudio(){let e=this._urlAudioEntry;if(this._urlAudioEntry=null,this._urlAudioSrc=null,!e)return;e.el.pause(),e.el.src="";let t=this._entries.indexOf(e);t!==-1&&this._entries.splice(t,1)}teardownObserver(){this._mediaObserver?.disconnect(),this._mediaObserver=void 0}_reportPlaybackError(e){this._playbackErrorPosted||(this._playbackErrorPosted=!0,this._dispatchEvent(new CustomEvent("playbackerror",{detail:{source:"parent-proxy",error:e}})))}_createEntry(e,t,i,r,o){if(this._urlTaken(e))return null;let a=t==="video"?document.createElement("video"):new Audio;a.preload="auto",a.src=e,a.load(),a.muted=this._getMuted(),a.volume=this._getVolume();let s=this._getPlaybackRate();s!==1&&(a.playbackRate=s);let u={el:a,start:i,duration:r,driftSamples:0,source:o};return this._entries.push(u),u}_resolveIframeMediaSrc(e){let t=e.getAttribute("src")||e.querySelector("source")?.getAttribute("src");return t?new URL(t,e.ownerDocument.baseURI).href:null}_adoptIframeMedia(e){if(e.preload==="metadata"||e.preload==="none")return;let t=this._resolveIframeMediaSrc(e);if(!t)return;let i=et(e),r=i.start??0,o=i.duration??Number.POSITIVE_INFINITY,a=e.tagName==="VIDEO"?"video":"audio",s=this._createEntry(t,a,r,o,e);s&&this._audioOwner==="parent"&&(this.mirrorTime(this._getCurrentTime(),{force:!0}),this._isPaused()||this._playEntryIfActive(s))}_followIframeMediaSrc(e){let t=this._entries.find(i=>i.source===e);if(!t)return this._adoptIframeMedia(e);this._audioOwner!=="parent"||!this._repointToSource(t)||(this.mirrorTime(this._getCurrentTime(),{force:!0}),this._isPaused()||this._playEntryIfActive(t))}_urlTaken(e,t){return this._entries.some(i=>i===t||i.source&&!i.source.isConnected?!1:(i.source&&this._resolveIframeMediaSrc(i.source)||i.el.src)===e)}_repointToSource(e){let t=e.source?this._resolveIframeMediaSrc(e.source):null;return!t||e.el.src===t?!1:this._urlTaken(t,e)?(this._removeEntry(e),!1):(e.el.src=t,e.el.load(),!0)}_detachIframeMedia(e){let t=this._entries.find(i=>i.source===e);t&&this._removeEntry(t)}_removeEntry(e){e.el.pause(),e.el.src="",this._entries.splice(this._entries.indexOf(e),1)}_observeDynamicMedia(e){if(this.teardownObserver(),typeof MutationObserver>"u"||!e.body)return;let t=new MutationObserver(o=>{for(let a of o){if(a.type==="attributes"&&a.attributeName==="src"){let s=a.target;x(s)&&s.matches("audio[data-start], video[data-start]")&&this._followIframeMediaSrc(s);continue}if(a.type==="attributes"&&a.attributeName==="preload"){let s=a.target;x(s)&&s.matches("audio[data-start], video[data-start]")&&(s.preload==="auto"?this._adoptIframeMedia(s):this._detachIframeMedia(s));continue}for(let s of a.addedNodes){if(!se(s))continue;let u=[];x(s)&&s.matches("audio[data-start], video[data-start]")&&u.push(s);let d=s.querySelectorAll("audio[data-start], video[data-start]");for(let m of d)x(m)&&u.push(m);for(let m of u)this._adoptIframeMedia(m)}for(let s of a.removedNodes){if(!se(s))continue;let u=[];x(s)&&s.matches("audio[data-start], video[data-start]")&&u.push(s);let d=s.querySelectorAll("audio[data-start], video[data-start]");for(let m of d)x(m)&&u.push(m);for(let m of u)this._detachIframeMedia(m)}}}),i={childList:!0,subtree:!0,attributes:!0,attributeFilter:["preload","src"]},r=Rn(e);for(let o of r)t.observe(o,i);this._mediaObserver=t}};function pt(n,e,t){if(n===null&&e===null)return{range:null,clamped:!1};let i=n??0,r=e!==null&&t>0&&e>t,o=r?t:e,a=o??(t>0?t:1/0);return!(i>=0)||!(a>i)?{range:null,clamped:!0}:{range:{start:i,end:o},clamped:r}}function ue(n,e,t){let i=n.end??e;return i<e?In(n.start,i,t):i}function ft(n,e,t,i){return n<e.start||n>=ue(e,t,i)}var Dr=100;function Cr(n,e){return typeof n.currentTime=="number"&&Number.isFinite(n.currentTime)?n.currentTime:(n.frame??0)/e}function On(n,e,t){return t<=0?!1:n.ended===!0?!0:n.ended===!1&&!n.isPlaying?!1:e>=t}function Nr(n,e,t,i,r,o){let{duration:a}=t;if(!r){let s=On(n,e,a);return{start:0,shownAtEnd:a,atEnd:s,stopRuntime:!1,entering:!1}}if(n.ownsRange){let s=i&&n.ended===!0&&!n.isPlaying;return{start:r.start,shownAtEnd:e,atEnd:s,stopRuntime:!1,entering:!1}}return Pr(n,e,t,i,r,o)}function Pr(n,e,t,i,r,o){let a=r.end??t.duration,s=t.enteringRange===!0&&(e<r.start||e>=a);return{start:r.start,shownAtEnd:ue(r,t.duration,o),atEnd:i&&!s&&On(n,e,a),stopRuntime:n.isPlaying,entering:s}}function Fn(n,e,t,i){let r=Cr(n,e),o=!t.paused,a=o||n.isPlaying,s=i.getPlayRange?.(),u=Nr(n,r,t,a,s,e),{atEnd:d,start:m}=u,g=t.duration>0?Math.min(r,t.duration):r,y=d?u.shownAtEnd:g,h=!n.isPlaying,A=d&&a;if(A&&i.getLoop())return i.media.audioOwner==="parent"&&i.media.pauseAll(),i.seek(m),i.play(),{...t,currentTime:m,paused:!1,enteringRange:!0};let b={...t,currentTime:y,paused:h,enteringRange:u.entering};i.media.audioOwner==="parent"&&(o&&h?i.media.pauseAll():!o&&!h&&i.media.playAll(),i.media.mirrorTime(y));let S=performance.now(),C=h!==t.paused;return(S-t.lastUpdateMs>Dr||C)&&(b.lastUpdateMs=S,i.updateControlsTime(y,t.duration),i.updateControlsPlaying(!h),i.dispatchEvent(new CustomEvent("timeupdate",{detail:{currentTime:y}}))),A&&(u.stopRuntime&&i.seek(y),i.media.audioOwner==="parent"&&i.media.pauseAll(),b.paused=!0,i.updateControlsPlaying(!1),i.dispatchEvent(new Event("ended"))),b}function Lr(n){return Array.isArray(n)?n.filter(e=>typeof e=="object"&&e!==null&&typeof e.id=="string"&&typeof e.start=="number"&&typeof e.duration=="number"):[]}function Vn(n,e,t){if(n.source!==e)return;let i=n.data;if(!i||i.source!=="hf-preview")return;let r=Cn(i);if(r.status==="unsupported"){t.dispatchEvent(new CustomEvent("runtimeprotocolerror",{detail:{code:r.code,receivedVersion:r.receivedVersion}}));return}t.setRuntimeFps?.(r.fps);let o=r.status==="supported"&&r.metadata.capabilities.includes("play-range");if(t.setRuntimeOwnsPlayRange?.(o),i.type==="shader-transition-state"){let a=i.state&&typeof i.state=="object"?i.state:{};t.shaderLoader.update(a,t.getShaderLoadingMode()),t.dispatchEvent(new CustomEvent("shadertransitionstate",{detail:{compositionId:i.compositionId,state:a}}));return}if(i.type==="ready"){t.onRuntimeReady();return}if(i.type==="assets-ready"){t.onRuntimeAssetsReady?.(i.timedOut===!0);return}if(i.type==="runtime-data-error"){t.onRuntimeDataError?.(i.channel,i.requestId,i.message);return}if(i.type==="runtime-data-applied"){t.onRuntimeDataApplied?.(i.channel,i.requestId);return}if(i.type==="state"){t.setPlaybackState(Fn({frame:i.frame??0,currentTime:i.currentTime,ended:typeof i.ended=="boolean"?i.ended:void 0,isPlaying:!!i.isPlaying,ownsRange:o},r.fps,t.getPlaybackState(),t));return}if(i.type==="media-autoplay-blocked"){if(t.shouldPromoteMediaAutoplayFallback?.()===!1)return;let a=null;try{a=t.getIframeDoc()}catch{}t.media.promoteToParentProxy(a,(s,u)=>t.media.mirrorTime(s,u)),t.sendControl("set-media-output-muted",{muted:!0});return}if(i.type==="timeline"&&i.durationInFrames>0){let a=Number(i.durationSeconds),s=Number(i.durationInFrames),u=Number.isFinite(a)&&a>0?a:s/r.fps;if(Number.isFinite(i.compositionWidth)&&i.compositionWidth>0&&Number.isFinite(i.compositionHeight)&&i.compositionHeight>0&&t.setCompositionSize(i.compositionWidth,i.compositionHeight),Number.isFinite(u)&&u>0){let d=t.getPlaybackState();t.setPlaybackState({...d,duration:u}),t.updateControlsTime(d.currentTime,u),t.onRuntimeTimelineReady(u,typeof i.assetsReady=="boolean"?i.assetsReady:void 0)}t.setScenes(Lr(i.scenes));return}i.type==="stage-size"&&Number.isFinite(i.width)&&i.width>0&&Number.isFinite(i.height)&&i.height>0&&t.setCompositionSize(i.width,i.height)}function Or(n,e){return n.includes(e)?!0:/hyperframe\.runtime\.iife\.js|__hyperframes\s*=/.test(n)}var Fr=new Set([">"," "," ",`
|
|
473
|
-
`,"\r","\f"]);function ht(n,e){let t=n.toLowerCase(),i=`<${e}`,r=0;for(;r<t.length;){let o=t.indexOf(i,r);if(o<0)return null;let a=t[o+i.length];if(Fr.has(a)){let s=t.indexOf(">",o+i.length);return s<0?null:{index:o,end:s+1}}r=o+i.length}return null}function Un(n,e){if(!n||Or(n,e))return n;let t=`<script src="${e}"></script>`,i=ht(n,"head");if(i)return n.slice(0,i.end)+t+n.slice(i.end);let r=ht(n,"body");if(r)return n.slice(0,r.index)+t+n.slice(r.index);let o=ht(n,"html");return o?n.slice(0,o.end)+t+n.slice(o.end):t+n}var O="shader-capture-scale",$="shader-loading",Fe="runtime-src",Hn="__hf_shader_capture_scale",Wn="__hf_shader_loading",z=["Preparing scene transitions","Sampling outgoing scene motion","Sampling incoming scene motion","Caching transition frames","Finalizing transition preview"];function bt(n){if(n===null)return null;let e=Number(n);return!Number.isFinite(e)||e<=0?null:String(Math.min(1,Math.max(.25,e)))}function Vr(n){if(n===null||n.trim()==="")return"composition";let e=n.trim().toLowerCase();return e==="none"||e==="false"||e==="0"||e==="off"?"none":e==="player"||e==="true"||e==="1"||e==="on"?"player":"composition"}function Gn(n,e){return n.filter(t=>t!==""&&t.split("=")[0]!==e)}function Ur(n,e,t){let i=n.indexOf("#"),r=i>=0?n.slice(0,i):n,o=i>=0?n.slice(i):"",a=r.indexOf("?"),s=a>=0?r.slice(0,a):r,u=a>=0?r.slice(a+1):"",d=Gn(u.split("&"),Hn);d=Gn(d,Wn),e!==null&&d.push(`${Hn}=${encodeURIComponent(e)}`),t!=="composition"&&d.push(`${Wn}=${encodeURIComponent(t)}`);let m=d.join("&");return`${s}${m?`?${m}`:""}${o}`}function Hr(n,e,t){if(e===null&&t==="composition")return n;let i=[];e!==null&&i.push(`window.__HF_SHADER_CAPTURE_SCALE=${JSON.stringify(e)};`),t!=="composition"&&i.push(`window.__HF_SHADER_LOADING=${JSON.stringify(t)};`);let r=`<script data-hyperframes-player-shader-options>${i.join("")}</script>`;return/<head\b[^>]*>/i.test(n)?n.replace(/<head\b[^>]*>/i,o=>`${o}${r}`):/<html\b[^>]*>/i.test(n)?n.replace(/<html\b[^>]*>/i,o=>`${o}${r}`):`${r}${n}`}function le(n){return Vr(n.getAttribute($))}function Bn(n){return Number(bt(n.getAttribute(O))??"1")}function $n(n,e){return Ur(e,bt(n.getAttribute(O)),le(n))}function de(n,e){return Un(Hr(e,bt(n.getAttribute(O)),le(n)),gt(n))}function gt(n){let e=n.getAttribute(Fe)?.trim();if(!e)return G;try{let t=new URL(e,document.baseURI),i=t.protocol==="http:"||t.protocol==="https:",r=t.hostname==="127.0.0.1"||t.hostname==="localhost"||t.hostname==="[::1]";return i&&(r||t.origin===location.origin)?t.href:G}catch{return G}}function zn(){let n=document.createElement("div");n.className="hfp-shader-loader",n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),n.setAttribute("aria-label","Preparing scene transitions"),n.setAttribute("data-hyperframes-ignore",""),n.draggable=!1;let e=h=>{h.preventDefault(),h.stopPropagation()};for(let h of["selectstart","dragstart","pointerdown","mousedown","click","dblclick","contextmenu","touchstart"])n.addEventListener(h,e,{capture:!0});let t=document.createElement("div");t.className="hfp-shader-loader-panel",t.draggable=!1;let i=document.createElement("div");i.className="hfp-shader-loader-mark",i.draggable=!1,i.innerHTML=['<svg width="78" height="78" viewBox="0 0 100 100" fill="none" aria-hidden="true" draggable="false">','<path d="M10.1851 57.8021L33.1145 73.8313C36.2202 75.9978 41.5173 73.5433 42.4816 69.4984L51.7611 30.4271C52.7253 26.3822 48.5802 23.9277 44.4602 26.0942L13.917 42.1235C6.96677 45.7676 4.97564 54.1579 10.1851 57.8021Z" fill="url(#hfp-shader-loader-grad-left)"/>','<path d="M87.5129 57.5141L56.9696 73.5433C52.8371 75.7098 48.7046 73.2553 49.6688 69.2104L58.9483 30.1391C59.9125 26.0942 65.2097 23.6397 68.3154 25.8062L91.2447 41.8354C96.4668 45.4796 94.4631 53.8699 87.5129 57.5141Z" fill="url(#hfp-shader-loader-grad-right)"/>',"<defs>",'<linearGradient id="hfp-shader-loader-grad-left" x1="48.5676" y1="25" x2="44.7804" y2="71.9384" gradientUnits="userSpaceOnUse">','<stop stop-color="#06E3FA"/>','<stop offset="1" stop-color="#4FDB5E"/>',"</linearGradient>",'<linearGradient id="hfp-shader-loader-grad-right" x1="54.8282" y1="73.8392" x2="72.0989" y2="32.8932" gradientUnits="userSpaceOnUse">','<stop stop-color="#06E3FA"/>','<stop offset="1" stop-color="#4FDB5E"/>',"</linearGradient>","</defs>","</svg>"].join("");let r=document.createElement("div");r.className="hfp-shader-loader-title";let o=document.createElement("span");o.className="hfp-shader-loader-title-text",o.textContent=z[0]||"Preparing scene transitions",r.appendChild(o);let a=document.createElement("div");a.className="hfp-shader-loader-detail",a.textContent="Rendering animated scene samples for shader transitions.";let s=document.createElement("div");s.className="hfp-shader-loader-track",s.setAttribute("aria-hidden","true");let u=document.createElement("div");u.className="hfp-shader-loader-fill",s.appendChild(u);let d=document.createElement("div");d.className="hfp-shader-loader-progress";let m=h=>{let A=document.createElement("div");A.className="hfp-shader-loader-row";let b=document.createElement("span");b.className="hfp-shader-loader-label",b.textContent=h;let S=document.createElement("span");return S.className="hfp-shader-loader-value",A.appendChild(b),A.appendChild(S),d.appendChild(A),{row:A,label:b,value:S}},g=m("transition"),y=m("transition frame");return t.appendChild(i),t.appendChild(r),t.appendChild(a),t.appendChild(s),t.appendChild(d),n.appendChild(t),{root:n,fill:u,title:o,detail:a,transitionValue:g.value,transitionRow:g.row,frameLabel:y.label,frameValue:y.value,frameRow:y.row}}var Wr=420;function Ve(n,e,t){e.textContent=t,n.style.visibility=t?"visible":"hidden"}var Ue=class{_el;_hideTimeout=null;_hiddenCallbacks=[];_drawingAssets=!1;constructor(e){this._el=e}show(){this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null),this._el.root.classList.remove("hfp-hiding"),this._el.root.classList.add("hfp-visible")}hide(){if(this._el.root.classList.contains("hfp-hiding")){this._hideTimeout||this._scheduleCleanup();return}this._el.root.classList.contains("hfp-visible")&&(this._el.root.classList.add("hfp-hiding"),this._el.root.classList.remove("hfp-visible"),this._scheduleCleanup())}whenHidden(e){let t=this._el.root.classList;t.contains("hfp-visible")||t.contains("hfp-hiding")?this._hiddenCallbacks.push(e):e()}_flushHidden(){let e=this._hiddenCallbacks;this._hiddenCallbacks=[];for(let t of e)t()}reset(){this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null),this._el.root.classList.remove("hfp-visible","hfp-hiding"),this._drawingAssets=!1,this._flushHidden(),this._el.fill.style.transform="scaleX(0)",Ve(this._el.transitionRow,this._el.transitionValue,""),Ve(this._el.frameRow,this._el.frameValue,"")}update(e,t){let i=t==="player"&&e.loading&&!e.ready;if(this._drawingAssets&&!i)return;if(t!=="player"){this.reset();return}if(e.ready||!e.loading){this.hide();return}this._el.root.setAttribute("aria-label","Preparing scene transitions"),this._drawingAssets=!1;let r=typeof e.progress=="number"&&Number.isFinite(e.progress)?e.progress:0,o=typeof e.total=="number"&&Number.isFinite(e.total)?e.total:0,a=o>0?Math.min(1,Math.max(0,r/o)):0,s=Math.min(z.length-1,Math.floor(a*z.length));this._el.title.textContent=z[s]||"Preparing scene transitions",this._el.detail.textContent=e.phase==="cached"?"Loading cached transition frames before playback.":e.phase==="finalizing"?"Uploading transition textures for smooth playback.":"Rendering animated scene samples for shader transitions.",this._el.fill.style.transform=`scaleX(${a})`;let u=e.currentTransition!==void 0&&e.transitionTotal!==void 0?`${e.currentTransition}/${e.transitionTotal}`:o>0?`${r}/${o}`:"",d=e.transitionFrame!==void 0&&e.transitionFrames!==void 0?`${e.transitionFrame}/${e.transitionFrames}`:"";this._el.frameLabel.textContent=e.phase==="cached"?"cached transition frames":e.phase==="finalizing"?"finalizing transition frames":"rendering transition frames",Ve(this._el.transitionRow,this._el.transitionValue,u),Ve(this._el.frameRow,this._el.frameValue,d),this._el.root.setAttribute("aria-valuenow",String(Math.round(a*100))),this.show()}showAssetsLoading(){this.reset(),this._el.title.textContent="Loading assets",this._el.detail.textContent="Waiting for images, video and fonts to finish loading.",this._el.root.setAttribute("aria-label","Loading assets"),this._drawingAssets=!0,this.show()}hideAssetsLoading(){this._drawingAssets&&this.hide()}get hideTimeout(){return this._hideTimeout}destroy(){this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null),this._hiddenCallbacks=[]}_scheduleCleanup(){this._hideTimeout&&clearTimeout(this._hideTimeout),this._hideTimeout=setTimeout(()=>{this._el.root.classList.remove("hfp-hiding"),this._hideTimeout=null,this._flushHidden()},Wr)}};function jn(n){return n?.trim().toLowerCase().startsWith("video/")??!1}function qn(n){let e=document.createElement("video");e.className="hfp-video",e.playsInline=!0,e.preload="metadata";let t=new AbortController,{signal:i}=t;return e.addEventListener("loadedmetadata",()=>n.onMetadata(e),{signal:i}),e.addEventListener("durationchange",()=>n.onDurationChange(e),{signal:i}),e.addEventListener("resize",()=>n.onResize(e),{signal:i}),e.addEventListener("play",()=>n.onPlay(e),{signal:i}),e.addEventListener("pause",()=>n.onPause(e),{signal:i}),e.addEventListener("timeupdate",()=>n.onTimeUpdate(),{signal:i}),e.addEventListener("error",()=>n.onError(e.error?.message||"Video failed to load",e.error?.code??null),{signal:i}),{video:e,adapter:{duration:()=>e.duration,time:()=>e.currentTime,seek:o=>{e.currentTime=o},play:()=>e.play().catch(o=>{i.aborted||n.onPlayRejected(o)}),pause:()=>e.pause(),timeScale:o=>{e.defaultPlaybackRate=o,e.playbackRate=o}},destroy:()=>{t.abort(),e.pause(),e.removeAttribute("src"),e.load(),e.remove()}}}var Gr=.1,Br=5,_t="sandbox-origin",Yn=1e4,yt=8e3,vt="assets-loading",ce="assets-loading-ui",At="low-power-idle",Xn="disable-click-to-play",me="range-start",pe="range-end",$r=150;function St(n){return!Number.isFinite(n)||n<=0?1:Math.max(Gr,Math.min(Br,n))}var He=class extends HTMLElement{static get observedAttributes(){return["src","srcdoc","width","height","controls","muted","audio-locked","volume","poster","playback-rate","audio-src","type",_t,Fe,O,$,ce,At,me,pe]}shadow;container;iframe;posterEl=null;controlsApi=null;resizeObserver;shaderLoader;probe;_ready=!1;_readyDocument=null;_connected=!1;_assetsReady=!1;_painted=!1;_pendingPlay=!1;_assetsGeneration=0;_assetsLoadingShowTimer=null;_currentTime=0;_duration=0;_paused=!0;_scrubbing=!1;_lastUpdateMs=0;_volume=1;_compositionWidth=1920;_compositionHeight=1080;_rescaleWarned=!1;_directTimelineAdapter=null;_directTimelineClock;_parentTickRaf=null;_media;_scenes=[];_runtimeFps=30;_runtimeBridgeReady=!1;_runtimeAssetsReadyGeneration=-1;_runtimeData=new Map;_runtimeDataRequestId=0;_pendingRuntimeData=new Map;_afterUpdate=null;_videoSource=null;_runtimeOwnsPlayRange=!1;_enteringRange=!1;_rangeClampReported="";constructor(){super(),this.shadow=this.attachShadow({mode:"open"}),Sn(this.shadow,hn),{container:this.container,iframe:this.iframe}=En(),this.shadow.appendChild(this.container);let e=zn();this.shadow.appendChild(e.root),this.shaderLoader=new Ue(e),this._media=new Oe({dispatchEvent:t=>this._emit(t),getMuted:()=>this.muted,getVolume:()=>this._volume,getPlaybackRate:()=>this.playbackRate,getCurrentTime:()=>this._currentTime,isPaused:()=>this._paused}),this._directTimelineClock=new Ce({onTimeUpdate:(t,i)=>{this._currentTime=t,this.controlsApi?.updateTime(t,i),this._emit(new CustomEvent("timeupdate",{detail:{currentTime:t}}))},getLoop:()=>this.loop,restart:()=>{this.seek(this._playRange()?.start??0),this.play()},onPaused:()=>{this._media.audioOwner==="parent"&&this._media.pauseAll(),this._paused=!0,this.controlsApi?.updatePlaying(!1),this._emit(new Event("ended"))},onEnded:()=>this.loop}),this.probe=new Me(this.iframe,{resolveRuntimeUrl:()=>gt(this),onReady:t=>this._onProbeReady(t),onError:t=>this._emit(new CustomEvent("error",{detail:{message:t}}))}),this.addEventListener("click",t=>{this.disableClickToPlay||An(t)||(this._paused?this.play():this.pause())}),this.resizeObserver=new ResizeObserver(()=>this._rescale()),this._onMessage=this._onMessage.bind(this),this._onIframeLoad=this._onIframeLoad.bind(this),this.iframe.addEventListener("load",this._onIframeLoad)}connectedCallback(){this._connected=!0,this._applySandboxOriginPolicy(),this.resizeObserver.observe(this),window.addEventListener("message",this._onMessage),this.hasAttribute("controls")&&this._setupControls(),this.hasAttribute("poster")&&(this.posterEl=lt(this.shadow,this.getAttribute("poster"),this.posterEl)),this.hasAttribute("audio-src")&&this._media.setupFromUrl(this.getAttribute("audio-src")),this.hasAttribute("srcdoc")&&(this.iframe.srcdoc=de(this,this.getAttribute("srcdoc"))),this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),!this.hasAttribute("audio-locked")&&this._isLockedHostEnvironment()&&this._applyAudioLock(!0)}disconnectedCallback(){this._connected=!1,this._teardownVideo(),this._sendControl("pause"),this._stopIframeMedia(),this.resizeObserver.disconnect(),window.removeEventListener("message",this._onMessage),this.probe.stop(),this._directTimelineClock.stop(),this._stopParentTickClock(),this._directTimelineAdapter=null,this.shaderLoader.destroy(),this._media.destroy(),this.controlsApi?.destroy(),this.controlsApi=null,this._paused=!0,this._pendingPlay=!1,this._abandonComposition("Player disconnected before runtime data was applied")}attributeChangedCallback(e,t,i){switch(e){case"src":if(!this.isConnected)break;i&&this._navigateSrc(i);break;case"type":{let r=this.getAttribute("src");if(!this.isConnected||r===null||!!this._videoSource===this._wantsVideo())break;this._navigateSrc(r);break}case"srcdoc":if(!this.isConnected)break;if(this._pendingPlay=!1,this._abandonComposition("Composition navigated before runtime data was applied"),i!==null)this._pauseForVideoSwitch(),this._teardownVideo(),this.iframe.srcdoc=de(this,i);else{this.iframe.removeAttribute("srcdoc");let r=this.getAttribute("src");r!==null&&this._wantsVideo()&&this._navigateSrc(r)}break;case _t:this._applySandboxOriginPolicy(this.isConnected&&t!==i);break;case"width":this._setCompositionSize(oe(i)??1920,this._compositionHeight);break;case"height":this._setCompositionSize(this._compositionWidth,oe(i)??1080);break;case"controls":i!==null?this._setupControls():(this.controlsApi?.destroy(),this.controlsApi=null);break;case"poster":this.posterEl=lt(this.shadow,i,this.posterEl);break;case"playback-rate":{let r=St(parseFloat(i||"1"));this._media.updatePlaybackRate(r),this._sendControl("set-playback-rate",{playbackRate:r}),this._directTimelineAdapter?.timeScale?.(r),this.controlsApi?.updateSpeed(r),this._emit(new Event("ratechange"));break}case"muted":this._handleMutedChange(i);break;case"audio-locked":this._applyAudioLock(i!==null);break;case"volume":{let r=Math.max(0,Math.min(1,parseFloat(i||"1")));this._volume=r,this._syncVideoAudio(),this._media.updateVolume(r),this._sendControl("set-volume",{volume:r}),this.controlsApi?.updateVolume(r),this._emit(new Event("volumechange"));break}case"audio-src":i?this._media.setupFromUrl(i):this._media.teardownUrlAudio();break;case ce:i==="none"&&this.shaderLoader.hideAssetsLoading();break;case At:this._sendControl("set-idle-heartbeat",{slow:i!==null});break;case me:case pe:this._applyPlayRange(!0);break;case O:case $:case Fe:if(!this.isConnected)break;this._reloadShaderOptions();break}}_applySandboxOriginPolicy(e=!1){this.hasAttribute(_t)?this.iframe.sandbox.remove("allow-same-origin"):this.iframe.sandbox.add("allow-same-origin"),e&&this._reloadForSandboxOriginPolicy()}_reloadForSandboxOriginPolicy(){if(this._videoSource)return;this._abandonComposition("Sandbox policy changed before runtime data was applied");let e=this.getAttribute("srcdoc");if(e!==null){this.iframe.srcdoc=de(this,e);return}let t=this.getAttribute("src");t===null?this.iframe.src="about:blank":this._loadSrc(t)}get iframeElement(){return this.iframe}get scenes(){return this._scenes}play(){this._play(!0)}_play(e){if(this._ready&&!this._assetsReady){this._pendingPlay=!0;return}this._pendingPlay=!1,this.posterEl?.remove(),this.posterEl=null;let t=this._ready?this._playRange():null;t?ft(this._currentTime,t,this._duration,this._runtimeFps)&&(this.seek(t.start),this._enteringRange=!0):this._duration>0&&this._currentTime>=this._duration&&this.seek(0),this._paused=!1;let i=this._tryDirectTimelinePlay(),r=!1;this._sendDisplayScale(),i||(this._sendControl("play"),this._ready&&!this._directTimelineAdapter?this._startParentTickClock():this._ready||(this._pendingPlay=!0,r=!0)),this._media.audioOwner==="parent"&&this._media.playAll(),this.controlsApi?.updatePlaying(!0),!r&&e&&this._emit(new Event("play")),i&&this._directTimelineAdapter&&this._directTimelineClock.start(this._directTimelineAdapter,()=>this._currentTime,()=>this._duration,()=>this._paused,()=>this._clockStop())}pause(){this._pendingPlay=!1,this._tryDirectTimelinePause()?this._showPausedVideoTime():this._sendControl("pause"),this._directTimelineClock.stop(),this._stopParentTickClock(),this._media.audioOwner==="parent"&&this._media.pauseAll(),this._paused=!0,this.controlsApi?.updatePlaying(!1),this._emit(new Event("pause"))}stopMedia(){this._sendControl("stop-media"),this._stopIframeMedia(),this._media.stopAdoptedMedia()}seek(e){this._pendingPlay=!1,!this._trySyncSeek(e)&&!this._tryDirectTimelineSeek(e)&&this._sendControl("seek",{timeSeconds:e,frame:Math.round(e*this._runtimeFps)}),this._directTimelineClock.stop(),this._stopParentTickClock(),this._currentTime=e,this._media.audioOwner==="parent"&&(this._scrubbing?this._media.scrubAll(e):(this._media.pauseAll(),this._media.seekAll(e))),this._paused=!0,this.controlsApi?.updatePlaying(!1),this.controlsApi?.updateTime(this._currentTime,this._duration)}setColorGrading(e,t){this._sendControl("set-color-grading",{target:e,grading:t})}clearColorGrading(e){this._sendControl("set-color-grading",{target:e,grading:null})}setColorGradingCompare(e,t){this._sendControl("set-color-grading-compare",{target:e,compare:t})}clearColorGradingCompare(e){this._sendControl("set-color-grading-compare",{target:e,compare:{enabled:!1}})}setRuntimeData(e,t){if(!/^[a-z][a-z0-9-]{0,63}$/.test(e))throw new Error(`Invalid HyperFrames runtime-data channel: ${e}`);if(typeof structuredClone!="function")throw new Error("HyperFrames runtime data requires structuredClone support; refusing an unverified payload");let i=structuredClone(t);this._runtimeData.set(e,i),this._deliverRuntimeData(e,i)}clearRuntimeData(e){if(!/^[a-z][a-z0-9-]{0,63}$/.test(e))throw new Error(`Invalid HyperFrames runtime-data channel: ${e}`);this._runtimeData.delete(e),this._deliverRuntimeDataClear(e)}get currentTime(){return this._currentTime}set currentTime(e){this.seek(e)}get duration(){return this._duration}get compositionWidth(){return this._compositionWidth}get compositionHeight(){return this._compositionHeight}get paused(){return this._paused}get ready(){return this._ready}get assetsReady(){return this._assetsReady}get painted(){return this._painted}get playbackRate(){return St(parseFloat(this.getAttribute("playback-rate")||"1"))}set playbackRate(e){this.setAttribute("playback-rate",String(St(e)))}get shaderCaptureScale(){return Bn(this)}set shaderCaptureScale(e){this.setAttribute(O,String(e))}get shaderLoading(){return le(this)}set shaderLoading(e){e==="composition"?this.removeAttribute($):this.setAttribute($,e)}get assetsLoadingUi(){return this.getAttribute(ce)==="none"?"none":"player"}set assetsLoadingUi(e){e==="none"?this.setAttribute(ce,"none"):this.removeAttribute(ce)}get muted(){return this.hasAttribute("muted")}set muted(e){e?this.setAttribute("muted",""):this.removeAttribute("muted")}get audioLocked(){return this.hasAttribute("audio-locked")}set audioLocked(e){e?this.setAttribute("audio-locked",""):this.removeAttribute("audio-locked")}_isLockedHostEnvironment(){if(typeof navigator>"u")return!1;let e=navigator.userAgent||"";return/\bClaude\/\d/.test(e)&&/\bElectron\b/.test(e)}_isAudioLocked(){return this.hasAttribute("audio-locked")||this._isLockedHostEnvironment()}_isSlideshowPlayer(){return this.closest("hyperframes-slideshow")!==null}_handleMutedChange(e){if(e===null&&this._isAudioLocked()){this.setAttribute("muted","");return}this._media.updateMuted(e!==null),this._syncVideoAudio(),this._setIframeMediaMuted(e!==null),this._sendControl("set-muted",{muted:e!==null}),this.controlsApi?.updateMuted(e!==null),this._emit(new Event("volumechange"))}_applyAudioLock(e){e&&(this.muted=!0),this.controlsApi?.setVolumeControlsHidden(e)}get volume(){return this._volume}set volume(e){this.setAttribute("volume",String(Math.max(0,Math.min(1,e))))}get disableClickToPlay(){return this.hasAttribute(Xn)}set disableClickToPlay(e){this.toggleAttribute(Xn,e)}get loop(){return this.hasAttribute("loop")}set loop(e){e?this.setAttribute("loop",""):this.removeAttribute("loop")}get rangeStart(){return this._readSeconds(me)}set rangeStart(e){this._writeSeconds(me,e)}get rangeEnd(){return this._readSeconds(pe)}set rangeEnd(e){this._writeSeconds(pe,e)}_readSeconds(e){let t=this.getAttribute(e);return t===null?null:Number(t)}_writeSeconds(e,t){t==null?this.removeAttribute(e):this.setAttribute(e,String(t))}_hasPlayRange(){return this.hasAttribute(me)||this.hasAttribute(pe)}_playRange(){return pt(this.rangeStart,this.rangeEnd,this._duration).range}_sendPlayRange(e){let t=e?.end??null;this._sendControl("set-play-range",{startSeconds:e?.start??null,endSeconds:t})}_applyPlayRange(e){let{range:t,clamped:i}=pt(this.rangeStart,this.rangeEnd,this._duration);this._sendPlayRange(t),this._ready&&(this._reportRangeClamp(t,i),t&&e&&!this._pendingPlay&&this._moveIntoPlayRange(t))}_reportRangeClamp(e,t){let i=t?`${this.rangeStart},${this.rangeEnd},${this._duration}`:"";if(i===this._rangeClampReported||(this._rangeClampReported=i,!t))return;let r={rangeStart:e?.start??null,rangeEnd:e?.end??null};this._emit(new CustomEvent("rangeclamped",{detail:{...r,duration:this._duration}}))}_moveIntoPlayRange(e){ft(this._currentTime,e,this._duration,this._runtimeFps)&&(this._paused?this.seek(e.start):this._jumpWhilePlaying(e.start))}_jumpWhilePlaying(e){this._directTimelineAdapter?(this._directTimelineAdapter.seek(e,!1),this._currentTime=e):this._runtimeOwnsPlayRange||(this.seek(e),this._enteringRange=!0,this._play(!1))}_clockStop(){let e=this._playRange(),t=e?.end??this._duration;if(!e)return{end:t,shown:t};let i=ue(e,this._duration,this._runtimeFps);return{end:t,shown:i<t?(i+t)/2:i}}_sendControl(e,t={}){try{let i=this.iframe.contentWindow;return i?(i.postMessage({...t,source:"hf-parent",type:"control",action:e,...ct(this._runtimeFps)},"*"),!0):((e==="set-runtime-data"||e==="clear-runtime-data")&&this._rejectRuntimeDataDelivery(t.channel,t.requestId,"Composition iframe is unavailable"),!1)}catch(i){return(e==="set-runtime-data"||e==="clear-runtime-data")&&this._rejectRuntimeDataDelivery(t.channel,t.requestId,i instanceof Error?i.message:String(i)),!1}}_deliverRuntimeData(e,t){if(!this.isConnected||!this._runtimeBridgeReady)return;let i=this._beginRuntimeDataDelivery(e);this._trySetRuntimeDataDirect(e,t,i)||this._sendControl("set-runtime-data",{channel:e,payload:t,requestId:i})}_deliverRuntimeDataClear(e){if(!this.isConnected||!this._runtimeBridgeReady)return;let t=this._beginRuntimeDataDelivery(e);this._tryClearRuntimeDataDirect(e,t)||this._sendControl("clear-runtime-data",{channel:e,requestId:t})}_trySetRuntimeDataDirect(e,t,i){try{let r=this.iframe.contentWindow?.__hyperframes;return typeof r?.setRuntimeData!="function"?!1:(r.setRuntimeData(e,t,i),!0)}catch{return!1}}_tryClearRuntimeDataDirect(e,t){try{let i=this.iframe.contentWindow?.__hyperframes;return typeof i?.clearRuntimeData!="function"?!1:(i.clearRuntimeData(e,t),!0)}catch{return!1}}_replayRuntimeData(){for(let[e,t]of this._runtimeData)this._deliverRuntimeData(e,t)}_beginRuntimeDataDelivery(e){let t=this._pendingRuntimeData.get(e);t&&window.clearTimeout(t.timeoutId),this._runtimeDataRequestId+=1;let i=this._runtimeDataRequestId,r=window.setTimeout(()=>{this._rejectRuntimeDataDelivery(e,i,`Runtime data delivery timed out after ${Yn}ms`)},Yn);return this._pendingRuntimeData.set(e,{requestId:i,timeoutId:r}),i}_resolveRuntimeDataDelivery(e,t){let i=this._takeRuntimeDataDelivery(e,t);i&&this._emit(new CustomEvent("runtimedataapplied",{detail:{channel:e,requestId:i.requestId}}))}_rejectRuntimeDataDelivery(e,t,i){let r=this._takeRuntimeDataDelivery(e,t);r&&this._emit(new CustomEvent("runtimedataerror",{detail:{channel:e,requestId:r.requestId,message:typeof i=="string"?i:String(i)}}))}_takeRuntimeDataDelivery(e,t){if(typeof e!="string"||typeof t!="number"||!Number.isSafeInteger(t))return null;let i=this._pendingRuntimeData.get(e);return!i||i.requestId!==t?null:(window.clearTimeout(i.timeoutId),this._pendingRuntimeData.delete(e),i)}_rejectAllRuntimeDataDeliveries(e){for(let[t,i]of[...this._pendingRuntimeData])this._rejectRuntimeDataDelivery(t,i.requestId,e)}_getSameOriginIframeDocument(){try{return this.iframe.contentDocument}catch{return null}}_setIframeMediaMuted(e){let t=this._getSameOriginIframeDocument();if(t)for(let i of t.querySelectorAll("video, audio"))x(i)&&(i.muted=e||i.defaultMuted)}_stopIframeMedia(){let e=this._getSameOriginIframeDocument();if(e)for(let t of e.querySelectorAll("video, audio"))x(t)&&t.pause()}_replayBridgeState(){this._sendControl("set-muted",{muted:this.muted}),this._sendControl("set-volume",{volume:this._volume}),this._sendControl("set-playback-rate",{playbackRate:this.playbackRate}),this._sendControl("set-native-media-sync-disabled",{disabled:this._isSlideshowPlayer()}),this._sendControl("set-web-audio-media-disabled",{disabled:this._isSlideshowPlayer()}),this._sendControl("set-idle-heartbeat",{slow:this.hasAttribute(At)}),this._sendDisplayScale()}_sendDisplayScale(){let e=Dn(this.iframe);e&&this._sendControl("set-display-scale",{scale:e})}_reloadShaderOptions(){if(!this._videoSource){if(this._abandonComposition("Shader options changed before runtime data was applied"),this.hasAttribute("srcdoc")){this.iframe.srcdoc=de(this,this.getAttribute("srcdoc")||"");return}this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")||"")}}_navigateSrc(e){this._pendingPlay=!1,this._pauseForVideoSwitch(),this._abandonComposition("Composition navigated before runtime data was applied"),this._loadSrc(e)}_wantsVideo(){return jn(this.getAttribute("type"))&&!this.hasAttribute("srcdoc")}_pauseForVideoSwitch(){!this._videoSource&&!this._wantsVideo()||(this._paused=!0,this.controlsApi?.updatePlaying(!1))}_loadSrc(e){if(this._wantsVideo()){this._loadVideo(e);return}this._teardownVideo(),this.iframe.src=$n(this,e)}_loadVideo(e){this._videoSource||(this._videoSource=qn({onMetadata:r=>this._applyThenEmit(()=>this._onVideoReady(r)),onDurationChange:r=>this._applyTimelineDuration(r.duration),onResize:r=>this._applyVideoSize(r),onPlay:r=>{!r.paused&&this._paused&&this.play()},onPause:r=>{r.paused&&!r.ended&&!this._paused&&this.pause()},onTimeUpdate:()=>{document.hidden&&this._playRange()&&this._directTimelineClock.poll()},onError:(r,o)=>{this._paused||this.pause(),this._emit(new CustomEvent("error",{detail:{message:r,code:o}}))},onPlayRejected:r=>this._onVideoPlayRejected(r)}),this.container.appendChild(this._videoSource.video),this.iframe.hidden=!0,this.iframe.src="about:blank"),this.probe.stop();let{video:t,adapter:i}=this._videoSource;this._directTimelineAdapter=i,this._currentTime=0,this._duration=0,this.controlsApi?.updateTime(0,0),this._syncVideoAudio(),i.timeScale?.(this.playbackRate),t.src=e}_teardownVideo(){this._videoSource&&(this._videoSource.destroy(),this._videoSource=null,this.iframe.hidden=!1)}_syncVideoAudio(){this._videoSource&&(this._videoSource.video.muted=this.muted,this._videoSource.video.volume=this._volume)}_onVideoReady(e){this._applyTimelineDuration(e.duration),this._applyVideoSize(e),this._ready=!0,this._dispatchReady(),this._waitForAssetsReady(null),this._afterEvents(()=>{this.hasAttribute("autoplay")&&this._paused&&this.play()})}_applyTimelineDuration(e){!Number.isFinite(e)||e<=0||(this._setDuration(e),this.controlsApi?.updateTime(this._currentTime,e))}_applyVideoSize(e){e.videoWidth>0&&e.videoHeight>0&&this._setCompositionSize(e.videoWidth,e.videoHeight)}_onVideoPlayRejected(e){e instanceof DOMException&&e.name==="NotAllowedError"&&(this._paused||this.pause(),this._emit(new CustomEvent("playbackerror",{detail:{source:"video",error:e}})))}_trySyncSeek(e){if(this._videoSource)return!1;try{let i=this.iframe.contentWindow?.__player;return typeof i?.seek!="function"?!1:(i.seek.call(i,e),!0)}catch{return!1}}_withDirectTimeline(e){let t=this._videoSource?null:this.probe.resolveDirectTimelineAdapter(),i=t||this._directTimelineAdapter;if(!i)return!1;try{return e(i),t&&t!==this._directTimelineAdapter&&this._applyTimelineDuration(t.duration()),this._directTimelineAdapter=i,!0}catch{return!1}}_tryDirectTimelineSeek(e){return this._withDirectTimeline(t=>{t.seek(e,!1),t.pause()})}_tryDirectTimelinePlay(){return this._withDirectTimeline(e=>{e.play()})}_tryDirectTimelinePause(){return this._withDirectTimeline(e=>{e.pause()})}_showPausedVideoTime(){this._videoSource&&(this._currentTime=this._videoSource.video.currentTime,this.controlsApi?.updateTime(this._currentTime,this._duration),this._emit(new CustomEvent("timeupdate",{detail:{currentTime:this._currentTime}})))}_startParentTickClock(){this._stopParentTickClock();let e=()=>{if(this._paused){this._parentTickRaf=null;return}this._sendControl("tick"),this._parentTickRaf=requestAnimationFrame(e)};this._parentTickRaf=requestAnimationFrame(e)}_stopParentTickClock(){this._parentTickRaf!==null&&(cancelAnimationFrame(this._parentTickRaf),this._parentTickRaf=null)}_onMessage(e){this._videoSource||this.probe.failed||this._applyThenEmit(()=>this._handleRuntimeMessage(e))}_handleRuntimeMessage(e){Vn(e,this.iframe.contentWindow,{getPlaybackState:()=>({currentTime:this._currentTime,duration:this._duration,paused:this._paused,lastUpdateMs:this._lastUpdateMs,enteringRange:this._enteringRange}),setPlaybackState:({currentTime:t,duration:i,paused:r,lastUpdateMs:o,enteringRange:a})=>{this._enteringRange=a===!0,this._currentTime=t,this._setDuration(i),this._paused=r,this._lastUpdateMs=o},getShaderLoadingMode:()=>le(this),shaderLoader:this.shaderLoader,setCompositionSize:(t,i)=>this._setCompositionSize(t,i),sendControl:(t,i)=>this._sendControl(t,i),getIframeDoc:()=>this.iframe.contentDocument,onRuntimeReady:()=>{this._runtimeBridgeReady=!0,this._replayBridgeState(),this._hasPlayRange()&&this._sendPlayRange(this._playRange()),this._replayRuntimeData()},onRuntimeAssetsReady:()=>{this._runtimeAssetsReadyGeneration===this._assetsGeneration&&this._settleAssetsReady(this._assetsGeneration)},onRuntimeDataApplied:(t,i)=>this._resolveRuntimeDataDelivery(t,i),onRuntimeDataError:(t,i,r)=>this._rejectRuntimeDataDelivery(t,i,r),onRuntimeTimelineReady:(t,i)=>this._onRuntimeTimelineReady(t,i),setRuntimeFps:t=>{this._runtimeFps=t},setRuntimeOwnsPlayRange:t=>{this._runtimeOwnsPlayRange=t},shouldPromoteMediaAutoplayFallback:()=>!this._isSlideshowPlayer(),setScenes:t=>{this._scenes=t,this._emit(new CustomEvent("scenes",{detail:{scenes:t}}))},updateControlsTime:(t,i)=>this.controlsApi?.updateTime(t,i),updateControlsPlaying:t=>this.controlsApi?.updatePlaying(t),dispatchEvent:t=>this._emit(t),seek:t=>this.seek(t),play:()=>this.play(),getLoop:()=>this.loop,getPlayRange:()=>this._playRange(),media:this._media})}_onRuntimeTimelineReady(e,t){if(this._ready)return;this.probe.stop(),this._setDuration(e),this._directTimelineAdapter=null,this._ready=!0,this.controlsApi?.updateTime(this._currentTime,e),this._dispatchReady();let i=this._getSameOriginIframeDocument();i&&this._media.setupFromIframe(i),this._replayBridgeState(),this._setIframeMediaMuted(this.muted),this._waitForAssetsReady(i,t),this._playWhenWanted()}_onProbeReady(e){this._applyThenEmit(()=>this._applyProbeResult(e))}_applyProbeResult({duration:e,adapter:t,compositionSize:i}){this._setDuration(e),this._directTimelineAdapter=t.kind==="direct-timeline"?t.timeline:null,i&&this._setCompositionSize(i.width,i.height),this._ready=!0,this.controlsApi?.updateTime(0,e),this._dispatchReady();let r=this._getSameOriginIframeDocument();r&&this._media.setupFromIframe(r),this._setIframeMediaMuted(this.muted),this._waitForAssetsReady(r),this._playWhenWanted()}_waitForAssetsReady(e,t){this._clearAssetsLoadingShowTimer(),this._assetsReady=!1,this._painted=!1;let i=++this._assetsGeneration;if(!e){t===!1?(this._runtimeAssetsReadyGeneration=i,this._startAssetsLoadingOverlayTimer(i),setTimeout(()=>this._settleAssetsReady(i),yt)):this._settleAssetsReady(i);return}Ln(e,({timedOut:r})=>{i===this._assetsGeneration&&(r&&this._warnStuckAssets(e),this._settleAssetsReady(i))},{timeoutMs:yt}),this._assetsReady||this._startAssetsLoadingOverlayTimer(i)}_startAssetsLoadingOverlayTimer(e){this._assetsLoadingShowTimer=setTimeout(()=>{this._assetsLoadingShowTimer=null,!(e!==this._assetsGeneration||this._assetsReady)&&(this.setAttribute(vt,""),this.assetsLoadingUi!=="none"&&this.shaderLoader.showAssetsLoading())},$r)}_hasPendingFirstFrameAssets(e){let{pendingMedia:t,pendingImages:i,fontsLoading:r}=Le(e,{scope:B});return t.length>0||i.length>0||r}_warnStuckAssets(e){let{pendingMedia:t,pendingImages:i,fontsLoading:r}=Le(e,{scope:B}),o=e.defaultView;console.warn(`[hyperframes-player] assets-loading timed out after ${yt}ms, playing anyway`,{stuckMedia:t.map(a=>a.currentSrc||a.getAttribute("src")||`<${a.tagName.toLowerCase()}>`),stuckImages:i.map(a=>a.currentSrc||a.getAttribute("src")||"<img>"),fontsLoading:r,computeReady:o?.__renderReady===!0,documentHidden:e.hidden===!0})}_settleAssetsReady(e){e!==this._assetsGeneration||this._assetsReady||(this._clearAssetsLoadingShowTimer(),this._assetsReady=!0,this.removeAttribute(vt),this.shaderLoader.hideAssetsLoading(),this._emit(new Event("assetsready")),this.shaderLoader.whenHidden(()=>{e===this._assetsGeneration&&(this._painted=!0,this._emit(new Event("painted")))}),this._afterEvents(()=>{this._pendingPlay&&this.play()}))}_abandonComposition(e){this.probe.stop(),this._ready=!1,this._readyDocument=null,this._invalidateAssetsWait(),this._releaseDocument(),this._runtimeBridgeReady=!1,this._rejectAllRuntimeDataDeliveries(e)}_releaseDocument(){this._runtimeOwnsPlayRange=!1,this._enteringRange=!1,this._directTimelineAdapter=null,this._directTimelineClock.stop(),this._stopParentTickClock(),this.shaderLoader.reset(),this._media.resetForIframeLoad()}_invalidateAssetsWait(){this._clearAssetsLoadingShowTimer(),this._assetsReady=!1,this._painted=!1,this._assetsGeneration++,this.removeAttribute(vt),this.shaderLoader.hide()}_clearAssetsLoadingShowTimer(){this._assetsLoadingShowTimer!==null&&(clearTimeout(this._assetsLoadingShowTimer),this._assetsLoadingShowTimer=null)}_dispatchReady(){this._readyDocument=this._getSameOriginIframeDocument();let e={duration:this._duration,compositionWidth:this._compositionWidth,compositionHeight:this._compositionHeight};this._emit(new CustomEvent("ready",{detail:e})),this._rescale(),this._rangeClampReported="",this._hasPlayRange()&&this._applyPlayRange(!0)}_setDuration(e){e!==this._duration&&(this._duration=e,this._ready&&(this._emit(new CustomEvent("durationchange",{detail:{duration:e}})),this._hasPlayRange()&&this._applyPlayRange(!1)))}_setCompositionSize(e,t){let i=e!==this._compositionWidth||t!==this._compositionHeight;if(this._compositionWidth=e,this._compositionHeight=t,this._rescale(),!i)return;let r={compositionWidth:e,compositionHeight:t};this._emit(new CustomEvent("resize",{detail:r}))}_applyThenEmit(e){if(this._afterUpdate){e();return}let t=[];this._afterUpdate=t;let i=[],r=o=>{try{o()}catch(a){i.push(a)}};r(e);for(let o of t)r(o);if(this._afterUpdate=null,i.length>0)throw i[0]}_afterEvents(e){this._afterUpdate?this._afterUpdate.push(e):e()}_playWhenWanted(){this._afterEvents(()=>{(this.hasAttribute("autoplay")||this._pendingPlay)&&this.play()})}_emit(e){this._afterEvents(()=>this.dispatchEvent(e))}_rescale(){let e=Tn(this,this.iframe,this._compositionWidth,this._compositionHeight);e&&this._sendDisplayScale(),!e&&this._ready&&!this._rescaleWarned&&(this._rescaleWarned=!0,console.warn("[hyperframes-player] rescale no-op after ready: zero-size player element",{src:this.getAttribute("src"),offsetWidth:this.offsetWidth,offsetHeight:this.offsetHeight,compositionWidth:this._compositionWidth,compositionHeight:this._compositionHeight}))}_onIframeLoad(){if(!this._connected||this._videoSource)return;let e=this._getSameOriginIframeDocument();if(this._ready&&e===this._readyDocument){e&&this._hasPendingFirstFrameAssets(e)&&this._waitForAssetsReady(e);return}this._ready=!1,this._invalidateAssetsWait(),this._releaseDocument(),this.probe.start()}_setupControls(){this.controlsApi||(this.controlsApi=vn(this.shadow,this.muted,this._volume,this.getAttribute("speed-presets"),{onPlay:()=>this.play(),onPause:()=>this.pause(),onSeek:e=>this.seek(e*this._duration),onScrubStart:()=>{this._scrubbing=!0},onScrubEnd:()=>{this._scrubbing=!1,this.seek(this._currentTime)},onSpeedChange:e=>{this.playbackRate=e},onMuteToggle:()=>{this.muted=!this.muted},onVolumeChange:e=>{this.volume=e}},this._isAudioLocked()))}get _audioOwner(){return this._media.audioOwner}get _parentMedia(){return this._media.entries}_mirrorParentMediaTime(e,t){this._media.mirrorTime(e,t)}_promoteToParentProxy(){let e=null;try{e=this.iframe.contentDocument}catch{}this._media.promoteToParentProxy(e,(t,i)=>this._mirrorParentMediaTime(t,i)),this._sendControl("set-media-output-muted",{muted:!0})}_observeDynamicMedia(e){this._media.setupFromIframe(e)}};customElements.get("hyperframes-player")||customElements.define("hyperframes-player",He);return ni(zr);})();
|
|
472
|
+
`,bn='<svg width="24" height="24" viewBox="46 21 54 56" fill="currentColor"><path d="M87.5129 57.5141L56.9696 73.5433C52.8371 75.7098 48.7046 73.2553 49.6688 69.2104L58.9483 30.1391C59.9125 26.0942 65.2097 23.6397 68.3154 25.8062L91.2447 41.8354C96.4668 45.4796 94.4631 53.8699 87.5129 57.5141Z"/></svg>',gn='<svg width="24" height="24" viewBox="0 0 18 18" fill="currentColor"><rect x="3" y="2" width="4" height="14"/><rect x="11" y="2" width="4" height="14"/></svg>',at='<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M3 9v6h4l5 5V4L7 9H3z"/><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"/><path d="M14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>',st='<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M3 9v6h4l5 5V4L7 9H3z"/><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"/></svg>',_n='<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M3 9v6h4l5 5V4L7 9H3z"/><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z" opacity="0.3"/><line x1="18" y1="7" x2="14" y2="17" stroke="currentColor" stroke-width="2"/></svg>';var ut=[.25,.5,1,1.5,2,4];function ae(n){return Number.isInteger(n)?`${n}x`:`${n}x`}function Ie(n){if(!Number.isFinite(n)||n<0)return"0:00";let e=Math.floor(n),t=Math.floor(e/60),i=e%60;return`${t}:${i.toString().padStart(2,"0")}`}function yn(n,e,t={}){let i=t.speedPresets??ut,r=document.createElement("div");r.className="hfp-controls",r.addEventListener("click",c=>{c.stopPropagation()});let o=document.createElement("button");o.className="hfp-play-btn",o.type="button",o.innerHTML=`<span class="hfp-ico hfp-ico-play">${bn}</span><span class="hfp-ico hfp-ico-pause">${gn}</span>`,o.setAttribute("aria-label","Play");let a=document.createElement("div");a.className="hfp-scrubber";let s=document.createElement("div");s.className="hfp-progress",s.style.width="0%",a.appendChild(s);let u=document.createElement("span");u.className="hfp-time",u.textContent="0:00 / 0:00";let d=document.createElement("div");d.className="hfp-speed-wrap";let m=document.createElement("button");m.className="hfp-speed-btn",m.type="button",m.textContent="1x",m.setAttribute("aria-label","Playback speed");let g=document.createElement("div");g.className="hfp-speed-menu",g.setAttribute("role","menu");for(let c of i){let p=document.createElement("button");p.className="hfp-speed-option",p.type="button",p.setAttribute("role","menuitem"),p.dataset.speed=String(c),p.textContent=ae(c),c===1&&p.classList.add("hfp-active"),g.appendChild(p)}d.appendChild(g),d.appendChild(m);let y=document.createElement("div");y.className="hfp-volume-wrap";let h=document.createElement("button");h.className="hfp-mute-btn",h.type="button",h.innerHTML=at,h.setAttribute("aria-label","Mute");let A=document.createElement("div");A.className="hfp-volume-slider-wrap";let b=document.createElement("div");b.className="hfp-volume-slider",b.setAttribute("role","slider"),b.setAttribute("aria-label","Volume"),b.setAttribute("aria-valuemin","0"),b.setAttribute("aria-valuemax","100"),b.setAttribute("aria-valuenow","100"),b.tabIndex=0;let S=document.createElement("div");S.className="hfp-volume-fill",S.style.width="100%",b.appendChild(S),A.appendChild(b),y.appendChild(A),y.appendChild(h),t.audioLocked&&(y.style.display="none"),r.appendChild(o),r.appendChild(a),r.appendChild(u),r.appendChild(y),r.appendChild(d),n.appendChild(r);let C=!1,R=!1,k=1,F=null,j=i.indexOf(1);j===-1&&(j=0);let q=(c,p)=>c?_n:p===0?st:p<.5?st:at;o.addEventListener("click",c=>{c.stopPropagation(),C?e.onPause():e.onPlay()}),h.addEventListener("click",c=>{c.stopPropagation(),e.onMuteToggle()});let l=!1,f=c=>{let p=b.getBoundingClientRect(),E=Math.max(0,Math.min(1,(c-p.left)/p.width));k=E,S.style.width=`${E*100}%`,b.setAttribute("aria-valuenow",String(Math.round(E*100))),R&&E>0&&e.onMuteToggle(),h.innerHTML=q(R,E),e.onVolumeChange(E)};b.addEventListener("mousedown",c=>{c.stopPropagation(),l=!0,f(c.clientX)});let _=c=>{l&&f(c.clientX)},w=()=>{l=!1};document.addEventListener("mousemove",_),document.addEventListener("mouseup",w),b.addEventListener("touchstart",c=>{l=!0;let p=c.touches[0];p&&f(p.clientX)},{passive:!0});let L=c=>{if(l){let p=c.touches[0];p&&f(p.clientX)}},fe=()=>{l=!1};document.addEventListener("touchmove",L,{passive:!0}),document.addEventListener("touchend",fe);let he=.05;b.addEventListener("keydown",c=>{let p=k;if(c.key==="ArrowRight"||c.key==="ArrowUp")p=Math.min(1,k+he);else if(c.key==="ArrowLeft"||c.key==="ArrowDown")p=Math.max(0,k-he);else return;c.preventDefault(),c.stopPropagation(),k=p,S.style.width=`${p*100}%`,b.setAttribute("aria-valuenow",String(Math.round(p*100))),R&&p>0&&e.onMuteToggle(),h.innerHTML=q(R,p),e.onVolumeChange(p)});let Y=c=>{for(let p of g.querySelectorAll(".hfp-speed-option"))p.classList.toggle("hfp-active",p.dataset.speed===String(c))};m.addEventListener("click",c=>{c.stopPropagation();let p=g.classList.toggle("hfp-open");m.setAttribute("aria-expanded",String(p))}),g.addEventListener("click",c=>{c.stopPropagation();let p=c.target.closest(".hfp-speed-option");if(!p)return;let E=parseFloat(p.dataset.speed);j=i.indexOf(E),m.textContent=ae(E),Y(E),g.classList.remove("hfp-open"),m.setAttribute("aria-expanded","false"),e.onSpeedChange(E)});let Et=()=>{g.classList.remove("hfp-open"),m.setAttribute("aria-expanded","false")};document.addEventListener("click",Et);let be=c=>{let p=a.getBoundingClientRect(),E=Math.max(0,Math.min(1,(c-p.left)/p.width));e.onSeek(E)},N=!1;a.addEventListener("mousedown",c=>{c.stopPropagation(),N=!0,e.onScrubStart?.(),be(c.clientX)});let Tt=c=>{N&&be(c.clientX)},Rt=()=>{N&&(N=!1,e.onScrubEnd?.())};document.addEventListener("mousemove",Tt),document.addEventListener("mouseup",Rt),a.addEventListener("touchstart",c=>{N=!0,e.onScrubStart?.();let p=c.touches[0];p&&be(p.clientX)},{passive:!0});let xt=c=>{if(N){let p=c.touches[0];p&&be(p.clientX)}},wt=()=>{N&&(N=!1,e.onScrubEnd?.())};document.addEventListener("touchmove",xt,{passive:!0}),document.addEventListener("touchend",wt);let kt=()=>{F&&clearTimeout(F),F=setTimeout(()=>{C&&r.classList.add("hfp-hidden")},3e3)},ge=n instanceof ShadowRoot?n.host:n,Mt=()=>{r.classList.remove("hfp-hidden"),kt()},It=()=>{C&&r.classList.add("hfp-hidden")};return ge.addEventListener("mousemove",Mt),ge.addEventListener("mouseleave",It),{updateTime(c,p){let E=p>0?Math.min(c,p):c,Kn=p>0?E/p*100:0;s.style.width=`${Kn}%`,u.textContent=`${Ie(E)} / ${Ie(p)}`},updatePlaying(c){C=c,o.classList.toggle("hfp-playing",c),o.setAttribute("aria-label",c?"Pause":"Play"),c?kt():r.classList.remove("hfp-hidden")},updateSpeed(c){let p=i.indexOf(c);p!==-1&&(j=p),m.textContent=ae(c),Y(c)},updateMuted(c){R=c,h.innerHTML=q(c,k),h.setAttribute("aria-label",c?"Unmute":"Mute")},updateVolume(c){k=c,S.style.width=`${c*100}%`,b.setAttribute("aria-valuenow",String(Math.round(c*100))),h.innerHTML=q(R,c)},setVolumeControlsHidden(c){y.style.display=c?"none":""},show(){r.style.display=""},hide(){r.style.display="none"},destroy(){document.removeEventListener("mousemove",Tt),document.removeEventListener("mouseup",Rt),document.removeEventListener("touchmove",xt),document.removeEventListener("touchend",wt),document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",w),document.removeEventListener("touchmove",L),document.removeEventListener("touchend",fe),document.removeEventListener("click",Et),ge.removeEventListener("mousemove",Mt),ge.removeEventListener("mouseleave",It),F&&clearTimeout(F),r.remove()}}}function vn(n,e,t,i,r,o=!1){let a=i?i.split(",").map(Number).filter(d=>!isNaN(d)&&d>0):void 0,s={...a?{speedPresets:a}:{},audioLocked:o},u=yn(n,r,s);return u.updateMuted(e),u.updateVolume(t),u}function lt(n,e,t){return e?(t||(t=document.createElement("img"),t.className="hfp-poster",n.appendChild(t)),t.src=e,t):(t?.remove(),null)}function An(n){return n.composedPath().some(e=>e instanceof HTMLElement&&e.classList.contains("hfp-controls"))}var De=null;function Sn(n,e){if(typeof CSSStyleSheet<"u")try{De||(De=new CSSStyleSheet,De.replaceSync(e)),n.adoptedStyleSheets=[De];return}catch{}let t=document.createElement("style");t.textContent=e,n.appendChild(t)}function En(){let n=document.createElement("div");n.className="hfp-container";let e=document.createElement("iframe");return e.className="hfp-iframe",e.sandbox.add("allow-scripts","allow-same-origin"),e.allow="autoplay; fullscreen",e.referrerPolicy="no-referrer",e.title="HyperFrames Composition",n.appendChild(e),{container:n,iframe:e}}function Tn(n,e,t,i){let r=n.offsetWidth,o=n.offsetHeight;if(r===0||o===0)return!1;let a=Math.min(r/t,o/i);return e.style.width=`${t}px`,e.style.height=`${i}px`,e.style.transform=`translate(-50%, -50%) scale(${a})`,!0}function Ji(n,e,t){if(t.end<=0)return!1;let i=t.shown<t.end&&e>0?e+.001:0;return n+i>=t.end}var Ce=class{constructor(e){this._callbacks=e}_callbacks;_raf=null;_lastUpdateMs=0;_tick=null;start(e,t,i,r,o){this.stop();let a=null,s=0,u=0,d=()=>{if(r()){this._raf=null;return}let m;try{m=e.time()}catch{this._raf=null;return}let g=i(),y=o();y.end>0&&(m=Math.min(m,y.end));let h=a===null?0:m-a;h!==0&&(u=Math.min(h,s),s=h),a=m;let A=Ji(m,u,y);A&&(m=y.shown);let b=performance.now();if((b-this._lastUpdateMs>100||A)&&(this._lastUpdateMs=b,this._callbacks.onTimeUpdate(m,g)),A){if(this._callbacks.getLoop()){this._callbacks.restart();return}try{e.pause(),y.shown<y.end&&e.seek(y.shown,!1)}catch{}this._callbacks.onPaused(),this._raf=null;return}this._raf=requestAnimationFrame(d)};this._tick=d,this._raf=requestAnimationFrame(d)}poll(){this._raf===null||!this._tick||(cancelAnimationFrame(this._raf),this._tick())}stop(){this._raf!==null&&(cancelAnimationFrame(this._raf),this._raf=null)}get isRunning(){return this._raf!==null}};function Rn(n){let e=Array.from(n.querySelectorAll("[data-composition-id]"));if(e.length===0)return n.body?[n.body]:[];let t=[];for(let i of e)Qi(i)||t.push(i);return Zi(n),t}function Zi(n){let e=n.body;if(!e||typeof console>"u"||typeof console.warn!="function")return;let t=e.querySelectorAll("audio[data-start], video[data-start]");if(t.length===0)return;let i=[];for(let r of t)r.closest("[data-composition-id]")||i.push(r);i.length!==0&&console.warn(`[hyperframes-player] selectMediaObserverTargets: composition hosts are present, but ${i.length} body-level timed media element(s) sit outside every [data-composition-id] subtree and will not be observed. Move them inside a composition host or the parent-frame proxy will never adopt them.`,i)}function Qi(n){let e=n.parentElement;for(;e;){if(e.hasAttribute("data-composition-id"))return!0;e=e.parentElement}return!1}var er=n=>4*Number.EPSILON*Math.max(1,Math.abs(n));function Ne(n,e){return!Number.isFinite(n)||!Number.isFinite(e)?n===e:Math.abs(n-e)<=er(Math.max(Math.abs(n),Math.abs(e)))}var xn=(n,e)=>n>=e||Ne(n,e),Pe=(n,e,t)=>xn(n,e)&&n<t&&!Ne(n,t),tr=1e-6,dt=(n,e,t,i)=>Pe(n,e,t)||xn(n,e)&&i>0&&t>=i-tr;var ir="data-fade-in",rr="data-fade-out",Oa=ir.slice(5),Fa=rr.slice(5),or=Object.freeze({fadeIn:0,fadeOut:0});var wn=':not([muted]):is(:not([data-has-audio]),[data-has-audio="true"])',Ua=`audio[data-start], video[data-start]${wn}`;var Es=1/16;var ur=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],ks=new Set([...ur,"contain","isolation","mask-border","mix-blend-mode","opacity"]);function lr(n){return Number.isFinite(n)&&n>0?n:30}function dr(n){return Number.isFinite(n)&&n>0?n:0}function kn(n,e){let t=lr(e),i=dr(n),r=i*t,o=Math.round(r);return Math.abs(r-o)<=.001?o/t:i}function Mn(n,e,t){return{start:kn(n,t),end:Number.isFinite(e)?kn(e,t):e}}var cr=["seconds-time","rational-fps","seek-keep-playing","composition-manifest-v1","runtime-data","play-range"];function mr(n,e){let t=Math.abs(n),i=Math.abs(e);for(;i!==0;){let r=t%i;t=i,i=r}return t||1}function pr(n){let e=Number.isFinite(n)&&n>0?n:30,t=Number.isInteger(e)?1:1e6,i=Math.round(e*t),r=mr(i,t);return{numerator:i/r,denominator:t/r}}function In(n,e,t){return Math.max(n,(Math.ceil(e*t-1e-6)-1)/t)}function fr(n){if(typeof n!="object"||n===null)return null;let e=n;return!Number.isFinite(e.numerator)||!Number.isFinite(e.denominator)||(e.numerator??0)<=0||(e.denominator??0)<=0?null:Number(e.numerator)/Number(e.denominator)}function ct(n){return{protocolVersion:1,capabilities:cr,fps:pr(n)}}function Dn(n){let e=n.offsetWidth,t=n.getBoundingClientRect().width;return e>0&&t>0?t/e:null}function hr(n){return Array.isArray(n)&&n.every(e=>typeof e=="string")}function Cn(n,e=30){if(typeof n!="object"||n===null)return{status:"legacy",fps:e};let t=n;if(t.protocolVersion===void 0)return{status:"legacy",fps:e};if(t.protocolVersion!==1)return{status:"unsupported",code:"unsupported_protocol_version",receivedVersion:t.protocolVersion};let i=fr(t.fps);return i===null||!hr(t.capabilities)?{status:"unsupported",code:"invalid_protocol_metadata",receivedVersion:t.protocolVersion}:{status:"supported",fps:i,metadata:t}}function Nn(n,e){let t=n.tagName.toLowerCase();if(t==="script"||t==="style"||t==="link"||t==="meta")return!1;let r=t==="video"||t==="audio"?e.resolver.resolveMediaStartForElement(n):e.resolver.resolveStartForElement(n,0),o=e.resolver.resolveDurationForElement(n),a=n.getAttribute("data-composition-id");if(a){let d=e.timelineRegistry[a],m=ne(d);!(n.hasAttribute("data-duration")||n.hasAttribute("data-end")||n.hasAttribute(Zt)||n.hasAttribute(Qt))&&(o==null||o<=0)&&m!=null&&m>0&&(o=m)}let s=o!=null&&o>0?r+o:Number.POSITIVE_INFINITY,u=e.exportRenderSeek?Mn(r,s,e.canonicalFps):{start:r,end:s};return dt(e.currentTime,u.start,u.end,e.compositionDuration)}var B="first-frame",br=3;function se(n){let e=n.ownerDocument?.defaultView;return e&&n instanceof e.Element?!0:n instanceof Element}function x(n){if(!se(n)||n.tagName!=="AUDIO"&&n.tagName!=="VIDEO")return!1;let e=n.ownerDocument?.defaultView;return e&&n instanceof e.HTMLMediaElement?!0:n instanceof HTMLMediaElement}function gr(n){return n.hasAttribute("data-start")||n.hasAttribute("data-track-index")}function _r(n,e,t){let i=n;for(;i;){if(gr(i)&&!Nn(i,{currentTime:0,compositionDuration:Number.POSITIVE_INFINITY,canonicalFps:30,exportRenderSeek:!1,timelineRegistry:t,resolver:e}))return!1;i=i.parentElement}return!0}function Pn(n,e,t,i){return e==="all"?!0:_r(n,t,i)}function Le(n,{scope:e="all"}={}){let t=n.defaultView,i=H({documentRef:n,timelineRegistry:t?.__timelines,includeAuthoredTimingAttrs:!0}),r=n.querySelector(`meta[name="${dn}"]`)!==null,o=Array.from(n.querySelectorAll("video, audio")).filter(x).filter(u=>Pn(u,r&&u.preload!=="auto"?B:e,i,t?.__timelines??{})).filter(u=>u.readyState<br),a=Array.from(n.querySelectorAll("img")).filter(u=>Pn(u,u.getAttribute("loading")?.toLowerCase()==="lazy"?B:e,i,t?.__timelines??{})).filter(u=>!u.complete),s=n.fonts?.status==="loading";return{pendingMedia:o,pendingImages:a,fontsLoading:s}}function yr(n,{pendingMedia:e,pendingImages:t,fontsLoading:i},r){let o=e.map(u=>new Promise(d=>{if(u.error){d();return}let m=()=>{u.removeEventListener("canplay",m),u.removeEventListener("error",m),r.removeEventListener("abort",m),d()};u.addEventListener("canplay",m),u.addEventListener("error",m),r.addEventListener("abort",m,{once:!0})})),a=t.map(u=>u.decode?u.decode().catch(()=>{}):Promise.resolve()),s=i&&n.fonts?n.fonts.ready.then(()=>{}):Promise.resolve();return Promise.all([...o,...a,s]).then(()=>{})}function vr(n,e,{scope:t="all"}={}){let i=Le(n,{scope:t});return i.pendingMedia.length===0&&i.pendingImages.length===0&&!i.fontsLoading?null:yr(n,i,e)}var Ar=50;function Sr(n,e){let t=n.defaultView;return!t||t.__renderReady||!t.__hf?null:new Promise(i=>{let r,o=()=>{r!==void 0&&clearTimeout(r),e.removeEventListener("abort",o),i()};if(e.aborted){o();return}e.addEventListener("abort",o,{once:!0});let a=()=>{if(t.__renderReady){o();return}r=setTimeout(a,Ar)};a()})}var Er=50,Tr=1.5,Rr=2,xr=1500;function mt(n,e){return new Promise(t=>{if(e.aborted){t(-1);return}let i=0,r=()=>{n.cancelAnimationFrame?.(i),t(-1)};e.addEventListener("abort",r,{once:!0}),i=n.requestAnimationFrame(o=>{e.removeEventListener("abort",r),t(o)})})}function wr(n,e){let t=n.defaultView;return t?(async()=>{let i=await mt(t,e);if(e.aborted)return;let r=await mt(t,e),o=r-i,a=0;for(;!e.aborted&&a<Rr;){if(r-i>=xr)return;let s=await mt(t,e);if(e.aborted)return;let u=s-r;o=Math.min(o,u),a=u<Er||u<=o*Tr?a+1:0,r=s}})():null}var kr=8e3;function Mr(n,e,t={}){let i=t.inputs??[(d,m)=>vr(d,m,{scope:t.scope}),Sr,wr],r=new AbortController,o=i.map(d=>d(n,r.signal)).filter(d=>d!==null);if(o.length===0){e({timedOut:!1});return}let a=t.timeoutMs??kr,s,u=new Promise(d=>{s=setTimeout(()=>d("timed-out"),a)});Promise.race([Promise.all(o).then(()=>"done"),u]).then(d=>{clearTimeout(s),r.abort(),e({timedOut:d==="timed-out"})})}function Ln(n,e,t={}){Mr(n,e,{...t,scope:B})}var Ir=.05,Dr=2,Oe=class{_entries=[];_mediaObserver;_playbackErrorPosted=!1;_audioOwner="runtime";_urlAudioEntry=null;_urlAudioSrc=null;_dispatchEvent;_getMuted;_getVolume;_getPlaybackRate;_getCurrentTime;_isPaused;constructor(e){this._dispatchEvent=e.dispatchEvent,this._getMuted=e.getMuted,this._getVolume=e.getVolume,this._getPlaybackRate=e.getPlaybackRate,this._getCurrentTime=e.getCurrentTime,this._isPaused=e.isPaused}get audioOwner(){return this._audioOwner}get entries(){return this._entries}resetForIframeLoad(){this._playbackErrorPosted=!1;let e=this._audioOwner==="parent";this._audioOwner="runtime",this.pauseAll();for(let t of this._entries)t!==this._urlAudioEntry&&(t.el.src="");this._entries=this._urlAudioEntry?[this._urlAudioEntry]:[],this._urlAudioSrc&&!this._urlAudioEntry&&(this._urlAudioEntry=this._createEntry(this._urlAudioSrc,"audio",0,1/0)),this.teardownObserver(),e&&this._dispatchEvent(new CustomEvent("audioownershipchange",{detail:{owner:"runtime",reason:"iframe-reload"}}))}destroy(){this.teardownObserver();for(let e of this._entries)e.el.pause(),e.el.src="";this._entries=[],this._urlAudioEntry=null,this._urlAudioSrc=null,this._audioOwner="runtime",this._playbackErrorPosted=!1}updateMuted(e){for(let t of this._entries)t.el.muted=e}updateVolume(e){for(let t of this._entries)t.el.volume=e}updatePlaybackRate(e){for(let t of this._entries)t.el.playbackRate=e}_playEntry(e){e.el.src&&e.el.play().catch(t=>this._reportPlaybackError(t))}_playEntryIfActive(e){this._refreshEntryBounds(e),this._inWindow(e,this._getCurrentTime())&&this._playEntry(e)}_refreshEntryBounds(e){if(!e.source?.isConnected)return;let t=et(e.source);e.start=t.start??0,e.duration=t.duration!=null&&t.duration>0?t.duration:Number.POSITIVE_INFINITY}_inWindow(e,t){return Pe(t,e.start,e.start+e.duration)}_gateEntryPlayback(e,t){return this._inWindow(e,t)?(this._audioOwner==="parent"&&!this._isPaused()&&e.el.paused&&this._playEntry(e),!0):(e.el.paused||e.el.pause(),e.driftSamples=0,!1)}playAll(){for(let e of this._entries)this._playEntryIfActive(e)}pauseAll(){for(let e of this._entries)e.el.pause()}stopAdoptedMedia(){for(let e of this._entries)e.source&&e.el.pause()}seekAll(e){for(let t of this._entries)this._refreshEntryBounds(t),this._inWindow(t,e)&&(t.el.currentTime=e-t.start)}scrubAll(e){for(let t of this._entries)this._refreshEntryBounds(t),this._inWindow(t,e)?(t.el.currentTime=e-t.start,this._playEntry(t)):t.el.paused||t.el.pause()}mirrorTime(e,t){let i=t?.force===!0;for(let r of this._entries){if(this._refreshEntryBounds(r),!this._gateEntryPlayback(r,e))continue;let o=e-r.start;Math.abs(r.el.currentTime-o)>Ir?(r.driftSamples+=1,(i||r.driftSamples>=Dr)&&(r.el.currentTime=o,r.driftSamples=0)):r.driftSamples=0}}promoteToParentProxy(e,t){if(this._audioOwner==="parent")return;if(this._audioOwner="parent",e)for(let r of e.querySelectorAll("video, audio"))x(r)&&(r.muted=!0);for(let r of[...this._entries])this._repointToSource(r);let i=this._getCurrentTime();t?t(i,{force:!0}):this.mirrorTime(i,{force:!0}),this._isPaused()||this.playAll(),this._dispatchEvent(new CustomEvent("audioownershipchange",{detail:{owner:"parent",reason:"autoplay-blocked"}}))}setupFromIframe(e){let t=e.querySelectorAll("audio[data-start], video[data-start]");for(let i of t)x(i)&&this._adoptIframeMedia(i);this._observeDynamicMedia(e)}setupFromUrl(e){if(this._urlAudioSrc===e&&this._urlAudioEntry)return;this.teardownUrlAudio();let t=this._createEntry(e,"audio",0,1/0);this._urlAudioEntry=t,this._urlAudioSrc=e,t&&this._audioOwner==="parent"&&!this._isPaused()&&(this.mirrorTime(this._getCurrentTime(),{force:!0}),this.playAll())}teardownUrlAudio(){let e=this._urlAudioEntry;if(this._urlAudioEntry=null,this._urlAudioSrc=null,!e)return;e.el.pause(),e.el.src="";let t=this._entries.indexOf(e);t!==-1&&this._entries.splice(t,1)}teardownObserver(){this._mediaObserver?.disconnect(),this._mediaObserver=void 0}_reportPlaybackError(e){this._playbackErrorPosted||(this._playbackErrorPosted=!0,this._dispatchEvent(new CustomEvent("playbackerror",{detail:{source:"parent-proxy",error:e}})))}_createEntry(e,t,i,r,o){if(this._urlTaken(e))return null;let a=t==="video"?document.createElement("video"):new Audio;a.preload="auto",a.src=e,a.load(),a.muted=this._getMuted(),a.volume=this._getVolume();let s=this._getPlaybackRate();s!==1&&(a.playbackRate=s);let u={el:a,start:i,duration:r,driftSamples:0,source:o};return this._entries.push(u),u}_resolveIframeMediaSrc(e){let t=e.getAttribute("src")||e.querySelector("source")?.getAttribute("src");return t?new URL(t,e.ownerDocument.baseURI).href:null}_adoptIframeMedia(e){if(e.preload==="metadata"||e.preload==="none")return;let t=this._resolveIframeMediaSrc(e);if(!t)return;let i=et(e),r=i.start??0,o=i.duration??Number.POSITIVE_INFINITY,a=e.tagName==="VIDEO"?"video":"audio",s=this._createEntry(t,a,r,o,e);s&&this._audioOwner==="parent"&&(this.mirrorTime(this._getCurrentTime(),{force:!0}),this._isPaused()||this._playEntryIfActive(s))}_followIframeMediaSrc(e){let t=this._entries.find(i=>i.source===e);if(!t)return this._adoptIframeMedia(e);this._audioOwner!=="parent"||!this._repointToSource(t)||(this.mirrorTime(this._getCurrentTime(),{force:!0}),this._isPaused()||this._playEntryIfActive(t))}_urlTaken(e,t){return this._entries.some(i=>i===t||i.source&&!i.source.isConnected?!1:(i.source&&this._resolveIframeMediaSrc(i.source)||i.el.src)===e)}_repointToSource(e){let t=e.source?this._resolveIframeMediaSrc(e.source):null;return!t||e.el.src===t?!1:this._urlTaken(t,e)?(this._removeEntry(e),!1):(e.el.src=t,e.el.load(),!0)}_detachIframeMedia(e){let t=this._entries.find(i=>i.source===e);t&&this._removeEntry(t)}_removeEntry(e){e.el.pause(),e.el.src="",this._entries.splice(this._entries.indexOf(e),1)}_observeDynamicMedia(e){if(this.teardownObserver(),typeof MutationObserver>"u"||!e.body)return;let t=new MutationObserver(o=>{for(let a of o){if(a.type==="attributes"&&a.attributeName==="src"){let s=a.target;x(s)&&s.matches("audio[data-start], video[data-start]")&&this._followIframeMediaSrc(s);continue}if(a.type==="attributes"&&a.attributeName==="preload"){let s=a.target;x(s)&&s.matches("audio[data-start], video[data-start]")&&(s.preload==="auto"?this._adoptIframeMedia(s):this._detachIframeMedia(s));continue}for(let s of a.addedNodes){if(!se(s))continue;let u=[];x(s)&&s.matches("audio[data-start], video[data-start]")&&u.push(s);let d=s.querySelectorAll("audio[data-start], video[data-start]");for(let m of d)x(m)&&u.push(m);for(let m of u)this._adoptIframeMedia(m)}for(let s of a.removedNodes){if(!se(s))continue;let u=[];x(s)&&s.matches("audio[data-start], video[data-start]")&&u.push(s);let d=s.querySelectorAll("audio[data-start], video[data-start]");for(let m of d)x(m)&&u.push(m);for(let m of u)this._detachIframeMedia(m)}}}),i={childList:!0,subtree:!0,attributes:!0,attributeFilter:["preload","src"]},r=Rn(e);for(let o of r)t.observe(o,i);this._mediaObserver=t}};function pt(n,e,t){if(n===null&&e===null)return{range:null,clamped:!1};let i=n??0,r=e!==null&&t>0&&e>t,o=r?t:e,a=o??(t>0?t:1/0);return!(i>=0)||!(a>i)?{range:null,clamped:!0}:{range:{start:i,end:o},clamped:r}}function ue(n,e,t){let i=n.end??e;return i<e?In(n.start,i,t):i}function ft(n,e,t,i){return n<e.start||n>=ue(e,t,i)}var Cr=100;function Nr(n,e){return typeof n.currentTime=="number"&&Number.isFinite(n.currentTime)?n.currentTime:(n.frame??0)/e}function On(n,e,t){return t<=0?!1:n.ended===!0?!0:n.ended===!1&&!n.isPlaying?!1:e>=t}function Pr(n,e,t,i,r,o){let{duration:a}=t;if(!r){let s=On(n,e,a);return{start:0,shownAtEnd:a,atEnd:s,stopRuntime:!1,entering:!1}}if(n.ownsRange){let s=i&&n.ended===!0&&!n.isPlaying;return{start:r.start,shownAtEnd:e,atEnd:s,stopRuntime:!1,entering:!1}}return Lr(n,e,t,i,r,o)}function Lr(n,e,t,i,r,o){let a=r.end??t.duration,s=t.enteringRange===!0&&(e<r.start||e>=a);return{start:r.start,shownAtEnd:ue(r,t.duration,o),atEnd:i&&!s&&On(n,e,a),stopRuntime:n.isPlaying,entering:s}}function Fn(n,e,t,i){let r=Nr(n,e),o=!t.paused,a=o||n.isPlaying,s=i.getPlayRange?.(),u=Pr(n,r,t,a,s,e),{atEnd:d,start:m}=u,g=t.duration>0?Math.min(r,t.duration):r,y=d?u.shownAtEnd:g,h=!n.isPlaying,A=d&&a;if(A&&i.getLoop())return i.media.audioOwner==="parent"&&i.media.pauseAll(),i.seek(m),i.play(),{...t,currentTime:m,paused:!1,enteringRange:!0};let b={...t,currentTime:y,paused:h,enteringRange:u.entering};i.media.audioOwner==="parent"&&(o&&h?i.media.pauseAll():!o&&!h&&i.media.playAll(),i.media.mirrorTime(y));let S=performance.now(),C=h!==t.paused;return(S-t.lastUpdateMs>Cr||C)&&(b.lastUpdateMs=S,i.updateControlsTime(y,t.duration),i.updateControlsPlaying(!h),i.dispatchEvent(new CustomEvent("timeupdate",{detail:{currentTime:y}}))),A&&(u.stopRuntime&&i.seek(y),i.media.audioOwner==="parent"&&i.media.pauseAll(),b.paused=!0,i.updateControlsPlaying(!1),i.dispatchEvent(new Event("ended"))),b}function Or(n){return Array.isArray(n)?n.filter(e=>typeof e=="object"&&e!==null&&typeof e.id=="string"&&typeof e.start=="number"&&typeof e.duration=="number"):[]}function Vn(n,e,t){if(n.source!==e)return;let i=n.data;if(!i||i.source!=="hf-preview")return;let r=Cn(i);if(r.status==="unsupported"){t.dispatchEvent(new CustomEvent("runtimeprotocolerror",{detail:{code:r.code,receivedVersion:r.receivedVersion}}));return}t.setRuntimeFps?.(r.fps);let o=r.status==="supported"&&r.metadata.capabilities.includes("play-range");if(t.setRuntimeOwnsPlayRange?.(o),i.type==="shader-transition-state"){let a=i.state&&typeof i.state=="object"?i.state:{};t.shaderLoader.update(a,t.getShaderLoadingMode()),t.dispatchEvent(new CustomEvent("shadertransitionstate",{detail:{compositionId:i.compositionId,state:a}}));return}if(i.type==="ready"){t.onRuntimeReady();return}if(i.type==="assets-ready"){t.onRuntimeAssetsReady?.(i.timedOut===!0);return}if(i.type==="runtime-data-error"){t.onRuntimeDataError?.(i.channel,i.requestId,i.message);return}if(i.type==="runtime-data-applied"){t.onRuntimeDataApplied?.(i.channel,i.requestId);return}if(i.type==="state"){t.setPlaybackState(Fn({frame:i.frame??0,currentTime:i.currentTime,ended:typeof i.ended=="boolean"?i.ended:void 0,isPlaying:!!i.isPlaying,ownsRange:o},r.fps,t.getPlaybackState(),t));return}if(i.type==="media-autoplay-blocked"){if(t.shouldPromoteMediaAutoplayFallback?.()===!1)return;let a=null;try{a=t.getIframeDoc()}catch{}t.media.promoteToParentProxy(a,(s,u)=>t.media.mirrorTime(s,u)),t.sendControl("set-media-output-muted",{muted:!0});return}if(i.type==="timeline"&&i.durationInFrames>0){let a=Number(i.durationSeconds),s=Number(i.durationInFrames),u=Number.isFinite(a)&&a>0?a:s/r.fps;if(Number.isFinite(i.compositionWidth)&&i.compositionWidth>0&&Number.isFinite(i.compositionHeight)&&i.compositionHeight>0&&t.setCompositionSize(i.compositionWidth,i.compositionHeight),Number.isFinite(u)&&u>0){let d=t.getPlaybackState();t.setPlaybackState({...d,duration:u}),t.updateControlsTime(d.currentTime,u),t.onRuntimeTimelineReady(u,typeof i.assetsReady=="boolean"?i.assetsReady:void 0)}t.setScenes(Or(i.scenes));return}i.type==="stage-size"&&Number.isFinite(i.width)&&i.width>0&&Number.isFinite(i.height)&&i.height>0&&t.setCompositionSize(i.width,i.height)}function Fr(n,e){return n.includes(e)?!0:/hyperframe\.runtime\.iife\.js|__hyperframes\s*=/.test(n)}var Vr=new Set([">"," "," ",`
|
|
473
|
+
`,"\r","\f"]);function ht(n,e){let t=n.toLowerCase(),i=`<${e}`,r=0;for(;r<t.length;){let o=t.indexOf(i,r);if(o<0)return null;let a=t[o+i.length];if(Vr.has(a)){let s=t.indexOf(">",o+i.length);return s<0?null:{index:o,end:s+1}}r=o+i.length}return null}function Un(n,e){if(!n||Fr(n,e))return n;let t=`<script src="${e}"></script>`,i=ht(n,"head");if(i)return n.slice(0,i.end)+t+n.slice(i.end);let r=ht(n,"body");if(r)return n.slice(0,r.index)+t+n.slice(r.index);let o=ht(n,"html");return o?n.slice(0,o.end)+t+n.slice(o.end):t+n}var O="shader-capture-scale",$="shader-loading",Fe="runtime-src",Hn="__hf_shader_capture_scale",Wn="__hf_shader_loading",z=["Preparing scene transitions","Sampling outgoing scene motion","Sampling incoming scene motion","Caching transition frames","Finalizing transition preview"];function bt(n){if(n===null)return null;let e=Number(n);return!Number.isFinite(e)||e<=0?null:String(Math.min(1,Math.max(.25,e)))}function Ur(n){if(n===null||n.trim()==="")return"composition";let e=n.trim().toLowerCase();return e==="none"||e==="false"||e==="0"||e==="off"?"none":e==="player"||e==="true"||e==="1"||e==="on"?"player":"composition"}function Gn(n,e){return n.filter(t=>t!==""&&t.split("=")[0]!==e)}function Hr(n,e,t){let i=n.indexOf("#"),r=i>=0?n.slice(0,i):n,o=i>=0?n.slice(i):"",a=r.indexOf("?"),s=a>=0?r.slice(0,a):r,u=a>=0?r.slice(a+1):"",d=Gn(u.split("&"),Hn);d=Gn(d,Wn),e!==null&&d.push(`${Hn}=${encodeURIComponent(e)}`),t!=="composition"&&d.push(`${Wn}=${encodeURIComponent(t)}`);let m=d.join("&");return`${s}${m?`?${m}`:""}${o}`}function Wr(n,e,t){if(e===null&&t==="composition")return n;let i=[];e!==null&&i.push(`window.__HF_SHADER_CAPTURE_SCALE=${JSON.stringify(e)};`),t!=="composition"&&i.push(`window.__HF_SHADER_LOADING=${JSON.stringify(t)};`);let r=`<script data-hyperframes-player-shader-options>${i.join("")}</script>`;return/<head\b[^>]*>/i.test(n)?n.replace(/<head\b[^>]*>/i,o=>`${o}${r}`):/<html\b[^>]*>/i.test(n)?n.replace(/<html\b[^>]*>/i,o=>`${o}${r}`):`${r}${n}`}function le(n){return Ur(n.getAttribute($))}function Bn(n){return Number(bt(n.getAttribute(O))??"1")}function $n(n,e){return Hr(e,bt(n.getAttribute(O)),le(n))}function de(n,e){return Un(Wr(e,bt(n.getAttribute(O)),le(n)),gt(n))}function gt(n){let e=n.getAttribute(Fe)?.trim();if(!e)return G;try{let t=new URL(e,document.baseURI),i=t.protocol==="http:"||t.protocol==="https:",r=t.hostname==="127.0.0.1"||t.hostname==="localhost"||t.hostname==="[::1]";return i&&(r||t.origin===location.origin)?t.href:G}catch{return G}}function zn(){let n=document.createElement("div");n.className="hfp-shader-loader",n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),n.setAttribute("aria-label","Preparing scene transitions"),n.setAttribute("data-hyperframes-ignore",""),n.draggable=!1;let e=h=>{h.preventDefault(),h.stopPropagation()};for(let h of["selectstart","dragstart","pointerdown","mousedown","click","dblclick","contextmenu","touchstart"])n.addEventListener(h,e,{capture:!0});let t=document.createElement("div");t.className="hfp-shader-loader-panel",t.draggable=!1;let i=document.createElement("div");i.className="hfp-shader-loader-mark",i.draggable=!1,i.innerHTML=['<svg width="78" height="78" viewBox="0 0 100 100" fill="none" aria-hidden="true" draggable="false">','<path d="M10.1851 57.8021L33.1145 73.8313C36.2202 75.9978 41.5173 73.5433 42.4816 69.4984L51.7611 30.4271C52.7253 26.3822 48.5802 23.9277 44.4602 26.0942L13.917 42.1235C6.96677 45.7676 4.97564 54.1579 10.1851 57.8021Z" fill="url(#hfp-shader-loader-grad-left)"/>','<path d="M87.5129 57.5141L56.9696 73.5433C52.8371 75.7098 48.7046 73.2553 49.6688 69.2104L58.9483 30.1391C59.9125 26.0942 65.2097 23.6397 68.3154 25.8062L91.2447 41.8354C96.4668 45.4796 94.4631 53.8699 87.5129 57.5141Z" fill="url(#hfp-shader-loader-grad-right)"/>',"<defs>",'<linearGradient id="hfp-shader-loader-grad-left" x1="48.5676" y1="25" x2="44.7804" y2="71.9384" gradientUnits="userSpaceOnUse">','<stop stop-color="#06E3FA"/>','<stop offset="1" stop-color="#4FDB5E"/>',"</linearGradient>",'<linearGradient id="hfp-shader-loader-grad-right" x1="54.8282" y1="73.8392" x2="72.0989" y2="32.8932" gradientUnits="userSpaceOnUse">','<stop stop-color="#06E3FA"/>','<stop offset="1" stop-color="#4FDB5E"/>',"</linearGradient>","</defs>","</svg>"].join("");let r=document.createElement("div");r.className="hfp-shader-loader-title";let o=document.createElement("span");o.className="hfp-shader-loader-title-text",o.textContent=z[0]||"Preparing scene transitions",r.appendChild(o);let a=document.createElement("div");a.className="hfp-shader-loader-detail",a.textContent="Rendering animated scene samples for shader transitions.";let s=document.createElement("div");s.className="hfp-shader-loader-track",s.setAttribute("aria-hidden","true");let u=document.createElement("div");u.className="hfp-shader-loader-fill",s.appendChild(u);let d=document.createElement("div");d.className="hfp-shader-loader-progress";let m=h=>{let A=document.createElement("div");A.className="hfp-shader-loader-row";let b=document.createElement("span");b.className="hfp-shader-loader-label",b.textContent=h;let S=document.createElement("span");return S.className="hfp-shader-loader-value",A.appendChild(b),A.appendChild(S),d.appendChild(A),{row:A,label:b,value:S}},g=m("transition"),y=m("transition frame");return t.appendChild(i),t.appendChild(r),t.appendChild(a),t.appendChild(s),t.appendChild(d),n.appendChild(t),{root:n,fill:u,title:o,detail:a,transitionValue:g.value,transitionRow:g.row,frameLabel:y.label,frameValue:y.value,frameRow:y.row}}var Gr=420;function Ve(n,e,t){e.textContent=t,n.style.visibility=t?"visible":"hidden"}var Ue=class{_el;_hideTimeout=null;_hiddenCallbacks=[];_drawingAssets=!1;constructor(e){this._el=e}show(){this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null),this._el.root.classList.remove("hfp-hiding"),this._el.root.classList.add("hfp-visible")}hide(){if(this._el.root.classList.contains("hfp-hiding")){this._hideTimeout||this._scheduleCleanup();return}this._el.root.classList.contains("hfp-visible")&&(this._el.root.classList.add("hfp-hiding"),this._el.root.classList.remove("hfp-visible"),this._scheduleCleanup())}whenHidden(e){let t=this._el.root.classList;t.contains("hfp-visible")||t.contains("hfp-hiding")?this._hiddenCallbacks.push(e):e()}_flushHidden(){let e=this._hiddenCallbacks;this._hiddenCallbacks=[];for(let t of e)t()}reset(){this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null),this._el.root.classList.remove("hfp-visible","hfp-hiding"),this._drawingAssets=!1,this._flushHidden(),this._el.fill.style.transform="scaleX(0)",Ve(this._el.transitionRow,this._el.transitionValue,""),Ve(this._el.frameRow,this._el.frameValue,"")}update(e,t){let i=t==="player"&&e.loading&&!e.ready;if(this._drawingAssets&&!i)return;if(t!=="player"){this.reset();return}if(e.ready||!e.loading){this.hide();return}this._el.root.setAttribute("aria-label","Preparing scene transitions"),this._drawingAssets=!1;let r=typeof e.progress=="number"&&Number.isFinite(e.progress)?e.progress:0,o=typeof e.total=="number"&&Number.isFinite(e.total)?e.total:0,a=o>0?Math.min(1,Math.max(0,r/o)):0,s=Math.min(z.length-1,Math.floor(a*z.length));this._el.title.textContent=z[s]||"Preparing scene transitions",this._el.detail.textContent=e.phase==="cached"?"Loading cached transition frames before playback.":e.phase==="finalizing"?"Uploading transition textures for smooth playback.":"Rendering animated scene samples for shader transitions.",this._el.fill.style.transform=`scaleX(${a})`;let u=e.currentTransition!==void 0&&e.transitionTotal!==void 0?`${e.currentTransition}/${e.transitionTotal}`:o>0?`${r}/${o}`:"",d=e.transitionFrame!==void 0&&e.transitionFrames!==void 0?`${e.transitionFrame}/${e.transitionFrames}`:"";this._el.frameLabel.textContent=e.phase==="cached"?"cached transition frames":e.phase==="finalizing"?"finalizing transition frames":"rendering transition frames",Ve(this._el.transitionRow,this._el.transitionValue,u),Ve(this._el.frameRow,this._el.frameValue,d),this._el.root.setAttribute("aria-valuenow",String(Math.round(a*100))),this.show()}showAssetsLoading(){this.reset(),this._el.title.textContent="Loading assets",this._el.detail.textContent="Waiting for images, video and fonts to finish loading.",this._el.root.setAttribute("aria-label","Loading assets"),this._drawingAssets=!0,this.show()}hideAssetsLoading(){this._drawingAssets&&this.hide()}get hideTimeout(){return this._hideTimeout}destroy(){this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null),this._hiddenCallbacks=[]}_scheduleCleanup(){this._hideTimeout&&clearTimeout(this._hideTimeout),this._hideTimeout=setTimeout(()=>{this._el.root.classList.remove("hfp-hiding"),this._hideTimeout=null,this._flushHidden()},Gr)}};function jn(n){return n?.trim().toLowerCase().startsWith("video/")??!1}function qn(n){let e=document.createElement("video");e.className="hfp-video",e.playsInline=!0,e.preload="metadata";let t=new AbortController,{signal:i}=t;return e.addEventListener("loadedmetadata",()=>n.onMetadata(e),{signal:i}),e.addEventListener("durationchange",()=>n.onDurationChange(e),{signal:i}),e.addEventListener("resize",()=>n.onResize(e),{signal:i}),e.addEventListener("play",()=>n.onPlay(e),{signal:i}),e.addEventListener("pause",()=>n.onPause(e),{signal:i}),e.addEventListener("timeupdate",()=>n.onTimeUpdate(),{signal:i}),e.addEventListener("error",()=>n.onError(e.error?.message||"Video failed to load",e.error?.code??null),{signal:i}),{video:e,adapter:{duration:()=>e.duration,time:()=>e.currentTime,seek:o=>{e.currentTime=o},play:()=>e.play().catch(o=>{i.aborted||n.onPlayRejected(o)}),pause:()=>e.pause(),timeScale:o=>{e.defaultPlaybackRate=o,e.playbackRate=o}},destroy:()=>{t.abort(),e.pause(),e.removeAttribute("src"),e.load(),e.remove()}}}var Br=.1,$r=5,_t="sandbox-origin",Yn=1e4,yt=8e3,vt="assets-loading",ce="assets-loading-ui",At="low-power-idle",Xn="disable-click-to-play",me="range-start",pe="range-end",zr=150;function St(n){return!Number.isFinite(n)||n<=0?1:Math.max(Br,Math.min($r,n))}var He=class extends HTMLElement{static get observedAttributes(){return["src","srcdoc","width","height","controls","muted","audio-locked","volume","poster","playback-rate","audio-src","type",_t,Fe,O,$,ce,At,me,pe]}shadow;container;iframe;posterEl=null;controlsApi=null;resizeObserver;shaderLoader;probe;_ready=!1;_readyDocument=null;_connected=!1;_assetsReady=!1;_painted=!1;_pendingPlay=!1;_assetsGeneration=0;_assetsLoadingShowTimer=null;_currentTime=0;_duration=0;_paused=!0;_scrubbing=!1;_lastUpdateMs=0;_volume=1;_compositionWidth=1920;_compositionHeight=1080;_rescaleWarned=!1;_directTimelineAdapter=null;_directTimelineClock;_parentTickRaf=null;_media;_scenes=[];_runtimeFps=30;_runtimeBridgeReady=!1;_runtimeAssetsReadyGeneration=-1;_runtimeData=new Map;_runtimeDataRequestId=0;_pendingRuntimeData=new Map;_afterUpdate=null;_videoSource=null;_runtimeOwnsPlayRange=!1;_enteringRange=!1;_rangeClampReported="";constructor(){super(),this.shadow=this.attachShadow({mode:"open"}),Sn(this.shadow,hn),{container:this.container,iframe:this.iframe}=En(),this.shadow.appendChild(this.container);let e=zn();this.shadow.appendChild(e.root),this.shaderLoader=new Ue(e),this._media=new Oe({dispatchEvent:t=>this._emit(t),getMuted:()=>this.muted,getVolume:()=>this._volume,getPlaybackRate:()=>this.playbackRate,getCurrentTime:()=>this._currentTime,isPaused:()=>this._paused}),this._directTimelineClock=new Ce({onTimeUpdate:(t,i)=>{this._currentTime=t,this.controlsApi?.updateTime(t,i),this._emit(new CustomEvent("timeupdate",{detail:{currentTime:t}}))},getLoop:()=>this.loop,restart:()=>{this.seek(this._playRange()?.start??0),this.play()},onPaused:()=>{this._media.audioOwner==="parent"&&this._media.pauseAll(),this._paused=!0,this.controlsApi?.updatePlaying(!1),this._emit(new Event("ended"))},onEnded:()=>this.loop}),this.probe=new Me(this.iframe,{resolveRuntimeUrl:()=>gt(this),onReady:t=>this._onProbeReady(t),onError:t=>this._emit(new CustomEvent("error",{detail:{message:t}}))}),this.addEventListener("click",t=>{this.disableClickToPlay||An(t)||(this._paused?this.play():this.pause())}),this.resizeObserver=new ResizeObserver(()=>this._rescale()),this._onMessage=this._onMessage.bind(this),this._onIframeLoad=this._onIframeLoad.bind(this),this.iframe.addEventListener("load",this._onIframeLoad)}connectedCallback(){this._connected=!0,this._applySandboxOriginPolicy(),this.resizeObserver.observe(this),window.addEventListener("message",this._onMessage),this.hasAttribute("controls")&&this._setupControls(),this.hasAttribute("poster")&&(this.posterEl=lt(this.shadow,this.getAttribute("poster"),this.posterEl)),this.hasAttribute("audio-src")&&this._media.setupFromUrl(this.getAttribute("audio-src")),this.hasAttribute("srcdoc")&&(this.iframe.srcdoc=de(this,this.getAttribute("srcdoc"))),this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),!this.hasAttribute("audio-locked")&&this._isLockedHostEnvironment()&&this._applyAudioLock(!0)}disconnectedCallback(){this._connected=!1,this._teardownVideo(),this._sendControl("pause"),this._stopIframeMedia(),this.resizeObserver.disconnect(),window.removeEventListener("message",this._onMessage),this.probe.stop(),this._directTimelineClock.stop(),this._stopParentTickClock(),this._directTimelineAdapter=null,this.shaderLoader.destroy(),this._media.destroy(),this.controlsApi?.destroy(),this.controlsApi=null,this._paused=!0,this._pendingPlay=!1,this._abandonComposition("Player disconnected before runtime data was applied")}attributeChangedCallback(e,t,i){switch(e){case"src":if(!this.isConnected)break;i&&this._navigateSrc(i);break;case"type":{let r=this.getAttribute("src");if(!this.isConnected||r===null||!!this._videoSource===this._wantsVideo())break;this._navigateSrc(r);break}case"srcdoc":if(!this.isConnected)break;if(this._pendingPlay=!1,this._abandonComposition("Composition navigated before runtime data was applied"),i!==null)this._pauseForVideoSwitch(),this._teardownVideo(),this.iframe.srcdoc=de(this,i);else{this.iframe.removeAttribute("srcdoc");let r=this.getAttribute("src");r!==null&&this._wantsVideo()&&this._navigateSrc(r)}break;case _t:this._applySandboxOriginPolicy(this.isConnected&&t!==i);break;case"width":this._setCompositionSize(oe(i)??1920,this._compositionHeight);break;case"height":this._setCompositionSize(this._compositionWidth,oe(i)??1080);break;case"controls":i!==null?this._setupControls():(this.controlsApi?.destroy(),this.controlsApi=null);break;case"poster":this.posterEl=lt(this.shadow,i,this.posterEl);break;case"playback-rate":{let r=St(parseFloat(i||"1"));this._media.updatePlaybackRate(r),this._sendControl("set-playback-rate",{playbackRate:r}),this._directTimelineAdapter?.timeScale?.(r),this.controlsApi?.updateSpeed(r),this._emit(new Event("ratechange"));break}case"muted":this._handleMutedChange(i);break;case"audio-locked":this._applyAudioLock(i!==null);break;case"volume":{let r=Math.max(0,Math.min(1,parseFloat(i||"1")));this._volume=r,this._syncVideoAudio(),this._media.updateVolume(r),this._sendControl("set-volume",{volume:r}),this.controlsApi?.updateVolume(r),this._emit(new Event("volumechange"));break}case"audio-src":i?this._media.setupFromUrl(i):this._media.teardownUrlAudio();break;case ce:i==="none"&&this.shaderLoader.hideAssetsLoading();break;case At:this._sendControl("set-idle-heartbeat",{slow:i!==null});break;case me:case pe:this._applyPlayRange(!0);break;case O:case $:case Fe:if(!this.isConnected)break;this._reloadShaderOptions();break}}_applySandboxOriginPolicy(e=!1){this.hasAttribute(_t)?this.iframe.sandbox.remove("allow-same-origin"):this.iframe.sandbox.add("allow-same-origin"),e&&this._reloadForSandboxOriginPolicy()}_reloadForSandboxOriginPolicy(){if(this._videoSource)return;this._abandonComposition("Sandbox policy changed before runtime data was applied");let e=this.getAttribute("srcdoc");if(e!==null){this.iframe.srcdoc=de(this,e);return}let t=this.getAttribute("src");t===null?this.iframe.src="about:blank":this._loadSrc(t)}get iframeElement(){return this.iframe}get scenes(){return this._scenes}play(){this._play(!0)}_play(e){if(this._ready&&!this._assetsReady){this._pendingPlay=!0;return}this._pendingPlay=!1,this.posterEl?.remove(),this.posterEl=null;let t=this._ready?this._playRange():null;t?ft(this._currentTime,t,this._duration,this._runtimeFps)&&(this.seek(t.start),this._enteringRange=!0):this._duration>0&&this._currentTime>=this._duration&&this.seek(0),this._paused=!1;let i=this._tryDirectTimelinePlay(),r=!1;this._sendDisplayScale(),i||(this._sendControl("play"),this._ready&&!this._directTimelineAdapter?this._startParentTickClock():this._ready||(this._pendingPlay=!0,r=!0)),this._media.audioOwner==="parent"&&this._media.playAll(),this.controlsApi?.updatePlaying(!0),!r&&e&&this._emit(new Event("play")),i&&this._directTimelineAdapter&&this._directTimelineClock.start(this._directTimelineAdapter,()=>this._currentTime,()=>this._duration,()=>this._paused,()=>this._clockStop())}pause(){this._pendingPlay=!1,this._tryDirectTimelinePause()?this._showPausedVideoTime():this._sendControl("pause"),this._directTimelineClock.stop(),this._stopParentTickClock(),this._media.audioOwner==="parent"&&this._media.pauseAll(),this._paused=!0,this.controlsApi?.updatePlaying(!1),this._emit(new Event("pause"))}stopMedia(){this._sendControl("stop-media"),this._stopIframeMedia(),this._media.stopAdoptedMedia()}seek(e){this._pendingPlay=!1,!this._trySyncSeek(e)&&!this._tryDirectTimelineSeek(e)&&this._sendControl("seek",{timeSeconds:e,frame:Math.round(e*this._runtimeFps)}),this._directTimelineClock.stop(),this._stopParentTickClock(),this._currentTime=e,this._media.audioOwner==="parent"&&(this._scrubbing?this._media.scrubAll(e):(this._media.pauseAll(),this._media.seekAll(e))),this._paused=!0,this.controlsApi?.updatePlaying(!1),this.controlsApi?.updateTime(this._currentTime,this._duration)}setColorGrading(e,t){this._sendControl("set-color-grading",{target:e,grading:t})}clearColorGrading(e){this._sendControl("set-color-grading",{target:e,grading:null})}setColorGradingCompare(e,t){this._sendControl("set-color-grading-compare",{target:e,compare:t})}clearColorGradingCompare(e){this._sendControl("set-color-grading-compare",{target:e,compare:{enabled:!1}})}setRuntimeData(e,t){if(!/^[a-z][a-z0-9-]{0,63}$/.test(e))throw new Error(`Invalid HyperFrames runtime-data channel: ${e}`);if(typeof structuredClone!="function")throw new Error("HyperFrames runtime data requires structuredClone support; refusing an unverified payload");let i=structuredClone(t);this._runtimeData.set(e,i),this._deliverRuntimeData(e,i)}clearRuntimeData(e){if(!/^[a-z][a-z0-9-]{0,63}$/.test(e))throw new Error(`Invalid HyperFrames runtime-data channel: ${e}`);this._runtimeData.delete(e),this._deliverRuntimeDataClear(e)}get currentTime(){return this._currentTime}set currentTime(e){this.seek(e)}get duration(){return this._duration}get compositionWidth(){return this._compositionWidth}get compositionHeight(){return this._compositionHeight}get paused(){return this._paused}get ready(){return this._ready}get assetsReady(){return this._assetsReady}get painted(){return this._painted}get playbackRate(){return St(parseFloat(this.getAttribute("playback-rate")||"1"))}set playbackRate(e){this.setAttribute("playback-rate",String(St(e)))}get shaderCaptureScale(){return Bn(this)}set shaderCaptureScale(e){this.setAttribute(O,String(e))}get shaderLoading(){return le(this)}set shaderLoading(e){e==="composition"?this.removeAttribute($):this.setAttribute($,e)}get assetsLoadingUi(){return this.getAttribute(ce)==="none"?"none":"player"}set assetsLoadingUi(e){e==="none"?this.setAttribute(ce,"none"):this.removeAttribute(ce)}get muted(){return this.hasAttribute("muted")}set muted(e){e?this.setAttribute("muted",""):this.removeAttribute("muted")}get audioLocked(){return this.hasAttribute("audio-locked")}set audioLocked(e){e?this.setAttribute("audio-locked",""):this.removeAttribute("audio-locked")}_isLockedHostEnvironment(){if(typeof navigator>"u")return!1;let e=navigator.userAgent||"";return/\bClaude\/\d/.test(e)&&/\bElectron\b/.test(e)}_isAudioLocked(){return this.hasAttribute("audio-locked")||this._isLockedHostEnvironment()}_isSlideshowPlayer(){return this.closest("hyperframes-slideshow")!==null}_handleMutedChange(e){if(e===null&&this._isAudioLocked()){this.setAttribute("muted","");return}this._media.updateMuted(e!==null),this._syncVideoAudio(),this._setIframeMediaMuted(e!==null),this._sendControl("set-muted",{muted:e!==null}),this.controlsApi?.updateMuted(e!==null),this._emit(new Event("volumechange"))}_applyAudioLock(e){e&&(this.muted=!0),this.controlsApi?.setVolumeControlsHidden(e)}get volume(){return this._volume}set volume(e){this.setAttribute("volume",String(Math.max(0,Math.min(1,e))))}get disableClickToPlay(){return this.hasAttribute(Xn)}set disableClickToPlay(e){this.toggleAttribute(Xn,e)}get loop(){return this.hasAttribute("loop")}set loop(e){e?this.setAttribute("loop",""):this.removeAttribute("loop")}get rangeStart(){return this._readSeconds(me)}set rangeStart(e){this._writeSeconds(me,e)}get rangeEnd(){return this._readSeconds(pe)}set rangeEnd(e){this._writeSeconds(pe,e)}_readSeconds(e){let t=this.getAttribute(e);return t===null?null:Number(t)}_writeSeconds(e,t){t==null?this.removeAttribute(e):this.setAttribute(e,String(t))}_hasPlayRange(){return this.hasAttribute(me)||this.hasAttribute(pe)}_playRange(){return pt(this.rangeStart,this.rangeEnd,this._duration).range}_sendPlayRange(e){let t=e?.end??null;this._sendControl("set-play-range",{startSeconds:e?.start??null,endSeconds:t})}_applyPlayRange(e){let{range:t,clamped:i}=pt(this.rangeStart,this.rangeEnd,this._duration);this._sendPlayRange(t),this._ready&&(this._reportRangeClamp(t,i),t&&e&&!this._pendingPlay&&this._moveIntoPlayRange(t))}_reportRangeClamp(e,t){let i=t?`${this.rangeStart},${this.rangeEnd},${this._duration}`:"";if(i===this._rangeClampReported||(this._rangeClampReported=i,!t))return;let r={rangeStart:e?.start??null,rangeEnd:e?.end??null};this._emit(new CustomEvent("rangeclamped",{detail:{...r,duration:this._duration}}))}_moveIntoPlayRange(e){ft(this._currentTime,e,this._duration,this._runtimeFps)&&(this._paused?this.seek(e.start):this._jumpWhilePlaying(e.start))}_jumpWhilePlaying(e){this._directTimelineAdapter?(this._directTimelineAdapter.seek(e,!1),this._currentTime=e):this._runtimeOwnsPlayRange||(this.seek(e),this._enteringRange=!0,this._play(!1))}_clockStop(){let e=this._playRange(),t=e?.end??this._duration;if(!e)return{end:t,shown:t};let i=ue(e,this._duration,this._runtimeFps);return{end:t,shown:i<t?(i+t)/2:i}}_sendControl(e,t={}){try{let i=this.iframe.contentWindow;return i?(i.postMessage({...t,source:"hf-parent",type:"control",action:e,...ct(this._runtimeFps)},"*"),!0):((e==="set-runtime-data"||e==="clear-runtime-data")&&this._rejectRuntimeDataDelivery(t.channel,t.requestId,"Composition iframe is unavailable"),!1)}catch(i){return(e==="set-runtime-data"||e==="clear-runtime-data")&&this._rejectRuntimeDataDelivery(t.channel,t.requestId,i instanceof Error?i.message:String(i)),!1}}_deliverRuntimeData(e,t){if(!this.isConnected||!this._runtimeBridgeReady)return;let i=this._beginRuntimeDataDelivery(e);this._trySetRuntimeDataDirect(e,t,i)||this._sendControl("set-runtime-data",{channel:e,payload:t,requestId:i})}_deliverRuntimeDataClear(e){if(!this.isConnected||!this._runtimeBridgeReady)return;let t=this._beginRuntimeDataDelivery(e);this._tryClearRuntimeDataDirect(e,t)||this._sendControl("clear-runtime-data",{channel:e,requestId:t})}_trySetRuntimeDataDirect(e,t,i){try{let r=this.iframe.contentWindow?.__hyperframes;return typeof r?.setRuntimeData!="function"?!1:(r.setRuntimeData(e,t,i),!0)}catch{return!1}}_tryClearRuntimeDataDirect(e,t){try{let i=this.iframe.contentWindow?.__hyperframes;return typeof i?.clearRuntimeData!="function"?!1:(i.clearRuntimeData(e,t),!0)}catch{return!1}}_replayRuntimeData(){for(let[e,t]of this._runtimeData)this._deliverRuntimeData(e,t)}_beginRuntimeDataDelivery(e){let t=this._pendingRuntimeData.get(e);t&&window.clearTimeout(t.timeoutId),this._runtimeDataRequestId+=1;let i=this._runtimeDataRequestId,r=window.setTimeout(()=>{this._rejectRuntimeDataDelivery(e,i,`Runtime data delivery timed out after ${Yn}ms`)},Yn);return this._pendingRuntimeData.set(e,{requestId:i,timeoutId:r}),i}_resolveRuntimeDataDelivery(e,t){let i=this._takeRuntimeDataDelivery(e,t);i&&this._emit(new CustomEvent("runtimedataapplied",{detail:{channel:e,requestId:i.requestId}}))}_rejectRuntimeDataDelivery(e,t,i){let r=this._takeRuntimeDataDelivery(e,t);r&&this._emit(new CustomEvent("runtimedataerror",{detail:{channel:e,requestId:r.requestId,message:typeof i=="string"?i:String(i)}}))}_takeRuntimeDataDelivery(e,t){if(typeof e!="string"||typeof t!="number"||!Number.isSafeInteger(t))return null;let i=this._pendingRuntimeData.get(e);return!i||i.requestId!==t?null:(window.clearTimeout(i.timeoutId),this._pendingRuntimeData.delete(e),i)}_rejectAllRuntimeDataDeliveries(e){for(let[t,i]of[...this._pendingRuntimeData])this._rejectRuntimeDataDelivery(t,i.requestId,e)}_getSameOriginIframeDocument(){try{return this.iframe.contentDocument}catch{return null}}_setIframeMediaMuted(e){let t=this._getSameOriginIframeDocument();if(t)for(let i of t.querySelectorAll("video, audio"))x(i)&&(i.muted=e||i.defaultMuted)}_stopIframeMedia(){let e=this._getSameOriginIframeDocument();if(e)for(let t of e.querySelectorAll("video, audio"))x(t)&&t.pause()}_replayBridgeState(){this._sendControl("set-muted",{muted:this.muted}),this._sendControl("set-volume",{volume:this._volume}),this._sendControl("set-playback-rate",{playbackRate:this.playbackRate}),this._sendControl("set-native-media-sync-disabled",{disabled:this._isSlideshowPlayer()}),this._sendControl("set-web-audio-media-disabled",{disabled:this._isSlideshowPlayer()}),this._sendControl("set-idle-heartbeat",{slow:this.hasAttribute(At)}),this._sendDisplayScale()}_sendDisplayScale(){let e=Dn(this.iframe);e&&this._sendControl("set-display-scale",{scale:e})}_reloadShaderOptions(){if(!this._videoSource){if(this._abandonComposition("Shader options changed before runtime data was applied"),this.hasAttribute("srcdoc")){this.iframe.srcdoc=de(this,this.getAttribute("srcdoc")||"");return}this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")||"")}}_navigateSrc(e){this._pendingPlay=!1,this._pauseForVideoSwitch(),this._abandonComposition("Composition navigated before runtime data was applied"),this._loadSrc(e)}_wantsVideo(){return jn(this.getAttribute("type"))&&!this.hasAttribute("srcdoc")}_pauseForVideoSwitch(){!this._videoSource&&!this._wantsVideo()||(this._paused=!0,this.controlsApi?.updatePlaying(!1))}_loadSrc(e){if(this._wantsVideo()){this._loadVideo(e);return}this._teardownVideo(),this.iframe.src=$n(this,e)}_loadVideo(e){this._videoSource||(this._videoSource=qn({onMetadata:r=>this._applyThenEmit(()=>this._onVideoReady(r)),onDurationChange:r=>this._applyTimelineDuration(r.duration),onResize:r=>this._applyVideoSize(r),onPlay:r=>{!r.paused&&this._paused&&this.play()},onPause:r=>{r.paused&&!r.ended&&!this._paused&&this.pause()},onTimeUpdate:()=>{document.hidden&&this._playRange()&&this._directTimelineClock.poll()},onError:(r,o)=>{this._paused||this.pause(),this._emit(new CustomEvent("error",{detail:{message:r,code:o}}))},onPlayRejected:r=>this._onVideoPlayRejected(r)}),this.container.appendChild(this._videoSource.video),this.iframe.hidden=!0,this.iframe.src="about:blank"),this.probe.stop();let{video:t,adapter:i}=this._videoSource;this._directTimelineAdapter=i,this._currentTime=0,this._duration=0,this.controlsApi?.updateTime(0,0),this._syncVideoAudio(),i.timeScale?.(this.playbackRate),t.src=e}_teardownVideo(){this._videoSource&&(this._videoSource.destroy(),this._videoSource=null,this.iframe.hidden=!1)}_syncVideoAudio(){this._videoSource&&(this._videoSource.video.muted=this.muted,this._videoSource.video.volume=this._volume)}_onVideoReady(e){this._applyTimelineDuration(e.duration),this._applyVideoSize(e),this._ready=!0,this._dispatchReady(),this._waitForAssetsReady(null),this._afterEvents(()=>{this.hasAttribute("autoplay")&&this._paused&&this.play()})}_applyTimelineDuration(e){!Number.isFinite(e)||e<=0||(this._setDuration(e),this.controlsApi?.updateTime(this._currentTime,e))}_applyVideoSize(e){e.videoWidth>0&&e.videoHeight>0&&this._setCompositionSize(e.videoWidth,e.videoHeight)}_onVideoPlayRejected(e){e instanceof DOMException&&e.name==="NotAllowedError"&&(this._paused||this.pause(),this._emit(new CustomEvent("playbackerror",{detail:{source:"video",error:e}})))}_trySyncSeek(e){if(this._videoSource)return!1;try{let i=this.iframe.contentWindow?.__player;return typeof i?.seek!="function"?!1:(i.seek.call(i,e),!0)}catch{return!1}}_withDirectTimeline(e){let t=this._videoSource?null:this.probe.resolveDirectTimelineAdapter(),i=t||this._directTimelineAdapter;if(!i)return!1;try{return e(i),t&&t!==this._directTimelineAdapter&&this._applyTimelineDuration(t.duration()),this._directTimelineAdapter=i,!0}catch{return!1}}_tryDirectTimelineSeek(e){return this._withDirectTimeline(t=>{t.seek(e,!1),t.pause()})}_tryDirectTimelinePlay(){return this._withDirectTimeline(e=>{e.play()})}_tryDirectTimelinePause(){return this._withDirectTimeline(e=>{e.pause()})}_showPausedVideoTime(){this._videoSource&&(this._currentTime=this._videoSource.video.currentTime,this.controlsApi?.updateTime(this._currentTime,this._duration),this._emit(new CustomEvent("timeupdate",{detail:{currentTime:this._currentTime}})))}_startParentTickClock(){this._stopParentTickClock();let e=()=>{if(this._paused){this._parentTickRaf=null;return}this._sendControl("tick"),this._parentTickRaf=requestAnimationFrame(e)};this._parentTickRaf=requestAnimationFrame(e)}_stopParentTickClock(){this._parentTickRaf!==null&&(cancelAnimationFrame(this._parentTickRaf),this._parentTickRaf=null)}_onMessage(e){this._videoSource||this.probe.failed||this._applyThenEmit(()=>this._handleRuntimeMessage(e))}_handleRuntimeMessage(e){Vn(e,this.iframe.contentWindow,{getPlaybackState:()=>({currentTime:this._currentTime,duration:this._duration,paused:this._paused,lastUpdateMs:this._lastUpdateMs,enteringRange:this._enteringRange}),setPlaybackState:({currentTime:t,duration:i,paused:r,lastUpdateMs:o,enteringRange:a})=>{this._enteringRange=a===!0,this._currentTime=t,this._setDuration(i),this._paused=r,this._lastUpdateMs=o},getShaderLoadingMode:()=>le(this),shaderLoader:this.shaderLoader,setCompositionSize:(t,i)=>this._setCompositionSize(t,i),sendControl:(t,i)=>this._sendControl(t,i),getIframeDoc:()=>this.iframe.contentDocument,onRuntimeReady:()=>{this._runtimeBridgeReady=!0,this._replayBridgeState(),this._hasPlayRange()&&this._sendPlayRange(this._playRange()),this._replayRuntimeData()},onRuntimeAssetsReady:()=>{this._runtimeAssetsReadyGeneration===this._assetsGeneration&&this._settleAssetsReady(this._assetsGeneration)},onRuntimeDataApplied:(t,i)=>this._resolveRuntimeDataDelivery(t,i),onRuntimeDataError:(t,i,r)=>this._rejectRuntimeDataDelivery(t,i,r),onRuntimeTimelineReady:(t,i)=>this._onRuntimeTimelineReady(t,i),setRuntimeFps:t=>{this._runtimeFps=t},setRuntimeOwnsPlayRange:t=>{this._runtimeOwnsPlayRange=t},shouldPromoteMediaAutoplayFallback:()=>!this._isSlideshowPlayer(),setScenes:t=>{this._scenes=t,this._emit(new CustomEvent("scenes",{detail:{scenes:t}}))},updateControlsTime:(t,i)=>this.controlsApi?.updateTime(t,i),updateControlsPlaying:t=>this.controlsApi?.updatePlaying(t),dispatchEvent:t=>this._emit(t),seek:t=>this.seek(t),play:()=>this.play(),getLoop:()=>this.loop,getPlayRange:()=>this._playRange(),media:this._media})}_onRuntimeTimelineReady(e,t){if(this._ready)return;this.probe.stop(),this._setDuration(e),this._directTimelineAdapter=null,this._ready=!0,this.controlsApi?.updateTime(this._currentTime,e),this._dispatchReady();let i=this._getSameOriginIframeDocument();i&&this._media.setupFromIframe(i),this._replayBridgeState(),this._setIframeMediaMuted(this.muted),this._waitForAssetsReady(i,t),this._playWhenWanted()}_onProbeReady(e){this._applyThenEmit(()=>this._applyProbeResult(e))}_applyProbeResult({duration:e,adapter:t,compositionSize:i}){this._setDuration(e),this._directTimelineAdapter=t.kind==="direct-timeline"?t.timeline:null,i&&this._setCompositionSize(i.width,i.height),this._ready=!0,this.controlsApi?.updateTime(0,e),this._dispatchReady();let r=this._getSameOriginIframeDocument();r&&this._media.setupFromIframe(r),this._setIframeMediaMuted(this.muted),this._waitForAssetsReady(r),this._playWhenWanted()}_waitForAssetsReady(e,t){this._clearAssetsLoadingShowTimer(),this._assetsReady=!1,this._painted=!1;let i=++this._assetsGeneration;if(!e){t===!1?(this._runtimeAssetsReadyGeneration=i,this._startAssetsLoadingOverlayTimer(i),setTimeout(()=>this._settleAssetsReady(i),yt)):this._settleAssetsReady(i);return}Ln(e,({timedOut:r})=>{i===this._assetsGeneration&&(r&&this._warnStuckAssets(e),this._settleAssetsReady(i))},{timeoutMs:yt}),this._assetsReady||this._startAssetsLoadingOverlayTimer(i)}_startAssetsLoadingOverlayTimer(e){this._assetsLoadingShowTimer=setTimeout(()=>{this._assetsLoadingShowTimer=null,!(e!==this._assetsGeneration||this._assetsReady)&&(this.setAttribute(vt,""),this.assetsLoadingUi!=="none"&&this.shaderLoader.showAssetsLoading())},zr)}_hasPendingFirstFrameAssets(e){let{pendingMedia:t,pendingImages:i,fontsLoading:r}=Le(e,{scope:B});return t.length>0||i.length>0||r}_warnStuckAssets(e){let{pendingMedia:t,pendingImages:i,fontsLoading:r}=Le(e,{scope:B}),o=e.defaultView;console.warn(`[hyperframes-player] assets-loading timed out after ${yt}ms, playing anyway`,{stuckMedia:t.map(a=>a.currentSrc||a.getAttribute("src")||`<${a.tagName.toLowerCase()}>`),stuckImages:i.map(a=>a.currentSrc||a.getAttribute("src")||"<img>"),fontsLoading:r,computeReady:o?.__renderReady===!0,documentHidden:e.hidden===!0})}_settleAssetsReady(e){e!==this._assetsGeneration||this._assetsReady||(this._clearAssetsLoadingShowTimer(),this._assetsReady=!0,this.removeAttribute(vt),this.shaderLoader.hideAssetsLoading(),this._emit(new Event("assetsready")),this.shaderLoader.whenHidden(()=>{e===this._assetsGeneration&&(this._painted=!0,this._emit(new Event("painted")))}),this._afterEvents(()=>{this._pendingPlay&&this.play()}))}_abandonComposition(e){this.probe.stop(),this._ready=!1,this._readyDocument=null,this._invalidateAssetsWait(),this._releaseDocument(),this._runtimeBridgeReady=!1,this._rejectAllRuntimeDataDeliveries(e)}_releaseDocument(){this._runtimeOwnsPlayRange=!1,this._enteringRange=!1,this._directTimelineAdapter=null,this._directTimelineClock.stop(),this._stopParentTickClock(),this.shaderLoader.reset(),this._media.resetForIframeLoad()}_invalidateAssetsWait(){this._clearAssetsLoadingShowTimer(),this._assetsReady=!1,this._painted=!1,this._assetsGeneration++,this.removeAttribute(vt),this.shaderLoader.hide()}_clearAssetsLoadingShowTimer(){this._assetsLoadingShowTimer!==null&&(clearTimeout(this._assetsLoadingShowTimer),this._assetsLoadingShowTimer=null)}_dispatchReady(){this._readyDocument=this._getSameOriginIframeDocument();let e={duration:this._duration,compositionWidth:this._compositionWidth,compositionHeight:this._compositionHeight};this._emit(new CustomEvent("ready",{detail:e})),this._rescale(),this._rangeClampReported="",this._hasPlayRange()&&this._applyPlayRange(!0)}_setDuration(e){e!==this._duration&&(this._duration=e,this._ready&&(this._emit(new CustomEvent("durationchange",{detail:{duration:e}})),this._hasPlayRange()&&this._applyPlayRange(!1)))}_setCompositionSize(e,t){let i=e!==this._compositionWidth||t!==this._compositionHeight;if(this._compositionWidth=e,this._compositionHeight=t,this._rescale(),!i)return;let r={compositionWidth:e,compositionHeight:t};this._emit(new CustomEvent("resize",{detail:r}))}_applyThenEmit(e){if(this._afterUpdate){e();return}let t=[];this._afterUpdate=t;let i=[],r=o=>{try{o()}catch(a){i.push(a)}};r(e);for(let o of t)r(o);if(this._afterUpdate=null,i.length>0)throw i[0]}_afterEvents(e){this._afterUpdate?this._afterUpdate.push(e):e()}_playWhenWanted(){this._afterEvents(()=>{(this.hasAttribute("autoplay")||this._pendingPlay)&&this.play()})}_emit(e){this._afterEvents(()=>this.dispatchEvent(e))}_rescale(){let e=Tn(this,this.iframe,this._compositionWidth,this._compositionHeight);e&&this._sendDisplayScale(),!e&&this._ready&&!this._rescaleWarned&&(this._rescaleWarned=!0,console.warn("[hyperframes-player] rescale no-op after ready: zero-size player element",{src:this.getAttribute("src"),offsetWidth:this.offsetWidth,offsetHeight:this.offsetHeight,compositionWidth:this._compositionWidth,compositionHeight:this._compositionHeight}))}_onIframeLoad(){if(!this._connected||this._videoSource)return;let e=this._getSameOriginIframeDocument();if(this._ready&&e===this._readyDocument){e&&this._hasPendingFirstFrameAssets(e)&&this._waitForAssetsReady(e);return}this._ready=!1,this._invalidateAssetsWait(),this._releaseDocument(),this.probe.start()}_setupControls(){this.controlsApi||(this.controlsApi=vn(this.shadow,this.muted,this._volume,this.getAttribute("speed-presets"),{onPlay:()=>this.play(),onPause:()=>this.pause(),onSeek:e=>this.seek(e*this._duration),onScrubStart:()=>{this._scrubbing=!0},onScrubEnd:()=>{this._scrubbing=!1,this.seek(this._currentTime)},onSpeedChange:e=>{this.playbackRate=e},onMuteToggle:()=>{this.muted=!this.muted},onVolumeChange:e=>{this.volume=e}},this._isAudioLocked()))}get _audioOwner(){return this._media.audioOwner}get _parentMedia(){return this._media.entries}_mirrorParentMediaTime(e,t){this._media.mirrorTime(e,t)}_promoteToParentProxy(){let e=null;try{e=this.iframe.contentDocument}catch{}this._media.promoteToParentProxy(e,(t,i)=>this._mirrorParentMediaTime(t,i)),this._sendControl("set-media-output-muted",{muted:!0})}_observeDynamicMedia(e){this._media.setupFromIframe(e)}};customElements.get("hyperframes-player")||customElements.define("hyperframes-player",He);return ni(jr);})();
|
|
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
resolveProject
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ATF6UESJ.js";
|
|
10
10
|
import {
|
|
11
11
|
formatBytes,
|
|
12
12
|
label
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
ensureDOMParser
|
|
16
16
|
} from "./chunk-442JNXRM.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-V652CBKA.js";
|
|
18
|
+
import "./chunk-B4VG7PGX.js";
|
|
19
19
|
import "./chunk-VWG7OQKU.js";
|
|
20
20
|
import "./chunk-QWQ6GQTI.js";
|
|
21
21
|
import {
|
|
@@ -28,17 +28,17 @@ import {
|
|
|
28
28
|
} from "./chunk-ZTZA4UWZ.js";
|
|
29
29
|
import {
|
|
30
30
|
withMeta
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-ZIL7S3L6.js";
|
|
32
32
|
import "./chunk-K4WIOZFP.js";
|
|
33
33
|
import "./chunk-XUXGIA7H.js";
|
|
34
34
|
import "./chunk-WERLJGIC.js";
|
|
35
35
|
import "./chunk-ISN5GRYI.js";
|
|
36
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-HTDDV7CM.js";
|
|
37
37
|
import "./chunk-XT6MXC7A.js";
|
|
38
38
|
import "./chunk-JYVGYKXG.js";
|
|
39
39
|
import "./chunk-7KDQAD2W.js";
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-
|
|
40
|
+
import "./chunk-MMSCLNCJ.js";
|
|
41
|
+
import "./chunk-LGAKMIEX.js";
|
|
42
42
|
import "./chunk-VC76R6W2.js";
|
|
43
43
|
import "./chunk-UJKQWGFF.js";
|
|
44
44
|
import {
|