import{w}from"./chunk-UIGDSWPH-C8mvmDRm.js";import{j as d}from"./jsx-runtime-CbGirg_M.js";import{r as m}from"./index-BoRhKTB8.js";import{E as g,D as h}from"./epic-video-9ssNJt3Q.js";import"./use-event-source-ZDun4YKa.js";import"./index-BC6L6d4X.js";import"./index-BJDrpBtR.js";import"./index-BN_canAo.js";import"./misc-D4V-U9nd.js";import"./tooltip-DpaM3OdK.js";import"./root-loader-AwLG1D86.js";import"./pe-D6_3VIe8.js";import"./types-s0-I03ry.js";import"./online-C_a_7ixK.js";import"./loading-DGPrsY7f.js";import"./user-DjQP8Fan.js";import"./workshop-config-C0r84dtp.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"28ce3948dcef68c9e8b5be7c5619a3bd17c18150"}}catch{}})();function u(s,o,i={}){const{schema:a}=i,e=crypto.randomUUID();return new Promise((r,t)=>{if(!window.parent||window.parent===window){console.log("[MCP] No parent frame available. Would have sent message:",{type:s,messageId:e,payload:o}),t(new Error("No parent frame available"));return}window.parent.postMessage({type:s,messageId:e,payload:o},"*");function n(p){if(p.data.type!=="ui-message-response"||p.data.messageId!==e)return;window.removeEventListener("message",n);const{response:f,error:l}=p.data.payload;if(l)return t(l);if(!a)return r(f);const c=a.safeParse(f);return c.success?r(c.data):t(c.error)}window.addEventListener("message",n)})}const W=w(function({loaderData:o}){const i=m.useRef(null);m.useEffect(()=>{o.videoInfos?.finally(()=>{if(window.parent.postMessage({type:"ui-lifecycle-iframe-ready"},"*"),!i.current)return;const e=i.current.clientHeight,r=i.current.clientWidth;window.parent.postMessage({type:"ui-size-change",payload:{height:e,width:r}},"*")})},[o.videoInfos]);async function a(e){const r=e.target;if(!(r instanceof HTMLAnchorElement))return;const t=r.href;if(!t)return;e.preventDefault(),e.stopPropagation();const n=t.startsWith("http")?new URL(t):new URL(t,window.location.origin);n.host===window.location.host&&n.pathname==="/login"&&await u("tool",{toolName:"login",params:{workshopDirectory:ENV.EPICSHOP_CONTEXT_CWD}}),await u("link",{url:n.toString()})}return d.jsx("div",{ref:i,onClickCapture:a,children:d.jsx(g,{epicVideoInfosPromise:o.videoInfos,children:d.jsx(h,{url:o.videoUrl})})})});export{W as default};
//# sourceMappingURL=epic-video-Cbys4McR.js.map
