hyperframes 0.8.89 → 0.8.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/{add-JDX7VHMM.js → add-LM5QLN3C.js} +15 -15
  2. package/dist/{animatedGifPrep-JV7YPNCR.js → animatedGifPrep-K4JXNDVB.js} +5 -5
  3. package/dist/{asset-ZQU3ZAHZ.js → asset-N2ZCF3TF.js} +2 -2
  4. package/dist/{assetCataloger-MYUR6H4S.js → assetCataloger-CDEJC5QV.js} +2 -2
  5. package/dist/{auth-ZI5X6SXG.js → auth-M6RIGSOA.js} +2 -2
  6. package/dist/{autoUpdate-BDREI4XN.js → autoUpdate-HPWJQCEJ.js} +2 -2
  7. package/dist/{backgroundChecks-52MY7SIC.js → backgroundChecks-7FNAVAWS.js} +3 -3
  8. package/dist/backgroundChecksWorker.js +3 -3
  9. package/dist/{batchRender-MIBYP2SP.js → batchRender-OWCX3WI4.js} +3 -3
  10. package/dist/{beats-77Z6UPMB.js → beats-TBRZUL5C.js} +9 -9
  11. package/dist/{benchmark-HR242B6Q.js → benchmark-4RGMJGVD.js} +11 -11
  12. package/dist/{browser-CLQNZB5J.js → browser-4MZ5CLY7.js} +8 -8
  13. package/dist/{bundleWithLocalizedFonts-CCWJW35L.js → bundleWithLocalizedFonts-6FJV5ME2.js} +2 -2
  14. package/dist/{capture-CFMXNRM6.js → capture-QM2JRH7T.js} +6 -6
  15. package/dist/{capture-MWX7ONGJ.js → capture-ZMZFCHW4.js} +2 -2
  16. package/dist/{catalog-OAJVYTXP.js → catalog-LWYAH2MC.js} +15 -15
  17. package/dist/{check-AJB25CBI.js → check-5CTGRHDC.js} +29 -29
  18. package/dist/{checkBrowser-RTZFBO62.js → checkBrowser-LPKPYD4J.js} +28 -28
  19. package/dist/chunk-275NJDC5.js +3528 -0
  20. package/dist/{chunk-SGJSK536.js → chunk-2QTVED47.js} +1 -1
  21. package/dist/{chunk-JVYVKXTA.js → chunk-325EA5ST.js} +2 -2
  22. package/dist/{chunk-VBXD76KN.js → chunk-4MQQI2II.js} +1 -1
  23. package/dist/{chunk-UXTEARGO.js → chunk-6TNEX275.js} +1 -1
  24. package/dist/{chunk-I7MD2PC7.js → chunk-AUGLU6WA.js} +2 -2
  25. package/dist/{chunk-AUON4YVS.js → chunk-AWMMV65H.js} +2 -2
  26. package/dist/{chunk-XLJXHNXC.js → chunk-BP3M6JPK.js} +1 -1
  27. package/dist/{chunk-RLKPZQKI.js → chunk-BYZZCZ2K.js} +4 -4
  28. package/dist/{chunk-2YPJQAU5.js → chunk-CALFK3EB.js} +1 -1
  29. package/dist/{chunk-SAYNFMCN.js → chunk-CC5HTRDE.js} +1 -1
  30. package/dist/{chunk-J4ZDN5N7.js → chunk-CPDR5AI7.js} +5 -5
  31. package/dist/{chunk-MEIIOQNR.js → chunk-CWAZA6DG.js} +1 -1
  32. package/dist/{chunk-Z4LBLZ3I.js → chunk-CXPRQS6R.js} +2 -2
  33. package/dist/{chunk-HMQ27CEJ.js → chunk-DHD3AEXF.js} +2 -2
  34. package/dist/{chunk-S2F6QM6J.js → chunk-DJD2XA6I.js} +3 -3
  35. package/dist/{chunk-ROFOQAPQ.js → chunk-E2FAYCAL.js} +8 -8
  36. package/dist/{chunk-MGUSGIWE.js → chunk-FFPYON3V.js} +1 -1
  37. package/dist/{chunk-WLIQG73N.js → chunk-G5CORT4V.js} +1 -1
  38. package/dist/{chunk-BEZ5LKUM.js → chunk-HEMH55SZ.js} +8 -8
  39. package/dist/{chunk-PWAWHXTQ.js → chunk-HSGHPWA2.js} +3 -3
  40. package/dist/{chunk-XMDQQAIB.js → chunk-J5LICYQR.js} +1 -1
  41. package/dist/{chunk-LTCGOUKZ.js → chunk-LXRB4VUU.js} +8 -8
  42. package/dist/{chunk-NL6WSNWA.js → chunk-MFXTKG6F.js} +4 -4
  43. package/dist/{chunk-CZXT2DRB.js → chunk-MISDKW56.js} +2 -2
  44. package/dist/{chunk-TQNLHVZB.js → chunk-NAAXO3N5.js} +2 -2
  45. package/dist/{chunk-FWDM3N34.js → chunk-P67KXZGX.js} +4 -4
  46. package/dist/{chunk-AP2WIRY6.js → chunk-PRPE3JNB.js} +1 -1
  47. package/dist/{chunk-WCQOPUJ4.js → chunk-RGHVO2UZ.js} +23 -10
  48. package/dist/{chunk-ELQAAO4F.js → chunk-RZYPG4LH.js} +1 -1
  49. package/dist/{chunk-ANWEGAE6.js → chunk-S6YCUTNM.js} +2 -2
  50. package/dist/{chunk-VQX6DC4V.js → chunk-SNHAPE52.js} +1 -1
  51. package/dist/{chunk-M3K5IF5G.js → chunk-SSMNR7NU.js} +2 -2
  52. package/dist/{chunk-BNHS2BR4.js → chunk-SUYIGLDN.js} +1 -1
  53. package/dist/{chunk-C22UJWNH.js → chunk-SZ2NP7UV.js} +1 -1
  54. package/dist/{chunk-LP4D3V7E.js → chunk-TJB5VU5L.js} +7 -7
  55. package/dist/{chunk-PKK6QWAQ.js → chunk-UMBXSPYI.js} +1 -1
  56. package/dist/{chunk-6BPWGLCF.js → chunk-UNZOL3UD.js} +3 -3
  57. package/dist/{chunk-WJ4NAOYT.js → chunk-V5Z3QGG2.js} +1 -1
  58. package/dist/{chunk-MIYTJ6RX.js → chunk-VDLFGW4J.js} +18 -10
  59. package/dist/{chunk-EAJNP7C7.js → chunk-WA7RZY3S.js} +3 -3
  60. package/dist/{chunk-W7KUW4QD.js → chunk-Z6Z7KGEU.js} +1 -1
  61. package/dist/{clean-YNSDX62K.js → clean-Z3SYXU27.js} +13 -13
  62. package/dist/cli.js +50 -50
  63. package/dist/{cloud-O6C6D2CC.js → cloud-DN2FSGEN.js} +4 -4
  64. package/dist/{cloudrun-ZUZ35J2A.js → cloudrun-XRZZV4QW.js} +3 -3
  65. package/dist/{compare-32ZYX7EU.js → compare-SXN42PJF.js} +23 -23
  66. package/dist/{compiler-XICNIB6E.js → compiler-JKWKLSX6.js} +2 -2
  67. package/dist/{component-OX6ODG5G.js → component-WK3MMT5D.js} +3 -3
  68. package/dist/{compositions-IAWH2EMO.js → compositions-XRJ2DDV3.js} +10 -10
  69. package/dist/{delete-4AGDWC2T.js → delete-AM732KQJ.js} +2 -2
  70. package/dist/{dist-V6OCFIID.js → dist-GFYJLCSU.js} +2 -2
  71. package/dist/{doctor-AH7IX5Z6.js → doctor-YQDGYTQM.js} +9 -9
  72. package/dist/{events-6M6FDQZZ.js → events-APLXVZ3I.js} +8 -8
  73. package/dist/{events-CJRCDPWV.js → events-HKIWOY7W.js} +7 -7
  74. package/dist/{feedback-C6DJ6XKA.js → feedback-JNJURFQW.js} +9 -9
  75. package/dist/{figma-L5RHNGY7.js → figma-WLQBX4IF.js} +3 -3
  76. package/dist/fontLocalizeCli.js +7 -7
  77. package/dist/{get-TBBCYF5B.js → get-EZ5QWZNN.js} +2 -2
  78. package/dist/{gpuPolicy-Z3VMNZAH.js → gpuPolicy-HQG5D4W4.js} +5 -5
  79. package/dist/{grade-compare-FNPPD6UE.js → grade-compare-CNJBF5FD.js} +23 -23
  80. package/dist/{help-L4V4PV7C.js → help-GOIEXCCA.js} +1 -1
  81. package/dist/{history-EEWE52BC.js → history-XRSETYAE.js} +13 -13
  82. package/dist/hyperframe-runtime.js +55 -55
  83. package/dist/hyperframe.manifest.json +1 -1
  84. package/dist/hyperframe.runtime.iife.js +55 -55
  85. package/dist/hyperframes-player.global.js +3 -3
  86. package/dist/{info-VQYR7VW6.js → info-3XSV2EFP.js} +10 -10
  87. package/dist/{init-L5BK5HGZ.js → init-B6524UHY.js} +20 -20
  88. package/dist/{inspect-4DSMPUHN.js → inspect-CQX6K5ET.js} +24 -24
  89. package/dist/{installer-IZI7H77F.js → installer-QU2LANZ7.js} +5 -5
  90. package/dist/{keyframes-AXHMLOSU.js → keyframes-HRCYZ6R2.js} +11 -11
  91. package/dist/{lambda-QOMWH34Y.js → lambda-RIEGJXBT.js} +4 -4
  92. package/dist/{layout-ZV23GQU6.js → layout-7ZNC3OWA.js} +24 -24
  93. package/dist/{lint-HZIRYUSA.js → lint-IAKBWR3G.js} +11 -11
  94. package/dist/{list-DLBDHWZ2.js → list-NSVU5YDL.js} +2 -2
  95. package/dist/{login-3PLQRQEP.js → login-Q76SF3KL.js} +4 -4
  96. package/dist/{media-treatment-7TZ7L7NU.js → media-treatment-F5GZ4KOP.js} +11 -11
  97. package/dist/{models-QMYYYGH4.js → models-4SDFED6C.js} +6 -6
  98. package/dist/{motionShot-J2Q4CGMA.js → motionShot-SY4RU6U5.js} +9 -9
  99. package/dist/{normalize-audio-SX64JNLW.js → normalize-audio-7HUEZIUZ.js} +9 -9
  100. package/dist/{pipeline-437AL3MK.js → pipeline-2HIV4Y7G.js} +5 -5
  101. package/dist/{play-VX2LSHXR.js → play-4YRL4KOS.js} +19 -19
  102. package/dist/{preflight-AUMMYJTT.js → preflight-IY4NAUE4.js} +6 -6
  103. package/dist/{present-F2DPEKZU.js → present-6MFRVEM6.js} +14 -14
  104. package/dist/{preview-ARITZNNL.js → preview-AHQURXOT.js} +17 -17
  105. package/dist/{producer-O7IG6IS4.js → producer-QCLJ24EY.js} +1 -1
  106. package/dist/{projectConfig-6RZN57VN.js → projectConfig-EJV3KBCO.js} +7 -7
  107. package/dist/{publication-Z64ENECQ.js → publication-4MXCWAAF.js} +3 -3
  108. package/dist/{publish-6LR5HSDV.js → publish-Y5XULKT3.js} +8 -8
  109. package/dist/{remove-background-SOPXL32V.js → remove-background-MZLVZJDP.js} +6 -6
  110. package/dist/{render-2VWTXUCT.js → render-3SPC22N3.js} +21 -21
  111. package/dist/{render-FT4NTFKZ.js → render-FMD7UKEI.js} +11 -11
  112. package/dist/{render-ZVTBJQGB.js → render-I6BBYGK4.js} +3 -3
  113. package/dist/{render-batch-SWB7ZEVV.js → render-batch-YOLPHNBE.js} +3 -3
  114. package/dist/{renderCancellation-34NDBFXL.js → renderCancellation-OKZ2OSKI.js} +5 -5
  115. package/dist/{resolver-XCOW3Q47.js → resolver-4MDVOI4J.js} +5 -5
  116. package/dist/{sherpa-ZRV5HYUT.js → sherpa-XU2H4MTL.js} +6 -6
  117. package/dist/{skills-KDD7E5CB.js → skills-XOUE2DXY.js} +10 -10
  118. package/dist/{skillsUpdateCheck-DXGEK4AH.js → skillsUpdateCheck-J43BUUXQ.js} +3 -3
  119. package/dist/{snapshot-BSOD5KKR.js → snapshot-EMF7KGSM.js} +24 -24
  120. package/dist/{src-ZL5S6ZOV.js → src-5V3MJNPC.js} +4 -4
  121. package/dist/{src-WPCXIBAP.js → src-SPJS4DVA.js} +6 -6
  122. package/dist/{staticProjectServer-VPVGLNV2.js → staticProjectServer-LKMDZ2DQ.js} +13 -13
  123. package/dist/{status-YW2IXW7Y.js → status-BIF2WXFE.js} +5 -5
  124. package/dist/studio/assets/{hyperframes-player-CVoS7kv8.js → hyperframes-player-zT2Bdx_l.js} +1 -1
  125. package/dist/studio/assets/{index-D35-L_yn.js → index-DSOLcE8X.js} +1 -1
  126. package/dist/studio/assets/{index-DBub9qQY.js → index-DV-z19zB.js} +1 -1
  127. package/dist/studio/assets/{index-BM8PwYby.js → index-V-0rfhe6.js} +168 -168
  128. package/dist/studio/{chunk-KU4F7QZ3.js → chunk-QPSOTK6M.js} +8 -1
  129. package/dist/studio/chunk-QPSOTK6M.js.map +1 -0
  130. package/dist/studio/index.d.ts +12 -3
  131. package/dist/studio/index.html +1 -1
  132. package/dist/studio/index.js +1349 -1066
  133. package/dist/studio/index.js.map +1 -1
  134. package/dist/studio/player.js +1 -1
  135. package/dist/{studio-api-6YLFY6OJ.js → studio-api-UT3W5AA6.js} +6 -6
  136. package/dist/{studioServer-2IK5LLRR.js → studioServer-Y3RJUIQM.js} +39 -36
  137. package/dist/{system-L4N5VQRB.js → system-5ALLLQFH.js} +5 -5
  138. package/dist/{telemetry-6P5WHWYI.js → telemetry-LTGWUJJT.js} +8 -8
  139. package/dist/{timeline-QZ4Q2LED.js → timeline-AA3LL6DL.js} +13 -13
  140. package/dist/{tokens-VXZYKHFV.js → tokens-ROIWLZRY.js} +2 -2
  141. package/dist/{transcribe-4SDPHYKI.js → transcribe-MWG54RBB.js} +6 -6
  142. package/dist/{transcribe-RQ6RHU2V.js → transcribe-TMWKDHAI.js} +11 -11
  143. package/dist/{updateCheck-RRWEIZY7.js → updateCheck-HF7VV7W4.js} +2 -2
  144. package/dist/{upgrade-LI5TVSQQ.js → upgrade-3OAEBAEA.js} +2 -2
  145. package/dist/{urlDownloader-AQDUJKGE.js → urlDownloader-YNKW5OUO.js} +4 -4
  146. package/dist/{validate-I56RAOC6.js → validate-ULWT5J56.js} +14 -14
  147. package/dist/{video-PWBBDS2L.js → video-2IYAAHHK.js} +5 -5
  148. package/package.json +1 -1
  149. package/dist/chunk-247O73KD.js +0 -3528
  150. package/dist/studio/chunk-KU4F7QZ3.js.map +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";var HyperframesPlayer=(()=>{var Me=Object.defineProperty;var In=Object.getOwnPropertyDescriptor;var Cn=Object.getOwnPropertyNames;var Dn=Object.prototype.hasOwnProperty;var Nn=(n,e)=>{for(var t in e)Me(n,t,{get:e[t],enumerable:!0})},Pn=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Cn(e))!Dn.call(n,r)&&r!==t&&Me(n,r,{get:()=>e[r],enumerable:!(i=In(e,r))||i.enumerable});return n};var Ln=n=>Pn(Me({},"__esModule",{value:!0}),n);var _r={};Nn(_r,{HyperframesPlayer:()=>ke,SPEED_PRESETS:()=>De,formatSpeed:()=>H,formatTime:()=>ue});function gt(n){return n.hasRuntime||n.runtimeInjected?!1:!!(n.hasNestedCompositions||n.hasTimelines&&n.attempts>=5)}function V(n){return typeof n=="object"&&n!==null}function _t(n){return V(n)&&typeof n.getDuration=="function"}function yt(n){return V(n)&&typeof n.duration=="function"&&typeof n.time=="function"&&typeof n.seek=="function"&&typeof n.play=="function"&&typeof n.pause=="function"}var P="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.8.89/dist/hyperframe.runtime.iife.js";function U(n){if(n===null)return null;let e=Number.parseInt(n,10);return Number.isFinite(e)&&e>0?e:null}function On(n){let e=n?.querySelector("[data-composition-id][data-width][data-height]")??n?.querySelector("[data-width][data-height]");if(!e)return null;let t=U(e.getAttribute("data-width")),i=U(e.getAttribute("data-height"));return t!==null&&i!==null?{width:t,height:i}:null}var se=class{constructor(e,t){this._iframe=e;this._callbacks=t}_iframe;_callbacks;_interval=null;_runtimeInjected=!1;get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let e=0;this._interval=setInterval(()=>{e++;try{let t=this._iframe.contentWindow;if(!t)return;let i=!!(t.__hf||t.__player),r=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!this._iframe.contentDocument?.querySelector("[data-composition-src]");if(gt({hasRuntime:i,hasTimelines:r,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:e})){this._injectRuntime();return}if(this._runtimeInjected&&!i)return;let a=this._resolvePlaybackDurationAdapter(t);if(a&&a.getDuration()>0){this.stop();let s=On(this._iframe.contentDocument);this._callbacks.onReady({duration:a.getDuration(),adapter:a,compositionSize:s});return}}catch{}e>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){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 Reflect.get(e,"__hf")!==void 0||V(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=P,(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(!V(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 yt(a)?a:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(_t(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let i=this._resolveDirectTimelineAdapterFromWindow(e);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}};var vt=`
1
+ "use strict";var HyperframesPlayer=(()=>{var Me=Object.defineProperty;var Nn=Object.getOwnPropertyDescriptor;var Pn=Object.getOwnPropertyNames;var Ln=Object.prototype.hasOwnProperty;var On=(n,e)=>{for(var t in e)Me(n,t,{get:e[t],enumerable:!0})},Fn=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Pn(e))!Ln.call(n,r)&&r!==t&&Me(n,r,{get:()=>e[r],enumerable:!(i=Nn(e,r))||i.enumerable});return n};var Vn=n=>Fn(Me({},"__esModule",{value:!0}),n);var vr={};On(vr,{HyperframesPlayer:()=>ke,SPEED_PRESETS:()=>De,formatSpeed:()=>G,formatTime:()=>ue});function gt(n){return n.hasRuntime||n.runtimeInjected?!1:!!(n.hasNestedCompositions||n.hasTimelines&&n.attempts>=5)}function U(n){return typeof n=="object"&&n!==null}function _t(n){return U(n)&&typeof n.getDuration=="function"}function yt(n){return U(n)&&typeof n.duration=="function"&&typeof n.time=="function"&&typeof n.seek=="function"&&typeof n.play=="function"&&typeof n.pause=="function"}var L="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.8.91/dist/hyperframe.runtime.iife.js";function H(n){if(n===null)return null;let e=Number.parseInt(n,10);return Number.isFinite(e)&&e>0?e:null}function Un(n){let e=n?.querySelector("[data-composition-id][data-width][data-height]")??n?.querySelector("[data-width][data-height]");if(!e)return null;let t=H(e.getAttribute("data-width")),i=H(e.getAttribute("data-height"));return t!==null&&i!==null?{width:t,height:i}:null}var se=class{constructor(e,t){this._iframe=e;this._callbacks=t}_iframe;_callbacks;_interval=null;_runtimeInjected=!1;get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let e=0;this._interval=setInterval(()=>{e++;try{let t=this._iframe.contentWindow;if(!t)return;let i=!!(t.__hf||t.__player),r=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!this._iframe.contentDocument?.querySelector("[data-composition-src]");if(gt({hasRuntime:i,hasTimelines:r,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:e})){this._injectRuntime();return}if(this._runtimeInjected&&!i)return;let a=this._resolvePlaybackDurationAdapter(t);if(a&&a.getDuration()>0){this.stop();let s=Un(this._iframe.contentDocument);this._callbacks.onReady({duration:a.getDuration(),adapter:a,compositionSize:s});return}}catch{}e>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){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 Reflect.get(e,"__hf")!==void 0||U(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=L,(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(!U(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 yt(a)?a:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(_t(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let i=this._resolveDirectTimelineAdapterFromWindow(e);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}};var vt=`
2
2
  :host {
3
3
  display: block;
4
4
  position: relative;
@@ -469,6 +469,6 @@
469
469
  background: var(--hfp-accent, #fff);
470
470
  pointer-events: none;
471
471
  }
472
- `,At='<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>',St='<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>',Ie='<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>',Ce='<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>',Et='<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 De=[.25,.5,1,1.5,2,4];function H(n){return Number.isInteger(n)?`${n}x`:`${n}x`}function ue(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 Tt(n,e,t={}){let i=t.speedPresets??De,r=document.createElement("div");r.className="hfp-controls",r.addEventListener("click",m=>{m.stopPropagation()});let o=document.createElement("button");o.className="hfp-play-btn",o.type="button",o.innerHTML=`<span class="hfp-ico hfp-ico-play">${At}</span><span class="hfp-ico hfp-ico-pause">${St}</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 l=document.createElement("button");l.className="hfp-speed-btn",l.type="button",l.textContent="1x",l.setAttribute("aria-label","Playback speed");let g=document.createElement("div");g.className="hfp-speed-menu",g.setAttribute("role","menu");for(let m of i){let p=document.createElement("button");p.className="hfp-speed-option",p.type="button",p.setAttribute("role","menuitem"),p.dataset.speed=String(m),p.textContent=H(m),m===1&&p.classList.add("hfp-active"),g.appendChild(p)}d.appendChild(g),d.appendChild(l);let c=document.createElement("div");c.className="hfp-volume-wrap";let f=document.createElement("button");f.className="hfp-mute-btn",f.type="button",f.innerHTML=Ie,f.setAttribute("aria-label","Mute");let h=document.createElement("div");h.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 y=document.createElement("div");y.className="hfp-volume-fill",y.style.width="100%",b.appendChild(y),h.appendChild(b),c.appendChild(h),c.appendChild(f),t.audioLocked&&(c.style.display="none"),r.appendChild(o),r.appendChild(a),r.appendChild(u),r.appendChild(c),r.appendChild(d),n.appendChild(r);let v=!1,A=!1,w=1,S=null,x=i.indexOf(1);x===-1&&(x=0);let ie=(m,p)=>m?Et:p===0?Ce:p<.5?Ce:Ie;o.addEventListener("click",m=>{m.stopPropagation(),v?e.onPause():e.onPlay()}),f.addEventListener("click",m=>{m.stopPropagation(),e.onMuteToggle()});let N=!1,re=m=>{let p=b.getBoundingClientRect(),E=Math.max(0,Math.min(1,(m-p.left)/p.width));w=E,y.style.width=`${E*100}%`,b.setAttribute("aria-valuenow",String(Math.round(E*100))),A&&E>0&&e.onMuteToggle(),f.innerHTML=ie(A,E),e.onVolumeChange(E)};b.addEventListener("mousedown",m=>{m.stopPropagation(),N=!0,re(m.clientX)});let it=m=>{N&&re(m.clientX)},rt=()=>{N=!1};document.addEventListener("mousemove",it),document.addEventListener("mouseup",rt),b.addEventListener("touchstart",m=>{N=!0;let p=m.touches[0];p&&re(p.clientX)},{passive:!0});let ot=m=>{if(N){let p=m.touches[0];p&&re(p.clientX)}},at=()=>{N=!1};document.addEventListener("touchmove",ot,{passive:!0}),document.addEventListener("touchend",at);let st=.05;b.addEventListener("keydown",m=>{let p=w;if(m.key==="ArrowRight"||m.key==="ArrowUp")p=Math.min(1,w+st);else if(m.key==="ArrowLeft"||m.key==="ArrowDown")p=Math.max(0,w-st);else return;m.preventDefault(),m.stopPropagation(),w=p,y.style.width=`${p*100}%`,b.setAttribute("aria-valuenow",String(Math.round(p*100))),A&&p>0&&e.onMuteToggle(),f.innerHTML=ie(A,p),e.onVolumeChange(p)});let ut=m=>{for(let p of g.querySelectorAll(".hfp-speed-option"))p.classList.toggle("hfp-active",p.dataset.speed===String(m))};l.addEventListener("click",m=>{m.stopPropagation();let p=g.classList.toggle("hfp-open");l.setAttribute("aria-expanded",String(p))}),g.addEventListener("click",m=>{m.stopPropagation();let p=m.target.closest(".hfp-speed-option");if(!p)return;let E=parseFloat(p.dataset.speed);x=i.indexOf(E),l.textContent=H(E),ut(E),g.classList.remove("hfp-open"),l.setAttribute("aria-expanded","false"),e.onSpeedChange(E)});let lt=()=>{g.classList.remove("hfp-open"),l.setAttribute("aria-expanded","false")};document.addEventListener("click",lt);let oe=m=>{let p=a.getBoundingClientRect(),E=Math.max(0,Math.min(1,(m-p.left)/p.width));e.onSeek(E)},I=!1;a.addEventListener("mousedown",m=>{m.stopPropagation(),I=!0,e.onScrubStart?.(),oe(m.clientX)});let dt=m=>{I&&oe(m.clientX)},ct=()=>{I&&(I=!1,e.onScrubEnd?.())};document.addEventListener("mousemove",dt),document.addEventListener("mouseup",ct),a.addEventListener("touchstart",m=>{I=!0,e.onScrubStart?.();let p=m.touches[0];p&&oe(p.clientX)},{passive:!0});let mt=m=>{if(I){let p=m.touches[0];p&&oe(p.clientX)}},pt=()=>{I&&(I=!1,e.onScrubEnd?.())};document.addEventListener("touchmove",mt,{passive:!0}),document.addEventListener("touchend",pt);let ft=()=>{S&&clearTimeout(S),S=setTimeout(()=>{v&&r.classList.add("hfp-hidden")},3e3)},ae=n instanceof ShadowRoot?n.host:n,ht=()=>{r.classList.remove("hfp-hidden"),ft()},bt=()=>{v&&r.classList.add("hfp-hidden")};return ae.addEventListener("mousemove",ht),ae.addEventListener("mouseleave",bt),{updateTime(m,p){let E=p>0?Math.min(m,p):m,Mn=p>0?E/p*100:0;s.style.width=`${Mn}%`,u.textContent=`${ue(E)} / ${ue(p)}`},updatePlaying(m){v=m,o.classList.toggle("hfp-playing",m),o.setAttribute("aria-label",m?"Pause":"Play"),m?ft():r.classList.remove("hfp-hidden")},updateSpeed(m){let p=i.indexOf(m);p!==-1&&(x=p),l.textContent=H(m),ut(m)},updateMuted(m){A=m,f.innerHTML=ie(m,w),f.setAttribute("aria-label",m?"Unmute":"Mute")},updateVolume(m){w=m,y.style.width=`${m*100}%`,b.setAttribute("aria-valuenow",String(Math.round(m*100))),f.innerHTML=ie(A,m)},setVolumeControlsHidden(m){c.style.display=m?"none":""},show(){r.style.display=""},hide(){r.style.display="none"},destroy(){document.removeEventListener("mousemove",dt),document.removeEventListener("mouseup",ct),document.removeEventListener("touchmove",mt),document.removeEventListener("touchend",pt),document.removeEventListener("mousemove",it),document.removeEventListener("mouseup",rt),document.removeEventListener("touchmove",ot),document.removeEventListener("touchend",at),document.removeEventListener("click",lt),ae.removeEventListener("mousemove",ht),ae.removeEventListener("mouseleave",bt),S&&clearTimeout(S),r.remove()}}}function Rt(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=Tt(n,r,s);return u.updateMuted(e),u.updateVolume(t),u}function Ne(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 wt(n){return n.composedPath().some(e=>e instanceof HTMLElement&&e.classList.contains("hfp-controls"))}var le=null;function xt(n,e){if(typeof CSSStyleSheet<"u")try{le||(le=new CSSStyleSheet,le.replaceSync(e)),n.adoptedStyleSheets=[le];return}catch{}let t=document.createElement("style");t.textContent=e,n.appendChild(t)}function kt(){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 Mt(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 Fn(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 de=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 l;try{l=e.time()}catch{this._raf=null;return}let g=i(),c=o();c.end>0&&(l=Math.min(l,c.end));let f=a===null?0:l-a;f!==0&&(u=Math.min(f,s),s=f),a=l;let h=Fn(l,u,c);h&&(l=c.shown);let b=performance.now();if((b-this._lastUpdateMs>100||h)&&(this._lastUpdateMs=b,this._callbacks.onTimeUpdate(l,g)),h){if(this._callbacks.getLoop()){this._callbacks.restart();return}try{e.pause(),c.shown<c.end&&e.seek(c.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 It(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)Un(i)||t.push(i);return Vn(n),t}function Vn(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 Un(n){let e=n.parentElement;for(;e;){if(e.hasAttribute("data-composition-id"))return!0;e=e.parentElement}return!1}function Ct(){return globalThis}function W(n,e){if(typeof window>"u")return;let t=Ct(),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 Dt="data-hf-authored-duration",Nt="data-hf-authored-end";function G(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 ce(n){let e=G(n.start);if(e==null)return null;let t=Math.max(0,e),i=G(n.duration),r=G(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=G(n.end),s=G(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 L=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),Hr=Object.freeze([L.start,L.duration,L.trackIndex]),Wr=Object.freeze([L.derivedEnd]),Gr=Object.freeze([L.derivedEnd,L.legacyTrack]);function Pe(n){if(n==null||n.trim()==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}var Pt=n=>{let e=Pe(n);return e!==null&&e>=0?e:null};function Lt(n){return Pt(n("data-playback-start"))??Pt(n("data-media-start"))??0}var B=.1,$=10;function Le(n){return Number.isFinite(n)&&n>0?Math.max(B,Math.min($,n)):1}function Ot(n,e=1){let t=Number.parseFloat(n("data-playback-rate")??"");return Le(Number.isFinite(t)&&t>0?t:e)}function Ft(n){let e=Pe(n("data-duration"));return e!==null&&e>0?e:null}function Vt(n,e){let t=Ft(n);if(t!==null)return t;let i=Pe(n("data-end"));return i!==null?i-e:null}var Hn=3;function Oe(n,e,t){return Number.isFinite(n)?Math.max(0,n-e)/Le(t):null}function Ut(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:Hn,source:"default"};if(i===null)return{seconds:null,source:"pending",reason:"source duration not yet probed"};let a=Oe(i,r,o);return a===null?{seconds:null,source:"pending",reason:"source reported a non-finite duration"}:{seconds:a,source:"media"}}var Wt="data-fx-chain",$r=Wt.slice(5);var z=(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}),Fe=(n=.707,e="Bandwidth \u2014 higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:n,scale:"log",automatable:!0,hint:e}),me=(n=-40,e=40,t=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:n,max:e,step:.1,default:t,automatable:!0}),Ht={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."},Gt=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[me(-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:[z("frequency","Frequency",1e3),me(-40,40,0),Fe(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[z("frequency","Frequency",200,20,2e3),me(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[z("frequency","Frequency",4e3,500,2e4),me(-40,40,0)],web:"biquad-highshelf"},{id:"highpass",label:"High-pass",group:"filter",description:"Remove low frequencies \u2014 the usual fix for rumble on a voice.",params:[z("frequency","Cutoff",300,20,2e4),Fe(.707),Ht],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies \u2014 darkens or muffles a track.",params:[z("frequency","Cutoff",8e3,100,2e4),Fe(.707),Ht],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:"Hard ceiling \u2014 nothing gets past the 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:"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 \u2014 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"}],zr=new Map(Gt.map(n=>[n.id,n]));var jr=Gt.map(n=>n.id);function Wn(n){return 10**(n/20)}var Bt=Wn(12);var Ue="data-automation",to=Ue.slice(5),Ve=1,Gn=512,k=class extends Error{constructor(e){super(e),this.name="AudioAutomationError"}},pe="volume",fe="rate";function $t(n){if(n===pe)return{kind:"volume"};if(n===fe)return{kind:"rate"};let e=n.split(".");if(e.length===3&&e[0]==="fx"&&e[1]===Bn){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 Bn="preset";var $n={min:0,max:Bt,step:.01,unit:"",label:"Volume",scale:"linear",default:1},zn={min:B,max:$,step:.05,unit:"x",label:"Speed",scale:"log",default:1};function j(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 jn(n){let e=j(n);return e===null||e===0?0:Math.min(1,Math.max(-1,e))}function zt(n,e){let t=j(n),i=j(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 qn(n){let e=jn(n?.curve),t=zt(n?.viaX,n?.viaY);return{...e?{curve:e}:{},...t?{viaX:t.x,viaY:t.y}:{}}}function Yn(n,e){let t=j(n?.t),i=j(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,...qn(n)}}function Xn(n,e){let t=n.map(r=>Yn(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,Gn)}function Kn(n){let e=[];for(let t of n.lanes){if(!$t(t.target))continue;let i=t.target===pe?$n:t.target===fe?zn:null,r=Xn(t.points??[],i);r.length>0&&e.push({target:t.target,points:r})}return{version:Ve,lanes:e}}function jt(n){let e;try{e=JSON.parse(n)}catch(r){throw new k(`Automation is not valid JSON: ${r.message}`)}if(typeof e!="object"||e===null)throw new k("Automation must be a JSON object.");let t=e;if(t.version!==Ve)throw new k(`Unsupported automation version: ${String(t.version)}`);if(!Array.isArray(t.lanes))throw new k("Automation is missing a `lanes` array.");let i=t.lanes.map((r,o)=>{if(typeof r!="object"||r===null)throw new k(`Lane ${o} is not an object.`);let a=r;if(typeof a.target!="string"||!$t(a.target))throw new k(`Lane ${o} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new k(`Lane ${o} is missing a \`points\` array.`);return{target:a.target,points:a.points}});return Kn({version:Ve,lanes:i})}function Jn(n,e){return e?Math.pow(n,Math.pow(2,2*e)):n}function Zn(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 Qn(n,e,t){let{cx:i,cy:r,w:o}=Zn(e,t),a=2-2*o,s=n*a-1+2*o*i,u=-n*a-2*o*i,d=ei(s,u,n),l=1-d,g=l*l+2*o*d*l+d*d;return g>0?(2*o*r*d*l+d*d)/g:n}function ei(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 ti(n,e){let t=zt(e.viaX,e.viaY);return t?Qn(Math.min(1,Math.max(0,n)),t.x,t.y):Jn(n,e.curve)}function ni(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 he(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],l=d.t-u.t;return l<=0?d.v:ni(u.v,d.v,ti((e-u.t)/l,u),t)}var be=new Map,ii=64;function qt(n,e=pe){let t=`${e}\0${n}`,i=be.get(t);if(i!==void 0)return i;let r=null;try{r=jt(n).lanes.find(o=>o.target===e)??null}catch{r=null}return be.size>ii&&be.clear(),be.set(t,r),r}var Yt=48,Xt=new WeakMap;function ri(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 l=he(n,d,"log");r.push(u),o.push(o[o.length-1]+(l+he(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,l=e[u].t;if(!(l<=0))for(let g=1;g<=Yt;g+=1)a(Math.max(d,0)+(l-d)*g/Yt)}return{ts:Float64Array.from(r),ss:Float64Array.from(o),firstRate:t,lastRate:i}}function oi(n){let e=Xt.get(n);return e||(e=ri(n),Xt.set(n,e)),e}function ai(n){return typeof n!="number"&&n.points.length>0}function si(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 He(n,e){if(typeof n=="number")return e/n;if(!ai(n))return e;let{ts:t,ss:i,firstRate:r,lastRate:o}=oi(n),a=t.length-1;return e<=0?e/r:e>=i[a]?t[a]+(e-i[a])/o:si(i,t,e)}function ui(n){return n?qt(n,fe):null}function Kt(n,e){return ui(n)??e}var li="http://www.w3.org/1999/xhtml";function Jt(n){return n!=null&&n.nodeType===1}function Zt(n){return Jt(n)&&n.namespaceURI===li}function We(n,e){return Zt(n)&&n.localName===e}function di(n){return We(n,"video")}function ci(n){return We(n,"audio")}function C(n){return di(n)||ci(n)}function Ge(n){return We(n,"img")}var _=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),co=Object.freeze([_.start,_.duration,_.trackIndex]),mo=Object.freeze([_.derivedEnd]),po=Object.freeze([_.derivedEnd,_.legacyTrack]);function M(n){if(n==null||n.trim()==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}var tn=/^[A-Za-z0-9_.:-]+$/;function nn(n,e){let t=n.charCodeAt(e);return t>=48&&t<=57}function Qt(n,e){let t=e;for(;t>=0&&nn(n,t);)t--;return t}function mi(n,e){let t=e;for(;t>=0&&(n[t]??"").trim()==="";)t--;return t}function pi(n){let e=n.length-1;if(!nn(n,e))return null;let t=Qt(n,e);return n[t]==="."&&(t=Qt(n,t-1)),t+1}function fi(n){let e=pi(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(!tn.test(r))return null;let o=Number(n.slice(e));return Number.isFinite(o)?{refId:r,operator:i,magnitude:o}:null}function ge(n){let e=(n??"").trim();if(!e)return null;let t=M(e);if(t!=null)return{kind:"absolute",value:t};if(tn.test(e))return{kind:"reference",refId:e,offset:0};let i=fi(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 hi(n,e,t,i){if(e==null||e.trim()==="")return t.defaultStart===void 0?0:t.defaultStart;if(!n)return T(i,"invalid-start",_.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",_.start,e),null):Math.max(0,r+n.offset)}var bi=1e-9;function gi(n,e){return Math.abs(n-e)<=bi}function _i(n,e,t){let i=M(n);if(i==null){T(t,"deprecated-end",_.derivedEnd,n),T(t,"invalid-end",_.derivedEnd,n);return}if(e==null){T(t,"deprecated-end",_.derivedEnd,n);return}gi(i,e)||(T(t,"deprecated-end",_.derivedEnd,n),T(t,"conflicting-end",_.derivedEnd,n))}function yi(n,e,t){let i=M(n);return i==null||i<0?(T(t,"invalid-duration",_.duration,n),{duration:null,end:null,durationSource:"invalid"}):{duration:i,end:e==null?null:e+i,durationSource:"duration"}}function vi(n,e,t){T(t,"deprecated-end",_.derivedEnd,n);let i=M(n);return i==null?(T(t,"invalid-end",_.derivedEnd,n),{duration:null,end:null,durationSource:"invalid"}):e==null?{duration:null,end:i,durationSource:"legacy-end"}:i<e?(T(t,"end-before-start",_.derivedEnd,n),{duration:null,end:null,durationSource:"invalid"}):{duration:i-e,end:i,durationSource:"legacy-end"}}function Ai(n,e,t){let i=n.getAttribute(_.duration),r=n.getAttribute(_.derivedEnd);if(i==null)return r==null?{duration:null,end:null,durationSource:"missing"}:vi(r,e,t);let o=yi(i,e,t);return r!=null&&_i(r,o.end,t),o}function en(n,e,t,i){let r=M(n);return r==null||!Number.isInteger(r)?(T(i,"invalid-track-index",e,n),{trackIndex:0,trackSource:"invalid"}):{trackIndex:r,trackSource:t}}function Si(n,e){let t=n.getAttribute(_.trackIndex),i=n.getAttribute(_.legacyTrack);if(t==null&&i==null)return{trackIndex:0,trackSource:"default"};if(t==null&&i!=null)return T(e,"deprecated-layer",_.legacyTrack,i),en(i,_.legacyTrack,"legacy-layer",e);let r=en(t??"",_.trackIndex,"track-index",e);if(i==null)return r;T(e,"deprecated-layer",_.legacyTrack,i);let o=M(i);return o!=null&&o!==r.trackIndex&&T(e,"conflicting-layer",_.legacyTrack,i),r}function Be(n,e={}){let t=[],i=n.getAttribute(_.start),r=ge(i),o=hi(r,i,e,t),a=Ai(n,o,t),s=Si(n,t);return{startExpression:r,start:o,...a,...s,diagnostics:t}}function q(n){return M(n)}function _e(n){return Ot(e=>n.getAttribute(e),C(n)?n.defaultPlaybackRate:1)}function $e(n){return Kt(n.getAttribute("data-automation"),_e(n))}function rn(n){return Lt(e=>n.getAttribute(e))}function Y(n,e){return Ei(e,rn(n),$e(n))}function ye(n,e=0){return!Ge(n)||!n.hasAttribute("data-start")&&!n.hasAttribute("data-track-index")?null:Ut({tag:"img",authoredDurationSeconds:Vt(t=>n.getAttribute(t),e),sourceDurationSeconds:null,mediaStartSeconds:0,playbackRate:1}).seconds}function Ei(n,e,t){return typeof t=="number"?Oe(n,e,t):Number.isFinite(n)?He(t,Math.max(0,n-e)):null}var on="data-hf-media-start-basis";function Ti(n){return n?.trim().toLowerCase()==="global"?"global":"local"}function Ri(n){return Ti(n.basis)==="global"?n.authoredStart:n.hostStart+n.authoredStart}function an(n){return n.hasAutoStart||n.authoredStart==null||n.hostStart<=0?n.ordinaryStart():Ri({authoredStart:n.authoredStart,hostStart:n.hostStart,basis:n.basis})}function ve(n){let e=n.timelineRegistry??{},t=n.includeAuthoredTimingAttrs??!1,i=n.documentRef??document,r=new WeakMap,o=new WeakMap,a=new Set,s=c=>{let f=i.getElementById(c);return f||(i.querySelector(`[data-composition-id="${CSS.escape(c)}"]`)??null)},u=c=>{let f=o.get(c);if(f!==void 0)return f;let h=null,b=ce({start:0,duration:c.getAttribute("data-duration"),authoredDuration:t?c.getAttribute("data-hf-authored-duration"):null});if(b?.duration!=null&&b.duration>0&&(h=b.duration),h==null||h<=0){let y=l(c,0),v=ce({start:y,end:c.getAttribute("data-end"),authoredEnd:t?c.getAttribute("data-hf-authored-end"):null});v?.duration!=null&&v.duration>0&&(h=v.duration)}if((h==null||h<=0)&&C(c)&&(h=Y(c,c.duration)),(h==null||h<=0)&&(h=ye(c)),h==null||h<=0){let y=c.getAttribute("data-composition-id");if(y){let v=e[y]??null;if(v&&typeof v.duration=="function")try{let A=Number(v.duration());Number.isFinite(A)&&A>0&&(h=A)}catch(A){W("runtime.startResolver.site1",A)}}}return h!=null&&Number.isFinite(h)&&h>0?(o.set(c,h),h):(o.set(c,null),null)},d=(c,f)=>{if(c.hasAttribute("data-composition-id")){let b=c.parentElement?.closest("[data-composition-id]");return b?l(b,f):0}let h=c.closest("[data-composition-id]");return h?l(h,f):0},l=(c,f)=>{let h=r.get(c);if(h!==void 0)return h??f;if(a.has(c))return f;a.add(c);try{let b=ge(c.getAttribute("data-start"));if(!b){if(c.hasAttribute("data-composition-id")){let S=c.parentElement;if(S&&(S.hasAttribute("data-composition-src")||S.hasAttribute("data-composition-id")||S.hasAttribute("data-composition-file"))){let x=l(S,f);return r.set(c,x),x}}return r.set(c,f),f}if(b.kind==="absolute"){let S=Math.max(0,b.value),x=Math.max(0,d(c,f)+S);return r.set(c,x),x}let y=s(b.refId);if(!y)return r.set(c,f),f;let v=l(y,0),A=u(y);if(A==null||A<=0){let S=Math.max(0,v+b.offset);return r.set(c,S),S}let w=Math.max(0,v+A+b.offset);return r.set(c,w),w}finally{a.delete(c)}};return{resolveStartForElement:(c,f=0)=>l(c,Math.max(0,f)),resolveDurationForElement:c=>u(c),resolveMediaStartForElement:c=>{let f=c.closest("[data-composition-id]"),h=f?l(f,0):0;return an({authoredStart:q(c.getAttribute("data-start")),hostStart:h,hasAutoStart:c.hasAttribute("data-hf-auto-start"),basis:c.getAttribute(on),ordinaryStart:()=>l(c,h)})}}}var xi=n=>4*Number.EPSILON*Math.max(1,Math.abs(n));function Ae(n,e){return!Number.isFinite(n)||!Number.isFinite(e)?n===e:Math.abs(n-e)<=xi(Math.max(Math.abs(n),Math.abs(e)))}var sn=(n,e)=>n>=e||Ae(n,e),Se=(n,e,t)=>sn(n,e)&&n<t&&!Ae(n,t),ki=1e-6,ze=(n,e,t,i)=>Se(n,e,t)||sn(n,e)&&i>0&&t>=i-ki;var Ii="data-fade-in",Ci="data-fade-out",zo=Ii.slice(5),jo=Ci.slice(5),Di=Object.freeze({fadeIn:0,fadeOut:0});var Pi=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],ka=new Set([...Pi,"contain","isolation","mask-border","mix-blend-mode","opacity"]);function Li(n){return Number.isFinite(n)&&n>0?n:30}function Oi(n){return Number.isFinite(n)&&n>0?n:0}function un(n,e){let t=Li(e),i=Oi(n),r=i*t,o=Math.round(r);return Math.abs(r-o)<=.001?o/t:i}function ln(n,e,t){return{start:un(n,t),end:Number.isFinite(e)?un(e,t):e}}var Fi=["seconds-time","rational-fps","seek-keep-playing","composition-manifest-v1","runtime-data","play-range"];function Vi(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 Ui(n){let e=Number.isFinite(n)&&n>0?n:30,t=Number.isInteger(e)?1:1e6,i=Math.round(e*t),r=Vi(i,t);return{numerator:i/r,denominator:t/r}}function dn(n,e,t){return Math.max(n,(Math.ceil(e*t-1e-6)-1)/t)}function Hi(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 je(n){return{protocolVersion:1,capabilities:Fi,fps:Ui(n)}}function Wi(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=Hi(t.fps);return i===null||!Wi(t.capabilities)?{status:"unsupported",code:"invalid_protocol_metadata",receivedVersion:t.protocolVersion}:{status:"supported",fps:i,metadata:t}}function mn(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],l=d&&typeof d.duration=="function"?Number(d.duration()):null;!(n.hasAttribute("data-duration")||n.hasAttribute("data-end")||n.hasAttribute(Dt)||n.hasAttribute(Nt))&&(o==null||o<=0)&&l!=null&&Number.isFinite(l)&&l>0&&(o=l)}let s=o!=null&&o>0?r+o:Number.POSITIVE_INFINITY,u=e.exportRenderSeek?ln(r,s,e.canonicalFps):{start:r,end:s};return ze(e.currentTime,u.start,u.end,e.compositionDuration)}var X="first-frame",Gi=3;function K(n){let e=n.ownerDocument?.defaultView;return e&&n instanceof e.Element?!0:n instanceof Element}function R(n){if(!K(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 Bi(n){return n.hasAttribute("data-start")||n.hasAttribute("data-track-index")}function $i(n,e,t){let i=n;for(;i;){if(Bi(i)&&!mn(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:$i(n,t,i)}function Ee(n,{scope:e="all"}={}){let t=n.defaultView,i=ve({documentRef:n,timelineRegistry:t?.__timelines,includeAuthoredTimingAttrs:!0}),r=Array.from(n.querySelectorAll("video, audio")).filter(R).filter(s=>pn(s,e,i,t?.__timelines??{})).filter(s=>s.readyState<Gi),o=Array.from(n.querySelectorAll("img")).filter(s=>pn(s,s.getAttribute("loading")?.toLowerCase()==="lazy"?X:e,i,t?.__timelines??{})).filter(s=>!s.complete),a=n.fonts?.status==="loading";return{pendingMedia:r,pendingImages:o,fontsLoading:a}}function zi(n,{pendingMedia:e,pendingImages:t,fontsLoading:i},r){let o=e.map(u=>new Promise(d=>{if(u.error){d();return}let l=()=>{u.removeEventListener("canplay",l),u.removeEventListener("error",l),r.removeEventListener("abort",l),d()};u.addEventListener("canplay",l),u.addEventListener("error",l),r.addEventListener("abort",l,{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 ji(n,e,{scope:t="all"}={}){let i=Ee(n,{scope:t});return i.pendingMedia.length===0&&i.pendingImages.length===0&&!i.fontsLoading?null:zi(n,i,e)}var qi=50;function Yi(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,qi)};a()})}var Xi=50,Ki=2,Ji=1500;function qe(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 Zi(n,e){let t=n.defaultView;return t?(async()=>{let i=await qe(t,e);if(e.aborted)return;let r=await qe(t,e),o=0;for(;!e.aborted&&o<Ki;){if(r-i>=Ji)return;let a=await qe(t,e);if(e.aborted)return;o=a-r<Xi?o+1:0,r=a}})():null}var Qi=8e3;function er(n,e,t={}){let i=t.inputs??[(d,l)=>ji(d,l,{scope:t.scope}),Yi,Zi],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??Qi,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 fn(n,e,t={}){er(n,e,{...t,scope:X})}var tr=.05,nr=2,Te=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=Be(e.source);e.start=t.start??0,e.duration=t.duration!=null&&t.duration>0?t.duration:Number.POSITIVE_INFINITY}_inWindow(e,t){return Se(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)>tr?(r.driftSamples+=1,(i||r.driftSamples>=nr)&&(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"))R(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)R(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=Be(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;R(s)&&s.matches("audio[data-start], video[data-start]")&&this._followIframeMediaSrc(s);continue}if(a.type==="attributes"&&a.attributeName==="preload"){let s=a.target;R(s)&&s.matches("audio[data-start], video[data-start]")&&s.preload==="auto"&&this._adoptIframeMedia(s);continue}for(let s of a.addedNodes){if(!K(s))continue;let u=[];R(s)&&s.matches("audio[data-start], video[data-start]")&&u.push(s);let d=s.querySelectorAll("audio[data-start], video[data-start]");for(let l of d)R(l)&&u.push(l);for(let l of u)this._adoptIframeMedia(l)}for(let s of a.removedNodes){if(!K(s))continue;let u=[];R(s)&&s.matches("audio[data-start], video[data-start]")&&u.push(s);let d=s.querySelectorAll("audio[data-start], video[data-start]");for(let l of d)R(l)&&u.push(l);for(let l of u)this._detachIframeMedia(l)}}}),i={childList:!0,subtree:!0,attributes:!0,attributeFilter:["preload","src"]},r=It(e);for(let o of r)t.observe(o,i);this._mediaObserver=t}};function Ye(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 J(n,e,t){let i=n.end??e;return i<e?dn(n.start,i,t):i}function Xe(n,e,t,i){return n<e.start||n>=J(e,t,i)}var ir=100;function rr(n,e){return typeof n.currentTime=="number"&&Number.isFinite(n.currentTime)?n.currentTime:(n.frame??0)/e}function hn(n,e,t){return t<=0?!1:n.ended===!0?!0:n.ended===!1&&!n.isPlaying?!1:e>=t}function or(n,e,t,i,r,o){let{duration:a}=t;if(!r){let s=hn(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 ar(n,e,t,i,r,o)}function ar(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:J(r,t.duration,o),atEnd:i&&!s&&hn(n,e,a),stopRuntime:n.isPlaying,entering:s}}function bn(n,e,t,i){let r=rr(n,e),o=!t.paused,a=o||n.isPlaying,s=i.getPlayRange?.(),u=or(n,r,t,a,s,e),{atEnd:d,start:l}=u,g=t.duration>0?Math.min(r,t.duration):r,c=d?u.shownAtEnd:g,f=!n.isPlaying,h=d&&a;if(h&&i.getLoop())return i.media.audioOwner==="parent"&&i.media.pauseAll(),i.seek(l),i.play(),{...t,currentTime:l,paused:!1,enteringRange:!0};let b={...t,currentTime:c,paused:f,enteringRange:u.entering};i.media.audioOwner==="parent"&&(o&&f?i.media.pauseAll():!o&&!f&&i.media.playAll(),i.media.mirrorTime(c));let y=performance.now(),v=f!==t.paused;return(y-t.lastUpdateMs>ir||v)&&(b.lastUpdateMs=y,i.updateControlsTime(c,t.duration),i.updateControlsPlaying(!f),i.dispatchEvent(new CustomEvent("timeupdate",{detail:{currentTime:c}}))),h&&(u.stopRuntime&&i.seek(c),i.media.audioOwner==="parent"&&i.media.pauseAll(),b.paused=!0,i.updateControlsPlaying(!1),i.dispatchEvent(new Event("ended"))),b}function sr(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 gn(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(bn({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(sr(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 ur(n,e){return n.includes(e)?!0:/hyperframe\.runtime\.iife\.js|__hyperframes\s*=/.test(n)}var lr=new Set([">"," "," ",`
473
- `,"\r","\f"]);function Ke(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(lr.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 _n(n,e){if(!n||ur(n,e))return n;let t=`<script src="${e}"></script>`,i=Ke(n,"head");if(i)return n.slice(0,i.end)+t+n.slice(i.end);let r=Ke(n,"body");if(r)return n.slice(0,r.index)+t+n.slice(r.index);let o=Ke(n,"html");return o?n.slice(0,o.end)+t+n.slice(o.end):t+n}var D="shader-capture-scale",O="shader-loading",Re="runtime-src",yn="__hf_shader_capture_scale",vn="__hf_shader_loading",F=["Preparing scene transitions","Sampling outgoing scene motion","Sampling incoming scene motion","Caching transition frames","Finalizing transition preview"];function Je(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 dr(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 An(n,e){return n.filter(t=>t!==""&&t.split("=")[0]!==e)}function cr(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=An(u.split("&"),yn);d=An(d,vn),e!==null&&d.push(`${yn}=${encodeURIComponent(e)}`),t!=="composition"&&d.push(`${vn}=${encodeURIComponent(t)}`);let l=d.join("&");return`${s}${l?`?${l}`:""}${o}`}function mr(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 Z(n){return dr(n.getAttribute(O))}function Sn(n){return Number(Je(n.getAttribute(D))??"1")}function En(n,e){return cr(e,Je(n.getAttribute(D)),Z(n))}function Q(n,e){return _n(mr(e,Je(n.getAttribute(D)),Z(n)),pr(n))}function pr(n){let e=n.getAttribute(Re)?.trim();if(!e)return P;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:P}catch{return P}}function Tn(){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=f=>{f.preventDefault(),f.stopPropagation()};for(let f of["selectstart","dragstart","pointerdown","mousedown","click","dblclick","contextmenu","touchstart"])n.addEventListener(f,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=F[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 l=f=>{let h=document.createElement("div");h.className="hfp-shader-loader-row";let b=document.createElement("span");b.className="hfp-shader-loader-label",b.textContent=f;let y=document.createElement("span");return y.className="hfp-shader-loader-value",h.appendChild(b),h.appendChild(y),d.appendChild(h),{row:h,label:b,value:y}},g=l("transition"),c=l("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:c.label,frameValue:c.value,frameRow:c.row}}var fr=420;function we(n,e,t){e.textContent=t,n.style.visibility=t?"visible":"hidden"}var xe=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)",we(this._el.transitionRow,this._el.transitionValue,""),we(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(F.length-1,Math.floor(a*F.length));this._el.title.textContent=F[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",we(this._el.transitionRow,this._el.transitionValue,u),we(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()},fr)}};function Rn(n){return n?.trim().toLowerCase().startsWith("video/")??!1}function wn(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 hr=.1,br=5,Ze="sandbox-origin",xn=1e4,Qe=8e3,et="assets-loading",ee="assets-loading-ui",tt="low-power-idle",kn="disable-click-to-play",te="range-start",ne="range-end",gr=150;function nt(n){return!Number.isFinite(n)||n<=0?1:Math.max(hr,Math.min(br,n))}var ke=class extends HTMLElement{static get observedAttributes(){return["src","srcdoc","width","height","controls","muted","audio-locked","volume","poster","playback-rate","audio-src","type",Ze,Re,D,O,ee,tt,te,ne]}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"}),xt(this.shadow,vt),{container:this.container,iframe:this.iframe}=kt(),this.shadow.appendChild(this.container);let e=Tn();this.shadow.appendChild(e.root),this.shaderLoader=new xe(e),this._media=new Te({dispatchEvent:t=>this._emit(t),getMuted:()=>this.muted,getVolume:()=>this._volume,getPlaybackRate:()=>this.playbackRate,getCurrentTime:()=>this._currentTime,isPaused:()=>this._paused}),this._directTimelineClock=new de({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 se(this.iframe,{onReady:t=>this._onProbeReady(t),onError:t=>this._emit(new CustomEvent("error",{detail:{message:t}}))}),this.addEventListener("click",t=>{this.disableClickToPlay||wt(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=Ne(this.shadow,this.getAttribute("poster"),this.posterEl)),this.hasAttribute("audio-src")&&this._media.setupFromUrl(this.getAttribute("audio-src")),this.hasAttribute("srcdoc")&&(this.iframe.srcdoc=Q(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=Q(this,i);else{this.iframe.removeAttribute("srcdoc");let r=this.getAttribute("src");r!==null&&this._wantsVideo()&&this._navigateSrc(r)}break;case Ze:this._applySandboxOriginPolicy(this.isConnected&&t!==i);break;case"width":this._setCompositionSize(U(i)??1920,this._compositionHeight);break;case"height":this._setCompositionSize(this._compositionWidth,U(i)??1080);break;case"controls":i!==null?this._setupControls():(this.controlsApi?.destroy(),this.controlsApi=null);break;case"poster":this.posterEl=Ne(this.shadow,i,this.posterEl);break;case"playback-rate":{let r=nt(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 ee:i==="none"&&this.shaderLoader.hideAssetsLoading();break;case tt:this._sendControl("set-idle-heartbeat",{slow:i!==null});break;case te:case ne:this._applyPlayRange(!0);break;case D:case O:case Re:if(!this.isConnected)break;this._reloadShaderOptions();break}}_applySandboxOriginPolicy(e=!1){this.hasAttribute(Ze)?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=Q(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?Xe(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;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 nt(parseFloat(this.getAttribute("playback-rate")||"1"))}set playbackRate(e){this.setAttribute("playback-rate",String(nt(e)))}get shaderCaptureScale(){return Sn(this)}set shaderCaptureScale(e){this.setAttribute(D,String(e))}get shaderLoading(){return Z(this)}set shaderLoading(e){e==="composition"?this.removeAttribute(O):this.setAttribute(O,e)}get assetsLoadingUi(){return this.getAttribute(ee)==="none"?"none":"player"}set assetsLoadingUi(e){e==="none"?this.setAttribute(ee,"none"):this.removeAttribute(ee)}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(kn)}set disableClickToPlay(e){this.toggleAttribute(kn,e)}get loop(){return this.hasAttribute("loop")}set loop(e){e?this.setAttribute("loop",""):this.removeAttribute("loop")}get rangeStart(){return this._readSeconds(te)}set rangeStart(e){this._writeSeconds(te,e)}get rangeEnd(){return this._readSeconds(ne)}set rangeEnd(e){this._writeSeconds(ne,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(te)||this.hasAttribute(ne)}_playRange(){return Ye(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}=Ye(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){Xe(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=J(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,...je(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 ${xn}ms`)},xn);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"))R(i)&&(i.muted=e||i.defaultMuted)}_stopIframeMedia(){let e=this._getSameOriginIframeDocument();if(e)for(let t of e.querySelectorAll("video, audio"))R(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(tt)})}_reloadShaderOptions(){if(!this._videoSource){if(this._abandonComposition("Shader options changed before runtime data was applied"),this.hasAttribute("srcdoc")){this.iframe.srcdoc=Q(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 Rn(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=En(this,e)}_loadVideo(e){this._videoSource||(this._videoSource=wn({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._applyThenEmit(()=>this._handleRuntimeMessage(e))}_handleRuntimeMessage(e){gn(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:()=>Z(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),Qe)):this._settleAssetsReady(i);return}fn(e,({timedOut:r})=>{i===this._assetsGeneration&&(r&&this._warnStuckAssets(e),this._settleAssetsReady(i))},{timeoutMs:Qe}),this._assetsReady||this._startAssetsLoadingOverlayTimer(i)}_startAssetsLoadingOverlayTimer(e){this._assetsLoadingShowTimer=setTimeout(()=>{this._assetsLoadingShowTimer=null,!(e!==this._assetsGeneration||this._assetsReady)&&(this.setAttribute(et,""),this.assetsLoadingUi!=="none"&&this.shaderLoader.showAssetsLoading())},gr)}_hasPendingFirstFrameAssets(e){let{pendingMedia:t,pendingImages:i,fontsLoading:r}=Ee(e,{scope:X});return t.length>0||i.length>0||r}_warnStuckAssets(e){let{pendingMedia:t,pendingImages:i,fontsLoading:r}=Ee(e,{scope:X}),o=e.defaultView;console.warn(`[hyperframes-player] assets-loading timed out after ${Qe}ms \u2014 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(et),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._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(et),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(){!Mt(this,this.iframe,this._compositionWidth,this._compositionHeight)&&this._ready&&!this._rescaleWarned&&(this._rescaleWarned=!0,console.warn("[hyperframes-player] rescale no-op after ready \u2014 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=Rt(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",ke);return Ln(_r);})();
472
+ `,At='<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>',St='<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>',Ie='<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>',Ce='<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>',Et='<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 De=[.25,.5,1,1.5,2,4];function G(n){return Number.isInteger(n)?`${n}x`:`${n}x`}function ue(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 Tt(n,e,t={}){let i=t.speedPresets??De,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">${At}</span><span class="hfp-ico hfp-ico-pause">${St}</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 l=document.createElement("button");l.className="hfp-speed-btn",l.type="button",l.textContent="1x",l.setAttribute("aria-label","Playback speed");let b=document.createElement("div");b.className="hfp-speed-menu",b.setAttribute("role","menu");for(let c of i){let f=document.createElement("button");f.className="hfp-speed-option",f.type="button",f.setAttribute("role","menuitem"),f.dataset.speed=String(c),f.textContent=G(c),c===1&&f.classList.add("hfp-active"),b.appendChild(f)}d.appendChild(b),d.appendChild(l);let y=document.createElement("div");y.className="hfp-volume-wrap";let g=document.createElement("button");g.className="hfp-mute-btn",g.type="button",g.innerHTML=Ie,g.setAttribute("aria-label","Mute");let m=document.createElement("div");m.className="hfp-volume-slider-wrap";let p=document.createElement("div");p.className="hfp-volume-slider",p.setAttribute("role","slider"),p.setAttribute("aria-label","Volume"),p.setAttribute("aria-valuemin","0"),p.setAttribute("aria-valuemax","100"),p.setAttribute("aria-valuenow","100"),p.tabIndex=0;let h=document.createElement("div");h.className="hfp-volume-fill",h.style.width="100%",p.appendChild(h),m.appendChild(p),y.appendChild(m),y.appendChild(g),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 v=!1,E=!1,A=1,T=null,N=i.indexOf(1);N===-1&&(N=0);let R=(c,f)=>c?Et:f===0?Ce:f<.5?Ce:Ie;o.addEventListener("click",c=>{c.stopPropagation(),v?e.onPause():e.onPlay()}),g.addEventListener("click",c=>{c.stopPropagation(),e.onMuteToggle()});let k=!1,re=c=>{let f=p.getBoundingClientRect(),S=Math.max(0,Math.min(1,(c-f.left)/f.width));A=S,h.style.width=`${S*100}%`,p.setAttribute("aria-valuenow",String(Math.round(S*100))),E&&S>0&&e.onMuteToggle(),g.innerHTML=R(E,S),e.onVolumeChange(S)};p.addEventListener("mousedown",c=>{c.stopPropagation(),k=!0,re(c.clientX)});let it=c=>{k&&re(c.clientX)},rt=()=>{k=!1};document.addEventListener("mousemove",it),document.addEventListener("mouseup",rt),p.addEventListener("touchstart",c=>{k=!0;let f=c.touches[0];f&&re(f.clientX)},{passive:!0});let ot=c=>{if(k){let f=c.touches[0];f&&re(f.clientX)}},at=()=>{k=!1};document.addEventListener("touchmove",ot,{passive:!0}),document.addEventListener("touchend",at);let st=.05;p.addEventListener("keydown",c=>{let f=A;if(c.key==="ArrowRight"||c.key==="ArrowUp")f=Math.min(1,A+st);else if(c.key==="ArrowLeft"||c.key==="ArrowDown")f=Math.max(0,A-st);else return;c.preventDefault(),c.stopPropagation(),A=f,h.style.width=`${f*100}%`,p.setAttribute("aria-valuenow",String(Math.round(f*100))),E&&f>0&&e.onMuteToggle(),g.innerHTML=R(E,f),e.onVolumeChange(f)});let ut=c=>{for(let f of b.querySelectorAll(".hfp-speed-option"))f.classList.toggle("hfp-active",f.dataset.speed===String(c))};l.addEventListener("click",c=>{c.stopPropagation();let f=b.classList.toggle("hfp-open");l.setAttribute("aria-expanded",String(f))}),b.addEventListener("click",c=>{c.stopPropagation();let f=c.target.closest(".hfp-speed-option");if(!f)return;let S=parseFloat(f.dataset.speed);N=i.indexOf(S),l.textContent=G(S),ut(S),b.classList.remove("hfp-open"),l.setAttribute("aria-expanded","false"),e.onSpeedChange(S)});let lt=()=>{b.classList.remove("hfp-open"),l.setAttribute("aria-expanded","false")};document.addEventListener("click",lt);let oe=c=>{let f=a.getBoundingClientRect(),S=Math.max(0,Math.min(1,(c-f.left)/f.width));e.onSeek(S)},C=!1;a.addEventListener("mousedown",c=>{c.stopPropagation(),C=!0,e.onScrubStart?.(),oe(c.clientX)});let dt=c=>{C&&oe(c.clientX)},ct=()=>{C&&(C=!1,e.onScrubEnd?.())};document.addEventListener("mousemove",dt),document.addEventListener("mouseup",ct),a.addEventListener("touchstart",c=>{C=!0,e.onScrubStart?.();let f=c.touches[0];f&&oe(f.clientX)},{passive:!0});let mt=c=>{if(C){let f=c.touches[0];f&&oe(f.clientX)}},pt=()=>{C&&(C=!1,e.onScrubEnd?.())};document.addEventListener("touchmove",mt,{passive:!0}),document.addEventListener("touchend",pt);let ft=()=>{T&&clearTimeout(T),T=setTimeout(()=>{v&&r.classList.add("hfp-hidden")},3e3)},ae=n instanceof ShadowRoot?n.host:n,ht=()=>{r.classList.remove("hfp-hidden"),ft()},bt=()=>{v&&r.classList.add("hfp-hidden")};return ae.addEventListener("mousemove",ht),ae.addEventListener("mouseleave",bt),{updateTime(c,f){let S=f>0?Math.min(c,f):c,Dn=f>0?S/f*100:0;s.style.width=`${Dn}%`,u.textContent=`${ue(S)} / ${ue(f)}`},updatePlaying(c){v=c,o.classList.toggle("hfp-playing",c),o.setAttribute("aria-label",c?"Pause":"Play"),c?ft():r.classList.remove("hfp-hidden")},updateSpeed(c){let f=i.indexOf(c);f!==-1&&(N=f),l.textContent=G(c),ut(c)},updateMuted(c){E=c,g.innerHTML=R(c,A),g.setAttribute("aria-label",c?"Unmute":"Mute")},updateVolume(c){A=c,h.style.width=`${c*100}%`,p.setAttribute("aria-valuenow",String(Math.round(c*100))),g.innerHTML=R(E,c)},setVolumeControlsHidden(c){y.style.display=c?"none":""},show(){r.style.display=""},hide(){r.style.display="none"},destroy(){document.removeEventListener("mousemove",dt),document.removeEventListener("mouseup",ct),document.removeEventListener("touchmove",mt),document.removeEventListener("touchend",pt),document.removeEventListener("mousemove",it),document.removeEventListener("mouseup",rt),document.removeEventListener("touchmove",ot),document.removeEventListener("touchend",at),document.removeEventListener("click",lt),ae.removeEventListener("mousemove",ht),ae.removeEventListener("mouseleave",bt),T&&clearTimeout(T),r.remove()}}}function Rt(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=Tt(n,r,s);return u.updateMuted(e),u.updateVolume(t),u}function Ne(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 wt(n){return n.composedPath().some(e=>e instanceof HTMLElement&&e.classList.contains("hfp-controls"))}var le=null;function xt(n,e){if(typeof CSSStyleSheet<"u")try{le||(le=new CSSStyleSheet,le.replaceSync(e)),n.adoptedStyleSheets=[le];return}catch{}let t=document.createElement("style");t.textContent=e,n.appendChild(t)}function kt(){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 Mt(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 Hn(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 de=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 l;try{l=e.time()}catch{this._raf=null;return}let b=i(),y=o();y.end>0&&(l=Math.min(l,y.end));let g=a===null?0:l-a;g!==0&&(u=Math.min(g,s),s=g),a=l;let m=Hn(l,u,y);m&&(l=y.shown);let p=performance.now();if((p-this._lastUpdateMs>100||m)&&(this._lastUpdateMs=p,this._callbacks.onTimeUpdate(l,b)),m){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 It(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)Wn(i)||t.push(i);return Gn(n),t}function Gn(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 Wn(n){let e=n.parentElement;for(;e;){if(e.hasAttribute("data-composition-id"))return!0;e=e.parentElement}return!1}function Ct(){return globalThis}function W(n,e){if(typeof window>"u")return;let t=Ct(),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 Dt="data-hf-authored-duration",Nt="data-hf-authored-end";function B(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 ce(n){let e=B(n.start);if(e==null)return null;let t=Math.max(0,e),i=B(n.duration),r=B(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=B(n.end),s=B(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 O=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),Wr=Object.freeze([O.start,O.duration,O.trackIndex]),Br=Object.freeze([O.derivedEnd]),$r=Object.freeze([O.derivedEnd,O.legacyTrack]);function Pe(n){if(n==null||n.trim()==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}var Pt=n=>{let e=Pe(n);return e!==null&&e>=0?e:null};function Lt(n){return Pt(n("data-playback-start"))??Pt(n("data-media-start"))??0}var $=.1,z=10;function Le(n){return Number.isFinite(n)&&n>0?Math.max($,Math.min(z,n)):1}function Ot(n,e=1){let t=Number.parseFloat(n("data-playback-rate")??"");return Le(Number.isFinite(t)&&t>0?t:e)}function Ft(n){let e=Pe(n("data-duration"));return e!==null&&e>0?e:null}function Vt(n,e){let t=Ft(n);if(t!==null)return t;let i=Pe(n("data-end"));return i!==null?i-e:null}var Bn=3;function Oe(n,e,t){return Number.isFinite(n)?Math.max(0,n-e)/Le(t):null}function Ut(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:Bn,source:"default"};if(i===null)return{seconds:null,source:"pending",reason:"source duration not yet probed"};let a=Oe(i,r,o);return a===null?{seconds:null,source:"pending",reason:"source reported a non-finite duration"}:{seconds:a,source:"media"}}var Gt="data-fx-chain",jr=Gt.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}),Fe=(n=.707,e="Bandwidth \u2014 higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:n,scale:"log",automatable:!0,hint:e}),me=(n=-40,e=40,t=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:n,max:e,step:.1,default:t,automatable:!0}),Ht={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."},Wt=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[me(-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),me(-40,40,0),Fe(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),me(-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),me(-40,40,0)],web:"biquad-highshelf"},{id:"highpass",label:"High-pass",group:"filter",description:"Remove low frequencies \u2014 the usual fix for rumble on a voice.",params:[j("frequency","Cutoff",300,20,2e4),Fe(.707),Ht],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies \u2014 darkens or muffles a track.",params:[j("frequency","Cutoff",8e3,100,2e4),Fe(.707),Ht],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:"Hard ceiling \u2014 nothing gets past the 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:"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 \u2014 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"}],qr=new Map(Wt.map(n=>[n.id,n]));var Yr=Wt.map(n=>n.id);function $n(n){return 10**(n/20)}var Bt=$n(12);var Ue="data-automation",io=Ue.slice(5),Ve=1,zn=512,M=class extends Error{constructor(e){super(e),this.name="AudioAutomationError"}},pe="volume",fe="rate";function $t(n){if(n===pe)return{kind:"volume"};if(n===fe)return{kind:"rate"};let e=n.split(".");if(e.length===3&&e[0]==="fx"&&e[1]===jn){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 jn="preset";var qn={min:0,max:Bt,step:.01,unit:"",label:"Volume",scale:"linear",default:1},Yn={min:$,max:z,step:.05,unit:"x",label:"Speed",scale:"log",default:1};function q(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 Xn(n){let e=q(n);return e===null||e===0?0:Math.min(1,Math.max(-1,e))}function zt(n,e){let t=q(n),i=q(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 Kn(n){let e=Xn(n?.curve),t=zt(n?.viaX,n?.viaY);return{...e?{curve:e}:{},...t?{viaX:t.x,viaY:t.y}:{}}}function Jn(n,e){let t=q(n?.t),i=q(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,...Kn(n)}}function Zn(n,e){let t=n.map(r=>Jn(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,zn)}function Qn(n){let e=[];for(let t of n.lanes){if(!$t(t.target))continue;let i=t.target===pe?qn:t.target===fe?Yn:null,r=Zn(t.points??[],i);r.length>0&&e.push({target:t.target,points:r})}return{version:Ve,lanes:e}}function jt(n){let e;try{e=JSON.parse(n)}catch(r){throw new M(`Automation is not valid JSON: ${r.message}`)}if(typeof e!="object"||e===null)throw new M("Automation must be a JSON object.");let t=e;if(t.version!==Ve)throw new M(`Unsupported automation version: ${String(t.version)}`);if(!Array.isArray(t.lanes))throw new M("Automation is missing a `lanes` array.");let i=t.lanes.map((r,o)=>{if(typeof r!="object"||r===null)throw new M(`Lane ${o} is not an object.`);let a=r;if(typeof a.target!="string"||!$t(a.target))throw new M(`Lane ${o} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new M(`Lane ${o} is missing a \`points\` array.`);return{target:a.target,points:a.points}});return Qn({version:Ve,lanes:i})}function ei(n,e){return e?Math.pow(n,Math.pow(2,2*e)):n}function ti(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 ni(n,e,t){let{cx:i,cy:r,w:o}=ti(e,t),a=2-2*o,s=n*a-1+2*o*i,u=-n*a-2*o*i,d=ii(s,u,n),l=1-d,b=l*l+2*o*d*l+d*d;return b>0?(2*o*r*d*l+d*d)/b:n}function ii(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 ri(n,e){let t=zt(e.viaX,e.viaY);return t?ni(Math.min(1,Math.max(0,n)),t.x,t.y):ei(n,e.curve)}function oi(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 he(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 b=a+s>>1;i[b].t<=e?a=b:s=b}let u=i[a],d=i[s],l=d.t-u.t;return l<=0?d.v:oi(u.v,d.v,ri((e-u.t)/l,u),t)}var be=new Map,ai=64;function qt(n,e=pe){let t=`${e}\0${n}`,i=be.get(t);if(i!==void 0)return i;let r=null;try{r=jt(n).lanes.find(o=>o.target===e)??null}catch{r=null}return be.size>ai&&be.clear(),be.set(t,r),r}var Yt=48,Xt=new WeakMap;function si(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 l=he(n,d,"log");r.push(u),o.push(o[o.length-1]+(l+he(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,l=e[u].t;if(!(l<=0))for(let b=1;b<=Yt;b+=1)a(Math.max(d,0)+(l-d)*b/Yt)}return{ts:Float64Array.from(r),ss:Float64Array.from(o),firstRate:t,lastRate:i}}function ui(n){let e=Xt.get(n);return e||(e=si(n),Xt.set(n,e)),e}function li(n){return typeof n!="number"&&n.points.length>0}function di(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 He(n,e){if(typeof n=="number")return e/n;if(!li(n))return e;let{ts:t,ss:i,firstRate:r,lastRate:o}=ui(n),a=t.length-1;return e<=0?e/r:e>=i[a]?t[a]+(e-i[a])/o:di(i,t,e)}function ci(n){return n?qt(n,fe):null}function Kt(n,e){return ci(n)??e}var mi="http://www.w3.org/1999/xhtml";function Jt(n){return n!=null&&n.nodeType===1}function Zt(n){return Jt(n)&&n.namespaceURI===mi}function Ge(n,e){return Zt(n)&&n.localName===e}function pi(n){return Ge(n,"video")}function fi(n){return Ge(n,"audio")}function D(n){return pi(n)||fi(n)}function We(n){return Ge(n,"img")}var _=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),po=Object.freeze([_.start,_.duration,_.trackIndex]),fo=Object.freeze([_.derivedEnd]),ho=Object.freeze([_.derivedEnd,_.legacyTrack]);function I(n){if(n==null||n.trim()==="")return null;let e=Number(n);return Number.isFinite(e)?e:null}var tn=/^[A-Za-z0-9_.:-]+$/;function nn(n,e){let t=n.charCodeAt(e);return t>=48&&t<=57}function Qt(n,e){let t=e;for(;t>=0&&nn(n,t);)t--;return t}function hi(n,e){let t=e;for(;t>=0&&(n[t]??"").trim()==="";)t--;return t}function bi(n){let e=n.length-1;if(!nn(n,e))return null;let t=Qt(n,e);return n[t]==="."&&(t=Qt(n,t-1)),t+1}function gi(n){let e=bi(n);if(e==null)return null;let t=hi(n,e-1),i=n[t];if(i!=="+"&&i!=="-")return null;let r=n.slice(0,t).trim();if(!tn.test(r))return null;let o=Number(n.slice(e));return Number.isFinite(o)?{refId:r,operator:i,magnitude:o}:null}function ge(n){let e=(n??"").trim();if(!e)return null;let t=I(e);if(t!=null)return{kind:"absolute",value:t};if(tn.test(e))return{kind:"reference",refId:e,offset:0};let i=gi(e);return i?{kind:"reference",refId:i.refId,offset:i.operator==="-"?-i.magnitude:i.magnitude}:null}function w(n,e,t,i){n.push({code:e,attribute:t,value:i})}function _i(n,e,t,i){if(e==null||e.trim()==="")return t.defaultStart===void 0?0:t.defaultStart;if(!n)return w(i,"invalid-start",_.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)?(w(i,"unresolved-start-reference",_.start,e),null):Math.max(0,r+n.offset)}var yi=1e-9;function vi(n,e){return Math.abs(n-e)<=yi}function Ai(n,e,t){let i=I(n);if(i==null){w(t,"deprecated-end",_.derivedEnd,n),w(t,"invalid-end",_.derivedEnd,n);return}if(e==null){w(t,"deprecated-end",_.derivedEnd,n);return}vi(i,e)||(w(t,"deprecated-end",_.derivedEnd,n),w(t,"conflicting-end",_.derivedEnd,n))}function Si(n,e,t){let i=I(n);return i==null||i<0?(w(t,"invalid-duration",_.duration,n),{duration:null,end:null,durationSource:"invalid"}):{duration:i,end:e==null?null:e+i,durationSource:"duration"}}function Ei(n,e,t){w(t,"deprecated-end",_.derivedEnd,n);let i=I(n);return i==null?(w(t,"invalid-end",_.derivedEnd,n),{duration:null,end:null,durationSource:"invalid"}):e==null?{duration:null,end:i,durationSource:"legacy-end"}:i<e?(w(t,"end-before-start",_.derivedEnd,n),{duration:null,end:null,durationSource:"invalid"}):{duration:i-e,end:i,durationSource:"legacy-end"}}function Ti(n,e,t){let i=n.getAttribute(_.duration),r=n.getAttribute(_.derivedEnd);if(i==null)return r==null?{duration:null,end:null,durationSource:"missing"}:Ei(r,e,t);let o=Si(i,e,t);return r!=null&&Ai(r,o.end,t),o}function en(n,e,t,i){let r=I(n);return r==null||!Number.isInteger(r)?(w(i,"invalid-track-index",e,n),{trackIndex:0,trackSource:"invalid"}):{trackIndex:r,trackSource:t}}function Ri(n,e){let t=n.getAttribute(_.trackIndex),i=n.getAttribute(_.legacyTrack);if(t==null&&i==null)return{trackIndex:0,trackSource:"default"};if(t==null&&i!=null)return w(e,"deprecated-layer",_.legacyTrack,i),en(i,_.legacyTrack,"legacy-layer",e);let r=en(t??"",_.trackIndex,"track-index",e);if(i==null)return r;w(e,"deprecated-layer",_.legacyTrack,i);let o=I(i);return o!=null&&o!==r.trackIndex&&w(e,"conflicting-layer",_.legacyTrack,i),r}function Be(n,e={}){let t=[],i=n.getAttribute(_.start),r=ge(i),o=_i(r,i,e,t),a=Ti(n,o,t),s=Ri(n,t);return{startExpression:r,start:o,...a,...s,diagnostics:t}}function Y(n){return I(n)}function _e(n){return Ot(e=>n.getAttribute(e),D(n)?n.defaultPlaybackRate:1)}function $e(n){return Kt(n.getAttribute("data-automation"),_e(n))}function rn(n){return Lt(e=>n.getAttribute(e))}function X(n,e){return wi(e,rn(n),$e(n))}function ye(n,e=0){return!We(n)||!n.hasAttribute("data-start")&&!n.hasAttribute("data-track-index")?null:Ut({tag:"img",authoredDurationSeconds:Vt(t=>n.getAttribute(t),e),sourceDurationSeconds:null,mediaStartSeconds:0,playbackRate:1}).seconds}function wi(n,e,t){return typeof t=="number"?Oe(n,e,t):Number.isFinite(n)?He(t,Math.max(0,n-e)):null}var on="data-hf-media-start-basis";function an(n){return n?.trim().toLowerCase()==="global"?"global":"local"}function xi(n){return an(n.basis)==="global"?n.authoredStart:n.hostStart+n.authoredStart}function sn(n){return ln(n)?xi({authoredStart:n.authoredStart,hostStart:n.hostStart,basis:n.basis}):n.ordinaryStart()}function un(n){return ln(n)&&an(n.basis)==="global"}function ln(n){return!n.hasAutoStart&&n.authoredStart!=null&&n.hostStart>0}function ve(n){let e=n.timelineRegistry??{},t=n.includeAuthoredTimingAttrs??!1,i=n.documentRef??document,r=new WeakMap,o=new WeakMap,a=new Set,s=m=>{let p=i.getElementById(m);return p||(i.querySelector(`[data-composition-id="${CSS.escape(m)}"]`)??null)},u=m=>{let p=o.get(m);if(p!==void 0)return p;let h=null,v=ce({start:0,duration:m.getAttribute("data-duration"),authoredDuration:t?m.getAttribute("data-hf-authored-duration"):null});if(v?.duration!=null&&v.duration>0&&(h=v.duration),h==null||h<=0){let E=l(m,0),A=ce({start:E,end:m.getAttribute("data-end"),authoredEnd:t?m.getAttribute("data-hf-authored-end"):null});A?.duration!=null&&A.duration>0&&(h=A.duration)}if((h==null||h<=0)&&D(m)&&(h=X(m,m.duration)),(h==null||h<=0)&&(h=ye(m)),h==null||h<=0){let E=m.getAttribute("data-composition-id");if(E){let A=e[E]??null;if(A&&typeof A.duration=="function")try{let T=Number(A.duration());Number.isFinite(T)&&T>0&&(h=T)}catch(T){W("runtime.startResolver.site1",T)}}}return h!=null&&Number.isFinite(h)&&h>0?(o.set(m,h),h):(o.set(m,null),null)},d=(m,p)=>{if(m.hasAttribute("data-composition-id")){let v=m.parentElement?.closest("[data-composition-id]");return v?l(v,p):0}let h=m.closest("[data-composition-id]");return h?l(h,p):0},l=(m,p)=>{let h=r.get(m);if(h!==void 0)return h??p;if(a.has(m))return p;a.add(m);try{let v=ge(m.getAttribute("data-start"));if(!v){if(m.hasAttribute("data-composition-id")){let R=m.parentElement;if(R&&(R.hasAttribute("data-composition-src")||R.hasAttribute("data-composition-id")||R.hasAttribute("data-composition-file"))){let k=l(R,p);return r.set(m,k),k}}return r.set(m,p),p}if(v.kind==="absolute"){let R=Math.max(0,v.value),k=Math.max(0,d(m,p)+R);return r.set(m,k),k}let E=s(v.refId);if(!E)return r.set(m,p),p;let A=l(E,0),T=u(E);if(T==null||T<=0){let R=Math.max(0,A+v.offset);return r.set(m,R),R}let N=Math.max(0,A+T+v.offset);return r.set(m,N),N}finally{a.delete(m)}},b=m=>{let p=m.closest("[data-composition-id]");return{authoredStart:Y(m.getAttribute("data-start")),hostStart:p?l(p,0):0,hasAutoStart:m.hasAttribute("data-hf-auto-start"),basis:m.getAttribute(on)}};return{resolveStartForElement:(m,p=0)=>l(m,Math.max(0,p)),resolveDurationForElement:m=>u(m),resolveMediaStartForElement:m=>{let p=b(m);return sn({...p,ordinaryStart:()=>l(m,p.hostStart)})},resolveHostStartForElement:m=>d(m,0),isRootGlobalMediaStartForElement:m=>D(m)&&un(b(m))}}var Mi=n=>4*Number.EPSILON*Math.max(1,Math.abs(n));function Ae(n,e){return!Number.isFinite(n)||!Number.isFinite(e)?n===e:Math.abs(n-e)<=Mi(Math.max(Math.abs(n),Math.abs(e)))}var dn=(n,e)=>n>=e||Ae(n,e),Se=(n,e,t)=>dn(n,e)&&n<t&&!Ae(n,t),Ii=1e-6,ze=(n,e,t,i)=>Se(n,e,t)||dn(n,e)&&i>0&&t>=i-Ii;var Di="data-fade-in",Ni="data-fade-out",qo=Di.slice(5),Yo=Ni.slice(5),Pi=Object.freeze({fadeIn:0,fadeOut:0});var Oi=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],Ia=new Set([...Oi,"contain","isolation","mask-border","mix-blend-mode","opacity"]);function Fi(n){return Number.isFinite(n)&&n>0?n:30}function Vi(n){return Number.isFinite(n)&&n>0?n:0}function cn(n,e){let t=Fi(e),i=Vi(n),r=i*t,o=Math.round(r);return Math.abs(r-o)<=.001?o/t:i}function mn(n,e,t){return{start:cn(n,t),end:Number.isFinite(e)?cn(e,t):e}}var Ui=["seconds-time","rational-fps","seek-keep-playing","composition-manifest-v1","runtime-data","play-range"];function Hi(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 Gi(n){let e=Number.isFinite(n)&&n>0?n:30,t=Number.isInteger(e)?1:1e6,i=Math.round(e*t),r=Hi(i,t);return{numerator:i/r,denominator:t/r}}function pn(n,e,t){return Math.max(n,(Math.ceil(e*t-1e-6)-1)/t)}function Wi(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 je(n){return{protocolVersion:1,capabilities:Ui,fps:Gi(n)}}function Bi(n){return Array.isArray(n)&&n.every(e=>typeof e=="string")}function fn(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=Wi(t.fps);return i===null||!Bi(t.capabilities)?{status:"unsupported",code:"invalid_protocol_metadata",receivedVersion:t.protocolVersion}:{status:"supported",fps:i,metadata:t}}function hn(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],l=d&&typeof d.duration=="function"?Number(d.duration()):null;!(n.hasAttribute("data-duration")||n.hasAttribute("data-end")||n.hasAttribute(Dt)||n.hasAttribute(Nt))&&(o==null||o<=0)&&l!=null&&Number.isFinite(l)&&l>0&&(o=l)}let s=o!=null&&o>0?r+o:Number.POSITIVE_INFINITY,u=e.exportRenderSeek?mn(r,s,e.canonicalFps):{start:r,end:s};return ze(e.currentTime,u.start,u.end,e.compositionDuration)}var K="first-frame",$i=3;function J(n){let e=n.ownerDocument?.defaultView;return e&&n instanceof e.Element?!0:n instanceof Element}function x(n){if(!J(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 zi(n){return n.hasAttribute("data-start")||n.hasAttribute("data-track-index")}function ji(n,e,t){let i=n;for(;i;){if(zi(i)&&!hn(i,{currentTime:0,compositionDuration:Number.POSITIVE_INFINITY,canonicalFps:30,exportRenderSeek:!1,timelineRegistry:t,resolver:e}))return!1;i=i.parentElement}return!0}function bn(n,e,t,i){return e==="all"?!0:ji(n,t,i)}function Ee(n,{scope:e="all"}={}){let t=n.defaultView,i=ve({documentRef:n,timelineRegistry:t?.__timelines,includeAuthoredTimingAttrs:!0}),r=Array.from(n.querySelectorAll("video, audio")).filter(x).filter(s=>bn(s,e,i,t?.__timelines??{})).filter(s=>s.readyState<$i),o=Array.from(n.querySelectorAll("img")).filter(s=>bn(s,s.getAttribute("loading")?.toLowerCase()==="lazy"?K:e,i,t?.__timelines??{})).filter(s=>!s.complete),a=n.fonts?.status==="loading";return{pendingMedia:r,pendingImages:o,fontsLoading:a}}function qi(n,{pendingMedia:e,pendingImages:t,fontsLoading:i},r){let o=e.map(u=>new Promise(d=>{if(u.error){d();return}let l=()=>{u.removeEventListener("canplay",l),u.removeEventListener("error",l),r.removeEventListener("abort",l),d()};u.addEventListener("canplay",l),u.addEventListener("error",l),r.addEventListener("abort",l,{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 Yi(n,e,{scope:t="all"}={}){let i=Ee(n,{scope:t});return i.pendingMedia.length===0&&i.pendingImages.length===0&&!i.fontsLoading?null:qi(n,i,e)}var Xi=50;function Ki(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,Xi)};a()})}var Ji=50,Zi=2,Qi=1500;function qe(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 er(n,e){let t=n.defaultView;return t?(async()=>{let i=await qe(t,e);if(e.aborted)return;let r=await qe(t,e),o=0;for(;!e.aborted&&o<Zi;){if(r-i>=Qi)return;let a=await qe(t,e);if(e.aborted)return;o=a-r<Ji?o+1:0,r=a}})():null}var tr=8e3;function nr(n,e,t={}){let i=t.inputs??[(d,l)=>Yi(d,l,{scope:t.scope}),Ki,er],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??tr,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 gn(n,e,t={}){nr(n,e,{...t,scope:K})}var ir=.05,rr=2,Te=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=Be(e.source);e.start=t.start??0,e.duration=t.duration!=null&&t.duration>0?t.duration:Number.POSITIVE_INFINITY}_inWindow(e,t){return Se(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>=rr)&&(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=Be(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);continue}for(let s of a.addedNodes){if(!J(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 l of d)x(l)&&u.push(l);for(let l of u)this._adoptIframeMedia(l)}for(let s of a.removedNodes){if(!J(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 l of d)x(l)&&u.push(l);for(let l of u)this._detachIframeMedia(l)}}}),i={childList:!0,subtree:!0,attributes:!0,attributeFilter:["preload","src"]},r=It(e);for(let o of r)t.observe(o,i);this._mediaObserver=t}};function Ye(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 Z(n,e,t){let i=n.end??e;return i<e?pn(n.start,i,t):i}function Xe(n,e,t,i){return n<e.start||n>=Z(e,t,i)}var or=100;function ar(n,e){return typeof n.currentTime=="number"&&Number.isFinite(n.currentTime)?n.currentTime:(n.frame??0)/e}function _n(n,e,t){return t<=0?!1:n.ended===!0?!0:n.ended===!1&&!n.isPlaying?!1:e>=t}function sr(n,e,t,i,r,o){let{duration:a}=t;if(!r){let s=_n(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 ur(n,e,t,i,r,o)}function ur(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:Z(r,t.duration,o),atEnd:i&&!s&&_n(n,e,a),stopRuntime:n.isPlaying,entering:s}}function yn(n,e,t,i){let r=ar(n,e),o=!t.paused,a=o||n.isPlaying,s=i.getPlayRange?.(),u=sr(n,r,t,a,s,e),{atEnd:d,start:l}=u,b=t.duration>0?Math.min(r,t.duration):r,y=d?u.shownAtEnd:b,g=!n.isPlaying,m=d&&a;if(m&&i.getLoop())return i.media.audioOwner==="parent"&&i.media.pauseAll(),i.seek(l),i.play(),{...t,currentTime:l,paused:!1,enteringRange:!0};let p={...t,currentTime:y,paused:g,enteringRange:u.entering};i.media.audioOwner==="parent"&&(o&&g?i.media.pauseAll():!o&&!g&&i.media.playAll(),i.media.mirrorTime(y));let h=performance.now(),v=g!==t.paused;return(h-t.lastUpdateMs>or||v)&&(p.lastUpdateMs=h,i.updateControlsTime(y,t.duration),i.updateControlsPlaying(!g),i.dispatchEvent(new CustomEvent("timeupdate",{detail:{currentTime:y}}))),m&&(u.stopRuntime&&i.seek(y),i.media.audioOwner==="parent"&&i.media.pauseAll(),p.paused=!0,i.updateControlsPlaying(!1),i.dispatchEvent(new Event("ended"))),p}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=fn(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(yn({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 dr(n,e){return n.includes(e)?!0:/hyperframe\.runtime\.iife\.js|__hyperframes\s*=/.test(n)}var cr=new Set([">"," "," ",`
473
+ `,"\r","\f"]);function Ke(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(cr.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 An(n,e){if(!n||dr(n,e))return n;let t=`<script src="${e}"></script>`,i=Ke(n,"head");if(i)return n.slice(0,i.end)+t+n.slice(i.end);let r=Ke(n,"body");if(r)return n.slice(0,r.index)+t+n.slice(r.index);let o=Ke(n,"html");return o?n.slice(0,o.end)+t+n.slice(o.end):t+n}var P="shader-capture-scale",F="shader-loading",Re="runtime-src",Sn="__hf_shader_capture_scale",En="__hf_shader_loading",V=["Preparing scene transitions","Sampling outgoing scene motion","Sampling incoming scene motion","Caching transition frames","Finalizing transition preview"];function Je(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 mr(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 Tn(n,e){return n.filter(t=>t!==""&&t.split("=")[0]!==e)}function pr(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=Tn(u.split("&"),Sn);d=Tn(d,En),e!==null&&d.push(`${Sn}=${encodeURIComponent(e)}`),t!=="composition"&&d.push(`${En}=${encodeURIComponent(t)}`);let l=d.join("&");return`${s}${l?`?${l}`:""}${o}`}function fr(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 Q(n){return mr(n.getAttribute(F))}function Rn(n){return Number(Je(n.getAttribute(P))??"1")}function wn(n,e){return pr(e,Je(n.getAttribute(P)),Q(n))}function ee(n,e){return An(fr(e,Je(n.getAttribute(P)),Q(n)),hr(n))}function hr(n){let e=n.getAttribute(Re)?.trim();if(!e)return L;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:L}catch{return L}}function xn(){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=g=>{g.preventDefault(),g.stopPropagation()};for(let g of["selectstart","dragstart","pointerdown","mousedown","click","dblclick","contextmenu","touchstart"])n.addEventListener(g,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=V[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 l=g=>{let m=document.createElement("div");m.className="hfp-shader-loader-row";let p=document.createElement("span");p.className="hfp-shader-loader-label",p.textContent=g;let h=document.createElement("span");return h.className="hfp-shader-loader-value",m.appendChild(p),m.appendChild(h),d.appendChild(m),{row:m,label:p,value:h}},b=l("transition"),y=l("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:b.value,transitionRow:b.row,frameLabel:y.label,frameValue:y.value,frameRow:y.row}}var br=420;function we(n,e,t){e.textContent=t,n.style.visibility=t?"visible":"hidden"}var xe=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)",we(this._el.transitionRow,this._el.transitionValue,""),we(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(V.length-1,Math.floor(a*V.length));this._el.title.textContent=V[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",we(this._el.transitionRow,this._el.transitionValue,u),we(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()},br)}};function kn(n){return n?.trim().toLowerCase().startsWith("video/")??!1}function Mn(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,_r=5,Ze="sandbox-origin",In=1e4,Qe=8e3,et="assets-loading",te="assets-loading-ui",tt="low-power-idle",Cn="disable-click-to-play",ne="range-start",ie="range-end",yr=150;function nt(n){return!Number.isFinite(n)||n<=0?1:Math.max(gr,Math.min(_r,n))}var ke=class extends HTMLElement{static get observedAttributes(){return["src","srcdoc","width","height","controls","muted","audio-locked","volume","poster","playback-rate","audio-src","type",Ze,Re,P,F,te,tt,ne,ie]}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"}),xt(this.shadow,vt),{container:this.container,iframe:this.iframe}=kt(),this.shadow.appendChild(this.container);let e=xn();this.shadow.appendChild(e.root),this.shaderLoader=new xe(e),this._media=new Te({dispatchEvent:t=>this._emit(t),getMuted:()=>this.muted,getVolume:()=>this._volume,getPlaybackRate:()=>this.playbackRate,getCurrentTime:()=>this._currentTime,isPaused:()=>this._paused}),this._directTimelineClock=new de({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 se(this.iframe,{onReady:t=>this._onProbeReady(t),onError:t=>this._emit(new CustomEvent("error",{detail:{message:t}}))}),this.addEventListener("click",t=>{this.disableClickToPlay||wt(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=Ne(this.shadow,this.getAttribute("poster"),this.posterEl)),this.hasAttribute("audio-src")&&this._media.setupFromUrl(this.getAttribute("audio-src")),this.hasAttribute("srcdoc")&&(this.iframe.srcdoc=ee(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=ee(this,i);else{this.iframe.removeAttribute("srcdoc");let r=this.getAttribute("src");r!==null&&this._wantsVideo()&&this._navigateSrc(r)}break;case Ze:this._applySandboxOriginPolicy(this.isConnected&&t!==i);break;case"width":this._setCompositionSize(H(i)??1920,this._compositionHeight);break;case"height":this._setCompositionSize(this._compositionWidth,H(i)??1080);break;case"controls":i!==null?this._setupControls():(this.controlsApi?.destroy(),this.controlsApi=null);break;case"poster":this.posterEl=Ne(this.shadow,i,this.posterEl);break;case"playback-rate":{let r=nt(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 te:i==="none"&&this.shaderLoader.hideAssetsLoading();break;case tt:this._sendControl("set-idle-heartbeat",{slow:i!==null});break;case ne:case ie:this._applyPlayRange(!0);break;case P:case F:case Re:if(!this.isConnected)break;this._reloadShaderOptions();break}}_applySandboxOriginPolicy(e=!1){this.hasAttribute(Ze)?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=ee(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?Xe(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;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 nt(parseFloat(this.getAttribute("playback-rate")||"1"))}set playbackRate(e){this.setAttribute("playback-rate",String(nt(e)))}get shaderCaptureScale(){return Rn(this)}set shaderCaptureScale(e){this.setAttribute(P,String(e))}get shaderLoading(){return Q(this)}set shaderLoading(e){e==="composition"?this.removeAttribute(F):this.setAttribute(F,e)}get assetsLoadingUi(){return this.getAttribute(te)==="none"?"none":"player"}set assetsLoadingUi(e){e==="none"?this.setAttribute(te,"none"):this.removeAttribute(te)}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(Cn)}set disableClickToPlay(e){this.toggleAttribute(Cn,e)}get loop(){return this.hasAttribute("loop")}set loop(e){e?this.setAttribute("loop",""):this.removeAttribute("loop")}get rangeStart(){return this._readSeconds(ne)}set rangeStart(e){this._writeSeconds(ne,e)}get rangeEnd(){return this._readSeconds(ie)}set rangeEnd(e){this._writeSeconds(ie,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(ne)||this.hasAttribute(ie)}_playRange(){return Ye(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}=Ye(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){Xe(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=Z(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,...je(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 ${In}ms`)},In);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(tt)})}_reloadShaderOptions(){if(!this._videoSource){if(this._abandonComposition("Shader options changed before runtime data was applied"),this.hasAttribute("srcdoc")){this.iframe.srcdoc=ee(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 kn(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=wn(this,e)}_loadVideo(e){this._videoSource||(this._videoSource=Mn({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._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:()=>Q(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),Qe)):this._settleAssetsReady(i);return}gn(e,({timedOut:r})=>{i===this._assetsGeneration&&(r&&this._warnStuckAssets(e),this._settleAssetsReady(i))},{timeoutMs:Qe}),this._assetsReady||this._startAssetsLoadingOverlayTimer(i)}_startAssetsLoadingOverlayTimer(e){this._assetsLoadingShowTimer=setTimeout(()=>{this._assetsLoadingShowTimer=null,!(e!==this._assetsGeneration||this._assetsReady)&&(this.setAttribute(et,""),this.assetsLoadingUi!=="none"&&this.shaderLoader.showAssetsLoading())},yr)}_hasPendingFirstFrameAssets(e){let{pendingMedia:t,pendingImages:i,fontsLoading:r}=Ee(e,{scope:K});return t.length>0||i.length>0||r}_warnStuckAssets(e){let{pendingMedia:t,pendingImages:i,fontsLoading:r}=Ee(e,{scope:K}),o=e.defaultView;console.warn(`[hyperframes-player] assets-loading timed out after ${Qe}ms \u2014 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(et),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._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(et),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(){!Mt(this,this.iframe,this._compositionWidth,this._compositionHeight)&&this._ready&&!this._rescaleWarned&&(this._rescaleWarned=!0,console.warn("[hyperframes-player] rescale no-op after ready \u2014 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=Rt(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",ke);return Vn(vr);})();
474
474
  //# sourceMappingURL=hyperframes-player.global.js.map
@@ -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-C22UJWNH.js";
9
+ } from "./chunk-SZ2NP7UV.js";
10
10
  import {
11
11
  formatBytes,
12
12
  label
@@ -14,28 +14,28 @@ import {
14
14
  import {
15
15
  ensureDOMParser
16
16
  } from "./chunk-PFCFR3KZ.js";
17
- import "./chunk-S2F6QM6J.js";
18
- import "./chunk-EAJNP7C7.js";
17
+ import "./chunk-DJD2XA6I.js";
18
+ import "./chunk-WA7RZY3S.js";
19
19
  import "./chunk-VWG7OQKU.js";
20
20
  import {
21
21
  c
22
22
  } from "./chunk-ZTZA4UWZ.js";
23
- import "./chunk-AP2WIRY6.js";
23
+ import "./chunk-PRPE3JNB.js";
24
24
  import "./chunk-AMKC3AXA.js";
25
25
  import {
26
26
  defineCommand
27
27
  } from "./chunk-S3S4TGEH.js";
28
28
  import "./chunk-54HJ63Q2.js";
29
29
  import "./chunk-PBN6GBJE.js";
30
- import "./chunk-ANWEGAE6.js";
31
- import "./chunk-WCQOPUJ4.js";
30
+ import "./chunk-S6YCUTNM.js";
31
+ import "./chunk-RGHVO2UZ.js";
32
32
  import {
33
33
  CANVAS_DIMENSIONS,
34
34
  parseHtml
35
35
  } from "./chunk-WFO4PSIZ.js";
36
36
  import "./chunk-DPVXBVLL.js";
37
- import "./chunk-VQX6DC4V.js";
38
- import "./chunk-247O73KD.js";
37
+ import "./chunk-SNHAPE52.js";
38
+ import "./chunk-275NJDC5.js";
39
39
  import "./chunk-VC76R6W2.js";
40
40
  import "./chunk-TWWSYAKJ.js";
41
41
  import "./chunk-U24VGXGA.js";
@@ -46,12 +46,12 @@ import "./chunk-GK4AIFIH.js";
46
46
  import "./chunk-2PSPARWP.js";
47
47
  import {
48
48
  withMeta
49
- } from "./chunk-SAYNFMCN.js";
49
+ } from "./chunk-CC5HTRDE.js";
50
50
  import "./chunk-K4WIOZFP.js";
51
51
  import "./chunk-XUXGIA7H.js";
52
52
  import "./chunk-WERLJGIC.js";
53
53
  import "./chunk-ISN5GRYI.js";
54
- import "./chunk-Z4LBLZ3I.js";
54
+ import "./chunk-CXPRQS6R.js";
55
55
  import "./chunk-KNU5COPB.js";
56
56
  import "./chunk-3GXQPCJC.js";
57
57
  import "./chunk-RQVDTPGD.js";