@hyperframes/producer 0.1.13 → 0.1.15
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.1.0",
|
|
3
3
|
"buildId": "dev",
|
|
4
|
-
"sha256": "
|
|
4
|
+
"sha256": "9c1a1638c1ed6318cc730de0fc1540490b7261d6f0b99d62bcd1cfef562b3021",
|
|
5
5
|
"artifacts": {
|
|
6
6
|
"iife": "hyperframe.runtime.iife.js",
|
|
7
7
|
"esm": "hyperframe.runtime.mjs"
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
"use strict";(()=>{function
|
|
1
|
+
"use strict";(()=>{function le(e){try{window.parent.postMessage(e,"*")}catch{}}function ft(e){let t=n=>{let r=n.data;if(!r||r.source!=="hf-parent"||r.type!=="control")return;let o=r.action;if(o==="play"){e.onPlay();return}if(o==="pause"){e.onPause();return}if(o==="seek"){e.onSeek(Number(r.frame??0),r.seekMode??"commit");return}if(o==="set-muted"){e.onSetMuted(!!r.muted);return}if(o==="set-playback-rate"){e.onSetPlaybackRate(Number(r.playbackRate??1));return}if(o==="enable-pick-mode"){e.onEnablePickMode();return}if(o==="disable-pick-mode"){e.onDisablePickMode();return}if(o==="flash-elements"){let i=r.selectors,u=r.duration||800;i&&tn(i,u)}};return window.addEventListener("message",t),t}function tn(e,t){if(!document.getElementById("__hf-flash-styles")){let n=document.createElement("style");n.id="__hf-flash-styles",n.textContent=`
|
|
2
2
|
.__hf-flash {
|
|
3
3
|
outline: 2px solid rgba(59, 130, 246, 0.6) !important;
|
|
4
4
|
outline-offset: 2px !important;
|
|
5
|
-
animation: __hf-flash-pulse ${
|
|
5
|
+
animation: __hf-flash-pulse ${t}ms ease-out forwards !important;
|
|
6
6
|
}
|
|
7
7
|
@keyframes __hf-flash-pulse {
|
|
8
8
|
0% { outline-color: rgba(59, 130, 246, 0.8); }
|
|
9
9
|
100% { outline-color: transparent; }
|
|
10
10
|
}
|
|
11
|
-
`,document.head.appendChild(
|
|
12
|
-
`),document.head.appendChild(a),document.body.classList.add("__hf-pick-active"),document.addEventListener("mousemove",X,!0),document.addEventListener("click",V,!0),document.addEventListener("keydown",ae,!0),b("hyperframe:picker:mode",{isPickMode:!0,timestamp:Date.now()}))}function oe(){n&&(n=!1,i&&(i.classList.remove("__hf-pick-highlight"),i=null),a&&(a.remove(),a=null),document.body.classList.remove("__hf-pick-active"),document.removeEventListener("mousemove",X,!0),document.removeEventListener("click",V,!0),document.removeEventListener("keydown",ae,!0),b("hyperframe:picker:mode",{isPickMode:!1,timestamp:Date.now()}))}function de(){window.__HF_PICKER_API={enable:ce,disable:oe,isActive:()=>n,getHovered:()=>u,getSelected:()=>p,getCandidatesAtPoint:(c,g,A)=>Number.isFinite(c)&&Number.isFinite(g)?x(c,g,A):[],pickAtPoint:(c,g,A)=>{if(!Number.isFinite(c)||!Number.isFinite(g))return null;let H=x(c,g,8);if(!H.length)return null;let P=Math.max(0,Math.min(H.length-1,Number(A??0))),R=H[P]??null;return R?(s(R),e.postMessage({source:"hf-preview",type:"element-picked",elementInfo:R}),oe(),R):null},pickManyAtPoint:(c,g,A)=>{if(!Number.isFinite(c)||!Number.isFinite(g))return[];let H=x(c,g,8);if(!H.length)return[];let P=[],R=Array.isArray(A)?A:[0];for(let J of R){let z=Math.max(0,Math.min(H.length-1,Math.floor(Number(J)))),I=H[z];if(!I)continue;P.some(L=>L.selector===I.selector&&L.tagName===I.tagName)||P.push(I)}return P.length?(s(P[0]??null),e.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:P}),oe(),P):[]}},b("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:ce,disablePickMode:oe,installPickerApi:de}}function Xe(e,n){let i=Number.isFinite(n)&&n>0?n:30,a=Number.isFinite(e)&&e>0?e:0;return Math.floor(a*i+1e-9)/i}function Qe(e,n,i){let a=Xe(n,i);return e.pause(),typeof e.totalTime=="function"?e.totalTime(a,!1):e.seek(a,!1),a}function et(e){return{_timeline:null,play:()=>{let n=e.getTimeline();if(!n||e.getIsPlaying())return;let i=Math.max(0,Number(e.getSafeDuration?.()??n.duration()??0)||0);i>0&&Math.max(0,Number(n.time())||0)>=i&&(n.pause(),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()),n.play(),e.onDeterministicPlay(),e.setIsPlaying(!0),e.onShowNativeVideos(),e.onStatePost(!0)},pause:()=>{let n=e.getTimeline();if(!n)return;n.pause();let i=Math.max(0,Number(n.time())||0);e.onDeterministicSeek(i),e.onDeterministicPause(),e.setIsPlaying(!1),e.onSyncMedia(i,!1),e.onRenderFrameSeek(i),e.onStatePost(!0)},seek:n=>{let i=e.getTimeline();if(!i)return;let a=Math.max(0,Number(n)||0),u=Qe(i,a,e.getCanonicalFps());e.onDeterministicSeek(u),e.setIsPlaying(!1),e.onSyncMedia(u,!1),e.onRenderFrameSeek(u),e.onStatePost(!0)},renderSeek:n=>{let i=e.getTimeline();if(!i)return;let a=Qe(i,n,e.getCanonicalFps());e.onDeterministicSeek(a),e.setIsPlaying(!1),e.onSyncMedia(a,!1),e.onRenderFrameSeek(a),e.onStatePost(!0)},getTime:()=>Number(e.getTimeline()?.time()??0),getDuration:()=>Number(e.getTimeline()?.duration()??0),isPlaying:()=>e.getIsPlaying(),setPlaybackRate:n=>e.setPlaybackRate(n),getPlaybackRate:()=>e.getPlaybackRate()}}function tt(){return{capturedTimeline:null,isPlaying:!1,rafId:null,currentTime:0,deterministicAdapters:[],parityModeEnabled:!0,canonicalFps:30,bridgeMuted:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,timelinePollIntervalId:null,controlBridgeHandler:null,clampDurationLoggedRaw:null,beforeUnloadHandler:null,domReadyHandler:null,injectedCompStyles:[],injectedCompScripts:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,maxTimelineDurationSeconds:1800,nativeVisualWatchdogTick:0}}function Te(e){let n=Number(e);return Number.isFinite(n)?n:null}function pt(e){let n=(e??"").trim();if(!n)return null;let i=Te(n);if(i!=null)return{kind:"absolute",value:i};let a=n.match(/^([A-Za-z0-9_.:-]+)(?:\s*([+-])\s*([0-9]*\.?[0-9]+))?$/);if(!a)return null;let u=(a[1]??"").trim();if(!u)return null;let p=a[2]??"+",b=a[3]??"0",f=Number.parseFloat(b),s=Number.isFinite(f)?Math.max(0,f):0,y=p==="-"?-s:s;return{kind:"reference",refId:u,offset:y}}function be(e){let n=e.timelineRegistry??{},i=new WeakMap,a=new WeakMap,u=new Set,p=s=>{let y=document.getElementById(s);return y||(document.querySelector(`[data-composition-id="${CSS.escape(s)}"]`)??null)},b=s=>{let y=a.get(s);if(y!==void 0)return y;let h=null,D=Te(s.getAttribute("data-duration"));if(D!=null&&D>0&&(h=D),h==null||h<=0){let k=Te(s.getAttribute("data-end"));if(k!=null){let B=f(s,0),x=k-B;Number.isFinite(x)&&x>0&&(h=x)}}if((h==null||h<=0)&&s instanceof HTMLMediaElement){let k=Te(s.getAttribute("data-playback-start"))??Te(s.getAttribute("data-media-start"))??0;Number.isFinite(s.duration)&&s.duration>k&&(h=s.duration-k)}if(h==null||h<=0){let k=s.getAttribute("data-composition-id");if(k){let B=n[k]??null;if(B&&typeof B.duration=="function")try{let x=Number(B.duration());Number.isFinite(x)&&x>0&&(h=x)}catch{}}}return h!=null&&Number.isFinite(h)&&h>0?(a.set(s,h),h):(a.set(s,null),null)},f=(s,y)=>{let h=i.get(s);if(h!==void 0)return h??y;if(u.has(s))return y;u.add(s);try{let D=pt(s.getAttribute("data-start"));if(!D){if(s.hasAttribute("data-composition-id")){let V=s.parentElement;if(V&&(V.hasAttribute("data-composition-src")||V.hasAttribute("data-composition-id"))){let ae=f(V,y);return i.set(s,ae),ae}}return i.set(s,y),y}if(D.kind==="absolute"){let V=Math.max(0,D.value);return i.set(s,V),V}let k=p(D.refId);if(!k)return i.set(s,y),y;let B=f(k,0),x=b(k);if(x==null||x<=0){let V=Math.max(0,B+D.offset);return i.set(s,V),V}let X=Math.max(0,B+x+D.offset);return i.set(s,X),X}finally{u.delete(s)}};return{resolveStartForElement:(s,y=0)=>f(s,Math.max(0,y)),resolveDurationForElement:s=>b(s)}}function ne(e){let n=Number(e);return Number.isFinite(n)?n:null}var nt={composition:0,video:1,image:2,element:3,audio:4};function gt(e){if(e.length===0)return;let n=new Map;for(let b of e){let f=n.get(b.track)??new Set;f.add(b.kind),n.set(b.track,f)}if(!Array.from(n.values()).some(b=>b.size>1))return;let a=0,u=new Map,p=[...n.keys()].sort((b,f)=>b-f);for(let b of p){let f=n.get(b);if(f.size===1)u.set(`${b}:${[...f][0]}`,a++);else{let s=[...f].sort((y,h)=>(nt[y]??99)-(nt[h]??99));for(let y of s)u.set(`${b}:${y}`,a++)}}for(let b of e){let f=`${b.track}:${b.kind}`,s=u.get(f);s!=null&&(b.track=s)}}function Ee(e){let n=String(e??"").trim();if(!n)return null;let i=n.toLowerCase();if(i.startsWith("data:")||i.startsWith("javascript:"))return null;try{return new URL(n,document.baseURI).toString()}catch{return n}}function yt(e){let n=e.getAttribute("src")??e.getAttribute("data-src");if(n)return Ee(n);let i=e.getAttribute("data-composition-src");if(i)return Ee(i);let a=e.querySelector("img[src], video[src], audio[src], source[src]");return a?Ee(a.getAttribute("src")):null}function it(e){let i=window.__timelines??{},a=be({timelineRegistry:i}),u=E=>{if(!E)return null;let d=i[E]??null;if(!d||typeof d.duration!="function")return null;try{let S=Number(d.duration());return Number.isFinite(S)&&S>0?S:null}catch{return null}},p=E=>{let d=ne(E.getAttribute("data-duration"));if(d!=null&&d>0)return d;let S=ne(E.getAttribute("data-playback-start"))??ne(E.getAttribute("data-media-start"))??0;return Number.isFinite(E.duration)&&E.duration>S?Math.max(0,E.duration-S):null},b=()=>{let E=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(E.length===0)return null;let d=0;for(let S of E){let N=a.resolveStartForElement(S,0);if(!Number.isFinite(N))continue;let F=p(S);F==null||F<=0||(d=Math.max(d,Math.max(0,N)+F))}return d>0?d:null},f=E=>{let d=E.trim().toLowerCase();return!(!d||d==="main"||d.includes("caption")||d.includes("ambient"))},s=(E,d)=>{let S=[],N=null,F=null,T=null,w=E.parentElement;for(;w;){let M=w.getAttribute("data-composition-id");M&&(S.push(M),!T&&w!==d&&(T=M),N==null&&(N=a.resolveStartForElement(w,0)),F==null&&(F=ne(w.getAttribute("data-duration"))??u(M)??null)),w=w.parentElement}return{parentCompositionId:T,compositionAncestors:S.reverse(),inheritedStart:N,inheritedDuration:F}},y=document.querySelector("[data-composition-id]"),h=y?.getAttribute("data-composition-id")??null,D=y?a.resolveStartForElement(y,0):0,k=b(),B=k!=null?Math.max(0,k-Math.max(0,D)):null,x=u(h),X=ne(y?.getAttribute("data-duration")),V=typeof x=="number"&&Number.isFinite(x)&&x>0?x:null,ae=typeof X=="number"&&Number.isFinite(X)&&X>0?X:null,ce=typeof B=="number"&&Number.isFinite(B)&&B>0?B:null,oe=V!=null&&ce!=null&&V>ce+1,de=ae??(oe?ce:V??ce),c=de!=null?Math.min(de,e.maxTimelineDurationSeconds):null,A=(c!=null?D+c:null)??(typeof k=="number"&&Number.isFinite(k)&&k>0?k:null),H=(E,d)=>!Number.isFinite(d)||d<=0?0:A==null||!Number.isFinite(A)?d:!Number.isFinite(E)||E>=A?0:Math.max(0,Math.min(d,A-E)),P=Array.from(document.querySelectorAll("[data-composition-id]")),R=[],J=[],z=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),I=0;for(let E=0;E<z.length;E+=1){let d=z[E];if(d===y||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(d.tagName))continue;let S=s(d,y),N=a.resolveStartForElement(d,S.inheritedStart??0),F=d.getAttribute("data-composition-id"),T=ne(d.getAttribute("data-duration"));if((T==null||T<=0)&&F&&F!==h&&(T=u(F)),(T==null||T<=0)&&d instanceof HTMLMediaElement){let Q=ne(d.getAttribute("data-playback-start"))??ne(d.getAttribute("data-media-start"))??0;Number.isFinite(d.duration)&&d.duration>0&&(T=Math.max(0,d.duration-Q))}if(T==null||T<=0){let Q=S.inheritedDuration;if(Q!=null&&Q>0){let le=(S.inheritedStart??0)+Q;T=Math.max(0,le-N)}}if(T==null||T<=0||(T=H(N,T),T<=0))continue;let w=N+T;I=Math.max(I,w);let M=d.tagName.toLowerCase(),se=F&&F!==h?"composition":M==="video"?"video":M==="audio"?"audio":M==="img"?"image":"element";R.push({id:d.id||F||`__node__index_${E}`,label:d.getAttribute("data-timeline-label")??d.getAttribute("data-label")??d.getAttribute("aria-label")??F??d.id??d.className?.split(" ")[0]??se,start:N,duration:T,track:Number.parseInt(d.getAttribute("data-track-index")??d.getAttribute("data-track")??String(E),10)||0,kind:se,tagName:M,compositionId:d.getAttribute("data-composition-id"),compositionAncestors:S.compositionAncestors,parentCompositionId:S.parentCompositionId,nodePath:null,compositionSrc:Ee(d.getAttribute("data-composition-src")),assetUrl:yt(d),timelineRole:d.getAttribute("data-timeline-role"),timelineLabel:d.getAttribute("data-timeline-label"),timelineGroup:d.getAttribute("data-timeline-group"),timelinePriority:ne(d.getAttribute("data-timeline-priority"))})}let q=new Set(R.map(E=>E.id)),L=y?.getAttribute("data-composition-id")??null,Ae=L?i[L]??null:null;if(Ae&&y){let E=Ae;if(typeof E.getChildren=="function")try{let d=E.getChildren(!0,!0,!1)??[],S=new Map;for(let T of y.children){let w=T;if(!w.id)continue;let M=w.tagName.toLowerCase();M==="script"||M==="style"||M==="link"||S.set(w,{id:w.id,start:1/0,end:-1/0})}let N=T=>{let w=T;for(;w;){if(S.has(w))return w;if(w===y)return null;w=w.parentElement}return null};for(let T of d){if(typeof T.targets!="function"||typeof T.startTime!="function"||typeof T.duration!="function")continue;let w=T.startTime(),M=T.parent;for(;M&&typeof M.startTime=="function";)w+=M.startTime(),M=M.parent;let se=w+T.duration();if(!(!Number.isFinite(w)||!Number.isFinite(se)))for(let Q of T.targets()){if(!(Q instanceof Element))continue;let re=N(Q);if(!re)continue;let le=S.get(re);le&&(le.start=Math.min(le.start,w),le.end=Math.max(le.end,se))}}let F=R.length>0?Math.max(...R.map(T=>T.track))+1:0;for(let[T,w]of S){if(w.start===1/0||w.end===-1/0)continue;let M=T;if(q.has(M.id))continue;let se=Math.max(0,w.end-w.start);if(se<=0)continue;let Q=H(w.start,se);Q<=0||(I=Math.max(I,w.start+Q),R.push({id:M.id,label:M.getAttribute("data-timeline-label")??M.getAttribute("data-label")??M.getAttribute("aria-label")??M.id,start:w.start,duration:Q,track:Number.parseInt(M.getAttribute("data-track-index")??M.getAttribute("data-track")??"",10)||F,kind:"element",tagName:M.tagName.toLowerCase(),compositionId:M.getAttribute("data-composition-id"),compositionAncestors:L?[L]:[],parentCompositionId:L,nodePath:null,compositionSrc:null,assetUrl:null,timelineRole:M.getAttribute("data-timeline-role"),timelineLabel:M.getAttribute("data-timeline-label"),timelineGroup:M.getAttribute("data-timeline-group"),timelinePriority:ne(M.getAttribute("data-timeline-priority"))}),q.add(M.id))}}catch{}}if(y&&c!=null&&c>0){let E=R.length>0?Math.max(...R.map(d=>d.track))+1:0;for(let d of y.children){let S=d;if(!S.id||q.has(S.id))continue;let N=S.tagName.toLowerCase();if(N==="script"||N==="style"||N==="link"||N==="meta"||window.getComputedStyle(S).display==="none")continue;let T=H(0,c);T<=0||(I=Math.max(I,T),R.push({id:S.id,label:S.getAttribute("data-timeline-label")??S.getAttribute("data-label")??S.getAttribute("aria-label")??S.id,start:0,duration:T,track:Number.parseInt(S.getAttribute("data-track-index")??S.getAttribute("data-track")??"",10)||E,kind:"element",tagName:N,compositionId:S.getAttribute("data-composition-id"),compositionAncestors:L?[L]:[],parentCompositionId:L,nodePath:null,compositionSrc:null,assetUrl:null,timelineRole:S.getAttribute("data-timeline-role"),timelineLabel:S.getAttribute("data-timeline-label"),timelineGroup:S.getAttribute("data-timeline-group"),timelinePriority:ne(S.getAttribute("data-timeline-priority"))}),q.add(S.id))}}gt(R);for(let E of P){if(E===y)continue;let d=E.getAttribute("data-composition-id");if(!d||!f(d))continue;let S=a.resolveStartForElement(E,0),N=ne(E.getAttribute("data-duration")),F=u(d),T=N&&N>0?N:F;if(T==null||T<=0)continue;let w=H(S,T);w<=0||J.push({id:d,label:E.getAttribute("data-label")??d,start:S,duration:w,thumbnailUrl:Ee(E.getAttribute("data-thumbnail-url")),avatarName:null})}let ve=Math.max(1,Math.min(I||1,e.maxTimelineDurationSeconds));return{source:"hf-preview",type:"timeline",durationInFrames:oe&&ae==null?Number.POSITIVE_INFINITY:Math.max(1,Math.round(ve*Math.max(1,e.canonicalFps))),clips:R,scenes:J,compositionWidth:ne(y?.getAttribute("data-width"))??1920,compositionHeight:ne(y?.getAttribute("data-height"))??1080}}var bt=/^(?![a-zA-Z][a-zA-Z\d+\-.]*:)(?!\/\/)(?!\/)(?!\.\.?\/).+/,ht=e=>new Promise(n=>{let i=!1,a=Date.now(),u=null,p=b=>{i||(i=!0,u!=null&&window.clearTimeout(u),n({status:b,elapsedMs:Math.max(0,Date.now()-a)}))};e.addEventListener("load",()=>p("load"),{once:!0}),e.addEventListener("error",()=>p("error"),{once:!0}),u=window.setTimeout(()=>p("timeout"),8e3)});function ot(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.textContent=""}function St(e,n){let i=e.trim();if(!i)return e;try{return bt.test(i)?new URL(i,document.baseURI).toString():n?new URL(i,n).toString():new URL(i,document.baseURI).toString()}catch{return e}}async function rt(e){let n=null;e.hostCompositionId&&(n=Array.from(e.sourceNode.querySelectorAll("[data-composition-id]")).find(s=>s.getAttribute("data-composition-id")===e.hostCompositionId)??null);let i=n??e.sourceNode,a=Array.from(i.querySelectorAll("style"));for(let f of a){let s=f.cloneNode(!0);s instanceof HTMLStyleElement&&(document.head.appendChild(s),e.injectedStyles.push(s))}let u=Array.from(i.querySelectorAll("script")),p=[];for(let f of u){let s=f.getAttribute("type")?.trim()??"",y=f.getAttribute("src")?.trim()??"";if(y){let h=St(y,e.compositionUrl);p.push({kind:"external",src:h,type:s})}else{let h=f.textContent?.trim()??"";h&&p.push({kind:"inline",content:h,type:s})}f.parentNode?.removeChild(f)}let b=Array.from(i.querySelectorAll("style"));for(let f of b)f.parentNode?.removeChild(f);if(n){let f=document.importNode(n,!0),s=n.getAttribute("data-width"),y=n.getAttribute("data-height"),h=e.parseDimensionPx(s),D=e.parseDimensionPx(y);f.style.position="relative",f.style.width=h||"100%",f.style.height=D||"100%",h&&f.style.setProperty("--comp-width",h),D&&f.style.setProperty("--comp-height",D),s&&e.host.setAttribute("data-width",s),y&&e.host.setAttribute("data-height",y),h&&e.host instanceof HTMLElement&&(e.host.style.width=h),D&&e.host instanceof HTMLElement&&(e.host.style.height=D),e.host.appendChild(f)}else e.hasTemplate?e.host.appendChild(document.importNode(i,!0)):e.host.innerHTML=e.fallbackBodyInnerHtml;for(let f of p){let s=document.createElement("script");if(f.type&&(s.type=f.type),s.async=!1,f.kind==="external"?s.src=f.src:f.type.toLowerCase()==="module"?s.textContent=f.content:s.textContent=`(function(){${f.content}})();`,document.body.appendChild(s),e.injectedScripts.push(s),f.kind==="external"){let y=await ht(s);y.status!=="load"&&e.onDiagnostic?.({code:"external_composition_script_load_issue",details:{hostCompositionId:e.hostCompositionId,hostCompositionSrc:e.hostCompositionSrc,resolvedScriptSrc:f.src,loadStatus:y.status,elapsedMs:y.elapsedMs}})}}}async function at(e){let n=Array.from(document.querySelectorAll("[data-composition-src]"));n.length!==0&&await Promise.all(n.map(async i=>{let a=i.getAttribute("data-composition-src");if(!a)return;let u=null;try{u=new URL(a,document.baseURI)}catch{u=null}ot(i);try{let p=i.getAttribute("data-composition-id"),b=p!=null?document.querySelector(`template#${CSS.escape(p)}-template`):null;if(b){await rt({host:i,hostCompositionId:p,hostCompositionSrc:a,sourceNode:b.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic});return}let f=await fetch(a);if(!f.ok)throw new Error(`HTTP ${f.status}`);let s=await f.text(),h=new DOMParser().parseFromString(s,"text/html"),D=(p?h.querySelector(`template#${CSS.escape(p)}-template`):null)??h.querySelector("template"),k=D?D.content:h.body;await rt({host:i,hostCompositionId:p,hostCompositionSrc:a,sourceNode:k,hasTemplate:!!D,fallbackBodyInnerHtml:h.body.innerHTML,compositionUrl:u,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic})}catch(p){e.onDiagnostic?.({code:"external_composition_load_failed",details:{hostCompositionId:i.getAttribute("data-composition-id"),hostCompositionSrc:a,errorMessage:p instanceof Error?p.message:"unknown_error"}}),ot(i)}}))}function st(){let e=tt(),n=window,i=null,a=null,u=[],p=new Set,b=null;if(typeof n.__hfRuntimeTeardown=="function")try{n.__hfRuntimeTeardown()}catch{}document.documentElement&&(document.documentElement.style.margin="0",document.documentElement.style.padding="0",document.documentElement.style.overflow="hidden"),document.body&&(document.body.style.margin="0",document.body.style.padding="0",document.body.style.overflow="hidden"),window.__timelines=window.__timelines||{};let f=t=>{u.push(t)},s=(t,r,o)=>{let m=o??`${t}:${JSON.stringify(r)}`;p.has(m)||(p.add(m),te({source:"hf-preview",type:"diagnostic",code:t,details:r}))},y=t=>{let r={scale:1,focusX:960,focusY:540},o=[],m=[],l={time:t.getTime(),duration:t.getDuration(),isPlaying:t.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:t.play,pause:t.pause,seek:t.seek,getTime:t.getTime,getDuration:t.getDuration,isPlaying:t.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>r,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>o,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:t.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>m,getRenderState:()=>({...l,time:t.getTime(),duration:t.getDuration(),isPlaying:t.isPlaying()})}},h=1/60,D=.75,k=.75,B=.35,x=900,X=3,V=2,ae=.05,ce=100,oe=240,de=t=>{if(t instanceof Error)return t.message||String(t);if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t??"")}},c=t=>{let r=t.toLowerCase();return r.includes("cannot read properties of null")||r.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:r.includes("failed to execute 'queryselector'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:r.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},g=t=>{if(t==null||t.trim()==="")return null;let r=Number.parseFloat(t);return!Number.isFinite(r)||r<=0?null:`${r}px`},A=()=>{let t=document.querySelector('[data-composition-id][data-root="true"]');if(t instanceof HTMLElement)return t;let r=Array.from(document.querySelectorAll("[data-composition-id]"));return r.length===0?null:r.find(o=>!o.parentElement?.closest("[data-composition-id]"))??r[0]??null},H=()=>{let t=A();if(!t)return;let r=g(t.getAttribute("data-width")),o=g(t.getAttribute("data-height"));r&&(t.style.width=r),o&&(t.style.height=o),r&&t.style.setProperty("--comp-width",r),o&&t.style.setProperty("--comp-height",o)},P=()=>{let t=A(),r=Array.from(document.querySelectorAll("[data-composition-id]")).filter(o=>o.hasAttribute("data-duration")||o.hasAttribute("data-end"));for(let o of r)t&&o===t||(o.removeAttribute("data-duration"),o.removeAttribute("data-end"))},R=()=>{let t=A();if(!t)return;t.style.position||(t.style.position="relative"),t.style.overflow="hidden";let r=g(t.getAttribute("data-width")),o=g(t.getAttribute("data-height"));r&&(t.style.width=r),o&&(t.style.height=o);let m=Array.from(t.children);for(let l of m){let O=l.tagName.toLowerCase();if(O==="script"||O==="style"||O==="link"||O==="meta"||!l.hasAttribute("data-start"))continue;let Y=(l.style.top==="0px"||l.style.top==="0")&&(l.style.left==="0px"||l.style.left==="0")&&l.style.width==="100%"&&l.style.height==="100%",me=/translate\(\s*-50%\s*,\s*-50%\s*\)/.test(l.style.transform);if(Y&&me&&!l.hasAttribute("data-width")&&!l.hasAttribute("data-height")){let ie=l.style.top,C=l.style.left,v=l.style.width,W=l.style.height;l.style.top="",l.style.left="",l.style.width="",l.style.height="";let _=window.getComputedStyle(l);_.top!=="auto"||_.bottom!=="auto"||_.left!=="auto"||_.right!=="auto"||_.width!=="0px"||_.height!=="0px"||(l.style.top=ie,l.style.left=C,l.style.width=v,l.style.height=W)}let $=window.getComputedStyle(l),U=$.position;if(U!=="absolute"&&U!=="fixed"&&(l.style.position="absolute"),!!l.style.top||!!l.style.bottom||$.top!=="auto"||$.bottom!=="auto"||(l.style.top="0"),!!l.style.left||!!l.style.right||$.left!=="auto"||$.right!=="auto"||(l.style.left="0"),O!=="audio"){let ie=g(l.getAttribute("data-width")),C=g(l.getAttribute("data-height")),v=$.width!=="0px"&&$.width!=="auto",W=$.height!=="0px"&&$.height!=="auto";ie?!l.style.width&&!v&&(l.style.width=ie):!l.style.width&&$.width==="0px"&&(l.style.width="100%"),C?!l.style.height&&!W&&(l.style.height=C):!l.style.height&&$.height==="0px"&&(l.style.height="100%")}}},J=(t,r=0)=>be({timelineRegistry:window.__timelines??{}}).resolveStartForElement(t,r),z=t=>be({timelineRegistry:window.__timelines??{}}).resolveDurationForElement(t),I=!document.querySelector("[data-composition-src]"),q=t=>{if(!t||typeof t.duration!="function")return null;try{let r=Number(t.duration());return Number.isFinite(r)?Math.max(0,r):null}catch{return null}},L=t=>typeof t=="number"&&Number.isFinite(t)&&t>h,Ae=t=>{let r=Number(t.getAttribute("data-duration"));if(Number.isFinite(r)&&r>0)return r;let o=Number(t.getAttribute("data-playback-start")??t.getAttribute("data-media-start")??"0"),m=Number.isFinite(o)?Math.max(0,o):0;return Number.isFinite(t.duration)&&t.duration>m?Math.max(0,t.duration-m):null},ve=()=>{let t=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(t.length===0)return null;let r=0;for(let o of t){let m=J(o,0);if(!Number.isFinite(m))continue;let l=Ae(o);l==null||l<=h||(r=Math.max(r,Math.max(0,m)+l))}return r>h?r:null},_e=()=>{let t=ve();return typeof t!="number"||!Number.isFinite(t)||t<=h?null:t},Ne=t=>L(t)?Math.max(h,t*D):h,E=(t,r=0)=>{let o=q(t),m=_e(),l=Number.isFinite(r)&&r>h?r:0,O=0;L(o)?O=Math.max(o,l):L(m)?O=Math.max(m,l):O=l;let Y=Math.max(1,Number(e.maxTimelineDurationSeconds)||1800);return O>0?Math.max(0,Math.min(O,Y)):0},d=()=>{let t=window.__timelines??{},r=be({timelineRegistry:t}),o=_e(),m=Ne(o),l=C=>{let v=document.querySelector(`[data-composition-id="${CSS.escape(C)}"]`);return v?r.resolveStartForElement(v,0):0},O=C=>{let v=window.gsap;if(!v||typeof v.timeline!="function")return null;let W=v.timeline({paused:!0});for(let _ of C)W.add(_.timeline,l(_.compositionId));return W},Y=(C,v)=>{if(!L(C))return null;let W=window.gsap;if(!W||typeof W.timeline!="function")return null;let _=W.timeline({paused:!0});if(v)try{_.add(v,0)}catch{}let j=_;if(typeof j.to=="function")try{j.to({},{duration:C})}catch{}return _},me=(C,v)=>{let W=C;if(typeof W.getChildren!="function")return[];try{let _=W.getChildren(!0,!0,!0)??[];if(!Array.isArray(_))return[];let j=[];for(let K of v)if(!_.some(fe=>fe===K.timeline))try{let fe=l(K.compositionId);C.add(K.timeline,fe),j.push(K.compositionId)}catch{}return j}catch{return[]}},$=A(),U=$?.getAttribute("data-composition-id")??null;if(!U)return{timeline:null};let ee=t[U]??null,G=(()=>{if(!$)return[];let C=new Set,v=Array.from($.querySelectorAll("[data-composition-id]")),W=[];for(let _ of v){let j=_.getAttribute("data-composition-id");if(!j||j===U||C.has(j))continue;C.add(j);let K=t[j]??null;if(!K||typeof K.play!="function"||typeof K.pause!="function")continue;let ye=q(K);W.push({compositionId:j,timeline:K,durationSeconds:ye??0})}return W})(),ie=C=>{for(let v of C){let W=v.timeline;if(typeof W.paused=="function")try{W.paused(!1)}catch{}}};if(G.length>0&&ie(G),ee){let C=G.length>0?me(ee,G):[];if((G.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id='"+U+"'])"))&&(N=!0),C.length>0)try{let _=ee.time();ee.seek(_,!1)}catch{}let v=q(ee);if(!L(v)&&G.length>0){let _=G.map(mt=>mt.compositionId),j=O(G),K=q(j);if(j&&L(K))return{timeline:j,selectedTimelineIds:_,selectedDurationSeconds:K,mediaDurationFloorSeconds:o,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:U,rootDurationSeconds:v,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:m,selectedDurationSeconds:K,mediaDurationFloorSeconds:o,selectedTimelineIds:_,autoNestedChildren:C}}};let ye=Y(o??0,ee),fe=q(ye);if(ye&&L(fe))return{timeline:ye,selectedTimelineIds:[U],selectedDurationSeconds:fe,mediaDurationFloorSeconds:o,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:U,rootDurationSeconds:v,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:o,selectedDurationSeconds:fe,selectedTimelineIds:[U],autoNestedChildren:C}}}}if(!L(v)&&G.length===0){let _=Y(o??0,ee),j=q(_);if(_&&L(j))return{timeline:_,selectedTimelineIds:[U],selectedDurationSeconds:j,mediaDurationFloorSeconds:o,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:U,rootDurationSeconds:v,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:o,selectedDurationSeconds:j,selectedTimelineIds:[U]}}}}let W=$?.getAttribute("data-duration");if(W){let _=parseFloat(W);if(L(_)&&L(v)&&_>=v+.5){let j=ee;if(typeof j.to=="function")try{j.to({},{duration:0},_)}catch{}let K=q(ee);if(L(K))return{timeline:ee,selectedTimelineIds:[U],selectedDurationSeconds:K,mediaDurationFloorSeconds:o,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:U,rootDurationSeconds:v,rootDeclaredDur:_,newDur:K}}}}}return{timeline:ee,selectedTimelineIds:[U],selectedDurationSeconds:v,mediaDurationFloorSeconds:o,diagnostics:C.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:U,selectedDurationSeconds:v,autoNestedChildren:C}}:void 0}}if(G.length>0){let C=G.map(_=>_.compositionId),v=O(G),W=q(v);if(v)return{timeline:v,selectedTimelineIds:C,selectedDurationSeconds:W,mediaDurationFloorSeconds:o,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:U,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:m,selectedDurationSeconds:W,mediaDurationFloorSeconds:o,selectedTimelineIds:C}}}}return{timeline:null}},S=()=>{let t=e.capturedTimeline;if(!t||typeof t.time!="function")return;let r=Number(t.time());Number.isFinite(r)&&(e.currentTime=Math.max(0,r))},N=!1,F=()=>{if(!I)return!1;let t=e.capturedTimeline,r=q(t),o=L(r);if(t&&o&&N)return!1;let m=d();return m.timeline?t&&t===m.timeline?(typeof t.timeScale=="function"&&t.timeScale(e.playbackRate),!1):(e.capturedTimeline=m.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),m.diagnostics&&te({source:"hf-preview",type:"diagnostic",code:m.diagnostics.code,details:m.diagnostics.details}),te({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:m.selectedTimelineIds??[],selectedDurationSeconds:m.selectedDurationSeconds??null,mediaDurationFloorSeconds:m.mediaDurationFloorSeconds??null}}),!0):!1},T=()=>{let t=A();if(!(t instanceof HTMLElement))return;let r=t.getBoundingClientRect(),o=Number(t.getAttribute("data-width")),m=Number(t.getAttribute("data-height")),l=window.getComputedStyle(t),O=Number.isFinite(o)&&o>0&&Number.isFinite(m)&&m>0,Y=r.width<=0||r.height<=0||t.clientWidth<=0||t.clientHeight<=0;!O||!Y||s("root_stage_layout_zero",{compositionId:t.getAttribute("data-composition-id")??null,declaredWidth:o,declaredHeight:m,rectWidth:Math.round(r.width),rectHeight:Math.round(r.height),clientWidth:t.clientWidth,clientHeight:t.clientHeight,display:l.display,visibility:l.visibility,overflow:l.overflow},`root-stage-layout-zero:${t.getAttribute("data-composition-id")??"unknown"}`)},w=()=>{e.tornDown||(b!=null&&window.cancelAnimationFrame(b),b=window.requestAnimationFrame(()=>{b=null,T()}))},M=()=>{i=t=>{let r=de(t.error??t.message).slice(0,oe);if(!r)return;let o=c(r);te({source:"hf-preview",type:"diagnostic",code:o.code,details:{category:o.category,message:r,filename:t.filename||null,line:Number.isFinite(t.lineno)?t.lineno:null,column:Number.isFinite(t.colno)?t.colno:null}})},a=t=>{let r=de(t.reason).slice(0,oe);if(!r)return;let o=c(r);te({source:"hf-preview",type:"diagnostic",code:`${o.code}_unhandled_rejection`,details:{category:`${o.category}-unhandled-rejection`,message:r}})},window.addEventListener("error",i),window.addEventListener("unhandledrejection",a)},se=()=>{let t=Array.from(document.querySelectorAll("img, video, audio, source, link[rel='stylesheet']"));for(let o of t){let m=()=>{if(!(o instanceof Element))return;let l=o.tagName.toLowerCase(),O=o.getAttribute("src")??o.getAttribute("href")??o.getAttribute("poster")??null,Y=l==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";s(Y,{tagName:l,assetUrl:O,currentSrc:(o instanceof HTMLImageElement||o instanceof HTMLMediaElement)&&o.currentSrc||null,readyState:o instanceof HTMLMediaElement?o.readyState:null,networkState:o instanceof HTMLMediaElement?o.networkState:null},`${Y}:${l}:${O??"unknown"}`)};o.addEventListener("error",m),f(()=>{o.removeEventListener("error",m)})}let r=document.fonts;r&&r.ready.then(()=>{if(e.tornDown)return;let o=Array.from(r).filter(m=>m.status==="error").map(m=>m.family).filter(m=>!!m).slice(0,10);o.length!==0&&s("runtime_font_load_issue",{failedFamilies:o,totalFaces:Array.from(r).length},`runtime-font-load-issue:${o.join("|")}`)}).catch(()=>{})},Q=(t,r)=>{if(!t.timeline)return!1;let o=e.capturedTimeline;if(o&&o===t.timeline)return!1;let m=Math.max(0,e.currentTime||0),l=e.isPlaying;e.capturedTimeline=t.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{e.capturedTimeline.pause(),e.capturedTimeline.seek(m,!1),l&&e.capturedTimeline.play()}catch{}return te({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:r,previousTime:m,selectedTimelineIds:t.selectedTimelineIds??[],selectedDurationSeconds:t.selectedDurationSeconds??null,mediaDurationFloorSeconds:t.mediaDurationFloorSeconds??null}}),!0},re=null,le=!1,we=new Set,Me=()=>{e.tornDown||(re!=null&&window.clearTimeout(re),re=window.setTimeout(()=>{if(e.tornDown)return;re=null;let t=d();if(!t.timeline||!L(t.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){F()&&(pe(),ue(!0));return}if(le)return;let o=q(e.capturedTimeline),m=t.selectedDurationSeconds??q(t.timeline);L(m)&&(!L(o)||m>=o+ae)&&Q(t,"manual")&&(le=!0,te({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:o??null,selectedDurationSeconds:m??null,selectedTimelineIds:t.selectedTimelineIds??[],mediaDurationFloorSeconds:t.mediaDurationFloorSeconds??null}}),pe(),ue(!0))},ce))},ct=()=>{for(let t of we)t.removeEventListener("loadedmetadata",Me),t.removeEventListener("durationchange",Me);we.clear()},De=()=>{if(e.tornDown)return;let t=Array.from(document.querySelectorAll("video, audio"));for(let r of t)we.has(r)||(we.add(r),r.addEventListener("loadedmetadata",Me),r.addEventListener("durationchange",Me))},Fe=()=>{let t=Ze({resolveStartSeconds:m=>J(m,0)});Ye({clips:t.mediaClips,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate});let r=document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null,o=Array.from(document.querySelectorAll("[data-start]"));for(let m of o){if(!(m instanceof HTMLElement))continue;let l=m.tagName.toLowerCase();if(l==="script"||l==="style"||l==="link"||l==="meta")continue;if(!m.getAttribute("data-composition-id")){let ie=m.closest("[data-composition-id]")?.getAttribute("data-composition-id")??null;if(ie&&ie!==r)continue}let Y=J(m,0),me=z(m),$=me!=null&&me>0?Y+me:Number.POSITIVE_INFINITY,U=$,ee=m.getAttribute("data-composition-id");if(ee&&!Number.isFinite($)){let G=(window.__timelines??{})[ee];if(G&&typeof G.duration=="function"){let ie=G.duration();ie>0&&(U=Y+ie)}}let Ie=e.currentTime>=Y&&(Number.isFinite(U)?e.currentTime<U:!0);m.style.visibility=Ie?"visible":"hidden"}},ue=t=>{S();let r=Math.max(0,Math.round((e.currentTime||0)*e.canonicalFps)),o=Date.now();(t||r!==e.bridgeLastPostedFrame||e.isPlaying!==e.bridgeLastPostedPlaying||e.bridgeMuted!==e.bridgeLastPostedMuted||o-e.bridgeLastPostedAt>=e.bridgeMaxPostIntervalMs)&&(e.bridgeLastPostedFrame=r,e.bridgeLastPostedPlaying=e.isPlaying,e.bridgeLastPostedMuted=e.bridgeMuted,e.bridgeLastPostedAt=o,te({source:"hf-preview",type:"state",frame:r,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},pe=()=>{P(),H(),R();let t=A();if(t){let o=g(t.getAttribute("data-width")),m=g(t.getAttribute("data-height")),l=o?parseInt(o,10):0,O=m?parseInt(m,10):0;l>0&&O>0&&te({source:"hf-preview",type:"stage-size",width:l,height:O})}F();let r=it({canonicalFps:e.canonicalFps,maxTimelineDurationSeconds:e.maxTimelineDurationSeconds});window.__clipManifest=r,te(r),w()},he=(t,r=0)=>{for(let o of e.deterministicAdapters){try{t==="discover"&&o.discover(),t==="pause"&&o.pause(),t==="play"&&o.play&&o.play()}catch{}if(t==="discover")try{o.seek({time:r})}catch{}}};I||at({injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,parseDimensionPx:g,onDiagnostic:({code:t,details:r})=>{te({source:"hf-preview",type:"diagnostic",code:t,details:r})}}).finally(()=>{I=!0,he("discover",e.currentTime),De(),se(),pe(),ue(!0)});let ke=Je({postMessage:t=>te(t)});ke.installPickerApi();let He=t=>{let r=Number(t);!Number.isFinite(r)||r<=0?e.playbackRate=1:e.playbackRate=Math.max(.1,Math.min(5,r)),e.capturedTimeline&&typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);let o=document.querySelectorAll("video, audio");for(let m of o)if(m instanceof HTMLMediaElement)try{m.playbackRate=e.playbackRate}catch{}},Z=et({getTimeline:()=>e.capturedTimeline,setTimeline:t=>{e.capturedTimeline=t},getIsPlaying:()=>e.isPlaying,setIsPlaying:t=>{e.isPlaying=t},getPlaybackRate:()=>e.playbackRate,setPlaybackRate:He,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(t,r)=>{e.currentTime=Math.max(0,Number(t)||0),e.isPlaying=r,Fe()},onStatePost:ue,onDeterministicSeek:t=>{for(let r of e.deterministicAdapters)try{r.seek({time:Number(t)||0})}catch{}},onDeterministicPause:()=>he("pause"),onDeterministicPlay:()=>he("play"),onRenderFrameSeek:()=>{},onShowNativeVideos:()=>{},getSafeDuration:()=>E(e.capturedTimeline,0)});window.__player=y(Z),window.__playerReady=!0,window.__renderReady=!0,Ue(te),Se("composition_loaded",{duration:Z.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.controlBridgeHandler=je({onPlay:()=>{Z.play(),Se("composition_played",{time:Z.getTime()})},onPause:()=>{Z.pause(),Se("composition_paused",{time:Z.getTime()})},onSeek:(t,r)=>{let o=Math.max(0,t)/e.canonicalFps;Z.seek(o),Se("composition_seeked",{time:o})},onSetMuted:t=>{e.bridgeMuted=t;let r=document.querySelectorAll("video, audio");for(let o of r)o instanceof HTMLMediaElement&&(o.muted=t)},onSetPlaybackRate:t=>He(t),onEnablePickMode:()=>ke.enablePickMode(),onDisablePickMode:()=>ke.disablePickMode()}),F(),e.capturedTimeline&&(Z._timeline=e.capturedTimeline),I&&setTimeout(()=>{let t=e.capturedTimeline;F()&&e.capturedTimeline!==t&&(Z._timeline=e.capturedTimeline),he("discover",e.currentTime),pe(),ue(!0)},0),e.deterministicAdapters=[Be({resolveStartSeconds:t=>J(t,0)}),Ke(),ze(),Ge(),qe({getTimeline:()=>e.capturedTimeline})],M(),he("discover"),De(),e.timelinePollIntervalId&&clearInterval(e.timelinePollIntervalId);let Pe=0,Re=null,We=0,Le=!1,ge=0,Oe=()=>{We=Date.now(),Le=!1,ge=0};e.timelinePollIntervalId=setInterval(()=>{Pe+=1;let r=e.isPlaying&&e.capturedTimeline!=null&&Math.max(0,e.currentTime||0)<V?!1:F();if(e.capturedTimeline&&!Z._timeline&&(Z._timeline=e.capturedTimeline),(r||Pe%20===0)&&pe(),Pe%10===0&&De(),S(),e.isPlaying&&e.capturedTimeline){let o=Math.max(0,e.currentTime||0),m=Re,l=E(e.capturedTimeline,0);if(l>0&&o>=l){Z.pause(),Z.seek(l),Re=l,ge=0,ue(!0);return}if(m!=null&&m>=k&&o<=B?ge+=1:ge=0,!Le&&ge>=X&&Date.now()-We>x){let Y=d();Q(Y,"loop_guard")&&(Le=!0,ge=0)}Re=Math.max(0,e.currentTime||0)}else Re=Math.max(0,e.currentTime||0);e.isPlaying&&Fe(),ue(!1)},50),pe(),ue(!0);let ut=Z.seek;Z.seek=t=>{Oe(),ut(t)};let dt=Z.renderSeek;Z.renderSeek=t=>{Oe(),dt(t)};let Ce=()=>{if(!e.tornDown){e.tornDown=!0,e.timelinePollIntervalId&&(clearInterval(e.timelinePollIntervalId),e.timelinePollIntervalId=null),re!=null&&(window.clearTimeout(re),re=null),b!=null&&(window.cancelAnimationFrame(b),b=null),ct(),e.controlBridgeHandler&&(window.removeEventListener("message",e.controlBridgeHandler),e.controlBridgeHandler=null),i&&(window.removeEventListener("error",i),i=null),a&&(window.removeEventListener("unhandledrejection",a),a=null),e.beforeUnloadHandler&&(window.removeEventListener("beforeunload",e.beforeUnloadHandler),e.beforeUnloadHandler=null),ke.disablePickMode();for(let t of e.deterministicAdapters)if(!(!t||typeof t.revert!="function"))try{t.revert()}catch{}e.deterministicAdapters=[];for(let t of u.splice(0))try{t()}catch{}for(let t of e.injectedCompStyles)try{t.remove()}catch{}e.injectedCompStyles=[];for(let t of e.injectedCompScripts)try{t.remove()}catch{}e.injectedCompScripts=[],e.capturedTimeline=null,n.__hfRuntimeTeardown===Ce&&(n.__hfRuntimeTeardown=null)}};n.__hfRuntimeTeardown=Ce,e.beforeUnloadHandler=Ce,window.addEventListener("beforeunload",e.beforeUnloadHandler)}window.__timelines=window.__timelines||{};function lt(){let e=window;e.__hyperframeRuntimeBootstrapped||(e.__hyperframeRuntimeBootstrapped=!0,st())}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",lt,{once:!0}):lt();})();
|
|
11
|
+
`,document.head.appendChild(n)}for(let n of e)try{document.querySelectorAll(n).forEach(o=>{o.classList.add("__hf-flash"),setTimeout(()=>o.classList.remove("__hf-flash"),t)})}catch{}}var qe=null;function pt(e){qe=e}function Pe(e,t){if(qe)try{qe({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch{}}function ht(e){let t=[];return{name:"css",discover:()=>{t=[];let n=document.querySelectorAll("*");for(let r of n){if(!(r instanceof HTMLElement))continue;let o=window.getComputedStyle(r);!o.animationName||o.animationName==="none"||t.push({el:r,baseDelay:r.style.animationDelay||"",basePlayState:r.style.animationPlayState||""})}},seek:n=>{let r=Number(n.time)||0;for(let o of t){if(!o.el.isConnected)continue;let i=e?.resolveStartSeconds?e.resolveStartSeconds(o.el):Number.parseFloat(o.el.getAttribute("data-start")??"0")||0,u=Math.max(0,r-i);o.el.style.animationPlayState="paused",o.el.style.animationDelay=`-${u.toFixed(3)}s`}},pause:()=>{for(let n of t)n.el.isConnected&&(n.el.style.animationPlayState=n.basePlayState||"paused",n.baseDelay&&(n.el.style.animationDelay=n.baseDelay))},revert:()=>{t=[]}}}function gt(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);typeof n.totalTime=="function"?n.totalTime(r,!1):n.seek(r,!1)},pause:()=>{let t=e.getTimeline();t&&t.pause()}}}function Lt(){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 o of t)r.has(o)||n.push(o);window.__hfLottie=n}}}catch{}},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(yt(r))r.goToAndStop(t*1e3,!1);else if(bt(r)){if(typeof r.setCurrentRawFrameValue=="function"){let o=r.totalFrames??0,i=r.frameRate??30,u=t*i;o>0&&r.setCurrentRawFrameValue(Math.min(u,o-1))}else if(typeof r.seek=="function"){let o=r.duration??1,i=Math.min(100,t/o*100);r.seek(i)}}}catch{}},pause:()=>{let e=window.__hfLottie;if(!(!e||e.length===0))for(let t of e)try{(yt(t)||bt(t))&&t.pause()}catch{}},revert:()=>{}}}function yt(e){return typeof e=="object"&&e!==null&&typeof e.goToAndStop=="function"}function bt(e){return typeof e=="object"&&e!==null&&typeof e.pause=="function"&&("totalFrames"in e||"duration"in e)}function St(){let e=null,t=0;return{name:"three",discover:()=>{},seek:n=>{e=Math.max(0,Number(n.time)||0),t=e,window.__hfThreeTime=e;try{window.dispatchEvent(new CustomEvent("hf-seek",{detail:{time:e}}))}catch{}},pause:()=>{e==null&&(e=Math.max(0,t))},play:()=>{e=null},revert:()=>{e=null,t=0}}}function At(){return{name:"waapi",discover:()=>{},seek:e=>{if(!document.getAnimations)return;let t=Math.max(0,(Number(e.time)||0)*1e3);for(let n of document.getAnimations())try{n.pause(),n.currentTime=t}catch{}},pause:()=>{if(document.getAnimations)for(let e of document.getAnimations())try{e.pause()}catch{}}}}function kt(e){let t=Array.from(document.querySelectorAll("video[data-start], audio[data-start]")),n=[],r=[],o=0;for(let i of t){let u=e?.resolveStartSeconds?e.resolveStartSeconds(i):Number.parseFloat(i.dataset.start??"0");if(!Number.isFinite(u))continue;let c=Number.parseFloat(i.dataset.playbackStart??i.dataset.mediaStart??"0")||0,d=i.defaultPlaybackRate,a=Number.isFinite(d)&&d>0?Math.max(.1,Math.min(5,d)):1,l=i.loop,L=Number.isFinite(i.duration)&&i.duration>0?i.duration:null,m=Number.parseFloat(i.dataset.duration??"");(!Number.isFinite(m)||m<=0)&&L!=null&&(m=Math.max(0,(L-c)/a));let y=Number.isFinite(m)&&m>0?u+m:Number.POSITIVE_INFINITY,M=Number.parseFloat(i.dataset.volume??""),w={el:i,start:u,mediaStart:c,duration:Number.isFinite(m)&&m>0?m:Number.POSITIVE_INFINITY,end:y,volume:Number.isFinite(M)?M:null,playbackRate:a,loop:l,sourceDuration:L};n.push(w),i.tagName==="VIDEO"&&r.push(w),Number.isFinite(y)&&(o=Math.max(o,y))}return{timedMediaEls:t,mediaClips:n,videoClips:r,maxMediaEnd:o}}function xt(e){for(let t of e.clips){let{el:n}=t;if(!n.isConnected)continue;let r=(e.timeSeconds-t.start)*t.playbackRate+t.mediaStart;if(e.timeSeconds>=t.start&&e.timeSeconds<t.end&&r>=0){if(t.loop&&t.sourceDuration!=null&&t.sourceDuration>0){let i=t.sourceDuration-t.mediaStart;i>0&&r>=t.sourceDuration&&(r=t.mediaStart+(r-t.mediaStart)%i)}t.volume!=null&&(n.volume=t.volume);try{n.playbackRate=t.playbackRate*e.playbackRate}catch{}if(Math.abs((n.currentTime||0)-r)>.3)try{n.currentTime=r}catch{}e.playing&&n.paused?n.play().catch(()=>{}):!e.playing&&!n.paused&&n.pause();continue}n.paused||n.pause()}}function Et(e){let t=!1,n=null,r=null,o=null,i=null;function u(g,A){try{window.dispatchEvent(new CustomEvent(g,{detail:A}))}catch{}}function c(g){o=g,u("hyperframe:picker:hovered",{elementInfo:o,isPickMode:t,timestamp:Date.now()})}function d(g){i=g,u("hyperframe:picker:selected",{elementInfo:i,isPickMode:t,timestamp:Date.now()})}function a(g){if(!g||g===document.body||g===document.documentElement)return!1;let A=g.tagName.toLowerCase();return!(A==="script"||A==="style"||A==="link"||A==="meta"||g.classList.contains("__hf-pick-highlight"))}function l(g){let A=g;if(A.id)return`#${A.id}`;let N=g.getAttribute("data-composition-id");if(N)return`[data-composition-id="${N}"]`;let R=g.getAttribute("data-composition-src");if(R)return`[data-composition-src="${R}"]`;let F=g.getAttribute("data-track-index");if(F)return`[data-track-index="${F}"]`;let E=g.tagName.toLowerCase(),k=g.parentElement;if(!k)return E;let P=k.querySelectorAll(`:scope > ${E}`);if(P.length===1)return E;for(let W=0;W<P.length;W+=1)if(P[W]===g)return`${E}:nth-of-type(${W+1})`;return E}function L(g){let A=g.tagName.toLowerCase(),N=(g.textContent??"").trim().replace(/\s+/g," "),R=(F,E)=>F.length>E?`${F.slice(0,E-1)}\u2026`:F;return A==="h1"||A==="h2"||A==="h3"?"Heading":A==="p"||A==="span"||A==="div"?N.length>0?R(N,56):"Text":A==="img"?"Image":A==="video"?"Video":A==="audio"?"Audio":A==="svg"?"Shape":g.getAttribute("data-composition-src")?"Composition":A==="section"?"Section":`${A.charAt(0).toUpperCase()}${A.slice(1)}`}function m(g,A,N){let R=typeof N=="number"&&N>0?N:8,F=[];if(document.elementsFromPoint)F=document.elementsFromPoint(g,A);else if(document.elementFromPoint){let P=document.elementFromPoint(g,A);F=P?[P]:[]}let E={},k=[];for(let P=0;P<F.length;P+=1){let W=F[P];if(!a(W))continue;let Y=`${W.tagName}::${W.id||""}::${P}`;if(!E[Y]&&(E[Y]=!0,k.push(W),k.length>=R))break}return k}function y(g){let A=g.getBoundingClientRect(),N={};for(let F=0;F<g.attributes.length;F+=1){let E=g.attributes[F];E.name.startsWith("data-")&&(N[E.name]=E.value)}return{id:g.id||null,tagName:g.tagName.toLowerCase(),selector:l(g),label:L(g),boundingBox:{x:A.left,y:A.top,width:A.width,height:A.height},textContent:g.textContent?g.textContent.trim().slice(0,200):null,src:g.getAttribute("src")||g.getAttribute("data-composition-src")||null,dataAttributes:N}}function M(g,A,N){return m(g,A,N).map(y)}function w(g){if(!t)return;let N=m(g.clientX,g.clientY,1)[0]??(g.target instanceof Element?g.target:null);if(!a(N)||n===N)return;n&&n.classList.remove("__hf-pick-highlight"),n=N,N.classList.add("__hf-pick-highlight");let R=y(N);c(R),e.postMessage({source:"hf-preview",type:"element-hovered",elementInfo:R})}function _(g){if(!t)return;g.preventDefault(),g.stopPropagation(),g.stopImmediatePropagation();let A=M(g.clientX,g.clientY,8);A.length!==0&&(c(A[0]??null),e.postMessage({source:"hf-preview",type:"element-pick-candidates",candidates:A,selectedIndex:0,point:{x:g.clientX,y:g.clientY}}))}function V(g){g.key==="Escape"&&(z(),e.postMessage({source:"hf-preview",type:"pick-mode-cancelled"}))}function ee(){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(`
|
|
12
|
+
`),document.head.appendChild(r),document.body.classList.add("__hf-pick-active"),document.addEventListener("mousemove",w,!0),document.addEventListener("click",_,!0),document.addEventListener("keydown",V,!0),u("hyperframe:picker:mode",{isPickMode:!0,timestamp:Date.now()}))}function z(){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",w,!0),document.removeEventListener("click",_,!0),document.removeEventListener("keydown",V,!0),u("hyperframe:picker:mode",{isPickMode:!1,timestamp:Date.now()}))}function $(){window.__HF_PICKER_API={enable:ee,disable:z,isActive:()=>t,getHovered:()=>o,getSelected:()=>i,getCandidatesAtPoint:(g,A,N)=>Number.isFinite(g)&&Number.isFinite(A)?M(g,A,N):[],pickAtPoint:(g,A,N)=>{if(!Number.isFinite(g)||!Number.isFinite(A))return null;let R=M(g,A,8);if(!R.length)return null;let F=Math.max(0,Math.min(R.length-1,Number(N??0))),E=R[F]??null;return E?(d(E),e.postMessage({source:"hf-preview",type:"element-picked",elementInfo:E}),z(),E):null},pickManyAtPoint:(g,A,N)=>{if(!Number.isFinite(g)||!Number.isFinite(A))return[];let R=M(g,A,8);if(!R.length)return[];let F=[],E=Array.isArray(N)?N:[0];for(let k of E){let P=Math.max(0,Math.min(R.length-1,Math.floor(Number(k)))),W=R[P];if(!W)continue;F.some(U=>U.selector===W.selector&&U.tagName===W.tagName)||F.push(W)}return F.length?(d(F[0]??null),e.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:F}),z(),F):[]}},u("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:ee,disablePickMode:z,installPickerApi:$}}function Tt(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 wt(e,t,n){let r=Tt(t,n);return e.pause(),typeof e.totalTime=="function"?e.totalTime(r,!1):e.seek(r,!1),r}function Mt(e){return{_timeline:null,play:()=>{let t=e.getTimeline();if(!t||e.getIsPlaying())return;let n=Math.max(0,Number(e.getSafeDuration?.()??t.duration()??0)||0);n>0&&Math.max(0,Number(t.time())||0)>=n&&(t.pause(),t.seek(0,!1),e.onDeterministicSeek(0),e.setIsPlaying(!1),e.onSyncMedia(0,!1),e.onRenderFrameSeek(0)),typeof t.timeScale=="function"&&t.timeScale(e.getPlaybackRate()),t.play(),e.onDeterministicPlay(),e.setIsPlaying(!0),e.onShowNativeVideos(),e.onStatePost(!0)},pause:()=>{let t=e.getTimeline();if(!t)return;t.pause();let n=Math.max(0,Number(t.time())||0);e.onDeterministicSeek(n),e.onDeterministicPause(),e.setIsPlaying(!1),e.onSyncMedia(n,!1),e.onRenderFrameSeek(n),e.onStatePost(!0)},seek:t=>{let n=e.getTimeline();if(!n)return;let r=Math.max(0,Number(t)||0),o=wt(n,r,e.getCanonicalFps());e.onDeterministicSeek(o),e.setIsPlaying(!1),e.onSyncMedia(o,!1),e.onRenderFrameSeek(o),e.onStatePost(!0)},renderSeek:t=>{let n=e.getTimeline();if(!n)return;let r=wt(n,t,e.getCanonicalFps());e.onDeterministicSeek(r),e.setIsPlaying(!1),e.onSyncMedia(r,!1),e.onRenderFrameSeek(r),e.onStatePost(!0)},getTime:()=>Number(e.getTimeline()?.time()??0),getDuration:()=>Number(e.getTimeline()?.duration()??0),isPlaying:()=>e.getIsPlaying(),setPlaybackRate:t=>e.setPlaybackRate(t),getPlaybackRate:()=>e.getPlaybackRate()}}function Nt(){return{capturedTimeline:null,isPlaying:!1,rafId:null,currentTime:0,deterministicAdapters:[],parityModeEnabled:!0,canonicalFps:30,bridgeMuted:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,timelinePollIntervalId:null,controlBridgeHandler:null,clampDurationLoggedRaw:null,beforeUnloadHandler:null,domReadyHandler:null,injectedCompStyles:[],injectedCompScripts:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,maxTimelineDurationSeconds:1800,nativeVisualWatchdogTick:0}}function Ce(e){let t=Number(e);return Number.isFinite(t)?t:null}function nn(e){let t=(e??"").trim();if(!t)return null;let n=Ce(t);if(n!=null)return{kind:"absolute",value:n};let r=t.match(/^([A-Za-z0-9_.:-]+)(?:\s*([+-])\s*([0-9]*\.?[0-9]+))?$/);if(!r)return null;let o=(r[1]??"").trim();if(!o)return null;let i=r[2]??"+",u=r[3]??"0",c=Number.parseFloat(u),d=Number.isFinite(c)?Math.max(0,c):0,a=i==="-"?-d:d;return{kind:"reference",refId:o,offset:a}}function Te(e){let t=e.timelineRegistry??{},n=new WeakMap,r=new WeakMap,o=new Set,i=d=>{let a=document.getElementById(d);return a||(document.querySelector(`[data-composition-id="${CSS.escape(d)}"]`)??null)},u=d=>{let a=r.get(d);if(a!==void 0)return a;let l=null,L=Ce(d.getAttribute("data-duration"));if(L!=null&&L>0&&(l=L),l==null||l<=0){let m=Ce(d.getAttribute("data-end"));if(m!=null){let y=c(d,0),M=m-y;Number.isFinite(M)&&M>0&&(l=M)}}if((l==null||l<=0)&&d instanceof HTMLMediaElement){let m=Ce(d.getAttribute("data-playback-start"))??Ce(d.getAttribute("data-media-start"))??0;Number.isFinite(d.duration)&&d.duration>m&&(l=d.duration-m)}if(l==null||l<=0){let m=d.getAttribute("data-composition-id");if(m){let y=t[m]??null;if(y&&typeof y.duration=="function")try{let M=Number(y.duration());Number.isFinite(M)&&M>0&&(l=M)}catch{}}}return l!=null&&Number.isFinite(l)&&l>0?(r.set(d,l),l):(r.set(d,null),null)},c=(d,a)=>{let l=n.get(d);if(l!==void 0)return l??a;if(o.has(d))return a;o.add(d);try{let L=nn(d.getAttribute("data-start"));if(!L){if(d.hasAttribute("data-composition-id")){let _=d.parentElement;if(_&&(_.hasAttribute("data-composition-src")||_.hasAttribute("data-composition-id"))){let V=c(_,a);return n.set(d,V),V}}return n.set(d,a),a}if(L.kind==="absolute"){let _=Math.max(0,L.value);return n.set(d,_),_}let m=i(L.refId);if(!m)return n.set(d,a),a;let y=c(m,0),M=u(m);if(M==null||M<=0){let _=Math.max(0,y+L.offset);return n.set(d,_),_}let w=Math.max(0,y+M+L.offset);return n.set(d,w),w}finally{o.delete(d)}};return{resolveStartForElement:(d,a=0)=>c(d,Math.max(0,a)),resolveDurationForElement:d=>u(d)}}function ue(e){let t=Number(e);return Number.isFinite(t)?t:null}var vt={composition:0,video:1,image:2,element:3,audio:4};function on(e){if(e.length===0)return;let t=new Map;for(let u of e){let c=t.get(u.track)??new Set;c.add(u.kind),t.set(u.track,c)}if(!Array.from(t.values()).some(u=>u.size>1))return;let r=0,o=new Map,i=[...t.keys()].sort((u,c)=>u-c);for(let u of i){let c=t.get(u);if(c.size===1)o.set(`${u}:${[...c][0]}`,r++);else{let d=[...c].sort((a,l)=>(vt[a]??99)-(vt[l]??99));for(let a of d)o.set(`${u}:${a}`,r++)}}for(let u of e){let c=`${u.track}:${u.kind}`,d=o.get(c);d!=null&&(u.track=d)}}function Fe(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 rn(e){let t=e.getAttribute("src")??e.getAttribute("data-src");if(t)return Fe(t);let n=e.getAttribute("data-composition-src");if(n)return Fe(n);let r=e.querySelector("img[src], video[src], audio[src], source[src]");return r?Fe(r.getAttribute("src")):null}function Rt(e){let n=window.__timelines??{},r=Te({timelineRegistry:n}),o=b=>{if(!b)return null;let h=n[b]??null;if(!h||typeof h.duration!="function")return null;try{let T=Number(h.duration());return Number.isFinite(T)&&T>0?T:null}catch{return null}},i=b=>{let h=ue(b.getAttribute("data-duration"));if(h!=null&&h>0)return h;let T=ue(b.getAttribute("data-playback-start"))??ue(b.getAttribute("data-media-start"))??0;return Number.isFinite(b.duration)&&b.duration>T?Math.max(0,b.duration-T):null},u=()=>{let b=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(b.length===0)return null;let h=0;for(let T of b){let C=r.resolveStartForElement(T,0);if(!Number.isFinite(C))continue;let G=i(T);G==null||G<=0||(h=Math.max(h,Math.max(0,C)+G))}return h>0?h:null},c=b=>{let h=b.trim().toLowerCase();return!(!h||h==="main"||h.includes("caption")||h.includes("ambient"))},d=(b,h)=>{let T=[],C=null,G=null,D=null,I=b.parentElement;for(;I;){let B=I.getAttribute("data-composition-id");B&&(T.push(B),!D&&I!==h&&(D=B),C==null&&(C=r.resolveStartForElement(I,0)),G==null&&(G=ue(I.getAttribute("data-duration"))??o(B)??null)),I=I.parentElement}return{parentCompositionId:D,compositionAncestors:T.reverse(),inheritedStart:C,inheritedDuration:G}},a=document.querySelector("[data-composition-id]"),l=a?.getAttribute("data-composition-id")??null,L=a?r.resolveStartForElement(a,0):0,m=u(),y=m!=null?Math.max(0,m-Math.max(0,L)):null,M=o(l),w=ue(a?.getAttribute("data-duration")),_=typeof M=="number"&&Number.isFinite(M)&&M>0?M:null,V=typeof w=="number"&&Number.isFinite(w)&&w>0?w:null,ee=typeof y=="number"&&Number.isFinite(y)&&y>0?y:null,z=_!=null&&ee!=null&&_>ee+1,$=V??(z?ee:_??ee),g=$!=null?Math.min($,e.maxTimelineDurationSeconds):null,N=(g!=null?L+g:null)??(typeof m=="number"&&Number.isFinite(m)&&m>0?m:null),R=(b,h)=>!Number.isFinite(h)||h<=0?0:N==null||!Number.isFinite(N)?h:!Number.isFinite(b)||b>=N?0:Math.max(0,Math.min(h,N-b)),F=Array.from(document.querySelectorAll("[data-composition-id]")),E=[],k=[],P=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),W=0;for(let b=0;b<P.length;b+=1){let h=P[b];if(h===a||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(h.tagName))continue;let T=d(h,a),C=r.resolveStartForElement(h,T.inheritedStart??0),G=h.getAttribute("data-composition-id"),D=ue(h.getAttribute("data-duration"));if((D==null||D<=0)&&G&&G!==l&&(D=o(G)),(D==null||D<=0)&&h instanceof HTMLMediaElement){let ae=ue(h.getAttribute("data-playback-start"))??ue(h.getAttribute("data-media-start"))??0;Number.isFinite(h.duration)&&h.duration>0&&(D=Math.max(0,h.duration-ae))}if(D==null||D<=0){let ae=T.inheritedDuration;if(ae!=null&&ae>0){let fe=(T.inheritedStart??0)+ae;D=Math.max(0,fe-C)}}if(D==null||D<=0||(D=R(C,D),D<=0))continue;let I=C+D;W=Math.max(W,I);let B=h.tagName.toLowerCase(),me=G&&G!==l?"composition":B==="video"?"video":B==="audio"?"audio":B==="img"?"image":"element";E.push({id:h.id||G||`__node__index_${b}`,label:h.getAttribute("data-timeline-label")??h.getAttribute("data-label")??h.getAttribute("aria-label")??G??h.id??h.className?.split(" ")[0]??me,start:C,duration:D,track:Number.parseInt(h.getAttribute("data-track-index")??h.getAttribute("data-track")??String(b),10)||0,kind:me,tagName:B,compositionId:h.getAttribute("data-composition-id"),compositionAncestors:T.compositionAncestors,parentCompositionId:T.parentCompositionId,nodePath:null,compositionSrc:Fe(h.getAttribute("data-composition-src")),assetUrl:rn(h),timelineRole:h.getAttribute("data-timeline-role"),timelineLabel:h.getAttribute("data-timeline-label"),timelineGroup:h.getAttribute("data-timeline-group"),timelinePriority:ue(h.getAttribute("data-timeline-priority"))})}let Y=new Set(E.map(b=>b.id)),U=a?.getAttribute("data-composition-id")??null,K=U?n[U]??null:null;if(K&&a){let b=K;if(typeof b.getChildren=="function")try{let h=b.getChildren(!0,!0,!1)??[],T=new Map;for(let D of a.children){let I=D;if(!I.id)continue;let B=I.tagName.toLowerCase();B==="script"||B==="style"||B==="link"||T.set(I,{id:I.id,start:1/0,end:-1/0})}let C=D=>{let I=D;for(;I;){if(T.has(I))return I;if(I===a)return null;I=I.parentElement}return null};for(let D of h){if(typeof D.targets!="function"||typeof D.startTime!="function"||typeof D.duration!="function")continue;let I=D.startTime(),B=D.parent;for(;B&&typeof B.startTime=="function";)I+=B.startTime(),B=B.parent;let me=I+D.duration();if(!(!Number.isFinite(I)||!Number.isFinite(me)))for(let ae of D.targets()){if(!(ae instanceof Element))continue;let ve=C(ae);if(!ve)continue;let fe=T.get(ve);fe&&(fe.start=Math.min(fe.start,I),fe.end=Math.max(fe.end,me))}}let G=E.length>0?Math.max(...E.map(D=>D.track))+1:0;for(let[D,I]of T){if(I.start===1/0||I.end===-1/0)continue;let B=D;if(Y.has(B.id))continue;let me=Math.max(0,I.end-I.start);if(me<=0)continue;let ae=R(I.start,me);ae<=0||(W=Math.max(W,I.start+ae),E.push({id:B.id,label:B.getAttribute("data-timeline-label")??B.getAttribute("data-label")??B.getAttribute("aria-label")??B.id,start:I.start,duration:ae,track:Number.parseInt(B.getAttribute("data-track-index")??B.getAttribute("data-track")??"",10)||G,kind:"element",tagName:B.tagName.toLowerCase(),compositionId:B.getAttribute("data-composition-id"),compositionAncestors:U?[U]:[],parentCompositionId:U,nodePath:null,compositionSrc:null,assetUrl:null,timelineRole:B.getAttribute("data-timeline-role"),timelineLabel:B.getAttribute("data-timeline-label"),timelineGroup:B.getAttribute("data-timeline-group"),timelinePriority:ue(B.getAttribute("data-timeline-priority"))}),Y.add(B.id))}}catch{}}if(a&&g!=null&&g>0){let b=E.length>0?Math.max(...E.map(h=>h.track))+1:0;for(let h of a.children){let T=h;if(!T.id||Y.has(T.id))continue;let C=T.tagName.toLowerCase();if(C==="script"||C==="style"||C==="link"||C==="meta"||window.getComputedStyle(T).display==="none")continue;let D=R(0,g);D<=0||(W=Math.max(W,D),E.push({id:T.id,label:T.getAttribute("data-timeline-label")??T.getAttribute("data-label")??T.getAttribute("aria-label")??T.id,start:0,duration:D,track:Number.parseInt(T.getAttribute("data-track-index")??T.getAttribute("data-track")??"",10)||b,kind:"element",tagName:C,compositionId:T.getAttribute("data-composition-id"),compositionAncestors:U?[U]:[],parentCompositionId:U,nodePath:null,compositionSrc:null,assetUrl:null,timelineRole:T.getAttribute("data-timeline-role"),timelineLabel:T.getAttribute("data-timeline-label"),timelineGroup:T.getAttribute("data-timeline-group"),timelinePriority:ue(T.getAttribute("data-timeline-priority"))}),Y.add(T.id))}}on(E);for(let b of F){if(b===a)continue;let h=b.getAttribute("data-composition-id");if(!h||!c(h))continue;let T=r.resolveStartForElement(b,0),C=ue(b.getAttribute("data-duration")),G=o(h),D=C&&C>0?C:G;if(D==null||D<=0)continue;let I=R(T,D);I<=0||k.push({id:h,label:b.getAttribute("data-label")??h,start:T,duration:I,thumbnailUrl:Fe(b.getAttribute("data-thumbnail-url")),avatarName:null})}let H=Math.max(1,Math.min(W||1,e.maxTimelineDurationSeconds));return{source:"hf-preview",type:"timeline",durationInFrames:z&&V==null?Number.POSITIVE_INFINITY:Math.max(1,Math.round(H*Math.max(1,e.canonicalFps))),clips:E,scenes:k,compositionWidth:ue(a?.getAttribute("data-width"))??1920,compositionHeight:ue(a?.getAttribute("data-height"))??1080}}var sn=/^(?![a-zA-Z][a-zA-Z\d+\-.]*:)(?!\/\/)(?!\/)(?!\.\.?\/).+/,an=e=>new Promise(t=>{let n=!1,r=Date.now(),o=null,i=u=>{n||(n=!0,o!=null&&window.clearTimeout(o),t({status:u,elapsedMs:Math.max(0,Date.now()-r)}))};e.addEventListener("load",()=>i("load"),{once:!0}),e.addEventListener("error",()=>i("error"),{once:!0}),o=window.setTimeout(()=>i("timeout"),8e3)});function Ve(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.textContent=""}function ln(e,t){let n=e.trim();if(!n)return e;try{return sn.test(n)?new URL(n,document.baseURI).toString():t?new URL(n,t).toString():new URL(n,document.baseURI).toString()}catch{return e}}async function Ke(e){let t=null;e.hostCompositionId&&(t=Array.from(e.sourceNode.querySelectorAll("[data-composition-id]")).find(d=>d.getAttribute("data-composition-id")===e.hostCompositionId)??null);let n=t??e.sourceNode,r=Array.from(n.querySelectorAll("style"));for(let c of r){let d=c.cloneNode(!0);d instanceof HTMLStyleElement&&(document.head.appendChild(d),e.injectedStyles.push(d))}let o=Array.from(n.querySelectorAll("script")),i=[];for(let c of o){let d=c.getAttribute("type")?.trim()??"",a=c.getAttribute("src")?.trim()??"";if(a){let l=ln(a,e.compositionUrl);i.push({kind:"external",src:l,type:d})}else{let l=c.textContent?.trim()??"";l&&i.push({kind:"inline",content:l,type:d})}c.parentNode?.removeChild(c)}let u=Array.from(n.querySelectorAll("style"));for(let c of u)c.parentNode?.removeChild(c);if(t){let c=document.importNode(t,!0),d=t.getAttribute("data-width"),a=t.getAttribute("data-height"),l=e.parseDimensionPx(d),L=e.parseDimensionPx(a);c.style.position="relative",c.style.width=l||"100%",c.style.height=L||"100%",l&&c.style.setProperty("--comp-width",l),L&&c.style.setProperty("--comp-height",L),d&&e.host.setAttribute("data-width",d),a&&e.host.setAttribute("data-height",a),l&&e.host instanceof HTMLElement&&(e.host.style.width=l),L&&e.host instanceof HTMLElement&&(e.host.style.height=L),e.host.appendChild(c)}else e.hasTemplate?e.host.appendChild(document.importNode(n,!0)):e.host.innerHTML=e.fallbackBodyInnerHtml;for(let c of i){let d=document.createElement("script");if(c.type&&(d.type=c.type),d.async=!1,c.kind==="external"?d.src=c.src:c.type.toLowerCase()==="module"?d.textContent=c.content:d.textContent=`(function(){${c.content}})();`,document.body.appendChild(d),e.injectedScripts.push(d),c.kind==="external"){let a=await an(d);a.status!=="load"&&e.onDiagnostic?.({code:"external_composition_script_load_issue",details:{hostCompositionId:e.hostCompositionId,hostCompositionSrc:e.hostCompositionSrc,resolvedScriptSrc:c.src,loadStatus:a.status,elapsedMs:a.elapsedMs}})}}}async function Pt(e){let t=Array.from(document.querySelectorAll("[data-composition-id]:not([data-composition-src])")).filter(n=>{if(n.children.length>0)return!1;let r=n.getAttribute("data-composition-id");return r?!!document.querySelector(`template#${CSS.escape(r)}-template`):!1});if(t.length!==0)for(let n of t){let r=n.getAttribute("data-composition-id"),o=document.querySelector(`template#${CSS.escape(r)}-template`);Ve(n),await Ke({host:n,hostCompositionId:r,hostCompositionSrc:`template#${r}-template`,sourceNode:o.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:null,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic})}}async function Ct(e){let t=Array.from(document.querySelectorAll("[data-composition-src]"));t.length!==0&&await Promise.all(t.map(async n=>{let r=n.getAttribute("data-composition-src");if(!r)return;let o=null;try{o=new URL(r,document.baseURI)}catch{o=null}Ve(n);try{let i=n.getAttribute("data-composition-id"),u=i!=null?document.querySelector(`template#${CSS.escape(i)}-template`):null;if(u){await Ke({host:n,hostCompositionId:i,hostCompositionSrc:r,sourceNode:u.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:o,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic});return}let c=await fetch(r);if(!c.ok)throw new Error(`HTTP ${c.status}`);let d=await c.text(),l=new DOMParser().parseFromString(d,"text/html"),L=(i?l.querySelector(`template#${CSS.escape(i)}-template`):null)??l.querySelector("template"),m=L?L.content:l.body;await Ke({host:n,hostCompositionId:i,hostCompositionSrc:r,sourceNode:m,hasTemplate:!!L,fallbackBodyInnerHtml:l.body.innerHTML,compositionUrl:o,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic})}catch(i){e.onDiagnostic?.({code:"external_composition_load_failed",details:{hostCompositionId:n.getAttribute("data-composition-id"),hostCompositionSrc:r,errorMessage:i instanceof Error?i.message:"unknown_error"}}),Ve(n)}}))}function Ft(){let e=Nt(),t=window,n=null,r=null,o=[],i=new Set,u=null;if(typeof t.__hfRuntimeTeardown=="function")try{t.__hfRuntimeTeardown()}catch{}document.documentElement&&(document.documentElement.style.margin="0",document.documentElement.style.padding="0",document.documentElement.style.overflow="hidden"),document.body&&(document.body.style.margin="0",document.body.style.padding="0",document.body.style.overflow="hidden"),window.__timelines=window.__timelines||{};let c=s=>{o.push(s)},d=(s,p,f)=>{let x=f??`${s}:${JSON.stringify(p)}`;i.has(x)||(i.add(x),le({source:"hf-preview",type:"diagnostic",code:s,details:p}))},a=s=>{let p={scale:1,focusX:960,focusY:540},f=[],x=[],S={time:s.getTime(),duration:s.getDuration(),isPlaying:s.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:s.play,pause:s.pause,seek:s.seek,getTime:s.getTime,getDuration:s.getDuration,isPlaying:s.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>p,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>f,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:s.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>x,getRenderState:()=>({...S,time:s.getTime(),duration:s.getDuration(),isPlaying:s.isPlaying()})}},l=1/60,L=.75,m=.75,y=.35,M=900,w=3,_=2,V=.05,ee=100,z=240,$=s=>{if(s instanceof Error)return s.message||String(s);if(typeof s=="string")return s;try{return JSON.stringify(s)}catch{return String(s??"")}},g=s=>{let p=s.toLowerCase();return p.includes("cannot read properties of null")||p.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:p.includes("failed to execute 'queryselector'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:p.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},A=s=>{if(s==null||s.trim()==="")return null;let p=Number.parseFloat(s);return!Number.isFinite(p)||p<=0?null:`${p}px`},N=()=>{let s=document.querySelector('[data-composition-id][data-root="true"]');if(s instanceof HTMLElement)return s;let p=Array.from(document.querySelectorAll("[data-composition-id]"));return p.length===0?null:p.find(f=>!f.parentElement?.closest("[data-composition-id]"))??p[0]??null},R=()=>{let s=N();if(!s)return;let p=A(s.getAttribute("data-width")),f=A(s.getAttribute("data-height"));p&&(s.style.width=p),f&&(s.style.height=f),p&&s.style.setProperty("--comp-width",p),f&&s.style.setProperty("--comp-height",f)},F=()=>{let s=N(),p=Array.from(document.querySelectorAll("[data-composition-id]")).filter(f=>f.hasAttribute("data-duration")||f.hasAttribute("data-end"));for(let f of p)s&&f===s||(f.removeAttribute("data-duration"),f.removeAttribute("data-end"))},E=()=>{let s=N();if(!s)return;s.style.position||(s.style.position="relative"),s.style.overflow="hidden";let p=A(s.getAttribute("data-width")),f=A(s.getAttribute("data-height"));p&&(s.style.width=p),f&&(s.style.height=f);let x=Array.from(s.children);for(let S of x){let Z=S.tagName.toLowerCase();if(Z==="script"||Z==="style"||Z==="link"||Z==="meta"||!S.hasAttribute("data-start"))continue;let re=(S.style.top==="0px"||S.style.top==="0")&&(S.style.left==="0px"||S.style.left==="0")&&S.style.width==="100%"&&S.style.height==="100%",Le=/translate\(\s*-50%\s*,\s*-50%\s*\)/.test(S.style.transform);if(re&&Le&&!S.hasAttribute("data-width")&&!S.hasAttribute("data-height")){let ce=S.style.top,q=S.style.left,O=S.style.width,J=S.style.height;S.style.top="",S.style.left="",S.style.width="",S.style.height="";let j=window.getComputedStyle(S);j.top!=="auto"||j.bottom!=="auto"||j.left!=="auto"||j.right!=="auto"||j.width!=="0px"||j.height!=="0px"||(S.style.top=ce,S.style.left=q,S.style.width=O,S.style.height=J)}let te=window.getComputedStyle(S),X=te.position;if(X!=="absolute"&&X!=="fixed"&&(S.style.position="absolute"),!!S.style.top||!!S.style.bottom||te.top!=="auto"||te.bottom!=="auto"||(S.style.top="0"),!!S.style.left||!!S.style.right||te.left!=="auto"||te.right!=="auto"||(S.style.left="0"),Z!=="audio"){let ce=A(S.getAttribute("data-width")),q=A(S.getAttribute("data-height")),O=te.width!=="0px"&&te.width!=="auto",J=te.height!=="0px"&&te.height!=="auto";ce?!S.style.width&&!O&&(S.style.width=ce):!S.style.width&&te.width==="0px"&&(S.style.width="100%"),q?!S.style.height&&!J&&(S.style.height=q):!S.style.height&&te.height==="0px"&&(S.style.height="100%")}}},k=(s,p=0)=>Te({timelineRegistry:window.__timelines??{}}).resolveStartForElement(s,p),P=s=>Te({timelineRegistry:window.__timelines??{}}).resolveDurationForElement(s),W=!!document.querySelector("[data-composition-src]"),Y=!1;{let s=document.querySelectorAll("[data-composition-id]:not([data-composition-src])");for(let p of s){let f=p.getAttribute("data-composition-id");if(f&&p.children.length===0&&document.querySelector(`template#${CSS.escape(f)}-template`)){Y=!0;break}}}let U=!W&&!Y,K=s=>{if(!s||typeof s.duration!="function")return null;try{let p=Number(s.duration());return Number.isFinite(p)?Math.max(0,p):null}catch{return null}},H=s=>typeof s=="number"&&Number.isFinite(s)&&s>l,de=s=>{let p=Number(s.getAttribute("data-duration"));if(Number.isFinite(p)&&p>0)return p;let f=Number(s.getAttribute("data-playback-start")??s.getAttribute("data-media-start")??"0"),x=Number.isFinite(f)?Math.max(0,f):0;return Number.isFinite(s.duration)&&s.duration>x?Math.max(0,s.duration-x):null},v=()=>{let s=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(s.length===0)return null;let p=0;for(let f of s){let x=k(f,0);if(!Number.isFinite(x))continue;let S=de(f);S==null||S<=l||(p=Math.max(p,Math.max(0,x)+S))}return p>l?p:null},b=()=>{let s=v();return typeof s!="number"||!Number.isFinite(s)||s<=l?null:s},h=s=>H(s)?Math.max(l,s*L):l,T=(s,p=0)=>{let f=K(s),x=b(),S=Number.isFinite(p)&&p>l?p:0,Z=0;H(f)?Z=Math.max(f,S):H(x)?Z=Math.max(x,S):Z=S;let re=Math.max(1,Number(e.maxTimelineDurationSeconds)||1800);return Z>0?Math.max(0,Math.min(Z,re)):0},C=()=>{let s=window.__timelines??{},p=Te({timelineRegistry:s}),f=b(),x=h(f),S=q=>{let O=document.querySelector(`[data-composition-id="${CSS.escape(q)}"]`);return O?p.resolveStartForElement(O,0):0},Z=q=>{let O=window.gsap;if(!O||typeof O.timeline!="function")return null;let J=O.timeline({paused:!0});for(let j of q)J.add(j.timeline,S(j.compositionId));return J},re=(q,O)=>{if(!H(q))return null;let J=window.gsap;if(!J||typeof J.timeline!="function")return null;let j=J.timeline({paused:!0});if(O)try{j.add(O,0)}catch{}let Q=j;if(typeof Q.to=="function")try{Q.to({},{duration:q})}catch{}return j},Le=(q,O)=>{let J=q;if(typeof J.getChildren!="function")return[];try{let j=J.getChildren(!0,!0,!0)??[];if(!Array.isArray(j))return[];let Q=[];for(let ie of O)if(!j.some(Se=>Se===ie.timeline))try{let Se=S(ie.compositionId);q.add(ie.timeline,Se),Q.push(ie.compositionId)}catch{}return Q}catch{return[]}},te=N(),X=te?.getAttribute("data-composition-id")??null;if(!X)return{timeline:null};let se=s[X]??null,ne=(()=>{if(!te)return[];let q=new Set,O=Array.from(te.querySelectorAll("[data-composition-id]")),J=[];for(let j of O){let Q=j.getAttribute("data-composition-id");if(!Q||Q===X||q.has(Q))continue;q.add(Q);let ie=s[Q]??null;if(!ie||typeof ie.play!="function"||typeof ie.pause!="function")continue;let Ee=K(ie);J.push({compositionId:Q,timeline:ie,durationSeconds:Ee??0})}return J})(),ce=q=>{for(let O of q){let J=O.timeline;if(typeof J.paused=="function")try{J.paused(!1)}catch{}}};if(ne.length>0&&ce(ne),se){let q=ne.length>0?Le(se,ne):[];if((ne.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id='"+X+"'])"))&&(D=!0),q.length>0)try{let j=se.time();se.seek(j,!1)}catch{}let O=K(se);if(!H(O)&&ne.length>0){let j=ne.map(en=>en.compositionId),Q=Z(ne),ie=K(Q);if(Q&&H(ie))return{timeline:Q,selectedTimelineIds:j,selectedDurationSeconds:ie,mediaDurationFloorSeconds:f,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:X,rootDurationSeconds:O,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:x,selectedDurationSeconds:ie,mediaDurationFloorSeconds:f,selectedTimelineIds:j,autoNestedChildren:q}}};let Ee=re(f??0,se),Se=K(Ee);if(Ee&&H(Se))return{timeline:Ee,selectedTimelineIds:[X],selectedDurationSeconds:Se,mediaDurationFloorSeconds:f,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:X,rootDurationSeconds:O,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:f,selectedDurationSeconds:Se,selectedTimelineIds:[X],autoNestedChildren:q}}}}if(!H(O)&&ne.length===0){let j=re(f??0,se),Q=K(j);if(j&&H(Q))return{timeline:j,selectedTimelineIds:[X],selectedDurationSeconds:Q,mediaDurationFloorSeconds:f,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:X,rootDurationSeconds:O,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:f,selectedDurationSeconds:Q,selectedTimelineIds:[X]}}}}let J=te?.getAttribute("data-duration");if(J){let j=parseFloat(J);if(H(j)&&H(O)&&j>=O+.5){let Q=se;if(typeof Q.to=="function")try{Q.to({},{duration:0},j)}catch{}let ie=K(se);if(H(ie))return{timeline:se,selectedTimelineIds:[X],selectedDurationSeconds:ie,mediaDurationFloorSeconds:f,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:X,rootDurationSeconds:O,rootDeclaredDur:j,newDur:ie}}}}}return{timeline:se,selectedTimelineIds:[X],selectedDurationSeconds:O,mediaDurationFloorSeconds:f,diagnostics:q.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:X,selectedDurationSeconds:O,autoNestedChildren:q}}:void 0}}if(ne.length>0){let q=ne.map(j=>j.compositionId),O=Z(ne),J=K(O);if(O)return{timeline:O,selectedTimelineIds:q,selectedDurationSeconds:J,mediaDurationFloorSeconds:f,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:X,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:x,selectedDurationSeconds:J,mediaDurationFloorSeconds:f,selectedTimelineIds:q}}}}return{timeline:null}},G=()=>{let s=e.capturedTimeline;if(!s||typeof s.time!="function")return;let p=Number(s.time());Number.isFinite(p)&&(e.currentTime=Math.max(0,p))},D=!1,I=()=>{if(!U)return!1;let s=e.capturedTimeline,p=K(s),f=H(p);if(s&&f&&D)return!1;let x=C();return x.timeline?s&&s===x.timeline?(typeof s.timeScale=="function"&&s.timeScale(e.playbackRate),!1):(e.capturedTimeline=x.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),x.diagnostics&&le({source:"hf-preview",type:"diagnostic",code:x.diagnostics.code,details:x.diagnostics.details}),le({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:x.selectedTimelineIds??[],selectedDurationSeconds:x.selectedDurationSeconds??null,mediaDurationFloorSeconds:x.mediaDurationFloorSeconds??null}}),!0):!1},B=()=>{let s=N();if(!(s instanceof HTMLElement))return;let p=s.getBoundingClientRect(),f=Number(s.getAttribute("data-width")),x=Number(s.getAttribute("data-height")),S=window.getComputedStyle(s),Z=Number.isFinite(f)&&f>0&&Number.isFinite(x)&&x>0,re=p.width<=0||p.height<=0||s.clientWidth<=0||s.clientHeight<=0;!Z||!re||d("root_stage_layout_zero",{compositionId:s.getAttribute("data-composition-id")??null,declaredWidth:f,declaredHeight:x,rectWidth:Math.round(p.width),rectHeight:Math.round(p.height),clientWidth:s.clientWidth,clientHeight:s.clientHeight,display:S.display,visibility:S.visibility,overflow:S.overflow},`root-stage-layout-zero:${s.getAttribute("data-composition-id")??"unknown"}`)},me=()=>{e.tornDown||(u!=null&&window.cancelAnimationFrame(u),u=window.requestAnimationFrame(()=>{u=null,B()}))},ae=()=>{n=s=>{let p=$(s.error??s.message).slice(0,z);if(!p)return;let f=g(p);le({source:"hf-preview",type:"diagnostic",code:f.code,details:{category:f.category,message:p,filename:s.filename||null,line:Number.isFinite(s.lineno)?s.lineno:null,column:Number.isFinite(s.colno)?s.colno:null}})},r=s=>{let p=$(s.reason).slice(0,z);if(!p)return;let f=g(p);le({source:"hf-preview",type:"diagnostic",code:`${f.code}_unhandled_rejection`,details:{category:`${f.category}-unhandled-rejection`,message:p}})},window.addEventListener("error",n),window.addEventListener("unhandledrejection",r)},ve=()=>{let s=Array.from(document.querySelectorAll("img, video, audio, source, link[rel='stylesheet']"));for(let f of s){let x=()=>{if(!(f instanceof Element))return;let S=f.tagName.toLowerCase(),Z=f.getAttribute("src")??f.getAttribute("href")??f.getAttribute("poster")??null,re=S==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";d(re,{tagName:S,assetUrl:Z,currentSrc:(f instanceof HTMLImageElement||f instanceof HTMLMediaElement)&&f.currentSrc||null,readyState:f instanceof HTMLMediaElement?f.readyState:null,networkState:f instanceof HTMLMediaElement?f.networkState:null},`${re}:${S}:${Z??"unknown"}`)};f.addEventListener("error",x),c(()=>{f.removeEventListener("error",x)})}let p=document.fonts;p&&p.ready.then(()=>{if(e.tornDown)return;let f=Array.from(p).filter(x=>x.status==="error").map(x=>x.family).filter(x=>!!x).slice(0,10);f.length!==0&&d("runtime_font_load_issue",{failedFamilies:f,totalFaces:Array.from(p).length},`runtime-font-load-issue:${f.join("|")}`)}).catch(()=>{})},fe=(s,p)=>{if(!s.timeline)return!1;let f=e.capturedTimeline;if(f&&f===s.timeline)return!1;let x=Math.max(0,e.currentTime||0),S=e.isPlaying;e.capturedTimeline=s.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{e.capturedTimeline.pause(),e.capturedTimeline.seek(x,!1),S&&e.capturedTimeline.play()}catch{}return le({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:p,previousTime:x,selectedTimelineIds:s.selectedTimelineIds??[],selectedDurationSeconds:s.selectedDurationSeconds??null,mediaDurationFloorSeconds:s.mediaDurationFloorSeconds??null}}),!0},be=null,lt=!1,Ie=new Set,_e=()=>{e.tornDown||(be!=null&&window.clearTimeout(be),be=window.setTimeout(()=>{if(e.tornDown)return;be=null;let s=C();if(!s.timeline||!H(s.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){I()&&(ke(),he(!0));return}if(lt)return;let f=K(e.capturedTimeline),x=s.selectedDurationSeconds??K(s.timeline);H(x)&&(!H(f)||x>=f+V)&&fe(s,"manual")&&(lt=!0,le({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:f??null,selectedDurationSeconds:x??null,selectedTimelineIds:s.selectedTimelineIds??[],mediaDurationFloorSeconds:s.mediaDurationFloorSeconds??null}}),ke(),he(!0))},ee))},Qt=()=>{for(let s of Ie)s.removeEventListener("loadedmetadata",_e),s.removeEventListener("durationchange",_e);Ie.clear()},je=()=>{if(e.tornDown)return;let s=Array.from(document.querySelectorAll("video, audio"));for(let p of s)Ie.has(p)||(Ie.add(p),p.addEventListener("loadedmetadata",_e),p.addEventListener("durationchange",_e))},ut=()=>{let s=kt({resolveStartSeconds:x=>k(x,0)});xt({clips:s.mediaClips,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate});let p=document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null,f=Array.from(document.querySelectorAll("[data-start]"));for(let x of f){if(!(x instanceof HTMLElement))continue;let S=x.tagName.toLowerCase();if(S==="script"||S==="style"||S==="link"||S==="meta")continue;if(!x.getAttribute("data-composition-id")){let ce=x.closest("[data-composition-id]")?.getAttribute("data-composition-id")??null;if(ce&&ce!==p)continue}let re=k(x,0),Le=P(x),te=Le!=null&&Le>0?re+Le:Number.POSITIVE_INFINITY,X=te,se=x.getAttribute("data-composition-id");if(se&&!Number.isFinite(te)){let ne=(window.__timelines??{})[se];if(ne&&typeof ne.duration=="function"){let ce=ne.duration();ce>0&&(X=re+ce)}}let $e=e.currentTime>=re&&(Number.isFinite(X)?e.currentTime<X:!0);x.style.visibility=$e?"visible":"hidden"}},he=s=>{G();let p=Math.max(0,Math.round((e.currentTime||0)*e.canonicalFps)),f=Date.now();(s||p!==e.bridgeLastPostedFrame||e.isPlaying!==e.bridgeLastPostedPlaying||e.bridgeMuted!==e.bridgeLastPostedMuted||f-e.bridgeLastPostedAt>=e.bridgeMaxPostIntervalMs)&&(e.bridgeLastPostedFrame=p,e.bridgeLastPostedPlaying=e.isPlaying,e.bridgeLastPostedMuted=e.bridgeMuted,e.bridgeLastPostedAt=f,le({source:"hf-preview",type:"state",frame:p,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},ke=()=>{F(),R(),E();let s=N();if(s){let f=A(s.getAttribute("data-width")),x=A(s.getAttribute("data-height")),S=f?parseInt(f,10):0,Z=x?parseInt(x,10):0;S>0&&Z>0&&le({source:"hf-preview",type:"stage-size",width:S,height:Z})}I();let p=Rt({canonicalFps:e.canonicalFps,maxTimelineDurationSeconds:e.maxTimelineDurationSeconds});window.__clipManifest=p,le(p),me()},Re=(s,p=0)=>{for(let f of e.deterministicAdapters){try{s==="discover"&&f.discover(),s==="pause"&&f.pause(),s==="play"&&f.play&&f.play()}catch{}if(s==="discover")try{f.seek({time:p})}catch{}}};if(!U){let s={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,parseDimensionPx:A,onDiagnostic:({code:p,details:f})=>{le({source:"hf-preview",type:"diagnostic",code:p,details:f})}};Ct(s).then(()=>Pt(s)).finally(()=>{U=!0,Re("discover",e.currentTime),je(),ve(),ke(),he(!0)})}let We=Et({postMessage:s=>le(s)});We.installPickerApi();let ct=s=>{let p=Number(s);!Number.isFinite(p)||p<=0?e.playbackRate=1:e.playbackRate=Math.max(.1,Math.min(5,p)),e.capturedTimeline&&typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);let f=document.querySelectorAll("video, audio");for(let x of f)if(x instanceof HTMLMediaElement)try{x.playbackRate=e.playbackRate}catch{}},oe=Mt({getTimeline:()=>e.capturedTimeline,setTimeline:s=>{e.capturedTimeline=s},getIsPlaying:()=>e.isPlaying,setIsPlaying:s=>{e.isPlaying=s},getPlaybackRate:()=>e.playbackRate,setPlaybackRate:ct,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(s,p)=>{e.currentTime=Math.max(0,Number(s)||0),e.isPlaying=p,ut()},onStatePost:he,onDeterministicSeek:s=>{for(let p of e.deterministicAdapters)try{p.seek({time:Number(s)||0})}catch{}},onDeterministicPause:()=>Re("pause"),onDeterministicPlay:()=>Re("play"),onRenderFrameSeek:()=>{},onShowNativeVideos:()=>{},getSafeDuration:()=>T(e.capturedTimeline,0)});window.__player=a(oe),window.__playerReady=!0,window.__renderReady=!0,pt(le),Pe("composition_loaded",{duration:oe.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.controlBridgeHandler=ft({onPlay:()=>{oe.play(),Pe("composition_played",{time:oe.getTime()})},onPause:()=>{oe.pause(),Pe("composition_paused",{time:oe.getTime()})},onSeek:(s,p)=>{let f=Math.max(0,s)/e.canonicalFps;oe.seek(f),Pe("composition_seeked",{time:f})},onSetMuted:s=>{e.bridgeMuted=s;let p=document.querySelectorAll("video, audio");for(let f of p)f instanceof HTMLMediaElement&&(f.muted=s)},onSetPlaybackRate:s=>ct(s),onEnablePickMode:()=>We.enablePickMode(),onDisablePickMode:()=>We.disablePickMode()}),I(),e.capturedTimeline&&(oe._timeline=e.capturedTimeline),U&&setTimeout(()=>{let s=e.capturedTimeline;I()&&e.capturedTimeline!==s&&(oe._timeline=e.capturedTimeline),Re("discover",e.currentTime),ke(),he(!0)},0),e.deterministicAdapters=[ht({resolveStartSeconds:s=>k(s,0)}),At(),Lt(),St(),gt({getTimeline:()=>e.capturedTimeline})],ae(),Re("discover"),je(),e.timelinePollIntervalId&&clearInterval(e.timelinePollIntervalId);let ze=0,Be=null,dt=0,Ge=!1,xe=0,mt=()=>{dt=Date.now(),Ge=!1,xe=0};e.timelinePollIntervalId=setInterval(()=>{ze+=1;let p=e.isPlaying&&e.capturedTimeline!=null&&Math.max(0,e.currentTime||0)<_?!1:I();if(e.capturedTimeline&&!oe._timeline&&(oe._timeline=e.capturedTimeline),(p||ze%20===0)&&ke(),ze%10===0&&je(),G(),e.isPlaying&&e.capturedTimeline){let f=Math.max(0,e.currentTime||0),x=Be,S=T(e.capturedTimeline,0);if(S>0&&f>=S){oe.pause(),oe.seek(S),Be=S,xe=0,he(!0);return}if(x!=null&&x>=m&&f<=y?xe+=1:xe=0,!Ge&&xe>=w&&Date.now()-dt>M){let re=C();fe(re,"loop_guard")&&(Ge=!0,xe=0)}Be=Math.max(0,e.currentTime||0)}else Be=Math.max(0,e.currentTime||0);e.isPlaying&&ut(),he(!1)},50),ke(),he(!0);let Yt=oe.seek;oe.seek=s=>{mt(),Yt(s)};let Xt=oe.renderSeek;oe.renderSeek=s=>{mt(),Xt(s)};let Ue=()=>{if(!e.tornDown){e.tornDown=!0,e.timelinePollIntervalId&&(clearInterval(e.timelinePollIntervalId),e.timelinePollIntervalId=null),be!=null&&(window.clearTimeout(be),be=null),u!=null&&(window.cancelAnimationFrame(u),u=null),Qt(),e.controlBridgeHandler&&(window.removeEventListener("message",e.controlBridgeHandler),e.controlBridgeHandler=null),n&&(window.removeEventListener("error",n),n=null),r&&(window.removeEventListener("unhandledrejection",r),r=null),e.beforeUnloadHandler&&(window.removeEventListener("beforeunload",e.beforeUnloadHandler),e.beforeUnloadHandler=null),We.disablePickMode();for(let s of e.deterministicAdapters)if(!(!s||typeof s.revert!="function"))try{s.revert()}catch{}e.deterministicAdapters=[];for(let s of o.splice(0))try{s()}catch{}for(let s of e.injectedCompStyles)try{s.remove()}catch{}e.injectedCompStyles=[];for(let s of e.injectedCompScripts)try{s.remove()}catch{}e.injectedCompScripts=[],e.capturedTimeline=null,t.__hfRuntimeTeardown===Ue&&(t.__hfRuntimeTeardown=null)}};t.__hfRuntimeTeardown=Ue,e.beforeUnloadHandler=Ue,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var un=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ON","CS","ON","CS","ON","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ON","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","ON","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],cn=["AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","CS","AL","ON","ON","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","ON","NSM","NSM","NSM","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL"];function dn(e){return e<=255?un[e]:1424<=e&&e<=1524?"R":1536<=e&&e<=1791?cn[e&255]:1792<=e&&e<=2220?"AL":"L"}function mn(e){let t=e.length;if(t===0)return null;let n=new Array(t),r=0;for(let a=0;a<t;a++){let l=dn(e.charCodeAt(a));(l==="R"||l==="AL"||l==="AN")&&r++,n[a]=l}if(r===0)return null;let o=t/r<.3?0:1,i=new Int8Array(t);for(let a=0;a<t;a++)i[a]=o;let u=o&1?"R":"L",c=u,d=c;for(let a=0;a<t;a++)n[a]==="NSM"?n[a]=d:d=n[a];d=c;for(let a=0;a<t;a++){let l=n[a];l==="EN"?n[a]=d==="AL"?"AN":"EN":(l==="R"||l==="L"||l==="AL")&&(d=l)}for(let a=0;a<t;a++)n[a]==="AL"&&(n[a]="R");for(let a=1;a<t-1;a++)n[a]==="ES"&&n[a-1]==="EN"&&n[a+1]==="EN"&&(n[a]="EN"),n[a]==="CS"&&(n[a-1]==="EN"||n[a-1]==="AN")&&n[a+1]===n[a-1]&&(n[a]=n[a-1]);for(let a=0;a<t;a++){if(n[a]!=="EN")continue;let l;for(l=a-1;l>=0&&n[l]==="ET";l--)n[l]="EN";for(l=a+1;l<t&&n[l]==="ET";l++)n[l]="EN"}for(let a=0;a<t;a++){let l=n[a];(l==="WS"||l==="ES"||l==="ET"||l==="CS")&&(n[a]="ON")}d=c;for(let a=0;a<t;a++){let l=n[a];l==="EN"?n[a]=d==="L"?"L":"EN":(l==="R"||l==="L")&&(d=l)}for(let a=0;a<t;a++){if(n[a]!=="ON")continue;let l=a+1;for(;l<t&&n[l]==="ON";)l++;let L=a>0?n[a-1]:c,m=l<t?n[l]:c,y=L!=="L"?"R":"L";if(y===(m!=="L"?"R":"L"))for(let w=a;w<l;w++)n[w]=y;a=l-1}for(let a=0;a<t;a++)n[a]==="ON"&&(n[a]=u);for(let a=0;a<t;a++){let l=n[a];(i[a]&1)===0?l==="R"?i[a]++:(l==="AN"||l==="EN")&&(i[a]+=2):(l==="L"||l==="AN"||l==="EN")&&i[a]++}return i}function Dt(e,t){let n=mn(e);if(n===null)return null;let r=new Int8Array(t.length);for(let o=0;o<t.length;o++)r[o]=n[t[o]];return r}var fn=/[ \t\n\r\f]+/g,pn=/[\t\n\r\f]| {2,}|^ | $/;function hn(e){let t=e??"normal";return t==="pre-wrap"?{mode:t,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:t,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function gn(e){if(!pn.test(e))return e;let t=e.replace(fn," ");return t.charCodeAt(0)===32&&(t=t.slice(1)),t.length>0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function yn(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,`
|
|
13
|
+
`).replace(/[\r\f]/g,`
|
|
14
|
+
`):e.replace(/\r\n/g,`
|
|
15
|
+
`)}var Je=null,bn;function Ln(){return Je===null&&(Je=new Intl.Segmenter(bn,{granularity:"word"})),Je}var Sn=/\p{Script=Arabic}/u,He=/\p{M}/u,_t=/\p{Nd}/u;function Ze(e){return Sn.test(e)}function pe(e){for(let t of e){let n=t.codePointAt(0);if(n>=19968&&n<=40959||n>=13312&&n<=19903||n>=131072&&n<=173791||n>=173824&&n<=177983||n>=177984&&n<=178207||n>=178208&&n<=183983||n>=183984&&n<=191471||n>=196608&&n<=201551||n>=63744&&n<=64255||n>=194560&&n<=195103||n>=12288&&n<=12351||n>=12352&&n<=12447||n>=12448&&n<=12543||n>=44032&&n<=55215||n>=65280&&n<=65519)return!0}return!1}var Xe=new Set(["\uFF0C","\uFF0E","\uFF01","\uFF1A","\uFF1B","\uFF1F","\u3001","\u3002","\u30FB","\uFF09","\u3015","\u3009","\u300B","\u300D","\u300F","\u3011","\u3017","\u3019","\u301B","\u30FC","\u3005","\u303B","\u309D","\u309E","\u30FD","\u30FE"]),De=new Set(['"',"(","[","{","\u201C","\u2018","\xAB","\u2039","\uFF08","\u3014","\u3008","\u300A","\u300C","\u300E","\u3010","\u3016","\u3018","\u301A"]),et=new Set(["'","\u2019"]),we=new Set([".",",","!","?",":",";","\u060C","\u061B","\u061F","\u0964","\u0965","\u104A","\u104B","\u104C","\u104D","\u104F",")","]","}","%",'"',"\u201D","\u2019","\xBB","\u203A","\u2026"]),An=new Set([":",".","\u060C","\u061B"]),kn=new Set(["\u104F"]),xn=new Set(["\u201D","\u2019","\xBB","\u203A","\u300D","\u300F","\u3011","\u300B","\u3009","\u3015","\uFF09"]);function En(e){if(tt(e))return!0;let t=!1;for(let n of e){if(we.has(n)){t=!0;continue}if(!(t&&He.test(n)))return!1}return t}function Tn(e){for(let t of e)if(!Xe.has(t)&&!we.has(t))return!1;return e.length>0}function wn(e){if(tt(e))return!0;for(let t of e)if(!De.has(t)&&!et.has(t)&&!He.test(t))return!1;return e.length>0}function tt(e){let t=!1;for(let n of e)if(!(n==="\\"||He.test(n))){if(De.has(n)||we.has(n)||et.has(n)){t=!0;continue}return!1}return t}function Mn(e){let t=Array.from(e),n=t.length;for(;n>0;){let r=t[n-1];if(He.test(r)){n--;continue}if(De.has(r)||et.has(r)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function Nn(e,t){if(e.length===0)return!1;for(let n of e)if(n!==t)return!1;return!0}function vn(e){return!Ze(e)||e.length===0?!1:An.has(e[e.length-1])}function Rn(e){return e.length===0?!1:kn.has(e[e.length-1])}function Pn(e){if(e.length<2||e[0]!==" ")return null;let t=e.slice(1);return/^\p{M}+$/u.test(t)?{space:" ",marks:t}:null}function nt(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(xn.has(n))return!0;if(!we.has(n))return!1}return!1}function Cn(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===`
|
|
16
|
+
`)return"hard-break"}return e===" "?"space":e==="\xA0"||e==="\u202F"||e==="\u2060"||e==="\uFEFF"?"glue":e==="\u200B"?"zero-width-break":e==="\xAD"?"soft-hyphen":"text"}function Fn(e,t,n,r){let o=[],i=null,u="",c=n,d=!1,a=0;for(let l of e){let L=Cn(l,r),m=L==="text"&&t;if(i!==null&&L===i&&m===d){u+=l,a+=l.length;continue}i!==null&&o.push({text:u,isWordLike:d,kind:i,start:c}),i=L,u=l,c=n+a,d=m,a+=l.length}return i!==null&&o.push({text:u,isWordLike:d,kind:i,start:c}),o}function Qe(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}var Dn=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function In(e,t){let n=e.texts[t];return n.startsWith("www.")?!0:Dn.test(n)&&t+1<e.len&&e.kinds[t+1]==="text"&&e.texts[t+1]==="//"}function _n(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}function Wn(e){let t=e.texts.slice(),n=e.isWordLike.slice(),r=e.kinds.slice(),o=e.starts.slice();for(let u=0;u<e.len;u++){if(r[u]!=="text"||!In(e,u))continue;let c=u+1;for(;c<e.len&&!Qe(r[c]);){t[u]+=t[c],n[u]=!0;let d=t[c].includes("?");if(r[c]="text",t[c]="",c++,d)break}}let i=0;for(let u=0;u<t.length;u++){let c=t[u];c.length!==0&&(i!==u&&(t[i]=c,n[i]=n[u],r[i]=r[u],o[i]=o[u]),i++)}return t.length=i,n.length=i,r.length=i,o.length=i,{len:i,texts:t,isWordLike:n,kinds:r,starts:o}}function Bn(e){let t=[],n=[],r=[],o=[];for(let i=0;i<e.len;i++){let u=e.texts[i];if(t.push(u),n.push(e.isWordLike[i]),r.push(e.kinds[i]),o.push(e.starts[i]),!_n(u))continue;let c=i+1;if(c>=e.len||Qe(e.kinds[c]))continue;let d="",a=e.starts[c],l=c;for(;l<e.len&&!Qe(e.kinds[l]);)d+=e.texts[l],l++;d.length>0&&(t.push(d),n.push(!0),r.push("text"),o.push(a),i=l-1)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:o}}var Hn=new Set([":","-","/","\xD7",",",".","+","\u2013","\u2014"]),It=/^[A-Za-z0-9_]+[,:;]*$/,On=/[,:;]+$/;function Wt(e){for(let t of e)if(_t.test(t))return!0;return!1}function Ye(e){if(e.length===0)return!1;for(let t of e)if(!(_t.test(t)||Hn.has(t)))return!1;return!0}function jn(e){let t=[],n=[],r=[],o=[];for(let i=0;i<e.len;i++){let u=e.texts[i],c=e.kinds[i];if(c==="text"&&Ye(u)&&Wt(u)){let d=u,a=i+1;for(;a<e.len&&e.kinds[a]==="text"&&Ye(e.texts[a]);)d+=e.texts[a],a++;t.push(d),n.push(!0),r.push("text"),o.push(e.starts[i]),i=a-1;continue}t.push(u),n.push(e.isWordLike[i]),r.push(c),o.push(e.starts[i])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:o}}function zn(e){let t=[],n=[],r=[],o=[];for(let i=0;i<e.len;i++){let u=e.texts[i],c=e.kinds[i],d=e.isWordLike[i];if(c==="text"&&d&&It.test(u)){let a=u,l=i+1;for(;On.test(a)&&l<e.len&&e.kinds[l]==="text"&&e.isWordLike[l]&&It.test(e.texts[l]);)a+=e.texts[l],l++;t.push(a),n.push(!0),r.push("text"),o.push(e.starts[i]),i=l-1;continue}t.push(u),n.push(d),r.push(c),o.push(e.starts[i])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:o}}function Gn(e){let t=[],n=[],r=[],o=[];for(let i=0;i<e.len;i++){let u=e.texts[i];if(e.kinds[i]==="text"&&u.includes("-")){let c=u.split("-"),d=c.length>1;for(let a=0;a<c.length;a++){let l=c[a];if(!d)break;(l.length===0||!Wt(l)||!Ye(l))&&(d=!1)}if(d){let a=0;for(let l=0;l<c.length;l++){let L=c[l],m=l<c.length-1?`${L}-`:L;t.push(m),n.push(!0),r.push("text"),o.push(e.starts[i]+a),a+=m.length}continue}}t.push(u),n.push(e.isWordLike[i]),r.push(e.kinds[i]),o.push(e.starts[i])}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:o}}function Un(e){let t=[],n=[],r=[],o=[],i=0;for(;i<e.len;){let u=e.texts[i],c=e.isWordLike[i],d=e.kinds[i],a=e.starts[i];if(d==="glue"){let l=u,L=a;for(i++;i<e.len&&e.kinds[i]==="glue";)l+=e.texts[i],i++;if(i<e.len&&e.kinds[i]==="text")u=l+e.texts[i],c=e.isWordLike[i],d="text",a=L,i++;else{t.push(l),n.push(!1),r.push("glue"),o.push(L);continue}}else i++;if(d==="text")for(;i<e.len&&e.kinds[i]==="glue";){let l="";for(;i<e.len&&e.kinds[i]==="glue";)l+=e.texts[i],i++;if(i<e.len&&e.kinds[i]==="text"){u+=l+e.texts[i],c=c||e.isWordLike[i],i++;continue}u+=l}t.push(u),n.push(c),r.push(d),o.push(a)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:o}}function $n(e){let t=e.texts.slice(),n=e.isWordLike.slice(),r=e.kinds.slice(),o=e.starts.slice();for(let i=0;i<t.length-1;i++){if(r[i]!=="text"||r[i+1]!=="text"||!pe(t[i])||!pe(t[i+1]))continue;let u=Mn(t[i]);u!==null&&(t[i]=u.head,t[i+1]=u.tail+t[i+1],o[i+1]=o[i]+u.head.length)}return{len:t.length,texts:t,isWordLike:n,kinds:r,starts:o}}function qn(e,t,n){let r=Ln(),o=0,i=[],u=[],c=[],d=[];for(let m of r.segment(e))for(let y of Fn(m.segment,m.isWordLike??!1,m.index,n)){let M=y.kind==="text";t.carryCJKAfterClosingQuote&&M&&o>0&&c[o-1]==="text"&&pe(y.text)&&pe(i[o-1])&&nt(i[o-1])||M&&o>0&&c[o-1]==="text"&&Tn(y.text)&&pe(i[o-1])||M&&o>0&&c[o-1]==="text"&&Rn(i[o-1])?(i[o-1]+=y.text,u[o-1]=u[o-1]||y.isWordLike):M&&o>0&&c[o-1]==="text"&&y.isWordLike&&Ze(y.text)&&vn(i[o-1])?(i[o-1]+=y.text,u[o-1]=!0):M&&!y.isWordLike&&o>0&&c[o-1]==="text"&&y.text.length===1&&y.text!=="-"&&y.text!=="\u2014"&&Nn(i[o-1],y.text)||M&&!y.isWordLike&&o>0&&c[o-1]==="text"&&(En(y.text)||y.text==="-"&&u[o-1])?i[o-1]+=y.text:(i[o]=y.text,u[o]=y.isWordLike,c[o]=y.kind,d[o]=y.start,o++)}for(let m=1;m<o;m++)c[m]==="text"&&!u[m]&&tt(i[m])&&c[m-1]==="text"&&(i[m-1]+=i[m],u[m-1]=u[m-1]||u[m],i[m]="");for(let m=o-2;m>=0;m--)if(c[m]==="text"&&!u[m]&&wn(i[m])){let y=m+1;for(;y<o&&i[y]==="";)y++;y<o&&c[y]==="text"&&(i[y]=i[m]+i[y],d[y]=d[m],i[m]="")}let a=0;for(let m=0;m<o;m++){let y=i[m];y.length!==0&&(a!==m&&(i[a]=y,u[a]=u[m],c[a]=c[m],d[a]=d[m]),a++)}i.length=a,u.length=a,c.length=a,d.length=a;let l=Un({len:a,texts:i,isWordLike:u,kinds:c,starts:d}),L=$n(zn(Gn(jn(Bn(Wn(l))))));for(let m=0;m<L.len-1;m++){let y=Pn(L.texts[m]);y!==null&&(L.kinds[m]!=="space"&&L.kinds[m]!=="preserved-space"||L.kinds[m+1]!=="text"||!Ze(L.texts[m+1])||(L.texts[m]=y.space,L.isWordLike[m]=!1,L.kinds[m]=L.kinds[m]==="preserved-space"?"preserved-space":"space",L.texts[m+1]=y.marks+L.texts[m+1],L.starts[m+1]=L.starts[m]+y.space.length))}return L}function Vn(e,t){if(e.len===0)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];let n=[],r=0;for(let o=0;o<e.len;o++)e.kinds[o]==="hard-break"&&(n.push({startSegmentIndex:r,endSegmentIndex:o,consumedEndSegmentIndex:o+1}),r=o+1);return r<e.len&&n.push({startSegmentIndex:r,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),n}function Bt(e,t,n="normal"){let r=hn(n),o=r.mode==="pre-wrap"?yn(e):gn(e);if(o.length===0)return{normalized:o,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let i=qn(o,t,r);return{normalized:o,chunks:Vn(i,r),...i}}var Me=null,Ht=new Map,Ne=null,Kn=/\p{Emoji_Presentation}/u,Jn=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u,it=null,Ot=new Map;function ot(){if(Me!==null)return Me;if(typeof OffscreenCanvas<"u")return Me=new OffscreenCanvas(1,1).getContext("2d"),Me;if(typeof document<"u")return Me=document.createElement("canvas").getContext("2d"),Me;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function Zn(e){let t=Ht.get(e);return t||(t=new Map,Ht.set(e,t)),t}function ge(e,t){let n=t.get(e);return n===void 0&&(n={width:ot().measureText(e).width,containsCJK:pe(e)},t.set(e,n)),n}function Ae(){if(Ne!==null)return Ne;if(typeof navigator>"u")return Ne={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Ne;let e=navigator.userAgent,n=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),r=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return Ne={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:r,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},Ne}function Qn(e){let t=e.match(/(\d+(?:\.\d+)?)\s*px/);return t?parseFloat(t[1]):16}function rt(){return it===null&&(it=new Intl.Segmenter(void 0,{granularity:"grapheme"})),it}function Yn(e){return Kn.test(e)||e.includes("\uFE0F")}function jt(e){return Jn.test(e)}function Xn(e,t){let n=Ot.get(e);if(n!==void 0)return n;let r=ot();r.font=e;let o=r.measureText("\u{1F600}").width;if(n=0,o>t+.5&&typeof document<"u"&&document.body!==null){let i=document.createElement("span");i.style.font=e,i.style.display="inline-block",i.style.visibility="hidden",i.style.position="absolute",i.textContent="\u{1F600}",document.body.appendChild(i);let u=i.getBoundingClientRect().width;document.body.removeChild(i),o-u>.5&&(n=o-u)}return Ot.set(e,n),n}function ei(e){let t=0,n=rt();for(let r of n.segment(e))Yn(r.segment)&&t++;return t}function ti(e,t){return t.emojiCount===void 0&&(t.emojiCount=ei(e)),t.emojiCount}function ye(e,t,n){return n===0?t.width:t.width-ti(e,t)*n}function zt(e,t,n,r){if(t.graphemeWidths!==void 0)return t.graphemeWidths;let o=[],i=rt();for(let u of i.segment(e)){let c=ge(u.segment,n);o.push(ye(u.segment,c,r))}return t.graphemeWidths=o.length>1?o:null,t.graphemeWidths}function Gt(e,t,n,r){if(t.graphemePrefixWidths!==void 0)return t.graphemePrefixWidths;let o=[],i=rt(),u="";for(let c of i.segment(e)){u+=c.segment;let d=ge(u,n);o.push(ye(u,d,r))}return t.graphemePrefixWidths=o.length>1?o:null,t.graphemePrefixWidths}function Ut(e,t){let n=ot();n.font=e;let r=Zn(e),o=Qn(e),i=t?Xn(e,o):0;return{cache:r,fontSize:o,emojiCorrection:i}}function Oe(e){return e==="space"||e==="preserved-space"||e==="tab"||e==="zero-width-break"||e==="soft-hyphen"}function ni(e){return e==="space"}function ii(e,t){if(t<=0)return 0;let n=e%t;return Math.abs(n)<=1e-6?t:t-n}function st(e,t,n,r){return!r||t===null?e[n]:t[n]-(n>0?t[n-1]:0)}function oi(e,t,n,r,o,i){let u=0,c=t;for(;u<e.length;){let d=i?t+e[u]:c+e[u];if((u+1<e.length?d+o:d)>n+r)break;c=d,u++}return{fitCount:u,fittedWidth:c}}function $t(e,t){return e.simpleLineWalkFastPath?ri(e,t):qt(e,t)}function ri(e,t){let{widths:n,kinds:r,breakableWidths:o,breakablePrefixWidths:i}=e;if(n.length===0)return 0;let u=Ae(),c=u.lineFitEpsilon,d=0,a=0,l=!1;function L(m){let y=n[m];if(y>t&&o[m]!==null){let M=o[m],w=i[m]??null;a=0;for(let _=0;_<M.length;_++){let V=st(M,w,_,u.preferPrefixWidthsForBreakableRuns);a>0&&a+V>t+c?(d++,a=V):(a===0&&d++,a+=V)}}else a=y,d++;l=!0}for(let m=0;m<n.length;m++){let y=n[m],M=r[m];if(!l){L(m);continue}let w=a+y;if(w>t+c){if(ni(M))continue;a=0,l=!1,L(m);continue}a=w}return l?d:d+1}function si(e,t,n){let{widths:r,kinds:o,breakableWidths:i,breakablePrefixWidths:u}=e;if(r.length===0)return 0;let c=Ae(),d=c.lineFitEpsilon,a=0,l=0,L=!1,m=0,y=0,M=0,w=0,_=-1,V=0;function ee(){_=-1,V=0}function z(k=M,P=w,W=l){a++,n?.({startSegmentIndex:m,startGraphemeIndex:y,endSegmentIndex:k,endGraphemeIndex:P,width:W}),l=0,L=!1,ee()}function $(k,P){L=!0,m=k,y=0,M=k+1,w=0,l=P}function g(k,P,W){L=!0,m=k,y=P,M=k,w=P+1,l=W}function A(k,P){if(!L){$(k,P);return}l+=P,M=k+1,w=0}function N(k,P){Oe(o[k])&&(_=k+1,V=l-P)}function R(k){F(k,0)}function F(k,P){let W=i[k],Y=u[k]??null;for(let U=P;U<W.length;U++){let K=st(W,Y,U,c.preferPrefixWidthsForBreakableRuns);if(!L){g(k,U,K);continue}l+K>t+d?(z(),g(k,U,K)):(l+=K,M=k,w=U+1)}L&&M===k&&w===W.length&&(M=k+1,w=0)}let E=0;for(;E<r.length;){let k=r[E],P=o[E];if(!L){k>t&&i[E]!==null?R(E):$(E,k),N(E,k),E++;continue}if(l+k>t+d){if(Oe(P)){A(E,k),z(E+1,0,l-k),E++;continue}if(_>=0){z(_,0,V);continue}if(k>t&&i[E]!==null){z(),R(E),E++;continue}z();continue}A(E,k),N(E,k),E++}return L&&z(),a}function qt(e,t,n){if(e.simpleLineWalkFastPath)return si(e,t,n);let{widths:r,lineEndFitAdvances:o,lineEndPaintAdvances:i,kinds:u,breakableWidths:c,breakablePrefixWidths:d,discretionaryHyphenWidth:a,tabStopAdvance:l,chunks:L}=e;if(r.length===0||L.length===0)return 0;let m=Ae(),y=m.lineFitEpsilon,M=0,w=0,_=!1,V=0,ee=0,z=0,$=0,g=-1,A=0,N=0,R=null;function F(){g=-1,A=0,N=0,R=null}function E(v=z,b=$,h=w){M++,n?.({startSegmentIndex:V,startGraphemeIndex:ee,endSegmentIndex:v,endGraphemeIndex:b,width:h}),w=0,_=!1,F()}function k(v,b){_=!0,V=v,ee=0,z=v+1,$=0,w=b}function P(v,b,h){_=!0,V=v,ee=b,z=v,$=b+1,w=h}function W(v,b){if(!_){k(v,b);return}w+=b,z=v+1,$=0}function Y(v,b){if(!Oe(u[v]))return;let h=u[v]==="tab"?0:o[v],T=u[v]==="tab"?b:i[v];g=v+1,A=w-b+h,N=w-b+T,R=u[v]}function U(v){K(v,0)}function K(v,b){let h=c[v],T=d[v]??null;for(let C=b;C<h.length;C++){let G=st(h,T,C,m.preferPrefixWidthsForBreakableRuns);if(!_){P(v,C,G);continue}w+G>t+y?(E(),P(v,C,G)):(w+=G,z=v,$=C+1)}_&&z===v&&$===h.length&&(z=v+1,$=0)}function H(v){if(R!=="soft-hyphen")return!1;let b=c[v];if(b===null)return!1;let h=m.preferPrefixWidthsForBreakableRuns?d[v]??b:b,T=h!==b,{fitCount:C,fittedWidth:G}=oi(h,w,t,y,a,T);return C===0?!1:(w=G,z=v,$=C,F(),C===b.length?(z=v+1,$=0,!0):(E(v,C,G+a),K(v,C),!0))}function de(v){M++,n?.({startSegmentIndex:v.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:v.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),F()}for(let v=0;v<L.length;v++){let b=L[v];if(b.startSegmentIndex===b.endSegmentIndex){de(b);continue}_=!1,w=0,V=b.startSegmentIndex,ee=0,z=b.startSegmentIndex,$=0,F();let h=b.startSegmentIndex;for(;h<b.endSegmentIndex;){let T=u[h],C=T==="tab"?ii(w,l):r[h];if(T==="soft-hyphen"){_&&(z=h+1,$=0,g=h+1,A=w+a,N=w+a,R=T),h++;continue}if(!_){C>t&&c[h]!==null?U(h):k(h,C),Y(h,C),h++;continue}if(w+C>t+y){let D=w+(T==="tab"?0:o[h]),I=w+(T==="tab"?C:i[h]);if(R==="soft-hyphen"&&m.preferEarlySoftHyphenBreak&&A<=t+y){E(g,0,N);continue}if(R==="soft-hyphen"&&H(h)){h++;continue}if(Oe(T)&&D<=t+y){W(h,C),E(h+1,0,I),h++;continue}if(g>=0&&A<=t+y){E(g,0,N);continue}if(C>t&&c[h]!==null){E(),U(h),h++;continue}E();continue}W(h,C),Y(h,C),h++}if(_){let T=g===b.consumedEndSegmentIndex?N:w;E(b.consumedEndSegmentIndex,0,T)}}return M}var at=null;function ai(){return at===null&&(at=new Intl.Segmenter(void 0,{granularity:"grapheme"})),at}function li(e){return e?{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableWidths:[],breakablePrefixWidths:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}:{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableWidths:[],breakablePrefixWidths:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]}}function ui(e,t,n){let r=ai(),o=Ae(),{cache:i,emojiCorrection:u}=Ut(t,jt(e.normalized)),c=ye("-",ge("-",i),u),a=ye(" ",ge(" ",i),u)*8;if(e.len===0)return li(n);let l=[],L=[],m=[],y=[],M=e.chunks.length<=1,w=n?[]:null,_=[],V=[],ee=n?[]:null,z=Array.from({length:e.len}),$=Array.from({length:e.len});function g(R,F,E,k,P,W,Y,U){P!=="text"&&P!=="space"&&P!=="zero-width-break"&&(M=!1),l.push(F),L.push(E),m.push(k),y.push(P),w?.push(W),_.push(Y),V.push(U),ee!==null&&ee.push(R)}for(let R=0;R<e.len;R++){z[R]=l.length;let F=e.texts[R],E=e.isWordLike[R],k=e.kinds[R],P=e.starts[R];if(k==="soft-hyphen"){g(F,0,c,c,k,P,null,null),$[R]=l.length;continue}if(k==="hard-break"){g(F,0,0,0,k,P,null,null),$[R]=l.length;continue}if(k==="tab"){g(F,0,0,0,k,P,null,null),$[R]=l.length;continue}let W=ge(F,i);if(k==="text"&&W.containsCJK){let H="",de=0;for(let v of r.segment(F)){let b=v.segment;if(H.length===0){H=b,de=v.index;continue}if(De.has(H)||Xe.has(b)||we.has(b)||o.carryCJKAfterClosingQuote&&pe(b)&&nt(H)){H+=b;continue}let h=ge(H,i),T=ye(H,h,u);g(H,T,T,T,"text",P+de,null,null),H=b,de=v.index}if(H.length>0){let v=ge(H,i),b=ye(H,v,u);g(H,b,b,b,"text",P+de,null,null)}$[R]=l.length;continue}let Y=ye(F,W,u),U=k==="space"||k==="preserved-space"||k==="zero-width-break"?0:Y,K=k==="space"||k==="zero-width-break"?0:Y;if(E&&F.length>1){let H=zt(F,W,i,u),de=o.preferPrefixWidthsForBreakableRuns?Gt(F,W,i,u):null;g(F,Y,U,K,k,P,H,de)}else g(F,Y,U,K,k,P,null,null);$[R]=l.length}let A=ci(e.chunks,z,$),N=w===null?null:Dt(e.normalized,w);return ee!==null?{widths:l,lineEndFitAdvances:L,lineEndPaintAdvances:m,kinds:y,simpleLineWalkFastPath:M,segLevels:N,breakableWidths:_,breakablePrefixWidths:V,discretionaryHyphenWidth:c,tabStopAdvance:a,chunks:A,segments:ee}:{widths:l,lineEndFitAdvances:L,lineEndPaintAdvances:m,kinds:y,simpleLineWalkFastPath:M,segLevels:N,breakableWidths:_,breakablePrefixWidths:V,discretionaryHyphenWidth:c,tabStopAdvance:a,chunks:A}}function ci(e,t,n){let r=[];for(let o=0;o<e.length;o++){let i=e[o],u=i.startSegmentIndex<t.length?t[i.startSegmentIndex]:n[n.length-1]??0,c=i.endSegmentIndex<t.length?t[i.endSegmentIndex]:n[n.length-1]??0,d=i.consumedEndSegmentIndex<t.length?t[i.consumedEndSegmentIndex]:n[n.length-1]??0;r.push({startSegmentIndex:u,endSegmentIndex:c,consumedEndSegmentIndex:d})}return r}function di(e,t,n,r){let o=Bt(e,Ae(),r?.whiteSpace);return ui(o,t,n)}function Vt(e,t,n){return di(e,t,!1,n)}function Kt(e,t,n){let r=$t(e,t);return{lineCount:r,height:r*n}}var mi={maxWidth:1600,baseFontSize:78,minFontSize:42,fontWeight:900,fontFamily:"Outfit",step:2};function Jt(e,t){let n={...mi,...t},r=1.2;for(let o=n.baseFontSize;o>=n.minFontSize;o-=n.step){let i=`${n.fontWeight} ${o}px ${n.fontFamily}`,u=Vt(e,i),{lineCount:c}=Kt(u,n.maxWidth,o*r);if(c<=1)return{fontSize:o,fits:!0}}return{fontSize:n.minFontSize,fits:!1}}window.__timelines=window.__timelines||{};window.__hyperframes={fitTextFontSize:Jt};function Zt(){let e=window;e.__hyperframeRuntimeBootstrapped||(e.__hyperframeRuntimeBootstrapped=!0,Ft())}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Zt,{once:!0}):Zt();})();
|
|
13
17
|
|
package/dist/index.js
CHANGED
|
@@ -99387,6 +99387,19 @@ function lintHyperframeHtml(html, options = {}) {
|
|
|
99387
99387
|
)
|
|
99388
99388
|
});
|
|
99389
99389
|
}
|
|
99390
|
+
const clipIds = /* @__PURE__ */ new Map();
|
|
99391
|
+
const clipClasses = /* @__PURE__ */ new Map();
|
|
99392
|
+
for (const tag of tags) {
|
|
99393
|
+
const classAttr = readAttr(tag.raw, "class") || "";
|
|
99394
|
+
const classes = classAttr.split(/\s+/).filter(Boolean);
|
|
99395
|
+
if (!classes.includes("clip")) continue;
|
|
99396
|
+
const id = readAttr(tag.raw, "id");
|
|
99397
|
+
const info = { tag: tag.name, id: id || "", classes: classAttr };
|
|
99398
|
+
if (id) clipIds.set(`#${id}`, info);
|
|
99399
|
+
for (const cls of classes) {
|
|
99400
|
+
if (cls !== "clip") clipClasses.set(`.${cls}`, info);
|
|
99401
|
+
}
|
|
99402
|
+
}
|
|
99390
99403
|
const classUsage = countClassUsage(tags);
|
|
99391
99404
|
for (const script of scripts) {
|
|
99392
99405
|
const localTimelineCompId = readRegisteredTimelineCompositionId(script.content);
|
|
@@ -99429,24 +99442,39 @@ ${right2.raw}`)
|
|
|
99429
99442
|
});
|
|
99430
99443
|
}
|
|
99431
99444
|
}
|
|
99445
|
+
for (const win of gsapWindows) {
|
|
99446
|
+
const sel = win.targetSelector;
|
|
99447
|
+
const clipInfo = clipIds.get(sel) || clipClasses.get(sel);
|
|
99448
|
+
if (!clipInfo) continue;
|
|
99449
|
+
const elDesc = `<${clipInfo.tag}${clipInfo.id ? ` id="${clipInfo.id}"` : ""} class="${clipInfo.classes}">`;
|
|
99450
|
+
pushFinding({
|
|
99451
|
+
code: "gsap_animates_clip_element",
|
|
99452
|
+
severity: "error",
|
|
99453
|
+
message: `GSAP animation targets a clip element. Selector "${sel}" resolves to element ${elDesc}. The framework manages clip visibility \u2014 animate an inner wrapper instead.`,
|
|
99454
|
+
selector: sel,
|
|
99455
|
+
elementId: clipInfo.id || void 0,
|
|
99456
|
+
fixHint: "Wrap content in a child <div> and target that with GSAP.",
|
|
99457
|
+
snippet: truncateSnippet(win.raw)
|
|
99458
|
+
});
|
|
99459
|
+
}
|
|
99432
99460
|
if (!localTimelineCompId || localTimelineCompId === rootCompositionId) {
|
|
99433
99461
|
continue;
|
|
99434
99462
|
}
|
|
99435
|
-
for (const
|
|
99436
|
-
if (!isSuspiciousGlobalSelector(
|
|
99463
|
+
for (const win of gsapWindows) {
|
|
99464
|
+
if (!isSuspiciousGlobalSelector(win.targetSelector)) {
|
|
99437
99465
|
continue;
|
|
99438
99466
|
}
|
|
99439
|
-
const className = getSingleClassSelector(
|
|
99467
|
+
const className = getSingleClassSelector(win.targetSelector);
|
|
99440
99468
|
if (className && (classUsage.get(className) || 0) < 2) {
|
|
99441
99469
|
continue;
|
|
99442
99470
|
}
|
|
99443
99471
|
pushFinding({
|
|
99444
99472
|
code: "unscoped_gsap_selector",
|
|
99445
99473
|
severity: "warning",
|
|
99446
|
-
message: `Timeline "${localTimelineCompId}" uses unscoped selector "${
|
|
99447
|
-
selector:
|
|
99448
|
-
fixHint: `Scope the selector: \`[data-composition-id="${localTimelineCompId}"] ${
|
|
99449
|
-
snippet: truncateSnippet(
|
|
99474
|
+
message: `Timeline "${localTimelineCompId}" uses unscoped selector "${win.targetSelector}" that will target elements in ALL compositions when bundled, causing data loss (opacity, transforms, etc.).`,
|
|
99475
|
+
selector: win.targetSelector,
|
|
99476
|
+
fixHint: `Scope the selector: \`[data-composition-id="${localTimelineCompId}"] ${win.targetSelector}\` or use a unique id.`,
|
|
99477
|
+
snippet: truncateSnippet(win.raw)
|
|
99450
99478
|
});
|
|
99451
99479
|
}
|
|
99452
99480
|
}
|
|
@@ -99699,6 +99727,58 @@ ${right2.raw}`)
|
|
|
99699
99727
|
}
|
|
99700
99728
|
}
|
|
99701
99729
|
}
|
|
99730
|
+
for (const script of scripts) {
|
|
99731
|
+
const content = script.content;
|
|
99732
|
+
const hasExitTween = /\.to\s*\([^,]+,\s*\{[^}]*opacity\s*:\s*0/.test(content);
|
|
99733
|
+
const hasHardKill = /\.set\s*\([^,]+,\s*\{[^}]*(?:visibility\s*:\s*["']hidden["']|opacity\s*:\s*0)/.test(content);
|
|
99734
|
+
const hasCaptionLoop = /forEach|\.forEach\s*\(/.test(content) && /createElement|caption|group|cg-/.test(content);
|
|
99735
|
+
if (hasCaptionLoop && hasExitTween && !hasHardKill) {
|
|
99736
|
+
pushFinding({
|
|
99737
|
+
code: "caption_exit_missing_hard_kill",
|
|
99738
|
+
severity: "warning",
|
|
99739
|
+
message: "Caption exit animations (tl.to with opacity: 0) detected without a hard tl.set kill. Exit tweens can fail when karaoke word-level tweens conflict, leaving captions stuck on screen.",
|
|
99740
|
+
fixHint: 'Add `tl.set(groupEl, { opacity: 0, visibility: "hidden" }, group.end)` after every exit tl.to animation as a deterministic kill.'
|
|
99741
|
+
});
|
|
99742
|
+
}
|
|
99743
|
+
}
|
|
99744
|
+
for (const style of styles) {
|
|
99745
|
+
const content = style.content;
|
|
99746
|
+
const captionBlocks = content.matchAll(
|
|
99747
|
+
/(\.caption[-_]?(?:group|container|text|line|word)|#caption[-_]?container)\s*\{([^}]+)\}/gi
|
|
99748
|
+
);
|
|
99749
|
+
for (const [, selector, body] of captionBlocks) {
|
|
99750
|
+
if (!body) continue;
|
|
99751
|
+
const hasNowrap = /white-space\s*:\s*nowrap/i.test(body);
|
|
99752
|
+
const hasMaxWidth = /max-width/i.test(body);
|
|
99753
|
+
if (hasNowrap && !hasMaxWidth) {
|
|
99754
|
+
pushFinding({
|
|
99755
|
+
code: "caption_text_overflow_risk",
|
|
99756
|
+
severity: "warning",
|
|
99757
|
+
selector: (selector ?? "").trim(),
|
|
99758
|
+
message: `Caption selector "${(selector ?? "").trim()}" has white-space: nowrap but no max-width. Long phrases will clip off-screen.`,
|
|
99759
|
+
fixHint: "Add max-width: 1600px (landscape) or max-width: 900px (portrait) and overflow: hidden."
|
|
99760
|
+
});
|
|
99761
|
+
}
|
|
99762
|
+
}
|
|
99763
|
+
}
|
|
99764
|
+
for (const style of styles) {
|
|
99765
|
+
const content = style.content;
|
|
99766
|
+
const captionBlocks = content.matchAll(
|
|
99767
|
+
/(\.caption[-_]?(?:group|container|text|line)|#caption[-_]?container)\s*\{([^}]+)\}/gi
|
|
99768
|
+
);
|
|
99769
|
+
for (const [, selector, body] of captionBlocks) {
|
|
99770
|
+
if (!body) continue;
|
|
99771
|
+
if (/position\s*:\s*relative/i.test(body)) {
|
|
99772
|
+
pushFinding({
|
|
99773
|
+
code: "caption_container_relative_position",
|
|
99774
|
+
severity: "warning",
|
|
99775
|
+
selector: (selector ?? "").trim(),
|
|
99776
|
+
message: `Caption selector "${(selector ?? "").trim()}" uses position: relative which causes overflow and breaks caption stacking.`,
|
|
99777
|
+
fixHint: "Use position: absolute for all caption elements."
|
|
99778
|
+
});
|
|
99779
|
+
}
|
|
99780
|
+
}
|
|
99781
|
+
}
|
|
99702
99782
|
{
|
|
99703
99783
|
const externalScriptRe = /<script\b[^>]*\bsrc=["'](https?:\/\/[^"']+)["'][^>]*>/gi;
|
|
99704
99784
|
let match2;
|
|
@@ -99717,11 +99797,13 @@ ${right2.raw}`)
|
|
|
99717
99797
|
}
|
|
99718
99798
|
}
|
|
99719
99799
|
const errorCount = findings.filter((finding) => finding.severity === "error").length;
|
|
99720
|
-
const warningCount = findings.
|
|
99800
|
+
const warningCount = findings.filter((finding) => finding.severity === "warning").length;
|
|
99801
|
+
const infoCount = findings.filter((finding) => finding.severity === "info").length;
|
|
99721
99802
|
return {
|
|
99722
99803
|
ok: errorCount === 0,
|
|
99723
99804
|
errorCount,
|
|
99724
99805
|
warningCount,
|
|
99806
|
+
infoCount,
|
|
99725
99807
|
findings
|
|
99726
99808
|
};
|
|
99727
99809
|
}
|
|
@@ -100040,6 +100122,14 @@ function quantizeTimeToFrame(timeSeconds, fps) {
|
|
|
100040
100122
|
return frameIndex / safeFps;
|
|
100041
100123
|
}
|
|
100042
100124
|
|
|
100125
|
+
// ../../node_modules/.bun/@chenglou+pretext@0.0.3/node_modules/@chenglou/pretext/dist/analysis.js
|
|
100126
|
+
var arabicScriptRe = new RegExp("\\p{Script=Arabic}", "u");
|
|
100127
|
+
var combiningMarkRe = new RegExp("\\p{M}", "u");
|
|
100128
|
+
var decimalDigitRe = new RegExp("\\p{Nd}", "u");
|
|
100129
|
+
|
|
100130
|
+
// ../../node_modules/.bun/@chenglou+pretext@0.0.3/node_modules/@chenglou/pretext/dist/measurement.js
|
|
100131
|
+
var emojiPresentationRe = new RegExp("\\p{Emoji_Presentation}", "u");
|
|
100132
|
+
|
|
100043
100133
|
// ../engine/src/services/screenshotService.ts
|
|
100044
100134
|
var cdpSessionCache = /* @__PURE__ */ new WeakMap();
|
|
100045
100135
|
async function getCdpSession(page) {
|
|
@@ -103049,7 +103139,7 @@ var Context = class {
|
|
|
103049
103139
|
* @param layout - The layout to set.
|
|
103050
103140
|
* @returns The layout function.
|
|
103051
103141
|
*/
|
|
103052
|
-
setLayout = (
|
|
103142
|
+
setLayout = (layout2) => this.#layout = layout2;
|
|
103053
103143
|
/**
|
|
103054
103144
|
* Gets the current layout for the response.
|
|
103055
103145
|
*
|