(async()=>{try{let e=await initPageServer({projectDir:dirpath});ipcRenderer.send("c-msg",{type:"running",appName:appName,port:e.port,dirpath:dirpath,mapping:{[e.sourceServerName]:dirpath+"/source"},fileUpload:{[e.sourceUploadName]:dirpath+"/source"}}),ipcRenderer.once("to-closePageServer",async(r,a)=>{await e.saveData();let t=await pfs.readdir(dirpath+"/source"),p=e.pServer.commonData.sourceData.pics.map(r=>r.path.replace(`/${e.sourceServerName}/`,"")),i=[];t.forEach(e=>{p.includes(e)||i.push(e)}),i.length&&await Promise.all(i.map(async e=>{await pfs.unlink(`${dirpath}/source/${e}`)})),currentWin.close()});let r=new BrowserWindow({width:1280,height:720,backgroundColor:"#303336",frame:!1,titleBarStyle:"hiddenInset",webPreferences:{nodeIntegration:!0}});r.loadURL(`http://localhost:${listen}/pageCreator/index.html?i=${(901217*e.port).toString(32)}`),r.on("closed",e=>{ipcRenderer.send("c-msg",{type:"close",appName:"pageCreator",dirpath:dirpath})})}catch(e){ipcRenderer.send("c-msg",{type:"openError",appName:appName,dirpath:dirpath,error:e.toString()}),currentWin.close()}})();