mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-10-04 08:16:17 +00:00
9 lines
109 KiB
JavaScript
9 lines
109 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/peerAssignModal-BlY9USB3.js","assets/localeText-BwlyH2uL.js","assets/index-D5fbjBmH.js","assets/index-XjBtNnya.css","assets/DashboardClientAssignmentStore-C45wUqOp.js","assets/peerAssignModal--_bmFbmn.css","assets/peerShareLinkModal-vYd2is_h.js","assets/dayjs.min-Rf3-f83x.js","assets/vue-datepicker-TsAnng-H.js","assets/peerShareLinkModal-DgDHiTOw.css","assets/peerJobs-Dy2B-B5E.js","assets/protocolBadge-BVQE6rMK.js","assets/index-DEZPVeS-.js","assets/peerJobs-D_dDl936.css","assets/peerQRCode-BuSsVfWC.js","assets/browser-DpR0RqZi.js","assets/peerQRCode-DuWWfBch.css","assets/peerConfigurationFile-CdJ_2hj_.js","assets/peerConfigurationFile-Z9ms5mIx.css","assets/peerSettings-BWazN9hG.js","assets/peerSettings-CSjO_Okh.css"])))=>i.map(i=>d[i]);
|
||
import{r as w,K as Y,D as U,o as X,H as G,x as me,q as W,c as m,f as i,a as e,b as l,u as E,d as $,t as S,g as K,_ as R,h as j,F as N,i as V,n as I,z as J,G as F,W as q,M as we,N as xe,O as Z,w as z,k as oe,e as O,j as A,P as ee,T as le,Q as te,J as he,m as D,y as M,R as ce,I as pe,v as H,E as ae,U as ke,s as Q,C as ge,V as Se,L as be,p as Pe,S as Ce}from"./index-D5fbjBmH.js";import{_ as Ie}from"./protocolBadge-BVQE6rMK.js";import{L as f}from"./localeText-BwlyH2uL.js";import{C as Ae,L as De,B as Le,a as Oe,b as Me,c as Ne,p as Re,d as Be,e as Te,f as je,P as Je,h as Ue,g as fe}from"./index-DEZPVeS-.js";import{d as ie}from"./dayjs.min-Rf3-f83x.js";import{Q as Ve}from"./vue-datepicker-TsAnng-H.js";const Ee={class:"row gx-2 gy-2 mb-3"},Ke={class:"col-12"},Fe={class:"card rounded-3 bg-transparent",style:{height:"270px"}},We={class:"card-header bg-transparent border-0"},ze={class:"text-muted"},He={class:"card-body pt-1"},qe={class:"col-sm col-lg-6"},Ge={class:"card rounded-3 bg-transparent",style:{height:"270px"}},Ye={class:"card-header bg-transparent border-0 d-flex align-items-center"},Qe={class:"text-muted"},Ze={key:0,class:"text-primary fw-bold ms-auto"},Xe={class:"card-body pt-1"},et={class:"col-sm col-lg-6"},tt={class:"card rounded-3 bg-transparent",style:{height:"270px"}},st={class:"card-header bg-transparent border-0 d-flex align-items-center"},ot={class:"text-muted"},lt={key:0,class:"text-success fw-bold ms-auto"},nt={class:"card-body pt-1"},at={__name:"peerDataUsageCharts",props:{configurationPeers:Array,configurationInfo:Object},setup(s){Ae.register(De,Le,Oe,Me,Ne,Re,Be,Te,je,Je);const t=s,n=w({timestamp:[],data:[]}),d=w({timestamp:[],data:[]}),c=Y(),p=U(),o=w(void 0),r=async()=>{await K("/api/getWireguardConfigurationRealtimeTraffic",{configurationName:c.params.id},g=>{let _=ie().format("hh:mm:ss A");(g.data.sent!==0&&g.data.recv!==0||n.value.data.length>0&&d.value.data.length>0)&&(n.value.timestamp.push(_),n.value.data.push(g.data.sent),d.value.timestamp.push(_),d.value.data.push(g.data.recv))})},u=()=>{clearInterval(o.value),o.value=void 0,t.configurationInfo.Status&&(o.value=setInterval(()=>{r()},parseInt(p.Configuration.Server.dashboard_refresh_interval)))};X(()=>{u()}),G(()=>t.configurationInfo.Status,()=>{u()}),G(()=>p.Configuration.Server.dashboard_refresh_interval,()=>{u()}),me(()=>{clearInterval(o.value),o.value=void 0});const v=W(()=>{let g=t.configurationPeers.filter(_=>_.cumu_data+_.total_data>0);return{labels:g.map(_=>_.name?_.name:`Untitled Peer - ${_.id}`),datasets:[{label:"Total Data Usage",data:g.map(_=>_.cumu_data+_.total_data),backgroundColor:g.map(_=>"#ffc107"),tooltip:{callbacks:{label:_=>`${_.formattedValue} GB`}}}]}}),h=W(()=>({labels:[...n.value.timestamp],datasets:[{label:"Data Sent",data:[...n.value.data],fill:!1,borderColor:"#198754",backgroundColor:"#198754",tension:0}]})),P=W(()=>({labels:[...d.value.timestamp],datasets:[{label:"Data Received",data:[...d.value.data],fill:!1,borderColor:"#0d6efd",backgroundColor:"#0d6efd",tension:0}]})),x=W(()=>({responsive:!0,plugins:{legend:{display:!1}},scales:{x:{ticks:{display:!1},grid:{display:!1}},y:{ticks:{callback:(g,_)=>`${Math.round((g+Number.EPSILON)*1e3)/1e3} GB`},grid:{display:!1}}}})),C=W(()=>({responsive:!0,plugins:{legend:{display:!1},tooltip:{callbacks:{label:g=>`${g.formattedValue} MB/s`}}},scales:{x:{ticks:{display:!1},grid:{display:!0}},y:{ticks:{callback:(g,_)=>`${Math.round((g+Number.EPSILON)*1e3)/1e3} MB/s`},grid:{display:!0}}}}));return(g,_)=>(i(),m("div",Ee,[e("div",Ke,[e("div",Fe,[e("div",We,[e("small",ze,[l(f,{t:"Peers Data Usage"})])]),e("div",He,[l(E(Ue),{data:v.value,options:x.value,style:{width:"100%",height:"200px","max-height":"200px"}},null,8,["data","options"])])])]),e("div",qe,[e("div",Ge,[e("div",Ye,[e("small",Qe,[l(f,{t:"Real Time Received Data Usage"})]),d.value.data.length>0?(i(),m("small",Ze,S(d.value.data[d.value.data.length-1])+" MB/s ",1)):$("",!0)]),e("div",Xe,[l(E(fe),{options:C.value,data:P.value,style:{width:"100%",height:"200px","max-height":"200px"}},null,8,["options","data"])])])]),e("div",et,[e("div",tt,[e("div",st,[e("small",ot,[l(f,{t:"Real Time Sent Data Usage"})]),n.value.data.length>0?(i(),m("small",lt,S(n.value.data[n.value.data.length-1])+" MB/s ",1)):$("",!0)]),e("div",nt,[l(E(fe),{options:C.value,data:h.value,style:{width:"100%",height:"200px","max-height":"200px"}},null,8,["options","data"])])])])]))}},it={name:"peerSearch",components:{LocaleText:f},setup(){const s=U(),t=q();return{store:s,wireguardConfigurationStore:t}},props:{configuration:Object},data(){return{sort:{status:F("Status"),name:F("Name"),allowed_ip:F("Allowed IPs"),restricted:F("Restricted")},interval:{5e3:F("5 Seconds"),1e4:F("10 Seconds"),3e4:F("30 Seconds"),6e4:F("1 Minutes")},display:{grid:F("Grid"),list:F("List")},searchString:"",searchStringTimeout:void 0,showDisplaySettings:!1,showMoreSettings:!1}},methods:{updateSort(s){J("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_sort",value:s},t=>{t.status&&this.store.getConfiguration()})},updateRefreshInterval(s){J("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_refresh_interval",value:s},t=>{t.status&&this.store.getConfiguration()})},updateDisplay(s){J("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_peer_list_display",value:s},t=>{t.status&&this.store.getConfiguration()})},downloadAllPeer(){K(`/api/downloadAllPeers/${this.configuration.Name}`,{},s=>{s.data.forEach(t=>{t.fileName=t.fileName+".conf"}),window.wireguard.generateZipFiles(s,this.configuration.Name)})}}},rt={class:"d-flex flex-column gap-2 my-4"},dt={class:"d-flex gap-2 peerSearchContainer"},ut={class:"dropdown"},ct={"data-bs-toggle":"dropdown",class:"btn w-100 btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle position-relative"},mt={class:"badge text-bg-primary ms-2"},pt={class:"dropdown-menu rounded-3"},bt=["onClick"],ft={class:"ms-auto"},vt={key:0,class:"bi bi-check-circle-fill"},ht={class:"dropdown"},gt={"data-bs-toggle":"dropdown",class:"btn btn-sm w-100 text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle position-relative"},_t={class:"badge text-bg-primary ms-2"},yt={class:"dropdown-menu rounded-3"},$t=["onClick"],wt={class:"ms-auto"},xt={key:0,class:"bi bi-check-circle-fill"},kt={class:"dropdown"},St={"data-bs-toggle":"dropdown",class:"btn btn-sm w-100 text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle position-relative"},Pt={class:"badge text-bg-primary ms-2"},Ct={class:"dropdown-menu rounded-3"},It=["onClick"],At={class:"ms-auto"},Dt={key:0,class:"bi bi-check-circle-fill"};function Lt(s,t,n,d,c,p){const o=j("LocaleText");return i(),m("div",rt,[e("div",dt,[e("div",ut,[e("button",ct,[t[4]||(t[4]=e("i",{class:"bi bi-sort-up me-2"},null,-1)),l(o,{t:"Sort By"}),e("span",mt,S(this.sort[d.store.Configuration.Server.dashboard_sort]),1)]),e("ul",pt,[(i(!0),m(N,null,V(this.sort,(r,u)=>(i(),m("li",null,[e("button",{class:"dropdown-item d-flex align-items-center",onClick:v=>this.updateSort(u)},[e("small",null,S(r),1),e("small",ft,[d.store.Configuration.Server.dashboard_sort===u?(i(),m("i",vt)):$("",!0)])],8,bt)]))),256))])]),e("div",ht,[e("button",gt,[t[5]||(t[5]=e("i",{class:"bi bi-arrow-repeat me-2"},null,-1)),l(o,{t:"Refresh Interval"}),e("span",_t,S(this.interval[d.store.Configuration.Server.dashboard_refresh_interval]),1)]),e("ul",yt,[(i(!0),m(N,null,V(this.interval,(r,u)=>(i(),m("li",null,[e("button",{class:"dropdown-item d-flex align-items-center",onClick:v=>this.updateRefreshInterval(u)},[e("small",null,S(r),1),e("small",wt,[d.store.Configuration.Server.dashboard_refresh_interval===u?(i(),m("i",xt)):$("",!0)])],8,$t)]))),256))])]),e("div",kt,[e("button",St,[e("i",{class:I(["bi me-2","bi-"+d.store.Configuration.Server.dashboard_peer_list_display])},null,2),l(o,{t:"Display"}),e("span",Pt,S(this.display[d.store.Configuration.Server.dashboard_peer_list_display]),1)]),e("ul",Ct,[(i(!0),m(N,null,V(this.display,(r,u)=>(i(),m("li",null,[e("button",{class:"dropdown-item d-flex align-items-center",onClick:v=>this.updateDisplay(u)},[e("small",null,S(r),1),e("small",At,[d.store.Configuration.Server.dashboard_peer_list_display===u?(i(),m("i",Dt)):$("",!0)])],8,It)]))),256))])]),e("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle ms-lg-auto",onClick:t[0]||(t[0]=r=>this.$emit("search"))},[t[6]||(t[6]=e("i",{class:"bi bi-search me-2"},null,-1)),l(o,{t:"Search"})]),e("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:t[1]||(t[1]=r=>this.downloadAllPeer())},[t[7]||(t[7]=e("i",{class:"bi bi-download me-2 me-lg-0 me-xl-2"},null,-1)),l(o,{t:"Download All",class:"d-sm-block d-lg-none d-xl-block"})]),e("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:t[2]||(t[2]=r=>this.$emit("selectPeers"))},[t[8]||(t[8]=e("i",{class:"bi bi-check2-all me-2 me-lg-0 me-xl-2"},null,-1)),l(o,{t:"Select Peers",class:"d-sm-block d-lg-none d-xl-block"})]),e("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:t[3]||(t[3]=r=>this.$emit("jobsAll")),type:"button","aria-expanded":"false"},[t[9]||(t[9]=e("i",{class:"bi bi-person-walking me-2 me-lg-0 me-xl-2"},null,-1)),l(o,{t:"Active Jobs",class:"d-sm-block d-lg-none d-xl-block"})])])])}const Ot=R(it,[["render",Lt],["__scopeId","data-v-7af0f399"]]);function Mt(s){return we()?(xe(s),!0):!1}const _e=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Nt=Object.prototype.toString,Rt=s=>Nt.call(s)==="[object Object]",se=()=>{},Bt=Tt();function Tt(){var s,t;return _e&&((s=window?.navigator)==null?void 0:s.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window?.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function de(s){return Array.isArray(s)?s:[s]}function jt(s,t,n){return G(s,t,{...n,immediate:!0})}const ye=_e?window:void 0;function ne(s){var t;const n=Z(s);return(t=n?.$el)!=null?t:n}function ue(...s){const t=[],n=()=>{t.forEach(r=>r()),t.length=0},d=(r,u,v,h)=>(r.addEventListener(u,v,h),()=>r.removeEventListener(u,v,h)),c=W(()=>{const r=de(Z(s[0])).filter(u=>u!=null);return r.every(u=>typeof u!="string")?r:void 0}),p=jt(()=>{var r,u;return[(u=(r=c.value)==null?void 0:r.map(v=>ne(v)))!=null?u:[ye].filter(v=>v!=null),de(Z(c.value?s[1]:s[0])),de(E(c.value?s[2]:s[1])),Z(c.value?s[3]:s[2])]},([r,u,v,h])=>{if(n(),!r?.length||!u?.length||!v?.length)return;const P=Rt(h)?{...h}:h;t.push(...r.flatMap(x=>u.flatMap(C=>v.map(g=>d(x,C,g,P)))))},{flush:"post"}),o=()=>{p(),n()};return Mt(n),o}let ve=!1;function Jt(s,t,n={}){const{window:d=ye,ignore:c=[],capture:p=!0,detectIframe:o=!1,controls:r=!1}=n;if(!d)return r?{stop:se,cancel:se,trigger:se}:se;if(Bt&&!ve){ve=!0;const k={passive:!0};Array.from(d.document.body.children).forEach(L=>L.addEventListener("click",se,k)),d.document.documentElement.addEventListener("click",se,k)}let u=!0;const v=k=>Z(c).some(L=>{if(typeof L=="string")return Array.from(d.document.querySelectorAll(L)).some(B=>B===k.target||k.composedPath().includes(B));{const B=ne(L);return B&&(k.target===B||k.composedPath().includes(B))}});function h(k){const L=Z(k);return L&&L.$.subTree.shapeFlag===16}function P(k,L){const B=Z(k),b=B.$.subTree&&B.$.subTree.children;return b==null||!Array.isArray(b)?!1:b.some(a=>a.el===L.target||L.composedPath().includes(a.el))}const x=k=>{const L=ne(s);if(k.target!=null&&!(!(L instanceof Element)&&h(s)&&P(s,k))&&!(!L||L===k.target||k.composedPath().includes(L))){if("detail"in k&&k.detail===0&&(u=!v(k)),!u){u=!0;return}t(k)}};let C=!1;const g=[ue(d,"click",k=>{C||(C=!0,setTimeout(()=>{C=!1},0),x(k))},{passive:!0,capture:p}),ue(d,"pointerdown",k=>{const L=ne(s);u=!v(k)&&!!(L&&!k.composedPath().includes(L))},{passive:!0}),o&&ue(d,"blur",k=>{setTimeout(()=>{var L;const B=ne(s);((L=d.document.activeElement)==null?void 0:L.tagName)==="IFRAME"&&!B?.contains(d.document.activeElement)&&t(k)},0)},{passive:!0})].filter(Boolean),_=()=>g.forEach(k=>k());return r?{stop:_,cancel:()=>{u=!1},trigger:k=>{u=!0,x(k),u=!1}}:_}const Ut={key:0,class:"position-absolute d-block p-1 px-2 bg-body text-body rounded-3 border shadow"},Vt={__name:"peerSettingsDropdownTool",props:{icon:String,title:String},emits:["click"],setup(s,{emit:t}){const n=t,d=w(!1);return(c,p)=>(i(),m("a",{class:"dropdown-item text-center px-0 rounded-3 position-relative",role:"button",onMouseenter:p[0]||(p[0]=o=>d.value=!0),onMouseleave:p[1]||(p[1]=o=>d.value=!1),onClick:p[2]||(p[2]=o=>n("click"))},[e("i",{class:I(["me-auto bi",s.icon])},null,2),l(oe,{name:"zoomReversed"},{default:z(()=>[d.value?(i(),m("span",Ut,[e("small",null,[l(f,{t:s.title},null,8,["t"])])])):$("",!0)]),_:1})],32))}},Et=R(Vt,[["__scopeId","data-v-d4e41a56"]]),Kt={name:"peerSettingsDropdown",components:{PeerSettingsDropdownTool:Et,LocaleText:f},setup(){return{dashboardStore:U()}},props:{Peer:Object},data(){return{deleteBtnDisabled:!1,restrictBtnDisabled:!1,allowAccessBtnDisabled:!1,confirmDelete:!1}},methods:{downloadPeer(){K("/api/downloadPeer/"+this.$route.params.id,{id:this.Peer.id},s=>{if(s.status){const t=new Blob([s.data.file],{type:"text/plain"}),n=URL.createObjectURL(t),d=`${s.data.fileName}.conf`,c=document.createElement("a");c.href=n,c.download=d,c.click(),this.dashboardStore.newMessage("WGDashboard","Peer download started","success")}else this.dashboardStore.newMessage("Server",s.message,"danger")})},downloadQRCode(s){K("/api/downloadPeer/"+this.$route.params.id,{id:this.Peer.id},t=>{t.status?this.$emit(s,t.data.file):this.dashboardStore.newMessage("Server",t.message,"danger")})},deletePeer(){this.deleteBtnDisabled=!0,J(`/api/deletePeers/${this.$route.params.id}`,{peers:[this.Peer.id]},s=>{this.dashboardStore.newMessage("Server",s.message,s.status?"success":"danger"),this.$emit("refresh"),this.deleteBtnDisabled=!1})},restrictPeer(){this.restrictBtnDisabled=!0,J(`/api/restrictPeers/${this.$route.params.id}`,{peers:[this.Peer.id]},s=>{this.dashboardStore.newMessage("Server",s.message,s.status?"success":"danger"),this.$emit("refresh"),this.restrictBtnDisabled=!1})},allowAccessPeer(){this.allowAccessBtnDisabled=!0,J(`/api/allowAccessPeers/${this.$route.params.id}`,{peers:[this.Peer.id]},s=>{this.dashboardStore.newMessage("Server",s.message,s.status?"success":"danger"),this.$emit("refresh"),this.allowAccessBtnDisabled=!1})}}},Ft={class:"dropdown-menu mt-2 shadow-lg d-block rounded-3",style:{"max-width":"200px"}},Wt={style:{"font-size":"0.8rem","padding-left":"var(--bs-dropdown-item-padding-x)","padding-right":"var(--bs-dropdown-item-padding-x)"}},zt={class:"text-body d-flex"},Ht={class:"ms-auto"},qt={key:1},Gt={class:"w-100 dropdown-item text-muted",style:{"white-space":"break-spaces","font-size":"0.7rem"}},Yt={key:2},Qt={class:"d-flex",style:{"padding-left":"var(--bs-dropdown-item-padding-x)","padding-right":"var(--bs-dropdown-item-padding-x)"}},Zt={key:1,class:"confirmDelete"},Xt={style:{"white-space":"break-spaces"},class:"mb-2 d-block fw-bold"},es={class:"d-flex w-100 gap-2"},ts=["disabled"],ss=["disabled"],os={key:1};function ls(s,t,n,d,c,p){const o=j("LocaleText"),r=j("PeerSettingsDropdownTool");return i(),m("ul",Ft,[this.Peer.restricted?(i(),m("li",os,[e("a",{class:I(["dropdown-item d-flex text-warning",{disabled:this.allowAccessBtnDisabled}]),onClick:t[11]||(t[11]=u=>this.allowAccessPeer()),role:"button"},[t[25]||(t[25]=e("i",{class:"me-auto bi bi-unlock"},null,-1)),this.allowAccessBtnDisabled?(i(),A(o,{key:1,t:"Allowing Access..."})):(i(),A(o,{key:0,t:"Allow Access"}))],2)])):(i(),m(N,{key:0},[this.confirmDelete?(i(),m("li",Zt,[e("p",Xt,[l(o,{t:"Are you sure to delete this peer?"})]),e("div",es,[e("button",{onClick:t[9]||(t[9]=u=>this.deletePeer()),disabled:this.deleteBtnDisabled,class:"flex-grow-1 ms-auto btn btn-sm bg-danger"},[l(o,{t:"Yes"})],8,ts),e("button",{disabled:this.deleteBtnDisabled,onClick:t[10]||(t[10]=u=>this.confirmDelete=!1),class:"flex-grow-1 btn btn-sm bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle"},[l(o,{t:"No"})],8,ss)])])):(i(),m(N,{key:0},[this.Peer.status==="running"?(i(),m(N,{key:0},[e("li",Wt,[e("span",zt,[t[12]||(t[12]=e("i",{class:"bi bi-box-arrow-in-right"},null,-1)),e("span",Ht,S(this.Peer.endpoint),1)])]),t[13]||(t[13]=e("li",null,[e("hr",{class:"dropdown-divider"})],-1))],64)):$("",!0),this.Peer.private_key?(i(),m("li",Yt,[t[14]||(t[14]=e("div",{class:"text-center text-muted"},null,-1)),e("div",Qt,[l(r,{icon:"bi-download",title:"Download",onClick:t[0]||(t[0]=u=>this.downloadPeer())}),l(r,{icon:"bi-qr-code",title:"QR Code",onClick:t[1]||(t[1]=u=>this.$emit("qrcode"))}),l(r,{icon:"bi-body-text",title:"Configuration File",onClick:t[2]||(t[2]=u=>this.$emit("configurationFile"))}),l(r,{icon:"bi-share",title:"Share Peer",onClick:t[3]||(t[3]=u=>this.$emit("share"))})])])):(i(),m("li",qt,[e("small",Gt,[l(o,{t:"Download & QR Code is not available due to no private key set for this peer"})])])),t[23]||(t[23]=e("li",null,[e("hr",{class:"dropdown-divider"})],-1)),e("li",null,[e("a",{class:"dropdown-item d-flex",role:"button",onClick:t[4]||(t[4]=u=>this.$emit("setting"))},[t[15]||(t[15]=e("i",{class:"me-auto bi bi-pen"},null,-1)),t[16]||(t[16]=O()),l(o,{t:"Peer Settings"})])]),e("li",null,[e("a",{class:"dropdown-item d-flex",role:"button",onClick:t[5]||(t[5]=u=>this.$emit("jobs"))},[t[17]||(t[17]=e("i",{class:"me-auto bi bi-app-indicator"},null,-1)),t[18]||(t[18]=O()),l(o,{t:"Schedule Jobs"})])]),e("li",null,[e("a",{class:"dropdown-item d-flex",role:"button",onClick:t[6]||(t[6]=u=>this.$emit("assign"))},[t[19]||(t[19]=e("i",{class:"me-auto bi bi-diagram-2"},null,-1)),t[20]||(t[20]=O()),l(o,{t:"Assign Peer"})])]),t[24]||(t[24]=e("li",null,[e("hr",{class:"dropdown-divider"})],-1)),e("li",null,[e("a",{class:I(["dropdown-item d-flex text-warning",{disabled:this.restrictBtnDisabled}]),onClick:t[7]||(t[7]=u=>this.restrictPeer()),role:"button"},[t[21]||(t[21]=e("i",{class:"me-auto bi bi-lock"},null,-1)),this.restrictBtnDisabled?(i(),A(o,{key:1,t:"Restricting..."})):(i(),A(o,{key:0,t:"Restrict Access"}))],2)]),e("li",null,[e("a",{class:I(["dropdown-item d-flex fw-bold text-danger",{disabled:this.deleteBtnDisabled}]),onClick:t[8]||(t[8]=u=>this.confirmDelete=!0),role:"button"},[t[22]||(t[22]=e("i",{class:"me-auto bi bi-trash"},null,-1)),this.deleteBtnDisabled?(i(),A(o,{key:1,t:"Deleting..."})):(i(),A(o,{key:0,t:"Delete"}))],2)])],64))],64))])}const ns=R(Kt,[["render",ls],["__scopeId","data-v-d636c35d"]]),as={name:"peer",methods:{GetLocale:F},components:{LocaleText:f,PeerSettingsDropdown:ns},props:{Peer:Object},data(){return{}},setup(){const s=w(null),t=w(!1),n=U();return Jt(s,d=>{t.value=!1}),{target:s,subMenuOpened:t,dashboardStore:n}},computed:{getLatestHandshake(){return this.Peer.latest_handshake.includes(",")?this.Peer.latest_handshake.split(",")[0]:this.Peer.latest_handshake}}},is=["id"],rs={key:0,class:"card-header bg-transparent d-flex align-items-center gap-2 border-0"},ds={key:0,style:{"font-size":"0.8rem",color:"#28a745"},class:"d-flex align-items-center"},us={style:{"font-size":"0.8rem"},class:"ms-auto d-flex gap-2"},cs={class:"text-primary"},ms={class:"text-success"},ps={key:0,class:"text-secondary"},bs={key:1,class:"border-0 card-header bg-transparent text-warning fw-bold",style:{"font-size":"0.8rem"}},fs={class:"card-body pt-1",style:{"font-size":"0.9rem"}},vs={class:"text-muted"},hs={class:"d-block"},gs={class:"text-muted"},_s={class:"d-block"},ys={class:"d-flex align-items-end ms-auto"};function $s(s,t,n,d,c,p){const o=j("LocaleText"),r=j("PeerSettingsDropdown");return i(),m("div",{class:I(["card shadow-sm rounded-3 peerCard",{"border-warning":n.Peer.restricted}]),id:"peer_"+n.Peer.id},[e("div",null,[n.Peer.restricted?(i(),m("div",bs,[t[14]||(t[14]=e("i",{class:"bi-lock-fill me-2"},null,-1)),l(o,{t:"Access Restricted"})])):(i(),m("div",rs,[e("div",{class:I(["dot ms-0",{active:n.Peer.status==="running"}])},null,2),d.dashboardStore.Configuration.Server.dashboard_peer_list_display==="list"&&n.Peer.status==="running"?(i(),m("div",ds,[t[8]||(t[8]=e("i",{class:"bi bi-box-arrow-in-right me-2"},null,-1)),e("span",null,S(n.Peer.endpoint),1)])):$("",!0),e("div",us,[e("span",cs,[t[9]||(t[9]=e("i",{class:"bi bi-arrow-down"},null,-1)),e("strong",null,S((n.Peer.cumu_receive+n.Peer.total_receive).toFixed(4)),1),t[10]||(t[10]=O(" GB "))]),e("span",ms,[t[11]||(t[11]=e("i",{class:"bi bi-arrow-up"},null,-1)),e("strong",null,S((n.Peer.cumu_sent+n.Peer.total_sent).toFixed(4)),1),t[12]||(t[12]=O(" GB "))]),n.Peer.latest_handshake!=="No Handshake"?(i(),m("span",ps,[t[13]||(t[13]=e("i",{class:"bi bi-arrows-angle-contract"},null,-1)),O(" "+S(p.getLatestHandshake)+" ago ",1)])):$("",!0)])]))]),e("div",fs,[e("h6",null,S(n.Peer.name?n.Peer.name:p.GetLocale("Untitled Peer")),1),e("div",{class:I(["d-flex",[d.dashboardStore.Configuration.Server.dashboard_peer_list_display==="grid"?"gap-1 flex-column":"flex-row gap-3"]])},[e("div",{class:I({"d-flex gap-2 align-items-center":d.dashboardStore.Configuration.Server.dashboard_peer_list_display==="list"})},[e("small",vs,[l(o,{t:"Public Key"})]),e("small",hs,[e("samp",null,S(n.Peer.id),1)])],2),e("div",{class:I({"d-flex gap-2 align-items-center":d.dashboardStore.Configuration.Server.dashboard_peer_list_display==="list"})},[e("small",gs,[l(o,{t:"Allowed IPs"})]),e("small",_s,[e("samp",null,S(n.Peer.allowed_ip),1)])],2),e("div",ys,[e("div",{class:I(["ms-auto px-2 rounded-3 subMenuBtn",{active:this.subMenuOpened}])},[e("a",{role:"button",class:"text-body",onClick:t[0]||(t[0]=u=>this.subMenuOpened=!0)},t[15]||(t[15]=[e("h5",{class:"mb-0"},[e("i",{class:"bi bi-three-dots"})],-1)])),l(oe,{name:"slide-fade"},{default:z(()=>[this.subMenuOpened?(i(),A(r,{key:0,onQrcode:t[1]||(t[1]=u=>this.$emit("qrcode")),onConfigurationFile:t[2]||(t[2]=u=>this.$emit("configurationFile")),onSetting:t[3]||(t[3]=u=>this.$emit("setting")),onJobs:t[4]||(t[4]=u=>this.$emit("jobs")),onRefresh:t[5]||(t[5]=u=>this.$emit("refresh")),onShare:t[6]||(t[6]=u=>this.$emit("share")),onAssign:t[7]||(t[7]=u=>this.$emit("assign")),Peer:n.Peer,ref:"target"},null,8,["Peer"])):$("",!0)]),_:1})],2)])],2)])],10,is)}const ws=R(as,[["render",$s],["__scopeId","data-v-b909bf3c"]]),xs={__name:"peerListModals",props:{configurationModals:Object,configurationModalSelectedPeer:Object},emits:["refresh"],setup(s,{emit:t}){const n=t,d=ee(()=>te(()=>import("./peerAssignModal-BlY9USB3.js"),__vite__mapDeps([0,1,2,3,4,5]))),c=ee(()=>te(()=>import("./peerShareLinkModal-vYd2is_h.js"),__vite__mapDeps([6,2,3,7,8,1,9]))),p=ee(()=>te(()=>import("./peerJobs-Dy2B-B5E.js"),__vite__mapDeps([10,2,3,1,11,12,7,8,13]))),o=ee(()=>te(()=>import("./peerQRCode-BuSsVfWC.js"),__vite__mapDeps([14,15,2,3,1,16]))),r=ee(()=>te(()=>import("./peerConfigurationFile-CdJ_2hj_.js"),__vite__mapDeps([17,2,3,1,15,18]))),u=ee(()=>te(()=>import("./peerSettings-BWazN9hG.js"),__vite__mapDeps([19,2,3,1,20])));return(v,h)=>(i(),A(le,{name:"zoom"},{default:z(()=>[s.configurationModals.peerSetting.modalOpen?(i(),A(E(u),{key:"PeerSettingsModal",selectedPeer:s.configurationModalSelectedPeer,onRefresh:h[0]||(h[0]=P=>n("refresh")),onClose:h[1]||(h[1]=P=>s.configurationModals.peerSetting.modalOpen=!1)},null,8,["selectedPeer"])):$("",!0),s.configurationModals.peerQRCode.modalOpen?(i(),A(E(o),{key:"PeerQRCodeModal",selectedPeer:s.configurationModalSelectedPeer,onClose:h[2]||(h[2]=P=>s.configurationModals.peerQRCode.modalOpen=!1)},null,8,["selectedPeer"])):$("",!0),s.configurationModals.peerScheduleJobs.modalOpen?(i(),A(E(p),{key:"PeerJobsModal",onRefresh:h[3]||(h[3]=P=>n("refresh")),selectedPeer:s.configurationModalSelectedPeer,onClose:h[4]||(h[4]=P=>s.configurationModals.peerScheduleJobs.modalOpen=!1)},null,8,["selectedPeer"])):$("",!0),s.configurationModals.peerShare.modalOpen?(i(),A(E(c),{key:"PeerShareLinkModal",onClose:h[5]||(h[5]=P=>{s.configurationModals.peerShare.modalOpen=!1}),selectedPeer:s.configurationModalSelectedPeer},null,8,["selectedPeer"])):$("",!0),s.configurationModals.peerConfigurationFile.modalOpen?(i(),A(E(r),{key:4,onClose:h[6]||(h[6]=P=>s.configurationModals.peerConfigurationFile.modalOpen=!1),selectedPeer:s.configurationModalSelectedPeer},null,8,["selectedPeer"])):$("",!0),s.configurationModals.assignPeer.modalOpen?(i(),A(E(d),{key:5,selectedPeer:s.configurationModalSelectedPeer,onClose:h[7]||(h[7]=P=>s.configurationModals.assignPeer.modalOpen=!1)},null,8,["selectedPeer"])):$("",!0)]),_:1}))}},ks={style:{"margin-bottom":"20px",height:"1px"},id:"loadMore"},Ss={__name:"peerIntersectionObserver",props:["peerListLength","showPeersCount"],emits:["loadMore"],setup(s,{emit:t}){const n=w(void 0),d=t;return X(()=>{n.value=new IntersectionObserver(c=>{c.forEach(p=>{p.isIntersecting&&d("loadMore")})},{rootMargin:"20px",threshold:1}),n.value.observe(document.querySelector("#loadMore"))}),me(()=>{n.value.disconnect()}),(c,p)=>(i(),m("div",ks))}},Ps={class:"d-flex gap-1 flex-column"},Cs=he({__name:"configurationDescription",props:["configuration"],setup(s){const t=s,n=w(t.configuration.Info.Description),d=w(!1),c=w(!1),p=async()=>{await J("/api/updateWireguardConfigurationInfo",{Name:t.configuration.Name,Key:"Description",Value:n.value},r=>{c.value=r.status,o()})},o=()=>{d.value=!0,setTimeout(()=>{d.value=!1},3e3)};return(r,u)=>(i(),m("div",Ps,[u[2]||(u[2]=e("label",{for:"configurationDescription"},[e("small",{style:{"white-space":"nowrap"},class:"text-muted"},[e("i",{class:"bi bi-pencil-fill me-2"}),O("Notes ")])],-1)),D(e("input",{type:"text",class:I([[d.value?[c.value?"is-valid":"is-invalid"]:void 0],"form-control rounded-3 bg-transparent form-control-sm"]),id:"configurationDescription","onUpdate:modelValue":u[0]||(u[0]=v=>n.value=v),onChange:u[1]||(u[1]=v=>p())},null,34),[[M,n.value]])]))}}),Is={class:"fixed-bottom w-100 bottom-0 z-2",style:{"z-index":"1"}},As={class:"container-fluid"},Ds={class:"row g-0"},Ls={class:"col-md-9 col-lg-10 d-flex justify-content-center py-2"},Os={class:"rounded-3 p-2 border shadow searchPeersContainer bg-body-tertiary"},Ms={class:"d-flex gap-1 align-items-center px-2"},Ns=["placeholder"],Rs={__name:"peerSearchBar",emits:["close"],setup(s,{emit:t}){const n=W(()=>F("Search Peers..."));let d;const c=q(),p=w(c.searchString),o=()=>{d?(clearTimeout(d),d=setTimeout(()=>{c.searchString=p.value},300)):d=setTimeout(()=>{c.searchString=p.value},300)},r=t,u=ce("searchBar"),v=Y(),h=pe();return v.query.peer&&(p.value=v.query.peer,h.replace({query:null})),X(()=>{u.value.focus()}),(P,x)=>(i(),A(oe,{name:"slideUp",appear:"",type:"animation",style:{"animation-delay":"1s"}},{default:z(()=>[e("div",Is,[e("div",As,[e("div",Ds,[x[5]||(x[5]=e("div",{class:"col-md-3 col-lg-2"},null,-1)),e("div",Ls,[e("div",Os,[e("div",Ms,[x[4]||(x[4]=e("h6",{class:"mb-0 me-2"},[e("label",{for:"searchPeers"},[e("i",{class:"bi bi-search"})])],-1)),D(e("input",{ref:"searchBar",class:"flex-grow-1 form-control rounded-3 bg-secondary-subtle border-1 border-secondary-subtle",placeholder:n.value,id:"searchPeers",onKeyup:x[0]||(x[0]=C=>o()),"onUpdate:modelValue":x[1]||(x[1]=C=>p.value=C)},null,40,Ns),[[M,p.value]]),e("button",{onClick:x[2]||(x[2]=C=>r("close")),style:{"white-space":"nowrap"},class:"btn bg-secondary-subtle text-secondary-emphasis border-secondary-subtle rounded-3 d-flex align-items-center"},[e("span",null,[x[3]||(x[3]=e("i",{class:"bi bi-x-circle-fill me-2"},null,-1)),l(f,{t:"Done"})])])])])])])])])]),_:1}))}},Bs=R(Rs,[["__scopeId","data-v-e976c90a"]]),Ts={name:"scheduleDropdown",props:{options:Array,data:String,edit:!1},setup(s){s.data===void 0&&this.$emit("update",this.options[0].value)},computed:{currentSelection(){return this.options.find(s=>s.value===this.data)}}},js={class:"dropdown scheduleDropdown"},Js={class:"dropdown-menu rounded-3 shadow",style:{"font-size":"0.875rem",width:"200px"}},Us=["onClick"],Vs={key:0,class:"bi bi-check ms-auto"};function Es(s,t,n,d,c,p){return i(),m("div",js,[e("button",{class:I(["btn btn-sm btn-outline-primary rounded-3",{"disabled border-transparent":!n.edit}]),type:"button","data-bs-toggle":"dropdown","aria-expanded":"false"},[e("samp",null,S(this.currentSelection.display),1)],2),e("ul",Js,[n.edit?(i(!0),m(N,{key:0},V(this.options,o=>(i(),m("li",null,[e("a",{class:"dropdown-item d-flex align-items-center",role:"button",onClick:r=>s.$emit("update",o.value)},[e("samp",null,S(o.display),1),o.value===this.currentSelection.value?(i(),m("i",Vs)):$("",!0)],8,Us)]))),256)):$("",!0)])])}const Ks=R(Ts,[["render",Es],["__scopeId","data-v-6a5aba2a"]]),Fs={name:"schedulePeerJob",components:{LocaleText:f,VueDatePicker:Ve,ScheduleDropdown:Ks},props:{dropdowns:Array[Object],pjob:Object,viewOnly:!1},setup(s){const t=w({}),n=w(!1),d=w(!1);t.value=JSON.parse(JSON.stringify(s.pjob)),t.value.CreationDate||(n.value=!0,d.value=!0);const c=U();return{job:t,edit:n,newJob:d,store:c}},data(){return{inputType:void 0}},watch:{pjob:{deep:!0,immediate:!0,handler(s){this.edit||(this.job=JSON.parse(JSON.stringify(s)))}}},methods:{save(){this.job.Field&&this.job.Operator&&this.job.Action&&this.job.Value?J("/api/savePeerScheduleJob",{Job:this.job},s=>{s.status?(this.edit=!1,this.store.newMessage("Server","Peer job saved","success"),console.log(s.data),this.$emit("refresh",s.data[0]),this.newJob=!1):this.store.newMessage("Server",s.message,"danger")}):this.alert()},alert(){let s="animate__flash",t=this.$el.querySelectorAll(".scheduleDropdown"),n=this.$el.querySelectorAll("input");t.forEach(d=>d.classList.add("animate__animated",s)),n.forEach(d=>d.classList.add("animate__animated",s)),setTimeout(()=>{t.forEach(d=>d.classList.remove("animate__animated",s)),n.forEach(d=>d.classList.remove("animate__animated",s))},2e3)},reset(){this.job.CreationDate?(this.job=JSON.parse(JSON.stringify(this.pjob)),this.edit=!1):this.$emit("delete")},delete(){this.job.CreationDate&&J("/api/deletePeerScheduleJob",{Job:this.job},s=>{s.status?this.store.newMessage("Server","Peer job deleted","success"):(this.store.newMessage("Server",s.message,"danger"),this.$emit("delete"))}),this.$emit("delete")},parseTime(s){s&&(this.job.Value=ie(s).format("YYYY-MM-DD HH:mm:ss"))}}},Ws={class:"card-header bg-transparent text-muted border-0"},zs={key:0,class:"d-flex"},Hs={class:"me-auto"},qs={key:1},Gs={class:"badge text-bg-warning"},Ys={class:"card-body pt-1",style:{"font-family":"var(--bs-font-monospace)"}},Qs={class:"d-flex gap-2 align-items-center mb-2"},Zs=["disabled"],Xs={class:"px-5 d-flex gap-2 align-items-center"},eo={class:"d-flex gap-3"},to={key:0,class:"ms-auto d-flex gap-3"},so={key:1,class:"ms-auto d-flex gap-3"};function oo(s,t,n,d,c,p){const o=j("LocaleText"),r=j("ScheduleDropdown"),u=j("VueDatePicker");return i(),m("div",{class:I(["card shadow-sm rounded-3 mb-2",{"border-warning-subtle":this.newJob}])},[e("div",Ws,[this.newJob?(i(),m("small",qs,[e("span",Gs,[l(o,{t:"Unsaved Job"})])])):(i(),m("small",zs,[e("strong",Hs,[l(o,{t:"Job ID"})]),e("samp",null,S(this.job.JobID),1)]))]),e("div",Ys,[e("div",Qs,[e("samp",null,[l(o,{t:"if"})]),l(r,{edit:d.edit,options:this.dropdowns.Field,data:this.job.Field,onUpdate:t[0]||(t[0]=v=>{this.job.Field=v})},null,8,["edit","options","data"]),e("samp",null,[l(o,{t:"is"})]),l(r,{edit:d.edit,options:this.dropdowns.Operator,data:this.job.Operator,onUpdate:t[1]||(t[1]=v=>this.job.Operator=v)},null,8,["edit","options","data"]),this.job.Field==="date"?(i(),A(u,{key:0,is24:!0,"min-date":new Date,"model-value":this.job.Value,"onUpdate:modelValue":this.parseTime,"time-picker-inline":"",format:"yyyy-MM-dd HH:mm:ss","preview-format":"yyyy-MM-dd HH:mm:ss",clearable:!1,disabled:!d.edit,dark:this.store.Configuration.Server.dashboard_theme==="dark"},null,8,["min-date","model-value","onUpdate:modelValue","disabled","dark"])):D((i(),m("input",{key:1,class:"form-control form-control-sm form-control-dark rounded-3 flex-grow-1",disabled:!d.edit,"onUpdate:modelValue":t[2]||(t[2]=v=>this.job.Value=v),style:{width:"auto"}},null,8,Zs)),[[M,this.job.Value]]),e("samp",null,S(this.dropdowns.Field.find(v=>v.value===this.job.Field)?.unit)+" { ",1)]),e("div",Xs,[e("samp",null,[l(o,{t:"then"})]),l(r,{edit:d.edit,options:this.dropdowns.Action,data:this.job.Action,onUpdate:t[3]||(t[3]=v=>this.job.Action=v)},null,8,["edit","options","data"])]),e("div",eo,[t[12]||(t[12]=e("samp",null,"}",-1)),this.edit?(i(),m("div",so,[e("a",{role:"button",class:"text-secondary text-decoration-none",onClick:t[6]||(t[6]=v=>this.reset())},[t[10]||(t[10]=O("[C] ")),l(o,{t:"Cancel"})]),e("a",{role:"button",class:"text-primary ms-auto text-decoration-none",onClick:t[7]||(t[7]=v=>this.save())},[t[11]||(t[11]=O("[S] ")),l(o,{t:"Save"})])])):(i(),m("div",to,[e("a",{role:"button",class:"ms-auto text-decoration-none",onClick:t[4]||(t[4]=v=>this.edit=!0)},[t[8]||(t[8]=O("[E] ")),l(o,{t:"Edit"})]),e("a",{role:"button",onClick:t[5]||(t[5]=v=>this.delete()),class:"text-danger text-decoration-none"},[t[9]||(t[9]=O("[D] ")),l(o,{t:"Delete"})])]))])])],2)}const lo=R(Fs,[["render",oo],["__scopeId","data-v-4aa63a3e"]]),no={name:"peerJobsAllModal",setup(){return{store:q()}},components:{LocaleText:f,SchedulePeerJob:lo},props:{configurationPeers:Array[Object]},computed:{getAllJobs(){return this.configurationPeers.filter(s=>s.jobs.length>0)}}},ao={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll"},io={class:"container d-flex h-100 w-100"},ro={class:"m-auto modal-dialog-centered dashboardModal"},uo={class:"card rounded-3 shadow",style:{width:"900px"}},co={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-2"},mo={class:"mb-0 fw-normal"},po={class:"card-body px-4 pb-4 pt-2"},bo={key:0,class:"accordion",id:"peerJobsLogsModalAccordion"},fo={class:"accordion-header"},vo=["data-bs-target"],ho={key:0},go={class:"text-muted"},_o=["id"],yo={class:"accordion-body"},$o={key:1,class:"card shadow-sm",style:{height:"153px"}},wo={class:"card-body text-muted text-center d-flex"},xo={class:"m-auto"};function ko(s,t,n,d,c,p){const o=j("LocaleText"),r=j("SchedulePeerJob");return i(),m("div",ao,[e("div",io,[e("div",ro,[e("div",uo,[e("div",co,[e("h4",mo,[l(o,{t:"All Active Jobs"})]),e("button",{type:"button",class:"btn-close ms-auto",onClick:t[0]||(t[0]=u=>this.$emit("close"))})]),e("div",po,[e("button",{class:"btn bg-primary-subtle border-1 border-primary-subtle text-primary-emphasis rounded-3 shadow mb-2",onClick:t[1]||(t[1]=u=>this.$emit("allLogs"))},[t[4]||(t[4]=e("i",{class:"bi bi-clock me-2"},null,-1)),l(o,{t:"Logs"})]),this.getAllJobs.length>0?(i(),m("div",bo,[(i(!0),m(N,null,V(this.getAllJobs,(u,v)=>(i(),m("div",{class:"accordion-item",key:u.id},[e("h2",fo,[e("button",{class:"accordion-button collapsed",type:"button","data-bs-toggle":"collapse","data-bs-target":"#collapse_"+v},[e("small",null,[e("strong",null,[u.name?(i(),m("span",ho,S(u.name)+" • ",1)):$("",!0),e("samp",go,S(u.id),1)])])],8,vo)]),e("div",{id:"collapse_"+v,class:"accordion-collapse collapse","data-bs-parent":"#peerJobsLogsModalAccordion"},[e("div",yo,[(i(!0),m(N,null,V(u.jobs,h=>(i(),A(r,{onDelete:t[2]||(t[2]=P=>this.$emit("refresh")),onRefresh:t[3]||(t[3]=P=>this.$emit("refresh")),dropdowns:this.store.PeerScheduleJobs.dropdowns,viewOnly:!0,key:h.JobID,pjob:h},null,8,["dropdowns","pjob"]))),128))])],8,_o)]))),128))])):(i(),m("div",$o,[e("div",wo,[e("span",xo,[l(o,{t:"No active job at the moment."})])])]))])])])])])}const So=R(no,[["render",ko]]),Po={name:"peerJobsLogsModal",components:{LocaleText:f},props:{configurationInfo:Object},data(){return{dataLoading:!0,data:[],logFetchTime:void 0,showLogID:!1,showJobID:!0,showSuccessJob:!0,showFailedJob:!0,showLogAmount:10}},async mounted(){await this.fetchLog()},methods:{async fetchLog(){this.dataLoading=!0,await K(`/api/getPeerScheduleJobLogs/${this.configurationInfo.Name}`,{},s=>{this.data=s.data,this.logFetchTime=ie().format("YYYY-MM-DD HH:mm:ss"),this.dataLoading=!1})}},computed:{getLogs(){return this.data.filter(s=>this.showSuccessJob&&["1","true"].includes(s.Status)||this.showFailedJob&&["0","false"].includes(s.Status))},showLogs(){return this.getLogs.slice(0,this.showLogAmount)}}},Co={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll"},Io={class:"container-fluid d-flex h-100 w-100"},Ao={class:"m-auto mt-0 modal-dialog-centered dashboardModal",style:{width:"100%"}},Do={class:"card rounded-3 shadow w-100"},Lo={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-0"},Oo={class:"mb-0"},Mo={class:"card-body px-4 pb-4 pt-2"},No={key:0},Ro={class:"mb-2 d-flex gap-3"},Bo={class:"d-flex gap-3 align-items-center"},To={class:"text-muted"},jo={class:"form-check"},Jo={class:"form-check-label",for:"jobLogsShowSuccessCheck"},Uo={class:"badge text-success-emphasis bg-success-subtle"},Vo={class:"form-check"},Eo={class:"form-check-label",for:"jobLogsShowFailedCheck"},Ko={class:"badge text-danger-emphasis bg-danger-subtle"},Fo={class:"d-flex gap-3 align-items-center ms-auto"},Wo={class:"text-muted"},zo={class:"form-check"},Ho={class:"form-check-label",for:"jobLogsShowJobIDCheck"},qo={class:"form-check"},Go={class:"form-check-label",for:"jobLogsShowLogIDCheck"},Yo={class:"table"},Qo={scope:"col"},Zo={key:0,scope:"col"},Xo={key:1,scope:"col"},el={scope:"col"},tl={scope:"col"},sl={style:{"font-size":"0.875rem"}},ol={scope:"row"},ll={key:0},nl={class:"text-muted"},al={key:1},il={class:"text-muted"},rl={class:"d-flex gap-2"},dl={key:1,class:"d-flex align-items-center flex-column"};function ul(s,t,n,d,c,p){const o=j("LocaleText");return i(),m("div",Co,[e("div",Io,[e("div",Ao,[e("div",Do,[e("div",Lo,[e("h4",Oo,[l(o,{t:"Jobs Logs"})]),e("button",{type:"button",class:"btn-close ms-auto",onClick:t[0]||(t[0]=r=>this.$emit("close"))})]),e("div",Mo,[this.dataLoading?(i(),m("div",dl,t[11]||(t[11]=[e("div",{class:"spinner-border text-body",role:"status"},[e("span",{class:"visually-hidden"},"Loading...")],-1)]))):(i(),m("div",No,[e("p",null,[l(o,{t:"Updated at"}),O(" : "+S(this.logFetchTime),1)]),e("div",Ro,[e("button",{onClick:t[1]||(t[1]=r=>this.fetchLog()),class:"btn btn-sm rounded-3 shadow-sm text-info-emphasis bg-info-subtle border-1 border-info-subtle me-1"},[t[8]||(t[8]=e("i",{class:"bi bi-arrow-clockwise me-2"},null,-1)),l(o,{t:"Refresh"})]),e("div",Bo,[e("span",To,[l(o,{t:"Filter"})]),e("div",jo,[D(e("input",{class:"form-check-input",type:"checkbox","onUpdate:modelValue":t[2]||(t[2]=r=>this.showSuccessJob=r),id:"jobLogsShowSuccessCheck"},null,512),[[H,this.showSuccessJob]]),e("label",Jo,[e("span",Uo,[l(o,{t:"Success"})])])]),e("div",Vo,[D(e("input",{class:"form-check-input",type:"checkbox","onUpdate:modelValue":t[3]||(t[3]=r=>this.showFailedJob=r),id:"jobLogsShowFailedCheck"},null,512),[[H,this.showFailedJob]]),e("label",Eo,[e("span",Ko,[l(o,{t:"Failed"})])])])]),e("div",Fo,[e("span",Wo,[l(o,{t:"Display"})]),e("div",zo,[D(e("input",{class:"form-check-input",type:"checkbox","onUpdate:modelValue":t[4]||(t[4]=r=>c.showJobID=r),id:"jobLogsShowJobIDCheck"},null,512),[[H,c.showJobID]]),e("label",Ho,[l(o,{t:"Job ID"})])]),e("div",qo,[D(e("input",{class:"form-check-input",type:"checkbox","onUpdate:modelValue":t[5]||(t[5]=r=>c.showLogID=r),id:"jobLogsShowLogIDCheck"},null,512),[[H,c.showLogID]]),e("label",Go,[l(o,{t:"Log ID"})])])])]),e("table",Yo,[e("thead",null,[e("tr",null,[e("th",Qo,[l(o,{t:"Date"})]),c.showLogID?(i(),m("th",Zo,[l(o,{t:"Log ID"})])):$("",!0),c.showJobID?(i(),m("th",Xo,[l(o,{t:"Job ID"})])):$("",!0),e("th",el,[l(o,{t:"Status"})]),e("th",tl,[l(o,{t:"Message"})])])]),e("tbody",null,[(i(!0),m(N,null,V(this.showLogs,r=>(i(),m("tr",sl,[e("th",ol,S(r.LogDate),1),c.showLogID?(i(),m("td",ll,[e("samp",nl,S(r.LogID),1)])):$("",!0),c.showJobID?(i(),m("td",al,[e("samp",il,S(r.JobID),1)])):$("",!0),e("td",null,[e("span",{class:I(["badge",[r.Status==="1"?"text-success-emphasis bg-success-subtle":"text-danger-emphasis bg-danger-subtle"]])},S(r.Status==="1"?"Success":"Failed"),3)]),e("td",null,S(r.Message),1)]))),256))])]),e("div",rl,[this.getLogs.length>this.showLogAmount?(i(),m("button",{key:0,onClick:t[6]||(t[6]=r=>this.showLogAmount+=20),class:"btn btn-sm rounded-3 shadow-sm text-primary-emphasis bg-primary-subtle border-1 border-primary-subtle"},t[9]||(t[9]=[e("i",{class:"bi bi-chevron-down me-2"},null,-1),O(" Show More ")]))):$("",!0),this.showLogAmount>20?(i(),m("button",{key:1,onClick:t[7]||(t[7]=r=>this.showLogAmount=20),class:"btn btn-sm rounded-3 shadow-sm text-primary-emphasis bg-primary-subtle border-1 border-primary-subtle"},t[10]||(t[10]=[e("i",{class:"bi bi-chevron-up me-2"},null,-1),O(" Collapse ")]))):$("",!0)])]))])])])])])}const cl=R(Po,[["render",ul]]),ml={class:"card rounded-3 flex-grow-1 bg-danger-subtle border-danger-subtle border shadow"},pl={class:"card-body"},bl={class:"d-flex align-items-center gap-3 inputGroup"},fl=["value"],vl={class:"mb-0"},hl={class:"d-flex mt-3"},gl=["disabled"],_l={__name:"updateConfigurationName",props:{configurationName:String},emits:["close"],setup(s,{emit:t}){const n=s,d=t,c=ae({data:"",valid:!1}),p=q();X(()=>{G(()=>c.data,h=>{c.valid=/^[a-zA-Z0-9_=+.-]{1,15}$/.test(h)&&h.length>0&&!p.Configurations.find(P=>P.Name===h)})});const o=U(),r=w(!1),u=pe(),v=async()=>{c.data&&(r.value=!0,clearInterval(o.Peers.RefreshInterval),await J("/api/renameWireguardConfiguration",{ConfigurationName:n.configurationName,NewConfigurationName:c.data},async h=>{h.status?(await p.getConfigurations(),o.newMessage("Server","Configuration renamed","success"),u.push(`/configuration/${c.data}/peers`)):(o.newMessage("Server",h.message,"danger"),r.value=!1)}))};return(h,P)=>(i(),m("div",ml,[e("div",pl,[e("p",null,[l(f,{t:"To update this configuration's name, WGDashboard will execute the following operations:"})]),e("ol",null,[e("li",null,[l(f,{t:"Duplicate current configuration's database table and .conf file with the new name"})]),e("li",null,[l(f,{t:"Delete current configuration's database table and .conf file"})])]),e("div",bl,[e("input",{class:"form-control form-control-sm rounded-3",value:s.configurationName,disabled:""},null,8,fl),P[3]||(P[3]=e("h3",{class:"mb-0"},[e("i",{class:"bi bi-arrow-right"})],-1)),D(e("input",{class:I(["form-control form-control-sm rounded-3",[c.data?c.valid?"is-valid":"is-invalid":""]]),id:"newConfigurationName","onUpdate:modelValue":P[0]||(P[0]=x=>c.data=x)},null,2),[[M,c.data]])]),e("div",{class:I(["invalid-feedback",{"d-block":!c.valid&&c.data}])},[l(f,{t:"Configuration name is invalid. Possible reasons:"}),e("ul",vl,[e("li",null,[l(f,{t:"Configuration name already exist"})]),e("li",null,[l(f,{t:"Configuration name can only contain 15 lower/uppercase alphabet, numbers, underscore, equal sign, plus sign, period and hyphen."})])])],2),e("div",hl,[e("button",{onClick:P[1]||(P[1]=x=>d("close")),class:"btn btn-sm bg-secondary-subtle border-secondary-subtle text-secondary-emphasis rounded-3"},[l(f,{t:"Cancel"})]),e("button",{onClick:P[2]||(P[2]=x=>v()),disabled:!c.data||r.value,class:"btn btn-sm btn-danger rounded-3 ms-auto"},[l(f,{t:"Save"})],8,gl)])])]))}},yl=R(_l,[["__scopeId","data-v-33ea9576"]]),$l={name:"Dropdown",props:{width:{type:String,default:"80px"},height:{type:String,default:"auto"},title:{type:String,default:""},disabled:{type:Boolean,default:!1},defaultDisplay:{type:Boolean,default:!1}}},wl={class:"title"};function xl(s,t,n,d,c,p){return i(),m("div",{class:I(["dropdown",{disabled:n.disabled}]),onClick:t[0]||(t[0]=(...o)=>s.toggleDropdown&&s.toggleDropdown(...o)),onFocusout:t[1]||(t[1]=(...o)=>s.hideDropdown&&s.hideDropdown(...o)),tabindex:"0"},[e("div",wl,[e("div",null,S(n.title),1)])],34)}const kl=R($l,[["render",xl]]),Sl={components:{Dropdown:kl},name:"CodeEditor",props:{lineNums:{type:Boolean,default:!1},modelValue:{type:String},value:{type:String},theme:{type:String,default:"github-dark"},tabSpaces:{type:Number,default:2},wrap:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!1},header:{type:Boolean,default:!0},width:{type:String,default:"540px"},height:{type:String,default:"auto"},maxWidth:{type:String},minWidth:{type:String},maxHeight:{type:String},minHeight:{type:String},borderRadius:{type:String,default:"12px"},languages:{type:Array,default:function(){return[["javascript","JS"]]}},langListWidth:{type:String,default:"110px"},langListHeight:{type:String,default:"auto"},langListDisplay:{type:Boolean,default:!1},displayLanguage:{type:Boolean,default:!0},zIndex:{type:String,default:"0"},fontSize:{type:String,default:"17px"},padding:{type:String,default:"20px"}},directives:{highlight:{mounted(s,t){s.textContent=t.value},updated(s,t){s.scrolling?s.scrolling=!1:s.textContent=t.value}}},data(){return{scrollBarWidth:0,scrollBarHeight:0,top:0,left:0,languageClass:"hljs language-"+this.languages[0][0],languageTitle:this.languages[0][1]?this.languages[0][1]:this.languages[0][0],content:this.value,cursorPosition:0,insertTab:!1,lineNum:0,lineNumsWidth:0,scrolling:!1,textareaHeight:0,showLineNums:this.wrap?!1:this.lineNums}},computed:{tabWidth(){let s="";for(let t=0;t<this.tabSpaces;t++)s+=" ";return s},contentValue(){return this.modelValue==null?this.content+`
|
||
`:this.modelValue+`
|
||
`},scroll(){return this.height!="auto"}},methods:{updateValue(s){this.modelValue==null?this.content=s.target.value:this.$emit("update:modelValue",s.target.value)},changeLang(s){this.languageTitle=s[1]?s[1]:s[0],this.languageClass="language-"+s[0],this.$emit("lang",s[0])},tab(){if(document.execCommand("insertText"))document.execCommand("insertText",!1,this.tabWidth);else{const s=this.$refs.textarea.selectionStart;this.content=this.content.substring(0,s)+this.tabWidth+this.content.substring(s),this.cursorPosition=s+this.tabWidth.length,this.insertTab=!0}},calcScrollDistance(s){this.$refs.code.scrolling=!0,this.scrolling=!0,this.top=-s.target.scrollTop,this.left=-s.target.scrollLeft},resizer(){new ResizeObserver(n=>{this.scrollBarWidth=n[0].target.offsetWidth-n[0].target.clientWidth,this.scrollBarHeight=n[0].target.offsetHeight-n[0].target.clientHeight,this.textareaHeight=n[0].target.offsetHeight}).observe(this.$refs.textarea);const t=new ResizeObserver(n=>{this.lineNumsWidth=n[0].target.offsetWidth});this.$refs.lineNums&&t.observe(this.$refs.lineNums)},copy(){document.execCommand("copy")?(this.$refs.textarea.select(),document.execCommand("copy"),window.getSelection().removeAllRanges()):navigator.clipboard.writeText(this.$refs.textarea.value)},getLineNum(){const s=this.$refs.textarea.value;let t=0,n=s.indexOf(`
|
||
`);for(;n!==-1;)t++,n=s.indexOf(`
|
||
`,n+1);const d=this.$refs.lineNums.firstChild.offsetHeight,c=parseInt(this.textareaHeight/d)-1;this.lineNum=this.height=="auto"||t>c?t:c}},mounted(){this.$emit("lang",this.languages[0][0]),this.$emit("content",this.content),this.$emit("textarea",this.$refs.textarea),this.resizer()},updated(){this.insertTab&&(this.$refs.textarea.setSelectionRange(this.cursorPosition,this.cursorPosition),this.insertTab=!1),this.lineNums&&(this.scrolling?this.scrolling=!1:this.getLineNum())}},Pl=["theme"],Cl=["readOnly","autofocus","value"];function Il(s,t,n,d,c,p){const o=j("Dropdown"),r=ke("highlight");return i(),m("div",{theme:n.theme,class:I(["code-editor",{"hide-header":!n.header,scroll:p.scroll,"read-only":n.readOnly,wrap:n.wrap}]),style:Q({width:n.width,height:n.height,zIndex:n.zIndex,maxWidth:n.maxWidth,minWidth:n.minWidth,maxHeight:n.maxHeight,minHeight:n.minHeight})},[e("div",{class:"hljs",style:Q({borderRadius:n.borderRadius})},[n.header?(i(),m("div",{key:0,class:I(["header",{border:c.showLineNums}]),style:Q({borderRadius:n.borderRadius+" "+n.borderRadius+" 0 0"})},[n.displayLanguage?(i(),A(o,{key:0,width:n.langListWidth,title:c.languageTitle,disabled:n.languages.length<=1,defaultDisplay:n.langListDisplay},null,8,["width","title","disabled","defaultDisplay"])):$("",!0)],6)):$("",!0),e("div",{class:"code-area",style:Q({borderRadius:n.header?"0 0 "+n.borderRadius+" "+n.borderRadius:n.borderRadius})},[c.showLineNums?(i(),m("div",{key:0,ref:"lineNums",class:"line-nums hljs",style:Q({fontSize:n.fontSize,paddingTop:n.header?"10px":n.padding,paddingBottom:n.padding,top:c.top+"px"})},[t[3]||(t[3]=e("div",null,"1",-1)),(i(!0),m(N,null,V(c.lineNum,u=>(i(),m("div",null,S(u+1),1))),256)),t[4]||(t[4]=e("div",null," ",-1))],4)):$("",!0),e("textarea",{title:"textarea",readOnly:n.readOnly,style:Q({fontSize:n.fontSize,padding:n.header?n.lineNums?"10px "+n.padding+" "+n.padding:"0 "+n.padding+" "+n.padding:n.padding,marginLeft:c.showLineNums?c.lineNumsWidth+"px":"0",width:c.showLineNums?"calc(100% - "+c.lineNumsWidth+"px)":"100%"}),ref:"textarea",autofocus:n.autofocus,spellcheck:"false",onKeydown:t[0]||(t[0]=ge(Se((...u)=>p.tab&&p.tab(...u),["prevent","stop"]),["tab"])),onScroll:t[1]||(t[1]=(...u)=>p.calcScrollDistance&&p.calcScrollDistance(...u)),value:n.modelValue==null?c.content:n.modelValue,onInput:t[2]||(t[2]=(...u)=>p.updateValue&&p.updateValue(...u))},null,44,Cl),e("pre",{style:Q({paddingRight:c.scrollBarWidth+"px",paddingBottom:c.scrollBarHeight+"px",marginLeft:c.showLineNums?c.lineNumsWidth+"px":"0",width:c.showLineNums?"calc(100% - "+c.lineNumsWidth+"px)":"100%"})},[t[6]||(t[6]=O(" ")),D((i(),m("code",{ref:"code",class:I(c.languageClass),style:Q({top:c.top+"px",left:c.left+"px",fontSize:n.fontSize,padding:n.header?n.lineNums?"10px "+n.padding+" "+n.padding:"0 "+n.padding+" "+n.padding:n.padding})},t[5]||(t[5]=[O(`
|
||
`)]),6)),[[r,p.contentValue]]),t[7]||(t[7]=O(`
|
||
`))],4)],4)],4)],14,Pl)}const Al=R(Sl,[["render",Il]]),Dl={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll"},Ll={class:"container d-flex h-100 w-100"},Ol={class:"m-auto modal-dialog-centered dashboardModal",style:{width:"1000px"}},Ml={class:"card rounded-3 shadow flex-grow-1",id:"deleteConfigurationContainer"},Nl={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-0"},Rl={class:"mb-0"},Bl={class:"card-body px-4 d-flex flex-column gap-3"},Tl={key:0,class:"alert alert-danger rounded-3 mb-0"},jl={class:"mb-2"},Jl={class:"bg-body w-100 p-2 rounded-3"},Ul={class:"d-flex gap-2"},Vl=["disabled"],El=["disabled"],Kl={__name:"editRawConfigurationFile",emits:["close"],async setup(s,{emit:t}){let n,d;const c=t,p=Y(),o=w(""),r=w(""),u=w(!1),v=w(""),h=async()=>{await K("/api/getWireguardConfigurationRawFile",{configurationName:p.params.id},g=>{o.value=g.data.content,r.value=g.data.path})};[n,d]=be(()=>h()),await n,d();const P=U(),x=w(!1),C=async()=>{x.value=!0,await J("/api/updateWireguardConfigurationRawFile",{configurationName:p.params.id,rawConfiguration:o.value},g=>{g.status?(u.value=!1,P.newMessage("Server","Configuration saved","success")):(u.value=!0,v.value=g.message),x.value=!1})};return(g,_)=>(i(),m("div",Dl,[e("div",Ll,[e("div",Ol,[e("div",Ml,[e("div",Nl,[e("h5",Rl,[l(f,{t:"Edit Raw Configuration File"})]),e("button",{type:"button",class:"btn-close ms-auto",onClick:_[0]||(_[0]=k=>c("close"))})]),e("div",Bl,[u.value?(i(),m("div",Tl,[e("div",jl,[e("strong",null,[l(f,{t:"Failed to save configuration. Please see the following error message:"})])]),e("div",Jl,[e("pre",null,S(v.value),1)])])):$("",!0),l(Al,{disabled:!0,"read-only":x.value,modelValue:o.value,"onUpdate:modelValue":_[1]||(_[1]=k=>o.value=k),theme:E(P).Configuration.Server.dashboard_theme==="dark"?"github-dark":"github",languages:[["ini",r.value]],width:"100%",height:"600px"},null,8,["read-only","modelValue","theme","languages"]),e("div",Ul,[e("button",{class:"btn bg-secondary-subtle border-secondary-subtle text-secondary-emphasis rounded-3 shadow ms-auto px-3 py-2",disabled:x.value,onClick:_[2]||(_[2]=k=>h())},[_[4]||(_[4]=e("i",{class:"bi bi-arrow-clockwise me-2"},null,-1)),l(f,{t:"Reset"})],8,Vl),e("button",{onClick:_[3]||(_[3]=k=>C()),disabled:x.value,class:"btn bg-danger-subtle border-danger-subtle text-danger-emphasis rounded-3 px-3 py-2 shadow"},[_[5]||(_[5]=e("i",{class:"bi bi-save-fill me-2"},null,-1)),x.value?(i(),A(f,{key:1,t:"Saving..."})):(i(),A(f,{key:0,t:"Save"}))],8,El)])])])])])]))}},Fl={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll"},Wl={class:"container d-flex h-100 w-100"},zl={class:"m-auto modal-dialog-centered dashboardModal",style:{width:"700px"}},Hl={class:"card rounded-3 shadow flex-grow-1 bg-danger-subtle border-danger-subtle",id:"deleteConfigurationContainer"},ql={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-0"},Gl={class:"mb-0"},Yl={class:"card-body px-4 text-muted"},Ql={class:"mb-0"},Zl={key:0},Xl={key:1},en={key:2,class:"d-flex align-items-center gap-2"},tn=["placeholder"],sn=["disabled"],on={__name:"deleteConfiguration",emits:["backup","close"],setup(s,{emit:t}){const d=Y().params.id,c=w(""),p=pe(),o=U(),r=w(!1),u=()=>{clearInterval(o.Peers.RefreshInterval),r.value=!0,J("/api/deleteWireguardConfiguration",{ConfigurationName:d},C=>{C.status?(p.push("/"),o.newMessage("Server","Configuration deleted","success")):r.value=!1})},v=w(!0),h=w([]),P=()=>{v.value=!0,K("/api/getWireguardConfigurationBackup",{configurationName:d},C=>{h.value=C.data,v.value=!1})};X(()=>{P()});const x=t;return(C,g)=>(i(),m("div",Fl,[e("div",Wl,[e("div",zl,[e("div",Hl,[e("div",ql,[e("h5",Gl,[l(f,{t:"Are you sure to delete this configuration?"})]),e("button",{type:"button",class:"btn-close ms-auto",onClick:g[0]||(g[0]=_=>x("close"))})]),e("div",Yl,[e("p",Ql,[l(f,{t:"Once you deleted this configuration:"})]),e("ul",null,[e("li",null,[l(f,{t:"All connected peers will get disconnected"})]),e("li",null,[l(f,{t:"Both configuration file (.conf) and database table related to this configuration will get deleted"})])]),e("div",{class:I(["alert",[v.value?"alert-secondary":h.value.length>0?"alert-success":"alert-danger"]])},[v.value?(i(),m("div",Zl,[g[5]||(g[5]=e("i",{class:"bi bi-search me-2"},null,-1)),l(f,{t:"Checking backups..."})])):h.value.length>0?(i(),m("div",Xl,[g[6]||(g[6]=e("i",{class:"bi bi-check-circle-fill me-2"},null,-1)),l(f,{t:"This configuration have "+h.value.length+" backups"},null,8,["t"])])):(i(),m("div",en,[g[9]||(g[9]=e("i",{class:"bi bi-x-circle-fill me-2"},null,-1)),l(f,{t:"This configuration have no backup"}),e("a",{role:"button",onClick:g[1]||(g[1]=_=>x("backup")),class:"ms-auto btn btn-sm btn-primary rounded-3"},[g[7]||(g[7]=e("i",{class:"bi bi-clock-history me-2"},null,-1)),l(f,{t:"Backup"})]),e("a",{role:"button",onClick:g[2]||(g[2]=_=>P()),class:"btn btn-sm btn-primary rounded-3"},g[8]||(g[8]=[e("i",{class:"bi bi-arrow-clockwise"},null,-1)]))]))],2),g[11]||(g[11]=e("hr",null,null,-1)),e("p",null,[l(f,{t:"If you're sure, please type in the configuration name below and click Delete"})]),D(e("input",{class:"form-control rounded-3 mb-3",placeholder:E(d),"onUpdate:modelValue":g[3]||(g[3]=_=>c.value=_),type:"text"},null,8,tn),[[M,c.value]]),e("button",{class:"btn btn-danger w-100",onClick:g[4]||(g[4]=_=>u()),disabled:c.value!==E(d)||r.value},[g[10]||(g[10]=e("i",{class:"bi bi-trash-fill me-2 rounded-3"},null,-1)),r.value?(i(),A(f,{key:1,t:"Deleting..."})):(i(),A(f,{key:0,t:"Delete"}))],8,sn)])])])])]))}},ln={class:"card my-0 rounded-3"},nn={class:"card-body position-relative"},an={key:0,class:"position-absolute w-100 h-100 confirmationContainer start-0 top-0 rounded-3 d-flex p-2"},rn={class:"m-auto"},dn={class:"d-flex gap-2 align-items-center justify-content-center"},un=["disabled"],cn=["disabled"],mn={key:0,class:"position-absolute w-100 h-100 confirmationContainer start-0 top-0 rounded-3 d-flex p-2"},pn={class:"m-auto"},bn={class:"d-flex gap-2 align-items-center justify-content-center"},fn=["disabled"],vn=["disabled"],hn={class:"d-flex gap-3"},gn={class:"d-flex flex-column"},_n={class:"text-muted"},yn={class:"d-flex flex-column"},$n={class:"text-muted"},wn={class:"d-flex gap-2 align-items-center ms-auto"},xn={class:"card rounded-3"},kn={key:0,class:"card-body"},Sn=["value"],Pn={class:"d-flex"},Cn={__name:"backup",props:["b","delay"],emits:["refresh","refreshPeersList"],setup(s,{emit:t}){Pe(g=>({b32c1fd8:x.value}));const n=s,d=w(!1),c=w(!1),p=Y(),o=t,r=U(),u=w(!1),v=()=>{u.value=!0,J("/api/deleteWireguardConfigurationBackup",{ConfigurationName:p.params.id,BackupFileName:n.b.filename},g=>{u.value=!1,g.status?(o("refresh"),r.newMessage("Server","Backup deleted","success")):r.newMessage("Server","Backup failed to delete","danger")})},h=()=>{u.value=!0,J("/api/restoreWireguardConfigurationBackup",{ConfigurationName:p.params.id,BackupFileName:n.b.filename},g=>{u.value=!1,c.value=!1,g.status?(o("refreshPeersList"),r.newMessage("Server","Backup restored with "+n.b.filename,"success")):r.newMessage("Server","Backup failed to restore","danger")})},P=()=>{K("/api/downloadWireguardConfigurationBackup",{configurationName:p.params.id,backupFileName:n.b.filename},g=>{g.status&&window.open(`/fileDownload?file=${g.data}`,"_blank")})},x=W(()=>n.delay+"s"),C=w(!1);return(g,_)=>(i(),m("div",ln,[e("div",nn,[l(oe,{name:"zoomReversed"},{default:z(()=>[d.value?(i(),m("div",an,[e("div",rn,[e("h5",null,[l(f,{t:"Are you sure to delete this backup?"})]),e("div",dn,[e("button",{class:"btn btn-danger rounded-3",disabled:u.value,onClick:_[0]||(_[0]=k=>v())},[l(f,{t:"Yes"})],8,un),e("button",{onClick:_[1]||(_[1]=k=>d.value=!1),disabled:u.value,class:"btn bg-secondary-subtle text-secondary-emphasis border-secondary-subtle rounded-3"},[l(f,{t:"No"})],8,cn)])])])):$("",!0)]),_:1}),l(oe,{name:"zoomReversed"},{default:z(()=>[c.value?(i(),m("div",mn,[e("div",pn,[e("h5",null,[l(f,{t:"Are you sure to restore this backup?"})]),e("div",bn,[e("button",{disabled:u.value,onClick:_[2]||(_[2]=k=>h()),class:"btn btn-success rounded-3"},[l(f,{t:"Yes"})],8,fn),e("button",{onClick:_[3]||(_[3]=k=>c.value=!1),disabled:u.value,class:"btn bg-secondary-subtle text-secondary-emphasis border-secondary-subtle rounded-3"},[l(f,{t:"No"})],8,vn)])])])):$("",!0)]),_:1}),e("div",hn,[e("div",gn,[e("small",_n,[l(f,{t:"Backup"})]),e("samp",null,S(s.b.filename),1)]),e("div",yn,[e("small",$n,[l(f,{t:"Backup Date"})]),O(" "+S(E(ie)(s.b.backupDate,"YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss")),1)]),e("div",wn,[e("button",{onClick:_[4]||(_[4]=k=>P()),class:"btn bg-primary-subtle text-primary-emphasis border-primary-subtle rounded-3 btn-sm"},_[8]||(_[8]=[e("i",{class:"bi bi-download"},null,-1)])),e("button",{onClick:_[5]||(_[5]=k=>c.value=!0),class:"btn bg-warning-subtle text-warning-emphasis border-warning-subtle rounded-3 btn-sm"},_[9]||(_[9]=[e("i",{class:"bi bi-clock-history"},null,-1)])),e("button",{onClick:_[6]||(_[6]=k=>d.value=!0),class:"btn bg-danger-subtle text-danger-emphasis border-danger-subtle rounded-3 btn-sm"},_[10]||(_[10]=[e("i",{class:"bi bi-trash-fill"},null,-1)]))])]),_[14]||(_[14]=e("hr",null,null,-1)),e("div",xn,[e("a",{role:"button",class:I(["card-header d-flex text-decoration-none align-items-center",{"border-bottom-0":!C.value}]),style:{cursor:"pointer"},onClick:_[7]||(_[7]=k=>C.value=!C.value)},[e("small",null,[_[11]||(_[11]=O(".conf ")),l(f,{t:"File"})]),_[12]||(_[12]=e("i",{class:"bi bi-chevron-down ms-auto"},null,-1))],2),C.value?(i(),m("div",kn,[e("textarea",{class:"form-control rounded-3",value:s.b.content,disabled:"",style:{height:"300px","font-family":"var(--bs-font-monospace),sans-serif !important"}},null,8,Sn)])):$("",!0)]),_[15]||(_[15]=e("hr",null,null,-1)),e("div",Pn,[e("span",null,[_[13]||(_[13]=e("i",{class:"bi bi-database me-1"},null,-1)),l(f,{t:"Database File"})]),e("i",{class:I(["bi ms-auto",[s.b.database?"text-success bi-check-circle-fill":"text-danger bi-x-circle-fill"]])},null,2)])])]))}},In=R(Cn,[["__scopeId","data-v-9f0c0156"]]),An={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll",ref:"editConfigurationContainer"},Dn={class:"d-flex h-100 w-100"},Ln={class:"modal-dialog-centered dashboardModal w-100 h-100 overflow-x-scroll flex-column gap-3 mx-3"},On={class:"my-5 d-flex gap-3 flex-column position-relative"},Mn={class:"title"},Nn={class:"d-flex mb-3"},Rn={class:"mb-0"},Bn={class:"position-relative d-flex flex-column gap-3"},Tn={class:"text-center title",key:"spinner"},jn={class:"card my-0 rounded-3",key:"noBackups"},Jn={class:"card-body text-center text-muted"},Un={__name:"configurationBackupRestore",emits:["close","refreshPeersList"],setup(s,{emit:t}){const n=Y(),d=w([]),c=w(!0),p=t;X(()=>{o()});const o=()=>{c.value=!0,K("/api/getWireguardConfigurationBackup",{configurationName:n.params.id},u=>{d.value=u.data,c.value=!1})},r=()=>{K("/api/createWireguardConfigurationBackup",{configurationName:n.params.id},u=>{d.value=u.data,c.value=!1})};return(u,v)=>(i(),m("div",An,[e("div",Dn,[e("div",Ln,[e("div",On,[e("div",Mn,[e("div",Nn,[e("h4",Rn,[l(f,{t:"Backup & Restore"})]),e("button",{type:"button",class:"btn-close ms-auto",onClick:v[0]||(v[0]=h=>u.$emit("close"))})]),e("button",{onClick:v[1]||(v[1]=h=>r()),class:"btn bg-primary-subtle text-primary-emphasis border-primary-subtle rounded-3 w-100"},[v[4]||(v[4]=e("i",{class:"bi bi-plus-circle-fill me-2"},null,-1)),l(f,{t:"Create Backup"})])]),e("div",Bn,[l(le,{name:"list1"},{default:z(()=>[c.value&&d.value.length===0?(i(),m("div",Tn,v[5]||(v[5]=[e("div",{class:"spinner-border"},null,-1)]))):!c.value&&d.value.length===0?(i(),m("div",jn,[e("div",Jn,[v[6]||(v[6]=e("i",{class:"bi bi-x-circle-fill me-2"},null,-1)),l(f,{t:"No backup yet, click the button above to create backup."})])])):$("",!0),(i(!0),m(N,null,V(d.value,h=>(i(),A(In,{onRefresh:v[2]||(v[2]=P=>o()),onRefreshPeersList:v[3]||(v[3]=P=>p("refreshPeersList")),b:h,key:h.filename},null,8,["b"]))),128))]),_:1})])])])])],512))}},Vn=R(Un,[["__scopeId","data-v-1f718118"]]),En={id:"editPeerSettingsOverride"},Kn={class:"mb-0"},Fn={class:"mb-3 text-muted"},Wn={class:"d-flex gap-2 flex-column"},zn={for:"override_DNS",class:"form-label"},Hn={class:"text-muted"},qn=["disabled"],Gn={class:"invalid-feedback"},Yn={for:"override_EndpointAllowedIPs",class:"form-label"},Qn={class:"text-muted"},Zn=["disabled"],Xn={class:"invalid-feedback"},ea={for:"override_ListenPort",class:"form-label"},ta={class:"text-muted"},sa=["disabled"],oa={class:"invalid-feedback"},la={for:"override_MTU",class:"form-label"},na={class:"text-muted"},aa=["disabled"],ia={class:"invalid-feedback"},ra={for:"override_PeerRemoteEndpoint",class:"form-label"},da={class:"text-muted"},ua=["disabled"],ca={for:"override_persistent_keepalive",class:"form-label"},ma={class:"text-muted"},pa=["disabled"],ba={class:"invalid-feedback"},fa={class:"d-flex mt-1 gap-2"},va=he({__name:"editPeerSettingsOverride",props:["configuration"],setup(s){const t=s,n=w(!1),d=w({...t.configuration.Info.OverridePeerSettings}),c=w(!1),p=w("");X(()=>{document.querySelectorAll("#editPeerSettingsOverride input").forEach(u=>u.addEventListener("change",()=>{c.value=!0}))});const o=()=>{d.value=t.configuration.Info.OverridePeerSettings,c.value=!1},r=async()=>{document.querySelectorAll("#editPeerSettingsOverride input").forEach(u=>u.classList.remove("is-invalid","is-valid")),await J("/api/updateWireguardConfigurationInfo",{Name:t.configuration.Name,Key:"OverridePeerSettings",Value:d.value},u=>{u.status?(c.value=!1,t.configuration.Info.OverridePeerSettings=d.value,document.querySelectorAll("#editPeerSettingsOverride input").forEach(v=>v.classList.add("is-valid"))):(p.value=u.message,document.querySelector(`#override_${u.data}`).classList.add("is-invalid"))})};return(u,v)=>(i(),m("div",En,[e("h5",Kn,[l(f,{t:"Override Peer Settings"})]),e("h6",Fn,[e("small",null,[l(f,{t:"Only apply to peers in this configuration"})])]),e("div",Wn,[e("div",null,[e("label",zn,[e("small",Hn,[l(f,{t:"DNS"})])]),D(e("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:n.value,"onUpdate:modelValue":v[0]||(v[0]=h=>d.value.DNS=h),id:"override_DNS"},null,8,qn),[[M,d.value.DNS]]),e("div",Gn,S(p.value),1)]),e("div",null,[e("label",Yn,[e("small",Qn,[l(f,{t:"Endpoint Allowed IPs"})])]),D(e("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:n.value,"onUpdate:modelValue":v[1]||(v[1]=h=>d.value.EndpointAllowedIPs=h),id:"override_EndpointAllowedIPs"},null,8,Zn),[[M,d.value.EndpointAllowedIPs]]),e("div",Xn,S(p.value),1)]),e("div",null,[e("label",ea,[e("small",ta,[l(f,{t:"Listen Port"})])]),D(e("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:n.value,"onUpdate:modelValue":v[2]||(v[2]=h=>d.value.ListenPort=h),id:"override_ListenPort"},null,8,sa),[[M,d.value.ListenPort]]),e("div",oa,S(p.value),1)]),e("div",null,[e("label",la,[e("small",na,[l(f,{t:"MTU"})])]),D(e("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:n.value,"onUpdate:modelValue":v[3]||(v[3]=h=>d.value.MTU=h),id:"override_MTU"},null,8,aa),[[M,d.value.MTU]]),e("div",ia,S(p.value),1)]),e("div",null,[e("label",ra,[e("small",da,[l(f,{t:"Peer Remote Endpoint"})])]),D(e("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:n.value,"onUpdate:modelValue":v[4]||(v[4]=h=>d.value.PeerRemoteEndpoint=h),id:"override_PeerRemoteEndpoint"},null,8,ua),[[M,d.value.PeerRemoteEndpoint]])]),e("div",null,[e("label",ca,[e("small",ma,[l(f,{t:"Persistent Keepalive"})])]),D(e("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:n.value,"onUpdate:modelValue":v[5]||(v[5]=h=>d.value.PersistentKeepalive=h),id:"override_PersistentKeepalive"},null,8,pa),[[M,d.value.PersistentKeepalive]]),e("div",ba,S(p.value),1)]),e("div",fa,[e("button",{class:I([{disabled:!c.value},"btn btn-sm bg-secondary-subtle border-secondary-subtle text-secondary-emphasis rounded-3 shadow ms-auto"]),onClick:v[6]||(v[6]=h=>o())},[v[8]||(v[8]=e("i",{class:"bi bi-arrow-clockwise me-2"},null,-1)),l(f,{t:"Reset"})],2),e("button",{class:I([{disabled:!c.value},"btn btn-sm bg-primary-subtle border-primary-subtle text-primary-emphasis rounded-3 shadow"]),onClick:v[7]||(v[7]=h=>r())},[v[9]||(v[9]=e("i",{class:"bi bi-save-fill me-2"},null,-1)),l(f,{t:"Save"})],2)])])]))}}),ha={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0",ref:"editConfigurationContainer"},ga={class:"w-100 h-100 overflow-y-scroll"},_a={class:"container d-flex h-100 w-100"},ya={class:"m-auto modal-dialog-centered dashboardModal",style:{width:"700px"}},$a={class:"card rounded-3 shadow flex-grow-1"},wa={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4"},xa={class:"mb-0"},ka={class:"card-body px-4 pb-4"},Sa={class:"d-flex gap-2 flex-column"},Pa={key:0,class:"d-flex align-items-center gap-3"},Ca={class:"text-muted"},Ia={class:"d-flex align-items-center gap-3"},Aa={class:"text-muted",style:{"word-break":"keep-all"}},Da={class:"ms-auto",style:{"word-break":"break-all"}},La={class:"d-flex"},Oa={for:"configuration_private_key",class:"form-label"},Ma={class:"text-muted d-block"},Na={class:"form-check form-switch ms-auto"},Ra=["disabled"],Ba={for:"configuration_ipaddress_cidr",class:"form-label"},Ta={class:"text-muted"},ja=["disabled"],Ja={for:"configuration_listen_port",class:"form-label"},Ua={class:"text-muted"},Va=["disabled"],Ea={class:"accordion mt-2",id:"editConfigurationOptionalAccordion"},Ka={class:"accordion-item"},Fa={class:"accordion-header"},Wa={class:"accordion-button collapsed px-3 py-2",type:"button","data-bs-toggle":"collapse","data-bs-target":"#editOptionalAccordionCollapse"},za={class:"text-muted"},Ha={id:"editOptionalAccordionCollapse",class:"accordion-collapse collapse","data-bs-parent":"#editConfigurationOptionalAccordion"},qa={class:"accordion-body d-flex flex-column gap-3"},Ga=["for"],Ya={class:"text-muted"},Qa=["disabled","onUpdate:modelValue","id"],Za=["for"],Xa={class:"text-muted"},ei=["disabled","onUpdate:modelValue","id"],ti={class:"d-flex align-items-center gap-2 mt-1"},si=["disabled"],oi=["disabled"],li={class:"mb-3"},ni={class:"d-flex gap-2 flex-column"},ai={__name:"editConfiguration",props:{configurationInfo:Object},emits:["changed","close","refresh"],setup(s,{emit:t}){const n=s,d=q(),c=U(),p=w(!1),o=ae(JSON.parse(JSON.stringify(n.configurationInfo))),r=w(!1),u=w(!1),v=ae({PrivateKey:!0,IPAddress:!0,ListenPort:!0}),h=()=>{d.checkWGKeyLength(o.PrivateKey)?(v.PrivateKey=!0,o.PublicKey=window.wireguard.generatePublicKey(o.PrivateKey)):v.PrivateKey=!1},P=()=>{u.value=!1,Object.assign(o,JSON.parse(JSON.stringify(n.configurationInfo)))},x=t,C=()=>{p.value=!0,J("/api/updateWireguardConfiguration",o,B=>{p.value=!1,B.status?(c.newMessage("Server","Configuration saved","success"),u.value=!1,x("dataChanged",B.data)):c.newMessage("Server",B.message,"danger")})},g=w(!1);G(o,()=>{u.value=JSON.stringify(o)!==JSON.stringify(n.configurationInfo)},{deep:!0});const _=w(!1),k=w(!1),L=w(!1);return(B,b)=>(i(),m("div",ha,[e("div",ga,[l(le,{name:"zoom"},{default:z(()=>[_.value?(i(),A(Kl,{key:0,name:"EditRawConfigurationFile",onClose:b[0]||(b[0]=a=>_.value=!1)})):$("",!0),L.value?(i(),A(on,{key:"DeleteConfiguration",onBackup:b[1]||(b[1]=a=>k.value=!0),onClose:b[2]||(b[2]=a=>L.value=!1)})):$("",!0),k.value?(i(),A(Vn,{key:2,onClose:b[3]||(b[3]=a=>k.value=!1),onRefreshPeersList:b[4]||(b[4]=a=>x("refresh"))})):$("",!0)]),_:1}),e("div",_a,[e("div",ya,[e("div",$a,[e("div",wa,[e("h4",xa,[l(f,{t:"Configuration Settings"})]),e("button",{type:"button",class:"btn-close ms-auto",onClick:b[5]||(b[5]=a=>B.$emit("close"))})]),e("div",ka,[e("div",Sa,[g.value?$("",!0):(i(),m("div",Pa,[e("small",Ca,[l(f,{t:"Name"})]),e("small",null,S(o.Name),1),e("button",{onClick:b[6]||(b[6]=a=>g.value=!0),class:"btn btn-sm bg-danger-subtle border-danger-subtle text-danger-emphasis rounded-3 ms-auto"},[l(f,{t:"Update Name"})])])),g.value?(i(),A(yl,{key:1,onClose:b[7]||(b[7]=a=>g.value=!1),"configuration-name":o.Name},null,8,["configuration-name"])):(i(),m(N,{key:2},[b[24]||(b[24]=e("hr",null,null,-1)),e("div",Ia,[e("small",Aa,[l(f,{t:"Public Key"})]),e("small",Da,S(o.PublicKey),1)]),b[25]||(b[25]=e("hr",null,null,-1)),e("div",null,[e("div",La,[e("label",Oa,[e("small",Ma,[l(f,{t:"Private Key"})])]),e("div",Na,[D(e("input",{class:"form-check-input",type:"checkbox",role:"switch",id:"editPrivateKeySwitch","onUpdate:modelValue":b[8]||(b[8]=a=>r.value=a)},null,512),[[H,r.value]]),b[18]||(b[18]=e("label",{class:"form-check-label",for:"editPrivateKeySwitch"},[e("small",null,"Edit")],-1))])]),D(e("input",{type:"text",class:I(["form-control form-control-sm rounded-3",{"is-invalid":!v.PrivateKey}]),disabled:p.value||!r.value,onKeyup:b[9]||(b[9]=a=>h()),"onUpdate:modelValue":b[10]||(b[10]=a=>o.PrivateKey=a),id:"configuration_private_key"},null,42,Ra),[[M,o.PrivateKey]])]),e("div",null,[e("label",Ba,[e("small",Ta,[l(f,{t:"IP Address/CIDR"})])]),D(e("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:p.value,"onUpdate:modelValue":b[11]||(b[11]=a=>o.Address=a),id:"configuration_ipaddress_cidr"},null,8,ja),[[M,o.Address]])]),e("div",null,[e("label",Ja,[e("small",Ua,[l(f,{t:"Listen Port"})])]),D(e("input",{type:"number",class:"form-control form-control-sm rounded-3",disabled:p.value,"onUpdate:modelValue":b[12]||(b[12]=a=>o.ListenPort=a),id:"configuration_listen_port"},null,8,Va),[[M,o.ListenPort]])]),e("div",Ea,[e("div",Ka,[e("h2",Fa,[e("button",Wa,[e("small",za,[l(f,{t:"Optional Settings"})])])]),e("div",Ha,[e("div",qa,[(i(),m(N,null,V(["Table","PreUp","PreDown","PostUp","PostDown"],a=>e("div",null,[e("label",{for:"configuration_"+a,class:"form-label"},[e("small",Ya,[l(f,{t:a},null,8,["t"])])],8,Ga),D(e("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:p.value,"onUpdate:modelValue":y=>o[a]=y,id:"configuration_"+a},null,8,Qa),[[M,o[a]]])])),64)),s.configurationInfo.Protocol==="awg"?(i(),m(N,{key:0},V(["Jc","Jmin","Jmax","S1","S2","H1","H2","H3","H4"],a=>e("div",null,[e("label",{for:"configuration_"+a,class:"form-label"},[e("small",Xa,[l(f,{t:a},null,8,["t"])])],8,Za),D(e("input",{type:"number",class:"form-control form-control-sm rounded-3",disabled:p.value,"onUpdate:modelValue":y=>o[a]=y,id:"configuration_"+a},null,8,ei),[[M,o[a]]])])),64)):$("",!0)])])])]),e("div",ti,[e("button",{class:"btn btn-sm bg-secondary-subtle border-secondary-subtle text-secondary-emphasis rounded-3 shadow ms-auto",onClick:b[13]||(b[13]=a=>P()),disabled:!u.value||p.value},[b[19]||(b[19]=e("i",{class:"bi bi-arrow-clockwise me-2"},null,-1)),l(f,{t:"Reset"})],8,si),e("button",{class:"btn btn-sm bg-primary-subtle border-primary-subtle text-primary-emphasis rounded-3 shadow",disabled:!u.value||p.value,onClick:b[14]||(b[14]=a=>C())},[b[20]||(b[20]=e("i",{class:"bi bi-save-fill me-2"},null,-1)),l(f,{t:"Save"})],8,oi)]),b[26]||(b[26]=e("hr",null,null,-1)),l(va,{configuration:s.configurationInfo},null,8,["configuration"]),b[27]||(b[27]=e("hr",null,null,-1)),e("h5",li,[l(f,{t:"Danger Zone"})]),e("div",ni,[e("button",{onClick:b[15]||(b[15]=a=>k.value=!0),class:"btn bg-warning-subtle border-warning-subtle text-warning-emphasis rounded-3 text-start d-flex"},[b[21]||(b[21]=e("i",{class:"bi bi-copy me-auto"},null,-1)),l(f,{t:"Backup & Restore"})]),e("button",{onClick:b[16]||(b[16]=a=>_.value=!0),class:"btn bg-warning-subtle border-warning-subtle text-warning-emphasis rounded-3 d-flex"},[b[22]||(b[22]=e("i",{class:"bi bi-pen me-auto"},null,-1)),l(f,{t:"Edit Raw Configuration File"})]),e("button",{onClick:b[17]||(b[17]=a=>L.value=!0),class:"btn bg-danger-subtle border-danger-subtle text-danger-emphasis rounded-3 d-flex mt-4"},[b[23]||(b[23]=e("i",{class:"bi bi-trash-fill me-auto"},null,-1)),l(f,{t:"Delete Configuration"})])])],64))])])])])])])],512))}},ii={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll",ref:"selectPeersContainer"},ri={class:"container d-flex h-100 w-100"},di={class:"m-auto modal-dialog-centered dashboardModal",style:{width:"700px"}},ui={class:"card rounded-3 shadow flex-grow-1"},ci={class:"card-header bg-transparent d-flex align-items-center gap-2 p-4 flex-column pb-3"},mi={class:"mb-2 w-100 d-flex"},pi={class:"mb-0"},bi={class:"d-flex w-100 align-items-center gap-2"},fi={class:"d-flex gap-3"},vi={class:"card-body px-4 flex-grow-1 d-flex gap-2 flex-column position-relative",ref:"card-body",style:{"overflow-y":"scroll"}},hi=["onClick","disabled","data-id"],gi={key:0},_i={class:"d-flex flex-column"},yi={class:"fw-bold"},$i={class:"text-muted"},wi={key:1,class:"ms-auto"},xi={key:0,class:"spinner-border spinner-border-sm",role:"status"},ki={class:"card-footer px-4 py-3 gap-2 d-flex align-items-center"},Si=["disabled"],Pi={key:0,class:"flex-grow-1 text-center"},Ci=["disabled"],Ii={key:0,class:"flex-grow-1 text-center"},Ai=["disabled"],Di={key:0,class:"flex-grow-1 text-center"},Li=["disabled"],Oi={__name:"selectPeers",props:{configurationPeers:Array},emits:["refresh","close"],setup(s,{emit:t}){const n=s,d=w(!1),c=w(!1),p=w([]),o=w(""),r=b=>{p.value.find(a=>a===b)?p.value=p.value.filter(a=>a!==b):p.value.push(b)},u=W(()=>d.value||c.value?n.configurationPeers.filter(b=>p.value.find(a=>a===b.id)):o.value.length>0?n.configurationPeers.filter(b=>b.id.includes(o.value)||b.name.includes(o.value)):n.configurationPeers);G(p,()=>{p.value.length===0&&(d.value=!1,c.value=!1)});const v=Y(),h=U(),P=t,x=w(!1),C=()=>{x.value=!0,J(`/api/deletePeers/${v.params.id}`,{peers:p.value},b=>{h.newMessage("Server",b.message,b.status?"success":"danger"),b.status&&(p.value=[],d.value=!1),P("refresh"),x.value=!1})},g=ae({success:[],failed:[]}),_=ce("card-body"),k=ce("sp"),L=async()=>{c.value=!0;for(const b of p.value)_.value.scrollTo({top:k.value.find(a=>a.dataset.id===b).offsetTop-20,behavior:"smooth"}),await K("/api/downloadPeer/"+v.params.id,{id:b},a=>{if(a.status){const y=new Blob([a.data.file],{type:"text/plain"}),T=URL.createObjectURL(y),$e=`${a.data.fileName}.conf`,re=document.createElement("a");re.href=T,re.download=$e,re.click(),g.success.push(b)}else g.failed.push(b)})},B=()=>{g.success=[],g.failed=[],c.value=!1};return(b,a)=>(i(),m("div",ii,[e("div",ri,[e("div",di,[e("div",ui,[e("div",ci,[e("div",mi,[e("h4",pi,[l(f,{t:"Select Peers"})]),e("button",{type:"button",class:"btn-close ms-auto",onClick:a[0]||(a[0]=y=>P("close"))})]),e("div",bi,[e("div",fi,[!c.value&&p.value.length!==s.configurationPeers.map(y=>y.id).length?(i(),m("a",{key:0,role:"button",onClick:a[1]||(a[1]=y=>p.value=s.configurationPeers.map(T=>T.id)),class:"text-decoration-none text-body"},[e("small",null,[a[9]||(a[9]=e("i",{class:"bi bi-check-all me-2"},null,-1)),l(f,{t:"Select All"})])])):$("",!0),p.value.length>0&&!c.value?(i(),m("a",{key:1,role:"button",class:"text-decoration-none text-body",onClick:a[2]||(a[2]=y=>p.value=[])},[e("small",null,[a[10]||(a[10]=e("i",{class:"bi bi-x-circle-fill me-2"},null,-1)),l(f,{t:"Clear Selection"})])])):$("",!0)]),a[11]||(a[11]=e("label",{class:"ms-auto",for:"selectPeersSearchInput"},[e("i",{class:"bi bi-search"})],-1)),D(e("input",{class:"form-control form-control-sm rounded-3","onUpdate:modelValue":a[3]||(a[3]=y=>o.value=y),id:"selectPeersSearchInput",style:{width:"200px !important"},type:"text"},null,512),[[M,o.value]])])]),e("div",vi,[(i(!0),m(N,null,V(u.value,y=>(i(),m("button",{type:"button",class:I(["btn w-100 peerBtn text-start rounded-3 d-flex align-items-center gap-3",{active:p.value.find(T=>T===y.id)}]),onClick:T=>r(y.id),key:y.id,disabled:d.value||c.value,ref_for:!0,ref:"sp","data-id":y.id},[c.value?$("",!0):(i(),m("span",gi,[e("i",{class:I(["bi",[p.value.find(T=>T===y.id)?"bi-check-circle-fill":"bi-circle"]])},null,2)])),e("span",_i,[e("small",yi,S(y.name?y.name:"Untitled Peer"),1),e("small",$i,[e("samp",null,S(y.id),1)])]),c.value?(i(),m("span",wi,[!g.success.find(T=>T===y.id)&&!g.failed.find(T=>T===y.id)?(i(),m("span",xi)):(i(),m("i",{key:1,class:I(["bi",[g.failed.find(T=>T===y.id)?"bi-x-circle-fill":"bi-check-circle-fill"]])},null,2))])):$("",!0)],10,hi))),128))],512),e("div",ki,[!d.value&&!c.value?(i(),m(N,{key:0},[e("button",{class:"btn bg-primary-subtle text-primary-emphasis border-primary-subtle rounded-3",disabled:p.value.length===0||x.value,onClick:a[4]||(a[4]=y=>L())},a[12]||(a[12]=[e("i",{class:"bi bi-download"},null,-1)]),8,Si),p.value.length>0?(i(),m("span",Pi,[a[13]||(a[13]=e("i",{class:"bi bi-check-circle-fill me-2"},null,-1)),l(f,{t:p.value.length+" Peer"+(p.value.length>1?"s":"")},null,8,["t"])])):$("",!0),e("button",{class:"btn bg-danger-subtle text-danger-emphasis border-danger-subtle ms-auto rounded-3",onClick:a[5]||(a[5]=y=>d.value=!0),disabled:p.value.length===0||x.value},a[14]||(a[14]=[e("i",{class:"bi bi-trash"},null,-1)]),8,Ci)],64)):c.value?(i(),m(N,{key:1},[g.failed.length+g.success.length<p.value.length?(i(),m("strong",Ii,[l(f,{t:"Downloading"}),a[15]||(a[15]=O()),l(f,{t:p.value.length+" Peer"+(p.value.length>1?"s":"")},null,8,["t"]),a[16]||(a[16]=O("... "))])):(i(),m(N,{key:1},[e("strong",null,[l(f,{t:"Download Finished"})]),e("button",{onClick:a[6]||(a[6]=y=>B()),class:"btn bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle rounded-3 ms-auto"},[l(f,{t:"Done"})])],64))],64)):d.value?(i(),m(N,{key:2},[e("button",{class:"btn btn-danger rounded-3",disabled:p.value.length===0||x.value,onClick:a[7]||(a[7]=y=>C())},[l(f,{t:"Yes"})],8,Ai),p.value.length>0?(i(),m("strong",Di,[l(f,{t:"Are you sure to delete"}),a[17]||(a[17]=O()),l(f,{t:p.value.length+" Peer"+(p.value.length>1?"s":"")},null,8,["t"]),a[18]||(a[18]=O("? "))])):$("",!0),e("button",{class:"btn bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle ms-auto rounded-3",disabled:p.value.length===0||x.value,onClick:a[8]||(a[8]=y=>d.value=!1)},[l(f,{t:"No"})],8,Li)],64)):$("",!0)])])])])],512))}},Mi=R(Oi,[["__scopeId","data-v-177407c1"]]),Ni={name:"endpointAllowedIps",components:{LocaleText:f},props:{data:Object,saving:Boolean},setup(){const s=q(),t=U();return{store:s,dashboardStore:t}},data(){return{endpointAllowedIps:JSON.parse(JSON.stringify(this.data.endpoint_allowed_ip)),error:!1}},methods:{checkAllowedIP(){let s=this.endpointAllowedIps.split(",").map(t=>t.replaceAll(" ",""));for(let t in s)if(!this.store.checkCIDR(s[t])){this.error||this.dashboardStore.newMessage("WGDashboard","Endpoint Allowed IPs format is incorrect","danger"),this.data.endpoint_allowed_ip="",this.error=!0;return}this.error=!1,this.data.endpoint_allowed_ip=this.endpointAllowedIps}},watch:{endpointAllowedIps(){this.checkAllowedIP()}}},Ri={for:"peer_endpoint_allowed_ips",class:"form-label"},Bi={class:"text-muted"},Ti=["disabled"];function ji(s,t,n,d,c,p){const o=j("LocaleText");return i(),m("div",null,[e("label",Ri,[e("small",Bi,[l(o,{t:"Endpoint Allowed IPs"}),t[2]||(t[2]=O()),e("code",null,[l(o,{t:"(Required)"})])])]),D(e("input",{type:"text",class:I(["form-control form-control-sm rounded-3",{"is-invalid":c.error}]),disabled:this.saving,"onUpdate:modelValue":t[0]||(t[0]=r=>this.endpointAllowedIps=r),onBlur:t[1]||(t[1]=r=>this.checkAllowedIP()),id:"peer_endpoint_allowed_ips"},null,42,Ti),[[M,this.endpointAllowedIps]])])}const Ji=R(Ni,[["render",ji]]),Ui={name:"allowedIPsInput",components:{LocaleText:f},props:{data:Object,saving:Boolean,bulk:Boolean,availableIp:void 0},data(){return{allowedIp:[],availableIpSearchString:"",customAvailableIp:"",allowedIpFormatError:!1}},setup(s){const t=q(),n=U(),d=w("");return Object.keys(s.availableIp).length>0&&(d.value=Object.keys(s.availableIp)[0]),{store:t,dashboardStore:n,selectedSubnet:d}},computed:{searchAvailableIps(){return this.availableIpSearchString?this.availableIp[this.selectedSubnet].filter(s=>s.includes(this.availableIpSearchString)&&!this.data.allowed_ips.includes(s)):this.availableIp[this.selectedSubnet].filter(s=>!this.data.allowed_ips.includes(s))},inputGetLocale(){return F("Enter IP Address/CIDR")}},methods:{addAllowedIp(s){let t=s.split(",");for(let n=0;n<t.length;n++){let d=t[n].trim();if(this.store.checkCIDR(d))this.data.allowed_ips.push(d);else return this.allowedIpFormatError=!0,this.dashboardStore.newMessage("WGDashboard",`This Allowed IP address is invalid: ${d}`,"danger"),!1}return this.customAvailableIp="",!0}},watch:{customAvailableIp(){this.allowedIpFormatError=!1}},mounted(){if(this.availableIp!==void 0&&Object.keys(this.availableIp).length>0&&this.data.allowed_ips.length===0)for(let s in this.availableIp)this.availableIp[s].length>0&&this.addAllowedIp(this.availableIp[s][0])}},Vi={class:"d-flex flex-column flex-md-row mb-2"},Ei={for:"peer_allowed_ip_textbox",class:"form-label mb-0"},Ki={class:"text-muted"},Fi={class:"form-check form-switch ms-md-auto"},Wi={class:"form-check-label",for:"disableIPValidation"},zi={class:"d-flex"},Hi=["onClick"],qi={class:"d-flex gap-2 align-items-center"},Gi={class:"input-group"},Yi=["placeholder","disabled"],Qi=["disabled"],Zi={class:"text-muted"},Xi={class:"dropdown flex-grow-1"},er=["disabled"],tr={key:0,class:"dropdown-menu mt-2 shadow w-100 dropdown-menu-end rounded-3 pb-0",style:{width:"300px !important"}},sr={class:"px-3 d-flex gap-3 align-items-center"},or={class:"px-3 overflow-x-scroll d-flex overflow-x-scroll overflow-y-hidden align-items-center gap-2"},lr=["onClick"],nr={class:"overflow-y-scroll",style:{height:"270px"}},ar=["onClick"],ir={class:"me-auto"},rr={key:0,class:"px-3 py-2"},dr={key:0,class:"text-muted"},ur={key:1,class:"text-muted"};function cr(s,t,n,d,c,p){const o=j("LocaleText");return i(),m("div",{class:I({inactiveField:this.bulk})},[e("div",Vi,[e("label",Ei,[e("small",Ki,[l(o,{t:"Allowed IPs"}),t[5]||(t[5]=O()),e("code",null,[l(o,{t:"(Required)"})])])]),e("div",Fi,[D(e("input",{class:"form-check-input",type:"checkbox","onUpdate:modelValue":t[0]||(t[0]=r=>this.data.allowed_ips_validation=r),role:"switch",id:"disableIPValidation"},null,512),[[H,this.data.allowed_ips_validation]]),e("label",Wi,[e("small",null,[l(o,{t:"Allowed IPs Validation"})])])])]),e("div",zi,[e("div",{class:I(["d-flex gap-2 flex-wrap",{"mb-2":this.data.allowed_ips.length>0}])},[l(le,{name:"list"},{default:z(()=>[(i(!0),m(N,null,V(this.data.allowed_ips,(r,u)=>(i(),m("span",{class:"badge rounded-pill text-bg-success",key:r},[O(S(r)+" ",1),e("a",{role:"button",onClick:v=>this.data.allowed_ips.splice(u,1)},t[6]||(t[6]=[e("i",{class:"bi bi-x-circle-fill ms-1"},null,-1)]),8,Hi)]))),128))]),_:1})],2)]),e("div",qi,[e("div",Gi,[D(e("input",{type:"text",class:I(["form-control form-control-sm rounded-start-3",{"is-invalid":this.allowedIpFormatError}]),placeholder:this.inputGetLocale,onKeyup:t[1]||(t[1]=ge(r=>this.customAvailableIp?this.addAllowedIp(this.customAvailableIp):void 0,["enter"])),"onUpdate:modelValue":t[2]||(t[2]=r=>c.customAvailableIp=r),id:"peer_allowed_ip_textbox",disabled:n.bulk},null,42,Yi),[[M,c.customAvailableIp]]),e("button",{class:I(["btn btn-sm rounded-end-3",[this.customAvailableIp?"btn-success":"btn-outline-success"]]),disabled:n.bulk||!this.customAvailableIp,onClick:t[3]||(t[3]=r=>this.addAllowedIp(this.customAvailableIp)),type:"button",id:"button-addon2"},t[7]||(t[7]=[e("i",{class:"bi bi-plus-lg"},null,-1)]),10,Qi)]),e("small",Zi,[l(o,{t:"or"})]),e("div",Xi,[e("button",{class:"btn btn-outline-secondary btn-sm dropdown-toggle rounded-3 w-100",disabled:!n.availableIp||n.bulk,"data-bs-auto-close":"outside",type:"button","data-bs-toggle":"dropdown","aria-expanded":"false"},[t[8]||(t[8]=e("i",{class:"bi bi-filter-circle me-2"},null,-1)),l(o,{t:"Pick Available IP"})],8,er),this.availableIp?(i(),m("ul",tr,[e("li",null,[e("div",sr,[t[9]||(t[9]=e("label",{for:"availableIpSearchString",class:"text-muted"},[e("i",{class:"bi bi-search"})],-1)),D(e("input",{id:"availableIpSearchString",class:"form-control form-control-sm rounded-3","onUpdate:modelValue":t[4]||(t[4]=r=>this.availableIpSearchString=r)},null,512),[[M,this.availableIpSearchString]])]),t[11]||(t[11]=e("hr",{class:"my-2"},null,-1)),e("div",or,[t[10]||(t[10]=e("small",{class:"text-muted"},"Subnet",-1)),(i(!0),m(N,null,V(Object.keys(this.availableIp),r=>(i(),m("button",{key:r,onClick:u=>this.selectedSubnet=r,class:I([{"bg-primary-subtle":this.selectedSubnet===r},"btn btn-sm text-primary-emphasis rounded-3"])},S(r),11,lr))),128))]),t[12]||(t[12]=e("hr",{class:"mt-2 mb-0"},null,-1))]),e("li",null,[e("div",nr,[(i(!0),m(N,null,V(this.searchAvailableIps,r=>(i(),m("div",{style:{},key:r},[e("a",{class:"dropdown-item d-flex",role:"button",onClick:u=>this.addAllowedIp(r)},[e("span",ir,[e("small",null,S(r),1)])],8,ar)]))),128)),this.searchAvailableIps.length===0?(i(),m("div",rr,[this.availableIpSearchString?(i(),m("small",dr,[l(o,{t:"No available IP containing"}),O('"'+S(this.availableIpSearchString)+'"',1)])):(i(),m("small",ur,[l(o,{t:"No more IP address available in this subnet"})]))])):$("",!0)])])])):$("",!0)])])],2)}const mr=R(Ui,[["render",cr],["__scopeId","data-v-ed72944d"]]),pr={name:"dnsInput",components:{LocaleText:f},props:{data:Object,saving:Boolean},data(){return{error:!1,dns:JSON.parse(JSON.stringify(this.data.DNS))}},setup(){const s=q(),t=U();return{store:s,dashboardStore:t}},methods:{checkDNS(){if(this.dns){let s=this.dns.split(",").map(t=>t.replaceAll(" ",""));for(let t in s)if(!this.store.regexCheckIP(s[t])){this.error||this.dashboardStore.newMessage("WGDashboard","DNS format is incorrect","danger"),this.error=!0,this.data.DNS="";return}this.error=!1,this.data.DNS=this.dns}}},watch:{dns(){this.checkDNS()}}},br={for:"peer_DNS_textbox",class:"form-label"},fr={class:"text-muted"},vr=["disabled"];function hr(s,t,n,d,c,p){const o=j("LocaleText");return i(),m("div",null,[e("label",br,[e("small",fr,[l(o,{t:"DNS"})])]),D(e("input",{type:"text",class:I(["form-control form-control-sm rounded-3",{"is-invalid":this.error}]),disabled:this.saving,"onUpdate:modelValue":t[0]||(t[0]=r=>this.dns=r),id:"peer_DNS_textbox"},null,10,vr),[[M,this.dns]])])}const gr=R(pr,[["render",hr]]),_r={name:"nameInput",components:{LocaleText:f},props:{bulk:Boolean,data:Object,saving:Boolean}},yr={for:"peer_name_textbox",class:"form-label"},$r={class:"text-muted"},wr=["disabled"];function xr(s,t,n,d,c,p){const o=j("LocaleText");return i(),m("div",{class:I({inactiveField:this.bulk})},[e("label",yr,[e("small",$r,[l(o,{t:"Name"})])]),D(e("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:this.saving||this.bulk,"onUpdate:modelValue":t[0]||(t[0]=r=>this.data.name=r),id:"peer_name_textbox",placeholder:""},null,8,wr),[[M,this.data.name]])],2)}const kr=R(_r,[["render",xr]]),Sr={name:"privatePublicKeyInput",components:{LocaleText:f},props:{data:Object,saving:Boolean,bulk:Boolean},setup(){const s=U(),t=q();return{dashboardStore:s,wgStore:t}},data(){return{keypair:{publicKey:"",privateKey:"",presharedKey:""},editKey:!1,error:!1}},methods:{genKeyPair(){this.editKey=!1,this.keypair=window.wireguard.generateKeypair(),this.data.private_key=this.keypair.privateKey,this.data.public_key=this.keypair.publicKey},testKey(s){return/^[A-Za-z0-9+/]{43}=?=?$/.test(s)},checkMatching(){try{this.keypair.privateKey&&this.wgStore.checkWGKeyLength(this.keypair.privateKey)&&(this.keypair.publicKey=window.wireguard.generatePublicKey(this.keypair.privateKey),window.wireguard.generatePublicKey(this.keypair.privateKey)!==this.keypair.publicKey?(this.error=!0,this.dashboardStore.newMessage("WGDashboard","Private key does not match with the public key","danger")):(this.data.private_key=this.keypair.privateKey,this.data.public_key=this.keypair.publicKey))}catch{this.error=!0,this.data.private_key="",this.data.public_key=""}}},mounted(){this.genKeyPair()},watch:{keypair:{deep:!0,handler(){this.error=!1,this.checkMatching()}}}},Pr={for:"peer_private_key_textbox",class:"form-label"},Cr={class:"text-muted"},Ir={class:"input-group"},Ar=["disabled"],Dr=["disabled"],Lr={class:"d-flex flex-column flex-md-row mb-2"},Or={for:"public_key",class:"form-label mb-0"},Mr={class:"text-muted"},Nr={class:"form-check form-switch ms-md-auto"},Rr=["disabled"],Br={class:"form-check-label",for:"enablePublicKeyEdit"},Tr=["disabled"];function jr(s,t,n,d,c,p){const o=j("LocaleText");return i(),m("div",{class:I(["d-flex gap-2 flex-column",{inactiveField:this.bulk}])},[e("div",null,[e("label",Pr,[e("small",Cr,[l(o,{t:"Private Key"}),t[6]||(t[6]=O()),e("code",null,[l(o,{t:"(Required for QR Code and Download)"})])])]),e("div",Ir,[D(e("input",{type:"text",class:I(["form-control form-control-sm rounded-start-3",{"is-invalid":this.error}]),"onUpdate:modelValue":t[0]||(t[0]=r=>this.keypair.privateKey=r),disabled:!this.editKey||this.bulk,onBlur:t[1]||(t[1]=r=>this.checkMatching()),id:"peer_private_key_textbox"},null,42,Ar),[[M,this.keypair.privateKey]]),e("button",{class:"btn btn-outline-info btn-sm rounded-end-3",onClick:t[2]||(t[2]=r=>this.genKeyPair()),disabled:this.bulk,type:"button",id:"button-addon2"},t[7]||(t[7]=[e("i",{class:"bi bi-arrow-repeat"},null,-1)]),8,Dr)])]),e("div",null,[e("div",Lr,[e("label",Or,[e("small",Mr,[l(o,{t:"Public Key"}),t[8]||(t[8]=O()),e("code",null,[l(o,{t:"(Required)"})])])]),e("div",Nr,[D(e("input",{class:"form-check-input",type:"checkbox",role:"switch",disabled:this.bulk,id:"enablePublicKeyEdit","onUpdate:modelValue":t[3]||(t[3]=r=>this.editKey=r)},null,8,Rr),[[H,this.editKey]]),e("label",Br,[e("small",null,[l(o,{t:"Use your own Private and Public Key"})])])])]),D(e("input",{class:I(["form-control-sm form-control rounded-3",{"is-invalid":this.error}]),"onUpdate:modelValue":t[4]||(t[4]=r=>this.keypair.publicKey=r),onBlur:t[5]||(t[5]=r=>this.checkMatching()),disabled:!this.editKey||this.bulk,type:"text",id:"public_key"},null,42,Tr),[[M,this.keypair.publicKey]])])],2)}const Jr=R(Sr,[["render",jr]]),Ur={name:"bulkAdd",components:{LocaleText:f},props:{saving:Boolean,data:Object,availableIp:void 0},data(){return{numberOfAvailableIPs:null}},computed:{bulkAddGetLocale(){return F("How many peers you want to add?")},getNumberOfAvailableIPs(){return this.numberOfAvailableIPs?Object.values(this.numberOfAvailableIPs).reduce((s,t)=>s+t):"..."}},watch:{"data.bulkAdd":{immediate:!0,handler(s){s&&K("/api/getNumberOfAvailableIPs/"+this.$route.params.id,{},t=>{t.status&&(this.numberOfAvailableIPs=t.data)})}}}},Vr={class:"form-check form-switch"},Er=["disabled"],Kr={class:"form-check-label me-2",for:"bulk_add"},Fr={class:"text-muted d-block"},Wr={key:0,class:"form-group"},zr=["max","placeholder"],Hr={class:"text-muted"};function qr(s,t,n,d,c,p){const o=j("LocaleText");return i(),m("div",null,[e("div",Vr,[D(e("input",{class:"form-check-input",type:"checkbox",role:"switch",disabled:!this.availableIp,id:"bulk_add","onUpdate:modelValue":t[0]||(t[0]=r=>this.data.bulkAdd=r)},null,8,Er),[[H,this.data.bulkAdd]]),e("label",Kr,[e("small",null,[e("strong",null,[l(o,{t:"Bulk Add"})])])])]),e("p",{class:I({"mb-0":!this.data.bulkAdd})},[e("small",Fr,[l(o,{t:"By adding peers by bulk, each peer's name will be auto generated, and Allowed IP will be assign to the next available IP."})])],2),this.data.bulkAdd?(i(),m("div",Wr,[D(e("input",{class:"form-control form-control-sm rounded-3 mb-1",type:"number",min:"1",id:"bulk_add_count",max:this.availableIp.length,"onUpdate:modelValue":t[1]||(t[1]=r=>this.data.bulkAddAmount=r),placeholder:this.bulkAddGetLocale},null,8,zr),[[M,this.data.bulkAddAmount]]),e("small",Hr,[l(o,{t:"You can add up to "+p.getNumberOfAvailableIPs+" peers"},null,8,["t"])])])):$("",!0)])}const Gr=R(Ur,[["render",qr]]),Yr={name:"presharedKeyInput",components:{LocaleText:f},props:{data:Object,saving:Boolean},data(){return{enable:!1}},watch:{enable(){this.enable?this.data.preshared_key=window.wireguard.generateKeypair().presharedKey:this.data.preshared_key=""}}},Qr={class:"d-flex align-items-start"},Zr={for:"peer_preshared_key_textbox",class:"form-label"},Xr={class:"text-muted"},ed={class:"form-check form-switch ms-auto"},td=["disabled"];function sd(s,t,n,d,c,p){const o=j("LocaleText");return i(),m("div",null,[e("div",Qr,[e("label",Zr,[e("small",Xr,[l(o,{t:"Pre-Shared Key"})])]),e("div",ed,[D(e("input",{class:"form-check-input",type:"checkbox",role:"switch","onUpdate:modelValue":t[0]||(t[0]=r=>this.enable=r),id:"peer_preshared_key_switch"},null,512),[[H,this.enable]])])]),D(e("input",{type:"text",class:"form-control form-control-sm rounded-3",disabled:this.saving||!this.enable,"onUpdate:modelValue":t[1]||(t[1]=r=>this.data.preshared_key=r),id:"peer_preshared_key_textbox"},null,8,td),[[M,this.data.preshared_key]])])}const od=R(Yr,[["render",sd]]),ld={name:"mtuInput",components:{LocaleText:f},props:{data:Object,saving:Boolean}},nd={for:"peer_mtu",class:"form-label"},ad={class:"text-muted"},id=["disabled"];function rd(s,t,n,d,c,p){const o=j("LocaleText");return i(),m("div",null,[e("label",nd,[e("small",ad,[l(o,{t:"MTU"})])]),D(e("input",{type:"number",class:"form-control form-control-sm rounded-3",disabled:this.saving,"onUpdate:modelValue":t[0]||(t[0]=r=>this.data.mtu=r),min:"0",id:"peer_mtu"},null,8,id),[[M,this.data.mtu]])])}const dd=R(ld,[["render",rd]]),ud={name:"persistentKeepAliveInput",components:{LocaleText:f},props:{data:Object,saving:Boolean}},cd={for:"peer_keep_alive",class:"form-label"},md={class:"text-muted"},pd=["disabled"];function bd(s,t,n,d,c,p){const o=j("LocaleText");return i(),m("div",null,[e("label",cd,[e("small",md,[l(o,{t:"Persistent Keepalive"})])]),D(e("input",{type:"number",class:"form-control form-control-sm rounded-3",disabled:this.saving,"onUpdate:modelValue":t[0]||(t[0]=r=>this.data.keepalive=r),id:"peer_keep_alive"},null,8,pd),[[M,this.data.keepalive]])])}const fd=R(ud,[["render",bd]]),vd={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll",ref:"editConfigurationContainer"},hd={class:"container d-flex h-100 w-100"},gd={class:"m-auto modal-dialog-centered dashboardModal",style:{width:"1000px"}},_d={class:"card rounded-3 shadow flex-grow-1"},yd={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4"},$d={class:"mb-0"},wd={class:"card-body px-4 pb-4"},xd={class:"d-flex flex-column gap-2"},kd={class:"accordion mb-3",id:"peerAddModalAccordion"},Sd={class:"accordion-item"},Pd={class:"accordion-header"},Cd={class:"accordion-button collapsed rounded-3",type:"button","data-bs-toggle":"collapse","data-bs-target":"#peerAddModalAccordionAdvancedOptions"},Id={id:"peerAddModalAccordionAdvancedOptions",class:"accordion-collapse collapse collapsed","data-bs-parent":"#peerAddModalAccordion"},Ad={class:"accordion-body rounded-bottom-3"},Dd={class:"d-flex flex-column gap-2"},Ld={class:"row gy-3"},Od={key:0,class:"col-sm"},Md={class:"col-sm"},Nd={class:"col-sm"},Rd={key:1,class:"col-12"},Bd={class:"form-check form-switch"},Td={class:"form-check-label",for:"bullAdd_PresharedKey_Switch"},jd={class:"fw-bold"},Jd={class:"d-flex mt-2"},Ud=["disabled"],Vd={key:0,class:"bi bi-plus-circle-fill me-2"},Ed={__name:"peerAddModal",emits:["close","addedPeers"],async setup(s,{emit:t}){let n,d;const c=U(),p=q(),o=w({bulkAdd:!1,bulkAddAmount:0,name:"",allowed_ips:[],private_key:"",public_key:"",DNS:c.Configuration.Peers.peer_global_dns,endpoint_allowed_ip:c.Configuration.Peers.peer_endpoint_allowed_ip,keepalive:parseInt(c.Configuration.Peers.peer_keep_alive),mtu:parseInt(c.Configuration.Peers.peer_mtu),preshared_key:"",preshared_key_bulkAdd:!1,advanced_security:"off",allowed_ips_validation:!0}),r=w([]),u=w(!1),v=Y();[n,d]=be(()=>K("/api/getAvailableIPs/"+v.params.id,{},C=>{C.status&&(r.value=C.data)})),await n,d();const h=t;W(()=>p.Configurations.find(C=>C.Name===v.params.id).Protocol);const P=W(()=>{let C=!0;return o.value.bulkAdd?(o.value.bulkAddAmount.length===0||o.value.bulkAddAmount>r.value.length)&&(C=!1):["allowed_ips","private_key","public_key","endpoint_allowed_ip","keepalive","mtu"].forEach(_=>{o.value[_].length===0&&(C=!1)}),C}),x=()=>{u.value=!0,J("/api/addPeers/"+v.params.id,o.value,C=>{C.status?(c.newMessage("Server","Peer created successfully","success"),h("addedPeers")):c.newMessage("Server",C.message,"danger"),u.value=!1})};return G(()=>o.value.bulkAddAmount,()=>{o.value.bulkAddAmount>r.value.length&&(o.value.bulkAddAmount=r.value.length)}),(C,g)=>(i(),m("div",vd,[e("div",hd,[e("div",gd,[e("div",_d,[e("div",yd,[e("h4",$d,[l(f,{t:"Add Peers"})]),e("button",{type:"button",class:"btn-close ms-auto",onClick:g[0]||(g[0]=_=>h("close"))})]),e("div",wd,[e("div",xd,[l(Gr,{saving:u.value,data:o.value,availableIp:r.value},null,8,["saving","data","availableIp"]),o.value.bulkAdd?$("",!0):(i(),m(N,{key:0},[g[3]||(g[3]=e("hr",{class:"mb-0 mt-2"},null,-1)),l(kr,{saving:u.value,data:o.value},null,8,["saving","data"]),l(Jr,{saving:u.value,data:o.value},null,8,["saving","data"]),l(mr,{availableIp:r.value,saving:u.value,data:o.value},null,8,["availableIp","saving","data"])],64))]),g[5]||(g[5]=e("hr",null,null,-1)),e("div",kd,[e("div",Sd,[e("h2",Pd,[e("button",Cd,[l(f,{t:"Advanced Options"})])]),e("div",Id,[e("div",Ad,[e("div",Dd,[l(gr,{saving:u.value,data:o.value},null,8,["saving","data"]),l(Ji,{saving:u.value,data:o.value},null,8,["saving","data"]),e("div",Ld,[o.value.bulkAdd?$("",!0):(i(),m("div",Od,[l(od,{saving:u.value,data:o.value,bulk:o.value.bulkAdd},null,8,["saving","data","bulk"])])),e("div",Md,[l(dd,{saving:u.value,data:o.value},null,8,["saving","data"])]),e("div",Nd,[l(fd,{saving:u.value,data:o.value},null,8,["saving","data"])]),o.value.bulkAdd?(i(),m("div",Rd,[e("div",Bd,[D(e("input",{class:"form-check-input",type:"checkbox",role:"switch","onUpdate:modelValue":g[1]||(g[1]=_=>o.value.preshared_key_bulkAdd=_),id:"bullAdd_PresharedKey_Switch",checked:""},null,512),[[H,o.value.preshared_key_bulkAdd]]),e("label",Td,[e("small",jd,[l(f,{t:"Pre-Shared Key"}),g[4]||(g[4]=O()),o.value.preshared_key_bulkAdd?(i(),A(f,{key:0,t:"Enabled"})):(i(),A(f,{key:1,t:"Disabled"}))])])])])):$("",!0)])])])])])]),e("div",Jd,[e("button",{class:"ms-auto btn btn-dark btn-brand rounded-3 px-3 py-2 shadow",disabled:!P.value||u.value,onClick:g[2]||(g[2]=_=>x())},[u.value?$("",!0):(i(),m("i",Vd)),u.value?(i(),A(f,{key:1,t:"Adding..."})):(i(),A(f,{key:2,t:"Add"}))],8,Ud)])])])])])],512))}},Kd={class:"container-fluid"},Fd={class:"d-flex align-items-sm-start flex-column flex-sm-row gap-3"},Wd={class:"text-muted d-flex align-items-center gap-2"},zd={class:"mb-0"},Hd={class:"d-flex align-items-center gap-3"},qd={class:"mb-0 display-4"},Gd={class:"ms-sm-auto d-flex gap-2 flex-column"},Yd={class:"card rounded-3 bg-transparent"},Qd={class:"card-body py-2 d-flex align-items-center"},Zd={class:"text-muted"},Xd={class:"form-check form-switch mb-0 ms-auto pe-0 me-0"},eu=["for"],tu={key:2,class:"spinner-border spinner-border-sm ms-2","aria-hidden":"true"},su=["disabled","id"],ou={class:"d-flex gap-2"},lu={class:"row mt-3 gy-2 gx-2 mb-2"},nu={class:"col-12 col-lg-3"},au={class:"card rounded-3 bg-transparent h-100"},iu={class:"card-body py-2 d-flex flex-column justify-content-center"},ru={class:"mb-0 text-muted"},du={class:"col-12 col-lg-3"},uu={class:"card rounded-3 bg-transparent h-100"},cu={class:"card-body py-2 d-flex flex-column justify-content-center"},mu={class:"mb-0 text-muted"},pu={style:{"word-break":"break-all"},class:"col-12 col-lg-6"},bu={class:"card rounded-3 bg-transparent h-100"},fu={class:"card-body py-2 d-flex flex-column justify-content-center"},vu={class:"mb-0 text-muted"},hu={class:"row gx-2 gy-2 mb-2"},gu={class:"col-12 col-lg-3"},_u={class:"card rounded-3 bg-transparent h-100"},yu={class:"card-body d-flex"},$u={class:"mb-0 text-muted"},wu={class:"h4"},xu={class:"col-12 col-lg-3"},ku={class:"card rounded-3 bg-transparent h-100"},Su={class:"card-body d-flex"},Pu={class:"mb-0 text-muted"},Cu={class:"h4"},Iu={class:"col-12 col-lg-3"},Au={class:"card rounded-3 bg-transparent h-100"},Du={class:"card-body d-flex"},Lu={class:"mb-0 text-muted"},Ou={class:"h4 text-primary"},Mu={class:"col-12 col-lg-3"},Nu={class:"card rounded-3 bg-transparent h-100"},Ru={class:"card-body d-flex"},Bu={class:"mb-0 text-muted"},Tu={class:"h4 text-success"},ju={style:{"margin-bottom":"80px"}},Ju=20,Uu={__name:"peerList",async setup(s){let t,n;const d=U(),c=q(),p=Y(),o=w({}),r=w([]),u=w(!1),v=w({}),h=w({peerNew:{modalOpen:!1},peerSetting:{modalOpen:!1},peerScheduleJobs:{modalOpen:!1},peerQRCode:{modalOpen:!1},peerConfigurationFile:{modalOpen:!1},peerCreate:{modalOpen:!1},peerScheduleJobsAll:{modalOpen:!1},peerScheduleJobsLogs:{modalOpen:!1},peerShare:{modalOpen:!1},editConfiguration:{modalOpen:!1},selectPeers:{modalOpen:!1},backupRestore:{modalOpen:!1},deleteConfiguration:{modalOpen:!1},editRawConfigurationFile:{modalOpen:!1},assignPeer:{modalOpen:!1}}),P=w(!1),x=async()=>{await K("/api/getWireguardConfigurationInfo",{configurationName:p.params.id},b=>{b.status&&(o.value=b.data.configurationInfo,r.value=b.data.configurationPeers,r.value.forEach(a=>{a.restricted=!1}),b.data.configurationRestrictedPeers.forEach(a=>{a.restricted=!0,r.value.push(a)}))})};[t,n]=be(()=>x()),await t,n();const C=w(void 0),g=()=>{clearInterval(C.value),C.value=setInterval(async()=>{await x()},parseInt(d.Configuration.Server.dashboard_refresh_interval))};g(),me(()=>{clearInterval(C.value),C.value=void 0}),G(()=>d.Configuration.Server.dashboard_refresh_interval,()=>{g()});const _=async()=>{u.value=!0,await K("/api/toggleWireguardConfiguration",{configurationName:o.value.Name},b=>{b.status?d.newMessage("Server",`${o.value.Name} ${b.data?"is on":"is off"}`,"success"):d.newMessage("Server",b.message,"danger"),c.Configurations.find(a=>a.Name===o.value.Name).Status=b.data,o.value.Status=b.data,u.value=!1})},k=W(()=>({connectedPeers:r.value.filter(b=>b.status==="running").length,totalUsage:r.value.length>0?r.value.filter(b=>!b.restricted).map(b=>b.total_data+b.cumu_data).reduce((b,a)=>b+a,0).toFixed(4):0,totalReceive:r.value.length>0?r.value.filter(b=>!b.restricted).map(b=>b.total_receive+b.cumu_receive).reduce((b,a)=>b+a,0).toFixed(4):0,totalSent:r.value.length>0?r.value.filter(b=>!b.restricted).map(b=>b.total_sent+b.cumu_sent).reduce((b,a)=>b+a,0).toFixed(4):0})),L=w(10),B=W(()=>{const b=c.searchString?r.value.filter(a=>a.name.includes(c.searchString)||a.id.includes(c.searchString)||a.allowed_ip.includes(c.searchString)):r.value;return d.Configuration.Server.dashboard_sort==="restricted"?b.sort((a,y)=>a[d.Configuration.Server.dashboard_sort]<y[d.Configuration.Server.dashboard_sort]?1:a[d.Configuration.Server.dashboard_sort]>y[d.Configuration.Server.dashboard_sort]?-1:0).slice(0,L.value):b.sort((a,y)=>a[d.Configuration.Server.dashboard_sort]<y[d.Configuration.Server.dashboard_sort]?-1:a[d.Configuration.Server.dashboard_sort]>y[d.Configuration.Server.dashboard_sort]?1:0).slice(0,L.value)});return G(()=>p.query.id,b=>{b?c.searchString=b:c.searchString=void 0},{immediate:!0}),(b,a)=>(i(),m("div",Kd,[e("div",Fd,[e("div",null,[e("div",Wd,[e("h5",zd,[l(Ie,{protocol:o.value.Protocol},null,8,["protocol"])])]),e("div",Hd,[e("h1",qd,[e("samp",null,S(o.value.Name),1)])])]),e("div",Gd,[e("div",Yd,[e("div",Qd,[e("small",Zd,[l(f,{t:"Status"})]),e("div",{class:I(["dot ms-2",{active:o.value.Status}])},null,2),e("div",Xd,[e("label",{class:"form-check-label",style:{cursor:"pointer"},for:"switch"+o.value.id},[o.value.Status&&!u.value?(i(),A(f,{key:0,t:"On"})):!o.value.Status&&!u.value?(i(),A(f,{key:1,t:"Off"})):$("",!0),u.value?(i(),m("span",tu)):$("",!0)],8,eu),D(e("input",{class:"form-check-input",style:{cursor:"pointer"},disabled:u.value,type:"checkbox",role:"switch",id:"switch"+o.value.id,onChange:a[0]||(a[0]=y=>_()),"onUpdate:modelValue":a[1]||(a[1]=y=>o.value.Status=y)},null,40,su),[[H,o.value.Status]])])])]),e("div",ou,[e("a",{role:"button",onClick:a[2]||(a[2]=y=>h.value.peerNew.modalOpen=!0),class:"titleBtn py-2 text-decoration-none btn text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle"},[a[29]||(a[29]=e("i",{class:"bi bi-plus-circle me-2"},null,-1)),l(f,{t:"Peer"})]),e("button",{class:"titleBtn py-2 text-decoration-none btn text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:a[3]||(a[3]=y=>h.value.editConfiguration.modalOpen=!0),type:"button","aria-expanded":"false"},[a[30]||(a[30]=e("i",{class:"bi bi-gear-fill me-2"},null,-1)),l(f,{t:"Configuration Settings"})])])])]),a[35]||(a[35]=e("hr",null,null,-1)),l(Cs,{configuration:o.value},null,8,["configuration"]),e("div",lu,[e("div",nu,[e("div",au,[e("div",iu,[e("p",ru,[e("small",null,[l(f,{t:"Address"})])]),O(" "+S(o.value.Address),1)])])]),e("div",du,[e("div",uu,[e("div",cu,[e("p",mu,[e("small",null,[l(f,{t:"Listen Port"})])]),O(" "+S(o.value.ListenPort),1)])])]),e("div",pu,[e("div",bu,[e("div",fu,[e("p",vu,[e("small",null,[l(f,{t:"Public Key"})])]),e("samp",null,S(o.value.PublicKey),1)])])])]),e("div",hu,[e("div",gu,[e("div",_u,[e("div",yu,[e("div",null,[e("p",$u,[e("small",null,[l(f,{t:"Connected Peers"})])]),e("strong",wu,S(k.value.connectedPeers)+" / "+S(r.value.length),1)]),a[31]||(a[31]=e("i",{class:"bi bi-ethernet ms-auto h2 text-muted"},null,-1))])])]),e("div",xu,[e("div",ku,[e("div",Su,[e("div",null,[e("p",Pu,[e("small",null,[l(f,{t:"Total Usage"})])]),e("strong",Cu,S(k.value.totalUsage)+" GB",1)]),a[32]||(a[32]=e("i",{class:"bi bi-arrow-down-up ms-auto h2 text-muted"},null,-1))])])]),e("div",Iu,[e("div",Au,[e("div",Du,[e("div",null,[e("p",Lu,[e("small",null,[l(f,{t:"Total Received"})])]),e("strong",Ou,S(k.value.totalReceive)+" GB",1)]),a[33]||(a[33]=e("i",{class:"bi bi-arrow-down ms-auto h2 text-muted"},null,-1))])])]),e("div",Mu,[e("div",Nu,[e("div",Ru,[e("div",null,[e("p",Bu,[e("small",null,[l(f,{t:"Total Sent"})])]),e("strong",Tu,S(k.value.totalSent)+" GB",1)]),a[34]||(a[34]=e("i",{class:"bi bi-arrow-up ms-auto h2 text-muted"},null,-1))])])])]),l(at,{configurationPeers:r.value,configurationInfo:o.value},null,8,["configurationPeers","configurationInfo"]),a[36]||(a[36]=e("hr",null,null,-1)),e("div",ju,[r.value.length>0?(i(),A(Ot,{key:0,onSearch:a[4]||(a[4]=y=>P.value=!0),onJobsAll:a[5]||(a[5]=y=>h.value.peerScheduleJobsAll.modalOpen=!0),onJobLogs:a[6]||(a[6]=y=>h.value.peerScheduleJobsLogs.modalOpen=!0),onEditConfiguration:a[7]||(a[7]=y=>h.value.editConfiguration.modalOpen=!0),onSelectPeers:a[8]||(a[8]=y=>h.value.selectPeers.modalOpen=!0),onBackupRestore:a[9]||(a[9]=y=>h.value.backupRestore.modalOpen=!0),onDeleteConfiguration:a[10]||(a[10]=y=>h.value.deleteConfiguration.modalOpen=!0),configuration:o.value},null,8,["configuration"])):$("",!0),l(le,{name:"peerList",tag:"div",class:"row gx-2 gy-2 z-0 position-relative"},{default:z(()=>[(i(!0),m(N,null,V(B.value,y=>(i(),m("div",{class:I(["col-12",{"col-lg-6 col-xl-4":E(d).Configuration.Server.dashboard_peer_list_display==="grid"}]),key:y.id},[l(ws,{Peer:y,onShare:T=>{h.value.peerShare.modalOpen=!0,v.value=y},onRefresh:a[11]||(a[11]=T=>x()),onJobs:T=>{h.value.peerScheduleJobs.modalOpen=!0,v.value=y},onSetting:T=>{h.value.peerSetting.modalOpen=!0,v.value=y},onQrcode:T=>{v.value=y,h.value.peerQRCode.modalOpen=!0},onConfigurationFile:T=>{v.value=y,h.value.peerConfigurationFile.modalOpen=!0},onAssign:T=>{v.value=y,h.value.assignPeer.modalOpen=!0}},null,8,["Peer","onShare","onJobs","onSetting","onQrcode","onConfigurationFile","onAssign"])],2))),128))]),_:1})]),l(oe,{name:"slideUp"},{default:z(()=>[P.value?(i(),A(Bs,{key:0,onClose:a[12]||(a[12]=y=>P.value=!1)})):$("",!0)]),_:1}),l(xs,{configurationModals:h.value,configurationModalSelectedPeer:v.value,onRefresh:a[13]||(a[13]=y=>x())},null,8,["configurationModals","configurationModalSelectedPeer"]),l(le,{name:"zoom"},{default:z(()=>[(i(),A(Ce,{key:"PeerAddModal"},{default:z(()=>[h.value.peerNew.modalOpen?(i(),A(Ed,{key:0,onClose:a[14]||(a[14]=y=>h.value.peerNew.modalOpen=!1),onAddedPeers:a[15]||(a[15]=y=>{h.value.peerNew.modalOpen=!1,x()})})):$("",!0)]),_:1})),h.value.peerScheduleJobsAll.modalOpen?(i(),A(So,{key:"PeerJobsAllModal",onRefresh:a[16]||(a[16]=y=>x()),onAllLogs:a[17]||(a[17]=y=>h.value.peerScheduleJobsLogs.modalOpen=!0),onClose:a[18]||(a[18]=y=>h.value.peerScheduleJobsAll.modalOpen=!1),configurationPeers:r.value},null,8,["configurationPeers"])):$("",!0),h.value.peerScheduleJobsLogs.modalOpen?(i(),A(cl,{key:"PeerJobsLogsModal",onClose:a[19]||(a[19]=y=>h.value.peerScheduleJobsLogs.modalOpen=!1),configurationInfo:o.value},null,8,["configurationInfo"])):$("",!0),h.value.editConfiguration.modalOpen?(i(),A(ai,{key:"EditConfigurationModal",onEditRaw:a[20]||(a[20]=y=>h.value.editRawConfigurationFile.modalOpen=!0),onClose:a[21]||(a[21]=y=>h.value.editConfiguration.modalOpen=!1),onDataChanged:a[22]||(a[22]=y=>o.value=y),onRefresh:a[23]||(a[23]=y=>x()),onBackupRestore:a[24]||(a[24]=y=>h.value.backupRestore.modalOpen=!0),onDeleteConfiguration:a[25]||(a[25]=y=>h.value.deleteConfiguration.modalOpen=!0),configurationInfo:o.value},null,8,["configurationInfo"])):$("",!0),h.value.selectPeers.modalOpen?(i(),A(Mi,{key:3,onRefresh:a[26]||(a[26]=y=>x()),configurationPeers:r.value,onClose:a[27]||(a[27]=y=>h.value.selectPeers.modalOpen=!1)},null,8,["configurationPeers"])):$("",!0)]),_:1}),l(Ss,{showPeersCount:L.value,peerListLength:B.value.length,onLoadMore:a[28]||(a[28]=y=>L.value+=Ju)},null,8,["showPeersCount","peerListLength"])]))}},Vu=R(Uu,[["__scopeId","data-v-8e2e659f"]]),qu=Object.freeze(Object.defineProperty({__proto__:null,default:Vu},Symbol.toStringTag,{value:"Module"}));export{Ks as S,lo as a,qu as p};
|