import{w}from"./chunk-EVOBXE3Y-Bmgys8-c.js";import{j as f}from"./jsx-runtime-hUI6LOBV.js";import{r as u}from"./index-CFdT0RIo.js";import{E as g,D as h}from"./epic-video-CaAYhEZJ.js";import"./loading-Cf-_cX4u.js";import"./index-BiGqsMpe.js";import"./misc-BNcbB3dR.js";import"./tooltip-CoTdGGXz.js";import"./index-ZNADqOyW.js";import"./root-loader-ByAKsmmv.js";import"./pe-BRA_K7Pt.js";import"./schemas-Bn3zadsT.js";import"./index-Bh67Vwl7.js";import"./online-BM9kpW1W.js";import"./format-C6HW_OzJ.js";import"./user-BrD2IM_u.js";import"./workshop-config-BNvMPSev.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"66e9b849450b819e11683314a547a341cb57f7d0"};var o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="00294e7a-a0b0-4a1b-8ba1-27e9b317d30d",e._sentryDebugIdIdentifier="sentry-dbid-00294e7a-a0b0-4a1b-8ba1-27e9b317d30d")}catch{}})();function m(e,o,n={}){const{schema:a}=n,r=crypto.randomUUID();return new Promise((i,t)=>{if(!window.parent||window.parent===window){console.log("[MCP] No parent frame available. Would have sent message:",{type:e,messageId:r,payload:o}),t(new Error("No parent frame available"));return}window.parent.postMessage({type:e,messageId:r,payload:o},"*");function s(d){if(d.data.type!=="ui-message-response"||d.data.messageId!==r)return;window.removeEventListener("message",s);const{response:c,error:l}=d.data.payload;if(l)return t(l);if(!a)return i(c);const p=a.safeParse(c);return p.success?i(p.data):t(p.error)}window.addEventListener("message",s)})}const U=w(function({loaderData:o}){const n=u.useRef(null);u.useEffect(()=>{o.videoInfos?.finally(()=>{if(window.parent.postMessage({type:"ui-lifecycle-iframe-ready"},"*"),!n.current)return;const r=n.current.clientHeight,i=n.current.clientWidth;window.parent.postMessage({type:"ui-size-change",payload:{height:r,width:i}},"*")})},[o.videoInfos]);async function a(r){const i=r.target;if(!(i instanceof HTMLAnchorElement))return;const t=i.href;if(!t)return;r.preventDefault(),r.stopPropagation();const s=t.startsWith("http")?new URL(t):new URL(t,window.location.origin);s.host===window.location.host&&s.pathname==="/login"&&await m("tool",{toolName:"login",params:{workshopDirectory:ENV.EPICSHOP_CONTEXT_CWD}}),await m("link",{url:s.toString()})}return f.jsx("div",{ref:n,onClickCapture:a,children:f.jsx(g,{epicVideoInfosPromise:o.videoInfos,children:f.jsx(h,{url:o.videoUrl})})})});export{U as default};
//# sourceMappingURL=epic-video-CBu8Wl-E.js.map
