var p=Object.defineProperty;var l=(t,e,s)=>e in t?p(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var o=(t,e,s)=>(l(t,typeof e!="symbol"?e+"":e,s),s);import{j as m,u as h,aW as u,aX as d,aY as f,aZ as y,n as D,e as S,o as v}from"./index-03b6134d.js";import"./index-0a53aaef.js";import"./postmen-9e6354af.js";function b(t){const e={asset:{version:"2.0",generator:"Galacean Editor"},scene:{rootEntities:["1000000","1000001"],background:{mode:0,color:{r:.0157,g:.0157,b:.0157,a:1}},ambient:{},shadow:{},fog:{}},entities:[{id:"1000000",name:"Camera",position:[0,0,10],components:["1000100"]},{id:"1000001",name:"DirectLight",position:[0,3,0],rotation:[-45,-45,0],components:["1000101"]}],components:[{id:"1000100",type:"Camera",props:{isOrthographic:!1,nearClipPlane:.1,farClipPlane:100,viewport:{x:0,y:0,z:1,w:1}}},{id:"1000101",type:"DirectLight",props:{enabled:!0,intensity:.6,color:{r:1,g:1,b:1,a:1}}}]};return t!==void 0&&(e.scene.name=t),e}var g=Object.defineProperty,w=Object.getOwnPropertyDescriptor,C=(t,e,s,a)=>{for(var n=a>1?void 0:a?w(e,s):e,i=t.length-1,r;i>=0;i--)(r=t[i])&&(n=(a?r(e,s,n):r(n))||n);return a&&n&&g(e,s,n),n};let c=class extends m{constructor(e){super(e);o(this,"sceneData",null);h(this)}async initByMain(e,s){this.sceneData=u(await e.text())}getMainData(){return d(this.sceneData)}async rename(e){await super.rename(e),await this.root.assetFacade.persistAssetMain(this.id)}saveMainImmediately(){var s;const e=this.root.sceneStore;if(this.id===e.refId){if(e.destroyed){f(this.root.projectStore.id,this.serverId);return}const a=y(this.root,this.id);return this.sceneData=a,this.sceneData.scene&&(this.sceneData.scene.name=this.name),super.saveMainImmediately()}else if((s=this.sceneData)!=null&&s.scene&&this.sceneData.scene.name!==this.name)return this.sceneData.scene.name=this.name,super.saveMainImmediately()}async initByCreation(e,s,a){return this.sceneData=b(this._name)}onDoubleClick(){this.root.projectStore.switchScene({scene:this.id})}};c=C([D({type:"Scene",label:S("asset.scene.title"),defaultName:"Scene",extname:"scene",importMenuConfig:{type:v.Add},async bundle(t){return{content:new Blob([t.content],{type:"application/json"})}}})],c);export{c as SceneAsset};
