(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(s){if(s.ep)return;s.ep=!0;const l=n(s);fetch(s.href,l)}})();const He=!1,qe=(e,t)=>e===t,L=Symbol("solid-proxy"),he=Symbol("solid-track"),Q={equals:qe};let Ae=Ee;const N=1,Y=2,ke={owned:null,cleanups:null,context:null,owner:null};var m=null;let fe=null,Ge=null,b=null,v=null,E=null,ie=0;function z(e,t){const n=b,r=m,s=e.length===0,l=t===void 0?r:t,i=s?ke:{owned:null,cleanups:null,context:l?l.context:null,owner:l},o=s?e:()=>e(()=>C(()=>H(i)));m=i,b=null;try{return V(o,!0)}finally{b=n,m=r}}function k(e,t){t=t?Object.assign({},Q,t):Q;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},r=s=>(typeof s=="function"&&(s=s(n.value)),Oe(n,s));return[xe.bind(n),r]}function _(e,t,n){const r=$e(e,t,!1,N);J(r)}function oe(e,t,n){Ae=et;const r=$e(e,t,!1,N);r.user=!0,E?E.push(r):J(r)}function I(e,t,n){n=n?Object.assign({},Q,n):Q;const r=$e(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,J(r),xe.bind(r)}function Je(e){return V(e,!1)}function C(e){if(b===null)return e();const t=b;b=null;try{return e()}finally{b=t}}function Xe(e,t,n){const r=Array.isArray(e);let s,l=n&&n.defer;return i=>{let o;if(r){o=Array(e.length);for(let f=0;ft(o,s,i));return s=o,a}}function ze(e){oe(()=>C(e))}function Qe(e){return m===null||(m.cleanups===null?m.cleanups=[e]:m.cleanups.push(e)),e}function ge(){return b}function xe(){if(this.sources&&this.state)if(this.state===N)J(this);else{const e=v;v=null,V(()=>ee(this),!1),v=e}if(b){const e=this.observers?this.observers.length:0;b.sources?(b.sources.push(this),b.sourceSlots.push(e)):(b.sources=[this],b.sourceSlots=[e]),this.observers?(this.observers.push(b),this.observerSlots.push(b.sources.length-1)):(this.observers=[b],this.observerSlots=[b.sources.length-1])}return this.value}function Oe(e,t,n){let r=e.value;return(!e.comparator||!e.comparator(r,t))&&(e.value=t,e.observers&&e.observers.length&&V(()=>{for(let s=0;s1e6)throw v=[],new Error},!1)),t}function J(e){if(!e.fn)return;H(e);const t=ie;Ye(e,e.value,t)}function Ye(e,t,n){let r;const s=m,l=b;b=m=e;try{r=e.fn(t)}catch(i){return e.pure&&(e.state=N,e.owned&&e.owned.forEach(H),e.owned=null),e.updatedAt=n+1,Ne(i)}finally{b=l,m=s}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?Oe(e,r):e.value=r,e.updatedAt=n)}function $e(e,t,n,r=N,s){const l={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:m,context:m?m.context:null,pure:n};return m===null||m!==ke&&(m.owned?m.owned.push(l):m.owned=[l]),l}function Z(e){if(e.state===0)return;if(e.state===Y)return ee(e);if(e.suspense&&C(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt=0;n--)if(e=t[n],e.state===N)J(e);else if(e.state===Y){const r=v;v=null,V(()=>ee(e,t[0]),!1),v=r}}function V(e,t){if(v)return e();let n=!1;t||(v=[]),E?n=!0:E=[],ie++;try{const r=e();return Ze(n),r}catch(r){n||(E=null),v=null,Ne(r)}}function Ze(e){if(v&&(Ee(v),v=null),e)return;const t=E;E=null,t.length&&V(()=>Ae(t),!1)}function Ee(e){for(let t=0;t=0;t--)H(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)H(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function tt(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function Ne(e,t=m){throw tt(e)}const nt=Symbol("fallback");function ye(e){for(let t=0;t1?[]:null;return Qe(()=>ye(l)),()=>{let a=e()||[],f=a.length,u,c;return a[he],C(()=>{let p,y,w,P,T,S,A,x,D;if(f===0)i!==0&&(ye(l),l=[],r=[],s=[],i=0,o&&(o=[])),n.fallback&&(r=[nt],s[0]=z(Ke=>(l[0]=Ke,n.fallback())),i=1);else if(i===0){for(s=new Array(f),c=0;c=S&&x>=S&&r[A]===a[x];A--,x--)w[x]=s[A],P[x]=l[A],o&&(T[x]=o[A]);for(p=new Map,y=new Array(x+1),c=x;c>=S;c--)D=a[c],u=p.get(D),y[c]=u===void 0?-1:u,p.set(D,c);for(u=S;u<=A;u++)D=r[u],c=p.get(D),c!==void 0&&c!==-1?(w[c]=s[u],P[c]=l[u],o&&(T[c]=o[u]),c=y[c],p.set(D,c)):l[u]();for(c=S;ce(t||{}))}const st=e=>`Stale read from <${e}>.`;function q(e){const t="fallback"in e&&{fallback:()=>e.fallback};return I(rt(()=>e.each,e.children,t||void 0))}function ve(e){const t=e.keyed,n=I(()=>e.when,void 0,void 0),r=t?n:I(n,void 0,{equals:(s,l)=>!s==!l});return I(()=>{const s=r();if(s){const l=e.children;return typeof l=="function"&&l.length>0?C(()=>l(t?s:()=>{if(!C(r))throw st("Show");return n()})):l}return e.fallback},void 0,void 0)}const j=e=>I(()=>e());function lt(e,t,n){let r=n.length,s=t.length,l=r,i=0,o=0,a=t[s-1].nextSibling,f=null;for(;iu-o){const y=t[i];for(;o{s=l,t===document?e():d(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{s(),t.textContent=""}}function g(e,t,n,r){let s;const l=()=>{const o=document.createElement("template");return o.innerHTML=e,o.content.firstChild},i=()=>(s||(s=l())).cloneNode(!0);return i.cloneNode=i,i}function Pe(e,t=window.document){const n=t[we]||(t[we]=new Set);for(let r=0,s=e.length;re(t,n))}function d(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return te(e,t,r,n);_(s=>te(e,t(),s,n),r)}function at(e){let t=e.target;const n=`$$${e.type}`,r=e.target,s=e.currentTarget,l=a=>Object.defineProperty(e,"target",{configurable:!0,value:a}),i=()=>{const a=t[n];if(a&&!t.disabled){const f=t[`${n}Data`];if(f!==void 0?a.call(t,f,e):a.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&l(t.host),!0},o=()=>{for(;i()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),e.composedPath){const a=e.composedPath();l(a[0]);for(let f=0;f{let o=t();for(;typeof o=="function";)o=o();n=te(e,o,n,r)}),()=>n;if(Array.isArray(t)){const o=[],a=n&&Array.isArray(n);if(pe(o,t,n,s))return _(()=>n=te(e,o,n,r,!0)),()=>n;if(o.length===0){if(n=B(e,n,r),i)return n}else a?n.length===0?_e(e,o,r):lt(e,n,o):(n&&B(e),_e(e,o));n=o}else if(t.nodeType){if(Array.isArray(n)){if(i)return n=B(e,n,r,t);B(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function pe(e,t,n,r){let s=!1;for(let l=0,i=t.length;l=0;i--){const o=t[i];if(s!==o){const a=o.parentNode===e;!l&&!i?a?e.replaceChild(s,o):e.insertBefore(s,n):a&&o.remove()}else l=!0}}else e.insertBefore(s,n);return[s]}async function je(e){const t=await fetch(e,{credentials:"same-origin"});if(!t.ok)throw new Error(`${e}: ${t.status} ${t.statusText}`);return await t.json()}function Le(){return je("/view/api/state")}function ct(){return je("/view/api/version")}const ne=Symbol("store-raw"),F=Symbol("store-node"),O=Symbol("store-has"),De=Symbol("store-self");function Be(e){let t=e[L];if(!t&&(Object.defineProperty(e,L,{value:t=new Proxy(e,dt)}),!Array.isArray(e))){const n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e);for(let s=0,l=n.length;se[L][t]),n}function Ie(e){ge()&&G(re(e,F),De)()}function ut(e){return Ie(e),Reflect.ownKeys(e)}const dt={get(e,t,n){if(t===ne)return e;if(t===L)return n;if(t===he)return Ie(e),n;const r=re(e,F),s=r[t];let l=s?s():e[t];if(t===F||t===O||t==="__proto__")return l;if(!s){const i=Object.getOwnPropertyDescriptor(e,t);ge()&&(typeof l!="function"||e.hasOwnProperty(t))&&!(i&&i.get)&&(l=G(r,t,l)())}return R(l)?Be(l):l},has(e,t){return t===ne||t===L||t===he||t===F||t===O||t==="__proto__"?!0:(ge()&&G(re(e,O),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:ut,getOwnPropertyDescriptor:ft};function W(e,t,n,r=!1){if(!r&&e[t]===n)return;const s=e[t],l=e.length;n===void 0?(delete e[t],e[O]&&e[O][t]&&s!==void 0&&e[O][t].$()):(e[t]=n,e[O]&&e[O][t]&&s===void 0&&e[O][t].$());let i=re(e,F),o;if((o=G(i,t,s))&&o.$(()=>n),Array.isArray(e)&&e.length!==l){for(let a=e.length;a1){r=t.shift();const i=typeof r,o=Array.isArray(e);if(Array.isArray(r)){for(let a=0;a1){K(e[r],t,[r].concat(n));return}s=e[r],n=[r].concat(n)}let l=t[0];typeof l=="function"&&(l=l(s,n),l===s)||r===void 0&&l==null||(l=U(l),r===void 0||R(s)&&R(l)&&!Array.isArray(l)?Me(s,l):W(e,r,l))}function gt(...[e,t]){const n=U(e||{}),r=Array.isArray(n),s=Be(n);function l(...i){Je(()=>{r&&i.length===1?ht(n,i[0]):K(n,i)})}return[s,l]}const se=new WeakMap,Fe={get(e,t){if(t===ne)return e;const n=e[t];let r;return R(n)?se.get(n)||(se.set(n,r=new Proxy(n,Fe)),r):n},set(e,t,n){return W(e,t,U(n)),!0},deleteProperty(e,t){return W(e,t,void 0,!0),!0}};function me(e){return t=>{if(R(t)){let n;(n=se.get(t))||se.set(t,n=new Proxy(t,Fe)),e(n)}return t}}const[le,ae]=gt({byName:{}});function Re(e){const t={};for(const n of e)t[n.maglevd.name]=n;ae({byName:t})}function pt(e,t){ae(me(n=>{const r=n.byName[e];if(!r)return;const s=r.backends.find(l=>l.name===t.backend);s&&(s.state=t.transition.to,s.last_transition=t.transition,s.transitions||(s.transitions=[]),s.transitions.push(t.transition),s.transitions.length>20&&(s.transitions=s.transitions.slice(s.transitions.length-20)))}))}function bt(e,t){ae(me(n=>{const r=n.byName[e];r&&(r.maglevd.connected=t.connected,r.maglevd.last_error=t.last_error)}))}function ue(e,t,n){ae(me(r=>{const s=r.byName[e];if(!s)return;const l=s.backends.find(i=>i.address===t);if(l)for(const i of s.frontends)for(const o of i.pools)for(const a of o.backends)a.name===l.name&&(a.effective_weight=n)}))}function $t(e){if(!e||!e.at_unix_ns||e.at_unix_ns<=0)return"";const t=Date.now()-e.at_unix_ns/1e6,n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const s=Math.floor(r/60);return s<48?`${s}h ago`:`${Math.floor(s/24)}d ago`}const Se=500,[be,mt]=k([]);function yt(e){mt(t=>{const n=[...t,e];return n.length>Se?n.slice(n.length-Se):n})}function vt(){const e=new EventSource("/view/api/events");return e.onmessage=t=>{try{const n=JSON.parse(t.data);wt(n)}catch(n){console.error("sse parse error",n,t.data)}},e.addEventListener("resync",async()=>{try{const t=await Le();Re(t)}catch(t){console.error("resync refetch failed",t)}}),e.onerror=t=>{console.debug("sse error, browser will reconnect",t)},e}function wt(e){switch(yt(e),e.type){case"backend":pt(e.maglevd,e.payload);break;case"frontend":e.maglevd,e.payload;break;case"maglevd-status":bt(e.maglevd,e.payload);break;case"log":_t(e.maglevd,e.payload);break}}function _t(e,t){if(!t.msg.startsWith("vpp-lb-sync-as-"))return;const n=t.attrs??{},r=n.address;if(r)switch(t.msg){case"vpp-lb-sync-as-added":ue(e,r,Number(n.weight??0));break;case"vpp-lb-sync-as-removed":ue(e,r,0);break;case"vpp-lb-sync-as-weight-updated":ue(e,r,Number(n.to??0));break}}const[ce,Ue]=k(void 0);var St=g("