This session covers three distinct arcs: correctness bug fixes in the
VPP sync path and frontend reducers, new config validation, and a
large polish pass on the web frontend (tighter layout, backend kebab
dialogs, live grouped-table, live config-reload re-sync).
- encap for a VIP is now derived from the backend address family,
not the VIP's. A v6 VIP with v4 backends is programmed as IP6_GRE4
(not the buggy IP6_GRE6), matching the VPP LB plugin's
requirement that encap reflects the tunnel inner family. desiredVIP
gained an Encap field populated in desiredFromFrontend.
- ActivePoolIndex now requires at least one backend in a pool to be
BOTH in StateUp AND pb.Weight>0 before the pool counts as active.
Previously a primary pool with every backend manually zeroed would
still win over a fallback with weight=100, so fallback traffic
never materialized. New TestActivePoolIndexWeightedFailover table
pins the rule in five subcases.
- SyncLBStateVIP gained a flushAddress parameter threaded through
reconcileVIP; it forces flush=true on the setASWeight call for a
specific backend regardless of the usual 0→N heuristic. Wires up
the explicit [flush] knob the CLI exposes.
- convertFrontend already enforced that backends within one frontend
share a family. New cross-frontend pass validateVIPFamilyConsistency
rejects configs where two frontends share a VIP address but carry
backends in different families — VPP's LB plugin requires every
VIP on a prefix to have the same encap type, so such a config
would fail at lb_add_del_vip_v2 time with VNET_API_ERROR_INVALID
_ARGUMENT (-73). Catching it at config load turns a silent
runtime failure into a clear startup error.
- Two new TestValidationErrors cases pin the behavior: mismatched
families reject, same-family frontends on one VIP address allowed.
- Proto adds `bool flush = 5` to SetWeightRequest. The RPC now
drives a VIP sync immediately after mutating config (fixing the
latent "weight change only takes effect at the next 30s periodic
reconcile" gap), passing flushAddress = backend IP when req.Flush
is true.
- maglevc grows an optional [flush] token: `set frontend F pool P
backend B weight N [flush]`. Implementation uses two Run closures
(runSetFrontendPoolBackendWeight and -Flush) because the tree
walker only puts slot tokens in args — literal keywords like
`flush` advance the node but don't appear in the arg list.
- docs/user-guide.md updated with the [flush] optional and a
three-paragraph explainer of the graceful-drain vs. flush
semantics at the VPP level.
- checker.ListFrontends now sorts alphabetically to match the
existing sort in ListBackends / ListHealthChecks — RPC responses
no longer shuffle VIPs per call. cmd/frontend/client.go also
sorts defensively in refreshAll so an old maglevd build renders
alphabetically too.
- backendFromProto was returning out.Transitions[n-1] as the
LastTransition, but maglevd stores (and the proto carries)
transitions newest-first, so [n-1] was actually the oldest.
Reverse on read, which normalizes the client's Transitions slice
to oldest-first and makes [n-1] genuinely the newest. LastTransition
now points at the actual latest transition record.
- applyBackendTransition (Go and TS) derives Enabled = state!="disabled"
so the two fields stay in lockstep — closed a drift window where
a recently re-enabled backend still rendered with a stuck
[disabled] tag. The tag was later removed entirely since state
and enabled carry the same information.
- Layout tightened substantially: "FRONTENDS" panel header removed,
zippy-summary and zippy-body paddings cut, backend-table row
padding dropped to 2px, per-pool <h3> removed. Pools now live in
a single consolidated table per frontend with a dedicated "pool"
column that shows the pool name only on the first row of each
group — classic grouped-table layout, maximally dense.
- Description moved inline into the Zippy summary as muted italic
text, freeing a vertical line per frontend card.
- formatVIPAddress() helper renders IPv6 VIPs as [addr]:port and
IPv4 as addr:port, matching RFC 3986 authority syntax.
- Pools with effective_weight=0 on every backend (standby
fallbacks, fully-drained primaries) render at opacity 0.35 on
their non-actions cells; the kebab column stays at full contrast
because its menu is still fully functional on standby backends.
- Config-reload propagation: a maglevd config-reload-done log
event triggers triggerConfigResync() on the frontend side —
refreshAll() runs off the event-dispatch goroutine, then a
BrowserEvent{Type:"resync"} is published through the broker.
writeEvent emits type="resync" as a named SSE frame so the
SPA's existing addEventListener("resync") handler picks it up
and calls fetchAllState → replaceAll.
- recomputeEffectiveWeights in stores/state.ts mirrors the
server-side health.EffectiveWeights logic so the SPA keeps
pool.effective_weight correct the moment a backend transitions,
without waiting for the 30s refresh. Fixed a nasty bug where
applyBackendEffectiveWeight wrote VIP-scoped vpp-lb-sync-as-*
event weights into every frontend sharing the backend,
corrupting frontends with different per-pool configured weights.
The old log-event reducer was removed; applyConfiguredWeight is
the narrower replacement used by the kebab set-weight flow.
- applyBackendTransition calls recomputeEffectiveWeights after
state updates so pool-failover transitions (primary ⇌ fallback)
reflect instantly in the UI.
- Confirmation dialogs via a new Modal primitive
(Portal-mounted to document.body, escape/click-outside close,
click-outside debounced on mousedown so mid-row-text-selection
drags don't dismiss).
- pause/resume/enable/disable each show a Modal with a consequence
paragraph explaining what hits live traffic ("will keep existing
flows", "will flush VPP's flow table", etc.). The disable commit
button is styled btn-danger red.
- set-weight action shows a Modal with a range slider (0-100,
seeded from the current configured weight, accent-colored live
numeric readout via <output>) plus a flush checkbox and a live-
swapping note/warn paragraph describing what will happen. On
commit, the SPA also updates its local store via
applyConfiguredWeight so the operator sees the new weight
immediately without waiting for the next refresh.
- ProbeHeartbeat is now state-aware: ▶ (play) at rest for up/
down/unknown backends, ⏸ (pause) for paused, ⏹ (stop) for
disabled/removed, ❤️ (heart) during an in-flight probe.
- Drop the probe-done event listener — fast probes (<10ms)
could fire probe-done in the same render tick as probe-start
and the heart would never visibly paint. Each probe-start now
runs a fixed 400ms scale-pop animation on a timer; subsequent
probe-start events reset the timer, so fast cadences produce a
continuous heart pulse.
- Fixed wrapper box (16x14 px, overflow hidden) so the row
doesn't jiggle when the glyph swaps between the narrow ▶/⏸/⏹
text glyphs and the wider ❤️ emoji.
- Brand wordmark changed from "maglev" to "vpp-maglev" and wrapped
in an <a> linking to https://git.ipng.ch/ipng/vpp-maglev. Logo
link changed to https://ipng.ch/. Both open in a new tab with
rel="noopener".
- .gitignore fix: `frontend`, `maglevc`, `maglevd` were matching
ANY file or directory with those names anywhere in the tree,
silently ignoring cmd/frontend and friends. Anchored with
leading slashes so only repo-root build artifacts match.
2 lines
35 KiB
JavaScript
2 lines
35 KiB
JavaScript
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const l of r)if(l.type==="childList")for(const i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const l={};return r.integrity&&(l.integrity=r.integrity),r.referrerPolicy&&(l.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?l.credentials="include":r.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(r){if(r.ep)return;r.ep=!0;const l=n(r);fetch(r.href,l)}})();const at=!1,ct=(e,t)=>e===t,F=Symbol("solid-proxy"),xe=Symbol("solid-track"),ue={equals:ct};let Ve=Ge;const U=1,fe=2,We={owned:null,cleanups:null,context:null,owner:null};var v=null;let ke=null,ut=null,p=null,E=null,D=null,we=0;function ne(e,t){const n=p,s=v,r=e.length===0,l=t===void 0?s:t,i=r?We:{owned:null,cleanups:null,context:l?l.context:null,owner:l},o=r?e:()=>e(()=>M(()=>se(i)));v=i,p=null;try{return G(o,!0)}finally{p=n,v=s}}function x(e,t){t=t?Object.assign({},ue,t):ue;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},s=r=>(typeof r=="function"&&(r=r(n.value)),He(n,r));return[Fe.bind(n),s]}function C(e,t,n){const s=Pe(e,t,!1,U);ie(s)}function H(e,t,n){Ve=pt;const s=Pe(e,t,!1,U);(!n||!n.render)&&(s.user=!0),D?D.push(s):ie(s)}function W(e,t,n){n=n?Object.assign({},ue,n):ue;const s=Pe(e,t,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=n.equals||void 0,ie(s),Fe.bind(s)}function ft(e){return G(e,!1)}function M(e){if(p===null)return e();const t=p;p=null;try{return e()}finally{p=t}}function dt(e,t,n){const s=Array.isArray(e);let r,l=n&&n.defer;return i=>{let o;if(s){o=Array(e.length);for(let u=0;u<e.length;u++)o[u]=e[u]()}else o=e();if(l)return l=!1,i;const a=M(()=>t(o,r,i));return r=o,a}}function gt(e){H(()=>M(e))}function Y(e){return v===null||(v.cleanups===null?v.cleanups=[e]:v.cleanups.push(e)),e}function Ae(){return p}function ht(){return v}function bt(e,t){const n=v,s=p;v=e,p=null;try{return G(t,!0)}catch(r){Oe(r)}finally{v=n,p=s}}function Fe(){if(this.sources&&this.state)if(this.state===U)ie(this);else{const e=E;E=null,G(()=>ge(this),!1),E=e}if(p){const e=this.observers?this.observers.length:0;p.sources?(p.sources.push(this),p.sourceSlots.push(e)):(p.sources=[this],p.sourceSlots=[e]),this.observers?(this.observers.push(p),this.observerSlots.push(p.sources.length-1)):(this.observers=[p],this.observerSlots=[p.sources.length-1])}return this.value}function He(e,t,n){let s=e.value;return(!e.comparator||!e.comparator(s,t))&&(e.value=t,e.observers&&e.observers.length&&G(()=>{for(let r=0;r<e.observers.length;r+=1){const l=e.observers[r],i=ke&&ke.running;i&&ke.disposed.has(l),(i?!l.tState:!l.state)&&(l.pure?E.push(l):D.push(l),l.observers&&Ke(l)),i||(l.state=U)}if(E.length>1e6)throw E=[],new Error},!1)),t}function ie(e){if(!e.fn)return;se(e);const t=we;mt(e,e.value,t)}function mt(e,t,n){let s;const r=v,l=p;p=v=e;try{s=e.fn(t)}catch(i){return e.pure&&(e.state=U,e.owned&&e.owned.forEach(se),e.owned=null),e.updatedAt=n+1,Oe(i)}finally{p=l,v=r}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?He(e,s):e.value=s,e.updatedAt=n)}function Pe(e,t,n,s=U,r){const l={fn:e,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:v,context:v?v.context:null,pure:n};return v===null||v!==We&&(v.owned?v.owned.push(l):v.owned=[l]),l}function de(e){if(e.state===0)return;if(e.state===fe)return ge(e);if(e.suspense&&M(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<we);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===U)ie(e);else if(e.state===fe){const s=E;E=null,G(()=>ge(e,t[0]),!1),E=s}}function G(e,t){if(E)return e();let n=!1;t||(E=[]),D?n=!0:D=[],we++;try{const s=e();return $t(n),s}catch(s){n||(D=null),E=null,Oe(s)}}function $t(e){if(E&&(Ge(E),E=null),e)return;const t=D;D=null,t.length&&G(()=>Ve(t),!1)}function Ge(e){for(let t=0;t<e.length;t++)de(e[t])}function pt(e){let t,n=0;for(t=0;t<e.length;t++){const s=e[t];s.user?e[n++]=s:de(s)}for(t=0;t<n;t++)de(e[t])}function ge(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const s=e.sources[n];if(s.sources){const r=s.state;r===U?s!==t&&(!s.updatedAt||s.updatedAt<we)&&de(s):r===fe&&ge(s,t)}}}function Ke(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=fe,n.pure?E.push(n):D.push(n),n.observers&&Ke(n))}}function se(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),s=e.sourceSlots.pop(),r=n.observers;if(r&&r.length){const l=r.pop(),i=n.observerSlots.pop();s<r.length&&(l.sourceSlots[i]=s,r[s]=l,n.observerSlots[s]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)se(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)se(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 wt(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function Oe(e,t=v){throw wt(e)}const vt=Symbol("fallback");function De(e){for(let t=0;t<e.length;t++)e[t]()}function yt(e,t,n={}){let s=[],r=[],l=[],i=0,o=t.length>1?[]:null;return Y(()=>De(l)),()=>{let a=e()||[],u=a.length,f,c;return a[xe],M(()=>{let b,y,k,P,B,m,w,_,A;if(u===0)i!==0&&(De(l),l=[],s=[],r=[],i=0,o&&(o=[])),n.fallback&&(s=[vt],r[0]=ne(S=>(l[0]=S,n.fallback())),i=1);else if(i===0){for(r=new Array(u),c=0;c<u;c++)s[c]=a[c],r[c]=ne($);i=u}else{for(k=new Array(u),P=new Array(u),o&&(B=new Array(u)),m=0,w=Math.min(i,u);m<w&&s[m]===a[m];m++);for(w=i-1,_=u-1;w>=m&&_>=m&&s[w]===a[_];w--,_--)k[_]=r[w],P[_]=l[w],o&&(B[_]=o[w]);for(b=new Map,y=new Array(_+1),c=_;c>=m;c--)A=a[c],f=b.get(A),y[c]=f===void 0?-1:f,b.set(A,c);for(f=m;f<=w;f++)A=s[f],c=b.get(A),c!==void 0&&c!==-1?(k[c]=r[f],P[c]=l[f],o&&(B[c]=o[f]),c=y[c],b.set(A,c)):l[f]();for(c=m;c<u;c++)c in k?(r[c]=k[c],l[c]=P[c],o&&(o[c]=B[c],o[c](c))):r[c]=ne($);r=r.slice(0,i=u),s=a.slice(0)}return r});function $(b){if(l[c]=b,o){const[y,k]=x(c);return o[c]=k,t(a[c],y)}return t(a[c])}}}function g(e,t){return M(()=>e(t||{}))}const _t=e=>`Stale read from <${e}>.`;function J(e){const t="fallback"in e&&{fallback:()=>e.fallback};return W(yt(()=>e.each,e.children,t||void 0))}function O(e){const t=e.keyed,n=W(()=>e.when,void 0,void 0),s=t?n:W(n,void 0,{equals:(r,l)=>!r==!l});return W(()=>{const r=s();if(r){const l=e.children;return typeof l=="function"&&l.length>0?M(()=>l(t?r:()=>{if(!M(s))throw _t("Show");return n()})):l}return e.fallback},void 0,void 0)}const L=e=>W(()=>e());function St(e,t,n){let s=n.length,r=t.length,l=s,i=0,o=0,a=t[r-1].nextSibling,u=null;for(;i<r||o<l;){if(t[i]===n[o]){i++,o++;continue}for(;t[r-1]===n[l-1];)r--,l--;if(r===i){const f=l<s?o?n[o-1].nextSibling:n[l-o]:a;for(;o<l;)e.insertBefore(n[o++],f)}else if(l===o)for(;i<r;)(!u||!u.has(t[i]))&&t[i].remove(),i++;else if(t[i]===n[l-1]&&n[o]===t[r-1]){const f=t[--r].nextSibling;e.insertBefore(n[o++],t[i++].nextSibling),e.insertBefore(n[--l],f),t[r]=n[l]}else{if(!u){u=new Map;let c=o;for(;c<l;)u.set(n[c],c++)}const f=u.get(t[i]);if(f!=null)if(o<f&&f<l){let c=i,$=1,b;for(;++c<r&&c<l&&!((b=u.get(t[c]))==null||b!==f+$);)$++;if($>f-o){const y=t[i];for(;o<f;)e.insertBefore(n[o++],y)}else e.replaceChild(n[o++],t[i++])}else i++;else t[i++].remove()}}}const Me="_$DX_DELEGATE";function kt(e,t,n,s={}){let r;return ne(l=>{r=l,t===document?e():d(t,e(),t.firstChild?null:void 0,n)},s.owner),()=>{r(),t.textContent=""}}function h(e,t,n,s){let r;const l=()=>{const o=document.createElement("template");return o.innerHTML=e,o.content.firstChild},i=()=>(r||(r=l())).cloneNode(!0);return i.cloneNode=i,i}function ve(e,t=window.document){const n=t[Me]||(t[Me]=new Set);for(let s=0,r=e.length;s<r;s++){const l=e[s];n.has(l)||(n.add(l),t.addEventListener(l,Ct))}}function N(e,t,n){n==null?e.removeAttribute(t):e.setAttribute(t,n)}function xt(e,t){t==null?e.removeAttribute("class"):e.className=t}function At(e,t,n,s){Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n}function ye(e,t,n){return M(()=>e(t,n))}function d(e,t,n,s){if(n!==void 0&&!s&&(s=[]),typeof t!="function")return he(e,t,s,n);C(r=>he(e,t(),r,n),s)}function Ct(e){let t=e.target;const n=`$$${e.type}`,s=e.target,r=e.currentTarget,l=a=>Object.defineProperty(e,"target",{configurable:!0,value:a}),i=()=>{const a=t[n];if(a&&!t.disabled){const u=t[`${n}Data`];if(u!==void 0?a.call(t,u,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 u=0;u<a.length-2&&(t=a[u],!!i());u++){if(t._$host){t=t._$host,o();break}if(t.parentNode===r)break}}else o();l(s)}function he(e,t,n,s,r){for(;typeof n=="function";)n=n();if(t===n)return n;const l=typeof t,i=s!==void 0;if(e=i&&n[0]&&n[0].parentNode||e,l==="string"||l==="number"){if(l==="number"&&(t=t.toString(),t===n))return n;if(i){let o=n[0];o&&o.nodeType===3?o.data!==t&&(o.data=t):o=document.createTextNode(t),n=K(e,n,s,o)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||l==="boolean")n=K(e,n,s);else{if(l==="function")return C(()=>{let o=t();for(;typeof o=="function";)o=o();n=he(e,o,n,s)}),()=>n;if(Array.isArray(t)){const o=[],a=n&&Array.isArray(n);if(Ce(o,t,n,r))return C(()=>n=he(e,o,n,s,!0)),()=>n;if(o.length===0){if(n=K(e,n,s),i)return n}else a?n.length===0?Be(e,o,s):St(e,n,o):(n&&K(e),Be(e,o));n=o}else if(t.nodeType){if(Array.isArray(n)){if(i)return n=K(e,n,s,t);K(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function Ce(e,t,n,s){let r=!1;for(let l=0,i=t.length;l<i;l++){let o=t[l],a=n&&n[e.length],u;if(!(o==null||o===!0||o===!1))if((u=typeof o)=="object"&&o.nodeType)e.push(o);else if(Array.isArray(o))r=Ce(e,o,a)||r;else if(u==="function")if(s){for(;typeof o=="function";)o=o();r=Ce(e,Array.isArray(o)?o:[o],Array.isArray(a)?a:[a])||r}else e.push(o),r=!0;else{const f=String(o);a&&a.nodeType===3&&a.data===f?e.push(a):e.push(document.createTextNode(f))}}return r}function Be(e,t,n=null){for(let s=0,r=t.length;s<r;s++)e.insertBefore(t[s],n)}function K(e,t,n,s){if(n===void 0)return e.textContent="";const r=s||document.createTextNode("");if(t.length){let l=!1;for(let i=t.length-1;i>=0;i--){const o=t[i];if(r!==o){const a=o.parentNode===e;!l&&!i?a?e.replaceChild(r,o):e.insertBefore(r,n):a&&o.remove()}else l=!0}}else e.insertBefore(r,n);return[r]}const Et="http://www.w3.org/2000/svg";function Pt(e,t=!1,n=void 0){return t?document.createElementNS(Et,e):document.createElement(e,{is:n})}function Ot(e){const{useShadow:t}=e,n=document.createTextNode(""),s=()=>e.mount||document.body,r=ht();let l;return H(()=>{l||(l=bt(r,()=>W(()=>e.children)));const i=s();if(i instanceof HTMLHeadElement){const[o,a]=x(!1),u=()=>a(!0);ne(f=>d(i,()=>o()?f():l(),null)),Y(u)}else{const o=Pt(e.isSVG?"g":"div",e.isSVG),a=t&&o.attachShadow?o.attachShadow({mode:"open"}):o;Object.defineProperty(o,"_$host",{get(){return n.parentNode},configurable:!0}),d(a,l),i.appendChild(o),e.ref&&e.ref(o),Y(()=>i.removeChild(o))}},void 0,{render:!0}),n}async function qe(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 Ye(){return qe("/view/api/state")}function Tt(){return qe("/view/api/version")}const be=Symbol("store-raw"),q=Symbol("store-node"),j=Symbol("store-has"),Je=Symbol("store-self");function Xe(e){let t=e[F];if(!t&&(Object.defineProperty(e,F,{value:t=new Proxy(e,It)}),!Array.isArray(e))){const n=Object.keys(e),s=Object.getOwnPropertyDescriptors(e);for(let r=0,l=n.length;r<l;r++){const i=n[r];s[i].get&&Object.defineProperty(e,i,{enumerable:s[i].enumerable,get:s[i].get.bind(t)})}}return t}function X(e){let t;return e!=null&&typeof e=="object"&&(e[F]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function z(e,t=new Set){let n,s,r,l;if(n=e!=null&&e[be])return n;if(!X(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let i=0,o=e.length;i<o;i++)r=e[i],(s=z(r,t))!==r&&(e[i]=s)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);const i=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let a=0,u=i.length;a<u;a++)l=i[a],!o[l].get&&(r=e[l],(s=z(r,t))!==r&&(e[l]=s))}return e}function me(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function le(e,t,n){if(e[t])return e[t];const[s,r]=x(n,{equals:!1,internal:!0});return s.$=r,e[t]=s}function Nt(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===F||t===q||(delete n.value,delete n.writable,n.get=()=>e[F][t]),n}function ze(e){Ae()&&le(me(e,q),Je)()}function Lt(e){return ze(e),Reflect.ownKeys(e)}const It={get(e,t,n){if(t===be)return e;if(t===F)return n;if(t===xe)return ze(e),n;const s=me(e,q),r=s[t];let l=r?r():e[t];if(t===q||t===j||t==="__proto__")return l;if(!r){const i=Object.getOwnPropertyDescriptor(e,t);Ae()&&(typeof l!="function"||e.hasOwnProperty(t))&&!(i&&i.get)&&(l=le(s,t,l)())}return X(l)?Xe(l):l},has(e,t){return t===be||t===F||t===xe||t===q||t===j||t==="__proto__"?!0:(Ae()&&le(me(e,j),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Lt,getOwnPropertyDescriptor:Nt};function Q(e,t,n,s=!1){if(!s&&e[t]===n)return;const r=e[t],l=e.length;n===void 0?(delete e[t],e[j]&&e[j][t]&&r!==void 0&&e[j][t].$()):(e[t]=n,e[j]&&e[j][t]&&r===void 0&&e[j][t].$());let i=me(e,q),o;if((o=le(i,t,r))&&o.$(()=>n),Array.isArray(e)&&e.length!==l){for(let a=e.length;a<l;a++)(o=i[a])&&o.$();(o=le(i,"length",l))&&o.$(e.length)}(o=i[Je])&&o.$()}function Qe(e,t){const n=Object.keys(t);for(let s=0;s<n.length;s+=1){const r=n[s];Q(e,r,t[r])}}function jt(e,t){if(typeof t=="function"&&(t=t(e)),t=z(t),Array.isArray(t)){if(e===t)return;let n=0,s=t.length;for(;n<s;n++){const r=t[n];e[n]!==r&&Q(e,n,r)}Q(e,"length",s)}else Qe(e,t)}function te(e,t,n=[]){let s,r=e;if(t.length>1){s=t.shift();const i=typeof s,o=Array.isArray(e);if(Array.isArray(s)){for(let a=0;a<s.length;a++)te(e,[s[a]].concat(t),n);return}else if(o&&i==="function"){for(let a=0;a<e.length;a++)s(e[a],a)&&te(e,[a].concat(t),n);return}else if(o&&i==="object"){const{from:a=0,to:u=e.length-1,by:f=1}=s;for(let c=a;c<=u;c+=f)te(e,[c].concat(t),n);return}else if(t.length>1){te(e[s],t,[s].concat(n));return}r=e[s],n=[s].concat(n)}let l=t[0];typeof l=="function"&&(l=l(r,n),l===r)||s===void 0&&l==null||(l=z(l),s===void 0||X(r)&&X(l)&&!Array.isArray(l)?Qe(r,l):Q(e,s,l))}function Dt(...[e,t]){const n=z(e||{}),s=Array.isArray(n),r=Xe(n);function l(...i){ft(()=>{s&&i.length===1?jt(n,i[0]):te(n,i)})}return[r,l]}const $e=new WeakMap,Ze={get(e,t){if(t===be)return e;const n=e[t];let s;return X(n)?$e.get(n)||($e.set(n,s=new Proxy(n,Ze)),s):n},set(e,t,n){return Q(e,t,z(n)),!0},deleteProperty(e,t){return Q(e,t,void 0,!0),!0}};function oe(e){return t=>{if(X(t)){let n;(n=$e.get(t))||$e.set(t,n=new Proxy(t,Ze)),e(n)}return t}}const[Mt,Bt]=x(0);setInterval(()=>Bt(e=>e+1),5e3);function et(e){const t={};for(const n of e.backends)t[n.name]=n.state;for(const n of e.frontends){let s=0;for(let r=0;r<n.pools.length;r++){let l=!1;for(const i of n.pools[r].backends)if(t[i.name]==="up"&&i.weight>0){l=!0;break}if(l){s=r;break}}for(let r=0;r<n.pools.length;r++)for(const l of n.pools[r].backends){const i=t[l.name];l.effective_weight=i==="up"&&r===s?l.weight:0}}}const[pe,Z]=Dt({byName:{}});function tt(e){const t={};for(const n of e)t[n.maglevd.name]=n;Z({byName:t})}function Rt(e,t){Z(oe(n=>{const s=n.byName[e];if(!s)return;const r=s.backends.find(l=>l.name===t.backend);r&&(r.state=t.transition.to,r.enabled=t.transition.to!=="disabled",r.last_transition=t.transition,r.transitions||(r.transitions=[]),r.transitions.push(t.transition),r.transitions.length>20&&(r.transitions=r.transitions.slice(r.transitions.length-20)),et(s))}))}function Ut(e,t){Z(oe(n=>{const s=n.byName[e];if(!s)return;const r=s.frontends.find(l=>l.name===t.frontend);r&&(r.state=t.transition.to)}))}function Vt(e,t){Z(oe(n=>{const s=n.byName[e];s&&(s.vpp_state=t)}))}function Wt(e,t){Z(oe(n=>{const s=n.byName[e];s&&(s.maglevd.connected=t.connected,s.maglevd.last_error=t.last_error)}))}function Ft(e,t,n,s,r){Z(oe(l=>{const i=l.byName[e];if(!i)return;const o=i.frontends.find(f=>f.name===t);if(!o)return;const a=o.pools.find(f=>f.name===n);if(!a)return;const u=a.backends.find(f=>f.name===s);u&&(u.weight=r,et(i))}))}function Ht(e,t){return e.includes(":")?`[${e}]:${t}`:`${e}:${t}`}function Gt(e){if(Mt(),!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<=1)return"now";const s=n%60,r=Math.floor(n/60);if(r<1)return`${n}s ago`;const l=r%60,i=Math.floor(r/60);if(i<1)return`${l}m${s}s ago`;const o=i%24,a=Math.floor(i/24);return a<1?`${i}h${l}m ago`:`${a}d${o}h ago`}const Re=500,[Ee,Kt]=x([]);function qt(e){Kt(t=>{const n=[...t,e];return n.length>Re?n.slice(n.length-Re):n})}function Yt(){const e=new EventSource("/view/api/events");return e.onmessage=t=>{try{const n=JSON.parse(t.data);Jt(n)}catch(n){console.error("sse parse error",n,t.data)}},e.addEventListener("resync",async()=>{try{const t=await Ye();tt(t)}catch(t){console.error("resync refetch failed",t)}}),e.onerror=t=>{console.debug("sse error, browser will reconnect",t)},e}function Jt(e){switch(qt(e),e.type){case"backend":Rt(e.maglevd,e.payload);break;case"frontend":Ut(e.maglevd,e.payload);break;case"maglevd-status":Wt(e.maglevd,e.payload);break;case"vpp-status":Vt(e.maglevd,e.payload.state);break}}const[_e,nt]=x(void 0);var Xt=h("<nav class=scope-selector>"),zt=h("<button class=scope-tab><span class=dot>");const Qt=()=>{const e=()=>Object.keys(pe.byName).sort();return(()=>{var t=Xt();return d(t,g(J,{get each(){return e()},children:n=>{const s=()=>pe.byName[n],r=()=>s()?.maglevd.connected??!1;return(()=>{var l=zt();return l.firstChild,l.$$click=()=>nt(n),d(l,n,null),C(i=>{var o=_e()===n,a=!!r(),u=!r(),f=s()?.maglevd.address??"";return o!==i.e&&l.classList.toggle("active",i.e=o),a!==i.t&&l.classList.toggle("connected",i.t=a),u!==i.a&&l.classList.toggle("disconnected",i.a=u),f!==i.o&&N(l,"title",i.o=f),i},{e:void 0,t:void 0,a:void 0,o:void 0}),l})()}})),t})()};ve(["click"]);var Zt=h("<span class=status-badge>");const rt=e=>(()=>{var t=Zt();return d(t,()=>e.label??e.state),C(()=>N(t,"data-state",e.state)),t})();var en=h("<span class=probe-heartbeat>");const tn="▶",nn="⏸",rn="⏹",sn="❤️",Ue=400;function ln(e){switch(e){case"paused":return nn;case"disabled":case"removed":return rn;default:return tn}}const on=e=>{const[t,n]=x(!1);let s,r;return H(()=>{const l=Ee();if(l.length===0)return;const i=l[l.length-1];if(i.type!=="log"||i.maglevd!==e.maglevd)return;const o=i.payload;o.attrs?.backend===e.backend&&o.msg==="probe-start"&&(n(!0),s?.animate([{transform:"scale(1)"},{transform:"scale(1.6)",offset:.25},{transform:"scale(1)"}],{duration:Ue,easing:"ease-out"}),r!==void 0&&clearTimeout(r),r=window.setTimeout(()=>{n(!1),r=void 0},Ue))}),Y(()=>{r!==void 0&&clearTimeout(r)}),(()=>{var l=en(),i=s;return typeof i=="function"?ye(i,l):s=l,d(l,(()=>{var o=L(()=>!!t());return()=>o()?sn:ln(e.state)})()),C(()=>l.classList.toggle("in-flight",!!t())),l})()};var an=h("<span class=flash-target>");const re=e=>{let t;return H(dt(()=>e.value,()=>{t?.animate([{transform:"scale(1)",backgroundColor:"#facc15",boxShadow:"0 0 0 2px #facc15",offset:0},{transform:"scale(1.35)",backgroundColor:"#facc15",boxShadow:"0 0 0 4px #facc15",offset:.18},{transform:"scale(1)",backgroundColor:"#facc15",boxShadow:"0 0 0 2px #facc15",offset:.5},{transform:"scale(1)",backgroundColor:"transparent",boxShadow:"0 0 0 0 transparent",offset:1}],{duration:1500,easing:"ease-out"})},{defer:!0})),(()=>{var n=an(),s=t;return typeof s=="function"?ye(s,n):t=n,d(n,()=>e.children??e.value),n})()};async function cn(e,t,n){const s=`/admin/api/${encodeURIComponent(e)}/backend/${encodeURIComponent(t)}/${n}`,r=await fetch(s,{method:"POST",credentials:"same-origin"});if(!r.ok){const l=(await r.text()).trim();throw new Error(l||`${r.status} ${r.statusText}`)}return await r.json()}async function un(e,t,n,s,r,l){const i=`/admin/api/${encodeURIComponent(e)}/frontend/${encodeURIComponent(t)}/pool/${encodeURIComponent(n)}/backend/${encodeURIComponent(s)}/weight`,o=await fetch(i,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({weight:r,flush:l})});if(!o.ok){const a=(await o.text()).trim();throw new Error(a||`${o.status} ${o.statusText}`)}return await o.json()}var fn=h("<div class=modal-backdrop><div class=modal-card role=dialog aria-modal=true><header class=modal-header><h3></h3><button type=button class=modal-close aria-label=close>×</button></header><div class=modal-body>");const dn=e=>(H(()=>{const t=n=>{n.key==="Escape"&&e.onClose()};document.addEventListener("keydown",t),Y(()=>document.removeEventListener("keydown",t))}),g(Ot,{get mount(){return document.body},get children(){var t=fn(),n=t.firstChild,s=n.firstChild,r=s.firstChild,l=r.nextSibling,i=s.nextSibling;return t.$$mousedown=o=>{o.target===o.currentTarget&&e.onClose()},d(r,()=>e.title),At(l,"click",e.onClose),d(i,()=>e.children),C(()=>N(n,"aria-label",e.title)),t}}));ve(["mousedown","click"]);var gn=h("<div class=kebab-menu role=menu>"),hn=h('<div class=kebab-wrap><button type=button class=kebab-btn aria-haspopup=menu title="backend actions">⋮'),bn=h("<button type=button class=kebab-item role=menuitem>"),mn=h("<p class=dialog-error>"),$n=h("<footer class=dialog-footer><button type=button class=btn-secondary>cancel</button><button type=button class=btn-primary>"),pn=h("<p class=dialog-warn>VPP's flow table will be cleared for this backend. Active sessions will be dropped immediately."),wn=h('<div class=dialog-body><p class=dialog-target><code></code> in pool <code></code> of frontend <code></code></p><label class=dialog-field><span class=weight-slider-label>weight<output class=weight-slider-value></output></span><input type=range class=weight-slider min=0 max=100 step=1><small>0–100; 0 keeps the backend in the pool but assigns it no traffic</small></label><label class="dialog-field checkbox"><input type=checkbox><span>flush existing flows'),vn=h("<p class=dialog-note>VPP's flow table is left alone. Existing sessions keep reaching this backend until they finish."),yn=h("<div class=dialog-body><p class=dialog-consequence>");function _n(e){const t={label:"set weight…",action:"weight"};switch(e){case"up":case"down":case"unknown":return[t,{label:"pause",action:"pause"},{label:"disable",action:"disable"}];case"paused":return[t,{label:"resume",action:"resume"},{label:"disable",action:"disable"}];case"disabled":return[t,{label:"enable",action:"enable"}];default:return[]}}function Sn(e){switch(e){case"pause":return"This will stop health checks and set the weight to 0, but existing flows to this backend are kept. New traffic will be rerouted to other backends.";case"resume":return"This will restart health checks. The backend re-enters the 'unknown' state and will start receiving traffic once it probes up.";case"disable":return"This will stop health checks, set the weight to 0, AND flush VPP's flow table for this backend. Active sessions will be dropped immediately.";case"enable":return"This will restart health checks on a previously disabled backend. It re-enters the 'unknown' state and will start receiving traffic once it probes up."}}const kn=e=>{const[t,n]=x(!1),[s,r]=x(),[l,i]=x(!1),[o,a]=x(),[u,f]=x(e.configuredWeight),[c,$]=x(!1);let b;const y=()=>_n(e.state);H(()=>{if(!t())return;const m=_=>{b&&(b.contains(_.target)||n(!1))},w=_=>{_.key==="Escape"&&n(!1)};document.addEventListener("mousedown",m),document.addEventListener("keydown",w),Y(()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",w)})});const k=m=>{n(!1),a(void 0),m==="weight"&&(f(e.configuredWeight),$(!1)),r(m)},P=()=>{l()||(r(void 0),a(void 0))},B=async()=>{const m=s();if(m){i(!0),a(void 0);try{if(m==="weight"){const w=u();if(!Number.isFinite(w)||w<0||w>100)throw new Error("weight must be an integer in [0, 100]");const _=Math.floor(w);await un(e.maglevd,e.frontend,e.pool,e.backend,_,c()),Ft(e.maglevd,e.frontend,e.pool,e.backend,_)}else await cn(e.maglevd,e.backend,m);r(void 0)}catch(w){a(`${w}`)}finally{i(!1)}}};return g(O,{get when(){return y().length>0},get children(){var m=hn(),w=m.firstChild,_=b;return typeof _=="function"?ye(_,m):b=m,w.$$click=A=>{A.stopPropagation(),n(S=>!S)},d(m,g(O,{get when(){return t()},get children(){var A=gn();return d(A,g(J,{get each(){return y()},children:S=>(()=>{var T=bn();return T.$$click=()=>k(S.action),d(T,()=>S.label),T})()})),A}}),null),d(m,g(O,{get when(){return s()},children:A=>g(dn,{get title(){return xn(A(),e.backend)},onClose:P,get children(){return[L(()=>L(()=>A()==="weight")()?(()=>{var S=wn(),T=S.firstChild,V=T.firstChild,I=V.nextSibling,ee=I.nextSibling,ae=ee.nextSibling,ce=ae.nextSibling,Ne=T.nextSibling,Le=Ne.firstChild,lt=Le.firstChild,it=lt.nextSibling,Ie=Le.nextSibling,ot=Ne.nextSibling,je=ot.firstChild;return d(V,()=>e.backend),d(ee,()=>e.pool),d(ce,()=>e.frontend),d(it,u),Ie.$$input=Se=>f(Number(Se.currentTarget.value)),je.addEventListener("change",Se=>$(Se.currentTarget.checked)),d(S,g(O,{get when(){return c()},get fallback(){return vn()},get children(){return pn()}}),null),C(()=>Ie.value=u()),C(()=>je.checked=c()),S})():(()=>{var S=yn(),T=S.firstChild;return d(T,()=>Sn(A())),S})()),g(O,{get when(){return o()},get children(){var S=mn();return d(S,o),S}}),(()=>{var S=$n(),T=S.firstChild,V=T.nextSibling;return T.$$click=P,V.$$click=B,d(V,()=>l()?"committing…":"commit"),C(I=>{var ee=l(),ae=!!(A()==="disable"||A()==="weight"&&c()),ce=l();return ee!==I.e&&(T.disabled=I.e=ee),ae!==I.t&&V.classList.toggle("btn-danger",I.t=ae),ce!==I.a&&(V.disabled=I.a=ce),I},{e:void 0,t:void 0,a:void 0}),S})()]}})}),null),C(()=>N(w,"aria-expanded",t())),m}})};function xn(e,t){switch(e){case"weight":return`Set weight — ${t}`;case"pause":return`Pause ${t}?`;case"resume":return`Resume ${t}?`;case"disable":return`Disable ${t}?`;case"enable":return`Enable ${t}?`}}ve(["click","input"]);const R=window.location.pathname.startsWith("/admin");var An=h("<td class=actions>"),Cn=h("<tr class=backend-row><td class=col-pool></td><td class=backend-name><span class=backend-name-text></span></td><td class=backend-address></td><td></td><td class=numeric></td><td class=numeric></td><td class=age>");const En=e=>{const t=()=>e.backend;return(()=>{var n=Cn(),s=n.firstChild,r=s.nextSibling,l=r.firstChild,i=r.nextSibling,o=i.nextSibling,a=o.nextSibling,u=a.nextSibling,f=u.nextSibling;return d(s,(()=>{var c=L(()=>!!e.showPool);return()=>c()?e.pool:""})()),d(r,g(on,{get maglevd(){return e.maglevd},get backend(){return t().name},get state(){return t().state}}),l),d(l,()=>t().name),d(i,()=>t().address),d(o,g(re,{get value(){return t().state},get children(){return g(rt,{get state(){return t().state}})}})),d(a,g(re,{get value(){return e.poolBackend.weight}})),d(u,g(re,{get value(){return e.poolBackend.effective_weight}})),d(f,()=>Gt(t().last_transition)),d(n,g(O,{when:R,get children(){var c=An();return d(c,g(kn,{get maglevd(){return e.maglevd},get frontend(){return e.frontend},get pool(){return e.pool},get backend(){return t().name},get state(){return t().state},get configuredWeight(){return e.poolBackend.weight}})),c}}),null),C(c=>{var $=!e.poolActive,b=t().state;return $!==c.e&&n.classList.toggle("pool-standby",c.e=$),b!==c.t&&N(n,"data-state",c.t=b),c},{e:void 0,t:void 0}),n})()};var Pn=h("<details class=zippy><summary></summary><div class=zippy-body>");const Te=e=>(()=>{var t=Pn(),n=t.firstChild,s=n.nextSibling;return d(n,()=>e.title),d(s,()=>e.children),C(()=>t.open=e.open),t})();var On=h("<span class=frontend-title><span class=frontend-title-name></span><span class=frontend-title-addr></span><span class=frontend-title-proto>"),Tn=h("<span class=tag>sticky"),Nn=h("<span class=frontend-title-desc>"),Ln=h('<th class="col-actions actions">'),In=h('<table class=backend-table><thead><tr><th class=col-pool>pool</th><th class=col-name>backend</th><th class=col-address>address</th><th class=col-state>state</th><th class="col-weight numeric">weight</th><th class="col-effective numeric">effective</th><th class=col-age>last transition</th></tr></thead><tbody>');const jn=e=>{const t=()=>Object.fromEntries(e.snap.backends.map(r=>[r.name,r])),n=()=>e.frontend,s=(()=>{var r=On(),l=r.firstChild,i=l.nextSibling,o=i.nextSibling;return d(l,()=>n().name),d(r,g(re,{get value(){return n().state??"unknown"},get children(){return g(rt,{get state(){return n().state??"unknown"}})}}),i),d(i,()=>Ht(n().address,n().port)),d(o,()=>n().protocol.toUpperCase()),d(r,(()=>{var a=L(()=>!!n().src_ip_sticky);return()=>a()&&Tn()})(),null),d(r,(()=>{var a=L(()=>!!n().description);return()=>a()&&(()=>{var u=Nn();return d(u,()=>n().description),u})()})(),null),r})();return g(Te,{title:s,open:!0,get children(){var r=In(),l=r.firstChild,i=l.firstChild,o=i.firstChild,a=o.nextSibling,u=a.nextSibling,f=u.nextSibling,c=f.nextSibling,$=c.nextSibling;$.nextSibling;var b=l.nextSibling;return d(i,g(O,{when:R,get children(){return Ln()}}),null),d(b,g(J,{get each(){return n().pools},children:y=>{const k=()=>y.backends.some(P=>P.effective_weight>0);return g(J,{get each(){return y.backends},children:(P,B)=>{const m=t()[P.name];return m?g(En,{get maglevd(){return e.snap.maglevd.name},get frontend(){return n().name},get pool(){return y.name},get showPool(){return B()===0},get poolActive(){return k()},backend:m,poolBackend:P}):null}})}})),r}})};var Dn=h("<span class=vpp-badge>"),Mn=h("<span class=zippy-title>VPP"),Bn=h("<p class=empty>No VPP information available."),Rn=h("<dl class=kv><dt>version</dt><dd></dd><dt>build date</dt><dd></dd><dt>pid</dt><dd></dd><dt>booted</dt><dd></dd><dt>connected</dt><dd>");const Un=e=>{const t=()=>e.info?.boottime_ns?new Date(e.info.boottime_ns/1e6).toISOString():"",n=()=>e.info?.connecttime_ns?new Date(e.info.connecttime_ns/1e6).toISOString():"",s=()=>e.state==="connected"?"connected":"disconnected",r=(()=>{var l=Mn();return l.firstChild,d(l,g(re,{get value(){return s()},get children(){var i=Dn();return d(i,s),C(()=>N(i,"data-state",s())),i}}),null),l})();return g(Te,{title:r,get children(){return g(O,{get when(){return e.info},get fallback(){return Bn()},children:l=>(()=>{var i=Rn(),o=i.firstChild,a=o.nextSibling,u=a.nextSibling,f=u.nextSibling,c=f.nextSibling,$=c.nextSibling,b=$.nextSibling,y=b.nextSibling,k=y.nextSibling,P=k.nextSibling;return d(a,()=>l().version),d(f,()=>l().build_date),d($,()=>l().pid),d(y,t),d(P,n),i})()})}})};var Vn=h("<main class=overview>"),Wn=h("<p class=empty>No maglevd selected."),Fn=h('<div class="banner warn"> disconnected'),Hn=h("<div class=frontend-list>");const Gn=()=>{const e=()=>{const t=_e();return t?pe.byName[t]:void 0};return(()=>{var t=Vn();return d(t,g(O,{get when(){return e()},get fallback(){return Wn()},children:n=>[g(O,{get when(){return!n().maglevd.connected},get children(){var s=Fn(),r=s.firstChild;return d(s,()=>n().maglevd.name,r),d(s,(()=>{var l=L(()=>!!n().maglevd.last_error);return()=>l()&&`: ${n().maglevd.last_error}`})(),null),s}}),(()=>{var s=Hn();return d(s,g(J,{get each(){return n().frontends},children:r=>g(jn,{get snap(){return n()},frontend:r})})),s})(),g(Un,{get info(){return n().vpp_info},get state(){return n().vpp_state}})]})),t})()};var Kn=h("<ol class=event-tail>"),qn=h("<div class=debug-toolbar><label><input type=checkbox>all maglevds</label><button></button><span class=count> events"),Yn=h("<li>");const Jn=()=>{const[e,t]=x(!1),[n,s]=x(!1),[r,l]=x([]),i=W(()=>{const u=n()?r():Ee();if(e())return u;const f=_e();return f?u.filter(c=>c.maglevd===f):u}),o=()=>{n()?s(!1):(l([...Ee()]),s(!0))};let a;return H(()=>{i(),!n()&&a&&(a.scrollTop=a.scrollHeight)}),g(Te,{title:"Event stream",get children(){return[(()=>{var u=Kn(),f=a;return typeof f=="function"?ye(f,u):a=u,d(u,g(J,{get each(){return i()},children:c=>(()=>{var $=Yn();return d($,()=>Qn(c)),C(b=>{var y=`event-row event-${c.type}`,k=!!Xn(c);return y!==b.e&&xt($,b.e=y),k!==b.t&&$.classList.toggle("event-sync",b.t=k),b},{e:void 0,t:void 0}),$})()})),u})(),(()=>{var u=qn(),f=u.firstChild,c=f.firstChild,$=f.nextSibling,b=$.nextSibling,y=b.firstChild;return c.addEventListener("change",k=>t(k.currentTarget.checked)),$.$$click=o,d($,()=>n()?"resume":"pause"),d(b,()=>i().length,y),C(()=>c.checked=e()),u})()]}})};function Xn(e){return e.type!=="log"?!1:e.payload.msg.startsWith("vpp-lb-sync-")}function zn(e){if(!e)return"";const t=["vip","protocol","port","address","weight","from","to","encap","src-ip-sticky","flush"],n=[],s=new Set;for(const r of t)r in e&&(n.push(`${r}=${e[r]}`),s.add(r));for(const[r,l]of Object.entries(e))s.has(r)||n.push(`${r}=${l}`);return n.join(" ")}function Qn(e){const t=new Date(e.at_unix_ns/1e6).toISOString().substring(11,23),n=`[${e.maglevd}]`;switch(e.type){case"backend":{const s=e.payload;return`${t} ${n} backend ${s.backend}: ${s.transition.from} → ${s.transition.to}`}case"frontend":{const s=e.payload;return`${t} ${n} frontend ${s.frontend}: ${s.transition.from} → ${s.transition.to}`}case"log":{const s=e.payload;if(s.msg.startsWith("vpp-lb-sync-"))return`${t} ${n} ${s.msg} ${zn(s.attrs)}`.trimEnd();const r=s.attrs?Object.entries(s.attrs).map(([l,i])=>`${l}=${i}`).join(" "):"";return`${t} ${n} ${s.level} ${s.msg} ${r}`.trimEnd()}case"maglevd-status":return`${t} ${n} maglevd status: ${JSON.stringify(e.payload)}`;default:return`${t} ${n} ${e.type}`}}ve(["click"]);const Zn="/view/assets/logo-bimi-Bguc6E_L.svg";var er=h("<span class=mode-tag>"),tr=h("<a class=admin-toggle>"),nr=h('<div class=app><header class=app-header><div class=brand><a class=brand-logo href=https://ipng.ch/ target=_blank rel=noopener title="IPng Networks"><img alt=IPng></a><a class=brand-name href=https://git.ipng.ch/ipng/vpp-maglev target=_blank rel=noopener title="vpp-maglev on git.ipng.ch"><strong>vpp-maglev'),rr=h("<span class=version> (<!>)"),sr=h('<div class="banner err">'),lr=h("<p class=loading>Loading…");const ir=()=>{const[e,t]=x(),[n,s]=x();gt(async()=>{try{const[l,i]=await Promise.all([Ye(),Tt()]);tt(l),s(i),!_e()&&l.length>0&&nt(l[0].maglevd.name),Yt()}catch(l){t(`${l}`)}});const r=()=>n()?.admin_enabled===!0;return(()=>{var l=nr(),i=l.firstChild,o=i.firstChild,a=o.firstChild,u=a.firstChild;return a.nextSibling,N(u,"src",Zn),d(o,(()=>{var f=L(()=>!!n());return()=>f()&&(()=>{var c=rr(),$=c.firstChild,b=$.nextSibling;return b.nextSibling,d(c,()=>n().version,$),d(c,()=>n().commit,b),C(()=>N(c,"title",`commit ${n().commit} · built ${n().date}`)),c})()})(),null),d(i,g(Qt,{}),null),d(i,g(O,{get when(){return R||r()},get children(){var f=er();return d(f,R?"admin":"view"),f}}),null),d(i,g(O,{get when(){return r()},get children(){var f=tr();return N(f,"href",R?"/view/":"/admin/"),N(f,"title",R?"exit admin mode":"enter admin mode"),d(f,R?"exit admin":"admin…"),f}}),null),d(l,(()=>{var f=L(()=>!!e());return()=>f()&&(()=>{var c=sr();return d(c,e),c})()})(),null),d(l,(()=>{var f=L(()=>!e()&&Object.keys(pe.byName).length===0);return()=>f()&&lr()})(),null),d(l,g(Gn,{}),null),d(l,g(O,{when:R,get children(){return g(Jn,{})}}),null),l})()},st=document.getElementById("root");if(!st)throw new Error("no #root element");kt(()=>g(ir,{}),st);
|