hyperframes 0.8.25 → 0.8.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +212 -59
- package/dist/fontLocalizeCli.js +29 -5
- package/dist/hyperframe-runtime.js +1 -1
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +1 -1
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/studio/assets/{hyperframes-player-CTP_00ix.js → hyperframes-player-DBxVmzQ-.js} +1 -1
- package/dist/studio/assets/{index-DSk_ALFr.js → index-B177PW6o.js} +144 -144
- package/dist/studio/assets/{index-Bjb4YqS_.js → index-BSANnCNW.js} +1 -1
- package/dist/studio/assets/{index-Di-8Jxqc.js → index-DmsMkmOI.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/studio/index.js +27 -11
- package/dist/studio/index.js.map +1 -1
- package/package.json +1 -1
package/dist/fontLocalizeCli.js
CHANGED
|
@@ -63492,7 +63492,12 @@ function scopeCssToComposition(css, compositionId, scopeSelectorOverride, author
|
|
|
63492
63492
|
if (!css || !trimmedCompositionId)
|
|
63493
63493
|
return css;
|
|
63494
63494
|
const scope = scopeSelectorOverride || `[data-composition-id="${escapeCssAttributeValue(trimmedCompositionId)}"]`;
|
|
63495
|
-
|
|
63495
|
+
let root;
|
|
63496
|
+
try {
|
|
63497
|
+
root = postcss.parse(css);
|
|
63498
|
+
} catch {
|
|
63499
|
+
return "";
|
|
63500
|
+
}
|
|
63496
63501
|
root.walkRules((rule) => {
|
|
63497
63502
|
if (isInsideGlobalAtRule(rule))
|
|
63498
63503
|
return;
|
|
@@ -71398,7 +71403,12 @@ var init_dist3 = __esm({
|
|
|
71398
71403
|
let root;
|
|
71399
71404
|
try {
|
|
71400
71405
|
root = postcss2.parse(style.content);
|
|
71401
|
-
} catch {
|
|
71406
|
+
} catch (error) {
|
|
71407
|
+
findings.push({
|
|
71408
|
+
code: "css_parse_error",
|
|
71409
|
+
severity: "error",
|
|
71410
|
+
message: `CSS parse error: ${error instanceof Error ? error.message : "unknown"}`
|
|
71411
|
+
});
|
|
71402
71412
|
continue;
|
|
71403
71413
|
}
|
|
71404
71414
|
root.walkRules((rule) => {
|
|
@@ -87609,10 +87619,24 @@ var WOFF2_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWeb
|
|
|
87609
87619
|
function fontSlug(familyName) {
|
|
87610
87620
|
return familyName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
87611
87621
|
}
|
|
87622
|
+
var ephemeralFontCacheRoot;
|
|
87612
87623
|
function fontCacheDir(slug) {
|
|
87613
87624
|
const dir = join25(resolveFontCacheRoot(), slug);
|
|
87614
87625
|
if (!existsSync22(dir)) {
|
|
87615
|
-
|
|
87626
|
+
try {
|
|
87627
|
+
mkdirSync11(dir, { recursive: true });
|
|
87628
|
+
} catch {
|
|
87629
|
+
const firstFallback = ephemeralFontCacheRoot === void 0;
|
|
87630
|
+
ephemeralFontCacheRoot ??= mkdtempSync5(join25(tmpdir5(), "hyperframes-fonts-"));
|
|
87631
|
+
const fallback = join25(ephemeralFontCacheRoot, slug);
|
|
87632
|
+
mkdirSync11(fallback, { recursive: true });
|
|
87633
|
+
if (firstFallback) {
|
|
87634
|
+
defaultLogger.warn(
|
|
87635
|
+
`Font cache directory is unwritable (${dir}). Using temporary fallback \u2014 fonts will re-download each run. Fix with: chmod 755 ${resolveFontCacheRoot()}`
|
|
87636
|
+
);
|
|
87637
|
+
}
|
|
87638
|
+
return fallback;
|
|
87639
|
+
}
|
|
87616
87640
|
}
|
|
87617
87641
|
return dir;
|
|
87618
87642
|
}
|
|
@@ -97898,8 +97922,8 @@ async function runFontLocalize(io, localize) {
|
|
|
97898
97922
|
}
|
|
97899
97923
|
|
|
97900
97924
|
// src/version.ts
|
|
97901
|
-
var VERSION = true ? "0.8.
|
|
97902
|
-
var PRODUCER_VERSION = true ? "0.8.
|
|
97925
|
+
var VERSION = true ? "0.8.27" : "0.0.0-dev";
|
|
97926
|
+
var PRODUCER_VERSION = true ? "0.8.27" : "0.0.0-dev";
|
|
97903
97927
|
|
|
97904
97928
|
// src/fontLocalizeCli.ts
|
|
97905
97929
|
async function readStdin() {
|
|
@@ -37,7 +37,7 @@ https://www.w3ctech.com/topic/2226`));let l=n(...a);return l.postcssPlugin=t,l.p
|
|
|
37
37
|
100% { outline-color: transparent; }
|
|
38
38
|
}
|
|
39
39
|
`,document.head.appendChild(n)}for(let n of e)try{document.querySelectorAll(n).forEach(i=>{i.classList.add("__hf-flash"),setTimeout(()=>i.classList.remove("__hf-flash"),t)})}catch(r){L("bridge.flashElements.querySelector",r)}}var Qi=null;function Ws(e){Qi=e}function Ne(e,t){if(Qi)try{Qi({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch(n){L("runtime.analytics.site1",n)}}function lp(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-"),n=0,r=t.length;for(;n<r&&t[n]==="-";)n++;for(;r>n&&t[r-1]==="-";)r--;let i=t.slice(n,r);return i.length>0?i:"node"}function Pt(e){return`--${lp(e)}`}function Vs(e){let t=new Map;for(let n of e){let r=Pt(n),i=t.get(r);i?i.includes(n)||i.push(n):t.set(r,[n])}return[...t.values()].filter(n=>n.length>1)}function qs(){if(typeof document>"u")return{};let e=new Set;document.documentElement?.hasAttribute("data-composition-variables")&&e.add(document.documentElement);for(let i of Array.from(document.querySelectorAll("[data-composition-variables]")))e.add(i);let t={};for(let i of e)Object.assign(t,bn(i));let n=Rr(),r={...t,...n};for(let i of e)eo(i,r);return r}var zs=new Set;function $s(e){let t=e?.getAttribute("data-composition-variables");if(!t)return[];let n;try{n=JSON.parse(t)}catch{return[]}return Array.isArray(n)?n.filter(r=>!!r&&typeof r=="object"):[]}function up(e,t){return t?.trim()||e.getAttribute("data-composition-id")?.trim()||e.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")?.trim()||"composition"}function cp(e){return Array.isArray(e.options)?e.options.map(t=>t&&typeof t=="object"?t.value:t).filter(t=>typeof t=="string"||typeof t=="number"):[]}function dp(e,t){if(typeof e.id!="string")return null;let n=t[e.id];if(n==null||"default"in e&&String(n)===String(e.default))return null;let r=cp(e);return r.length===0||r.some(i=>String(i)===String(n))?null:{id:e.id,value:n,allowed:r}}function eo(e,t,n){if(!e)return;let r=$s(e);if(r.length===0)return;let i=up(e,n);for(let o of r){let a=dp(o,t);if(!a)continue;let l=`${i}|${a.id}|${String(a.value)}`;if(zs.has(l))continue;zs.add(l);let s="default"in o?JSON.stringify(o.default):"the composition default";console.warn(`[hyperframes] runtime_unknown_enum_value: ${i} variable "${a.id}" got ${JSON.stringify(a.value)}, which is not a declared option (${a.allowed.join(", ")}). Rendering ${s} instead.`)}}function bn(e){let t={};for(let n of $s(e))typeof n.id!="string"||!("default"in n)||(t[n.id]=n.default);return t}var Zi="data-hf-css-vars";function Tr(e){return"style"in e&&typeof e.style?.setProperty=="function"}function to(e,t){if(!Tr(e))return;let n=[];for(let[r,i]of Object.entries(t))if(typeof i=="string"&&i!==""||typeof i=="number"){let o=Pt(r);e.style.setProperty(o,String(i)),n.push(o)}n.length>0&&e.setAttribute(Zi,n.join(" "))}function js(e,t,n){let r={};for(let[i,o]of Object.entries(t)){let a=Pt(i);((Tr(e)?e.style.getPropertyValue(a):"")||(n?n.getComputedStyle(e).getPropertyValue(a):"")).trim()===""&&(r[i]=o)}return r}function Ks(e){if(!Tr(e))return;let t=e.getAttribute(Zi);if(t){for(let n of t.split(" "))n.startsWith("--")&&e.style.removeProperty(n);e.removeAttribute(Zi)}}function Ys(e){let t=new Set;e.documentElement?.hasAttribute("data-composition-variables")&&t.add(e.documentElement);for(let i of Array.from(e.querySelectorAll("[data-composition-variables]")))t.add(i);let n=Rr(),r=[];for(let i of t)r.push(...fp(i,n,e.defaultView));for(let i of Vs(r))console.warn(`composition variables ${i.join(", ")} collapse to the same CSS property ${Pt(i[0]??"")} \u2014 rename one to avoid cross-talk`)}function fp(e,t,n){if(!Tr(e))return[];let r=bn(e),i={};for(let[o,a]of Object.entries(r)){if(o in t)continue;let l=Pt(o);(e.style.getPropertyValue(l)||(n?n.getComputedStyle(e).getPropertyValue(l):"")).trim()===""&&(i[o]=a)}for(let[o,a]of Object.entries(t))o in r&&(i[o]=a);return to(e,i),Object.keys(r)}function Xs(e){let t=e.getAttribute("data-variable-values");if(!t)return{};let n;try{n=JSON.parse(t)}catch{return{}}return!n||typeof n!="object"||Array.isArray(n)?{}:n}function Rr(){if(typeof window>"u")return{};let e=window.__hfVariables;return!e||typeof e!="object"||Array.isArray(e)?{}:e}function Js(e){let t=[],n=u=>{if(typeof u.getAnimations!="function")return[];try{return u.getAnimations()}catch{return[]}},r=u=>e?.resolveStartSeconds?e.resolveStartSeconds(u):Number.parseFloat(u.getAttribute("data-start")??"0")||0,i=(u,c)=>{let f=null;try{f=u.effect?.getComputedTiming?.()??null}catch(p){L("runtime.adapters.css.site5",p)}if(!f)return{};let m=Number(f.endTime);return Number.isFinite(m)?{endSeconds:c+m/1e3}:{unbounded:!0}},o=(u,c)=>{for(let f of u){try{f.currentTime=c}catch(m){L("runtime.adapters.css.site1",m)}try{f.pause()}catch(m){L("runtime.adapters.css.site2",m)}}},a=u=>{for(let c of u)try{c.play()}catch(f){L("runtime.adapters.css.site3",f)}},l=u=>{for(let c of u)try{c.pause()}catch(f){L("runtime.adapters.css.site4",f)}},s=u=>{u.baseDelay?u.el.style.animationDelay=u.baseDelay:u.el.style.removeProperty("animation-delay"),u.basePlayState?u.el.style.animationPlayState=u.basePlayState:u.el.style.removeProperty("animation-play-state")};return{name:"css",discover:()=>{t=[];let u=document.querySelectorAll("*");for(let c of u){if(!(c instanceof HTMLElement))continue;let f=window.getComputedStyle(c);!f.animationName||f.animationName==="none"||t.push({el:c,baseDelay:c.style.animationDelay||"",basePlayState:c.style.animationPlayState||"",animations:n(c)})}},getInferredDurationSeconds:()=>{let u=0;for(let c of t){if(!c.el.isConnected)continue;let f=r(c.el);for(let m of n(c.el)){let p=i(m,f);p.endSeconds!=null&&(u=Math.max(u,p.endSeconds))}}return u>0?u:null},seek:u=>{let c=Number(u.time)||0;for(let f of t){if(!f.el.isConnected)continue;let m=r(f.el),p=Math.max(0,c-m)*1e3,b=f.animations;if(b.length>0){o(b,p);continue}f.el.style.animationPlayState="paused",f.el.style.animationDelay=`-${(p/1e3).toFixed(3)}s`}},pause:()=>{for(let u of t){if(!u.el.isConnected)continue;let c=u.animations;c.length>0&&l(c),s(u)}},play:()=>{for(let u of t)u.el.isConnected&&(s(u),a(u.animations))},revert:()=>{t=[]}}}function Qs(e){return{name:"gsap",discover:()=>{},seek:t=>{let n=e.getTimeline();if(!n)return;n.pause();let r=Math.max(0,Number(t.time)||0),i=t.suppressEvents===!0;typeof n.totalTime=="function"?(n.totalTime(r+.001,!0),n.totalTime(r,i)):n.seek(r,i)},pause:()=>{let t=e.getTimeline();t&&t.pause()}}}function Zs(){return{name:"animejs",discover:()=>{try{let e=window.anime;if(!e||typeof e.running>"u")return;let t=e.running;if(!Array.isArray(t)||t.length===0)return;let n=window.__hfAnime??[],r=new Set(n);for(let i of t)r.has(i)||n.push(i);window.__hfAnime=n}catch(e){L("runtime.adapters.animejs.site1",e)}},seek:e=>{let t=Math.max(0,(Number(e.time)||0)*1e3),n=window.__hfAnime;if(!(!n||n.length===0))for(let r of n)try{typeof r.seek=="function"&&r.seek(t)}catch(i){L("runtime.adapters.animejs.site2",i)}},pause:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.pause=="function"&&t.pause()}catch(n){L("runtime.adapters.animejs.site3",n)}},play:()=>{let e=window.__hfAnime;if(!(!e||e.length===0))for(let t of e)try{typeof t.play=="function"&&t.play()}catch(n){L("runtime.adapters.animejs.site4",n)}},revert:()=>{}}}function tl(){return{name:"lottie",discover:()=>{try{let e=window.lottie;if(e&&typeof e.getRegisteredAnimations=="function"){let t=e.getRegisteredAnimations();if(Array.isArray(t)&&t.length>0){let n=window.__hfLottie??[],r=new Set(n);for(let i of t)r.has(i)||n.push(i);window.__hfLottie=n}}}catch(e){L("runtime.adapters.lottie.site1",e)}},seek:e=>{let t=Math.max(0,Number(e.time)||0),n=window.__hfLottie;if(!(!n||n.length===0))for(let r of n)try{if(no(r))r.goToAndStop(t*1e3,!1);else if(ro(r)){if(typeof r.setCurrentRawFrameValue=="function"){let i=r.totalFrames??0,o=r.frameRate??30,a=t*o;i>0&&r.setCurrentRawFrameValue(Math.min(a,i-1))}else if(typeof r.seek=="function"){let i=r.duration??1,o=Math.min(100,t/i*100);r.seek(o)}}}catch(i){L("runtime.adapters.lottie.site2",i)}},pause:()=>{let e=window.__hfLottie;if(!(!e||e.length===0))for(let t of e)try{(no(t)||ro(t))&&t.pause()}catch(n){L("runtime.adapters.lottie.site3",n)}},revert:()=>{},getInferredDurationSeconds:()=>{let e=window.__hfLottie;if(!e||e.length===0)return null;let t=0,n=!1;for(let r of e){let i=null;try{i=mp(r)}catch(o){L("runtime.adapters.lottie.site4",o)}i!=null&&(n=!0,t=Math.max(t,i))}return n?t:null}}}function el(e,t){return!Number.isFinite(e)||!e||e<=0||!Number.isFinite(t)||!t||t<=0?null:e/t}function mp(e){return no(e)?el(e.totalFrames,e.frameRate):ro(e)?Number.isFinite(e.duration)&&(e.duration??0)>0?e.duration??null:el(e.totalFrames,e.frameRate):null}function no(e){return typeof e=="object"&&e!==null&&typeof e.goToAndStop=="function"}function ro(e){return typeof e=="object"&&e!==null&&typeof e.pause=="function"&&("totalFrames"in e||"duration"in e)}var io=-1,kr=new Set,Ot,oo=0;function nl(e){let t=[],n=!0,r={time:e,waitUntil:o=>{if(!n)throw new Error("hf-seek waitUntil() must be called synchronously from the event listener");t.push(o)}};try{window.dispatchEvent(new CustomEvent("hf-seek",{detail:r}))}catch(o){L("runtime.adapters.seek-dispatch.site1",o)}finally{n=!1}if(t.length===0)return;let i=Promise.all(t).then(()=>({status:"fulfilled"})).catch(o=>({status:"rejected",reason:o}));kr.add(i),i.then(o=>{kr.delete(i)&&o.status==="rejected"&&Ot===void 0&&(Ot={reason:o.reason})})}function Mr(e){e!==io&&(io=e,nl(e))}function Fr(e){io=e,nl(e)}function rl(){return oo>0}async function ao(){oo+=1;let e=Ot;try{for(await Promise.resolve();kr.size>0;){let r=(await Promise.all([...kr])).find(i=>i.status==="rejected");e===void 0&&r?.status==="rejected"&&(e={reason:r.reason})}let t=Ot;if(e===void 0&&(e=t),Ot===t&&(Ot=void 0),e)throw e.reason}finally{oo-=1}}function il(){let e=null,t=0,n=null,r=null,i=null,o=null,a=()=>{if(typeof window>"u")return null;let c=window.THREE?.DefaultLoadingManager;return!c||typeof c!="object"||typeof c.itemsLoaded!="number"||typeof c.itemsTotal!="number"?null:c},l=u=>{o||u.itemsTotal<=u.itemsLoaded||(o=new Promise(c=>{u.onLoad=function(){try{i?.call(this)}finally{o=null,u.onLoad=i??null,c()}}}))},s=u=>{n!==u&&(n=u,r=u.onStart??null,i=u.onLoad??null,u.onStart=function(c,f,m){try{r?.call(this,c,f,m)}finally{l(u)}})};return{name:"three",discover:()=>{let u=a();u&&(s(u),l(u))},seek:u=>{e=Math.max(0,Number(u.time)||0),t=e,window.__hfThreeTime=e,Mr(e)},pause:()=>{e==null&&(e=Math.max(0,t))},play:()=>{e=null},revert:()=>{e=null,t=0},getReadyPromise:()=>{let u=a();return!u||u.itemsTotal<=u.itemsLoaded?null:(o||l(u),o)}}}function qe(e){let t=null,n=new WeakSet;return{name:e.name,discover:()=>{},seek:()=>{},pause:()=>{},play:()=>{},revert:()=>{},getReadyPromise:()=>{let r=e.getInstances();if(r.length===0)return null;let i=r.filter(o=>!n.has(o));return i.length===0?null:t||(t=Promise.allSettled(i.map(o=>e.waitFor(o).then(()=>{n.add(o)}))).then(()=>{t=null}),t)}}}function ol(){return qe({name:"mapbox",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfMapbox;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{if(e.loaded()){t();return}e.on("load",t)})})}function al(){return qe({name:"leaflet",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfLeaflet;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>e.whenReady(t))})}function sl(){return qe({name:"google-maps",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfGoogleMaps;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{let n=e.addListener("tilesloaded",()=>{n.remove(),t()})})})}function ll(){return qe({name:"maplibre",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfMaplibre;return Array.isArray(e)?e:[]},waitFor:e=>new Promise(t=>{if(e.loaded()){t();return}e.on("load",t)})})}function ul(){return qe({name:"d3",getInstances:()=>{if(typeof window>"u")return[];let e=window.__hfD3;return Array.isArray(e)?e:[]},waitFor:e=>e.end()})}var pp=250;function cl(){let e=null,t=0,n=null,r=()=>{n!==null&&(window.clearInterval(n),n=null)},i=()=>{n===null&&document.querySelector("[data-composition-id][data-requires-webgpu]")&&(n=window.setInterval(()=>{e!==null&&(rl()||(window.__hfTypegpuTime=e,Fr(e)))},pp))};return{name:"typegpu",discover:()=>{},seek:o=>{e=Math.max(0,Number(o.time)||0),t=e,window.__hfTypegpuTime=e,Mr(e)},pause:()=>{e==null&&(e=Math.max(0,t)),i()},play:()=>{r(),e=null},revert:()=>{r(),e=null,t=0}}}var xn="data-hf-render-id",dl="data-hf-group-render-id";function hp(e){return e.getAttribute(xn)||e.id||null}var gp="__render_frame_",bp="__";function xp(e){return`${gp}${e}${bp}`}function yp(e){let t=hp(e);return t?xp(t):null}function ut(e){let t=yp(e);if(!t)return null;let n=document.getElementById(t);return n instanceof HTMLImageElement?n:null}function fl(e){let t=e.nextElementSibling;if(t instanceof HTMLImageElement&&t.classList.contains("__render_frame__")&&t.complete&&t.naturalWidth>0)return t;let n=ut(e);return n&&n.complete&&n.naturalWidth>0?n:null}function ml(){let e=globalThis.GPUQueue;if(!e?.prototype?.copyExternalImageToTexture)return;let t=e.prototype.copyExternalImageToTexture;e.prototype.copyExternalImageToTexture=function(n,r,i){if(n?.source instanceof HTMLVideoElement){let o=fl(n.source);if(o)return t.call(this,{...n,source:o},r,i)}return t.call(this,n,r,i)}}function pl(){let e=[globalThis.WebGL2RenderingContext,globalThis.WebGLRenderingContext],t=["texImage2D","texSubImage2D"];for(let n of e){let r=n?.prototype;if(r)for(let i of t){let o=r[i];if(typeof o!="function"||o.__hfVideoPatched)continue;let a=function(...l){let s=l.length-1,u=l[s];if(u instanceof HTMLVideoElement){let c=fl(u);c&&(l[s]=c)}return o.apply(this,l)};a.__hfVideoPatched=!0,r[i]=a}}}function hl(){let e=!1,t=0,n=!1,r,i,o,a=new Set,l=new WeakMap,s=()=>{if(!document.getAnimations)return[];try{return document.getAnimations()}catch{return[]}},u=x=>{let _=Number(x.currentTime);return Number.isFinite(_)&&_>0?_:0},c=(x,_)=>_<=0?x:x>=_?Math.max(0,x-_):x,f=(x,_)=>{let R=l.get(x);if(R)return R;let T={compositionTimeMs:_,animationTimeMs:e?c(u(x),_):u(x)};return l.set(x,T),T},m=(x,_)=>{if(!a.has(x)){a.add(x);let R=()=>{a.delete(x)};try{x.addEventListener("finish",R,{once:!0}),x.addEventListener("cancel",R,{once:!0})}catch(T){L("runtime.adapters.waapi.site4",T)}}f(x,_)},p=(x,_)=>{for(let R of x)m(R,_)},b=()=>{if(n||typeof Element>"u")return;let x=Element.prototype;if(typeof x.animate!="function"||x.__hfOriginalAnimate)return;let _=x.animate;try{Object.defineProperty(x,"__hfOriginalAnimate",{value:_,configurable:!0});let R=function(...T){let M=_.apply(this,T);return m(M,t),M};x.animate=R,r=x,i=_,o=R,n=!0}catch{}},v=x=>{let _=null;try{_=x.effect?.getComputedTiming?.()??null}catch(M){L("runtime.adapters.waapi.site4",M)}if(!_)return{};let R=Number(_.endTime);return Number.isFinite(R)?{endSeconds:(l.get(x)?.compositionTimeMs??0)/1e3+R/1e3}:{unbounded:!0}};return{name:"waapi",discover:()=>{e=!0,b(),p(s(),t)},seek:x=>{let _=Math.max(0,(Number(x.time)||0)*1e3);t=_,(!e||a.size>0)&&p(s(),e?_:0);for(let R of a){let T=e?f(R,_):f(R,0),M=T.animationTimeMs+Math.max(0,_-T.compositionTimeMs);try{R.currentTime=M}catch(D){L("runtime.adapters.waapi.site1",D)}try{R.pause()}catch(D){L("runtime.adapters.waapi.site2",D)}}},pause:()=>{e||p(s(),t);for(let x of a)try{x.pause()}catch(_){L("runtime.adapters.waapi.site3",_)}},revert:()=>{if(a.clear(),l=new WeakMap,e=!1,t=0,r&&i&&o&&r.animate===o)try{r.animate=i,r.__hfOriginalAnimate===i&&delete r.__hfOriginalAnimate}catch(x){L("runtime.adapters.waapi.site5",x)}r=void 0,i=void 0,o=void 0,n=!1},getInferredDurationSeconds:()=>{let x=0;for(let _ of s()){let R=v(_);R.endSeconds!=null&&(x=Math.max(x,R.endSeconds))}return x>0?x:null}}}var so=3.981071705534972;function Le(e){return Number.isFinite(e)?Math.max(0,Math.min(so,e)):1}function Nr(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function gl(e,t){let n=typeof HTMLMediaElement>"u"?void 0:Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,"volume"),r=n?.get,i=n?.set;if(!r||!i)return t();let o=Number(r.call(e));Object.defineProperty(e,"volume",{configurable:!0,get:()=>o,set:a=>{o=Number(a),i.call(e,Nr(o))}});try{return t()}finally{delete e.volume,i.call(e,Nr(o))}}var Ht=Object.freeze({start:"data-start",duration:"data-duration",trackIndex:"data-track-index",derivedEnd:"data-end",legacyTrack:"data-layer"}),yv=Object.freeze([Ht.start,Ht.duration,Ht.trackIndex]),vv=Object.freeze([Ht.derivedEnd]),Sv=Object.freeze([Ht.derivedEnd,Ht.legacyTrack]);function Gt(e){if(e==null||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}var xl=/^[A-Za-z0-9_.:-]+$/;function yl(e,t){let n=e.charCodeAt(t);return n>=48&&n<=57}function bl(e,t){let n=t;for(;n>=0&&yl(e,n);)n--;return n}function vp(e,t){let n=t;for(;n>=0&&(e[n]??"").trim()==="";)n--;return n}function Sp(e){let t=e.length-1;if(!yl(e,t))return null;let n=bl(e,t);return e[n]==="."&&(n=bl(e,n-1)),n+1}function Ap(e){let t=Sp(e);if(t==null)return null;let n=vp(e,t-1),r=e[n];if(r!=="+"&&r!=="-")return null;let i=e.slice(0,n).trim();if(!xl.test(i))return null;let o=Number(e.slice(t));return Number.isFinite(o)?{refId:i,operator:r,magnitude:o}:null}function lo(e){let t=(e??"").trim();if(!t)return null;let n=Gt(t);if(n!=null)return{kind:"absolute",value:n};if(xl.test(t))return{kind:"reference",refId:t,offset:0};let r=Ap(t);return r?{kind:"reference",refId:r.refId,offset:r.operator==="-"?-r.magnitude:r.magnitude}:null}function vl(e){return Number.isFinite(e)&&e>0?Math.max(.1,Math.min(5,e)):1}function ve(e){return Gt(e)}function _e(e){let t=Number.parseFloat(e.getAttribute("data-playback-rate")??""),n=Number.isFinite(t)&&t>0?t:typeof HTMLMediaElement<"u"&&e instanceof HTMLMediaElement?e.defaultPlaybackRate:1;return vl(n)}function yn(e){let t=n=>{let r=ve(n);return r==null?null:Number.isFinite(r)&&r>=0?r:null};return t(e.getAttribute("data-playback-start"))??t(e.getAttribute("data-media-start"))??0}function Qe(e,t){return Ep(t,yn(e),_e(e))}function Ep(e,t,n){return Number.isFinite(e)?Math.max(0,e-t)/vl(n):null}function wp(e,t,n){let r=e.filter(o=>Number.isFinite(o.time)&&Number.isFinite(o.volume)).map(o=>({time:Math.max(0,o.time-t),volume:Le(o.volume)})).sort((o,a)=>o.time-a.time),i=[];for(let o of r){let a=i.at(-1);a&&Math.abs(a.time-o.time)<1e-9?a.volume=o.volume:i.push(o)}return i.length===0||i[0].time>0&&i.unshift({time:0,volume:Le(n)}),i}function Sl(e,t){if(e.length===0)return 1;let n=0;for(;n<e.length-2&&t>=e[n+1].time;)n+=1;let r=e[n],i=e[n+1]??r,o=i.time-r.time,a=o<=0?0:Math.min(1,Math.max(0,(t-r.time)/o));return r.volume+(i.volume-r.volume)*a}function Cp(e,t,n,r){let i=e.at(-1);!i||Math.abs(i.volume-n.volume)>1e-4?(i&&t&&t.time>i.time&&e.push(t),e.push(n)):r&&n.time>i.time&&e.push(n)}function _p(e){let t=Number.parseFloat(e??"");return Number.isFinite(t)?t:void 0}function Al(e,t){let n=ve(e.dataset.start)??0,r=ve(e.dataset.end)??void 0,i=ve(e.dataset.duration)??void 0,o=t;i!==void 0&&i>0?o=n+i:r!==void 0&&r>n&&(o=r);let a=_p(e.dataset.volume)??1;return{start:n,end:o,staticVolume:Le(a)}}function Tp(e,t,n,r){let{start:i,end:o,staticVolume:a}=Al(e,n),l=1/Math.min(60,Math.max(1,r)),s=Math.max(0,i),u=Math.min(n,o),c=gl(e,()=>{e.volume=a;let m=[],p;for(let b=s;b<=u+1e-6;b=Math.min(u,b+l)){t(b);let v=Number(e.volume);if(Number.isFinite(v)){let x={time:Number(b.toFixed(6)),volume:Number(Le(v).toFixed(6))};Cp(m,p,x,b===u),p=x}if(b===u)break}return m});return c.some(m=>Math.abs(m.volume-a)>1e-4)?c:null}function El(e,t,n,r,i={}){if(i.allowLiveTimelineSeek===!1||!t||!(e instanceof HTMLAudioElement)&&!(e instanceof HTMLVideoElement)||n<=0)return;let o=s=>{try{typeof t.totalTime=="function"?t.totalTime(s,!0):typeof t.seek=="function"&&t.seek(s,!0)}catch{}},a=typeof t.totalTime=="function"?Number(t.totalTime()):typeof t.seek=="function"?Number(t.seek()):0,l=Tp(e,o,n,60);if(Number.isFinite(a)&&o(a),l){let{start:s,staticVolume:u}=Al(e,n),c=wp(l,s,u);c.length>0&&r.set(e,c)}}var Tt="data-fx-chain",Fv=Tt.slice(5),wl=1,vn=(e="frequency",t="Frequency",n=1e3,r=20,i=2e4)=>({kind:"number",key:e,label:t,unit:"Hz",min:r,max:i,step:1,default:n,scale:"log",automatable:!0}),uo=(e=.707,t="Bandwidth \u2014 higher is narrower.")=>({kind:"number",key:"q",label:"Q",unit:"",min:.1,max:20,step:.01,default:e,scale:"log",automatable:!0,hint:t}),Lr=(e=-40,t=40,n=0)=>({kind:"number",key:"gain",label:"Gain",unit:"dB",min:e,max:t,step:.1,default:n,automatable:!0}),Cl={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."},Tl=[{id:"gain",label:"Gain",group:"dynamics",description:"Raise or lower the whole signal. Automate it to duck under something else.",params:[Lr(-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:[vn("frequency","Frequency",1e3),Lr(-40,40,0),uo(1)],web:"biquad-peaking"},{id:"lowshelf",label:"Low Shelf",group:"filter",description:"Lift or drop everything below the corner frequency.",params:[vn("frequency","Frequency",200,20,2e3),Lr(-40,40,0)],web:"biquad-lowshelf"},{id:"highshelf",label:"High Shelf",group:"filter",description:"Lift or drop everything above the corner frequency.",params:[vn("frequency","Frequency",4e3,500,2e4),Lr(-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:[vn("frequency","Cutoff",300,20,2e4),uo(.707),Cl],web:"biquad-highpass"},{id:"lowpass",label:"Low-pass",group:"filter",description:"Remove high frequencies \u2014 darkens or muffles a track.",params:[vn("frequency","Cutoff",8e3,100,2e4),uo(.707),Cl],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"}],co=new Map(Tl.map(e=>[e.id,e]));function Sn(e){return co.get(e)}var Nv=Tl.map(e=>e.id);function An(e,t){let n=co.get(e);if(!n)return{};let r={};for(let i of n.params){let o=t?.[i.key];if(i.kind==="enum"){let l=i.options.some(s=>s.value===o);r[i.key]=l?o:i.default;continue}let a=typeof o=="number"?o:typeof o=="string"&&o.trim()!==""?Number(o):Number.NaN;r[i.key]=Number.isFinite(a)?Math.min(i.max,Math.max(i.min,a)):i.default}return r}var ct=class extends Error{constructor(t){super(t),this.name="AudioFxChainError"}};function Rl(e){let t;try{t=JSON.parse(e)}catch(i){throw new ct(`Chain file is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new ct("Chain file must be a JSON object.");let n=t;if(n.version!==wl)throw new ct(`Unsupported chain version: ${String(n.version)}`);if(!Array.isArray(n.nodes))throw new ct("Chain file is missing a `nodes` array.");let r=n.nodes.map(Rp);return{version:wl,nodes:r}}function En(e){return e.nodes.filter(t=>t.enabled!==!1)}function Rp(e,t){if(typeof e!="object"||e===null)throw new ct(`Node ${t} is not an object.`);let n=e;if(typeof n.type!="string"||!co.has(n.type))throw new ct(`Node ${t} has unknown effect type: ${String(n.type)}`);return Mp({type:n.type,id:Dr(n.id),fromCarve:_l(n.fromCarve),fromPreset:Dr(n.fromPreset),label:Dr(n.label),fromEq:Dr(n.fromEq),fromLeveller:_l(n.fromLeveller),presetAmount:kp(n.presetAmount),enabled:n.enabled!==!1,params:An(n.type,n.params??void 0)})}function Dr(e){return typeof e=="string"&&e?e:void 0}function _l(e){return e===!0?!0:void 0}function kp(e){if(!(typeof e!="number"||!Number.isFinite(e)))return Math.min(1,Math.max(0,e))}function Mp(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}var et="data-automation",Pv=et.slice(5),Ir=1,Fp=512,Ze=class extends Error{constructor(t){super(t),this.name="AudioAutomationError"}},Bt="volume";function Cn(e){if(e===Bt)return{kind:"volume"};let t=e.split(".");if(t.length===3&&t[0]==="fx"&&t[1]===Np){let i=t[2];return i?{kind:"preset",presetId:i}:null}if(t.length!==3||t[0]!=="fx")return null;let[,n,r]=t;return!n||!r?null:{kind:"fx",nodeId:n,param:r}}var Np="preset";var Lp={min:0,max:1,step:.01,unit:"",label:"Amount",scale:"linear",default:1},Pr={min:0,max:so,step:.01,unit:"",label:"Volume",scale:"linear",default:1};function fo(e,t){let n=Cn(e);if(!n)return null;if(n.kind==="volume")return Pr;if(n.kind==="preset")return t?.nodes.some(l=>l.fromPreset===n.presetId)?{...Lp,label:`${n.presetId} \xB7 Amount`}:null;let r=t?.nodes.find(a=>a.id===n.nodeId);if(!r)return null;let i=Sn(r.type),o=i?.params.find(a=>a.key===n.param);return!o||o.kind!=="number"?null:{min:o.min,max:o.max,step:o.step,unit:o.unit,label:`${i?.label??r.type} \xB7 ${o.label}`,scale:o.scale==="log"&&o.min>0?"log":"linear",default:o.default}}function wn(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null}function Dp(e){let t=wn(e);return t===null||t===0?0:Math.min(1,Math.max(-1,t))}function kl(e,t){let n=wn(e),r=wn(t);if(n===null||r===null)return null;let i=l=>Math.min(.999,Math.max(.001,l)),o=i(n),a=i(r);return Math.abs(o-a)<1e-6?null:{x:o,y:a}}function Ip(e){let t=Dp(e?.curve),n=kl(e?.viaX,e?.viaY);return{...t?{curve:t}:{},...n?{viaX:n.x,viaY:n.y}:{}}}function Pp(e,t){let n=wn(e?.t),r=wn(e?.v);if(n===null||r===null)return null;let i=t?Math.min(t.max,Math.max(t.min,r)):r;return{t:Math.max(0,n),v:i,...Ip(e)}}function Ml(e,t){let n=e.map(i=>Pp(i,t)).filter(i=>i!==null).sort((i,o)=>i.t-o.t),r=[];for(let i of n)r.length>0&&r[r.length-1].t===i.t?r[r.length-1]=i:r.push(i);return r.slice(0,Fp)}function Op(e){let t=[];for(let n of e.lanes){if(!Cn(n.target))continue;let r=n.target===Bt?Pr:null,i=Ml(n.points??[],r);i.length>0&&t.push({target:n.target,points:i})}return{version:Ir,lanes:t}}function Fl(e,t){let n=[];for(let r of e.lanes){let i=fo(r.target,t);if(!i)continue;let o=Ml(r.points,i);o.length>0&&n.push({target:r.target,points:o})}return{version:Ir,lanes:n}}function Or(e){let t;try{t=JSON.parse(e)}catch(i){throw new Ze(`Automation is not valid JSON: ${i.message}`)}if(typeof t!="object"||t===null)throw new Ze("Automation must be a JSON object.");let n=t;if(n.version!==Ir)throw new Ze(`Unsupported automation version: ${String(n.version)}`);if(!Array.isArray(n.lanes))throw new Ze("Automation is missing a `lanes` array.");let r=n.lanes.map((i,o)=>{if(typeof i!="object"||i===null)throw new Ze(`Lane ${o} is not an object.`);let a=i;if(typeof a.target!="string"||!Cn(a.target))throw new Ze(`Lane ${o} has an unreadable target: ${String(a.target)}`);if(!Array.isArray(a.points))throw new Ze(`Lane ${o} is missing a \`points\` array.`);return{target:a.target,points:a.points}});return Op({version:Ir,lanes:r})}function Hp(e,t){return t?Math.pow(e,Math.pow(2,2*t)):e}function Gp(e,t){let n=e-.5,r=t-.5,i=.999,o=1e6,a=n>0?n/(i-e):n<0?-n/(e-(1-i)):0,l=r>0?r/(i-t):r<0?-r/(t-(1-i)):0,s=Math.min(o,Math.max(1,a,l));return{cx:e+n/s,cy:t+r/s,w:s}}function Bp(e,t,n){let{cx:r,cy:i,w:o}=Gp(t,n),a=2-2*o,l=e*a-1+2*o*r,s=-e*a-2*o*r,u=Up(l,s,e),c=1-u,f=c*c+2*o*u*c+u*u;return f>0?(2*o*i*u*c+u*u)/f:e}function Up(e,t,n){if(Math.abs(e)<1e-12)return Math.abs(t)<1e-12?n:-n/t;let r=Math.sqrt(Math.max(0,t*t-4*e*n)),i=(-t+r)/(2*e),o=(-t-r)/(2*e),a=l=>l>=-1e-9&&l<=1+1e-9;return a(i)?Math.min(1,Math.max(0,i)):a(o)?Math.min(1,Math.max(0,o)):n}function Wp(e,t){let n=kl(t.viaX,t.viaY);return n?Bp(Math.min(1,Math.max(0,e)),n.x,n.y):Hp(e,t.curve)}function Vp(e,t,n,r){return r==="log"&&e>0&&t>0?Math.exp(Math.log(e)+(Math.log(t)-Math.log(e))*n):e+(t-e)*n}function _n(e,t,n="linear"){let r=e.points;if(r.length===0)return 0;let i=r[0];if(t<=i.t)return i.v;let o=r[r.length-1];if(t>=o.t)return o.v;let a=0,l=r.length-1;for(;l-a>1;){let f=a+l>>1;r[f].t<=t?a=f:l=f}let s=r[a],u=r[l],c=u.t-s.t;return c<=0?u.v:Vp(s.v,u.v,Wp((t-s.t)/c,s),n)}function Nl(e){return e.points.length<=1||e.points.every(t=>t.v===e.points[0].v)}function Ll(e,t,n,r,i="linear"){let o=Math.max(2,Math.floor(r)),a=new Float32Array(o),l=n-t;for(let s=0;s<o;s+=1)a[s]=_n(e,t+l*s/(o-1),i);return a}var Hr=new Map,zp=64;function qp(e){let t=Hr.get(e);if(t!==void 0)return t;let n=null;try{n=Or(e).lanes.find(r=>r.target===Bt)??null}catch{n=null}return Hr.size>zp&&Hr.clear(),Hr.set(e,n),n}function Dl(e,t){let n=(typeof e.getAttribute=="function"?e.getAttribute(et):null)??"";if(!n)return null;let r=qp(n);return!r||r.points.length===0?null:_n(r,t)}var Ut="hf-audio-group",Gr="data-audio-group";function mo(e){let t=e?.getAttribute("data-volume"),n=t?parseFloat(t):1;return Number.isFinite(n)?n:1}function po(e,t){let n=Array.from(e?.querySelectorAll?.(`${Ut}[${xn}]`)??[]).find(i=>i.getAttribute(xn)===t);if(n)return n;let r=e?.getElementById(t)??null;return r&&r.tagName?.toLowerCase()===Ut?r:null}function Br(e,t){let n=t?.getAttribute?.(dl)??t?.getAttribute?.(Gr);return n?po(e,n)?.hasAttribute("data-hidden")??!1:!1}function Il(e){return typeof e.tagName!="string"||e.tagName.toLowerCase()!=="audio"||typeof e.getAttribute!="function"?null:e.getAttribute(Gr)||null}function Pl(e){let t="__hf-audio-group-inert";if(!e?.head||e.getElementById(t))return;let n=e.createElement("style");n.id=t,n.textContent=`${Ut}{display:none!important}`,e.head.appendChild(n)}function $e(e){return yn(e)}function Ol(e){let t=e.isVideo?e.explicitDuration??e.sourceDuration:e.sourceDuration,n=(e.isVideo?[t,e.hostRemaining]:[t,e.hostRemaining,e.explicitDuration]).filter(r=>r!=null&&Number.isFinite(r)&&r>=0);return n.length>0?Math.min(...n):null}function Hl(e){let t=Array.from(document.querySelectorAll("video, audio")),n=e?.shouldIncludeElement?t.filter(a=>e.shouldIncludeElement?.(a)):t.filter(a=>a.hasAttribute("data-start")),r=[],i=[],o=0;for(let a of n){let l=e?.resolveStartSeconds?e.resolveStartSeconds(a):Number.parseFloat(a.dataset.start??"0");if(!Number.isFinite(l))continue;let s=$e(a),u=_e(a),c=a.loop,f=Number.isFinite(a.duration)&&a.duration>0?a.duration:null,m=e?.resolveDurationSeconds?.(a)??Number.parseFloat(a.dataset.duration??"");(!Number.isFinite(m)||m<0)&&f!=null&&(m=Math.max(0,(f-s)/u));let p=Number.isFinite(m)&&m>=0,b=p?l+m:Number.POSITIVE_INFINITY,v=Number.parseFloat(a.dataset.volume??""),x={el:a,start:l,mediaStart:s,duration:p?m:Number.POSITIVE_INFINITY,end:b,volume:Number.isFinite(v)?v:null,playbackRate:u,loop:c,sourceDuration:f};r.push(x),a.tagName==="VIDEO"&&i.push(x),Number.isFinite(b)&&(o=Math.max(o,b))}return{timedMediaEls:n,mediaClips:r,videoClips:i,maxMediaEnd:o}}var go=new WeakMap,Ur=new WeakMap,Tn=new WeakMap,bo=new WeakSet,Wt=new WeakSet;function $p(e){if(Wt.has(e))return;Wt.add(e);let t=()=>Wt.delete(e);e.addEventListener("playing",t,{once:!0}),e.addEventListener("pause",t,{once:!0}),e.addEventListener("error",t,{once:!0})}var jp=3;function Kp(e){return e.error!=null||e.networkState===jp}var xo=new WeakMap;function ho(e){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):1}function yo(e){go.delete(e),Ur.delete(e),Tn.delete(e),bo.delete(e),xo.delete(e)}function Gl(e){let t=!!(e.outputMuted||e.userMuted);for(let n of e.clips){let{el:r}=n;if(!r.isConnected)continue;let i=(e.timeSeconds-n.start)*n.playbackRate+n.mediaStart,o=r.tagName==="VIDEO"&&!n.loop,a=o&&n.sourceDuration!=null&&i>=n.sourceDuration&&e.timeSeconds>=n.start&&e.timeSeconds<n.end;a&&n.sourceDuration!=null&&(i=n.sourceDuration);let l=Ur.get(r),s=r.tagName==="AUDIO"&&(l===void 0||i<l-.04),u=!n.loop&&n.sourceDuration!=null&&i>=n.mediaStart&&i<n.sourceDuration&&(o||s);if(e.timeSeconds>=n.start&&e.timeSeconds<n.end&&i>=0&&(!r.ended||n.loop||a||u)){if(Ur.set(r,i),n.loop&&n.sourceDuration!=null&&n.sourceDuration>0){let H=n.sourceDuration-n.mediaStart;H>0&&i>=n.sourceDuration&&(i=n.mediaStart+(i-n.mediaStart)%H)}let m=ho(e.userVolume??1),p=Le(n.volume??1),b=xo.get(r),v=ho(r.volume),x,_=Dl(r,e.timeSeconds-n.start);if(_!==null)x=Le(_);else if(n.volumeKeyframes&&n.volumeKeyframes.length>0){let H=e.timeSeconds-n.start;x=Le(Sl(n.volumeKeyframes,H))}else e.isWebAudioRouted?.(r)?x=p:b===void 0?x=p>1?p:v:Math.abs(v-b)>1e-4?x=v:x=p;let T=r.closest("[data-hidden]")!==null||Br(r.ownerDocument,r)?0:ho(x*m);r.volume=T,xo.set(r,T),e.onElementVolume?.(r,T,x),(t||e.isWebAudioOwned?.(r))&&(r.muted=!0),r.preload!=="auto"&&(r.preload="auto");try{r.playbackRate=n.playbackRate*e.playbackRate}catch(H){L("runtime.media.site1",H)}let M=.04,D=2,E=r.currentTime||0,S=Math.abs(E-i),A=i-E,C=go.get(r);go.set(r,A);let F=C===void 0,I=!F&&Math.abs(A-C)>.5,q=S>3,W=r.tagName==="AUDIO"&&F&&E-i>M,Y=a&&S>.001||r.ended&&u&&S>.001||W||S>.5&&(F||I||q),k=r.tagName==="VIDEO"&&!r.paused,U=C!==void 0&&Math.abs(A-C)<.004,ie=!1;if(!k&&!Y&&!F&&U&&S>M){let H=(Tn.get(r)??0)+1;Tn.set(r,H),H>=D&&(ie=!0,Tn.set(r,0))}else S<=M&&Tn.set(r,0);let P=!k&&e.forceSync&&S>.02;if(Y||ie||P){if(!(r.tagName==="VIDEO"&&!!ut(r))){try{r.currentTime=i}catch(V){L("runtime.media.site2",V)}if(Math.abs(r.currentTime-i)>.5&&!bo.has(r)){bo.add(r),r.load();try{r.currentTime=i}catch(V){L("runtime.media.site3",V)}}}Wt.delete(r)}a?r.paused||r.pause():e.playing&&r.paused&&!Wt.has(r)&&!Kp(r)?($p(r),r.play().catch(H=>{Wt.delete(r),(H&&typeof H=="object"&&"name"in H?String(H.name??""):"")==="NotAllowedError"&&e.onAutoplayBlocked?.()})):!e.playing&&!r.paused&&r.pause();continue}let f=e.timeSeconds>=n.start&&e.timeSeconds<n.end;yo(r),f&&Ur.set(r,i),r.paused||r.pause()}}var Yp="hf-proxy",Bl="runtime_media_proxy_fallback",Ul="runtime_media_proxy_unavailable",Rn=new WeakSet,Wl=new WeakSet;function Wr(e){return e.currentSrc||e.src}function vo(e){return window.__HF_EXPORT_RENDER_SEEK_CONFIG?!0:e instanceof HTMLVideoElement&&!!ut(e)}function So(e){let t=Wr(e);if(!t)return null;let n;try{n=new URL(t,document.baseURI)}catch{return null}if(n.origin!==window.location.origin)return null;try{return decodeURIComponent(n.pathname)}catch{return n.pathname}}function Xp(e,t){let n=null;for(let r of Object.keys(t))e.endsWith(r)&&(n===null||r.length>n.length)&&(n=r);return n?t[n]??null:null}function Jp(e,t){let n=e.normalize("NFC").toLowerCase(),r=-1,i=null,o=!1;for(let[a,l]of Object.entries(t)){let s=a.normalize("NFC").toLowerCase();n.endsWith(s)&&(s.length>r?(r=s.length,i=l,o=!1):s.length===r&&(o=!0))}return o?null:i}function Ao(e,t){return t[e]??Xp(e,t)??Jp(e,t)}function Qp(e,t){let n=new URL(e,document.baseURI);return n.searchParams.set(Yp,t?t.hasAlpha?"vp8":"h264":"auto"),n.href}var Zp={cross_origin:"video reports zero decodable width but its source is cross-origin; no local proxy can be served for it",proxy_playback_failed:"the authoring proxy itself failed to decode; render output is unaffected",browser_safe_codec:"the file errored but its codec is browser-decodable; a proxy cannot help (the file itself is likely corrupt)",invalid_source_url:"the media source URL is malformed and cannot be proxied"};function Rt(e,t,n){if(Wl.has(e))return;Wl.add(e);let r=Zp[t];be({source:"hf-preview",type:"diagnostic",code:Ul,details:{asset:n,codecName:null,reason:t,note:r}}),console.info(`[hyperframes] ${Ul}: "${n}" (${t}): ${r}`)}function Eo(e,t=null,n="reactive"){if(Rn.has(e))return;let r=Wr(e),i;try{i=Qp(r,t)}catch(l){L("runtime.mediaProxy.swap",l),Rt(e,"invalid_source_url",r);return}Rn.add(e),yo(e),e.src=i,e.load();let o=t?.codecName??null;be({source:"hf-preview",type:"diagnostic",code:Bl,details:{asset:r,codecName:o,trigger:n,note:"render output is unaffected; only this preview element was swapped to an authoring proxy"}}),console.info(`[hyperframes] ${Bl}: "${r}" uses a codec (${o??"unknown"}) this browser can't decode; auto-swapped to an authoring proxy for this preview only. Render output is unaffected.`)}function Vl(e){if(vo(e)||!(e instanceof HTMLVideoElement)||Rn.has(e))return;let t=window.__HF_MEDIA_CODEC_MAP__;if(!t)return;let n=So(e);if(n===null)return;let r=Ao(n,t);if(!r||!r.browserHostile)return;let i=r.representativeMime?e.canPlayType(r.representativeMime):"";i==="probably"||i==="maybe"||Eo(e,r,"proactive")}function zl(e){if(vo(e)||!(e instanceof HTMLVideoElement)||e.videoWidth!==0)return;let t=Wr(e);if(Rn.has(e)){Rt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=So(e);if(r===null){Rt(e,"cross_origin",t);return}let i=Ao(r,n);if(i&&!i.browserHostile){Rt(e,"browser_safe_codec",t);return}Eo(e,i,"reactive")}function ql(e){if(vo(e)||!(e instanceof HTMLVideoElement))return;let t=Wr(e);if(Rn.has(e)){Rt(e,"proxy_playback_failed",t);return}let n=window.__HF_MEDIA_CODEC_MAP__;if(!n)return;let r=So(e);if(r===null){Rt(e,"cross_origin",t);return}let i=Ao(r,n);if(i&&!i.browserHostile){Rt(e,"browser_safe_codec",t);return}Eo(e,i,"tertiary")}var Se=class extends Error{constructor(n,r=null){super(r==null?n:`${n} at line ${r}`);ge(this,"lineNumber");this.name="CubeLutParseError",this.lineNumber=r}},eh=[0,0,0],th=[1,1,1],Vr=64;function nh(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];if(r==='"'&&(t=!t),r==="#"&&!t)return e.slice(0,n)}return e}function dt(e,t){let n=Number(e);if(!Number.isFinite(n))throw new Se(`Invalid number "${e}"`,t);return n}function $l(e,t,n){if(e.length!==3)throw new Se(`${t} expects three numbers`,n);return[dt(e[0],n),dt(e[1],n),dt(e[2],n)]}function jl(e,t,n){if(!e)throw new Se(`${t} expects a size`,n);let r=Number(e);if(!Number.isInteger(r)||r<2)throw new Se(`${t} must be an integer greater than 1`,n);return r}function rh(e,t){if(t[0]<=e[0]||t[1]<=e[1]||t[2]<=e[2])throw new Se("DOMAIN_MAX values must be greater than DOMAIN_MIN values")}function ih(e){let t=/^TITLE\s+"([^"]*)"\s*$/i.exec(e);if(t)return t[1]??null;let n=/^TITLE\s+(.+)\s*$/i.exec(e);return n&&(n[1]??"").trim()||null}function oh(e){return/^[+-]?(?:\d|\.\d)/.test(e)}function Kl(e,t={}){let n=t.maxSize??Vr,r=null,i=eh,o=th,a=null,l=null,s=[],u=e.replace(/^\uFEFF/,"").split(/\r?\n/);for(let f=0;f<u.length;f++){let m=f+1,p=nh(u[f]??"").trim();if(!p)continue;let b=p.split(/\s+/),v=(b[0]??"").toUpperCase(),x=b.slice(1);if(v==="TITLE"){r=ih(p);continue}if(v==="DOMAIN_MIN"){i=$l(x,v,m);continue}if(v==="DOMAIN_MAX"){o=$l(x,v,m);continue}if(v==="LUT_3D_INPUT_RANGE"){if(x.length!==2)throw new Se(`${v} expects two numbers`,m);let _=dt(x[0],m),R=dt(x[1],m);if(R<=_)throw new Se("LUT_3D_INPUT_RANGE max must exceed min",m);i=[_,_,_],o=[R,R,R];continue}if(v==="LUT_1D_SIZE"){a=jl(x[0],v,m);continue}if(v==="LUT_3D_SIZE"){if(l=jl(x[0],v,m),l>n)throw new Se(`LUT_3D_SIZE ${l} exceeds max ${n}`,m);continue}if(!oh(v)){if(v.startsWith("LUT_"))throw new Se(`Unsupported cube keyword ${v}`,m);continue}if(!l)throw a?new Se("1D cube LUTs are not supported yet",m):new Se("LUT data appears before LUT_3D_SIZE",m);if(b.length!==3)throw new Se("LUT data rows must contain three numbers",m);s.push(dt(b[0],m),dt(b[1],m),dt(b[2],m))}if(a&&l)throw new Se("Mixed 1D and 3D cube LUTs are not supported yet");if(!l)throw a?new Se("1D cube LUTs are not supported yet"):new Se("Missing LUT_3D_SIZE");rh(i,o);let c=l*l*l;if(s.length!==c*3)throw new Se(`Expected ${c} LUT rows for size ${l}, found ${s.length/3}`);return{title:r,size:l,domainMin:i,domainMax:o,data:new Float32Array(s)}}function ah(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):0}function kn(e){return Math.round(ah(e)*255)}function wo(e){let t=e.size,n=t*t,r=t,i=new Uint8Array(n*r*4);for(let o=0;o<t;o++)for(let a=0;a<t;a++)for(let l=0;l<t;l++){let s=((o*t+a)*t+l)*3,u=(a*n+o*t+l)*4;i[u]=kn(e.data[s]??0),i[u+1]=kn(e.data[s+1]??0),i[u+2]=kn(e.data[s+2]??0),i[u+3]=255}return{width:n,height:r,data:i}}var Yl="rec709";var me={hueDegrees:{min:0,max:360,inclusiveMax:!1},unit:{min:0,max:1},signedUnit:{min:-1,max:1},secondaryHueRange:{min:0,max:180},secondaryHueSoftness:{min:0,max:180},secondaryHueCombinedMax:180,secondarySoftRangeSoftness:{min:0,max:.5},secondaryHueShift:{min:-180,max:180},effects:{asciiStyle:{min:0,max:7},bloom:{min:0,max:3},bloomRadius:{min:1,max:100},monoScreenShape:{min:0,max:4}}};var Xl=["exposure","contrast","highlights","shadows","whites","blacks","temperature","tint","vibrance","saturation"],Jl=["shadows","midtones","highlights"],Ql=["master","red","green","blue"],Zl=["hueVsHue","hueVsSaturation","hueVsLuma"];var eu=["vignette","vignetteMidpoint","vignetteRoundness","vignetteFeather","grain","grainSize","grainRoughness"],tu=["blur","pixelate","chromaBleed","tapeDamage","tapeTracking","tapeNoise","tapeSpeed","filmArtifacts","halftone","halftoneSize","twoInkPrint","twoInkPrintSize","ascii","asciiSize","asciiInvert","asciiStyle","asciiColor","asciiRotation","dither","ditherSize","bloom","bloomRadius","monoScreen","monoScreenSize","monoScreenAngle","monoScreenSpread","monoScreenShape","monoScreenInvert","scanlines","scanlineCount","scanlineSoftness","chromaticAberration","chromaticAngle","crtCurvature","digitalGlitch","digitalGlitchColorSplit","digitalGlitchLineTear","digitalGlitchPixelate","digitalGlitchBlockAmount","digitalGlitchBlockDisplacement","digitalGlitchBlockOpacity","digitalGlitchSpeed","engraving","engravingSpacing","engravingMinThickness","engravingMaxThickness","engravingAngle","engravingContrast","engravingSharpness","engravingWave","engravingWaveFrequency","crosshatch","crosshatchSpacing","crosshatchThickness","crosshatchAngle","crosshatchContrast","crosshatchEdges","crosshatchLineWeight","crosshatchWave","crosshatchWaveFrequency","kuwahara","kuwaharaRadius","kuwaharaSharpness","kuwaharaSaturation"];var aS=me.unit,sS=me.signedUnit,lS=me.effects;var je=1024,Mn=16;function nu(e,t,n,r){let i=((2*e+t)*n-e*r)/(e+t);return Math.sign(i)!==Math.sign(n)?0:Math.sign(n)!==Math.sign(r)&&Math.abs(i)>3*Math.abs(n)?3*n:i}function Ae(e,t){let n=e[t];if(n===void 0)throw new RangeError("Color curve points must be contiguous");return n}function sh(e){let t=[],n=[],r=Ae(e,0);for(let a of e.slice(1)){let l=a[0]-r[0];t.push(l),n.push((a[1]-r[1])/l),r=a}let i=Ae(n,0);if(e.length===2)return[i,i];let o=new Array(e.length);o[0]=nu(Ae(t,0),Ae(t,1),i,Ae(n,1)),o[o.length-1]=nu(Ae(t,t.length-1),Ae(t,t.length-2),Ae(n,n.length-1),Ae(n,n.length-2));for(let a=1;a<e.length-1;a+=1){let l=Ae(n,a-1),s=Ae(n,a);if(l===0||s===0||Math.sign(l)!==Math.sign(s)){o[a]=0;continue}let u=Ae(t,a-1),c=Ae(t,a),f=2*c+u,m=c+2*u;o[a]=(f+m)/(f/l+m/s)}return o}function ru(e,t){if(e.length<2)throw new RangeError("A color curve requires at least two points");if(!Number.isInteger(t)||t<2)throw new RangeError("Curve LUT size must be at least 2");let n=Number.NEGATIVE_INFINITY;for(let[r,i]of e){if(!Number.isFinite(r)||!Number.isFinite(i))throw new TypeError("Color curve points must be finite");if(r<=n)throw new RangeError("Color curve inputs must be strictly increasing");n=r}}function lh(e,t,n){if(!Number.isFinite(t)||!Number.isFinite(n)||t>=n)throw new RangeError("Curve output bounds must be finite and increasing");if(e.some(([,r])=>r<t||r>n))throw new RangeError(`Curve outputs must be between ${t} and ${n}`)}function uh(e,t,n,r,i){let o=n[0]-t[0],a=Math.min(1,Math.max(0,(e-t[0])/o)),l=a*a,s=l*a;return(2*s-3*l+1)*t[1]+(s-2*l+a)*o*r+(-2*s+3*l)*n[1]+(s-l)*o*i}function iu(e,t,n,r,i){lh(e,r,i);let o=sh(e),a=new Float32Array(t),l=0;for(let s=0;s<t;s+=1){let u=n(s);for(;l<e.length-2&&u>Ae(e,l+1)[0];)l+=1;let c=Ae(e,l),f=Ae(e,l+1),m=uh(u,c,f,Ae(o,l),Ae(o,l+1));a[s]=Math.min(i,Math.max(r,m))}return a}function Vt(e,t=je){if(ru(e,t),e.length>Mn)throw new RangeError(`A color curve supports at most ${Mn} points`);if(e.some(([n])=>n<0||n>1))throw new RangeError("Color curve inputs must be between 0 and 1");if(e[0]?.[0]!==0||e[e.length-1]?.[0]!==1)throw new RangeError("Color curves must include input endpoints 0 and 1");return iu(e,t,n=>n/(t-1),0,1)}function _o(e,t,n,r=je){if(e.length<3)throw new RangeError("A hue curve requires at least three points");if(e.length>Mn)throw new RangeError(`A hue curve supports at most ${Mn} points`);let i=[...e].sort((s,u)=>s[0]-u[0]);for(let s=0;s<i.length;s+=1){let u=i[s];if(!u||u[0]<0||u[0]>=360)throw new RangeError("Hue curve inputs must be from 0 up to 360 degrees");if(s>0&&u[0]===i[s-1]?.[0])throw new RangeError("Hue curve inputs must be unique")}let o=i.slice(-2).map(([s,u])=>[s-360,u]),a=i.slice(0,2).map(([s,u])=>[s+360,u]),l=[...o,...i,...a];return ru(l,r),iu(l,r,s=>s/r*360,t,n)}var Fn="data-color-grading",Nn="data-hf-color-grading-source-hidden",$r="data-hf-authored-opacity",uu="__hf_color_grading_",dh=Yl,ko={exposure:0,contrast:0,highlights:0,shadows:0,whites:0,blacks:0,temperature:0,tint:0,vibrance:0,saturation:0},Mo={vignette:0,vignetteMidpoint:.5,vignetteRoundness:0,vignetteFeather:.65,grain:0,grainSize:.25,grainRoughness:.5},Fo={blur:0,pixelate:0,chromaBleed:0,tapeDamage:0,tapeTracking:0,tapeNoise:1,tapeSpeed:.5,filmArtifacts:0,halftone:0,halftoneSize:0,twoInkPrint:0,twoInkPrintSize:0,ascii:0,asciiSize:5/76,asciiInvert:0,asciiStyle:0,asciiColor:1,asciiRotation:0,dither:0,ditherSize:0,bloom:0,bloomRadius:8,monoScreen:0,monoScreenSize:0,monoScreenAngle:0,monoScreenSpread:0,monoScreenShape:0,monoScreenInvert:0,scanlines:0,scanlineCount:0,scanlineSoftness:0,chromaticAberration:0,chromaticAngle:0,crtCurvature:0,digitalGlitch:0,digitalGlitchColorSplit:0,digitalGlitchLineTear:0,digitalGlitchPixelate:0,digitalGlitchBlockAmount:0,digitalGlitchBlockDisplacement:0,digitalGlitchBlockOpacity:0,digitalGlitchSpeed:0,engraving:0,engravingSpacing:7/17,engravingMinThickness:.2,engravingMaxThickness:3.2/7,engravingAngle:.25,engravingContrast:7/15,engravingSharpness:.59,engravingWave:.2,engravingWaveFrequency:2/9,crosshatch:0,crosshatchSpacing:7/25,crosshatchThickness:.25,crosshatchAngle:.25,crosshatchContrast:1/3,crosshatchEdges:.5,crosshatchLineWeight:0,crosshatchWave:.33,crosshatchWaveFrequency:2/9,kuwahara:0,kuwaharaRadius:1/7,kuwaharaSharpness:5/16,kuwaharaSaturation:.5};var jr=Xl,cu=Jl,du=Ql,fu=Zl,Lo=eu,Do=tu,ou={exposure:.03,contrast:-.12,highlights:-.1,shadows:.16,whites:-.04,blacks:.08,temperature:.13,vibrance:-.08,saturation:-.08},au={vignette:.18};function Ee(e,t,n={},r={},i={},o=1){return{id:e,label:t,intensity:o,adjust:{...ko,...n},details:{...Mo,...r},effects:{...Fo,...i}}}var Io=[Ee("neutral","Neutral"),Ee("warm-daylight","Warm Daylight",{exposure:.06,contrast:.07,highlights:-.06,shadows:.08,temperature:.18,saturation:.08}),Ee("clean-studio","Clean Studio",{contrast:.08,highlights:-.08,shadows:.06,temperature:-.08,tint:.03,saturation:.04}),Ee("skin-soft","Skin Soft",{exposure:.04,contrast:-.03,highlights:-.12,shadows:.12,temperature:.08,tint:.02,saturation:.04}),Ee("food-pop","Food Pop",{exposure:.06,contrast:.1,shadows:.06,temperature:.14,vibrance:.1,saturation:.18}),Ee("night-lift","Night Lift",{exposure:.08,contrast:.08,highlights:-.18,shadows:.2,blacks:-.08,saturation:.04},{vignette:.12}),Ee("muted-editorial","Muted Editorial",{exposure:-.02,contrast:.08,highlights:-.08,shadows:.06,blacks:-.05,temperature:-.03,saturation:-.12},{vignette:.1}),Ee("vintage-wash","Vintage Wash",ou,au),Ee("mono-clean","Mono Clean",{contrast:.12,highlights:-.04,shadows:.04,blacks:-.08,saturation:-1}),Ee("mono-fade","Mono Fade",{contrast:-.04,highlights:-.06,shadows:.1,blacks:.12,saturation:-1},{vignette:.08}),Ee("soft-boost","Soft Boost",{exposure:.06,contrast:-.04,highlights:-.14,shadows:.16,vibrance:.08,saturation:.1}),Ee("bright-pop","Bright Pop",{exposure:.12,contrast:.12,whites:.08,blacks:-.04,vibrance:.08,saturation:.14}),Ee("deep-contrast","Deep Contrast",{exposure:-.03,contrast:.2,highlights:-.08,shadows:-.08,blacks:-.12,saturation:.06}),Ee("creator-camcorder","Creator Camcorder",{contrast:.08,highlights:-.05,shadows:.02,whites:.03,blacks:-.04,temperature:-.03,tint:-.015,vibrance:-.03,saturation:-.06},{vignette:.06,grain:.08,grainSize:.18,grainRoughness:.58},{chromaBleed:.55},.72),Ee("vhs-playback","VHS Playback",{contrast:-.04,saturation:-.08},{grain:.16,grainSize:.12,grainRoughness:.72},{tapeDamage:.82,tapeTracking:.85,tapeNoise:.3,tapeSpeed:.5,chromaBleed:.5,chromaticAberration:.18,scanlines:.35,scanlineCount:.17,scanlineSoftness:1,digitalGlitch:.32,digitalGlitchLineTear:.08,digitalGlitchSpeed:.5}),Ee("home-movie-8mm","8mm Home Movie",ou,{...au,vignette:.28,vignetteMidpoint:.54,vignetteFeather:.72,grain:.34,grainSize:.18,grainRoughness:.72},{filmArtifacts:.62},.72),Ee("editorial-halftone","Editorial Halftone",{contrast:.04,saturation:.04},{},{halftone:.94,halftoneSize:.36}),Ee("two-ink-print","Two-Ink Print",{contrast:.08,highlights:-.06,shadows:.04},{},{twoInkPrint:1,twoInkPrintSize:.42})],fh=new Map(Io.map(e=>[e.id,e])),mh=/^\$(?:\{([A-Za-z0-9_.:-]+)\}|([A-Za-z0-9_.:-]+))$/,ph={exposure:{min:-2,max:2},contrast:{min:-1,max:1},highlights:{min:-1,max:1},shadows:{min:-1,max:1},whites:{min:-1,max:1},blacks:{min:-1,max:1},temperature:{min:-1,max:1},tint:{min:-1,max:1},vibrance:{min:-1,max:1},saturation:{min:-1,max:1}},zt={hue:0,amount:0,level:0},su={amount:me.unit,level:me.signedUnit},ft=[[0,0],[1,1]],qt=[],hh={hueVsHue:me.secondaryHueShift,hueVsSaturation:me.signedUnit,hueVsLuma:me.signedUnit},To={center:0,range:180,softness:0},Ro={min:0,max:1,softness:.05},gh={vignette:me.unit,vignetteMidpoint:me.unit,vignetteRoundness:me.signedUnit,vignetteFeather:me.unit,grain:me.unit,grainSize:me.unit,grainRoughness:me.unit},No=me.unit,bh=me.effects,mu=["blur","pixelate","chromaBleed","tapeDamage","filmArtifacts","halftone","twoInkPrint","ascii","dither","bloom","monoScreen","scanlines","chromaticAberration","crtCurvature","digitalGlitch","engraving","crosshatch","kuwahara"];var xh=Io.filter(e=>mu.some(t=>e.effects[t]>1e-4)),gS=Io.filter(e=>!xh.includes(e)),bS={blur:{blur:.45},pixelate:{pixelate:.55},bloom:{bloom:.55,bloomRadius:8},chromaBleed:{chromaBleed:.55},tapeDamage:{tapeDamage:.65,tapeTracking:.55,tapeNoise:.25,tapeSpeed:.5},filmArtifacts:{filmArtifacts:.55},scanlines:{scanlines:.35,scanlineCount:.17,scanlineSoftness:1},chromaticAberration:{chromaticAberration:.15,chromaticAngle:0},crtCurvature:{crtCurvature:.2},digitalGlitch:{digitalGlitch:.55,digitalGlitchColorSplit:.25,digitalGlitchLineTear:.25,digitalGlitchPixelate:.15,digitalGlitchBlockAmount:.5,digitalGlitchBlockDisplacement:.25,digitalGlitchBlockOpacity:0,digitalGlitchSpeed:.5},halftone:{halftone:.94,halftoneSize:.36},twoInkPrint:{twoInkPrint:1,twoInkPrintSize:.42},ascii:{ascii:1,asciiSize:5/76,asciiInvert:0,asciiStyle:0,asciiColor:1,asciiRotation:0},dither:{dither:1,ditherSize:.5},monoScreen:{monoScreen:1,monoScreenSize:.35,monoScreenAngle:.25,monoScreenSpread:.3,monoScreenShape:0,monoScreenInvert:0},engraving:{engraving:1,engravingSpacing:7/17,engravingMinThickness:.2,engravingMaxThickness:3.2/7,engravingAngle:.25,engravingContrast:7/15,engravingSharpness:.59,engravingWave:.2,engravingWaveFrequency:2/9},crosshatch:{crosshatch:1,crosshatchSpacing:7/25,crosshatchThickness:.25,crosshatchAngle:.25,crosshatchContrast:1/3,crosshatchEdges:.5,crosshatchLineWeight:0,crosshatchWave:.33,crosshatchWaveFrequency:2/9},kuwahara:{kuwahara:1,kuwaharaRadius:1/7,kuwaharaSharpness:5/16,kuwaharaSaturation:.5}},pu=[{path:"intensity",name:"--hf-color-grading-intensity",min:0,max:1},{path:"lut.intensity",name:"--hf-color-grading-lut-intensity",min:0,max:1},{path:"adjust.exposure",name:"--hf-color-grading-exposure",min:-2,max:2},{path:"effects.blur",name:"--hf-color-grading-blur",min:0,max:1},{path:"effects.bloom",name:"--hf-color-grading-bloom",min:0,max:3},{path:"effects.kuwahara",name:"--hf-color-grading-kuwahara",min:0,max:1},{path:"effects.pixelate",name:"--hf-color-grading-pixelate",min:0,max:1},{path:"effects.ascii",name:"--hf-color-grading-ascii",min:0,max:1},{path:"effects.dither",name:"--hf-color-grading-dither",min:0,max:1}];var yh=/^#[0-9a-f]{6}$/i;function vh(e){return!Array.isArray(e)||e.length<2||e.length>6||!e.every(t=>typeof t=="string"&&yh.test(t))?null:e.map(t=>t.toLowerCase())}function Te(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qr(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,e)):0}function hu(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?Math.min(1,Math.max(0,n)):t}function Re(e,t){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?qr(n,t.min,t.max):0}function Po(e,t=0){let n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?(n%360+360)%360:t}function Sh(e){let t=Te(e)?e:{};return cu.reduce((n,r)=>{let i=Te(t[r])?t[r]:{};return n[r]={hue:Po(i.hue,zt.hue),amount:Re(i.amount??zt.amount,su.amount),level:Re(i.level??zt.level,su.level)},n},{shadows:{...zt},midtones:{...zt},highlights:{...zt}})}function Ah(e){if(!Array.isArray(e)||e.length!==2)return null;let t=Number(e[0]),n=Number(e[1]);return Number.isFinite(t)&&Number.isFinite(n)?[qr(t,0,1),qr(n,0,1)]:null}function gu(e){return e.some((t,n)=>n>0&&t[0]===e[n-1]?.[0])}function Eh(e){(e[0]?.[0]??0)>0&&e.unshift([0,0]),(e.at(-1)?.[0]??1)<1&&e.push([1,1])}function wh(e){if(!Array.isArray(e)||e.length<2)return ft;let t=[];for(let n of e){let r=Ah(n);if(!r)return ft;t.push(r)}return t.sort((n,r)=>n[0]-r[0]),gu(t)||(Eh(t),t.length>16)?ft:t}function Ch(e){let t=Te(e)?e:{};return du.reduce((n,r)=>(n[r]=wh(t[r]),n),{master:ft,red:ft,green:ft,blue:ft})}function _h(e,t){if(!Array.isArray(e)||e.length!==2)return null;let n=Number(e[0]),r=Number(e[1]);return Number.isFinite(n)&&Number.isFinite(r)?[Po(n),qr(r,t.min,t.max)]:null}function Th(e,t){if(!Array.isArray(e)||e.length<3||e.length>16)return qt;let n=[];for(let r of e){let i=_h(r,t);if(!i)return qt;n.push(i)}return n.sort((r,i)=>r[0]-i[0]),gu(n)?qt:n}function Rh(e){let t=Te(e)?e:{};return fu.reduce((n,r)=>(n[r]=Th(t[r],hh[r]),n),{hueVsHue:qt,hueVsSaturation:qt,hueVsLuma:qt})}function lu(e){let t=Te(e)?e:{},n=Re(t.min??Ro.min,No),r=Re(t.max??Ro.max,No);return{min:Math.min(n,r),max:Math.max(n,r),softness:Re(t.softness??Ro.softness,me.secondarySoftRangeSoftness)}}function kh(e){let t=Te(e)?e:{},n=Re(t.range??To.range,me.secondaryHueRange);return{center:Po(t.center,To.center),range:n,softness:Re(t.softness??To.softness,{min:me.secondaryHueSoftness.min,max:me.secondaryHueCombinedMax-n})}}function Mh(e){return{hueShift:Re(e.hueShift??0,me.secondaryHueShift),saturation:Re(e.saturation??0,me.signedUnit),luma:Re(e.luma??0,me.signedUnit),temperature:Re(e.temperature??0,me.signedUnit),tint:Re(e.tint??0,me.signedUnit)}}function Fh(e){return!Te(e)||!Te(e.key)||!Te(e.correction)?null:{enabled:e.enabled!==!1,key:{hue:kh(e.key.hue),saturation:lu(e.key.saturation),luma:lu(e.key.luma)},correction:Mh(e.correction)}}function Nh(e){if(!Array.isArray(e))return[];let t=[];for(let n of e.slice(0,4)){let r=Fh(n);r&&t.push(r)}return t}function Lh(e){if(e==null)return null;let t=String(e).trim();return t||null}function Dh(e){if(e==null)return null;if(typeof e=="string"){let n=e.trim();return n?{src:n,intensity:1}:null}if(!Te(e))return null;let t=e.src;return typeof t!="string"||t.trim()===""?null:{src:t.trim(),intensity:hu(e.intensity,1)}}function Ih(e){if(typeof e=="string"){let t=e.trim();if(!t)return null;if(t.startsWith("{"))try{let n=JSON.parse(t);return Te(n)?n:null}catch{return null}return{preset:t}}return Te(e)?e:null}function Ph(e,t){let n=e.trim().match(mh);if(!n)return e;let r=n[1]??n[2]??"";return r&&Object.hasOwn(t,r)?t[r]:e}function zr(e,t){if(typeof e=="string"){let r=Ph(e,t);if(r!==e)return r;let i=e.trim();if(!i.startsWith("{"))return e;try{return zr(JSON.parse(i),t)}catch{return e}}if(Array.isArray(e))return e.map(r=>zr(r,t));if(!Te(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=zr(i,t);return n}function Oh(e){return e?fh.get(e)??null:null}function Kr(e){let t=Ih(e);if(!t||t.enabled===!1)return null;let n=Lh(t.preset),r=Oh(n),i=r?.adjust??ko,o=r?.details??Mo,a=r?.effects??Fo,l=Te(t.adjust)?t.adjust:{},s=Te(t.details)?t.details:{},u=Te(t.effects)?t.effects:{},c=jr.reduce((p,b)=>(p[b]=Re(l[b]??i[b],ph[b]),p),{...ko}),f=Lo.reduce((p,b)=>(p[b]=Re(s[b]??o[b],gh[b]),p),{...Mo}),m=Do.reduce((p,b)=>(p[b]=Re(u[b]??a[b],bh[b]??No),p),{...Fo});return{enabled:!0,preset:n,intensity:hu(t.intensity,r?.intensity??1),adjust:c,wheels:Sh(t.wheels),curves:Ch(t.curves),hueCurves:Rh(t.hueCurves),secondaries:Nh(t.secondaries),details:f,effects:m,palette:vh(t.palette),lut:Dh(t.lut),colorSpace:typeof t.colorSpace=="string"&&t.colorSpace.trim()?t.colorSpace.trim():dh}}function bu(e,t){return Kr(zr(e,t))}function Hh(e){return cu.some(t=>Math.abs(e[t].amount)>1e-4||Math.abs(e[t].level)>1e-4)}function Oo(e){return du.some(t=>e[t].some(([n,r])=>Math.abs(n-r)>1e-4))}function Ho(e){return fu.some(t=>e[t].some(([,n])=>Math.abs(n)>1e-4))}function Go(e){return e.some(t=>t.enabled&&Object.values(t.correction).some(n=>Math.abs(n)>1e-4))}function xu(e){return e?.enabled?Math.abs(e.details.vignette)>1e-4||Math.abs(e.details.grain)>1e-4||mu.some(n=>Math.abs(e.effects[n])>1e-4)?!0:e.intensity===0?!1:e.lut&&e.lut.intensity!==0?!0:jr.some(n=>Math.abs(e.adjust[n])>1e-4)||(e.wheels?Hh(e.wheels):!1)||(e.curves?Oo(e.curves):!1)||(e.hueCurves?Ho(e.hueCurves):!1)||(e.secondaries?Go(e.secondaries):!1):!1}var Gh=["[data-hyperframes-ignore]","[data-hyperframes-picker-ignore]","[data-hf-ignore]","[data-no-inspect]","[data-no-pick]","[data-hyper-shader-loading]"].join(","),Bh=["[data-hyperframes-picker-block]","[data-hyper-shader-loading]"].join(",");function yu(e){let t=!1,n=null,r=null,i=null,o=null;function a(S,A){try{window.dispatchEvent(new CustomEvent(S,{detail:A}))}catch(C){L("runtime.picker.site1",C)}}function l(S){i=S,a("hyperframe:picker:hovered",{elementInfo:i,isPickMode:t,timestamp:Date.now()})}function s(S){o=S,a("hyperframe:picker:selected",{elementInfo:o,isPickMode:t,timestamp:Date.now()})}function u(S){let A=S.ownerDocument.defaultView;if(!A)return!1;let C=S;for(;C&&C!==document.body&&C!==document.documentElement;){let F=A.getComputedStyle(C);if(F.display==="none"||F.visibility==="hidden"||F.pointerEvents==="none")return!0;let I=Number.parseFloat(F.opacity);if(Number.isFinite(I)&&I<=.01&&!C.hasAttribute(Nn))return!0;C=C.parentElement}return!1}function c(S){if(!S||S===document.body||S===document.documentElement)return!1;let A=S.tagName.toLowerCase();return!(A==="script"||A==="style"||A==="link"||A==="meta"||S.classList.contains("__hf-pick-highlight")||S.closest(Gh)||u(S))}function f(S){return!!S?.closest(Bh)}function m(S){let A=S;if(A.id)return`#${CSS.escape(A.id)}`;let C=S.getAttribute("data-composition-id");if(C)return`[data-composition-id="${CSS.escape(C)}"]`;let F=S.getAttribute("data-composition-src");if(F)return`[data-composition-src="${CSS.escape(F)}"]`;let I=S.getAttribute("data-track-index");if(I)return`[data-track-index="${CSS.escape(I)}"]`;let q=S.tagName.toLowerCase(),W=S.parentElement;if(!W)return q;let Y=W.querySelectorAll(`:scope > ${q}`);if(Y.length===1)return q;for(let k=0;k<Y.length;k+=1)if(Y[k]===S)return`${q}:nth-of-type(${k+1})`;return q}function p(S){let A=S.tagName.toLowerCase(),C=(S.textContent??"").trim().replace(/\s+/g," "),F=(I,q)=>I.length>q?`${I.slice(0,q-1)}\u2026`:I;return A==="h1"||A==="h2"||A==="h3"?"Heading":A==="p"||A==="span"||A==="div"?C.length>0?F(C,56):"Text":A==="img"?"Image":A==="video"?"Video":A==="audio"?"Audio":A==="svg"?"Shape":S.getAttribute("data-composition-src")?"Composition":A==="section"?"Section":`${A.charAt(0).toUpperCase()}${A.slice(1)}`}function b(S,A,C){let F=typeof C=="number"&&C>0?C:8,I=[];if(document.elementsFromPoint)I=document.elementsFromPoint(S,A);else if(document.elementFromPoint){let Y=document.elementFromPoint(S,A);I=Y?[Y]:[]}if(f(I[0]??null))return[];let q={},W=[];for(let[Y,k]of I.entries()){if(!c(k))continue;let U=`${k.tagName}::${k.id||""}::${Y}`;if(!q[U]&&(q[U]=!0,W.push(k),W.length>=F))break}return W}function v(S){let A=S.getBoundingClientRect(),C={};for(let I of Array.from(S.attributes))I.name.startsWith("data-")&&(C[I.name]=I.value);return{id:S.id||null,tagName:S.tagName.toLowerCase(),selector:m(S),label:p(S),boundingBox:{x:A.left,y:A.top,width:A.width,height:A.height},textContent:S.textContent?S.textContent.trim().slice(0,200):null,src:S.getAttribute("src")||S.getAttribute("data-composition-src")||null,dataAttributes:C}}function x(S,A,C){return b(S,A,C).map(v)}function _(S){if(!t)return;let C=b(S.clientX,S.clientY,1)[0]??(S.target instanceof Element?S.target:null);if(!c(C)||n===C)return;n&&n.classList.remove("__hf-pick-highlight"),n=C,C.classList.add("__hf-pick-highlight");let F=v(C);l(F),e.postMessage({source:"hf-preview",type:"element-hovered",elementInfo:F})}function R(S){if(!t)return;S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation();let A=x(S.clientX,S.clientY,8);A.length!==0&&(l(A[0]??null),e.postMessage({source:"hf-preview",type:"element-pick-candidates",candidates:A,selectedIndex:0,point:{x:S.clientX,y:S.clientY}}))}function T(S){S.key==="Escape"&&(D(),e.postMessage({source:"hf-preview",type:"pick-mode-cancelled"}))}function M(){t||(t=!0,r=document.createElement("style"),r.textContent=[".__hf-pick-highlight { outline: 2px solid #4f8cf7 !important; outline-offset: 2px; cursor: crosshair !important; }",".__hf-pick-active * { cursor: crosshair !important; }"].join(`
|
|
40
|
-
`),document.head.appendChild(r),document.body.classList.add("__hf-pick-active"),document.addEventListener("mousemove",_,!0),document.addEventListener("click",R,!0),document.addEventListener("keydown",T,!0),a("hyperframe:picker:mode",{isPickMode:!0,timestamp:Date.now()}))}function D(){t&&(t=!1,n&&(n.classList.remove("__hf-pick-highlight"),n=null),r&&(r.remove(),r=null),document.body.classList.remove("__hf-pick-active"),document.removeEventListener("mousemove",_,!0),document.removeEventListener("click",R,!0),document.removeEventListener("keydown",T,!0),a("hyperframe:picker:mode",{isPickMode:!1,timestamp:Date.now()}))}function E(){window.__HF_PICKER_API={enable:M,disable:D,isActive:()=>t,getHovered:()=>i,getSelected:()=>o,getCandidatesAtPoint:(S,A,C)=>Number.isFinite(S)&&Number.isFinite(A)?x(S,A,C):[],pickAtPoint:(S,A,C)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return null;let F=x(S,A,8);if(!F.length)return null;let I=Math.max(0,Math.min(F.length-1,Number(C??0))),q=F[I]??null;return q?(s(q),e.postMessage({source:"hf-preview",type:"element-picked",elementInfo:q}),D(),q):null},pickManyAtPoint:(S,A,C)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return[];let F=x(S,A,8);if(!F.length)return[];let I=[],q=Array.isArray(C)?C:[0];for(let W of q){let Y=Math.max(0,Math.min(F.length-1,Math.floor(Number(W)))),k=F[Y];if(!k)continue;I.some(ie=>ie.selector===k.selector&&ie.tagName===k.tagName)||I.push(k)}return I.length?(s(I[0]??null),e.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:I}),D(),I):[]}},a("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:M,disablePickMode:D,installPickerApi:E}}var Uh=["width","height","top","left","right","bottom","inset","object-fit","object-position","z-index","opacity","visibility","filter","mix-blend-mode","backdrop-filter","border-radius","overflow","clip-path","mask","mask-image","mask-size","mask-position","mask-repeat","transform","transform-origin","translate","rotate","scale","box-sizing"];function $t(e,t){let n=Number.isFinite(t)&&t>0?t:30,r=Number.isFinite(e)&&e>0?e:0;return Math.floor(r*n+1e-9)/n}function vu(e,t,n=Uh){for(let r of n){let i=t.getPropertyValue(r);i&&e.setProperty(r,i)}}function Ln(e,t,n){let r=e?.[t];return typeof r=="function"?Number(r.call(e))||n:typeof r=="number"&&Number.isFinite(r)?r:(r!=null&&L("runtime.player.nonConformantNum",{prop:t,actual:typeof r}),n)}function Ue(e,t){let n=e?.[t];if(typeof n=="function"){n.call(e);return}n!==void 0&&L("runtime.player.nonConformantVoid",{method:t,actual:typeof n})}function Dn(e,t,n){if(e){for(let r of Object.values(e))if(!(!r||r===t))try{n(r)}catch(i){L("runtime.player.site1",i)}}}function Su(e,t,n,r){let i=$t(t,n),o=r?.suppressEvents===!0;return Ue(e,"pause"),typeof e.totalTime=="function"?e.totalTime(i,o):typeof e.seek=="function"&&e.seek(i,o),i}function Wh(e,t,n,r,i){let o=[];Dn(e,t,a=>{Ue(a,"play"),o.push(a)});try{return Su(t,n,r,i)}finally{for(let a of o)try{Ue(a,"pause")}catch(l){L("runtime.player.site2",l)}}}function Vh(e,t){Dn(e,t,n=>{Ue(n,"play")})}function Au(e){let t=e.transport;return t?{_timeline:null,play:()=>t.play(),pause:()=>t.pause(),seek:(n,r)=>t.seek(n,r),renderSeek:(n,r)=>t.renderSeek(n,r),getTime:()=>t.getTime(),getDuration:()=>t.getDuration(),isPlaying:()=>t.isPlaying(),setPlaybackRate:n=>t.setPlaybackRate(n),getPlaybackRate:()=>t.getPlaybackRate()}:{_timeline:null,play:()=>{let n=e.getTimeline();if(!n||e.getIsPlaying())return;let r=Math.max(0,Number(e.getSafeDuration?.()??Ln(n,"duration",0))||0);r>0&&Math.max(0,Ln(n,"time",0))>=r&&(Ue(n,"pause"),typeof n.seek=="function"&&n.seek(0,!1),e.onDeterministicSeek(0),e.setIsPlaying(!1),e.onSyncMedia(0,!1),e.onRenderFrameSeek(0)),typeof n.timeScale=="function"&&n.timeScale(e.getPlaybackRate()),Ue(n,"play"),Dn(e.getTimelineRegistry?.(),n,i=>{typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),Ue(i,"play")}),e.onDeterministicPlay(),e.setIsPlaying(!0),e.onShowNativeVideos(),e.onStatePost(!0)},pause:()=>{let n=e.getTimeline();if(!n)return;Ue(n,"pause"),Dn(e.getTimelineRegistry?.(),n,i=>{Ue(i,"pause")});let r=Math.max(0,Ln(n,"time",0));e.onDeterministicSeek(r),e.onDeterministicPause(),e.setIsPlaying(!1),e.onSyncMedia(r,!1),e.onRenderFrameSeek(r),e.onStatePost(!0)},seek:(n,r)=>{let i=e.getTimeline();if(!i)return;let o=Math.max(0,Number(n)||0),a=e.getIsPlaying(),l=Wh(e.getTimelineRegistry?.(),i,o,e.getCanonicalFps());e.onDeterministicSeek(l),r?.keepPlaying&&a?(typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),Ue(i,"play"),Dn(e.getTimelineRegistry?.(),i,s=>{typeof s.timeScale=="function"&&s.timeScale(e.getPlaybackRate()),Ue(s,"play")}),e.onDeterministicPlay(),e.onShowNativeVideos(),e.onSyncMedia(l,!0)):(e.setIsPlaying(!1),e.onSyncMedia(l,!1)),e.onRenderFrameSeek(l),e.onStatePost(!0)},renderSeek:(n,r)=>{let i=e.getTimeline(),o=e.getCanonicalFps(),a=i?(Vh(e.getTimelineRegistry?.(),i),Su(i,n,o,r)):$t(Math.max(0,Number(n)||0),o);e.onDeterministicSeek(a,r),e.setIsPlaying(!1),e.onSyncMedia(a,!1),e.onRenderFrameSeek(a),e.onStatePost(!0)},getTime:()=>Ln(e.getTimeline(),"time",0),getDuration:()=>Ln(e.getTimeline(),"duration",0),isPlaying:()=>e.getIsPlaying(),setPlaybackRate:n=>e.setPlaybackRate(n),getPlaybackRate:()=>e.getPlaybackRate()}}function Eu(){return{capturedTimeline:null,isPlaying:!1,currentTime:0,deterministicAdapters:[],canonicalFps:30,bridgeMuted:!1,bridgeVolume:1,mediaOutputMuted:!1,nativeMediaSyncDisabled:!1,webAudioMediaDisabled:!1,mediaAutoplayBlockedPosted:!1,mediaForceSyncNextTick:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,controlBridgeHandler:null,beforeUnloadHandler:null,injectedCompStyles:[],injectedCompScripts:[],injectedCompLinks:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,transportClock:null,transportRafId:null}}var zh=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function Bo(e){return e.id||e.getAttribute("data-hf-id")||null}function qh(e){return ve(e)}function $h(e,t){let n=e.getAttribute("data-composition-id");if(!n)return null;let r=Number(t[n]?.duration?.());return Number.isFinite(r)&&r>0?r:null}function jh(e){return!(e instanceof HTMLMediaElement)||!Number.isFinite(e.duration)?null:Qe(e,e.duration)}function Kh(e,t,n,r){let i=qh(e.getAttribute("data-duration"));return i!=null&&i>0?i:$h(e,t)??jh(e)??Math.max(0,n-r)}function Yh(e){for(let[t,n]of e){let r=t.parentElement;for(;r;){let i=e.get(r);if(i){n.parentId=i.id,i.children.push(n);break}r=r.parentElement}}}function wu(e){let{startResolver:t,timelineRegistry:n,rootDuration:r}=e,i=new Map,o=document.querySelector("[data-composition-id]"),a=0;for(let l of document.querySelectorAll("[data-start]")){if(l===o||zh.has(l.tagName))continue;let s=t.resolveStartForElement(l,0);if(Kh(l,n,r,s)<=0)continue;let u={id:Bo(l)??`__clip-${a++}`,element:l,parentId:null,children:[]};i.set(l,u)}return Yh(i),{roots:Array.from(i.values()).filter(l=>l.parentId===null)}}function In(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null}function jt(e){let t=In(e.start);if(t==null)return null;let n=Math.max(0,t),r=In(e.duration),i=In(e.authoredDuration),o=r!=null&&r>0?r:i!=null&&i>0?i:null;if(o!=null)return{start:n,duration:o,end:n+o};let a=In(e.end),l=In(e.authoredEnd),s=a!=null&&a>n?a:l!=null&&l>n?l:null;return{start:n,duration:s==null?null:s-n,end:s}}var Uo="css:root",Cu=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],Xh=new Set([...Cu,"contain","isolation","mask-border","mix-blend-mode","opacity"]),Jh=new Set(["absolute","relative"]),Qh=new Set(["flex","inline-flex","grid","inline-grid"]),Zh=new Set(["layout","paint","strict","content"]),e0=new Set(["size","inline-size"]);function t0(e){return e.position==="fixed"||e.position==="sticky"}function n0(e,t){if(t.zIndex==="auto"||t.zIndex==="")return!1;if(Jh.has(t.position))return!0;let n=e.parentElement?e.ownerDocument.defaultView?.getComputedStyle(e.parentElement).display:null;return n!=null&&Qh.has(n)}function r0(e){let t=Number.parseFloat(e.opacity);if(Number.isFinite(t)&&t<1||e.getPropertyValue("isolation")==="isolate")return!0;let n=e.getPropertyValue("mix-blend-mode");return n&&n!=="normal"?!0:Cu.some(r=>{let i=e.getPropertyValue(r);return i!==""&&i!=="none"})}function i0(e){return e.getPropertyValue("contain").split(/\s+/).some(n=>Zh.has(n))?!0:e0.has(e.getPropertyValue("container-type"))}function o0(e){return e.getPropertyValue("will-change").split(",").map(t=>t.trim()).some(t=>Xh.has(t))}function a0(e,t){return t0(t)||n0(e,t)||r0(t)||i0(t)?!0:o0(t)}function s0(e){let t=[],n=e;for(;n?.parentElement;)t.push(Array.prototype.indexOf.call(n.parentElement.children,n)),n=n.parentElement;return`css:${t.reverse().join(".")}`}function Yr(e){let t=e.ownerDocument.defaultView;if(!t)return Uo;let n=e.parentElement;for(;n&&n!==e.ownerDocument.documentElement;){try{if(a0(n,t.getComputedStyle(n)))return s0(n)}catch{return Uo}n=n.parentElement}return Uo}function mt(e){let t=e.timelineRegistry??{},n=e.includeAuthoredTimingAttrs??!1,r=e.documentRef??document,i=new WeakMap,o=new WeakMap,a=new Set,l=m=>{let p=r.getElementById(m);return p||(r.querySelector(`[data-composition-id="${CSS.escape(m)}"]`)??null)},s=m=>{let p=m.ownerDocument.defaultView?.HTMLMediaElement;return p?m instanceof p:typeof HTMLMediaElement<"u"&&m instanceof HTMLMediaElement},u=m=>{let p=o.get(m);if(p!==void 0)return p;let b=null,v=jt({start:0,duration:m.getAttribute("data-duration"),authoredDuration:n?m.getAttribute("data-hf-authored-duration"):null});if(v?.duration!=null&&v.duration>0&&(b=v.duration),b==null||b<=0){let x=f(m,0),_=jt({start:x,end:m.getAttribute("data-end"),authoredEnd:n?m.getAttribute("data-hf-authored-end"):null});_?.duration!=null&&_.duration>0&&(b=_.duration)}if((b==null||b<=0)&&s(m)){let x=yn(m);Number.isFinite(m.duration)&&m.duration>x&&(b=(m.duration-x)/_e(m))}if(b==null||b<=0){let x=m.getAttribute("data-composition-id");if(x){let _=t[x]??null;if(_&&typeof _.duration=="function")try{let R=Number(_.duration());Number.isFinite(R)&&R>0&&(b=R)}catch(R){L("runtime.startResolver.site1",R)}}}return b!=null&&Number.isFinite(b)&&b>0?(o.set(m,b),b):(o.set(m,null),null)},c=(m,p)=>{if(m.hasAttribute("data-composition-id")){let v=m.parentElement?.closest("[data-composition-id]");return v?f(v,p):0}let b=m.closest("[data-composition-id]");return b?f(b,p):0},f=(m,p)=>{let b=i.get(m);if(b!==void 0)return b??p;if(a.has(m))return p;a.add(m);try{let v=lo(m.getAttribute("data-start"));if(!v){if(m.hasAttribute("data-composition-id")){let M=m.parentElement;if(M&&(M.hasAttribute("data-composition-src")||M.hasAttribute("data-composition-id")||M.hasAttribute("data-composition-file"))){let D=f(M,p);return i.set(m,D),D}}return i.set(m,p),p}if(v.kind==="absolute"){let M=Math.max(0,v.value),D=Math.max(0,c(m,p)+M);return i.set(m,D),D}let x=l(v.refId);if(!x)return i.set(m,p),p;let _=f(x,0),R=u(x);if(R==null||R<=0){let M=Math.max(0,_+v.offset);return i.set(m,M),M}let T=Math.max(0,_+R+v.offset);return i.set(m,T),T}finally{a.delete(m)}};return{resolveStartForElement:(m,p=0)=>f(m,Math.max(0,p)),resolveDurationForElement:m=>u(m)}}function Wo(e){let t=e.trim().toLowerCase();return!(!t||t==="main"||t.includes("caption")||t.includes("ambient"))}function pt(e){return ve(e)}function Vo(e){let t=e.getAttribute("data-duration"),n=e.getAttribute("data-hf-authored-duration"),r=jt({start:0,duration:t,authoredDuration:n})?.duration;return r??([t,n].map(pt).some(o=>o!=null&&o<=0)?0:null)}function _u(e){return jt({start:0,end:e.getAttribute("data-end"),authoredEnd:e.getAttribute("data-hf-authored-end")})?.end??null}function zo(e){try{let t=e.style?.zIndex;if(t&&t!=="auto"){let n=parseInt(t,10);if(Number.isFinite(n))return n}return 0}catch{return 0}}function qo(...e){let t=e.filter(n=>Number.isFinite(n??null));return t.length===0?null:Math.max(...t)}function $o(e,t){let n=e.getAttribute("data-track-index")??e.getAttribute("data-track");if(n==null)return t;let r=Number.parseInt(n,10);return Number.isFinite(r)?r:t}function On(e){let t=String(e??"").trim();if(!t)return null;let n=t.toLowerCase();if(n.startsWith("data:")||n.startsWith("javascript:"))return null;try{return new URL(t,document.baseURI).toString()}catch{return t}}function Tu(e){let t=e.getAttribute("src")??e.getAttribute("data-src");if(t)return On(t);let n=e.getAttribute("data-composition-src");if(n)return On(n);let r=e.querySelector("img[src], video[src], audio[src], source[src]");return r?On(r.getAttribute("src")):null}function u0(e){let t=e.className;return typeof t!="string"?null:t.split(/\s+/).map(n=>n.trim()).find(n=>n&&n!=="clip"&&!n.startsWith("__hf-"))??null}function c0(e){if(!e)return null;try{return new URL(e,document.baseURI).pathname.split("/").filter(Boolean).at(-1)??null}catch{return e.split(/[\\/]/).filter(Boolean).at(-1)??null}}function d0(e){let t=e.textContent?.replace(/\s+/g," ").trim();return t?t.length>32?`${t.slice(0,31)}...`:t:null}function Pn(e){let t=e.replace(/\.[^.]+$/i,"").replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t?t.replace(/\b\w/g,n=>n.toUpperCase()):e}function f0(e,t,n){let r=e.getAttribute("data-timeline-label")??e.getAttribute("data-label")??e.getAttribute("aria-label")??null;if(r?.trim())return r.trim();let i=e.getAttribute("data-composition-id");if(i)return Pn(i);let o=e.id;if(o)return Pn(o);let a=u0(e);if(a)return Pn(a);let l=c0(Tu(e));if(l)return Pn(l);let s=d0(e);return s||`${Pn(t)} ${n+1}`}function Ru(e){let n=window.__timelines??{},r=mt({timelineRegistry:n,includeAuthoredTimingAttrs:!0}),i=z=>{if(!z)return null;let O=n[z]??null;if(!O||typeof O.duration!="function")return null;try{let B=Number(O.duration());return Number.isFinite(B)&&B>0?B:null}catch{return null}},o=z=>{let O=pt(z.getAttribute("data-duration"));return O!=null&&O>0?O:Number.isFinite(z.duration)?Qe(z,z.duration):null},a=()=>{let z=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(z.length===0)return null;let O=0;for(let B of z){let ee=B.hasAttribute("data-hf-auto-start")?r.resolveStartForElement(B,0):Math.max(0,Number(B.getAttribute("data-start")??0)||0);if(!Number.isFinite(ee))continue;let K=o(B);K==null||K<=0||(O=Math.max(O,Math.max(0,ee)+K))}return O>0?O:null},l=(z,O)=>{let B=[],ee=null,K=null,te=null,J=z.parentElement;for(;J;){let X=J.getAttribute("data-composition-id");X&&(B.push(X),!te&&J!==O&&(te=X),ee==null&&(ee=r.resolveStartForElement(J,0)),K==null&&(K=pt(J.getAttribute("data-duration"))??i(X)??null)),J=J.parentElement}return{parentCompositionId:te,compositionAncestors:B.reverse(),inheritedStart:ee,inheritedDuration:K}},s=document.querySelector("[data-composition-id]"),u=Array.from(document.querySelectorAll("[data-composition-id]")),c=s?.getAttribute("data-composition-id")??null,f=s?r.resolveStartForElement(s,0):0,m=a(),p=m!=null?Math.max(0,m-Math.max(0,f)):null,b=i(c),v=Vo(s??document.body),x=qo(...u.filter(z=>z!==s).map(z=>{let O=r.resolveStartForElement(z,0),B=r.resolveDurationForElement(z)??i(z.getAttribute("data-composition-id"))??null;return!Number.isFinite(O)||B==null||B<=0?null:Math.max(0,O)+B})),_=x!=null?Math.max(0,x-Math.max(0,f)):null,R=typeof b=="number"&&Number.isFinite(b)&&b>0?b:null,T=typeof v=="number"&&Number.isFinite(v)&&v>0?v:null,M=typeof p=="number"&&Number.isFinite(p)&&p>0?p:null,D=typeof _=="number"&&Number.isFinite(_)&&_>0?_:null,E=qo(M,D),S=R!=null&&E!=null&&R>E+1,C=T??(S?E:qo(R,M,D))??null,I=(C!=null?f+C:null)??(typeof m=="number"&&Number.isFinite(m)&&m>0?m:null),q=(z,O)=>!Number.isFinite(O)||O<=0?0:I==null||!Number.isFinite(I)?O:!Number.isFinite(z)||z>=I?0:Math.max(0,Math.min(O,I-z)),W=[],Y=[],k=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),U=0;for(let[z,O]of k.entries()){if(O===s||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(O.tagName))continue;let B=l(O,s),ee=r.resolveStartForElement(O,B.inheritedStart??0),K=O.getAttribute("data-composition-id"),te=Vo(O);if(te==null&&K&&K!==c&&(te=i(K)),te==null&&O instanceof HTMLMediaElement&&Number.isFinite(O.duration)&&(te=Qe(O,O.duration)),te==null){let Fe=B.inheritedDuration;if(Fe!=null&&Fe>0){let Ce=(B.inheritedStart??0)+Fe;te=Math.max(0,Ce-ee)}}if(te==null||te<=0||(te=q(ee,te),te<=0))continue;let J=ee+te;U=Math.max(U,J);let X=O.tagName.toLowerCase(),Pe=K&&K!==c?"composition":X==="video"?"video":X==="audio"?"audio":X==="img"?"image":"element";W.push({id:Bo(O)??K??null,label:f0(O,Pe,W.length),start:ee,duration:te,track:$o(O,z),zIndex:zo(O),stackingContextId:Yr(O),kind:Pe,tagName:X,compositionId:O.getAttribute("data-composition-id"),compositionAncestors:B.compositionAncestors,parentCompositionId:B.parentCompositionId,nodePath:null,compositionSrc:On(O.getAttribute("data-composition-src")),playbackStart:$e(O),playbackRate:_e(O),assetUrl:Tu(O),timelineRole:O.getAttribute("data-timeline-role"),timelineLabel:O.getAttribute("data-timeline-label"),timelineGroup:O.getAttribute("data-timeline-group"),timelinePriority:pt(O.getAttribute("data-timeline-priority"))})}let ie=new Set(W.map(z=>z.id)),P=s?.getAttribute("data-composition-id")??null,H=P?n[P]??null:null;if(H&&s){let z=H;if(typeof z.getChildren=="function")try{let O=z.getChildren(!0,!0,!1)??[],B=new Map;for(let te of s.children){let J=te;if(!J.id)continue;let X=J.tagName.toLowerCase();X==="script"||X==="style"||X==="link"||B.set(J,{id:J.id,start:1/0,end:-1/0})}let ee=te=>{let J=te;for(;J;){if(B.has(J))return J;if(J===s)return null;J=J.parentElement}return null};for(let te of O){if(typeof te.targets!="function"||typeof te.startTime!="function"||typeof te.duration!="function")continue;let J=te.startTime(),X=te.parent;for(;X&&X!==H&&typeof X.startTime=="function";)J+=X.startTime(),X=X.parent;let Pe=J+te.duration();if(!(!Number.isFinite(J)||!Number.isFinite(Pe)))for(let Fe of te.targets()){if(!(Fe instanceof Element))continue;let cn=ee(Fe);if(!cn)continue;let Ce=B.get(cn);Ce&&(Ce.start=Math.min(Ce.start,J),Ce.end=Math.max(Ce.end,Pe))}}let K=W.length>0?Math.max(...W.map(te=>te.track))+1:0;for(let[te,J]of B){if(J.start===1/0||J.end===-1/0)continue;let X=te;if(ie.has(X.id))continue;let Pe=Math.max(0,J.end-J.start);if(Pe<=0)continue;let Fe=q(J.start,Pe);Fe<=0||(U=Math.max(U,J.start+Fe),W.push({id:X.id,label:X.getAttribute("data-timeline-label")??X.getAttribute("data-label")??X.getAttribute("aria-label")??X.id,start:J.start,duration:Fe,track:$o(X,K),zIndex:zo(X),stackingContextId:Yr(X),kind:"element",tagName:X.tagName.toLowerCase(),compositionId:X.getAttribute("data-composition-id"),compositionAncestors:P?[P]:[],parentCompositionId:P,nodePath:null,compositionSrc:null,playbackStart:$e(X),playbackRate:_e(X),assetUrl:null,timelineRole:X.getAttribute("data-timeline-role"),timelineLabel:X.getAttribute("data-timeline-label"),timelineGroup:X.getAttribute("data-timeline-group"),timelinePriority:pt(X.getAttribute("data-timeline-priority"))}),ie.add(X.id))}}catch(O){L("runtime.timeline.site1",O)}}if(s&&C!=null&&C>0){let z=W.length>0?Math.max(...W.map(O=>O.track))+1:0;for(let O of s.children){let B=O;if(!B.id||ie.has(B.id))continue;let ee=B.getAttribute("data-timeline-role");if(ee!=="overlay"&&ee!=="persistent-overlay")continue;let K=B.tagName.toLowerCase();if(K==="script"||K==="style"||K==="link"||K==="meta"||window.getComputedStyle(B).display==="none")continue;let J=q(0,C);J<=0||(U=Math.max(U,J),W.push({id:B.id,label:B.getAttribute("data-timeline-label")??B.getAttribute("data-label")??B.getAttribute("aria-label")??B.id,start:0,duration:J,track:$o(B,z),zIndex:zo(B),stackingContextId:Yr(B),kind:"element",tagName:K,compositionId:B.getAttribute("data-composition-id"),compositionAncestors:P?[P]:[],parentCompositionId:P,nodePath:null,compositionSrc:null,playbackStart:$e(B),playbackRate:_e(B),assetUrl:null,timelineRole:ee,timelineLabel:B.getAttribute("data-timeline-label"),timelineGroup:B.getAttribute("data-timeline-group"),timelinePriority:pt(B.getAttribute("data-timeline-priority"))}),ie.add(B.id))}}for(let z of u){if(z===s)continue;let O=z.getAttribute("data-composition-id");if(!O||!Wo(O))continue;let B=r.resolveStartForElement(z,0),ee=Vo(z);if((ee==null||ee<=0)&&_u(z)!=null){let X=_u(z);ee=Math.max(0,X-B)}let K=i(O),te=ee&&ee>0?ee:K;if(te==null||te<=0)continue;let J=q(B,te);J<=0||Y.push({id:O,label:z.getAttribute("data-label")??O,start:B,duration:J,thumbnailUrl:On(z.getAttribute("data-thumbnail-url")),avatarName:null})}let V=Math.max(1,U||1,C??0),j=S&&T==null,we=j?Number.POSITIVE_INFINITY:Math.max(1,Math.ceil(V*Math.max(1,e.canonicalFps)));return{..._r(e.canonicalFps),source:"hf-preview",type:"timeline",compositionContractVersion:1,durationSeconds:j?Number.POSITIVE_INFINITY:V,durationInFrames:we,clips:W,scenes:Y,compositionWidth:pt(s?.getAttribute("data-width"))??1920,compositionHeight:pt(s?.getAttribute("data-height"))??1080}}var jo="data-composition-id",m0="data-composition-src",p0=`[${jo}]`,iA=`[${m0}]`,ku="style",Mu="script",h0='link[rel="stylesheet"], link[rel="preconnect"]';function Kt(e){return e?Array.from(e):[]}function Fu(e){let{contentNode:t,head:n,documentElement:r,hasTemplate:i,compositionId:o}=e,a=Kt(t.querySelectorAll(p0)),l=o?a.find(c=>c.getAttribute(jo)===o)??null:a[0]??null,s=(l??a[0])?.getAttribute(jo)?.trim()||"",u=i?null:n??null;return{innerRoot:l,authoredCompositionId:o||s||null,scriptCompositionId:s||o||null,authoredRootId:l?.getAttribute("id")?.trim()||null,styleSources:[...Kt(u?.querySelectorAll(ku)),...Kt(t.querySelectorAll(ku))],scriptSources:[...Kt(u?.querySelectorAll(Mu)),...Kt(t.querySelectorAll(Mu))],linkSources:Kt(n?.querySelectorAll(h0)),variableDefaultCarriers:[r,l].filter(c=>c!=null)}}var pe=Qm(nd(),1),rd=pe.default,jA=pe.default.stringify,KA=pe.default.fromJSON,YA=pe.default.plugin,XA=pe.default.parse,JA=pe.default.list,QA=pe.default.document,ZA=pe.default.comment,eE=pe.default.atRule,tE=pe.default.rule,nE=pe.default.decl,rE=pe.default.root,iE=pe.default.CssSyntaxError,oE=pe.default.Declaration,aE=pe.default.Container,sE=pe.default.Processor,lE=pe.default.Document,uE=pe.default.Comment,cE=pe.default.Warning,dE=pe.default.AtRule,fE=pe.default.Result,mE=pe.default.Input,pE=pe.default.Rule,hE=pe.default.Root,gE=pe.default.Node;var ya="data-hf-authored-id",id="data-hf-inner-root";function va(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sa(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Og(e){return e&&e.replace(/[^a-zA-Z0-9_-]/g,n=>`\\${n}`).replace(/^-?\d/,n=>`\\${n}`)}function ad(e){let t=e.trim();return t?Array.from(new Set([t,Og(t)])).filter(Boolean):[]}function Hg(e){return!!e&&/[\w-]/.test(e)}function Gg(e,t,n){let r=ad(t).sort((l,s)=>s.length-l.length);if(r.length===0)return e;let i="",o=0,a=null;for(let l=0;l<e.length;l+=1){let s=e[l],u=l>0?e[l-1]:"";if(a){i+=s,s===a&&u!=="\\"&&(a=null);continue}if(s==='"'||s==="'"){a=s,i+=s;continue}if(s==="["){o+=1,i+=s;continue}if(s==="]"){o=Math.max(0,o-1),i+=s;continue}if(s==="#"&&o===0){let c=r.find(f=>e.startsWith(f,l+1));if(c){let f=e[l+1+c.length];if(!Hg(f)){i+=n,l+=c.length;continue}}}i+=s}return i}function Bg(e,t){let n=t?.trim();return n?Gg(e,n,`[${ya}="${Sa(n)}"]`):e}function od(e){return`${e}:not(:has([${id}])), ${e} > [${id}]`}function Ug(e,t,n,r,i,o){let a=Bg(e,r),l=Wg(a,t,n),s=l.trim();if(!s||s==="*")return e;if(/^(html|body|:root)$/i.test(s))return o?od(t):e;let u=new RegExp(`\\[\\s*data-composition-id\\s*=\\s*(["'])${va(n)}\\1\\s*\\]`,"g");if(u.test(s))return s.replace(u,"").trim()===""?od(t):l.replace(u,t);let c=l.match(/^\s*/)?.[0]??"",f=l.match(/\s*$/)?.[0]??"";if(i){let m=r?`[${ya}="${Sa(r)}"]`:null;if(m&&s.startsWith(m)){let p=s.slice(m.length);return`${c}${t}${m}${p}${f}`}}return`${c}${t} ${s}${f}`}function Wg(e,t,n){let r=va(n),i=String.raw`\[\s*data-composition-id\s*=\s*(?:"${r}"|'${r}')\s*\]`,o=String.raw`\s*\[\s*data-(?:start|duration)\s*=\s*(?:"[^"]*"|'[^']*')\s*\]`;return e.replace(new RegExp(`${i}(?:${o})+`,"g"),t).replace(new RegExp(`(?:${o})+${i}`,"g"),t)}var Vg=new Set(["keyframes","-webkit-keyframes","font-face"]);function zg(e){return e?.type==="atrule"}function qg(e){let t=e.parent;for(;t;){if(zg(t)&&Vg.has(t.name.toLowerCase()))return!0;t=t.parent}return!1}function $g(e){let t=e.parent;for(;t;){if(t.type==="rule")return!0;t=t.parent}return!1}function sd(e,t,n,r,i){let o=t.trim();if(!e||!o)return e;let a=n||`[data-composition-id="${Sa(o)}"]`,l=rd.parse(e);return l.walkRules(s=>{qg(s)||$g(s)||(s.selectors=s.selectors.map(u=>Ug(u,a,o,r,i?.compoundAuthoredRoot,i?.scopeRootSelectors)))}),l.toResult({map:!1}).css}function nt(e){return JSON.stringify(e).replace(/</g,"\\u003c")}function ld(e,t,n="[HyperFrames] composition script error:",r,i=t,o){let a=nt(t),l=nt(i),s=nt(n),u=va(t),c=nt(o?.trim()||null),f=nt(r??null),m=nt(String.raw`\[\s*data-composition-id\s*=\s*(?:"${u}"|'${u}')\s*\]`),p=nt(String.raw`\s*\[\s*data-(?:start|duration)\s*=\s*(?:"[^"]*"|'[^']*')\s*\]`),b=nt(ad(o?.trim()||""));return`(function(){
|
|
40
|
+
`),document.head.appendChild(r),document.body.classList.add("__hf-pick-active"),document.addEventListener("mousemove",_,!0),document.addEventListener("click",R,!0),document.addEventListener("keydown",T,!0),a("hyperframe:picker:mode",{isPickMode:!0,timestamp:Date.now()}))}function D(){t&&(t=!1,n&&(n.classList.remove("__hf-pick-highlight"),n=null),r&&(r.remove(),r=null),document.body.classList.remove("__hf-pick-active"),document.removeEventListener("mousemove",_,!0),document.removeEventListener("click",R,!0),document.removeEventListener("keydown",T,!0),a("hyperframe:picker:mode",{isPickMode:!1,timestamp:Date.now()}))}function E(){window.__HF_PICKER_API={enable:M,disable:D,isActive:()=>t,getHovered:()=>i,getSelected:()=>o,getCandidatesAtPoint:(S,A,C)=>Number.isFinite(S)&&Number.isFinite(A)?x(S,A,C):[],pickAtPoint:(S,A,C)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return null;let F=x(S,A,8);if(!F.length)return null;let I=Math.max(0,Math.min(F.length-1,Number(C??0))),q=F[I]??null;return q?(s(q),e.postMessage({source:"hf-preview",type:"element-picked",elementInfo:q}),D(),q):null},pickManyAtPoint:(S,A,C)=>{if(!Number.isFinite(S)||!Number.isFinite(A))return[];let F=x(S,A,8);if(!F.length)return[];let I=[],q=Array.isArray(C)?C:[0];for(let W of q){let Y=Math.max(0,Math.min(F.length-1,Math.floor(Number(W)))),k=F[Y];if(!k)continue;I.some(ie=>ie.selector===k.selector&&ie.tagName===k.tagName)||I.push(k)}return I.length?(s(I[0]??null),e.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:I}),D(),I):[]}},a("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:M,disablePickMode:D,installPickerApi:E}}var Uh=["width","height","top","left","right","bottom","inset","object-fit","object-position","z-index","opacity","visibility","filter","mix-blend-mode","backdrop-filter","border-radius","overflow","clip-path","mask","mask-image","mask-size","mask-position","mask-repeat","transform","transform-origin","translate","rotate","scale","box-sizing"];function $t(e,t){let n=Number.isFinite(t)&&t>0?t:30,r=Number.isFinite(e)&&e>0?e:0;return Math.floor(r*n+1e-9)/n}function vu(e,t,n=Uh){for(let r of n){let i=t.getPropertyValue(r);i&&e.setProperty(r,i)}}function Ln(e,t,n){let r=e?.[t];return typeof r=="function"?Number(r.call(e))||n:typeof r=="number"&&Number.isFinite(r)?r:(r!=null&&L("runtime.player.nonConformantNum",{prop:t,actual:typeof r}),n)}function Ue(e,t){let n=e?.[t];if(typeof n=="function"){n.call(e);return}n!==void 0&&L("runtime.player.nonConformantVoid",{method:t,actual:typeof n})}function Dn(e,t,n){if(e){for(let r of Object.values(e))if(!(!r||r===t))try{n(r)}catch(i){L("runtime.player.site1",i)}}}function Su(e,t,n,r){let i=$t(t,n),o=r?.suppressEvents===!0;return Ue(e,"pause"),typeof e.totalTime=="function"?e.totalTime(i,o):typeof e.seek=="function"&&e.seek(i,o),i}function Wh(e,t,n,r,i){let o=[];Dn(e,t,a=>{Ue(a,"play"),o.push(a)});try{return Su(t,n,r,i)}finally{for(let a of o)try{Ue(a,"pause")}catch(l){L("runtime.player.site2",l)}}}function Vh(e,t){Dn(e,t,n=>{Ue(n,"play")})}function Au(e){let t=e.transport;return t?{_timeline:null,play:()=>t.play(),pause:()=>t.pause(),seek:(n,r)=>t.seek(n,r),renderSeek:(n,r)=>t.renderSeek(n,r),getTime:()=>t.getTime(),getDuration:()=>t.getDuration(),isPlaying:()=>t.isPlaying(),setPlaybackRate:n=>t.setPlaybackRate(n),getPlaybackRate:()=>t.getPlaybackRate()}:{_timeline:null,play:()=>{let n=e.getTimeline();if(!n||e.getIsPlaying())return;let r=Math.max(0,Number(e.getSafeDuration?.()??Ln(n,"duration",0))||0);r>0&&Math.max(0,Ln(n,"time",0))>=r&&(Ue(n,"pause"),typeof n.seek=="function"&&n.seek(0,!1),e.onDeterministicSeek(0),e.setIsPlaying(!1),e.onSyncMedia(0,!1),e.onRenderFrameSeek(0)),typeof n.timeScale=="function"&&n.timeScale(e.getPlaybackRate()),Ue(n,"play"),Dn(e.getTimelineRegistry?.(),n,i=>{typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),Ue(i,"play")}),e.onDeterministicPlay(),e.setIsPlaying(!0),e.onShowNativeVideos(),e.onStatePost(!0)},pause:()=>{let n=e.getTimeline();if(!n)return;Ue(n,"pause"),Dn(e.getTimelineRegistry?.(),n,i=>{Ue(i,"pause")});let r=Math.max(0,Ln(n,"time",0));e.onDeterministicSeek(r),e.onDeterministicPause(),e.setIsPlaying(!1),e.onSyncMedia(r,!1),e.onRenderFrameSeek(r),e.onStatePost(!0)},seek:(n,r)=>{let i=e.getTimeline();if(!i)return;let o=Math.max(0,Number(n)||0),a=e.getIsPlaying(),l=Wh(e.getTimelineRegistry?.(),i,o,e.getCanonicalFps());e.onDeterministicSeek(l),r?.keepPlaying&&a?(typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),Ue(i,"play"),Dn(e.getTimelineRegistry?.(),i,s=>{typeof s.timeScale=="function"&&s.timeScale(e.getPlaybackRate()),Ue(s,"play")}),e.onDeterministicPlay(),e.onShowNativeVideos(),e.onSyncMedia(l,!0)):(e.setIsPlaying(!1),e.onSyncMedia(l,!1)),e.onRenderFrameSeek(l),e.onStatePost(!0)},renderSeek:(n,r)=>{let i=e.getTimeline(),o=e.getCanonicalFps(),a=i?(Vh(e.getTimelineRegistry?.(),i),Su(i,n,o,r)):$t(Math.max(0,Number(n)||0),o);e.onDeterministicSeek(a,r),e.setIsPlaying(!1),e.onSyncMedia(a,!1),e.onRenderFrameSeek(a),e.onStatePost(!0)},getTime:()=>Ln(e.getTimeline(),"time",0),getDuration:()=>Ln(e.getTimeline(),"duration",0),isPlaying:()=>e.getIsPlaying(),setPlaybackRate:n=>e.setPlaybackRate(n),getPlaybackRate:()=>e.getPlaybackRate()}}function Eu(){return{capturedTimeline:null,isPlaying:!1,currentTime:0,deterministicAdapters:[],canonicalFps:30,bridgeMuted:!1,bridgeVolume:1,mediaOutputMuted:!1,nativeMediaSyncDisabled:!1,webAudioMediaDisabled:!1,mediaAutoplayBlockedPosted:!1,mediaForceSyncNextTick:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,controlBridgeHandler:null,beforeUnloadHandler:null,injectedCompStyles:[],injectedCompScripts:[],injectedCompLinks:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,transportClock:null,transportRafId:null}}var zh=new Set(["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"]);function Bo(e){return e.id||e.getAttribute("data-hf-id")||null}function qh(e){return ve(e)}function $h(e,t){let n=e.getAttribute("data-composition-id");if(!n)return null;let r=Number(t[n]?.duration?.());return Number.isFinite(r)&&r>0?r:null}function jh(e){return!(e instanceof HTMLMediaElement)||!Number.isFinite(e.duration)?null:Qe(e,e.duration)}function Kh(e,t,n,r){let i=qh(e.getAttribute("data-duration"));return i!=null&&i>0?i:$h(e,t)??jh(e)??Math.max(0,n-r)}function Yh(e){for(let[t,n]of e){let r=t.parentElement;for(;r;){let i=e.get(r);if(i){n.parentId=i.id,i.children.push(n);break}r=r.parentElement}}}function wu(e){let{startResolver:t,timelineRegistry:n,rootDuration:r}=e,i=new Map,o=document.querySelector("[data-composition-id]"),a=0;for(let l of document.querySelectorAll("[data-start]")){if(l===o||zh.has(l.tagName))continue;let s=t.resolveStartForElement(l,0);if(Kh(l,n,r,s)<=0)continue;let u={id:Bo(l)??`__clip-${a++}`,element:l,parentId:null,children:[]};i.set(l,u)}return Yh(i),{roots:Array.from(i.values()).filter(l=>l.parentId===null)}}function In(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;let t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?t:null}function jt(e){let t=In(e.start);if(t==null)return null;let n=Math.max(0,t),r=In(e.duration),i=In(e.authoredDuration),o=r!=null&&r>0?r:i!=null&&i>0?i:null;if(o!=null)return{start:n,duration:o,end:n+o};let a=In(e.end),l=In(e.authoredEnd),s=a!=null&&a>n?a:l!=null&&l>n?l:null;return{start:n,duration:s==null?null:s-n,end:s}}var Uo="css:root",Cu=["backdrop-filter","clip-path","filter","mask","mask-border-source","mask-image","perspective","rotate","scale","transform","translate","-webkit-mask-image"],Xh=new Set([...Cu,"contain","isolation","mask-border","mix-blend-mode","opacity"]),Jh=new Set(["absolute","relative"]),Qh=new Set(["flex","inline-flex","grid","inline-grid"]),Zh=new Set(["layout","paint","strict","content"]),e0=new Set(["size","inline-size"]);function t0(e){return e.position==="fixed"||e.position==="sticky"}function n0(e,t){if(t.zIndex==="auto"||t.zIndex==="")return!1;if(Jh.has(t.position))return!0;let n=e.parentElement?e.ownerDocument.defaultView?.getComputedStyle(e.parentElement).display:null;return n!=null&&Qh.has(n)}function r0(e){let t=Number.parseFloat(e.opacity);if(Number.isFinite(t)&&t<1||e.getPropertyValue("isolation")==="isolate")return!0;let n=e.getPropertyValue("mix-blend-mode");return n&&n!=="normal"?!0:Cu.some(r=>{let i=e.getPropertyValue(r);return i!==""&&i!=="none"})}function i0(e){return e.getPropertyValue("contain").split(/\s+/).some(n=>Zh.has(n))?!0:e0.has(e.getPropertyValue("container-type"))}function o0(e){return e.getPropertyValue("will-change").split(",").map(t=>t.trim()).some(t=>Xh.has(t))}function a0(e,t){return t0(t)||n0(e,t)||r0(t)||i0(t)?!0:o0(t)}function s0(e){let t=[],n=e;for(;n?.parentElement;)t.push(Array.prototype.indexOf.call(n.parentElement.children,n)),n=n.parentElement;return`css:${t.reverse().join(".")}`}function Yr(e){let t=e.ownerDocument.defaultView;if(!t)return Uo;let n=e.parentElement;for(;n&&n!==e.ownerDocument.documentElement;){try{if(a0(n,t.getComputedStyle(n)))return s0(n)}catch{return Uo}n=n.parentElement}return Uo}function mt(e){let t=e.timelineRegistry??{},n=e.includeAuthoredTimingAttrs??!1,r=e.documentRef??document,i=new WeakMap,o=new WeakMap,a=new Set,l=m=>{let p=r.getElementById(m);return p||(r.querySelector(`[data-composition-id="${CSS.escape(m)}"]`)??null)},s=m=>{let p=m.ownerDocument.defaultView?.HTMLMediaElement;return p?m instanceof p:typeof HTMLMediaElement<"u"&&m instanceof HTMLMediaElement},u=m=>{let p=o.get(m);if(p!==void 0)return p;let b=null,v=jt({start:0,duration:m.getAttribute("data-duration"),authoredDuration:n?m.getAttribute("data-hf-authored-duration"):null});if(v?.duration!=null&&v.duration>0&&(b=v.duration),b==null||b<=0){let x=f(m,0),_=jt({start:x,end:m.getAttribute("data-end"),authoredEnd:n?m.getAttribute("data-hf-authored-end"):null});_?.duration!=null&&_.duration>0&&(b=_.duration)}if((b==null||b<=0)&&s(m)){let x=yn(m);Number.isFinite(m.duration)&&m.duration>x&&(b=(m.duration-x)/_e(m))}if(b==null||b<=0){let x=m.getAttribute("data-composition-id");if(x){let _=t[x]??null;if(_&&typeof _.duration=="function")try{let R=Number(_.duration());Number.isFinite(R)&&R>0&&(b=R)}catch(R){L("runtime.startResolver.site1",R)}}}return b!=null&&Number.isFinite(b)&&b>0?(o.set(m,b),b):(o.set(m,null),null)},c=(m,p)=>{if(m.hasAttribute("data-composition-id")){let v=m.parentElement?.closest("[data-composition-id]");return v?f(v,p):0}let b=m.closest("[data-composition-id]");return b?f(b,p):0},f=(m,p)=>{let b=i.get(m);if(b!==void 0)return b??p;if(a.has(m))return p;a.add(m);try{let v=lo(m.getAttribute("data-start"));if(!v){if(m.hasAttribute("data-composition-id")){let M=m.parentElement;if(M&&(M.hasAttribute("data-composition-src")||M.hasAttribute("data-composition-id")||M.hasAttribute("data-composition-file"))){let D=f(M,p);return i.set(m,D),D}}return i.set(m,p),p}if(v.kind==="absolute"){let M=Math.max(0,v.value),D=Math.max(0,c(m,p)+M);return i.set(m,D),D}let x=l(v.refId);if(!x)return i.set(m,p),p;let _=f(x,0),R=u(x);if(R==null||R<=0){let M=Math.max(0,_+v.offset);return i.set(m,M),M}let T=Math.max(0,_+R+v.offset);return i.set(m,T),T}finally{a.delete(m)}};return{resolveStartForElement:(m,p=0)=>f(m,Math.max(0,p)),resolveDurationForElement:m=>u(m)}}function Wo(e){let t=e.trim().toLowerCase();return!(!t||t==="main"||t.includes("caption")||t.includes("ambient"))}function pt(e){return ve(e)}function Vo(e){let t=e.getAttribute("data-duration"),n=e.getAttribute("data-hf-authored-duration"),r=jt({start:0,duration:t,authoredDuration:n})?.duration;return r??([t,n].map(pt).some(o=>o!=null&&o<=0)?0:null)}function _u(e){return jt({start:0,end:e.getAttribute("data-end"),authoredEnd:e.getAttribute("data-hf-authored-end")})?.end??null}function zo(e){try{let t=e.style?.zIndex;if(t&&t!=="auto"){let n=parseInt(t,10);if(Number.isFinite(n))return n}return 0}catch{return 0}}function qo(...e){let t=e.filter(n=>Number.isFinite(n??null));return t.length===0?null:Math.max(...t)}function $o(e,t){let n=e.getAttribute("data-track-index")??e.getAttribute("data-track");if(n==null)return t;let r=Number.parseInt(n,10);return Number.isFinite(r)?r:t}function On(e){let t=String(e??"").trim();if(!t)return null;let n=t.toLowerCase();if(n.startsWith("data:")||n.startsWith("javascript:"))return null;try{return new URL(t,document.baseURI).toString()}catch{return t}}function Tu(e){let t=e.getAttribute("src")??e.getAttribute("data-src");if(t)return On(t);let n=e.getAttribute("data-composition-src");if(n)return On(n);let r=e.querySelector("img[src], video[src], audio[src], source[src]");return r?On(r.getAttribute("src")):null}function u0(e){let t=e.className;return typeof t!="string"?null:t.split(/\s+/).map(n=>n.trim()).find(n=>n&&n!=="clip"&&!n.startsWith("__hf-"))??null}function c0(e){if(!e)return null;try{return new URL(e,document.baseURI).pathname.split("/").filter(Boolean).at(-1)??null}catch{return e.split(/[\\/]/).filter(Boolean).at(-1)??null}}function d0(e){let t=e.textContent?.replace(/\s+/g," ").trim();return t?t.length>32?`${t.slice(0,31)}...`:t:null}function Pn(e){let t=e.replace(/\.[^.]+$/i,"").replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t?t.replace(/\b\w/g,n=>n.toUpperCase()):e}function f0(e,t,n){let r=e.getAttribute("data-timeline-label")??e.getAttribute("data-label")??e.getAttribute("aria-label")??null;if(r?.trim())return r.trim();let i=e.getAttribute("data-composition-id");if(i)return Pn(i);let o=e.id;if(o)return Pn(o);let a=u0(e);if(a)return Pn(a);let l=c0(Tu(e));if(l)return Pn(l);let s=d0(e);return s||`${Pn(t)} ${n+1}`}function Ru(e){let n=window.__timelines??{},r=mt({timelineRegistry:n,includeAuthoredTimingAttrs:!0}),i=z=>{if(!z)return null;let O=n[z]??null;if(!O||typeof O.duration!="function")return null;try{let B=Number(O.duration());return Number.isFinite(B)&&B>0?B:null}catch{return null}},o=z=>{let O=pt(z.getAttribute("data-duration"));return O!=null&&O>0?O:Number.isFinite(z.duration)?Qe(z,z.duration):null},a=()=>{let z=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(z.length===0)return null;let O=0;for(let B of z){let ee=B.hasAttribute("data-hf-auto-start")?r.resolveStartForElement(B,0):Math.max(0,Number(B.getAttribute("data-start")??0)||0);if(!Number.isFinite(ee))continue;let K=o(B);K==null||K<=0||(O=Math.max(O,Math.max(0,ee)+K))}return O>0?O:null},l=(z,O)=>{let B=[],ee=null,K=null,te=null,J=z.parentElement;for(;J;){let X=J.getAttribute("data-composition-id");X&&(B.push(X),!te&&J!==O&&(te=X),ee==null&&(ee=r.resolveStartForElement(J,0)),K==null&&(K=pt(J.getAttribute("data-duration"))??i(X)??null)),J=J.parentElement}return{parentCompositionId:te,compositionAncestors:B.reverse(),inheritedStart:ee,inheritedDuration:K}},s=document.querySelector("[data-composition-id]"),u=Array.from(document.querySelectorAll("[data-composition-id]")),c=s?.getAttribute("data-composition-id")??null,f=s?r.resolveStartForElement(s,0):0,m=a(),p=m!=null?Math.max(0,m-Math.max(0,f)):null,b=i(c),v=Vo(s??document.body),x=qo(...u.filter(z=>z!==s).map(z=>{let O=r.resolveStartForElement(z,0),B=r.resolveDurationForElement(z)??i(z.getAttribute("data-composition-id"))??null;return!Number.isFinite(O)||B==null||B<=0?null:Math.max(0,O)+B})),_=x!=null?Math.max(0,x-Math.max(0,f)):null,R=typeof b=="number"&&Number.isFinite(b)&&b>0?b:null,T=typeof v=="number"&&Number.isFinite(v)&&v>0?v:null,M=typeof p=="number"&&Number.isFinite(p)&&p>0?p:null,D=typeof _=="number"&&Number.isFinite(_)&&_>0?_:null,E=qo(M,D),S=R!=null&&E!=null&&R>E+1,C=T??(S?E:qo(R,M,D))??null,I=(C!=null?f+C:null)??(typeof m=="number"&&Number.isFinite(m)&&m>0?m:null),q=(z,O)=>!Number.isFinite(O)||O<=0?0:I==null||!Number.isFinite(I)?O:!Number.isFinite(z)||z>=I?0:Math.max(0,Math.min(O,I-z)),W=[],Y=[],k=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),U=0;for(let[z,O]of k.entries()){if(O===s||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(O.tagName))continue;let B=l(O,s),ee=r.resolveStartForElement(O,B.inheritedStart??0),K=O.getAttribute("data-composition-id"),te=Vo(O);if(te==null&&K&&K!==c&&(te=i(K)),te==null&&O instanceof HTMLMediaElement&&Number.isFinite(O.duration)&&(te=Qe(O,O.duration)),te==null){let Fe=B.inheritedDuration;if(Fe!=null&&Fe>0){let Ce=(B.inheritedStart??0)+Fe;te=Math.max(0,Ce-ee)}}if(te==null||te<=0||(te=q(ee,te),te<=0))continue;let J=ee+te;U=Math.max(U,J);let X=O.tagName.toLowerCase(),Pe=K&&K!==c?"composition":X==="video"?"video":X==="audio"?"audio":X==="img"?"image":"element";W.push({id:Bo(O)??K??null,label:f0(O,Pe,W.length),start:ee,duration:te,track:$o(O,z),zIndex:zo(O),stackingContextId:Yr(O),kind:Pe,tagName:X,compositionId:O.getAttribute("data-composition-id"),compositionAncestors:B.compositionAncestors,parentCompositionId:B.parentCompositionId,nodePath:null,compositionSrc:On(O.getAttribute("data-composition-src")),playbackStart:$e(O),playbackRate:_e(O),assetUrl:Tu(O),timelineRole:O.getAttribute("data-timeline-role"),timelineLabel:O.getAttribute("data-timeline-label"),timelineGroup:O.getAttribute("data-timeline-group"),timelinePriority:pt(O.getAttribute("data-timeline-priority"))})}let ie=new Set(W.map(z=>z.id)),P=s?.getAttribute("data-composition-id")??null,H=P?n[P]??null:null;if(H&&s){let z=H;if(typeof z.getChildren=="function")try{let O=z.getChildren(!0,!0,!1)??[],B=new Map;for(let te of s.children){let J=te;if(!J.id)continue;let X=J.tagName.toLowerCase();X==="script"||X==="style"||X==="link"||B.set(J,{id:J.id,start:1/0,end:-1/0})}let ee=te=>{let J=te;for(;J;){if(B.has(J))return J;if(J===s)return null;J=J.parentElement}return null};for(let te of O){if(typeof te.targets!="function"||typeof te.startTime!="function"||typeof te.duration!="function")continue;let J=te.startTime(),X=te.parent;for(;X&&X!==H&&typeof X.startTime=="function";)J+=X.startTime(),X=X.parent;let Pe=J+te.duration();if(!(!Number.isFinite(J)||!Number.isFinite(Pe)))for(let Fe of te.targets()){if(!(Fe instanceof Element))continue;let cn=ee(Fe);if(!cn)continue;let Ce=B.get(cn);Ce&&(Ce.start=Math.min(Ce.start,J),Ce.end=Math.max(Ce.end,Pe))}}let K=W.length>0?Math.max(...W.map(te=>te.track))+1:0;for(let[te,J]of B){if(J.start===1/0||J.end===-1/0)continue;let X=te;if(ie.has(X.id))continue;let Pe=Math.max(0,J.end-J.start);if(Pe<=0)continue;let Fe=q(J.start,Pe);Fe<=0||(U=Math.max(U,J.start+Fe),W.push({id:X.id,label:X.getAttribute("data-timeline-label")??X.getAttribute("data-label")??X.getAttribute("aria-label")??X.id,start:J.start,duration:Fe,track:$o(X,K),zIndex:zo(X),stackingContextId:Yr(X),kind:"element",tagName:X.tagName.toLowerCase(),compositionId:X.getAttribute("data-composition-id"),compositionAncestors:P?[P]:[],parentCompositionId:P,nodePath:null,compositionSrc:null,playbackStart:$e(X),playbackRate:_e(X),assetUrl:null,timelineRole:X.getAttribute("data-timeline-role"),timelineLabel:X.getAttribute("data-timeline-label"),timelineGroup:X.getAttribute("data-timeline-group"),timelinePriority:pt(X.getAttribute("data-timeline-priority"))}),ie.add(X.id))}}catch(O){L("runtime.timeline.site1",O)}}if(s&&C!=null&&C>0){let z=W.length>0?Math.max(...W.map(O=>O.track))+1:0;for(let O of s.children){let B=O;if(!B.id||ie.has(B.id))continue;let ee=B.getAttribute("data-timeline-role");if(ee!=="overlay"&&ee!=="persistent-overlay")continue;let K=B.tagName.toLowerCase();if(K==="script"||K==="style"||K==="link"||K==="meta"||window.getComputedStyle(B).display==="none")continue;let J=q(0,C);J<=0||(U=Math.max(U,J),W.push({id:B.id,label:B.getAttribute("data-timeline-label")??B.getAttribute("data-label")??B.getAttribute("aria-label")??B.id,start:0,duration:J,track:$o(B,z),zIndex:zo(B),stackingContextId:Yr(B),kind:"element",tagName:K,compositionId:B.getAttribute("data-composition-id"),compositionAncestors:P?[P]:[],parentCompositionId:P,nodePath:null,compositionSrc:null,playbackStart:$e(B),playbackRate:_e(B),assetUrl:null,timelineRole:ee,timelineLabel:B.getAttribute("data-timeline-label"),timelineGroup:B.getAttribute("data-timeline-group"),timelinePriority:pt(B.getAttribute("data-timeline-priority"))}),ie.add(B.id))}}for(let z of u){if(z===s)continue;let O=z.getAttribute("data-composition-id");if(!O||!Wo(O))continue;let B=r.resolveStartForElement(z,0),ee=Vo(z);if((ee==null||ee<=0)&&_u(z)!=null){let X=_u(z);ee=Math.max(0,X-B)}let K=i(O),te=ee&&ee>0?ee:K;if(te==null||te<=0)continue;let J=q(B,te);J<=0||Y.push({id:O,label:z.getAttribute("data-label")??O,start:B,duration:J,thumbnailUrl:On(z.getAttribute("data-thumbnail-url")),avatarName:null})}let V=Math.max(1,U||1,C??0),j=S&&T==null,we=j?Number.POSITIVE_INFINITY:Math.max(1,Math.ceil(V*Math.max(1,e.canonicalFps)));return{..._r(e.canonicalFps),source:"hf-preview",type:"timeline",compositionContractVersion:1,durationSeconds:j?Number.POSITIVE_INFINITY:V,durationInFrames:we,clips:W,scenes:Y,compositionWidth:pt(s?.getAttribute("data-width"))??1920,compositionHeight:pt(s?.getAttribute("data-height"))??1080}}var jo="data-composition-id",m0="data-composition-src",p0=`[${jo}]`,iA=`[${m0}]`,ku="style",Mu="script",h0='link[rel="stylesheet"], link[rel="preconnect"]';function Kt(e){return e?Array.from(e):[]}function Fu(e){let{contentNode:t,head:n,documentElement:r,hasTemplate:i,compositionId:o}=e,a=Kt(t.querySelectorAll(p0)),l=o?a.find(c=>c.getAttribute(jo)===o)??null:a[0]??null,s=(l??a[0])?.getAttribute(jo)?.trim()||"",u=i?null:n??null;return{innerRoot:l,authoredCompositionId:o||s||null,scriptCompositionId:s||o||null,authoredRootId:l?.getAttribute("id")?.trim()||null,styleSources:[...Kt(u?.querySelectorAll(ku)),...Kt(t.querySelectorAll(ku))],scriptSources:[...Kt(u?.querySelectorAll(Mu)),...Kt(t.querySelectorAll(Mu))],linkSources:Kt(n?.querySelectorAll(h0)),variableDefaultCarriers:[r,l].filter(c=>c!=null)}}var pe=Qm(nd(),1),rd=pe.default,jA=pe.default.stringify,KA=pe.default.fromJSON,YA=pe.default.plugin,XA=pe.default.parse,JA=pe.default.list,QA=pe.default.document,ZA=pe.default.comment,eE=pe.default.atRule,tE=pe.default.rule,nE=pe.default.decl,rE=pe.default.root,iE=pe.default.CssSyntaxError,oE=pe.default.Declaration,aE=pe.default.Container,sE=pe.default.Processor,lE=pe.default.Document,uE=pe.default.Comment,cE=pe.default.Warning,dE=pe.default.AtRule,fE=pe.default.Result,mE=pe.default.Input,pE=pe.default.Rule,hE=pe.default.Root,gE=pe.default.Node;var ya="data-hf-authored-id",id="data-hf-inner-root";function va(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sa(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Og(e){return e&&e.replace(/[^a-zA-Z0-9_-]/g,n=>`\\${n}`).replace(/^-?\d/,n=>`\\${n}`)}function ad(e){let t=e.trim();return t?Array.from(new Set([t,Og(t)])).filter(Boolean):[]}function Hg(e){return!!e&&/[\w-]/.test(e)}function Gg(e,t,n){let r=ad(t).sort((l,s)=>s.length-l.length);if(r.length===0)return e;let i="",o=0,a=null;for(let l=0;l<e.length;l+=1){let s=e[l],u=l>0?e[l-1]:"";if(a){i+=s,s===a&&u!=="\\"&&(a=null);continue}if(s==='"'||s==="'"){a=s,i+=s;continue}if(s==="["){o+=1,i+=s;continue}if(s==="]"){o=Math.max(0,o-1),i+=s;continue}if(s==="#"&&o===0){let c=r.find(f=>e.startsWith(f,l+1));if(c){let f=e[l+1+c.length];if(!Hg(f)){i+=n,l+=c.length;continue}}}i+=s}return i}function Bg(e,t){let n=t?.trim();return n?Gg(e,n,`[${ya}="${Sa(n)}"]`):e}function od(e){return`${e}:not(:has([${id}])), ${e} > [${id}]`}function Ug(e,t,n,r,i,o){let a=Bg(e,r),l=Wg(a,t,n),s=l.trim();if(!s||s==="*")return e;if(/^(html|body|:root)$/i.test(s))return o?od(t):e;let u=new RegExp(`\\[\\s*data-composition-id\\s*=\\s*(["'])${va(n)}\\1\\s*\\]`,"g");if(u.test(s))return s.replace(u,"").trim()===""?od(t):l.replace(u,t);let c=l.match(/^\s*/)?.[0]??"",f=l.match(/\s*$/)?.[0]??"";if(i){let m=r?`[${ya}="${Sa(r)}"]`:null;if(m&&s.startsWith(m)){let p=s.slice(m.length);return`${c}${t}${m}${p}${f}`}}return`${c}${t} ${s}${f}`}function Wg(e,t,n){let r=va(n),i=String.raw`\[\s*data-composition-id\s*=\s*(?:"${r}"|'${r}')\s*\]`,o=String.raw`\s*\[\s*data-(?:start|duration)\s*=\s*(?:"[^"]*"|'[^']*')\s*\]`;return e.replace(new RegExp(`${i}(?:${o})+`,"g"),t).replace(new RegExp(`(?:${o})+${i}`,"g"),t)}var Vg=new Set(["keyframes","-webkit-keyframes","font-face"]);function zg(e){return e?.type==="atrule"}function qg(e){let t=e.parent;for(;t;){if(zg(t)&&Vg.has(t.name.toLowerCase()))return!0;t=t.parent}return!1}function $g(e){let t=e.parent;for(;t;){if(t.type==="rule")return!0;t=t.parent}return!1}function sd(e,t,n,r,i){let o=t.trim();if(!e||!o)return e;let a=n||`[data-composition-id="${Sa(o)}"]`,l;try{l=rd.parse(e)}catch{return""}return l.walkRules(s=>{qg(s)||$g(s)||(s.selectors=s.selectors.map(u=>Ug(u,a,o,r,i?.compoundAuthoredRoot,i?.scopeRootSelectors)))}),l.toResult({map:!1}).css}function nt(e){return JSON.stringify(e).replace(/</g,"\\u003c")}function ld(e,t,n="[HyperFrames] composition script error:",r,i=t,o){let a=nt(t),l=nt(i),s=nt(n),u=va(t),c=nt(o?.trim()||null),f=nt(r??null),m=nt(String.raw`\[\s*data-composition-id\s*=\s*(?:"${u}"|'${u}')\s*\]`),p=nt(String.raw`\s*\[\s*data-(?:start|duration)\s*=\s*(?:"[^"]*"|'[^']*')\s*\]`),b=nt(ad(o?.trim()||""));return`(function(){
|
|
41
41
|
var __hfCompId = ${a};
|
|
42
42
|
var __hfTimelineCompId = ${l};
|
|
43
43
|
var __hfErrorLabel = ${s};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.1.0",
|
|
3
3
|
"buildId": "dev",
|
|
4
|
-
"sha256": "
|
|
4
|
+
"sha256": "bf98a5384bd0b78d53fe2f8a5dc186d91f4c41a01d00efc370f9d34be77c78db",
|
|
5
5
|
"artifacts": {
|
|
6
6
|
"iife": "hyperframe.runtime.iife.js",
|
|
7
7
|
"esm": "hyperframe.runtime.mjs"
|