const Path=require("path"),Fs=require("fs"),Util=Editor.require("packages://hot-update-tools/core/Util.js"),OutPut=Editor.require("packages://hot-update-tools/core/OutPut.js");Vue.component("serve-tool",{template:Fs.readFileSync(Editor.url("packages://hot-update-tools/panel/serve-tool.html"),"utf-8"),mixins:[Editor.require("packages://hot-update-tools/panel/mixin.js")],data:()=>({staticFileServer:null,staticFileDir:null,staticFileUrl:null}),created(){this.$nextTick(()=>{this.staticFileDir=OutPut.testServerDir})},methods:{onBtnClickSelectHttpDir(){let t=[OutPut.testServerDir,this.staticFileDir,Path.join(Editor.projectInfo.path,"build"),Editor.projectInfo.path];for(let e=0;e<t.length;e++){let i=t[e];if(i&&Fs.existsSync(i)){t=i;break}}let e=Editor.Dialog.openFile({title:"选择目录",defaultPath:t,properties:["openDirectory"]});-1!==e&&(this.staticFileDir=e[0])},onBtnClickHttpDir(){this.openDir(this.staticFileDir)}}});