import{y as w,J as C,E as L}from"./index-B5qe6yln.js";import{c as O}from"./index-CEQStqDa.js";import{aD as G}from"./vendor-ui-DXwyveTF.js";import{v as b,aA as k,aF as M,aM as P,ab as W,l as D,i as h,ax as B,g as m}from"./vendor-core-CzvSW5ae.js";import{c as N,b as y,I as a,a as l,e as F}from"./useMessage-CYVXvlqq.js";const R={class:"size-full"},x=["src"],V=b({__name:"index",props:{compType:{},version:{},compAttrs:{},iuid:{},bgColor:{}},setup(f){const s=f,{locale:d}=k(),_=w(),T=C(),r=N(!1,window.__GLOBAL_CONFIG__.subPort),{instanceUid:E,messageListener:g,sendMessageToTargetIframe:n}=F(),{addListener:i}=g(),{createIframeParams:I}=y(),S=G().value,c=M("iframe"),A=(()=>{const e={topOrigin:window.location.origin,userId:T.userId??"",instanceUid:[E.value,s.iuid].join(",")??"",compId:s.compAttrs?._id??"",isSfc:!0},t={params:I(e),isDark:S.toString()},o=new URLSearchParams(t).toString();return`${r}/${L.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_GET,l(m(()=>_.deps),()=>{const e=c.value?.contentWindow;e&&n(e,a.SETTING_DATA_SET,_.deps,r)}).triggerCallback),i(a.LOCALE_GET,()=>{const{stopWatch:e,triggerCallback:t}=l(m(()=>d.value),()=>{const o=c.value?.contentWindow;o?n(o,a.LOCALE_SET,d.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,[h("iframe",{ref:"iframe",class:"size-full",src:B(A),frameborder:"0"},null,8,x)]))}});export{V as _};
