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