import{aG as N,b1 as P,b0 as R,aC as m,aZ as $,aF as c,ad as A,bB as o,az as d,bj as l,aA as C,aB as i,s as D,bm as _,bc as I,aO as j,R as q,bb as n,av as S,b3 as r,aE as u,aU as G,al as M}from"./index-DrvLDslf.js";/* empty css             *//* empty css                  *//* empty css               */const H={key:0,class:"workspace-3d-toolbar"},Z={class:"hint"},J=["src"],K={key:1,class:"workspace-3d-mask"},Q=N({__name:"Workspace3D",props:{host:{default:void 0},scope:{default:"Platform"},token:{default:""},readOnly:{type:Boolean,default:!1},embedUi:{type:Boolean,default:!1},canvasOnly:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1}},emits:["pick","select","ready"],setup(s,{expose:U,emit:W}){const t=s,y=W,v=n(),g=n(),k=n(!1),f=n(null),b=n([]),w=n(""),p=S(()=>t.host??"localhost:8223"??"localhost:8223"),L=S(()=>{const a=new URLSearchParams;return a.set("scope",t.scope??"Platform"),t.token&&a.set("token",t.token),a.set("ro",t.readOnly?"1":"0"),t.canvasOnly?a.set("ui","canvas-only"):t.embedUi&&a.set("ui","embed"),`http://${p.value}/?${a.toString()}`});async function F(){const a=t.canvasOnly?"/declareCanvasOnly":t.embedUi?"/declareEmbedUi":null;if(a)try{await fetch(`http://${p.value}${a}`,{method:"GET",mode:"no-cors",cache:"no-store",credentials:"omit",keepalive:!0})}catch(e){console.warn(`[Workspace3D] ${a} 请求失败，SimpleLite 可能仍以完整面板模式启动：`,e)}}async function B(){k.value=!1,await F(),w.value=L.value}function T(){k.value=!0,y("ready")}function E(a){if(!v.value||a.source!==v.value.contentWindow)return;const e=a.data;!e||typeof e!="object"||(e.type==="workspace.pick"&&e.payload&&typeof e.payload.x=="number"?(f.value=e.payload,y("pick",e.payload)):e.type==="workspace.select"&&Array.isArray(e.payload)&&(b.value=e.payload,y("select",e.payload)))}function x(){B()}function O(){const a=g.value;a&&(document.fullscreenElement?document.exitFullscreen():a.requestFullscreen())}return P(()=>{window.addEventListener("message",E),B()}),R(()=>{window.removeEventListener("message",E)}),U({reload:x,enterFullscreen:O}),(a,e)=>{const h=A,z=D,V=q;return r(),m("div",{class:$(["workspace-3d-wrap",{"workspace-3d--canvas-only":s.canvasOnly||s.hideToolbar}])},[s.canvasOnly||s.hideToolbar?i("",!0):(r(),m("div",H,[c(h,{type:s.readOnly?"info":"success",effect:"dark",size:"small"},{default:o(()=>[u(l(s.readOnly?"只读":"可交互"),1)]),_:1},8,["type"]),d("span",Z,"webVRender · http://"+l(p.value)+" · scope="+l(s.scope),1),e[2]||(e[2]=d("div",{class:"spacer"},null,-1)),f.value?(r(),C(h,{key:0,type:"warning",size:"small"},{default:o(()=>[u(" Pick ("+l(f.value.x.toFixed(0))+", "+l(f.value.y.toFixed(0))+") ",1)]),_:1})):i("",!0),b.value.length?(r(),C(h,{key:1,type:"primary",size:"small"},{default:o(()=>[u(" Selected: "+l(b.value.length),1)]),_:1})):i("",!0),c(z,{size:"small",icon:_(I),onClick:x},{default:o(()=>[...e[0]||(e[0]=[u("重载",-1)])]),_:1},8,["icon"]),c(z,{size:"small",icon:_(j),onClick:O},{default:o(()=>[...e[1]||(e[1]=[u("全屏",-1)])]),_:1},8,["icon"])])),d("div",{ref_key:"frameWrap",ref:g,class:"workspace-3d-frame"},[w.value?(r(),m("iframe",{key:0,ref_key:"frame",ref:v,src:w.value,class:"workspace-3d-iframe",allow:"fullscreen",onLoad:T},null,40,J)):i("",!0),k.value?i("",!0):(r(),m("div",K,[c(V,{class:"is-loading",size:"32"},{default:o(()=>[c(_(G))]),_:1}),d("span",null,"正在连接 webVRender (http://"+l(p.value)+") ...",1),e[3]||(e[3]=d("span",{class:"muted"},"如长时间未加载，请确认 SimpleLite 已以 Web-Enabled 模式启动且 8223 端口可达。",-1))]))],512)],2)}}}),te=M(Q,[["__scopeId","data-v-fdbecbc9"]]);export{te as W};
