({icon:wa,logobj:[]}),watch:{logs(e){let t=[];e.forEach(((s,i)=>{"string"==typeof s&&t.push({log:Va(s),key:e.length-i})})),this.logobj=t}}};const tr=ka(er,Ta,[],!1,null,"62593594",null).exports,sr={name:"eapp",props:["fresh"],data:()=>({eapp:{enable:!0,logo_type:1,apps:[]},apps:[],logs:[],bEdit:!1,dragSce:null,dragIdx:-1,toSave:!1,logo_type_org:1}),computed:{applogo(){return this.apps.map((e=>e.logo||this.$uApi.hashToLogo(e.hash,e.name,Number(this.eapp.logo_type))))},bRun(){return this.apps.map((()=>!1))}},watch:{fresh(){this.epInit(!1)}},components:{log:tr},created(){this.$wsrecv.add("eapp",(e=>{this.logs.length>=100||/\x1b\[H/.test(e)?this.logs=[e]:/\r|(\x1b\[F)/.test(e)?this.logs.splice(0,1,e):this.logs.unshift(e)})),this.epInit()},methods:{epInit(e=!0){this.$axios.get("/eapp").then((t=>{0===t.data.rescode&&(this.eapp=t.data.resdata,this.apps=this.eapp.apps.filter((e=>e&&e.name&&e.type&&e.target)),e&&this.apps.forEach(((e,t)=>{"auto"===e.run&&(this.logs.unshift(`[${this.$logHead("eapp notify")}][${this.$sTime(null,1)}] AUTO RUN EAPP: ${e.name}`),this.epOpen(t))})))})).catch((e=>{this.logs.unshift(`[${this.$logHead("eapp error")}][${this.$sTime(null,1)}] [31m首页 eapp 列表获取失败 ${e.message}[0m`),console.error("获取失败",e)}))},epOpera(e){this.bEdit?this.epEdit(e):this.epOpen(e)},epLogoErr(e,t){const s=this.apps[e];this.logs.unshift(`[${this.$logHead("eapp error")}][${this.$sTime(null,1)}] [31mEAPP ${s.name} logo 加载失败,生成默认图标[0m`),t.target.src=this.$uApi.hashToLogo(s.hash,s.name,this.eapp.logo_type)},epOpen(e=0){const t={...this.apps[e]};if(!(t.name&&t.type&&t.target))return void this.$message.error("eapp 内容不完整");if(this.bRun[e])return void this.$message.success(t.name,"运行中");if(!/%ei%/.test(t.target))return void this.epRun(t,e);let s=t.target.split("%ei%"),i=this.$uStr.escapeHtml(t.target).replace(/%ei%/g,''),n=(this.$axios,this.$message,this.epRun),a="eapp_"+this.$uStr.euid(4);this.$evui({id:a,title:t.name+" - "+t.type.toUpperCase(),width:600,height:null,style:{content:"margin: .3em; font-family: var(--font-fm);"},content:`${i}
`,methods:{epRun(){let i=document.querySelectorAll(`.${a} .elecTable_input[name=eapp_arg]`),r="";i.forEach(((e,t)=>{r+=s[t]+e.value})),t.target=r+s.pop(),n(t,e)}}})},epRun(e,t){switch(e.type){case"efh":this.$uApi.open("run/?target="+encodeURI(e.target)),this.logs.unshift(`[${this.$logHead("eapp notify")}][${this.$sTime(null,1)}] 执行 EFH: ${e.target}`);break;case"url":this.$uApi.open(e.target),this.logs.unshift(`[${this.$logHead("eapp notify")}][${this.$sTime(null,1)}] 打开网址: ${e.target}`);break;case"eval":this.logs.unshift(`[${this.$logHead("eapp notify")}][${this.$sTime(null,1)}] EVALRUN: ${e.name}`),this.logs.unshift(`[${this.$logHead("eapp notify")}][${this.$sTime(null,1)}] EVALRUN RESULT: ${this.$sString(this.$uApi.evalRun(e.target))||"没有返回数据"}`);break;case"shell":case"js":this.$wsrecv.connected||this.logs.unshift(`[${this.$logHead("eapp error")}][${this.$sTime(null,1)}] [31mwebsocket 尚未连接,运行日志无法传输`),this.bRun[t]=!0,this.$axios.post("/eapp/run",{app:e,id:this.$wsrecv.id}).then((s=>{this.bRun[t]=!1,0===s.data.rescode?this.logs.unshift(`[${this.$logHead("eapp info")}][${this.$sTime(null,1)}] ${s.data.message}`):this.logs.unshift(`[${this.$logHead("eapp error")}][${this.$sTime(null,1)}] [31m执行 ${e.target} 失败 ${s.data.message}`)})).catch((s=>{this.bRun[t]=!1,this.logs.unshift(`[${this.$logHead("eapp error")}][${this.$sTime(null,1)}] [31m执行 ${e.target} 失败 ${s.message}`),console.error(e.target,"执行失败",s)}));break;default:this.$message.error(`未知 EAPP 类型: ${e.type}`),this.logs.unshift(`[${this.$logHead("eapp error")}][${this.$sTime(null,1)}] [31m未知 EAPP 类型: ${e.type}`)}},epEdit(e=-1){const t=this.apps,s=t[e]||{name:this.$t("name"),logo:"",type:"js",target:"test.js"};let i=this.$axios,n=this.$message;this.$evui({id:"eapp_new",title:s.hash?this.$t("edit")+" EAPP - "+s.name:this.$t("new")+" EAPP",width:600,height:null,style:{content:"margin: .3em; font-family: var(--font-fm);"},content:``,methods:{moreToggle(e){const t=e.target.classList,s=document.querySelector(".eapp_more").classList;t.contains("elecBtn--moreup")?(t.remove("elecBtn--moreup"),s.add("hide")):(t.add("elecBtn--moreup"),s.remove("hide"))},save(){s.name=document.querySelector(".elecTable_input[name=eapp_name]").value,s.logo=document.querySelector(".elecTable_input[name=eapp_logo]").value,s.type=document.querySelector(".elecTable_select[name=eapp_type]").value,s.target=document.querySelector(".editor_textarea[name=eapp_target]").value,s.run=document.querySelector(".elecTable_select[name=eapp_run]").value,s.note=document.querySelector(".elecTable_input[name=eapp_note]").value,s.name&&s.type&&s.target?i.put("/eapp",{idx:e,...s}).then((i=>{0===i.data.rescode?(n.success("成功添加应用",s.name),s.hash=i.data.resdata,-1===e&&t.push(s)):n.error("添加应用失败",i.data.message)})).catch((e=>{n.error("添加应用失败",e.message),console.error("添加应用失败",e)})):n.error("EAPP 内容填写不完整,请修改后再保存")}}})},epMove(e){if(e=Number(e),this.apps[e]&&confirm(`确定移除应用 ${this.apps[e].name}?`)){const t=this.apps[e].name,s=this.$message.loading(`正在删除应用 ${t}...`,0);this.$axios.delete(`/eapp/${e}`).then((t=>{0===t.data.rescode&&this.apps.splice(e,1)})).catch((e=>{this.$message.error(`${t} 删除失败`,e.message),console.error(`${t} 删除失败`,e)})).finally(s)}},epSave(){if(!this.bEdit)return this.bEdit=!0,void(this.logo_type_org=this.eapp.logo_type||1);if(this.toSave&&confirm(`确定保存当前应用列表 ${this.apps.length}?`)){const e=this.$message.loading("应用列表保存中...",0);this.$axios.post("/eapp",{enable:this.eapp.enable,logo_type:this.eapp.logo_type,apps:this.apps}).then((e=>{0===e.data.rescode?this.$message.success("保存成功"):(this.$message.error("保存失败",e.data.message),console.error("保存失败",e.data))})).catch((e=>{this.$message.error("保存失败",e.message),console.error("保存失败",e)})).finally(e)}else if(this.eapp.logo_type!==this.logo_type_org){const e=this.$message.loading(`应用 LOGO 风格 ${this.eapp.logo_type}...`,0);this.$axios.put("/eapp/logo_type",{logo_type:this.eapp.logo_type}).then((e=>{0===e.data.rescode?(this.$message.success("新的 LOGO 风格应用成功"),this.logs.unshift(`[${this.$logHead("eapp notify")}][${this.$sTime(null,1)}] 成功应用新的 LOGO 风格 ${this.eapp.logo_type}`)):(this.$message.error("新的 LOGO 风格应用失败",e.data.message),console.error("新的 LOGO 风格应用失败",e.data))})).catch((e=>{this.$message.error("新的 LOGO 风格保存失败",e.message),console.error("新的 LOGO 风格应用失败",e)})).finally(e)}this.bEdit=!1,this.toSave=!1},dragStart(e,t){e.dataTransfer.effectAllowed="move",this.dragIdx=t,this.dragSce=this.apps[t]},dragEnter(e,t){e.preventDefault(),-1!==this.dragIdx&&this.dragIdx!==t&&(this.apps.splice(this.dragIdx,1),this.apps.splice(t,0,this.dragSce),this.dragIdx=t)},dragEnd(e,t){this.dragIdx=-1,this.toSave=!0}}};const ir=ka(sr,xa,[],!1,null,"fdaa1d28",null).exports,nr=JSON.parse('{"join_gap":" ","en":"英文","zh":"中文","a":"a","access":"ACCESS","add":"ADD","addition":"ADDITION","address":"ADDRESS","agroup":"A GROUP","all":"ALL","allow":"ALLOW","allowed":"ALLOWED","and":"AND","arch":"ARCH","as":"AS","author":"AUTHOR","auto":"AUTO","autorun":"AUTO","backup":"BACKUP","belong":"BELONG","blacklist":"BLACKLIST","bfreq":"before request","bfres":"before response","browser":"browser","cache":"CACHE","cancel":"CANCEL","certificate":"CERTIFICATE","check":"CHECK","checkall":"CHECK ALL","checked":"CHECKED","checked_short":"CKD","checknone":"CHECK NONE","choose":"CHOOSE","clear":"CLEAR","clickrun":"CLICK","close":"CLOSE","closed":"CLOSED","cmd":"CMD","con_clients":"Connected Clients","confirm":"CONFIRM","connected":"CONNECTED","content":"CONTENT","countdown":"countdown","cron":"cron","current":"CURRENT","date":"DATE","default":"DEFAULT","delete":"DELETE","detail":"detail","disable":"DISABLE","disable_short":"DE","disabled":"DISABLED","disconnected":"DISCONNECTED","document":"document","donation":"DONATION","download":"DOWNLOAD","dthave":"DON\'T HAVE","edit":"EDIT","editexit":"EXIT","editmode":"EDIT","efss_file_manage":"EFSS FILE MANAGE","enable":"ENABLE","enable_short":"EN","enabled":"ENABLED","every":"EVERY","export":"EXPORT","exportsub":"EXPORT","fetch":"FETCH","file":"FILE","files":"FILES","five":"five","forbid":"FORBID","force":"FORCE","format":"FORMAT","generate":"GENERATE","get":"GET","homepage":"HOMEPAGE","host":"HOST","host_info":"Host Information","illegal":"illegal","import":"IMPORT","input":"input","install":"INSTALL","jsruntimes":"Script Run Times","language":"LANGUAGE","last":"LAST","last_three":"last three","level":"LEVEL","list":"LIST","local":"LOCAL","logs":"LOGS","logs_of_script":"LOGS OF SCRIPT","make":"MAKE","manage":"MANAGE","match":"MATCH","memory":"MEMORY","memoryusage":"Memory Usage","mock":"MOCK","modifyto":"MODIFY TO","more":"more","moveto":"MOVE TO","murl":"MATCH URL","name":"NAME","new":"NEW","neweapp":"NEW","next":"NEXT","non-matched":"NON-MATCHED","note":"NOTE","notify":"NOTIFY","noupdate":"no update","on":"on","open":"OPEN","operate":"OPERATE","operate_short":"OP","optional":"optional","or":"or","overview":"OVERVIEW","param":"PARAM","persistence":"Persistence","platform":"PLATFORM","please":"please","port":"PORT","prev":"PREV","proxy":"PROXY","push":"PUSH","random":"random","redirect":"REDIRECT","refresh":"REFRESH","regexp":"REGEXP","reject":"REJECT","remote":"REMOTE","request":"REQUEST","repeat":"repeat","replace":"REPLACE","rest":"rest","restart":"RESTART","rewrite":"REWRITE","root":"ROOT","rule":"RULE","run":"RUN","save":"SAVE","script":"SCRIPT","search":"SEARCH","second":"second","seconds":"seconds","security":"SECURITY","self-signed":"SELF-SIGNED","send":"SEND","setting":"SETTING","setting_of":"SETTING","shortcut":"shortcut","show":"show","sign":"SIGN","six":"six","skip":"SKIP","sponsors":"Sponsors","start":"START","startat":"START AT","status":"STATUS","status_short":"ST","stop":"STOP","style":"STYLE","sub":"SUB","target":"TARGET","task":"TASK","temp":"TEMP","test":"TEST","time":"TIME","timed":"TIMED","times":"times","timing":"TIMING","to":"TO","toggle":"TOGGLE","update":"UPDATE","upload":"UPLOAD","url":"URL","user":"USER","valid":"VALID","version":"VERSION","web":"WEB","whitelist":"WHITELIST"}'),ar=JSON.parse('{"join_gap":"","en":"EN","zh":"zh-CN","a":"一个","access":"访问","add":"添加","addition":"新增","address":"地址","agroup":"某分组","all":"全部","allow":"允许","allowed":"允许","and":"并","arch":"架构","as":"成为","author":"作者","auto":"自动","autorun":"自动运行","backup":"备份","belong":"关联","bfreq":"网络请求前","bfres":"数据返回前","blacklist":"黑名单","browser":"浏览器","cache":"缓存","cancel":"取消","certificate":"证书","check":"查看","checkall":"全部选择","checked":"选中","checked_short":"选择","checknone":"全都不选","choose":"选择","clear":"清空","clickrun":"点击运行","close":"关闭","closed":"已关闭","cmd":"指令","con_clients":"客户端连接数","confirm":"确定","connected":"已连接","content":"内容","countdown":"倒计时","cron":"cron定时","current":"当前","date":"日期","default":"默认","delete":"删除","detail":"详细说明","disable":"关闭","disable_short":"禁用","disabled":"已关闭","disconnected":"已断开","document":"说明文档","donation":"赞助打赏","download":"下载","dthave":"并没有","edit":"编辑","editexit":"退出编辑","editmode":"编辑模式","efss_file_manage":"EFSS 文件管理界面","enable":"启用","enable_short":"启用","enabled":"已启用","every":"每","export":"导出","exportsub":"导出订阅","fetch":"获取内容","file":"文件","files":"文件数","five":"五","forbid":"禁止","force":"强制","format":"格式","generate":"生成","get":"获取","homepage":"主页地址","host":"域名","host_info":"服务器相关信息","illegal":"非法","import":"导入","input":"输入","install":"安装","jsruntimes":"脚本运行总次数","language":"语言偏好","last":"最近","last_three":"后三项","level":"等级","list":"列表","local":"本地","logs":"日志","logs_of_script":"查看程序运行日志","make":"生成","manage":"管理","match":"匹配","memory":"内存","memoryusage":"内存使用情况","mock":"模拟","modifyto":"修改方式","more":"更多","moveto":"移动到","murl":"匹配链接","name":"名称","new":"新建","neweapp":"新建应用","next":"下一个","non-matched":"未匹配","note":"备注","notify":"通知","noupdate":"不自动更新","on":"在","open":"打开","operate":"操作","operate_short":"操作","optional":"可选择项","or":"或","overview":"基础信息","param":"参数","persistence":"常量","platform":"平台","please":"请","port":"端口","prev":"上一个","proxy":"代理","push":"推送","random":"随机","redirect":"重定向","refresh":"刷新","regexp":"正则表达式","reject":"阻止","remote":"远程","request":"请求","repeat":"重复","replace":"替换","rest":"剩余","restart":"重启","rewrite":"重写","root":"根","rule":"规则","run":"运行","save":"保存","script":"脚本","search":"搜索","second":"秒","seconds":"秒数","security":"安全","self-signed":"自签","send":"发送","setting":"设置","setting_of":"相关设置","shortcut":"快捷键","show":"显示","sign":"签发","six":"六","skip":"跳过","sponsors":"广告","start":"开始","startat":"启动时间","status":"状态","status_short":"状态","stop":"停止","style":"风格","sub":"订阅","target":"目标","task":"任务","temp":"临时","test":"测试","time":"时间","timed":"定时","times":"次数","timing":"时间点","to":"至","toggle":"反转","update":"更新","upload":"上传","url":"链接","user":"用户","valid":"有效","version":"后台版本","web":"网络","whitelist":"白名单"}');const rr={locale:function(){let e="";return location.search&&(e=new URLSearchParams(location.search).get("lang")),e||localStorage.getItem("lang")||navigator.language}().startsWith("zh")?"zh-CN":"en",fallbackLocale:"en"},or={en:nr,"zh-CN":ar};function lr(e){return(or[rr.locale]||or[rr.fallbackLocale])[e]||e}function cr(e=""){return e=e.startsWith("zh")?"zh-CN":"en",rr.locale=e,console.debug("locale lang set to",e),localStorage.setItem("lang",e),e}const ur={name:"overview",data(){return{version:"1.0.0",baseurl:location.protocol+"//"+location.hostname,anyproxy:{enable:!0,port:8001,webPort:8002},ruleslen:0,rewriteslen:0,jslistslen:0,taskstatus:"0/0/0",mitmhostlen:0,start:this.$sTime(),newversion:"",sysinfo:Object.create(null),eopbtn:{open:!1,close:!1},enablelist:{rule:!0,rewrite:!0,mitmhost:!0},userid:this.$uApi.store.get("userid"),bcheck:this.$uApi.store.getCache("bChecked"),eappfresh:!1,isPwa:this.$uApi.isPwa()}},components:{status:Ca,eapp:ir},created(){this.ovInit(),this.bcheck||(this.$uApi.store.set("bcheck",(new Date).getDate().toString()),this.bcheck=!0,"http:"!==location.protocol||/^(100|10|127|172|192\.168)/.test(location.hostname)||this.$message.error("当前正通过 http 访问,建议升级到 https"))},methods:{ovInit(){const e=this.$message.loading("正在获取 overview 相关数据...",0);this.$axios.get("/data?type=overview"+(this.bcheck?"":`&check=${this.bcheck}`)).then((e=>{if(this.$message.success(`成功获取 overview 相关数据\nwebUI 版本 3.8.2 后台版本 ${e.data.version}`),e.data.lang&&cr(e.data.lang),this.ruleslen=e.data.ruleslen,this.rewriteslen=e.data.rewriteslen,this.jslistslen=e.data.jslistslen,this.mitmhostlen=e.data.mitmhostlen,this.version=e.data.version,this.start=this.$sTime(new Date(e.data.start),0,0),this.anyproxy=e.data.anyproxy,this.newversion=e.data.newversion,this.sysinfo=e.data.sysinfo,this.userid=e.data.userid,this.userid!==this.$uApi.store.get("userid")&&this.$uApi.store.set("userid",this.userid),this.$uApi.store.setCache("bSponsor",this.$uApi.store.getCache("sponsors").has(this.userid)),Object.assign(this.enablelist,e.data.enablelist),"object"==typeof e.data.menunav&&this.$emit("menunav",{...e.data.menunav}),"object"==typeof e.data.logo&&this.$emit("theme",{type:"logo",...e.data.logo}),this.$uApi.store.getCache("bSponsor")){let t=e.data.theme;t&&this.$emit("theme",t.simple||t)}else this.$emit("theme",{enable:!1});e.data.taskstatus&&(this.taskstatus=e.data.taskstatus.running+"/"+e.data.taskstatus.total+"/"+e.data.taskstatus.sub);let t=Number(this.version.replace(/\.|v/g,""));this.newversion&&Number(this.newversion.replace(/\.|v/g,""))>t?(console.log(`elecV2P 有新的版本 v${this.newversion} 可供更新`),this.$uApi.store.get("newversion")!==this.newversion&&(this.$message.success(`elecV2P 有新的版本 v${this.newversion} 可供更新`,{url:"https://github.com/elecV2/elecV2P/blob/master/logs/update.log",secd:0}),this.$uApi.store.set("newversion",this.newversion))):this.newversion=""})).catch((e=>{this.$message.error("获取端口数据失败",e.message),console.error("获取端口数据失败",e)})).finally(e)},showUplog(){const e=this.$message.loading("正在获取更新日志...",0);this.$axios.get("https://raw.githubusercontent.com/elecV2/elecV2P/master/logs/update.log").then((e=>{this.$message.success("获取成功"),this.$evui({title:"当前 elecV2P 版本: "+this.version+" 最近更新日志",width:820,height:460,style:{content:"padding-left: 8px; font-size: 16px;"},content:`${this.newversion?"检测到有新版本 v"+this.newversion+'
请使用
softupdate.js 或者 docker 命令进行升级':""}
${e.data}
`})})).catch((e=>{this.$message.error("获取失败",e.message),console.error("更新日志获取失败",e),this.$evui({title:"更新日志获取失败",width:400,height:160,content:'点击此链接 前往 Github 查看最新更新日志
'})})).finally(e)},eproxyBtn(){this.anyproxy.enable?this.eopbtn.close=!this.eopbtn.close:this.eopbtn.open=!this.eopbtn.open},eproxyToggle(e=""){this.$wsrecv.connected?(this.anyproxy&&this.anyproxy.enable?("close"===e||confirm("确定关闭 ANYPROXY?"))&&(this.$wsrecv.send("eproxy","close"),this.anyproxy.enable=!1):("open"===e||confirm("确定打开 ANYPROXY?"))&&(this.$wsrecv.send("eproxy","start"),this.anyproxy.enable=!0),this.eopbtn.open=!1,this.eopbtn.close=!1):this.$message.error("websocket 尚未连接,指令无法发送")},webifOpen(){this.anyproxy.enable?this.$uApi.open(this.baseurl+":"+this.anyproxy.webPort):this.$message.success("当前 ANYPROXY 处于关闭状态,无可查看日志")},runHour(e){e.target.title="elecV2P 已持续运行 "+this.$uStr.hDays(Date.parse(this.start))}}};const hr=ka(ur,ya,[],!1,null,"75f1e158",null).exports;var dr=function(){var e=this,t=e._self._c;return t("section",{on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.rulesSave()):null}}},[t("header",{staticClass:"header"},[e._v(e._s(e.header))]),e._v(" "),t("main",{staticClass:"content"},[t("div",{staticClass:"etable"},[t("table",{staticClass:"elecTable",class:{"elecTable--disabled":!e.ruleble.enable}},[t("caption",{staticClass:"elecTable_caption",class:{"elecTable--disabled":!e.ruleble.enable}},[t("div",{staticClass:"eflex elecTable_caption--left"},[t("span",{attrs:{title:"启用该列表中的规则(建议在不需要使用时关闭"}},[e._v(e._s(e.$t("enable"))+":")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.ruleble}})],1),e._v(" "),t("span",[e._v("RULE "+e._s(e.$t("list"))+" - "+e._s(e.rulestatus))]),e._v(" "),t("span",{staticClass:"icon icon_caption--sync",attrs:{title:"刷新当前列表"},domProps:{innerHTML:e._s(e.icon.sync)},on:{click:function(t){return e.rulesInit()}}})]),e._v(" "),t("thead",[t("tr",[t("th",{staticClass:"elecTable_th minw160"},[e._v(e._s(e.$t("match")))]),e._v(" "),t("th",{staticClass:"elecTable_th minw480"},[e._v(e._s(e.$t("content"))+"("+e._s(e.$t("regexp"))+")")]),e._v(" "),t("th",{staticClass:"elecTable_th minw160"},[e._v(e._s(e.$t("modifyto")))]),e._v(" "),t("th",{staticClass:"elecTable_th minw480"},[e._v(e._s(e.$t("target")))]),e._v(" "),t("th",{staticClass:"elecTable_th minw160"},[e._v(e._s(e.$t("timing")))]),e._v(" "),t("th",{staticClass:"elecTable_th elecTable_th--enable"},[e._v(e._s(e.$t("enable_short")))]),e._v(" "),t("th",{staticClass:"elecTable_th minw62"},[e._v(e._s(e.$t("operate_short")))])])]),e._v(" "),t("tbody",e._l(e.eplists,(function(s,i){return t("tr",{key:i,class:{"elecTable_tr--disabled":!s.enable}},[t("td",{staticClass:"elecTable_td"},[t("select",{directives:[{name:"model",rawName:"v-model",value:s.mtype,expression:"el.mtype"}],staticClass:"elecTable_select",on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s,"mtype",t.target.multiple?i:i[0])}}},[t("option",[e._v("url")]),e._v(" "),t("option",[e._v("host")]),e._v(" "),t("option",[e._v("useragent")]),e._v(" "),t("option",[e._v("reqmethod")]),e._v(" "),t("option",[e._v("reqbody")]),e._v(" "),t("option",[e._v("resstatus")]),e._v(" "),t("option",[e._v("restype")]),e._v(" "),t("option",[e._v("resbody")])])]),e._v(" "),t("td",{staticClass:"elecTable_td"},["reqmethod"==s.mtype?t("select",{directives:[{name:"model",rawName:"v-model",value:s.match,expression:"el.match"}],staticClass:"elecTable_select",on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s,"match",t.target.multiple?i:i[0])}}},[t("option",[e._v("GET")]),e._v(" "),t("option",[e._v("POST")]),e._v(" "),t("option",[e._v("PUT")]),e._v(" "),t("option",[e._v("DELETE")])]):"resstatus"==s.mtype?t("select",{directives:[{name:"model",rawName:"v-model",value:s.match,expression:"el.match"}],staticClass:"elecTable_select",on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s,"match",t.target.multiple?i:i[0])}}},[t("option",[e._v("200")]),t("option",[e._v("404")]),t("option",[e._v("30x")]),t("option",[e._v("50x")])]):t("input",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:s.match,expression:"el.match",modifiers:{lazy:!0,trim:!0}}],staticClass:"elecTable_input",attrs:{type:"text"},domProps:{value:s.match},on:{change:function(t){e.$set(s,"match",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("select",{directives:[{name:"model",rawName:"v-model",value:s.ctype,expression:"el.ctype"}],staticClass:"elecTable_select",on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s,"ctype",t.target.multiple?i:i[0])}}},[t("option",{attrs:{value:"js"}},[e._v(e._s(e.script))]),e._v(" "),t("option",{attrs:{value:"block"}},[e._v(e._s(e.reject))]),e._v(" "),t("option",{attrs:{value:"307"}},[e._v(e._s(e.redirect))]),e._v(" "),t("option",{attrs:{value:"hold"}},[e._v("$HOLD")]),e._v(" "),t("option",{attrs:{value:"ua"}},[e._v("User-Agent")])])]),e._v(" "),t("td",{staticClass:"elecTable_td"},["block"==s.ctype?t("select",{directives:[{name:"model",rawName:"v-model",value:s.target,expression:"el.target"}],staticClass:"elecTable_select",on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s,"target",t.target.multiple?i:i[0])}}},[t("option",{attrs:{value:"json"}},[e._v("reject-json")]),e._v(" "),t("option",{attrs:{value:"reject",selected:"selected"}},[e._v("reject-200")]),e._v(" "),t("option",[e._v("tinyimg")])]):"ua"==s.ctype?t("select",{directives:[{name:"model",rawName:"v-model",value:s.target,expression:"el.target"}],staticClass:"elecTable_select",on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s,"target",t.target.multiple?i:i[0])}}},e._l(e.uagentlists,(function(s,i){return t("option",{key:i,domProps:{value:i}},[e._v(e._s(s))])})),0):t("input",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:s.target,expression:"el.target",modifiers:{lazy:!0,trim:!0}}],staticClass:"elecTable_input",attrs:{type:"text"},domProps:{value:s.target},on:{change:function(t){e.$set(s,"target",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td",class:["req"===s.stage?"elecTable_td--req":"elecTable_td--res"]},[t("select",{directives:[{name:"model",rawName:"v-model",value:s.stage,expression:"el.stage"}],staticClass:"elecTable_select",on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s,"stage",t.target.multiple?i:i[0])}}},[t("option",{attrs:{value:"req"}},[e._v(e._s(e.bfreq))]),e._v(" "),t("option",{attrs:{value:"res",selected:"selected"}},[e._v(e._s(e.bfres))])])]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("checkbox",{attrs:{oCheck:s}})],1),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("span",{staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.delete)},on:{click:function(t){return e.ruleDel(i)}}})])])})),0),e._v(" "),t("tfoot",[t("tr",[t("td",{staticClass:"elecTable_add",attrs:{colspan:"7"}},[t("span",{staticClass:"elecTable_addbtn",on:{click:function(t){return e.eplists.push({mtype:"host",match:"host.com",ctype:"js",target:"0body.js",stage:"res",enable:!0})}}},[e._v(e._s(e.$ta("new","rule")))])])])])])]),e._v(" "),t("p",{staticClass:"center"},[t("button",{staticClass:"elecBtn elecBtn--long",on:{click:function(t){return e.rulesSave()}}},[e._v(e._s(e.$t("save")))])])]),e._v(" "),e._m(0)])};dr._withStripped=!0;var pr=function(){var e=this,t=e._self._c;return t("div",{staticClass:"checkbox",class:{"checkbox--checked":e.bChecked},on:{click:function(t){e.bChecked=!e.bChecked}}},[t("span",{staticClass:"checkbox_status"})])};pr._withStripped=!0;const mr=ka({name:"checkbox",props:["oCheck","oKey","oInit"],computed:{bKey(){return this.oKey||"enable"},bChecked:{get(){return void 0===this.oCheck[this.bKey]?"false"!==this.oInit:!!this.oCheck[this.bKey]},set(e){this.$set(this.oCheck,this.bKey,e)}}}},pr,[],!1,null,"40a3a37e",null).exports,fr={name:"rules",data(){return{header:"RULES",bfreq:this.$t("bfreq"),bfres:this.$t("bfres"),reject:this.$t("reject"),redirect:this.$t("redirect"),script:this.$t("script"),uagentlists:{},eplists:[],ruleble:{enable:!0},icon:wa}},computed:{rulestatus(){return this.eplists.filter((e=>e.enable)).length+"/"+this.eplists.length}},components:{checkbox:mr},created(){this.rulesInit()},methods:{rulesInit(){const e=this.$message.loading("正在获取规则列表...",0);this.$axios.get("/data?type=rules").then((e=>{this.eplists=e.data.eplists.list;for(let t in e.data.uagent)e.data.uagent[t].name&&(this.uagentlists[t]=e.data.uagent[t].name);this.ruleble.enable=!1!==e.data.eplists.enable,this.$message.success(`成功获取规则列表 ${this.rulestatus}`),console.log("成功获取规则列表",this.rulestatus)})).catch((e=>{this.$message.error("获取规则列表失败",e.message),console.error("获取列表失败",e)})).finally(e)},rulesSave(){if(confirm("共 "+this.rulestatus+" 条规则将被保存,"+(this.ruleble.enable?"":"但不启用该规则列表,")+"确定?")){const e=this.$message.loading("规则保存中...",0);this.$axios.put("/data",{type:"rules",eplists:this.eplists,ruleenable:this.ruleble.enable}).then((e=>{0===e.data.rescode?this.$message.success("保存成功",e.data.message):this.$message.error("RULES 规则保存失败",e.data.message)})).catch((e=>{this.$message.error("保存失败",e.message),console.error(e)})).finally(e)}},ruleDel(e){switch(this.$sType(e)){case"number":this.$delete(this.eplists,e);break;case"array":if(e.length&&confirm(`确定删除这 ${e.length} 条规则吗?\n(手动保存后正式生效)`)){let t=this.eplists.slice();for(let s of e)t[s]&&(t[s]=-1);this.eplists=t.filter((e=>-1!==e))}break;default:this.$message.error("规则删除失败,未知删除参数")}}}};const vr=ka(fr,dr,[function(){var e=this,t=e._self._c;return t("footer",{staticClass:"footer"},[t("ul",[t("li",[e._v("所有更改在保存后正式生效")]),e._v(" "),t("li",[e._v("仅首条命中规则有效,优先级低于 REWRITE")]),e._v(" "),t("li",[e._v("$HOLD 后面修改内容表示时间(秒) 0: 一直等待")]),e._v(" "),t("li",[e._v("更详细说明,参考 "),t("a",{attrs:{href:"https://github.com/elecV2/elecV2P-dei/tree/master/docs/03-rules.md",target:"elecV2PDoc"}},[e._v("说明文档: 03-rules")])])])])}],!1,null,null,null).exports;var gr=function(){var e=this,t=e._self._c;return t("section",{on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.reSave()):null},keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.preventDefault(),t.stopPropagation(),t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:void(e.rewriteChecked="none"))}}},[t("header",{staticClass:"header"},[e._v(e._s(e.$ta("rewrite","request")))]),e._v(" "),t("main",{staticClass:"content"},[t("div",{staticClass:"etable",on:{click:function(t){return t.stopPropagation(),e.rewriteDelegate(t)}}},[t("table",{staticClass:"elecTable",class:{"elecTable--disabled":!e.rewriteble.enable}},[t("caption",{staticClass:"elecTable_caption",class:{"elecTable--disabled":!e.rewriteble.enable}},[t("div",{staticClass:"eflex elecTable_caption--left"},[t("span",{attrs:{title:"启用/禁用该列表下的所有规则(包含订阅"}},[e._v(e._s(e.$t("enable"))+":")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.rewriteble}})],1),e._v(" "),t("span",{attrs:{title:"重写/修改某个网络请求的部分数据"}},[e._v("REWRITE "+e._s(e.$t("list"))+" - "+e._s(e.rewritestatus))]),e._v(" "),t("span",{staticClass:"icon icon_caption--sync",attrs:{title:e.$ta("refresh","current","list")},domProps:{innerHTML:e._s(e.icon.sync)},on:{click:function(t){return e.reInit()}}})]),e._v(" "),t("thead",[t("tr",[t("th",{staticClass:"elecTable_th elecTable_th--check",attrs:{title:e.$t("checkall")+"/"+e.$t("checknone")+"(ESC)"}},[t("input",{staticClass:"echeckbox",attrs:{type:"checkbox"},on:{change:function(t){return e.rewriteCkall(t)}}})]),e._v(" "),t("th",{staticClass:"elecTable_th minw320"},[e._v(e._s(e.$t("murl"))+"("+e._s(e.$t("regexp"))+")")]),e._v(" "),t("th",{staticClass:"elecTable_th minw160"},[e._v(e._s(e.$t("timing")))]),e._v(" "),t("th",{staticClass:"elecTable_th minw320",attrs:{title:e.$t("script")+" or reject "+e.$t("param")}},[e._v(e._s(e.$t("script")))]),e._v(" "),t("th",{staticClass:"elecTable_th elecTable_th--name"},[e._v(e._s(e.$t("note")))]),e._v(" "),t("th",{staticClass:"elecTable_th elecTable_th--enable",attrs:{title:e.$t("enable")}},[e._v(e._s(e.$t("enable_short")))]),e._v(" "),t("th",{staticClass:"elecTable_th minw62",attrs:{title:e.$t("operate")}},[e._v(e._s(e.$t("operate_short")))])])]),e._v(" "),t("tbody",{attrs:{tabindex:"0"}},[e._l(e.rewritelists,(function(s,i){return t("tr",{key:i,class:{"elecTable_tr--disabled":!s.enable,"elecTable_tr--selected":e.rewriteChecked[i]}},[t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.rewriteCheck,expression:"rewriteCheck"}],staticClass:"echeckbox",attrs:{type:"checkbox"},domProps:{value:i,checked:Array.isArray(e.rewriteCheck)?e._i(e.rewriteCheck,i)>-1:e.rewriteCheck},on:{change:function(t){var s=e.rewriteCheck,n=t.target,a=!!n.checked;if(Array.isArray(s)){var r=i,o=e._i(s,r);n.checked?o<0&&(e.rewriteCheck=s.concat([r])):o>-1&&(e.rewriteCheck=s.slice(0,o).concat(s.slice(o+1)))}else e.rewriteCheck=a}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.match,expression:"rewrite.match",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{type:"text"},domProps:{value:s.match},on:{input:function(t){t.target.composing||e.$set(s,"match",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td",class:["req"===s.stage?"elecTable_td--req":"elecTable_td--res"]},[t("select",{directives:[{name:"model",rawName:"v-model",value:s.stage,expression:"rewrite.stage"}],staticClass:"elecTable_select",on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s,"stage",t.target.multiple?i:i[0])}}},[t("option",{attrs:{value:"res",selected:"selected"}},[e._v(e._s(e.bfres))]),e._v(" "),t("option",{attrs:{value:"req"}},[e._v(e._s(e.bfreq))])])]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.target,expression:"rewrite.target",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{type:"text"},domProps:{value:s.target},on:{input:function(t){t.target.composing||e.$set(s,"target",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.note,expression:"rewrite.note",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{type:"text",placeholder:"备注信息(可省略"},domProps:{value:s.note},on:{input:function(t){t.target.composing||e.$set(s,"note",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("checkbox",{attrs:{oCheck:s}})],1),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("span",{staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.delete)},on:{click:function(t){return e.rewriteDel(i)}}})])])})),e._v(" "),t("tr",[t("td",{staticClass:"center border_top1",attrs:{colspan:"7"}},[t("span",{directives:[{name:"show",rawName:"v-show",value:e.rewriteCheck.length,expression:"rewriteCheck.length"}],staticClass:"elecTable_addbtn elecTable_addbtn--clear",on:{click:function(t){return e.rewriteDel(e.rewriteCheck)}}},[e._v(e._s(e.$ta("delete","checked","rule"))+" "+e._s(e.rewriteCheck.length))]),e._v(" "),t("span",{staticClass:"elecTable_addbtn",attrs:{"data-method":"newRewrite"}},[e._v(e._s(e.$ta("add","rewrite","rule")))]),e._v(" "),t("span",{staticClass:"elecTable_addbtn folderbk",attrs:{title:"导入备份文件将会覆盖当前所有规则(包括订阅)"},on:{click:function(t){return e.rewriteImport()}}},[e._v(e._s(e.$ta("import","backup","file")))]),e._v(" "),t("span",{staticClass:"elecTable_addbtn",attrs:{"data-method":"exportRewrite",title:"备份包含订阅在内的当前所有规则"}},[e._v(e._s(e.$ta("backup","current","list")))]),e._v(" "),t("span",{directives:[{name:"show",rawName:"v-show",value:e.rewriteCheck.length,expression:"rewriteCheck.length"}],staticClass:"elecTable_addbtn elecTable_addbtn--uncheck",on:{click:function(t){e.rewriteCheck=[]}}},[e._v(e._s(e.$ta("cancel","checked","rule"))+" "+e._s(e.rewriteCheck.length))])])])],2),e._v(" "),e._l(e.rewritesub,(function(s,i){return t("tbody",{key:i,staticClass:"elecTable_group",style:{background:s.bkcolor}},[t("tr",{class:{"elecTable_tr--disabled":!s.enable,"elecTable_tr--selected":-1!==e.rewritesubChecked.indexOf(i)}},[t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.rewritesubChecked,expression:"rewritesubChecked"}],staticClass:"echeckbox",attrs:{type:"checkbox"},domProps:{value:i,checked:Array.isArray(e.rewritesubChecked)?e._i(e.rewritesubChecked,i)>-1:e.rewritesubChecked},on:{change:[function(t){var s=e.rewritesubChecked,n=t.target,a=!!n.checked;if(Array.isArray(s)){var r=i,o=e._i(s,r);n.checked?o<0&&(e.rewritesubChecked=s.concat([r])):o>-1&&(e.rewritesubChecked=s.slice(0,o).concat(s.slice(o+1)))}else e.rewritesubChecked=a},function(t){return e.rewritesubCheck(i,t)}]}})]),e._v(" "),t("td",{staticClass:"elecTable_td",attrs:{colspan:"4"}},[t("div",{staticClass:"eflex w100"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.name,expression:"subr.name",modifiers:{trim:!0}}],staticClass:"elecTable_input elecTable_th--name",attrs:{type:"text",placeholder:"订阅名称"},domProps:{value:s.name},on:{input:function(t){t.target.composing||e.$set(s,"name",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.resource,expression:"subr.resource",modifiers:{trim:!0}}],staticClass:"elecTable_input elecBtn--mleft",attrs:{type:"text",placeholder:"订阅地址",title:"alt+enter 在新标签页中打开此订阅链接"},domProps:{value:s.resource},on:{keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:t.altKey?(t.preventDefault(),t.ctrlKey||t.shiftKey||t.metaKey?null:e.$uApi.open(s.resource)):null},input:function(t){t.target.composing||e.$set(s,"resource",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("button",{staticClass:"elecBtn elecBtn--mleft",on:{click:function(t){return e.rewritesubUpdate(s.resource,i)}}},[e._v(e._s(e.$t("fetch")))]),e._v(" "),-1!==e.rewritesubChecked.indexOf(i)?t("button",{staticClass:"elecBtn elecBtn--mleft",attrs:{"data-method":"exportRewrite","data-parm":i,title:"导出当前订阅下的所有规则"}},[e._v(e._s(e.$t("exportsub")))]):s.collapse?t("span",{staticClass:"elecBtn elecBtn--mleft elecBtn--uncheck"},[e._v(e._s(s.enable?s.list.filter((e=>e.enable)).length:"0")+"/"+e._s(s.list.length))]):t("input",{directives:[{name:"model",rawName:"v-model.trim.lazy",value:s.bkcolor,expression:"subr.bkcolor",modifiers:{trim:!0,lazy:!0}}],staticClass:"elecTable_input elecTable_cell100 elecBtn--mleft",attrs:{placeholder:"背景色",title:"当前分组背景颜色/图片"},domProps:{value:s.bkcolor},on:{change:function(t){e.$set(s,"bkcolor",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})])]),e._v(" "),t("td",{staticClass:"elecTable_td",attrs:{title:"启用/禁用该订阅下的所有规则"}},[t("checkbox",{attrs:{oCheck:s}})],1),e._v(" "),t("td",{staticClass:"elecTable_td"},[s.resource&&-1===e.rewritesubChecked.indexOf(i)?s.collapse?t("span",{staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.downcircle)},on:{click:function(t){return e.rewritesubOp(i,"collapse")}}}):t("span",{staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.upcircle)},on:{click:function(t){return e.rewritesubOp(i,"collapse")}}}):t("span",{staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.delete)},on:{click:function(t){return e.rewritesubOp(i,"delete")}}})])]),e._v(" "),e._l(e.rewritesublist[i],(function(s,n){return t("tr",{class:{"elecTable_tr--disabled":!s.enable,"elecTable_tr--selected":e.rewriteChecked[i+"|"+n]}},[t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.rewriteCheck,expression:"rewriteCheck"}],staticClass:"echeckbox",attrs:{type:"checkbox"},domProps:{value:i+"|"+n,checked:Array.isArray(e.rewriteCheck)?e._i(e.rewriteCheck,i+"|"+n)>-1:e.rewriteCheck},on:{change:function(t){var s=e.rewriteCheck,a=t.target,r=!!a.checked;if(Array.isArray(s)){var o=i+"|"+n,l=e._i(s,o);a.checked?l<0&&(e.rewriteCheck=s.concat([o])):l>-1&&(e.rewriteCheck=s.slice(0,l).concat(s.slice(l+1)))}else e.rewriteCheck=r}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.match,expression:"rewrite.match",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{type:"text"},domProps:{value:s.match},on:{input:function(t){t.target.composing||e.$set(s,"match",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td",class:["req"===s.stage?"elecTable_td--req":"elecTable_td--res"]},[t("select",{directives:[{name:"model",rawName:"v-model",value:s.stage,expression:"rewrite.stage"}],staticClass:"elecTable_select",on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s,"stage",t.target.multiple?i:i[0])}}},[t("option",{attrs:{value:"res",selected:"selected"}},[e._v(e._s(e.bfres))]),e._v(" "),t("option",{attrs:{value:"req"}},[e._v(e._s(e.bfreq))])])]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.target,expression:"rewrite.target",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{type:"text"},domProps:{value:s.target},on:{input:function(t){t.target.composing||e.$set(s,"target",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.note,expression:"rewrite.note",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{type:"text",placeholder:"备注信息(可省略"},domProps:{value:s.note},on:{input:function(t){t.target.composing||e.$set(s,"note",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("checkbox",{attrs:{oCheck:s}})],1),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("span",{staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.delete)},on:{click:function(t){return e.rewriteDel(i+"|"+n)}}})])])}))],2)})),e._v(" "),t("tfoot",[t("tr",[t("td",{staticClass:"center border_top1",attrs:{colspan:"7"}},[t("span",{directives:[{name:"show",rawName:"v-show",value:e.rewriteCheck.length,expression:"rewriteCheck.length"}],staticClass:"elecTable_addbtn trasbk",attrs:{"data-method":"disOrEn","data-parm":"enable"}},[e._v(e._s(e.$ta("enable_short","/","disable_short","checked","rule")))]),e._v(" "),t("span",{staticClass:"elecTable_addbtn",attrs:{"data-method":"newSub"}},[e._v(e._s(e.$ta("add","rewrite","sub")))]),e._v(" "),t("span",{directives:[{name:"show",rawName:"v-show",value:e.rewriteCheck.length,expression:"rewriteCheck.length"}],staticClass:"elecTable_addbtn greenbk",attrs:{"data-method":"exportRewrite","data-parm":"checked"}},[e._v(e._s(e.$ta("export","as","sub")))])])])])],2)]),e._v(" "),t("p",{staticClass:"center"},[t("button",{staticClass:"elecBtn elecBtn--long",on:{click:function(t){return e.reSave()}}},[e._v(e._s(e.$t("save")))])])]),e._v(" "),e._m(0)])};gr._withStripped=!0;const _r={name:"rewrite",props:[],data(){return{bfreq:this.$t("bfreq"),bfres:this.$t("bfres"),rewritelists:[],rewritesub:[],rewritesubChecked:[],rewriteCheck:[],rewriteble:{enable:!0},icon:wa}},components:{checkbox:mr},computed:{rewritestatus(){let e=Object.keys(this.rewritesub),t=this.rewritelists.length,s=this.rewritelists.filter((e=>e.enable)).length;return e.forEach((e=>{void 0===this.rewritesub[e].list&&(this.rewritesub[e].list=[]),this.rewritesub[e].enable&&(s+=this.rewritesub[e].list.filter((e=>e.enable)).length,t+=this.rewritesub[e].list.length),void 0===this.rewritesub[e].collapse&&(this.rewritesub[e].collapse=!1)})),s+"/"+t+"/"+e.length},rewriteChecked:{get(){let e=[];return this.rewriteCheck.forEach((t=>{e[t]=!0})),e},set(e){"all"===e?this.rewriteCheck=Object.keys(this.rewritelists):"none"===e&&(this.rewriteCheck=[])}},rewritesublist(){let e={};return Object.keys(this.rewritesub).forEach((t=>{this.rewritesub[t].collapse?e[t]=[]:e[t]=this.rewritesub[t].list||[]})),e}},created(){this.reInit()},methods:{reInit(){const e=this.$message.loading("正在获取 rewrite 列表...",0);this.$axios.get("/data?type=rewritelists").then((e=>{e.data?(this.rewritesub=e.data.rewritesub||{},this.rewritelists=e.data.rewrite.list,this.rewriteCheck=[],this.rewriteble.enable=!1!==e.data.rewrite.enable,this.dealOldList(),this.$message.success("成功获取 REWRITE 规则列表",this.rewritestatus)):this.$message.error("REWRITE 规则列表获取失败")})).catch((e=>{this.$message.error("获取 REWRITE 规则列表失败",e.message),console.error("获取 REWRITE 规则列表失败",e)})).finally(e)},dealOldList(){let e=[];for(let t in this.rewritelists){let s=this.rewritelists[t];if("req"!==s.stage&&"res"!==s.stage&&(s.stage=/^reject(-200|-dict|-json|-array|-img)?$/.test(s.target)?"req":"res"),s.belong){let i=s.belong;delete s.belong,this.rewritesub[i]?(this.rewritesub[i].list?this.rewritesub[i].list.push(s):this.rewritesub[i].list=[s],this.rewritesub[i].bkcolor||(this.rewritesub[i].bkcolor=this.$uStr.randomColor({max:200})),e.push(t)):console.log("规则",s.match,"对应订阅已不存在,删除 belong 属性",i)}}e.reverse().forEach((e=>this.$delete(this.rewritelists,e)))},reSave(){let e=[];if(this.rewritelists.forEach(((t,s)=>{t.match&&t.target||e.push(s+1)})),e.length>0)this.$message.error("当前列表第",e.join(", "),"/",this.rewritelists.length,"项包含空字符,请填写完整或删除后再进行保存");else if(confirm(`保存重写规则列表 ${this.rewritestatus}${this.rewriteble.enable?"":",但不启用"}`)){const e=this.$message.loading("重写规则上传保存中...",0);this.$axios.put("/data",{type:"rewrite",rewritelists:this.rewritelists,rewritesub:this.rewritesub,rewriteenable:this.rewriteble.enable}).then((e=>{0===e.data.rescode?this.$message.success("保存成功",e.data.message):this.$message.error("REWRITE 规则保存失败",e.data.message)})).catch((e=>{this.$message.error(e.message),console.error("重写规则保存失败",e)})).finally(e)}},rewriteDelegate(e){switch(e.target.dataset.method){case"disOrEn":let t="disable"===e.target.dataset.parm;this.rewriteCheck.forEach((e=>{if("number"===this.$sType(e))this.rewritelists[e].enable=t;else{let[s,i]=e.split("|");s&&i&&this.rewritesublist[s]&&(this.rewritesub[s].list[i].enable=t)}})),e.target.dataset.parm=t?"enable":"disable",this.$message.success("已批量",t?"启用":"禁用",this.rewriteCheck.length,"条规则");break;case"newRewrite":this.rewritelists.push({match:"^https?://httpbin\\.org/get\\?rewrite=elecV2P",stage:"req",target:"0body.js",enable:!0});break;case"newSub":this.rewritesubAdd();break;case"exportRewrite":this.rewriteExport(e.target.dataset.parm)}},async rewritesubUpdate(e,t){if(!e||!/^https?:\/\/\S{4}|^\/?efss\//i.test(e))return void this.$message.error("请输入正确的订阅地址");let s=this.$message.loading("正在获取订阅内容中...",0),i="";try{i=await this.$axios.get(e)}catch(t){if(t.response)return s(),this.$message.error(`获取订阅内容失败,服务器返回状态码 ${t.response.status}`),void console.debug(`获取订阅内容失败,服务器返回状态码 ${t.response.status}`,t.response.data);if(!/^https?:\/\/\S{4}/.test(e))return s(),void this.$message.error("获取订阅内容失败",t.message);try{this.$message.error("获取订阅内容失败",t.message,"即将尝试从服务器端获取该订阅内容"),i=await this.$axios.get("/data?type=stream&url="+e)}catch(e){return s(),void this.$message.error("获取订阅信息失败",e.message,"请检测网络后重试")}}if(200!==i.status||-1===i.data.rescode)return s(),this.$message.error("该订阅返回状态有误,请确认当前网络环境或输入链接是否正常"),void console.error(i.data);s();let n=this.$sJson(i.data);if(!n||!n.list&&!n.rewrite){if(!i.data)return void this.$message.error("没有检测到任何订阅内容");i.data=this.$sString(i.data),this.$message.success("检测到该订阅内容为非 elecV2P 订阅格式,尝试以兼容模式解析该内容"),n={name:this.rewritesub[t].name,mitmhost:[],list:[]};let e=i.data.match(/hostname ?= ?(.+)/);e&&e[1]&&(n.mitmhost=e[1].split(/ ?, ?/)),n.mitmhost.length&&(n.mitmhost[0]=n.mitmhost[0].replace("%APPEND% ","")),i.data.split(/\r|\n/).forEach((e=>{if(/^(#|\[|\/\/)/.test(e)||e.length<3)return;let t=e.split(" "),s=e.match(/script-path=([^,]*)/),i="",a="res",r="";if(s&&s[1])if(r=s[1],a=/http-request/.test(e)?"req":"res",/^http-res/.test(t[0]))i=t[1];else{let t=e.match(/pattern=([^,]*)/);t&&t[1]&&(i=t[1])}else t.length>=2&&(r=t.pop(),/^http|^reject|\.js$/.test(r)&&(i=t[0],a=/^reject/.test(r)||/request/.test(t[2])?"req":"res"));i&&a&&r&&n.list.push({match:i,stage:a,target:r,enable:!0})}))}if(n&&n.rewrite&&n.rewrite.length&&(n.list=n.rewrite),n&&n.list&&n.list.length){let e=`${n.note||"没有任何备注说明"}
`;n.mitmhost&&n.mitmhost.length&&(e+=``),n.task&&n.task.list&&(e+=``),e+=`作者: ${n.author||"无"} 更新: ${n.resource||"无"}
`;let s=this.$axios,i=this.$message,a=this.rewritesub;this.$evui({title:`${n.name||this.rewritesub[t].name||"检测到如下规则"}`,width:600,height:null,style:{title:`background: ${n.bkcolor||this.rewritesub[t].bkcolor};`,content:"text-align: center;margin: .2em;"},content:e,methods:{rewriteAdd(){let e=document.querySelector(".elecBtn[data-method=rewriteAdd]");if(e){if(e.dataset.done)return void i.success("重写规则已添加");e.dataset.done="1",e.classList.remove("greenbk"),e.classList.add("elecBtn--stop")}let s=n.list.filter((e=>{if(e.match&&/^http|^reject|\.js$/.test(e.target))return"req"!==e.stage&&"res"!==e.stage&&(e.stage=/^reject/.test(e.target)?"req":"res"),e.enable=!1!==e.enable,!0}));n.name&&(a[t].name=n.name),void 0!==n.enable&&(a[t].enable=n.enable),n.bkcolor&&(a[t].bkcolor=n.bkcolor),n.resource&&(a[t].resource=n.resource),a[t]={...a[t],list:s},i.success("订阅",n.name,"内容更新完成(保存后正式生效)")},taskAdd(){let e=document.querySelector(".elecBtn[data-method=taskAdd]");if(e){if(e.dataset.done)return void i.success("定时任务已添加");e.dataset.done="1",e.classList.remove("greenbk"),e.classList.add("elecBtn--stop")}for(let e of n.task.list)s.put("/task",{op:"add",data:{type:n.task.type,task:e}}).then((t=>{0===t.data.rescode?i.success("添加定时任务",e.name,t.data.message):i.error("添加定时任务失败",t.data.message)})).catch((e=>{i.error("添加定时任务失败",e.message),console.error("添加定时任务失败",e)}))},hostAdd(){let e=document.querySelector(".elecBtn[data-method=hostAdd]");if(e){if(e.dataset.done)return void i.success("解析域名已添加");e.dataset.done="1",e.classList.remove("greenbk"),e.classList.add("elecBtn--stop")}s.put("/data",{type:"mitmhostadd",data:n.mitmhost,note:n.name}).then((e=>{0===e.data.rescode?i.success("成功更新 MITMHOST",n.mitmhost.join(", ")):i.error("MITMHOST 更新失败",e.data.message)})).catch((e=>{i.error("更新 mitmhost 失败",e.message),console.error("更新 mitmhost 失败",e)}))}}})}else this.$message.error("elecV2P 暂时无法解析该订阅内容"),console.debug(this.rewritesub[t].name,"内容为",i.data)},rewritesubCheck(e,t){if(e&&t)if(t.target.checked)for(let t in this.rewritesub[e].list||[]){let s=e+"|"+t;-1===this.rewriteCheck.indexOf(s)&&this.rewriteCheck.push(s)}else this.rewriteCheck=this.rewriteCheck.filter((t=>!("string"==typeof t&&t.startsWith(e))))},rewriteDel(e){switch(this.$sType(e)){case"number":this.$delete(this.rewritelists,e);break;case"array":if(e.length&&confirm(`确定删除这 ${e.length} 条规则吗?\n(手动保存后正式生效)`)){for(let t of e)this.rewriteDel(t);this.rewriteCheck=[]}break;case"string":let[t,s]=e.split("|");t&&s&&this.rewritesublist[t]&&(this.rewritesublist[t].splice(Number(s),1),this.$forceUpdate());break;default:this.$message.error("规则删除失败,未知删除参数")}},rewritesubAdd(e=this.$uStr.euid()){this.$set(this.rewritesub,e,{name:this.$ta("rewrite","sub")+(Object.keys(this.rewritesub).length+1),resource:"",type:"rewrite",note:"",date:this.$sTime(),total:0,active:0,enable:!0,bkcolor:this.$uStr.randomColor({max:200}),collapse:!1,list:[]})},rewritesubOp(e,t="delete"){"collapse"===t?(this.rewritesub[e].collapse=!this.rewritesub[e].collapse,this.rewritesub[e].collapse?this.rewritesublist[e]=[]:this.rewritesublist[e]=this.rewritesub[e].list,this.$forceUpdate()):this.rewritesub[e]&&(0===this.rewritesub[e].list.length||confirm("确定删除重写订阅:"+this.rewritesub[e].name+" 及其相关规则\n(并不会删除已添加的 MITMHOST/TASK 等)"))&&(this.$delete(this.rewritesub,e),this.rewriteCheck=this.rewriteCheck.filter((t=>!("string"==typeof t&&t.startsWith(e)))))},rewriteCkall(e){this.rewriteChecked=e.target.checked?"all":"none"},rewriteExport(e="all"){let t=Object.create(null),s="rewritesub-elecV2P.json";switch(e){case"all":t={rewrite:{note:"elecV2P 重写规则",date:this.$sTime(),total:this.rewritelists.length,active:this.rewritelists.filter((e=>e.enable)).length,enable:this.rewriteble.enable,list:this.rewritelists},rewritesub:this.rewritesub},s="rewrite.list",this.$message.success("成功使用当前规则列表(包含订阅)生成备份文件,请选择目录进行保存");break;case"checked":t={name:"elecV2P 重写订阅",author:"留个名字 elecV2",note:"xx 导出的重写规则。该订阅目前仅适用于 elecV2P。更多说明请查看: https://github.com/elecV2/elecV2P-dei/tree/master/docs/05-rewrite.md",date:this.$sTime(),type:"rewrite",resource:"订阅更新远程链接(待填写",mitmhost:[],list:[]},this.rewriteCheck.forEach((e=>{if("number"===this.$sType(e))e=this.rewritelists[e];else{let[t,s]=e.split("|");t&&s&&this.rewritesublist[t]&&(e=this.rewritesublist[t][s])}e.match&&e.stage&&e.target&&t.list.push(e)}));break;default:this.rewritesub[e]?(t={...this.rewritesub[e],type:"rewrite",note:"关于该订阅的一些说明(可省略)。该订阅目前仅适用于 elecV2P,与其他软件并不兼容。更详细说明请查看: https://github.com/elecV2/elecV2P-dei/tree/master/docs/05-rewrite.md",date:this.$sTime()},delete t.total,delete t.active,delete t.collapse,s=this.rewritesub[e].name):this.$message.error("未知导出类型",e)}"rewrite"===t.type||t.rewrite?this.$uApi.saveAsFile(t,s||"rewritesub-elecV2P.json"):this.$message.error("当前并没有检测到任何规则")},rewriteImport(){this.$uApi.getFile({accept:".list,.json",type:"text"}).then((e=>{let t=e.content,s=this.$sJson(t);s&&(s.rewrite&&s.rewrite.list||s.rewritesub)?confirm(`检测到重写规则 ${s.rewrite.list.length} 条,订阅 ${Object.keys(s.rewritesub||{}).length} 个\n确定使用该备份替换当前所有规则及订阅吗?`)&&(this.rewritelists=s.rewrite.list||[],this.rewritesub=s.rewritesub||{},this.rewriteCheck=[],this.rewriteble.enable=!1!==s.rewrite.enable,this.dealOldList(),this.$message.success("成功导入重写规则备份文件,保存后正式生效")):(console.error("elecV2P 无法解析导入文件",t),this.$message.error("无法解析导入文件,仅支持 elecV2P 的备份文件"))})).catch((e=>{console.debug("rewrite import",e)}))}}};const br=ka(_r,gr,[function(){var e=this,t=e._self._c;return t("footer",{staticClass:"footer"},[t("ul",[t("li",[t("b",[e._v("本页所有规则的更改在点击保存后才正式生效")])]),e._v(" "),t("li",[e._v("订阅规则并不会自动加载更新,需手动获取及保存")]),e._v(" "),t("li",[e._v("规则匹配公式: `(new RegExp('正则表达式')).test(request.url)`")]),e._v(" "),t("li",[e._v("更多说明请查看 "),t("a",{attrs:{href:"https://github.com/elecV2/elecV2P-dei/tree/master/docs/05-rewrite.md",target:"elecV2PDoc"}},[e._v("文档: 05-rewrite")])])])])}],!1,null,null,null).exports;var yr=function(){var e=this,t=e._self._c;return t("section",[t("header",{staticClass:"header"},[e._v(e._s(e.$ta("script","manage")))]),e._v(" "),t("main",{staticClass:"content",on:{click:function(t){e.menu={}}}},[t("contextmenu",{attrs:{menus:e.menu.list,pos:e.menu.pos}}),e._v(" "),t("store",{attrs:{logs:e.logs},on:{belongview:function(t){t&&t.includes("|")?e.jsname=t:e.jsView(t)}}}),e._v(" "),t("div",{staticClass:"title--radius",on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.preventDefault(),t.stopPropagation(),t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:void(e.menu={}))}}},[t("h4",{staticClass:"title title--radius"},[t("span",{staticClass:"icon cursor title_sync",attrs:{title:"更新列表"},domProps:{innerHTML:e._s(e.icon.sync)},on:{click:function(t){return e.getJSlist()}}}),e._v(" "),t("span",{staticClass:"title_main",attrs:{title:"当前服务器上存在的本地脚本文件数量"}},[e._v(e._s(e.$ta("script","files"))+" - "+e._s(e.jslists.length))]),e._v(" "),t("span",{staticClass:"title_arrow",class:{"title_arrow--up":e.collapse.titlearrow},on:{click:function(t){if(t.preventDefault(),t.target!==t.currentTarget)return null;e.collapse.titlearrow=!e.collapse.titlearrow}}})]),e._v(" "),t("div",{directives:[{name:"show",rawName:"v-show",value:e.collapse.titlearrow,expression:"collapse.titlearrow"}],staticClass:"uploadjs"},[t("div",{staticClass:"eflex w100 eflex--between"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.jsdownloadurl,expression:"jsdownloadurl",modifiers:{trim:!0}}],staticClass:"elecTable_input wp80",attrs:{type:"text",placeholder:"远程脚本链接 script url"},domProps:{value:e.jsdownloadurl},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.jsDownload()},input:function(t){t.target.composing||(e.jsdownloadurl=t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("button",{staticClass:"elecBtn wp19",on:{click:function(t){return e.jsDownload()}}},[e._v(e._s(e.$ta("start","push")))])]),e._v(" "),t("div",{staticClass:"eflex eflex--between w100 emargin"},[t("div",{staticClass:"eupload wp80"},[t("input",{ref:"jsfiles",staticClass:"eupload_file",attrs:{type:"file",accept:".js, .efh",multiple:"",title:"choose script files"},on:{change:e.jstoupload}}),e._v(" "),t("span",{directives:[{name:"show",rawName:"v-show",value:e.jsfiles.length,expression:"jsfiles.length"}],staticClass:"eupload_span"},[e._v(e._s(e.jsfilename))])]),e._v(" "),t("button",{staticClass:"elecBtn wp19",on:{click:function(t){return e.jsUpload()}}},[e._v(e._s(e.$ta("start","upload")))])])]),e._v(" "),t("div",{staticClass:"jslists_cont",attrs:{tabindex:"0"}},[t("ul",{staticClass:"jslists_alljs",on:{click:function(t){return t.preventDefault(),e.jsOp(t)},contextmenu:function(t){return t.preventDefault(),t.stopPropagation(),e.jsOp(t)}}},[e._l(e.jslistsshow,(function(s){return t("li",{key:s,staticClass:"jslists_item"},[t("span",{staticClass:"jsitem_view",attrs:{"data-method":"view","data-param":s}},[e._v("👁️")]),e._v(" "),t("span",{attrs:{"data-method":"menu","data-param":s}},[e._v(e._s(s))]),e._v(" "),t("span",{staticClass:"jsitem_delete",attrs:{"data-method":"delete","data-param":s}},[e._v("X")])])})),e._v(" "),t("li",{directives:[{name:"show",rawName:"v-show",value:!!e.restnum,expression:"!!restnum"}],staticClass:"jslists_item jslists_item--showrest"},[t("span",{on:{click:function(t){e.shownum=-1}}},[e._v(e._s(e.$ta("show","rest"))+" "+e._s(e.restnum))])])],2)])]),e._v(" "),t("div",{staticClass:"editor editor--jsmanage",class:{"editor--full":!e.collapse.editor}},[t("h3",{staticClass:"editor_title"},[t("div",{staticClass:"eflex wp46 minw320 epos_rel"},[t("label",{staticClass:"minw100"},[e._v(e._s(e.$t("name"))+": ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.jsname,expression:"jsname",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{placeholder:"脚本文件名 enter: 查看,ctrl+del: 删除"},domProps:{value:e.jsname},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.jsView(e.jsname)},keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:t.ctrlKey?t.shiftKey||t.altKey||t.metaKey?null:e.jsDelete(e.jsname):null},function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),t.shiftKey||t.altKey||t.metaKey?null:e.jsSave()):null},function(t){e.jsshowall=!1}],input:function(t){t.target.composing||(e.jsname=t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("button",{directives:[{name:"show",rawName:"v-show",value:e.jsname,expression:"jsname"}],staticClass:"elecBtn elecBtn--del",on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.jsDelete(e.jsname)}}},[e._v("X")])]),e._v(" "),t("div",{staticClass:"script_info",class:{hide:!e.jsupdate}},[t("span",{staticClass:"eflex script_size",attrs:{title:"脚本大小"}},[e._v(e._s(e.jssize))]),e._v(" "),t("span",{staticClass:"emargin--d5em",attrs:{title:"最近更新"}},[e._v(e._s(e.jsupdate))])]),e._v(" "),t("div",{staticClass:"eflex bk_main_cl radius_bs"},[t("button",{staticClass:"elecBtn greenbk elecBtn--new",on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.jsView()}}},[e._v(e._s(e.$ta("new","script")))]),e._v(" "),t("button",{staticClass:"elecBtn bk_secd_fc radius_zero",on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.scriptTask()}}},[e._v(e._s(e.$ta("add","task")))]),e._v(" "),t("span",{staticClass:"title_collapse emargin--d5em",class:{"title_collapse--collapsed":e.collapse.editor},attrs:{title:"全屏"},on:{click:function(t){if(t.preventDefault(),t.target!==t.currentTarget)return null;e.collapse.editor=!e.collapse.editor}}})])]),e._v(" "),t("textarea",{directives:[{name:"model",rawName:"v-model",value:e.jscontent,expression:"jscontent"}],staticClass:"editor_textarea",class:{"editor_textarea--nowrap":e.textarea_nowrap},attrs:{placeholder:e.orgjs},domProps:{value:e.jscontent},on:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab")||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:(t.preventDefault(),t.stopPropagation(),e.$uApi.insertText(" "))},function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.jsSave()):null},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:t.ctrlKey?(t.preventDefault(),t.shiftKey||t.altKey||t.metaKey?null:e.jsTest()):null},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:t.altKey?(t.preventDefault(),t.ctrlKey||t.shiftKey||t.metaKey?null:void(e.textarea_nowrap=!e.textarea_nowrap)):null},function(t){return(t.type.indexOf("key")||66===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),t.shiftKey||t.altKey||t.metaKey?null:e.jsTest()):null}],input:function(t){t.target.composing||(e.jscontent=t.target.value)}}}),e._v(" "),t("div",{staticClass:"eflex eflex--wrap w100",attrs:{title:"tab: 两个空格 ctrl+s: 保存 ctrl+enter/ctrl+b: 测试运行 alt+enter: 不换行"}},[t("button",{staticClass:"elecBtn elecBtn--jseditor",on:{click:function(t){return e.jsSave()}}},[e._v(e._s(e.$ta("save","script"))+"(ctrl+s)")]),e._v(" "),t("button",{staticClass:"elecBtn elecBtn--jseditor",on:{click:function(t){return e.jsTest()}}},[e._v(e._s(e.$ta("test","run"))+"(ctrl+b)")])])]),e._v(" "),t("mock",{attrs:{jslists:e.jslists}}),e._v(" "),t("log",{attrs:{logs:e.logs,title:e.runlogs,collapse:e.collapse}})],1),e._v(" "),t("footer",{staticClass:"footer"},[t("ul",{staticClass:"footer_tip"},[t("li",[e._v("当远程脚本无法推送时,尝试在 SETTING 界面添加代理")]),e._v(" "),t("li",[e._v("远程推送脚本时可附加 -rename=xxx.js 重命名文件")]),e._v(" "),t("li",[e._v("mock 网络请求可用于检查网络及代理是否正常")]),e._v(" "),t("li",[e._v(e._s(e.$ta("more","detail"))+" "),t("a",{attrs:{href:"https://github.com/elecV2/elecV2P-dei/tree/master/docs/04-JS.md",target:"elecV2PDoc"}},[e._v(e._s(e.$t("document"))+":04-JS.md")])])])])])};yr._withStripped=!0;var $r=function(){var e=this,t=e._self._c;return t("div",{staticClass:"storemanage",class:{"storemanage--collapsed":e.collapse}},[t("h2",{staticClass:"title"},[t("span",{staticClass:"icon cursor title_sync",attrs:{title:"更新列表"},domProps:{innerHTML:e._s(e.icon.sync)},on:{click:e.storeGet}}),e._v(" "),t("span",{staticClass:"title_main",attrs:{title:"ctrl+f 搜索"}},[e._v("store/cookie "+e._s(e.$t("persistence"))+" - "+e._s(Object.keys(e.store).length))]),e._v(" "),t("span",{staticClass:"title_collapse",class:{"title_collapse--collapsed":e.collapse},on:{click:function(t){e.collapse=!e.collapse}}})]),e._v(" "),t("ul",{staticClass:"storelists",on:{click:function(t){return t.preventDefault(),e.storeOp(t)}}},[e._l(e.storeshow,(function(s){return t("li",{key:s,staticClass:"storelists_item"},[t("span",{attrs:{"data-edit":s}},[e._v(e._s(s))]),e._v(" "),t("span",{staticClass:"item_delete",attrs:{"data-delete":s}},[e._v("X")])])})),e._v(" "),t("li",{directives:[{name:"show",rawName:"v-show",value:!!e.restnum,expression:"!!restnum"}],staticClass:"storelists_item storelists_item--showrest"},[t("span",{on:{click:function(t){e.shownum=-1}}},[e._v(e._s(e.$ta("show","rest"))+" "+e._s(e.restnum))])])],2),e._v(" "),t("div",{staticClass:"editor editor--inner"},[t("div",{staticClass:"editor_title"},[t("div",{staticClass:"eflex epos_rel"},[t("label",{staticClass:"store_label",attrs:{title:"请注意大小写"}},[e._v("KEY:")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.edkey,expression:"edkey",modifiers:{trim:!0}}],staticClass:"editor_input storekey_input",attrs:{type:"text",name:"name",placeholder:"NEWKEY"},domProps:{value:e.edkey},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.storeEdit(e.edkey)},keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:t.ctrlKey?t.shiftKey||t.altKey||t.metaKey?null:e.storeDelete(e.edkey):null},input:function(t){t.target.composing||(e.edkey=t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("button",{directives:[{name:"show",rawName:"v-show",value:e.edkey,expression:"edkey"}],staticClass:"elecBtn elecBtn--del",on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.storeDelete(e.edkey)}}},[e._v("X")])]),e._v(" "),t("div",{staticClass:"eflex emargin",attrs:{title:"如不清楚就保持默认"}},[t("label",{staticClass:"store_label"},[e._v("TYPE:")]),e._v(" "),t("select",{directives:[{name:"model",rawName:"v-model",value:e.edvalue.type,expression:"edvalue.type"}],staticClass:"elecTable_select w120",on:{change:function(t){var s=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(e.edvalue,"type",t.target.multiple?s:s[0])}}},[t("option",{attrs:{selected:"selected"}},[e._v("string")]),e._v(" "),t("option",[e._v("number")]),e._v(" "),t("option",{attrs:{value:"object"}},[e._v("json")]),e._v(" "),t("option",[e._v("array")]),e._v(" "),t("option",[e._v("boolean")])])]),e._v(" "),t("div",{staticClass:"eflex"},[t("label",{staticClass:"minw100"},[e._v(e._s(e.$t("belong"))+":")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.trim.lazy",value:e.edvalue.belong,expression:"edvalue.belong",modifiers:{trim:!0,lazy:!0}}],staticClass:"editor_input storebelong_input",attrs:{type:"text",name:"name",placeholder:"写入或调用该 store 常量的脚本(可省略)"},domProps:{value:e.edvalue.belong},on:{change:function(t){e.$set(e.edvalue,"belong",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("div",{staticClass:"storebelong eflex--wrap"},[t("div",{staticClass:"eflex"},[t("label",{staticClass:"store_label"},[e._v(e._s(e.$t("note"))+":")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.trim.lazy",value:e.edvalue.note,expression:"edvalue.note",modifiers:{trim:!0,lazy:!0}}],staticClass:"editor_input storenote_input",attrs:{type:"text",name:"name",placeholder:"关于该 store 常量的一些说明(可省略)"},domProps:{value:e.edvalue.note},on:{change:function(t){e.$set(e.edvalue,"note",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("span",{directives:[{name:"show",rawName:"v-show",value:e.edvalue.update,expression:"edvalue.update"}],staticClass:"efont",attrs:{title:"该 cookie 的最近更新时间"}},[e._v(e._s(e.$ta("last","update"))+": "+e._s(e.edvalue.update))]),e._v(" "),t("button",{staticClass:"elecBtn elecBtn--h36",on:{click:function(t){return e.viewBelong()}}},[e._v(e._s(e.$ta("check","belong","script")))])])]),e._v(" "),t("textarea",{directives:[{name:"model",rawName:"v-model",value:e.edvalue.value,expression:"edvalue.value"}],staticClass:"editor_textarea",attrs:{placeholder:"the value of key"},domProps:{value:e.edvalue.value},on:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab")||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:(t.preventDefault(),t.stopPropagation(),e.$uApi.insertText(" "))},function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.storeSave()):null}],input:function(t){t.target.composing||e.$set(e.edvalue,"value",t.target.value)}}}),e._v(" "),t("div",{staticClass:"eflex eflex--wrap w100"},[t("button",{staticClass:"elecBtn elecBtn--store",attrs:{title:"快捷键: ctrl+s"},on:{click:function(t){return e.storeSave()}}},[e._v(e._s(e.$t("save")))]),e._v(" "),t("button",{staticClass:"elecBtn elecBtn--store folderbk",attrs:{title:".json 表示单个 Cookie, .zip 表示所有 Cookie"},on:{click:function(t){return e.storeImport()}}},[e._v(e._s(e.$t("import")))]),e._v(" "),t("button",{staticClass:"elecBtn elecBtn--store",on:{click:function(t){return e.storeExport()}}},[e._v(e._s(e.$t("export")))]),e._v(" "),t("button",{staticClass:"elecBtn elecBtn--store greenbk",on:{click:function(t){return e.storeBackup()}}},[e._v(e._s(e.$ta("backup","all")))])])])])};$r._withStripped=!0;const wr={name:"storemanage",props:["logs"],data:()=>({store:[],edkey:"",edvalue:{type:"string"},collapse:!0,icon:wa,shownum:50,restnum:0}),computed:{storeshow(){let e=this.shownum;if(-1===e||e>=this.store.length)return this.restnum=0,this.store;let t=0,s=[];for(;t++{this.store=e.data,this.$message.success("成功获取 store 常量 "+this.store.length),this.logs.unshift(`[${this.$logHead("storemanage info")}][${this.$sTime(null,1)}] 成功获取 store 常量 ${this.store.length}`)})).catch((e=>{this.$message.error("获取 store 常量失败",e.message),this.logs.unshift(`[${this.$logHead("storemanage error")}][${this.$sTime(null,1)}] 获取 store/cookie 常量失败 ${e.message}`),console.error("获取 store 常量失败",e)})).finally(e)},storeEdit(e){if(!e)return void this.$message.error("请先确定要获取的 key 值");if(-1===this.store.indexOf(e))return this.$message.error(e,"暂不存在"),void this.logs.unshift(`[${this.$logHead("storemanage error")}][${this.$sTime(null,1)}] ${e} 暂不存在`);const t=this.$message.loading("正在获取",e,"的值...",0);this.$axios.get("/store/"+e).then((t=>{this.edkey=e,"object"==typeof t.data&&void 0!==t.data.type&&void 0!==t.data.value?(this.edvalue=t.data,/^(array|object|json)$/.test(t.data.type)&&(this.edvalue.value=JSON.stringify(t.data.value,null,2))):this.edvalue={type:"string",value:"object"==typeof t.data?JSON.stringify(t.data,null,2):t.data},this.$message.success("成功获取",e,"的值"),this.logs.unshift(`[${this.$logHead("storemanage info")}][${this.$sTime(null,1)}] 成功获取 ${e} 的值`)})).catch((t=>{this.$message.error("获取",e,"数据失败",t.message),this.logs.unshift(`[${this.$logHead("storemanage error")}][${this.$sTime(null,1)}] 获取 ${e} 数据失败 ${t.message}`),console.error("获取",e,"数据失败",t)})).finally(t)},storeSave(){if(this.edkey&&this.edvalue.value){if(/array|object|json/.test(this.edvalue.type)){let e=this.$sJson(this.edvalue.value);if(!e)return void this.$message.error("当前输入内容无法转化为 array/object/json 格式");this.edvalue.value=JSON.stringify(e,null,2)}if(-1===this.store.indexOf(this.edkey)||confirm(this.edkey+" 已存在,是否覆盖?")){const e=this.$message.loading("数据上传保存中...",0);this.$axios.put("/store",{type:"save",data:{key:this.edkey,value:this.edvalue}}).then((e=>{-1===e.data.rescode?(this.$message.error(this.edkey,"保存失败"),this.logs.unshift(`[${this.$logHead("storemanage error")}][${this.$sTime(null,1)}] ${this.edkey} 保存失败 ${e.data.message}`)):(this.$message.success(this.edkey,"已保存"),this.logs.unshift(`[${this.$logHead("storemanage info")}][${this.$sTime(null,1)}] ${this.edkey} 已保存 ${e.data.message||e.data}`),-1===this.store.indexOf(this.edkey)&&this.store.push(this.edkey),"number"===this.edvalue.type?this.edvalue.value=Number(this.edvalue.value):"boolean"===this.edvalue.type&&(this.edvalue.value=this.$uStr.sBool(this.edvalue.value)),this.$set(this.edvalue,"update",this.$sTime(null,0,0)))})).catch((e=>{this.$message.error("保存失败:",e.message),this.logs.unshift(`[${this.$logHead("storemanage error")}][${this.$sTime(null,1)}] ${this.edkey} 保存失败 ${e.message}`),console.error("提交 store 常量失败",e)})).finally(e)}}else this.$message.error("请先输入 KEY 及对应内容")},storeDelete(e){if(e){if(confirm("确定删除:"+e+",及对应的值?")){const t=this.$message.loading("数据删除中...",0);this.$axios.put("/store",{type:"delete",data:e}).then((t=>{if(0===t.data.rescode){this.$message.success(e,"已删除"),this.logs.unshift(`[${this.$logHead("storemanage info")}][${this.$sTime(null,1)}] ${e} 已删除 ${t.data.message}`);const s=this.store.indexOf(e);s>-1&&this.store.splice(s,1),this.edkey===e&&(this.edkey="",this.edvalue={type:"string"})}else this.$message.error(e,"删除失败",t.data.message),this.logs.unshift(`[${this.$logHead("storemanage error")}][${this.$sTime(null,1)}] ${e} 删除失败 ${t.data.message}`)})).catch((t=>{this.$message.error("删除失败:"+t.message),this.logs.unshift(`[${this.$logHead("storemanage error")}][${this.$sTime(null,1)}] ${e} 删除失败 ${t.message}`),console.error("删除数据失败",t)})).finally(t)}}else this.$message.error("请先输入要删除的 KEY")},storeOp(e){e.target.dataset.edit?this.storeEdit(e.target.dataset.edit):e.target.dataset.delete&&this.storeDelete(e.target.dataset.delete)},viewBelong(){this.edvalue.belong?this.$emit("belongview",this.edvalue.belong.replaceAll(/ ?, ?|,| /g,"|")):this.$message.error("该 cookie 暂无关联脚本")},storeExport(){this.edkey&&this.edvalue.value?this.$uApi.saveAsFile({key:this.edkey,value:this.edvalue,update:this.$sTime()},this.edkey+"_elecV2Pstore.json"):this.$message.error("当前 Cookie 值为空")},async storeImport(){let e=await this.$uApi.getFile({accept:".json,.zip",type:"file"});if("application/x-zip-compressed"===e.type){if(!/elecV2P/.test(e.name)&&!confirm("当前导入 zip 文件可能并不是 elecV2P store 备份\n确定要继续导入吗?"))return;const t=this.$message.loading("正在对上传的备份文件进行解析...");let s=new FormData;return s.append("backup",e),void this.$axios.post("/store/backup",s,{headers:{"Content-Type":"multipart/form-data"}}).then((e=>{0===e.data.rescode?(console.debug(e.data),this.store=e.data.resdata,this.$message.success("store 备份成功上传"),this.logs.unshift(`[${this.$logHead("storeImport info")}][${this.$sTime(null,1)}] 备份上传成功 ${e.data.message}`)):(this.$message.error("备份上传失败",e.data.message),this.logs.unshift(`[${this.$logHead("storeImport error")}][${this.$sTime(null,1)}] store 备份上传失败 ${e.data.message}`))})).catch((e=>{this.$message.error("上传备份失败",e.message),this.logs.unshift(`[${this.$logHead("storeImport error")}][${this.$sTime(null,1)}] 上传备份失败 ${e.message}`),console.error(e)})).finally(t)}if("application/json"!==e.type)return void this.$message.error("仅支持 json 格式文件导入");let t=new FileReader;t.onload=e=>{let t=e.target.result,s=this.$sJson(t);s.key&&s.value&&s.value.type&&s.value.value?(this.edkey=s.key,this.edvalue=s.value,this.logs.unshift(`[${this.$logHead("storeImport info")}][${this.$sTime(null,1)}] 成功导入 Cookie ${this.edkey}`),this.$message.success(`成功导入 Cookie ${this.edkey}`)):(console.error("elecV2P 无法解析该文件内容",t),this.$message.error("导入的 Cookie 文件内容格式不正确",8),this.logs.unshift(`[${this.$logHead("storeImport error")}][${this.$sTime(null,1)}] 导入的 Cookie 文件内容并非 elecV2P 可解析的格式\n${t.length>300?t.slice(-300)+"...":t}`))},t.readAsText(e)},storeBackup(){this.$uApi.downloadFile("/backup/store","elecV2P_store.zip")}}};const kr=ka(wr,$r,[],!1,null,"c3b243d4",null).exports;var Cr=function(){var e=this,t=e._self._c;return t("div",{staticClass:"mock",class:{"mock--collapsed":e.collapse}},[t("h4",{staticClass:"title title--mock"},[t("span",{staticClass:"title_main"},[e._v(e._s(e.$ta("mock","HTTP","request")))]),e._v(" "),t("span",{staticClass:"title_collapse",class:{"title_collapse--collapsed":e.collapse},on:{click:function(t){e.collapse=!e.collapse}}})]),e._v(" "),t("div",{staticClass:"eflex eflex--wrap"},[t("select",{directives:[{name:"model",rawName:"v-model",value:e.method,expression:"method"}],staticClass:"elecTable_select w120 emargin--top",on:{change:function(t){var s=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.method=t.target.multiple?s:s[0]}}},[t("option",[e._v("GET")]),e._v(" "),t("option",[e._v("PUT")]),e._v(" "),t("option",[e._v("POST")]),e._v(" "),t("option",[e._v("DELETE")])]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:e.apiurl,expression:"apiurl",modifiers:{lazy:!0,trim:!0}}],staticClass:"elecTable_input eflex_grow1 wp50 emargin--d5em",domProps:{value:e.apiurl},on:{change:function(t){e.apiurl=t.target.value.trim()},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("select",{directives:[{name:"model",rawName:"v-model",value:e.mocktype,expression:"mocktype"}],staticClass:"elecTable_select w220 emargin--top",on:{change:function(t){var s=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.mocktype=t.target.multiple?s:s[0]}}},[t("option",{attrs:{value:"fetch"}},[e._v("from "+e._s(e.$t("browser")))]),e._v(" "),t("option",{attrs:{value:"axios"}},[e._v("from elecV2P")])])]),e._v(" "),t("div",{staticClass:"eflex eflex--wrap"},[t("label",{staticClass:"mock_label",attrs:{title:"网络请求头"}},[e._v("HEADERS:")]),e._v(" "),t("select",{directives:[{name:"model",rawName:"v-model",value:e.headertype,expression:"headertype"}],staticClass:"elecTable_select w220 emargin--top",attrs:{title:"Content-Type"},on:{change:function(t){var s=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.headertype=t.target.multiple?s:s[0]}}},[t("option",[e._v("text/plain")]),e._v(" "),t("option",[e._v("application/json")]),e._v(" "),t("option",[e._v("application/x-www-form-urlencoded")])]),e._v(" "),t("label",{staticClass:"mock_label emargin--left",attrs:{title:"headers more"}},[e._v(e._s(e.$t("more").toUpperCase())+":")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:e.headermore,expression:"headermore",modifiers:{lazy:!0,trim:!0}}],staticClass:"elecTable_input eflex_grow1 wp50 emargin--top",attrs:{placeholder:"{ Cookie: '123' }"},domProps:{value:e.headermore},on:{change:function(t){e.headermore=t.target.value.trim()},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("textarea",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:e.body,expression:"body",modifiers:{lazy:!0,trim:!0}}],staticClass:"editor_textarea editor_textarea--mini",attrs:{placeholder:"request body. 网络请求体"},domProps:{value:e.body},on:{change:function(t){e.body=t.target.value.trim()},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("div",{staticClass:"eflex"},[t("button",{staticClass:"elecBtn elecBtn--stlong",on:{click:function(t){return e.mockreq()}}},[e._v(e._s(e.$ta("send","request")))]),e._v(" "),t("button",{staticClass:"elecBtn elecBtn--stlong emargin--left",on:{click:function(t){e.jsnameshow=!0}}},[e._v(e._s(e.$ta("make","script")))])]),e._v(" "),e.jsnameshow?t("div",{staticClass:"mockjsname"},[t("label",{staticClass:"mock_label"},[e._v(e._s(e.$ta("script","name"))+":")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:e.jsname,expression:"jsname",modifiers:{lazy:!0,trim:!0}}],staticClass:"elecTable_input w220",domProps:{value:e.jsname},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.mockjs()},change:function(t){e.jsname=t.target.value.trim()},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("button",{staticClass:"elecBtn emargin--d5em greenbk",on:{click:function(t){return e.mockjs()}}},[e._v(e._s(e.$t("confirm")))]),e._v(" "),t("button",{staticClass:"elecBtn elecBtn--stop minw62",on:{click:function(t){e.jsnameshow=!1}}},[e._v("X")])]):e._e()])};Cr._withStripped=!0;const xr={name:"mock",props:["jslists"],data:()=>({method:"GET",apiurl:"https://httpbin.org/get",mocktype:"fetch",headertype:"text/plain",headermore:"{}",body:null,jsname:"elecV2Pmock.js",jsnameshow:!1,collapse:!0}),computed:{headers(){let e={"Content-Type":this.headertype+";charset=utf-8"},t=this.$sJson(this.headermore);return t?Object.assign(e,t):(this.$message.error("headers 附加内容并不是正确的 JSON 格式"),this.$wsrecv.dispatch("jsmanage",`[${this.$logHead("mockreq error")}][${this.$sTime(null,1)}] headers 附加内容 ${this.headermore} 并不是正确的 JSON 格式`)),e}},methods:{mockreq(){const e={url:this.apiurl,method:this.method,headers:this.headers,body:this.body};if(/json/.test(e.headers["Content-Type"])){let t=this.$sJson(this.body);if(!t)return console.error("body 内容并不是正确的 JSON 格式"),void this.$message.error("body 内容并不是正确的 JSON 格式");e.body=t}e.body?e.body=this.$sString(e.body):e.body=null;const t=this.$message.loading("网络请求已执行,等待数据返回...",0);"fetch"===this.mocktype?fetch(e.url,e).then((e=>e.text())).then((e=>{this.$message.success("网络请求成功"),e=`[${this.$logHead("mockFetch result")}][${this.$sTime(null,1)}] ${e}`,this.$wsrecv.dispatch("jsmanage",e)})).catch((e=>{this.$message.error("fetch 请求失败",e.message);let t=`[${this.$logHead("mockFetch error")}][${this.$sTime(null,1)}] fetch 请求失败 ${e.message}`;this.$wsrecv.dispatch("jsmanage",t),console.error("fetch 请求失败",e)})).finally(t):this.$axios.put("/mock",{type:"req",request:e}).then((e=>{this.$message.success("网络请求",e.data.message),console.debug(e.data)})).catch((e=>{this.$message.error("请求失败",e.message),console.error(e)})).finally(t)},mockjs(){this.jsnameshow=!1;const e={url:this.apiurl,method:this.method,headers:this.headers};if(/json/.test(e.headers["Content-Type"])){let t=this.$sJson(this.body);if(!t)return console.error("body 内容并不是正确的 JSON 格式"),void this.$message.error("body 内容并不是正确的 JSON 格式");e.body=t}else e.body=this.body;if(this.jslists.indexOf(this.jsname)>-1&&!confirm(this.jsname+" 已存在,是否覆盖?"))return;const t=this.$message.loading("JS 脚本生成中...",0);this.$axios.put("/mock",{type:"js",jsname:this.jsname,request:e}).then((e=>{this.$message.success("脚本已保存",e.data.message),this.jslists.push(this.jsname)})).catch((e=>{this.$message.error("请求失败",e.message),console.error(e)})).finally(t)}}};const Tr=ka(xr,Cr,[],!1,null,"732d9c77",null).exports;var Sr=function(){var e=this,t=e._self._c;return t("ul",{staticClass:"menu",style:{left:(e.pos?e.pos[0]:0)+"px",top:(e.pos?e.pos[1]:0)+"px"}},e._l(e.menus,(function(s,i){return t("li",{staticClass:"menu_item",style:{color:s.color,backgroundColor:s.bkcolor,fontSize:s.fontsize,height:s.height},attrs:{"data-method":s.method,"data-param":s.param},on:{click:function(t){return t.preventDefault(),e.click(i)},contextmenu:function(t){return t.preventDefault(),e.rclick(i)},dblclick:function(t){return t.preventDefault(),e.dclick(i)}}},[e._v(e._s(s.label))])})),0)};Sr._withStripped=!0;const Or=ka({name:"contextmenu",props:["menus","pos"],methods:{click(e){this.menus.length&&this.menus[e].click?this.menus[e].click():console.debug("点击暂无对应处理函数"),this.menus.splice(0)},rclick(e){this.menus.length&&this.menus[e].rclick?this.menus[e].rclick():console.debug("右键暂无对应处理函数"),this.menus.splice(0)},dclick(e){this.menus.length&&this.menus[e].dclick?this.menus[e].dclick():console.debug("双击暂无对应处理函数"),this.menus.splice(0)}}},Sr,[],!1,null,"10ef9a33",null).exports,Er={name:"jsmanage",data(){return{jslists:[],jsdownloadurl:"",jsname:"",jscontent:"",jsupdate:"",jssize:"",jsshowall:!1,jsfiles:[],orgjs:"// 每个脚本理论上都有权限对服务器上的任一文件进行随意修改,请勿运行不信任的脚本\nconsole.log('当前 elecV2P 版本', __version)\n// 获取 store/cookie 值\nlet val = $store.get('cookieKEY')\nconsole.log('cookieKEY 对应值:', val)\n\n// 发送通知\n$feed.push('elecV2P 通知', '该通知来自脚本' + __name + '\\n\\n更多说明请查看: https://github.com/elecV2/elecV2P-dei/tree/master/docs/07-feed¬ify.md', 'https://github.com/elecV2/elecV2P')\n\n// 网络请求\n$axios({\n url: 'https://httpbin.org/post',\n headers: {\n 'User-Agent': 'elecV2P Super Max Plus++',\n },\n method: 'post'\n}).then(res=>{\n console.log(res.data)\n}).catch(e=>console.error(e.message)).finally(()=>{\n $done('网络请求执行完毕')\n})\n\nconsole.log('更多脚本相关说明请查看说明文档: https://github.com/elecV2/elecV2P-dei/tree/master/docs/04-JS.md')\n",logs:[],icon:wa,collapse:{titlearrow:this.$uStr.iRandom(0,10)>2,loginfo:!0,editor:!0},shownum:100,restnum:0,menu:{pos:[0,0],list:[]},textarea_nowrap:!1,runlogs:this.$ta("script","run","logs")}},components:{store:kr,log:tr,mock:Tr,contextmenu:Or},activated(){const e=this.$uApi.store.getCache("scriptview");e&&(this.jslists.length?this.jsView(e):this.getJSlist().then((()=>{this.jsView(e)})),this.$uApi.store.deleteCache("scriptview"))},computed:{jsfilename(){let e=[];for(let t=0;t=this.jslists.length)return this.restnum=0,this.jslists;let t=0,s=[];for(;t++{try{return e.test(t)}catch(e){return!0}}));return 0===t.length&&-1!==this.shownum&&(this.shownum=-1),t}},created(){this.$uApi.store.getCache("scriptview")||this.getJSlist().then((()=>{const e=new URL(location).searchParams.get("fn");e&&this.jsView(e)}));const e=this.$wsrecv.add("jsmanage",(e=>{this.logs.length>=200||/\x1b\[H/.test(e)?this.logs=[e]:/\r|(\x1b\[F)/.test(e)?this.logs.splice(0,1,e):this.logs.unshift(e)}));e&&this.logs.unshift(`[${this.$logHead("websocket error")}][${this.$sTime(null,1)}] [31m${e}, 日志无法传输`)},methods:{async getJSlist(){const e=this.$message.loading("获取脚本列表中...",0);let t=await this.$axios.get("/jsfile").catch((e=>{this.$message.error("获取脚本列表失败",e.message),this.logs.unshift(`[${this.$logHead("jsmanage error")}][${this.$sTime(null,1)}] [31m脚本列表获取失败 ${e.message}`),console.error("获取失败",e)}));t&&t.data&&(this.jslists=t.data,this.$message.success(`成功获取脚本列表 ${this.jslists.length}`),this.logs.unshift(`[${this.$logHead("jsmanage info")}][${this.$sTime(null,1)}] 成功获取脚本 ${this.jslists.length}`)),e()},jsDownload(){if(!this.jsdownloadurl||!1===/^https?:\/\/\S{4}/.test(this.jsdownloadurl))return void this.$message.error("该远程脚本链接有误",this.jsdownloadurl);let e=this.jsdownloadurl.match(/ -rename(=| )([^\- ]+)/),t="",s="";if(e&&e[2]?(t=e[2].replace(/^(\\|\/)+/,""),s=this.jsdownloadurl.replace(/ -rename(=| )([^\- ]+)/,"").trim()):(t=this.$uStr.surlName(this.jsdownloadurl),s=this.jsdownloadurl),(/\.(js|efh)$/.test(s)||confirm("当前远程链接对应文件可能并非脚本文件,是否继续?"))&&(-1===this.jslists.indexOf(t)||confirm(t+" 已存在,是否覆盖?"))){const e=this.$message.loading(`${t} 下载中...`,0);this.$axios.put("/jsfile",{op:"jsdownload",name:t,url:s}).then((e=>{0===e.data.rescode?(this.$message.success(t,"下载成功"),-1===this.jslists.indexOf(t)&&this.jslists.push(t),this.logs.unshift(`[${this.$logHead("jsDownload info")}][${this.$sTime(null,1)}] ${t} 下载成功 ${e.data.message}`)):(this.$message.error(t,"下载失败"),this.logs.unshift(`[${this.$logHead("jsDownload error")}][${this.$sTime(null,1)}] [31m${s} 下载失败 ${e.data.message}`))})).catch((e=>{this.$message.error("下载失败",e.message),this.logs.unshift(`[${this.$logHead("jsDownload error")}][${this.$sTime(null,1)}] [31m${s} 下载失败,${e.message}`),console.error(s,"下载失败",e)})).finally(e)}},jsSave(){if(!/\.(js|efh)$/i.test(this.jsname))return this.$message.error("脚本文件名错误"),void this.logs.unshift(`[${this.$logHead("jsSave error")}][${this.$sTime(null,1)}] [31m${this.jsname} 并非合法的脚本名称。编辑上传其他类型的文件请前往 EFSS 界面`);if(!this.jscontent)return this.$message.error("请先输入脚本内容"),void this.logs.unshift(`[${this.$logHead("jsSave error")}][${this.$sTime(null,1)}] [31m保存脚本失败,请先输入脚本内容`);const e=this.$message.loading(this.jsname,"保存中...",0);this.$axios.post("/jsfile",{jsname:this.jsname,jscontent:this.jscontent}).then((e=>{0===e.data.rescode?(this.$message.success(this.jsname,"保存成功"),-1===this.jslists.indexOf(this.jsname)&&this.jslists.push(this.jsname),this.logs.unshift(`[${this.$logHead("jsSave info")}][${this.$sTime(null,1)}] ${this.jsname} 保存成功`),this.jsupdate=this.$sTime(),this.jssize=this.$uStr.kSize((new TextEncoder).encode(this.jscontent).length)):(this.$message.error(this.jsname,"保存失败",e.data.message),this.logs.unshift(`[${this.$logHead("jsSave error")}][${this.$sTime(null,1)}] [31m${this.jsname} 保存失败`))})).catch((e=>{console.error(e),this.$message.error("保存失败",e.message),this.logs.unshift(`[${this.$logHead("jsSave error")}][${this.$sTime(null,1)}] [31m保存失败 ${e.message}`)})).finally(e)},jsTest(){if(this.jsname&&this.jscontent){if(/\$request|\$response/.test(this.jscontent)&&!confirm("$request/$response 等参数仅在网络请求中有效,是否继续执行?"))return;let e="";const t=this.$message.loading(this.jsname,"正在上传运行中...",0);this.collapse.loginfo=!1,this.logs.unshift(`[${this.$logHead("jsTestRun info")}][${this.$sTime(null,1)}] 正在测试运行 ${this.jsname}...`),this.$axios.post("/jsfile",{id:this.$wsrecv.id,type:"totest",jsname:this.jsname,jscontent:this.jscontent}).then((t=>{e=this.$sString(t.data),this.$message.success(e)})).catch((t=>{e="测试运行失败 "+t.message,this.$message.error(e),console.error(t)})).finally((()=>{t(),this.logs.unshift(`[${this.$logHead(this.jsname+" result")}][${this.$sTime(null,1)}] ${e||this.jsname+" 返回值为空"}`)}))}else this.$message.error("脚本名称或内容不完整")},jstoupload(){this.jsfiles=this.$refs.jsfiles.files},jsUpload(){let e=new FormData,t=[];for(let s=0;s{0===e.data.rescode?(this.$message.success(t.join(", "),"上传成功"),t.forEach((e=>{-1===this.jslists.indexOf(e)&&this.jslists.push(e)})),this.jsfiles="",this.$refs.jsfiles.value="",this.logs.unshift(`[${this.$logHead("jsUpload info")}][${this.$sTime(null,1)}] ${t.join(", ")} 上传成功`)):(this.$message.error("上传失败",e.data.message),this.logs.unshift(`[${this.$logHead("jsUpload error")}][${this.$sTime(null,1)}] [31m上传失败 ${e.data.message}`))})).catch((e=>{this.$message.error("上传失败",e.message),this.logs.unshift(`[${this.$logHead("jsUpload error")}][${this.$sTime(null,1)}] [31m上传失败 ${e.message}`),console.error("文件上传失败",e)})).finally(s)},jsView(e){if(e&&1===this.jslistsshow.length&&(e=this.jslistsshow[0]),e&&-1!==this.jslists.indexOf(e)){this.jsname=e;const t=this.$message.loading("正在获取",e,"文件内容...",0);this.$axios.get("/jsfile?jsfn="+e,{transformResponse:[e=>e]}).then((t=>{this.jscontent=t.data,this.$message.success(e,"文件内容获取成功"),this.logs.unshift(`[${this.$logHead("jsmanage info")}][${this.$sTime(null,1)}] ${e} 文件内容获取成功`),t.headers["last-modified"]?(this.jsupdate=this.$sTime(t.headers["last-modified"]),this.jssize=this.$uStr.kSize((new TextEncoder).encode(t.data).length)):this.jsupdate=""})).catch((t=>{this.$message.error(e,"获取失败",t.message),this.logs.unshift(`[${this.$logHead("jsmanage error")}][${this.$sTime(null,1)}] [31m${e} 获取失败 ${t.message}`),console.error(e,"获取失败",t)})).finally(t)}else if(/^https?:\/\//.test(e)){let t=this.$message.loading("检测到该脚本文件名为远程地址,正在尝试获取其文件内容...",0);this.$axios.get(e,{transformResponse:[e=>e],crossdomain:!0}).then((t=>{this.jsname=this.$uStr.surlName(e),this.jscontent=t.data,this.$message.success("远程脚本文件",this.jsname,"获取成功"),this.logs.unshift(`[${this.$logHead("jsmanage info")}][${this.$sTime(null,1)}] ${e} 文件内容获取成功`),this.jsupdate=""})).catch((t=>{this.$message.error("远程脚本内容获取失败",t.message),this.logs.unshift(`[${this.$logHead("jsmanage error")}][${this.$sTime(null,1)}] [31m获取远程脚本: ${e} 失败,请检测网络后重试 ${t.message}`),console.error(t)})).finally(t)}else this.jsname=e||"new.js","new.js"!==this.jsname&&(this.$message.error(e,"暂不存在"),this.logs.unshift(`[${this.$logHead("jsmanage error")}][${this.$sTime(null,1)}] [31m${e} 暂不存在`)),""!==this.jscontent&&"new.js"!==this.jsname||(this.jscontent=this.orgjs),this.jsupdate="";this.jsshowall=!0,this.$uApi.scrollView(".editor--jsmanage")},jsDelete(e){if(e){if(confirm("确认删除服务器端脚本文件: "+e)){const t=this.$message.loading(`正在删除文件 ${e}...`,0);this.$axios.delete("/jsfile",{data:{jsfn:e}}).then((t=>{if(0===t.data.rescode){const s=this.jslists.indexOf(e);s>-1?(this.jslists.splice(s,1),this.$message.success(e,"已删除"),this.logs.unshift(`[${this.$logHead("jsDelete info")}][${this.$sTime(null,1)}] ${e} 已删除 ${t.data.message}`),this.jsname===e&&(this.jsname="",this.jscontent="")):this.$message.error(e,"文件不存在")}else this.$message.error(e,"删除失败"),this.logs.unshift(`[${this.$logHead("jsDelete error")}][${this.$sTime(null,1)}] [31m${e} 删除失败 ${t.data.message}`)})).catch((t=>{this.$message.error("未知错误",t.message),this.logs.unshift(`[${this.$logHead("jsDelete error")}][${this.$sTime(null,1)}] [31m${e} 删除失败 ${t.message}`),console.error("未知错误",t)})).finally(t)}}else this.$message.error("请先输入要删除的文件名")},jsOp(e){switch(e.target.dataset.method){case"view":this.jsView(e.target.dataset.param);break;case"delete":this.jsDelete(e.target.dataset.param);break;case"menu":this.jsMenu(e.target.dataset.param)}},jsRun(e){if(!e)return void this.$message.error("请先输入脚本名称");const t=this.$message.loading(e,"准备运行中...",0);this.collapse.loginfo=!1,this.logs.unshift(`[${this.$logHead("jsRun info")}][${this.$sTime(null,1)}] 正在运行 ${e}...`),this.$axios.post("/jsfile",{id:this.$wsrecv.id,type:"torun",jsname:e}).then((e=>{this.$message.success(e.data)})).catch((e=>{this.$message.error(e.message),console.error(e)})).finally(t)},jsMenu(e){let t=[],s=this.jsDelete,i=this.jsView,n=this.jsRun,a=this.$uApi.open,r=this.$uApi.copy,o=this.$message.success,l=/\.efh$/.test(e);t.push({label:"运行",bkcolor:"var(--icon-bk)",click(){n(e)}},{label:"查看",click(){i(e)}},{label:"删除",bkcolor:"var(--note-bk)",click(){s(e)}},{label:"复制脚本名称",click(){r(e),o("复制成功")}},{label:(l?"新标签页":"附带参数")+"运行",bkcolor:"var(--icon-bk)",click(){if(l)return void a("run/?target="+encodeURI(e));let t=prompt("请输入附带参数(比如:-env name=elecV2P 或 -grant nodejs)","-env ");null!==t&&n(e+(t?" "+t.trim():""))}},{label:"打开日志文件",click(){a("./logs/"+e.replace(/\/|\\/g,"-")+".log")}}),this.menu={pos:this.$uApi.getCursorPos(event,120,32*t.length),list:t}},scriptTask(){let e=this.jscontent,t=this.jsname;if(!e)return void this.$message.error("请先获取脚本内容");let s=e.match(/([0-9\-\*\/,]+ [0-9\-\*\/,]+ [0-9\-\*\/,]+ [0-9\-\*\/,]+ [0-9\-\*\/,]+( [0-9\-\*\/,]+)?) ([^ ,]+), ?tag=([^, \n\r]+)/);s||(s=e.match(/([0-9\-\*\/,]+ [0-9\-\*\/,]+ [0-9\-\*\/,]+ [0-9\-\*\/,]+ [0-9\-\*\/,]+( [0-9\-\*\/,]+)?)"?( (script\-path=)?([^, \n\r]+\.js))?(, ?tag=([^, \n\r]+))?/)||[],s[5]&&(s[3]=s[5]),s[4]=s[7]||"");let i=this.$axios,n=this.$message;this.$evui({title:"添加新的定时任务",width:800,height:148,style:{title:"background: var(--secd-fc);",content:"margin-top: .5em; font-family: var(--font-fm);"},content:`运行脚本
`,methods:{addTask(){let e=document.querySelector(".elecBtn[data-method=addTask]");if(e){if(e.dataset.done)return void n.success("该任务已添加");e.dataset.done="1",e.classList.remove("greenbk"),e.classList.add("elecBtn--stop")}let t=document.querySelector(".elecTable_input[name=task_name]").value,s=document.querySelector(".elecTable_input[name=task_time]").value,a=document.querySelector(".elecTable_input[name=task_target]").value;if(!(t&&s&&a))return n.error("请填写完整的任务内容"),void delete e.dataset.done;i.put("/task",{op:"add",data:{type:"addition",task:{name:t,type:document.querySelector(".elecTable_select[name=task_type]").value,time:s,job:{type:"runjs",target:a},running:!0}}}).then((s=>{0===s.data.rescode?n.success("添加定时任务",t,s.data.message):(delete e.dataset.done,n.error("添加定时任务失败",s.data.message))})).catch((t=>{n.error("添加定时任务失败",t.message),console.error("添加定时任务失败",t),delete e.dataset.done}))}}})}}};const jr=ka(Er,yr,[],!1,null,"6c7f3ec2",null).exports;var Nr=function(){var e=this,t=e._self._c;return t("section",{on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.saveAll()):null}}},[t("header",{staticClass:"header"},[e._v(e._s(e.$t("setting")))]),e._v(" "),t("main",{staticClass:"content"},[t("div",{staticClass:"setting setting--home"},[t("div",{staticClass:"wp50 minw320 eflex_grow1",on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.homepageSave()):null}}},[t("label",{staticClass:"setting_label",attrs:{title:"可访问此后台界面的完整 URL。用于 RSS 订阅及脚本中的 __home 参数"}},[e._v(e._s(e.$t("homepage"))+":")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.homepage,expression:"homepage",modifiers:{trim:!0}}],staticClass:"setting_input",attrs:{name:"homepage",placeholder:e.init_url},domProps:{value:e.homepage},on:{input:function(t){t.target.composing||(e.homepage=t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:function(t){return e.homepageSave()}}},[e._v(e._s(e.$t("save")))])]),e._v(" "),t("div",{staticClass:"wp50 minw320 eflex_grow1",on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.langSave()):null}}},[t("label",{staticClass:"setting_label",attrs:{title:"仅供参考"}},[e._v(e._s(e.$t("language"))+":")]),e._v(" "),t("select",{directives:[{name:"model",rawName:"v-model",value:e.lang,expression:"lang"}],staticClass:"setting_select setting_select--short",on:{change:function(t){var s=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.lang=t.target.multiple?s:s[0]}}},[t("option",{attrs:{value:"zh-CN"}},[e._v(e._s(e.$t("zh")))]),e._v(" "),t("option",{attrs:{value:"en"}},[e._v(e._s(e.$t("en")))])]),e._v(" "),t("span",{staticClass:"tip"},[e._v("(还有很多地方待翻译)")]),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:function(t){return e.langSave()}}},[e._v(e._s(e.$t("save")))])])]),e._v(" "),t("div",{staticClass:"setting setting--log"},[t("div",{staticClass:"wp50 minw320 eflex_grow1",on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.glevelSet()):null}}},[t("label",{staticClass:"setting_label",attrs:{title:"后台日志输出等级"}},[e._v(e._s(e.$t("logs"))+e._s(e.$t("level"))+":")]),e._v(" "),t("select",{directives:[{name:"model",rawName:"v-model",value:e.gloglevel,expression:"gloglevel"}],staticClass:"setting_select",on:{change:function(t){var s=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.gloglevel=t.target.multiple?s:s[0]}}},[t("option",[e._v("error")]),e._v(" "),t("option",[e._v("notify")]),e._v(" "),t("option",[e._v("info")]),e._v(" "),t("option",[e._v("debug")])]),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:function(t){return e.glevelSet()}}},[e._v(e._s(e.$t("save")))])]),e._v(" "),t("div",{staticClass:"wp50 minw320 eflex_grow1",on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.gsliceSet()):null}}},[t("label",{staticClass:"setting_label",attrs:{title:"后台日志输出格式"}},[e._v(e._s(e.$t("format"))+":")]),e._v(" "),t("select",{directives:[{name:"model",rawName:"v-model",value:e.glogslicebegin,expression:"glogslicebegin"}],staticClass:"setting_select",on:{change:function(t){var s=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.glogslicebegin=t.target.multiple?s:s[0]}}},[t("option",{attrs:{value:"0"}},[e._v("YYYY-MM-DD HH:mm:ss.SSS")]),e._v(" "),t("option",{attrs:{value:"5"}},[e._v("MM-DD HH:mm:ss.SSS")]),e._v(" "),t("option",{attrs:{value:"11"}},[e._v("HH:mm:ss.SSS")])]),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:function(t){return e.gsliceSet()}}},[e._v(e._s(e.$t("save")))])])]),e._v(" "),t("div",{staticClass:"setting setting--webhook"},[t("div",{staticClass:"wp50 minw320 eflex_grow1",on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.wbrtokenSave()):null}}},[t("label",{staticClass:"setting_label",attrs:{title:"服务器访问 token(非常重要)"}},[e._v("WEBHOOK TOKEN:")]),e._v(" "),t("div",{staticClass:"incon"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.wbrtoken,expression:"wbrtoken",modifiers:{trim:!0}}],staticClass:"setting_input incon_input",attrs:{name:"wbrtoken"},domProps:{value:e.wbrtoken},on:{input:function(t){t.target.composing||(e.wbrtoken=t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("span",{staticClass:"icon cursor incon_icon",domProps:{innerHTML:e._s(e.icon.sync)},on:{click:function(t){e.wbrtoken=e.$uStr.UUID()}}})]),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:function(t){return e.wbrtokenSave()}}},[e._v(e._s(e.$t("save")))])]),e._v(" "),t("div",{staticClass:"wp50 minw320 eflex_grow1",on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.wbrscriptSave()):null}}},[t("label",{staticClass:"setting_label",attrs:{title:"webhook 其他 payload 处理脚本"}},[e._v("SCRIPT:")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.wbrscript}}),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.wbrscript.target,expression:"wbrscript.target",modifiers:{trim:!0}}],staticClass:"setting_input setting_input--middle",attrs:{name:"wbrscript",placeholder:"webhook.js"},domProps:{value:e.wbrscript.target},on:{input:function(t){t.target.composing||e.$set(e.wbrscript,"target",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:function(t){return e.wbrscriptSave()}}},[e._v(e._s(e.$t("save")))])],1),e._v(" "),t("div",{directives:[{name:"show",rawName:"v-show",value:e.userid,expression:"userid"}],staticClass:"w100",attrs:{title:"基于 WEBHOOK TOKEN 自动生成 无法自定义及反推"}},[t("span",[e._v(e._s(e.$t("user"))+" ID: ")]),t("span",[e._v(e._s(e.userid))])])]),e._v(" "),t("div",{staticClass:"setting",class:{"setting--collapsed":e.collapse.notify}},[t("h4",{staticClass:"setting_title"},[t("div",{staticClass:"title_main"},[t("a",{staticClass:"cursor--help main_fc",attrs:{href:"https://github.com/elecV2/elecV2P-dei/tree/master/docs/07-feed¬ify.md",target:"elecV2PDoc"}},[e._v(e._s(e.$ta("notify","setting_of")))]),e._v(" "),t("span",{staticClass:"mleft30 cursor",attrs:{title:"点击进行测试(先保存)"},domProps:{innerHTML:e._s(e.icon.plays)},on:{click:function(t){return e.feedTest()}}})]),e._v(" "),t("span",{staticClass:"title_collapse",class:{"title_collapse--collapsed":e.collapse.notify},on:{click:function(t){e.collapse.notify=!e.collapse.notify}}})]),e._v(" "),t("div",{staticClass:"setting--notify"},[e._m(0),e._v(" "),t("checkbox",{attrs:{oCheck:e.CONFIG_FEED.iftttid}}),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.CONFIG_FEED.iftttid.key,expression:"CONFIG_FEED.iftttid.key",modifiers:{trim:!0}}],staticClass:"setting_input",attrs:{name:"ifttt",placeholder:"xxxxxxxxxxxxxxxxxxxxxx"},domProps:{value:e.CONFIG_FEED.iftttid.key},on:{input:function(t){t.target.composing||e.$set(e.CONFIG_FEED.iftttid,"key",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:function(t){return e.iftttSave()}}},[e._v(e._s(e.$t("save")))])],1),e._v(" "),t("div",{staticClass:"setting--notify"},[e._m(1),e._v(" "),t("checkbox",{attrs:{oCheck:e.CONFIG_FEED.barkkey}}),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.CONFIG_FEED.barkkey.key,expression:"CONFIG_FEED.barkkey.key",modifiers:{trim:!0}}],staticClass:"setting_input",attrs:{name:"barkkey",placeholder:"xxxxxxxxxxxxxxxxxxxxxx"},domProps:{value:e.CONFIG_FEED.barkkey.key},on:{input:function(t){t.target.composing||e.$set(e.CONFIG_FEED.barkkey,"key",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:function(t){return e.barkeySave()}}},[e._v(e._s(e.$t("save")))])],1),e._v(" "),t("div",{staticClass:"setting--notify"},[t("label",{staticClass:"setting_label"},[e._v("自定义通知:")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.CONFIG_FEED.custnotify}}),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.CONFIG_FEED.custnotify.url,expression:"CONFIG_FEED.custnotify.url",modifiers:{trim:!0}}],staticClass:"setting_input",attrs:{name:"custnotify",placeholder:"https://xxx.xx.xxx/xxxxxx"},domProps:{value:e.CONFIG_FEED.custnotify.url},on:{input:function(t){t.target.composing||e.$set(e.CONFIG_FEED.custnotify,"url",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("select",{directives:[{name:"model",rawName:"v-model",value:e.CONFIG_FEED.custnotify.type,expression:"CONFIG_FEED.custnotify.type"}],staticClass:"setting_select setting_select--short",on:{change:function(t){var s=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(e.CONFIG_FEED.custnotify,"type",t.target.multiple?s:s[0])}}},[t("option",[e._v("GET")]),e._v(" "),t("option",[e._v("POST")])]),e._v(" "),"POST"==e.CONFIG_FEED.custnotify.type?t("textarea",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:e.CONFIG_FEED.custnotify.data,expression:"CONFIG_FEED.custnotify.data",modifiers:{lazy:!0,trim:!0}}],staticClass:"editor_textarea editor_textarea--mini emargin--top",attrs:{placeholder:'使用 $title$ 代表通知标题,$body$ 代表通知内容,$url$ 代表附加链接。比如:\n{\n "text": `$title$`,\n "desp": `$body$\\n\\n附加链接: $url$`\n}\n具体格式及使用参数,根据自定义通知的 API 说明进行调整(通知内容尽量使用反引号`包括)'},domProps:{value:e.CONFIG_FEED.custnotify.data},on:{change:function(t){e.$set(e.CONFIG_FEED.custnotify,"data",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}):e._e(),e._v(" "),t("button",{staticClass:"elecBtn elecBtn--stlong",on:{click:function(t){return e.custnotifySave()}}},[e._v(e._s(e.$t("save")))])],1),e._v(" "),t("div",{staticClass:"setting--notify"},[t("label",{staticClass:"setting_label"},[e._v("通知触发脚本:")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.CONFIG_FEED.runjs}}),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:e.CONFIG_FEED.runjs.list,expression:"CONFIG_FEED.runjs.list",modifiers:{lazy:!0,trim:!0}}],staticClass:"setting_input",attrs:{name:"runjs",placeholder:"notify.js, test.js(多个脚本使用英文逗号进行分隔,支持远程链接)"},domProps:{value:e.CONFIG_FEED.runjs.list},on:{change:function(t){e.$set(e.CONFIG_FEED.runjs,"list",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:function(t){return e.notifyjsSave()}}},[e._v(e._s(e.$t("save")))])],1),e._v(" "),t("div",{staticClass:"setting--notify"},[t("label",{staticClass:"setting_label setting_label--flex"},[t("span",[e._v("当通知内容长度超过")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.number",value:e.CONFIG_FEED.maxbLength,expression:"CONFIG_FEED.maxbLength",modifiers:{number:!0}}],staticClass:"setting_input setting_input--number",attrs:{type:"number",name:"maxbLength",placeholder:"0: 不分段"},domProps:{value:e.CONFIG_FEED.maxbLength},on:{input:function(t){t.target.composing||e.$set(e.CONFIG_FEED,"maxbLength",e._n(t.target.value))},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("span",[e._v("时,分段发送")])]),e._v(" "),t("label",{staticClass:"setting_label setting_label--flex"},[t("span",[e._v("是否在前端网页显示通知:")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.CONFIG_FEED.webmessage}})],1),e._v(" "),t("label",{staticClass:"setting_label setting_label--flex",attrs:{title:"默认通知内容包括:定时任务开始与停止,脚本运行达到指定次数等"}},[t("span",[e._v("是否开启默认通知:")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.CONFIG_FEED}})],1),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:function(t){return e.feedOp()}}},[e._v(e._s(e.$t("save")))])])]),e._v(" "),t("div",{staticClass:"setting",class:{"setting--collapsed":e.collapse.other},on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.mergeSave()):null}}},[t("h4",{staticClass:"setting_title"},[t("sapn",{staticClass:"title_main"},[e._v(e._s(e.$ta("default","notify","setting_of")))]),e._v(" "),t("span",{staticClass:"title_collapse",class:{"title_collapse--collapsed":e.collapse.other},on:{click:function(t){e.collapse.other=!e.collapse.other}}})],1),e._v(" "),t("div",{staticClass:"setting setting--other"},[t("div",{staticClass:"eflex eflex--wrap w100"},[t("span",{staticClass:"tip"},[e._v("默认通知内容包括:定时任务开始与停止,脚本运行达到指定次数等")]),e._v(" "),t("label",{staticClass:"setting_label setting_label--flex",attrs:{title:"FEED/RSS 包含所有通知内容"}},[e._v("是否输出 "),t("a",{attrs:{href:"/feed",target:"elecV2PFeed"}},[e._v("FEED")]),e._v(":\n "),t("checkbox",{attrs:{oCheck:e.CONFIG_FEED.rss}})],1),e._v(" "),t("button",{staticClass:"elecBtn elecBtn--wave",on:{click:function(t){return e.feedClear()}}},[e._v("清空 FEED 内容")])]),e._v(" "),t("div",{staticClass:"w100"},[t("div",{staticClass:"setting setting--inline"},[t("label",{staticClass:"setting_label setting_label--flex"},[t("span",{staticClass:"setting_label"},[e._v("是否合并默认通知")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.CONFIG_FEED.merge}})],1),e._v(" "),t("div",[t("label",{staticClass:"setting_label"},[e._v("合并时间(秒):")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.number",value:e.CONFIG_FEED.merge.gaptime,expression:"CONFIG_FEED.merge.gaptime",modifiers:{number:!0}}],staticClass:"setting_input setting_input--number",attrs:{type:"number",name:"mergetime"},domProps:{value:e.CONFIG_FEED.merge.gaptime},on:{input:function(t){t.target.composing||e.$set(e.CONFIG_FEED.merge,"gaptime",e._n(t.target.value))},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("div",[t("label",{staticClass:"setting_label"},[e._v("合并逻辑:")]),e._v(" "),t("span",{staticClass:"setting_andor",on:{click:function(t){e.CONFIG_FEED.merge.andor=!e.CONFIG_FEED.merge.andor}}},[e._v(e._s(e.CONFIG_FEED.merge.andor?"AND":"OR"))])]),e._v(" "),t("div",[t("label",{staticClass:"setting_label"},[e._v("合并条数:")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.number",value:e.CONFIG_FEED.merge.number,expression:"CONFIG_FEED.merge.number",modifiers:{number:!0}}],staticClass:"setting_input setting_input--number",attrs:{type:"number",name:"mergenum"},domProps:{value:e.CONFIG_FEED.merge.number},on:{input:function(t){t.target.composing||e.$set(e.CONFIG_FEED.merge,"number",e._n(t.target.value))},blur:function(t){return e.$forceUpdate()}}})])]),e._v(" "),t("i",{staticClass:"tip tip--small"},[e._v("当前设置表示:至少等 "+e._s(e.CONFIG_FEED.merge.gaptime)+" 秒 "+e._s(e.CONFIG_FEED.merge.andor?"且":"或")+" 共有 "+e._s(e.CONFIG_FEED.merge.number)+" 条通知时合并发送(此设置对脚本内的通知函数无效,即脚本通知还是单独发送)")])])]),e._v(" "),t("button",{staticClass:"elecBtn elecBtn--stlong",on:{click:function(t){return e.mergeSave()}}},[e._v(e._s(e.$t("save")))])]),e._v(" "),t("div",{staticClass:"setting setting--vflex",class:{"setting--collapsed":e.collapse.runjs},on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.runjsSave()):null}}},[t("h4",{staticClass:"setting_title"},[t("sapn",{staticClass:"title_main"},[e._v(e._s(e.$ta("script","run","setting_of")))]),e._v(" "),t("span",{staticClass:"title_collapse",class:{"title_collapse--collapsed":e.collapse.runjs},on:{click:function(t){e.collapse.runjs=!e.collapse.runjs}}})],1),e._v(" "),t("div",{staticClass:"setting--other"},[t("div",{staticClass:"eflex eflex--wrap w100"},[t("div",[t("label",{attrs:{title:"0 ms 表示不设定超时时间"}},[e._v("TIMEOUT(ms): ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.number",value:e.CONFIG_RUNJS.timeout,expression:"CONFIG_RUNJS.timeout",modifiers:{number:!0}}],staticClass:"setting_input setting_input--number",attrs:{type:"number",placeholder:"0:不限制"},domProps:{value:e.CONFIG_RUNJS.timeout},on:{input:function(t){t.target.composing||e.$set(e.CONFIG_RUNJS,"timeout",e._n(t.target.value))},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("div",[t("label",{attrs:{title:"0 秒表示有则不更新"}},[e._v("远程脚本更新最低时间间隔(秒):")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.number",value:e.CONFIG_RUNJS.intervals,expression:"CONFIG_RUNJS.intervals",modifiers:{number:!0}}],staticClass:"setting_input setting_input--number",attrs:{type:"number",placeholder:"0:有则不更新",name:"intervals"},domProps:{value:e.CONFIG_RUNJS.intervals},on:{input:function(t){t.target.composing||e.$set(e.CONFIG_RUNJS,"intervals",e._n(t.target.value))},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("div",[t("label",{attrs:{title:"0 次表示不通知"}},[e._v("每运行 ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.number",value:e.CONFIG_RUNJS.numtofeed,expression:"CONFIG_RUNJS.numtofeed",modifiers:{number:!0}}],staticClass:"setting_input setting_input--number",attrs:{type:"number",placeholder:"0:不通知",name:"numtofeed"},domProps:{value:e.CONFIG_RUNJS.numtofeed},on:{input:function(t){t.target.composing||e.$set(e.CONFIG_RUNJS,"numtofeed",e._n(t.target.value))},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("label",[e._v(" 次, 添加一个默认通知")])])]),e._v(" "),t("i",{staticClass:"tip tip--small"},[e._v("0 ms: 不设定超过时间,由 $done 控制返回, 0 秒: 表示如果有则不更新, 0 次: 表示不通知")]),e._v(" "),t("div",{staticClass:"eflex eflex--wrap w100"},[t("div",{staticClass:"eflex"},[t("label",[e._v("保存日志")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.CONFIG_RUNJS.jslogfile,expression:"CONFIG_RUNJS.jslogfile"}],staticClass:"echeckbox",attrs:{type:"checkbox",name:"jslogs"},domProps:{checked:Array.isArray(e.CONFIG_RUNJS.jslogfile)?e._i(e.CONFIG_RUNJS.jslogfile,null)>-1:e.CONFIG_RUNJS.jslogfile},on:{change:function(t){var s=e.CONFIG_RUNJS.jslogfile,i=t.target,n=!!i.checked;if(Array.isArray(s)){var a=e._i(s,null);i.checked?a<0&&e.$set(e.CONFIG_RUNJS,"jslogfile",s.concat([null])):a>-1&&e.$set(e.CONFIG_RUNJS,"jslogfile",s.slice(0,a).concat(s.slice(a+1)))}else e.$set(e.CONFIG_RUNJS,"jslogfile",n)}}})]),e._v(" "),t("div",{staticClass:"eflex"},[t("label",{attrs:{title:"打印并保存脚本运行时所发送的网络请求 url"}},[e._v("保存网络请求 URL 到日志中")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.CONFIG_RUNJS.eaxioslog,expression:"CONFIG_RUNJS.eaxioslog"}],staticClass:"echeckbox",attrs:{type:"checkbox",name:"eaxioslog"},domProps:{checked:Array.isArray(e.CONFIG_RUNJS.eaxioslog)?e._i(e.CONFIG_RUNJS.eaxioslog,null)>-1:e.CONFIG_RUNJS.eaxioslog},on:{change:function(t){var s=e.CONFIG_RUNJS.eaxioslog,i=t.target,n=!!i.checked;if(Array.isArray(s)){var a=e._i(s,null);i.checked?a<0&&e.$set(e.CONFIG_RUNJS,"eaxioslog",s.concat([null])):a>-1&&e.$set(e.CONFIG_RUNJS,"eaxioslog",s.slice(0,a).concat(s.slice(a+1)))}else e.$set(e.CONFIG_RUNJS,"eaxioslog",n)}}})]),e._v(" "),t("div",{staticClass:"eflex"},[t("label",[e._v("使用网络请求相关设置中的代理(如有)")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.CONFIG_RUNJS.proxy,expression:"CONFIG_RUNJS.proxy"}],staticClass:"echeckbox",attrs:{type:"checkbox",name:"runjsproxy"},domProps:{checked:Array.isArray(e.CONFIG_RUNJS.proxy)?e._i(e.CONFIG_RUNJS.proxy,null)>-1:e.CONFIG_RUNJS.proxy},on:{change:function(t){var s=e.CONFIG_RUNJS.proxy,i=t.target,n=!!i.checked;if(Array.isArray(s)){var a=e._i(s,null);i.checked?a<0&&e.$set(e.CONFIG_RUNJS,"proxy",s.concat([null])):a>-1&&e.$set(e.CONFIG_RUNJS,"proxy",s.slice(0,a).concat(s.slice(a+1)))}else e.$set(e.CONFIG_RUNJS,"proxy",n)}}})])]),e._v(" "),t("div",{staticClass:"setting setting--inline"},[t("div",{staticClass:"eflex"},[t("label",{staticClass:"w120",attrs:{title:"白名单脚本不显示网络请求 url"}},[e._v("白名单脚本")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.CONFIG_RUNJS.white}})],1),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:e.jswhitelist,expression:"jswhitelist",modifiers:{lazy:!0,trim:!0}}],staticClass:"setting_input setting_input--middle",attrs:{placeholder:"完整的脚本文件名,以英文逗号进行分隔,比如: test.js,softupdate.js",title:"远程脚本只需填写文件名部分。本地次级目录文件需带目录填写"},domProps:{value:e.jswhitelist},on:{change:function(t){e.jswhitelist=t.target.value.trim()},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("span",{staticClass:"tip"},[e._v("该名单脚本内所有网络请求直接放行,不做屏蔽检测")])])]),t("button",{staticClass:"elecBtn elecBtn--stlong",on:{click:function(t){return e.runjsSave()}}},[e._v(e._s(e.$t("save")))])]),e._v(" "),t("eAxios",{attrs:{config:e.CONFIG_Axios,uagent:e.uagent}}),e._v(" "),t("webui",e._g({attrs:{menunav:e.webUI.nav,theme:e.webUI.theme,logo:e.webUI.logo}},e.$listeners)),e._v(" "),t("security",{attrs:{config:e.CONFIG_SECURITY}}),e._v(" "),t("env",{attrs:{config:e.CONFIG_env}}),e._v(" "),t("div",{staticClass:"setting setting--init",class:{"setting--collapsed":e.collapse.init}},[t("h4",{staticClass:"setting_title"},[t("sapn",{staticClass:"title_main",attrs:{title:"重启后生效"}},[e._v("初始化相关设置")]),e._v(" "),t("span",{staticClass:"title_collapse",class:{"title_collapse--collapsed":e.collapse.init},on:{click:function(t){e.collapse.init=!e.collapse.init}}})],1),e._v(" "),t("div",{staticClass:"setting setting--inline",on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.initSave()):null}}},[t("div",{staticClass:"eflex"},[t("label",{staticClass:"setting_label"},[e._v("启动时检测新版本:")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.CONFIG_init,oKey:"checkupdate"}})],1),e._v(" "),t("div",{staticClass:"eflex eflex_grow1 emargin--d5em"},[t("label",{staticClass:"setting_label",attrs:{title:"在 elecV2P 启动时执行的脚本, 可用于配置基础执行环境,或发送启动通知等"}},[e._v("启动时运行脚本:")]),e._v(" "),t("checkbox",{staticClass:"emargin--right",attrs:{oCheck:e.CONFIG_init,oKey:"runjsenable"}}),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:e.CONFIG_init.runjs,expression:"CONFIG_init.runjs",modifiers:{lazy:!0,trim:!0}}],staticClass:"elecTable_input",attrs:{name:"init",placeholder:"python-install.js, feed.js, process.env.js(多个脚本请使用英文逗号进行分隔)"},domProps:{value:e.CONFIG_init.runjs},on:{change:function(t){e.$set(e.CONFIG_init,"runjs",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})],1),e._v(" "),t("button",{staticClass:"elecBtn emargin--d5em",on:{click:function(t){return e.initSave()}}},[e._v(e._s(e.$t("save")))])]),e._v(" "),t("div",{staticClass:"setting setting--inline",on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.webUIPortSave()):null}}},[t("label",{staticClass:"setting_label"},[e._v("webUI 主界面端口:")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.number",value:e.webUI.port,expression:"webUI.port",modifiers:{number:!0}}],staticClass:"setting_input setting_input--number",attrs:{type:"number",name:"webuiport",placeholder:"80"},domProps:{value:e.webUI.port},on:{input:function(t){t.target.composing||e.$set(e.webUI,"port",e._n(t.target.value))},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("label",{staticClass:"setting_label setting_label--flex",attrs:{title:"是否使用 https 访问"}},[t("span",[e._v("TLS:")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.webUI.tls}})],1),e._v(" "),t("label",{staticClass:"setting_label setting_label--flex",attrs:{title:"TLS 证书颁发对象,IP 或 域名"}},[t("span",[e._v("HOST:")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.webUI.tls.host,expression:"webUI.tls.host"}],staticClass:"setting_input w220",attrs:{name:"tls_host",placeholder:"IP 或 域名"},domProps:{value:e.webUI.tls.host},on:{input:function(t){t.target.composing||e.$set(e.webUI.tls,"host",t.target.value)}}})]),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:function(t){return e.webUIPortSave()}}},[e._v(e._s(e.$t("save")))])]),e._v(" "),t("div",{staticClass:"setting setting--inline",on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.anyproxySave()):null}}},[t("label",{staticClass:"setting_label"},[e._v("ANYPROXY 设置:")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.anyproxy,title:"启动时 关闭/打开"}}),e._v(" "),t("label",{staticClass:"setting_label setting_label--flex"},[t("span",[e._v("代理端口:")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.number",value:e.anyproxy.port,expression:"anyproxy.port",modifiers:{number:!0}}],staticClass:"setting_input setting_input--number",attrs:{type:"number",name:"anyport",placeholder:"8001"},domProps:{value:e.anyproxy.port},on:{input:function(t){t.target.composing||e.$set(e.anyproxy,"port",e._n(t.target.value))},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("label",{staticClass:"setting_label setting_label--flex"},[t("span",[e._v("网络请求查看端口:")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.number",value:e.anyproxy.webPort,expression:"anyproxy.webPort",modifiers:{number:!0}}],staticClass:"setting_input setting_input--number",attrs:{type:"number",name:"anywebport",placeholder:"8002"},domProps:{value:e.anyproxy.webPort},on:{input:function(t){t.target.composing||e.$set(e.anyproxy,"webPort",e._n(t.target.value))},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:e.anyproxySave}},[e._v(e._s(e.$t("save")))])],1),e._v(" "),t("div",{staticClass:"setting setting--config",on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.pathSave()):null}}},[t("label",{staticClass:"title_inline",attrs:{title:"仅可在启动时通过 env.CONFIG 更改"}},[t("span",{staticClass:"elabel_text"},[e._v("当前配置文件")]),e._v(" "),t("input",{staticClass:"emargin elecTable_input wp50 minw320",attrs:{disabled:""},domProps:{value:e.CONFIG_Path.config}})]),e._v(" "),t("div",{staticClass:"eflex eflex--wrap"},[t("label",{staticClass:"w100"},[t("span",{staticClass:"elabel_text",attrs:{title:"当前使用目录:"+e.CONFIG_Path.lists_final}},[e._v("规则任务列表等保存目录")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.CONFIG_Path.lists,expression:"CONFIG_Path.lists"}],staticClass:"elecTable_input wp50 minw320 emargin",attrs:{placeholder:e.CONFIG_Path.lists_final},domProps:{value:e.CONFIG_Path.lists},on:{input:function(t){t.target.composing||e.$set(e.CONFIG_Path,"lists",t.target.value)}}})]),e._v(" "),t("label",{staticClass:"w100"},[t("span",{staticClass:"elabel_text",attrs:{title:"当前使用目录:"+e.CONFIG_Path.script_final}},[e._v("脚本文件保存目录")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.CONFIG_Path.script,expression:"CONFIG_Path.script"}],staticClass:"elecTable_input wp50 minw320 emargin",attrs:{placeholder:e.CONFIG_Path.script_final},domProps:{value:e.CONFIG_Path.script},on:{input:function(t){t.target.composing||e.$set(e.CONFIG_Path,"script",t.target.value)}}})]),e._v(" "),t("label",{staticClass:"w100"},[t("span",{staticClass:"elabel_text",attrs:{title:"当前使用目录:"+e.CONFIG_Path.store_final}},[e._v("store 常量保存目录")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.CONFIG_Path.store,expression:"CONFIG_Path.store"}],staticClass:"elecTable_input wp50 minw320 emargin",attrs:{placeholder:e.CONFIG_Path.store_final},domProps:{value:e.CONFIG_Path.store},on:{input:function(t){t.target.composing||e.$set(e.CONFIG_Path,"store",t.target.value)}}})]),e._v(" "),t("label",{staticClass:"w100"},[t("span",{staticClass:"elabel_text",attrs:{title:"当前使用目录:"+e.CONFIG_Path.shell_final}},[e._v("shell 指令默认执行目录")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.CONFIG_Path.shell,expression:"CONFIG_Path.shell"}],staticClass:"elecTable_input wp50 minw320 emargin",attrs:{placeholder:e.CONFIG_Path.shell_final},domProps:{value:e.CONFIG_Path.shell},on:{input:function(t){t.target.composing||e.$set(e.CONFIG_Path,"shell",t.target.value)}}})]),e._v(" "),t("button",{staticClass:"elecBtn elecBtn--stlong emargin--d5em",on:{click:function(t){return e.pathSave()}}},[e._v(e._s(e.$t("save")))])])]),e._v(" "),t("i",{staticClass:"tip"},[e._v("以上设置将在 elecV2P 重启后正式应用")]),e._v(" "),t("div",{staticClass:"setting setting--inline"},[t("button",{staticClass:"emargin elecBtn elecBtn--check w220",on:{click:function(t){return e.updateCheck()}}},[e._v("检测更新 elecV2P")]),e._v(" "),t("button",{staticClass:"emargin elecBtn greenbk w220",attrs:{title:"请确认已保存好当前规则及任务列表"},on:{click:function(t){return e.evRestart()}}},[e._v(e._s(e.$t("restart"))+" elecV2P")]),e._v(" "),t("button",{staticClass:"emargin elecBtn elecBtn--clear w220",attrs:{title:"如只想关闭 ANYPROXY,可在首页双击 ANRPROXY 端口"},on:{click:function(t){return e.evStop()}}},[e._v(e._s(e.$t("stop"))+" elecV2P")]),e._v(" "),t("button",{staticClass:"emargin elecBtn elecBtn--file",on:{click:function(t){return e.configImport()}}},[e._v("导入配置文件")]),e._v(" "),t("button",{staticClass:"emargin elecBtn",attrs:{title:"确保当前页面 WEBHOOK TOKEN 是和服务器匹配的"},on:{click:function(t){return e.configExport()}}},[e._v("导出当前配置")])])])],1),e._v(" "),e._m(2),e._v(" "),e.bShowMinishell?t("minishell",{tag:"div"}):e._e()],1)};Nr._withStripped=!0;var Pr=function(){var e=this,t=e._self._c;return t("div",{staticClass:"shell",class:{mini:e.bIsHide}},[t("span",{staticClass:"shell_hide",class:{"shell_hide--close":!e.$wsrecv.connected},on:{click:function(t){e.bIsHide=!e.bIsHide}}},[e._v(e._s(e.subnum))]),e._v(" "),e.bIsHide?e._e():t("div",{staticClass:"shelllogs",on:{click:function(t){e.autoScroll=!1}}},[t("div",{staticClass:"shell_status"},[t("span",{staticClass:"shell_status_item"},[e._v("CLIENTS: "+e._s(e.status.clients))]),e._v(" "),t("span",{staticClass:"shell_status_item"},[e._v("RSS: "+e._s(e.status.rss))]),e._v(" "),t("span",{directives:[{name:"show",rawName:"v-show",value:e.status.rtimes,expression:"status.rtimes"}],staticClass:"shell_status_item"},[e._v("JSRUNTS: "+e._s(e.status.rtimes))])]),e._v(" "),e._l(e.logs,(function(s){return t("span",{staticClass:"loginfo_item",domProps:{innerHTML:e._s(e.logHtml(s))}})}))],2),e._v(" "),e.bIsHide?e._e():t("ul",{staticClass:"shellsub"},e._l(e.subprocess,(function(s,i){return t("li",{key:i,staticClass:"eflex w100 shellsub_item"},[t("span",{staticClass:"shellsub_command",attrs:{title:i}},[e._v(e._s(e.subCommandAlign(s.command+" %")))]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:s.subcommand,expression:"process.subcommand"}],staticClass:"shellsub_input",attrs:{type:"text"},domProps:{value:s.subcommand},on:{keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.preventDefault(),t.stopPropagation(),t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.sendToSub(i))},keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.preventDefault(),t.stopPropagation(),t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.hiupdownSub(i,!0))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.preventDefault(),t.stopPropagation(),t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.hiupdownSub(i))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.preventDefault(),t.stopPropagation(),t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:void(s.subcommand=""))}],input:function(t){t.target.composing||e.$set(s,"subcommand",t.target.value)}}}),e._v(" "),t("span",{staticClass:"shellsub_close",on:{click:function(t){return e.subProcessExit(i)}}},[e._v("X")])])})),0),e._v(" "),e.bIsHide?e._e():t("div",{staticClass:"shellcommand",on:{click:function(t){e.autoScroll=!0}}},[t("textarea",{directives:[{name:"model",rawName:"v-model",value:e.fullcommand,expression:"fullcommand"}],staticClass:"shellcommand_input",domProps:{value:e.fullcommand},on:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.preventDefault(),t.stopPropagation(),t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.send.apply(null,arguments))},function(t){return(t.type.indexOf("key")||76===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),t.shiftKey||t.altKey||t.metaKey?null:void(e.logs=[])):null},function(t){return t.type.indexOf("key")||36===t.keyCode?(t.preventDefault(),t.stopPropagation(),t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.moveCur(0,t)):null},function(t){return(t.type.indexOf("key")||65===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),t.shiftKey||t.altKey||t.metaKey?null:e.moveCur(0,t)):null},function(t){return(t.type.indexOf("key")||69===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),t.shiftKey||t.altKey||t.metaKey?null:e.moveCur(-1,t)):null}],keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.preventDefault(),t.stopPropagation(),t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.hiupdown(!0))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.preventDefault(),t.stopPropagation(),t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.hiupdown())},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.preventDefault(),t.stopPropagation(),t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:void(e.command=""))}],input:function(t){t.target.composing||(e.fullcommand=t.target.value)}}})])])};function Ar(e=""){switch(e){case"reload":case"?reload":case"refresh":location.reload(!0);break;default:e?/^#/.test(e)?location.hash=e:window.open(e,"elecV2Ptab","noreferrer"):console.debug("no url to open")}}function Ir(e,t=160,s=100){let i=e.pageX,n=e.pageY;return e.pageX+t>document.body.clientWidth&&(i-=t),e.pageY+s>document.body.clientHeight&&(n-=s),[i,n]}Pr._withStripped=!0;const Rr=new Map,Dr=new Map;Dr.set("082bc4ee40bfef100f79579dc780dff7",{name:"elecV2",homepage:"https://github.com/elecV2"}),Dr.set("cd2458b5e43827ee9a2009b56f29ffd5",{name:"Public test",homepage:"https://t.me/elecV2"}),Dr.set("b9b2e3354b6520261c1b5c375dc2bf74",{name:"Oreomeow",homepage:"https://github.com/Oreomeow"});let Fr=localStorage.getItem("sponsors");if(Fr)try{JSON.parse(Za(Fr,"elecV2P_sponsors")).forEach((e=>{Dr.set(e,Object.create(null))}))}catch(e){console.debug("parse localStorage sponsors",e)}Rr.set("sponsors",Dr),Rr.set("bChecked",localStorage.getItem("bcheck")===(new Date).getDate().toString()),Dr.has(localStorage.getItem("userid"))&&Rr.set("bSponsor",!0);const Lr={get:e=>localStorage.getItem(e),set:(e,t)=>localStorage.setItem(e,t),hasCache:e=>Rr.has(e),getCache:e=>Rr.get(e),setCache:(e,t)=>Rr.set(e,t),deleteCache:e=>Rr.delete(e)};function Hr(e){let t=document.querySelector(e);t&&(t.scrollTop=t.scrollHeight)}function Ur(e){let t=document.querySelector(e);t&&t.scrollIntoView()}function Mr(e){let t=document.querySelector(e);t&&t.focus()}function Br(e,t="elecV2P.json",s="application/json"){e=/json/.test(s)?JSON.stringify(e,null,2):String(e);const i=new Blob([e],{type:s});let n=(window.URL||window.webkitURL).createObjectURL(i),a=document.createElement("a");a.download=t,a.href=n,a.click()}function zr(e,t=""){fetch(e).then((s=>{if(!t)try{const e=s.headers.get("Content-Disposition").split(";");t=e[1].split("=")[1]}catch(e){console.error("fail to get filename",e)}return s.blob().then((s=>{let i=document.createElement("a");i.href=URL.createObjectURL(s),i.download=t||e.split("/").pop(),i.click()}))}))}function Vr(e="",t=".evscript"){if(!e)return void console.log("some code are expect");document.querySelector(t)&&document.querySelector(t).remove();let s=document.createElement("script");s.setAttribute("type","text/javascript"),s.setAttribute("defer","defer"),s.className="evscript",s.innerHTML=e,document.head.appendChild(s)}function Gr(e="",t=".evtheme"){if(!e)return void console.log("some style contexts are expect");document.querySelector(t)&&document.querySelector(t).remove();let s=document.createElement("style");s.className="evtheme",s.innerHTML=e,document.head.appendChild(s)}function Kr(e="",t=""){if(!e)return void console.log("a meta name is expect");let s=document.querySelector(`meta[name=${e}]`),i=null;s?i=s:(i=document.createElement("meta"),i.name=e),i.content=t,!s&&document.head.appendChild(i)}function qr(e="standalone"){return matchMedia(`(display-mode: ${e})`).matches||navigator.standalone||document.referrer.includes("android-app://")}function Jr(e){document.querySelector(e)&&document.querySelector(e).remove()}function Wr(e=""){let t=document.querySelector(".copyinput");t&&"INPUT"===t.nodeName||(t=document.createElement("input"),t.className="copyinput",t.style.position="fixed",t.style.top="-6px",t.style.height="0",t.style.border="none",document.body.appendChild(t)),t.value=e,t.focus(),t.select(),document.execCommand("copy"),t.blur()}function Yr(e){return navigator.clipboard.writeText(e)}function Xr({accept:e="*",type:t="text",multiple:s=!1}={}){let i=document.createElement("input");return i.type="file",i.accept=e,s&&(i.multiple=!0),new Promise(((e,s)=>{i.onchange=i=>{let n=i.target.files[0];if(n)if(console.debug("get file",n.name,n.type,n.size),"file"===t)e(n);else{let t=new FileReader;t.readAsText(n,"UTF-8"),t.onload=t=>{e({name:n.name,type:n.type,size:n.size,content:t.target.result})}}else s("请先选择文件")},i.click()}))}function Zr(){return navigator.userAgent||"Mozilla/5.0 (Linux; U; elecV2P; x64) ePhone Super Max Plus++"}function Qr(e=""){return getComputedStyle(document.querySelector("#app")).getPropertyValue(e).trim()}function eo(e=""){document.execCommand("insertText",!1,e)}const to=new Map;function so(e="",t="",s=3){if(!e||!t)return void to.clear();32!==e.length&&(e=Wa(t,32));const i=e+t+s;if(to.has(i))return to.get(i);let n="";switch(s){case 4:n=function(e=""){const t=document.createElement("canvas");t.width=180,t.height=180;const s=t.getContext("2d"),i=e.match(/\w{2}/g).map((e=>parseInt(e,16)));s.fillStyle=`rgba(${i[0]}, ${i[4]}, ${i[8]}, ${i[12]/380+.3})`,s.fillRect(0,0,t.width,t.height),s.lineCap="round",s.lineJoin="round";const n=i[0]%4,a=i[1]%10+10;switch(s.beginPath(),s.lineWidth=i[2]%15+5,s.strokeStyle=`rgba(${i[0]}, ${i[1]}, ${i[2]}, ${i[3]/380+.3})`,s.fillStyle=`rgba(${i[0]}, ${i[1]}, ${i[2]}, ${i[3]/380+.3})`,n){case 0:s.strokeRect(50-a,60-a,2*a,2*a);break;case 1:s.fillRect(50-a,60-a,2*a,2*a);break;case 2:s.arc(50,60,a,0,2*Math.PI),s.stroke();break;default:s.arc(50,60,a,0,2*Math.PI),s.fill()}const r=i[4]%4,o=i[5]%10+10;switch(s.beginPath(),s.lineWidth=i[6]%15+5,s.strokeStyle=`rgba(${i[4]}, ${i[5]}, ${i[6]}, ${i[7]/380+.3})`,s.fillStyle=`rgba(${i[4]}, ${i[5]}, ${i[6]}, ${i[7]/380+.3})`,r){case 0:s.strokeRect(130-o,60-o,2*o,2*o);break;case 1:s.fillRect(130-o,60-o,2*o,2*o);break;case 2:s.arc(130,60,o,0,2*Math.PI),s.stroke();break;default:s.arc(130,60,o,0,2*Math.PI),s.fill()}return s.beginPath(),s.moveTo(90,(a+o)/2+60),s.quadraticCurveTo(i[8],i[9],90,i[10]%15+105),s.lineWidth=i[11]%15+5,s.strokeStyle=`rgba(${i[8]}, ${i[9]}, ${i[10]}, ${i[11]/380+.3})`,s.stroke(),s.beginPath(),s.moveTo(50,130),s.quadraticCurveTo(i[12],i[13]%50+130,130,130),s.lineWidth=i[14]%15+5,s.strokeStyle=`rgba(${i[12]}, ${i[13]}, ${i[14]}, ${i[15]/380+.3})`,s.stroke(),t.toDataURL()}(e);break;case 3:n=function(e="",t=""){const s=document.createElement("canvas");s.width=180,s.height=180;const i=s.getContext("2d"),n=e.match(/\w{2}/g).map((e=>parseInt(e,16))),a=i.createRadialGradient(90,90,0,90,90,128);a.addColorStop(0,`rgba(${n[0]}, ${n[1]}, ${n[2]}, ${n[3]/380+.3})`),a.addColorStop(.25,`rgba(${n[4]}, ${n[5]}, ${n[6]}, ${n[7]/380+.3})`),a.addColorStop(.5,`rgba(${n[8]}, ${n[9]}, ${n[10]}, ${n[11]/380+.3})`),a.addColorStop(.75,`rgba(${n[12]}, ${n[13]}, ${n[14]}, ${n[15]/380+.3})`),a.addColorStop(1,`rgba(${n[12]}, ${n[13]}, ${n[14]}, ${n[15]/380+.3})`),i.beginPath(),i.fillStyle=a,i.arc(90,90,128,0,2*Math.PI),i.fill(),t&&io(t,i);return s.toDataURL()}(e,t);break;case 2:n=function(e="",t=""){const s=document.createElement("canvas");s.width=180,s.height=180;const i=s.getContext("2d");e+=e;let n=0;for(let t=0;t<18;t++){for(let s=0;s<18;s++)i.beginPath(),i.fillStyle="#"+e.slice(n+s,n+s+8),i.arc(10*s+5,10*t+5,5,0,2*Math.PI),i.fill();n++}t&&io(t,i);return s.toDataURL()}(e,t);break;default:n=function(e="",t=""){const s=document.createElement("canvas");s.width=180,s.height=180;const i=s.getContext("2d"),n=e.match(/\w{2}/g).map((e=>parseInt(e,16))),a=[n[0]%120,n[1]%120],r=[n[2]%(180-a[0])+a[0],n[3]%(180-a[1])+a[1]];i.fillStyle=`rgba(${n[0]}, ${n[1]}, ${n[2]}, ${n[3]/380+.3})`,i.fillRect(0,0,r[0],a[1]-2),i.fillStyle=`rgba(${n[4]}, ${n[5]}, ${n[6]}, ${n[7]/380+.3})`,i.fillRect(r[0]+2,0,180-r[0]-2,r[1]),i.fillStyle=`rgba(${n[8]}, ${n[9]}, ${n[10]}, ${n[11]/380+.3})`,i.fillRect(a[0],r[1]+2,180-a[0],180-r[1]-2),i.fillStyle=`rgba(${n[12]}, ${n[13]}, ${n[14]}, ${n[15]/380+.3})`,i.fillRect(0,a[1],a[0]-2,180-a[1]),i.fillStyle=Qr("--main-bk")||`rgba(${n[1]}, ${n[5]}, ${n[9]}, ${n[13]/380+.3})`,i.fillRect(a[0],a[1],r[0]-a[0],r[1]-a[1]),i.fillStyle="#000",i.fillRect(r[0],0,2,r[1]),i.fillRect(a[0],r[1],180-a[0],2),i.fillRect(a[0]-2,a[1],2,180-a[1]),i.fillRect(0,a[1]-2,r[0],2),t&&io(t,i);return s.toDataURL()}(e,t)}return to.set(i,n),n}function io(e="",t){e&&(e.length>1&&(e=e.slice(0,1)),e=e.toUpperCase(),t.beginPath(),t.lineWidth=6,t.textAlign="center",t.textBaseline="middle",t.font="bold 140px "+(Qr("--font-fm")||"system-ui,sans-serif"),t.strokeStyle=Qr("--main-fc")||"#FFFFFF",t.strokeText(e,90,98))}function no(e=""){if("function"!=typeof eval){const e="eval 函数在当前环境下不可用";return console.error(e),e}try{return(0,eval)(e)}catch(e){return console.error("evalRun fail",e),e.message}}function ao(){return document.title}function ro(e="elecV2P"){document.title=e}function oo({ele:e=document.querySelector(".logo_a"),off:t=!0}={}){return t?e.classList.add("logo_a--offline"):e.classList.remove("logo_a--offline")}function lo(e,t=""){return t?document.querySelectorAll(e):document.querySelector(e)}const co={message:Object.create(null),evui:()=>{}};const uo=ka({name:"minishell",data:()=>({logs:[],command:"node -v",cwd:"",bIsHide:!0,status:{clients:0,rss:0,rtimes:0},history:{current:-1,lists:[]},autoScroll:!0,subprocess:Object.create(null),subDelaySend:Object.create(null),tips:"快捷键:\n- esc // 清空当前输入命令\n- ctrl + l // 清空屏幕日志\n- up/down // 上下查找历史执行命令\n- shift + tab // 移动光标到子进程交互输入框(如果存在的话\n- 单击上方日志输出部分,停止自动滚动。单击下方命令输入部分,开启自动滚动\n\n特殊指令:\n- cls/clear // 清空屏幕日志\n- cwd // 获取当前工作目录\n- cd xxx // 更改当前工作目录到xxx\n- docs // 打开 minishell 相关说明文档\n- exit // 最小化 minishell 界面(在子进程交互中输入时表示结束子进程"}),computed:{cwdshow(){return this.cwd?this.cwd.replace(/(\/|\\)$/,"").split(/\\|\//).pop()+"> ":"> "},subnum(){return Object.keys(this.subprocess).length||""},fullcommand:{get(){return this.cwdshow+this.command},set(e){this.command=e.replace(/[^>]*> /,"")}}},created(){this.logs.push(this.tips),this.$wsrecv.add("minishell",(e=>{if(e.data)switch(e.type){case"cwd":this.logs.push("cwd: "+e.data),this.cwd=e.data;break;case"shellinit":this.logs.push("cwd: "+e.data.cwd),this.cwd=e.data.cwd,e.data.subprocess&&(this.subprocess=e.data.subprocess);break;case"subprocessexit":if(this.subDelaySend[e.data]){console.debug("exit subprocess:",e.data),clearTimeout(this.subDelaySend[e.data]),this.subDelaySend[e.data]=null;break}this.subprocess[e.data]?(console.debug("exit subprocess:",e.data,"command:",this.subprocess[e.data].command),this.$delete(this.subprocess,e.data)):console.debug("subprocess: "+e.data+" not exist yet");break;case"subprocessadd":console.debug("run subprocess:",e.data.id,"command:",e.data.command);let{id:t,command:s}=e.data;this.subDelaySend[t]=setTimeout((()=>{this.subDelaySend[t]=null,this.$set(this.subprocess,t,{command:s,history:{current:-1,lists:[]}})}),800);break;case"elecV2Pstatus":this.status.clients=e.data.clients,this.status.rss=e.data.memoryusage.rss;break;case"jsrunstatus":this.status.rtimes=e.data.total;break;default:/\x1b\[H/.test(e.data)?this.logs=[e.data]:/\r|(\x1b\[F)/.test(e.data)?this.logs.splice(-1,1,e.data):this.logs.push(e.data)}else console.debug("minishell recv",e,"expected ms.data")})),this.$wsrecv.connected&&this.$wsrecv.send("shell","init"),setTimeout(Mr,2e3,".shellcommand_input")},watch:{logs(e){this.logBottom()},subprocess(){this.logBottom()}},methods:{logBottom(){this.autoScroll&&(this.autoScroll=!1,setTimeout((()=>{Hr(".shelllogs"),this.autoScroll=!0}),200))},logHtml:Va,send(e){if(!this.$wsrecv.connected)return this.$message.error("websocket 尚未连接"),void this.logs.push(`[${this.$logHead("minishell error")}][${this.$sTime(null,1)}] websocket 尚未连接`);if(!e.ctrlKey&&!e.shiftKey&&this.command){switch(this.command=this.command.trim(),this.command){case"exit":this.bIsHide=!0;break;case"clear":case"CLEAR":case"cls":case"CLS":this.logs.splice(0);break;case"docs":Ar("https://github.com/elecV2/elecV2P-dei/blob/master/docs/Advanced.md");break;default:const e=`${this.$wsrecv.id}_minishell_${this.history.lists.length}`;this.$wsrecv.send("shell",{id:e,type:"main",data:encodeURI(this.command)}),this.logs.push(`[${this.$logHead("minishell notify")}][${this.$sTime(null,1)}] running command: ${this.command}`)}this.history.lists.push(this.command),this.history.current=-1,this.command=""}},sendToSub(e){if(!e)return void this.$message.error("a command id is expected");let t=this.subprocess[e].subcommand;this.subprocess[e]&&t?(this.subprocess[e].subcommand="",this.$wsrecv.send("shell",{id:e,type:"sub",data:encodeURI(t)}),this.subprocess[e].history||(this.subprocess[e].history={lists:[]}),this.subprocess[e].history.lists.push(t),this.subprocess[e].history.current=-1):this.$message.error("请先输入要执行的命令")},subProcessExit(e){this.$wsrecv.send("shell",{id:e,type:"sub",data:"exit"}),this.$delete(this.subprocess,e)},hiupdown(e=!1){0!==this.history.lists.length&&(e?(this.history.current--,this.history.current<0&&(this.history.current=this.history.lists.length-1)):(this.history.current++,this.history.current>=this.history.lists.length&&(this.history.current=0)),this.command=this.history.lists[this.history.current])},hiupdownSub(e,t=!1){let s=this.subprocess[e];s&&s.history&&0!==s.history.lists.length&&(t?(s.history.current--,s.history.current<0&&(s.history.current=s.history.lists.length-1)):(s.history.current++,s.history.current>=s.history.lists.length&&(s.history.current=0)),s.subcommand=s.history.lists[s.history.current])},subCommandAlign:e=>e.length<32?e:Ba(e,32),moveCur(e=0,t){if(0===e){const e=t.target.value.indexOf(">")+2;t.target.setSelectionRange(e,e)}else t.target.setSelectionRange(e,e)}}},Pr,[],!1,null,"007ead95",null).exports;var ho=function(){var e=this,t=e._self._c;return t("div",{staticClass:"setting setting--vflex",class:{"setting--collapsed":e.collapse},on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.eAxiosSave()):null}}},[t("h4",{staticClass:"setting_title"},[t("sapn",{staticClass:"title_main"},[e._v(e._s(e.$ta("web","request","setting_of")))]),e._v(" "),t("span",{staticClass:"title_collapse",class:{"title_collapse--collapsed":e.collapse},on:{click:function(t){e.collapse=!e.collapse}}})],1),e._v(" "),t("div",{directives:[{name:"show",rawName:"v-show",value:!e.collapse,expression:"!collapse"}],staticClass:"w100"},[t("div",{staticClass:"setting setting--inline"},[t("div",[t("label",[e._v("TIMEOUT(ms): ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.number",value:e.config.timeout,expression:"config.timeout",modifiers:{number:!0}}],staticClass:"setting_input setting_input--number",attrs:{type:"number",placeholder:"0:不限制"},domProps:{value:e.config.timeout},on:{input:function(t){t.target.composing||e.$set(e.config,"timeout",e._n(t.target.value))},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("div",{staticClass:"minw320"},[t("label",{attrs:{title:"当 header 中没有 User-Agent 时,使用此 UA"}},[e._v("User-Agent: ")]),e._v(" "),t("select",{directives:[{name:"model",rawName:"v-model",value:e.config.uagent,expression:"config.uagent"}],staticClass:"elecTable_select w220",on:{change:function(t){var s=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(e.config,"uagent",t.target.multiple?s:s[0])}}},e._l(e.ualists,(function(s,i){return t("option",{domProps:{value:i}},[e._v(e._s(s))])})),0),e._v(" "),t("button",{staticClass:"elecBtn",class:{"elecBtn--check":e.bUAManage},on:{click:function(t){e.bUAManage=!e.bUAManage}}},[e._v(e._s(e.$t("manage")))])]),e._v(" "),t("div",[t("label",{attrs:{title:"process.env.NODE_TLS_REJECT_UNAUTHORIZED,建议始终勾选"}},[e._v("REJECT_UNAUTHORIZED: ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.config.reject_unauthorized,expression:"config.reject_unauthorized"}],staticClass:"echeckbox emargin",attrs:{type:"checkbox"},domProps:{checked:Array.isArray(e.config.reject_unauthorized)?e._i(e.config.reject_unauthorized,null)>-1:e.config.reject_unauthorized},on:{change:function(t){var s=e.config.reject_unauthorized,i=t.target,n=!!i.checked;if(Array.isArray(s)){var a=e._i(s,null);i.checked?a<0&&e.$set(e.config,"reject_unauthorized",s.concat([null])):a>-1&&e.$set(e.config,"reject_unauthorized",s.slice(0,a).concat(s.slice(a+1)))}else e.$set(e.config,"reject_unauthorized",n)}}})]),e._v(" "),t("div",{staticClass:"eflex"},[t("label",[e._v("HTTP "+e._s(e.$t("proxy"))+":")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.config.proxy}})],1)]),e._v(" "),t("div",{directives:[{name:"show",rawName:"v-show",value:e.bUAManage,expression:"bUAManage"}],staticClass:"setting setting--inline setting--ua",on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.uaSave()):null}}},[t("table",{staticClass:"elecTable elecTable--ua"},[t("thead",[t("tr",[t("th",{staticClass:"elecTable_th elecTable_th--name"},[e._v(e._s(e.$t("name")))]),e._v(" "),t("th",{staticClass:"elecTable_th minw600"},[e._v(e._s(e.$t("content")))]),e._v(" "),t("th",{staticClass:"elecTable_th minw62"},[e._v(e._s(e.$t("operate_short")))])])]),e._v(" "),t("tbody",e._l(e.uagent,(function(s,i){return t("tr",{key:i},[t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.name,expression:"ua.name",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{placeholder:"chrome 浏览器"},domProps:{value:s.name},on:{input:function(t){t.target.composing||e.$set(s,"name",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.header,expression:"ua.header",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{placeholder:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36"},domProps:{value:s.header},on:{input:function(t){t.target.composing||e.$set(s,"header",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("span",{staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.delete)},on:{click:function(t){return e.uaDelete(i)}}})])])})),0),e._v(" "),t("tfoot",[t("tr",[t("td",{staticClass:"elecTable_td padding0",attrs:{colspan:"3"}},[t("span",{staticClass:"elecTable_addbtn",on:{click:function(t){return e.uaAdd()}}},[e._v(e._s(e.$t("add"))+" UA")]),e._v(" "),t("span",{staticClass:"elecTable_addbtn",on:{click:function(t){return e.uaSave()}}},[e._v(e._s(e.$ta("save","current","list")))])])])])])]),e._v(" "),t("div",{directives:[{name:"show",rawName:"v-show",value:e.config.proxy.enable,expression:"config.proxy.enable"}],staticClass:"setting_proxy"},[t("div",{staticClass:"setting setting--inline"},[t("label",[t("span",[e._v("PORT:")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.number",value:e.config.proxy.port,expression:"config.proxy.port",modifiers:{number:!0}}],staticClass:"setting_input setting_input--number",attrs:{type:"number",placeholder:"8001"},domProps:{value:e.config.proxy.port},on:{input:function(t){t.target.composing||e.$set(e.config.proxy,"port",e._n(t.target.value))},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("label",{staticClass:"wp46"},[t("span",[e._v("HOST:")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.lazy",value:e.config.proxy.host,expression:"config.proxy.host",modifiers:{lazy:!0}}],staticClass:"setting_input",attrs:{placeholder:"可选。如省略表示使用本地代理"},domProps:{value:e.config.proxy.host},on:{change:function(t){return e.$set(e.config.proxy,"host",t.target.value)}}})]),e._v(" "),t("label",[t("span",[e._v("AUTH:")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.isAuth,expression:"isAuth"}],staticClass:"echeckbox",attrs:{type:"checkbox"},domProps:{checked:Array.isArray(e.isAuth)?e._i(e.isAuth,null)>-1:e.isAuth},on:{change:function(t){var s=e.isAuth,i=t.target,n=!!i.checked;if(Array.isArray(s)){var a=e._i(s,null);i.checked?a<0&&(e.isAuth=s.concat([null])):a>-1&&(e.isAuth=s.slice(0,a).concat(s.slice(a+1)))}else e.isAuth=n}}})])]),e._v(" "),e.isAuth?t("div",{staticClass:"setting setting--inline"},[t("label",{staticClass:"eflex mp46"},[t("span",[e._v("USERNAME:")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.lazy",value:e.config.proxy.auth.username,expression:"config.proxy.auth.username",modifiers:{lazy:!0}}],staticClass:"setting_input",domProps:{value:e.config.proxy.auth.username},on:{change:function(t){return e.$set(e.config.proxy.auth,"username",t.target.value)}}})]),e._v(" "),t("label",{staticClass:"eflex mp46"},[t("span",[e._v("PASSWORD:")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.lazy",value:e.config.proxy.auth.password,expression:"config.proxy.auth.password",modifiers:{lazy:!0}}],staticClass:"setting_input",domProps:{value:e.config.proxy.auth.password},on:{change:function(t){return e.$set(e.config.proxy.auth,"password",t.target.value)}}})])]):e._e()]),e._v(" "),t("div",{staticClass:"setting_proxy",attrs:{title:"谨慎选择是否开启,不合理的设置可能会导致正常的网络请求被屏蔽"}},[t("div",{staticClass:"setting setting--inline"},[t("div",{staticClass:"eflex"},[t("label",{staticClass:"minw160",attrs:{title:"可使用 request.token: '你的webhook token' 绕过屏蔽检测"}},[e._v(e._s(e.$t("forbid"))+" URL")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.config.block}})],1),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.lazy",value:e.config.block.regexp,expression:"config.block.regexp",modifiers:{lazy:!0}}],staticClass:"setting_input setting_input--middle",attrs:{placeholder:"匹配内容 比如: abc|123 匹配方式: new RegExp('该内容').test(url)"},domProps:{value:e.config.block.regexp},on:{change:function(t){return e.$set(e.config.block,"regexp",t.target.value)}}}),e._v(" "),t("span",{staticClass:"tip"},[e._v("当网络请求 url 符合此正则表达式时,屏蔽该请求")])]),e._v(" "),t("div",{staticClass:"setting setting--inline"},[t("div",{staticClass:"eflex"},[t("label",{staticClass:"minw160"},[e._v(e._s(e.$t("allowed"))+" URL")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.config.only}})],1),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.lazy",value:e.config.only.regexp,expression:"config.only.regexp",modifiers:{lazy:!0}}],staticClass:"setting_input setting_input--middle",attrs:{placeholder:"匹配内容 其他所有不符合该正则表达式的网络请求将被直接屏蔽掉"},domProps:{value:e.config.only.regexp},on:{change:function(t){return e.$set(e.config.only,"regexp",t.target.value)}}}),e._v(" "),t("span",{staticClass:"tip"},[e._v("开启时,仅允许符合此正则表达式的网络请求通过")])])]),e._v(" "),t("i",{staticClass:"tip tip--small"},[e._v("该部分设置适用于服务器端 文件下载/JS/mock 等模块发起的网络请求。URL 匹配方式: new RegExp('匹配内容').test(url)")]),e._v(" "),t("div",[t("button",{staticClass:"elecBtn elecBtn--stlong",on:{click:function(t){return e.eAxiosSave()}}},[e._v(e._s(e.$t("save")))])])])])};ho._withStripped=!0;const po=ka({name:"eAxios",props:["config","uagent"],data(){return{icon:wa,collapse:this.$uStr.iRandom(0,10)>5,bUAManage:!1}},computed:{ualists(){let e={};for(let t in this.uagent)e[t]=this.uagent[t].name;return e},isAuth:{get(){return Boolean(this.config.proxy&&this.config.proxy.auth)},set(e){e?this.$set(this.config.proxy,"auth",{}):this.$delete(this.config.proxy,"auth")}}},components:{checkbox:mr},methods:{uaDelete(e){this.$message.success("User-Agent:",this.uagent[e].name,"已删除,保存后生效"),this.$delete(this.uagent,e)},uaAdd(){this.$set(this.uagent,this.$uStr.euid(),{name:"我的 UA",header:this.$uApi.getUA()})},uaSave(){const e=this.$message.loading("User-Agent 列表上传更新中...",0);this.$axios.put("/config",{type:"uagent",data:this.uagent}).then((e=>{this.$message.success("设置成功",e.data.message)})).catch((e=>{this.$message.error("设置失败",e.message),console.log(e)})).finally(e)},eAxiosSave(){const e=this.$message.loading("网络请求相关设置保存中...",0);this.$axios.put("/config",{type:"eAxios",data:this.config}).then((e=>{0===e.data.rescode?this.$message.success("网络请求相关设置更改成功",e.data.message):this.$message.error("设置失败",e.data.message)})).catch((e=>{this.$message.error("设置失败",e.message),console.log(e)})).finally(e)}}},ho,[],!1,null,"487a2786",null).exports;var mo=function(){var e=this,t=e._self._c;return t("div",{staticClass:"setting setting--vflex",class:{"setting--collapsed":e.collapse},on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.securitySave()):null}}},[t("h4",{staticClass:"setting_title"},[t("div",{staticClass:"title_main"},[t("span",{attrs:{title:"仅对 webUI 端口有效"}},[e._v(e._s(e.$ta("security","access","setting_of")))]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.config.enable,expression:"config.enable"}],staticClass:"echeckbox emargin",attrs:{type:"checkbox",name:"status",title:"是否开启安全访问"},domProps:{checked:Array.isArray(e.config.enable)?e._i(e.config.enable,null)>-1:e.config.enable},on:{change:function(t){var s=e.config.enable,i=t.target,n=!!i.checked;if(Array.isArray(s)){var a=e._i(s,null);i.checked?a<0&&e.$set(e.config,"enable",s.concat([null])):a>-1&&e.$set(e.config,"enable",s.slice(0,a).concat(s.slice(a+1)))}else e.$set(e.config,"enable",n)}}})]),e._v(" "),t("span",{staticClass:"title_collapse",class:{"title_collapse--collapsed":e.collapse},on:{click:function(t){e.collapse=!e.collapse}}})]),e._v(" "),t("div",{directives:[{name:"show",rawName:"v-show",value:!e.collapse&&e.config.enable,expression:"!collapse && config.enable"}],staticClass:"w100"},[t("div",{staticClass:"radius_bs border emargin"},[t("div",{staticClass:"setting setting--inline"},[t("div",{staticClass:"wp50"},[t("label",{staticClass:"setting_label"},[e._v(e._s(e.$ta("allowed","access"))+" IP("+e._s(e.$t("whitelist"))+"):")]),e._v(" "),t("textarea",{directives:[{name:"model",rawName:"v-model.trim",value:e.whitelist,expression:"whitelist",modifiers:{trim:!0}}],staticClass:"editor_textarea",attrs:{name:"whitelist",placeholder:"127.0.0.1\n192.168.1.101\n182.xxx.x.125\n(仅可设置为 IP 地址)\n(白名单优先级高于黑名单)"},domProps:{value:e.whitelist},on:{input:function(t){t.target.composing||(e.whitelist=t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("div",{staticClass:"wp50"},[t("label",{staticClass:"setting_label"},[e._v(e._s(e.$ta("forbid","access"))+" IP("+e._s(e.$t("blacklist"))+"):")]),e._v(" "),t("textarea",{directives:[{name:"model",rawName:"v-model.trim",value:e.blacklist,expression:"blacklist",modifiers:{trim:!0}}],staticClass:"editor_textarea",attrs:{name:"blacklist",placeholder:"172.20.10.2\n*\n单独星号字符 * 表示屏蔽所有(只允许白名单中的 IP 通过)\n如果设置为 *,请务必先记下 WEBHOOK TOKEN"},domProps:{value:e.blacklist},on:{input:function(t){t.target.composing||(e.blacklist=t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})])]),e._v(" "),t("div",{staticClass:"eflex eflex--wrap w100"},[t("div",{staticClass:"eflex",attrs:{title:"启用后,仅 webhook 接口可访问"}},[t("label",{staticClass:"setting_label"},[e._v("WEBHOOK ONLY")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.config,oKey:"webhook_only",oInit:"false"}})],1),e._v(" "),t("div",{staticClass:"eflex",attrs:{title:"不启用时,webUI 将不可使用授权 cookie 进行访问"}},[t("label",{staticClass:"setting_label"},[e._v(e._s(e.$t("allow"))+" cookie")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.config.cookie}})],1),e._v(" "),t("div",{attrs:{title:"0: 表示不通知"}},[t("label",[e._v(e._s(e.$t("every"))+" ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.number",value:e.config.numtofeed,expression:"config.numtofeed",modifiers:{number:!0}}],staticClass:"setting_input setting_input--number",attrs:{type:"number",name:"numtofeed",placeholder:"0: 不通知"},domProps:{value:e.config.numtofeed},on:{input:function(t){t.target.composing||e.$set(e.config,"numtofeed",e._n(t.target.value))},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("label",[e._v(" "+e._s(e.$ta("times","illegal","access"))+", "+e._s(e.$ta("send","a","notify")))])])])]),e._v(" "),t("div",{staticClass:"setting setting--inline border"},[t("h4",{staticClass:"title_inline"},[t("sapn",{staticClass:"title_main"},[e._v(e._s(e.$ta("temp","access"))+" TOKEN")]),e._v(" "),t("button",{staticClass:"efloat--right elecBtn elecBtn--h32 radius_zero radius-bs--tr greenbk",on:{click:function(t){return e.tokensNew()}}},[e._v(e._s(e.$t("new")))])],1),e._v(" "),t("div",{staticClass:"eflex eflex--wrap w100 margin0"},e._l(e.config.tokens,(function(s,i){return t("div",{directives:[{name:"key",rawName:"v-key",value:i,expression:"hash"}],staticClass:"settoken",class:{"settoken--disabled":!s.enable}},[t("div",{staticClass:"eflex w460 minw320 emargin"},[t("input",{directives:[{name:"model",rawName:"v-model",value:s.token,expression:"token.token"}],staticClass:"elecTable_input h36",attrs:{placeholder:"临时访问 token"},domProps:{value:s.token},on:{input:function(t){t.target.composing||e.$set(s,"token",t.target.value)}}}),e._v(" "),t("span",{staticClass:"icon--op h36",domProps:{innerHTML:e._s(e.icon.sync)},on:{click:function(t){s.token=e.$uStr.UUID()}}})]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:s.path,expression:"token.path"}],staticClass:"elecTable_input w360 minw320 emargin h36",attrs:{placeholder:"允许路径,比如 ^/efss(留空:不限制"},domProps:{value:s.path},on:{input:function(t){t.target.composing||e.$set(s,"path",t.target.value)}}}),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:s.method,expression:"token.method"}],staticClass:"elecTable_input w360 minw320 emargin h36",attrs:{placeholder:"允许方法,比如 GET(留空:不限制"},domProps:{value:s.method},on:{input:function(t){t.target.composing||e.$set(s,"method",t.target.value)}}}),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:s.note,expression:"token.note"}],staticClass:"elecTable_input minw160 emargin h36",attrs:{placeholder:"备注(可省略"},domProps:{value:s.note},on:{input:function(t){t.target.composing||e.$set(s,"note",t.target.value)}}}),e._v(" "),t("span",{staticClass:"minw100",attrs:{title:"已授权访问次数"}},[e._v(e._s(s.times))]),e._v(" "),t("div",{staticClass:"eflex emargin"},[t("checkbox",{attrs:{oCheck:s}}),e._v(" "),t("span",{staticClass:"icon--op h36",attrs:{title:i},domProps:{innerHTML:e._s(e.icon.delete)},on:{click:function(t){return e.$delete(e.config.tokens,i)}}})],1)])})),0)]),e._v(" "),e._m(0)]),e._v(" "),t("button",{directives:[{name:"show",rawName:"v-show",value:!e.collapse,expression:"!collapse"}],staticClass:"elecBtn elecBtn--stlong",on:{click:function(t){return e.securitySave()}}},[e._v(e._s(e.$t("save")))])])};mo._withStripped=!0;const fo=ka({name:"security",props:["config"],data:()=>({icon:wa,collapse:!1}),components:{checkbox:mr},computed:{whitelist:{get(){return this.config.whitelist?this.config.whitelist.join("\n"):""},set(e){e?this.$set(this.config,"whitelist",e.split(/\r|\n|,/).filter((e=>e.trim()))):this.config.whitelist=[]}},blacklist:{get(){return this.config.blacklist?this.config.blacklist.join("\n"):""},set(e){e?this.$set(this.config,"blacklist",e.split(/\r|\n|,/).filter((e=>e.trim()))):this.config.blacklist=[]}}},methods:{tokensNew(){this.$set(this.config.tokens,this.$uStr.euid(),{enable:!0,token:this.$uStr.UUID(),path:"",method:"",note:"",times:0})},securitySave(){if(this.config.webhook_only&&!confirm("启用 仅开放 webhook 接口 后,webUI 等其他所有接口都不可用\n确定继续?"))return;const e=this.$message.loading("安全访问相关设置保存中...",0);this.$axios.put("/config",{type:"security",data:this.config}).then((e=>{0===e.data.rescode?(this.$message.success("安全访问相关设置保存成功"),e.data.resdata&&(this.config.tokens=e.data.resdata)):(this.$message.error("安全访问相关设置保存失败",e.data.message),console.error(e.data))})).catch((e=>{this.$message.error("安全访问相关设置保存失败",e.message),console.log(e)})).finally(e)}}},mo,[function(){var e=this,t=e._self._c;return t("i",{staticClass:"tip emargin"},[t("span",[e._v("更多说明请参考: ")]),e._v(" "),t("a",{attrs:{href:"https://github.com/elecV2/elecV2P-dei/tree/master/docs/Advanced.md",target:"elecV2PDoc"}},[e._v("Advanced.md")])])}],!1,null,"2a6fe729",null).exports;var vo=function(){var e=this,t=e._self._c;return t("div",{staticClass:"setting setting--vflex",class:{"setting--collapsed":e.collapse},on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.webuiSave()):null}}},[t("h4",{staticClass:"setting_title"},[t("sapn",{staticClass:"title_main"},[e._v("webUI "+e._s(e.$t("setting_of")))]),e._v(" "),t("span",{staticClass:"title_collapse",class:{"title_collapse--collapsed":e.collapse},on:{click:function(t){e.collapse=!e.collapse}}})],1),e._v(" "),t("div",{directives:[{name:"show",rawName:"v-show",value:!e.collapse,expression:"!collapse"}],staticClass:"border setting setting--inline"},[t("div",{staticClass:"eflex"},[t("label",{attrs:{title:"左上角显示信息"}},[e._v("自定义 LOGO:")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.logo}})],1),e._v(" "),t("label",{staticClass:"eflex eflex--wrap emargin"},[e._v("图标链接:"),t("input",{directives:[{name:"model",rawName:"v-model",value:e.logo.src,expression:"logo.src"}],staticClass:"elecTable_input logo_src",attrs:{placeholder:"比如 https://x.xx/x.png 或 efss/logo/my.png"},domProps:{value:e.logo.src},on:{input:function(t){t.target.composing||e.$set(e.logo,"src",t.target.value)}}})]),e._v(" "),t("label",{staticClass:"eflex"},[e._v("显示名称:"),t("input",{directives:[{name:"model",rawName:"v-model",value:e.logo.name,expression:"logo.name"}],staticClass:"elecTable_input w120",attrs:{placeholder:"elecV2P"},domProps:{value:e.logo.name},on:{input:function(t){t.target.composing||e.$set(e.logo,"name",t.target.value)}}})]),e._v(" "),t("button",{staticClass:"elecBtn w120",on:{click:function(t){return t.preventDefault(),e.logoSave()}}},[e._v("保存")])]),e._v(" "),t("div",{directives:[{name:"show",rawName:"v-show",value:!e.collapse,expression:"!collapse"}],staticClass:"border setting setting--inline"},[t("h4",{staticClass:"title_inline",attrs:{title:"SETTING/DONATION 暂时不支持隐藏"}},[e._v("左侧导航栏设置")]),e._v(" "),t("ul",{staticClass:"eflex eflex--wrap emargin"},e._l(e.menulist,(function(s,i){return t("li",{key:i,staticClass:"menunav_item"},[t("label",[e._v(e._s(i.toUpperCase())+": 别名")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:s.name,expression:"nav.name"}],staticClass:"emargin--left elecTable_input w220",attrs:{type:"text",placeholder:"显示为其他名称"},domProps:{value:s.name},on:{input:function(t){t.target.composing||e.$set(s,"name",t.target.value)}}}),e._v(" "),t("label",{staticClass:"emargin--left"},[e._v("显示")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:s.show,expression:"nav.show"}],staticClass:"echeckbox",attrs:{type:"checkbox"},domProps:{checked:Array.isArray(s.show)?e._i(s.show,null)>-1:s.show},on:{change:function(t){var i=s.show,n=t.target,a=!!n.checked;if(Array.isArray(i)){var r=e._i(i,null);n.checked?r<0&&e.$set(s,"show",i.concat([null])):r>-1&&e.$set(s,"show",i.slice(0,r).concat(i.slice(r+1)))}else e.$set(s,"show",a)}}})])})),0),e._v(" "),t("span",{staticClass:"tip tip--small"},[e._v(" • SETTING/DONATION 暂时不可隐藏 • 隐藏界面可通过 #hash 的形式直接访问")])]),e._v(" "),e.$uApi.store.getCache("bSponsor")?t("div",{directives:[{name:"show",rawName:"v-show",value:!e.collapse,expression:"!collapse"}],staticClass:"border setting setting--inline"},[t("div",{staticClass:"eflex"},[t("label",[e._v("启用主题:")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.theme_simple}}),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.theme_simple.name,expression:"theme_simple.name"}],staticClass:"emargin--left elecTable_input w220",attrs:{type:"text",placeholder:"主题名称"},domProps:{value:e.theme_simple.name},on:{input:function(t){t.target.composing||e.$set(e.theme_simple,"name",t.target.value)}}})],1),e._v(" "),t("div",{staticClass:"emargin"},[t("label",[e._v("主色彩:")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.theme_simple.mainbk,expression:"theme_simple.mainbk"}],staticClass:"elecTable_input w120",attrs:{type:"text",placeholder:"#326733"},domProps:{value:e.theme_simple.mainbk},on:{input:function(t){t.target.composing||e.$set(e.theme_simple,"mainbk",t.target.value)}}})]),e._v(" "),t("div",{staticClass:"emargin"},[t("label",[e._v("文字色彩:")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.theme_simple.maincl,expression:"theme_simple.maincl"}],staticClass:"elecTable_input w120",attrs:{type:"text",placeholder:"#ff9800"},domProps:{value:e.theme_simple.maincl},on:{input:function(t){t.target.composing||e.$set(e.theme_simple,"maincl",t.target.value)}}})]),e._v(" "),t("div",{staticClass:"emargin"},[t("label",[e._v("应用背景:")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.theme_simple.appbk,expression:"theme_simple.appbk"}],staticClass:"elecTable_input w220",attrs:{type:"text",placeholder:"url(https://x.xx/x.png)"},domProps:{value:e.theme_simple.appbk},on:{input:function(t){t.target.composing||e.$set(e.theme_simple,"appbk",t.target.value)}}})]),e._v(" "),t("div",{staticClass:"emargin eflex eflex--wrap w100"},[t("div",{staticClass:"theme_style"},[t("label",[e._v("附加样式:")]),e._v(" "),t("textarea",{directives:[{name:"model",rawName:"v-model",value:e.theme_simple.style,expression:"theme_simple.style"}],staticClass:"editor_textarea editor_textarea--oneline",attrs:{placeholder:"#app {--main-bk: #2E3784;--main-fc: #FFCB40;--main-cl: #64AAD0;}"},domProps:{value:e.theme_simple.style},on:{input:function(t){t.target.composing||e.$set(e.theme_simple,"style",t.target.value)}}})]),e._v(" "),t("button",{staticClass:"elecBtn greenbk",on:{click:function(t){return e.themePreview()}}},[e._v("预览")]),e._v(" "),t("button",{staticClass:"elecBtn w120",on:{click:function(t){return e.themeSave()}}},[e._v("保存为常用")])]),e._v(" "),t("div",{staticClass:"w100"},[t("ul",{staticClass:"w100"},e._l(e.theme_list,(function(s,i){return t("li",{staticClass:"theme_item"},[t("span",{staticClass:"w220"},[e._v(e._s(s.name)+":")]),e._v(" "),t("div",{staticClass:"theme_view"},[t("span",{staticClass:"theme_viewitem",style:{background:s.mainbk},attrs:{title:s.mainbk},on:{click:function(t){return t.preventDefault(),e.copyColor(s.mainbk)}}}),e._v(" "),t("span",{staticClass:"theme_viewitem",style:{background:s.maincl},attrs:{title:s.maincl},on:{click:function(t){return t.preventDefault(),e.copyColor(s.maincl)}}}),e._v(" "),t("span",{staticClass:"theme_viewitem",style:{background:s.appbk},attrs:{title:s.appbk},on:{click:function(t){return t.preventDefault(),e.copyColor(s.appbk)}}})]),e._v(" "),t("div",{staticClass:"theme_op"},[t("button",{staticClass:"elecBtn greenbk elecBtn--h32",on:{click:function(t){return e.themePreview(i)}}},[e._v("预览")]),e._v(" "),t("button",{staticClass:"elecBtn elecBtn--clear elecBtn--h32",on:{click:function(t){return e.theme_list.splice(i,1)}}},[e._v("删除")])])])})),0),e._v(" "),t("div",{staticClass:"theme_imexport"},[t("button",{staticClass:"elecBtn elecBtn--h32 minw160",on:{click:function(t){return t.preventDefault(),e.themeExport()}}},[e._v("导出常用主题")]),e._v(" "),t("button",{staticClass:"elecBtn elecBtn--h32 minw160",on:{click:function(t){return t.preventDefault(),e.themeImport()}}},[e._v("导入常用主题")])])])]):e._e(),e._v(" "),t("button",{directives:[{name:"show",rawName:"v-show",value:!e.collapse,expression:"!collapse"}],staticClass:"elecBtn elecBtn--stlong",on:{click:function(t){return e.webuiSave()}}},[e._v(e._s(e.$t("save")))])])};vo._withStripped=!0;const go=ka({name:"webui",props:["menunav","theme","logo"],data(){return{collapse:this.$uStr.iRandom(0,10)>5,navkey:["overview","task","mitm","rules","rewrite","jsmanage","setting","cfilter","about","donation"]}},components:{checkbox:mr},computed:{menulist(){for(let e of this.navkey)this.menunav[e]||(this.menunav[e]=Object.create(null)),!1!==this.menunav[e].show&&(this.menunav[e].show=!0);return this.menunav},theme_simple(){return this.theme.simple||(this.theme.simple=Object.create(null)),this.theme.simple},theme_list(){return this.theme.list||(this.theme.list=[]),this.theme.list}},methods:{webuiSave(){if(this.theme_simple.style&&/{0===e.data.rescode?(this.$message.success("webUI 相关设置修改成功"),this.$emit("menunav",this.menunav,!0),this.$emit("theme",this.theme_simple)):this.$message.error("webUI 相关设置修改失败",e.data.message)})).catch((e=>{this.$message.error("webUI 相关设修改失败",e.message),console.error("webUI 相关设修改失败",e)})).finally(e)},themeSave(){let e=prompt("命名将要保存的主题",this.theme_simple.name||"主题名称");e&&(this.theme.list.push({name:e,mainbk:this.theme_simple.mainbk,maincl:this.theme_simple.maincl,appbk:this.theme_simple.appbk,style:this.theme_simple.style}),this.$message.success(e,"已保存"),this.$forceUpdate())},themePreview(e=-1){-1!==e?(this.theme_simple.enable=!0,this.theme_simple.name=this.theme_list[e].name,this.theme_simple.mainbk=this.theme_list[e].mainbk,this.theme_simple.maincl=this.theme_list[e].maincl,this.theme_simple.appbk=this.theme_list[e].appbk,this.theme_simple.style=this.theme_list[e].style,this.$emit("theme",this.theme_simple)):this.$emit("theme",this.theme_simple)},themeExport(){this.$uApi.saveAsFile(this.theme_list,"elecV2P_theme.json")},themeImport(){this.$uApi.getFile({accept:".json"}).then((e=>{try{this.theme_list.push(...JSON.parse(e.content)),this.$forceUpdate(),this.$message.success("常用主题列表导入成功")}catch(e){this.$message.error("常用主题列表导入失败",e.message||e)}})).catch((e=>{this.$message.error("常用主题列表导入失败",e.message||e)}))},logoSave(){const e=this.$message.loading("LOGO 相关设置保存中...",0);this.$axios.put("/config",{type:"webUILogo",data:this.logo}).then((e=>{0===e.data.rescode?(this.$message.success("LOGO 相关设置修改成功"),this.$emit("theme",{type:"logo",...this.logo})):this.$message.error("LOGO 相关设置修改失败",e.data.message)})).catch((e=>{this.$message.error("LOGO 相关设修改失败",e.message),console.error("LOGO 相关设修改失败",e)})).finally(e)},copyColor(e=""){e?this.$uApi.copyToClipboard(e).then((t=>{this.$message.success("成功复制",e)})).catch((e=>{this.$message.error("复制失败",e.message)})):this.$message.error("该项暂无对应值可供复制")}}},vo,[],!1,null,"f48c8df4",null).exports;var _o=function(){var e=this,t=e._self._c;return t("div",{staticClass:"setting setting--vflex",class:{"setting--collapsed":e.collapse},on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.envSave()):null}}},[t("h4",{staticClass:"setting_title"},[t("sapn",{staticClass:"title_main"},[e._v("环境变量相关设置")]),e._v(" "),t("span",{staticClass:"title_collapse",class:{"title_collapse--collapsed":e.collapse},on:{click:function(t){e.collapse=!e.collapse}}})],1),e._v(" "),t("div",{directives:[{name:"show",rawName:"v-show",value:!e.collapse,expression:"!collapse"}],staticClass:"w100"},[t("div",{staticClass:"eflex w100 emargin"},[t("label",{staticClass:"minw160"},[e._v("PATH")]),e._v(" "),t("textarea",{directives:[{name:"model",rawName:"v-model",value:e.config.path,expression:"config.path"}],staticClass:"editor_textarea editor_textarea--mini emargin--left",attrs:{placeholder:"路径/PATH 分隔符 WIN系统-分号(;) 其他系统-冒号(:)"},domProps:{value:e.config.path},on:{input:function(t){t.target.composing||e.$set(e.config,"path",t.target.value)}}})]),e._v(" "),e._l(e.config.other,(function(s,i){return t("div",{key:i,staticClass:"eflex w100 emargin"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s[0],expression:"envk[0]",modifiers:{trim:!0}}],staticClass:"elecTable_input minw160",attrs:{type:"text",placeholder:"变量名称"},domProps:{value:s[0]},on:{input:function(t){t.target.composing||e.$set(s,0,t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("textarea",{directives:[{name:"model",rawName:"v-model.trim",value:s[1],expression:"envk[1]",modifiers:{trim:!0}}],staticClass:"editor_textarea editor_textarea--oneline emargin--left",attrs:{placeholder:"变量对应值"},domProps:{value:s[1]},on:{input:function(t){t.target.composing||e.$set(s,1,t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("span",{staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.delete)},on:{click:function(t){return e.$delete(e.config.other,i)}}})])}))],2),e._v(" "),t("div",{directives:[{name:"show",rawName:"v-show",value:!e.collapse,expression:"!collapse"}],staticClass:"eflex w100"},[t("button",{staticClass:"elecBtn elecBtn--stlong wp46",on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.envNew()}}},[e._v(e._s(e.$t("new")))]),e._v(" "),t("button",{staticClass:"elecBtn elecBtn--stlong wp46",on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.envSave()}}},[e._v(e._s(e.$t("save")))])])])};_o._withStripped=!0;const bo=ka({name:"env",props:["config"],data(){return{icon:wa,collapse:this.$uStr.iRandom(0,10)>5}},methods:{envNew(){this.config.other.push(["",""])},envSave(){if(!this.config.path)return void this.$message.error("请先输入 PATH 变量对应值再进行保存");if(/[\*\?"<>\|]/.test(this.config.path)&&!confirm("PATH 中包含特殊字符,确认继续保存?"))return;let e=[],t=[];if(this.config.other.length)for(const e of this.config.other){if(!e[0]||!e[1])return void this.$message.error("部分环境变量或对应值为空,请填写后再进行保存");t.push(e[0])}this.config.dable.forEach((s=>{-1===t.indexOf(s)&&e.push(s)}));const s=this.$message.loading("环境变量相关设置保存中...",0);this.$axios.put("/config",{type:"env",data:{path:this.config.path,other:this.config.other,todel:e}}).then((e=>{0===e.data.rescode?(this.$message.success("环境变量相关设置修改成功"),this.config.dable=this.config.other.map((e=>e[0]))):this.$message.error("环境变量相关设置修改失败",e.data.message)})).catch((e=>{this.$message.error("环境变量相关设修改失败",e.message),console.error("环境变量相关设修改失败",e)})).finally(s)}}},_o,[],!1,null,null,null).exports,yo={name:"setting",props:[],data(){return{icon:wa,collapse:{notify:this.$uStr.iRandom(0,10)>5,runjs:this.$uStr.iRandom(0,10)>5,other:this.$uStr.iRandom(0,10)>5,init:!0},init_url:Oa.base_url,homepage:Oa.base_url,lang:rr.locale,gloglevel:"info",glogslicebegin:"0",wbrtoken:"",userid:this.$uApi.store.get("userid"),wbrscript:{enable:!1,target:""},CONFIG_FEED:{enable:!0,rss:{enable:!0,homepage:"https://github.com/elecV2/elecV2P"},iftttid:{enable:!1,key:""},barkkey:{enable:!1,key:""},custnotify:{enable:!1,url:"",type:"GET",data:""},runjs:{enable:!1,list:""},merge:{enable:!0,gaptime:60,number:10,andor:!1},maxbLength:1200,webmessage:{enable:!1}},CONFIG_RUNJS:{timeout:5e3,intervals:86400,numtofeed:50,jslogfile:!0,eaxioslog:!1,proxy:!0,white:{enable:!1,list:[]}},CONFIG_Axios:{proxy:{enable:!1},timeout:5e3,uagent:"",block:{enable:!1,regexp:""},only:{enable:!1,regexp:""},reject_unauthorized:!0},bShowMinishell:!1,uagent:Object.create(null),CONFIG_SECURITY:{enable:!1,blacklist:[],whitelist:[],cookie:{enable:!0},numtofeed:0,webhook_only:!1,tokens:{}},CONFIG_init:{checkupdate:!0,runjsenable:!0,runjs:""},CONFIG_env:{path:"",other:[],dable:[]},anyproxy:{enable:!0,port:8001,webPort:8002},webUI:{port:80,tls:{enable:!1,host:"127.0.0.1"},nav:Object.create(null),logo:{enable:!1,src:"",name:""},theme:{simple:{enable:!1,name:"",mainbk:"",maincl:"",appbk:"",style:""},list:[{name:"简单暗黑",mainbk:"#000C",maincl:"#6E77FB",appbk:"#000C",style:""},{name:"简单透明",mainbk:"#0000",maincl:"#FFC107",appbk:"url(https://images.unsplash.com/photo-1646505183416-f3301d2a8127?auto=format)",style:".content>div,.elecBtn--long,.efssset_container,.efsslist{border: 1px solid var(--tras-bk);}.eapp_item .eapp_name,.efsslist_content .efssa{color: var(--main-cl);}.loginfo.loginfo--full{background: var(--secd-bk);}.codeditor{--main-bk: var(--secd-bk);}"}]}},CONFIG_Path:{config:"",lists:"",lists_final:"",script:"",script_final:"",store:"",store_final:"",shell:"",shell_final:""},newversion:""}},computed:{jswhitelist:{get(){return this.CONFIG_RUNJS.white.list.join(", ")},set(e){this.CONFIG_RUNJS.white.list=e.split(/ ?, ?|,| /)}}},components:{minishell:uo,eAxios:po,security:fo,checkbox:mr,webui:go,env:bo},created(){const e=this.$message.loading("正在获取 设置 相关数据...",0);this.$axios.get("/config?type=setting").then((e=>{if(this.$message.success("CONFIG 相关数据获取成功"),this.homepage=e.data.homepage||Oa.base_url,this.gloglevel=e.data.gloglevel,this.glogslicebegin=String(e.data.glogslicebegin||"0"),Object.assign(this.CONFIG_SECURITY,e.data.security||{}),Object.assign(this.CONFIG_FEED,e.data.CONFIG_FEED||{}),Object.assign(this.CONFIG_RUNJS,e.data.CONFIG_RUNJS||{}),Object.assign(this.CONFIG_Axios,e.data.CONFIG_Axios||{}),Object.assign(this.CONFIG_Path,e.data.CONFIG_Path||{}),Object.assign(this.CONFIG_init,e.data.init||{}),Object.assign(this.anyproxy,e.data.anyproxy||{}),e.data.CONFIG_env){const{path:t,...s}=e.data.CONFIG_env;this.CONFIG_env.path=t;for(const e in s)this.CONFIG_env.dable.push(e),this.CONFIG_env.other.push([e,s[e]])}if(e.data.uagent)for(let t in e.data.uagent)e.data.uagent[t].name&&this.$set(this.uagent,t,{name:e.data.uagent[t].name,header:e.data.uagent[t].header});if(this.wbrtoken=e.data.wbrtoken,this.userid=e.data.userid,this.userid!==this.$uApi.store.get("userid")&&this.$uApi.store.set("userid",this.userid),this.$uApi.store.setCache("bSponsor",this.$uApi.store.getCache("sponsors").has(this.userid)),e.data.webUI)if(Object.assign(this.webUI,e.data.webUI),e.data.webUI.nav&&this.$emit("menunav",{...e.data.webUI.nav}),e.data.webUI.logo&&this.$emit("theme",{type:"logo",...e.data.webUI.logo}),this.$uApi.store.getCache("bSponsor")){let t=e.data.webUI.theme;t&&this.$emit("theme",t.simple||t)}else this.$emit("theme",{enable:!1});e.data.lang&&this.lang!==e.data.lang&&(this.lang=e.data.lang,this.setLanguage()),"object"==typeof e.data.wbrscript&&Object.assign(this.wbrscript,e.data.wbrscript),this.bShowMinishell=e.data.minishell,this.newversion=e.data.newversion})).catch((e=>{this.$message.error("获取数据失败",e),console.error("获取数据失败",e)})).finally(e)},methods:{homepageSave(){if(this.homepage!==location.origin&&!confirm("设置主页和当前主页 "+location.origin+" 不匹配,确定保存?"))return;const e=this.$message.loading("主页设置保存中...",0);this.$axios.put("/config",{type:"homepage",data:this.homepage}).then((e=>{this.$message.success("设置成功",e.data.message)})).catch((e=>{this.$message.error("设置失败",e.message),console.log(e)})).finally(e)},glevelSet(){const e=this.$message.loading("全局日志设置中...",0);this.$axios.put("/config",{type:"gloglevel",data:this.gloglevel}).then((e=>{0===e.data.rescode?this.$message.success("设置成功",e.data.message):this.$message.error("设置失败",e.data.message)})).catch((e=>{this.$message.error("设置失败",e.message),console.log(e)})).finally(e)},gsliceSet(){const e=this.$message.loading("日志格式设置中...",0);this.$axios.put("/config",{type:"glogslicebegin",data:this.glogslicebegin}).then((e=>{0===e.data.rescode?(this.$message.success("日志格式设置成功"),Oa.glogslicebegin=this.glogslicebegin):this.$message.error("日志格式设置失败")})).catch((e=>{this.$message.error("日志格式设置失败",e.message),console.log(e)})).finally(e)},feedOp(){const e=this.$message.loading("设置保存中...",0);this.$axios.put("/feed",{type:"op",data:{enable:this.CONFIG_FEED.enable,maxbLength:this.CONFIG_FEED.maxbLength,webmessage:this.CONFIG_FEED.webmessage}}).then((e=>{this.$message.success(`设置已保存\n${e.data.message}`)})).catch((e=>{this.$message.error("设置保存失败",e.message),console.log(e)})).finally(e)},feedTest(){const e=this.$message.loading("通知准备测试中...",0);this.$axios.put("/feed",{type:"test"}).then((e=>{0===e.data.rescode?this.$message.success(e.data.message):console.log(e.data)})).catch((e=>{this.$message.error("通知测试失败",e.message),console.log(e)})).finally(e)},feedClear(){if(!confirm("确实清空 Feed 内容吗?"))return;const e=this.$message.loading("Feed 清空中...",0);this.$axios.put("/feed",{type:"clear"}).then((e=>{this.$message.success("Feed 内容已重置",e.data.message)})).catch((e=>{this.$message.error("Feed 清空失败",e.message),console.log(e)})).finally(e)},iftttSave(){if(!this.CONFIG_FEED.iftttid.enable||this.CONFIG_FEED.iftttid.key){if(this.CONFIG_FEED.iftttid.enable||confirm("确认关闭 IFTTT 通知?")){const e=this.$message.loading("IFTTT 设置中...",0);this.$axios.put("/feed",{type:"ifttt",data:this.CONFIG_FEED.iftttid}).then((e=>{this.$message.success("IFTTT 设置已保存",e.data.message),console.debug(e.data)})).catch((e=>{this.$message.error("设置保存失败",e.response?e.response.data:e.message),console.error(e)})).finally(e)}}else this.$message.error("请输入 IFTTT KEY 值")},barkeySave(){if(!this.CONFIG_FEED.barkkey.enable||this.CONFIG_FEED.barkkey.key){if(this.CONFIG_FEED.barkkey.enable||confirm("确认关闭 BARK 通知?")){const e=this.$message.loading("barkkey 设置中...",0);this.$axios.put("/feed",{type:"barkkey",data:this.CONFIG_FEED.barkkey}).then((e=>{this.$message.success("barkkey 设置已保存",e.data.message),console.debug(e.data)})).catch((e=>{this.$message.error("设置失败",e.response?e.response.data:e.message),console.error(e)})).finally(e)}}else this.$message.error("请输入 BARK KEY 值")},custnotifySave(){if(!this.CONFIG_FEED.custnotify.enable||this.CONFIG_FEED.custnotify.url){if(this.CONFIG_FEED.custnotify.enable||confirm("确认关闭自定义通知?")){const e=this.$message.loading("更新自定义通知相关设置中...",0);this.$axios.put("/feed",{type:"custnotify",data:this.CONFIG_FEED.custnotify}).then((e=>{this.$message.success("自定义通知设置已保存",e.data.message),console.debug(e.data)})).catch((e=>{this.$message.error("设置失败",e.response?e.response.data:e.message),console.error(e)})).finally(e)}}else this.$message.error("请输入自定义通知链接")},notifyjsSave(){if(!this.CONFIG_FEED.runjs.enable||this.CONFIG_FEED.runjs.list){if(this.CONFIG_FEED.runjs.enable||confirm("确认关闭触发脚本?")){const e=this.$message.loading("通知触发脚本设置保存中...",0);this.$axios.put("/feed",{type:"runjs",data:this.CONFIG_FEED.runjs}).then((e=>{this.$message.success(`设置已保存\n${e.data.message}`),console.debug(e.data)})).catch((e=>{this.$message.error("设置保存失败",e.response?e.response.data:e.message),console.error(e)})).finally(e)}}else this.$message.error("请输入要触发的脚本")},wbrtokenSave(){if(!this.wbrtoken)return void this.$message.error("请先输入 TOKEN 值");if(this.wbrtoken.length<12)return void this.$message.error("当前设置 TOKEN 太短,请重新填写");const e=this.$message.loading("TOKEN 上传设置中...",0);this.$axios.put("/config",{type:"wbrtoken",data:this.wbrtoken}).then((e=>{0===e.data.rescode?(e.data.resdata&&this.userid!==e.data.resdata.userid&&(this.userid=e.data.resdata.userid,this.$uApi.store.set("userid",this.userid)),this.$message.success("设置成功",e.data.message)):this.$message.error("WEBHOOK TOKEN 修改失败",e.data.message),console.debug(e.data)})).catch((e=>{this.$message.error("设置失败",e.message),console.log(e)})).finally(e)},wbrscriptSave(){if(this.wbrscript.enable&&!this.wbrscript.target)return void this.$message.error("请先设置 WEBHOOK SCRIPT 处理脚本");const e=this.$message.loading("WEBHOOK SCRIPT 设置中...",0);this.$axios.put("/config",{type:"wbrscript",data:this.wbrscript}).then((e=>{0===e.data.rescode?this.$message.success("设置成功",e.data.message):this.$message.error("WEBHOOK SCRIPT 设置失败",e.data.message)})).catch((e=>{this.$message.error("WEBHOOK SCRIPT 设置失败",e.message),console.error("WEBHOOK SCRIPT 设置",e)})).finally(e)},mergeSave(){const e=this.$message.loading("默认通知设置中...",0);this.$axios.put("/feed",{type:"merge",data:{rssenable:this.CONFIG_FEED.rss.enable,merge:this.CONFIG_FEED.merge}}).then((e=>{this.$message.success(`设置已保存\n${e.data.message}`),console.debug(e.data)})).catch((e=>{this.$message.error("设置失败",e.message),console.log(e)})).finally(e)},runjsSave(){const e=this.$message.loading("脚本运行相关设置保存中...",0);this.$axios.put("/config",{type:"runjs",data:this.CONFIG_RUNJS}).then((e=>{0===e.data.rescode?this.$message.success("脚本运行相关设置保存成功",e.data.message):(this.$message.error("脚本运行相关设置保存失败",e.data.message),console.error(e.data))})).catch((e=>{this.$message.error("脚本运行相关设置保存失败",e.message),console.log(e)})).finally(e)},initSave(){const e=this.$message.loading("启动时 相关设置保存中...",0);this.$axios.put("/config",{type:"init",data:{CONFIG_init:this.CONFIG_init}}).then((e=>{0===e.data.rescode?this.$message.success("启动时相关设置保存成功",e.data.message):this.$message.error("启动时相关设置修改失败")})).catch((e=>{this.$message.error("启动时相关设置保存失败",e.message),console.log(e)})).finally(e)},anyproxySave(){if(this.anyproxy.port&&this.anyproxy.webPort){if(this.anyproxy.enable||confirm("确定在下次启动 elecV2P 时不打开 ANYPROXY 吗?")){const e=this.$message.loading("ANYPROXY 相关设置保存中...",0);this.$axios.put("/config",{type:"anyproxy",data:this.anyproxy}).then((e=>{0===e.data.rescode?this.$message.success("ANYPROXY 设置保存成功"):(this.$message.error("ANYPROXY 设置修改失败",e.data.message),console.error(e.data))})).catch((e=>{this.$message.error("设置失败",e.message),console.log(e)})).finally(e)}}else this.$message.error("请正确填写端口相关数据")},webUIPortSave(){if(confirm("确定将 webUI 主界面端口更改为: "+this.webUI.port+" 吗?(下次启动时应用)")){const e=this.$message.loading("webUI 主界面端口修改保存中...",0);this.$axios.put("/config",{type:"webUIPort",data:this.webUI}).then((e=>{0===e.data.rescode?this.$message.success("webUI 端口设置保存成功"):(this.$message.error("webUI 端口设置修改失败",e.data.message),console.error(e.data))})).catch((e=>{this.$message.error("webUI 端口设置失败",e.message),console.log(e)})).finally(e)}},pathSave(){const e=this.$message.loading("用户数据保存目录设置中...",0),{lists:t,script:s,store:i,shell:n}=this.CONFIG_Path;this.$axios.put("/config",{type:"datapath",data:{lists:t,script:s,store:i,shell:n}}).then((e=>{0===e.data.rescode?this.$message.success("用户数据保存目录设置成功 重启后正式生效"):this.$message.error("用户数据保存目录设置失败",e.data.message)})).catch((e=>{this.$message.error("设置保存失败",e.message),console.log(e)})).finally(e)},saveAll(){const e=this.$message.loading("配置数据上传中...",0);this.$axios.put("/config",{type:"config",data:{homepage:this.homepage,lang:this.lang,gloglevel:this.gloglevel,glogslicebegin:this.glogslicebegin,CONFIG_FEED:this.CONFIG_FEED,CONFIG_RUNJS:this.CONFIG_RUNJS,CONFIG_Axios:this.CONFIG_Axios,wbrtoken:this.wbrtoken,webhook:{script:this.wbrscript},path_lists:this.CONFIG_Path.lists,path_script:this.CONFIG_Path.script,path_store:this.CONFIG_Path.store,path_shell:this.CONFIG_Path.shell,webUI:this.webUI,SECURITY:this.CONFIG_SECURITY,init:this.CONFIG_init}}).then((e=>{this.$message.success(`当前设置保存成功\n${e.data.message}`)})).catch((e=>{this.$message.error("设置保存失败",e.message),console.log("设置保存失败",e)})).finally(e)},configExport(){this.$uApi.downloadFile("/config?token="+this.wbrtoken,"config.json")},async configImport(){if(!confirm("导入配置文件将会覆盖当前所有设置,并在重启后正式生效\n确认继续?"))return;let e=await this.$uApi.getFile({accept:".json"});if(e){if(e.content=this.$uStr.sJson(e.content),!e.content)return void this.$message.error("当前导入文件并不是正确的 JSON 格式");this.$axios.post("/config",{file:e}).then((e=>{0===e.data.rescode?this.$message.success("配置文件导入成功,将在重启后正式生效",e.data.message):this.$message.error("配置文件导入失败",e.data.message),console.debug("配置文件导入结果",e.data)})).catch((e=>{this.$message.error("配置文件导入失败",e.message),console.error("配置文件导入失败",e)}))}else this.$message.error("请选择正确的配置文件进行导入")},setLanguage(){const e=cr(this.lang);return this.$forceUpdate(),e},langSave(){if(this.lang===rr.locale)return void this.$message.success(`当前语言偏好为 ${this.lang} 未做修改`);const e=this.$message.loading("语言偏好设置保存中...",0);this.$axios.put("/config",{type:"lang",data:this.lang}).then((e=>{if(0===e.data.rescode){let e=this.setLanguage();this.$message.success("成功设置当前语言偏好为",e)}else this.$message.error("语言偏好修改失败",e.data.message)})).catch((e=>{this.$message.error("语言偏好设置失败",e.message),console.log("语言偏好设置失败",e)})).finally(e)},evRestart(){confirm("即将尝试重启 elecV2P,请提前保存好规则及任务列表,确定继续?")&&this.$axios.post("/webhook",{token:this.wbrtoken,type:"shell",command:"pm2 restart elecV2P"}).then((e=>{this.$message.error("重启失败",e.data.message)})).catch((e=>{this.$message.success("重启命令已发送,将在 5 秒后自动刷新该页面"),setTimeout((()=>location.reload()),5e3)}))},evStop(){confirm("关闭 elecV2P 后,当前网页、定时任务以及 ANYPROXY 都将不可用,确定继续?")&&this.$axios.post("/webhook",{token:this.wbrtoken,type:"shell",command:"pm2 stop elecV2P"}).then((e=>{this.$message.error("关闭失败",e.data.message)})).catch((e=>{this.$message.success("关闭命令已发送,即将自动跳转到首页"),setTimeout((()=>location.reload()),5e3)}))},updateCheck(){if(this.newversion)return void this.$message.success("检测到新版本 v"+this.newversion+"\n请手动运行 softupdate.js 或者使用 docker 命令进行更新\n(等 softupdate.js 稳定后将会集成到这里实现自动更新)");const e=this.$message.loading("正在检测 elecV2P 是否有新的版本可供更新...",0);this.$axios.get("/data?type=update&force=true").then((e=>{e.data.updateversion?(this.$message.success("检测到新版本 elecV2P v"+e.data.updateversion+"\n请手动运行 softupdate.js 或者使用 docker 命令进行更新\n(等 softupdate.js 稳定后将会集成到这部分以实现自动更新)"),this.newversion=e.data.updateversion):this.$message.success(e.data.message+"\n当前 elecV2P v"+e.data.version+" 已是最新版本")})).catch((e=>{this.$message.error("检测更新失败",e.message),console.error("检测更新失败",e)})).finally(e)}}};const $o=ka(yo,Nr,[function(){var e=this,t=e._self._c;return t("label",{staticClass:"setting_label"},[t("a",{staticClass:"cursor--help",attrs:{href:"https://help.ifttt.com/hc/en-us/articles/115010230347-Webhooks-service-FAQ",target:"_blank"}},[e._v("IFTTT")]),e._v(" KEY:")])},function(){var e=this,t=e._self._c;return t("label",{staticClass:"setting_label"},[t("a",{staticClass:"cursor--help",attrs:{href:"https://github.com/Finb/Bark",target:"_blank"}},[e._v("BARK")]),e._v(" KEY:")])},function(){var e=this,t=e._self._c;return t("footer",{staticClass:"footer"},[t("ul",{staticClass:"footer_tip"},[t("li",[e._v("关于配置文件的完整说明,参考文档: "),t("a",{attrs:{href:"https://github.com/elecV2/elecV2P-dei/blob/master/docs/10-config.md",target:"elecV2PDoc"}},[e._v("10-config.md")])]),e._v(" "),t("li",[e._v("通知及脚本运行和网络请求相关设置对使用 nodejs 模式运行的脚本无效")]),e._v(" "),t("li",[e._v("除了初始化相关设置之外,其他设置保存后立即生效。CTRL+S 快捷保存")]),e._v(" "),t("li",[e._v("关于通知类相关设置参考: "),t("a",{attrs:{href:"https://github.com/elecV2/elecV2P-dei/tree/master/docs/07-feed¬ify.md",target:"elecV2PDoc"}},[e._v("07-feed.md")]),e._v("。 其他参考: "),t("a",{attrs:{href:"https://github.com/elecV2/elecV2P-dei/tree/master/docs",target:"elecV2PDoc"}},[e._v("全部说明文档")]),e._v(" 相关项")])])])}],!1,null,"b5ef0062",null).exports;var wo=function(){var e=this,t=e._self._c;return t("section",{on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),t.shiftKey||t.altKey||t.metaKey?null:e.taskSave()):null}}},[t("header",{staticClass:"header"},[e._v(e._s(e.$ta("timed","task")))]),e._v(" "),t("main",{staticClass:"content",on:{click:function(t){e.menu={}},keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.preventDefault(),t.stopPropagation(),t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:(e.menu={},void(e.taskChecked="none")))}}},[t("contextmenu",{attrs:{menus:e.menu.list,pos:e.menu.pos}}),e._v(" "),t("movegroup",{attrs:{show:e.show,gpoptions:e.gnamelist},on:{choose:function(t){return e.taskMoveToGroup(t)}}}),e._v(" "),t("div",{staticClass:"etable"},[t("table",{staticClass:"elecTable"},[t("caption",{staticClass:"elecTable_caption"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.search,expression:"search"}],staticClass:"elecTable_input elecTable_input--caption",class:{eopacity:e.search},attrs:{placeholder:e.$ta("search","task"),title:"输入名称/时间/任务内容中的关键字进行过滤显示"},domProps:{value:e.search},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.preventDefault(),t.stopPropagation(),t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:void(e.search=""))},input:function(t){t.target.composing||(e.search=t.target.value)}}}),e._v(" "),t("span",[e._v(e._s(e.$ta("task","list"))+" - "+e._s(e.taskstatus))]),e._v(" "),t("span",{staticClass:"icon icon_caption--sync",attrs:{title:"刷新当前任务列表"},domProps:{innerHTML:e._s(e.icon.sync)},on:{click:function(t){return e.taskInit()}}})]),e._v(" "),t("thead",[t("tr",[t("th",{staticClass:"elecTable_th elecTable_th--check",attrs:{title:e.$ta("checkall","/","checknone")}},[t("input",{staticClass:"echeckbox",attrs:{type:"checkbox"},on:{change:function(t){return e.taskCkall(t)}}})]),e._v(" "),t("th",{staticClass:"elecTable_th elecTable_th--name"},[e._v(e._s(e.$t("name")))]),e._v(" "),t("th",{staticClass:"elecTable_th task_time",attrs:{colspan:"2"}},[e._v(e._s(e.$t("time")))]),e._v(" "),t("th",{staticClass:"elecTable_th minw600",attrs:{colspan:"2",title:"enter: 开始定时任务\nctrl+enter: 测试运行任务\nalt +enter: 查看任务日志"}},[e._v(e._s(e.$t("task")))]),e._v(" "),t("th",{staticClass:"elecTable_th minw62",attrs:{title:e.$t("status")}},[e._v(e._s(e.$t("status_short")))]),e._v(" "),t("th",{staticClass:"elecTable_th elecTable_cell100",attrs:{colspan:"2",title:e.$t("operate")}},[e._v(e._s(e.$t("operate_short")))])])]),e._v(" "),e._l(e.grouplist,(function(s,i){return t("tbody",{key:i,class:{elecTable_group:"normal"!==i,"elecTable_group--bottom":"normal"!==i},style:{background:e.tasklists[i]&&e.tasklists[i].bkcolor},attrs:{tabindex:"-1"},on:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:t.altKey?(t.preventDefault(),t.ctrlKey||t.shiftKey||t.metaKey?null:e.taskLog(t)):null},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:t.ctrlKey?(t.preventDefault(),t.shiftKey||t.altKey||t.metaKey?null:e.taskTest(t)):null}],keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.preventDefault(),t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.taskStartDelegate(t))}}},["normal"!==i?t("tr",[t("td",{staticClass:"elecTable_td"},[t("input",{staticClass:"echeckbox",attrs:{type:"checkbox"},on:{change:function(t){return e.taskGroupCheck(i,t)}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.tasklists[i].name,expression:"tasklists[gid].name",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{placeholder:"id: "+i},domProps:{value:e.tasklists[i].name},on:{input:function(t){t.target.composing||e.$set(e.tasklists[i],"name",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td",attrs:{colspan:"5"}},[t("div",{staticClass:"eflex w100"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.tasklists[i].note,expression:"tasklists[gid].note",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{type:"text",placeholder:"分组备注说明(可省略"},domProps:{value:e.tasklists[i].note},on:{input:function(t){t.target.composing||e.$set(e.tasklists[i],"note",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.trim.lazy",value:e.tasklists[i].bkcolor,expression:"tasklists[gid].bkcolor",modifiers:{trim:!0,lazy:!0}}],staticClass:"elecTable_input elecTable_cell100 elecBtn--mleft",attrs:{placeholder:"背景色",title:"当前分组背景颜色/图片"},domProps:{value:e.tasklists[i].bkcolor},on:{change:function(t){e.$set(e.tasklists[i],"bkcolor",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("span",{staticClass:"elecBtn elecBtn--mleft elecBtn--uncheck"},[e._v(e._s(e.tasklists[i].active)+"/"+e._s(e.tasklists[i].total))])])]),e._v(" "),t("td",{staticClass:"elecTable_td elecTable_cell100",attrs:{colspan:"2"}},[t("span",{directives:[{name:"show",rawName:"v-show",value:e.tasklists[i].collapse,expression:"tasklists[gid].collapse"}],staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.downcircle)},on:{click:function(t){return e.taskGroupOp(i)}}}),e._v(" "),t("span",{directives:[{name:"show",rawName:"v-show",value:!e.tasklists[i].collapse,expression:"!tasklists[gid].collapse"}],staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.upcircle)},on:{click:function(t){return e.taskGroupOp(i)}}}),e._v(" "),t("span",{staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.delete)},on:{click:function(t){return e.taskGroupDelete(i)}}})])]):e._e(),e._v(" "),e._l(s,(function(s,i){return t("tr",{key:i,class:{"elecTable_tr--disabled":!s.running,"elecTable_tr--selected":e.taskChecked[i]}},[t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.taskChecklist,expression:"taskChecklist"}],staticClass:"echeckbox",attrs:{type:"checkbox"},domProps:{value:i,checked:Array.isArray(e.taskChecklist)?e._i(e.taskChecklist,i)>-1:e.taskChecklist},on:{change:function(t){var s=e.taskChecklist,n=t.target,a=!!n.checked;if(Array.isArray(s)){var r=i,o=e._i(s,r);n.checked?o<0&&(e.taskChecklist=s.concat([r])):o>-1&&(e.taskChecklist=s.slice(0,o).concat(s.slice(o+1)))}else e.taskChecklist=a}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.name,expression:"titem.name",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{"data-tid":i,placeholder:"id: "+s.id},domProps:{value:s.name},on:{input:function(t){t.target.composing||e.$set(s,"name",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("select",{directives:[{name:"model",rawName:"v-model",value:s.type,expression:"titem.type"}],staticClass:"elecTable_select",on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s,"type",t.target.multiple?i:i[0])}}},[t("option",{attrs:{value:"cron"}},[e._v(e._s(e.type_of_time.cron))]),e._v(" "),t("option",{attrs:{value:"schedule"}},[e._v(e._s(e.type_of_time.schedule))])])]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.time,expression:"titem.time",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{"data-tid":i},domProps:{value:s.time},on:{input:function(t){t.target.composing||e.$set(s,"time",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td task_select"},[t("select",{directives:[{name:"model",rawName:"v-model",value:s.job.type,expression:"titem.job.type"}],staticClass:"elecTable_select",on:{change:[function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s.job,"type",t.target.multiple?i:i[0])},function(e){"exec"===s.job.type&&(s.job.target="node -v")}]}},e._l(e.jobtype_select,(function(s,i){return t("option",{key:i,domProps:{value:i}},[e._v(e._s(s))])})),0)]),e._v(" "),t("td",{staticClass:"elecTable_td"},[/^task/.test(s.job.type)?t("select",{directives:[{name:"model",rawName:"v-model.trim",value:s.job.target,expression:"titem.job.target",modifiers:{trim:!0}}],staticClass:"elecTable_select",on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s.job,"target",t.target.multiple?i:i[0])}}},e._l(e.normlist,(function(s,i){return t("option",{key:i,domProps:{value:i}},[e._v(e._s(s.name))])})),0):t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.job.target,expression:"titem.job.target",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{"data-tid":i},domProps:{value:s.job.target},on:{input:function(t){t.target.composing||e.$set(s.job,"target",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td",on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.taskMenu(t,i)},contextmenu:function(t){return t.preventDefault(),t.stopPropagation(),e.taskMenu(t,i)}}},[t("span",{directives:[{name:"show",rawName:"v-show",value:s.running,expression:"titem.running"}],staticClass:"icon--op icon--run",domProps:{innerHTML:e._s(e.icon.sync)}}),e._v(" "),t("span",{directives:[{name:"show",rawName:"v-show",value:!s.running,expression:"!titem.running"}],staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.pause)}})]),e._v(" "),t("td",{staticClass:"elecTable_td elecTable_cell100",attrs:{colspan:"2"}},[t("span",{directives:[{name:"show",rawName:"v-show",value:s.running,expression:"titem.running"}],staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.pause)},on:{click:function(t){return e.taskStop(i)}}}),e._v(" "),t("span",{directives:[{name:"show",rawName:"v-show",value:!s.running,expression:"!titem.running"}],staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.play)},on:{click:function(t){return e.taskStart(i)}}}),e._v(" "),t("span",{staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.delete)},on:{click:function(t){return e.taskDelete(i)}}})])])}))],2)})),e._v(" "),t("tbody",[t("tr",[t("td",{staticClass:"center border_top1",attrs:{colspan:"9"}},[t("span",{staticClass:"elecTable_addbtn",on:{click:function(t){return e.taskNew()}}},[e._v(e._s(e.$ta("new","timed","task")))]),e._v(" "),t("span",{staticClass:"elecTable_addbtn",on:{click:function(t){return e.subNew()}}},[e._v(e._s(e.$ta("add","task","sub")))]),e._v(" "),t("span",{staticClass:"elecTable_addbtn folderbk",on:{click:function(t){return e.taskImport()}}},[e._v(e._s(e.$ta("import","local","sub")))]),e._v(" "),t("span",{staticClass:"elecTable_addbtn",class:{"elecTable_addbtn--selected":1===e.subeishow},on:{click:function(t){return e.taskExport()}}},[e._v(e._s(e.$t("export"))+e._s(e.taskChecklist.length?e.$ta("","checked","task"):e.$ta("","task","list")))]),e._v(" "),t("span",{staticClass:"elecTable_addbtn",attrs:{title:"更新会覆盖本地同名文件"},on:{click:function(t){return e.jsUpdate()}}},[e._v(e._s(e.$ta("update","remote","script")))])])]),e._v(" "),t("tr",{directives:[{name:"show",rawName:"v-show",value:e.taskChecklist.length,expression:"taskChecklist.length"}]},[t("td",{staticClass:"center",attrs:{colspan:"9"}},[t("span",{staticClass:"elecTable_addbtn elecTable_addbtn--check",on:{click:function(t){e.show.groupchoose=!0}}},[e._v(e._s(e.$ta("moveto","agroup")))]),e._v(" "),t("span",{staticClass:"elecTable_addbtn elecTable_addbtn--uncheck",on:{click:function(t){return e.taskCkall(t)}}},[e._v(e._s(e.$ta("cancel","checked","task")))]),e._v(" "),t("span",{staticClass:"elecTable_addbtn greenbk",on:{click:function(t){return e.taskStart(e.taskChecklist)}}},[e._v(e._s(e.$ta("start","checked","task")))]),e._v(" "),t("span",{staticClass:"elecTable_addbtn elecTable_addbtn--stop",on:{click:function(t){return e.taskStop(e.taskChecklist)}}},[e._v(e._s(e.$ta("stop","checked","task")))]),e._v(" "),t("span",{staticClass:"elecTable_addbtn elecTable_addbtn--clear",on:{click:function(t){return e.taskDelete(e.taskChecklist)}}},[e._v(e._s(e.$ta("delete","checked","task"))+" "+e._s(e.taskChecklist.length))])])])]),e._v(" "),t("tbody",e._l(e.sublist,(function(s,i,n){return t("tr",{key:i,class:{"elecTable_tr--selected":e.subimport.tid===i}},[t("td",{staticClass:"elecTable_td"},[t("input",{staticClass:"echeckbox",attrs:{type:"checkbox"},on:{change:function(t){return e.tasksubCheck(i,t)}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model",value:s.name,expression:"titem.name"}],staticClass:"elecTable_input",attrs:{placeholder:"订阅名称"},domProps:{value:s.name},on:{input:function(t){t.target.composing||e.$set(s,"name",t.target.value)}}})]),e._v(" "),t("td",{staticClass:"elecTable_td",class:{greenbk:"none"!==s.update_type},attrs:{title:"自动更新订阅任务"}},[t("select",{directives:[{name:"model",rawName:"v-model",value:s.update_type,expression:"titem.update_type"}],staticClass:"elecTable_select",on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s,"update_type",t.target.multiple?i:i[0])}}},[t("option",{attrs:{value:"none"}},[e._v(e._s(e.type_of_time.noupdate))]),e._v(" "),t("option",{attrs:{value:"cron"}},[e._v(e._s(e.type_of_time.cron))]),e._v(" "),t("option",{attrs:{value:"schedule"}},[e._v(e._s(e.type_of_time.schedule))])])]),e._v(" "),t("td",{staticClass:"elecTable_td",class:{greenbk:"none"!==s.update_type}},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.time,expression:"titem.time",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{"data-tid":i,placeholder:"自动更新时间"},domProps:{value:s.time},on:{input:function(t){t.target.composing||e.$set(s,"time",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td",attrs:{title:"同名任务更新方式"}},[t("select",{directives:[{name:"model",rawName:"v-model",value:s.job.type,expression:"titem.job.type"}],staticClass:"elecTable_select",on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s.job,"type",t.target.multiple?i:i[0])}}},e._l(e.subselect,(function(s,i){return t("option",{key:i,domProps:{value:i}},[e._v(e._s(s))])})),0)]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model",value:s.job.target,expression:"titem.job.target"}],staticClass:"elecTable_input",attrs:{placeholder:"订阅链接,不兼容其他软件的订阅格式。请勿添加不信任的来源链接"},domProps:{value:s.job.target},on:{input:function(t){t.target.composing||e.$set(s.job,"target",t.target.value)}}})]),e._v(" "),t("td",{staticClass:"elecTable_td",attrs:{colspan:"2"}},[t("button",{staticClass:"elecBtn",on:{click:function(t){return e.subGet(s.job.target,i)}}},[e._v(e._s(e.$t("fetch")))])]),e._v(" "),t("td",{staticClass:"elecTable_td minw62"},[t("span",{staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.delete)},on:{click:function(t){return e.subDelete(i)}}})])])})),0),e._v(" "),t("tbody",{directives:[{name:"show",rawName:"v-show",value:1===e.subeishow,expression:"subeishow === 1"}],staticClass:"border_top"},[t("tr",[t("td",{staticClass:"elecTable_td",attrs:{colspan:"6"}},[t("div",{staticClass:"subdetail_head"},[t("label",{staticClass:"subdetail_label"},[e._v(e._s(e.$ta("sub","name"))+": ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:e.subexport.name,expression:"subexport.name",modifiers:{lazy:!0,trim:!0}}],staticClass:"elecTable_input subdetail_name",attrs:{placeholder:"elecV2P 定时任务订阅"},domProps:{value:e.subexport.name},on:{change:function(t){e.$set(e.subexport,"name",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("label",{staticClass:"subdetail_label"},[e._v(e._s(e.$ta("sub","note"))+": ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:e.subexport.note,expression:"subexport.note",modifiers:{lazy:!0,trim:!0}}],staticClass:"elecTable_input subdetail_note",attrs:{placeholder:"这是一个适用于 elecV2P 的定时任务订阅。请不要添加未知来源的订阅"},domProps:{value:e.subexport.note},on:{change:function(t){e.$set(e.subexport,"note",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})])]),e._v(" "),t("td",{staticClass:"elecTable_td",attrs:{colspan:"3"}},[t("button",{staticClass:"elecBtn greenbk",on:{click:function(t){return e.taskExportDownload()}}},[e._v(e._s(e.$t("exportsub")))])])]),e._v(" "),t("tr",[t("td",{staticClass:"elecTable_td",attrs:{colspan:"9"}},[t("textarea",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:e.subexportstr,expression:"subexportstr",modifiers:{lazy:!0,trim:!0}}],staticClass:"editor_textarea subdetail_content",attrs:{placeholder:'订阅内容格式如下: \n{\n name: "订阅名称",\n note: "订阅描述,可省略。不兼容其他软件的订阅格式。详细说明参考: https://github.com/elecV2/elecV2P-dei/tree/master/docs/06-task.md",\n list: [\n {\n "name": "清空日志",\n "type": "cron",\n "time": "30 59 23 * * *",\n "job": {\n "type": "runjs",\n "target": "https://raw.githubusercontent.com/elecV2/elecV2P/master/script/JSFile/deletelog.js"\n }\n }\n ]\n}'},domProps:{value:e.subexportstr},on:{change:function(t){e.subexportstr=t.target.value.trim()},blur:function(t){return e.$forceUpdate()}}})])])]),e._v(" "),t("tbody",{directives:[{name:"show",rawName:"v-show",value:2===e.subeishow,expression:"subeishow === 2"}],staticClass:"border_top"},[t("tr",[t("td",{staticClass:"elecTable_td",attrs:{colspan:"6"}},[t("div",{staticClass:"subdetail_head"},[t("label",{staticClass:"subdetail_label"},[e._v(e._s(e.$ta("sub","name"))+": ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.subimport.name,expression:"subimport.name",modifiers:{trim:!0}}],staticClass:"elecTable_input subdetail_name",attrs:{placeholder:"elecV2P 定时任务订阅"},domProps:{value:e.subimport.name},on:{input:function(t){t.target.composing||e.$set(e.subimport,"name",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}}),e._v(" "),t("label",{staticClass:"subdetail_label"},[e._v(e._s(e.$ta("sub","note"))+": ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:e.subimport.note,expression:"subimport.note",modifiers:{lazy:!0,trim:!0}}],staticClass:"elecTable_input subdetail_note",attrs:{placeholder:"elecV2P 定时任务订阅。请不要添加未知来源的订阅"},domProps:{value:e.subimport.note},on:{change:function(t){e.$set(e.subimport,"note",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})])]),e._v(" "),t("td",{staticClass:"elecTable_td",attrs:{colspan:"2",title:"绿色背景: 任务添加时即开始定时"}},[t("button",{staticClass:"elecBtn greenbk",on:{click:function(t){return e.subAll()}}},[e._v(e._s(e.tasksubChecklist.length?e.$ta("add","checked_short"):e.$ta("add","all")))])]),e._v(" "),t("td",{staticClass:"elecTable_td minw62"},[t("span",{staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.delete)},on:{click:function(t){return e.subClear()}}})])]),e._v(" "),e._l(e.subimport.list,(function(s,i){return t("tr",{key:i,class:{"elecTable_tr--selected":-1!==e.tasksubChecklist.indexOf(i)}},[t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.tasksubChecklist,expression:"tasksubChecklist"}],staticClass:"echeckbox",attrs:{type:"checkbox"},domProps:{value:i,checked:Array.isArray(e.tasksubChecklist)?e._i(e.tasksubChecklist,i)>-1:e.tasksubChecklist},on:{change:function(t){var s=e.tasksubChecklist,n=t.target,a=!!n.checked;if(Array.isArray(s)){var r=i,o=e._i(s,r);n.checked?o<0&&(e.tasksubChecklist=s.concat([r])):o>-1&&(e.tasksubChecklist=s.slice(0,o).concat(s.slice(o+1)))}else e.tasksubChecklist=a}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:s.name,expression:"titem.name",modifiers:{lazy:!0,trim:!0}}],staticClass:"elecTable_input",domProps:{value:s.name},on:{change:function(t){e.$set(s,"name",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("select",{directives:[{name:"model",rawName:"v-model",value:s.type,expression:"titem.type"}],staticClass:"elecTable_select",on:{change:[function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s,"type",t.target.multiple?i:i[0])},function(e){s.time="cron"===s.type?"30 10 0 * * *":"schedule"===s.type?"3 2 3 2":""}]}},[t("option",{attrs:{value:"cron"}},[e._v(e._s(e.type_of_time.cron))]),e._v(" "),t("option",{attrs:{value:"schedule"}},[e._v(e._s(e.type_of_time.schedule))])])]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:s.time,expression:"titem.time",modifiers:{lazy:!0,trim:!0}}],staticClass:"elecTable_input",domProps:{value:s.time},on:{change:function(t){e.$set(s,"time",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td task_select"},[t("select",{directives:[{name:"model",rawName:"v-model",value:s.job.type,expression:"titem.job.type"}],staticClass:"elecTable_select",on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s.job,"type",t.target.multiple?i:i[0])}}},e._l(e.jobtype_select,(function(s,i){return t("option",{key:i,domProps:{value:i}},[e._v(e._s(s))])})),0)]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.lazy.trim",value:s.job.target,expression:"titem.job.target",modifiers:{lazy:!0,trim:!0}}],staticClass:"elecTable_input",domProps:{value:s.job.target},on:{change:function(t){e.$set(s.job,"target",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td",class:{greenbk:!1!==s.running},attrs:{colspan:"3"}},[t("button",{staticClass:"elecBtn",on:{click:function(t){return t.preventDefault(),e.subTaskAdd(s)}}},[e._v(e._s(e.$t("add","task")))])])])})),e._v(" "),t("tr",{directives:[{name:"show",rawName:"v-show",value:e.subimport.author||e.subimport.date||e.subimport.resource,expression:"(subimport.author || subimport.date || subimport.resource)"}]},[t("td",{staticClass:"elecTable_td elecTable_td--subinfo",attrs:{colspan:"9"}},[t("span",{},[e._v(e._s(e.subimport.author?e.$t("author")+": "+e.subimport.author:""))]),e._v(" "),t("span",{staticClass:"mleft30"},[e._v(e._s(e.subimport.date?e.$ta("update","date")+": "+e.subimport.date:""))]),e._v(" "),t("span",{staticClass:"mleft30"},[e._v(e._s(e.subimport.resource?e.$ta("update","address")+": "+e.subimport.resource:""))])])])],2)],2)]),e._v(" "),t("p",{staticClass:"center"},[t("button",{staticClass:"elecBtn elecBtn--long elecBtn--tasksave",on:{click:function(t){return e.taskSave()}}},[e._v(e._s(e.$t("save")))])]),e._v(" "),t("log",{attrs:{logs:e.logs,title:e.tasklogs,collapse:e.collapse}})],1),e._v(" "),t("footer",{staticClass:"footer"},[t("ul",[t("li",[t("strong",[e._v(e._s(e.type_of_time.cron))]),e._v(" "+e._s(e.$t("format").toLowerCase())+": (*) * * * * *("+e._s(e.$ta("five","or","six","cron","format").toLowerCase())+")")]),e._v(" "),t("li",[t("strong",[e._v(e._s(e.type_of_time.schedule))]),e._v(" "+e._s(e.$t("format").toLowerCase())+": 30 999 3 2("+e._s(e.$ta("countdown","seconds","/","repeat","times","/","random","seconds","/","random","times"))+")"),t("i",[e._v(e._s(e.$ta("last_three","optional")))])]),e._v(" "),t("li",[e._v(e._s(e.$ta("task","input","shortcut"))+": enter - "+e._s(e.$ta("start","task"))+" ctrl+enter - "+e._s(e.$ta("test","run","task"))+" alt+enter - "+e._s(e.$ta("open","task","run","logs")))]),e._v(" "),t("li",[e._v(e._s(e.$ta("more","detail"))+" "),t("a",{attrs:{href:"https://github.com/elecV2/elecV2P-dei/tree/master/docs/06-task.md",target:"elecV2PDoc"}},[e._v(e._s(e.$t("document"))+": 06-task.md")])])])])])};wo._withStripped=!0;var ko=function(){var e=this,t=e._self._c;return e.show.groupchoose?t("VueDragResize",{attrs:{className:"ediv",dragHandle:".ediv_title--name",parent:!0,"prevent-deactivation":!1,active:!0,w:"480",h:"92",z:"9",resizable:!1,draggable:!0,handles:["tl","tr","bl","br"],"lock-aspect-ratio":!1}},[t("h3",{staticClass:"ediv_title"},[t("span",{staticClass:"ediv_title--name"},[e._v("请选择分组")]),e._v(" "),t("span",{staticClass:"ediv_title--close",on:{click:function(t){e.show.groupchoose=!e.show.groupchoose}}},[e._v("x")])]),e._v(" "),t("div",{staticClass:"ediv_content"},[t("div",{staticClass:"mgselect"},[t("label",{staticClass:"elecTable_label mgselect_label"},[e._v("移动到此分组: ")]),e._v(" "),t("select",{directives:[{name:"model",rawName:"v-model",value:e.choose,expression:"choose"}],staticClass:"elecTable_select mgselect_choose",on:{change:function(t){var s=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.choose=t.target.multiple?s:s[0]}}},[t("option",{attrs:{value:"new"}},[e._v("新的分组")]),e._v(" "),t("option",{attrs:{value:"none"}},[e._v("不属于任何分组")]),e._v(" "),e._l(e.gpoptions,(function(s,i){return t("option",{key:i,domProps:{value:i}},[e._v(e._s(s))])}))],2),e._v(" "),t("button",{staticClass:"elecBtn greenbk",on:{click:function(t){return e.groupChoose()}}},[e._v("确定")])])])]):e._e()};ko._withStripped=!0;var Co=s(432),xo=s.n(Co);const To=ka({name:"movegroup",props:["show","gpoptions"],components:{VueDragResize:xo()},data:()=>({choose:"new"}),methods:{groupChoose(){this.$emit("choose",this.choose)}}},ko,[],!1,null,"05f31d25",null).exports,So={name:"task",data(){return{tasklists:{},subexport:{},subimport:{},taskimorn:!1,taskimtid:"",subeishow:0,taskstatus:"",jobtype_select:{runjs:this.$t("run")+" JS",exec:"SHELL "+this.$t("cmd"),taskstart:this.$ta("start","task"),taskstop:this.$ta("stop","","task")},subselect:{skip:this.$t("skip"),replace:this.$t("replace"),addition:this.$t("addition")},type_of_time:{cron:this.$t("cron"),schedule:this.$t("countdown"),noupdate:this.$t("noupdate")},logs:[],icon:wa,taskChecklist:[],tasksubChecklist:[],menu:{pos:[0,0],list:[]},show:{groupchoose:!1},search:"",collapse:{loginfo:!0},tasklogs:this.$ta("task","run","logs")}},components:{log:tr,contextmenu:Or,movegroup:To},computed:{normlist(){let e={};for(let t in this.tasklists)if(this.tasklists[t])switch(this.tasklists[t].type){case"cron":case"schedule":e[t]=this.tasklists[t]}return e},tnamelist(){let e={};for(let t in this.normlist)e[this.normlist[t].name]=t;return e},gnamelist(){let e={};for(let t in this.tasklists)"group"===this.tasklists[t].type&&(e[t]=this.tasklists[t].name);return e},sublist(){let e={};for(let t in this.tasklists)"sub"===this.tasklists[t].type&&(e[t]=this.tasklists[t]);return e},searchlist(){if(!this.search)return this.tasklists;let e={},t=new RegExp(this.search);for(let s in this.normlist)t.test(this.normlist[s].name+this.normlist[s].time+this.normlist[s].job.target)&&(e[s]=this.normlist[s]);return e},grouplist(){let e={},t={},s={running:0,total:0,sub:Object.keys(this.sublist).length};for(let i in this.searchlist){if("sub"===this.searchlist[i].type){this.searchlist[i].update_type||(this.searchlist[i].update_type="none");continue}if("group"===this.searchlist[i].type){e[i]||(e[i]={},this.searchlist[i].total=0,this.searchlist[i].active=0,this.searchlist[i].bkcolor||(this.searchlist[i].bkcolor=this.$uStr.randomColor({max:200})),void 0===this.searchlist[i].collapse&&(this.searchlist[i].collapse=!1));continue}s.total++,this.searchlist[i].running&&s.running++;let n=this.searchlist[i].group;n&&this.searchlist[n]&&"group"===this.searchlist[n].type?(e[n]||(e[n]={},this.searchlist[n].total=0,this.searchlist[n].active=0,this.searchlist[n].bkcolor||(this.searchlist[n].bkcolor=this.$uStr.randomColor({max:200})),void 0===this.searchlist[n].collapse&&(this.searchlist[n].collapse=!1)),this.searchlist[n].collapse||(e[n][i]=this.searchlist[i]),this.searchlist[n].total++,this.searchlist[i].running&&this.searchlist[n].active++):t[i]=this.searchlist[i]}return this.taskstatus=s.running+"/"+s.total+"/"+s.sub,e.normal=t,e},subexportstr:{get(){return JSON.stringify(this.subexport,null,2)},set(e){let t=this.$sJson(e);t?Object.assign(this.subexport,t):this.$message.error("订阅内容格式不正确, 已自动退回到修改前内容",10)}},taskChecked:{get(){let e=[];return this.taskChecklist.forEach((t=>{e[t]=!0})),e},set(e){"all"===e?this.taskChecklist=Object.keys(this.search?this.searchlist:this.normlist):"none"===e?this.taskChecklist=[]:this.normlist[e]&&-1===this.taskChecklist.indexOf(e)&&this.taskChecklist.push(e)}}},watch:{taskimorn(e){!1===e?this.$delete(this.tasklists,"localtemp"):this.taskimtid=Object.keys(this.sublist)[0]}},created(){this.taskInit();let e=this.$wsrecv.add("tasklog",(e=>{this.logs.length>=200||/\x1b\[H/.test(e)?this.logs=[e]:/\r|(\x1b\[F)/.test(e)?this.logs.splice(0,1,e):this.logs.unshift(e)}));e&&this.logs.unshift(`[${this.$logHead("websocket error")}][${this.$sTime(null,1)}] ${e}, 日志无法传输`),this.$wsrecv.add("task",(e=>{if("init"!==e.op)if(this.tasklists[e.tid])switch(e.op){case"start":this.$set(this.tasklists[e.tid],"running",!0);break;case"stop":this.$set(this.tasklists[e.tid],"running",!1);break;default:console.error("unknow task operation")}else e.tid&&e.taskinfo&&this.taskCheck(e.taskinfo)?this.tasklists[e.tid]=e.taskinfo:console.error("任务暂不存在",e);else this.taskInit()}))},methods:{taskInit(){const e=this.$message.loading("获取任务列表中...",0);this.$axios.get("/task").then((e=>{if(-1===e.data.rescode)return this.$message.error("获取任务列表失败",e.data.message),void this.logs.unshift(`[${this.$logHead("taskInit info")}][${this.$sTime(null,1)}] 获取任务列表失败: ${e.data.message}`);this.tasklists=e.data||{},this.subexport={},this.subimport={},this.subeishow=0,console.debug(`[${this.$logHead("taskInit info")}][${this.$sTime(null,1)}]`,"当前 elecV2P 任务分组数",Object.keys(this.grouplist).length-1),this.$message.success("成功获取任务列表",this.taskstatus),this.logs.unshift(`[${this.$logHead("taskInit info")}][${this.$sTime(null,1)}] 成功获取任务列表: ${this.taskstatus}`)})).catch((e=>{this.$message.error("获取任务列表失败",e.message),this.logs.unshift(`[${this.$logHead("taskInit error")}][${this.$sTime(null,1)}] 获取任务列表失败: ${e.message}`),console.error("获取任务列表失败",e)})).finally(e)},taskNewId(e=8){let t=this.$uStr.euid(e);return this.tasklists[t]?this.taskNewId():t},taskNew(e=this.taskNewId()){let t={},s={};Math.random()>.6?(t.type="schedule",t.time="3 2 2"):(t.type="cron",t.time="20 10 0 * * *"),Math.random()<.5?(s.type="runjs",s.target="test.js"):(s.type="exec",s.target="node -v"),this.$set(this.tasklists,e,{id:e,name:this.$ta("new","task")+(Object.keys(this.normlist).length+1),type:t.type,time:t.time,job:s,running:!1})},taskCheck(e){if(!e)return this.$message.error("请输入任务内容"),this.logs.unshift(`[${this.$logHead("taskAdd error")}][${this.$sTime(null,1)}] 没有任何任务信息`),!1;if(!e.name)return this.$message.error("请输入任务名"),this.logs.unshift(`[${this.$logHead("taskAdd error")}][${this.$sTime(null,1)}] 没有任务名称`),!1;if(!/schedule|cron/.test(e.type))return this.$message.error("非法任务类型",e.type),this.logs.unshift(`[${this.$logHead("taskAdd error")}][${this.$sTime(null,1)}] ${e.name} 任务类型 ${e.type} 有误`),!1;let t=e.time.split(" ");return"cron"===e.type&&5!==t.length&&6!==t.length?(this.$message.error(e.time,"不符合 cron 时间格式标准"),this.logs.unshift(`[${this.$logHead("taskAdd error")}][${this.$sTime(null,1)}] ${e.name} 时间: ${e.time} 不符合 cron 时间格式标准`),!1):"schedule"===e.type&&t.filter((e=>/^\d+$/.test(e))).length!==t.length?(this.$message.error(e.time,"不符合",this.type_of_time.schedule,"时间格式标准"),this.logs.unshift(`[${this.$logHead("taskAdd error")}][${this.$sTime(null,1)}] ${e.name} 时间: ${e.time} 不符合 ${this.type_of_time.schedule} 时间格式标准`),!1):!!(e.job&&e.job.type&&e.job.target)||(this.$message.error("任务内容填写不完整"),this.logs.unshift(`[${this.$logHead("taskAdd error")}][${this.$sTime(null,1)}] ${e.name} 任务内容填写不完整`),!1)},taskStart(e){let t,s="array"===this.$sType(e);if(s)t=[],e.forEach((e=>{this.taskCheck(this.tasklists[e])&&(this.tasklists[e].id=e,this.tasklists[e].running=!0,t.push(this.tasklists[e]))}));else{if(!this.taskCheck(this.tasklists[e]))return;if(this.tasklists[e].running)return void this.$message.error(this.tasklists[e].name,"正在运行中");this.tasklists[e].id=e,this.tasklists[e].running=!0,t=this.tasklists[e]}let i=!1;const n=this.$message.loading("任务上传准备执行中...",0);this.$axios.put("/task",{op:"start",data:{task:t}}).then((e=>{0===e.data.rescode?this.$message.success("定时任务已开始"):i=e.data.message})).catch((e=>{console.error(e),i=e.message})).finally((()=>{n(),i&&(s||(this.tasklists[e].running=!1),this.$message.error("开始任务失败"),this.logs.unshift(`[${this.$logHead("taskStart error")}][${this.$sTime(null,1)}] 开始任务执行失败: ${i}`))}))},taskStop(e){let t="array"===this.$sType(e);if(!t){if(!1===this.tasklists[e].running)return void this.$message.success(this.tasklists[e].name,"已停止,无需任何操作");this.tasklists[e].running=!1}let s=!1;const i=this.$message.loading("任务停止命令执行中...",0);this.$axios.put("/task",{op:"stop",data:{tid:e}}).then((e=>{0===e.data.rescode?this.$message.success("相关定时任务已停止"):s=e.data.message})).catch((e=>{s=e.message,console.error(e)})).finally((()=>{i(),s&&(t||(this.tasklists[e].running=!0),this.$message.error("停止任务失败"),this.logs.unshift(`[${this.$logHead("taskStop error")}][${this.$sTime(null,1)}] 停止任务失败: ${s}`))}))},taskDelete(e){if("array"===this.$sType(e)){if(confirm(`确定删除这 ${e.length} 个定时任务?`)){const t=this.$message.loading("定时任务批量删除中...",0);this.$axios.put("/task",{op:"delete",data:{tid:e}}).then((t=>{0===t.data.rescode?(this.$message.success("定时任务批量删除完成"),e.forEach((e=>this.$delete(this.tasklists,e))),this.logs.unshift(`[${this.$logHead("taskDelete info")}][${this.$sTime(null,1)}] 定时任务批量删除完成`),this.taskChecked="none"):(this.$message.error("定时任务批量删除失败"),this.logs.unshift(`[${this.$logHead("taskDelete error")}][${this.$sTime(null,1)}] 定时任务批量删除失败 ${t.data.message}`))})).catch((e=>{this.$message.error("定时任务批量删除失败",e.message),this.logs.unshift(`[${this.$logHead("taskDelete error")}][${this.$sTime(null,1)}] 定时任务批量删除: ${e.message}`),console.error(e)})).finally(t)}}else if(confirm(`确定删除任务 ${this.tasklists[e].name}?`)){const t=this.$message.loading("定时任务",this.tasklists[e].name,"删除中...",0);this.$axios.put("/task",{op:"delete",data:{tid:e}}).then((t=>{0===t.data.rescode?(this.$message.success("成功删除任务:",this.tasklists[e].name),this.logs.unshift(`[${this.$logHead("taskDelete info")}][${this.$sTime(null,1)}] 成功删除任务: ${this.tasklists[e].name}`),this.$delete(this.tasklists,e)):(this.$message.error("任务:",this.tasklists[e].name,"删除失败"),this.logs.unshift(`[${this.$logHead("taskDelete error")}][${this.$sTime(null,1)}] 任务: ${this.tasklists[e].name} 删除失败 ${t.data.message}`))})).catch((e=>{this.$message.error("删除任务失败",e.message),this.logs.unshift(`[${this.$logHead("taskDelete error")}][${this.$sTime(null,1)}] 删除任务失败: ${e.message}`),console.error(e)})).finally(t)}},taskSave(){this.search="";const e=this.$message.loading("正在保存当前任务列表...",0);this.$axios.post("/task",this.tasklists).then((e=>{-1===e.data.rescode?(this.$message.error("当前任务列表保存失败"),this.logs.unshift(`[${this.$logHead("taskSave error")}][${this.$sTime(null,1)}] 当前任务列表保存失败:${e.data.message}`)):(this.$message.success("当前任务列表已保存",this.taskstatus),this.logs.unshift(`[${this.$logHead("taskSave info")}][${this.$sTime(null,1)}] 当前任务列表已保存 ${this.taskstatus},将在 elecV2P 下次启动时自动恢复`))})).catch((e=>{console.error(e),this.$message.error("当前任务列表保存失败",e.message),this.logs.unshift(`[${this.$logHead("taskSave error")}][${this.$sTime(null,1)}] 当前任务列表保存失败:${e.message}`)})).finally(e)},taskStartDelegate(e){let t=e.target.dataset.tid;t&&this.taskStart(t)},taskTest(e){let t=e.target?e.target.dataset.tid:e;if(!t)return;if(!this.taskCheck(this.tasklists[t]))return;let s=this.tasklists[t].running;this.tasklists[t].running=!0;const i=this.$message.loading("任务测试运行中...",0);this.logs.unshift(`[${this.$logHead("taskStart info")}][${this.$sTime(null,1)}] 立即测试运行定时任务: ${this.tasklists[t].name}`),this.collapse.loginfo=!1,this.$axios.put("/task",{op:"test",data:{tid:"totest",task:this.tasklists[t]}}).then((e=>{let s=this.$sString(e.data.message)||"无";this.$message.success(this.tasklists[t].name,"测试运行结果:",s),this.logs.unshift(`[${this.$logHead("taskTest info")}][${this.$sTime(null,1)}] ${this.tasklists[t].name} 测试运行结果: ${s}`)})).catch((e=>{console.error(e),this.$message.error(this.tasklists[t].name,"测试运行失败",e.message),this.logs.unshift(`[${this.$logHead("taskTest error")}][${this.$sTime(null,1)}] ${this.tasklists[t].name} 测试运行失败: ${e.message}`)})).finally((()=>{i(),this.tasklists[t].running=s}))},taskLog(e){let t=e.target?e.target.dataset.tid:e;t&&(this.tasklists[t]?"runjs"===this.tasklists[t].job.type?/^https?:\/\/\S{4}/.test(this.tasklists[t].job.target)?this.$uApi.open(`./logs/${this.$uStr.surlName(this.tasklists[t].job.target.split(" ")[0])}.log`):this.$uApi.open(`./logs/${this.tasklists[t].job.target.split(" ")[0].replace(/\/|\\/g,"-")}.log`):"exec"===this.tasklists[t].job.type?this.$uApi.open(`./logs/${this.tasklists[t].name}.task.log`):this.$message.error("该任务类型不支持查看日志"):this.$message.error("任务不存在"))},subNew(e=this.taskNewId()){this.$set(this.tasklists,e,{name:this.$ta("task","sub")+(Object.keys(this.sublist).length+1),type:"sub",update_type:"none",time:"26 5 * * *",job:{type:"skip",target:""}})},async subGet(e,t){if(!e||!/^https?:\/\/\S{4}|^\/?efss\//.test(e))return void this.$message.error("请输入正确的订阅地址",6);if(!/\.json$/.test(e)&&!confirm("该订阅内容可能并不是 JSON 格式,确认继续?"))return;let s=this.$message.loading("正在获取订阅信息...",0),i="";try{i=await this.$axios.get(e,{crossdomain:!0})}catch(t){if(this.logs.unshift(`[${this.$logHead("taskSub error")}][${this.$sTime(null,1)}] 获取订阅信息失败 ${t.message}`),t.response)return s(),this.$message.error(`获取订阅内容失败,服务器返回状态码 ${t.response.status}`),void console.debug(`获取订阅内容失败,服务器返回状态码 ${t.response.status}`,t.response.data);if(/^https?:\/\/\S{4}/.test(e)){this.logs.unshift(`[${this.$logHead("taskSub info")}][${this.$sTime(null,1)}] 即将尝试从服务器端获取该订阅内容`),this.$message.error("获取订阅信息失败",t.message,"即将尝试从服务器端获取该订阅内容");try{i=await this.$axios.get("/data?type=stream&url="+e)}catch(t){return s(),this.$message.error("获取订阅信息失败",t.message,"请检测网络后重试"),void this.logs.unshift(`[${this.$logHead("taskSub error")}][${this.$sTime(null,1)}] 从 ${e} 获取订阅信息失败 ${t.message},请检测网络后重试`)}}}if(200!==i.status||-1===i.data.rescode)return s(),this.logs.unshift(`[${this.$logHead("taskSub error")}][${this.$sTime(null,1)}] 该订阅链接 ${e} 返回结果有误 ${this.$sString(i.data)} 请确认输入地址是否正确`),this.$message.error("该订阅返回状态不正确,请确认当前网络环境或输入地址是否正常"),void console.error(i);s();let n=this.$sJson(i.data);n&&n.name&&n.list?("localtemp"===t&&(t=this.taskNewId(),this.$set(this.tasklists,t,this.tasklists.localtemp)),n.tid=t,n.resource=n.resource||n.surl,n.note=n.note||n.desc,this.subimport=n,this.taskimorn=!1,this.subeishow=2,this.$message.success("成功获取订阅信息"),this.logs.unshift(`[${this.$logHead("taskSub info")}][${this.$sTime(null,1)}] 成功获取订阅 ${n.name} 内容`),n.time&&!this.sublist[t].time&&(this.sublist[t].time=n.time,this.sublist[t].update_type=n.update_type||n.type||"none"),"定时任务订阅"===this.sublist[t].name&&(this.sublist[t].name=n.name)):(this.$message.error("该订阅内容无法解析"),this.logs.unshift(`[${this.$logHead("taskSub error")}][${this.$sTime(null,1)}] 该订阅 ${e} 内容并不符合 elecV2P 订阅格式,请确认订阅链接及内容无误后再次添加`))},subDelete(e){if(this.subimport.tid===e)return this.subeishow=0,void(this.subimport.tid=null);if(!this.tasklists[e].job.target||confirm("确定删除订阅:"+this.tasklists[e].name+" (并不会删除相关任务)")){const t=this.$message.loading(this.tasklists[e].name,"删除中...",0);this.$axios.put("/task",{op:"delete",data:{tid:e}}).then((t=>{this.$message.success("成功删除订阅:",this.tasklists[e].name),this.logs.unshift(`[${this.$logHead("taskSub info")}][${this.$sTime(null,1)}] 成功删除订阅: ${this.tasklists[e].name}`),this.$delete(this.tasklists,e)})).catch((e=>{console.error(e),this.$message.error("删除订阅失败",e.message),this.logs.unshift(`[${this.$logHead("taskSub error")}][${this.$sTime(null,1)}] 删除订阅失败 ${e.message}`)})).finally(t)}},subClear(){this.subeishow=0,this.subimport.tid=null,this.taskimorn&&(this.taskimorn=!1)},taskExport(){if(1===this.subeishow)return void(this.subeishow=0);let e={name:"elecV2P 定时任务订阅",author:"留个名字",note:"xx 导出的任务订阅。该订阅适用于 elecV2P,与其他软件并不兼容。相关说明参考:https://github.com/elecV2/elecV2P-dei/tree/master/docs/06-task.md",date:this.$sTime(),type:"task",list:[]};if(this.taskChecklist.length)this.taskChecklist.forEach((t=>{this.normlist[t]&&this.normlist[t].name&&this.normlist[t].time&&this.normlist[t].job&&e.list.push({name:this.normlist[t].name,type:this.normlist[t].type,time:this.normlist[t].time,running:this.normlist[t].running,job:this.normlist[t].job})}));else for(let t in this.normlist)e.list.push({name:this.normlist[t].name,type:this.normlist[t].type,time:this.normlist[t].time,running:this.normlist[t].running,job:this.normlist[t].job});this.subimport={},this.subexport=e,this.subeishow=1,this.taskimorn=!1},taskExportDownload(){this.subexport.name&&this.subexport.list?(this.$uApi.saveAsFile(this.subexport,this.subexport.name+".json"),this.logs.unshift(`[${this.$logHead("taskExport info")}][${this.$sTime(null,1)}] 成功导出订阅:${this.subexport.name}`)):(this.$message.error("订阅信息不完整"),this.logs.unshift(`[${this.$logHead("taskExport error")}][${this.$sTime(null,1)}] 订阅导出失败,订阅信息填写不完整`))},taskImport(){this.$uApi.getFile({accept:".json",type:"text"}).then((e=>{let t=e.content,s=this.$sJson(t);s&&s.name&&s.list?(s.resource=s.resource||s.surl,s.note=s.note||s.desc,this.subimport=s,this.subimport.tid="local",this.subeishow=2,0===Object.keys(this.sublist).length&&this.subNew("localtemp"),this.logs.unshift(`[${this.$logHead("taskImport info")}][${this.$sTime(null,1)}] 成功获取本地订阅: ${s.name}`),this.taskimorn=!0,this.$message.success("成功获取本地订阅任务列表")):(console.error("elecV2P 无法解析该订阅内容",t),this.$message.error("该订阅内容无法解析"),this.logs.unshift(`[${this.$logHead("taskImport error")}][${this.$sTime(null,1)}] 导入的本地订阅内容并不符合 elecV2P 订阅格式,请尝试修改后再次添加\n${this.$sString(t).slice(-300)}`))})).catch((e=>{this.subimport={},console.debug(e)}))},async jsUpdate(){let e=[];if(this.taskChecklist.length)this.taskChecklist.forEach((t=>{this.tasklists[t]&&this.tasklists[t].job&&"runjs"===this.tasklists[t].job.type&&/^https?:\/\/\S{4}/.test(this.tasklists[t].job.target)&&e.push(this.tasklists[t].job.target.split(" ")[0])}));else for(let t in this.tasklists)this.tasklists[t]&&this.tasklists[t].job&&"runjs"===this.tasklists[t].job.type&&/^https?:\/\/\S{4}/.test(this.tasklists[t].job.target)&&e.push(this.tasklists[t].job.target.split(" ")[0]);if(e.length){if(confirm("共有 "+e.length+" 个远程脚本等待更新,确定继续?")){const t=this.$message.loading("正在更新远程 JS...",0);for(let t of e){this.logs.unshift(`[${this.$logHead("taskJSUP info")}][${this.$sTime(null,1)}] 开始更新下载 ${t}`);let e=await this.$axios.put("/jsfile",{op:"jsdownload",name:this.$uStr.surlName(t),url:t}).catch((e=>this.$message.error(e.message)));0===e.data.rescode?this.logs.unshift(`[${this.$logHead("taskJSUP info")}][${this.$sTime(null,1)}] 更新完成 ${e.data.message} `):this.logs.unshift(`[${this.$logHead("taskJSUP error")}][${this.$sTime(null,1)}] 更新失败 ${e.data.message} `)}t(),this.$message.success("全部远程脚本更新完成")}}else{const e=this.$ta("current","")+(this.taskChecklist.length?this.$ta("checked","task"):this.$ta("task","list"))+this.$ta("","dthave","remote","script");this.$message.error(e),this.logs.unshift(`[${this.$logHead("taskJSUP error")}][${this.$sTime(null,1)}] ${e}`)}},subTaskForm(e,{type:t="skip",belong:s}){if(!this.taskCheck(e))return!1;if(!e.id)if(this.tnamelist[e.name])if(this.logs.unshift(`[${this.$logHead("taskSubAdd info")}][${this.$sTime(null,1)}] 检测到同名任务: ${e.name},当前同名任务更新方式为: ${this.subselect[t]}`),"replace"===t)e.id=this.tnamelist[e.name];else{if("addition"!==t)return this.logs.unshift(`[${this.$logHead("taskSubAdd info")}][${this.$sTime(null,1)}] 跳过添加同名任务: ${e.name}`),!1;e.id=this.taskNewId()}else e.id=this.taskNewId();return!1!==e.running&&(e.running=!0),s&&"local"!==s&&(e.belong=s),e},subTaskAdd(e){let t=this.subimport.tid,s="";if("local"===t)s=this.sublist[this.taskimtid].job.type;else{if(!this.sublist[t]||!this.sublist[t].job)return Promise.reject("未知错误,订阅可能不存在");s=this.sublist[t].job.type}let i=[],n=e=>{let n=this.subTaskForm(e,{type:s,belong:t});n&&i.push(n)};if("array"===this.$sType(e)?e.forEach((e=>n(e))):n(e),0===i.length){let e="没有新的任务需要添加";return this.$message.success(e),this.logs.unshift(`[${this.$logHead("taskSubAdd info")}][${this.$sTime(null,1)}] ${e}`),Promise.resolve(e)}let a=this.$message.loading("正在添加定时任务...",0);return new Promise(((e,t)=>{this.$axios.put("/task",{op:"add",data:{task:i,type:s}}).then((e=>{0===e.data.rescode?(this.$message.success("定时任务添加成功"),this.logs.unshift(`[${this.$logHead("taskSubAdd info")}][${this.$sTime(null,1)}] 定时任务添加完成`),JSON.parse(JSON.stringify(i)).forEach((e=>{this.$set(this.tasklists,e.id,e)}))):(this.$message.error("定时任务添加失败"),this.logs.unshift(`[${this.$logHead("taskSubAdd error")}][${this.$sTime(null,1)}] 添加定时任务失败 ${e.data.message}`))})).catch((e=>{console.error(e),this.$message.error("定时任务添加失败",e.message),this.logs.unshift(`[${this.$logHead("taskSubAdd error")}][${this.$sTime(null,1)}] 添加定时任务失败 ${e.message}`)})).finally((()=>{e(),a()}))}))},subAll(){if(this.subimport.list&&this.subimport.list.length){let e=[];this.tasksubChecklist.length?this.tasksubChecklist.forEach((t=>{e.push(this.subimport.list[t])})):e=this.subimport.list,this.logs.unshift(`[${this.$logHead("taskSubAdd info")}][${this.$sTime(null,1)}] 开始添加订阅 ${this.subimport.name} 中的任务`),this.subTaskAdd(e).catch((e=>this.$message.error(e))).finally((()=>{this.tasksubChecklist=[]}))}else this.$message.error("并没有可以导入的定时任务"),this.logs.unshift(`[${this.$logHead("taskSubAdd error")}][${this.$sTime(null,1)}] 当前订阅列表为空`)},tasksubCheck(e,t){if(e&&t)if(t.target.checked){let t=JSON.parse(JSON.stringify(this.normlist)),s=!0;this.taskChecklist.forEach((e=>{t[e]=-1}));for(let i in t){t[i].belong===e&&(this.taskChecklist.push(i),s&&(s=!1))}s&&this.$message.success("列表中暂时还没有该订阅内的定时任务")}else this.taskChecklist=this.taskChecklist.filter((t=>this.tasklists[t]&&this.tasklists[t].belong!==e))},taskCkall(e){this.taskChecked=e.target.checked?"all":"none"},taskMenu(e,t){let s=[],i=this.taskTest,n=this.taskLog;if(s.push({label:"立即测试运行",bkcolor:"var(--icon-bk)",click(){i(t)}},{label:"查看任务日志",click(){n(t)}}),"runjs"===this.tasklists[t].job.type){let e=this.tasklists[t].job.target.split(" ")[0],i=this.$uApi.store.setCache;s.push({label:"查看脚本内容",method:"nav",param:"jsmanage",click(){i("scriptview",e)}})}this.menu={pos:this.$uApi.getCursorPos(e,160,32*s.length),list:s}},taskGroupCheck(e,t){if(e&&t)if(t.target.checked)for(let t in this.normlist)this.normlist[t].group===e&&(this.taskChecked=t);else this.taskChecklist=this.taskChecklist.filter((t=>this.normlist[t].group!==e))},taskGroupDelete(e){if(!this.tasklists[e])return void this.$message.error("分组",e,"暂不存在");let t=this.tasklists[e].name,s=Object.keys(this.grouplist[e]);if(0===s.length||confirm("确定删除分组 "+t+"(并不会删除该分组下的任务)?")){const i=this.$message.loading(t,"删除中...",0);this.$axios.put("/task",{op:"delete",data:{tid:e}}).then((i=>{this.$message.success("成功删除分组",t,""+(s.length?s.length+"个任务已移动到普通列表":"")),this.logs.unshift(`[${this.$logHead("taskGroup info")}][${this.$sTime(null,1)}] 成功删除分组: ${t}`),s.forEach((e=>{this.$delete(this.normlist[e],"group")})),this.$delete(this.tasklists,e),console.debug(i.data)})).catch((e=>{console.error(e),this.$message.error("删除分组失败",e.message),this.logs.unshift(`[${this.$logHead("taskGroup error")}][${this.$sTime(null,1)}] 删除分组失败 ${e.message}`)})).finally(i)}},taskGroupOp(e){this.$set(this.tasklists[e],"collapse",!this.tasklists[e].collapse)},taskMoveToGroup(e){"new"===e&&(e=this.taskNewId(),this.$set(this.tasklists,e,{name:"新的分组 "+Object.keys(this.grouplist).length,type:"group",note:"关于该分组的一些备注说明",bkcolor:this.$uStr.randomColor({max:200}),collapse:!1})),"none"===e||this.tasklists[e]&&"group"===this.tasklists[e].type?(this.taskChecklist.forEach((t=>{"none"===e?this.$delete(this.tasklists[t],"group"):this.$set(this.tasklists[t],"group",e)})),this.$message.success("成功移动",this.taskChecklist.length,"个定时任务到","none"===e?"普通列表":this.tasklists[e].name),this.logs.unshift(`[${this.$logHead("taskGroup info")}][${this.$sTime(null,1)}] 成功移动 ${this.taskChecklist.length} 个定时任务到 ${"none"===e?"普通列表":this.tasklists[e].name},保存后生效`),this.show.groupchoose=!1,this.taskChecked="none"):this.$message.error("所选分组不存在,请重新选择")}}};const Oo=ka(So,wo,[],!1,null,"6e5c5756",null).exports;var Eo=function(){var e=this,t=e._self._c;return t("section",{on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.hostSave()):null}}},[t("header",{staticClass:"header"},[e._v(e._s(e.header))]),e._v(" "),t("main",{staticClass:"content"},[t("div",{staticClass:"mitmset",class:{"mitmset--close":!e.eproxy.enable}},[t("div",{staticClass:"mitmset_status emargin",class:{"mitmset--close":!e.eproxy.enable}},[e._v(e._s(e.$t("status"))+":"+e._s(e.$t(e.eproxy.enable?"enabled":"disabled")))]),e._v(" "),t("div",{staticClass:"mitmset_item emargin"},[t("label",[e._v("ANYPROXY "+e._s(e.$t("port"))+": "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.eproxy.port,expression:"eproxy.port"}],staticClass:"elecTable_input elecTable_input--number mitmset_bl1",attrs:{type:"number"},domProps:{value:e.eproxy.port},on:{input:function(t){t.target.composing||e.$set(e.eproxy,"port",t.target.value)}}})])]),e._v(" "),t("div",{staticClass:"mitmset_item emargin"},[t("label",[e._v("ANYPROXY "+e._s(e.$t("logs"))+": "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.eproxy.webPort,expression:"eproxy.webPort"}],staticClass:"elecTable_input elecTable_input--number mitmset_bl1",attrs:{type:"number"},domProps:{value:e.eproxy.webPort},on:{input:function(t){t.target.composing||e.$set(e.eproxy,"webPort",t.target.value)}}})])]),e._v(" "),t("button",{directives:[{name:"show",rawName:"v-show",value:!e.eproxy.enable,expression:"!eproxy.enable"}],staticClass:"elecBtn w220 greenbk emargin",on:{click:function(t){return e.eproxyToggle("open")}}},[e._v(e._s(e.$t("enable"))+" MITM")]),e._v(" "),t("button",{directives:[{name:"show",rawName:"v-show",value:e.eproxy.enable,expression:"eproxy.enable"}],staticClass:"elecBtn w220 elecBtn--stop emargin",on:{click:function(t){return e.eproxyToggle("close")}}},[e._v(e._s(e.$t("disable"))+" MITM")])]),e._v(" "),t("div",{staticClass:"etable"},[t("table",{staticClass:"elecTable",class:{"elecTable--disabled":!e.mitmhosteble.enable}},[t("caption",{staticClass:"elecTable_caption",class:{"elecTable--disabled":!e.mitmhosteble.enable}},[t("div",{staticClass:"eflex elecTable_caption--left"},[t("span",{attrs:{title:"按照下表进行解析(解析全部可使用单星号 *"}},[e._v(e._s(e.$t("enable"))+":")]),e._v(" "),t("checkbox",{attrs:{oCheck:e.mitmhosteble}})],1),e._v(" "),t("span",[e._v("MITM HOST "+e._s(e.$t("list"))+" - "+e._s(e.mitmhost.length))]),e._v(" "),t("span",{staticClass:"icon icon_caption--sync",attrs:{title:"刷新当前列表"},domProps:{innerHTML:e._s(e.icon.sync)},on:{click:function(t){return e.mitmInit()}}})]),e._v(" "),t("thead",[t("tr",[t("th",{staticClass:"elecTable_th elecTable_th--check",attrs:{title:"全选/全不选"}},[t("input",{staticClass:"echeckbox",attrs:{type:"checkbox"},on:{change:function(t){return e.mitmCkall(t)}}})]),e._v(" "),t("th",{staticClass:"elecTable_th minw320"},[e._v(e._s(e.$t("host")))]),e._v(" "),t("th",{staticClass:"elecTable_th elecTable_th--name"},[e._v(e._s(e.$t("note")))]),e._v(" "),t("th",{staticClass:"elecTable_th elecTable_th--enable"},[e._v(e._s(e.$t("enable_short")))]),e._v(" "),t("th",{staticClass:"elecTable_th minw62"},[e._v(e._s(e.$t("operate_short")))])])]),e._v(" "),t("tbody",e._l(e.mitmhost,(function(s,i){return t("tr",{key:i,class:{"elecTable_tr--disabled":!s.enable,"elecTable_tr--selected":e.mitmChecked[i]}},[t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.mitmCheck,expression:"mitmCheck"}],staticClass:"echeckbox",attrs:{type:"checkbox"},domProps:{value:String(i),checked:Array.isArray(e.mitmCheck)?e._i(e.mitmCheck,String(i))>-1:e.mitmCheck},on:{change:function(t){var s=e.mitmCheck,n=t.target,a=!!n.checked;if(Array.isArray(s)){var r=String(i),o=e._i(s,r);n.checked?o<0&&(e.mitmCheck=s.concat([r])):o>-1&&(e.mitmCheck=s.slice(0,o).concat(s.slice(o+1)))}else e.mitmCheck=a}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.host,expression:"host.host",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{type:"text",placeholder:"e.test.com"},domProps:{value:s.host},on:{input:function(t){t.target.composing||e.$set(s,"host",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s.note,expression:"host.note",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{type:"text",placeholder:"备注信息(可省略"},domProps:{value:s.note},on:{input:function(t){t.target.composing||e.$set(s,"note",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("checkbox",{attrs:{oCheck:s}})],1),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("span",{staticClass:"icon--op cursor",domProps:{innerHTML:e._s(e.icon.delete)},on:{click:function(t){return e.mhostDel(i)}}})])])})),0),e._v(" "),t("tfoot",[t("tr",[t("td",{staticClass:"center border_top1",attrs:{colspan:"5"}},[t("span",{directives:[{name:"show",rawName:"v-show",value:e.mitmCheck.length,expression:"mitmCheck.length"}],staticClass:"elecTable_addbtn elecTable_addbtn--clear",on:{click:function(t){return e.mhostDelCks()}}},[e._v(e._s(e.$ta("delete","checked")))]),e._v(" "),t("span",{staticClass:"elecTable_addbtn",on:{click:function(t){return e.mitmhost.push({host:"",enable:!0})}}},[e._v(e._s(e.$ta("add","host")))])])])])])]),e._v(" "),t("p",{staticClass:"center"},[t("button",{staticClass:"elecBtn elecBtn--long",on:{click:function(t){return e.hostSave()}}},[e._v(e._s(e.$t("save")))])]),e._v(" "),t("pac",{attrs:{config:e.config_pac}}),e._v(" "),t("div",{staticClass:"mitmcrt"},[t("h4",{staticClass:"mitmcrt_title"},[e._v(e._s(e.$ta("self-signed","root","certificate","manage")))]),e._v(" "),t("div",{staticClass:"eflex mitm_border"},[t("div",[t("label",{staticClass:"sfcrt_label"},[e._v(e._s(e.$t("certificate"))+": ")]),t("span",{staticClass:"sfcrt_info"},[e._v(e._s(e.crtinfo.commonName))])]),e._v(" "),t("div",[t("label",{staticClass:"sfcrt_label"},[e._v(e._s(e.$ta("valid","date"))+": ")]),t("span",{staticClass:"sfcrt_info"},[e._v(e._s(e.crtinfo.notBefore)+" "+e._s(e.$t("to"))+" "+e._s(e.crtinfo.notAfter))])]),e._v(" "),t("select",{directives:[{name:"show",rawName:"v-show",value:0===e.crtinfo.rescode,expression:"crtinfo.rescode === 0"},{name:"model",rawName:"v-model",value:e.crt_type,expression:"crt_type"}],staticClass:"elecTable_select minw160",on:{change:function(t){var s=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.crt_type=t.target.multiple?s:s[0]}}},[t("option",{attrs:{value:"crt"}},[e._v("CRT "+e._s(e.$t("certificate")))]),e._v(" "),t("option",{attrs:{value:"p12"}},[e._v("P12 "+e._s(e.$t("certificate")))]),e._v(" "),t("option",{attrs:{value:"dot"}},[e._v(".0 "+e._s(e.$t("certificate")))])]),e._v(" "),t("button",{staticClass:"elecBtn",attrs:{title:"下载当前使用的根证书文件"},on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.crtInstall()}}},[e._v(e._s(e.$ta("download","current","certificate")))]),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:function(t){t.preventDefault(),t.stopPropagation(),e.crthostshow=!e.crthostshow}}},[e._v(e._s(e.$ta("sign","host","certificate")))]),e._v(" "),t("div",{directives:[{name:"show",rawName:"v-show",value:e.crthostshow,expression:"crthostshow"}],staticClass:"sfcrt_self"},[t("label",{staticClass:"sfcrt_label"},[e._v(e._s(e.$t("host")))]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.crt_host,expression:"crt_host"}],staticClass:"elecTable_input sfcrt_host",attrs:{placeholder:"域名 比如 test.com"},domProps:{value:e.crt_host},on:{input:function(t){t.target.composing||(e.crt_host=t.target.value)}}}),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.crtHost()}}},[e._v(e._s(e.$ta("generate","and","download")))])])]),e._v(" "),t("div",{staticClass:"eflex mitm_border"},[t("label",{staticClass:"sfcrt_label"},[e._v(e._s(e.$ta("new","root","certificate"))+":")]),e._v(" "),t("div",[t("label",{staticClass:"sfcrt_label"},[e._v(e._s(e.$t("name"))+" ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.newcrt.commonName,expression:"newcrt.commonName"}],staticClass:"elecTable_input w220",attrs:{type:"text",name:"commonName",placeholder:"elecV2P (全英文字符)"},domProps:{value:e.newcrt.commonName},on:{input:function(t){t.target.composing||e.$set(e.newcrt,"commonName",t.target.value)}}})]),e._v(" "),t("div",{staticClass:"eflex"},[t("label",{staticClass:"sfcrt_label"},[e._v(e._s(e.$ta("force","replace"))+" ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.newcrt.overwrite,expression:"newcrt.overwrite"}],staticClass:"echeckbox",attrs:{type:"checkbox",name:"overwrite"},domProps:{checked:Array.isArray(e.newcrt.overwrite)?e._i(e.newcrt.overwrite,null)>-1:e.newcrt.overwrite},on:{change:function(t){var s=e.newcrt.overwrite,i=t.target,n=!!i.checked;if(Array.isArray(s)){var a=e._i(s,null);i.checked?a<0&&e.$set(e.newcrt,"overwrite",s.concat([null])):a>-1&&e.$set(e.newcrt,"overwrite",s.slice(0,a).concat(s.slice(a+1)))}else e.$set(e.newcrt,"overwrite",n)}}})]),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:function(t){return e.crtNew()}}},[e._v(e._s(e.$t("generate")))])]),e._v(" "),t("div",{staticClass:"eflex mitm_border"},[t("div",{staticClass:"eupload eupload--crt",attrs:{title:"根证书包含 rootCA.crt/rootCA.key 两部分"}},[t("input",{ref:"crtfiles",staticClass:"eupload_file eupload_file--crt",attrs:{type:"file",multiple:""},on:{change:function(t){return e.crtstoupload()}}}),e._v(" "),t("span",{directives:[{name:"show",rawName:"v-show",value:e.crtfiles.length,expression:"crtfiles.length"}],staticClass:"eupload_span"},[e._v(e._s(e.crtfilename))])]),e._v(" "),t("button",{staticClass:"elecBtn w220 emargin",on:{click:function(t){return e.crtUpload()}}},[e._v(e._s(e.$ta("start","upload")))])]),e._v(" "),t("div",{staticClass:"eflex mitm_border"},[t("button",{staticClass:"elecBtn minw320 emargin",attrs:{title:"清空 ANYPROXY temp cache 文件夹"},on:{click:function(t){return e.cacheClear()}}},[e._v(e._s(e.$ta("clear","cache","file")))]),e._v(" "),t("button",{staticClass:"elecBtn minw320 emargin",attrs:{title:"删除由根证书签发的其他域名证书"},on:{click:function(t){return e.crtClear()}}},[e._v(e._s(e.$ta("clear","host","certificate")))]),e._v(" "),t("button",{staticClass:"elecBtn minw320 greenbk",on:{click:function(t){return e.eproxyToggle("restart")}}},[e._v(e._s(e.$t("restart"))+" ANYPROXY")])])])],1),e._v(" "),e._m(0)])};Eo._withStripped=!0;var jo=function(){var e=this,t=e._self._c;return t("div",{staticClass:"pacset"},[t("div",{staticClass:"pacaddr eflex"},[t("label",{staticClass:"elabel",attrs:{title:"根据上面的 MITM HOST 列表自动生成 base on mitmhost list"}},[e._v("PAC "+e._s(e.$t("file")))]),e._v(" "),t("span",{staticClass:"elecBtn",on:{click:function(t){return e.pacCopy()}}},[e._v(e._s(e.config.addr))])]),e._v(" "),t("div",{staticClass:"pacproxy eflex emargin"},[t("label",{staticClass:"elabel",attrs:{title:"需要 MITM 的网络请求分流代理地址"}},[e._v(e._s(e.$t("proxy")))]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.config.proxy,expression:"config.proxy",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{placeholder:"127.0.0.1:8001"},domProps:{value:e.config.proxy},on:{input:function(t){t.target.composing||e.$set(e.config,"proxy",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("div",{staticClass:"pacproxy eflex emargin"},[t("label",{staticClass:"elabel",attrs:{title:"未匹配到的网络请求走向"}},[e._v(e._s(e.$t("non-matched")))]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model.trim",value:e.config.final,expression:"config.final",modifiers:{trim:!0}}],staticClass:"elecTable_input",attrs:{placeholder:"DIRECT"},domProps:{value:e.config.final},on:{input:function(t){t.target.composing||e.$set(e.config,"final",t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("button",{staticClass:"elecBtn",on:{click:function(t){return e.pacSave()}}},[e._v(e._s(e.$t("save")))])])};jo._withStripped=!0;const No={name:"mitm",props:["config"],data:()=>({}),methods:{pacCopy(){this.$uApi.copyToClipboard(this.config.addr+"?u="+Date.now()+"&token="),this.$message.success("成功复制 PAC 文件链接")},pacSave(){const e=this.$message.loading("正在更新 PAC 默认代理...",0);this.$axios.put("/pac",{proxy:this.config.proxy,final:this.config.final}).then((e=>{console.debug("PAC SAVE 返回结果",e.data),0===e.data.rescode?this.$message.success("成功更新 PAC 默认代理",e.data.message):this.$message.error("更新 PAC 默认代理失败",e.data.message)})).catch((e=>{this.$message.error("更新 PAC 默认代理失败",e.message),console.error(e)})).finally(e)}}};const Po={name:"mitm",props:[],data:()=>({header:"MITM",crtfiles:[],mitmhost:[],newcrt:{commonName:"elecV2P",overwrite:!1},crtinfo:{},mitmhosteble:{enable:!0},icon:wa,crt_type:"crt",crt_host:"",mitmCheck:[],eproxy:{enable:!1,port:8001,webPort:8002},crthostshow:!1,config_pac:{addr:Oa.base_url+"/pac",proxy:"127.0.0.1:8001",final:"DIRECT"}}),components:{pac:ka(No,jo,[],!1,null,null,null).exports,checkbox:mr},created(){this.mitmInit()},computed:{mitmChecked:{get(){let e={};return this.mitmCheck.forEach((t=>{e[t]=!0})),e},set(e){"all"===e?this.mitmCheck=Object.keys(this.mitmhost):"none"===e&&(this.mitmCheck=[])}},crtfilename(){let e=[];for(let t=0;t{e.data.host&&(this.mitmhost=[],e.data.host.forEach((e=>{switch(this.$sType(e)){case"string":this.mitmhost.push({host:e,enable:!0});break;case"object":!1!==e.enable&&(e.enable=!0),this.mitmhost.push(e)}}))),e.data.eproxy&&Object.assign(this.eproxy,e.data.eproxy),this.mitmhosteble.enable=!1!==e.data.enable,e.data.crtinfo&&0===e.data.crtinfo.rescode?this.crtinfo=e.data.crtinfo:this.crtinfo={commonName:"没有检测到相关证书(可能是 ANYPROXY 尚未开启)",notBefore:"无",notAfter:"无"},e.data.pacproxy&&(this.config_pac.proxy=e.data.pacproxy),e.data.pacfinal&&(this.config_pac.final=e.data.pacfinal),this.$message.success("成功获取 mitmhost 列表 "+this.mitmhost.length)})).catch((e=>{this.$message.error("获取 mitmhost 数据失败 "+e.message),console.error("获取 mitmhost 数据失败",e)})).finally(e)},crtstoupload(){this.crtfiles=this.$refs.crtfiles.files},crtUpload(){if(-1===this.crtfilename.indexOf("rootCA.crt")||-1===this.crtfilename.indexOf("rootCA.key"))return void this.$message.error("根证书应该包含 rootCA.crt/rootCA.key 两部分");let e=new FormData;for(let t of this.crtfiles)e.append(t.name,t);this.$axios.post("/crt",e,{headers:{"Content-Type":"multipart/form-data"}}).then((e=>{console.log(e.data,e.status),0===e.data.rescode?(this.$message.success("上传成功 "+e.data.message+"\n将在 ANYPROXY 重启后自动应用"),this.crtfiles="",this.$refs.crtfiles.value=""):this.$message.success("上传失败 "+e.data.message)})).catch((()=>{this.$message.error("上传失败 FAILURE!!")}))},crtClear(){if(confirm("清空由之前根证书已签发的所有证书?")){const e=this.$message.loading("证书清除中...",0);this.$axios.put("/crt",{op:"clearcrt"}).then((e=>{this.$message.success("清除完成",e.data.message)})).catch((e=>{this.$message.error("操作失败",e.message),console.error(e)})).finally(e)}},crtInstall(){0===this.crtinfo.rescode?window.open("/crt"+("crt"!==this.crt_type?"?type="+this.crt_type:"")):this.$message.error("当前并没有证书可供下载,可能是 ANYPROXY 尚未开启")},crtNew(){if(!this.newcrt.commonName)return void this.$message.error("请先输入证书名称");const e=this.$message.loading("证书生成中...",0);this.$axios.put("/crt",{op:"new",data:this.newcrt}).then((e=>{0===e.data.rescode?this.$message.success("成功生成新的根证书\n"+e.data.message+"\n将在 ANYPROXY 重启后自动应用"):this.$message.success("自签根证书生成失败\n"+e.data.message)})).catch((e=>{this.$message.error("操作失败 "+e.message),console.error(e)})).finally(e)},hostSave(){let e=0,t=!1,s=this.mitmhost.filter((s=>{if(s.host)return s.enable&&(e++,"*"===s.host&&(t=!0)),!0}));if(confirm(`共 ${e}/${s.length} 个 mitmhost 将被保存,${this.mitmhosteble.enable?t?"包含单独 * 项,将解析所有域名,":"":"但不启用,"}确定保存?`)){this.mitmhost=s;const e=this.$message.loading("mitmhost 上传保存中...",0);this.$axios.put("/data",{type:"mitmhost",data:this.mitmhost,mitmhostenable:this.mitmhosteble.enable}).then((e=>{0===e.data.rescode?this.$message.success("保存成功",e.data.message):this.$message.error("mitmhost 保存失败",e.data.message)})).catch((e=>{this.$message.error("mitmhost 保存失败",e.message),console.error("mitmhost 保存失败",e)})).finally(e)}},cacheClear(){const e=this.$message.loading("清空 ANYPROXY temp cache 文件夹中...",0);this.$axios.delete("/tempcaches").then((e=>{console.debug("清空 ANYPROXY temp cache 返回结果",e.data),0===e.data.rescode?this.$message.success("清空完成",e.data.message):this.$message.error("清空失败",e.data.message)})).catch((e=>{this.$message.error("清空失败",e.message),console.error(e)})).finally(e)},mhostDel(e){this.$delete(this.mitmhost,e)},mhostDelCks(){this.mitmhost=this.mitmhost.filter(((e,t)=>!this.mitmChecked[t])),this.$message.success(`成功删除 ${this.mitmCheck.length} 条规则,保存后正式生效`),this.mitmCheck=[]},crtHost(){this.crt_host?window.open("./crt/new/"+this.crt_host):this.$message.error("请先输入要签发证书的域名")},mitmCkall(e){this.mitmChecked=e.target.checked?"all":"none"},eproxyToggle(e=""){if(this.$wsrecv.connected)switch(e){case"open":if(this.eproxy.enable)return void this.$message.success("当前 MITM 功能已处于启用状态");confirm("确定打开 ANYPROXY,启用 MITM 功能?")&&(this.eproxy.enable=!0,this.$wsrecv.send("eproxy",{...this.eproxy}));break;case"close":if(!this.eproxy.enable)return void this.$message.success("当前 MITM 功能已处于关闭状态");confirm("确定关闭 ANYPROXY,暂停 MITM 功能?")&&(this.eproxy.enable=!1,this.$wsrecv.send("eproxy","close"));break;case"restart":confirm("确定重启 ANYPROXY?")&&(this.eproxy.enable=!0,this.$wsrecv.send("eproxy",{op:"restart",...this.eproxy}));break;default:this.$message.error("未知操作",e)}else this.$message.error("websocket 尚未连接,指令无法发送")}}};const Ao=ka(Po,Eo,[function(){var e=this,t=e._self._c;return t("footer",{staticClass:"footer"},[t("ul",{staticClass:"footer_tip"},[t("li",[e._v("关于 PAC 文件的说明参考文档:"),t("a",{staticClass:"tip",attrs:{href:"https://github.com/elecV2/elecV2P-dei/blob/master/docs/Advanced.md",target:"_blank"}},[e._v("Advanced.md")]),e._v(" 相关部分")]),e._v(" "),t("li",[e._v("各个系统的证书安装与信任 参考: "),t("a",{staticClass:"tip",attrs:{href:"https://github.com/alibaba/anyproxy/tree/master/docs-src/cn",target:"_blank"}},[e._v("此页面")]),e._v(" 的证书配置相关部分")]),e._v(" "),t("li",[e._v("生成或上传新的根证书在重启后生效,需要重新下载安装和信任")]),e._v(" "),t("li",[e._v("解析 https 请求的条件:安装信任根证书且相关域名在解析列表中")]),e._v(" "),t("li",[e._v("经常使用 ANYPROXY 代理会产生大量缓存文件,请定期进行清理")])])])}],!1,null,"0b31b9a4",null).exports;var Io=function(){var e=this,t=e._self._c;return t("main",[t("header",{staticClass:"header"},[e._v(e._s(e.header))]),e._v(" "),t("main",{staticClass:"content"},[t("div",{staticClass:"etable"},[t("table",{staticClass:"elecTable",on:{keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),t.shiftKey||t.altKey||t.metaKey?null:e.filterSave()):null}}},[t("caption",{staticClass:"elecTable_caption"},[t("span",[e._v("filter.list - "+e._s(e.lists.length))]),e._v(" "),t("span",{staticClass:"icon icon_caption--sync",attrs:{title:"刷新当前列表"},domProps:{innerHTML:e._s(e.icon.sync)},on:{click:function(t){return e.cfInit()}}})]),e._v(" "),e._m(0),e._v(" "),t("tbody",e._l(e.lists,(function({data:s,index:i}){return t("tr",{key:"filter"+i},[t("td",{staticClass:"elecTable_td"},[t("select",{directives:[{name:"model",rawName:"v-model",value:s[0],expression:"data[0]"}],staticClass:"elecTable_select",on:{change:function(t){var i=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(s,0,t.target.multiple?i:i[0])}}},[t("option",[e._v("DOMAIN")]),e._v(" "),t("option",[e._v("DOMAIN-SUFFIX")]),e._v(" "),t("option",[e._v("IP-CIDR")])])]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("input",{directives:[{name:"model",rawName:"v-model.trim",value:s[1],expression:"data[1]",modifiers:{trim:!0}}],staticClass:"elecTable_input",domProps:{value:s[1]},on:{input:function(t){t.target.composing||e.$set(s,1,t.target.value.trim())},blur:function(t){return e.$forceUpdate()}}})]),e._v(" "),t("td",{staticClass:"elecTable_td"},[t("span",{staticClass:"icon--op",domProps:{innerHTML:e._s(e.icon.delete)},on:{click:function(t){return e.$set(e.orglist[i],"status",-1)}}})])])})),0),e._v(" "),t("tfoot",[t("tr",[t("td",{staticClass:"elecTable_add",attrs:{colspan:"3"},on:{click:function(t){return e.orglist.push({data:["DOMAIN",""],index:e.orglist.length,status:1})}}},[e._v("+")])])])])]),e._v(" "),t("p",{staticClass:"center"},[t("button",{staticClass:"elecBtn elecBtn--long",on:{click:function(t){return e.filterSave()}}},[e._v("保存当前列表")])])]),e._v(" "),t("footer",{staticClass:"footer footer--h48"},[t("div",[t("span",[e._v("该列表用于客户端分流(filter)订阅 地址:")]),e._v(" "),t("strong",[t("a",{attrs:{href:"/filter",target:"elecV2PFilter"}},[e._v(e._s(e.homepage)+"/filter")])])])])])};Io._withStripped=!0;const Ro={name:"filter",data:()=>({icon:wa,header:"客户端订阅分流列表",homepage:location.origin,orglist:[]}),created(){this.cfInit()},computed:{lists(){return this.orglist.filter((e=>-1!==e.status))}},methods:{cfInit(){const e=this.$message.loading("正在获取 filter 列表...",0);this.$axios.get("/data?type=filter").then((e=>{let t=e.data,s=[];t&&t.split(/\n|\r/).forEach((e=>{if(3===e.split(",").length&&!/^(#|\[)/.test(e)){let t=e.split(",");s.push({data:[t[0],t[1]],index:s.length,status:0})}})),this.orglist=s,this.$message.success("成功获取 filter 列表 "+this.orglist.length)})).catch((e=>{this.$message.error("获取 filter 列表失败",e.message),console.error("获取 filter 数据失败",e)})).finally(e)},filterSave(){let e=[];if(e=this.lists.filter((e=>e.data[1]&&/^(DOMAIN(-SUFFIX)?|IP-CIDR)$/.test(e.data[0]))),this.lists.length-e.length)return void this.$message.error("部分规则为空,请填写完成或删除后再进行保存");e=this.lists.map((e=>e.data));const t=this.$message.loading("filter 列表保存中...",0);this.$axios.post("/filterlist",{filterlist:e}).then((e=>{this.$message.success("保存成功",e.data.message)})).catch((e=>{this.$message.error("保存失败",e.message),console.error(e)})).finally(t)}}};const Do=ka(Ro,Io,[function(){var e=this,t=e._self._c;return t("thead",[t("tr",[t("th",{staticClass:"elecTable_th elecTable_th--name"},[e._v("匹配方式")]),e._v(" "),t("th",{staticClass:"elecTable_th"},[e._v("匹配内容")]),e._v(" "),t("th",{staticClass:"elecTable_th minw62"},[e._v("操作")])])])}],!1,null,null,null).exports;var Fo=function(){var e=this,t=e._self._c;return t("section",[t("header",{staticClass:"header"},[e._v(e._s(e.header))]),e._v(" "),e._m(0),e._v(" "),t("footer",{staticClass:"footer footer--h48"},[t("a",{attrs:{href:"https://github.com/elecV2/elecV2P",target:"elecV2PGit"}},[t("i",{staticClass:"icon icon-github",attrs:{"aria-label":"icon: github"}},[t("svg",{attrs:{viewBox:"64 64 896 896","data-icon":"github",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",focusable:"false"}},[t("path",{attrs:{d:"M511.6 76.3C264.3 76.2 64 276.4 64 523.5 64 718.9 189.3 885 363.8 946c23.5 5.9 19.9-10.8 19.9-22.2v-77.5c-135.7 15.9-141.2-73.9-150.3-88.9C215 726 171.5 718 184.5 703c30.9-15.9 62.4 4 98.9 57.9 26.4 39.1 77.9 32.5 104 26 5.7-23.5 17.9-44.5 34.7-60.8-140.6-25.2-199.2-111-199.2-213 0-49.5 16.3-95 48.3-131.7-20.4-60.5 1.9-112.3 4.9-120 58.1-5.2 118.5 41.6 123.2 45.3 33-8.9 70.7-13.6 112.9-13.6 42.4 0 80.2 4.9 113.5 13.9 11.3-8.6 67.3-48.8 121.3-43.9 2.9 7.7 24.7 58.3 5.5 118 32.4 36.8 48.9 82.7 48.9 132.3 0 102.2-59 188.1-200 212.9a127.5 127.5 0 0 1 38.1 91v112.5c.8 9 0 17.9 15 17.9 177.1-59.7 304.6-227 304.6-424.1 0-247.2-200.4-447.3-447.5-447.3z"}})])]),e._v(" Github ")]),e._v(" "),t("a",{attrs:{href:"https://t.me/elecV2",target:"elecV2PTG"}},[t("i",{staticClass:"icon icon-robot",attrs:{"aria-label":"icon: robot"}},[t("svg",{attrs:{viewBox:"64 64 896 896","data-icon":"robot",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",focusable:"false"}},[t("path",{attrs:{d:"M300 328a60 60 0 1 0 120 0 60 60 0 1 0-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 1 0 120 0 60 60 0 1 0-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}})])]),e._v(" Telegram ")])])])};Fo._withStripped=!0;const Lo=ka({name:"about",data:()=>({header:"ABOUT"})},Fo,[function(){var e=this,t=e._self._c;return t("main",{staticClass:"content"},[t("div",{staticClass:"about"},[t("h4",{staticClass:"about_title"},[e._v("简介")]),e._v(" "),t("p",[e._v("elecV2P - customize personal network.")]),e._v(" "),t("p",[e._v("elecV2P 是一款基于 NodeJS,可通过 JS 修改网络请求,以及定时运行脚本或 SHELL 指令的网络工具。")]),e._v(" "),t("br"),e._v(" "),t("p",[e._v("项目地址:"),t("a",{attrs:{href:"https://github.com/elecV2/elecV2P",target:"elecV2PGit"}},[e._v("https://github.com/elecV2/elecV2P")]),t("br"),e._v("说明文档:"),t("a",{attrs:{href:"https://github.com/elecV2/elecV2P-dei/tree/master/docs",target:"elecV2PDoc"}},[e._v("https://github.com/elecV2/elecV2P-dei/tree/master/docs")])]),e._v(" "),t("h4",{staticClass:"about_title"},[e._v("功能")]),e._v(" "),t("ul",[t("li",[e._v("查看/修改 网络请求 (MITM)")]),e._v(" "),t("li",[e._v("定时执行 JS/SHELL 脚本")]),e._v(" "),t("li",[e._v("FEED/IFTTT/自定义 通知")]),e._v(" "),t("li",[e._v("EFSS 基础文件管理")])]),e._v(" "),t("h4",{staticClass:"about_title"},[e._v("项目已开源")]),e._v(" "),t("p",[e._v("前端源文件位于 web/src 目录,修改后使用 yarn build 命令进行打包。")]),e._v(" "),t("p",[e._v("在使用时,如果有任何问题或建议,欢迎一起交流 "),t("a",{attrs:{href:"https://github.com/elecV2/elecV2P/issues",target:"elecV2PGit"}},[e._v("open a issue")]),e._v("。")]),e._v(" "),t("h4",{staticClass:"about_title"},[e._v("贡献/参考")]),e._v(" "),t("ul",[t("li",[t("a",{attrs:{href:"https://github.com/alibaba/anyproxy",target:"_blank"}},[e._v("anyproxy")])]),e._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/axios/axios",target:"_blank"}},[e._v("axios")])]),e._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/cheeriojs/cheerio",target:"_blank"}},[e._v("cheerio")])]),e._v(" "),t("li",[t("a",{attrs:{href:"https://expressjs.com",target:"_blank"}},[e._v("express")])]),e._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/merencia/node-cron",target:"_blank"}},[e._v("node-cron")])]),e._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/dylang/node-rss",target:"_blank"}},[e._v("node-rss")])]),e._v(" "),t("li",[t("a",{attrs:{href:"https://pm2.keymetrics.io/",target:"_blank"}},[e._v("pm2")])]),e._v(" "),t("li",[t("a",{attrs:{href:"https://vuejs.org",target:"_blank"}},[e._v("vue")])]),e._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/mauricius/vue-draggable-resizable",target:"_blank"}},[e._v("vue-draggable-resizable")])]),e._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/ajaxorg/ace",target:"_blank"}},[e._v("ace")])]),e._v(" "),t("li",[t("a",{attrs:{href:"https://github.com/cthackers/adm-zip",target:"_blank"}},[e._v("adm-zip")])]),e._v(" "),t("li",[t("a",{attrs:{href:"https://www.antdv.com",target:"_blank"}},[e._v("Ant Design Vue")])])]),e._v(" "),t("h5",{staticClass:"about_tip"},[t("i",[e._v(" • Don't be evil. "),t("small",[e._v("(Because I am already one)")])])])])])}],!1,null,"055bd4a3",null).exports;var Ho=function(){var e=this,t=e._self._c;return t("section",[t("header",{staticClass:"header"},[e._v(e._s(e.$t("donation")))]),e._v(" "),t("main",{staticClass:"content"},[t("div",{staticClass:"donation"},[e._m(0),e._v(" "),e._m(1),e._v(" "),t("div",{directives:[{name:"show",rawName:"v-show",value:e.userid,expression:"userid"}],attrs:{title:"可多台设备共用(设置相同 WEBHOOK TOKEN)"}},[t("p",[e._v("当前用户 ID: "+e._s(e.userid))]),e._v(" "),e._m(2)])]),e._v(" "),t("div",{staticClass:"todo"},[t("h2",{directives:[{name:"show",rawName:"v-show",value:!e.tododata,expression:"!tododata"}],staticClass:"todotitle",on:{click:e.todoget}},[e._v("查看 Todo-Done-Project")]),e._v(" "),t("div",{domProps:{innerHTML:e._s(e.tododata)}})])]),e._v(" "),e._m(3)])};Ho._withStripped=!0;const Uo={name:"donation",data(){return{userid:this.$uApi.store.get("userid"),tododata:""}},created(){this.$uApi.store.getCache("bSponsor")||this.$axios.get("/data?type=sponsors").then((e=>{if(0===e.data.rescode){let t=e.data.resdata;this.$uApi.store.set("sponsors",this.$uStr.ebufEncrypt(JSON.stringify(t.sponsors),"elecV2P_sponsors")),this.userid!==t.userid&&(this.userid=t.userid,this.$uApi.store.set("userid",this.userid)),(this.$uApi.store.getCache("sponsors").has(this.userid)||-1!==t.sponsors.indexOf(this.userid))&&(this.$message.success("感谢您的赞助,相关权益已激活,请回到首页并刷新"),this.$uApi.store.setCache("bSponsor",!0))}console.debug("get sponsors lists",e.data)})).catch((e=>{console.debug("获取 sponsors lists 失败",e.message)}))},methods:{todoget(){if(this.tododata)return;const e=this.$message.loading("获取 todo lists 中...",0);this.$axios.get("https://raw.githubusercontent.com/elecV2/elecV2P/master/Todo.md").then((e=>{this.$message.success("获取成功"),this.tododata=e.data})).catch((e=>{this.$message.error("获取失败 "+e.message),console.error(e),this.tododata="点击前往:https://github.com/elecV2/elecV2P 查看"})).finally(e)}}};const Mo=ka(Uo,Ho,[function(){var e=this,t=e._self._c;return t("p",[e._v("如果你觉得本项目还不错的话,"),t("a",{attrs:{href:"https://github.com/elecV2/elecV2P",target:"elecV2PGit"}},[e._v("给个 Star")]),e._v(" ,或者赞助打赏一下")])},function(){var e=this._self._c;return e("div",{staticClass:"donationpic"},[e("img",{staticClass:"donationpic_item",attrs:{alt:"wechat",src:"https://elecv2.github.io/src/wechat.png"}}),this._v(" "),e("img",{staticClass:"donationpic_item",attrs:{alt:"alipay",src:"https://elecv2.github.io/src/alipay.png"}})])},function(){var e=this,t=e._self._c;return t("p",{staticClass:"tip"},[e._v("* 赞助 10 元及以上,体验"),t("a",{staticClass:"tip",attrs:{href:"https://github.com/elecV2/elecV2P-dei/tree/master/examples/theme",target:"elecV2PDoc"}},[e._v(" 主题功能")]),e._v("(请附上用户 ID)")])},function(){var e=this,t=e._self._c;return t("footer",{staticClass:"footer"},[t("span",[e._v("BTC: 1GtN4T1GB4YUf4YWynqr1Vgv4sdgLepoo9")]),e._v(" "),t("span",[e._v("ETH: 0x2455850dAC2f44309E3e208E5ffAF5945308E76a")])])}],!1,null,"51001bdc",null).exports;var Bo=function(){var e=this,t=e._self._c;return e.bIsHide?e._e():t("div",{staticClass:"hold"},[t("h4",{staticClass:"hold_title"},[e._v("$HOLD: "+e._s(e.title))]),e._v(" "),t("div",{staticClass:"hold_edit"},[t("div",{staticClass:"hold_left"},[e.request?t("div",{staticClass:"hold_request"},[t("div",{staticClass:"hold_request_flex"},[t("select",{directives:[{name:"model",rawName:"v-model",value:e.request.method,expression:"request.method"}],staticClass:"elecTable_select header_select",on:{change:function(t){var s=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){return"_value"in e?e._value:e.value}));e.$set(e.request,"method",t.target.multiple?s:s[0])}}},[t("option",[e._v("GET")]),e._v(" "),t("option",[e._v("POST")]),e._v(" "),t("option",[e._v("PUT")]),e._v(" "),t("option",[e._v("DELETE")])]),e._v(" "),t("label",{staticClass:"header_label"},[e._v("HOST : ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.request.hostname,expression:"request.hostname"}],staticClass:"elecTable_input hostname_input",domProps:{value:e.request.hostname},on:{input:function(t){t.target.composing||e.$set(e.request,"hostname",t.target.value)}}}),e._v(" "),t("label",{staticClass:"header_label"},[e._v(" : ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.request.port,expression:"request.port"}],staticClass:"elecTable_input port_input",domProps:{value:e.request.port},on:{input:function(t){t.target.composing||e.$set(e.request,"port",t.target.value)}}})]),e._v(" "),t("div",{staticClass:"hold_request_flex"},[t("label",{staticClass:"header_label"},[e._v("PATH : ")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.request.path,expression:"request.path"}],staticClass:"elecTable_input path_input",domProps:{value:e.request.path},on:{input:function(t){t.target.composing||e.$set(e.request,"path",t.target.value)}}})])]):e._e(),e._v(" "),t("div",{staticClass:"hold_header"},[t("h4",{staticClass:"hold_title"},[e._v("header"),t("span",{staticClass:"icon icon-interaction",attrs:{"aria-label":"icon: interaction"},on:{click:function(t){e.bIsTheader=!e.bIsTheader}}},[t("svg",{attrs:{viewBox:"64 64 896 896","data-icon":"interaction",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",focusable:"false"}},[t("path",{attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656zM304.8 524h50.7c3.7 0 6.8-3 6.8-6.8v-78.9c0-19.7 15.9-35.6 35.5-35.6h205.7v53.4c0 5.7 6.5 8.8 10.9 5.3l109.1-85.7c3.5-2.7 3.5-8 0-10.7l-109.1-85.7c-4.4-3.5-10.9-.3-10.9 5.3V338H397.7c-55.1 0-99.7 44.8-99.7 100.1V517c0 4 3 7 6.8 7zm-4.2 134.9l109.1 85.7c4.4 3.5 10.9.3 10.9-5.3v-53.4h205.7c55.1 0 99.7-44.8 99.7-100.1v-78.9c0-3.7-3-6.8-6.8-6.8h-50.7c-3.7 0-6.8 3-6.8 6.8v78.9c0 19.7-15.9 35.6-35.5 35.6H420.6V568c0-5.7-6.5-8.8-10.9-5.3l-109.1 85.7c-3.5 2.5-3.5 7.8 0 10.5z"}})])])]),e._v(" "),e.bIsTheader?t("textarea",{directives:[{name:"model",rawName:"v-model.lazy",value:e.strheader,expression:"strheader",modifiers:{lazy:!0}}],staticClass:"editor_textarea header_text",domProps:{value:e.strheader},on:{change:function(t){e.strheader=t.target.value}}}):t("div",e._l(e.header,(function(s,i){return t("span",{key:i,staticClass:"header_item"},[t("label",{staticClass:"header_label",attrs:{title:i}},[e._v(e._s(i)+":")]),e._v(" "),t("span",{staticClass:"button_delete",on:{click:function(t){return e.headerDelete(i)}}},[e._v("X")]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.header[i],expression:"header[key]"}],staticClass:"elecTable_input header_input",domProps:{value:e.header[i]},on:{input:function(t){t.target.composing||e.$set(e.header,i,t.target.value)}}})])})),0)])]),e._v(" "),t("div",{staticClass:"hold_body"},[t("h4",{staticClass:"hold_title"},[e._v("body")]),e._v(" "),t("textarea",{directives:[{name:"model",rawName:"v-model.lazy",value:e.body,expression:"body",modifiers:{lazy:!0}}],staticClass:"editor_textarea body_text",domProps:{value:e.body},on:{change:function(t){e.body=t.target.value}}})])]),e._v(" "),t("p",{staticClass:"hold_bcont center"},[t("button",{staticClass:"elecBtn hold_button",on:{click:e.holdDone}},[e._v("完成")]),e._v(" "),e.request?t("button",{staticClass:"elecBtn hold_button",on:{click:e.reject}},[e._v("直接返回当前数据")]):e._e()])])};Bo._withStripped=!0;const zo={name:"hold",data:()=>({title:"waiting hold data",request:null,header:{},body:"hello elecV2P",bIsHide:!0,bIsTheader:!1}),computed:{strheader:{get(){return JSON.stringify(this.header,null,4)},set(e){try{this.header=JSON.parse(e)}catch{console.log("hold header string is not a json"),this.$message.error("header 内容并不是正确的 JSON 格式",10)}}}},created(){this.$wsrecv.add("hold",(e=>{"over"===e?(this.bIsHide=!0,this.request=null,this.header={},this.body="hello elecV2P"):(this.title=e.title,this.request=e.request||null,this.header=e.header||{},this.body=e.body,this.bIsHide=!1)}))},methods:{holdDone(){const e={header:this.header,body:this.body};this.request&&(this.request.path=encodeURI(this.request.path),e.request=this.request),this.$wsrecv.send("hold",e),this.bIsHide=!0},reject(){const e={reject:!0,header:this.header,body:this.body};this.$wsrecv.send("hold",e),this.bIsHide=!0},headerDelete(e){this.$delete(this.header,e)}}};const Vo=ka(zo,Bo,[],!1,null,"3afbbebb",null).exports;var Go=function(){var e=this,t=e._self._c;return t("div",{staticClass:"message"},e._l(e.msgs,(function(s,i){return t("div",{key:i,staticClass:"message_item",style:{textAlign:s.align}},[t("span",{staticClass:"message_type icon",domProps:{innerHTML:e._s(e.icon[s.type])}}),e._v(" "),t("span",{staticClass:"message_text",class:{cursor:s.url},attrs:{title:s.url},on:{click:function(t){return e.$uApi.open(s.url)}}},[e._v(e._s(s.text))]),e._v(" "),t("span",{staticClass:"message_remove",on:{click:function(t){return e.msgRemove(i)}}},[e._v("X")])])})),0)};Go._withStripped=!0;const Ko=ka({name:"message",data:()=>({msgs:{},icon:wa}),computed:{},created(){Object.assign(co.message,{success:(...e)=>this.msgShow("success",this.formMsg(e)),error:(...e)=>this.msgShow("error",this.formMsg(e)),loading:(...e)=>this.msgShow("loading",this.formMsg(e)),close:e=>{e?this.msgRemove(e):this.msgs={}}}),this.$wsrecv&&this.$wsrecv.add("message",(e=>{if("object"===Ea(e))switch(e.type){case"success":case"error":case"loading":const t=this.formMsg(e.data);this.msgShow(e.type,t),this.msgNotify(t.msg,{secd:t.secd,url:t.url,tag:t.mid});break;case"close":e.data?this.msgRemove(e.data):this.msgs={};break;default:this.msgShow("error",{msg:"暂不支持的通知类型: "+e.type,secd:10})}else this.msgShow("success",this.formMsg(e))}))},methods:{formMsg(e){if(0===e.length)return{msg:""};if("array"!==Ea(e))return{msg:Na(e)};if(1===e.length)return{msg:Na(e[0])};let t,s,i,n,a=e.pop();return Number.isFinite(a)?t=a:"object"===Ea(a)&&(a.secd||a.url||a.mid||a.align)?(t=a.secd,s=a.url,i=a.mid,n=a.align):e.push(a),{msg:e.map((e=>Na(e))).join(" "),secd:t,url:s,mid:i,align:n}},msgShow(e,{msg:t,secd:s,url:i,mid:n=Ra(),align:a}){return void 0!==t&&""!==t||(t="a empty message",n="empty"),Number.isFinite(s)||(s=(t.match(/\W/g)||t).length/5+(3*Object.keys(this.msgs).length||5)),this.$set(this.msgs,n,{text:t,type:e,secd:s,url:i,align:a}),0!==s&&(this.msgs[n].sTout=setTimeout(this.msgRemove,1e3*s,n)),()=>{this.msgRemove(n)}},msgRemove(e){this.msgs[e]&&(clearTimeout(this.msgs[e].sTout),this.$delete(this.msgs,e))},async getNotifyPerm(){if("undefined"==typeof Notification)return"";let e=Notification.permission;return"granted"===e||"denied"===e?e:(e=await Notification.requestPermission(),void 0===e?new Promise((e=>Notification.requestPermission((t=>e(t))))):e)},async msgNotify(e="",t={}){if("granted"===await this.getNotifyPerm()){t.icon||(t.icon="efss/logo/elecV2P.png");const s=new Notification(t.title||"",{body:e,icon:t.icon,tag:t.tag});t.secd>0&&setTimeout((()=>s.close()),1e3*t.secd),t.url&&(s.onclick=e=>{e.preventDefault(),this.$uApi.open(t.url),s.close()})}}}},Go,[],!1,null,"40ac18ce",null).exports;var qo=function(){var e=this,t=e._self._c;return t("div",{staticClass:"evui"},e._l(e.draglist,(function(s,i){return t("VueDragResize",{key:i,attrs:{className:"ediv",dragHandle:".ediv_title--name",parent:!0,"prevent-deactivation":!1,active:s.active,w:s.width,h:s.height,x:s.left,y:s.top,z:s.z,resizable:s.resizable,draggable:s.draggable,handles:["tl","tr","bl","br"],"lock-aspect-ratio":!1},on:{deactivated:function(e){s.z=1},activated:function(e){s.z=2},resizestop:function(t){return e.updateVal(arguments,i)},dragstop:function(t){return e.updateVal(arguments,i)}}},[t("h3",{staticClass:"ediv_title",style:s.style.title,on:{click:function(e){s.z=2}}},[t("span",{staticClass:"ediv_title--name",attrs:{title:i}},[e._v(e._s(s.title))]),e._v(" "),t("span",{staticClass:"ediv_title--close",on:{click:function(t){return e.evRemove(i)}}},[e._v("x")])]),e._v(" "),t("div",{staticClass:"ediv_content",style:s.style.content,domProps:{innerHTML:e._s(s.content)},on:{click:function(t){return e.evDelegate(t,i)},keydown:function(t){return(t.type.indexOf("key")||83===t.keyCode)&&t.ctrlKey?(t.preventDefault(),t.stopPropagation(),e.evSave(i)):null}}}),e._v(" "),s.cbable?t("div",{staticClass:"ediv_btncontainer"},[t("textarea",{directives:[{name:"model",rawName:"v-model",value:s.cbdata,expression:"ediv.cbdata"}],staticClass:"elecTable_input ediv_cbdata",style:s.style.cbdata,attrs:{placeholder:s.cbhint},domProps:{value:s.cbdata},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:t.ctrlKey?e.cbsubmit(i):null},input:function(t){t.target.composing||e.$set(s,"cbdata",t.target.value)}}}),e._v(" "),t("button",{staticClass:"elecBtn ediv_cbbtn",style:s.style.cbbtn,on:{click:function(t){return e.cbsubmit(i)}}},[e._v(e._s(s.cblabel))])]):e._e()])})),1)};qo._withStripped=!0;const Jo={name:"evui",components:{VueDragResize:xo()},data:()=>({init:{title:"elecV2P 显示窗口",top:0,left:0,width:620,height:360,z:1,active:!0,resizable:!1,draggable:!0,content:"暂时没有添加任何内容
关于 $evui 的使用可参考:说明文档 $evui 部分
",style:{content:"font-size: 15px"},cbable:!1,cbdata:"",cblabel:"提交",cbhint:"输入返回给后台的数据"},script:"",draglist:{}}),created(){co.evui=e=>this.neweu({...e,type:"local"}),this.$wsrecv&&this.$wsrecv.add("evui",(e=>{let t=this.$sJson(e);if(t)switch(t.data&&t.data.script&&(this.script=t.data.script),t.type){case"neweu":this.neweu(t.data);break;case"close":case"delete":this.draglist[t.id]&&(this.$message.success("收到服务器端关闭",this.draglist[t.id].title,"evui 界面的命令",t.message&&"\n附带信息: "+t.message),this.evRemove(t.id));break;case"contentadd":this.$set(this.draglist[t.id],"content",this.draglist[t.id].content+this.$sString(t.data));break;case"content":this.$set(this.draglist[t.id],"content",this.$sString(t.data));break;case"cbdataadd":let e=this.draglist[t.id].cbdata+"\n"+this.$sString(t.data);this.$set(this.draglist[t.id],"cbdata",e);break;default:this.$set(this.draglist[t.id],"cbdata",this.$sString(t.data))}else this.$message.error("evui 输送的数据有误")}))},watch:{script(e){this.$uApi.injectJs(e)}},methods:{updateVal({...e},t){let s={left:e[0],top:e[1]};void 0!==e[2]&&void 0!==e[3]&&(s.width=e[2],s.height=e[3]),Object.assign(this.draglist[t],s)},neweu(e={}){let t=e.id||this.$uStr.euid();(e={...this.init,...e}).top=e.top||(document.body.clientHeight-Number(e.height||460))/2,e.left=e.left||(document.body.clientWidth-Number(e.width||800))/2,e.top<0&&(e.top=0),e.left<0&&(e.left=0),e.content&&(e.content=this.$sString(e.content)),e.cbdata&&(e.cbdata=this.$sString(e.cbdata)),"object"!==this.$sType(e.style)&&(e.style={content:e.style}),e.script&&(this.script=e.script),this.$set(this.draglist,t,e)},evRemove(e){e?this.draglist[e]&&("local"!==this.draglist[e].type&&this.$wsrecv&&this.$wsrecv.connected&&this.$wsrecv.send(e,"close"),this.$delete(this.draglist,e)):this.$message.error("a id of the evui is expect")},cbsubmit(e){this.$message.success(this.draglist[e].title,"send data:\n",this.draglist[e].cbdata),this.$wsrecv&&this.$wsrecv.send(e,this.draglist[e].cbdata)},evDelegate(e,t){const s=e&&e.target.dataset.method;if(!s)return;this.draglist[t].methods&&this.draglist[t].methods[s]&&this.draglist[t].methods[s](e);"true"!==e.target.dataset.close&&"close"!==s||this.evRemove(t)},evSave(e){this.draglist[e].methods&&this.draglist[e].methods.save&&(this.draglist[e].methods.save(),this.evRemove(e))}}};const Wo=ka(Jo,qo,[],!1,null,null,null).exports;const Yo=ka({name:"app",data:()=>({icon:wa,logo_src:ba,logo_name:"elecV2P",collapsed:window.innerWidth<960,sidermobile:!0,currentpanel:"overview",islangzh:rr.locale.startsWith("zh"),menulist:{overview:Object.create(null),task:Object.create(null),mitm:Object.create(null),rules:Object.create(null),rewrite:Object.create(null),jsmanage:Object.create(null),setting:Object.create(null),cfilter:Object.create(null),about:Object.create(null),donation:Object.create(null)}}),created(){let e=location.hash.slice(1).toLowerCase();this.currentpanel=this.menulist[e]?e:"overview";let t=this.$sJson(this.$uApi.store.get("menunav"));t?this.menulist=t:this.islangzh&&(this.menulist.overview.name="基础信息",this.menulist.task.name="定时任务",this.menulist.rewrite.name="重写请求",this.menulist.jsmanage.name="脚本管理",this.menulist.setting.name="设置相关",this.menulist.cfilter.name="分流列表",this.menulist.about.name="简介说明",this.menulist.donation.name="赞助打赏");let s=this.$sJson(this.$uApi.store.get("theme"));s&&this.themeApply(s),addEventListener("hashchange",(e=>{let t=location.hash.slice(1).toLowerCase();this.currentpanel=this.menulist[t]?t:"overview"})),addEventListener("load",(e=>{"serviceWorker"in navigator?(navigator.serviceWorker.register("/sw.js").catch((e=>{console.error("service worker registration failed",e)})),navigator.serviceWorker.addEventListener("controllerchange",(()=>{console.debug("a new service worker activated"),this.$message.success("a new service worker activated")}))):("http:"===location.protocol||this.$uApi.store.getCache("bChecked")||this.$message.error("该浏览器暂不支持 service workers,webUI 部分功能可能受限"),console.error("This browser does not support service workers. webUI 部分功能可能受限")),location.search.includes("token")&&history.replaceState(null,"","/"+location.hash)}))},components:{overview:hr,rules:vr,rewrite:br,jsmanage:jr,setting:$o,task:Oo,mitm:Ao,cfilter:Do,about:Lo,donation:Mo,hold:Vo,message:Ko,evui:Wo},computed:{navlist(){let e=Object.create(null),t=this.$uApi.store.getCache("bSponsor");for(let s in this.menulist)"setting"===s||"donation"===s&&!t?(this.menulist[s].show=!0,e[s]=this.menulist[s]):!1!==this.menulist[s].show&&(e[s]=this.menulist[s]);return e}},methods:{nav(e){location.hash="#"+e,this.sidermobile||(this.sidermobile=!0)},edelegate(e){if("nav"===e.target.dataset.method){let t=e.target.dataset.panel||e.target.dataset.param;t&&this.nav(t)}},menunav(e=null,t=!1){if(!e)return void console.debug("menu nav are expect");if(!t&&JSON.stringify(e)===JSON.stringify(this.menulist))return void console.debug("same menu nav, no need to update");let s={...this.menulist};for(let t in e)s[t]&&(s[t]=e[t]);this.menulist=s,this.$uApi.store.set("menunav",JSON.stringify(s))},themeApply(e=null){if(!e)return void console.error("theme object is expect");if("logo"===e.type)return!1===e.enable?(this.logo_src=ba,void(this.logo_name="elecV2P")):(e.src&&(this.logo_src=e.src),void(e.name&&(this.logo_name=e.name)));if(e.simple&&(e=e.simple),!0!==e.enable)return this.$uApi.removeItem(".evtheme"),this.$uApi.injectMeta("theme-color","#003153"),void this.$uApi.store.set("theme",JSON.stringify(e));let t="";e.mainbk&&(t=`--main-bk: ${e.mainbk};`,e.mainbk.startsWith("#")&&(t+=`--secd-fc: ${e.mainbk.padEnd(7,8).slice(0,7)}b8;`)),e.maincl&&(t+=`--main-cl: ${e.maincl};`,e.maincl.startsWith("#")&&(t+=`--secd-bk: ${e.maincl.padEnd(7,8).slice(0,7)}b8;`)),e.appbk&&(/^http/.test(e.appbk)&&(e.appbk=`url(${e.appbk})`),t+=`background: ${e.appbk};`),t&&(t=`#app{${t}}`),e.style&&(t+=e.style,/--main-fc/.test(e.style)&&this.$uApi.hashToLogo()),this.$uApi.injectCss(t),this.$uApi.injectMeta("theme-color",e.mainbk),this.$uApi.store.set("theme",JSON.stringify(e))},srcErr(){this.$message.error("LOGO 图标加载失败,自动生成替换图标"),this.logo_src=this.$uApi.hashToLogo(this.$uApi.store.get("userid"),this.logo_name,4)}}},_a,[],!1,null,"10ee03bb",null).exports;function Xo(e,t){return function(){return e.apply(t,arguments)}}const{toString:Zo}=Object.prototype,{getPrototypeOf:Qo}=Object,el=(tl=Object.create(null),e=>{const t=Zo.call(e);return tl[t]||(tl[t]=t.slice(8,-1).toLowerCase())});var tl;const sl=e=>(e=e.toLowerCase(),t=>el(t)===e),il=e=>t=>typeof t===e,{isArray:nl}=Array,al=il("undefined");const rl=sl("ArrayBuffer");const ol=il("string"),ll=il("function"),cl=il("number"),ul=e=>null!==e&&"object"==typeof e,hl=e=>{if("object"!==el(e))return!1;const t=Qo(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},dl=sl("Date"),pl=sl("File"),ml=sl("Blob"),fl=sl("FileList"),vl=sl("URLSearchParams"),[gl,_l,bl,yl]=["ReadableStream","Request","Response","Headers"].map(sl);function $l(e,t,{allOwnKeys:s=!1}={}){if(null==e)return;let i,n;if("object"!=typeof e&&(e=[e]),nl(e))for(i=0,n=e.length;i0;)if(i=s[n],t===i.toLowerCase())return i;return null}const kl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Cl=e=>!al(e)&&e!==kl;const xl=(Tl="undefined"!=typeof Uint8Array&&Qo(Uint8Array),e=>Tl&&e instanceof Tl);var Tl;const Sl=sl("HTMLFormElement"),Ol=(({hasOwnProperty:e})=>(t,s)=>e.call(t,s))(Object.prototype),El=sl("RegExp"),jl=(e,t)=>{const s=Object.getOwnPropertyDescriptors(e),i={};$l(s,((s,n)=>{let a;!1!==(a=t(s,n,e))&&(i[n]=a||s)})),Object.defineProperties(e,i)},Nl="abcdefghijklmnopqrstuvwxyz",Pl="0123456789",Al={DIGIT:Pl,ALPHA:Nl,ALPHA_DIGIT:Nl+Nl.toUpperCase()+Pl};const Il=sl("AsyncFunction"),Rl=(Dl="function"==typeof setImmediate,Fl=ll(kl.postMessage),Dl?setImmediate:Fl?((e,t)=>(kl.addEventListener("message",(({source:s,data:i})=>{s===kl&&i===e&&t.length&&t.shift()()}),!1),s=>{t.push(s),kl.postMessage(e,"*")}))(`axios@${Math.random()}`,[]):e=>setTimeout(e));var Dl,Fl;const Ll="undefined"!=typeof queueMicrotask?queueMicrotask.bind(kl):"undefined"!=typeof process&&process.nextTick||Rl,Hl={isArray:nl,isArrayBuffer:rl,isBuffer:function(e){return null!==e&&!al(e)&&null!==e.constructor&&!al(e.constructor)&&ll(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||ll(e.append)&&("formdata"===(t=el(e))||"object"===t&&ll(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&rl(e.buffer),t},isString:ol,isNumber:cl,isBoolean:e=>!0===e||!1===e,isObject:ul,isPlainObject:hl,isReadableStream:gl,isRequest:_l,isResponse:bl,isHeaders:yl,isUndefined:al,isDate:dl,isFile:pl,isBlob:ml,isRegExp:El,isFunction:ll,isStream:e=>ul(e)&&ll(e.pipe),isURLSearchParams:vl,isTypedArray:xl,isFileList:fl,forEach:$l,merge:function e(){const{caseless:t}=Cl(this)&&this||{},s={},i=(i,n)=>{const a=t&&wl(s,n)||n;hl(s[a])&&hl(i)?s[a]=e(s[a],i):hl(i)?s[a]=e({},i):nl(i)?s[a]=i.slice():s[a]=i};for(let e=0,t=arguments.length;e($l(t,((t,i)=>{s&&ll(t)?e[i]=Xo(t,s):e[i]=t}),{allOwnKeys:i}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,s,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),s&&Object.assign(e.prototype,s)},toFlatObject:(e,t,s,i)=>{let n,a,r;const o={};if(t=t||{},null==e)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)r=n[a],i&&!i(r,e,t)||o[r]||(t[r]=e[r],o[r]=!0);e=!1!==s&&Qo(e)}while(e&&(!s||s(e,t))&&e!==Object.prototype);return t},kindOf:el,kindOfTest:sl,endsWith:(e,t,s)=>{e=String(e),(void 0===s||s>e.length)&&(s=e.length),s-=t.length;const i=e.indexOf(t,s);return-1!==i&&i===s},toArray:e=>{if(!e)return null;if(nl(e))return e;let t=e.length;if(!cl(t))return null;const s=new Array(t);for(;t-- >0;)s[t]=e[t];return s},forEachEntry:(e,t)=>{const s=(e&&e[Symbol.iterator]).call(e);let i;for(;(i=s.next())&&!i.done;){const s=i.value;t.call(e,s[0],s[1])}},matchAll:(e,t)=>{let s;const i=[];for(;null!==(s=e.exec(t));)i.push(s);return i},isHTMLForm:Sl,hasOwnProperty:Ol,hasOwnProp:Ol,reduceDescriptors:jl,freezeMethods:e=>{jl(e,((t,s)=>{if(ll(e)&&-1!==["arguments","caller","callee"].indexOf(s))return!1;const i=e[s];ll(i)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")}))}))},toObjectSet:(e,t)=>{const s={},i=e=>{e.forEach((e=>{s[e]=!0}))};return nl(e)?i(e):i(String(e).split(t)),s},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,s){return t.toUpperCase()+s})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:wl,global:kl,isContextDefined:Cl,ALPHABET:Al,generateString:(e=16,t=Al.ALPHA_DIGIT)=>{let s="";const{length:i}=t;for(;e--;)s+=t[Math.random()*i|0];return s},isSpecCompliantForm:function(e){return!!(e&&ll(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),s=(e,i)=>{if(ul(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[i]=e;const n=nl(e)?[]:{};return $l(e,((e,t)=>{const a=s(e,i+1);!al(a)&&(n[t]=a)})),t[i]=void 0,n}}return e};return s(e,0)},isAsyncFn:Il,isThenable:e=>e&&(ul(e)||ll(e))&&ll(e.then)&&ll(e.catch),setImmediate:Rl,asap:Ll};function Ul(e,t,s,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),s&&(this.config=s),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}Hl.inherits(Ul,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Hl.toJSONObject(this.config),code:this.code,status:this.status}}});const Ml=Ul.prototype,Bl={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{Bl[e]={value:e}})),Object.defineProperties(Ul,Bl),Object.defineProperty(Ml,"isAxiosError",{value:!0}),Ul.from=(e,t,s,i,n,a)=>{const r=Object.create(Ml);return Hl.toFlatObject(e,r,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),Ul.call(r,e.message,t,s,i,n),r.cause=e,r.name=e.name,a&&Object.assign(r,a),r};const zl=Ul;function Vl(e){return Hl.isPlainObject(e)||Hl.isArray(e)}function Gl(e){return Hl.endsWith(e,"[]")?e.slice(0,-2):e}function Kl(e,t,s){return e?e.concat(t).map((function(e,t){return e=Gl(e),!s&&t?"["+e+"]":e})).join(s?".":""):t}const ql=Hl.toFlatObject(Hl,{},null,(function(e){return/^is[A-Z]/.test(e)}));const Jl=function(e,t,s){if(!Hl.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const i=(s=Hl.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!Hl.isUndefined(t[e])}))).metaTokens,n=s.visitor||c,a=s.dots,r=s.indexes,o=(s.Blob||"undefined"!=typeof Blob&&Blob)&&Hl.isSpecCompliantForm(t);if(!Hl.isFunction(n))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(Hl.isDate(e))return e.toISOString();if(!o&&Hl.isBlob(e))throw new zl("Blob is not supported. Use a Buffer instead.");return Hl.isArrayBuffer(e)||Hl.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,s,n){let o=e;if(e&&!n&&"object"==typeof e)if(Hl.endsWith(s,"{}"))s=i?s:s.slice(0,-2),e=JSON.stringify(e);else if(Hl.isArray(e)&&function(e){return Hl.isArray(e)&&!e.some(Vl)}(e)||(Hl.isFileList(e)||Hl.endsWith(s,"[]"))&&(o=Hl.toArray(e)))return s=Gl(s),o.forEach((function(e,i){!Hl.isUndefined(e)&&null!==e&&t.append(!0===r?Kl([s],i,a):null===r?s:s+"[]",l(e))})),!1;return!!Vl(e)||(t.append(Kl(n,s,a),l(e)),!1)}const u=[],h=Object.assign(ql,{defaultVisitor:c,convertValue:l,isVisitable:Vl});if(!Hl.isObject(e))throw new TypeError("data must be an object");return function e(s,i){if(!Hl.isUndefined(s)){if(-1!==u.indexOf(s))throw Error("Circular reference detected in "+i.join("."));u.push(s),Hl.forEach(s,(function(s,a){!0===(!(Hl.isUndefined(s)||null===s)&&n.call(t,s,Hl.isString(a)?a.trim():a,i,h))&&e(s,i?i.concat(a):[a])})),u.pop()}}(e),t};function Wl(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Yl(e,t){this._pairs=[],e&&Jl(e,this,t)}const Xl=Yl.prototype;Xl.append=function(e,t){this._pairs.push([e,t])},Xl.toString=function(e){const t=e?function(t){return e.call(this,t,Wl)}:Wl;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};const Zl=Yl;function Ql(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ec(e,t,s){if(!t)return e;const i=s&&s.encode||Ql,n=s&&s.serialize;let a;if(a=n?n(t,s):Hl.isURLSearchParams(t)?t.toString():new Zl(t,s).toString(i),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const tc=class{constructor(){this.handlers=[]}use(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!s&&s.synchronous,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Hl.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},sc={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ic={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Zl,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},nc="undefined"!=typeof window&&"undefined"!=typeof document,ac="object"==typeof navigator&&navigator||void 0,rc=nc&&(!ac||["ReactNative","NativeScript","NS"].indexOf(ac.product)<0),oc="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,lc=nc&&window.location.href||"http://localhost",cc={...i,...ic};const uc=function(e){function t(e,s,i,n){let a=e[n++];if("__proto__"===a)return!0;const r=Number.isFinite(+a),o=n>=e.length;if(a=!a&&Hl.isArray(i)?i.length:a,o)return Hl.hasOwnProp(i,a)?i[a]=[i[a],s]:i[a]=s,!r;i[a]&&Hl.isObject(i[a])||(i[a]=[]);return t(e,s,i[a],n)&&Hl.isArray(i[a])&&(i[a]=function(e){const t={},s=Object.keys(e);let i;const n=s.length;let a;for(i=0;i{t(function(e){return Hl.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),i,s,0)})),s}return null};const hc={transitional:sc,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const s=t.getContentType()||"",i=s.indexOf("application/json")>-1,n=Hl.isObject(e);n&&Hl.isHTMLForm(e)&&(e=new FormData(e));if(Hl.isFormData(e))return i?JSON.stringify(uc(e)):e;if(Hl.isArrayBuffer(e)||Hl.isBuffer(e)||Hl.isStream(e)||Hl.isFile(e)||Hl.isBlob(e)||Hl.isReadableStream(e))return e;if(Hl.isArrayBufferView(e))return e.buffer;if(Hl.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(n){if(s.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Jl(e,new cc.classes.URLSearchParams,Object.assign({visitor:function(e,t,s,i){return cc.isNode&&Hl.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=Hl.isFileList(e))||s.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Jl(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return n||i?(t.setContentType("application/json",!1),function(e,t,s){if(Hl.isString(e))try{return(t||JSON.parse)(e),Hl.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(s||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||hc.transitional,s=t&&t.forcedJSONParsing,i="json"===this.responseType;if(Hl.isResponse(e)||Hl.isReadableStream(e))return e;if(e&&Hl.isString(e)&&(s&&!this.responseType||i)){const s=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw zl.from(e,zl.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:cc.classes.FormData,Blob:cc.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Hl.forEach(["delete","get","head","post","put","patch"],(e=>{hc.headers[e]={}}));const dc=hc,pc=Hl.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),mc=Symbol("internals");function fc(e){return e&&String(e).trim().toLowerCase()}function vc(e){return!1===e||null==e?e:Hl.isArray(e)?e.map(vc):String(e)}function gc(e,t,s,i,n){return Hl.isFunction(i)?i.call(this,t,s):(n&&(t=s),Hl.isString(t)?Hl.isString(i)?-1!==t.indexOf(i):Hl.isRegExp(i)?i.test(t):void 0:void 0)}class _c{constructor(e){e&&this.set(e)}set(e,t,s){const i=this;function n(e,t,s){const n=fc(t);if(!n)throw new Error("header name must be a non-empty string");const a=Hl.findKey(i,n);(!a||void 0===i[a]||!0===s||void 0===s&&!1!==i[a])&&(i[a||t]=vc(e))}const a=(e,t)=>Hl.forEach(e,((e,s)=>n(e,s,t)));if(Hl.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(Hl.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))a((e=>{const t={};let s,i,n;return e&&e.split("\n").forEach((function(e){n=e.indexOf(":"),s=e.substring(0,n).trim().toLowerCase(),i=e.substring(n+1).trim(),!s||t[s]&&pc[s]||("set-cookie"===s?t[s]?t[s].push(i):t[s]=[i]:t[s]=t[s]?t[s]+", "+i:i)})),t})(e),t);else if(Hl.isHeaders(e))for(const[t,i]of e.entries())n(i,t,s);else null!=e&&n(t,e,s);return this}get(e,t){if(e=fc(e)){const s=Hl.findKey(this,e);if(s){const e=this[s];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=s.exec(e);)t[i[1]]=i[2];return t}(e);if(Hl.isFunction(t))return t.call(this,e,s);if(Hl.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=fc(e)){const s=Hl.findKey(this,e);return!(!s||void 0===this[s]||t&&!gc(0,this[s],s,t))}return!1}delete(e,t){const s=this;let i=!1;function n(e){if(e=fc(e)){const n=Hl.findKey(s,e);!n||t&&!gc(0,s[n],n,t)||(delete s[n],i=!0)}}return Hl.isArray(e)?e.forEach(n):n(e),i}clear(e){const t=Object.keys(this);let s=t.length,i=!1;for(;s--;){const n=t[s];e&&!gc(0,this[n],n,e,!0)||(delete this[n],i=!0)}return i}normalize(e){const t=this,s={};return Hl.forEach(this,((i,n)=>{const a=Hl.findKey(s,n);if(a)return t[a]=vc(i),void delete t[n];const r=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,s)=>t.toUpperCase()+s))}(n):String(n).trim();r!==n&&delete t[n],t[r]=vc(i),s[r]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Hl.forEach(this,((s,i)=>{null!=s&&!1!==s&&(t[i]=e&&Hl.isArray(s)?s.join(", "):s)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const s=new this(e);return t.forEach((e=>s.set(e))),s}static accessor(e){const t=(this[mc]=this[mc]={accessors:{}}).accessors,s=this.prototype;function i(e){const i=fc(e);t[i]||(!function(e,t){const s=Hl.toCamelCase(" "+t);["get","set","has"].forEach((i=>{Object.defineProperty(e,i+s,{value:function(e,s,n){return this[i].call(this,t,e,s,n)},configurable:!0})}))}(s,e),t[i]=!0)}return Hl.isArray(e)?e.forEach(i):i(e),this}}_c.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Hl.reduceDescriptors(_c.prototype,(({value:e},t)=>{let s=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[s]=e}}})),Hl.freezeMethods(_c);const bc=_c;function yc(e,t){const s=this||dc,i=t||s,n=bc.from(i.headers);let a=i.data;return Hl.forEach(e,(function(e){a=e.call(s,a,n.normalize(),t?t.status:void 0)})),n.normalize(),a}function $c(e){return!(!e||!e.__CANCEL__)}function wc(e,t,s){zl.call(this,null==e?"canceled":e,zl.ERR_CANCELED,t,s),this.name="CanceledError"}Hl.inherits(wc,zl,{__CANCEL__:!0});const kc=wc;function Cc(e,t,s){const i=s.config.validateStatus;s.status&&i&&!i(s.status)?t(new zl("Request failed with status code "+s.status,[zl.ERR_BAD_REQUEST,zl.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s)):e(s)}const xc=function(e,t){e=e||10;const s=new Array(e),i=new Array(e);let n,a=0,r=0;return t=void 0!==t?t:1e3,function(o){const l=Date.now(),c=i[r];n||(n=l),s[a]=o,i[a]=l;let u=r,h=0;for(;u!==a;)h+=s[u++],u%=e;if(a=(a+1)%e,a===r&&(r=(r+1)%e),l-n{n=a,s=null,i&&(clearTimeout(i),i=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),o=t-n;o>=a?r(e,t):(s=e,i||(i=setTimeout((()=>{i=null,r(s)}),a-o)))},()=>s&&r(s)]},Sc=(e,t,s=3)=>{let i=0;const n=xc(50,250);return Tc((s=>{const a=s.loaded,r=s.lengthComputable?s.total:void 0,o=a-i,l=n(o);i=a;e({loaded:a,total:r,progress:r?a/r:void 0,bytes:o,rate:l||void 0,estimated:l&&r&&a<=r?(r-a)/l:void 0,event:s,lengthComputable:null!=r,[t?"download":"upload"]:!0})}),s)},Oc=(e,t)=>{const s=null!=e;return[i=>t[0]({lengthComputable:s,total:e,loaded:i}),t[1]]},Ec=e=>(...t)=>Hl.asap((()=>e(...t))),jc=cc.hasStandardBrowserEnv?function(){const e=cc.navigator&&/(msie|trident)/i.test(cc.navigator.userAgent),t=document.createElement("a");let s;function i(s){let i=s;return e&&(t.setAttribute("href",i),i=t.href),t.setAttribute("href",i),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return s=i(window.location.href),function(e){const t=Hl.isString(e)?i(e):e;return t.protocol===s.protocol&&t.host===s.host}}():function(){return!0},Nc=cc.hasStandardBrowserEnv?{write(e,t,s,i,n,a){const r=[e+"="+encodeURIComponent(t)];Hl.isNumber(s)&&r.push("expires="+new Date(s).toGMTString()),Hl.isString(i)&&r.push("path="+i),Hl.isString(n)&&r.push("domain="+n),!0===a&&r.push("secure"),document.cookie=r.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Pc(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Ac=e=>e instanceof bc?{...e}:e;function Ic(e,t){t=t||{};const s={};function i(e,t,s){return Hl.isPlainObject(e)&&Hl.isPlainObject(t)?Hl.merge.call({caseless:s},e,t):Hl.isPlainObject(t)?Hl.merge({},t):Hl.isArray(t)?t.slice():t}function n(e,t,s){return Hl.isUndefined(t)?Hl.isUndefined(e)?void 0:i(void 0,e,s):i(e,t,s)}function a(e,t){if(!Hl.isUndefined(t))return i(void 0,t)}function r(e,t){return Hl.isUndefined(t)?Hl.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function o(s,n,a){return a in t?i(s,n):a in e?i(void 0,s):void 0}const l={url:a,method:a,data:a,baseURL:r,transformRequest:r,transformResponse:r,paramsSerializer:r,timeout:r,timeoutMessage:r,withCredentials:r,withXSRFToken:r,adapter:r,responseType:r,xsrfCookieName:r,xsrfHeaderName:r,onUploadProgress:r,onDownloadProgress:r,decompress:r,maxContentLength:r,maxBodyLength:r,beforeRedirect:r,transport:r,httpAgent:r,httpsAgent:r,cancelToken:r,socketPath:r,responseEncoding:r,validateStatus:o,headers:(e,t)=>n(Ac(e),Ac(t),!0)};return Hl.forEach(Object.keys(Object.assign({},e,t)),(function(i){const a=l[i]||n,r=a(e[i],t[i],i);Hl.isUndefined(r)&&a!==o||(s[i]=r)})),s}const Rc=e=>{const t=Ic({},e);let s,{data:i,withXSRFToken:n,xsrfHeaderName:a,xsrfCookieName:r,headers:o,auth:l}=t;if(t.headers=o=bc.from(o),t.url=ec(Pc(t.baseURL,t.url),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),Hl.isFormData(i))if(cc.hasStandardBrowserEnv||cc.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(!1!==(s=o.getContentType())){const[e,...t]=s?s.split(";").map((e=>e.trim())).filter(Boolean):[];o.setContentType([e||"multipart/form-data",...t].join("; "))}if(cc.hasStandardBrowserEnv&&(n&&Hl.isFunction(n)&&(n=n(t)),n||!1!==n&&jc(t.url))){const e=a&&r&&Nc.read(r);e&&o.set(a,e)}return t},Dc="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,s){const i=Rc(e);let n=i.data;const a=bc.from(i.headers).normalize();let r,o,l,c,u,{responseType:h,onUploadProgress:d,onDownloadProgress:p}=i;function m(){c&&c(),u&&u(),i.cancelToken&&i.cancelToken.unsubscribe(r),i.signal&&i.signal.removeEventListener("abort",r)}let f=new XMLHttpRequest;function v(){if(!f)return;const i=bc.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders());Cc((function(e){t(e),m()}),(function(e){s(e),m()}),{data:h&&"text"!==h&&"json"!==h?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:i,config:e,request:f}),f=null}f.open(i.method.toUpperCase(),i.url,!0),f.timeout=i.timeout,"onloadend"in f?f.onloadend=v:f.onreadystatechange=function(){f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))&&setTimeout(v)},f.onabort=function(){f&&(s(new zl("Request aborted",zl.ECONNABORTED,e,f)),f=null)},f.onerror=function(){s(new zl("Network Error",zl.ERR_NETWORK,e,f)),f=null},f.ontimeout=function(){let t=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const n=i.transitional||sc;i.timeoutErrorMessage&&(t=i.timeoutErrorMessage),s(new zl(t,n.clarifyTimeoutError?zl.ETIMEDOUT:zl.ECONNABORTED,e,f)),f=null},void 0===n&&a.setContentType(null),"setRequestHeader"in f&&Hl.forEach(a.toJSON(),(function(e,t){f.setRequestHeader(t,e)})),Hl.isUndefined(i.withCredentials)||(f.withCredentials=!!i.withCredentials),h&&"json"!==h&&(f.responseType=i.responseType),p&&([l,u]=Sc(p,!0),f.addEventListener("progress",l)),d&&f.upload&&([o,c]=Sc(d),f.upload.addEventListener("progress",o),f.upload.addEventListener("loadend",c)),(i.cancelToken||i.signal)&&(r=t=>{f&&(s(!t||t.type?new kc(null,e,f):t),f.abort(),f=null)},i.cancelToken&&i.cancelToken.subscribe(r),i.signal&&(i.signal.aborted?r():i.signal.addEventListener("abort",r)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(i.url);g&&-1===cc.protocols.indexOf(g)?s(new zl("Unsupported protocol "+g+":",zl.ERR_BAD_REQUEST,e)):f.send(n||null)}))},Fc=(e,t)=>{const{length:s}=e=e?e.filter(Boolean):[];if(t||s){let s,i=new AbortController;const n=function(e){if(!s){s=!0,r();const t=e instanceof Error?e:this.reason;i.abort(t instanceof zl?t:new kc(t instanceof Error?t.message:t))}};let a=t&&setTimeout((()=>{a=null,n(new zl(`timeout ${t} of ms exceeded`,zl.ETIMEDOUT))}),t);const r=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(n):e.removeEventListener("abort",n)})),e=null)};e.forEach((e=>e.addEventListener("abort",n)));const{signal:o}=i;return o.unsubscribe=()=>Hl.asap(r),o}},Lc=function*(e,t){let s=e.byteLength;if(!t||s{const n=async function*(e,t){for await(const s of Hc(e))yield*Lc(s,t)}(e,t);let a,r=0,o=e=>{a||(a=!0,i&&i(e))};return new ReadableStream({async pull(e){try{const{done:t,value:i}=await n.next();if(t)return o(),void e.close();let a=i.byteLength;if(s){let e=r+=a;s(e)}e.enqueue(new Uint8Array(i))}catch(e){throw o(e),e}},cancel:e=>(o(e),n.return())},{highWaterMark:2})},Mc="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Bc=Mc&&"function"==typeof ReadableStream,zc=Mc&&("function"==typeof TextEncoder?(Vc=new TextEncoder,e=>Vc.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Vc;const Gc=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Kc=Bc&&Gc((()=>{let e=!1;const t=new Request(cc.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),qc=Bc&&Gc((()=>Hl.isReadableStream(new Response("").body))),Jc={stream:qc&&(e=>e.body)};var Wc;Mc&&(Wc=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!Jc[e]&&(Jc[e]=Hl.isFunction(Wc[e])?t=>t[e]():(t,s)=>{throw new zl(`Response type '${e}' is not supported`,zl.ERR_NOT_SUPPORT,s)})})));const Yc=async(e,t)=>{const s=Hl.toFiniteNumber(e.getContentLength());return null==s?(async e=>{if(null==e)return 0;if(Hl.isBlob(e))return e.size;if(Hl.isSpecCompliantForm(e)){const t=new Request(cc.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Hl.isArrayBufferView(e)||Hl.isArrayBuffer(e)?e.byteLength:(Hl.isURLSearchParams(e)&&(e+=""),Hl.isString(e)?(await zc(e)).byteLength:void 0)})(t):s},Xc=Mc&&(async e=>{let{url:t,method:s,data:i,signal:n,cancelToken:a,timeout:r,onDownloadProgress:o,onUploadProgress:l,responseType:c,headers:u,withCredentials:h="same-origin",fetchOptions:d}=Rc(e);c=c?(c+"").toLowerCase():"text";let p,m=Fc([n,a&&a.toAbortSignal()],r);const f=m&&m.unsubscribe&&(()=>{m.unsubscribe()});let v;try{if(l&&Kc&&"get"!==s&&"head"!==s&&0!==(v=await Yc(u,i))){let e,s=new Request(t,{method:"POST",body:i,duplex:"half"});if(Hl.isFormData(i)&&(e=s.headers.get("content-type"))&&u.setContentType(e),s.body){const[e,t]=Oc(v,Sc(Ec(l)));i=Uc(s.body,65536,e,t)}}Hl.isString(h)||(h=h?"include":"omit");const n="credentials"in Request.prototype;p=new Request(t,{...d,signal:m,method:s.toUpperCase(),headers:u.normalize().toJSON(),body:i,duplex:"half",credentials:n?h:void 0});let a=await fetch(p);const r=qc&&("stream"===c||"response"===c);if(qc&&(o||r&&f)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=a[t]}));const t=Hl.toFiniteNumber(a.headers.get("content-length")),[s,i]=o&&Oc(t,Sc(Ec(o),!0))||[];a=new Response(Uc(a.body,65536,s,(()=>{i&&i(),f&&f()})),e)}c=c||"text";let g=await Jc[Hl.findKey(Jc,c)||"text"](a,e);return!r&&f&&f(),await new Promise(((t,s)=>{Cc(t,s,{data:g,headers:bc.from(a.headers),status:a.status,statusText:a.statusText,config:e,request:p})}))}catch(t){if(f&&f(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new zl("Network Error",zl.ERR_NETWORK,e,p),{cause:t.cause||t});throw zl.from(t,t&&t.code,e,p)}}),Zc={http:null,xhr:Dc,fetch:Xc};Hl.forEach(Zc,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const Qc=e=>`- ${e}`,eu=e=>Hl.isFunction(e)||null===e||!1===e,tu=e=>{e=Hl.isArray(e)?e:[e];const{length:t}=e;let s,i;const n={};for(let a=0;a`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));let s=t?e.length>1?"since :\n"+e.map(Qc).join("\n"):" "+Qc(e[0]):"as no adapter specified";throw new zl("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return i};function su(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new kc(null,e)}function iu(e){su(e),e.headers=bc.from(e.headers),e.data=yc.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return tu(e.adapter||dc.adapter)(e).then((function(t){return su(e),t.data=yc.call(e,e.transformResponse,t),t.headers=bc.from(t.headers),t}),(function(t){return $c(t)||(su(e),t&&t.response&&(t.response.data=yc.call(e,e.transformResponse,t.response),t.response.headers=bc.from(t.response.headers))),Promise.reject(t)}))}const nu="1.7.7",au={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{au[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}}));const ru={};au.transitional=function(e,t,s){function i(e,t){return"[Axios v1.7.7] Transitional option '"+e+"'"+t+(s?". "+s:"")}return(s,n,a)=>{if(!1===e)throw new zl(i(n," has been removed"+(t?" in "+t:"")),zl.ERR_DEPRECATED);return t&&!ru[n]&&(ru[n]=!0,console.warn(i(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(s,n,a)}};const ou={assertOptions:function(e,t,s){if("object"!=typeof e)throw new zl("options must be an object",zl.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let n=i.length;for(;n-- >0;){const a=i[n],r=t[a];if(r){const t=e[a],s=void 0===t||r(t,a,e);if(!0!==s)throw new zl("option "+a+" must be "+s,zl.ERR_BAD_OPTION_VALUE)}else if(!0!==s)throw new zl("Unknown option "+a,zl.ERR_BAD_OPTION)}},validators:au},lu=ou.validators;class cu{constructor(e){this.defaults=e,this.interceptors={request:new tc,response:new tc}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t;Error.captureStackTrace?Error.captureStackTrace(t={}):t=new Error;const s=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?s&&!String(e.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+s):e.stack=s}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ic(this.defaults,t);const{transitional:s,paramsSerializer:i,headers:n}=t;void 0!==s&&ou.assertOptions(s,{silentJSONParsing:lu.transitional(lu.boolean),forcedJSONParsing:lu.transitional(lu.boolean),clarifyTimeoutError:lu.transitional(lu.boolean)},!1),null!=i&&(Hl.isFunction(i)?t.paramsSerializer={serialize:i}:ou.assertOptions(i,{encode:lu.function,serialize:lu.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=n&&Hl.merge(n.common,n[t.method]);n&&Hl.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete n[e]})),t.headers=bc.concat(a,n);const r=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));const l=[];let c;this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)}));let u,h=0;if(!o){const e=[iu.bind(this),void 0];for(e.unshift.apply(e,r),e.push.apply(e,l),u=e.length,c=Promise.resolve(t);h{if(!s._listeners)return;let t=s._listeners.length;for(;t-- >0;)s._listeners[t](e);s._listeners=null})),this.promise.then=e=>{let t;const i=new Promise((e=>{s.subscribe(e),t=e})).then(e);return i.cancel=function(){s.unsubscribe(t)},i},e((function(e,i,n){s.reason||(s.reason=new kc(e,i,n),t(s.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new hu((function(t){e=t})),cancel:e}}}const du=hu;const pu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(pu).forEach((([e,t])=>{pu[t]=e}));const mu=pu;const fu=function e(t){const s=new uu(t),i=Xo(uu.prototype.request,s);return Hl.extend(i,uu.prototype,s,{allOwnKeys:!0}),Hl.extend(i,s,null,{allOwnKeys:!0}),i.create=function(s){return e(Ic(t,s))},i}(dc);fu.Axios=uu,fu.CanceledError=kc,fu.CancelToken=du,fu.isCancel=$c,fu.VERSION=nu,fu.toFormData=Jl,fu.AxiosError=zl,fu.Cancel=fu.CanceledError,fu.all=function(e){return Promise.all(e)},fu.spread=function(e){return function(t){return e.apply(null,t)}},fu.isAxiosError=function(e){return Hl.isObject(e)&&!0===e.isAxiosError},fu.mergeConfig=Ic,fu.AxiosHeaders=bc,fu.formToJSON=e=>uc(Hl.isHTMLForm(e)?new FormData(e):e),fu.getAdapter=tu,fu.HttpStatusCode=mu,fu.default=fu;const vu=fu,gu={address:Oa.base_url.replace("http","ws")+"/elecV2P",trynum:0,trying:!1,reconnectnum:5,reconnectgap:10,wsrecv:{connected:!1,add(e,t){if(e&&"function"==typeof t)return this.lists[e]?this.lists[e].push(t):(this.lists[e]=[t],this.id&&function(e){if(gu.wsrecv.send)gu.wsrecv.send("ready",e);else{const t={times:5,gap:3};t.tmpInt=setInterval((()=>{gu.wsrecv.send?(gu.wsrecv.send("ready",e),clearInterval(t.tmpInt),delete t.tmpInt):t.times<=0?(console.debug("wsrecv no send method yet"),clearInterval(t.tmpInt),delete t.tmpInt):t.times--}),1e3*t.gap)}}(e)),this.connected?void 0:"websocket "+lr("disconnected");console.error("websocket recver and a callbak function is expect")},dispatch(e,t){this.lists.minishell&&this.lists.minishell.forEach((s=>s({type:e,data:t}))),"minishell"!==e&&this.lists[e]?this.lists[e].forEach((e=>e(t))):this.lists.minishell||console.debug("there are no recver",e,"to render data",t)},lists:{},connect(){_u()}},upstatus(e){this.wsrecv.lists.elecV2Pstatus&&this.wsrecv.lists.elecV2Pstatus.forEach((t=>t({clients:e})))}};async function _u(){if(gu.trynum++,gu.wsrecv.connected)return void console.log(`[${Ba("websocket info")}][${Ha(null,1)}] websocket ${lr("connected")}`);if(gu.trying)return void console.log(`[${Ba("websocket info")}][${Ha(null,1)}] websocket is trying to connect...`);console.log(`[${Ba("websocket info")}][${Ha(null,1)}] 第 ${gu.trynum} 次尝试 websocket 连接中`),gu.upstatus(`第 ${gu.trynum} 次尝试连接中`);const e=new WebSocket(gu.address);gu.trying=!0,e.onopen=()=>{console.log(`[${Ba("websocket info")}][${Ha(null,1)}] WebSocket connected: ${gu.address}`),oo({off:!1}),gu.trynum=0,gu.trying=!1,gu.wsrecv.connected=!0,gu.upstatus(lr("connected")),gu.wsrecv.send=(t,s)=>{e.send(JSON.stringify({type:t,data:s,id:gu.wsrecv.id}))}},e.onmessage=e=>{try{e=JSON.parse(e.data),gu.wsrecv.dispatch(e.type,e.data)}catch(e){console.error("websocket data error:",e)}},e.onclose=e=>{console.error("WebSocket closed",e),gu.wsrecv.connected=!1,1008===e.code||4003===e.code?(gu.upstatus("无访问权限"),gu.wsrecv.dispatch("message",{type:"error",data:[`websocket 连接失败\n${e.reason}`]})):(gu.upstatus(lr("disconnected")),function(){if(gu.trynum>=gu.reconnectnum){let e="连接失败,请检查网络后尝试刷新页面";return console.error(`[${Ba("websocket error")}][${Ha(null,1)}] websocket ${e}`),gu.upstatus(e),gu.wsrecv.dispatch("tasklog",`[${Ba("websocket error")}][${Ha(null,1)}] [31mwebsocket ${e}`),void gu.wsrecv.dispatch("jsmanage",`[${Ba("websocket error")}][${Ha(null,1)}] [31mwebsocket ${e}`)}oo();const e=gu.reconnectgap*gu.trynum+5;console.log(`[${Ba("websocket info")}][${Ha(null,1)}] 客户端将在 ${e} 秒后尝试第 ${gu.trynum+1}/${gu.reconnectnum} 次重连`),gu.upstatus(`${lr("disconnected")},${e} 秒后尝试第 ${gu.trynum+1}/${gu.reconnectnum} 次重连 ${Ha().split(" ").pop()}`),gu.wsrecv.dispatch("tasklog",`[${Ba("websocket error")}][${Ha(null,1)}] [31mwebsocket ${lr("disconnected")},将在 ${e} 秒后尝试重连(如果不是手动断开或网络问题,可能是某个脚本运行出错,导致 elecV2P 重启,请根据 errors.log 和当前时间,找到相应脚本进行修改)`),gu.wsrecv.dispatch("jsmanage",`[${Ba("websocket error")}][${Ha(null,1)}] [31mwebsocket ${lr("disconnected")},将在 ${e} 秒后尝试重连(如果不是手动断开或网络问题,可能是某个脚本运行出错,导致 elecV2P 重启,请根据 errors.log 和当前时间,找到相应脚本进行修改)`),setTimeout((()=>{_u()}),1e3*e)}())},e.onerror=e=>{console.debug("WebSocket error",e),gu.trying=!1,gu.wsrecv.connected=!1}}gu.wsrecv.add("init",(e=>{e.secunset&&!Lr.get("secunset")&&(gu.wsrecv.dispatch("message",{type:"success",data:["当前 webUI 端口所有用户可访问,如部署在公网\n请务必前往 SETTING/设置 界面打开安全访问",{url:"#setting",secd:0}]}),console.log(`[${Ba("elecV2P notify")}][${Ha(null,1)}] 当前 webUI 端口所有用户可访问,如部署在公网请务必前往 SETTING/设置 界面打开安全访问`),Lr.set("secunset","true")),e.vernum?(gu.wsrecv.id=e.id,Object.keys(gu.wsrecv.lists).forEach((e=>{gu.wsrecv.send("ready",e),"jsmanage"!==e&&"tasklog"!==e||gu.wsrecv.lists[e].forEach((e=>e(`[${Ba("websocket info")}][${Ha(null,1)}] websocket ${lr("connected")}`)))})),console.log(`[${Ba("elecV2P info")}][${Ha(null,1)}] 当前 elecV2P 后台版本 ${e.version}`),console.log(`[${Ba("elecV2P info")}][${Ha(null,1)}] 当前 elecV2P webUI 版本 ${Oa.version}`),Oa.vernumco.evui(e),ti.prototype.$message=co.message,ti.prototype.$t=lr,ti.prototype.$ta=function(...e){const t=or[rr.locale]||or[rr.fallbackLocale],s=t.join_gap;return e.map((e=>t[e]||e)).join(s)},ti.config.productionTip=!1,new ti({el:"#app",render:e=>e(Yo)})})()})();
\ No newline at end of file
diff --git a/web/dist/index.html b/web/dist/index.html
index b1cef450..c3e7bb32 100644
--- a/web/dist/index.html
+++ b/web/dist/index.html
@@ -10,7 +10,7 @@
elecV2P - customize personal network
-
+
diff --git a/webmodule.js b/webmodule.js
index aac9ed16..70fada6f 100644
--- a/webmodule.js
+++ b/webmodule.js
@@ -3,6 +3,7 @@ const http = require('http')
const path = require('path')
const express = require('express')
const compression = require('compression')
+const { createProxyMiddleware } = require('http-proxy-middleware')
const { CONFIG, CONFIG_Port } = require('./config')
@@ -69,6 +70,14 @@ module.exports = () => {
wbrun(app)
wbeapp(app)
+ app.use(['/eproxy-logs', '/dist', '/latestLog', '/do-not-proxy', '/api/getInitData', '/fetchBody'], createProxyMiddleware({
+ target: 'http://localhost:' + CONFIG_Port.webif,
+ changeOrigin: true,
+ logLevel: CONFIG.gloglevel || 'info',
+ pathRewrite: {
+ '^/eproxy-logs': '/',
+ },
+ }))
app.use((req, res, next) => {
res.status(404).send(htmlTemplate(`${req.method} ${req.originalUrl}
404, Not Found