2024-12-18 17:45:22 +08:00
|
|
|
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/deleteConfiguration-gjCTyT4T.js","assets/index-C7RZshvj.js","assets/index-Bj4AOr1K.css","assets/localeText-CtboAReP.js","assets/configurationBackupRestore-Dea4yoLF.js","assets/dayjs.min-Bc9ZgdwU.js","assets/configurationBackupRestore-BeBqyCqt.css","assets/selectPeers-C_VG2AGk.js","assets/selectPeers-Wjnh8YUZ.css","assets/editConfiguration-BbKPgegf.js","assets/editConfiguration-Oqrarw_V.css","assets/peerShareLinkModal-D23qHCPl.js","assets/vue-datepicker-QX0NLR-4.js","assets/peerJobsLogsModal-PbWxka5-.js","assets/peerJobsAllModal-roMAeqgA.js","assets/schedulePeerJob-DKrIJ91n.js","assets/schedulePeerJob--V7cpve7.css","assets/peerJobs-Cv4hhfes.js","assets/peerJobs-voXURBEt.css","assets/peerCreate-Cz6pOdlA.js","assets/peerCreate-BpTNoL68.css","assets/peerQRCode-7CQhcymP.js","assets/browser-CjSdxGTc.js","assets/peerConfigurationFile-UmU9dUY-.js","assets/peerConfigurationFile-CNB9RKjb.css","assets/peerSettings-CTAPAYhI.js","assets/peerSettings-DCod994Y.css"])))=>i.map(i=>d[i]);
|
|
|
|
|
import{_ as Dt,D as hi,W as Vi,G as bt,z as ie,g as oe,a as M,c as R,b as g,d as C,t as F,F as Xt,h as ii,e as B,j as $,J as Ko,K as Xo,A as Rn,H as An,r as st,n as ht,w as X,T as q,f as pt,i as N,L as In,M as En,N as Ci,O as Go,o as ji,P as Jo,Q as Di,R as qo,U as Fn,p as Bn,V as zn,m as Ui,x as Qo,X as Zo,q as Ot,C as tr,Y as er,Z as ir,$ as sr,s as nr,a0 as rt,v as or,k as rr,a1 as at}from"./index-C7RZshvj.js";import{L as ft}from"./localeText-CtboAReP.js";import{d as cs}from"./dayjs.min-Bc9ZgdwU.js";import{_ as ar}from"./protocolBadge-tjyiv7K1.js";const lr={name:"peerSearch",components:{LocaleText:ft},setup(){const i=hi(),t=Vi();return{store:i,wireguardConfigurationStore:t}},props:{configuration:Object},data(){return{sort:{status:bt("Status"),name:bt("Name"),allowed_ip:bt("Allowed IPs"),restricted:bt("Restricted")},interval:{5e3:bt("5 Seconds"),1e4:bt("10 Seconds"),3e4:bt("30 Seconds"),6e4:bt("1 Minutes")},searchString:"",searchStringTimeout:void 0,showDisplaySettings:!1,showMoreSettings:!1}},methods:{debounce(){this.searchStringTimeout?(clearTimeout(this.searchStringTimeout),this.searchStringTimeout=setTimeout(()=>{this.wireguardConfigurationStore.searchString=this.searchString},300)):this.searchStringTimeout=setTimeout(()=>{this.wireguardConfigurationStore.searchString=this.searchString},300)},updateSort(i){ie("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_sort",value:i},t=>{t.status&&this.store.getConfiguration()})},updateRefreshInterval(i){ie("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_refresh_interval",value:i},t=>{t.status&&this.store.getConfiguration()})},downloadAllPeer(){oe(`/api/downloadAllPeers/${this.configuration.Name}`,{},i=>{console.log(i),window.wireguard.generateZipFiles(i,this.configuration.Name)})}},computed:{searchBarPlaceholder(){return bt("Search Peers...")}}},cr={class:"d-flex flex-column gap-2 my-4"},hr={class:"d-flex gap-2 peerSearchContainer"},dr={class:"dropdown"},ur={"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"},fr={class:"badge text-bg-primary ms-2"},gr={class:"dropdown-menu rounded-3"},pr=["onClick"],mr={class:"ms-auto"},br={key:0,class:"bi bi-check-circle-fill"},_r={class:"dropdown"},xr={"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"},yr={class:"badge text-bg-primary ms-2"},vr={class:"dropdown-menu rounded-3"},Sr=["onClick"],wr={class:"ms-auto"},kr={key:0,class:"bi bi-check-circle-fill"};function Pr(i,t,e,s,n,o){const r=$("LocaleText");return M(),R("div",cr,[g("div",hr,[g("div",dr,[g("button",ur,[t[4]||(t[4]=g("i",{class:"bi bi-sort-up me-2"},null,-1)),C(r,{t:"Sort By"}),g("span",fr,F(this.sort[s.store.Configuration.Server.dashboard_sort]),1)]),g("ul",gr,[(M(!0),R(Xt,null,ii(this.sort,(a,l)=>(M(),R("li",null,[g("button",{class:"dropdown-item d-flex align-items-center",onClick:c=>this.updateSort(l)},[g("small",null,F(a),1),g("small",mr,[s.store.Configuration.Server.dashboard_sort===l?(M(),R("i",br)):B("",!0)])],8,pr)]))),256))])]),g("div",_r,[g("button",xr,[t[5]||(t[5]=g("i",{class:"bi bi-arrow-repeat me-2"},null,-1)),C(r,{t:"Refresh Interval"}),g("span",yr,F(this.interval[s.store.Configuration.Server.dashboard_refresh_interval]),1)]),g("ul",vr,[(M(!0),R(Xt,null,ii(this.interval,(a,l)=>(M(),R("li",null,[g("button",{class:"dropdown-item d-flex align-items-center",onClick:c=>this.updateRefreshInterval(l)},[g("small",null,F(a),1),g("small",wr,[s.store.Configuration.Server.dashboard_refresh_interval===l?(M(),R("i",kr)):B("",!0)])],8,Sr)]))),256))])]),g("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]=a=>this.$emit("search"))},[t[6]||(t[6]=g("i",{class:"bi bi-search me-2"},null,-1)),C(r,{t:"Search"})]),g("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:t[1]||(t[1]=a=>this.
|
2024-12-06 20:27:04 +08:00
|
|
|
|
* @kurkle/color v0.3.2
|
|
|
|
|
* https://github.com/kurkle/color#readme
|
|
|
|
|
* (c) 2023 Jukka Kurkela
|
|
|
|
|
* Released under the MIT License
|
2024-12-18 15:06:41 +08:00
|
|
|
|
*/function Ae(i){return i+.5|0}const Lt=(i,t,e)=>Math.max(Math.min(i,e),t);function xe(i){return Lt(Ae(i*2.55),0,255)}function At(i){return Lt(Ae(i*255),0,255)}function Mt(i){return Lt(Ae(i/2.55)/100,0,1)}function ds(i){return Lt(Ae(i*100),0,100)}const lt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Oi=[..."0123456789ABCDEF"],ma=i=>Oi[i&15],ba=i=>Oi[(i&240)>>4]+Oi[i&15],ze=i=>(i&240)>>4===(i&15),_a=i=>ze(i.r)&&ze(i.g)&&ze(i.b)&&ze(i.a);function xa(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255<[i[1]]*17,g:255<[i[2]]*17,b:255<[i[3]]*17,a:t===5?lt[i[4]]*17:255}:(t===7||t===9)&&(e={r:lt[i[1]]<<4|lt[i[2]],g:lt[i[3]]<<4|lt[i[4]],b:lt[i[5]]<<4|lt[i[6]],a:t===9?lt[i[7]]<<4|lt[i[8]]:255})),e}const ya=(i,t)=>i<255?t(i):"";function va(i){var t=_a(i)?ma:ba;return i?"#"+t(i.r)+t(i.g)+t(i.b)+ya(i.a,t):void 0}const Sa=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function jn(i,t,e){const s=t*Math.min(e,1-e),n=(o,r=(o+i/30)%12)=>e-s*Math.max(Math.min(r-3,9-r,1),-1);return[n(0),n(8),n(4)]}function wa(i,t,e){const s=(n,o=(n+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function ka(i,t,e){const s=jn(i,1,.5);let n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)s[n]*=1-t-e,s[n]+=t;return s}function Pa(i,t,e,s,n){return i===n?(t-e)/s+(t<e?6:0):t===n?(e-i)/s+2:(i-t)/s+4}function Yi(i){const e=i.r/255,s=i.g/255,n=i.b/255,o=Math.max(e,s,n),r=Math.min(e,s,n),a=(o+r)/2;let l,c,h;return o!==r&&(h=o-r,c=a>.5?h/(2-o-r):h/(o+r),l=Pa(e,s,n,h,o),l=l*60+.5),[l|0,c||0,a]}function Ki(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(At)}function Xi(i,t,e){return Ki(jn,i,t,e)}function Ma(i,t,e){return Ki(ka,i,t,e)}function Ca(i,t,e){return Ki(wa,i,t,e)}function Un(i){return(i%360+360)%360}function Da(i){const t=Sa.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?xe(+t[5]):At(+t[5]));const n=Un(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?s=Ma(n,o,r):t[1]==="hsv"?s=Ca(n,o,r):s=Xi(n,o,r),{r:s[0],g:s[1],b:s[2],a:e}}function Oa(i,t){var e=Yi(i);e[0]=Un(e[0]+t),e=Xi(e),i.r=e[0],i.g=e[1],i.b=e[2]}function Ta(i){if(!i)return;const t=Yi(i),e=t[0],s=ds(t[1]),n=ds(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${Mt(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const us={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},fs={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"
|
2024-12-06 20:27:04 +08:00
|
|
|
|
* Chart.js v4.4.4
|
|
|
|
|
* https://www.chartjs.org
|
|
|
|
|
* (c) 2024 Chart.js Contributors
|
|
|
|
|
* Released under the MIT License
|
2024-12-18 17:45:22 +08:00
|
|
|
|
*/function wt(){}const za=(()=>{let i=0;return()=>i++})();function W(i){return i===null||typeof i>"u"}function G(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function E(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function dt(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function mt(i,t){return dt(i)?i:t}function I(i,t){return typeof i>"u"?t:i}const $a=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function V(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function z(i,t,e,s){let n,o,r;if(G(i))for(o=i.length,n=0;n<o;n++)t.call(e,i[n],n);else if(E(i))for(r=Object.keys(i),o=r.length,n=0;n<o;n++)t.call(e,i[r[n]],r[n])}function si(i,t){let e,s,n,o;if(!i||!t||i.length!==t.length)return!1;for(e=0,s=i.length;e<s;++e)if(n=i[e],o=t[e],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function ni(i){if(G(i))return i.map(ni);if(E(i)){const t=Object.create(null),e=Object.keys(i),s=e.length;let n=0;for(;n<s;++n)t[e[n]]=ni(i[e[n]]);return t}return i}function Kn(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function Na(i,t,e,s){if(!Kn(i))return;const n=t[i],o=e[i];E(n)&&E(o)?Ce(n,o,s):t[i]=ni(o)}function Ce(i,t,e){const s=G(t)?t:[t],n=s.length;if(!E(i))return i;e=e||{};const o=e.merger||Na;let r;for(let a=0;a<n;++a){if(r=s[a],!E(r))continue;const l=Object.keys(r);for(let c=0,h=l.length;c<h;++c)o(l[c],i,r,e)}return i}function Se(i,t){return Ce(i,t,{merger:Ha})}function Ha(i,t,e){if(!Kn(i))return;const s=t[i],n=e[i];E(s)&&E(n)?Se(s,n):Object.prototype.hasOwnProperty.call(t,i)||(t[i]=ni(n))}const ps={"":i=>i,x:i=>i.x,y:i=>i.y};function Wa(i){const t=i.split("."),e=[];let s="";for(const n of t)s+=n,s.endsWith("\\")?s=s.slice(0,-1)+".":(e.push(s),s="");return e}function Va(i){const t=Wa(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function re(i,t){return(ps[t]||(ps[t]=Va(t)))(i)}function Gi(i){return i.charAt(0).toUpperCase()+i.slice(1)}const De=i=>typeof i<"u",It=i=>typeof i=="function",ms=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function ja(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const J=Math.PI,vt=2*J,Ua=vt+J,oi=Number.POSITIVE_INFINITY,Ya=J/180,gt=J/2,$t=J/4,bs=J*2/3,Ti=Math.log10,St=Math.sign;function we(i,t,e){return Math.abs(i-t)<e}function _s(i){const t=Math.round(i);i=we(i,t,i/1e3)?t:i;const e=Math.pow(10,Math.floor(Ti(i))),s=i/e;return(s<=1?1:s<=2?2:s<=5?5:10)*e}function Ka(i){const t=[],e=Math.sqrt(i);let s;for(s=1;s<e;s++)i%s===0&&(t.push(s),t.push(i/s));return e===(e|0)&&t.push(e),t.sort((n,o)=>n-o).pop(),t}function Oe(i){return!isNaN(parseFloat(i))&&isFinite(i)}function Xa(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function Ga(i,t,e){let s,n,o;for(s=0,n=i.length;s<n;s++)o=i[s][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function Ut(i){return i*(J/180)}function Ja(i){return i*(180/J)}function xs(i){if(!dt(i))return;let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}function qa(i,t){const e=t.x-i.x,s=t.y-i.y,n=Math.sqrt(e*e+s*s);let o=Math.atan2(s,e);return o<-.5*J&&(o+=vt),{angle:o,distance:n}}function Li(i,t){return Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2))}function Qa(i,t){return(i-t+Ua)%vt-J}function Tt(i){return(i%vt+vt)%vt}function Xn(i,t,e,s){const n=Tt(i),o=Tt(t),r=Tt(e),a=Tt(o-n),l=Tt(r-n),c=Tt(n-o),h=Tt(n-r);return n===o||n===r||s&&o===r||a>l&&c<h}function nt(i,t,e){return Math.max(t,Math.min(e,i))}function Za(i){return nt(i,-32768,32767)}function Yt(i,t,e,s=1e-6){return i>=Math.min(t,e)-s&&i<=Math.max(t,e)+s}function Ji(i,t,e){e=e||(r=>i[r]<t);let s=i.length-1,n=0,o;for(;s-n>1;)o=n+s>>1,e(o)?n=o:s=o;return{lo:n,hi:s}}const Kt=(i,t,e,s)=>Ji(i,e,s?n=>{const o=i[n][t];return o<e||o===e&&i[n+1][t]===e}:n=>i[n][t]<e),tl=(i,t,e)=>Ji(i,e,s=>i[s][t]>=e);function el(i,t,e){let s=0,n=i.length;for(;s<n&&i[s]<t;)s++;for(;n>s&&i[n-1]>e;)n--;return s>0||n<i.length?i.slice(s,n):i}c
|
2024-12-06 20:27:04 +08:00
|
|
|
|
* Chart.js v4.4.4
|
|
|
|
|
* https://www.chartjs.org
|
|
|
|
|
* (c) 2024 Chart.js Contributors
|
|
|
|
|
* Released under the MIT License
|
2024-12-18 17:45:22 +08:00
|
|
|
|
*/class ac{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,s,n){const o=e.listeners[n],r=e.duration;o.forEach(a=>a({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(s-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=qn.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((s,n)=>{if(!s.running||!s.items.length)return;const o=s.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,s,t,"progress")),o.length||(s.running=!1,this._notify(n,s,t,"complete"),s.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let s=e.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,s)),s}listen(t,e,s){this._getAnims(t).listeners[e].push(s)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((s,n)=>Math.max(s,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const s=e.items;let n=s.length-1;for(;n>=0;--n)s[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var kt=new ac;const Is="transparent",lc={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=ws(i||Is),n=s.valid&&ws(t||Is);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class cc{constructor(t,e,s,n){const o=e[s];n=We([t.to,n,o,t.from]);const r=We([t.from,o,n]);this._active=!0,this._fn=t.fn||lc[t.type||typeof r],this._easing=ke[t.easing]||ke.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=s,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,s){if(this._active){this._notify(!1);const n=this._target[this._prop],o=s-this._start,r=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=We([t.to,e,n,t.from]),this._from=We([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,s=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e<s),!this._active){this._target[n]=a,this._notify(!0);return}if(e<0){this._target[n]=o;return}l=e/s%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,s)=>{t.push({res:e,rej:s})})}_notify(t){const e=t?"res":"rej",s=this._promises||[];for(let n=0;n<s.length;n++)s[n][e]()}}class go{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!E(t))return;const e=Object.keys(U.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const o=t[n];if(!E(o))return;const r={};for(const a of e)r[a]=o[a];(G(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!s.has(a))&&s.set(a,r)})})}_animateOptions(t,e){const s=e.options,n=dc(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&hc(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,e){const s=this._properties,n=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[c];let d=o[c];const u=s.get(c);if(d)if(u&&d.active()){d.update(u,h,a);continue}else d.cancel();if(!u||!u.duration){t[c]=h;continue}o[c]=d=new cc(u,t,c,h),n.push(d)}return n}update(t,e){if(this._properties.size===0
|
2024-12-06 20:27:04 +08:00
|
|
|
|
`)>-1?i.split(`
|
2024-12-18 17:45:22 +08:00
|
|
|
|
`):i}function ud(i,t){const{element:e,datasetIndex:s,index:n}=t,o=i.getDatasetMeta(s).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:i,label:r,parsed:o.getParsed(n),raw:i.data.datasets[s].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:e}}function fn(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=Z(t.bodyFont),c=Z(t.titleFont),h=Z(t.footerFont),d=o.length,u=n.length,f=s.length,p=ut(t.padding);let m=p.height,b=0,_=s.reduce((P,v)=>P+v.before.length+v.lines.length+v.after.length,0);if(_+=i.beforeBody.length+i.afterBody.length,d&&(m+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),_){const P=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;m+=f*P+(_-f)*l.lineHeight+(_-1)*t.bodySpacing}u&&(m+=t.footerMarginTop+u*h.lineHeight+(u-1)*t.footerSpacing);let x=0;const S=function(P){b=Math.max(b,e.measureText(P).width+x)};return e.save(),e.font=c.string,z(i.title,S),e.font=l.string,z(i.beforeBody.concat(i.afterBody),S),x=t.displayColors?r+2+t.boxPadding:0,z(s,P=>{z(P.before,S),z(P.lines,S),z(P.after,S)}),x=0,e.font=h.string,z(i.footer,S),e.restore(),b+=p.width,{width:b,height:m}}function fd(i,t){const{y:e,height:s}=t;return e<s/2?"top":e>i.height-s/2?"bottom":"center"}function gd(i,t,e,s){const{x:n,width:o}=s,r=e.caretSize+e.caretPadding;if(i==="left"&&n+o+r>t.width||i==="right"&&n-o-r<0)return!0}function pd(i,t,e,s){const{x:n,width:o}=e,{width:r,chartArea:{left:a,right:l}}=i;let c="center";return s==="center"?c=n<=(a+l)/2?"left":"right":n<=o/2?c="left":n>=r-o/2&&(c="right"),gd(c,i,t,e)&&(c="center"),c}function gn(i,t,e){const s=e.yAlign||t.yAlign||fd(i,e);return{xAlign:e.xAlign||t.xAlign||pd(i,t,e,s),yAlign:s}}function md(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function bd(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function pn(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=se(r);let p=md(t,a);const m=bd(t,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(h,u)+n:a==="right"&&(p+=Math.max(d,f)+n),{x:nt(p,0,s.width-t.width),y:nt(m,0,s.height-t.height)}}function Je(i,t,e){const s=ut(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function mn(i){return _t([],Pt(i))}function _d(i,t,e){return qt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function bn(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const Ao={beforeTitle:wt,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,s=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex<s)return e[t.dataIndex]}return""},afterTitle:wt,beforeBody:wt,beforeLabel:wt,label(i){if(this&&this.options&&this.options.mode==="dataset")return i.label+": "+i.formattedValue||i.formattedValue;let t=i.dataset.label||"";t&&(t+=": ");const e=i.formattedValue;return W(e)||(t+=e),t},labelColor(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:wt,afterBody:wt,beforeFooter:wt,footer:wt,afterFooter:wt};function tt(i,t,e,s){const n=i[t].call(e,s);return typeof n>"u"?Ao[t].call(e,s):n}class _n extends Et{static positioners=ve;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afte
|
2024-12-06 20:27:04 +08:00
|
|
|
|
`:this.modelValue+`
|
|
|
|
|
`},scroll(){return this.height!="auto"}},methods:{updateValue(i){this.modelValue==null?this.content=i.target.value:this.$emit("update:modelValue",i.target.value)},changeLang(i){this.languageTitle=i[1]?i[1]:i[0],this.languageClass="language-"+i[0],this.$emit("lang",i[0])},tab(){if(document.execCommand("insertText"))document.execCommand("insertText",!1,this.tabWidth);else{const i=this.$refs.textarea.selectionStart;this.content=this.content.substring(0,i)+this.tabWidth+this.content.substring(i),this.cursorPosition=i+this.tabWidth.length,this.insertTab=!0}},calcScrollDistance(i){this.$refs.code.scrolling=!0,this.scrolling=!0,this.top=-i.target.scrollTop,this.left=-i.target.scrollLeft},resizer(){new ResizeObserver(e=>{this.scrollBarWidth=e[0].target.offsetWidth-e[0].target.clientWidth,this.scrollBarHeight=e[0].target.offsetHeight-e[0].target.clientHeight,this.textareaHeight=e[0].target.offsetHeight}).observe(this.$refs.textarea);const t=new ResizeObserver(e=>{this.lineNumsWidth=e[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 i=this.$refs.textarea.value;let t=0,e=i.indexOf(`
|
|
|
|
|
`);for(;e!==-1;)t++,e=i.indexOf(`
|
2024-12-18 17:45:22 +08:00
|
|
|
|
`,e+1);const s=this.$refs.lineNums.firstChild.offsetHeight,n=parseInt(this.textareaHeight/s)-1;this.lineNum=this.height=="auto"||t>n?t:n}},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())}},Uu=["theme"],Yu=["readOnly","autofocus","value"];function Ku(i,t,e,s,n,o){const r=$("Dropdown"),a=Zo("highlight");return M(),R("div",{theme:e.theme,class:ht(["code-editor",{"hide-header":!e.header,scroll:o.scroll,"read-only":e.readOnly,wrap:e.wrap}]),style:Ot({width:e.width,height:e.height,zIndex:e.zIndex,maxWidth:e.maxWidth,minWidth:e.minWidth,maxHeight:e.maxHeight,minHeight:e.minHeight})},[g("div",{class:"hljs",style:Ot({borderRadius:e.borderRadius})},[e.header?(M(),R("div",{key:0,class:ht(["header",{border:n.showLineNums}]),style:Ot({borderRadius:e.borderRadius+" "+e.borderRadius+" 0 0"})},[e.displayLanguage?(M(),N(r,{key:0,width:e.langListWidth,title:n.languageTitle,disabled:e.languages.length<=1,defaultDisplay:e.langListDisplay},null,8,["width","title","disabled","defaultDisplay"])):B("",!0)],6)):B("",!0),g("div",{class:"code-area",style:Ot({borderRadius:e.header?"0 0 "+e.borderRadius+" "+e.borderRadius:e.borderRadius})},[n.showLineNums?(M(),R("div",{key:0,ref:"lineNums",class:"line-nums hljs",style:Ot({fontSize:e.fontSize,paddingTop:e.header?"10px":e.padding,paddingBottom:e.padding,top:n.top+"px"})},[t[3]||(t[3]=g("div",null,"1",-1)),(M(!0),R(Xt,null,ii(n.lineNum,l=>(M(),R("div",null,F(l+1),1))),256)),t[4]||(t[4]=g("div",null," ",-1))],4)):B("",!0),g("textarea",{title:"textarea",readOnly:e.readOnly,style:Ot({fontSize:e.fontSize,padding:e.header?e.lineNums?"10px "+e.padding+" "+e.padding:"0 "+e.padding+" "+e.padding:e.padding,marginLeft:n.showLineNums?n.lineNumsWidth+"px":"0",width:n.showLineNums?"calc(100% - "+n.lineNumsWidth+"px)":"100%"}),ref:"textarea",autofocus:e.autofocus,spellcheck:"false",onKeydown:t[0]||(t[0]=tr(er((...l)=>o.tab&&o.tab(...l),["prevent","stop"]),["tab"])),onScroll:t[1]||(t[1]=(...l)=>o.calcScrollDistance&&o.calcScrollDistance(...l)),value:e.modelValue==null?n.content:e.modelValue,onInput:t[2]||(t[2]=(...l)=>o.updateValue&&o.updateValue(...l))},null,44,Yu),g("pre",{style:Ot({paddingRight:n.scrollBarWidth+"px",paddingBottom:n.scrollBarHeight+"px",marginLeft:n.showLineNums?n.lineNumsWidth+"px":"0",width:n.showLineNums?"calc(100% - "+n.lineNumsWidth+"px)":"100%"})},[t[6]||(t[6]=pt(" ")),Ui((M(),R("code",{ref:"code",class:ht(n.languageClass),style:Ot({top:n.top+"px",left:n.left+"px",fontSize:e.fontSize,padding:e.header?e.lineNums?"10px "+e.padding+" "+e.padding:"0 "+e.padding+" "+e.padding:e.padding})},t[5]||(t[5]=[pt(`
|
2024-12-06 20:27:04 +08:00
|
|
|
|
`)]),6)),[[a,o.contentValue]]),t[7]||(t[7]=pt(`
|
2024-12-18 17:45:22 +08:00
|
|
|
|
`))],4)],4)],4)],14,Uu)}const Xu=Dt(ju,[["render",Ku]]),Gu={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll"},Ju={class:"container d-flex h-100 w-100"},qu={class:"m-auto modal-dialog-centered dashboardModal",style:{width:"1000px"}},Qu={class:"card rounded-3 shadow flex-grow-1",id:"deleteConfigurationContainer"},Zu={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-0"},tf={class:"mb-0"},ef={class:"card-body px-4 d-flex flex-column gap-3"},sf={class:"alert alert-warning rounded-3 mb-0"},nf={key:0,class:"alert alert-danger rounded-3 mb-0"},of={class:"mb-2"},rf={class:"bg-body w-100 p-2 rounded-3"},af={class:"d-flex gap-2"},lf=["disabled"],cf=["disabled"],hf={__name:"editRawConfigurationFile",emits:["close"],async setup(i,{emit:t}){let e,s;const n=t,o=sr(),r=st(""),a=st(""),l=st(!1),c=st(""),h=async()=>{await oe("/api/getWireguardConfigurationRawFile",{configurationName:o.params.id},p=>{r.value=p.data.content,a.value=p.data.path})};[e,s]=ir(()=>h()),await e,s();const d=hi(),u=st(!1),f=async()=>{u.value=!0,await ie("/api/updateWireguardConfigurationRawFile",{configurationName:o.params.id,rawConfiguration:r.value},p=>{p.status?(l.value=!1,d.newMessage("Server","Configuration saved","success")):(l.value=!0,c.value=p.message),u.value=!1})};return(p,m)=>(M(),R("div",Gu,[g("div",Ju,[g("div",qu,[g("div",Qu,[g("div",Zu,[g("h5",tf,[C(ft,{t:"Edit Raw Configuration File"})]),g("button",{type:"button",class:"btn-close ms-auto",onClick:m[0]||(m[0]=b=>n("close"))})]),g("div",ef,[g("div",sf,[m[4]||(m[4]=g("i",{class:"bi-exclamation-triangle-fill me-2"},null,-1)),C(ft,{t:"Please be careful when editing the raw file"})]),l.value?(M(),R("div",nf,[g("div",of,[g("strong",null,[C(ft,{t:"Failed to save configuration. Please see the following error message:"})])]),g("div",rf,[g("pre",null,F(c.value),1)])])):B("",!0),C(Xu,{disabled:!0,"read-only":u.value,modelValue:r.value,"onUpdate:modelValue":m[1]||(m[1]=b=>r.value=b),theme:Rn(d).Configuration.Server.dashboard_theme==="dark"?"github-dark":"github",languages:[["ini",a.value]],width:"100%",height:"600px"},null,8,["read-only","modelValue","theme","languages"]),g("div",af,[g("button",{class:"btn bg-secondary-subtle border-secondary-subtle text-secondary-emphasis rounded-3 shadow ms-auto px-3 py-2",disabled:u.value,onClick:m[2]||(m[2]=b=>h())},[m[5]||(m[5]=g("i",{class:"bi bi-arrow-clockwise me-2"},null,-1)),C(ft,{t:"Reset"})],8,lf),g("button",{onClick:m[3]||(m[3]=b=>f()),disabled:u.value,class:"btn bg-danger-subtle border-danger-subtle text-danger-emphasis rounded-3 px-3 py-2 shadow"},[m[6]||(m[6]=g("i",{class:"bi bi-save-fill me-2"},null,-1)),u.value?(M(),N(ft,{key:1,t:"Saving..."})):(M(),N(ft,{key:0,t:"Save"}))],8,cf)])])])])])]))}},df={class:"text-center"},uf={key:0,class:"text-muted"},ff={__name:"peerIntersectionObserver",props:["peerListLength","showPeersCount"],emits:["loadMore"],setup(i,{emit:t}){const e=st(void 0),s=t;return ji(()=>{e.value=new IntersectionObserver(n=>{n.forEach(o=>{o.isIntersecting&&s("loadMore")})},{rootMargin:"20px",threshold:1}),e.value.observe(document.querySelector("#loadMore"))}),nr(()=>{e.value.disconnect()}),(n,o)=>(M(),R("div",df,[i.peerListLength<i.showPeersCount?(M(),R("small",uf," That's it, no more peers ")):B("",!0),o[0]||(o[0]=g("div",{style:{"margin-bottom":"20px",height:"1px"},id:"loadMore"},null,-1))]))}};ui.register(Jh,sd,bo,_o,Md,cd,dd,xd,wd,qh);const gf={name:"peerList",components:{PeerIntersectionObserver:ff,EditRawConfigurationFile:hf,ProtocolBadge:ar,PeerSearchBar:$u,PeerRow:Tu,DeleteConfiguration:rt(()=>at(()=>import("./deleteConfiguration-gjCTyT4T.js"),__vite__mapDeps([0,1,2,3]))),ConfigurationBackupRestore:rt(()=>at(()=>import("./configurationBackupRestore-Dea4yoLF.js"),__vite__mapDeps([4,1,2,5,3,6]))),SelectPeers:rt(()=>at(()=>import("./selectPeers-C_VG2AGk.js"),__vite__mapDeps([7,1,2,3,8]))),EditConfiguration:rt(()=>at(()=>import("./editConfiguration-BbKPgegf.js"),__vite__mapDeps([9,1,2,3,10]))),LocaleText:ft,PeerShareLinkModal:rt(()=>at(()=>import("./peerShareLinkMo
|