import{f as $,l as O,D as R,e as T,U as B}from"./vendor-ui-DXwyveTF.js";import{E as m,z as N,g as z,q as w}from"./index-B5qe6yln.js";import{v as b,aA as k,ab as L,l as F,r as e,aO as a,i as t,ax as l,ap as f,q as x,ac as j,aC as U,aD as q,a7 as K,aj as W,j as G,af as H,g as A}from"./vendor-core-CzvSW5ae.js";import{c as X}from"./useCompMetaLocalStore-eE-CBcE9.js";import{B as Y,_ as J}from"./index.vue_vue_type_script_setup_true_lang-DCQMqfel.js";/* empty css                *//* empty css                */import{_ as Q}from"./index.vue_vue_type_script_setup_true_lang-DM_Wm4GD.js";import{u as Z}from"./useVscodeOpen-Dx3IRL0P.js";import{_ as ee}from"./PanelBackground.vue_vue_type_script_setup_true_lang-DBIlZFl0.js";import{_ as oe}from"./EmptyStatusContainer.vue_vue_type_script_setup_true_lang-CofI0Rvq.js";import"./index.vue_vue_type_style_index_0_lang-BQWxY2F1.js";import"./core-B1GcTOER.js";import"./useTeamHeaders-Cc060CP0.js";import"./index.vue_vue_type_script_setup_true_lang-D3xHCy9f.js";import"./index-CEQStqDa.js";import"./BaseDialog.vue_vue_type_script_setup_true_lang-CgV6_zzd.js";import"./useCacheOssStore-DApHt9lQ.js";import"./useMessage-CYVXvlqq.js";const te={class:"size-full overflow-hidden flex flex-col"},ae={class:"size-full"},se={class:"flex items-center"},ne={class:"flex-1"},le={class:"text-xs ml-auto"},ce=b({__name:"index",props:{version:{},compAttrs:{}},setup(s){const{openCompPathInVscode:v}=Z(),h=s,{t:p}=k();function C(){v(h.compAttrs.fullPath,`./${m.COMP_CONFIG_FILENAME}`)}return(P,c)=>{const r=$,i=O,o=R;return L(),F("div",te,[e(l(ee),{class:"size-full flex-1 shrink-0 flex flex-col gap-1",bg:s.compAttrs?.bgColor},{default:a(({bg:u,updateColor:d})=>[e(r,{"body-class":"!p-0 !overflow-visible",class:"flex-1 relative z-10"},{default:a(()=>[t("div",ae,[e(Q,{compAttrs:s.compAttrs,version:s.version,compType:l(m).IFRAME_ROUTES.ITEM.PREVIEW_LOCAL},null,8,["compAttrs","version","compType"])])]),_:1}),t("div",se,[t("div",ne,[t("span",null,f(s.compAttrs?.version),1)]),t("span",le,[t("span",null,f(l(p)("comp.bgPanel"))+"：",1),e(i,{teleported:!0,modelValue:u,clearable:"",onChange:d,onActiveChange:d},null,8,["modelValue","onChange","onActiveChange"])])])]),_:1},8,["bg"]),t("div",null,[x(f(l(p)("comp.compLocation"))+"： ",1),e(o,{href:"javascript:void(0)",type:"primary",underline:"always",onClick:C},{default:a(()=>[x(f(s.compAttrs.fullPath),1)]),_:1})])])}}}),re={class:"h-[50vh]"},Le=b({__name:"index",setup(s){const{t:v}=k(),h=new Map;j(m.PROVIDE_KEY_CALLBACKS,h);const p=U(),C=q(),P=N(),{compId:c}=p.params,r=X(c)(),i=H(!1),o=A(()=>r.detail),u=A(()=>Object.keys(o.value??{}).length>0),d=A(()=>{const n=z.getPreviewUrl(o.value.path,[`\\${m.COMP_README_FILENAME}`]);return`${m.COMP_PREVIEW_PREFIX_LOCAL}/${n}`});async function D(){if(!c)return;i.value=!0;const n=await w.v1Comp.compcontrollerLocalcompdetailbypathhash({fullPathHash:c}),y=await w.v1Comp.compcontrollerDep({compPath:n.data.path}),{thirdParty:_=[]}=y.data,E=_.map(S=>S.name),g=await w.v1Module.modulecontrollerPrebuild({deps:E}),{entryNameToFile:V={}}=g.data;r.setDetail(n.data),r.setDep(_),r.setDepToFile(V),i.value=!1}function I(){P.addPayLoad(`/previewLocal/${c}`,{name:`${o.value?.name??""}`})}function M(){const{href:n}=C.resolve({name:"previewLocalBlank",params:{compId:c}});window.open(n,"_blank")}return K(async()=>{u.value||await D(),I()}),(n,y)=>{const _=W("Icon"),E=T,g=B;return L(),G(g,{"wrap-class":"preview-container",class:"size-full p-[10px]"},{default:a(()=>[e(l(oe),{isEmpty:!u.value,loading:i.value},{default:a(()=>[t("div",re,[e(l(Y),{title:o.value?.name,actions:["maximize"]},{beforeActions:a(()=>[e(E,{type:"primary",circle:"",title:l(v)("common.newPage"),onClick:M},{default:a(()=>[e(_,{icon:"material-symbols:screen-share-rounded"})]),_:1},8,["title"])]),default:a(()=>[e(ce,{compAttrs:o.value,version:o.value.version},null,8,["compAttrs","version"])]),_:1},8,["title"])]),e(J,{mdSrc:d.value,scrollContainer:".preview-container",stickyTopDistance:0,showSimilarComp:!1},null,8,["mdSrc"])]),_:1},8,["isEmpty","loading"])]),_:1})}}});export{Le as default};
