import{f as $,l as O,D as R,e as T,U as B}from"./vendor-ui-CGT0cG1n.js";import{m,A as N,e as F,r as w}from"./index-D88CvPWT.js";import{v as b,aA as k,ab as L,l as z,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 K,a7 as W,aj as q,j as G,af as H,g}from"./vendor-core-BKehvho7.js";import{c as X}from"./useCompMetaLocalStore-BKTMp_k8.js";import{B as Y,_ as J}from"./index.vue_vue_type_script_setup_true_lang-D9A1RF52.js";/* empty css                *//* empty css                */import{_ as Q}from"./index.vue_vue_type_script_setup_true_lang-DTC1Qz-g.js";import{u as Z}from"./useVscodeOpen-BBdyQ3W2.js";import{_ as ee}from"./PanelBackground.vue_vue_type_script_setup_true_lang-BELCrrRh.js";import{_ as oe}from"./EmptyStatusContainer.vue_vue_type_script_setup_true_lang-pswB5SUz.js";import"./index.vue_vue_type_style_index_0_lang-BZ1LzI3x.js";import"./core-CcVTMiBP.js";import"./useTeamHeaders-DxHN7-t0.js";import"./index.vue_vue_type_script_setup_true_lang-CmmAEEXC.js";import"./index-B9hCLAJk.js";import"./useCacheOssStore-OAoLDVbw.js";import"./BaseDialog.vue_vue_type_script_setup_true_lang-BROcUfEh.js";import"./useMessage-Cbhfk7Nk.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(),z("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=K(),P=N(),{compId:c}=p.params,r=X(c)(),i=H(!1),o=g(()=>r.detail),u=g(()=>Object.keys(o.value??{}).length>0),d=g(()=>{const n=F.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,A=_.map(S=>S.name),E=await w.v1Module.modulecontrollerPrebuild({deps:A}),{entryNameToFile:V={}}=E.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 W(async()=>{u.value||await D(),I()}),(n,y)=>{const _=q("Icon"),A=T,E=B;return L(),G(E,{"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(A,{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};
