import{J as h,z as C,m as u}from"./index-D88CvPWT.js";import{c as _}from"./useCompMetaLocalStore-BKTMp_k8.js";import{aD as w}from"./vendor-ui-CGT0cG1n.js";import{u as D}from"./useVscodeOpen-BBdyQ3W2.js";import{v as N,aF as k,aM as G,ab as v,l as F,i as W,ax as b,g as f}from"./vendor-core-BKehvho7.js";import{c as B,b as $,I as s,a as T,e as x}from"./useMessage-Cbhfk7Nk.js";const R={class:"size-full"},U=["src"],q=N({__name:"index",props:{compType:{},version:{},compAttrs:{},iuid:{}},setup(I){const o=I,E=h(),p=C(),r=B(!1,window.__GLOBAL_CONFIG__.subPort),{instanceUid:S,messageListener:A,sendMessageToTargetIframe:m}=x(),{addListener:n}=A(),{createIframeParams:g}=$(),{openCompPathInVscode:L,handlePath:P}=D(),M=w().value,l=k("iframe"),O=(()=>{const e={topOrigin:window.location.origin,userId:E.userId??"",instanceUid:[S.value,o.iuid].join(",")??"",compId:o.compAttrs?._id??"",isSfc:!0},t={params:g(e),isDark:M.toString()},a=new URLSearchParams(t).toString();return`${r}/${u.WEBSITE_PATH_ITEM}/${o.compType}?${a}`})();async function d(){const e=l.value?.contentWindow;if(e){const t=_(o.compAttrs?._id)(),{dep:a,depToFile:c}=t,i={item:o.compAttrs,dep:a,depToFile:c};m(e,s.ITEM_INIT_SET_LOCAL,i,r)}}return n(s.ITEM_INIT_GET_LOCAL,()=>{d()}),n(s.ITEM_SITE_PATH_GET,e=>{const t=_(e)(),{stopWatch:a,triggerCallback:c}=T(f(()=>t.detail.fullPath),()=>{const i=l.value?.contentWindow;i?m(i,s.ITEM_SITE_PATH_SET,P(t.detail.fullPath,1),r):a()});c(e)}),n(s.ACTION_OPEN_VSCODE_LOCAL,e=>{const a=_(e)().detail.fullPath;L(a,`./${u.COMP_CONFIG_FILENAME}`)}),n(s.SETTING_DATA_LEAF_GET,T(f(()=>p.deps),()=>{const e=l.value?.contentWindow;e&&m(e,s.SETTING_DATA_LEAF_SET,p.deps,r)}).triggerCallback),G(()=>o.compAttrs,e=>{e&&d()}),(e,t)=>(v(),F("div",R,[W("iframe",{ref:"iframe",class:"size-full",src:b(O),frameborder:"0"},null,8,U)]))}});export{q as _};
