diff --git a/frontend/dist/VERSION b/frontend/dist/VERSION index 8d4808f2..1f2b78cb 100644 --- a/frontend/dist/VERSION +++ b/frontend/dist/VERSION @@ -1 +1 @@ -0.9.261 +0.9.262 diff --git a/frontend/dist/assets/Card-Dr9pbVV5.js b/frontend/dist/assets/Card-QO4sXDu0.js similarity index 96% rename from frontend/dist/assets/Card-Dr9pbVV5.js rename to frontend/dist/assets/Card-QO4sXDu0.js index 346a73f5..ae1f18f1 100644 --- a/frontend/dist/assets/Card-Dr9pbVV5.js +++ b/frontend/dist/assets/Card-QO4sXDu0.js @@ -1 +1 @@ -import{j as e,c as s}from"./vendor-react-j_fHog8x.js";import{j as l}from"./index-01Tx8g53.js";function t({title:t,icon:c,badge:i,badgeColor:r="teal",subtitle:a,actions:n,iconColor:x="text-icon-card-title",listHeader:m=!1,stackActionsOnMobile:d=!1,titleExtra:o,onClick:f,className:p}){const j="px-5 py-4 border-b border-edge-subtle",h=e.jsxs(e.Fragment,{children:[c&&e.jsx("span",{className:s("icon-md flex items-center justify-center",x),children:c}),e.jsx("span",{className:"type-micro",children:t}),i&&e.jsx(l,{color:r,children:i}),o]}),u=f?"button":"div",b=f?{onClick:f,type:"button"}:{};return d&&n?e.jsxs(u,{...b,className:s("flex flex-col gap-1 flex-shrink-0",m?j:"mb-3",f&&"w-full text-left cursor-pointer",p),children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 min-h-[32px]",children:[e.jsx("div",{className:"flex items-center gap-3",children:h}),e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:n})]}),a&&e.jsx("p",{className:"type-label text-fg-muted ml-8",children:a})]}):e.jsxs(u,{...b,className:s("flex flex-col gap-1 flex-shrink-0",m?j:"mb-3",f&&"w-full text-left cursor-pointer",p),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 min-h-[32px]",children:[e.jsx("div",{className:"flex items-center gap-3",children:h}),n&&e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:n})]}),a&&e.jsx("p",{className:"type-label text-fg-muted ml-8",children:a})]})}function c({children:l,centered:t,className:c}){return e.jsx("div",{className:s("flex-1 min-h-0",t&&"flex items-center justify-center",c),children:l})}export{t as C,c as a}; +import{j as e,c as s}from"./vendor-react-j_fHog8x.js";import{j as l}from"./index-BBcIGlRT.js";function t({title:t,icon:c,badge:i,badgeColor:r="teal",subtitle:a,actions:n,iconColor:x="text-icon-card-title",listHeader:m=!1,stackActionsOnMobile:d=!1,titleExtra:o,onClick:f,className:p}){const j="px-5 py-4 border-b border-edge-subtle",h=e.jsxs(e.Fragment,{children:[c&&e.jsx("span",{className:s("icon-md flex items-center justify-center",x),children:c}),e.jsx("span",{className:"type-micro",children:t}),i&&e.jsx(l,{color:r,children:i}),o]}),u=f?"button":"div",b=f?{onClick:f,type:"button"}:{};return d&&n?e.jsxs(u,{...b,className:s("flex flex-col gap-1 flex-shrink-0",m?j:"mb-3",f&&"w-full text-left cursor-pointer",p),children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 min-h-[32px]",children:[e.jsx("div",{className:"flex items-center gap-3",children:h}),e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:n})]}),a&&e.jsx("p",{className:"type-label text-fg-muted ml-8",children:a})]}):e.jsxs(u,{...b,className:s("flex flex-col gap-1 flex-shrink-0",m?j:"mb-3",f&&"w-full text-left cursor-pointer",p),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 min-h-[32px]",children:[e.jsx("div",{className:"flex items-center gap-3",children:h}),n&&e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:n})]}),a&&e.jsx("p",{className:"type-label text-fg-muted ml-8",children:a})]})}function c({children:l,centered:t,className:c}){return e.jsx("div",{className:s("flex-1 min-h-0",t&&"flex items-center justify-center",c),children:l})}export{t as C,c as a}; diff --git a/frontend/dist/assets/ChatBubble-B4FG9Nhp.js b/frontend/dist/assets/ChatBubble-DX1ocHRQ.js similarity index 93% rename from frontend/dist/assets/ChatBubble-B4FG9Nhp.js rename to frontend/dist/assets/ChatBubble-DX1ocHRQ.js index 7ccdacf9..851eb01e 100644 --- a/frontend/dist/assets/ChatBubble-B4FG9Nhp.js +++ b/frontend/dist/assets/ChatBubble-DX1ocHRQ.js @@ -1 +1 @@ -import{c as e}from"./index-01Tx8g53.js";import{r as s,j as t,c as a}from"./vendor-react-j_fHog8x.js";import{e as l,g as r,a as i,b as n,f as d}from"./chat-utils-CB1BFUm7.js";const c=e("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]),m=s.memo(function({senderName:e,text:s,timestamp:c,nameAccessory:m,bubbleAccessory:x,className:o}){const{emoji:h,cleanName:p}=l(e),f=r(p),u=i(e);return t.jsxs("div",{className:a("group flex items-start gap-3 w-full",o),children:[t.jsxs("div",{className:"flex-shrink-0 w-9 flex flex-col items-center gap-1",children:[t.jsx("div",{className:a("w-9 h-9 rounded-full flex items-center justify-center","shadow-md ring-1 ring-edge-subtle",h?"text-lg":"text-white text-[13px] font-bold tracking-tight"),style:{backgroundColor:f},children:h||u}),t.jsx("span",{className:"text-xs text-fg-muted tabular-nums h-4 leading-4",children:n(c)})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 h-5 mb-1",children:[t.jsx("span",{className:"text-[13px] font-medium truncate",style:{color:f,lineHeight:"20px"},children:p}),m]}),t.jsxs("div",{className:"flex items-end gap-1.5",children:[t.jsx("div",{className:a("inline-block px-3.5 py-2.5 max-w-full","rounded-2xl rounded-tl-md","bg-[#007AFF]"),children:t.jsx("p",{className:"text-sm text-white leading-relaxed tracking-wide whitespace-pre-wrap break-words",children:d(s)})}),x]})]})]})});function x({text:e}){return t.jsx("div",{className:"flex justify-center my-1",children:t.jsx("span",{className:a("px-3 py-1 rounded-full","bg-subtle-fill text-[11px] text-fg-muted/80 font-medium","ring-1 ring-edge-subtle"),children:e})})}export{m as C,c as M,x as S}; +import{c as e}from"./index-BBcIGlRT.js";import{r as s,j as t,c as a}from"./vendor-react-j_fHog8x.js";import{e as l,g as r,a as i,b as n,f as d}from"./chat-utils-I8bC4Iy5.js";const c=e("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]),m=s.memo(function({senderName:e,text:s,timestamp:c,nameAccessory:m,bubbleAccessory:x,className:o}){const{emoji:h,cleanName:p}=l(e),f=r(p),u=i(e);return t.jsxs("div",{className:a("group flex items-start gap-3 w-full",o),children:[t.jsxs("div",{className:"flex-shrink-0 w-9 flex flex-col items-center gap-1",children:[t.jsx("div",{className:a("w-9 h-9 rounded-full flex items-center justify-center","shadow-md ring-1 ring-edge-subtle",h?"text-lg":"text-white text-[13px] font-bold tracking-tight"),style:{backgroundColor:f},children:h||u}),t.jsx("span",{className:"text-xs text-fg-muted tabular-nums h-4 leading-4",children:n(c)})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 h-5 mb-1",children:[t.jsx("span",{className:"text-[13px] font-medium truncate",style:{color:f,lineHeight:"20px"},children:p}),m]}),t.jsxs("div",{className:"flex items-end gap-1.5",children:[t.jsx("div",{className:a("inline-block px-3.5 py-2.5 max-w-full","rounded-2xl rounded-tl-md","bg-[#007AFF]"),children:t.jsx("p",{className:"text-sm text-white leading-relaxed tracking-wide whitespace-pre-wrap break-words",children:d(s)})}),x]})]})]})});function x({text:e}){return t.jsx("div",{className:"flex justify-center my-1",children:t.jsx("span",{className:a("px-3 py-1 rounded-full","bg-subtle-fill text-[11px] text-fg-muted/80 font-medium","ring-1 ring-edge-subtle"),children:e})})}export{m as C,c as M,x as S}; diff --git a/frontend/dist/assets/CollisionExplorerModal-CTPNNbNo.js b/frontend/dist/assets/CollisionExplorerModal-CbOUGWmc.js similarity index 97% rename from frontend/dist/assets/CollisionExplorerModal-CTPNNbNo.js rename to frontend/dist/assets/CollisionExplorerModal-CbOUGWmc.js index 7b6da825..144a27e9 100644 --- a/frontend/dist/assets/CollisionExplorerModal-CTPNNbNo.js +++ b/frontend/dist/assets/CollisionExplorerModal-CbOUGWmc.js @@ -1 +1 @@ -import{r as e,j as s,c as t}from"./vendor-react-j_fHog8x.js";import{u as i,M as a,B as n,S as l,L as o,a as r}from"./BasemapLayer-BT1oL_wV.js";import"./maplibre-gl-b91ci4Kr.js";import{c as d,t as c,as as u,x as h,W as m,X as x,aj as p,j as g,o as f,bb as v}from"./index-01Tx8g53.js";import{T as b}from"./triangle-alert-DI33YyZq.js";import{M as y}from"./map-pin-DZIYgupP.js";import{C as j}from"./copy-B5OWhmpX.js";const N=d("monitor-smartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]),w=d("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),k={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"};function M({node:i,isHovered:a,onHover:n}){const[l,o]=e.useState(!1),r=e.useCallback(e=>{var s,t;e.stopPropagation(),s=i.hash,(null==(t=navigator.clipboard)?void 0:t.writeText)&&navigator.clipboard.writeText(s).catch(()=>{}),o(!0),setTimeout(()=>o(!1),2e3)},[i.hash]),d=i.contactType.toLowerCase(),c=d.includes("room")||d.includes("server");let u=w,h="text-sys-blue";return c?(u=v,h="text-signal-fair"):"companion"===d||"client"===d?(u=N,h="text-fg-muted"):i.isNeighbor&&(h="text-sys-green"),s.jsxs("div",{className:t("flex items-center gap-3 px-3 py-2.5 radius-inner transition-base cursor-pointer",a?"bg-sys-blue/10":"hover:bg-subtle-fill"),onMouseEnter:()=>n(i.hash),onMouseLeave:()=>n(null),children:[s.jsx(u,{className:t("w-4 h-4 flex-shrink-0",h)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"type-label text-fg-primary truncate",children:i.name}),i.isNeighbor&&s.jsx(g,{color:"green",compact:!0,children:"NBR"}),i.isRepeater&&s.jsx(g,{color:"zinc",compact:!0,children:"RPT"}),i.isHub&&s.jsx(g,{color:"indigo",compact:!0,children:"HUB"})]}),s.jsxs("button",{onClick:r,className:t("mt-1 inline-flex items-center gap-1 type-data-xs px-1.5 py-0.5 rounded","border transition-all cursor-pointer",l?"border-sys-green/50 bg-sys-green/10 text-sys-green":"border-edge-subtle bg-subtle/50 text-fg-muted hover:border-edge-strong"),title:`Copy: ${i.hash}`,children:[i.hash.slice(0,12),"…",l?s.jsx(f,{className:"w-2.5 h-2.5"}):s.jsx(j,{className:"w-2.5 h-2.5 opacity-50"})]})]})]})}function H({nodes:d,hoveredHash:c,onHover:u}){const h=i(),m=e.useRef(null),x=p(),[f,v]=e.useState(!1),b=e.useMemo(()=>d.filter(e=>null!=e.latitude&&null!=e.longitude&&(0!==e.latitude||0!==e.longitude)),[d]),j=e.useMemo(()=>{if(0===b.length)return null;let e=1/0,s=-1/0,t=1/0,i=-1/0;for(const a of b)e=Math.min(e,a.longitude),s=Math.max(s,a.longitude),t=Math.min(t,a.latitude),i=Math.max(i,a.latitude);if(i-t<.01){const e=(i+t)/2;t=e-.005,i=e+.005}if(s-e<.01){const t=(s+e)/2;e=t-.005,s=t+.005}return[[e,t],[s,i]]},[b]),N=e.useMemo(()=>j?{longitude:(j[0][0]+j[1][0])/2,latitude:(j[0][1]+j[1][1])/2}:{longitude:0,latitude:0},[j]),w=e.useMemo(()=>{if(b.length<2)return null;const e=[];for(let s=0;s{var e;const s=null==(e=m.current)?void 0:e.getMap();s&&j?(s.fitBounds(j,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:13,duration:0}),setTimeout(()=>v(!0),50)):v(!0)},[j]),H=x&&f;return 0===b.length?s.jsx("div",{className:"h-full flex items-center justify-center bg-subtle/30 radius-inner",children:s.jsxs("div",{className:"text-center text-fg-secondary p-4",children:[s.jsx(y,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),s.jsx("p",{className:"text-sm",children:"No location data available"})]})}):s.jsxs("div",{className:"h-full w-full relative radius-inner overflow-hidden bg-elevated",children:[s.jsx("div",{className:t("absolute inset-0 flex items-center justify-center z-10","transition-opacity duration-200 pointer-events-none",H?"opacity-0":"opacity-100 bg-elevated"),children:s.jsx("div",{className:"w-5 h-5 border-2 border-text-muted/30 border-t-text-muted rounded-full animate-spin"})}),s.jsx("div",{className:t("h-full w-full transition-opacity duration-200",H?"opacity-100":"opacity-0"),children:s.jsxs(a,{ref:m,initialViewState:{longitude:N.longitude,latitude:N.latitude,zoom:10},style:{height:"100%",width:"100%"},mapStyle:k,attributionControl:!1,onLoad:M,children:[s.jsx(n,{mode:h}),w&&s.jsx(l,{id:"collision-edges",type:"geojson",data:w,children:s.jsx(o,{id:"collision-edges-line",type:"line",paint:{"line-color":"#3B3F4A","line-width":2,"line-opacity":.8},layout:{"line-cap":"round","line-join":"round"}})}),b.map(e=>{const t=e.hash===c,i=e.hash.startsWith("0x")?e.hash.slice(2,4).toUpperCase():e.hash.slice(0,2).toUpperCase();return s.jsx(r,{longitude:e.longitude,latitude:e.latitude,anchor:"center",children:s.jsx("div",{className:"cursor-pointer transition-all duration-150",onMouseEnter:()=>u(e.hash),onMouseLeave:()=>u(null),style:{pointerEvents:"auto"},children:s.jsxs(g,{color:"amber",filled:!0,className:"type-data-xs shadow-lg",children:[i,t&&s.jsx("span",{className:"ml-1 opacity-75 font-sans",children:e.name})]})})},e.hash)})]})})]})}const C=e.memo(function({isOpen:t,prefix:i,candidateHashes:a,onClose:n}){const l=c(),o=u(),r=h(),[d,p]=e.useState(null),g=e.useMemo(()=>new Set(r.map(e=>e.hash)),[r]),f=(null==l?void 0:l.neighbors)??{},v=e.useMemo(()=>a.map(e=>{var s;const t=(e=>f[e]?f[e]:!e.startsWith("0x")&&f["0x"+e]?f["0x"+e]:e.startsWith("0x")&&f[e.slice(2)]?f[e.slice(2)]:void 0)(e);return{hash:e,name:(null==t?void 0:t.node_name)||(null==t?void 0:t.name)||`Unknown (${e.slice(0,8)}…)`,contactType:(null==t?void 0:t.contact_type)||"",isRepeater:(null==t?void 0:t.is_repeater)||"repeater"===(null==(s=null==t?void 0:t.contact_type)?void 0:s.toLowerCase())||!1,isNeighbor:g.has(e)||g.has("0x"+e)||g.has(e.replace(/^0x/,"")),isHub:o.has(e),latitude:null==t?void 0:t.latitude,longitude:null==t?void 0:t.longitude}}).sort((e,s)=>e.isNeighbor!==s.isNeighbor?e.isNeighbor?-1:1:e.isHub!==s.isHub?e.isHub?-1:1:e.name.localeCompare(s.name)),[a,f,g,o]),y=e.useMemo(()=>v.some(e=>null!=e.latitude&&null!=e.longitude&&(0!==e.latitude||0!==e.longitude)),[v]),j=e.useCallback(e=>{p(e)},[]),N=y?"4xl":"lg";return t?s.jsxs(m,{open:t,onClose:n,size:N,motionPlus:!0,className:y?"sm:h-[500px] sm:max-h-[600px]":"",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-edge-subtle",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 radius-inner bg-signal-fair/10",children:s.jsx(b,{className:"w-5 h-5 text-signal-fair"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"type-micro",children:["Prefix Collision: ",s.jsx("span",{className:"font-mono text-sys-blue",children:i})]}),s.jsxs("p",{className:"text-xs text-fg-secondary",children:[v.length," nodes share this prefix"]})]})]}),s.jsx("button",{onClick:n,className:"sm:hidden min-h-[44px] min-w-[44px] px-3 flex items-center justify-center text-[15px] font-medium text-sys-blue active:text-sys-blue/70 transition-base radius-inner active:bg-subtle-fill",children:"Done"}),s.jsx("button",{onClick:n,className:"hidden sm:flex items-center justify-center p-2 text-fg-muted hover:text-fg-primary transition-base radius-inner hover:bg-subtle","aria-label":"Close",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsxs(x,{className:"p-0 overflow-hidden flex-1 flex flex-col min-h-0",children:[s.jsxs("div",{className:"sm:hidden flex-1 overflow-y-auto",children:[y&&s.jsx("div",{className:"h-64 p-2 border-b border-edge-subtle",children:s.jsx(H,{nodes:v,hoveredHash:d,onHover:j})}),s.jsx("div",{className:"p-2",children:v.map(e=>s.jsx(M,{node:e,isHovered:d===e.hash,onHover:j},e.hash))})]}),y?s.jsxs("div",{className:"hidden sm:grid sm:grid-cols-[280px_minmax(400px,1fr)] flex-1 overflow-hidden sm:min-w-[700px]",children:[s.jsx("div",{className:"overflow-y-auto border-r border-edge-subtle",children:s.jsx("div",{className:"p-2",children:v.map(e=>s.jsx(M,{node:e,isHovered:d===e.hash,onHover:j},e.hash))})}),s.jsx("div",{className:"overflow-hidden p-2",children:s.jsx(H,{nodes:v,hoveredHash:d,onHover:j})})]}):s.jsx("div",{className:"hidden sm:block flex-1 overflow-y-auto",children:s.jsx("div",{className:"p-2",children:v.map(e=>s.jsx(M,{node:e,isHovered:d===e.hash,onHover:j},e.hash))})})]})]}):null});export{C,N as M,w as S}; +import{r as e,j as s,c as t}from"./vendor-react-j_fHog8x.js";import{u as i,M as a,B as n,S as l,L as o,a as r}from"./BasemapLayer-BT1oL_wV.js";import"./maplibre-gl-b91ci4Kr.js";import{c as d,t as c,as as u,x as h,W as m,X as x,aj as p,j as g,o as f,bb as v}from"./index-BBcIGlRT.js";import{T as b}from"./triangle-alert-DH80WgOo.js";import{M as y}from"./map-pin-FZNiPp_L.js";import{C as j}from"./copy-C_IB0gEd.js";const N=d("monitor-smartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]),w=d("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),k={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"};function M({node:i,isHovered:a,onHover:n}){const[l,o]=e.useState(!1),r=e.useCallback(e=>{var s,t;e.stopPropagation(),s=i.hash,(null==(t=navigator.clipboard)?void 0:t.writeText)&&navigator.clipboard.writeText(s).catch(()=>{}),o(!0),setTimeout(()=>o(!1),2e3)},[i.hash]),d=i.contactType.toLowerCase(),c=d.includes("room")||d.includes("server");let u=w,h="text-sys-blue";return c?(u=v,h="text-signal-fair"):"companion"===d||"client"===d?(u=N,h="text-fg-muted"):i.isNeighbor&&(h="text-sys-green"),s.jsxs("div",{className:t("flex items-center gap-3 px-3 py-2.5 radius-inner transition-base cursor-pointer",a?"bg-sys-blue/10":"hover:bg-subtle-fill"),onMouseEnter:()=>n(i.hash),onMouseLeave:()=>n(null),children:[s.jsx(u,{className:t("w-4 h-4 flex-shrink-0",h)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"type-label text-fg-primary truncate",children:i.name}),i.isNeighbor&&s.jsx(g,{color:"green",compact:!0,children:"NBR"}),i.isRepeater&&s.jsx(g,{color:"zinc",compact:!0,children:"RPT"}),i.isHub&&s.jsx(g,{color:"indigo",compact:!0,children:"HUB"})]}),s.jsxs("button",{onClick:r,className:t("mt-1 inline-flex items-center gap-1 type-data-xs px-1.5 py-0.5 rounded","border transition-all cursor-pointer",l?"border-sys-green/50 bg-sys-green/10 text-sys-green":"border-edge-subtle bg-subtle/50 text-fg-muted hover:border-edge-strong"),title:`Copy: ${i.hash}`,children:[i.hash.slice(0,12),"…",l?s.jsx(f,{className:"w-2.5 h-2.5"}):s.jsx(j,{className:"w-2.5 h-2.5 opacity-50"})]})]})]})}function H({nodes:d,hoveredHash:c,onHover:u}){const h=i(),m=e.useRef(null),x=p(),[f,v]=e.useState(!1),b=e.useMemo(()=>d.filter(e=>null!=e.latitude&&null!=e.longitude&&(0!==e.latitude||0!==e.longitude)),[d]),j=e.useMemo(()=>{if(0===b.length)return null;let e=1/0,s=-1/0,t=1/0,i=-1/0;for(const a of b)e=Math.min(e,a.longitude),s=Math.max(s,a.longitude),t=Math.min(t,a.latitude),i=Math.max(i,a.latitude);if(i-t<.01){const e=(i+t)/2;t=e-.005,i=e+.005}if(s-e<.01){const t=(s+e)/2;e=t-.005,s=t+.005}return[[e,t],[s,i]]},[b]),N=e.useMemo(()=>j?{longitude:(j[0][0]+j[1][0])/2,latitude:(j[0][1]+j[1][1])/2}:{longitude:0,latitude:0},[j]),w=e.useMemo(()=>{if(b.length<2)return null;const e=[];for(let s=0;s{var e;const s=null==(e=m.current)?void 0:e.getMap();s&&j?(s.fitBounds(j,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:13,duration:0}),setTimeout(()=>v(!0),50)):v(!0)},[j]),H=x&&f;return 0===b.length?s.jsx("div",{className:"h-full flex items-center justify-center bg-subtle/30 radius-inner",children:s.jsxs("div",{className:"text-center text-fg-secondary p-4",children:[s.jsx(y,{className:"w-8 h-8 mx-auto mb-2 opacity-40"}),s.jsx("p",{className:"text-sm",children:"No location data available"})]})}):s.jsxs("div",{className:"h-full w-full relative radius-inner overflow-hidden bg-elevated",children:[s.jsx("div",{className:t("absolute inset-0 flex items-center justify-center z-10","transition-opacity duration-200 pointer-events-none",H?"opacity-0":"opacity-100 bg-elevated"),children:s.jsx("div",{className:"w-5 h-5 border-2 border-text-muted/30 border-t-text-muted rounded-full animate-spin"})}),s.jsx("div",{className:t("h-full w-full transition-opacity duration-200",H?"opacity-100":"opacity-0"),children:s.jsxs(a,{ref:m,initialViewState:{longitude:N.longitude,latitude:N.latitude,zoom:10},style:{height:"100%",width:"100%"},mapStyle:k,attributionControl:!1,onLoad:M,children:[s.jsx(n,{mode:h}),w&&s.jsx(l,{id:"collision-edges",type:"geojson",data:w,children:s.jsx(o,{id:"collision-edges-line",type:"line",paint:{"line-color":"#3B3F4A","line-width":2,"line-opacity":.8},layout:{"line-cap":"round","line-join":"round"}})}),b.map(e=>{const t=e.hash===c,i=e.hash.startsWith("0x")?e.hash.slice(2,4).toUpperCase():e.hash.slice(0,2).toUpperCase();return s.jsx(r,{longitude:e.longitude,latitude:e.latitude,anchor:"center",children:s.jsx("div",{className:"cursor-pointer transition-all duration-150",onMouseEnter:()=>u(e.hash),onMouseLeave:()=>u(null),style:{pointerEvents:"auto"},children:s.jsxs(g,{color:"amber",filled:!0,className:"type-data-xs shadow-lg",children:[i,t&&s.jsx("span",{className:"ml-1 opacity-75 font-sans",children:e.name})]})})},e.hash)})]})})]})}const C=e.memo(function({isOpen:t,prefix:i,candidateHashes:a,onClose:n}){const l=c(),o=u(),r=h(),[d,p]=e.useState(null),g=e.useMemo(()=>new Set(r.map(e=>e.hash)),[r]),f=(null==l?void 0:l.neighbors)??{},v=e.useMemo(()=>a.map(e=>{var s;const t=(e=>f[e]?f[e]:!e.startsWith("0x")&&f["0x"+e]?f["0x"+e]:e.startsWith("0x")&&f[e.slice(2)]?f[e.slice(2)]:void 0)(e);return{hash:e,name:(null==t?void 0:t.node_name)||(null==t?void 0:t.name)||`Unknown (${e.slice(0,8)}…)`,contactType:(null==t?void 0:t.contact_type)||"",isRepeater:(null==t?void 0:t.is_repeater)||"repeater"===(null==(s=null==t?void 0:t.contact_type)?void 0:s.toLowerCase())||!1,isNeighbor:g.has(e)||g.has("0x"+e)||g.has(e.replace(/^0x/,"")),isHub:o.has(e),latitude:null==t?void 0:t.latitude,longitude:null==t?void 0:t.longitude}}).sort((e,s)=>e.isNeighbor!==s.isNeighbor?e.isNeighbor?-1:1:e.isHub!==s.isHub?e.isHub?-1:1:e.name.localeCompare(s.name)),[a,f,g,o]),y=e.useMemo(()=>v.some(e=>null!=e.latitude&&null!=e.longitude&&(0!==e.latitude||0!==e.longitude)),[v]),j=e.useCallback(e=>{p(e)},[]),N=y?"4xl":"lg";return t?s.jsxs(m,{open:t,onClose:n,size:N,motionPlus:!0,className:y?"sm:h-[500px] sm:max-h-[600px]":"",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-edge-subtle",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"p-2 radius-inner bg-signal-fair/10",children:s.jsx(b,{className:"w-5 h-5 text-signal-fair"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"type-micro",children:["Prefix Collision: ",s.jsx("span",{className:"font-mono text-sys-blue",children:i})]}),s.jsxs("p",{className:"text-xs text-fg-secondary",children:[v.length," nodes share this prefix"]})]})]}),s.jsx("button",{onClick:n,className:"sm:hidden min-h-[44px] min-w-[44px] px-3 flex items-center justify-center text-[15px] font-medium text-sys-blue active:text-sys-blue/70 transition-base radius-inner active:bg-subtle-fill",children:"Done"}),s.jsx("button",{onClick:n,className:"hidden sm:flex items-center justify-center p-2 text-fg-muted hover:text-fg-primary transition-base radius-inner hover:bg-subtle","aria-label":"Close",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),s.jsxs(x,{className:"p-0 overflow-hidden flex-1 flex flex-col min-h-0",children:[s.jsxs("div",{className:"sm:hidden flex-1 overflow-y-auto",children:[y&&s.jsx("div",{className:"h-64 p-2 border-b border-edge-subtle",children:s.jsx(H,{nodes:v,hoveredHash:d,onHover:j})}),s.jsx("div",{className:"p-2",children:v.map(e=>s.jsx(M,{node:e,isHovered:d===e.hash,onHover:j},e.hash))})]}),y?s.jsxs("div",{className:"hidden sm:grid sm:grid-cols-[280px_minmax(400px,1fr)] flex-1 overflow-hidden sm:min-w-[700px]",children:[s.jsx("div",{className:"overflow-y-auto border-r border-edge-subtle",children:s.jsx("div",{className:"p-2",children:v.map(e=>s.jsx(M,{node:e,isHovered:d===e.hash,onHover:j},e.hash))})}),s.jsx("div",{className:"overflow-hidden p-2",children:s.jsx(H,{nodes:v,hoveredHash:d,onHover:j})})]}):s.jsx("div",{className:"hidden sm:block flex-1 overflow-y-auto",children:s.jsx("div",{className:"p-2",children:v.map(e=>s.jsx(M,{node:e,isHovered:d===e.hash,onHover:j},e.hash))})})]})]}):null});export{C,N as M,w as S}; diff --git a/frontend/dist/assets/Configuration-CIgGarXY.js b/frontend/dist/assets/Configuration-ribtJFkN.js similarity index 98% rename from frontend/dist/assets/Configuration-CIgGarXY.js rename to frontend/dist/assets/Configuration-ribtJFkN.js index d18c1bc9..c83bebd7 100644 --- a/frontend/dist/assets/Configuration-CIgGarXY.js +++ b/frontend/dist/assets/Configuration-ribtJFkN.js @@ -1 +1 @@ -import{r as e,j as s,c as t}from"./vendor-react-j_fHog8x.js";import{c as a,L as l,o as n,a5 as r,Y as i,bY as o,cI as c,cJ as d,T as u,cK as m,b2 as x,aH as h,n as p,cL as y,cM as f,cN as g,cO as b,R as j,B as v,cP as N,I as w}from"./index-01Tx8g53.js";import{g as k,a as C,c as S,r as _,s as F,b as T,u as E,d as P}from"./system-DikvxgDQ.js";import{T as M,P as z,C as R}from"./ConfirmModal-B8b131zF.js";import{l as D}from"./font-loader-BQzEmDrZ.js";import{M as I,S as L}from"./sun-CkgnTZGI.js";import{N as A}from"./NodeInformationCard-BswM4rjl.js";import{i as K,g as V,s as H,a as O,k as q}from"./keycap-sfx-CAsrNe23.js";import{a as $,P as B,b as X,B as J}from"./PageLayout-DrvMAhys.js";import{C as U}from"./Card-Dr9pbVV5.js";import{R as W,C as Y}from"./Grid-OFJ4oe0a.js";import{K as G}from"./key-round-D0AtlMOx.js";import{C as Q}from"./circle-check-DXO8ha7w.js";import{T as Z}from"./triangle-alert-DI33YyZq.js";import{R as ee}from"./refresh-cw-DYbYazpH.js";import{C as se}from"./copy-B5OWhmpX.js";import{C as te}from"./chevron-right-BHZSwM7S.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CmkNwW1A.js";import"./DataBox-Dpf5ZHgV.js";const ae=a("antenna",[["path",{d:"M2 12 7 2",key:"117k30"}],["path",{d:"m7 12 5-10",key:"1tvx22"}],["path",{d:"m12 12 5-10",key:"ev1o1a"}],["path",{d:"m17 12 5-10",key:"1e4ti3"}],["path",{d:"M4.5 7h15",key:"vlsxkz"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]),le=a("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),ne=a("folder-key",[["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2",key:"3hgo9p"}],["path",{d:"m22 14-4.5 4.5",key:"1ef6z8"}],["path",{d:"m21 15 1 1",key:"1ejcpy"}]]),re=a("folder-lock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]),ie=a("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),oe=a("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),ce=a("triangle-dashed",[["path",{d:"M10.17 4.193a2 2 0 0 1 3.666.013",key:"pltmmw"}],["path",{d:"M14 21h2",key:"v4qezv"}],["path",{d:"m15.874 7.743 1 1.732",key:"10m0iw"}],["path",{d:"m18.849 12.952 1 1.732",key:"zadnam"}],["path",{d:"M21.824 18.18a2 2 0 0 1-1.835 2.824",key:"fvwuk4"}],["path",{d:"M4.024 21a2 2 0 0 1-1.839-2.839",key:"1e1kah"}],["path",{d:"m5.136 12.952-1 1.732",key:"1u4ldi"}],["path",{d:"M8 21h2",key:"i9zjee"}],["path",{d:"m8.102 7.743-1 1.732",key:"1zzo4u"}]]),de=1500,ue="h-[38px]",me="h-[32px]",xe="px-3",he="px-2.5",pe="rounded-lg";function ye({label:a,value:i,editValue:o,onSave:c,type:d="text",suffix:u,placeholder:m,readOnly:x=!1,layout:h="stacked",min:p,max:y,step:f,maxLength:g,description:b,className:j}){const[v,N]=e.useState(!1),[w,k]=e.useState(""),[C,S]=e.useState("idle"),_=e.useRef(null),F=e.useRef(!0),T=e.useRef(null),E=!x&&!!c;e.useEffect(()=>(F.current=!0,()=>{F.current=!1,T.current&&clearTimeout(T.current)}),[]);const P=e.useCallback(()=>{E&&(k(o??i),N(!0),S("idle"),requestAnimationFrame(()=>{var e;return null==(e=_.current)?void 0:e.select()}))},[E,o,i]),M=e.useCallback(()=>{N(!1),k(""),S("idle")},[]),z=e.useCallback(async()=>{if(c&&"loading"!==C)if(w!==(o??i)){T.current&&clearTimeout(T.current),S("loading");try{if(await c(w),!F.current)return;S("success"),N(!1),T.current=setTimeout(()=>{F.current&&S("idle")},de)}catch{if(!F.current)return;S("error"),T.current=setTimeout(()=>{F.current&&S("idle")},de)}}else M()},[c,w,o,i,M,C]),R=e.useCallback(e=>{"Enter"===e.key?(e.preventDefault(),z()):"Escape"===e.key&&(e.preventDefault(),M())},[z,M]);return"inline"===h?s.jsxs("div",{className:t("group flex items-center justify-between gap-3",j),children:[s.jsx("label",{className:"type-label text-fg-muted truncate",children:a}),v?s.jsxs("div",{className:t(me,pe,he,"flex items-center transition-all","bg-transparent border border-sys-blue/50 ring-1 ring-sys-blue/20","min-w-[100px]"),children:[s.jsx("input",{ref:_,type:d,value:w,onChange:e=>k(e.target.value),onKeyDown:R,placeholder:m,min:p,max:y,step:f,maxLength:g,disabled:"loading"===C,className:t("bg-transparent text-fg-primary focus:outline-none type-data flex-1 min-w-0",u?"w-12 text-right":"w-full")}),u&&s.jsx("span",{className:"text-fg-muted type-data ml-1 shrink-0",children:u}),s.jsx("div",{className:"flex items-center gap-0.5 ml-2 shrink-0",children:"loading"===C?s.jsx(l,{className:"w-3.5 h-3.5 text-fg-muted animate-spin"}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:z,className:"p-0.5 rounded hover:bg-sys-green/15 text-sys-green transition-colors",title:"Save (Enter)",children:s.jsx(n,{className:"w-3 h-3"})}),s.jsx("button",{onClick:M,className:"p-0.5 rounded hover:bg-sys-red/15 text-fg-muted hover:text-sys-red transition-colors",title:"Cancel (Esc)",children:s.jsx(r,{className:"w-3 h-3"})})]})})]}):s.jsxs("div",{className:t(me,pe,he,"flex items-center justify-end transition-all min-w-[80px]","bg-input-bg border border-input-border",E&&"cursor-pointer hover:border-edge-strong"),onClick:E?P:void 0,children:[s.jsx("span",{className:"type-data text-fg-primary",children:i}),"success"===C&&s.jsx(n,{className:"w-3 h-3 text-sys-green ml-1.5 shrink-0"}),"error"===C&&s.jsx(r,{className:"w-3 h-3 text-sys-red ml-1.5 shrink-0"}),"idle"===C&&E&&s.jsx(oe,{className:"w-3 h-3 text-fg-muted ml-1.5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})]})]}):s.jsxs("div",{className:t("group",j),children:[s.jsx("label",{className:"type-label text-fg-muted block mb-1",children:a}),v?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:t(ue,pe,xe,"flex items-center transition-all","bg-transparent border border-sys-blue/50 ring-1 ring-sys-blue/20"),children:[s.jsx("input",{ref:_,type:d,value:w,onChange:e=>k(e.target.value),onKeyDown:R,placeholder:m,min:p,max:y,step:f,maxLength:g,disabled:"loading"===C,className:"w-full bg-transparent text-fg-primary focus:outline-none type-data flex-1 min-w-0"}),u&&s.jsx("span",{className:"text-fg-muted type-data ml-1 shrink-0",children:u}),s.jsx("div",{className:"flex items-center gap-0.5 ml-2 shrink-0",children:"loading"===C?s.jsx(l,{className:"w-3.5 h-3.5 text-fg-muted animate-spin"}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:z,className:"p-1 rounded hover:bg-sys-green/15 text-sys-green transition-colors",title:"Save (Enter)",children:s.jsx(n,{className:"w-3.5 h-3.5"})}),s.jsx("button",{onClick:M,className:"p-1 rounded hover:bg-sys-red/15 text-fg-muted hover:text-sys-red transition-colors",title:"Cancel (Esc)",children:s.jsx(r,{className:"w-3.5 h-3.5"})})]})})]}),b&&s.jsx("p",{className:"type-data-xs text-fg-muted mt-1 ml-3",children:b})]}):s.jsxs("div",{className:t(ue,pe,xe,"flex items-center transition-all","bg-input-bg border border-input-border",E&&"cursor-pointer hover:border-edge-strong"),onClick:E?P:void 0,children:[s.jsx("span",{className:"type-data text-fg-primary flex-1 whitespace-nowrap",children:i}),"success"===C&&s.jsx(n,{className:"w-3.5 h-3.5 text-sys-green shrink-0"}),"error"===C&&s.jsx(r,{className:"w-3.5 h-3.5 text-sys-red shrink-0"}),"idle"===C&&E&&s.jsx(oe,{className:"w-3.5 h-3.5 text-fg-muted opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})]})]})}function fe({label:a,value:o,editValue:c,options:d,onSave:u,readOnly:m=!1,layout:x="stacked",className:h}){const[p,y]=e.useState(!1),[f,g]=e.useState(""),[b,j]=e.useState("idle"),v=e.useRef(null),N=e.useRef(!0),w=e.useRef(null),k=!m&&!!u;e.useEffect(()=>(N.current=!0,()=>{N.current=!1,w.current&&clearTimeout(w.current)}),[]);const C=e.useCallback(()=>{k&&(g(String(c)),y(!0),j("idle"),requestAnimationFrame(()=>{var e;return null==(e=v.current)?void 0:e.focus()}))},[k,c]),S=e.useCallback(()=>{y(!1),g(""),j("idle")},[]),_=e.useCallback(async()=>{if(u&&"loading"!==b)if(f!==String(c)){w.current&&clearTimeout(w.current),j("loading");try{if(await u(f),!N.current)return;j("success"),y(!1),w.current=setTimeout(()=>{N.current&&j("idle")},de)}catch{if(!N.current)return;j("error"),w.current=setTimeout(()=>{N.current&&j("idle")},de)}}else S()},[u,f,c,S,b]),F=e.useCallback(e=>{"Escape"===e.key&&(e.preventDefault(),S())},[S]),T="inline"===x,E=T?me:ue,P=T?he:xe,M=s.jsxs("div",{className:t(E,pe,P,"flex items-center transition-all relative","bg-transparent border border-sys-blue/50 ring-1 ring-sys-blue/20",T&&"min-w-[100px]"),children:[s.jsx("select",{ref:v,value:f,onChange:e=>g(e.target.value),onKeyDown:F,disabled:"loading"===b,className:t("bg-transparent text-fg-primary focus:outline-none appearance-none cursor-pointer type-data flex-1 min-w-0","pr-6"),children:d.map(e=>s.jsx("option",{value:e.value,children:e.label},String(e.value)))}),s.jsx(i,{className:"absolute right-auto w-3.5 h-3.5 text-fg-muted pointer-events-none",style:{right:"loading"===b?"2rem":"3.5rem"}}),s.jsx("div",{className:"flex items-center gap-0.5 ml-1 shrink-0",children:"loading"===b?s.jsx(l,{className:t("text-fg-muted animate-spin",T?"w-3 h-3":"w-3.5 h-3.5")}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:_,className:t("rounded hover:bg-sys-green/15 text-sys-green transition-colors",T?"p-0.5":"p-1"),title:"Save",children:s.jsx(n,{className:T?"w-3 h-3":"w-3.5 h-3.5"})}),s.jsx("button",{onClick:S,className:t("rounded hover:bg-sys-red/15 text-fg-muted hover:text-sys-red transition-colors",T?"p-0.5":"p-1"),title:"Cancel (Esc)",children:s.jsx(r,{className:T?"w-3 h-3":"w-3.5 h-3.5"})})]})})]}),z=s.jsxs("div",{className:t(E,pe,P,"flex items-center transition-all","bg-input-bg border border-input-border",k&&"cursor-pointer hover:border-edge-strong",T?"justify-end min-w-[80px]":""),onClick:k?C:void 0,children:[s.jsx("span",{className:t("type-data text-fg-primary",!T&&"flex-1"),children:o}),"success"===b&&s.jsx(n,{className:t("text-sys-green shrink-0",T?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")}),"error"===b&&s.jsx(r,{className:t("text-sys-red shrink-0",T?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")}),"idle"===b&&k&&s.jsx(i,{className:t("text-fg-muted opacity-0 group-hover:opacity-100 transition-opacity shrink-0",T?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")})]});return T?s.jsxs("div",{className:t("group flex items-center justify-between",h),children:[s.jsx("label",{className:"type-label text-fg-muted shrink-0",children:a}),p?M:z]}):s.jsxs("div",{className:t("group",h),children:[s.jsx("label",{className:"type-label text-fg-muted block mb-1",children:a}),p?M:z]})}async function ge(e){return o("/api/update_web_config",{method:"POST",body:JSON.stringify(e)})}e.memo(function(){const{theme:e}=c(),{themeId:t}=e,a=d.find(e=>e.meta.id===t)??d[0];return s.jsx("div",{className:"h-10 flex items-center justify-center",children:s.jsx("span",{className:"font-medium transition-all duration-300 leading-none text-center text-fg-secondary",style:{fontFamily:"Inter, system-ui, sans-serif",fontSize:"clamp(0.75rem, 0.6rem + 1.5vw, 1.1rem)",letterSpacing:"-0.02em"},children:a.meta.name})})});const be=e.memo(function({compact:e=!1}){const{theme:a,setTheme:l}=c(),{themeId:n}=a;return s.jsx("div",{className:t("grid grid-cols-2 gap-2",e?"w-full min-w-0 self-stretch":"w-full"),children:[...d].reverse().map(a=>{const r=n===a.meta.id,i=a.meta.isDark;return s.jsxs("button",{type:"button",title:a.meta.name,className:t("flex flex-row items-stretch radius-inner transition-all duration-200 ease-out overflow-hidden cursor-pointer",e&&"h-6",r?"ring-2 ring-sys-blue scale-[1.02]":"opacity-70 hover:opacity-100"),onClick:()=>l(a.meta.id),children:[s.jsx("div",{className:t("flex-1 h-full",i?"bg-[#18181b]":"bg-[#EFF0F1]")}),s.jsx("div",{className:"flex flex-col h-full",children:a.display.palette.map((e,t)=>s.jsx("div",{className:"flex flex-1",children:e.map((e,t)=>s.jsx("div",{className:"w-2 h-full",style:{backgroundColor:e}},t))},t))})]},a.meta.id)})})}),je=e.memo(function(){const{theme:t,setTheme:a}=c(),{themeId:l}=t,n="breeze dark"===l,r=e.useCallback(e=>{a(e?"breeze dark":"breeze light")},[a]);return s.jsx(u,{enabled:n,onChange:r,label:s.jsxs(s.Fragment,{children:["Dark Mode: ",n?s.jsx(I,{className:"w-3.5 h-3.5 text-sys-blue inline"}):s.jsx(L,{className:"w-3.5 h-3.5 text-[#e8a517] inline"})]}),tooltip:"Switch between dark and light mode",size:"md"})}),ve=e.memo(function({layout:t="horizontal"}){return e.useEffect(()=>{D()},[]),"toggle-only"===t?s.jsx(je,{}):"thumbnails-only"===t?s.jsx(be,{}):"vertical"===t?s.jsxs("div",{className:"flex flex-col items-start gap-3",children:[s.jsx(je,{}),s.jsx(be,{})]}):s.jsxs("div",{className:"flex items-stretch gap-4",children:[s.jsx("div",{className:"flex-shrink-0 flex items-start",children:s.jsx(je,{})}),s.jsx(be,{compact:!0})]})}),Ne=2e3;function we(s,t,a){const[l,n]=e.useState("idle"),[r,i]=e.useState(null),o=e.useRef(!0),c=e.useRef(null),d=e.useRef(null),u=e.useRef(!1),m=e.useRef("idle"),x=e.useRef(s),h=e.useRef(t),p=e.useRef(a);return m.current=l,x.current=s,h.current=t,p.current=a,e.useEffect(()=>(o.current=!0,()=>{o.current=!1,c.current&&clearTimeout(c.current),d.current&&clearTimeout(d.current)}),[]),{enabled:null!==r?r:s,status:l,toggle:e.useCallback(async e=>{if("loading"===m.current)return;const s=x.current;c.current&&clearTimeout(c.current),d.current&&clearTimeout(d.current),u.current=!1,i(e),n("loading"),c.current=setTimeout(()=>{!u.current&&o.current&&(i(s),n("error"),d.current=setTimeout(()=>{o.current&&(n("idle"),i(null))},Ne))},1e4);try{if(await h.current(e),u.current=!0,c.current&&clearTimeout(c.current),!o.current)return;n("success"),d.current=setTimeout(()=>{var e;o.current&&(n("idle"),i(null),null==(e=p.current)||e.call(p))},Ne)}catch{if(u.current=!0,c.current&&clearTimeout(c.current),!o.current)return;i(s),n("error"),d.current=setTimeout(()=>{o.current&&(n("idle"),i(null))},Ne)}},[])}}function ke(){const{latitude:a,longitude:i,enabled:o,setLocation:c,enable:d,disable:u,clear:h}=m(),[p,y]=e.useState(!1),[f,g]=e.useState(""),[b,j]=e.useState(""),[v,N]=e.useState("idle"),[w,k]=e.useState(null),C=e.useRef(null),S=e.useRef(null),_=e.useRef(!0);e.useEffect(()=>(_.current=!0,()=>{_.current=!1,S.current&&clearTimeout(S.current)}),[]);const F=()=>{y(!1),k(null)};e.useEffect(()=>{if(!p)return;const e=e=>{"loading"!==v&&C.current&&!C.current.contains(e.target)&&F()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[p,v]);const T=null!==a&&null!==i;return s.jsx($,{children:s.jsxs("div",{ref:C,children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx(U,{icon:s.jsx(ce,{}),title:"Stealth"}),s.jsxs("div",{className:"flex items-center gap-1",children:[T&&!p&&s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>{o?u():d()},className:t("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2 mr-2",o?"bg-toggle-on border-toggle-on":"bg-toggle-off border-edge-subtle"),title:o?"Disable stealth location":"Enable stealth location",children:s.jsx("span",{className:t("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",o?"translate-x-5":"translate-x-0.5")})}),s.jsx("button",{onClick:()=>{h(),y(!1)},className:"p-2 rounded-lg transition-colors text-fg-muted hover:text-sys-red hover:bg-sys-red/10",title:"Clear stealth location",children:s.jsx(M,{className:"w-4 h-4"})})]}),p?s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:F,disabled:"loading"===v,className:t("p-2 rounded-lg transition-colors","loading"===v?"text-fg-muted cursor-not-allowed":"text-fg-muted hover:text-sys-red hover:bg-sys-red/10"),title:"Cancel",children:s.jsx(r,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{if("loading"===v)return;S.current&&clearTimeout(S.current);const e=((e,s)=>{const t=parseFloat(e),a=parseFloat(s);return isNaN(t)||isNaN(a)?"Please enter valid numbers":t<-90||t>90?"Latitude must be between -90 and 90":a<-180||a>180?"Longitude must be between -180 and 180":0===t&&0===a?"Coordinates (0, 0) are invalid":null})(f,b);if(e)return void k(e);N("loading"),k(null);const s=parseFloat(f),t=parseFloat(b);c(s,t),o||d(),N("success"),S.current=setTimeout(()=>{_.current&&(N("idle"),y(!1))},1e3)},disabled:"loading"===v,className:t("p-2 rounded-lg transition-colors","loading"===v?"text-sys-blue cursor-wait":"success"===v?"text-sys-green":"error"===v?"text-sys-red":"text-sys-green hover:bg-sys-green/10"),title:"Save",children:"loading"===v?s.jsx(l,{className:"w-4 h-4 animate-spin"}):"success"===v?s.jsx(n,{className:"w-4 h-4"}):"error"===v?s.jsx(r,{className:"w-4 h-4"}):s.jsx(n,{className:"w-4 h-4"})})]}):s.jsx("button",{onClick:()=>{g((null==a?void 0:a.toFixed(6))??""),j((null==i?void 0:i.toFixed(6))??""),k(null),y(!0)},className:"p-2 rounded-lg transition-colors text-fg-muted hover:text-fg-primary hover:bg-subtle",title:T?"Edit stealth location":"Set stealth location",children:s.jsx(oe,{className:"w-4 h-4"})})]})]}),s.jsx("div",{className:"bg-sys-cyan/5 rounded-xl p-3 mb-4",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(x,{className:"w-4 h-4 text-sys-cyan flex-shrink-0 mt-0.5"}),s.jsxs("p",{className:"type-body-sm text-fg-muted",children:[s.jsx("span",{className:"text-fg-secondary",children:"Stealth mode"})," allows you to appear on the map and in topology analysis without broadcasting your location. Coordinates are stored locally in your browser only — ",s.jsx("span",{className:"text-sys-cyan",children:"never sent to config.yaml or the mesh"}),"."]})]})}),w&&s.jsx("div",{className:"text-xs mb-3 px-2 py-1.5 rounded-md text-sys-red bg-sys-red/10",children:w}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"type-label text-fg-muted block mb-1",children:p?"Latitude (°)":"Latitude"}),s.jsx("div",{className:t("h-[38px] rounded-full px-4 flex items-center transition-colors","bg-subtle-fill"),children:p?s.jsx("input",{type:"number",value:f,onChange:e=>g(e.target.value),step:"0.000001",min:"-90",max:"90",placeholder:"e.g. 34.052234",className:"w-full bg-transparent text-fg-primary focus:outline-none type-data placeholder:text-fg-muted/50"}):s.jsx("span",{className:t("type-data",T&&o?"text-fg-primary":"text-fg-muted"),children:T?a.toFixed(6):"Not set"})})]}),s.jsxs("div",{children:[s.jsx("label",{className:"type-label text-fg-muted block mb-1",children:p?"Longitude (°)":"Longitude"}),s.jsx("div",{className:t("h-[38px] rounded-full px-4 flex items-center transition-colors","bg-subtle-fill"),children:p?s.jsx("input",{type:"number",value:b,onChange:e=>j(e.target.value),step:"0.000001",min:"-180",max:"180",placeholder:"e.g. -118.243685",className:"w-full bg-transparent text-fg-primary focus:outline-none type-data placeholder:text-fg-muted/50"}):s.jsx("span",{className:t("type-data",T&&o?"text-fg-primary":"text-fg-muted"),children:T?i.toFixed(6):"Not set"})})]})]}),T&&!p&&s.jsx("div",{className:"mt-3 pt-3 border-t border-edge-subtle",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:t("w-2 h-2 rounded-full",o?"bg-sys-green":"bg-fg-muted")}),s.jsx("span",{className:"type-body-sm text-fg-muted",children:o?"Stealth location active — you appear on maps with these coordinates":"Stealth location disabled — coordinates saved but not in use"})]})})]})})}const Ce=[{value:7.8,label:"7.8 kHz"},{value:10.4,label:"10.4 kHz"},{value:15.6,label:"15.6 kHz"},{value:20.8,label:"20.8 kHz"},{value:31.25,label:"31.25 kHz"},{value:41.7,label:"41.7 kHz"},{value:62.5,label:"62.5 kHz"},{value:125,label:"125 kHz"},{value:250,label:"250 kHz"},{value:500,label:"500 kHz"}],Se=[5,6,7,8,9,10,11,12],_e=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}],Fe="radioConfig";function Te(e){if(!e)return"Never";const s=Date.now()-1e3*e,t=Math.floor(s/6e4),a=Math.floor(s/36e5),l=Math.floor(s/864e5);return t<1?"Just now":t<60?`${t}m ago`:a<24?`${a}h ago`:l<365?`${l}d ago`:`${Math.floor(l/365)}y ago`}function Ee({node:e,level:a,expandedKeys:l,selectedKeyId:n,globalFloodPolicy:r,onSelect:i,onToggle:o}){const c=l.has(e.id),d=n===e.id,u=e.children&&e.children.length>0,m="allow"===r;return s.jsxs("div",{children:[s.jsxs("div",{className:t("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",d?"bg-sys-blue/15":"hover:bg-subtle-fill",m&&"opacity-50 cursor-not-allowed"),style:{marginLeft:16*a+"px"},onClick:()=>!m&&i(e.id),children:[u?s.jsx("button",{onClick:s=>{s.stopPropagation(),o(e.id)},className:"p-1 hover:bg-subtle-fill-hover rounded-full transition-colors",children:s.jsx(te,{className:t("w-3.5 h-3.5 text-fg-muted transition-transform",c&&"rotate-90")})}):s.jsx("span",{className:"w-5"}),s.jsx(ne,{className:"w-4 h-4 text-sys-blue flex-shrink-0"}),s.jsx("span",{className:"type-data text-fg-primary flex-1 truncate",children:e.name}),s.jsx("span",{className:"type-data-xs text-fg-muted hidden sm:inline",title:e.last_used?new Date(1e3*e.last_used).toLocaleString():void 0,children:Te(e.last_used)}),s.jsx("span",{className:t("type-data-xs px-2 py-0.5 rounded-full","allow"===e.floodPolicy?"bg-sys-green/15 text-sys-green":"bg-sys-red/15 text-sys-red"),children:"allow"===e.floodPolicy?"Allow":"Deny"})]}),u&&c&&s.jsx("div",{children:e.children.map(e=>s.jsx(Ee,{node:e,level:a+1,expandedKeys:l,selectedKeyId:n,globalFloodPolicy:r,onSelect:i,onToggle:o},e.id))})]})}function Pe(){const[a,l]=e.useState(K),[n,r]=e.useState(V),[i,o]=e.useState(!1),c=e.useCallback(e=>{l(e),H(e)},[]),d=e.useCallback(e=>{const s=parseFloat(e.target.value);r(s),O(s)},[]),m=e.useCallback(async()=>{i||(o(!0),await q(),o(!1))},[i]);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(u,{enabled:a,onChange:c,label:s.jsxs(s.Fragment,{children:["Sound: ",s.jsx("span",{className:a?"text-sys-green":"text-sys-red",children:a?"On":"Off"})]}),tooltip:"Enable or disable UI sound effects and haptic audio feedback",size:"md"}),s.jsx(v,{color:"primary",outline:!0,onClick:m,disabled:!a||i,className:"w-16 justify-center",children:i?"…":"Test"})]}),s.jsxs("div",{className:t("flex items-center gap-3",!a&&"opacity-40 pointer-events-none"),children:[s.jsx("span",{className:"type-label text-fg-muted w-14 shrink-0",children:"Volume"}),s.jsx("input",{type:"range",min:0,max:1,step:.05,value:n,onChange:d,className:"flex-1 accent-sys-blue h-1.5 cursor-pointer"}),s.jsxs("span",{className:"data-box w-16 justify-center",children:[Math.round(100*n),"%"]})]})]})}function Me(){var a,r,i,c,d,m;const{stats:D,setMode:I,clearModeMutation:L,setDutyCycleConfig:K,clearDutyCycleMutation:V,fetchStats:H,startMutation:O,clearMutation:q}=h(),te=null==(a=null==D?void 0:D.config)?void 0:a.radio,ne=null==(r=null==D?void 0:D.config)?void 0:r.repeater,oe=null==(i=null==D?void 0:D.config)?void 0:i.duty_cycle,ce=(null==D?void 0:D.node_name)||(null==(c=null==D?void 0:D.config)?void 0:c.node_name)||"Unknown Node",de=(null==ne?void 0:ne.mode)??"forward",ue=(null==oe?void 0:oe.enforcement_enabled)??!1,me=null==(d=null==D?void 0:D.config)?void 0:d.delays,xe=e.useRef(!0);e.useEffect(()=>(xe.current=!0,()=>{xe.current=!1}),[]);const he=null==(m=null==D?void 0:D.config)?void 0:m.web,[pe,be]=e.useState([]),[je,Ne]=e.useState(!1),[Te,Me]=e.useState(null),[ze,Re]=e.useState(!1),[De,Ie]=e.useState(""),[Le,Ae]=e.useState(null),[Ke,Ve]=e.useState(!1),[He,Oe]=e.useState(null),[qe,$e]=e.useState(!1),[Be,Xe]=e.useState(!1),[Je,Ue]=e.useState(!1),[We,Ye]=e.useState([]),[Ge,Qe]=e.useState(!1),[Ze,es]=e.useState(null),[ss,ts]=e.useState(()=>"allow"===localStorage.getItem("pymc:globalFloodPolicy")?"allow":"deny"),as=e.useCallback(e=>{ts(e),localStorage.setItem("pymc:globalFloodPolicy",e)},[]),[ls,ns]=e.useState(!1),[rs,is]=e.useState(null),[os,cs]=e.useState(new Set),[ds,us]=e.useState(!1),[ms,xs]=e.useState(!1),[hs,ps]=e.useState(!1),[ys,fs]=e.useState(null),[gs,bs]=e.useState(null),[js,vs]=e.useState(""),[Ns,ws]=e.useState("allow"),[ks,Cs]=e.useState(!1),[Ss,_s]=e.useState(!0),[Fs,Ts]=e.useState(!1),[Es,Ps]=e.useState(!0),[Ms,zs]=e.useState("idle"),[Rs,Ds]=e.useState(!1),[Is,Ls]=e.useState(!1),As=e.useCallback(()=>{const e=null==me?void 0:me.tx_delay_factor;return e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??1:"number"==typeof e?e:1},[me]),Ks=e.useCallback(()=>{const e=null==me?void 0:me.direct_tx_delay_factor;return"number"==typeof e?e:.5},[me]),Vs=e.useCallback(()=>{const e=null==oe?void 0:oe.max_airtime_percent;return"number"==typeof e?e:e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??6:6},[oe]),Hs=we("forward"===de,async e=>{await I(e?"forward":"monitor")},L),Os=we(ue,async e=>{await K({max_airtime_percent:Vs(),enforcement_enabled:e})},V),qs=we((null==he?void 0:he.cors_enabled)??!1,async e=>{var s;const t=await ge({web:{cors_enabled:e}});if(!t.success&&!(null==(s=t.data)?void 0:s.persisted))throw new Error("CORS update failed");await H()}),$s=e.useCallback(async e=>{O(Fe);try{const s=await p(e);if(!s.success)throw new Error(s.error||"Failed to save");await H({force:!0}).catch(()=>{})}finally{q(Fe)}},[O,q,H]);e.useEffect(()=>{(async()=>{Ps(!0);try{const e=await S();e.success&&e.data?Ts(e.data.exists):Ts(!1);const s=null==he?void 0:he.web_path;_s(!s||""===s)}catch{Ts(!1)}finally{Ps(!1)}})()},[null==he?void 0:he.web_path]);const Bs=async e=>{var s;if("loading"!==Ms){zs("loading");try{const t=await ge({web:{web_path:e?null:"/opt/pymc_console/web/html"}});if(!xe.current)return;t.success||(null==(s=t.data)?void 0:s.persisted)?(_s(e),zs("success"),Ds(!0),setTimeout(()=>{xe.current&&zs("idle")},2e3)):(zs("error"),setTimeout(()=>{xe.current&&zs("idle")},2e3))}catch{if(!xe.current)return;zs("error"),setTimeout(()=>{xe.current&&zs("idle")},2e3)}}},Xs=e.useCallback(async()=>{Ne(!0),Me(null);try{const e=await async function(){return o("/auth/tokens")}();be(e.tokens||[])}catch(e){Me(e instanceof Error?e.message:"Failed to fetch tokens")}finally{Ne(!1)}},[]);e.useEffect(()=>{Xs()},[Xs]);const Js=async()=>{if(De.trim()){$e(!0),Me(null);try{const e=await async function(e){return o("/auth/tokens",{method:"POST",body:JSON.stringify({name:e})})}(De.trim());Ae(e.token||null),Re(!1),Ve(!0),Ie(""),await Xs()}catch(e){Me(e instanceof Error?e.message:"Failed to create token")}finally{$e(!1)}}else Me("Token name is required")},Us=e=>e?new Date(1e3*e).toLocaleString():"Never",Ws=e.useCallback(e=>{const s=new Map,t=[];return e.forEach(e=>{const t={id:e.id,name:e.name,floodPolicy:e.flood_policy,transport_key:e.transport_key,last_used:e.last_used,parent_id:e.parent_id,children:[]};s.set(e.id,t)}),s.forEach(e=>{e.parent_id&&s.has(e.parent_id)?s.get(e.parent_id).children.push(e):t.push(e)}),t},[]),Ys=e.useCallback(async()=>{Qe(!0),es(null);try{const e=await k();if(e.success&&e.data){const s=Ws(e.data);Ye(s),is(e=>{if(null===e)return null;const t=s=>{for(const a of s){if(a.id===e)return!0;if(a.children&&t(a.children))return!0}return!1};return t(s)?e:null})}else es(e.error||"Failed to load transport keys")}catch(e){es(e instanceof Error?e.message:"Unknown error occurred")}finally{Qe(!1)}},[Ws]);e.useEffect(()=>{Ys(),C().then(e=>{e.success&&e.data&&as(e.data.global_flood_allow?"allow":"deny")}).catch(()=>{})},[Ys]);const Gs=e.useCallback((e,s)=>{for(const t of e){if(t.id===s)return t;if(t.children){const e=Gs(t.children,s);if(e)return e}}return null},[]),Qs=e.useCallback(()=>{if(!rs)return;const e=Gs(We,rs);return null==e?void 0:e.name},[rs,We,Gs]),Zs=e.useCallback(e=>{cs(s=>{const t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},[]),et=async()=>{if(js.trim()){Cs(!0),es(null);try{const e=await T({name:js.trim(),flood_policy:Ns,parent_id:rs??void 0});e.success?(await Ys(),us(!1),vs(""),ws("allow")):es(e.error||"Failed to add transport key")}catch(e){es(e instanceof Error?e.message:"Failed to add transport key")}finally{Cs(!1)}}else es("Key name is required")},st=e.useCallback(()=>{if(!rs)return;const e=Gs(We,rs);e&&(fs({...e}),xs(!0))},[rs,We,Gs]);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&(ds&&(us(!1),vs(""),ws("allow")),ms&&(xs(!1),fs(null)),hs&&(ps(!1),bs(null)),ze&&(Re(!1),Ie("")),Ke&&(Ve(!1),Ae(null)))};if(ds||ms||hs||ze||Ke)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ds,ms,hs,ze,Ke]);const tt=e.useCallback(()=>{if(!rs)return;const e=Gs(We,rs);e&&(bs(e),ps(!0))},[rs,We,Gs]);return s.jsxs(B,{children:[s.jsx(X,{title:"Configuration",icon:s.jsx(y,{})}),s.jsxs(J,{children:[s.jsxs(W,{template:"standard",children:[s.jsx(Y,{span:12,md:6,children:s.jsxs($,{neomorphic:!0,children:[s.jsx(U,{icon:s.jsx(f,{}),title:"Repeater Settings"}),ne?s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx("div",{className:"col-span-2",children:s.jsx(ye,{label:"Node Name",value:ce,onSave:async e=>$s({node_name:e}),placeholder:"Enter node name",maxLength:50})}),s.jsx(ye,{label:"Latitude",value:0!==ne.latitude?ne.latitude.toFixed(6):"Not set",editValue:String(ne.latitude),type:"number",suffix:"°",step:1e-6,min:-90,max:90,onSave:async e=>$s({latitude:parseFloat(e)})}),s.jsx(ye,{label:"Longitude",value:0!==ne.longitude?ne.longitude.toFixed(6):"Not set",editValue:String(ne.longitude),type:"number",suffix:"°",step:1e-6,min:-180,max:180,onSave:async e=>$s({longitude:parseFloat(e)})}),s.jsx(ye,{label:"Advert Interval",value:ne.send_advert_interval_hours>0?`${ne.send_advert_interval_hours}h`:"Disabled",editValue:String(ne.send_advert_interval_hours),type:"number",suffix:"hours",min:0,max:48,description:"0 = disabled, 3-48 hours",onSave:async e=>$s({flood_advert_interval_hours:parseInt(e,10)})}),s.jsx(ye,{label:"Score-based TX",value:ne.use_score_for_tx?"Enabled":"Disabled",readOnly:!0})]}):s.jsx("p",{className:"text-fg-muted",children:"Loading repeater settings..."})]})}),s.jsx(Y,{span:12,md:6,children:s.jsxs($,{neomorphic:!0,children:[s.jsx(U,{icon:s.jsx(ae,{}),title:"Radio Configuration"}),te?s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(ye,{label:"Frequency",value:g(te.frequency),editValue:(te.frequency/1e6).toFixed(3),type:"number",suffix:"MHz",step:.001,min:400,max:930,onSave:async e=>$s({frequency_mhz:parseFloat(e)})}),s.jsx(ye,{label:"TX Power",value:`${te.tx_power} dBm`,editValue:String(te.tx_power),type:"number",suffix:"dBm",min:2,max:30,onSave:async e=>$s({tx_power:parseInt(e,10)})}),s.jsx(fe,{label:"Bandwidth",value:b(te.bandwidth),editValue:te.bandwidth/1e3,options:Ce,onSave:async e=>$s({bandwidth_khz:parseFloat(e)})}),s.jsx(fe,{label:"Spreading Factor",value:`SF${te.spreading_factor}`,editValue:te.spreading_factor,options:Se.map(e=>({value:e,label:`SF${e}`})),onSave:async e=>$s({spreading_factor:parseInt(e,10)})}),s.jsx(fe,{label:"Coding Rate",value:`4/${te.coding_rate}`,editValue:te.coding_rate,options:_e,onSave:async e=>$s({coding_rate:parseInt(e,10)})}),s.jsx(ye,{label:"Preamble",value:`${te.preamble_length} symbols`,readOnly:!0})]}):s.jsx("p",{className:"text-fg-muted",children:"Loading radio configuration..."})]})})]}),s.jsxs(W,{template:"standard",children:[s.jsx(Y,{span:12,md:6,children:s.jsxs($,{neomorphic:!0,children:[s.jsx(U,{icon:s.jsx(j,{}),title:"Operating Mode"}),s.jsx("p",{className:"type-label text-fg-muted mb-3",children:"Control how the repeater handles packets"}),s.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[s.jsxs("div",{className:"flex-1 space-y-4",children:[s.jsx(u,{enabled:Hs.enabled,onChange:Hs.toggle,label:"Repeat",tooltip:"Toggles repeater or monitor mode. In monitor mode, the repeater will not repeat packets from the mesh.",status:Hs.status,size:"md"}),s.jsx(u,{enabled:Os.enabled,onChange:Os.toggle,label:"Duty Cycle",tooltip:"Limit transmission time to comply with airtime utilization regulations",status:Os.status,size:"md"}),s.jsx(ye,{label:"Max Airtime",layout:"inline",value:`${Vs().toFixed(1)}%`,editValue:String(Vs()),type:"number",suffix:"%",step:.5,min:.1,max:100,onSave:async e=>{await K({max_airtime_percent:parseFloat(e),enforcement_enabled:ue}),V()}})]}),s.jsx("div",{className:"hidden lg:block w-px bg-border-subtle"}),s.jsxs("div",{className:"flex-1 pt-4 lg:pt-0 border-t lg:border-t-0 border-edge-subtle",children:[s.jsx("label",{className:"type-label text-fg-muted block mb-3",children:"TX Delays"}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(ye,{label:"Flood",layout:"inline",value:`${As().toFixed(2)}x`,editValue:String(As()),type:"number",suffix:"x",step:.1,min:0,max:5,onSave:async e=>$s({tx_delay_factor:parseFloat(e)})}),s.jsx(ye,{label:"Direct",layout:"inline",value:`${Ks().toFixed(2)}s`,editValue:String(Ks()),type:"number",suffix:"s",step:.1,min:0,max:5,onSave:async e=>$s({direct_tx_delay_factor:parseFloat(e)})})]})]})]})]})}),s.jsx(Y,{span:12,md:6,children:s.jsxs($,{neomorphic:!0,children:[s.jsx(U,{icon:s.jsx(y,{}),title:"App Settings"}),s.jsx("p",{className:"type-body-sm text-fg-muted mb-4",children:"Appearance and web server options."}),s.jsxs("div",{className:"space-y-4",children:[s.jsx(u,{enabled:qs.enabled,onChange:qs.toggle,label:"Enable CORS",tooltip:"Allow cross-origin API access",status:qs.status,size:"md"}),s.jsx("div",{children:s.jsx(ve,{})}),s.jsx(Pe,{})]})]})})]}),s.jsx(W,{template:"auto",children:s.jsxs($,{neomorphic:!0,children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[s.jsx(U,{icon:s.jsx(re,{}),title:"Regions Transport Keys",subtitle:"Manage regional key hierarchy for flood control"}),s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[s.jsxs(v,{color:"primary",outline:!0,onClick:()=>us(!0),disabled:"allow"===ss,children:[s.jsx(z,{"data-slot":"icon"}),"Add"]}),s.jsx(v,{color:"primary",outline:!0,onClick:st,disabled:!rs||"allow"===ss,children:"Edit"}),s.jsx(v,{color:"danger",outline:!0,onClick:tt,disabled:!rs||"allow"===ss,children:"Delete"})]})]}),s.jsx("div",{className:"bg-subtle-fill radius-inner p-4 mb-4",children:s.jsx(u,{enabled:"deny"===ss,onChange:e=>(async e=>{ns(!0),es(null);try{const s=await F("allow"===e);s.success?as(e):es(s.error||"Failed to update global flood policy")}catch(s){es(s instanceof Error?s.message:"Failed to update global flood policy")}finally{ns(!1)}})(e?"deny":"allow"),label:s.jsxs(s.Fragment,{children:["Require Transport Keys: ",s.jsx("span",{className:"deny"===ss?"text-sys-green":"text-sys-red",children:"deny"===ss?"On":"Off"})]}),tooltip:"When enabled, only packets with matching transport keys are forwarded. When disabled, all packets flood freely.",status:ls?"loading":"idle",disabled:ls,dangerOff:!0,size:"md",className:"flex-row-reverse justify-between w-full"})}),Ze&&s.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-sys-red bg-sys-red/10",children:Ze}),s.jsx("div",{className:"bg-subtle-fill radius-inner p-4 min-h-[120px]",children:Ge?s.jsxs("div",{className:"flex items-center justify-center py-6",children:[s.jsx(l,{className:"w-5 h-5 animate-spin text-sys-blue mr-2"}),s.jsx("span",{className:"type-body-sm text-fg-muted",children:"Loading transport keys..."})]}):0===We.length?s.jsxs("div",{className:"text-center py-6",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-subtle-fill mx-auto mb-3 flex items-center justify-center",children:s.jsx(re,{className:"w-6 h-6 text-fg-muted/50"})}),s.jsx("p",{className:"type-body text-fg-muted",children:"No transport keys found"}),s.jsx("p",{className:"type-body-sm text-fg-muted/70 mt-1",children:"Add your first transport key to get started"})]}):s.jsx("div",{className:"space-y-1",children:We.map(e=>s.jsx(Ee,{node:e,level:0,expandedKeys:os,selectedKeyId:rs,globalFloodPolicy:ss,onSelect:is,onToggle:Zs},e.id))})})]})}),s.jsx(W,{template:"auto",children:s.jsxs($,{neomorphic:!0,children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[s.jsx(U,{icon:s.jsx(G,{}),title:"API Tokens",subtitle:"Manage API tokens for machine-to-machine authentication"}),s.jsxs(v,{color:"primary",outline:!0,onClick:()=>Re(!0),children:[s.jsx(z,{"data-slot":"icon"}),"Create Token"]})]}),s.jsx("div",{className:"bg-sys-cyan/5 radius-inner p-4 mb-4",children:s.jsxs("div",{className:"flex gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-sys-cyan/20 flex items-center justify-center flex-shrink-0",children:s.jsx(x,{className:"w-4 h-4 text-sys-cyan"})}),s.jsxs("div",{className:"type-body-sm text-fg-muted",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-secondary",children:"API tokens"})," are used for machine-to-machine authentication. Include the token in the ",s.jsx("code",{className:"type-code bg-sys-cyan/20 px-1.5 py-0.5 rounded-full text-sys-cyan",children:"X-API-Key"})," header when making API requests."]}),s.jsx("p",{className:"mt-1 text-fg-muted/70",children:"Tokens are only shown once at creation. Store them securely."})]})]})}),Te&&s.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-sys-red bg-sys-red/10",children:Te}),je&&0===pe.length?s.jsxs("div",{className:"flex items-center justify-center py-6",children:[s.jsx(l,{className:"w-5 h-5 animate-spin text-sys-blue mr-2"}),s.jsx("span",{className:"type-body-sm text-fg-muted",children:"Loading tokens..."})]}):pe.length>0?s.jsx("div",{className:"space-y-2",children:pe.map(e=>s.jsx("div",{className:"bg-subtle-fill hover:bg-subtle-fill-strong radius-inner p-4 transition-base",children:s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-sys-blue/10 flex items-center justify-center flex-shrink-0",children:s.jsx(G,{className:"w-5 h-5 text-sys-blue"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"type-body text-fg-primary font-medium truncate",children:e.name}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-0.5",children:[s.jsxs("span",{className:"type-data-sm text-fg-muted truncate",children:["Created: ",Us(e.created_at)]}),s.jsxs("span",{className:"type-data-sm text-fg-muted truncate",children:["Last used: ",Us(e.last_used)]})]})]})]}),s.jsxs(v,{color:"danger",outline:!0,onClick:()=>Oe({id:e.id,name:e.name}),disabled:Be,children:[s.jsx(M,{"data-slot":"icon"}),"Revoke"]})]})},e.id))}):s.jsxs("div",{className:"bg-subtle-fill radius-inner p-6 text-center",children:[s.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:s.jsx(G,{className:"w-7 h-7 text-fg-muted/50"})}),s.jsx("h3",{className:"type-body text-fg-primary font-medium mb-1",children:"No API Tokens"}),s.jsx("p",{className:"type-body-sm text-fg-muted mb-4",children:"Create a token to enable API access"}),s.jsx(v,{color:"primary",outline:!0,onClick:()=>Re(!0),children:"Create Your First Token"})]})]})}),s.jsx(W,{template:"auto",children:s.jsxs($,{neomorphic:!0,children:[s.jsx(U,{icon:s.jsx(ie,{}),title:"Web Frontend",subtitle:"Choose which web interface to use",className:"mb-4"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("label",{className:t("flex items-start gap-3 p-4 bg-subtle-fill radius-card border-2 cursor-pointer transition-base",Ss?"border-sys-blue bg-sys-blue/5":"border-transparent hover:border-sys-blue/30","loading"===Ms&&"opacity-50 pointer-events-none"),children:[s.jsx("input",{type:"radio",name:"frontend",checked:Ss,onChange:()=>Bs(!0),disabled:"loading"===Ms,className:"mt-1 h-4 w-4 text-sys-blue focus:ring-sys-blue focus:ring-offset-bg-elevated"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"type-body text-fg-primary font-medium",children:"Default Frontend"}),s.jsx("a",{href:"https://github.com/rightup/pyMC_Repeater",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"type-data-xs bg-sys-cyan/15 text-sys-cyan px-2.5 py-0.5 rounded-full font-medium hover:bg-sys-cyan/25 transition-colors",children:"@RightUp"})]}),s.jsx("div",{className:"type-body-sm text-fg-muted mt-1",children:"Built-in pyMC Repeater web interface"}),s.jsx("div",{className:"type-data-xs text-fg-muted/60 mt-1",children:"/opt/pymc_repeater/repeater/web/html"})]})]}),s.jsxs("label",{className:t("flex items-start gap-3 p-4 bg-subtle-fill radius-card border-2 cursor-pointer transition-base",Ss?"border-transparent hover:border-sys-blue/30":"border-sys-blue bg-sys-blue/5","loading"===Ms&&"opacity-50 pointer-events-none"),children:[s.jsx("input",{type:"radio",name:"frontend",checked:!Ss,onChange:()=>Bs(!1),disabled:"loading"===Ms,className:"mt-1 h-4 w-4 text-sys-blue focus:ring-sys-blue focus:ring-offset-bg-elevated"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"type-body text-fg-primary font-medium",children:"PyMC Console"}),s.jsx("span",{className:"type-data-xs bg-sys-indigo/15 text-sys-indigo px-2.5 py-0.5 rounded-full font-medium",children:"@Treehouse ⚡"})]}),s.jsx("div",{className:"type-body-sm text-fg-muted mt-1",children:"Alternative web interface for pyMC Repeater"}),s.jsx("div",{className:"type-data-xs text-fg-muted/60 mt-1",children:"/opt/pymc_console/web/html"})]})]})]}),!Es&&s.jsx("div",{className:t("bg-subtle-fill radius-card p-4",Fs?"border border-sys-green/20":"border border-sys-cyan/20"),children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:t("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",Fs?"bg-sys-green/20":"bg-sys-cyan/20"),children:Fs?s.jsx(Q,{className:"w-4 h-4 text-sys-green"}):s.jsx(x,{className:"w-4 h-4 text-sys-cyan"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"type-body text-fg-primary font-medium",children:Fs?"PyMC Console has been detected":"PyMC Console Not Installed"}),Fs?s.jsxs("p",{className:"type-body-sm text-fg-muted mt-1",children:["PyMC Console is installed at ",s.jsx("code",{className:"type-code bg-sys-green/10 px-1.5 py-0.5 rounded-full text-sys-green",children:"/opt/pymc_console/web/html"})]}):s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"type-body-sm text-fg-muted mt-1 mb-3",children:["PyMC Console must be installed at ",s.jsx("code",{className:"type-code bg-sys-cyan/10 px-1.5 py-0.5 rounded-full text-sys-cyan",children:"/opt/pymc_console/web/html"})," before selecting this option."]}),s.jsxs(v,{color:"primary",outline:!0,href:"https://github.com/dmduran12/pymc_console-dist",children:[s.jsx(le,{"data-slot":"icon"}),"PyMC Console Install Instructions"]})]})]})]})}),Rs&&s.jsx("div",{className:"bg-subtle-fill radius-card p-4 border border-sys-indigo/30",children:s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[s.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-sys-indigo/20 flex items-center justify-center flex-shrink-0",children:s.jsx(Z,{className:"w-4 h-4 text-sys-indigo"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"type-body text-fg-primary font-medium",children:"Service restart required"}),s.jsx("p",{className:"type-body-sm text-fg-muted mt-1",children:"Web frontend changes will take effect after restarting the pymc-repeater service."})]})]}),s.jsx(v,{color:"warning",outline:!0,onClick:async()=>{if(!Is){Ls(!0);try{await _(),Ds(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{Ds(!1),setTimeout(()=>{window.location.reload()},3e3)}}},disabled:Is,children:Is?s.jsxs(s.Fragment,{children:[s.jsx(l,{"data-slot":"icon",className:"animate-spin"}),"Restarting..."]}):s.jsxs(s.Fragment,{children:[s.jsx(ee,{"data-slot":"icon"}),"Restart Now"]})})]})})]})]})}),D&&s.jsx(W,{template:"auto",children:s.jsx(A,{nodeName:ce,repeaterVersion:D.version,coreVersion:D.core_version,localHash:D.local_hash,publicKey:D.public_key})}),D&&(0===(null==ne?void 0:ne.latitude)||!(null==ne?void 0:ne.latitude))&&(0===(null==ne?void 0:ne.longitude)||!(null==ne?void 0:ne.longitude))&&s.jsx(W,{template:"auto",children:s.jsx(ke,{})})]}),ze&&s.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&Re(!1),role:"dialog","aria-modal":"true","aria-labelledby":"create-token-modal-title",children:s.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[s.jsx("h3",{id:"create-token-modal-title",className:"type-micro mb-4",children:"Create API Token"}),s.jsxs("div",{className:"space-y-4",children:[s.jsx(N,{label:"Token Name",type:"text",value:De,onChange:e=>Ie(e.target.value),placeholder:"e.g., Production Server, CI/CD Pipeline",description:"Give your token a descriptive name to identify its purpose",onKeyDown:e=>"Enter"===e.key&&Js(),autoFocus:!0}),s.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[s.jsx(v,{color:"muted",outline:!0,onClick:()=>{Re(!1),Ie(""),Me(null)},disabled:qe,children:"Cancel"}),s.jsx(v,{color:"primary",onClick:Js,disabled:qe||!De.trim(),children:qe?s.jsxs(s.Fragment,{children:[s.jsx(l,{"data-slot":"icon",className:"animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),Ke&&Le&&s.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&Ve(!1),role:"dialog","aria-modal":"true","aria-labelledby":"show-token-modal-title",children:s.jsxs("div",{className:"surface-modal radius-card p-6 max-w-lg w-full",children:[s.jsx("h3",{id:"show-token-modal-title",className:"type-micro mb-4",children:"Token Created Successfully"}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"bg-sys-indigo/10 border border-sys-indigo/30 radius-inner p-3",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Z,{className:"w-4 h-4 text-sys-indigo flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm text-fg-secondary",children:[s.jsx("strong",{children:"Save this token now!"})," For security reasons, it will not be shown again."]})]})}),s.jsxs("div",{children:[s.jsx("label",{className:"type-label text-fg-primary block mb-1.5",children:"Your API Token"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(w,{value:Le,readOnly:!0,className:"flex-1 font-mono"}),s.jsxs(v,{color:"primary",outline:!0,onClick:()=>{Le&&(navigator.clipboard.writeText(Le),Ue(!0),setTimeout(()=>Ue(!1),2e3))},children:[Je?s.jsx(n,{"data-slot":"icon",className:"text-sys-green"}):s.jsx(se,{"data-slot":"icon"}),Je?"Copied!":"Copy"]})]})]}),s.jsxs("div",{className:"bg-sys-cyan/10 border border-sys-cyan/30 radius-inner p-3",children:[s.jsx("p",{className:"text-sm text-fg-secondary mb-2",children:s.jsx("strong",{children:"Usage Example:"})}),s.jsxs("code",{className:"block bg-sys-cyan/20 px-3 py-2 rounded type-code text-sys-cyan overflow-x-auto",children:['curl -H "X-API-Key: ',Le.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),s.jsx("div",{className:"flex justify-end mt-6",children:s.jsx(v,{color:"primary",onClick:()=>{Ve(!1),Ae(null)},children:"Done"})})]})]})}),s.jsx(R,{isOpen:!!He,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${null==He?void 0:He.name}'? This action cannot be undone.`,confirmLabel:Be?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:async()=>{if(He){Xe(!0),Me(null);try{await async function(e){return o(`/auth/tokens/${e}`,{method:"DELETE"})}(He.id),await Xs(),Oe(null)}catch(e){Me(e instanceof Error?e.message:"Failed to revoke token")}finally{Xe(!1)}}},onCancel:()=>Oe(null)}),ds&&s.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&us(!1),role:"dialog","aria-modal":"true","aria-labelledby":"add-key-modal-title",children:s.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[s.jsx("h3",{id:"add-key-modal-title",className:"type-micro mb-4",children:"Add Transport Key"}),s.jsxs("div",{className:"space-y-4",children:[rs&&s.jsxs("div",{className:"bg-sys-cyan/10 border border-sys-cyan/30 radius-inner p-3 text-sm text-fg-secondary",children:["Adding as child of: ",s.jsx("strong",{className:"text-fg-primary",children:Qs()})]}),s.jsx(N,{label:"Key Name",type:"text",value:js,onChange:e=>vs(e.target.value),placeholder:"e.g., Region Name, Group Key",onKeyDown:e=>"Enter"===e.key&&et(),autoFocus:!0}),s.jsxs("div",{children:[s.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Flood Policy"}),s.jsxs("div",{className:"toggle-group w-full",children:[s.jsx("button",{onClick:()=>ws("deny"),className:t("toggle-group-item flex-1","deny"===Ns&&"active !text-sys-red"),children:"Deny"}),s.jsx("button",{onClick:()=>ws("allow"),className:t("toggle-group-item flex-1","allow"===Ns&&"active !text-sys-green"),children:"Allow"})]})]}),s.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[s.jsx(v,{color:"muted",outline:!0,onClick:()=>{us(!1),vs(""),ws("allow")},disabled:ks,children:"Cancel"}),s.jsx(v,{color:"primary",onClick:et,disabled:ks||!js.trim(),children:ks?s.jsxs(s.Fragment,{children:[s.jsx(l,{"data-slot":"icon",className:"animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),ms&&ys&&s.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&xs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"edit-key-modal-title",children:s.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[s.jsx("h3",{id:"edit-key-modal-title",className:"type-micro mb-4",children:"Edit Transport Key"}),s.jsxs("div",{className:"space-y-4",children:[s.jsx(N,{label:"Key Name",type:"text",value:ys.name,onChange:e=>fs({...ys,name:e.target.value}),autoFocus:!0}),s.jsxs("div",{children:[s.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Flood Policy"}),s.jsxs("div",{className:"toggle-group w-full",children:[s.jsx("button",{onClick:()=>fs({...ys,floodPolicy:"deny"}),className:t("toggle-group-item flex-1","deny"===ys.floodPolicy&&"active !text-sys-red"),children:"Deny"}),s.jsx("button",{onClick:()=>fs({...ys,floodPolicy:"allow"}),className:t("toggle-group-item flex-1","allow"===ys.floodPolicy&&"active !text-sys-green"),children:"Allow"})]})]}),ys.transport_key&&s.jsxs("div",{children:[s.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Transport Key"}),s.jsx("code",{className:"block bg-input-bg px-3 py-2 radius-inner border border-input-border type-code text-fg-muted overflow-x-auto",children:ys.transport_key})]}),s.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[s.jsx(v,{color:"danger",outline:!0,onClick:()=>{xs(!1),bs(ys),ps(!0),fs(null)},disabled:ks,children:"Delete"}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx(v,{color:"muted",outline:!0,onClick:()=>{xs(!1),fs(null)},disabled:ks,children:"Cancel"}),s.jsx(v,{color:"primary",onClick:async()=>{if(ys){Cs(!0),es(null);try{const e=await E(ys.id,{name:ys.name,flood_policy:ys.floodPolicy});e.success?(await Ys(),xs(!1),fs(null)):es(e.error||"Failed to update transport key")}catch(e){es(e instanceof Error?e.message:"Failed to update transport key")}finally{Cs(!1)}}},disabled:ks||!ys.name.trim(),children:ks?s.jsxs(s.Fragment,{children:[s.jsx(l,{"data-slot":"icon",className:"animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),hs&&gs&&s.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&ps(!1),role:"dialog","aria-modal":"true","aria-labelledby":"delete-key-modal-title",children:s.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[s.jsx("h3",{id:"delete-key-modal-title",className:"type-micro mb-4",children:"Delete Transport Key"}),s.jsxs("p",{className:"text-fg-secondary mb-4",children:["Are you sure you want to delete ",s.jsxs("strong",{className:"text-fg-primary",children:["'",gs.name,"'"]}),"?"]}),gs.children&&gs.children.length>0&&s.jsx("div",{className:"bg-sys-indigo/10 border border-sys-indigo/30 radius-inner p-3 mb-4",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Z,{className:"w-4 h-4 text-sys-indigo flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm text-fg-secondary",children:["This key has ",gs.children.length," child key(s). Deleting will also remove all children."]})]})}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(v,{color:"muted",outline:!0,onClick:()=>{ps(!1),bs(null)},disabled:ks,children:"Cancel"}),s.jsx(v,{color:"danger",onClick:async()=>{if(gs){Cs(!0),es(null);try{const e=await P(gs.id);e.success?(await Ys(),ps(!1),bs(null),is(null)):es(e.error||"Failed to delete transport key")}catch(e){es(e instanceof Error?e.message:"Failed to delete transport key")}finally{Cs(!1)}}},disabled:ks,children:ks?s.jsxs(s.Fragment,{children:[s.jsx(l,{"data-slot":"icon",className:"animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{Me as default}; +import{r as e,j as s,c as t}from"./vendor-react-j_fHog8x.js";import{c as a,L as l,o as n,a5 as r,Y as i,bY as o,cI as c,cJ as d,T as u,cK as m,b2 as x,aH as h,n as p,cL as y,cM as f,cN as g,cO as b,R as j,B as v,cP as N,I as w}from"./index-BBcIGlRT.js";import{g as k,a as C,c as S,r as _,s as F,b as T,u as E,d as P}from"./system-7wpk3UyT.js";import{T as M,P as z,C as R}from"./ConfirmModal-CX0HrTOx.js";import{l as D}from"./font-loader-BQzEmDrZ.js";import{M as I,S as L}from"./sun-GNUT-ucn.js";import{N as A}from"./NodeInformationCard-DQTRuz7_.js";import{i as K,g as V,s as H,a as O,k as q}from"./keycap-sfx-CAsrNe23.js";import{a as $,P as B,b as X,B as J}from"./PageLayout-CYYy29Pg.js";import{C as U}from"./Card-QO4sXDu0.js";import{R as W,C as Y}from"./Grid-OFJ4oe0a.js";import{K as G}from"./key-round-0eVrrV09.js";import{C as Q}from"./circle-check-DI0_62yI.js";import{T as Z}from"./triangle-alert-DH80WgOo.js";import{R as ee}from"./refresh-cw-BJopKEHj.js";import{C as se}from"./copy-C_IB0gEd.js";import{C as te}from"./chevron-right-B6r5SVTI.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CmkNwW1A.js";import"./DataBox-B8dpvpbW.js";const ae=a("antenna",[["path",{d:"M2 12 7 2",key:"117k30"}],["path",{d:"m7 12 5-10",key:"1tvx22"}],["path",{d:"m12 12 5-10",key:"ev1o1a"}],["path",{d:"m17 12 5-10",key:"1e4ti3"}],["path",{d:"M4.5 7h15",key:"vlsxkz"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]),le=a("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),ne=a("folder-key",[["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2",key:"3hgo9p"}],["path",{d:"m22 14-4.5 4.5",key:"1ef6z8"}],["path",{d:"m21 15 1 1",key:"1ejcpy"}]]),re=a("folder-lock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]),ie=a("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),oe=a("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),ce=a("triangle-dashed",[["path",{d:"M10.17 4.193a2 2 0 0 1 3.666.013",key:"pltmmw"}],["path",{d:"M14 21h2",key:"v4qezv"}],["path",{d:"m15.874 7.743 1 1.732",key:"10m0iw"}],["path",{d:"m18.849 12.952 1 1.732",key:"zadnam"}],["path",{d:"M21.824 18.18a2 2 0 0 1-1.835 2.824",key:"fvwuk4"}],["path",{d:"M4.024 21a2 2 0 0 1-1.839-2.839",key:"1e1kah"}],["path",{d:"m5.136 12.952-1 1.732",key:"1u4ldi"}],["path",{d:"M8 21h2",key:"i9zjee"}],["path",{d:"m8.102 7.743-1 1.732",key:"1zzo4u"}]]),de=1500,ue="h-[38px]",me="h-[32px]",xe="px-3",he="px-2.5",pe="rounded-lg";function ye({label:a,value:i,editValue:o,onSave:c,type:d="text",suffix:u,placeholder:m,readOnly:x=!1,layout:h="stacked",min:p,max:y,step:f,maxLength:g,description:b,className:j}){const[v,N]=e.useState(!1),[w,k]=e.useState(""),[C,S]=e.useState("idle"),_=e.useRef(null),F=e.useRef(!0),T=e.useRef(null),E=!x&&!!c;e.useEffect(()=>(F.current=!0,()=>{F.current=!1,T.current&&clearTimeout(T.current)}),[]);const P=e.useCallback(()=>{E&&(k(o??i),N(!0),S("idle"),requestAnimationFrame(()=>{var e;return null==(e=_.current)?void 0:e.select()}))},[E,o,i]),M=e.useCallback(()=>{N(!1),k(""),S("idle")},[]),z=e.useCallback(async()=>{if(c&&"loading"!==C)if(w!==(o??i)){T.current&&clearTimeout(T.current),S("loading");try{if(await c(w),!F.current)return;S("success"),N(!1),T.current=setTimeout(()=>{F.current&&S("idle")},de)}catch{if(!F.current)return;S("error"),T.current=setTimeout(()=>{F.current&&S("idle")},de)}}else M()},[c,w,o,i,M,C]),R=e.useCallback(e=>{"Enter"===e.key?(e.preventDefault(),z()):"Escape"===e.key&&(e.preventDefault(),M())},[z,M]);return"inline"===h?s.jsxs("div",{className:t("group flex items-center justify-between gap-3",j),children:[s.jsx("label",{className:"type-label text-fg-muted truncate",children:a}),v?s.jsxs("div",{className:t(me,pe,he,"flex items-center transition-all","bg-transparent border border-sys-blue/50 ring-1 ring-sys-blue/20","min-w-[100px]"),children:[s.jsx("input",{ref:_,type:d,value:w,onChange:e=>k(e.target.value),onKeyDown:R,placeholder:m,min:p,max:y,step:f,maxLength:g,disabled:"loading"===C,className:t("bg-transparent text-fg-primary focus:outline-none type-data flex-1 min-w-0",u?"w-12 text-right":"w-full")}),u&&s.jsx("span",{className:"text-fg-muted type-data ml-1 shrink-0",children:u}),s.jsx("div",{className:"flex items-center gap-0.5 ml-2 shrink-0",children:"loading"===C?s.jsx(l,{className:"w-3.5 h-3.5 text-fg-muted animate-spin"}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:z,className:"p-0.5 rounded hover:bg-sys-green/15 text-sys-green transition-colors",title:"Save (Enter)",children:s.jsx(n,{className:"w-3 h-3"})}),s.jsx("button",{onClick:M,className:"p-0.5 rounded hover:bg-sys-red/15 text-fg-muted hover:text-sys-red transition-colors",title:"Cancel (Esc)",children:s.jsx(r,{className:"w-3 h-3"})})]})})]}):s.jsxs("div",{className:t(me,pe,he,"flex items-center justify-end transition-all min-w-[80px]","bg-input-bg border border-input-border",E&&"cursor-pointer hover:border-edge-strong"),onClick:E?P:void 0,children:[s.jsx("span",{className:"type-data text-fg-primary",children:i}),"success"===C&&s.jsx(n,{className:"w-3 h-3 text-sys-green ml-1.5 shrink-0"}),"error"===C&&s.jsx(r,{className:"w-3 h-3 text-sys-red ml-1.5 shrink-0"}),"idle"===C&&E&&s.jsx(oe,{className:"w-3 h-3 text-fg-muted ml-1.5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})]})]}):s.jsxs("div",{className:t("group",j),children:[s.jsx("label",{className:"type-label text-fg-muted block mb-1",children:a}),v?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:t(ue,pe,xe,"flex items-center transition-all","bg-transparent border border-sys-blue/50 ring-1 ring-sys-blue/20"),children:[s.jsx("input",{ref:_,type:d,value:w,onChange:e=>k(e.target.value),onKeyDown:R,placeholder:m,min:p,max:y,step:f,maxLength:g,disabled:"loading"===C,className:"w-full bg-transparent text-fg-primary focus:outline-none type-data flex-1 min-w-0"}),u&&s.jsx("span",{className:"text-fg-muted type-data ml-1 shrink-0",children:u}),s.jsx("div",{className:"flex items-center gap-0.5 ml-2 shrink-0",children:"loading"===C?s.jsx(l,{className:"w-3.5 h-3.5 text-fg-muted animate-spin"}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:z,className:"p-1 rounded hover:bg-sys-green/15 text-sys-green transition-colors",title:"Save (Enter)",children:s.jsx(n,{className:"w-3.5 h-3.5"})}),s.jsx("button",{onClick:M,className:"p-1 rounded hover:bg-sys-red/15 text-fg-muted hover:text-sys-red transition-colors",title:"Cancel (Esc)",children:s.jsx(r,{className:"w-3.5 h-3.5"})})]})})]}),b&&s.jsx("p",{className:"type-data-xs text-fg-muted mt-1 ml-3",children:b})]}):s.jsxs("div",{className:t(ue,pe,xe,"flex items-center transition-all","bg-input-bg border border-input-border",E&&"cursor-pointer hover:border-edge-strong"),onClick:E?P:void 0,children:[s.jsx("span",{className:"type-data text-fg-primary flex-1 whitespace-nowrap",children:i}),"success"===C&&s.jsx(n,{className:"w-3.5 h-3.5 text-sys-green shrink-0"}),"error"===C&&s.jsx(r,{className:"w-3.5 h-3.5 text-sys-red shrink-0"}),"idle"===C&&E&&s.jsx(oe,{className:"w-3.5 h-3.5 text-fg-muted opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})]})]})}function fe({label:a,value:o,editValue:c,options:d,onSave:u,readOnly:m=!1,layout:x="stacked",className:h}){const[p,y]=e.useState(!1),[f,g]=e.useState(""),[b,j]=e.useState("idle"),v=e.useRef(null),N=e.useRef(!0),w=e.useRef(null),k=!m&&!!u;e.useEffect(()=>(N.current=!0,()=>{N.current=!1,w.current&&clearTimeout(w.current)}),[]);const C=e.useCallback(()=>{k&&(g(String(c)),y(!0),j("idle"),requestAnimationFrame(()=>{var e;return null==(e=v.current)?void 0:e.focus()}))},[k,c]),S=e.useCallback(()=>{y(!1),g(""),j("idle")},[]),_=e.useCallback(async()=>{if(u&&"loading"!==b)if(f!==String(c)){w.current&&clearTimeout(w.current),j("loading");try{if(await u(f),!N.current)return;j("success"),y(!1),w.current=setTimeout(()=>{N.current&&j("idle")},de)}catch{if(!N.current)return;j("error"),w.current=setTimeout(()=>{N.current&&j("idle")},de)}}else S()},[u,f,c,S,b]),F=e.useCallback(e=>{"Escape"===e.key&&(e.preventDefault(),S())},[S]),T="inline"===x,E=T?me:ue,P=T?he:xe,M=s.jsxs("div",{className:t(E,pe,P,"flex items-center transition-all relative","bg-transparent border border-sys-blue/50 ring-1 ring-sys-blue/20",T&&"min-w-[100px]"),children:[s.jsx("select",{ref:v,value:f,onChange:e=>g(e.target.value),onKeyDown:F,disabled:"loading"===b,className:t("bg-transparent text-fg-primary focus:outline-none appearance-none cursor-pointer type-data flex-1 min-w-0","pr-6"),children:d.map(e=>s.jsx("option",{value:e.value,children:e.label},String(e.value)))}),s.jsx(i,{className:"absolute right-auto w-3.5 h-3.5 text-fg-muted pointer-events-none",style:{right:"loading"===b?"2rem":"3.5rem"}}),s.jsx("div",{className:"flex items-center gap-0.5 ml-1 shrink-0",children:"loading"===b?s.jsx(l,{className:t("text-fg-muted animate-spin",T?"w-3 h-3":"w-3.5 h-3.5")}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:_,className:t("rounded hover:bg-sys-green/15 text-sys-green transition-colors",T?"p-0.5":"p-1"),title:"Save",children:s.jsx(n,{className:T?"w-3 h-3":"w-3.5 h-3.5"})}),s.jsx("button",{onClick:S,className:t("rounded hover:bg-sys-red/15 text-fg-muted hover:text-sys-red transition-colors",T?"p-0.5":"p-1"),title:"Cancel (Esc)",children:s.jsx(r,{className:T?"w-3 h-3":"w-3.5 h-3.5"})})]})})]}),z=s.jsxs("div",{className:t(E,pe,P,"flex items-center transition-all","bg-input-bg border border-input-border",k&&"cursor-pointer hover:border-edge-strong",T?"justify-end min-w-[80px]":""),onClick:k?C:void 0,children:[s.jsx("span",{className:t("type-data text-fg-primary",!T&&"flex-1"),children:o}),"success"===b&&s.jsx(n,{className:t("text-sys-green shrink-0",T?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")}),"error"===b&&s.jsx(r,{className:t("text-sys-red shrink-0",T?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")}),"idle"===b&&k&&s.jsx(i,{className:t("text-fg-muted opacity-0 group-hover:opacity-100 transition-opacity shrink-0",T?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")})]});return T?s.jsxs("div",{className:t("group flex items-center justify-between",h),children:[s.jsx("label",{className:"type-label text-fg-muted shrink-0",children:a}),p?M:z]}):s.jsxs("div",{className:t("group",h),children:[s.jsx("label",{className:"type-label text-fg-muted block mb-1",children:a}),p?M:z]})}async function ge(e){return o("/api/update_web_config",{method:"POST",body:JSON.stringify(e)})}e.memo(function(){const{theme:e}=c(),{themeId:t}=e,a=d.find(e=>e.meta.id===t)??d[0];return s.jsx("div",{className:"h-10 flex items-center justify-center",children:s.jsx("span",{className:"font-medium transition-all duration-300 leading-none text-center text-fg-secondary",style:{fontFamily:"Inter, system-ui, sans-serif",fontSize:"clamp(0.75rem, 0.6rem + 1.5vw, 1.1rem)",letterSpacing:"-0.02em"},children:a.meta.name})})});const be=e.memo(function({compact:e=!1}){const{theme:a,setTheme:l}=c(),{themeId:n}=a;return s.jsx("div",{className:t("grid grid-cols-2 gap-2",e?"w-full min-w-0 self-stretch":"w-full"),children:[...d].reverse().map(a=>{const r=n===a.meta.id,i=a.meta.isDark;return s.jsxs("button",{type:"button",title:a.meta.name,className:t("flex flex-row items-stretch radius-inner transition-all duration-200 ease-out overflow-hidden cursor-pointer",e&&"h-6",r?"ring-2 ring-sys-blue scale-[1.02]":"opacity-70 hover:opacity-100"),onClick:()=>l(a.meta.id),children:[s.jsx("div",{className:t("flex-1 h-full",i?"bg-[#18181b]":"bg-[#EFF0F1]")}),s.jsx("div",{className:"flex flex-col h-full",children:a.display.palette.map((e,t)=>s.jsx("div",{className:"flex flex-1",children:e.map((e,t)=>s.jsx("div",{className:"w-2 h-full",style:{backgroundColor:e}},t))},t))})]},a.meta.id)})})}),je=e.memo(function(){const{theme:t,setTheme:a}=c(),{themeId:l}=t,n="breeze dark"===l,r=e.useCallback(e=>{a(e?"breeze dark":"breeze light")},[a]);return s.jsx(u,{enabled:n,onChange:r,label:s.jsxs(s.Fragment,{children:["Dark Mode: ",n?s.jsx(I,{className:"w-3.5 h-3.5 text-sys-blue inline"}):s.jsx(L,{className:"w-3.5 h-3.5 text-[#e8a517] inline"})]}),tooltip:"Switch between dark and light mode",size:"md"})}),ve=e.memo(function({layout:t="horizontal"}){return e.useEffect(()=>{D()},[]),"toggle-only"===t?s.jsx(je,{}):"thumbnails-only"===t?s.jsx(be,{}):"vertical"===t?s.jsxs("div",{className:"flex flex-col items-start gap-3",children:[s.jsx(je,{}),s.jsx(be,{})]}):s.jsxs("div",{className:"flex items-stretch gap-4",children:[s.jsx("div",{className:"flex-shrink-0 flex items-start",children:s.jsx(je,{})}),s.jsx(be,{compact:!0})]})}),Ne=2e3;function we(s,t,a){const[l,n]=e.useState("idle"),[r,i]=e.useState(null),o=e.useRef(!0),c=e.useRef(null),d=e.useRef(null),u=e.useRef(!1),m=e.useRef("idle"),x=e.useRef(s),h=e.useRef(t),p=e.useRef(a);return m.current=l,x.current=s,h.current=t,p.current=a,e.useEffect(()=>(o.current=!0,()=>{o.current=!1,c.current&&clearTimeout(c.current),d.current&&clearTimeout(d.current)}),[]),{enabled:null!==r?r:s,status:l,toggle:e.useCallback(async e=>{if("loading"===m.current)return;const s=x.current;c.current&&clearTimeout(c.current),d.current&&clearTimeout(d.current),u.current=!1,i(e),n("loading"),c.current=setTimeout(()=>{!u.current&&o.current&&(i(s),n("error"),d.current=setTimeout(()=>{o.current&&(n("idle"),i(null))},Ne))},1e4);try{if(await h.current(e),u.current=!0,c.current&&clearTimeout(c.current),!o.current)return;n("success"),d.current=setTimeout(()=>{var e;o.current&&(n("idle"),i(null),null==(e=p.current)||e.call(p))},Ne)}catch{if(u.current=!0,c.current&&clearTimeout(c.current),!o.current)return;i(s),n("error"),d.current=setTimeout(()=>{o.current&&(n("idle"),i(null))},Ne)}},[])}}function ke(){const{latitude:a,longitude:i,enabled:o,setLocation:c,enable:d,disable:u,clear:h}=m(),[p,y]=e.useState(!1),[f,g]=e.useState(""),[b,j]=e.useState(""),[v,N]=e.useState("idle"),[w,k]=e.useState(null),C=e.useRef(null),S=e.useRef(null),_=e.useRef(!0);e.useEffect(()=>(_.current=!0,()=>{_.current=!1,S.current&&clearTimeout(S.current)}),[]);const F=()=>{y(!1),k(null)};e.useEffect(()=>{if(!p)return;const e=e=>{"loading"!==v&&C.current&&!C.current.contains(e.target)&&F()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[p,v]);const T=null!==a&&null!==i;return s.jsx($,{children:s.jsxs("div",{ref:C,children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx(U,{icon:s.jsx(ce,{}),title:"Stealth"}),s.jsxs("div",{className:"flex items-center gap-1",children:[T&&!p&&s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>{o?u():d()},className:t("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2 mr-2",o?"bg-toggle-on border-toggle-on":"bg-toggle-off border-edge-subtle"),title:o?"Disable stealth location":"Enable stealth location",children:s.jsx("span",{className:t("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",o?"translate-x-5":"translate-x-0.5")})}),s.jsx("button",{onClick:()=>{h(),y(!1)},className:"p-2 rounded-lg transition-colors text-fg-muted hover:text-sys-red hover:bg-sys-red/10",title:"Clear stealth location",children:s.jsx(M,{className:"w-4 h-4"})})]}),p?s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:F,disabled:"loading"===v,className:t("p-2 rounded-lg transition-colors","loading"===v?"text-fg-muted cursor-not-allowed":"text-fg-muted hover:text-sys-red hover:bg-sys-red/10"),title:"Cancel",children:s.jsx(r,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{if("loading"===v)return;S.current&&clearTimeout(S.current);const e=((e,s)=>{const t=parseFloat(e),a=parseFloat(s);return isNaN(t)||isNaN(a)?"Please enter valid numbers":t<-90||t>90?"Latitude must be between -90 and 90":a<-180||a>180?"Longitude must be between -180 and 180":0===t&&0===a?"Coordinates (0, 0) are invalid":null})(f,b);if(e)return void k(e);N("loading"),k(null);const s=parseFloat(f),t=parseFloat(b);c(s,t),o||d(),N("success"),S.current=setTimeout(()=>{_.current&&(N("idle"),y(!1))},1e3)},disabled:"loading"===v,className:t("p-2 rounded-lg transition-colors","loading"===v?"text-sys-blue cursor-wait":"success"===v?"text-sys-green":"error"===v?"text-sys-red":"text-sys-green hover:bg-sys-green/10"),title:"Save",children:"loading"===v?s.jsx(l,{className:"w-4 h-4 animate-spin"}):"success"===v?s.jsx(n,{className:"w-4 h-4"}):"error"===v?s.jsx(r,{className:"w-4 h-4"}):s.jsx(n,{className:"w-4 h-4"})})]}):s.jsx("button",{onClick:()=>{g((null==a?void 0:a.toFixed(6))??""),j((null==i?void 0:i.toFixed(6))??""),k(null),y(!0)},className:"p-2 rounded-lg transition-colors text-fg-muted hover:text-fg-primary hover:bg-subtle",title:T?"Edit stealth location":"Set stealth location",children:s.jsx(oe,{className:"w-4 h-4"})})]})]}),s.jsx("div",{className:"bg-sys-cyan/5 rounded-xl p-3 mb-4",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(x,{className:"w-4 h-4 text-sys-cyan flex-shrink-0 mt-0.5"}),s.jsxs("p",{className:"type-body-sm text-fg-muted",children:[s.jsx("span",{className:"text-fg-secondary",children:"Stealth mode"})," allows you to appear on the map and in topology analysis without broadcasting your location. Coordinates are stored locally in your browser only — ",s.jsx("span",{className:"text-sys-cyan",children:"never sent to config.yaml or the mesh"}),"."]})]})}),w&&s.jsx("div",{className:"text-xs mb-3 px-2 py-1.5 rounded-md text-sys-red bg-sys-red/10",children:w}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"type-label text-fg-muted block mb-1",children:p?"Latitude (°)":"Latitude"}),s.jsx("div",{className:t("h-[38px] rounded-full px-4 flex items-center transition-colors","bg-subtle-fill"),children:p?s.jsx("input",{type:"number",value:f,onChange:e=>g(e.target.value),step:"0.000001",min:"-90",max:"90",placeholder:"e.g. 34.052234",className:"w-full bg-transparent text-fg-primary focus:outline-none type-data placeholder:text-fg-muted/50"}):s.jsx("span",{className:t("type-data",T&&o?"text-fg-primary":"text-fg-muted"),children:T?a.toFixed(6):"Not set"})})]}),s.jsxs("div",{children:[s.jsx("label",{className:"type-label text-fg-muted block mb-1",children:p?"Longitude (°)":"Longitude"}),s.jsx("div",{className:t("h-[38px] rounded-full px-4 flex items-center transition-colors","bg-subtle-fill"),children:p?s.jsx("input",{type:"number",value:b,onChange:e=>j(e.target.value),step:"0.000001",min:"-180",max:"180",placeholder:"e.g. -118.243685",className:"w-full bg-transparent text-fg-primary focus:outline-none type-data placeholder:text-fg-muted/50"}):s.jsx("span",{className:t("type-data",T&&o?"text-fg-primary":"text-fg-muted"),children:T?i.toFixed(6):"Not set"})})]})]}),T&&!p&&s.jsx("div",{className:"mt-3 pt-3 border-t border-edge-subtle",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:t("w-2 h-2 rounded-full",o?"bg-sys-green":"bg-fg-muted")}),s.jsx("span",{className:"type-body-sm text-fg-muted",children:o?"Stealth location active — you appear on maps with these coordinates":"Stealth location disabled — coordinates saved but not in use"})]})})]})})}const Ce=[{value:7.8,label:"7.8 kHz"},{value:10.4,label:"10.4 kHz"},{value:15.6,label:"15.6 kHz"},{value:20.8,label:"20.8 kHz"},{value:31.25,label:"31.25 kHz"},{value:41.7,label:"41.7 kHz"},{value:62.5,label:"62.5 kHz"},{value:125,label:"125 kHz"},{value:250,label:"250 kHz"},{value:500,label:"500 kHz"}],Se=[5,6,7,8,9,10,11,12],_e=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}],Fe="radioConfig";function Te(e){if(!e)return"Never";const s=Date.now()-1e3*e,t=Math.floor(s/6e4),a=Math.floor(s/36e5),l=Math.floor(s/864e5);return t<1?"Just now":t<60?`${t}m ago`:a<24?`${a}h ago`:l<365?`${l}d ago`:`${Math.floor(l/365)}y ago`}function Ee({node:e,level:a,expandedKeys:l,selectedKeyId:n,globalFloodPolicy:r,onSelect:i,onToggle:o}){const c=l.has(e.id),d=n===e.id,u=e.children&&e.children.length>0,m="allow"===r;return s.jsxs("div",{children:[s.jsxs("div",{className:t("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",d?"bg-sys-blue/15":"hover:bg-subtle-fill",m&&"opacity-50 cursor-not-allowed"),style:{marginLeft:16*a+"px"},onClick:()=>!m&&i(e.id),children:[u?s.jsx("button",{onClick:s=>{s.stopPropagation(),o(e.id)},className:"p-1 hover:bg-subtle-fill-hover rounded-full transition-colors",children:s.jsx(te,{className:t("w-3.5 h-3.5 text-fg-muted transition-transform",c&&"rotate-90")})}):s.jsx("span",{className:"w-5"}),s.jsx(ne,{className:"w-4 h-4 text-sys-blue flex-shrink-0"}),s.jsx("span",{className:"type-data text-fg-primary flex-1 truncate",children:e.name}),s.jsx("span",{className:"type-data-xs text-fg-muted hidden sm:inline",title:e.last_used?new Date(1e3*e.last_used).toLocaleString():void 0,children:Te(e.last_used)}),s.jsx("span",{className:t("type-data-xs px-2 py-0.5 rounded-full","allow"===e.floodPolicy?"bg-sys-green/15 text-sys-green":"bg-sys-red/15 text-sys-red"),children:"allow"===e.floodPolicy?"Allow":"Deny"})]}),u&&c&&s.jsx("div",{children:e.children.map(e=>s.jsx(Ee,{node:e,level:a+1,expandedKeys:l,selectedKeyId:n,globalFloodPolicy:r,onSelect:i,onToggle:o},e.id))})]})}function Pe(){const[a,l]=e.useState(K),[n,r]=e.useState(V),[i,o]=e.useState(!1),c=e.useCallback(e=>{l(e),H(e)},[]),d=e.useCallback(e=>{const s=parseFloat(e.target.value);r(s),O(s)},[]),m=e.useCallback(async()=>{i||(o(!0),await q(),o(!1))},[i]);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(u,{enabled:a,onChange:c,label:s.jsxs(s.Fragment,{children:["Sound: ",s.jsx("span",{className:a?"text-sys-green":"text-sys-red",children:a?"On":"Off"})]}),tooltip:"Enable or disable UI sound effects and haptic audio feedback",size:"md"}),s.jsx(v,{color:"primary",outline:!0,onClick:m,disabled:!a||i,className:"w-16 justify-center",children:i?"…":"Test"})]}),s.jsxs("div",{className:t("flex items-center gap-3",!a&&"opacity-40 pointer-events-none"),children:[s.jsx("span",{className:"type-label text-fg-muted w-14 shrink-0",children:"Volume"}),s.jsx("input",{type:"range",min:0,max:1,step:.05,value:n,onChange:d,className:"flex-1 accent-sys-blue h-1.5 cursor-pointer"}),s.jsxs("span",{className:"data-box w-16 justify-center",children:[Math.round(100*n),"%"]})]})]})}function Me(){var a,r,i,c,d,m;const{stats:D,setMode:I,clearModeMutation:L,setDutyCycleConfig:K,clearDutyCycleMutation:V,fetchStats:H,startMutation:O,clearMutation:q}=h(),te=null==(a=null==D?void 0:D.config)?void 0:a.radio,ne=null==(r=null==D?void 0:D.config)?void 0:r.repeater,oe=null==(i=null==D?void 0:D.config)?void 0:i.duty_cycle,ce=(null==D?void 0:D.node_name)||(null==(c=null==D?void 0:D.config)?void 0:c.node_name)||"Unknown Node",de=(null==ne?void 0:ne.mode)??"forward",ue=(null==oe?void 0:oe.enforcement_enabled)??!1,me=null==(d=null==D?void 0:D.config)?void 0:d.delays,xe=e.useRef(!0);e.useEffect(()=>(xe.current=!0,()=>{xe.current=!1}),[]);const he=null==(m=null==D?void 0:D.config)?void 0:m.web,[pe,be]=e.useState([]),[je,Ne]=e.useState(!1),[Te,Me]=e.useState(null),[ze,Re]=e.useState(!1),[De,Ie]=e.useState(""),[Le,Ae]=e.useState(null),[Ke,Ve]=e.useState(!1),[He,Oe]=e.useState(null),[qe,$e]=e.useState(!1),[Be,Xe]=e.useState(!1),[Je,Ue]=e.useState(!1),[We,Ye]=e.useState([]),[Ge,Qe]=e.useState(!1),[Ze,es]=e.useState(null),[ss,ts]=e.useState(()=>"allow"===localStorage.getItem("pymc:globalFloodPolicy")?"allow":"deny"),as=e.useCallback(e=>{ts(e),localStorage.setItem("pymc:globalFloodPolicy",e)},[]),[ls,ns]=e.useState(!1),[rs,is]=e.useState(null),[os,cs]=e.useState(new Set),[ds,us]=e.useState(!1),[ms,xs]=e.useState(!1),[hs,ps]=e.useState(!1),[ys,fs]=e.useState(null),[gs,bs]=e.useState(null),[js,vs]=e.useState(""),[Ns,ws]=e.useState("allow"),[ks,Cs]=e.useState(!1),[Ss,_s]=e.useState(!0),[Fs,Ts]=e.useState(!1),[Es,Ps]=e.useState(!0),[Ms,zs]=e.useState("idle"),[Rs,Ds]=e.useState(!1),[Is,Ls]=e.useState(!1),As=e.useCallback(()=>{const e=null==me?void 0:me.tx_delay_factor;return e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??1:"number"==typeof e?e:1},[me]),Ks=e.useCallback(()=>{const e=null==me?void 0:me.direct_tx_delay_factor;return"number"==typeof e?e:.5},[me]),Vs=e.useCallback(()=>{const e=null==oe?void 0:oe.max_airtime_percent;return"number"==typeof e?e:e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??6:6},[oe]),Hs=we("forward"===de,async e=>{await I(e?"forward":"monitor")},L),Os=we(ue,async e=>{await K({max_airtime_percent:Vs(),enforcement_enabled:e})},V),qs=we((null==he?void 0:he.cors_enabled)??!1,async e=>{var s;const t=await ge({web:{cors_enabled:e}});if(!t.success&&!(null==(s=t.data)?void 0:s.persisted))throw new Error("CORS update failed");await H()}),$s=e.useCallback(async e=>{O(Fe);try{const s=await p(e);if(!s.success)throw new Error(s.error||"Failed to save");await H({force:!0}).catch(()=>{})}finally{q(Fe)}},[O,q,H]);e.useEffect(()=>{(async()=>{Ps(!0);try{const e=await S();e.success&&e.data?Ts(e.data.exists):Ts(!1);const s=null==he?void 0:he.web_path;_s(!s||""===s)}catch{Ts(!1)}finally{Ps(!1)}})()},[null==he?void 0:he.web_path]);const Bs=async e=>{var s;if("loading"!==Ms){zs("loading");try{const t=await ge({web:{web_path:e?null:"/opt/pymc_console/web/html"}});if(!xe.current)return;t.success||(null==(s=t.data)?void 0:s.persisted)?(_s(e),zs("success"),Ds(!0),setTimeout(()=>{xe.current&&zs("idle")},2e3)):(zs("error"),setTimeout(()=>{xe.current&&zs("idle")},2e3))}catch{if(!xe.current)return;zs("error"),setTimeout(()=>{xe.current&&zs("idle")},2e3)}}},Xs=e.useCallback(async()=>{Ne(!0),Me(null);try{const e=await async function(){return o("/auth/tokens")}();be(e.tokens||[])}catch(e){Me(e instanceof Error?e.message:"Failed to fetch tokens")}finally{Ne(!1)}},[]);e.useEffect(()=>{Xs()},[Xs]);const Js=async()=>{if(De.trim()){$e(!0),Me(null);try{const e=await async function(e){return o("/auth/tokens",{method:"POST",body:JSON.stringify({name:e})})}(De.trim());Ae(e.token||null),Re(!1),Ve(!0),Ie(""),await Xs()}catch(e){Me(e instanceof Error?e.message:"Failed to create token")}finally{$e(!1)}}else Me("Token name is required")},Us=e=>e?new Date(1e3*e).toLocaleString():"Never",Ws=e.useCallback(e=>{const s=new Map,t=[];return e.forEach(e=>{const t={id:e.id,name:e.name,floodPolicy:e.flood_policy,transport_key:e.transport_key,last_used:e.last_used,parent_id:e.parent_id,children:[]};s.set(e.id,t)}),s.forEach(e=>{e.parent_id&&s.has(e.parent_id)?s.get(e.parent_id).children.push(e):t.push(e)}),t},[]),Ys=e.useCallback(async()=>{Qe(!0),es(null);try{const e=await k();if(e.success&&e.data){const s=Ws(e.data);Ye(s),is(e=>{if(null===e)return null;const t=s=>{for(const a of s){if(a.id===e)return!0;if(a.children&&t(a.children))return!0}return!1};return t(s)?e:null})}else es(e.error||"Failed to load transport keys")}catch(e){es(e instanceof Error?e.message:"Unknown error occurred")}finally{Qe(!1)}},[Ws]);e.useEffect(()=>{Ys(),C().then(e=>{e.success&&e.data&&as(e.data.global_flood_allow?"allow":"deny")}).catch(()=>{})},[Ys]);const Gs=e.useCallback((e,s)=>{for(const t of e){if(t.id===s)return t;if(t.children){const e=Gs(t.children,s);if(e)return e}}return null},[]),Qs=e.useCallback(()=>{if(!rs)return;const e=Gs(We,rs);return null==e?void 0:e.name},[rs,We,Gs]),Zs=e.useCallback(e=>{cs(s=>{const t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},[]),et=async()=>{if(js.trim()){Cs(!0),es(null);try{const e=await T({name:js.trim(),flood_policy:Ns,parent_id:rs??void 0});e.success?(await Ys(),us(!1),vs(""),ws("allow")):es(e.error||"Failed to add transport key")}catch(e){es(e instanceof Error?e.message:"Failed to add transport key")}finally{Cs(!1)}}else es("Key name is required")},st=e.useCallback(()=>{if(!rs)return;const e=Gs(We,rs);e&&(fs({...e}),xs(!0))},[rs,We,Gs]);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&(ds&&(us(!1),vs(""),ws("allow")),ms&&(xs(!1),fs(null)),hs&&(ps(!1),bs(null)),ze&&(Re(!1),Ie("")),Ke&&(Ve(!1),Ae(null)))};if(ds||ms||hs||ze||Ke)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ds,ms,hs,ze,Ke]);const tt=e.useCallback(()=>{if(!rs)return;const e=Gs(We,rs);e&&(bs(e),ps(!0))},[rs,We,Gs]);return s.jsxs(B,{children:[s.jsx(X,{title:"Configuration",icon:s.jsx(y,{})}),s.jsxs(J,{children:[s.jsxs(W,{template:"standard",children:[s.jsx(Y,{span:12,md:6,children:s.jsxs($,{neomorphic:!0,children:[s.jsx(U,{icon:s.jsx(f,{}),title:"Repeater Settings"}),ne?s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx("div",{className:"col-span-2",children:s.jsx(ye,{label:"Node Name",value:ce,onSave:async e=>$s({node_name:e}),placeholder:"Enter node name",maxLength:50})}),s.jsx(ye,{label:"Latitude",value:0!==ne.latitude?ne.latitude.toFixed(6):"Not set",editValue:String(ne.latitude),type:"number",suffix:"°",step:1e-6,min:-90,max:90,onSave:async e=>$s({latitude:parseFloat(e)})}),s.jsx(ye,{label:"Longitude",value:0!==ne.longitude?ne.longitude.toFixed(6):"Not set",editValue:String(ne.longitude),type:"number",suffix:"°",step:1e-6,min:-180,max:180,onSave:async e=>$s({longitude:parseFloat(e)})}),s.jsx(ye,{label:"Advert Interval",value:ne.send_advert_interval_hours>0?`${ne.send_advert_interval_hours}h`:"Disabled",editValue:String(ne.send_advert_interval_hours),type:"number",suffix:"hours",min:0,max:48,description:"0 = disabled, 3-48 hours",onSave:async e=>$s({flood_advert_interval_hours:parseInt(e,10)})}),s.jsx(ye,{label:"Score-based TX",value:ne.use_score_for_tx?"Enabled":"Disabled",readOnly:!0})]}):s.jsx("p",{className:"text-fg-muted",children:"Loading repeater settings..."})]})}),s.jsx(Y,{span:12,md:6,children:s.jsxs($,{neomorphic:!0,children:[s.jsx(U,{icon:s.jsx(ae,{}),title:"Radio Configuration"}),te?s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(ye,{label:"Frequency",value:g(te.frequency),editValue:(te.frequency/1e6).toFixed(3),type:"number",suffix:"MHz",step:.001,min:400,max:930,onSave:async e=>$s({frequency_mhz:parseFloat(e)})}),s.jsx(ye,{label:"TX Power",value:`${te.tx_power} dBm`,editValue:String(te.tx_power),type:"number",suffix:"dBm",min:2,max:30,onSave:async e=>$s({tx_power:parseInt(e,10)})}),s.jsx(fe,{label:"Bandwidth",value:b(te.bandwidth),editValue:te.bandwidth/1e3,options:Ce,onSave:async e=>$s({bandwidth_khz:parseFloat(e)})}),s.jsx(fe,{label:"Spreading Factor",value:`SF${te.spreading_factor}`,editValue:te.spreading_factor,options:Se.map(e=>({value:e,label:`SF${e}`})),onSave:async e=>$s({spreading_factor:parseInt(e,10)})}),s.jsx(fe,{label:"Coding Rate",value:`4/${te.coding_rate}`,editValue:te.coding_rate,options:_e,onSave:async e=>$s({coding_rate:parseInt(e,10)})}),s.jsx(ye,{label:"Preamble",value:`${te.preamble_length} symbols`,readOnly:!0})]}):s.jsx("p",{className:"text-fg-muted",children:"Loading radio configuration..."})]})})]}),s.jsxs(W,{template:"standard",children:[s.jsx(Y,{span:12,md:6,children:s.jsxs($,{neomorphic:!0,children:[s.jsx(U,{icon:s.jsx(j,{}),title:"Operating Mode"}),s.jsx("p",{className:"type-label text-fg-muted mb-3",children:"Control how the repeater handles packets"}),s.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[s.jsxs("div",{className:"flex-1 space-y-4",children:[s.jsx(u,{enabled:Hs.enabled,onChange:Hs.toggle,label:"Repeat",tooltip:"Toggles repeater or monitor mode. In monitor mode, the repeater will not repeat packets from the mesh.",status:Hs.status,size:"md"}),s.jsx(u,{enabled:Os.enabled,onChange:Os.toggle,label:"Duty Cycle",tooltip:"Limit transmission time to comply with airtime utilization regulations",status:Os.status,size:"md"}),s.jsx(ye,{label:"Max Airtime",layout:"inline",value:`${Vs().toFixed(1)}%`,editValue:String(Vs()),type:"number",suffix:"%",step:.5,min:.1,max:100,onSave:async e=>{await K({max_airtime_percent:parseFloat(e),enforcement_enabled:ue}),V()}})]}),s.jsx("div",{className:"hidden lg:block w-px bg-border-subtle"}),s.jsxs("div",{className:"flex-1 pt-4 lg:pt-0 border-t lg:border-t-0 border-edge-subtle",children:[s.jsx("label",{className:"type-label text-fg-muted block mb-3",children:"TX Delays"}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(ye,{label:"Flood",layout:"inline",value:`${As().toFixed(2)}x`,editValue:String(As()),type:"number",suffix:"x",step:.1,min:0,max:5,onSave:async e=>$s({tx_delay_factor:parseFloat(e)})}),s.jsx(ye,{label:"Direct",layout:"inline",value:`${Ks().toFixed(2)}s`,editValue:String(Ks()),type:"number",suffix:"s",step:.1,min:0,max:5,onSave:async e=>$s({direct_tx_delay_factor:parseFloat(e)})})]})]})]})]})}),s.jsx(Y,{span:12,md:6,children:s.jsxs($,{neomorphic:!0,children:[s.jsx(U,{icon:s.jsx(y,{}),title:"App Settings"}),s.jsx("p",{className:"type-body-sm text-fg-muted mb-4",children:"Appearance and web server options."}),s.jsxs("div",{className:"space-y-4",children:[s.jsx(u,{enabled:qs.enabled,onChange:qs.toggle,label:"Enable CORS",tooltip:"Allow cross-origin API access",status:qs.status,size:"md"}),s.jsx("div",{children:s.jsx(ve,{})}),s.jsx(Pe,{})]})]})})]}),s.jsx(W,{template:"auto",children:s.jsxs($,{neomorphic:!0,children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[s.jsx(U,{icon:s.jsx(re,{}),title:"Regions Transport Keys",subtitle:"Manage regional key hierarchy for flood control"}),s.jsxs("div",{className:"flex gap-2 flex-wrap",children:[s.jsxs(v,{color:"primary",outline:!0,onClick:()=>us(!0),disabled:"allow"===ss,children:[s.jsx(z,{"data-slot":"icon"}),"Add"]}),s.jsx(v,{color:"primary",outline:!0,onClick:st,disabled:!rs||"allow"===ss,children:"Edit"}),s.jsx(v,{color:"danger",outline:!0,onClick:tt,disabled:!rs||"allow"===ss,children:"Delete"})]})]}),s.jsx("div",{className:"bg-subtle-fill radius-inner p-4 mb-4",children:s.jsx(u,{enabled:"deny"===ss,onChange:e=>(async e=>{ns(!0),es(null);try{const s=await F("allow"===e);s.success?as(e):es(s.error||"Failed to update global flood policy")}catch(s){es(s instanceof Error?s.message:"Failed to update global flood policy")}finally{ns(!1)}})(e?"deny":"allow"),label:s.jsxs(s.Fragment,{children:["Require Transport Keys: ",s.jsx("span",{className:"deny"===ss?"text-sys-green":"text-sys-red",children:"deny"===ss?"On":"Off"})]}),tooltip:"When enabled, only packets with matching transport keys are forwarded. When disabled, all packets flood freely.",status:ls?"loading":"idle",disabled:ls,dangerOff:!0,size:"md",className:"flex-row-reverse justify-between w-full"})}),Ze&&s.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-sys-red bg-sys-red/10",children:Ze}),s.jsx("div",{className:"bg-subtle-fill radius-inner p-4 min-h-[120px]",children:Ge?s.jsxs("div",{className:"flex items-center justify-center py-6",children:[s.jsx(l,{className:"w-5 h-5 animate-spin text-sys-blue mr-2"}),s.jsx("span",{className:"type-body-sm text-fg-muted",children:"Loading transport keys..."})]}):0===We.length?s.jsxs("div",{className:"text-center py-6",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-subtle-fill mx-auto mb-3 flex items-center justify-center",children:s.jsx(re,{className:"w-6 h-6 text-fg-muted/50"})}),s.jsx("p",{className:"type-body text-fg-muted",children:"No transport keys found"}),s.jsx("p",{className:"type-body-sm text-fg-muted/70 mt-1",children:"Add your first transport key to get started"})]}):s.jsx("div",{className:"space-y-1",children:We.map(e=>s.jsx(Ee,{node:e,level:0,expandedKeys:os,selectedKeyId:rs,globalFloodPolicy:ss,onSelect:is,onToggle:Zs},e.id))})})]})}),s.jsx(W,{template:"auto",children:s.jsxs($,{neomorphic:!0,children:[s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[s.jsx(U,{icon:s.jsx(G,{}),title:"API Tokens",subtitle:"Manage API tokens for machine-to-machine authentication"}),s.jsxs(v,{color:"primary",outline:!0,onClick:()=>Re(!0),children:[s.jsx(z,{"data-slot":"icon"}),"Create Token"]})]}),s.jsx("div",{className:"bg-sys-cyan/5 radius-inner p-4 mb-4",children:s.jsxs("div",{className:"flex gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-sys-cyan/20 flex items-center justify-center flex-shrink-0",children:s.jsx(x,{className:"w-4 h-4 text-sys-cyan"})}),s.jsxs("div",{className:"type-body-sm text-fg-muted",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-secondary",children:"API tokens"})," are used for machine-to-machine authentication. Include the token in the ",s.jsx("code",{className:"type-code bg-sys-cyan/20 px-1.5 py-0.5 rounded-full text-sys-cyan",children:"X-API-Key"})," header when making API requests."]}),s.jsx("p",{className:"mt-1 text-fg-muted/70",children:"Tokens are only shown once at creation. Store them securely."})]})]})}),Te&&s.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-sys-red bg-sys-red/10",children:Te}),je&&0===pe.length?s.jsxs("div",{className:"flex items-center justify-center py-6",children:[s.jsx(l,{className:"w-5 h-5 animate-spin text-sys-blue mr-2"}),s.jsx("span",{className:"type-body-sm text-fg-muted",children:"Loading tokens..."})]}):pe.length>0?s.jsx("div",{className:"space-y-2",children:pe.map(e=>s.jsx("div",{className:"bg-subtle-fill hover:bg-subtle-fill-strong radius-inner p-4 transition-base",children:s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-sys-blue/10 flex items-center justify-center flex-shrink-0",children:s.jsx(G,{className:"w-5 h-5 text-sys-blue"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"type-body text-fg-primary font-medium truncate",children:e.name}),s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-0.5",children:[s.jsxs("span",{className:"type-data-sm text-fg-muted truncate",children:["Created: ",Us(e.created_at)]}),s.jsxs("span",{className:"type-data-sm text-fg-muted truncate",children:["Last used: ",Us(e.last_used)]})]})]})]}),s.jsxs(v,{color:"danger",outline:!0,onClick:()=>Oe({id:e.id,name:e.name}),disabled:Be,children:[s.jsx(M,{"data-slot":"icon"}),"Revoke"]})]})},e.id))}):s.jsxs("div",{className:"bg-subtle-fill radius-inner p-6 text-center",children:[s.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:s.jsx(G,{className:"w-7 h-7 text-fg-muted/50"})}),s.jsx("h3",{className:"type-body text-fg-primary font-medium mb-1",children:"No API Tokens"}),s.jsx("p",{className:"type-body-sm text-fg-muted mb-4",children:"Create a token to enable API access"}),s.jsx(v,{color:"primary",outline:!0,onClick:()=>Re(!0),children:"Create Your First Token"})]})]})}),s.jsx(W,{template:"auto",children:s.jsxs($,{neomorphic:!0,children:[s.jsx(U,{icon:s.jsx(ie,{}),title:"Web Frontend",subtitle:"Choose which web interface to use",className:"mb-4"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("label",{className:t("flex items-start gap-3 p-4 bg-subtle-fill radius-card border-2 cursor-pointer transition-base",Ss?"border-sys-blue bg-sys-blue/5":"border-transparent hover:border-sys-blue/30","loading"===Ms&&"opacity-50 pointer-events-none"),children:[s.jsx("input",{type:"radio",name:"frontend",checked:Ss,onChange:()=>Bs(!0),disabled:"loading"===Ms,className:"mt-1 h-4 w-4 text-sys-blue focus:ring-sys-blue focus:ring-offset-bg-elevated"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"type-body text-fg-primary font-medium",children:"Default Frontend"}),s.jsx("a",{href:"https://github.com/rightup/pyMC_Repeater",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"type-data-xs bg-sys-cyan/15 text-sys-cyan px-2.5 py-0.5 rounded-full font-medium hover:bg-sys-cyan/25 transition-colors",children:"@RightUp"})]}),s.jsx("div",{className:"type-body-sm text-fg-muted mt-1",children:"Built-in pyMC Repeater web interface"}),s.jsx("div",{className:"type-data-xs text-fg-muted/60 mt-1",children:"/opt/pymc_repeater/repeater/web/html"})]})]}),s.jsxs("label",{className:t("flex items-start gap-3 p-4 bg-subtle-fill radius-card border-2 cursor-pointer transition-base",Ss?"border-transparent hover:border-sys-blue/30":"border-sys-blue bg-sys-blue/5","loading"===Ms&&"opacity-50 pointer-events-none"),children:[s.jsx("input",{type:"radio",name:"frontend",checked:!Ss,onChange:()=>Bs(!1),disabled:"loading"===Ms,className:"mt-1 h-4 w-4 text-sys-blue focus:ring-sys-blue focus:ring-offset-bg-elevated"}),s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"type-body text-fg-primary font-medium",children:"PyMC Console"}),s.jsx("span",{className:"type-data-xs bg-sys-indigo/15 text-sys-indigo px-2.5 py-0.5 rounded-full font-medium",children:"@Treehouse ⚡"})]}),s.jsx("div",{className:"type-body-sm text-fg-muted mt-1",children:"Alternative web interface for pyMC Repeater"}),s.jsx("div",{className:"type-data-xs text-fg-muted/60 mt-1",children:"/opt/pymc_console/web/html"})]})]})]}),!Es&&s.jsx("div",{className:t("bg-subtle-fill radius-card p-4",Fs?"border border-sys-green/20":"border border-sys-cyan/20"),children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:t("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",Fs?"bg-sys-green/20":"bg-sys-cyan/20"),children:Fs?s.jsx(Q,{className:"w-4 h-4 text-sys-green"}):s.jsx(x,{className:"w-4 h-4 text-sys-cyan"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"type-body text-fg-primary font-medium",children:Fs?"PyMC Console has been detected":"PyMC Console Not Installed"}),Fs?s.jsxs("p",{className:"type-body-sm text-fg-muted mt-1",children:["PyMC Console is installed at ",s.jsx("code",{className:"type-code bg-sys-green/10 px-1.5 py-0.5 rounded-full text-sys-green",children:"/opt/pymc_console/web/html"})]}):s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"type-body-sm text-fg-muted mt-1 mb-3",children:["PyMC Console must be installed at ",s.jsx("code",{className:"type-code bg-sys-cyan/10 px-1.5 py-0.5 rounded-full text-sys-cyan",children:"/opt/pymc_console/web/html"})," before selecting this option."]}),s.jsxs(v,{color:"primary",outline:!0,href:"https://github.com/dmduran12/pymc_console-dist",children:[s.jsx(le,{"data-slot":"icon"}),"PyMC Console Install Instructions"]})]})]})]})}),Rs&&s.jsx("div",{className:"bg-subtle-fill radius-card p-4 border border-sys-indigo/30",children:s.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[s.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-sys-indigo/20 flex items-center justify-center flex-shrink-0",children:s.jsx(Z,{className:"w-4 h-4 text-sys-indigo"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"type-body text-fg-primary font-medium",children:"Service restart required"}),s.jsx("p",{className:"type-body-sm text-fg-muted mt-1",children:"Web frontend changes will take effect after restarting the pymc-repeater service."})]})]}),s.jsx(v,{color:"warning",outline:!0,onClick:async()=>{if(!Is){Ls(!0);try{await _(),Ds(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{Ds(!1),setTimeout(()=>{window.location.reload()},3e3)}}},disabled:Is,children:Is?s.jsxs(s.Fragment,{children:[s.jsx(l,{"data-slot":"icon",className:"animate-spin"}),"Restarting..."]}):s.jsxs(s.Fragment,{children:[s.jsx(ee,{"data-slot":"icon"}),"Restart Now"]})})]})})]})]})}),D&&s.jsx(W,{template:"auto",children:s.jsx(A,{nodeName:ce,repeaterVersion:D.version,coreVersion:D.core_version,localHash:D.local_hash,publicKey:D.public_key})}),D&&(0===(null==ne?void 0:ne.latitude)||!(null==ne?void 0:ne.latitude))&&(0===(null==ne?void 0:ne.longitude)||!(null==ne?void 0:ne.longitude))&&s.jsx(W,{template:"auto",children:s.jsx(ke,{})})]}),ze&&s.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&Re(!1),role:"dialog","aria-modal":"true","aria-labelledby":"create-token-modal-title",children:s.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[s.jsx("h3",{id:"create-token-modal-title",className:"type-micro mb-4",children:"Create API Token"}),s.jsxs("div",{className:"space-y-4",children:[s.jsx(N,{label:"Token Name",type:"text",value:De,onChange:e=>Ie(e.target.value),placeholder:"e.g., Production Server, CI/CD Pipeline",description:"Give your token a descriptive name to identify its purpose",onKeyDown:e=>"Enter"===e.key&&Js(),autoFocus:!0}),s.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[s.jsx(v,{color:"muted",outline:!0,onClick:()=>{Re(!1),Ie(""),Me(null)},disabled:qe,children:"Cancel"}),s.jsx(v,{color:"primary",onClick:Js,disabled:qe||!De.trim(),children:qe?s.jsxs(s.Fragment,{children:[s.jsx(l,{"data-slot":"icon",className:"animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),Ke&&Le&&s.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&Ve(!1),role:"dialog","aria-modal":"true","aria-labelledby":"show-token-modal-title",children:s.jsxs("div",{className:"surface-modal radius-card p-6 max-w-lg w-full",children:[s.jsx("h3",{id:"show-token-modal-title",className:"type-micro mb-4",children:"Token Created Successfully"}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"bg-sys-indigo/10 border border-sys-indigo/30 radius-inner p-3",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Z,{className:"w-4 h-4 text-sys-indigo flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm text-fg-secondary",children:[s.jsx("strong",{children:"Save this token now!"})," For security reasons, it will not be shown again."]})]})}),s.jsxs("div",{children:[s.jsx("label",{className:"type-label text-fg-primary block mb-1.5",children:"Your API Token"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(w,{value:Le,readOnly:!0,className:"flex-1 font-mono"}),s.jsxs(v,{color:"primary",outline:!0,onClick:()=>{Le&&(navigator.clipboard.writeText(Le),Ue(!0),setTimeout(()=>Ue(!1),2e3))},children:[Je?s.jsx(n,{"data-slot":"icon",className:"text-sys-green"}):s.jsx(se,{"data-slot":"icon"}),Je?"Copied!":"Copy"]})]})]}),s.jsxs("div",{className:"bg-sys-cyan/10 border border-sys-cyan/30 radius-inner p-3",children:[s.jsx("p",{className:"text-sm text-fg-secondary mb-2",children:s.jsx("strong",{children:"Usage Example:"})}),s.jsxs("code",{className:"block bg-sys-cyan/20 px-3 py-2 rounded type-code text-sys-cyan overflow-x-auto",children:['curl -H "X-API-Key: ',Le.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),s.jsx("div",{className:"flex justify-end mt-6",children:s.jsx(v,{color:"primary",onClick:()=>{Ve(!1),Ae(null)},children:"Done"})})]})]})}),s.jsx(R,{isOpen:!!He,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${null==He?void 0:He.name}'? This action cannot be undone.`,confirmLabel:Be?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:async()=>{if(He){Xe(!0),Me(null);try{await async function(e){return o(`/auth/tokens/${e}`,{method:"DELETE"})}(He.id),await Xs(),Oe(null)}catch(e){Me(e instanceof Error?e.message:"Failed to revoke token")}finally{Xe(!1)}}},onCancel:()=>Oe(null)}),ds&&s.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&us(!1),role:"dialog","aria-modal":"true","aria-labelledby":"add-key-modal-title",children:s.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[s.jsx("h3",{id:"add-key-modal-title",className:"type-micro mb-4",children:"Add Transport Key"}),s.jsxs("div",{className:"space-y-4",children:[rs&&s.jsxs("div",{className:"bg-sys-cyan/10 border border-sys-cyan/30 radius-inner p-3 text-sm text-fg-secondary",children:["Adding as child of: ",s.jsx("strong",{className:"text-fg-primary",children:Qs()})]}),s.jsx(N,{label:"Key Name",type:"text",value:js,onChange:e=>vs(e.target.value),placeholder:"e.g., Region Name, Group Key",onKeyDown:e=>"Enter"===e.key&&et(),autoFocus:!0}),s.jsxs("div",{children:[s.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Flood Policy"}),s.jsxs("div",{className:"toggle-group w-full",children:[s.jsx("button",{onClick:()=>ws("deny"),className:t("toggle-group-item flex-1","deny"===Ns&&"active !text-sys-red"),children:"Deny"}),s.jsx("button",{onClick:()=>ws("allow"),className:t("toggle-group-item flex-1","allow"===Ns&&"active !text-sys-green"),children:"Allow"})]})]}),s.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[s.jsx(v,{color:"muted",outline:!0,onClick:()=>{us(!1),vs(""),ws("allow")},disabled:ks,children:"Cancel"}),s.jsx(v,{color:"primary",onClick:et,disabled:ks||!js.trim(),children:ks?s.jsxs(s.Fragment,{children:[s.jsx(l,{"data-slot":"icon",className:"animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),ms&&ys&&s.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&xs(!1),role:"dialog","aria-modal":"true","aria-labelledby":"edit-key-modal-title",children:s.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[s.jsx("h3",{id:"edit-key-modal-title",className:"type-micro mb-4",children:"Edit Transport Key"}),s.jsxs("div",{className:"space-y-4",children:[s.jsx(N,{label:"Key Name",type:"text",value:ys.name,onChange:e=>fs({...ys,name:e.target.value}),autoFocus:!0}),s.jsxs("div",{children:[s.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Flood Policy"}),s.jsxs("div",{className:"toggle-group w-full",children:[s.jsx("button",{onClick:()=>fs({...ys,floodPolicy:"deny"}),className:t("toggle-group-item flex-1","deny"===ys.floodPolicy&&"active !text-sys-red"),children:"Deny"}),s.jsx("button",{onClick:()=>fs({...ys,floodPolicy:"allow"}),className:t("toggle-group-item flex-1","allow"===ys.floodPolicy&&"active !text-sys-green"),children:"Allow"})]})]}),ys.transport_key&&s.jsxs("div",{children:[s.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Transport Key"}),s.jsx("code",{className:"block bg-input-bg px-3 py-2 radius-inner border border-input-border type-code text-fg-muted overflow-x-auto",children:ys.transport_key})]}),s.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[s.jsx(v,{color:"danger",outline:!0,onClick:()=>{xs(!1),bs(ys),ps(!0),fs(null)},disabled:ks,children:"Delete"}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx(v,{color:"muted",outline:!0,onClick:()=>{xs(!1),fs(null)},disabled:ks,children:"Cancel"}),s.jsx(v,{color:"primary",onClick:async()=>{if(ys){Cs(!0),es(null);try{const e=await E(ys.id,{name:ys.name,flood_policy:ys.floodPolicy});e.success?(await Ys(),xs(!1),fs(null)):es(e.error||"Failed to update transport key")}catch(e){es(e instanceof Error?e.message:"Failed to update transport key")}finally{Cs(!1)}}},disabled:ks||!ys.name.trim(),children:ks?s.jsxs(s.Fragment,{children:[s.jsx(l,{"data-slot":"icon",className:"animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),hs&&gs&&s.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:e=>e.target===e.currentTarget&&ps(!1),role:"dialog","aria-modal":"true","aria-labelledby":"delete-key-modal-title",children:s.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[s.jsx("h3",{id:"delete-key-modal-title",className:"type-micro mb-4",children:"Delete Transport Key"}),s.jsxs("p",{className:"text-fg-secondary mb-4",children:["Are you sure you want to delete ",s.jsxs("strong",{className:"text-fg-primary",children:["'",gs.name,"'"]}),"?"]}),gs.children&&gs.children.length>0&&s.jsx("div",{className:"bg-sys-indigo/10 border border-sys-indigo/30 radius-inner p-3 mb-4",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Z,{className:"w-4 h-4 text-sys-indigo flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm text-fg-secondary",children:["This key has ",gs.children.length," child key(s). Deleting will also remove all children."]})]})}),s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsx(v,{color:"muted",outline:!0,onClick:()=>{ps(!1),bs(null)},disabled:ks,children:"Cancel"}),s.jsx(v,{color:"danger",onClick:async()=>{if(gs){Cs(!0),es(null);try{const e=await P(gs.id);e.success?(await Ys(),ps(!1),bs(null),is(null)):es(e.error||"Failed to delete transport key")}catch(e){es(e instanceof Error?e.message:"Failed to delete transport key")}finally{Cs(!1)}}},disabled:ks,children:ks?s.jsxs(s.Fragment,{children:[s.jsx(l,{"data-slot":"icon",className:"animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{Me as default}; diff --git a/frontend/dist/assets/ConfirmModal-B8b131zF.js b/frontend/dist/assets/ConfirmModal-CX0HrTOx.js similarity index 89% rename from frontend/dist/assets/ConfirmModal-B8b131zF.js rename to frontend/dist/assets/ConfirmModal-CX0HrTOx.js index 09db69be..ffec2f89 100644 --- a/frontend/dist/assets/ConfirmModal-B8b131zF.js +++ b/frontend/dist/assets/ConfirmModal-CX0HrTOx.js @@ -1 +1 @@ -import{c as e,W as a,bR as s,X as n,cQ as r,B as t}from"./index-01Tx8g53.js";import{r as o,j as l,c as i}from"./vendor-react-j_fHog8x.js";import{T as c}from"./triangle-alert-DI33YyZq.js";const d=e("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),m=e("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),h={danger:"text-sys-red",warning:"text-sys-indigo",default:"text-sys-blue"},x={danger:"danger",warning:"warning",default:"primary"},p=o.memo(function({isOpen:e,title:o="Confirm",message:d,confirmLabel:m="Confirm",cancelLabel:p="Cancel",variant:f="default",onConfirm:j,onCancel:y}){return l.jsxs(a,{open:e,onClose:y,size:"sm",children:[l.jsx(s,{icon:l.jsx(c,{className:i("w-5 h-5",h[f])}),title:o,onClose:y}),l.jsx(n,{children:l.jsx("p",{className:"text-sm text-fg-secondary",children:d})}),l.jsxs(r,{children:[l.jsx(t,{color:"muted",onClick:y,className:"flex-1",children:p}),l.jsx(t,{color:x[f],onClick:j,className:"flex-1",children:m})]})]})});export{p as C,d as P,m as T}; +import{c as e,W as a,bR as s,X as n,cQ as r,B as t}from"./index-BBcIGlRT.js";import{r as o,j as l,c as i}from"./vendor-react-j_fHog8x.js";import{T as c}from"./triangle-alert-DH80WgOo.js";const d=e("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),m=e("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),h={danger:"text-sys-red",warning:"text-sys-indigo",default:"text-sys-blue"},x={danger:"danger",warning:"warning",default:"primary"},p=o.memo(function({isOpen:e,title:o="Confirm",message:d,confirmLabel:m="Confirm",cancelLabel:p="Cancel",variant:f="default",onConfirm:j,onCancel:y}){return l.jsxs(a,{open:e,onClose:y,size:"sm",children:[l.jsx(s,{icon:l.jsx(c,{className:i("w-5 h-5",h[f])}),title:o,onClose:y}),l.jsx(n,{children:l.jsx("p",{className:"text-sm text-fg-secondary",children:d})}),l.jsxs(r,{children:[l.jsx(t,{color:"muted",onClick:y,className:"flex-1",children:p}),l.jsx(t,{color:x[f],onClick:j,className:"flex-1",children:m})]})]})});export{p as C,d as P,m as T}; diff --git a/frontend/dist/assets/Contacts-CiTyOtpU.js b/frontend/dist/assets/Contacts-DbMN-LnJ.js similarity index 95% rename from frontend/dist/assets/Contacts-CiTyOtpU.js rename to frontend/dist/assets/Contacts-DbMN-LnJ.js index f5ab0afc..c5732999 100644 --- a/frontend/dist/assets/Contacts-CiTyOtpU.js +++ b/frontend/dist/assets/Contacts-DbMN-LnJ.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-BEIMeErH.js","assets/vendor-react-j_fHog8x.js","assets/BasemapLayer-BT1oL_wV.js","assets/vendor-core-CmkNwW1A.js","assets/link-scoring-LTbqUxGC.js","assets/index-01Tx8g53.js","assets/ConfirmModal-B8b131zF.js","assets/triangle-alert-DI33YyZq.js","assets/DeepAnalysisModal-BWClcGsg.js","assets/geo-utils-D72kdxDo.js","assets/git-branch-Bz_gqcbv.js","assets/database-Cxl-xDNL.js","assets/message-square-B0UfZczh.js","assets/DelayedAnimateNumber-Ix4AeV6C.js","assets/index-D932VMrD.js","assets/refresh-cw-DYbYazpH.js","assets/target-L50EKHoJ.js","assets/sun-CkgnTZGI.js","assets/easing-DMuAVfRm.js","assets/SignalIndicator-CIKrVFY9.js","assets/signal-scoring-CcBiRcks.js","assets/font-loader-BQzEmDrZ.js","assets/wifi-DUOhGE6X.js","assets/users-CIk0ES1a.js","assets/badge-colors-YAE4qQ7m.js","assets/LightSparkline-BCL2qx0n.js","assets/copy-B5OWhmpX.js","assets/map-pin-DZIYgupP.js","assets/ping-CcgRdnC3.js","assets/node-types-BT5BImck.js","assets/PageLayout-DrvMAhys.js","assets/listbox-D30S1eZ7.js","assets/Card-Dr9pbVV5.js","assets/activity-DOuX3omM.js","assets/DataBox-Dpf5ZHgV.js","assets/funnel-4zcnjEgH.js","assets/circle-check-DXO8ha7w.js","assets/chat-utils-CB1BFUm7.js","assets/CollisionExplorerModal-CTPNNbNo.js","assets/network-CCjpHq5M.js","assets/search-DGnzblbI.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-QdsUNncv.css"])))=>i.map(i=>d[i]); -import{j as e,r as s,c as t,_ as a}from"./vendor-react-j_fHog8x.js";import{c as n,aA as l,aB as i,aC as r,au as c,h as o,aD as d,Y as m,aE as x,o as h,an as p,aF as g,aG as u,G as f,O as j,R as b,j as N,L as y,aH as v,y as w,aI as k,aJ as C,aK as M,x as S,aL as L,aM as P,aN as F,aO as $,aP as R,I as E,a5 as H}from"./index-01Tx8g53.js";import{p as T}from"./ping-CcgRdnC3.js";import{C as _,c as z}from"./node-types-BT5BImck.js";import{P as O,b as I,B as A}from"./PageLayout-DrvMAhys.js";import{L as D,a as G}from"./listbox-D30S1eZ7.js";import{C as U}from"./Card-Dr9pbVV5.js";import{T as V}from"./triangle-alert-DI33YyZq.js";import{b as W,Z as B,C as K,A as q,c as Z}from"./SignalIndicator-CIKrVFY9.js";import{G as J}from"./git-branch-Bz_gqcbv.js";import{E as Y,S as Q,T as X}from"./target-L50EKHoJ.js";import{A as ee}from"./activity-DOuX3omM.js";import{D as se}from"./DataBox-Dpf5ZHgV.js";import{F as te}from"./funnel-4zcnjEgH.js";import{P as ae,T as ne,C as le}from"./ConfirmModal-B8b131zF.js";import{U as ie}from"./users-CIk0ES1a.js";import{M as re}from"./map-pin-DZIYgupP.js";import{C as ce}from"./circle-check-DXO8ha7w.js";import{e as oe,g as de,a as me}from"./chat-utils-CB1BFUm7.js";import{C as xe,S as he,M as pe}from"./CollisionExplorerModal-CTPNNbNo.js";import{C as ge}from"./badge-colors-YAE4qQ7m.js";import{M as ue}from"./message-square-B0UfZczh.js";import{N as fe}from"./network-CCjpHq5M.js";import{S as je}from"./search-DGnzblbI.js";const be=n("arrow-down-left",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]),Ne=n("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]),ye=n("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]),ve=n("file-digit",[["path",{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2",key:"jrl274"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 16h2v6",key:"1bxocy"}],["path",{d:"M10 22h4",key:"ceow96"}],["rect",{x:"2",y:"16",width:"4",height:"6",rx:"2",key:"r45zd0"}]]),we=n("list-filter",[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]]),ke=n("move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]),Ce=n("radio-tower",[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]),Me=n("ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]),Se=n("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),Le=n("trending-down",[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]]),Pe=n("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);class Fe extends s.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){var s;return this.state.hasError?e.jsx("div",{className:t("map-container-16-9 flex items-center justify-center rounded-2xl",l),role:"alert","aria-live":"assertive",children:e.jsxs("div",{className:"text-center text-fg-muted p-4",children:[e.jsx("p",{className:"text-lg mb-2",children:"Map failed to load"}),e.jsx("p",{className:"text-sm text-fg-muted",children:(null==(s=this.state.error)?void 0:s.message)||"Unknown error"}),e.jsx("p",{className:"text-xs text-fg-muted mt-2",children:"Try refreshing the page or check your browser's WebGL support."})]})}):this.props.children}}const $e=s.lazy(()=>a(()=>import("./ContactsMapMapLibre-BEIMeErH.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42])));function Re({neighbors:a,localNode:n,localHash:i,onRemoveNode:r,selectedNodeHash:c,onNodeSelected:o,highlightedEdgeKey:d,highlightedGhost:m}){return e.jsx(Fe,{children:e.jsx(s.Suspense,{fallback:e.jsx("div",{className:t("map-container-16-9 flex items-center justify-center rounded-2xl",l),role:"status","aria-live":"polite","aria-label":"Loading map",children:e.jsxs("div",{className:"text-fg-muted flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-sys-blue border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading map..."})]})}),children:e.jsx($e,{neighbors:a,localNode:n,localHash:i,onRemoveNode:r,selectedNodeHash:c,onNodeSelected:o,highlightedEdgeKey:d,highlightedGhost:m})})})}function Ee(e){return e>=.7?"text-sys-green":e>=.5?"text-sys-indigo":e>=.3?"text-signal-poor":"text-sys-red"}function He(e){return`${Math.round(100*e)}%`}function Te(e,s){return s.has(e.toUpperCase())}const _e=s.memo(function({path:s,isHighlighted:t,onHighlight:a,ghostPrefixes:n}){const l=function(s){return s>.2?{icon:e.jsx(Pe,{className:"w-3 h-3"}),color:"text-sys-green"}:s<-.2?{icon:e.jsx(Le,{className:"w-3 h-3"}),color:"text-sys-red"}:{icon:e.jsx(x,{className:"w-3 h-3"}),color:"text-fg-muted"}}(s.observationTrend),i=s.weakestLinkKey&&s.weakestLinkConfidence<.5,r=s.hops.some(e=>Te(e,n));return e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md transition-colors cursor-pointer "+(t?"bg-sys-blue/20 border border-sys-blue/40":"hover:bg-subtle-fill"),onClick:()=>a(t?null:s.weakestLinkKey),children:[e.jsx("div",{className:"flex-shrink-0 w-12 text-center py-1 rounded-md "+(c=s.healthScore,c>=.7?"bg-sys-green/10":c>=.5?"bg-sys-indigo/10":c>=.3?"bg-signal-poor/10":"bg-sys-red/10"),children:e.jsx("span",{className:`text-xs font-semibold tabular-nums ${Ee(s.healthScore)}`,children:He(s.healthScore)})}),e.jsx("div",{className:"flex-1 flex items-center gap-0.5 overflow-x-auto min-w-0",children:s.hops.map((t,a)=>{var l;const r=Te(t,n),c=i&&(null==(l=s.weakestLinkKey)?void 0:l.includes(t));return e.jsxs("span",{className:"flex items-center",children:[e.jsxs("span",{className:"type-data-xs px-1.5 py-0.5 rounded flex items-center gap-0.5 "+(r?"bg-sys-cyan/20 text-sys-cyan border border-sys-cyan/30":c?"bg-sys-red/20 text-sys-red":"bg-subtle-fill-strong text-fg-secondary"),children:[r&&e.jsx(d,{className:"w-2.5 h-2.5"}),t]}),anew Set(h.map(e=>e.prefix.toUpperCase())),[h]),f=s.useMemo(()=>l.slice(0,t),[l,t]),j=s.useMemo(()=>0===l.length?null:{avgHealth:l.reduce((e,s)=>e+s.healthScore,0)/l.length,declining:l.filter(e=>e.observationTrend<-.2).length,weakLinks:l.filter(e=>e.weakestLinkConfidence<.5).length,pathsWithGhosts:l.filter(e=>e.hops.some(e=>u.has(e.toUpperCase()))).length},[l,u]),b=e=>{null==a||a(e)};return 0===l.length?null:e.jsxs(o,{noPadding:!0,children:[e.jsx(U,{listHeader:!0,icon:e.jsx(J,{}),title:"Path Health",onClick:()=>g(!p),className:"hover:bg-subtle-fill transition-colors rounded-t-lg",titleExtra:e.jsxs("span",{className:"ml-2 text-xs font-normal text-fg-muted",children:["(",l.length," paths)"]}),actions:e.jsxs("div",{className:"flex items-center gap-3",children:[j&&e.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[e.jsxs("span",{className:`tabular-nums ${Ee(j.avgHealth)}`,children:["Avg: ",He(j.avgHealth)]}),j.weakLinks>0&&e.jsxs("span",{className:"text-sys-red flex items-center gap-1",children:[e.jsx(V,{className:"w-3 h-3"}),j.weakLinks," weak"]}),j.declining>0&&e.jsxs("span",{className:"text-signal-poor flex items-center gap-1",children:[e.jsx(Le,{className:"w-3 h-3"}),j.declining," declining"]}),j.pathsWithGhosts>0&&e.jsxs("span",{className:"text-sys-cyan flex items-center gap-1",children:[e.jsx(d,{className:"w-3 h-3"}),j.pathsWithGhosts," ghost"]})]}),p?e.jsx(W,{className:"w-4 h-4 text-fg-muted"}):e.jsx(m,{className:"w-4 h-4 text-fg-muted"})]})}),p&&e.jsxs("div",{className:"p-3 pt-0 space-y-1",children:[x.totalPaths>0&&e.jsxs("div",{className:"flex items-center gap-3 text-xs text-fg-muted pb-2 border-b border-edge-subtle",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Y,{className:"w-3 h-3 text-sys-blue"}),e.jsx("span",{className:"text-fg-secondary",children:x.totalPaths.toLocaleString()})," Viterbi decoded"]}),x.observationOverrideCount>0&&e.jsxs("span",{className:"text-sys-green",children:[Math.round(x.observationOverrideCount/x.totalPaths*100),"% observation override"]}),h.length>0&&e.jsxs("span",{className:"text-sys-cyan flex items-center gap-1",children:[e.jsx(d,{className:"w-3 h-3"}),h.length," ghost",1!==h.length?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-fg-muted pb-2 border-b border-edge-subtle",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-sys-green"})," Healthy (≥70%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-sys-indigo"})," Fair (50-70%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-signal-poor"})," Weak (30-50%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-sys-red"})," Critical (<30%)"]}),h.length>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(d,{className:"w-3 h-3 text-sys-cyan"})," Ghost"]})]}),e.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:f.map(s=>e.jsx(_e,{path:s,isHighlighted:n===s.weakestLinkKey,onHighlight:b,ghostPrefixes:u},s.pathKey))}),l.length>t&&e.jsxs("div",{className:"text-center text-xs text-fg-muted pt-2",children:["Showing top ",t," of ",l.length," paths"]})]})]})});function Oe(e){switch(e){case"rf_intersection":return"RF Circle Intersection";case"weighted_centroid":return"Weighted Centroid";case"single_anchor":return"Single Anchor (less reliable)";default:return e}}const Ie={confirmed:{label:"Confirmed",icon:e.jsx(Se,{className:"w-3.5 h-3.5"}),borderClass:"border-sys-green/40",bgClass:"bg-sys-green/10",textClass:"text-sys-green",badgeClass:"bg-sys-green/20 text-sys-green"},likely:{label:"Likely",icon:e.jsx(h,{className:"w-3.5 h-3.5"}),borderClass:"border-sys-cyan/30",bgClass:"bg-sys-cyan/5",textClass:"text-sys-cyan",badgeClass:"bg-sys-cyan/20 text-sys-cyan"},possible:{label:"Possible",icon:e.jsx(_,{className:"w-3.5 h-3.5"}),borderClass:"border-sys-indigo/20",bgClass:"bg-sys-indigo/5",textClass:"text-sys-indigo",badgeClass:"bg-sys-indigo/20 text-sys-indigo"},noise:{label:"Noise",icon:e.jsx(V,{className:"w-3.5 h-3.5"}),borderClass:"border-edge-subtle",bgClass:"bg-surface/30",textClass:"text-fg-muted",badgeClass:"bg-elevated text-fg-muted"}};function Ae({ghost:a,neighbors:n,isExpanded:l,onToggle:i,compact:r}){var c,o;const x=(null==(c=a.classification)?void 0:c.tier)??"noise",h=Ie[x],u="clusterId"in(f=a)&&"temporal"in f;var f;const j=s.useMemo(()=>Array.from(a.commonNeighbors).map(e=>{var s;return{hash:e,name:null==(s=n[e])?void 0:s.name}}),[a.commonNeighbors,n]),b=a.estimatedLocation?a.estimatedLocation.uncertaintyM>=1e3?`±${(a.estimatedLocation.uncertaintyM/1e3).toFixed(1)}km`:`±${Math.round(a.estimatedLocation.uncertaintyM)}m`:null,N=u&&a.temporal?(y=a.temporal.consistency)>=.7?{label:"Steady",color:"text-sys-green"}:y>=.4?{label:"Regular",color:"text-sys-cyan"}:y>=.2?{label:"Sporadic",color:"text-sys-indigo"}:{label:"Bursty",color:"text-signal-poor"}:null;var y;const v=u&&a.collisionCandidates&&a.collisionCandidates.length>0,w=v?a.collisionCandidates[0]:null;return r?e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded bg-elevated/50 text-sm",children:[e.jsx("span",{className:"font-mono font-medium text-fg-secondary",children:a.prefix.toUpperCase()}),e.jsx("span",{className:"text-fg-muted",children:a.observationCount})]}):e.jsxs("div",{className:t("rounded-lg border transition-all duration-150",h.borderClass,h.bgClass),children:[e.jsxs("button",{onClick:i,className:"w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-subtle-fill rounded-lg",children:[e.jsx(d,{className:t("w-5 h-5 flex-shrink-0",h.textClass)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-sm font-semibold text-fg-primary",children:a.prefix.toUpperCase()}),e.jsx("span",{className:t("px-1.5 py-0.5 rounded text-sm font-medium",h.badgeClass),children:h.label})]}),e.jsx("div",{className:t("text-sm mt-0.5",h.textClass),children:(null==(o=a.classification)?void 0:o.reason)??"Unknown"}),e.jsxs("div",{className:"flex items-center gap-3 text-sm text-fg-muted mt-1",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Y,{className:"w-3 h-3"}),a.observationCount]}),e.jsxs("span",{children:[(100*a.confidence).toFixed(0),"%"]}),a.commonNeighbors.size>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ie,{className:"w-3 h-3"}),a.commonNeighbors.size]}),a.estimatedLocation&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(re,{className:"w-3 h-3"}),b]}),N&&e.jsxs("span",{className:t("flex items-center gap-1",N.color),children:[e.jsx(ee,{className:"w-3 h-3"}),N.label]}),v&&e.jsxs("span",{className:"flex items-center gap-1 text-signal-poor",children:[e.jsx(Q,{className:"w-3 h-3"}),"Collision?"]})]})]}),l?e.jsx(W,{className:"w-4 h-4 text-fg-muted"}):e.jsx(m,{className:"w-4 h-4 text-fg-muted"})]}),l&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-edge-subtle/50 mt-1 pt-3",children:[v&&w&&e.jsx("div",{className:"p-2 rounded bg-signal-poor/10 border border-signal-poor/30",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Q,{className:"w-4 h-4 text-signal-poor flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-signal-poor font-medium",children:"Possible collision with known node"}),e.jsx("div",{className:"text-fg-secondary mt-0.5",children:w.knownNodeName?e.jsxs("span",{children:["May match ",e.jsx("span",{className:"font-medium",children:w.knownNodeName})," ","(",(100*w.collisionProbability).toFixed(0),"% probability)"]}):e.jsxs("span",{children:["May match ",e.jsx(se,{copy:!0,size:"compact",className:"inline",children:w.knownNodeHash})," ","(",(100*w.collisionProbability).toFixed(0),"% probability)"]})}),w.evidence&&e.jsxs("div",{className:"text-fg-muted mt-1 text-xs",children:[w.evidence.sharedEdgeCount>0&&e.jsxs("span",{className:"mr-2",children:[w.evidence.sharedEdgeCount," shared edges"]}),void 0!==w.evidence.distanceKm&&e.jsxs("span",{className:"mr-2",children:[w.evidence.distanceKm.toFixed(1),"km apart"]}),w.evidence.withinUncertainty&&e.jsx("span",{className:"text-sys-indigo",children:"Within uncertainty radius"})]})]})]})}),a.estimatedLocation?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(re,{className:"w-4 h-4 text-sys-blue mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-fg-primary font-medium",children:[a.estimatedLocation.lat.toFixed(5),", ",a.estimatedLocation.lon.toFixed(5)]}),e.jsxs("div",{className:"text-fg-muted",children:["Uncertainty: ",b]}),u&&a.location&&e.jsxs("div",{className:"mt-1 text-fg-muted",children:[e.jsxs("div",{children:["Method: ",Oe(a.location.method)]}),a.location.anchors&&a.location.anchors.length>0&&e.jsxs("div",{children:[a.location.anchors.length," anchor",1!==a.location.anchors.length?"s":""," used"," · ",(100*a.location.locationConfidence).toFixed(0),"% confidence"]})]})]})]}):e.jsxs("div",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[e.jsx(V,{className:"w-4 h-4 text-signal-poor"}),"Location unknown (neighbors lack coordinates)"]}),u&&a.temporal&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ee,{className:"w-4 h-4 text-fg-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-fg-primary font-medium",children:["Temporal Pattern: ",e.jsx("span",{className:null==N?void 0:N.color,children:null==N?void 0:N.label})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5 mt-1 text-fg-muted",children:[e.jsxs("span",{children:["Distinct hours: ",a.temporal.distinctHours]}),e.jsxs("span",{children:["Distinct days: ",a.temporal.distinctDays]}),e.jsxs("span",{children:["Burstiness: ",(100*a.temporal.burstiness).toFixed(0),"%"]}),e.jsxs("span",{children:["Consistency: ",(100*a.temporal.consistency).toFixed(0),"%"]}),e.jsxs("span",{children:["Last 24h: ",a.temporal.last24HourCount," obs"]}),e.jsxs("span",{children:["Active hours: ",a.temporal.activeHoursLast24,"/24"]})]})]})]}),!u&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(p,{className:"w-4 h-4 text-fg-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-fg-primary",children:["First seen: ",g(a.firstSeen)," ago"]}),e.jsxs("div",{className:"text-fg-muted",children:["Last seen: ",g(a.lastSeen)," ago"]})]})]}),u&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ye,{className:"w-4 h-4 text-fg-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-fg-primary",children:["Active period: ",g(a.firstSeen)," – ",g(a.lastSeen)," ago"]}),a.temporal&&e.jsxs("div",{className:"text-fg-muted",children:["Obs/hour avg: ",a.temporal.observationsPerHour.toFixed(1)]})]})]}),j.length>0&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ie,{className:"w-4 h-4 text-fg-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-fg-muted mb-1",children:["Adjacent to ",j.length," known node",1!==j.length?"s":"",":"]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[j.slice(0,5).map(({hash:s})=>e.jsx(se,{copy:!0,size:"compact",children:s},s)),j.length>5&&e.jsxs("span",{className:"text-fg-muted",children:["+",j.length-5," more"]})]})]})]}),u&&a.validationStages&&e.jsxs("div",{className:"pt-2 border-t border-edge-subtle/30",children:[e.jsx("div",{className:"type-micro text-fg-muted mb-1.5",children:"Validation Stages"}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(De,{label:"Candidates",passed:a.validationStages.candidateExhaustion}),e.jsx(De,{label:"Temporal",passed:a.validationStages.temporalConsistency}),e.jsx(De,{label:"Topology",passed:a.validationStages.topologicalFit}),e.jsx(De,{label:"Location",passed:a.validationStages.locationPlausible})]})]}),a.classification&&!u&&e.jsx("div",{className:"pt-2 border-t border-edge-subtle/30",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[a.classification.criteria.hasVeryHighObservations&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs bg-sys-green/20 text-sys-green",children:"200+ obs"}),a.classification.criteria.hasHighObservations&&!a.classification.criteria.hasVeryHighObservations&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs bg-sys-cyan/20 text-sys-cyan",children:"50+ obs"}),a.classification.criteria.hasHighConfidence&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs bg-sys-green/20 text-sys-green",children:"70%+ conf"}),a.classification.criteria.hasCommonNeighbors&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs bg-sys-blue/20 text-sys-blue",children:"2+ neighbors"}),a.classification.criteria.hasGoodLocation&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs bg-sys-blue/20 text-sys-blue",children:"good loc"}),a.classification.criteria.isRecent&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs bg-fg-muted/20 text-fg-muted",children:"recent"})]})}),u&&a.upgradeRequirements&&a.upgradeRequirements.length>0&&"confirmed"!==x&&e.jsxs("div",{className:"pt-2 border-t border-edge-subtle/30",children:[e.jsx("div",{className:"type-micro text-fg-muted mb-1",children:"To upgrade tier:"}),e.jsx("ul",{className:"text-xs text-fg-secondary space-y-0.5",children:a.upgradeRequirements.slice(0,3).map((s,t)=>e.jsxs("li",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-sys-cyan",children:"•"})," ",s]},t))})]})]})]})}function De({label:s,passed:a}){return e.jsxs("span",{className:t("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",a?"bg-sys-green/20 text-sys-green":"bg-elevated text-fg-muted"),children:[a?e.jsx(ce,{className:"w-2.5 h-2.5"}):e.jsx(K,{className:"w-2.5 h-2.5"}),s]})}function Ge({neighbors:a,className:n,onGhostSelect:l}){const i=c(),o=r(),[p,g]=s.useState(new Set),[u,f]=s.useState("actionable"),[j,b]=s.useState(!1),[N,y]=s.useState(!0),[v,w]=s.useState(Date.now);s.useEffect(()=>{w(Date.now())},[i]);const k=s.useMemo(()=>i.filter(e=>!function(e,s){return s-1e3*e.lastSeen>6048e5}(e,v)),[i,v]),C=s.useMemo(()=>{const e=Array.from(p);return e.length>0?e[0]:null},[p]),M=s.useMemo(()=>C?k.find(e=>e.prefix===C)??null:null,[C,k]);s.useEffect(()=>{l&&l(M&&!N?{prefix:M.prefix,commonNeighbors:Array.from(M.commonNeighbors),estimatedLocation:M.estimatedLocation}:null)},[M,N,l]),s.useEffect(()=>{N&&g(new Set)},[N]);const{confirmed:S,likely:L,possible:P,noise:F,actionableCount:$}=s.useMemo(()=>{var e;const s=[],t=[],a=[],n=[];for(const i of k)switch((null==(e=i.classification)?void 0:e.tier)??"noise"){case"confirmed":s.push(i);break;case"likely":t.push(i);break;case"possible":a.push(i);break;case"noise":n.push(i)}const l=(e,s)=>s.observationCount-e.observationCount;return s.sort(l),t.sort(l),a.sort(l),n.sort(l),{confirmed:s,likely:t,possible:a,noise:n,actionableCount:s.length+t.length}},[k]);if(0===k.length)return null;const R=e=>{g(s=>s.has(e)?new Set:new Set([e]))},E="all"===u,H=S.length+L.length+(E?P.length:0)+(j?F.length:0);return e.jsxs("div",{className:n,children:[e.jsx(U,{listHeader:!0,icon:e.jsx(d,{}),title:"Ghost Buster",titleExtra:e.jsxs(e.Fragment,{children:[$>0&&e.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-sys-green/20 text-sys-green",children:[$," actionable"]}),N&&k.length>0&&e.jsxs("span",{className:"text-xs text-fg-muted ml-2",children:["(",k.length," total)"]})]}),actions:e.jsxs("div",{className:"flex items-center gap-2",children:[!N&&e.jsxs("button",{onClick:()=>f(e=>"actionable"===e?"all":"actionable"),className:t("flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors","all"===u?"bg-sys-blue/20 text-sys-blue":"bg-elevated text-fg-muted hover:text-fg-secondary"),children:[e.jsx(te,{className:"w-3 h-3"}),"actionable"===u?"Actionable":"All"]}),e.jsx("button",{onClick:()=>y(e=>!e),className:"flex items-center gap-1 px-2 py-1 rounded text-xs bg-elevated text-fg-muted hover:text-fg-secondary transition-colors",title:N?"Expand panel":"Minimize panel",children:N?e.jsx(ae,{className:"w-3 h-3"}):e.jsx(x,{className:"w-3 h-3"})})]})}),N?e.jsxs("div",{className:"px-5 py-3 flex items-center gap-3 text-xs cursor-pointer hover:bg-subtle-fill transition-colors",onClick:()=>y(!1),children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[S.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-sys-green",children:[e.jsx(Se,{className:"w-3 h-3"}),S.length," confirmed"]}),L.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-sys-cyan",children:[e.jsx(h,{className:"w-3 h-3"}),L.length," likely"]}),P.length>0&&e.jsxs("span",{className:"text-sys-indigo",children:[P.length," possible"]}),F.length>0&&e.jsxs("span",{className:"text-fg-muted",children:[F.length," noise"]})]}),e.jsx("span",{className:"text-fg-muted ml-auto",children:"Click to expand"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-5 py-2 flex items-center gap-3 text-xs border-b border-edge-subtle/30",children:[e.jsxs("span",{className:"text-fg-muted",children:[o.pathsWithGhosts.toLocaleString()," / ",o.totalPaths.toLocaleString()," paths"]}),e.jsx("span",{className:"text-fg-muted",children:"•"}),e.jsxs("div",{className:"flex items-center gap-2",children:[S.length>0&&e.jsxs("span",{className:"text-sys-green",children:[S.length," confirmed"]}),L.length>0&&e.jsxs("span",{className:"text-sys-cyan",children:[L.length," likely"]}),P.length>0&&e.jsxs("span",{className:"text-sys-indigo",children:[P.length," possible"]}),F.length>0&&e.jsxs("span",{className:"text-fg-muted",children:[F.length," noise"]})]})]}),e.jsxs("div",{className:"px-5 py-4 space-y-4",children:[S.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-sys-green",children:[e.jsx(Se,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Confirmed Repeaters (",S.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:S.map(s=>e.jsx(Ae,{ghost:s,neighbors:a,isExpanded:p.has(s.prefix),onToggle:()=>R(s.prefix)},s.prefix))})]}),L.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-sys-cyan",children:[e.jsx(h,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Likely Repeaters (",L.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:L.map(s=>e.jsx(Ae,{ghost:s,neighbors:a,isExpanded:p.has(s.prefix),onToggle:()=>R(s.prefix)},s.prefix))})]}),E&&P.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-sys-indigo",children:[e.jsx(_,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Possible (",P.length,")"]})]}),e.jsxs("div",{className:"space-y-2",children:[P.slice(0,10).map(s=>e.jsx(Ae,{ghost:s,neighbors:a,isExpanded:p.has(s.prefix),onToggle:()=>R(s.prefix)},s.prefix)),P.length>10&&e.jsxs("div",{className:"text-xs text-fg-muted text-center py-1",children:["+",P.length-10," more possible nodes"]})]})]}),F.length>0&&"all"===u&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{onClick:()=>b(!j),className:"flex items-center gap-2 text-xs text-fg-muted hover:text-fg-secondary transition-colors",children:[j?e.jsx(W,{className:"w-3.5 h-3.5"}):e.jsx(m,{className:"w-3.5 h-3.5"}),e.jsx(V,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["Noise (",F.length,")"]})]}),j&&e.jsx("div",{className:"flex flex-wrap gap-1",children:F.map(s=>e.jsx(Ae,{ghost:s,neighbors:a,isExpanded:!1,onToggle:()=>{},compact:!0},s.prefix))})]}),"actionable"===u&&0===$&&e.jsxs("div",{className:"text-center py-6 text-sm text-fg-muted",children:[e.jsx(d,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No confirmed or likely repeaters yet."}),e.jsxs("p",{className:"text-xs mt-1",children:[P.length+F.length," prefixes need more evidence."]}),e.jsxs("button",{onClick:()=>f("all"),className:"mt-3 text-sys-blue hover:underline",children:["View all ",k.length," discovered nodes"]})]}),o.observationOverrideCount>0&&H>0&&e.jsxs("div",{className:"pt-2 border-t border-edge-subtle/30 text-xs text-fg-muted",children:[e.jsx("span",{className:"text-sys-blue",children:o.observationOverrideCount})," observation overrides • Avg confidence: ",e.jsxs("span",{className:"text-sys-indigo",children:[(100*o.avgPathConfidence).toFixed(0),"%"]})]})]})]})]})}const Ue=s.memo(function({hash:t,className:a="",size:n="sm",collisionInfo:l,isViterbiResolved:i}){const c=u(),o=r(),[d,m]=s.useState(!1),x=s.useMemo(()=>f(t),[t]),p=s.useMemo(()=>void 0!==l?l:x?c.find(e=>e.prefix===x)??null:null,[x,c,l]),g=i??(o.totalPaths>0&&o.avgPathConfidence>=.7),j=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),m(!0)},[]),b=s.useCallback(()=>{m(!1)},[]);if(!p)return null;const N="sm"===n?"w-3.5 h-3.5":"w-4 h-4",y=g?"text-sys-cyan hover:text-sys-cyan hover:bg-sys-cyan/10 focus:ring-sys-cyan/50":"text-signal-fair hover:text-sys-indigo hover:bg-signal-fair/10 focus:ring-signal-fair/50",v=g?`Prefix conflict resolved by Viterbi HMM (${(100*o.avgPathConfidence).toFixed(0)}% confidence)`:`Prefix conflict: ${p.candidateCount} nodes share prefix "${x}"`;return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:j,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${y} ${a}`,title:v,"aria-label":`View prefix conflict for ${x}${g?" (Viterbi resolved)":""}`,children:g?e.jsxs("span",{className:"relative",children:[e.jsx(Y,{className:N}),e.jsx(h,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-sys-green"})]}):e.jsx(ve,{className:N})}),e.jsx(xe,{isOpen:d,prefix:p.prefix,candidateHashes:p.candidateHashes,onClose:b})]})}),Ve=s.memo(function({hash:s,contact:t,isHub:a,isNeighbor:n,distance:l,centrality:i,sparklineData:r,neighborSignal:c,collisionInfo:o,isViterbiResolved:d,isPinging:m,isPingingThis:x,pingResult:p,pingError:g,gatewayInfo:u,lastForwarderPrefix:f,isMobile:v,pathStability:w,onRowClick:k,onPing:C,onRemove:M}){const S=t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude,L=t.node_name||t.name||"Unknown",P=n&&c,F=z(t),{isRepeater:$,isCompanion:R,isRoomServer:E,isClient:H,label:T}=F,O=n?`${T} — Direct RF contact (zero-hop neighbor)`:`${T} — Flood routing (multi-hop via mesh)`,I=t.first_seen?j(t.first_seen).replace(/ ago$/i," old"):null;return e.jsxs("div",{className:`contacts-grid-row ${a?"bg-sys-amber/5 border-l-2 border-l-sys-amber":""} ${S?"cursor-pointer hover:bg-subtle-fill":""}`,onClick:()=>k(s),children:[e.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[P&&null!==(null==c?void 0:c.avgSnr)?e.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0 self-center "+(D=c.avgSnr,void 0===D?"bg-[var(--signal-unknown)]":D>=5?"bg-[var(--signal-excellent)]":D>=0?"bg-[var(--signal-good)]":D>=-5?"bg-[var(--signal-fair)]":D>=-10?"bg-[var(--signal-poor)]":"bg-[var(--signal-critical)]")}):e.jsx("div",{className:"w-2 flex-shrink-0"}),e.jsx("div",{className:"w-6 h-6 flex items-center justify-center flex-shrink-0",title:O,children:(()=>{if(E&&$)return e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(ue,{className:"w-5 h-5 absolute inset-0 text-sys-pink"}),e.jsx(he,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-sys-teal"})]});if(E)return e.jsx(ue,{className:"w-5 h-5 text-sys-pink"});if($)return e.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(b,{className:"w-3.5 h-3.5 text-sys-blue"})});if((R||H)&&"Unknown"!==L){const{emoji:s,cleanName:t}=oe(L);return e.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center",style:{backgroundColor:de(t)},children:s?e.jsx("span",{className:"text-sm leading-none",children:s}):e.jsx("span",{className:"text-white text-[9px] font-bold tracking-tighter",children:me(L)})})}return e.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-zinc-500/20",children:e.jsx(_,{className:"w-3.5 h-3.5 text-sys-amber"})})})()}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 overflow-hidden",children:[e.jsx("span",{className:"roster-title truncate",title:L,children:L}),n&&e.jsx(N,{color:ge.neighbor,compact:!0,className:"flex-shrink-0",children:"NBR"}),a&&e.jsxs(N,{color:ge.hub,compact:!0,className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(fe,{className:"w-3 h-3"}),"HUB"]}),$&&e.jsx(N,{color:ge.repeater,compact:!0,className:"flex-shrink-0",children:"RPT"}),E&&e.jsx(N,{color:ge.room,compact:!0,className:"flex-shrink-0",children:"ROOM"}),R&&e.jsx(N,{color:ge.companion,compact:!0,className:"flex-shrink-0",children:"COMP"}),H&&e.jsx(N,{color:ge.client,compact:!0,className:"flex-shrink-0",children:"CLIENT"}),v&&e.jsxs(N,{color:"cyan",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",children:[e.jsx(ke,{className:"w-2.5 h-2.5"}),"MOBILE"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(se,{copy:!0,size:"compact",truncate:[8,6],children:s}),e.jsx(Ue,{hash:s,collisionInfo:o,isViterbiResolved:d}),!n&&u&&e.jsxs(N,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`Via ${u.name||u.prefix} (${u.hopCount} hop${1!==u.hopCount?"s":""})`,children:[e.jsx(q,{className:"w-2.5 h-2.5"}),e.jsx("span",{className:"font-mono",children:u.prefix}),u.hopCount>1&&e.jsxs("span",{className:"opacity-60",children:["+",u.hopCount-1]})]}),f&&!n&&e.jsxs(N,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`Last forwarded by ${f}`,children:[e.jsx(be,{className:"w-2.5 h-2.5"}),e.jsx("span",{className:"font-mono",children:f})]}),null!=w&&0!==w&&e.jsx(N,{color:w>0?"green":"amber",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:w>0?"Path stability improving":"Path stability declining",children:w>0?e.jsx(Pe,{className:"w-2.5 h-2.5"}):e.jsx(Le,{className:"w-2.5 h-2.5"})}),r.length>0&&(()=>{const s=r.reduce((e,s)=>e+s.count,0);if(0===s)return null;const t=s/24;return e.jsxs(N,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`${s} packets in last 24h (~${t.toFixed(1)}/hr)`,children:[e.jsx(Ce,{className:"w-2.5 h-2.5"}),e.jsxs("span",{children:[t<1?"<1":t.toFixed(0),"/hr"]})]})})(),I&&e.jsxs(N,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0 opacity-70",title:`First discovered ${I}`,children:[e.jsx(ye,{className:"w-2.5 h-2.5"}),e.jsx("span",{children:I})]})]})]})]}),e.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[P&&null!==(null==c?void 0:c.avgRssi)&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Z,{rssi:c.avgRssi,className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs text-fg-muted",children:Math.round(c.avgRssi)})]}),P&&null!==(null==c?void 0:c.avgSnr)&&e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[c.avgSnr.toFixed(1)," dB"]})]}),e.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-fg-muted",children:null!=l&&e.jsxs(e.Fragment,{children:[e.jsx(Me,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs",children:(A=l,A<1e3?`${Math.round(A)}m`:`${(A/1e3).toFixed(1)}km`)})]})}),e.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:i>0&&e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-3 h-3 text-sys-indigo"}),e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[(100*i).toFixed(0),"%"]})]})}),e.jsx("div",{className:"contacts-col-seen flex items-center justify-end",children:e.jsx("span",{className:"type-data-xs text-fg-primary whitespace-nowrap",children:t.last_seen?j(t.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[n&&e.jsx(e.Fragment,{children:p?e.jsxs("div",{className:"flex items-center gap-1 text-sys-green",title:`RTT: ${p.rtt_ms.toFixed(0)}ms`,children:[e.jsx(h,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"type-data-xs hidden sm:inline",children:[p.snr_db.toFixed(1),"dB"]})]}):g?e.jsx("span",{className:"text-sys-red text-xs",title:g,children:"✗"}):e.jsx("button",{onClick:e=>C(s,e),disabled:m,className:"p-1 sm:p-1.5 radius-inner text-fg-muted/50 hover:text-sys-blue hover:bg-sys-blue/10 transition-base disabled:opacity-50 disabled:cursor-not-allowed",title:"Ping neighbor for updated signal info",children:x?e.jsx(y,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):e.jsx(X,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),e.jsx("button",{onClick:e=>{e.stopPropagation(),M(s,L)},className:"p-1 sm:p-1.5 radius-inner text-fg-muted/50 hover:text-sys-red hover:bg-sys-red/10 transition-base",title:"Remove contact",children:e.jsx(ne,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]});var A,D}),We=[],Be=[{field:"lastHeard",icon:p,label:"Recent"},{field:"distance",icon:Me,label:"Distance"},{field:"centrality",icon:ee,label:"Centrality"}];function Ke(e,s){const{color:a="primary",border:n=!1}=s??{};return t("flex items-center gap-1.5 px-2 py-1.5 text-sm radius-inner transition-base",e?"success"===a?"bg-sys-green/20 text-sys-green":"bg-sys-blue/20 text-sys-blue":"text-fg-muted hover:text-fg-secondary hover-bg",n&&(e?"success"===a?"border border-sys-green/30":"border border-sys-blue/30":"border border-transparent"))}function qe(e,s,t,a){const n=(t-e)*Math.PI/180,l=(a-s)*Math.PI/180,i=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(t*Math.PI/180)*Math.sin(l/2)*Math.sin(l/2);return 2*Math.atan2(Math.sqrt(i),Math.sqrt(1-i))*6371e3}const Ze=Object.freeze(Object.defineProperty({__proto__:null,default:function(){const{stats:a}=v(),n=w(),l=k(),d=C(),m=M(),x=S(),p=c(),g=L(),j=P(),N=i(),V=F(),W=u(),B=r(),K=$(),q=B.totalPaths>0&&B.avgPathConfidence>=.7,Z=s.useMemo(()=>{const e=new Map;for(const s of W)e.set(s.prefix,s);return e},[W]),[J,Y]=s.useState(null),[Q,X]=s.useState("lastHeard"),[ee,se]=s.useState("desc"),[te,ae]=s.useState(""),[ne,ce]=s.useState(!1),[oe,de]=s.useState(new Set),[me,xe]=s.useState(!1),[he,ge]=s.useState(null),[fe,be]=s.useState(null),[ye,ve]=s.useState(null),[ke,Ce]=s.useState(null),[Me,Se]=s.useState(new Map),[Le,Pe]=s.useState(new Map),[Fe,$e]=s.useState(25),[Ee,He]=s.useState(25),Te=s.useRef(null),_e=s.useMemo(()=>(null==a?void 0:a.neighbors)??{},[null==a?void 0:a.neighbors]),Oe=s.useMemo(()=>Object.fromEntries(Object.entries(_e).filter(([e])=>!n.has(e))),[_e,n]),Ie=R(),Ae=null==a?void 0:a.local_hash,De=s.useMemo(()=>{const e=new Map;for(const s of N){const t=s.hops[0];if(t&&0!==s.observationTrend){const a=Object.keys(_e).find(e=>e.toUpperCase().startsWith(t.toUpperCase()));a&&!e.has(a)&&e.set(a,s.observationTrend)}}return e},[N,_e]),Ue=s.useMemo(()=>{const e=new Map;if(!Ae||0===g.size)return e;for(const[s,t]of g)if(s.endsWith(`→${Ae}`)&&t.hops.length>1){const a=s.split("→")[0],n=t.hops[t.hops.length-1];e.set(a,n)}return e},[g,Ae]),Ze=s.useMemo(()=>{const e=new Map;if(!(null==Ie?void 0:Ie.latitude)||!(null==Ie?void 0:Ie.longitude))return e;for(const[s,t]of Object.entries(Oe))t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude?e.set(s,qe(Ie.latitude,Ie.longitude,t.latitude,t.longitude)):e.set(s,null);return e},[Oe,Ie]),{neighborHashSet:Je,neighborSignalMap:Ye}=s.useMemo(()=>{const e=new Set,s=new Map;for(const t of x)e.add(t.hash),s.set(t.hash,{avgRssi:t.avgRssi,avgSnr:t.avgSnr});return{neighborHashSet:e,neighborSignalMap:s}},[x]),Qe=s.useMemo(()=>{const e=te.toLowerCase().trim(),s="neighbor"===e||"neighbors"===e,t=ne||s,a=oe.size>0;return Object.fromEntries(Object.entries(Oe).filter(([n,l])=>{if(a){const e=function(e){return function(e){switch(e){case"room_server":return"room";case"repeater":return"repeater";case"companion":case"unknown":return"companion"}}(z(e).type)}(l);if(!oe.has(e))return!1}if(t&&!Je.has(n))return!1;if(s)return!0;if(!e)return!0;const i=(l.node_name||l.name||"").toLowerCase(),r=f(n).toLowerCase();return i.includes(e)||r.includes(e)||n.toLowerCase().includes(e)}))},[Oe,te,ne,Je,oe]),Xe=s.useMemo(()=>{const e=Object.entries(Qe),s=te.toLowerCase().trim(),t=2===s.length&&/^[0-9a-f]{2}$/i.test(s);return e.sort(([e,a],[n,l])=>{if(t){const t=f(e).toLowerCase(),a=f(n).toLowerCase(),l=t===s,i=a===s;if(l&&!i)return-1;if(i&&!l)return 1}let i=0;switch(Q){case"lastHeard":i=(a.last_seen||0)-(l.last_seen||0);break;case"distance":{const s=Ze.get(e)??null,t=Ze.get(n)??null;i=null===s&&null===t?0:null===s?1:null===t?-1:s-t;break}case"centrality":i=(m.get(e)||0)-(m.get(n)||0)}return"desc"===ee?-i:i})},[Qe,Q,ee,Ze,m,te]),es=s.useMemo(()=>{let e=0,s=0,t=0,a=0,n=0;for(const[,l]of Xe){const i=z(l),r=l.latitude&&l.longitude&&0!==l.latitude&&0!==l.longitude;switch(i.type){case"room_server":t++;break;case"repeater":s++;break;case"companion":e++;break;case"unknown":n++}r&&a++}return{companions:e,repeaters:s,roomServers:t,total:Xe.length,withLocation:a,unknown:n}},[Xe]),ss=s.useMemo(()=>new Set(d),[d]),ts=s.useMemo(()=>0===Fe?Xe:Xe.slice(0,Ee),[Xe,Ee,Fe]);s.useEffect(()=>{He(Fe||Xe.length)},[Q,ee,te,ne,oe,Fe,Xe.length]),s.useEffect(()=>{const e=e=>{e.target.closest("[data-dropdown]")||xe(!1)};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[]),s.useEffect(()=>{if(0===Fe)return;const e=new IntersectionObserver(e=>{e[0].isIntersecting&&EeMath.min(e+Fe,Xe.length))},{threshold:.1,rootMargin:"100px"});return Te.current&&e.observe(Te.current),()=>e.disconnect()},[Fe,Ee,Xe.length]);const as=s.useCallback(e=>{$e(e),He(e||Xe.length)},[Xe.length]),ns=s.useCallback(e=>{Q===e?se(e=>"desc"===e?"asc":"desc"):(X(e),se("desc"))},[Q]),ls=s.useCallback(e=>{const s=Oe[e];(null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&0!==s.latitude&&0!==s.longitude&&ge(e)},[Oe]),is=s.useCallback(()=>{ge(null)},[]),rs=s.useCallback((e,s)=>{Y({hash:e,name:s})},[]),cs=s.useCallback(async(e,s)=>{if(s.stopPropagation(),!ke){Ce(e),Se(s=>{const t=new Map(s);return t.delete(e),t}),Pe(s=>{const t=new Map(s);return t.delete(e),t});try{const s=e.startsWith("0x")?e.slice(0,4):`0x${e.slice(0,2)}`,t=await T(s,30);t.success&&t.data?(Se(s=>new Map(s).set(e,t.data)),setTimeout(()=>{Se(s=>{const t=new Map(s);return t.delete(e),t})},1e4)):(Pe(s=>new Map(s).set(e,t.error||"Ping failed")),setTimeout(()=>{Pe(s=>{const t=new Map(s);return t.delete(e),t})},5e3))}catch(t){const s=t instanceof Error?t.message:"Ping failed";Pe(t=>new Map(t).set(e,s)),setTimeout(()=>{Pe(s=>{const t=new Map(s);return t.delete(e),t})},5e3)}finally{Ce(null)}}},[ke]);return e.jsxs(O,{children:[e.jsx(I,{title:"Contacts",icon:e.jsx(ie,{}),controls:e.jsxs("div",{className:"flex items-center gap-4 sm:gap-5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Total:"}),e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${es.total} discovered node${1!==es.total?"s":""} on the mesh network`,children:[e.jsx(ie,{className:"w-3.5 h-3.5 text-fg-secondary"}),e.jsx("span",{children:es.total})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Types:"}),es.repeaters>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${es.repeaters} Repeater${1!==es.repeaters?"s":""} — Mesh network relay nodes that forward packets`,children:[e.jsx(b,{className:"w-3.5 h-3.5 text-sys-blue"}),e.jsx("span",{children:es.repeaters})]}),es.companions>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${es.companions} Companion${1!==es.companions?"s":""} — Client devices (phones, CLI tools) connected to the mesh`,children:[e.jsx(pe,{className:"w-3.5 h-3.5 text-fg-muted"}),e.jsx("span",{children:es.companions})]}),es.roomServers>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${es.roomServers} Room Server${1!==es.roomServers?"s":""} — Group chat servers hosting persistent rooms`,children:[e.jsx(ue,{className:"w-3.5 h-3.5 text-sys-pink"}),e.jsx("span",{children:es.roomServers})]}),es.withLocation>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${es.withLocation} node${1!==es.withLocation?"s":""} with GPS location — Visible on map`,children:[e.jsx(re,{className:"w-3.5 h-3.5 text-sys-green"}),e.jsx("span",{children:es.withLocation})]}),es.unknown>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${es.unknown} unknown node${1!==es.unknown?"s":""} — No name or location advertised`,children:[e.jsx(_,{className:"w-3.5 h-3.5 text-sys-amber"}),e.jsx("span",{children:es.unknown})]})]})]})}),e.jsxs(A,{children:[V?e.jsx(Re,{neighbors:Oe,localNode:Ie??void 0,localHash:Ae,onRemoveNode:l,selectedNodeHash:he,onNodeSelected:is,highlightedEdgeKey:fe,highlightedGhost:ye}):e.jsx("div",{className:"surface-base radius-card aspect-video flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-6 h-6 border-2 border-sys-blue border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-fg-muted",children:"Loading map..."})]})}),e.jsx(ze,{maxPaths:10,highlightedEdge:fe,onHighlightEdge:be}),p.length>0&&(V?e.jsx(o,{noPadding:!0,children:e.jsx(Ge,{neighbors:Oe,onGhostSelect:ve})}):e.jsxs("div",{className:"surface-base radius-card",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-edge-subtle",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-4 rounded bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-6 h-6 rounded bg-elevated animate-pulse"})]}),e.jsx("div",{className:"px-5 py-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-20 h-4 rounded bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-elevated animate-pulse"})]})})]})),e.jsx(o,{noPadding:!0,children:V?e.jsxs(e.Fragment,{children:[e.jsx(U,{listHeader:!0,stackActionsOnMobile:!0,icon:e.jsx(ie,{}),title:"Discovered Contacts",titleExtra:e.jsx(E,{type:"search",size:"sm",value:te,onChange:e=>ae(e.target.value),placeholder:"Search...",leadingIcon:e.jsx(je,{className:"w-3.5 h-3.5"}),trailingIcon:te?e.jsx("button",{onClick:()=>{ae(""),"neighbor"!==te.toLowerCase().trim()&&"neighbors"!==te.toLowerCase().trim()||ce(!1)},className:"text-fg-muted hover:text-fg-secondary",children:e.jsx(H,{className:"w-3 h-3"})}):void 0,className:"w-24 sm:w-32","aria-label":"Search contacts"}),actions:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("div",{className:"relative","data-dropdown":!0,children:[e.jsxs("button",{onClick:()=>xe(!me),className:Ke(oe.size>0,{border:!0}),title:"Filter by contact type",children:[e.jsx(we,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Filter"}),oe.size>0&&e.jsx("span",{className:"tabular-nums text-xs bg-sys-blue/30 px-1 rounded",children:oe.size})]}),me&&e.jsxs("div",{className:"absolute left-0 top-full mt-1 z-50 surface-elevated radius-inner py-1 min-w-[140px]",children:[[{key:"repeater",label:"Repeaters"},{key:"companion",label:"Companions"},{key:"room",label:"Rooms"}].map(({key:s,label:a})=>e.jsxs("button",{onClick:()=>{de(e=>{const t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},className:"w-full px-3 py-1.5 text-sm text-left hover-bg transition-base flex items-center gap-2",children:[e.jsx("span",{className:t("w-4 h-4 flex items-center justify-center radius-badge border",oe.has(s)?"bg-sys-blue border-sys-blue text-white":"border-edge-subtle"),children:oe.has(s)&&e.jsx(h,{className:"w-3 h-3"})}),e.jsx("span",{className:oe.has(s)?"text-fg-primary":"text-fg-secondary",children:a})]},s)),oe.size>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-edge-subtle my-1"}),e.jsx("button",{onClick:()=>de(new Set),className:"w-full px-3 py-1.5 text-sm text-left text-fg-muted hover:text-fg-secondary hover-bg transition-base",children:"Clear filters"})]})]})]}),Je.size>0&&e.jsxs("button",{onClick:()=>ce(!ne),className:Ke(ne,{color:"success",border:!0}),title:ne?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[e.jsx(b,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Neighbors"}),e.jsx("span",{className:"sm:hidden tabular-nums",children:Je.size})]})]}),e.jsx("div",{className:"hidden sm:block h-4 w-px bg-border-subtle"}),e.jsxs("div",{className:"flex items-center gap-1",children:[Be.map(({field:s,icon:a,label:n})=>e.jsxs("button",{onClick:()=>ns(s),className:Ke(Q===s),title:`Sort by ${n.toLowerCase()}`,children:[e.jsx(a,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:n}),Q===s&&e.jsx(Ne,{className:t("w-3 h-3","asc"===ee&&"rotate-180")})]},s)),e.jsx("div",{className:"h-4 w-px bg-border-subtle"}),e.jsxs(D,{value:Fe,onChange:as,className:"w-auto min-w-[50px] [&_button]:py-1 [&_button]:px-2 [&_button]:text-xs [&_button]:min-h-0","aria-label":"Items per page",children:[e.jsx(G,{value:25,children:"25"}),e.jsx(G,{value:50,children:"50"}),e.jsx(G,{value:100,children:"100"}),e.jsx(G,{value:0,children:"All"})]})]})]})}),Xe.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden sm:grid contacts-grid-header border-b border-edge-subtle/50 px-3 py-2 type-micro text-fg-muted",children:[e.jsx("div",{className:"contacts-col-node",children:"Node"}),e.jsx("div",{className:"contacts-col-signal text-right",children:"Signal"}),e.jsx("div",{className:"contacts-col-distance text-right",children:"Distance"}),e.jsx("div",{className:"contacts-col-centrality text-right",children:"Centrality"}),e.jsx("div",{className:"contacts-col-seen text-right",children:"Last Seen"}),e.jsx("div",{className:"contacts-col-actions"})]}),e.jsx("div",{className:"divide-y divide-edge-subtle/30",children:ts.map(([s,t])=>{const a=f(s),n=ss.has(s),l=Je.has(s),i=Ze.get(s)??null,r=m.get(s)||0,c=l?Ye.get(s):void 0,o=a?Z.get(a)??null:null,d=K.get(s)??We;let x=null;if(!l&&Ae&&g.size>0){const e=`${s}→${Ae}`,t=g.get(e);if(t&&t.hops.length>0){const e=t.hops[0],s=Object.keys(_e).find(s=>s.toUpperCase().startsWith(e.toUpperCase())),a=s?_e[s]:null;x={prefix:e,name:(null==a?void 0:a.node_name)??(null==a?void 0:a.name)??null,hopCount:t.hopCount}}}const h=j.has(s),p=De.get(s)??null,u=Ue.get(s)??null;return e.jsx(Ve,{hash:s,contact:t,isHub:n,isNeighbor:l,distance:i,centrality:r,sparklineData:d,neighborSignal:c,collisionInfo:o,isViterbiResolved:q,isPinging:null!==ke,isPingingThis:ke===s,pingResult:Me.get(s),pingError:Le.get(s),gatewayInfo:x,lastForwarderPrefix:u,isMobile:h,pathStability:p,onRowClick:ls,onPing:cs,onRemove:rs},s)})}),Fe>0&&Ee0&&EeHe(e=>Math.min(e+Fe,Xe.length)),className:"text-sys-blue hover:text-sys-blue/80 transition-base",children:"Load more"})]})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(ie,{className:"roster-empty-icon"}),e.jsx("div",{className:"type-label text-fg-secondary",children:"No Contacts Discovered"}),e.jsx("div",{className:"type-data-xs text-fg-muted mt-1",children:"Contacts will appear here as they advertise on the mesh network."})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-edge-subtle",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-elevated animate-pulse"}),e.jsx("div",{className:"w-32 h-4 rounded bg-elevated animate-pulse"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-16 h-6 rounded bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-6 rounded bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-6 rounded bg-elevated animate-pulse"})]})]}),e.jsx("div",{className:"px-3 py-3 space-y-3",children:[...Array(5)].map((s,t)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 rounded bg-elevated animate-pulse"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"h-4 w-32 rounded bg-elevated animate-pulse"}),e.jsx("div",{className:"h-3 w-24 rounded bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-12 h-4 rounded bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-elevated animate-pulse"})]},t))})]})})]}),e.jsx(le,{isOpen:!!J,title:"Remove Contact",message:`Are you sure you would like to remove ${(null==J?void 0:J.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{J&&l(J.hash),Y(null)},onCancel:()=>Y(null)})]})}},Symbol.toStringTag,{value:"Module"}));export{Ze as C,Ue as P,Me as R}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-BNwBX2WN.js","assets/vendor-react-j_fHog8x.js","assets/BasemapLayer-BT1oL_wV.js","assets/vendor-core-CmkNwW1A.js","assets/link-scoring-BHmEi4Ug.js","assets/index-BBcIGlRT.js","assets/ConfirmModal-CX0HrTOx.js","assets/triangle-alert-DH80WgOo.js","assets/DeepAnalysisModal--yROqPOt.js","assets/geo-utils-BJfOkt8p.js","assets/git-branch-CaPGs8Pg.js","assets/database-CO202xKy.js","assets/message-square-Dq5-N0aR.js","assets/DelayedAnimateNumber-CRcNKpk-.js","assets/index-CCvUM2Hn.js","assets/refresh-cw-BJopKEHj.js","assets/target-MKB3Qhi3.js","assets/sun-GNUT-ucn.js","assets/easing-DWvlCTyt.js","assets/SignalIndicator-BnBRvoqf.js","assets/signal-scoring-CcBiRcks.js","assets/font-loader-BQzEmDrZ.js","assets/wifi-BGoUD8Dj.js","assets/users-DuzW_tmB.js","assets/badge-colors-YAE4qQ7m.js","assets/LightSparkline-BCL2qx0n.js","assets/copy-C_IB0gEd.js","assets/map-pin-FZNiPp_L.js","assets/ping-CZgZ44Jt.js","assets/node-types-CuQMppbD.js","assets/PageLayout-CYYy29Pg.js","assets/listbox-BsuBKhOY.js","assets/Card-QO4sXDu0.js","assets/activity-_XXDiQ1M.js","assets/DataBox-B8dpvpbW.js","assets/funnel-Bb7d8E3s.js","assets/circle-check-DI0_62yI.js","assets/chat-utils-I8bC4Iy5.js","assets/CollisionExplorerModal-CbOUGWmc.js","assets/network-C6ho6RSo.js","assets/search-Cs3jReDi.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-QdsUNncv.css"])))=>i.map(i=>d[i]); +import{j as e,r as s,c as t,_ as a}from"./vendor-react-j_fHog8x.js";import{c as n,aA as l,aB as i,aC as r,au as c,h as o,aD as d,Y as m,aE as x,o as h,an as p,aF as g,aG as u,G as f,O as j,R as b,j as N,L as y,aH as v,y as w,aI as k,aJ as C,aK as M,x as S,aL as L,aM as P,aN as F,aO as $,aP as R,I as E,a5 as H}from"./index-BBcIGlRT.js";import{p as T}from"./ping-CZgZ44Jt.js";import{C as _,c as z}from"./node-types-CuQMppbD.js";import{P as O,b as I,B as A}from"./PageLayout-CYYy29Pg.js";import{L as D,a as G}from"./listbox-BsuBKhOY.js";import{C as U}from"./Card-QO4sXDu0.js";import{T as V}from"./triangle-alert-DH80WgOo.js";import{b as W,Z as B,C as K,A as q,c as Z}from"./SignalIndicator-BnBRvoqf.js";import{G as J}from"./git-branch-CaPGs8Pg.js";import{E as Y,S as Q,T as X}from"./target-MKB3Qhi3.js";import{A as ee}from"./activity-_XXDiQ1M.js";import{D as se}from"./DataBox-B8dpvpbW.js";import{F as te}from"./funnel-Bb7d8E3s.js";import{P as ae,T as ne,C as le}from"./ConfirmModal-CX0HrTOx.js";import{U as ie}from"./users-DuzW_tmB.js";import{M as re}from"./map-pin-FZNiPp_L.js";import{C as ce}from"./circle-check-DI0_62yI.js";import{e as oe,g as de,a as me}from"./chat-utils-I8bC4Iy5.js";import{C as xe,S as he,M as pe}from"./CollisionExplorerModal-CbOUGWmc.js";import{C as ge}from"./badge-colors-YAE4qQ7m.js";import{M as ue}from"./message-square-Dq5-N0aR.js";import{N as fe}from"./network-C6ho6RSo.js";import{S as je}from"./search-Cs3jReDi.js";const be=n("arrow-down-left",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]),Ne=n("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]),ye=n("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]),ve=n("file-digit",[["path",{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2",key:"jrl274"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 16h2v6",key:"1bxocy"}],["path",{d:"M10 22h4",key:"ceow96"}],["rect",{x:"2",y:"16",width:"4",height:"6",rx:"2",key:"r45zd0"}]]),we=n("list-filter",[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]]),ke=n("move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]),Ce=n("radio-tower",[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]),Me=n("ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]),Se=n("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),Le=n("trending-down",[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]]),Pe=n("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);class Fe extends s.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){var s;return this.state.hasError?e.jsx("div",{className:t("map-container-16-9 flex items-center justify-center rounded-2xl",l),role:"alert","aria-live":"assertive",children:e.jsxs("div",{className:"text-center text-fg-muted p-4",children:[e.jsx("p",{className:"text-lg mb-2",children:"Map failed to load"}),e.jsx("p",{className:"text-sm text-fg-muted",children:(null==(s=this.state.error)?void 0:s.message)||"Unknown error"}),e.jsx("p",{className:"text-xs text-fg-muted mt-2",children:"Try refreshing the page or check your browser's WebGL support."})]})}):this.props.children}}const $e=s.lazy(()=>a(()=>import("./ContactsMapMapLibre-BNwBX2WN.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42])));function Re({neighbors:a,localNode:n,localHash:i,onRemoveNode:r,selectedNodeHash:c,onNodeSelected:o,highlightedEdgeKey:d,highlightedGhost:m}){return e.jsx(Fe,{children:e.jsx(s.Suspense,{fallback:e.jsx("div",{className:t("map-container-16-9 flex items-center justify-center rounded-2xl",l),role:"status","aria-live":"polite","aria-label":"Loading map",children:e.jsxs("div",{className:"text-fg-muted flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-sys-blue border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading map..."})]})}),children:e.jsx($e,{neighbors:a,localNode:n,localHash:i,onRemoveNode:r,selectedNodeHash:c,onNodeSelected:o,highlightedEdgeKey:d,highlightedGhost:m})})})}function Ee(e){return e>=.7?"text-sys-green":e>=.5?"text-sys-indigo":e>=.3?"text-signal-poor":"text-sys-red"}function He(e){return`${Math.round(100*e)}%`}function Te(e,s){return s.has(e.toUpperCase())}const _e=s.memo(function({path:s,isHighlighted:t,onHighlight:a,ghostPrefixes:n}){const l=function(s){return s>.2?{icon:e.jsx(Pe,{className:"w-3 h-3"}),color:"text-sys-green"}:s<-.2?{icon:e.jsx(Le,{className:"w-3 h-3"}),color:"text-sys-red"}:{icon:e.jsx(x,{className:"w-3 h-3"}),color:"text-fg-muted"}}(s.observationTrend),i=s.weakestLinkKey&&s.weakestLinkConfidence<.5,r=s.hops.some(e=>Te(e,n));return e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md transition-colors cursor-pointer "+(t?"bg-sys-blue/20 border border-sys-blue/40":"hover:bg-subtle-fill"),onClick:()=>a(t?null:s.weakestLinkKey),children:[e.jsx("div",{className:"flex-shrink-0 w-12 text-center py-1 rounded-md "+(c=s.healthScore,c>=.7?"bg-sys-green/10":c>=.5?"bg-sys-indigo/10":c>=.3?"bg-signal-poor/10":"bg-sys-red/10"),children:e.jsx("span",{className:`text-xs font-semibold tabular-nums ${Ee(s.healthScore)}`,children:He(s.healthScore)})}),e.jsx("div",{className:"flex-1 flex items-center gap-0.5 overflow-x-auto min-w-0",children:s.hops.map((t,a)=>{var l;const r=Te(t,n),c=i&&(null==(l=s.weakestLinkKey)?void 0:l.includes(t));return e.jsxs("span",{className:"flex items-center",children:[e.jsxs("span",{className:"type-data-xs px-1.5 py-0.5 rounded flex items-center gap-0.5 "+(r?"bg-sys-cyan/20 text-sys-cyan border border-sys-cyan/30":c?"bg-sys-red/20 text-sys-red":"bg-subtle-fill-strong text-fg-secondary"),children:[r&&e.jsx(d,{className:"w-2.5 h-2.5"}),t]}),anew Set(h.map(e=>e.prefix.toUpperCase())),[h]),f=s.useMemo(()=>l.slice(0,t),[l,t]),j=s.useMemo(()=>0===l.length?null:{avgHealth:l.reduce((e,s)=>e+s.healthScore,0)/l.length,declining:l.filter(e=>e.observationTrend<-.2).length,weakLinks:l.filter(e=>e.weakestLinkConfidence<.5).length,pathsWithGhosts:l.filter(e=>e.hops.some(e=>u.has(e.toUpperCase()))).length},[l,u]),b=e=>{null==a||a(e)};return 0===l.length?null:e.jsxs(o,{noPadding:!0,children:[e.jsx(U,{listHeader:!0,icon:e.jsx(J,{}),title:"Path Health",onClick:()=>g(!p),className:"hover:bg-subtle-fill transition-colors rounded-t-lg",titleExtra:e.jsxs("span",{className:"ml-2 text-xs font-normal text-fg-muted",children:["(",l.length," paths)"]}),actions:e.jsxs("div",{className:"flex items-center gap-3",children:[j&&e.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[e.jsxs("span",{className:`tabular-nums ${Ee(j.avgHealth)}`,children:["Avg: ",He(j.avgHealth)]}),j.weakLinks>0&&e.jsxs("span",{className:"text-sys-red flex items-center gap-1",children:[e.jsx(V,{className:"w-3 h-3"}),j.weakLinks," weak"]}),j.declining>0&&e.jsxs("span",{className:"text-signal-poor flex items-center gap-1",children:[e.jsx(Le,{className:"w-3 h-3"}),j.declining," declining"]}),j.pathsWithGhosts>0&&e.jsxs("span",{className:"text-sys-cyan flex items-center gap-1",children:[e.jsx(d,{className:"w-3 h-3"}),j.pathsWithGhosts," ghost"]})]}),p?e.jsx(W,{className:"w-4 h-4 text-fg-muted"}):e.jsx(m,{className:"w-4 h-4 text-fg-muted"})]})}),p&&e.jsxs("div",{className:"p-3 pt-0 space-y-1",children:[x.totalPaths>0&&e.jsxs("div",{className:"flex items-center gap-3 text-xs text-fg-muted pb-2 border-b border-edge-subtle",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Y,{className:"w-3 h-3 text-sys-blue"}),e.jsx("span",{className:"text-fg-secondary",children:x.totalPaths.toLocaleString()})," Viterbi decoded"]}),x.observationOverrideCount>0&&e.jsxs("span",{className:"text-sys-green",children:[Math.round(x.observationOverrideCount/x.totalPaths*100),"% observation override"]}),h.length>0&&e.jsxs("span",{className:"text-sys-cyan flex items-center gap-1",children:[e.jsx(d,{className:"w-3 h-3"}),h.length," ghost",1!==h.length?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-fg-muted pb-2 border-b border-edge-subtle",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-sys-green"})," Healthy (≥70%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-sys-indigo"})," Fair (50-70%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-signal-poor"})," Weak (30-50%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-sys-red"})," Critical (<30%)"]}),h.length>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(d,{className:"w-3 h-3 text-sys-cyan"})," Ghost"]})]}),e.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:f.map(s=>e.jsx(_e,{path:s,isHighlighted:n===s.weakestLinkKey,onHighlight:b,ghostPrefixes:u},s.pathKey))}),l.length>t&&e.jsxs("div",{className:"text-center text-xs text-fg-muted pt-2",children:["Showing top ",t," of ",l.length," paths"]})]})]})});function Oe(e){switch(e){case"rf_intersection":return"RF Circle Intersection";case"weighted_centroid":return"Weighted Centroid";case"single_anchor":return"Single Anchor (less reliable)";default:return e}}const Ie={confirmed:{label:"Confirmed",icon:e.jsx(Se,{className:"w-3.5 h-3.5"}),borderClass:"border-sys-green/40",bgClass:"bg-sys-green/10",textClass:"text-sys-green",badgeClass:"bg-sys-green/20 text-sys-green"},likely:{label:"Likely",icon:e.jsx(h,{className:"w-3.5 h-3.5"}),borderClass:"border-sys-cyan/30",bgClass:"bg-sys-cyan/5",textClass:"text-sys-cyan",badgeClass:"bg-sys-cyan/20 text-sys-cyan"},possible:{label:"Possible",icon:e.jsx(_,{className:"w-3.5 h-3.5"}),borderClass:"border-sys-indigo/20",bgClass:"bg-sys-indigo/5",textClass:"text-sys-indigo",badgeClass:"bg-sys-indigo/20 text-sys-indigo"},noise:{label:"Noise",icon:e.jsx(V,{className:"w-3.5 h-3.5"}),borderClass:"border-edge-subtle",bgClass:"bg-surface/30",textClass:"text-fg-muted",badgeClass:"bg-elevated text-fg-muted"}};function Ae({ghost:a,neighbors:n,isExpanded:l,onToggle:i,compact:r}){var c,o;const x=(null==(c=a.classification)?void 0:c.tier)??"noise",h=Ie[x],u="clusterId"in(f=a)&&"temporal"in f;var f;const j=s.useMemo(()=>Array.from(a.commonNeighbors).map(e=>{var s;return{hash:e,name:null==(s=n[e])?void 0:s.name}}),[a.commonNeighbors,n]),b=a.estimatedLocation?a.estimatedLocation.uncertaintyM>=1e3?`±${(a.estimatedLocation.uncertaintyM/1e3).toFixed(1)}km`:`±${Math.round(a.estimatedLocation.uncertaintyM)}m`:null,N=u&&a.temporal?(y=a.temporal.consistency)>=.7?{label:"Steady",color:"text-sys-green"}:y>=.4?{label:"Regular",color:"text-sys-cyan"}:y>=.2?{label:"Sporadic",color:"text-sys-indigo"}:{label:"Bursty",color:"text-signal-poor"}:null;var y;const v=u&&a.collisionCandidates&&a.collisionCandidates.length>0,w=v?a.collisionCandidates[0]:null;return r?e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded bg-elevated/50 text-sm",children:[e.jsx("span",{className:"font-mono font-medium text-fg-secondary",children:a.prefix.toUpperCase()}),e.jsx("span",{className:"text-fg-muted",children:a.observationCount})]}):e.jsxs("div",{className:t("rounded-lg border transition-all duration-150",h.borderClass,h.bgClass),children:[e.jsxs("button",{onClick:i,className:"w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-subtle-fill rounded-lg",children:[e.jsx(d,{className:t("w-5 h-5 flex-shrink-0",h.textClass)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-sm font-semibold text-fg-primary",children:a.prefix.toUpperCase()}),e.jsx("span",{className:t("px-1.5 py-0.5 rounded text-sm font-medium",h.badgeClass),children:h.label})]}),e.jsx("div",{className:t("text-sm mt-0.5",h.textClass),children:(null==(o=a.classification)?void 0:o.reason)??"Unknown"}),e.jsxs("div",{className:"flex items-center gap-3 text-sm text-fg-muted mt-1",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Y,{className:"w-3 h-3"}),a.observationCount]}),e.jsxs("span",{children:[(100*a.confidence).toFixed(0),"%"]}),a.commonNeighbors.size>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ie,{className:"w-3 h-3"}),a.commonNeighbors.size]}),a.estimatedLocation&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(re,{className:"w-3 h-3"}),b]}),N&&e.jsxs("span",{className:t("flex items-center gap-1",N.color),children:[e.jsx(ee,{className:"w-3 h-3"}),N.label]}),v&&e.jsxs("span",{className:"flex items-center gap-1 text-signal-poor",children:[e.jsx(Q,{className:"w-3 h-3"}),"Collision?"]})]})]}),l?e.jsx(W,{className:"w-4 h-4 text-fg-muted"}):e.jsx(m,{className:"w-4 h-4 text-fg-muted"})]}),l&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-edge-subtle/50 mt-1 pt-3",children:[v&&w&&e.jsx("div",{className:"p-2 rounded bg-signal-poor/10 border border-signal-poor/30",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Q,{className:"w-4 h-4 text-signal-poor flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-signal-poor font-medium",children:"Possible collision with known node"}),e.jsx("div",{className:"text-fg-secondary mt-0.5",children:w.knownNodeName?e.jsxs("span",{children:["May match ",e.jsx("span",{className:"font-medium",children:w.knownNodeName})," ","(",(100*w.collisionProbability).toFixed(0),"% probability)"]}):e.jsxs("span",{children:["May match ",e.jsx(se,{copy:!0,size:"compact",className:"inline",children:w.knownNodeHash})," ","(",(100*w.collisionProbability).toFixed(0),"% probability)"]})}),w.evidence&&e.jsxs("div",{className:"text-fg-muted mt-1 text-xs",children:[w.evidence.sharedEdgeCount>0&&e.jsxs("span",{className:"mr-2",children:[w.evidence.sharedEdgeCount," shared edges"]}),void 0!==w.evidence.distanceKm&&e.jsxs("span",{className:"mr-2",children:[w.evidence.distanceKm.toFixed(1),"km apart"]}),w.evidence.withinUncertainty&&e.jsx("span",{className:"text-sys-indigo",children:"Within uncertainty radius"})]})]})]})}),a.estimatedLocation?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(re,{className:"w-4 h-4 text-sys-blue mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-fg-primary font-medium",children:[a.estimatedLocation.lat.toFixed(5),", ",a.estimatedLocation.lon.toFixed(5)]}),e.jsxs("div",{className:"text-fg-muted",children:["Uncertainty: ",b]}),u&&a.location&&e.jsxs("div",{className:"mt-1 text-fg-muted",children:[e.jsxs("div",{children:["Method: ",Oe(a.location.method)]}),a.location.anchors&&a.location.anchors.length>0&&e.jsxs("div",{children:[a.location.anchors.length," anchor",1!==a.location.anchors.length?"s":""," used"," · ",(100*a.location.locationConfidence).toFixed(0),"% confidence"]})]})]})]}):e.jsxs("div",{className:"flex items-center gap-2 text-sm text-fg-muted",children:[e.jsx(V,{className:"w-4 h-4 text-signal-poor"}),"Location unknown (neighbors lack coordinates)"]}),u&&a.temporal&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ee,{className:"w-4 h-4 text-fg-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-fg-primary font-medium",children:["Temporal Pattern: ",e.jsx("span",{className:null==N?void 0:N.color,children:null==N?void 0:N.label})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5 mt-1 text-fg-muted",children:[e.jsxs("span",{children:["Distinct hours: ",a.temporal.distinctHours]}),e.jsxs("span",{children:["Distinct days: ",a.temporal.distinctDays]}),e.jsxs("span",{children:["Burstiness: ",(100*a.temporal.burstiness).toFixed(0),"%"]}),e.jsxs("span",{children:["Consistency: ",(100*a.temporal.consistency).toFixed(0),"%"]}),e.jsxs("span",{children:["Last 24h: ",a.temporal.last24HourCount," obs"]}),e.jsxs("span",{children:["Active hours: ",a.temporal.activeHoursLast24,"/24"]})]})]})]}),!u&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(p,{className:"w-4 h-4 text-fg-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-fg-primary",children:["First seen: ",g(a.firstSeen)," ago"]}),e.jsxs("div",{className:"text-fg-muted",children:["Last seen: ",g(a.lastSeen)," ago"]})]})]}),u&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ye,{className:"w-4 h-4 text-fg-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-fg-primary",children:["Active period: ",g(a.firstSeen)," – ",g(a.lastSeen)," ago"]}),a.temporal&&e.jsxs("div",{className:"text-fg-muted",children:["Obs/hour avg: ",a.temporal.observationsPerHour.toFixed(1)]})]})]}),j.length>0&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ie,{className:"w-4 h-4 text-fg-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-fg-muted mb-1",children:["Adjacent to ",j.length," known node",1!==j.length?"s":"",":"]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[j.slice(0,5).map(({hash:s})=>e.jsx(se,{copy:!0,size:"compact",children:s},s)),j.length>5&&e.jsxs("span",{className:"text-fg-muted",children:["+",j.length-5," more"]})]})]})]}),u&&a.validationStages&&e.jsxs("div",{className:"pt-2 border-t border-edge-subtle/30",children:[e.jsx("div",{className:"type-micro text-fg-muted mb-1.5",children:"Validation Stages"}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(De,{label:"Candidates",passed:a.validationStages.candidateExhaustion}),e.jsx(De,{label:"Temporal",passed:a.validationStages.temporalConsistency}),e.jsx(De,{label:"Topology",passed:a.validationStages.topologicalFit}),e.jsx(De,{label:"Location",passed:a.validationStages.locationPlausible})]})]}),a.classification&&!u&&e.jsx("div",{className:"pt-2 border-t border-edge-subtle/30",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[a.classification.criteria.hasVeryHighObservations&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs bg-sys-green/20 text-sys-green",children:"200+ obs"}),a.classification.criteria.hasHighObservations&&!a.classification.criteria.hasVeryHighObservations&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs bg-sys-cyan/20 text-sys-cyan",children:"50+ obs"}),a.classification.criteria.hasHighConfidence&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs bg-sys-green/20 text-sys-green",children:"70%+ conf"}),a.classification.criteria.hasCommonNeighbors&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs bg-sys-blue/20 text-sys-blue",children:"2+ neighbors"}),a.classification.criteria.hasGoodLocation&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs bg-sys-blue/20 text-sys-blue",children:"good loc"}),a.classification.criteria.isRecent&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-xs bg-fg-muted/20 text-fg-muted",children:"recent"})]})}),u&&a.upgradeRequirements&&a.upgradeRequirements.length>0&&"confirmed"!==x&&e.jsxs("div",{className:"pt-2 border-t border-edge-subtle/30",children:[e.jsx("div",{className:"type-micro text-fg-muted mb-1",children:"To upgrade tier:"}),e.jsx("ul",{className:"text-xs text-fg-secondary space-y-0.5",children:a.upgradeRequirements.slice(0,3).map((s,t)=>e.jsxs("li",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-sys-cyan",children:"•"})," ",s]},t))})]})]})]})}function De({label:s,passed:a}){return e.jsxs("span",{className:t("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",a?"bg-sys-green/20 text-sys-green":"bg-elevated text-fg-muted"),children:[a?e.jsx(ce,{className:"w-2.5 h-2.5"}):e.jsx(K,{className:"w-2.5 h-2.5"}),s]})}function Ge({neighbors:a,className:n,onGhostSelect:l}){const i=c(),o=r(),[p,g]=s.useState(new Set),[u,f]=s.useState("actionable"),[j,b]=s.useState(!1),[N,y]=s.useState(!0),[v,w]=s.useState(Date.now);s.useEffect(()=>{w(Date.now())},[i]);const k=s.useMemo(()=>i.filter(e=>!function(e,s){return s-1e3*e.lastSeen>6048e5}(e,v)),[i,v]),C=s.useMemo(()=>{const e=Array.from(p);return e.length>0?e[0]:null},[p]),M=s.useMemo(()=>C?k.find(e=>e.prefix===C)??null:null,[C,k]);s.useEffect(()=>{l&&l(M&&!N?{prefix:M.prefix,commonNeighbors:Array.from(M.commonNeighbors),estimatedLocation:M.estimatedLocation}:null)},[M,N,l]),s.useEffect(()=>{N&&g(new Set)},[N]);const{confirmed:S,likely:L,possible:P,noise:F,actionableCount:$}=s.useMemo(()=>{var e;const s=[],t=[],a=[],n=[];for(const i of k)switch((null==(e=i.classification)?void 0:e.tier)??"noise"){case"confirmed":s.push(i);break;case"likely":t.push(i);break;case"possible":a.push(i);break;case"noise":n.push(i)}const l=(e,s)=>s.observationCount-e.observationCount;return s.sort(l),t.sort(l),a.sort(l),n.sort(l),{confirmed:s,likely:t,possible:a,noise:n,actionableCount:s.length+t.length}},[k]);if(0===k.length)return null;const R=e=>{g(s=>s.has(e)?new Set:new Set([e]))},E="all"===u,H=S.length+L.length+(E?P.length:0)+(j?F.length:0);return e.jsxs("div",{className:n,children:[e.jsx(U,{listHeader:!0,icon:e.jsx(d,{}),title:"Ghost Buster",titleExtra:e.jsxs(e.Fragment,{children:[$>0&&e.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-sys-green/20 text-sys-green",children:[$," actionable"]}),N&&k.length>0&&e.jsxs("span",{className:"text-xs text-fg-muted ml-2",children:["(",k.length," total)"]})]}),actions:e.jsxs("div",{className:"flex items-center gap-2",children:[!N&&e.jsxs("button",{onClick:()=>f(e=>"actionable"===e?"all":"actionable"),className:t("flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors","all"===u?"bg-sys-blue/20 text-sys-blue":"bg-elevated text-fg-muted hover:text-fg-secondary"),children:[e.jsx(te,{className:"w-3 h-3"}),"actionable"===u?"Actionable":"All"]}),e.jsx("button",{onClick:()=>y(e=>!e),className:"flex items-center gap-1 px-2 py-1 rounded text-xs bg-elevated text-fg-muted hover:text-fg-secondary transition-colors",title:N?"Expand panel":"Minimize panel",children:N?e.jsx(ae,{className:"w-3 h-3"}):e.jsx(x,{className:"w-3 h-3"})})]})}),N?e.jsxs("div",{className:"px-5 py-3 flex items-center gap-3 text-xs cursor-pointer hover:bg-subtle-fill transition-colors",onClick:()=>y(!1),children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[S.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-sys-green",children:[e.jsx(Se,{className:"w-3 h-3"}),S.length," confirmed"]}),L.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-sys-cyan",children:[e.jsx(h,{className:"w-3 h-3"}),L.length," likely"]}),P.length>0&&e.jsxs("span",{className:"text-sys-indigo",children:[P.length," possible"]}),F.length>0&&e.jsxs("span",{className:"text-fg-muted",children:[F.length," noise"]})]}),e.jsx("span",{className:"text-fg-muted ml-auto",children:"Click to expand"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-5 py-2 flex items-center gap-3 text-xs border-b border-edge-subtle/30",children:[e.jsxs("span",{className:"text-fg-muted",children:[o.pathsWithGhosts.toLocaleString()," / ",o.totalPaths.toLocaleString()," paths"]}),e.jsx("span",{className:"text-fg-muted",children:"•"}),e.jsxs("div",{className:"flex items-center gap-2",children:[S.length>0&&e.jsxs("span",{className:"text-sys-green",children:[S.length," confirmed"]}),L.length>0&&e.jsxs("span",{className:"text-sys-cyan",children:[L.length," likely"]}),P.length>0&&e.jsxs("span",{className:"text-sys-indigo",children:[P.length," possible"]}),F.length>0&&e.jsxs("span",{className:"text-fg-muted",children:[F.length," noise"]})]})]}),e.jsxs("div",{className:"px-5 py-4 space-y-4",children:[S.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-sys-green",children:[e.jsx(Se,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Confirmed Repeaters (",S.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:S.map(s=>e.jsx(Ae,{ghost:s,neighbors:a,isExpanded:p.has(s.prefix),onToggle:()=>R(s.prefix)},s.prefix))})]}),L.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-sys-cyan",children:[e.jsx(h,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Likely Repeaters (",L.length,")"]})]}),e.jsx("div",{className:"space-y-2",children:L.map(s=>e.jsx(Ae,{ghost:s,neighbors:a,isExpanded:p.has(s.prefix),onToggle:()=>R(s.prefix)},s.prefix))})]}),E&&P.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-sys-indigo",children:[e.jsx(_,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"font-medium",children:["Possible (",P.length,")"]})]}),e.jsxs("div",{className:"space-y-2",children:[P.slice(0,10).map(s=>e.jsx(Ae,{ghost:s,neighbors:a,isExpanded:p.has(s.prefix),onToggle:()=>R(s.prefix)},s.prefix)),P.length>10&&e.jsxs("div",{className:"text-xs text-fg-muted text-center py-1",children:["+",P.length-10," more possible nodes"]})]})]}),F.length>0&&"all"===u&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{onClick:()=>b(!j),className:"flex items-center gap-2 text-xs text-fg-muted hover:text-fg-secondary transition-colors",children:[j?e.jsx(W,{className:"w-3.5 h-3.5"}):e.jsx(m,{className:"w-3.5 h-3.5"}),e.jsx(V,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["Noise (",F.length,")"]})]}),j&&e.jsx("div",{className:"flex flex-wrap gap-1",children:F.map(s=>e.jsx(Ae,{ghost:s,neighbors:a,isExpanded:!1,onToggle:()=>{},compact:!0},s.prefix))})]}),"actionable"===u&&0===$&&e.jsxs("div",{className:"text-center py-6 text-sm text-fg-muted",children:[e.jsx(d,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No confirmed or likely repeaters yet."}),e.jsxs("p",{className:"text-xs mt-1",children:[P.length+F.length," prefixes need more evidence."]}),e.jsxs("button",{onClick:()=>f("all"),className:"mt-3 text-sys-blue hover:underline",children:["View all ",k.length," discovered nodes"]})]}),o.observationOverrideCount>0&&H>0&&e.jsxs("div",{className:"pt-2 border-t border-edge-subtle/30 text-xs text-fg-muted",children:[e.jsx("span",{className:"text-sys-blue",children:o.observationOverrideCount})," observation overrides • Avg confidence: ",e.jsxs("span",{className:"text-sys-indigo",children:[(100*o.avgPathConfidence).toFixed(0),"%"]})]})]})]})]})}const Ue=s.memo(function({hash:t,className:a="",size:n="sm",collisionInfo:l,isViterbiResolved:i}){const c=u(),o=r(),[d,m]=s.useState(!1),x=s.useMemo(()=>f(t),[t]),p=s.useMemo(()=>void 0!==l?l:x?c.find(e=>e.prefix===x)??null:null,[x,c,l]),g=i??(o.totalPaths>0&&o.avgPathConfidence>=.7),j=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),m(!0)},[]),b=s.useCallback(()=>{m(!1)},[]);if(!p)return null;const N="sm"===n?"w-3.5 h-3.5":"w-4 h-4",y=g?"text-sys-cyan hover:text-sys-cyan hover:bg-sys-cyan/10 focus:ring-sys-cyan/50":"text-signal-fair hover:text-sys-indigo hover:bg-signal-fair/10 focus:ring-signal-fair/50",v=g?`Prefix conflict resolved by Viterbi HMM (${(100*o.avgPathConfidence).toFixed(0)}% confidence)`:`Prefix conflict: ${p.candidateCount} nodes share prefix "${x}"`;return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:j,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${y} ${a}`,title:v,"aria-label":`View prefix conflict for ${x}${g?" (Viterbi resolved)":""}`,children:g?e.jsxs("span",{className:"relative",children:[e.jsx(Y,{className:N}),e.jsx(h,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-sys-green"})]}):e.jsx(ve,{className:N})}),e.jsx(xe,{isOpen:d,prefix:p.prefix,candidateHashes:p.candidateHashes,onClose:b})]})}),Ve=s.memo(function({hash:s,contact:t,isHub:a,isNeighbor:n,distance:l,centrality:i,sparklineData:r,neighborSignal:c,collisionInfo:o,isViterbiResolved:d,isPinging:m,isPingingThis:x,pingResult:p,pingError:g,gatewayInfo:u,lastForwarderPrefix:f,isMobile:v,pathStability:w,onRowClick:k,onPing:C,onRemove:M}){const S=t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude,L=t.node_name||t.name||"Unknown",P=n&&c,F=z(t),{isRepeater:$,isCompanion:R,isRoomServer:E,isClient:H,label:T}=F,O=n?`${T} — Direct RF contact (zero-hop neighbor)`:`${T} — Flood routing (multi-hop via mesh)`,I=t.first_seen?j(t.first_seen).replace(/ ago$/i," old"):null;return e.jsxs("div",{className:`contacts-grid-row ${a?"bg-sys-amber/5 border-l-2 border-l-sys-amber":""} ${S?"cursor-pointer hover:bg-subtle-fill":""}`,onClick:()=>k(s),children:[e.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[P&&null!==(null==c?void 0:c.avgSnr)?e.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0 self-center "+(D=c.avgSnr,void 0===D?"bg-[var(--signal-unknown)]":D>=5?"bg-[var(--signal-excellent)]":D>=0?"bg-[var(--signal-good)]":D>=-5?"bg-[var(--signal-fair)]":D>=-10?"bg-[var(--signal-poor)]":"bg-[var(--signal-critical)]")}):e.jsx("div",{className:"w-2 flex-shrink-0"}),e.jsx("div",{className:"w-6 h-6 flex items-center justify-center flex-shrink-0",title:O,children:(()=>{if(E&&$)return e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(ue,{className:"w-5 h-5 absolute inset-0 text-sys-pink"}),e.jsx(he,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-sys-teal"})]});if(E)return e.jsx(ue,{className:"w-5 h-5 text-sys-pink"});if($)return e.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(b,{className:"w-3.5 h-3.5 text-sys-blue"})});if((R||H)&&"Unknown"!==L){const{emoji:s,cleanName:t}=oe(L);return e.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center",style:{backgroundColor:de(t)},children:s?e.jsx("span",{className:"text-sm leading-none",children:s}):e.jsx("span",{className:"text-white text-[9px] font-bold tracking-tighter",children:me(L)})})}return e.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-zinc-500/20",children:e.jsx(_,{className:"w-3.5 h-3.5 text-sys-amber"})})})()}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 overflow-hidden",children:[e.jsx("span",{className:"roster-title truncate",title:L,children:L}),n&&e.jsx(N,{color:ge.neighbor,compact:!0,className:"flex-shrink-0",children:"NBR"}),a&&e.jsxs(N,{color:ge.hub,compact:!0,className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(fe,{className:"w-3 h-3"}),"HUB"]}),$&&e.jsx(N,{color:ge.repeater,compact:!0,className:"flex-shrink-0",children:"RPT"}),E&&e.jsx(N,{color:ge.room,compact:!0,className:"flex-shrink-0",children:"ROOM"}),R&&e.jsx(N,{color:ge.companion,compact:!0,className:"flex-shrink-0",children:"COMP"}),H&&e.jsx(N,{color:ge.client,compact:!0,className:"flex-shrink-0",children:"CLIENT"}),v&&e.jsxs(N,{color:"cyan",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",children:[e.jsx(ke,{className:"w-2.5 h-2.5"}),"MOBILE"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(se,{copy:!0,size:"compact",truncate:[8,6],children:s}),e.jsx(Ue,{hash:s,collisionInfo:o,isViterbiResolved:d}),!n&&u&&e.jsxs(N,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`Via ${u.name||u.prefix} (${u.hopCount} hop${1!==u.hopCount?"s":""})`,children:[e.jsx(q,{className:"w-2.5 h-2.5"}),e.jsx("span",{className:"font-mono",children:u.prefix}),u.hopCount>1&&e.jsxs("span",{className:"opacity-60",children:["+",u.hopCount-1]})]}),f&&!n&&e.jsxs(N,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`Last forwarded by ${f}`,children:[e.jsx(be,{className:"w-2.5 h-2.5"}),e.jsx("span",{className:"font-mono",children:f})]}),null!=w&&0!==w&&e.jsx(N,{color:w>0?"green":"amber",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:w>0?"Path stability improving":"Path stability declining",children:w>0?e.jsx(Pe,{className:"w-2.5 h-2.5"}):e.jsx(Le,{className:"w-2.5 h-2.5"})}),r.length>0&&(()=>{const s=r.reduce((e,s)=>e+s.count,0);if(0===s)return null;const t=s/24;return e.jsxs(N,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`${s} packets in last 24h (~${t.toFixed(1)}/hr)`,children:[e.jsx(Ce,{className:"w-2.5 h-2.5"}),e.jsxs("span",{children:[t<1?"<1":t.toFixed(0),"/hr"]})]})})(),I&&e.jsxs(N,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0 opacity-70",title:`First discovered ${I}`,children:[e.jsx(ye,{className:"w-2.5 h-2.5"}),e.jsx("span",{children:I})]})]})]})]}),e.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[P&&null!==(null==c?void 0:c.avgRssi)&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Z,{rssi:c.avgRssi,className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs text-fg-muted",children:Math.round(c.avgRssi)})]}),P&&null!==(null==c?void 0:c.avgSnr)&&e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[c.avgSnr.toFixed(1)," dB"]})]}),e.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-fg-muted",children:null!=l&&e.jsxs(e.Fragment,{children:[e.jsx(Me,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs",children:(A=l,A<1e3?`${Math.round(A)}m`:`${(A/1e3).toFixed(1)}km`)})]})}),e.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:i>0&&e.jsxs(e.Fragment,{children:[e.jsx(ee,{className:"w-3 h-3 text-sys-indigo"}),e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[(100*i).toFixed(0),"%"]})]})}),e.jsx("div",{className:"contacts-col-seen flex items-center justify-end",children:e.jsx("span",{className:"type-data-xs text-fg-primary whitespace-nowrap",children:t.last_seen?j(t.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[n&&e.jsx(e.Fragment,{children:p?e.jsxs("div",{className:"flex items-center gap-1 text-sys-green",title:`RTT: ${p.rtt_ms.toFixed(0)}ms`,children:[e.jsx(h,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"type-data-xs hidden sm:inline",children:[p.snr_db.toFixed(1),"dB"]})]}):g?e.jsx("span",{className:"text-sys-red text-xs",title:g,children:"✗"}):e.jsx("button",{onClick:e=>C(s,e),disabled:m,className:"p-1 sm:p-1.5 radius-inner text-fg-muted/50 hover:text-sys-blue hover:bg-sys-blue/10 transition-base disabled:opacity-50 disabled:cursor-not-allowed",title:"Ping neighbor for updated signal info",children:x?e.jsx(y,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):e.jsx(X,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),e.jsx("button",{onClick:e=>{e.stopPropagation(),M(s,L)},className:"p-1 sm:p-1.5 radius-inner text-fg-muted/50 hover:text-sys-red hover:bg-sys-red/10 transition-base",title:"Remove contact",children:e.jsx(ne,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]});var A,D}),We=[],Be=[{field:"lastHeard",icon:p,label:"Recent"},{field:"distance",icon:Me,label:"Distance"},{field:"centrality",icon:ee,label:"Centrality"}];function Ke(e,s){const{color:a="primary",border:n=!1}=s??{};return t("flex items-center gap-1.5 px-2 py-1.5 text-sm radius-inner transition-base",e?"success"===a?"bg-sys-green/20 text-sys-green":"bg-sys-blue/20 text-sys-blue":"text-fg-muted hover:text-fg-secondary hover-bg",n&&(e?"success"===a?"border border-sys-green/30":"border border-sys-blue/30":"border border-transparent"))}function qe(e,s,t,a){const n=(t-e)*Math.PI/180,l=(a-s)*Math.PI/180,i=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(t*Math.PI/180)*Math.sin(l/2)*Math.sin(l/2);return 2*Math.atan2(Math.sqrt(i),Math.sqrt(1-i))*6371e3}const Ze=Object.freeze(Object.defineProperty({__proto__:null,default:function(){const{stats:a}=v(),n=w(),l=k(),d=C(),m=M(),x=S(),p=c(),g=L(),j=P(),N=i(),V=F(),W=u(),B=r(),K=$(),q=B.totalPaths>0&&B.avgPathConfidence>=.7,Z=s.useMemo(()=>{const e=new Map;for(const s of W)e.set(s.prefix,s);return e},[W]),[J,Y]=s.useState(null),[Q,X]=s.useState("lastHeard"),[ee,se]=s.useState("desc"),[te,ae]=s.useState(""),[ne,ce]=s.useState(!1),[oe,de]=s.useState(new Set),[me,xe]=s.useState(!1),[he,ge]=s.useState(null),[fe,be]=s.useState(null),[ye,ve]=s.useState(null),[ke,Ce]=s.useState(null),[Me,Se]=s.useState(new Map),[Le,Pe]=s.useState(new Map),[Fe,$e]=s.useState(25),[Ee,He]=s.useState(25),Te=s.useRef(null),_e=s.useMemo(()=>(null==a?void 0:a.neighbors)??{},[null==a?void 0:a.neighbors]),Oe=s.useMemo(()=>Object.fromEntries(Object.entries(_e).filter(([e])=>!n.has(e))),[_e,n]),Ie=R(),Ae=null==a?void 0:a.local_hash,De=s.useMemo(()=>{const e=new Map;for(const s of N){const t=s.hops[0];if(t&&0!==s.observationTrend){const a=Object.keys(_e).find(e=>e.toUpperCase().startsWith(t.toUpperCase()));a&&!e.has(a)&&e.set(a,s.observationTrend)}}return e},[N,_e]),Ue=s.useMemo(()=>{const e=new Map;if(!Ae||0===g.size)return e;for(const[s,t]of g)if(s.endsWith(`→${Ae}`)&&t.hops.length>1){const a=s.split("→")[0],n=t.hops[t.hops.length-1];e.set(a,n)}return e},[g,Ae]),Ze=s.useMemo(()=>{const e=new Map;if(!(null==Ie?void 0:Ie.latitude)||!(null==Ie?void 0:Ie.longitude))return e;for(const[s,t]of Object.entries(Oe))t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude?e.set(s,qe(Ie.latitude,Ie.longitude,t.latitude,t.longitude)):e.set(s,null);return e},[Oe,Ie]),{neighborHashSet:Je,neighborSignalMap:Ye}=s.useMemo(()=>{const e=new Set,s=new Map;for(const t of x)e.add(t.hash),s.set(t.hash,{avgRssi:t.avgRssi,avgSnr:t.avgSnr});return{neighborHashSet:e,neighborSignalMap:s}},[x]),Qe=s.useMemo(()=>{const e=te.toLowerCase().trim(),s="neighbor"===e||"neighbors"===e,t=ne||s,a=oe.size>0;return Object.fromEntries(Object.entries(Oe).filter(([n,l])=>{if(a){const e=function(e){return function(e){switch(e){case"room_server":return"room";case"repeater":return"repeater";case"companion":case"unknown":return"companion"}}(z(e).type)}(l);if(!oe.has(e))return!1}if(t&&!Je.has(n))return!1;if(s)return!0;if(!e)return!0;const i=(l.node_name||l.name||"").toLowerCase(),r=f(n).toLowerCase();return i.includes(e)||r.includes(e)||n.toLowerCase().includes(e)}))},[Oe,te,ne,Je,oe]),Xe=s.useMemo(()=>{const e=Object.entries(Qe),s=te.toLowerCase().trim(),t=2===s.length&&/^[0-9a-f]{2}$/i.test(s);return e.sort(([e,a],[n,l])=>{if(t){const t=f(e).toLowerCase(),a=f(n).toLowerCase(),l=t===s,i=a===s;if(l&&!i)return-1;if(i&&!l)return 1}let i=0;switch(Q){case"lastHeard":i=(a.last_seen||0)-(l.last_seen||0);break;case"distance":{const s=Ze.get(e)??null,t=Ze.get(n)??null;i=null===s&&null===t?0:null===s?1:null===t?-1:s-t;break}case"centrality":i=(m.get(e)||0)-(m.get(n)||0)}return"desc"===ee?-i:i})},[Qe,Q,ee,Ze,m,te]),es=s.useMemo(()=>{let e=0,s=0,t=0,a=0,n=0;for(const[,l]of Xe){const i=z(l),r=l.latitude&&l.longitude&&0!==l.latitude&&0!==l.longitude;switch(i.type){case"room_server":t++;break;case"repeater":s++;break;case"companion":e++;break;case"unknown":n++}r&&a++}return{companions:e,repeaters:s,roomServers:t,total:Xe.length,withLocation:a,unknown:n}},[Xe]),ss=s.useMemo(()=>new Set(d),[d]),ts=s.useMemo(()=>0===Fe?Xe:Xe.slice(0,Ee),[Xe,Ee,Fe]);s.useEffect(()=>{He(Fe||Xe.length)},[Q,ee,te,ne,oe,Fe,Xe.length]),s.useEffect(()=>{const e=e=>{e.target.closest("[data-dropdown]")||xe(!1)};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[]),s.useEffect(()=>{if(0===Fe)return;const e=new IntersectionObserver(e=>{e[0].isIntersecting&&EeMath.min(e+Fe,Xe.length))},{threshold:.1,rootMargin:"100px"});return Te.current&&e.observe(Te.current),()=>e.disconnect()},[Fe,Ee,Xe.length]);const as=s.useCallback(e=>{$e(e),He(e||Xe.length)},[Xe.length]),ns=s.useCallback(e=>{Q===e?se(e=>"desc"===e?"asc":"desc"):(X(e),se("desc"))},[Q]),ls=s.useCallback(e=>{const s=Oe[e];(null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&0!==s.latitude&&0!==s.longitude&&ge(e)},[Oe]),is=s.useCallback(()=>{ge(null)},[]),rs=s.useCallback((e,s)=>{Y({hash:e,name:s})},[]),cs=s.useCallback(async(e,s)=>{if(s.stopPropagation(),!ke){Ce(e),Se(s=>{const t=new Map(s);return t.delete(e),t}),Pe(s=>{const t=new Map(s);return t.delete(e),t});try{const s=e.startsWith("0x")?e.slice(0,4):`0x${e.slice(0,2)}`,t=await T(s,30);t.success&&t.data?(Se(s=>new Map(s).set(e,t.data)),setTimeout(()=>{Se(s=>{const t=new Map(s);return t.delete(e),t})},1e4)):(Pe(s=>new Map(s).set(e,t.error||"Ping failed")),setTimeout(()=>{Pe(s=>{const t=new Map(s);return t.delete(e),t})},5e3))}catch(t){const s=t instanceof Error?t.message:"Ping failed";Pe(t=>new Map(t).set(e,s)),setTimeout(()=>{Pe(s=>{const t=new Map(s);return t.delete(e),t})},5e3)}finally{Ce(null)}}},[ke]);return e.jsxs(O,{children:[e.jsx(I,{title:"Contacts",icon:e.jsx(ie,{}),controls:e.jsxs("div",{className:"flex items-center gap-4 sm:gap-5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Total:"}),e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${es.total} discovered node${1!==es.total?"s":""} on the mesh network`,children:[e.jsx(ie,{className:"w-3.5 h-3.5 text-fg-secondary"}),e.jsx("span",{children:es.total})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Types:"}),es.repeaters>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${es.repeaters} Repeater${1!==es.repeaters?"s":""} — Mesh network relay nodes that forward packets`,children:[e.jsx(b,{className:"w-3.5 h-3.5 text-sys-blue"}),e.jsx("span",{children:es.repeaters})]}),es.companions>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${es.companions} Companion${1!==es.companions?"s":""} — Client devices (phones, CLI tools) connected to the mesh`,children:[e.jsx(pe,{className:"w-3.5 h-3.5 text-fg-muted"}),e.jsx("span",{children:es.companions})]}),es.roomServers>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${es.roomServers} Room Server${1!==es.roomServers?"s":""} — Group chat servers hosting persistent rooms`,children:[e.jsx(ue,{className:"w-3.5 h-3.5 text-sys-pink"}),e.jsx("span",{children:es.roomServers})]}),es.withLocation>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${es.withLocation} node${1!==es.withLocation?"s":""} with GPS location — Visible on map`,children:[e.jsx(re,{className:"w-3.5 h-3.5 text-sys-green"}),e.jsx("span",{children:es.withLocation})]}),es.unknown>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${es.unknown} unknown node${1!==es.unknown?"s":""} — No name or location advertised`,children:[e.jsx(_,{className:"w-3.5 h-3.5 text-sys-amber"}),e.jsx("span",{children:es.unknown})]})]})]})}),e.jsxs(A,{children:[V?e.jsx(Re,{neighbors:Oe,localNode:Ie??void 0,localHash:Ae,onRemoveNode:l,selectedNodeHash:he,onNodeSelected:is,highlightedEdgeKey:fe,highlightedGhost:ye}):e.jsx("div",{className:"surface-base radius-card aspect-video flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-6 h-6 border-2 border-sys-blue border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-fg-muted",children:"Loading map..."})]})}),e.jsx(ze,{maxPaths:10,highlightedEdge:fe,onHighlightEdge:be}),p.length>0&&(V?e.jsx(o,{noPadding:!0,children:e.jsx(Ge,{neighbors:Oe,onGhostSelect:ve})}):e.jsxs("div",{className:"surface-base radius-card",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-edge-subtle",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-4 rounded bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-6 h-6 rounded bg-elevated animate-pulse"})]}),e.jsx("div",{className:"px-5 py-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-20 h-4 rounded bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-elevated animate-pulse"})]})})]})),e.jsx(o,{noPadding:!0,children:V?e.jsxs(e.Fragment,{children:[e.jsx(U,{listHeader:!0,stackActionsOnMobile:!0,icon:e.jsx(ie,{}),title:"Discovered Contacts",titleExtra:e.jsx(E,{type:"search",size:"sm",value:te,onChange:e=>ae(e.target.value),placeholder:"Search...",leadingIcon:e.jsx(je,{className:"w-3.5 h-3.5"}),trailingIcon:te?e.jsx("button",{onClick:()=>{ae(""),"neighbor"!==te.toLowerCase().trim()&&"neighbors"!==te.toLowerCase().trim()||ce(!1)},className:"text-fg-muted hover:text-fg-secondary",children:e.jsx(H,{className:"w-3 h-3"})}):void 0,className:"w-24 sm:w-32","aria-label":"Search contacts"}),actions:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("div",{className:"relative","data-dropdown":!0,children:[e.jsxs("button",{onClick:()=>xe(!me),className:Ke(oe.size>0,{border:!0}),title:"Filter by contact type",children:[e.jsx(we,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Filter"}),oe.size>0&&e.jsx("span",{className:"tabular-nums text-xs bg-sys-blue/30 px-1 rounded",children:oe.size})]}),me&&e.jsxs("div",{className:"absolute left-0 top-full mt-1 z-50 surface-elevated radius-inner py-1 min-w-[140px]",children:[[{key:"repeater",label:"Repeaters"},{key:"companion",label:"Companions"},{key:"room",label:"Rooms"}].map(({key:s,label:a})=>e.jsxs("button",{onClick:()=>{de(e=>{const t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},className:"w-full px-3 py-1.5 text-sm text-left hover-bg transition-base flex items-center gap-2",children:[e.jsx("span",{className:t("w-4 h-4 flex items-center justify-center radius-badge border",oe.has(s)?"bg-sys-blue border-sys-blue text-white":"border-edge-subtle"),children:oe.has(s)&&e.jsx(h,{className:"w-3 h-3"})}),e.jsx("span",{className:oe.has(s)?"text-fg-primary":"text-fg-secondary",children:a})]},s)),oe.size>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-edge-subtle my-1"}),e.jsx("button",{onClick:()=>de(new Set),className:"w-full px-3 py-1.5 text-sm text-left text-fg-muted hover:text-fg-secondary hover-bg transition-base",children:"Clear filters"})]})]})]}),Je.size>0&&e.jsxs("button",{onClick:()=>ce(!ne),className:Ke(ne,{color:"success",border:!0}),title:ne?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[e.jsx(b,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Neighbors"}),e.jsx("span",{className:"sm:hidden tabular-nums",children:Je.size})]})]}),e.jsx("div",{className:"hidden sm:block h-4 w-px bg-border-subtle"}),e.jsxs("div",{className:"flex items-center gap-1",children:[Be.map(({field:s,icon:a,label:n})=>e.jsxs("button",{onClick:()=>ns(s),className:Ke(Q===s),title:`Sort by ${n.toLowerCase()}`,children:[e.jsx(a,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:n}),Q===s&&e.jsx(Ne,{className:t("w-3 h-3","asc"===ee&&"rotate-180")})]},s)),e.jsx("div",{className:"h-4 w-px bg-border-subtle"}),e.jsxs(D,{value:Fe,onChange:as,className:"w-auto min-w-[50px] [&_button]:py-1 [&_button]:px-2 [&_button]:text-xs [&_button]:min-h-0","aria-label":"Items per page",children:[e.jsx(G,{value:25,children:"25"}),e.jsx(G,{value:50,children:"50"}),e.jsx(G,{value:100,children:"100"}),e.jsx(G,{value:0,children:"All"})]})]})]})}),Xe.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden sm:grid contacts-grid-header border-b border-edge-subtle/50 px-3 py-2 type-micro text-fg-muted",children:[e.jsx("div",{className:"contacts-col-node",children:"Node"}),e.jsx("div",{className:"contacts-col-signal text-right",children:"Signal"}),e.jsx("div",{className:"contacts-col-distance text-right",children:"Distance"}),e.jsx("div",{className:"contacts-col-centrality text-right",children:"Centrality"}),e.jsx("div",{className:"contacts-col-seen text-right",children:"Last Seen"}),e.jsx("div",{className:"contacts-col-actions"})]}),e.jsx("div",{className:"divide-y divide-edge-subtle/30",children:ts.map(([s,t])=>{const a=f(s),n=ss.has(s),l=Je.has(s),i=Ze.get(s)??null,r=m.get(s)||0,c=l?Ye.get(s):void 0,o=a?Z.get(a)??null:null,d=K.get(s)??We;let x=null;if(!l&&Ae&&g.size>0){const e=`${s}→${Ae}`,t=g.get(e);if(t&&t.hops.length>0){const e=t.hops[0],s=Object.keys(_e).find(s=>s.toUpperCase().startsWith(e.toUpperCase())),a=s?_e[s]:null;x={prefix:e,name:(null==a?void 0:a.node_name)??(null==a?void 0:a.name)??null,hopCount:t.hopCount}}}const h=j.has(s),p=De.get(s)??null,u=Ue.get(s)??null;return e.jsx(Ve,{hash:s,contact:t,isHub:n,isNeighbor:l,distance:i,centrality:r,sparklineData:d,neighborSignal:c,collisionInfo:o,isViterbiResolved:q,isPinging:null!==ke,isPingingThis:ke===s,pingResult:Me.get(s),pingError:Le.get(s),gatewayInfo:x,lastForwarderPrefix:u,isMobile:h,pathStability:p,onRowClick:ls,onPing:cs,onRemove:rs},s)})}),Fe>0&&Ee0&&EeHe(e=>Math.min(e+Fe,Xe.length)),className:"text-sys-blue hover:text-sys-blue/80 transition-base",children:"Load more"})]})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(ie,{className:"roster-empty-icon"}),e.jsx("div",{className:"type-label text-fg-secondary",children:"No Contacts Discovered"}),e.jsx("div",{className:"type-data-xs text-fg-muted mt-1",children:"Contacts will appear here as they advertise on the mesh network."})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-edge-subtle",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-elevated animate-pulse"}),e.jsx("div",{className:"w-32 h-4 rounded bg-elevated animate-pulse"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-16 h-6 rounded bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-6 rounded bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-6 rounded bg-elevated animate-pulse"})]})]}),e.jsx("div",{className:"px-3 py-3 space-y-3",children:[...Array(5)].map((s,t)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 rounded bg-elevated animate-pulse"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"h-4 w-32 rounded bg-elevated animate-pulse"}),e.jsx("div",{className:"h-3 w-24 rounded bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-12 h-4 rounded bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-elevated animate-pulse"})]},t))})]})})]}),e.jsx(le,{isOpen:!!J,title:"Remove Contact",message:`Are you sure you would like to remove ${(null==J?void 0:J.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{J&&l(J.hash),Y(null)},onCancel:()=>Y(null)})]})}},Symbol.toStringTag,{value:"Module"}));export{Ze as C,Ue as P,Me as R}; diff --git a/frontend/dist/assets/ContactsMapMapLibre-BEIMeErH.js b/frontend/dist/assets/ContactsMapMapLibre-BNwBX2WN.js similarity index 99% rename from frontend/dist/assets/ContactsMapMapLibre-BEIMeErH.js rename to frontend/dist/assets/ContactsMapMapLibre-BNwBX2WN.js index 5a7c3fe4..ce8cef07 100644 --- a/frontend/dist/assets/ContactsMapMapLibre-BEIMeErH.js +++ b/frontend/dist/assets/ContactsMapMapLibre-BNwBX2WN.js @@ -1 +1 @@ -import{r as A,j as e,c as t,q as r}from"./vendor-react-j_fHog8x.js";import{u as n,b as o,S as i,L as a,P as s,c as l,M as c,d as u,B as d}from"./BasemapLayer-BT1oL_wV.js";import"./maplibre-gl-b91ci4Kr.js";import{L as f,c as g}from"./link-scoring-LTbqUxGC.js";import{c as h,Z as m,bk as b,d0 as p,d1 as v,d2 as y,au as w,aC as x,aD as k,H as C,m as B,Y as M,A as D,b as E,B as j,b4 as Q,aw as N,aE as S,L as F,W as P,R as T,a5 as L,X as R,o as I,an as _,d3 as z,F as H,d4 as G,d5 as O,G as U,be as Y,d6 as W,d7 as V,a0 as Z,j as K,O as J,bf as X,x as q,d8 as $,d9 as AA}from"./index-01Tx8g53.js";import{P as eA,T as tA,C as rA}from"./ConfirmModal-B8b131zF.js";import{a as nA,M as oA,E as iA,u as aA,G as sA,g as lA,b as cA,d as uA,D as dA}from"./DeepAnalysisModal-BWClcGsg.js";import{M as fA}from"./message-square-B0UfZczh.js";import{H as gA,D as hA}from"./DelayedAnimateNumber-Ix4AeV6C.js";import{R as mA}from"./refresh-cw-DYbYazpH.js";import{E as bA}from"./target-L50EKHoJ.js";import{S as pA,M as vA}from"./sun-CkgnTZGI.js";import{C as yA,a as wA,b as xA,c as kA}from"./easing-DMuAVfRm.js";import{G as CA}from"./git-branch-Bz_gqcbv.js";import{Z as BA}from"./SignalIndicator-CIKrVFY9.js";import{l as MA}from"./font-loader-BQzEmDrZ.js";import{c as DA,p as EA,d as jA}from"./vendor-core-CmkNwW1A.js";import{D as QA,c as NA}from"./geo-utils-D72kdxDo.js";import{W as SA}from"./wifi-DUOhGE6X.js";import{U as FA}from"./users-CIk0ES1a.js";import{H as PA,C as TA,N as LA,a as RA}from"./badge-colors-YAE4qQ7m.js";import{L as IA}from"./LightSparkline-BCL2qx0n.js";import{P as _A,R as zA}from"./Contacts-CiTyOtpU.js";import{C as HA}from"./copy-B5OWhmpX.js";import{M as GA}from"./map-pin-DZIYgupP.js";import"./triangle-alert-DI33YyZq.js";import"./database-Cxl-xDNL.js";import"./index-D932VMrD.js";import"./signal-scoring-CcBiRcks.js";import"./ping-CcgRdnC3.js";import"./node-types-BT5BImck.js";import"./PageLayout-DrvMAhys.js";import"./listbox-D30S1eZ7.js";import"./Card-Dr9pbVV5.js";import"./activity-DOuX3omM.js";import"./DataBox-Dpf5ZHgV.js";import"./funnel-4zcnjEgH.js";import"./circle-check-DXO8ha7w.js";import"./chat-utils-CB1BFUm7.js";import"./CollisionExplorerModal-CTPNNbNo.js";import"./network-CCjpHq5M.js";import"./search-DGnzblbI.js";const OA=h("boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]),UA=h("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),YA=h("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),WA=h("mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]),VA=h("sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]),ZA=h("swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]),KA=h("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),JA=h("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);function XA(A,e){const t=Math.max(5,Math.min(A,300)),r=Math.log(5),n=Math.log(300);return 1+(Math.log(t)-r)/(n-r)*5}const qA={textPrimary:m[900],textSecondary:"#4A4A4A",textMuted:m[500],border:"rgba(0, 0, 0, 0.12)",hoverBg:"rgba(0, 0, 0, 0.06)",disabledText:"rgba(0, 0, 0, 0.25)"},$A={nodeFill:b.blue,nodeStroke:"rgba(255,255,255,0.9)",nodeColor:b.indigo,localColor:b.amber,hubColor:b.purple,gatewayColor:b.indigo,mobileColor:b.orange,roomServerColor:b.pink,neighborColor:b.amber,edges:{rest:m[700],restBright:m[600],restDim:m[800],hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:m[400],hoverNeighbor:b.amber,neighborRest:m[500],neighborHover:b.amber,highlight:"#FFD700"},edgeOpacity:.82};function Ae(){if("undefined"==typeof window)return $A;const A=p(),e=v();return{nodeFill:A.nodeFill,nodeStroke:A.nodeStroke,nodeColor:$A.nodeColor,localColor:A.localColor,hubColor:A.hubColor,gatewayColor:A.gatewayColor,mobileColor:A.mobileColor,roomServerColor:A.roomColor,neighborColor:A.neighborColor,edges:{rest:e.rest,restBright:e.restBright,restDim:e.restDim,hoverDirect:e.hoverDirect,hoverLoop:e.hoverLoop,hoverStandard:e.hoverStandard,hoverNeighbor:e.hoverNeighbor,neighborRest:$A.edges.neighborRest,neighborHover:$A.edges.neighborHover,highlight:e.highlight},edgeOpacity:$A.edgeOpacity}}const ee=2e3,te=E.snappy,re=qA,ne=A.createContext("dark"),oe=()=>A.useContext(ne);function ie({color:A,ring:t}){return e.jsx("span",{className:"shrink-0 rounded-full",style:{width:14,height:14,backgroundColor:t?"transparent":A,border:t?`4px solid ${A}`:void 0,boxSizing:"border-box"}})}function ae({color:A}){return e.jsx("span",{className:"shrink-0 rounded-sm",style:{width:16,height:3,backgroundColor:A}})}function se({indicator:A,label:r,tooltip:n}){const o="light"===oe();return e.jsxs("div",{className:"flex items-center gap-1.5",children:[A,e.jsx("span",{className:t(!o&&"text-fg-secondary"),style:o?{color:re.textSecondary}:void 0,children:r}),n&&e.jsx(C,{content:n,delay:200,children:e.jsx("span",{className:t("cursor-help text-[10px] opacity-60 hover:opacity-100 transition-opacity",!o&&"text-fg-muted"),style:o?{color:re.textMuted}:void 0,children:"ⓘ"})})]})}function le({title:A,tooltip:r,isOpen:n,onToggle:o,showDivider:i,children:a}){const s="light"===oe();return e.jsxs("div",{className:i?"mt-2 pt-2 border-t":"",style:i?{borderColor:s?re.border:"var(--map-ui-border)"}:void 0,children:[e.jsxs("button",{type:"button",onClick:o,className:t("group w-full flex items-center justify-between py-1 font-medium transition-colors",!s&&"text-fg-secondary hover:text-fg-primary"),style:s?{color:re.textSecondary}:void 0,children:[e.jsxs("span",{className:"flex items-center gap-1",children:[A,e.jsx(C,{content:r,delay:200,children:e.jsx("span",{className:t("cursor-help text-[10px] opacity-60 group-hover:opacity-100 transition-opacity",!s&&"text-fg-muted"),style:s?{color:re.textMuted}:void 0,children:"ⓘ"})})]}),e.jsx(B.span,{animate:{rotate:n?0:-90},transition:{duration:.15},children:e.jsx(M,{className:"w-3 h-3",style:s?{color:re.textMuted}:{color:"var(--fg-muted)"}})})]}),e.jsx(D,{initial:!1,children:n&&e.jsx(B.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:te,className:"overflow-hidden",children:e.jsx("div",{className:"flex flex-col gap-1 pt-1.5",children:a})})})]})}function ce({label:A,value:r,color:n}){const o="light"===oe();return e.jsxs("div",{className:t("flex justify-between tabular-nums",!o&&"text-fg-muted"),style:o?{color:re.textMuted}:void 0,children:[e.jsx("span",{children:A}),e.jsx("span",{style:n?{color:n}:o?{color:re.textSecondary}:{color:"var(--fg-secondary)"},children:r})]})}function ue({icon:A,color:r,title:n,subtitle:o}){const i="light"===oe();return e.jsx("div",{className:"mt-1.5 pt-1.5 border-t",style:{borderColor:i?re.border:"var(--map-ui-border)"},children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"shrink-0",style:{color:r},children:A}),e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{className:"font-medium truncate",style:{color:r},children:n}),e.jsx("span",{className:t("text-[10px] leading-tight",!i&&"text-fg-muted"),style:i?{color:re.textMuted}:void 0,children:o})]})]})})}function de({showTopology:t,validatedPolylineCount:r,filteredNeighborCount:n,hasLocalNode:o,meshTopology:i,zeroHopNeighbors:a,neighborsWithLocation:s,basemapMode:l="dark"}){const c=y(),u=w(),d=x(),g=u.filter(A=>A.isLikelyReal).length,h=function(A){let e=0;for(const t of A.txDelayRecommendations.values())"backbone"===t.networkRole&&e++;return e}(i),m=a.size>0,[b,p]=A.useState(!0),[v,C]=A.useState(!0),[B,M]=A.useState(!0);return e.jsx(ne.Provider,{value:l,children:e.jsxs("div",{className:"map-control-surface p-2.5 text-xs",children:[e.jsxs(le,{title:"Nodes",tooltip:"Node type shown by shape + color. Yellow = direct RF neighbor.",isOpen:b,onToggle:()=>p(A=>!A),children:[e.jsx(se,{indicator:e.jsx(ie,{color:c.nodeFill}),label:"Node",tooltip:"Standard mesh node. Repeater, client, or companion device."}),e.jsx(se,{indicator:e.jsx(ie,{color:c.hubColor}),label:"Hub",tooltip:"Network hub (≥10% of last-hop traffic)."}),(D=s,D.some(([,A])=>{var e;const t=null==(e=A.contact_type)?void 0:e.toLowerCase();return"room server"===t||"room_server"===t||"room"===t||"server"===t})&&e.jsx(se,{indicator:e.jsx(fA,{className:"w-3 h-3 shrink-0",style:{color:c.roomColor},strokeWidth:2.5}),label:"Room",tooltip:"Room Server identity for client sync."})),e.jsx(se,{indicator:e.jsx(gA,{className:"w-3 h-3 shrink-0",style:{color:c.localColor},strokeWidth:2.5}),label:"Local",tooltip:"Your repeater running pyMC_Repeater."}),m&&e.jsx(se,{indicator:e.jsx(ie,{color:c.neighborColor}),label:"Neighbor",tooltip:"Zero-hop direct RF contact."}),i.gatewayNodes.length>0&&e.jsx(se,{indicator:e.jsx(ie,{color:c.gatewayColor}),label:"Gateway",tooltip:"Significant forwarder (7-10% traffic)."}),h>0&&e.jsx(se,{indicator:e.jsx(ie,{color:c.hubColor}),label:"Backbone",tooltip:"Critical relay with high centrality."}),i.mobileNodes.length>0&&e.jsx(se,{indicator:e.jsx(ie,{color:c.mobileColor,ring:!0}),label:"Mobile",tooltip:"Volatile node that appears/disappears."}),g>0&&e.jsx(se,{indicator:e.jsx(k,{className:"w-3 h-3 shrink-0",style:{color:c.ghostColor},strokeWidth:2.5}),label:`Ghost (${g})`,tooltip:"Unknown repeater from Viterbi analysis."})]}),m&&e.jsxs(le,{title:"Link Quality",tooltip:"Neighbor edge colors based on bidirectional balance.",isOpen:v,onToggle:()=>C(A=>!A),showDivider:!0,children:[e.jsx(se,{indicator:e.jsx(ae,{color:f.YELLOW}),label:"2-Way",tooltip:"33-67% balanced. Ideal bidirectional link."}),e.jsx(se,{indicator:e.jsx(ae,{color:f.GREEN}),label:"Listener",tooltip:">67% listener. They hear us well."}),e.jsx(se,{indicator:e.jsx(ae,{color:f.RED}),label:"Loud",tooltip:"<33% listener. They route more to us."})]}),t&&r>0&&e.jsxs(le,{title:"Topology",tooltip:"Links with 5+ validations. Thickness = strength.",isOpen:B,onToggle:()=>M(A=>!A),showDivider:!0,children:[e.jsx(ce,{label:"Nodes",value:n+(o?1:0)}),i.hubNodes.length>0&&e.jsx(ce,{label:"Hubs",value:i.hubNodes.length,color:$A.hubColor}),i.loops.length>0&&e.jsx(ue,{icon:e.jsx(mA,{className:"w-3 h-3"}),color:$A.edges.hoverLoop,title:`${i.loops.length} ${1===i.loops.length?"Loop":"Loops"}`,subtitle:"Redundant paths"}),d.totalPaths>0&&e.jsx(ue,{icon:e.jsx(bA,{className:"w-3 h-3"}),color:c.ghostColor,title:`${d.totalPaths.toLocaleString()} Viterbi`,subtitle:"HMM decoded paths"})]})]})});var D}const fe=qA.textMuted;function ge({mapRef:A,showNeighborLines:t,onToggleNeighborLines:r,hasNeighborPolylines:n,nodeFilter:o,onNodeFilterChange:i,hasHubNodes:a,hasZeroHopNeighbors:s,showCoverage:l,onToggleCoverage:c,showMinCut:u=!1,onToggleMinCut:d,hasMinCutData:f=!1,show3DTerrain:g,onToggle3DTerrain:h,basemapMode:m,onToggleBasemap:b,isFullscreen:p,onToggleFullscreen:v}){const y="w-4 h-4",w="light"===m?fe:void 0;return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"absolute top-3 right-3 z-[600] flex flex-col gap-2 sm:top-4 sm:right-4",children:[e.jsxs("div",{className:"map-control-surface flex items-center gap-1 p-1",children:[n&&e.jsx(j,{plain:!0,color:t?"warning":"muted",onClick:r,title:t?"Hide edge lines":"Show edge lines","aria-label":t?"Hide edge lines":"Show edge lines","aria-pressed":t,className:"!p-1.5 !rounded-md",children:e.jsx(Q,{className:y})}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(N,{color:"all"===o?"green":"zinc",customColor:"all"!==o?w:void 0,onClick:()=>i("all"),title:"Show all nodes",children:"All"}),a&&e.jsx(N,{color:"hubs"===o?"green":"zinc",customColor:"hubs"!==o?w:void 0,onClick:()=>i("hubs"),title:"Show only hub nodes and their connections",children:"Hubs"}),s&&e.jsx(N,{color:"direct"===o?"green":"zinc",customColor:"direct"!==o?w:void 0,onClick:()=>i("direct"),title:"Show only zero-hop (direct RF) neighbors",children:"Direct"})]}),f&&d&&e.jsx(j,{plain:!0,color:u?"primary":"muted",onClick:d,title:u?"Hide community partition":"Show community partition","aria-label":u?"Hide community partition":"Show community partition","aria-pressed":u,className:"!p-1.5 !rounded-md",children:e.jsx(OA,{className:y})}),e.jsx(j,{plain:!0,color:"light"===m?"primary":"muted",onClick:b,title:"light"===m?"Switch to dark map":"Switch to light map","aria-label":"light"===m?"Switch to dark map":"Switch to light map","aria-pressed":"light"===m,className:"!p-1.5 !rounded-md",children:"light"===m?e.jsx(pA,{className:y}):e.jsx(vA,{className:y})}),e.jsx(j,{plain:!0,color:g?"success":"muted",onClick:h,title:g?"Disable 3D terrain":"Enable 3D terrain","aria-label":g?"Disable 3D terrain":"Enable 3D terrain","aria-pressed":g,className:"!p-1.5 !rounded-md",children:e.jsx(WA,{className:y})}),e.jsx(j,{plain:!0,color:"muted",onClick:v,title:p?"Exit fullscreen":"Fullscreen","aria-label":p?"Exit fullscreen":"Enter fullscreen","aria-pressed":p,className:"!p-1.5 !rounded-md",children:p?e.jsx(nA,{className:y}):e.jsx(oA,{className:y})})]}),e.jsxs("div",{className:"map-control-surface flex flex-col items-stretch !overflow-hidden self-end !p-0",children:[e.jsx(j,{plain:!0,color:"muted",onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomIn()},title:"Zoom in","aria-label":"Zoom in",className:"!p-1.5 !rounded-none",children:e.jsx(eA,{className:y})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx(j,{plain:!0,color:"muted",onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomOut()},title:"Zoom out","aria-label":"Zoom out",className:"!p-1.5 !rounded-none",children:e.jsx(S,{className:y})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx(j,{plain:!0,color:"muted",onClick:()=>{var e;const t=null==(e=A.current)?void 0:e.getMap();t&&t.easeTo({bearing:0,pitch:0,duration:300})},title:"Reset bearing to north","aria-label":"Reset bearing to north",className:"!p-1.5 !rounded-none",children:e.jsx(yA,{className:y})})]})]})})}const he={text:qA.textSecondary,activeText:"#16A34A",activeBg:"rgba(220, 252, 231, 1)"},me="DeepAnalysis";function be(){return"abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())]}function pe({isActive:t,hasAnalyzed:r,isLoading:n,onClick:o,basemapMode:i="dark"}){const a="light"===i,s=a?he.text:void 0,l=a?he.activeText:"#4ADE80",[c,u]=A.useState(!1),[d,f]=A.useState(me),g=A.useRef(!1),h=A.useRef(null),[m]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),b=c&&!t&&!n&&m;A.useEffect(()=>{if(c&&!t&&!n&&!g.current){g.current=!0;const A=performance.now(),e=t=>{const r=t-A,n=Math.min(r/700,1),o=Math.floor(12*n);let i="";for(let A=0;A<12;A++)i+=A{h.current&&cancelAnimationFrame(h.current)}},[c,t,n]);const p=n?"Analyzing...":d;return e.jsxs("button",{onClick:o,onMouseEnter:()=>m&&u(!0),onMouseLeave:()=>m&&u(!1),onPointerEnter:()=>m&&u(!0),onPointerLeave:()=>m&&u(!1),disabled:n,className:"flex items-center gap-2 w-full text-left radius-inner transition-base "+(n?"cursor-wait":""),style:{padding:"0.5rem 0.625rem",backgroundColor:t?a?he.activeBg:"rgba(10, 26, 10, 1)":"var(--map-ui-bg, var(--surface))"},title:n?"Analyzing packet history...":r?t?"Hide topology edges":"Show topology edges":"Load full packet history and build topology",children:[n?e.jsx(F,{className:"w-3.5 h-3.5 flex-shrink-0 animate-spin",style:{color:l}}):e.jsx(CA,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"":"text-fg-secondary"),style:{...t&&{color:l},...b&&{color:l},...!t&&!b&&s&&{color:s}}}),e.jsx("span",{className:t?"":"text-fg-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:t||b?700:500,letterSpacing:"-0.01em",lineHeight:1,...t&&{color:l},...b&&{color:l},...!t&&!b&&s&&{color:s}},children:p})]})}const ve=b.teal,ye={text:qA.textSecondary,activeTeal:"#0D7377",activeBg:"rgba(204, 251, 241, 1)"};function we({isActive:t,onClick:r,basemapMode:n="dark"}){const o="light"===n,i=o?ye.text:void 0,a=o?ye.activeTeal:ve,[s,l]=A.useState(!1),[c,u]=A.useState(0),d=A.useRef(!1),f=A.useRef(null),[g,h]=A.useState(0),m=A.useRef(!1),[b]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),p=s&&!t&&b;A.useEffect(()=>{p&&!m.current&&(m.current=!0,h(1),setTimeout(()=>h(2),100),setTimeout(()=>h(3),200)),s||(m.current=!1,h(0))},[p,s]),A.useEffect(()=>{if(s&&!t&&!d.current){d.current=!0;const A=performance.now(),e=t=>{const r=t-A,n=Math.min(r/400,1);u(n),n<1&&(f.current=requestAnimationFrame(e))};f.current=requestAnimationFrame(e)}return s||(f.current&&(cancelAnimationFrame(f.current),f.current=null),d.current=!1,u(0)),()=>{f.current&&cancelAnimationFrame(f.current)}},[s,t]);const v=A=>{if(t)return a;if(!p)return i;const e=11*c;return A>=e-2&&Ab&&l(!0),onMouseLeave:()=>b&&l(!1),onPointerEnter:()=>b&&l(!0),onPointerLeave:()=>b&&l(!1),className:"flex items-center gap-2 w-full text-left radius-inner transition-base",style:{padding:"0.5rem 0.625rem",backgroundColor:t?o?ye.activeBg:"rgba(10, 36, 32, 1)":"var(--map-ui-bg, var(--surface))"},title:t?"Disable live packet tracing (reduces CPU usage)":"Enable live packet tracing",children:[e.jsx(BA,{className:"w-3.5 h-3.5 flex-shrink-0 "+(t?"":"text-fg-secondary"),fill:1===g?"#FFFFFF":3===g?a:"none",stroke:1===g||2===g?"#FFFFFF":t||p?a:i||"currentColor",style:{transition:"fill 0.05s, stroke 0.05s"}}),e.jsx("span",{className:t?"":"text-fg-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:t||p?700:500,letterSpacing:"-0.01em",lineHeight:1},children:"LiveTrace".split("").map((A,t)=>e.jsx("span",{style:{color:v(t)||void 0},children:A},t))})]})}const xe={text:qA.textSecondary,hoverBg:qA.hoverBg,activeBg:"rgba(254, 243, 199, 1)",disabledText:qA.disabledText},ke="#fe8019";function Ce({isActive:t,onClick:r,brightness:n=.7,onBrightnessChange:o,basemapMode:i="dark"}){const a="light"===i,s=a?xe.text:void 0,[l,c]=A.useState(!1),[u,d]=A.useState(!1),[f]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)});A.useEffect(()=>{MA()},[]),A.useEffect(()=>{if(!l||t)return;const A=requestAnimationFrame(()=>d(!0)),e=setTimeout(()=>d(!1),80);return()=>{cancelAnimationFrame(A),clearTimeout(e)}},[l,t]);const g=Math.max(.01,Math.min(1,n)),h=g<.999,m=g>.011,b=l&&!t&&f;return e.jsxs("button",{onClick:r,onMouseEnter:()=>f&&c(!0),onMouseLeave:()=>f&&c(!1),onPointerEnter:()=>f&&c(!0),onPointerLeave:()=>f&&c(!1),className:"flex items-center gap-2 w-full text-left radius-inner transition-base",style:{padding:"0.5rem 0.625rem",backgroundColor:t?a?xe.activeBg:"rgba(26, 20, 8, 1)":"var(--map-ui-bg, var(--surface))"},title:t?"Configure wardriving coverage":"Show wardriving coverage",children:[e.jsx(ZA,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"text-sys-amber":"text-fg-secondary"),style:b?{color:ke}:!t&&s?{color:s}:void 0}),e.jsx("span",{className:t?"text-sys-amber":"text-fg-secondary",style:{fontFamily:t||b?"'Jacquard 12', serif":"ui-monospace, SFMono-Regular, monospace",fontSize:t||b?"0.75rem":"0.6875rem",fontWeight:500,letterSpacing:"-0.01em",lineHeight:1,transition:"none",transform:t?"scale(1.45)":b?`scale(${u?1.595:1.45})`:void 0,transformOrigin:"left center",...b?{color:ke}:!t&&s?{color:s}:{}},children:"Wardrive"}),t&&o&&e.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[e.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.max(.01,g-.2);null==o||o(e)},disabled:!m,className:"p-0.5 rounded transition-colors "+(m?"text-sys-amber":"cursor-not-allowed"),style:{...m&&{"--hover-bg":a?xe.hoverBg:"var(--elevated)"},...!m&&{color:a?xe.disabledText:"rgba(251, 191, 36, 0.3)"}},onMouseEnter:A=>m&&(A.currentTarget.style.backgroundColor=a?xe.hoverBg:"var(--elevated)"),onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",title:`Decrease opacity (${Math.round(100*g)}%)`,children:e.jsx(vA,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.min(1,g+.2);null==o||o(e)},disabled:!h,className:"p-0.5 rounded transition-colors "+(h?"text-sys-amber":"cursor-not-allowed"),style:{...h&&{"--hover-bg":a?xe.hoverBg:"var(--elevated)"},...!h&&{color:a?xe.disabledText:"rgba(251, 191, 36, 0.3)"}},onMouseEnter:A=>h&&(A.currentTarget.style.backgroundColor=a?xe.hoverBg:"var(--elevated)"),onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",title:`Increase opacity (${Math.round(100*g)}%)`,children:e.jsx(pA,{className:"w-3.5 h-3.5"})})]})]})}function Be(A){let e=!0,t=-90,r=90,n=-180,o=180;for(const i of A.toLowerCase()){const A="0123456789bcdefghjkmnpqrstuvwxyz".indexOf(i);if(-1!==A)for(let i=4;i>=0;i--){const a=A>>i&1;if(e){const A=(n+o)/2;a?n=A:o=A}else{const A=(t+r)/2;a?t=A:r=A}e=!e}}return{lat:(t+r)/2,lon:(n+o)/2}}function Me(A){return Math.exp(-A*Math.LN2/7)}const De="pymc-wardriving-url",Ee="pymc-wardriving-enabled",je="pymc-wardriving-brightness";function Qe(A){"undefined"!=typeof localStorage&&(A?localStorage.setItem(De,A):localStorage.removeItem(De))}function Ne(A){"undefined"!=typeof localStorage&&localStorage.setItem(Ee,String(A))}function Se(){if("undefined"==typeof localStorage)return.7;const A=localStorage.getItem(je);if(A){const e=parseFloat(A);if(!isNaN(e)&&e>=.01&&e<=1)return e}return.7}function Fe(A,e=null){if(null!==A){const t=(Math.max(-12,Math.min(12,A))+12)/24;return null!==e?.8*t+(Math.max(-120,Math.min(-50,e))+120)/70*.2:t}return null!==e?(Math.max(-120,Math.min(-50,e))+120)/70:.5}const Pe=DA((A,e)=>({status:"idle",isVisible:"undefined"!=typeof localStorage&&"true"===localStorage.getItem(Ee),coveragePoints:[],repeaters:[],error:null,stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},url:"undefined"==typeof localStorage?"":localStorage.getItem(De)||"",brightness:Se(),isModalOpen:!1,openModal:()=>A({isModalOpen:!0}),closeModal:()=>A({isModalOpen:!1}),setUrl:e=>A({url:e}),setBrightness:e=>{const t=Math.max(.01,Math.min(1,e));!function(A){if("undefined"==typeof localStorage)return;const e=Math.max(.01,Math.min(1,A));localStorage.setItem(je,String(e))}(t),A({brightness:t})},toggleVisibility:()=>{const t=!e().isVisible;Ne(t),A({isVisible:t})},setVisible:e=>{Ne(e),A({isVisible:e})},loadCoverage:async e=>{if(!e.trim())return A({error:"Please enter a URL",status:"error"}),!1;try{new URL(e.trim())}catch{return A({error:"Invalid URL format",status:"error"}),!1}A({error:null,status:"connecting"});try{A({status:"loading"});const t=await async function(A){const e=`${A.replace(/\/+$/,"").replace(/\/get-nodes$/,"").replace(/\/get-samples$/,"")}/get-samples`,t=await async function(A,e={},t=8e3){const r=new AbortController,n=setTimeout(()=>r.abort(),t);try{return await fetch(A,{...e,signal:r.signal})}catch(o){if(o instanceof Error&&"AbortError"===o.name)throw new Error(`Connection timed out after ${t/1e3}s`);throw o}finally{clearTimeout(n)}}(e,{headers:{Accept:"application/json"}});if(!t.ok)throw new Error(`Failed to fetch precise samples: ${t.status}`);return t.json()}(e.trim());if(!t||"object"!=typeof t)throw new Error("Invalid response from server");if(!Array.isArray(t.keys))throw new Error("No sample data found in response");A({status:"processing"});const r=function(A){var e;const t=[];for(const r of A.keys){if(!r.observed)continue;const{lat:A,lon:n}=Be(r.hash),o=parseInt(r.time,10),i=isNaN(o)?30:(Date.now()-o)/864e5,a=Me(i),s=Fe(r.snr,r.rssi)*(.3+.7*a);t.push({lat:A,lon:n,successRate:r.observed?1:0,weight:s,totalSamples:1,ageDays:i,geohash:r.hash,repeaters:(null==(e=r.path)?void 0:e.map(A=>A.toLowerCase()))||[]})}return t}(t);if(0===r.length)throw new Error("No valid coverage points found");return A({coveragePoints:r,repeaters:[],stats:{coverageCount:r.length,repeaterCount:0,lastUpdated:new Date},status:"success",isVisible:!0,url:e.trim()}),Qe(e.trim()),Ne(!0),!0}catch(t){const e=t instanceof Error?t.message:"Failed to load coverage data";let r=e;return e.includes("timed out")?r="Connection timed out. Server may be unreachable or slow.":e.includes("Failed to fetch")||e.includes("NetworkError")?r="Could not connect to server. Check the URL and try again.":e.includes("CORS")?r="Server does not allow cross-origin requests.":e.includes("404")?r="Coverage endpoint not found. Check the URL.":(e.includes("ERR_NAME_NOT_RESOLVED")||e.includes("DNS"))&&(r="Server not found. Check the URL for typos."),A({error:r,status:"error"}),!1}},clearCoverage:()=>{A({coveragePoints:[],repeaters:[],stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},status:"idle",error:null,isVisible:!1,url:""}),Qe(""),Ne(!1)}})),Te={bg:"#F8F8F8",bgSubtle:"#F0F0F0",bgElevated:"#FFFFFF",bgInput:"#FFFFFF",border:"rgba(0, 0, 0, 0.12)",borderStrong:"rgba(0, 0, 0, 0.20)",borderFocus:"#3B82F6",text:"#1A1A1A",textSecondary:"#4A4A4A",textMuted:"#737373",success:"#059669",successBg:"#ECFDF5",successBorder:"#A7F3D0",error:"#DC2626",errorBg:"#FEF2F2",errorBorder:"#FECACA",info:"#2563EB",infoBg:"#EFF6FF",infoBorder:"#BFDBFE",warning:"#D97706",warningBg:"#FFFBEB",warningBorder:"#FDE68A",primary:"#F59E0B",hoverBg:"rgba(0, 0, 0, 0.04)",sliderTrack:"#E5E7EB",sliderThumb:"#F59E0B"},Le={bg:"var(--surface)",bgSubtle:"var(--subtle)",bgElevated:"var(--elevated)",bgInput:"var(--subtle)",border:"var(--edge-subtle)",borderStrong:"var(--edge-strong)",borderFocus:"var(--sys-blue)",text:"var(--fg-primary)",textSecondary:"var(--fg-secondary)",textMuted:"var(--fg-muted)",success:"var(--sys-green)",successBg:"rgba(74, 222, 128, 0.1)",successBorder:"rgba(74, 222, 128, 0.3)",error:"var(--sys-red)",errorBg:"rgba(239, 68, 68, 0.1)",errorBorder:"rgba(239, 68, 68, 0.3)",info:"var(--sys-indigo)",infoBg:"rgba(249, 210, 111, 0.1)",infoBorder:"rgba(249, 210, 111, 0.3)",warning:"var(--sys-indigo)",warningBg:"rgba(249, 210, 111, 0.1)",warningBorder:"rgba(249, 210, 111, 0.3)",primary:"var(--sys-indigo)",hoverBg:"var(--hover-tint)",sliderTrack:"var(--elevated)",sliderThumb:"var(--sys-indigo)"},Re=A.createContext({theme:Le,isLight:!1});function Ie(){return A.useContext(Re)}function _e({status:t,hasData:r}){const{theme:n,isLight:o}=Ie(),i=A.useMemo(()=>"connecting"===t||"loading"===t||"processing"===t?{icon:e.jsx(F,{className:"w-3.5 h-3.5 animate-spin"}),label:"connecting"===t?"Connecting...":"loading"===t?"Loading...":"Processing...",color:n.warning,bg:n.warningBg}:"error"===t?{icon:e.jsx(KA,{className:"w-3.5 h-3.5"}),label:"Disconnected",color:n.error,bg:n.errorBg}:r?{icon:e.jsx(SA,{className:"w-3.5 h-3.5"}),label:"Connected",color:n.success,bg:n.successBg}:{icon:e.jsx(T,{className:"w-3.5 h-3.5"}),label:"Ready",color:n.textMuted,bg:o?"rgba(0,0,0,0.04)":"rgba(255,255,255,0.04)"},[t,r,n,o]);return e.jsxs(B.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"flex items-center gap-1.5 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:i.bg,color:i.color},children:[i.icon,e.jsx("span",{children:i.label})]},i.label)}function ze({status:t}){const{theme:r}=Ie(),n=A.useMemo(()=>{switch(t){case"connecting":return 25;case"loading":return 60;case"processing":return 90;default:return 0}},[t]);return 0===n?null:e.jsx(B.div,{initial:{opacity:0,scaleY:0},animate:{opacity:1,scaleY:1},exit:{opacity:0,scaleY:0},className:"h-1 rounded-full overflow-hidden origin-top",style:{backgroundColor:r.sliderTrack},children:e.jsx(B.div,{className:"h-full rounded-full",style:{backgroundColor:r.primary},initial:{width:0},animate:{width:`${n}%`},transition:{duration:.4,ease:"easeOut"}})})}function He({variant:t,title:r,description:n,onDismiss:o}){const{theme:i}=Ie(),a=A.useMemo(()=>{switch(t){case"success":return{icon:e.jsx(I,{className:"w-4 h-4"}),color:i.success,bg:i.successBg,border:i.successBorder};case"error":return{icon:e.jsx(UA,{className:"w-4 h-4"}),color:i.error,bg:i.errorBg,border:i.errorBorder};case"info":return{icon:e.jsx(YA,{className:"w-4 h-4"}),color:i.info,bg:i.infoBg,border:i.infoBorder}}},[t,i]);return e.jsxs(B.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:E.snappy,className:"flex items-start gap-3 p-3 rounded-lg border",style:{backgroundColor:a.bg,borderColor:a.border,color:a.color},children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:r}),n&&e.jsx("p",{className:"text-xs mt-0.5 opacity-80",children:n})]}),o&&e.jsx("button",{onClick:o,className:"flex-shrink-0 p-1 rounded hover:bg-black/10 transition-colors","aria-label":"Dismiss",children:e.jsx(L,{className:"w-3.5 h-3.5"})})]})}function Ge({value:r,onChange:n,onSubmit:o,disabled:i}){const{theme:a,isLight:s}=Ie(),[l,c]=A.useState(!1);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"block text-sm font-medium",style:{color:a.textSecondary},children:"Coverage Server URL"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"url",value:r,onChange:A=>n(A.target.value),onKeyDown:A=>{"Enter"!==A.key||A.shiftKey||i||(A.preventDefault(),o())},onFocus:()=>c(!0),onBlur:()=>c(!1),placeholder:"https://coverage.wcmesh.com",disabled:i,className:t("w-full pl-3 pr-10 py-2.5 rounded-lg border text-sm transition-all duration-150","focus:outline-none",i&&"opacity-50 cursor-not-allowed"),style:{backgroundColor:a.bgInput,borderColor:l?a.borderFocus:a.border,color:a.text,boxShadow:l?"0 0 0 3px "+(s?"rgba(59, 130, 246, 0.15)":"rgba(139, 92, 246, 0.15)"):"none"}}),r&&!i&&e.jsx("button",{onClick:()=>n(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 p-1 rounded transition-colors",style:{color:a.textMuted},onMouseEnter:A=>A.currentTarget.style.color=a.text,onMouseLeave:A=>A.currentTarget.style.color=a.textMuted,"aria-label":"Clear URL",children:e.jsx(L,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs",style:{color:a.textMuted},children:"Press Enter to connect, or use the Connect button below"})]})}function Oe({value:A,onChange:r}){const{theme:n,isLight:o}=Ie(),i=Math.round(100*A);return e.jsx(B.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:E.gentle,className:"overflow-hidden",children:e.jsx("div",{className:"p-3 rounded-lg border",style:{backgroundColor:n.bgSubtle,borderColor:n.border},children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative w-4 h-4",children:[e.jsx(vA,{className:"w-4 h-4 absolute inset-0 transition-opacity",style:{color:n.textMuted,opacity:A<.5?1:0}}),e.jsx(pA,{className:"w-4 h-4 absolute inset-0 transition-opacity",style:{color:n.primary,opacity:A>=.5?1:0}})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs font-medium",style:{color:n.textSecondary},children:"Layer Opacity"}),e.jsxs("span",{className:"text-xs font-mono tabular-nums px-1.5 py-0.5 rounded",style:{color:n.text,backgroundColor:o?"rgba(0,0,0,0.06)":"rgba(255,255,255,0.06)"},children:[i,"%"]})]}),e.jsx("input",{type:"range",min:5,max:100,value:i,onChange:A=>r(Number(A.target.value)/100),className:t("w-full h-2 rounded-full appearance-none cursor-pointer","[&::-webkit-slider-thumb]:appearance-none","[&::-webkit-slider-thumb]:w-4","[&::-webkit-slider-thumb]:h-4","[&::-webkit-slider-thumb]:rounded-full","[&::-webkit-slider-thumb]:cursor-pointer","[&::-webkit-slider-thumb]:transition-transform","[&::-webkit-slider-thumb]:hover:scale-110","[&::-webkit-slider-thumb]:shadow-lg","[&::-moz-range-thumb]:appearance-none","[&::-moz-range-thumb]:w-4","[&::-moz-range-thumb]:h-4","[&::-moz-range-thumb]:rounded-full","[&::-moz-range-thumb]:border-0","[&::-moz-range-thumb]:cursor-pointer"),style:{background:`linear-gradient(to right, ${n.primary} ${i}%, ${n.sliderTrack} ${i}%)`,"--thumb-color":n.sliderThumb}}),e.jsx("style",{children:`\n input[type="range"]::-webkit-slider-thumb {\n background-color: ${n.sliderThumb};\n }\n input[type="range"]::-moz-range-thumb {\n background-color: ${n.sliderThumb};\n }\n `})]})]})})})}function Ue({coverageCount:A,repeaterCount:t,lastUpdated:r}){const{theme:n}=Ie();return e.jsxs("div",{className:"grid grid-cols-3 gap-2 p-3 rounded-lg border",style:{backgroundColor:n.bgSubtle,borderColor:n.border},children:[e.jsxs("div",{className:"text-center",children:[e.jsx(hA,{value:A,format:{useGrouping:!0,maximumFractionDigits:0},className:"text-lg font-semibold tabular-nums block",style:{color:n.text}}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:n.textMuted},children:"Points"})]}),e.jsxs("div",{className:"text-center border-x",style:{borderColor:n.border},children:[e.jsx(hA,{value:t,format:{useGrouping:!0,maximumFractionDigits:0},className:"text-lg font-semibold tabular-nums block",style:{color:n.text}}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:n.textMuted},children:"Repeaters"})]}),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[e.jsx(_,{className:"w-3.5 h-3.5",style:{color:n.textMuted}}),e.jsx("span",{className:"text-lg font-semibold tabular-nums",style:{color:n.text},children:r?r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"—"})]}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:n.textMuted},children:"Updated"})]})]})}function Ye({icon:r,label:n,onClick:o,disabled:i,variant:a="default",active:s}){const{theme:l,isLight:c}=Ie(),u=A.useMemo(()=>"danger"===a?{text:l.error,hoverBg:c?"rgba(220, 38, 38, 0.08)":"rgba(239, 68, 68, 0.15)"}:{text:s?l.primary:l.textSecondary,hoverBg:l.hoverBg},[a,s,l,c]);return e.jsxs("button",{onClick:o,disabled:i,className:t("flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-sm font-medium transition-colors",i&&"opacity-50 cursor-not-allowed"),style:{color:u.text},onMouseEnter:A=>!i&&(A.currentTarget.style.backgroundColor=u.hoverBg),onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:[r,e.jsx("span",{children:n})]})}function We(){const t=n(),r="light"===t,o=r?Te:Le,{isModalOpen:i,closeModal:a,status:s,isVisible:l,stats:c,error:u,url:d,brightness:f,loadCoverage:g,clearCoverage:h,toggleVisibility:m,setUrl:b,setBrightness:p}=Pe(),v="connecting"===s||"loading"===s||"processing"===s,y=c.coverageCount>0,[w,x]=A.useState(!0),[k,C]=A.useState(d);A.useEffect(()=>{C(d)},[d]),A.useEffect(()=>{"error"===s&&x(!0)},[s]);const M=A.useCallback(async()=>{await g(k)},[k,g]),Q=A.useCallback(()=>{C(""),h()},[h]),N=A.useCallback(A=>{C(A),b(A)},[b]),S=A.useCallback(()=>{v||a()},[v,a]),I=k.trim().length>0&&!v;return e.jsx(Re.Provider,{value:{theme:o,isLight:r},children:e.jsxs(P,{open:i,onClose:S,size:"md",bottomSheet:!0,basemapMode:t,children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",style:{borderColor:o.border},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg",style:{backgroundColor:o.bgSubtle,color:o.primary},children:e.jsx(T,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"type-micro",style:{color:o.text},children:"Wardriving Coverage"}),e.jsx("p",{className:"text-xs",style:{color:o.textMuted},children:"RF coverage heatmap overlay"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_e,{status:s,hasData:y}),!v&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:S,className:"sm:hidden min-h-[44px] min-w-[44px] px-3 flex items-center justify-center text-[15px] font-medium transition-base radius-inner active:bg-subtle-fill",style:{color:o.primary},children:"Done"}),e.jsx("button",{onClick:S,className:"hidden sm:flex items-center justify-center p-2 rounded-lg transition-colors",style:{color:o.textMuted},onMouseEnter:A=>{A.currentTarget.style.color=o.text,A.currentTarget.style.backgroundColor=o.hoverBg},onMouseLeave:A=>{A.currentTarget.style.color=o.textMuted,A.currentTarget.style.backgroundColor="transparent"},"aria-label":"Close",children:e.jsx(L,{className:"w-5 h-5"})})]})]})]}),e.jsx(D,{children:v&&e.jsx(ze,{status:s})}),e.jsxs(R,{className:"space-y-4",children:[e.jsx(Ge,{value:k,onChange:N,onSubmit:M,disabled:v}),e.jsx(D,{children:"error"===s&&u&&w&&e.jsx(He,{variant:"error",title:"Connection Failed",description:u,onDismiss:()=>x(!1)})}),e.jsx(D,{children:"success"===s&&y&&e.jsx(He,{variant:"success",title:"Coverage Data Loaded",description:"Adjust opacity below, then close to view on map"})}),e.jsx(D,{children:y&&!v&&e.jsx(B.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},transition:E.snappy,children:e.jsx(Ue,{coverageCount:c.coverageCount,repeaterCount:c.repeaterCount,lastUpdated:c.lastUpdated})})}),e.jsx(D,{children:y&&!v&&e.jsx(Oe,{value:f,onChange:p})})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 border-t",style:{borderColor:o.border},children:[e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(D,{children:y&&e.jsxs(B.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},transition:E.snappy,className:"flex items-center gap-1",children:[e.jsx(Ye,{icon:l?e.jsx(iA,{className:"w-4 h-4"}):e.jsx(bA,{className:"w-4 h-4"}),label:l?"Hide":"Show",onClick:m,disabled:v,active:l}),e.jsx(Ye,{icon:e.jsx(tA,{className:"w-4 h-4"}),label:"Clear",onClick:Q,disabled:v,variant:"danger"})]})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{plain:!0,color:"muted",onClick:S,disabled:v,children:y?"Done":"Cancel"}),e.jsx(j,{color:"warning",onClick:M,disabled:!I,children:v?e.jsxs(e.Fragment,{children:[e.jsx(F,{"data-slot":"icon",className:"animate-spin"}),"connecting"===s?"Connecting...":"loading"===s?"Loading...":"Processing..."]}):y?e.jsxs(e.Fragment,{children:[e.jsx(mA,{"data-slot":"icon"}),"Refresh"]}):e.jsxs(e.Fragment,{children:[e.jsx(QA,{"data-slot":"icon"}),"Connect"]})})]})]})]})})}const Ve={bandwidth:.07,threshold:.1,opacity:1,strokeWidth:4.5},Ze={...qA,trackBg:qA.border};function Ke({label:A,value:t,min:r,max:n,step:o,unit:i,formatValue:a,onChange:s,isLightMode:l}){const c=a?a(t):t.toFixed(2);return e.jsxs("div",{className:"flex items-center gap-2 sm:gap-2",children:[e.jsx("span",{className:"text-xs font-medium w-14 sm:w-16 flex-shrink-0",style:l?{color:Ze.textSecondary}:{color:"var(--fg-secondary)"},children:A}),e.jsx("input",{type:"range",min:r,max:n,step:o,value:t,onChange:A=>s(parseFloat(A.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer\n [&::-webkit-slider-thumb]:appearance-none\n [&::-webkit-slider-thumb]:w-3.5\n [&::-webkit-slider-thumb]:h-3.5\n [&::-webkit-slider-thumb]:rounded-full\n [&::-webkit-slider-thumb]:bg-sys-indigo\n [&::-webkit-slider-thumb]:cursor-pointer\n [&::-webkit-slider-thumb]:transition-transform\n [&::-webkit-slider-thumb]:hover:scale-110\n [&::-webkit-slider-thumb]:shadow-md",style:l?{backgroundColor:Ze.trackBg}:{backgroundColor:"var(--elevated)"}}),e.jsxs("span",{className:"text-xs font-mono tabular-nums w-12 sm:w-14 text-right flex-shrink-0",style:l?{color:Ze.textPrimary}:{color:"var(--fg-muted)"},children:[c,i&&e.jsx("span",{className:"ml-0.5 opacity-70",style:l?{color:Ze.textMuted}:void 0,children:i})]})]})}function Je({icon:A,label:t,value:r,subtext:n,isLightMode:o}){return e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 py-0.5 sm:py-1",children:[e.jsx("div",{style:o?{color:Ze.textMuted}:{color:"var(--fg-muted)"},children:A}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("div",{className:"text-[10px] sm:text-xs truncate",style:o?{color:Ze.textSecondary}:{color:"var(--fg-secondary)"},children:t})}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-xs font-mono tabular-nums",style:o?{color:Ze.textPrimary}:{color:"var(--fg-primary)"},children:r}),n&&e.jsx("div",{className:"text-[9px] leading-tight opacity-70",style:o?{color:Ze.textMuted}:{color:"var(--fg-muted)"},children:n})]})]})}function Xe({visible:t,onClose:r,settings:n,onSettingsChange:o,partition:i,totalNodes:a,basemapMode:s="dark"}){const l=aA(),c=A.useRef(null),u="light"===s,d=A.useMemo(()=>{if(!i)return{numCommunities:0,avgCommunitySize:0,minCommunitySize:0,maxCommunitySize:0,fiedlerValue:0,modularity:0,coveragePercent:0};const A=Array.from(i.communities.values()).map(A=>A.length),e=A.reduce((A,e)=>A+e,0);return{numCommunities:i.numCommunities,avgCommunitySize:A.length>0?Math.round(e/A.length):0,minCommunitySize:A.length>0?Math.min(...A):0,maxCommunitySize:A.length>0?Math.max(...A):0,fiedlerValue:i.fiedlerValue,modularity:0,coveragePercent:a>0?Math.round(e/a*100):0}},[i,a]),f=(A,e)=>{o({...n,[A]:e})},g=(111*n.bandwidth).toFixed(1);return e.jsx("div",{ref:c,className:"absolute inset-0 z-[600] pointer-events-none",children:e.jsx(D,{children:t&&e.jsx(B.div,{drag:!0,dragControls:l,dragConstraints:c,dragElastic:.1,dragMomentum:!1,initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:E.smooth,className:"\n absolute pointer-events-auto\n /* Mobile: bottom sheet style, full width with margins */\n bottom-2 left-2 right-2\n /* sm+: floating panel in bottom-right */\n sm:bottom-16 sm:left-auto sm:right-3 sm:w-64\n /* md+: slightly wider */\n md:w-72\n ",style:{touchAction:"none"},children:e.jsxs("div",{className:"\n map-control-surface rounded-lg overflow-hidden shadow-lg\n /* Mobile: limit height, allow scroll */\n max-h-[45vh] sm:max-h-[calc(100vh-180px)] overflow-y-auto\n /* iOS momentum scrolling */\n overscroll-contain\n ",children:[e.jsxs("div",{className:"\n flex items-center justify-between \n px-3 py-2 sm:px-2.5 sm:py-1.5 \n border-b \n cursor-grab active:cursor-grabbing\n /* Larger touch target on mobile */\n min-h-[44px] sm:min-h-0\n ",style:u?{borderColor:Ze.border}:void 0,onPointerDown:A=>l.start(A),children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-1.5",children:[e.jsx(sA,{className:"w-4 h-4 sm:w-3 sm:h-3",style:u?{color:Ze.textMuted}:void 0}),e.jsx(OA,{className:"w-4 h-4 sm:w-3.5 sm:h-3.5 text-sys-blue"}),e.jsx("span",{className:"text-sm sm:text-xs font-medium",style:u?{color:Ze.textPrimary}:void 0,children:"Partition"})]}),e.jsx(j,{plain:!0,color:"muted",onClick:r,className:"!p-1.5 sm:!p-0.5 !rounded min-w-[44px] min-h-[44px] sm:min-w-0 sm:min-h-0 flex items-center justify-center","aria-label":"Close toolbox",children:e.jsx(L,{className:"w-4 h-4 sm:w-3 sm:h-3"})})]}),e.jsx("div",{className:"px-3 py-2 sm:px-2.5 sm:py-1.5 border-b",style:u?{borderColor:Ze.border}:void 0,children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 sm:gap-x-3 gap-y-1 sm:gap-y-0.5",children:[e.jsx(Je,{icon:e.jsx(OA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Communities",value:d.numCommunities,isLightMode:u}),e.jsx(Je,{icon:e.jsx(FA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Avg Size",value:d.avgCommunitySize,subtext:`${d.minCommunitySize}–${d.maxCommunitySize}`,isLightMode:u}),e.jsx(Je,{icon:e.jsx(VA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Fiedler λ₂",value:d.fiedlerValue.toFixed(3),isLightMode:u}),e.jsx(Je,{icon:e.jsx(FA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Coverage",value:`${d.coveragePercent}%`,subtext:`of ${a}`,isLightMode:u})]})}),e.jsx("div",{className:"px-3 py-2 sm:px-2.5 sm:py-1.5",children:e.jsxs("div",{className:"space-y-3 sm:space-y-1.5",children:[e.jsx(Ke,{label:"Bandwidth",value:n.bandwidth,min:.01,max:.15,step:.005,formatValue:()=>g,unit:"km",onChange:A=>f("bandwidth",A),isLightMode:u}),e.jsx(Ke,{label:"Threshold",value:n.threshold,min:.05,max:.5,step:.01,formatValue:A=>`${Math.round(100*(1-A))}%`,unit:"cov",onChange:A=>f("threshold",A),isLightMode:u}),e.jsx(Ke,{label:"Opacity",value:n.opacity,min:.1,max:1,step:.05,formatValue:A=>`${Math.round(100*A)}%`,onChange:A=>f("opacity",A),isLightMode:u}),e.jsx(Ke,{label:"Stroke",value:n.strokeWidth,min:0,max:5,step:.5,unit:"px",formatValue:A=>A.toFixed(1),onChange:A=>f("strokeWidth",A),isLightMode:u})]})})]})})})})}const qe={getItem:A=>{try{return localStorage.getItem(A)}catch{return null}},setItem:(A,e)=>{try{localStorage.setItem(A,e)}catch{}},removeItem:A=>{try{localStorage.removeItem(A)}catch{}}},$e=DA()(EA(A=>({isEnabled:!1,toggle:()=>A(A=>({isEnabled:!A.isEnabled})),setEnabled:e=>A({isEnabled:e})}),{name:"pymc-live-trace",storage:jA(()=>qe)}));var At=function(A){var e,t=void 0!==(A=A||{})?A:{},r={};for(e in t)t.hasOwnProperty(e)&&(r[e]=t[e]);var n,o="";"undefined"!=typeof document&&document.currentScript&&(o=document.currentScript.src),o=0!==o.indexOf("blob:")?o.substr(0,o.lastIndexOf("/")+1):"",n=function(A,e,t){var r=new XMLHttpRequest;r.open("GET",A,!0),r.responseType="arraybuffer",r.onload=function(){if(200==r.status||0==r.status&&r.response)e(r.response);else{var n=O(A);n?e(n.buffer):t()}},r.onerror=t,r.send(null)};var i=t.print||function(){}.bind(),a=t.printErr||function(){}.bind();for(e in r)r.hasOwnProperty(e)&&(t[e]=r[e]);r=null,t.arguments&&t.arguments;var s=0,l=!1;function c(A){var e=t["_"+A];return e||tA("Assertion failed: "+("Cannot call unknown function "+A+", make sure it is exported")),e}var u,d,f,g,h,m,b,p="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function v(A,e){return A?function(A,e,t){for(var r=e+t,n=e;A[n]&&!(n>=r);)++n;if(n-e>16&&A.subarray&&p)return p.decode(A.subarray(e,n));for(var o="";e>10,56320|1023&l)}}else o+=String.fromCharCode((31&i)<<6|a)}else o+=String.fromCharCode(i)}return o}(f,A,e):""}function y(A,e){return A%e>0&&(A+=e-A%e),A}function w(A){u=A,t.HEAP8=d=new Int8Array(A),t.HEAP16=g=new Int16Array(A),t.HEAP32=h=new Int32Array(A),t.HEAPU8=f=new Uint8Array(A),t.HEAPU16=new Uint16Array(A),t.HEAPU32=new Uint32Array(A),t.HEAPF32=m=new Float32Array(A),t.HEAPF64=b=new Float64Array(A)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var x=t.TOTAL_MEMORY||33554432;function k(A){for(;A.length>0;){var e=A.shift();if("function"!=typeof e){var r=e.func;"number"==typeof r?void 0===e.arg?t.dynCall_v(r):t.dynCall_vi(r,e.arg):r(void 0===e.arg?null:e.arg)}else e()}}x=(u=t.buffer?t.buffer:new ArrayBuffer(x)).byteLength,w(u),h[7156]=5271536;var C=[],B=[],M=[],D=[];function E(A){C.unshift(A)}function j(A){D.unshift(A)}var Q=Math.abs,N=Math.ceil,S=Math.floor,F=Math.min,P=0,T=null;t.preloadedImages={},t.preloadedAudios={};var L,R,I=null,_="data:application/octet-stream;base64,";function z(A){return String.prototype.startsWith?A.startsWith(_):0===A.indexOf(_)}function H(){return d.length}I="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAH6iBfbytuk/Gq6akm/58z/Xrm0Liez0P5doSdOpSwRAWs602ULg8D/dT7Rcbo/1v1N1RQHFNOM/g9Snx7HW3L8HWsP8Q3jfP6VwOLosutk/9rjk1YQcxj+gnmKMsNn6P/HDeuPFY+M/YHwDjqKhB0Ci19/fCVrbP4UxKkDWOP6/pvljWa09tL9wi7wrQXjnv/Z6yLImkM2/3yTlOzY14D+m+WNZrT20PzwKVQnrQwNA9nrIsiaQzT/g40rFrRQFwPa45NWEHMa/kbslHEZq97/xw3rjxWPjv4cLC2SMBci/otff3wla27+rKF5oIAv0P1N1RQHFNOO/iDJPGyWHBUAHWsP8Q3jfvwQf/by16gXAfqIF9vK26b8XrO0Vh0r+v9eubQuJ7PS/BxLrA0ZZ479azrTZQuDwv1MK1EuItPw/yscgV9Z6FkAwHBR2WjQMQJNRzXsQ5vY/GlUHVJYKF0DONuFv2lMNQNCGZ28QJfk/0WUwoIL36D8ggDOMQuATQNqMOeAy/wZAWFYOYM+M2z/LWC4uH3oSQDE+LyTsMgRAkJzhRGWFGEDd4soovCQQQKqk0DJMEP8/rGmNdwOLBUAW2X/9xCbjP4hu3dcqJhNAzuYItRvdB0CgzW3zJW/sPxotm/Y2TxRAQAk9XmdDDEC1Kx9MKgT3P1M+NctcghZAFVqcLlb0C0Bgzd3sB2b2P77mZDPUWhZAFROHJpUGCEDAfma5CxXtPz1DWq/zYxRAmhYY5824F0DOuQKWSbAOQNCMqrvu3fs/L6DR22K2wT9nAAxPBU8RQGiN6mW43AFAZhu25b633D8c1YgmzowSQNM25BRKWARArGS08/lNxD+LFssHwmMRQLC5aNcxBgJABL9HT0WRF0CjCmJmOGEOQHsuaVzMP/s/TWJCaGGwBUCeu1PAPLzjP9nqN9DZOBNAKE4JcydbCkCGtbd1qjPzP8dgm9U8jhVAtPeKTkVwDkCeCLss5l37P401XMPLmBdAFd29VMVQDUBg0yA55h75Pz6odcYLCRdApBM4rBrkAkDyAVWgQxbRP4XDMnK20hFAymLlF7EmzD8GUgo9XBHlP3lbK7T9COc/k+OhPthhy7+YGEpnrOvCPzBFhLs15u4/epbqB6H4uz9IuuLF5svev6lzLKY31es/CaQ0envF5z8ZY0xlUADXv7zaz7HYEuI/CfbK1sn16T8uAQfWwxLWPzKn/YuFN94/5KdbC1AFu793fyCSnlfvPzK2y4doAMY/NRg5t1/X6b/shq4QJaHDP5yNIAKPOeI/vpn7BSE30r/X4YQrO6nrv78Ziv/Thto/DqJ1Y6+y5z9l51NaxFrlv8QlA65HOLS/86dxiEc96z+Hj0+LFjneP6LzBZ8LTc2/DaJ1Y6+y579l51NaxFrlP8QlA65HOLQ/8qdxiEc967+Jj0+LFjnev6LzBZ8LTc0/1qdbC1AFuz93fyCSnlfvvzK2y4doAMa/NRg5t1/X6T/vhq4QJaHDv5yNIAKPOeK/wJn7BSE30j/W4YQrO6nrP78Ziv/Thtq/CaQ0envF578XY0xlUADXP7zaz7HYEuK/CvbK1sn16b8rAQfWwxLWvzKn/YuFN96/zWLlF7EmzL8GUgo9XBHlv3lbK7T9COe/kOOhPthhyz+cGEpnrOvCvzBFhLs15u6/c5bqB6H4u79IuuLF5sveP6lzLKY31eu/AQAAAP////8HAAAA/////zEAAAD/////VwEAAP////9hCQAA/////6dBAAD/////kcsBAP/////3kAwA/////8H2VwAAAAAAAAAAAAAAAAACAAAA/////w4AAAD/////YgAAAP////+uAgAA/////8ISAAD/////ToMAAP////8ilwMA/////+4hGQD/////gu2vAAAAAAAAAAAAAAAAAAAAAAACAAAA//////////8BAAAAAwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////AgAAAP//////////AQAAAAAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD/////////////////////AQAAAP///////////////wIAAAD///////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP///////////////////////////////wIAAAD///////////////8BAAAA/////////////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAABAAAA//////////8CAAAA//////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAAAQAAAP//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAAAAgAAAAIAAAADAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAACAAAAAQAAAAMAAAACAAAAAgAAAAAAAAAFAAAABwAAAAAAAAACAAAAAgAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAAAAAAIAAAABAAAABAAAAAIAAAACAAAAAAAAAAUAAAAIAAAAAAAAAAIAAAACAAAAAwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAAAAAAAAgAAAAIAAAAAAAAABQAAAAkAAAAAAAAAAgAAAAIAAAADAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAIAAAAAAAAAAwAAAA4AAAACAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAgAAAAMAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAgAAAAAAAAADAAAACgAAAAIAAAAAAAAAAgAAAAMAAAABAAAAAAAAAAIAAAACAAAAAwAAAAcAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAACAAAAAAAAAAMAAAALAAAAAgAAAAAAAAACAAAAAwAAAAIAAAAAAAAAAgAAAAIAAAADAAAACAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAIAAAAAAAAAAwAAAAwAAAACAAAAAAAAAAIAAAADAAAAAwAAAAAAAAACAAAAAgAAAAMAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAACAAAAAgAAAAAAAAADAAAADQAAAAIAAAAAAAAAAgAAAAMAAAAEAAAAAAAAAAIAAAACAAAAAwAAAAoAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAIAAAACAAAAAAAAAAMAAAAGAAAAAgAAAAAAAAACAAAAAwAAAA8AAAAAAAAAAgAAAAIAAAADAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAIAAAAAAAAAAwAAAAcAAAACAAAAAAAAAAIAAAADAAAAEAAAAAAAAAACAAAAAgAAAAMAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAACAAAAAgAAAAAAAAADAAAACAAAAAIAAAAAAAAAAgAAAAMAAAARAAAAAAAAAAIAAAACAAAAAwAAAA0AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAACAAAAAAAAAAMAAAAJAAAAAgAAAAAAAAACAAAAAwAAABIAAAAAAAAAAgAAAAIAAAADAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAgAAAAIAAAAAAAAAAwAAAAUAAAACAAAAAAAAAAIAAAADAAAAEwAAAAAAAAACAAAAAgAAAAMAAAAPAAAAAAAAAAAAAAAAAAAAAAAAABAAAAACAAAAAAAAAAIAAAABAAAAEwAAAAIAAAACAAAAAAAAAAUAAAAKAAAAAAAAAAIAAAACAAAAAwAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAIAAAAAAAAAAgAAAAEAAAAPAAAAAgAAAAIAAAAAAAAABQAAAAsAAAAAAAAAAgAAAAIAAAADAAAAEQAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAgAAAAAAAAACAAAAAQAAABAAAAACAAAAAgAAAAAAAAAFAAAADAAAAAAAAAACAAAAAgAAAAMAAAASAAAAAAAAAAAAAAAAAAAAAAAAABMAAAACAAAAAAAAAAIAAAABAAAAEQAAAAIAAAACAAAAAAAAAAUAAAANAAAAAAAAAAIAAAACAAAAAwAAABMAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAIAAAAAAAAAAgAAAAEAAAASAAAAAgAAAAIAAAAAAAAABQAAAA4AAAAAAAAAAgAAAAIAAAADAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAAAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAEAAAAAAQAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAA6B6FaUp9QQTPXMuL4myJBraiDfBwx9UBYJseitzTIQOL5if9jqZtAnXX+Z+ycb0C3pucbhRBCQG8wJBYqpRRAlWbDCzCY5z/eFWBUEve6P/+qo4Q50Y4/D9YM3iCcYT8fcA2QJSA0P4ADxu0qAAc/BNcGolVJ2j5d9FACqwquPh9z7MthtI9CSUSYJke/YUJQ/64OyjU0Qpi0+HCmFQdCm3GfIVdh2kHsJ11kAyauQYC3UDFJOoFBSJsFV1OwU0FK5fcxX4AmQWhy/zZIt/lACqaCPsBjzUDbdUNIScugQMYQlVJ4MXNANiuq8GTvRUDxTXnulxEZQFZ8QX5kpuw/qmG/JwYFlEAluh3Q6DB+QKn4vyNq0GZAKOXekas+UUB8xabXXhI6QG63C2pLtSNAdDBtyNfLDUDyOcu67ID2P0rCMvRXAeE/Ki2TSVyzyT9Dk+8Sz2uzP5J+w5ARWp0/NQAoOiMuhj9YnP+RyMJwPxgW7TvQVFk/KgsLYF0kQz9g5dAC6IwzQcgHPVvDex1B1XjppodHBkHJq3OMM9fwQNvcmJ7wddlAInGPpQs/w0BRobq5EBmtQJZ2ai7n+ZVAtv2G5E+bgECG+gIfKBlpQK5f8jdI91JAL39sL/WpPEB8rGxhDqklQK6yUf43XhBAxL9y/tK8+D86XyZpgrHiPwAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAP////8AAAAAAAAAAAAAAAABAAAAAAAAAAAAAAD/////AAAAAAAAAAABAAAAAQAAAAAAAAAAAAAA/////wAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8FAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQAAAAAAAQABAAABAQAAAAAAAQAAAAEAAAABAAEAAAAAAAAAAAAAAAAAAAAAquJYWJZl+D9jaeZNtj/zPwwdI9KqaeO/qGefXwdHdz+q4lhYlmX4P+OrlPMN3PI/DB0j0qpp47+7SQLV4VIEQKriWFiWZfg/r2kma3tz8T82eQmLqNIGwMRIWXMqSvo/fcCszPux9j+jara6ozTwP6hnn18HR3c/MSoKLequ8r+SabgA2nj0P7jBLbDOHO8/1Ym/ICfH4T+6lxjvlFXHv73m373LRPU/0vXyDVxo7T+ToKRHJXMAQF/33578aPE/pAyy64tD9T8+U/hCvyruPwxv8Y7YYwLAuXYr8NAiCEB4+LDK0Sn0P1Qeuy4j+eo/OMx50n7K7L+TrGB/nyf8v5ehC2fbYPM/aXMKexiT6z8mFRIMjg/zP7yUVwGGBNw/E6opHERf8z/z0wR2g9DqPw4pBpcOhvu/NbA29uWAA8DMaTExyXzyP02biiQ+Ruk/S8jz2/FKBEB1pzZnpbb9P7pQU4wLfPI//7ZcQXeG6D9CqEQvAYoIwDB2VB6sSgRAVyv8H5We8T+EHWF8XNPmPzB2wT8Nrrg/SEi+cX+w4L8of+GtdSDxP1sjk5AdouU/6ZjOVru13r8K0obqI6bxvwVbdNXyhfA/w5GG024n5z+rwmtMzP8BwLw9pSX49QXABe/2uQxP8D+b6wCzCvXkP7uGT87fK+Q/pz/JWw4coj+qoBf2J0nwP/yE3PUo0+I/vFJeHcaC+D96luSIqvntP/bf8sHUYu8/gZNN41mL4z9bhOqVOF4FwO6lmAh1hQhAbCVxbdhk7z+1C8NdDcfiPwG36x/0OQBAx0WJ76c2+D9nlSHXANfuP2HlfZ3gqOE/EwnVlVPg9r96+oHzEH//v5bXzdT1Auw/DM3GwLsA4D9p/8uoKcr+v+U9x5DQVAPAehjSdghb7D9sc1IetODgP8MVwwB1pu6/azPk6OGe978W8t/TUc3rP+0QMvYfP+A/RsG/QpSE8D+l3uwScxzgPwQaifgujuw/k1Vti1I43z8MAwLnSh0GQH5nYnwwZgJAiGUzWC5s6j8WyyI/BbLgPw4iUapGeQJAB3W+imnp/j9BLWR4ssrpP2t+gG5Pstk/cpBsfm6DCMCOpU9dOZsFQEv8nFypHeo/ehJ6i+6S2D9jqlGEmarLv7STC5TRiOa/bC+x8WZD6D9H3yUkWpDZP8gZvmCMuQLAreY19/eRBsCoPOc8UzzpP6KI/QV+y9g/t/MoboyWzT+Hv5q3Zu3Mvy2xROCT4uY/9gQitMMg1T9abAqhWMDkv1oLTavoUfG/PMUJP9CD5j+fHRX3t6fSPz7W2gk6bvs/WRnuHwqN9D8YFturGCTmP1EZczv0b9I/5t4exabB5D/1ESLh5fTEP9X2z6SYweQ/6lv3I2zT0D9zkRGNUNMAQKoSvc4EIfs/Xggt8wQI5T+mJHHg/w/SP4lhT/9t8vQ/DrZ/DbwH7D+XlhbYZrjkP34LIpFt6c4/lwfp8fLX9L+j96CTTf76v3WdNhEv9uM/d8c3o4lV0D/vFdCHVcsFwAHeDq0F1QhApbYqcZiN5D9KoilqByXLPwX0/diA0vq/0fo0GxnxAMBbaTkvlCzjP/RrFrWXrMs/UYTrky7jA0DB9f4FiZYAQEGAk/3QzeE/r/TeqE8t0D/OqjlsnPbvvz8RKU8JOfW/smSEbK/O4T8MzuyPm3DDP/rFtctq9gZAfb1EVEaSA0Dts5dVInnhP18SFMc79MM/7y34cw6LAMDFrRJsZO0DwC2KLvLSYuA/hx5wcUHewz+49SnK/4ruPyeS0PX9a+E/ZxaaLvvZ3z8WPu5T2QS8Pygo4RIvMqa/BJ0Kqsd0279cKW4ay8jdP3b05bmZ364/10/qtdxk2r+Bcz6CDMvpv54qOw+Amdw/qLV71pW7sT/YKc80nIPUP8OfIaBJ77G/LyTuD1un2z+diYu8efWzP1wU7ACkfwjAZroyPL1yBkAmv3lKJJbbPysKSE4W+p0/dIgqY79TA8ATLTOQ3tsGwJ2zweD/Xdg/XO/jXeFUaL8VW2qLFKfov1cA9Aa6XfK/tIa7YGgI2T+f3hu/sxqPv2nXdPpf3Pc/jkw8Jbda8j+tT/z8tGPVP1yBHpJd35k/KYvYOy1s8j/yz+kCQjPrP9+agH7x59g/PZfJ9aBhpr/rDKzvYBb+PwtkiaGCt/c/vb1mVr+f1T/JIHwHc8Govw7aeF6+9vG/Xv7kD6fp979isYioQYHVP7AIQZuSFrG/3z1AdUTnAUDN3XY9O7f9P0AdQ9ljYNQ/dJANJPTOrb8kLECUiiPlP4yF7UgmStA/9xGmXxCG1T9qZzix4W2zv2SGJRJVrPe/Fh9a2M/B/b8IexzFCoPSP9y1QFD2bLe/Q86cWLJe/b+mOOfYm78BwOTjkPAGE9E/8aPCUKu/ub9pPZyLCiUGwBA7Mev/BQlALOmrlRi+0j+AMJ/dKULBv7iLtL6a6QRAEMDV/yajAUDa62dE3crJP1P70RgBUbq/38hVnR6esT/s1tG10Z/Ov/zLwalHPss/dTS9NKTXx78nMcRzCIEHQAabxDsAmQRA0tyLK3gSyT+Aui7nOhDGv5Gs58z3WgHATN3forJuBMCAui7nOhDGP9Lciyt4Esm/WAJyHQ4c7z8UP5HFIs3iP3U0vTSk18c//MvBqUc+y7+cvv8HLg/Kvy1I/mHsI+K/U/vRGAFRuj/a62dE3crJv8p+WV8KlQjAuQ/nOP43B0CAMJ/dKULBPyzpq5UYvtK/ZoU+VoLh4L9etLlRUfvtv/GjwlCrv7k/5OOQ8AYT0b9DfT9FhufXPwUX8hJp+4u/3LVAUPZstz8IexzFCoPSv9+L609E5fQ/q9Fz7X2J7T9qZzix4W2zP/cRpl8QhtW/vtNilqGX+j8MOy7QJoL0P3SQDST0zq0/QB1D2WNg1L8IIjSvGNkDwGB8Jou2GAfAsAhBm5IWsT9isYioQYHVvyS9D3zb6uy/gnwRa7uM9L/JIHwHc8GoP729Zla/n9W/CsAHJZwmAEDEW6OYT1r6Pz2XyfWgYaY/35qAfvHn2L83Tdy4lS30vxf2/gZ0jPq/XIEekl3fmb+tT/z8tGPVvybPr2zJ1/+/K7mJ0ypVAsCf3hu/sxqPPwCGu2BoCNm/5oITrpZn+r+UDUyDP+n/v1zv413hVGg/nbPB4P9d2L9MlmkxNvgCQMtZlKE85v8/KwpIThb6nb8mv3lKJJbbv8+SZsTvOOc/pQCIIOYw0j+diYu8efWzvy8k7g9bp9u/kxYDa+pKtD9XlYvA8HnVv6i1e9aVu7G/nio7D4CZ3L/WR6rNh5EGwCkgQweBkghAdvTluZnfrr9cKW4ay8jdvxbjhr1f1QVAR5C0MzivAkAWPu5T2QS8v2cWmi772d+/cKj4lzLJCEBx2QJfYrMFQIcecHFB3sO/LYou8tJi4L+jr7lhO38BwIcI0Nb7xgTAXxIUxzv0w7/ts5dVInnhv0T+l8DZLfE/MP3FoFvS5D8MzuyPm3DDv7JkhGyvzuG/tzhzRIRc0b9Ovv3/0z7mv6/03qhPLdC/m4CT/dDN4b9dwjU5VCQBQBBJX1ntCv0/9GsWtZesy79baTkvlCzjv1mjYgEz++S/oW6KnOQW8b9KoilqByXLv6W2KnGYjeS/SmaKz3Vx9z+BZB5yxGHwP3fHN6OJVdC/dZ02ES/2478PuaBjLrXaP4/JU81pPaO/fgsikW3pzr+XlhbYZrjkv4tSn7YDbP0/f2LnFKlF9z+mJHHg/w/Sv14ILfMECOW/mfg4qYhR/b+OP+RQDCACwOpb9yNs09C/1fbPpJjB5L9pN2WOVZ3wv3hHy9nxIve/URlzO/Rv0r8YFturGCTmv1d1/KKR8QPA8gsy9qzSB8CfHRX3t6fSvzzFCT/Qg+a/EYStnrzV9r/2QJqI7Lb9v/YEIrTDINW/LbFE4JPi5r/7kQEs5fEDQHunnf4GeQBAooj9BX7L2L+oPOc8Uzzpv+ydYY2SSAfAL4HK6CRTB0BH3yUkWpDZv2wvsfFmQ+i/Ik0Yzruh6T8fM3LoGoDUP3oSeovukti/S/ycXKkd6r9rEv+7UWcHQCRIQe/GfwNAa36Abk+y2b9BLWR4ssrpv9KT87qa0bM/FTyktw823L8WyyI/BbLgv4hlM1gubOq/DizMp9Ki6r8b5ckdjVrzv5NVbYtSON+/BBqJ+C6O7L/dUBFqgyXYv00Wh18r7+q/7RAy9h8/4L8W8t/TUc3rv4RM5DKx3wDAfvWIj94aBcBsc1IetODgv3oY0nYIW+y/oGcTFF54AUDkJqS/FKX6PwzNxsC7AOC/ltfN1PUC7L+5Wrz/zHnzP6688w2rNOc/YeV9neCo4b9nlSHXANfuvw9RsxKjY/s/1V8GteXE8j+1C8NdDcfiv2wlcW3YZO+/IOywaA7Q8b9bFP+4Tg36v4GTTeNZi+O/9t/ywdRi77+tRc3yFR7eP2bkcHXJkLO//ITc9SjT4r+qoBf2J0nwv2YHKoswwfm/iQcLspCjAcCb6wCzCvXkvwXv9rkMT/C/YkuwYAMXBMApCNUai9kIwMORhtNuJ+e/BVt01fKF8L+ZqWEfvIjsP6h693QZYNk/WyOTkB2i5b8of+GtdSDxvwpaaulDSwVADMQAX+lOAECEHWF8XNPmv1cr/B+VnvG/XyFG6opcCMD/mtR32/UEQP+2XEF3hui/ulBTjAt88r/imfCfRP+yP9zbvtc8XeO/TZuKJD5G6b/MaTExyXzyvxiTQeElXOO/rbJRQVGN9L/z0wR2g9DqvxOqKRxEX/O/FDGCEei99j9x8zV4VYTmP2lzCnsYk+u/l6ELZ9tg878pRXacaDT/v3k6GZRqoQXAVB67LiP56r94+LDK0Sn0vwO6pZ9b7wFAvK0nKVcc9j8+U/hCvyruv6QMsuuLQ/W/FPhKFYv46j8MyxaDTOW/v9L18g1caO2/vebfvctE9b/7GD8ZrF3xv3gx1AR9bQDAuMEtsM4c77+SabgA2nj0v5xKFIwxsATArKNSBaKsB0Cjara6ozTwv33ArMz7sfa/dF2U0FcWCcDxL357DJX/P69pJmt7c/G/quJYWJZl+L/YntVJlnrSP4sRLzXM+fe/46uU8w3c8r+q4lhYlmX4v85lu5+QRwRAsI0H/WU8479jaeZNtj/zv6riWFiWZfi/sI0H/WU847/OZbufkEcEQHAoPUBrnss/9exKzDtFtT88wM8kax+gP9OqeKeAYog/MW0ItiZvcj+ph+smvt5bP2lCaV5dEUU/StaUmQDaLz+kK9y22BMYP0O3whZuMwI/IIbgZGWE6z7UkjYaEM3UPuezxwa9cr8+LybxRMnFpz6E1N8DbPiRPsYjySMvK3s+//////8fAAj//////zMQCP////9/MiAI/////28yMAj/////YzJACP///z9iMlAI////N2IyYAj///8zYjJwCP//vzNiMoAI//+rM2IykAj/f6szYjKgCP8PqzNiMrAI/wOrM2IywAi/A6szYjLQCJ8DqzNiMuAImQOrM2Iy8Aj//////z8PCP//////Kx8I/////38pLwj/////Pyk/CP////85KU8I////PzgpXwj///8POClvCP///w44KX8I//8fDjgpjwj//w8OOCmfCP9/DQ44Ka8I/w8NDjgpvwj/DQ0OOCnPCP8MDQ44Kd8IxwwNDjgp7wjEDA0OOCn/CAcAAAAHAAAAAQAAAAIAAAAEAAAAAwAAAAAAAAAAAAAABwAAAAMAAAABAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAGAAAAAgAAAAMAAAAFAAAABAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAwAAAAEAAAAFAAAABAAAAAAAAAAAAAAABwAAAAUAAAADAAAABAAAAAEAAAAAAAAAAgAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8YLURU+yEJQBgtRFT7IQnAYWxnb3MuYwBoM05laWdoYm9yUm90YXRpb25zAGNvb3JkaWprLmMAX3VwQXA3Q2hlY2tlZABfdXBBcDdyQ2hlY2tlZABkaXJlY3RlZEVkZ2UuYwBkaXJlY3RlZEVkZ2VUb0JvdW5kYXJ5AGFkamFjZW50RmFjZURpclt0bXBGaWprLmZhY2VdW2ZpamsuZmFjZV0gPT0gS0kAZmFjZWlqay5jAF9mYWNlSWprUGVudFRvQ2VsbEJvdW5kYXJ5AGFkamFjZW50RmFjZURpcltjZW50ZXJJSksuZmFjZV1bZmFjZTJdID09IEtJAF9mYWNlSWprVG9DZWxsQm91bmRhcnkAaDNJbmRleC5jAGNvbXBhY3RDZWxscwBsYXRMbmdUb0NlbGwAY2VsbFRvQ2hpbGRQb3MAdmFsaWRhdGVDaGlsZFBvcwBsYXRMbmcuYwBjZWxsQXJlYVJhZHMyAHBvbHlnb24tPm5leHQgPT0gTlVMTABsaW5rZWRHZW8uYwBhZGROZXdMaW5rZWRQb2x5Z29uAG5leHQgIT0gTlVMTABsb29wICE9IE5VTEwAYWRkTmV3TGlua2VkTG9vcABwb2x5Z29uLT5maXJzdCA9PSBOVUxMAGFkZExpbmtlZExvb3AAY29vcmQgIT0gTlVMTABhZGRMaW5rZWRDb29yZABsb29wLT5maXJzdCA9PSBOVUxMAGlubmVyTG9vcHMgIT0gTlVMTABub3JtYWxpemVNdWx0aVBvbHlnb24AYmJveGVzICE9IE5VTEwAY2FuZGlkYXRlcyAhPSBOVUxMAGZpbmRQb2x5Z29uRm9ySG9sZQBjYW5kaWRhdGVCQm94ZXMgIT0gTlVMTAByZXZEaXIgIT0gSU5WQUxJRF9ESUdJVABsb2NhbGlqLmMAY2VsbFRvTG9jYWxJamsAYmFzZUNlbGwgIT0gb3JpZ2luQmFzZUNlbGwAIShvcmlnaW5PblBlbnQgJiYgaW5kZXhPblBlbnQpAGJhc2VDZWxsID09IG9yaWdpbkJhc2VDZWxsAGJhc2VDZWxsICE9IElOVkFMSURfQkFTRV9DRUxMAGxvY2FsSWprVG9DZWxsACFfaXNCYXNlQ2VsbFBlbnRhZ29uKGJhc2VDZWxsKQBiYXNlQ2VsbFJvdGF0aW9ucyA+PSAwAGdyaWRQYXRoQ2VsbHMAcG9seWZpbGwuYwBpdGVyU3RlcFBvbHlnb25Db21wYWN0ADAAdmVydGV4LmMAdmVydGV4Um90YXRpb25zAGNlbGxUb1ZlcnRleABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl";var G="function"==typeof atob?atob:function(A){var e,t,r,n,o,i,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="",l=0;A=A.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e=a.indexOf(A.charAt(l++))<<2|(n=a.indexOf(A.charAt(l++)))>>4,t=(15&n)<<4|(o=a.indexOf(A.charAt(l++)))>>2,r=(3&o)<<6|(i=a.indexOf(A.charAt(l++))),s+=String.fromCharCode(e),64!==o&&(s+=String.fromCharCode(t)),64!==i&&(s+=String.fromCharCode(r))}while(l=0){if((0|t)>13780509){if(0|(a=0|le(15,s)))break;s=0|n[(l=s)>>2],l=0|n[l+4>>2]}else c=0|qe(0|t,0|(a=((0|t)<0)<<31>>31),3,0),l=0|B(),a=0|Ve(0|t,0|a,1,0),a=0|Ve(0|(a=0|qe(0|c,0|l,0|a,0|B())),0|B(),1,0),l=0|B(),n[s>>2]=a,n[s+4>>2]=l,s=a;if(lt(0|r,0,s<<3),0|o){lt(0|o,0,s<<2),a=0|L(A,e,t,r,o,s,l,0);break}(a=0|We(s,4))?(c=0|L(A,e,t,r,a,s,l,0),Ye(a),a=c):a=13}else a=2}while(0);return S=i,0|a}function T(A,e,t,r,o){A|=0,e|=0,t|=0,r|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0;if(a=S,S=S+16|0,m=a+8|0,n[(h=i=a)>>2]=A,n[h+4>>2]=e,(0|t)<0)return S=a,2;if(n[(s=r)>>2]=A,n[s+4>>2]=e,(s=!!(0|o))&&(n[o>>2]=0),0|zA(A,e))return S=a,9;n[m>>2]=0;A:do{if((0|t)>=1)if(s)for(f=1,d=0,g=0,h=1,s=A;;){if(!(d|g)){if(0|(s=0|R(s,e,4,m,i)))break A;if(0|zA(s=0|n[(e=i)>>2],e=0|n[e+4>>2])){s=9;break A}}if(0|(s=0|R(s,e,0|n[26800+(g<<2)>>2],m,i)))break A;if(s=0|n[(e=i)>>2],e=0|n[e+4>>2],n[(A=r+(f<<3)|0)>>2]=s,n[A+4>>2]=e,n[o+(f<<2)>>2]=h,l=(0|(A=d+1|0))==(0|h),u=6==(0|(c=g+1|0)),0|zA(s,e)){s=9;break A}if((0|(h=h+(u&l&1)|0))>(0|t)){s=0;break}f=f+1|0,d=l?0:A,g=l?u?0:c:g}else for(f=1,d=0,g=0,h=1,s=A;;){if(!(d|g)){if(0|(s=0|R(s,e,4,m,i)))break A;if(0|zA(s=0|n[(e=i)>>2],e=0|n[e+4>>2])){s=9;break A}}if(0|(s=0|R(s,e,0|n[26800+(g<<2)>>2],m,i)))break A;if(s=0|n[(e=i)>>2],e=0|n[e+4>>2],n[(A=r+(f<<3)|0)>>2]=s,n[A+4>>2]=e,l=(0|(A=d+1|0))==(0|h),u=6==(0|(c=g+1|0)),0|zA(s,e)){s=9;break A}if((0|(h=h+(u&l&1)|0))>(0|t)){s=0;break}f=f+1|0,d=l?0:A,g=l?u?0:c:g}else s=0}while(0);return S=a,0|s}function L(A,e,t,r,o,i,a,s){t|=0,r|=0,o|=0,s|=0;var l,c,u,d=0,f=0,g=0,h=0,m=0,b=0,p=0;if(u=S,S=S+16|0,l=u+8|0,c=u,d=0|At(0|(A|=0),0|(e|=0),0|(i|=0),0|(a|=0)),g=0|B(),!(!(0|(p=0|n[(b=h=r+(d<<3)|0)>>2]))&!(0|(b=0|n[b+4>>2]))|(f=(0|p)==(0|A)&(0|b)==(0|e))))do{d=0|$e(0|(d=0|Ve(0|d,0|g,1,0)),0|B(),0|i,0|a),g=0|B(),f=(0|(b=0|n[(p=h=r+(d<<3)|0)>>2]))==(0|A)&(0|(p=0|n[p+4>>2]))==(0|e)}while(!(!(0|b)&!(0|p)|f));if(d=o+(d<<2)|0,f&&(0|n[d>>2])<=(0|s))return S=u,0;if(n[(p=h)>>2]=A,n[p+4>>2]=e,n[d>>2]=s,(0|s)>=(0|t))return S=u,0;switch(f=s+1|0,n[l>>2]=0,0|(d=0|R(A,e,2,l,c))){case 9:m=9;break;case 0:(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f))||(m=9)}A:do{if(9==(0|m)){switch(n[l>>2]=0,0|(d=0|R(A,e,3,l,c))){case 9:break;case 0:if(0|(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,1,l,c))){case 9:break;case 0:if(0|(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,5,l,c))){case 9:break;case 0:if(0|(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,4,l,c))){case 9:break;case 0:if(0|(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,6,l,c))){case 9:break;case 0:if(0|(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}return S=u,0}}while(0);return S=u,0|d}function R(A,e,t,r,o){A|=0,e|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,d=0,f=0,g=0;if((t|=0)>>>0>6)return 1;if(d=(0|n[(r|=0)>>2])%6|0,n[r>>2]=d,(0|d)>0){s=0;do{t=0|vA(t),s=s+1|0}while((0|s)<(0|n[r>>2]))}if(d=0|tt(0|A,0|e,45),B(),(a=127&d)>>>0>121)return 5;i=0|OA(A,e),s=0|tt(0|A,0|e,52),B(),s&=15;A:do{if(s){for(;;){if(c=0|tt(0|A,0|e,0|(l=3*(15-s|0)|0)),B(),7==(0|(c&=7))){e=5;break}if(g=!(0|ZA(s)),s=s+-1|0,f=0|rt(7,0,0|l),e&=~B(),A=0|rt(0|n[(g?432:16)+(28*c|0)+(t<<2)>>2],0,0|l)|A&~f,e|=l=0|B(),!(t=0|n[(g?640:224)+(28*c|0)+(t<<2)>>2])){t=0;break A}if(!s){u=8;break A}}return 0|e}u=8}while(0);8==(0|u)&&(A|=0|rt(0|(g=0|n[848+(28*a|0)+(t<<2)>>2]),0,45),e=B()|-1040385&e,t=0|n[4272+(28*a|0)+(t<<2)>>2],127&~g||(g=0|rt(0|n[848+(28*a|0)+20>>2],0,45),e=B()|-1040385&e,t=0|n[4272+(28*a|0)+20>>2],A=0|YA(g|A,e),e=0|B(),n[r>>2]=1+(0|n[r>>2]))),c=0|tt(0|A,0|e,45),B(),c&=127;A:do{if(0|H(c)){e:do{if(1==(0|OA(A,e))){if((0|a)!=(0|c)){if(0|Y(c,0|n[7696+(28*a|0)>>2])){A=0|VA(A,e),l=1,e=0|B();break}M(27795,26864,533,26872)}switch(0|i){case 3:A=0|YA(A,e),e=0|B(),n[r>>2]=1+(0|n[r>>2]),l=0;break e;case 5:A=0|VA(A,e),e=0|B(),n[r>>2]=5+(0|n[r>>2]),l=0;break e;case 0:return 9;default:return 1}}else l=0}while(0);if((0|t)>0){s=0;do{A=0|UA(A,e),e=0|B(),s=s+1|0}while((0|s)!=(0|t))}if((0|a)!=(0|c)){if(!(0|G(c))){if(!!(0|l)|5!=(0|OA(A,e)))break;n[r>>2]=1+(0|n[r>>2]);break}switch(127&d){case 8:case 118:break A}3!=(0|OA(A,e))&&(n[r>>2]=1+(0|n[r>>2]))}}else if((0|t)>0){s=0;do{A=0|YA(A,e),e=0|B(),s=s+1|0}while((0|s)!=(0|t))}}while(0);return n[r>>2]=((0|n[r>>2])+t|0)%6|0,n[(g=o)>>2]=A,n[g+4>>2]=e,0}function I(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var o,i,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0;if(i=S,S=S+16|0,h=i+8|0,n[(g=o=i)>>2]=A,n[g+4>>2]=e,(0|t)<0)return S=i,2;if(!t)return n[(h=r)>>2]=A,n[h+4>>2]=e,S=i,0;n[h>>2]=0;A:do{if(0|zA(A,e))A=9;else{a=0,g=A;do{if(0|(A=0|R(g,e,4,h,o)))break A;if(a=a+1|0,0|zA(g=0|n[(e=o)>>2],e=0|n[e+4>>2])){A=9;break A}}while((0|a)<(0|t));n[(f=r)>>2]=g,n[f+4>>2]=e,f=t+-1|0,d=0,A=1;do{if(a=26800+(d<<2)|0,5==(0|d))for(l=0|n[a>>2],s=0,a=A;;){if(0|(A=0|R(0|n[(A=o)>>2],0|n[A+4>>2],l,h,o)))break A;if((0|s)!=(0|f)){if(c=0|n[(u=o)>>2],u=0|n[u+4>>2],n[(A=r+(a<<3)|0)>>2]=c,n[A+4>>2]=u,0|zA(c,u)){A=9;break A}A=a+1|0}else A=a;if((0|(s=s+1|0))>=(0|t))break;a=A}else for(l=o,u=0|n[a>>2],c=0,a=A,s=0|n[l>>2],l=0|n[l+4>>2];;){if(0|(A=0|R(s,l,u,h,o)))break A;if(s=0|n[(l=o)>>2],l=0|n[l+4>>2],n[(A=r+(a<<3)|0)>>2]=s,n[A+4>>2]=l,A=a+1|0,0|zA(s,l)){A=9;break A}if((0|(c=c+1|0))>=(0|t))break;a=A}d=d+1|0}while(d>>>0<6);A=(0|g)==(0|n[(A=o)>>2])&&(0|e)==(0|n[A+4>>2])?0:9}}while(0);return S=i,0|A}function _(A,e,t,r){t|=0,r|=0;var o,i,a,s=0,l=0;for(a=S,S=S+16|0,o=a,i=a+8|0,s=(s=!(0|zA(A|=0,e|=0)))?1:2;;){if(n[i>>2]=0,!(0|R(A,e,s,i,o))&((0|n[(l=o)>>2])==(0|t)?(0|n[l+4>>2])==(0|r):0)){A=4;break}if((s=s+1|0)>>>0>=7){s=7,A=4;break}}return 4==(0|A)?(S=a,0|s):0}function z(A,e,t,r,i,a,s){e|=0,t|=0,r|=0,i|=0,a|=0,s|=0;var l,c,u,d,f,g,h,m,b,p,v=0,y=0,w=0,x=0,k=0,C=0,M=0,D=0,E=0,j=0,Q=0,N=0,F=0,P=0,T=0,L=0,R=0,I=0,_=0;if(p=S,S=S+64|0,h=p+48|0,m=p+32|0,b=p+24|0,l=p+8|0,c=p,(0|(y=0|n[(A|=0)>>2]))<=0)return S=p,0;for(u=A+4|0,d=h+8|0,f=m+8|0,g=l+8|0,v=0,F=0;;){N=(w=0|n[u>>2])+(F<<4)|0,n[h>>2]=n[N>>2],n[h+4>>2]=n[N+4>>2],n[h+8>>2]=n[N+8>>2],n[h+12>>2]=n[N+12>>2],(0|F)==(y+-1|0)?(n[m>>2]=n[w>>2],n[m+4>>2]=n[w+4>>2],n[m+8>>2]=n[w+8>>2],n[m+12>>2]=n[w+12>>2]):(N=w+(F+1<<4)|0,n[m>>2]=n[N>>2],n[m+4>>2]=n[N+4>>2],n[m+8>>2]=n[N+8>>2],n[m+12>>2]=n[N+12>>2]),y=0|tA(h,m,r,b);A:do{if(y)w=0,v=y;else if(w=0|n[(y=b)>>2],(0|(y=0|n[y+4>>2]))>0|!(0|y)&w>>>0>0){Q=0,N=0;e:for(;;){if(R=1/(+(w>>>0)+4294967296*+(0|y)),_=+o[h>>3],I=+((y=0|Ze(0|w,0|y,0|Q,0|N))>>>0)+4294967296*+(0|B()),L=+(Q>>>0)+4294967296*+(0|N),o[l>>3]=R*(_*I)+R*(+o[m>>3]*L),o[g>>3]=R*(+o[d>>3]*I)+R*(+o[f>>3]*L),0|(y=0|KA(l,r,c))){v=y;break}C=0|At(0|(E=0|n[(j=c)>>2]),0|(j=0|n[j+4>>2]),0|e,0|t),x=0|B(),w=0|n[(k=y=s+(C<<3)|0)>>2],k=0|n[k+4>>2];t:do{if(!(0|w)&!(0|k))P=y,T=16;else for(M=0,D=0;;){if((0|M)>(0|t)|(0|M)==(0|t)&D>>>0>e>>>0){v=1;break e}if((0|w)==(0|E)&(0|k)==(0|j))break t;if(C=0|$e(0|(y=0|Ve(0|C,0|x,1,0)),0|B(),0|e,0|t),x=0|B(),D=0|Ve(0|D,0|M,1,0),M=0|B(),!(0|(w=0|n[(k=y=s+(C<<3)|0)>>2]))&!(0|(k=0|n[k+4>>2]))){P=y,T=16;break}}}while(0);if(16!=(0|T)||(T=0,!(0|E)&!(0|j))||(n[(D=P)>>2]=E,n[D+4>>2]=j,D=a+(n[i>>2]<<3)|0,n[D>>2]=E,n[D+4>>2]=j,D=0|Ve(0|n[(D=i)>>2],0|n[D+4>>2],1,0),E=0|B(),n[(j=i)>>2]=D,n[j+4>>2]=E),Q=0|Ve(0|Q,0|N,1,0),N=0|B(),w=0|n[(y=b)>>2],!((0|(y=0|n[y+4>>2]))>(0|N)|(0|y)==(0|N)&w>>>0>Q>>>0)){w=1;break A}}w=0}else w=1}while(0);if(F=F+1|0,!w){T=21;break}if((0|F)>=(0|(y=0|n[A>>2]))){v=0,T=21;break}}return 21==(0|T)?(S=p,0|v):0}function H(A){return(A|=0)>>>0>121?0|(A=0):0|(A=0|n[7696+(28*A|0)+16>>2])}function G(A){return 4==(0|(A|=0))|117==(0|A)|0}function O(A){return 0|n[11120+(216*(0|n[(A|=0)>>2])|0)+(72*(0|n[A+4>>2])|0)+(24*(0|n[A+8>>2])|0)+(n[A+12>>2]<<3)>>2]}function U(A){return 0|n[11120+(216*(0|n[(A|=0)>>2])|0)+(72*(0|n[A+4>>2])|0)+(24*(0|n[A+8>>2])|0)+(n[A+12>>2]<<3)+4>>2]}function Y(A,e){return e|=0,(0|n[7696+(28*(A|=0)|0)+20>>2])==(0|e)?0|(e=1):0|(e=(0|n[7696+(28*A|0)+24>>2])==(0|e))}function W(A,e){return 0|n[848+(28*(A|=0)|0)+((e|=0)<<2)>>2]}function V(A,e){return e|=0,(0|n[848+(28*(A|=0)|0)>>2])==(0|e)?0|(e=0):(0|n[848+(28*A|0)+4>>2])==(0|e)?0|(e=1):(0|n[848+(28*A|0)+8>>2])==(0|e)?0|(e=2):(0|n[848+(28*A|0)+12>>2])==(0|e)?0|(e=3):(0|n[848+(28*A|0)+16>>2])==(0|e)?0|(e=4):(0|n[848+(28*A|0)+20>>2])==(0|e)?0|(e=5):0|((0|n[848+(28*A|0)+24>>2])==(0|e)?6:7)}function Z(A){var e,t,r;return e=(r=+o[16+(A|=0)>>3])-(t=+o[A+24>>3]),+(r>3]<+o[A+24>>3]|0}function J(A){return+(+o[(A|=0)>>3]-+o[A+8>>3])}function X(A,e){A|=0;var t,r,n=0;return(n=+o[(e|=0)>>3])>=+o[A+8>>3]&&n<=+o[A>>3]?(t=+o[A+16>>3],n=+o[A+24>>3],e=(r=+o[e+8>>3])>=n,A=r<=t&1,t>3]<+o[e+8>>3]||+o[A+8>>3]>+o[e>>3]?0|(s=0):(n=(l=+o[A+16>>3])<(u=+o[(t=A+24|0)>>3]),c=(a=+o[(s=e+16|0)>>3])<(i=+o[(r=e+24|0)>>3]),e=u-a>3],e)||(u=+ie(+o[t>>3],A))>+ie(+o[s>>3],e)?0|(c=0):0|(c=1))}function $(A,e){e|=0;var t,r,n,i,a,s=0,l=0,c=0,u=0;return+o[(A|=0)>>3]<+o[e>>3]||+o[A+8>>3]>+o[e+8>>3]?0|(s=0):(n=(i=+o[(s=A+16|0)>>3])<(l=+o[A+24>>3]),c=(u=+o[(t=e+16|0)>>3])<(a=+o[(r=e+24|0)>>3]),e=l-u>3],e)?0|(c=(u=+ie(+o[s>>3],A))>=+ie(+o[t>>3],e)):0|(c=0))}function AA(A,e){A|=0,e|=0;var t,r,i,a,s,l=0;i=S,S=S+176|0,n[(r=i)>>2]=4,l=+o[e>>3],o[r+8>>3]=l,a=+o[e+16>>3],o[r+16>>3]=a,o[r+24>>3]=l,l=+o[e+24>>3],o[r+32>>3]=l,s=+o[e+8>>3],o[r+40>>3]=s,o[r+48>>3]=l,o[r+56>>3]=s,o[r+64>>3]=a,t=96+(e=r+72|0)|0;do{n[e>>2]=0,e=e+4|0}while((0|e)<(0|t));st(0|A,0|r,168),S=i}function eA(A,e,t){A|=0,e|=0,t|=0;var r,a,c,u,d,f,g,h=0,m=0,b=0,p=0,y=0,x=0,k=0;f=S,S=S+288|0,d=f+264|0,p=f+96|0,m=(h=b=f)+96|0;do{n[h>>2]=0,h=h+4|0}while((0|h)<(0|m));return 0|(e=0|Ae(e,b))?(S=f,0|(x=e)):(qA(b=0|n[(m=b)>>2],m=0|n[m+4>>2],d),$A(b,m,p),u=+ae(d,p+8|0),o[d>>3]=+o[A>>3],o[(m=d+8|0)>>3]=+o[A+16>>3],o[p>>3]=+o[A+8>>3],o[(b=p+8|0)>>3]=+o[A+24>>3],a=+ae(d,p),k=+o[m>>3]-+o[b>>3],c=+l(+k),g=+o[d>>3]-+o[p>>3],r=+l(+g),!(0==k|0==g)&&(k=+ot(+c,+r),k=+v(+a*a/+it(+k/+it(+c,+r),3)/(u*(2.59807621135*u)*.8)),o[i>>3]=k,y=~~k>>>0,x=+l(k)>=1?k>0?~~+w(+s(k/4294967296),4294967295)>>>0:~~+v((k-+(~~k>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2])?(p=!(0|y)&!(0|x),n[(e=t)>>2]=p?1:y,n[e+4>>2]=p?0:x,e=0):e=1,S=f,0|(x=e))}function tA(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var a,c,u,d,f=0,g=0,h=0;d=S,S=S+288|0,c=d+264|0,u=d+96|0,a=(f=g=d)+96|0;do{n[f>>2]=0,f=f+4|0}while((0|f)<(0|a));return 0|(t=0|Ae(t,g))?(S=d,0|(r=t)):(qA(f=0|n[(t=g)>>2],t=0|n[t+4>>2],c),$A(f,t,u),h=+ae(c,u+8|0),h=+v(+ +ae(A,e)/(2*h)),o[i>>3]=h,t=~~h>>>0,f=+l(h)>=1?h>0?~~+w(+s(h/4294967296),4294967295)>>>0:~~+v((h-+(~~h>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2]?(g=!(0|t)&!(0|f),n[r>>2]=g?1:t,n[r+4>>2]=g?0:f,S=d,0|(r=0)):(S=d,0|(r=1)))}function rA(A,e,t,r){e|=0,t|=0,r|=0,n[(A|=0)>>2]=e,n[A+4>>2]=t,n[A+8>>2]=r}function nA(A){var e,t=0,r=0,o=0,i=0,a=0;t=0|n[(A|=0)>>2],r=0|n[(e=A+4|0)>>2],(0|t)<0&&(r=r-t|0,n[e>>2]=r,n[(a=A+8|0)>>2]=(0|n[a>>2])-t,n[A>>2]=0,t=0),(0|r)<0?(t=t-r|0,n[A>>2]=t,i=(0|n[(a=A+8|0)>>2])-r|0,n[a>>2]=i,n[e>>2]=0,r=0):(a=i=A+8|0,i=0|n[i>>2]),(0|i)<0&&(t=t-i|0,n[A>>2]=t,r=r-i|0,n[e>>2]=r,n[a>>2]=0,i=0),(0|(o=(0|i)<(0|(o=(0|r)<(0|t)?r:t))?i:o))<=0||(n[A>>2]=t-o,n[e>>2]=r-o,n[a>>2]=i-o)}function oA(A,e){var t,r;e|=0,r=0|n[8+(A|=0)>>2],t=+((0|n[A+4>>2])-r|0),o[e>>3]=+((0|n[A>>2])-r|0)-.5*t,o[e+8>>3]=.8660254037844386*t}function iA(A,e,t){A|=0,e|=0,n[(t|=0)>>2]=(0|n[e>>2])+(0|n[A>>2]),n[t+4>>2]=(0|n[e+4>>2])+(0|n[A+4>>2]),n[t+8>>2]=(0|n[e+8>>2])+(0|n[A+8>>2])}function aA(A,e,t){A|=0,e|=0,n[(t|=0)>>2]=(0|n[A>>2])-(0|n[e>>2]),n[t+4>>2]=(0|n[A+4>>2])-(0|n[e+4>>2]),n[t+8>>2]=(0|n[A+8>>2])-(0|n[e+8>>2])}function sA(A,e){e|=0;var t,r=0;r=0|y(0|n[(A|=0)>>2],e),n[A>>2]=r,t=0|y(0|n[(r=A+4|0)>>2],e),n[r>>2]=t,e=0|y(0|n[(A=A+8|0)>>2],e),n[A>>2]=e}function lA(A){var e,t,r=0,o=0,i=0,a=0,s=0;s=(0|(t=0|n[(A|=0)>>2]))<0,A=(A=(o=(0|(a=((e=(0|(i=(0|n[A+4>>2])-(s?t:0)|0))<0)?0-i|0:0)+((0|n[A+8>>2])-(s?t:0))|0))<0)?0:a)-((i=(0|(o=(0|A)<(0|(o=(0|(r=(e?0:i)-(o?a:0)|0))<(0|(a=(s?0:t)-(e?i:0)-(o?a:0)|0))?r:a))?A:o))>0)?o:0)|0,r=r-(i?o:0)|0;A:do{switch(a-(i?o:0)|0){case 0:switch(0|r){case 0:return 0|(0|A?1==(0|A)?1:7:0);case 1:return 0|(0|A?1==(0|A)?3:7:2);default:break A}case 1:switch(0|r){case 0:return 0|(0|A?1==(0|A)?5:7:4);case 1:if(A)break A;return 6;default:break A}}}while(0);return 7}function cA(A){var e,t,r=0,o=0,i=0,a=0,s=0,l=0,c=0;if(l=0|n[(t=8+(A|=0)|0)>>2],(e=(0|n[A>>2])-l|0)>>>0>715827881|(l=(0|n[(c=A+4|0)>>2])-l|0)>>>0>715827881){if(a=2147483647-e|0,s=-2147483648-e|0,(i=(0|e)>0)?(0|a)<(0|e):(0|s)>(0|e))return 1;if(o=e<<1,i?(2147483647-o|0)<(0|e):(-2147483648-o|0)>(0|e))return 1;if((0|l)>0?(2147483647-l|0)<(0|l):(-2147483648-l|0)>(0|l))return 1;if(r=3*e|0,o=l<<1,(i?(0|a)<(0|o):(0|s)>(0|o))||((0|e)>-1?(-2147483648|r)>=(0|l):(-2147483648^r)<(0|l)))return 1}else o=l<<1,r=3*e|0;return i=0|Oe(.14285714285714285*+(r-l|0)),n[A>>2]=i,a=0|Oe(.14285714285714285*+(o+e|0)),n[c>>2]=a,n[t>>2]=0,r=(o=(0|a)<(0|i))?i:a,(0|(o=o?a:i))<0&&((-2147483648==(0|o)||((0|r)>0?(2147483647-r|0)<(0|o):(-2147483648-r|0)>(0|o)))&&M(27795,26892,354,26903),((0|r)>-1?(-2147483648|r)>=(0|o):(-2147483648^r)<(0|o))&&M(27795,26892,354,26903)),r=a-i|0,(0|i)<0?(o=0-i|0,n[c>>2]=r,n[t>>2]=o,n[A>>2]=0,i=0):(r=a,o=0),(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[t>>2]=o,n[c>>2]=0,r=0),s=i-o|0,a=r-o|0,(0|o)<0?(n[A>>2]=s,n[c>>2]=a,n[t>>2]=0,r=a,a=s,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|r)<(0|a)?r:a))?o:i))<=0||(n[A>>2]=a-i,n[c>>2]=r-i,n[t>>2]=o-i),0}function uA(A){var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0;if(i=0|n[(e=8+(A|=0)|0)>>2],(a=(0|n[A>>2])-i|0)>>>0>715827881|(i=(0|n[(s=A+4|0)>>2])-i|0)>>>0>715827881){if((r=(0|a)>0)?(2147483647-a|0)<(0|a):(-2147483648-a|0)>(0|a))return 1;if(t=a<<1,(o=(0|i)>0)?(2147483647-i|0)<(0|i):(-2147483648-i|0)>(0|i))return 1;if(l=i<<1,o?(2147483647-l|0)<(0|i):(-2147483648-l|0)>(0|i))return 1;if(r?(2147483647-t|0)<(0|i):(-2147483648-t|0)>(0|i))return 1;if(r=3*i|0,(0|i)>-1?(-2147483648|r)>=(0|a):(-2147483648^r)<(0|a))return 1}else r=3*i|0,t=a<<1;return o=0|Oe(.14285714285714285*+(t+i|0)),n[A>>2]=o,i=0|Oe(.14285714285714285*+(r-a|0)),n[s>>2]=i,n[e>>2]=0,t=(r=(0|i)<(0|o))?o:i,(0|(r=r?i:o))<0&&((-2147483648==(0|r)||((0|t)>0?(2147483647-t|0)<(0|r):(-2147483648-t|0)>(0|r)))&&M(27795,26892,402,26917),((0|t)>-1?(-2147483648|t)>=(0|r):(-2147483648^t)<(0|r))&&M(27795,26892,402,26917)),t=i-o|0,(0|o)<0?(r=0-o|0,n[s>>2]=t,n[e>>2]=r,n[A>>2]=0,o=0):(t=i,r=0),(0|t)<0&&(o=o-t|0,n[A>>2]=o,r=r-t|0,n[e>>2]=r,n[s>>2]=0,t=0),a=o-r|0,i=t-r|0,(0|r)<0?(n[A>>2]=a,n[s>>2]=i,n[e>>2]=0,t=i,i=a,r=0):i=o,(0|(o=(0|r)<(0|(o=(0|t)<(0|i)?t:i))?r:o))<=0||(n[A>>2]=i-o,n[s>>2]=t-o,n[e>>2]=r-o),0}function dA(A){var e,t,r=0,o=0,i=0,a=0,s=0;o=0|n[(e=8+(A|=0)|0)>>2],i=0|Oe(.14285714285714285*+((3*(r=(0|n[A>>2])-o|0)|0)-(o=(0|n[(t=A+4|0)>>2])-o|0)|0)),n[A>>2]=i,r=0|Oe(.14285714285714285*+((o<<1)+r|0)),n[t>>2]=r,n[e>>2]=0,o=r-i|0,(0|i)<0?(s=0-i|0,n[t>>2]=o,n[e>>2]=s,n[A>>2]=0,r=o,i=0,o=s):o=0,(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[e>>2]=o,n[t>>2]=0,r=0),s=i-o|0,a=r-o|0,(0|o)<0?(n[A>>2]=s,n[t>>2]=a,n[e>>2]=0,r=a,a=s,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|r)<(0|a)?r:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=r-i,n[e>>2]=o-i)}function fA(A){var e,t,r=0,o=0,i=0,a=0,s=0;o=0|n[(e=8+(A|=0)|0)>>2],i=0|Oe(.14285714285714285*+(((r=(0|n[A>>2])-o|0)<<1)+(o=(0|n[(t=A+4|0)>>2])-o|0)|0)),n[A>>2]=i,r=0|Oe(.14285714285714285*+((3*o|0)-r|0)),n[t>>2]=r,n[e>>2]=0,o=r-i|0,(0|i)<0?(s=0-i|0,n[t>>2]=o,n[e>>2]=s,n[A>>2]=0,r=o,i=0,o=s):o=0,(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[e>>2]=o,n[t>>2]=0,r=0),s=i-o|0,a=r-o|0,(0|o)<0?(n[A>>2]=s,n[t>>2]=a,n[e>>2]=0,r=a,a=s,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|r)<(0|a)?r:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=r-i,n[e>>2]=o-i)}function gA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],i=0|n[(t=A+4|0)>>2],a=0|n[(r=A+8|0)>>2],s=i+(3*o|0)|0,n[A>>2]=s,i=a+(3*i|0)|0,n[t>>2]=i,o=(3*a|0)+o|0,n[r>>2]=o,a=i-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=a,n[r>>2]=o,n[A>>2]=0,i=a,a=0):a=s,(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function hA(A){var e,t,r,o=0,i=0,a=0,s=0;s=0|n[(A|=0)>>2],a=(3*(o=0|n[(t=A+4|0)>>2])|0)+s|0,s=(i=0|n[(r=A+8|0)>>2])+(3*s|0)|0,n[A>>2]=s,n[t>>2]=a,o=(3*i|0)+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,s=0):i=a,(0|i)<0&&(s=s-i|0,n[A>>2]=s,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=s-o|0,a=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=a,n[r>>2]=0,s=e,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|a)<(0|s)?a:s))?o:i))<=0||(n[A>>2]=s-i,n[t>>2]=a-i,n[r>>2]=o-i)}function mA(A,e){A|=0;var t,r,o,i=0,a=0,s=0;((e|=0)-1|0)>>>0>=6||(s=(0|n[15440+(12*e|0)>>2])+(0|n[A>>2])|0,n[A>>2]=s,o=A+4|0,a=(0|n[15440+(12*e|0)+4>>2])+(0|n[o>>2])|0,n[o>>2]=a,r=A+8|0,e=(0|n[15440+(12*e|0)+8>>2])+(0|n[r>>2])|0,n[r>>2]=e,i=a-s|0,(0|s)<0?(e=e-s|0,n[o>>2]=i,n[r>>2]=e,n[A>>2]=0,a=0):(i=a,a=s),(0|i)<0&&(a=a-i|0,n[A>>2]=a,e=e-i|0,n[r>>2]=e,n[o>>2]=0,i=0),t=a-e|0,s=i-e|0,(0|e)<0?(n[A>>2]=t,n[o>>2]=s,n[r>>2]=0,a=t,e=0):s=i,(0|(i=(0|e)<(0|(i=(0|s)<(0|a)?s:a))?e:i))<=0||(n[A>>2]=a-i,n[o>>2]=s-i,n[r>>2]=e-i))}function bA(A){var e,t,r,o=0,i=0,a=0,s=0;s=0|n[(A|=0)>>2],a=(o=0|n[(t=A+4|0)>>2])+s|0,s=(i=0|n[(r=A+8|0)>>2])+s|0,n[A>>2]=s,n[t>>2]=a,o=i+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,a=0):(i=a,a=s),(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function pA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],a=0|n[(t=A+4|0)>>2],i=0|n[(r=A+8|0)>>2],s=a+o|0,n[A>>2]=s,a=i+a|0,n[t>>2]=a,o=i+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,a=0):(i=a,a=s),(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function vA(A){switch(0|(A|=0)){case 1:A=5;break;case 5:A=4;break;case 4:A=6;break;case 6:A=2;break;case 2:A=3;break;case 3:A=1}return 0|A}function yA(A){switch(0|(A|=0)){case 1:A=3;break;case 3:A=2;break;case 2:A=6;break;case 6:A=4;break;case 4:A=5;break;case 5:A=1}return 0|A}function wA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],i=0|n[(t=A+4|0)>>2],a=0|n[(r=A+8|0)>>2],s=i+(o<<1)|0,n[A>>2]=s,i=a+(i<<1)|0,n[t>>2]=i,o=(a<<1)+o|0,n[r>>2]=o,a=i-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=a,n[r>>2]=o,n[A>>2]=0,i=a,a=0):a=s,(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function xA(A){var e,t,r,o=0,i=0,a=0,s=0;s=0|n[(A|=0)>>2],a=((o=0|n[(t=A+4|0)>>2])<<1)+s|0,s=(i=0|n[(r=A+8|0)>>2])+(s<<1)|0,n[A>>2]=s,n[t>>2]=a,o=(i<<1)+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,s=0):i=a,(0|i)<0&&(s=s-i|0,n[A>>2]=s,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=s-o|0,a=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=a,n[r>>2]=0,s=e,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|a)<(0|s)?a:s))?o:i))<=0||(n[A>>2]=s-i,n[t>>2]=a-i,n[r>>2]=o-i)}function kA(A,e){e|=0;var t,r,o,i=0,a=0,s=0;return o=(0|(r=(0|n[(A|=0)>>2])-(0|n[e>>2])|0))<0,t=(0|(a=(0|n[A+4>>2])-(0|n[e+4>>2])-(o?r:0)|0))<0,e=(e=(A=(0|(s=(o?0-r|0:0)+(0|n[A+8>>2])-(0|n[e+8>>2])+(t?0-a|0:0)|0))<0)?0:s)-((a=(0|(A=(0|e)<(0|(A=(0|(i=(t?0:a)-(A?s:0)|0))<(0|(s=(o?0:r)-(t?a:0)-(A?s:0)|0))?i:s))?e:A))>0)?A:0)|0,i=i-(a?A:0)|0,0|((0|(A=(0|(A=s-(a?A:0)|0))>-1?A:0-A|0))>(0|(e=(0|(i=(0|i)>-1?i:0-i|0))>(0|(e=(0|e)>-1?e:0-e|0))?i:e))?A:e)}function CA(A){var e,t,r,o;t=(o=0|n[(e=8+(A|=0)|0)>>2])-(0|n[A>>2])|0,n[A>>2]=t,A=(0|n[(r=A+4|0)>>2])-o|0,n[r>>2]=A,n[e>>2]=0-(A+t)}function BA(A){var e,t,r=0,o=0,i=0,a=0,s=0;r=0-(o=0|n[(A|=0)>>2])|0,n[A>>2]=r,n[(e=A+8|0)>>2]=0,a=(i=0|n[(t=A+4|0)>>2])+o|0,(0|o)>0?(n[t>>2]=a,n[e>>2]=o,n[A>>2]=0,r=0,i=a):o=0,(0|i)<0?(s=r-i|0,n[A>>2]=s,o=o-i|0,n[e>>2]=o,n[t>>2]=0,a=s-o|0,r=0-o|0,(0|o)<0?(n[A>>2]=a,n[t>>2]=r,n[e>>2]=0,i=r,o=0):(i=0,a=s)):a=r,(0|(r=(0|o)<(0|(r=(0|i)<(0|a)?i:a))?o:r))<=0||(n[A>>2]=a-r,n[t>>2]=i-r,n[e>>2]=o-r)}function MA(A,e){var t=0;switch(t=0|tt(0|(A|=0),0|(e|=0),56),B(),7&t){case 0:case 7:return 0}return t=-2130706433&e|134217728,!0&268435456==(2013265920&e)?!0&16777216==(117440512&e)&!!(0|zA(A,t))?0|(t=0):0|(t=0|LA(A,t)):0|(t=0)}function DA(A,e,t){t|=0;var r,o,i=0,a=0;return o=S,S=S+16|0,r=o,a=-2130706433&(e|=0)|134217728,!0&268435456==(2013265920&e)?(i=0|tt(0|(A|=0),0|e,56),B(),i=0|function(A,e,t){t|=0;var r,o=0,i=0;if(r=S,S=S+16|0,i=r,o=0|zA(A|=0,e|=0),(t+-1|0)>>>0>5)return S=r,-1;if(1==(0|t)&(o=!!(0|o)))return S=r,-1;do{if(!(0|Fe(A,e,i))){if(o){o=(5+(0|n[26352+(t<<2)>>2])-(0|n[i>>2])|0)%5|0;break}o=(6+(0|n[26384+(t<<2)>>2])-(0|n[i>>2])|0)%6|0;break}o=-1}while(0);return S=r,0|(i=o)}(A,a,7&i),-1==(0|i)?(n[t>>2]=0,S=o,0|(a=6)):(0|XA(A,a,r)&&M(27795,26932,282,26947),e=0|tt(0|A,0|e,52),B(),e&=15,0|zA(A,a)?jA(r,e,i,2,t):FA(r,e,i,2,t),S=o,0|(a=0))):(S=o,0|(a=6))}function EA(A,e,t,r,i){e|=0,t|=0,r|=0,i|=0;var a,s=0,u=0;if(s=+function(A){var e,t;return t=+o[(A|=0)>>3],e=+o[A+8>>3],+ +c(+(t*t+e*e))}(A|=0),s<1e-16)return e=15600+(e<<4)|0,n[i>>2]=n[e>>2],n[i+4>>2]=n[e+4>>2],n[i+8>>2]=n[e+8>>2],void(n[i+12>>2]=n[e+12>>2]);if(u=+p(+ +o[A+8>>3],+ +o[A>>3]),(0|t)>0){A=0;do{s*=.37796447300922725,A=A+1|0}while((0|A)!=(0|t))}a=.3333333333333333*s,r?(t=!(0|ZA(t)),s=+b(.381966011250105*(t?a:.37796447300922725*a))):(s=+b(.381966011250105*s),0|ZA(t)&&(u=+ne(u+.3334731722518321))),function(A,e,t,r){A|=0,e=+e,r|=0;var i=0,a=0,s=0,c=0;if((t=+t)<1e-16)return n[r>>2]=n[A>>2],n[r+4>>2]=n[A+4>>2],n[r+8>>2]=n[A+8>>2],void(n[r+12>>2]=n[A+12>>2]);a=e<0?e+6.283185307179586:e,a=e>=6.283185307179586?a+-6.283185307179586:a;do{if(!(a<1e-16)){if(i=+l(+(a+-3.141592653589793))<1e-16,e=+o[A>>3],i){e-=t,o[r>>3]=e,i=r;break}if(s=+d(+t),t=+f(+t),e=s*+f(+e)+ +d(+a)*(t*+d(+e)),e=+m(+((e=e>1?1:e)<-1?-1:e)),o[r>>3]=e,+l(+(e+-1.5707963267948966))<1e-16)return o[r>>3]=1.5707963267948966,void(o[r+8>>3]=0);if(+l(+(e+1.5707963267948966))<1e-16)return o[r>>3]=-1.5707963267948966,void(o[r+8>>3]=0);if(c=1/+d(+e),a=t*+f(+a)*c,t=+o[A>>3],e=c*((s-+f(+e)*+f(+t))/+d(+t)),s=a>1?1:a,e=e>1?1:e,(e=+o[A+8>>3]+ +p(+(s<-1?-1:s),+(e<-1?-1:e)))>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);return void(o[r+8>>3]=e)}e=+o[A>>3]+t,o[r>>3]=e,i=r}while(0);if(+l(+(e+-1.5707963267948966))<1e-16)return o[i>>3]=1.5707963267948966,void(o[r+8>>3]=0);if(+l(+(e+1.5707963267948966))<1e-16)return o[i>>3]=-1.5707963267948966,void(o[r+8>>3]=0);if((e=+o[A+8>>3])>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);o[r+8>>3]=e}(15600+(e<<4)|0,+ne(+o[15920+(24*e|0)>>3]-u),s,i)}function jA(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,s,l,c,u,d,f,g,h,m,b,p,v,y,w,x,k,C,B,D,E,j,Q=0,N=0,F=0,P=0,T=0,L=0;if(j=S,S=S+272|0,P=j+240|0,B=j,D=j+224|0,E=j+208|0,b=j+176|0,p=j+160|0,v=j+192|0,y=j+144|0,w=j+128|0,x=j+112|0,k=j+96|0,C=j+80|0,n[(Q=j+256|0)>>2]=e,n[P>>2]=n[A>>2],n[P+4>>2]=n[A+4>>2],n[P+8>>2]=n[A+8>>2],n[P+12>>2]=n[A+12>>2],QA(P,Q,B),n[i>>2]=0,(0|(P=r+t+(5==(0|r)&1)|0))<=(0|t))S=j;else{s=D+4|0,l=b+4|0,c=t+5|0,u=16880+((a=0|n[Q>>2])<<2)|0,d=16960+(a<<2)|0,f=w+8|0,g=x+8|0,h=k+8|0,m=E+4|0,F=t;A:for(;;){N=B+((0|F)%5<<4)|0,n[E>>2]=n[N>>2],n[E+4>>2]=n[N+4>>2],n[E+8>>2]=n[N+8>>2],n[E+12>>2]=n[N+12>>2];do{}while(2==(0|NA(E,a,0,1)));if((0|F)>(0|t)&!!(0|ZA(e))){if(n[b>>2]=n[E>>2],n[b+4>>2]=n[E+4>>2],n[b+8>>2]=n[E+8>>2],n[b+12>>2]=n[E+12>>2],oA(s,p),r=0|n[b>>2],Q=0|n[17040+(80*r|0)+(n[D>>2]<<2)>>2],n[b>>2]=n[18640+(80*r|0)+(20*Q|0)>>2],(0|(N=0|n[18640+(80*r|0)+(20*Q|0)+16>>2]))>0){A=0;do{bA(l),A=A+1|0}while((0|A)<(0|N))}switch(N=18640+(80*r|0)+(20*Q|0)+4|0,n[v>>2]=n[N>>2],n[v+4>>2]=n[N+4>>2],n[v+8>>2]=n[N+8>>2],sA(v,3*(0|n[u>>2])|0),iA(l,v,l),nA(l),oA(l,y),T=+(0|n[d>>2]),o[w>>3]=3*T,o[f>>3]=0,L=-1.5*T,o[x>>3]=L,o[g>>3]=2.598076211353316*T,o[k>>3]=L,o[h>>3]=-2.598076211353316*T,0|n[17040+(80*(0|n[b>>2])|0)+(n[E>>2]<<2)>>2]){case 1:A=x,r=w;break;case 3:A=k,r=x;break;case 2:A=w,r=k;break;default:A=12;break A}Qe(p,y,r,A,C),EA(C,0|n[b>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])}if((0|F)<(0|c)&&(oA(m,b),EA(b,0|n[E>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])),n[D>>2]=n[E>>2],n[D+4>>2]=n[E+4>>2],n[D+8>>2]=n[E+8>>2],n[D+12>>2]=n[E+12>>2],(0|(F=F+1|0))>=(0|P)){A=3;break}}3!=(0|A)?12==(0|A)&&M(26970,27017,572,27027):S=j}}function QA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=S,S=S+128|0,i=r,s=20240,l=60+(a=o=r+64|0)|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));s=20304,l=(a=i)+60|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));o=(l=!(0|ZA(0|n[e>>2])))?o:i,wA(i=A+4|0),xA(i),0|ZA(0|n[e>>2])&&(hA(i),n[e>>2]=1+(0|n[e>>2])),n[t>>2]=n[A>>2],iA(i,o,e=t+4|0),nA(e),n[t+16>>2]=n[A>>2],iA(i,o+12|0,e=t+20|0),nA(e),n[t+32>>2]=n[A>>2],iA(i,o+24|0,e=t+36|0),nA(e),n[t+48>>2]=n[A>>2],iA(i,o+36|0,e=t+52|0),nA(e),n[t+64>>2]=n[A>>2],iA(i,o+48|0,t=t+68|0),nA(t),S=r}function NA(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c,u=0,d=0,f=0,g=0,h=0;if(c=S,S=S+32|0,l=c+12|0,i=c,h=4+(A|=0)|0,g=0|n[16960+((e|=0)<<2)>>2],g=(s=!!(0|r))?3*g|0:g,u=0|n[h>>2],o=0|n[(a=A+8|0)>>2],s){if((0|(u=o+u+(r=0|n[(d=A+12|0)>>2])|0))==(0|g))return S=c,1;f=d}else u=o+u+(r=0|n[(f=A+12|0)>>2])|0;if((0|u)<=(0|g))return S=c,0;do{if((0|r)>0){if(r=0|n[A>>2],(0|o)>0){d=18640+(80*r|0)+60|0,r=A;break}r=18640+(80*r|0)+40|0,t?(rA(l,g,0,0),aA(h,l,i),pA(i),iA(i,l,h),d=r,r=A):(d=r,r=A)}else d=18640+(80*(0|n[A>>2])|0)+20|0,r=A}while(0);if(n[r>>2]=n[d>>2],(0|n[(u=d+16|0)>>2])>0){r=0;do{bA(h),r=r+1|0}while((0|r)<(0|n[u>>2]))}return A=d+4|0,n[l>>2]=n[A>>2],n[l+4>>2]=n[A+4>>2],n[l+8>>2]=n[A+8>>2],e=0|n[16880+(e<<2)>>2],sA(l,s?3*e|0:e),iA(h,l,h),nA(h),r=s&&((0|n[a>>2])+(0|n[h>>2])+(0|n[f>>2])|0)==(0|g)?1:2,S=c,0|r}function SA(A,e){A|=0,e|=0;var t=0;do{t=0|NA(A,e,0,1)}while(2==(0|t));return 0|t}function FA(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,s,l,c,u,d,f,g,h,m,b,p,v,y,w,x,k,C,B=0,D=0,E=0,j=0,Q=0;if(C=S,S=S+240|0,y=C+208|0,w=C,x=C+192|0,k=C+176|0,h=C+160|0,m=C+144|0,b=C+128|0,p=C+112|0,v=C+96|0,n[(B=C+224|0)>>2]=e,n[y>>2]=n[A>>2],n[y+4>>2]=n[A+4>>2],n[y+8>>2]=n[A+8>>2],n[y+12>>2]=n[A+12>>2],PA(y,B,w),n[i>>2]=0,(0|(g=r+t+(6==(0|r)&1)|0))<=(0|t))S=C;else{s=t+6|0,l=16960+((a=0|n[B>>2])<<2)|0,c=m+8|0,u=b+8|0,d=p+8|0,f=x+4|0,D=0,E=t,r=-1;A:for(;;){if(A=w+((B=(0|E)%6|0)<<4)|0,n[x>>2]=n[A>>2],n[x+4>>2]=n[A+4>>2],n[x+8>>2]=n[A+8>>2],n[x+12>>2]=n[A+12>>2],A=D,D=0|NA(x,a,0,1),(0|E)>(0|t)&!!(0|ZA(e))&&1!=(0|A)&&(0|n[x>>2])!=(0|r)){switch(oA(w+((B+5|0)%6<<4)+4|0,k),oA(w+(B<<4)+4|0,h),j=+(0|n[l>>2]),o[m>>3]=3*j,o[c>>3]=0,Q=-1.5*j,o[b>>3]=Q,o[u>>3]=2.598076211353316*j,o[p>>3]=Q,o[d>>3]=-2.598076211353316*j,B=0|n[y>>2],0|n[17040+(80*B|0)+(((0|r)==(0|B)?n[x>>2]:r)<<2)>>2]){case 1:A=b,r=m;break;case 3:A=p,r=b;break;case 2:A=m,r=p;break;default:A=8;break A}Qe(k,h,r,A,v),0|Ne(k,v)||0|Ne(h,v)||(EA(v,0|n[y>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2]))}if((0|E)<(0|s)&&(oA(f,k),EA(k,0|n[x>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])),(0|(E=E+1|0))>=(0|g)){A=3;break}r=0|n[x>>2]}3!=(0|A)?8==(0|A)&&M(27054,27017,737,27099):S=C}}function PA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=S,S=S+160|0,i=r,s=20368,l=72+(a=o=r+80|0)|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));s=20448,l=(a=i)+72|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));o=(l=!(0|ZA(0|n[e>>2])))?o:i,wA(i=A+4|0),xA(i),0|ZA(0|n[e>>2])&&(hA(i),n[e>>2]=1+(0|n[e>>2])),n[t>>2]=n[A>>2],iA(i,o,e=t+4|0),nA(e),n[t+16>>2]=n[A>>2],iA(i,o+12|0,e=t+20|0),nA(e),n[t+32>>2]=n[A>>2],iA(i,o+24|0,e=t+36|0),nA(e),n[t+48>>2]=n[A>>2],iA(i,o+36|0,e=t+52|0),nA(e),n[t+64>>2]=n[A>>2],iA(i,o+48|0,e=t+68|0),nA(e),n[t+80>>2]=n[A>>2],iA(i,o+60|0,t=t+84|0),nA(t),S=r}function TA(A,e){return e=0|tt(0|(A|=0),0|(e|=0),45),B(),127&e}function LA(A,e){A|=0;var t=0,n=0,o=0,i=0;return!0&134217728==(-16777216&(e|=0))?(n=0|tt(0|A,0|e,52),B(),n&=15,t=0|tt(0|A,0|e,45),B(),(t&=127)>>>0>121?0|(A=0):!(613566756&(i=0|rt(0|(o=0|tt(0|A,0|e,0|(i=3*(15^n)|0))),0|B(),0|i))&Ze(-1227133514,-1171,0|i,0|(o=0|B())))&!(4681&o&B())&&15==(0|n)|!(0|(i=0|tt(0|rt(0|~A,0|~e,0|(i=19+(3*n|0)|0)),0|B(),0|i)))&!(0|B())?0|r[20528+t|0]?!(0|A)&!(0|(e&=8191))?0|(i=1):(i=0|nt(0|A,0|e),B(),0|!!((63-i|0)%3|0)):0|(i=1):0|(i=0)):0|(A=0)}function RA(A,e,t,r){A|=0,t|=0,r|=0;var o=0,i=0,a=0,s=0;if(o=0|rt(0|(e|=0),0,52),i=0|B(),t=0|rt(0|t,0,45),t=0|i|B()|134225919,(0|e)<1)return i=-1,r=t,n[(e=A)>>2]=i,void(n[(A=A+4|0)>>2]=r);for(i=1,o=-1;s=0|rt(7,0,0|(a=3*(15-i|0)|0)),t&=~B(),o=o&~s|(a=0|rt(0|r,0,0|a)),t=0|t|B(),(0|i)!=(0|e);)i=i+1|0;n[(a=s=A)>>2]=o,n[(s=s+4|0)>>2]=t}function IA(A,e,t,r){t|=0,r|=0;var o=0,i=0;if(i=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return 4;if((0|(i&=15))<(0|t))return 12;if((0|i)==(0|t))return n[r>>2]=A,n[r+4>>2]=e,0;if(o=0|rt(0|t,0,52),o|=A,A=B()|-15728641&e,(0|i)>(0|t))do{e=0|rt(7,0,3*(14-t|0)|0),t=t+1|0,o|=e,A=0|B()|A}while((0|t)<(0|i));return n[r>>2]=o,n[r+4>>2]=A,0}function _A(A,e,t,r){t|=0,r|=0;var o=0,i=0,a=0;if(i=0|tt(0|(A|=0),0|(e|=0),52),B(),!((0|t)<16&(0|(i&=15))<=(0|t)))return 4;o=t-i|0,t=0|tt(0|A,0|e,45),B();A:do{if(0|H(127&t)){e:do{if(0|i){for(t=1;!((a=0|rt(7,0,3*(15-t|0)|0))&A)&!((0|B())&e);){if(!(t>>>0>>0))break e;t=t+1|0}t=0|pe(7,0,o,((0|o)<0)<<31>>31),o=0|B();break A}}while(0);t=0|Ve(0|(t=0|qe(0|(t=0|pe(7,0,o,((0|o)<0)<<31>>31)),0|B(),5,0)),0|B(),-5,-1),t=0|Ve(0|(t=0|Xe(0|t,0|B(),6,0)),0|B(),1,0),o=0|B()}else t=0|pe(7,0,o,((0|o)<0)<<31>>31),o=0|B()}while(0);return n[(a=r)>>2]=t,n[a+4>>2]=o,0}function zA(A,e){var t=0,r=0,n=0;if(n=0|tt(0|(A|=0),0|(e|=0),45),B(),!(0|H(127&n)))return 0;n=0|tt(0|A,0|e,52),B(),n&=15;A:do{if(n)for(r=1;;){if(t=0|tt(0|A,0|e,3*(15-r|0)|0),B(),0|(t&=7))break A;if(!(r>>>0>>0)){t=0;break}r=r+1|0}else t=0}while(0);return 1&!(0|t)}function HA(A,e,t,r){return A|=0,e|=0,(0|(r|=0))<(0|(t|=0))?(r=A,C(0|(t=e)),0|r):(t=0|rt(-1,-1,3+(3*(r-t|0)|0)|0),r=0|rt(0|~t,0|~B(),3*(15-r|0)|0),t=~B()&e,r=~r&A,C(0|t),0|r)}function GA(A,e,t,r){t|=0,r|=0;var o=0;return o=0|tt(0|(A|=0),0|(e|=0),52),B(),(0|t)<16&(0|(o&=15))<=(0|t)?((0|o)<(0|t)&&(o=0|rt(-1,-1,3+(3*(t+-1-o|0)|0)|0),o=0|rt(0|~o,0|~B(),3*(15-t|0)|0),e=~B()&e,A&=~o),o=0|rt(0|t,0,52),t=-15728641&e|B(),n[r>>2]=A|o,n[r+4>>2]=t,0|(r=0)):0|(r=4)}function OA(A,e){var t=0,r=0,n=0;if(n=0|tt(0|(A|=0),0|(e|=0),52),B(),!(n&=15))return 0;for(r=1;;){if(t=0|tt(0|A,0|e,3*(15-r|0)|0),B(),0|(t&=7)){r=5;break}if(!(r>>>0>>0)){t=0,r=5;break}r=r+1|0}return 5==(0|r)?0|t:0}function UA(A,e){var t=0,r=0,n=0,o=0,i=0,a=0,s=0;if(s=0|tt(0|(A|=0),0|(e|=0),52),B(),!(s&=15))return s=A,C(0|(a=e)),0|s;for(a=1,t=0;;){r=0|rt(7,0,0|(o=3*(15-a|0)|0)),n=0|B(),i=0|tt(0|A,0|e,0|o),B(),A=(o=0|rt(0|vA(7&i),0,0|o))|A&~r,e=(i=0|B())|e&~n;A:do{if(!t)if(!(o&r|0)&!(i&n|0))t=0;else if(r=0|tt(0|A,0|e,52),B(),r&=15){t=1;e:for(;;){switch(i=0|tt(0|A,0|e,3*(15-t|0)|0),B(),7&i){case 1:break e;case 0:break;default:t=1;break A}if(!(t>>>0>>0)){t=1;break A}t=t+1|0}for(t=1;;){if(n=0|tt(0|A,0|e,0|(i=3*(15-t|0)|0)),B(),o=0|rt(7,0,0|i),e&=~B(),A=A&~o|(i=0|rt(0|vA(7&n),0,0|i)),e=0|e|B(),!(t>>>0>>0)){t=1;break}t=t+1|0}}else t=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return C(0|e),0|A}function YA(A,e){var t=0,r=0,n=0,o=0,i=0;if(r=0|tt(0|(A|=0),0|(e|=0),52),B(),!(r&=15))return r=A,C(0|(t=e)),0|r;for(t=1;i=0|tt(0|A,0|e,0|(o=3*(15-t|0)|0)),B(),n=0|rt(7,0,0|o),e&=~B(),A=(o=0|rt(0|vA(7&i),0,0|o))|A&~n,e=0|B()|e,t>>>0>>0;)t=t+1|0;return C(0|e),0|A}function WA(A,e){var t=0,r=0,n=0,o=0,i=0,a=0,s=0;if(s=0|tt(0|(A|=0),0|(e|=0),52),B(),!(s&=15))return s=A,C(0|(a=e)),0|s;for(a=1,t=0;;){r=0|rt(7,0,0|(o=3*(15-a|0)|0)),n=0|B(),i=0|tt(0|A,0|e,0|o),B(),A=(o=0|rt(0|yA(7&i),0,0|o))|A&~r,e=(i=0|B())|e&~n;A:do{if(!t)if(!(o&r|0)&!(i&n|0))t=0;else if(r=0|tt(0|A,0|e,52),B(),r&=15){t=1;e:for(;;){switch(i=0|tt(0|A,0|e,3*(15-t|0)|0),B(),7&i){case 1:break e;case 0:break;default:t=1;break A}if(!(t>>>0>>0)){t=1;break A}t=t+1|0}for(t=1;;){if(o=0|rt(7,0,0|(n=3*(15-t|0)|0)),i=e&~B(),e=0|tt(0|A,0|e,0|n),B(),A=A&~o|(e=0|rt(0|yA(7&e),0,0|n)),e=0|i|B(),!(t>>>0>>0)){t=1;break}t=t+1|0}}else t=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return C(0|e),0|A}function VA(A,e){var t=0,r=0,n=0,o=0,i=0;if(r=0|tt(0|(A|=0),0|(e|=0),52),B(),!(r&=15))return r=A,C(0|(t=e)),0|r;for(t=1;o=0|rt(7,0,0|(i=3*(15-t|0)|0)),n=e&~B(),e=0|tt(0|A,0|e,0|i),B(),A=(e=0|rt(0|yA(7&e),0,0|i))|A&~o,e=0|B()|n,t>>>0>>0;)t=t+1|0;return C(0|e),0|A}function ZA(A){return(0|(A|=0))%2|0}function KA(A,e,t){t|=0;var r,i=0;return r=S,S=S+16|0,i=r,(e|=0)>>>0>15?(S=r,0|(i=4)):2146435072&~n[4+(A|=0)>>2]&&2146435072&~n[A+8+4>>2]?(function(A,e,t){var r,i;r=S,S=S+16|0,function(A,e,t,r){e|=0,r|=0;var i,a=0,s=0,l=0,c=0;if(i=S,S=S+16|0,function(A,e,t){e|=0,t|=0;var r,i,a=0;i=S,S=S+32|0,function(A,e){e|=0;var t,r,n=0;n=+o[(A|=0)>>3],t=+d(+n),n=+f(+n),o[e+16>>3]=n,n=+o[A+8>>3],r=t*+d(+n),o[e>>3]=r,n=t*+f(+n),o[e+8>>3]=n}(A|=0,r=i),n[e>>2]=0,o[t>>3]=5,(a=+Se(16400,r))<+o[t>>3]&&(n[e>>2]=0,o[t>>3]=a),(a=+Se(16424,r))<+o[t>>3]&&(n[e>>2]=1,o[t>>3]=a),(a=+Se(16448,r))<+o[t>>3]&&(n[e>>2]=2,o[t>>3]=a),(a=+Se(16472,r))<+o[t>>3]&&(n[e>>2]=3,o[t>>3]=a),(a=+Se(16496,r))<+o[t>>3]&&(n[e>>2]=4,o[t>>3]=a),(a=+Se(16520,r))<+o[t>>3]&&(n[e>>2]=5,o[t>>3]=a),(a=+Se(16544,r))<+o[t>>3]&&(n[e>>2]=6,o[t>>3]=a),(a=+Se(16568,r))<+o[t>>3]&&(n[e>>2]=7,o[t>>3]=a),(a=+Se(16592,r))<+o[t>>3]&&(n[e>>2]=8,o[t>>3]=a),(a=+Se(16616,r))<+o[t>>3]&&(n[e>>2]=9,o[t>>3]=a),(a=+Se(16640,r))<+o[t>>3]&&(n[e>>2]=10,o[t>>3]=a),(a=+Se(16664,r))<+o[t>>3]&&(n[e>>2]=11,o[t>>3]=a),(a=+Se(16688,r))<+o[t>>3]&&(n[e>>2]=12,o[t>>3]=a),(a=+Se(16712,r))<+o[t>>3]&&(n[e>>2]=13,o[t>>3]=a),(a=+Se(16736,r))<+o[t>>3]&&(n[e>>2]=14,o[t>>3]=a),(a=+Se(16760,r))<+o[t>>3]&&(n[e>>2]=15,o[t>>3]=a),(a=+Se(16784,r))<+o[t>>3]&&(n[e>>2]=16,o[t>>3]=a),(a=+Se(16808,r))<+o[t>>3]&&(n[e>>2]=17,o[t>>3]=a),(a=+Se(16832,r))<+o[t>>3]&&(n[e>>2]=18,o[t>>3]=a),(a=+Se(16856,r))<+o[t>>3]?(n[e>>2]=19,o[t>>3]=a,S=i):S=i}(A|=0,t|=0,c=i),(s=+h(+(1-.5*+o[c>>3])))<1e-16)return n[r>>2]=0,n[r+4>>2]=0,n[r+8>>2]=0,n[r+12>>2]=0,void(S=i);if(c=0|n[t>>2],a=+ne((a=+o[15920+(24*c|0)>>3])-+ne(+function(A,e){var t,r,n,i,a;return A|=0,i=+o[(e|=0)>>3],r=+d(+i),n=+o[e+8>>3]-+o[A+8>>3],a=r*+f(+n),t=+o[A>>3],+ +p(+a,+(+f(+i)*+d(+t)-+d(+n)*(r*+f(+t))))}(15600+(c<<4)|0,A))),l=0|ZA(e)?+ne(a+-.3334731722518321):a,a=2.618033988749896*+g(+s),(0|e)>0){A=0;do{a*=2.6457513110645907,A=A+1|0}while((0|A)!=(0|e))}s=+d(+l)*a,o[r>>3]=s,l=+f(+l)*a,o[r+8>>3]=l,S=i}(A|=0,e|=0,t|=0,i=r),function(A,e){A|=0;var t,r,i,a,s=0,c=0,u=0,d=0,f=0,g=0,h=0;n[(a=8+(e|=0)|0)>>2]=0,r=+o[A>>3],d=+l(+r),i=+o[A+8>>3],d+=.5*(f=1.1547005383792515*+l(+i)),d-=+(0|(s=~~d)),f-=+(0|(A=~~f));do{if(d<.5){if(d<.3333333333333333){if(n[e>>2]=s,f<.5*(d+1)){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(A=(1&!(f<(h=1-d)))+A|0,n[e+4>>2]=A,h<=f&f<2*d){s=s+1|0,n[e>>2]=s;break}n[e>>2]=s;break}if(!(d<.6666666666666666)){if(s=s+1|0,n[e>>2]=s,f<.5*d){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(f<1-d){if(n[e+4>>2]=A,2*d-1>2]=s;break}}else A=A+1|0,n[e+4>>2]=A;s=s+1|0,n[e>>2]=s}while(0);do{if(r<0){if(1&A){s=~~(+(0|s)-(2*(+((g=0|Ze(0|s,((0|s)<0)<<31>>31,0|(g=(A+1|0)/2|0),((0|g)<0)<<31>>31))>>>0)+4294967296*+(0|B()))+1)),n[e>>2]=s;break}s=~~(+(0|s)-2*(+((g=0|Ze(0|s,((0|s)<0)<<31>>31,0|(g=(0|A)/2|0),((0|g)<0)<<31>>31))>>>0)+4294967296*+(0|B()))),n[e>>2]=s;break}}while(0);g=e+4|0,i<0&&(s=s-((1|A<<1)/2|0)|0,n[e>>2]=s,A=0-A|0,n[g>>2]=A),c=A-s|0,(0|s)<0?(u=0-s|0,n[g>>2]=c,n[a>>2]=u,n[e>>2]=0,A=c,s=0):u=0,(0|A)<0&&(s=s-A|0,n[e>>2]=s,u=u-A|0,n[a>>2]=u,n[g>>2]=0,A=0),t=s-u|0,c=A-u|0,(0|u)<0&&(n[e>>2]=t,n[g>>2]=c,n[a>>2]=0,A=c,s=t,u=0),(0|(c=(0|u)<(0|(c=(0|A)<(0|s)?A:s))?u:c))<=0||(n[e>>2]=s-c,n[g>>2]=A-c,n[a>>2]=u-c)}(i,t+4|0),S=r}(A,e,i),e=0|function(A,e){A|=0;var t,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0;if(t=S,S=S+64|0,l=t+40|0,o=t+24|0,i=t+12|0,a=t,rt(0|(e|=0),0,52),r=134225919|B(),!e)return(0|n[A+4>>2])>2||(0|n[A+8>>2])>2||(0|n[A+12>>2])>2?(l=0,C(0|(s=0)),S=t,0|l):(rt(0|O(A),0,45),s=0|B()|r,l=-1,C(0|s),S=t,0|l);if(n[l>>2]=n[A>>2],n[l+4>>2]=n[A+4>>2],n[l+8>>2]=n[A+8>>2],n[l+12>>2]=n[A+12>>2],s=l+4|0,(0|e)>0)for(A=-1;n[o>>2]=n[s>>2],n[o+4>>2]=n[s+4>>2],n[o+8>>2]=n[s+8>>2],1&e?(dA(s),n[i>>2]=n[s>>2],n[i+4>>2]=n[s+4>>2],n[i+8>>2]=n[s+8>>2],gA(i)):(fA(s),n[i>>2]=n[s>>2],n[i+4>>2]=n[s+4>>2],n[i+8>>2]=n[s+8>>2],hA(i)),aA(o,i,a),nA(a),c=0|rt(7,0,0|(u=3*(15-e|0)|0)),r&=~B(),A=(u=0|rt(0|lA(a),0,0|u))|A&~c,r=0|B()|r,(0|e)>1;)e=e+-1|0;else A=-1;A:do{if((0|n[s>>2])<=2&&(0|n[l+8>>2])<=2&&(0|n[l+12>>2])<=2){if(e=0|rt(0|(o=0|O(l)),0,45),e|=A,A=B()|-1040385&r,a=0|U(l),!(0|H(o))){if((0|a)<=0)break;for(i=0;;){if(o=0|tt(0|e,0|A,52),B(),o&=15)for(r=1;l=0|tt(0|e,0|A,0|(u=3*(15-r|0)|0)),B(),c=0|rt(7,0,0|u),A&=~B(),e=e&~c|(u=0|rt(0|vA(7&l),0,0|u)),A=0|A|B(),r>>>0>>0;)r=r+1|0;if((0|(i=i+1|0))==(0|a))break A}}i=0|tt(0|e,0|A,52),B(),i&=15;e:do{if(i){r=1;t:for(;;){switch(u=0|tt(0|e,0|A,3*(15-r|0)|0),B(),7&u){case 1:break t;case 0:break;default:break e}if(!(r>>>0>>0))break e;r=r+1|0}if(0|Y(o,0|n[l>>2]))for(r=1;c=0|rt(7,0,0|(l=3*(15-r|0)|0)),u=A&~B(),A=0|tt(0|e,0|A,0|l),B(),e=e&~c|(A=0|rt(0|yA(7&A),0,0|l)),A=0|u|B(),r>>>0>>0;)r=r+1|0;else for(r=1;l=0|tt(0|e,0|A,0|(u=3*(15-r|0)|0)),B(),c=0|rt(7,0,0|u),A&=~B(),e=e&~c|(u=0|rt(0|vA(7&l),0,0|u)),A=0|A|B(),r>>>0>>0;)r=r+1|0}}while(0);if((0|a)>0){r=0;do{e=0|UA(e,A),A=0|B(),r=r+1|0}while((0|r)!=(0|a))}}else e=0,A=0}while(0);return u=e,C(0|(c=A)),S=t,0|u}(i,e),i=0|B(),n[t>>2]=e,n[t+4>>2]=i,!(0|e)&!(0|i)&&M(27795,27122,1050,27145),S=r,0|(i=0)):(S=r,0|(i=3))}function JA(A,e,t){var r,o=0,i=0,a=0;if(r=4+(t|=0)|0,i=0|tt(0|(A|=0),0|(e|=0),52),B(),i&=15,a=0|tt(0|A,0|e,45),B(),o=!(0|i),0|H(127&a)){if(o)return 1;o=1}else{if(o)return 0;o=0|n[r>>2]||0|n[t+8>>2]?1:1&!!(0|n[t+12>>2])}for(t=1;1&t?gA(r):hA(r),a=0|tt(0|A,0|e,3*(15-t|0)|0),B(),mA(r,7&a),t>>>0>>0;)t=t+1|0;return 0|o}function XA(A,e,t){t|=0;var r,o,i=0,a=0,s=0,l=0,c=0,u=0;if(o=S,S=S+16|0,r=o,u=0|tt(0|(A|=0),0|(e|=0),45),B(),(u&=127)>>>0>121)return n[t>>2]=0,n[t+4>>2]=0,n[t+8>>2]=0,n[t+12>>2]=0,S=o,5;A:do{if(0|H(u)&&(s=0|tt(0|A,0|e,52),B(),0|(s&=15))){i=1;e:for(;;){switch(c=0|tt(0|A,0|e,3*(15-i|0)|0),B(),7&c){case 5:break e;case 0:break;default:i=e;break A}if(!(i>>>0>>0)){i=e;break A}i=i+1|0}for(a=1,i=e;l=0|rt(7,0,0|(e=3*(15-a|0)|0)),c=i&~B(),i=0|tt(0|A,0|i,0|e),B(),A=A&~l|(i=0|rt(0|yA(7&i),0,0|e)),i=0|c|B(),a>>>0>>0;)a=a+1|0}else i=e}while(0);if(c=7696+(28*u|0)|0,n[t>>2]=n[c>>2],n[t+4>>2]=n[c+4>>2],n[t+8>>2]=n[c+8>>2],n[t+12>>2]=n[c+12>>2],!(0|JA(A,i,t)))return S=o,0;if(l=t+4|0,n[r>>2]=n[l>>2],n[r+4>>2]=n[l+4>>2],n[r+8>>2]=n[l+8>>2],s=0|tt(0|A,0|i,52),B(),c=15&s,1&s?(hA(l),s=c+1|0):s=c,0|H(u)){A:do{if(c)for(e=1;;){if(a=0|tt(0|A,0|i,3*(15-e|0)|0),B(),0|(a&=7)){i=a;break A}if(!(e>>>0>>0)){i=0;break}e=e+1|0}else i=0}while(0);i=4==(0|i)&1}else i=0;if(0|NA(t,s,i,0)){if(0|H(u))do{}while(0|NA(t,s,0,0));(0|s)!=(0|c)&&fA(l)}else(0|s)!=(0|c)&&(n[l>>2]=n[r>>2],n[l+4>>2]=n[r+4>>2],n[l+8>>2]=n[r+8>>2]);return S=o,0}function qA(A,e,t){t|=0;var r,o,i=0;return o=S,S=S+16|0,0|(i=0|XA(A|=0,e|=0,r=o))?(S=o,0|i):(i=0|tt(0|A,0|e,52),B(),function(A,e,t){var r,o;e|=0,t|=0,r=S,S=S+16|0,oA(4+(A|=0)|0,o=r),EA(o,0|n[A>>2],e,0,t),S=r}(r,15&i,t),S=o,0|(i=0))}function $A(A,e,t){t|=0;var r,n=0,o=0,i=0;if(r=S,S=S+16|0,0|(n=0|XA(A|=0,e|=0,i=r)))return S=r,0|n;n=0|tt(0|A,0|e,45),B(),n=!(0|H(127&n)),o=0|tt(0|A,0|e,52),B(),o&=15;A:do{if(!n){if(0|o)for(n=1;;){if(!(!((0|rt(7,0,3*(15-n|0)|0))&A)&!((0|B())&e)))break A;if(!(n>>>0>>0))break;n=n+1|0}return jA(i,o,0,5,t),S=r,0}}while(0);return FA(i,o,0,6,t),S=r,0}function Ae(A,e){e|=0;var t=0,r=0,o=0,i=0,a=0,s=0,l=0;if((A|=0)>>>0>15)return 4;if(rt(0|A,0,52),s=134225919|B(),!A){t=0,r=0;do{0|H(r)&&(rt(0|r,0,45),a=0|s|B(),n[(A=e+(t<<3)|0)>>2]=-1,n[A+4>>2]=a,t=t+1|0),r=r+1|0}while(122!=(0|r));return 0}t=0,a=0;do{if(0|H(a)){for(rt(0|a,0,45),r=1,o=-1,i=0|s|B();o&=~(l=0|rt(7,0,3*(15-r|0)|0)),i&=~B(),(0|r)!=(0|A);)r=r+1|0;n[(l=e+(t<<3)|0)>>2]=o,n[l+4>>2]=i,t=t+1|0}a=a+1|0}while(122!=(0|a));return 0}function ee(A,e,t,r){A|=0,r|=0;var o=0,i=0,a=0;o=0|tt(0|(e|=0),0|(t|=0),52),B(),!(0|e)&!(0|t)|(0|r)>15|(0|(o&=15))>(0|r)?(i=-1,e=-1,t=0,o=0):(e=0|HA(e,t,o+1|0,r),a=-15728641&B(),t=0|rt(0|r,0,52),i=o,e=(e=!(0|zA(t|=e,a=0|a|B())))?-1:r,o=a),n[(a=A)>>2]=t,n[a+4>>2]=o,n[A+8>>2]=i,n[A+12>>2]=e}function te(A,e,t,r){t|=0,r|=0;var o=0,i=0;return o=0|tt(0|(A|=0),0|(e|=0),52),B(),o&=15,n[(i=r+8|0)>>2]=o,!(0|A)&!(0|e)|(0|t)>15|(0|o)>(0|t)?(n[(t=r)>>2]=0,n[t+4>>2]=0,n[i>>2]=-1,void(n[r+12>>2]=-1)):(A=0|HA(A,e,o+1|0,t),i=-15728641&B(),o=0|rt(0|t,0,52),o|=A,i=0|i|B(),n[(A=r)>>2]=o,n[A+4>>2]=i,A=r+12|0,0|zA(o,i)?void(n[A>>2]=t):void(n[A>>2]=-1))}function re(A){var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0,c=0;if(!(!(0|(t=0|n[(r=A|=0)>>2]))&!(0|(r=0|n[r+4>>2]))||(o=0|tt(0|t,0|r,52),B(),t=0|Ve(0|(l=0|rt(1,0,3*(15^(o&=15))|0)),0|B(),0|t,0|r),r=0|B(),n[(l=A)>>2]=t,n[l+4>>2]=r,(0|o)<(0|(s=0|n[(l=A+8|0)>>2]))))){for(e=A+12|0,a=o;;){if((0|a)==(0|s)){o=5;break}if(c=(0|a)==(0|n[e>>2]),o=0|tt(0|t,0|r,0|(i=3*(15-a|0)|0)),B(),c&1==(0|(o&=7))&!0){o=7;break}if(!(7==(0|o)&!0)){o=10;break}if(t=0|Ve(0|t,0|r,0|(c=0|rt(1,0,0|i)),0|B()),r=0|B(),n[(c=A)>>2]=t,n[c+4>>2]=r,!((0|a)>(0|s))){o=10;break}a=a+-1|0}if(5==(0|o))return n[(c=A)>>2]=0,n[c+4>>2]=0,n[l>>2]=-1,void(n[e>>2]=-1);if(7==(0|o))return s=0|Ve(0|t,0|r,0|(s=0|rt(1,0,0|i)),0|B()),l=0|B(),n[(c=A)>>2]=s,n[c+4>>2]=l,void(n[e>>2]=a+-1)}}function ne(A){var e;return e=(A=+A)<0?A+6.283185307179586:A,+(A>=6.283185307179586?e+-6.283185307179586:e)}function oe(A,e){return e|=0,+l(+(+o[(A|=0)>>3]-+o[e>>3]))<17453292519943298e-27?0|(e=+l(+(+o[A+8>>3]-+o[e+8>>3]))<17453292519943298e-27):0|(e=0)}function ie(A,e){switch(A=+A,0|(e|=0)){case 1:A=A<0?A+6.283185307179586:A;break;case 2:A=A>0?A+-6.283185307179586:A}return+A}function ae(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+f(.5*(r-t)))*n+(i=+f(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+d(+r)*+d(+t)*i),2*+p(+ +c(+i),+ +c(+(1-i)))*6371.007180918475}function se(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20656+(A<<3)>>3],0|(e=0))}function le(A,e){e|=0;var t=0;return(A|=0)>>>0>15?0|(e=4):(t=0|qe(0|(t=0|pe(7,0,A,((0|A)<0)<<31>>31)),0|B(),120,0),A=0|B(),n[e>>2]=2|t,n[e+4>>2]=A,0|(e=0))}function ce(A,e,t){A|=0,t|=0;var r,n,i,a,s=0,l=0,u=0,h=0,m=0,v=0;return v=+o[(e|=0)>>3],i=+o[A>>3],m=+f(.5*(v-i)),u=+o[e+8>>3],n=+o[A+8>>3],h=+f(.5*(u-n)),r=+d(+i),a=+d(+v),h=2*+p(+ +c(+(h=m*m+h*(a*r*h))),+ +c(+(1-h))),m=+o[t>>3],v=+f(.5*(m-v)),s=+o[t+8>>3],u=+f(.5*(s-u)),l=+d(+m),u=2*+p(+ +c(+(u=v*v+u*(a*l*u))),+ +c(+(1-u))),m=+f(.5*(i-m)),s=+f(.5*(n-s)),s=2*+p(+ +c(+(s=m*m+s*(r*l*s))),+ +c(+(1-s))),4*+b(+ +c(+ +g(.5*(l=.5*(h+u+s)))*+g(.5*(l-h))*+g(.5*(l-u))*+g(.5*(l-s))))}function ue(A,e,t){t|=0;var r,i,a,s=0,l=0;if(a=S,S=S+192|0,i=a,0|(l=0|qA(A|=0,e|=0,r=a+168|0)))return S=a,0|l;if(0|$A(A,e,i)&&M(27795,27190,415,27199),(0|(e=0|n[i>>2]))>0){if(s=+ce(i+8|0,i+8+((1!=(0|e)&1)<<4)|0,r)+0,1!=(0|e)){A=1;do{s+=+ce(i+8+((l=A)<<4)|0,i+8+((0|(A=A+1|0))%(0|e)<<4)|0,r)}while((0|A)<(0|e))}}else s=0;return o[t>>3]=s,S=a,0}function de(A){A|=0;var e,t,r=0;return(e=0|We(1,12))||M(27280,27235,49,27293),0|(r=0|n[(t=A+4|0)>>2])?(n[(r=r+8|0)>>2]=e,n[t>>2]=e,0|e):(0|n[A>>2]&&M(27310,27235,61,27333),n[(r=A)>>2]=e,n[t>>2]=e,0|e)}function fe(A,e){var t,r;return A|=0,e|=0,(r=0|Ue(24))||M(27347,27235,78,27361),n[r>>2]=n[e>>2],n[r+4>>2]=n[e+4>>2],n[r+8>>2]=n[e+8>>2],n[r+12>>2]=n[e+12>>2],n[r+16>>2]=0,0|(t=0|n[(e=A+4|0)>>2])?(n[t+16>>2]=r,n[e>>2]=r,0|r):(0|n[A>>2]&&M(27376,27235,82,27361),n[A>>2]=r,n[e>>2]=r,0|r)}function ge(A){var e=0,t=0,r=0,o=0;if(A|=0)for(r=1;;){if(0|(e=0|n[A>>2]))do{if(0|(t=0|n[e>>2]))do{o=t,t=0|n[t+16>>2],Ye(o)}while(0|t);o=e,e=0|n[e+8>>2],Ye(o)}while(0|e);if(e=A,A=0|n[A+8>>2],r||Ye(e),!A)break;r=0}}function he(A,e,t){A|=0;var r=0,i=0,a=0,s=0,l=0,c=0,u=0,d=0;if(!(0|X(e|=0,t|=0)))return 0;if(e=0|K(e),r=+o[t>>3],i=e&(i=+o[t+8>>3])<0?i+6.283185307179586:i,!(A=0|n[A>>2]))return 0;if(e){e=0,u=i,t=A;A:for(;;){for(;s=+o[t>>3],i=+o[t+8>>3],d=0|n[(t=t+16|0)>>2],a=+o[(d=0|d?d:A)>>3],l=+o[d+8>>3],s>a?(c=s,s=l):(c=a,a=s,s=i,i=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(t=0|n[t>>2])){t=22;break A}if(((c=(l=s<0?s+6.283185307179586:s)+(r-a)/(c-a)*((s=i<0?i+6.283185307179586:i)-l))<0?c+6.283185307179586:c)>(u=l==u|s==u?u+-2220446049250313e-31:u)&&(e^=1),!(t=0|n[t>>2])){t=22;break}}if(22==(0|t))return 0|e}else{e=0,u=i,t=A;A:for(;;){for(;s=+o[t>>3],i=+o[t+8>>3],d=0|n[(t=t+16|0)>>2],a=+o[(d=0|d?d:A)>>3],l=+o[d+8>>3],s>a?(c=s,s=l):(c=a,a=s,s=i,i=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(t=0|n[t>>2])){t=22;break A}if(s+(r-a)/(c-a)*(i-s)>(u=s==u|i==u?u+-2220446049250313e-31:u)&&(e^=1),!(t=0|n[t>>2])){t=22;break}}if(22==(0|t))return 0|e}return 0}function me(A,e,t,o,i){t|=0,o|=0,i|=0;var a,s,l,c,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0;if(c=S,S=S+32|0,y=c+16|0,l=c,u=0|tt(0|(A|=0),0|(e|=0),52),B(),u&=15,b=0|tt(0|t,0|o,52),B(),(0|u)!=(15&b))return S=c,12;if(h=0|tt(0|A,0|e,45),B(),h&=127,m=0|tt(0|t,0|o,45),B(),h>>>0>121|(m&=127)>>>0>121)return S=c,5;if(b=(0|h)!=(0|m)){if(7==(0|(f=0|V(h,m))))return S=c,1;7==(0|(g=0|V(m,h)))?M(27514,27538,161,27548):(p=f,d=g)}else p=0,d=0;a=0|H(h),s=0|H(m),n[y>>2]=0,n[y+4>>2]=0,n[y+8>>2]=0,n[y+12>>2]=0;do{if(p){if(f=(0|(m=0|n[4272+(28*h|0)+(p<<2)>>2]))>0,s)if(f){h=0,g=t,f=o;do{g=0|WA(g,f),f=0|B(),1==(0|(d=0|yA(d)))&&(d=0|yA(1)),h=h+1|0}while((0|h)!=(0|m));m=d,h=g,g=f}else m=d,h=t,g=o;else if(f){h=0,g=t,f=o;do{g=0|VA(g,f),f=0|B(),d=0|yA(d),h=h+1|0}while((0|h)!=(0|m));m=d,h=g,g=f}else m=d,h=t,g=o;if(JA(h,g,y),b||M(27563,27538,191,27548),(f=!!(0|a))&(d=!!(0|s))&&M(27590,27538,192,27548),f){if(7==(0|(d=0|OA(A,e)))){u=5;break}if(0|r[22e3+(7*d|0)+p|0]){u=1;break}h=g=0|n[21168+(28*d|0)+(p<<2)>>2]}else if(d){if(7==(0|(d=0|OA(h,g)))){u=5;break}if(0|r[22e3+(7*d|0)+m|0]){u=1;break}h=0,g=0|n[21168+(28*m|0)+(d<<2)>>2]}else h=0,g=0;if((h|g|0)<0)u=5;else{if((0|g)>0){f=y+4|0,d=0;do{pA(f),d=d+1|0}while((0|d)!=(0|g))}if(n[l>>2]=0,n[l+4>>2]=0,n[l+8>>2]=0,mA(l,p),0|u)for(;0|ZA(u)?gA(l):hA(l),(0|u)>1;)u=u+-1|0;if((0|h)>0){u=0;do{pA(l),u=u+1|0}while((0|u)!=(0|h))}iA(v=y+4|0,l,v),nA(v),v=51}}else if(JA(t,o,y),!!(0|a)&!!(0|s))if((0|m)!=(0|h)&&M(27621,27538,261,27548),7==(0|(d=0|OA(A,e)))|7==(0|(u=0|OA(t,o))))u=5;else if(0|r[22e3+(7*d|0)+u|0])u=1;else if((0|(d=0|n[21168+(28*d|0)+(u<<2)>>2]))>0){f=y+4|0,u=0;do{pA(f),u=u+1|0}while((0|u)!=(0|d));v=51}else v=51;else v=51}while(0);return 51==(0|v)&&(u=y+4|0,n[i>>2]=n[u>>2],n[i+4>>2]=n[u+4>>2],n[i+8>>2]=n[u+8>>2],u=0),S=c,0|u}function be(A,e,t,r){t|=0,r|=0;var o,i,a,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0;if(a=S,S=S+48|0,o=a+36|0,c=a+24|0,u=a+12|0,d=a,s=0|tt(0|(A|=0),0|(e|=0),52),B(),s&=15,g=0|tt(0|A,0|e,45),B(),(g&=127)>>>0>121)return S=a,5;if(i=0|H(g),rt(0|s,0,52),b=134225919|B(),n[(l=r)>>2]=-1,n[l+4>>2]=b,!s)return 7==(0|(s=0|lA(t)))||127==(0|(s=0|W(g,s)))?(S=a,0|(b=1)):(h=0|rt(0|s,0,45),m=0|B(),m=-1040385&n[(g=r)+4>>2]|m,n[(b=r)>>2]=n[g>>2]|h,n[b+4>>2]=m,S=a,0|(b=0));for(n[o>>2]=n[t>>2],n[o+4>>2]=n[t+4>>2],n[o+8>>2]=n[t+8>>2],t=s;;){if(l=t,t=t+-1|0,n[c>>2]=n[o>>2],n[c+4>>2]=n[o+4>>2],n[c+8>>2]=n[o+8>>2],0|ZA(l)){if(0|(s=0|cA(o))){t=13;break}n[u>>2]=n[o>>2],n[u+4>>2]=n[o+4>>2],n[u+8>>2]=n[o+8>>2],gA(u)}else{if(0|(s=0|uA(o))){t=13;break}n[u>>2]=n[o>>2],n[u+4>>2]=n[o+4>>2],n[u+8>>2]=n[o+8>>2],hA(u)}if(aA(c,u,d),nA(d),v=0|n[(s=r)>>2],s=0|n[s+4>>2],p=0|rt(7,0,0|(y=3*(15-l|0)|0)),s&=~B(),y=0|rt(0|lA(d),0,0|y),s=0|B()|s,n[(b=r)>>2]=y|v&~p,n[b+4>>2]=s,(0|l)<=1){t=14;break}}A:do{if(13!=(0|t)&&14==(0|t))if((0|n[o>>2])<=1&&(0|n[o+4>>2])<=1&&(0|n[o+8>>2])<=1){d=127==(0|(s=0|W(g,t=0|lA(o))))?0:0|H(s);e:do{if(t){if(i){if(7==(0|(s=0|OA(A,e)))){s=5;break A}if((0|(l=0|n[21376+(28*s|0)+(t<<2)>>2]))>0){s=t,t=0;do{s=0|vA(s),t=t+1|0}while((0|t)!=(0|l))}else s=t;if(1==(0|s)){s=9;break A}127==(0|(t=0|W(g,s)))&&M(27648,27538,411,27678),0|H(t)?M(27693,27538,412,27678):(m=t,h=l,f=s)}else m=s,h=0,f=t;if((0|(u=0|n[4272+(28*g|0)+(f<<2)>>2]))<=-1&&M(27724,27538,419,27678),!d){if((0|h)<0){s=5;break A}if(0|h){s=0,t=0|n[(l=r)>>2],l=0|n[l+4>>2];do{t=0|YA(t,l),l=0|B(),n[(y=r)>>2]=t,n[y+4>>2]=l,s=s+1|0}while((0|s)<(0|h))}if((0|u)<=0){s=m,t=58;break}for(s=0,t=0|n[(l=r)>>2],l=0|n[l+4>>2];;)if(t=0|YA(t,l),l=0|B(),n[(y=r)>>2]=t,n[y+4>>2]=l,(0|(s=s+1|0))==(0|u)){s=m,t=58;break e}}if(7==(0|(c=0|V(m,g)))&&M(27514,27538,428,27678),t=0|n[(s=r)>>2],s=0|n[s+4>>2],(0|u)>0){l=0;do{t=0|YA(t,s),s=0|B(),n[(y=r)>>2]=t,n[y+4>>2]=s,l=l+1|0}while((0|l)!=(0|u))}if(7==(0|(s=0|OA(t,s)))&&M(27795,27538,440,27678),t=0|G(m),(0|(t=0|n[(t?21792:21584)+(28*c|0)+(s<<2)>>2]))<0&&M(27795,27538,454,27678),t){s=0,l=0|n[(c=r)>>2],c=0|n[c+4>>2];do{l=0|UA(l,c),c=0|B(),n[(y=r)>>2]=l,n[y+4>>2]=c,s=s+1|0}while((0|s)<(0|t));s=m,t=58}else s=m,t=58}else if(!!(0|i)&!!(0|d)){if(7==(0|(t=0|OA(A,e)))|7==(0|(l=0|OA(0|n[(l=r)>>2],0|n[l+4>>2])))){s=5;break A}if((0|(l=0|n[21376+(28*t|0)+(l<<2)>>2]))<0){s=5;break A}if(l){t=0,c=0|n[(u=r)>>2],u=0|n[u+4>>2];do{c=0|YA(c,u),u=0|B(),n[(y=r)>>2]=c,n[y+4>>2]=u,t=t+1|0}while((0|t)<(0|l));t=58}else t=59}else t=58}while(0);if(58==(0|t)&&d&&(t=59),59==(0|t)&&1==(0|OA(0|n[(y=r)>>2],0|n[y+4>>2]))){s=9;break}p=0|n[(y=r)>>2],y=-1040385&n[y+4>>2],v=0|rt(0|s,0,45),y=0|y|B(),n[(s=r)>>2]=p|v,n[s+4>>2]=y,s=0}else s=1}while(0);return S=a,0|s}function pe(A,e,t,r){A|=0,e|=0;var n=0,o=0,i=0;if(!(0|(t|=0))&!(0|(r|=0)))return o=1,C(0|(n=0)),0|o;o=A,n=e,A=1,e=0;do{A=0|qe(0|((i=!0&!(1&t))?1:o),0|(i?0:n),0|A,0|e),e=0|B(),t=0|et(0|t,0|r,1),r=0|B(),o=0|qe(0|o,0|n,0|o,0|n),n=0|B()}while(!(!(0|t)&!(0|r)));return C(0|e),0|A}function ve(A,e,t,r){t|=0,r|=0;var i,a=0,s=0,l=0,c=0,u=0,f=0;i=S,S=S+16|0,s=i,l=0|tt(0|(A|=0),0|(e|=0),52),B(),l&=15;do{if(l){if(!(a=0|qA(A,e,s))){u=+o[s>>3],c=1/+d(+u),f=+o[25968+(l<<3)>>3],o[t>>3]=u+f,o[t+8>>3]=u-f,u=+o[s+8>>3],c*=f,o[t+16>>3]=c+u,o[t+24>>3]=u-c;break}return S=i,0|a}if(a=0|tt(0|A,0|e,45),B(),(a&=127)>>>0>121)return S=i,5;s=22064+(a<<5)|0,n[t>>2]=n[s>>2],n[t+4>>2]=n[s+4>>2],n[t+8>>2]=n[s+8>>2],n[t+12>>2]=n[s+12>>2],n[t+16>>2]=n[s+16>>2],n[t+20>>2]=n[s+20>>2],n[t+24>>2]=n[s+24>>2],n[t+28>>2]=n[s+28>>2];break}while(0);return function(A,e){e=+e;var t,r,n,i,a,s,l,c=0,u=0;c=(i=+o[(n=16+(A|=0)|0)>>3])-(r=+o[(t=A+24|0)>>3]),c=i>3],c=.5*(c*e-c),u+=e=.5*((l=u-(s=+o[(a=A+8|0)>>3]))*e-l),o[A>>3]=u>1.5707963267948966?1.5707963267948966:u,e=s-e,o[a>>3]=e<-1.5707963267948966?-1.5707963267948966:e,e=(e=i+c)>3.141592653589793?e+-6.283185307179586:e,o[n>>3]=e<-3.141592653589793?e+6.283185307179586:e,e=(e=r-c)>3.141592653589793?e+-6.283185307179586:e,o[t>>3]=e<-3.141592653589793?e+6.283185307179586:e}(t,r?1.4:1.1),(0|n[(r=26096+(l<<3)|0)>>2])==(0|A)&&(0|n[r+4>>2])==(0|e)&&(o[t>>3]=1.5707963267948966),(0|n[(l=26224+(l<<3)|0)>>2])==(0|A)&&(0|n[l+4>>2])==(0|e)&&(o[t+8>>3]=-1.5707963267948966),1.5707963267948966!=+o[t>>3]&&-1.5707963267948966!=+o[t+8>>3]?(S=i,0|(l=0)):(o[t+16>>3]=3.141592653589793,o[t+24>>3]=-3.141592653589793,S=i,0|(l=0))}function ye(A){var e,t,o,i,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0;if(i=S,S=S+336|0,e=i+168|0,t=i,!(0|(s=0|n[(l=A|=0)>>2]))&!(0|(l=0|n[l+4>>2])))S=i;else{if(0|r[0|(a=A+28|0)]?(s=0|we(s,l),l=0|B()):r[0|a]=1,!(0|n[n[(o=A+20|0)>>2]>>2]))return 0|(s=0|n[(a=A+24|0)>>2])&&Ye(s),n[(x=A)>>2]=0,n[x+4>>2]=0,n[A+8>>2]=0,n[o>>2]=0,n[A+12>>2]=-1,n[A+16>>2]=0,n[a>>2]=0,void(S=i);c=15&(a=0|n[(x=A+16|0)>>2]);A:do{if(!(0|s)&!(0|l))w=A+24|0;else{v=A+12|0,b=3==(0|c),m=255&a,g=3==(1|c),p=A+24|0,h=(c+-1|0)>>>0<3,d=3==(2|c),f=t+8|0;e:for(;;){if(u=0|tt(0|s,0|l,52),B(),(0|(u&=15))==(0|n[v>>2])){switch(15&m){case 0:case 2:case 3:if(0|(c=0|qA(s,l,e))){y=15;break e}if(0|Me(0|n[o>>2],0|n[p>>2],e)){y=19;break e}}if(g&&(c=0|n[4+(0|n[o>>2])>>2],n[e>>2]=n[c>>2],n[e+4>>2]=n[c+4>>2],n[e+8>>2]=n[c+8>>2],n[e+12>>2]=n[c+12>>2],0|X(26832,e))){if(0|KA(0|n[4+(0|n[o>>2])>>2],u,t)){y=25;break}if((0|n[(c=t)>>2])==(0|s)&&(0|n[c+4>>2])==(0|l)){y=29;break}}if(h){if(0|(c=0|$A(s,l,e))){y=32;break}if(0|ve(s,l,t,0)){y=36;break}if(d&&0|De(0|n[o>>2],0|n[p>>2],e,t)){y=42;break}if(g&&0|je(0|n[o>>2],0|n[p>>2],e,t)){y=42;break}}if(b){if(a=0|ve(s,l,e,1),c=0|n[p>>2],0|a){y=45;break}if(0|q(c,e)){if(AA(t,e),0|$(e,0|n[p>>2])){y=53;break}if(0|Me(0|n[o>>2],0|n[p>>2],f)){y=53;break}if(0|je(0|n[o>>2],0|n[p>>2],t,e)){y=53;break}}}}do{if((0|u)<(0|n[v>>2])){if(a=0|ve(s,l,e,1),c=0|n[p>>2],0|a){y=58;break e}if(!(0|q(c,e))){y=73;break}if(0|$(0|n[p>>2],e)&&(AA(t,e),0|De(0|n[o>>2],0|n[p>>2],t,e))){y=65;break e}if(0|(s=0|GA(s,l,u+1|0,t))){y=67;break e}s=0|n[(l=t)>>2],l=0|n[l+4>>2]}else y=73}while(0);if(73==(0|y)&&(y=0,s=0|we(s,l),l=0|B()),!(0|s)&!(0|l)){w=p;break A}}switch(0|y){case 15:0|(a=0|n[p>>2])&&Ye(a),n[(y=A)>>2]=0,n[y+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[x>>2]=0,n[p>>2]=0,n[A+8>>2]=c,y=20;break;case 19:n[A>>2]=s,n[A+4>>2]=l,y=20;break;case 25:M(27795,27761,470,27772);break;case 29:case 42:return n[A>>2]=s,n[A+4>>2]=l,void(S=i);case 32:return 0|(a=0|n[p>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[x>>2]=0,n[p>>2]=0,n[A+8>>2]=c,void(S=i);case 36:M(27795,27761,493,27772);break;case 45:0|c&&Ye(c),n[(y=A)>>2]=0,n[y+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[x>>2]=0,n[p>>2]=0,n[A+8>>2]=a,y=55;break;case 53:n[A>>2]=s,n[A+4>>2]=l,y=55;break;case 58:0|c&&Ye(c),n[(y=A)>>2]=0,n[y+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[x>>2]=0,n[p>>2]=0,n[A+8>>2]=a,y=71;break;case 65:n[A>>2]=s,n[A+4>>2]=l,y=71;break;case 67:return 0|(a=0|n[p>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[x>>2]=0,n[p>>2]=0,n[A+8>>2]=s,void(S=i)}if(20==(0|y))return void(S=i);if(55==(0|y))return void(S=i);if(71==(0|y))return void(S=i)}}while(0);0|(a=0|n[w>>2])&&Ye(a),n[(y=A)>>2]=0,n[y+4>>2]=0,n[A+8>>2]=0,n[o>>2]=0,n[A+12>>2]=-1,n[x>>2]=0,n[w>>2]=0,S=i}}function we(A,e){var t,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0,d=0;t=S,S=S+16|0,d=t,o=0|tt(0|(A|=0),0|(e|=0),52),B(),o&=15,r=0|tt(0|A,0|e,45),B();do{if(o){for(;r=0|rt(o+4095|0,0,52),i=B()|-15728641&e,r=r|A|(s=0|rt(7,0,0|(a=3*(15-o|0)|0))),i|=l=0|B(),c=0|tt(0|A,0|e,0|a),B(),o=o+-1|0,!((c&=7)>>>0<6);){if(!o){u=4;break}e=i,A=r}if(4==(0|u)){r=0|tt(0|r,0|i,45),B();break}return d=0|rt(((d=!(0|c)&!!(0|zA(r,i)))?2:1)+c|0,0,0|a),u=0|B()|e&~l,d|=A&~s,C(0|u),S=t,0|d}}while(0);return(r&=127)>>>0>120?(d=0,C(0|(u=0)),S=t,0|d):(RA(d,0,r+1|0,0),u=0|n[d+4>>2],d=0|n[d>>2],C(0|u),S=t,0|d)}function xe(A,e,t){A|=0;var r,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0;if(!(0|X(e|=0,t|=0)))return 0;if(e=0|K(e),i=+o[t>>3],a=e&(a=+o[t+8>>3])<0?a+6.283185307179586:a,(0|(g=0|n[A>>2]))<=0)return 0;if(r=0|n[A+4>>2],e){e=0,f=a,t=-1,A=0;A:for(;;){for(d=A;l=+o[r+(d<<4)>>3],a=+o[r+(d<<4)+8>>3],s=+o[r+((A=(t+2|0)%(0|g)|0)<<4)>>3],c=+o[r+(A<<4)+8>>3],l>s?(u=l,l=c):(u=s,s=l,l=a,a=c),(i=i==s|i==u?i+2220446049250313e-31:i)u;){if((0|(t=d+1|0))>=(0|g)){t=22;break A}A=d,d=t,t=A}if(((u=(c=l<0?l+6.283185307179586:l)+(i-s)/(u-s)*((l=a<0?a+6.283185307179586:a)-c))<0?u+6.283185307179586:u)>(f=c==f|l==f?f+-2220446049250313e-31:f)&&(e^=1),(0|(A=d+1|0))>=(0|g)){t=22;break}t=d}if(22==(0|t))return 0|e}else{e=0,f=a,t=-1,A=0;A:for(;;){for(d=A;l=+o[r+(d<<4)>>3],a=+o[r+(d<<4)+8>>3],s=+o[r+((A=(t+2|0)%(0|g)|0)<<4)>>3],c=+o[r+(A<<4)+8>>3],l>s?(u=l,l=c):(u=s,s=l,l=a,a=c),(i=i==s|i==u?i+2220446049250313e-31:i)u;){if((0|(t=d+1|0))>=(0|g)){t=22;break A}A=d,d=t,t=A}if(l+(i-s)/(u-s)*(a-l)>(f=l==f|a==f?f+-2220446049250313e-31:f)&&(e^=1),(0|(A=d+1|0))>=(0|g)){t=22;break}t=d}if(22==(0|t))return 0|e}return 0}function ke(A,e){e|=0;var t,r,i,a,s,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0;if(!(r=0|n[(A|=0)>>2]))return n[e>>2]=0,n[e+4>>2]=0,n[e+8>>2]=0,n[e+12>>2]=0,n[e+16>>2]=0,n[e+20>>2]=0,n[e+24>>2]=0,void(n[e+28>>2]=0);if(o[(i=e+8|0)>>3]=17976931348623157e292,o[(a=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(s=e+16|0)>>3]=-17976931348623157e292,!((0|r)<=0)){for(t=0|n[A+4>>2],b=17976931348623157e292,p=-17976931348623157e292,v=0,A=-1,f=17976931348623157e292,g=17976931348623157e292,m=-17976931348623157e292,u=-17976931348623157e292,y=0;c=+o[t+(y<<4)>>3],h=+o[t+(y<<4)+8>>3],d=+o[t+(((0|(A=A+2|0))==(0|r)?0:A)<<4)+8>>3],c>3]=c,f=c),h>3]=h,g=h),c>m?o[e>>3]=c:c=m,h>u&&(o[s>>3]=h,u=h),b=h>0&hp?h:p,v|=+l(+(h-d))>3.141592653589793,(0|(A=y+1|0))!=(0|r);)w=y,m=c,y=A,A=w;v&&(o[s>>3]=p,o[a>>3]=b)}}function Ce(A){return 0|((A|=0)>>>0<4?0:15)}function Be(A,e){e|=0;var t,r=0,i=0,a=0,s=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0,k=0,C=0,B=0,M=0;if(p=0|n[(A|=0)>>2]){if(o[(v=e+8|0)>>3]=17976931348623157e292,o[(y=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(w=e+16|0)>>3]=-17976931348623157e292,(0|p)>0){for(a=0|n[A+4>>2],m=17976931348623157e292,b=-17976931348623157e292,i=0,r=-1,d=17976931348623157e292,f=17976931348623157e292,h=-17976931348623157e292,c=-17976931348623157e292,x=0;s=+o[a+(x<<4)>>3],g=+o[a+(x<<4)+8>>3],u=+o[a+(((0|(B=r+2|0))==(0|p)?0:B)<<4)+8>>3],s>3]=s,d=s),g>3]=g,f=g),s>h?o[e>>3]=s:s=h,g>c&&(o[w>>3]=g,c=g),m=g>0&gb?g:b,i|=+l(+(g-u))>3.141592653589793,(0|(r=x+1|0))!=(0|p);)B=x,h=s,x=r,r=B;i&&(o[w>>3]=b,o[y>>3]=m)}}else n[e>>2]=0,n[e+4>>2]=0,n[e+8>>2]=0,n[e+12>>2]=0,n[e+16>>2]=0,n[e+20>>2]=0,n[e+24>>2]=0,n[e+28>>2]=0;if(!((0|(r=0|n[(B=A+8|0)>>2]))<=0)){t=A+12|0,C=0;do{if(a=0|n[t>>2],i=C,y=e+((C=C+1|0)<<5)|0,w=0|n[a+(i<<3)>>2]){if(o[(x=e+(C<<5)+8|0)>>3]=17976931348623157e292,o[(A=e+(C<<5)+24|0)>>3]=17976931348623157e292,o[y>>3]=-17976931348623157e292,o[(k=e+(C<<5)+16|0)>>3]=-17976931348623157e292,(0|w)>0){for(p=0|n[a+(i<<3)+4>>2],m=17976931348623157e292,b=-17976931348623157e292,a=0,i=-1,v=0,d=17976931348623157e292,f=17976931348623157e292,g=-17976931348623157e292,c=-17976931348623157e292;s=+o[p+(v<<4)>>3],h=+o[p+(v<<4)+8>>3],u=+o[p+(((0|(i=i+2|0))==(0|w)?0:i)<<4)+8>>3],s>3]=s,d=s),h>3]=h,f=h),s>g?o[y>>3]=s:s=g,h>c&&(o[k>>3]=h,c=h),m=h>0&hb?h:b,a|=+l(+(h-u))>3.141592653589793,(0|(i=v+1|0))!=(0|w);)M=v,v=i,g=s,i=M;a&&(o[k>>3]=b,o[A>>3]=m)}}else n[y>>2]=0,n[y+4>>2]=0,n[y+8>>2]=0,n[y+12>>2]=0,n[y+16>>2]=0,n[y+20>>2]=0,n[y+24>>2]=0,n[y+28>>2]=0,r=0|n[B>>2]}while((0|C)<(0|r))}}function Me(A,e,t){var r=0,o=0,i=0;if(!(0|xe(A|=0,e|=0,t|=0)))return 0;if((0|n[(o=A+8|0)>>2])<=0)return 1;for(r=A+12|0,A=0;;){if(i=A,A=A+1|0,0|xe((0|n[r>>2])+(i<<3)|0,e+(A<<5)|0,t)){A=0,r=6;break}if((0|A)>=(0|n[o>>2])){A=1,r=6;break}}return 6==(0|r)?0|A:0}function De(A,e,t,r){r|=0;var o,i,a=0,s=0,l=0,c=0,u=0;if(i=S,S=S+16|0,o=i,!(0|xe(A|=0,e|=0,l=8+(t|=0)|0)))return S=i,0;c=A+8|0;A:do{if((0|n[c>>2])>0){for(s=A+12|0,a=0;;){if(u=a,a=a+1|0,0|xe((0|n[s>>2])+(u<<3)|0,e+(a<<5)|0,l)){a=0;break}if((0|a)>=(0|n[c>>2]))break A}return S=i,0|a}}while(0);if(0|Ee(A,e,t,r))return S=i,0;n[o>>2]=n[t>>2],n[o+4>>2]=l,a=0|n[c>>2];A:do{if((0|a)>0)for(A=A+12|0,l=0,s=a;;){if(a=0|n[A>>2],(0|n[a+(l<<3)>>2])>0){if(0|xe(o,r,0|n[a+(l<<3)+4>>2])){a=0;break A}if(a=l+1|0,0|Ee((0|n[A>>2])+(l<<3)|0,e+(a<<5)|0,t,r)){a=0;break A}s=0|n[c>>2]}else a=l+1|0;if(!((0|a)<(0|s))){a=1;break}l=a}else a=1}while(0);return S=i,0|a}function Ee(A,e,t,r){A|=0,t|=0;var i,a,s,l,c,u,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0,k=0,C=0,B=0,M=0;if(u=S,S=S+176|0,l=u+172|0,d=u+168|0,c=u,!(0|q(e|=0,r|=0)))return S=u,0;if(function(A,e,t,r){var i,a,s,l,c;e|=0,t|=0,r|=0,A=(a=+o[16+(A|=0)>>3])<(c=+o[A+24>>3]),i=(l=+o[e+16>>3])<(s=+o[e+24>>3]),e=c-l>2]=A?i|e?1:2:0,n[r>>2]=i?A?1:e?2:1:0}(e,r,l,d),st(0|c,0|t,168),(0|n[t>>2])>0){e=0;do{x=+ie(+o[(B=c+8+(e<<4)+8|0)>>3],0|n[d>>2]),o[B>>3]=x,e=e+1|0}while((0|e)<(0|n[t>>2]))}a=+o[r>>3],s=+o[r+8>>3],x=+ie(+o[r+16>>3],0|n[d>>2]),i=+ie(+o[r+24>>3],0|n[d>>2]);A:do{if((0|n[A>>2])>0){if(r=A+4|0,(0|(d=0|n[c>>2]))<=0)for(e=0;;)if((0|(e=e+1|0))>=(0|n[A>>2])){e=0;break A}for(t=0;;){if(e=0|n[r>>2],y=+o[e+(t<<4)>>3],w=+ie(+o[e+(t<<4)+8>>3],0|n[l>>2]),e=0|n[r>>2],B=(0|(t=t+1|0))%(0|n[A>>2])|0,f=+o[e+(B<<4)>>3],g=+ie(+o[e+(B<<4)+8>>3],0|n[l>>2]),!(y>=a)|!(f>=a)&&!(y<=s)|!(f<=s)&&!(w<=i)|!(g<=i)&&!(w>=x)|!(g>=x)){v=f-y,b=g-w,e=0;do{if(M=e,B=(0|(e=e+1|0))==(0|d)?0:e,f=+o[c+8+(M<<4)+8>>3],g=+o[c+8+(B<<4)+8>>3]-f,h=+o[c+8+(M<<4)>>3],!(0==(p=v*g-b*(m=+o[c+8+(B<<4)>>3]-h))||(k=w-f,C=y-h,m=(k*m-g*C)/p,m<0|m>1))&&(p=(v*k-b*C)/p)>=0&p<=1){e=1;break A}}while((0|e)<(0|d))}if((0|t)>=(0|n[A>>2])){e=0;break}}}else e=0}while(0);return S=u,0|e}function je(A,e,t,r){var o=0,i=0,a=0;if(0|Ee(A|=0,e|=0,t|=0,r|=0))return 1;if((0|n[(i=A+8|0)>>2])<=0)return 0;for(o=A+12|0,A=0;;){if(a=A,A=A+1|0,0|Ee((0|n[o>>2])+(a<<3)|0,e+(A<<5)|0,t,r)){A=1,o=6;break}if((0|A)>=(0|n[i>>2])){A=0,o=6;break}}return 6==(0|o)?0|A:0}function Qe(A,e,t,r,n){e|=0,t|=0,r|=0,n|=0;var i,a,s,l,c,u,d,f=0;l=+o[(A|=0)>>3],s=+o[e>>3]-l,a=+o[A+8>>3],i=+o[e+8>>3]-a,u=+o[t>>3],f=((f=+o[r>>3]-u)*(a-(d=+o[t+8>>3]))-(l-u)*(c=+o[r+8>>3]-d))/(s*c-i*f),o[n>>3]=l+s*f,o[n+8>>3]=a+i*f}function Ne(A,e){return e|=0,+l(+(+o[(A|=0)>>3]-+o[e>>3]))<1.1920928955078125e-7?0|(e=+l(+(+o[A+8>>3]-+o[e+8>>3]))<1.1920928955078125e-7):0|(e=0)}function Se(A,e){var t,r,n;return e|=0,+((n=+o[(A|=0)>>3]-+o[e>>3])*n+(r=+o[A+8>>3]-+o[e+8>>3])*r+(t=+o[A+16>>3]-+o[e+16>>3])*t)}function Fe(A,e,t){t|=0;var r,o,i,a,s=0,l=0,c=0,u=0;if(a=S,S=S+32|0,u=a,0|(s=0|XA(A|=0,e|=0,o=a+16|0)))return S=a,0|s;r=0|TA(A,e),i=0|OA(A,e),function(A,e){A=7696+(28*(A|=0)|0)|0,n[(e|=0)>>2]=n[A>>2],n[e+4>>2]=n[A+4>>2],n[e+8>>2]=n[A+8>>2],n[e+12>>2]=n[A+12>>2]}(r,u),s=0|function(A,e){A|=0;var t=0,r=0;if((e|=0)>>>0>20)return-1;do{if((0|n[11120+(216*e|0)>>2])!=(0|A))if((0|n[11120+(216*e|0)+8>>2])!=(0|A))if((0|n[11120+(216*e|0)+16>>2])!=(0|A))if((0|n[11120+(216*e|0)+24>>2])!=(0|A))if((0|n[11120+(216*e|0)+32>>2])!=(0|A))if((0|n[11120+(216*e|0)+40>>2])!=(0|A))if((0|n[11120+(216*e|0)+48>>2])!=(0|A))if((0|n[11120+(216*e|0)+56>>2])!=(0|A))if((0|n[11120+(216*e|0)+64>>2])!=(0|A))if((0|n[11120+(216*e|0)+72>>2])!=(0|A))if((0|n[11120+(216*e|0)+80>>2])!=(0|A))if((0|n[11120+(216*e|0)+88>>2])!=(0|A))if((0|n[11120+(216*e|0)+96>>2])!=(0|A))if((0|n[11120+(216*e|0)+104>>2])!=(0|A))if((0|n[11120+(216*e|0)+112>>2])!=(0|A))if((0|n[11120+(216*e|0)+120>>2])!=(0|A))if((0|n[11120+(216*e|0)+128>>2])!=(0|A)){if((0|n[11120+(216*e|0)+136>>2])!=(0|A)){if((0|n[11120+(216*e|0)+144>>2])==(0|A)){A=0,t=2,r=0;break}if((0|n[11120+(216*e|0)+152>>2])==(0|A)){A=0,t=2,r=1;break}if((0|n[11120+(216*e|0)+160>>2])==(0|A)){A=0,t=2,r=2;break}if((0|n[11120+(216*e|0)+168>>2])==(0|A)){A=1,t=2,r=0;break}if((0|n[11120+(216*e|0)+176>>2])==(0|A)){A=1,t=2,r=1;break}if((0|n[11120+(216*e|0)+184>>2])==(0|A)){A=1,t=2,r=2;break}if((0|n[11120+(216*e|0)+192>>2])==(0|A)){A=2,t=2,r=0;break}if((0|n[11120+(216*e|0)+200>>2])==(0|A)){A=2,t=2,r=1;break}if((0|n[11120+(216*e|0)+208>>2])==(0|A)){A=2,t=2,r=2;break}return-1}A=2,t=1,r=2}else A=2,t=1,r=1;else A=2,t=1,r=0;else A=1,t=1,r=2;else A=1,t=1,r=1;else A=1,t=1,r=0;else A=0,t=1,r=2;else A=0,t=1,r=1;else A=0,t=1,r=0;else A=2,t=0,r=2;else A=2,t=0,r=1;else A=2,t=0,r=0;else A=1,t=0,r=2;else A=1,t=0,r=1;else A=1,t=0,r=0;else A=0,t=0,r=2;else A=0,t=0,r=1;else A=0,t=0,r=0}while(0);return 0|n[11120+(216*e|0)+(72*t|0)+(24*A|0)+(r<<3)+4>>2]}(r,0|n[o>>2]);do{if(0|H(r)){switch(0|r){case 4:l=0;break;case 14:l=1;break;case 24:l=2;break;case 38:l=3;break;case 49:l=4;break;case 58:l=5;break;case 63:l=6;break;case 72:l=7;break;case 83:l=8;break;case 97:l=9;break;case 107:l=10;break;case 117:l=11;break;default:M(27795,27797,75,27806)}if(c=0|n[26416+(24*l|0)+8>>2],e=0|n[26416+(24*l|0)+16>>2],(0|(A=0|n[o>>2]))!=(0|n[u>>2])&&(u=0|G(r))|(0|(A=0|n[o>>2]))==(0|e)&&(s=(s+1|0)%6|0),3==(0|i)&(0|A)==(0|e)){s=(s+5|0)%6|0;break}5==(0|i)&(0|A)==(0|c)&&(s=(s+1|0)%6|0)}}while(0);return n[t>>2]=s,S=a,0}function Pe(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0;if(l=S,S=S+32|0,y=l+24|0,s=l+20|0,a=l+8|0,i=l+16|0,o=l,g=(g=!(0|zA(A|=0,e|=0)))?6:5,m=0|tt(0|A,0|e,52),B(),g>>>0<=t>>>0)return S=l,2;!(b=!(0|(m&=15)))&&!((p=0|rt(7,0,3*(15^m)|0))&A)&!((0|B())&e)?c=t:u=4;A:do{if(4==(0|u)){if((0|((c=!!(0|zA(A,e)))?4:5))<(0|t))return S=l,1;if(0|Fe(A,e,y))return S=l,1;if(u=(0|n[y>>2])+t|0,7==(0|(p=0|n[(c=c?26704+((0|u)%5<<2)|0:26736+((0|u)%6<<2)|0)>>2])))return S=l,1;n[s>>2]=0,c=0|R(A,e,p,s,a);do{if(!c){if(h=0|n[(f=a)>>2],u=(d=(f=0|n[f+4>>2])>>>0>>0|(0|f)==(0|e)&h>>>0>>0)?h:A,d=d?f:e,!b&&!(h&(b=0|rt(7,0,3*(15^m)|0)))&!(f&(0|B())))c=t;else{if(f=(t+-1+g|0)%(0|g)|0,c=0|zA(A,e),(0|f)<0&&M(27795,27797,248,27822),(0|((g=!!(0|c))?4:5))<(0|f)&&M(27795,27797,248,27822),0|Fe(A,e,y)&&M(27795,27797,248,27822),c=(0|n[y>>2])+f|0,7==(0|(f=0|n[(c=g?26704+((0|c)%5<<2)|0:26736+((0|c)%6<<2)|0)>>2]))&&M(27795,27797,248,27822),n[i>>2]=0,0|(c=0|R(A,e,f,i,o)))break;g=0|n[(h=o)>>2],h=0|n[h+4>>2];do{if(h>>>0>>0|(0|h)==(0|d)&g>>>0>>0){if(u=0|zA(g,h)?0|_(g,h,A,e):0|n[26800+(((0|n[i>>2])+(0|n[26768+(f<<2)>>2])|0)%6<<2)>>2],c=0|zA(g,h),(u+-1|0)>>>0>5){c=-1,u=g,d=h;break}if(1==(0|u)&(c=!!(0|c))){c=-1,u=g,d=h;break}do{if(!(0|Fe(g,h,y))){if(c){c=(5+(0|n[26352+(u<<2)>>2])-(0|n[y>>2])|0)%5|0;break}c=(6+(0|n[26384+(u<<2)>>2])-(0|n[y>>2])|0)%6|0;break}c=-1}while(0);u=g,d=h}else c=t}while(0);h=0|n[(f=a)>>2],f=0|n[f+4>>2]}if((0|u)==(0|h)&(0|d)==(0|f)){if(A=(g=!!(0|zA(h,f)))?0|_(h,f,A,e):0|n[26800+(((0|n[s>>2])+(0|n[26768+(p<<2)>>2])|0)%6<<2)>>2],c=0|zA(h,f),(A+-1|0)>>>0<=5&&!(1==(0|A)&(v=!!(0|c))))do{if(!(0|Fe(h,f,y))){if(v){c=(5+(0|n[26352+(A<<2)>>2])-(0|n[y>>2])|0)%5|0;break}c=(6+(0|n[26384+(A<<2)>>2])-(0|n[y>>2])|0)%6|0;break}c=-1}while(0);else c=-1;c=6==(0|(c=c+1|0))|g&5==(0|c)?0:c}e=d,A=u;break A}}while(0);return S=l,0|c}}while(0);return v=0|rt(0|c,0,56),y=B()|-2130706433&e|536870912,n[r>>2]=v|A,n[r+4>>2]=y,S=l,0}function Te(A,e){A|=0;var t,r,o=0,i=0;return r=S,S=S+16|0,t=r,!0&536870912==(2013265920&(e|=0))&&0|LA(A,o=-2130706433&e|134217728)?(i=0|tt(0|A,0|e,56),B(),o=(i=!(0|Pe(A,o,7&i,t)))&((0|n[(o=t)>>2])==(0|A)?(0|n[o+4>>2])==(0|e):0)&1,S=r,0|o):(S=r,0|(o=0))}function Le(A,e,t){A|=0,t|=0;var r=0;(0|(e|=0))>0?(r=0|We(e,4),n[A>>2]=r,r||M(27835,27858,40,27872)):n[A>>2]=0,n[A+4>>2]=e,n[A+8>>2]=0,n[A+12>>2]=t}function Re(A){var e,t,r,i=0,a=0,s=0,c=0;e=4+(A|=0)|0,t=A+12|0,r=A+8|0;A:for(;;){for(a=0|n[e>>2],i=0;;){if((0|i)>=(0|a))break A;if(s=0|n[A>>2],c=0|n[s+(i<<2)>>2])break;i=i+1|0}i=s+(~~(+l(+ +u(10,+ +(15-(0|n[t>>2])|0))*(+o[c>>3]+ +o[c+8>>3]))%+(0|a))>>>0<<2)|0,a=0|n[i>>2];e:do{if(0|a){if(s=c+32|0,(0|a)==(0|c))n[i>>2]=n[s>>2];else{if(!(i=0|n[(a=a+32|0)>>2]))break;for(;(0|i)!=(0|c);)if(!(i=0|n[(a=i+32|0)>>2]))break e;n[a>>2]=n[s>>2]}Ye(c),n[r>>2]=(0|n[r>>2])-1}}while(0)}Ye(0|n[A>>2])}function Ie(A){var e,t=0,r=0;for(e=0|n[4+(A|=0)>>2],r=0;;){if((0|r)>=(0|e)){t=0,r=4;break}if(t=0|n[(0|n[A>>2])+(r<<2)>>2]){r=4;break}r=r+1|0}return 4==(0|r)?0|t:0}function _e(A,e){e|=0;var t=0,r=0,i=0,a=0;if(t=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,t=(0|n[A>>2])+(t<<2)|0,!(r=0|n[t>>2]))return 1;a=e+32|0;do{if((0|r)!=(0|e)){if(!(t=0|n[r+32>>2]))return 1;for(i=t;;){if((0|i)==(0|e)){i=8;break}if(!(t=0|n[i+32>>2])){t=1,i=10;break}r=i,i=t}if(8==(0|i)){n[r+32>>2]=n[a>>2];break}if(10==(0|i))return 0|t}else n[t>>2]=n[a>>2]}while(0);return Ye(e),n[(a=A+8|0)>>2]=(0|n[a>>2])-1,0}function ze(A,e,t){A|=0,e|=0,t|=0;var r,i=0,a=0,s=0;(r=0|Ue(40))||M(27888,27858,98,27901),n[r>>2]=n[e>>2],n[r+4>>2]=n[e+4>>2],n[r+8>>2]=n[e+8>>2],n[r+12>>2]=n[e+12>>2],n[(a=r+16|0)>>2]=n[t>>2],n[a+4>>2]=n[t+4>>2],n[a+8>>2]=n[t+8>>2],n[a+12>>2]=n[t+12>>2],n[r+32>>2]=0,a=~~(+l(+ +u(10,+ +(15-(0|n[A+12>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,a=(0|n[A>>2])+(a<<2)|0,i=0|n[a>>2];do{if(i){for(;!(0|oe(i,e)&&0|oe(i+16|0,t));)if(a=0|n[i+32>>2],!(0|n[(i=0|a?a:i)+32>>2])){s=10;break}if(10==(0|s)){n[i+32>>2]=r;break}return Ye(r),0|i}n[a>>2]=r}while(0);return n[(s=A+8|0)>>2]=1+(0|n[s>>2]),0|r}function He(A,e,t){e|=0,t|=0;var r=0,i=0;if(i=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,!(i=0|n[(0|n[A>>2])+(i<<2)>>2]))return 0;if(!t){for(A=i;;){if(0|oe(A,e)){r=10;break}if(!(A=0|n[A+32>>2])){A=0,r=10;break}}if(10==(0|r))return 0|A}for(A=i;;){if(0|oe(A,e)&&0|oe(A+16|0,t)){r=10;break}if(!(A=0|n[A+32>>2])){A=0,r=10;break}}return 10==(0|r)?0|A:0}function Ge(A,e){e|=0;var t=0;if(t=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,!(A=0|n[(0|n[A>>2])+(t<<2)>>2]))return 0;for(;;){if(0|oe(A,e)){e=5;break}if(!(A=0|n[A+32>>2])){A=0,e=5;break}}return 5==(0|e)?0|A:0}function Oe(A){return 0|+ct(+(A=+A))}function Ue(A){A|=0;var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0;e=S,S=S+16|0,g=e;do{if(A>>>0<245){if(A=(u=A>>>0<11?16:A+11&-8)>>>3,3&(r=(f=0|n[6981])>>>A))return o=0|n[(r=8+(A=27964+((t=(1&r^1)+A|0)<<1<<2)|0)|0)>>2],(0|(a=0|n[(i=o+8|0)>>2]))==(0|A)?n[6981]=f&~(1<>2]=A,n[r>>2]=a),x=t<<3,n[o+4>>2]=3|x,n[(x=o+x+4|0)>>2]=1|n[x>>2],S=e,0|i;if(u>>>0>(d=0|n[6983])>>>0){if(0|r)return t=((t=r<>>=l=t>>>12&16)>>>5&8)|l|(a=(t>>>=r)>>>2&4)|(A=(t>>>=a)>>>1&2)|(o=(t>>>=A)>>>1&1))+(t>>>o)|0)<<1<<2)|0)|0)>>2],(0|(r=0|n[(l=a+8|0)>>2]))==(0|t)?(A=f&~(1<>2]=t,n[A>>2]=r,A=f),s=(x=o<<3)-u|0,n[a+4>>2]=3|u,n[4+(i=a+u|0)>>2]=1|s,n[a+x>>2]=s,0|d&&(o=0|n[6986],r=27964+((t=d>>>3)<<1<<2)|0,A&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=o,n[t+12>>2]=o,n[o+8>>2]=t,n[o+12>>2]=r),n[6983]=s,n[6986]=i,S=e,0|l;if(a=0|n[6982]){for(r=(a&0-a)-1|0,r=c=0|n[28228+(((o=(r>>>=i=r>>>12&16)>>>5&8)|i|(s=(r>>>=o)>>>2&4)|(l=(r>>>=s)>>>1&2)|(c=(r>>>=l)>>>1&1))+(r>>>c)<<2)>>2],l=c,c=(-8&n[c+4>>2])-u|0;(A=0|n[r+16>>2])||(A=0|n[r+20>>2]);)r=A,l=(i=(s=(-8&n[A+4>>2])-u|0)>>>0>>0)?A:l,c=i?s:c;if((s=l+u|0)>>>0>l>>>0){i=0|n[l+24>>2],t=0|n[l+12>>2];do{if((0|t)==(0|l)){if(!(t=0|n[(A=l+20|0)>>2])&&!(t=0|n[(A=l+16|0)>>2])){r=0;break}for(;;)if(r=0|n[(o=t+20|0)>>2])t=r,A=o;else{if(!(r=0|n[(o=t+16|0)>>2]))break;t=r,A=o}n[A>>2]=0,r=t}else r=0|n[l+8>>2],n[r+12>>2]=t,n[t+8>>2]=r,r=t}while(0);do{if(0|i){if(t=0|n[l+28>>2],(0|l)==(0|n[(A=28228+(t<<2)|0)>>2])){if(n[A>>2]=r,!r){n[6982]=a&~(1<>2])==(0|l)?x:i+20)>>2]=r,!r)break;n[r+24>>2]=i,0|(t=0|n[l+16>>2])&&(n[r+16>>2]=t,n[t+24>>2]=r),0|(t=0|n[l+20>>2])&&(n[r+20>>2]=t,n[t+24>>2]=r)}}while(0);return c>>>0<16?(x=c+u|0,n[l+4>>2]=3|x,n[(x=l+x+4|0)>>2]=1|n[x>>2]):(n[l+4>>2]=3|u,n[s+4>>2]=1|c,n[s+c>>2]=c,0|d&&(o=0|n[6986],r=27964+((t=d>>>3)<<1<<2)|0,(t=1<>2]:(n[6981]=t|f,t=r,A=r+8|0),n[A>>2]=o,n[t+12>>2]=o,n[o+8>>2]=t,n[o+12>>2]=r),n[6983]=c,n[6986]=s),S=e,0|l+8}f=u}else f=u}else f=u}else if(A>>>0<=4294967231)if(u=-8&(A=A+11|0),o=0|n[6982]){i=0-u|0,c=(A>>>=8)?u>>>0>16777215?31:u>>>(7+(c=14-((l=(520192+(b=A<<(f=(A+1048320|0)>>>16&8))|0)>>>16&4)|f|(c=(245760+(b<<=l)|0)>>>16&2))+(b<>>15)|0)|0)&1|c<<1:0,r=0|n[28228+(c<<2)>>2];A:do{if(r)for(A=0,l=u<<(31==(0|c)?0:25-(c>>>1)|0),a=0;;){if((s=(-8&n[r+4>>2])-u|0)>>>0>>0){if(!s){A=r,i=0,b=65;break A}A=r,i=s}if(a=!(0|(b=0|n[r+20>>2]))|(0|b)==(0|(r=0|n[r+16+(l>>>31<<2)>>2]))?a:b,!r){r=a,b=61;break}l<<=1}else r=0,A=0,b=61}while(0);if(61==(0|b)){if(!(0|r)&!(0|A)){if(!(A=((A=2<>>=s=f>>>12&16)>>>5&8)|s|(l=(f>>>=a)>>>2&4)|(c=(f>>>=l)>>>1&2)|(r=(f>>>=c)>>>1&1))+(f>>>r)<<2)>>2]}r?b=65:(l=A,s=i)}if(65==(0|b))for(a=r;;){if(i=(r=(f=(-8&n[a+4>>2])-u|0)>>>0>>0)?f:i,A=r?a:A,(r=0|n[a+16>>2])||(r=0|n[a+20>>2]),!r){l=A,s=i;break}a=r}if(0|l&&s>>>0<((0|n[6983])-u|0)>>>0&&(d=l+u|0)>>>0>l>>>0){a=0|n[l+24>>2],t=0|n[l+12>>2];do{if((0|t)==(0|l)){if(!(t=0|n[(A=l+20|0)>>2])&&!(t=0|n[(A=l+16|0)>>2])){t=0;break}for(;;)if(r=0|n[(i=t+20|0)>>2])t=r,A=i;else{if(!(r=0|n[(i=t+16|0)>>2]))break;t=r,A=i}n[A>>2]=0}else x=0|n[l+8>>2],n[x+12>>2]=t,n[t+8>>2]=x}while(0);do{if(a){if(A=0|n[l+28>>2],(0|l)==(0|n[(r=28228+(A<<2)|0)>>2])){if(n[r>>2]=t,!t){o&=~(1<>2])==(0|l)?x:a+20)>>2]=t,!t)break;n[t+24>>2]=a,0|(A=0|n[l+16>>2])&&(n[t+16>>2]=A,n[A+24>>2]=t),(A=0|n[l+20>>2])&&(n[t+20>>2]=A,n[A+24>>2]=t)}}while(0);A:do{if(s>>>0<16)x=s+u|0,n[l+4>>2]=3|x,n[(x=l+x+4|0)>>2]=1|n[x>>2];else{if(n[l+4>>2]=3|u,n[d+4>>2]=1|s,n[d+s>>2]=s,t=s>>>3,s>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=d,n[t+12>>2]=d,n[d+8>>2]=t,n[d+12>>2]=r;break}if(t=28228+((r=(t=s>>>8)?s>>>0>16777215?31:s>>>(7+(r=14-((y=(520192+(x=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(r=(245760+(x<<=y)|0)>>>16&2))+(x<>>15)|0)|0)&1|r<<1:0)<<2)|0,n[d+28>>2]=r,n[4+(A=d+16|0)>>2]=0,n[A>>2]=0,!(o&(A=1<>2]=d,n[d+24>>2]=t,n[d+12>>2]=d,n[d+8>>2]=d;break}t=0|n[t>>2];e:do{if((-8&n[t+4>>2])!=(0|s)){for(o=s<<(31==(0|r)?0:25-(r>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|s)){t=A;break e}o<<=1,t=A}n[r>>2]=d,n[d+24>>2]=t,n[d+12>>2]=d,n[d+8>>2]=d;break A}}while(0);x=0|n[(w=t+8|0)>>2],n[x+12>>2]=d,n[w>>2]=d,n[d+8>>2]=x,n[d+12>>2]=t,n[d+24>>2]=0}}while(0);return S=e,0|l+8}f=u}else f=u;else f=-1}while(0);if((r=0|n[6983])>>>0>=f>>>0)return t=r-f|0,A=0|n[6986],t>>>0>15?(x=A+f|0,n[6986]=x,n[6983]=t,n[x+4>>2]=1|t,n[A+r>>2]=t,n[A+4>>2]=3|f):(n[6983]=0,n[6986]=0,n[A+4>>2]=3|r,n[(x=A+r+4|0)>>2]=1|n[x>>2]),S=e,0|A+8;if((s=0|n[6984])>>>0>f>>>0)return y=s-f|0,n[6984]=y,w=(x=0|n[6987])+f|0,n[6987]=w,n[w+4>>2]=1|y,n[x+4>>2]=3|f,S=e,0|x+8;if(0|n[7099]?A=0|n[7101]:(n[7101]=4096,n[7100]=4096,n[7102]=-1,n[7103]=-1,n[7104]=0,n[7092]=0,n[7099]=-16&g^1431655768,A=4096),l=f+48|0,(u=(a=A+(c=f+47|0)|0)&(i=0-A|0))>>>0<=f>>>0)return S=e,0;if(0|(A=0|n[7091])&&(g=(d=0|n[7089])+u|0)>>>0<=d>>>0|g>>>0>A>>>0)return S=e,0;A:do{if(4&n[7092])t=0,b=143;else{r=0|n[6987];e:do{if(r){for(o=28372;!((g=0|n[o>>2])>>>0<=r>>>0&&(g+(0|n[o+4>>2])|0)>>>0>r>>>0);){if(!(A=0|n[o+8>>2])){b=128;break e}o=A}if((t=a-s&i)>>>0<2147483647)if((0|(A=0|ut(0|t)))==((0|n[o>>2])+(0|n[o+4>>2])|0)){if(-1!=(0|A)){s=t,a=A,b=145;break A}}else o=A,b=136;else t=0}else b=128}while(0);do{if(128==(0|b))if(-1!=(0|(r=0|ut(0)))&&(t=r,m=(t=((m=(h=0|n[7100])-1|0)&t?(m+t&0-h)-t|0:0)+u|0)+(h=0|n[7089])|0,t>>>0>f>>>0&t>>>0<2147483647)){if(0|(g=0|n[7091])&&m>>>0<=h>>>0|m>>>0>g>>>0){t=0;break}if((0|(A=0|ut(0|t)))==(0|r)){s=t,a=r,b=145;break A}o=A,b=136}else t=0}while(0);do{if(136==(0|b)){if(r=0-t|0,!(l>>>0>t>>>0&t>>>0<2147483647&-1!=(0|o))){if(-1==(0|o)){t=0;break}s=t,a=o,b=145;break A}if((A=c-t+(A=0|n[7101])&0-A)>>>0>=2147483647){s=t,a=o,b=145;break A}if(-1==(0|ut(0|A))){ut(0|r),t=0;break}s=A+t|0,a=o,b=145;break A}}while(0);n[7092]=4|n[7092],b=143}}while(0);if(143==(0|b)&&u>>>0<2147483647&&!(-1==(0|(y=0|ut(0|u)))|1^(v=(p=(m=0|ut(0))-y|0)>>>0>(f+40|0)>>>0)|y>>>0>>0&-1!=(0|y)&-1!=(0|m)^1)&&(s=v?p:t,a=y,b=145),145==(0|b)){t=(0|n[7089])+s|0,n[7089]=t,t>>>0>(0|n[7090])>>>0&&(n[7090]=t),c=0|n[6987];A:do{if(c){for(t=28372;;){if((0|a)==((A=0|n[t>>2])+(r=0|n[t+4>>2])|0)){b=154;break}if(!(o=0|n[t+8>>2]))break;t=o}if(!(154!=(0|b)||(w=t+4|0,8&n[t+12>>2]))&&a>>>0>c>>>0&A>>>0<=c>>>0){n[w>>2]=r+s,w=c+(y=7&(y=c+8|0)?0-y&7:0)|0,y=(x=(0|n[6984])+s|0)-y|0,n[6987]=w,n[6984]=y,n[w+4>>2]=1|y,n[c+x+4>>2]=40,n[6988]=n[7103];break}for(a>>>0<(0|n[6985])>>>0&&(n[6985]=a),r=a+s|0,t=28372;;){if((0|n[t>>2])==(0|r)){b=162;break}if(!(A=0|n[t+8>>2]))break;t=A}if(162==(0|b)&&!(8&n[t+12>>2])){n[t>>2]=a,n[(d=t+4|0)>>2]=(0|n[d>>2])+s,u=(d=a+(7&(d=a+8|0)?0-d&7:0)|0)+f|0,l=(t=r+(7&(t=r+8|0)?0-t&7:0)|0)-d-f|0,n[d+4>>2]=3|f;e:do{if((0|c)==(0|t))x=(0|n[6984])+l|0,n[6984]=x,n[6987]=u,n[u+4>>2]=1|x;else{if((0|n[6986])==(0|t)){x=(0|n[6983])+l|0,n[6983]=x,n[6986]=u,n[u+4>>2]=1|x,n[u+x>>2]=x;break}if(1==(3&(A=0|n[t+4>>2]))){s=-8&A,o=A>>>3;t:do{if(A>>>0<256){if(A=0|n[t+8>>2],(0|(r=0|n[t+12>>2]))==(0|A)){n[6981]=n[6981]&~(1<>2]=r,n[r+8>>2]=A;break}a=0|n[t+24>>2],A=0|n[t+12>>2];do{if((0|A)==(0|t)){if(A=0|n[(o=4+(r=t+16|0)|0)>>2])r=o;else if(!(A=0|n[r>>2])){A=0;break}for(;;)if(o=0|n[(i=A+20|0)>>2])A=o,r=i;else{if(!(o=0|n[(i=A+16|0)>>2]))break;A=o,r=i}n[r>>2]=0}else x=0|n[t+8>>2],n[x+12>>2]=A,n[A+8>>2]=x}while(0);if(!a)break;o=28228+((r=0|n[t+28>>2])<<2)|0;do{if((0|n[o>>2])==(0|t)){if(n[o>>2]=A,0|A)break;n[6982]=n[6982]&~(1<>2])==(0|t)?x:a+20)>>2]=A,!A)break t}while(0);if(n[A+24>>2]=a,0|(o=0|n[(r=t+16|0)>>2])&&(n[A+16>>2]=o,n[o+24>>2]=A),!(r=0|n[r+4>>2]))break;n[A+20>>2]=r,n[r+24>>2]=A}while(0);t=t+s|0,i=s+l|0}else i=l;if(n[(t=t+4|0)>>2]=-2&n[t>>2],n[u+4>>2]=1|i,n[u+i>>2]=i,t=i>>>3,i>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=u,n[t+12>>2]=u,n[u+8>>2]=t,n[u+12>>2]=r;break}t=i>>>8;do{if(t){if(i>>>0>16777215){o=31;break}o=i>>>(7+(o=14-((y=(520192+(x=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(o=(245760+(x<<=y)|0)>>>16&2))+(x<>>15)|0)|0)&1|o<<1}else o=0}while(0);if(t=28228+(o<<2)|0,n[u+28>>2]=o,n[4+(A=u+16|0)>>2]=0,n[A>>2]=0,!((A=0|n[6982])&(r=1<>2]=u,n[u+24>>2]=t,n[u+12>>2]=u,n[u+8>>2]=u;break}t=0|n[t>>2];t:do{if((-8&n[t+4>>2])!=(0|i)){for(o=i<<(31==(0|o)?0:25-(o>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|i)){t=A;break t}o<<=1,t=A}n[r>>2]=u,n[u+24>>2]=t,n[u+12>>2]=u,n[u+8>>2]=u;break e}}while(0);x=0|n[(w=t+8|0)>>2],n[x+12>>2]=u,n[w>>2]=u,n[u+8>>2]=x,n[u+12>>2]=t,n[u+24>>2]=0}}while(0);return S=e,0|d+8}for(t=28372;!((A=0|n[t>>2])>>>0<=c>>>0&&(x=A+(0|n[t+4>>2])|0)>>>0>c>>>0);)t=0|n[t+8>>2];t=(A=(A=(i=x+-47|0)+(7&(A=i+8|0)?0-A&7:0)|0)>>>0<(i=c+16|0)>>>0?c:A)+8|0,w=a+(y=7&(y=a+8|0)?0-y&7:0)|0,y=(r=s+-40|0)-y|0,n[6987]=w,n[6984]=y,n[w+4>>2]=1|y,n[a+r+4>>2]=40,n[6988]=n[7103],n[(r=A+4|0)>>2]=27,n[t>>2]=n[7093],n[t+4>>2]=n[7094],n[t+8>>2]=n[7095],n[t+12>>2]=n[7096],n[7093]=a,n[7094]=s,n[7096]=0,n[7095]=t,t=A+24|0;do{w=t,n[(t=t+4|0)>>2]=7}while((w+8|0)>>>0>>0);if((0|A)!=(0|c)){if(a=A-c|0,n[r>>2]=-2&n[r>>2],n[c+4>>2]=1|a,n[A>>2]=a,t=a>>>3,a>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=c,n[t+12>>2]=c,n[c+8>>2]=t,n[c+12>>2]=r;break}if(r=28228+((o=(t=a>>>8)?a>>>0>16777215?31:a>>>(7+(o=14-((y=(520192+(x=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(o=(245760+(x<<=y)|0)>>>16&2))+(x<>>15)|0)|0)&1|o<<1:0)<<2)|0,n[c+28>>2]=o,n[c+20>>2]=0,n[i>>2]=0,!((t=0|n[6982])&(A=1<>2]=c,n[c+24>>2]=r,n[c+12>>2]=c,n[c+8>>2]=c;break}t=0|n[r>>2];e:do{if((-8&n[t+4>>2])!=(0|a)){for(o=a<<(31==(0|o)?0:25-(o>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|a)){t=A;break e}o<<=1,t=A}n[r>>2]=c,n[c+24>>2]=t,n[c+12>>2]=c,n[c+8>>2]=c;break A}}while(0);x=0|n[(w=t+8|0)>>2],n[x+12>>2]=c,n[w>>2]=c,n[c+8>>2]=x,n[c+12>>2]=t,n[c+24>>2]=0}}else!(0|(x=0|n[6985]))|a>>>0>>0&&(n[6985]=a),n[7093]=a,n[7094]=s,n[7096]=0,n[6990]=n[7099],n[6989]=-1,n[6994]=27964,n[6993]=27964,n[6996]=27972,n[6995]=27972,n[6998]=27980,n[6997]=27980,n[7e3]=27988,n[6999]=27988,n[7002]=27996,n[7001]=27996,n[7004]=28004,n[7003]=28004,n[7006]=28012,n[7005]=28012,n[7008]=28020,n[7007]=28020,n[7010]=28028,n[7009]=28028,n[7012]=28036,n[7011]=28036,n[7014]=28044,n[7013]=28044,n[7016]=28052,n[7015]=28052,n[7018]=28060,n[7017]=28060,n[7020]=28068,n[7019]=28068,n[7022]=28076,n[7021]=28076,n[7024]=28084,n[7023]=28084,n[7026]=28092,n[7025]=28092,n[7028]=28100,n[7027]=28100,n[7030]=28108,n[7029]=28108,n[7032]=28116,n[7031]=28116,n[7034]=28124,n[7033]=28124,n[7036]=28132,n[7035]=28132,n[7038]=28140,n[7037]=28140,n[7040]=28148,n[7039]=28148,n[7042]=28156,n[7041]=28156,n[7044]=28164,n[7043]=28164,n[7046]=28172,n[7045]=28172,n[7048]=28180,n[7047]=28180,n[7050]=28188,n[7049]=28188,n[7052]=28196,n[7051]=28196,n[7054]=28204,n[7053]=28204,n[7056]=28212,n[7055]=28212,w=a+(y=7&(y=a+8|0)?0-y&7:0)|0,y=(x=s+-40|0)-y|0,n[6987]=w,n[6984]=y,n[w+4>>2]=1|y,n[a+x+4>>2]=40,n[6988]=n[7103]}while(0);if((t=0|n[6984])>>>0>f>>>0)return y=t-f|0,n[6984]=y,w=(x=0|n[6987])+f|0,n[6987]=w,n[w+4>>2]=1|y,n[x+4>>2]=3|f,S=e,0|x+8}return n[(x=27920)>>2]=12,S=e,0}function Ye(A){var e=0,t=0,r=0,o=0,i=0,a=0,s=0,l=0;if(A|=0){t=A+-8|0,o=0|n[6985],l=t+(e=-8&(A=0|n[A+-4>>2]))|0;do{if(1&A)s=t,a=t;else{if(r=0|n[t>>2],!(3&A))return;if(i=r+e|0,(a=t+(0-r)|0)>>>0>>0)return;if((0|n[6986])==(0|a)){if(3&~(e=0|n[(A=l+4|0)>>2])){s=a,e=i;break}return n[6983]=i,n[A>>2]=-2&e,n[a+4>>2]=1|i,void(n[a+i>>2]=i)}if(t=r>>>3,r>>>0<256){if(A=0|n[a+8>>2],(0|(e=0|n[a+12>>2]))==(0|A)){n[6981]=n[6981]&~(1<>2]=e,n[e+8>>2]=A,s=a,e=i;break}o=0|n[a+24>>2],A=0|n[a+12>>2];do{if((0|A)==(0|a)){if(A=0|n[(t=4+(e=a+16|0)|0)>>2])e=t;else if(!(A=0|n[e>>2])){A=0;break}for(;;)if(t=0|n[(r=A+20|0)>>2])A=t,e=r;else{if(!(t=0|n[(r=A+16|0)>>2]))break;A=t,e=r}n[e>>2]=0}else s=0|n[a+8>>2],n[s+12>>2]=A,n[A+8>>2]=s}while(0);if(o){if(e=0|n[a+28>>2],(0|n[(t=28228+(e<<2)|0)>>2])==(0|a)){if(n[t>>2]=A,!A){n[6982]=n[6982]&~(1<>2])==(0|a)?s:o+20)>>2]=A,!A){s=a,e=i;break}n[A+24>>2]=o,0|(t=0|n[(e=a+16|0)>>2])&&(n[A+16>>2]=t,n[t+24>>2]=A),(e=0|n[e+4>>2])?(n[A+20>>2]=e,n[e+24>>2]=A,s=a,e=i):(s=a,e=i)}else s=a,e=i}}while(0);if(!(a>>>0>=l>>>0)&&1&(r=0|n[(A=l+4|0)>>2])){if(2&r)n[A>>2]=-2&r,n[s+4>>2]=1|e,n[a+e>>2]=e,o=e;else{if((0|n[6987])==(0|l)){if(l=(0|n[6984])+e|0,n[6984]=l,n[6987]=s,n[s+4>>2]=1|l,(0|s)!=(0|n[6986]))return;return n[6986]=0,void(n[6983]=0)}if((0|n[6986])==(0|l))return l=(0|n[6983])+e|0,n[6983]=l,n[6986]=a,n[s+4>>2]=1|l,void(n[a+l>>2]=l);o=(-8&r)+e|0,t=r>>>3;do{if(r>>>0<256){if(e=0|n[l+8>>2],(0|(A=0|n[l+12>>2]))==(0|e)){n[6981]=n[6981]&~(1<>2]=A,n[A+8>>2]=e;break}i=0|n[l+24>>2],A=0|n[l+12>>2];do{if((0|A)==(0|l)){if(A=0|n[(t=4+(e=l+16|0)|0)>>2])e=t;else if(!(A=0|n[e>>2])){t=0;break}for(;;)if(t=0|n[(r=A+20|0)>>2])A=t,e=r;else{if(!(t=0|n[(r=A+16|0)>>2]))break;A=t,e=r}n[e>>2]=0,t=A}else t=0|n[l+8>>2],n[t+12>>2]=A,n[A+8>>2]=t,t=A}while(0);if(0|i){if(A=0|n[l+28>>2],(0|n[(e=28228+(A<<2)|0)>>2])==(0|l)){if(n[e>>2]=t,!t){n[6982]=n[6982]&~(1<>2])==(0|l)?r:i+20)>>2]=t,!t)break;n[t+24>>2]=i,0|(e=0|n[(A=l+16|0)>>2])&&(n[t+16>>2]=e,n[e+24>>2]=t),0|(A=0|n[A+4>>2])&&(n[t+20>>2]=A,n[A+24>>2]=t)}}while(0);if(n[s+4>>2]=1|o,n[a+o>>2]=o,(0|s)==(0|n[6986]))return void(n[6983]=o)}if(A=o>>>3,o>>>0<256)return t=27964+(A<<1<<2)|0,(e=0|n[6981])&(A=1<>2]:(n[6981]=e|A,A=t,e=t+8|0),n[e>>2]=s,n[A+12>>2]=s,n[s+8>>2]=A,void(n[s+12>>2]=t);A=28228+((r=(A=o>>>8)?o>>>0>16777215?31:o>>>(7+(r=14-((i=(520192+(l=A<<(a=(A+1048320|0)>>>16&8))|0)>>>16&4)|a|(r=(245760+(l<<=i)|0)>>>16&2))+(l<>>15)|0)|0)&1|r<<1:0)<<2)|0,n[s+28>>2]=r,n[s+20>>2]=0,n[s+16>>2]=0,e=0|n[6982],t=1<>2];e:do{if((-8&n[A+4>>2])!=(0|o)){for(r=o<<(31==(0|r)?0:25-(r>>>1)|0);e=0|n[(t=A+16+(r>>>31<<2)|0)>>2];){if((-8&n[e+4>>2])==(0|o)){A=e;break e}r<<=1,A=e}n[t>>2]=s,n[s+24>>2]=A,n[s+12>>2]=s,n[s+8>>2]=s;break A}}while(0);l=0|n[(a=A+8|0)>>2],n[l+12>>2]=s,n[a>>2]=s,n[s+8>>2]=l,n[s+12>>2]=A,n[s+24>>2]=0}else n[6982]=e|t,n[A>>2]=s,n[s+24>>2]=A,n[s+12>>2]=s,n[s+8>>2]=s}while(0);if(l=(0|n[6989])-1|0,n[6989]=l,!(0|l)){for(A=28380;A=0|n[A>>2];)A=A+8|0;n[6989]=-1}}}}function We(A,e){e|=0;var t=0;return(A|=0)?(t=0|y(e,A),(e|A)>>>0>65535&&(t=((t>>>0)/(A>>>0)|0)==(0|e)?t:-1)):t=0,(A=0|Ue(t))&&3&n[A+-4>>2]?(lt(0|A,0,0|t),0|A):0|A}function Ve(A,e,t,r){return 0|(C((e|=0)+(r|=0)+((t=(A|=0)+(t|=0)>>>0)>>>0>>0|0)>>>0|0),t)}function Ze(A,e,t,r){return 0|(C(0|(r=(e|=0)-(r|=0)-((t|=0)>>>0>(A|=0)>>>0|0)>>>0)),A-t>>>0)}function Ke(A){return 0|((A|=0)?31-(0|k(A^A-1)):32)}function Je(A,e,t,r,o){o|=0;var i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0;if(u=A|=0,a=t|=0,s=f=r|=0,!(c=l=e|=0))return i=!!(0|o),s?i?(n[o>>2]=0|A,n[o+4>>2]=0&e,o=0,0|(C(0|(f=0)),o)):(o=0,0|(C(0|(f=0)),o)):(i&&(n[o>>2]=(u>>>0)%(a>>>0),n[o+4>>2]=0),o=(u>>>0)/(a>>>0)>>>0,0|(C(0|(f=0)),o));i=!(0|s);do{if(a){if(!i){if((i=(0|k(0|s))-(0|k(0|c))|0)>>>0<=31){a=d=i+1|0,A=u>>>(d>>>0)&(e=i-31>>31)|c<<(s=31-i|0),e&=c>>>(d>>>0),i=0,s=u<>2]=0|A,n[o+4>>2]=l|0&e,o=0,0|(C(0|(f=0)),o)):(o=0,0|(C(0|(f=0)),o))}if((i=a-1|0)&a){a=s=33+(0|k(0|a))-(0|k(0|c))|0,A=(d=32-s|0)-1>>31&c>>>((g=s-32|0)>>>0)|(c<>>(s>>>0))&(e=g>>31),e&=c>>>(s>>>0),i=u<<(h=64-s|0)&(l=d>>31),s=(c<>>(g>>>0))&l|u<>31;break}return 0|o&&(n[o>>2]=i&u,n[o+4>>2]=0),1==(0|a)?(h=0|A,0|(C(0|(g=l|0&e)),h)):(g=c>>>((h=0|Ke(0|a))>>>0)|0,h=c<<32-h|u>>>(h>>>0),0|(C(0|g),h))}if(i)return 0|o&&(n[o>>2]=(c>>>0)%(a>>>0),n[o+4>>2]=0),h=(c>>>0)/(a>>>0)>>>0,0|(C(0|(g=0)),h);if(!u)return 0|o&&(n[o>>2]=0,n[o+4>>2]=(c>>>0)%(s>>>0)),h=(c>>>0)/(s>>>0)>>>0,0|(C(0|(g=0)),h);if(!((i=s-1|0)&s))return 0|o&&(n[o>>2]=0|A,n[o+4>>2]=i&c|0&e),g=0,h=c>>>((0|Ke(0|s))>>>0),0|(C(0|g),h);if((i=(0|k(0|s))-(0|k(0|c))|0)>>>0<=30){a=e=i+1|0,A=c<<(s=31-i|0)|u>>>(e>>>0),e=c>>>(e>>>0),i=0,s=u<>2]=0|A,n[o+4>>2]=l|0&e,h=0,0|(C(0|(g=0)),h)):(h=0,0|(C(0|(g=0)),h))}while(0);if(a){c=0|Ve(0|(d=0|t),0|(u=f|0&r),-1,-1),t=0|B(),l=s,s=0;do{r=l,l=i>>>31|l<<1,i=s|i<<1,Ze(0|c,0|t,0|(r=A<<1|r>>>31),0|(f=A>>>31|e<<1)),s=1&(g=(h=0|B())>>31|((0|h)<0?-1:0)<<1),A=0|Ze(0|r,0|f,g&d|0,(((0|h)<0?-1:0)>>31|((0|h)<0?-1:0)<<1)&u),e=0|B(),a=a-1|0}while(0|a);c=l,l=0}else c=s,l=0,s=0;return a=0,0|o&&(n[o>>2]=A,n[o+4>>2]=e),h=i<<1&-2|s,0|(C(0|(g=(0|i)>>>31|(c|a)<<1|l)),h)}function Xe(A,e,t,r){var n,o,i,a,s;return t|=0,o=(r|=0)>>31|((0|r)<0?-1:0)<<1,n=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,i=0|Ze((s=(e|=0)>>31|((0|e)<0?-1:0)<<1)^(A|=0),(a=((0|e)<0?-1:0)>>31|((0|e)<0?-1:0)<<1)^e,0|s,0|a),A=o^s,e=n^a,0|Ze((0|Je(i,0|B(),0|Ze(o^t|0,n^r|0,0|o,0|n),0|B(),0))^A,(0|B())^e,0|A,0|e)}function qe(A,e,t,r){var n,o;return e|=0,r|=0,t=0|function(A,e){var t,r,n,o=0;return A=((t=0|y(o=65535&(e|=0),n=65535&(A|=0)))>>>16)+(0|y(o,r=A>>>16))|0,e=0|y(o=e>>>16,n),0|(C((A>>>16)+(0|y(o,r))+(((65535&A)+e|0)>>>16)|0),A+e<<16|65535&t)}(n=A|=0,o=t|=0),A=0|B(),0|(C((0|y(e,o))+(0|y(r,n))+A|0&A),t)}function $e(A,e,t,r){var o,i,a,s,l,c;return t|=0,o=S,S=S+16|0,s=0|o,c=(r|=0)>>31|((0|r)<0?-1:0)<<1,l=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,Je(A=0|Ze((a=(e|=0)>>31|((0|e)<0?-1:0)<<1)^(A|=0),(i=((0|e)<0?-1:0)>>31|((0|e)<0?-1:0)<<1)^e,0|a,0|i),e=0|B(),0|Ze(c^t|0,l^r|0,0|c,0|l),0|B(),s),r=0|Ze(n[s>>2]^a|0,n[s+4>>2]^i|0,0|a,0|i),t=0|B(),S=o,0|(C(0|t),r)}function At(A,e,t,r){var o,i;return i=S,S=S+16|0,Je(A|=0,e|=0,t|=0,r|=0,o=0|i),S=i,0|(C(0|n[o+4>>2]),n[o>>2])}function et(A,e,t){return A|=0,e|=0,(0|(t|=0))<32?(C(e>>t|0),A>>>t|(e&(1<>t-32)}function tt(A,e,t){return A|=0,e|=0,(0|(t|=0))<32?(C(e>>>t|0),A>>>t|(e&(1<>>t-32|0)}function rt(A,e,t){return A|=0,(0|(t|=0))<32?(C((e|=0)<>>32-t),A<=0?+s(A+.5):+v(A-.5)}function st(A,e,t){A|=0,e|=0;var o,i,a=0;if((0|(t|=0))>=8192)return j(0|A,0|e,0|t),0|A;if(i=0|A,o=A+t|0,(3&A)==(3&e)){for(;3&A;){if(!t)return 0|i;r[0|A]=0|r[0|e],A=A+1|0,e=e+1|0,t=t-1|0}for(a=(t=-4&o)-64|0;(0|A)<=(0|a);)n[A>>2]=n[e>>2],n[A+4>>2]=n[e+4>>2],n[A+8>>2]=n[e+8>>2],n[A+12>>2]=n[e+12>>2],n[A+16>>2]=n[e+16>>2],n[A+20>>2]=n[e+20>>2],n[A+24>>2]=n[e+24>>2],n[A+28>>2]=n[e+28>>2],n[A+32>>2]=n[e+32>>2],n[A+36>>2]=n[e+36>>2],n[A+40>>2]=n[e+40>>2],n[A+44>>2]=n[e+44>>2],n[A+48>>2]=n[e+48>>2],n[A+52>>2]=n[e+52>>2],n[A+56>>2]=n[e+56>>2],n[A+60>>2]=n[e+60>>2],A=A+64|0,e=e+64|0;for(;(0|A)<(0|t);)n[A>>2]=n[e>>2],A=A+4|0,e=e+4|0}else for(t=o-4|0;(0|A)<(0|t);)r[0|A]=0|r[0|e],r[A+1|0]=0|r[e+1|0],r[A+2|0]=0|r[e+2|0],r[A+3|0]=0|r[e+3|0],A=A+4|0,e=e+4|0;for(;(0|A)<(0|o);)r[0|A]=0|r[0|e],A=A+1|0,e=e+1|0;return 0|i}function lt(A,e,t){e|=0;var o,i=0,a=0,s=0;if(o=(A|=0)+(t|=0)|0,e&=255,(0|t)>=67){for(;3&A;)r[0|A]=e,A=A+1|0;for(s=e|e<<8|e<<16|e<<24,a=(i=-4&o)-64|0;(0|A)<=(0|a);)n[A>>2]=s,n[A+4>>2]=s,n[A+8>>2]=s,n[A+12>>2]=s,n[A+16>>2]=s,n[A+20>>2]=s,n[A+24>>2]=s,n[A+28>>2]=s,n[A+32>>2]=s,n[A+36>>2]=s,n[A+40>>2]=s,n[A+44>>2]=s,n[A+48>>2]=s,n[A+52>>2]=s,n[A+56>>2]=s,n[A+60>>2]=s,A=A+64|0;for(;(0|A)<(0|i);)n[A>>2]=s,A=A+4|0}for(;(0|A)<(0|o);)r[0|A]=e,A=A+1|0;return o-t|0}function ct(A){return(A=+A)>=0?+s(A+.5):+v(A-.5)}function ut(A){var e,t,r;return A|=0,r=0|E(),(0|A)>0&(0|(e=(t=0|n[a>>2])+A|0))<(0|t)|(0|e)<0?(N(0|e),D(12),-1):(0|e)>(0|r)&&!(0|Q(0|e))?(D(12),-1):(n[a>>2]=e,0|t)}return{___divdi3:Xe,___muldi3:qe,___remdi3:$e,___uremdi3:At,_areNeighborCells:function(A,e,t,r,o){o|=0;var i,a,s,l=0,c=0,u=0,d=0;if(s=S,S=S+64|0,a=s,i=s+56|0,!(!0&134217728==(2013265920&(e|=0))&!0&134217728==(2013265920&(r|=0))))return S=s,5;if((0|(A|=0))==(0|(t|=0))&(0|e)==(0|r))return n[o>>2]=0,S=s,0;if(c=0|tt(0|A,0|e,52),B(),c&=15,d=0|tt(0|t,0|r,52),B(),(0|c)!=(15&d))return S=s,12;if(l=c+-1|0,c>>>0>1){IA(A,e,l,a),IA(t,r,l,i),u=0|n[(d=a)>>2],d=0|n[d+4>>2];A:do{if((0|u)==(0|n[i>>2])&&(0|d)==(0|n[i+4>>2])){l=0|tt(0|A,0|e,0|(c=3*(15^c)|0)),B(),l&=7,c=0|tt(0|t,0|r,0|c),B(),c&=7;do{if(!(0|l)|!(0|c))n[o>>2]=1,l=0;else if(7==(0|l))l=5;else{if(1==(0|l)|1==(0|c)&&0|zA(u,d)){l=5;break}if((0|n[15536+(l<<2)>>2])!=(0|c)&&(0|n[15568+(l<<2)>>2])!=(0|c))break A;n[o>>2]=1,l=0}}while(0);return S=s,0|l}}while(0)}c=(l=a)+56|0;do{n[l>>2]=0,l=l+4|0}while((0|l)<(0|c));return F(A,e,1,a),l=(0|n[(e=a)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+8|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+16|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+24|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+32|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+40|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)?1:1&((0|n[(l=a+48|0)>>2])==(0|t)?(0|n[l+4>>2])==(0|r):0),n[o>>2]=l,S=s,0},_bitshift64Ashr:et,_bitshift64Lshr:tt,_bitshift64Shl:rt,_calloc:We,_cellAreaKm2:function(A,e,t){return 0|(A=0|ue(A|=0,e|=0,t|=0))||(o[t>>3]=6371.007180918475*+o[t>>3]*6371.007180918475),0|A},_cellAreaM2:function(A,e,t){return 0|(A=0|ue(A|=0,e|=0,t|=0))||(o[t>>3]=6371.007180918475*+o[t>>3]*6371.007180918475*1e3*1e3),0|A},_cellAreaRads2:ue,_cellToBoundary:$A,_cellToCenterChild:GA,_cellToChildPos:function(A,e,t,r){t|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0;if(o=S,S=S+16|0,p=o,v=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return S=o,4;if((0|(v&=15))<(0|t))return S=o,12;if((0|v)!=(0|t))if(a=0|rt(0|t,0,52),a|=A,l=B()|-15728641&e,(0|v)>(0|t)){c=t;do{b=0|rt(7,0,3*(14-c|0)|0),c=c+1|0,a|=b,l=0|B()|l}while((0|c)<(0|v));b=a}else b=a;else b=A,l=e;m=0|tt(0|b,0|l,45),B();A:do{if(0|H(127&m)){if(c=0|tt(0|b,0|l,52),B(),0|(c&=15))for(a=1;;){if(!(!((m=0|rt(7,0,3*(15-a|0)|0))&b)&!((0|B())&l))){u=33;break A}if(!(a>>>0>>0))break;a=a+1|0}if(n[(m=r)>>2]=0,n[m+4>>2]=0,(0|v)>(0|t)){for(m=-15728641&e,h=v;;){if(g=h,(h=h+-1|0)>>>0>15|(0|v)<(0|h)){u=19;break}if((0|v)!=(0|h))if(a=0|rt(0|h,0,52),a|=A,c=0|B()|m,(0|v)<(0|g))f=a;else{u=h;do{f=0|rt(7,0,3*(14-u|0)|0),u=u+1|0,a|=f,c=0|B()|c}while((0|u)<(0|v));f=a}else f=A,c=e;if(d=0|tt(0|f,0|c,45),B(),0|H(127&d)){d=0|tt(0|f,0|c,52),B(),d&=15;e:do{if(d)for(u=1;;){if(a=0|tt(0|f,0|c,3*(15-u|0)|0),B(),0|(a&=7))break e;if(!(u>>>0>>0)){a=0;break}u=u+1|0}else a=0}while(0);a=1&!(0|a)}else a=0;if(c=0|tt(0|A,0|e,3*(15-g|0)|0),B(),7==(0|(c&=7))){i=5,u=42;break}if(1==(0|c)&(a=!!(0|a))){i=5,u=42;break}if(0|(f=c+((!!(0|c)&a)<<31>>31)|0)&&(u=0|pe(7,0,u=v-g|0,((0|u)<0)<<31>>31),d=0|B(),a?(a=0|Ve(0|(a=0|qe(0|u,0|d,5,0)),0|B(),-5,-1),a=0|Ve(0|(a=0|Xe(0|a,0|B(),6,0)),0|B(),1,0),c=0|B()):(a=u,c=d),g=0|Ve(0|a,0|c,0|(g=0|qe(0|u,0|d,0|(g=f+-1|0),((0|g)<0)<<31>>31)),0|B()),d=0|Ve(0|g,0|(f=0|B()),0|n[(d=r)>>2],0|n[d+4>>2]),f=0|B(),n[(g=r)>>2]=d,n[g+4>>2]=f),(0|h)<=(0|t)){u=37;break}}if(19==(0|u))M(27795,27122,1367,27158);else{if(37==(0|u)){i=0|n[(s=r)+4>>2],s=0|n[s>>2];break}if(42==(0|u))return S=o,0|i}}else i=0,s=0}else u=33}while(0);A:do{if(33==(0|u)){if(n[(m=r)>>2]=0,n[m+4>>2]=0,(0|v)>(0|t)){for(a=v;;){if(i=0|tt(0|A,0|e,3*(15-a|0)|0),B(),7==(0|(i&=7))){i=5;break}if(i=0|qe(0|(s=0|pe(7,0,s=v-a|0,((0|s)<0)<<31>>31)),0|B(),0|i,0),s=0|B(),s=0|Ve(0|n[(m=r)>>2],0|n[m+4>>2],0|i,0|s),i=0|B(),n[(m=r)>>2]=s,n[m+4>>2]=i,(0|(a=a+-1|0))<=(0|t))break A}return S=o,0|i}i=0,s=0}}while(0);return 0|_A(b,l,v,p)&&M(27795,27122,1327,27173),((0|i)>-1|-1==(0|i)&s>>>0>4294967295)&((0|(p=0|n[(v=p)+4>>2]))>(0|i)|((0|p)==(0|i)?(0|n[v>>2])>>>0>s>>>0:0))?(S=o,0|(v=0)):(M(27795,27122,1407,27158),0)},_cellToChildren:function(A,e,t,r){r|=0;var o,i,a=0,s=0;if(i=S,S=S+16|0,ee(o=i,A|=0,e|=0,t|=0),!(0|(A=0|n[(e=o)>>2]))&!(0|(e=0|n[e+4>>2])))return S=i,0;a=0,t=0;do{n[(s=r+(a<<3)|0)>>2]=A,n[s+4>>2]=e,a=0|Ve(0|a,0|t,1,0),t=0|B(),re(o),A=0|n[(s=o)>>2],e=0|n[s+4>>2]}while(!(!(0|A)&!(0|e)));return S=i,0},_cellToChildrenSize:_A,_cellToLatLng:qA,_cellToLocalIj:function(A,e,t,r,o,i){var a,s;return A|=0,i|=0,s=S,S=S+16|0,a=s,(o|=0)?A=15:(A=0|me(A,e|=0,t|=0,r|=0,a))||(function(A,e){var t;e|=0,t=0|n[8+(A|=0)>>2],n[e>>2]=(0|n[A>>2])-t,n[e+4>>2]=(0|n[A+4>>2])-t}(a,i),A=0),S=s,0|A},_cellToParent:IA,_cellToVertex:Pe,_cellToVertexes:function(A,e,t){t|=0;var r,o=0,i=0;return i=!(0|zA(A|=0,e|=0)),r=!(0|(o=0|Pe(A,e,0,t))),i?r?0|(o=0|Pe(A,e,1,t+8|0))||0|(o=0|Pe(A,e,2,t+16|0))||0|(o=0|Pe(A,e,3,t+24|0))||(o=0|Pe(A,e,4,t+32|0))?0|(i=o):0|Pe(A,e,5,t+40|0):0|(i=o):r?0|(o=0|Pe(A,e,1,t+8|0))||0|(o=0|Pe(A,e,2,t+16|0))||0|(o=0|Pe(A,e,3,t+24|0))||0|(o=0|Pe(A,e,4,t+32|0))?0|(i=o):(n[(i=t+40|0)>>2]=0,n[i+4>>2]=0,0|(i=0)):0|(i=o)},_cellsToDirectedEdge:function(A,e,t,r,o){return o|=0,7==(0|(t=0|_(A|=0,e|=0,t|=0,r|=0)))?0|(o=11):(r=0|rt(0|t,0,56),e=-2130706433&e|B()|268435456,n[o>>2]=A|r,n[o+4>>2]=e,0|(o=0))},_cellsToLinkedMultiPolygon:function(A,e,t){t|=0;var r,i,a,s=0;if(a=S,S=S+32|0,r=a,0|(A=0|function(A,e,t){A|=0,t|=0;var r,o,i=0,a=0,s=0,l=0,c=0,u=0;if(o=S,S=S+176|0,r=o,(0|(e|=0))<1)return Le(t,0,0),S=o,0;for(c=0|tt(0|n[(c=A)>>2],0|n[c+4>>2],52),B(),Le(t,(0|e)>6?e:6,15&c),c=0;!(0|(i=0|$A(0|n[(i=A+(c<<3)|0)>>2],0|n[i+4>>2],r)));){if((0|(i=0|n[r>>2]))>0){l=0;do{s=r+8+(l<<4)|0,(a=0|He(t,i=r+8+((0|(l=l+1|0))%(0|i)<<4)|0,s))?_e(t,a):ze(t,s,i),i=0|n[r>>2]}while((0|l)<(0|i))}if((0|(c=c+1|0))>=(0|e)){i=0,u=13;break}}return 13==(0|u)?(S=o,0|i):(Re(t),S=o,0|(u=i))}(A|=0,e|=0,i=a+16|0)))return S=a,0|A;if(n[t>>2]=0,n[t+4>>2]=0,n[t+8>>2]=0,0|(A=0|Ie(i)))do{e=0|de(t);do{fe(e,A),s=A+16|0,n[r>>2]=n[s>>2],n[r+4>>2]=n[s+4>>2],n[r+8>>2]=n[s+8>>2],n[r+12>>2]=n[s+12>>2],_e(i,A),A=0|Ge(i,r)}while(0|A);A=0|Ie(i)}while(0|A);return Re(i),(A=0|function(A){var e,t,r=0,i=0,a=0,s=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0,k=0,C=0,B=0,D=0,E=0,j=0,Q=0,N=0,S=0,F=0,P=0,T=0,L=0;if(0|n[(s=(A|=0)+8|0)>>2])return 1;if(!(a=0|n[A>>2]))return 0;r=a,i=0;do{i=i+1|0,r=0|n[r+8>>2]}while(0|r);if(i>>>0<2)return 0;(t=0|Ue(i<<2))||M(27396,27235,317,27415),(e=0|Ue(i<<5))||M(27437,27235,321,27415),n[A>>2]=0,n[(E=A+4|0)>>2]=0,n[s>>2]=0,i=0,P=0,D=0,m=0;A:for(;;){if(h=0|n[a>>2]){c=0,u=h;do{if(f=+o[u+8>>3],r=u,u=0|n[u+16>>2],d=+o[(s=(g=!(0|u))?h:u)+8>>3],+l(+(f-d))>3.141592653589793){L=14;break}c+=(d-f)*(+o[r>>3]+ +o[s>>3])}while(!g);if(14==(0|L)){L=0,c=0,r=h;do{B=+o[r+8>>3],S=0|n[(F=r+16|0)>>2],C=+o[(S=0|S?S:h)+8>>3],c+=(+o[r>>3]+ +o[S>>3])*((C<0?C+6.283185307179586:C)-(B<0?B+6.283185307179586:B)),r=0|n[(0|r?F:a)>>2]}while(0|r)}c>0?(n[t+(P<<2)>>2]=a,P=P+1|0,s=D,r=m):L=19}else L=19;if(19==(0|L)){L=0;do{if(!i){if(m){s=E,u=m+8|0,r=a,i=A;break}if(0|n[A>>2]){L=27;break A}s=E,u=A,r=a,i=A;break}if(0|n[(r=i+8|0)>>2]){L=21;break A}if(!(i=0|We(1,12))){L=23;break A}n[r>>2]=i,s=i+4|0,u=i,r=m}while(0);if(n[u>>2]=a,n[s>>2]=a,u=e+(D<<5)|0,g=0|n[a>>2]){for(o[(h=e+(D<<5)+8|0)>>3]=17976931348623157e292,o[(m=e+(D<<5)+24|0)>>3]=17976931348623157e292,o[u>>3]=-17976931348623157e292,o[(b=e+(D<<5)+16|0)>>3]=-17976931348623157e292,x=17976931348623157e292,k=-17976931348623157e292,s=0,p=g,f=17976931348623157e292,y=17976931348623157e292,w=-17976931348623157e292,d=-17976931348623157e292;c=+o[p>>3],B=+o[p+8>>3],p=0|n[p+16>>2],C=+o[((v=!(0|p))?g:p)+8>>3],c>3]=c,f=c),B>3]=B,y=B),c>w?o[u>>3]=c:c=w,B>d&&(o[b>>3]=B,d=B),x=B>0&Bk?B:k,s|=+l(+(B-C))>3.141592653589793,!v;)w=c;s&&(o[b>>3]=k,o[m>>3]=x)}else n[u>>2]=0,n[u+4>>2]=0,n[u+8>>2]=0,n[u+12>>2]=0,n[u+16>>2]=0,n[u+20>>2]=0,n[u+24>>2]=0,n[u+28>>2]=0;s=D+1|0}if(a=0|n[(F=a+8|0)>>2],n[F>>2]=0,!a){L=45;break}D=s,m=r}if(21==(0|L))M(27213,27235,35,27247);else if(23==(0|L))M(27267,27235,37,27247);else if(27==(0|L))M(27310,27235,61,27333);else if(45==(0|L)){A:do{if((0|P)>0){for(F=!(0|s),N=s<<2,S=!(0|A),Q=0,r=0;;){if(j=0|n[t+(Q<<2)>>2],F)L=73;else{if(!(D=0|Ue(N))){L=50;break}if(!(E=0|Ue(N))){L=52;break}e:do{if(S)i=0;else{for(s=0,i=0,u=A;a=e+(s<<5)|0,0|he(0|n[u>>2],a,0|n[j>>2])?(n[D+(i<<2)>>2]=u,n[E+(i<<2)>>2]=a,v=i+1|0):v=i,u=0|n[u+8>>2];)s=s+1|0,i=v;if((0|v)>0)if(a=0|n[D>>2],1==(0|v))i=a;else for(b=0,p=-1,i=a,m=a;;){for(g=0|n[m>>2],a=0,u=0;h=(0|(s=0|n[n[D+(u<<2)>>2]>>2]))==(0|g)?a:a+(1&he(s,0|n[E+(u<<2)>>2],0|n[g>>2]))|0,(0|(u=u+1|0))!=(0|v);)a=h;if(i=(s=(0|h)>(0|p))?m:i,(0|(a=b+1|0))==(0|v))break e;b=a,p=s?h:p,m=0|n[D+(a<<2)>>2]}else i=0}}while(0);if(Ye(D),Ye(E),i){if(a=0|n[(s=i+4|0)>>2])i=a+8|0;else if(0|n[i>>2]){L=70;break}n[i>>2]=j,n[s>>2]=j}else L=73}if(73==(0|L)){if(L=0,0|(r=0|n[j>>2]))do{E=r,r=0|n[r+16>>2],Ye(E)}while(0|r);Ye(j),r=1}if((0|(Q=Q+1|0))>=(0|P)){T=r;break A}}50==(0|L)?M(27452,27235,249,27471):52==(0|L)?M(27490,27235,252,27471):70==(0|L)&&M(27310,27235,61,27333)}else T=0}while(0);return Ye(t),Ye(e),0|T}return 0}(t))?(ge(t),S=a,0|(s=A)):(S=a,0|(s=0))},_childPosToCell:function(A,e,t,r,o,i){A|=0,e|=0,i|=0;var a,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0;if(a=S,S=S+16|0,s=a,(o|=0)>>>0>15)return S=a,4;if(l=0|tt(0|(t|=0),0|(r|=0),52),B(),(0|(l&=15))>(0|o))return S=a,12;if(0|_A(t,r,o,s)&&M(27795,27122,1327,27173),!(((0|e)>-1|-1==(0|e)&A>>>0>4294967295)&((0|(u=0|n[(d=s)+4>>2]))>(0|e)|((0|u)==(0|e)?(0|n[d>>2])>>>0>A>>>0:0))))return S=a,2;d=o-l|0,o=0|rt(0|o,0,52),c=B()|-15728641&r,n[(u=i)>>2]=o|t,n[u+4>>2]=c,u=0|tt(0|t,0|r,45),B();A:do{if(0|H(127&u)){if(0|l)for(s=1;;){if(!(!((u=0|rt(7,0,3*(15-s|0)|0))&t)&!((0|B())&r)))break A;if(!(s>>>0>>0))break;s=s+1|0}if((0|d)<1)return S=a,0;for(u=15^l,r=-1,c=1,s=1;;){l=0|pe(7,0,l=d-c|0,((0|l)<0)<<31>>31),t=0|B();do{if(s){if(s=0|Xe(0|(s=0|Ve(0|(s=0|qe(0|l,0|t,5,0)),0|B(),-5,-1)),0|B(),6,0),(0|e)>(0|(o=0|B()))|(0|e)==(0|o)&A>>>0>s>>>0){e=0|Ze(0|(e=0|Ve(0|A,0|e,-1,-1)),0|B(),0|s,0|o),s=0|B(),h=0|n[(f=i)>>2],f=0|n[f+4>>2],g=0|rt(7,0,0|(m=3*(u+r|0)|0)),f&=~B(),m=0|rt(0|(o=0|Ve(0|(r=0|Xe(0|e,0|s,0|l,0|t)),0|(A=0|B()),2,0)),0|B(),0|m),f=0|B()|f,n[(o=i)>>2]=m|h&~g,n[o+4>>2]=f,A=0|Ze(0|e,0|s,0|(A=0|qe(0|r,0|A,0|l,0|t)),0|B()),s=0,e=0|B();break}g=0|n[(m=i)>>2],m=0|n[m+4>>2],h=0|rt(7,0,3*(u+r|0)|0),m&=~B(),n[(s=i)>>2]=g&~h,n[s+4>>2]=m,s=1;break}o=0|n[(g=i)>>2],g=0|n[g+4>>2],f=0|rt(7,0,0|(r=3*(u+r|0)|0)),g&=~B(),r=0|rt(0|(m=0|Xe(0|A,0|e,0|l,0|t)),0|(s=0|B()),0|r),g=0|B()|g,n[(h=i)>>2]=r|o&~f,n[h+4>>2]=g,A=0|Ze(0|A,0|e,0|(s=0|qe(0|m,0|s,0|l,0|t)),0|B()),s=0,e=0|B()}while(0);if(!((0|d)>(0|c))){e=0;break}r=~c,c=c+1|0}return S=a,0|e}}while(0);if((0|d)<1)return S=a,0;for(o=15^l,s=1;;){if(h=0|pe(7,0,h=d-s|0,((0|h)<0)<<31>>31),m=0|B(),t=0|n[(c=i)>>2],c=0|n[c+4>>2],r=0|rt(7,0,0|(l=3*(o-s|0)|0)),c&=~B(),l=0|rt(0|(f=0|Xe(0|A,0|e,0|h,0|m)),0|(g=0|B()),0|l),c=0|B()|c,n[(u=i)>>2]=l|t&~r,n[u+4>>2]=c,A=0|Ze(0|A,0|e,0|(m=0|qe(0|f,0|g,0|h,0|m)),0|B()),e=0|B(),(0|d)<=(0|s)){e=0;break}s=s+1|0}return S=a,0|e},_compactCells:function(A,e,t,r){e|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0,k=0,C=0,D=0,E=0,j=0,Q=0,N=0,S=0;if(!(0|(t|=0))&!(0|(r|=0)))return 0;if(a=0|n[(i=A|=0)>>2],!0&!(15728640&(i=0|n[i+4>>2]))){if(!((0|r)>0|!(0|r)&t>>>0>0))return 0;if(n[(S=e)>>2]=a,n[S+4>>2]=i,1==(0|t)&!(0|r))return 0;i=1,a=0;do{N=0|n[4+(Q=A+(i<<3)|0)>>2],n[(S=e+(i<<3)|0)>>2]=n[Q>>2],n[S+4>>2]=N,i=0|Ve(0|i,0|a,1,0),a=0|B()}while((0|a)<(0|r)|(0|a)==(0|r)&i>>>0>>0);return 0}if(!(N=0|Ue(o=t<<3)))return 13;if(st(0|N,0|A,0|o),!(Q=0|We(t,8)))return Ye(N),13;A:for(;;){E=0|tt(0|(u=0|n[(i=N)>>2]),0|(i=0|n[i+4>>2]),52),B(),j=(E&=15)-1|0,D=!!(0|E),C=(0|r)>0|!(0|r)&t>>>0>0;e:do{if(D&C){if(y=0|rt(0|j,0,52),w=0|B(),j>>>0>15){if(!(!(0|u)&!(0|i))){S=16;break A}for(a=0,A=0;;){if(a=0|Ve(0|a,0|A,1,0),!((0|(A=0|B()))<(0|r)|(0|A)==(0|r)&a>>>0>>0))break e;if(!(!(0|(k=0|n[(s=N+(a<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))){i=s,S=16;break A}}}for(l=u,A=i,a=0,s=0;;){if(!(!(0|l)&!(0|A))){if(!(!0&!(117440512&A))){S=21;break A}if(d=0|tt(0|l,0|A,52),B(),(0|(d&=15))<(0|j)){i=12,S=27;break A}if((0|d)!=(0|j)&&(l|=y,A=-15728641&A|w,d>>>0>=E>>>0)){c=j;do{k=0|rt(7,0,3*(14-c|0)|0),c=c+1|0,l|=k,A=0|B()|A}while(c>>>0>>0)}if(g=0|At(0|l,0|A,0|t,0|r),h=0|B(),!(!(0|(f=0|n[(d=c=Q+(g<<3)|0)>>2]))&!(0|(d=0|n[d+4>>2])))){p=0,v=0;do{if((0|p)>(0|r)|(0|p)==(0|r)&v>>>0>t>>>0){S=31;break A}if((0|f)==(0|l)&(-117440513&d)==(0|A)){m=0|tt(0|f,0|d,56),B(),b=1+(m&=7)|0,k=0|tt(0|f,0|d,45),B();t:do{if(0|H(127&k)){if(f=0|tt(0|f,0|d,52),B(),!(f&=15)){d=6;break}for(d=1;;){if(!(!((k=0|rt(7,0,3*(15-d|0)|0))&l)&!((0|B())&A))){d=7;break t}if(!(d>>>0>>0)){d=6;break}d=d+1|0}}else d=7}while(0);if((m+2|0)>>>0>d>>>0){S=41;break A}k=0|rt(0|b,0,56),A=B()|-117440513&A,n[(x=c)>>2]=0,n[x+4>>2]=0,l|=k}else g=0|$e(0|(g=0|Ve(0|g,0|h,1,0)),0|B(),0|t,0|r),h=0|B();v=0|Ve(0|v,0|p,1,0),p=0|B(),f=0|n[(d=c=Q+(g<<3)|0)>>2],d=0|n[d+4>>2]}while(!(!(0|f)&!(0|d)))}n[(k=c)>>2]=l,n[k+4>>2]=A}if(a=0|Ve(0|a,0|s,1,0),!((0|(s=0|B()))<(0|r)|(0|s)==(0|r)&a>>>0>>0))break e;l=0|n[(A=N+(a<<3)|0)>>2],A=0|n[A+4>>2]}}}while(0);if(k=0|Ve(0|t,0|r,5,0),(x=0|B())>>>0<0|!(0|x)&k>>>0<11){S=85;break}if(k=0|Xe(0|t,0|r,6,0),B(),!(k=0|We(k,8))){S=48;break}do{if(C){for(b=0,A=0,m=0,p=0;;){if(!(0|(a=0|n[(s=d=Q+(b<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))x=m;else{f=0|tt(0|a,0|s,56),B(),l=1+(f&=7)|0,g=-117440513&s,x=0|tt(0|a,0|s,45),B();e:do{if(0|H(127&x)){if(h=0|tt(0|a,0|s,52),B(),0|(h&=15))for(c=1;;){if(!(!(a&(x=0|rt(7,0,3*(15-c|0)|0)))&!(g&(0|B()))))break e;if(!(c>>>0>>0))break;c=c+1|0}a|=s=0|rt(0|l,0,56),s=0|B()|g,n[(l=d)>>2]=a,n[l+4>>2]=s,l=f+2|0}}while(0);7==(0|l)?(n[(x=k+(A<<3)|0)>>2]=a,n[x+4>>2]=-117440513&s,A=0|Ve(0|A,0|m,1,0),x=0|B()):x=m}if(b=0|Ve(0|b,0|p,1,0),!((0|(p=0|B()))<(0|r)|(0|p)==(0|r)&b>>>0>>0))break;m=x}if(C){if(v=j>>>0>15,y=0|rt(0|j,0,52),w=0|B(),!D){for(a=0,c=0,l=0,s=0;!(0|u)&!(0|i)||(n[(j=e+(a<<3)|0)>>2]=u,n[j+4>>2]=i,a=0|Ve(0|a,0|c,1,0),c=0|B()),l=0|Ve(0|l,0|s,1,0),(0|(s=0|B()))<(0|r)|(0|s)==(0|r)&l>>>0>>0;)u=0|n[(i=N+(l<<3)|0)>>2],i=0|n[i+4>>2];i=x;break}for(a=0,c=0,s=0,l=0;;){do{if(!(!(0|u)&!(0|i))){if(h=0|tt(0|u,0|i,52),B(),v|(0|(h&=15))<(0|j)){S=80;break A}if((0|h)!=(0|j)){if(d=u|y,f=-15728641&i|w,h>>>0>=E>>>0){g=j;do{D=0|rt(7,0,3*(14-g|0)|0),g=g+1|0,d|=D,f=0|B()|f}while(g>>>0>>0)}}else d=u,f=i;m=0|At(0|d,0|f,0|t,0|r),g=0,h=0,p=0|B();do{if((0|g)>(0|r)|(0|g)==(0|r)&h>>>0>t>>>0){S=81;break A}if((-117440513&(b=0|n[4+(D=Q+(m<<3)|0)>>2]))==(0|f)&&(0|n[D>>2])==(0|d)){S=65;break}m=0|$e(0|(D=0|Ve(0|m,0|p,1,0)),0|B(),0|t,0|r),p=0|B(),h=0|Ve(0|h,0|g,1,0),g=0|B(),D=Q+(m<<3)|0}while((0|n[D>>2])!=(0|d)||(0|n[D+4>>2])!=(0|f));if(65==(0|S)&&(S=0,!0&100663296==(117440512&b)))break;n[(D=e+(a<<3)|0)>>2]=u,n[D+4>>2]=i,a=0|Ve(0|a,0|c,1,0),c=0|B()}}while(0);if(s=0|Ve(0|s,0|l,1,0),!((0|(l=0|B()))<(0|r)|(0|l)==(0|r)&s>>>0>>0))break;u=0|n[(i=N+(s<<3)|0)>>2],i=0|n[i+4>>2]}i=x}else a=0,i=x}else a=0,A=0,i=0}while(0);if(lt(0|Q,0,0|o),st(0|N,0|k,A<<3),Ye(k),!(0|A)&!(0|i)){S=89;break}e=e+(a<<3)|0,r=i,t=A}if(16==(0|S))!0&!(117440512&i)?(i=4,S=27):S=21;else if(31==(0|S))M(27795,27122,620,27132);else{if(41==(0|S))return Ye(N),Ye(Q),10;if(48==(0|S))return Ye(N),Ye(Q),13;80==(0|S)?M(27795,27122,711,27132):81==(0|S)?M(27795,27122,723,27132):85==(0|S)&&(st(0|e,0|N,t<<3),S=89)}return 21==(0|S)?(Ye(N),Ye(Q),0|(S=5)):27==(0|S)?(Ye(N),Ye(Q),0|(S=i)):89==(0|S)?(Ye(N),Ye(Q),0|(S=0)):0},_constructCell:function(A,e,t,o){t|=0,o|=0;var i=0,a=0,s=0,l=0,c=0,u=0;if((A|=0)>>>0>15)return 4;if((e|=0)>>>0>121)return 17;s=0|rt(0|A,0,52),i=0|B(),l=0|rt(0|e,0,45),i=0|i|B()|134225919;A:do{if((0|A)>=1){for(l=1,s=!!(0|r[20528+e|0]),a=-1;;){if((e=0|n[t+(l+-1<<2)>>2])>>>0>6){i=18,e=10;break}if(!(!(0|e)|1^s)){if(1==(0|e)){i=19,e=10;break}s=0}if(c=0|rt(7,0,0|(u=3*(15-l|0)|0)),i&=~B(),a=(e=0|rt(0|e,((0|e)<0)<<31>>31,0|u))|a&~c,i=0|B()|i,!((0|l)<(0|A)))break A;l=l+1|0}if(10==(0|e))return 0|i}else a=-1}while(0);return n[(u=o)>>2]=a,n[u+4>>2]=i,0},_destroyLinkedMultiPolygon:ge,_directedEdgeToBoundary:DA,_directedEdgeToCells:function(A,e,t){A|=0;var r,o,i,a=0;return r=S,S=S+16|0,a=r,!0&268435456==(2013265920&(e|=0))?(o=-2130706433&e|134217728,n[(i=t|=0)>>2]=A,n[i+4>>2]=o,n[a>>2]=0,e=0|tt(0|A,0|e,56),B(),a=0|R(A,o,7&e,a,t+8|0),S=r,0|a):(S=r,0|(a=6))},_edgeLengthKm:function(A,e,t){t|=0;var r,i=0,a=0,s=0,l=0,u=0,g=0,h=0;if(r=S,S=S+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return l=A,s=+o[t>>3],s*=6371.007180918475,o[t>>3]=s,S=r,0|l;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return l=0,s=0,s*=6371.007180918475,o[t>>3]=s,S=r,0|l;e=A+-1|0,A=0,i=+o[l+8>>3],a=+o[l+16>>3],s=0;do{g=i,i=+o[l+8+((A=A+1|0)<<4)>>3],h=+f(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+f(.5*(a-u)))*(+d(+g)*+d(+i)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)!=(0|e));return o[t>>3]=s,l=0,h=s,h*=6371.007180918475,o[t>>3]=h,S=r,0|l},_edgeLengthM:function(A,e,t){t|=0;var r,i=0,a=0,s=0,l=0,u=0,g=0,h=0;if(r=S,S=S+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return l=A,s=+o[t>>3],s*=6371.007180918475,s*=1e3,o[t>>3]=s,S=r,0|l;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return l=0,s=0,s*=6371.007180918475,s*=1e3,o[t>>3]=s,S=r,0|l;e=A+-1|0,A=0,i=+o[l+8>>3],a=+o[l+16>>3],s=0;do{g=i,i=+o[l+8+((A=A+1|0)<<4)>>3],h=+f(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+f(.5*(a-u)))*(+d(+g)*+d(+i)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)!=(0|e));return o[t>>3]=s,l=0,h=s,h*=6371.007180918475,h*=1e3,o[t>>3]=h,S=r,0|l},_edgeLengthRads:function(A,e,t){t|=0;var r,i=0,a=0,s=0,l=0,u=0,g=0,h=0;if(r=S,S=S+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return S=r,0|A;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return S=r,0;e=A+-1|0,A=0,i=+o[l+8>>3],a=+o[l+16>>3],s=0;do{g=i,i=+o[l+8+((A=A+1|0)<<4)>>3],h=+f(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+f(.5*(a-u)))*(+d(+i)*+d(+g)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)<(0|e));return o[t>>3]=s,S=r,0},_emscripten_replace_memory:function(A){return r=new Int8Array(A),n=new Int32Array(A),o=new Float64Array(A),t=A,!0},_free:Ye,_getBaseCellNumber:TA,_getDirectedEdgeDestination:function(A,e,t){A|=0,e|=0,t|=0;var r,o,i=0;return r=S,S=S+16|0,n[(i=r)>>2]=0,!0&268435456==(2013265920&e)?(o=0|tt(0|A,0|e,56),B(),i=0|R(A,-2130706433&e|134217728,7&o,i,t),S=r,0|i):(S=r,0|(i=6))},_getDirectedEdgeOrigin:function(A,e,t){return A|=0,t|=0,!0&268435456==(2013265920&(e|=0))?(n[t>>2]=A,n[t+4>>2]=-2130706433&e|134217728,0|(t=0)):0|(t=6)},_getHexagonAreaAvgKm2:se,_getHexagonAreaAvgM2:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20784+(A<<3)>>3],0|(e=0))},_getHexagonEdgeLengthAvgKm:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20912+(A<<3)>>3],0|(e=0))},_getHexagonEdgeLengthAvgM:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[21040+(A<<3)>>3],0|(e=0))},_getIcosahedronFaces:function A(e,t,r){r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0;o=S,S=S+128|0,d=o+112|0,s=o+96|0,f=o,a=0|tt(0|(e|=0),0|(t|=0),52),B(),c=15&a,n[d>>2]=c,l=0|tt(0|e,0|t,45),B(),l&=127;A:do{if(0|H(l)){if(0|c)for(i=1;;){if(!(!((u=0|rt(7,0,3*(15-i|0)|0))&e)&!((0|B())&t))){a=0;break A}if(!(i>>>0>>0))break;i=i+1|0}if(!(1&a))return u=0|rt(c+1|0,0,52),f=B()|-15728641&t,f=0|A((u|e)&~(d=0|rt(7,0,3*(14-c|0)|0)),f&~B(),r),S=o,0|f;a=1}else a=0}while(0);if(!(i=0|XA(e,t,s))){a?(QA(s,d,f),u=5):(PA(s,d,f),u=6);A:do{if(0|H(l))if(c)for(i=1;;){if(!(!((l=0|rt(7,0,3*(15-i|0)|0))&e)&!((0|B())&t))){e=2;break A}if(!(i>>>0>>0)){e=5;break}i=i+1|0}else e=5;else e=2}while(0);lt(0|r,-1,e<<2);A:do{if(a)for(s=0;;){if(SA(l=f+(s<<4)|0,0|n[d>>2]),l=0|n[l>>2],-1==(0|(c=0|n[r>>2]))|(0|c)==(0|l))i=r;else{a=0;do{if((a=a+1|0)>>>0>=e>>>0){i=1;break A}c=0|n[(i=r+(a<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(n[i>>2]=l,(s=s+1|0)>>>0>=u>>>0){i=0;break}}else for(s=0;;){if(NA(l=f+(s<<4)|0,0|n[d>>2],0,1),l=0|n[l>>2],-1==(0|(c=0|n[r>>2]))|(0|c)==(0|l))i=r;else{a=0;do{if((a=a+1|0)>>>0>=e>>>0){i=1;break A}c=0|n[(i=r+(a<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(n[i>>2]=l,(s=s+1|0)>>>0>=u>>>0){i=0;break}}}while(0)}return S=o,0|i},_getIndexDigit:function(A,e,t,r){return r|=0,((t|=0)-1|0)>>>0>14?0|(r=4):(t=0|tt(0|(A|=0),0|(e|=0),3*(15-t|0)|0),B(),n[r>>2]=7&t,0|(r=0))},_getNumCells:le,_getPentagons:Ae,_getRes0Cells:function(A){A|=0;var e=0,t=0,r=0;e=0;do{rt(0|e,0,45),r=134225919|B(),n[(t=A+(e<<3)|0)>>2]=-1,n[t+4>>2]=r,e=e+1|0}while(122!=(0|e));return 0},_getResolution:function(A,e){return e=0|tt(0|(A|=0),0|(e|=0),52),B(),15&e},_greatCircleDistanceKm:ae,_greatCircleDistanceM:function(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+f(.5*(r-t)))*n+(i=+f(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+d(+r)*+d(+t)*i),2*+p(+ +c(+i),+ +c(+(1-i)))*6371.007180918475*1e3},_greatCircleDistanceRads:function(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+f(.5*(r-t)))*n+(i=+f(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+d(+r)*+d(+t)*i),2*+p(+ +c(+i),+ +c(+(1-i)))},_gridDisk:F,_gridDiskDistances:P,_gridDistance:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a,s=0,l=0;return a=S,S=S+32|0,l=a,0|(i=0|me(A|=0,e|=0,A,e,s=a+12|0))?(S=a,0|(l=i)):0|(A=0|me(A,e,t,r,l))?(S=a,0|(l=A)):(s=0|kA(s,l),n[(l=o)>>2]=s,n[l+4>>2]=((0|s)<0)<<31>>31,S=a,0|(l=0))},_gridPathCells:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a,s=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0,k=0,C=0,D=0,E=0;if(a=S,S=S+48|0,c=a+12|0,D=a,!(s=0|me(A|=0,e|=0,A,e,i=a+24|0))&&!(s=0|me(A,e,t,r,c))){C=((0|(k=0|kA(i,c)))<0)<<31>>31,n[i>>2]=0,n[i+4>>2]=0,n[i+8>>2]=0,n[c>>2]=0,n[c+4>>2]=0,n[c+8>>2]=0,0|me(A,e,A,e,i)&&M(27795,27538,692,27747),0|me(A,e,t,r,c)&&M(27795,27538,697,27747),CA(i),CA(c),g=0|k?1/+(0|k):0,t=0|n[i>>2],v=g*+((0|n[c>>2])-t|0),r=0|n[(y=i+4|0)>>2],w=g*+((0|n[c+4>>2])-r|0),s=0|n[(x=i+8|0)>>2],g*=+((0|n[c+8>>2])-s|0),n[D>>2]=t,n[(h=D+4|0)>>2]=r,n[(m=D+8|0)>>2]=s;A:do{if((0|k)<0)s=0;else for(b=0,p=0;;){E=v*(d=+(p>>>0)+4294967296*+(0|b))+ +(0|t),u=w*d+ +(0|r),d=g*d+ +(0|s),t=~~+at(+E),c=~~+at(+u),s=~~+at(+d),E=+l(+(+(0|t)-E)),u=+l(+(+(0|c)-u)),d=+l(+(+(0|s)-d));do{if(!(E>u&E>d)){if(f=0-t|0,u>d){r=f-s|0;break}r=c,s=f-c|0;break}t=0-(c+s)|0,r=c}while(0);if(n[D>>2]=t,n[h>>2]=r,n[m>>2]=s,BA(D),0|(s=0|be(A,e,D,o+(p<<3)|0)))break A;if(!((0|b)<(0|C)|(0|b)==(0|C)&p>>>0>>0)){s=0;break A}t=0|Ve(0|p,0|b,1,0),b=r=0|B(),p=t,t=0|n[i>>2],r=0|n[y>>2],s=0|n[x>>2]}}while(0);return S=a,0|s}return S=a,0|s},_gridPathCellsSize:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a=0,s=0,l=0;return i=S,S=S+32|0,l=i,(a=0|me(A|=0,e|=0,A,e,s=i+12|0))||(a=0|me(A,e,t,r,l))?(S=i,0|(l=a)):(r=0|Ve(0|(r=0|kA(s,l)),((0|r)<0)<<31>>31,1,0),s=0|B(),n[(l=o)>>2]=r,n[l+4>>2]=s,S=i,0|(l=0))},_gridRing:function(A,e,t,r){return 0|I(A|=0,e|=0,t|=0,r|=0)?(lt(0|r,0,48*t|0),0|(r=0|function(A,e,t,r){A|=0,e|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0;if(o=S,S=S+16|0,s=o,!(t|=0))return n[r>>2]=A,n[r+4>>2]=e,S=o,0;do{if((0|t)>=0){if((0|t)>13780509){if(0|(i=0|le(15,s)))break;i=0|n[(a=s)>>2],a=0|n[a+4>>2]}else d=0|qe(0|t,0|(i=((0|t)<0)<<31>>31),3,0),a=0|B(),i=0|Ve(0|t,0|i,1,0),i=0|Ve(0|(i=0|qe(0|d,0|a,0|i,0|B())),0|B(),1,0),a=0|B(),n[(d=s)>>2]=i,n[d+4>>2]=a;if(u=0|We(i,8)){if(!(d=0|We(i,4))){Ye(u),i=13;break}if(0|(i=0|L(A,e,t,u,d,i,a,0))){Ye(u),Ye(d);break}if(e=0|n[s>>2],(0|(s=0|n[s+4>>2]))>0|!(0|s)&e>>>0>0){i=0,l=0,c=0;do{!(0|(a=0|n[(A=u+(l<<3)|0)>>2]))&!(0|(A=0|n[A+4>>2]))||(0|n[d+(l<<2)>>2])!=(0|t)||(n[(f=r+(i<<3)|0)>>2]=a,n[f+4>>2]=A,i=i+1|0),l=0|Ve(0|l,0|c,1,0),c=0|B()}while((0|c)<(0|s)|(0|c)==(0|s)&l>>>0>>0)}Ye(u),Ye(d),i=0}else i=13}else i=2}while(0);return S=o,0|i}(A,e,t,r))):0|(r=0)},_gridRingUnsafe:I,_i64Add:Ve,_i64Subtract:Ze,_isPentagon:zA,_isResClassIII:function(A,e){return e=0|tt(0|(A|=0),0|(e|=0),52),B(),1&e},_isValidCell:LA,_isValidDirectedEdge:MA,_isValidIndex:function(A,e){A|=0;var t=0,n=0,o=0,i=0;if(!0&134217728==(-16777216&(e|=0))&&(n=0|tt(0|A,0|e,52),B(),n&=15,t=0|tt(0|A,0|e,45),B(),(t&=127)>>>0<=121)&&!(613566756&(i=0|rt(0|(o=0|tt(0|A,0|e,0|(i=3*(15^n)|0))),0|B(),0|i))&Ze(-1227133514,-1171,0|i,0|(o=0|B())))&!(4681&o&B())&&15==(0|n)|!(0|(i=0|tt(0|rt(0|~A,0|~e,0|(i=19+(3*n|0)|0)),0|B(),0|i)))&!(0|B())){if(!(0|r[20528+t|0]))return 1;if(!(0|A)&!(0|(t=8191&e)))return 1;if(i=0|nt(0|A,0|t),B(),(63-i|0)%3|0)return 1}return 0|MA(A,e)?0|(i=1):0|(i=1&!!(0|Te(A,e)))},_isValidVertex:Te,_latLngToCell:KA,_llvm_ctlz_i64:nt,_llvm_maxnum_f64:ot,_llvm_minnum_f64:it,_llvm_round_f64:at,_localIjToCell:function(A,e,t,r,o){var i,a;return A|=0,e|=0,t|=0,o|=0,a=S,S=S+16|0,i=a,(r|=0)?t=15:(t=0|function(A,e){e|=0;var t,r,o,i=0,a=0,s=0;if(a=0|n[(A|=0)>>2],n[e>>2]=a,s=0|n[A+4>>2],n[(r=e+4|0)>>2]=s,n[(o=e+8|0)>>2]=0,A=(i=(0|s)<(0|a))?a:s,(0|(i=i?s:a))<0){if(-2147483648==(0|i)||((0|A)>0?(2147483647-A|0)<(0|i):(-2147483648-A|0)>(0|i)))return 1;if((0|A)>-1?(-2147483648|A)>=(0|i):(-2147483648^A)<(0|i))return 1}return A=s-a|0,(0|a)<0?(i=0-a|0,n[r>>2]=A,n[o>>2]=i,n[e>>2]=0,a=0):(A=s,i=0),(0|A)<0&&(a=a-A|0,n[e>>2]=a,i=i-A|0,n[o>>2]=i,n[r>>2]=0,A=0),t=a-i|0,s=A-i|0,(0|i)<0?(n[e>>2]=t,n[r>>2]=s,n[o>>2]=0,A=s,s=t,i=0):s=a,(0|(a=(0|i)<(0|(a=(0|A)<(0|s)?A:s))?i:a))<=0||(n[e>>2]=s-a,n[r>>2]=A-a,n[o>>2]=i-a),0}(t,i))||(t=0|be(A,e,i,o)),S=a,0|t},_malloc:Ue,_maxFaceCount:function(A,e,t){t|=0;var r=0,o=0;if(o=0|tt(0|(A|=0),0|(e|=0),45),B(),!(0|H(127&o)))return o=2,n[t>>2]=o,0;if(o=0|tt(0|A,0|e,52),B(),!(o&=15))return o=5,n[t>>2]=o,0;for(r=1;;){if(!(!((0|rt(7,0,3*(15-r|0)|0))&A)&!((0|B())&e))){r=2,A=6;break}if(!(r>>>0>>0)){r=5,A=6;break}r=r+1|0}return 6==(0|A)?(n[t>>2]=r,0):0},_maxGridDiskSize:function(A,e){e|=0;var t=0,r=0,o=0;return(0|(A|=0))<0?0|(e=2):(0|A)>13780509?0|(e=0|le(15,e)):(o=0|qe(0|A,0|(t=((0|A)<0)<<31>>31),3,0),r=0|B(),t=0|Ve(0|A,0|t,1,0),t=0|Ve(0|(t=0|qe(0|o,0|r,0|t,0|B())),0|B(),1,0),A=0|B(),n[e>>2]=t,n[e+4>>2]=A,0|(e=0))},_maxPolygonToCellsSize:function(A,e,t,r){A|=0,e|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0;if(o=S,S=S+48|0,i=o+16|0,a=o+8|0,s=o,0|(t=0|Ce(t|=0)))return S=o,0|t;if(l=0|n[(c=A)+4>>2],n[(t=a)>>2]=n[c>>2],n[t+4>>2]=l,ke(a,i),!(t=0|eA(i,e,s))){if(e=0|n[a>>2],(0|(a=0|n[A+8>>2]))>0){i=0|n[A+12>>2],t=0;do{e=(0|n[i+(t<<3)>>2])+e|0,t=t+1|0}while((0|t)<(0|a))}i=0|n[(t=s)>>2],(0|(t=0|n[t+4>>2]))<(0|(a=((0|e)<0)<<31>>31))|(0|t)==(0|a)&i>>>0>>0?(n[(t=s)>>2]=e,n[t+4>>2]=a,t=a):e=i,l=0|Ve(0|e,0|t,12,0),c=0|B(),n[(t=s)>>2]=l,n[t+4>>2]=c,n[(t=r)>>2]=l,n[t+4>>2]=c,t=0}return S=o,0|t},_maxPolygonToCellsSizeExperimental:function(A,e,t,i){e|=0,t|=0,i|=0;var a,s,c=0,u=0,f=0,g=0,h=0,m=0,b=0,p=0;if(s=S,S=S+48|0,h=s+32|0,g=s+40|0,a=s,!(0|n[(A|=0)>>2]))return n[(m=i)>>2]=0,n[m+4>>2]=0,S=s,0;RA(h,0,0,0),c=0|n[(f=h)>>2],f=0|n[f+4>>2];do{if(e>>>0>15)n[(m=a)>>2]=0,n[m+4>>2]=0,n[a+8>>2]=4,n[a+12>>2]=-1,t=a+29|0,n[(m=a+16|0)>>2]=0,n[m+4>>2]=0,n[m+8>>2]=0,r[m+12|0]=0,r[0|t]=0|r[0|g],r[t+1|0]=0|r[g+1|0],r[t+2|0]=0|r[g+2|0],t=4,m=9;else{if(0|(t=0|Ce(t))){n[(h=a)>>2]=0,n[h+4>>2]=0,n[a+8>>2]=t,n[a+12>>2]=-1,m=a+29|0,n[(h=a+16|0)>>2]=0,n[h+4>>2]=0,n[h+8>>2]=0,r[h+12|0]=0,r[0|m]=0|r[0|g],r[m+1|0]=0|r[g+1|0],r[m+2|0]=0|r[g+2|0],m=9;break}if(!(t=0|We(1+(0|n[A+8>>2])|0,32))){n[(m=a)>>2]=0,n[m+4>>2]=0,n[a+8>>2]=13,n[a+12>>2]=-1,t=a+29|0,n[(m=a+16|0)>>2]=0,n[m+4>>2]=0,n[m+8>>2]=0,r[m+12|0]=0,r[0|t]=0|r[0|g],r[t+1|0]=0|r[g+1|0],r[t+2|0]=0|r[g+2|0],t=13,m=9;break}Be(A,t),n[(p=a)>>2]=c,n[p+4>>2]=f,n[(f=a+8|0)>>2]=0,n[a+12>>2]=e,n[a+20>>2]=A,n[a+24>>2]=t,r[a+28|0]=0,r[0|(c=a+29|0)]=0|r[0|g],r[c+1|0]=0|r[g+1|0],r[c+2|0]=0|r[g+2|0],n[a+16>>2]=3,b=+J(t),b*=+Z(t),u=+l(+ +o[t>>3]),u=b/+d(+ +it(+u,+ +l(+ +o[t+8>>3])))*6371.007180918475*6371.007180918475,t=0|n[(c=a+12|0)>>2];A:do{if((0|t)>0)do{if(se(t+-1|0,h),!(u/+o[h>>3]>10))break A;t=(p=0|n[c>>2])-1|0,n[c>>2]=t}while((0|p)>1)}while(0);if(ye(a),n[(c=i)>>2]=0,n[c+4>>2]=0,!(!(0|(t=0|n[(c=a)>>2]))&!(0|(c=0|n[c+4>>2]))))do{_A(t,c,e,h),g=h,g=0|Ve(0|n[(A=i)>>2],0|n[A+4>>2],0|n[g>>2],0|n[g+4>>2]),A=0|B(),n[(p=i)>>2]=g,n[p+4>>2]=A,ye(a),t=0|n[(p=a)>>2],c=0|n[p+4>>2]}while(!(!(0|t)&!(0|c)));t=0|n[f>>2]}}while(0);return S=s,0|t},_memcpy:st,_memset:lt,_originToDirectedEdges:function(A,e,t){t|=0;var r,o=0;return r=!(0|zA(A|=0,e|=0)),e&=-2130706433,n[(o=t)>>2]=r?A:0,n[o+4>>2]=r?285212672|e:0,n[(o=t+8|0)>>2]=A,n[o+4>>2]=301989888|e,n[(o=t+16|0)>>2]=A,n[o+4>>2]=318767104|e,n[(o=t+24|0)>>2]=A,n[o+4>>2]=335544320|e,n[(o=t+32|0)>>2]=A,n[o+4>>2]=352321536|e,n[(t=t+40|0)>>2]=A,n[t+4>>2]=369098752|e,0},_pentagonCount:function(){return 12},_polygonToCells:function(A,e,t,r){A|=0,e|=0,r|=0;var o,i,a,s,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0,k=0,C=0,M=0,D=0,E=0,j=0,Q=0,N=0,F=0,P=0,R=0,I=0,_=0;if(s=S,S=S+112|0,o=s+80|0,f=s+72|0,i=s,a=s+56|0,0|(l=0|Ce(t|=0)))return S=s,0|l;if(!(_=0|Ue(32+(n[(g=A+8|0)>>2]<<5)|0)))return S=s,13;if(Be(A,_),!(l=0|Ce(t))){if(I=0|n[(R=A)+4>>2],n[(l=f)>>2]=n[R>>2],n[l+4>>2]=I,ke(f,o),l=0|eA(o,e,i))R=0,I=0;else{if(l=0|n[f>>2],(0|(c=0|n[g>>2]))>0){u=0|n[A+12>>2],t=0;do{l=(0|n[u+(t<<3)>>2])+l|0,t=t+1|0}while((0|t)!=(0|c));t=l}else t=l;c=0|n[(l=i)>>2],(0|(l=0|n[l+4>>2]))<(0|(u=((0|t)<0)<<31>>31))|(0|l)==(0|u)&c>>>0>>0?(n[(l=i)>>2]=t,n[l+4>>2]=u,l=u):t=c,R=0|Ve(0|t,0|l,12,0),I=0|B(),n[(l=i)>>2]=R,n[l+4>>2]=I,l=0}if(!l){if(!(t=0|We(R,8)))return Ye(_),S=s,13;if(!(d=0|We(R,8)))return Ye(_),Ye(t),S=s,13;n[(F=o)>>2]=0,n[F+4>>2]=0,P=0|n[(F=A)+4>>2],n[(l=f)>>2]=n[F>>2],n[l+4>>2]=P,l=0|z(f,R,I,e,o,t,d);A:do{if(l)Ye(t),Ye(d),Ye(_);else{e:do{if((0|n[g>>2])>0){for(u=A+12|0,c=0;l=0|z((0|n[u>>2])+(c<<3)|0,R,I,e,o,t,d),c=c+1|0,!(0|l);)if((0|c)>=(0|n[g>>2]))break e;Ye(t),Ye(d),Ye(_);break A}}while(0);(0|I)>0|!(0|I)&R>>>0>0&<(0|d,0,R<<3),F=0|n[(P=o)+4>>2];e:do{if((0|F)>0|!(0|F)&(0|n[P>>2])>>>0>0){j=t,Q=d,N=t,F=d,P=t,l=t,M=t,D=d,E=d,t=d;t:for(;;){for(w=0,x=0,k=0,C=0,c=0,u=0;;){f=(d=i)+56|0;do{n[d>>2]=0,d=d+4|0}while((0|d)<(0|f));if(0|T(g=0|n[(e=j+(w<<3)|0)>>2],e=0|n[e+4>>2],1,i,0)){f=(d=i)+56|0;do{n[d>>2]=0,d=d+4|0}while((0|d)<(0|f));0|(d=0|We(7,4))&&(L(g,e,1,i,d,7,0,0),Ye(d))}for(y=0;;){p=0|n[(v=i+(y<<3)|0)>>2],v=0|n[v+4>>2];r:do{if(!(0|p)&!(0|v))d=c,f=u;else{if(h=0|At(0|p,0|v,0|R,0|I),g=0|B(),!(!(0|(f=0|n[(e=d=r+(h<<3)|0)>>2]))&!(0|(e=0|n[e+4>>2])))){m=0,b=0;do{if((0|m)>(0|I)|(0|m)==(0|I)&b>>>0>R>>>0)break t;if((0|f)==(0|p)&(0|e)==(0|v)){d=c,f=u;break r}h=0|$e(0|(d=0|Ve(0|h,0|g,1,0)),0|B(),0|R,0|I),g=0|B(),b=0|Ve(0|b,0|m,1,0),m=0|B(),f=0|n[(e=d=r+(h<<3)|0)>>2],e=0|n[e+4>>2]}while(!(!(0|f)&!(0|e)))}if(!(0|p)&!(0|v)){d=c,f=u;break}qA(p,v,a),0|Me(A,_,a)&&(b=0|Ve(0|c,0|u,1,0),u=0|B(),n[(m=d)>>2]=p,n[m+4>>2]=v,n[(c=Q+(c<<3)|0)>>2]=p,n[c+4>>2]=v,c=b),d=c,f=u}}while(0);if((y=y+1|0)>>>0>=7)break;c=d,u=f}if(w=0|Ve(0|w,0|x,1,0),x=0|B(),k=0|Ve(0|k,0|C,1,0),C=0|B(),c=0|n[(u=o)>>2],!((0|C)<(0|(u=0|n[u+4>>2]))|(0|C)==(0|u)&k>>>0>>0))break;c=d,u=f}if((0|u)>0|!(0|u)&c>>>0>0){c=0,u=0;do{n[(C=j+(c<<3)|0)>>2]=0,n[C+4>>2]=0,c=0|Ve(0|c,0|u,1,0),u=0|B(),k=0|n[(C=o)+4>>2]}while((0|u)<(0|k)|((0|u)==(0|k)?c>>>0<(0|n[C>>2])>>>0:0))}if(n[(C=o)>>2]=d,n[C+4>>2]=f,!((0|f)>0|!(0|f)&d>>>0>0))break e;y=t,w=E,x=P,k=D,C=Q,t=M,E=l,D=N,M=y,l=w,P=F,F=x,N=k,Q=j,j=C}Ye(N),Ye(F),Ye(_),l=1;break A}l=d}while(0);Ye(_),Ye(t),Ye(l),l=0}}while(0);return S=s,0|l}}return Ye(_),S=s,0|l},_polygonToCellsExperimental:function(A,e,t,o,i,a){o|=0,i|=0,a|=0;var s,l,c,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0;c=S,S=S+160|0,d=c+64|0,h=c+112|0,p=c,function(A,e,t,o){A|=0,e|=0,t|=0,o|=0;var i,a,s,l=0,c=0,u=0,d=0;s=S,S=S+48|0,i=s+40|0,a=s,RA(c=s+32|0,0,0,0),u=0|n[c>>2],c=0|n[c+4>>2];do{if(t>>>0<=15){if(0|(l=0|Ce(o))){n[(o=a)>>2]=0,n[o+4>>2]=0,n[a+8>>2]=l,n[a+12>>2]=-1,u=a+29|0,n[(o=a+16|0)>>2]=0,n[o+4>>2]=0,n[o+8>>2]=0,r[o+12|0]=0,r[0|u]=0|r[0|i],r[u+1|0]=0|r[i+1|0],r[u+2|0]=0|r[i+2|0];break}if(l=0|We(1+(0|n[e+8>>2])|0,32)){Be(e,l),n[(d=a)>>2]=u,n[d+4>>2]=c,n[a+8>>2]=0,n[a+12>>2]=t,n[a+16>>2]=o,n[a+20>>2]=e,n[a+24>>2]=l,r[a+28|0]=0,r[0|(u=a+29|0)]=0|r[0|i],r[u+1|0]=0|r[i+1|0],r[u+2|0]=0|r[i+2|0];break}n[(o=a)>>2]=0,n[o+4>>2]=0,n[a+8>>2]=13,n[a+12>>2]=-1,u=a+29|0,n[(o=a+16|0)>>2]=0,n[o+4>>2]=0,n[o+8>>2]=0,r[o+12|0]=0,r[0|u]=0|r[0|i],r[u+1|0]=0|r[i+1|0],r[u+2|0]=0|r[i+2|0];break}n[(u=a)>>2]=0,n[u+4>>2]=0,n[a+8>>2]=4,n[a+12>>2]=-1,d=a+29|0,n[(u=a+16|0)>>2]=0,n[u+4>>2]=0,n[u+8>>2]=0,r[u+12|0]=0,r[0|d]=0|r[0|i],r[d+1|0]=0|r[i+1|0],r[d+2|0]=0|r[i+2|0]}while(0);ye(a),n[A>>2]=n[a>>2],n[A+4>>2]=n[a+4>>2],n[A+8>>2]=n[a+8>>2],n[A+12>>2]=n[a+12>>2],n[A+16>>2]=n[a+16>>2],n[A+20>>2]=n[a+20>>2],n[A+24>>2]=n[a+24>>2],n[A+28>>2]=n[a+28>>2],S=s}(g=c+80|0,A|=0,e|=0,t|=0),ee(d,0|n[(f=g)>>2],0|n[f+4>>2],e),s=0|n[(f=d)>>2],f=0|n[f+4>>2],u=0|n[g+8>>2],n[(m=h+4|0)>>2]=n[g>>2],n[m+4>>2]=n[g+4>>2],n[m+8>>2]=n[g+8>>2],n[m+12>>2]=n[g+12>>2],n[m+16>>2]=n[g+16>>2],n[m+20>>2]=n[g+20>>2],n[m+24>>2]=n[g+24>>2],n[m+28>>2]=n[g+28>>2],n[(m=p)>>2]=s,n[m+4>>2]=f,n[(m=p+8|0)>>2]=u,e=h,t=36+(A=p+12|0)|0;do{n[A>>2]=n[e>>2],A=A+4|0,e=e+4|0}while((0|A)<(0|t));if(n[(h=p+48|0)>>2]=n[d>>2],n[h+4>>2]=n[d+4>>2],n[h+8>>2]=n[d+8>>2],n[h+12>>2]=n[d+12>>2],!(0|s)&!(0|f))return S=c,0|u;t=p+16|0,l=p+24|0,g=p+28|0,u=0,d=0,e=s,A=f;do{if(!((0|u)<(0|i)|(0|u)==(0|i)&d>>>0>>0)){b=4;break}if(f=d,d=0|Ve(0|d,0|u,1,0),u=0|B(),n[(f=a+(f<<3)|0)>>2]=e,n[f+4>>2]=A,re(h),!(0|(e=0|n[(A=h)>>2]))&!(0|(A=0|n[A+4>>2]))){if(ye(t),!(0|(A=0|n[(e=t)>>2]))&!(0|(e=0|n[e+4>>2]))){b=10;break}te(A,e,0|n[g>>2],h),e=0|n[(A=h)>>2],A=0|n[A+4>>2]}n[(f=p)>>2]=e,n[f+4>>2]=A}while(!(!(0|e)&!(0|A)));return 4==(0|b)?(0|(e=0|n[(A=p+40|0)>>2])&&Ye(e),n[(b=p+16|0)>>2]=0,n[b+4>>2]=0,n[l>>2]=0,n[p+36>>2]=0,n[g>>2]=-1,n[p+32>>2]=0,n[A>>2]=0,te(0,0,0,h),n[p>>2]=0,n[p+4>>2]=0,n[m>>2]=0,S=c,0|(p=14)):(10==(0|b)&&(n[p>>2]=0,n[p+4>>2]=0,n[m>>2]=n[l>>2]),p=0|n[m>>2],S=c,0|p)},_readInt64AsDoubleFromPointer:function(A){return+(+((0|n[(A|=0)>>2])>>>0)+4294967296*+(0|n[A+4>>2]))},_res0CellCount:function(){return 122},_round:ct,_sbrk:ut,_sizeOfCellBoundary:function(){return 168},_sizeOfCoordIJ:function(){return 8},_sizeOfGeoLoop:function(){return 8},_sizeOfGeoPolygon:function(){return 16},_sizeOfH3Index:function(){return 8},_sizeOfLatLng:function(){return 16},_sizeOfLinkedGeoPolygon:function(){return 12},_uncompactCells:function(A,e,t,r,o,i,a){A|=0,r|=0,o|=0,i|=0;var s,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0;if(s=S,S=S+16|0,m=s,!((0|(t|=0))>0|!(0|t)&(e|=0)>>>0>0))return S=s,0;if((0|(a|=0))>=16)return S=s,12;g=0,h=0,f=0,l=0;A:for(;;){if(d=0|tt(0|(c=0|n[(u=A+(g<<3)|0)>>2]),0|(u=0|n[u+4>>2]),52),B(),(15&d)>(0|a)){l=12,c=11;break}if(ee(m,c,u,a),!(0|(u=0|n[(d=m)>>2]))&!(0|(d=0|n[d+4>>2])))c=f;else{c=f;do{if(!((0|l)<(0|i)|(0|l)==(0|i)&c>>>0>>0)){c=10;break A}n[(f=r+(c<<3)|0)>>2]=u,n[f+4>>2]=d,c=0|Ve(0|c,0|l,1,0),l=0|B(),re(m),u=0|n[(f=m)>>2],d=0|n[f+4>>2]}while(!(!(0|u)&!(0|d)))}if(g=0|Ve(0|g,0|h,1,0),!((0|(h=0|B()))<(0|t)|(0|h)==(0|t)&g>>>0>>0)){l=0,c=11;break}f=c}return 10==(0|c)?(S=s,0|(m=14)):11==(0|c)?(S=s,0|l):0},_uncompactCellsSize:function(A,e,t,r,o){A|=0,e|=0,t|=0,r|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,d=0,f=0;a=S,S=S+16|0,i=a;A:do{if((0|t)>0|!(0|t)&e>>>0>0){for(d=0,l=0,s=0,f=0;;){if(!(!(0|(c=0|n[(u=A+(d<<3)|0)>>2]))&!(0|(u=0|n[u+4>>2]))||(u=!(0|_A(c,u,r,i)),l=0|Ve(0|n[(c=i)>>2],0|n[c+4>>2],0|l,0|s),s=0|B(),u))){s=12;break}if(d=0|Ve(0|d,0|f,1,0),!((0|(f=0|B()))<(0|t)|(0|f)==(0|t)&d>>>0>>0))break A}return S=a,0|s}l=0,s=0}while(0);return n[o>>2]=l,n[o+4>>2]=s,S=a,0},_vertexToLatLng:function(A,e,t){t|=0;var r,o,i,a,s=0,l=0;return a=S,S=S+192|0,o=a,i=a+168|0,s=0|tt(0|(A|=0),0|(e|=0),56),B(),s&=7,0|(r=0|XA(A,l=-2130706433&e|134217728,i))?(S=a,0|(l=r)):(e=0|tt(0|A,0|e,52),B(),e&=15,0|zA(A,l)?jA(i,e,s,1,o):FA(i,e,s,1,o),l=o+8|0,n[t>>2]=n[l>>2],n[t+4>>2]=n[l+4>>2],n[t+8>>2]=n[l+8>>2],n[t+12>>2]=n[l+12>>2],S=a,0|(l=0))},establishStackSpace:function(A,e){S=A|=0},stackAlloc:function(A){var e;return e=S,S=15+(S=S+(A|=0)|0)&-16,0|e},stackRestore:function(A){S=A|=0},stackSave:function(){return 0|S}}}({Math:Math,Int8Array:Int8Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Float32Array:Float32Array,Float64Array:Float64Array},{b:function(A){s=A},c:function(){return s},d:function(A,e,t,r){tA("Assertion failed: "+v(A)+", at: "+[e?v(e):"unknown filename",t,r?v(r):"unknown function"])},e:function(A){return t.___errno_location&&(h[t.___errno_location()>>2]=A),A},f:H,g:function(A,e,t){f.set(f.subarray(e,e+t),A)},h:function(A){var e=H(),t=16777216,r=2130706432;if(A>r)return!1;for(var n=Math.max(e,16777216);n0))return 0;for(var n=t+r-1,o=0;o=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&A.charCodeAt(++o)),i<=127){if(t>=n)break;e[t++]=i}else if(i<=2047){if(t+1>=n)break;e[t++]=192|i>>6,e[t++]=128|63&i}else if(i<=65535){if(t+2>=n)break;e[t++]=224|i>>12,e[t++]=128|i>>6&63,e[t++]=128|63&i}else{if(t+3>=n)break;e[t++]=240|i>>18,e[t++]=128|i>>12&63,e[t++]=128|i>>6&63,e[t++]=128|63&i}}e[t]=0}(A,f,e,t)}(A,e=Z(t),t)}return e},array:function(A){var e,t,r=Z(A.length);return e=A,t=r,d.set(e,t),r}},o=c(A),i=[],a=0;if(r)for(var s=0;s>1]=e;break;case"i32":h[A>>2]=e;break;case"i64":R=[e>>>0,(L=e,+Q(L)>=1?L>0?(0|F(+S(L/4294967296),4294967295))>>>0:~~+N((L-+(~~L>>>0))/4294967296)>>>0:0)],h[A>>2]=R[0],h[A+4>>2]=R[1];break;case"float":m[A>>2]=e;break;case"double":b[A>>3]=e;break;default:tA("invalid type for setValue: "+t)}},t.getValue=function(A,e,t){switch("*"===(e=e||"i8").charAt(e.length-1)&&(e="i32"),e){case"i1":case"i8":return d[0|A];case"i16":return g[A>>1];case"i32":case"i64":return h[A>>2];case"float":return m[A>>2];case"double":return b[A>>3];default:tA("invalid type for getValue: "+e)}return null},I){z(I)||(W=I,I=t.locateFile?t.locateFile(W,o):o+W),P++,t.monitorRunDependencies&&t.monitorRunDependencies(P);var X=function(A){A.byteLength&&(A=new Uint8Array(A)),f.set(A,8),t.memoryInitializerRequest&&delete t.memoryInitializerRequest.response,function(){if(P--,t.monitorRunDependencies&&t.monitorRunDependencies(P),0==P&&T){var A=T;T=null,A()}}()},q=function(){n(I,X,function(){throw"could not load memory initializer "+I})},$=O(I);if($)X($.buffer);else if(t.memoryInitializerRequest){var AA=function(){var A=t.memoryInitializerRequest,e=A.response;if(200!==A.status&&0!==A.status){var r=O(t.memoryInitializerRequestURL);if(!r)return void q();e=r.buffer}X(e)};t.memoryInitializerRequest.response?setTimeout(AA,0):t.memoryInitializerRequest.addEventListener("load",AA)}else q()}function eA(A){function e(){V||(V=!0,l||(k(B),k(M),t.onRuntimeInitialized&&t.onRuntimeInitialized(),function(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)j(t.postRun.shift());k(D)}()))}P>0||(function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)E(t.preRun.shift());k(C)}(),P>0||(t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),e()},1)):e()))}function tA(A){throw t.onAbort&&t.onAbort(A),i(A+=""),a(A),l=!0,"abort("+A+"). Build with -s ASSERTIONS=1 for more info."}if(T=function A(){V||eA(),V||(T=A)},t.run=eA,t.abort=tA,t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return eA(),A}("object"==typeof At?At:{}),et="number",tt={0:"Success",1:"The operation failed but a more specific error is not available",2:"Argument was outside of acceptable range",3:"Latitude or longitude arguments were outside of acceptable range",4:"Resolution argument was outside of acceptable range",5:"Cell argument was not valid",6:"Directed edge argument was not valid",7:"Undirected edge argument was not valid",8:"Vertex argument was not valid",9:"Pentagon distortion was encountered",10:"Duplicate input",11:"Cell arguments were not neighbors",12:"Cell arguments had incompatible resolutions",13:"Memory allocation failed",14:"Bounds of provided memory were insufficient",15:"Mode or flags argument was not valid",16:"Index argument was not valid",17:"Base cell number was outside of acceptable range",18:"Child indexing digits invalid",19:"Child indexing digits refer to a deleted subsequence"},rt={1e3:"Unknown unit",1001:"Array length out of bounds",1002:"Got unexpected null value for H3 index"};function nt(A,e,t){var r=t&&"value"in t,n=new Error((A[e]||"Unknown error")+" (code: "+e+(r?", value: "+t.value:"")+")");return n.code=e,n}function ot(A){if(0!==A)throw function(A,e){return nt(tt,A,2===arguments.length?{value:e}:{})}(A)}var it={};[["sizeOfH3Index",et],["sizeOfLatLng",et],["sizeOfCellBoundary",et],["sizeOfGeoLoop",et],["sizeOfGeoPolygon",et],["sizeOfLinkedGeoPolygon",et],["sizeOfCoordIJ",et],["readInt64AsDoubleFromPointer",et],["isValidCell",et,[et,et]],["isValidIndex",et,[et,et]],["latLngToCell",et,[et,et,et,et]],["cellToLatLng",et,[et,et,et]],["cellToBoundary",et,[et,et,et]],["maxGridDiskSize",et,[et,et]],["gridDisk",et,[et,et,et,et]],["gridDiskDistances",et,[et,et,et,et,et]],["gridRing",et,[et,et,et,et]],["gridRingUnsafe",et,[et,et,et,et]],["maxPolygonToCellsSize",et,[et,et,et,et]],["polygonToCells",et,[et,et,et,et]],["maxPolygonToCellsSizeExperimental",et,[et,et,et,et]],["polygonToCellsExperimental",et,[et,et,et,et,et,et]],["cellsToLinkedMultiPolygon",et,[et,et,et]],["destroyLinkedMultiPolygon",null,[et]],["compactCells",et,[et,et,et,et]],["uncompactCells",et,[et,et,et,et,et,et]],["uncompactCellsSize",et,[et,et,et,et,et]],["isPentagon",et,[et,et]],["isResClassIII",et,[et,et]],["getBaseCellNumber",et,[et,et]],["getResolution",et,[et,et]],["getIndexDigit",et,[et,et,et]],["constructCell",et,[et,et,et,et]],["maxFaceCount",et,[et,et,et]],["getIcosahedronFaces",et,[et,et,et]],["cellToParent",et,[et,et,et,et]],["cellToChildren",et,[et,et,et,et]],["cellToCenterChild",et,[et,et,et,et]],["cellToChildrenSize",et,[et,et,et,et]],["cellToChildPos",et,[et,et,et,et]],["childPosToCell",et,[et,et,et,et,et,et]],["areNeighborCells",et,[et,et,et,et,et]],["cellsToDirectedEdge",et,[et,et,et,et,et]],["getDirectedEdgeOrigin",et,[et,et,et]],["getDirectedEdgeDestination",et,[et,et,et]],["isValidDirectedEdge",et,[et,et]],["directedEdgeToCells",et,[et,et,et]],["originToDirectedEdges",et,[et,et,et]],["directedEdgeToBoundary",et,[et,et,et]],["gridDistance",et,[et,et,et,et,et]],["gridPathCells",et,[et,et,et,et,et]],["gridPathCellsSize",et,[et,et,et,et,et]],["cellToLocalIj",et,[et,et,et,et,et,et]],["localIjToCell",et,[et,et,et,et,et]],["getHexagonAreaAvgM2",et,[et,et]],["getHexagonAreaAvgKm2",et,[et,et]],["getHexagonEdgeLengthAvgM",et,[et,et]],["getHexagonEdgeLengthAvgKm",et,[et,et]],["greatCircleDistanceM",et,[et,et]],["greatCircleDistanceKm",et,[et,et]],["greatCircleDistanceRads",et,[et,et]],["cellAreaM2",et,[et,et,et]],["cellAreaKm2",et,[et,et,et]],["cellAreaRads2",et,[et,et,et]],["edgeLengthM",et,[et,et,et]],["edgeLengthKm",et,[et,et,et]],["edgeLengthRads",et,[et,et,et]],["getNumCells",et,[et,et]],["getRes0Cells",et,[et]],["res0CellCount",et],["getPentagons",et,[et,et]],["pentagonCount",et],["cellToVertex",et,[et,et,et,et]],["cellToVertexes",et,[et,et,et]],["vertexToLatLng",et,[et,et,et]],["isValidVertex",et,[et,et]]].forEach(function(A){it[A[0]]=At.cwrap.apply(At,A)});var at=16,st=it.sizeOfH3Index(),lt=it.sizeOfLatLng(),ct=it.sizeOfCellBoundary();it.sizeOfGeoPolygon(),it.sizeOfGeoLoop(),it.sizeOfLinkedGeoPolygon(),it.sizeOfCoordIJ();var ut=/[^0-9a-fA-F]/;function dt(A){if(A>=0)return A.toString(at);var e=ft(8,(A&=2147483647).toString(at));return(parseInt(e[0],at)+8).toString(at)+e.substring(1)}function ft(A,e){for(var t=A-e.length,r="",n=0;n.85?.9+(i-.85)/.15*.1:.1+(i-.15)/.7*.8;var i;return kt(r[Math.min(23,Math.floor(24*o))])}function Bt({coveragePoints:t,visible:r,terrainEnabled:n=!1,brightness:i=.7,basemapMode:a="dark"}){const{current:s}=o(),[l,c]=A.useState(null);A.useEffect(()=>{const A=()=>{var A;const e=null==(A=null==s?void 0:s.getMap)?void 0:A.call(s);e&&!l&&c(e)};A();const e=setInterval(A,50),t=setTimeout(()=>clearInterval(e),5e3);return()=>{clearInterval(e),clearTimeout(t)}},[s,l]);const[u,d]=A.useState(null),[f,g]=A.useState(!1),h=A.useRef({aborted:!1}),m=A.useRef(0),b=A.useRef(a),p=function(e){const[t,r]=A.useState(e);return A.useEffect(()=>{const A=setTimeout(()=>r(e),300);return()=>clearTimeout(A)},[e,300]),t}(t),v=A.useMemo(()=>function(A="dark"){var e;if("light"===A)return xt;const t=z();return 24===t.length&&0!==(null==(e=t[0])?void 0:e[0])?t:wt}(a),[a]);A.useEffect(()=>{if(!p||!Array.isArray(p)||0===p.length)return void queueMicrotask(()=>{d(null),m.current=0});const A=b.current!==a;if(p.length===m.current&&u&&!A)return;m.current=p.length,b.current=a,h.current.aborted=!0,h.current={aborted:!1};const e=h.current;g(!0);const{cells:t,minQuality:r,maxQuality:n}=function(A){const e=new Map;for(const o of A){if("number"!=typeof o.lat||"number"!=typeof o.lon||isNaN(o.lat)||isNaN(o.lon))continue;const A=mt(o.lat,o.lon,8),t=e.get(A),r=o.weight;t?(t.count++,t.qualitySum+=r):e.set(A,{count:1,qualitySum:r})}const t=[];let r=1/0,n=-1/0;for(const[o,i]of e.entries()){const A=i.qualitySum/i.count;t.push({hexId:o,count:i.count,avgQuality:A}),r=Math.min(r,A),n=Math.max(n,A)}return{cells:t,minQuality:t.length>0?r:0,maxQuality:t.length>0?n:0}}(p);if(0===t.length)return d(null),void g(!1);if(t.length<500){const A=function(A,e,t,r){const n=[];for(const o of A){const A=bt(o.hexId).map(([A,e])=>[e,A]);A.push(A[0]);const i=Ct(o.avgQuality,e,t,r);n.push({type:"Feature",properties:{color:i,quality:o.avgQuality,count:o.count},geometry:{type:"Polygon",coordinates:[A]}})}return{type:"FeatureCollection",features:n}}(t,r,n,v);return void(e.aborted||(d(A),g(!1)))}return async function(A,e,t,r,n){const o=[];let i=0;for(;i[e,A]);a.push(a[0]);const s=Ct(n.avgQuality,e,t,r);o.push({type:"Feature",properties:{color:s,quality:n.avgQuality,count:n.count},geometry:{type:"Polygon",coordinates:[a]}})}irequestAnimationFrame(A))}return{type:"FeatureCollection",features:o}}(t,r,n,v,e).then(A=>{!e.aborted&&A&&d(A)}).finally(()=>{e.aborted||g(!1)}),()=>{e.aborted=!0}},[p,v]),A.useEffect(()=>{if(!l)return;const A=()=>{var A,e;try{const t=l.getLayer(yt),n=l.getSource(vt);if(r&&u&&u.features.length>0){if(n?l.getSource(vt).setData(u):l.addSource(vt,{type:"geojson",data:u}),!t){const t=l.getLayer("topology-weak-edges-native"),r=null==(e=null==(A=l.getStyle())?void 0:A.layers)?void 0:e.find(A=>"symbol"===A.type),n=t?"topology-weak-edges-native":null==r?void 0:r.id;l.addLayer({id:yt,type:"fill",source:vt,paint:{"fill-color":["get","color"],"fill-opacity":i}},n)}}else t&&l.removeLayer(yt),n&&l.removeSource(vt)}catch(t){}};l.isStyleLoaded()?A():l.once("style.load",A)},[l,r,u,n]),A.useEffect(()=>{if(l&&r)try{l.getLayer(yt)&&l.setPaintProperty(yt,"fill-opacity",i)}catch{}},[l,i,r]),A.useEffect(()=>()=>{if(l)try{l.getLayer(yt)&&l.removeLayer(yt),l.getSource(vt)&&l.removeSource(vt)}catch{}},[l]);const y=(null==u?void 0:u.features.length)??0;return y>0&&r?e.jsx("div",{"data-testid":"wardriving-hexlayer-maplibre-active","data-point-count":(null==t?void 0:t.length)||0,"data-cell-count":y,"data-terrain-enabled":n,"data-is-processing":f,style:{display:"none"}}):null}const Mt="https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png",Dt="terrarium",Et="terrain-dem",jt="hillshade-dem",Qt="terrain-hillshade";function Nt({enabled:e,exaggeration:t=4}){const{current:r}=o(),[n,i]=A.useState(null),a=A.useRef(null);return A.useEffect(()=>{const A=()=>{var A;const e=null==(A=null==r?void 0:r.getMap)?void 0:A.call(r);e&&!n&&i(e)};A();const e=setInterval(A,50),t=setTimeout(()=>clearInterval(e),5e3);return()=>{clearInterval(e),clearTimeout(t)}},[r,n]),A.useEffect(()=>{if(!n)return;let A=!0;const e=()=>{var e,t;if(A)try{if(n.getSource(jt)||n.addSource(jt,{type:"raster-dem",tiles:[Mt],encoding:Dt,tileSize:256,maxzoom:14}),!n.getLayer(Qt)){const A=null==(t=null==(e=n.getStyle())?void 0:e.layers)?void 0:t.find(A=>"symbol"===A.type);n.addLayer({id:Qt,type:"hillshade",source:jt,paint:{"hillshade-shadow-color":"rgba(10, 10, 10, 0.6)","hillshade-highlight-color":"rgba(245, 240, 230, 0.4)","hillshade-accent-color":"rgba(90, 75, 65, 0.3)","hillshade-illumination-direction":315,"hillshade-exaggeration":.35}},null==A?void 0:A.id)}n.getSource(Et)||n.addSource(Et,{type:"raster-dem",tiles:[Mt],encoding:Dt,tileSize:256,maxzoom:14})}catch(r){}};return n.isStyleLoaded()?e():(n.once("style.load",e),n.once("load",()=>{A&&!n.getSource(jt)&&e()})),()=>{A=!1}},[n]),A.useEffect(()=>{if(!n)return;let A=!0,r=!1;const o=()=>{if(A&&n.getSource(Et))try{e?(n.setCenterClampedToGround(!1),n.setTerrain({source:Et,exaggeration:t}),n.setMaxPitch(70),!r&&n.getPitch()<30&&!n.isMoving()&&(r=!0,null!==a.current&&clearTimeout(a.current),a.current=window.setTimeout(()=>{a.current=null,A&&!n.isMoving()&&n.getPitch()<30&&n.easeTo({pitch:45,duration:1e3})},200))):(n.setTerrain(null),n.setCenterClampedToGround(!0),n.getPitch()>0&&!n.isMoving()&&n.easeTo({pitch:0,duration:800}),n.setMaxPitch(60))}catch(o){}};if(n.isStyleLoaded()&&n.getSource(Et))o();else{const A=()=>{n.getSource(Et)&&o()};n.once("idle",A)}return()=>{A=!1,null!==a.current&&(clearTimeout(a.current),a.current=null)}},[n,e,t]),A.useEffect(()=>()=>{var A;try{(null==(A=null==n?void 0:n.getStyle)?void 0:A.call(n))&&n.isStyleLoaded()&&(n.setTerrain(null),n.getLayer(Qt)&&n.removeLayer(Qt),n.getSource(jt)&&n.removeSource(jt),n.getSource(Et)&&n.removeSource(Et))}catch{}},[n]),null}const St=.03,Ft=.1,Pt=2;function Tt(A,e=3){if(A.length<3||e<=0)return A;let t=A;for(let r=0;r0&&A.push([A[0][0],A[0][1]]),t=A}return t}function Lt(A,e={}){const t=function(A,e={}){if(A.length<3)return{coordinates:[],valid:!1};const{bandwidth:t=St,threshold:n=Ft,cellSize:o=Pt}=e,i=function(A,e){let t=1/0,r=-1/0,n=1/0,o=-1/0;for(const[i,a]of A)ir&&(r=i),ao&&(o=a);return t-=e,r+=e,n-=e,o+=e,{minX:t,minY:n,maxX:r,maxY:o,width:r-t,height:o-n}}(A,.02),a=Math.ceil(i.width/(t/2)),s=Math.ceil(i.height/(t/2)),l=Math.min(1,200/Math.max(a,s)),c=Math.max(10,Math.ceil(a*l)),u=Math.max(10,Math.ceil(s*l)),d=A=>A/c*i.width+i.minX,f=A=>A/u*i.height+i.minY,g=t/i.width*c;try{const e=r().x(A=>(A[0]-i.minX)/i.width*c).y(A=>(A[1]-i.minY)/i.height*u).size([c,u]).bandwidth(Math.max(5,g)).cellSize(o)(A);if(0===e.length)return{coordinates:[],valid:!1};const t=Math.max(...e.map(A=>A.value))*n;let a=e[0],s=1/0;for(const A of e){const e=Math.abs(A.value-t);e0){const e=A[0],t=A[A.length-1];e[0]===t[0]&&e[1]===t[1]||A.push([e[0],e[1]])}if(A.length>=4){const t=Tt(A);e.push(t)}}e.length>0&&l.push(e)}const h=[];for(const A of l)for(const e of A)h.push(e);return{coordinates:l,valid:l.length>0}}catch(h){return{coordinates:[],valid:!1}}}(A,e);return t.valid&&0!==t.coordinates.length?1===t.coordinates.length?{type:"Polygon",coordinates:t.coordinates[0]}:{type:"MultiPolygon",coordinates:t.coordinates}:null}function Rt(A,e,t){return(e[0]-A[0])*(t[1]-A[1])-(e[1]-A[1])*(t[0]-A[0])}function It(A,e,t,r,n){const o=n*n,i=o*n;return[.5*(2*e[0]+(-A[0]+t[0])*n+(2*A[0]-5*e[0]+4*t[0]-r[0])*o+(-A[0]+3*e[0]-3*t[0]+r[0])*i),.5*(2*e[1]+(-A[1]+t[1])*n+(2*A[1]-5*e[1]+4*t[1]-r[1])*o+(-A[1]+3*e[1]-3*t[1]+r[1])*i)]}function _t(A){let e=function(A){if(A.length<3)return A;const e=[...A].sort((A,e)=>A[0]-e[0]||A[1]-e[1]),t=[];for(const n of e){for(;t.length>=2&&Rt(t[t.length-2],t[t.length-1],n)<=0;)t.pop();t.push(n)}const r=[];for(let n=e.length-1;n>=0;n--){const A=e[n];for(;r.length>=2&&Rt(r[r.length-2],r[r.length-1],A)<=0;)r.pop();r.push(A)}return t.pop(),r.pop(),t.concat(r)}(A);if(e.length<3)return null;e=function(A){if(A.length<3)return A;let e=0,t=0;for(const[r,n]of A)e+=r,t+=n;return e/=A.length,t/=A.length,A.map(([A,r])=>{const n=A-e,o=r-t,i=Math.sqrt(n*n+o*o);if(i<1e-4)return[A,r];const a=(i+.008)/i;return[e+n*a,t+o*a]})}(e);const t=function(A){if(A.length<3)return A;const e=[],t=A.length;for(let r=0;rt?function(A,e,t,r){const n=[];for(const[o,i]of A.communities){const A=[];for(const t of i){const r=e.get(t);r&&A.push([r[1],r[0]])}if(A.length<3)continue;let a=Lt(A,{bandwidth:t,threshold:r});a||(a=_t(A)),a&&n.push({type:"Feature",properties:{community:o,color:cA(o),borderColor:lA(o),nodeCount:i.length},geometry:a})}return{type:"FeatureCollection",features:n}}(t,r,s,l):{type:"FeatureCollection",features:[]},[t,r,s,l]),d=n?o:0,f={"fill-color":["get","color"],"fill-opacity":d},g={"line-color":["get","borderColor"],"line-width":c,"line-opacity":d};return e.jsxs(i,{id:"mincut-partition",type:"geojson",data:u,children:[e.jsx(a,{id:"mincut-partition-fill",type:"fill",paint:f}),e.jsx(a,{id:"mincut-partition-stroke",type:"line",paint:g})]})}const Ht={showTopology:!1,showNeighborLines:!0,show3DTerrain:!1,showMinCut:!1,nodeFilter:"all"},Gt=DA()(EA(A=>({viewState:null,setViewState:e=>A({viewState:e,lastSavedAt:Date.now()}),toggles:Ht,setToggle:(e,t)=>A(A=>({toggles:{...A.toggles,[e]:t},lastSavedAt:Date.now()})),setToggles:e=>A(A=>({toggles:{...A.toggles,...e},lastSavedAt:Date.now()})),hasAnalyzed:!1,setHasAnalyzed:e=>A({hasAnalyzed:e,lastSavedAt:Date.now()}),lastSavedAt:null,reset:()=>A({viewState:null,toggles:Ht,hasAnalyzed:!1,lastSavedAt:null})}),{name:"pymc-map-view",partialize:A=>({viewState:A.viewState,toggles:A.toggles,hasAnalyzed:A.hasAnalyzed,lastSavedAt:A.lastSavedAt})}));function Ot(A,e=!1,t=!1,r=!1,n=.7,o){const i=v(o);return r?n>=.75?i.restBright:i.rest:n>=.85?i.rest:i.restDim}function Ut(A){return[A[1],A[0]]}function Yt(A,e,t,r=12){const[n,o]=A,[i,a]=e,s=[];for(let l=0;l<=r;l++){const A=l/r,e=o+(a-o)*A,c=n+(i-n)*A,u=4*t*A*(1-A);s.push([e,c,u])}return s}function Wt(A,e,t,r,n,o,i,a,s,l,c,u="dark"){const d=Ae(),f=[];let g=1/0,h=-1/0;const m=[];for(const p of A){const A=.7*(p.edge.avgConfidence??(e?.7:.5))+p.edge.certainCount/Math.max(i,1)*.3+(e?.5:0);m.push({polyline:p,brightnessScore:A}),g=Math.min(g,A),h=Math.max(h,A)}if(0===m.length)return{type:"FeatureCollection",features:[]};const b=h-g||1;m.sort((A,e)=>A.brightnessScore-e.brightnessScore);for(const{polyline:p,brightnessScore:v}of m){const{from:A,to:i,edge:h}=p,m=t.get(h.key)??0;if(m<=0)continue;const y=a.has(h.key),w=s.has(h.key),x=h.avgConfidence??(e?.7:.5),k=l===h.key,C=c[h.fromHash],B=c[h.toHash],M=(null==C?void 0:C.node_name)||(null==C?void 0:C.name)||h.fromHash.slice(0,8),D=(null==B?void 0:B.node_name)||(null==B?void 0:B.name)||h.toHash.slice(0,8),E=[A[0]+(i[0]-A[0])*m,A[1]+(i[1]-A[1])*m];let j,Q,N,S;if(e){const A=o.get(h.key)??XA(h.certainCount),e=n.get(h.key)??A;j=e+(A-e)*r,k?j=Math.max(1.6*j,4.5):w&&(j*=1.3)}else j=1.5;if(Q=k?d.edges.highlight:Ot(0,h.isDirectPathEdge??!1,y,w,x,u),N=k?d.edges.highlight:h.isDirectPathEdge?d.edges.hoverDirect:y?d.edges.hoverLoop:d.edges.hoverStandard,e){const A=Math.min(1.5*m,1)*d.edgeOpacity;S=w?1.15*A:A}else S=(.3+.3*x)*m;k&&(S=.95);const F=(v-g)/b;f.push({type:"Feature",properties:{key:h.key,baseColor:Q,hoverColor:N,baseWidth:j,baseOpacity:S,brightnessScore:F,isLoopEdge:y,isBackbone:w,isDirectPath:h.isDirectPathEdge??!1,isHubConnection:h.isHubConnection??!1,isZeroHop:h.isZeroHop??!1,isValidated:e,certainCount:h.certainCount,confidence:x,symmetryRatio:h.symmetryRatio??1,dominantDirection:h.dominantDirection??"balanced",fromName:M,toName:D,fromHash:h.fromHash,toHash:h.toHash},geometry:{type:"LineString",coordinates:[Ut(A),Ut(E)]}})}return{type:"FeatureCollection",features:f}}function Vt(A,e){const t=Ae(),r=[];let n=0;for(const o of A){const A=e.get(o.hash);A&&A.blendedScore>n&&(n=A.blendedScore)}for(const o of A){const{from:A,to:i,hash:a,neighbor:s,lastHopData:l}=o,c=`neighbor-${a}`,u=(null==l?void 0:l.avgRssi)??s.rssi??null,d=(null==l?void 0:l.avgSnr)??s.snr??null,f=(null==l?void 0:l.count)??0,g=(null==l?void 0:l.confidence)??1,h=e.get(a),m=(null==h?void 0:h.listenerScore)??0,b=(null==h?void 0:h.loudScore)??0,p=(null==h?void 0:h.blendedScore)??0,v=n>0?p/n:0,y=o.rxAdvertCount??0,w=o.txProxyCount??0,x=y+w,k=x>0?(w-y)/x:0,C=Yt(A,i,150,8);r.push({type:"Feature",properties:{key:c,hash:a,name:s.node_name||s.name||a.slice(0,8),prefix:a.slice(2,4).toUpperCase(),color:t.neighborColor,width:2.5,opacity:.85,rssi:u,snr:d,packetCount:f,confidence:g,hasAvgRssi:void 0!==(null==l?void 0:l.avgRssi),hasAvgSnr:void 0!==(null==l?void 0:l.avgSnr),isNeighborEdge:!0,listenerScore:m,loudScore:b,blendedScore:p,trafficWeight:v,linkAsymmetry:k,rxAdvertCount:y,txProxyCount:w},geometry:{type:"LineString",coordinates:C}})}return{type:"FeatureCollection",features:r}}function Zt(A,e){if(A<240)return.5;if(A<480)return 1;const t=(A-480)/(e-480);return Math.max(0,.33*(1-t))}function Kt(A,e,t){const r=t?U(t):null,n=[];for(const o of A){if(r&&o.toUpperCase()===r){t&&n.push(t);continue}const A=e.get(o.toUpperCase());A&&n.push(A)}return n}const Jt="edge-blink-source",Xt="edge-blink-layer",qt=1e3,$t=1e3,Ar=b.teal,er="node-markers-layer";function tr(A){return A<0||A>=qt?0:1-A/qt}function rr(A){if(A<0)return 0;if(A>=$t)return 0;const e=A/$t;return Math.pow(1-e,3)}function nr(A){return[A[1],A[0]]}const or=A.memo(function({nodeHash:A,width:t=60,height:r=20,color:n,showArea:o=!0,showTooltip:i=!1,className:a=""}){const s=W(A),l=V(),c=!Z().backgroundLoadComplete||l,u="number"==typeof t?t:60;return e.jsx(IA,{data:s,width:u,height:r,color:n,isLoading:c,className:a})});function ir(A){const e=new Date(1e3*A);return`${(e.getMonth()+1).toString().padStart(2,"0")}/${e.getDate().toString().padStart(2,"0")}`}function ar({txDelayRec:t,onRemove:r}){const[n,o]=A.useState(!1),i=t.floodFactor??t.txDelayFactor,a=t.directFactor??t.directTxDelayFactor;return e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsxs("button",{onClick:async()=>{const A=`set txdelay ${i.toFixed(1)}\nset direct.txdelay ${a.toFixed(1)}`;try{await navigator.clipboard.writeText(A),o(!0),setTimeout(()=>o(!1),1500)}catch(e){const t=document.createElement("textarea");t.value=A,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{document.execCommand("copy"),o(!0),setTimeout(()=>o(!1),1500)}catch{}document.body.removeChild(t)}},className:"flex items-center gap-2 flex-1 py-1 px-1.5 bg-sys-amber/5 hover:bg-sys-amber/10 rounded transition-colors group",title:"Click to copy CLI commands",children:[e.jsx(JA,{className:"w-3 h-3 text-sys-amber shrink-0"}),e.jsx("span",{className:"text-fg-muted",children:"TxDelay"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-fg-muted",children:"F"}),e.jsxs("span",{className:"data-box data-box-compact text-sys-amber",children:["×",i.toFixed(1)]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-fg-muted",children:"D"}),e.jsxs("span",{className:"data-box data-box-compact text-sys-amber",children:["×",a.toFixed(1)]})]})]}),n?e.jsx(I,{className:"w-3 h-3 text-sys-green ml-auto"}):e.jsx(HA,{className:"w-3 h-3 text-fg-muted opacity-0 group-hover:opacity-100 transition-opacity ml-auto"})]}),r&&e.jsx("button",{onClick:r,className:"p-1 text-fg-secondary hover:text-sys-red hover:bg-sys-red/10 rounded transition-colors",title:"Remove from contacts",children:e.jsx(tA,{className:"w-3.5 h-3.5"})})]})}function sr({hash:t,hashPrefix:r,name:n,isHub:o,isGateway:i,isBackbone:a,isZeroHop:s,isMobile:l,isRoomServer:c,isStale:u,lastSeenTimestamp:d,centrality:f,affinity:g,meanSnr:h,meanRssi:m,neighbor:b,onRemove:p,txDelayRec:v}){const[y,w]=A.useState(!1),x=s?"Direct":(null==g?void 0:g.typicalHopPosition)?`${g.typicalHopPosition}-hop`:null,k=v&&!v.insufficientData;return e.jsxs("div",{className:"w-[240px] pr-2",children:[e.jsx("div",{className:"text-[14px] font-semibold text-fg-primary leading-tight truncate mb-1",children:n}),e.jsxs("div",{className:"flex items-center gap-1 flex-wrap mb-1.5",children:[e.jsx("code",{className:"type-data-xs text-fg-secondary bg-data-box-bg border border-data-box-border px-1 py-0.5 rounded",children:r}),e.jsx("button",{onClick:async()=>{try{await navigator.clipboard.writeText(t),w(!0),setTimeout(()=>w(!1),1500)}catch(A){const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();try{document.execCommand("copy"),w(!0),setTimeout(()=>w(!1),1500)}catch{}document.body.removeChild(e)}},className:"p-0.5 hover:bg-subtle-fill-hover rounded transition-colors",title:"Copy full hash",children:y?e.jsx(I,{className:"w-3 h-3 text-sys-green"}):e.jsx(HA,{className:"w-3 h-3 text-fg-secondary"})}),e.jsx(_A,{hash:t,size:"sm"}),x&&e.jsx(K,{color:s?PA.direct:PA.multihop,compact:!0,children:x}),b.is_repeater&&e.jsx(K,{color:TA.repeater,compact:!0,children:"Rptr"}),o&&e.jsx(K,{color:TA.hub,compact:!0,title:"Hub: ≥10% of last-hop traffic",children:"Hub"}),i&&!o&&e.jsx(K,{color:TA.gateway,compact:!0,title:"Gateway: 7-10% of last-hop traffic",children:"Gate"}),a&&e.jsx(K,{color:TA.backbone,compact:!0,title:"Backbone",children:"Bone"}),l&&e.jsx(K,{color:TA.mobile,compact:!0,children:"Mobile"}),c&&e.jsx(K,{color:TA.room,compact:!0,children:"Room"}),u&&d&&e.jsxs(K,{compact:!0,title:"Neighbor not heard in 7+ days",children:["Idle ",ir(d)]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-fg-secondary mb-1.5",children:[e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(_,{className:"w-3 h-3 text-fg-muted shrink-0"}),e.jsx("span",{className:"font-mono",children:J(b.last_seen)})]}),(null==g?void 0:g.distanceMeters)&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(zA,{className:"w-3 h-3 text-fg-muted shrink-0"}),e.jsx("span",{className:"font-mono font-semibold text-fg-primary",children:(C=g.distanceMeters,null===C?"—":C<1e3?`${Math.round(C)}m`:`${(C/1e3).toFixed(1)}km`)})]}),b.latitude&&b.longitude&&0!==b.latitude&&0!==b.longitude&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(GA,{className:"w-3 h-3 text-fg-muted shrink-0"}),e.jsxs("span",{className:"font-mono text-fg-muted",children:[b.latitude.toFixed(2),", ",b.longitude.toFixed(2)]})]})]}),e.jsx("div",{className:"mb-1.5",style:{width:224},children:e.jsx(or,{nodeHash:t,width:224,height:26,showArea:!0,showTooltip:!0})}),e.jsxs("div",{className:"flex gap-3 text-xs mb-1.5",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-fg-muted",children:"Packets"}),e.jsx("span",{className:"data-box data-box-compact",children:(null==g?void 0:g.frequency)||0})]}),s&&void 0!==h&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-fg-muted",children:"SNR"}),e.jsxs("span",{className:"data-box data-box-compact",children:[h.toFixed(1)," dB"]})]}),k&&v.networkRole&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-fg-muted",children:"Role"}),e.jsx(K,{color:LA[v.networkRole],compact:!0,title:{hub:"Hub: High-connectivity node that bridges many paths",backbone:"Backbone: Critical relay with high traffic",relay:"Relay: Standard forwarding node",edge:"Edge: Peripheral node"}[v.networkRole],children:v.networkRole})]})]}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-fg-muted",children:"Adverts"}),e.jsx("span",{className:"data-box data-box-compact",children:b.advert_count||0})]}),s&&void 0!==m&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-fg-muted",children:"RSSI"}),e.jsxs("span",{className:"data-box data-box-compact",children:[Math.round(m)," dBm"]})]}),k&&v.dataConfidence&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-fg-muted",children:"Data"}),e.jsx(K,{color:RA[v.dataConfidence],compact:!0,title:{high:"1000+ packets",medium:"500-999 packets",low:"100-499 packets",insufficient:"Insufficient data"}[v.dataConfidence],children:v.dataConfidence})]})]}),!k&&p&&e.jsx("button",{onClick:p,className:"p-1 self-start text-fg-secondary hover:text-sys-red hover:bg-sys-red/10 rounded transition-colors",title:"Remove from contacts",children:e.jsx(tA,{className:"w-3.5 h-3.5"})})]}),k&&e.jsx(ar,{txDelayRec:v,onRemove:p})]});var C}const lr="node-markers-native",cr="node-markers-layer",ur="node-markers-layer-local",dr="marker-standard",fr="marker-standard-neighbor",gr="marker-hub",hr="marker-hub-neighbor",mr="marker-gateway",br="marker-gateway-neighbor",pr="marker-mobile",vr="marker-mobile-neighbor",yr="marker-room-server",wr="marker-room-server-neighbor",xr="marker-local",kr="marker-stale-5day",Cr="marker-stale-10day",Br="marker-blink-black",Mr="marker-blink-black-local",Dr="marker-blink",Er="marker-blink-local",jr={tier1:m[500],tier2:m[700]};function Qr(A){if(!A)return 0;const e=(Date.now()-1e3*A)/864e5;return e>=10?2:e>=5?1:0}function Nr(A){var e;const t=null==(e=A.contact_type)?void 0:e.toLowerCase();return"room server"===t||"room_server"===t||"room"===t||"server"===t}function Sr(A){return A.startsWith("0x")?A.slice(2,4).toUpperCase():A.slice(0,2).toUpperCase()}function Fr({neighborsWithLocation:t,localNode:r,localHash:n,zeroHopNeighbors:l,lastHopNeighborMap:c,meshTopology:u,hoveredMarker:d,onMarkerHover:f,getNodeOpacity:g,shouldShowNode:h,onRequestRemove:m,openPopupId:b,onOpenPopup:v,onClosePopup:y,onNodeClick:w,blinkingNodes:x}){const{current:k}=o(),C=A.useRef(!1),[B,M]=A.useState(!1);A.useEffect(()=>{var A;const e=null==(A=null==k?void 0:k.getMap)?void 0:A.call(k);if(!e)return;const t=()=>{try{!function(A){const e=p(),t=(A,e,t=0,r=!1)=>{const n=document.createElement("canvas");n.width=32,n.height=32;const o=n.getContext("2d",r?{colorSpace:"display-p3"}:void 0),i=14-t/2;return o.beginPath(),o.arc(16,16,i,0,2*Math.PI),o.fillStyle=A,o.fill(),e&&t>0&&(o.strokeStyle=e,o.lineWidth=2*t,o.stroke()),o.shadowColor="rgba(0,0,0,0.3)",o.shadowBlur=4,o.shadowOffsetY=2,{data:o.getImageData(0,0,32,32),pixelRatio:2}},r=(A,e=!1)=>{const t=document.createElement("canvas");t.width=48,t.height=48;const r=t.getContext("2d",e?{colorSpace:"display-p3"}:void 0),n=24*.35*2;return r.strokeStyle=A,r.lineWidth=5,r.lineCap="round",r.lineJoin="round",r.beginPath(),r.moveTo(24-n,24),r.lineTo(24,24-n),r.lineTo(40.8,24),r.stroke(),r.beginPath(),r.moveTo(24-.7*n,24),r.lineTo(24-.7*n,35.76),r.lineTo(35.76,35.76),r.lineTo(35.76,24),r.stroke(),r.beginPath(),r.moveTo(20.64,35.76),r.lineTo(20.64,27.36),r.lineTo(27.36,27.36),r.lineTo(27.36,35.76),r.stroke(),{data:r.getImageData(0,0,48,48),pixelRatio:2}},n=(A,e)=>{const t=document.createElement("canvas");t.width=48,t.height=48;const r=t.getContext("2d"),n=24*.35*2;return r.strokeStyle=A,r.lineWidth=5,r.lineCap="round",r.lineJoin="round",e&&(r.fillStyle=e),r.beginPath(),r.roundRect(24-n,24-.6*n,1.6*n,1.2*n,6),e&&r.fill(),r.stroke(),r.beginPath(),r.moveTo(18.96,34.08),r.lineTo(24-.6*n,40.8),r.lineTo(24,34.08),r.stroke(),{data:r.getImageData(0,0,48,48),pixelRatio:2}},o="#00FF00",i={[dr]:t(e.nodeFill),[fr]:t(e.neighborColor),[gr]:t(e.hubColor),[hr]:t(e.neighborColor),[mr]:t(e.gatewayColor),[br]:t(e.neighborColor),[pr]:t("transparent",e.mobileColor,2.5),[vr]:t(e.neighborColor),[yr]:n(e.roomColor),[wr]:n(e.neighborColor,"#1a1a1c"),[xr]:r(e.localColor),[kr]:t(jr.tier1),[Cr]:t(jr.tier2),[Br]:t("#000000"),[Mr]:r("#000000"),[Dr]:t(o,void 0,0,!0),[Er]:r(o,!0)};for(const[a,s]of Object.entries(i))try{A.hasImage(a)&&A.removeImage(a),A.addImage(a,s.data,{pixelRatio:s.pixelRatio})}catch{}}(e),C.current=!0,B||M(!0)}catch(A){}};e.isStyleLoaded()?t():e.once("style.load",t);const r=()=>{e.hasImage(dr)||t()};e.on("styledata",r);const n=()=>{C.current=!1,t()},o=new MutationObserver(A=>{for(const e of A)if("data-theme"===e.attributeName){setTimeout(n,100);break}});o.observe(document.documentElement,{attributes:!0});const i=document.querySelector("[data-basemap]");let a=null;return i&&(a=new MutationObserver(A=>{for(const e of A)if("data-basemap"===e.attributeName){setTimeout(n,100);break}}),a.observe(i,{attributes:!0})),()=>{e.off("styledata",r),o.disconnect(),null==a||a.disconnect()}},[k,B]);const D=A.useMemo(()=>{var A;const e=[],r=[...t].sort(([A,e],[t,r])=>{const n=(A,e)=>{var t;return Nr(e)?5e3:l.has(A)?3e3:u.hubNodes.includes(A)?2e3:(null==(t=u.gatewayNodes)?void 0:t.includes(A))?1e3:0};return n(A,e)-n(t,r)});for(const[t,o]of r){if(!o.latitude||!o.longitude)continue;if(n&&((n.startsWith("0x")?n.slice(2,4).toLowerCase():n.slice(0,2).toLowerCase())===(t.startsWith("0x")?t.slice(2,4).toLowerCase():t.slice(0,2).toLowerCase())||t===n))continue;const r=h(t),i=g(t,r);if(i<=.01)continue;const a=l.has(t),s=u.hubNodes.includes(t),d=(null==(A=u.gatewayNodes)?void 0:A.includes(t))??!1,f=u.mobileNodes.includes(t),m=Nr(o),b=u.centrality.get(t)||0,p=c.get(t),v=o.last_seen||(null==p?void 0:p.lastSeen),y=Qr(v),w=y>0;let x=i;2===y?x=Math.min(i,.25):1===y&&(x=Math.min(i,.5));let k="standard";m?k="roomServer":s?k="hub":d?k="gateway":f&&(k="mobile");const C=u.fullAffinity.get(t),B=u.txDelayRecommendations.get(t);e.push({type:"Feature",geometry:{type:"Point",coordinates:[o.longitude,o.latitude]},properties:{hash:t,name:o.node_name||o.name||"Unknown",hashPrefix:Sr(t),iconType:k,isNeighbor:a,isHub:s,isGateway:d,isMobile:f,isRoomServer:m,isStale:w,staleTier:y,isZeroHop:a,opacity:x,blinkIntensity:0,lastSeenTimestamp:v,centrality:b,neighborJson:JSON.stringify(o),affinityJson:C?JSON.stringify(C):void 0,txDelayRecJson:B?JSON.stringify(B):void 0,meanSnr:(null==p?void 0:p.avgSnr)??void 0,meanRssi:(null==p?void 0:p.avgRssi)??void 0}})}return{type:"FeatureCollection",features:e}},[t,n,l,c,u,g,h]),E=A.useMemo(()=>(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)?{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:[r.longitude,r.latitude]},properties:{hash:"local",name:r.name,hashPrefix:n?Sr(n):"",iconType:"local",isNeighbor:!1,isHub:!1,isGateway:!1,isMobile:!1,isRoomServer:!1,isStale:!1,staleTier:0,isZeroHop:!1,opacity:1,blinkIntensity:0,centrality:0}}]}:{type:"FeatureCollection",features:[]},[r,n]),j=A.useCallback(A=>{var e;if(!A.features||0===A.features.length)return;const t=null==(e=A.features[0].properties)?void 0:e.hash;t&&(v&&v(t),w&&"local"!==t&&w(t))},[v,w]),Q=A.useCallback(A=>{var e,t;if(!A.features||0===A.features.length)return;const r=null==(e=null==k?void 0:k.getMap)?void 0:e.call(k);r&&(r.getCanvas().style.cursor="pointer");const n=null==(t=A.features[0].properties)?void 0:t.hash;n&&f(n)},[k,f]),N=A.useCallback(()=>{var A;const e=null==(A=null==k?void 0:k.getMap)?void 0:A.call(k);e&&(e.getCanvas().style.cursor=""),f(null)},[k,f]);A.useEffect(()=>{var A;const e=null==(A=null==k?void 0:k.getMap)?void 0:A.call(k);if(!e||!B)return;const t=[cr,ur];for(const r of t)e.on("click",r,j),e.on("mouseenter",r,Q),e.on("mouseleave",r,N);return()=>{for(const A of t)e.off("click",A,j),e.off("mouseenter",A,Q),e.off("mouseleave",A,N)}},[k,B,j,Q,N]);const S=A.useRef(D),F=A.useRef(E);A.useEffect(()=>{S.current=D,F.current=E},[D,E]),A.useEffect(()=>{var A;const e=null==(A=null==k?void 0:k.getMap)?void 0:A.call(k);if(!e||!B||!x||0===x.size)return;const t=e.getSource(lr),r=e.getSource(`${lr}-local`);if(t||r){if(t){const A=S.current;let e=!1;const r=A.features.map(A=>{const t=x.get(A.properties.hash)??0;return t!==A.properties.blinkIntensity?(e=!0,{...A,properties:{...A.properties,blinkIntensity:t}}):A});e&&t.setData({type:"FeatureCollection",features:r})}if(r&&n){const A=x.get(n)??0,e=F.current;e.features.length>0&&e.features[0].properties.blinkIntensity!==A&&r.setData({type:"FeatureCollection",features:[{...e.features[0],properties:{...e.features[0].properties,blinkIntensity:A}}]})}}},[k,B,x,n]);const P=A.useMemo(()=>{if(!b)return null;if("local"===b&&r)return{longitude:r.longitude,latitude:r.latitude,isLocal:!0,name:r.name,hash:n};const A=D.features.find(A=>A.properties.hash===b);if(!A)return null;const e=A.properties,t=e.txDelayRecJson?JSON.parse(e.txDelayRecJson):void 0;return{longitude:A.geometry.coordinates[0],latitude:A.geometry.coordinates[1],isLocal:!1,hash:e.hash,hashPrefix:e.hashPrefix,name:e.name,isHub:e.isHub,isGateway:e.isGateway,isBackbone:"backbone"===(null==t?void 0:t.networkRole),isZeroHop:e.isZeroHop,isMobile:e.isMobile,isRoomServer:e.isRoomServer,isStale:e.isStale,lastSeenTimestamp:e.lastSeenTimestamp,centrality:e.centrality,neighbor:e.neighborJson?JSON.parse(e.neighborJson):void 0,affinity:e.affinityJson?JSON.parse(e.affinityJson):void 0,txDelayRec:t,meanSnr:e.meanSnr,meanRssi:e.meanRssi}},[b,r,n,D]);if(!B)return null;const T=p(),L=["case",[">",["get","blinkIntensity"],.66],Dr,[">",["get","blinkIntensity"],.33],Br,["==",["get","staleTier"],2],Cr,["==",["get","staleTier"],1],kr,["==",["get","iconType"],"roomServer"],["case",["get","isNeighbor"],wr,yr],["==",["get","iconType"],"hub"],["case",["get","isNeighbor"],hr,gr],["==",["get","iconType"],"gateway"],["case",["get","isNeighbor"],br,mr],["==",["get","iconType"],"mobile"],["case",["get","isNeighbor"],vr,pr],["case",["get","isNeighbor"],fr,dr]],R=["interpolate",["linear"],["zoom"],6,.25,10,1];return e.jsxs(e.Fragment,{children:[e.jsx(i,{id:lr,type:"geojson",data:D,children:e.jsx(a,{id:cr,type:"symbol",layout:{"icon-image":L,"icon-size":R,"icon-allow-overlap":!0,"icon-ignore-placement":!0,"symbol-sort-key":["get","opacity"]},paint:{"icon-opacity":["get","opacity"]}})}),e.jsx(i,{id:`${lr}-local`,type:"geojson",data:E,children:e.jsx(a,{id:ur,type:"symbol",layout:{"icon-image":["case",[">",["get","blinkIntensity"],.66],Er,[">",["get","blinkIntensity"],.33],Mr,xr],"icon-size":R,"icon-allow-overlap":!0,"icon-ignore-placement":!0},paint:{"icon-opacity":1}})}),P&&y&&e.jsx(s,{longitude:P.longitude,latitude:P.latitude,offset:{center:[0,0],top:[0,12],"top-left":[6,12],"top-right":[-6,12],bottom:[0,-12],"bottom-left":[6,-12],"bottom-right":[-6,-12],left:[12,0],right:[-12,0]},maxWidth:"280px",closeOnClick:!0,onClose:y,className:"maplibre-popup",children:P.isLocal?e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{className:"text-base",children:P.name}),P.hash&&e.jsx("span",{className:"ml-2 font-mono text-xs text-fg-muted surface-badge px-1.5 py-0.5 rounded",children:Sr(P.hash)}),e.jsx("br",{}),e.jsx("span",{style:{color:T.localColor},className:"font-medium",children:"This Node (Local)"}),e.jsx("br",{}),r&&e.jsxs("span",{className:"text-xs text-fg-muted",children:[r.latitude.toFixed(5),", ",r.longitude.toFixed(5)]})]}):P.neighbor&&P.hash?e.jsx(sr,{hash:P.hash,hashPrefix:P.hashPrefix,name:P.name,isHub:P.isHub,isGateway:P.isGateway,isBackbone:P.isBackbone,isZeroHop:P.isZeroHop,isMobile:P.isMobile,isRoomServer:P.isRoomServer,isStale:P.isStale,lastSeenTimestamp:P.lastSeenTimestamp,centrality:P.centrality,affinity:P.affinity,meanSnr:P.meanSnr,meanRssi:P.meanRssi,neighbor:P.neighbor,txDelayRec:P.txDelayRec,onRemove:m?()=>m(P.hash,P.name):void 0}):null})]})}const Pr=[cr,ur],Tr="topology-validated-edges-native",Lr="topology-weak-edges-native",Rr="neighbor-edges-native",Ir="topology-weak-edges-native",_r="topology-validated-edges-native",zr="neighbor-edges-native",Hr={type:"FeatureCollection",features:[]},Gr={"line-cap":"round","line-join":"round"},Or={"line-color":"transparent","line-width":16,"line-opacity":0};function Ur({showTopology:t,isExiting:r,hoveredEdgeKey:n,highlightedLoopEdges:s,highlightedFocusEdges:l,onEdgeHover:c,onLoopHover:u,loops:d=[],neighborNames:g={},opacityBias:h=.5,widthMultiplier:m=1,trafficFilter:b=0,showNeighborLines:p=!0,disableHover:v=!1}){const{current:y}=o(),w=t||r,x=!0,k=p?"visible":"none",C=v||r,B=A.useRef(null),M=A.useRef(C),D=A.useRef(new Map),E=A.useRef(g),j=A.useRef(u);A.useLayoutEffect(()=>{M.current=C,E.current=g,j.current=u});const Q=A.useMemo(()=>function(A){const e=new Map;for(const t of A)for(const A of t.edgeKeys){const r=e.get(A)??[];r.push(t),e.set(A,r)}return e}(d),[d]);A.useLayoutEffect(()=>{D.current=Q},[Q]);const N=A.useCallback(A=>{var e,t;if(M.current)return;if(!A.features||0===A.features.length)return;const r=A.features[0].properties;if(!(null==r?void 0:r.key))return;const n=r.key;if(n!==B.current){B.current=n;const o=!0===r.isNeighborEdge||"true"===r.isNeighborEdge,i=!0===r.isLoopEdge||"true"===r.isLoopEdge;if(o){const t={key:n,fromName:"Local",toName:r.name,certainCount:Number(r.packetCount)||0,confidence:1,isBackbone:!1,isLoopEdge:!1,isDirectPath:!0,isZeroHop:!0,symmetryRatio:1,dominantDirection:"balanced",isHubConnection:!1};c(n,[A.lngLat.lng,A.lngLat.lat],t),null==(e=j.current)||e.call(j,null)}else if(i&&j.current){const e=D.current.get(n)??[];if(e.length>0){const t=new Set;for(const A of e)for(const e of A.edgeKeys)t.add(e);const r={loops:e,highlightedEdgeKeys:t,hoveredEdgeKey:n,nodeNames:e[0].nodes.map(A=>E.current[A]||A.substring(0,4))};j.current(r,[A.lngLat.lng,A.lngLat.lat]),c(n)}else{const e={key:n,fromName:r.fromName,toName:r.toName,certainCount:Number(r.certainCount),confidence:Number(r.confidence),isBackbone:!0===r.isBackbone||"true"===r.isBackbone,isLoopEdge:!0,isDirectPath:!0===r.isDirectPath||"true"===r.isDirectPath,isZeroHop:!0===r.isZeroHop||"true"===r.isZeroHop,symmetryRatio:Number(r.symmetryRatio),dominantDirection:r.dominantDirection,isHubConnection:!0===r.isHubConnection||"true"===r.isHubConnection};c(n,[A.lngLat.lng,A.lngLat.lat],e)}}else{const e={key:n,fromName:r.fromName,toName:r.toName,certainCount:Number(r.certainCount),confidence:Number(r.confidence),isBackbone:!0===r.isBackbone||"true"===r.isBackbone,isLoopEdge:i,isDirectPath:!0===r.isDirectPath||"true"===r.isDirectPath,isZeroHop:!0===r.isZeroHop||"true"===r.isZeroHop,symmetryRatio:Number(r.symmetryRatio),dominantDirection:r.dominantDirection,isHubConnection:!0===r.isHubConnection||"true"===r.isHubConnection};c(n,[A.lngLat.lng,A.lngLat.lat],e),null==(t=j.current)||t.call(j,null)}}},[c]),S=A.useCallback(()=>{var A;null!==B.current&&(B.current=null,c(null),null==(A=j.current)||A.call(j,null))},[c]);A.useEffect(()=>{var A;const e=null==(A=null==y?void 0:y.getMap)?void 0:A.call(y);if(!e||!w)return;const t="topology-validated-edges-hitarea-native",r=()=>{try{return e.getStyle()&&e.getLayer(t)}catch{return!1}},n=()=>!!r()&&(e.on("mousemove",t,N),e.on("mouseleave",t,S),!0);if(!n()){const A=()=>{n()&&e.off("styledata",A)};return e.on("styledata",A),()=>{try{e.off("styledata",A),r()&&(e.off("mousemove",t,N),e.off("mouseleave",t,S))}catch{}}}return()=>{try{r()&&(e.off("mousemove",t,N),e.off("mouseleave",t,S))}catch{}}},[y,w,N,S]),A.useEffect(()=>{var A;const e=null==(A=null==y?void 0:y.getMap)?void 0:A.call(y);if(!e||!p)return;const t="neighbor-edges-hitarea-native",r=()=>{try{return e.getStyle()&&e.getLayer(t)}catch{return!1}},n=()=>!!r()&&(e.on("mousemove",t,N),e.on("mouseleave",t,S),!0);if(!n()){const A=()=>{n()&&e.off("styledata",A)};return e.on("styledata",A),()=>{try{e.off("styledata",A),r()&&(e.off("mousemove",t,N),e.off("mouseleave",t,S))}catch{}}}return()=>{try{r()&&(e.off("mousemove",t,N),e.off("mouseleave",t,S))}catch{}}},[y,x,p,N,S]),A.useEffect(()=>{var A;const e=null==(A=null==y?void 0:y.getMap)?void 0:A.call(y);if(!e)return;let t=null;const r=(A,t)=>{try{if(e.getLayer(A)&&e.getLayer(t))return e.moveLayer(A,t),!0}catch{}return!1},n=()=>{try{if(!e.getLayer("node-markers-layer"))return;r(zr,"node-markers-layer"),r("neighbor-edges-hitarea-native",zr),(r(_r,"neighbor-edges-hitarea-native")||r(_r,"node-markers-layer"))&&r("topology-validated-edges-hitarea-native",_r),r(Ir,"topology-validated-edges-hitarea-native")}catch{}},o=()=>{t&&clearTimeout(t),t=setTimeout(n,50)},i=setTimeout(n,100);e.on("styledata",o);const a=A=>{(A.sourceId===Tr||A.sourceId===Lr||A.sourceId===Rr)&&o()};return e.on("sourcedata",a),()=>{clearTimeout(i),t&&clearTimeout(t);try{e.off("styledata",o),e.off("sourcedata",a)}catch{}}},[y,w,x,p]);const F=C?null:n,P=function(A,e,t,r,n,o){const i=Ae(),a=null!==A,s=n&&n.size>0,l=o&&o.size>0,c=s?Array.from(n):[],u=l?Array.from(o):[],d=e<=0?["get","baseColor"]:["case",[">=",["get","brightnessScore"],1-.5*e],"#FFFFFF",["get","baseColor"]],f=e<=0?1:["max",.1,["+",1,["*",e,3,["-",["get","brightnessScore"],.5]]]],g=s?["in",["get","key"],["literal",c]]:l?["in",["get","key"],["literal",u]]:!!a&&["==",["get","key"],A],h=a||s||l,m=i.edges.hoverLoop,b=i.edges.highlight;return{"line-color":h?["case",g,s?m:l?b:["get","hoverColor"],d]:d,"line-width":h?["case",g,["max",["*",["get","baseWidth"],t,1.3],3.5],["*",["get","baseWidth"],t]]:["*",["get","baseWidth"],t],"line-opacity":["case",["<",["get","brightnessScore"],r],0,h?["case",g,["min",["*",["get","baseOpacity"],1.25],1],["*",["get","baseOpacity"],f,.35]]:["*",["get","baseOpacity"],f]]}}(F,h,m,b,C?null:s,l??null),T=function(A){const e=null!==A,{YELLOW:t,GREEN:r,RED:n,GRAY:o}=f,i=["to-number",["get","listenerScore"],0],a=["to-number",["get","loudScore"],0],s=["/",i,["max",["+",i,a],1]],l=["*",["+",.2,["*",["to-number",["get","trafficWeight"],0],.8]],8];return{"line-color":["case",["all",["==",i,0],["==",a,0]],o,[">=",s,.97],r,["<=",s,.03],n,["interpolate",["linear"],s,.03,n,.5,t,.97,r]],"line-width":["interpolate",["linear"],["zoom"],6,e?["case",["==",["get","key"],A],["max",["*",l,.25],1.25],["*",l,.25]]:["*",l,.25],10,e?["case",["==",["get","key"],A],["max",l,5],l]:l],"line-opacity":e?["case",["==",["get","key"],A],1,.35]:.9}}(F);return e.jsxs(e.Fragment,{children:[w&&e.jsx(i,{id:Lr,type:"geojson",data:Hr,children:e.jsx(a,{id:Ir,type:"line",paint:P,layout:{...Gr,visibility:k}})}),w&&e.jsxs(i,{id:Tr,type:"geojson",data:Hr,children:[e.jsx(a,{id:"topology-validated-edges-hitarea-native",type:"line",paint:Or,layout:{...Gr,visibility:k}}),e.jsx(a,{id:_r,type:"line",paint:P,layout:{...Gr,visibility:k}})]}),e.jsxs(i,{id:Rr,type:"geojson",data:Hr,children:[e.jsx(a,{id:"neighbor-edges-hitarea-native",type:"line",paint:Or,layout:{...Gr,visibility:k}}),e.jsx(a,{id:zr,type:"line",paint:T,layout:{...Gr,visibility:k}})]})]})}const Yr=["topology-validated-edges-hitarea-native","topology-validated-edges-native","topology-weak-edges-native","neighbor-edges-hitarea-native","neighbor-edges-native"];function Wr({targetHash:e,nodeCoordinates:t,onComplete:r}){const{current:n}=o(),i=A.useRef(null);return A.useEffect(()=>{if(!n||!e||e===i.current)return;const A=t.get(e);if(!A)return;const o=n.getMap();o.isMoving()&&o.stop(),i.current=e;const[a,s]=A;n.flyTo({center:[s,a],zoom:10,duration:2500,essential:!0}),setTimeout(()=>{null==r||r()},2600)},[e,t,n,r]),null}function Vr({highlightedEdgeKey:e,validatedPolylines:t,weakPolylines:r,onEnsureTopology:n}){const{current:i}=o(),a=A.useRef(null);return A.useEffect(()=>{if(!i||!e)return;if(e===a.current)return;a.current=e,n();const A=t.find(A=>A.edge.key===e)||r.find(A=>A.edge.key===e);if(!A)return;if(i.getMap().isMoving())return;const o=(A.from[0]+A.to[0])/2,s=(A.from[1]+A.to[1])/2,l=i.getZoom(),c=Math.max(l,11);i.easeTo({center:[s,o],zoom:c,duration:500})},[e,t,r,i,n]),null}function Zr(A,e,t,r=64){const n=[],o=t/6371e3*(180/Math.PI),i=o/Math.cos(e*Math.PI/180);for(let a=0;a<=r;a++){const t=a/r*2*Math.PI,s=A+i*Math.cos(t),l=e+o*Math.sin(t);n.push([s,l])}return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[n]}}}function Kr({ghost:t,neighborCoordinates:r,onHighlightedNeighborsChange:n}){const{current:s}=o(),l=A.useRef(null),c=A.useRef(null),u=A.useMemo(()=>t?new Set(t.commonNeighbors):new Set,[t]);A.useEffect(()=>{null==n||n(u)},[u,n]);const d=A.useMemo(()=>{if(!(null==t?void 0:t.commonNeighbors)||t.commonNeighbors.length<2)return 8e3;let A=0;const e=[];for(const n of t.commonNeighbors){const A=r.get(n);A&&e.push(A)}t.estimatedLocation&&e.push([t.estimatedLocation.lat,t.estimatedLocation.lon]);for(let t=0;tA&&(A=n)}return Math.max(A,2e3)},[t,r]),f=A.useMemo(()=>{if(!(null==t?void 0:t.estimatedLocation))return{type:"FeatureCollection",features:[]};const{lat:A,lon:e,uncertaintyM:r}=t.estimatedLocation,n=.5*d,o=r>0?r:2e3;return{type:"FeatureCollection",features:[Zr(e,A,Math.max(500,Math.min(o,n)))]}},[t,d]);if(A.useEffect(()=>{if(!s)return;const A=s.getMap();if(t&&t.prefix!==c.current){if(c.current=t.prefix,!l.current&&A.getZoom()>3){const e=A.getCenter();l.current={center:[e.lng,e.lat],zoom:A.getZoom(),pitch:A.getPitch(),bearing:A.getBearing()}}const e=[];for(const A of t.commonNeighbors){const t=r.get(A);t&&e.push([t[1],t[0]])}if(t.estimatedLocation&&e.push([t.estimatedLocation.lon,t.estimatedLocation.lat]),e.length>0){const r=()=>{var n;if(A.isMoving())setTimeout(r,100);else if(1===e.length)s.flyTo({center:e[0],zoom:13,duration:1500});else{let A=1/0,r=-1/0,o=1/0,i=-1/0;for(const[t,n]of e)A=Math.min(A,t),r=Math.max(r,t),o=Math.min(o,n),i=Math.max(i,n);if(null==(n=t.estimatedLocation)?void 0:n.uncertaintyM){const e=t.estimatedLocation.uncertaintyM/111e3;A-=e,r+=e,o-=e,i+=e}s.fitBounds([[A,o],[r,i]],{padding:{top:60,bottom:60,left:60,right:60},maxZoom:14,duration:1500})}};setTimeout(r,50)}}if(!t&&null!==c.current&&(c.current=null,l.current)){const e=l.current,t=()=>{A.isMoving()?setTimeout(t,100):(s.flyTo({center:e.center,zoom:e.zoom,pitch:e.pitch,bearing:e.bearing,duration:1e3}),l.current=null)};setTimeout(t,50)}},[t,s,r]),!(null==t?void 0:t.estimatedLocation))return null;return e.jsx(i,{id:"ghost-uncertainty-circle",type:"geojson",data:f,children:e.jsx(a,{id:"ghost-uncertainty-fill",type:"fill",paint:{"fill-color":"rgba(167, 139, 250, 0.15)","fill-opacity":.8}})})}const Jr={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"},Xr={longitude:0,latitude:0,zoom:2};function qr({data:A}){const t=A.subtitle&&"loop"===A.type,r=A.subtitle&&"loop"!==A.type;return e.jsxs("div",{className:"w-[540px]",children:[e.jsxs("div",{className:"flex items-center justify-between h-5",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[A.title.icon&&e.jsx("span",{className:`${A.title.color} text-base leading-none flex-shrink-0`,children:A.title.icon}),e.jsx("span",{className:`${A.title.color} font-semibold text-[13px] truncate`,children:A.title.text}),r&&e.jsx("span",{className:`${A.subtitle.color} text-[11px] flex-shrink-0`,children:A.subtitle.text})]}),A.badges.length>0&&e.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:A.badges.map((A,t)=>e.jsx("span",{className:`${A.color} text-[11px] font-medium`,children:A.text},t))})]}),t&&e.jsx("div",{className:"h-4 mt-0.5 overflow-hidden",children:e.jsx("span",{className:"type-data-xs text-fg-muted truncate block",children:A.subtitle.text})}),e.jsx("div",{className:`flex items-center gap-4 h-4 ${t?"mt-1":"mt-1.5"} text-[11px]`,children:A.stats.map((A,t)=>e.jsxs("span",{className:"whitespace-nowrap",children:[e.jsx("span",{className:`font-mono tabular-nums font-semibold ${A.color??"text-fg-primary"}`,children:A.value}),e.jsx("span",{className:"text-fg-muted ml-1",children:A.label}),A.unit&&e.jsx("span",{className:"text-fg-muted/50 ml-0.5",children:A.unit})]},t))})]})}function $r({neighbors:t,localNode:r,localHash:o,onRemoveNode:i,selectedNodeHash:a,onNodeSelected:s,highlightedEdgeKey:f,highlightedGhost:h}){const m=A.useRef(null),b=X(),p=q(),v=Z(),y=$(),[w,x]=A.useState(!1),k=Gt(A=>A.viewState),C=Gt(A=>A.toggles),B=Gt(A=>A.hasAnalyzed),M=Gt(A=>A.setViewState),D=Gt(A=>A.setToggle),E=Gt(A=>A.setHasAnalyzed),j=AA(A=>A.preloadFromNodes),Q=AA(A=>A.isLoading),N=AA(A=>A.terrainGrid),S=o??y,F=A.useMemo(()=>{const A=[];for(const[,e]of Object.entries(t))e.latitude&&e.longitude&&A.push([e.latitude,e.longitude]);return A},[t]),P=A.useMemo(()=>function(A,e){let t=[...A];if((null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude)&&t.push([e.latitude,e.longitude]),0===t.length)return null;if(1===t.length){const[A,e]=t[0];return{longitude:e,latitude:A,zoom:14}}t=function(A,e){if(A.length<=2)return A;let t,r;if((null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude))t=e.latitude,r=e.longitude;else{let e=0,n=0;for(const[t,r]of A)e+=t,n+=r;t=e/A.length,r=n/A.length}const n=A.map(([A,e])=>{return{pos:[A,e],dist:(n=t,o=r,i=A,a=e,NA(n,o,i,a)/1e3)};var n,o,i,a});n.sort((A,e)=>A.dist-e.dist);const o=n[Math.floor(n.length/2)].dist,i=Math.max(3*o,50),a=n.filter(A=>A.dist<=i).map(A=>A.pos);return a.length<.5*A.length?A:a}(t,e);let r=1/0,n=-1/0,o=1/0,i=-1/0;for(const[f,g]of t)r=Math.min(r,g),n=Math.max(n,g),o=Math.min(o,f),i=Math.max(i,f);const a=(r+n)/2,s=(o+i)/2,l=i-o,c=n-r,u=Math.max(l,c);let d=16;return u>0&&(d=Math.floor(Math.log2(360/u*1.2)),d=Math.max(1,Math.min(14,d))),d=Math.min(d+1,12),{longitude:a,latitude:s,zoom:d}}(F,r),[F,r]),[T,L]=A.useState(()=>k??P??Xr),R=A.useCallback(A=>{L(A),queueMicrotask(()=>M(A))},[M]),I=A.useRef(!!k);A.useEffect(()=>{I.current||!P||k?k&&setTimeout(()=>x(!0),50):(L(P),queueMicrotask(()=>M(P)),I.current=!0,setTimeout(()=>x(!0),50))},[P,k,M]);const[_,z]=A.useState(!1),[W,V]=A.useState(()=>!(C.showTopology&&!v.topologyLoadComplete)&&C.showTopology),[K,J]=A.useState(C.showNeighborLines),[eA,tA]=A.useState(!1),[nA,oA]=A.useState(C.showMinCut),[iA,aA]=A.useState(Ve),[sA,lA]=A.useState(C.show3DTerrain),[cA,fA]=A.useState(C.nodeFilter),gA=A.useCallback(A=>{V(e=>{const t="function"==typeof A?A(e):A;return queueMicrotask(()=>D("showTopology",t)),t})},[D]),hA=A.useCallback(A=>{J(e=>{const t="function"==typeof A?A(e):A;return queueMicrotask(()=>D("showNeighborLines",t)),t})},[D]),mA=A.useCallback(A=>{oA(e=>{const t="function"==typeof A?A(e):A;return queueMicrotask(()=>D("showMinCut",t)),t})},[D]),bA=A.useCallback(A=>{lA(e=>{const t="function"==typeof A?A(e):A;return queueMicrotask(()=>D("show3DTerrain",t)),t})},[D]),pA=A.useCallback(A=>{fA(A),queueMicrotask(()=>D("nodeFilter",A))},[D]),[vA,yA]=A.useState(null),[CA,BA]=A.useState(null),[MA,DA]=A.useState(null),[EA]=A.useState(0),[jA]=A.useState(.5),[QA]=A.useState(0),[SA,FA]=A.useState(null),[PA,TA]=A.useState(""),[LA,RA]=A.useState(!1),[IA,_A]=A.useState(!1),[zA,HA]=A.useState(()=>!(B&&!v.topologyLoadComplete)&&B);A.useEffect(()=>{if(v.topologyLoadComplete)return;const A=B&&!zA,e=C.showTopology&&!W;(A||e)&&queueMicrotask(()=>{A&&E(!1),e&&D("showTopology",!1)})},[B,C.showTopology,v.topologyLoadComplete,zA,W,E,D]);const GA=A.useCallback(A=>{HA(A),queueMicrotask(()=>E(A))},[E]),[OA,UA]=A.useState(null),YA=A.useCallback(A=>UA(A),[]),WA=A.useCallback(()=>UA(null),[]),[,VA]=A.useState(new Set),ZA=Pe(A=>A.coveragePoints),KA=Pe(A=>A.isVisible),JA=Pe(A=>A.brightness),qA=Pe(A=>A.openModal),$A=$e(A=>A.isEnabled),Ae=$e(A=>A.toggle),te=n(),re=l(),ne=A.useRef(!1);A.useEffect(()=>{ZA.length>0&&KA&&!ne.current&&(hA(!1),ne.current=!0)},[ZA.length,KA]);const oe=A.useRef(null);A.useEffect(()=>{if(a&&a!==oe.current){oe.current=a;const A=setTimeout(()=>{UA(a)},1250);return()=>clearTimeout(A)}},[a]);const[ie,ae]=A.useState(null),[se,le]=A.useState(null),ce=A.useCallback((A,e,t)=>{BA(A),A&&e&&t?ae({longitude:e[0],latitude:e[1],type:"topology",properties:{key:t.key,fromName:t.fromName,toName:t.toName,certainCount:t.certainCount,confidence:t.confidence,isBackbone:t.isBackbone,isLoopEdge:t.isLoopEdge,isDirectPath:t.isDirectPath,isHubConnection:t.isHubConnection,symmetryRatio:t.symmetryRatio,dominantDirection:t.dominantDirection}}):A||ae(null)},[]),ue=A.useCallback((A,e)=>{le(A),A&&ae(null)},[]),fe=A.useMemo(()=>{var A;if(!W)return null;if(!vA)return null;if(CA)return null;const e=b.loops;if(0===e.length)return null;const r=function(A,e,t){const r=function(A,e){return e.filter(e=>e.nodes.includes(A)).sort((A,e)=>e.avgCertainCount-A.avgCertainCount)}(A,e),n=new Set,o=[];for(const i of r)for(const A of i.edgeKeys)if(!n.has(A)){n.add(A);const e=t.get(A);o.push({key:A,certainCount:(null==e?void 0:e.certainCount)??0})}return o.sort((A,e)=>e.certainCount-A.certainCount),{loops:r,highlightedEdgeKeys:n,sortedEdges:o}}(vA,e,b.edgeMap);if(0===r.loops.length)return null;const n=r.loops[0].nodes.map(A=>{var e,r;return A===S?"You":(null==(e=t[A])?void 0:e.node_name)||(null==(r=t[A])?void 0:r.name)||A.substring(0,4)});return{loops:r.loops,highlightedEdgeKeys:r.highlightedEdgeKeys,hoveredEdgeKey:(null==(A=r.sortedEdges[0])?void 0:A.key)||"",nodeNames:n}},[W,vA,CA,b.loops,b.edgeMap,t,S]);A.useEffect(()=>{CA||le(fe)},[fe,CA]);const he=A.useMemo(()=>{const A={};for(const[e,r]of Object.entries(t))A[e]=r.node_name||r.name||e.substring(0,4);return S&&(A[S]="You"),A},[t,S]),me=A.useMemo(()=>Object.entries(t).filter(([,A])=>A.latitude&&A.longitude),[t]),be=A.useMemo(()=>{const A=new Map;S&&(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)&&A.set(S,[r.latitude,r.longitude]);for(const[e,t]of me)t.latitude&&t.longitude&&A.set(e,[t.latitude,t.longitude]);return A},[S,r,me]),ve=A.useMemo(()=>{const A=new Map;for(const e of p)"expired"!==e.status&&A.set(e.hash,{hash:e.hash,prefix:e.prefix,count:e.count,avgRssi:e.avgRssi,avgSnr:e.avgSnr,lastSeen:e.lastSeen,confidence:1,status:e.status});return A},[p]),ye=A.useMemo(()=>{var A,e;const r=new Set;for(const n of ve.keys())(null==(A=t[n])?void 0:A.latitude)&&(null==(e=t[n])?void 0:e.longitude)&&r.add(n);return r},[ve,t]),xe=A.useMemo(()=>{if(0===ye.size||!S)return new Map;const A=G.getPackets();if(0===A.length)return new Map;const e=U(S);return g(A,ye,e).scores},[ye,S,v.packetCount]),ke=A.useCallback(A=>!!(S&&(A.fromHash===S&&ye.has(A.toHash)||A.toHash===S&&ye.has(A.fromHash))),[S,ye]),Be=A.useMemo(()=>{var A,e;if(0===p.length||!S)return[];if(v.backgroundLoadComplete)return[];const r=[];for(const n of p){if("expired"===n.status)continue;if(!(null==(A=t[n.hash])?void 0:A.latitude)||!(null==(e=t[n.hash])?void 0:e.longitude))continue;const o=[S,n.hash].sort(),i=`${o[0]}~${o[1]}`;r.push({fromHash:S,toHash:n.hash,key:i,packetCount:n.count,avgConfidence:1,strength:.8,avgRecency:1,hopDistanceFromLocal:0,isHubConnection:!1,isCertain:!0,certainCount:n.count,isLoopEdge:!1,forwardCount:n.count,reverseCount:0,symmetryRatio:0,dominantDirection:"forward",floodCount:n.count,directCount:0,isDirectPathEdge:!1,isZeroHop:!0,avgRssi:n.avgRssi,avgSnr:n.avgSnr})}return r},[p,S,v.backgroundLoadComplete,t]),Me=A.useMemo(()=>{const A=[];if(Be.length>0&&!v.backgroundLoadComplete){for(const e of Be){const t=be.get(e.fromHash),r=be.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A}for(const e of b.validatedEdges){if(ke(e))continue;const t=be.get(e.fromHash),r=be.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[b.validatedEdges,be,ke,Be,v.backgroundLoadComplete]),De=A.useMemo(()=>{const A=[];for(const e of b.weakEdges){if(ke(e))continue;const t=be.get(e.fromHash),r=be.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[b.weakEdges,be,ke]),Ee=A.useMemo(()=>{if(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude))return[];const A=[],e=[r.latitude,r.longitude],n=new Map;for(const t of b.lastHopNeighbors)n.set(t.hash,t.count);const o=new Map;for(const t of p)o.set(t.hash,t.count);for(const r of ye){const i=t[r];if(!(null==i?void 0:i.latitude)||!(null==i?void 0:i.longitude))continue;const a=o.get(r),s=n.get(r);A.push({from:e,to:[i.latitude,i.longitude],hash:r,neighbor:i,lastHopData:ve.get(r)??null,rxAdvertCount:a,txProxyCount:s})}return A},[r,ye,t,ve,b.lastHopNeighbors,p]),je=A.useMemo(()=>new Set(b.loopEdgeKeys),[b.loopEdgeKeys]),Qe=A.useMemo(()=>new Set(b.backboneEdges),[b.backboneEdges]),Ne=A.useMemo(()=>{if(!MA)return null;const A=b.validatedEdges.filter(A=>A.fromHash===MA||A.toHash===MA);if(0===A.length)return null;const e=[...A].sort((A,e)=>e.certainCount-A.certainCount),t=Math.max(1,Math.ceil(.2*e.length)),r=e.slice(0,t);return new Set(r.map(A=>A.key))},[MA,b.validatedEdges]),Se=A.useMemo(()=>{let A=0;if(Be.length>0&&!v.backgroundLoadComplete){for(const e of Be)e.certainCount>A&&(A=e.certainCount);return A||1}for(const e of b.validatedEdges)e.certainCount>A&&(A=e.certainCount);return A||1},[b.validatedEdges,Be,v.backgroundLoadComplete]),Fe=A.useMemo(()=>{if(0===b.validatedEdges.length)return null;const A=new Set;for(const r of b.validatedEdges)A.add(r.fromHash),A.add(r.toHash);const e=Array.from(A).filter(A=>be.has(A)).sort();if(e.length<3)return null;const t=new Map;for(const r of e){const A=be.get(r);A&&t.set(r,A)}return uA(b.validatedEdges,e,t,b.edgeBetweenness)},[b.validatedEdges,be,b.edgeBetweenness]),Te=A.useCallback(()=>{mA(A=>{const e=!A;if(e&&Fe&&m.current){const A=m.current.getMap();if(!A)return e;let t=1/0,r=-1/0,n=1/0,o=-1/0,i=!1;for(const[,e]of Fe.communities)for(const A of e){const e=be.get(A);if(e){const[A,a]=e;n=Math.min(n,A),o=Math.max(o,A),t=Math.min(t,a),r=Math.max(r,a),i=!0}}i&&A.fitBounds([[t,n],[r,o]],{padding:{top:60,bottom:100,left:60,right:320},duration:800,maxZoom:14})}return e})},[Fe,be]),Le=A.useRef(null);A.useLayoutEffect(()=>{var A,e;Le.current=(null==(e=null==(A=m.current)?void 0:A.getMap)?void 0:e.call(A))??null});const Re=H(),Ie=A.useMemo(()=>G.getPackets(),[Re]);!function({map:e,nodeCoordinates:t,packets:r,localHash:n,neighbors:o,meshTopology:i,enabled:a=!0}){const s=A.useRef(null),l=e&&"current"in e?e.current:e;A.useEffect(()=>{s.current=l},[l]);const c=A.useRef(!1),u=A.useRef(null),d=A.useRef([]),f=A.useRef(0),g=A.useRef(!1),[h,m]=A.useState(!1),b=A.useRef(null),p=A.useRef([]),v=A.useRef(new Map),y=A.useRef(t);A.useEffect(()=>{y.current=t},[t]),A.useEffect(()=>{v.current=function(A,e){const t=new Map;for(const r of Object.keys(A)){const A=U(r);t.has(A)||t.set(A,r)}if(e){const A=U(e);t.set(A,e)}return t}(o,n)},[o,n]),A.useEffect(()=>{if(!a){b.current&&(clearTimeout(b.current),b.current=null),p.current=[],null!==u.current&&(cancelAnimationFrame(u.current),u.current=null),d.current=[];const A=s.current;if(A&&c.current){const e=A.getSource(Jt);e&&e.setData({type:"FeatureCollection",features:[]})}g.current=!1,f.current=0}},[a]),A.useEffect(()=>{const A=l;if(!A)return;let e=null,t=!1;const r=()=>{if(!t&&!c.current)try{A.getLayer(Xt)&&A.removeLayer(Xt),A.getSource(Jt)&&A.removeSource(Jt),A.addSource(Jt,{type:"geojson",data:{type:"FeatureCollection",features:[]}});const t=A.getLayer(er)?er:void 0;A.addLayer({id:Xt,type:"line",source:Jt,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["any",["==",["get","isSpeculative"],!0],["==",["get","isSpeculative"],"true"]],"#8B7BAD",Ar],"line-width":["case",["any",["==",["get","isSpeculative"],!0],["==",["get","isSpeculative"],"true"]],1.875,2.5],"line-opacity":["*",["get","opacityMult"],["interpolate",["linear"],["get","intensity"],0,0,.1,.8,.5,1,1,1]]}},t),c.current=!0,m(!0),e&&(clearInterval(e),e=null)}catch{}};return A.isStyleLoaded()&&r(),A.once("style.load",()=>{r()}),c.current||(e=setInterval(()=>{c.current?e&&clearInterval(e):r()},100),setTimeout(()=>{e&&(clearInterval(e),e=null)},5e3)),()=>{t=!0,e&&clearInterval(e),null!==u.current&&(cancelAnimationFrame(u.current),u.current=null);const A=s.current;if(A&&c.current){try{A.getLayer(Xt)&&A.removeLayer(Xt),A.getSource(Jt)&&A.removeSource(Jt)}catch{}c.current=!1,m(!1)}}},[l]);const w=A.useRef(()=>{});A.useEffect(()=>{w.current=()=>{const A=s.current;if(!A)return;const e=A.getSource(Jt);if(!e)return;const t=performance.now(),r=d.current,n=[],o=[];for(const i of r){const A=t-i.startTime-i.delay;if(A<(i.isSpeculative?$t:qt)){o.push(i);const e=i.isSpeculative?rr(A):tr(A);e>0&&n.push({type:"Feature",properties:{intensity:e,opacityMult:i.isSpeculative?.5:1,isSpeculative:i.isSpeculative??!1},geometry:{type:"LineString",coordinates:[i.fromCoord,i.toCoord]}})}}e.setData({type:"FeatureCollection",features:n}),d.current=o,o.length>0?u.current=requestAnimationFrame(()=>w.current()):u.current=null}},[]);const x=A.useCallback(()=>{const A=s.current;A&&function(A){if(!A.getLayer(Xt))return;const e=A.getLayer(er)?er:void 0;try{A.moveLayer(Xt,e)}catch{}}(A),null===u.current&&(u.current=requestAnimationFrame(()=>w.current()))},[]),k=A.useCallback(()=>{if(!s.current||!c.current)return;const A=p.current;if(p.current=[],b.current=null,0===A.length)return;const e=v.current,t=y.current;if(0===e.size)return;const r=performance.now();let o=0,a=!1;const l=new Set;for(const s of A){const A=O(s,n);if(!A||A.original.length<2)continue;const c=A.original;let u=0,f=null;for(let n=0;n0){A.sort((A,e)=>e.confidence-A.confidence);const e=Math.max(1,Math.ceil(.25*A.length)),n=A.slice(0,e),i=o+150*u;for(const{edgeKey:A,otherHash:o}of n){const e=t.get(f),n=t.get(o);d.current.push({edgeKey:A,fromCoord:nr(e),toCoord:nr(n),startTime:r,delay:i,isSpeculative:!0}),l.add(A),a=!0}}}u>0&&(o+=150*u*.5)}a&&x()},[n,i,x]);A.useEffect(()=>{const A=s.current;if(!a)return;if(!A)return;if(!h)return;if(0===r.length)return;const e=Date.now(),t=f.current;if(!g.current){g.current=!0;const A=(e-3e4)/1e3,t=r.filter(e=>(e.timestamp??0)>=A);let n=0;for(const e of r){const A=e.timestamp??0;A>n&&(n=A)}if(f.current=n,t.length>0){t.sort((A,e)=>(A.timestamp??0)-(e.timestamp??0));const A=t.slice(-20);p.current.push(...A),k()}return}const n=r.filter(A=>(A.timestamp??0)>t);if(0===n.length)return;let o=0;for(const r of n){const A=r.timestamp??0;A>o&&(o=A)}f.current=o,p.current.push(...n),b.current&&clearTimeout(b.current),b.current=setTimeout(k,175)},[a,r,k,h]),A.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[])}({map:Le,nodeCoordinates:be,packets:Ie,localHash:S,neighbors:t,meshTopology:b,enabled:$A});const{isExiting:_e,isAnimating:ze,resetAnimationState:He}=function({map:e,showTopology:t,validatedPolylines:r,weakPolylines:n,maxCertainCount:o,loopEdgeKeys:i,backboneEdgeKeys:a,highlightedEdgeKey:s,neighbors:l,validatedSourceId:c,weakSourceId:u,neighborPolylines:d=[],showNeighborLines:f=!0,neighborSourceId:g,neighborLinkScores:h=new Map,basemapMode:m}){const b=A.useRef(null);A.useEffect(()=>{const A=e&&"current"in e?e.current:e;b.current=A});const p=A.useRef(new Map),v=A.useRef(1),y=A.useRef(new Map),w=A.useRef(new Map),x=A.useRef(!1),k=A.useRef(null),C=A.useRef(t),B=A.useRef(new Set),M=A.useRef(""),D=A.useRef(new Map),E=A.useRef(""),j=A.useRef(""),Q=A.useRef(""),N=A.useRef(r),S=A.useRef(n),F=A.useRef(o),P=A.useRef(i),T=A.useRef(a),L=A.useRef(s),R=A.useRef(l),I=A.useRef(d),_=A.useRef(f),z=A.useRef(h),H=A.useRef(m);A.useEffect(()=>{N.current=r,S.current=n,F.current=o,P.current=i,T.current=a,L.current=s,R.current=l,I.current=d,_.current=f,z.current=h,H.current=m},[r,n,o,i,a,s,l,d,f,h,m]);const G=A.useCallback((A=!1)=>{var e,t,r,n,o,i,a,s,l,d;const f=b.current;if(!f)return;const h=f.getSource(c),m=f.getSource(u),x=f.getSource(g);if(h){const o=Wt(N.current,!0,p.current,v.current,y.current,w.current,F.current,P.current,T.current,L.current,R.current,H.current),i=`${o.features.length}:${(null==(t=null==(e=o.features[0])?void 0:e.properties)?void 0:t.key)??""}:${(null==(n=null==(r=o.features[o.features.length-1])?void 0:r.properties)?void 0:n.key)??""}:${Array.from(p.current.values()).reduce((A,e)=>A+e,0).toFixed(2)}`;(A||i!==E.current)&&(h.setData(o),E.current=i)}if(m){const e=Wt(S.current,!1,p.current,v.current,y.current,w.current,F.current,P.current,T.current,L.current,R.current,H.current),t=`${e.features.length}:${(null==(i=null==(o=e.features[0])?void 0:o.properties)?void 0:i.key)??""}:${(null==(s=null==(a=e.features[e.features.length-1])?void 0:a.properties)?void 0:s.key)??""}`;(A||t!==j.current)&&(m.setData(e),j.current=t)}if(x&&I.current.length>0){const e=Vt(I.current,z.current),t=`${e.features.length}:${(null==(d=null==(l=e.features[0])?void 0:l.properties)?void 0:d.hash)??""}`;(A||t!==Q.current)&&(x.setData(e),Q.current=t)}},[c,u,g]),O=A.useCallback(()=>{k.current&&(cancelAnimationFrame(k.current),k.current=null),p.current=new Map,v.current=1,y.current=new Map,w.current=new Map,x.current=!1,B.current=new Set,M.current="",D.current=new Map},[]);A.useEffect(()=>{const A=C.current,e=t;if(C.current=t,b.current){if(k.current&&(cancelAnimationFrame(k.current),k.current=null),A&&!e&&!x.current){x.current=!0;const A=new Map(p.current);let e=null;const t=r=>{e||(e=r);const n=r-e,o=Math.min(n/500,1),i=wA(o);for(const[e,t]of A)p.current.set(e,t*(1-i));G(!0),o<1?k.current=requestAnimationFrame(t):(x.current=!1,p.current=new Map,B.current=new Set,M.current="",y.current=new Map,w.current=new Map,k.current=null,G(!0))};k.current=requestAnimationFrame(t)}!A&&e&&(p.current=new Map,B.current=new Set,M.current="")}},[t,G]),A.useEffect(()=>{const A=b.current;if(!t||x.current||!A)return;const e=[...r,...n],o=e.map(A=>`${A.edge.key}:${A.edge.certainCount}`).sort().join(","),i=0===B.current.size,a=""!==M.current&&M.current!==o;if(!i&&!a)return void G();const s=[],l=[];for(const{edge:t}of e)B.current.has(t.key)?l.push(t.key):s.push(t.key);a&&l.length>0&&(y.current=new Map(D.current),v.current=0),w.current=new Map;for(const{edge:t}of r){const A=XA(t.certainCount);w.current.set(t.key,A)}for(const t of s)p.current.set(t,0);for(const t of l)p.current.has(t)||p.current.set(t,1);if(s.length>0||a&&l.length>0){k.current&&(cancelAnimationFrame(k.current),k.current=null);let A=null;const e=Math.min(100,ee/Math.max(s.length,1)/2),t=r=>{A||(A=r);const n=r-A;for(let A=0;A0){const A=Math.min(n/ee,1);v.current=xA(A)}G(!0);const o=ee+(s.length-1)*e;k.current=n{const A=b.current;if(!A||!g)return;const e=()=>{const e=A.getSource(g);if(!e)return!1;if(d.length>0){const A=Vt(d,h);e.setData(A)}else e.setData({type:"FeatureCollection",features:[]});return!0};if(e())return;const t=r=>{r.sourceId===g&&e()&&A.off("sourcedata",t)};A.on("sourcedata",t);const r=()=>{e()&&(A.off("styledata",r),A.off("sourcedata",t))};return A.on("styledata",r),()=>{A.off("sourcedata",t),A.off("styledata",r)}},[g,d,h]);const U=A.useRef(m);return A.useEffect(()=>{m!==U.current&&(U.current=m,E.current="",j.current="",Q.current="",G(!0))},[m,G]),A.useEffect(()=>()=>{k.current&&(cancelAnimationFrame(k.current),k.current=null)},[]),{isExiting:x.current,isAnimating:null!==k.current,resetAnimationState:O,weightAnimProgress:v.current,animStartWeights:y.current,animTargetWeights:w.current}}({map:Le,showTopology:W,validatedPolylines:Me,weakPolylines:De,maxCertainCount:Se,loopEdgeKeys:je,backboneEdgeKeys:Qe,highlightedEdgeKey:f,neighbors:t,validatedSourceId:Tr,weakSourceId:Lr,neighborPolylines:Ee,showNeighborLines:K,neighborSourceId:Rr,neighborLinkScores:xe,basemapMode:te}),Ge=A.useMemo(()=>{const A=new Set;for(const e of b.hubNodes){A.add(e);for(const t of b.validatedEdges)t.fromHash===e&&A.add(t.toHash),t.toHash===e&&A.add(t.fromHash)}return A},[b.hubNodes,b.validatedEdges]),Oe=A.useMemo(()=>{const A=new Set;if(!o)return A;for(const e of b.validatedEdges)e.fromHash===o&&A.add(e.toHash),e.toHash===o&&A.add(e.fromHash);return A},[o,b.validatedEdges]),{getNodeOpacity:Ue}=function({soloDirect:e,soloHubs:t,neighborHashes:r,hubConnectedNodes:n,directNodeSet:o,localConnectedNodes:i,showTopology:a}){const[s,l]=A.useState(new Map),c=A.useRef(e),u=A.useRef(t),d=A.useRef(new Map),f=A.useRef(null),g=A.useRef(n),h=A.useRef(o),m=A.useRef(i),b=A.useRef(a);return A.useEffect(()=>{g.current=n,h.current=o,m.current=i,b.current=a},[n,o,i,a]),A.useEffect(()=>{const A=c.current,n=u.current,o=e,i=t;if(c.current=e,u.current=t,A===o&&n===i)return;f.current&&(cancelAnimationFrame(f.current),f.current=null);const a=g.current,s=h.current,p=m.current,v=b.current;for(const e of r)d.current.has(e)||d.current.set(e,Math.random());const y=(A,e,t)=>{const r=a.has(A),n=s.has(A),o=v&&p.has(A);return!e&&!t||(e&&t?r||n||o:t?r:!e||n||o)},w=[];for(const e of r){const t=y(e,A,n),r=y(e,o,i);t!==r&&w.push({hash:e,startOpacity:t?1:0,targetOpacity:r?1:0})}if(0===w.length)return;l(A=>{const e=new Map(A);for(const{hash:t,startOpacity:r}of w)e.set(t,r);return e});const x=w;let k=null;const C=A=>{k||(k=A);const e=A-k;let t=!0;l(()=>{const A=new Map;for(const{hash:r,startOpacity:n,targetOpacity:o}of x){const i=250*(d.current.get(r)??0),a=Math.max(0,e-i),s=Math.min(a/500,1),l=n+(o-n)*xA(s);A.set(r,l),s<1&&(t=!1)}return A}),e<750&&!t?f.current=requestAnimationFrame(C):(f.current=null,l(new Map))};return f.current=requestAnimationFrame(C),()=>{f.current&&(cancelAnimationFrame(f.current),f.current=null)}},[e,t,r]),{nodeOpacities:s,getNodeOpacity:(A,e)=>s.has(A)?s.get(A):e?1:0}}({soloDirect:"direct"===cA,soloHubs:"hubs"===cA,neighborHashes:me.map(([A])=>A),hubConnectedNodes:Ge,directNodeSet:ye,localConnectedNodes:Oe,showTopology:W}),{blinkingNodes:Ye,blinkColor:Ze}=function({neighbors:e,localHash:t,enabled:r=!0}){const[n,o]=A.useState(new Map),i=H(),a=A.useRef(G.getPackets());A.useEffect(()=>{a.current=G.getPackets()},[i]);const s=A.useRef(0),l=A.useRef(null),c=A.useRef(new Map),u=A.useRef(new Map);A.useEffect(()=>{u.current=function(A){const e=new Map;for(const t of Object.keys(A)){const A=U(t);e.has(A)||e.set(A,t)}return e}(e)},[e]);const d=A.useRef(null);return A.useEffect(()=>{d.current=()=>{const A=performance.now(),e=c.current;if(0===e.size)return l.current=null,void o(new Map);const t=new Map,r=[];for(const[n,{startTime:o,staggerDelay:i}]of e){const e=A-o-i;if(e<0);else if(e>=750)r.push(n);else{const A=Zt(e,750);A>0&&t.set(n,A)}}for(const n of r)e.delete(n);o(t),e.size>0&&d.current?l.current=requestAnimationFrame(d.current):l.current=null}},[]),A.useEffect(()=>{if(!r)return;const A=a.current;if(0===A.length)return;const e=s.current,n=A.filter(A=>(A.timestamp??0)>e);if(0===e){const e=A.reduce((A,e)=>Math.max(A,e.timestamp??0),0);return void(s.current=e)}if(0===n.length)return;const o=n.reduce((A,e)=>Math.max(A,e.timestamp??0),0);s.current=o;const i=performance.now();let f=0;for(const r of n){const A=O(r,t);if(!A||0===A.original.length)continue;const e=Kt(A.original,u.current,t);if(0===e.length)continue;const n=375;for(let t=0;t()=>{null!==l.current&&(cancelAnimationFrame(l.current),l.current=null)},[]),{blinkingNodes:n,blinkColor:"#00FF00"}}({neighbors:t,localHash:o,enabled:$A}),Ke=A.useCallback(A=>{if("all"===cA)return!0;if("direct"===cA)return ye.has(A);if("hubs"===cA){if(b.hubNodes.includes(A))return!0;for(const e of b.validatedEdges){if(e.fromHash===A&&b.hubNodes.includes(e.toHash))return!0;if(e.toHash===A&&b.hubNodes.includes(e.fromHash))return!0}return!1}return!0},[cA,ye,b.hubNodes,b.validatedEdges]),Je=A.useCallback(()=>{_A(!0),RA(!0)},[]),qe=A.useCallback(()=>{zA?gA(A=>!A):Je()},[zA,Je]),At=A.useCallback(A=>{R(A.viewState),(A.viewState.pitch??0)>10&&!sA&&bA(!0)},[sA]),et=A.useCallback(()=>{z(A=>{var e,t,r,n,o,i,a;const s=!A,l=null==(r=null==(t=null==(e=m.current)?void 0:e.getContainer())?void 0:t.closest(".map-container-fullscreen, .map-container-16-9"))?void 0:r.parentElement;return s?l&&document.fullscreenEnabled?null==(n=l.requestFullscreen)||n.call(l).catch(()=>{}):l&&document.webkitFullscreenEnabled&&(null==(o=l.webkitRequestFullscreen)||o.call(l)):document.fullscreenElement?null==(i=document.exitFullscreen)||i.call(document).catch(()=>{}):document.webkitFullscreenElement&&(null==(a=document.webkitExitFullscreen)||a.call(document)),s})},[]),tt=A.useCallback(A=>{pA(A)},[]),rt=A.useCallback(()=>{hA(A=>!A)},[]),nt=A.useCallback(()=>{tA(A=>!A)},[]),ot=A.useCallback(()=>{bA(A=>{const e=!A;if(m.current){const A=m.current.getMap();A&&A.stop()}if(e&&m.current){const A=m.current.getMap();A&&A.easeTo({pitch:45,duration:1500,easing:wA})}if(!e&&m.current){const A=m.current.getMap();A&&A.easeTo({pitch:0,bearing:0,duration:800,easing:kA})}return e})},[]),it=A.useCallback(()=>{W||gA(!0)},[W]),at=A.useCallback((A,e)=>{FA(A),TA(e)},[]),st=A.useCallback(()=>{SA&&i&&i(SA),FA(null),TA("")},[SA,i]),lt=A.useMemo(()=>[...Yr,...Pr],[]),ct=A.useRef(!1);A.useEffect(()=>{ct.current="ontouchstart"in window||navigator.maxTouchPoints>0},[]);const ut=A.useCallback(A=>{A.features&&0!==A.features.length||(ct.current&&ie&&(ae(null),BA(null)),MA&&DA(null))},[ie,MA]),dt=A.useCallback(A=>{DA(e=>e===A?null:A)},[]),ft=A.useCallback(A=>{var e,t;if(!A.features||0===A.features.length)return;if(A.features.some(A=>{var e,t;return null==(t=null==(e=A.layer)?void 0:e.id)?void 0:t.startsWith("node-markers-")}))return void(CA&&(BA(null),ae(null)));const r=A.features.find(A=>{var e;const t=null==(e=A.layer)?void 0:e.id;return(null==t?void 0:t.startsWith("topology-"))||(null==t?void 0:t.startsWith("neighbor-"))});if(!r)return;const n=null==(e=r.layer)?void 0:e.id,o=r.properties;if(!(null==o?void 0:o.key))return;const i=null==n?void 0:n.startsWith("topology-"),a=null==n?void 0:n.startsWith("neighbor-");if(i||a){const e=o.key.replace(/-loop[12]$/,"");BA(e),A.lngLat&&ae({longitude:A.lngLat.lng,latitude:A.lngLat.lat,type:i?"topology":"neighbor",properties:o})}try{(null==(t=m.current)?void 0:t.getCanvas())&&(m.current.getCanvas().style.cursor="pointer")}catch{}},[CA]),gt=A.useCallback(()=>{var A;BA(null),ae(null);try{(null==(A=m.current)?void 0:A.getCanvas())&&(m.current.getCanvas().style.cursor="")}catch{}},[]),ht=_?"map-container-fullscreen":"map-container-16-9",mt=F.length>0||(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude),bt=!w||!mt,pt=mt;return e.jsxs("div",{className:`relative ${ht}`,role:"application","aria-label":"Mesh network contacts map","aria-describedby":"map-instructions","data-basemap":te,children:[e.jsx("span",{id:"map-instructions",className:"sr-only",children:"Interactive map showing mesh network contacts. Use mouse or touch to pan and zoom. Press Tab to navigate map controls. Press Escape to exit fullscreen mode."}),bt&&e.jsx("div",{className:"absolute inset-0 z-50 surface-base rounded-2xl flex items-center justify-center","aria-hidden":"true",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-6 h-6 border-2 border-sys-blue border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-fg-muted",children:"Loading map..."})]})}),pt&&e.jsx("div",{className:`relative w-full h-full ${_?"":"rounded-[1.125rem] overflow-hidden"} ${bt?"opacity-0":"opacity-100 transition-opacity duration-300"}`,children:e.jsxs(c,{ref:m,...T,onMove:At,mapStyle:Jr,style:{width:"100%",height:"100%"},attributionControl:!1,interactiveLayerIds:lt,onMouseMove:ft,onMouseLeave:gt,onClick:ut,onError:A=>{},onIdle:()=>{if(!N&&!Q&&m.current){const A=m.current.getMap();if(A){const e=Object.values(t).filter(A=>A.latitude&&A.longitude).map(A=>({latitude:A.latitude,longitude:A.longitude}));(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)&&e.push({latitude:r.latitude,longitude:r.longitude}),e.length>0&&j(e,A)}}},children:[e.jsx(u,{position:"bottom-right"}),e.jsx(d,{mode:te}),e.jsx(Nt,{enabled:sA,exaggeration:4}),e.jsx(Bt,{coveragePoints:ZA,visible:ZA.length>0&&KA,terrainEnabled:sA,brightness:JA,basemapMode:te}),e.jsx(zt,{partition:Fe,nodeCoordinates:be,visible:nA&&zA,opacity:iA.opacity,bandwidth:iA.bandwidth,threshold:iA.threshold,strokeWidth:iA.strokeWidth}),e.jsx(Ur,{showTopology:W,isExiting:_e,hoveredEdgeKey:CA,highlightedLoopEdges:null==se?void 0:se.highlightedEdgeKeys,highlightedFocusEdges:Ne,onEdgeHover:ce,onLoopHover:ue,loops:b.loops,neighborNames:he,opacityBias:EA,widthMultiplier:jA,trafficFilter:QA,showNeighborLines:K,disableHover:ze||IA}),a&&e.jsx(Wr,{targetHash:a,nodeCoordinates:be,onComplete:s}),f&&e.jsx(Vr,{highlightedEdgeKey:f,validatedPolylines:Me,weakPolylines:De,onEnsureTopology:it}),e.jsx(Kr,{ghost:h??null,neighborCoordinates:be,onHighlightedNeighborsChange:VA}),e.jsx(Fr,{neighborsWithLocation:me,localNode:r,localHash:o,zeroHopNeighbors:ye,lastHopNeighborMap:ve,meshTopology:b,hoveredMarker:vA,onMarkerHover:yA,getNodeOpacity:Ue,shouldShowNode:Ke,onRequestRemove:i?at:void 0,openPopupId:OA,onOpenPopup:YA,onClosePopup:WA,onNodeClick:dt,blinkingNodes:Ye,blinkColor:Ze})]})}),(()=>{const A=function(A,e,t){if(e){const A=e.loops[0],t=e.loops.length,r=[{label:"hops",value:A.size},{label:"seen",value:A.minCertainCount}],n=[];return A.includesLocal&&n.push({text:"★ Includes your node",color:"text-sys-amber"}),t>1&&n.push({text:`+${t-1} overlapping`,color:"text-sys-indigo/70"}),{type:"loop",title:{icon:"⟳",text:"Redundant Path"+(t>1?"s":""),color:"text-sys-indigo"},subtitle:{text:`${e.nodeNames.join(" → ")} → ${e.nodeNames[0]}`,color:"text-fg-secondary",mono:!0},stats:r,badges:n}}if("neighbor"===(null==A?void 0:A.type)){const e=A.properties,t=[];void 0!==e.rssi&&null!==e.rssi&&t.push({label:"RSSI",value:`${Math.round(e.rssi)} dBm`,unit:e.hasAvgRssi?"avg":void 0}),void 0!==e.snr&&null!==e.snr&&t.push({label:"SNR",value:`${Number(e.snr).toFixed(1)} dB`,unit:e.hasAvgSnr?"avg":void 0});const r=e.listenerScore??0,n=e.loudScore??0,o=r>0||n>0;return o&&(t.push({label:"listener",value:r,color:"text-sys-green"}),t.push({label:"loud",value:n,color:"text-sys-red"})),void 0===e.packetCount||o||t.push({label:"packets",value:Number(e.packetCount).toLocaleString()}),{type:"neighbor",title:{icon:"●",text:e.prefix?`${e.name} (${e.prefix})`:e.name,color:"text-sys-amber"},subtitle:{text:"Direct RF Neighbor",color:"text-sys-amber/70"},stats:t,badges:[]}}if("topology"===(null==A?void 0:A.type)){const e=A.properties,r=t>0?Number(e.certainCount)/t:0,n=[{label:"validations",value:e.certainCount},{label:"of max traffic",value:`${Math.round(100*r)}%`},{label:"confidence",value:`${Math.round(100*Number(e.confidence))}%`}];if(void 0!==e.symmetryRatio&&e.symmetryRatio<1){const A="forward"===e.dominantDirection?"→":"reverse"===e.dominantDirection?"←":"↔";n.push({label:"symmetric",value:`${A} ${Math.round(100*e.symmetryRatio)}%`,color:"text-fg-muted"})}const o=[];return e.isBackbone&&o.push({text:"Backbone",color:"text-zinc-300"}),e.isLoopEdge&&o.push({text:"Redundant",color:"text-sys-indigo"}),e.isDirectPath&&o.push({text:"Direct Path",color:"text-sys-teal"}),{type:"topology",title:{icon:"",text:`${e.fromName} ↔ ${e.toName}`,color:"text-fg-primary"},stats:n,badges:o}}return null}(ie?{type:ie.type,properties:ie.properties}:null,se,Se);return A&&e.jsx("div",{className:"map-edge-tooltip",children:e.jsx("div",{className:"map-control-surface map-edge-tooltip-inner",children:e.jsx(qr,{data:A})})})})(),e.jsx(ge,{mapRef:m,showNeighborLines:K,onToggleNeighborLines:rt,hasNeighborPolylines:Ee.length>0,nodeFilter:cA,onNodeFilterChange:tt,hasHubNodes:b.hubNodes.length>0,hasZeroHopNeighbors:ye.size>0,showCoverage:eA,onToggleCoverage:nt,showMinCut:nA,onToggleMinCut:Te,hasMinCutData:zA&&null!==Fe&&Fe.numCommunities>1,show3DTerrain:sA,onToggle3DTerrain:ot,basemapMode:te,onToggleBasemap:re,isFullscreen:_,onToggleFullscreen:et}),e.jsxs("div",{className:"map-legend-stack",children:[e.jsx(pe,{isActive:W,hasAnalyzed:zA,isLoading:IA,onClick:qe,basemapMode:te}),e.jsx(we,{isActive:$A,onClick:Ae,basemapMode:te}),e.jsx(Ce,{isActive:ZA.length>0&&KA,onClick:qA,basemapMode:te}),e.jsx(de,{showTopology:W,validatedPolylineCount:Me.length,filteredNeighborCount:me.length,hasLocalNode:!(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude)),meshTopology:b,zeroHopNeighbors:ye,neighborsWithLocation:me,basemapMode:te})]}),!_&&e.jsx("div",{className:"surface-card-frame absolute inset-0 pointer-events-none rounded-[1.125rem]",style:{zIndex:9999},"aria-hidden":"true"}),e.jsx(rA,{isOpen:null!==SA,onCancel:()=>FA(null),onConfirm:st,title:"Remove Node?",message:`Remove "${PA}" from the contacts list? This will hide the node until it sends a new packet.`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger"}),e.jsx(dA,{isOpen:LA,onClose:()=>{RA(!1),_A(!1),He(),GA(!0),setTimeout(()=>gA(!0),150)}}),e.jsx(We,{}),e.jsx(Xe,{visible:nA&&zA,onClose:()=>mA(!1),settings:iA,onSettingsChange:aA,partition:Fe,totalNodes:Object.keys(t).length,basemapMode:te})]})}export{$r as default}; +import{r as A,j as e,c as t,q as r}from"./vendor-react-j_fHog8x.js";import{u as n,b as o,S as i,L as a,P as s,c as l,M as c,d as u,B as d}from"./BasemapLayer-BT1oL_wV.js";import"./maplibre-gl-b91ci4Kr.js";import{L as f,c as g}from"./link-scoring-BHmEi4Ug.js";import{c as h,Z as m,bk as b,d0 as p,d1 as v,d2 as y,au as w,aC as x,aD as k,H as C,m as B,Y as M,A as D,b as E,B as j,b4 as Q,aw as N,aE as S,L as F,W as P,R as T,a5 as L,X as R,o as I,an as _,d3 as z,F as H,d4 as G,d5 as O,G as U,be as Y,d6 as W,d7 as V,a0 as Z,j as K,O as J,bf as X,x as q,d8 as $,d9 as AA}from"./index-BBcIGlRT.js";import{P as eA,T as tA,C as rA}from"./ConfirmModal-CX0HrTOx.js";import{a as nA,M as oA,E as iA,u as aA,G as sA,g as lA,b as cA,d as uA,D as dA}from"./DeepAnalysisModal--yROqPOt.js";import{M as fA}from"./message-square-Dq5-N0aR.js";import{H as gA,D as hA}from"./DelayedAnimateNumber-CRcNKpk-.js";import{R as mA}from"./refresh-cw-BJopKEHj.js";import{E as bA}from"./target-MKB3Qhi3.js";import{S as pA,M as vA}from"./sun-GNUT-ucn.js";import{C as yA,a as wA,b as xA,c as kA}from"./easing-DWvlCTyt.js";import{G as CA}from"./git-branch-CaPGs8Pg.js";import{Z as BA}from"./SignalIndicator-BnBRvoqf.js";import{l as MA}from"./font-loader-BQzEmDrZ.js";import{c as DA,p as EA,d as jA}from"./vendor-core-CmkNwW1A.js";import{D as QA,c as NA}from"./geo-utils-BJfOkt8p.js";import{W as SA}from"./wifi-BGoUD8Dj.js";import{U as FA}from"./users-DuzW_tmB.js";import{H as PA,C as TA,N as LA,a as RA}from"./badge-colors-YAE4qQ7m.js";import{L as IA}from"./LightSparkline-BCL2qx0n.js";import{P as _A,R as zA}from"./Contacts-DbMN-LnJ.js";import{C as HA}from"./copy-C_IB0gEd.js";import{M as GA}from"./map-pin-FZNiPp_L.js";import"./triangle-alert-DH80WgOo.js";import"./database-CO202xKy.js";import"./index-CCvUM2Hn.js";import"./signal-scoring-CcBiRcks.js";import"./ping-CZgZ44Jt.js";import"./node-types-CuQMppbD.js";import"./PageLayout-CYYy29Pg.js";import"./listbox-BsuBKhOY.js";import"./Card-QO4sXDu0.js";import"./activity-_XXDiQ1M.js";import"./DataBox-B8dpvpbW.js";import"./funnel-Bb7d8E3s.js";import"./circle-check-DI0_62yI.js";import"./chat-utils-I8bC4Iy5.js";import"./CollisionExplorerModal-CbOUGWmc.js";import"./network-C6ho6RSo.js";import"./search-Cs3jReDi.js";const OA=h("boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]),UA=h("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),YA=h("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]),WA=h("mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]),VA=h("sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]),ZA=h("swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]),KA=h("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),JA=h("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);function XA(A,e){const t=Math.max(5,Math.min(A,300)),r=Math.log(5),n=Math.log(300);return 1+(Math.log(t)-r)/(n-r)*5}const qA={textPrimary:m[900],textSecondary:"#4A4A4A",textMuted:m[500],border:"rgba(0, 0, 0, 0.12)",hoverBg:"rgba(0, 0, 0, 0.06)",disabledText:"rgba(0, 0, 0, 0.25)"},$A={nodeFill:b.blue,nodeStroke:"rgba(255,255,255,0.9)",nodeColor:b.indigo,localColor:b.amber,hubColor:b.purple,gatewayColor:b.indigo,mobileColor:b.orange,roomServerColor:b.pink,neighborColor:b.amber,edges:{rest:m[700],restBright:m[600],restDim:m[800],hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:m[400],hoverNeighbor:b.amber,neighborRest:m[500],neighborHover:b.amber,highlight:"#FFD700"},edgeOpacity:.82};function Ae(){if("undefined"==typeof window)return $A;const A=p(),e=v();return{nodeFill:A.nodeFill,nodeStroke:A.nodeStroke,nodeColor:$A.nodeColor,localColor:A.localColor,hubColor:A.hubColor,gatewayColor:A.gatewayColor,mobileColor:A.mobileColor,roomServerColor:A.roomColor,neighborColor:A.neighborColor,edges:{rest:e.rest,restBright:e.restBright,restDim:e.restDim,hoverDirect:e.hoverDirect,hoverLoop:e.hoverLoop,hoverStandard:e.hoverStandard,hoverNeighbor:e.hoverNeighbor,neighborRest:$A.edges.neighborRest,neighborHover:$A.edges.neighborHover,highlight:e.highlight},edgeOpacity:$A.edgeOpacity}}const ee=2e3,te=E.snappy,re=qA,ne=A.createContext("dark"),oe=()=>A.useContext(ne);function ie({color:A,ring:t}){return e.jsx("span",{className:"shrink-0 rounded-full",style:{width:14,height:14,backgroundColor:t?"transparent":A,border:t?`4px solid ${A}`:void 0,boxSizing:"border-box"}})}function ae({color:A}){return e.jsx("span",{className:"shrink-0 rounded-sm",style:{width:16,height:3,backgroundColor:A}})}function se({indicator:A,label:r,tooltip:n}){const o="light"===oe();return e.jsxs("div",{className:"flex items-center gap-1.5",children:[A,e.jsx("span",{className:t(!o&&"text-fg-secondary"),style:o?{color:re.textSecondary}:void 0,children:r}),n&&e.jsx(C,{content:n,delay:200,children:e.jsx("span",{className:t("cursor-help text-[10px] opacity-60 hover:opacity-100 transition-opacity",!o&&"text-fg-muted"),style:o?{color:re.textMuted}:void 0,children:"ⓘ"})})]})}function le({title:A,tooltip:r,isOpen:n,onToggle:o,showDivider:i,children:a}){const s="light"===oe();return e.jsxs("div",{className:i?"mt-2 pt-2 border-t":"",style:i?{borderColor:s?re.border:"var(--map-ui-border)"}:void 0,children:[e.jsxs("button",{type:"button",onClick:o,className:t("group w-full flex items-center justify-between py-1 font-medium transition-colors",!s&&"text-fg-secondary hover:text-fg-primary"),style:s?{color:re.textSecondary}:void 0,children:[e.jsxs("span",{className:"flex items-center gap-1",children:[A,e.jsx(C,{content:r,delay:200,children:e.jsx("span",{className:t("cursor-help text-[10px] opacity-60 group-hover:opacity-100 transition-opacity",!s&&"text-fg-muted"),style:s?{color:re.textMuted}:void 0,children:"ⓘ"})})]}),e.jsx(B.span,{animate:{rotate:n?0:-90},transition:{duration:.15},children:e.jsx(M,{className:"w-3 h-3",style:s?{color:re.textMuted}:{color:"var(--fg-muted)"}})})]}),e.jsx(D,{initial:!1,children:n&&e.jsx(B.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:te,className:"overflow-hidden",children:e.jsx("div",{className:"flex flex-col gap-1 pt-1.5",children:a})})})]})}function ce({label:A,value:r,color:n}){const o="light"===oe();return e.jsxs("div",{className:t("flex justify-between tabular-nums",!o&&"text-fg-muted"),style:o?{color:re.textMuted}:void 0,children:[e.jsx("span",{children:A}),e.jsx("span",{style:n?{color:n}:o?{color:re.textSecondary}:{color:"var(--fg-secondary)"},children:r})]})}function ue({icon:A,color:r,title:n,subtitle:o}){const i="light"===oe();return e.jsx("div",{className:"mt-1.5 pt-1.5 border-t",style:{borderColor:i?re.border:"var(--map-ui-border)"},children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"shrink-0",style:{color:r},children:A}),e.jsxs("div",{className:"flex flex-col min-w-0",children:[e.jsx("span",{className:"font-medium truncate",style:{color:r},children:n}),e.jsx("span",{className:t("text-[10px] leading-tight",!i&&"text-fg-muted"),style:i?{color:re.textMuted}:void 0,children:o})]})]})})}function de({showTopology:t,validatedPolylineCount:r,filteredNeighborCount:n,hasLocalNode:o,meshTopology:i,zeroHopNeighbors:a,neighborsWithLocation:s,basemapMode:l="dark"}){const c=y(),u=w(),d=x(),g=u.filter(A=>A.isLikelyReal).length,h=function(A){let e=0;for(const t of A.txDelayRecommendations.values())"backbone"===t.networkRole&&e++;return e}(i),m=a.size>0,[b,p]=A.useState(!0),[v,C]=A.useState(!0),[B,M]=A.useState(!0);return e.jsx(ne.Provider,{value:l,children:e.jsxs("div",{className:"map-control-surface p-2.5 text-xs",children:[e.jsxs(le,{title:"Nodes",tooltip:"Node type shown by shape + color. Yellow = direct RF neighbor.",isOpen:b,onToggle:()=>p(A=>!A),children:[e.jsx(se,{indicator:e.jsx(ie,{color:c.nodeFill}),label:"Node",tooltip:"Standard mesh node. Repeater, client, or companion device."}),e.jsx(se,{indicator:e.jsx(ie,{color:c.hubColor}),label:"Hub",tooltip:"Network hub (≥10% of last-hop traffic)."}),(D=s,D.some(([,A])=>{var e;const t=null==(e=A.contact_type)?void 0:e.toLowerCase();return"room server"===t||"room_server"===t||"room"===t||"server"===t})&&e.jsx(se,{indicator:e.jsx(fA,{className:"w-3 h-3 shrink-0",style:{color:c.roomColor},strokeWidth:2.5}),label:"Room",tooltip:"Room Server identity for client sync."})),e.jsx(se,{indicator:e.jsx(gA,{className:"w-3 h-3 shrink-0",style:{color:c.localColor},strokeWidth:2.5}),label:"Local",tooltip:"Your repeater running pyMC_Repeater."}),m&&e.jsx(se,{indicator:e.jsx(ie,{color:c.neighborColor}),label:"Neighbor",tooltip:"Zero-hop direct RF contact."}),i.gatewayNodes.length>0&&e.jsx(se,{indicator:e.jsx(ie,{color:c.gatewayColor}),label:"Gateway",tooltip:"Significant forwarder (7-10% traffic)."}),h>0&&e.jsx(se,{indicator:e.jsx(ie,{color:c.hubColor}),label:"Backbone",tooltip:"Critical relay with high centrality."}),i.mobileNodes.length>0&&e.jsx(se,{indicator:e.jsx(ie,{color:c.mobileColor,ring:!0}),label:"Mobile",tooltip:"Volatile node that appears/disappears."}),g>0&&e.jsx(se,{indicator:e.jsx(k,{className:"w-3 h-3 shrink-0",style:{color:c.ghostColor},strokeWidth:2.5}),label:`Ghost (${g})`,tooltip:"Unknown repeater from Viterbi analysis."})]}),m&&e.jsxs(le,{title:"Link Quality",tooltip:"Neighbor edge colors based on bidirectional balance.",isOpen:v,onToggle:()=>C(A=>!A),showDivider:!0,children:[e.jsx(se,{indicator:e.jsx(ae,{color:f.YELLOW}),label:"2-Way",tooltip:"33-67% balanced. Ideal bidirectional link."}),e.jsx(se,{indicator:e.jsx(ae,{color:f.GREEN}),label:"Listener",tooltip:">67% listener. They hear us well."}),e.jsx(se,{indicator:e.jsx(ae,{color:f.RED}),label:"Loud",tooltip:"<33% listener. They route more to us."})]}),t&&r>0&&e.jsxs(le,{title:"Topology",tooltip:"Links with 5+ validations. Thickness = strength.",isOpen:B,onToggle:()=>M(A=>!A),showDivider:!0,children:[e.jsx(ce,{label:"Nodes",value:n+(o?1:0)}),i.hubNodes.length>0&&e.jsx(ce,{label:"Hubs",value:i.hubNodes.length,color:$A.hubColor}),i.loops.length>0&&e.jsx(ue,{icon:e.jsx(mA,{className:"w-3 h-3"}),color:$A.edges.hoverLoop,title:`${i.loops.length} ${1===i.loops.length?"Loop":"Loops"}`,subtitle:"Redundant paths"}),d.totalPaths>0&&e.jsx(ue,{icon:e.jsx(bA,{className:"w-3 h-3"}),color:c.ghostColor,title:`${d.totalPaths.toLocaleString()} Viterbi`,subtitle:"HMM decoded paths"})]})]})});var D}const fe=qA.textMuted;function ge({mapRef:A,showNeighborLines:t,onToggleNeighborLines:r,hasNeighborPolylines:n,nodeFilter:o,onNodeFilterChange:i,hasHubNodes:a,hasZeroHopNeighbors:s,showCoverage:l,onToggleCoverage:c,showMinCut:u=!1,onToggleMinCut:d,hasMinCutData:f=!1,show3DTerrain:g,onToggle3DTerrain:h,basemapMode:m,onToggleBasemap:b,isFullscreen:p,onToggleFullscreen:v}){const y="w-4 h-4",w="light"===m?fe:void 0;return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"absolute top-3 right-3 z-[600] flex flex-col gap-2 sm:top-4 sm:right-4",children:[e.jsxs("div",{className:"map-control-surface flex items-center gap-1 p-1",children:[n&&e.jsx(j,{plain:!0,color:t?"warning":"muted",onClick:r,title:t?"Hide edge lines":"Show edge lines","aria-label":t?"Hide edge lines":"Show edge lines","aria-pressed":t,className:"!p-1.5 !rounded-md",children:e.jsx(Q,{className:y})}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(N,{color:"all"===o?"green":"zinc",customColor:"all"!==o?w:void 0,onClick:()=>i("all"),title:"Show all nodes",children:"All"}),a&&e.jsx(N,{color:"hubs"===o?"green":"zinc",customColor:"hubs"!==o?w:void 0,onClick:()=>i("hubs"),title:"Show only hub nodes and their connections",children:"Hubs"}),s&&e.jsx(N,{color:"direct"===o?"green":"zinc",customColor:"direct"!==o?w:void 0,onClick:()=>i("direct"),title:"Show only zero-hop (direct RF) neighbors",children:"Direct"})]}),f&&d&&e.jsx(j,{plain:!0,color:u?"primary":"muted",onClick:d,title:u?"Hide community partition":"Show community partition","aria-label":u?"Hide community partition":"Show community partition","aria-pressed":u,className:"!p-1.5 !rounded-md",children:e.jsx(OA,{className:y})}),e.jsx(j,{plain:!0,color:"light"===m?"primary":"muted",onClick:b,title:"light"===m?"Switch to dark map":"Switch to light map","aria-label":"light"===m?"Switch to dark map":"Switch to light map","aria-pressed":"light"===m,className:"!p-1.5 !rounded-md",children:"light"===m?e.jsx(pA,{className:y}):e.jsx(vA,{className:y})}),e.jsx(j,{plain:!0,color:g?"success":"muted",onClick:h,title:g?"Disable 3D terrain":"Enable 3D terrain","aria-label":g?"Disable 3D terrain":"Enable 3D terrain","aria-pressed":g,className:"!p-1.5 !rounded-md",children:e.jsx(WA,{className:y})}),e.jsx(j,{plain:!0,color:"muted",onClick:v,title:p?"Exit fullscreen":"Fullscreen","aria-label":p?"Exit fullscreen":"Enter fullscreen","aria-pressed":p,className:"!p-1.5 !rounded-md",children:p?e.jsx(nA,{className:y}):e.jsx(oA,{className:y})})]}),e.jsxs("div",{className:"map-control-surface flex flex-col items-stretch !overflow-hidden self-end !p-0",children:[e.jsx(j,{plain:!0,color:"muted",onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomIn()},title:"Zoom in","aria-label":"Zoom in",className:"!p-1.5 !rounded-none",children:e.jsx(eA,{className:y})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx(j,{plain:!0,color:"muted",onClick:()=>{var e,t;null==(t=null==(e=A.current)?void 0:e.getMap())||t.zoomOut()},title:"Zoom out","aria-label":"Zoom out",className:"!p-1.5 !rounded-none",children:e.jsx(S,{className:y})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx(j,{plain:!0,color:"muted",onClick:()=>{var e;const t=null==(e=A.current)?void 0:e.getMap();t&&t.easeTo({bearing:0,pitch:0,duration:300})},title:"Reset bearing to north","aria-label":"Reset bearing to north",className:"!p-1.5 !rounded-none",children:e.jsx(yA,{className:y})})]})]})})}const he={text:qA.textSecondary,activeText:"#16A34A",activeBg:"rgba(220, 252, 231, 1)"},me="DeepAnalysis";function be(){return"abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())]}function pe({isActive:t,hasAnalyzed:r,isLoading:n,onClick:o,basemapMode:i="dark"}){const a="light"===i,s=a?he.text:void 0,l=a?he.activeText:"#4ADE80",[c,u]=A.useState(!1),[d,f]=A.useState(me),g=A.useRef(!1),h=A.useRef(null),[m]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),b=c&&!t&&!n&&m;A.useEffect(()=>{if(c&&!t&&!n&&!g.current){g.current=!0;const A=performance.now(),e=t=>{const r=t-A,n=Math.min(r/700,1),o=Math.floor(12*n);let i="";for(let A=0;A<12;A++)i+=A{h.current&&cancelAnimationFrame(h.current)}},[c,t,n]);const p=n?"Analyzing...":d;return e.jsxs("button",{onClick:o,onMouseEnter:()=>m&&u(!0),onMouseLeave:()=>m&&u(!1),onPointerEnter:()=>m&&u(!0),onPointerLeave:()=>m&&u(!1),disabled:n,className:"flex items-center gap-2 w-full text-left radius-inner transition-base "+(n?"cursor-wait":""),style:{padding:"0.5rem 0.625rem",backgroundColor:t?a?he.activeBg:"rgba(10, 26, 10, 1)":"var(--map-ui-bg, var(--surface))"},title:n?"Analyzing packet history...":r?t?"Hide topology edges":"Show topology edges":"Load full packet history and build topology",children:[n?e.jsx(F,{className:"w-3.5 h-3.5 flex-shrink-0 animate-spin",style:{color:l}}):e.jsx(CA,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"":"text-fg-secondary"),style:{...t&&{color:l},...b&&{color:l},...!t&&!b&&s&&{color:s}}}),e.jsx("span",{className:t?"":"text-fg-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:t||b?700:500,letterSpacing:"-0.01em",lineHeight:1,...t&&{color:l},...b&&{color:l},...!t&&!b&&s&&{color:s}},children:p})]})}const ve=b.teal,ye={text:qA.textSecondary,activeTeal:"#0D7377",activeBg:"rgba(204, 251, 241, 1)"};function we({isActive:t,onClick:r,basemapMode:n="dark"}){const o="light"===n,i=o?ye.text:void 0,a=o?ye.activeTeal:ve,[s,l]=A.useState(!1),[c,u]=A.useState(0),d=A.useRef(!1),f=A.useRef(null),[g,h]=A.useState(0),m=A.useRef(!1),[b]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)}),p=s&&!t&&b;A.useEffect(()=>{p&&!m.current&&(m.current=!0,h(1),setTimeout(()=>h(2),100),setTimeout(()=>h(3),200)),s||(m.current=!1,h(0))},[p,s]),A.useEffect(()=>{if(s&&!t&&!d.current){d.current=!0;const A=performance.now(),e=t=>{const r=t-A,n=Math.min(r/400,1);u(n),n<1&&(f.current=requestAnimationFrame(e))};f.current=requestAnimationFrame(e)}return s||(f.current&&(cancelAnimationFrame(f.current),f.current=null),d.current=!1,u(0)),()=>{f.current&&cancelAnimationFrame(f.current)}},[s,t]);const v=A=>{if(t)return a;if(!p)return i;const e=11*c;return A>=e-2&&Ab&&l(!0),onMouseLeave:()=>b&&l(!1),onPointerEnter:()=>b&&l(!0),onPointerLeave:()=>b&&l(!1),className:"flex items-center gap-2 w-full text-left radius-inner transition-base",style:{padding:"0.5rem 0.625rem",backgroundColor:t?o?ye.activeBg:"rgba(10, 36, 32, 1)":"var(--map-ui-bg, var(--surface))"},title:t?"Disable live packet tracing (reduces CPU usage)":"Enable live packet tracing",children:[e.jsx(BA,{className:"w-3.5 h-3.5 flex-shrink-0 "+(t?"":"text-fg-secondary"),fill:1===g?"#FFFFFF":3===g?a:"none",stroke:1===g||2===g?"#FFFFFF":t||p?a:i||"currentColor",style:{transition:"fill 0.05s, stroke 0.05s"}}),e.jsx("span",{className:t?"":"text-fg-secondary",style:{fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"0.6875rem",fontWeight:t||p?700:500,letterSpacing:"-0.01em",lineHeight:1},children:"LiveTrace".split("").map((A,t)=>e.jsx("span",{style:{color:v(t)||void 0},children:A},t))})]})}const xe={text:qA.textSecondary,hoverBg:qA.hoverBg,activeBg:"rgba(254, 243, 199, 1)",disabledText:qA.disabledText},ke="#fe8019";function Ce({isActive:t,onClick:r,brightness:n=.7,onBrightnessChange:o,basemapMode:i="dark"}){const a="light"===i,s=a?xe.text:void 0,[l,c]=A.useState(!1),[u,d]=A.useState(!1),[f]=A.useState(()=>{var A;return"undefined"!=typeof window&&((null==(A=window.matchMedia)?void 0:A.call(window,"(hover: hover)").matches)??!1)});A.useEffect(()=>{MA()},[]),A.useEffect(()=>{if(!l||t)return;const A=requestAnimationFrame(()=>d(!0)),e=setTimeout(()=>d(!1),80);return()=>{cancelAnimationFrame(A),clearTimeout(e)}},[l,t]);const g=Math.max(.01,Math.min(1,n)),h=g<.999,m=g>.011,b=l&&!t&&f;return e.jsxs("button",{onClick:r,onMouseEnter:()=>f&&c(!0),onMouseLeave:()=>f&&c(!1),onPointerEnter:()=>f&&c(!0),onPointerLeave:()=>f&&c(!1),className:"flex items-center gap-2 w-full text-left radius-inner transition-base",style:{padding:"0.5rem 0.625rem",backgroundColor:t?a?xe.activeBg:"rgba(26, 20, 8, 1)":"var(--map-ui-bg, var(--surface))"},title:t?"Configure wardriving coverage":"Show wardriving coverage",children:[e.jsx(ZA,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"text-sys-amber":"text-fg-secondary"),style:b?{color:ke}:!t&&s?{color:s}:void 0}),e.jsx("span",{className:t?"text-sys-amber":"text-fg-secondary",style:{fontFamily:t||b?"'Jacquard 12', serif":"ui-monospace, SFMono-Regular, monospace",fontSize:t||b?"0.75rem":"0.6875rem",fontWeight:500,letterSpacing:"-0.01em",lineHeight:1,transition:"none",transform:t?"scale(1.45)":b?`scale(${u?1.595:1.45})`:void 0,transformOrigin:"left center",...b?{color:ke}:!t&&s?{color:s}:{}},children:"Wardrive"}),t&&o&&e.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[e.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.max(.01,g-.2);null==o||o(e)},disabled:!m,className:"p-0.5 rounded transition-colors "+(m?"text-sys-amber":"cursor-not-allowed"),style:{...m&&{"--hover-bg":a?xe.hoverBg:"var(--elevated)"},...!m&&{color:a?xe.disabledText:"rgba(251, 191, 36, 0.3)"}},onMouseEnter:A=>m&&(A.currentTarget.style.backgroundColor=a?xe.hoverBg:"var(--elevated)"),onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",title:`Decrease opacity (${Math.round(100*g)}%)`,children:e.jsx(vA,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.min(1,g+.2);null==o||o(e)},disabled:!h,className:"p-0.5 rounded transition-colors "+(h?"text-sys-amber":"cursor-not-allowed"),style:{...h&&{"--hover-bg":a?xe.hoverBg:"var(--elevated)"},...!h&&{color:a?xe.disabledText:"rgba(251, 191, 36, 0.3)"}},onMouseEnter:A=>h&&(A.currentTarget.style.backgroundColor=a?xe.hoverBg:"var(--elevated)"),onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",title:`Increase opacity (${Math.round(100*g)}%)`,children:e.jsx(pA,{className:"w-3.5 h-3.5"})})]})]})}function Be(A){let e=!0,t=-90,r=90,n=-180,o=180;for(const i of A.toLowerCase()){const A="0123456789bcdefghjkmnpqrstuvwxyz".indexOf(i);if(-1!==A)for(let i=4;i>=0;i--){const a=A>>i&1;if(e){const A=(n+o)/2;a?n=A:o=A}else{const A=(t+r)/2;a?t=A:r=A}e=!e}}return{lat:(t+r)/2,lon:(n+o)/2}}function Me(A){return Math.exp(-A*Math.LN2/7)}const De="pymc-wardriving-url",Ee="pymc-wardriving-enabled",je="pymc-wardriving-brightness";function Qe(A){"undefined"!=typeof localStorage&&(A?localStorage.setItem(De,A):localStorage.removeItem(De))}function Ne(A){"undefined"!=typeof localStorage&&localStorage.setItem(Ee,String(A))}function Se(){if("undefined"==typeof localStorage)return.7;const A=localStorage.getItem(je);if(A){const e=parseFloat(A);if(!isNaN(e)&&e>=.01&&e<=1)return e}return.7}function Fe(A,e=null){if(null!==A){const t=(Math.max(-12,Math.min(12,A))+12)/24;return null!==e?.8*t+(Math.max(-120,Math.min(-50,e))+120)/70*.2:t}return null!==e?(Math.max(-120,Math.min(-50,e))+120)/70:.5}const Pe=DA((A,e)=>({status:"idle",isVisible:"undefined"!=typeof localStorage&&"true"===localStorage.getItem(Ee),coveragePoints:[],repeaters:[],error:null,stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},url:"undefined"==typeof localStorage?"":localStorage.getItem(De)||"",brightness:Se(),isModalOpen:!1,openModal:()=>A({isModalOpen:!0}),closeModal:()=>A({isModalOpen:!1}),setUrl:e=>A({url:e}),setBrightness:e=>{const t=Math.max(.01,Math.min(1,e));!function(A){if("undefined"==typeof localStorage)return;const e=Math.max(.01,Math.min(1,A));localStorage.setItem(je,String(e))}(t),A({brightness:t})},toggleVisibility:()=>{const t=!e().isVisible;Ne(t),A({isVisible:t})},setVisible:e=>{Ne(e),A({isVisible:e})},loadCoverage:async e=>{if(!e.trim())return A({error:"Please enter a URL",status:"error"}),!1;try{new URL(e.trim())}catch{return A({error:"Invalid URL format",status:"error"}),!1}A({error:null,status:"connecting"});try{A({status:"loading"});const t=await async function(A){const e=`${A.replace(/\/+$/,"").replace(/\/get-nodes$/,"").replace(/\/get-samples$/,"")}/get-samples`,t=await async function(A,e={},t=8e3){const r=new AbortController,n=setTimeout(()=>r.abort(),t);try{return await fetch(A,{...e,signal:r.signal})}catch(o){if(o instanceof Error&&"AbortError"===o.name)throw new Error(`Connection timed out after ${t/1e3}s`);throw o}finally{clearTimeout(n)}}(e,{headers:{Accept:"application/json"}});if(!t.ok)throw new Error(`Failed to fetch precise samples: ${t.status}`);return t.json()}(e.trim());if(!t||"object"!=typeof t)throw new Error("Invalid response from server");if(!Array.isArray(t.keys))throw new Error("No sample data found in response");A({status:"processing"});const r=function(A){var e;const t=[];for(const r of A.keys){if(!r.observed)continue;const{lat:A,lon:n}=Be(r.hash),o=parseInt(r.time,10),i=isNaN(o)?30:(Date.now()-o)/864e5,a=Me(i),s=Fe(r.snr,r.rssi)*(.3+.7*a);t.push({lat:A,lon:n,successRate:r.observed?1:0,weight:s,totalSamples:1,ageDays:i,geohash:r.hash,repeaters:(null==(e=r.path)?void 0:e.map(A=>A.toLowerCase()))||[]})}return t}(t);if(0===r.length)throw new Error("No valid coverage points found");return A({coveragePoints:r,repeaters:[],stats:{coverageCount:r.length,repeaterCount:0,lastUpdated:new Date},status:"success",isVisible:!0,url:e.trim()}),Qe(e.trim()),Ne(!0),!0}catch(t){const e=t instanceof Error?t.message:"Failed to load coverage data";let r=e;return e.includes("timed out")?r="Connection timed out. Server may be unreachable or slow.":e.includes("Failed to fetch")||e.includes("NetworkError")?r="Could not connect to server. Check the URL and try again.":e.includes("CORS")?r="Server does not allow cross-origin requests.":e.includes("404")?r="Coverage endpoint not found. Check the URL.":(e.includes("ERR_NAME_NOT_RESOLVED")||e.includes("DNS"))&&(r="Server not found. Check the URL for typos."),A({error:r,status:"error"}),!1}},clearCoverage:()=>{A({coveragePoints:[],repeaters:[],stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},status:"idle",error:null,isVisible:!1,url:""}),Qe(""),Ne(!1)}})),Te={bg:"#F8F8F8",bgSubtle:"#F0F0F0",bgElevated:"#FFFFFF",bgInput:"#FFFFFF",border:"rgba(0, 0, 0, 0.12)",borderStrong:"rgba(0, 0, 0, 0.20)",borderFocus:"#3B82F6",text:"#1A1A1A",textSecondary:"#4A4A4A",textMuted:"#737373",success:"#059669",successBg:"#ECFDF5",successBorder:"#A7F3D0",error:"#DC2626",errorBg:"#FEF2F2",errorBorder:"#FECACA",info:"#2563EB",infoBg:"#EFF6FF",infoBorder:"#BFDBFE",warning:"#D97706",warningBg:"#FFFBEB",warningBorder:"#FDE68A",primary:"#F59E0B",hoverBg:"rgba(0, 0, 0, 0.04)",sliderTrack:"#E5E7EB",sliderThumb:"#F59E0B"},Le={bg:"var(--surface)",bgSubtle:"var(--subtle)",bgElevated:"var(--elevated)",bgInput:"var(--subtle)",border:"var(--edge-subtle)",borderStrong:"var(--edge-strong)",borderFocus:"var(--sys-blue)",text:"var(--fg-primary)",textSecondary:"var(--fg-secondary)",textMuted:"var(--fg-muted)",success:"var(--sys-green)",successBg:"rgba(74, 222, 128, 0.1)",successBorder:"rgba(74, 222, 128, 0.3)",error:"var(--sys-red)",errorBg:"rgba(239, 68, 68, 0.1)",errorBorder:"rgba(239, 68, 68, 0.3)",info:"var(--sys-indigo)",infoBg:"rgba(249, 210, 111, 0.1)",infoBorder:"rgba(249, 210, 111, 0.3)",warning:"var(--sys-indigo)",warningBg:"rgba(249, 210, 111, 0.1)",warningBorder:"rgba(249, 210, 111, 0.3)",primary:"var(--sys-indigo)",hoverBg:"var(--hover-tint)",sliderTrack:"var(--elevated)",sliderThumb:"var(--sys-indigo)"},Re=A.createContext({theme:Le,isLight:!1});function Ie(){return A.useContext(Re)}function _e({status:t,hasData:r}){const{theme:n,isLight:o}=Ie(),i=A.useMemo(()=>"connecting"===t||"loading"===t||"processing"===t?{icon:e.jsx(F,{className:"w-3.5 h-3.5 animate-spin"}),label:"connecting"===t?"Connecting...":"loading"===t?"Loading...":"Processing...",color:n.warning,bg:n.warningBg}:"error"===t?{icon:e.jsx(KA,{className:"w-3.5 h-3.5"}),label:"Disconnected",color:n.error,bg:n.errorBg}:r?{icon:e.jsx(SA,{className:"w-3.5 h-3.5"}),label:"Connected",color:n.success,bg:n.successBg}:{icon:e.jsx(T,{className:"w-3.5 h-3.5"}),label:"Ready",color:n.textMuted,bg:o?"rgba(0,0,0,0.04)":"rgba(255,255,255,0.04)"},[t,r,n,o]);return e.jsxs(B.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"flex items-center gap-1.5 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:i.bg,color:i.color},children:[i.icon,e.jsx("span",{children:i.label})]},i.label)}function ze({status:t}){const{theme:r}=Ie(),n=A.useMemo(()=>{switch(t){case"connecting":return 25;case"loading":return 60;case"processing":return 90;default:return 0}},[t]);return 0===n?null:e.jsx(B.div,{initial:{opacity:0,scaleY:0},animate:{opacity:1,scaleY:1},exit:{opacity:0,scaleY:0},className:"h-1 rounded-full overflow-hidden origin-top",style:{backgroundColor:r.sliderTrack},children:e.jsx(B.div,{className:"h-full rounded-full",style:{backgroundColor:r.primary},initial:{width:0},animate:{width:`${n}%`},transition:{duration:.4,ease:"easeOut"}})})}function He({variant:t,title:r,description:n,onDismiss:o}){const{theme:i}=Ie(),a=A.useMemo(()=>{switch(t){case"success":return{icon:e.jsx(I,{className:"w-4 h-4"}),color:i.success,bg:i.successBg,border:i.successBorder};case"error":return{icon:e.jsx(UA,{className:"w-4 h-4"}),color:i.error,bg:i.errorBg,border:i.errorBorder};case"info":return{icon:e.jsx(YA,{className:"w-4 h-4"}),color:i.info,bg:i.infoBg,border:i.infoBorder}}},[t,i]);return e.jsxs(B.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:E.snappy,className:"flex items-start gap-3 p-3 rounded-lg border",style:{backgroundColor:a.bg,borderColor:a.border,color:a.color},children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:r}),n&&e.jsx("p",{className:"text-xs mt-0.5 opacity-80",children:n})]}),o&&e.jsx("button",{onClick:o,className:"flex-shrink-0 p-1 rounded hover:bg-black/10 transition-colors","aria-label":"Dismiss",children:e.jsx(L,{className:"w-3.5 h-3.5"})})]})}function Ge({value:r,onChange:n,onSubmit:o,disabled:i}){const{theme:a,isLight:s}=Ie(),[l,c]=A.useState(!1);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"block text-sm font-medium",style:{color:a.textSecondary},children:"Coverage Server URL"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"url",value:r,onChange:A=>n(A.target.value),onKeyDown:A=>{"Enter"!==A.key||A.shiftKey||i||(A.preventDefault(),o())},onFocus:()=>c(!0),onBlur:()=>c(!1),placeholder:"https://coverage.wcmesh.com",disabled:i,className:t("w-full pl-3 pr-10 py-2.5 rounded-lg border text-sm transition-all duration-150","focus:outline-none",i&&"opacity-50 cursor-not-allowed"),style:{backgroundColor:a.bgInput,borderColor:l?a.borderFocus:a.border,color:a.text,boxShadow:l?"0 0 0 3px "+(s?"rgba(59, 130, 246, 0.15)":"rgba(139, 92, 246, 0.15)"):"none"}}),r&&!i&&e.jsx("button",{onClick:()=>n(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 p-1 rounded transition-colors",style:{color:a.textMuted},onMouseEnter:A=>A.currentTarget.style.color=a.text,onMouseLeave:A=>A.currentTarget.style.color=a.textMuted,"aria-label":"Clear URL",children:e.jsx(L,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs",style:{color:a.textMuted},children:"Press Enter to connect, or use the Connect button below"})]})}function Oe({value:A,onChange:r}){const{theme:n,isLight:o}=Ie(),i=Math.round(100*A);return e.jsx(B.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:E.gentle,className:"overflow-hidden",children:e.jsx("div",{className:"p-3 rounded-lg border",style:{backgroundColor:n.bgSubtle,borderColor:n.border},children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative w-4 h-4",children:[e.jsx(vA,{className:"w-4 h-4 absolute inset-0 transition-opacity",style:{color:n.textMuted,opacity:A<.5?1:0}}),e.jsx(pA,{className:"w-4 h-4 absolute inset-0 transition-opacity",style:{color:n.primary,opacity:A>=.5?1:0}})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs font-medium",style:{color:n.textSecondary},children:"Layer Opacity"}),e.jsxs("span",{className:"text-xs font-mono tabular-nums px-1.5 py-0.5 rounded",style:{color:n.text,backgroundColor:o?"rgba(0,0,0,0.06)":"rgba(255,255,255,0.06)"},children:[i,"%"]})]}),e.jsx("input",{type:"range",min:5,max:100,value:i,onChange:A=>r(Number(A.target.value)/100),className:t("w-full h-2 rounded-full appearance-none cursor-pointer","[&::-webkit-slider-thumb]:appearance-none","[&::-webkit-slider-thumb]:w-4","[&::-webkit-slider-thumb]:h-4","[&::-webkit-slider-thumb]:rounded-full","[&::-webkit-slider-thumb]:cursor-pointer","[&::-webkit-slider-thumb]:transition-transform","[&::-webkit-slider-thumb]:hover:scale-110","[&::-webkit-slider-thumb]:shadow-lg","[&::-moz-range-thumb]:appearance-none","[&::-moz-range-thumb]:w-4","[&::-moz-range-thumb]:h-4","[&::-moz-range-thumb]:rounded-full","[&::-moz-range-thumb]:border-0","[&::-moz-range-thumb]:cursor-pointer"),style:{background:`linear-gradient(to right, ${n.primary} ${i}%, ${n.sliderTrack} ${i}%)`,"--thumb-color":n.sliderThumb}}),e.jsx("style",{children:`\n input[type="range"]::-webkit-slider-thumb {\n background-color: ${n.sliderThumb};\n }\n input[type="range"]::-moz-range-thumb {\n background-color: ${n.sliderThumb};\n }\n `})]})]})})})}function Ue({coverageCount:A,repeaterCount:t,lastUpdated:r}){const{theme:n}=Ie();return e.jsxs("div",{className:"grid grid-cols-3 gap-2 p-3 rounded-lg border",style:{backgroundColor:n.bgSubtle,borderColor:n.border},children:[e.jsxs("div",{className:"text-center",children:[e.jsx(hA,{value:A,format:{useGrouping:!0,maximumFractionDigits:0},className:"text-lg font-semibold tabular-nums block",style:{color:n.text}}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:n.textMuted},children:"Points"})]}),e.jsxs("div",{className:"text-center border-x",style:{borderColor:n.border},children:[e.jsx(hA,{value:t,format:{useGrouping:!0,maximumFractionDigits:0},className:"text-lg font-semibold tabular-nums block",style:{color:n.text}}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:n.textMuted},children:"Repeaters"})]}),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[e.jsx(_,{className:"w-3.5 h-3.5",style:{color:n.textMuted}}),e.jsx("span",{className:"text-lg font-semibold tabular-nums",style:{color:n.text},children:r?r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):"—"})]}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:n.textMuted},children:"Updated"})]})]})}function Ye({icon:r,label:n,onClick:o,disabled:i,variant:a="default",active:s}){const{theme:l,isLight:c}=Ie(),u=A.useMemo(()=>"danger"===a?{text:l.error,hoverBg:c?"rgba(220, 38, 38, 0.08)":"rgba(239, 68, 68, 0.15)"}:{text:s?l.primary:l.textSecondary,hoverBg:l.hoverBg},[a,s,l,c]);return e.jsxs("button",{onClick:o,disabled:i,className:t("flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-sm font-medium transition-colors",i&&"opacity-50 cursor-not-allowed"),style:{color:u.text},onMouseEnter:A=>!i&&(A.currentTarget.style.backgroundColor=u.hoverBg),onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:[r,e.jsx("span",{children:n})]})}function We(){const t=n(),r="light"===t,o=r?Te:Le,{isModalOpen:i,closeModal:a,status:s,isVisible:l,stats:c,error:u,url:d,brightness:f,loadCoverage:g,clearCoverage:h,toggleVisibility:m,setUrl:b,setBrightness:p}=Pe(),v="connecting"===s||"loading"===s||"processing"===s,y=c.coverageCount>0,[w,x]=A.useState(!0),[k,C]=A.useState(d);A.useEffect(()=>{C(d)},[d]),A.useEffect(()=>{"error"===s&&x(!0)},[s]);const M=A.useCallback(async()=>{await g(k)},[k,g]),Q=A.useCallback(()=>{C(""),h()},[h]),N=A.useCallback(A=>{C(A),b(A)},[b]),S=A.useCallback(()=>{v||a()},[v,a]),I=k.trim().length>0&&!v;return e.jsx(Re.Provider,{value:{theme:o,isLight:r},children:e.jsxs(P,{open:i,onClose:S,size:"md",bottomSheet:!0,basemapMode:t,children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",style:{borderColor:o.border},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg",style:{backgroundColor:o.bgSubtle,color:o.primary},children:e.jsx(T,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"type-micro",style:{color:o.text},children:"Wardriving Coverage"}),e.jsx("p",{className:"text-xs",style:{color:o.textMuted},children:"RF coverage heatmap overlay"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_e,{status:s,hasData:y}),!v&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:S,className:"sm:hidden min-h-[44px] min-w-[44px] px-3 flex items-center justify-center text-[15px] font-medium transition-base radius-inner active:bg-subtle-fill",style:{color:o.primary},children:"Done"}),e.jsx("button",{onClick:S,className:"hidden sm:flex items-center justify-center p-2 rounded-lg transition-colors",style:{color:o.textMuted},onMouseEnter:A=>{A.currentTarget.style.color=o.text,A.currentTarget.style.backgroundColor=o.hoverBg},onMouseLeave:A=>{A.currentTarget.style.color=o.textMuted,A.currentTarget.style.backgroundColor="transparent"},"aria-label":"Close",children:e.jsx(L,{className:"w-5 h-5"})})]})]})]}),e.jsx(D,{children:v&&e.jsx(ze,{status:s})}),e.jsxs(R,{className:"space-y-4",children:[e.jsx(Ge,{value:k,onChange:N,onSubmit:M,disabled:v}),e.jsx(D,{children:"error"===s&&u&&w&&e.jsx(He,{variant:"error",title:"Connection Failed",description:u,onDismiss:()=>x(!1)})}),e.jsx(D,{children:"success"===s&&y&&e.jsx(He,{variant:"success",title:"Coverage Data Loaded",description:"Adjust opacity below, then close to view on map"})}),e.jsx(D,{children:y&&!v&&e.jsx(B.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},transition:E.snappy,children:e.jsx(Ue,{coverageCount:c.coverageCount,repeaterCount:c.repeaterCount,lastUpdated:c.lastUpdated})})}),e.jsx(D,{children:y&&!v&&e.jsx(Oe,{value:f,onChange:p})})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 border-t",style:{borderColor:o.border},children:[e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(D,{children:y&&e.jsxs(B.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},transition:E.snappy,className:"flex items-center gap-1",children:[e.jsx(Ye,{icon:l?e.jsx(iA,{className:"w-4 h-4"}):e.jsx(bA,{className:"w-4 h-4"}),label:l?"Hide":"Show",onClick:m,disabled:v,active:l}),e.jsx(Ye,{icon:e.jsx(tA,{className:"w-4 h-4"}),label:"Clear",onClick:Q,disabled:v,variant:"danger"})]})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(j,{plain:!0,color:"muted",onClick:S,disabled:v,children:y?"Done":"Cancel"}),e.jsx(j,{color:"warning",onClick:M,disabled:!I,children:v?e.jsxs(e.Fragment,{children:[e.jsx(F,{"data-slot":"icon",className:"animate-spin"}),"connecting"===s?"Connecting...":"loading"===s?"Loading...":"Processing..."]}):y?e.jsxs(e.Fragment,{children:[e.jsx(mA,{"data-slot":"icon"}),"Refresh"]}):e.jsxs(e.Fragment,{children:[e.jsx(QA,{"data-slot":"icon"}),"Connect"]})})]})]})]})})}const Ve={bandwidth:.07,threshold:.1,opacity:1,strokeWidth:4.5},Ze={...qA,trackBg:qA.border};function Ke({label:A,value:t,min:r,max:n,step:o,unit:i,formatValue:a,onChange:s,isLightMode:l}){const c=a?a(t):t.toFixed(2);return e.jsxs("div",{className:"flex items-center gap-2 sm:gap-2",children:[e.jsx("span",{className:"text-xs font-medium w-14 sm:w-16 flex-shrink-0",style:l?{color:Ze.textSecondary}:{color:"var(--fg-secondary)"},children:A}),e.jsx("input",{type:"range",min:r,max:n,step:o,value:t,onChange:A=>s(parseFloat(A.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer\n [&::-webkit-slider-thumb]:appearance-none\n [&::-webkit-slider-thumb]:w-3.5\n [&::-webkit-slider-thumb]:h-3.5\n [&::-webkit-slider-thumb]:rounded-full\n [&::-webkit-slider-thumb]:bg-sys-indigo\n [&::-webkit-slider-thumb]:cursor-pointer\n [&::-webkit-slider-thumb]:transition-transform\n [&::-webkit-slider-thumb]:hover:scale-110\n [&::-webkit-slider-thumb]:shadow-md",style:l?{backgroundColor:Ze.trackBg}:{backgroundColor:"var(--elevated)"}}),e.jsxs("span",{className:"text-xs font-mono tabular-nums w-12 sm:w-14 text-right flex-shrink-0",style:l?{color:Ze.textPrimary}:{color:"var(--fg-muted)"},children:[c,i&&e.jsx("span",{className:"ml-0.5 opacity-70",style:l?{color:Ze.textMuted}:void 0,children:i})]})]})}function Je({icon:A,label:t,value:r,subtext:n,isLightMode:o}){return e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 py-0.5 sm:py-1",children:[e.jsx("div",{style:o?{color:Ze.textMuted}:{color:"var(--fg-muted)"},children:A}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("div",{className:"text-[10px] sm:text-xs truncate",style:o?{color:Ze.textSecondary}:{color:"var(--fg-secondary)"},children:t})}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-xs font-mono tabular-nums",style:o?{color:Ze.textPrimary}:{color:"var(--fg-primary)"},children:r}),n&&e.jsx("div",{className:"text-[9px] leading-tight opacity-70",style:o?{color:Ze.textMuted}:{color:"var(--fg-muted)"},children:n})]})]})}function Xe({visible:t,onClose:r,settings:n,onSettingsChange:o,partition:i,totalNodes:a,basemapMode:s="dark"}){const l=aA(),c=A.useRef(null),u="light"===s,d=A.useMemo(()=>{if(!i)return{numCommunities:0,avgCommunitySize:0,minCommunitySize:0,maxCommunitySize:0,fiedlerValue:0,modularity:0,coveragePercent:0};const A=Array.from(i.communities.values()).map(A=>A.length),e=A.reduce((A,e)=>A+e,0);return{numCommunities:i.numCommunities,avgCommunitySize:A.length>0?Math.round(e/A.length):0,minCommunitySize:A.length>0?Math.min(...A):0,maxCommunitySize:A.length>0?Math.max(...A):0,fiedlerValue:i.fiedlerValue,modularity:0,coveragePercent:a>0?Math.round(e/a*100):0}},[i,a]),f=(A,e)=>{o({...n,[A]:e})},g=(111*n.bandwidth).toFixed(1);return e.jsx("div",{ref:c,className:"absolute inset-0 z-[600] pointer-events-none",children:e.jsx(D,{children:t&&e.jsx(B.div,{drag:!0,dragControls:l,dragConstraints:c,dragElastic:.1,dragMomentum:!1,initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:E.smooth,className:"\n absolute pointer-events-auto\n /* Mobile: bottom sheet style, full width with margins */\n bottom-2 left-2 right-2\n /* sm+: floating panel in bottom-right */\n sm:bottom-16 sm:left-auto sm:right-3 sm:w-64\n /* md+: slightly wider */\n md:w-72\n ",style:{touchAction:"none"},children:e.jsxs("div",{className:"\n map-control-surface rounded-lg overflow-hidden shadow-lg\n /* Mobile: limit height, allow scroll */\n max-h-[45vh] sm:max-h-[calc(100vh-180px)] overflow-y-auto\n /* iOS momentum scrolling */\n overscroll-contain\n ",children:[e.jsxs("div",{className:"\n flex items-center justify-between \n px-3 py-2 sm:px-2.5 sm:py-1.5 \n border-b \n cursor-grab active:cursor-grabbing\n /* Larger touch target on mobile */\n min-h-[44px] sm:min-h-0\n ",style:u?{borderColor:Ze.border}:void 0,onPointerDown:A=>l.start(A),children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-1.5",children:[e.jsx(sA,{className:"w-4 h-4 sm:w-3 sm:h-3",style:u?{color:Ze.textMuted}:void 0}),e.jsx(OA,{className:"w-4 h-4 sm:w-3.5 sm:h-3.5 text-sys-blue"}),e.jsx("span",{className:"text-sm sm:text-xs font-medium",style:u?{color:Ze.textPrimary}:void 0,children:"Partition"})]}),e.jsx(j,{plain:!0,color:"muted",onClick:r,className:"!p-1.5 sm:!p-0.5 !rounded min-w-[44px] min-h-[44px] sm:min-w-0 sm:min-h-0 flex items-center justify-center","aria-label":"Close toolbox",children:e.jsx(L,{className:"w-4 h-4 sm:w-3 sm:h-3"})})]}),e.jsx("div",{className:"px-3 py-2 sm:px-2.5 sm:py-1.5 border-b",style:u?{borderColor:Ze.border}:void 0,children:e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 sm:gap-x-3 gap-y-1 sm:gap-y-0.5",children:[e.jsx(Je,{icon:e.jsx(OA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Communities",value:d.numCommunities,isLightMode:u}),e.jsx(Je,{icon:e.jsx(FA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Avg Size",value:d.avgCommunitySize,subtext:`${d.minCommunitySize}–${d.maxCommunitySize}`,isLightMode:u}),e.jsx(Je,{icon:e.jsx(VA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Fiedler λ₂",value:d.fiedlerValue.toFixed(3),isLightMode:u}),e.jsx(Je,{icon:e.jsx(FA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Coverage",value:`${d.coveragePercent}%`,subtext:`of ${a}`,isLightMode:u})]})}),e.jsx("div",{className:"px-3 py-2 sm:px-2.5 sm:py-1.5",children:e.jsxs("div",{className:"space-y-3 sm:space-y-1.5",children:[e.jsx(Ke,{label:"Bandwidth",value:n.bandwidth,min:.01,max:.15,step:.005,formatValue:()=>g,unit:"km",onChange:A=>f("bandwidth",A),isLightMode:u}),e.jsx(Ke,{label:"Threshold",value:n.threshold,min:.05,max:.5,step:.01,formatValue:A=>`${Math.round(100*(1-A))}%`,unit:"cov",onChange:A=>f("threshold",A),isLightMode:u}),e.jsx(Ke,{label:"Opacity",value:n.opacity,min:.1,max:1,step:.05,formatValue:A=>`${Math.round(100*A)}%`,onChange:A=>f("opacity",A),isLightMode:u}),e.jsx(Ke,{label:"Stroke",value:n.strokeWidth,min:0,max:5,step:.5,unit:"px",formatValue:A=>A.toFixed(1),onChange:A=>f("strokeWidth",A),isLightMode:u})]})})]})})})})}const qe={getItem:A=>{try{return localStorage.getItem(A)}catch{return null}},setItem:(A,e)=>{try{localStorage.setItem(A,e)}catch{}},removeItem:A=>{try{localStorage.removeItem(A)}catch{}}},$e=DA()(EA(A=>({isEnabled:!1,toggle:()=>A(A=>({isEnabled:!A.isEnabled})),setEnabled:e=>A({isEnabled:e})}),{name:"pymc-live-trace",storage:jA(()=>qe)}));var At=function(A){var e,t=void 0!==(A=A||{})?A:{},r={};for(e in t)t.hasOwnProperty(e)&&(r[e]=t[e]);var n,o="";"undefined"!=typeof document&&document.currentScript&&(o=document.currentScript.src),o=0!==o.indexOf("blob:")?o.substr(0,o.lastIndexOf("/")+1):"",n=function(A,e,t){var r=new XMLHttpRequest;r.open("GET",A,!0),r.responseType="arraybuffer",r.onload=function(){if(200==r.status||0==r.status&&r.response)e(r.response);else{var n=O(A);n?e(n.buffer):t()}},r.onerror=t,r.send(null)};var i=t.print||function(){}.bind(),a=t.printErr||function(){}.bind();for(e in r)r.hasOwnProperty(e)&&(t[e]=r[e]);r=null,t.arguments&&t.arguments;var s=0,l=!1;function c(A){var e=t["_"+A];return e||tA("Assertion failed: "+("Cannot call unknown function "+A+", make sure it is exported")),e}var u,d,f,g,h,m,b,p="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function v(A,e){return A?function(A,e,t){for(var r=e+t,n=e;A[n]&&!(n>=r);)++n;if(n-e>16&&A.subarray&&p)return p.decode(A.subarray(e,n));for(var o="";e>10,56320|1023&l)}}else o+=String.fromCharCode((31&i)<<6|a)}else o+=String.fromCharCode(i)}return o}(f,A,e):""}function y(A,e){return A%e>0&&(A+=e-A%e),A}function w(A){u=A,t.HEAP8=d=new Int8Array(A),t.HEAP16=g=new Int16Array(A),t.HEAP32=h=new Int32Array(A),t.HEAPU8=f=new Uint8Array(A),t.HEAPU16=new Uint16Array(A),t.HEAPU32=new Uint32Array(A),t.HEAPF32=m=new Float32Array(A),t.HEAPF64=b=new Float64Array(A)}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var x=t.TOTAL_MEMORY||33554432;function k(A){for(;A.length>0;){var e=A.shift();if("function"!=typeof e){var r=e.func;"number"==typeof r?void 0===e.arg?t.dynCall_v(r):t.dynCall_vi(r,e.arg):r(void 0===e.arg?null:e.arg)}else e()}}x=(u=t.buffer?t.buffer:new ArrayBuffer(x)).byteLength,w(u),h[7156]=5271536;var C=[],B=[],M=[],D=[];function E(A){C.unshift(A)}function j(A){D.unshift(A)}var Q=Math.abs,N=Math.ceil,S=Math.floor,F=Math.min,P=0,T=null;t.preloadedImages={},t.preloadedAudios={};var L,R,I=null,_="data:application/octet-stream;base64,";function z(A){return String.prototype.startsWith?A.startsWith(_):0===A.indexOf(_)}function H(){return d.length}I="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAH6iBfbytuk/Gq6akm/58z/Xrm0Liez0P5doSdOpSwRAWs602ULg8D/dT7Rcbo/1v1N1RQHFNOM/g9Snx7HW3L8HWsP8Q3jfP6VwOLosutk/9rjk1YQcxj+gnmKMsNn6P/HDeuPFY+M/YHwDjqKhB0Ci19/fCVrbP4UxKkDWOP6/pvljWa09tL9wi7wrQXjnv/Z6yLImkM2/3yTlOzY14D+m+WNZrT20PzwKVQnrQwNA9nrIsiaQzT/g40rFrRQFwPa45NWEHMa/kbslHEZq97/xw3rjxWPjv4cLC2SMBci/otff3wla27+rKF5oIAv0P1N1RQHFNOO/iDJPGyWHBUAHWsP8Q3jfvwQf/by16gXAfqIF9vK26b8XrO0Vh0r+v9eubQuJ7PS/BxLrA0ZZ479azrTZQuDwv1MK1EuItPw/yscgV9Z6FkAwHBR2WjQMQJNRzXsQ5vY/GlUHVJYKF0DONuFv2lMNQNCGZ28QJfk/0WUwoIL36D8ggDOMQuATQNqMOeAy/wZAWFYOYM+M2z/LWC4uH3oSQDE+LyTsMgRAkJzhRGWFGEDd4soovCQQQKqk0DJMEP8/rGmNdwOLBUAW2X/9xCbjP4hu3dcqJhNAzuYItRvdB0CgzW3zJW/sPxotm/Y2TxRAQAk9XmdDDEC1Kx9MKgT3P1M+NctcghZAFVqcLlb0C0Bgzd3sB2b2P77mZDPUWhZAFROHJpUGCEDAfma5CxXtPz1DWq/zYxRAmhYY5824F0DOuQKWSbAOQNCMqrvu3fs/L6DR22K2wT9nAAxPBU8RQGiN6mW43AFAZhu25b633D8c1YgmzowSQNM25BRKWARArGS08/lNxD+LFssHwmMRQLC5aNcxBgJABL9HT0WRF0CjCmJmOGEOQHsuaVzMP/s/TWJCaGGwBUCeu1PAPLzjP9nqN9DZOBNAKE4JcydbCkCGtbd1qjPzP8dgm9U8jhVAtPeKTkVwDkCeCLss5l37P401XMPLmBdAFd29VMVQDUBg0yA55h75Pz6odcYLCRdApBM4rBrkAkDyAVWgQxbRP4XDMnK20hFAymLlF7EmzD8GUgo9XBHlP3lbK7T9COc/k+OhPthhy7+YGEpnrOvCPzBFhLs15u4/epbqB6H4uz9IuuLF5svev6lzLKY31es/CaQ0envF5z8ZY0xlUADXv7zaz7HYEuI/CfbK1sn16T8uAQfWwxLWPzKn/YuFN94/5KdbC1AFu793fyCSnlfvPzK2y4doAMY/NRg5t1/X6b/shq4QJaHDP5yNIAKPOeI/vpn7BSE30r/X4YQrO6nrv78Ziv/Thto/DqJ1Y6+y5z9l51NaxFrlv8QlA65HOLS/86dxiEc96z+Hj0+LFjneP6LzBZ8LTc2/DaJ1Y6+y579l51NaxFrlP8QlA65HOLQ/8qdxiEc967+Jj0+LFjnev6LzBZ8LTc0/1qdbC1AFuz93fyCSnlfvvzK2y4doAMa/NRg5t1/X6T/vhq4QJaHDv5yNIAKPOeK/wJn7BSE30j/W4YQrO6nrP78Ziv/Thtq/CaQ0envF578XY0xlUADXP7zaz7HYEuK/CvbK1sn16b8rAQfWwxLWvzKn/YuFN96/zWLlF7EmzL8GUgo9XBHlv3lbK7T9COe/kOOhPthhyz+cGEpnrOvCvzBFhLs15u6/c5bqB6H4u79IuuLF5sveP6lzLKY31eu/AQAAAP////8HAAAA/////zEAAAD/////VwEAAP////9hCQAA/////6dBAAD/////kcsBAP/////3kAwA/////8H2VwAAAAAAAAAAAAAAAAACAAAA/////w4AAAD/////YgAAAP////+uAgAA/////8ISAAD/////ToMAAP////8ilwMA/////+4hGQD/////gu2vAAAAAAAAAAAAAAAAAAAAAAACAAAA//////////8BAAAAAwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////AgAAAP//////////AQAAAAAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD/////////////////////AQAAAP///////////////wIAAAD///////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP///////////////////////////////wIAAAD///////////////8BAAAA/////////////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAABAAAA//////////8CAAAA//////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAAAQAAAP//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAAAAgAAAAIAAAADAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAACAAAAAQAAAAMAAAACAAAAAgAAAAAAAAAFAAAABwAAAAAAAAACAAAAAgAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAAAAAAIAAAABAAAABAAAAAIAAAACAAAAAAAAAAUAAAAIAAAAAAAAAAIAAAACAAAAAwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAAAAAAAAgAAAAIAAAAAAAAABQAAAAkAAAAAAAAAAgAAAAIAAAADAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAIAAAAAAAAAAwAAAA4AAAACAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAgAAAAMAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAgAAAAAAAAADAAAACgAAAAIAAAAAAAAAAgAAAAMAAAABAAAAAAAAAAIAAAACAAAAAwAAAAcAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAACAAAAAAAAAAMAAAALAAAAAgAAAAAAAAACAAAAAwAAAAIAAAAAAAAAAgAAAAIAAAADAAAACAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAIAAAAAAAAAAwAAAAwAAAACAAAAAAAAAAIAAAADAAAAAwAAAAAAAAACAAAAAgAAAAMAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAACAAAAAgAAAAAAAAADAAAADQAAAAIAAAAAAAAAAgAAAAMAAAAEAAAAAAAAAAIAAAACAAAAAwAAAAoAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAIAAAACAAAAAAAAAAMAAAAGAAAAAgAAAAAAAAACAAAAAwAAAA8AAAAAAAAAAgAAAAIAAAADAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAIAAAAAAAAAAwAAAAcAAAACAAAAAAAAAAIAAAADAAAAEAAAAAAAAAACAAAAAgAAAAMAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAACAAAAAgAAAAAAAAADAAAACAAAAAIAAAAAAAAAAgAAAAMAAAARAAAAAAAAAAIAAAACAAAAAwAAAA0AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAACAAAAAAAAAAMAAAAJAAAAAgAAAAAAAAACAAAAAwAAABIAAAAAAAAAAgAAAAIAAAADAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAgAAAAIAAAAAAAAAAwAAAAUAAAACAAAAAAAAAAIAAAADAAAAEwAAAAAAAAACAAAAAgAAAAMAAAAPAAAAAAAAAAAAAAAAAAAAAAAAABAAAAACAAAAAAAAAAIAAAABAAAAEwAAAAIAAAACAAAAAAAAAAUAAAAKAAAAAAAAAAIAAAACAAAAAwAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAIAAAAAAAAAAgAAAAEAAAAPAAAAAgAAAAIAAAAAAAAABQAAAAsAAAAAAAAAAgAAAAIAAAADAAAAEQAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAgAAAAAAAAACAAAAAQAAABAAAAACAAAAAgAAAAAAAAAFAAAADAAAAAAAAAACAAAAAgAAAAMAAAASAAAAAAAAAAAAAAAAAAAAAAAAABMAAAACAAAAAAAAAAIAAAABAAAAEQAAAAIAAAACAAAAAAAAAAUAAAANAAAAAAAAAAIAAAACAAAAAwAAABMAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAIAAAAAAAAAAgAAAAEAAAASAAAAAgAAAAIAAAAAAAAABQAAAA4AAAAAAAAAAgAAAAIAAAADAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAAAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAEAAAAAAQAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAA6B6FaUp9QQTPXMuL4myJBraiDfBwx9UBYJseitzTIQOL5if9jqZtAnXX+Z+ycb0C3pucbhRBCQG8wJBYqpRRAlWbDCzCY5z/eFWBUEve6P/+qo4Q50Y4/D9YM3iCcYT8fcA2QJSA0P4ADxu0qAAc/BNcGolVJ2j5d9FACqwquPh9z7MthtI9CSUSYJke/YUJQ/64OyjU0Qpi0+HCmFQdCm3GfIVdh2kHsJ11kAyauQYC3UDFJOoFBSJsFV1OwU0FK5fcxX4AmQWhy/zZIt/lACqaCPsBjzUDbdUNIScugQMYQlVJ4MXNANiuq8GTvRUDxTXnulxEZQFZ8QX5kpuw/qmG/JwYFlEAluh3Q6DB+QKn4vyNq0GZAKOXekas+UUB8xabXXhI6QG63C2pLtSNAdDBtyNfLDUDyOcu67ID2P0rCMvRXAeE/Ki2TSVyzyT9Dk+8Sz2uzP5J+w5ARWp0/NQAoOiMuhj9YnP+RyMJwPxgW7TvQVFk/KgsLYF0kQz9g5dAC6IwzQcgHPVvDex1B1XjppodHBkHJq3OMM9fwQNvcmJ7wddlAInGPpQs/w0BRobq5EBmtQJZ2ai7n+ZVAtv2G5E+bgECG+gIfKBlpQK5f8jdI91JAL39sL/WpPEB8rGxhDqklQK6yUf43XhBAxL9y/tK8+D86XyZpgrHiPwAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAP////8AAAAAAAAAAAAAAAABAAAAAAAAAAAAAAD/////AAAAAAAAAAABAAAAAQAAAAAAAAAAAAAA/////wAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8FAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQAAAAAAAQABAAABAQAAAAAAAQAAAAEAAAABAAEAAAAAAAAAAAAAAAAAAAAAquJYWJZl+D9jaeZNtj/zPwwdI9KqaeO/qGefXwdHdz+q4lhYlmX4P+OrlPMN3PI/DB0j0qpp47+7SQLV4VIEQKriWFiWZfg/r2kma3tz8T82eQmLqNIGwMRIWXMqSvo/fcCszPux9j+jara6ozTwP6hnn18HR3c/MSoKLequ8r+SabgA2nj0P7jBLbDOHO8/1Ym/ICfH4T+6lxjvlFXHv73m373LRPU/0vXyDVxo7T+ToKRHJXMAQF/33578aPE/pAyy64tD9T8+U/hCvyruPwxv8Y7YYwLAuXYr8NAiCEB4+LDK0Sn0P1Qeuy4j+eo/OMx50n7K7L+TrGB/nyf8v5ehC2fbYPM/aXMKexiT6z8mFRIMjg/zP7yUVwGGBNw/E6opHERf8z/z0wR2g9DqPw4pBpcOhvu/NbA29uWAA8DMaTExyXzyP02biiQ+Ruk/S8jz2/FKBEB1pzZnpbb9P7pQU4wLfPI//7ZcQXeG6D9CqEQvAYoIwDB2VB6sSgRAVyv8H5We8T+EHWF8XNPmPzB2wT8Nrrg/SEi+cX+w4L8of+GtdSDxP1sjk5AdouU/6ZjOVru13r8K0obqI6bxvwVbdNXyhfA/w5GG024n5z+rwmtMzP8BwLw9pSX49QXABe/2uQxP8D+b6wCzCvXkP7uGT87fK+Q/pz/JWw4coj+qoBf2J0nwP/yE3PUo0+I/vFJeHcaC+D96luSIqvntP/bf8sHUYu8/gZNN41mL4z9bhOqVOF4FwO6lmAh1hQhAbCVxbdhk7z+1C8NdDcfiPwG36x/0OQBAx0WJ76c2+D9nlSHXANfuP2HlfZ3gqOE/EwnVlVPg9r96+oHzEH//v5bXzdT1Auw/DM3GwLsA4D9p/8uoKcr+v+U9x5DQVAPAehjSdghb7D9sc1IetODgP8MVwwB1pu6/azPk6OGe978W8t/TUc3rP+0QMvYfP+A/RsG/QpSE8D+l3uwScxzgPwQaifgujuw/k1Vti1I43z8MAwLnSh0GQH5nYnwwZgJAiGUzWC5s6j8WyyI/BbLgPw4iUapGeQJAB3W+imnp/j9BLWR4ssrpP2t+gG5Pstk/cpBsfm6DCMCOpU9dOZsFQEv8nFypHeo/ehJ6i+6S2D9jqlGEmarLv7STC5TRiOa/bC+x8WZD6D9H3yUkWpDZP8gZvmCMuQLAreY19/eRBsCoPOc8UzzpP6KI/QV+y9g/t/MoboyWzT+Hv5q3Zu3Mvy2xROCT4uY/9gQitMMg1T9abAqhWMDkv1oLTavoUfG/PMUJP9CD5j+fHRX3t6fSPz7W2gk6bvs/WRnuHwqN9D8YFturGCTmP1EZczv0b9I/5t4exabB5D/1ESLh5fTEP9X2z6SYweQ/6lv3I2zT0D9zkRGNUNMAQKoSvc4EIfs/Xggt8wQI5T+mJHHg/w/SP4lhT/9t8vQ/DrZ/DbwH7D+XlhbYZrjkP34LIpFt6c4/lwfp8fLX9L+j96CTTf76v3WdNhEv9uM/d8c3o4lV0D/vFdCHVcsFwAHeDq0F1QhApbYqcZiN5D9KoilqByXLPwX0/diA0vq/0fo0GxnxAMBbaTkvlCzjP/RrFrWXrMs/UYTrky7jA0DB9f4FiZYAQEGAk/3QzeE/r/TeqE8t0D/OqjlsnPbvvz8RKU8JOfW/smSEbK/O4T8MzuyPm3DDP/rFtctq9gZAfb1EVEaSA0Dts5dVInnhP18SFMc79MM/7y34cw6LAMDFrRJsZO0DwC2KLvLSYuA/hx5wcUHewz+49SnK/4ruPyeS0PX9a+E/ZxaaLvvZ3z8WPu5T2QS8Pygo4RIvMqa/BJ0Kqsd0279cKW4ay8jdP3b05bmZ364/10/qtdxk2r+Bcz6CDMvpv54qOw+Amdw/qLV71pW7sT/YKc80nIPUP8OfIaBJ77G/LyTuD1un2z+diYu8efWzP1wU7ACkfwjAZroyPL1yBkAmv3lKJJbbPysKSE4W+p0/dIgqY79TA8ATLTOQ3tsGwJ2zweD/Xdg/XO/jXeFUaL8VW2qLFKfov1cA9Aa6XfK/tIa7YGgI2T+f3hu/sxqPv2nXdPpf3Pc/jkw8Jbda8j+tT/z8tGPVP1yBHpJd35k/KYvYOy1s8j/yz+kCQjPrP9+agH7x59g/PZfJ9aBhpr/rDKzvYBb+PwtkiaGCt/c/vb1mVr+f1T/JIHwHc8Govw7aeF6+9vG/Xv7kD6fp979isYioQYHVP7AIQZuSFrG/3z1AdUTnAUDN3XY9O7f9P0AdQ9ljYNQ/dJANJPTOrb8kLECUiiPlP4yF7UgmStA/9xGmXxCG1T9qZzix4W2zv2SGJRJVrPe/Fh9a2M/B/b8IexzFCoPSP9y1QFD2bLe/Q86cWLJe/b+mOOfYm78BwOTjkPAGE9E/8aPCUKu/ub9pPZyLCiUGwBA7Mev/BQlALOmrlRi+0j+AMJ/dKULBv7iLtL6a6QRAEMDV/yajAUDa62dE3crJP1P70RgBUbq/38hVnR6esT/s1tG10Z/Ov/zLwalHPss/dTS9NKTXx78nMcRzCIEHQAabxDsAmQRA0tyLK3gSyT+Aui7nOhDGv5Gs58z3WgHATN3forJuBMCAui7nOhDGP9Lciyt4Esm/WAJyHQ4c7z8UP5HFIs3iP3U0vTSk18c//MvBqUc+y7+cvv8HLg/Kvy1I/mHsI+K/U/vRGAFRuj/a62dE3crJv8p+WV8KlQjAuQ/nOP43B0CAMJ/dKULBPyzpq5UYvtK/ZoU+VoLh4L9etLlRUfvtv/GjwlCrv7k/5OOQ8AYT0b9DfT9FhufXPwUX8hJp+4u/3LVAUPZstz8IexzFCoPSv9+L609E5fQ/q9Fz7X2J7T9qZzix4W2zP/cRpl8QhtW/vtNilqGX+j8MOy7QJoL0P3SQDST0zq0/QB1D2WNg1L8IIjSvGNkDwGB8Jou2GAfAsAhBm5IWsT9isYioQYHVvyS9D3zb6uy/gnwRa7uM9L/JIHwHc8GoP729Zla/n9W/CsAHJZwmAEDEW6OYT1r6Pz2XyfWgYaY/35qAfvHn2L83Tdy4lS30vxf2/gZ0jPq/XIEekl3fmb+tT/z8tGPVvybPr2zJ1/+/K7mJ0ypVAsCf3hu/sxqPPwCGu2BoCNm/5oITrpZn+r+UDUyDP+n/v1zv413hVGg/nbPB4P9d2L9MlmkxNvgCQMtZlKE85v8/KwpIThb6nb8mv3lKJJbbv8+SZsTvOOc/pQCIIOYw0j+diYu8efWzvy8k7g9bp9u/kxYDa+pKtD9XlYvA8HnVv6i1e9aVu7G/nio7D4CZ3L/WR6rNh5EGwCkgQweBkghAdvTluZnfrr9cKW4ay8jdvxbjhr1f1QVAR5C0MzivAkAWPu5T2QS8v2cWmi772d+/cKj4lzLJCEBx2QJfYrMFQIcecHFB3sO/LYou8tJi4L+jr7lhO38BwIcI0Nb7xgTAXxIUxzv0w7/ts5dVInnhv0T+l8DZLfE/MP3FoFvS5D8MzuyPm3DDv7JkhGyvzuG/tzhzRIRc0b9Ovv3/0z7mv6/03qhPLdC/m4CT/dDN4b9dwjU5VCQBQBBJX1ntCv0/9GsWtZesy79baTkvlCzjv1mjYgEz++S/oW6KnOQW8b9KoilqByXLv6W2KnGYjeS/SmaKz3Vx9z+BZB5yxGHwP3fHN6OJVdC/dZ02ES/2478PuaBjLrXaP4/JU81pPaO/fgsikW3pzr+XlhbYZrjkv4tSn7YDbP0/f2LnFKlF9z+mJHHg/w/Sv14ILfMECOW/mfg4qYhR/b+OP+RQDCACwOpb9yNs09C/1fbPpJjB5L9pN2WOVZ3wv3hHy9nxIve/URlzO/Rv0r8YFturGCTmv1d1/KKR8QPA8gsy9qzSB8CfHRX3t6fSvzzFCT/Qg+a/EYStnrzV9r/2QJqI7Lb9v/YEIrTDINW/LbFE4JPi5r/7kQEs5fEDQHunnf4GeQBAooj9BX7L2L+oPOc8Uzzpv+ydYY2SSAfAL4HK6CRTB0BH3yUkWpDZv2wvsfFmQ+i/Ik0Yzruh6T8fM3LoGoDUP3oSeovukti/S/ycXKkd6r9rEv+7UWcHQCRIQe/GfwNAa36Abk+y2b9BLWR4ssrpv9KT87qa0bM/FTyktw823L8WyyI/BbLgv4hlM1gubOq/DizMp9Ki6r8b5ckdjVrzv5NVbYtSON+/BBqJ+C6O7L/dUBFqgyXYv00Wh18r7+q/7RAy9h8/4L8W8t/TUc3rv4RM5DKx3wDAfvWIj94aBcBsc1IetODgv3oY0nYIW+y/oGcTFF54AUDkJqS/FKX6PwzNxsC7AOC/ltfN1PUC7L+5Wrz/zHnzP6688w2rNOc/YeV9neCo4b9nlSHXANfuvw9RsxKjY/s/1V8GteXE8j+1C8NdDcfiv2wlcW3YZO+/IOywaA7Q8b9bFP+4Tg36v4GTTeNZi+O/9t/ywdRi77+tRc3yFR7eP2bkcHXJkLO//ITc9SjT4r+qoBf2J0nwv2YHKoswwfm/iQcLspCjAcCb6wCzCvXkvwXv9rkMT/C/YkuwYAMXBMApCNUai9kIwMORhtNuJ+e/BVt01fKF8L+ZqWEfvIjsP6h693QZYNk/WyOTkB2i5b8of+GtdSDxvwpaaulDSwVADMQAX+lOAECEHWF8XNPmv1cr/B+VnvG/XyFG6opcCMD/mtR32/UEQP+2XEF3hui/ulBTjAt88r/imfCfRP+yP9zbvtc8XeO/TZuKJD5G6b/MaTExyXzyvxiTQeElXOO/rbJRQVGN9L/z0wR2g9DqvxOqKRxEX/O/FDGCEei99j9x8zV4VYTmP2lzCnsYk+u/l6ELZ9tg878pRXacaDT/v3k6GZRqoQXAVB67LiP56r94+LDK0Sn0vwO6pZ9b7wFAvK0nKVcc9j8+U/hCvyruv6QMsuuLQ/W/FPhKFYv46j8MyxaDTOW/v9L18g1caO2/vebfvctE9b/7GD8ZrF3xv3gx1AR9bQDAuMEtsM4c77+SabgA2nj0v5xKFIwxsATArKNSBaKsB0Cjara6ozTwv33ArMz7sfa/dF2U0FcWCcDxL357DJX/P69pJmt7c/G/quJYWJZl+L/YntVJlnrSP4sRLzXM+fe/46uU8w3c8r+q4lhYlmX4v85lu5+QRwRAsI0H/WU8479jaeZNtj/zv6riWFiWZfi/sI0H/WU847/OZbufkEcEQHAoPUBrnss/9exKzDtFtT88wM8kax+gP9OqeKeAYog/MW0ItiZvcj+ph+smvt5bP2lCaV5dEUU/StaUmQDaLz+kK9y22BMYP0O3whZuMwI/IIbgZGWE6z7UkjYaEM3UPuezxwa9cr8+LybxRMnFpz6E1N8DbPiRPsYjySMvK3s+//////8fAAj//////zMQCP////9/MiAI/////28yMAj/////YzJACP///z9iMlAI////N2IyYAj///8zYjJwCP//vzNiMoAI//+rM2IykAj/f6szYjKgCP8PqzNiMrAI/wOrM2IywAi/A6szYjLQCJ8DqzNiMuAImQOrM2Iy8Aj//////z8PCP//////Kx8I/////38pLwj/////Pyk/CP////85KU8I////PzgpXwj///8POClvCP///w44KX8I//8fDjgpjwj//w8OOCmfCP9/DQ44Ka8I/w8NDjgpvwj/DQ0OOCnPCP8MDQ44Kd8IxwwNDjgp7wjEDA0OOCn/CAcAAAAHAAAAAQAAAAIAAAAEAAAAAwAAAAAAAAAAAAAABwAAAAMAAAABAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAGAAAAAgAAAAMAAAAFAAAABAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAwAAAAEAAAAFAAAABAAAAAAAAAAAAAAABwAAAAUAAAADAAAABAAAAAEAAAAAAAAAAgAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8YLURU+yEJQBgtRFT7IQnAYWxnb3MuYwBoM05laWdoYm9yUm90YXRpb25zAGNvb3JkaWprLmMAX3VwQXA3Q2hlY2tlZABfdXBBcDdyQ2hlY2tlZABkaXJlY3RlZEVkZ2UuYwBkaXJlY3RlZEVkZ2VUb0JvdW5kYXJ5AGFkamFjZW50RmFjZURpclt0bXBGaWprLmZhY2VdW2ZpamsuZmFjZV0gPT0gS0kAZmFjZWlqay5jAF9mYWNlSWprUGVudFRvQ2VsbEJvdW5kYXJ5AGFkamFjZW50RmFjZURpcltjZW50ZXJJSksuZmFjZV1bZmFjZTJdID09IEtJAF9mYWNlSWprVG9DZWxsQm91bmRhcnkAaDNJbmRleC5jAGNvbXBhY3RDZWxscwBsYXRMbmdUb0NlbGwAY2VsbFRvQ2hpbGRQb3MAdmFsaWRhdGVDaGlsZFBvcwBsYXRMbmcuYwBjZWxsQXJlYVJhZHMyAHBvbHlnb24tPm5leHQgPT0gTlVMTABsaW5rZWRHZW8uYwBhZGROZXdMaW5rZWRQb2x5Z29uAG5leHQgIT0gTlVMTABsb29wICE9IE5VTEwAYWRkTmV3TGlua2VkTG9vcABwb2x5Z29uLT5maXJzdCA9PSBOVUxMAGFkZExpbmtlZExvb3AAY29vcmQgIT0gTlVMTABhZGRMaW5rZWRDb29yZABsb29wLT5maXJzdCA9PSBOVUxMAGlubmVyTG9vcHMgIT0gTlVMTABub3JtYWxpemVNdWx0aVBvbHlnb24AYmJveGVzICE9IE5VTEwAY2FuZGlkYXRlcyAhPSBOVUxMAGZpbmRQb2x5Z29uRm9ySG9sZQBjYW5kaWRhdGVCQm94ZXMgIT0gTlVMTAByZXZEaXIgIT0gSU5WQUxJRF9ESUdJVABsb2NhbGlqLmMAY2VsbFRvTG9jYWxJamsAYmFzZUNlbGwgIT0gb3JpZ2luQmFzZUNlbGwAIShvcmlnaW5PblBlbnQgJiYgaW5kZXhPblBlbnQpAGJhc2VDZWxsID09IG9yaWdpbkJhc2VDZWxsAGJhc2VDZWxsICE9IElOVkFMSURfQkFTRV9DRUxMAGxvY2FsSWprVG9DZWxsACFfaXNCYXNlQ2VsbFBlbnRhZ29uKGJhc2VDZWxsKQBiYXNlQ2VsbFJvdGF0aW9ucyA+PSAwAGdyaWRQYXRoQ2VsbHMAcG9seWZpbGwuYwBpdGVyU3RlcFBvbHlnb25Db21wYWN0ADAAdmVydGV4LmMAdmVydGV4Um90YXRpb25zAGNlbGxUb1ZlcnRleABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl";var G="function"==typeof atob?atob:function(A){var e,t,r,n,o,i,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="",l=0;A=A.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e=a.indexOf(A.charAt(l++))<<2|(n=a.indexOf(A.charAt(l++)))>>4,t=(15&n)<<4|(o=a.indexOf(A.charAt(l++)))>>2,r=(3&o)<<6|(i=a.indexOf(A.charAt(l++))),s+=String.fromCharCode(e),64!==o&&(s+=String.fromCharCode(t)),64!==i&&(s+=String.fromCharCode(r))}while(l=0){if((0|t)>13780509){if(0|(a=0|le(15,s)))break;s=0|n[(l=s)>>2],l=0|n[l+4>>2]}else c=0|qe(0|t,0|(a=((0|t)<0)<<31>>31),3,0),l=0|B(),a=0|Ve(0|t,0|a,1,0),a=0|Ve(0|(a=0|qe(0|c,0|l,0|a,0|B())),0|B(),1,0),l=0|B(),n[s>>2]=a,n[s+4>>2]=l,s=a;if(lt(0|r,0,s<<3),0|o){lt(0|o,0,s<<2),a=0|L(A,e,t,r,o,s,l,0);break}(a=0|We(s,4))?(c=0|L(A,e,t,r,a,s,l,0),Ye(a),a=c):a=13}else a=2}while(0);return S=i,0|a}function T(A,e,t,r,o){A|=0,e|=0,t|=0,r|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0;if(a=S,S=S+16|0,m=a+8|0,n[(h=i=a)>>2]=A,n[h+4>>2]=e,(0|t)<0)return S=a,2;if(n[(s=r)>>2]=A,n[s+4>>2]=e,(s=!!(0|o))&&(n[o>>2]=0),0|zA(A,e))return S=a,9;n[m>>2]=0;A:do{if((0|t)>=1)if(s)for(f=1,d=0,g=0,h=1,s=A;;){if(!(d|g)){if(0|(s=0|R(s,e,4,m,i)))break A;if(0|zA(s=0|n[(e=i)>>2],e=0|n[e+4>>2])){s=9;break A}}if(0|(s=0|R(s,e,0|n[26800+(g<<2)>>2],m,i)))break A;if(s=0|n[(e=i)>>2],e=0|n[e+4>>2],n[(A=r+(f<<3)|0)>>2]=s,n[A+4>>2]=e,n[o+(f<<2)>>2]=h,l=(0|(A=d+1|0))==(0|h),u=6==(0|(c=g+1|0)),0|zA(s,e)){s=9;break A}if((0|(h=h+(u&l&1)|0))>(0|t)){s=0;break}f=f+1|0,d=l?0:A,g=l?u?0:c:g}else for(f=1,d=0,g=0,h=1,s=A;;){if(!(d|g)){if(0|(s=0|R(s,e,4,m,i)))break A;if(0|zA(s=0|n[(e=i)>>2],e=0|n[e+4>>2])){s=9;break A}}if(0|(s=0|R(s,e,0|n[26800+(g<<2)>>2],m,i)))break A;if(s=0|n[(e=i)>>2],e=0|n[e+4>>2],n[(A=r+(f<<3)|0)>>2]=s,n[A+4>>2]=e,l=(0|(A=d+1|0))==(0|h),u=6==(0|(c=g+1|0)),0|zA(s,e)){s=9;break A}if((0|(h=h+(u&l&1)|0))>(0|t)){s=0;break}f=f+1|0,d=l?0:A,g=l?u?0:c:g}else s=0}while(0);return S=a,0|s}function L(A,e,t,r,o,i,a,s){t|=0,r|=0,o|=0,s|=0;var l,c,u,d=0,f=0,g=0,h=0,m=0,b=0,p=0;if(u=S,S=S+16|0,l=u+8|0,c=u,d=0|At(0|(A|=0),0|(e|=0),0|(i|=0),0|(a|=0)),g=0|B(),!(!(0|(p=0|n[(b=h=r+(d<<3)|0)>>2]))&!(0|(b=0|n[b+4>>2]))|(f=(0|p)==(0|A)&(0|b)==(0|e))))do{d=0|$e(0|(d=0|Ve(0|d,0|g,1,0)),0|B(),0|i,0|a),g=0|B(),f=(0|(b=0|n[(p=h=r+(d<<3)|0)>>2]))==(0|A)&(0|(p=0|n[p+4>>2]))==(0|e)}while(!(!(0|b)&!(0|p)|f));if(d=o+(d<<2)|0,f&&(0|n[d>>2])<=(0|s))return S=u,0;if(n[(p=h)>>2]=A,n[p+4>>2]=e,n[d>>2]=s,(0|s)>=(0|t))return S=u,0;switch(f=s+1|0,n[l>>2]=0,0|(d=0|R(A,e,2,l,c))){case 9:m=9;break;case 0:(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f))||(m=9)}A:do{if(9==(0|m)){switch(n[l>>2]=0,0|(d=0|R(A,e,3,l,c))){case 9:break;case 0:if(0|(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,1,l,c))){case 9:break;case 0:if(0|(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,5,l,c))){case 9:break;case 0:if(0|(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,4,l,c))){case 9:break;case 0:if(0|(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}switch(n[l>>2]=0,0|(d=0|R(A,e,6,l,c))){case 9:break;case 0:if(0|(d=0|L(0|n[(d=c)>>2],0|n[d+4>>2],t,r,o,i,a,f)))break A;break;default:break A}return S=u,0}}while(0);return S=u,0|d}function R(A,e,t,r,o){A|=0,e|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,d=0,f=0,g=0;if((t|=0)>>>0>6)return 1;if(d=(0|n[(r|=0)>>2])%6|0,n[r>>2]=d,(0|d)>0){s=0;do{t=0|vA(t),s=s+1|0}while((0|s)<(0|n[r>>2]))}if(d=0|tt(0|A,0|e,45),B(),(a=127&d)>>>0>121)return 5;i=0|OA(A,e),s=0|tt(0|A,0|e,52),B(),s&=15;A:do{if(s){for(;;){if(c=0|tt(0|A,0|e,0|(l=3*(15-s|0)|0)),B(),7==(0|(c&=7))){e=5;break}if(g=!(0|ZA(s)),s=s+-1|0,f=0|rt(7,0,0|l),e&=~B(),A=0|rt(0|n[(g?432:16)+(28*c|0)+(t<<2)>>2],0,0|l)|A&~f,e|=l=0|B(),!(t=0|n[(g?640:224)+(28*c|0)+(t<<2)>>2])){t=0;break A}if(!s){u=8;break A}}return 0|e}u=8}while(0);8==(0|u)&&(A|=0|rt(0|(g=0|n[848+(28*a|0)+(t<<2)>>2]),0,45),e=B()|-1040385&e,t=0|n[4272+(28*a|0)+(t<<2)>>2],127&~g||(g=0|rt(0|n[848+(28*a|0)+20>>2],0,45),e=B()|-1040385&e,t=0|n[4272+(28*a|0)+20>>2],A=0|YA(g|A,e),e=0|B(),n[r>>2]=1+(0|n[r>>2]))),c=0|tt(0|A,0|e,45),B(),c&=127;A:do{if(0|H(c)){e:do{if(1==(0|OA(A,e))){if((0|a)!=(0|c)){if(0|Y(c,0|n[7696+(28*a|0)>>2])){A=0|VA(A,e),l=1,e=0|B();break}M(27795,26864,533,26872)}switch(0|i){case 3:A=0|YA(A,e),e=0|B(),n[r>>2]=1+(0|n[r>>2]),l=0;break e;case 5:A=0|VA(A,e),e=0|B(),n[r>>2]=5+(0|n[r>>2]),l=0;break e;case 0:return 9;default:return 1}}else l=0}while(0);if((0|t)>0){s=0;do{A=0|UA(A,e),e=0|B(),s=s+1|0}while((0|s)!=(0|t))}if((0|a)!=(0|c)){if(!(0|G(c))){if(!!(0|l)|5!=(0|OA(A,e)))break;n[r>>2]=1+(0|n[r>>2]);break}switch(127&d){case 8:case 118:break A}3!=(0|OA(A,e))&&(n[r>>2]=1+(0|n[r>>2]))}}else if((0|t)>0){s=0;do{A=0|YA(A,e),e=0|B(),s=s+1|0}while((0|s)!=(0|t))}}while(0);return n[r>>2]=((0|n[r>>2])+t|0)%6|0,n[(g=o)>>2]=A,n[g+4>>2]=e,0}function I(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var o,i,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0;if(i=S,S=S+16|0,h=i+8|0,n[(g=o=i)>>2]=A,n[g+4>>2]=e,(0|t)<0)return S=i,2;if(!t)return n[(h=r)>>2]=A,n[h+4>>2]=e,S=i,0;n[h>>2]=0;A:do{if(0|zA(A,e))A=9;else{a=0,g=A;do{if(0|(A=0|R(g,e,4,h,o)))break A;if(a=a+1|0,0|zA(g=0|n[(e=o)>>2],e=0|n[e+4>>2])){A=9;break A}}while((0|a)<(0|t));n[(f=r)>>2]=g,n[f+4>>2]=e,f=t+-1|0,d=0,A=1;do{if(a=26800+(d<<2)|0,5==(0|d))for(l=0|n[a>>2],s=0,a=A;;){if(0|(A=0|R(0|n[(A=o)>>2],0|n[A+4>>2],l,h,o)))break A;if((0|s)!=(0|f)){if(c=0|n[(u=o)>>2],u=0|n[u+4>>2],n[(A=r+(a<<3)|0)>>2]=c,n[A+4>>2]=u,0|zA(c,u)){A=9;break A}A=a+1|0}else A=a;if((0|(s=s+1|0))>=(0|t))break;a=A}else for(l=o,u=0|n[a>>2],c=0,a=A,s=0|n[l>>2],l=0|n[l+4>>2];;){if(0|(A=0|R(s,l,u,h,o)))break A;if(s=0|n[(l=o)>>2],l=0|n[l+4>>2],n[(A=r+(a<<3)|0)>>2]=s,n[A+4>>2]=l,A=a+1|0,0|zA(s,l)){A=9;break A}if((0|(c=c+1|0))>=(0|t))break;a=A}d=d+1|0}while(d>>>0<6);A=(0|g)==(0|n[(A=o)>>2])&&(0|e)==(0|n[A+4>>2])?0:9}}while(0);return S=i,0|A}function _(A,e,t,r){t|=0,r|=0;var o,i,a,s=0,l=0;for(a=S,S=S+16|0,o=a,i=a+8|0,s=(s=!(0|zA(A|=0,e|=0)))?1:2;;){if(n[i>>2]=0,!(0|R(A,e,s,i,o))&((0|n[(l=o)>>2])==(0|t)?(0|n[l+4>>2])==(0|r):0)){A=4;break}if((s=s+1|0)>>>0>=7){s=7,A=4;break}}return 4==(0|A)?(S=a,0|s):0}function z(A,e,t,r,i,a,s){e|=0,t|=0,r|=0,i|=0,a|=0,s|=0;var l,c,u,d,f,g,h,m,b,p,v=0,y=0,w=0,x=0,k=0,C=0,M=0,D=0,E=0,j=0,Q=0,N=0,F=0,P=0,T=0,L=0,R=0,I=0,_=0;if(p=S,S=S+64|0,h=p+48|0,m=p+32|0,b=p+24|0,l=p+8|0,c=p,(0|(y=0|n[(A|=0)>>2]))<=0)return S=p,0;for(u=A+4|0,d=h+8|0,f=m+8|0,g=l+8|0,v=0,F=0;;){N=(w=0|n[u>>2])+(F<<4)|0,n[h>>2]=n[N>>2],n[h+4>>2]=n[N+4>>2],n[h+8>>2]=n[N+8>>2],n[h+12>>2]=n[N+12>>2],(0|F)==(y+-1|0)?(n[m>>2]=n[w>>2],n[m+4>>2]=n[w+4>>2],n[m+8>>2]=n[w+8>>2],n[m+12>>2]=n[w+12>>2]):(N=w+(F+1<<4)|0,n[m>>2]=n[N>>2],n[m+4>>2]=n[N+4>>2],n[m+8>>2]=n[N+8>>2],n[m+12>>2]=n[N+12>>2]),y=0|tA(h,m,r,b);A:do{if(y)w=0,v=y;else if(w=0|n[(y=b)>>2],(0|(y=0|n[y+4>>2]))>0|!(0|y)&w>>>0>0){Q=0,N=0;e:for(;;){if(R=1/(+(w>>>0)+4294967296*+(0|y)),_=+o[h>>3],I=+((y=0|Ze(0|w,0|y,0|Q,0|N))>>>0)+4294967296*+(0|B()),L=+(Q>>>0)+4294967296*+(0|N),o[l>>3]=R*(_*I)+R*(+o[m>>3]*L),o[g>>3]=R*(+o[d>>3]*I)+R*(+o[f>>3]*L),0|(y=0|KA(l,r,c))){v=y;break}C=0|At(0|(E=0|n[(j=c)>>2]),0|(j=0|n[j+4>>2]),0|e,0|t),x=0|B(),w=0|n[(k=y=s+(C<<3)|0)>>2],k=0|n[k+4>>2];t:do{if(!(0|w)&!(0|k))P=y,T=16;else for(M=0,D=0;;){if((0|M)>(0|t)|(0|M)==(0|t)&D>>>0>e>>>0){v=1;break e}if((0|w)==(0|E)&(0|k)==(0|j))break t;if(C=0|$e(0|(y=0|Ve(0|C,0|x,1,0)),0|B(),0|e,0|t),x=0|B(),D=0|Ve(0|D,0|M,1,0),M=0|B(),!(0|(w=0|n[(k=y=s+(C<<3)|0)>>2]))&!(0|(k=0|n[k+4>>2]))){P=y,T=16;break}}}while(0);if(16!=(0|T)||(T=0,!(0|E)&!(0|j))||(n[(D=P)>>2]=E,n[D+4>>2]=j,D=a+(n[i>>2]<<3)|0,n[D>>2]=E,n[D+4>>2]=j,D=0|Ve(0|n[(D=i)>>2],0|n[D+4>>2],1,0),E=0|B(),n[(j=i)>>2]=D,n[j+4>>2]=E),Q=0|Ve(0|Q,0|N,1,0),N=0|B(),w=0|n[(y=b)>>2],!((0|(y=0|n[y+4>>2]))>(0|N)|(0|y)==(0|N)&w>>>0>Q>>>0)){w=1;break A}}w=0}else w=1}while(0);if(F=F+1|0,!w){T=21;break}if((0|F)>=(0|(y=0|n[A>>2]))){v=0,T=21;break}}return 21==(0|T)?(S=p,0|v):0}function H(A){return(A|=0)>>>0>121?0|(A=0):0|(A=0|n[7696+(28*A|0)+16>>2])}function G(A){return 4==(0|(A|=0))|117==(0|A)|0}function O(A){return 0|n[11120+(216*(0|n[(A|=0)>>2])|0)+(72*(0|n[A+4>>2])|0)+(24*(0|n[A+8>>2])|0)+(n[A+12>>2]<<3)>>2]}function U(A){return 0|n[11120+(216*(0|n[(A|=0)>>2])|0)+(72*(0|n[A+4>>2])|0)+(24*(0|n[A+8>>2])|0)+(n[A+12>>2]<<3)+4>>2]}function Y(A,e){return e|=0,(0|n[7696+(28*(A|=0)|0)+20>>2])==(0|e)?0|(e=1):0|(e=(0|n[7696+(28*A|0)+24>>2])==(0|e))}function W(A,e){return 0|n[848+(28*(A|=0)|0)+((e|=0)<<2)>>2]}function V(A,e){return e|=0,(0|n[848+(28*(A|=0)|0)>>2])==(0|e)?0|(e=0):(0|n[848+(28*A|0)+4>>2])==(0|e)?0|(e=1):(0|n[848+(28*A|0)+8>>2])==(0|e)?0|(e=2):(0|n[848+(28*A|0)+12>>2])==(0|e)?0|(e=3):(0|n[848+(28*A|0)+16>>2])==(0|e)?0|(e=4):(0|n[848+(28*A|0)+20>>2])==(0|e)?0|(e=5):0|((0|n[848+(28*A|0)+24>>2])==(0|e)?6:7)}function Z(A){var e,t,r;return e=(r=+o[16+(A|=0)>>3])-(t=+o[A+24>>3]),+(r>3]<+o[A+24>>3]|0}function J(A){return+(+o[(A|=0)>>3]-+o[A+8>>3])}function X(A,e){A|=0;var t,r,n=0;return(n=+o[(e|=0)>>3])>=+o[A+8>>3]&&n<=+o[A>>3]?(t=+o[A+16>>3],n=+o[A+24>>3],e=(r=+o[e+8>>3])>=n,A=r<=t&1,t>3]<+o[e+8>>3]||+o[A+8>>3]>+o[e>>3]?0|(s=0):(n=(l=+o[A+16>>3])<(u=+o[(t=A+24|0)>>3]),c=(a=+o[(s=e+16|0)>>3])<(i=+o[(r=e+24|0)>>3]),e=u-a>3],e)||(u=+ie(+o[t>>3],A))>+ie(+o[s>>3],e)?0|(c=0):0|(c=1))}function $(A,e){e|=0;var t,r,n,i,a,s=0,l=0,c=0,u=0;return+o[(A|=0)>>3]<+o[e>>3]||+o[A+8>>3]>+o[e+8>>3]?0|(s=0):(n=(i=+o[(s=A+16|0)>>3])<(l=+o[A+24>>3]),c=(u=+o[(t=e+16|0)>>3])<(a=+o[(r=e+24|0)>>3]),e=l-u>3],e)?0|(c=(u=+ie(+o[s>>3],A))>=+ie(+o[t>>3],e)):0|(c=0))}function AA(A,e){A|=0,e|=0;var t,r,i,a,s,l=0;i=S,S=S+176|0,n[(r=i)>>2]=4,l=+o[e>>3],o[r+8>>3]=l,a=+o[e+16>>3],o[r+16>>3]=a,o[r+24>>3]=l,l=+o[e+24>>3],o[r+32>>3]=l,s=+o[e+8>>3],o[r+40>>3]=s,o[r+48>>3]=l,o[r+56>>3]=s,o[r+64>>3]=a,t=96+(e=r+72|0)|0;do{n[e>>2]=0,e=e+4|0}while((0|e)<(0|t));st(0|A,0|r,168),S=i}function eA(A,e,t){A|=0,e|=0,t|=0;var r,a,c,u,d,f,g,h=0,m=0,b=0,p=0,y=0,x=0,k=0;f=S,S=S+288|0,d=f+264|0,p=f+96|0,m=(h=b=f)+96|0;do{n[h>>2]=0,h=h+4|0}while((0|h)<(0|m));return 0|(e=0|Ae(e,b))?(S=f,0|(x=e)):(qA(b=0|n[(m=b)>>2],m=0|n[m+4>>2],d),$A(b,m,p),u=+ae(d,p+8|0),o[d>>3]=+o[A>>3],o[(m=d+8|0)>>3]=+o[A+16>>3],o[p>>3]=+o[A+8>>3],o[(b=p+8|0)>>3]=+o[A+24>>3],a=+ae(d,p),k=+o[m>>3]-+o[b>>3],c=+l(+k),g=+o[d>>3]-+o[p>>3],r=+l(+g),!(0==k|0==g)&&(k=+ot(+c,+r),k=+v(+a*a/+it(+k/+it(+c,+r),3)/(u*(2.59807621135*u)*.8)),o[i>>3]=k,y=~~k>>>0,x=+l(k)>=1?k>0?~~+w(+s(k/4294967296),4294967295)>>>0:~~+v((k-+(~~k>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2])?(p=!(0|y)&!(0|x),n[(e=t)>>2]=p?1:y,n[e+4>>2]=p?0:x,e=0):e=1,S=f,0|(x=e))}function tA(A,e,t,r){A|=0,e|=0,t|=0,r|=0;var a,c,u,d,f=0,g=0,h=0;d=S,S=S+288|0,c=d+264|0,u=d+96|0,a=(f=g=d)+96|0;do{n[f>>2]=0,f=f+4|0}while((0|f)<(0|a));return 0|(t=0|Ae(t,g))?(S=d,0|(r=t)):(qA(f=0|n[(t=g)>>2],t=0|n[t+4>>2],c),$A(f,t,u),h=+ae(c,u+8|0),h=+v(+ +ae(A,e)/(2*h)),o[i>>3]=h,t=~~h>>>0,f=+l(h)>=1?h>0?~~+w(+s(h/4294967296),4294967295)>>>0:~~+v((h-+(~~h>>>0))/4294967296)>>>0:0,2146435072&~n[i+4>>2]?(g=!(0|t)&!(0|f),n[r>>2]=g?1:t,n[r+4>>2]=g?0:f,S=d,0|(r=0)):(S=d,0|(r=1)))}function rA(A,e,t,r){e|=0,t|=0,r|=0,n[(A|=0)>>2]=e,n[A+4>>2]=t,n[A+8>>2]=r}function nA(A){var e,t=0,r=0,o=0,i=0,a=0;t=0|n[(A|=0)>>2],r=0|n[(e=A+4|0)>>2],(0|t)<0&&(r=r-t|0,n[e>>2]=r,n[(a=A+8|0)>>2]=(0|n[a>>2])-t,n[A>>2]=0,t=0),(0|r)<0?(t=t-r|0,n[A>>2]=t,i=(0|n[(a=A+8|0)>>2])-r|0,n[a>>2]=i,n[e>>2]=0,r=0):(a=i=A+8|0,i=0|n[i>>2]),(0|i)<0&&(t=t-i|0,n[A>>2]=t,r=r-i|0,n[e>>2]=r,n[a>>2]=0,i=0),(0|(o=(0|i)<(0|(o=(0|r)<(0|t)?r:t))?i:o))<=0||(n[A>>2]=t-o,n[e>>2]=r-o,n[a>>2]=i-o)}function oA(A,e){var t,r;e|=0,r=0|n[8+(A|=0)>>2],t=+((0|n[A+4>>2])-r|0),o[e>>3]=+((0|n[A>>2])-r|0)-.5*t,o[e+8>>3]=.8660254037844386*t}function iA(A,e,t){A|=0,e|=0,n[(t|=0)>>2]=(0|n[e>>2])+(0|n[A>>2]),n[t+4>>2]=(0|n[e+4>>2])+(0|n[A+4>>2]),n[t+8>>2]=(0|n[e+8>>2])+(0|n[A+8>>2])}function aA(A,e,t){A|=0,e|=0,n[(t|=0)>>2]=(0|n[A>>2])-(0|n[e>>2]),n[t+4>>2]=(0|n[A+4>>2])-(0|n[e+4>>2]),n[t+8>>2]=(0|n[A+8>>2])-(0|n[e+8>>2])}function sA(A,e){e|=0;var t,r=0;r=0|y(0|n[(A|=0)>>2],e),n[A>>2]=r,t=0|y(0|n[(r=A+4|0)>>2],e),n[r>>2]=t,e=0|y(0|n[(A=A+8|0)>>2],e),n[A>>2]=e}function lA(A){var e,t,r=0,o=0,i=0,a=0,s=0;s=(0|(t=0|n[(A|=0)>>2]))<0,A=(A=(o=(0|(a=((e=(0|(i=(0|n[A+4>>2])-(s?t:0)|0))<0)?0-i|0:0)+((0|n[A+8>>2])-(s?t:0))|0))<0)?0:a)-((i=(0|(o=(0|A)<(0|(o=(0|(r=(e?0:i)-(o?a:0)|0))<(0|(a=(s?0:t)-(e?i:0)-(o?a:0)|0))?r:a))?A:o))>0)?o:0)|0,r=r-(i?o:0)|0;A:do{switch(a-(i?o:0)|0){case 0:switch(0|r){case 0:return 0|(0|A?1==(0|A)?1:7:0);case 1:return 0|(0|A?1==(0|A)?3:7:2);default:break A}case 1:switch(0|r){case 0:return 0|(0|A?1==(0|A)?5:7:4);case 1:if(A)break A;return 6;default:break A}}}while(0);return 7}function cA(A){var e,t,r=0,o=0,i=0,a=0,s=0,l=0,c=0;if(l=0|n[(t=8+(A|=0)|0)>>2],(e=(0|n[A>>2])-l|0)>>>0>715827881|(l=(0|n[(c=A+4|0)>>2])-l|0)>>>0>715827881){if(a=2147483647-e|0,s=-2147483648-e|0,(i=(0|e)>0)?(0|a)<(0|e):(0|s)>(0|e))return 1;if(o=e<<1,i?(2147483647-o|0)<(0|e):(-2147483648-o|0)>(0|e))return 1;if((0|l)>0?(2147483647-l|0)<(0|l):(-2147483648-l|0)>(0|l))return 1;if(r=3*e|0,o=l<<1,(i?(0|a)<(0|o):(0|s)>(0|o))||((0|e)>-1?(-2147483648|r)>=(0|l):(-2147483648^r)<(0|l)))return 1}else o=l<<1,r=3*e|0;return i=0|Oe(.14285714285714285*+(r-l|0)),n[A>>2]=i,a=0|Oe(.14285714285714285*+(o+e|0)),n[c>>2]=a,n[t>>2]=0,r=(o=(0|a)<(0|i))?i:a,(0|(o=o?a:i))<0&&((-2147483648==(0|o)||((0|r)>0?(2147483647-r|0)<(0|o):(-2147483648-r|0)>(0|o)))&&M(27795,26892,354,26903),((0|r)>-1?(-2147483648|r)>=(0|o):(-2147483648^r)<(0|o))&&M(27795,26892,354,26903)),r=a-i|0,(0|i)<0?(o=0-i|0,n[c>>2]=r,n[t>>2]=o,n[A>>2]=0,i=0):(r=a,o=0),(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[t>>2]=o,n[c>>2]=0,r=0),s=i-o|0,a=r-o|0,(0|o)<0?(n[A>>2]=s,n[c>>2]=a,n[t>>2]=0,r=a,a=s,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|r)<(0|a)?r:a))?o:i))<=0||(n[A>>2]=a-i,n[c>>2]=r-i,n[t>>2]=o-i),0}function uA(A){var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0;if(i=0|n[(e=8+(A|=0)|0)>>2],(a=(0|n[A>>2])-i|0)>>>0>715827881|(i=(0|n[(s=A+4|0)>>2])-i|0)>>>0>715827881){if((r=(0|a)>0)?(2147483647-a|0)<(0|a):(-2147483648-a|0)>(0|a))return 1;if(t=a<<1,(o=(0|i)>0)?(2147483647-i|0)<(0|i):(-2147483648-i|0)>(0|i))return 1;if(l=i<<1,o?(2147483647-l|0)<(0|i):(-2147483648-l|0)>(0|i))return 1;if(r?(2147483647-t|0)<(0|i):(-2147483648-t|0)>(0|i))return 1;if(r=3*i|0,(0|i)>-1?(-2147483648|r)>=(0|a):(-2147483648^r)<(0|a))return 1}else r=3*i|0,t=a<<1;return o=0|Oe(.14285714285714285*+(t+i|0)),n[A>>2]=o,i=0|Oe(.14285714285714285*+(r-a|0)),n[s>>2]=i,n[e>>2]=0,t=(r=(0|i)<(0|o))?o:i,(0|(r=r?i:o))<0&&((-2147483648==(0|r)||((0|t)>0?(2147483647-t|0)<(0|r):(-2147483648-t|0)>(0|r)))&&M(27795,26892,402,26917),((0|t)>-1?(-2147483648|t)>=(0|r):(-2147483648^t)<(0|r))&&M(27795,26892,402,26917)),t=i-o|0,(0|o)<0?(r=0-o|0,n[s>>2]=t,n[e>>2]=r,n[A>>2]=0,o=0):(t=i,r=0),(0|t)<0&&(o=o-t|0,n[A>>2]=o,r=r-t|0,n[e>>2]=r,n[s>>2]=0,t=0),a=o-r|0,i=t-r|0,(0|r)<0?(n[A>>2]=a,n[s>>2]=i,n[e>>2]=0,t=i,i=a,r=0):i=o,(0|(o=(0|r)<(0|(o=(0|t)<(0|i)?t:i))?r:o))<=0||(n[A>>2]=i-o,n[s>>2]=t-o,n[e>>2]=r-o),0}function dA(A){var e,t,r=0,o=0,i=0,a=0,s=0;o=0|n[(e=8+(A|=0)|0)>>2],i=0|Oe(.14285714285714285*+((3*(r=(0|n[A>>2])-o|0)|0)-(o=(0|n[(t=A+4|0)>>2])-o|0)|0)),n[A>>2]=i,r=0|Oe(.14285714285714285*+((o<<1)+r|0)),n[t>>2]=r,n[e>>2]=0,o=r-i|0,(0|i)<0?(s=0-i|0,n[t>>2]=o,n[e>>2]=s,n[A>>2]=0,r=o,i=0,o=s):o=0,(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[e>>2]=o,n[t>>2]=0,r=0),s=i-o|0,a=r-o|0,(0|o)<0?(n[A>>2]=s,n[t>>2]=a,n[e>>2]=0,r=a,a=s,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|r)<(0|a)?r:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=r-i,n[e>>2]=o-i)}function fA(A){var e,t,r=0,o=0,i=0,a=0,s=0;o=0|n[(e=8+(A|=0)|0)>>2],i=0|Oe(.14285714285714285*+(((r=(0|n[A>>2])-o|0)<<1)+(o=(0|n[(t=A+4|0)>>2])-o|0)|0)),n[A>>2]=i,r=0|Oe(.14285714285714285*+((3*o|0)-r|0)),n[t>>2]=r,n[e>>2]=0,o=r-i|0,(0|i)<0?(s=0-i|0,n[t>>2]=o,n[e>>2]=s,n[A>>2]=0,r=o,i=0,o=s):o=0,(0|r)<0&&(i=i-r|0,n[A>>2]=i,o=o-r|0,n[e>>2]=o,n[t>>2]=0,r=0),s=i-o|0,a=r-o|0,(0|o)<0?(n[A>>2]=s,n[t>>2]=a,n[e>>2]=0,r=a,a=s,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|r)<(0|a)?r:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=r-i,n[e>>2]=o-i)}function gA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],i=0|n[(t=A+4|0)>>2],a=0|n[(r=A+8|0)>>2],s=i+(3*o|0)|0,n[A>>2]=s,i=a+(3*i|0)|0,n[t>>2]=i,o=(3*a|0)+o|0,n[r>>2]=o,a=i-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=a,n[r>>2]=o,n[A>>2]=0,i=a,a=0):a=s,(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function hA(A){var e,t,r,o=0,i=0,a=0,s=0;s=0|n[(A|=0)>>2],a=(3*(o=0|n[(t=A+4|0)>>2])|0)+s|0,s=(i=0|n[(r=A+8|0)>>2])+(3*s|0)|0,n[A>>2]=s,n[t>>2]=a,o=(3*i|0)+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,s=0):i=a,(0|i)<0&&(s=s-i|0,n[A>>2]=s,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=s-o|0,a=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=a,n[r>>2]=0,s=e,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|a)<(0|s)?a:s))?o:i))<=0||(n[A>>2]=s-i,n[t>>2]=a-i,n[r>>2]=o-i)}function mA(A,e){A|=0;var t,r,o,i=0,a=0,s=0;((e|=0)-1|0)>>>0>=6||(s=(0|n[15440+(12*e|0)>>2])+(0|n[A>>2])|0,n[A>>2]=s,o=A+4|0,a=(0|n[15440+(12*e|0)+4>>2])+(0|n[o>>2])|0,n[o>>2]=a,r=A+8|0,e=(0|n[15440+(12*e|0)+8>>2])+(0|n[r>>2])|0,n[r>>2]=e,i=a-s|0,(0|s)<0?(e=e-s|0,n[o>>2]=i,n[r>>2]=e,n[A>>2]=0,a=0):(i=a,a=s),(0|i)<0&&(a=a-i|0,n[A>>2]=a,e=e-i|0,n[r>>2]=e,n[o>>2]=0,i=0),t=a-e|0,s=i-e|0,(0|e)<0?(n[A>>2]=t,n[o>>2]=s,n[r>>2]=0,a=t,e=0):s=i,(0|(i=(0|e)<(0|(i=(0|s)<(0|a)?s:a))?e:i))<=0||(n[A>>2]=a-i,n[o>>2]=s-i,n[r>>2]=e-i))}function bA(A){var e,t,r,o=0,i=0,a=0,s=0;s=0|n[(A|=0)>>2],a=(o=0|n[(t=A+4|0)>>2])+s|0,s=(i=0|n[(r=A+8|0)>>2])+s|0,n[A>>2]=s,n[t>>2]=a,o=i+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,a=0):(i=a,a=s),(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function pA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],a=0|n[(t=A+4|0)>>2],i=0|n[(r=A+8|0)>>2],s=a+o|0,n[A>>2]=s,a=i+a|0,n[t>>2]=a,o=i+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,a=0):(i=a,a=s),(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function vA(A){switch(0|(A|=0)){case 1:A=5;break;case 5:A=4;break;case 4:A=6;break;case 6:A=2;break;case 2:A=3;break;case 3:A=1}return 0|A}function yA(A){switch(0|(A|=0)){case 1:A=3;break;case 3:A=2;break;case 2:A=6;break;case 6:A=4;break;case 4:A=5;break;case 5:A=1}return 0|A}function wA(A){var e,t,r,o=0,i=0,a=0,s=0;o=0|n[(A|=0)>>2],i=0|n[(t=A+4|0)>>2],a=0|n[(r=A+8|0)>>2],s=i+(o<<1)|0,n[A>>2]=s,i=a+(i<<1)|0,n[t>>2]=i,o=(a<<1)+o|0,n[r>>2]=o,a=i-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=a,n[r>>2]=o,n[A>>2]=0,i=a,a=0):a=s,(0|i)<0&&(a=a-i|0,n[A>>2]=a,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=a-o|0,s=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=s,n[r>>2]=0,a=e,o=0):s=i,(0|(i=(0|o)<(0|(i=(0|s)<(0|a)?s:a))?o:i))<=0||(n[A>>2]=a-i,n[t>>2]=s-i,n[r>>2]=o-i)}function xA(A){var e,t,r,o=0,i=0,a=0,s=0;s=0|n[(A|=0)>>2],a=((o=0|n[(t=A+4|0)>>2])<<1)+s|0,s=(i=0|n[(r=A+8|0)>>2])+(s<<1)|0,n[A>>2]=s,n[t>>2]=a,o=(i<<1)+o|0,n[r>>2]=o,i=a-s|0,(0|s)<0?(o=o-s|0,n[t>>2]=i,n[r>>2]=o,n[A>>2]=0,s=0):i=a,(0|i)<0&&(s=s-i|0,n[A>>2]=s,o=o-i|0,n[r>>2]=o,n[t>>2]=0,i=0),e=s-o|0,a=i-o|0,(0|o)<0?(n[A>>2]=e,n[t>>2]=a,n[r>>2]=0,s=e,o=0):a=i,(0|(i=(0|o)<(0|(i=(0|a)<(0|s)?a:s))?o:i))<=0||(n[A>>2]=s-i,n[t>>2]=a-i,n[r>>2]=o-i)}function kA(A,e){e|=0;var t,r,o,i=0,a=0,s=0;return o=(0|(r=(0|n[(A|=0)>>2])-(0|n[e>>2])|0))<0,t=(0|(a=(0|n[A+4>>2])-(0|n[e+4>>2])-(o?r:0)|0))<0,e=(e=(A=(0|(s=(o?0-r|0:0)+(0|n[A+8>>2])-(0|n[e+8>>2])+(t?0-a|0:0)|0))<0)?0:s)-((a=(0|(A=(0|e)<(0|(A=(0|(i=(t?0:a)-(A?s:0)|0))<(0|(s=(o?0:r)-(t?a:0)-(A?s:0)|0))?i:s))?e:A))>0)?A:0)|0,i=i-(a?A:0)|0,0|((0|(A=(0|(A=s-(a?A:0)|0))>-1?A:0-A|0))>(0|(e=(0|(i=(0|i)>-1?i:0-i|0))>(0|(e=(0|e)>-1?e:0-e|0))?i:e))?A:e)}function CA(A){var e,t,r,o;t=(o=0|n[(e=8+(A|=0)|0)>>2])-(0|n[A>>2])|0,n[A>>2]=t,A=(0|n[(r=A+4|0)>>2])-o|0,n[r>>2]=A,n[e>>2]=0-(A+t)}function BA(A){var e,t,r=0,o=0,i=0,a=0,s=0;r=0-(o=0|n[(A|=0)>>2])|0,n[A>>2]=r,n[(e=A+8|0)>>2]=0,a=(i=0|n[(t=A+4|0)>>2])+o|0,(0|o)>0?(n[t>>2]=a,n[e>>2]=o,n[A>>2]=0,r=0,i=a):o=0,(0|i)<0?(s=r-i|0,n[A>>2]=s,o=o-i|0,n[e>>2]=o,n[t>>2]=0,a=s-o|0,r=0-o|0,(0|o)<0?(n[A>>2]=a,n[t>>2]=r,n[e>>2]=0,i=r,o=0):(i=0,a=s)):a=r,(0|(r=(0|o)<(0|(r=(0|i)<(0|a)?i:a))?o:r))<=0||(n[A>>2]=a-r,n[t>>2]=i-r,n[e>>2]=o-r)}function MA(A,e){var t=0;switch(t=0|tt(0|(A|=0),0|(e|=0),56),B(),7&t){case 0:case 7:return 0}return t=-2130706433&e|134217728,!0&268435456==(2013265920&e)?!0&16777216==(117440512&e)&!!(0|zA(A,t))?0|(t=0):0|(t=0|LA(A,t)):0|(t=0)}function DA(A,e,t){t|=0;var r,o,i=0,a=0;return o=S,S=S+16|0,r=o,a=-2130706433&(e|=0)|134217728,!0&268435456==(2013265920&e)?(i=0|tt(0|(A|=0),0|e,56),B(),i=0|function(A,e,t){t|=0;var r,o=0,i=0;if(r=S,S=S+16|0,i=r,o=0|zA(A|=0,e|=0),(t+-1|0)>>>0>5)return S=r,-1;if(1==(0|t)&(o=!!(0|o)))return S=r,-1;do{if(!(0|Fe(A,e,i))){if(o){o=(5+(0|n[26352+(t<<2)>>2])-(0|n[i>>2])|0)%5|0;break}o=(6+(0|n[26384+(t<<2)>>2])-(0|n[i>>2])|0)%6|0;break}o=-1}while(0);return S=r,0|(i=o)}(A,a,7&i),-1==(0|i)?(n[t>>2]=0,S=o,0|(a=6)):(0|XA(A,a,r)&&M(27795,26932,282,26947),e=0|tt(0|A,0|e,52),B(),e&=15,0|zA(A,a)?jA(r,e,i,2,t):FA(r,e,i,2,t),S=o,0|(a=0))):(S=o,0|(a=6))}function EA(A,e,t,r,i){e|=0,t|=0,r|=0,i|=0;var a,s=0,u=0;if(s=+function(A){var e,t;return t=+o[(A|=0)>>3],e=+o[A+8>>3],+ +c(+(t*t+e*e))}(A|=0),s<1e-16)return e=15600+(e<<4)|0,n[i>>2]=n[e>>2],n[i+4>>2]=n[e+4>>2],n[i+8>>2]=n[e+8>>2],void(n[i+12>>2]=n[e+12>>2]);if(u=+p(+ +o[A+8>>3],+ +o[A>>3]),(0|t)>0){A=0;do{s*=.37796447300922725,A=A+1|0}while((0|A)!=(0|t))}a=.3333333333333333*s,r?(t=!(0|ZA(t)),s=+b(.381966011250105*(t?a:.37796447300922725*a))):(s=+b(.381966011250105*s),0|ZA(t)&&(u=+ne(u+.3334731722518321))),function(A,e,t,r){A|=0,e=+e,r|=0;var i=0,a=0,s=0,c=0;if((t=+t)<1e-16)return n[r>>2]=n[A>>2],n[r+4>>2]=n[A+4>>2],n[r+8>>2]=n[A+8>>2],void(n[r+12>>2]=n[A+12>>2]);a=e<0?e+6.283185307179586:e,a=e>=6.283185307179586?a+-6.283185307179586:a;do{if(!(a<1e-16)){if(i=+l(+(a+-3.141592653589793))<1e-16,e=+o[A>>3],i){e-=t,o[r>>3]=e,i=r;break}if(s=+d(+t),t=+f(+t),e=s*+f(+e)+ +d(+a)*(t*+d(+e)),e=+m(+((e=e>1?1:e)<-1?-1:e)),o[r>>3]=e,+l(+(e+-1.5707963267948966))<1e-16)return o[r>>3]=1.5707963267948966,void(o[r+8>>3]=0);if(+l(+(e+1.5707963267948966))<1e-16)return o[r>>3]=-1.5707963267948966,void(o[r+8>>3]=0);if(c=1/+d(+e),a=t*+f(+a)*c,t=+o[A>>3],e=c*((s-+f(+e)*+f(+t))/+d(+t)),s=a>1?1:a,e=e>1?1:e,(e=+o[A+8>>3]+ +p(+(s<-1?-1:s),+(e<-1?-1:e)))>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);return void(o[r+8>>3]=e)}e=+o[A>>3]+t,o[r>>3]=e,i=r}while(0);if(+l(+(e+-1.5707963267948966))<1e-16)return o[i>>3]=1.5707963267948966,void(o[r+8>>3]=0);if(+l(+(e+1.5707963267948966))<1e-16)return o[i>>3]=-1.5707963267948966,void(o[r+8>>3]=0);if((e=+o[A+8>>3])>3.141592653589793)do{e+=-6.283185307179586}while(e>3.141592653589793);if(e<-3.141592653589793)do{e+=6.283185307179586}while(e<-3.141592653589793);o[r+8>>3]=e}(15600+(e<<4)|0,+ne(+o[15920+(24*e|0)>>3]-u),s,i)}function jA(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,s,l,c,u,d,f,g,h,m,b,p,v,y,w,x,k,C,B,D,E,j,Q=0,N=0,F=0,P=0,T=0,L=0;if(j=S,S=S+272|0,P=j+240|0,B=j,D=j+224|0,E=j+208|0,b=j+176|0,p=j+160|0,v=j+192|0,y=j+144|0,w=j+128|0,x=j+112|0,k=j+96|0,C=j+80|0,n[(Q=j+256|0)>>2]=e,n[P>>2]=n[A>>2],n[P+4>>2]=n[A+4>>2],n[P+8>>2]=n[A+8>>2],n[P+12>>2]=n[A+12>>2],QA(P,Q,B),n[i>>2]=0,(0|(P=r+t+(5==(0|r)&1)|0))<=(0|t))S=j;else{s=D+4|0,l=b+4|0,c=t+5|0,u=16880+((a=0|n[Q>>2])<<2)|0,d=16960+(a<<2)|0,f=w+8|0,g=x+8|0,h=k+8|0,m=E+4|0,F=t;A:for(;;){N=B+((0|F)%5<<4)|0,n[E>>2]=n[N>>2],n[E+4>>2]=n[N+4>>2],n[E+8>>2]=n[N+8>>2],n[E+12>>2]=n[N+12>>2];do{}while(2==(0|NA(E,a,0,1)));if((0|F)>(0|t)&!!(0|ZA(e))){if(n[b>>2]=n[E>>2],n[b+4>>2]=n[E+4>>2],n[b+8>>2]=n[E+8>>2],n[b+12>>2]=n[E+12>>2],oA(s,p),r=0|n[b>>2],Q=0|n[17040+(80*r|0)+(n[D>>2]<<2)>>2],n[b>>2]=n[18640+(80*r|0)+(20*Q|0)>>2],(0|(N=0|n[18640+(80*r|0)+(20*Q|0)+16>>2]))>0){A=0;do{bA(l),A=A+1|0}while((0|A)<(0|N))}switch(N=18640+(80*r|0)+(20*Q|0)+4|0,n[v>>2]=n[N>>2],n[v+4>>2]=n[N+4>>2],n[v+8>>2]=n[N+8>>2],sA(v,3*(0|n[u>>2])|0),iA(l,v,l),nA(l),oA(l,y),T=+(0|n[d>>2]),o[w>>3]=3*T,o[f>>3]=0,L=-1.5*T,o[x>>3]=L,o[g>>3]=2.598076211353316*T,o[k>>3]=L,o[h>>3]=-2.598076211353316*T,0|n[17040+(80*(0|n[b>>2])|0)+(n[E>>2]<<2)>>2]){case 1:A=x,r=w;break;case 3:A=k,r=x;break;case 2:A=w,r=k;break;default:A=12;break A}Qe(p,y,r,A,C),EA(C,0|n[b>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])}if((0|F)<(0|c)&&(oA(m,b),EA(b,0|n[E>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])),n[D>>2]=n[E>>2],n[D+4>>2]=n[E+4>>2],n[D+8>>2]=n[E+8>>2],n[D+12>>2]=n[E+12>>2],(0|(F=F+1|0))>=(0|P)){A=3;break}}3!=(0|A)?12==(0|A)&&M(26970,27017,572,27027):S=j}}function QA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=S,S=S+128|0,i=r,s=20240,l=60+(a=o=r+64|0)|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));s=20304,l=(a=i)+60|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));o=(l=!(0|ZA(0|n[e>>2])))?o:i,wA(i=A+4|0),xA(i),0|ZA(0|n[e>>2])&&(hA(i),n[e>>2]=1+(0|n[e>>2])),n[t>>2]=n[A>>2],iA(i,o,e=t+4|0),nA(e),n[t+16>>2]=n[A>>2],iA(i,o+12|0,e=t+20|0),nA(e),n[t+32>>2]=n[A>>2],iA(i,o+24|0,e=t+36|0),nA(e),n[t+48>>2]=n[A>>2],iA(i,o+36|0,e=t+52|0),nA(e),n[t+64>>2]=n[A>>2],iA(i,o+48|0,t=t+68|0),nA(t),S=r}function NA(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c,u=0,d=0,f=0,g=0,h=0;if(c=S,S=S+32|0,l=c+12|0,i=c,h=4+(A|=0)|0,g=0|n[16960+((e|=0)<<2)>>2],g=(s=!!(0|r))?3*g|0:g,u=0|n[h>>2],o=0|n[(a=A+8|0)>>2],s){if((0|(u=o+u+(r=0|n[(d=A+12|0)>>2])|0))==(0|g))return S=c,1;f=d}else u=o+u+(r=0|n[(f=A+12|0)>>2])|0;if((0|u)<=(0|g))return S=c,0;do{if((0|r)>0){if(r=0|n[A>>2],(0|o)>0){d=18640+(80*r|0)+60|0,r=A;break}r=18640+(80*r|0)+40|0,t?(rA(l,g,0,0),aA(h,l,i),pA(i),iA(i,l,h),d=r,r=A):(d=r,r=A)}else d=18640+(80*(0|n[A>>2])|0)+20|0,r=A}while(0);if(n[r>>2]=n[d>>2],(0|n[(u=d+16|0)>>2])>0){r=0;do{bA(h),r=r+1|0}while((0|r)<(0|n[u>>2]))}return A=d+4|0,n[l>>2]=n[A>>2],n[l+4>>2]=n[A+4>>2],n[l+8>>2]=n[A+8>>2],e=0|n[16880+(e<<2)>>2],sA(l,s?3*e|0:e),iA(h,l,h),nA(h),r=s&&((0|n[a>>2])+(0|n[h>>2])+(0|n[f>>2])|0)==(0|g)?1:2,S=c,0|r}function SA(A,e){A|=0,e|=0;var t=0;do{t=0|NA(A,e,0,1)}while(2==(0|t));return 0|t}function FA(A,e,t,r,i){A|=0,e|=0,t|=0,r|=0,i|=0;var a,s,l,c,u,d,f,g,h,m,b,p,v,y,w,x,k,C,B=0,D=0,E=0,j=0,Q=0;if(C=S,S=S+240|0,y=C+208|0,w=C,x=C+192|0,k=C+176|0,h=C+160|0,m=C+144|0,b=C+128|0,p=C+112|0,v=C+96|0,n[(B=C+224|0)>>2]=e,n[y>>2]=n[A>>2],n[y+4>>2]=n[A+4>>2],n[y+8>>2]=n[A+8>>2],n[y+12>>2]=n[A+12>>2],PA(y,B,w),n[i>>2]=0,(0|(g=r+t+(6==(0|r)&1)|0))<=(0|t))S=C;else{s=t+6|0,l=16960+((a=0|n[B>>2])<<2)|0,c=m+8|0,u=b+8|0,d=p+8|0,f=x+4|0,D=0,E=t,r=-1;A:for(;;){if(A=w+((B=(0|E)%6|0)<<4)|0,n[x>>2]=n[A>>2],n[x+4>>2]=n[A+4>>2],n[x+8>>2]=n[A+8>>2],n[x+12>>2]=n[A+12>>2],A=D,D=0|NA(x,a,0,1),(0|E)>(0|t)&!!(0|ZA(e))&&1!=(0|A)&&(0|n[x>>2])!=(0|r)){switch(oA(w+((B+5|0)%6<<4)+4|0,k),oA(w+(B<<4)+4|0,h),j=+(0|n[l>>2]),o[m>>3]=3*j,o[c>>3]=0,Q=-1.5*j,o[b>>3]=Q,o[u>>3]=2.598076211353316*j,o[p>>3]=Q,o[d>>3]=-2.598076211353316*j,B=0|n[y>>2],0|n[17040+(80*B|0)+(((0|r)==(0|B)?n[x>>2]:r)<<2)>>2]){case 1:A=b,r=m;break;case 3:A=p,r=b;break;case 2:A=m,r=p;break;default:A=8;break A}Qe(k,h,r,A,v),0|Ne(k,v)||0|Ne(h,v)||(EA(v,0|n[y>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2]))}if((0|E)<(0|s)&&(oA(f,k),EA(k,0|n[x>>2],a,1,i+8+(n[i>>2]<<4)|0),n[i>>2]=1+(0|n[i>>2])),(0|(E=E+1|0))>=(0|g)){A=3;break}r=0|n[x>>2]}3!=(0|A)?8==(0|A)&&M(27054,27017,737,27099):S=C}}function PA(A,e,t){A|=0,e|=0,t|=0;var r,o=0,i=0,a=0,s=0,l=0;r=S,S=S+160|0,i=r,s=20368,l=72+(a=o=r+80|0)|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));s=20448,l=(a=i)+72|0;do{n[a>>2]=n[s>>2],a=a+4|0,s=s+4|0}while((0|a)<(0|l));o=(l=!(0|ZA(0|n[e>>2])))?o:i,wA(i=A+4|0),xA(i),0|ZA(0|n[e>>2])&&(hA(i),n[e>>2]=1+(0|n[e>>2])),n[t>>2]=n[A>>2],iA(i,o,e=t+4|0),nA(e),n[t+16>>2]=n[A>>2],iA(i,o+12|0,e=t+20|0),nA(e),n[t+32>>2]=n[A>>2],iA(i,o+24|0,e=t+36|0),nA(e),n[t+48>>2]=n[A>>2],iA(i,o+36|0,e=t+52|0),nA(e),n[t+64>>2]=n[A>>2],iA(i,o+48|0,e=t+68|0),nA(e),n[t+80>>2]=n[A>>2],iA(i,o+60|0,t=t+84|0),nA(t),S=r}function TA(A,e){return e=0|tt(0|(A|=0),0|(e|=0),45),B(),127&e}function LA(A,e){A|=0;var t=0,n=0,o=0,i=0;return!0&134217728==(-16777216&(e|=0))?(n=0|tt(0|A,0|e,52),B(),n&=15,t=0|tt(0|A,0|e,45),B(),(t&=127)>>>0>121?0|(A=0):!(613566756&(i=0|rt(0|(o=0|tt(0|A,0|e,0|(i=3*(15^n)|0))),0|B(),0|i))&Ze(-1227133514,-1171,0|i,0|(o=0|B())))&!(4681&o&B())&&15==(0|n)|!(0|(i=0|tt(0|rt(0|~A,0|~e,0|(i=19+(3*n|0)|0)),0|B(),0|i)))&!(0|B())?0|r[20528+t|0]?!(0|A)&!(0|(e&=8191))?0|(i=1):(i=0|nt(0|A,0|e),B(),0|!!((63-i|0)%3|0)):0|(i=1):0|(i=0)):0|(A=0)}function RA(A,e,t,r){A|=0,t|=0,r|=0;var o=0,i=0,a=0,s=0;if(o=0|rt(0|(e|=0),0,52),i=0|B(),t=0|rt(0|t,0,45),t=0|i|B()|134225919,(0|e)<1)return i=-1,r=t,n[(e=A)>>2]=i,void(n[(A=A+4|0)>>2]=r);for(i=1,o=-1;s=0|rt(7,0,0|(a=3*(15-i|0)|0)),t&=~B(),o=o&~s|(a=0|rt(0|r,0,0|a)),t=0|t|B(),(0|i)!=(0|e);)i=i+1|0;n[(a=s=A)>>2]=o,n[(s=s+4|0)>>2]=t}function IA(A,e,t,r){t|=0,r|=0;var o=0,i=0;if(i=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return 4;if((0|(i&=15))<(0|t))return 12;if((0|i)==(0|t))return n[r>>2]=A,n[r+4>>2]=e,0;if(o=0|rt(0|t,0,52),o|=A,A=B()|-15728641&e,(0|i)>(0|t))do{e=0|rt(7,0,3*(14-t|0)|0),t=t+1|0,o|=e,A=0|B()|A}while((0|t)<(0|i));return n[r>>2]=o,n[r+4>>2]=A,0}function _A(A,e,t,r){t|=0,r|=0;var o=0,i=0,a=0;if(i=0|tt(0|(A|=0),0|(e|=0),52),B(),!((0|t)<16&(0|(i&=15))<=(0|t)))return 4;o=t-i|0,t=0|tt(0|A,0|e,45),B();A:do{if(0|H(127&t)){e:do{if(0|i){for(t=1;!((a=0|rt(7,0,3*(15-t|0)|0))&A)&!((0|B())&e);){if(!(t>>>0>>0))break e;t=t+1|0}t=0|pe(7,0,o,((0|o)<0)<<31>>31),o=0|B();break A}}while(0);t=0|Ve(0|(t=0|qe(0|(t=0|pe(7,0,o,((0|o)<0)<<31>>31)),0|B(),5,0)),0|B(),-5,-1),t=0|Ve(0|(t=0|Xe(0|t,0|B(),6,0)),0|B(),1,0),o=0|B()}else t=0|pe(7,0,o,((0|o)<0)<<31>>31),o=0|B()}while(0);return n[(a=r)>>2]=t,n[a+4>>2]=o,0}function zA(A,e){var t=0,r=0,n=0;if(n=0|tt(0|(A|=0),0|(e|=0),45),B(),!(0|H(127&n)))return 0;n=0|tt(0|A,0|e,52),B(),n&=15;A:do{if(n)for(r=1;;){if(t=0|tt(0|A,0|e,3*(15-r|0)|0),B(),0|(t&=7))break A;if(!(r>>>0>>0)){t=0;break}r=r+1|0}else t=0}while(0);return 1&!(0|t)}function HA(A,e,t,r){return A|=0,e|=0,(0|(r|=0))<(0|(t|=0))?(r=A,C(0|(t=e)),0|r):(t=0|rt(-1,-1,3+(3*(r-t|0)|0)|0),r=0|rt(0|~t,0|~B(),3*(15-r|0)|0),t=~B()&e,r=~r&A,C(0|t),0|r)}function GA(A,e,t,r){t|=0,r|=0;var o=0;return o=0|tt(0|(A|=0),0|(e|=0),52),B(),(0|t)<16&(0|(o&=15))<=(0|t)?((0|o)<(0|t)&&(o=0|rt(-1,-1,3+(3*(t+-1-o|0)|0)|0),o=0|rt(0|~o,0|~B(),3*(15-t|0)|0),e=~B()&e,A&=~o),o=0|rt(0|t,0,52),t=-15728641&e|B(),n[r>>2]=A|o,n[r+4>>2]=t,0|(r=0)):0|(r=4)}function OA(A,e){var t=0,r=0,n=0;if(n=0|tt(0|(A|=0),0|(e|=0),52),B(),!(n&=15))return 0;for(r=1;;){if(t=0|tt(0|A,0|e,3*(15-r|0)|0),B(),0|(t&=7)){r=5;break}if(!(r>>>0>>0)){t=0,r=5;break}r=r+1|0}return 5==(0|r)?0|t:0}function UA(A,e){var t=0,r=0,n=0,o=0,i=0,a=0,s=0;if(s=0|tt(0|(A|=0),0|(e|=0),52),B(),!(s&=15))return s=A,C(0|(a=e)),0|s;for(a=1,t=0;;){r=0|rt(7,0,0|(o=3*(15-a|0)|0)),n=0|B(),i=0|tt(0|A,0|e,0|o),B(),A=(o=0|rt(0|vA(7&i),0,0|o))|A&~r,e=(i=0|B())|e&~n;A:do{if(!t)if(!(o&r|0)&!(i&n|0))t=0;else if(r=0|tt(0|A,0|e,52),B(),r&=15){t=1;e:for(;;){switch(i=0|tt(0|A,0|e,3*(15-t|0)|0),B(),7&i){case 1:break e;case 0:break;default:t=1;break A}if(!(t>>>0>>0)){t=1;break A}t=t+1|0}for(t=1;;){if(n=0|tt(0|A,0|e,0|(i=3*(15-t|0)|0)),B(),o=0|rt(7,0,0|i),e&=~B(),A=A&~o|(i=0|rt(0|vA(7&n),0,0|i)),e=0|e|B(),!(t>>>0>>0)){t=1;break}t=t+1|0}}else t=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return C(0|e),0|A}function YA(A,e){var t=0,r=0,n=0,o=0,i=0;if(r=0|tt(0|(A|=0),0|(e|=0),52),B(),!(r&=15))return r=A,C(0|(t=e)),0|r;for(t=1;i=0|tt(0|A,0|e,0|(o=3*(15-t|0)|0)),B(),n=0|rt(7,0,0|o),e&=~B(),A=(o=0|rt(0|vA(7&i),0,0|o))|A&~n,e=0|B()|e,t>>>0>>0;)t=t+1|0;return C(0|e),0|A}function WA(A,e){var t=0,r=0,n=0,o=0,i=0,a=0,s=0;if(s=0|tt(0|(A|=0),0|(e|=0),52),B(),!(s&=15))return s=A,C(0|(a=e)),0|s;for(a=1,t=0;;){r=0|rt(7,0,0|(o=3*(15-a|0)|0)),n=0|B(),i=0|tt(0|A,0|e,0|o),B(),A=(o=0|rt(0|yA(7&i),0,0|o))|A&~r,e=(i=0|B())|e&~n;A:do{if(!t)if(!(o&r|0)&!(i&n|0))t=0;else if(r=0|tt(0|A,0|e,52),B(),r&=15){t=1;e:for(;;){switch(i=0|tt(0|A,0|e,3*(15-t|0)|0),B(),7&i){case 1:break e;case 0:break;default:t=1;break A}if(!(t>>>0>>0)){t=1;break A}t=t+1|0}for(t=1;;){if(o=0|rt(7,0,0|(n=3*(15-t|0)|0)),i=e&~B(),e=0|tt(0|A,0|e,0|n),B(),A=A&~o|(e=0|rt(0|yA(7&e),0,0|n)),e=0|i|B(),!(t>>>0>>0)){t=1;break}t=t+1|0}}else t=1}while(0);if(!(a>>>0>>0))break;a=a+1|0}return C(0|e),0|A}function VA(A,e){var t=0,r=0,n=0,o=0,i=0;if(r=0|tt(0|(A|=0),0|(e|=0),52),B(),!(r&=15))return r=A,C(0|(t=e)),0|r;for(t=1;o=0|rt(7,0,0|(i=3*(15-t|0)|0)),n=e&~B(),e=0|tt(0|A,0|e,0|i),B(),A=(e=0|rt(0|yA(7&e),0,0|i))|A&~o,e=0|B()|n,t>>>0>>0;)t=t+1|0;return C(0|e),0|A}function ZA(A){return(0|(A|=0))%2|0}function KA(A,e,t){t|=0;var r,i=0;return r=S,S=S+16|0,i=r,(e|=0)>>>0>15?(S=r,0|(i=4)):2146435072&~n[4+(A|=0)>>2]&&2146435072&~n[A+8+4>>2]?(function(A,e,t){var r,i;r=S,S=S+16|0,function(A,e,t,r){e|=0,r|=0;var i,a=0,s=0,l=0,c=0;if(i=S,S=S+16|0,function(A,e,t){e|=0,t|=0;var r,i,a=0;i=S,S=S+32|0,function(A,e){e|=0;var t,r,n=0;n=+o[(A|=0)>>3],t=+d(+n),n=+f(+n),o[e+16>>3]=n,n=+o[A+8>>3],r=t*+d(+n),o[e>>3]=r,n=t*+f(+n),o[e+8>>3]=n}(A|=0,r=i),n[e>>2]=0,o[t>>3]=5,(a=+Se(16400,r))<+o[t>>3]&&(n[e>>2]=0,o[t>>3]=a),(a=+Se(16424,r))<+o[t>>3]&&(n[e>>2]=1,o[t>>3]=a),(a=+Se(16448,r))<+o[t>>3]&&(n[e>>2]=2,o[t>>3]=a),(a=+Se(16472,r))<+o[t>>3]&&(n[e>>2]=3,o[t>>3]=a),(a=+Se(16496,r))<+o[t>>3]&&(n[e>>2]=4,o[t>>3]=a),(a=+Se(16520,r))<+o[t>>3]&&(n[e>>2]=5,o[t>>3]=a),(a=+Se(16544,r))<+o[t>>3]&&(n[e>>2]=6,o[t>>3]=a),(a=+Se(16568,r))<+o[t>>3]&&(n[e>>2]=7,o[t>>3]=a),(a=+Se(16592,r))<+o[t>>3]&&(n[e>>2]=8,o[t>>3]=a),(a=+Se(16616,r))<+o[t>>3]&&(n[e>>2]=9,o[t>>3]=a),(a=+Se(16640,r))<+o[t>>3]&&(n[e>>2]=10,o[t>>3]=a),(a=+Se(16664,r))<+o[t>>3]&&(n[e>>2]=11,o[t>>3]=a),(a=+Se(16688,r))<+o[t>>3]&&(n[e>>2]=12,o[t>>3]=a),(a=+Se(16712,r))<+o[t>>3]&&(n[e>>2]=13,o[t>>3]=a),(a=+Se(16736,r))<+o[t>>3]&&(n[e>>2]=14,o[t>>3]=a),(a=+Se(16760,r))<+o[t>>3]&&(n[e>>2]=15,o[t>>3]=a),(a=+Se(16784,r))<+o[t>>3]&&(n[e>>2]=16,o[t>>3]=a),(a=+Se(16808,r))<+o[t>>3]&&(n[e>>2]=17,o[t>>3]=a),(a=+Se(16832,r))<+o[t>>3]&&(n[e>>2]=18,o[t>>3]=a),(a=+Se(16856,r))<+o[t>>3]?(n[e>>2]=19,o[t>>3]=a,S=i):S=i}(A|=0,t|=0,c=i),(s=+h(+(1-.5*+o[c>>3])))<1e-16)return n[r>>2]=0,n[r+4>>2]=0,n[r+8>>2]=0,n[r+12>>2]=0,void(S=i);if(c=0|n[t>>2],a=+ne((a=+o[15920+(24*c|0)>>3])-+ne(+function(A,e){var t,r,n,i,a;return A|=0,i=+o[(e|=0)>>3],r=+d(+i),n=+o[e+8>>3]-+o[A+8>>3],a=r*+f(+n),t=+o[A>>3],+ +p(+a,+(+f(+i)*+d(+t)-+d(+n)*(r*+f(+t))))}(15600+(c<<4)|0,A))),l=0|ZA(e)?+ne(a+-.3334731722518321):a,a=2.618033988749896*+g(+s),(0|e)>0){A=0;do{a*=2.6457513110645907,A=A+1|0}while((0|A)!=(0|e))}s=+d(+l)*a,o[r>>3]=s,l=+f(+l)*a,o[r+8>>3]=l,S=i}(A|=0,e|=0,t|=0,i=r),function(A,e){A|=0;var t,r,i,a,s=0,c=0,u=0,d=0,f=0,g=0,h=0;n[(a=8+(e|=0)|0)>>2]=0,r=+o[A>>3],d=+l(+r),i=+o[A+8>>3],d+=.5*(f=1.1547005383792515*+l(+i)),d-=+(0|(s=~~d)),f-=+(0|(A=~~f));do{if(d<.5){if(d<.3333333333333333){if(n[e>>2]=s,f<.5*(d+1)){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(A=(1&!(f<(h=1-d)))+A|0,n[e+4>>2]=A,h<=f&f<2*d){s=s+1|0,n[e>>2]=s;break}n[e>>2]=s;break}if(!(d<.6666666666666666)){if(s=s+1|0,n[e>>2]=s,f<.5*d){n[e+4>>2]=A;break}A=A+1|0,n[e+4>>2]=A;break}if(f<1-d){if(n[e+4>>2]=A,2*d-1>2]=s;break}}else A=A+1|0,n[e+4>>2]=A;s=s+1|0,n[e>>2]=s}while(0);do{if(r<0){if(1&A){s=~~(+(0|s)-(2*(+((g=0|Ze(0|s,((0|s)<0)<<31>>31,0|(g=(A+1|0)/2|0),((0|g)<0)<<31>>31))>>>0)+4294967296*+(0|B()))+1)),n[e>>2]=s;break}s=~~(+(0|s)-2*(+((g=0|Ze(0|s,((0|s)<0)<<31>>31,0|(g=(0|A)/2|0),((0|g)<0)<<31>>31))>>>0)+4294967296*+(0|B()))),n[e>>2]=s;break}}while(0);g=e+4|0,i<0&&(s=s-((1|A<<1)/2|0)|0,n[e>>2]=s,A=0-A|0,n[g>>2]=A),c=A-s|0,(0|s)<0?(u=0-s|0,n[g>>2]=c,n[a>>2]=u,n[e>>2]=0,A=c,s=0):u=0,(0|A)<0&&(s=s-A|0,n[e>>2]=s,u=u-A|0,n[a>>2]=u,n[g>>2]=0,A=0),t=s-u|0,c=A-u|0,(0|u)<0&&(n[e>>2]=t,n[g>>2]=c,n[a>>2]=0,A=c,s=t,u=0),(0|(c=(0|u)<(0|(c=(0|A)<(0|s)?A:s))?u:c))<=0||(n[e>>2]=s-c,n[g>>2]=A-c,n[a>>2]=u-c)}(i,t+4|0),S=r}(A,e,i),e=0|function(A,e){A|=0;var t,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0;if(t=S,S=S+64|0,l=t+40|0,o=t+24|0,i=t+12|0,a=t,rt(0|(e|=0),0,52),r=134225919|B(),!e)return(0|n[A+4>>2])>2||(0|n[A+8>>2])>2||(0|n[A+12>>2])>2?(l=0,C(0|(s=0)),S=t,0|l):(rt(0|O(A),0,45),s=0|B()|r,l=-1,C(0|s),S=t,0|l);if(n[l>>2]=n[A>>2],n[l+4>>2]=n[A+4>>2],n[l+8>>2]=n[A+8>>2],n[l+12>>2]=n[A+12>>2],s=l+4|0,(0|e)>0)for(A=-1;n[o>>2]=n[s>>2],n[o+4>>2]=n[s+4>>2],n[o+8>>2]=n[s+8>>2],1&e?(dA(s),n[i>>2]=n[s>>2],n[i+4>>2]=n[s+4>>2],n[i+8>>2]=n[s+8>>2],gA(i)):(fA(s),n[i>>2]=n[s>>2],n[i+4>>2]=n[s+4>>2],n[i+8>>2]=n[s+8>>2],hA(i)),aA(o,i,a),nA(a),c=0|rt(7,0,0|(u=3*(15-e|0)|0)),r&=~B(),A=(u=0|rt(0|lA(a),0,0|u))|A&~c,r=0|B()|r,(0|e)>1;)e=e+-1|0;else A=-1;A:do{if((0|n[s>>2])<=2&&(0|n[l+8>>2])<=2&&(0|n[l+12>>2])<=2){if(e=0|rt(0|(o=0|O(l)),0,45),e|=A,A=B()|-1040385&r,a=0|U(l),!(0|H(o))){if((0|a)<=0)break;for(i=0;;){if(o=0|tt(0|e,0|A,52),B(),o&=15)for(r=1;l=0|tt(0|e,0|A,0|(u=3*(15-r|0)|0)),B(),c=0|rt(7,0,0|u),A&=~B(),e=e&~c|(u=0|rt(0|vA(7&l),0,0|u)),A=0|A|B(),r>>>0>>0;)r=r+1|0;if((0|(i=i+1|0))==(0|a))break A}}i=0|tt(0|e,0|A,52),B(),i&=15;e:do{if(i){r=1;t:for(;;){switch(u=0|tt(0|e,0|A,3*(15-r|0)|0),B(),7&u){case 1:break t;case 0:break;default:break e}if(!(r>>>0>>0))break e;r=r+1|0}if(0|Y(o,0|n[l>>2]))for(r=1;c=0|rt(7,0,0|(l=3*(15-r|0)|0)),u=A&~B(),A=0|tt(0|e,0|A,0|l),B(),e=e&~c|(A=0|rt(0|yA(7&A),0,0|l)),A=0|u|B(),r>>>0>>0;)r=r+1|0;else for(r=1;l=0|tt(0|e,0|A,0|(u=3*(15-r|0)|0)),B(),c=0|rt(7,0,0|u),A&=~B(),e=e&~c|(u=0|rt(0|vA(7&l),0,0|u)),A=0|A|B(),r>>>0>>0;)r=r+1|0}}while(0);if((0|a)>0){r=0;do{e=0|UA(e,A),A=0|B(),r=r+1|0}while((0|r)!=(0|a))}}else e=0,A=0}while(0);return u=e,C(0|(c=A)),S=t,0|u}(i,e),i=0|B(),n[t>>2]=e,n[t+4>>2]=i,!(0|e)&!(0|i)&&M(27795,27122,1050,27145),S=r,0|(i=0)):(S=r,0|(i=3))}function JA(A,e,t){var r,o=0,i=0,a=0;if(r=4+(t|=0)|0,i=0|tt(0|(A|=0),0|(e|=0),52),B(),i&=15,a=0|tt(0|A,0|e,45),B(),o=!(0|i),0|H(127&a)){if(o)return 1;o=1}else{if(o)return 0;o=0|n[r>>2]||0|n[t+8>>2]?1:1&!!(0|n[t+12>>2])}for(t=1;1&t?gA(r):hA(r),a=0|tt(0|A,0|e,3*(15-t|0)|0),B(),mA(r,7&a),t>>>0>>0;)t=t+1|0;return 0|o}function XA(A,e,t){t|=0;var r,o,i=0,a=0,s=0,l=0,c=0,u=0;if(o=S,S=S+16|0,r=o,u=0|tt(0|(A|=0),0|(e|=0),45),B(),(u&=127)>>>0>121)return n[t>>2]=0,n[t+4>>2]=0,n[t+8>>2]=0,n[t+12>>2]=0,S=o,5;A:do{if(0|H(u)&&(s=0|tt(0|A,0|e,52),B(),0|(s&=15))){i=1;e:for(;;){switch(c=0|tt(0|A,0|e,3*(15-i|0)|0),B(),7&c){case 5:break e;case 0:break;default:i=e;break A}if(!(i>>>0>>0)){i=e;break A}i=i+1|0}for(a=1,i=e;l=0|rt(7,0,0|(e=3*(15-a|0)|0)),c=i&~B(),i=0|tt(0|A,0|i,0|e),B(),A=A&~l|(i=0|rt(0|yA(7&i),0,0|e)),i=0|c|B(),a>>>0>>0;)a=a+1|0}else i=e}while(0);if(c=7696+(28*u|0)|0,n[t>>2]=n[c>>2],n[t+4>>2]=n[c+4>>2],n[t+8>>2]=n[c+8>>2],n[t+12>>2]=n[c+12>>2],!(0|JA(A,i,t)))return S=o,0;if(l=t+4|0,n[r>>2]=n[l>>2],n[r+4>>2]=n[l+4>>2],n[r+8>>2]=n[l+8>>2],s=0|tt(0|A,0|i,52),B(),c=15&s,1&s?(hA(l),s=c+1|0):s=c,0|H(u)){A:do{if(c)for(e=1;;){if(a=0|tt(0|A,0|i,3*(15-e|0)|0),B(),0|(a&=7)){i=a;break A}if(!(e>>>0>>0)){i=0;break}e=e+1|0}else i=0}while(0);i=4==(0|i)&1}else i=0;if(0|NA(t,s,i,0)){if(0|H(u))do{}while(0|NA(t,s,0,0));(0|s)!=(0|c)&&fA(l)}else(0|s)!=(0|c)&&(n[l>>2]=n[r>>2],n[l+4>>2]=n[r+4>>2],n[l+8>>2]=n[r+8>>2]);return S=o,0}function qA(A,e,t){t|=0;var r,o,i=0;return o=S,S=S+16|0,0|(i=0|XA(A|=0,e|=0,r=o))?(S=o,0|i):(i=0|tt(0|A,0|e,52),B(),function(A,e,t){var r,o;e|=0,t|=0,r=S,S=S+16|0,oA(4+(A|=0)|0,o=r),EA(o,0|n[A>>2],e,0,t),S=r}(r,15&i,t),S=o,0|(i=0))}function $A(A,e,t){t|=0;var r,n=0,o=0,i=0;if(r=S,S=S+16|0,0|(n=0|XA(A|=0,e|=0,i=r)))return S=r,0|n;n=0|tt(0|A,0|e,45),B(),n=!(0|H(127&n)),o=0|tt(0|A,0|e,52),B(),o&=15;A:do{if(!n){if(0|o)for(n=1;;){if(!(!((0|rt(7,0,3*(15-n|0)|0))&A)&!((0|B())&e)))break A;if(!(n>>>0>>0))break;n=n+1|0}return jA(i,o,0,5,t),S=r,0}}while(0);return FA(i,o,0,6,t),S=r,0}function Ae(A,e){e|=0;var t=0,r=0,o=0,i=0,a=0,s=0,l=0;if((A|=0)>>>0>15)return 4;if(rt(0|A,0,52),s=134225919|B(),!A){t=0,r=0;do{0|H(r)&&(rt(0|r,0,45),a=0|s|B(),n[(A=e+(t<<3)|0)>>2]=-1,n[A+4>>2]=a,t=t+1|0),r=r+1|0}while(122!=(0|r));return 0}t=0,a=0;do{if(0|H(a)){for(rt(0|a,0,45),r=1,o=-1,i=0|s|B();o&=~(l=0|rt(7,0,3*(15-r|0)|0)),i&=~B(),(0|r)!=(0|A);)r=r+1|0;n[(l=e+(t<<3)|0)>>2]=o,n[l+4>>2]=i,t=t+1|0}a=a+1|0}while(122!=(0|a));return 0}function ee(A,e,t,r){A|=0,r|=0;var o=0,i=0,a=0;o=0|tt(0|(e|=0),0|(t|=0),52),B(),!(0|e)&!(0|t)|(0|r)>15|(0|(o&=15))>(0|r)?(i=-1,e=-1,t=0,o=0):(e=0|HA(e,t,o+1|0,r),a=-15728641&B(),t=0|rt(0|r,0,52),i=o,e=(e=!(0|zA(t|=e,a=0|a|B())))?-1:r,o=a),n[(a=A)>>2]=t,n[a+4>>2]=o,n[A+8>>2]=i,n[A+12>>2]=e}function te(A,e,t,r){t|=0,r|=0;var o=0,i=0;return o=0|tt(0|(A|=0),0|(e|=0),52),B(),o&=15,n[(i=r+8|0)>>2]=o,!(0|A)&!(0|e)|(0|t)>15|(0|o)>(0|t)?(n[(t=r)>>2]=0,n[t+4>>2]=0,n[i>>2]=-1,void(n[r+12>>2]=-1)):(A=0|HA(A,e,o+1|0,t),i=-15728641&B(),o=0|rt(0|t,0,52),o|=A,i=0|i|B(),n[(A=r)>>2]=o,n[A+4>>2]=i,A=r+12|0,0|zA(o,i)?void(n[A>>2]=t):void(n[A>>2]=-1))}function re(A){var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0,c=0;if(!(!(0|(t=0|n[(r=A|=0)>>2]))&!(0|(r=0|n[r+4>>2]))||(o=0|tt(0|t,0|r,52),B(),t=0|Ve(0|(l=0|rt(1,0,3*(15^(o&=15))|0)),0|B(),0|t,0|r),r=0|B(),n[(l=A)>>2]=t,n[l+4>>2]=r,(0|o)<(0|(s=0|n[(l=A+8|0)>>2]))))){for(e=A+12|0,a=o;;){if((0|a)==(0|s)){o=5;break}if(c=(0|a)==(0|n[e>>2]),o=0|tt(0|t,0|r,0|(i=3*(15-a|0)|0)),B(),c&1==(0|(o&=7))&!0){o=7;break}if(!(7==(0|o)&!0)){o=10;break}if(t=0|Ve(0|t,0|r,0|(c=0|rt(1,0,0|i)),0|B()),r=0|B(),n[(c=A)>>2]=t,n[c+4>>2]=r,!((0|a)>(0|s))){o=10;break}a=a+-1|0}if(5==(0|o))return n[(c=A)>>2]=0,n[c+4>>2]=0,n[l>>2]=-1,void(n[e>>2]=-1);if(7==(0|o))return s=0|Ve(0|t,0|r,0|(s=0|rt(1,0,0|i)),0|B()),l=0|B(),n[(c=A)>>2]=s,n[c+4>>2]=l,void(n[e>>2]=a+-1)}}function ne(A){var e;return e=(A=+A)<0?A+6.283185307179586:A,+(A>=6.283185307179586?e+-6.283185307179586:e)}function oe(A,e){return e|=0,+l(+(+o[(A|=0)>>3]-+o[e>>3]))<17453292519943298e-27?0|(e=+l(+(+o[A+8>>3]-+o[e+8>>3]))<17453292519943298e-27):0|(e=0)}function ie(A,e){switch(A=+A,0|(e|=0)){case 1:A=A<0?A+6.283185307179586:A;break;case 2:A=A>0?A+-6.283185307179586:A}return+A}function ae(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+f(.5*(r-t)))*n+(i=+f(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+d(+r)*+d(+t)*i),2*+p(+ +c(+i),+ +c(+(1-i)))*6371.007180918475}function se(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20656+(A<<3)>>3],0|(e=0))}function le(A,e){e|=0;var t=0;return(A|=0)>>>0>15?0|(e=4):(t=0|qe(0|(t=0|pe(7,0,A,((0|A)<0)<<31>>31)),0|B(),120,0),A=0|B(),n[e>>2]=2|t,n[e+4>>2]=A,0|(e=0))}function ce(A,e,t){A|=0,t|=0;var r,n,i,a,s=0,l=0,u=0,h=0,m=0,v=0;return v=+o[(e|=0)>>3],i=+o[A>>3],m=+f(.5*(v-i)),u=+o[e+8>>3],n=+o[A+8>>3],h=+f(.5*(u-n)),r=+d(+i),a=+d(+v),h=2*+p(+ +c(+(h=m*m+h*(a*r*h))),+ +c(+(1-h))),m=+o[t>>3],v=+f(.5*(m-v)),s=+o[t+8>>3],u=+f(.5*(s-u)),l=+d(+m),u=2*+p(+ +c(+(u=v*v+u*(a*l*u))),+ +c(+(1-u))),m=+f(.5*(i-m)),s=+f(.5*(n-s)),s=2*+p(+ +c(+(s=m*m+s*(r*l*s))),+ +c(+(1-s))),4*+b(+ +c(+ +g(.5*(l=.5*(h+u+s)))*+g(.5*(l-h))*+g(.5*(l-u))*+g(.5*(l-s))))}function ue(A,e,t){t|=0;var r,i,a,s=0,l=0;if(a=S,S=S+192|0,i=a,0|(l=0|qA(A|=0,e|=0,r=a+168|0)))return S=a,0|l;if(0|$A(A,e,i)&&M(27795,27190,415,27199),(0|(e=0|n[i>>2]))>0){if(s=+ce(i+8|0,i+8+((1!=(0|e)&1)<<4)|0,r)+0,1!=(0|e)){A=1;do{s+=+ce(i+8+((l=A)<<4)|0,i+8+((0|(A=A+1|0))%(0|e)<<4)|0,r)}while((0|A)<(0|e))}}else s=0;return o[t>>3]=s,S=a,0}function de(A){A|=0;var e,t,r=0;return(e=0|We(1,12))||M(27280,27235,49,27293),0|(r=0|n[(t=A+4|0)>>2])?(n[(r=r+8|0)>>2]=e,n[t>>2]=e,0|e):(0|n[A>>2]&&M(27310,27235,61,27333),n[(r=A)>>2]=e,n[t>>2]=e,0|e)}function fe(A,e){var t,r;return A|=0,e|=0,(r=0|Ue(24))||M(27347,27235,78,27361),n[r>>2]=n[e>>2],n[r+4>>2]=n[e+4>>2],n[r+8>>2]=n[e+8>>2],n[r+12>>2]=n[e+12>>2],n[r+16>>2]=0,0|(t=0|n[(e=A+4|0)>>2])?(n[t+16>>2]=r,n[e>>2]=r,0|r):(0|n[A>>2]&&M(27376,27235,82,27361),n[A>>2]=r,n[e>>2]=r,0|r)}function ge(A){var e=0,t=0,r=0,o=0;if(A|=0)for(r=1;;){if(0|(e=0|n[A>>2]))do{if(0|(t=0|n[e>>2]))do{o=t,t=0|n[t+16>>2],Ye(o)}while(0|t);o=e,e=0|n[e+8>>2],Ye(o)}while(0|e);if(e=A,A=0|n[A+8>>2],r||Ye(e),!A)break;r=0}}function he(A,e,t){A|=0;var r=0,i=0,a=0,s=0,l=0,c=0,u=0,d=0;if(!(0|X(e|=0,t|=0)))return 0;if(e=0|K(e),r=+o[t>>3],i=e&(i=+o[t+8>>3])<0?i+6.283185307179586:i,!(A=0|n[A>>2]))return 0;if(e){e=0,u=i,t=A;A:for(;;){for(;s=+o[t>>3],i=+o[t+8>>3],d=0|n[(t=t+16|0)>>2],a=+o[(d=0|d?d:A)>>3],l=+o[d+8>>3],s>a?(c=s,s=l):(c=a,a=s,s=i,i=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(t=0|n[t>>2])){t=22;break A}if(((c=(l=s<0?s+6.283185307179586:s)+(r-a)/(c-a)*((s=i<0?i+6.283185307179586:i)-l))<0?c+6.283185307179586:c)>(u=l==u|s==u?u+-2220446049250313e-31:u)&&(e^=1),!(t=0|n[t>>2])){t=22;break}}if(22==(0|t))return 0|e}else{e=0,u=i,t=A;A:for(;;){for(;s=+o[t>>3],i=+o[t+8>>3],d=0|n[(t=t+16|0)>>2],a=+o[(d=0|d?d:A)>>3],l=+o[d+8>>3],s>a?(c=s,s=l):(c=a,a=s,s=i,i=l),(r=r==a|r==c?r+2220446049250313e-31:r)c;)if(!(t=0|n[t>>2])){t=22;break A}if(s+(r-a)/(c-a)*(i-s)>(u=s==u|i==u?u+-2220446049250313e-31:u)&&(e^=1),!(t=0|n[t>>2])){t=22;break}}if(22==(0|t))return 0|e}return 0}function me(A,e,t,o,i){t|=0,o|=0,i|=0;var a,s,l,c,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0;if(c=S,S=S+32|0,y=c+16|0,l=c,u=0|tt(0|(A|=0),0|(e|=0),52),B(),u&=15,b=0|tt(0|t,0|o,52),B(),(0|u)!=(15&b))return S=c,12;if(h=0|tt(0|A,0|e,45),B(),h&=127,m=0|tt(0|t,0|o,45),B(),h>>>0>121|(m&=127)>>>0>121)return S=c,5;if(b=(0|h)!=(0|m)){if(7==(0|(f=0|V(h,m))))return S=c,1;7==(0|(g=0|V(m,h)))?M(27514,27538,161,27548):(p=f,d=g)}else p=0,d=0;a=0|H(h),s=0|H(m),n[y>>2]=0,n[y+4>>2]=0,n[y+8>>2]=0,n[y+12>>2]=0;do{if(p){if(f=(0|(m=0|n[4272+(28*h|0)+(p<<2)>>2]))>0,s)if(f){h=0,g=t,f=o;do{g=0|WA(g,f),f=0|B(),1==(0|(d=0|yA(d)))&&(d=0|yA(1)),h=h+1|0}while((0|h)!=(0|m));m=d,h=g,g=f}else m=d,h=t,g=o;else if(f){h=0,g=t,f=o;do{g=0|VA(g,f),f=0|B(),d=0|yA(d),h=h+1|0}while((0|h)!=(0|m));m=d,h=g,g=f}else m=d,h=t,g=o;if(JA(h,g,y),b||M(27563,27538,191,27548),(f=!!(0|a))&(d=!!(0|s))&&M(27590,27538,192,27548),f){if(7==(0|(d=0|OA(A,e)))){u=5;break}if(0|r[22e3+(7*d|0)+p|0]){u=1;break}h=g=0|n[21168+(28*d|0)+(p<<2)>>2]}else if(d){if(7==(0|(d=0|OA(h,g)))){u=5;break}if(0|r[22e3+(7*d|0)+m|0]){u=1;break}h=0,g=0|n[21168+(28*m|0)+(d<<2)>>2]}else h=0,g=0;if((h|g|0)<0)u=5;else{if((0|g)>0){f=y+4|0,d=0;do{pA(f),d=d+1|0}while((0|d)!=(0|g))}if(n[l>>2]=0,n[l+4>>2]=0,n[l+8>>2]=0,mA(l,p),0|u)for(;0|ZA(u)?gA(l):hA(l),(0|u)>1;)u=u+-1|0;if((0|h)>0){u=0;do{pA(l),u=u+1|0}while((0|u)!=(0|h))}iA(v=y+4|0,l,v),nA(v),v=51}}else if(JA(t,o,y),!!(0|a)&!!(0|s))if((0|m)!=(0|h)&&M(27621,27538,261,27548),7==(0|(d=0|OA(A,e)))|7==(0|(u=0|OA(t,o))))u=5;else if(0|r[22e3+(7*d|0)+u|0])u=1;else if((0|(d=0|n[21168+(28*d|0)+(u<<2)>>2]))>0){f=y+4|0,u=0;do{pA(f),u=u+1|0}while((0|u)!=(0|d));v=51}else v=51;else v=51}while(0);return 51==(0|v)&&(u=y+4|0,n[i>>2]=n[u>>2],n[i+4>>2]=n[u+4>>2],n[i+8>>2]=n[u+8>>2],u=0),S=c,0|u}function be(A,e,t,r){t|=0,r|=0;var o,i,a,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0;if(a=S,S=S+48|0,o=a+36|0,c=a+24|0,u=a+12|0,d=a,s=0|tt(0|(A|=0),0|(e|=0),52),B(),s&=15,g=0|tt(0|A,0|e,45),B(),(g&=127)>>>0>121)return S=a,5;if(i=0|H(g),rt(0|s,0,52),b=134225919|B(),n[(l=r)>>2]=-1,n[l+4>>2]=b,!s)return 7==(0|(s=0|lA(t)))||127==(0|(s=0|W(g,s)))?(S=a,0|(b=1)):(h=0|rt(0|s,0,45),m=0|B(),m=-1040385&n[(g=r)+4>>2]|m,n[(b=r)>>2]=n[g>>2]|h,n[b+4>>2]=m,S=a,0|(b=0));for(n[o>>2]=n[t>>2],n[o+4>>2]=n[t+4>>2],n[o+8>>2]=n[t+8>>2],t=s;;){if(l=t,t=t+-1|0,n[c>>2]=n[o>>2],n[c+4>>2]=n[o+4>>2],n[c+8>>2]=n[o+8>>2],0|ZA(l)){if(0|(s=0|cA(o))){t=13;break}n[u>>2]=n[o>>2],n[u+4>>2]=n[o+4>>2],n[u+8>>2]=n[o+8>>2],gA(u)}else{if(0|(s=0|uA(o))){t=13;break}n[u>>2]=n[o>>2],n[u+4>>2]=n[o+4>>2],n[u+8>>2]=n[o+8>>2],hA(u)}if(aA(c,u,d),nA(d),v=0|n[(s=r)>>2],s=0|n[s+4>>2],p=0|rt(7,0,0|(y=3*(15-l|0)|0)),s&=~B(),y=0|rt(0|lA(d),0,0|y),s=0|B()|s,n[(b=r)>>2]=y|v&~p,n[b+4>>2]=s,(0|l)<=1){t=14;break}}A:do{if(13!=(0|t)&&14==(0|t))if((0|n[o>>2])<=1&&(0|n[o+4>>2])<=1&&(0|n[o+8>>2])<=1){d=127==(0|(s=0|W(g,t=0|lA(o))))?0:0|H(s);e:do{if(t){if(i){if(7==(0|(s=0|OA(A,e)))){s=5;break A}if((0|(l=0|n[21376+(28*s|0)+(t<<2)>>2]))>0){s=t,t=0;do{s=0|vA(s),t=t+1|0}while((0|t)!=(0|l))}else s=t;if(1==(0|s)){s=9;break A}127==(0|(t=0|W(g,s)))&&M(27648,27538,411,27678),0|H(t)?M(27693,27538,412,27678):(m=t,h=l,f=s)}else m=s,h=0,f=t;if((0|(u=0|n[4272+(28*g|0)+(f<<2)>>2]))<=-1&&M(27724,27538,419,27678),!d){if((0|h)<0){s=5;break A}if(0|h){s=0,t=0|n[(l=r)>>2],l=0|n[l+4>>2];do{t=0|YA(t,l),l=0|B(),n[(y=r)>>2]=t,n[y+4>>2]=l,s=s+1|0}while((0|s)<(0|h))}if((0|u)<=0){s=m,t=58;break}for(s=0,t=0|n[(l=r)>>2],l=0|n[l+4>>2];;)if(t=0|YA(t,l),l=0|B(),n[(y=r)>>2]=t,n[y+4>>2]=l,(0|(s=s+1|0))==(0|u)){s=m,t=58;break e}}if(7==(0|(c=0|V(m,g)))&&M(27514,27538,428,27678),t=0|n[(s=r)>>2],s=0|n[s+4>>2],(0|u)>0){l=0;do{t=0|YA(t,s),s=0|B(),n[(y=r)>>2]=t,n[y+4>>2]=s,l=l+1|0}while((0|l)!=(0|u))}if(7==(0|(s=0|OA(t,s)))&&M(27795,27538,440,27678),t=0|G(m),(0|(t=0|n[(t?21792:21584)+(28*c|0)+(s<<2)>>2]))<0&&M(27795,27538,454,27678),t){s=0,l=0|n[(c=r)>>2],c=0|n[c+4>>2];do{l=0|UA(l,c),c=0|B(),n[(y=r)>>2]=l,n[y+4>>2]=c,s=s+1|0}while((0|s)<(0|t));s=m,t=58}else s=m,t=58}else if(!!(0|i)&!!(0|d)){if(7==(0|(t=0|OA(A,e)))|7==(0|(l=0|OA(0|n[(l=r)>>2],0|n[l+4>>2])))){s=5;break A}if((0|(l=0|n[21376+(28*t|0)+(l<<2)>>2]))<0){s=5;break A}if(l){t=0,c=0|n[(u=r)>>2],u=0|n[u+4>>2];do{c=0|YA(c,u),u=0|B(),n[(y=r)>>2]=c,n[y+4>>2]=u,t=t+1|0}while((0|t)<(0|l));t=58}else t=59}else t=58}while(0);if(58==(0|t)&&d&&(t=59),59==(0|t)&&1==(0|OA(0|n[(y=r)>>2],0|n[y+4>>2]))){s=9;break}p=0|n[(y=r)>>2],y=-1040385&n[y+4>>2],v=0|rt(0|s,0,45),y=0|y|B(),n[(s=r)>>2]=p|v,n[s+4>>2]=y,s=0}else s=1}while(0);return S=a,0|s}function pe(A,e,t,r){A|=0,e|=0;var n=0,o=0,i=0;if(!(0|(t|=0))&!(0|(r|=0)))return o=1,C(0|(n=0)),0|o;o=A,n=e,A=1,e=0;do{A=0|qe(0|((i=!0&!(1&t))?1:o),0|(i?0:n),0|A,0|e),e=0|B(),t=0|et(0|t,0|r,1),r=0|B(),o=0|qe(0|o,0|n,0|o,0|n),n=0|B()}while(!(!(0|t)&!(0|r)));return C(0|e),0|A}function ve(A,e,t,r){t|=0,r|=0;var i,a=0,s=0,l=0,c=0,u=0,f=0;i=S,S=S+16|0,s=i,l=0|tt(0|(A|=0),0|(e|=0),52),B(),l&=15;do{if(l){if(!(a=0|qA(A,e,s))){u=+o[s>>3],c=1/+d(+u),f=+o[25968+(l<<3)>>3],o[t>>3]=u+f,o[t+8>>3]=u-f,u=+o[s+8>>3],c*=f,o[t+16>>3]=c+u,o[t+24>>3]=u-c;break}return S=i,0|a}if(a=0|tt(0|A,0|e,45),B(),(a&=127)>>>0>121)return S=i,5;s=22064+(a<<5)|0,n[t>>2]=n[s>>2],n[t+4>>2]=n[s+4>>2],n[t+8>>2]=n[s+8>>2],n[t+12>>2]=n[s+12>>2],n[t+16>>2]=n[s+16>>2],n[t+20>>2]=n[s+20>>2],n[t+24>>2]=n[s+24>>2],n[t+28>>2]=n[s+28>>2];break}while(0);return function(A,e){e=+e;var t,r,n,i,a,s,l,c=0,u=0;c=(i=+o[(n=16+(A|=0)|0)>>3])-(r=+o[(t=A+24|0)>>3]),c=i>3],c=.5*(c*e-c),u+=e=.5*((l=u-(s=+o[(a=A+8|0)>>3]))*e-l),o[A>>3]=u>1.5707963267948966?1.5707963267948966:u,e=s-e,o[a>>3]=e<-1.5707963267948966?-1.5707963267948966:e,e=(e=i+c)>3.141592653589793?e+-6.283185307179586:e,o[n>>3]=e<-3.141592653589793?e+6.283185307179586:e,e=(e=r-c)>3.141592653589793?e+-6.283185307179586:e,o[t>>3]=e<-3.141592653589793?e+6.283185307179586:e}(t,r?1.4:1.1),(0|n[(r=26096+(l<<3)|0)>>2])==(0|A)&&(0|n[r+4>>2])==(0|e)&&(o[t>>3]=1.5707963267948966),(0|n[(l=26224+(l<<3)|0)>>2])==(0|A)&&(0|n[l+4>>2])==(0|e)&&(o[t+8>>3]=-1.5707963267948966),1.5707963267948966!=+o[t>>3]&&-1.5707963267948966!=+o[t+8>>3]?(S=i,0|(l=0)):(o[t+16>>3]=3.141592653589793,o[t+24>>3]=-3.141592653589793,S=i,0|(l=0))}function ye(A){var e,t,o,i,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0;if(i=S,S=S+336|0,e=i+168|0,t=i,!(0|(s=0|n[(l=A|=0)>>2]))&!(0|(l=0|n[l+4>>2])))S=i;else{if(0|r[0|(a=A+28|0)]?(s=0|we(s,l),l=0|B()):r[0|a]=1,!(0|n[n[(o=A+20|0)>>2]>>2]))return 0|(s=0|n[(a=A+24|0)>>2])&&Ye(s),n[(x=A)>>2]=0,n[x+4>>2]=0,n[A+8>>2]=0,n[o>>2]=0,n[A+12>>2]=-1,n[A+16>>2]=0,n[a>>2]=0,void(S=i);c=15&(a=0|n[(x=A+16|0)>>2]);A:do{if(!(0|s)&!(0|l))w=A+24|0;else{v=A+12|0,b=3==(0|c),m=255&a,g=3==(1|c),p=A+24|0,h=(c+-1|0)>>>0<3,d=3==(2|c),f=t+8|0;e:for(;;){if(u=0|tt(0|s,0|l,52),B(),(0|(u&=15))==(0|n[v>>2])){switch(15&m){case 0:case 2:case 3:if(0|(c=0|qA(s,l,e))){y=15;break e}if(0|Me(0|n[o>>2],0|n[p>>2],e)){y=19;break e}}if(g&&(c=0|n[4+(0|n[o>>2])>>2],n[e>>2]=n[c>>2],n[e+4>>2]=n[c+4>>2],n[e+8>>2]=n[c+8>>2],n[e+12>>2]=n[c+12>>2],0|X(26832,e))){if(0|KA(0|n[4+(0|n[o>>2])>>2],u,t)){y=25;break}if((0|n[(c=t)>>2])==(0|s)&&(0|n[c+4>>2])==(0|l)){y=29;break}}if(h){if(0|(c=0|$A(s,l,e))){y=32;break}if(0|ve(s,l,t,0)){y=36;break}if(d&&0|De(0|n[o>>2],0|n[p>>2],e,t)){y=42;break}if(g&&0|je(0|n[o>>2],0|n[p>>2],e,t)){y=42;break}}if(b){if(a=0|ve(s,l,e,1),c=0|n[p>>2],0|a){y=45;break}if(0|q(c,e)){if(AA(t,e),0|$(e,0|n[p>>2])){y=53;break}if(0|Me(0|n[o>>2],0|n[p>>2],f)){y=53;break}if(0|je(0|n[o>>2],0|n[p>>2],t,e)){y=53;break}}}}do{if((0|u)<(0|n[v>>2])){if(a=0|ve(s,l,e,1),c=0|n[p>>2],0|a){y=58;break e}if(!(0|q(c,e))){y=73;break}if(0|$(0|n[p>>2],e)&&(AA(t,e),0|De(0|n[o>>2],0|n[p>>2],t,e))){y=65;break e}if(0|(s=0|GA(s,l,u+1|0,t))){y=67;break e}s=0|n[(l=t)>>2],l=0|n[l+4>>2]}else y=73}while(0);if(73==(0|y)&&(y=0,s=0|we(s,l),l=0|B()),!(0|s)&!(0|l)){w=p;break A}}switch(0|y){case 15:0|(a=0|n[p>>2])&&Ye(a),n[(y=A)>>2]=0,n[y+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[x>>2]=0,n[p>>2]=0,n[A+8>>2]=c,y=20;break;case 19:n[A>>2]=s,n[A+4>>2]=l,y=20;break;case 25:M(27795,27761,470,27772);break;case 29:case 42:return n[A>>2]=s,n[A+4>>2]=l,void(S=i);case 32:return 0|(a=0|n[p>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[x>>2]=0,n[p>>2]=0,n[A+8>>2]=c,void(S=i);case 36:M(27795,27761,493,27772);break;case 45:0|c&&Ye(c),n[(y=A)>>2]=0,n[y+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[x>>2]=0,n[p>>2]=0,n[A+8>>2]=a,y=55;break;case 53:n[A>>2]=s,n[A+4>>2]=l,y=55;break;case 58:0|c&&Ye(c),n[(y=A)>>2]=0,n[y+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[x>>2]=0,n[p>>2]=0,n[A+8>>2]=a,y=71;break;case 65:n[A>>2]=s,n[A+4>>2]=l,y=71;break;case 67:return 0|(a=0|n[p>>2])&&Ye(a),n[(w=A)>>2]=0,n[w+4>>2]=0,n[o>>2]=0,n[v>>2]=-1,n[x>>2]=0,n[p>>2]=0,n[A+8>>2]=s,void(S=i)}if(20==(0|y))return void(S=i);if(55==(0|y))return void(S=i);if(71==(0|y))return void(S=i)}}while(0);0|(a=0|n[w>>2])&&Ye(a),n[(y=A)>>2]=0,n[y+4>>2]=0,n[A+8>>2]=0,n[o>>2]=0,n[A+12>>2]=-1,n[x>>2]=0,n[w>>2]=0,S=i}}function we(A,e){var t,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0,d=0;t=S,S=S+16|0,d=t,o=0|tt(0|(A|=0),0|(e|=0),52),B(),o&=15,r=0|tt(0|A,0|e,45),B();do{if(o){for(;r=0|rt(o+4095|0,0,52),i=B()|-15728641&e,r=r|A|(s=0|rt(7,0,0|(a=3*(15-o|0)|0))),i|=l=0|B(),c=0|tt(0|A,0|e,0|a),B(),o=o+-1|0,!((c&=7)>>>0<6);){if(!o){u=4;break}e=i,A=r}if(4==(0|u)){r=0|tt(0|r,0|i,45),B();break}return d=0|rt(((d=!(0|c)&!!(0|zA(r,i)))?2:1)+c|0,0,0|a),u=0|B()|e&~l,d|=A&~s,C(0|u),S=t,0|d}}while(0);return(r&=127)>>>0>120?(d=0,C(0|(u=0)),S=t,0|d):(RA(d,0,r+1|0,0),u=0|n[d+4>>2],d=0|n[d>>2],C(0|u),S=t,0|d)}function xe(A,e,t){A|=0;var r,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0;if(!(0|X(e|=0,t|=0)))return 0;if(e=0|K(e),i=+o[t>>3],a=e&(a=+o[t+8>>3])<0?a+6.283185307179586:a,(0|(g=0|n[A>>2]))<=0)return 0;if(r=0|n[A+4>>2],e){e=0,f=a,t=-1,A=0;A:for(;;){for(d=A;l=+o[r+(d<<4)>>3],a=+o[r+(d<<4)+8>>3],s=+o[r+((A=(t+2|0)%(0|g)|0)<<4)>>3],c=+o[r+(A<<4)+8>>3],l>s?(u=l,l=c):(u=s,s=l,l=a,a=c),(i=i==s|i==u?i+2220446049250313e-31:i)u;){if((0|(t=d+1|0))>=(0|g)){t=22;break A}A=d,d=t,t=A}if(((u=(c=l<0?l+6.283185307179586:l)+(i-s)/(u-s)*((l=a<0?a+6.283185307179586:a)-c))<0?u+6.283185307179586:u)>(f=c==f|l==f?f+-2220446049250313e-31:f)&&(e^=1),(0|(A=d+1|0))>=(0|g)){t=22;break}t=d}if(22==(0|t))return 0|e}else{e=0,f=a,t=-1,A=0;A:for(;;){for(d=A;l=+o[r+(d<<4)>>3],a=+o[r+(d<<4)+8>>3],s=+o[r+((A=(t+2|0)%(0|g)|0)<<4)>>3],c=+o[r+(A<<4)+8>>3],l>s?(u=l,l=c):(u=s,s=l,l=a,a=c),(i=i==s|i==u?i+2220446049250313e-31:i)u;){if((0|(t=d+1|0))>=(0|g)){t=22;break A}A=d,d=t,t=A}if(l+(i-s)/(u-s)*(a-l)>(f=l==f|a==f?f+-2220446049250313e-31:f)&&(e^=1),(0|(A=d+1|0))>=(0|g)){t=22;break}t=d}if(22==(0|t))return 0|e}return 0}function ke(A,e){e|=0;var t,r,i,a,s,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0;if(!(r=0|n[(A|=0)>>2]))return n[e>>2]=0,n[e+4>>2]=0,n[e+8>>2]=0,n[e+12>>2]=0,n[e+16>>2]=0,n[e+20>>2]=0,n[e+24>>2]=0,void(n[e+28>>2]=0);if(o[(i=e+8|0)>>3]=17976931348623157e292,o[(a=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(s=e+16|0)>>3]=-17976931348623157e292,!((0|r)<=0)){for(t=0|n[A+4>>2],b=17976931348623157e292,p=-17976931348623157e292,v=0,A=-1,f=17976931348623157e292,g=17976931348623157e292,m=-17976931348623157e292,u=-17976931348623157e292,y=0;c=+o[t+(y<<4)>>3],h=+o[t+(y<<4)+8>>3],d=+o[t+(((0|(A=A+2|0))==(0|r)?0:A)<<4)+8>>3],c>3]=c,f=c),h>3]=h,g=h),c>m?o[e>>3]=c:c=m,h>u&&(o[s>>3]=h,u=h),b=h>0&hp?h:p,v|=+l(+(h-d))>3.141592653589793,(0|(A=y+1|0))!=(0|r);)w=y,m=c,y=A,A=w;v&&(o[s>>3]=p,o[a>>3]=b)}}function Ce(A){return 0|((A|=0)>>>0<4?0:15)}function Be(A,e){e|=0;var t,r=0,i=0,a=0,s=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0,k=0,C=0,B=0,M=0;if(p=0|n[(A|=0)>>2]){if(o[(v=e+8|0)>>3]=17976931348623157e292,o[(y=e+24|0)>>3]=17976931348623157e292,o[e>>3]=-17976931348623157e292,o[(w=e+16|0)>>3]=-17976931348623157e292,(0|p)>0){for(a=0|n[A+4>>2],m=17976931348623157e292,b=-17976931348623157e292,i=0,r=-1,d=17976931348623157e292,f=17976931348623157e292,h=-17976931348623157e292,c=-17976931348623157e292,x=0;s=+o[a+(x<<4)>>3],g=+o[a+(x<<4)+8>>3],u=+o[a+(((0|(B=r+2|0))==(0|p)?0:B)<<4)+8>>3],s>3]=s,d=s),g>3]=g,f=g),s>h?o[e>>3]=s:s=h,g>c&&(o[w>>3]=g,c=g),m=g>0&gb?g:b,i|=+l(+(g-u))>3.141592653589793,(0|(r=x+1|0))!=(0|p);)B=x,h=s,x=r,r=B;i&&(o[w>>3]=b,o[y>>3]=m)}}else n[e>>2]=0,n[e+4>>2]=0,n[e+8>>2]=0,n[e+12>>2]=0,n[e+16>>2]=0,n[e+20>>2]=0,n[e+24>>2]=0,n[e+28>>2]=0;if(!((0|(r=0|n[(B=A+8|0)>>2]))<=0)){t=A+12|0,C=0;do{if(a=0|n[t>>2],i=C,y=e+((C=C+1|0)<<5)|0,w=0|n[a+(i<<3)>>2]){if(o[(x=e+(C<<5)+8|0)>>3]=17976931348623157e292,o[(A=e+(C<<5)+24|0)>>3]=17976931348623157e292,o[y>>3]=-17976931348623157e292,o[(k=e+(C<<5)+16|0)>>3]=-17976931348623157e292,(0|w)>0){for(p=0|n[a+(i<<3)+4>>2],m=17976931348623157e292,b=-17976931348623157e292,a=0,i=-1,v=0,d=17976931348623157e292,f=17976931348623157e292,g=-17976931348623157e292,c=-17976931348623157e292;s=+o[p+(v<<4)>>3],h=+o[p+(v<<4)+8>>3],u=+o[p+(((0|(i=i+2|0))==(0|w)?0:i)<<4)+8>>3],s>3]=s,d=s),h>3]=h,f=h),s>g?o[y>>3]=s:s=g,h>c&&(o[k>>3]=h,c=h),m=h>0&hb?h:b,a|=+l(+(h-u))>3.141592653589793,(0|(i=v+1|0))!=(0|w);)M=v,v=i,g=s,i=M;a&&(o[k>>3]=b,o[A>>3]=m)}}else n[y>>2]=0,n[y+4>>2]=0,n[y+8>>2]=0,n[y+12>>2]=0,n[y+16>>2]=0,n[y+20>>2]=0,n[y+24>>2]=0,n[y+28>>2]=0,r=0|n[B>>2]}while((0|C)<(0|r))}}function Me(A,e,t){var r=0,o=0,i=0;if(!(0|xe(A|=0,e|=0,t|=0)))return 0;if((0|n[(o=A+8|0)>>2])<=0)return 1;for(r=A+12|0,A=0;;){if(i=A,A=A+1|0,0|xe((0|n[r>>2])+(i<<3)|0,e+(A<<5)|0,t)){A=0,r=6;break}if((0|A)>=(0|n[o>>2])){A=1,r=6;break}}return 6==(0|r)?0|A:0}function De(A,e,t,r){r|=0;var o,i,a=0,s=0,l=0,c=0,u=0;if(i=S,S=S+16|0,o=i,!(0|xe(A|=0,e|=0,l=8+(t|=0)|0)))return S=i,0;c=A+8|0;A:do{if((0|n[c>>2])>0){for(s=A+12|0,a=0;;){if(u=a,a=a+1|0,0|xe((0|n[s>>2])+(u<<3)|0,e+(a<<5)|0,l)){a=0;break}if((0|a)>=(0|n[c>>2]))break A}return S=i,0|a}}while(0);if(0|Ee(A,e,t,r))return S=i,0;n[o>>2]=n[t>>2],n[o+4>>2]=l,a=0|n[c>>2];A:do{if((0|a)>0)for(A=A+12|0,l=0,s=a;;){if(a=0|n[A>>2],(0|n[a+(l<<3)>>2])>0){if(0|xe(o,r,0|n[a+(l<<3)+4>>2])){a=0;break A}if(a=l+1|0,0|Ee((0|n[A>>2])+(l<<3)|0,e+(a<<5)|0,t,r)){a=0;break A}s=0|n[c>>2]}else a=l+1|0;if(!((0|a)<(0|s))){a=1;break}l=a}else a=1}while(0);return S=i,0|a}function Ee(A,e,t,r){A|=0,t|=0;var i,a,s,l,c,u,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0,k=0,C=0,B=0,M=0;if(u=S,S=S+176|0,l=u+172|0,d=u+168|0,c=u,!(0|q(e|=0,r|=0)))return S=u,0;if(function(A,e,t,r){var i,a,s,l,c;e|=0,t|=0,r|=0,A=(a=+o[16+(A|=0)>>3])<(c=+o[A+24>>3]),i=(l=+o[e+16>>3])<(s=+o[e+24>>3]),e=c-l>2]=A?i|e?1:2:0,n[r>>2]=i?A?1:e?2:1:0}(e,r,l,d),st(0|c,0|t,168),(0|n[t>>2])>0){e=0;do{x=+ie(+o[(B=c+8+(e<<4)+8|0)>>3],0|n[d>>2]),o[B>>3]=x,e=e+1|0}while((0|e)<(0|n[t>>2]))}a=+o[r>>3],s=+o[r+8>>3],x=+ie(+o[r+16>>3],0|n[d>>2]),i=+ie(+o[r+24>>3],0|n[d>>2]);A:do{if((0|n[A>>2])>0){if(r=A+4|0,(0|(d=0|n[c>>2]))<=0)for(e=0;;)if((0|(e=e+1|0))>=(0|n[A>>2])){e=0;break A}for(t=0;;){if(e=0|n[r>>2],y=+o[e+(t<<4)>>3],w=+ie(+o[e+(t<<4)+8>>3],0|n[l>>2]),e=0|n[r>>2],B=(0|(t=t+1|0))%(0|n[A>>2])|0,f=+o[e+(B<<4)>>3],g=+ie(+o[e+(B<<4)+8>>3],0|n[l>>2]),!(y>=a)|!(f>=a)&&!(y<=s)|!(f<=s)&&!(w<=i)|!(g<=i)&&!(w>=x)|!(g>=x)){v=f-y,b=g-w,e=0;do{if(M=e,B=(0|(e=e+1|0))==(0|d)?0:e,f=+o[c+8+(M<<4)+8>>3],g=+o[c+8+(B<<4)+8>>3]-f,h=+o[c+8+(M<<4)>>3],!(0==(p=v*g-b*(m=+o[c+8+(B<<4)>>3]-h))||(k=w-f,C=y-h,m=(k*m-g*C)/p,m<0|m>1))&&(p=(v*k-b*C)/p)>=0&p<=1){e=1;break A}}while((0|e)<(0|d))}if((0|t)>=(0|n[A>>2])){e=0;break}}}else e=0}while(0);return S=u,0|e}function je(A,e,t,r){var o=0,i=0,a=0;if(0|Ee(A|=0,e|=0,t|=0,r|=0))return 1;if((0|n[(i=A+8|0)>>2])<=0)return 0;for(o=A+12|0,A=0;;){if(a=A,A=A+1|0,0|Ee((0|n[o>>2])+(a<<3)|0,e+(A<<5)|0,t,r)){A=1,o=6;break}if((0|A)>=(0|n[i>>2])){A=0,o=6;break}}return 6==(0|o)?0|A:0}function Qe(A,e,t,r,n){e|=0,t|=0,r|=0,n|=0;var i,a,s,l,c,u,d,f=0;l=+o[(A|=0)>>3],s=+o[e>>3]-l,a=+o[A+8>>3],i=+o[e+8>>3]-a,u=+o[t>>3],f=((f=+o[r>>3]-u)*(a-(d=+o[t+8>>3]))-(l-u)*(c=+o[r+8>>3]-d))/(s*c-i*f),o[n>>3]=l+s*f,o[n+8>>3]=a+i*f}function Ne(A,e){return e|=0,+l(+(+o[(A|=0)>>3]-+o[e>>3]))<1.1920928955078125e-7?0|(e=+l(+(+o[A+8>>3]-+o[e+8>>3]))<1.1920928955078125e-7):0|(e=0)}function Se(A,e){var t,r,n;return e|=0,+((n=+o[(A|=0)>>3]-+o[e>>3])*n+(r=+o[A+8>>3]-+o[e+8>>3])*r+(t=+o[A+16>>3]-+o[e+16>>3])*t)}function Fe(A,e,t){t|=0;var r,o,i,a,s=0,l=0,c=0,u=0;if(a=S,S=S+32|0,u=a,0|(s=0|XA(A|=0,e|=0,o=a+16|0)))return S=a,0|s;r=0|TA(A,e),i=0|OA(A,e),function(A,e){A=7696+(28*(A|=0)|0)|0,n[(e|=0)>>2]=n[A>>2],n[e+4>>2]=n[A+4>>2],n[e+8>>2]=n[A+8>>2],n[e+12>>2]=n[A+12>>2]}(r,u),s=0|function(A,e){A|=0;var t=0,r=0;if((e|=0)>>>0>20)return-1;do{if((0|n[11120+(216*e|0)>>2])!=(0|A))if((0|n[11120+(216*e|0)+8>>2])!=(0|A))if((0|n[11120+(216*e|0)+16>>2])!=(0|A))if((0|n[11120+(216*e|0)+24>>2])!=(0|A))if((0|n[11120+(216*e|0)+32>>2])!=(0|A))if((0|n[11120+(216*e|0)+40>>2])!=(0|A))if((0|n[11120+(216*e|0)+48>>2])!=(0|A))if((0|n[11120+(216*e|0)+56>>2])!=(0|A))if((0|n[11120+(216*e|0)+64>>2])!=(0|A))if((0|n[11120+(216*e|0)+72>>2])!=(0|A))if((0|n[11120+(216*e|0)+80>>2])!=(0|A))if((0|n[11120+(216*e|0)+88>>2])!=(0|A))if((0|n[11120+(216*e|0)+96>>2])!=(0|A))if((0|n[11120+(216*e|0)+104>>2])!=(0|A))if((0|n[11120+(216*e|0)+112>>2])!=(0|A))if((0|n[11120+(216*e|0)+120>>2])!=(0|A))if((0|n[11120+(216*e|0)+128>>2])!=(0|A)){if((0|n[11120+(216*e|0)+136>>2])!=(0|A)){if((0|n[11120+(216*e|0)+144>>2])==(0|A)){A=0,t=2,r=0;break}if((0|n[11120+(216*e|0)+152>>2])==(0|A)){A=0,t=2,r=1;break}if((0|n[11120+(216*e|0)+160>>2])==(0|A)){A=0,t=2,r=2;break}if((0|n[11120+(216*e|0)+168>>2])==(0|A)){A=1,t=2,r=0;break}if((0|n[11120+(216*e|0)+176>>2])==(0|A)){A=1,t=2,r=1;break}if((0|n[11120+(216*e|0)+184>>2])==(0|A)){A=1,t=2,r=2;break}if((0|n[11120+(216*e|0)+192>>2])==(0|A)){A=2,t=2,r=0;break}if((0|n[11120+(216*e|0)+200>>2])==(0|A)){A=2,t=2,r=1;break}if((0|n[11120+(216*e|0)+208>>2])==(0|A)){A=2,t=2,r=2;break}return-1}A=2,t=1,r=2}else A=2,t=1,r=1;else A=2,t=1,r=0;else A=1,t=1,r=2;else A=1,t=1,r=1;else A=1,t=1,r=0;else A=0,t=1,r=2;else A=0,t=1,r=1;else A=0,t=1,r=0;else A=2,t=0,r=2;else A=2,t=0,r=1;else A=2,t=0,r=0;else A=1,t=0,r=2;else A=1,t=0,r=1;else A=1,t=0,r=0;else A=0,t=0,r=2;else A=0,t=0,r=1;else A=0,t=0,r=0}while(0);return 0|n[11120+(216*e|0)+(72*t|0)+(24*A|0)+(r<<3)+4>>2]}(r,0|n[o>>2]);do{if(0|H(r)){switch(0|r){case 4:l=0;break;case 14:l=1;break;case 24:l=2;break;case 38:l=3;break;case 49:l=4;break;case 58:l=5;break;case 63:l=6;break;case 72:l=7;break;case 83:l=8;break;case 97:l=9;break;case 107:l=10;break;case 117:l=11;break;default:M(27795,27797,75,27806)}if(c=0|n[26416+(24*l|0)+8>>2],e=0|n[26416+(24*l|0)+16>>2],(0|(A=0|n[o>>2]))!=(0|n[u>>2])&&(u=0|G(r))|(0|(A=0|n[o>>2]))==(0|e)&&(s=(s+1|0)%6|0),3==(0|i)&(0|A)==(0|e)){s=(s+5|0)%6|0;break}5==(0|i)&(0|A)==(0|c)&&(s=(s+1|0)%6|0)}}while(0);return n[t>>2]=s,S=a,0}function Pe(A,e,t,r){t|=0,r|=0;var o,i,a,s,l,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0;if(l=S,S=S+32|0,y=l+24|0,s=l+20|0,a=l+8|0,i=l+16|0,o=l,g=(g=!(0|zA(A|=0,e|=0)))?6:5,m=0|tt(0|A,0|e,52),B(),g>>>0<=t>>>0)return S=l,2;!(b=!(0|(m&=15)))&&!((p=0|rt(7,0,3*(15^m)|0))&A)&!((0|B())&e)?c=t:u=4;A:do{if(4==(0|u)){if((0|((c=!!(0|zA(A,e)))?4:5))<(0|t))return S=l,1;if(0|Fe(A,e,y))return S=l,1;if(u=(0|n[y>>2])+t|0,7==(0|(p=0|n[(c=c?26704+((0|u)%5<<2)|0:26736+((0|u)%6<<2)|0)>>2])))return S=l,1;n[s>>2]=0,c=0|R(A,e,p,s,a);do{if(!c){if(h=0|n[(f=a)>>2],u=(d=(f=0|n[f+4>>2])>>>0>>0|(0|f)==(0|e)&h>>>0>>0)?h:A,d=d?f:e,!b&&!(h&(b=0|rt(7,0,3*(15^m)|0)))&!(f&(0|B())))c=t;else{if(f=(t+-1+g|0)%(0|g)|0,c=0|zA(A,e),(0|f)<0&&M(27795,27797,248,27822),(0|((g=!!(0|c))?4:5))<(0|f)&&M(27795,27797,248,27822),0|Fe(A,e,y)&&M(27795,27797,248,27822),c=(0|n[y>>2])+f|0,7==(0|(f=0|n[(c=g?26704+((0|c)%5<<2)|0:26736+((0|c)%6<<2)|0)>>2]))&&M(27795,27797,248,27822),n[i>>2]=0,0|(c=0|R(A,e,f,i,o)))break;g=0|n[(h=o)>>2],h=0|n[h+4>>2];do{if(h>>>0>>0|(0|h)==(0|d)&g>>>0>>0){if(u=0|zA(g,h)?0|_(g,h,A,e):0|n[26800+(((0|n[i>>2])+(0|n[26768+(f<<2)>>2])|0)%6<<2)>>2],c=0|zA(g,h),(u+-1|0)>>>0>5){c=-1,u=g,d=h;break}if(1==(0|u)&(c=!!(0|c))){c=-1,u=g,d=h;break}do{if(!(0|Fe(g,h,y))){if(c){c=(5+(0|n[26352+(u<<2)>>2])-(0|n[y>>2])|0)%5|0;break}c=(6+(0|n[26384+(u<<2)>>2])-(0|n[y>>2])|0)%6|0;break}c=-1}while(0);u=g,d=h}else c=t}while(0);h=0|n[(f=a)>>2],f=0|n[f+4>>2]}if((0|u)==(0|h)&(0|d)==(0|f)){if(A=(g=!!(0|zA(h,f)))?0|_(h,f,A,e):0|n[26800+(((0|n[s>>2])+(0|n[26768+(p<<2)>>2])|0)%6<<2)>>2],c=0|zA(h,f),(A+-1|0)>>>0<=5&&!(1==(0|A)&(v=!!(0|c))))do{if(!(0|Fe(h,f,y))){if(v){c=(5+(0|n[26352+(A<<2)>>2])-(0|n[y>>2])|0)%5|0;break}c=(6+(0|n[26384+(A<<2)>>2])-(0|n[y>>2])|0)%6|0;break}c=-1}while(0);else c=-1;c=6==(0|(c=c+1|0))|g&5==(0|c)?0:c}e=d,A=u;break A}}while(0);return S=l,0|c}}while(0);return v=0|rt(0|c,0,56),y=B()|-2130706433&e|536870912,n[r>>2]=v|A,n[r+4>>2]=y,S=l,0}function Te(A,e){A|=0;var t,r,o=0,i=0;return r=S,S=S+16|0,t=r,!0&536870912==(2013265920&(e|=0))&&0|LA(A,o=-2130706433&e|134217728)?(i=0|tt(0|A,0|e,56),B(),o=(i=!(0|Pe(A,o,7&i,t)))&((0|n[(o=t)>>2])==(0|A)?(0|n[o+4>>2])==(0|e):0)&1,S=r,0|o):(S=r,0|(o=0))}function Le(A,e,t){A|=0,t|=0;var r=0;(0|(e|=0))>0?(r=0|We(e,4),n[A>>2]=r,r||M(27835,27858,40,27872)):n[A>>2]=0,n[A+4>>2]=e,n[A+8>>2]=0,n[A+12>>2]=t}function Re(A){var e,t,r,i=0,a=0,s=0,c=0;e=4+(A|=0)|0,t=A+12|0,r=A+8|0;A:for(;;){for(a=0|n[e>>2],i=0;;){if((0|i)>=(0|a))break A;if(s=0|n[A>>2],c=0|n[s+(i<<2)>>2])break;i=i+1|0}i=s+(~~(+l(+ +u(10,+ +(15-(0|n[t>>2])|0))*(+o[c>>3]+ +o[c+8>>3]))%+(0|a))>>>0<<2)|0,a=0|n[i>>2];e:do{if(0|a){if(s=c+32|0,(0|a)==(0|c))n[i>>2]=n[s>>2];else{if(!(i=0|n[(a=a+32|0)>>2]))break;for(;(0|i)!=(0|c);)if(!(i=0|n[(a=i+32|0)>>2]))break e;n[a>>2]=n[s>>2]}Ye(c),n[r>>2]=(0|n[r>>2])-1}}while(0)}Ye(0|n[A>>2])}function Ie(A){var e,t=0,r=0;for(e=0|n[4+(A|=0)>>2],r=0;;){if((0|r)>=(0|e)){t=0,r=4;break}if(t=0|n[(0|n[A>>2])+(r<<2)>>2]){r=4;break}r=r+1|0}return 4==(0|r)?0|t:0}function _e(A,e){e|=0;var t=0,r=0,i=0,a=0;if(t=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,t=(0|n[A>>2])+(t<<2)|0,!(r=0|n[t>>2]))return 1;a=e+32|0;do{if((0|r)!=(0|e)){if(!(t=0|n[r+32>>2]))return 1;for(i=t;;){if((0|i)==(0|e)){i=8;break}if(!(t=0|n[i+32>>2])){t=1,i=10;break}r=i,i=t}if(8==(0|i)){n[r+32>>2]=n[a>>2];break}if(10==(0|i))return 0|t}else n[t>>2]=n[a>>2]}while(0);return Ye(e),n[(a=A+8|0)>>2]=(0|n[a>>2])-1,0}function ze(A,e,t){A|=0,e|=0,t|=0;var r,i=0,a=0,s=0;(r=0|Ue(40))||M(27888,27858,98,27901),n[r>>2]=n[e>>2],n[r+4>>2]=n[e+4>>2],n[r+8>>2]=n[e+8>>2],n[r+12>>2]=n[e+12>>2],n[(a=r+16|0)>>2]=n[t>>2],n[a+4>>2]=n[t+4>>2],n[a+8>>2]=n[t+8>>2],n[a+12>>2]=n[t+12>>2],n[r+32>>2]=0,a=~~(+l(+ +u(10,+ +(15-(0|n[A+12>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,a=(0|n[A>>2])+(a<<2)|0,i=0|n[a>>2];do{if(i){for(;!(0|oe(i,e)&&0|oe(i+16|0,t));)if(a=0|n[i+32>>2],!(0|n[(i=0|a?a:i)+32>>2])){s=10;break}if(10==(0|s)){n[i+32>>2]=r;break}return Ye(r),0|i}n[a>>2]=r}while(0);return n[(s=A+8|0)>>2]=1+(0|n[s>>2]),0|r}function He(A,e,t){e|=0,t|=0;var r=0,i=0;if(i=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,!(i=0|n[(0|n[A>>2])+(i<<2)>>2]))return 0;if(!t){for(A=i;;){if(0|oe(A,e)){r=10;break}if(!(A=0|n[A+32>>2])){A=0,r=10;break}}if(10==(0|r))return 0|A}for(A=i;;){if(0|oe(A,e)&&0|oe(A+16|0,t)){r=10;break}if(!(A=0|n[A+32>>2])){A=0,r=10;break}}return 10==(0|r)?0|A:0}function Ge(A,e){e|=0;var t=0;if(t=~~(+l(+ +u(10,+ +(15-(0|n[12+(A|=0)>>2])|0))*(+o[e>>3]+ +o[e+8>>3]))%+(0|n[A+4>>2]))>>>0,!(A=0|n[(0|n[A>>2])+(t<<2)>>2]))return 0;for(;;){if(0|oe(A,e)){e=5;break}if(!(A=0|n[A+32>>2])){A=0,e=5;break}}return 5==(0|e)?0|A:0}function Oe(A){return 0|+ct(+(A=+A))}function Ue(A){A|=0;var e,t=0,r=0,o=0,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0;e=S,S=S+16|0,g=e;do{if(A>>>0<245){if(A=(u=A>>>0<11?16:A+11&-8)>>>3,3&(r=(f=0|n[6981])>>>A))return o=0|n[(r=8+(A=27964+((t=(1&r^1)+A|0)<<1<<2)|0)|0)>>2],(0|(a=0|n[(i=o+8|0)>>2]))==(0|A)?n[6981]=f&~(1<>2]=A,n[r>>2]=a),x=t<<3,n[o+4>>2]=3|x,n[(x=o+x+4|0)>>2]=1|n[x>>2],S=e,0|i;if(u>>>0>(d=0|n[6983])>>>0){if(0|r)return t=((t=r<>>=l=t>>>12&16)>>>5&8)|l|(a=(t>>>=r)>>>2&4)|(A=(t>>>=a)>>>1&2)|(o=(t>>>=A)>>>1&1))+(t>>>o)|0)<<1<<2)|0)|0)>>2],(0|(r=0|n[(l=a+8|0)>>2]))==(0|t)?(A=f&~(1<>2]=t,n[A>>2]=r,A=f),s=(x=o<<3)-u|0,n[a+4>>2]=3|u,n[4+(i=a+u|0)>>2]=1|s,n[a+x>>2]=s,0|d&&(o=0|n[6986],r=27964+((t=d>>>3)<<1<<2)|0,A&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=o,n[t+12>>2]=o,n[o+8>>2]=t,n[o+12>>2]=r),n[6983]=s,n[6986]=i,S=e,0|l;if(a=0|n[6982]){for(r=(a&0-a)-1|0,r=c=0|n[28228+(((o=(r>>>=i=r>>>12&16)>>>5&8)|i|(s=(r>>>=o)>>>2&4)|(l=(r>>>=s)>>>1&2)|(c=(r>>>=l)>>>1&1))+(r>>>c)<<2)>>2],l=c,c=(-8&n[c+4>>2])-u|0;(A=0|n[r+16>>2])||(A=0|n[r+20>>2]);)r=A,l=(i=(s=(-8&n[A+4>>2])-u|0)>>>0>>0)?A:l,c=i?s:c;if((s=l+u|0)>>>0>l>>>0){i=0|n[l+24>>2],t=0|n[l+12>>2];do{if((0|t)==(0|l)){if(!(t=0|n[(A=l+20|0)>>2])&&!(t=0|n[(A=l+16|0)>>2])){r=0;break}for(;;)if(r=0|n[(o=t+20|0)>>2])t=r,A=o;else{if(!(r=0|n[(o=t+16|0)>>2]))break;t=r,A=o}n[A>>2]=0,r=t}else r=0|n[l+8>>2],n[r+12>>2]=t,n[t+8>>2]=r,r=t}while(0);do{if(0|i){if(t=0|n[l+28>>2],(0|l)==(0|n[(A=28228+(t<<2)|0)>>2])){if(n[A>>2]=r,!r){n[6982]=a&~(1<>2])==(0|l)?x:i+20)>>2]=r,!r)break;n[r+24>>2]=i,0|(t=0|n[l+16>>2])&&(n[r+16>>2]=t,n[t+24>>2]=r),0|(t=0|n[l+20>>2])&&(n[r+20>>2]=t,n[t+24>>2]=r)}}while(0);return c>>>0<16?(x=c+u|0,n[l+4>>2]=3|x,n[(x=l+x+4|0)>>2]=1|n[x>>2]):(n[l+4>>2]=3|u,n[s+4>>2]=1|c,n[s+c>>2]=c,0|d&&(o=0|n[6986],r=27964+((t=d>>>3)<<1<<2)|0,(t=1<>2]:(n[6981]=t|f,t=r,A=r+8|0),n[A>>2]=o,n[t+12>>2]=o,n[o+8>>2]=t,n[o+12>>2]=r),n[6983]=c,n[6986]=s),S=e,0|l+8}f=u}else f=u}else f=u}else if(A>>>0<=4294967231)if(u=-8&(A=A+11|0),o=0|n[6982]){i=0-u|0,c=(A>>>=8)?u>>>0>16777215?31:u>>>(7+(c=14-((l=(520192+(b=A<<(f=(A+1048320|0)>>>16&8))|0)>>>16&4)|f|(c=(245760+(b<<=l)|0)>>>16&2))+(b<>>15)|0)|0)&1|c<<1:0,r=0|n[28228+(c<<2)>>2];A:do{if(r)for(A=0,l=u<<(31==(0|c)?0:25-(c>>>1)|0),a=0;;){if((s=(-8&n[r+4>>2])-u|0)>>>0>>0){if(!s){A=r,i=0,b=65;break A}A=r,i=s}if(a=!(0|(b=0|n[r+20>>2]))|(0|b)==(0|(r=0|n[r+16+(l>>>31<<2)>>2]))?a:b,!r){r=a,b=61;break}l<<=1}else r=0,A=0,b=61}while(0);if(61==(0|b)){if(!(0|r)&!(0|A)){if(!(A=((A=2<>>=s=f>>>12&16)>>>5&8)|s|(l=(f>>>=a)>>>2&4)|(c=(f>>>=l)>>>1&2)|(r=(f>>>=c)>>>1&1))+(f>>>r)<<2)>>2]}r?b=65:(l=A,s=i)}if(65==(0|b))for(a=r;;){if(i=(r=(f=(-8&n[a+4>>2])-u|0)>>>0>>0)?f:i,A=r?a:A,(r=0|n[a+16>>2])||(r=0|n[a+20>>2]),!r){l=A,s=i;break}a=r}if(0|l&&s>>>0<((0|n[6983])-u|0)>>>0&&(d=l+u|0)>>>0>l>>>0){a=0|n[l+24>>2],t=0|n[l+12>>2];do{if((0|t)==(0|l)){if(!(t=0|n[(A=l+20|0)>>2])&&!(t=0|n[(A=l+16|0)>>2])){t=0;break}for(;;)if(r=0|n[(i=t+20|0)>>2])t=r,A=i;else{if(!(r=0|n[(i=t+16|0)>>2]))break;t=r,A=i}n[A>>2]=0}else x=0|n[l+8>>2],n[x+12>>2]=t,n[t+8>>2]=x}while(0);do{if(a){if(A=0|n[l+28>>2],(0|l)==(0|n[(r=28228+(A<<2)|0)>>2])){if(n[r>>2]=t,!t){o&=~(1<>2])==(0|l)?x:a+20)>>2]=t,!t)break;n[t+24>>2]=a,0|(A=0|n[l+16>>2])&&(n[t+16>>2]=A,n[A+24>>2]=t),(A=0|n[l+20>>2])&&(n[t+20>>2]=A,n[A+24>>2]=t)}}while(0);A:do{if(s>>>0<16)x=s+u|0,n[l+4>>2]=3|x,n[(x=l+x+4|0)>>2]=1|n[x>>2];else{if(n[l+4>>2]=3|u,n[d+4>>2]=1|s,n[d+s>>2]=s,t=s>>>3,s>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=d,n[t+12>>2]=d,n[d+8>>2]=t,n[d+12>>2]=r;break}if(t=28228+((r=(t=s>>>8)?s>>>0>16777215?31:s>>>(7+(r=14-((y=(520192+(x=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(r=(245760+(x<<=y)|0)>>>16&2))+(x<>>15)|0)|0)&1|r<<1:0)<<2)|0,n[d+28>>2]=r,n[4+(A=d+16|0)>>2]=0,n[A>>2]=0,!(o&(A=1<>2]=d,n[d+24>>2]=t,n[d+12>>2]=d,n[d+8>>2]=d;break}t=0|n[t>>2];e:do{if((-8&n[t+4>>2])!=(0|s)){for(o=s<<(31==(0|r)?0:25-(r>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|s)){t=A;break e}o<<=1,t=A}n[r>>2]=d,n[d+24>>2]=t,n[d+12>>2]=d,n[d+8>>2]=d;break A}}while(0);x=0|n[(w=t+8|0)>>2],n[x+12>>2]=d,n[w>>2]=d,n[d+8>>2]=x,n[d+12>>2]=t,n[d+24>>2]=0}}while(0);return S=e,0|l+8}f=u}else f=u;else f=-1}while(0);if((r=0|n[6983])>>>0>=f>>>0)return t=r-f|0,A=0|n[6986],t>>>0>15?(x=A+f|0,n[6986]=x,n[6983]=t,n[x+4>>2]=1|t,n[A+r>>2]=t,n[A+4>>2]=3|f):(n[6983]=0,n[6986]=0,n[A+4>>2]=3|r,n[(x=A+r+4|0)>>2]=1|n[x>>2]),S=e,0|A+8;if((s=0|n[6984])>>>0>f>>>0)return y=s-f|0,n[6984]=y,w=(x=0|n[6987])+f|0,n[6987]=w,n[w+4>>2]=1|y,n[x+4>>2]=3|f,S=e,0|x+8;if(0|n[7099]?A=0|n[7101]:(n[7101]=4096,n[7100]=4096,n[7102]=-1,n[7103]=-1,n[7104]=0,n[7092]=0,n[7099]=-16&g^1431655768,A=4096),l=f+48|0,(u=(a=A+(c=f+47|0)|0)&(i=0-A|0))>>>0<=f>>>0)return S=e,0;if(0|(A=0|n[7091])&&(g=(d=0|n[7089])+u|0)>>>0<=d>>>0|g>>>0>A>>>0)return S=e,0;A:do{if(4&n[7092])t=0,b=143;else{r=0|n[6987];e:do{if(r){for(o=28372;!((g=0|n[o>>2])>>>0<=r>>>0&&(g+(0|n[o+4>>2])|0)>>>0>r>>>0);){if(!(A=0|n[o+8>>2])){b=128;break e}o=A}if((t=a-s&i)>>>0<2147483647)if((0|(A=0|ut(0|t)))==((0|n[o>>2])+(0|n[o+4>>2])|0)){if(-1!=(0|A)){s=t,a=A,b=145;break A}}else o=A,b=136;else t=0}else b=128}while(0);do{if(128==(0|b))if(-1!=(0|(r=0|ut(0)))&&(t=r,m=(t=((m=(h=0|n[7100])-1|0)&t?(m+t&0-h)-t|0:0)+u|0)+(h=0|n[7089])|0,t>>>0>f>>>0&t>>>0<2147483647)){if(0|(g=0|n[7091])&&m>>>0<=h>>>0|m>>>0>g>>>0){t=0;break}if((0|(A=0|ut(0|t)))==(0|r)){s=t,a=r,b=145;break A}o=A,b=136}else t=0}while(0);do{if(136==(0|b)){if(r=0-t|0,!(l>>>0>t>>>0&t>>>0<2147483647&-1!=(0|o))){if(-1==(0|o)){t=0;break}s=t,a=o,b=145;break A}if((A=c-t+(A=0|n[7101])&0-A)>>>0>=2147483647){s=t,a=o,b=145;break A}if(-1==(0|ut(0|A))){ut(0|r),t=0;break}s=A+t|0,a=o,b=145;break A}}while(0);n[7092]=4|n[7092],b=143}}while(0);if(143==(0|b)&&u>>>0<2147483647&&!(-1==(0|(y=0|ut(0|u)))|1^(v=(p=(m=0|ut(0))-y|0)>>>0>(f+40|0)>>>0)|y>>>0>>0&-1!=(0|y)&-1!=(0|m)^1)&&(s=v?p:t,a=y,b=145),145==(0|b)){t=(0|n[7089])+s|0,n[7089]=t,t>>>0>(0|n[7090])>>>0&&(n[7090]=t),c=0|n[6987];A:do{if(c){for(t=28372;;){if((0|a)==((A=0|n[t>>2])+(r=0|n[t+4>>2])|0)){b=154;break}if(!(o=0|n[t+8>>2]))break;t=o}if(!(154!=(0|b)||(w=t+4|0,8&n[t+12>>2]))&&a>>>0>c>>>0&A>>>0<=c>>>0){n[w>>2]=r+s,w=c+(y=7&(y=c+8|0)?0-y&7:0)|0,y=(x=(0|n[6984])+s|0)-y|0,n[6987]=w,n[6984]=y,n[w+4>>2]=1|y,n[c+x+4>>2]=40,n[6988]=n[7103];break}for(a>>>0<(0|n[6985])>>>0&&(n[6985]=a),r=a+s|0,t=28372;;){if((0|n[t>>2])==(0|r)){b=162;break}if(!(A=0|n[t+8>>2]))break;t=A}if(162==(0|b)&&!(8&n[t+12>>2])){n[t>>2]=a,n[(d=t+4|0)>>2]=(0|n[d>>2])+s,u=(d=a+(7&(d=a+8|0)?0-d&7:0)|0)+f|0,l=(t=r+(7&(t=r+8|0)?0-t&7:0)|0)-d-f|0,n[d+4>>2]=3|f;e:do{if((0|c)==(0|t))x=(0|n[6984])+l|0,n[6984]=x,n[6987]=u,n[u+4>>2]=1|x;else{if((0|n[6986])==(0|t)){x=(0|n[6983])+l|0,n[6983]=x,n[6986]=u,n[u+4>>2]=1|x,n[u+x>>2]=x;break}if(1==(3&(A=0|n[t+4>>2]))){s=-8&A,o=A>>>3;t:do{if(A>>>0<256){if(A=0|n[t+8>>2],(0|(r=0|n[t+12>>2]))==(0|A)){n[6981]=n[6981]&~(1<>2]=r,n[r+8>>2]=A;break}a=0|n[t+24>>2],A=0|n[t+12>>2];do{if((0|A)==(0|t)){if(A=0|n[(o=4+(r=t+16|0)|0)>>2])r=o;else if(!(A=0|n[r>>2])){A=0;break}for(;;)if(o=0|n[(i=A+20|0)>>2])A=o,r=i;else{if(!(o=0|n[(i=A+16|0)>>2]))break;A=o,r=i}n[r>>2]=0}else x=0|n[t+8>>2],n[x+12>>2]=A,n[A+8>>2]=x}while(0);if(!a)break;o=28228+((r=0|n[t+28>>2])<<2)|0;do{if((0|n[o>>2])==(0|t)){if(n[o>>2]=A,0|A)break;n[6982]=n[6982]&~(1<>2])==(0|t)?x:a+20)>>2]=A,!A)break t}while(0);if(n[A+24>>2]=a,0|(o=0|n[(r=t+16|0)>>2])&&(n[A+16>>2]=o,n[o+24>>2]=A),!(r=0|n[r+4>>2]))break;n[A+20>>2]=r,n[r+24>>2]=A}while(0);t=t+s|0,i=s+l|0}else i=l;if(n[(t=t+4|0)>>2]=-2&n[t>>2],n[u+4>>2]=1|i,n[u+i>>2]=i,t=i>>>3,i>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=u,n[t+12>>2]=u,n[u+8>>2]=t,n[u+12>>2]=r;break}t=i>>>8;do{if(t){if(i>>>0>16777215){o=31;break}o=i>>>(7+(o=14-((y=(520192+(x=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(o=(245760+(x<<=y)|0)>>>16&2))+(x<>>15)|0)|0)&1|o<<1}else o=0}while(0);if(t=28228+(o<<2)|0,n[u+28>>2]=o,n[4+(A=u+16|0)>>2]=0,n[A>>2]=0,!((A=0|n[6982])&(r=1<>2]=u,n[u+24>>2]=t,n[u+12>>2]=u,n[u+8>>2]=u;break}t=0|n[t>>2];t:do{if((-8&n[t+4>>2])!=(0|i)){for(o=i<<(31==(0|o)?0:25-(o>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|i)){t=A;break t}o<<=1,t=A}n[r>>2]=u,n[u+24>>2]=t,n[u+12>>2]=u,n[u+8>>2]=u;break e}}while(0);x=0|n[(w=t+8|0)>>2],n[x+12>>2]=u,n[w>>2]=u,n[u+8>>2]=x,n[u+12>>2]=t,n[u+24>>2]=0}}while(0);return S=e,0|d+8}for(t=28372;!((A=0|n[t>>2])>>>0<=c>>>0&&(x=A+(0|n[t+4>>2])|0)>>>0>c>>>0);)t=0|n[t+8>>2];t=(A=(A=(i=x+-47|0)+(7&(A=i+8|0)?0-A&7:0)|0)>>>0<(i=c+16|0)>>>0?c:A)+8|0,w=a+(y=7&(y=a+8|0)?0-y&7:0)|0,y=(r=s+-40|0)-y|0,n[6987]=w,n[6984]=y,n[w+4>>2]=1|y,n[a+r+4>>2]=40,n[6988]=n[7103],n[(r=A+4|0)>>2]=27,n[t>>2]=n[7093],n[t+4>>2]=n[7094],n[t+8>>2]=n[7095],n[t+12>>2]=n[7096],n[7093]=a,n[7094]=s,n[7096]=0,n[7095]=t,t=A+24|0;do{w=t,n[(t=t+4|0)>>2]=7}while((w+8|0)>>>0>>0);if((0|A)!=(0|c)){if(a=A-c|0,n[r>>2]=-2&n[r>>2],n[c+4>>2]=1|a,n[A>>2]=a,t=a>>>3,a>>>0<256){r=27964+(t<<1<<2)|0,(A=0|n[6981])&(t=1<>2]:(n[6981]=A|t,t=r,A=r+8|0),n[A>>2]=c,n[t+12>>2]=c,n[c+8>>2]=t,n[c+12>>2]=r;break}if(r=28228+((o=(t=a>>>8)?a>>>0>16777215?31:a>>>(7+(o=14-((y=(520192+(x=t<<(w=(t+1048320|0)>>>16&8))|0)>>>16&4)|w|(o=(245760+(x<<=y)|0)>>>16&2))+(x<>>15)|0)|0)&1|o<<1:0)<<2)|0,n[c+28>>2]=o,n[c+20>>2]=0,n[i>>2]=0,!((t=0|n[6982])&(A=1<>2]=c,n[c+24>>2]=r,n[c+12>>2]=c,n[c+8>>2]=c;break}t=0|n[r>>2];e:do{if((-8&n[t+4>>2])!=(0|a)){for(o=a<<(31==(0|o)?0:25-(o>>>1)|0);A=0|n[(r=t+16+(o>>>31<<2)|0)>>2];){if((-8&n[A+4>>2])==(0|a)){t=A;break e}o<<=1,t=A}n[r>>2]=c,n[c+24>>2]=t,n[c+12>>2]=c,n[c+8>>2]=c;break A}}while(0);x=0|n[(w=t+8|0)>>2],n[x+12>>2]=c,n[w>>2]=c,n[c+8>>2]=x,n[c+12>>2]=t,n[c+24>>2]=0}}else!(0|(x=0|n[6985]))|a>>>0>>0&&(n[6985]=a),n[7093]=a,n[7094]=s,n[7096]=0,n[6990]=n[7099],n[6989]=-1,n[6994]=27964,n[6993]=27964,n[6996]=27972,n[6995]=27972,n[6998]=27980,n[6997]=27980,n[7e3]=27988,n[6999]=27988,n[7002]=27996,n[7001]=27996,n[7004]=28004,n[7003]=28004,n[7006]=28012,n[7005]=28012,n[7008]=28020,n[7007]=28020,n[7010]=28028,n[7009]=28028,n[7012]=28036,n[7011]=28036,n[7014]=28044,n[7013]=28044,n[7016]=28052,n[7015]=28052,n[7018]=28060,n[7017]=28060,n[7020]=28068,n[7019]=28068,n[7022]=28076,n[7021]=28076,n[7024]=28084,n[7023]=28084,n[7026]=28092,n[7025]=28092,n[7028]=28100,n[7027]=28100,n[7030]=28108,n[7029]=28108,n[7032]=28116,n[7031]=28116,n[7034]=28124,n[7033]=28124,n[7036]=28132,n[7035]=28132,n[7038]=28140,n[7037]=28140,n[7040]=28148,n[7039]=28148,n[7042]=28156,n[7041]=28156,n[7044]=28164,n[7043]=28164,n[7046]=28172,n[7045]=28172,n[7048]=28180,n[7047]=28180,n[7050]=28188,n[7049]=28188,n[7052]=28196,n[7051]=28196,n[7054]=28204,n[7053]=28204,n[7056]=28212,n[7055]=28212,w=a+(y=7&(y=a+8|0)?0-y&7:0)|0,y=(x=s+-40|0)-y|0,n[6987]=w,n[6984]=y,n[w+4>>2]=1|y,n[a+x+4>>2]=40,n[6988]=n[7103]}while(0);if((t=0|n[6984])>>>0>f>>>0)return y=t-f|0,n[6984]=y,w=(x=0|n[6987])+f|0,n[6987]=w,n[w+4>>2]=1|y,n[x+4>>2]=3|f,S=e,0|x+8}return n[(x=27920)>>2]=12,S=e,0}function Ye(A){var e=0,t=0,r=0,o=0,i=0,a=0,s=0,l=0;if(A|=0){t=A+-8|0,o=0|n[6985],l=t+(e=-8&(A=0|n[A+-4>>2]))|0;do{if(1&A)s=t,a=t;else{if(r=0|n[t>>2],!(3&A))return;if(i=r+e|0,(a=t+(0-r)|0)>>>0>>0)return;if((0|n[6986])==(0|a)){if(3&~(e=0|n[(A=l+4|0)>>2])){s=a,e=i;break}return n[6983]=i,n[A>>2]=-2&e,n[a+4>>2]=1|i,void(n[a+i>>2]=i)}if(t=r>>>3,r>>>0<256){if(A=0|n[a+8>>2],(0|(e=0|n[a+12>>2]))==(0|A)){n[6981]=n[6981]&~(1<>2]=e,n[e+8>>2]=A,s=a,e=i;break}o=0|n[a+24>>2],A=0|n[a+12>>2];do{if((0|A)==(0|a)){if(A=0|n[(t=4+(e=a+16|0)|0)>>2])e=t;else if(!(A=0|n[e>>2])){A=0;break}for(;;)if(t=0|n[(r=A+20|0)>>2])A=t,e=r;else{if(!(t=0|n[(r=A+16|0)>>2]))break;A=t,e=r}n[e>>2]=0}else s=0|n[a+8>>2],n[s+12>>2]=A,n[A+8>>2]=s}while(0);if(o){if(e=0|n[a+28>>2],(0|n[(t=28228+(e<<2)|0)>>2])==(0|a)){if(n[t>>2]=A,!A){n[6982]=n[6982]&~(1<>2])==(0|a)?s:o+20)>>2]=A,!A){s=a,e=i;break}n[A+24>>2]=o,0|(t=0|n[(e=a+16|0)>>2])&&(n[A+16>>2]=t,n[t+24>>2]=A),(e=0|n[e+4>>2])?(n[A+20>>2]=e,n[e+24>>2]=A,s=a,e=i):(s=a,e=i)}else s=a,e=i}}while(0);if(!(a>>>0>=l>>>0)&&1&(r=0|n[(A=l+4|0)>>2])){if(2&r)n[A>>2]=-2&r,n[s+4>>2]=1|e,n[a+e>>2]=e,o=e;else{if((0|n[6987])==(0|l)){if(l=(0|n[6984])+e|0,n[6984]=l,n[6987]=s,n[s+4>>2]=1|l,(0|s)!=(0|n[6986]))return;return n[6986]=0,void(n[6983]=0)}if((0|n[6986])==(0|l))return l=(0|n[6983])+e|0,n[6983]=l,n[6986]=a,n[s+4>>2]=1|l,void(n[a+l>>2]=l);o=(-8&r)+e|0,t=r>>>3;do{if(r>>>0<256){if(e=0|n[l+8>>2],(0|(A=0|n[l+12>>2]))==(0|e)){n[6981]=n[6981]&~(1<>2]=A,n[A+8>>2]=e;break}i=0|n[l+24>>2],A=0|n[l+12>>2];do{if((0|A)==(0|l)){if(A=0|n[(t=4+(e=l+16|0)|0)>>2])e=t;else if(!(A=0|n[e>>2])){t=0;break}for(;;)if(t=0|n[(r=A+20|0)>>2])A=t,e=r;else{if(!(t=0|n[(r=A+16|0)>>2]))break;A=t,e=r}n[e>>2]=0,t=A}else t=0|n[l+8>>2],n[t+12>>2]=A,n[A+8>>2]=t,t=A}while(0);if(0|i){if(A=0|n[l+28>>2],(0|n[(e=28228+(A<<2)|0)>>2])==(0|l)){if(n[e>>2]=t,!t){n[6982]=n[6982]&~(1<>2])==(0|l)?r:i+20)>>2]=t,!t)break;n[t+24>>2]=i,0|(e=0|n[(A=l+16|0)>>2])&&(n[t+16>>2]=e,n[e+24>>2]=t),0|(A=0|n[A+4>>2])&&(n[t+20>>2]=A,n[A+24>>2]=t)}}while(0);if(n[s+4>>2]=1|o,n[a+o>>2]=o,(0|s)==(0|n[6986]))return void(n[6983]=o)}if(A=o>>>3,o>>>0<256)return t=27964+(A<<1<<2)|0,(e=0|n[6981])&(A=1<>2]:(n[6981]=e|A,A=t,e=t+8|0),n[e>>2]=s,n[A+12>>2]=s,n[s+8>>2]=A,void(n[s+12>>2]=t);A=28228+((r=(A=o>>>8)?o>>>0>16777215?31:o>>>(7+(r=14-((i=(520192+(l=A<<(a=(A+1048320|0)>>>16&8))|0)>>>16&4)|a|(r=(245760+(l<<=i)|0)>>>16&2))+(l<>>15)|0)|0)&1|r<<1:0)<<2)|0,n[s+28>>2]=r,n[s+20>>2]=0,n[s+16>>2]=0,e=0|n[6982],t=1<>2];e:do{if((-8&n[A+4>>2])!=(0|o)){for(r=o<<(31==(0|r)?0:25-(r>>>1)|0);e=0|n[(t=A+16+(r>>>31<<2)|0)>>2];){if((-8&n[e+4>>2])==(0|o)){A=e;break e}r<<=1,A=e}n[t>>2]=s,n[s+24>>2]=A,n[s+12>>2]=s,n[s+8>>2]=s;break A}}while(0);l=0|n[(a=A+8|0)>>2],n[l+12>>2]=s,n[a>>2]=s,n[s+8>>2]=l,n[s+12>>2]=A,n[s+24>>2]=0}else n[6982]=e|t,n[A>>2]=s,n[s+24>>2]=A,n[s+12>>2]=s,n[s+8>>2]=s}while(0);if(l=(0|n[6989])-1|0,n[6989]=l,!(0|l)){for(A=28380;A=0|n[A>>2];)A=A+8|0;n[6989]=-1}}}}function We(A,e){e|=0;var t=0;return(A|=0)?(t=0|y(e,A),(e|A)>>>0>65535&&(t=((t>>>0)/(A>>>0)|0)==(0|e)?t:-1)):t=0,(A=0|Ue(t))&&3&n[A+-4>>2]?(lt(0|A,0,0|t),0|A):0|A}function Ve(A,e,t,r){return 0|(C((e|=0)+(r|=0)+((t=(A|=0)+(t|=0)>>>0)>>>0>>0|0)>>>0|0),t)}function Ze(A,e,t,r){return 0|(C(0|(r=(e|=0)-(r|=0)-((t|=0)>>>0>(A|=0)>>>0|0)>>>0)),A-t>>>0)}function Ke(A){return 0|((A|=0)?31-(0|k(A^A-1)):32)}function Je(A,e,t,r,o){o|=0;var i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0;if(u=A|=0,a=t|=0,s=f=r|=0,!(c=l=e|=0))return i=!!(0|o),s?i?(n[o>>2]=0|A,n[o+4>>2]=0&e,o=0,0|(C(0|(f=0)),o)):(o=0,0|(C(0|(f=0)),o)):(i&&(n[o>>2]=(u>>>0)%(a>>>0),n[o+4>>2]=0),o=(u>>>0)/(a>>>0)>>>0,0|(C(0|(f=0)),o));i=!(0|s);do{if(a){if(!i){if((i=(0|k(0|s))-(0|k(0|c))|0)>>>0<=31){a=d=i+1|0,A=u>>>(d>>>0)&(e=i-31>>31)|c<<(s=31-i|0),e&=c>>>(d>>>0),i=0,s=u<>2]=0|A,n[o+4>>2]=l|0&e,o=0,0|(C(0|(f=0)),o)):(o=0,0|(C(0|(f=0)),o))}if((i=a-1|0)&a){a=s=33+(0|k(0|a))-(0|k(0|c))|0,A=(d=32-s|0)-1>>31&c>>>((g=s-32|0)>>>0)|(c<>>(s>>>0))&(e=g>>31),e&=c>>>(s>>>0),i=u<<(h=64-s|0)&(l=d>>31),s=(c<>>(g>>>0))&l|u<>31;break}return 0|o&&(n[o>>2]=i&u,n[o+4>>2]=0),1==(0|a)?(h=0|A,0|(C(0|(g=l|0&e)),h)):(g=c>>>((h=0|Ke(0|a))>>>0)|0,h=c<<32-h|u>>>(h>>>0),0|(C(0|g),h))}if(i)return 0|o&&(n[o>>2]=(c>>>0)%(a>>>0),n[o+4>>2]=0),h=(c>>>0)/(a>>>0)>>>0,0|(C(0|(g=0)),h);if(!u)return 0|o&&(n[o>>2]=0,n[o+4>>2]=(c>>>0)%(s>>>0)),h=(c>>>0)/(s>>>0)>>>0,0|(C(0|(g=0)),h);if(!((i=s-1|0)&s))return 0|o&&(n[o>>2]=0|A,n[o+4>>2]=i&c|0&e),g=0,h=c>>>((0|Ke(0|s))>>>0),0|(C(0|g),h);if((i=(0|k(0|s))-(0|k(0|c))|0)>>>0<=30){a=e=i+1|0,A=c<<(s=31-i|0)|u>>>(e>>>0),e=c>>>(e>>>0),i=0,s=u<>2]=0|A,n[o+4>>2]=l|0&e,h=0,0|(C(0|(g=0)),h)):(h=0,0|(C(0|(g=0)),h))}while(0);if(a){c=0|Ve(0|(d=0|t),0|(u=f|0&r),-1,-1),t=0|B(),l=s,s=0;do{r=l,l=i>>>31|l<<1,i=s|i<<1,Ze(0|c,0|t,0|(r=A<<1|r>>>31),0|(f=A>>>31|e<<1)),s=1&(g=(h=0|B())>>31|((0|h)<0?-1:0)<<1),A=0|Ze(0|r,0|f,g&d|0,(((0|h)<0?-1:0)>>31|((0|h)<0?-1:0)<<1)&u),e=0|B(),a=a-1|0}while(0|a);c=l,l=0}else c=s,l=0,s=0;return a=0,0|o&&(n[o>>2]=A,n[o+4>>2]=e),h=i<<1&-2|s,0|(C(0|(g=(0|i)>>>31|(c|a)<<1|l)),h)}function Xe(A,e,t,r){var n,o,i,a,s;return t|=0,o=(r|=0)>>31|((0|r)<0?-1:0)<<1,n=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,i=0|Ze((s=(e|=0)>>31|((0|e)<0?-1:0)<<1)^(A|=0),(a=((0|e)<0?-1:0)>>31|((0|e)<0?-1:0)<<1)^e,0|s,0|a),A=o^s,e=n^a,0|Ze((0|Je(i,0|B(),0|Ze(o^t|0,n^r|0,0|o,0|n),0|B(),0))^A,(0|B())^e,0|A,0|e)}function qe(A,e,t,r){var n,o;return e|=0,r|=0,t=0|function(A,e){var t,r,n,o=0;return A=((t=0|y(o=65535&(e|=0),n=65535&(A|=0)))>>>16)+(0|y(o,r=A>>>16))|0,e=0|y(o=e>>>16,n),0|(C((A>>>16)+(0|y(o,r))+(((65535&A)+e|0)>>>16)|0),A+e<<16|65535&t)}(n=A|=0,o=t|=0),A=0|B(),0|(C((0|y(e,o))+(0|y(r,n))+A|0&A),t)}function $e(A,e,t,r){var o,i,a,s,l,c;return t|=0,o=S,S=S+16|0,s=0|o,c=(r|=0)>>31|((0|r)<0?-1:0)<<1,l=((0|r)<0?-1:0)>>31|((0|r)<0?-1:0)<<1,Je(A=0|Ze((a=(e|=0)>>31|((0|e)<0?-1:0)<<1)^(A|=0),(i=((0|e)<0?-1:0)>>31|((0|e)<0?-1:0)<<1)^e,0|a,0|i),e=0|B(),0|Ze(c^t|0,l^r|0,0|c,0|l),0|B(),s),r=0|Ze(n[s>>2]^a|0,n[s+4>>2]^i|0,0|a,0|i),t=0|B(),S=o,0|(C(0|t),r)}function At(A,e,t,r){var o,i;return i=S,S=S+16|0,Je(A|=0,e|=0,t|=0,r|=0,o=0|i),S=i,0|(C(0|n[o+4>>2]),n[o>>2])}function et(A,e,t){return A|=0,e|=0,(0|(t|=0))<32?(C(e>>t|0),A>>>t|(e&(1<>t-32)}function tt(A,e,t){return A|=0,e|=0,(0|(t|=0))<32?(C(e>>>t|0),A>>>t|(e&(1<>>t-32|0)}function rt(A,e,t){return A|=0,(0|(t|=0))<32?(C((e|=0)<>>32-t),A<=0?+s(A+.5):+v(A-.5)}function st(A,e,t){A|=0,e|=0;var o,i,a=0;if((0|(t|=0))>=8192)return j(0|A,0|e,0|t),0|A;if(i=0|A,o=A+t|0,(3&A)==(3&e)){for(;3&A;){if(!t)return 0|i;r[0|A]=0|r[0|e],A=A+1|0,e=e+1|0,t=t-1|0}for(a=(t=-4&o)-64|0;(0|A)<=(0|a);)n[A>>2]=n[e>>2],n[A+4>>2]=n[e+4>>2],n[A+8>>2]=n[e+8>>2],n[A+12>>2]=n[e+12>>2],n[A+16>>2]=n[e+16>>2],n[A+20>>2]=n[e+20>>2],n[A+24>>2]=n[e+24>>2],n[A+28>>2]=n[e+28>>2],n[A+32>>2]=n[e+32>>2],n[A+36>>2]=n[e+36>>2],n[A+40>>2]=n[e+40>>2],n[A+44>>2]=n[e+44>>2],n[A+48>>2]=n[e+48>>2],n[A+52>>2]=n[e+52>>2],n[A+56>>2]=n[e+56>>2],n[A+60>>2]=n[e+60>>2],A=A+64|0,e=e+64|0;for(;(0|A)<(0|t);)n[A>>2]=n[e>>2],A=A+4|0,e=e+4|0}else for(t=o-4|0;(0|A)<(0|t);)r[0|A]=0|r[0|e],r[A+1|0]=0|r[e+1|0],r[A+2|0]=0|r[e+2|0],r[A+3|0]=0|r[e+3|0],A=A+4|0,e=e+4|0;for(;(0|A)<(0|o);)r[0|A]=0|r[0|e],A=A+1|0,e=e+1|0;return 0|i}function lt(A,e,t){e|=0;var o,i=0,a=0,s=0;if(o=(A|=0)+(t|=0)|0,e&=255,(0|t)>=67){for(;3&A;)r[0|A]=e,A=A+1|0;for(s=e|e<<8|e<<16|e<<24,a=(i=-4&o)-64|0;(0|A)<=(0|a);)n[A>>2]=s,n[A+4>>2]=s,n[A+8>>2]=s,n[A+12>>2]=s,n[A+16>>2]=s,n[A+20>>2]=s,n[A+24>>2]=s,n[A+28>>2]=s,n[A+32>>2]=s,n[A+36>>2]=s,n[A+40>>2]=s,n[A+44>>2]=s,n[A+48>>2]=s,n[A+52>>2]=s,n[A+56>>2]=s,n[A+60>>2]=s,A=A+64|0;for(;(0|A)<(0|i);)n[A>>2]=s,A=A+4|0}for(;(0|A)<(0|o);)r[0|A]=e,A=A+1|0;return o-t|0}function ct(A){return(A=+A)>=0?+s(A+.5):+v(A-.5)}function ut(A){var e,t,r;return A|=0,r=0|E(),(0|A)>0&(0|(e=(t=0|n[a>>2])+A|0))<(0|t)|(0|e)<0?(N(0|e),D(12),-1):(0|e)>(0|r)&&!(0|Q(0|e))?(D(12),-1):(n[a>>2]=e,0|t)}return{___divdi3:Xe,___muldi3:qe,___remdi3:$e,___uremdi3:At,_areNeighborCells:function(A,e,t,r,o){o|=0;var i,a,s,l=0,c=0,u=0,d=0;if(s=S,S=S+64|0,a=s,i=s+56|0,!(!0&134217728==(2013265920&(e|=0))&!0&134217728==(2013265920&(r|=0))))return S=s,5;if((0|(A|=0))==(0|(t|=0))&(0|e)==(0|r))return n[o>>2]=0,S=s,0;if(c=0|tt(0|A,0|e,52),B(),c&=15,d=0|tt(0|t,0|r,52),B(),(0|c)!=(15&d))return S=s,12;if(l=c+-1|0,c>>>0>1){IA(A,e,l,a),IA(t,r,l,i),u=0|n[(d=a)>>2],d=0|n[d+4>>2];A:do{if((0|u)==(0|n[i>>2])&&(0|d)==(0|n[i+4>>2])){l=0|tt(0|A,0|e,0|(c=3*(15^c)|0)),B(),l&=7,c=0|tt(0|t,0|r,0|c),B(),c&=7;do{if(!(0|l)|!(0|c))n[o>>2]=1,l=0;else if(7==(0|l))l=5;else{if(1==(0|l)|1==(0|c)&&0|zA(u,d)){l=5;break}if((0|n[15536+(l<<2)>>2])!=(0|c)&&(0|n[15568+(l<<2)>>2])!=(0|c))break A;n[o>>2]=1,l=0}}while(0);return S=s,0|l}}while(0)}c=(l=a)+56|0;do{n[l>>2]=0,l=l+4|0}while((0|l)<(0|c));return F(A,e,1,a),l=(0|n[(e=a)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+8|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+16|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+24|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+32|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)||(0|n[(e=a+40|0)>>2])==(0|t)&&(0|n[e+4>>2])==(0|r)?1:1&((0|n[(l=a+48|0)>>2])==(0|t)?(0|n[l+4>>2])==(0|r):0),n[o>>2]=l,S=s,0},_bitshift64Ashr:et,_bitshift64Lshr:tt,_bitshift64Shl:rt,_calloc:We,_cellAreaKm2:function(A,e,t){return 0|(A=0|ue(A|=0,e|=0,t|=0))||(o[t>>3]=6371.007180918475*+o[t>>3]*6371.007180918475),0|A},_cellAreaM2:function(A,e,t){return 0|(A=0|ue(A|=0,e|=0,t|=0))||(o[t>>3]=6371.007180918475*+o[t>>3]*6371.007180918475*1e3*1e3),0|A},_cellAreaRads2:ue,_cellToBoundary:$A,_cellToCenterChild:GA,_cellToChildPos:function(A,e,t,r){t|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0;if(o=S,S=S+16|0,p=o,v=0|tt(0|(A|=0),0|(e|=0),52),B(),t>>>0>15)return S=o,4;if((0|(v&=15))<(0|t))return S=o,12;if((0|v)!=(0|t))if(a=0|rt(0|t,0,52),a|=A,l=B()|-15728641&e,(0|v)>(0|t)){c=t;do{b=0|rt(7,0,3*(14-c|0)|0),c=c+1|0,a|=b,l=0|B()|l}while((0|c)<(0|v));b=a}else b=a;else b=A,l=e;m=0|tt(0|b,0|l,45),B();A:do{if(0|H(127&m)){if(c=0|tt(0|b,0|l,52),B(),0|(c&=15))for(a=1;;){if(!(!((m=0|rt(7,0,3*(15-a|0)|0))&b)&!((0|B())&l))){u=33;break A}if(!(a>>>0>>0))break;a=a+1|0}if(n[(m=r)>>2]=0,n[m+4>>2]=0,(0|v)>(0|t)){for(m=-15728641&e,h=v;;){if(g=h,(h=h+-1|0)>>>0>15|(0|v)<(0|h)){u=19;break}if((0|v)!=(0|h))if(a=0|rt(0|h,0,52),a|=A,c=0|B()|m,(0|v)<(0|g))f=a;else{u=h;do{f=0|rt(7,0,3*(14-u|0)|0),u=u+1|0,a|=f,c=0|B()|c}while((0|u)<(0|v));f=a}else f=A,c=e;if(d=0|tt(0|f,0|c,45),B(),0|H(127&d)){d=0|tt(0|f,0|c,52),B(),d&=15;e:do{if(d)for(u=1;;){if(a=0|tt(0|f,0|c,3*(15-u|0)|0),B(),0|(a&=7))break e;if(!(u>>>0>>0)){a=0;break}u=u+1|0}else a=0}while(0);a=1&!(0|a)}else a=0;if(c=0|tt(0|A,0|e,3*(15-g|0)|0),B(),7==(0|(c&=7))){i=5,u=42;break}if(1==(0|c)&(a=!!(0|a))){i=5,u=42;break}if(0|(f=c+((!!(0|c)&a)<<31>>31)|0)&&(u=0|pe(7,0,u=v-g|0,((0|u)<0)<<31>>31),d=0|B(),a?(a=0|Ve(0|(a=0|qe(0|u,0|d,5,0)),0|B(),-5,-1),a=0|Ve(0|(a=0|Xe(0|a,0|B(),6,0)),0|B(),1,0),c=0|B()):(a=u,c=d),g=0|Ve(0|a,0|c,0|(g=0|qe(0|u,0|d,0|(g=f+-1|0),((0|g)<0)<<31>>31)),0|B()),d=0|Ve(0|g,0|(f=0|B()),0|n[(d=r)>>2],0|n[d+4>>2]),f=0|B(),n[(g=r)>>2]=d,n[g+4>>2]=f),(0|h)<=(0|t)){u=37;break}}if(19==(0|u))M(27795,27122,1367,27158);else{if(37==(0|u)){i=0|n[(s=r)+4>>2],s=0|n[s>>2];break}if(42==(0|u))return S=o,0|i}}else i=0,s=0}else u=33}while(0);A:do{if(33==(0|u)){if(n[(m=r)>>2]=0,n[m+4>>2]=0,(0|v)>(0|t)){for(a=v;;){if(i=0|tt(0|A,0|e,3*(15-a|0)|0),B(),7==(0|(i&=7))){i=5;break}if(i=0|qe(0|(s=0|pe(7,0,s=v-a|0,((0|s)<0)<<31>>31)),0|B(),0|i,0),s=0|B(),s=0|Ve(0|n[(m=r)>>2],0|n[m+4>>2],0|i,0|s),i=0|B(),n[(m=r)>>2]=s,n[m+4>>2]=i,(0|(a=a+-1|0))<=(0|t))break A}return S=o,0|i}i=0,s=0}}while(0);return 0|_A(b,l,v,p)&&M(27795,27122,1327,27173),((0|i)>-1|-1==(0|i)&s>>>0>4294967295)&((0|(p=0|n[(v=p)+4>>2]))>(0|i)|((0|p)==(0|i)?(0|n[v>>2])>>>0>s>>>0:0))?(S=o,0|(v=0)):(M(27795,27122,1407,27158),0)},_cellToChildren:function(A,e,t,r){r|=0;var o,i,a=0,s=0;if(i=S,S=S+16|0,ee(o=i,A|=0,e|=0,t|=0),!(0|(A=0|n[(e=o)>>2]))&!(0|(e=0|n[e+4>>2])))return S=i,0;a=0,t=0;do{n[(s=r+(a<<3)|0)>>2]=A,n[s+4>>2]=e,a=0|Ve(0|a,0|t,1,0),t=0|B(),re(o),A=0|n[(s=o)>>2],e=0|n[s+4>>2]}while(!(!(0|A)&!(0|e)));return S=i,0},_cellToChildrenSize:_A,_cellToLatLng:qA,_cellToLocalIj:function(A,e,t,r,o,i){var a,s;return A|=0,i|=0,s=S,S=S+16|0,a=s,(o|=0)?A=15:(A=0|me(A,e|=0,t|=0,r|=0,a))||(function(A,e){var t;e|=0,t=0|n[8+(A|=0)>>2],n[e>>2]=(0|n[A>>2])-t,n[e+4>>2]=(0|n[A+4>>2])-t}(a,i),A=0),S=s,0|A},_cellToParent:IA,_cellToVertex:Pe,_cellToVertexes:function(A,e,t){t|=0;var r,o=0,i=0;return i=!(0|zA(A|=0,e|=0)),r=!(0|(o=0|Pe(A,e,0,t))),i?r?0|(o=0|Pe(A,e,1,t+8|0))||0|(o=0|Pe(A,e,2,t+16|0))||0|(o=0|Pe(A,e,3,t+24|0))||(o=0|Pe(A,e,4,t+32|0))?0|(i=o):0|Pe(A,e,5,t+40|0):0|(i=o):r?0|(o=0|Pe(A,e,1,t+8|0))||0|(o=0|Pe(A,e,2,t+16|0))||0|(o=0|Pe(A,e,3,t+24|0))||0|(o=0|Pe(A,e,4,t+32|0))?0|(i=o):(n[(i=t+40|0)>>2]=0,n[i+4>>2]=0,0|(i=0)):0|(i=o)},_cellsToDirectedEdge:function(A,e,t,r,o){return o|=0,7==(0|(t=0|_(A|=0,e|=0,t|=0,r|=0)))?0|(o=11):(r=0|rt(0|t,0,56),e=-2130706433&e|B()|268435456,n[o>>2]=A|r,n[o+4>>2]=e,0|(o=0))},_cellsToLinkedMultiPolygon:function(A,e,t){t|=0;var r,i,a,s=0;if(a=S,S=S+32|0,r=a,0|(A=0|function(A,e,t){A|=0,t|=0;var r,o,i=0,a=0,s=0,l=0,c=0,u=0;if(o=S,S=S+176|0,r=o,(0|(e|=0))<1)return Le(t,0,0),S=o,0;for(c=0|tt(0|n[(c=A)>>2],0|n[c+4>>2],52),B(),Le(t,(0|e)>6?e:6,15&c),c=0;!(0|(i=0|$A(0|n[(i=A+(c<<3)|0)>>2],0|n[i+4>>2],r)));){if((0|(i=0|n[r>>2]))>0){l=0;do{s=r+8+(l<<4)|0,(a=0|He(t,i=r+8+((0|(l=l+1|0))%(0|i)<<4)|0,s))?_e(t,a):ze(t,s,i),i=0|n[r>>2]}while((0|l)<(0|i))}if((0|(c=c+1|0))>=(0|e)){i=0,u=13;break}}return 13==(0|u)?(S=o,0|i):(Re(t),S=o,0|(u=i))}(A|=0,e|=0,i=a+16|0)))return S=a,0|A;if(n[t>>2]=0,n[t+4>>2]=0,n[t+8>>2]=0,0|(A=0|Ie(i)))do{e=0|de(t);do{fe(e,A),s=A+16|0,n[r>>2]=n[s>>2],n[r+4>>2]=n[s+4>>2],n[r+8>>2]=n[s+8>>2],n[r+12>>2]=n[s+12>>2],_e(i,A),A=0|Ge(i,r)}while(0|A);A=0|Ie(i)}while(0|A);return Re(i),(A=0|function(A){var e,t,r=0,i=0,a=0,s=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0,k=0,C=0,B=0,D=0,E=0,j=0,Q=0,N=0,S=0,F=0,P=0,T=0,L=0;if(0|n[(s=(A|=0)+8|0)>>2])return 1;if(!(a=0|n[A>>2]))return 0;r=a,i=0;do{i=i+1|0,r=0|n[r+8>>2]}while(0|r);if(i>>>0<2)return 0;(t=0|Ue(i<<2))||M(27396,27235,317,27415),(e=0|Ue(i<<5))||M(27437,27235,321,27415),n[A>>2]=0,n[(E=A+4|0)>>2]=0,n[s>>2]=0,i=0,P=0,D=0,m=0;A:for(;;){if(h=0|n[a>>2]){c=0,u=h;do{if(f=+o[u+8>>3],r=u,u=0|n[u+16>>2],d=+o[(s=(g=!(0|u))?h:u)+8>>3],+l(+(f-d))>3.141592653589793){L=14;break}c+=(d-f)*(+o[r>>3]+ +o[s>>3])}while(!g);if(14==(0|L)){L=0,c=0,r=h;do{B=+o[r+8>>3],S=0|n[(F=r+16|0)>>2],C=+o[(S=0|S?S:h)+8>>3],c+=(+o[r>>3]+ +o[S>>3])*((C<0?C+6.283185307179586:C)-(B<0?B+6.283185307179586:B)),r=0|n[(0|r?F:a)>>2]}while(0|r)}c>0?(n[t+(P<<2)>>2]=a,P=P+1|0,s=D,r=m):L=19}else L=19;if(19==(0|L)){L=0;do{if(!i){if(m){s=E,u=m+8|0,r=a,i=A;break}if(0|n[A>>2]){L=27;break A}s=E,u=A,r=a,i=A;break}if(0|n[(r=i+8|0)>>2]){L=21;break A}if(!(i=0|We(1,12))){L=23;break A}n[r>>2]=i,s=i+4|0,u=i,r=m}while(0);if(n[u>>2]=a,n[s>>2]=a,u=e+(D<<5)|0,g=0|n[a>>2]){for(o[(h=e+(D<<5)+8|0)>>3]=17976931348623157e292,o[(m=e+(D<<5)+24|0)>>3]=17976931348623157e292,o[u>>3]=-17976931348623157e292,o[(b=e+(D<<5)+16|0)>>3]=-17976931348623157e292,x=17976931348623157e292,k=-17976931348623157e292,s=0,p=g,f=17976931348623157e292,y=17976931348623157e292,w=-17976931348623157e292,d=-17976931348623157e292;c=+o[p>>3],B=+o[p+8>>3],p=0|n[p+16>>2],C=+o[((v=!(0|p))?g:p)+8>>3],c>3]=c,f=c),B>3]=B,y=B),c>w?o[u>>3]=c:c=w,B>d&&(o[b>>3]=B,d=B),x=B>0&Bk?B:k,s|=+l(+(B-C))>3.141592653589793,!v;)w=c;s&&(o[b>>3]=k,o[m>>3]=x)}else n[u>>2]=0,n[u+4>>2]=0,n[u+8>>2]=0,n[u+12>>2]=0,n[u+16>>2]=0,n[u+20>>2]=0,n[u+24>>2]=0,n[u+28>>2]=0;s=D+1|0}if(a=0|n[(F=a+8|0)>>2],n[F>>2]=0,!a){L=45;break}D=s,m=r}if(21==(0|L))M(27213,27235,35,27247);else if(23==(0|L))M(27267,27235,37,27247);else if(27==(0|L))M(27310,27235,61,27333);else if(45==(0|L)){A:do{if((0|P)>0){for(F=!(0|s),N=s<<2,S=!(0|A),Q=0,r=0;;){if(j=0|n[t+(Q<<2)>>2],F)L=73;else{if(!(D=0|Ue(N))){L=50;break}if(!(E=0|Ue(N))){L=52;break}e:do{if(S)i=0;else{for(s=0,i=0,u=A;a=e+(s<<5)|0,0|he(0|n[u>>2],a,0|n[j>>2])?(n[D+(i<<2)>>2]=u,n[E+(i<<2)>>2]=a,v=i+1|0):v=i,u=0|n[u+8>>2];)s=s+1|0,i=v;if((0|v)>0)if(a=0|n[D>>2],1==(0|v))i=a;else for(b=0,p=-1,i=a,m=a;;){for(g=0|n[m>>2],a=0,u=0;h=(0|(s=0|n[n[D+(u<<2)>>2]>>2]))==(0|g)?a:a+(1&he(s,0|n[E+(u<<2)>>2],0|n[g>>2]))|0,(0|(u=u+1|0))!=(0|v);)a=h;if(i=(s=(0|h)>(0|p))?m:i,(0|(a=b+1|0))==(0|v))break e;b=a,p=s?h:p,m=0|n[D+(a<<2)>>2]}else i=0}}while(0);if(Ye(D),Ye(E),i){if(a=0|n[(s=i+4|0)>>2])i=a+8|0;else if(0|n[i>>2]){L=70;break}n[i>>2]=j,n[s>>2]=j}else L=73}if(73==(0|L)){if(L=0,0|(r=0|n[j>>2]))do{E=r,r=0|n[r+16>>2],Ye(E)}while(0|r);Ye(j),r=1}if((0|(Q=Q+1|0))>=(0|P)){T=r;break A}}50==(0|L)?M(27452,27235,249,27471):52==(0|L)?M(27490,27235,252,27471):70==(0|L)&&M(27310,27235,61,27333)}else T=0}while(0);return Ye(t),Ye(e),0|T}return 0}(t))?(ge(t),S=a,0|(s=A)):(S=a,0|(s=0))},_childPosToCell:function(A,e,t,r,o,i){A|=0,e|=0,i|=0;var a,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0;if(a=S,S=S+16|0,s=a,(o|=0)>>>0>15)return S=a,4;if(l=0|tt(0|(t|=0),0|(r|=0),52),B(),(0|(l&=15))>(0|o))return S=a,12;if(0|_A(t,r,o,s)&&M(27795,27122,1327,27173),!(((0|e)>-1|-1==(0|e)&A>>>0>4294967295)&((0|(u=0|n[(d=s)+4>>2]))>(0|e)|((0|u)==(0|e)?(0|n[d>>2])>>>0>A>>>0:0))))return S=a,2;d=o-l|0,o=0|rt(0|o,0,52),c=B()|-15728641&r,n[(u=i)>>2]=o|t,n[u+4>>2]=c,u=0|tt(0|t,0|r,45),B();A:do{if(0|H(127&u)){if(0|l)for(s=1;;){if(!(!((u=0|rt(7,0,3*(15-s|0)|0))&t)&!((0|B())&r)))break A;if(!(s>>>0>>0))break;s=s+1|0}if((0|d)<1)return S=a,0;for(u=15^l,r=-1,c=1,s=1;;){l=0|pe(7,0,l=d-c|0,((0|l)<0)<<31>>31),t=0|B();do{if(s){if(s=0|Xe(0|(s=0|Ve(0|(s=0|qe(0|l,0|t,5,0)),0|B(),-5,-1)),0|B(),6,0),(0|e)>(0|(o=0|B()))|(0|e)==(0|o)&A>>>0>s>>>0){e=0|Ze(0|(e=0|Ve(0|A,0|e,-1,-1)),0|B(),0|s,0|o),s=0|B(),h=0|n[(f=i)>>2],f=0|n[f+4>>2],g=0|rt(7,0,0|(m=3*(u+r|0)|0)),f&=~B(),m=0|rt(0|(o=0|Ve(0|(r=0|Xe(0|e,0|s,0|l,0|t)),0|(A=0|B()),2,0)),0|B(),0|m),f=0|B()|f,n[(o=i)>>2]=m|h&~g,n[o+4>>2]=f,A=0|Ze(0|e,0|s,0|(A=0|qe(0|r,0|A,0|l,0|t)),0|B()),s=0,e=0|B();break}g=0|n[(m=i)>>2],m=0|n[m+4>>2],h=0|rt(7,0,3*(u+r|0)|0),m&=~B(),n[(s=i)>>2]=g&~h,n[s+4>>2]=m,s=1;break}o=0|n[(g=i)>>2],g=0|n[g+4>>2],f=0|rt(7,0,0|(r=3*(u+r|0)|0)),g&=~B(),r=0|rt(0|(m=0|Xe(0|A,0|e,0|l,0|t)),0|(s=0|B()),0|r),g=0|B()|g,n[(h=i)>>2]=r|o&~f,n[h+4>>2]=g,A=0|Ze(0|A,0|e,0|(s=0|qe(0|m,0|s,0|l,0|t)),0|B()),s=0,e=0|B()}while(0);if(!((0|d)>(0|c))){e=0;break}r=~c,c=c+1|0}return S=a,0|e}}while(0);if((0|d)<1)return S=a,0;for(o=15^l,s=1;;){if(h=0|pe(7,0,h=d-s|0,((0|h)<0)<<31>>31),m=0|B(),t=0|n[(c=i)>>2],c=0|n[c+4>>2],r=0|rt(7,0,0|(l=3*(o-s|0)|0)),c&=~B(),l=0|rt(0|(f=0|Xe(0|A,0|e,0|h,0|m)),0|(g=0|B()),0|l),c=0|B()|c,n[(u=i)>>2]=l|t&~r,n[u+4>>2]=c,A=0|Ze(0|A,0|e,0|(m=0|qe(0|f,0|g,0|h,0|m)),0|B()),e=0|B(),(0|d)<=(0|s)){e=0;break}s=s+1|0}return S=a,0|e},_compactCells:function(A,e,t,r){e|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0,k=0,C=0,D=0,E=0,j=0,Q=0,N=0,S=0;if(!(0|(t|=0))&!(0|(r|=0)))return 0;if(a=0|n[(i=A|=0)>>2],!0&!(15728640&(i=0|n[i+4>>2]))){if(!((0|r)>0|!(0|r)&t>>>0>0))return 0;if(n[(S=e)>>2]=a,n[S+4>>2]=i,1==(0|t)&!(0|r))return 0;i=1,a=0;do{N=0|n[4+(Q=A+(i<<3)|0)>>2],n[(S=e+(i<<3)|0)>>2]=n[Q>>2],n[S+4>>2]=N,i=0|Ve(0|i,0|a,1,0),a=0|B()}while((0|a)<(0|r)|(0|a)==(0|r)&i>>>0>>0);return 0}if(!(N=0|Ue(o=t<<3)))return 13;if(st(0|N,0|A,0|o),!(Q=0|We(t,8)))return Ye(N),13;A:for(;;){E=0|tt(0|(u=0|n[(i=N)>>2]),0|(i=0|n[i+4>>2]),52),B(),j=(E&=15)-1|0,D=!!(0|E),C=(0|r)>0|!(0|r)&t>>>0>0;e:do{if(D&C){if(y=0|rt(0|j,0,52),w=0|B(),j>>>0>15){if(!(!(0|u)&!(0|i))){S=16;break A}for(a=0,A=0;;){if(a=0|Ve(0|a,0|A,1,0),!((0|(A=0|B()))<(0|r)|(0|A)==(0|r)&a>>>0>>0))break e;if(!(!(0|(k=0|n[(s=N+(a<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))){i=s,S=16;break A}}}for(l=u,A=i,a=0,s=0;;){if(!(!(0|l)&!(0|A))){if(!(!0&!(117440512&A))){S=21;break A}if(d=0|tt(0|l,0|A,52),B(),(0|(d&=15))<(0|j)){i=12,S=27;break A}if((0|d)!=(0|j)&&(l|=y,A=-15728641&A|w,d>>>0>=E>>>0)){c=j;do{k=0|rt(7,0,3*(14-c|0)|0),c=c+1|0,l|=k,A=0|B()|A}while(c>>>0>>0)}if(g=0|At(0|l,0|A,0|t,0|r),h=0|B(),!(!(0|(f=0|n[(d=c=Q+(g<<3)|0)>>2]))&!(0|(d=0|n[d+4>>2])))){p=0,v=0;do{if((0|p)>(0|r)|(0|p)==(0|r)&v>>>0>t>>>0){S=31;break A}if((0|f)==(0|l)&(-117440513&d)==(0|A)){m=0|tt(0|f,0|d,56),B(),b=1+(m&=7)|0,k=0|tt(0|f,0|d,45),B();t:do{if(0|H(127&k)){if(f=0|tt(0|f,0|d,52),B(),!(f&=15)){d=6;break}for(d=1;;){if(!(!((k=0|rt(7,0,3*(15-d|0)|0))&l)&!((0|B())&A))){d=7;break t}if(!(d>>>0>>0)){d=6;break}d=d+1|0}}else d=7}while(0);if((m+2|0)>>>0>d>>>0){S=41;break A}k=0|rt(0|b,0,56),A=B()|-117440513&A,n[(x=c)>>2]=0,n[x+4>>2]=0,l|=k}else g=0|$e(0|(g=0|Ve(0|g,0|h,1,0)),0|B(),0|t,0|r),h=0|B();v=0|Ve(0|v,0|p,1,0),p=0|B(),f=0|n[(d=c=Q+(g<<3)|0)>>2],d=0|n[d+4>>2]}while(!(!(0|f)&!(0|d)))}n[(k=c)>>2]=l,n[k+4>>2]=A}if(a=0|Ve(0|a,0|s,1,0),!((0|(s=0|B()))<(0|r)|(0|s)==(0|r)&a>>>0>>0))break e;l=0|n[(A=N+(a<<3)|0)>>2],A=0|n[A+4>>2]}}}while(0);if(k=0|Ve(0|t,0|r,5,0),(x=0|B())>>>0<0|!(0|x)&k>>>0<11){S=85;break}if(k=0|Xe(0|t,0|r,6,0),B(),!(k=0|We(k,8))){S=48;break}do{if(C){for(b=0,A=0,m=0,p=0;;){if(!(0|(a=0|n[(s=d=Q+(b<<3)|0)>>2]))&!(0|(s=0|n[s+4>>2])))x=m;else{f=0|tt(0|a,0|s,56),B(),l=1+(f&=7)|0,g=-117440513&s,x=0|tt(0|a,0|s,45),B();e:do{if(0|H(127&x)){if(h=0|tt(0|a,0|s,52),B(),0|(h&=15))for(c=1;;){if(!(!(a&(x=0|rt(7,0,3*(15-c|0)|0)))&!(g&(0|B()))))break e;if(!(c>>>0>>0))break;c=c+1|0}a|=s=0|rt(0|l,0,56),s=0|B()|g,n[(l=d)>>2]=a,n[l+4>>2]=s,l=f+2|0}}while(0);7==(0|l)?(n[(x=k+(A<<3)|0)>>2]=a,n[x+4>>2]=-117440513&s,A=0|Ve(0|A,0|m,1,0),x=0|B()):x=m}if(b=0|Ve(0|b,0|p,1,0),!((0|(p=0|B()))<(0|r)|(0|p)==(0|r)&b>>>0>>0))break;m=x}if(C){if(v=j>>>0>15,y=0|rt(0|j,0,52),w=0|B(),!D){for(a=0,c=0,l=0,s=0;!(0|u)&!(0|i)||(n[(j=e+(a<<3)|0)>>2]=u,n[j+4>>2]=i,a=0|Ve(0|a,0|c,1,0),c=0|B()),l=0|Ve(0|l,0|s,1,0),(0|(s=0|B()))<(0|r)|(0|s)==(0|r)&l>>>0>>0;)u=0|n[(i=N+(l<<3)|0)>>2],i=0|n[i+4>>2];i=x;break}for(a=0,c=0,s=0,l=0;;){do{if(!(!(0|u)&!(0|i))){if(h=0|tt(0|u,0|i,52),B(),v|(0|(h&=15))<(0|j)){S=80;break A}if((0|h)!=(0|j)){if(d=u|y,f=-15728641&i|w,h>>>0>=E>>>0){g=j;do{D=0|rt(7,0,3*(14-g|0)|0),g=g+1|0,d|=D,f=0|B()|f}while(g>>>0>>0)}}else d=u,f=i;m=0|At(0|d,0|f,0|t,0|r),g=0,h=0,p=0|B();do{if((0|g)>(0|r)|(0|g)==(0|r)&h>>>0>t>>>0){S=81;break A}if((-117440513&(b=0|n[4+(D=Q+(m<<3)|0)>>2]))==(0|f)&&(0|n[D>>2])==(0|d)){S=65;break}m=0|$e(0|(D=0|Ve(0|m,0|p,1,0)),0|B(),0|t,0|r),p=0|B(),h=0|Ve(0|h,0|g,1,0),g=0|B(),D=Q+(m<<3)|0}while((0|n[D>>2])!=(0|d)||(0|n[D+4>>2])!=(0|f));if(65==(0|S)&&(S=0,!0&100663296==(117440512&b)))break;n[(D=e+(a<<3)|0)>>2]=u,n[D+4>>2]=i,a=0|Ve(0|a,0|c,1,0),c=0|B()}}while(0);if(s=0|Ve(0|s,0|l,1,0),!((0|(l=0|B()))<(0|r)|(0|l)==(0|r)&s>>>0>>0))break;u=0|n[(i=N+(s<<3)|0)>>2],i=0|n[i+4>>2]}i=x}else a=0,i=x}else a=0,A=0,i=0}while(0);if(lt(0|Q,0,0|o),st(0|N,0|k,A<<3),Ye(k),!(0|A)&!(0|i)){S=89;break}e=e+(a<<3)|0,r=i,t=A}if(16==(0|S))!0&!(117440512&i)?(i=4,S=27):S=21;else if(31==(0|S))M(27795,27122,620,27132);else{if(41==(0|S))return Ye(N),Ye(Q),10;if(48==(0|S))return Ye(N),Ye(Q),13;80==(0|S)?M(27795,27122,711,27132):81==(0|S)?M(27795,27122,723,27132):85==(0|S)&&(st(0|e,0|N,t<<3),S=89)}return 21==(0|S)?(Ye(N),Ye(Q),0|(S=5)):27==(0|S)?(Ye(N),Ye(Q),0|(S=i)):89==(0|S)?(Ye(N),Ye(Q),0|(S=0)):0},_constructCell:function(A,e,t,o){t|=0,o|=0;var i=0,a=0,s=0,l=0,c=0,u=0;if((A|=0)>>>0>15)return 4;if((e|=0)>>>0>121)return 17;s=0|rt(0|A,0,52),i=0|B(),l=0|rt(0|e,0,45),i=0|i|B()|134225919;A:do{if((0|A)>=1){for(l=1,s=!!(0|r[20528+e|0]),a=-1;;){if((e=0|n[t+(l+-1<<2)>>2])>>>0>6){i=18,e=10;break}if(!(!(0|e)|1^s)){if(1==(0|e)){i=19,e=10;break}s=0}if(c=0|rt(7,0,0|(u=3*(15-l|0)|0)),i&=~B(),a=(e=0|rt(0|e,((0|e)<0)<<31>>31,0|u))|a&~c,i=0|B()|i,!((0|l)<(0|A)))break A;l=l+1|0}if(10==(0|e))return 0|i}else a=-1}while(0);return n[(u=o)>>2]=a,n[u+4>>2]=i,0},_destroyLinkedMultiPolygon:ge,_directedEdgeToBoundary:DA,_directedEdgeToCells:function(A,e,t){A|=0;var r,o,i,a=0;return r=S,S=S+16|0,a=r,!0&268435456==(2013265920&(e|=0))?(o=-2130706433&e|134217728,n[(i=t|=0)>>2]=A,n[i+4>>2]=o,n[a>>2]=0,e=0|tt(0|A,0|e,56),B(),a=0|R(A,o,7&e,a,t+8|0),S=r,0|a):(S=r,0|(a=6))},_edgeLengthKm:function(A,e,t){t|=0;var r,i=0,a=0,s=0,l=0,u=0,g=0,h=0;if(r=S,S=S+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return l=A,s=+o[t>>3],s*=6371.007180918475,o[t>>3]=s,S=r,0|l;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return l=0,s=0,s*=6371.007180918475,o[t>>3]=s,S=r,0|l;e=A+-1|0,A=0,i=+o[l+8>>3],a=+o[l+16>>3],s=0;do{g=i,i=+o[l+8+((A=A+1|0)<<4)>>3],h=+f(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+f(.5*(a-u)))*(+d(+g)*+d(+i)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)!=(0|e));return o[t>>3]=s,l=0,h=s,h*=6371.007180918475,o[t>>3]=h,S=r,0|l},_edgeLengthM:function(A,e,t){t|=0;var r,i=0,a=0,s=0,l=0,u=0,g=0,h=0;if(r=S,S=S+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return l=A,s=+o[t>>3],s*=6371.007180918475,s*=1e3,o[t>>3]=s,S=r,0|l;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return l=0,s=0,s*=6371.007180918475,s*=1e3,o[t>>3]=s,S=r,0|l;e=A+-1|0,A=0,i=+o[l+8>>3],a=+o[l+16>>3],s=0;do{g=i,i=+o[l+8+((A=A+1|0)<<4)>>3],h=+f(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+f(.5*(a-u)))*(+d(+g)*+d(+i)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)!=(0|e));return o[t>>3]=s,l=0,h=s,h*=6371.007180918475,h*=1e3,o[t>>3]=h,S=r,0|l},_edgeLengthRads:function(A,e,t){t|=0;var r,i=0,a=0,s=0,l=0,u=0,g=0,h=0;if(r=S,S=S+176|0,0|(A=0|DA(A|=0,e|=0,l=r)))return S=r,0|A;if(o[t>>3]=0,(0|(A=0|n[l>>2]))<=1)return S=r,0;e=A+-1|0,A=0,i=+o[l+8>>3],a=+o[l+16>>3],s=0;do{g=i,i=+o[l+8+((A=A+1|0)<<4)>>3],h=+f(.5*(i-g)),u=a,a=+o[l+8+(A<<4)+8>>3],u=h*h+(u=+f(.5*(a-u)))*(+d(+i)*+d(+g)*u),s+=2*+p(+ +c(+u),+ +c(+(1-u)))}while((0|A)<(0|e));return o[t>>3]=s,S=r,0},_emscripten_replace_memory:function(A){return r=new Int8Array(A),n=new Int32Array(A),o=new Float64Array(A),t=A,!0},_free:Ye,_getBaseCellNumber:TA,_getDirectedEdgeDestination:function(A,e,t){A|=0,e|=0,t|=0;var r,o,i=0;return r=S,S=S+16|0,n[(i=r)>>2]=0,!0&268435456==(2013265920&e)?(o=0|tt(0|A,0|e,56),B(),i=0|R(A,-2130706433&e|134217728,7&o,i,t),S=r,0|i):(S=r,0|(i=6))},_getDirectedEdgeOrigin:function(A,e,t){return A|=0,t|=0,!0&268435456==(2013265920&(e|=0))?(n[t>>2]=A,n[t+4>>2]=-2130706433&e|134217728,0|(t=0)):0|(t=6)},_getHexagonAreaAvgKm2:se,_getHexagonAreaAvgM2:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20784+(A<<3)>>3],0|(e=0))},_getHexagonEdgeLengthAvgKm:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[20912+(A<<3)>>3],0|(e=0))},_getHexagonEdgeLengthAvgM:function(A,e){return e|=0,(A|=0)>>>0>15?0|(e=4):(o[e>>3]=+o[21040+(A<<3)>>3],0|(e=0))},_getIcosahedronFaces:function A(e,t,r){r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0;o=S,S=S+128|0,d=o+112|0,s=o+96|0,f=o,a=0|tt(0|(e|=0),0|(t|=0),52),B(),c=15&a,n[d>>2]=c,l=0|tt(0|e,0|t,45),B(),l&=127;A:do{if(0|H(l)){if(0|c)for(i=1;;){if(!(!((u=0|rt(7,0,3*(15-i|0)|0))&e)&!((0|B())&t))){a=0;break A}if(!(i>>>0>>0))break;i=i+1|0}if(!(1&a))return u=0|rt(c+1|0,0,52),f=B()|-15728641&t,f=0|A((u|e)&~(d=0|rt(7,0,3*(14-c|0)|0)),f&~B(),r),S=o,0|f;a=1}else a=0}while(0);if(!(i=0|XA(e,t,s))){a?(QA(s,d,f),u=5):(PA(s,d,f),u=6);A:do{if(0|H(l))if(c)for(i=1;;){if(!(!((l=0|rt(7,0,3*(15-i|0)|0))&e)&!((0|B())&t))){e=2;break A}if(!(i>>>0>>0)){e=5;break}i=i+1|0}else e=5;else e=2}while(0);lt(0|r,-1,e<<2);A:do{if(a)for(s=0;;){if(SA(l=f+(s<<4)|0,0|n[d>>2]),l=0|n[l>>2],-1==(0|(c=0|n[r>>2]))|(0|c)==(0|l))i=r;else{a=0;do{if((a=a+1|0)>>>0>=e>>>0){i=1;break A}c=0|n[(i=r+(a<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(n[i>>2]=l,(s=s+1|0)>>>0>=u>>>0){i=0;break}}else for(s=0;;){if(NA(l=f+(s<<4)|0,0|n[d>>2],0,1),l=0|n[l>>2],-1==(0|(c=0|n[r>>2]))|(0|c)==(0|l))i=r;else{a=0;do{if((a=a+1|0)>>>0>=e>>>0){i=1;break A}c=0|n[(i=r+(a<<2)|0)>>2]}while(!(-1==(0|c)|(0|c)==(0|l)))}if(n[i>>2]=l,(s=s+1|0)>>>0>=u>>>0){i=0;break}}}while(0)}return S=o,0|i},_getIndexDigit:function(A,e,t,r){return r|=0,((t|=0)-1|0)>>>0>14?0|(r=4):(t=0|tt(0|(A|=0),0|(e|=0),3*(15-t|0)|0),B(),n[r>>2]=7&t,0|(r=0))},_getNumCells:le,_getPentagons:Ae,_getRes0Cells:function(A){A|=0;var e=0,t=0,r=0;e=0;do{rt(0|e,0,45),r=134225919|B(),n[(t=A+(e<<3)|0)>>2]=-1,n[t+4>>2]=r,e=e+1|0}while(122!=(0|e));return 0},_getResolution:function(A,e){return e=0|tt(0|(A|=0),0|(e|=0),52),B(),15&e},_greatCircleDistanceKm:ae,_greatCircleDistanceM:function(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+f(.5*(r-t)))*n+(i=+f(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+d(+r)*+d(+t)*i),2*+p(+ +c(+i),+ +c(+(1-i)))*6371.007180918475*1e3},_greatCircleDistanceRads:function(A,e){A|=0;var t,r,n,i=0;return r=+o[(e|=0)>>3],t=+o[A>>3],i=(n=+f(.5*(r-t)))*n+(i=+f(.5*(+o[e+8>>3]-+o[A+8>>3])))*(+d(+r)*+d(+t)*i),2*+p(+ +c(+i),+ +c(+(1-i)))},_gridDisk:F,_gridDiskDistances:P,_gridDistance:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a,s=0,l=0;return a=S,S=S+32|0,l=a,0|(i=0|me(A|=0,e|=0,A,e,s=a+12|0))?(S=a,0|(l=i)):0|(A=0|me(A,e,t,r,l))?(S=a,0|(l=A)):(s=0|kA(s,l),n[(l=o)>>2]=s,n[l+4>>2]=((0|s)<0)<<31>>31,S=a,0|(l=0))},_gridPathCells:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a,s=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0,k=0,C=0,D=0,E=0;if(a=S,S=S+48|0,c=a+12|0,D=a,!(s=0|me(A|=0,e|=0,A,e,i=a+24|0))&&!(s=0|me(A,e,t,r,c))){C=((0|(k=0|kA(i,c)))<0)<<31>>31,n[i>>2]=0,n[i+4>>2]=0,n[i+8>>2]=0,n[c>>2]=0,n[c+4>>2]=0,n[c+8>>2]=0,0|me(A,e,A,e,i)&&M(27795,27538,692,27747),0|me(A,e,t,r,c)&&M(27795,27538,697,27747),CA(i),CA(c),g=0|k?1/+(0|k):0,t=0|n[i>>2],v=g*+((0|n[c>>2])-t|0),r=0|n[(y=i+4|0)>>2],w=g*+((0|n[c+4>>2])-r|0),s=0|n[(x=i+8|0)>>2],g*=+((0|n[c+8>>2])-s|0),n[D>>2]=t,n[(h=D+4|0)>>2]=r,n[(m=D+8|0)>>2]=s;A:do{if((0|k)<0)s=0;else for(b=0,p=0;;){E=v*(d=+(p>>>0)+4294967296*+(0|b))+ +(0|t),u=w*d+ +(0|r),d=g*d+ +(0|s),t=~~+at(+E),c=~~+at(+u),s=~~+at(+d),E=+l(+(+(0|t)-E)),u=+l(+(+(0|c)-u)),d=+l(+(+(0|s)-d));do{if(!(E>u&E>d)){if(f=0-t|0,u>d){r=f-s|0;break}r=c,s=f-c|0;break}t=0-(c+s)|0,r=c}while(0);if(n[D>>2]=t,n[h>>2]=r,n[m>>2]=s,BA(D),0|(s=0|be(A,e,D,o+(p<<3)|0)))break A;if(!((0|b)<(0|C)|(0|b)==(0|C)&p>>>0>>0)){s=0;break A}t=0|Ve(0|p,0|b,1,0),b=r=0|B(),p=t,t=0|n[i>>2],r=0|n[y>>2],s=0|n[x>>2]}}while(0);return S=a,0|s}return S=a,0|s},_gridPathCellsSize:function(A,e,t,r,o){t|=0,r|=0,o|=0;var i,a=0,s=0,l=0;return i=S,S=S+32|0,l=i,(a=0|me(A|=0,e|=0,A,e,s=i+12|0))||(a=0|me(A,e,t,r,l))?(S=i,0|(l=a)):(r=0|Ve(0|(r=0|kA(s,l)),((0|r)<0)<<31>>31,1,0),s=0|B(),n[(l=o)>>2]=r,n[l+4>>2]=s,S=i,0|(l=0))},_gridRing:function(A,e,t,r){return 0|I(A|=0,e|=0,t|=0,r|=0)?(lt(0|r,0,48*t|0),0|(r=0|function(A,e,t,r){A|=0,e|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0,u=0,d=0,f=0;if(o=S,S=S+16|0,s=o,!(t|=0))return n[r>>2]=A,n[r+4>>2]=e,S=o,0;do{if((0|t)>=0){if((0|t)>13780509){if(0|(i=0|le(15,s)))break;i=0|n[(a=s)>>2],a=0|n[a+4>>2]}else d=0|qe(0|t,0|(i=((0|t)<0)<<31>>31),3,0),a=0|B(),i=0|Ve(0|t,0|i,1,0),i=0|Ve(0|(i=0|qe(0|d,0|a,0|i,0|B())),0|B(),1,0),a=0|B(),n[(d=s)>>2]=i,n[d+4>>2]=a;if(u=0|We(i,8)){if(!(d=0|We(i,4))){Ye(u),i=13;break}if(0|(i=0|L(A,e,t,u,d,i,a,0))){Ye(u),Ye(d);break}if(e=0|n[s>>2],(0|(s=0|n[s+4>>2]))>0|!(0|s)&e>>>0>0){i=0,l=0,c=0;do{!(0|(a=0|n[(A=u+(l<<3)|0)>>2]))&!(0|(A=0|n[A+4>>2]))||(0|n[d+(l<<2)>>2])!=(0|t)||(n[(f=r+(i<<3)|0)>>2]=a,n[f+4>>2]=A,i=i+1|0),l=0|Ve(0|l,0|c,1,0),c=0|B()}while((0|c)<(0|s)|(0|c)==(0|s)&l>>>0>>0)}Ye(u),Ye(d),i=0}else i=13}else i=2}while(0);return S=o,0|i}(A,e,t,r))):0|(r=0)},_gridRingUnsafe:I,_i64Add:Ve,_i64Subtract:Ze,_isPentagon:zA,_isResClassIII:function(A,e){return e=0|tt(0|(A|=0),0|(e|=0),52),B(),1&e},_isValidCell:LA,_isValidDirectedEdge:MA,_isValidIndex:function(A,e){A|=0;var t=0,n=0,o=0,i=0;if(!0&134217728==(-16777216&(e|=0))&&(n=0|tt(0|A,0|e,52),B(),n&=15,t=0|tt(0|A,0|e,45),B(),(t&=127)>>>0<=121)&&!(613566756&(i=0|rt(0|(o=0|tt(0|A,0|e,0|(i=3*(15^n)|0))),0|B(),0|i))&Ze(-1227133514,-1171,0|i,0|(o=0|B())))&!(4681&o&B())&&15==(0|n)|!(0|(i=0|tt(0|rt(0|~A,0|~e,0|(i=19+(3*n|0)|0)),0|B(),0|i)))&!(0|B())){if(!(0|r[20528+t|0]))return 1;if(!(0|A)&!(0|(t=8191&e)))return 1;if(i=0|nt(0|A,0|t),B(),(63-i|0)%3|0)return 1}return 0|MA(A,e)?0|(i=1):0|(i=1&!!(0|Te(A,e)))},_isValidVertex:Te,_latLngToCell:KA,_llvm_ctlz_i64:nt,_llvm_maxnum_f64:ot,_llvm_minnum_f64:it,_llvm_round_f64:at,_localIjToCell:function(A,e,t,r,o){var i,a;return A|=0,e|=0,t|=0,o|=0,a=S,S=S+16|0,i=a,(r|=0)?t=15:(t=0|function(A,e){e|=0;var t,r,o,i=0,a=0,s=0;if(a=0|n[(A|=0)>>2],n[e>>2]=a,s=0|n[A+4>>2],n[(r=e+4|0)>>2]=s,n[(o=e+8|0)>>2]=0,A=(i=(0|s)<(0|a))?a:s,(0|(i=i?s:a))<0){if(-2147483648==(0|i)||((0|A)>0?(2147483647-A|0)<(0|i):(-2147483648-A|0)>(0|i)))return 1;if((0|A)>-1?(-2147483648|A)>=(0|i):(-2147483648^A)<(0|i))return 1}return A=s-a|0,(0|a)<0?(i=0-a|0,n[r>>2]=A,n[o>>2]=i,n[e>>2]=0,a=0):(A=s,i=0),(0|A)<0&&(a=a-A|0,n[e>>2]=a,i=i-A|0,n[o>>2]=i,n[r>>2]=0,A=0),t=a-i|0,s=A-i|0,(0|i)<0?(n[e>>2]=t,n[r>>2]=s,n[o>>2]=0,A=s,s=t,i=0):s=a,(0|(a=(0|i)<(0|(a=(0|A)<(0|s)?A:s))?i:a))<=0||(n[e>>2]=s-a,n[r>>2]=A-a,n[o>>2]=i-a),0}(t,i))||(t=0|be(A,e,i,o)),S=a,0|t},_malloc:Ue,_maxFaceCount:function(A,e,t){t|=0;var r=0,o=0;if(o=0|tt(0|(A|=0),0|(e|=0),45),B(),!(0|H(127&o)))return o=2,n[t>>2]=o,0;if(o=0|tt(0|A,0|e,52),B(),!(o&=15))return o=5,n[t>>2]=o,0;for(r=1;;){if(!(!((0|rt(7,0,3*(15-r|0)|0))&A)&!((0|B())&e))){r=2,A=6;break}if(!(r>>>0>>0)){r=5,A=6;break}r=r+1|0}return 6==(0|A)?(n[t>>2]=r,0):0},_maxGridDiskSize:function(A,e){e|=0;var t=0,r=0,o=0;return(0|(A|=0))<0?0|(e=2):(0|A)>13780509?0|(e=0|le(15,e)):(o=0|qe(0|A,0|(t=((0|A)<0)<<31>>31),3,0),r=0|B(),t=0|Ve(0|A,0|t,1,0),t=0|Ve(0|(t=0|qe(0|o,0|r,0|t,0|B())),0|B(),1,0),A=0|B(),n[e>>2]=t,n[e+4>>2]=A,0|(e=0))},_maxPolygonToCellsSize:function(A,e,t,r){A|=0,e|=0,r|=0;var o,i=0,a=0,s=0,l=0,c=0;if(o=S,S=S+48|0,i=o+16|0,a=o+8|0,s=o,0|(t=0|Ce(t|=0)))return S=o,0|t;if(l=0|n[(c=A)+4>>2],n[(t=a)>>2]=n[c>>2],n[t+4>>2]=l,ke(a,i),!(t=0|eA(i,e,s))){if(e=0|n[a>>2],(0|(a=0|n[A+8>>2]))>0){i=0|n[A+12>>2],t=0;do{e=(0|n[i+(t<<3)>>2])+e|0,t=t+1|0}while((0|t)<(0|a))}i=0|n[(t=s)>>2],(0|(t=0|n[t+4>>2]))<(0|(a=((0|e)<0)<<31>>31))|(0|t)==(0|a)&i>>>0>>0?(n[(t=s)>>2]=e,n[t+4>>2]=a,t=a):e=i,l=0|Ve(0|e,0|t,12,0),c=0|B(),n[(t=s)>>2]=l,n[t+4>>2]=c,n[(t=r)>>2]=l,n[t+4>>2]=c,t=0}return S=o,0|t},_maxPolygonToCellsSizeExperimental:function(A,e,t,i){e|=0,t|=0,i|=0;var a,s,c=0,u=0,f=0,g=0,h=0,m=0,b=0,p=0;if(s=S,S=S+48|0,h=s+32|0,g=s+40|0,a=s,!(0|n[(A|=0)>>2]))return n[(m=i)>>2]=0,n[m+4>>2]=0,S=s,0;RA(h,0,0,0),c=0|n[(f=h)>>2],f=0|n[f+4>>2];do{if(e>>>0>15)n[(m=a)>>2]=0,n[m+4>>2]=0,n[a+8>>2]=4,n[a+12>>2]=-1,t=a+29|0,n[(m=a+16|0)>>2]=0,n[m+4>>2]=0,n[m+8>>2]=0,r[m+12|0]=0,r[0|t]=0|r[0|g],r[t+1|0]=0|r[g+1|0],r[t+2|0]=0|r[g+2|0],t=4,m=9;else{if(0|(t=0|Ce(t))){n[(h=a)>>2]=0,n[h+4>>2]=0,n[a+8>>2]=t,n[a+12>>2]=-1,m=a+29|0,n[(h=a+16|0)>>2]=0,n[h+4>>2]=0,n[h+8>>2]=0,r[h+12|0]=0,r[0|m]=0|r[0|g],r[m+1|0]=0|r[g+1|0],r[m+2|0]=0|r[g+2|0],m=9;break}if(!(t=0|We(1+(0|n[A+8>>2])|0,32))){n[(m=a)>>2]=0,n[m+4>>2]=0,n[a+8>>2]=13,n[a+12>>2]=-1,t=a+29|0,n[(m=a+16|0)>>2]=0,n[m+4>>2]=0,n[m+8>>2]=0,r[m+12|0]=0,r[0|t]=0|r[0|g],r[t+1|0]=0|r[g+1|0],r[t+2|0]=0|r[g+2|0],t=13,m=9;break}Be(A,t),n[(p=a)>>2]=c,n[p+4>>2]=f,n[(f=a+8|0)>>2]=0,n[a+12>>2]=e,n[a+20>>2]=A,n[a+24>>2]=t,r[a+28|0]=0,r[0|(c=a+29|0)]=0|r[0|g],r[c+1|0]=0|r[g+1|0],r[c+2|0]=0|r[g+2|0],n[a+16>>2]=3,b=+J(t),b*=+Z(t),u=+l(+ +o[t>>3]),u=b/+d(+ +it(+u,+ +l(+ +o[t+8>>3])))*6371.007180918475*6371.007180918475,t=0|n[(c=a+12|0)>>2];A:do{if((0|t)>0)do{if(se(t+-1|0,h),!(u/+o[h>>3]>10))break A;t=(p=0|n[c>>2])-1|0,n[c>>2]=t}while((0|p)>1)}while(0);if(ye(a),n[(c=i)>>2]=0,n[c+4>>2]=0,!(!(0|(t=0|n[(c=a)>>2]))&!(0|(c=0|n[c+4>>2]))))do{_A(t,c,e,h),g=h,g=0|Ve(0|n[(A=i)>>2],0|n[A+4>>2],0|n[g>>2],0|n[g+4>>2]),A=0|B(),n[(p=i)>>2]=g,n[p+4>>2]=A,ye(a),t=0|n[(p=a)>>2],c=0|n[p+4>>2]}while(!(!(0|t)&!(0|c)));t=0|n[f>>2]}}while(0);return S=s,0|t},_memcpy:st,_memset:lt,_originToDirectedEdges:function(A,e,t){t|=0;var r,o=0;return r=!(0|zA(A|=0,e|=0)),e&=-2130706433,n[(o=t)>>2]=r?A:0,n[o+4>>2]=r?285212672|e:0,n[(o=t+8|0)>>2]=A,n[o+4>>2]=301989888|e,n[(o=t+16|0)>>2]=A,n[o+4>>2]=318767104|e,n[(o=t+24|0)>>2]=A,n[o+4>>2]=335544320|e,n[(o=t+32|0)>>2]=A,n[o+4>>2]=352321536|e,n[(t=t+40|0)>>2]=A,n[t+4>>2]=369098752|e,0},_pentagonCount:function(){return 12},_polygonToCells:function(A,e,t,r){A|=0,e|=0,r|=0;var o,i,a,s,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0,v=0,y=0,w=0,x=0,k=0,C=0,M=0,D=0,E=0,j=0,Q=0,N=0,F=0,P=0,R=0,I=0,_=0;if(s=S,S=S+112|0,o=s+80|0,f=s+72|0,i=s,a=s+56|0,0|(l=0|Ce(t|=0)))return S=s,0|l;if(!(_=0|Ue(32+(n[(g=A+8|0)>>2]<<5)|0)))return S=s,13;if(Be(A,_),!(l=0|Ce(t))){if(I=0|n[(R=A)+4>>2],n[(l=f)>>2]=n[R>>2],n[l+4>>2]=I,ke(f,o),l=0|eA(o,e,i))R=0,I=0;else{if(l=0|n[f>>2],(0|(c=0|n[g>>2]))>0){u=0|n[A+12>>2],t=0;do{l=(0|n[u+(t<<3)>>2])+l|0,t=t+1|0}while((0|t)!=(0|c));t=l}else t=l;c=0|n[(l=i)>>2],(0|(l=0|n[l+4>>2]))<(0|(u=((0|t)<0)<<31>>31))|(0|l)==(0|u)&c>>>0>>0?(n[(l=i)>>2]=t,n[l+4>>2]=u,l=u):t=c,R=0|Ve(0|t,0|l,12,0),I=0|B(),n[(l=i)>>2]=R,n[l+4>>2]=I,l=0}if(!l){if(!(t=0|We(R,8)))return Ye(_),S=s,13;if(!(d=0|We(R,8)))return Ye(_),Ye(t),S=s,13;n[(F=o)>>2]=0,n[F+4>>2]=0,P=0|n[(F=A)+4>>2],n[(l=f)>>2]=n[F>>2],n[l+4>>2]=P,l=0|z(f,R,I,e,o,t,d);A:do{if(l)Ye(t),Ye(d),Ye(_);else{e:do{if((0|n[g>>2])>0){for(u=A+12|0,c=0;l=0|z((0|n[u>>2])+(c<<3)|0,R,I,e,o,t,d),c=c+1|0,!(0|l);)if((0|c)>=(0|n[g>>2]))break e;Ye(t),Ye(d),Ye(_);break A}}while(0);(0|I)>0|!(0|I)&R>>>0>0&<(0|d,0,R<<3),F=0|n[(P=o)+4>>2];e:do{if((0|F)>0|!(0|F)&(0|n[P>>2])>>>0>0){j=t,Q=d,N=t,F=d,P=t,l=t,M=t,D=d,E=d,t=d;t:for(;;){for(w=0,x=0,k=0,C=0,c=0,u=0;;){f=(d=i)+56|0;do{n[d>>2]=0,d=d+4|0}while((0|d)<(0|f));if(0|T(g=0|n[(e=j+(w<<3)|0)>>2],e=0|n[e+4>>2],1,i,0)){f=(d=i)+56|0;do{n[d>>2]=0,d=d+4|0}while((0|d)<(0|f));0|(d=0|We(7,4))&&(L(g,e,1,i,d,7,0,0),Ye(d))}for(y=0;;){p=0|n[(v=i+(y<<3)|0)>>2],v=0|n[v+4>>2];r:do{if(!(0|p)&!(0|v))d=c,f=u;else{if(h=0|At(0|p,0|v,0|R,0|I),g=0|B(),!(!(0|(f=0|n[(e=d=r+(h<<3)|0)>>2]))&!(0|(e=0|n[e+4>>2])))){m=0,b=0;do{if((0|m)>(0|I)|(0|m)==(0|I)&b>>>0>R>>>0)break t;if((0|f)==(0|p)&(0|e)==(0|v)){d=c,f=u;break r}h=0|$e(0|(d=0|Ve(0|h,0|g,1,0)),0|B(),0|R,0|I),g=0|B(),b=0|Ve(0|b,0|m,1,0),m=0|B(),f=0|n[(e=d=r+(h<<3)|0)>>2],e=0|n[e+4>>2]}while(!(!(0|f)&!(0|e)))}if(!(0|p)&!(0|v)){d=c,f=u;break}qA(p,v,a),0|Me(A,_,a)&&(b=0|Ve(0|c,0|u,1,0),u=0|B(),n[(m=d)>>2]=p,n[m+4>>2]=v,n[(c=Q+(c<<3)|0)>>2]=p,n[c+4>>2]=v,c=b),d=c,f=u}}while(0);if((y=y+1|0)>>>0>=7)break;c=d,u=f}if(w=0|Ve(0|w,0|x,1,0),x=0|B(),k=0|Ve(0|k,0|C,1,0),C=0|B(),c=0|n[(u=o)>>2],!((0|C)<(0|(u=0|n[u+4>>2]))|(0|C)==(0|u)&k>>>0>>0))break;c=d,u=f}if((0|u)>0|!(0|u)&c>>>0>0){c=0,u=0;do{n[(C=j+(c<<3)|0)>>2]=0,n[C+4>>2]=0,c=0|Ve(0|c,0|u,1,0),u=0|B(),k=0|n[(C=o)+4>>2]}while((0|u)<(0|k)|((0|u)==(0|k)?c>>>0<(0|n[C>>2])>>>0:0))}if(n[(C=o)>>2]=d,n[C+4>>2]=f,!((0|f)>0|!(0|f)&d>>>0>0))break e;y=t,w=E,x=P,k=D,C=Q,t=M,E=l,D=N,M=y,l=w,P=F,F=x,N=k,Q=j,j=C}Ye(N),Ye(F),Ye(_),l=1;break A}l=d}while(0);Ye(_),Ye(t),Ye(l),l=0}}while(0);return S=s,0|l}}return Ye(_),S=s,0|l},_polygonToCellsExperimental:function(A,e,t,o,i,a){o|=0,i|=0,a|=0;var s,l,c,u=0,d=0,f=0,g=0,h=0,m=0,b=0,p=0;c=S,S=S+160|0,d=c+64|0,h=c+112|0,p=c,function(A,e,t,o){A|=0,e|=0,t|=0,o|=0;var i,a,s,l=0,c=0,u=0,d=0;s=S,S=S+48|0,i=s+40|0,a=s,RA(c=s+32|0,0,0,0),u=0|n[c>>2],c=0|n[c+4>>2];do{if(t>>>0<=15){if(0|(l=0|Ce(o))){n[(o=a)>>2]=0,n[o+4>>2]=0,n[a+8>>2]=l,n[a+12>>2]=-1,u=a+29|0,n[(o=a+16|0)>>2]=0,n[o+4>>2]=0,n[o+8>>2]=0,r[o+12|0]=0,r[0|u]=0|r[0|i],r[u+1|0]=0|r[i+1|0],r[u+2|0]=0|r[i+2|0];break}if(l=0|We(1+(0|n[e+8>>2])|0,32)){Be(e,l),n[(d=a)>>2]=u,n[d+4>>2]=c,n[a+8>>2]=0,n[a+12>>2]=t,n[a+16>>2]=o,n[a+20>>2]=e,n[a+24>>2]=l,r[a+28|0]=0,r[0|(u=a+29|0)]=0|r[0|i],r[u+1|0]=0|r[i+1|0],r[u+2|0]=0|r[i+2|0];break}n[(o=a)>>2]=0,n[o+4>>2]=0,n[a+8>>2]=13,n[a+12>>2]=-1,u=a+29|0,n[(o=a+16|0)>>2]=0,n[o+4>>2]=0,n[o+8>>2]=0,r[o+12|0]=0,r[0|u]=0|r[0|i],r[u+1|0]=0|r[i+1|0],r[u+2|0]=0|r[i+2|0];break}n[(u=a)>>2]=0,n[u+4>>2]=0,n[a+8>>2]=4,n[a+12>>2]=-1,d=a+29|0,n[(u=a+16|0)>>2]=0,n[u+4>>2]=0,n[u+8>>2]=0,r[u+12|0]=0,r[0|d]=0|r[0|i],r[d+1|0]=0|r[i+1|0],r[d+2|0]=0|r[i+2|0]}while(0);ye(a),n[A>>2]=n[a>>2],n[A+4>>2]=n[a+4>>2],n[A+8>>2]=n[a+8>>2],n[A+12>>2]=n[a+12>>2],n[A+16>>2]=n[a+16>>2],n[A+20>>2]=n[a+20>>2],n[A+24>>2]=n[a+24>>2],n[A+28>>2]=n[a+28>>2],S=s}(g=c+80|0,A|=0,e|=0,t|=0),ee(d,0|n[(f=g)>>2],0|n[f+4>>2],e),s=0|n[(f=d)>>2],f=0|n[f+4>>2],u=0|n[g+8>>2],n[(m=h+4|0)>>2]=n[g>>2],n[m+4>>2]=n[g+4>>2],n[m+8>>2]=n[g+8>>2],n[m+12>>2]=n[g+12>>2],n[m+16>>2]=n[g+16>>2],n[m+20>>2]=n[g+20>>2],n[m+24>>2]=n[g+24>>2],n[m+28>>2]=n[g+28>>2],n[(m=p)>>2]=s,n[m+4>>2]=f,n[(m=p+8|0)>>2]=u,e=h,t=36+(A=p+12|0)|0;do{n[A>>2]=n[e>>2],A=A+4|0,e=e+4|0}while((0|A)<(0|t));if(n[(h=p+48|0)>>2]=n[d>>2],n[h+4>>2]=n[d+4>>2],n[h+8>>2]=n[d+8>>2],n[h+12>>2]=n[d+12>>2],!(0|s)&!(0|f))return S=c,0|u;t=p+16|0,l=p+24|0,g=p+28|0,u=0,d=0,e=s,A=f;do{if(!((0|u)<(0|i)|(0|u)==(0|i)&d>>>0>>0)){b=4;break}if(f=d,d=0|Ve(0|d,0|u,1,0),u=0|B(),n[(f=a+(f<<3)|0)>>2]=e,n[f+4>>2]=A,re(h),!(0|(e=0|n[(A=h)>>2]))&!(0|(A=0|n[A+4>>2]))){if(ye(t),!(0|(A=0|n[(e=t)>>2]))&!(0|(e=0|n[e+4>>2]))){b=10;break}te(A,e,0|n[g>>2],h),e=0|n[(A=h)>>2],A=0|n[A+4>>2]}n[(f=p)>>2]=e,n[f+4>>2]=A}while(!(!(0|e)&!(0|A)));return 4==(0|b)?(0|(e=0|n[(A=p+40|0)>>2])&&Ye(e),n[(b=p+16|0)>>2]=0,n[b+4>>2]=0,n[l>>2]=0,n[p+36>>2]=0,n[g>>2]=-1,n[p+32>>2]=0,n[A>>2]=0,te(0,0,0,h),n[p>>2]=0,n[p+4>>2]=0,n[m>>2]=0,S=c,0|(p=14)):(10==(0|b)&&(n[p>>2]=0,n[p+4>>2]=0,n[m>>2]=n[l>>2]),p=0|n[m>>2],S=c,0|p)},_readInt64AsDoubleFromPointer:function(A){return+(+((0|n[(A|=0)>>2])>>>0)+4294967296*+(0|n[A+4>>2]))},_res0CellCount:function(){return 122},_round:ct,_sbrk:ut,_sizeOfCellBoundary:function(){return 168},_sizeOfCoordIJ:function(){return 8},_sizeOfGeoLoop:function(){return 8},_sizeOfGeoPolygon:function(){return 16},_sizeOfH3Index:function(){return 8},_sizeOfLatLng:function(){return 16},_sizeOfLinkedGeoPolygon:function(){return 12},_uncompactCells:function(A,e,t,r,o,i,a){A|=0,r|=0,o|=0,i|=0;var s,l=0,c=0,u=0,d=0,f=0,g=0,h=0,m=0;if(s=S,S=S+16|0,m=s,!((0|(t|=0))>0|!(0|t)&(e|=0)>>>0>0))return S=s,0;if((0|(a|=0))>=16)return S=s,12;g=0,h=0,f=0,l=0;A:for(;;){if(d=0|tt(0|(c=0|n[(u=A+(g<<3)|0)>>2]),0|(u=0|n[u+4>>2]),52),B(),(15&d)>(0|a)){l=12,c=11;break}if(ee(m,c,u,a),!(0|(u=0|n[(d=m)>>2]))&!(0|(d=0|n[d+4>>2])))c=f;else{c=f;do{if(!((0|l)<(0|i)|(0|l)==(0|i)&c>>>0>>0)){c=10;break A}n[(f=r+(c<<3)|0)>>2]=u,n[f+4>>2]=d,c=0|Ve(0|c,0|l,1,0),l=0|B(),re(m),u=0|n[(f=m)>>2],d=0|n[f+4>>2]}while(!(!(0|u)&!(0|d)))}if(g=0|Ve(0|g,0|h,1,0),!((0|(h=0|B()))<(0|t)|(0|h)==(0|t)&g>>>0>>0)){l=0,c=11;break}f=c}return 10==(0|c)?(S=s,0|(m=14)):11==(0|c)?(S=s,0|l):0},_uncompactCellsSize:function(A,e,t,r,o){A|=0,e|=0,t|=0,r|=0,o|=0;var i,a,s=0,l=0,c=0,u=0,d=0,f=0;a=S,S=S+16|0,i=a;A:do{if((0|t)>0|!(0|t)&e>>>0>0){for(d=0,l=0,s=0,f=0;;){if(!(!(0|(c=0|n[(u=A+(d<<3)|0)>>2]))&!(0|(u=0|n[u+4>>2]))||(u=!(0|_A(c,u,r,i)),l=0|Ve(0|n[(c=i)>>2],0|n[c+4>>2],0|l,0|s),s=0|B(),u))){s=12;break}if(d=0|Ve(0|d,0|f,1,0),!((0|(f=0|B()))<(0|t)|(0|f)==(0|t)&d>>>0>>0))break A}return S=a,0|s}l=0,s=0}while(0);return n[o>>2]=l,n[o+4>>2]=s,S=a,0},_vertexToLatLng:function(A,e,t){t|=0;var r,o,i,a,s=0,l=0;return a=S,S=S+192|0,o=a,i=a+168|0,s=0|tt(0|(A|=0),0|(e|=0),56),B(),s&=7,0|(r=0|XA(A,l=-2130706433&e|134217728,i))?(S=a,0|(l=r)):(e=0|tt(0|A,0|e,52),B(),e&=15,0|zA(A,l)?jA(i,e,s,1,o):FA(i,e,s,1,o),l=o+8|0,n[t>>2]=n[l>>2],n[t+4>>2]=n[l+4>>2],n[t+8>>2]=n[l+8>>2],n[t+12>>2]=n[l+12>>2],S=a,0|(l=0))},establishStackSpace:function(A,e){S=A|=0},stackAlloc:function(A){var e;return e=S,S=15+(S=S+(A|=0)|0)&-16,0|e},stackRestore:function(A){S=A|=0},stackSave:function(){return 0|S}}}({Math:Math,Int8Array:Int8Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Float32Array:Float32Array,Float64Array:Float64Array},{b:function(A){s=A},c:function(){return s},d:function(A,e,t,r){tA("Assertion failed: "+v(A)+", at: "+[e?v(e):"unknown filename",t,r?v(r):"unknown function"])},e:function(A){return t.___errno_location&&(h[t.___errno_location()>>2]=A),A},f:H,g:function(A,e,t){f.set(f.subarray(e,e+t),A)},h:function(A){var e=H(),t=16777216,r=2130706432;if(A>r)return!1;for(var n=Math.max(e,16777216);n0))return 0;for(var n=t+r-1,o=0;o=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&A.charCodeAt(++o)),i<=127){if(t>=n)break;e[t++]=i}else if(i<=2047){if(t+1>=n)break;e[t++]=192|i>>6,e[t++]=128|63&i}else if(i<=65535){if(t+2>=n)break;e[t++]=224|i>>12,e[t++]=128|i>>6&63,e[t++]=128|63&i}else{if(t+3>=n)break;e[t++]=240|i>>18,e[t++]=128|i>>12&63,e[t++]=128|i>>6&63,e[t++]=128|63&i}}e[t]=0}(A,f,e,t)}(A,e=Z(t),t)}return e},array:function(A){var e,t,r=Z(A.length);return e=A,t=r,d.set(e,t),r}},o=c(A),i=[],a=0;if(r)for(var s=0;s>1]=e;break;case"i32":h[A>>2]=e;break;case"i64":R=[e>>>0,(L=e,+Q(L)>=1?L>0?(0|F(+S(L/4294967296),4294967295))>>>0:~~+N((L-+(~~L>>>0))/4294967296)>>>0:0)],h[A>>2]=R[0],h[A+4>>2]=R[1];break;case"float":m[A>>2]=e;break;case"double":b[A>>3]=e;break;default:tA("invalid type for setValue: "+t)}},t.getValue=function(A,e,t){switch("*"===(e=e||"i8").charAt(e.length-1)&&(e="i32"),e){case"i1":case"i8":return d[0|A];case"i16":return g[A>>1];case"i32":case"i64":return h[A>>2];case"float":return m[A>>2];case"double":return b[A>>3];default:tA("invalid type for getValue: "+e)}return null},I){z(I)||(W=I,I=t.locateFile?t.locateFile(W,o):o+W),P++,t.monitorRunDependencies&&t.monitorRunDependencies(P);var X=function(A){A.byteLength&&(A=new Uint8Array(A)),f.set(A,8),t.memoryInitializerRequest&&delete t.memoryInitializerRequest.response,function(){if(P--,t.monitorRunDependencies&&t.monitorRunDependencies(P),0==P&&T){var A=T;T=null,A()}}()},q=function(){n(I,X,function(){throw"could not load memory initializer "+I})},$=O(I);if($)X($.buffer);else if(t.memoryInitializerRequest){var AA=function(){var A=t.memoryInitializerRequest,e=A.response;if(200!==A.status&&0!==A.status){var r=O(t.memoryInitializerRequestURL);if(!r)return void q();e=r.buffer}X(e)};t.memoryInitializerRequest.response?setTimeout(AA,0):t.memoryInitializerRequest.addEventListener("load",AA)}else q()}function eA(A){function e(){V||(V=!0,l||(k(B),k(M),t.onRuntimeInitialized&&t.onRuntimeInitialized(),function(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)j(t.postRun.shift());k(D)}()))}P>0||(function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)E(t.preRun.shift());k(C)}(),P>0||(t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),e()},1)):e()))}function tA(A){throw t.onAbort&&t.onAbort(A),i(A+=""),a(A),l=!0,"abort("+A+"). Build with -s ASSERTIONS=1 for more info."}if(T=function A(){V||eA(),V||(T=A)},t.run=eA,t.abort=tA,t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return eA(),A}("object"==typeof At?At:{}),et="number",tt={0:"Success",1:"The operation failed but a more specific error is not available",2:"Argument was outside of acceptable range",3:"Latitude or longitude arguments were outside of acceptable range",4:"Resolution argument was outside of acceptable range",5:"Cell argument was not valid",6:"Directed edge argument was not valid",7:"Undirected edge argument was not valid",8:"Vertex argument was not valid",9:"Pentagon distortion was encountered",10:"Duplicate input",11:"Cell arguments were not neighbors",12:"Cell arguments had incompatible resolutions",13:"Memory allocation failed",14:"Bounds of provided memory were insufficient",15:"Mode or flags argument was not valid",16:"Index argument was not valid",17:"Base cell number was outside of acceptable range",18:"Child indexing digits invalid",19:"Child indexing digits refer to a deleted subsequence"},rt={1e3:"Unknown unit",1001:"Array length out of bounds",1002:"Got unexpected null value for H3 index"};function nt(A,e,t){var r=t&&"value"in t,n=new Error((A[e]||"Unknown error")+" (code: "+e+(r?", value: "+t.value:"")+")");return n.code=e,n}function ot(A){if(0!==A)throw function(A,e){return nt(tt,A,2===arguments.length?{value:e}:{})}(A)}var it={};[["sizeOfH3Index",et],["sizeOfLatLng",et],["sizeOfCellBoundary",et],["sizeOfGeoLoop",et],["sizeOfGeoPolygon",et],["sizeOfLinkedGeoPolygon",et],["sizeOfCoordIJ",et],["readInt64AsDoubleFromPointer",et],["isValidCell",et,[et,et]],["isValidIndex",et,[et,et]],["latLngToCell",et,[et,et,et,et]],["cellToLatLng",et,[et,et,et]],["cellToBoundary",et,[et,et,et]],["maxGridDiskSize",et,[et,et]],["gridDisk",et,[et,et,et,et]],["gridDiskDistances",et,[et,et,et,et,et]],["gridRing",et,[et,et,et,et]],["gridRingUnsafe",et,[et,et,et,et]],["maxPolygonToCellsSize",et,[et,et,et,et]],["polygonToCells",et,[et,et,et,et]],["maxPolygonToCellsSizeExperimental",et,[et,et,et,et]],["polygonToCellsExperimental",et,[et,et,et,et,et,et]],["cellsToLinkedMultiPolygon",et,[et,et,et]],["destroyLinkedMultiPolygon",null,[et]],["compactCells",et,[et,et,et,et]],["uncompactCells",et,[et,et,et,et,et,et]],["uncompactCellsSize",et,[et,et,et,et,et]],["isPentagon",et,[et,et]],["isResClassIII",et,[et,et]],["getBaseCellNumber",et,[et,et]],["getResolution",et,[et,et]],["getIndexDigit",et,[et,et,et]],["constructCell",et,[et,et,et,et]],["maxFaceCount",et,[et,et,et]],["getIcosahedronFaces",et,[et,et,et]],["cellToParent",et,[et,et,et,et]],["cellToChildren",et,[et,et,et,et]],["cellToCenterChild",et,[et,et,et,et]],["cellToChildrenSize",et,[et,et,et,et]],["cellToChildPos",et,[et,et,et,et]],["childPosToCell",et,[et,et,et,et,et,et]],["areNeighborCells",et,[et,et,et,et,et]],["cellsToDirectedEdge",et,[et,et,et,et,et]],["getDirectedEdgeOrigin",et,[et,et,et]],["getDirectedEdgeDestination",et,[et,et,et]],["isValidDirectedEdge",et,[et,et]],["directedEdgeToCells",et,[et,et,et]],["originToDirectedEdges",et,[et,et,et]],["directedEdgeToBoundary",et,[et,et,et]],["gridDistance",et,[et,et,et,et,et]],["gridPathCells",et,[et,et,et,et,et]],["gridPathCellsSize",et,[et,et,et,et,et]],["cellToLocalIj",et,[et,et,et,et,et,et]],["localIjToCell",et,[et,et,et,et,et]],["getHexagonAreaAvgM2",et,[et,et]],["getHexagonAreaAvgKm2",et,[et,et]],["getHexagonEdgeLengthAvgM",et,[et,et]],["getHexagonEdgeLengthAvgKm",et,[et,et]],["greatCircleDistanceM",et,[et,et]],["greatCircleDistanceKm",et,[et,et]],["greatCircleDistanceRads",et,[et,et]],["cellAreaM2",et,[et,et,et]],["cellAreaKm2",et,[et,et,et]],["cellAreaRads2",et,[et,et,et]],["edgeLengthM",et,[et,et,et]],["edgeLengthKm",et,[et,et,et]],["edgeLengthRads",et,[et,et,et]],["getNumCells",et,[et,et]],["getRes0Cells",et,[et]],["res0CellCount",et],["getPentagons",et,[et,et]],["pentagonCount",et],["cellToVertex",et,[et,et,et,et]],["cellToVertexes",et,[et,et,et]],["vertexToLatLng",et,[et,et,et]],["isValidVertex",et,[et,et]]].forEach(function(A){it[A[0]]=At.cwrap.apply(At,A)});var at=16,st=it.sizeOfH3Index(),lt=it.sizeOfLatLng(),ct=it.sizeOfCellBoundary();it.sizeOfGeoPolygon(),it.sizeOfGeoLoop(),it.sizeOfLinkedGeoPolygon(),it.sizeOfCoordIJ();var ut=/[^0-9a-fA-F]/;function dt(A){if(A>=0)return A.toString(at);var e=ft(8,(A&=2147483647).toString(at));return(parseInt(e[0],at)+8).toString(at)+e.substring(1)}function ft(A,e){for(var t=A-e.length,r="",n=0;n.85?.9+(i-.85)/.15*.1:.1+(i-.15)/.7*.8;var i;return kt(r[Math.min(23,Math.floor(24*o))])}function Bt({coveragePoints:t,visible:r,terrainEnabled:n=!1,brightness:i=.7,basemapMode:a="dark"}){const{current:s}=o(),[l,c]=A.useState(null);A.useEffect(()=>{const A=()=>{var A;const e=null==(A=null==s?void 0:s.getMap)?void 0:A.call(s);e&&!l&&c(e)};A();const e=setInterval(A,50),t=setTimeout(()=>clearInterval(e),5e3);return()=>{clearInterval(e),clearTimeout(t)}},[s,l]);const[u,d]=A.useState(null),[f,g]=A.useState(!1),h=A.useRef({aborted:!1}),m=A.useRef(0),b=A.useRef(a),p=function(e){const[t,r]=A.useState(e);return A.useEffect(()=>{const A=setTimeout(()=>r(e),300);return()=>clearTimeout(A)},[e,300]),t}(t),v=A.useMemo(()=>function(A="dark"){var e;if("light"===A)return xt;const t=z();return 24===t.length&&0!==(null==(e=t[0])?void 0:e[0])?t:wt}(a),[a]);A.useEffect(()=>{if(!p||!Array.isArray(p)||0===p.length)return void queueMicrotask(()=>{d(null),m.current=0});const A=b.current!==a;if(p.length===m.current&&u&&!A)return;m.current=p.length,b.current=a,h.current.aborted=!0,h.current={aborted:!1};const e=h.current;g(!0);const{cells:t,minQuality:r,maxQuality:n}=function(A){const e=new Map;for(const o of A){if("number"!=typeof o.lat||"number"!=typeof o.lon||isNaN(o.lat)||isNaN(o.lon))continue;const A=mt(o.lat,o.lon,8),t=e.get(A),r=o.weight;t?(t.count++,t.qualitySum+=r):e.set(A,{count:1,qualitySum:r})}const t=[];let r=1/0,n=-1/0;for(const[o,i]of e.entries()){const A=i.qualitySum/i.count;t.push({hexId:o,count:i.count,avgQuality:A}),r=Math.min(r,A),n=Math.max(n,A)}return{cells:t,minQuality:t.length>0?r:0,maxQuality:t.length>0?n:0}}(p);if(0===t.length)return d(null),void g(!1);if(t.length<500){const A=function(A,e,t,r){const n=[];for(const o of A){const A=bt(o.hexId).map(([A,e])=>[e,A]);A.push(A[0]);const i=Ct(o.avgQuality,e,t,r);n.push({type:"Feature",properties:{color:i,quality:o.avgQuality,count:o.count},geometry:{type:"Polygon",coordinates:[A]}})}return{type:"FeatureCollection",features:n}}(t,r,n,v);return void(e.aborted||(d(A),g(!1)))}return async function(A,e,t,r,n){const o=[];let i=0;for(;i[e,A]);a.push(a[0]);const s=Ct(n.avgQuality,e,t,r);o.push({type:"Feature",properties:{color:s,quality:n.avgQuality,count:n.count},geometry:{type:"Polygon",coordinates:[a]}})}irequestAnimationFrame(A))}return{type:"FeatureCollection",features:o}}(t,r,n,v,e).then(A=>{!e.aborted&&A&&d(A)}).finally(()=>{e.aborted||g(!1)}),()=>{e.aborted=!0}},[p,v]),A.useEffect(()=>{if(!l)return;const A=()=>{var A,e;try{const t=l.getLayer(yt),n=l.getSource(vt);if(r&&u&&u.features.length>0){if(n?l.getSource(vt).setData(u):l.addSource(vt,{type:"geojson",data:u}),!t){const t=l.getLayer("topology-weak-edges-native"),r=null==(e=null==(A=l.getStyle())?void 0:A.layers)?void 0:e.find(A=>"symbol"===A.type),n=t?"topology-weak-edges-native":null==r?void 0:r.id;l.addLayer({id:yt,type:"fill",source:vt,paint:{"fill-color":["get","color"],"fill-opacity":i}},n)}}else t&&l.removeLayer(yt),n&&l.removeSource(vt)}catch(t){}};l.isStyleLoaded()?A():l.once("style.load",A)},[l,r,u,n]),A.useEffect(()=>{if(l&&r)try{l.getLayer(yt)&&l.setPaintProperty(yt,"fill-opacity",i)}catch{}},[l,i,r]),A.useEffect(()=>()=>{if(l)try{l.getLayer(yt)&&l.removeLayer(yt),l.getSource(vt)&&l.removeSource(vt)}catch{}},[l]);const y=(null==u?void 0:u.features.length)??0;return y>0&&r?e.jsx("div",{"data-testid":"wardriving-hexlayer-maplibre-active","data-point-count":(null==t?void 0:t.length)||0,"data-cell-count":y,"data-terrain-enabled":n,"data-is-processing":f,style:{display:"none"}}):null}const Mt="https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png",Dt="terrarium",Et="terrain-dem",jt="hillshade-dem",Qt="terrain-hillshade";function Nt({enabled:e,exaggeration:t=4}){const{current:r}=o(),[n,i]=A.useState(null),a=A.useRef(null);return A.useEffect(()=>{const A=()=>{var A;const e=null==(A=null==r?void 0:r.getMap)?void 0:A.call(r);e&&!n&&i(e)};A();const e=setInterval(A,50),t=setTimeout(()=>clearInterval(e),5e3);return()=>{clearInterval(e),clearTimeout(t)}},[r,n]),A.useEffect(()=>{if(!n)return;let A=!0;const e=()=>{var e,t;if(A)try{if(n.getSource(jt)||n.addSource(jt,{type:"raster-dem",tiles:[Mt],encoding:Dt,tileSize:256,maxzoom:14}),!n.getLayer(Qt)){const A=null==(t=null==(e=n.getStyle())?void 0:e.layers)?void 0:t.find(A=>"symbol"===A.type);n.addLayer({id:Qt,type:"hillshade",source:jt,paint:{"hillshade-shadow-color":"rgba(10, 10, 10, 0.6)","hillshade-highlight-color":"rgba(245, 240, 230, 0.4)","hillshade-accent-color":"rgba(90, 75, 65, 0.3)","hillshade-illumination-direction":315,"hillshade-exaggeration":.35}},null==A?void 0:A.id)}n.getSource(Et)||n.addSource(Et,{type:"raster-dem",tiles:[Mt],encoding:Dt,tileSize:256,maxzoom:14})}catch(r){}};return n.isStyleLoaded()?e():(n.once("style.load",e),n.once("load",()=>{A&&!n.getSource(jt)&&e()})),()=>{A=!1}},[n]),A.useEffect(()=>{if(!n)return;let A=!0,r=!1;const o=()=>{if(A&&n.getSource(Et))try{e?(n.setCenterClampedToGround(!1),n.setTerrain({source:Et,exaggeration:t}),n.setMaxPitch(70),!r&&n.getPitch()<30&&!n.isMoving()&&(r=!0,null!==a.current&&clearTimeout(a.current),a.current=window.setTimeout(()=>{a.current=null,A&&!n.isMoving()&&n.getPitch()<30&&n.easeTo({pitch:45,duration:1e3})},200))):(n.setTerrain(null),n.setCenterClampedToGround(!0),n.getPitch()>0&&!n.isMoving()&&n.easeTo({pitch:0,duration:800}),n.setMaxPitch(60))}catch(o){}};if(n.isStyleLoaded()&&n.getSource(Et))o();else{const A=()=>{n.getSource(Et)&&o()};n.once("idle",A)}return()=>{A=!1,null!==a.current&&(clearTimeout(a.current),a.current=null)}},[n,e,t]),A.useEffect(()=>()=>{var A;try{(null==(A=null==n?void 0:n.getStyle)?void 0:A.call(n))&&n.isStyleLoaded()&&(n.setTerrain(null),n.getLayer(Qt)&&n.removeLayer(Qt),n.getSource(jt)&&n.removeSource(jt),n.getSource(Et)&&n.removeSource(Et))}catch{}},[n]),null}const St=.03,Ft=.1,Pt=2;function Tt(A,e=3){if(A.length<3||e<=0)return A;let t=A;for(let r=0;r0&&A.push([A[0][0],A[0][1]]),t=A}return t}function Lt(A,e={}){const t=function(A,e={}){if(A.length<3)return{coordinates:[],valid:!1};const{bandwidth:t=St,threshold:n=Ft,cellSize:o=Pt}=e,i=function(A,e){let t=1/0,r=-1/0,n=1/0,o=-1/0;for(const[i,a]of A)ir&&(r=i),ao&&(o=a);return t-=e,r+=e,n-=e,o+=e,{minX:t,minY:n,maxX:r,maxY:o,width:r-t,height:o-n}}(A,.02),a=Math.ceil(i.width/(t/2)),s=Math.ceil(i.height/(t/2)),l=Math.min(1,200/Math.max(a,s)),c=Math.max(10,Math.ceil(a*l)),u=Math.max(10,Math.ceil(s*l)),d=A=>A/c*i.width+i.minX,f=A=>A/u*i.height+i.minY,g=t/i.width*c;try{const e=r().x(A=>(A[0]-i.minX)/i.width*c).y(A=>(A[1]-i.minY)/i.height*u).size([c,u]).bandwidth(Math.max(5,g)).cellSize(o)(A);if(0===e.length)return{coordinates:[],valid:!1};const t=Math.max(...e.map(A=>A.value))*n;let a=e[0],s=1/0;for(const A of e){const e=Math.abs(A.value-t);e0){const e=A[0],t=A[A.length-1];e[0]===t[0]&&e[1]===t[1]||A.push([e[0],e[1]])}if(A.length>=4){const t=Tt(A);e.push(t)}}e.length>0&&l.push(e)}const h=[];for(const A of l)for(const e of A)h.push(e);return{coordinates:l,valid:l.length>0}}catch(h){return{coordinates:[],valid:!1}}}(A,e);return t.valid&&0!==t.coordinates.length?1===t.coordinates.length?{type:"Polygon",coordinates:t.coordinates[0]}:{type:"MultiPolygon",coordinates:t.coordinates}:null}function Rt(A,e,t){return(e[0]-A[0])*(t[1]-A[1])-(e[1]-A[1])*(t[0]-A[0])}function It(A,e,t,r,n){const o=n*n,i=o*n;return[.5*(2*e[0]+(-A[0]+t[0])*n+(2*A[0]-5*e[0]+4*t[0]-r[0])*o+(-A[0]+3*e[0]-3*t[0]+r[0])*i),.5*(2*e[1]+(-A[1]+t[1])*n+(2*A[1]-5*e[1]+4*t[1]-r[1])*o+(-A[1]+3*e[1]-3*t[1]+r[1])*i)]}function _t(A){let e=function(A){if(A.length<3)return A;const e=[...A].sort((A,e)=>A[0]-e[0]||A[1]-e[1]),t=[];for(const n of e){for(;t.length>=2&&Rt(t[t.length-2],t[t.length-1],n)<=0;)t.pop();t.push(n)}const r=[];for(let n=e.length-1;n>=0;n--){const A=e[n];for(;r.length>=2&&Rt(r[r.length-2],r[r.length-1],A)<=0;)r.pop();r.push(A)}return t.pop(),r.pop(),t.concat(r)}(A);if(e.length<3)return null;e=function(A){if(A.length<3)return A;let e=0,t=0;for(const[r,n]of A)e+=r,t+=n;return e/=A.length,t/=A.length,A.map(([A,r])=>{const n=A-e,o=r-t,i=Math.sqrt(n*n+o*o);if(i<1e-4)return[A,r];const a=(i+.008)/i;return[e+n*a,t+o*a]})}(e);const t=function(A){if(A.length<3)return A;const e=[],t=A.length;for(let r=0;rt?function(A,e,t,r){const n=[];for(const[o,i]of A.communities){const A=[];for(const t of i){const r=e.get(t);r&&A.push([r[1],r[0]])}if(A.length<3)continue;let a=Lt(A,{bandwidth:t,threshold:r});a||(a=_t(A)),a&&n.push({type:"Feature",properties:{community:o,color:cA(o),borderColor:lA(o),nodeCount:i.length},geometry:a})}return{type:"FeatureCollection",features:n}}(t,r,s,l):{type:"FeatureCollection",features:[]},[t,r,s,l]),d=n?o:0,f={"fill-color":["get","color"],"fill-opacity":d},g={"line-color":["get","borderColor"],"line-width":c,"line-opacity":d};return e.jsxs(i,{id:"mincut-partition",type:"geojson",data:u,children:[e.jsx(a,{id:"mincut-partition-fill",type:"fill",paint:f}),e.jsx(a,{id:"mincut-partition-stroke",type:"line",paint:g})]})}const Ht={showTopology:!1,showNeighborLines:!0,show3DTerrain:!1,showMinCut:!1,nodeFilter:"all"},Gt=DA()(EA(A=>({viewState:null,setViewState:e=>A({viewState:e,lastSavedAt:Date.now()}),toggles:Ht,setToggle:(e,t)=>A(A=>({toggles:{...A.toggles,[e]:t},lastSavedAt:Date.now()})),setToggles:e=>A(A=>({toggles:{...A.toggles,...e},lastSavedAt:Date.now()})),hasAnalyzed:!1,setHasAnalyzed:e=>A({hasAnalyzed:e,lastSavedAt:Date.now()}),lastSavedAt:null,reset:()=>A({viewState:null,toggles:Ht,hasAnalyzed:!1,lastSavedAt:null})}),{name:"pymc-map-view",partialize:A=>({viewState:A.viewState,toggles:A.toggles,hasAnalyzed:A.hasAnalyzed,lastSavedAt:A.lastSavedAt})}));function Ot(A,e=!1,t=!1,r=!1,n=.7,o){const i=v(o);return r?n>=.75?i.restBright:i.rest:n>=.85?i.rest:i.restDim}function Ut(A){return[A[1],A[0]]}function Yt(A,e,t,r=12){const[n,o]=A,[i,a]=e,s=[];for(let l=0;l<=r;l++){const A=l/r,e=o+(a-o)*A,c=n+(i-n)*A,u=4*t*A*(1-A);s.push([e,c,u])}return s}function Wt(A,e,t,r,n,o,i,a,s,l,c,u="dark"){const d=Ae(),f=[];let g=1/0,h=-1/0;const m=[];for(const p of A){const A=.7*(p.edge.avgConfidence??(e?.7:.5))+p.edge.certainCount/Math.max(i,1)*.3+(e?.5:0);m.push({polyline:p,brightnessScore:A}),g=Math.min(g,A),h=Math.max(h,A)}if(0===m.length)return{type:"FeatureCollection",features:[]};const b=h-g||1;m.sort((A,e)=>A.brightnessScore-e.brightnessScore);for(const{polyline:p,brightnessScore:v}of m){const{from:A,to:i,edge:h}=p,m=t.get(h.key)??0;if(m<=0)continue;const y=a.has(h.key),w=s.has(h.key),x=h.avgConfidence??(e?.7:.5),k=l===h.key,C=c[h.fromHash],B=c[h.toHash],M=(null==C?void 0:C.node_name)||(null==C?void 0:C.name)||h.fromHash.slice(0,8),D=(null==B?void 0:B.node_name)||(null==B?void 0:B.name)||h.toHash.slice(0,8),E=[A[0]+(i[0]-A[0])*m,A[1]+(i[1]-A[1])*m];let j,Q,N,S;if(e){const A=o.get(h.key)??XA(h.certainCount),e=n.get(h.key)??A;j=e+(A-e)*r,k?j=Math.max(1.6*j,4.5):w&&(j*=1.3)}else j=1.5;if(Q=k?d.edges.highlight:Ot(0,h.isDirectPathEdge??!1,y,w,x,u),N=k?d.edges.highlight:h.isDirectPathEdge?d.edges.hoverDirect:y?d.edges.hoverLoop:d.edges.hoverStandard,e){const A=Math.min(1.5*m,1)*d.edgeOpacity;S=w?1.15*A:A}else S=(.3+.3*x)*m;k&&(S=.95);const F=(v-g)/b;f.push({type:"Feature",properties:{key:h.key,baseColor:Q,hoverColor:N,baseWidth:j,baseOpacity:S,brightnessScore:F,isLoopEdge:y,isBackbone:w,isDirectPath:h.isDirectPathEdge??!1,isHubConnection:h.isHubConnection??!1,isZeroHop:h.isZeroHop??!1,isValidated:e,certainCount:h.certainCount,confidence:x,symmetryRatio:h.symmetryRatio??1,dominantDirection:h.dominantDirection??"balanced",fromName:M,toName:D,fromHash:h.fromHash,toHash:h.toHash},geometry:{type:"LineString",coordinates:[Ut(A),Ut(E)]}})}return{type:"FeatureCollection",features:f}}function Vt(A,e){const t=Ae(),r=[];let n=0;for(const o of A){const A=e.get(o.hash);A&&A.blendedScore>n&&(n=A.blendedScore)}for(const o of A){const{from:A,to:i,hash:a,neighbor:s,lastHopData:l}=o,c=`neighbor-${a}`,u=(null==l?void 0:l.avgRssi)??s.rssi??null,d=(null==l?void 0:l.avgSnr)??s.snr??null,f=(null==l?void 0:l.count)??0,g=(null==l?void 0:l.confidence)??1,h=e.get(a),m=(null==h?void 0:h.listenerScore)??0,b=(null==h?void 0:h.loudScore)??0,p=(null==h?void 0:h.blendedScore)??0,v=n>0?p/n:0,y=o.rxAdvertCount??0,w=o.txProxyCount??0,x=y+w,k=x>0?(w-y)/x:0,C=Yt(A,i,150,8);r.push({type:"Feature",properties:{key:c,hash:a,name:s.node_name||s.name||a.slice(0,8),prefix:a.slice(2,4).toUpperCase(),color:t.neighborColor,width:2.5,opacity:.85,rssi:u,snr:d,packetCount:f,confidence:g,hasAvgRssi:void 0!==(null==l?void 0:l.avgRssi),hasAvgSnr:void 0!==(null==l?void 0:l.avgSnr),isNeighborEdge:!0,listenerScore:m,loudScore:b,blendedScore:p,trafficWeight:v,linkAsymmetry:k,rxAdvertCount:y,txProxyCount:w},geometry:{type:"LineString",coordinates:C}})}return{type:"FeatureCollection",features:r}}function Zt(A,e){if(A<240)return.5;if(A<480)return 1;const t=(A-480)/(e-480);return Math.max(0,.33*(1-t))}function Kt(A,e,t){const r=t?U(t):null,n=[];for(const o of A){if(r&&o.toUpperCase()===r){t&&n.push(t);continue}const A=e.get(o.toUpperCase());A&&n.push(A)}return n}const Jt="edge-blink-source",Xt="edge-blink-layer",qt=1e3,$t=1e3,Ar=b.teal,er="node-markers-layer";function tr(A){return A<0||A>=qt?0:1-A/qt}function rr(A){if(A<0)return 0;if(A>=$t)return 0;const e=A/$t;return Math.pow(1-e,3)}function nr(A){return[A[1],A[0]]}const or=A.memo(function({nodeHash:A,width:t=60,height:r=20,color:n,showArea:o=!0,showTooltip:i=!1,className:a=""}){const s=W(A),l=V(),c=!Z().backgroundLoadComplete||l,u="number"==typeof t?t:60;return e.jsx(IA,{data:s,width:u,height:r,color:n,isLoading:c,className:a})});function ir(A){const e=new Date(1e3*A);return`${(e.getMonth()+1).toString().padStart(2,"0")}/${e.getDate().toString().padStart(2,"0")}`}function ar({txDelayRec:t,onRemove:r}){const[n,o]=A.useState(!1),i=t.floodFactor??t.txDelayFactor,a=t.directFactor??t.directTxDelayFactor;return e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsxs("button",{onClick:async()=>{const A=`set txdelay ${i.toFixed(1)}\nset direct.txdelay ${a.toFixed(1)}`;try{await navigator.clipboard.writeText(A),o(!0),setTimeout(()=>o(!1),1500)}catch(e){const t=document.createElement("textarea");t.value=A,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{document.execCommand("copy"),o(!0),setTimeout(()=>o(!1),1500)}catch{}document.body.removeChild(t)}},className:"flex items-center gap-2 flex-1 py-1 px-1.5 bg-sys-amber/5 hover:bg-sys-amber/10 rounded transition-colors group",title:"Click to copy CLI commands",children:[e.jsx(JA,{className:"w-3 h-3 text-sys-amber shrink-0"}),e.jsx("span",{className:"text-fg-muted",children:"TxDelay"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-fg-muted",children:"F"}),e.jsxs("span",{className:"data-box data-box-compact text-sys-amber",children:["×",i.toFixed(1)]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-fg-muted",children:"D"}),e.jsxs("span",{className:"data-box data-box-compact text-sys-amber",children:["×",a.toFixed(1)]})]})]}),n?e.jsx(I,{className:"w-3 h-3 text-sys-green ml-auto"}):e.jsx(HA,{className:"w-3 h-3 text-fg-muted opacity-0 group-hover:opacity-100 transition-opacity ml-auto"})]}),r&&e.jsx("button",{onClick:r,className:"p-1 text-fg-secondary hover:text-sys-red hover:bg-sys-red/10 rounded transition-colors",title:"Remove from contacts",children:e.jsx(tA,{className:"w-3.5 h-3.5"})})]})}function sr({hash:t,hashPrefix:r,name:n,isHub:o,isGateway:i,isBackbone:a,isZeroHop:s,isMobile:l,isRoomServer:c,isStale:u,lastSeenTimestamp:d,centrality:f,affinity:g,meanSnr:h,meanRssi:m,neighbor:b,onRemove:p,txDelayRec:v}){const[y,w]=A.useState(!1),x=s?"Direct":(null==g?void 0:g.typicalHopPosition)?`${g.typicalHopPosition}-hop`:null,k=v&&!v.insufficientData;return e.jsxs("div",{className:"w-[240px] pr-2",children:[e.jsx("div",{className:"text-[14px] font-semibold text-fg-primary leading-tight truncate mb-1",children:n}),e.jsxs("div",{className:"flex items-center gap-1 flex-wrap mb-1.5",children:[e.jsx("code",{className:"type-data-xs text-fg-secondary bg-data-box-bg border border-data-box-border px-1 py-0.5 rounded",children:r}),e.jsx("button",{onClick:async()=>{try{await navigator.clipboard.writeText(t),w(!0),setTimeout(()=>w(!1),1500)}catch(A){const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();try{document.execCommand("copy"),w(!0),setTimeout(()=>w(!1),1500)}catch{}document.body.removeChild(e)}},className:"p-0.5 hover:bg-subtle-fill-hover rounded transition-colors",title:"Copy full hash",children:y?e.jsx(I,{className:"w-3 h-3 text-sys-green"}):e.jsx(HA,{className:"w-3 h-3 text-fg-secondary"})}),e.jsx(_A,{hash:t,size:"sm"}),x&&e.jsx(K,{color:s?PA.direct:PA.multihop,compact:!0,children:x}),b.is_repeater&&e.jsx(K,{color:TA.repeater,compact:!0,children:"Rptr"}),o&&e.jsx(K,{color:TA.hub,compact:!0,title:"Hub: ≥10% of last-hop traffic",children:"Hub"}),i&&!o&&e.jsx(K,{color:TA.gateway,compact:!0,title:"Gateway: 7-10% of last-hop traffic",children:"Gate"}),a&&e.jsx(K,{color:TA.backbone,compact:!0,title:"Backbone",children:"Bone"}),l&&e.jsx(K,{color:TA.mobile,compact:!0,children:"Mobile"}),c&&e.jsx(K,{color:TA.room,compact:!0,children:"Room"}),u&&d&&e.jsxs(K,{compact:!0,title:"Neighbor not heard in 7+ days",children:["Idle ",ir(d)]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-fg-secondary mb-1.5",children:[e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(_,{className:"w-3 h-3 text-fg-muted shrink-0"}),e.jsx("span",{className:"font-mono",children:J(b.last_seen)})]}),(null==g?void 0:g.distanceMeters)&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(zA,{className:"w-3 h-3 text-fg-muted shrink-0"}),e.jsx("span",{className:"font-mono font-semibold text-fg-primary",children:(C=g.distanceMeters,null===C?"—":C<1e3?`${Math.round(C)}m`:`${(C/1e3).toFixed(1)}km`)})]}),b.latitude&&b.longitude&&0!==b.latitude&&0!==b.longitude&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(GA,{className:"w-3 h-3 text-fg-muted shrink-0"}),e.jsxs("span",{className:"font-mono text-fg-muted",children:[b.latitude.toFixed(2),", ",b.longitude.toFixed(2)]})]})]}),e.jsx("div",{className:"mb-1.5",style:{width:224},children:e.jsx(or,{nodeHash:t,width:224,height:26,showArea:!0,showTooltip:!0})}),e.jsxs("div",{className:"flex gap-3 text-xs mb-1.5",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-fg-muted",children:"Packets"}),e.jsx("span",{className:"data-box data-box-compact",children:(null==g?void 0:g.frequency)||0})]}),s&&void 0!==h&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-fg-muted",children:"SNR"}),e.jsxs("span",{className:"data-box data-box-compact",children:[h.toFixed(1)," dB"]})]}),k&&v.networkRole&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-fg-muted",children:"Role"}),e.jsx(K,{color:LA[v.networkRole],compact:!0,title:{hub:"Hub: High-connectivity node that bridges many paths",backbone:"Backbone: Critical relay with high traffic",relay:"Relay: Standard forwarding node",edge:"Edge: Peripheral node"}[v.networkRole],children:v.networkRole})]})]}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-fg-muted",children:"Adverts"}),e.jsx("span",{className:"data-box data-box-compact",children:b.advert_count||0})]}),s&&void 0!==m&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-fg-muted",children:"RSSI"}),e.jsxs("span",{className:"data-box data-box-compact",children:[Math.round(m)," dBm"]})]}),k&&v.dataConfidence&&e.jsxs("div",{className:"flex justify-between items-center gap-2",children:[e.jsx("span",{className:"text-fg-muted",children:"Data"}),e.jsx(K,{color:RA[v.dataConfidence],compact:!0,title:{high:"1000+ packets",medium:"500-999 packets",low:"100-499 packets",insufficient:"Insufficient data"}[v.dataConfidence],children:v.dataConfidence})]})]}),!k&&p&&e.jsx("button",{onClick:p,className:"p-1 self-start text-fg-secondary hover:text-sys-red hover:bg-sys-red/10 rounded transition-colors",title:"Remove from contacts",children:e.jsx(tA,{className:"w-3.5 h-3.5"})})]}),k&&e.jsx(ar,{txDelayRec:v,onRemove:p})]});var C}const lr="node-markers-native",cr="node-markers-layer",ur="node-markers-layer-local",dr="marker-standard",fr="marker-standard-neighbor",gr="marker-hub",hr="marker-hub-neighbor",mr="marker-gateway",br="marker-gateway-neighbor",pr="marker-mobile",vr="marker-mobile-neighbor",yr="marker-room-server",wr="marker-room-server-neighbor",xr="marker-local",kr="marker-stale-5day",Cr="marker-stale-10day",Br="marker-blink-black",Mr="marker-blink-black-local",Dr="marker-blink",Er="marker-blink-local",jr={tier1:m[500],tier2:m[700]};function Qr(A){if(!A)return 0;const e=(Date.now()-1e3*A)/864e5;return e>=10?2:e>=5?1:0}function Nr(A){var e;const t=null==(e=A.contact_type)?void 0:e.toLowerCase();return"room server"===t||"room_server"===t||"room"===t||"server"===t}function Sr(A){return A.startsWith("0x")?A.slice(2,4).toUpperCase():A.slice(0,2).toUpperCase()}function Fr({neighborsWithLocation:t,localNode:r,localHash:n,zeroHopNeighbors:l,lastHopNeighborMap:c,meshTopology:u,hoveredMarker:d,onMarkerHover:f,getNodeOpacity:g,shouldShowNode:h,onRequestRemove:m,openPopupId:b,onOpenPopup:v,onClosePopup:y,onNodeClick:w,blinkingNodes:x}){const{current:k}=o(),C=A.useRef(!1),[B,M]=A.useState(!1);A.useEffect(()=>{var A;const e=null==(A=null==k?void 0:k.getMap)?void 0:A.call(k);if(!e)return;const t=()=>{try{!function(A){const e=p(),t=(A,e,t=0,r=!1)=>{const n=document.createElement("canvas");n.width=32,n.height=32;const o=n.getContext("2d",r?{colorSpace:"display-p3"}:void 0),i=14-t/2;return o.beginPath(),o.arc(16,16,i,0,2*Math.PI),o.fillStyle=A,o.fill(),e&&t>0&&(o.strokeStyle=e,o.lineWidth=2*t,o.stroke()),o.shadowColor="rgba(0,0,0,0.3)",o.shadowBlur=4,o.shadowOffsetY=2,{data:o.getImageData(0,0,32,32),pixelRatio:2}},r=(A,e=!1)=>{const t=document.createElement("canvas");t.width=48,t.height=48;const r=t.getContext("2d",e?{colorSpace:"display-p3"}:void 0),n=24*.35*2;return r.strokeStyle=A,r.lineWidth=5,r.lineCap="round",r.lineJoin="round",r.beginPath(),r.moveTo(24-n,24),r.lineTo(24,24-n),r.lineTo(40.8,24),r.stroke(),r.beginPath(),r.moveTo(24-.7*n,24),r.lineTo(24-.7*n,35.76),r.lineTo(35.76,35.76),r.lineTo(35.76,24),r.stroke(),r.beginPath(),r.moveTo(20.64,35.76),r.lineTo(20.64,27.36),r.lineTo(27.36,27.36),r.lineTo(27.36,35.76),r.stroke(),{data:r.getImageData(0,0,48,48),pixelRatio:2}},n=(A,e)=>{const t=document.createElement("canvas");t.width=48,t.height=48;const r=t.getContext("2d"),n=24*.35*2;return r.strokeStyle=A,r.lineWidth=5,r.lineCap="round",r.lineJoin="round",e&&(r.fillStyle=e),r.beginPath(),r.roundRect(24-n,24-.6*n,1.6*n,1.2*n,6),e&&r.fill(),r.stroke(),r.beginPath(),r.moveTo(18.96,34.08),r.lineTo(24-.6*n,40.8),r.lineTo(24,34.08),r.stroke(),{data:r.getImageData(0,0,48,48),pixelRatio:2}},o="#00FF00",i={[dr]:t(e.nodeFill),[fr]:t(e.neighborColor),[gr]:t(e.hubColor),[hr]:t(e.neighborColor),[mr]:t(e.gatewayColor),[br]:t(e.neighborColor),[pr]:t("transparent",e.mobileColor,2.5),[vr]:t(e.neighborColor),[yr]:n(e.roomColor),[wr]:n(e.neighborColor,"#1a1a1c"),[xr]:r(e.localColor),[kr]:t(jr.tier1),[Cr]:t(jr.tier2),[Br]:t("#000000"),[Mr]:r("#000000"),[Dr]:t(o,void 0,0,!0),[Er]:r(o,!0)};for(const[a,s]of Object.entries(i))try{A.hasImage(a)&&A.removeImage(a),A.addImage(a,s.data,{pixelRatio:s.pixelRatio})}catch{}}(e),C.current=!0,B||M(!0)}catch(A){}};e.isStyleLoaded()?t():e.once("style.load",t);const r=()=>{e.hasImage(dr)||t()};e.on("styledata",r);const n=()=>{C.current=!1,t()},o=new MutationObserver(A=>{for(const e of A)if("data-theme"===e.attributeName){setTimeout(n,100);break}});o.observe(document.documentElement,{attributes:!0});const i=document.querySelector("[data-basemap]");let a=null;return i&&(a=new MutationObserver(A=>{for(const e of A)if("data-basemap"===e.attributeName){setTimeout(n,100);break}}),a.observe(i,{attributes:!0})),()=>{e.off("styledata",r),o.disconnect(),null==a||a.disconnect()}},[k,B]);const D=A.useMemo(()=>{var A;const e=[],r=[...t].sort(([A,e],[t,r])=>{const n=(A,e)=>{var t;return Nr(e)?5e3:l.has(A)?3e3:u.hubNodes.includes(A)?2e3:(null==(t=u.gatewayNodes)?void 0:t.includes(A))?1e3:0};return n(A,e)-n(t,r)});for(const[t,o]of r){if(!o.latitude||!o.longitude)continue;if(n&&((n.startsWith("0x")?n.slice(2,4).toLowerCase():n.slice(0,2).toLowerCase())===(t.startsWith("0x")?t.slice(2,4).toLowerCase():t.slice(0,2).toLowerCase())||t===n))continue;const r=h(t),i=g(t,r);if(i<=.01)continue;const a=l.has(t),s=u.hubNodes.includes(t),d=(null==(A=u.gatewayNodes)?void 0:A.includes(t))??!1,f=u.mobileNodes.includes(t),m=Nr(o),b=u.centrality.get(t)||0,p=c.get(t),v=o.last_seen||(null==p?void 0:p.lastSeen),y=Qr(v),w=y>0;let x=i;2===y?x=Math.min(i,.25):1===y&&(x=Math.min(i,.5));let k="standard";m?k="roomServer":s?k="hub":d?k="gateway":f&&(k="mobile");const C=u.fullAffinity.get(t),B=u.txDelayRecommendations.get(t);e.push({type:"Feature",geometry:{type:"Point",coordinates:[o.longitude,o.latitude]},properties:{hash:t,name:o.node_name||o.name||"Unknown",hashPrefix:Sr(t),iconType:k,isNeighbor:a,isHub:s,isGateway:d,isMobile:f,isRoomServer:m,isStale:w,staleTier:y,isZeroHop:a,opacity:x,blinkIntensity:0,lastSeenTimestamp:v,centrality:b,neighborJson:JSON.stringify(o),affinityJson:C?JSON.stringify(C):void 0,txDelayRecJson:B?JSON.stringify(B):void 0,meanSnr:(null==p?void 0:p.avgSnr)??void 0,meanRssi:(null==p?void 0:p.avgRssi)??void 0}})}return{type:"FeatureCollection",features:e}},[t,n,l,c,u,g,h]),E=A.useMemo(()=>(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)?{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:[r.longitude,r.latitude]},properties:{hash:"local",name:r.name,hashPrefix:n?Sr(n):"",iconType:"local",isNeighbor:!1,isHub:!1,isGateway:!1,isMobile:!1,isRoomServer:!1,isStale:!1,staleTier:0,isZeroHop:!1,opacity:1,blinkIntensity:0,centrality:0}}]}:{type:"FeatureCollection",features:[]},[r,n]),j=A.useCallback(A=>{var e;if(!A.features||0===A.features.length)return;const t=null==(e=A.features[0].properties)?void 0:e.hash;t&&(v&&v(t),w&&"local"!==t&&w(t))},[v,w]),Q=A.useCallback(A=>{var e,t;if(!A.features||0===A.features.length)return;const r=null==(e=null==k?void 0:k.getMap)?void 0:e.call(k);r&&(r.getCanvas().style.cursor="pointer");const n=null==(t=A.features[0].properties)?void 0:t.hash;n&&f(n)},[k,f]),N=A.useCallback(()=>{var A;const e=null==(A=null==k?void 0:k.getMap)?void 0:A.call(k);e&&(e.getCanvas().style.cursor=""),f(null)},[k,f]);A.useEffect(()=>{var A;const e=null==(A=null==k?void 0:k.getMap)?void 0:A.call(k);if(!e||!B)return;const t=[cr,ur];for(const r of t)e.on("click",r,j),e.on("mouseenter",r,Q),e.on("mouseleave",r,N);return()=>{for(const A of t)e.off("click",A,j),e.off("mouseenter",A,Q),e.off("mouseleave",A,N)}},[k,B,j,Q,N]);const S=A.useRef(D),F=A.useRef(E);A.useEffect(()=>{S.current=D,F.current=E},[D,E]),A.useEffect(()=>{var A;const e=null==(A=null==k?void 0:k.getMap)?void 0:A.call(k);if(!e||!B||!x||0===x.size)return;const t=e.getSource(lr),r=e.getSource(`${lr}-local`);if(t||r){if(t){const A=S.current;let e=!1;const r=A.features.map(A=>{const t=x.get(A.properties.hash)??0;return t!==A.properties.blinkIntensity?(e=!0,{...A,properties:{...A.properties,blinkIntensity:t}}):A});e&&t.setData({type:"FeatureCollection",features:r})}if(r&&n){const A=x.get(n)??0,e=F.current;e.features.length>0&&e.features[0].properties.blinkIntensity!==A&&r.setData({type:"FeatureCollection",features:[{...e.features[0],properties:{...e.features[0].properties,blinkIntensity:A}}]})}}},[k,B,x,n]);const P=A.useMemo(()=>{if(!b)return null;if("local"===b&&r)return{longitude:r.longitude,latitude:r.latitude,isLocal:!0,name:r.name,hash:n};const A=D.features.find(A=>A.properties.hash===b);if(!A)return null;const e=A.properties,t=e.txDelayRecJson?JSON.parse(e.txDelayRecJson):void 0;return{longitude:A.geometry.coordinates[0],latitude:A.geometry.coordinates[1],isLocal:!1,hash:e.hash,hashPrefix:e.hashPrefix,name:e.name,isHub:e.isHub,isGateway:e.isGateway,isBackbone:"backbone"===(null==t?void 0:t.networkRole),isZeroHop:e.isZeroHop,isMobile:e.isMobile,isRoomServer:e.isRoomServer,isStale:e.isStale,lastSeenTimestamp:e.lastSeenTimestamp,centrality:e.centrality,neighbor:e.neighborJson?JSON.parse(e.neighborJson):void 0,affinity:e.affinityJson?JSON.parse(e.affinityJson):void 0,txDelayRec:t,meanSnr:e.meanSnr,meanRssi:e.meanRssi}},[b,r,n,D]);if(!B)return null;const T=p(),L=["case",[">",["get","blinkIntensity"],.66],Dr,[">",["get","blinkIntensity"],.33],Br,["==",["get","staleTier"],2],Cr,["==",["get","staleTier"],1],kr,["==",["get","iconType"],"roomServer"],["case",["get","isNeighbor"],wr,yr],["==",["get","iconType"],"hub"],["case",["get","isNeighbor"],hr,gr],["==",["get","iconType"],"gateway"],["case",["get","isNeighbor"],br,mr],["==",["get","iconType"],"mobile"],["case",["get","isNeighbor"],vr,pr],["case",["get","isNeighbor"],fr,dr]],R=["interpolate",["linear"],["zoom"],6,.25,10,1];return e.jsxs(e.Fragment,{children:[e.jsx(i,{id:lr,type:"geojson",data:D,children:e.jsx(a,{id:cr,type:"symbol",layout:{"icon-image":L,"icon-size":R,"icon-allow-overlap":!0,"icon-ignore-placement":!0,"symbol-sort-key":["get","opacity"]},paint:{"icon-opacity":["get","opacity"]}})}),e.jsx(i,{id:`${lr}-local`,type:"geojson",data:E,children:e.jsx(a,{id:ur,type:"symbol",layout:{"icon-image":["case",[">",["get","blinkIntensity"],.66],Er,[">",["get","blinkIntensity"],.33],Mr,xr],"icon-size":R,"icon-allow-overlap":!0,"icon-ignore-placement":!0},paint:{"icon-opacity":1}})}),P&&y&&e.jsx(s,{longitude:P.longitude,latitude:P.latitude,offset:{center:[0,0],top:[0,12],"top-left":[6,12],"top-right":[-6,12],bottom:[0,-12],"bottom-left":[6,-12],"bottom-right":[-6,-12],left:[12,0],right:[-12,0]},maxWidth:"280px",closeOnClick:!0,onClose:y,className:"maplibre-popup",children:P.isLocal?e.jsxs("div",{className:"text-sm",children:[e.jsx("strong",{className:"text-base",children:P.name}),P.hash&&e.jsx("span",{className:"ml-2 font-mono text-xs text-fg-muted surface-badge px-1.5 py-0.5 rounded",children:Sr(P.hash)}),e.jsx("br",{}),e.jsx("span",{style:{color:T.localColor},className:"font-medium",children:"This Node (Local)"}),e.jsx("br",{}),r&&e.jsxs("span",{className:"text-xs text-fg-muted",children:[r.latitude.toFixed(5),", ",r.longitude.toFixed(5)]})]}):P.neighbor&&P.hash?e.jsx(sr,{hash:P.hash,hashPrefix:P.hashPrefix,name:P.name,isHub:P.isHub,isGateway:P.isGateway,isBackbone:P.isBackbone,isZeroHop:P.isZeroHop,isMobile:P.isMobile,isRoomServer:P.isRoomServer,isStale:P.isStale,lastSeenTimestamp:P.lastSeenTimestamp,centrality:P.centrality,affinity:P.affinity,meanSnr:P.meanSnr,meanRssi:P.meanRssi,neighbor:P.neighbor,txDelayRec:P.txDelayRec,onRemove:m?()=>m(P.hash,P.name):void 0}):null})]})}const Pr=[cr,ur],Tr="topology-validated-edges-native",Lr="topology-weak-edges-native",Rr="neighbor-edges-native",Ir="topology-weak-edges-native",_r="topology-validated-edges-native",zr="neighbor-edges-native",Hr={type:"FeatureCollection",features:[]},Gr={"line-cap":"round","line-join":"round"},Or={"line-color":"transparent","line-width":16,"line-opacity":0};function Ur({showTopology:t,isExiting:r,hoveredEdgeKey:n,highlightedLoopEdges:s,highlightedFocusEdges:l,onEdgeHover:c,onLoopHover:u,loops:d=[],neighborNames:g={},opacityBias:h=.5,widthMultiplier:m=1,trafficFilter:b=0,showNeighborLines:p=!0,disableHover:v=!1}){const{current:y}=o(),w=t||r,x=!0,k=p?"visible":"none",C=v||r,B=A.useRef(null),M=A.useRef(C),D=A.useRef(new Map),E=A.useRef(g),j=A.useRef(u);A.useLayoutEffect(()=>{M.current=C,E.current=g,j.current=u});const Q=A.useMemo(()=>function(A){const e=new Map;for(const t of A)for(const A of t.edgeKeys){const r=e.get(A)??[];r.push(t),e.set(A,r)}return e}(d),[d]);A.useLayoutEffect(()=>{D.current=Q},[Q]);const N=A.useCallback(A=>{var e,t;if(M.current)return;if(!A.features||0===A.features.length)return;const r=A.features[0].properties;if(!(null==r?void 0:r.key))return;const n=r.key;if(n!==B.current){B.current=n;const o=!0===r.isNeighborEdge||"true"===r.isNeighborEdge,i=!0===r.isLoopEdge||"true"===r.isLoopEdge;if(o){const t={key:n,fromName:"Local",toName:r.name,certainCount:Number(r.packetCount)||0,confidence:1,isBackbone:!1,isLoopEdge:!1,isDirectPath:!0,isZeroHop:!0,symmetryRatio:1,dominantDirection:"balanced",isHubConnection:!1};c(n,[A.lngLat.lng,A.lngLat.lat],t),null==(e=j.current)||e.call(j,null)}else if(i&&j.current){const e=D.current.get(n)??[];if(e.length>0){const t=new Set;for(const A of e)for(const e of A.edgeKeys)t.add(e);const r={loops:e,highlightedEdgeKeys:t,hoveredEdgeKey:n,nodeNames:e[0].nodes.map(A=>E.current[A]||A.substring(0,4))};j.current(r,[A.lngLat.lng,A.lngLat.lat]),c(n)}else{const e={key:n,fromName:r.fromName,toName:r.toName,certainCount:Number(r.certainCount),confidence:Number(r.confidence),isBackbone:!0===r.isBackbone||"true"===r.isBackbone,isLoopEdge:!0,isDirectPath:!0===r.isDirectPath||"true"===r.isDirectPath,isZeroHop:!0===r.isZeroHop||"true"===r.isZeroHop,symmetryRatio:Number(r.symmetryRatio),dominantDirection:r.dominantDirection,isHubConnection:!0===r.isHubConnection||"true"===r.isHubConnection};c(n,[A.lngLat.lng,A.lngLat.lat],e)}}else{const e={key:n,fromName:r.fromName,toName:r.toName,certainCount:Number(r.certainCount),confidence:Number(r.confidence),isBackbone:!0===r.isBackbone||"true"===r.isBackbone,isLoopEdge:i,isDirectPath:!0===r.isDirectPath||"true"===r.isDirectPath,isZeroHop:!0===r.isZeroHop||"true"===r.isZeroHop,symmetryRatio:Number(r.symmetryRatio),dominantDirection:r.dominantDirection,isHubConnection:!0===r.isHubConnection||"true"===r.isHubConnection};c(n,[A.lngLat.lng,A.lngLat.lat],e),null==(t=j.current)||t.call(j,null)}}},[c]),S=A.useCallback(()=>{var A;null!==B.current&&(B.current=null,c(null),null==(A=j.current)||A.call(j,null))},[c]);A.useEffect(()=>{var A;const e=null==(A=null==y?void 0:y.getMap)?void 0:A.call(y);if(!e||!w)return;const t="topology-validated-edges-hitarea-native",r=()=>{try{return e.getStyle()&&e.getLayer(t)}catch{return!1}},n=()=>!!r()&&(e.on("mousemove",t,N),e.on("mouseleave",t,S),!0);if(!n()){const A=()=>{n()&&e.off("styledata",A)};return e.on("styledata",A),()=>{try{e.off("styledata",A),r()&&(e.off("mousemove",t,N),e.off("mouseleave",t,S))}catch{}}}return()=>{try{r()&&(e.off("mousemove",t,N),e.off("mouseleave",t,S))}catch{}}},[y,w,N,S]),A.useEffect(()=>{var A;const e=null==(A=null==y?void 0:y.getMap)?void 0:A.call(y);if(!e||!p)return;const t="neighbor-edges-hitarea-native",r=()=>{try{return e.getStyle()&&e.getLayer(t)}catch{return!1}},n=()=>!!r()&&(e.on("mousemove",t,N),e.on("mouseleave",t,S),!0);if(!n()){const A=()=>{n()&&e.off("styledata",A)};return e.on("styledata",A),()=>{try{e.off("styledata",A),r()&&(e.off("mousemove",t,N),e.off("mouseleave",t,S))}catch{}}}return()=>{try{r()&&(e.off("mousemove",t,N),e.off("mouseleave",t,S))}catch{}}},[y,x,p,N,S]),A.useEffect(()=>{var A;const e=null==(A=null==y?void 0:y.getMap)?void 0:A.call(y);if(!e)return;let t=null;const r=(A,t)=>{try{if(e.getLayer(A)&&e.getLayer(t))return e.moveLayer(A,t),!0}catch{}return!1},n=()=>{try{if(!e.getLayer("node-markers-layer"))return;r(zr,"node-markers-layer"),r("neighbor-edges-hitarea-native",zr),(r(_r,"neighbor-edges-hitarea-native")||r(_r,"node-markers-layer"))&&r("topology-validated-edges-hitarea-native",_r),r(Ir,"topology-validated-edges-hitarea-native")}catch{}},o=()=>{t&&clearTimeout(t),t=setTimeout(n,50)},i=setTimeout(n,100);e.on("styledata",o);const a=A=>{(A.sourceId===Tr||A.sourceId===Lr||A.sourceId===Rr)&&o()};return e.on("sourcedata",a),()=>{clearTimeout(i),t&&clearTimeout(t);try{e.off("styledata",o),e.off("sourcedata",a)}catch{}}},[y,w,x,p]);const F=C?null:n,P=function(A,e,t,r,n,o){const i=Ae(),a=null!==A,s=n&&n.size>0,l=o&&o.size>0,c=s?Array.from(n):[],u=l?Array.from(o):[],d=e<=0?["get","baseColor"]:["case",[">=",["get","brightnessScore"],1-.5*e],"#FFFFFF",["get","baseColor"]],f=e<=0?1:["max",.1,["+",1,["*",e,3,["-",["get","brightnessScore"],.5]]]],g=s?["in",["get","key"],["literal",c]]:l?["in",["get","key"],["literal",u]]:!!a&&["==",["get","key"],A],h=a||s||l,m=i.edges.hoverLoop,b=i.edges.highlight;return{"line-color":h?["case",g,s?m:l?b:["get","hoverColor"],d]:d,"line-width":h?["case",g,["max",["*",["get","baseWidth"],t,1.3],3.5],["*",["get","baseWidth"],t]]:["*",["get","baseWidth"],t],"line-opacity":["case",["<",["get","brightnessScore"],r],0,h?["case",g,["min",["*",["get","baseOpacity"],1.25],1],["*",["get","baseOpacity"],f,.35]]:["*",["get","baseOpacity"],f]]}}(F,h,m,b,C?null:s,l??null),T=function(A){const e=null!==A,{YELLOW:t,GREEN:r,RED:n,GRAY:o}=f,i=["to-number",["get","listenerScore"],0],a=["to-number",["get","loudScore"],0],s=["/",i,["max",["+",i,a],1]],l=["*",["+",.2,["*",["to-number",["get","trafficWeight"],0],.8]],8];return{"line-color":["case",["all",["==",i,0],["==",a,0]],o,[">=",s,.97],r,["<=",s,.03],n,["interpolate",["linear"],s,.03,n,.5,t,.97,r]],"line-width":["interpolate",["linear"],["zoom"],6,e?["case",["==",["get","key"],A],["max",["*",l,.25],1.25],["*",l,.25]]:["*",l,.25],10,e?["case",["==",["get","key"],A],["max",l,5],l]:l],"line-opacity":e?["case",["==",["get","key"],A],1,.35]:.9}}(F);return e.jsxs(e.Fragment,{children:[w&&e.jsx(i,{id:Lr,type:"geojson",data:Hr,children:e.jsx(a,{id:Ir,type:"line",paint:P,layout:{...Gr,visibility:k}})}),w&&e.jsxs(i,{id:Tr,type:"geojson",data:Hr,children:[e.jsx(a,{id:"topology-validated-edges-hitarea-native",type:"line",paint:Or,layout:{...Gr,visibility:k}}),e.jsx(a,{id:_r,type:"line",paint:P,layout:{...Gr,visibility:k}})]}),e.jsxs(i,{id:Rr,type:"geojson",data:Hr,children:[e.jsx(a,{id:"neighbor-edges-hitarea-native",type:"line",paint:Or,layout:{...Gr,visibility:k}}),e.jsx(a,{id:zr,type:"line",paint:T,layout:{...Gr,visibility:k}})]})]})}const Yr=["topology-validated-edges-hitarea-native","topology-validated-edges-native","topology-weak-edges-native","neighbor-edges-hitarea-native","neighbor-edges-native"];function Wr({targetHash:e,nodeCoordinates:t,onComplete:r}){const{current:n}=o(),i=A.useRef(null);return A.useEffect(()=>{if(!n||!e||e===i.current)return;const A=t.get(e);if(!A)return;const o=n.getMap();o.isMoving()&&o.stop(),i.current=e;const[a,s]=A;n.flyTo({center:[s,a],zoom:10,duration:2500,essential:!0}),setTimeout(()=>{null==r||r()},2600)},[e,t,n,r]),null}function Vr({highlightedEdgeKey:e,validatedPolylines:t,weakPolylines:r,onEnsureTopology:n}){const{current:i}=o(),a=A.useRef(null);return A.useEffect(()=>{if(!i||!e)return;if(e===a.current)return;a.current=e,n();const A=t.find(A=>A.edge.key===e)||r.find(A=>A.edge.key===e);if(!A)return;if(i.getMap().isMoving())return;const o=(A.from[0]+A.to[0])/2,s=(A.from[1]+A.to[1])/2,l=i.getZoom(),c=Math.max(l,11);i.easeTo({center:[s,o],zoom:c,duration:500})},[e,t,r,i,n]),null}function Zr(A,e,t,r=64){const n=[],o=t/6371e3*(180/Math.PI),i=o/Math.cos(e*Math.PI/180);for(let a=0;a<=r;a++){const t=a/r*2*Math.PI,s=A+i*Math.cos(t),l=e+o*Math.sin(t);n.push([s,l])}return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[n]}}}function Kr({ghost:t,neighborCoordinates:r,onHighlightedNeighborsChange:n}){const{current:s}=o(),l=A.useRef(null),c=A.useRef(null),u=A.useMemo(()=>t?new Set(t.commonNeighbors):new Set,[t]);A.useEffect(()=>{null==n||n(u)},[u,n]);const d=A.useMemo(()=>{if(!(null==t?void 0:t.commonNeighbors)||t.commonNeighbors.length<2)return 8e3;let A=0;const e=[];for(const n of t.commonNeighbors){const A=r.get(n);A&&e.push(A)}t.estimatedLocation&&e.push([t.estimatedLocation.lat,t.estimatedLocation.lon]);for(let t=0;tA&&(A=n)}return Math.max(A,2e3)},[t,r]),f=A.useMemo(()=>{if(!(null==t?void 0:t.estimatedLocation))return{type:"FeatureCollection",features:[]};const{lat:A,lon:e,uncertaintyM:r}=t.estimatedLocation,n=.5*d,o=r>0?r:2e3;return{type:"FeatureCollection",features:[Zr(e,A,Math.max(500,Math.min(o,n)))]}},[t,d]);if(A.useEffect(()=>{if(!s)return;const A=s.getMap();if(t&&t.prefix!==c.current){if(c.current=t.prefix,!l.current&&A.getZoom()>3){const e=A.getCenter();l.current={center:[e.lng,e.lat],zoom:A.getZoom(),pitch:A.getPitch(),bearing:A.getBearing()}}const e=[];for(const A of t.commonNeighbors){const t=r.get(A);t&&e.push([t[1],t[0]])}if(t.estimatedLocation&&e.push([t.estimatedLocation.lon,t.estimatedLocation.lat]),e.length>0){const r=()=>{var n;if(A.isMoving())setTimeout(r,100);else if(1===e.length)s.flyTo({center:e[0],zoom:13,duration:1500});else{let A=1/0,r=-1/0,o=1/0,i=-1/0;for(const[t,n]of e)A=Math.min(A,t),r=Math.max(r,t),o=Math.min(o,n),i=Math.max(i,n);if(null==(n=t.estimatedLocation)?void 0:n.uncertaintyM){const e=t.estimatedLocation.uncertaintyM/111e3;A-=e,r+=e,o-=e,i+=e}s.fitBounds([[A,o],[r,i]],{padding:{top:60,bottom:60,left:60,right:60},maxZoom:14,duration:1500})}};setTimeout(r,50)}}if(!t&&null!==c.current&&(c.current=null,l.current)){const e=l.current,t=()=>{A.isMoving()?setTimeout(t,100):(s.flyTo({center:e.center,zoom:e.zoom,pitch:e.pitch,bearing:e.bearing,duration:1e3}),l.current=null)};setTimeout(t,50)}},[t,s,r]),!(null==t?void 0:t.estimatedLocation))return null;return e.jsx(i,{id:"ghost-uncertainty-circle",type:"geojson",data:f,children:e.jsx(a,{id:"ghost-uncertainty-fill",type:"fill",paint:{"fill-color":"rgba(167, 139, 250, 0.15)","fill-opacity":.8}})})}const Jr={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"},Xr={longitude:0,latitude:0,zoom:2};function qr({data:A}){const t=A.subtitle&&"loop"===A.type,r=A.subtitle&&"loop"!==A.type;return e.jsxs("div",{className:"w-[540px]",children:[e.jsxs("div",{className:"flex items-center justify-between h-5",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[A.title.icon&&e.jsx("span",{className:`${A.title.color} text-base leading-none flex-shrink-0`,children:A.title.icon}),e.jsx("span",{className:`${A.title.color} font-semibold text-[13px] truncate`,children:A.title.text}),r&&e.jsx("span",{className:`${A.subtitle.color} text-[11px] flex-shrink-0`,children:A.subtitle.text})]}),A.badges.length>0&&e.jsx("div",{className:"flex items-center gap-2 flex-shrink-0 ml-3",children:A.badges.map((A,t)=>e.jsx("span",{className:`${A.color} text-[11px] font-medium`,children:A.text},t))})]}),t&&e.jsx("div",{className:"h-4 mt-0.5 overflow-hidden",children:e.jsx("span",{className:"type-data-xs text-fg-muted truncate block",children:A.subtitle.text})}),e.jsx("div",{className:`flex items-center gap-4 h-4 ${t?"mt-1":"mt-1.5"} text-[11px]`,children:A.stats.map((A,t)=>e.jsxs("span",{className:"whitespace-nowrap",children:[e.jsx("span",{className:`font-mono tabular-nums font-semibold ${A.color??"text-fg-primary"}`,children:A.value}),e.jsx("span",{className:"text-fg-muted ml-1",children:A.label}),A.unit&&e.jsx("span",{className:"text-fg-muted/50 ml-0.5",children:A.unit})]},t))})]})}function $r({neighbors:t,localNode:r,localHash:o,onRemoveNode:i,selectedNodeHash:a,onNodeSelected:s,highlightedEdgeKey:f,highlightedGhost:h}){const m=A.useRef(null),b=X(),p=q(),v=Z(),y=$(),[w,x]=A.useState(!1),k=Gt(A=>A.viewState),C=Gt(A=>A.toggles),B=Gt(A=>A.hasAnalyzed),M=Gt(A=>A.setViewState),D=Gt(A=>A.setToggle),E=Gt(A=>A.setHasAnalyzed),j=AA(A=>A.preloadFromNodes),Q=AA(A=>A.isLoading),N=AA(A=>A.terrainGrid),S=o??y,F=A.useMemo(()=>{const A=[];for(const[,e]of Object.entries(t))e.latitude&&e.longitude&&A.push([e.latitude,e.longitude]);return A},[t]),P=A.useMemo(()=>function(A,e){let t=[...A];if((null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude)&&t.push([e.latitude,e.longitude]),0===t.length)return null;if(1===t.length){const[A,e]=t[0];return{longitude:e,latitude:A,zoom:14}}t=function(A,e){if(A.length<=2)return A;let t,r;if((null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude))t=e.latitude,r=e.longitude;else{let e=0,n=0;for(const[t,r]of A)e+=t,n+=r;t=e/A.length,r=n/A.length}const n=A.map(([A,e])=>{return{pos:[A,e],dist:(n=t,o=r,i=A,a=e,NA(n,o,i,a)/1e3)};var n,o,i,a});n.sort((A,e)=>A.dist-e.dist);const o=n[Math.floor(n.length/2)].dist,i=Math.max(3*o,50),a=n.filter(A=>A.dist<=i).map(A=>A.pos);return a.length<.5*A.length?A:a}(t,e);let r=1/0,n=-1/0,o=1/0,i=-1/0;for(const[f,g]of t)r=Math.min(r,g),n=Math.max(n,g),o=Math.min(o,f),i=Math.max(i,f);const a=(r+n)/2,s=(o+i)/2,l=i-o,c=n-r,u=Math.max(l,c);let d=16;return u>0&&(d=Math.floor(Math.log2(360/u*1.2)),d=Math.max(1,Math.min(14,d))),d=Math.min(d+1,12),{longitude:a,latitude:s,zoom:d}}(F,r),[F,r]),[T,L]=A.useState(()=>k??P??Xr),R=A.useCallback(A=>{L(A),queueMicrotask(()=>M(A))},[M]),I=A.useRef(!!k);A.useEffect(()=>{I.current||!P||k?k&&setTimeout(()=>x(!0),50):(L(P),queueMicrotask(()=>M(P)),I.current=!0,setTimeout(()=>x(!0),50))},[P,k,M]);const[_,z]=A.useState(!1),[W,V]=A.useState(()=>!(C.showTopology&&!v.topologyLoadComplete)&&C.showTopology),[K,J]=A.useState(C.showNeighborLines),[eA,tA]=A.useState(!1),[nA,oA]=A.useState(C.showMinCut),[iA,aA]=A.useState(Ve),[sA,lA]=A.useState(C.show3DTerrain),[cA,fA]=A.useState(C.nodeFilter),gA=A.useCallback(A=>{V(e=>{const t="function"==typeof A?A(e):A;return queueMicrotask(()=>D("showTopology",t)),t})},[D]),hA=A.useCallback(A=>{J(e=>{const t="function"==typeof A?A(e):A;return queueMicrotask(()=>D("showNeighborLines",t)),t})},[D]),mA=A.useCallback(A=>{oA(e=>{const t="function"==typeof A?A(e):A;return queueMicrotask(()=>D("showMinCut",t)),t})},[D]),bA=A.useCallback(A=>{lA(e=>{const t="function"==typeof A?A(e):A;return queueMicrotask(()=>D("show3DTerrain",t)),t})},[D]),pA=A.useCallback(A=>{fA(A),queueMicrotask(()=>D("nodeFilter",A))},[D]),[vA,yA]=A.useState(null),[CA,BA]=A.useState(null),[MA,DA]=A.useState(null),[EA]=A.useState(0),[jA]=A.useState(.5),[QA]=A.useState(0),[SA,FA]=A.useState(null),[PA,TA]=A.useState(""),[LA,RA]=A.useState(!1),[IA,_A]=A.useState(!1),[zA,HA]=A.useState(()=>!(B&&!v.topologyLoadComplete)&&B);A.useEffect(()=>{if(v.topologyLoadComplete)return;const A=B&&!zA,e=C.showTopology&&!W;(A||e)&&queueMicrotask(()=>{A&&E(!1),e&&D("showTopology",!1)})},[B,C.showTopology,v.topologyLoadComplete,zA,W,E,D]);const GA=A.useCallback(A=>{HA(A),queueMicrotask(()=>E(A))},[E]),[OA,UA]=A.useState(null),YA=A.useCallback(A=>UA(A),[]),WA=A.useCallback(()=>UA(null),[]),[,VA]=A.useState(new Set),ZA=Pe(A=>A.coveragePoints),KA=Pe(A=>A.isVisible),JA=Pe(A=>A.brightness),qA=Pe(A=>A.openModal),$A=$e(A=>A.isEnabled),Ae=$e(A=>A.toggle),te=n(),re=l(),ne=A.useRef(!1);A.useEffect(()=>{ZA.length>0&&KA&&!ne.current&&(hA(!1),ne.current=!0)},[ZA.length,KA]);const oe=A.useRef(null);A.useEffect(()=>{if(a&&a!==oe.current){oe.current=a;const A=setTimeout(()=>{UA(a)},1250);return()=>clearTimeout(A)}},[a]);const[ie,ae]=A.useState(null),[se,le]=A.useState(null),ce=A.useCallback((A,e,t)=>{BA(A),A&&e&&t?ae({longitude:e[0],latitude:e[1],type:"topology",properties:{key:t.key,fromName:t.fromName,toName:t.toName,certainCount:t.certainCount,confidence:t.confidence,isBackbone:t.isBackbone,isLoopEdge:t.isLoopEdge,isDirectPath:t.isDirectPath,isHubConnection:t.isHubConnection,symmetryRatio:t.symmetryRatio,dominantDirection:t.dominantDirection}}):A||ae(null)},[]),ue=A.useCallback((A,e)=>{le(A),A&&ae(null)},[]),fe=A.useMemo(()=>{var A;if(!W)return null;if(!vA)return null;if(CA)return null;const e=b.loops;if(0===e.length)return null;const r=function(A,e,t){const r=function(A,e){return e.filter(e=>e.nodes.includes(A)).sort((A,e)=>e.avgCertainCount-A.avgCertainCount)}(A,e),n=new Set,o=[];for(const i of r)for(const A of i.edgeKeys)if(!n.has(A)){n.add(A);const e=t.get(A);o.push({key:A,certainCount:(null==e?void 0:e.certainCount)??0})}return o.sort((A,e)=>e.certainCount-A.certainCount),{loops:r,highlightedEdgeKeys:n,sortedEdges:o}}(vA,e,b.edgeMap);if(0===r.loops.length)return null;const n=r.loops[0].nodes.map(A=>{var e,r;return A===S?"You":(null==(e=t[A])?void 0:e.node_name)||(null==(r=t[A])?void 0:r.name)||A.substring(0,4)});return{loops:r.loops,highlightedEdgeKeys:r.highlightedEdgeKeys,hoveredEdgeKey:(null==(A=r.sortedEdges[0])?void 0:A.key)||"",nodeNames:n}},[W,vA,CA,b.loops,b.edgeMap,t,S]);A.useEffect(()=>{CA||le(fe)},[fe,CA]);const he=A.useMemo(()=>{const A={};for(const[e,r]of Object.entries(t))A[e]=r.node_name||r.name||e.substring(0,4);return S&&(A[S]="You"),A},[t,S]),me=A.useMemo(()=>Object.entries(t).filter(([,A])=>A.latitude&&A.longitude),[t]),be=A.useMemo(()=>{const A=new Map;S&&(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)&&A.set(S,[r.latitude,r.longitude]);for(const[e,t]of me)t.latitude&&t.longitude&&A.set(e,[t.latitude,t.longitude]);return A},[S,r,me]),ve=A.useMemo(()=>{const A=new Map;for(const e of p)"expired"!==e.status&&A.set(e.hash,{hash:e.hash,prefix:e.prefix,count:e.count,avgRssi:e.avgRssi,avgSnr:e.avgSnr,lastSeen:e.lastSeen,confidence:1,status:e.status});return A},[p]),ye=A.useMemo(()=>{var A,e;const r=new Set;for(const n of ve.keys())(null==(A=t[n])?void 0:A.latitude)&&(null==(e=t[n])?void 0:e.longitude)&&r.add(n);return r},[ve,t]),xe=A.useMemo(()=>{if(0===ye.size||!S)return new Map;const A=G.getPackets();if(0===A.length)return new Map;const e=U(S);return g(A,ye,e).scores},[ye,S,v.packetCount]),ke=A.useCallback(A=>!!(S&&(A.fromHash===S&&ye.has(A.toHash)||A.toHash===S&&ye.has(A.fromHash))),[S,ye]),Be=A.useMemo(()=>{var A,e;if(0===p.length||!S)return[];if(v.backgroundLoadComplete)return[];const r=[];for(const n of p){if("expired"===n.status)continue;if(!(null==(A=t[n.hash])?void 0:A.latitude)||!(null==(e=t[n.hash])?void 0:e.longitude))continue;const o=[S,n.hash].sort(),i=`${o[0]}~${o[1]}`;r.push({fromHash:S,toHash:n.hash,key:i,packetCount:n.count,avgConfidence:1,strength:.8,avgRecency:1,hopDistanceFromLocal:0,isHubConnection:!1,isCertain:!0,certainCount:n.count,isLoopEdge:!1,forwardCount:n.count,reverseCount:0,symmetryRatio:0,dominantDirection:"forward",floodCount:n.count,directCount:0,isDirectPathEdge:!1,isZeroHop:!0,avgRssi:n.avgRssi,avgSnr:n.avgSnr})}return r},[p,S,v.backgroundLoadComplete,t]),Me=A.useMemo(()=>{const A=[];if(Be.length>0&&!v.backgroundLoadComplete){for(const e of Be){const t=be.get(e.fromHash),r=be.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A}for(const e of b.validatedEdges){if(ke(e))continue;const t=be.get(e.fromHash),r=be.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[b.validatedEdges,be,ke,Be,v.backgroundLoadComplete]),De=A.useMemo(()=>{const A=[];for(const e of b.weakEdges){if(ke(e))continue;const t=be.get(e.fromHash),r=be.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[b.weakEdges,be,ke]),Ee=A.useMemo(()=>{if(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude))return[];const A=[],e=[r.latitude,r.longitude],n=new Map;for(const t of b.lastHopNeighbors)n.set(t.hash,t.count);const o=new Map;for(const t of p)o.set(t.hash,t.count);for(const r of ye){const i=t[r];if(!(null==i?void 0:i.latitude)||!(null==i?void 0:i.longitude))continue;const a=o.get(r),s=n.get(r);A.push({from:e,to:[i.latitude,i.longitude],hash:r,neighbor:i,lastHopData:ve.get(r)??null,rxAdvertCount:a,txProxyCount:s})}return A},[r,ye,t,ve,b.lastHopNeighbors,p]),je=A.useMemo(()=>new Set(b.loopEdgeKeys),[b.loopEdgeKeys]),Qe=A.useMemo(()=>new Set(b.backboneEdges),[b.backboneEdges]),Ne=A.useMemo(()=>{if(!MA)return null;const A=b.validatedEdges.filter(A=>A.fromHash===MA||A.toHash===MA);if(0===A.length)return null;const e=[...A].sort((A,e)=>e.certainCount-A.certainCount),t=Math.max(1,Math.ceil(.2*e.length)),r=e.slice(0,t);return new Set(r.map(A=>A.key))},[MA,b.validatedEdges]),Se=A.useMemo(()=>{let A=0;if(Be.length>0&&!v.backgroundLoadComplete){for(const e of Be)e.certainCount>A&&(A=e.certainCount);return A||1}for(const e of b.validatedEdges)e.certainCount>A&&(A=e.certainCount);return A||1},[b.validatedEdges,Be,v.backgroundLoadComplete]),Fe=A.useMemo(()=>{if(0===b.validatedEdges.length)return null;const A=new Set;for(const r of b.validatedEdges)A.add(r.fromHash),A.add(r.toHash);const e=Array.from(A).filter(A=>be.has(A)).sort();if(e.length<3)return null;const t=new Map;for(const r of e){const A=be.get(r);A&&t.set(r,A)}return uA(b.validatedEdges,e,t,b.edgeBetweenness)},[b.validatedEdges,be,b.edgeBetweenness]),Te=A.useCallback(()=>{mA(A=>{const e=!A;if(e&&Fe&&m.current){const A=m.current.getMap();if(!A)return e;let t=1/0,r=-1/0,n=1/0,o=-1/0,i=!1;for(const[,e]of Fe.communities)for(const A of e){const e=be.get(A);if(e){const[A,a]=e;n=Math.min(n,A),o=Math.max(o,A),t=Math.min(t,a),r=Math.max(r,a),i=!0}}i&&A.fitBounds([[t,n],[r,o]],{padding:{top:60,bottom:100,left:60,right:320},duration:800,maxZoom:14})}return e})},[Fe,be]),Le=A.useRef(null);A.useLayoutEffect(()=>{var A,e;Le.current=(null==(e=null==(A=m.current)?void 0:A.getMap)?void 0:e.call(A))??null});const Re=H(),Ie=A.useMemo(()=>G.getPackets(),[Re]);!function({map:e,nodeCoordinates:t,packets:r,localHash:n,neighbors:o,meshTopology:i,enabled:a=!0}){const s=A.useRef(null),l=e&&"current"in e?e.current:e;A.useEffect(()=>{s.current=l},[l]);const c=A.useRef(!1),u=A.useRef(null),d=A.useRef([]),f=A.useRef(0),g=A.useRef(!1),[h,m]=A.useState(!1),b=A.useRef(null),p=A.useRef([]),v=A.useRef(new Map),y=A.useRef(t);A.useEffect(()=>{y.current=t},[t]),A.useEffect(()=>{v.current=function(A,e){const t=new Map;for(const r of Object.keys(A)){const A=U(r);t.has(A)||t.set(A,r)}if(e){const A=U(e);t.set(A,e)}return t}(o,n)},[o,n]),A.useEffect(()=>{if(!a){b.current&&(clearTimeout(b.current),b.current=null),p.current=[],null!==u.current&&(cancelAnimationFrame(u.current),u.current=null),d.current=[];const A=s.current;if(A&&c.current){const e=A.getSource(Jt);e&&e.setData({type:"FeatureCollection",features:[]})}g.current=!1,f.current=0}},[a]),A.useEffect(()=>{const A=l;if(!A)return;let e=null,t=!1;const r=()=>{if(!t&&!c.current)try{A.getLayer(Xt)&&A.removeLayer(Xt),A.getSource(Jt)&&A.removeSource(Jt),A.addSource(Jt,{type:"geojson",data:{type:"FeatureCollection",features:[]}});const t=A.getLayer(er)?er:void 0;A.addLayer({id:Xt,type:"line",source:Jt,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["any",["==",["get","isSpeculative"],!0],["==",["get","isSpeculative"],"true"]],"#8B7BAD",Ar],"line-width":["case",["any",["==",["get","isSpeculative"],!0],["==",["get","isSpeculative"],"true"]],1.875,2.5],"line-opacity":["*",["get","opacityMult"],["interpolate",["linear"],["get","intensity"],0,0,.1,.8,.5,1,1,1]]}},t),c.current=!0,m(!0),e&&(clearInterval(e),e=null)}catch{}};return A.isStyleLoaded()&&r(),A.once("style.load",()=>{r()}),c.current||(e=setInterval(()=>{c.current?e&&clearInterval(e):r()},100),setTimeout(()=>{e&&(clearInterval(e),e=null)},5e3)),()=>{t=!0,e&&clearInterval(e),null!==u.current&&(cancelAnimationFrame(u.current),u.current=null);const A=s.current;if(A&&c.current){try{A.getLayer(Xt)&&A.removeLayer(Xt),A.getSource(Jt)&&A.removeSource(Jt)}catch{}c.current=!1,m(!1)}}},[l]);const w=A.useRef(()=>{});A.useEffect(()=>{w.current=()=>{const A=s.current;if(!A)return;const e=A.getSource(Jt);if(!e)return;const t=performance.now(),r=d.current,n=[],o=[];for(const i of r){const A=t-i.startTime-i.delay;if(A<(i.isSpeculative?$t:qt)){o.push(i);const e=i.isSpeculative?rr(A):tr(A);e>0&&n.push({type:"Feature",properties:{intensity:e,opacityMult:i.isSpeculative?.5:1,isSpeculative:i.isSpeculative??!1},geometry:{type:"LineString",coordinates:[i.fromCoord,i.toCoord]}})}}e.setData({type:"FeatureCollection",features:n}),d.current=o,o.length>0?u.current=requestAnimationFrame(()=>w.current()):u.current=null}},[]);const x=A.useCallback(()=>{const A=s.current;A&&function(A){if(!A.getLayer(Xt))return;const e=A.getLayer(er)?er:void 0;try{A.moveLayer(Xt,e)}catch{}}(A),null===u.current&&(u.current=requestAnimationFrame(()=>w.current()))},[]),k=A.useCallback(()=>{if(!s.current||!c.current)return;const A=p.current;if(p.current=[],b.current=null,0===A.length)return;const e=v.current,t=y.current;if(0===e.size)return;const r=performance.now();let o=0,a=!1;const l=new Set;for(const s of A){const A=O(s,n);if(!A||A.original.length<2)continue;const c=A.original;let u=0,f=null;for(let n=0;n0){A.sort((A,e)=>e.confidence-A.confidence);const e=Math.max(1,Math.ceil(.25*A.length)),n=A.slice(0,e),i=o+150*u;for(const{edgeKey:A,otherHash:o}of n){const e=t.get(f),n=t.get(o);d.current.push({edgeKey:A,fromCoord:nr(e),toCoord:nr(n),startTime:r,delay:i,isSpeculative:!0}),l.add(A),a=!0}}}u>0&&(o+=150*u*.5)}a&&x()},[n,i,x]);A.useEffect(()=>{const A=s.current;if(!a)return;if(!A)return;if(!h)return;if(0===r.length)return;const e=Date.now(),t=f.current;if(!g.current){g.current=!0;const A=(e-3e4)/1e3,t=r.filter(e=>(e.timestamp??0)>=A);let n=0;for(const e of r){const A=e.timestamp??0;A>n&&(n=A)}if(f.current=n,t.length>0){t.sort((A,e)=>(A.timestamp??0)-(e.timestamp??0));const A=t.slice(-20);p.current.push(...A),k()}return}const n=r.filter(A=>(A.timestamp??0)>t);if(0===n.length)return;let o=0;for(const r of n){const A=r.timestamp??0;A>o&&(o=A)}f.current=o,p.current.push(...n),b.current&&clearTimeout(b.current),b.current=setTimeout(k,175)},[a,r,k,h]),A.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[])}({map:Le,nodeCoordinates:be,packets:Ie,localHash:S,neighbors:t,meshTopology:b,enabled:$A});const{isExiting:_e,isAnimating:ze,resetAnimationState:He}=function({map:e,showTopology:t,validatedPolylines:r,weakPolylines:n,maxCertainCount:o,loopEdgeKeys:i,backboneEdgeKeys:a,highlightedEdgeKey:s,neighbors:l,validatedSourceId:c,weakSourceId:u,neighborPolylines:d=[],showNeighborLines:f=!0,neighborSourceId:g,neighborLinkScores:h=new Map,basemapMode:m}){const b=A.useRef(null);A.useEffect(()=>{const A=e&&"current"in e?e.current:e;b.current=A});const p=A.useRef(new Map),v=A.useRef(1),y=A.useRef(new Map),w=A.useRef(new Map),x=A.useRef(!1),k=A.useRef(null),C=A.useRef(t),B=A.useRef(new Set),M=A.useRef(""),D=A.useRef(new Map),E=A.useRef(""),j=A.useRef(""),Q=A.useRef(""),N=A.useRef(r),S=A.useRef(n),F=A.useRef(o),P=A.useRef(i),T=A.useRef(a),L=A.useRef(s),R=A.useRef(l),I=A.useRef(d),_=A.useRef(f),z=A.useRef(h),H=A.useRef(m);A.useEffect(()=>{N.current=r,S.current=n,F.current=o,P.current=i,T.current=a,L.current=s,R.current=l,I.current=d,_.current=f,z.current=h,H.current=m},[r,n,o,i,a,s,l,d,f,h,m]);const G=A.useCallback((A=!1)=>{var e,t,r,n,o,i,a,s,l,d;const f=b.current;if(!f)return;const h=f.getSource(c),m=f.getSource(u),x=f.getSource(g);if(h){const o=Wt(N.current,!0,p.current,v.current,y.current,w.current,F.current,P.current,T.current,L.current,R.current,H.current),i=`${o.features.length}:${(null==(t=null==(e=o.features[0])?void 0:e.properties)?void 0:t.key)??""}:${(null==(n=null==(r=o.features[o.features.length-1])?void 0:r.properties)?void 0:n.key)??""}:${Array.from(p.current.values()).reduce((A,e)=>A+e,0).toFixed(2)}`;(A||i!==E.current)&&(h.setData(o),E.current=i)}if(m){const e=Wt(S.current,!1,p.current,v.current,y.current,w.current,F.current,P.current,T.current,L.current,R.current,H.current),t=`${e.features.length}:${(null==(i=null==(o=e.features[0])?void 0:o.properties)?void 0:i.key)??""}:${(null==(s=null==(a=e.features[e.features.length-1])?void 0:a.properties)?void 0:s.key)??""}`;(A||t!==j.current)&&(m.setData(e),j.current=t)}if(x&&I.current.length>0){const e=Vt(I.current,z.current),t=`${e.features.length}:${(null==(d=null==(l=e.features[0])?void 0:l.properties)?void 0:d.hash)??""}`;(A||t!==Q.current)&&(x.setData(e),Q.current=t)}},[c,u,g]),O=A.useCallback(()=>{k.current&&(cancelAnimationFrame(k.current),k.current=null),p.current=new Map,v.current=1,y.current=new Map,w.current=new Map,x.current=!1,B.current=new Set,M.current="",D.current=new Map},[]);A.useEffect(()=>{const A=C.current,e=t;if(C.current=t,b.current){if(k.current&&(cancelAnimationFrame(k.current),k.current=null),A&&!e&&!x.current){x.current=!0;const A=new Map(p.current);let e=null;const t=r=>{e||(e=r);const n=r-e,o=Math.min(n/500,1),i=wA(o);for(const[e,t]of A)p.current.set(e,t*(1-i));G(!0),o<1?k.current=requestAnimationFrame(t):(x.current=!1,p.current=new Map,B.current=new Set,M.current="",y.current=new Map,w.current=new Map,k.current=null,G(!0))};k.current=requestAnimationFrame(t)}!A&&e&&(p.current=new Map,B.current=new Set,M.current="")}},[t,G]),A.useEffect(()=>{const A=b.current;if(!t||x.current||!A)return;const e=[...r,...n],o=e.map(A=>`${A.edge.key}:${A.edge.certainCount}`).sort().join(","),i=0===B.current.size,a=""!==M.current&&M.current!==o;if(!i&&!a)return void G();const s=[],l=[];for(const{edge:t}of e)B.current.has(t.key)?l.push(t.key):s.push(t.key);a&&l.length>0&&(y.current=new Map(D.current),v.current=0),w.current=new Map;for(const{edge:t}of r){const A=XA(t.certainCount);w.current.set(t.key,A)}for(const t of s)p.current.set(t,0);for(const t of l)p.current.has(t)||p.current.set(t,1);if(s.length>0||a&&l.length>0){k.current&&(cancelAnimationFrame(k.current),k.current=null);let A=null;const e=Math.min(100,ee/Math.max(s.length,1)/2),t=r=>{A||(A=r);const n=r-A;for(let A=0;A0){const A=Math.min(n/ee,1);v.current=xA(A)}G(!0);const o=ee+(s.length-1)*e;k.current=n{const A=b.current;if(!A||!g)return;const e=()=>{const e=A.getSource(g);if(!e)return!1;if(d.length>0){const A=Vt(d,h);e.setData(A)}else e.setData({type:"FeatureCollection",features:[]});return!0};if(e())return;const t=r=>{r.sourceId===g&&e()&&A.off("sourcedata",t)};A.on("sourcedata",t);const r=()=>{e()&&(A.off("styledata",r),A.off("sourcedata",t))};return A.on("styledata",r),()=>{A.off("sourcedata",t),A.off("styledata",r)}},[g,d,h]);const U=A.useRef(m);return A.useEffect(()=>{m!==U.current&&(U.current=m,E.current="",j.current="",Q.current="",G(!0))},[m,G]),A.useEffect(()=>()=>{k.current&&(cancelAnimationFrame(k.current),k.current=null)},[]),{isExiting:x.current,isAnimating:null!==k.current,resetAnimationState:O,weightAnimProgress:v.current,animStartWeights:y.current,animTargetWeights:w.current}}({map:Le,showTopology:W,validatedPolylines:Me,weakPolylines:De,maxCertainCount:Se,loopEdgeKeys:je,backboneEdgeKeys:Qe,highlightedEdgeKey:f,neighbors:t,validatedSourceId:Tr,weakSourceId:Lr,neighborPolylines:Ee,showNeighborLines:K,neighborSourceId:Rr,neighborLinkScores:xe,basemapMode:te}),Ge=A.useMemo(()=>{const A=new Set;for(const e of b.hubNodes){A.add(e);for(const t of b.validatedEdges)t.fromHash===e&&A.add(t.toHash),t.toHash===e&&A.add(t.fromHash)}return A},[b.hubNodes,b.validatedEdges]),Oe=A.useMemo(()=>{const A=new Set;if(!o)return A;for(const e of b.validatedEdges)e.fromHash===o&&A.add(e.toHash),e.toHash===o&&A.add(e.fromHash);return A},[o,b.validatedEdges]),{getNodeOpacity:Ue}=function({soloDirect:e,soloHubs:t,neighborHashes:r,hubConnectedNodes:n,directNodeSet:o,localConnectedNodes:i,showTopology:a}){const[s,l]=A.useState(new Map),c=A.useRef(e),u=A.useRef(t),d=A.useRef(new Map),f=A.useRef(null),g=A.useRef(n),h=A.useRef(o),m=A.useRef(i),b=A.useRef(a);return A.useEffect(()=>{g.current=n,h.current=o,m.current=i,b.current=a},[n,o,i,a]),A.useEffect(()=>{const A=c.current,n=u.current,o=e,i=t;if(c.current=e,u.current=t,A===o&&n===i)return;f.current&&(cancelAnimationFrame(f.current),f.current=null);const a=g.current,s=h.current,p=m.current,v=b.current;for(const e of r)d.current.has(e)||d.current.set(e,Math.random());const y=(A,e,t)=>{const r=a.has(A),n=s.has(A),o=v&&p.has(A);return!e&&!t||(e&&t?r||n||o:t?r:!e||n||o)},w=[];for(const e of r){const t=y(e,A,n),r=y(e,o,i);t!==r&&w.push({hash:e,startOpacity:t?1:0,targetOpacity:r?1:0})}if(0===w.length)return;l(A=>{const e=new Map(A);for(const{hash:t,startOpacity:r}of w)e.set(t,r);return e});const x=w;let k=null;const C=A=>{k||(k=A);const e=A-k;let t=!0;l(()=>{const A=new Map;for(const{hash:r,startOpacity:n,targetOpacity:o}of x){const i=250*(d.current.get(r)??0),a=Math.max(0,e-i),s=Math.min(a/500,1),l=n+(o-n)*xA(s);A.set(r,l),s<1&&(t=!1)}return A}),e<750&&!t?f.current=requestAnimationFrame(C):(f.current=null,l(new Map))};return f.current=requestAnimationFrame(C),()=>{f.current&&(cancelAnimationFrame(f.current),f.current=null)}},[e,t,r]),{nodeOpacities:s,getNodeOpacity:(A,e)=>s.has(A)?s.get(A):e?1:0}}({soloDirect:"direct"===cA,soloHubs:"hubs"===cA,neighborHashes:me.map(([A])=>A),hubConnectedNodes:Ge,directNodeSet:ye,localConnectedNodes:Oe,showTopology:W}),{blinkingNodes:Ye,blinkColor:Ze}=function({neighbors:e,localHash:t,enabled:r=!0}){const[n,o]=A.useState(new Map),i=H(),a=A.useRef(G.getPackets());A.useEffect(()=>{a.current=G.getPackets()},[i]);const s=A.useRef(0),l=A.useRef(null),c=A.useRef(new Map),u=A.useRef(new Map);A.useEffect(()=>{u.current=function(A){const e=new Map;for(const t of Object.keys(A)){const A=U(t);e.has(A)||e.set(A,t)}return e}(e)},[e]);const d=A.useRef(null);return A.useEffect(()=>{d.current=()=>{const A=performance.now(),e=c.current;if(0===e.size)return l.current=null,void o(new Map);const t=new Map,r=[];for(const[n,{startTime:o,staggerDelay:i}]of e){const e=A-o-i;if(e<0);else if(e>=750)r.push(n);else{const A=Zt(e,750);A>0&&t.set(n,A)}}for(const n of r)e.delete(n);o(t),e.size>0&&d.current?l.current=requestAnimationFrame(d.current):l.current=null}},[]),A.useEffect(()=>{if(!r)return;const A=a.current;if(0===A.length)return;const e=s.current,n=A.filter(A=>(A.timestamp??0)>e);if(0===e){const e=A.reduce((A,e)=>Math.max(A,e.timestamp??0),0);return void(s.current=e)}if(0===n.length)return;const o=n.reduce((A,e)=>Math.max(A,e.timestamp??0),0);s.current=o;const i=performance.now();let f=0;for(const r of n){const A=O(r,t);if(!A||0===A.original.length)continue;const e=Kt(A.original,u.current,t);if(0===e.length)continue;const n=375;for(let t=0;t()=>{null!==l.current&&(cancelAnimationFrame(l.current),l.current=null)},[]),{blinkingNodes:n,blinkColor:"#00FF00"}}({neighbors:t,localHash:o,enabled:$A}),Ke=A.useCallback(A=>{if("all"===cA)return!0;if("direct"===cA)return ye.has(A);if("hubs"===cA){if(b.hubNodes.includes(A))return!0;for(const e of b.validatedEdges){if(e.fromHash===A&&b.hubNodes.includes(e.toHash))return!0;if(e.toHash===A&&b.hubNodes.includes(e.fromHash))return!0}return!1}return!0},[cA,ye,b.hubNodes,b.validatedEdges]),Je=A.useCallback(()=>{_A(!0),RA(!0)},[]),qe=A.useCallback(()=>{zA?gA(A=>!A):Je()},[zA,Je]),At=A.useCallback(A=>{R(A.viewState),(A.viewState.pitch??0)>10&&!sA&&bA(!0)},[sA]),et=A.useCallback(()=>{z(A=>{var e,t,r,n,o,i,a;const s=!A,l=null==(r=null==(t=null==(e=m.current)?void 0:e.getContainer())?void 0:t.closest(".map-container-fullscreen, .map-container-16-9"))?void 0:r.parentElement;return s?l&&document.fullscreenEnabled?null==(n=l.requestFullscreen)||n.call(l).catch(()=>{}):l&&document.webkitFullscreenEnabled&&(null==(o=l.webkitRequestFullscreen)||o.call(l)):document.fullscreenElement?null==(i=document.exitFullscreen)||i.call(document).catch(()=>{}):document.webkitFullscreenElement&&(null==(a=document.webkitExitFullscreen)||a.call(document)),s})},[]),tt=A.useCallback(A=>{pA(A)},[]),rt=A.useCallback(()=>{hA(A=>!A)},[]),nt=A.useCallback(()=>{tA(A=>!A)},[]),ot=A.useCallback(()=>{bA(A=>{const e=!A;if(m.current){const A=m.current.getMap();A&&A.stop()}if(e&&m.current){const A=m.current.getMap();A&&A.easeTo({pitch:45,duration:1500,easing:wA})}if(!e&&m.current){const A=m.current.getMap();A&&A.easeTo({pitch:0,bearing:0,duration:800,easing:kA})}return e})},[]),it=A.useCallback(()=>{W||gA(!0)},[W]),at=A.useCallback((A,e)=>{FA(A),TA(e)},[]),st=A.useCallback(()=>{SA&&i&&i(SA),FA(null),TA("")},[SA,i]),lt=A.useMemo(()=>[...Yr,...Pr],[]),ct=A.useRef(!1);A.useEffect(()=>{ct.current="ontouchstart"in window||navigator.maxTouchPoints>0},[]);const ut=A.useCallback(A=>{A.features&&0!==A.features.length||(ct.current&&ie&&(ae(null),BA(null)),MA&&DA(null))},[ie,MA]),dt=A.useCallback(A=>{DA(e=>e===A?null:A)},[]),ft=A.useCallback(A=>{var e,t;if(!A.features||0===A.features.length)return;if(A.features.some(A=>{var e,t;return null==(t=null==(e=A.layer)?void 0:e.id)?void 0:t.startsWith("node-markers-")}))return void(CA&&(BA(null),ae(null)));const r=A.features.find(A=>{var e;const t=null==(e=A.layer)?void 0:e.id;return(null==t?void 0:t.startsWith("topology-"))||(null==t?void 0:t.startsWith("neighbor-"))});if(!r)return;const n=null==(e=r.layer)?void 0:e.id,o=r.properties;if(!(null==o?void 0:o.key))return;const i=null==n?void 0:n.startsWith("topology-"),a=null==n?void 0:n.startsWith("neighbor-");if(i||a){const e=o.key.replace(/-loop[12]$/,"");BA(e),A.lngLat&&ae({longitude:A.lngLat.lng,latitude:A.lngLat.lat,type:i?"topology":"neighbor",properties:o})}try{(null==(t=m.current)?void 0:t.getCanvas())&&(m.current.getCanvas().style.cursor="pointer")}catch{}},[CA]),gt=A.useCallback(()=>{var A;BA(null),ae(null);try{(null==(A=m.current)?void 0:A.getCanvas())&&(m.current.getCanvas().style.cursor="")}catch{}},[]),ht=_?"map-container-fullscreen":"map-container-16-9",mt=F.length>0||(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude),bt=!w||!mt,pt=mt;return e.jsxs("div",{className:`relative ${ht}`,role:"application","aria-label":"Mesh network contacts map","aria-describedby":"map-instructions","data-basemap":te,children:[e.jsx("span",{id:"map-instructions",className:"sr-only",children:"Interactive map showing mesh network contacts. Use mouse or touch to pan and zoom. Press Tab to navigate map controls. Press Escape to exit fullscreen mode."}),bt&&e.jsx("div",{className:"absolute inset-0 z-50 surface-base rounded-2xl flex items-center justify-center","aria-hidden":"true",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-6 h-6 border-2 border-sys-blue border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-fg-muted",children:"Loading map..."})]})}),pt&&e.jsx("div",{className:`relative w-full h-full ${_?"":"rounded-[1.125rem] overflow-hidden"} ${bt?"opacity-0":"opacity-100 transition-opacity duration-300"}`,children:e.jsxs(c,{ref:m,...T,onMove:At,mapStyle:Jr,style:{width:"100%",height:"100%"},attributionControl:!1,interactiveLayerIds:lt,onMouseMove:ft,onMouseLeave:gt,onClick:ut,onError:A=>{},onIdle:()=>{if(!N&&!Q&&m.current){const A=m.current.getMap();if(A){const e=Object.values(t).filter(A=>A.latitude&&A.longitude).map(A=>({latitude:A.latitude,longitude:A.longitude}));(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)&&e.push({latitude:r.latitude,longitude:r.longitude}),e.length>0&&j(e,A)}}},children:[e.jsx(u,{position:"bottom-right"}),e.jsx(d,{mode:te}),e.jsx(Nt,{enabled:sA,exaggeration:4}),e.jsx(Bt,{coveragePoints:ZA,visible:ZA.length>0&&KA,terrainEnabled:sA,brightness:JA,basemapMode:te}),e.jsx(zt,{partition:Fe,nodeCoordinates:be,visible:nA&&zA,opacity:iA.opacity,bandwidth:iA.bandwidth,threshold:iA.threshold,strokeWidth:iA.strokeWidth}),e.jsx(Ur,{showTopology:W,isExiting:_e,hoveredEdgeKey:CA,highlightedLoopEdges:null==se?void 0:se.highlightedEdgeKeys,highlightedFocusEdges:Ne,onEdgeHover:ce,onLoopHover:ue,loops:b.loops,neighborNames:he,opacityBias:EA,widthMultiplier:jA,trafficFilter:QA,showNeighborLines:K,disableHover:ze||IA}),a&&e.jsx(Wr,{targetHash:a,nodeCoordinates:be,onComplete:s}),f&&e.jsx(Vr,{highlightedEdgeKey:f,validatedPolylines:Me,weakPolylines:De,onEnsureTopology:it}),e.jsx(Kr,{ghost:h??null,neighborCoordinates:be,onHighlightedNeighborsChange:VA}),e.jsx(Fr,{neighborsWithLocation:me,localNode:r,localHash:o,zeroHopNeighbors:ye,lastHopNeighborMap:ve,meshTopology:b,hoveredMarker:vA,onMarkerHover:yA,getNodeOpacity:Ue,shouldShowNode:Ke,onRequestRemove:i?at:void 0,openPopupId:OA,onOpenPopup:YA,onClosePopup:WA,onNodeClick:dt,blinkingNodes:Ye,blinkColor:Ze})]})}),(()=>{const A=function(A,e,t){if(e){const A=e.loops[0],t=e.loops.length,r=[{label:"hops",value:A.size},{label:"seen",value:A.minCertainCount}],n=[];return A.includesLocal&&n.push({text:"★ Includes your node",color:"text-sys-amber"}),t>1&&n.push({text:`+${t-1} overlapping`,color:"text-sys-indigo/70"}),{type:"loop",title:{icon:"⟳",text:"Redundant Path"+(t>1?"s":""),color:"text-sys-indigo"},subtitle:{text:`${e.nodeNames.join(" → ")} → ${e.nodeNames[0]}`,color:"text-fg-secondary",mono:!0},stats:r,badges:n}}if("neighbor"===(null==A?void 0:A.type)){const e=A.properties,t=[];void 0!==e.rssi&&null!==e.rssi&&t.push({label:"RSSI",value:`${Math.round(e.rssi)} dBm`,unit:e.hasAvgRssi?"avg":void 0}),void 0!==e.snr&&null!==e.snr&&t.push({label:"SNR",value:`${Number(e.snr).toFixed(1)} dB`,unit:e.hasAvgSnr?"avg":void 0});const r=e.listenerScore??0,n=e.loudScore??0,o=r>0||n>0;return o&&(t.push({label:"listener",value:r,color:"text-sys-green"}),t.push({label:"loud",value:n,color:"text-sys-red"})),void 0===e.packetCount||o||t.push({label:"packets",value:Number(e.packetCount).toLocaleString()}),{type:"neighbor",title:{icon:"●",text:e.prefix?`${e.name} (${e.prefix})`:e.name,color:"text-sys-amber"},subtitle:{text:"Direct RF Neighbor",color:"text-sys-amber/70"},stats:t,badges:[]}}if("topology"===(null==A?void 0:A.type)){const e=A.properties,r=t>0?Number(e.certainCount)/t:0,n=[{label:"validations",value:e.certainCount},{label:"of max traffic",value:`${Math.round(100*r)}%`},{label:"confidence",value:`${Math.round(100*Number(e.confidence))}%`}];if(void 0!==e.symmetryRatio&&e.symmetryRatio<1){const A="forward"===e.dominantDirection?"→":"reverse"===e.dominantDirection?"←":"↔";n.push({label:"symmetric",value:`${A} ${Math.round(100*e.symmetryRatio)}%`,color:"text-fg-muted"})}const o=[];return e.isBackbone&&o.push({text:"Backbone",color:"text-zinc-300"}),e.isLoopEdge&&o.push({text:"Redundant",color:"text-sys-indigo"}),e.isDirectPath&&o.push({text:"Direct Path",color:"text-sys-teal"}),{type:"topology",title:{icon:"",text:`${e.fromName} ↔ ${e.toName}`,color:"text-fg-primary"},stats:n,badges:o}}return null}(ie?{type:ie.type,properties:ie.properties}:null,se,Se);return A&&e.jsx("div",{className:"map-edge-tooltip",children:e.jsx("div",{className:"map-control-surface map-edge-tooltip-inner",children:e.jsx(qr,{data:A})})})})(),e.jsx(ge,{mapRef:m,showNeighborLines:K,onToggleNeighborLines:rt,hasNeighborPolylines:Ee.length>0,nodeFilter:cA,onNodeFilterChange:tt,hasHubNodes:b.hubNodes.length>0,hasZeroHopNeighbors:ye.size>0,showCoverage:eA,onToggleCoverage:nt,showMinCut:nA,onToggleMinCut:Te,hasMinCutData:zA&&null!==Fe&&Fe.numCommunities>1,show3DTerrain:sA,onToggle3DTerrain:ot,basemapMode:te,onToggleBasemap:re,isFullscreen:_,onToggleFullscreen:et}),e.jsxs("div",{className:"map-legend-stack",children:[e.jsx(pe,{isActive:W,hasAnalyzed:zA,isLoading:IA,onClick:qe,basemapMode:te}),e.jsx(we,{isActive:$A,onClick:Ae,basemapMode:te}),e.jsx(Ce,{isActive:ZA.length>0&&KA,onClick:qA,basemapMode:te}),e.jsx(de,{showTopology:W,validatedPolylineCount:Me.length,filteredNeighborCount:me.length,hasLocalNode:!(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude)),meshTopology:b,zeroHopNeighbors:ye,neighborsWithLocation:me,basemapMode:te})]}),!_&&e.jsx("div",{className:"surface-card-frame absolute inset-0 pointer-events-none rounded-[1.125rem]",style:{zIndex:9999},"aria-hidden":"true"}),e.jsx(rA,{isOpen:null!==SA,onCancel:()=>FA(null),onConfirm:st,title:"Remove Node?",message:`Remove "${PA}" from the contacts list? This will hide the node until it sends a new packet.`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger"}),e.jsx(dA,{isOpen:LA,onClose:()=>{RA(!1),_A(!1),He(),GA(!0),setTimeout(()=>gA(!0),150)}}),e.jsx(We,{}),e.jsx(Xe,{visible:nA&&zA,onClose:()=>mA(!1),settings:iA,onSettingsChange:aA,partition:Fe,totalNodes:Object.keys(t).length,basemapMode:te})]})}export{$r as default}; diff --git a/frontend/dist/assets/Dashboard-CLZ_2cdd.js b/frontend/dist/assets/Dashboard-D9ScohcH.js similarity index 97% rename from frontend/dist/assets/Dashboard-CLZ_2cdd.js rename to frontend/dist/assets/Dashboard-D9ScohcH.js index bf3254fd..737c8d26 100644 --- a/frontend/dist/assets/Dashboard-CLZ_2cdd.js +++ b/frontend/dist/assets/Dashboard-D9ScohcH.js @@ -1 +1 @@ -import{r as e,j as t,c as s}from"./vendor-react-j_fHog8x.js";import{c as a,u as n,A as l,m as i,U as o,S as r,d as c,e as d,f as m,h as u,j as h,k as x,n as p,o as f,L as g,p as b,q as j,r as y,t as v,v as N,T as k,w,B as M,R as C,x as S,y as _,z as L,D as B,E as T,F,G as R,H as D,J as H,K as $,M as A,P,N as z,O as I,Q as E,V as q,W as O,X as W,Y as G,_ as V,$ as U,a0 as J,a1 as K,a2 as X}from"./index-01Tx8g53.js";import{C as Q,S as Y,a as Z,P as ee,b as te,B as se}from"./PageLayout-DrvMAhys.js";import{S as ae,M as ne}from"./sun-CkgnTZGI.js";import{A as le,E as ie,T as oe}from"./TimeRangeSelector-D9BP9uVt.js";import{c as re}from"./node-types-BT5BImck.js";import{b as ce,c as de,a as me,d as ue,F as he}from"./meshcore-tx-constants-BDLT5LMb.js";import{S as xe,u as pe,P as fe,T as ge,C as be}from"./PacketList-C6Vv6v7V.js";import{C as je}from"./copy-B5OWhmpX.js";import{C as ye}from"./Card-Dr9pbVV5.js";import{A as ve,Z as Ne,C as ke}from"./SignalIndicator-CIKrVFY9.js";import{s as we}from"./signal-scoring-CcBiRcks.js";import{L as Me}from"./LightSparkline-BCL2qx0n.js";import{a as Ce}from"./vendor-core-CmkNwW1A.js";import{c as Se}from"./link-scoring-LTbqUxGC.js";import{N as _e}from"./NodeInformationCard-BswM4rjl.js";import{g as Le,e as Be,a as Te,f as Fe}from"./chat-utils-CB1BFUm7.js";import{M as Re,C as De}from"./ChatBubble-B4FG9Nhp.js";import{C as He}from"./chevron-right-BHZSwM7S.js";import{H as $e}from"./route-D7UU7r6_.js";import{M as Ae}from"./message-square-B0UfZczh.js";import{H as Pe}from"./DelayedAnimateNumber-Ix4AeV6C.js";import{R as ze,C as Ie}from"./Grid-OFJ4oe0a.js";import"./maplibre-gl-b91ci4Kr.js";import"./index-D932VMrD.js";import"./payload-decoders-XckZ5vyB.js";import"./badge-colors-YAE4qQ7m.js";import"./arrow-up-C91otjLx.js";import"./map-pin-DZIYgupP.js";import"./triangle-alert-DI33YyZq.js";import"./DataBox-Dpf5ZHgV.js";import"./layers-BNjfohkH.js";import"./activity-DOuX3omM.js";import"./circle-check-DXO8ha7w.js";import"./database-Cxl-xDNL.js";const Ee=a("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]),qe=a("audio-waveform",[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]]),Oe=a("ear",[["path",{d:"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0",key:"1dfaln"}],["path",{d:"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4",key:"1qnva7"}]]),We=a("megaphone",[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]),Ge=a("pill-bottle",[["path",{d:"M18 11h-4a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h4",key:"17ldeb"}],["path",{d:"M6 7v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7",key:"nc37y6"}],["rect",{width:"16",height:"5",x:"4",y:"2",rx:"1",key:"3jeezo"}]]),Ve=a("satellite-dish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]),Ue=a("square-activity",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M17 12h-2l-2 5-2-10-2 5H7",key:"15hlnc"}]]),Je=a("tablets",[["circle",{cx:"7",cy:"7",r:"5",key:"x29byf"}],["circle",{cx:"17",cy:"17",r:"5",key:"1op1d2"}],["path",{d:"M12 17h10",key:"ls21zv"}],["path",{d:"m3.46 10.54 7.08-7.08",key:"1rehiu"}]]),Ke=a("timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);function Xe({packets:s,rangeMinutes:a,bucketCount:c}){const d=n(),[m,u]=e.useState(null),[h,x]=e.useState(null),[p,f]=e.useState(null),{buckets:g,activeTypes:b,totalByType:j}=e.useMemo(()=>function(e,t,s){const a=Date.now()/1e3,n=60*t,l=a-n,i=n/s,o=[];for(let c=0;ca)continue;const t=Math.min(s-1,Math.floor((e-l)/i)),n=c.type??c.payload_type??0,d=c.length??c.payload_length??0,m=o[t];m.bytesByType[n]=(m.bytesByType[n]??0)+d,m.totalBytes+=d,r[n]=(r[n]??0)+d}return{buckets:o,activeTypes:Object.keys(r).map(e=>parseInt(e,10)).filter(e=>r[e]>0).sort((e,t)=>r[t]-r[e]),totalByType:r}}(s,a,c),[s,a,c]),y=e.useCallback((e,t,s)=>{u(t),x(s)},[]),v=g.length>0&&b.length>0,N=m?function(e){const t=new Date(1e3*e).getHours();return t>=6&&t<18}(m.start):null,k=m?(w=m.start,new Date(1e3*w).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})):"";var w;const M=null!==p&&null!==N&&p!==N;return N!==p&&f(N),t.jsxs("div",{className:"flex flex-col h-full relative",children:[t.jsx("div",{className:"h-5 relative mb-1 shrink-0",children:m&&null!==h&&t.jsxs("div",{className:"absolute flex items-center gap-1.5 type-data-sm -translate-x-1/2",style:{left:`calc(48px + ${100*h}% * (1 - 48px / 100%))`},children:[t.jsx(l,{mode:"wait",children:t.jsx(i.span,{initial:!!M&&{opacity:0,scale:.5,rotate:-90},animate:{opacity:1,scale:1,rotate:0},exit:{opacity:0,scale:.5,rotate:90},transition:{duration:.25,ease:"easeOut"},children:N?t.jsx(ae,{className:"w-4 h-4 text-sys-amber"}):t.jsx(ne,{className:"w-4 h-4 text-sys-blue"})},N?"sun":"moon")}),t.jsx("span",{className:"text-fg-secondary",children:k})]})}),t.jsx("div",{className:"flex-1 min-h-0",children:v&&t.jsx(o,{buckets:g,activeTypes:b,gridColor:d.grid,axisTickColor:d.axisTick,onHover:y})}),t.jsx("div",{className:"pt-2 px-1 pb-2 shrink-0",children:v&&t.jsx(r,{activeTypes:b,totalByType:j})})]})}const Qe=e.memo(function({buckets:s,activeTypes:a}){const n=e.useRef(null),l=e.useRef(s),i=e.useRef(a);l.current=s,i.current=a;const o=e.useMemo(()=>[s.map(e=>e.start),s.map(()=>1)],[s]);return e.useEffect(()=>{if(!n.current||0===s.length)return;const e=n.current,t=e.getBoundingClientRect(),a=Math.floor(t.width)||200,r=Math.floor(t.height)||60,u=new c({width:a,height:r,padding:[0,0,0,0],cursor:{show:!1},scales:{x:{time:!1},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],legend:{show:!1},hooks:{draw:[e=>{const t=e.ctx,{left:s,top:a,width:n,height:o}=e.bbox;!function(e,t,s,a,n,l,i){if(0===t.length)return;const o=function(e,t,s){var a,n;if(e.length<=s)return e;const l=e.length/s,i=[];for(let o=0;o0&&(d.bytesByType[s]=(d.bytesByType[s]??0)+t)}}i.push(d)}return i}(t,s,m.statsCard),r=o.length,c=l/r,u=o.map(e=>e.totalBytes).filter(e=>e>0);if(0===u.length)return;const h=Math.max(...u),x=Math.min(...u),p=h-x;for(let m=0;m{const t=e.getBoundingClientRect();t.width>0&&t.height>0&&u.setSize({width:Math.floor(t.width),height:Math.floor(t.height)})});return h.observe(e),()=>{h.disconnect(),u.destroy()}},[o,s.length]),0===s.length?t.jsx("div",{className:"h-full flex items-center justify-center",children:t.jsx("div",{className:"w-full h-0.5 rounded-full bg-fg-muted/15"})}):t.jsx("div",{ref:n,className:"w-full h-full"})});function Ye({value:s,receivedCount:a,packets:n,rangeMinutes:l,bucketCount:i,timeRangeLabel:o,icon:r,isLoaded:c=!0}){const{buckets:d,activeTypes:m,ratePerHour:x}=e.useMemo(()=>function(e,t,s){const a=Date.now()/1e3,n=60*t,l=a-n,i=n/s,o=[];for(let m=0;ma)continue;const t=Math.min(s-1,Math.floor((e-l)/i)),n=m.type??m.payload_type??0,d=m.length??m.payload_length??0,u=o[t];u.bytesByType[n]=(u.bytesByType[n]??0)+d,u.totalBytes+=d,r[n]=(r[n]??0)+d,c++}const d=t/60;return{buckets:o,activeTypes:Object.keys(r).map(e=>parseInt(e,10)).filter(e=>r[e]>0).sort((e,t)=>r[t]-r[e]),ratePerHour:d>0?Math.round(c/d):0}}(n,l,i),[n,l,i]),p=a>0?(s/a*100).toFixed(1):null;return c?t.jsxs(u,{compact:!0,children:[t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[r&&t.jsx("span",{className:"icon-sm text-icon-card-title",children:r}),t.jsx("span",{className:"type-micro",children:"FORWARDED"}),o&&t.jsx(h,{color:"zinc",className:"hidden sm:inline-flex",children:o})]}),t.jsx("div",{className:"type-data-xl text-fg-primary",children:t.jsx(le,{value:s,className:"font-mono tabular-nums",priority:"high"})}),t.jsx("div",{className:"flex-1 mt-1 overflow-hidden min-h-[40px] sm:min-h-[60px]",children:m.length>0?t.jsx(Qe,{buckets:d,activeTypes:m}):t.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t.jsx("div",{className:"w-full h-0.5 rounded-full bg-fg-muted/15"})})}),t.jsx("div",{className:"pt-1.5 sm:pt-2 mt-1",children:t.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Rate"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[x,"/hr"]})]}),null!==p&&t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Ratio"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[p,"%"]})]})]})})]}):t.jsx(u,{compact:!0,children:t.jsx(Q,{})})}function Ze({value:s,receivedCount:a,packets:n,rangeMinutes:l,bucketCount:i,timeRangeLabel:o,icon:r,isLoaded:c=!0}){const{buckets:d,activeTypes:m,ratePerHour:x}=e.useMemo(()=>function(e,t,s){const a=Date.now()/1e3,n=60*t,l=a-n,i=n/s,o=[];for(let m=0;ma)continue;const t=Math.min(s-1,Math.floor((e-l)/i)),n=m.type??m.payload_type??0,d=m.length??m.payload_length??0,u=o[t];u.bytesByType[n]=(u.bytesByType[n]??0)+d,u.totalBytes+=d,r[n]=(r[n]??0)+d,c++}const d=t/60;return{buckets:o,activeTypes:Object.keys(r).map(e=>parseInt(e,10)).filter(e=>r[e]>0).sort((e,t)=>r[t]-r[e]),ratePerHour:d>0?Math.round(c/d):0}}(n,l,i),[n,l,i]),p=a>0?(s/a*100).toFixed(1):null;return c?t.jsxs(u,{compact:!0,children:[t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[r&&t.jsx("span",{className:"icon-sm text-icon-card-title",children:r}),t.jsx("span",{className:"type-micro",children:"DROPPED"}),o&&t.jsx(h,{color:"zinc",className:"hidden sm:inline-flex",children:o})]}),t.jsx("div",{className:"type-data-xl text-fg-primary",children:t.jsx(le,{value:s,className:"font-mono tabular-nums",priority:"high"})}),t.jsx("div",{className:"flex-1 mt-1 overflow-hidden min-h-[40px] sm:min-h-[60px]",children:m.length>0?t.jsx(Qe,{buckets:d,activeTypes:m}):t.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t.jsx("div",{className:"w-full h-0.5 rounded-full bg-fg-muted/15"})})}),t.jsx("div",{className:"pt-1.5 sm:pt-2 mt-1",children:t.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Rate"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[x,"/hr"]})]}),null!==p&&t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Drop %"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[p,"%"]})]})]})})]}):t.jsx(u,{compact:!0,children:t.jsx(Q,{})})}const et={",":"punc",".":"punc-period",":":"punc-colon","/":"punc-slash"},tt=/([,\.:\/])/g,st=e.memo(function({children:s,className:a="",as:n="span"}){const l=e.useMemo(()=>{let e;return e="number"==typeof s?s.toLocaleString():Array.isArray(s)?s.join(""):String(s??""),tt.test(e)?(tt.lastIndex=0,e.split(tt).map((e,s)=>{const a=et[e];return a?t.jsx("span",{className:a,children:e},s):e})):e},[s]);return t.jsx(n,{className:`data-tight ${a}`.trim(),children:l})});function at(e,t,s){return me(Math.max(t,Math.min(s,e)))}function nt({stats:s,receivedBuckets:a,droppedBuckets:n,forwardedBuckets:l,bucketDurationSeconds:i,timeRangeLabel:o,isLoaded:r=!0}){var c,d,m,b;const[j,y]=e.useState(!1),[v,N]=e.useState("idle"),k=x();if(!r)return t.jsx(u,{compact:!0,children:t.jsx(Q,{})});const w=Math.floor(Date.now()/1e3)-604800,M=Object.values((null==s?void 0:s.neighbors)??{}).filter(e=>e.zero_hop&&e.last_seen>=w&&re(e).isRepeater).length,C=k.filter(e=>"active"===e.status||e.lastSeen>=w).length,S=Math.max(M,C),_=function(e,t,s){const a=e=>(null==e?void 0:e.reduce((e,t)=>e+t.count,0))??0,n=a(t),l=a(s),i=n||(null==e?void 0:e.rx_count)||1,o=l||(null==e?void 0:e.dropped_count)||0;return i>0?o/(i+o)*100:0}(s,a,n),L=function(e,t,s){if((null==t?void 0:t.length)&&s){const e=100;return((null==(a=t)?void 0:a.reduce((e,t)=>e+t.count,0))??0)*e/(t.length*s*1e3)*100}var a;if(e){const t=1e3*(e.uptime_seconds||1);return(e.total_airtime_ms||e.airtime_used_ms||0)/t*100}return 0}(s,l,i),B=(null==(d=null==(c=null==s?void 0:s.config)?void 0:c.delays)?void 0:d.tx_delay_factor)??null,T=(null==(b=null==(m=null==s?void 0:s.config)?void 0:m.delays)?void 0:b.direct_tx_delay_factor)??null,F=function(e,t,s,a){let n=ce(e);t>20?n+=2*he:t>12&&(n+=he),s>8&&(n+=he);const l=at(n,0,2);let i=ue(e);s>8&&(i+=he);const o=at(i,0,1),r=de(l),c=de(o),d=null!==a?de(a):null;let m="stable";return null!==d&&(r>d?m="increase":r20?H.push(`High duplicate rate (${_.toFixed(1)}%) suggests frequent collisions — window widened.`):_>12&&H.push(`Elevated duplicate rate (${_.toFixed(1)}%) — window widened one step.`),L>8&&H.push(`Channel is busy (${L.toFixed(1)}% TX util) — extra spacing added.`));const $=[`Direct uses one forwarder — ×${F.directFactor.toFixed(1)} backoff for channel contention.`];L>8&&$.push("Busy channel — small extra backoff.");const A=[`Flood ×${F.floodFactor.toFixed(1)} (${F.floodSlots} slot${1!==F.floodSlots?"s":""})`,...H,"",`Direct ×${F.directFactor.toFixed(1)}`,...$,"","Click to copy CLI commands"].join("\n"),P=null!==B?de(B):null,z=null!==T?de(T):null,I=null!==P&&F.floodSlots!==P,E=null!==z&&F.directSlots!==z,q=I||E,O=e.useCallback(async()=>{if("applying"!==v){N("applying");try{const e=await p({tx_delay_factor:F.floodFactor,direct_tx_delay_factor:F.directFactor});(null==e?void 0:e.success)?(N("success"),setTimeout(()=>N("idle"),2e3)):(N("error"),setTimeout(()=>N("idle"),2500))}catch{N("error"),setTimeout(()=>N("idle"),2500)}}},[v,F.floodFactor,F.directFactor]);return t.jsxs(u,{compact:!0,children:[t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3 flex-wrap",children:[t.jsx(xe,{className:"w-4 h-4 text-icon-card-title flex-shrink-0"}),t.jsx("span",{className:"type-micro",children:"DELAY DOCTOR"}),o&&t.jsx(h,{color:"zinc",className:"hidden sm:inline-flex",children:o})]}),t.jsxs("button",{onClick:async()=>{const e=`set txdelay ${F.floodFactor.toFixed(1)}\nset direct.txdelay ${F.directFactor.toFixed(1)}`;try{await navigator.clipboard.writeText(e),y(!0),setTimeout(()=>y(!1),1500)}catch{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{document.execCommand("copy"),y(!0),setTimeout(()=>y(!1),1500)}catch{}document.body.removeChild(t)}},className:"flex gap-3 mb-2 sm:mb-3 w-full text-left hover:bg-subtle-fill radius-inner transition-base p-1 -m-1 group",title:A,children:[t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx("span",{className:"type-data-xl text-fg-primary",children:t.jsxs(st,{children:["×",F.floodFactor.toFixed(1)]})}),t.jsx("span",{className:"type-micro text-fg-muted mt-0.5 sm:mt-1",children:"Flood"})]}),t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx("span",{className:"type-data-xl text-sys-blue",children:t.jsxs(st,{children:["×",F.directFactor.toFixed(1)]})}),t.jsx("span",{className:"type-micro text-fg-muted mt-0.5 sm:mt-1",children:"Direct"})]}),t.jsx("div",{className:"flex items-center self-center opacity-0 group-hover:opacity-100 transition-opacity",children:j?t.jsx(f,{className:"w-4 h-4 text-sys-green"}):t.jsx(je,{className:"w-4 h-4 text-fg-muted"})})]}),t.jsx("div",{className:"flex-1 py-2",children:t.jsxs("div",{className:"flex gap-3",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"data-box-label",children:"Dupe"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left "+(F.duplicateRate>8?"text-status-warning":""),children:[F.duplicateRate.toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"data-box-label",children:"TX Util"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[F.txUtilization.toFixed(2),"%"]})]})]})}),t.jsx("div",{className:"pt-2 mt-auto",children:t.jsxs("div",{className:"flex items-end justify-between gap-2",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Current"}),t.jsx("div",{className:"flex gap-2",children:null!==B?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"data-box",children:["×",B.toFixed(2)]}),t.jsxs("div",{className:"data-box",style:{color:"var(--sys-blue)"},children:["×",(null==T?void 0:T.toFixed(2))??"—"]})]}):t.jsx("span",{className:"text-sm text-fg-muted",children:"No config"})})]}),q&&t.jsxs("button",{onClick:O,disabled:"applying"===v||"success"===v,className:"flex items-center gap-1.5 px-2.5 py-1.5 radius-inner type-micro font-medium transition-base\n "+("success"===v?"bg-sys-green/15 text-sys-green":"error"===v?"bg-sys-red/15 text-sys-red":"applying"===v?"bg-subtle-fill text-fg-muted":"bg-sys-blue/10 text-sys-blue hover:bg-sys-blue/20"),title:`Apply ×${F.floodFactor.toFixed(1)} flood, ×${F.directFactor.toFixed(1)} direct`,children:["success"===v?"Rx'd":"error"===v?"Failed":"Apply","applying"===v?t.jsx(g,{className:"w-3.5 h-3.5 animate-spin"}):"success"===v?t.jsx(f,{className:"w-3.5 h-3.5"}):t.jsxs("span",{className:"relative inline-flex items-end w-6 h-3.5",children:[t.jsx(Ge,{className:"w-3.5 h-3.5 absolute left-0 bottom-0"}),t.jsx(Je,{className:"w-3 h-3 absolute right-0 bottom-0"})]})]})]})})]})}function lt(){const s=b(),a=j(),n=y(),l=v(),i=N(),o=pe(e=>e.requestChannel),[r,c]=e.useState(!0),d=e.useCallback(e=>c(e),[]),m=e.useMemo(()=>[...s.length<=100?s:s.slice(-100)].sort((e,t)=>(t.timestamp??0)-(e.timestamp??0)),[s]),h=null==l?void 0:l.local_hash,x=null==l?void 0:l.neighbors;return t.jsxs(u,{noPadding:!0,className:"!overflow-visible",children:[t.jsx(ye,{listHeader:!0,icon:t.jsx(C,{}),title:"Recent Packets",actions:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(k,{enabled:r,onChange:d,label:"Hide Dupes",size:"sm"}),n&&t.jsx(w,{showLabel:!0}),t.jsxs(M,{color:"primary",outline:!0,href:"/packets",children:["View all",t.jsx(ve,{"data-slot":"icon"})]})]})}),t.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-1",children:t.jsx(fe,{packets:m,allPackets:s,localHash:h,neighbors:x,decodedMessages:i,onChannelClick:o,loading:a,maxPackets:25,showPagination:!1,flashNewest:!0,hideDupes:r,emptyMessage:"No packets received",footerAction:t.jsxs(M,{color:"primary",outline:!0,href:"/packets",children:["View all",t.jsx(ve,{"data-slot":"icon"})]})})})]})}const it={stable:"M5 12h14",up:"M5 15l7-7 7 7",down:"M19 9l-7 7-7-7"};function ot({trend:e}){return t.jsx("span",{className:`mini-widget-trend ${e}`,children:t.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:it[e]})})})}function rt(){return t.jsx("div",{className:"mini-widget-loading",children:t.jsx("div",{className:"mini-widget-loading-spinner"})})}function ct({message:e}){return t.jsx("div",{className:"mini-widget-error",children:t.jsx("span",{title:e,children:"No data"})})}function dt({title:e,icon:s,value:a,unit:n,valueSize:l="md",status:i,subtitle:o,trend:r,children:c,isLoading:d=!1,error:m,className:h="",onClick:x}){const p=["mini-widget-value","lg"===l&&"mini-widget-value-lg","sm"===l&&"mini-widget-value-sm"].filter(Boolean).join(" "),f=["mini-widget",h].filter(Boolean).join(" ");return t.jsxs(u,{noPadding:!0,className:f,onClick:x,children:[t.jsxs("div",{className:"mini-widget-header",children:[s,t.jsx("span",{className:"mini-widget-title",children:e}),i&&"unknown"!==i&&t.jsx("div",{className:`mini-widget-status-dot ${i}`}),r&&t.jsx(ot,{trend:r})]}),d?t.jsx(rt,{}):m?t.jsx(ct,{message:m}):t.jsxs(t.Fragment,{children:[void 0!==a&&t.jsxs("div",{className:p,children:["number"==typeof a?t.jsx(le,{value:a,className:"font-mono tabular-nums",priority:"medium",format:Number.isInteger(a)?void 0:{minimumFractionDigits:1,maximumFractionDigits:1}}):t.jsx(st,{children:a}),n&&t.jsx("span",{className:"mini-widget-unit",children:n})]}),o&&t.jsx("div",{className:"mini-widget-subtitle",children:o}),c]})]})}const mt={DELTA_CRITICAL:10,SLOPE_CRITICAL:4,JITTER_CRITICAL:6,DELTA_WARNING:5,SLOPE_WARNING:2,JITTER_WARNING:4},ut={baselineMedian:null,baselineP10:null,baselineP90:null,currentMedian:null,currentSampleCount:0,delta:0,slope:0,jitter:0,penalty:0,penaltyReason:null,computedAt:0,isReliable:!1};function ht(e,t){if(0===e.length)return null;const s=[...e].sort((e,t)=>e-t),a=t/100*(s.length-1),n=Math.floor(a),l=Math.ceil(a);return n===l?s[n]:s[n]+(s[l]-s[n])*(a-n)}function xt(e){return ht(e,50)}function pt(e){if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(Number).filter(e=>!isNaN(e))}catch{}return[]}function ft(e){return null!=e&&0!==e&&!Object.is(e,-0)&&!(e>-50||e<-130)}function gt(e,t,s=2,a=!1){if(null===t)return"stable";const n=e-t;return(0!==t?100*Math.abs(n/t):Math.abs(n))0?"up":"down":n>0?"down":"up"}const bt={lbtStats:null,noiseFloor:null,sparklineNoiseFloor:[],linkQuality:null,channelHealth:null,nfTrend:ut,radioConfig:null,trends:null,stats:null,recentPackets:[],quickNeighbors:[],isLoading:!0,error:null,refresh:async()=>{}},jt=e.createContext(bt);function yt({children:s}){var a;const n=v(),l=b(),i=S(),o=_(),r=L(),c=B[r],d=Math.max(1,c.minutes/60),m=null===n,u=e.useMemo(()=>function(e,t){const s=3600*t,a=Math.floor(Date.now()/1e3)-s,n=e.filter(e=>e.timestamp>=a&&void 0!==e.lbt_attempts&&e.lbt_attempts>0),l=n.length,i=n.filter(e=>(e.lbt_attempts??0)>1).length,o=l>0?i/l*100:0,r=n.filter(e=>(e.lbt_attempts??0)>1),c=r.length>0?r.reduce((e,t)=>e+(t.lbt_attempts??0),0)/r.length:0,d=n.filter(e=>(e.lbt_attempts??0)>=5).length,m=l>0?d/l*100:0,u=[];for(const y of n){const e=pt(y.lbt_backoff_delays_ms);u.push(...e)}const h=u.reduce((e,t)=>e+t,0),x=u.length>0?h/u.length:0,p=u.length>0?Math.min(...u):0,f=u.length>0?Math.max(...u):0,g=s/24,b=[],j=[];for(let y=0;y<24;y++){const e=a+y*g,t=e+g,s=n.filter(s=>s.timestamp>=e&&s.timestamp(e.lbt_attempts??0)>1).length,i=s.length>0?l/s.length*100:0,o=[];for(const a of s){const e=pt(a.lbt_backoff_delays_ms);o.push(...e)}const r=o.length>0?o.reduce((e,t)=>e+t,0)/o.length:0;if(b.push(r),0===s.length)j.push(0);else{const e=s.filter(e=>(e.lbt_attempts??0)>=5).length,t=o.length>0?Math.max(...o):0,a=Math.min(s.length/5,1),n=.15,l=Math.log(1+i*n)/Math.log(1+100*n)*40,c=e/s.length*100,d=Math.min(.5*c,25);let m=0;r>100&&(m=Math.min(8*Math.log10(r/100),15));let u=0;t>500&&r>0&&t>2*r&&(u=Math.min((t-500)/200,5));const h=l+d+m+u;j.push(Math.min(h*a,85))}}return{totalPacketsWithLBT:l,packetsWithRetries:i,retryRate:o,avgRetries:c,channelBusyCount:d,channelBusyRate:m,avgBackoffMs:x,minBackoffMs:p,maxBackoffMs:f,totalBackoffMs:h,sparklineBackoff:b,sparklineCollisionRisk:j,windowHours:t,packetCount:e.length}}(l,d),[l,d]),h=(null==n?void 0:n.noise_floor_dbm)??null,x=e.useMemo(()=>ft(h)?h:null,[h]),p=e.useMemo(()=>{var e;const t=null==(e=null==n?void 0:n.config)?void 0:e.radio;return t?{sf:t.spreading_factor??7,bwHz:t.bandwidth??125e3}:null},[null==(a=null==n?void 0:n.config)?void 0:a.radio]),[f,g]=e.useState([]),j=e.useRef({time:0,hours:0});e.useEffect(()=>{const e=async()=>{var e;const t=Date.now(),s=Math.ceil(d);if(0===j.current.time||j.current.hours!==s||t-j.current.time>=6e4){j.current={time:t,hours:s};try{const t=await T(Math.max(s,24));t.success&&(null==(e=t.data)?void 0:e.history)&&g(t.data.history)}catch{}}};e();const t=setInterval(e,6e4);return()=>clearInterval(t)},[d]);const y=e.useMemo(()=>function(e,t){if(0===e.length)return[];const s=e.reduce((e,t)=>Math.max(e,t.timestamp),0);if(0===s)return[];const a=3600*t,n=s-a,l=a/24,i=[];for(let o=0;o<24;o++){const t=n+o*l,s=t+l,a=e.filter(e=>e.timestamp>=t&&e.timestamp0){const e=a.reduce((e,t)=>e+t.noise_floor_dbm,0)/a.length;i.push(e)}else i.push(i.length>0?i[i.length-1]:-100)}return i}(f,d),[f,d]),N=null==n?void 0:n.neighbors,k=e.useMemo(()=>{const e=N??{};return Object.fromEntries(Object.entries(e).filter(([e])=>!o.has(e)))},[N,o]),w=e.useMemo(()=>i.filter(e=>!o.has(e.hash)),[i,o]),M=e.useMemo(()=>function(e){if(0===e.length)return{...ut,computedAt:Math.floor(Date.now()/1e3)};const t=Math.floor(Date.now()/1e3),s=e.filter(e=>Number.isFinite(e)),a=e.length>0?[e[e.length-1]]:[],n=e.slice(-4).filter(e=>Number.isFinite(e)),l=xt(s),i=ht(s,10),o=ht(s,90),r=xt(a),c=null!==r&&null!==i?r-i:0,d=function(e){if(e.length<2)return 0;const t=e.length;let s=0,a=0,n=0,l=0;const i=e[0].timestamp;for(const r of e){const e=(r.timestamp-i)/3600,t=r.value;s+=e,a+=t,n+=e*t,l+=e*e}const o=t*l-s*s;return Math.abs(o)<1e-4?0:(t*n-s*a)/o}(n.map((e,s)=>({timestamp:t-3600*(n.length-1-s),value:e}))),m=function(e){if(e.length<2)return 0;const t=e.reduce((e,t)=>e+t,0)/e.length,s=e.map(e=>Math.pow(e-t,2)).reduce((e,t)=>e+t,0)/e.length;return Math.sqrt(s)}(n),u=s.length>=12,[h,x]=u?function(e,t,s){const a=mt;return e>=a.DELTA_CRITICAL?[2,`Noise floor ${e.toFixed(1)} dB above baseline`]:t>=a.SLOPE_CRITICAL?[2,`Noise floor rising ${t.toFixed(1)} dB/hour`]:s>=a.JITTER_CRITICAL?[2,`Noise floor unstable (±${s.toFixed(1)} dB)`]:e>=a.DELTA_WARNING?[1,`Noise floor ${e.toFixed(1)} dB above baseline`]:t>=a.SLOPE_WARNING?[1,`Noise floor rising ${t.toFixed(1)} dB/hour`]:s>=a.JITTER_WARNING?[1,`Noise floor variable (±${s.toFixed(1)} dB)`]:[0,null]}(c,d,m):[0,null];return{baselineMedian:l,baselineP10:i,baselineP90:o,currentMedian:r,currentSampleCount:a.length,delta:c,slope:d,jitter:m,penalty:h,penaltyReason:x,computedAt:t,isReliable:u}}(y),[y]),C=e.useMemo(()=>function(e,t,s){if(0===e.length)return{neighbors:[],networkScore:0,neighborCount:0,bestLink:null,worstLink:null};const a=e.map(e=>{const a=function(e,t,s){const a=we(e,t,s,0);if(a)switch(a.finalGrade){case"excellent":return 100;case"good":return 80;case"fair":return 60;case"poor":return 40;case"critical":return 20}const n=void 0===e?50:e>=10?100:e>=5?80:e>=0?60:e>=-5?40:20,l=void 0===t?50:t>=-70?100:t>=-80?80:t>=-90?60:t>=-100?40:20;return Math.round(.6*n+.4*l)}(e.avgSnr??void 0,e.avgRssi??void 0,s),n=t[e.hash];return{name:(null==n?void 0:n.name)||(null==n?void 0:n.node_name)||e.prefix,hash:e.hash,rssi:e.avgRssi??-100,snr:e.avgSnr??-10,score:a,advertCount:e.count}});a.sort((e,t)=>t.score-e.score);const n=a.length>0?a.reduce((e,t)=>e+t.score,0)/a.length:0;return{neighbors:a,networkScore:Math.round(n),neighborCount:a.length,bestLink:a.length>0?{name:a[0].name,score:a[0].score}:null,worstLink:a.length>0?{name:a[a.length-1].name,score:a[a.length-1].score}:null}}(w,k,p),[w,k,p]),F=e.useMemo(()=>function(e,t,s){const a=e?Math.max(0,Math.min(100,100-5*e.retryRate)):50;let n=50;null!==t&&(n=Math.max(0,Math.min(100,(t+120)/30*100)));const l=(null==s?void 0:s.networkScore)??50,i=Math.round(.35*a+.25*n+.4*l);let o;return o=i>=85?"excellent":i>=70?"good":i>=50?"fair":i>=30?"congested":"critical",{score:i,status:o,components:{lbtHealth:Math.round(a),noiseHealth:Math.round(n),linkHealth:Math.round(l)}}}(u,x,C),[u,x,C]),[R,D]=e.useState({noiseFloor:null,networkScore:null,channelHealth:null}),H=e.useRef(0);e.useEffect(()=>{const e=()=>{const e=Date.now();e-H.current>3e4&&(H.current=e,D({noiseFloor:x,networkScore:(null==C?void 0:C.networkScore)??null,channelHealth:(null==F?void 0:F.score)??null}))};e();const t=setInterval(e,5e3);return()=>clearInterval(t)},[x,null==C?void 0:C.networkScore,null==F?void 0:F.score]);const $=e.useMemo(()=>({noiseFloor:{current:x,previous:R.noiseFloor,trend:null!==x?gt(x,R.noiseFloor,2,!0):"stable"},networkScore:{current:(null==C?void 0:C.networkScore)??0,previous:R.networkScore,trend:gt((null==C?void 0:C.networkScore)??0,R.networkScore,3,!1)},channelHealth:{current:(null==F?void 0:F.score)??0,previous:R.channelHealth,trend:gt((null==F?void 0:F.score)??0,R.channelHealth,3,!1)}}),[x,null==C?void 0:C.networkScore,null==F?void 0:F.score,R]),A={lbtStats:u,noiseFloor:x,sparklineNoiseFloor:y,linkQuality:C,channelHealth:F,nfTrend:M,radioConfig:p,trends:$,stats:n,recentPackets:l,quickNeighbors:i,isLoading:m,error:null,refresh:async()=>{}};return t.jsx(jt.Provider,{value:A,children:s})}function vt(){const t=e.useContext(jt);if(void 0===t)throw new Error("useLBTData must be used within an LBTDataProvider");return t}function Nt(e,t){return 0===e?"No backoffs":`${t.toFixed(0)}% retry rate`}function kt(){const{lbtStats:s,isLoading:a,error:n}=vt(),l=Ce(),i=(null==s?void 0:s.avgBackoffMs)??0,o=(null==s?void 0:s.retryRate)??0,r=s?(c=i)<100?"excellent":c<250?"good":c<500?"fair":c<1e3?"congested":"critical":"unknown";var c;const d=null==s?void 0:s.sparklineBackoff,m=e.useMemo(()=>!d||d.length<2?[]:d.map((e,t)=>({timestamp:Date.now()-36e5*(d.length-1-t),count:e})),[d]);return t.jsx(dt,{title:"LBT Backoff",icon:t.jsx(Ke,{className:"mini-widget-icon"}),value:Math.round(i),unit:"ms",status:r,subtitle:s?Nt(i,o):void 0,isLoading:a,error:n,onClick:()=>l("/packets"),children:t.jsx("div",{className:"mini-widget-sparkline w-full",children:t.jsx(Me,{data:m,width:9999,height:24,color:"var(--sys-blue)",isLoading:a,className:"w-full"})})})}function wt(e){return 0===e?"—":e<1?"<1":Math.round(e).toString()}function Mt(){const{lbtStats:e,isLoading:s,error:a}=vt(),n=Ce(),l=(null==e?void 0:e.channelBusyCount)??0,i=(null==e?void 0:e.totalPacketsWithLBT)??0,o=(null==e?void 0:e.channelBusyRate)??0,r=(null==e?void 0:e.retryRate)??0,c=(null==e?void 0:e.avgBackoffMs)??0,d=(null==e?void 0:e.minBackoffMs)??0,m=(null==e?void 0:e.maxBackoffMs)??0,u=r>0?Math.max(0,(r-o)/r*100):100;return t.jsx(dt,{title:"Ch. Busy",icon:t.jsx(ie,{className:"mini-widget-icon"}),isLoading:s,error:a,onClick:()=>n("/packets"),children:t.jsx("div",{className:"flex-1 flex items-end",children:t.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)] sm:grid-cols-[auto_minmax(0,1fr)_auto_minmax(0,1fr)] gap-x-2 gap-y-1 sm:gap-y-2 w-full items-baseline",children:[t.jsx("span",{className:"data-box-label mb-0 text-[10px] sm:text-sm",title:`${l} packets exceeded max CAD attempts (5) out of ${i} total transmissions.`,children:"Failed:"}),t.jsxs("div",{className:"data-box data-box-compact sm:data-box justify-self-start",title:`${l} packets exceeded max CAD attempts (5) out of ${i} total transmissions.`,children:[t.jsx(st,{children:l}),t.jsx("span",{className:"text-fg-muted punc-slash",children:"/"}),t.jsx(st,{children:i})]}),t.jsx("span",{className:"data-box-label mb-0 text-[10px] sm:text-sm",title:`${u.toFixed(1)}% of packets that needed LBT retries were sent successfully.`,children:"Sent:"}),t.jsx("div",{className:"data-box data-box-compact sm:data-box justify-self-start",title:`${u.toFixed(1)}% of packets that needed LBT retries were sent successfully.`,children:t.jsxs(st,{children:[u.toFixed(0),"%"]})}),t.jsx("span",{className:"data-box-label mb-0 text-[10px] sm:text-sm",title:`Average LBT backoff delay: ${c.toFixed(0)}ms.`,children:"Mean:"}),t.jsxs("div",{className:"data-box data-box-compact sm:data-box justify-self-start",title:`Average LBT backoff delay: ${c.toFixed(0)}ms.`,children:[t.jsx(st,{children:wt(c)}),t.jsx("span",{className:"text-fg-muted text-xs",children:"ms"})]}),t.jsx("span",{className:"data-box-label mb-0 text-[10px] sm:text-sm",title:`Backoff range: ${d.toFixed(0)}ms min, ${m.toFixed(0)}ms max.`,children:"Range:"}),t.jsxs("div",{className:"data-box data-box-compact sm:data-box justify-self-start",title:`Backoff range: ${d.toFixed(0)}ms min, ${m.toFixed(0)}ms max.`,children:[t.jsx(st,{children:wt(d)}),t.jsx("span",{className:"text-fg-muted punc-slash",children:"/"}),t.jsx(st,{children:wt(m)})]})]})})})}function Ct(e){return null===e?"No reading":e<-115?"Very quiet":e<-105?"Quiet":e<-95?"Moderate":e<-85?"Elevated":"High interference"}function St(){const{noiseFloor:s,sparklineNoiseFloor:a,trends:n,isLoading:l,error:i}=vt(),o=null===(r=s)||r<-110?"excellent":r<-100?"good":r<-90?"fair":r<-80?"congested":"critical";var r;const c=null==n?void 0:n.noiseFloor.trend,d=e.useMemo(()=>!a||a.length<2?[]:a.map((e,t)=>({timestamp:Date.now()-36e5*(a.length-1-t),count:-e})),[a]),m=null!==s?Math.round(s):"—";return t.jsx(dt,{title:"Noise Floor",icon:t.jsx(qe,{className:"mini-widget-icon"}),value:m,unit:null!==s?"dBm":void 0,status:o,trend:c,subtitle:Ct(s),isLoading:l,error:i,children:t.jsx("div",{className:"mini-widget-sparkline w-full",children:t.jsx(Me,{data:d,width:9999,height:24,color:"var(--sys-blue)",isLoading:l,className:"w-full"})})})}function _t(){const s=Ce(),a=S(),n=b(),l=v(),i=L(),o=60*B[i].minutes,r=F(),c=e.useMemo(()=>{if(0===r)return n;const e=r-o;return n.filter(t=>t.timestamp>=e)},[n,o,r]),d=null===l,m=(null==l?void 0:l.local_hash)?R(l.local_hash):"",u=(null==l?void 0:l.neighbors)??{},{neighborHashes:h,neighborNames:x}=e.useMemo(()=>{const e=new Set,t=new Map;for(const s of a){e.add(s.hash);const a=u[s.hash],n=(null==a?void 0:a.name)||(null==a?void 0:a.node_name)||s.prefix;t.set(s.hash,n)}return{neighborHashes:e,neighborNames:t}},[a,u]),p=e.useMemo(()=>{if(0===h.size||0===c.length||!m)return{champion:null,listener:null,loudest:null};const{scores:e}=Se(c,h,m),t=[];for(const[l,i]of e)0!==i.blendedScore&&t.push({...i,name:x.get(l)??R(l)});let s=null,a=null,n=null;for(const l of t)(!s||l.blendedScore>s.blendedScore)&&(s=l),(!a||l.listenerScore>a.listenerScore)&&(a=l),(!n||l.loudScore>n.loudScore)&&(n=l);return{champion:s,listener:a,loudest:n}},[c,h,m,x]),{champion:f,listener:g,loudest:j}=p,y=f||g||j?t.jsxs("div",{className:"flex flex-col gap-0 sm:gap-0.5 mt-auto",children:[f&&t.jsx(D,{content:(N=f,t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["🏆 Champion: ",N.name]}),t.jsxs("div",{className:"text-fg-muted mb-1",children:["Blended Score: ",N.blendedScore,t.jsx("span",{className:"text-fg-muted/60 ml-1",children:"(Listener + Loud)"})]}),t.jsxs("div",{className:"border-t border-edge-subtle pt-1 mt-1 space-y-0.5",children:[t.jsxs("div",{children:["Listener: ",N.listenerScore,"/100 (",N.listenerCount," shared paths)"]}),t.jsxs("div",{children:["Loud: ",N.loudScore,"/100 (",N.loudCount," packets relayed)"]})]})]})),children:t.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx(ge,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 text-map-neighbor-color flex-shrink-0"}),t.jsx("span",{className:"font-semibold text-map-neighbor-color font-mono truncate flex-1 min-w-0",children:f.name}),t.jsx("span",{className:"text-map-neighbor-color pl-1 sm:pl-2 tabular-nums flex-shrink-0 w-7 sm:w-9 text-right",children:f.blendedScore})]})}),g&&t.jsx(D,{content:(e=>t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["👂 Best Listener: ",e.name]}),t.jsxs("div",{className:"text-fg-muted mb-1",children:["Score: ",e.listenerScore,"/100"]}),t.jsx("div",{className:"border-t border-edge-subtle pt-1 mt-1",children:t.jsxs("div",{children:[e.listenerCount," packets where they heard your transmissions"]})})]}))(g),children:t.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx(Oe,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 text-fg-muted flex-shrink-0"}),t.jsx("span",{className:"text-fg-muted font-mono truncate flex-1 min-w-0",children:g.name}),t.jsx("span",{className:"text-fg-muted pl-1 sm:pl-2 tabular-nums flex-shrink-0 w-7 sm:w-9 text-right",children:g.listenerScore})]})}),j&&t.jsx(D,{content:(e=>t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["📢 Loudest: ",e.name]}),t.jsxs("div",{className:"text-fg-muted mb-1",children:["Score: ",e.loudScore,"/100"]}),t.jsx("div",{className:"border-t border-edge-subtle pt-1 mt-1",children:t.jsxs("div",{children:[e.loudCount," packets they relayed directly to you"]})})]}))(j),children:t.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx(We,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 text-fg-muted flex-shrink-0"}),t.jsx("span",{className:"text-fg-muted font-mono truncate flex-1 min-w-0",children:j.name}),t.jsx("span",{className:"text-fg-muted pl-1 sm:pl-2 tabular-nums flex-shrink-0 w-7 sm:w-9 text-right",children:j.loudScore})]})})]}):0===a.length?t.jsx("div",{className:"flex items-center justify-center text-xs sm:text-sm text-fg-muted mt-auto",children:"No direct neighbors"}):t.jsx("div",{className:"flex items-center justify-center text-xs sm:text-sm text-fg-muted mt-auto",children:"No routing data yet"});var N;return t.jsx(dt,{title:"Link Leaders",icon:t.jsx(Ve,{className:"mini-widget-icon"}),isLoading:d,onClick:()=>s("/contacts"),children:y})}function Lt(){const{lbtStats:s,isLoading:a,error:n}=vt(),l=s?function(e){const{retryRate:t,channelBusyCount:s,totalPacketsWithLBT:a,avgBackoffMs:n,maxBackoffMs:l}=e;if(0===a)return 0;const i=Math.min(a/10,1),o=Math.log(1+.15*t)/Math.log(16)*40,r=s/a*100,c=Math.min(.5*r,25);let d=0;n>100&&(d=Math.min(8*Math.log10(n/100),15));let m=0;l>500&&n>0&&l>2*n&&(m=Math.min((l-500)/200,5));const u=(o+c+d+m)*i;return Math.min(u,85)}(s):0,i=s?(o=l)<15?"excellent":o<30?"good":o<45?"fair":o<60?"congested":"critical":"unknown";var o;const r=(null==s?void 0:s.maxBackoffMs)??0,c=s?r>200?`Max backoff: ${Math.round(r)}ms`:function(e){return e<15?"Clear channel":e<30?"Light traffic":e<45?"Moderate traffic":e<60?"Heavy traffic":e<75?"Congested":"Severe congestion"}(l):void 0,d=null==s?void 0:s.sparklineCollisionRisk,m=e.useMemo(()=>!d||d.length<2?[]:d.map((e,t)=>({timestamp:Date.now()-36e5*(d.length-1-t),count:e})),[d]),u=Math.round(10*l)/10;return t.jsx(dt,{title:"Collision Risk",icon:t.jsx(Ne,{className:"mini-widget-icon"}),value:u,unit:"%",status:i,subtitle:c,isLoading:a,error:n,children:t.jsx("div",{className:"mini-widget-sparkline w-full",children:t.jsx(Me,{data:m,width:9999,height:24,color:"var(--sys-blue)",isLoading:a,className:"w-full"})})})}function Bt(){const[s,a]=e.useState(!1),[n]=e.useState(0),{stats:l,lbtStats:i,isLoading:o}=vt(),r=e.useMemo(()=>{if(!l)return null;const e=l.airtime_used_ms??0,t=l.max_airtime_ms??1;return{usedMs:e,maxMs:t,remainingMs:l.airtime_remaining_ms??0,utilizationPercent:l.utilization_percent??(t>0?e/t*100:0)}},[l]),c=e.useMemo(()=>i&&0!==i.totalPacketsWithLBT?(i.totalPacketsWithLBT-i.packetsWithRetries)/i.totalPacketsWithLBT*100:100,[i]),d=(null==r?void 0:r.utilizationPercent)??0,m=(u=d)<30?"excellent":u<50?"good":u<70?"fair":u<90?"congested":"critical";var u;const h=(null==r?void 0:r.remainingMs)??0,x=c<95?`${c.toFixed(0)}% clean TX`:((p=h)<1e3?`${Math.round(p)}ms`:p<6e4?`${(p/1e3).toFixed(1)}s`:`${(p/6e4).toFixed(1)}m`)+" remaining";var p;const f=r?t.jsx("div",{className:"mini-widget-progress mt-auto",children:t.jsx("div",{className:`mini-widget-progress-bar ${m}`,style:{width:`${Math.min(d,100)}%`}})}):null;return t.jsx(dt,{title:"Duty Cycle",icon:t.jsx(C,{className:"mini-widget-icon"}),value:d.toFixed(1),unit:"%",status:m,subtitle:x,isLoading:o,children:f})}function Tt(){return t.jsxs("div",{className:"mini-widget",children:[t.jsxs("div",{className:"mini-widget-header",children:[t.jsx(Y,{className:"w-4 h-4"}),t.jsx(Y,{className:"h-3 w-16"})]}),t.jsx(Y,{className:"h-7 w-12 mt-2"}),t.jsx(Y,{className:"h-3 w-20 mt-2"})]})}function Ft(){return t.jsx("div",{className:"widget-row",children:Array.from({length:6}).map((e,s)=>t.jsx(Tt,{},s))})}function Rt({className:e="",isLoaded:s=!0}){return t.jsxs("div",{className:`mesh-health-container relative ${e}`,children:[t.jsxs("div",{className:"mesh-health-header",children:[t.jsx(Ue,{className:"w-4 h-4 text-sys-blue"}),t.jsx("span",{className:"type-label text-fg-muted",children:"MESH HEALTH"})]}),s?t.jsx(yt,{children:t.jsxs("div",{className:"widget-row",children:[t.jsx(kt,{}),t.jsx(Lt,{}),t.jsx(St,{}),t.jsx(Bt,{}),t.jsx(Mt,{}),t.jsx(_t,{})]})}):t.jsx(Ft,{})]})}let Dt="",Ht="",$t="";function At(e){!function(){const e=new Date,t=e.toDateString();if(t!==$t){$t=t,Dt=t;const s=new Date(e);s.setDate(s.getDate()-1),Ht=s.toDateString()}}();const t=new Date(1e3*e).toDateString();return t===Dt?"Today":t===Ht?"Yesterday":new Date(1e3*e).toLocaleDateString([],{weekday:"short",month:"short",day:"numeric"})}function Pt(e,t,s){return`${e||""}|${t}|${s}`}const zt=e.memo(function({message:e,onChannelClick:s,isChannelSelected:a}){const n=e.channelName||e.channelHash.slice(0,6);return t.jsx("div",{style:{transform:"translateZ(0)",willChange:"transform"},children:t.jsx(De,{senderName:e.senderName||"Unknown",text:e.text,timestamp:e.timestamp,nameAccessory:t.jsx(be,{channelName:n,active:a,onClick:()=>null==s?void 0:s(e.channelHash)})})})},function(e,t){const s=e.message,a=t.message;return s.timestamp===a.timestamp&&s.text===a.text&&s.senderName===a.senderName&&s.channelHash===a.channelHash&&s.channelName===a.channelName&&e.isChannelSelected===t.isChannelSelected&&e.onChannelClick===t.onChannelClick});function It({open:a,onClose:n,messages:l,onLoadMore:i,hasMoreToLoad:o,isDecoding:r,initialChannel:c}){const d=e.useRef(null),m=e.useRef(!0),u=L(),h=E(),x=e.useRef(!1);e.useEffect(()=>{a?(x.current=!0,q.resume()):x.current&&q.pause()},[a]);const p=e.useMemo(()=>{const e=Date.now()/1e3-60*B[u].minutes;return[...l].filter(t=>t.timestamp>=e).sort((e,t)=>e.timestamp-t.timestamp)},[l,u]),f=e.useCallback(()=>{const e=d.current;e&&(m.current=e.scrollTop>=-50)},[]),b=e.useMemo(()=>{const e=new Map;for(const t of p){const s=t.channelHash,a=e.get(s);a?a.count++:e.set(s,{name:t.channelName||t.channelHash.slice(0,6),hash:t.channelHash,count:1})}return Array.from(e.values()).sort((e,t)=>t.count-e.count)},[p]),j=b.length,[y,v]=e.useState(null),[N,k]=e.useState(!1);e.useEffect(()=>{a&&c&&v(c)},[a,c]);const w=e.useCallback(()=>{i(y,b)},[i,y,b]),M=e.useMemo(()=>y?p.filter(e=>e.channelHash===y):p,[p,y]),C=e.useMemo(()=>{const e=[];let t="";for(const s of M){const a=At(s.timestamp);a!==t&&(e.push({type:"date",date:a}),t=a),e.push({type:"message",message:s})}return e},[M]);e.useLayoutEffect(()=>{const e=d.current;e&&m.current&&(e.scrollTop=0)},[M.length]);const S=b.slice(0,19),_=b.slice(19),T=_.length>0;return t.jsx(O,{open:a,onClose:n,size:"lg",motionPlus:!0,solid:!0,children:t.jsxs(W,{className:"p-0 flex flex-col h-[80vh] max-h-[700px] rounded-2xl",children:[t.jsx("div",{className:"flex-shrink-0 px-4 sm:px-5 py-3 sm:py-4",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Re,{className:"size-5 text-icon-card-title flex-shrink-0"}),t.jsx("h2",{className:"type-micro",children:"Public Channels"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(oe,{ranges:B,selectedIndex:u,onSelect:h,size:"micro"}),t.jsx("button",{onClick:n,className:"sm:hidden min-h-[44px] min-w-[44px] px-3 flex items-center justify-center text-[15px] font-medium text-sys-blue active:text-sys-blue/70 transition-base radius-inner active:bg-subtle-fill",children:"Done"}),t.jsx("button",{onClick:n,className:"hidden sm:flex items-center justify-center p-2 text-fg-muted hover:text-fg-primary transition-base radius-inner hover:bg-subtle","aria-label":"Close",children:t.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}),t.jsx("div",{className:"flex-shrink-0 px-3 pb-2 relative z-10 isolate",style:{minHeight:j>0?void 0:0},children:j>0&&t.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.jsx("button",{onClick:()=>v(null),className:s("px-2 py-0.5 rounded text-xs font-medium transition-all","ring-1 ring-inset",null===y?"bg-sys-blue/20 text-sys-blue ring-sys-blue/30":"bg-subtle-fill text-fg-secondary ring-edge-subtle hover:bg-subtle-fill-strong"),children:"All"}),S.map(e=>t.jsx("button",{onClick:()=>v(e.hash),className:s("flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium transition-all","ring-1 ring-inset",y===e.hash?"bg-sys-blue/20 text-sys-blue ring-sys-blue/30":"bg-subtle-fill text-fg-secondary ring-edge-subtle hover:bg-subtle-fill-strong"),children:t.jsx("span",{className:"truncate max-w-[80px]",children:e.name})},e.hash)),T&&t.jsxs("div",{className:"relative",children:[t.jsxs("button",{onClick:()=>k(!N),className:s("flex items-center gap-0.5 px-2 py-0.5 rounded text-xs font-medium transition-all","ring-1 ring-inset",N||_.some(e=>e.hash===y)?"bg-sys-blue/20 text-sys-blue ring-sys-blue/30":"bg-subtle-fill text-fg-secondary ring-edge-subtle hover:bg-subtle-fill-strong"),children:["+",_.length,t.jsx(G,{className:s("size-3 transition-transform",N&&"rotate-180")})]}),N&&t.jsx("div",{className:s("absolute top-full left-0 mt-1 z-50","min-w-[140px] max-h-[200px] overflow-y-auto","p-1 rounded-lg","bg-elevated backdrop-blur-xl","ring-1 ring-edge-subtle shadow-xl"),children:_.map(e=>t.jsxs("button",{onClick:()=>{v(e.hash),k(!1)},className:s("w-full flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-all text-left",y===e.hash?"bg-sys-blue/20 text-sys-blue":"text-fg-secondary hover:bg-subtle-fill-strong"),children:[t.jsx($e,{className:"size-2.5 opacity-60 flex-shrink-0"}),t.jsx("span",{className:"truncate",children:e.name}),t.jsxs("span",{className:"opacity-60 ml-auto",children:["(",e.count,")"]})]},e.hash))})]})]})}),t.jsx("div",{ref:d,onScroll:f,className:s("flex-1 overflow-y-auto overflow-x-hidden","mx-3 mb-3 rounded-md","bg-body","ring-1 ring-inset ring-edge-subtle","flex flex-col-reverse"),children:r&&0===M.length?t.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[300px] text-fg-muted px-4 py-4",children:[t.jsx(g,{className:"size-12 mb-4 text-sys-indigo animate-spin"}),t.jsx("p",{className:"text-lg font-medium",children:"Loading messages..."})]}):0===M.length?t.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[300px] text-fg-muted px-4 py-4",children:[t.jsx(Ae,{className:"size-16 mb-4 opacity-20"}),t.jsx("p",{className:"text-lg font-medium",children:"No messages yet"}),t.jsx("p",{className:"text-sm mt-1 opacity-70",children:y?"No messages in this channel":"Public channel messages will appear here"})]}):t.jsxs("div",{className:"px-4 py-4",children:[o&&t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("button",{onClick:w,disabled:r,className:s("px-4 py-1.5 rounded-full","text-[11px] font-medium","ring-1 ring-inset",r?"bg-subtle-fill text-fg-muted ring-edge-subtle cursor-wait":"bg-sys-blue/10 text-sys-blue ring-sys-blue/20 hover:bg-sys-blue/20 hover:ring-sys-blue/30"),children:r?t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx(g,{className:"size-3 animate-spin"}),"Loading..."]}):"Load older messages"})}),C.map((e,a)=>{if("date"===e.type)return t.jsx("div",{className:"flex justify-center my-4",children:t.jsx("span",{className:s("px-3.5 py-1.5 rounded-full","bg-subtle-fill backdrop-blur-sm","text-[11px] text-fg-muted/80 font-medium","ring-1 ring-edge-subtle"),children:e.date})},`date-${e.date}-${a}`);const n=`msg-${e.message.timestamp}-${e.message.senderName||"anon"}-${e.message.channelHash}`;return t.jsx("div",{className:"mb-3",children:t.jsx(zt,{message:e.message,onChannelClick:v,isChannelSelected:y===e.message.channelHash})},n)})]})}),t.jsx("div",{className:"flex-shrink-0 px-5 py-2 text-center",children:t.jsxs("p",{className:"text-[11px] text-fg-muted",children:[M.length," messages · ",j," ",1===j?"channel":"channels",r&&t.jsxs("span",{className:"ml-2 text-sys-indigo",children:[t.jsx(g,{className:"inline size-3 animate-spin mr-1"}),"Decrypting..."]})]})})]})})}function Et({isLoaded:a=!0}){const n=b(),[o,r]=e.useState(!1),[c,d]=e.useState(null),m=L(),u=e.useCallback(()=>{d(null),r(!0),H.getState().queueDecryption(n)},[n]),h=pe(e=>e.requestedHash),x=pe(e=>e.clearRequest);e.useEffect(()=>{h&&(d(h),r(!0),H.getState().queueDecryption(n),x())},[h,x,n]);const p=N(),f=$(),g=A(),j=e.useMemo(()=>function(e){const t=[],s=new Set;for(const a of e.values()){const e=a.decoded;if(!e||!e.decrypted||e.macCorrupted||!e.text)continue;const n=Pt(e.senderName,e.channelHash,e.text);s.has(n)||(s.add(n),t.push({timestamp:a.timestamp,channelName:e.channelName,channelHash:e.channelHash,senderName:e.senderName,text:e.text,rssi:a.rssi,snr:a.snr}))}return t}(p),[p]),y=e.useMemo(()=>{const e=Date.now()/1e3-60*B[m].minutes;return j.filter(t=>t.timestamp>=e)},[j,m]),v=e.useMemo(()=>0===y.length?null:y.reduce((e,t)=>t.timestamp>e.timestamp?t:e),[y]),k=f.isDecoding,w=e.useMemo(()=>{const e=Date.now()/1e3-60*B[m].minutes,t=new Set;let s=0;for(const a of n)(a.type??a.payload_type)===P.GRP_TXT&&((a.timestamp??0){const e=Date.now()/1e3-60*B[m].minutes;for(const t of n)if((t.type??t.payload_type)===P.GRP_TXT&&!((t.timestamp??0){if(!k){if(e){const s=t.find(t=>t.hash===e);if(s)return void H.getState().queueChannelDecryption(n,s.name)}H.getState().queueDecryption(n)}},[n,k]);return a?t.jsxs(t.Fragment,{children:[t.jsx("div",{onClick:u,className:s("group cursor-pointer rounded-2xl transition-all duration-150","bg-surface/80 backdrop-blur-lg neomorphic-outer","hover:bg-subtle-fill","px-3 py-2.5 sm:px-4 sm:py-3"),children:t.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 flex-shrink-0",children:[t.jsx(Re,{className:"size-4 text-icon-card-title flex-shrink-0"}),t.jsx("span",{className:"type-micro",children:"CHAT ACTIVITY"}),w>0&&t.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-subtle-fill ring-1 ring-inset ring-edge-subtle text-sm tabular-nums text-fg-secondary",children:w}),t.jsx(He,{className:"size-4 text-fg-muted group-hover:text-sys-indigo transition-colors ml-auto sm:hidden"})]}),t.jsxs("div",{className:"flex items-center gap-2 sm:gap-1.5 min-w-0 overflow-hidden",children:[t.jsx(l,{mode:"wait",initial:!1,children:v?t.jsxs(i.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-16},transition:{duration:.2,ease:[.4,0,.2,1]},className:"flex items-center gap-2 sm:gap-1.5 min-w-0",children:[v.channelName&&t.jsx("span",{className:"hidden sm:inline-flex",children:t.jsx(be,{channelName:v.channelName})}),t.jsx("div",{className:"hidden sm:flex w-[30px] h-[30px] rounded-full items-center justify-center flex-shrink-0 ring-1 ring-edge-subtle",style:{backgroundColor:Le(Be(v.senderName||"").cleanName)},children:Be(v.senderName||"").emoji?t.jsx("span",{className:"text-base",children:Be(v.senderName||"").emoji}):t.jsx("span",{className:"text-white text-xs font-bold tracking-tighter",children:Te(v.senderName||"")})}),t.jsx("div",{className:"inline-flex items-center px-3 py-1.5 rounded-2xl rounded-tr-md bg-[#007AFF] shadow-sm min-w-0 flex-1 sm:flex-initial sm:max-w-xs sm:-ml-px",children:t.jsx("span",{className:"text-sm text-white truncate tracking-wide",children:Fe(v.text)})}),t.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-subtle-fill ring-1 ring-inset ring-edge-subtle text-sm tabular-nums text-fg-secondary flex-shrink-0",children:I(v.timestamp)})]},`msg-${v.timestamp}-${v.senderName}-${v.channelHash}`):g?t.jsx(i.span,{initial:{opacity:0},animate:{opacity:1},className:"text-sm text-fg-muted italic",children:"No messages yet"},"empty"):t.jsxs(i.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,y:-16},transition:{duration:.15},className:"flex items-center gap-2 sm:gap-1.5",children:[t.jsx("div",{className:"hidden sm:block w-8 h-4 rounded bg-subtle-fill-strong animate-pulse"}),t.jsx("div",{className:"hidden sm:block w-[30px] h-[30px] rounded-full bg-subtle-fill-strong animate-pulse"}),t.jsx("div",{className:"h-8 w-32 sm:w-48 rounded-2xl bg-subtle-fill-strong animate-pulse"}),t.jsx("div",{className:"w-12 h-6 rounded-md bg-subtle-fill-strong animate-pulse"})]},"skeleton")}),t.jsx(He,{className:"size-4 text-fg-muted group-hover:text-sys-indigo transition-colors flex-shrink-0 hidden sm:block ml-1"})]})]})}),t.jsx(It,{open:o,onClose:()=>r(!1),messages:j,onLoadMore:S,hasMoreToLoad:C,isDecoding:k,initialChannel:c})]}):t.jsx("div",{className:"h-14 rounded-xl bg-elevated/50 animate-pulse"})}function qt(){var s,a;const n=v(),l=V(),i=b(),o=U(),r=e.useRef(!1);o&&!r.current&&(r.current=!0);const c=r.current,d=L(),m=E(),u=J(),x=B[d]??B[4],p=u.isBackgroundLoading&&d>=5,f=null==(s=null==n?void 0:n.config)?void 0:s.radio,g=e.useMemo(()=>f?{sf:f.spreading_factor??10,bw:f.bandwidth??25e4,cr:f.coding_rate??5,preamble:f.preamble_length??8}:null,[f]),j=i.length,y=e.useMemo(()=>j?K(x.minutes,x.buckets,i,n):null,[j,x.minutes,x.buckets,g]),N=e.useMemo(()=>{const e=e=>(null==e?void 0:e.reduce((e,t)=>e+t.count,0))??0,t=e(null==y?void 0:y.received),s=e(null==y?void 0:y.unique_received),a=e(null==y?void 0:y.forwarded),n=e(null==y?void 0:y.dropped),l=e(null==y?void 0:y.transmitted),i=((null==y?void 0:y.time_range_minutes)??x.minutes)/60;return{received:t,uniqueReceived:s,forwarded:a,dropped:n,transmitted:l,rxPerHour:i>0?Math.round(t/i):0,fwdPerHour:i>0?Math.round(a/i):0}},[y,x.minutes]),k=e.useMemo(()=>{if(!i.length)return{totalBytes:0,kbPerHour:0};const e=Date.now()/1e3,t=e-60*x.minutes;let s=0;for(const n of i)n.transmitted||n.timestampe||(s+=n.length??n.payload_length??0);const a=x.minutes/60;return{totalBytes:s,kbPerHour:a>0?Math.round(s/1024/a):0}},[i,x.minutes]),w=(null==n?void 0:n.node_name)??(null==(a=null==n?void 0:n.config)?void 0:a.node_name)??"Unknown Node";return e.useEffect(()=>{w&&"Unknown Node"!==w&&(document.title=`pyMC: ${w}`)},[w]),l?t.jsxs(Z,{neomorphic:!0,className:"p-8 text-center",children:[t.jsx("p",{className:"type-subheading text-sys-red mb-2",children:"Failed to connect to backend"}),t.jsx("p",{className:"type-body text-fg-muted",children:l}),t.jsx("p",{className:"type-data-sm text-fg-muted mt-4",children:"Make sure the backend is running on port 8000"})]}):t.jsxs(ee,{children:[t.jsx(te,{title:w,icon:t.jsx(Pe,{}),controls:t.jsx(oe,{ranges:B,selectedIndex:d,onSelect:m,isPending:p})}),t.jsxs(se,{children:[t.jsx(Et,{isLoaded:c}),t.jsx(ze,{template:"hero-auto",children:t.jsxs(Z,{neomorphic:!0,compact:!0,children:[t.jsx(ye,{icon:t.jsx(X,{}),title:"PACKETS RECEIVED",badge:x.label,badgeColor:"zinc",actions:c?t.jsxs("div",{className:"data-box",children:[k.kbPerHour," KB/hr"]}):t.jsx("div",{className:"data-box opacity-0",children:"0 KB/hr"})}),t.jsxs("div",{className:"flex flex-wrap gap-4 sm:gap-8",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx("div",{className:"type-data-xl text-fg-primary",children:c?t.jsx(le,{value:N.received,className:"font-mono tabular-nums",priority:"high"}):t.jsx("span",{className:"opacity-30",children:"—"})}),t.jsx(h,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"Total Rx"})]}),t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx("div",{className:"type-data-xl text-fg-primary",children:c?t.jsx(le,{value:N.uniqueReceived,className:"font-mono tabular-nums",priority:"high"}):t.jsx("span",{className:"opacity-30",children:"—"})}),t.jsx(h,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"Unique"})]})]}),t.jsxs("div",{className:"mt-2 flex-1 min-h-0 relative",children:[t.jsx("div",{className:"absolute inset-0 flex items-end gap-1 transition-opacity duration-300 "+(c?"opacity-0 pointer-events-none":"opacity-100"),"aria-hidden":c,children:[45,72,33,58,80,42,65,28,55,75,38,62].map((e,s)=>t.jsx("div",{className:"flex-1 bg-subtle-fill rounded-sm animate-pulse",style:{height:`${e}%`}},s))}),t.jsx("div",{className:"h-full transition-opacity duration-300 "+(c?"opacity-100":"opacity-0"),children:t.jsx(Xe,{packets:i,rangeMinutes:x.minutes,bucketCount:x.buckets})})]})]})}),t.jsxs(ze,{template:"compact",children:[t.jsx(Ie,{span:6,lg:4,children:t.jsx(Ye,{value:N.forwarded,receivedCount:N.received,packets:i,rangeMinutes:x.minutes,bucketCount:x.buckets,timeRangeLabel:x.label,icon:t.jsx(Ee,{className:"w-4 h-4"}),isLoaded:c})}),t.jsx(Ie,{span:6,lg:4,children:t.jsx(Ze,{value:N.dropped,receivedCount:N.received,packets:i,rangeMinutes:x.minutes,bucketCount:x.buckets,timeRangeLabel:x.label,icon:t.jsx(ke,{className:"w-4 h-4"}),isLoaded:c})}),t.jsx(Ie,{span:12,lg:4,children:t.jsx(nt,{stats:n,localHash:null==n?void 0:n.local_hash,receivedBuckets:null==y?void 0:y.received,droppedBuckets:null==y?void 0:y.dropped,forwardedBuckets:null==y?void 0:y.forwarded,bucketDurationSeconds:null==y?void 0:y.bucket_duration_seconds,timeRangeLabel:x.label,isLoaded:c})})]}),t.jsx(Rt,{isLoaded:c}),t.jsx(lt,{}),n&&t.jsx(ze,{template:"auto",children:t.jsx(_e,{nodeName:w,repeaterVersion:n.version,coreVersion:n.core_version,localHash:n.local_hash,publicKey:n.public_key})})]})]})}export{qt as default}; +import{r as e,j as t,c as s}from"./vendor-react-j_fHog8x.js";import{c as a,u as n,A as l,m as i,U as o,S as r,d as c,e as d,f as m,h as u,j as h,k as x,n as p,o as f,L as g,p as b,q as j,r as y,t as v,v as N,T as k,w,B as M,R as C,x as S,y as _,z as L,D as B,E as T,F,G as R,H as D,J as H,K as $,M as A,P,N as z,O as I,Q as E,V as q,W as O,X as W,Y as G,_ as V,$ as U,a0 as J,a1 as K,a2 as X}from"./index-BBcIGlRT.js";import{C as Q,S as Y,a as Z,P as ee,b as te,B as se}from"./PageLayout-CYYy29Pg.js";import{S as ae,M as ne}from"./sun-GNUT-ucn.js";import{A as le,E as ie,T as oe}from"./TimeRangeSelector-P4ymVxf5.js";import{c as re}from"./node-types-CuQMppbD.js";import{b as ce,c as de,a as me,d as ue,F as he}from"./meshcore-tx-constants-BDLT5LMb.js";import{S as xe,u as pe,P as fe,T as ge,C as be}from"./PacketList-Bo8AKcoq.js";import{C as je}from"./copy-C_IB0gEd.js";import{C as ye}from"./Card-QO4sXDu0.js";import{A as ve,Z as Ne,C as ke}from"./SignalIndicator-BnBRvoqf.js";import{s as we}from"./signal-scoring-CcBiRcks.js";import{L as Me}from"./LightSparkline-BCL2qx0n.js";import{a as Ce}from"./vendor-core-CmkNwW1A.js";import{c as Se}from"./link-scoring-BHmEi4Ug.js";import{N as _e}from"./NodeInformationCard-DQTRuz7_.js";import{g as Le,e as Be,a as Te,f as Fe}from"./chat-utils-I8bC4Iy5.js";import{M as Re,C as De}from"./ChatBubble-DX1ocHRQ.js";import{C as He}from"./chevron-right-B6r5SVTI.js";import{H as $e}from"./route-lCtw8lWd.js";import{M as Ae}from"./message-square-Dq5-N0aR.js";import{H as Pe}from"./DelayedAnimateNumber-CRcNKpk-.js";import{R as ze,C as Ie}from"./Grid-OFJ4oe0a.js";import"./maplibre-gl-b91ci4Kr.js";import"./index-CCvUM2Hn.js";import"./payload-decoders-C74LtYDG.js";import"./badge-colors-YAE4qQ7m.js";import"./arrow-up-B5IQoVJ5.js";import"./map-pin-FZNiPp_L.js";import"./triangle-alert-DH80WgOo.js";import"./DataBox-B8dpvpbW.js";import"./layers-BSSTaBST.js";import"./activity-_XXDiQ1M.js";import"./circle-check-DI0_62yI.js";import"./database-CO202xKy.js";const Ee=a("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]),qe=a("audio-waveform",[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]]),Oe=a("ear",[["path",{d:"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0",key:"1dfaln"}],["path",{d:"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4",key:"1qnva7"}]]),We=a("megaphone",[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]),Ge=a("pill-bottle",[["path",{d:"M18 11h-4a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h4",key:"17ldeb"}],["path",{d:"M6 7v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7",key:"nc37y6"}],["rect",{width:"16",height:"5",x:"4",y:"2",rx:"1",key:"3jeezo"}]]),Ve=a("satellite-dish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]),Ue=a("square-activity",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M17 12h-2l-2 5-2-10-2 5H7",key:"15hlnc"}]]),Je=a("tablets",[["circle",{cx:"7",cy:"7",r:"5",key:"x29byf"}],["circle",{cx:"17",cy:"17",r:"5",key:"1op1d2"}],["path",{d:"M12 17h10",key:"ls21zv"}],["path",{d:"m3.46 10.54 7.08-7.08",key:"1rehiu"}]]),Ke=a("timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);function Xe({packets:s,rangeMinutes:a,bucketCount:c}){const d=n(),[m,u]=e.useState(null),[h,x]=e.useState(null),[p,f]=e.useState(null),{buckets:g,activeTypes:b,totalByType:j}=e.useMemo(()=>function(e,t,s){const a=Date.now()/1e3,n=60*t,l=a-n,i=n/s,o=[];for(let c=0;ca)continue;const t=Math.min(s-1,Math.floor((e-l)/i)),n=c.type??c.payload_type??0,d=c.length??c.payload_length??0,m=o[t];m.bytesByType[n]=(m.bytesByType[n]??0)+d,m.totalBytes+=d,r[n]=(r[n]??0)+d}return{buckets:o,activeTypes:Object.keys(r).map(e=>parseInt(e,10)).filter(e=>r[e]>0).sort((e,t)=>r[t]-r[e]),totalByType:r}}(s,a,c),[s,a,c]),y=e.useCallback((e,t,s)=>{u(t),x(s)},[]),v=g.length>0&&b.length>0,N=m?function(e){const t=new Date(1e3*e).getHours();return t>=6&&t<18}(m.start):null,k=m?(w=m.start,new Date(1e3*w).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})):"";var w;const M=null!==p&&null!==N&&p!==N;return N!==p&&f(N),t.jsxs("div",{className:"flex flex-col h-full relative",children:[t.jsx("div",{className:"h-5 relative mb-1 shrink-0",children:m&&null!==h&&t.jsxs("div",{className:"absolute flex items-center gap-1.5 type-data-sm -translate-x-1/2",style:{left:`calc(48px + ${100*h}% * (1 - 48px / 100%))`},children:[t.jsx(l,{mode:"wait",children:t.jsx(i.span,{initial:!!M&&{opacity:0,scale:.5,rotate:-90},animate:{opacity:1,scale:1,rotate:0},exit:{opacity:0,scale:.5,rotate:90},transition:{duration:.25,ease:"easeOut"},children:N?t.jsx(ae,{className:"w-4 h-4 text-sys-amber"}):t.jsx(ne,{className:"w-4 h-4 text-sys-blue"})},N?"sun":"moon")}),t.jsx("span",{className:"text-fg-secondary",children:k})]})}),t.jsx("div",{className:"flex-1 min-h-0",children:v&&t.jsx(o,{buckets:g,activeTypes:b,gridColor:d.grid,axisTickColor:d.axisTick,onHover:y})}),t.jsx("div",{className:"pt-2 px-1 pb-2 shrink-0",children:v&&t.jsx(r,{activeTypes:b,totalByType:j})})]})}const Qe=e.memo(function({buckets:s,activeTypes:a}){const n=e.useRef(null),l=e.useRef(s),i=e.useRef(a);l.current=s,i.current=a;const o=e.useMemo(()=>[s.map(e=>e.start),s.map(()=>1)],[s]);return e.useEffect(()=>{if(!n.current||0===s.length)return;const e=n.current,t=e.getBoundingClientRect(),a=Math.floor(t.width)||200,r=Math.floor(t.height)||60,u=new c({width:a,height:r,padding:[0,0,0,0],cursor:{show:!1},scales:{x:{time:!1},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],legend:{show:!1},hooks:{draw:[e=>{const t=e.ctx,{left:s,top:a,width:n,height:o}=e.bbox;!function(e,t,s,a,n,l,i){if(0===t.length)return;const o=function(e,t,s){var a,n;if(e.length<=s)return e;const l=e.length/s,i=[];for(let o=0;o0&&(d.bytesByType[s]=(d.bytesByType[s]??0)+t)}}i.push(d)}return i}(t,s,m.statsCard),r=o.length,c=l/r,u=o.map(e=>e.totalBytes).filter(e=>e>0);if(0===u.length)return;const h=Math.max(...u),x=Math.min(...u),p=h-x;for(let m=0;m{const t=e.getBoundingClientRect();t.width>0&&t.height>0&&u.setSize({width:Math.floor(t.width),height:Math.floor(t.height)})});return h.observe(e),()=>{h.disconnect(),u.destroy()}},[o,s.length]),0===s.length?t.jsx("div",{className:"h-full flex items-center justify-center",children:t.jsx("div",{className:"w-full h-0.5 rounded-full bg-fg-muted/15"})}):t.jsx("div",{ref:n,className:"w-full h-full"})});function Ye({value:s,receivedCount:a,packets:n,rangeMinutes:l,bucketCount:i,timeRangeLabel:o,icon:r,isLoaded:c=!0}){const{buckets:d,activeTypes:m,ratePerHour:x}=e.useMemo(()=>function(e,t,s){const a=Date.now()/1e3,n=60*t,l=a-n,i=n/s,o=[];for(let m=0;ma)continue;const t=Math.min(s-1,Math.floor((e-l)/i)),n=m.type??m.payload_type??0,d=m.length??m.payload_length??0,u=o[t];u.bytesByType[n]=(u.bytesByType[n]??0)+d,u.totalBytes+=d,r[n]=(r[n]??0)+d,c++}const d=t/60;return{buckets:o,activeTypes:Object.keys(r).map(e=>parseInt(e,10)).filter(e=>r[e]>0).sort((e,t)=>r[t]-r[e]),ratePerHour:d>0?Math.round(c/d):0}}(n,l,i),[n,l,i]),p=a>0?(s/a*100).toFixed(1):null;return c?t.jsxs(u,{compact:!0,children:[t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[r&&t.jsx("span",{className:"icon-sm text-icon-card-title",children:r}),t.jsx("span",{className:"type-micro",children:"FORWARDED"}),o&&t.jsx(h,{color:"zinc",className:"hidden sm:inline-flex",children:o})]}),t.jsx("div",{className:"type-data-xl text-fg-primary",children:t.jsx(le,{value:s,className:"font-mono tabular-nums",priority:"high"})}),t.jsx("div",{className:"flex-1 mt-1 overflow-hidden min-h-[40px] sm:min-h-[60px]",children:m.length>0?t.jsx(Qe,{buckets:d,activeTypes:m}):t.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t.jsx("div",{className:"w-full h-0.5 rounded-full bg-fg-muted/15"})})}),t.jsx("div",{className:"pt-1.5 sm:pt-2 mt-1",children:t.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Rate"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[x,"/hr"]})]}),null!==p&&t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Ratio"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[p,"%"]})]})]})})]}):t.jsx(u,{compact:!0,children:t.jsx(Q,{})})}function Ze({value:s,receivedCount:a,packets:n,rangeMinutes:l,bucketCount:i,timeRangeLabel:o,icon:r,isLoaded:c=!0}){const{buckets:d,activeTypes:m,ratePerHour:x}=e.useMemo(()=>function(e,t,s){const a=Date.now()/1e3,n=60*t,l=a-n,i=n/s,o=[];for(let m=0;ma)continue;const t=Math.min(s-1,Math.floor((e-l)/i)),n=m.type??m.payload_type??0,d=m.length??m.payload_length??0,u=o[t];u.bytesByType[n]=(u.bytesByType[n]??0)+d,u.totalBytes+=d,r[n]=(r[n]??0)+d,c++}const d=t/60;return{buckets:o,activeTypes:Object.keys(r).map(e=>parseInt(e,10)).filter(e=>r[e]>0).sort((e,t)=>r[t]-r[e]),ratePerHour:d>0?Math.round(c/d):0}}(n,l,i),[n,l,i]),p=a>0?(s/a*100).toFixed(1):null;return c?t.jsxs(u,{compact:!0,children:[t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[r&&t.jsx("span",{className:"icon-sm text-icon-card-title",children:r}),t.jsx("span",{className:"type-micro",children:"DROPPED"}),o&&t.jsx(h,{color:"zinc",className:"hidden sm:inline-flex",children:o})]}),t.jsx("div",{className:"type-data-xl text-fg-primary",children:t.jsx(le,{value:s,className:"font-mono tabular-nums",priority:"high"})}),t.jsx("div",{className:"flex-1 mt-1 overflow-hidden min-h-[40px] sm:min-h-[60px]",children:m.length>0?t.jsx(Qe,{buckets:d,activeTypes:m}):t.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t.jsx("div",{className:"w-full h-0.5 rounded-full bg-fg-muted/15"})})}),t.jsx("div",{className:"pt-1.5 sm:pt-2 mt-1",children:t.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Rate"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[x,"/hr"]})]}),null!==p&&t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Drop %"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[p,"%"]})]})]})})]}):t.jsx(u,{compact:!0,children:t.jsx(Q,{})})}const et={",":"punc",".":"punc-period",":":"punc-colon","/":"punc-slash"},tt=/([,\.:\/])/g,st=e.memo(function({children:s,className:a="",as:n="span"}){const l=e.useMemo(()=>{let e;return e="number"==typeof s?s.toLocaleString():Array.isArray(s)?s.join(""):String(s??""),tt.test(e)?(tt.lastIndex=0,e.split(tt).map((e,s)=>{const a=et[e];return a?t.jsx("span",{className:a,children:e},s):e})):e},[s]);return t.jsx(n,{className:`data-tight ${a}`.trim(),children:l})});function at(e,t,s){return me(Math.max(t,Math.min(s,e)))}function nt({stats:s,receivedBuckets:a,droppedBuckets:n,forwardedBuckets:l,bucketDurationSeconds:i,timeRangeLabel:o,isLoaded:r=!0}){var c,d,m,b;const[j,y]=e.useState(!1),[v,N]=e.useState("idle"),k=x();if(!r)return t.jsx(u,{compact:!0,children:t.jsx(Q,{})});const w=Math.floor(Date.now()/1e3)-604800,M=Object.values((null==s?void 0:s.neighbors)??{}).filter(e=>e.zero_hop&&e.last_seen>=w&&re(e).isRepeater).length,C=k.filter(e=>"active"===e.status||e.lastSeen>=w).length,S=Math.max(M,C),_=function(e,t,s){const a=e=>(null==e?void 0:e.reduce((e,t)=>e+t.count,0))??0,n=a(t),l=a(s),i=n||(null==e?void 0:e.rx_count)||1,o=l||(null==e?void 0:e.dropped_count)||0;return i>0?o/(i+o)*100:0}(s,a,n),L=function(e,t,s){if((null==t?void 0:t.length)&&s){const e=100;return((null==(a=t)?void 0:a.reduce((e,t)=>e+t.count,0))??0)*e/(t.length*s*1e3)*100}var a;if(e){const t=1e3*(e.uptime_seconds||1);return(e.total_airtime_ms||e.airtime_used_ms||0)/t*100}return 0}(s,l,i),B=(null==(d=null==(c=null==s?void 0:s.config)?void 0:c.delays)?void 0:d.tx_delay_factor)??null,T=(null==(b=null==(m=null==s?void 0:s.config)?void 0:m.delays)?void 0:b.direct_tx_delay_factor)??null,F=function(e,t,s,a){let n=ce(e);t>20?n+=2*he:t>12&&(n+=he),s>8&&(n+=he);const l=at(n,0,2);let i=ue(e);s>8&&(i+=he);const o=at(i,0,1),r=de(l),c=de(o),d=null!==a?de(a):null;let m="stable";return null!==d&&(r>d?m="increase":r20?H.push(`High duplicate rate (${_.toFixed(1)}%) suggests frequent collisions — window widened.`):_>12&&H.push(`Elevated duplicate rate (${_.toFixed(1)}%) — window widened one step.`),L>8&&H.push(`Channel is busy (${L.toFixed(1)}% TX util) — extra spacing added.`));const $=[`Direct uses one forwarder — ×${F.directFactor.toFixed(1)} backoff for channel contention.`];L>8&&$.push("Busy channel — small extra backoff.");const A=[`Flood ×${F.floodFactor.toFixed(1)} (${F.floodSlots} slot${1!==F.floodSlots?"s":""})`,...H,"",`Direct ×${F.directFactor.toFixed(1)}`,...$,"","Click to copy CLI commands"].join("\n"),P=null!==B?de(B):null,z=null!==T?de(T):null,I=null!==P&&F.floodSlots!==P,E=null!==z&&F.directSlots!==z,q=I||E,O=e.useCallback(async()=>{if("applying"!==v){N("applying");try{const e=await p({tx_delay_factor:F.floodFactor,direct_tx_delay_factor:F.directFactor});(null==e?void 0:e.success)?(N("success"),setTimeout(()=>N("idle"),2e3)):(N("error"),setTimeout(()=>N("idle"),2500))}catch{N("error"),setTimeout(()=>N("idle"),2500)}}},[v,F.floodFactor,F.directFactor]);return t.jsxs(u,{compact:!0,children:[t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3 flex-wrap",children:[t.jsx(xe,{className:"w-4 h-4 text-icon-card-title flex-shrink-0"}),t.jsx("span",{className:"type-micro",children:"DELAY DOCTOR"}),o&&t.jsx(h,{color:"zinc",className:"hidden sm:inline-flex",children:o})]}),t.jsxs("button",{onClick:async()=>{const e=`set txdelay ${F.floodFactor.toFixed(1)}\nset direct.txdelay ${F.directFactor.toFixed(1)}`;try{await navigator.clipboard.writeText(e),y(!0),setTimeout(()=>y(!1),1500)}catch{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{document.execCommand("copy"),y(!0),setTimeout(()=>y(!1),1500)}catch{}document.body.removeChild(t)}},className:"flex gap-3 mb-2 sm:mb-3 w-full text-left hover:bg-subtle-fill radius-inner transition-base p-1 -m-1 group",title:A,children:[t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx("span",{className:"type-data-xl text-fg-primary",children:t.jsxs(st,{children:["×",F.floodFactor.toFixed(1)]})}),t.jsx("span",{className:"type-micro text-fg-muted mt-0.5 sm:mt-1",children:"Flood"})]}),t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx("span",{className:"type-data-xl text-sys-blue",children:t.jsxs(st,{children:["×",F.directFactor.toFixed(1)]})}),t.jsx("span",{className:"type-micro text-fg-muted mt-0.5 sm:mt-1",children:"Direct"})]}),t.jsx("div",{className:"flex items-center self-center opacity-0 group-hover:opacity-100 transition-opacity",children:j?t.jsx(f,{className:"w-4 h-4 text-sys-green"}):t.jsx(je,{className:"w-4 h-4 text-fg-muted"})})]}),t.jsx("div",{className:"flex-1 py-2",children:t.jsxs("div",{className:"flex gap-3",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"data-box-label",children:"Dupe"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left "+(F.duplicateRate>8?"text-status-warning":""),children:[F.duplicateRate.toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"data-box-label",children:"TX Util"}),t.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[F.txUtilization.toFixed(2),"%"]})]})]})}),t.jsx("div",{className:"pt-2 mt-auto",children:t.jsxs("div",{className:"flex items-end justify-between gap-2",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Current"}),t.jsx("div",{className:"flex gap-2",children:null!==B?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"data-box",children:["×",B.toFixed(2)]}),t.jsxs("div",{className:"data-box",style:{color:"var(--sys-blue)"},children:["×",(null==T?void 0:T.toFixed(2))??"—"]})]}):t.jsx("span",{className:"text-sm text-fg-muted",children:"No config"})})]}),q&&t.jsxs("button",{onClick:O,disabled:"applying"===v||"success"===v,className:"flex items-center gap-1.5 px-2.5 py-1.5 radius-inner type-micro font-medium transition-base\n "+("success"===v?"bg-sys-green/15 text-sys-green":"error"===v?"bg-sys-red/15 text-sys-red":"applying"===v?"bg-subtle-fill text-fg-muted":"bg-sys-blue/10 text-sys-blue hover:bg-sys-blue/20"),title:`Apply ×${F.floodFactor.toFixed(1)} flood, ×${F.directFactor.toFixed(1)} direct`,children:["success"===v?"Rx'd":"error"===v?"Failed":"Apply","applying"===v?t.jsx(g,{className:"w-3.5 h-3.5 animate-spin"}):"success"===v?t.jsx(f,{className:"w-3.5 h-3.5"}):t.jsxs("span",{className:"relative inline-flex items-end w-6 h-3.5",children:[t.jsx(Ge,{className:"w-3.5 h-3.5 absolute left-0 bottom-0"}),t.jsx(Je,{className:"w-3 h-3 absolute right-0 bottom-0"})]})]})]})})]})}function lt(){const s=b(),a=j(),n=y(),l=v(),i=N(),o=pe(e=>e.requestChannel),[r,c]=e.useState(!0),d=e.useCallback(e=>c(e),[]),m=e.useMemo(()=>[...s.length<=100?s:s.slice(-100)].sort((e,t)=>(t.timestamp??0)-(e.timestamp??0)),[s]),h=null==l?void 0:l.local_hash,x=null==l?void 0:l.neighbors;return t.jsxs(u,{noPadding:!0,className:"!overflow-visible",children:[t.jsx(ye,{listHeader:!0,icon:t.jsx(C,{}),title:"Recent Packets",actions:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(k,{enabled:r,onChange:d,label:"Hide Dupes",size:"sm"}),n&&t.jsx(w,{showLabel:!0}),t.jsxs(M,{color:"primary",outline:!0,href:"/packets",children:["View all",t.jsx(ve,{"data-slot":"icon"})]})]})}),t.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-1",children:t.jsx(fe,{packets:m,allPackets:s,localHash:h,neighbors:x,decodedMessages:i,onChannelClick:o,loading:a,maxPackets:25,showPagination:!1,flashNewest:!0,hideDupes:r,emptyMessage:"No packets received",footerAction:t.jsxs(M,{color:"primary",outline:!0,href:"/packets",children:["View all",t.jsx(ve,{"data-slot":"icon"})]})})})]})}const it={stable:"M5 12h14",up:"M5 15l7-7 7 7",down:"M19 9l-7 7-7-7"};function ot({trend:e}){return t.jsx("span",{className:`mini-widget-trend ${e}`,children:t.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:it[e]})})})}function rt(){return t.jsx("div",{className:"mini-widget-loading",children:t.jsx("div",{className:"mini-widget-loading-spinner"})})}function ct({message:e}){return t.jsx("div",{className:"mini-widget-error",children:t.jsx("span",{title:e,children:"No data"})})}function dt({title:e,icon:s,value:a,unit:n,valueSize:l="md",status:i,subtitle:o,trend:r,children:c,isLoading:d=!1,error:m,className:h="",onClick:x}){const p=["mini-widget-value","lg"===l&&"mini-widget-value-lg","sm"===l&&"mini-widget-value-sm"].filter(Boolean).join(" "),f=["mini-widget",h].filter(Boolean).join(" ");return t.jsxs(u,{noPadding:!0,className:f,onClick:x,children:[t.jsxs("div",{className:"mini-widget-header",children:[s,t.jsx("span",{className:"mini-widget-title",children:e}),i&&"unknown"!==i&&t.jsx("div",{className:`mini-widget-status-dot ${i}`}),r&&t.jsx(ot,{trend:r})]}),d?t.jsx(rt,{}):m?t.jsx(ct,{message:m}):t.jsxs(t.Fragment,{children:[void 0!==a&&t.jsxs("div",{className:p,children:["number"==typeof a?t.jsx(le,{value:a,className:"font-mono tabular-nums",priority:"medium",format:Number.isInteger(a)?void 0:{minimumFractionDigits:1,maximumFractionDigits:1}}):t.jsx(st,{children:a}),n&&t.jsx("span",{className:"mini-widget-unit",children:n})]}),o&&t.jsx("div",{className:"mini-widget-subtitle",children:o}),c]})]})}const mt={DELTA_CRITICAL:10,SLOPE_CRITICAL:4,JITTER_CRITICAL:6,DELTA_WARNING:5,SLOPE_WARNING:2,JITTER_WARNING:4},ut={baselineMedian:null,baselineP10:null,baselineP90:null,currentMedian:null,currentSampleCount:0,delta:0,slope:0,jitter:0,penalty:0,penaltyReason:null,computedAt:0,isReliable:!1};function ht(e,t){if(0===e.length)return null;const s=[...e].sort((e,t)=>e-t),a=t/100*(s.length-1),n=Math.floor(a),l=Math.ceil(a);return n===l?s[n]:s[n]+(s[l]-s[n])*(a-n)}function xt(e){return ht(e,50)}function pt(e){if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t))return t.map(Number).filter(e=>!isNaN(e))}catch{}return[]}function ft(e){return null!=e&&0!==e&&!Object.is(e,-0)&&!(e>-50||e<-130)}function gt(e,t,s=2,a=!1){if(null===t)return"stable";const n=e-t;return(0!==t?100*Math.abs(n/t):Math.abs(n))0?"up":"down":n>0?"down":"up"}const bt={lbtStats:null,noiseFloor:null,sparklineNoiseFloor:[],linkQuality:null,channelHealth:null,nfTrend:ut,radioConfig:null,trends:null,stats:null,recentPackets:[],quickNeighbors:[],isLoading:!0,error:null,refresh:async()=>{}},jt=e.createContext(bt);function yt({children:s}){var a;const n=v(),l=b(),i=S(),o=_(),r=L(),c=B[r],d=Math.max(1,c.minutes/60),m=null===n,u=e.useMemo(()=>function(e,t){const s=3600*t,a=Math.floor(Date.now()/1e3)-s,n=e.filter(e=>e.timestamp>=a&&void 0!==e.lbt_attempts&&e.lbt_attempts>0),l=n.length,i=n.filter(e=>(e.lbt_attempts??0)>1).length,o=l>0?i/l*100:0,r=n.filter(e=>(e.lbt_attempts??0)>1),c=r.length>0?r.reduce((e,t)=>e+(t.lbt_attempts??0),0)/r.length:0,d=n.filter(e=>(e.lbt_attempts??0)>=5).length,m=l>0?d/l*100:0,u=[];for(const y of n){const e=pt(y.lbt_backoff_delays_ms);u.push(...e)}const h=u.reduce((e,t)=>e+t,0),x=u.length>0?h/u.length:0,p=u.length>0?Math.min(...u):0,f=u.length>0?Math.max(...u):0,g=s/24,b=[],j=[];for(let y=0;y<24;y++){const e=a+y*g,t=e+g,s=n.filter(s=>s.timestamp>=e&&s.timestamp(e.lbt_attempts??0)>1).length,i=s.length>0?l/s.length*100:0,o=[];for(const a of s){const e=pt(a.lbt_backoff_delays_ms);o.push(...e)}const r=o.length>0?o.reduce((e,t)=>e+t,0)/o.length:0;if(b.push(r),0===s.length)j.push(0);else{const e=s.filter(e=>(e.lbt_attempts??0)>=5).length,t=o.length>0?Math.max(...o):0,a=Math.min(s.length/5,1),n=.15,l=Math.log(1+i*n)/Math.log(1+100*n)*40,c=e/s.length*100,d=Math.min(.5*c,25);let m=0;r>100&&(m=Math.min(8*Math.log10(r/100),15));let u=0;t>500&&r>0&&t>2*r&&(u=Math.min((t-500)/200,5));const h=l+d+m+u;j.push(Math.min(h*a,85))}}return{totalPacketsWithLBT:l,packetsWithRetries:i,retryRate:o,avgRetries:c,channelBusyCount:d,channelBusyRate:m,avgBackoffMs:x,minBackoffMs:p,maxBackoffMs:f,totalBackoffMs:h,sparklineBackoff:b,sparklineCollisionRisk:j,windowHours:t,packetCount:e.length}}(l,d),[l,d]),h=(null==n?void 0:n.noise_floor_dbm)??null,x=e.useMemo(()=>ft(h)?h:null,[h]),p=e.useMemo(()=>{var e;const t=null==(e=null==n?void 0:n.config)?void 0:e.radio;return t?{sf:t.spreading_factor??7,bwHz:t.bandwidth??125e3}:null},[null==(a=null==n?void 0:n.config)?void 0:a.radio]),[f,g]=e.useState([]),j=e.useRef({time:0,hours:0});e.useEffect(()=>{const e=async()=>{var e;const t=Date.now(),s=Math.ceil(d);if(0===j.current.time||j.current.hours!==s||t-j.current.time>=6e4){j.current={time:t,hours:s};try{const t=await T(Math.max(s,24));t.success&&(null==(e=t.data)?void 0:e.history)&&g(t.data.history)}catch{}}};e();const t=setInterval(e,6e4);return()=>clearInterval(t)},[d]);const y=e.useMemo(()=>function(e,t){if(0===e.length)return[];const s=e.reduce((e,t)=>Math.max(e,t.timestamp),0);if(0===s)return[];const a=3600*t,n=s-a,l=a/24,i=[];for(let o=0;o<24;o++){const t=n+o*l,s=t+l,a=e.filter(e=>e.timestamp>=t&&e.timestamp0){const e=a.reduce((e,t)=>e+t.noise_floor_dbm,0)/a.length;i.push(e)}else i.push(i.length>0?i[i.length-1]:-100)}return i}(f,d),[f,d]),N=null==n?void 0:n.neighbors,k=e.useMemo(()=>{const e=N??{};return Object.fromEntries(Object.entries(e).filter(([e])=>!o.has(e)))},[N,o]),w=e.useMemo(()=>i.filter(e=>!o.has(e.hash)),[i,o]),M=e.useMemo(()=>function(e){if(0===e.length)return{...ut,computedAt:Math.floor(Date.now()/1e3)};const t=Math.floor(Date.now()/1e3),s=e.filter(e=>Number.isFinite(e)),a=e.length>0?[e[e.length-1]]:[],n=e.slice(-4).filter(e=>Number.isFinite(e)),l=xt(s),i=ht(s,10),o=ht(s,90),r=xt(a),c=null!==r&&null!==i?r-i:0,d=function(e){if(e.length<2)return 0;const t=e.length;let s=0,a=0,n=0,l=0;const i=e[0].timestamp;for(const r of e){const e=(r.timestamp-i)/3600,t=r.value;s+=e,a+=t,n+=e*t,l+=e*e}const o=t*l-s*s;return Math.abs(o)<1e-4?0:(t*n-s*a)/o}(n.map((e,s)=>({timestamp:t-3600*(n.length-1-s),value:e}))),m=function(e){if(e.length<2)return 0;const t=e.reduce((e,t)=>e+t,0)/e.length,s=e.map(e=>Math.pow(e-t,2)).reduce((e,t)=>e+t,0)/e.length;return Math.sqrt(s)}(n),u=s.length>=12,[h,x]=u?function(e,t,s){const a=mt;return e>=a.DELTA_CRITICAL?[2,`Noise floor ${e.toFixed(1)} dB above baseline`]:t>=a.SLOPE_CRITICAL?[2,`Noise floor rising ${t.toFixed(1)} dB/hour`]:s>=a.JITTER_CRITICAL?[2,`Noise floor unstable (±${s.toFixed(1)} dB)`]:e>=a.DELTA_WARNING?[1,`Noise floor ${e.toFixed(1)} dB above baseline`]:t>=a.SLOPE_WARNING?[1,`Noise floor rising ${t.toFixed(1)} dB/hour`]:s>=a.JITTER_WARNING?[1,`Noise floor variable (±${s.toFixed(1)} dB)`]:[0,null]}(c,d,m):[0,null];return{baselineMedian:l,baselineP10:i,baselineP90:o,currentMedian:r,currentSampleCount:a.length,delta:c,slope:d,jitter:m,penalty:h,penaltyReason:x,computedAt:t,isReliable:u}}(y),[y]),C=e.useMemo(()=>function(e,t,s){if(0===e.length)return{neighbors:[],networkScore:0,neighborCount:0,bestLink:null,worstLink:null};const a=e.map(e=>{const a=function(e,t,s){const a=we(e,t,s,0);if(a)switch(a.finalGrade){case"excellent":return 100;case"good":return 80;case"fair":return 60;case"poor":return 40;case"critical":return 20}const n=void 0===e?50:e>=10?100:e>=5?80:e>=0?60:e>=-5?40:20,l=void 0===t?50:t>=-70?100:t>=-80?80:t>=-90?60:t>=-100?40:20;return Math.round(.6*n+.4*l)}(e.avgSnr??void 0,e.avgRssi??void 0,s),n=t[e.hash];return{name:(null==n?void 0:n.name)||(null==n?void 0:n.node_name)||e.prefix,hash:e.hash,rssi:e.avgRssi??-100,snr:e.avgSnr??-10,score:a,advertCount:e.count}});a.sort((e,t)=>t.score-e.score);const n=a.length>0?a.reduce((e,t)=>e+t.score,0)/a.length:0;return{neighbors:a,networkScore:Math.round(n),neighborCount:a.length,bestLink:a.length>0?{name:a[0].name,score:a[0].score}:null,worstLink:a.length>0?{name:a[a.length-1].name,score:a[a.length-1].score}:null}}(w,k,p),[w,k,p]),F=e.useMemo(()=>function(e,t,s){const a=e?Math.max(0,Math.min(100,100-5*e.retryRate)):50;let n=50;null!==t&&(n=Math.max(0,Math.min(100,(t+120)/30*100)));const l=(null==s?void 0:s.networkScore)??50,i=Math.round(.35*a+.25*n+.4*l);let o;return o=i>=85?"excellent":i>=70?"good":i>=50?"fair":i>=30?"congested":"critical",{score:i,status:o,components:{lbtHealth:Math.round(a),noiseHealth:Math.round(n),linkHealth:Math.round(l)}}}(u,x,C),[u,x,C]),[R,D]=e.useState({noiseFloor:null,networkScore:null,channelHealth:null}),H=e.useRef(0);e.useEffect(()=>{const e=()=>{const e=Date.now();e-H.current>3e4&&(H.current=e,D({noiseFloor:x,networkScore:(null==C?void 0:C.networkScore)??null,channelHealth:(null==F?void 0:F.score)??null}))};e();const t=setInterval(e,5e3);return()=>clearInterval(t)},[x,null==C?void 0:C.networkScore,null==F?void 0:F.score]);const $=e.useMemo(()=>({noiseFloor:{current:x,previous:R.noiseFloor,trend:null!==x?gt(x,R.noiseFloor,2,!0):"stable"},networkScore:{current:(null==C?void 0:C.networkScore)??0,previous:R.networkScore,trend:gt((null==C?void 0:C.networkScore)??0,R.networkScore,3,!1)},channelHealth:{current:(null==F?void 0:F.score)??0,previous:R.channelHealth,trend:gt((null==F?void 0:F.score)??0,R.channelHealth,3,!1)}}),[x,null==C?void 0:C.networkScore,null==F?void 0:F.score,R]),A={lbtStats:u,noiseFloor:x,sparklineNoiseFloor:y,linkQuality:C,channelHealth:F,nfTrend:M,radioConfig:p,trends:$,stats:n,recentPackets:l,quickNeighbors:i,isLoading:m,error:null,refresh:async()=>{}};return t.jsx(jt.Provider,{value:A,children:s})}function vt(){const t=e.useContext(jt);if(void 0===t)throw new Error("useLBTData must be used within an LBTDataProvider");return t}function Nt(e,t){return 0===e?"No backoffs":`${t.toFixed(0)}% retry rate`}function kt(){const{lbtStats:s,isLoading:a,error:n}=vt(),l=Ce(),i=(null==s?void 0:s.avgBackoffMs)??0,o=(null==s?void 0:s.retryRate)??0,r=s?(c=i)<100?"excellent":c<250?"good":c<500?"fair":c<1e3?"congested":"critical":"unknown";var c;const d=null==s?void 0:s.sparklineBackoff,m=e.useMemo(()=>!d||d.length<2?[]:d.map((e,t)=>({timestamp:Date.now()-36e5*(d.length-1-t),count:e})),[d]);return t.jsx(dt,{title:"LBT Backoff",icon:t.jsx(Ke,{className:"mini-widget-icon"}),value:Math.round(i),unit:"ms",status:r,subtitle:s?Nt(i,o):void 0,isLoading:a,error:n,onClick:()=>l("/packets"),children:t.jsx("div",{className:"mini-widget-sparkline w-full",children:t.jsx(Me,{data:m,width:9999,height:24,color:"var(--sys-blue)",isLoading:a,className:"w-full"})})})}function wt(e){return 0===e?"—":e<1?"<1":Math.round(e).toString()}function Mt(){const{lbtStats:e,isLoading:s,error:a}=vt(),n=Ce(),l=(null==e?void 0:e.channelBusyCount)??0,i=(null==e?void 0:e.totalPacketsWithLBT)??0,o=(null==e?void 0:e.channelBusyRate)??0,r=(null==e?void 0:e.retryRate)??0,c=(null==e?void 0:e.avgBackoffMs)??0,d=(null==e?void 0:e.minBackoffMs)??0,m=(null==e?void 0:e.maxBackoffMs)??0,u=r>0?Math.max(0,(r-o)/r*100):100;return t.jsx(dt,{title:"Ch. Busy",icon:t.jsx(ie,{className:"mini-widget-icon"}),isLoading:s,error:a,onClick:()=>n("/packets"),children:t.jsx("div",{className:"flex-1 flex items-end",children:t.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)] sm:grid-cols-[auto_minmax(0,1fr)_auto_minmax(0,1fr)] gap-x-2 gap-y-1 sm:gap-y-2 w-full items-baseline",children:[t.jsx("span",{className:"data-box-label mb-0 text-[10px] sm:text-sm",title:`${l} packets exceeded max CAD attempts (5) out of ${i} total transmissions.`,children:"Failed:"}),t.jsxs("div",{className:"data-box data-box-compact sm:data-box justify-self-start",title:`${l} packets exceeded max CAD attempts (5) out of ${i} total transmissions.`,children:[t.jsx(st,{children:l}),t.jsx("span",{className:"text-fg-muted punc-slash",children:"/"}),t.jsx(st,{children:i})]}),t.jsx("span",{className:"data-box-label mb-0 text-[10px] sm:text-sm",title:`${u.toFixed(1)}% of packets that needed LBT retries were sent successfully.`,children:"Sent:"}),t.jsx("div",{className:"data-box data-box-compact sm:data-box justify-self-start",title:`${u.toFixed(1)}% of packets that needed LBT retries were sent successfully.`,children:t.jsxs(st,{children:[u.toFixed(0),"%"]})}),t.jsx("span",{className:"data-box-label mb-0 text-[10px] sm:text-sm",title:`Average LBT backoff delay: ${c.toFixed(0)}ms.`,children:"Mean:"}),t.jsxs("div",{className:"data-box data-box-compact sm:data-box justify-self-start",title:`Average LBT backoff delay: ${c.toFixed(0)}ms.`,children:[t.jsx(st,{children:wt(c)}),t.jsx("span",{className:"text-fg-muted text-xs",children:"ms"})]}),t.jsx("span",{className:"data-box-label mb-0 text-[10px] sm:text-sm",title:`Backoff range: ${d.toFixed(0)}ms min, ${m.toFixed(0)}ms max.`,children:"Range:"}),t.jsxs("div",{className:"data-box data-box-compact sm:data-box justify-self-start",title:`Backoff range: ${d.toFixed(0)}ms min, ${m.toFixed(0)}ms max.`,children:[t.jsx(st,{children:wt(d)}),t.jsx("span",{className:"text-fg-muted punc-slash",children:"/"}),t.jsx(st,{children:wt(m)})]})]})})})}function Ct(e){return null===e?"No reading":e<-115?"Very quiet":e<-105?"Quiet":e<-95?"Moderate":e<-85?"Elevated":"High interference"}function St(){const{noiseFloor:s,sparklineNoiseFloor:a,trends:n,isLoading:l,error:i}=vt(),o=null===(r=s)||r<-110?"excellent":r<-100?"good":r<-90?"fair":r<-80?"congested":"critical";var r;const c=null==n?void 0:n.noiseFloor.trend,d=e.useMemo(()=>!a||a.length<2?[]:a.map((e,t)=>({timestamp:Date.now()-36e5*(a.length-1-t),count:-e})),[a]),m=null!==s?Math.round(s):"—";return t.jsx(dt,{title:"Noise Floor",icon:t.jsx(qe,{className:"mini-widget-icon"}),value:m,unit:null!==s?"dBm":void 0,status:o,trend:c,subtitle:Ct(s),isLoading:l,error:i,children:t.jsx("div",{className:"mini-widget-sparkline w-full",children:t.jsx(Me,{data:d,width:9999,height:24,color:"var(--sys-blue)",isLoading:l,className:"w-full"})})})}function _t(){const s=Ce(),a=S(),n=b(),l=v(),i=L(),o=60*B[i].minutes,r=F(),c=e.useMemo(()=>{if(0===r)return n;const e=r-o;return n.filter(t=>t.timestamp>=e)},[n,o,r]),d=null===l,m=(null==l?void 0:l.local_hash)?R(l.local_hash):"",u=(null==l?void 0:l.neighbors)??{},{neighborHashes:h,neighborNames:x}=e.useMemo(()=>{const e=new Set,t=new Map;for(const s of a){e.add(s.hash);const a=u[s.hash],n=(null==a?void 0:a.name)||(null==a?void 0:a.node_name)||s.prefix;t.set(s.hash,n)}return{neighborHashes:e,neighborNames:t}},[a,u]),p=e.useMemo(()=>{if(0===h.size||0===c.length||!m)return{champion:null,listener:null,loudest:null};const{scores:e}=Se(c,h,m),t=[];for(const[l,i]of e)0!==i.blendedScore&&t.push({...i,name:x.get(l)??R(l)});let s=null,a=null,n=null;for(const l of t)(!s||l.blendedScore>s.blendedScore)&&(s=l),(!a||l.listenerScore>a.listenerScore)&&(a=l),(!n||l.loudScore>n.loudScore)&&(n=l);return{champion:s,listener:a,loudest:n}},[c,h,m,x]),{champion:f,listener:g,loudest:j}=p,y=f||g||j?t.jsxs("div",{className:"flex flex-col gap-0 sm:gap-0.5 mt-auto",children:[f&&t.jsx(D,{content:(N=f,t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["🏆 Champion: ",N.name]}),t.jsxs("div",{className:"text-fg-muted mb-1",children:["Blended Score: ",N.blendedScore,t.jsx("span",{className:"text-fg-muted/60 ml-1",children:"(Listener + Loud)"})]}),t.jsxs("div",{className:"border-t border-edge-subtle pt-1 mt-1 space-y-0.5",children:[t.jsxs("div",{children:["Listener: ",N.listenerScore,"/100 (",N.listenerCount," shared paths)"]}),t.jsxs("div",{children:["Loud: ",N.loudScore,"/100 (",N.loudCount," packets relayed)"]})]})]})),children:t.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx(ge,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 text-map-neighbor-color flex-shrink-0"}),t.jsx("span",{className:"font-semibold text-map-neighbor-color font-mono truncate flex-1 min-w-0",children:f.name}),t.jsx("span",{className:"text-map-neighbor-color pl-1 sm:pl-2 tabular-nums flex-shrink-0 w-7 sm:w-9 text-right",children:f.blendedScore})]})}),g&&t.jsx(D,{content:(e=>t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["👂 Best Listener: ",e.name]}),t.jsxs("div",{className:"text-fg-muted mb-1",children:["Score: ",e.listenerScore,"/100"]}),t.jsx("div",{className:"border-t border-edge-subtle pt-1 mt-1",children:t.jsxs("div",{children:[e.listenerCount," packets where they heard your transmissions"]})})]}))(g),children:t.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx(Oe,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 text-fg-muted flex-shrink-0"}),t.jsx("span",{className:"text-fg-muted font-mono truncate flex-1 min-w-0",children:g.name}),t.jsx("span",{className:"text-fg-muted pl-1 sm:pl-2 tabular-nums flex-shrink-0 w-7 sm:w-9 text-right",children:g.listenerScore})]})}),j&&t.jsx(D,{content:(e=>t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["📢 Loudest: ",e.name]}),t.jsxs("div",{className:"text-fg-muted mb-1",children:["Score: ",e.loudScore,"/100"]}),t.jsx("div",{className:"border-t border-edge-subtle pt-1 mt-1",children:t.jsxs("div",{children:[e.loudCount," packets they relayed directly to you"]})})]}))(j),children:t.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx(We,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 text-fg-muted flex-shrink-0"}),t.jsx("span",{className:"text-fg-muted font-mono truncate flex-1 min-w-0",children:j.name}),t.jsx("span",{className:"text-fg-muted pl-1 sm:pl-2 tabular-nums flex-shrink-0 w-7 sm:w-9 text-right",children:j.loudScore})]})})]}):0===a.length?t.jsx("div",{className:"flex items-center justify-center text-xs sm:text-sm text-fg-muted mt-auto",children:"No direct neighbors"}):t.jsx("div",{className:"flex items-center justify-center text-xs sm:text-sm text-fg-muted mt-auto",children:"No routing data yet"});var N;return t.jsx(dt,{title:"Link Leaders",icon:t.jsx(Ve,{className:"mini-widget-icon"}),isLoading:d,onClick:()=>s("/contacts"),children:y})}function Lt(){const{lbtStats:s,isLoading:a,error:n}=vt(),l=s?function(e){const{retryRate:t,channelBusyCount:s,totalPacketsWithLBT:a,avgBackoffMs:n,maxBackoffMs:l}=e;if(0===a)return 0;const i=Math.min(a/10,1),o=Math.log(1+.15*t)/Math.log(16)*40,r=s/a*100,c=Math.min(.5*r,25);let d=0;n>100&&(d=Math.min(8*Math.log10(n/100),15));let m=0;l>500&&n>0&&l>2*n&&(m=Math.min((l-500)/200,5));const u=(o+c+d+m)*i;return Math.min(u,85)}(s):0,i=s?(o=l)<15?"excellent":o<30?"good":o<45?"fair":o<60?"congested":"critical":"unknown";var o;const r=(null==s?void 0:s.maxBackoffMs)??0,c=s?r>200?`Max backoff: ${Math.round(r)}ms`:function(e){return e<15?"Clear channel":e<30?"Light traffic":e<45?"Moderate traffic":e<60?"Heavy traffic":e<75?"Congested":"Severe congestion"}(l):void 0,d=null==s?void 0:s.sparklineCollisionRisk,m=e.useMemo(()=>!d||d.length<2?[]:d.map((e,t)=>({timestamp:Date.now()-36e5*(d.length-1-t),count:e})),[d]),u=Math.round(10*l)/10;return t.jsx(dt,{title:"Collision Risk",icon:t.jsx(Ne,{className:"mini-widget-icon"}),value:u,unit:"%",status:i,subtitle:c,isLoading:a,error:n,children:t.jsx("div",{className:"mini-widget-sparkline w-full",children:t.jsx(Me,{data:m,width:9999,height:24,color:"var(--sys-blue)",isLoading:a,className:"w-full"})})})}function Bt(){const[s,a]=e.useState(!1),[n]=e.useState(0),{stats:l,lbtStats:i,isLoading:o}=vt(),r=e.useMemo(()=>{if(!l)return null;const e=l.airtime_used_ms??0,t=l.max_airtime_ms??1;return{usedMs:e,maxMs:t,remainingMs:l.airtime_remaining_ms??0,utilizationPercent:l.utilization_percent??(t>0?e/t*100:0)}},[l]),c=e.useMemo(()=>i&&0!==i.totalPacketsWithLBT?(i.totalPacketsWithLBT-i.packetsWithRetries)/i.totalPacketsWithLBT*100:100,[i]),d=(null==r?void 0:r.utilizationPercent)??0,m=(u=d)<30?"excellent":u<50?"good":u<70?"fair":u<90?"congested":"critical";var u;const h=(null==r?void 0:r.remainingMs)??0,x=c<95?`${c.toFixed(0)}% clean TX`:((p=h)<1e3?`${Math.round(p)}ms`:p<6e4?`${(p/1e3).toFixed(1)}s`:`${(p/6e4).toFixed(1)}m`)+" remaining";var p;const f=r?t.jsx("div",{className:"mini-widget-progress mt-auto",children:t.jsx("div",{className:`mini-widget-progress-bar ${m}`,style:{width:`${Math.min(d,100)}%`}})}):null;return t.jsx(dt,{title:"Duty Cycle",icon:t.jsx(C,{className:"mini-widget-icon"}),value:d.toFixed(1),unit:"%",status:m,subtitle:x,isLoading:o,children:f})}function Tt(){return t.jsxs("div",{className:"mini-widget",children:[t.jsxs("div",{className:"mini-widget-header",children:[t.jsx(Y,{className:"w-4 h-4"}),t.jsx(Y,{className:"h-3 w-16"})]}),t.jsx(Y,{className:"h-7 w-12 mt-2"}),t.jsx(Y,{className:"h-3 w-20 mt-2"})]})}function Ft(){return t.jsx("div",{className:"widget-row",children:Array.from({length:6}).map((e,s)=>t.jsx(Tt,{},s))})}function Rt({className:e="",isLoaded:s=!0}){return t.jsxs("div",{className:`mesh-health-container relative ${e}`,children:[t.jsxs("div",{className:"mesh-health-header",children:[t.jsx(Ue,{className:"w-4 h-4 text-sys-blue"}),t.jsx("span",{className:"type-label text-fg-muted",children:"MESH HEALTH"})]}),s?t.jsx(yt,{children:t.jsxs("div",{className:"widget-row",children:[t.jsx(kt,{}),t.jsx(Lt,{}),t.jsx(St,{}),t.jsx(Bt,{}),t.jsx(Mt,{}),t.jsx(_t,{})]})}):t.jsx(Ft,{})]})}let Dt="",Ht="",$t="";function At(e){!function(){const e=new Date,t=e.toDateString();if(t!==$t){$t=t,Dt=t;const s=new Date(e);s.setDate(s.getDate()-1),Ht=s.toDateString()}}();const t=new Date(1e3*e).toDateString();return t===Dt?"Today":t===Ht?"Yesterday":new Date(1e3*e).toLocaleDateString([],{weekday:"short",month:"short",day:"numeric"})}function Pt(e,t,s){return`${e||""}|${t}|${s}`}const zt=e.memo(function({message:e,onChannelClick:s,isChannelSelected:a}){const n=e.channelName||e.channelHash.slice(0,6);return t.jsx("div",{style:{transform:"translateZ(0)",willChange:"transform"},children:t.jsx(De,{senderName:e.senderName||"Unknown",text:e.text,timestamp:e.timestamp,nameAccessory:t.jsx(be,{channelName:n,active:a,onClick:()=>null==s?void 0:s(e.channelHash)})})})},function(e,t){const s=e.message,a=t.message;return s.timestamp===a.timestamp&&s.text===a.text&&s.senderName===a.senderName&&s.channelHash===a.channelHash&&s.channelName===a.channelName&&e.isChannelSelected===t.isChannelSelected&&e.onChannelClick===t.onChannelClick});function It({open:a,onClose:n,messages:l,onLoadMore:i,hasMoreToLoad:o,isDecoding:r,initialChannel:c}){const d=e.useRef(null),m=e.useRef(!0),u=L(),h=E(),x=e.useRef(!1);e.useEffect(()=>{a?(x.current=!0,q.resume()):x.current&&q.pause()},[a]);const p=e.useMemo(()=>{const e=Date.now()/1e3-60*B[u].minutes;return[...l].filter(t=>t.timestamp>=e).sort((e,t)=>e.timestamp-t.timestamp)},[l,u]),f=e.useCallback(()=>{const e=d.current;e&&(m.current=e.scrollTop>=-50)},[]),b=e.useMemo(()=>{const e=new Map;for(const t of p){const s=t.channelHash,a=e.get(s);a?a.count++:e.set(s,{name:t.channelName||t.channelHash.slice(0,6),hash:t.channelHash,count:1})}return Array.from(e.values()).sort((e,t)=>t.count-e.count)},[p]),j=b.length,[y,v]=e.useState(null),[N,k]=e.useState(!1);e.useEffect(()=>{a&&c&&v(c)},[a,c]);const w=e.useCallback(()=>{i(y,b)},[i,y,b]),M=e.useMemo(()=>y?p.filter(e=>e.channelHash===y):p,[p,y]),C=e.useMemo(()=>{const e=[];let t="";for(const s of M){const a=At(s.timestamp);a!==t&&(e.push({type:"date",date:a}),t=a),e.push({type:"message",message:s})}return e},[M]);e.useLayoutEffect(()=>{const e=d.current;e&&m.current&&(e.scrollTop=0)},[M.length]);const S=b.slice(0,19),_=b.slice(19),T=_.length>0;return t.jsx(O,{open:a,onClose:n,size:"lg",motionPlus:!0,solid:!0,children:t.jsxs(W,{className:"p-0 flex flex-col h-[80vh] max-h-[700px] rounded-2xl",children:[t.jsx("div",{className:"flex-shrink-0 px-4 sm:px-5 py-3 sm:py-4",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Re,{className:"size-5 text-icon-card-title flex-shrink-0"}),t.jsx("h2",{className:"type-micro",children:"Public Channels"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(oe,{ranges:B,selectedIndex:u,onSelect:h,size:"micro"}),t.jsx("button",{onClick:n,className:"sm:hidden min-h-[44px] min-w-[44px] px-3 flex items-center justify-center text-[15px] font-medium text-sys-blue active:text-sys-blue/70 transition-base radius-inner active:bg-subtle-fill",children:"Done"}),t.jsx("button",{onClick:n,className:"hidden sm:flex items-center justify-center p-2 text-fg-muted hover:text-fg-primary transition-base radius-inner hover:bg-subtle","aria-label":"Close",children:t.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}),t.jsx("div",{className:"flex-shrink-0 px-3 pb-2 relative z-10 isolate",style:{minHeight:j>0?void 0:0},children:j>0&&t.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.jsx("button",{onClick:()=>v(null),className:s("px-2 py-0.5 rounded text-xs font-medium transition-all","ring-1 ring-inset",null===y?"bg-sys-blue/20 text-sys-blue ring-sys-blue/30":"bg-subtle-fill text-fg-secondary ring-edge-subtle hover:bg-subtle-fill-strong"),children:"All"}),S.map(e=>t.jsx("button",{onClick:()=>v(e.hash),className:s("flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium transition-all","ring-1 ring-inset",y===e.hash?"bg-sys-blue/20 text-sys-blue ring-sys-blue/30":"bg-subtle-fill text-fg-secondary ring-edge-subtle hover:bg-subtle-fill-strong"),children:t.jsx("span",{className:"truncate max-w-[80px]",children:e.name})},e.hash)),T&&t.jsxs("div",{className:"relative",children:[t.jsxs("button",{onClick:()=>k(!N),className:s("flex items-center gap-0.5 px-2 py-0.5 rounded text-xs font-medium transition-all","ring-1 ring-inset",N||_.some(e=>e.hash===y)?"bg-sys-blue/20 text-sys-blue ring-sys-blue/30":"bg-subtle-fill text-fg-secondary ring-edge-subtle hover:bg-subtle-fill-strong"),children:["+",_.length,t.jsx(G,{className:s("size-3 transition-transform",N&&"rotate-180")})]}),N&&t.jsx("div",{className:s("absolute top-full left-0 mt-1 z-50","min-w-[140px] max-h-[200px] overflow-y-auto","p-1 rounded-lg","bg-elevated backdrop-blur-xl","ring-1 ring-edge-subtle shadow-xl"),children:_.map(e=>t.jsxs("button",{onClick:()=>{v(e.hash),k(!1)},className:s("w-full flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-all text-left",y===e.hash?"bg-sys-blue/20 text-sys-blue":"text-fg-secondary hover:bg-subtle-fill-strong"),children:[t.jsx($e,{className:"size-2.5 opacity-60 flex-shrink-0"}),t.jsx("span",{className:"truncate",children:e.name}),t.jsxs("span",{className:"opacity-60 ml-auto",children:["(",e.count,")"]})]},e.hash))})]})]})}),t.jsx("div",{ref:d,onScroll:f,className:s("flex-1 overflow-y-auto overflow-x-hidden","mx-3 mb-3 rounded-md","bg-body","ring-1 ring-inset ring-edge-subtle","flex flex-col-reverse"),children:r&&0===M.length?t.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[300px] text-fg-muted px-4 py-4",children:[t.jsx(g,{className:"size-12 mb-4 text-sys-indigo animate-spin"}),t.jsx("p",{className:"text-lg font-medium",children:"Loading messages..."})]}):0===M.length?t.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[300px] text-fg-muted px-4 py-4",children:[t.jsx(Ae,{className:"size-16 mb-4 opacity-20"}),t.jsx("p",{className:"text-lg font-medium",children:"No messages yet"}),t.jsx("p",{className:"text-sm mt-1 opacity-70",children:y?"No messages in this channel":"Public channel messages will appear here"})]}):t.jsxs("div",{className:"px-4 py-4",children:[o&&t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("button",{onClick:w,disabled:r,className:s("px-4 py-1.5 rounded-full","text-[11px] font-medium","ring-1 ring-inset",r?"bg-subtle-fill text-fg-muted ring-edge-subtle cursor-wait":"bg-sys-blue/10 text-sys-blue ring-sys-blue/20 hover:bg-sys-blue/20 hover:ring-sys-blue/30"),children:r?t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx(g,{className:"size-3 animate-spin"}),"Loading..."]}):"Load older messages"})}),C.map((e,a)=>{if("date"===e.type)return t.jsx("div",{className:"flex justify-center my-4",children:t.jsx("span",{className:s("px-3.5 py-1.5 rounded-full","bg-subtle-fill backdrop-blur-sm","text-[11px] text-fg-muted/80 font-medium","ring-1 ring-edge-subtle"),children:e.date})},`date-${e.date}-${a}`);const n=`msg-${e.message.timestamp}-${e.message.senderName||"anon"}-${e.message.channelHash}`;return t.jsx("div",{className:"mb-3",children:t.jsx(zt,{message:e.message,onChannelClick:v,isChannelSelected:y===e.message.channelHash})},n)})]})}),t.jsx("div",{className:"flex-shrink-0 px-5 py-2 text-center",children:t.jsxs("p",{className:"text-[11px] text-fg-muted",children:[M.length," messages · ",j," ",1===j?"channel":"channels",r&&t.jsxs("span",{className:"ml-2 text-sys-indigo",children:[t.jsx(g,{className:"inline size-3 animate-spin mr-1"}),"Decrypting..."]})]})})]})})}function Et({isLoaded:a=!0}){const n=b(),[o,r]=e.useState(!1),[c,d]=e.useState(null),m=L(),u=e.useCallback(()=>{d(null),r(!0),H.getState().queueDecryption(n)},[n]),h=pe(e=>e.requestedHash),x=pe(e=>e.clearRequest);e.useEffect(()=>{h&&(d(h),r(!0),H.getState().queueDecryption(n),x())},[h,x,n]);const p=N(),f=$(),g=A(),j=e.useMemo(()=>function(e){const t=[],s=new Set;for(const a of e.values()){const e=a.decoded;if(!e||!e.decrypted||e.macCorrupted||!e.text)continue;const n=Pt(e.senderName,e.channelHash,e.text);s.has(n)||(s.add(n),t.push({timestamp:a.timestamp,channelName:e.channelName,channelHash:e.channelHash,senderName:e.senderName,text:e.text,rssi:a.rssi,snr:a.snr}))}return t}(p),[p]),y=e.useMemo(()=>{const e=Date.now()/1e3-60*B[m].minutes;return j.filter(t=>t.timestamp>=e)},[j,m]),v=e.useMemo(()=>0===y.length?null:y.reduce((e,t)=>t.timestamp>e.timestamp?t:e),[y]),k=f.isDecoding,w=e.useMemo(()=>{const e=Date.now()/1e3-60*B[m].minutes,t=new Set;let s=0;for(const a of n)(a.type??a.payload_type)===P.GRP_TXT&&((a.timestamp??0){const e=Date.now()/1e3-60*B[m].minutes;for(const t of n)if((t.type??t.payload_type)===P.GRP_TXT&&!((t.timestamp??0){if(!k){if(e){const s=t.find(t=>t.hash===e);if(s)return void H.getState().queueChannelDecryption(n,s.name)}H.getState().queueDecryption(n)}},[n,k]);return a?t.jsxs(t.Fragment,{children:[t.jsx("div",{onClick:u,className:s("group cursor-pointer rounded-2xl transition-all duration-150","bg-surface/80 backdrop-blur-lg neomorphic-outer","hover:bg-subtle-fill","px-3 py-2.5 sm:px-4 sm:py-3"),children:t.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 flex-shrink-0",children:[t.jsx(Re,{className:"size-4 text-icon-card-title flex-shrink-0"}),t.jsx("span",{className:"type-micro",children:"CHAT ACTIVITY"}),w>0&&t.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-subtle-fill ring-1 ring-inset ring-edge-subtle text-sm tabular-nums text-fg-secondary",children:w}),t.jsx(He,{className:"size-4 text-fg-muted group-hover:text-sys-indigo transition-colors ml-auto sm:hidden"})]}),t.jsxs("div",{className:"flex items-center gap-2 sm:gap-1.5 min-w-0 overflow-hidden",children:[t.jsx(l,{mode:"wait",initial:!1,children:v?t.jsxs(i.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-16},transition:{duration:.2,ease:[.4,0,.2,1]},className:"flex items-center gap-2 sm:gap-1.5 min-w-0",children:[v.channelName&&t.jsx("span",{className:"hidden sm:inline-flex",children:t.jsx(be,{channelName:v.channelName})}),t.jsx("div",{className:"hidden sm:flex w-[30px] h-[30px] rounded-full items-center justify-center flex-shrink-0 ring-1 ring-edge-subtle",style:{backgroundColor:Le(Be(v.senderName||"").cleanName)},children:Be(v.senderName||"").emoji?t.jsx("span",{className:"text-base",children:Be(v.senderName||"").emoji}):t.jsx("span",{className:"text-white text-xs font-bold tracking-tighter",children:Te(v.senderName||"")})}),t.jsx("div",{className:"inline-flex items-center px-3 py-1.5 rounded-2xl rounded-tr-md bg-[#007AFF] shadow-sm min-w-0 flex-1 sm:flex-initial sm:max-w-xs sm:-ml-px",children:t.jsx("span",{className:"text-sm text-white truncate tracking-wide",children:Fe(v.text)})}),t.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-subtle-fill ring-1 ring-inset ring-edge-subtle text-sm tabular-nums text-fg-secondary flex-shrink-0",children:I(v.timestamp)})]},`msg-${v.timestamp}-${v.senderName}-${v.channelHash}`):g?t.jsx(i.span,{initial:{opacity:0},animate:{opacity:1},className:"text-sm text-fg-muted italic",children:"No messages yet"},"empty"):t.jsxs(i.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,y:-16},transition:{duration:.15},className:"flex items-center gap-2 sm:gap-1.5",children:[t.jsx("div",{className:"hidden sm:block w-8 h-4 rounded bg-subtle-fill-strong animate-pulse"}),t.jsx("div",{className:"hidden sm:block w-[30px] h-[30px] rounded-full bg-subtle-fill-strong animate-pulse"}),t.jsx("div",{className:"h-8 w-32 sm:w-48 rounded-2xl bg-subtle-fill-strong animate-pulse"}),t.jsx("div",{className:"w-12 h-6 rounded-md bg-subtle-fill-strong animate-pulse"})]},"skeleton")}),t.jsx(He,{className:"size-4 text-fg-muted group-hover:text-sys-indigo transition-colors flex-shrink-0 hidden sm:block ml-1"})]})]})}),t.jsx(It,{open:o,onClose:()=>r(!1),messages:j,onLoadMore:S,hasMoreToLoad:C,isDecoding:k,initialChannel:c})]}):t.jsx("div",{className:"h-14 rounded-xl bg-elevated/50 animate-pulse"})}function qt(){var s,a;const n=v(),l=V(),i=b(),o=U(),r=e.useRef(!1);o&&!r.current&&(r.current=!0);const c=r.current,d=L(),m=E(),u=J(),x=B[d]??B[4],p=u.isBackgroundLoading&&d>=5,f=null==(s=null==n?void 0:n.config)?void 0:s.radio,g=e.useMemo(()=>f?{sf:f.spreading_factor??10,bw:f.bandwidth??25e4,cr:f.coding_rate??5,preamble:f.preamble_length??8}:null,[f]),j=i.length,y=e.useMemo(()=>j?K(x.minutes,x.buckets,i,n):null,[j,x.minutes,x.buckets,g]),N=e.useMemo(()=>{const e=e=>(null==e?void 0:e.reduce((e,t)=>e+t.count,0))??0,t=e(null==y?void 0:y.received),s=e(null==y?void 0:y.unique_received),a=e(null==y?void 0:y.forwarded),n=e(null==y?void 0:y.dropped),l=e(null==y?void 0:y.transmitted),i=((null==y?void 0:y.time_range_minutes)??x.minutes)/60;return{received:t,uniqueReceived:s,forwarded:a,dropped:n,transmitted:l,rxPerHour:i>0?Math.round(t/i):0,fwdPerHour:i>0?Math.round(a/i):0}},[y,x.minutes]),k=e.useMemo(()=>{if(!i.length)return{totalBytes:0,kbPerHour:0};const e=Date.now()/1e3,t=e-60*x.minutes;let s=0;for(const n of i)n.transmitted||n.timestampe||(s+=n.length??n.payload_length??0);const a=x.minutes/60;return{totalBytes:s,kbPerHour:a>0?Math.round(s/1024/a):0}},[i,x.minutes]),w=(null==n?void 0:n.node_name)??(null==(a=null==n?void 0:n.config)?void 0:a.node_name)??"Unknown Node";return e.useEffect(()=>{w&&"Unknown Node"!==w&&(document.title=`pyMC: ${w}`)},[w]),l?t.jsxs(Z,{neomorphic:!0,className:"p-8 text-center",children:[t.jsx("p",{className:"type-subheading text-sys-red mb-2",children:"Failed to connect to backend"}),t.jsx("p",{className:"type-body text-fg-muted",children:l}),t.jsx("p",{className:"type-data-sm text-fg-muted mt-4",children:"Make sure the backend is running on port 8000"})]}):t.jsxs(ee,{children:[t.jsx(te,{title:w,icon:t.jsx(Pe,{}),controls:t.jsx(oe,{ranges:B,selectedIndex:d,onSelect:m,isPending:p})}),t.jsxs(se,{children:[t.jsx(Et,{isLoaded:c}),t.jsx(ze,{template:"hero-auto",children:t.jsxs(Z,{neomorphic:!0,compact:!0,children:[t.jsx(ye,{icon:t.jsx(X,{}),title:"PACKETS RECEIVED",badge:x.label,badgeColor:"zinc",actions:c?t.jsxs("div",{className:"data-box",children:[k.kbPerHour," KB/hr"]}):t.jsx("div",{className:"data-box opacity-0",children:"0 KB/hr"})}),t.jsxs("div",{className:"flex flex-wrap gap-4 sm:gap-8",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx("div",{className:"type-data-xl text-fg-primary",children:c?t.jsx(le,{value:N.received,className:"font-mono tabular-nums",priority:"high"}):t.jsx("span",{className:"opacity-30",children:"—"})}),t.jsx(h,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"Total Rx"})]}),t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx("div",{className:"type-data-xl text-fg-primary",children:c?t.jsx(le,{value:N.uniqueReceived,className:"font-mono tabular-nums",priority:"high"}):t.jsx("span",{className:"opacity-30",children:"—"})}),t.jsx(h,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"Unique"})]})]}),t.jsxs("div",{className:"mt-2 flex-1 min-h-0 relative",children:[t.jsx("div",{className:"absolute inset-0 flex items-end gap-1 transition-opacity duration-300 "+(c?"opacity-0 pointer-events-none":"opacity-100"),"aria-hidden":c,children:[45,72,33,58,80,42,65,28,55,75,38,62].map((e,s)=>t.jsx("div",{className:"flex-1 bg-subtle-fill rounded-sm animate-pulse",style:{height:`${e}%`}},s))}),t.jsx("div",{className:"h-full transition-opacity duration-300 "+(c?"opacity-100":"opacity-0"),children:t.jsx(Xe,{packets:i,rangeMinutes:x.minutes,bucketCount:x.buckets})})]})]})}),t.jsxs(ze,{template:"compact",children:[t.jsx(Ie,{span:6,lg:4,children:t.jsx(Ye,{value:N.forwarded,receivedCount:N.received,packets:i,rangeMinutes:x.minutes,bucketCount:x.buckets,timeRangeLabel:x.label,icon:t.jsx(Ee,{className:"w-4 h-4"}),isLoaded:c})}),t.jsx(Ie,{span:6,lg:4,children:t.jsx(Ze,{value:N.dropped,receivedCount:N.received,packets:i,rangeMinutes:x.minutes,bucketCount:x.buckets,timeRangeLabel:x.label,icon:t.jsx(ke,{className:"w-4 h-4"}),isLoaded:c})}),t.jsx(Ie,{span:12,lg:4,children:t.jsx(nt,{stats:n,localHash:null==n?void 0:n.local_hash,receivedBuckets:null==y?void 0:y.received,droppedBuckets:null==y?void 0:y.dropped,forwardedBuckets:null==y?void 0:y.forwarded,bucketDurationSeconds:null==y?void 0:y.bucket_duration_seconds,timeRangeLabel:x.label,isLoaded:c})})]}),t.jsx(Rt,{isLoaded:c}),t.jsx(lt,{}),n&&t.jsx(ze,{template:"auto",children:t.jsx(_e,{nodeName:w,repeaterVersion:n.version,coreVersion:n.core_version,localHash:n.local_hash,publicKey:n.public_key})})]})]})}export{qt as default}; diff --git a/frontend/dist/assets/DataBox-Dpf5ZHgV.js b/frontend/dist/assets/DataBox-B8dpvpbW.js similarity index 94% rename from frontend/dist/assets/DataBox-Dpf5ZHgV.js rename to frontend/dist/assets/DataBox-B8dpvpbW.js index ecabfdab..f0e0d4ae 100644 --- a/frontend/dist/assets/DataBox-Dpf5ZHgV.js +++ b/frontend/dist/assets/DataBox-B8dpvpbW.js @@ -1 +1 @@ -import{r as e,j as t,c as o}from"./vendor-react-j_fHog8x.js";import{o as n}from"./index-01Tx8g53.js";import{C as s}from"./copy-B5OWhmpX.js";const a={standard:"w-3 h-3",compact:"w-2.5 h-2.5",responsive:"w-2.5 h-2.5 sm:w-3 sm:h-3"};function r({children:r,copyValue:c,copy:i=!1,size:l="standard",className:p,title:d,color:u,truncate:m}){const[x,y]=e.useState(!1),[h,w]=e.useState(!1),f=e.useRef(null),v=c??("string"==typeof r?r:""),b=a[l],g=(()=>{if(!m||"string"!=typeof r)return r;const e=r,[t,o]=!0===m?[6,4]:m;return e.length<=t+o+3?e:`${e.slice(0,t)}…${e.slice(-o)}`})(),j=e.useCallback(e=>{i&&(e.preventDefault(),e.stopPropagation(),f.current&&clearTimeout(f.current),function(e){var t;if("undefined"!=typeof window&&(window.isSecureContext||"https:"===window.location.protocol||"localhost"===window.location.hostname)&&(null==(t=navigator.clipboard)?void 0:t.writeText))return navigator.clipboard.writeText(e).catch(()=>{}),!0;try{const{scrollX:t,scrollY:o}=window,n=document.createElement("textarea");n.value=e,n.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;pointer-events:none",n.setAttribute("readonly",""),document.body.appendChild(n),n.focus({preventScroll:!0}),n.select(),n.setSelectionRange(0,e.length);const s=document.execCommand("copy");return document.body.removeChild(n),window.scrollTo(t,o),s}catch(o){return!1}}(v),y(!0),f.current=setTimeout(()=>y(!1),2e3))},[i,v]),C="compact"===l?"data-box-compact":"responsive"===l?"data-box-responsive":"",N=i?d||`Click to copy: ${v}`:d;return i?t.jsxs("button",{type:"button",onClick:j,onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),className:o("data-box interactive",C,"cursor-pointer select-none gap-1","hover-bg",u,p),title:N,"aria-label":`Copy ${v}`,children:[t.jsx("span",{className:o("transition-colors duration-200",x?"text-sys-green":""),children:g}),t.jsx("span",{className:o("flex items-center justify-center","compact"===l?"w-3 h-3":"w-3.5 h-3.5"),children:x?t.jsx(n,{className:o("text-sys-green",b)}):t.jsx(s,{className:o("transition-opacity duration-200",h?"opacity-70":"opacity-40",b)})})]}):t.jsx("span",{className:o("data-box",C,u,p),title:N,children:g})}export{r as D}; +import{r as e,j as t,c as o}from"./vendor-react-j_fHog8x.js";import{o as n}from"./index-BBcIGlRT.js";import{C as s}from"./copy-C_IB0gEd.js";const a={standard:"w-3 h-3",compact:"w-2.5 h-2.5",responsive:"w-2.5 h-2.5 sm:w-3 sm:h-3"};function r({children:r,copyValue:c,copy:i=!1,size:l="standard",className:p,title:d,color:u,truncate:m}){const[x,y]=e.useState(!1),[h,w]=e.useState(!1),f=e.useRef(null),v=c??("string"==typeof r?r:""),b=a[l],g=(()=>{if(!m||"string"!=typeof r)return r;const e=r,[t,o]=!0===m?[6,4]:m;return e.length<=t+o+3?e:`${e.slice(0,t)}…${e.slice(-o)}`})(),j=e.useCallback(e=>{i&&(e.preventDefault(),e.stopPropagation(),f.current&&clearTimeout(f.current),function(e){var t;if("undefined"!=typeof window&&(window.isSecureContext||"https:"===window.location.protocol||"localhost"===window.location.hostname)&&(null==(t=navigator.clipboard)?void 0:t.writeText))return navigator.clipboard.writeText(e).catch(()=>{}),!0;try{const{scrollX:t,scrollY:o}=window,n=document.createElement("textarea");n.value=e,n.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;pointer-events:none",n.setAttribute("readonly",""),document.body.appendChild(n),n.focus({preventScroll:!0}),n.select(),n.setSelectionRange(0,e.length);const s=document.execCommand("copy");return document.body.removeChild(n),window.scrollTo(t,o),s}catch(o){return!1}}(v),y(!0),f.current=setTimeout(()=>y(!1),2e3))},[i,v]),C="compact"===l?"data-box-compact":"responsive"===l?"data-box-responsive":"",N=i?d||`Click to copy: ${v}`:d;return i?t.jsxs("button",{type:"button",onClick:j,onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),className:o("data-box interactive",C,"cursor-pointer select-none gap-1","hover-bg",u,p),title:N,"aria-label":`Copy ${v}`,children:[t.jsx("span",{className:o("transition-colors duration-200",x?"text-sys-green":""),children:g}),t.jsx("span",{className:o("flex items-center justify-center","compact"===l?"w-3 h-3":"w-3.5 h-3.5"),children:x?t.jsx(n,{className:o("text-sys-green",b)}):t.jsx(s,{className:o("transition-opacity duration-200",h?"opacity-70":"opacity-40",b)})})]}):t.jsx("span",{className:o("data-box",C,u,p),title:N,children:g})}export{r as D}; diff --git a/frontend/dist/assets/DeepAnalysisModal-BWClcGsg.js b/frontend/dist/assets/DeepAnalysisModal--yROqPOt.js similarity index 97% rename from frontend/dist/assets/DeepAnalysisModal-BWClcGsg.js rename to frontend/dist/assets/DeepAnalysisModal--yROqPOt.js index 3b8c15cb..d254de38 100644 --- a/frontend/dist/assets/DeepAnalysisModal-BWClcGsg.js +++ b/frontend/dist/assets/DeepAnalysisModal--yROqPOt.js @@ -1 +1 @@ -import{c as e,a8 as t,bS as s,bT as n,aH as a,dE as i,dF as o,W as r,dG as l,X as c,m as u,o as f,aD as h,L as m}from"./index-01Tx8g53.js";import{c as d,D as g}from"./geo-utils-D72kdxDo.js";import{r as p,j as x,c as y}from"./vendor-react-j_fHog8x.js";import{G as b}from"./git-branch-Bz_gqcbv.js";import{D as j}from"./database-Cxl-xDNL.js";const v=e("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),k=e("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),M=e("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),w=e("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]);class N{constructor(){this.componentControls=new Set}subscribe(e){return this.componentControls.add(e),()=>this.componentControls.delete(e)}start(e,t){this.componentControls.forEach(s=>{s.start(e.nativeEvent||e,t)})}cancel(){this.componentControls.forEach(e=>{e.cancel()})}stop(){this.componentControls.forEach(e=>{e.stop()})}}const C=()=>new N;function A(){return t(C)}const H={hidden:{opacity:0,scale:.9},visible:{opacity:1,scale:1,transition:{type:"spring",stiffness:400,damping:15}},exit:{opacity:0,scale:.9,transition:{duration:n.fast}}},T={hidden:{opacity:0,y:"100%"},visible:{opacity:1,y:0,transition:{type:"spring",stiffness:400,damping:30}},exit:{opacity:0,y:"100%",transition:{duration:n.medium,ease:s.easeIn}}};function D(e,t){let s=0;for(let n=0;n0)for(let s=0;sArray(t).fill(0));for(let n=0;nArray(t).fill(0));for(let r=0;r43758.5453*Math.sin(12.9898*t)%1-.5);z(i,s),V(i);let o=0;for(let r=0;r<100;r++){const e=E(a,i);z(e,s);const t=D(e,e)/D(i,e);if(V(e),i=e,Math.abs(t-o)<1e-8)return{vector:i,eigenvalue:n-t};o=t}return{vector:i,eigenvalue:n-o}}function P(e,t){if(e.length<2)return 0;const s=[];for(const o of e){const e=t.get(o);e&&s.push(e)}if(s.length<2)return 0;const n=Math.min(s.length,20),a=s.length<=n?s:function(e,t){if(t>=e.length)return e;const s=[],n=e.length/t;for(let a=0;ai.has(e.fromHash)&&i.has(e.toHash));if(0===o.length)return null;const r=function(e,t,s,n){const a=t.length,i=new Map(t.map((e,t)=>[e,t])),o=Array(a).fill(null).map(()=>Array(a).fill(0));for(const r of e){const e=i.get(r.fromHash),t=i.get(r.toHash);if(void 0!==e&&void 0!==t&&e!==t){const a=r.strength*r.certainCount;let i=1;if(s){const e=s.get(r.fromHash),t=s.get(r.toHash);e&&t&&(i=L(d(e[0],e[1],t[0],t[1])/1e3))}let l=1;if(n){const e=[r.fromHash,r.toHash].sort().join("-");l=1-.7*(n.get(e)??0)}const c=.3+.7*(r.symmetryRatio??0),u=Math.pow(a,.7)*Math.pow(i,.3)*l*c;o[e][t]=u,o[t][e]=u}}return o}(o,t,s,n),l=S(r),{vector:c,eigenvalue:u}=F(l);if(u<.001)return null;const f=[],h=[];for(let m=0;m({hash:e,community:0,fiedlerValue:0})),numCommunities:1,fiedlerValue:0,isConnected:a<=1};const i=[];let o=1/0;const r=[[t,0]];for(;r.length>0;){const[t,a]=r.shift();if((s?P(t,s):0)>20&&a<4&&t.length>=10){const i=O(e,t,s,n);if(i){o=Math.min(o,i.fiedlerValue),r.push([i.group0,a+1]),r.push([i.group1,a+1]);continue}}i.push(t)}const l=new Map,c=[],u=new Map;for(let f=0;f[e,t])),a=Array(s).fill(null).map(()=>Array(s).fill(0));for(const r of e){const e=n.get(r.fromHash),t=n.get(r.toHash);void 0!==e&&void 0!==t&&e!==t&&(a[e][t]=1,a[t][e]=1)}const i=S(a),{eigenvalue:o}=F(i);return Math.max(0,o)}function R(e){const t=["rgba(139, 92, 246, 0.6)","rgba(16, 185, 129, 0.6)","rgba(245, 158, 11, 0.6)","rgba(239, 68, 68, 0.6)","rgba(59, 130, 246, 0.6)","rgba(236, 72, 153, 0.6)","rgba(20, 184, 166, 0.6)","rgba(249, 115, 22, 0.6)"];return t[e%t.length]}function B({label:e,icon:t,status:s,detail:n}){return x.jsxs("div",{className:y("flex items-center gap-3 py-3 px-4 radius-inset transition-base","active"===s&&"bg-sys-blue/10","complete"===s&&"bg-sys-blue/10 ring-2 ring-inset ring-sys-blue","pending"===s&&"opacity-40"),children:[x.jsx("div",{className:y("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-all duration-300","active"===s&&"bg-sys-blue/20","complete"===s&&"bg-sys-blue/20","pending"===s&&"bg-subtle-fill"),children:"complete"===s?x.jsx(f,{className:"w-4 h-4 text-sys-blue"}):"active"===s?x.jsx(m,{className:"w-4 h-4 animate-spin text-sys-blue"}):x.jsx("span",{className:"text-fg-muted",children:t})}),x.jsxs("div",{className:"flex-1 min-w-0",children:[x.jsx("div",{className:y("text-sm font-medium transition-colors","active"===s&&"text-sys-blue","complete"===s&&"text-sys-blue","pending"===s&&"text-fg-muted"),children:e}),n&&"pending"!==s&&x.jsx("div",{className:"text-xs text-fg-muted mt-0.5 truncate",children:n})]})]})}const I=p.memo(function({isOpen:e,onClose:t}){const{packetCacheState:s,triggerDeepAnalysis:n}=a(),m=i(),d=o(),y=s.packetCount,[v,k]=p.useState("fetching");p.useEffect(()=>{e&&n()},[e,n]),p.useEffect(()=>{if(e)if(s.isTopologyLoading)k("fetching");else if(m)k("analyzing"),setTimeout(()=>k("building"),500),setTimeout(()=>k("discovering"),1e3);else if(d>0&&!s.isTopologyLoading){k("complete");const e=setTimeout(()=>{t()},1500);return()=>clearTimeout(e)}},[e,s.isTopologyLoading,m,d,t]);const M="complete"===v,w=s.loadProgress,N=p.useMemo(()=>w&&w.target>0?`Loading... ${(w.loaded/1e3).toFixed(1)}k / ${(w.target/1e3).toFixed(1)}k packets (${w.percent}%)`:y>0?`${y.toLocaleString()} packets loaded`:"Connecting to database...",[w,y]),C=e=>{const t=["fetching","analyzing","building","discovering","complete"],s=t.indexOf(v),n=t.indexOf(e);return n{};return x.jsx(r,{open:e,onClose:A,size:"sm",bottomSheet:!1,children:x.jsx(l,{isLoading:!M,borderRadius:16,children:x.jsx(c,{className:"p-6 radius-card overflow-hidden",children:M?x.jsxs("div",{className:"flex flex-col items-center py-6",children:[x.jsx(u.div,{variants:H,initial:"hidden",animate:"visible",className:"w-16 h-16 rounded-full flex items-center justify-center mb-4 bg-sys-blue/20",children:x.jsx(f,{className:"w-8 h-8 text-sys-blue"})}),x.jsx("h3",{className:"type-micro text-sys-blue",children:"Ready!"}),x.jsx("button",{onClick:t,className:"mt-3 sm:hidden min-h-[44px] min-w-[44px] px-4 flex items-center justify-center text-[15px] font-medium text-sys-blue active:text-sys-blue/70 transition-base radius-inner active:bg-subtle-fill",children:"Done"})]}):x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[x.jsx("div",{className:"w-10 h-10 radius-inset flex items-center justify-center bg-sys-blue/15",children:x.jsx(b,{className:"w-5 h-5 text-sys-blue"})}),x.jsxs("div",{children:[x.jsx("h3",{className:"type-micro",children:"Deep Analysis"}),x.jsx("p",{className:"text-xs text-fg-muted",children:"Building mesh topology"})]})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx(B,{label:"Fetching Packets",icon:x.jsx(g,{className:"w-4 h-4"}),status:C("fetching"),detail:N}),x.jsx(B,{label:"Analyzing Database",icon:x.jsx(j,{className:"w-4 h-4"}),status:C("analyzing"),detail:"Processing packet paths"}),x.jsx(B,{label:"Building Topology",icon:x.jsx(b,{className:"w-4 h-4"}),status:C("building"),detail:"Computing mesh edges"}),x.jsx(B,{label:"Discovering Nodes",icon:x.jsx(h,{className:"w-4 h-4"}),status:C("discovering"),detail:"Viterbi HMM ghost detection"})]}),x.jsx("p",{className:"text-xs text-fg-muted text-center mt-5",children:"This may take a few seconds..."})]})})})})});export{I as D,v as E,k as G,M,w as a,q as b,G as c,$ as d,R as g,T as s,A as u}; +import{c as e,a8 as t,bS as s,bT as n,aH as a,dE as i,dF as o,W as r,dG as l,X as c,m as u,o as f,aD as h,L as m}from"./index-BBcIGlRT.js";import{c as d,D as g}from"./geo-utils-BJfOkt8p.js";import{r as p,j as x,c as y}from"./vendor-react-j_fHog8x.js";import{G as b}from"./git-branch-CaPGs8Pg.js";import{D as j}from"./database-CO202xKy.js";const v=e("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),k=e("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),M=e("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),w=e("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]);class N{constructor(){this.componentControls=new Set}subscribe(e){return this.componentControls.add(e),()=>this.componentControls.delete(e)}start(e,t){this.componentControls.forEach(s=>{s.start(e.nativeEvent||e,t)})}cancel(){this.componentControls.forEach(e=>{e.cancel()})}stop(){this.componentControls.forEach(e=>{e.stop()})}}const C=()=>new N;function A(){return t(C)}const H={hidden:{opacity:0,scale:.9},visible:{opacity:1,scale:1,transition:{type:"spring",stiffness:400,damping:15}},exit:{opacity:0,scale:.9,transition:{duration:n.fast}}},T={hidden:{opacity:0,y:"100%"},visible:{opacity:1,y:0,transition:{type:"spring",stiffness:400,damping:30}},exit:{opacity:0,y:"100%",transition:{duration:n.medium,ease:s.easeIn}}};function D(e,t){let s=0;for(let n=0;n0)for(let s=0;sArray(t).fill(0));for(let n=0;nArray(t).fill(0));for(let r=0;r43758.5453*Math.sin(12.9898*t)%1-.5);z(i,s),V(i);let o=0;for(let r=0;r<100;r++){const e=E(a,i);z(e,s);const t=D(e,e)/D(i,e);if(V(e),i=e,Math.abs(t-o)<1e-8)return{vector:i,eigenvalue:n-t};o=t}return{vector:i,eigenvalue:n-o}}function P(e,t){if(e.length<2)return 0;const s=[];for(const o of e){const e=t.get(o);e&&s.push(e)}if(s.length<2)return 0;const n=Math.min(s.length,20),a=s.length<=n?s:function(e,t){if(t>=e.length)return e;const s=[],n=e.length/t;for(let a=0;ai.has(e.fromHash)&&i.has(e.toHash));if(0===o.length)return null;const r=function(e,t,s,n){const a=t.length,i=new Map(t.map((e,t)=>[e,t])),o=Array(a).fill(null).map(()=>Array(a).fill(0));for(const r of e){const e=i.get(r.fromHash),t=i.get(r.toHash);if(void 0!==e&&void 0!==t&&e!==t){const a=r.strength*r.certainCount;let i=1;if(s){const e=s.get(r.fromHash),t=s.get(r.toHash);e&&t&&(i=L(d(e[0],e[1],t[0],t[1])/1e3))}let l=1;if(n){const e=[r.fromHash,r.toHash].sort().join("-");l=1-.7*(n.get(e)??0)}const c=.3+.7*(r.symmetryRatio??0),u=Math.pow(a,.7)*Math.pow(i,.3)*l*c;o[e][t]=u,o[t][e]=u}}return o}(o,t,s,n),l=S(r),{vector:c,eigenvalue:u}=F(l);if(u<.001)return null;const f=[],h=[];for(let m=0;m({hash:e,community:0,fiedlerValue:0})),numCommunities:1,fiedlerValue:0,isConnected:a<=1};const i=[];let o=1/0;const r=[[t,0]];for(;r.length>0;){const[t,a]=r.shift();if((s?P(t,s):0)>20&&a<4&&t.length>=10){const i=O(e,t,s,n);if(i){o=Math.min(o,i.fiedlerValue),r.push([i.group0,a+1]),r.push([i.group1,a+1]);continue}}i.push(t)}const l=new Map,c=[],u=new Map;for(let f=0;f[e,t])),a=Array(s).fill(null).map(()=>Array(s).fill(0));for(const r of e){const e=n.get(r.fromHash),t=n.get(r.toHash);void 0!==e&&void 0!==t&&e!==t&&(a[e][t]=1,a[t][e]=1)}const i=S(a),{eigenvalue:o}=F(i);return Math.max(0,o)}function R(e){const t=["rgba(139, 92, 246, 0.6)","rgba(16, 185, 129, 0.6)","rgba(245, 158, 11, 0.6)","rgba(239, 68, 68, 0.6)","rgba(59, 130, 246, 0.6)","rgba(236, 72, 153, 0.6)","rgba(20, 184, 166, 0.6)","rgba(249, 115, 22, 0.6)"];return t[e%t.length]}function B({label:e,icon:t,status:s,detail:n}){return x.jsxs("div",{className:y("flex items-center gap-3 py-3 px-4 radius-inset transition-base","active"===s&&"bg-sys-blue/10","complete"===s&&"bg-sys-blue/10 ring-2 ring-inset ring-sys-blue","pending"===s&&"opacity-40"),children:[x.jsx("div",{className:y("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-all duration-300","active"===s&&"bg-sys-blue/20","complete"===s&&"bg-sys-blue/20","pending"===s&&"bg-subtle-fill"),children:"complete"===s?x.jsx(f,{className:"w-4 h-4 text-sys-blue"}):"active"===s?x.jsx(m,{className:"w-4 h-4 animate-spin text-sys-blue"}):x.jsx("span",{className:"text-fg-muted",children:t})}),x.jsxs("div",{className:"flex-1 min-w-0",children:[x.jsx("div",{className:y("text-sm font-medium transition-colors","active"===s&&"text-sys-blue","complete"===s&&"text-sys-blue","pending"===s&&"text-fg-muted"),children:e}),n&&"pending"!==s&&x.jsx("div",{className:"text-xs text-fg-muted mt-0.5 truncate",children:n})]})]})}const I=p.memo(function({isOpen:e,onClose:t}){const{packetCacheState:s,triggerDeepAnalysis:n}=a(),m=i(),d=o(),y=s.packetCount,[v,k]=p.useState("fetching");p.useEffect(()=>{e&&n()},[e,n]),p.useEffect(()=>{if(e)if(s.isTopologyLoading)k("fetching");else if(m)k("analyzing"),setTimeout(()=>k("building"),500),setTimeout(()=>k("discovering"),1e3);else if(d>0&&!s.isTopologyLoading){k("complete");const e=setTimeout(()=>{t()},1500);return()=>clearTimeout(e)}},[e,s.isTopologyLoading,m,d,t]);const M="complete"===v,w=s.loadProgress,N=p.useMemo(()=>w&&w.target>0?`Loading... ${(w.loaded/1e3).toFixed(1)}k / ${(w.target/1e3).toFixed(1)}k packets (${w.percent}%)`:y>0?`${y.toLocaleString()} packets loaded`:"Connecting to database...",[w,y]),C=e=>{const t=["fetching","analyzing","building","discovering","complete"],s=t.indexOf(v),n=t.indexOf(e);return n{};return x.jsx(r,{open:e,onClose:A,size:"sm",bottomSheet:!1,children:x.jsx(l,{isLoading:!M,borderRadius:16,children:x.jsx(c,{className:"p-6 radius-card overflow-hidden",children:M?x.jsxs("div",{className:"flex flex-col items-center py-6",children:[x.jsx(u.div,{variants:H,initial:"hidden",animate:"visible",className:"w-16 h-16 rounded-full flex items-center justify-center mb-4 bg-sys-blue/20",children:x.jsx(f,{className:"w-8 h-8 text-sys-blue"})}),x.jsx("h3",{className:"type-micro text-sys-blue",children:"Ready!"}),x.jsx("button",{onClick:t,className:"mt-3 sm:hidden min-h-[44px] min-w-[44px] px-4 flex items-center justify-center text-[15px] font-medium text-sys-blue active:text-sys-blue/70 transition-base radius-inner active:bg-subtle-fill",children:"Done"})]}):x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[x.jsx("div",{className:"w-10 h-10 radius-inset flex items-center justify-center bg-sys-blue/15",children:x.jsx(b,{className:"w-5 h-5 text-sys-blue"})}),x.jsxs("div",{children:[x.jsx("h3",{className:"type-micro",children:"Deep Analysis"}),x.jsx("p",{className:"text-xs text-fg-muted",children:"Building mesh topology"})]})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx(B,{label:"Fetching Packets",icon:x.jsx(g,{className:"w-4 h-4"}),status:C("fetching"),detail:N}),x.jsx(B,{label:"Analyzing Database",icon:x.jsx(j,{className:"w-4 h-4"}),status:C("analyzing"),detail:"Processing packet paths"}),x.jsx(B,{label:"Building Topology",icon:x.jsx(b,{className:"w-4 h-4"}),status:C("building"),detail:"Computing mesh edges"}),x.jsx(B,{label:"Discovering Nodes",icon:x.jsx(h,{className:"w-4 h-4"}),status:C("discovering"),detail:"Viterbi HMM ghost detection"})]}),x.jsx("p",{className:"text-xs text-fg-muted text-center mt-5",children:"This may take a few seconds..."})]})})})})});export{I as D,v as E,k as G,M,w as a,q as b,G as c,$ as d,R as g,T as s,A as u}; diff --git a/frontend/dist/assets/DelayedAnimateNumber-Ix4AeV6C.js b/frontend/dist/assets/DelayedAnimateNumber-CRcNKpk-.js similarity index 86% rename from frontend/dist/assets/DelayedAnimateNumber-Ix4AeV6C.js rename to frontend/dist/assets/DelayedAnimateNumber-CRcNKpk-.js index 47db2c0e..92f05e61 100644 --- a/frontend/dist/assets/DelayedAnimateNumber-Ix4AeV6C.js +++ b/frontend/dist/assets/DelayedAnimateNumber-CRcNKpk-.js @@ -1 +1 @@ -import{c as e,ba as a}from"./index-01Tx8g53.js";import{r as t,j as s}from"./vendor-react-j_fHog8x.js";import{A as n}from"./index-D932VMrD.js";const r=e("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);function i({value:e,format:r,prefix:i,className:o,style:m}){const[c,l]=t.useState("waiting");if(t.useEffect(()=>{const e=setTimeout(()=>l("mounted"),400);return()=>clearTimeout(e)},[]),t.useEffect(()=>{if("mounted"===c){const e=requestAnimationFrame(()=>l("animating"));return()=>cancelAnimationFrame(e)}},[c]),"waiting"===c){const e=(0).toLocaleString(void 0,r);return s.jsxs("span",{className:o,style:m,children:[i,e]})}return s.jsx(n,{className:o,style:m,format:r,prefix:i,transition:a.numberReveal,children:"animating"===c?e:0})}export{i as D,r as H}; +import{c as e,ba as a}from"./index-BBcIGlRT.js";import{r as t,j as s}from"./vendor-react-j_fHog8x.js";import{A as n}from"./index-CCvUM2Hn.js";const r=e("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);function i({value:e,format:r,prefix:i,className:o,style:m}){const[c,l]=t.useState("waiting");if(t.useEffect(()=>{const e=setTimeout(()=>l("mounted"),400);return()=>clearTimeout(e)},[]),t.useEffect(()=>{if("mounted"===c){const e=requestAnimationFrame(()=>l("animating"));return()=>cancelAnimationFrame(e)}},[c]),"waiting"===c){const e=(0).toLocaleString(void 0,r);return s.jsxs("span",{className:o,style:m,children:[i,e]})}return s.jsx(n,{className:o,style:m,format:r,prefix:i,transition:a.numberReveal,children:"animating"===c?e:0})}export{i as D,r as H}; diff --git a/frontend/dist/assets/KeycapButton-6IH7dZJL.js b/frontend/dist/assets/KeycapButton-Dvk7y-ZW.js similarity index 98% rename from frontend/dist/assets/KeycapButton-6IH7dZJL.js rename to frontend/dist/assets/KeycapButton-Dvk7y-ZW.js index ccd3cd7b..38bad577 100644 --- a/frontend/dist/assets/KeycapButton-6IH7dZJL.js +++ b/frontend/dist/assets/KeycapButton-Dvk7y-ZW.js @@ -1 +1 @@ -import{bY as e,Z as a}from"./index-01Tx8g53.js";import{r as c,j as s}from"./vendor-react-j_fHog8x.js";import{b as n,c as t}from"./keycap-sfx-CAsrNe23.js";async function d(a){return e("/api/acl_remove_client",{method:"POST",body:JSON.stringify(a)})}async function r(){return e("/api/acl_stats")}const i={a:"24,3 76,3 83,7 76,11 24,11 17,7",b:"88,22 93,27 93,71 88,76 83,71 83,27",c:"88,106 93,111 93,155 88,160 83,155 83,111",d:"24,171 76,171 83,175 76,179 24,179 17,175",e:"12,106 17,111 17,155 12,160 7,155 7,111",f:"12,22 17,27 17,71 12,76 7,71 7,27",g:"24,86 76,86 83,91 76,96 24,96 17,91"},o=Object.keys(i),l={0:"abcdef",1:"bc",2:"abdeg",3:"abcdg",4:"bcfg",5:"acdfg",6:"acdefg",7:"abc",8:"abcdefg",9:"abcdfg",A:"abcefg",B:"cdefg",C:"adef",D:"bcdeg",E:"adefg",F:"aefg",G:"acdef",H:"bcefg",I:"ef",J:"bcde",L:"def",M:"abcefg",N:"ceg",O:"abcdef",P:"abefg",Q:"abcfg",R:"eg",S:"acdfg",T:"defg",U:"bcdef",V:"cde",Y:"bcdfg",Z:"abdeg",a:"abcefg",b:"cdefg",c:"deg",d:"bcdeg",e:"adefg",f:"aefg",g:"abcdfg",h:"cefg",i:"c",j:"bcde",l:"def",m:"abcef",n:"ceg",o:"cdeg",p:"abefg",r:"eg",s:"acdfg",t:"defg",u:"cde",v:"cde",y:"bcdfg"," ":"",_:"d","-":"g","=":"dg","°":"abfg",'"':"bf","'":"f","(":"adef",")":"abcd","[":"adef","]":"abcd","!":"bc",".":"d"};function g(e,a){const c=Array.from(e).map(e=>l[e.toUpperCase()]??l[e]??""),s=Math.max(0,(a??0)-e.length);for(let n=0;n{if(d)return;const a=g(e,t),c=6+2*(a.length-1);let s,n=0,r=!1;const i=()=>{r||(n++,n>=c?b(null):(b(a.map((e,a)=>n>=6+2*a?e:o.filter(()=>Math.random()>.45).join(""))),s=setTimeout(i,56)))};return i(),()=>{r=!0,clearTimeout(s)}},[e,t,d]);const m=g(e,t),p=u??m;return s.jsxs("span",{className:"seven-seg"+(r?` ${r}`:""),children:[p.map((e,c)=>((e,c)=>s.jsx("svg",{viewBox:"0 0 100 182",width:l,height:n,className:"seven-seg__char","aria-hidden":"true",children:o.map(c=>s.jsx("polygon",{points:i[c],fill:a,stroke:a,strokeWidth:4,strokeLinejoin:"round",opacity:e.includes(c)?1:f},c))},c))(e,`${c}-${e}`)),s.jsx("span",{className:"sr-only",children:e})]})}const u={grey:"/assets/keycap.svg",red:"/assets/keycap-red.svg"},b=a[900];function m({icon:e,variant:a="grey",onClick:d,onPress:r,sentDuration:i=2e3,title:o,disabled:l=!1,className:g,iconColor:f=b,iconActiveColor:m="#FFDEB0",indicators:p}){const h=!!r,[y,k]=c.useState("idle"),[j,v]=c.useState(!1),x=c.useRef(),N=h?"held"===y:j,C=h&&("sending"===y||"sent"===y),_=h?"held"===y||"sending"===y:j;c.useEffect(()=>()=>clearTimeout(x.current),[]);const T=c.useCallback(()=>{l||C||(n(),h?k("held"):v(!0))},[l,C,h]),$=c.useCallback(async()=>{if(h){if("held"!==y)return;t(),k("sending");const e=await r();k(e?"sent":"idle"),e&&(x.current=setTimeout(()=>k("idle"),i))}else{if(!j)return;v(!1),t(),null==d||d()}},[h,y,r,i,j,d]),S=c.useCallback(()=>{h?"held"===y&&(t(),k("idle")):(j&&t(),v(!1))},[h,y,j]),M=s.jsx("button",{onMouseDown:T,onMouseUp:$,onMouseLeave:S,onTouchStart:T,onTouchEnd:$,onTouchCancel:S,disabled:l||C,className:`keycap-btn${"red"===a?" keycap-btn--red-cap":""}${_?" keycap-btn--pressed":""}${g&&!p?` ${g}`:""}`,title:o,children:s.jsxs("div",{className:"keycap-wrap",children:[s.jsx("img",{src:u[a],alt:"",className:"keycap-btn__img",draggable:!1}),s.jsx("span",{className:"keycap-icon-overlay",style:{color:N||"sending"===y?m:f},children:e})]})});return(null==p?void 0:p.length)?s.jsxs("div",{className:"keycap-group"+(g?` ${g}`:""),children:[M,s.jsx("div",{className:"indicator-key-pair",children:p.map(e=>{const a=e.trackPress?y:e.active?"active":"idle";return s.jsxs("div",{className:"indicator-key"+("idle"!==a?` indicator-key--${a}`:""),children:[s.jsx("span",{className:"indicator-key__label",children:e.label}),s.jsx("span",{className:"indicator-key__led"})]},e.label)})})]}):M}export{m as K,f as S,r as g,d as r}; +import{bY as e,Z as a}from"./index-BBcIGlRT.js";import{r as c,j as s}from"./vendor-react-j_fHog8x.js";import{b as n,c as t}from"./keycap-sfx-CAsrNe23.js";async function d(a){return e("/api/acl_remove_client",{method:"POST",body:JSON.stringify(a)})}async function r(){return e("/api/acl_stats")}const i={a:"24,3 76,3 83,7 76,11 24,11 17,7",b:"88,22 93,27 93,71 88,76 83,71 83,27",c:"88,106 93,111 93,155 88,160 83,155 83,111",d:"24,171 76,171 83,175 76,179 24,179 17,175",e:"12,106 17,111 17,155 12,160 7,155 7,111",f:"12,22 17,27 17,71 12,76 7,71 7,27",g:"24,86 76,86 83,91 76,96 24,96 17,91"},o=Object.keys(i),l={0:"abcdef",1:"bc",2:"abdeg",3:"abcdg",4:"bcfg",5:"acdfg",6:"acdefg",7:"abc",8:"abcdefg",9:"abcdfg",A:"abcefg",B:"cdefg",C:"adef",D:"bcdeg",E:"adefg",F:"aefg",G:"acdef",H:"bcefg",I:"ef",J:"bcde",L:"def",M:"abcefg",N:"ceg",O:"abcdef",P:"abefg",Q:"abcfg",R:"eg",S:"acdfg",T:"defg",U:"bcdef",V:"cde",Y:"bcdfg",Z:"abdeg",a:"abcefg",b:"cdefg",c:"deg",d:"bcdeg",e:"adefg",f:"aefg",g:"abcdfg",h:"cefg",i:"c",j:"bcde",l:"def",m:"abcef",n:"ceg",o:"cdeg",p:"abefg",r:"eg",s:"acdfg",t:"defg",u:"cde",v:"cde",y:"bcdfg"," ":"",_:"d","-":"g","=":"dg","°":"abfg",'"':"bf","'":"f","(":"adef",")":"abcd","[":"adef","]":"abcd","!":"bc",".":"d"};function g(e,a){const c=Array.from(e).map(e=>l[e.toUpperCase()]??l[e]??""),s=Math.max(0,(a??0)-e.length);for(let n=0;n{if(d)return;const a=g(e,t),c=6+2*(a.length-1);let s,n=0,r=!1;const i=()=>{r||(n++,n>=c?b(null):(b(a.map((e,a)=>n>=6+2*a?e:o.filter(()=>Math.random()>.45).join(""))),s=setTimeout(i,56)))};return i(),()=>{r=!0,clearTimeout(s)}},[e,t,d]);const m=g(e,t),p=u??m;return s.jsxs("span",{className:"seven-seg"+(r?` ${r}`:""),children:[p.map((e,c)=>((e,c)=>s.jsx("svg",{viewBox:"0 0 100 182",width:l,height:n,className:"seven-seg__char","aria-hidden":"true",children:o.map(c=>s.jsx("polygon",{points:i[c],fill:a,stroke:a,strokeWidth:4,strokeLinejoin:"round",opacity:e.includes(c)?1:f},c))},c))(e,`${c}-${e}`)),s.jsx("span",{className:"sr-only",children:e})]})}const u={grey:"/assets/keycap.svg",red:"/assets/keycap-red.svg"},b=a[900];function m({icon:e,variant:a="grey",onClick:d,onPress:r,sentDuration:i=2e3,title:o,disabled:l=!1,className:g,iconColor:f=b,iconActiveColor:m="#FFDEB0",indicators:p}){const h=!!r,[y,k]=c.useState("idle"),[j,v]=c.useState(!1),x=c.useRef(),N=h?"held"===y:j,C=h&&("sending"===y||"sent"===y),_=h?"held"===y||"sending"===y:j;c.useEffect(()=>()=>clearTimeout(x.current),[]);const T=c.useCallback(()=>{l||C||(n(),h?k("held"):v(!0))},[l,C,h]),$=c.useCallback(async()=>{if(h){if("held"!==y)return;t(),k("sending");const e=await r();k(e?"sent":"idle"),e&&(x.current=setTimeout(()=>k("idle"),i))}else{if(!j)return;v(!1),t(),null==d||d()}},[h,y,r,i,j,d]),S=c.useCallback(()=>{h?"held"===y&&(t(),k("idle")):(j&&t(),v(!1))},[h,y,j]),M=s.jsx("button",{onMouseDown:T,onMouseUp:$,onMouseLeave:S,onTouchStart:T,onTouchEnd:$,onTouchCancel:S,disabled:l||C,className:`keycap-btn${"red"===a?" keycap-btn--red-cap":""}${_?" keycap-btn--pressed":""}${g&&!p?` ${g}`:""}`,title:o,children:s.jsxs("div",{className:"keycap-wrap",children:[s.jsx("img",{src:u[a],alt:"",className:"keycap-btn__img",draggable:!1}),s.jsx("span",{className:"keycap-icon-overlay",style:{color:N||"sending"===y?m:f},children:e})]})});return(null==p?void 0:p.length)?s.jsxs("div",{className:"keycap-group"+(g?` ${g}`:""),children:[M,s.jsx("div",{className:"indicator-key-pair",children:p.map(e=>{const a=e.trackPress?y:e.active?"active":"idle";return s.jsxs("div",{className:"indicator-key"+("idle"!==a?` indicator-key--${a}`:""),children:[s.jsx("span",{className:"indicator-key__label",children:e.label}),s.jsx("span",{className:"indicator-key__led"})]},e.label)})})]}):M}export{m as K,f as S,r as g,d as r}; diff --git a/frontend/dist/assets/Login-CQwX9eZS.js b/frontend/dist/assets/Login-Q9eTfSur.js similarity index 99% rename from frontend/dist/assets/Login-CQwX9eZS.js rename to frontend/dist/assets/Login-Q9eTfSur.js index 69a6fad3..0341c5cd 100644 --- a/frontend/dist/assets/Login-CQwX9eZS.js +++ b/frontend/dist/assets/Login-Q9eTfSur.js @@ -1 +1 @@ -import{r as e,j as s,c as t}from"./vendor-react-j_fHog8x.js";import{g as a,i,s as n,l as r,m as l,a as o,b as c,I as d,C as m,A as h,B as C,Z as x}from"./index-01Tx8g53.js";import{g as p,B as u,r as f,T as L}from"./ascii-burst-CXC_pYgi.js";import{a as g}from"./vendor-core-CmkNwW1A.js";import"./maplibre-gl-b91ci4Kr.js";const j=["@@@@@@@ @@@ @@@ @@@@@@@@@@ @@@@@@@ ","@@@@@@@@ @@@ @@@ @@@@@@@@@@@ @@@@@@@@ ","@@! @@@ @@! !@@ @@! @@! @@! !@@ ","!@! @!@ !@! @!! !@! !@! !@! !@! ","@!@@!@! !@!@! @!! !!@ @!@ !@! ","!!@!!! @!!! !@! ! !@! !!! ","!!: !!: !!: !!: :!! ",":!: :!: :!: :!: :!: "," :: :: ::: :: ::: ::: "," : : : : :: :: : "],y=L-1;function b(e){let s="",t=0,a=!1,i="",n=!1,r=!1,l=!1;for(;t",a=!1),i="",n=!1,r=!1,l=!1;else if("1"===c)n=!0,l=!0;else if("2"===c)r=!0,l=!0;else if(c.startsWith("38;2;")){const e=c.split(";");i=`rgb(${e[2]},${e[3]},${e[4]})`,l=!0}}else{if(l){a&&(s+="");const e=[];i&&e.push(`color:${i}`),n&&e.push("font-weight:700"),r&&e.push("opacity:0.6"),e.length>0?(s+=``,a=!0):a=!1,l=!1}const o=e[t];s+="<"===o?"<":">"===o?">":"&"===o?"&":o,t++}return a&&(s+=""),s}function v(e){let s="";for(let t=0;t0&&(s+="\n"),s+=b(e[t]);return s}const N=e.memo(function(){const t=e.useRef(null);return e.useEffect(()=>{const e=t.current;if(!e)return;let s=0;e.innerHTML=v(p(j,0));const a=setInterval(()=>{s++,s>y?clearInterval(a):e.innerHTML=v(p(j,s))},u);return()=>{clearInterval(a),f()}},[]),s.jsx("pre",{ref:t,"aria-label":"PYMC",role:"img",style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"16px",lineHeight:1.25,letterSpacing:"0.01em",textAlign:"center",whiteSpace:"pre",margin:0,overflow:"hidden"}})}),w=e.memo(function({width:e,height:t,className:a="",fill:i="currentColor"}){return s.jsxs("svg",{viewBox:"0 0 134 15",width:e,height:t,className:a,role:"img","aria-label":"MeshCore",style:{fillRule:"evenodd",clipRule:"evenodd"},children:[s.jsx("path",{fill:i,d:"M3.277,0.053C2.829,0.053 2.401,0.41 2.321,0.851L0.013,13.623C-0.067,14.064 0.232,14.421 0.681,14.421L3.13,14.421C3.578,14.421 4.006,14.064 4.086,13.623L5.004,8.54L6.684,13.957C6.766,14.239 7.02,14.421 7.337,14.421L10.58,14.421C10.897,14.421 11.217,14.239 11.401,13.957L15.043,8.513L14.119,13.623C14.038,14.064 14.338,14.421 14.787,14.421L17.236,14.421C17.684,14.421 18.112,14.064 18.192,13.623L20.5,0.851C20.582,0.41 20.283,0.053 19.834,0.053L16.69,0.053C16.373,0.053 16.053,0.235 15.87,0.517L9.897,9.473C9.803,9.616 9.578,9.578 9.528,9.41L7.074,0.517C6.992,0.235 6.738,0.053 6.421,0.053L3.277,0.053Z"}),s.jsx("path",{fill:i,d:"M21.146,14.421C21.146,14.421 33.257,14.421 33.257,14.421C33.526,14.421 33.784,14.205 33.831,13.942L34.337,11.128C34.385,10.863 34.206,10.649 33.936,10.649L25.519,10.649C25.429,10.649 25.37,10.576 25.385,10.488L25.635,9.105C25.65,9.017 25.736,8.944 25.826,8.944L32.596,8.944C32.865,8.944 33.123,8.728 33.171,8.465L33.621,5.974C33.669,5.709 33.49,5.495 33.221,5.495L26.45,5.495C26.361,5.495 26.301,5.423 26.317,5.335L26.584,3.852C26.599,3.764 26.685,3.691 26.775,3.691L35.192,3.691C35.462,3.691 35.719,3.476 35.767,3.21L36.258,0.498C36.306,0.235 36.126,0.019 35.857,0.019L23.746,0.019C23.297,0.019 22.867,0.378 22.788,0.819L20.474,13.621C20.396,14.062 20.695,14.421 21.146,14.421Z"}),s.jsx("path",{fill:i,d:"M45.926,14.419L45.926,14.421L46.346,14.421C48.453,14.421 50.465,12.742 50.839,10.67L51.081,9.327C51.456,7.256 50.05,5.576 47.943,5.576L41.455,5.576C41.186,5.576 41.007,5.363 41.054,5.097L41.218,4.192C41.266,3.927 41.524,3.713 41.793,3.713L50.569,3.713C51.018,3.713 51.446,3.356 51.526,2.915L51.9,0.85C51.98,0.407 51.68,0.05 51.232,0.05L41.638,0.05C39.531,0.05 37.519,1.73 37.145,3.801L36.88,5.267C36.505,7.339 37.91,9.018 40.018,9.018L46.506,9.018C46.775,9.018 46.954,9.231 46.907,9.497L46.785,10.176C46.737,10.441 46.479,10.655 46.21,10.655L37.189,10.655C36.741,10.655 36.313,11.012 36.233,11.453L35.841,13.621C35.761,14.062 36.061,14.419 36.51,14.419L45.926,14.419Z"}),s.jsx("path",{fill:i,d:"M68.008,0.046C68.008,0.046 65.296,0.046 65.296,0.046C64.847,0.046 64.42,0.403 64.34,0.844L63.532,5.31C63.517,5.398 63.431,5.469 63.341,5.469L58.085,5.469C57.995,5.469 57.936,5.398 57.951,5.31L58.758,0.844C58.837,0.403 58.539,0.046 58.09,0.046L55.378,0.046C54.93,0.046 54.502,0.403 54.422,0.844L52.112,13.623C52.032,14.064 52.331,14.421 52.78,14.421L55.492,14.421C55.941,14.421 56.369,14.064 56.449,13.623L57.272,9.074C57.287,8.986 57.373,8.914 57.462,8.914L62.719,8.914C62.809,8.914 62.868,8.985 62.853,9.074L62.032,13.623C61.952,14.064 62.252,14.421 62.7,14.421L65.413,14.421C65.861,14.421 66.289,14.064 66.369,13.623L68.678,0.844C68.755,0.403 68.457,0.046 68.008,0.046Z"}),s.jsx("path",{fill:i,d:"M72.099,14.421C72.099,14.421 80.066,14.421 80.066,14.421C80.515,14.421 80.943,14.064 81.022,13.623L81.414,11.453C81.494,11.012 81.194,10.655 80.746,10.655L73.828,10.655C73.559,10.655 73.38,10.441 73.427,10.176L74.51,4.215C74.558,3.951 74.815,3.736 75.082,3.736L82,3.736C82.448,3.736 82.876,3.379 82.956,2.938L83.34,0.817C83.42,0.376 83.12,0.019 82.672,0.019L74.724,0.019C72.622,0.019 70.614,1.691 70.236,3.757L68.965,10.665C68.587,12.738 69.99,14.421 72.099,14.421Z"}),s.jsx("path",{fill:i,d:"M97.176,-0C97.176,0 88.882,0 88.882,0C86.775,0 84.763,1.68 84.389,3.751L83.139,10.67C82.765,12.741 84.169,14.421 86.277,14.421L94.571,14.421C96.678,14.421 98.69,12.741 99.064,10.67L100.314,3.751C100.689,1.68 99.284,-0 97.176,-0ZM94.798,10.178C94.75,10.443 94.492,10.657 94.223,10.657L87.978,10.657C87.709,10.657 87.529,10.443 87.577,10.178L88.659,4.192C88.707,3.927 88.964,3.713 89.234,3.713L95.477,3.713C95.747,3.713 95.926,3.927 95.878,4.192L94.798,10.178Z"}),s.jsx("path",{fill:i,d:"M101.284,14.421L103.995,14.421C104.443,14.421 104.871,14.065 104.951,13.624L105.43,10.97C105.446,10.882 105.531,10.81 105.621,10.81L108.902,10.806C109.064,10.806 109.2,10.886 109.267,11.018L110.813,14.035C110.992,14.392 111.319,14.434 112.303,14.419C112.88,14.426 113.756,14.382 115.169,14.382C115.623,14.382 115.902,13.907 115.678,13.51L113.989,10.569C113.945,10.491 113.993,10.386 114.086,10.34C115.39,9.707 116.423,8.477 116.681,7.055L117.27,3.785C117.646,1.713 116.242,0.033 114.134,0.033L103.884,0.033C103.436,0.033 103.008,0.39 102.928,0.831L100.616,13.623C100.536,14.064 100.836,14.421 101.284,14.421L101.284,14.421ZM106.73,3.791C106.745,3.703 106.831,3.631 106.921,3.631L112.225,3.631C112.626,3.631 112.891,3.949 112.821,4.343L112.431,6.494C112.359,6.885 111.979,7.204 111.58,7.204L106.276,7.204C106.186,7.204 106.127,7.133 106.142,7.043L106.73,3.791Z"}),s.jsx("path",{fill:i,d:"M118.277,14.421C118.277,14.421 130.388,14.421 130.388,14.421C130.657,14.421 130.915,14.205 130.963,13.942L131.468,11.128C131.516,10.863 131.337,10.649 131.068,10.649L122.65,10.649C122.56,10.649 122.501,10.576 122.516,10.488L122.766,9.105C122.781,9.017 122.867,8.944 122.957,8.944L129.728,8.944C129.997,8.944 130.254,8.728 130.302,8.465L130.753,5.974C130.801,5.709 130.621,5.495 130.352,5.495L123.581,5.495C123.492,5.495 123.432,5.423 123.448,5.335L123.715,3.852C123.73,3.764 123.816,3.691 123.906,3.691L132.324,3.691C132.593,3.691 132.851,3.476 132.898,3.21L133.389,0.498C133.437,0.235 133.257,0.019 132.988,0.019L120.877,0.019C120.428,0.019 119.999,0.378 119.919,0.819L117.605,13.621C117.527,14.062 117.827,14.421 118.277,14.421Z"})]})}),M={container:{hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:o.normal,delayChildren:.1}}},item:{hidden:{opacity:0,y:12},visible:{opacity:1,y:0,transition:c.smooth}},footer:{hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{...c.gentle,delay:.4}}},error:{hidden:{opacity:0,height:0,marginTop:0},visible:{opacity:1,height:"auto",marginTop:24,transition:c.snappy},exit:{opacity:0,height:0,marginTop:0,transition:{duration:.15}}}},k=t("block type-badge text-fg-secondary"),S=e.memo(function({className:e}){return s.jsxs("svg",{className:t("animate-spin",e),viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),T=e.memo(function({href:e,children:t}){return s.jsx(l.a,{href:e,target:"_blank",rel:"noopener noreferrer",whileHover:{scale:1.05},whileTap:{scale:.98},className:"inline-flex items-center gap-1.5 opacity-60 hover:opacity-100 transition-opacity",children:t})}),Z=()=>s.jsx("span",{className:"text-white/20 text-xs","aria-hidden":"true",children:"•"}),z=e.memo(function(){return s.jsx("div",{className:"fixed inset-0 -z-10",style:{backgroundColor:x[950]},"aria-hidden":"true"})}),R=e.memo(function(){return s.jsxs(l.footer,{variants:M.footer,initial:"hidden",animate:"visible",className:"fixed bottom-0 inset-x-0 px-4 py-6",children:[s.jsx("p",{className:"text-center type-badge text-white/40 mb-3",children:"Powered By"}),s.jsx("div",{className:"mx-auto max-w-xs",children:s.jsxs("div",{className:"flex items-center justify-center gap-4",children:[s.jsx(T,{href:"https://github.com/rightup/pyMC_Repeater",children:s.jsxs("span",{className:"font-mono text-sm font-semibold tracking-tight",children:[s.jsx("span",{className:"text-sys-blue",children:"py"}),s.jsx("span",{className:"text-white",children:"MC"})]})}),s.jsx(Z,{}),s.jsx(T,{href:"https://meshcore.co.uk",children:s.jsx(w,{height:12,className:"text-white"})}),s.jsx(Z,{}),s.jsxs(T,{href:"https://wcmesh.com",children:[s.jsx("div",{className:"size-6 overflow-hidden radius-badge border border-white/10",children:s.jsx("img",{src:"/assets/WCM_Waves-RN-_ocPH.gif",alt:"",className:"size-full object-cover"})}),s.jsx("span",{className:"font-mono text-sm font-semibold tracking-tight text-white",children:"WCM"})]})]})})]})});function B(){const t=g(),[o,c]=e.useState("admin"),[x,p]=e.useState(""),[u,f]=e.useState(a),[L,j]=e.useState(!1),[y,b]=e.useState(null),v=o.length>0&&x.length>0&&!L;e.useEffect(()=>{i()&&t("/",{replace:!0})},[t]);const w=e.useCallback(()=>b(null),[]),T=e.useCallback(e=>{c(e.target.value),y&&w()},[y,w]),Z=e.useCallback(e=>{p(e.target.value),y&&w()},[y,w]),B=e.useCallback(e=>{f(e),n(e)},[]),H=e.useCallback(async e=>{if(e.preventDefault(),!v)return;j(!0),b(null);const s=await r(o,x,u);j(!1),s.success?window.location.href="/":b(s.error??"Login failed")},[v,o,x,u]),A=e.useCallback(e=>{"Enter"===e.key&&v&&"INPUT"===e.target.tagName&&(e.preventDefault(),e.currentTarget.requestSubmit())},[v]);return s.jsxs(s.Fragment,{children:[s.jsx(z,{}),s.jsx("main",{className:"flex min-h-svh items-center justify-center px-4 py-12 sm:px-6 lg:px-8",children:s.jsxs(l.div,{variants:M.container,initial:"hidden",animate:"visible",className:"w-full max-w-sm space-y-10",children:[s.jsx(l.div,{variants:M.item,className:"flex justify-center",children:s.jsx(N,{})}),s.jsxs(l.form,{variants:M.item,onSubmit:H,onKeyDown:A,className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("label",{htmlFor:"username",className:k,children:"Username"}),s.jsx("div",{className:"mt-2",children:s.jsx(d,{id:"username",name:"username",type:"text",value:o,onChange:T,required:!0,autoComplete:"username",autoFocus:!0,className:"font-mono text-sm font-semibold"})})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"password",className:k,children:"Password"}),s.jsx("div",{className:"mt-2",children:s.jsx(d,{id:"password",name:"password",type:"password",value:x,onChange:Z,required:!0,autoComplete:"current-password",className:"font-mono text-sm font-semibold"})})]}),s.jsx(m,{checked:u,onChange:B,label:s.jsx("span",{className:"type-badge text-fg-secondary",children:"Remember me"}),size:"sm"}),s.jsx(h,{mode:"wait",children:y&&s.jsx(l.div,{variants:M.error,initial:"hidden",animate:"visible",exit:"exit",role:"alert",className:"rounded-md bg-sys-red/10 p-3 overflow-hidden",children:s.jsx("p",{className:"text-sm text-sys-red text-center",children:y})},"error")}),s.jsx(l.div,{whileTap:v?{scale:.98}:void 0,children:s.jsx(C,{type:"submit",disabled:!v,className:"w-full font-mono text-sm font-semibold uppercase tracking-wide text-white bg-sys-indigo hover:bg-sys-blue shadow-sm transition-colors",children:L?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(S,{className:"size-4"}),"Signing in…"]}):"Sign in"})})]}),s.jsxs(l.p,{variants:M.item,className:"text-center text-sm/6 text-fg-muted",children:["A ",s.jsx("span",{className:"text-sys-blue",children:"@RightUp"})," X"," ",s.jsx("span",{className:"text-sys-blue",children:"@Treehouse⚡"})," Collab"]})]})}),s.jsx(R,{})]})}export{B as default}; +import{r as e,j as s,c as t}from"./vendor-react-j_fHog8x.js";import{g as a,i,s as n,l as r,m as l,a as o,b as c,I as d,C as m,A as h,B as C,Z as x}from"./index-BBcIGlRT.js";import{g as p,B as u,r as f,T as L}from"./ascii-burst-CXC_pYgi.js";import{a as g}from"./vendor-core-CmkNwW1A.js";import"./maplibre-gl-b91ci4Kr.js";const j=["@@@@@@@ @@@ @@@ @@@@@@@@@@ @@@@@@@ ","@@@@@@@@ @@@ @@@ @@@@@@@@@@@ @@@@@@@@ ","@@! @@@ @@! !@@ @@! @@! @@! !@@ ","!@! @!@ !@! @!! !@! !@! !@! !@! ","@!@@!@! !@!@! @!! !!@ @!@ !@! ","!!@!!! @!!! !@! ! !@! !!! ","!!: !!: !!: !!: :!! ",":!: :!: :!: :!: :!: "," :: :: ::: :: ::: ::: "," : : : : :: :: : "],y=L-1;function b(e){let s="",t=0,a=!1,i="",n=!1,r=!1,l=!1;for(;t",a=!1),i="",n=!1,r=!1,l=!1;else if("1"===c)n=!0,l=!0;else if("2"===c)r=!0,l=!0;else if(c.startsWith("38;2;")){const e=c.split(";");i=`rgb(${e[2]},${e[3]},${e[4]})`,l=!0}}else{if(l){a&&(s+="");const e=[];i&&e.push(`color:${i}`),n&&e.push("font-weight:700"),r&&e.push("opacity:0.6"),e.length>0?(s+=``,a=!0):a=!1,l=!1}const o=e[t];s+="<"===o?"<":">"===o?">":"&"===o?"&":o,t++}return a&&(s+=""),s}function v(e){let s="";for(let t=0;t0&&(s+="\n"),s+=b(e[t]);return s}const N=e.memo(function(){const t=e.useRef(null);return e.useEffect(()=>{const e=t.current;if(!e)return;let s=0;e.innerHTML=v(p(j,0));const a=setInterval(()=>{s++,s>y?clearInterval(a):e.innerHTML=v(p(j,s))},u);return()=>{clearInterval(a),f()}},[]),s.jsx("pre",{ref:t,"aria-label":"PYMC",role:"img",style:{fontFamily:"'JetBrains Mono', monospace",fontSize:"16px",lineHeight:1.25,letterSpacing:"0.01em",textAlign:"center",whiteSpace:"pre",margin:0,overflow:"hidden"}})}),w=e.memo(function({width:e,height:t,className:a="",fill:i="currentColor"}){return s.jsxs("svg",{viewBox:"0 0 134 15",width:e,height:t,className:a,role:"img","aria-label":"MeshCore",style:{fillRule:"evenodd",clipRule:"evenodd"},children:[s.jsx("path",{fill:i,d:"M3.277,0.053C2.829,0.053 2.401,0.41 2.321,0.851L0.013,13.623C-0.067,14.064 0.232,14.421 0.681,14.421L3.13,14.421C3.578,14.421 4.006,14.064 4.086,13.623L5.004,8.54L6.684,13.957C6.766,14.239 7.02,14.421 7.337,14.421L10.58,14.421C10.897,14.421 11.217,14.239 11.401,13.957L15.043,8.513L14.119,13.623C14.038,14.064 14.338,14.421 14.787,14.421L17.236,14.421C17.684,14.421 18.112,14.064 18.192,13.623L20.5,0.851C20.582,0.41 20.283,0.053 19.834,0.053L16.69,0.053C16.373,0.053 16.053,0.235 15.87,0.517L9.897,9.473C9.803,9.616 9.578,9.578 9.528,9.41L7.074,0.517C6.992,0.235 6.738,0.053 6.421,0.053L3.277,0.053Z"}),s.jsx("path",{fill:i,d:"M21.146,14.421C21.146,14.421 33.257,14.421 33.257,14.421C33.526,14.421 33.784,14.205 33.831,13.942L34.337,11.128C34.385,10.863 34.206,10.649 33.936,10.649L25.519,10.649C25.429,10.649 25.37,10.576 25.385,10.488L25.635,9.105C25.65,9.017 25.736,8.944 25.826,8.944L32.596,8.944C32.865,8.944 33.123,8.728 33.171,8.465L33.621,5.974C33.669,5.709 33.49,5.495 33.221,5.495L26.45,5.495C26.361,5.495 26.301,5.423 26.317,5.335L26.584,3.852C26.599,3.764 26.685,3.691 26.775,3.691L35.192,3.691C35.462,3.691 35.719,3.476 35.767,3.21L36.258,0.498C36.306,0.235 36.126,0.019 35.857,0.019L23.746,0.019C23.297,0.019 22.867,0.378 22.788,0.819L20.474,13.621C20.396,14.062 20.695,14.421 21.146,14.421Z"}),s.jsx("path",{fill:i,d:"M45.926,14.419L45.926,14.421L46.346,14.421C48.453,14.421 50.465,12.742 50.839,10.67L51.081,9.327C51.456,7.256 50.05,5.576 47.943,5.576L41.455,5.576C41.186,5.576 41.007,5.363 41.054,5.097L41.218,4.192C41.266,3.927 41.524,3.713 41.793,3.713L50.569,3.713C51.018,3.713 51.446,3.356 51.526,2.915L51.9,0.85C51.98,0.407 51.68,0.05 51.232,0.05L41.638,0.05C39.531,0.05 37.519,1.73 37.145,3.801L36.88,5.267C36.505,7.339 37.91,9.018 40.018,9.018L46.506,9.018C46.775,9.018 46.954,9.231 46.907,9.497L46.785,10.176C46.737,10.441 46.479,10.655 46.21,10.655L37.189,10.655C36.741,10.655 36.313,11.012 36.233,11.453L35.841,13.621C35.761,14.062 36.061,14.419 36.51,14.419L45.926,14.419Z"}),s.jsx("path",{fill:i,d:"M68.008,0.046C68.008,0.046 65.296,0.046 65.296,0.046C64.847,0.046 64.42,0.403 64.34,0.844L63.532,5.31C63.517,5.398 63.431,5.469 63.341,5.469L58.085,5.469C57.995,5.469 57.936,5.398 57.951,5.31L58.758,0.844C58.837,0.403 58.539,0.046 58.09,0.046L55.378,0.046C54.93,0.046 54.502,0.403 54.422,0.844L52.112,13.623C52.032,14.064 52.331,14.421 52.78,14.421L55.492,14.421C55.941,14.421 56.369,14.064 56.449,13.623L57.272,9.074C57.287,8.986 57.373,8.914 57.462,8.914L62.719,8.914C62.809,8.914 62.868,8.985 62.853,9.074L62.032,13.623C61.952,14.064 62.252,14.421 62.7,14.421L65.413,14.421C65.861,14.421 66.289,14.064 66.369,13.623L68.678,0.844C68.755,0.403 68.457,0.046 68.008,0.046Z"}),s.jsx("path",{fill:i,d:"M72.099,14.421C72.099,14.421 80.066,14.421 80.066,14.421C80.515,14.421 80.943,14.064 81.022,13.623L81.414,11.453C81.494,11.012 81.194,10.655 80.746,10.655L73.828,10.655C73.559,10.655 73.38,10.441 73.427,10.176L74.51,4.215C74.558,3.951 74.815,3.736 75.082,3.736L82,3.736C82.448,3.736 82.876,3.379 82.956,2.938L83.34,0.817C83.42,0.376 83.12,0.019 82.672,0.019L74.724,0.019C72.622,0.019 70.614,1.691 70.236,3.757L68.965,10.665C68.587,12.738 69.99,14.421 72.099,14.421Z"}),s.jsx("path",{fill:i,d:"M97.176,-0C97.176,0 88.882,0 88.882,0C86.775,0 84.763,1.68 84.389,3.751L83.139,10.67C82.765,12.741 84.169,14.421 86.277,14.421L94.571,14.421C96.678,14.421 98.69,12.741 99.064,10.67L100.314,3.751C100.689,1.68 99.284,-0 97.176,-0ZM94.798,10.178C94.75,10.443 94.492,10.657 94.223,10.657L87.978,10.657C87.709,10.657 87.529,10.443 87.577,10.178L88.659,4.192C88.707,3.927 88.964,3.713 89.234,3.713L95.477,3.713C95.747,3.713 95.926,3.927 95.878,4.192L94.798,10.178Z"}),s.jsx("path",{fill:i,d:"M101.284,14.421L103.995,14.421C104.443,14.421 104.871,14.065 104.951,13.624L105.43,10.97C105.446,10.882 105.531,10.81 105.621,10.81L108.902,10.806C109.064,10.806 109.2,10.886 109.267,11.018L110.813,14.035C110.992,14.392 111.319,14.434 112.303,14.419C112.88,14.426 113.756,14.382 115.169,14.382C115.623,14.382 115.902,13.907 115.678,13.51L113.989,10.569C113.945,10.491 113.993,10.386 114.086,10.34C115.39,9.707 116.423,8.477 116.681,7.055L117.27,3.785C117.646,1.713 116.242,0.033 114.134,0.033L103.884,0.033C103.436,0.033 103.008,0.39 102.928,0.831L100.616,13.623C100.536,14.064 100.836,14.421 101.284,14.421L101.284,14.421ZM106.73,3.791C106.745,3.703 106.831,3.631 106.921,3.631L112.225,3.631C112.626,3.631 112.891,3.949 112.821,4.343L112.431,6.494C112.359,6.885 111.979,7.204 111.58,7.204L106.276,7.204C106.186,7.204 106.127,7.133 106.142,7.043L106.73,3.791Z"}),s.jsx("path",{fill:i,d:"M118.277,14.421C118.277,14.421 130.388,14.421 130.388,14.421C130.657,14.421 130.915,14.205 130.963,13.942L131.468,11.128C131.516,10.863 131.337,10.649 131.068,10.649L122.65,10.649C122.56,10.649 122.501,10.576 122.516,10.488L122.766,9.105C122.781,9.017 122.867,8.944 122.957,8.944L129.728,8.944C129.997,8.944 130.254,8.728 130.302,8.465L130.753,5.974C130.801,5.709 130.621,5.495 130.352,5.495L123.581,5.495C123.492,5.495 123.432,5.423 123.448,5.335L123.715,3.852C123.73,3.764 123.816,3.691 123.906,3.691L132.324,3.691C132.593,3.691 132.851,3.476 132.898,3.21L133.389,0.498C133.437,0.235 133.257,0.019 132.988,0.019L120.877,0.019C120.428,0.019 119.999,0.378 119.919,0.819L117.605,13.621C117.527,14.062 117.827,14.421 118.277,14.421Z"})]})}),M={container:{hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:o.normal,delayChildren:.1}}},item:{hidden:{opacity:0,y:12},visible:{opacity:1,y:0,transition:c.smooth}},footer:{hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{...c.gentle,delay:.4}}},error:{hidden:{opacity:0,height:0,marginTop:0},visible:{opacity:1,height:"auto",marginTop:24,transition:c.snappy},exit:{opacity:0,height:0,marginTop:0,transition:{duration:.15}}}},k=t("block type-badge text-fg-secondary"),S=e.memo(function({className:e}){return s.jsxs("svg",{className:t("animate-spin",e),viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),T=e.memo(function({href:e,children:t}){return s.jsx(l.a,{href:e,target:"_blank",rel:"noopener noreferrer",whileHover:{scale:1.05},whileTap:{scale:.98},className:"inline-flex items-center gap-1.5 opacity-60 hover:opacity-100 transition-opacity",children:t})}),Z=()=>s.jsx("span",{className:"text-white/20 text-xs","aria-hidden":"true",children:"•"}),z=e.memo(function(){return s.jsx("div",{className:"fixed inset-0 -z-10",style:{backgroundColor:x[950]},"aria-hidden":"true"})}),R=e.memo(function(){return s.jsxs(l.footer,{variants:M.footer,initial:"hidden",animate:"visible",className:"fixed bottom-0 inset-x-0 px-4 py-6",children:[s.jsx("p",{className:"text-center type-badge text-white/40 mb-3",children:"Powered By"}),s.jsx("div",{className:"mx-auto max-w-xs",children:s.jsxs("div",{className:"flex items-center justify-center gap-4",children:[s.jsx(T,{href:"https://github.com/rightup/pyMC_Repeater",children:s.jsxs("span",{className:"font-mono text-sm font-semibold tracking-tight",children:[s.jsx("span",{className:"text-sys-blue",children:"py"}),s.jsx("span",{className:"text-white",children:"MC"})]})}),s.jsx(Z,{}),s.jsx(T,{href:"https://meshcore.co.uk",children:s.jsx(w,{height:12,className:"text-white"})}),s.jsx(Z,{}),s.jsxs(T,{href:"https://wcmesh.com",children:[s.jsx("div",{className:"size-6 overflow-hidden radius-badge border border-white/10",children:s.jsx("img",{src:"/assets/WCM_Waves-RN-_ocPH.gif",alt:"",className:"size-full object-cover"})}),s.jsx("span",{className:"font-mono text-sm font-semibold tracking-tight text-white",children:"WCM"})]})]})})]})});function B(){const t=g(),[o,c]=e.useState("admin"),[x,p]=e.useState(""),[u,f]=e.useState(a),[L,j]=e.useState(!1),[y,b]=e.useState(null),v=o.length>0&&x.length>0&&!L;e.useEffect(()=>{i()&&t("/",{replace:!0})},[t]);const w=e.useCallback(()=>b(null),[]),T=e.useCallback(e=>{c(e.target.value),y&&w()},[y,w]),Z=e.useCallback(e=>{p(e.target.value),y&&w()},[y,w]),B=e.useCallback(e=>{f(e),n(e)},[]),H=e.useCallback(async e=>{if(e.preventDefault(),!v)return;j(!0),b(null);const s=await r(o,x,u);j(!1),s.success?window.location.href="/":b(s.error??"Login failed")},[v,o,x,u]),A=e.useCallback(e=>{"Enter"===e.key&&v&&"INPUT"===e.target.tagName&&(e.preventDefault(),e.currentTarget.requestSubmit())},[v]);return s.jsxs(s.Fragment,{children:[s.jsx(z,{}),s.jsx("main",{className:"flex min-h-svh items-center justify-center px-4 py-12 sm:px-6 lg:px-8",children:s.jsxs(l.div,{variants:M.container,initial:"hidden",animate:"visible",className:"w-full max-w-sm space-y-10",children:[s.jsx(l.div,{variants:M.item,className:"flex justify-center",children:s.jsx(N,{})}),s.jsxs(l.form,{variants:M.item,onSubmit:H,onKeyDown:A,className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("label",{htmlFor:"username",className:k,children:"Username"}),s.jsx("div",{className:"mt-2",children:s.jsx(d,{id:"username",name:"username",type:"text",value:o,onChange:T,required:!0,autoComplete:"username",autoFocus:!0,className:"font-mono text-sm font-semibold"})})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"password",className:k,children:"Password"}),s.jsx("div",{className:"mt-2",children:s.jsx(d,{id:"password",name:"password",type:"password",value:x,onChange:Z,required:!0,autoComplete:"current-password",className:"font-mono text-sm font-semibold"})})]}),s.jsx(m,{checked:u,onChange:B,label:s.jsx("span",{className:"type-badge text-fg-secondary",children:"Remember me"}),size:"sm"}),s.jsx(h,{mode:"wait",children:y&&s.jsx(l.div,{variants:M.error,initial:"hidden",animate:"visible",exit:"exit",role:"alert",className:"rounded-md bg-sys-red/10 p-3 overflow-hidden",children:s.jsx("p",{className:"text-sm text-sys-red text-center",children:y})},"error")}),s.jsx(l.div,{whileTap:v?{scale:.98}:void 0,children:s.jsx(C,{type:"submit",disabled:!v,className:"w-full font-mono text-sm font-semibold uppercase tracking-wide text-white bg-sys-indigo hover:bg-sys-blue shadow-sm transition-colors",children:L?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(S,{className:"size-4"}),"Signing in…"]}):"Sign in"})})]}),s.jsxs(l.p,{variants:M.item,className:"text-center text-sm/6 text-fg-muted",children:["A ",s.jsx("span",{className:"text-sys-blue",children:"@RightUp"})," X"," ",s.jsx("span",{className:"text-sys-blue",children:"@Treehouse⚡"})," Collab"]})]})}),s.jsx(R,{})]})}export{B as default}; diff --git a/frontend/dist/assets/Logs-Df-7DFJ4.js b/frontend/dist/assets/Logs-B5-CJrX4.js similarity index 92% rename from frontend/dist/assets/Logs-Df-7DFJ4.js rename to frontend/dist/assets/Logs-B5-CJrX4.js index 9218fd29..47fef601 100644 --- a/frontend/dist/assets/Logs-Df-7DFJ4.js +++ b/frontend/dist/assets/Logs-B5-CJrX4.js @@ -1 +1 @@ -import{r as s,j as e,c as a}from"./vendor-react-j_fHog8x.js";import{c as l,bz as t,bA as c,r,bB as i,bC as o,bD as n,B as m,bE as d,bo as x,bF as p}from"./index-01Tx8g53.js";import{u as g}from"./usePolling-B1kG3uqm.js";import{P as h,b as j,B as u,a as y,L as b}from"./PageLayout-DrvMAhys.js";import{C as f}from"./Card-Dr9pbVV5.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CmkNwW1A.js";const v=l("circle-play",[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),N=l("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),w=s.memo(function({log:s}){return e.jsx("div",{className:"p-3 radius-card bg-subtle-fill hover:bg-subtle-fill-strong transition-base",children:e.jsxs("div",{className:"flex items-baseline gap-3",children:[e.jsx("span",{className:a("type-data-sm w-14 shrink-0",p(s.level)),children:s.level}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"type-data-sm text-fg-primary break-words whitespace-pre-wrap",children:s.message}),e.jsx("p",{className:"type-data-xs text-fg-muted mt-1",children:new Date(s.timestamp).toLocaleString()})]})]})})});function k({showDebug:s,onToggle:l}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:a("type-data-sm",s?"text-sys-orange":"text-sys-cyan"),children:s?"DEBUG":"INFO"}),e.jsx(x,{enabled:s,onChange:l,size:"sm"})]})}function C(){const l=t(),x=c(),p=r(),C=i(),D=o(),[B,L]=s.useState(!1),P=s.useCallback(()=>{L(s=>!s)},[]),E=B?l:l.filter(s=>"DEBUG"!==s.level);return g(C,d.logs,p),e.jsxs(h,{children:[e.jsx(j,{title:"System Logs",icon:e.jsx(n,{}),controls:e.jsx(k,{showDebug:B,onToggle:P})}),e.jsx(u,{children:e.jsxs(y,{neomorphic:!0,noPadding:!0,children:[e.jsx(f,{listHeader:!0,icon:e.jsx(n,{className:"icon-sm"}),title:"Log Entries",actions:e.jsx(m,{plain:!0,color:p?"danger":"primary",onClick:()=>D(!p),title:p?"Pause":"Resume",className:a(!p&&"animate-pulse-slow"),children:p?e.jsx(N,{"data-slot":"icon",className:"!w-5 !h-5"}):e.jsx(v,{"data-slot":"icon",className:"!w-5 !h-5"})})}),e.jsx("div",{className:"space-y-2 max-h-[calc(100dvh-226px)] sm:max-h-[calc(100dvh-234px)] lg:max-h-[calc(100vh-194px)] overflow-y-auto p-4",children:x&&0===l.length?e.jsx(b,{count:10}):0===E.length?e.jsx("div",{className:"text-center py-12 text-fg-muted",children:0===l.length?"No logs available":"No logs match selected filters"}):E.map((s,a)=>e.jsx(w,{log:s},`${s.timestamp}-${a}`))})]})})]})}export{C as default}; +import{r as s,j as e,c as a}from"./vendor-react-j_fHog8x.js";import{c as l,bz as t,bA as c,r,bB as i,bC as o,bD as n,B as m,bE as d,bo as x,bF as p}from"./index-BBcIGlRT.js";import{u as g}from"./usePolling-B1kG3uqm.js";import{P as h,b as j,B as u,a as y,L as b}from"./PageLayout-CYYy29Pg.js";import{C as f}from"./Card-QO4sXDu0.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CmkNwW1A.js";const v=l("circle-play",[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),N=l("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),w=s.memo(function({log:s}){return e.jsx("div",{className:"p-3 radius-card bg-subtle-fill hover:bg-subtle-fill-strong transition-base",children:e.jsxs("div",{className:"flex items-baseline gap-3",children:[e.jsx("span",{className:a("type-data-sm w-14 shrink-0",p(s.level)),children:s.level}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"type-data-sm text-fg-primary break-words whitespace-pre-wrap",children:s.message}),e.jsx("p",{className:"type-data-xs text-fg-muted mt-1",children:new Date(s.timestamp).toLocaleString()})]})]})})});function k({showDebug:s,onToggle:l}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:a("type-data-sm",s?"text-sys-orange":"text-sys-cyan"),children:s?"DEBUG":"INFO"}),e.jsx(x,{enabled:s,onChange:l,size:"sm"})]})}function C(){const l=t(),x=c(),p=r(),C=i(),D=o(),[B,L]=s.useState(!1),P=s.useCallback(()=>{L(s=>!s)},[]),E=B?l:l.filter(s=>"DEBUG"!==s.level);return g(C,d.logs,p),e.jsxs(h,{children:[e.jsx(j,{title:"System Logs",icon:e.jsx(n,{}),controls:e.jsx(k,{showDebug:B,onToggle:P})}),e.jsx(u,{children:e.jsxs(y,{neomorphic:!0,noPadding:!0,children:[e.jsx(f,{listHeader:!0,icon:e.jsx(n,{className:"icon-sm"}),title:"Log Entries",actions:e.jsx(m,{plain:!0,color:p?"danger":"primary",onClick:()=>D(!p),title:p?"Pause":"Resume",className:a(!p&&"animate-pulse-slow"),children:p?e.jsx(N,{"data-slot":"icon",className:"!w-5 !h-5"}):e.jsx(v,{"data-slot":"icon",className:"!w-5 !h-5"})})}),e.jsx("div",{className:"space-y-2 max-h-[calc(100dvh-226px)] sm:max-h-[calc(100dvh-234px)] lg:max-h-[calc(100vh-194px)] overflow-y-auto p-4",children:x&&0===l.length?e.jsx(b,{count:10}):0===E.length?e.jsx("div",{className:"text-center py-12 text-fg-muted",children:0===l.length?"No logs available":"No logs match selected filters"}):E.map((s,a)=>e.jsx(w,{log:s},`${s.timestamp}-${a}`))})]})})]})}export{C as default}; diff --git a/frontend/dist/assets/MeshGraph-LoEY91Ly.js b/frontend/dist/assets/MeshGraph-7WLMHygh.js similarity index 99% rename from frontend/dist/assets/MeshGraph-LoEY91Ly.js rename to frontend/dist/assets/MeshGraph-7WLMHygh.js index 17c7ca99..4eea1fd4 100644 --- a/frontend/dist/assets/MeshGraph-LoEY91Ly.js +++ b/frontend/dist/assets/MeshGraph-7WLMHygh.js @@ -1 +1 @@ -var e=Object.defineProperty,t=(t,s,n)=>((t,s,n)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n)(t,"symbol"!=typeof s?s+"":s,n);import{r as s,j as n,m as a,i,W as o,Z as r}from"./vendor-react-j_fHog8x.js";import{c as l,bc as c,bd as d,be as u,A as m,m as h,aE as x,a5 as p,aN as g,bf as f,bg as v,b3 as b,bh as y,bi as j,aB as N,bj as w,t as C,a_ as k,bk as S,Z as L,E as D,b4 as F,j as R,H as M,bl as H,bm as B,R as P,bn as E,Y as z,L as A,bo as T,bp as $,B as I,o as G,bq as O,aH as Z}from"./index-01Tx8g53.js";import{u as W,G as V,M as K,c as _,E as q,a as U,D as X,s as Y}from"./DeepAnalysisModal-BWClcGsg.js";import{D as J}from"./DataBox-Dpf5ZHgV.js";import{h as Q,c as ee,D as te}from"./geo-utils-D72kdxDo.js";import{N as se,a as ne}from"./badge-colors-YAE4qQ7m.js";import{e as ae,f as ie,g as oe}from"./meshcore-tx-constants-BDLT5LMb.js";import{E as re,S as le,T as ce}from"./target-L50EKHoJ.js";import{L as de}from"./layers-BNjfohkH.js";import{S as ue}from"./search-DGnzblbI.js";import{S as me}from"./settings-2-CePlNpN3.js";import{C as he}from"./chevron-right-BHZSwM7S.js";import{N as xe}from"./network-CCjpHq5M.js";import{C as pe}from"./copy-B5OWhmpX.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CmkNwW1A.js";import"./git-branch-Bz_gqcbv.js";import"./database-Cxl-xDNL.js";const ge=l("arrow-right-left",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]),fe=l("focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),ve=l("group",[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2",key:"adw53z"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2",key:"an4l38"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2",key:"144t0e"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2",key:"rtnfgi"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1",key:"1eyiv7"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1",key:"1qlmkx"}]]),be=l("lasso",[["path",{d:"M3.704 14.467A10 8 0 0 1 2 10a10 8 0 0 1 20 0 10 8 0 0 1-10 8 10 8 0 0 1-5.181-1.158",key:"1yant3"}],["path",{d:"M7 22a5 5 0 0 1-2-3.994",key:"1xp6a4"}],["circle",{cx:"5",cy:"16",r:"2",key:"18csp3"}]]),ye=l("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);function je(e){if(null==e)return"";const t=String(e);return t.includes(",")||t.includes('"')||t.includes("\n")?`"${t.replace(/"/g,'""')}"`:t}function Ne(e,t){const s=[e.join(",")];for(const n of t)s.push(n.map(je).join(","));return s.join("\n")}function we(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Ce(e){return!e||e<=0?"":new Date(1e3*e).toISOString()}function ke(e,t){return`${e}-${(new Date).toISOString().replace(/[:.]/g,"-").slice(0,19)}.${t}`}const Se=["hash","prefix","name","nodeClass","communityId","degree","inDegree","outDegree","betweenness","pathDiversity","packetCount","lastSeen","activityLevel","recencyScore","avgRssi","avgSnr","isZeroHop","prefixConfidence","hasCollision","collisionCandidates","isLocal","isHub","isGateway","isBackbone","isMobile","isGhost","isInLoop","latitude","longitude","contactType"];function Le(e){var t,s;return[e.hash,e.prefix,e.name??"",e.nodeClass,e.communityId,e.degree,e.inDegree,e.outDegree,e.betweenness.toFixed(6),e.pathDiversity,e.packetCount,Ce(e.lastSeen),e.activityLevel,e.recencyScore.toFixed(4),(null==(t=e.avgRssi)?void 0:t.toFixed(1))??"",(null==(s=e.avgSnr)?void 0:s.toFixed(1))??"",e.isZeroHop,e.prefixConfidence.toFixed(4),e.hasCollision,e.collisionCandidates,e.isLocal,e.isHub,e.isGateway,e.isBackbone,e.isMobile,e.isGhost,e.isInLoop,e.latitude??"",e.longitude??"",e.contactType??""]}function De(e,t){const s=[];for(const n of e.nodeMetrics.values())!t&&n.isGhost||s.push({hash:n.hash,prefix:n.prefix,name:n.name,nodeClass:n.nodeClass,communityId:n.communityId,degree:n.degree,inDegree:n.inDegree,outDegree:n.outDegree,betweenness:n.betweenness,pathDiversity:n.pathDiversity,packetCount:n.packetCount,lastSeen:n.lastSeen,activityLevel:n.activityLevel,recencyScore:n.recencyScore,avgRssi:n.avgRssi,avgSnr:n.avgSnr,isZeroHop:n.isZeroHop,prefixConfidence:n.prefixConfidence,hasCollision:n.hasCollision,isLocal:n.isLocal,isHub:n.isHub,isGateway:n.isGateway,isBackbone:n.isBackbone,isMobile:n.isMobile,isGhost:n.isGhost,isInLoop:n.isInLoop,latitude:n.latitude,longitude:n.longitude,contactType:n.contactType});return s}const Fe=["fromHash","toHash","key","packetCount","certainCount","avgConfidence","strength","forwardCount","reverseCount","symmetryRatio","dominantDirection","floodCount","directCount","isDirectPathEdge","isZeroHop","isLoopEdge","isCertain","avgRssi","avgSnr","avgRecency","hopDistanceFromLocal","edgeBetweenness","isBackbone"];function Re(e,t){const s=t?e.edges:e.validatedEdges,n=new Set(e.backboneEdges);return s.map(t=>({fromHash:t.fromHash,toHash:t.toHash,key:t.key,packetCount:t.packetCount,certainCount:t.certainCount,avgConfidence:t.avgConfidence,strength:t.strength,forwardCount:t.forwardCount,reverseCount:t.reverseCount,symmetryRatio:t.symmetryRatio,dominantDirection:t.dominantDirection,floodCount:t.floodCount,directCount:t.directCount,isDirectPathEdge:t.isDirectPathEdge,isZeroHop:t.isZeroHop??!1,isLoopEdge:t.isLoopEdge??!1,isCertain:t.isCertain,avgRssi:t.avgRssi??null,avgSnr:t.avgSnr??null,avgRecency:t.avgRecency,hopDistanceFromLocal:t.hopDistanceFromLocal,edgeBetweenness:e.edgeBetweenness.get(t.key)??0,isBackbone:n.has(t.key)}))}const Me=["pathKey","hops","hopCount","healthScore","weakestLinkKey","weakestLinkConfidence","avgEdgeCertainty","observationTrend","alternatePathsCount","estimatedLatencyMs","observationCount","routeType","lastSeen","involvesHub"];function He(e){return[e.pathKey,e.hops.join(">"),e.hops.length,e.healthScore.toFixed(4),e.weakestLinkKey??"",e.weakestLinkConfidence.toFixed(4),e.avgEdgeCertainty.toFixed(4),e.observationTrend.toFixed(4),e.alternatePathsCount,e.estimatedLatencyMs.toFixed(0),e.observationCount,e.routeType,Ce(e.lastSeen),e.involvesHub]}const Be=["nodeHash","nodePrefix","nodeName","networkRole","floodFactor","directFactor","floodSlots","directSlots","trafficIntensity","directNeighborCount","collisionRisk","confidence","adjustment","dataConfidence","observationSymmetry","rationale"];function Pe(e,t,s){const n=s.get(e);return[e,(null==n?void 0:n.prefix)??"",(null==n?void 0:n.name)??"",t.networkRole,t.floodFactor.toFixed(2),t.directFactor.toFixed(2),t.floodSlots,t.directSlots,t.trafficIntensity.toFixed(4),t.directNeighborCount,t.collisionRisk.toFixed(4),t.confidence.toFixed(4),t.adjustment,t.dataConfidence,t.observationSymmetry.toFixed(4),t.rationale]}function Ee(e,t){var s,n;const a=new Set(e.backboneEdges),i=['','',` `,` pymc_console v${c}`," MeshCore LoRa Mesh Network Topology"," ",' ',""," \x3c!-- Node Attributes --\x3e",' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '," ",""," \x3c!-- Edge Attributes --\x3e",' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '," ",""," "];for(const o of e.nodeMetrics.values()){if(!t&&o.isGhost)continue;const e=we(o.name??o.prefix);i.push(` `),i.push(" "),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),null!=o.avgRssi&&i.push(` `),null!=o.avgSnr&&i.push(` `),i.push(" "),null==o.latitude||null==o.longitude||0===o.latitude&&0===o.longitude||i.push(` `),i.push(" ")}i.push(" "),i.push(""),i.push(" ");for(const o of e.validatedEdges){const r=e.nodeMetrics;if(!t&&((null==(s=r.get(o.fromHash))?void 0:s.isGhost)||(null==(n=r.get(o.toHash))?void 0:n.isGhost)))continue;const l=e.edgeBetweenness.get(o.key)??0;i.push(` `),i.push(" "),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(" "),i.push(" ")}return i.push(" "),i.push(" "),i.push(""),i.join("\n")}function ze(e,t,s){const n={meta:{exportedAt:(new Date).toISOString(),pymcConsoleVersion:c,nodeCount:e.nodeMetrics.size,edgeCount:e.validatedEdges.length,communityCount:e.communityCount,loopCount:e.loops.length,backboneEdgeCount:e.backboneEdges.length,hubNodes:e.hubNodes.length,gatewayNodes:e.gatewayNodes.length,mobileNodes:e.mobileNodes.length,ghostNodes:e.discoveredNodes.filter(e=>e.isLikelyReal).length},nodes:De(e,t),edges:Re(e,s),pathHealth:e.pathHealth.map(e=>({pathKey:e.pathKey,hops:e.hops,healthScore:e.healthScore,weakestLinkKey:e.weakestLinkKey,weakestLinkConfidence:e.weakestLinkConfidence,avgEdgeCertainty:e.avgEdgeCertainty,observationTrend:e.observationTrend,alternatePathsCount:e.alternatePathsCount,estimatedLatencyMs:e.estimatedLatencyMs,observationCount:e.observationCount,routeType:e.routeType,lastSeen:e.lastSeen,involvesHub:e.involvesHub})),txDelayRecommendations:Array.from(e.txDelayRecommendations.entries()).map(([t,s])=>{var n,a;return{nodeHash:t,nodePrefix:(null==(n=e.nodeMetrics.get(t))?void 0:n.prefix)??"",nodeName:(null==(a=e.nodeMetrics.get(t))?void 0:a.name)??null,networkRole:s.networkRole,floodFactor:s.floodFactor,directFactor:s.directFactor,floodSlots:s.floodSlots,directSlots:s.directSlots,trafficIntensity:s.trafficIntensity,collisionRisk:s.collisionRisk,confidence:s.confidence,adjustment:s.adjustment,dataConfidence:s.dataConfidence,rationale:s.rationale}}),loops:e.loops.map(e=>({id:e.id,nodes:e.nodes,edgeKeys:e.edgeKeys,size:e.size,avgCertainCount:e.avgCertainCount,minCertainCount:e.minCertainCount,includesLocal:e.includesLocal,strength:e.strength})),disambiguationStats:{totalPrefixes:e.disambiguationStats.totalPrefixes,unambiguousPrefixes:e.disambiguationStats.unambiguousPrefixes,collisionPrefixes:e.disambiguationStats.collisionPrefixes,collisionRate:e.disambiguationStats.collisionRate,avgConfidence:e.disambiguationStats.avgConfidence},viterbiStats:{totalPaths:e.viterbiStats.totalPaths,pathsWithGhosts:e.viterbiStats.pathsWithGhosts,avgPathConfidence:e.viterbiStats.avgPathConfidence,tracePacketsProcessed:e.viterbiStats.tracePacketsProcessed,pathPacketsProcessed:e.viterbiStats.pathPacketsProcessed,distantEdgesDiscovered:e.viterbiStats.distantEdgesDiscovered,duplicateGroupsFound:e.viterbiStats.duplicateGroupsFound,echolocationEdgesInferred:e.viterbiStats.echolocationEdgesInferred}};return JSON.stringify(n,null,2)}function Ae(e,t){const s=t.includeGhosts??!0,n=t.includeWeakEdges??!1;switch(t.format){case"csv":{let a,i;switch(t.dataset){case"nodes":case"full":default:a=function(e,t){const s=[];for(const n of e.nodeMetrics.values())!t&&n.isGhost||s.push(Le(n));return Ne(Se,s)}(e,s),i="mesh-nodes";break;case"edges":a=function(e,t){const s=t?e.edges:e.validatedEdges,n=new Set(e.backboneEdges),a=s.map(t=>function(e,t,s){var n,a;return[e.fromHash,e.toHash,e.key,e.packetCount,e.certainCount,e.avgConfidence.toFixed(4),e.strength.toFixed(4),e.forwardCount,e.reverseCount,e.symmetryRatio.toFixed(4),e.dominantDirection,e.floodCount,e.directCount,e.isDirectPathEdge,e.isZeroHop??!1,e.isLoopEdge??!1,e.isCertain,(null==(n=e.avgRssi)?void 0:n.toFixed(1))??"",(null==(a=e.avgSnr)?void 0:a.toFixed(1))??"",e.avgRecency.toFixed(4),e.hopDistanceFromLocal,(t.get(e.key)??0).toFixed(6),s.has(e.key)]}(t,e.edgeBetweenness,n));return Ne(Fe,a)}(e,n),i="mesh-edges";break;case"pathHealth":a=function(e){const t=e.pathHealth.map(He);return Ne(Me,t)}(e),i="mesh-path-health";break;case"txDelay":a=function(e){const t=[];for(const[s,n]of e.txDelayRecommendations)t.push(Pe(s,n,e.nodeMetrics));return Ne(Be,t)}(e),i="mesh-tx-delay"}return{content:a,filename:ke(i,"csv"),mimeType:"text/csv"}}case"gexf":return{content:Ee(e,s),filename:ke("mesh-topology","gexf"),mimeType:"application/xml"};default:return{content:ze(e,s,n),filename:ke("mesh-topology","json"),mimeType:"application/json"}}}function Te(e,t,s=1){const{n:n,adjList:a,totalWeight:i,degree:o}=e;if(0===i)return!1;const r=2*i,l=new Float64Array(n);for(let u=0;up+1e-7&&(p=a,x=e)}x!==n&&(l[n]-=u,l[x]+=u,t[e]=x,d=!0,c=!0)}}return c}function $e(e,t){const{n:s,adjList:n}=e,a=new Set;for(let h=0;he-t),o=new Map;for(let h=0;h[]);for(const[h,x]of c){const[e,t]=h.split("-").map(Number),s=x/2;m[e].push({j:t,w:s}),m[t].push({j:e,w:s}),d[e]+=s,d[t]+=s,u+=s}return{newGraph:{n:r,adjList:m,totalWeight:u,degree:Array.from(d)},mapping:l}}function Ie(e,t,s){const n=(null==s?void 0:s.resolution)??1,a=(null==s?void 0:s.kWeight)??1,i=t.length;if(0===i)return{communities:new Map,numCommunities:0,modularity:0,passes:0};if(1===i)return{communities:new Map([[t[0],0]]),numCommunities:1,modularity:0,passes:0};const{graph:o}=function(e,t,s=1){const n=t.length,a=new Map;for(let l=0;l[]),o=new Array(n).fill(0);let r=0;for(const l of e){const e=a.get(l.fromHash),t=a.get(l.toHash);if(void 0===e||void 0===t)continue;if(e===t)continue;const n=Math.max(.01,(l.certainCount+1)*l.avgConfidence*l.strength),c=1===s?n:Math.pow(n,s);i[e].push({j:t,w:c}),i[t].push({j:e,w:c}),o[e]+=c,o[t]+=c,r+=c}return{graph:{n:n,adjList:i,totalWeight:r,degree:o},hashToIdx:a}}(e,t,a);let r=o,l=new Int32Array(i);for(let v=0;v=r.n)break;r=e,l=new Int32Array(e.n);for(let s=0;se-t),x=new Map;for(let v=0;v=20?"excellent":e>=10?"good":e>=3?"fair":e>=0?"marginal":"critical"}function qe(e){return e>=15?"anomalous-good":e>=5?"better":e>=-5?"expected":e>=-20?"worse":"anomalous-bad"}function Ue(e,t,s,n,a){const i=n.tx_power??22,o=n.spreading_factor??12,r=n.coding_rate??5,l=n.frequency??0,c=l>1e5?l/1e6:l||915,d=n.bandwidth??0,u=d>1e3?d/1e3:d||125,m=(null==a?void 0:a.sensitivityOverrideDbm)??Ve(o,u,r);let h=null,x=null;t&&s&&Q(t.latitude??void 0,t.longitude??void 0)&&Q(s.latitude??void 0,s.longitude??void 0)&&(h=ee(t.latitude,t.longitude,s.latitude,s.longitude),x=h/1e3);let p=null,g=null;null!=h&&h>0&&(p=We(h,c),g=i+2.15+2.15-p);const f=e.avgRssi??null,v=e.avgSnr??null;let b=null,y=null;null!=f&&null!=g&&(b=f-g,y=qe(b));let j=null,N=null;null!=f&&(j=f-m,N=_e(j));const w=null!=f,C="anomalous-good"===y||"anomalous-bad"===y;return{edgeKey:e.key,fromHash:e.fromHash,toHash:e.toHash,distanceM:h,distanceKm:x,fsplDb:p,theoreticalRxPowerDbm:g,observedRssiDbm:f,observedSnrDb:v,deviationDb:b,deviationClass:y,marginDb:j,marginClass:N,sensitivityDbm:m,txPowerDbm:i,frequencyMhz:c,spreadingFactor:o,bandwidthKhz:u,noiseFloorDbm:null,isZeroHop:e.isZeroHop??!1,isTraceEstimated:!1,hasData:w,isAnomalous:C}}function Xe(e,t,s,n,a=22,i){const o=e.traceQuality;if(!o)return null;let r=null;if(r=null!=o.forwardSnr&&null!=o.reverseSnr?Math.min(o.forwardSnr,o.reverseSnr):o.forwardSnr??o.reverseSnr,null==r)return null;const l=n.spreading_factor??12,c=n.coding_rate??5,d=n.bandwidth??0,u=d>1e3?d/1e3:d||125,m=1e3*u,h=n.frequency??0,x=h>1e5?h/1e6:h||915,p=(null==i?void 0:i.sensitivityOverrideDbm)??Ve(l,u,c),g=(null==i?void 0:i.observedNoiseFloorDbm)??Ke(m),f=g+r;let v=null,b=null;t&&s&&Q(t.latitude??void 0,t.longitude??void 0)&&Q(s.latitude??void 0,s.longitude??void 0)&&(v=ee(t.latitude,t.longitude,s.latitude,s.longitude),b=v/1e3);let y=null,j=null;null!=v&&v>0&&(y=We(v,x),j=a+2.15+2.15-y);let N=null,w=null;null!=j&&(N=f-j,w=qe(N));const C=f-p,k=_e(C);return{edgeKey:e.key,fromHash:e.fromHash,toHash:e.toHash,distanceM:v,distanceKm:b,fsplDb:y,theoreticalRxPowerDbm:j,observedRssiDbm:f,observedSnrDb:r,deviationDb:N,deviationClass:w,marginDb:C,marginClass:k,sensitivityDbm:p,noiseFloorDbm:g,txPowerDbm:a,frequencyMhz:x,spreadingFactor:l,bandwidthKhz:u,isZeroHop:!1,isTraceEstimated:!0,hasData:!0,isAnomalous:"anomalous-good"===w||"anomalous-bad"===w}}const Ye={"anomalous-good":"#2DD4BF",better:"#34D399",expected:"#9CA3AF",worse:"#FB923C","anomalous-bad":"#EF4444"},Je={excellent:"#34D399",good:"#A3E635",fair:"#FBBF24",marginal:"#FB923C",critical:"#EF4444"};function Qe(e,t="margin"){return e.hasData?"deviation"===t?e.deviationClass?Ye[e.deviationClass]:"#505058":e.marginClass?Je[e.marginClass]:"#505058":"#505058"}function et(e,t=.5,s=4){return null==e.marginDb?t:t+Math.max(0,Math.min(1,e.marginDb/40))*(s-t)}let tt=0;function st(){return`ta-${++tt}-${Date.now()}`}function nt(e){return{standard:0,ghost:1,mobile:2,neighbor:3,backbone:4,gateway:5,hub:6,local:7}[e]??0}class at{constructor(e=200){t(this,"prevSnapshot",null),t(this,"log",[]),t(this,"maxLog"),this.maxLog=e}update(e,t){const s=function(e){const t=new Set;for(const r of e.edges)t.add(r.key);const s=new Map,n=new Map,a=new Map,i=new Set;for(const[r,l]of e.nodeMetrics)s.set(r,l.betweenness),n.set(r,l.communityId),a.set(r,l.nodeClass),i.add(r);const o=new Set;for(const r of e.discoveredNodes)r.isLikelyReal&&o.add(r.prefix);return{timestamp:Date.now(),edgeKeys:t,betweenness:s,communities:n,nodeClasses:a,ghostPrefixes:o,nodeHashes:i}}(e);if(!this.prevSnapshot)return this.prevSnapshot=s,{anomalies:[],categoryCounts:{"edge-appeared":0,"edge-disappeared":0,"ghost-appeared":0,"ghost-disappeared":0,"betweenness-shift":0,"community-change":0,"class-change":0,"node-appeared":0,"node-disappeared":0},severityCounts:{info:0,warning:0,critical:0},totalCount:0,timestamp:Date.now()};const n=function(e,t,s){const n=Date.now(),a=[],i=e=>(null==s?void 0:s.get(e))??null;for(const d of t.edgeKeys)if(!e.edgeKeys.has(d)){const[e,t]=d.split("-"),s=i(e)??(null==e?void 0:e.slice(0,6)),o=i(t)??(null==t?void 0:t.slice(0,6));a.push({id:st(),detectedAt:n,category:"edge-appeared",severity:"info",description:`New edge: ${s} ↔ ${o}`,edgeKey:d})}for(const d of e.edgeKeys)if(!t.edgeKeys.has(d)){const[e,t]=d.split("-"),s=i(e)??(null==e?void 0:e.slice(0,6)),o=i(t)??(null==t?void 0:t.slice(0,6));a.push({id:st(),detectedAt:n,category:"edge-disappeared",severity:"warning",description:`Edge lost: ${s} ↔ ${o}`,edgeKey:d})}for(const d of t.nodeHashes)if(!e.nodeHashes.has(d)){const e=i(d);a.push({id:st(),detectedAt:n,category:"node-appeared",severity:"info",description:`Node appeared: ${e??d.slice(0,8)}`,nodeHash:d,nodeName:e??void 0})}for(const d of e.nodeHashes)if(!t.nodeHashes.has(d)){const e=i(d);a.push({id:st(),detectedAt:n,category:"node-disappeared",severity:"warning",description:`Node dropped: ${e??d.slice(0,8)}`,nodeHash:d,nodeName:e??void 0})}for(const d of t.ghostPrefixes)e.ghostPrefixes.has(d)||a.push({id:st(),detectedAt:n,category:"ghost-appeared",severity:"info",description:`Ghost node discovered: ${d.toUpperCase()}`});for(const d of e.ghostPrefixes)t.ghostPrefixes.has(d)||a.push({id:st(),detectedAt:n,category:"ghost-disappeared",severity:"info",description:`Ghost node resolved: ${d.toUpperCase()}`});for(const[d,u]of t.betweenness){const t=e.betweenness.get(d);if(void 0===t)continue;const s=Math.abs(u-t);if(s>=.15){const e=i(d),o=u>t?"increased":"decreased";a.push({id:st(),detectedAt:n,category:"betweenness-shift",severity:s>=.3?"critical":"warning",description:`${e??d.slice(0,8)} betweenness ${o}: ${t.toFixed(3)} → ${u.toFixed(3)}`,nodeHash:d,nodeName:e??void 0,previousValue:t,currentValue:u})}}for(const[d,u]of t.communities){const t=e.communities.get(d);if(void 0!==t&&u!==t){const e=i(d);a.push({id:st(),detectedAt:n,category:"community-change",severity:"info",description:`${e??d.slice(0,8)} moved: community #${t} → #${u}`,nodeHash:d,nodeName:e??void 0,previousValue:t,currentValue:u})}}for(const[d,u]of t.nodeClasses){const t=e.nodeClasses.get(d);if(void 0!==t&&u!==t){const e=i(d),s=nt(u)>nt(t);a.push({id:st(),detectedAt:n,category:"class-change",severity:s?"warning":"info",description:`${e??d.slice(0,8)} ${s?"promoted":"changed"}: ${t} → ${u}`,nodeHash:d,nodeName:e??void 0,previousValue:t,currentValue:u})}}const o={},r={},l=["edge-appeared","edge-disappeared","ghost-appeared","ghost-disappeared","betweenness-shift","community-change","class-change","node-appeared","node-disappeared"],c=["info","warning","critical"];for(const d of l)o[d]=0;for(const d of c)r[d]=0;for(const d of a)o[d.category]++,r[d.severity]++;return a.sort((e,t)=>t.detectedAt-e.detectedAt),{anomalies:a,categoryCounts:o,severityCounts:r,totalCount:a.length,timestamp:n}}(this.prevSnapshot,s,t);this.prevSnapshot=s;try{!function(e,t){const s=t.edgeMap,n=t.nodeMetrics,a=new Set(t.backboneEdges??[]);for(const i of e){if(i.edgeKey&&("edge-appeared"===i.category||"edge-disappeared"===i.category)){const e=null==s?void 0:s.get(i.edgeKey),t=i.edgeKey.split("-"),o=t[0],r=t[1],l=o?null==n?void 0:n.get(o):void 0,c=r?null==n?void 0:n.get(r):void 0;i.edgeDetail=e?{fromName:(null==l?void 0:l.name)??null,toName:(null==c?void 0:c.name)??null,fromClass:(null==l?void 0:l.nodeClass)??null,toClass:(null==c?void 0:c.nodeClass)??null,packetCount:e.packetCount,confidence:e.avgConfidence,symmetryRatio:e.symmetryRatio,isBackbone:a.has(i.edgeKey),isLoop:e.isLoopEdge??!1,isZeroHop:e.isZeroHop??!1,isDirectPath:e.isDirectPathEdge,avgRssi:e.avgRssi??null,avgSnr:e.avgSnr??null,fromBetweenness:(null==l?void 0:l.betweenness)??null,toBetweenness:(null==c?void 0:c.betweenness)??null}:{fromName:(null==l?void 0:l.name)??null,toName:(null==c?void 0:c.name)??null,fromClass:(null==l?void 0:l.nodeClass)??null,toClass:(null==c?void 0:c.nodeClass)??null,packetCount:0,confidence:0,symmetryRatio:0,isBackbone:!1,isLoop:!1,isZeroHop:!1,isDirectPath:!1,avgRssi:null,avgSnr:null,fromBetweenness:(null==l?void 0:l.betweenness)??null,toBetweenness:(null==c?void 0:c.betweenness)??null}}if(i.nodeHash){const e=null==n?void 0:n.get(i.nodeHash);e&&(i.nodeDetail=it(e))}}}(n.anomalies,e)}catch(a){}return this.log.unshift(...n.anomalies),this.log.length>this.maxLog&&(this.log.length=this.maxLog),n}getLog(){return this.log}getFiltered(e){const t=Date.now();return this.log.filter(s=>!(e.category&&s.category!==e.category||e.severity&&s.severity!==e.severity||e.nodeHash&&s.nodeHash!==e.nodeHash||e.maxAge&&t-s.detectedAt>e.maxAge))}clear(){this.log=[],this.prevSnapshot=null}}function it(e){return{nodeClass:e.nodeClass,degree:e.degree,betweenness:e.betweenness,activityLevel:e.activityLevel,isZeroHop:e.isZeroHop,avgRssi:e.avgRssi,avgSnr:e.avgSnr,communityId:e.communityId,packetCount:e.packetCount,connectionCount:e.degree}}function ot(e){if(e.length<2)return 0;const t=e.length;let s=0,n=0,a=0,i=0;for(let r=0;r.3&&n.push({name:"Weak link certainty",description:e.weakestLinkKey?`Weakest: ${e.weakestLinkConfidence<.3?"very low":"low"} confidence`:`Average certainty: ${(100*e.avgEdgeCertainty).toFixed(0)}%`,score:i,weight:.3});let o=0;0===e.alternatePathsCount?(o=1,n.push({name:"No alternate paths",description:"Single route to destination — no failover available",score:o,weight:.2})):1===e.alternatePathsCount&&(o=.5,n.push({name:"Limited redundancy",description:"Only 1 alternate path available",score:o,weight:.2}));let r=0;if(e.weakestLinkKey){const a=t.get(e.weakestLinkKey);if(null!=(null==a?void 0:a.avgRssi)){const e=a.avgRssi-s;e<3?(r=1,n.push({name:"Signal near sensitivity",description:`Weakest link: ${e.toFixed(1)} dB margin (< 3 dB)`,score:r,weight:rt})):e<10&&(r=1-(e-3)/7,n.push({name:"Low signal margin",description:`Weakest link: ${e.toFixed(1)} dB margin`,score:r,weight:rt}))}}const l=.35*a+.3*i+.2*o+r*rt;if(l<.35)return null;let c,d;return l>=.75?(c="critical",d="imminent"):l>=.55?(c="high",d="near-term"):(c="moderate",d="watch"),{pathKey:e.pathKey,hops:e.hops,riskScore:Math.round(100*l)/100,riskLevel:c,factors:n,weakestEdgeKey:e.weakestLinkKey,healthScore:e.healthScore,observationTrend:e.observationTrend,alternatePathsCount:e.alternatePathsCount,urgency:d}}let ct=100;function dt(){return++ct}const ut="meshgraph-panel-";function mt(e){try{const t=localStorage.getItem(ut+e);return t?JSON.parse(t):null}catch{return null}}function ht({id:e,title:t,icon:a,open:i,onClose:o,defaultPosition:r,defaultSize:l,minSize:c={width:180,height:120},maxSize:d,autoHeight:u=!1,headerActions:g,children:f}){const v=W(),b=s.useRef(null),y=s.useRef(null),j=s.useMemo(()=>{const t=mt(e);return t?{x:t.x,y:t.y,w:t.w,h:u?l.height:t.h,minimized:t.minimized}:{x:r.x,y:r.y,w:l.width,h:l.height,minimized:!1}},[e]),[N,w]=s.useState({w:j.w,h:j.h}),[C,k]=s.useState(j.minimized),[S,L]=s.useState(()=>dt()),[D,F]=s.useState({x:j.x,y:j.y});s.useLayoutEffect(()=>{const t=b.current;if(!i||!t)return;const s=t.getBoundingClientRect();if(s.width<1||s.height<1)return;const n=mt(e),a=(o=(null==n?void 0:n.x)??j.x,r=(null==n?void 0:n.y)??j.y,l=(null==n?void 0:n.w)??N.w,c=s.width,d=s.height,{x:Math.max(8,Math.min(o,Math.max(8,c-l-8))),y:Math.max(8,Math.min(r,Math.max(8,d-36)))});var o,r,l,c,d;F(a)},[i,e]);const[R,M]=s.useState(!1),H=s.useRef({startX:0,startY:0,startW:0,startH:0,edge:""}),B=s.useRef(),P=s.useCallback(()=>{B.current&&clearTimeout(B.current),B.current=setTimeout(()=>{const t=y.current;if(!t)return;const s=window.getComputedStyle(t),n=new DOMMatrix(s.transform);!function(e,t){try{localStorage.setItem(ut+e,JSON.stringify(t))}catch{}}(e,{x:n.m41,y:n.m42,w:N.w,h:N.h,minimized:C})},300)},[e,N.w,N.h,C]);s.useEffect(()=>{P()},[N,C,P]);const E=s.useCallback(()=>{L(dt())},[]),z=s.useCallback(()=>{k(e=>!e)},[]),A=s.useCallback((e,t)=>{e.preventDefault(),e.stopPropagation(),M(!0),H.current={startX:e.clientX,startY:e.clientY,startW:N.w,startH:N.h,edge:t},E();const s=e=>{const{startX:t,startY:s,startW:n,startH:a,edge:i}=H.current,o=e.clientX-t,r=e.clientY-s;let l=n,u=a;"e"!==i&&"se"!==i||(l=Math.max(c.width,n+o),d&&(l=Math.min(d.width,l))),"s"!==i&&"se"!==i||(u=Math.max(c.height,a+r),d&&(u=Math.min(d.height,u))),w({w:l,h:u})},n=()=>{M(!1),window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",n)};window.addEventListener("pointermove",s),window.addEventListener("pointerup",n)},[N,c,d,E]);return n.jsx("div",{ref:b,className:"absolute inset-0 pointer-events-none",style:{zIndex:S},children:n.jsx(m,{children:i&&n.jsxs(h.div,{ref:y,drag:!R,dragControls:v,dragConstraints:b,dragElastic:.05,dragMomentum:!1,dragListener:!1,initial:{opacity:0,scale:.96,x:D.x,y:D.y},animate:{opacity:1,scale:1,x:D.x,y:D.y},exit:{opacity:0,scale:.96},transition:{duration:.15},onPointerDown:E,className:"absolute top-0 left-0 pointer-events-auto",style:{width:N.w,touchAction:"none"},children:[n.jsxs("div",{className:"surface-elevated radius-inset shadow-xl overflow-hidden flex flex-col",style:{maxHeight:C?void 0:u?"80vh":N.h},children:[n.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 border-b border-edge-subtle cursor-grab active:cursor-grabbing select-none shrink-0",onPointerDown:e=>{E(),v.start(e)},children:[n.jsx(V,{className:"w-3 h-3 text-fg-muted/50 shrink-0"}),a&&n.jsx("span",{className:"text-fg-muted shrink-0 [&>svg]:w-3 [&>svg]:h-3",children:a}),n.jsx("span",{className:"text-[11px] font-medium text-fg-primary flex-1 truncate",children:t}),g,n.jsx("button",{onClick:z,className:"p-0.5 radius-badge hover-bg transition-base",title:C?"Expand":"Minimize",children:C?n.jsx(K,{className:"w-2.5 h-2.5 text-fg-muted"}):n.jsx(x,{className:"w-2.5 h-2.5 text-fg-muted"})}),n.jsx("button",{onClick:o,className:"p-0.5 radius-badge hover-bg transition-base",title:"Close",children:n.jsx(p,{className:"w-2.5 h-2.5 text-fg-muted"})})]}),n.jsx(m,{initial:!1,children:!C&&n.jsx(h.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},className:"overflow-hidden",children:n.jsx("div",{className:"overflow-y-auto",style:{maxHeight:u?"70vh":void 0},children:f})})})]}),!C&&!u&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"absolute top-0 -right-1 w-2 h-full cursor-ew-resize",onPointerDown:e=>A(e,"e")}),n.jsx("div",{className:"absolute -bottom-1 left-0 w-full h-2 cursor-ns-resize",onPointerDown:e=>A(e,"s")}),n.jsx("div",{className:"absolute -bottom-1 -right-1 w-3 h-3 cursor-nwse-resize",onPointerDown:e=>A(e,"se"),children:n.jsxs("svg",{className:"w-full h-full text-fg-muted/30",viewBox:"0 0 12 12",children:[n.jsx("path",{d:"M10 2 L10 10 L2 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),n.jsx("path",{d:"M7 5 L7 7 L5 7",fill:"none",stroke:"currentColor",strokeWidth:"1"})]})})]})]})})})}const xt=800,pt={critical:[S.red,S.red],poor:[S.orange,S.orange],fair:[S.amber,S.amber],good:[S.green,S.green],excellent:[S.blue,S.blue]},gt={active:1,recent:.85,stale:.45,inactive:.25},ft=[S.purple,S.green,S.amber,S.red,S.blue,S.pink,S.teal,S.orange],vt=[S.purple,S.green,S.amber,S.red,S.blue,S.pink,S.teal,S.orange];function bt(e,t,s){const n=(e,t)=>parseInt(e.slice(1+2*t,3+2*t),16);return`#${[0,1,2].map(a=>{return(i=a,Math.round(n(e,i)*s+n(t,i)*(1-s))).toString(16).padStart(2,"0");var i}).join("")}`}const yt={zeroHop:bt(S.amber,L[500],.55),directPath:bt(S.teal,L[500],.55),loop:bt(S.purple,L[500],.55),backbone:L[300],standard:L[500],standardDim:L[600],ghost:L[600]},jt={zeroHop:bt(S.amber,L[700],.5),directPath:bt(S.teal,L[700],.5),loop:bt(S.purple,L[700],.5),backbone:L[700],standard:L[400],standardDim:L[300],ghost:L[400]},Nt=!1,wt=!0,Ct=!0,kt=!0,St=!0,Lt=!0,Dt={local:S.amber,hub:S.purple,gateway:S.blue,backbone:S.green,neighbor:S.pink,mobile:S.orange,ghost:L[400],standard:L[300]},Ft={local:S.amber,hub:S.purple,gateway:S.blue,backbone:S.green,neighbor:S.pink,mobile:S.orange,ghost:L[500],standard:L[600]},Rt={local:"Your repeater — the home node running this dashboard",hub:"≥10% of last-hop traffic — dominant forwarder for your local node",gateway:"7-10% of last-hop traffic — significant relay node",backbone:"High betweenness centrality — critical path node connecting clusters",neighbor:"Zero-hop direct RF contact — no intermediate forwarders",mobile:"High path volatility — node appears and disappears frequently",ghost:"Unresolved prefix inferred by Viterbi HMM from path patterns",standard:"<7% of traffic — normal mesh participant"};function Mt(e){const t=e.replace("#","");return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}function Ht(e,t,s){const[n,a,i]=Mt(e),[o,r,l]=Mt(t),c=Math.max(0,Math.min(1,s)),d=Math.round(n*c+o*(1-c)),u=Math.round(a*c+r*(1-c)),m=Math.round(i*c+l*(1-c));return`#${d.toString(16).padStart(2,"0")}${u.toString(16).padStart(2,"0")}${m.toString(16).padStart(2,"0")}`}function Bt(e,t){return e.isZeroHop?"zero-hop":e.isDirectPathEdge?"direct-path":e.isLoopEdge?"loop":t.has(e.key)?"backbone":"standard"}function Pt(e,t,s){const n=s?yt:jt;switch(e){case"zero-hop":return n.zeroHop;case"direct-path":return n.directPath;case"loop":return n.loop;case"backbone":return n.backbone;case"ghost":return n.ghost;default:return t>=.7?n.standard:n.standardDim}}const Et={"zero-hop":"Zero-Hop (Direct RF)","direct-path":"Direct Path (Unicast)",loop:"Redundant Loop",backbone:"Backbone",standard:"Standard",ghost:"Ghost (Inferred)"},zt={"zero-hop":"Direct radio contact — no intermediate forwarders in path","direct-path":"Unicast-routed edge — verified via DIRECT route type packets",loop:"Redundant path — alternate route between the same endpoints exists",backbone:"High betweenness centrality — critical traffic flow edge",standard:"Normal mesh edge with moderate-to-high confidence",ghost:"Inferred connection from Viterbi HMM ghost node analysis"},At=s.memo(function({timeline:e}){const t=e.buckets;if(t.length<2)return null;const[s,a]=e.rssiRange,i=Math.max(1,a-s),[o,r]=e.snrRange,l=Math.max(1,r-o),c=198/(t.length-1),d=t.map((e,t)=>{const n=1+t*c,a=1+34*(1-(e.avgRssi-s)/i);return`${n.toFixed(1)},${a.toFixed(1)}`}).join(" "),u=t.map((e,t)=>{const s=1+t*c,n=1+34*(1-(e.avgSnr-o)/l);return`${s.toFixed(1)},${n.toFixed(1)}`}).join(" "),m=e.rssiTrend>.1?"↑":e.rssiTrend<-.1?"↓":"→",h=e.snrTrend>.1?"↑":e.snrTrend<-.1?"↓":"→",x=e.rssiTrend>.1?"#34D399":e.rssiTrend<-.1?"#EF4444":"#9CA3AF",p=e.snrTrend>.1?"#34D399":e.snrTrend<-.1?"#EF4444":"#9CA3AF",g=(e.timeSpanMs/36e5).toFixed(1),f=function(e){const t=e.rssiTrend<-.1,s=e.snrTrend<-.1,n=e.rssiTrend>.1,a=e.snrTrend>.1,i=e.rssiRange[1]-e.rssiRange[0],o=e.snrRange[1]-e.snrRange[0];return t&&s?{text:"Both RSSI and SNR declining — possible antenna degradation or increasing distance",color:"#EF4444"}:s&&!t?{text:"SNR declining while RSSI stable — likely RF interference or noise floor increase",color:"#F97316"}:t&&!s?{text:"RSSI declining while SNR stable — possible path obstruction or power change",color:"#F97316"}:n&&a?{text:"Signal improving — conditions favorable or antenna adjustment working",color:"#34D399"}:i>15||o>10?{text:"High signal variance — intermittent obstruction or multipath fading",color:"#FBBF24"}:{text:"Signal stable — no significant degradation detected",color:"#9CA3AF"}}(e);return n.jsxs("div",{className:"mt-2 pt-2 border-t border-edge-subtle/50",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx(M,{content:n.jsxs("div",{className:"max-w-xs space-y-1.5",children:[n.jsx("div",{className:"font-semibold text-fg-primary",children:"Signal Quality Over Time"}),n.jsx("div",{className:"text-fg-secondary text-[11px]",children:"Tracks RSSI (signal power) and SNR (signal-to-noise ratio) for zero-hop packets received directly from this neighbor. Reveals weather effects, interference, and antenna degradation."}),n.jsxs("div",{className:"pt-1 border-t border-edge-subtle/30 space-y-0.5 font-mono text-[10px]",children:[n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Samples"}),n.jsx("span",{className:"text-fg-primary tabular-nums",children:e.totalSamples})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Time span"}),n.jsxs("span",{className:"text-fg-primary tabular-nums",children:[g,"h"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Avg RSSI"}),n.jsxs("span",{className:"text-fg-primary tabular-nums",children:[e.avgRssi.toFixed(1)," dBm"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Avg SNR"}),n.jsxs("span",{className:"text-fg-primary tabular-nums",children:[e.avgSnr.toFixed(1)," dB"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"RSSI trend"}),n.jsxs("span",{className:"tabular-nums",style:{color:x},children:[e.rssiTrend>0?"+":"",e.rssiTrend.toFixed(3)," dBm/bucket"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"SNR trend"}),n.jsxs("span",{className:"tabular-nums",style:{color:p},children:[e.snrTrend>0?"+":"",e.snrTrend.toFixed(3)," dB/bucket"]})]})]}),n.jsxs("div",{className:"text-[10px] text-fg-muted italic",children:["Trend is linear regression slope across ",t.length," time buckets. ↑ = improving, ↓ = degrading, → = stable."]})]}),children:n.jsx("span",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Signal Timeline"})}),n.jsxs("span",{className:"text-[9px] text-fg-muted tabular-nums",children:[e.totalSamples," samples · ",g,"h"]})]}),n.jsxs("svg",{viewBox:"0 0 200 36",className:"w-full h-9",preserveAspectRatio:"none",children:[n.jsx("polyline",{points:d,fill:"none",stroke:"#60A5FA",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.8"}),n.jsx("polyline",{points:u,fill:"none",stroke:"#34D399",strokeWidth:"1",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.5",strokeDasharray:"3 2"})]}),n.jsxs("div",{className:"flex items-center justify-between text-[9px] mt-0.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"flex items-center gap-0.5",children:[n.jsx("span",{className:"w-2.5 h-[1.5px] bg-[#60A5FA] rounded-full inline-block"}),n.jsx("span",{className:"text-fg-muted",children:"RSSI"}),n.jsx("span",{className:"tabular-nums",style:{color:x},children:m})]}),n.jsxs("span",{className:"flex items-center gap-0.5",children:[n.jsx("span",{className:"w-2.5 h-[1px] bg-[#34D399] rounded-full inline-block opacity-50",style:{borderTop:"1px dashed #34D399"}}),n.jsx("span",{className:"text-fg-muted",children:"SNR"}),n.jsx("span",{className:"tabular-nums",style:{color:p},children:h})]})]}),n.jsxs("div",{className:"flex items-center gap-2 text-fg-muted tabular-nums",children:[n.jsxs("span",{children:[s.toFixed(0),"…",a.toFixed(0)," dBm"]}),n.jsxs("span",{children:[o.toFixed(0),"…",r.toFixed(0)," dB"]})]})]}),n.jsx("div",{className:"mt-1 text-[9px] leading-tight",style:{color:f.color},children:f.text})]})}),Tt=s.memo(function({edge:e,onClose:t}){const[a,i]=s.useState(null);return s.useEffect(()=>{if(!e.isZeroHop&&"zero-hop"!==e.edgeType)return void i(null);const t=Z.getState().packets,s=Z.getState().cachedLocalHash??void 0,n=function(e,t,s,n,a=24){const i=function(e,t,s,n){var a;const i=[],o=t.replace(/^0x/i,"").slice(0,2).toLowerCase();for(const r of e){if(r.transmitted)continue;if(null==r.rssi||null==r.snr)continue;if(0===r.rssi&&0===r.snr)continue;const e=(null==(a=r.src_hash)?void 0:a.replace(/^0x/i,""))??"";if(e.slice(0,2).toLowerCase()!==o&&e!==t.replace(/^0x/i,""))continue;const s=r.original_path??r.forwarded_path??[],l=d(s,n),c=(null==l?void 0:l.effectiveLength)??0,m=r.route??r.route_type;let h=!1;h=null!=m&&u(m)?c<=1:0===c,h&&i.push({timestamp:1e3*r.timestamp,rssi:r.rssi,snr:r.snr})}if(i.sort((e,t)=>e.timestamp-t.timestamp),i.length>0&&i[0].timestamp<4102444800)for(const r of i)r.timestamp*=1e3;return i}(e,t,0,n);if(i.length<3)return null;const o=function(e,t=24){if(0===e.length)return[];const s=e[0].timestamp,n=e[e.length-1].timestamp-s;if(n<=0)return[{timestamp:s,avgRssi:e.reduce((e,t)=>e+t.rssi,0)/e.length,avgSnr:e.reduce((e,t)=>e+t.snr,0)/e.length,minRssi:Math.min(...e.map(e=>e.rssi)),maxRssi:Math.max(...e.map(e=>e.rssi)),minSnr:Math.min(...e.map(e=>e.snr)),maxSnr:Math.max(...e.map(e=>e.snr)),count:e.length}];const a=n/t,i=[];for(let r=0;r0&&(r.avgRssi/=r.count,r.avgSnr/=r.count,o.push(r));return o}(i,a);if(o.length<2)return null;let r=0,l=0,c=1/0,m=-1/0,h=1/0,x=-1/0;for(const d of i)r+=d.rssi,l+=d.snr,c=Math.min(c,d.rssi),m=Math.max(m,d.rssi),h=Math.min(h,d.snr),x=Math.max(x,d.snr);const p=ot(o.map(e=>e.avgRssi)),g=ot(o.map(e=>e.avgSnr)),f=i[0].timestamp,v=i[i.length-1].timestamp;return{buckets:o,totalSamples:i.length,rssiRange:[c,m],snrRange:[h,x],avgRssi:r/i.length,avgSnr:l/i.length,rssiTrend:p,snrTrend:g,timeSpanMs:v-f}}(t,e.source,e.target,s);i(n)},[e.source,e.target,e.isZeroHop,e.edgeType]),n.jsxs(h.div,{variants:Y,initial:"hidden",animate:"visible",exit:"exit",className:"absolute inset-x-3 bottom-3 z-20 surface-elevated radius-inset shadow-xl",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-edge-subtle/50",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(ge,{className:"size-3.5 text-fg-muted shrink-0"}),n.jsxs("span",{className:"text-sm font-semibold text-fg-primary truncate",children:[e.fromName??e.source.slice(0,6)," → ",e.toName??e.target.slice(0,6)]}),n.jsxs("div",{className:"flex gap-1 shrink-0",children:[n.jsx(R,{color:"zinc",compact:!0,children:Et[e.edgeType]}),e.isBackbone&&n.jsx(R,{color:"emerald",compact:!0,children:"BONE"}),e.isLoopEdge&&n.jsx(R,{color:"indigo",compact:!0,children:"LOOP"}),e.isGhost&&n.jsx(R,{color:"zinc",compact:!0,children:"GHOST"})]})]}),n.jsx(I,{plain:!0,onClick:t,title:"Close",className:"shrink-0",children:n.jsx(p,{className:"size-4"})})]}),n.jsxs("div",{className:"p-3 font-mono text-[11px]",children:[n.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[n.jsxs("div",{children:[n.jsx(M,{content:"Average disambiguation confidence across all observations of this edge",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Confidence"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[(100*e.confidence).toFixed(0),"%"]})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Observations where both endpoints had high-confidence disambiguation",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Certain"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.certainCount.toLocaleString()})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Total packets observed traversing this edge",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Packets"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.packetCount.toLocaleString()})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Combined certainCount × confidence metric for edge ranking",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Strength"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.strength.toFixed(2)})]})]}),n.jsxs("div",{className:"grid grid-cols-4 gap-3 mt-2",children:[n.jsxs("div",{children:[n.jsx(M,{content:"Bidirectional balance (min/max) — 0 = one-way traffic, 1 = perfectly balanced",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Symmetry"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.symmetryRatio.toFixed(2)})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Dominant traffic flow direction between these nodes",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Direction"})}),n.jsx("div",{className:"text-fg-primary capitalize",children:e.dominantDirection})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Forward (A→B) vs reverse (B→A) observation counts",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Fwd / Rev"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.forwardCount," / ",e.reverseCount]})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Routing method — broadcast flood vs unicast direct routing",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Flood / Direct"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.floodCount," / ",e.directCount]})]})]}),(null!=e.avgRssi||null!=e.avgSnr)&&n.jsxs("div",{className:"grid grid-cols-2 gap-3 mt-2 pt-2 border-t border-edge-subtle/50",children:[null!=e.avgRssi&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase",children:"RSSI"}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.avgRssi.toFixed(1)," dBm"]})]}),null!=e.avgSnr&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase",children:"SNR"}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.avgSnr.toFixed(1)," dB"]})]})]}),e.linkBudget&&n.jsxs("div",{className:"grid grid-cols-4 gap-3 mt-2 pt-2 border-t border-edge-subtle/50",children:[null!=e.linkBudget.distanceKm&&n.jsxs("div",{children:[n.jsx(M,{content:"Haversine distance between endpoint locations",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Distance"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.linkBudget.distanceKm.toFixed(2)," km"]})]}),null!=e.linkBudget.fsplDb&&n.jsxs("div",{children:[n.jsx(M,{content:"Free Space Path Loss — theoretical signal attenuation over this distance at configured frequency",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"FSPL"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.linkBudget.fsplDb.toFixed(1)," dB"]})]}),null!=e.linkBudget.marginDb&&n.jsxs("div",{children:[n.jsx(M,{content:"Link margin — observed RSSI minus receiver sensitivity. Positive = signal headroom above minimum.",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Margin"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",style:{color:e.linkBudget.marginClass?Je[e.linkBudget.marginClass]:void 0},children:[e.linkBudget.marginDb>0?"+":"",e.linkBudget.marginDb.toFixed(1)," dB"]})]}),null!=e.linkBudget.deviationDb&&n.jsxs("div",{children:[n.jsx(M,{content:"Deviation from theoretical FSPL — positive means better signal than free-space prediction",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"vs Theory"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.linkBudget.deviationDb>0?"+":"",e.linkBudget.deviationDb.toFixed(1)," dB"]})]})]}),a&&n.jsx(At,{timeline:a})]})]})}),$t=s.memo(function({node:e,onClose:t,egoMetrics:a,onExpandEgo:i,neighbors:o,onSelectNeighbor:r,txDelayRec:l}){const[c,d]=s.useState(!1),[u,m]=s.useState(!1);return n.jsxs(h.div,{variants:Y,initial:"hidden",animate:"visible",exit:"exit",className:"absolute inset-x-3 bottom-3 z-20 surface-elevated radius-inset shadow-xl max-h-[60vh] flex flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-edge-subtle/50",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:($()?Dt:Ft)[e.nodeClass]}}),n.jsx("code",{className:"text-sm font-semibold text-fg-primary shrink-0",children:e.prefix}),e.name&&n.jsx("span",{className:"text-sm text-fg-secondary truncate",children:e.name}),n.jsxs("div",{className:"flex gap-1 shrink-0",children:[e.isLocal&&n.jsx(R,{color:"yellow",compact:!0,children:"LOCAL"}),e.isHub&&n.jsx(R,{color:"violet",compact:!0,children:"HUB"}),e.isGateway&&n.jsx(R,{color:"sky",compact:!0,children:"GW"}),e.isBackbone&&n.jsx(R,{color:"emerald",compact:!0,children:"BONE"}),e.isMobile&&n.jsx(R,{color:"orange",compact:!0,children:"MOB"}),e.isZeroHop&&n.jsx(R,{color:"amber",compact:!0,children:"RF"}),e.isGhost&&n.jsx(R,{color:"zinc",compact:!0,children:"GHOST"}),e.isInLoop&&n.jsx(R,{color:"indigo",compact:!0,children:"LOOP"})]})]}),n.jsx(I,{plain:!0,onClick:t,title:"Close",className:"shrink-0",children:n.jsx(p,{className:"size-4"})})]}),n.jsxs("div",{className:"p-3 font-mono text-[11px]",children:[n.jsx(J,{copy:!0,size:"compact",truncate:[10,6],className:"w-full mb-3",children:e.hash}),n.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[n.jsxs("div",{children:[n.jsx(M,{content:"Total connections (edges) to this node",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Degree"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.degree})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Inbound vs outbound edge count — indicates traffic directionality",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"In / Out"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.inDegree," / ",e.outDegree]})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Betweenness centrality (0–1) — how often this node lies on shortest paths. High value = critical relay.",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Between."})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.betweenness.toFixed(3)})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Total packets observed involving this node",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Packets"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.packetCount.toLocaleString()})]})]}),n.jsxs("div",{className:"grid grid-cols-4 gap-3 mt-2",children:[n.jsxs("div",{children:[n.jsx(M,{content:"Number of topology edges connected to this node",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Edges"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.edgeCount})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Community cluster assignment from graph partitioning algorithm",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Community"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:["#",e.communityId]})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Prefix disambiguation confidence — how certain the 2-char prefix→node mapping is (multi-factor scoring)",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Confidence"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[(100*e.prefixConfidence).toFixed(0),"%"]})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Recency level — active (<1h), recent (<6h), stale (<24h), inactive (>24h)",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Activity"})}),n.jsx("div",{className:"text-fg-primary capitalize",children:e.activityLevel})]})]}),(null!=e.avgRssi||null!=e.avgSnr)&&n.jsxs("div",{className:"grid grid-cols-2 gap-3 mt-2 pt-2 border-t border-edge-subtle/50",children:[null!=e.avgRssi&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase",children:"RSSI"}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.avgRssi.toFixed(1)," dBm"]})]}),null!=e.avgSnr&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase",children:"SNR"}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.avgSnr.toFixed(1)," dB"]})]})]}),a&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-3 gap-3 mt-2 pt-2 border-t border-edge-subtle/50",children:[n.jsxs("div",{children:[n.jsx(M,{content:"Number of direct 1-hop neighbors in the topology",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Ego Size"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:a.neighborCount})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Local clustering coefficient — how interconnected this node's neighbors are (0 = none, 1 = fully connected)",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Clustering"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:a.clusteringCoeff.toFixed(3)})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Average betweenness centrality of this node's direct neighbors",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Avg Nbr Btw."})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:a.avgNeighborBetweenness.toFixed(3)})]})]}),n.jsxs("div",{className:"grid grid-cols-3 gap-3 mt-2",children:[n.jsxs("div",{children:[n.jsx(M,{content:"Average disambiguation confidence across all connected edges",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Edge Conf."})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[(100*a.avgEdgeConfidence).toFixed(0),"%"]})]}),null!=a.avgRssi&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase",children:"Avg RSSI"}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[a.avgRssi.toFixed(1)," dBm"]})]}),null!=a.avgSnr&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase",children:"Avg SNR"}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[a.avgSnr.toFixed(1)," dB"]})]})]})]}),l&&!l.insufficientData&&n.jsxs("div",{className:"mt-2 pt-2 border-t border-edge-subtle/50",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[n.jsx(M,{content:"RF-grounded TX delay recommendation from centralized topology engine. Anchored to MeshCore firmware defaults with observer bias correction.",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase tracking-wide cursor-help",children:"TX Delay Recommendation"})}),n.jsxs("div",{className:"flex items-center gap-1",children:[l.networkRole&&n.jsx(R,{color:se[l.networkRole],compact:!0,children:l.networkRole}),l.dataConfidence&&n.jsx(R,{color:ne[l.dataConfidence],compact:!0,children:l.dataConfidence})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(M,{content:`Flood TX delay factor (firmware default: ×${ae})`,children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Flood"})}),n.jsx("div",{className:"text-fg-primary tabular-nums text-sys-amber",children:ie(l.floodFactor)})]}),n.jsxs("div",{children:[n.jsx(M,{content:`Direct TX delay factor (firmware default: ×${oe})`,children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Direct"})}),n.jsx("div",{className:"text-fg-primary tabular-nums text-sys-amber",children:ie(l.directFactor)})]})]}),l.rationale&&n.jsx("div",{className:"mt-1 text-[9px] text-fg-muted leading-snug",children:l.rationale}),null!=l.observationSymmetry&&l.observationSymmetry<.6&&n.jsxs("div",{className:"mt-1 text-[9px] text-sys-amber/70 leading-snug",children:["⚠ Low observation symmetry (",(100*l.observationSymmetry).toFixed(0),"%) — recommendation damped toward firmware defaults"]}),n.jsxs("button",{onClick:async()=>{const e=`set txdelay ${l.floodFactor.toFixed(1)}\nset direct.txdelay ${l.directFactor.toFixed(1)}`;try{await navigator.clipboard.writeText(e)}catch{}m(!0),setTimeout(()=>m(!1),1500)},className:"mt-1.5 flex items-center gap-1 text-[9px] text-sys-blue hover:text-sys-blue/80 transition-base",children:[u?n.jsx(G,{className:"w-3 h-3 text-sys-green"}):n.jsx(pe,{className:"w-3 h-3"}),u?"Copied!":"Copy CLI commands"]})]}),i&&n.jsx("div",{className:"mt-2 pt-2 border-t border-edge-subtle/50",children:n.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 text-[10px] text-sys-blue hover:text-sys-blue/80 transition-base",children:[n.jsx(O,{className:"w-3 h-3"}),"Expand 2-hop neighborhood"]})}),o&&o.length>0&&n.jsxs("div",{className:"mt-2 pt-2 border-t border-edge-subtle/50",children:[n.jsxs("button",{onClick:()=>d(e=>!e),className:"flex items-center justify-between w-full text-[9px] text-fg-muted uppercase tracking-wide cursor-pointer hover:text-fg-secondary transition-base",children:[n.jsxs("span",{children:["Neighbors (",o.length,")"]}),n.jsx(z,{className:"w-3 h-3 transition-transform "+(c?"rotate-180":"")})]}),c&&n.jsx("div",{className:"mt-1.5 max-h-32 overflow-y-auto space-y-0.5",children:o.map(e=>n.jsxs("button",{onClick:()=>null==r?void 0:r(e.hash),className:"w-full flex items-center gap-2 px-1.5 py-1 radius-badge hover-bg transition-base text-left group",children:[n.jsx("code",{className:"text-[10px] text-sys-blue shrink-0 tabular-nums",children:e.prefix}),n.jsx("span",{className:"text-[10px] text-fg-secondary truncate flex-1",children:e.name||"—"}),null!=e.avgSnr&&n.jsxs("span",{className:"text-[9px] text-fg-muted tabular-nums shrink-0",children:[e.avgSnr.toFixed(0)," dB"]}),null!=e.avgRssi&&n.jsx("span",{className:"text-[9px] text-fg-muted tabular-nums shrink-0",children:e.avgRssi.toFixed(0)}),n.jsxs("span",{className:"text-[9px] text-fg-muted/60 tabular-nums shrink-0",children:[(100*e.edgeConfidence).toFixed(0),"%"]})]},e.hash))})]})]})]})}),It=s.memo(function({metrics:e,onClose:t}){const s=Object.entries(e.communities).sort(([,e],[,t])=>t-e),a=Object.entries(e.nodeClasses).sort(([,e],[,t])=>t-e);return n.jsxs(h.div,{variants:Y,initial:"hidden",animate:"visible",exit:"exit",className:"absolute inset-x-3 bottom-3 z-20 surface-elevated radius-inset shadow-xl",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-edge-subtle/50",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(be,{className:"size-3.5 text-fg-muted shrink-0"}),n.jsx("span",{className:"text-sm font-semibold text-fg-primary",children:"Subgraph Analysis"}),n.jsxs(R,{color:"violet",compact:!0,children:[e.nodeCount," nodes"]})]}),n.jsx(I,{plain:!0,onClick:t,title:"Close",className:"shrink-0",children:n.jsx(p,{className:"size-4"})})]}),n.jsxs("div",{className:"p-3 font-mono text-[11px]",children:[n.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase",children:"Nodes"}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.nodeCount})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Edges where both endpoints are within the lasso selection",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Internal Edges"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.edgeCount})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Mean betweenness centrality of selected nodes",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Avg Between."})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.avgBetweenness.toFixed(3)})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Mean edge disambiguation confidence for internal edges",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Avg Confidence"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[(100*e.avgConfidence).toFixed(0),"%"]})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3 mt-2 pt-2 border-t border-edge-subtle/50",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase mb-1",children:"Communities"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:s.map(([e,t])=>n.jsxs("span",{className:"text-fg-secondary",children:["#",e,"×",t]},e))})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase mb-1",children:"Node Types"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:a.map(([e,t])=>n.jsxs("span",{className:"text-fg-secondary capitalize",children:[e,"×",t]},e))})]})]}),e.nodeCount>1&&n.jsx("div",{className:"mt-2 pt-2 border-t border-edge-subtle/50",children:n.jsxs("div",{className:"text-[9px] text-fg-muted flex items-center gap-1 flex-wrap",children:[n.jsx(M,{content:"Fraction of possible edges that exist — 2E / N(N-1)",children:n.jsxs("span",{className:"cursor-help",children:["Density: ",(2*e.edgeCount/(e.nodeCount*(e.nodeCount-1))*100).toFixed(1),"%"]})}),n.jsx("span",{children:"·"}),n.jsx(M,{content:"Mean connections per node — 2E / N",children:n.jsxs("span",{className:"cursor-help",children:["Avg Degree: ",(2*e.edgeCount/e.nodeCount).toFixed(1)]})}),null!=e.avgPathHealth&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"·"}),n.jsx(M,{content:"Average health score of paths within the selection",children:n.jsxs("span",{className:"cursor-help",children:["Path Health: ",(100*e.avgPathHealth).toFixed(0),"%"]})})]})]})})]})]})});function Gt(){return n.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 text-center px-8",children:[n.jsx("div",{className:"p-4 radius-pill bg-subtle-fill",children:n.jsx(xe,{className:"w-8 h-8 text-fg-muted"})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h2",{className:"type-subheading text-fg-primary",children:"No Topology Data"}),n.jsx("p",{className:"type-body text-fg-muted max-w-sm",children:"The mesh topology will appear here once packets are received and processed."})]}),n.jsxs("div",{className:"flex items-center gap-2 type-data-xs text-fg-muted",children:[n.jsx(P,{className:"w-4 h-4 animate-pulse"}),n.jsx("span",{children:"Waiting for mesh traffic..."})]})]})}const Ot=s.memo(function({label:e,value:t,onChange:a,min:i,max:o,step:r}){const[l,c]=s.useState(!1),[d,u]=s.useState(""),m=s.useRef(null),h=s.useCallback(()=>{const e=parseFloat(d);isNaN(e)||a(Math.min(o,Math.max(i,Math.round(e/r)*r))),c(!1)},[d,a,i,o,r]),x=s.useCallback(()=>{u(t.toFixed(2)),c(!0),setTimeout(()=>{var e;return null==(e=m.current)?void 0:e.select()},0)},[t]);return n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] text-fg-muted",children:e}),l?n.jsx("input",{ref:m,type:"number",value:d,onChange:e=>u(e.target.value),onBlur:h,onKeyDown:e=>{"Enter"===e.key&&h(),"Escape"===e.key&&c(!1)},min:i,max:o,step:r,className:"w-14 text-right text-[10px] text-fg-secondary tabular-nums bg-subtle-fill radius-badge px-1 py-0.5 border border-edge-subtle focus:outline-none focus:border-sys-blue"}):n.jsx("button",{onClick:x,className:"text-[10px] text-fg-secondary tabular-nums hover:text-sys-blue cursor-text transition-colors",title:"Click to type a value",children:t.toFixed(2)})]}),n.jsx("input",{type:"range",min:i,max:o,step:r,value:t,onChange:e=>a(parseFloat(e.target.value)),className:"w-full h-1 bg-subtle-fill rounded appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:bg-sys-blue [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:cursor-pointer"})]})}),Zt=s.memo(function({label:e,checked:t,onChange:s}){return n.jsxs(o,{className:"flex items-center justify-between",children:[n.jsx(r,{className:"text-[10px] text-fg-muted cursor-pointer select-none",children:e}),n.jsx(T,{enabled:t,onChange:s,size:"sm"})]})});function Wt(){var e,t,o,r,l,c,d,u,x,S,T,$,I,G,O;const Z=g(),[W,V]=s.useState(!1),[Y,J]=s.useState(!1),Q=s.useRef(!1);s.useEffect(()=>{Z&&!Q.current&&(Q.current=!0,J(!0))},[Z]);const ee=s.useCallback(()=>{J(!1),V(!0)},[]),se=f(),ne=function(e,t=1e3){const[n,a]=s.useState(e),i=s.useRef(Date.now()),o=s.useRef(null);return s.useEffect(()=>{const s=Date.now(),n=t-(s-i.current);return n<=0?(a(e),i.current=s):(o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{a(e),i.current=Date.now()},n)),()=>{o.current&&clearTimeout(o.current)}},[e,t]),n}(v(),2e3),ae=b(),ie=y(),oe=j(),xe=N(),pe=w(),ge=C(),je=k(),Ne=je?Dt:Ft,we=je?ft:vt,Ce=s.useMemo(()=>function(e){if("undefined"==typeof document)return e?L[950]:"#EFF0F1";const t=getComputedStyle(document.documentElement).getPropertyValue("--bg-body").trim();return t.startsWith("#")?t:e?L[950]:"#EFF0F1"}(je),[je]),ke=s.useMemo(()=>function(e){if("undefined"==typeof document)return e?L[400]:L[500];const t=getComputedStyle(document.documentElement).getPropertyValue("--text-secondary").trim();return t.startsWith("#")?t:e?L[400]:L[500]}(je),[je]),[Se,Le]=s.useState(!0),[De,Fe]=s.useState(null),[Re,Me]=s.useState(null),[He,Be]=s.useState(!1),[Pe,Ee]=s.useState(""),[ze,Te]=s.useState(!1),[$e,Ge]=s.useState(!1),[Oe,Ze]=s.useState("simulation"),[We,_e]=s.useState(!0),[qe,Ye]=s.useState(!1),[tt,st]=s.useState(!0),[nt,it]=s.useState(!1),[ot,rt]=s.useState(!1),[ct,dt]=s.useState(new Set),[ut,mt]=s.useState(!1),[bt,Mt]=s.useState("spectral"),[Et,At]=s.useState(1),[Wt,Vt]=s.useState(1),[Kt,_t]=s.useState(!1),[qt,Ut]=s.useState(null),[Xt,Yt]=s.useState(!1),[Jt,Qt]=s.useState(!1),[es,ts]=s.useState(null),[ss,ns]=s.useState(null),[as,is]=s.useState(null),[os,rs]=s.useState(null),[ls,cs]=s.useState(null),[ds,us]=s.useState(null),ms=s.useRef(!1),[hs,xs]=s.useState(!1),[ps,gs]=s.useState([]),[fs,vs]=s.useState(0),[bs,ys]=s.useState(null),js=s.useRef(new at),Ns=s.useRef(null),ws=s.useRef(null),[Cs,ks]=s.useState(null),[Ss,Ls]=s.useState(null),[Ds,Fs]=s.useState({}),[Rs,Ms]=s.useState({simulationDecay:2e4,simulationGravity:.05,simulationCenter:.05,simulationRepulsion:5,simulationRepulsionTheta:.4,simulationLinkSpring:.05,simulationLinkDistance:78,simulationFriction:.72,simulationRepulsionFromMouse:0,pointSizeScale:.4,pointOpacity:1,pointGreyoutOpacity:.1,linkWidthScale:.06,linkOpacity:.95,linkGreyoutOpacity:.1,curvedLinks:Nt,curvedLinkWeight:.8,linkDefaultArrows:wt,linkArrowsSizeScale:1.7,scalePointsOnZoom:Ct,scaleLinksOnZoom:kt,renderLinks:St,renderHoveredPointRing:Lt,spaceSize:4096}),Hs=s.useCallback((e,t)=>{Ms(s=>({...s,[e]:t}))},[]),Bs=s.useCallback(()=>{Ms({simulationDecay:2e4,simulationGravity:.05,simulationCenter:.05,simulationRepulsion:5,simulationRepulsionTheta:.4,simulationLinkSpring:.05,simulationLinkDistance:78,simulationFriction:.72,simulationRepulsionFromMouse:0,pointSizeScale:.4,pointOpacity:1,pointGreyoutOpacity:.1,linkWidthScale:.06,linkOpacity:.95,linkGreyoutOpacity:.1,curvedLinks:Nt,curvedLinkWeight:.8,linkDefaultArrows:wt,linkArrowsSizeScale:1.7,scalePointsOnZoom:Ct,scaleLinksOnZoom:kt,renderLinks:St,renderHoveredPointRing:Lt,spaceSize:4096})},[]);s.useEffect(()=>()=>{var e;try{null==(e=ws.current)||e.destroy()}catch{}ws.current=null},[]),s.useEffect(()=>{const e=e=>{var t,s;if(!(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement))switch(e.key.toLowerCase()){case"f":e.metaKey||e.ctrlKey||(e.preventDefault(),null==(t=ws.current)||t.fitView(xt));break;case"escape":ze?(Te(!1),Ee("")):De&&(Fe(null),null==(s=ws.current)||s.unselectAllPoints());break;case"/":ze||(e.preventDefault(),Te(!0),setTimeout(()=>{var e;return null==(e=Ns.current)?void 0:e.focus()},50));break;case" ":e.preventDefault(),ws.current&&(Se?ws.current.pause():ws.current.start(),Le(e=>!e));break;case"l":_e(e=>!e)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ze,De,Se]);const Ps=s.useMemo(()=>new Set((null==se?void 0:se.backboneEdges)??[]),[null==se?void 0:se.backboneEdges]),Es=s.useMemo(()=>({resolution:Et,kWeight:Wt}),[Et,Wt]),zs=s.useMemo(()=>{if("louvain"!==bt)return null;const e=null==se?void 0:se.edges;return!e||0===e.length||!ne||ne.size<3?null:Ie(e,Array.from(ne.keys()),Es).communities},[bt,null==se?void 0:se.edges,ne,Es]),As=s.useMemo(()=>{var e;if(!ne||0===ne.size||!W)return[];const t=[],s=(null==ge?void 0:ge.node_name)??(null==(e=null==ge?void 0:ge.config)?void 0:e.node_name)??null,n=je?"#171717":"#EFF0F1";let a=1;for(const i of ne.values())i.degree>a&&(a=i.degree);for(const i of ne.values()){const e=i,o=e.degree>0?Math.log10(e.degree+1)/Math.log10(a+1):0,r=5+23*Math.min(1,o),l=6*e.betweenness,c=e.isLocal?28:Math.min(34,r+l),d=(null==zs?void 0:zs.get(e.hash))??e.communityId,u=ut&&d>=0?we[d%we.length]:Ne[e.nodeClass],m=gt[e.activityLevel]??1,h=e.isLocal?Ne.local:m<1?Ht(u,n,m):u,x=e.isLocal?s??e.name:e.name;t.push({id:e.hash,label:x?`${e.prefix} ${x}`:e.prefix,color:h,size:c,nodeClass:e.nodeClass,name:x,prefix:e.prefix,packetCount:e.packetCount,isLocal:e.isLocal,isHub:e.isHub,isGateway:e.isGateway,isBackbone:e.isBackbone,isMobile:e.isMobile,isZeroHop:e.isZeroHop,isGhost:e.isGhost,degree:e.degree,betweenness:e.betweenness,communityId:(null==zs?void 0:zs.get(e.hash))??e.communityId,activityLevel:e.activityLevel,prefixConfidence:e.prefixConfidence,hasCollision:e.hasCollision,inDegree:e.inDegree,outDegree:e.outDegree,isInLoop:e.isInLoop,avgRssi:e.avgRssi,avgSnr:e.avgSnr})}for(const i of ae){const e=`ghost-${i.prefix}`;if(t.some(t=>t.id===e))continue;const s=Ht(Ne.ghost,n,.6);t.push({id:e,label:`? ${i.prefix.toUpperCase()}`,color:s,size:6,nodeClass:"ghost",name:null,prefix:i.prefix,packetCount:i.observationCount,isLocal:!1,isHub:!1,isGateway:!1,isBackbone:!1,isMobile:!1,isZeroHop:!1,isGhost:!0,degree:i.commonNeighbors.size,betweenness:0,communityId:-1,activityLevel:"active",prefixConfidence:i.confidence,hasCollision:!1,inDegree:0,outDegree:0,isInLoop:!1,avgRssi:null,avgSnr:null})}return t},[ne,W,null==ge?void 0:ge.node_name,null==(e=null==ge?void 0:ge.config)?void 0:e.node_name,Ne,je,ae,we,ut,bt,zs]),Ts=s.useMemo(()=>new Set(As.map(e=>e.id)),[As]),$s=s.useMemo(()=>{const e=new Map;if(!ne)return e;for(const t of ne.values())e.set(t.hash,t.name);return e},[ne]),Is=s.useMemo(()=>{const e=(null==se?void 0:se.edges)??[];if(!e.length||!W)return[];const t=[],s=(null==se?void 0:se.edgeBetweenness)??new Map;for(const a of e){if(!Ts.has(a.fromHash)||!Ts.has(a.toHash))continue;const e=Bt(a,Ps),n=Pt(e,a.avgConfidence,je),i=s.get(a.key)??0,o=i>0?.5+4*i:.5+2*Math.min(1,a.certainCount/50);t.push({source:a.fromHash,target:a.toHash,color:n,width:o,key:a.key,packetCount:a.packetCount,certainCount:a.certainCount,confidence:a.avgConfidence,symmetryRatio:a.symmetryRatio,dominantDirection:a.dominantDirection,isBackbone:Ps.has(a.key),isLoopEdge:a.isLoopEdge??!1,isDirectPath:a.isDirectPathEdge,isZeroHop:a.isZeroHop??!1,isGhost:!1,forwardCount:a.forwardCount,reverseCount:a.reverseCount,floodCount:a.floodCount,directCount:a.directCount,avgRssi:a.avgRssi??null,avgSnr:a.avgSnr??null,strength:a.strength,fromName:$s.get(a.fromHash)??null,toName:$s.get(a.toHash)??null,edgeType:e})}const n=je?yt:jt;for(const a of ae){const e=`ghost-${a.prefix}`;if(Ts.has(e))for(const s of a.commonNeighbors)Ts.has(s)&&t.push({source:e,target:s,color:n.ghost,width:.4,key:`ghost-${a.prefix}-${s}`,packetCount:a.observationCount,certainCount:0,confidence:a.confidence,symmetryRatio:0,dominantDirection:"balanced",isBackbone:!1,isLoopEdge:!1,isDirectPath:!1,isZeroHop:!1,isGhost:!0,forwardCount:0,reverseCount:0,floodCount:0,directCount:0,avgRssi:null,avgSnr:null,strength:a.confidence,fromName:null,toName:$s.get(s)??null,edgeType:"ghost"})}return t},[null==se?void 0:se.edges,null==se?void 0:se.edgeBetweenness,W,Ts,je,Ps,$s,ae]),Gs=null==(o=null==(t=null==ge?void 0:ge.config)?void 0:t.radio)?void 0:o.frequency,Os=null==(l=null==(r=null==ge?void 0:ge.config)?void 0:r.radio)?void 0:l.bandwidth,Zs=null==(d=null==(c=null==ge?void 0:ge.config)?void 0:c.radio)?void 0:d.spreading_factor,Ws=null==(x=null==(u=null==ge?void 0:ge.config)?void 0:u.radio)?void 0:x.tx_power,Vs=null==(T=null==(S=null==ge?void 0:ge.config)?void 0:S.radio)?void 0:T.coding_rate;s.useEffect(()=>{Jt&&!ms.current&&(ms.current=!0,(async()=>{var e,t;try{const s=await D(24);if(s.success&&(null==(t=null==(e=s.data)?void 0:e.history)?void 0:t.length)){const e=s.data.history.map(e=>e.noise_floor_dbm).filter(e=>null!=e&&e>-200&&e<0);if(e.length>0){const t=[...e].sort((e,t)=>e-t),s=t[Math.floor(t.length/2)];us(s)}}}catch{}})())},[Jt]);const Ks=s.useMemo(()=>{if(!se||!Jt)return null;const e={frequency:Gs,bandwidth:null!=as?1e3*as:Os,spreading_factor:ss??Zs,tx_power:es??Ws,coding_rate:os??Vs},t={};return null!=ls&&(t.sensitivityOverrideDbm=ls),null!=ds&&(t.observedNoiseFloorDbm=ds),function(e,t,s){const n=[],a=e.nodeMetrics,i=new Set,o=t.tx_power??22;for(const r of e.edges){if(!r.isZeroHop)continue;const e=a.get(r.fromHash),o=a.get(r.toHash);n.push(Ue(r,e,o,t,s)),i.add(r.key)}for(const r of e.edges){if(i.has(r.key))continue;if(!r.traceQuality)continue;const e=Xe(r,a.get(r.fromHash),a.get(r.toHash),t,o,s);e&&(n.push(e),i.add(r.key))}return n}(se,e,t)},[se,Jt,Gs,Os,Zs,Ws,Vs,es,ss,as,os,ls,ds]),_s=s.useMemo(()=>{if(!Ks)return null;const e=new Map;for(const t of Ks)e.set(t.edgeKey,t);return e},[Ks]),qs=s.useMemo(()=>Ks&&0!==Ks.length?function(e){const t={"anomalous-good":0,better:0,expected:0,worse:0,"anomalous-bad":0},s={excellent:0,good:0,fair:0,marginal:0,critical:0};let n=0,a=0,i=null,o=null,r=0,l=0;for(const c of e)c.hasData&&(null!=c.marginDb&&(n+=c.marginDb,a++,(!i||c.marginDb<(i.marginDb??1/0))&&(i=c),(!o||c.marginDb>(o.marginDb??-1/0))&&(o=c)),c.marginClass&&s[c.marginClass]++,null!=c.deviationDb&&c.deviationClass?(t[c.deviationClass]++,l++):r++);return{totalEdges:e.length,analyzedEdges:l,rssiOnlyEdges:r,avgMarginDb:a>0?n/a:null,worstMargin:i,bestMargin:o,deviationCounts:t,marginCounts:s,anomalousCount:t["anomalous-good"]+t["anomalous-bad"]}}(Ks):null,[Ks]),Us=s.useMemo(()=>{if(!Jt||!_s)return Is;const e=je?"#303038":"#D0D0D8";return Is.map(t=>{const s=_s.get(t.key);return s&&s.hasData?{...t,color:Qe(s,"margin"),width:et(s),linkBudget:s}:{...t,color:e,width:.3}})},[Is,Jt,_s,je]),Xs=s.useMemo(()=>0===ct.size?As:As.filter(e=>!ct.has(e.nodeClass)),[As,ct]),Ys=s.useMemo(()=>{if(0===ct.size)return Us;const e=new Set(Xs.map(e=>e.id));return Us.filter(t=>e.has(t.source)&&e.has(t.target))},[Us,Xs,ct]),Js=s.useRef([]);s.useEffect(()=>{Js.current=Ys},[Ys]);const Qs=s.useMemo(()=>{const e=new Map;for(const t of Is)e.set(t.source,(e.get(t.source)??0)+1),e.set(t.target,(e.get(t.target)??0)+1);return e},[Is]),en=s.useMemo(()=>{const e=new Map;for(const t of As)e.set(t.id,t);return e},[As]);s.useEffect(()=>{if(0===Xs.length)return ks(null),Ls(null),void Fs({});let e=!1;const t=setTimeout(async()=>{try{const t=Xs.map(e=>({id:e.id,label:e.label,color:e.color,size:e.size,communityId:String(e.communityId)})),s=Ys.map(e=>({source:e.source,target:e.target,color:e.color,width:e.width})),n={points:{pointIdBy:"id",pointColorBy:"color",pointColorStrategy:"direct",pointDefaultColor:je?"#9CA3AF":"#374151",pointLabelBy:"label",pointSizeBy:"size",pointSizeStrategy:"direct",pointDefaultSize:8,pointSizeScale:1,pointGreyoutOpacity:.3,pointIncludeColumns:["communityId"]},links:{linkSourceBy:"source",linkTargetsBy:["target"],linkColorBy:"color",linkColorStrategy:"direct",linkDefaultColor:je?"#6B7280":"#9CA3AF",linkWidthBy:"width",linkWidthStrategy:"direct",linkDefaultWidth:1,linkWidthScale:1,linkGreyoutOpacity:.1}},a=await i(n,t,s);if(e||!a)return;ks(a.points??null),Ls(a.links??null),Fs(a.cosmographConfig??{})}catch(t){}},100);return()=>{e=!0,clearTimeout(t)}},[Xs,Ys,je]);const tn=s.useCallback(e=>{e&&(ws.current=e,e.start(),setTimeout(()=>{e.fitView(xt)},1500))},[]),sn=s.useCallback(()=>{var e;null==(e=ws.current)||e.fitView(xt)},[]),nn=s.useCallback(()=>{const e=ws.current;e&&(Se?e.pause():e.start(),Le(!Se))},[Se]),an=s.useCallback(async e=>{const t=ws.current,s=en.get(e);if(s){if(t)try{const s=await t.getPointIndicesByIds([e]);s&&s.length>0&&void 0!==s[0]&&(t.zoomToPoint(s[0],400,2.5),t.selectPoint(s[0],!1,!0))}catch{}Me(null),Fe({hash:e,name:s.name,prefix:s.prefix,nodeClass:s.nodeClass,packetCount:s.packetCount,edgeCount:Qs.get(e)??0,degree:s.degree,betweenness:s.betweenness,communityId:s.communityId,isLocal:s.isLocal,isHub:s.isHub,isGateway:s.isGateway,isBackbone:s.isBackbone,isMobile:s.isMobile,isZeroHop:s.isZeroHop,isGhost:s.isGhost,isInLoop:s.isInLoop,activityLevel:s.activityLevel,prefixConfidence:s.prefixConfidence,hasCollision:s.hasCollision,inDegree:s.inDegree,outDegree:s.outDegree,avgRssi:s.avgRssi,avgSnr:s.avgSnr})}},[en,Qs]),on=s.useRef(null);s.useEffect(()=>{on.current=_s},[_s]);const rn=s.useCallback(e=>{var t;if(void 0===e)return void Me(null);const s=Js.current[e];if(!s)return;const n=null==(t=on.current)?void 0:t.get(s.key);Me(n&&!s.linkBudget?{...s,linkBudget:n}:s),Fe(null)},[]),ln=s.useCallback(async(e,t,s)=>{var n;if(void 0===e)return Fe(null),Ut(null),void(null==(n=ws.current)||n.unselectAllPoints());Me(null);const a=ws.current;if(a)try{const t=await a.getPointIdsByIndices([e]);if(!t||0===t.length)return;const s=t[0],n=en.get(s);if(!n)return;a.selectPoint(e,!1,!0),Fe({hash:s,name:n.name,prefix:n.prefix,nodeClass:n.nodeClass,packetCount:n.packetCount,edgeCount:Qs.get(s)??0,degree:n.degree,betweenness:n.betweenness,communityId:n.communityId,isLocal:n.isLocal,isHub:n.isHub,isGateway:n.isGateway,isBackbone:n.isBackbone,isMobile:n.isMobile,isZeroHop:n.isZeroHop,isGhost:n.isGhost,isInLoop:n.isInLoop,activityLevel:n.activityLevel,prefixConfidence:n.prefixConfidence,hasCollision:n.hasCollision,inDegree:n.inDegree,outDegree:n.outDegree,avgRssi:n.avgRssi,avgSnr:n.avgSnr})}catch{}},[en,Qs]),cn=s.useMemo(()=>{if(!ze||!Pe.trim())return[];const e=Pe.toLowerCase();return As.filter(t=>{var s;return t.prefix.toLowerCase().includes(e)||(null==(s=t.name)?void 0:s.toLowerCase().includes(e))||t.id.toLowerCase().includes(e)}).slice(0,8)},[As,Pe,ze]),dn=s.useCallback(e=>{Te(!1),Ee(""),an(e.id)},[an]),un=s.useCallback(()=>{Be(e=>!e)},[]),mn=s.useCallback(e=>{dt(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),hn=s.useCallback(()=>{mt(e=>{const t=!e,s=ws.current;return s&&s.start(.5),t})},[]),xn=s.useCallback(()=>{_t(e=>{const t=!e,s=ws.current;return s?(t?s.activatePolygonalSelection():(s.deactivatePolygonalSelection(),Ut(null),s.unselectAllPoints()),t):t})},[]),pn=s.useCallback(async()=>{const e=ws.current;if(!e)return;await new Promise(e=>setTimeout(e,80));const t=e.getSelectedPointIndices();if(!t||0===t.length)return void Ut(null);const s=await e.getPointIdsByIndices(t);if(!s||0===s.length)return void Ut(null);const n=new Set(s);let a=0,i=0;for(const m of Js.current)n.has(m.source)&&n.has(m.target)&&(a++,i+=m.confidence);let o=0;const r={},l={};for(const m of s){const e=en.get(m);e&&(o+=e.betweenness,r[e.communityId]=(r[e.communityId]??0)+1,l[e.nodeClass]=(l[e.nodeClass]??0)+1)}const c=new Set;for(const m of s){const e=en.get(m);e&&c.add(e.prefix.toLowerCase())}let d=0,u=0;for(const m of xe)if(m.hops.length>=2){const e=m.hops[0].toLowerCase(),t=m.hops[m.hops.length-1].toLowerCase();c.has(e)&&c.has(t)&&(d+=m.healthScore,u++)}Ut({nodeCount:s.length,edgeCount:a,avgBetweenness:s.length>0?o/s.length:0,avgConfidence:a>0?i/a:0,avgPathHealth:u>0?d/u:null,communities:r,nodeClasses:l}),Fe(null),Me(null)},[en,xe]),gn=s.useCallback(()=>{var e;Ut(null),null==(e=ws.current)||e.unselectAllPoints()},[]),fn=s.useMemo(()=>{var e;if(!De)return null;const t=De.hash,s=new Set;for(const h of Ys)h.source===t?s.add(h.target):h.target===t&&s.add(h.source);if(0===s.size)return{clusteringCoeff:0,avgNeighborBetweenness:0,neighborCount:0,avgEdgeConfidence:0,avgRssi:null,avgSnr:null};let n=0;for(const h of Ys)s.has(h.source)&&s.has(h.target)&&n++;const a=s.size,i=a>1?2*n/(a*(a-1)):0;let o=0;for(const h of s)o+=(null==(e=en.get(h))?void 0:e.betweenness)??0;let r=0,l=0,c=0,d=0,u=0,m=0;for(const h of Ys)h.source!==t&&h.target!==t||(r+=h.confidence,l++,null!=h.avgRssi&&(c+=h.avgRssi,d++),null!=h.avgSnr&&(u+=h.avgSnr,m++));return{clusteringCoeff:Math.min(1,i),avgNeighborBetweenness:o/a,neighborCount:a,avgEdgeConfidence:l>0?r/l:0,avgRssi:d>0?c/d:null,avgSnr:m>0?u/m:null}},[De,Ys,en]),vn=s.useMemo(()=>De&&pe?pe.get(De.hash)??null:null,[De,pe]),bn=s.useMemo(()=>{if(!De)return[];const e=De.hash,t=[],s=new Set;for(const n of Ys){let a=null;if(n.source===e?a=n.target:n.target===e&&(a=n.source),!a||s.has(a))continue;s.add(a);const i=en.get(a);t.push({hash:a,prefix:(null==i?void 0:i.prefix)??a.slice(2,4).toUpperCase(),name:(null==i?void 0:i.name)??null,edgeConfidence:n.confidence,edgeType:n.edgeType,avgRssi:n.avgRssi,avgSnr:n.avgSnr})}return t.sort((e,t)=>t.edgeConfidence-e.edgeConfidence),t},[De,Ys,en]),yn=s.useCallback(async()=>{const e=ws.current;if(!e||!De)return;const t=await e.getPointIndicesByIds([De.hash]);if(!t||void 0===t[0])return;const s=t[0],n=e.getConnectedPointIndices(s)??[],a=new Set([s,...n]);for(const o of n){const t=e.getConnectedPointIndices(o)??[];for(const e of t)a.add(e)}const i=Array.from(a);e.selectPoints(i),e.fitViewByIndices(i,xt,.15)},[De]);s.useEffect(()=>{if(!Kt)return;const e=e=>{var t,s;"Escape"===e.key&&(_t(!1),null==(t=ws.current)||t.deactivatePolygonalSelection(),Ut(null),null==(s=ws.current)||s.unselectAllPoints())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[Kt]);const jn=s.useCallback((e,t)=>{se&&(function(e,t){!function(e){const t=new Blob([e.content],{type:e.mimeType}),s=URL.createObjectURL(t),n=document.createElement("a");n.href=s,n.download=e.filename,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(s)}(Ae(e,t))}(se,{format:e,dataset:t}),Yt(!1))},[se]),Nn=s.useMemo(()=>{if(!se||!xe.length)return null;const e=se.edges??[];return 0===e.length?null:function(e,t,s=-137){const n=new Map;for(const o of t)n.set(o.key,o);const a=t.filter(e=>null!=e.avgRssi).length,i=[];for(const o of e){const e=lt(o,n,s);e&&i.push(e)}return i.sort((e,t)=>t.riskScore-e.riskScore),{atRiskPaths:i,criticalCount:i.filter(e=>"critical"===e.riskLevel).length,highCount:i.filter(e=>"high"===e.riskLevel).length,moderateCount:i.filter(e=>"moderate"===e.riskLevel).length,edgesAnalyzed:t.length,edgesWithSignal:a}}(xe,e)},[se,xe]),wn=s.useMemo(()=>{const e=null==se?void 0:se.edges;if(!e||0===e.length||!ne||ne.size<3)return null;const t=Array.from(ne.keys());return _(e,t)},[null==se?void 0:se.edges,ne]),Cn=s.useMemo(()=>{if("louvain"!==bt)return null;const e=null==se?void 0:se.edges;return!e||0===e.length||!ne||ne.size<3?null:Ie(e,Array.from(ne.keys()),Es)},[bt,null==se?void 0:se.edges,ne,Es]);s.useEffect(()=>{if(!se)return;const e=new Map;for(const[s,n]of se.nodeMetrics)e.set(s,n.name);const t=js.current.update(se,e);t.totalCount>0&&(gs(js.current.getLog()),vs(e=>e+t.totalCount))},[se]);const kn=s.useCallback(()=>{vs(0),xs(e=>!e)},[]),Sn=s.useMemo(()=>function(e,t){if(null==e)return null;const s=Math.max(0,e),n=s>0?(Math.log10(s)+4)/4.5:0,a=Math.round(Math.max(0,Math.min(100,100*n)));let i,o;a<10?(i="critical",o="Partition risk"):a<30?(i="poor",o="Weak connectivity"):a<55?(i="fair",o="Moderate resilience"):a<80?(i="good",o="Well connected"):(i="excellent",o="Highly resilient");const[r,l]=pt[i];return{score:a,grade:i,label:o,color:t?r:l}}(wn,je),[wn,je]),Ln=n.jsxs("div",{className:"absolute top-0 left-0 right-0 z-20 px-4 py-3 pointer-events-none flex items-start justify-between",children:[n.jsxs("h1",{className:"type-title text-fg-primary flex items-center gap-2 sm:gap-3 pointer-events-auto",children:[n.jsx(F,{className:"w-5 h-5 sm:w-6 sm:h-6 text-icon-page-title"}),n.jsx("span",{children:"MeshGraph"}),n.jsx(R,{color:"violet",compact:!0,children:"Analytics"})]}),Sn&&n.jsx(M,{content:n.jsxs("div",{className:"max-w-xs space-y-2",children:[n.jsx("div",{className:"font-semibold text-fg-primary",children:"Mesh Resilience Score"}),n.jsx("div",{className:"text-fg-secondary",children:"Derived from the Fiedler eigenvalue (λ₂) — the second-smallest eigenvalue of the graph Laplacian. Measures how well-connected the mesh is and how resistant it is to partitioning."}),n.jsxs("div",{className:"space-y-0.5 font-mono text-[10px]",children:[n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Raw λ₂"}),n.jsx("span",{className:"text-fg-primary tabular-nums",children:(null==wn?void 0:wn.toFixed(6))??"—"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Score"}),n.jsxs("span",{className:"tabular-nums",style:{color:Sn.color},children:[Sn.score,"/100"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Grade"}),n.jsx("span",{className:"capitalize",style:{color:Sn.color},children:Sn.grade})]})]}),n.jsxs("div",{className:"pt-1 border-t border-edge-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-fg-muted font-medium",children:"Grade thresholds"}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:pt.excellent[0]},children:"Excellent"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"80-100 (λ₂ > 0.3)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:pt.good[0]},children:"Good"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"55-79 (λ₂ 0.03-0.3)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:pt.fair[0]},children:"Fair"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"30-54 (λ₂ 0.003-0.03)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:pt.poor[0]},children:"Poor"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"10-29 (λ₂ 0.0001-0.003)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:pt.critical[0]},children:"Critical"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"<10 (λ₂ ≈ 0)"})]})]}),n.jsx("div",{className:"text-[10px] text-fg-muted italic",children:"Near-zero λ₂ = one bridge away from network partition. Log-scale mapping: small λ₂ changes at low values have outsized impact."})]}),children:n.jsxs("div",{className:"pointer-events-auto surface-control radius-inner px-3 py-1.5 flex items-center gap-2 cursor-help",children:[n.jsxs("div",{className:"flex items-baseline gap-1.5",children:[n.jsx("span",{className:"text-[10px] text-fg-muted uppercase tracking-wider",children:"Resilience"}),n.jsx("span",{className:"text-lg font-semibold tabular-nums leading-none",style:{color:Sn.color},children:Sn.score})]}),n.jsx("div",{className:"w-12 h-1.5 rounded-full bg-subtle-fill overflow-hidden",children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${Sn.score}%`,backgroundColor:Sn.color}})})]})})]}),Dn=(e,t=!1)=>{const s="flex flex-col items-center gap-0.5 px-1.5 py-1 radius-inner transition-all duration-100 active:scale-95";return e&&t?`${s} bg-status-warning/15 text-status-warning shadow-inner`:e?`${s} bg-sys-blue/20 text-sys-blue shadow-inner`:`${s} hover:bg-white/5 hover:scale-105 text-fg-secondary`},Fn=n.jsx("div",{className:"w-px h-6 bg-border-subtle/40 mx-0.5 shrink-0"}),Rn=n.jsxs("div",{className:"absolute top-12 right-3 z-10 flex items-center gap-0.5 surface-control radius-inner px-1.5 py-1",children:[n.jsx(M,{content:"Visible nodes / edges in the graph",children:n.jsxs("span",{className:"text-[9px] text-fg-muted tabular-nums mr-1.5 leading-none cursor-help",children:[Xs.length,n.jsx("br",{}),Ys.length]})}),Fn,n.jsx(M,{content:We?"Hide labels (L)":"Show labels (L)",children:n.jsxs("button",{onClick:()=>_e(e=>!e),className:Dn(!We,!0),children:[We?n.jsx(re,{className:"w-3.5 h-3.5"}):n.jsx(q,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Lbl"})]})}),n.jsx(M,{content:ut?"Disable clustering":"Community clustering",children:n.jsxs("button",{onClick:hn,className:Dn(ut),children:[n.jsx(ve,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Grp"})]})}),n.jsx(M,{content:Kt?"Exit lasso (Esc)":"Lasso selection",children:n.jsxs("button",{onClick:xn,className:Dn(Kt,!0),children:[n.jsx(be,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Sel"})]})}),Fn,n.jsx(M,{content:"Legend",children:n.jsxs("button",{onClick:()=>Ye(e=>!e),className:Dn(qe),children:[n.jsx(de,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Map"})]})}),n.jsx(M,{content:"Search (/)",children:n.jsxs("button",{onClick:()=>{Te(!0),setTimeout(()=>{var e;return null==(e=Ns.current)?void 0:e.focus()},50)},className:Dn(ze),children:[n.jsx(ue,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Fnd"})]})}),Fn,n.jsx(M,{content:Se?"Pause (Space)":"Play (Space)",children:n.jsxs("button",{onClick:nn,className:Dn(!Se),children:[Se?n.jsx(H,{className:"w-3.5 h-3.5 text-sys-green"}):n.jsx(B,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:Se?"Run":"Stop"})]})}),n.jsx(M,{content:"Fit view (F)",children:n.jsxs("button",{onClick:sn,className:Dn(!1),children:[n.jsx(fe,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Fit"})]})}),Fn,n.jsx(M,{content:Jt?"Disable link budget":"Link budget overlay",children:n.jsxs("button",{onClick:()=>Qt(e=>!e),className:Dn(Jt),children:[n.jsx(P,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"RF"})]})}),n.jsx(M,{content:"Anomaly log",children:n.jsxs("button",{onClick:kn,className:`relative ${Dn(hs,!0)}`,children:[n.jsx(le,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Alert"}),fs>0&&n.jsx("span",{className:"absolute -top-1 -right-0.5 w-3 h-3 rounded-full bg-status-danger text-[7px] font-bold text-white flex items-center justify-center",children:fs>9?"9+":fs})]})}),n.jsx(M,{content:"Export topology",children:n.jsxs("button",{onClick:()=>Yt(e=>!e),className:Dn(Xt),children:[n.jsx(te,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Exp"})]})}),n.jsx(M,{content:"Settings",children:n.jsxs("button",{onClick:()=>Ge(e=>!e),className:Dn($e),children:[n.jsx(me,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Cfg"})]})}),Fn,n.jsx(M,{content:He?"Exit fullscreen":"Fullscreen",children:n.jsxs("button",{onClick:un,className:Dn(He),children:[He?n.jsx(U,{className:"w-3.5 h-3.5"}):n.jsx(K,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Max"})]})})]}),Mn=n.jsxs(ht,{id:"settings",title:"Graph Settings",icon:n.jsx(me,{}),open:$e,onClose:()=>Ge(!1),defaultPosition:{x:"undefined"!=typeof window?window.innerWidth-308:600,y:60},defaultSize:{width:288,height:420},minSize:{width:260,height:200},maxSize:{width:400,height:600},headerActions:n.jsx(M,{content:"Reset to defaults",children:n.jsx("button",{onClick:Bs,className:"p-0.5 radius-badge hover-bg transition-base",children:n.jsx(ye,{className:"w-2.5 h-2.5 text-fg-muted"})})}),children:[n.jsx("div",{className:"flex border-b border-edge-subtle",children:["simulation","points","links","rendering"].map(e=>n.jsx("button",{onClick:()=>Ze(e),className:"flex-1 px-2 py-1.5 text-[10px] font-medium capitalize transition-colors "+(Oe===e?"text-sys-blue border-b-2 border-sys-blue":"text-fg-muted hover:text-fg-secondary"),children:e},e))}),n.jsxs("div",{className:"p-3 space-y-3",children:["simulation"===Oe&&n.jsxs(n.Fragment,{children:[n.jsx(Ot,{label:"Gravity",value:Rs.simulationGravity,onChange:e=>Hs("simulationGravity",e),min:0,max:1,step:.01}),n.jsx(Ot,{label:"Repulsion",value:Rs.simulationRepulsion,onChange:e=>Hs("simulationRepulsion",e),min:0,max:5,step:.1}),n.jsx(Ot,{label:"Link Spring",value:Rs.simulationLinkSpring,onChange:e=>Hs("simulationLinkSpring",e),min:0,max:2,step:.05}),n.jsx(Ot,{label:"Link Distance",value:Rs.simulationLinkDistance,onChange:e=>Hs("simulationLinkDistance",e),min:1,max:100,step:1}),n.jsx(Ot,{label:"Friction",value:Rs.simulationFriction,onChange:e=>Hs("simulationFriction",e),min:0,max:1,step:.01}),n.jsx(Ot,{label:"Center Force",value:Rs.simulationCenter,onChange:e=>Hs("simulationCenter",e),min:0,max:1,step:.01}),n.jsx(Ot,{label:"Decay",value:Rs.simulationDecay,onChange:e=>Hs("simulationDecay",e),min:100,max:2e4,step:100}),n.jsx(Ot,{label:"Repulsion Theta",value:Rs.simulationRepulsionTheta,onChange:e=>Hs("simulationRepulsionTheta",e),min:.1,max:3,step:.05}),n.jsx(Ot,{label:"Mouse Repulsion",value:Rs.simulationRepulsionFromMouse,onChange:e=>Hs("simulationRepulsionFromMouse",e),min:0,max:10,step:.5})]}),"points"===Oe&&n.jsxs(n.Fragment,{children:[n.jsx(Ot,{label:"Size Scale",value:Rs.pointSizeScale,onChange:e=>Hs("pointSizeScale",e),min:.1,max:5,step:.1}),n.jsx(Ot,{label:"Opacity",value:Rs.pointOpacity,onChange:e=>Hs("pointOpacity",e),min:0,max:1,step:.05}),n.jsx(Ot,{label:"Greyout Opacity",value:Rs.pointGreyoutOpacity,onChange:e=>Hs("pointGreyoutOpacity",e),min:0,max:1,step:.05}),n.jsx(Zt,{label:"Scale on Zoom",checked:Rs.scalePointsOnZoom,onChange:e=>Hs("scalePointsOnZoom",e)}),n.jsx(Zt,{label:"Hover Ring",checked:Rs.renderHoveredPointRing,onChange:e=>Hs("renderHoveredPointRing",e)})]}),"links"===Oe&&n.jsxs(n.Fragment,{children:[n.jsx(Zt,{label:"Show Links",checked:Rs.renderLinks,onChange:e=>Hs("renderLinks",e)}),n.jsx(Zt,{label:"Curved Links",checked:Rs.curvedLinks,onChange:e=>Hs("curvedLinks",e)}),n.jsx(Zt,{label:"Show Arrows",checked:Rs.linkDefaultArrows,onChange:e=>Hs("linkDefaultArrows",e)}),n.jsx(Ot,{label:"Width Scale",value:Rs.linkWidthScale,onChange:e=>Hs("linkWidthScale",e),min:.1,max:5,step:.1}),n.jsx(Ot,{label:"Opacity",value:Rs.linkOpacity,onChange:e=>Hs("linkOpacity",e),min:0,max:1,step:.05}),n.jsx(Ot,{label:"Greyout Opacity",value:Rs.linkGreyoutOpacity,onChange:e=>Hs("linkGreyoutOpacity",e),min:0,max:1,step:.05}),Rs.curvedLinks&&n.jsx(Ot,{label:"Curve Weight",value:Rs.curvedLinkWeight,onChange:e=>Hs("curvedLinkWeight",e),min:0,max:1,step:.05}),Rs.linkDefaultArrows&&n.jsx(Ot,{label:"Arrow Size",value:Rs.linkArrowsSizeScale,onChange:e=>Hs("linkArrowsSizeScale",e),min:.1,max:3,step:.1}),n.jsx(Zt,{label:"Scale on Zoom",checked:Rs.scaleLinksOnZoom,onChange:e=>Hs("scaleLinksOnZoom",e)})]}),"rendering"===Oe&&n.jsxs(n.Fragment,{children:[n.jsx(Ot,{label:"Space Size",value:Rs.spaceSize,onChange:e=>Hs("spaceSize",e),min:1024,max:16384,step:512}),n.jsx("div",{className:"pt-2 border-t border-edge-subtle/50",children:n.jsx("p",{className:"text-[9px] text-fg-muted",children:"Space size defines the simulation boundary. Larger values allow more spread."})})]})]})]}),Hn=n.jsxs(ht,{id:"export",title:"Export Topology",icon:n.jsx(te,{}),open:Xt,onClose:()=>Yt(!1),defaultPosition:{x:"undefined"!=typeof window?window.innerWidth-280:600,y:100},defaultSize:{width:256,height:320},minSize:{width:220,height:150},autoHeight:!0,children:[n.jsx("div",{className:"py-1",children:[{label:"Full Topology (JSON)",format:"json",dataset:"full",desc:"All data: nodes, edges, paths, TX delay"},{label:"Gephi Graph (GEXF)",format:"gexf",dataset:"full",desc:"Import into Gephi for advanced analysis"},{label:"Nodes (CSV)",format:"csv",dataset:"nodes",desc:"Node metrics: centrality, class, signal"},{label:"Edges (CSV)",format:"csv",dataset:"edges",desc:"Edge metrics: confidence, symmetry, type"},{label:"Path Health (CSV)",format:"csv",dataset:"pathHealth",desc:"Route health scores and trends"},{label:"TX Delay (CSV)",format:"csv",dataset:"txDelay",desc:"TX delay recommendations per node"}].map(({label:e,format:t,dataset:s,desc:a})=>n.jsxs("button",{onClick:()=>jn(t,s),className:"w-full flex flex-col px-3 py-2 text-left hover-bg transition-base",children:[n.jsx("span",{className:"text-[11px] font-medium text-fg-primary",children:e}),n.jsx("span",{className:"text-[9px] text-fg-muted",children:a})]},`${t}-${s}`))}),n.jsx("div",{className:"px-3 py-1.5 border-t border-edge-subtle",children:n.jsxs("span",{className:"text-[9px] text-fg-muted",children:[(null==($=null==se?void 0:se.nodeMetrics)?void 0:$.size)??0," nodes · ",(null==(I=null==se?void 0:se.validatedEdges)?void 0:I.length)??0," edges"]})})]}),Bn={info:{dot:"bg-sys-blue",text:"text-fg-secondary"},warning:{dot:"bg-status-warning",text:"text-status-warning"},critical:{dot:"bg-status-danger",text:"text-status-danger"}},Pn={"edge-appeared":"Link Discovered","edge-disappeared":"Link Lost","ghost-appeared":"Ghost Discovered","ghost-disappeared":"Ghost Resolved","betweenness-shift":"Traffic Rerouting","community-change":"Community Change","class-change":"Role Change","node-appeared":"Node Appeared","node-disappeared":"Node Dropped"},En=(e,t,s)=>null==t||""===t?null:n.jsxs("div",{className:"flex justify-between gap-2",children:[n.jsx("span",{className:"text-fg-muted",children:e}),n.jsx("span",{className:`tabular-nums text-right ${s??"text-fg-secondary"}`,children:t})]}),zn=e=>{const t=[];return e.isZeroHop&&t.push({label:"Zero-Hop",color:"text-status-warning"}),e.isDirectPath&&t.push({label:"Direct",color:"text-sys-blue"}),e.isBackbone&&t.push({label:"Backbone",color:"text-fg-primary"}),e.isLoop&&t.push({label:"Loop",color:"text-sys-indigo"}),0===t.length?null:n.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.map(e=>n.jsx("span",{className:`text-[8px] font-medium uppercase tracking-wider px-1 py-px radius-badge bg-subtle-fill ${e.color}`,children:e.label},e.label))})},An=e=>n.jsxs("div",{className:"text-[9px] space-y-0.5",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"capitalize font-medium text-fg-secondary",children:e.nodeClass}),e.isZeroHop&&n.jsx("span",{className:"text-[8px] font-medium uppercase tracking-wider px-1 py-px radius-badge bg-subtle-fill text-status-warning",children:"Neighbor"})]}),En("Degree",e.degree),e.betweenness>.01&&En("Betweenness",e.betweenness.toFixed(3)),En("Packets",e.packetCount),En("Community",`#${e.communityId}`),En("Activity",e.activityLevel),null!=e.avgRssi&&En("RSSI",`${e.avgRssi.toFixed(0)} dBm`),null!=e.avgSnr&&En("SNR",`${e.avgSnr.toFixed(1)} dB`)]}),Tn=e=>n.jsxs("div",{className:"text-[9px] space-y-0.5",children:[null!=e.previousValue&&null!=e.currentValue&&n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-fg-muted font-mono",children:"number"==typeof e.previousValue?e.previousValue.toFixed(3):e.previousValue}),n.jsx("span",{className:"text-fg-muted/40",children:"→"}),n.jsx("span",{className:"text-fg-secondary font-mono",children:"number"==typeof e.currentValue?e.currentValue.toFixed(3):e.currentValue}),"number"==typeof e.previousValue&&"number"==typeof e.currentValue&&n.jsxs("span",{className:e.currentValue>e.previousValue?"text-sys-green":"text-signal-poor",children:["(",e.currentValue>e.previousValue?"+":"",(e.currentValue-e.previousValue).toFixed(3),")"]})]}),e.nodeDetail&&n.jsxs(n.Fragment,{children:[En("Class",e.nodeDetail.nodeClass),En("Degree",e.nodeDetail.degree),e.nodeDetail.betweenness>.01&&En("Betweenness",e.nodeDetail.betweenness.toFixed(3))]})]}),$n=s.useCallback(e=>{ys(t=>t===e?null:e)},[]),In=n.jsxs(ht,{id:"anomaly",title:"Anomaly Log",icon:n.jsx(le,{}),open:hs,onClose:()=>xs(!1),defaultPosition:{x:"undefined"!=typeof window?window.innerWidth-328:600,y:100},defaultSize:{width:308,height:400},minSize:{width:260,height:180},maxSize:{width:440,height:700},headerActions:ps.length>0?n.jsx("button",{onClick:()=>{js.current.clear(),gs([]),ys(null)},className:"p-0.5 radius-badge hover-bg transition-base",title:"Clear all",children:n.jsx(ye,{className:"w-2.5 h-2.5 text-fg-muted"})}):void 0,children:[0===ps.length?n.jsxs("div",{className:"px-3 py-6 text-center",children:[n.jsx(le,{className:"w-5 h-5 text-fg-muted mx-auto mb-1.5"}),n.jsx("p",{className:"text-[11px] text-fg-muted",children:"No anomalies detected yet"}),n.jsx("p",{className:"text-[9px] text-fg-muted/60 mt-0.5",children:"Changes appear after topology recomputes"})]}):n.jsx("div",{className:"overflow-y-auto",children:ps.slice(0,50).map(e=>{const t=Bn[e.severity],s=E(e.detectedAt/1e3),a=bs===e.id,i=!(!e.edgeDetail&&!e.nodeDetail&&null==e.previousValue);return n.jsxs("div",{className:`border-b border-edge-subtle/50 last:border-0 transition-colors ${i?"cursor-pointer hover-bg":""} ${a?"bg-subtle-fill/50":""}`,onClick:i?()=>$n(e.id):void 0,children:[n.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5",children:[n.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 mt-1.5 ${t.dot}`}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("p",{className:`text-[10px] leading-tight ${t.text}`,children:e.description}),n.jsxs("p",{className:"text-[9px] text-fg-muted/60 mt-0.5",children:[Pn[e.category]??e.category," · ",s]})]}),i&&n.jsx(z,{className:"w-3 h-3 text-fg-muted/40 shrink-0 mt-0.5 transition-transform duration-150 "+(a?"rotate-180":"")})]}),a&&n.jsx("div",{className:"px-3 pb-2 pl-6",children:n.jsxs("div",{className:"border-l-2 border-edge-subtle/60 pl-2 py-0.5",children:[e.edgeDetail&&(o=e.edgeDetail,r=e.category,n.jsxs("div",{className:"text-[9px] space-y-0.5",children:[(o.fromClass||o.toClass)&&n.jsxs("div",{className:"flex items-center gap-1 text-fg-muted",children:[n.jsx("span",{className:"capitalize",children:o.fromClass??"?"}),n.jsx("span",{className:"text-fg-muted/40",children:"↔"}),n.jsx("span",{className:"capitalize",children:o.toClass??"?"})]}),"edge-appeared"===r&&o.packetCount>0&&n.jsxs(n.Fragment,{children:[En("Packets",o.packetCount),En("Confidence",`${(100*o.confidence).toFixed(0)}%`,o.confidence>=.8?"text-sys-green":o.confidence>=.5?"text-sys-indigo":"text-signal-poor"),En("Symmetry",`${(100*o.symmetryRatio).toFixed(0)}%`)]}),o.isZeroHop&&null!=o.avgRssi&&En("RSSI",`${o.avgRssi.toFixed(0)} dBm`),o.isZeroHop&&null!=o.avgSnr&&En("SNR",`${o.avgSnr.toFixed(1)} dB`),null!=o.fromBetweenness&&o.fromBetweenness>.01&&En(`${o.fromName??"A"} centrality`,o.fromBetweenness.toFixed(3)),null!=o.toBetweenness&&o.toBetweenness>.01&&En(`${o.toName??"B"} centrality`,o.toBetweenness.toFixed(3)),zn(o)]})),e.nodeDetail&&!e.edgeDetail&&("node-appeared"===e.category||"node-disappeared"===e.category)&&An(e.nodeDetail),("betweenness-shift"===e.category||"community-change"===e.category||"class-change"===e.category)&&Tn(e)]})})]},e.id);var o,r})}),ps.length>0&&n.jsx("div",{className:"px-3 py-1.5 border-t border-edge-subtle",children:n.jsxs("span",{className:"text-[9px] text-fg-muted",children:[ps.length," total · showing ",Math.min(ps.length,50)]})})]}),Gn=s.useMemo(()=>{const e={};for(const t of Is)e[t.edgeType]=(e[t.edgeType]??0)+1;return e},[Is]),On=n.jsxs(ht,{id:"legend",title:"Legend",icon:n.jsx(de,{}),open:qe,onClose:()=>Ye(!1),defaultPosition:{x:12,y:60},defaultSize:{width:224,height:400},minSize:{width:200,height:150},maxSize:{width:360,height:700},autoHeight:!0,children:[n.jsxs("div",{className:"border-b border-edge-subtle",children:[n.jsxs("button",{onClick:()=>st(e=>!e),className:"w-full flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-medium text-fg-secondary hover-bg transition-base",children:[tt?n.jsx(z,{className:"w-3 h-3"}):n.jsx(he,{className:"w-3 h-3"}),"Nodes",n.jsx("span",{className:"text-fg-muted ml-auto tabular-nums",children:Xs.length})]}),tt&&n.jsx("div",{className:"px-2 pb-2 space-y-0.5",children:[["local","Local"],["hub","Hub"],["gateway","Gateway"],["backbone","Backbone"],["neighbor","Neighbor"],["mobile","Mobile"],["ghost","Ghost"],["standard","Standard"]].map(([e,t])=>{const s=ie[e]??0;if(0===s&&"local"!==e)return null;const a=ct.has(e);return n.jsx(M,{content:Rt[e],children:n.jsxs("button",{onClick:()=>mn(e),className:"w-full flex items-center gap-2 px-2 py-1 radius-badge transition-base text-left "+(a?"opacity-40":"hover-bg"),children:[n.jsx("span",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:Ne[e]}}),n.jsx("span",{className:"text-[10px] text-fg-secondary flex-1",children:t}),n.jsx("span",{className:"text-[10px] text-fg-muted tabular-nums",children:s})]})},e)})})]}),n.jsxs("div",{className:"border-b border-edge-subtle",children:[n.jsxs("button",{onClick:()=>it(e=>!e),className:"w-full flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-medium text-fg-secondary hover-bg transition-base",children:[nt?n.jsx(z,{className:"w-3 h-3"}):n.jsx(he,{className:"w-3 h-3"}),"Edges",n.jsx("span",{className:"text-fg-muted ml-auto tabular-nums",children:Ys.length})]}),nt&&n.jsx("div",{className:"px-2 pb-2 space-y-0.5",children:[{type:"zero-hop",label:"Zero-Hop RF"},{type:"direct-path",label:"Direct Path"},{type:"loop",label:"Loop"},{type:"backbone",label:"Backbone"},{type:"standard",label:"Standard"},{type:"ghost",label:"Ghost"}].map(({type:e,label:t})=>{const s=Gn[e]??0;if(0===s)return null;const a=Pt(e,.8,je);return n.jsx(M,{content:zt[e],children:n.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 cursor-help",children:[n.jsx("span",{className:"w-4 h-0.5 shrink-0 rounded-full",style:{backgroundColor:a}}),n.jsx("span",{className:"text-[10px] text-fg-secondary flex-1",children:t}),n.jsx("span",{className:"text-[10px] text-fg-muted tabular-nums",children:s})]})},e)})})]}),Jt&&qs&&n.jsxs("div",{className:"border-b border-edge-subtle",children:[n.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-medium text-sys-green flex items-center gap-1.5",children:[n.jsx(P,{className:"w-3 h-3"}),"Link Budget",n.jsxs("span",{className:"text-fg-muted ml-auto tabular-nums",children:[qs.analyzedEdges+qs.rssiOnlyEdges,"/",qs.totalEdges]})]}),n.jsxs("div",{className:"px-3 pb-2 space-y-0.5",children:[(()=>{const e=Gs&&Gs>1e5?Gs/1e6:Gs||915,t=ss??Zs??12,s=as??(Os&&Os>1e3?Os/1e3:Os||125),a=os??Vs??5,i=es??Ws??22,o=Ve(t,s,a),r=ls??o,l=Ke(1e3*s),c=ds??l,d=(null==Ks?void 0:Ks.filter(e=>e.isTraceEstimated).length)??0,u=(null==Ks?void 0:Ks.filter(e=>e.isZeroHop).length)??0,m=null!=es||null!=ss||null!=as||null!=os||null!=ls,h="w-10 px-1 py-0 text-[10px] text-right tabular-nums bg-subtle-fill border border-edge-subtle rounded text-fg-secondary focus:outline-none focus:border-sys-blue";return n.jsxs("div",{className:"pb-1 mb-1 border-b border-edge-subtle space-y-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx("span",{className:"text-fg-muted",children:"Frequency"}),n.jsxs("span",{className:"text-fg-secondary tabular-nums",children:[e.toFixed(3)," MHz"]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-fg-muted",children:"SF"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("select",{value:t,onChange:e=>{const t=parseInt(e.target.value,10);ns(t===(Zs??12)?null:t)},className:h+" w-12 appearance-none",children:[7,8,9,10,11,12].map(e=>n.jsxs("option",{value:e,children:["SF",e]},e))}),null!=ss&&n.jsx("button",{onClick:()=>ns(null),className:"text-[8px] text-sys-blue hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-fg-muted",children:"BW"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("select",{value:s,onChange:e=>{const t=parseFloat(e.target.value);is(t===(Os&&Os>1e3?Os/1e3:Os||125)?null:t)},className:h+" w-14 appearance-none",children:[62.5,125,250,500].map(e=>n.jsxs("option",{value:e,children:[e," kHz"]},e))}),null!=as&&n.jsx("button",{onClick:()=>is(null),className:"text-[8px] text-sys-blue hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-fg-muted",children:"CR"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("select",{value:a,onChange:e=>{const t=parseInt(e.target.value,10);rs(t===(Vs??5)?null:t)},className:h+" w-12 appearance-none",children:[5,6,7,8].map(e=>n.jsxs("option",{value:e,children:["4/",e]},e))}),null!=os&&n.jsx("button",{onClick:()=>rs(null),className:"text-[8px] text-sys-blue hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-fg-muted",children:"TX Power"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("input",{type:"number",min:1,max:36,step:1,value:i,onChange:e=>{const t=parseInt(e.target.value,10);isNaN(t)||ts(t)},onBlur:e=>{const t=parseInt(e.target.value,10);isNaN(t)?ts(null):ts(Math.max(1,Math.min(36,t)))},className:h}),n.jsx("span",{className:"text-fg-muted",children:"dBm"}),null!=es&&n.jsx("button",{onClick:()=>ts(null),className:"text-[8px] text-sys-blue hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-fg-muted",children:"Sensitivity"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("input",{type:"number",min:-150,max:-80,step:.5,value:Math.round(10*r)/10,onChange:e=>{const t=parseFloat(e.target.value);isNaN(t)||cs(t)},onBlur:e=>{const t=parseFloat(e.target.value);isNaN(t)?cs(null):cs(Math.max(-150,Math.min(-80,t)))},className:h+" w-12"}),n.jsx("span",{className:"text-fg-muted",children:"dBm"}),null!=ls&&n.jsx("button",{onClick:()=>cs(null),className:"text-[8px] text-sys-blue hover:underline",title:"Reset",children:"↺"})]})]}),d>0&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx("span",{className:"text-fg-muted",children:"Noise Floor"}),n.jsxs("span",{className:"text-fg-secondary tabular-nums "+(null!=ds?"":"italic text-fg-muted"),children:[c.toFixed(1)," dBm",null!=ds?"":" (est.)"]})]}),m&&n.jsx("button",{onClick:()=>{ts(null),ns(null),is(null),rs(null),cs(null)},className:"w-full text-[9px] text-sys-blue hover:underline text-center pt-0.5",children:"Reset all to radio config"}),(u>0||d>0)&&n.jsxs("div",{className:"flex items-center justify-between text-[10px] pt-0.5",children:[n.jsx("span",{className:"text-fg-muted",children:"Sources"}),n.jsxs("span",{className:"text-fg-secondary tabular-nums",children:[u>0&&n.jsxs("span",{children:[u," direct"]}),u>0&&d>0&&n.jsx("span",{className:"text-fg-muted",children:" · "}),d>0&&n.jsxs("span",{className:"text-sys-indigo",children:[d," trace"]})]})]})]})})(),null!=qs.avgMarginDb&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx("span",{className:"text-fg-muted",children:"Avg Margin"}),n.jsxs("span",{className:"text-fg-secondary tabular-nums",children:[qs.avgMarginDb>0?"+":"",qs.avgMarginDb.toFixed(1)," dB"]})]}),["excellent","good","fair","marginal","critical"].map(e=>{const t=qs.marginCounts[e];return 0===t?null:n.jsxs("div",{className:"flex items-center gap-2 px-1 py-0.5",children:[n.jsx("span",{className:"w-3 h-0.5 shrink-0 rounded-full",style:{backgroundColor:Je[e]}}),n.jsx("span",{className:"text-[10px] text-fg-secondary flex-1 capitalize",children:e}),n.jsx("span",{className:"text-[10px] text-fg-muted tabular-nums",children:t})]},e)}),qs.anomalousCount>0&&n.jsxs("div",{className:"flex items-center justify-between text-[10px] pt-0.5",children:[n.jsx("span",{className:"text-status-warning",children:"Anomalous"}),n.jsx("span",{className:"text-status-warning tabular-nums",children:qs.anomalousCount})]})]})]}),Nn&&Nn.atRiskPaths.length>0&&n.jsxs("div",{className:"border-b border-edge-subtle",children:[n.jsxs("div",{className:"flex items-center",children:[n.jsxs("button",{onClick:()=>rt(e=>!e),className:"flex-1 flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-medium text-status-warning hover-bg transition-base",children:[ot?n.jsx(z,{className:"w-3 h-3"}):n.jsx(he,{className:"w-3 h-3"}),"At-Risk Paths",n.jsxs("span",{className:"text-fg-muted ml-auto tabular-nums",children:[Nn.criticalCount>0&&n.jsxs("span",{className:"text-status-danger",children:[Nn.criticalCount,"c"]}),Nn.criticalCount>0&&Nn.highCount>0&&" ",Nn.highCount>0&&n.jsxs("span",{className:"text-status-warning",children:[Nn.highCount,"h"]}),(Nn.criticalCount>0||Nn.highCount>0)&&Nn.moderateCount>0&&" ",Nn.moderateCount>0&&n.jsxs("span",{className:"text-fg-muted",children:[Nn.moderateCount,"m"]})]})]}),n.jsx(M,{content:n.jsxs("div",{className:"max-w-xs space-y-1.5",children:[n.jsx("div",{className:"font-semibold text-fg-primary",children:"Predictive Path Failure"}),n.jsx("div",{className:"text-fg-secondary text-[11px]",children:"Identifies paths at risk of failure by combining four weighted factors. Paths below the moderate threshold (35%) are not shown."}),n.jsxs("div",{className:"pt-1 border-t border-edge-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-fg-muted font-medium",children:"Factor weights"}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-secondary",children:"Declining usage"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"35%"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-secondary",children:"Weak link certainty"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"30%"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-secondary",children:"No alternate paths"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"20%"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-secondary",children:"Low signal margin"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"15%"})]})]}),n.jsxs("div",{className:"pt-1 border-t border-edge-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-fg-muted font-medium",children:"Risk thresholds"}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-status-danger",children:"Critical"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"≥75% — failure likely imminent"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-status-warning",children:"High"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"55-74% — significant risk"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Moderate"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"35-54% — worth monitoring"})]})]}),n.jsxs("div",{className:"pt-1 border-t border-edge-subtle/30 text-[10px] text-fg-muted font-mono space-y-0.5",children:[n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{children:"Edges analyzed"}),n.jsx("span",{className:"tabular-nums",children:Nn.edgesAnalyzed})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{children:"With signal data"}),n.jsx("span",{className:"tabular-nums",children:Nn.edgesWithSignal})]})]})]}),children:n.jsx("span",{className:"px-2 py-1.5 text-fg-muted cursor-help",children:n.jsx(le,{className:"w-3 h-3"})})})]}),ot&&n.jsx("div",{className:"px-2 pb-2 space-y-1",children:Nn.atRiskPaths.slice(0,8).map(e=>{const t="critical"===e.riskLevel?"#EF4444":"high"===e.riskLevel?"#F97316":"#FBBF24",s="imminent"===e.urgency?"IMM":"near-term"===e.urgency?"NEAR":"WATCH";return n.jsx(M,{content:n.jsxs("div",{className:"max-w-xs space-y-1.5",children:[n.jsx("div",{className:"font-semibold text-fg-primary font-mono text-[11px]",children:e.hops.join(" → ")}),n.jsxs("div",{className:"space-y-0.5 text-[10px]",children:[n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Risk score"}),n.jsxs("span",{className:"font-semibold tabular-nums",style:{color:t},children:[(100*e.riskScore).toFixed(1),"%"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Health score"}),n.jsxs("span",{className:"text-fg-primary tabular-nums",children:[(100*e.healthScore).toFixed(0),"%"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Obs. trend"}),n.jsxs("span",{className:"tabular-nums "+(e.observationTrend<0?"text-status-danger":"text-fg-secondary"),children:[e.observationTrend>0?"+":"",e.observationTrend.toFixed(3)]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Alt. paths"}),n.jsx("span",{className:"tabular-nums "+(0===e.alternatePathsCount?"text-status-danger":"text-fg-secondary"),children:e.alternatePathsCount})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Urgency"}),n.jsx("span",{className:"capitalize",style:{color:t},children:e.urgency})]})]}),e.factors.length>0&&n.jsxs("div",{className:"pt-1 border-t border-edge-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-fg-muted font-medium",children:"Contributing factors"}),e.factors.map((e,t)=>n.jsxs("div",{className:"space-y-0.5",children:[n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-secondary",children:e.name}),n.jsxs("span",{className:"text-fg-muted tabular-nums",children:[(e.score*e.weight*100).toFixed(1),"% (",(100*e.weight).toFixed(0),"w × ",(100*e.score).toFixed(0),"s)"]})]}),n.jsx("div",{className:"text-fg-muted pl-1",children:e.description})]},t))]})]}),children:n.jsxs("div",{className:"px-2 py-1 radius-badge bg-subtle-fill/30 cursor-help",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:t}}),n.jsx("span",{className:"text-[10px] text-fg-secondary font-mono truncate flex-1",children:e.hops.join(" → ")}),n.jsx("span",{className:"text-[8px] uppercase tracking-wide px-1 py-px radius-badge",style:{backgroundColor:`${t}20`,color:t},children:s}),n.jsxs("span",{className:"text-[10px] tabular-nums font-semibold",style:{color:t},children:[(100*e.riskScore).toFixed(0),"%"]})]}),n.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5 pl-3",children:e.factors.map((t,s)=>n.jsxs("span",{className:"text-[8px] text-fg-muted",children:[t.name," (",(t.score*t.weight*100).toFixed(0),"%)",sMt(e=>"spectral"===e?"louvain":"spectral"),className:"text-sys-blue hover:underline cursor-pointer",children:"spectral"===bt?"Spectral":"Louvain"})]}),"louvain"===bt&&Cn&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(M,{content:"Louvain modularity score — quality of community partition (higher = better defined communities)",children:n.jsx("span",{className:"text-fg-muted cursor-help",children:"Modularity Q"})}),n.jsx("span",{className:"text-fg-secondary tabular-nums",children:Cn.modularity.toFixed(4)})]}),"louvain"===bt&&n.jsxs("div",{className:"mt-1.5 pt-1.5 border-t border-edge-subtle space-y-1.5",children:[n.jsx(Ot,{label:"Resolution γ",value:Et,onChange:At,min:.01,max:5,step:.01}),n.jsx(Ot,{label:"K-weight",value:Wt,onChange:Vt,min:.01,max:5,step:.01}),(1!==Et||1!==Wt)&&n.jsx("button",{onClick:()=>{At(1),Vt(1)},className:"w-full text-[10px] text-sys-blue hover:underline text-center",children:"Reset defaults"})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(M,{content:"Redundant path cycles in the topology — indicates alternate routing options",children:n.jsx("span",{className:"text-fg-muted cursor-help",children:"Loops"})}),n.jsx("span",{className:"text-fg-secondary tabular-nums",children:(null==(G=null==se?void 0:se.loops)?void 0:G.length)??0})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(M,{content:"High-betweenness edges that carry disproportionate traffic flow",children:n.jsx("span",{className:"text-fg-muted cursor-help",children:"Backbone"})}),n.jsx("span",{className:"text-fg-secondary tabular-nums",children:(null==(O=null==se?void 0:se.backboneEdges)?void 0:O.length)??0})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(M,{content:"Unresolved prefix nodes inferred by Viterbi HMM from repeated path patterns",children:n.jsx("span",{className:"text-fg-muted cursor-help",children:"Ghosts"})}),n.jsx("span",{className:"text-fg-secondary tabular-nums",children:ae.length})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(M,{content:"Community-aware node coloring — groups nodes by cluster assignment",children:n.jsx("span",{className:"text-fg-muted cursor-help",children:"Clustering"})}),n.jsx("span",{className:"tabular-nums "+(ut?"text-sys-blue":"text-fg-muted"),children:ut?"On":"Off"})]}),null!=wn&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(M,{content:"Algebraic connectivity — 2nd-smallest eigenvalue of the graph Laplacian. Near-zero = one bridge from network partition.",children:n.jsx("span",{className:"text-fg-muted cursor-help",children:"Fiedler λ₂"})}),n.jsx("span",{className:"tabular-nums "+(wn<.01?"text-status-warning":"text-fg-secondary"),children:wn.toFixed(4)})]}),ct.size>0&&n.jsxs("button",{onClick:()=>dt(new Set),className:"w-full mt-1 text-[10px] text-sys-blue hover:underline text-center",children:["Clear filters (",ct.size,")"]})]})]}),Zn=n.jsx(m,{children:ze&&n.jsx(h.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},className:"absolute top-4 left-1/2 -translate-x-1/2 z-30 w-80",children:n.jsxs("div",{className:"surface-elevated radius-inset shadow-2xl overflow-hidden",children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-edge-subtle",children:[n.jsx(ue,{className:"w-4 h-4 text-fg-muted shrink-0"}),n.jsx("input",{ref:Ns,type:"text",value:Pe,onChange:e=>Ee(e.target.value),placeholder:"Search by name or prefix...",className:"flex-1 bg-transparent text-sm text-fg-primary placeholder:text-fg-muted focus:outline-none",onKeyDown:e=>{"Escape"===e.key?(Te(!1),Ee("")):"Enter"===e.key&&cn.length>0&&dn(cn[0])}}),Pe&&n.jsx("button",{onClick:()=>Ee(""),className:"p-0.5 radius-badge hover-bg transition-base",children:n.jsx(p,{className:"w-3 h-3 text-fg-muted"})})]}),cn.length>0&&n.jsx("div",{className:"max-h-64 overflow-y-auto",children:cn.map((e,t)=>n.jsxs("button",{onClick:()=>dn(e),className:"w-full flex items-center gap-3 px-3 py-2 text-left hover-bg transition-base "+(0===t?"bg-subtle-fill/50":""),children:[n.jsx("span",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:Ne[e.nodeClass]}}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-sm text-fg-primary truncate",children:e.name||e.prefix}),e.name&&n.jsx("div",{className:"text-[10px] text-fg-muted",children:e.prefix})]}),n.jsx(ce,{className:"w-3 h-3 text-fg-muted shrink-0"})]},e.id))}),Pe&&0===cn.length&&n.jsx("div",{className:"px-3 py-4 text-center text-sm text-fg-muted",children:"No nodes found"}),!Pe&&n.jsx("div",{className:"px-3 py-2 type-data-xs text-fg-muted",children:"Type to search • Enter to select • Esc to close"})]})})});return W?0===As.length?n.jsxs("div",{className:"relative h-[calc(100dvh-56px)] lg:h-dvh min-h-[500px] -mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 overflow-hidden",children:[Ln,n.jsx("div",{className:"absolute inset-0 bg-body flex items-center justify-center",children:n.jsx(Gt,{})})]}):Cs?He?n.jsxs("div",{className:"fixed inset-0 z-50 bg-body flex flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 surface-header z-10",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(F,{className:"w-5 h-5 text-icon-page-title"}),n.jsxs("h1",{className:"type-title text-fg-primary flex items-center gap-2",children:["MeshGraph",n.jsx(R,{color:"violet",compact:!0,children:"Analytics"})]}),n.jsxs("span",{className:"text-[10px] text-fg-muted tabular-nums",children:[Xs.length," nodes • ",Ys.length," edges"]})]}),n.jsx(M,{content:"Exit fullscreen",children:n.jsx("button",{onClick:un,className:"p-1.5 radius-inner hover-bg transition-base",children:n.jsx(U,{className:"w-4 h-4 text-fg-muted"})})})]}),n.jsxs("div",{className:"flex-1 relative min-h-0 m-2 surface-base radius-inset overflow-hidden border border-edge-subtle",children:[n.jsx(a,{className:"absolute inset-0",points:Cs,links:Ss,...Ds,...Rs,backgroundColor:Ce,fitViewOnInit:!0,fitViewPadding:.15,showLabels:We,showDynamicLabels:!1,showTopLabels:We,showTopLabelsLimit:200,showHoveredPointLabel:!0,pointLabelColor:ke,pointClusterBy:ut?"communityId":void 0,onPolygonSelected:Kt?pn:void 0,polygonalSelectorStrokeColor:je?"#FBBF24":"#D97706",onClick:ln,onLinkClick:rn,onMount:tn,hoveredPointRingColor:je?"#FBBF24":"#D97706",hoveredPointCursor:"pointer",hoveredLinkCursor:"pointer"}),Zn,On,Rn,Mn,Hn,In,n.jsxs(m,{children:[De&&n.jsx($t,{node:De,egoMetrics:fn,onExpandEgo:yn,neighbors:bn,onSelectNeighbor:an,txDelayRec:vn,onClose:()=>{var e;Fe(null),null==(e=ws.current)||e.unselectAllPoints()}}),Re&&!De&&n.jsx(Tt,{edge:Re,onClose:()=>Me(null)}),qt&&!De&&!Re&&n.jsx(It,{metrics:qt,onClose:gn})]})]})]}):n.jsxs("div",{className:"relative h-[calc(100dvh-56px)] lg:h-dvh min-h-[500px] -mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 overflow-hidden",children:[Ln,n.jsxs("div",{className:"absolute inset-0",children:[n.jsx(a,{className:"absolute inset-0",points:Cs,links:Ss,...Ds,...Rs,backgroundColor:Ce,fitViewOnInit:!0,fitViewPadding:.15,showLabels:We,showDynamicLabels:!1,showTopLabels:We,showTopLabelsLimit:200,showHoveredPointLabel:!0,pointLabelColor:ke,pointClusterBy:ut?"communityId":void 0,onPolygonSelected:Kt?pn:void 0,polygonalSelectorStrokeColor:je?"#FBBF24":"#D97706",onClick:ln,onLinkClick:rn,onMount:tn,hoveredPointRingColor:je?"#FBBF24":"#D97706",hoveredPointCursor:"pointer",hoveredLinkCursor:"pointer"}),Zn,On,Rn,Mn,Hn,In,n.jsxs("div",{className:"absolute bottom-4 right-4 z-10 hidden lg:flex items-center gap-3 type-data-xs text-fg-muted/60",children:[n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 radius-badge bg-subtle-fill/50 font-mono",children:"/"})," Search"]}),n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 radius-badge bg-subtle-fill/50 font-mono",children:"F"})," Fit"]}),n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 radius-badge bg-subtle-fill/50 font-mono",children:"L"})," Labels"]}),n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 radius-badge bg-subtle-fill/50 font-mono",children:"Space"})," Pause"]}),n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 radius-badge bg-subtle-fill/50 font-mono",children:"Esc"})," Clear"]})]}),n.jsxs(m,{children:[De&&n.jsx($t,{node:De,egoMetrics:fn,onExpandEgo:yn,neighbors:bn,onSelectNeighbor:an,txDelayRec:vn,onClose:()=>{var e;Fe(null),null==(e=ws.current)||e.unselectAllPoints()}}),Re&&!De&&n.jsx(Tt,{edge:Re,onClose:()=>Me(null)}),qt&&!De&&!Re&&n.jsx(It,{metrics:qt,onClose:gn})]})]})]}):n.jsxs("div",{className:"relative h-[calc(100dvh-56px)] lg:h-dvh min-h-[500px] -mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 overflow-hidden",children:[Ln,n.jsxs("div",{className:"absolute inset-0 bg-body flex flex-col items-center justify-center gap-3",children:[n.jsx(A,{className:"w-8 h-8 text-sys-blue animate-spin"}),n.jsx("span",{className:"type-body text-fg-muted",children:"Preparing graph..."})]})]}):n.jsxs("div",{className:"relative h-[calc(100dvh-56px)] lg:h-dvh min-h-[500px] -mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 overflow-hidden",children:[Ln,n.jsxs("div",{className:"absolute inset-0 bg-body flex items-center justify-center",children:[n.jsx(X,{isOpen:Y,onClose:ee}),!Y&&n.jsx(A,{className:"w-8 h-8 text-sys-blue animate-spin"})]})]})}export{Wt as default}; +var e=Object.defineProperty,t=(t,s,n)=>((t,s,n)=>s in t?e(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n)(t,"symbol"!=typeof s?s+"":s,n);import{r as s,j as n,m as a,i,W as o,Z as r}from"./vendor-react-j_fHog8x.js";import{c as l,bc as c,bd as d,be as u,A as m,m as h,aE as x,a5 as p,aN as g,bf as f,bg as v,b3 as b,bh as y,bi as j,aB as N,bj as w,t as C,a_ as k,bk as S,Z as L,E as D,b4 as F,j as R,H as M,bl as H,bm as B,R as P,bn as E,Y as z,L as A,bo as T,bp as $,B as I,o as G,bq as O,aH as Z}from"./index-BBcIGlRT.js";import{u as W,G as V,M as K,c as _,E as q,a as U,D as X,s as Y}from"./DeepAnalysisModal--yROqPOt.js";import{D as J}from"./DataBox-B8dpvpbW.js";import{h as Q,c as ee,D as te}from"./geo-utils-BJfOkt8p.js";import{N as se,a as ne}from"./badge-colors-YAE4qQ7m.js";import{e as ae,f as ie,g as oe}from"./meshcore-tx-constants-BDLT5LMb.js";import{E as re,S as le,T as ce}from"./target-MKB3Qhi3.js";import{L as de}from"./layers-BSSTaBST.js";import{S as ue}from"./search-Cs3jReDi.js";import{S as me}from"./settings-2-YxRSYOZ0.js";import{C as he}from"./chevron-right-B6r5SVTI.js";import{N as xe}from"./network-C6ho6RSo.js";import{C as pe}from"./copy-C_IB0gEd.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CmkNwW1A.js";import"./git-branch-CaPGs8Pg.js";import"./database-CO202xKy.js";const ge=l("arrow-right-left",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]),fe=l("focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),ve=l("group",[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2",key:"adw53z"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2",key:"an4l38"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2",key:"144t0e"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2",key:"rtnfgi"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1",key:"1eyiv7"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1",key:"1qlmkx"}]]),be=l("lasso",[["path",{d:"M3.704 14.467A10 8 0 0 1 2 10a10 8 0 0 1 20 0 10 8 0 0 1-10 8 10 8 0 0 1-5.181-1.158",key:"1yant3"}],["path",{d:"M7 22a5 5 0 0 1-2-3.994",key:"1xp6a4"}],["circle",{cx:"5",cy:"16",r:"2",key:"18csp3"}]]),ye=l("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);function je(e){if(null==e)return"";const t=String(e);return t.includes(",")||t.includes('"')||t.includes("\n")?`"${t.replace(/"/g,'""')}"`:t}function Ne(e,t){const s=[e.join(",")];for(const n of t)s.push(n.map(je).join(","));return s.join("\n")}function we(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Ce(e){return!e||e<=0?"":new Date(1e3*e).toISOString()}function ke(e,t){return`${e}-${(new Date).toISOString().replace(/[:.]/g,"-").slice(0,19)}.${t}`}const Se=["hash","prefix","name","nodeClass","communityId","degree","inDegree","outDegree","betweenness","pathDiversity","packetCount","lastSeen","activityLevel","recencyScore","avgRssi","avgSnr","isZeroHop","prefixConfidence","hasCollision","collisionCandidates","isLocal","isHub","isGateway","isBackbone","isMobile","isGhost","isInLoop","latitude","longitude","contactType"];function Le(e){var t,s;return[e.hash,e.prefix,e.name??"",e.nodeClass,e.communityId,e.degree,e.inDegree,e.outDegree,e.betweenness.toFixed(6),e.pathDiversity,e.packetCount,Ce(e.lastSeen),e.activityLevel,e.recencyScore.toFixed(4),(null==(t=e.avgRssi)?void 0:t.toFixed(1))??"",(null==(s=e.avgSnr)?void 0:s.toFixed(1))??"",e.isZeroHop,e.prefixConfidence.toFixed(4),e.hasCollision,e.collisionCandidates,e.isLocal,e.isHub,e.isGateway,e.isBackbone,e.isMobile,e.isGhost,e.isInLoop,e.latitude??"",e.longitude??"",e.contactType??""]}function De(e,t){const s=[];for(const n of e.nodeMetrics.values())!t&&n.isGhost||s.push({hash:n.hash,prefix:n.prefix,name:n.name,nodeClass:n.nodeClass,communityId:n.communityId,degree:n.degree,inDegree:n.inDegree,outDegree:n.outDegree,betweenness:n.betweenness,pathDiversity:n.pathDiversity,packetCount:n.packetCount,lastSeen:n.lastSeen,activityLevel:n.activityLevel,recencyScore:n.recencyScore,avgRssi:n.avgRssi,avgSnr:n.avgSnr,isZeroHop:n.isZeroHop,prefixConfidence:n.prefixConfidence,hasCollision:n.hasCollision,isLocal:n.isLocal,isHub:n.isHub,isGateway:n.isGateway,isBackbone:n.isBackbone,isMobile:n.isMobile,isGhost:n.isGhost,isInLoop:n.isInLoop,latitude:n.latitude,longitude:n.longitude,contactType:n.contactType});return s}const Fe=["fromHash","toHash","key","packetCount","certainCount","avgConfidence","strength","forwardCount","reverseCount","symmetryRatio","dominantDirection","floodCount","directCount","isDirectPathEdge","isZeroHop","isLoopEdge","isCertain","avgRssi","avgSnr","avgRecency","hopDistanceFromLocal","edgeBetweenness","isBackbone"];function Re(e,t){const s=t?e.edges:e.validatedEdges,n=new Set(e.backboneEdges);return s.map(t=>({fromHash:t.fromHash,toHash:t.toHash,key:t.key,packetCount:t.packetCount,certainCount:t.certainCount,avgConfidence:t.avgConfidence,strength:t.strength,forwardCount:t.forwardCount,reverseCount:t.reverseCount,symmetryRatio:t.symmetryRatio,dominantDirection:t.dominantDirection,floodCount:t.floodCount,directCount:t.directCount,isDirectPathEdge:t.isDirectPathEdge,isZeroHop:t.isZeroHop??!1,isLoopEdge:t.isLoopEdge??!1,isCertain:t.isCertain,avgRssi:t.avgRssi??null,avgSnr:t.avgSnr??null,avgRecency:t.avgRecency,hopDistanceFromLocal:t.hopDistanceFromLocal,edgeBetweenness:e.edgeBetweenness.get(t.key)??0,isBackbone:n.has(t.key)}))}const Me=["pathKey","hops","hopCount","healthScore","weakestLinkKey","weakestLinkConfidence","avgEdgeCertainty","observationTrend","alternatePathsCount","estimatedLatencyMs","observationCount","routeType","lastSeen","involvesHub"];function He(e){return[e.pathKey,e.hops.join(">"),e.hops.length,e.healthScore.toFixed(4),e.weakestLinkKey??"",e.weakestLinkConfidence.toFixed(4),e.avgEdgeCertainty.toFixed(4),e.observationTrend.toFixed(4),e.alternatePathsCount,e.estimatedLatencyMs.toFixed(0),e.observationCount,e.routeType,Ce(e.lastSeen),e.involvesHub]}const Be=["nodeHash","nodePrefix","nodeName","networkRole","floodFactor","directFactor","floodSlots","directSlots","trafficIntensity","directNeighborCount","collisionRisk","confidence","adjustment","dataConfidence","observationSymmetry","rationale"];function Pe(e,t,s){const n=s.get(e);return[e,(null==n?void 0:n.prefix)??"",(null==n?void 0:n.name)??"",t.networkRole,t.floodFactor.toFixed(2),t.directFactor.toFixed(2),t.floodSlots,t.directSlots,t.trafficIntensity.toFixed(4),t.directNeighborCount,t.collisionRisk.toFixed(4),t.confidence.toFixed(4),t.adjustment,t.dataConfidence,t.observationSymmetry.toFixed(4),t.rationale]}function Ee(e,t){var s,n;const a=new Set(e.backboneEdges),i=['','',` `,` pymc_console v${c}`," MeshCore LoRa Mesh Network Topology"," ",' ',""," \x3c!-- Node Attributes --\x3e",' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '," ",""," \x3c!-- Edge Attributes --\x3e",' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '," ",""," "];for(const o of e.nodeMetrics.values()){if(!t&&o.isGhost)continue;const e=we(o.name??o.prefix);i.push(` `),i.push(" "),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),null!=o.avgRssi&&i.push(` `),null!=o.avgSnr&&i.push(` `),i.push(" "),null==o.latitude||null==o.longitude||0===o.latitude&&0===o.longitude||i.push(` `),i.push(" ")}i.push(" "),i.push(""),i.push(" ");for(const o of e.validatedEdges){const r=e.nodeMetrics;if(!t&&((null==(s=r.get(o.fromHash))?void 0:s.isGhost)||(null==(n=r.get(o.toHash))?void 0:n.isGhost)))continue;const l=e.edgeBetweenness.get(o.key)??0;i.push(` `),i.push(" "),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(` `),i.push(" "),i.push(" ")}return i.push(" "),i.push(" "),i.push(""),i.join("\n")}function ze(e,t,s){const n={meta:{exportedAt:(new Date).toISOString(),pymcConsoleVersion:c,nodeCount:e.nodeMetrics.size,edgeCount:e.validatedEdges.length,communityCount:e.communityCount,loopCount:e.loops.length,backboneEdgeCount:e.backboneEdges.length,hubNodes:e.hubNodes.length,gatewayNodes:e.gatewayNodes.length,mobileNodes:e.mobileNodes.length,ghostNodes:e.discoveredNodes.filter(e=>e.isLikelyReal).length},nodes:De(e,t),edges:Re(e,s),pathHealth:e.pathHealth.map(e=>({pathKey:e.pathKey,hops:e.hops,healthScore:e.healthScore,weakestLinkKey:e.weakestLinkKey,weakestLinkConfidence:e.weakestLinkConfidence,avgEdgeCertainty:e.avgEdgeCertainty,observationTrend:e.observationTrend,alternatePathsCount:e.alternatePathsCount,estimatedLatencyMs:e.estimatedLatencyMs,observationCount:e.observationCount,routeType:e.routeType,lastSeen:e.lastSeen,involvesHub:e.involvesHub})),txDelayRecommendations:Array.from(e.txDelayRecommendations.entries()).map(([t,s])=>{var n,a;return{nodeHash:t,nodePrefix:(null==(n=e.nodeMetrics.get(t))?void 0:n.prefix)??"",nodeName:(null==(a=e.nodeMetrics.get(t))?void 0:a.name)??null,networkRole:s.networkRole,floodFactor:s.floodFactor,directFactor:s.directFactor,floodSlots:s.floodSlots,directSlots:s.directSlots,trafficIntensity:s.trafficIntensity,collisionRisk:s.collisionRisk,confidence:s.confidence,adjustment:s.adjustment,dataConfidence:s.dataConfidence,rationale:s.rationale}}),loops:e.loops.map(e=>({id:e.id,nodes:e.nodes,edgeKeys:e.edgeKeys,size:e.size,avgCertainCount:e.avgCertainCount,minCertainCount:e.minCertainCount,includesLocal:e.includesLocal,strength:e.strength})),disambiguationStats:{totalPrefixes:e.disambiguationStats.totalPrefixes,unambiguousPrefixes:e.disambiguationStats.unambiguousPrefixes,collisionPrefixes:e.disambiguationStats.collisionPrefixes,collisionRate:e.disambiguationStats.collisionRate,avgConfidence:e.disambiguationStats.avgConfidence},viterbiStats:{totalPaths:e.viterbiStats.totalPaths,pathsWithGhosts:e.viterbiStats.pathsWithGhosts,avgPathConfidence:e.viterbiStats.avgPathConfidence,tracePacketsProcessed:e.viterbiStats.tracePacketsProcessed,pathPacketsProcessed:e.viterbiStats.pathPacketsProcessed,distantEdgesDiscovered:e.viterbiStats.distantEdgesDiscovered,duplicateGroupsFound:e.viterbiStats.duplicateGroupsFound,echolocationEdgesInferred:e.viterbiStats.echolocationEdgesInferred}};return JSON.stringify(n,null,2)}function Ae(e,t){const s=t.includeGhosts??!0,n=t.includeWeakEdges??!1;switch(t.format){case"csv":{let a,i;switch(t.dataset){case"nodes":case"full":default:a=function(e,t){const s=[];for(const n of e.nodeMetrics.values())!t&&n.isGhost||s.push(Le(n));return Ne(Se,s)}(e,s),i="mesh-nodes";break;case"edges":a=function(e,t){const s=t?e.edges:e.validatedEdges,n=new Set(e.backboneEdges),a=s.map(t=>function(e,t,s){var n,a;return[e.fromHash,e.toHash,e.key,e.packetCount,e.certainCount,e.avgConfidence.toFixed(4),e.strength.toFixed(4),e.forwardCount,e.reverseCount,e.symmetryRatio.toFixed(4),e.dominantDirection,e.floodCount,e.directCount,e.isDirectPathEdge,e.isZeroHop??!1,e.isLoopEdge??!1,e.isCertain,(null==(n=e.avgRssi)?void 0:n.toFixed(1))??"",(null==(a=e.avgSnr)?void 0:a.toFixed(1))??"",e.avgRecency.toFixed(4),e.hopDistanceFromLocal,(t.get(e.key)??0).toFixed(6),s.has(e.key)]}(t,e.edgeBetweenness,n));return Ne(Fe,a)}(e,n),i="mesh-edges";break;case"pathHealth":a=function(e){const t=e.pathHealth.map(He);return Ne(Me,t)}(e),i="mesh-path-health";break;case"txDelay":a=function(e){const t=[];for(const[s,n]of e.txDelayRecommendations)t.push(Pe(s,n,e.nodeMetrics));return Ne(Be,t)}(e),i="mesh-tx-delay"}return{content:a,filename:ke(i,"csv"),mimeType:"text/csv"}}case"gexf":return{content:Ee(e,s),filename:ke("mesh-topology","gexf"),mimeType:"application/xml"};default:return{content:ze(e,s,n),filename:ke("mesh-topology","json"),mimeType:"application/json"}}}function Te(e,t,s=1){const{n:n,adjList:a,totalWeight:i,degree:o}=e;if(0===i)return!1;const r=2*i,l=new Float64Array(n);for(let u=0;up+1e-7&&(p=a,x=e)}x!==n&&(l[n]-=u,l[x]+=u,t[e]=x,d=!0,c=!0)}}return c}function $e(e,t){const{n:s,adjList:n}=e,a=new Set;for(let h=0;he-t),o=new Map;for(let h=0;h[]);for(const[h,x]of c){const[e,t]=h.split("-").map(Number),s=x/2;m[e].push({j:t,w:s}),m[t].push({j:e,w:s}),d[e]+=s,d[t]+=s,u+=s}return{newGraph:{n:r,adjList:m,totalWeight:u,degree:Array.from(d)},mapping:l}}function Ie(e,t,s){const n=(null==s?void 0:s.resolution)??1,a=(null==s?void 0:s.kWeight)??1,i=t.length;if(0===i)return{communities:new Map,numCommunities:0,modularity:0,passes:0};if(1===i)return{communities:new Map([[t[0],0]]),numCommunities:1,modularity:0,passes:0};const{graph:o}=function(e,t,s=1){const n=t.length,a=new Map;for(let l=0;l[]),o=new Array(n).fill(0);let r=0;for(const l of e){const e=a.get(l.fromHash),t=a.get(l.toHash);if(void 0===e||void 0===t)continue;if(e===t)continue;const n=Math.max(.01,(l.certainCount+1)*l.avgConfidence*l.strength),c=1===s?n:Math.pow(n,s);i[e].push({j:t,w:c}),i[t].push({j:e,w:c}),o[e]+=c,o[t]+=c,r+=c}return{graph:{n:n,adjList:i,totalWeight:r,degree:o},hashToIdx:a}}(e,t,a);let r=o,l=new Int32Array(i);for(let v=0;v=r.n)break;r=e,l=new Int32Array(e.n);for(let s=0;se-t),x=new Map;for(let v=0;v=20?"excellent":e>=10?"good":e>=3?"fair":e>=0?"marginal":"critical"}function qe(e){return e>=15?"anomalous-good":e>=5?"better":e>=-5?"expected":e>=-20?"worse":"anomalous-bad"}function Ue(e,t,s,n,a){const i=n.tx_power??22,o=n.spreading_factor??12,r=n.coding_rate??5,l=n.frequency??0,c=l>1e5?l/1e6:l||915,d=n.bandwidth??0,u=d>1e3?d/1e3:d||125,m=(null==a?void 0:a.sensitivityOverrideDbm)??Ve(o,u,r);let h=null,x=null;t&&s&&Q(t.latitude??void 0,t.longitude??void 0)&&Q(s.latitude??void 0,s.longitude??void 0)&&(h=ee(t.latitude,t.longitude,s.latitude,s.longitude),x=h/1e3);let p=null,g=null;null!=h&&h>0&&(p=We(h,c),g=i+2.15+2.15-p);const f=e.avgRssi??null,v=e.avgSnr??null;let b=null,y=null;null!=f&&null!=g&&(b=f-g,y=qe(b));let j=null,N=null;null!=f&&(j=f-m,N=_e(j));const w=null!=f,C="anomalous-good"===y||"anomalous-bad"===y;return{edgeKey:e.key,fromHash:e.fromHash,toHash:e.toHash,distanceM:h,distanceKm:x,fsplDb:p,theoreticalRxPowerDbm:g,observedRssiDbm:f,observedSnrDb:v,deviationDb:b,deviationClass:y,marginDb:j,marginClass:N,sensitivityDbm:m,txPowerDbm:i,frequencyMhz:c,spreadingFactor:o,bandwidthKhz:u,noiseFloorDbm:null,isZeroHop:e.isZeroHop??!1,isTraceEstimated:!1,hasData:w,isAnomalous:C}}function Xe(e,t,s,n,a=22,i){const o=e.traceQuality;if(!o)return null;let r=null;if(r=null!=o.forwardSnr&&null!=o.reverseSnr?Math.min(o.forwardSnr,o.reverseSnr):o.forwardSnr??o.reverseSnr,null==r)return null;const l=n.spreading_factor??12,c=n.coding_rate??5,d=n.bandwidth??0,u=d>1e3?d/1e3:d||125,m=1e3*u,h=n.frequency??0,x=h>1e5?h/1e6:h||915,p=(null==i?void 0:i.sensitivityOverrideDbm)??Ve(l,u,c),g=(null==i?void 0:i.observedNoiseFloorDbm)??Ke(m),f=g+r;let v=null,b=null;t&&s&&Q(t.latitude??void 0,t.longitude??void 0)&&Q(s.latitude??void 0,s.longitude??void 0)&&(v=ee(t.latitude,t.longitude,s.latitude,s.longitude),b=v/1e3);let y=null,j=null;null!=v&&v>0&&(y=We(v,x),j=a+2.15+2.15-y);let N=null,w=null;null!=j&&(N=f-j,w=qe(N));const C=f-p,k=_e(C);return{edgeKey:e.key,fromHash:e.fromHash,toHash:e.toHash,distanceM:v,distanceKm:b,fsplDb:y,theoreticalRxPowerDbm:j,observedRssiDbm:f,observedSnrDb:r,deviationDb:N,deviationClass:w,marginDb:C,marginClass:k,sensitivityDbm:p,noiseFloorDbm:g,txPowerDbm:a,frequencyMhz:x,spreadingFactor:l,bandwidthKhz:u,isZeroHop:!1,isTraceEstimated:!0,hasData:!0,isAnomalous:"anomalous-good"===w||"anomalous-bad"===w}}const Ye={"anomalous-good":"#2DD4BF",better:"#34D399",expected:"#9CA3AF",worse:"#FB923C","anomalous-bad":"#EF4444"},Je={excellent:"#34D399",good:"#A3E635",fair:"#FBBF24",marginal:"#FB923C",critical:"#EF4444"};function Qe(e,t="margin"){return e.hasData?"deviation"===t?e.deviationClass?Ye[e.deviationClass]:"#505058":e.marginClass?Je[e.marginClass]:"#505058":"#505058"}function et(e,t=.5,s=4){return null==e.marginDb?t:t+Math.max(0,Math.min(1,e.marginDb/40))*(s-t)}let tt=0;function st(){return`ta-${++tt}-${Date.now()}`}function nt(e){return{standard:0,ghost:1,mobile:2,neighbor:3,backbone:4,gateway:5,hub:6,local:7}[e]??0}class at{constructor(e=200){t(this,"prevSnapshot",null),t(this,"log",[]),t(this,"maxLog"),this.maxLog=e}update(e,t){const s=function(e){const t=new Set;for(const r of e.edges)t.add(r.key);const s=new Map,n=new Map,a=new Map,i=new Set;for(const[r,l]of e.nodeMetrics)s.set(r,l.betweenness),n.set(r,l.communityId),a.set(r,l.nodeClass),i.add(r);const o=new Set;for(const r of e.discoveredNodes)r.isLikelyReal&&o.add(r.prefix);return{timestamp:Date.now(),edgeKeys:t,betweenness:s,communities:n,nodeClasses:a,ghostPrefixes:o,nodeHashes:i}}(e);if(!this.prevSnapshot)return this.prevSnapshot=s,{anomalies:[],categoryCounts:{"edge-appeared":0,"edge-disappeared":0,"ghost-appeared":0,"ghost-disappeared":0,"betweenness-shift":0,"community-change":0,"class-change":0,"node-appeared":0,"node-disappeared":0},severityCounts:{info:0,warning:0,critical:0},totalCount:0,timestamp:Date.now()};const n=function(e,t,s){const n=Date.now(),a=[],i=e=>(null==s?void 0:s.get(e))??null;for(const d of t.edgeKeys)if(!e.edgeKeys.has(d)){const[e,t]=d.split("-"),s=i(e)??(null==e?void 0:e.slice(0,6)),o=i(t)??(null==t?void 0:t.slice(0,6));a.push({id:st(),detectedAt:n,category:"edge-appeared",severity:"info",description:`New edge: ${s} ↔ ${o}`,edgeKey:d})}for(const d of e.edgeKeys)if(!t.edgeKeys.has(d)){const[e,t]=d.split("-"),s=i(e)??(null==e?void 0:e.slice(0,6)),o=i(t)??(null==t?void 0:t.slice(0,6));a.push({id:st(),detectedAt:n,category:"edge-disappeared",severity:"warning",description:`Edge lost: ${s} ↔ ${o}`,edgeKey:d})}for(const d of t.nodeHashes)if(!e.nodeHashes.has(d)){const e=i(d);a.push({id:st(),detectedAt:n,category:"node-appeared",severity:"info",description:`Node appeared: ${e??d.slice(0,8)}`,nodeHash:d,nodeName:e??void 0})}for(const d of e.nodeHashes)if(!t.nodeHashes.has(d)){const e=i(d);a.push({id:st(),detectedAt:n,category:"node-disappeared",severity:"warning",description:`Node dropped: ${e??d.slice(0,8)}`,nodeHash:d,nodeName:e??void 0})}for(const d of t.ghostPrefixes)e.ghostPrefixes.has(d)||a.push({id:st(),detectedAt:n,category:"ghost-appeared",severity:"info",description:`Ghost node discovered: ${d.toUpperCase()}`});for(const d of e.ghostPrefixes)t.ghostPrefixes.has(d)||a.push({id:st(),detectedAt:n,category:"ghost-disappeared",severity:"info",description:`Ghost node resolved: ${d.toUpperCase()}`});for(const[d,u]of t.betweenness){const t=e.betweenness.get(d);if(void 0===t)continue;const s=Math.abs(u-t);if(s>=.15){const e=i(d),o=u>t?"increased":"decreased";a.push({id:st(),detectedAt:n,category:"betweenness-shift",severity:s>=.3?"critical":"warning",description:`${e??d.slice(0,8)} betweenness ${o}: ${t.toFixed(3)} → ${u.toFixed(3)}`,nodeHash:d,nodeName:e??void 0,previousValue:t,currentValue:u})}}for(const[d,u]of t.communities){const t=e.communities.get(d);if(void 0!==t&&u!==t){const e=i(d);a.push({id:st(),detectedAt:n,category:"community-change",severity:"info",description:`${e??d.slice(0,8)} moved: community #${t} → #${u}`,nodeHash:d,nodeName:e??void 0,previousValue:t,currentValue:u})}}for(const[d,u]of t.nodeClasses){const t=e.nodeClasses.get(d);if(void 0!==t&&u!==t){const e=i(d),s=nt(u)>nt(t);a.push({id:st(),detectedAt:n,category:"class-change",severity:s?"warning":"info",description:`${e??d.slice(0,8)} ${s?"promoted":"changed"}: ${t} → ${u}`,nodeHash:d,nodeName:e??void 0,previousValue:t,currentValue:u})}}const o={},r={},l=["edge-appeared","edge-disappeared","ghost-appeared","ghost-disappeared","betweenness-shift","community-change","class-change","node-appeared","node-disappeared"],c=["info","warning","critical"];for(const d of l)o[d]=0;for(const d of c)r[d]=0;for(const d of a)o[d.category]++,r[d.severity]++;return a.sort((e,t)=>t.detectedAt-e.detectedAt),{anomalies:a,categoryCounts:o,severityCounts:r,totalCount:a.length,timestamp:n}}(this.prevSnapshot,s,t);this.prevSnapshot=s;try{!function(e,t){const s=t.edgeMap,n=t.nodeMetrics,a=new Set(t.backboneEdges??[]);for(const i of e){if(i.edgeKey&&("edge-appeared"===i.category||"edge-disappeared"===i.category)){const e=null==s?void 0:s.get(i.edgeKey),t=i.edgeKey.split("-"),o=t[0],r=t[1],l=o?null==n?void 0:n.get(o):void 0,c=r?null==n?void 0:n.get(r):void 0;i.edgeDetail=e?{fromName:(null==l?void 0:l.name)??null,toName:(null==c?void 0:c.name)??null,fromClass:(null==l?void 0:l.nodeClass)??null,toClass:(null==c?void 0:c.nodeClass)??null,packetCount:e.packetCount,confidence:e.avgConfidence,symmetryRatio:e.symmetryRatio,isBackbone:a.has(i.edgeKey),isLoop:e.isLoopEdge??!1,isZeroHop:e.isZeroHop??!1,isDirectPath:e.isDirectPathEdge,avgRssi:e.avgRssi??null,avgSnr:e.avgSnr??null,fromBetweenness:(null==l?void 0:l.betweenness)??null,toBetweenness:(null==c?void 0:c.betweenness)??null}:{fromName:(null==l?void 0:l.name)??null,toName:(null==c?void 0:c.name)??null,fromClass:(null==l?void 0:l.nodeClass)??null,toClass:(null==c?void 0:c.nodeClass)??null,packetCount:0,confidence:0,symmetryRatio:0,isBackbone:!1,isLoop:!1,isZeroHop:!1,isDirectPath:!1,avgRssi:null,avgSnr:null,fromBetweenness:(null==l?void 0:l.betweenness)??null,toBetweenness:(null==c?void 0:c.betweenness)??null}}if(i.nodeHash){const e=null==n?void 0:n.get(i.nodeHash);e&&(i.nodeDetail=it(e))}}}(n.anomalies,e)}catch(a){}return this.log.unshift(...n.anomalies),this.log.length>this.maxLog&&(this.log.length=this.maxLog),n}getLog(){return this.log}getFiltered(e){const t=Date.now();return this.log.filter(s=>!(e.category&&s.category!==e.category||e.severity&&s.severity!==e.severity||e.nodeHash&&s.nodeHash!==e.nodeHash||e.maxAge&&t-s.detectedAt>e.maxAge))}clear(){this.log=[],this.prevSnapshot=null}}function it(e){return{nodeClass:e.nodeClass,degree:e.degree,betweenness:e.betweenness,activityLevel:e.activityLevel,isZeroHop:e.isZeroHop,avgRssi:e.avgRssi,avgSnr:e.avgSnr,communityId:e.communityId,packetCount:e.packetCount,connectionCount:e.degree}}function ot(e){if(e.length<2)return 0;const t=e.length;let s=0,n=0,a=0,i=0;for(let r=0;r.3&&n.push({name:"Weak link certainty",description:e.weakestLinkKey?`Weakest: ${e.weakestLinkConfidence<.3?"very low":"low"} confidence`:`Average certainty: ${(100*e.avgEdgeCertainty).toFixed(0)}%`,score:i,weight:.3});let o=0;0===e.alternatePathsCount?(o=1,n.push({name:"No alternate paths",description:"Single route to destination — no failover available",score:o,weight:.2})):1===e.alternatePathsCount&&(o=.5,n.push({name:"Limited redundancy",description:"Only 1 alternate path available",score:o,weight:.2}));let r=0;if(e.weakestLinkKey){const a=t.get(e.weakestLinkKey);if(null!=(null==a?void 0:a.avgRssi)){const e=a.avgRssi-s;e<3?(r=1,n.push({name:"Signal near sensitivity",description:`Weakest link: ${e.toFixed(1)} dB margin (< 3 dB)`,score:r,weight:rt})):e<10&&(r=1-(e-3)/7,n.push({name:"Low signal margin",description:`Weakest link: ${e.toFixed(1)} dB margin`,score:r,weight:rt}))}}const l=.35*a+.3*i+.2*o+r*rt;if(l<.35)return null;let c,d;return l>=.75?(c="critical",d="imminent"):l>=.55?(c="high",d="near-term"):(c="moderate",d="watch"),{pathKey:e.pathKey,hops:e.hops,riskScore:Math.round(100*l)/100,riskLevel:c,factors:n,weakestEdgeKey:e.weakestLinkKey,healthScore:e.healthScore,observationTrend:e.observationTrend,alternatePathsCount:e.alternatePathsCount,urgency:d}}let ct=100;function dt(){return++ct}const ut="meshgraph-panel-";function mt(e){try{const t=localStorage.getItem(ut+e);return t?JSON.parse(t):null}catch{return null}}function ht({id:e,title:t,icon:a,open:i,onClose:o,defaultPosition:r,defaultSize:l,minSize:c={width:180,height:120},maxSize:d,autoHeight:u=!1,headerActions:g,children:f}){const v=W(),b=s.useRef(null),y=s.useRef(null),j=s.useMemo(()=>{const t=mt(e);return t?{x:t.x,y:t.y,w:t.w,h:u?l.height:t.h,minimized:t.minimized}:{x:r.x,y:r.y,w:l.width,h:l.height,minimized:!1}},[e]),[N,w]=s.useState({w:j.w,h:j.h}),[C,k]=s.useState(j.minimized),[S,L]=s.useState(()=>dt()),[D,F]=s.useState({x:j.x,y:j.y});s.useLayoutEffect(()=>{const t=b.current;if(!i||!t)return;const s=t.getBoundingClientRect();if(s.width<1||s.height<1)return;const n=mt(e),a=(o=(null==n?void 0:n.x)??j.x,r=(null==n?void 0:n.y)??j.y,l=(null==n?void 0:n.w)??N.w,c=s.width,d=s.height,{x:Math.max(8,Math.min(o,Math.max(8,c-l-8))),y:Math.max(8,Math.min(r,Math.max(8,d-36)))});var o,r,l,c,d;F(a)},[i,e]);const[R,M]=s.useState(!1),H=s.useRef({startX:0,startY:0,startW:0,startH:0,edge:""}),B=s.useRef(),P=s.useCallback(()=>{B.current&&clearTimeout(B.current),B.current=setTimeout(()=>{const t=y.current;if(!t)return;const s=window.getComputedStyle(t),n=new DOMMatrix(s.transform);!function(e,t){try{localStorage.setItem(ut+e,JSON.stringify(t))}catch{}}(e,{x:n.m41,y:n.m42,w:N.w,h:N.h,minimized:C})},300)},[e,N.w,N.h,C]);s.useEffect(()=>{P()},[N,C,P]);const E=s.useCallback(()=>{L(dt())},[]),z=s.useCallback(()=>{k(e=>!e)},[]),A=s.useCallback((e,t)=>{e.preventDefault(),e.stopPropagation(),M(!0),H.current={startX:e.clientX,startY:e.clientY,startW:N.w,startH:N.h,edge:t},E();const s=e=>{const{startX:t,startY:s,startW:n,startH:a,edge:i}=H.current,o=e.clientX-t,r=e.clientY-s;let l=n,u=a;"e"!==i&&"se"!==i||(l=Math.max(c.width,n+o),d&&(l=Math.min(d.width,l))),"s"!==i&&"se"!==i||(u=Math.max(c.height,a+r),d&&(u=Math.min(d.height,u))),w({w:l,h:u})},n=()=>{M(!1),window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",n)};window.addEventListener("pointermove",s),window.addEventListener("pointerup",n)},[N,c,d,E]);return n.jsx("div",{ref:b,className:"absolute inset-0 pointer-events-none",style:{zIndex:S},children:n.jsx(m,{children:i&&n.jsxs(h.div,{ref:y,drag:!R,dragControls:v,dragConstraints:b,dragElastic:.05,dragMomentum:!1,dragListener:!1,initial:{opacity:0,scale:.96,x:D.x,y:D.y},animate:{opacity:1,scale:1,x:D.x,y:D.y},exit:{opacity:0,scale:.96},transition:{duration:.15},onPointerDown:E,className:"absolute top-0 left-0 pointer-events-auto",style:{width:N.w,touchAction:"none"},children:[n.jsxs("div",{className:"surface-elevated radius-inset shadow-xl overflow-hidden flex flex-col",style:{maxHeight:C?void 0:u?"80vh":N.h},children:[n.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 border-b border-edge-subtle cursor-grab active:cursor-grabbing select-none shrink-0",onPointerDown:e=>{E(),v.start(e)},children:[n.jsx(V,{className:"w-3 h-3 text-fg-muted/50 shrink-0"}),a&&n.jsx("span",{className:"text-fg-muted shrink-0 [&>svg]:w-3 [&>svg]:h-3",children:a}),n.jsx("span",{className:"text-[11px] font-medium text-fg-primary flex-1 truncate",children:t}),g,n.jsx("button",{onClick:z,className:"p-0.5 radius-badge hover-bg transition-base",title:C?"Expand":"Minimize",children:C?n.jsx(K,{className:"w-2.5 h-2.5 text-fg-muted"}):n.jsx(x,{className:"w-2.5 h-2.5 text-fg-muted"})}),n.jsx("button",{onClick:o,className:"p-0.5 radius-badge hover-bg transition-base",title:"Close",children:n.jsx(p,{className:"w-2.5 h-2.5 text-fg-muted"})})]}),n.jsx(m,{initial:!1,children:!C&&n.jsx(h.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},className:"overflow-hidden",children:n.jsx("div",{className:"overflow-y-auto",style:{maxHeight:u?"70vh":void 0},children:f})})})]}),!C&&!u&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"absolute top-0 -right-1 w-2 h-full cursor-ew-resize",onPointerDown:e=>A(e,"e")}),n.jsx("div",{className:"absolute -bottom-1 left-0 w-full h-2 cursor-ns-resize",onPointerDown:e=>A(e,"s")}),n.jsx("div",{className:"absolute -bottom-1 -right-1 w-3 h-3 cursor-nwse-resize",onPointerDown:e=>A(e,"se"),children:n.jsxs("svg",{className:"w-full h-full text-fg-muted/30",viewBox:"0 0 12 12",children:[n.jsx("path",{d:"M10 2 L10 10 L2 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),n.jsx("path",{d:"M7 5 L7 7 L5 7",fill:"none",stroke:"currentColor",strokeWidth:"1"})]})})]})]})})})}const xt=800,pt={critical:[S.red,S.red],poor:[S.orange,S.orange],fair:[S.amber,S.amber],good:[S.green,S.green],excellent:[S.blue,S.blue]},gt={active:1,recent:.85,stale:.45,inactive:.25},ft=[S.purple,S.green,S.amber,S.red,S.blue,S.pink,S.teal,S.orange],vt=[S.purple,S.green,S.amber,S.red,S.blue,S.pink,S.teal,S.orange];function bt(e,t,s){const n=(e,t)=>parseInt(e.slice(1+2*t,3+2*t),16);return`#${[0,1,2].map(a=>{return(i=a,Math.round(n(e,i)*s+n(t,i)*(1-s))).toString(16).padStart(2,"0");var i}).join("")}`}const yt={zeroHop:bt(S.amber,L[500],.55),directPath:bt(S.teal,L[500],.55),loop:bt(S.purple,L[500],.55),backbone:L[300],standard:L[500],standardDim:L[600],ghost:L[600]},jt={zeroHop:bt(S.amber,L[700],.5),directPath:bt(S.teal,L[700],.5),loop:bt(S.purple,L[700],.5),backbone:L[700],standard:L[400],standardDim:L[300],ghost:L[400]},Nt=!1,wt=!0,Ct=!0,kt=!0,St=!0,Lt=!0,Dt={local:S.amber,hub:S.purple,gateway:S.blue,backbone:S.green,neighbor:S.pink,mobile:S.orange,ghost:L[400],standard:L[300]},Ft={local:S.amber,hub:S.purple,gateway:S.blue,backbone:S.green,neighbor:S.pink,mobile:S.orange,ghost:L[500],standard:L[600]},Rt={local:"Your repeater — the home node running this dashboard",hub:"≥10% of last-hop traffic — dominant forwarder for your local node",gateway:"7-10% of last-hop traffic — significant relay node",backbone:"High betweenness centrality — critical path node connecting clusters",neighbor:"Zero-hop direct RF contact — no intermediate forwarders",mobile:"High path volatility — node appears and disappears frequently",ghost:"Unresolved prefix inferred by Viterbi HMM from path patterns",standard:"<7% of traffic — normal mesh participant"};function Mt(e){const t=e.replace("#","");return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}function Ht(e,t,s){const[n,a,i]=Mt(e),[o,r,l]=Mt(t),c=Math.max(0,Math.min(1,s)),d=Math.round(n*c+o*(1-c)),u=Math.round(a*c+r*(1-c)),m=Math.round(i*c+l*(1-c));return`#${d.toString(16).padStart(2,"0")}${u.toString(16).padStart(2,"0")}${m.toString(16).padStart(2,"0")}`}function Bt(e,t){return e.isZeroHop?"zero-hop":e.isDirectPathEdge?"direct-path":e.isLoopEdge?"loop":t.has(e.key)?"backbone":"standard"}function Pt(e,t,s){const n=s?yt:jt;switch(e){case"zero-hop":return n.zeroHop;case"direct-path":return n.directPath;case"loop":return n.loop;case"backbone":return n.backbone;case"ghost":return n.ghost;default:return t>=.7?n.standard:n.standardDim}}const Et={"zero-hop":"Zero-Hop (Direct RF)","direct-path":"Direct Path (Unicast)",loop:"Redundant Loop",backbone:"Backbone",standard:"Standard",ghost:"Ghost (Inferred)"},zt={"zero-hop":"Direct radio contact — no intermediate forwarders in path","direct-path":"Unicast-routed edge — verified via DIRECT route type packets",loop:"Redundant path — alternate route between the same endpoints exists",backbone:"High betweenness centrality — critical traffic flow edge",standard:"Normal mesh edge with moderate-to-high confidence",ghost:"Inferred connection from Viterbi HMM ghost node analysis"},At=s.memo(function({timeline:e}){const t=e.buckets;if(t.length<2)return null;const[s,a]=e.rssiRange,i=Math.max(1,a-s),[o,r]=e.snrRange,l=Math.max(1,r-o),c=198/(t.length-1),d=t.map((e,t)=>{const n=1+t*c,a=1+34*(1-(e.avgRssi-s)/i);return`${n.toFixed(1)},${a.toFixed(1)}`}).join(" "),u=t.map((e,t)=>{const s=1+t*c,n=1+34*(1-(e.avgSnr-o)/l);return`${s.toFixed(1)},${n.toFixed(1)}`}).join(" "),m=e.rssiTrend>.1?"↑":e.rssiTrend<-.1?"↓":"→",h=e.snrTrend>.1?"↑":e.snrTrend<-.1?"↓":"→",x=e.rssiTrend>.1?"#34D399":e.rssiTrend<-.1?"#EF4444":"#9CA3AF",p=e.snrTrend>.1?"#34D399":e.snrTrend<-.1?"#EF4444":"#9CA3AF",g=(e.timeSpanMs/36e5).toFixed(1),f=function(e){const t=e.rssiTrend<-.1,s=e.snrTrend<-.1,n=e.rssiTrend>.1,a=e.snrTrend>.1,i=e.rssiRange[1]-e.rssiRange[0],o=e.snrRange[1]-e.snrRange[0];return t&&s?{text:"Both RSSI and SNR declining — possible antenna degradation or increasing distance",color:"#EF4444"}:s&&!t?{text:"SNR declining while RSSI stable — likely RF interference or noise floor increase",color:"#F97316"}:t&&!s?{text:"RSSI declining while SNR stable — possible path obstruction or power change",color:"#F97316"}:n&&a?{text:"Signal improving — conditions favorable or antenna adjustment working",color:"#34D399"}:i>15||o>10?{text:"High signal variance — intermittent obstruction or multipath fading",color:"#FBBF24"}:{text:"Signal stable — no significant degradation detected",color:"#9CA3AF"}}(e);return n.jsxs("div",{className:"mt-2 pt-2 border-t border-edge-subtle/50",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx(M,{content:n.jsxs("div",{className:"max-w-xs space-y-1.5",children:[n.jsx("div",{className:"font-semibold text-fg-primary",children:"Signal Quality Over Time"}),n.jsx("div",{className:"text-fg-secondary text-[11px]",children:"Tracks RSSI (signal power) and SNR (signal-to-noise ratio) for zero-hop packets received directly from this neighbor. Reveals weather effects, interference, and antenna degradation."}),n.jsxs("div",{className:"pt-1 border-t border-edge-subtle/30 space-y-0.5 font-mono text-[10px]",children:[n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Samples"}),n.jsx("span",{className:"text-fg-primary tabular-nums",children:e.totalSamples})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Time span"}),n.jsxs("span",{className:"text-fg-primary tabular-nums",children:[g,"h"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Avg RSSI"}),n.jsxs("span",{className:"text-fg-primary tabular-nums",children:[e.avgRssi.toFixed(1)," dBm"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Avg SNR"}),n.jsxs("span",{className:"text-fg-primary tabular-nums",children:[e.avgSnr.toFixed(1)," dB"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"RSSI trend"}),n.jsxs("span",{className:"tabular-nums",style:{color:x},children:[e.rssiTrend>0?"+":"",e.rssiTrend.toFixed(3)," dBm/bucket"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"SNR trend"}),n.jsxs("span",{className:"tabular-nums",style:{color:p},children:[e.snrTrend>0?"+":"",e.snrTrend.toFixed(3)," dB/bucket"]})]})]}),n.jsxs("div",{className:"text-[10px] text-fg-muted italic",children:["Trend is linear regression slope across ",t.length," time buckets. ↑ = improving, ↓ = degrading, → = stable."]})]}),children:n.jsx("span",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Signal Timeline"})}),n.jsxs("span",{className:"text-[9px] text-fg-muted tabular-nums",children:[e.totalSamples," samples · ",g,"h"]})]}),n.jsxs("svg",{viewBox:"0 0 200 36",className:"w-full h-9",preserveAspectRatio:"none",children:[n.jsx("polyline",{points:d,fill:"none",stroke:"#60A5FA",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.8"}),n.jsx("polyline",{points:u,fill:"none",stroke:"#34D399",strokeWidth:"1",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.5",strokeDasharray:"3 2"})]}),n.jsxs("div",{className:"flex items-center justify-between text-[9px] mt-0.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"flex items-center gap-0.5",children:[n.jsx("span",{className:"w-2.5 h-[1.5px] bg-[#60A5FA] rounded-full inline-block"}),n.jsx("span",{className:"text-fg-muted",children:"RSSI"}),n.jsx("span",{className:"tabular-nums",style:{color:x},children:m})]}),n.jsxs("span",{className:"flex items-center gap-0.5",children:[n.jsx("span",{className:"w-2.5 h-[1px] bg-[#34D399] rounded-full inline-block opacity-50",style:{borderTop:"1px dashed #34D399"}}),n.jsx("span",{className:"text-fg-muted",children:"SNR"}),n.jsx("span",{className:"tabular-nums",style:{color:p},children:h})]})]}),n.jsxs("div",{className:"flex items-center gap-2 text-fg-muted tabular-nums",children:[n.jsxs("span",{children:[s.toFixed(0),"…",a.toFixed(0)," dBm"]}),n.jsxs("span",{children:[o.toFixed(0),"…",r.toFixed(0)," dB"]})]})]}),n.jsx("div",{className:"mt-1 text-[9px] leading-tight",style:{color:f.color},children:f.text})]})}),Tt=s.memo(function({edge:e,onClose:t}){const[a,i]=s.useState(null);return s.useEffect(()=>{if(!e.isZeroHop&&"zero-hop"!==e.edgeType)return void i(null);const t=Z.getState().packets,s=Z.getState().cachedLocalHash??void 0,n=function(e,t,s,n,a=24){const i=function(e,t,s,n){var a;const i=[],o=t.replace(/^0x/i,"").slice(0,2).toLowerCase();for(const r of e){if(r.transmitted)continue;if(null==r.rssi||null==r.snr)continue;if(0===r.rssi&&0===r.snr)continue;const e=(null==(a=r.src_hash)?void 0:a.replace(/^0x/i,""))??"";if(e.slice(0,2).toLowerCase()!==o&&e!==t.replace(/^0x/i,""))continue;const s=r.original_path??r.forwarded_path??[],l=d(s,n),c=(null==l?void 0:l.effectiveLength)??0,m=r.route??r.route_type;let h=!1;h=null!=m&&u(m)?c<=1:0===c,h&&i.push({timestamp:1e3*r.timestamp,rssi:r.rssi,snr:r.snr})}if(i.sort((e,t)=>e.timestamp-t.timestamp),i.length>0&&i[0].timestamp<4102444800)for(const r of i)r.timestamp*=1e3;return i}(e,t,0,n);if(i.length<3)return null;const o=function(e,t=24){if(0===e.length)return[];const s=e[0].timestamp,n=e[e.length-1].timestamp-s;if(n<=0)return[{timestamp:s,avgRssi:e.reduce((e,t)=>e+t.rssi,0)/e.length,avgSnr:e.reduce((e,t)=>e+t.snr,0)/e.length,minRssi:Math.min(...e.map(e=>e.rssi)),maxRssi:Math.max(...e.map(e=>e.rssi)),minSnr:Math.min(...e.map(e=>e.snr)),maxSnr:Math.max(...e.map(e=>e.snr)),count:e.length}];const a=n/t,i=[];for(let r=0;r0&&(r.avgRssi/=r.count,r.avgSnr/=r.count,o.push(r));return o}(i,a);if(o.length<2)return null;let r=0,l=0,c=1/0,m=-1/0,h=1/0,x=-1/0;for(const d of i)r+=d.rssi,l+=d.snr,c=Math.min(c,d.rssi),m=Math.max(m,d.rssi),h=Math.min(h,d.snr),x=Math.max(x,d.snr);const p=ot(o.map(e=>e.avgRssi)),g=ot(o.map(e=>e.avgSnr)),f=i[0].timestamp,v=i[i.length-1].timestamp;return{buckets:o,totalSamples:i.length,rssiRange:[c,m],snrRange:[h,x],avgRssi:r/i.length,avgSnr:l/i.length,rssiTrend:p,snrTrend:g,timeSpanMs:v-f}}(t,e.source,e.target,s);i(n)},[e.source,e.target,e.isZeroHop,e.edgeType]),n.jsxs(h.div,{variants:Y,initial:"hidden",animate:"visible",exit:"exit",className:"absolute inset-x-3 bottom-3 z-20 surface-elevated radius-inset shadow-xl",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-edge-subtle/50",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(ge,{className:"size-3.5 text-fg-muted shrink-0"}),n.jsxs("span",{className:"text-sm font-semibold text-fg-primary truncate",children:[e.fromName??e.source.slice(0,6)," → ",e.toName??e.target.slice(0,6)]}),n.jsxs("div",{className:"flex gap-1 shrink-0",children:[n.jsx(R,{color:"zinc",compact:!0,children:Et[e.edgeType]}),e.isBackbone&&n.jsx(R,{color:"emerald",compact:!0,children:"BONE"}),e.isLoopEdge&&n.jsx(R,{color:"indigo",compact:!0,children:"LOOP"}),e.isGhost&&n.jsx(R,{color:"zinc",compact:!0,children:"GHOST"})]})]}),n.jsx(I,{plain:!0,onClick:t,title:"Close",className:"shrink-0",children:n.jsx(p,{className:"size-4"})})]}),n.jsxs("div",{className:"p-3 font-mono text-[11px]",children:[n.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[n.jsxs("div",{children:[n.jsx(M,{content:"Average disambiguation confidence across all observations of this edge",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Confidence"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[(100*e.confidence).toFixed(0),"%"]})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Observations where both endpoints had high-confidence disambiguation",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Certain"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.certainCount.toLocaleString()})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Total packets observed traversing this edge",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Packets"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.packetCount.toLocaleString()})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Combined certainCount × confidence metric for edge ranking",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Strength"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.strength.toFixed(2)})]})]}),n.jsxs("div",{className:"grid grid-cols-4 gap-3 mt-2",children:[n.jsxs("div",{children:[n.jsx(M,{content:"Bidirectional balance (min/max) — 0 = one-way traffic, 1 = perfectly balanced",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Symmetry"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.symmetryRatio.toFixed(2)})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Dominant traffic flow direction between these nodes",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Direction"})}),n.jsx("div",{className:"text-fg-primary capitalize",children:e.dominantDirection})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Forward (A→B) vs reverse (B→A) observation counts",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Fwd / Rev"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.forwardCount," / ",e.reverseCount]})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Routing method — broadcast flood vs unicast direct routing",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Flood / Direct"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.floodCount," / ",e.directCount]})]})]}),(null!=e.avgRssi||null!=e.avgSnr)&&n.jsxs("div",{className:"grid grid-cols-2 gap-3 mt-2 pt-2 border-t border-edge-subtle/50",children:[null!=e.avgRssi&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase",children:"RSSI"}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.avgRssi.toFixed(1)," dBm"]})]}),null!=e.avgSnr&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase",children:"SNR"}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.avgSnr.toFixed(1)," dB"]})]})]}),e.linkBudget&&n.jsxs("div",{className:"grid grid-cols-4 gap-3 mt-2 pt-2 border-t border-edge-subtle/50",children:[null!=e.linkBudget.distanceKm&&n.jsxs("div",{children:[n.jsx(M,{content:"Haversine distance between endpoint locations",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Distance"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.linkBudget.distanceKm.toFixed(2)," km"]})]}),null!=e.linkBudget.fsplDb&&n.jsxs("div",{children:[n.jsx(M,{content:"Free Space Path Loss — theoretical signal attenuation over this distance at configured frequency",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"FSPL"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.linkBudget.fsplDb.toFixed(1)," dB"]})]}),null!=e.linkBudget.marginDb&&n.jsxs("div",{children:[n.jsx(M,{content:"Link margin — observed RSSI minus receiver sensitivity. Positive = signal headroom above minimum.",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Margin"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",style:{color:e.linkBudget.marginClass?Je[e.linkBudget.marginClass]:void 0},children:[e.linkBudget.marginDb>0?"+":"",e.linkBudget.marginDb.toFixed(1)," dB"]})]}),null!=e.linkBudget.deviationDb&&n.jsxs("div",{children:[n.jsx(M,{content:"Deviation from theoretical FSPL — positive means better signal than free-space prediction",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"vs Theory"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.linkBudget.deviationDb>0?"+":"",e.linkBudget.deviationDb.toFixed(1)," dB"]})]})]}),a&&n.jsx(At,{timeline:a})]})]})}),$t=s.memo(function({node:e,onClose:t,egoMetrics:a,onExpandEgo:i,neighbors:o,onSelectNeighbor:r,txDelayRec:l}){const[c,d]=s.useState(!1),[u,m]=s.useState(!1);return n.jsxs(h.div,{variants:Y,initial:"hidden",animate:"visible",exit:"exit",className:"absolute inset-x-3 bottom-3 z-20 surface-elevated radius-inset shadow-xl max-h-[60vh] flex flex-col",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-edge-subtle/50",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:($()?Dt:Ft)[e.nodeClass]}}),n.jsx("code",{className:"text-sm font-semibold text-fg-primary shrink-0",children:e.prefix}),e.name&&n.jsx("span",{className:"text-sm text-fg-secondary truncate",children:e.name}),n.jsxs("div",{className:"flex gap-1 shrink-0",children:[e.isLocal&&n.jsx(R,{color:"yellow",compact:!0,children:"LOCAL"}),e.isHub&&n.jsx(R,{color:"violet",compact:!0,children:"HUB"}),e.isGateway&&n.jsx(R,{color:"sky",compact:!0,children:"GW"}),e.isBackbone&&n.jsx(R,{color:"emerald",compact:!0,children:"BONE"}),e.isMobile&&n.jsx(R,{color:"orange",compact:!0,children:"MOB"}),e.isZeroHop&&n.jsx(R,{color:"amber",compact:!0,children:"RF"}),e.isGhost&&n.jsx(R,{color:"zinc",compact:!0,children:"GHOST"}),e.isInLoop&&n.jsx(R,{color:"indigo",compact:!0,children:"LOOP"})]})]}),n.jsx(I,{plain:!0,onClick:t,title:"Close",className:"shrink-0",children:n.jsx(p,{className:"size-4"})})]}),n.jsxs("div",{className:"p-3 font-mono text-[11px]",children:[n.jsx(J,{copy:!0,size:"compact",truncate:[10,6],className:"w-full mb-3",children:e.hash}),n.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[n.jsxs("div",{children:[n.jsx(M,{content:"Total connections (edges) to this node",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Degree"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.degree})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Inbound vs outbound edge count — indicates traffic directionality",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"In / Out"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.inDegree," / ",e.outDegree]})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Betweenness centrality (0–1) — how often this node lies on shortest paths. High value = critical relay.",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Between."})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.betweenness.toFixed(3)})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Total packets observed involving this node",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Packets"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.packetCount.toLocaleString()})]})]}),n.jsxs("div",{className:"grid grid-cols-4 gap-3 mt-2",children:[n.jsxs("div",{children:[n.jsx(M,{content:"Number of topology edges connected to this node",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Edges"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.edgeCount})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Community cluster assignment from graph partitioning algorithm",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Community"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:["#",e.communityId]})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Prefix disambiguation confidence — how certain the 2-char prefix→node mapping is (multi-factor scoring)",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Confidence"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[(100*e.prefixConfidence).toFixed(0),"%"]})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Recency level — active (<1h), recent (<6h), stale (<24h), inactive (>24h)",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Activity"})}),n.jsx("div",{className:"text-fg-primary capitalize",children:e.activityLevel})]})]}),(null!=e.avgRssi||null!=e.avgSnr)&&n.jsxs("div",{className:"grid grid-cols-2 gap-3 mt-2 pt-2 border-t border-edge-subtle/50",children:[null!=e.avgRssi&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase",children:"RSSI"}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.avgRssi.toFixed(1)," dBm"]})]}),null!=e.avgSnr&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase",children:"SNR"}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[e.avgSnr.toFixed(1)," dB"]})]})]}),a&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-3 gap-3 mt-2 pt-2 border-t border-edge-subtle/50",children:[n.jsxs("div",{children:[n.jsx(M,{content:"Number of direct 1-hop neighbors in the topology",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Ego Size"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:a.neighborCount})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Local clustering coefficient — how interconnected this node's neighbors are (0 = none, 1 = fully connected)",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Clustering"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:a.clusteringCoeff.toFixed(3)})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Average betweenness centrality of this node's direct neighbors",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Avg Nbr Btw."})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:a.avgNeighborBetweenness.toFixed(3)})]})]}),n.jsxs("div",{className:"grid grid-cols-3 gap-3 mt-2",children:[n.jsxs("div",{children:[n.jsx(M,{content:"Average disambiguation confidence across all connected edges",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Edge Conf."})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[(100*a.avgEdgeConfidence).toFixed(0),"%"]})]}),null!=a.avgRssi&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase",children:"Avg RSSI"}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[a.avgRssi.toFixed(1)," dBm"]})]}),null!=a.avgSnr&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase",children:"Avg SNR"}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[a.avgSnr.toFixed(1)," dB"]})]})]})]}),l&&!l.insufficientData&&n.jsxs("div",{className:"mt-2 pt-2 border-t border-edge-subtle/50",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[n.jsx(M,{content:"RF-grounded TX delay recommendation from centralized topology engine. Anchored to MeshCore firmware defaults with observer bias correction.",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase tracking-wide cursor-help",children:"TX Delay Recommendation"})}),n.jsxs("div",{className:"flex items-center gap-1",children:[l.networkRole&&n.jsx(R,{color:se[l.networkRole],compact:!0,children:l.networkRole}),l.dataConfidence&&n.jsx(R,{color:ne[l.dataConfidence],compact:!0,children:l.dataConfidence})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(M,{content:`Flood TX delay factor (firmware default: ×${ae})`,children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Flood"})}),n.jsx("div",{className:"text-fg-primary tabular-nums text-sys-amber",children:ie(l.floodFactor)})]}),n.jsxs("div",{children:[n.jsx(M,{content:`Direct TX delay factor (firmware default: ×${oe})`,children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Direct"})}),n.jsx("div",{className:"text-fg-primary tabular-nums text-sys-amber",children:ie(l.directFactor)})]})]}),l.rationale&&n.jsx("div",{className:"mt-1 text-[9px] text-fg-muted leading-snug",children:l.rationale}),null!=l.observationSymmetry&&l.observationSymmetry<.6&&n.jsxs("div",{className:"mt-1 text-[9px] text-sys-amber/70 leading-snug",children:["⚠ Low observation symmetry (",(100*l.observationSymmetry).toFixed(0),"%) — recommendation damped toward firmware defaults"]}),n.jsxs("button",{onClick:async()=>{const e=`set txdelay ${l.floodFactor.toFixed(1)}\nset direct.txdelay ${l.directFactor.toFixed(1)}`;try{await navigator.clipboard.writeText(e)}catch{}m(!0),setTimeout(()=>m(!1),1500)},className:"mt-1.5 flex items-center gap-1 text-[9px] text-sys-blue hover:text-sys-blue/80 transition-base",children:[u?n.jsx(G,{className:"w-3 h-3 text-sys-green"}):n.jsx(pe,{className:"w-3 h-3"}),u?"Copied!":"Copy CLI commands"]})]}),i&&n.jsx("div",{className:"mt-2 pt-2 border-t border-edge-subtle/50",children:n.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 text-[10px] text-sys-blue hover:text-sys-blue/80 transition-base",children:[n.jsx(O,{className:"w-3 h-3"}),"Expand 2-hop neighborhood"]})}),o&&o.length>0&&n.jsxs("div",{className:"mt-2 pt-2 border-t border-edge-subtle/50",children:[n.jsxs("button",{onClick:()=>d(e=>!e),className:"flex items-center justify-between w-full text-[9px] text-fg-muted uppercase tracking-wide cursor-pointer hover:text-fg-secondary transition-base",children:[n.jsxs("span",{children:["Neighbors (",o.length,")"]}),n.jsx(z,{className:"w-3 h-3 transition-transform "+(c?"rotate-180":"")})]}),c&&n.jsx("div",{className:"mt-1.5 max-h-32 overflow-y-auto space-y-0.5",children:o.map(e=>n.jsxs("button",{onClick:()=>null==r?void 0:r(e.hash),className:"w-full flex items-center gap-2 px-1.5 py-1 radius-badge hover-bg transition-base text-left group",children:[n.jsx("code",{className:"text-[10px] text-sys-blue shrink-0 tabular-nums",children:e.prefix}),n.jsx("span",{className:"text-[10px] text-fg-secondary truncate flex-1",children:e.name||"—"}),null!=e.avgSnr&&n.jsxs("span",{className:"text-[9px] text-fg-muted tabular-nums shrink-0",children:[e.avgSnr.toFixed(0)," dB"]}),null!=e.avgRssi&&n.jsx("span",{className:"text-[9px] text-fg-muted tabular-nums shrink-0",children:e.avgRssi.toFixed(0)}),n.jsxs("span",{className:"text-[9px] text-fg-muted/60 tabular-nums shrink-0",children:[(100*e.edgeConfidence).toFixed(0),"%"]})]},e.hash))})]})]})]})}),It=s.memo(function({metrics:e,onClose:t}){const s=Object.entries(e.communities).sort(([,e],[,t])=>t-e),a=Object.entries(e.nodeClasses).sort(([,e],[,t])=>t-e);return n.jsxs(h.div,{variants:Y,initial:"hidden",animate:"visible",exit:"exit",className:"absolute inset-x-3 bottom-3 z-20 surface-elevated radius-inset shadow-xl",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-edge-subtle/50",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(be,{className:"size-3.5 text-fg-muted shrink-0"}),n.jsx("span",{className:"text-sm font-semibold text-fg-primary",children:"Subgraph Analysis"}),n.jsxs(R,{color:"violet",compact:!0,children:[e.nodeCount," nodes"]})]}),n.jsx(I,{plain:!0,onClick:t,title:"Close",className:"shrink-0",children:n.jsx(p,{className:"size-4"})})]}),n.jsxs("div",{className:"p-3 font-mono text-[11px]",children:[n.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase",children:"Nodes"}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.nodeCount})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Edges where both endpoints are within the lasso selection",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Internal Edges"})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.edgeCount})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Mean betweenness centrality of selected nodes",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Avg Between."})}),n.jsx("div",{className:"text-fg-primary tabular-nums",children:e.avgBetweenness.toFixed(3)})]}),n.jsxs("div",{children:[n.jsx(M,{content:"Mean edge disambiguation confidence for internal edges",children:n.jsx("div",{className:"text-[9px] text-fg-muted uppercase cursor-help",children:"Avg Confidence"})}),n.jsxs("div",{className:"text-fg-primary tabular-nums",children:[(100*e.avgConfidence).toFixed(0),"%"]})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3 mt-2 pt-2 border-t border-edge-subtle/50",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase mb-1",children:"Communities"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:s.map(([e,t])=>n.jsxs("span",{className:"text-fg-secondary",children:["#",e,"×",t]},e))})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-fg-muted uppercase mb-1",children:"Node Types"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:a.map(([e,t])=>n.jsxs("span",{className:"text-fg-secondary capitalize",children:[e,"×",t]},e))})]})]}),e.nodeCount>1&&n.jsx("div",{className:"mt-2 pt-2 border-t border-edge-subtle/50",children:n.jsxs("div",{className:"text-[9px] text-fg-muted flex items-center gap-1 flex-wrap",children:[n.jsx(M,{content:"Fraction of possible edges that exist — 2E / N(N-1)",children:n.jsxs("span",{className:"cursor-help",children:["Density: ",(2*e.edgeCount/(e.nodeCount*(e.nodeCount-1))*100).toFixed(1),"%"]})}),n.jsx("span",{children:"·"}),n.jsx(M,{content:"Mean connections per node — 2E / N",children:n.jsxs("span",{className:"cursor-help",children:["Avg Degree: ",(2*e.edgeCount/e.nodeCount).toFixed(1)]})}),null!=e.avgPathHealth&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"·"}),n.jsx(M,{content:"Average health score of paths within the selection",children:n.jsxs("span",{className:"cursor-help",children:["Path Health: ",(100*e.avgPathHealth).toFixed(0),"%"]})})]})]})})]})]})});function Gt(){return n.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 text-center px-8",children:[n.jsx("div",{className:"p-4 radius-pill bg-subtle-fill",children:n.jsx(xe,{className:"w-8 h-8 text-fg-muted"})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h2",{className:"type-subheading text-fg-primary",children:"No Topology Data"}),n.jsx("p",{className:"type-body text-fg-muted max-w-sm",children:"The mesh topology will appear here once packets are received and processed."})]}),n.jsxs("div",{className:"flex items-center gap-2 type-data-xs text-fg-muted",children:[n.jsx(P,{className:"w-4 h-4 animate-pulse"}),n.jsx("span",{children:"Waiting for mesh traffic..."})]})]})}const Ot=s.memo(function({label:e,value:t,onChange:a,min:i,max:o,step:r}){const[l,c]=s.useState(!1),[d,u]=s.useState(""),m=s.useRef(null),h=s.useCallback(()=>{const e=parseFloat(d);isNaN(e)||a(Math.min(o,Math.max(i,Math.round(e/r)*r))),c(!1)},[d,a,i,o,r]),x=s.useCallback(()=>{u(t.toFixed(2)),c(!0),setTimeout(()=>{var e;return null==(e=m.current)?void 0:e.select()},0)},[t]);return n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] text-fg-muted",children:e}),l?n.jsx("input",{ref:m,type:"number",value:d,onChange:e=>u(e.target.value),onBlur:h,onKeyDown:e=>{"Enter"===e.key&&h(),"Escape"===e.key&&c(!1)},min:i,max:o,step:r,className:"w-14 text-right text-[10px] text-fg-secondary tabular-nums bg-subtle-fill radius-badge px-1 py-0.5 border border-edge-subtle focus:outline-none focus:border-sys-blue"}):n.jsx("button",{onClick:x,className:"text-[10px] text-fg-secondary tabular-nums hover:text-sys-blue cursor-text transition-colors",title:"Click to type a value",children:t.toFixed(2)})]}),n.jsx("input",{type:"range",min:i,max:o,step:r,value:t,onChange:e=>a(parseFloat(e.target.value)),className:"w-full h-1 bg-subtle-fill rounded appearance-none cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3 [&::-webkit-slider-thumb]:h-3 [&::-webkit-slider-thumb]:bg-sys-blue [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:cursor-pointer"})]})}),Zt=s.memo(function({label:e,checked:t,onChange:s}){return n.jsxs(o,{className:"flex items-center justify-between",children:[n.jsx(r,{className:"text-[10px] text-fg-muted cursor-pointer select-none",children:e}),n.jsx(T,{enabled:t,onChange:s,size:"sm"})]})});function Wt(){var e,t,o,r,l,c,d,u,x,S,T,$,I,G,O;const Z=g(),[W,V]=s.useState(!1),[Y,J]=s.useState(!1),Q=s.useRef(!1);s.useEffect(()=>{Z&&!Q.current&&(Q.current=!0,J(!0))},[Z]);const ee=s.useCallback(()=>{J(!1),V(!0)},[]),se=f(),ne=function(e,t=1e3){const[n,a]=s.useState(e),i=s.useRef(Date.now()),o=s.useRef(null);return s.useEffect(()=>{const s=Date.now(),n=t-(s-i.current);return n<=0?(a(e),i.current=s):(o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{a(e),i.current=Date.now()},n)),()=>{o.current&&clearTimeout(o.current)}},[e,t]),n}(v(),2e3),ae=b(),ie=y(),oe=j(),xe=N(),pe=w(),ge=C(),je=k(),Ne=je?Dt:Ft,we=je?ft:vt,Ce=s.useMemo(()=>function(e){if("undefined"==typeof document)return e?L[950]:"#EFF0F1";const t=getComputedStyle(document.documentElement).getPropertyValue("--bg-body").trim();return t.startsWith("#")?t:e?L[950]:"#EFF0F1"}(je),[je]),ke=s.useMemo(()=>function(e){if("undefined"==typeof document)return e?L[400]:L[500];const t=getComputedStyle(document.documentElement).getPropertyValue("--text-secondary").trim();return t.startsWith("#")?t:e?L[400]:L[500]}(je),[je]),[Se,Le]=s.useState(!0),[De,Fe]=s.useState(null),[Re,Me]=s.useState(null),[He,Be]=s.useState(!1),[Pe,Ee]=s.useState(""),[ze,Te]=s.useState(!1),[$e,Ge]=s.useState(!1),[Oe,Ze]=s.useState("simulation"),[We,_e]=s.useState(!0),[qe,Ye]=s.useState(!1),[tt,st]=s.useState(!0),[nt,it]=s.useState(!1),[ot,rt]=s.useState(!1),[ct,dt]=s.useState(new Set),[ut,mt]=s.useState(!1),[bt,Mt]=s.useState("spectral"),[Et,At]=s.useState(1),[Wt,Vt]=s.useState(1),[Kt,_t]=s.useState(!1),[qt,Ut]=s.useState(null),[Xt,Yt]=s.useState(!1),[Jt,Qt]=s.useState(!1),[es,ts]=s.useState(null),[ss,ns]=s.useState(null),[as,is]=s.useState(null),[os,rs]=s.useState(null),[ls,cs]=s.useState(null),[ds,us]=s.useState(null),ms=s.useRef(!1),[hs,xs]=s.useState(!1),[ps,gs]=s.useState([]),[fs,vs]=s.useState(0),[bs,ys]=s.useState(null),js=s.useRef(new at),Ns=s.useRef(null),ws=s.useRef(null),[Cs,ks]=s.useState(null),[Ss,Ls]=s.useState(null),[Ds,Fs]=s.useState({}),[Rs,Ms]=s.useState({simulationDecay:2e4,simulationGravity:.05,simulationCenter:.05,simulationRepulsion:5,simulationRepulsionTheta:.4,simulationLinkSpring:.05,simulationLinkDistance:78,simulationFriction:.72,simulationRepulsionFromMouse:0,pointSizeScale:.4,pointOpacity:1,pointGreyoutOpacity:.1,linkWidthScale:.06,linkOpacity:.95,linkGreyoutOpacity:.1,curvedLinks:Nt,curvedLinkWeight:.8,linkDefaultArrows:wt,linkArrowsSizeScale:1.7,scalePointsOnZoom:Ct,scaleLinksOnZoom:kt,renderLinks:St,renderHoveredPointRing:Lt,spaceSize:4096}),Hs=s.useCallback((e,t)=>{Ms(s=>({...s,[e]:t}))},[]),Bs=s.useCallback(()=>{Ms({simulationDecay:2e4,simulationGravity:.05,simulationCenter:.05,simulationRepulsion:5,simulationRepulsionTheta:.4,simulationLinkSpring:.05,simulationLinkDistance:78,simulationFriction:.72,simulationRepulsionFromMouse:0,pointSizeScale:.4,pointOpacity:1,pointGreyoutOpacity:.1,linkWidthScale:.06,linkOpacity:.95,linkGreyoutOpacity:.1,curvedLinks:Nt,curvedLinkWeight:.8,linkDefaultArrows:wt,linkArrowsSizeScale:1.7,scalePointsOnZoom:Ct,scaleLinksOnZoom:kt,renderLinks:St,renderHoveredPointRing:Lt,spaceSize:4096})},[]);s.useEffect(()=>()=>{var e;try{null==(e=ws.current)||e.destroy()}catch{}ws.current=null},[]),s.useEffect(()=>{const e=e=>{var t,s;if(!(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement))switch(e.key.toLowerCase()){case"f":e.metaKey||e.ctrlKey||(e.preventDefault(),null==(t=ws.current)||t.fitView(xt));break;case"escape":ze?(Te(!1),Ee("")):De&&(Fe(null),null==(s=ws.current)||s.unselectAllPoints());break;case"/":ze||(e.preventDefault(),Te(!0),setTimeout(()=>{var e;return null==(e=Ns.current)?void 0:e.focus()},50));break;case" ":e.preventDefault(),ws.current&&(Se?ws.current.pause():ws.current.start(),Le(e=>!e));break;case"l":_e(e=>!e)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ze,De,Se]);const Ps=s.useMemo(()=>new Set((null==se?void 0:se.backboneEdges)??[]),[null==se?void 0:se.backboneEdges]),Es=s.useMemo(()=>({resolution:Et,kWeight:Wt}),[Et,Wt]),zs=s.useMemo(()=>{if("louvain"!==bt)return null;const e=null==se?void 0:se.edges;return!e||0===e.length||!ne||ne.size<3?null:Ie(e,Array.from(ne.keys()),Es).communities},[bt,null==se?void 0:se.edges,ne,Es]),As=s.useMemo(()=>{var e;if(!ne||0===ne.size||!W)return[];const t=[],s=(null==ge?void 0:ge.node_name)??(null==(e=null==ge?void 0:ge.config)?void 0:e.node_name)??null,n=je?"#171717":"#EFF0F1";let a=1;for(const i of ne.values())i.degree>a&&(a=i.degree);for(const i of ne.values()){const e=i,o=e.degree>0?Math.log10(e.degree+1)/Math.log10(a+1):0,r=5+23*Math.min(1,o),l=6*e.betweenness,c=e.isLocal?28:Math.min(34,r+l),d=(null==zs?void 0:zs.get(e.hash))??e.communityId,u=ut&&d>=0?we[d%we.length]:Ne[e.nodeClass],m=gt[e.activityLevel]??1,h=e.isLocal?Ne.local:m<1?Ht(u,n,m):u,x=e.isLocal?s??e.name:e.name;t.push({id:e.hash,label:x?`${e.prefix} ${x}`:e.prefix,color:h,size:c,nodeClass:e.nodeClass,name:x,prefix:e.prefix,packetCount:e.packetCount,isLocal:e.isLocal,isHub:e.isHub,isGateway:e.isGateway,isBackbone:e.isBackbone,isMobile:e.isMobile,isZeroHop:e.isZeroHop,isGhost:e.isGhost,degree:e.degree,betweenness:e.betweenness,communityId:(null==zs?void 0:zs.get(e.hash))??e.communityId,activityLevel:e.activityLevel,prefixConfidence:e.prefixConfidence,hasCollision:e.hasCollision,inDegree:e.inDegree,outDegree:e.outDegree,isInLoop:e.isInLoop,avgRssi:e.avgRssi,avgSnr:e.avgSnr})}for(const i of ae){const e=`ghost-${i.prefix}`;if(t.some(t=>t.id===e))continue;const s=Ht(Ne.ghost,n,.6);t.push({id:e,label:`? ${i.prefix.toUpperCase()}`,color:s,size:6,nodeClass:"ghost",name:null,prefix:i.prefix,packetCount:i.observationCount,isLocal:!1,isHub:!1,isGateway:!1,isBackbone:!1,isMobile:!1,isZeroHop:!1,isGhost:!0,degree:i.commonNeighbors.size,betweenness:0,communityId:-1,activityLevel:"active",prefixConfidence:i.confidence,hasCollision:!1,inDegree:0,outDegree:0,isInLoop:!1,avgRssi:null,avgSnr:null})}return t},[ne,W,null==ge?void 0:ge.node_name,null==(e=null==ge?void 0:ge.config)?void 0:e.node_name,Ne,je,ae,we,ut,bt,zs]),Ts=s.useMemo(()=>new Set(As.map(e=>e.id)),[As]),$s=s.useMemo(()=>{const e=new Map;if(!ne)return e;for(const t of ne.values())e.set(t.hash,t.name);return e},[ne]),Is=s.useMemo(()=>{const e=(null==se?void 0:se.edges)??[];if(!e.length||!W)return[];const t=[],s=(null==se?void 0:se.edgeBetweenness)??new Map;for(const a of e){if(!Ts.has(a.fromHash)||!Ts.has(a.toHash))continue;const e=Bt(a,Ps),n=Pt(e,a.avgConfidence,je),i=s.get(a.key)??0,o=i>0?.5+4*i:.5+2*Math.min(1,a.certainCount/50);t.push({source:a.fromHash,target:a.toHash,color:n,width:o,key:a.key,packetCount:a.packetCount,certainCount:a.certainCount,confidence:a.avgConfidence,symmetryRatio:a.symmetryRatio,dominantDirection:a.dominantDirection,isBackbone:Ps.has(a.key),isLoopEdge:a.isLoopEdge??!1,isDirectPath:a.isDirectPathEdge,isZeroHop:a.isZeroHop??!1,isGhost:!1,forwardCount:a.forwardCount,reverseCount:a.reverseCount,floodCount:a.floodCount,directCount:a.directCount,avgRssi:a.avgRssi??null,avgSnr:a.avgSnr??null,strength:a.strength,fromName:$s.get(a.fromHash)??null,toName:$s.get(a.toHash)??null,edgeType:e})}const n=je?yt:jt;for(const a of ae){const e=`ghost-${a.prefix}`;if(Ts.has(e))for(const s of a.commonNeighbors)Ts.has(s)&&t.push({source:e,target:s,color:n.ghost,width:.4,key:`ghost-${a.prefix}-${s}`,packetCount:a.observationCount,certainCount:0,confidence:a.confidence,symmetryRatio:0,dominantDirection:"balanced",isBackbone:!1,isLoopEdge:!1,isDirectPath:!1,isZeroHop:!1,isGhost:!0,forwardCount:0,reverseCount:0,floodCount:0,directCount:0,avgRssi:null,avgSnr:null,strength:a.confidence,fromName:null,toName:$s.get(s)??null,edgeType:"ghost"})}return t},[null==se?void 0:se.edges,null==se?void 0:se.edgeBetweenness,W,Ts,je,Ps,$s,ae]),Gs=null==(o=null==(t=null==ge?void 0:ge.config)?void 0:t.radio)?void 0:o.frequency,Os=null==(l=null==(r=null==ge?void 0:ge.config)?void 0:r.radio)?void 0:l.bandwidth,Zs=null==(d=null==(c=null==ge?void 0:ge.config)?void 0:c.radio)?void 0:d.spreading_factor,Ws=null==(x=null==(u=null==ge?void 0:ge.config)?void 0:u.radio)?void 0:x.tx_power,Vs=null==(T=null==(S=null==ge?void 0:ge.config)?void 0:S.radio)?void 0:T.coding_rate;s.useEffect(()=>{Jt&&!ms.current&&(ms.current=!0,(async()=>{var e,t;try{const s=await D(24);if(s.success&&(null==(t=null==(e=s.data)?void 0:e.history)?void 0:t.length)){const e=s.data.history.map(e=>e.noise_floor_dbm).filter(e=>null!=e&&e>-200&&e<0);if(e.length>0){const t=[...e].sort((e,t)=>e-t),s=t[Math.floor(t.length/2)];us(s)}}}catch{}})())},[Jt]);const Ks=s.useMemo(()=>{if(!se||!Jt)return null;const e={frequency:Gs,bandwidth:null!=as?1e3*as:Os,spreading_factor:ss??Zs,tx_power:es??Ws,coding_rate:os??Vs},t={};return null!=ls&&(t.sensitivityOverrideDbm=ls),null!=ds&&(t.observedNoiseFloorDbm=ds),function(e,t,s){const n=[],a=e.nodeMetrics,i=new Set,o=t.tx_power??22;for(const r of e.edges){if(!r.isZeroHop)continue;const e=a.get(r.fromHash),o=a.get(r.toHash);n.push(Ue(r,e,o,t,s)),i.add(r.key)}for(const r of e.edges){if(i.has(r.key))continue;if(!r.traceQuality)continue;const e=Xe(r,a.get(r.fromHash),a.get(r.toHash),t,o,s);e&&(n.push(e),i.add(r.key))}return n}(se,e,t)},[se,Jt,Gs,Os,Zs,Ws,Vs,es,ss,as,os,ls,ds]),_s=s.useMemo(()=>{if(!Ks)return null;const e=new Map;for(const t of Ks)e.set(t.edgeKey,t);return e},[Ks]),qs=s.useMemo(()=>Ks&&0!==Ks.length?function(e){const t={"anomalous-good":0,better:0,expected:0,worse:0,"anomalous-bad":0},s={excellent:0,good:0,fair:0,marginal:0,critical:0};let n=0,a=0,i=null,o=null,r=0,l=0;for(const c of e)c.hasData&&(null!=c.marginDb&&(n+=c.marginDb,a++,(!i||c.marginDb<(i.marginDb??1/0))&&(i=c),(!o||c.marginDb>(o.marginDb??-1/0))&&(o=c)),c.marginClass&&s[c.marginClass]++,null!=c.deviationDb&&c.deviationClass?(t[c.deviationClass]++,l++):r++);return{totalEdges:e.length,analyzedEdges:l,rssiOnlyEdges:r,avgMarginDb:a>0?n/a:null,worstMargin:i,bestMargin:o,deviationCounts:t,marginCounts:s,anomalousCount:t["anomalous-good"]+t["anomalous-bad"]}}(Ks):null,[Ks]),Us=s.useMemo(()=>{if(!Jt||!_s)return Is;const e=je?"#303038":"#D0D0D8";return Is.map(t=>{const s=_s.get(t.key);return s&&s.hasData?{...t,color:Qe(s,"margin"),width:et(s),linkBudget:s}:{...t,color:e,width:.3}})},[Is,Jt,_s,je]),Xs=s.useMemo(()=>0===ct.size?As:As.filter(e=>!ct.has(e.nodeClass)),[As,ct]),Ys=s.useMemo(()=>{if(0===ct.size)return Us;const e=new Set(Xs.map(e=>e.id));return Us.filter(t=>e.has(t.source)&&e.has(t.target))},[Us,Xs,ct]),Js=s.useRef([]);s.useEffect(()=>{Js.current=Ys},[Ys]);const Qs=s.useMemo(()=>{const e=new Map;for(const t of Is)e.set(t.source,(e.get(t.source)??0)+1),e.set(t.target,(e.get(t.target)??0)+1);return e},[Is]),en=s.useMemo(()=>{const e=new Map;for(const t of As)e.set(t.id,t);return e},[As]);s.useEffect(()=>{if(0===Xs.length)return ks(null),Ls(null),void Fs({});let e=!1;const t=setTimeout(async()=>{try{const t=Xs.map(e=>({id:e.id,label:e.label,color:e.color,size:e.size,communityId:String(e.communityId)})),s=Ys.map(e=>({source:e.source,target:e.target,color:e.color,width:e.width})),n={points:{pointIdBy:"id",pointColorBy:"color",pointColorStrategy:"direct",pointDefaultColor:je?"#9CA3AF":"#374151",pointLabelBy:"label",pointSizeBy:"size",pointSizeStrategy:"direct",pointDefaultSize:8,pointSizeScale:1,pointGreyoutOpacity:.3,pointIncludeColumns:["communityId"]},links:{linkSourceBy:"source",linkTargetsBy:["target"],linkColorBy:"color",linkColorStrategy:"direct",linkDefaultColor:je?"#6B7280":"#9CA3AF",linkWidthBy:"width",linkWidthStrategy:"direct",linkDefaultWidth:1,linkWidthScale:1,linkGreyoutOpacity:.1}},a=await i(n,t,s);if(e||!a)return;ks(a.points??null),Ls(a.links??null),Fs(a.cosmographConfig??{})}catch(t){}},100);return()=>{e=!0,clearTimeout(t)}},[Xs,Ys,je]);const tn=s.useCallback(e=>{e&&(ws.current=e,e.start(),setTimeout(()=>{e.fitView(xt)},1500))},[]),sn=s.useCallback(()=>{var e;null==(e=ws.current)||e.fitView(xt)},[]),nn=s.useCallback(()=>{const e=ws.current;e&&(Se?e.pause():e.start(),Le(!Se))},[Se]),an=s.useCallback(async e=>{const t=ws.current,s=en.get(e);if(s){if(t)try{const s=await t.getPointIndicesByIds([e]);s&&s.length>0&&void 0!==s[0]&&(t.zoomToPoint(s[0],400,2.5),t.selectPoint(s[0],!1,!0))}catch{}Me(null),Fe({hash:e,name:s.name,prefix:s.prefix,nodeClass:s.nodeClass,packetCount:s.packetCount,edgeCount:Qs.get(e)??0,degree:s.degree,betweenness:s.betweenness,communityId:s.communityId,isLocal:s.isLocal,isHub:s.isHub,isGateway:s.isGateway,isBackbone:s.isBackbone,isMobile:s.isMobile,isZeroHop:s.isZeroHop,isGhost:s.isGhost,isInLoop:s.isInLoop,activityLevel:s.activityLevel,prefixConfidence:s.prefixConfidence,hasCollision:s.hasCollision,inDegree:s.inDegree,outDegree:s.outDegree,avgRssi:s.avgRssi,avgSnr:s.avgSnr})}},[en,Qs]),on=s.useRef(null);s.useEffect(()=>{on.current=_s},[_s]);const rn=s.useCallback(e=>{var t;if(void 0===e)return void Me(null);const s=Js.current[e];if(!s)return;const n=null==(t=on.current)?void 0:t.get(s.key);Me(n&&!s.linkBudget?{...s,linkBudget:n}:s),Fe(null)},[]),ln=s.useCallback(async(e,t,s)=>{var n;if(void 0===e)return Fe(null),Ut(null),void(null==(n=ws.current)||n.unselectAllPoints());Me(null);const a=ws.current;if(a)try{const t=await a.getPointIdsByIndices([e]);if(!t||0===t.length)return;const s=t[0],n=en.get(s);if(!n)return;a.selectPoint(e,!1,!0),Fe({hash:s,name:n.name,prefix:n.prefix,nodeClass:n.nodeClass,packetCount:n.packetCount,edgeCount:Qs.get(s)??0,degree:n.degree,betweenness:n.betweenness,communityId:n.communityId,isLocal:n.isLocal,isHub:n.isHub,isGateway:n.isGateway,isBackbone:n.isBackbone,isMobile:n.isMobile,isZeroHop:n.isZeroHop,isGhost:n.isGhost,isInLoop:n.isInLoop,activityLevel:n.activityLevel,prefixConfidence:n.prefixConfidence,hasCollision:n.hasCollision,inDegree:n.inDegree,outDegree:n.outDegree,avgRssi:n.avgRssi,avgSnr:n.avgSnr})}catch{}},[en,Qs]),cn=s.useMemo(()=>{if(!ze||!Pe.trim())return[];const e=Pe.toLowerCase();return As.filter(t=>{var s;return t.prefix.toLowerCase().includes(e)||(null==(s=t.name)?void 0:s.toLowerCase().includes(e))||t.id.toLowerCase().includes(e)}).slice(0,8)},[As,Pe,ze]),dn=s.useCallback(e=>{Te(!1),Ee(""),an(e.id)},[an]),un=s.useCallback(()=>{Be(e=>!e)},[]),mn=s.useCallback(e=>{dt(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),hn=s.useCallback(()=>{mt(e=>{const t=!e,s=ws.current;return s&&s.start(.5),t})},[]),xn=s.useCallback(()=>{_t(e=>{const t=!e,s=ws.current;return s?(t?s.activatePolygonalSelection():(s.deactivatePolygonalSelection(),Ut(null),s.unselectAllPoints()),t):t})},[]),pn=s.useCallback(async()=>{const e=ws.current;if(!e)return;await new Promise(e=>setTimeout(e,80));const t=e.getSelectedPointIndices();if(!t||0===t.length)return void Ut(null);const s=await e.getPointIdsByIndices(t);if(!s||0===s.length)return void Ut(null);const n=new Set(s);let a=0,i=0;for(const m of Js.current)n.has(m.source)&&n.has(m.target)&&(a++,i+=m.confidence);let o=0;const r={},l={};for(const m of s){const e=en.get(m);e&&(o+=e.betweenness,r[e.communityId]=(r[e.communityId]??0)+1,l[e.nodeClass]=(l[e.nodeClass]??0)+1)}const c=new Set;for(const m of s){const e=en.get(m);e&&c.add(e.prefix.toLowerCase())}let d=0,u=0;for(const m of xe)if(m.hops.length>=2){const e=m.hops[0].toLowerCase(),t=m.hops[m.hops.length-1].toLowerCase();c.has(e)&&c.has(t)&&(d+=m.healthScore,u++)}Ut({nodeCount:s.length,edgeCount:a,avgBetweenness:s.length>0?o/s.length:0,avgConfidence:a>0?i/a:0,avgPathHealth:u>0?d/u:null,communities:r,nodeClasses:l}),Fe(null),Me(null)},[en,xe]),gn=s.useCallback(()=>{var e;Ut(null),null==(e=ws.current)||e.unselectAllPoints()},[]),fn=s.useMemo(()=>{var e;if(!De)return null;const t=De.hash,s=new Set;for(const h of Ys)h.source===t?s.add(h.target):h.target===t&&s.add(h.source);if(0===s.size)return{clusteringCoeff:0,avgNeighborBetweenness:0,neighborCount:0,avgEdgeConfidence:0,avgRssi:null,avgSnr:null};let n=0;for(const h of Ys)s.has(h.source)&&s.has(h.target)&&n++;const a=s.size,i=a>1?2*n/(a*(a-1)):0;let o=0;for(const h of s)o+=(null==(e=en.get(h))?void 0:e.betweenness)??0;let r=0,l=0,c=0,d=0,u=0,m=0;for(const h of Ys)h.source!==t&&h.target!==t||(r+=h.confidence,l++,null!=h.avgRssi&&(c+=h.avgRssi,d++),null!=h.avgSnr&&(u+=h.avgSnr,m++));return{clusteringCoeff:Math.min(1,i),avgNeighborBetweenness:o/a,neighborCount:a,avgEdgeConfidence:l>0?r/l:0,avgRssi:d>0?c/d:null,avgSnr:m>0?u/m:null}},[De,Ys,en]),vn=s.useMemo(()=>De&&pe?pe.get(De.hash)??null:null,[De,pe]),bn=s.useMemo(()=>{if(!De)return[];const e=De.hash,t=[],s=new Set;for(const n of Ys){let a=null;if(n.source===e?a=n.target:n.target===e&&(a=n.source),!a||s.has(a))continue;s.add(a);const i=en.get(a);t.push({hash:a,prefix:(null==i?void 0:i.prefix)??a.slice(2,4).toUpperCase(),name:(null==i?void 0:i.name)??null,edgeConfidence:n.confidence,edgeType:n.edgeType,avgRssi:n.avgRssi,avgSnr:n.avgSnr})}return t.sort((e,t)=>t.edgeConfidence-e.edgeConfidence),t},[De,Ys,en]),yn=s.useCallback(async()=>{const e=ws.current;if(!e||!De)return;const t=await e.getPointIndicesByIds([De.hash]);if(!t||void 0===t[0])return;const s=t[0],n=e.getConnectedPointIndices(s)??[],a=new Set([s,...n]);for(const o of n){const t=e.getConnectedPointIndices(o)??[];for(const e of t)a.add(e)}const i=Array.from(a);e.selectPoints(i),e.fitViewByIndices(i,xt,.15)},[De]);s.useEffect(()=>{if(!Kt)return;const e=e=>{var t,s;"Escape"===e.key&&(_t(!1),null==(t=ws.current)||t.deactivatePolygonalSelection(),Ut(null),null==(s=ws.current)||s.unselectAllPoints())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[Kt]);const jn=s.useCallback((e,t)=>{se&&(function(e,t){!function(e){const t=new Blob([e.content],{type:e.mimeType}),s=URL.createObjectURL(t),n=document.createElement("a");n.href=s,n.download=e.filename,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(s)}(Ae(e,t))}(se,{format:e,dataset:t}),Yt(!1))},[se]),Nn=s.useMemo(()=>{if(!se||!xe.length)return null;const e=se.edges??[];return 0===e.length?null:function(e,t,s=-137){const n=new Map;for(const o of t)n.set(o.key,o);const a=t.filter(e=>null!=e.avgRssi).length,i=[];for(const o of e){const e=lt(o,n,s);e&&i.push(e)}return i.sort((e,t)=>t.riskScore-e.riskScore),{atRiskPaths:i,criticalCount:i.filter(e=>"critical"===e.riskLevel).length,highCount:i.filter(e=>"high"===e.riskLevel).length,moderateCount:i.filter(e=>"moderate"===e.riskLevel).length,edgesAnalyzed:t.length,edgesWithSignal:a}}(xe,e)},[se,xe]),wn=s.useMemo(()=>{const e=null==se?void 0:se.edges;if(!e||0===e.length||!ne||ne.size<3)return null;const t=Array.from(ne.keys());return _(e,t)},[null==se?void 0:se.edges,ne]),Cn=s.useMemo(()=>{if("louvain"!==bt)return null;const e=null==se?void 0:se.edges;return!e||0===e.length||!ne||ne.size<3?null:Ie(e,Array.from(ne.keys()),Es)},[bt,null==se?void 0:se.edges,ne,Es]);s.useEffect(()=>{if(!se)return;const e=new Map;for(const[s,n]of se.nodeMetrics)e.set(s,n.name);const t=js.current.update(se,e);t.totalCount>0&&(gs(js.current.getLog()),vs(e=>e+t.totalCount))},[se]);const kn=s.useCallback(()=>{vs(0),xs(e=>!e)},[]),Sn=s.useMemo(()=>function(e,t){if(null==e)return null;const s=Math.max(0,e),n=s>0?(Math.log10(s)+4)/4.5:0,a=Math.round(Math.max(0,Math.min(100,100*n)));let i,o;a<10?(i="critical",o="Partition risk"):a<30?(i="poor",o="Weak connectivity"):a<55?(i="fair",o="Moderate resilience"):a<80?(i="good",o="Well connected"):(i="excellent",o="Highly resilient");const[r,l]=pt[i];return{score:a,grade:i,label:o,color:t?r:l}}(wn,je),[wn,je]),Ln=n.jsxs("div",{className:"absolute top-0 left-0 right-0 z-20 px-4 py-3 pointer-events-none flex items-start justify-between",children:[n.jsxs("h1",{className:"type-title text-fg-primary flex items-center gap-2 sm:gap-3 pointer-events-auto",children:[n.jsx(F,{className:"w-5 h-5 sm:w-6 sm:h-6 text-icon-page-title"}),n.jsx("span",{children:"MeshGraph"}),n.jsx(R,{color:"violet",compact:!0,children:"Analytics"})]}),Sn&&n.jsx(M,{content:n.jsxs("div",{className:"max-w-xs space-y-2",children:[n.jsx("div",{className:"font-semibold text-fg-primary",children:"Mesh Resilience Score"}),n.jsx("div",{className:"text-fg-secondary",children:"Derived from the Fiedler eigenvalue (λ₂) — the second-smallest eigenvalue of the graph Laplacian. Measures how well-connected the mesh is and how resistant it is to partitioning."}),n.jsxs("div",{className:"space-y-0.5 font-mono text-[10px]",children:[n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Raw λ₂"}),n.jsx("span",{className:"text-fg-primary tabular-nums",children:(null==wn?void 0:wn.toFixed(6))??"—"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Score"}),n.jsxs("span",{className:"tabular-nums",style:{color:Sn.color},children:[Sn.score,"/100"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Grade"}),n.jsx("span",{className:"capitalize",style:{color:Sn.color},children:Sn.grade})]})]}),n.jsxs("div",{className:"pt-1 border-t border-edge-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-fg-muted font-medium",children:"Grade thresholds"}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:pt.excellent[0]},children:"Excellent"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"80-100 (λ₂ > 0.3)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:pt.good[0]},children:"Good"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"55-79 (λ₂ 0.03-0.3)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:pt.fair[0]},children:"Fair"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"30-54 (λ₂ 0.003-0.03)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:pt.poor[0]},children:"Poor"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"10-29 (λ₂ 0.0001-0.003)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:pt.critical[0]},children:"Critical"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"<10 (λ₂ ≈ 0)"})]})]}),n.jsx("div",{className:"text-[10px] text-fg-muted italic",children:"Near-zero λ₂ = one bridge away from network partition. Log-scale mapping: small λ₂ changes at low values have outsized impact."})]}),children:n.jsxs("div",{className:"pointer-events-auto surface-control radius-inner px-3 py-1.5 flex items-center gap-2 cursor-help",children:[n.jsxs("div",{className:"flex items-baseline gap-1.5",children:[n.jsx("span",{className:"text-[10px] text-fg-muted uppercase tracking-wider",children:"Resilience"}),n.jsx("span",{className:"text-lg font-semibold tabular-nums leading-none",style:{color:Sn.color},children:Sn.score})]}),n.jsx("div",{className:"w-12 h-1.5 rounded-full bg-subtle-fill overflow-hidden",children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${Sn.score}%`,backgroundColor:Sn.color}})})]})})]}),Dn=(e,t=!1)=>{const s="flex flex-col items-center gap-0.5 px-1.5 py-1 radius-inner transition-all duration-100 active:scale-95";return e&&t?`${s} bg-status-warning/15 text-status-warning shadow-inner`:e?`${s} bg-sys-blue/20 text-sys-blue shadow-inner`:`${s} hover:bg-white/5 hover:scale-105 text-fg-secondary`},Fn=n.jsx("div",{className:"w-px h-6 bg-border-subtle/40 mx-0.5 shrink-0"}),Rn=n.jsxs("div",{className:"absolute top-12 right-3 z-10 flex items-center gap-0.5 surface-control radius-inner px-1.5 py-1",children:[n.jsx(M,{content:"Visible nodes / edges in the graph",children:n.jsxs("span",{className:"text-[9px] text-fg-muted tabular-nums mr-1.5 leading-none cursor-help",children:[Xs.length,n.jsx("br",{}),Ys.length]})}),Fn,n.jsx(M,{content:We?"Hide labels (L)":"Show labels (L)",children:n.jsxs("button",{onClick:()=>_e(e=>!e),className:Dn(!We,!0),children:[We?n.jsx(re,{className:"w-3.5 h-3.5"}):n.jsx(q,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Lbl"})]})}),n.jsx(M,{content:ut?"Disable clustering":"Community clustering",children:n.jsxs("button",{onClick:hn,className:Dn(ut),children:[n.jsx(ve,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Grp"})]})}),n.jsx(M,{content:Kt?"Exit lasso (Esc)":"Lasso selection",children:n.jsxs("button",{onClick:xn,className:Dn(Kt,!0),children:[n.jsx(be,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Sel"})]})}),Fn,n.jsx(M,{content:"Legend",children:n.jsxs("button",{onClick:()=>Ye(e=>!e),className:Dn(qe),children:[n.jsx(de,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Map"})]})}),n.jsx(M,{content:"Search (/)",children:n.jsxs("button",{onClick:()=>{Te(!0),setTimeout(()=>{var e;return null==(e=Ns.current)?void 0:e.focus()},50)},className:Dn(ze),children:[n.jsx(ue,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Fnd"})]})}),Fn,n.jsx(M,{content:Se?"Pause (Space)":"Play (Space)",children:n.jsxs("button",{onClick:nn,className:Dn(!Se),children:[Se?n.jsx(H,{className:"w-3.5 h-3.5 text-sys-green"}):n.jsx(B,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:Se?"Run":"Stop"})]})}),n.jsx(M,{content:"Fit view (F)",children:n.jsxs("button",{onClick:sn,className:Dn(!1),children:[n.jsx(fe,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Fit"})]})}),Fn,n.jsx(M,{content:Jt?"Disable link budget":"Link budget overlay",children:n.jsxs("button",{onClick:()=>Qt(e=>!e),className:Dn(Jt),children:[n.jsx(P,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"RF"})]})}),n.jsx(M,{content:"Anomaly log",children:n.jsxs("button",{onClick:kn,className:`relative ${Dn(hs,!0)}`,children:[n.jsx(le,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Alert"}),fs>0&&n.jsx("span",{className:"absolute -top-1 -right-0.5 w-3 h-3 rounded-full bg-status-danger text-[7px] font-bold text-white flex items-center justify-center",children:fs>9?"9+":fs})]})}),n.jsx(M,{content:"Export topology",children:n.jsxs("button",{onClick:()=>Yt(e=>!e),className:Dn(Xt),children:[n.jsx(te,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Exp"})]})}),n.jsx(M,{content:"Settings",children:n.jsxs("button",{onClick:()=>Ge(e=>!e),className:Dn($e),children:[n.jsx(me,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Cfg"})]})}),Fn,n.jsx(M,{content:He?"Exit fullscreen":"Fullscreen",children:n.jsxs("button",{onClick:un,className:Dn(He),children:[He?n.jsx(U,{className:"w-3.5 h-3.5"}):n.jsx(K,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Max"})]})})]}),Mn=n.jsxs(ht,{id:"settings",title:"Graph Settings",icon:n.jsx(me,{}),open:$e,onClose:()=>Ge(!1),defaultPosition:{x:"undefined"!=typeof window?window.innerWidth-308:600,y:60},defaultSize:{width:288,height:420},minSize:{width:260,height:200},maxSize:{width:400,height:600},headerActions:n.jsx(M,{content:"Reset to defaults",children:n.jsx("button",{onClick:Bs,className:"p-0.5 radius-badge hover-bg transition-base",children:n.jsx(ye,{className:"w-2.5 h-2.5 text-fg-muted"})})}),children:[n.jsx("div",{className:"flex border-b border-edge-subtle",children:["simulation","points","links","rendering"].map(e=>n.jsx("button",{onClick:()=>Ze(e),className:"flex-1 px-2 py-1.5 text-[10px] font-medium capitalize transition-colors "+(Oe===e?"text-sys-blue border-b-2 border-sys-blue":"text-fg-muted hover:text-fg-secondary"),children:e},e))}),n.jsxs("div",{className:"p-3 space-y-3",children:["simulation"===Oe&&n.jsxs(n.Fragment,{children:[n.jsx(Ot,{label:"Gravity",value:Rs.simulationGravity,onChange:e=>Hs("simulationGravity",e),min:0,max:1,step:.01}),n.jsx(Ot,{label:"Repulsion",value:Rs.simulationRepulsion,onChange:e=>Hs("simulationRepulsion",e),min:0,max:5,step:.1}),n.jsx(Ot,{label:"Link Spring",value:Rs.simulationLinkSpring,onChange:e=>Hs("simulationLinkSpring",e),min:0,max:2,step:.05}),n.jsx(Ot,{label:"Link Distance",value:Rs.simulationLinkDistance,onChange:e=>Hs("simulationLinkDistance",e),min:1,max:100,step:1}),n.jsx(Ot,{label:"Friction",value:Rs.simulationFriction,onChange:e=>Hs("simulationFriction",e),min:0,max:1,step:.01}),n.jsx(Ot,{label:"Center Force",value:Rs.simulationCenter,onChange:e=>Hs("simulationCenter",e),min:0,max:1,step:.01}),n.jsx(Ot,{label:"Decay",value:Rs.simulationDecay,onChange:e=>Hs("simulationDecay",e),min:100,max:2e4,step:100}),n.jsx(Ot,{label:"Repulsion Theta",value:Rs.simulationRepulsionTheta,onChange:e=>Hs("simulationRepulsionTheta",e),min:.1,max:3,step:.05}),n.jsx(Ot,{label:"Mouse Repulsion",value:Rs.simulationRepulsionFromMouse,onChange:e=>Hs("simulationRepulsionFromMouse",e),min:0,max:10,step:.5})]}),"points"===Oe&&n.jsxs(n.Fragment,{children:[n.jsx(Ot,{label:"Size Scale",value:Rs.pointSizeScale,onChange:e=>Hs("pointSizeScale",e),min:.1,max:5,step:.1}),n.jsx(Ot,{label:"Opacity",value:Rs.pointOpacity,onChange:e=>Hs("pointOpacity",e),min:0,max:1,step:.05}),n.jsx(Ot,{label:"Greyout Opacity",value:Rs.pointGreyoutOpacity,onChange:e=>Hs("pointGreyoutOpacity",e),min:0,max:1,step:.05}),n.jsx(Zt,{label:"Scale on Zoom",checked:Rs.scalePointsOnZoom,onChange:e=>Hs("scalePointsOnZoom",e)}),n.jsx(Zt,{label:"Hover Ring",checked:Rs.renderHoveredPointRing,onChange:e=>Hs("renderHoveredPointRing",e)})]}),"links"===Oe&&n.jsxs(n.Fragment,{children:[n.jsx(Zt,{label:"Show Links",checked:Rs.renderLinks,onChange:e=>Hs("renderLinks",e)}),n.jsx(Zt,{label:"Curved Links",checked:Rs.curvedLinks,onChange:e=>Hs("curvedLinks",e)}),n.jsx(Zt,{label:"Show Arrows",checked:Rs.linkDefaultArrows,onChange:e=>Hs("linkDefaultArrows",e)}),n.jsx(Ot,{label:"Width Scale",value:Rs.linkWidthScale,onChange:e=>Hs("linkWidthScale",e),min:.1,max:5,step:.1}),n.jsx(Ot,{label:"Opacity",value:Rs.linkOpacity,onChange:e=>Hs("linkOpacity",e),min:0,max:1,step:.05}),n.jsx(Ot,{label:"Greyout Opacity",value:Rs.linkGreyoutOpacity,onChange:e=>Hs("linkGreyoutOpacity",e),min:0,max:1,step:.05}),Rs.curvedLinks&&n.jsx(Ot,{label:"Curve Weight",value:Rs.curvedLinkWeight,onChange:e=>Hs("curvedLinkWeight",e),min:0,max:1,step:.05}),Rs.linkDefaultArrows&&n.jsx(Ot,{label:"Arrow Size",value:Rs.linkArrowsSizeScale,onChange:e=>Hs("linkArrowsSizeScale",e),min:.1,max:3,step:.1}),n.jsx(Zt,{label:"Scale on Zoom",checked:Rs.scaleLinksOnZoom,onChange:e=>Hs("scaleLinksOnZoom",e)})]}),"rendering"===Oe&&n.jsxs(n.Fragment,{children:[n.jsx(Ot,{label:"Space Size",value:Rs.spaceSize,onChange:e=>Hs("spaceSize",e),min:1024,max:16384,step:512}),n.jsx("div",{className:"pt-2 border-t border-edge-subtle/50",children:n.jsx("p",{className:"text-[9px] text-fg-muted",children:"Space size defines the simulation boundary. Larger values allow more spread."})})]})]})]}),Hn=n.jsxs(ht,{id:"export",title:"Export Topology",icon:n.jsx(te,{}),open:Xt,onClose:()=>Yt(!1),defaultPosition:{x:"undefined"!=typeof window?window.innerWidth-280:600,y:100},defaultSize:{width:256,height:320},minSize:{width:220,height:150},autoHeight:!0,children:[n.jsx("div",{className:"py-1",children:[{label:"Full Topology (JSON)",format:"json",dataset:"full",desc:"All data: nodes, edges, paths, TX delay"},{label:"Gephi Graph (GEXF)",format:"gexf",dataset:"full",desc:"Import into Gephi for advanced analysis"},{label:"Nodes (CSV)",format:"csv",dataset:"nodes",desc:"Node metrics: centrality, class, signal"},{label:"Edges (CSV)",format:"csv",dataset:"edges",desc:"Edge metrics: confidence, symmetry, type"},{label:"Path Health (CSV)",format:"csv",dataset:"pathHealth",desc:"Route health scores and trends"},{label:"TX Delay (CSV)",format:"csv",dataset:"txDelay",desc:"TX delay recommendations per node"}].map(({label:e,format:t,dataset:s,desc:a})=>n.jsxs("button",{onClick:()=>jn(t,s),className:"w-full flex flex-col px-3 py-2 text-left hover-bg transition-base",children:[n.jsx("span",{className:"text-[11px] font-medium text-fg-primary",children:e}),n.jsx("span",{className:"text-[9px] text-fg-muted",children:a})]},`${t}-${s}`))}),n.jsx("div",{className:"px-3 py-1.5 border-t border-edge-subtle",children:n.jsxs("span",{className:"text-[9px] text-fg-muted",children:[(null==($=null==se?void 0:se.nodeMetrics)?void 0:$.size)??0," nodes · ",(null==(I=null==se?void 0:se.validatedEdges)?void 0:I.length)??0," edges"]})})]}),Bn={info:{dot:"bg-sys-blue",text:"text-fg-secondary"},warning:{dot:"bg-status-warning",text:"text-status-warning"},critical:{dot:"bg-status-danger",text:"text-status-danger"}},Pn={"edge-appeared":"Link Discovered","edge-disappeared":"Link Lost","ghost-appeared":"Ghost Discovered","ghost-disappeared":"Ghost Resolved","betweenness-shift":"Traffic Rerouting","community-change":"Community Change","class-change":"Role Change","node-appeared":"Node Appeared","node-disappeared":"Node Dropped"},En=(e,t,s)=>null==t||""===t?null:n.jsxs("div",{className:"flex justify-between gap-2",children:[n.jsx("span",{className:"text-fg-muted",children:e}),n.jsx("span",{className:`tabular-nums text-right ${s??"text-fg-secondary"}`,children:t})]}),zn=e=>{const t=[];return e.isZeroHop&&t.push({label:"Zero-Hop",color:"text-status-warning"}),e.isDirectPath&&t.push({label:"Direct",color:"text-sys-blue"}),e.isBackbone&&t.push({label:"Backbone",color:"text-fg-primary"}),e.isLoop&&t.push({label:"Loop",color:"text-sys-indigo"}),0===t.length?null:n.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.map(e=>n.jsx("span",{className:`text-[8px] font-medium uppercase tracking-wider px-1 py-px radius-badge bg-subtle-fill ${e.color}`,children:e.label},e.label))})},An=e=>n.jsxs("div",{className:"text-[9px] space-y-0.5",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"capitalize font-medium text-fg-secondary",children:e.nodeClass}),e.isZeroHop&&n.jsx("span",{className:"text-[8px] font-medium uppercase tracking-wider px-1 py-px radius-badge bg-subtle-fill text-status-warning",children:"Neighbor"})]}),En("Degree",e.degree),e.betweenness>.01&&En("Betweenness",e.betweenness.toFixed(3)),En("Packets",e.packetCount),En("Community",`#${e.communityId}`),En("Activity",e.activityLevel),null!=e.avgRssi&&En("RSSI",`${e.avgRssi.toFixed(0)} dBm`),null!=e.avgSnr&&En("SNR",`${e.avgSnr.toFixed(1)} dB`)]}),Tn=e=>n.jsxs("div",{className:"text-[9px] space-y-0.5",children:[null!=e.previousValue&&null!=e.currentValue&&n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-fg-muted font-mono",children:"number"==typeof e.previousValue?e.previousValue.toFixed(3):e.previousValue}),n.jsx("span",{className:"text-fg-muted/40",children:"→"}),n.jsx("span",{className:"text-fg-secondary font-mono",children:"number"==typeof e.currentValue?e.currentValue.toFixed(3):e.currentValue}),"number"==typeof e.previousValue&&"number"==typeof e.currentValue&&n.jsxs("span",{className:e.currentValue>e.previousValue?"text-sys-green":"text-signal-poor",children:["(",e.currentValue>e.previousValue?"+":"",(e.currentValue-e.previousValue).toFixed(3),")"]})]}),e.nodeDetail&&n.jsxs(n.Fragment,{children:[En("Class",e.nodeDetail.nodeClass),En("Degree",e.nodeDetail.degree),e.nodeDetail.betweenness>.01&&En("Betweenness",e.nodeDetail.betweenness.toFixed(3))]})]}),$n=s.useCallback(e=>{ys(t=>t===e?null:e)},[]),In=n.jsxs(ht,{id:"anomaly",title:"Anomaly Log",icon:n.jsx(le,{}),open:hs,onClose:()=>xs(!1),defaultPosition:{x:"undefined"!=typeof window?window.innerWidth-328:600,y:100},defaultSize:{width:308,height:400},minSize:{width:260,height:180},maxSize:{width:440,height:700},headerActions:ps.length>0?n.jsx("button",{onClick:()=>{js.current.clear(),gs([]),ys(null)},className:"p-0.5 radius-badge hover-bg transition-base",title:"Clear all",children:n.jsx(ye,{className:"w-2.5 h-2.5 text-fg-muted"})}):void 0,children:[0===ps.length?n.jsxs("div",{className:"px-3 py-6 text-center",children:[n.jsx(le,{className:"w-5 h-5 text-fg-muted mx-auto mb-1.5"}),n.jsx("p",{className:"text-[11px] text-fg-muted",children:"No anomalies detected yet"}),n.jsx("p",{className:"text-[9px] text-fg-muted/60 mt-0.5",children:"Changes appear after topology recomputes"})]}):n.jsx("div",{className:"overflow-y-auto",children:ps.slice(0,50).map(e=>{const t=Bn[e.severity],s=E(e.detectedAt/1e3),a=bs===e.id,i=!(!e.edgeDetail&&!e.nodeDetail&&null==e.previousValue);return n.jsxs("div",{className:`border-b border-edge-subtle/50 last:border-0 transition-colors ${i?"cursor-pointer hover-bg":""} ${a?"bg-subtle-fill/50":""}`,onClick:i?()=>$n(e.id):void 0,children:[n.jsxs("div",{className:"flex items-start gap-2 px-3 py-1.5",children:[n.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 mt-1.5 ${t.dot}`}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("p",{className:`text-[10px] leading-tight ${t.text}`,children:e.description}),n.jsxs("p",{className:"text-[9px] text-fg-muted/60 mt-0.5",children:[Pn[e.category]??e.category," · ",s]})]}),i&&n.jsx(z,{className:"w-3 h-3 text-fg-muted/40 shrink-0 mt-0.5 transition-transform duration-150 "+(a?"rotate-180":"")})]}),a&&n.jsx("div",{className:"px-3 pb-2 pl-6",children:n.jsxs("div",{className:"border-l-2 border-edge-subtle/60 pl-2 py-0.5",children:[e.edgeDetail&&(o=e.edgeDetail,r=e.category,n.jsxs("div",{className:"text-[9px] space-y-0.5",children:[(o.fromClass||o.toClass)&&n.jsxs("div",{className:"flex items-center gap-1 text-fg-muted",children:[n.jsx("span",{className:"capitalize",children:o.fromClass??"?"}),n.jsx("span",{className:"text-fg-muted/40",children:"↔"}),n.jsx("span",{className:"capitalize",children:o.toClass??"?"})]}),"edge-appeared"===r&&o.packetCount>0&&n.jsxs(n.Fragment,{children:[En("Packets",o.packetCount),En("Confidence",`${(100*o.confidence).toFixed(0)}%`,o.confidence>=.8?"text-sys-green":o.confidence>=.5?"text-sys-indigo":"text-signal-poor"),En("Symmetry",`${(100*o.symmetryRatio).toFixed(0)}%`)]}),o.isZeroHop&&null!=o.avgRssi&&En("RSSI",`${o.avgRssi.toFixed(0)} dBm`),o.isZeroHop&&null!=o.avgSnr&&En("SNR",`${o.avgSnr.toFixed(1)} dB`),null!=o.fromBetweenness&&o.fromBetweenness>.01&&En(`${o.fromName??"A"} centrality`,o.fromBetweenness.toFixed(3)),null!=o.toBetweenness&&o.toBetweenness>.01&&En(`${o.toName??"B"} centrality`,o.toBetweenness.toFixed(3)),zn(o)]})),e.nodeDetail&&!e.edgeDetail&&("node-appeared"===e.category||"node-disappeared"===e.category)&&An(e.nodeDetail),("betweenness-shift"===e.category||"community-change"===e.category||"class-change"===e.category)&&Tn(e)]})})]},e.id);var o,r})}),ps.length>0&&n.jsx("div",{className:"px-3 py-1.5 border-t border-edge-subtle",children:n.jsxs("span",{className:"text-[9px] text-fg-muted",children:[ps.length," total · showing ",Math.min(ps.length,50)]})})]}),Gn=s.useMemo(()=>{const e={};for(const t of Is)e[t.edgeType]=(e[t.edgeType]??0)+1;return e},[Is]),On=n.jsxs(ht,{id:"legend",title:"Legend",icon:n.jsx(de,{}),open:qe,onClose:()=>Ye(!1),defaultPosition:{x:12,y:60},defaultSize:{width:224,height:400},minSize:{width:200,height:150},maxSize:{width:360,height:700},autoHeight:!0,children:[n.jsxs("div",{className:"border-b border-edge-subtle",children:[n.jsxs("button",{onClick:()=>st(e=>!e),className:"w-full flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-medium text-fg-secondary hover-bg transition-base",children:[tt?n.jsx(z,{className:"w-3 h-3"}):n.jsx(he,{className:"w-3 h-3"}),"Nodes",n.jsx("span",{className:"text-fg-muted ml-auto tabular-nums",children:Xs.length})]}),tt&&n.jsx("div",{className:"px-2 pb-2 space-y-0.5",children:[["local","Local"],["hub","Hub"],["gateway","Gateway"],["backbone","Backbone"],["neighbor","Neighbor"],["mobile","Mobile"],["ghost","Ghost"],["standard","Standard"]].map(([e,t])=>{const s=ie[e]??0;if(0===s&&"local"!==e)return null;const a=ct.has(e);return n.jsx(M,{content:Rt[e],children:n.jsxs("button",{onClick:()=>mn(e),className:"w-full flex items-center gap-2 px-2 py-1 radius-badge transition-base text-left "+(a?"opacity-40":"hover-bg"),children:[n.jsx("span",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:Ne[e]}}),n.jsx("span",{className:"text-[10px] text-fg-secondary flex-1",children:t}),n.jsx("span",{className:"text-[10px] text-fg-muted tabular-nums",children:s})]})},e)})})]}),n.jsxs("div",{className:"border-b border-edge-subtle",children:[n.jsxs("button",{onClick:()=>it(e=>!e),className:"w-full flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-medium text-fg-secondary hover-bg transition-base",children:[nt?n.jsx(z,{className:"w-3 h-3"}):n.jsx(he,{className:"w-3 h-3"}),"Edges",n.jsx("span",{className:"text-fg-muted ml-auto tabular-nums",children:Ys.length})]}),nt&&n.jsx("div",{className:"px-2 pb-2 space-y-0.5",children:[{type:"zero-hop",label:"Zero-Hop RF"},{type:"direct-path",label:"Direct Path"},{type:"loop",label:"Loop"},{type:"backbone",label:"Backbone"},{type:"standard",label:"Standard"},{type:"ghost",label:"Ghost"}].map(({type:e,label:t})=>{const s=Gn[e]??0;if(0===s)return null;const a=Pt(e,.8,je);return n.jsx(M,{content:zt[e],children:n.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 cursor-help",children:[n.jsx("span",{className:"w-4 h-0.5 shrink-0 rounded-full",style:{backgroundColor:a}}),n.jsx("span",{className:"text-[10px] text-fg-secondary flex-1",children:t}),n.jsx("span",{className:"text-[10px] text-fg-muted tabular-nums",children:s})]})},e)})})]}),Jt&&qs&&n.jsxs("div",{className:"border-b border-edge-subtle",children:[n.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-medium text-sys-green flex items-center gap-1.5",children:[n.jsx(P,{className:"w-3 h-3"}),"Link Budget",n.jsxs("span",{className:"text-fg-muted ml-auto tabular-nums",children:[qs.analyzedEdges+qs.rssiOnlyEdges,"/",qs.totalEdges]})]}),n.jsxs("div",{className:"px-3 pb-2 space-y-0.5",children:[(()=>{const e=Gs&&Gs>1e5?Gs/1e6:Gs||915,t=ss??Zs??12,s=as??(Os&&Os>1e3?Os/1e3:Os||125),a=os??Vs??5,i=es??Ws??22,o=Ve(t,s,a),r=ls??o,l=Ke(1e3*s),c=ds??l,d=(null==Ks?void 0:Ks.filter(e=>e.isTraceEstimated).length)??0,u=(null==Ks?void 0:Ks.filter(e=>e.isZeroHop).length)??0,m=null!=es||null!=ss||null!=as||null!=os||null!=ls,h="w-10 px-1 py-0 text-[10px] text-right tabular-nums bg-subtle-fill border border-edge-subtle rounded text-fg-secondary focus:outline-none focus:border-sys-blue";return n.jsxs("div",{className:"pb-1 mb-1 border-b border-edge-subtle space-y-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx("span",{className:"text-fg-muted",children:"Frequency"}),n.jsxs("span",{className:"text-fg-secondary tabular-nums",children:[e.toFixed(3)," MHz"]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-fg-muted",children:"SF"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("select",{value:t,onChange:e=>{const t=parseInt(e.target.value,10);ns(t===(Zs??12)?null:t)},className:h+" w-12 appearance-none",children:[7,8,9,10,11,12].map(e=>n.jsxs("option",{value:e,children:["SF",e]},e))}),null!=ss&&n.jsx("button",{onClick:()=>ns(null),className:"text-[8px] text-sys-blue hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-fg-muted",children:"BW"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("select",{value:s,onChange:e=>{const t=parseFloat(e.target.value);is(t===(Os&&Os>1e3?Os/1e3:Os||125)?null:t)},className:h+" w-14 appearance-none",children:[62.5,125,250,500].map(e=>n.jsxs("option",{value:e,children:[e," kHz"]},e))}),null!=as&&n.jsx("button",{onClick:()=>is(null),className:"text-[8px] text-sys-blue hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-fg-muted",children:"CR"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("select",{value:a,onChange:e=>{const t=parseInt(e.target.value,10);rs(t===(Vs??5)?null:t)},className:h+" w-12 appearance-none",children:[5,6,7,8].map(e=>n.jsxs("option",{value:e,children:["4/",e]},e))}),null!=os&&n.jsx("button",{onClick:()=>rs(null),className:"text-[8px] text-sys-blue hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-fg-muted",children:"TX Power"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("input",{type:"number",min:1,max:36,step:1,value:i,onChange:e=>{const t=parseInt(e.target.value,10);isNaN(t)||ts(t)},onBlur:e=>{const t=parseInt(e.target.value,10);isNaN(t)?ts(null):ts(Math.max(1,Math.min(36,t)))},className:h}),n.jsx("span",{className:"text-fg-muted",children:"dBm"}),null!=es&&n.jsx("button",{onClick:()=>ts(null),className:"text-[8px] text-sys-blue hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-fg-muted",children:"Sensitivity"}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("input",{type:"number",min:-150,max:-80,step:.5,value:Math.round(10*r)/10,onChange:e=>{const t=parseFloat(e.target.value);isNaN(t)||cs(t)},onBlur:e=>{const t=parseFloat(e.target.value);isNaN(t)?cs(null):cs(Math.max(-150,Math.min(-80,t)))},className:h+" w-12"}),n.jsx("span",{className:"text-fg-muted",children:"dBm"}),null!=ls&&n.jsx("button",{onClick:()=>cs(null),className:"text-[8px] text-sys-blue hover:underline",title:"Reset",children:"↺"})]})]}),d>0&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx("span",{className:"text-fg-muted",children:"Noise Floor"}),n.jsxs("span",{className:"text-fg-secondary tabular-nums "+(null!=ds?"":"italic text-fg-muted"),children:[c.toFixed(1)," dBm",null!=ds?"":" (est.)"]})]}),m&&n.jsx("button",{onClick:()=>{ts(null),ns(null),is(null),rs(null),cs(null)},className:"w-full text-[9px] text-sys-blue hover:underline text-center pt-0.5",children:"Reset all to radio config"}),(u>0||d>0)&&n.jsxs("div",{className:"flex items-center justify-between text-[10px] pt-0.5",children:[n.jsx("span",{className:"text-fg-muted",children:"Sources"}),n.jsxs("span",{className:"text-fg-secondary tabular-nums",children:[u>0&&n.jsxs("span",{children:[u," direct"]}),u>0&&d>0&&n.jsx("span",{className:"text-fg-muted",children:" · "}),d>0&&n.jsxs("span",{className:"text-sys-indigo",children:[d," trace"]})]})]})]})})(),null!=qs.avgMarginDb&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx("span",{className:"text-fg-muted",children:"Avg Margin"}),n.jsxs("span",{className:"text-fg-secondary tabular-nums",children:[qs.avgMarginDb>0?"+":"",qs.avgMarginDb.toFixed(1)," dB"]})]}),["excellent","good","fair","marginal","critical"].map(e=>{const t=qs.marginCounts[e];return 0===t?null:n.jsxs("div",{className:"flex items-center gap-2 px-1 py-0.5",children:[n.jsx("span",{className:"w-3 h-0.5 shrink-0 rounded-full",style:{backgroundColor:Je[e]}}),n.jsx("span",{className:"text-[10px] text-fg-secondary flex-1 capitalize",children:e}),n.jsx("span",{className:"text-[10px] text-fg-muted tabular-nums",children:t})]},e)}),qs.anomalousCount>0&&n.jsxs("div",{className:"flex items-center justify-between text-[10px] pt-0.5",children:[n.jsx("span",{className:"text-status-warning",children:"Anomalous"}),n.jsx("span",{className:"text-status-warning tabular-nums",children:qs.anomalousCount})]})]})]}),Nn&&Nn.atRiskPaths.length>0&&n.jsxs("div",{className:"border-b border-edge-subtle",children:[n.jsxs("div",{className:"flex items-center",children:[n.jsxs("button",{onClick:()=>rt(e=>!e),className:"flex-1 flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-medium text-status-warning hover-bg transition-base",children:[ot?n.jsx(z,{className:"w-3 h-3"}):n.jsx(he,{className:"w-3 h-3"}),"At-Risk Paths",n.jsxs("span",{className:"text-fg-muted ml-auto tabular-nums",children:[Nn.criticalCount>0&&n.jsxs("span",{className:"text-status-danger",children:[Nn.criticalCount,"c"]}),Nn.criticalCount>0&&Nn.highCount>0&&" ",Nn.highCount>0&&n.jsxs("span",{className:"text-status-warning",children:[Nn.highCount,"h"]}),(Nn.criticalCount>0||Nn.highCount>0)&&Nn.moderateCount>0&&" ",Nn.moderateCount>0&&n.jsxs("span",{className:"text-fg-muted",children:[Nn.moderateCount,"m"]})]})]}),n.jsx(M,{content:n.jsxs("div",{className:"max-w-xs space-y-1.5",children:[n.jsx("div",{className:"font-semibold text-fg-primary",children:"Predictive Path Failure"}),n.jsx("div",{className:"text-fg-secondary text-[11px]",children:"Identifies paths at risk of failure by combining four weighted factors. Paths below the moderate threshold (35%) are not shown."}),n.jsxs("div",{className:"pt-1 border-t border-edge-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-fg-muted font-medium",children:"Factor weights"}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-secondary",children:"Declining usage"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"35%"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-secondary",children:"Weak link certainty"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"30%"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-secondary",children:"No alternate paths"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"20%"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-secondary",children:"Low signal margin"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"15%"})]})]}),n.jsxs("div",{className:"pt-1 border-t border-edge-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-fg-muted font-medium",children:"Risk thresholds"}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-status-danger",children:"Critical"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"≥75% — failure likely imminent"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-status-warning",children:"High"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"55-74% — significant risk"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Moderate"}),n.jsx("span",{className:"text-fg-muted tabular-nums",children:"35-54% — worth monitoring"})]})]}),n.jsxs("div",{className:"pt-1 border-t border-edge-subtle/30 text-[10px] text-fg-muted font-mono space-y-0.5",children:[n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{children:"Edges analyzed"}),n.jsx("span",{className:"tabular-nums",children:Nn.edgesAnalyzed})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{children:"With signal data"}),n.jsx("span",{className:"tabular-nums",children:Nn.edgesWithSignal})]})]})]}),children:n.jsx("span",{className:"px-2 py-1.5 text-fg-muted cursor-help",children:n.jsx(le,{className:"w-3 h-3"})})})]}),ot&&n.jsx("div",{className:"px-2 pb-2 space-y-1",children:Nn.atRiskPaths.slice(0,8).map(e=>{const t="critical"===e.riskLevel?"#EF4444":"high"===e.riskLevel?"#F97316":"#FBBF24",s="imminent"===e.urgency?"IMM":"near-term"===e.urgency?"NEAR":"WATCH";return n.jsx(M,{content:n.jsxs("div",{className:"max-w-xs space-y-1.5",children:[n.jsx("div",{className:"font-semibold text-fg-primary font-mono text-[11px]",children:e.hops.join(" → ")}),n.jsxs("div",{className:"space-y-0.5 text-[10px]",children:[n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Risk score"}),n.jsxs("span",{className:"font-semibold tabular-nums",style:{color:t},children:[(100*e.riskScore).toFixed(1),"%"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Health score"}),n.jsxs("span",{className:"text-fg-primary tabular-nums",children:[(100*e.healthScore).toFixed(0),"%"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Obs. trend"}),n.jsxs("span",{className:"tabular-nums "+(e.observationTrend<0?"text-status-danger":"text-fg-secondary"),children:[e.observationTrend>0?"+":"",e.observationTrend.toFixed(3)]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Alt. paths"}),n.jsx("span",{className:"tabular-nums "+(0===e.alternatePathsCount?"text-status-danger":"text-fg-secondary"),children:e.alternatePathsCount})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-muted",children:"Urgency"}),n.jsx("span",{className:"capitalize",style:{color:t},children:e.urgency})]})]}),e.factors.length>0&&n.jsxs("div",{className:"pt-1 border-t border-edge-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-fg-muted font-medium",children:"Contributing factors"}),e.factors.map((e,t)=>n.jsxs("div",{className:"space-y-0.5",children:[n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-fg-secondary",children:e.name}),n.jsxs("span",{className:"text-fg-muted tabular-nums",children:[(e.score*e.weight*100).toFixed(1),"% (",(100*e.weight).toFixed(0),"w × ",(100*e.score).toFixed(0),"s)"]})]}),n.jsx("div",{className:"text-fg-muted pl-1",children:e.description})]},t))]})]}),children:n.jsxs("div",{className:"px-2 py-1 radius-badge bg-subtle-fill/30 cursor-help",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:t}}),n.jsx("span",{className:"text-[10px] text-fg-secondary font-mono truncate flex-1",children:e.hops.join(" → ")}),n.jsx("span",{className:"text-[8px] uppercase tracking-wide px-1 py-px radius-badge",style:{backgroundColor:`${t}20`,color:t},children:s}),n.jsxs("span",{className:"text-[10px] tabular-nums font-semibold",style:{color:t},children:[(100*e.riskScore).toFixed(0),"%"]})]}),n.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5 pl-3",children:e.factors.map((t,s)=>n.jsxs("span",{className:"text-[8px] text-fg-muted",children:[t.name," (",(t.score*t.weight*100).toFixed(0),"%)",sMt(e=>"spectral"===e?"louvain":"spectral"),className:"text-sys-blue hover:underline cursor-pointer",children:"spectral"===bt?"Spectral":"Louvain"})]}),"louvain"===bt&&Cn&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(M,{content:"Louvain modularity score — quality of community partition (higher = better defined communities)",children:n.jsx("span",{className:"text-fg-muted cursor-help",children:"Modularity Q"})}),n.jsx("span",{className:"text-fg-secondary tabular-nums",children:Cn.modularity.toFixed(4)})]}),"louvain"===bt&&n.jsxs("div",{className:"mt-1.5 pt-1.5 border-t border-edge-subtle space-y-1.5",children:[n.jsx(Ot,{label:"Resolution γ",value:Et,onChange:At,min:.01,max:5,step:.01}),n.jsx(Ot,{label:"K-weight",value:Wt,onChange:Vt,min:.01,max:5,step:.01}),(1!==Et||1!==Wt)&&n.jsx("button",{onClick:()=>{At(1),Vt(1)},className:"w-full text-[10px] text-sys-blue hover:underline text-center",children:"Reset defaults"})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(M,{content:"Redundant path cycles in the topology — indicates alternate routing options",children:n.jsx("span",{className:"text-fg-muted cursor-help",children:"Loops"})}),n.jsx("span",{className:"text-fg-secondary tabular-nums",children:(null==(G=null==se?void 0:se.loops)?void 0:G.length)??0})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(M,{content:"High-betweenness edges that carry disproportionate traffic flow",children:n.jsx("span",{className:"text-fg-muted cursor-help",children:"Backbone"})}),n.jsx("span",{className:"text-fg-secondary tabular-nums",children:(null==(O=null==se?void 0:se.backboneEdges)?void 0:O.length)??0})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(M,{content:"Unresolved prefix nodes inferred by Viterbi HMM from repeated path patterns",children:n.jsx("span",{className:"text-fg-muted cursor-help",children:"Ghosts"})}),n.jsx("span",{className:"text-fg-secondary tabular-nums",children:ae.length})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(M,{content:"Community-aware node coloring — groups nodes by cluster assignment",children:n.jsx("span",{className:"text-fg-muted cursor-help",children:"Clustering"})}),n.jsx("span",{className:"tabular-nums "+(ut?"text-sys-blue":"text-fg-muted"),children:ut?"On":"Off"})]}),null!=wn&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(M,{content:"Algebraic connectivity — 2nd-smallest eigenvalue of the graph Laplacian. Near-zero = one bridge from network partition.",children:n.jsx("span",{className:"text-fg-muted cursor-help",children:"Fiedler λ₂"})}),n.jsx("span",{className:"tabular-nums "+(wn<.01?"text-status-warning":"text-fg-secondary"),children:wn.toFixed(4)})]}),ct.size>0&&n.jsxs("button",{onClick:()=>dt(new Set),className:"w-full mt-1 text-[10px] text-sys-blue hover:underline text-center",children:["Clear filters (",ct.size,")"]})]})]}),Zn=n.jsx(m,{children:ze&&n.jsx(h.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15},className:"absolute top-4 left-1/2 -translate-x-1/2 z-30 w-80",children:n.jsxs("div",{className:"surface-elevated radius-inset shadow-2xl overflow-hidden",children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-edge-subtle",children:[n.jsx(ue,{className:"w-4 h-4 text-fg-muted shrink-0"}),n.jsx("input",{ref:Ns,type:"text",value:Pe,onChange:e=>Ee(e.target.value),placeholder:"Search by name or prefix...",className:"flex-1 bg-transparent text-sm text-fg-primary placeholder:text-fg-muted focus:outline-none",onKeyDown:e=>{"Escape"===e.key?(Te(!1),Ee("")):"Enter"===e.key&&cn.length>0&&dn(cn[0])}}),Pe&&n.jsx("button",{onClick:()=>Ee(""),className:"p-0.5 radius-badge hover-bg transition-base",children:n.jsx(p,{className:"w-3 h-3 text-fg-muted"})})]}),cn.length>0&&n.jsx("div",{className:"max-h-64 overflow-y-auto",children:cn.map((e,t)=>n.jsxs("button",{onClick:()=>dn(e),className:"w-full flex items-center gap-3 px-3 py-2 text-left hover-bg transition-base "+(0===t?"bg-subtle-fill/50":""),children:[n.jsx("span",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:Ne[e.nodeClass]}}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-sm text-fg-primary truncate",children:e.name||e.prefix}),e.name&&n.jsx("div",{className:"text-[10px] text-fg-muted",children:e.prefix})]}),n.jsx(ce,{className:"w-3 h-3 text-fg-muted shrink-0"})]},e.id))}),Pe&&0===cn.length&&n.jsx("div",{className:"px-3 py-4 text-center text-sm text-fg-muted",children:"No nodes found"}),!Pe&&n.jsx("div",{className:"px-3 py-2 type-data-xs text-fg-muted",children:"Type to search • Enter to select • Esc to close"})]})})});return W?0===As.length?n.jsxs("div",{className:"relative h-[calc(100dvh-56px)] lg:h-dvh min-h-[500px] -mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 overflow-hidden",children:[Ln,n.jsx("div",{className:"absolute inset-0 bg-body flex items-center justify-center",children:n.jsx(Gt,{})})]}):Cs?He?n.jsxs("div",{className:"fixed inset-0 z-50 bg-body flex flex-col overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 surface-header z-10",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(F,{className:"w-5 h-5 text-icon-page-title"}),n.jsxs("h1",{className:"type-title text-fg-primary flex items-center gap-2",children:["MeshGraph",n.jsx(R,{color:"violet",compact:!0,children:"Analytics"})]}),n.jsxs("span",{className:"text-[10px] text-fg-muted tabular-nums",children:[Xs.length," nodes • ",Ys.length," edges"]})]}),n.jsx(M,{content:"Exit fullscreen",children:n.jsx("button",{onClick:un,className:"p-1.5 radius-inner hover-bg transition-base",children:n.jsx(U,{className:"w-4 h-4 text-fg-muted"})})})]}),n.jsxs("div",{className:"flex-1 relative min-h-0 m-2 surface-base radius-inset overflow-hidden border border-edge-subtle",children:[n.jsx(a,{className:"absolute inset-0",points:Cs,links:Ss,...Ds,...Rs,backgroundColor:Ce,fitViewOnInit:!0,fitViewPadding:.15,showLabels:We,showDynamicLabels:!1,showTopLabels:We,showTopLabelsLimit:200,showHoveredPointLabel:!0,pointLabelColor:ke,pointClusterBy:ut?"communityId":void 0,onPolygonSelected:Kt?pn:void 0,polygonalSelectorStrokeColor:je?"#FBBF24":"#D97706",onClick:ln,onLinkClick:rn,onMount:tn,hoveredPointRingColor:je?"#FBBF24":"#D97706",hoveredPointCursor:"pointer",hoveredLinkCursor:"pointer"}),Zn,On,Rn,Mn,Hn,In,n.jsxs(m,{children:[De&&n.jsx($t,{node:De,egoMetrics:fn,onExpandEgo:yn,neighbors:bn,onSelectNeighbor:an,txDelayRec:vn,onClose:()=>{var e;Fe(null),null==(e=ws.current)||e.unselectAllPoints()}}),Re&&!De&&n.jsx(Tt,{edge:Re,onClose:()=>Me(null)}),qt&&!De&&!Re&&n.jsx(It,{metrics:qt,onClose:gn})]})]})]}):n.jsxs("div",{className:"relative h-[calc(100dvh-56px)] lg:h-dvh min-h-[500px] -mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 overflow-hidden",children:[Ln,n.jsxs("div",{className:"absolute inset-0",children:[n.jsx(a,{className:"absolute inset-0",points:Cs,links:Ss,...Ds,...Rs,backgroundColor:Ce,fitViewOnInit:!0,fitViewPadding:.15,showLabels:We,showDynamicLabels:!1,showTopLabels:We,showTopLabelsLimit:200,showHoveredPointLabel:!0,pointLabelColor:ke,pointClusterBy:ut?"communityId":void 0,onPolygonSelected:Kt?pn:void 0,polygonalSelectorStrokeColor:je?"#FBBF24":"#D97706",onClick:ln,onLinkClick:rn,onMount:tn,hoveredPointRingColor:je?"#FBBF24":"#D97706",hoveredPointCursor:"pointer",hoveredLinkCursor:"pointer"}),Zn,On,Rn,Mn,Hn,In,n.jsxs("div",{className:"absolute bottom-4 right-4 z-10 hidden lg:flex items-center gap-3 type-data-xs text-fg-muted/60",children:[n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 radius-badge bg-subtle-fill/50 font-mono",children:"/"})," Search"]}),n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 radius-badge bg-subtle-fill/50 font-mono",children:"F"})," Fit"]}),n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 radius-badge bg-subtle-fill/50 font-mono",children:"L"})," Labels"]}),n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 radius-badge bg-subtle-fill/50 font-mono",children:"Space"})," Pause"]}),n.jsxs("span",{children:[n.jsx("kbd",{className:"px-1 py-0.5 radius-badge bg-subtle-fill/50 font-mono",children:"Esc"})," Clear"]})]}),n.jsxs(m,{children:[De&&n.jsx($t,{node:De,egoMetrics:fn,onExpandEgo:yn,neighbors:bn,onSelectNeighbor:an,txDelayRec:vn,onClose:()=>{var e;Fe(null),null==(e=ws.current)||e.unselectAllPoints()}}),Re&&!De&&n.jsx(Tt,{edge:Re,onClose:()=>Me(null)}),qt&&!De&&!Re&&n.jsx(It,{metrics:qt,onClose:gn})]})]})]}):n.jsxs("div",{className:"relative h-[calc(100dvh-56px)] lg:h-dvh min-h-[500px] -mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 overflow-hidden",children:[Ln,n.jsxs("div",{className:"absolute inset-0 bg-body flex flex-col items-center justify-center gap-3",children:[n.jsx(A,{className:"w-8 h-8 text-sys-blue animate-spin"}),n.jsx("span",{className:"type-body text-fg-muted",children:"Preparing graph..."})]})]}):n.jsxs("div",{className:"relative h-[calc(100dvh-56px)] lg:h-dvh min-h-[500px] -mx-4 sm:-mx-6 lg:-mx-8 -mt-5 -mb-4 sm:-mb-6 lg:-mb-8 overflow-hidden",children:[Ln,n.jsxs("div",{className:"absolute inset-0 bg-body flex items-center justify-center",children:[n.jsx(X,{isOpen:Y,onClose:ee}),!Y&&n.jsx(A,{className:"w-8 h-8 text-sys-blue animate-spin"})]})]})}export{Wt as default}; diff --git a/frontend/dist/assets/NodeInformationCard-BswM4rjl.js b/frontend/dist/assets/NodeInformationCard-DQTRuz7_.js similarity index 90% rename from frontend/dist/assets/NodeInformationCard-BswM4rjl.js rename to frontend/dist/assets/NodeInformationCard-DQTRuz7_.js index 8228b675..d58d16fb 100644 --- a/frontend/dist/assets/NodeInformationCard-BswM4rjl.js +++ b/frontend/dist/assets/NodeInformationCard-DQTRuz7_.js @@ -1 +1 @@ -import{j as s}from"./vendor-react-j_fHog8x.js";import{a as e}from"./PageLayout-DrvMAhys.js";import{D as a}from"./DataBox-Dpf5ZHgV.js";import{R as t,bc as r}from"./index-01Tx8g53.js";import{C as c}from"./Card-Dr9pbVV5.js";function l({nodeName:l,repeaterVersion:m,coreVersion:i,localHash:n,publicKey:d}){return s.jsxs(e,{neomorphic:!0,children:[s.jsx(c,{icon:s.jsx(t,{}),title:"Node Information"}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 sm:gap-4",children:[s.jsxs("div",{className:"min-w-0 col-span-2 sm:col-span-1",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Node Name"}),s.jsx("p",{className:"type-body text-fg-primary mt-0.5 sm:mt-1 truncate",title:l,children:l})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Repeater"}),s.jsxs("p",{className:"type-data text-fg-primary mt-0.5 sm:mt-1 truncate",title:`v${m}`,children:["v",m]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Core"}),s.jsxs("p",{className:"type-data text-fg-primary mt-0.5 sm:mt-1 truncate",title:`v${i}`,children:["v",i]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Console"}),s.jsxs("p",{className:"type-data text-fg-primary mt-0.5 sm:mt-1 truncate",title:`v${r}`,children:["v",r]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Local Hash"}),s.jsx("div",{className:"mt-0.5 sm:mt-1",children:n?s.jsx(a,{copy:!0,size:"compact",children:n}):s.jsx("span",{className:"type-data-sm text-fg-secondary",children:"N/A"})})]})]}),d&&s.jsxs("div",{className:"mt-3 sm:mt-4 pt-3 sm:pt-4 border-t border-edge-subtle",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Public Key"}),s.jsx("div",{className:"mt-0.5 sm:mt-1",children:s.jsx(a,{copy:!0,size:"responsive",children:d})})]})]})}export{l as N}; +import{j as s}from"./vendor-react-j_fHog8x.js";import{a as e}from"./PageLayout-CYYy29Pg.js";import{D as a}from"./DataBox-B8dpvpbW.js";import{R as t,bc as r}from"./index-BBcIGlRT.js";import{C as c}from"./Card-QO4sXDu0.js";function l({nodeName:l,repeaterVersion:m,coreVersion:i,localHash:n,publicKey:d}){return s.jsxs(e,{neomorphic:!0,children:[s.jsx(c,{icon:s.jsx(t,{}),title:"Node Information"}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 sm:gap-4",children:[s.jsxs("div",{className:"min-w-0 col-span-2 sm:col-span-1",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Node Name"}),s.jsx("p",{className:"type-body text-fg-primary mt-0.5 sm:mt-1 truncate",title:l,children:l})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Repeater"}),s.jsxs("p",{className:"type-data text-fg-primary mt-0.5 sm:mt-1 truncate",title:`v${m}`,children:["v",m]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Core"}),s.jsxs("p",{className:"type-data text-fg-primary mt-0.5 sm:mt-1 truncate",title:`v${i}`,children:["v",i]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Console"}),s.jsxs("p",{className:"type-data text-fg-primary mt-0.5 sm:mt-1 truncate",title:`v${r}`,children:["v",r]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Local Hash"}),s.jsx("div",{className:"mt-0.5 sm:mt-1",children:n?s.jsx(a,{copy:!0,size:"compact",children:n}):s.jsx("span",{className:"type-data-sm text-fg-secondary",children:"N/A"})})]})]}),d&&s.jsxs("div",{className:"mt-3 sm:mt-4 pt-3 sm:pt-4 border-t border-edge-subtle",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Public Key"}),s.jsx("div",{className:"mt-0.5 sm:mt-1",children:s.jsx(a,{copy:!0,size:"responsive",children:d})})]})]})}export{l as N}; diff --git a/frontend/dist/assets/PacketList-C6Vv6v7V.js b/frontend/dist/assets/PacketList-Bo8AKcoq.js similarity index 98% rename from frontend/dist/assets/PacketList-C6Vv6v7V.js rename to frontend/dist/assets/PacketList-Bo8AKcoq.js index 35445cfa..900bf67d 100644 --- a/frontend/dist/assets/PacketList-C6Vv6v7V.js +++ b/frontend/dist/assets/PacketList-Bo8AKcoq.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PathMapMapLibre-QnAQ-gAh.js","assets/vendor-react-j_fHog8x.js","assets/BasemapLayer-BT1oL_wV.js","assets/vendor-core-CmkNwW1A.js","assets/index-01Tx8g53.js","assets/DelayedAnimateNumber-Ix4AeV6C.js","assets/index-D932VMrD.js","assets/payload-decoders-XckZ5vyB.js","assets/node-types-BT5BImck.js","assets/badge-colors-YAE4qQ7m.js","assets/chat-utils-CB1BFUm7.js","assets/SignalIndicator-CIKrVFY9.js","assets/signal-scoring-CcBiRcks.js","assets/arrow-up-C91otjLx.js","assets/copy-B5OWhmpX.js","assets/chevron-right-BHZSwM7S.js","assets/map-pin-DZIYgupP.js","assets/triangle-alert-DI33YyZq.js","assets/DataBox-Dpf5ZHgV.js","assets/layers-BNjfohkH.js","assets/route-D7UU7r6_.js","assets/activity-DOuX3omM.js","assets/circle-check-DXO8ha7w.js","assets/database-Cxl-xDNL.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-QdsUNncv.css"])))=>i.map(i=>d[i]); -import{c as e}from"./vendor-core-CmkNwW1A.js";import{j as s,c as t,r as a,_ as n}from"./vendor-react-j_fHog8x.js";import{c as l,a6 as r,a7 as i,a8 as c,a9 as o,B as d,aa as x,ab as m,ac as p,j as h,ad as u,R as g,ae as f,af as y,ag as j,ah as b,ai as N,G as v,aj as k,ak as w,m as C,P as S,o as _,al as H,am as M,an as T,ao as P,ap as B,aq as F,ar as L,t as D,as as z,at as R,au as A,av as $,W as E,X as U,A as I,aw as V,Y as O,ax as Q,ay as G,az as W}from"./index-01Tx8g53.js";import{P as q,d as K,a as X,b as Y,c as J,e as Z,f as ee}from"./payload-decoders-XckZ5vyB.js";import{g as se,C as te}from"./node-types-BT5BImck.js";import{D as ae,R as ne,P as le}from"./badge-colors-YAE4qQ7m.js";import{g as re,e as ie,a as ce}from"./chat-utils-CB1BFUm7.js";import{A as oe,S as de,i as xe,a as me,g as pe,b as he,Z as ue}from"./SignalIndicator-CIKrVFY9.js";import{a as ge,A as fe}from"./arrow-up-C91otjLx.js";import{C as ye}from"./copy-B5OWhmpX.js";import{C as je}from"./chevron-right-BHZSwM7S.js";import{M as be}from"./map-pin-DZIYgupP.js";import{T as Ne}from"./triangle-alert-DI33YyZq.js";import{D as ve}from"./DataBox-Dpf5ZHgV.js";import{L as ke}from"./layers-BNjfohkH.js";import{H as we,R as Ce}from"./route-D7UU7r6_.js";import{A as Se}from"./activity-DOuX3omM.js";import{C as _e}from"./circle-check-DXO8ha7w.js";import{D as He}from"./database-Cxl-xDNL.js";import{H as Me,D as Te}from"./DelayedAnimateNumber-Ix4AeV6C.js";const Pe=l("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Be=l("corner-down-right",[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]),Fe=l("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),Le=l("message-circle-question-mark",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),De=l("reply",[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]),ze=l("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),Re=l("stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]),Ae=l("trophy",[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]]),$e=l("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);function Ee(e,s){[...s].reverse().forEach(t=>{const a=e.getVariant(t);a&&i(e,a),e.variantChildren&&e.variantChildren.forEach(e=>{Ee(e,s)})})}function Ue(){const e=new Set,s={subscribe:s=>(e.add(s),()=>{e.delete(s)}),start(s,t){const a=[];return e.forEach(e=>{a.push(r(e,s,{transitionOverride:t}))}),Promise.all(a)},set:s=>e.forEach(e=>{!function(e,s){Array.isArray(s)?Ee(e,s):"string"==typeof s?Ee(e,[s]):i(e,s)}(e,s)}),stop(){e.forEach(e=>{!function(e){e.values.forEach(e=>e.stop())}(e)})},mount:()=>()=>{s.stop()}};return s}function Ie(){const e=c(Ue);return o(e.mount,[]),e}function Ve({"aria-label":e="Page navigation",className:a,...n}){return s.jsx("nav",{"aria-label":e,...n,className:t("flex gap-x-2",a)})}function Oe({onClick:e,disabled:a=!1,className:n,children:l="Previous"}){return s.jsx("span",{className:t("grow basis-0",n),children:s.jsxs(d,{plain:!0,onClick:e,disabled:a,"aria-label":"Previous page",className:t("gap-1",a&&"invisible"),children:[s.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M2.75 8H13.25M2.75 8L5.25 5.5M2.75 8L5.25 10.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})}),l]})})}function Qe({onClick:e,disabled:a=!1,className:n,children:l="Next"}){return s.jsx("span",{className:t("flex grow basis-0 justify-end",n),children:s.jsxs(d,{plain:!0,onClick:e,disabled:a,"aria-label":"Next page",className:t("gap-1",a&&"invisible"),children:[l,s.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M13.25 8L2.75 8M13.25 8L10.75 10.5M13.25 8L10.75 5.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})]})})}function Ge({className:e,...a}){return s.jsx("span",{...a,className:t("hidden items-baseline gap-x-2 sm:flex",e)})}function We({page:e,current:a=!1,onClick:n,className:l,children:r}){return s.jsx(d,{plain:!a,outline:a,onClick:()=>null==n?void 0:n(e),"aria-label":`Page ${e}`,"aria-current":a?"page":void 0,className:t("min-w-[2.25rem] before:absolute before:-inset-px before:rounded-lg",a&&"before:bg-subtle-fill",l),children:r??e})}function qe({className:e,...a}){return s.jsx("span",{"aria-hidden":"true",...a,className:t("w-[2.25rem] select-none text-center text-sm text-fg-muted",e),children:"…"})}const Ke=e(e=>({requestedHash:null,requestChannel:s=>e({requestedHash:s}),clearRequest:()=>e({requestedHash:null})}));function Xe(e){if(!e||e.length<8)return null;const s=parseInt(e.slice(0,2),16),t=parseInt(e.slice(2,4),16),a=parseInt(e.slice(4,6),16),n=parseInt(e.slice(6,8),16);return isNaN(s)||isNaN(t)||isNaN(a)||isNaN(n)?null:((s|t<<8|a<<16|n<<24)>>>0).toString(16).toUpperCase().padStart(8,"0")}function Ye(e){return e>=10?"excellent":e>=5?"good":e>=0?"fair":e>=-5?"poor":"critical"}function Je(e){if(!e.payload)return null;try{const s=p(e.payload),t=function(e){const s=e.original_path||e.forwarded_path||[];if("string"==typeof s)try{const e=JSON.parse(s);if(Array.isArray(e))return e.map(e=>parseInt(e,16))}catch{return[]}else if(Array.isArray(s))return s.map(e=>parseInt(e,16));return[]}(e),a=X(s,t);return a?{packet:e,decoded:a,timestamp:e.timestamp??0,hopCount:a.snrValues.length,rssi:e.rssi,snr:e.snr}:null}catch{return null}}const Ze={rx:{icon:fe,label:"Rx",badgeColor:ae.rx,avatarBg:"bg-sys-green/15",avatarText:"text-sys-green"},forward:{icon:oe,label:"Fwd",badgeColor:ae.forward,avatarBg:"bg-sys-cyan/15",avatarText:"text-sys-cyan"},duplicate:{icon:ye,label:"Dupe",badgeColor:ae.duplicate,avatarBg:"bg-fg-muted/15",avatarText:"text-fg-secondary"},tx:{icon:ge,label:"Tx",badgeColor:ae.tx,avatarBg:"bg-sys-indigo/15",avatarText:"text-sys-indigo"},dropped:{icon:Be,label:"Drop",badgeColor:ae.dropped,avatarBg:"bg-sys-amber/15",avatarText:"text-sys-amber"}},es={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},ss={sm:"w-8 h-8",md:"w-9 h-9",lg:"w-10 h-10"};function ts(e){return"tx_local"===e.packet_origin?"tx":"tx_forward"===e.packet_origin?"forward":e.is_duplicate?"duplicate":e.transmitted?"forward":e.drop_reason?"dropped":"rx"}const as=a.memo(function({packet:e,showLabel:a=!0,variant:n="avatar",size:l="sm"}){const r=ts(e),i=Ze[r],c=i.icon;return"avatar"===n?s.jsx("div",{className:t("flex items-center justify-center rounded-full flex-shrink-0",i.avatarBg,ss[l]),children:s.jsx(c,{className:t(es[l],i.avatarText)})}):s.jsxs(h,{color:i.badgeColor,children:[s.jsx(c,{className:es[l]}),a&&i.label]})}),ns=a.memo(function({path:e,localHash:a,className:n}){if(!e||0===e.length)return s.jsx("span",{className:t("text-fg-muted text-xs",n),children:"—"});const l=a?(a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase():null;return s.jsx("span",{className:t("flex items-center gap-0.5 type-data-xs overflow-hidden",n),children:e.map((t,a)=>{const n=a===e.length-1,r=l&&t.toUpperCase()===l;return s.jsxs("span",{className:"flex items-center flex-shrink-0",children:[r?s.jsx("span",{className:"px-1 py-0.5 rounded bg-sys-amber/20 text-sys-amber text-[9px] font-medium",children:"You"}):s.jsx("span",{className:"px-1 py-0.5 rounded bg-subtle-fill-hover text-fg-secondary",children:t.toUpperCase()}),!n&&s.jsx(je,{className:"w-2.5 h-2.5 text-fg-muted mx-0.5 flex-shrink-0"})]},`${t}-${a}`)})})});function ls({channelName:e,onClick:a,active:n,compact:l,className:r}){const i=e.startsWith("#")?e:`#${e}`,c=t("inline-flex items-center flex-shrink-0","font-medium",l?"px-1.5 h-4 leading-4 rounded text-[10px]":"px-2 h-5 leading-5 rounded text-xs",n?"bg-sys-blue/20 text-sys-blue":"bg-sys-blue/10 text-sys-blue",a&&!n&&"hover:bg-sys-blue/20 cursor-pointer",r);return a?s.jsx("button",{type:"button",onClick:a,className:c,children:i}):s.jsx("span",{className:c,children:i})}function rs(e){return{"--data-box-accent":b[e]}}function is(e){const s=e.payload_type_name||y(e.payload_type??e.type),t=e.route_type_name||j(e.route_type??e.route);return{payloadType:s,routeType:t,payloadColor:le[s]??"zinc",routeColor:ne[t]??"zinc"}}function cs(e){if(!e)return[];if(Array.isArray(e))return e;try{const s=JSON.parse(e);return Array.isArray(s)?s:[]}catch{return[]}}function os(e,s){const{name:t,nodeType:a}=se(e,s);return{name:t,isCompanion:a.isCompanion||a.isClient,isRepeater:a.isRepeater}}const ds=a.memo(function({packet:e,onClick:n,localHash:l,neighbors:r,isFlashing:i=!1,isTraceHighlighted:c,onTraceHover:o,traceTag:d,onViewTraceReport:x,dupeGroupPosition:m,isDupeGroupHovered:p=!1,onDupeGroupHover:h,dupeCount:y,decodedMessages:j,onChannelClick:N}){const v=!y&&u(e.is_duplicate),k=void 0!==m,{payloadType:w,routeType:C,payloadColor:S,routeColor:_}=is(e),H="tx_local"===e.packet_origin,M="TRACE"===w,T=cs(e.original_path),P=cs(e.forwarded_path),B=P.length>0?P:T,F=e.src_hash?(e.src_hash.startsWith("0x")?e.src_hash.slice(2,6):e.src_hash.slice(0,4)).toUpperCase():null,{name:L,isRepeater:D}=os(e.src_hash,r);let z=null,R=null,A=null,$=null;if("GRP_TXT"===w&&j){const s=j.get(e.packet_hash),t=null==s?void 0:s.decoded;(null==t?void 0:t.decrypted)&&!t.macCorrupted&&t.text&&(R=t.senderName||null,z=t.text,A=t.channelName||null,$=t.channelHash||null)}else if("TXT_MSG"===w&&e.raw_packet)try{const s=q.fromHex(e.raw_packet);if(s.success&&s.packet){const e=Y(s.packet.payload);e&&!e.encrypted&&(z=e.text)}}catch{}const E=R||(D?null:L),U=!!E,I=!U&&D&&!!L,V=!U&&!I&&"GRP_TXT"===w&&!z,O=e.payload_length??e.length??0;e.lbt_attempts;const Q=a.useCallback(()=>{M&&d&&x?x(d):n(e)},[M,d,x,n,e]),G=a.useCallback(()=>{M&&d&&o&&o(d),k&&h&&e.packet_hash&&h(e.packet_hash)},[M,d,o,k,h,e.packet_hash]),W=a.useCallback(()=>{o&&o(null),h&&h(null)},[o,h]),K=b[S]||b.zinc,X=p;return s.jsxs("div",{onClick:Q,onMouseEnter:G,onMouseLeave:W,className:t("group relative cursor-pointer","hover:bg-subtle-fill",v&&!p&&"opacity-40",i&&"flash-row",H&&"bg-sys-indigo/5",c&&"bg-sys-teal/10"),children:[s.jsx("div",{className:t("absolute pointer-events-none transition-opacity duration-75",k?X?"opacity-100":"opacity-0":"opacity-0 group-hover:opacity-100"),style:(()=>{const e={pointerEvents:"none"};return"first"===m?{...e,borderTop:`2px solid ${K}`,borderLeft:`2px solid ${K}`,borderRight:`2px solid ${K}`,borderBottom:"none",borderRadius:"8px 8px 0 0",inset:"-2px -2px 0 -2px"}:"middle"===m?{...e,borderTop:"none",borderLeft:`2px solid ${K}`,borderRight:`2px solid ${K}`,borderBottom:"none",borderRadius:0,inset:"0 -2px"}:"last"===m?{...e,borderTop:"none",borderLeft:`2px solid ${K}`,borderRight:`2px solid ${K}`,borderBottom:`2px solid ${K}`,borderRadius:"0 0 8px 8px",inset:"0 -2px -2px -2px"}:{...e,border:`2px solid ${K}`,borderRadius:"8px",inset:"-2px"}})()}),s.jsxs("div",{className:"relative flex items-center gap-2 min-[600px]:gap-3 px-2 py-2 min-[600px]:px-3 min-[600px]:py-2.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[s.jsx("div",{className:"relative flex-shrink-0",children:U?s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-1 ring-edge-subtle",style:{backgroundColor:re(ie(E).cleanName)},children:ie(E).emoji?s.jsx("span",{className:"text-base leading-none",children:ie(E).emoji}):s.jsx("span",{className:"text-white text-[10px] font-bold tracking-tighter",children:ce(E)})}):I?s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:s.jsx(g,{className:"size-5 text-sys-blue"})}):V?s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-zinc-500/20 ring-1 ring-edge-subtle",children:s.jsx(Le,{className:"size-4 text-fg-muted"})}):s.jsx(as,{packet:e,variant:"avatar",size:"sm"})}),s.jsx("div",{className:"min-w-0",children:U?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"font-semibold text-[13px] text-fg-primary font-sans truncate max-w-[90px]",children:E}),F&&s.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate",children:F})]}):I?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"font-semibold text-[13px] text-fg-primary font-sans truncate max-w-[90px]",children:L}),F&&s.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate",children:F})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"font-bold text-[13px] text-fg-primary font-sans truncate",children:F||"—"}),L&&s.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate max-w-[70px]",children:L})]})})]}),s.jsxs("div",{className:"flex-1 flex items-center gap-1 min-[600px]:gap-1.5 min-[900px]:gap-2 min-w-0",children:[s.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:rs(S),children:w}),y&&y>1&&s.jsxs("span",{className:"data-box data-box-compact flex-shrink-0",children:["×",y]}),s.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:rs(_),children:C}),s.jsxs("span",{className:"hidden min-[520px]:inline type-data-xs text-fg-muted flex-shrink-0",children:[O,"B"]}),s.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:z?s.jsxs("span",{className:"text-[11px] text-fg-secondary truncate block flex items-center gap-1",children:[A&&s.jsx(ls,{channelName:A,compact:!0,onClick:N&&$?e=>{e.stopPropagation(),N($)}:void 0}),s.jsx("span",{className:"italic truncate",children:z})]}):s.jsx(ns,{path:B,localHash:l})})]}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[s.jsx("span",{className:"data-box data-box-compact",children:f(e.timestamp)}),s.jsx(de,{rssi:e.rssi,snr:e.snr,compact:!0,showValues:!0,validated:xe(e)})]})]})]})}),xs=a.memo(function({packet:e,onClick:a,localHash:n,neighbors:l,isFlashing:r=!1,isTraceHighlighted:i,traceTag:c,onViewTraceReport:o,dupeGroupPosition:d,isDupeGroupHovered:x=!1,onDupeGroupHover:m,dupeCount:p,decodedMessages:h,onChannelClick:y}){const{payloadType:j,routeType:N,payloadColor:v,routeColor:k}=is(e),w="tx_local"===e.packet_origin,C="TRACE"===j,S=!p&&u(e.is_duplicate),_=cs(e.original_path),H=cs(e.forwarded_path),M=H.length>0?H:_,T=M.length,P=e.src_hash?(e.src_hash.startsWith("0x")?e.src_hash.slice(2,6):e.src_hash.slice(0,4)).toUpperCase():null,{name:B,isRepeater:F}=os(e.src_hash,l);let L=null,D=null,z=null,R=null;if("GRP_TXT"===j&&h){const s=h.get(e.packet_hash),t=null==s?void 0:s.decoded;(null==t?void 0:t.decrypted)&&!t.macCorrupted&&t.text&&(D=t.senderName||null,L=t.text,z=t.channelName||null,R=t.channelHash||null)}else if("TXT_MSG"===j&&e.raw_packet)try{const s=q.fromHex(e.raw_packet);if(s.success&&s.packet){const e=Y(s.packet.payload);e&&!e.encrypted&&(L=e.text)}}catch{}const A=D||(F?null:B),$=!!A,E=!$&&F&&!!B,U=!$&&!E&&"GRP_TXT"===j&&!L,I=e.payload_length??e.length??0,V=e.lbt_attempts??0,O=b[v]||b.zinc;return s.jsxs("div",{onClick:()=>{C&&c&&o?o(c):a(e)},className:t("relative pl-3 pr-2.5 py-2 cursor-pointer","active:bg-subtle-fill-hover",S&&"opacity-40",r&&"flash-row",w&&"bg-sys-indigo/5",i&&"bg-sys-teal/10"),children:[s.jsx("div",{className:"absolute left-0 transition-all",style:(()=>{if(!d)return{opacity:0};const e=x?1:.4,s=x?"3px":"2px";return"first"===d?{backgroundColor:O,opacity:e,width:s,top:"6px",bottom:0,borderRadius:"0 9999px 0 0"}:"middle"===d?{backgroundColor:O,opacity:e,width:s,top:0,bottom:0,borderRadius:0}:"last"===d?{backgroundColor:O,opacity:e,width:s,top:0,bottom:"6px",borderRadius:"0 0 9999px 0"}:{backgroundColor:O,opacity:e,width:s,top:"6px",bottom:"6px",borderRadius:"9999px"}})()}),s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"relative flex-shrink-0 mt-0.5",children:$?s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-1 ring-edge-subtle",style:{backgroundColor:re(ie(A).cleanName)},children:ie(A).emoji?s.jsx("span",{className:"text-base leading-none",children:ie(A).emoji}):s.jsx("span",{className:"text-white text-[10px] font-bold tracking-tighter",children:ce(A)})}):E?s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:s.jsx(g,{className:"size-5 text-sys-blue"})}):U?s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-zinc-500/20 ring-1 ring-edge-subtle",children:s.jsx(Le,{className:"size-4 text-fg-muted"})}):s.jsx(as,{packet:e,variant:"avatar",size:"sm"})}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[$?s.jsx("span",{className:"font-medium text-[14px] text-fg-primary tracking-tight truncate min-w-0",children:A}):E?s.jsx("span",{className:"font-medium text-[14px] text-fg-primary tracking-tight truncate min-w-0",children:B}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"font-semibold text-[14px] text-fg-primary tracking-tight flex-shrink-0",children:P||"—"}),B&&s.jsx("span",{className:"text-[12px] text-fg-muted truncate min-w-0",children:B})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:rs(v),children:j}),s.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:rs(k),children:N}),p&&p>1&&s.jsxs("span",{className:"data-box data-box-compact flex-shrink-0",children:["×",p]}),s.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[s.jsx("span",{className:"type-data-xs text-fg-muted w-[28px] text-right",children:e.rssi}),s.jsx(de,{rssi:e.rssi,compact:!0,showValues:!1,validated:xe(e)})]})]}),s.jsxs("div",{className:"flex items-center gap-1 type-data-xs text-fg-muted",children:[s.jsx("span",{className:"data-box data-box-compact flex-shrink-0",children:f(e.timestamp)}),I>0&&s.jsxs("span",{children:[I,"B"]}),V>0&&s.jsxs("span",{className:V>1?"text-sys-amber/60":void 0,children:["LBT:",V]}),null!=e.snr&&s.jsxs("span",{children:[e.snr.toFixed(0),"dB"]}),L?s.jsxs("span",{className:"text-[11px] text-fg-secondary truncate flex items-center gap-1 min-w-0",children:[z&&s.jsx(ls,{channelName:z,compact:!0,onClick:y&&R?e=>{e.stopPropagation(),y(R)}:void 0}),s.jsx("span",{className:"italic truncate",children:L})]}):T>0?s.jsx(ns,{path:M,localHash:n}):null]})]})]})]})});function ms(e){if(e.contact_type){const s=e.contact_type.toLowerCase();if("repeater"===s||"rep"===s)return!0;if("companion"===s||"client"===s||"cli"===s)return!1;if("room server"===s||"room_server"===s||"room"===s||"server"===s)return!1}return!0===e.is_repeater||(e.is_repeater,!1)}const ps=a.lazy(()=>n(()=>import("./PathMapMapLibre-QnAQ-gAh.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25])));function hs(e){return`${(100*e).toFixed(0)}%`}function us(e,s){const t=document.documentElement,a=getComputedStyle(t),n={success:a.getPropertyValue("--sys-green").trim()||"#39D98A",secondary:a.getPropertyValue("--sys-indigo").trim()||"#F9D26F",poor:a.getPropertyValue("--signal-poor").trim()||"#FF8A5C",danger:a.getPropertyValue("--sys-red").trim()||"#FF5C7A",muted:a.getPropertyValue("--text-muted").trim()||"#767688"};let l;return l=0===s?n.muted:e>=1?n.success:e>=.5?n.secondary:e>=.25?n.poor:e>0?n.danger:n.muted,{color:l}}class gs extends a.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?s.jsxs("div",{className:"h-[200px] flex items-center justify-center text-fg-muted",children:[s.jsx(Ne,{className:"w-4 h-4 mr-2"}),"Map failed to load"]}):this.props.children}}function fs({path:e,neighbors:n,localNode:l,localHash:r,srcHash:i,dstHash:c,neighborAffinity:o,prefixLookup:d,hubNodes:x,traceSnr:m,advertiserSource:p}){const[h,u]=a.useState(null),g=a.useMemo(()=>{if(!p)return null;const e="wardrive"===p.nodeType;return{prefix:p.prefix||"??",candidates:[{hash:p.publicKey||p.prefix||"source",name:p.name,latitude:p.latitude,longitude:p.longitude,probability:1,isLocal:!1,isWardrive:e}],confidence:1,totalMatches:1,isSource:!0}},[p]),f=a.useMemo(()=>{if(p)return null;if(!i)return null;const e=v(i),s=n[i];if((null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&(0!==s.latitude||0!==s.longitude))return{prefix:e,candidates:[{hash:i,name:s.node_name||s.name||"Source",latitude:s.latitude,longitude:s.longitude,probability:1,isLocal:!1,isDirectNeighbor:!0===s.zero_hop}],confidence:1,totalMatches:1,isSource:!0};const t=(null==s?void 0:s.node_name)||(null==s?void 0:s.name)||i.slice(0,8);return{prefix:e,candidates:[{hash:i,name:t,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isSource:!0}},[p,i,n]),y=a.useMemo(()=>{const e=(null==c?void 0:c.startsWith("0x"))?c.slice(2):c;if((!e||"00"===e||"0000000000000000"===e)&&l&&r){const e=v(r),s=0!==l.latitude||0!==l.longitude;return{prefix:e,candidates:[{hash:r,name:l.name||"Local Node",latitude:s?l.latitude:0,longitude:s?l.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}if(!c)return null;const s=v(c);if(r&&c===r&&l){const e=0!==l.latitude||0!==l.longitude;return{prefix:s,candidates:[{hash:c,name:l.name||"Local Node",latitude:e?l.latitude:0,longitude:e?l.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}const t=n[c];if((null==t?void 0:t.latitude)&&(null==t?void 0:t.longitude)&&(0!==t.latitude||0!==t.longitude))return{prefix:s,candidates:[{hash:c,name:t.node_name||t.name||"Destination",latitude:t.latitude,longitude:t.longitude,probability:1,isLocal:!1,isDirectNeighbor:!0===t.zero_hop}],confidence:1,totalMatches:1,isDestination:!0};const a=(null==t?void 0:t.node_name)||(null==t?void 0:t.name)||c.slice(0,8);return{prefix:s,candidates:[{hash:c,name:a,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isDestination:!0}},[c,n,l,r]),j=a.useMemo(()=>function(e,s,t,a,n,l){if(!e||0===e.length)return{hops:[],overallConfidence:0,hasValidPath:!1};const r=e.length-1,i=e.map((i,c)=>{const o=c===r,d=e.length-c,{candidates:x,totalMatches:m}=function(e,s,t,a,n=!1,l,r,i){const c=function(e){const s={};for(const[t,a]of Object.entries(e))ms(a)&&(s[t]=a);return s}(s);let o;if(r){const s=function(e,s,t){const a=s.toUpperCase(),n=e.get(a);if(!n||0===n.candidates.length)return{hash:null,confidence:0};if(null==t?void 0:t.isLastHop)return{hash:n.bestMatch,confidence:n.confidence};if(1===(null==t?void 0:t.position))return{hash:n.bestMatch,confidence:n.confidence};if((null==t?void 0:t.position)&&n.bestMatchForPosition.has(t.position)){const e=n.bestMatchForPosition.get(t.position),s=Math.max(e.confidence,n.confidence);return{hash:e.hash,confidence:s}}if((null==t?void 0:t.adjacentPrefixes)&&t.adjacentPrefixes.length>0){let e=n.bestMatch,s=0;for(const a of n.candidates){let n=0;for(const e of t.adjacentPrefixes)n+=a.adjacentPrefixCounts.get(e.toUpperCase())||0;const l=a.combinedScore+n/Math.max(1,a.totalAdjacentObservations)*.3;l>s&&(s=l,e=a.hash)}return{hash:e,confidence:n.confidence}}return{hash:n.bestMatch,confidence:n.confidence}}(r,e,{position:i,isLastHop:n});o=s.confidence}const{matches:d,probability:x}=function(e,s,t,a,n=!1){const l=e.toUpperCase(),r=[],i=t&&N(l,t);i&&r.push(t);for(const p of Object.keys(s))N(l,p)&&r.push(p);if(n&&i&&t&&1===r.length)return{matches:r,probability:1,bestMatch:t};if(n&&i&&r.length>1){const e=r.filter(e=>e!==t);if(1===e.length)return{matches:r,probability:1,bestMatch:e[0]}}const c=r.length>0?1/r.length:0,o=[...r].sort();let d=null,x=-1;if(1===o.length)d=o[0];else if(o.length>1&&a){for(const e of o){const s=a.get(e),t=s?"number"==typeof s?s:s.combinedScore:0;t>x&&(x=t,d=e)}d||(d=o[0])}else o.length>0&&(d=o[0]);let m=c;if(r.length>1&&a&&x>0){let e=0;for(const s of r){const t=a.get(s);e+=t?"number"==typeof t?t:t.combinedScore:0}e>0&&(m=Math.min(.95,x/e))}return{matches:r,probability:m,bestMatch:d}}(e,c,a,l,n),m=d.length,p=[],h=e.toUpperCase(),u=t&&void 0!==t.latitude&&void 0!==t.longitude&&(0!==t.latitude||0!==t.longitude);for(const f of d){if(a&&N(h,a)&&f===a&&u&&t){p.push({hash:f,name:t.name||"Local Node",latitude:t.latitude,longitude:t.longitude,probability:n?1:x,isLocal:!0});continue}const e=c[f];(null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude)&&(0!==e.latitude||0!==e.longitude)&&p.push({hash:f,name:e.node_name||e.name||"Unknown",latitude:e.latitude,longitude:e.longitude,probability:x,isLocal:!1,isDirectNeighbor:!0===e.zero_hop})}const g=p.length;if(1===g)p[0].probability=o??1;else if(g>1)if(void 0!==o&&o>0){p[0].probability=o;const e=1-o,s=g-1;p.slice(1).forEach(t=>{t.probability=e/s})}else{let e=0;const s=p.map(s=>{if(s.isLocal)return{candidate:s,score:1};const a=null==l?void 0:l.get(s.hash);let n=.5;var r;let i;return u&&t&&(n=(r=function(e,s,t,a){const n=(t-e)*Math.PI/180,l=(a-s)*Math.PI/180,r=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(t*Math.PI/180)*Math.sin(l/2)*Math.sin(l/2);return 2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))*6371e3}(t.latitude,t.longitude,s.latitude,s.longitude))<100?1:r<500?.9:r<1e3?.7:r<5e3?.5:r<1e4?.3:.1),a?i=.3*n+.3*a.hopConsistencyScore+.4*a.frequencyScore:(i=n,s.isDirectNeighbor&&(i=Math.max(i,.8))),e+=i,{candidate:s,score:i}});if(e>0)s.forEach(({candidate:s,score:t})=>{s.probability=Math.min(.95,t/e)});else{const e=1/g;p.forEach(s=>s.probability=e)}}return{candidates:p,totalMatches:m}}(i,s,t,a,o,n,l,d),p=x.length>0?Math.max(...x.map(e=>e.probability)):0;return{prefix:i,candidates:x,confidence:p,totalMatches:m}}),c=i.reduce((e,s)=>0===s.confidence?0:e*s.confidence,1),o=i.some(e=>e.candidates.length>0);return{hops:i,overallConfidence:c,hasValidPath:o}}(e,n,l,r,o,d),[e,n,l,r,o,d]),b=a.useMemo(()=>{const e=[];g?e.push(g):f&&e.push(f),e.push(...j.hops),y&&e.push(y);const s=e.reduce((e,s)=>0===s.confidence?0:e*s.confidence,1),t=e.some(e=>e.candidates.some(e=>0!==e.latitude||0!==e.longitude));return{hops:e,overallConfidence:s,hasValidPath:t}},[g,f,j,y]);return b.hasValidPath?s.jsxs("div",{className:"h-full flex flex-col space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-fg-muted",children:"Path Confidence:"}),s.jsx("span",{className:(k=b.overallConfidence,k>=1?"text-sys-green":k>=.5?"text-sys-indigo":k>=.25?"text-signal-poor":k>0?"text-sys-red":"text-fg-muted"),children:hs(b.overallConfidence)}),s.jsx("button",{className:"text-fg-muted hover:text-fg-secondary transition-colors",title:"Confidence is calculated based on how many known nodes match each path prefix. Multiple matches reduce confidence due to collision probability.",children:s.jsx(te,{className:"w-3 h-3"})})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-sys-green"}),s.jsx("span",{className:"text-fg-muted",children:"Exact"})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-sys-indigo"}),s.jsx("span",{className:"text-fg-muted",children:"Multi"})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-fg-muted"}),s.jsx("span",{className:"text-fg-muted",children:"Unknown"})]})]})]}),s.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:s.jsx(gs,{children:s.jsx(a.Suspense,{fallback:s.jsx("div",{className:"h-full bg-elevated flex items-center justify-center text-fg-muted text-sm",children:"Loading map..."}),children:s.jsx(ps,{resolvedPath:b,localNode:l,hubNodes:x,hoveredHopIndex:h,onHoverHop:u,traceSnr:m})})})}),s.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:b.hops.map((e,a)=>{var n,l,r;const i=!0===e.isSource,c=!0===e.isDestination,o=h===a;let d;return d=i?`Source: ${(null==(n=e.candidates[0])?void 0:n.name)||"Unknown"}`:c?`Destination: ${(null==(l=e.candidates[0])?void 0:l.name)||"Unknown"}`:0===e.totalMatches?"No matching nodes found":1===e.totalMatches?`Exact match: ${(null==(r=e.candidates[0])?void 0:r.name)||"Unknown"}`:`${e.totalMatches} possible matches (${(100*e.confidence).toFixed(0)}% confidence)`,s.jsxs("div",{className:t("flex items-center gap-1 px-1.5 py-0.5 rounded type-data-xs cursor-pointer transition-all",o?"bg-sys-blue/20 ring-1 ring-sys-blue/50":"bg-elevated hover:bg-subtle",i&&"border border-sys-green/30",c&&"border border-sys-blue/30"),title:d,onMouseEnter:()=>u(a),onMouseLeave:()=>u(null),children:[i&&s.jsx("span",{className:"text-sys-green text-[8px] mr-0.5",children:"SRC"}),c&&s.jsx("span",{className:"text-sys-blue text-[8px] mr-0.5",children:"DST"}),s.jsx("span",{style:us(e.confidence,e.totalMatches),children:e.prefix}),!i&&!c&&e.totalMatches>1&&s.jsxs("span",{className:"text-fg-muted",children:["×",e.totalMatches]}),!i&&!c&&0===e.totalMatches&&s.jsx("span",{className:"text-fg-muted",children:"?"})]},a)})})]}):s.jsxs("div",{className:"flex items-center justify-center text-fg-muted text-xs py-4",children:[s.jsx(be,{className:"w-3.5 h-3.5 mr-1.5 opacity-50"}),"No location data available for path nodes"]});var k}function ys(e){return e.match(/.{1,2}/g)||[]}function js(e){return null!==e&&e.startsWith("payload:")}const bs=15,Ns="color-mix(in srgb, var(--elevated) 60%, var(--body))",vs="\n inset 0 0 0 1px color-mix(in srgb, var(--fg-primary) 6%, transparent),\n inset 0 1px 0 color-mix(in srgb, white 3%, transparent),\n 0 1px 2px color-mix(in srgb, black 5%, transparent)\n ",ks=2,ws={type:"tween",duration:.25,ease:[.25,.1,.25,1]};function Cs(e,s){return e?`inset 0 0 0 ${ks}px ${b[s]}`:vs}function Ss(e,s){return e?s:`color-mix(in srgb, ${s} ${bs}%, transparent)`}function _s({segments:e,selectedSegment:t,onSegmentClick:n}){const[l,r]=a.useState(null),[i,c]=a.useState(null),o=e.some(e=>void 0!==e.id)&&n,d=[];for(const s of e){const e=ys(s.hex);for(const t of e)d.push({byte:t.toUpperCase(),color:s.color,id:s.id})}const x=[];for(let s=0;s{const d=e.length<16;return s.jsx("div",{className:"flex rounded-md overflow-hidden",children:e.map(({byte:a,color:x,id:m},p)=>{const h=p===e.length-1,u=d&&h,g=b[x],f=m?l===m:i===x,y=Boolean(m&&t===m),j=f||y;return s.jsx("span",{className:"w-[1.75rem] text-xs text-center py-0.5 font-mono select-text "+(o?"cursor-pointer":""),style:{backgroundColor:Ss(j,g),color:j?"rgba(255,255,255,0.95)":g,transition:j?"none":"background-color 0.15s ease-out, color 0.15s ease-out",touchAction:"manipulation",...u?{borderRadius:"0 0.375rem 0.375rem 0"}:{}},onMouseEnter:()=>{m?r(m):c(x)},onMouseLeave:()=>{r(null),c(null)},onClick:()=>m&&(null==n?void 0:n(m)),onTouchStart:()=>{m?r(m):c(x)},onTouchEnd:()=>{r(null),c(null)},children:a},p)})},a)})})}function Hs({rawHex:e,hexSegments:t,selectedSegment:n,onSegmentClick:l}){const[r,i]=a.useState(!1),c=a.useCallback(async()=>{try{await navigator.clipboard.writeText(e.toUpperCase()),i(!0),setTimeout(()=>i(!1),2e3)}catch(s){}},[e]);return s.jsxs("div",{className:"bg-black rounded-2xl p-6 relative",children:[s.jsx(_s,{segments:t,selectedSegment:n,onSegmentClick:l}),s.jsx("button",{onClick:c,className:"absolute bottom-3 right-3 flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-subtle-fill-hover hover:bg-subtle-fill-strong text-fg-muted hover:text-fg-secondary transition-all text-xs font-sans",title:"Copy raw packet hex",children:r?s.jsxs(s.Fragment,{children:[s.jsx(_,{className:"w-3.5 h-3.5 text-sys-green"}),s.jsx("span",{className:"text-sys-green",children:"Copied"})]}):s.jsxs(s.Fragment,{children:[s.jsx(ye,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Copy"})]})})]})}function Ms({bits:e,field:t,value:a,binary:n}){return s.jsxs("tr",{children:[s.jsx("td",{className:"py-1.5 text-xs text-fg-muted tabular-nums",children:e}),s.jsx("td",{className:"py-1.5 text-sm text-fg-secondary",children:t}),s.jsx("td",{className:"py-1.5",children:(()=>{if("Payload Type"===t){const e=le[a]||"zinc";return s.jsx(h,{color:e,children:a})}if("Route Type"===t){const e=ne[a]||"zinc";return s.jsx(h,{color:e,children:a})}return s.jsx("span",{className:"text-sm text-fg-primary",children:a})})()}),s.jsx("td",{className:"py-1.5 type-data-xs text-sys-cyan",children:n})]})}function Ts({id:e,title:t,color:a,hexBytes:n,startByte:l,endByte:r,isSelected:i,children:c}){const o=n?ys(n):[];return s.jsxs(C.div,{layout:"position",layoutId:e,transition:ws,className:"w-full min-w-0 overflow-hidden rounded-xl p-4 sm:p-5 space-y-4",style:{backgroundColor:Ns,boxShadow:Cs(i,a)},children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 min-w-0",children:[s.jsx(h,{color:a,children:t}),o.length>0&&o.length<=16&&o.map((e,t)=>s.jsx(h,{color:a,className:"font-mono",children:e.toUpperCase()},t))]}),s.jsxs("span",{className:"type-data-xs text-fg-muted flex-shrink-0",children:["Bytes ",l,"-",r]})]}),s.jsx("div",{className:"min-w-0 overflow-hidden",children:c})]})}function Ps({advert:e,timestamp:t}){const a=M(t||e.timestamp);return s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-indigo/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[s.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-indigo) 0%, var(--sys-blue) 100%)"},children:s.jsx(g,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:e.name||"Unknown Node"}),s.jsx("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:e.nodeType})]})]}),s.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),s.jsxs("div",{className:"px-4 py-3 space-y-2",children:[void 0!==e.latitude&&void 0!==e.longitude&&s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(be,{className:"w-4 h-4 text-sys-indigo flex-shrink-0"}),s.jsxs("span",{className:"text-sm text-fg-secondary font-mono",children:[e.latitude.toFixed(5),"°, ",e.longitude.toFixed(5),"°"]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(T,{className:"w-4 h-4 text-sys-indigo flex-shrink-0"}),s.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:a})]})]})]})})}function Bs({decoded:e,timestamp:t}){const a=t?M(t):"Unknown";return s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-teal/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[s.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-teal) 0%, var(--sys-cyan) 100%)"},children:s.jsx(He,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:e.channelName||"Channel Data"}),s.jsxs("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:[e.dataLength," bytes • ",e.decrypted?"Decrypted":"Encrypted"]})]})]}),s.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),s.jsxs("div",{className:"px-4 py-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(we,{className:"w-4 h-4 text-sys-teal flex-shrink-0"}),s.jsxs("span",{className:"text-sm text-fg-secondary font-sans",children:["Channel: ",s.jsxs("span",{className:"font-mono",children:["0x",e.channelHash]})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(T,{className:"w-4 h-4 text-sys-teal flex-shrink-0"}),s.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:a})]}),e.decrypted&&e.decryptedHex&&s.jsxs("div",{className:"mt-2 pt-2 border-t border-edge-subtle",children:[s.jsx("p",{className:"type-micro text-fg-muted mb-1 font-sans",children:"Decrypted Data"}),s.jsx("div",{className:"max-w-full overflow-x-auto",children:s.jsx(ve,{size:"compact",copy:!0,className:"inline-block",children:s.jsx("span",{className:"break-all text-xs",children:e.decryptedHex.toUpperCase()})})})]})]})]})})}function Fs({decoded:e,timestamp:t,isLoading:n=!1,onDecrypted:l}){const r=t?M(t):"Unknown",[i,c]=a.useState(""),[o,d]=a.useState(!1),[x,m]=a.useState(null),[h,u]=a.useState(!1),g=a.useCallback(async()=>{if(i.trim()&&e.ciphertextHex&&e.macHex){d(!0),m(null);try{const s=parseInt(e.channelHash,16),t=p(e.macHex),a=p(e.ciphertextHex),n=await P(i.trim(),s,t,a);if(n.success){const s=n.result.plaintext,t=new TextDecoder("utf-8",{fatal:!1}).decode(s.slice(5)),a=t.indexOf(": "),r={...e,channelName:n.result.channelName,decrypted:!0,timestamp:s[0]|s[1]<<8|s[2]<<16|s[3]<<24,flags:s[4],senderName:a>0?t.slice(0,a):void 0,text:a>0?t.slice(a+2):t};null==l||l(r),c(""),u(!1)}else m(n.error)}catch(s){m(s instanceof Error?s.message:"Unknown error")}finally{d(!1)}}},[i,e,l]);return n?s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-xl p-4 sm:p-5",style:{backgroundColor:"color-mix(in srgb, var(--elevated) 60%, var(--body))",boxShadow:"\n inset 0 0 0 1px color-mix(in srgb, var(--fg-primary) 6%, transparent),\n inset 0 1px 0 color-mix(in srgb, white 3%, transparent),\n 0 1px 2px color-mix(in srgb, black 5%, transparent)\n "},children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3 h-[15px]",children:[s.jsx("div",{className:"h-2.5 w-12 rounded bg-subtle-fill-hover animate-pulse"}),s.jsx("div",{className:"h-2.5 w-16 rounded bg-subtle-fill-hover animate-pulse"})]}),s.jsx("div",{className:"inline-block max-w-[85%] px-3.5 py-2 rounded-2xl rounded-tl-md",style:{background:"color-mix(in srgb, var(--sys-blue) 30%, transparent)"},children:s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("div",{className:"h-3.5 w-48 rounded bg-subtle-fill-strong animate-pulse"}),s.jsx("div",{className:"h-3.5 w-32 rounded bg-subtle-fill-strong animate-pulse"})]})})]})}):e.decrypted?s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-xl p-4 sm:p-5",style:{backgroundColor:"color-mix(in srgb, var(--elevated) 60%, var(--body))",boxShadow:"\n inset 0 0 0 1px color-mix(in srgb, var(--fg-primary) 6%, transparent),\n inset 0 1px 0 color-mix(in srgb, white 3%, transparent),\n 0 1px 2px color-mix(in srgb, black 5%, transparent)\n "},children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.senderName&&s.jsxs("span",{className:"text-[11px] text-fg-muted font-sans",children:["From ",s.jsx("span",{className:"text-fg-secondary font-medium",children:e.senderName})]}),e.channelName&&s.jsxs("span",{className:"text-[11px] text-fg-muted font-sans",children:["in ",s.jsx("span",{className:"text-sys-cyan font-medium",children:e.channelName})]})]}),s.jsx("div",{className:"inline-block max-w-[85%] px-3.5 py-2 rounded-2xl rounded-tl-md",style:{background:"linear-gradient(135deg, var(--sys-blue) 0%, color-mix(in srgb, var(--sys-blue) 85%, var(--sys-cyan)) 100%)"},children:s.jsx("p",{className:"text-sm text-white font-sans leading-relaxed whitespace-pre-wrap break-words",children:e.text})})]})}):s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-2xl overflow-hidden bg-zinc-500/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[s.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--zinc-500) 0%, color-mix(in srgb, var(--zinc-500) 70%, black) 100%)"},children:s.jsx(Fe,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:e.isPublicHashChannel?"Public Hash Channel":"Encrypted Message"}),s.jsxs("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:["Channel hash: ",s.jsxs("span",{className:"font-mono",children:["0x",e.channelHash]})]})]})]}),s.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),s.jsxs("div",{className:"px-4 py-3 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(T,{className:"w-4 h-4 text-zinc-400 flex-shrink-0"}),s.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:r})]}),e.ciphertextHex&&e.macHex&&s.jsx("div",{className:"space-y-2",children:h?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:i,onChange:e=>c(e.target.value),placeholder:"Channel name (e.g. south-bay)",className:"flex-1 px-3 py-1.5 text-sm rounded-lg bg-subtle-fill-strong border border-edge-subtle text-fg-primary placeholder:text-fg-muted focus:outline-none focus:border-zinc-500",onKeyDown:e=>"Enter"===e.key&&g(),disabled:o}),s.jsx("button",{onClick:g,disabled:o||!i.trim(),className:"px-3 py-1.5 text-sm font-medium rounded-lg bg-zinc-600 hover:bg-zinc-500 text-white disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o?"Testing...":"Try"}),s.jsx("button",{onClick:()=>{u(!1),m(null),c("")},className:"px-2 py-1.5 text-sm rounded-lg hover:bg-subtle-fill-strong text-fg-muted transition-colors",children:"×"})]}),x&&s.jsx("p",{className:"text-xs text-sys-red",children:x})]}):s.jsx("button",{onClick:()=>u(!0),className:"text-xs text-zinc-400 hover:text-zinc-300 underline underline-offset-2 transition-colors",children:"Know the channel name? Try to decrypt"})}),!h&&s.jsx("p",{className:"text-xs text-fg-muted",children:e.isPublicHashChannel?"Public hash channel message. Key not in common channel list.":"Unknown hash channel. Channel name required for decryption."})]})]})})}function Ls({decoded:e,timestamp:t}){const a=t?M(t):"Unknown";return s.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:"linear-gradient(135deg, var(--sys-green) 0%, var(--sys-teal) 100%)"},children:s.jsx(_e,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-sm font-semibold text-fg-primary font-sans",children:"Acknowledgment"}),s.jsxs("p",{className:"text-xs text-fg-muted font-sans mt-0.5",children:["CRC: ",s.jsxs("span",{className:"font-mono text-sys-green",children:["0x",e.crc]})," · ",a]})]})]})}function Ds({decoded:e,timestamp:t}){const a=t?M(t):"Unknown",n=e.path.length;return s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-amber/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[s.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-amber) 0%, var(--sys-orange) 100%)"},children:s.jsx(Ce,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:"Path Response"}),s.jsxs("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:[n," ",1===n?"hop":"hops"]})]})]}),s.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),s.jsxs("div",{className:"px-4 py-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(T,{className:"w-4 h-4 text-sys-amber flex-shrink-0"}),s.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:a})]}),e.path.length>0&&s.jsx("div",{className:"mt-2 pt-2 border-t border-edge-subtle",children:s.jsx("div",{className:"flex flex-wrap items-center gap-2",children:e.path.map((e,t)=>s.jsxs("div",{className:"flex items-center gap-2",children:[t>0&&s.jsx(oe,{className:"w-4 h-4 text-sys-amber"}),s.jsx(h,{color:"amber",className:"font-mono",children:e})]},t))})})]})]})})}function zs({decoded:e,timestamp:t}){const a=t?M(t):"Unknown",n=e.pathHashes.length,l=e.snrValues.length;return s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-blue/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[s.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-blue) 0%, var(--sys-indigo) 100%)"},children:s.jsx(Se,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:["Trace ",e.isComplete?"Complete":"In Progress"]}),s.jsxs("p",{className:"text-sm text-fg-muted mt-0.5",children:["Tag: 0x",e.traceTag.slice(0,8),e.isComplete&&" • ✓"]})]})]}),s.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),s.jsxs("div",{className:"px-4 py-3 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(T,{className:"w-4 h-4 text-sys-blue flex-shrink-0"}),s.jsx("span",{className:"text-sm text-fg-secondary",children:a})]}),s.jsxs("div",{className:"flex items-center gap-4 text-xs text-fg-muted",children:[s.jsxs("span",{children:[n," target ",1===n?"hop":"hops"]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:[l," SNR ",1===l?"sample":"samples"]}),0!==e.authCode&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"•"}),s.jsxs("span",{children:["Auth: ",e.authCode]})]})]}),e.pathHashes.length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:e.pathHashes.map((t,a)=>{const n=e.snrValues[a],l=void 0!==n?(e=>e>=7?"green":e>=0?"yellow":e>=-5?"orange":"red")(n):"zinc",r=void 0!==n;return s.jsxs("div",{className:"flex items-center gap-2",children:[a>0&&s.jsx(oe,{className:"w-4 h-4 text-sys-blue flex-shrink-0"}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(h,{color:r?"blue":"zinc",className:"font-mono",children:t}),r&&s.jsxs(h,{color:l,className:"font-mono",children:[n>=0?"+":"",Number.isInteger(n)?n:n.toFixed(1),"dB"]})]})]},a)})})]})]})})}function Rs({decoded:e,timestamp:t}){const a=t?M(t):"Unknown";return e.encrypted?s.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:"linear-gradient(135deg, var(--sys-indigo) 0%, var(--sys-blue) 100%)"},children:s.jsx(Fe,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-sm font-semibold text-fg-primary font-sans",children:"Encrypted Message"}),s.jsxs("p",{className:"text-xs text-fg-muted font-sans mt-0.5",children:[e.srcHash," → ",e.destHash," · ",a]})]})]}):s.jsxs("div",{className:"mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1.5 px-1",children:[s.jsxs("span",{className:"text-[11px] text-fg-muted font-sans",children:[s.jsx("span",{className:"font-mono text-fg-secondary",children:e.srcHash})," → ",s.jsx("span",{className:"font-mono text-fg-secondary",children:e.destHash})]}),s.jsxs("span",{className:"text-[11px] text-fg-muted font-sans",children:["· ",a]})]}),s.jsx("div",{className:"inline-block max-w-[85%] px-3.5 py-2 rounded-2xl rounded-tr-md ml-auto",style:{background:"linear-gradient(135deg, var(--sys-green) 0%, var(--sys-teal) 100%)"},children:s.jsx("p",{className:"text-sm text-white font-sans leading-relaxed whitespace-pre-wrap break-words",children:e.text})})]})}function As({decoded:e,timestamp:t}){const a=t?M(t):"Unknown",n=(e.partNumber+1)/e.totalParts*100;return s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-yellow/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[s.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-yellow) 0%, var(--sys-amber) 100%)"},children:s.jsx(ke,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:"Multipart Segment"}),s.jsxs("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:["Part ",e.partNumber+1," of ",e.totalParts]})]})]}),s.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),s.jsxs("div",{className:"px-4 py-3 space-y-3",children:[s.jsx("div",{children:s.jsx("div",{className:"h-2 bg-subtle-fill-strong rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${n}%`,background:"linear-gradient(90deg, var(--sys-yellow), var(--sys-amber))"}})})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(we,{className:"w-4 h-4 text-sys-yellow flex-shrink-0"}),s.jsxs("span",{className:"text-sm text-fg-secondary font-sans",children:["Message ID: ",s.jsx("span",{className:"font-mono",children:e.messageId})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(T,{className:"w-4 h-4 text-sys-yellow flex-shrink-0"}),s.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:a})]})]})]})})}function $s({decoded:e,timestamp:t,payloadType:a}){const n=t?M(t):"Unknown",l=(()=>{switch(a){case S.REQ:return{icon:B,gradient:"var(--sys-orange), var(--sys-red)",bg:"rgba(249, 115, 22, 0.15)",label:"Request"};case S.RESPONSE:return{icon:De,gradient:"var(--sys-green), var(--sys-teal)",bg:"rgba(34, 197, 94, 0.15)",label:"Response"};case S.ANON_REQ:return{icon:Fe,gradient:"var(--sys-indigo), var(--sys-pink)",bg:"rgba(91, 91, 214, 0.15)",label:"Anonymous Request"};default:return{icon:me,gradient:"var(--sys-gray), var(--sys-slate)",bg:"rgba(107, 114, 128, 0.15)",label:e.payloadTypeName}}})(),r=l.icon;return s.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:`linear-gradient(135deg, ${l.gradient})`},children:s.jsx(r,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-sm font-semibold text-fg-primary font-sans",children:l.label}),s.jsxs("p",{className:"text-xs text-fg-muted font-sans mt-0.5",children:[e.length," bytes · ",n]})]})]})}function Es({pathHex:e}){if(!e)return null;const t=ys(e);return s.jsx("div",{className:"flex flex-wrap items-center gap-2 py-2",children:t.map((e,t)=>s.jsxs("div",{className:"flex items-center gap-2",children:[t>0&&s.jsx(oe,{className:"w-4 h-4 text-sys-amber flex-shrink-0"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(ve,{size:"compact",copy:!0,children:e.toUpperCase()}),s.jsx("span",{className:"text-xs text-fg-muted font-sans tabular-nums w-4 text-left",children:t+1})]})]},t))})}function Us({decoded:e,payloadType:t}){const a=H[t]||`TYPE_${t}`;switch(e.type){case"advert":{const t="chat"===e.nodeType?"companion":e.nodeType.replace("_"," "),a=void 0!==e.latitude&&void 0!==e.longitude&&!(0===e.latitude&&0===e.longitude);return s.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Role:"})," ",t]}),e.name&&s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Name:"})," ",e.name]}),a&&s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Location:"})," ",e.latitude.toFixed(4),"°, ",e.longitude.toFixed(4),"°"]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Time:"})," ",M(e.timestamp)]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Flags:"})," ",e.flagsDescription]})]})}case"ack":return s.jsx("div",{className:"text-xs text-fg-primary space-y-0.5",children:s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"CRC:"})," 0x",e.crc]})});case"path":return s.jsx("div",{className:"text-xs text-fg-primary space-y-1",children:s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Path:"})," ",e.pathString||"(empty)"]})});case"trace":return s.jsxs("div",{className:"text-xs text-fg-primary space-y-1",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Tag:"})," 0x",e.traceTag]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Target Path:"})," ",e.pathString||"(empty)"]}),e.snrValues.length>0&&s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"SNR:"})," ",e.snrValues.map(e=>`${e>=0?"+":""}${Number.isInteger(e)?e:e.toFixed(1)}dB`).join(" → ")]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Status:"})," ",e.isComplete?"✓ Complete":`In progress (${e.snrValues.length}/${e.pathHashes.length})`]})]});case"txt_msg":return s.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Dest:"})," ",e.destHash]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Src:"})," ",e.srcHash]}),e.encrypted?s.jsx("p",{className:"text-fg-muted italic",children:"Encrypted content"}):s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Text:"})," ",e.text]})]});case"grp_txt":return s.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Channel:"})," ",e.channelName?s.jsx("span",{className:"text-sys-green",children:e.channelName}):e.isPublicHashChannel?s.jsx("span",{className:"text-sys-indigo",children:"Public Hash Channel"}):s.jsxs("span",{className:"font-mono",children:["0x",e.channelHash]})]}),e.decrypted?s.jsxs(s.Fragment,{children:[e.senderName&&s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"From:"})," ",e.senderName]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Text:"})," ",e.text]})]}):e.isPublicHashChannel?s.jsx("p",{className:"text-fg-muted italic",children:"Encrypted (public hash channel)"}):s.jsx("p",{className:"text-fg-muted italic",children:"Encrypted (unknown channel)"})]});case"grp_data":return s.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Channel:"})," ",e.channelName?s.jsx("span",{className:"text-sys-teal",children:e.channelName}):s.jsxs("span",{className:"font-mono",children:["0x",e.channelHash]})]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Data:"})," ",e.dataLength," bytes ",e.decrypted?"(decrypted)":"(encrypted)"]})]});case"multipart":return s.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Part:"})," ",e.partNumber+1,"/",e.totalParts]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Message ID:"})," ",e.messageId]})]});default:return s.jsxs("p",{className:"text-xs text-fg-secondary",children:[a," (",e.length," bytes)"]})}}const Is=a.memo(function({packet:e,decodedGrpTxt:t}){var n,l;const r=e.raw_packet||"",i=r.length/2,c=k(),[o,d]=a.useState(null),[p,u]=a.useState(null),[g,f]=a.useState(!1),[y,j]=a.useState(null),b=a.useCallback(e=>{j(s=>s===e?null:e)},[]),N=a.useMemo(()=>function(e){if(!e||e.length<4)return null;const s=q.fromHex(e);if(!s.success||!s.packet)return null;const t=s.packet,a=function(e){const s=3&e,t=e>>2&15,a=e>>6&3;return[{bits:"0-1",field:"Route Type",value:x(s),binary:(3&s).toString(2).padStart(2,"0")},{bits:"2-5",field:"Payload Type",value:m(t),binary:(15&t).toString(2).padStart(4,"0")},{bits:"6-7",field:"Version",value:a.toString(),binary:(3&a).toString(2).padStart(2,"0")}]}(t.header),n=e.slice(0,2);let l=2,r="";t.hasTransportCodes()&&(r=e.slice(2,10),l=10);const i=e.slice(l,l+2),c=l+2,o=c+2*t.pathLen,d=e.slice(c,o),p=e.slice(o),h=K(t);return{packet:t,headerHex:n,headerFields:a,transportCodesHex:r,pathLengthHex:i,pathDataHex:d,payloadHex:p,payloadStartByte:Math.floor(o/2),decoded:h}}(r),[r]),v=null==(n=null==N?void 0:N.packet)?void 0:n.payloadType,_=(null==N?void 0:N.payloadHex)||"",H=null==(l=null==N?void 0:N.packet)?void 0:l.payload,T=v===S.GRP_TXT,P=v===S.GRP_DATA,B=T&&!t&&(!c||g);if(a.useEffect(()=>{if(d(null),f(!1),t)return;if(!T||!H||H.length<4)return;if(!c)return void f(!0);f(!0);let e=!1;return J(H).then(s=>{e||(d(s),f(!1))}),()=>{e=!0}},[_,T,c,t]),a.useEffect(()=>{if(u(null),!P||!H||H.length<4)return;if(!c)return;let e=!1;return Z(H).then(s=>{e||u(s)}),()=>{e=!0}},[_,P,c]),!N||0===r.length)return s.jsx("div",{className:"p-4 text-center text-fg-muted",children:s.jsx("p",{className:"text-sm",children:"No raw packet data available"})});const{packet:F}=N;let L=N.decoded;t&&"grp_txt"===N.decoded.type?L=t:o&&"grp_txt"===N.decoded.type?L=o:p&&"grp_data"===N.decoded.type&&(L=p);const D=a.useMemo(()=>function(e,t){switch(e.type){case"advert":return function(e,t){const a=[];let n=0;const l=t.slice(0,64);a.push({id:"payload:publicKey",title:"Public Key",color:"pink",hex:l,startByte:n,endByte:n+31,decoded:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:e.publicKey.toUpperCase()}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Ed25519 public key (32 bytes)"})]})}),n+=32;const r=t.slice(64,72);a.push({id:"payload:timestamp",title:"Timestamp",color:"orange",hex:r,startByte:n,endByte:n+3,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:r.toUpperCase()}),s.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:[e.timestamp," (",M(e.timestamp),")"]})]})}),n+=4;const i=t.slice(72,200);a.push({id:"payload:signature",title:"Signature",color:"teal",hex:i,startByte:n,endByte:n+63,decoded:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:e.signature.toUpperCase()}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Ed25519 signature (64 bytes)"})]})}),n+=64;const c=t.slice(200,202);if(a.push({id:"payload:flags",title:"Flags",color:"blue",hex:c,startByte:n,endByte:n,decoded:s.jsxs(s.Fragment,{children:[s.jsxs(ve,{size:"standard",copy:!0,children:["0x",e.flags.toString(16).padStart(2,"0").toUpperCase()]}),s.jsx("p",{className:"text-xs text-fg-primary mt-1",children:e.flagsDescription}),s.jsxs("p",{className:"text-xs text-fg-muted",children:["Node Type: ",e.nodeType]})]})}),n+=1,void 0!==e.latitude){const l=t.slice(2*n,2*n+8);a.push({id:"payload:latitude",title:"Latitude",color:"green",hex:l,startByte:n,endByte:n+3,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:l.toUpperCase()}),s.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:[e.latitude.toFixed(6),"°"]})]})}),n+=4}if(void 0!==e.longitude){const l=t.slice(2*n,2*n+8);a.push({id:"payload:longitude",title:"Longitude",color:"indigo",hex:l,startByte:n,endByte:n+3,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:l.toUpperCase()}),s.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:[e.longitude.toFixed(6),"°"]})]})}),n+=4}if(e.name){const l=t.slice(2*n),r=l.length/2;a.push({id:"payload:name",title:"Name",color:"amber",hex:l,startByte:n,endByte:n+r-1,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:l.toUpperCase()}),s.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:['"',e.name,'"']})]})})}return a}(e,t);case"ack":return function(e,t){return[{id:"payload:crc",title:"CRC",color:"green",hex:t.slice(0,8),startByte:0,endByte:3,decoded:s.jsxs(s.Fragment,{children:[s.jsxs(ve,{size:"standard",copy:!0,children:["0x",e.crc]}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"CRC32 of acknowledged packet"})]})}]}(e,t);case"grp_txt":return function(e,t){const a=[];a.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:t.slice(0,2),startByte:0,endByte:0,decoded:s.jsxs(s.Fragment,{children:[s.jsxs(ve,{size:"standard",copy:!0,children:["0x",e.channelHash]}),e.channelName&&s.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:["Channel: ",e.channelName]})]})}),e.macHex&&a.push({id:"payload:mac",title:"MAC",color:"indigo",hex:t.slice(2,6),startByte:1,endByte:2,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:e.macHex.toUpperCase()}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=t.slice(6);return n&&a.push({id:"payload:ciphertext",title:e.decrypted?"Message":"Ciphertext",color:e.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:e.decrypted?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-sm text-fg-primary",children:['"',e.text,'"']}),e.senderName&&s.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:["From: ",e.senderName]})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:n.toUpperCase()}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"AES-128-ECB encrypted"})]})}),a}(e,t);case"grp_data":return function(e,t){const a=[];a.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:t.slice(0,2),startByte:0,endByte:0,decoded:s.jsxs(s.Fragment,{children:[s.jsxs(ve,{size:"standard",copy:!0,children:["0x",e.channelHash]}),e.channelName&&s.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:["Channel: ",e.channelName]})]})}),e.macHex&&a.push({id:"payload:mac",title:"MAC",color:"indigo",hex:t.slice(2,6),startByte:1,endByte:2,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:e.macHex.toUpperCase()}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=t.slice(6);return n&&a.push({id:"payload:ciphertext",title:e.decrypted?"Decrypted Data":"Encrypted Data",color:e.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:(e.decryptedHex||n).toUpperCase()}),s.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[e.dataLength," bytes",e.decrypted?"":" (AES-128-ECB encrypted)"]})]})}),a}(e,t);case"path":return function(e,t){return[{id:"payload:path",title:"Path Hops",color:"amber",hex:t,startByte:0,endByte:t.length/2-1,decoded:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-wrap items-center gap-1",children:e.path.map((e,t)=>s.jsxs("span",{className:"flex items-center gap-1",children:[t>0&&s.jsx(oe,{className:"w-3 h-3 text-fg-muted"}),s.jsx(h,{color:"amber",className:"font-mono",children:e})]},t))}),s.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[e.path.length," hops"]})]})}]}(e,t);case"trace":return function(e,t){const a=[];a.push({id:"payload:crc",title:"Trace Tag",color:"blue",hex:t.slice(0,8),startByte:0,endByte:3,decoded:s.jsxs(s.Fragment,{children:[s.jsxs(ve,{size:"standard",copy:!0,children:["0x",e.traceTag]}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Unique trace request identifier"})]})}),a.push({id:"payload:mac",title:"Auth Code",color:"indigo",hex:t.slice(8,16),startByte:4,endByte:7,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:e.authCode}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Authentication/verification code"})]})}),a.push({id:"payload:flags",title:"Flags",color:"amber",hex:t.slice(16,18),startByte:8,endByte:8,decoded:s.jsxs(s.Fragment,{children:[s.jsxs(ve,{size:"standard",copy:!0,children:["0x",e.flags.toString(16).toUpperCase().padStart(2,"0")]}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:0===e.flags?"No flags set":`Flags: ${e.flags.toString(2).padStart(8,"0")}b`})]})});const n=t.slice(18);if(n){const t=e=>e>=7?"green":e>=0?"yellow":e>=-5?"orange":"red";a.push({id:"payload:path",title:"Target Path",color:"indigo",hex:n,startByte:9,endByte:9+n.length/2-1,decoded:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-wrap items-center gap-1",children:e.pathHashes.map((a,n)=>{const l=e.snrValues[n],r=void 0!==l?t(l):"zinc";return s.jsxs("span",{className:"flex items-center gap-1",children:[n>0&&s.jsx(oe,{className:"w-3 h-3 text-fg-muted"}),s.jsx(h,{color:"indigo",className:"font-mono",children:a}),void 0!==l&&s.jsxs(h,{color:r,className:"font-mono",children:[l>=0?"+":"",Number.isInteger(l)?l:l.toFixed(1),"dB"]})]},n)})}),s.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[e.pathHashes.length," target ",1===e.pathHashes.length?"hop":"hops",e.snrValues.length>0&&` • ${e.snrValues.length} SNR ${1===e.snrValues.length?"value":"values"} collected`,e.isComplete&&" • ✓ Complete"]})]})})}return a}(e,t);case"multipart":return function(e,t){const a=[];a.push({id:"payload:msgId",title:"Message ID",color:"blue",hex:t.slice(0,4),startByte:0,endByte:1,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:e.messageId.toUpperCase()}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Unique message identifier"})]})}),a.push({id:"payload:partNum",title:"Part Number",color:"amber",hex:t.slice(4,6),startByte:2,endByte:2,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:e.partNumber}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"0-indexed part number"})]})}),a.push({id:"payload:totalParts",title:"Total Parts",color:"orange",hex:t.slice(6,8),startByte:3,endByte:3,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:e.totalParts}),s.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:["Part ",e.partNumber+1," of ",e.totalParts]})]})});const n=t.slice(8);return n&&a.push({id:"payload:partData",title:"Part Data",color:"cyan",hex:n,startByte:4,endByte:4+n.length/2-1,decoded:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:n.toUpperCase()}),s.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[n.length/2," bytes"]})]})}),a}(e,t);default:return[{id:"payload:ciphertext",title:"Raw Data",color:"zinc",hex:t,startByte:0,endByte:t.length/2-1,decoded:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:t.toUpperCase()}),s.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[t.length/2," bytes"]})]})}]}}(L,N.payloadHex),[L,N.payloadHex]),z="payload"===y||js(y),R=a.useMemo(()=>{const e=[{id:"header",hex:N.headerHex,color:"red"},...N.transportCodesHex?[{id:"transportCodes",hex:N.transportCodesHex,color:"indigo"}]:[],{id:"pathLength",hex:N.pathLengthHex,color:"green"},...N.pathDataHex?[{id:"pathData",hex:N.pathDataHex,color:"amber"}]:[]];return z?[...e,...(s=D,s.map(e=>({id:e.id,hex:e.hex,color:e.color})))]:[...e,{id:"payload",hex:N.payloadHex,color:"cyan"}];var s},[N,z,D]);return s.jsxs("div",{className:"font-mono space-y-2 min-w-0 overflow-hidden",children:[(()=>{switch(L.type){case"advert":return s.jsx(Ps,{advert:L,timestamp:e.timestamp});case"grp_data":return s.jsx(Bs,{decoded:L,timestamp:e.timestamp});case"grp_txt":return s.jsx(Fs,{decoded:L,timestamp:e.timestamp,isLoading:B,onDecrypted:d});case"ack":return s.jsx(Ls,{decoded:L,timestamp:e.timestamp});case"path":return s.jsx(Ds,{decoded:L,timestamp:e.timestamp});case"trace":return s.jsx(zs,{decoded:L,timestamp:e.timestamp});case"txt_msg":return s.jsx(Rs,{decoded:L,timestamp:e.timestamp});case"multipart":return s.jsx(As,{decoded:L,timestamp:e.timestamp});case"generic":return F.payloadType===S.REQ||F.payloadType===S.RESPONSE||F.payloadType===S.ANON_REQ?s.jsx($s,{decoded:L,timestamp:e.timestamp,payloadType:F.payloadType}):null;default:return null}})(),s.jsx(Hs,{rawHex:r,hexSegments:R,selectedSegment:y,onSegmentClick:b}),s.jsx(w,{children:s.jsx(C.div,{layout:!0,transition:ws,className:"space-y-2 min-w-0",children:(()=>{var e,t,a,n;const l=[{id:"header",title:"Header",color:"red",startByte:0,endByte:0,hexBytes:`0x${N.headerHex.toUpperCase()}`,condition:!0,content:s.jsxs("table",{className:"w-full text-left",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"type-micro text-fg-muted border-b border-edge-subtle font-sans",children:[s.jsx("th",{className:"py-1 font-medium",children:"Bits"}),s.jsx("th",{className:"py-1 font-medium",children:"Field"}),s.jsx("th",{className:"py-1 font-medium",children:"Value"}),s.jsx("th",{className:"py-1 font-medium",children:"Binary"})]})}),s.jsx("tbody",{children:N.headerFields.map(e=>s.jsx(Ms,{...e},e.bits))})]})},{id:"transportCodes",title:"Transport Codes",color:"indigo",startByte:1,endByte:4,hexBytes:(null==(e=N.transportCodesHex)?void 0:e.toUpperCase())||"",condition:!!N.transportCodesHex,content:s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-xs text-fg-muted",children:"Two 16-bit transport codes for encrypted routing"}),s.jsxs("div",{className:"mt-1 text-xs text-fg-secondary",children:["Code 1: 0x",null==(t=N.transportCodesHex)?void 0:t.slice(0,4).toUpperCase()," | Code 2: 0x",null==(a=N.transportCodesHex)?void 0:a.slice(4,8).toUpperCase()]})]})},{id:"pathLength",title:"Path Length",color:"green",startByte:N.transportCodesHex?5:1,endByte:N.transportCodesHex?5:1,hexBytes:`0x${N.pathLengthHex.toUpperCase()}`,condition:!0,content:s.jsxs("p",{className:"text-xs text-fg-muted pt-1",children:[F.pathLen," bytes showing route taken (increases as packet floods)"]})},{id:"pathData",title:"Path Data",color:"amber",startByte:N.transportCodesHex?6:2,endByte:(N.transportCodesHex?5:1)+F.pathLen,hexBytes:(null==(n=N.pathDataHex)?void 0:n.toUpperCase())||"",condition:F.pathLen>0,content:s.jsxs("div",{className:"space-y-3",children:[s.jsx(Es,{pathHex:N.pathDataHex}),s.jsx("p",{className:"text-xs text-fg-muted",children:"Historical route taken (bytes are added as packet floods through network)"})]})},{id:"payload",title:"Payload",color:"cyan",startByte:N.payloadStartByte,endByte:i-1,hexBytes:N.payloadHex.toUpperCase(),condition:!0,content:s.jsxs(s.Fragment,{children:[!js(y)&&s.jsxs("div",{className:"p-3 rounded-lg bg-black",children:[s.jsx("p",{className:"type-micro text-fg-muted mb-1.5 font-sans",children:"Decoded"}),s.jsx(Us,{decoded:L,payloadType:F.payloadType})]}),!js(y)&&D.length>0&&s.jsx("p",{className:"type-micro text-fg-muted mt-3 font-sans",children:"Click a field below to highlight its bytes"}),js(y)&&s.jsx("p",{className:"type-micro text-fg-muted font-sans",children:"↑ Selected field above • Other fields below ↓"})]})}].filter(e=>e.condition),r=js(y)?D.find(e=>e.id===y):null,c=js(y)?[...l].sort((e,s)=>"payload"===e.id?-1:"payload"===s.id?1:0):[...l].sort((e,s)=>e.id===y?-1:s.id===y?1:0),o=js(y)?D.filter(e=>e.id!==y):[];return s.jsxs(s.Fragment,{children:[r&&s.jsx(Ts,{id:`subfield-${r.id}`,title:r.title,color:r.color,startByte:N.payloadStartByte+r.startByte,endByte:N.payloadStartByte+r.endByte,hexBytes:r.hex.toUpperCase(),isSelected:!0,children:r.decoded},r.id),c.map(e=>s.jsx(Ts,{id:`section-${e.id}`,title:e.title,color:e.color,startByte:e.startByte,endByte:e.endByte,hexBytes:e.hexBytes,isSelected:e.id===y,children:e.content},e.id)),o.map(e=>s.jsxs(C.div,{layout:"position",layoutId:`subfield-${e.id}`,transition:ws,className:"w-full min-w-0 overflow-hidden rounded-xl p-4 sm:p-5 space-y-4",style:{backgroundColor:Ns,boxShadow:vs},children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 min-w-0",children:[s.jsx(h,{color:e.color,children:e.title}),e.hex.length<=32&&ys(e.hex).map((t,a)=>s.jsx(h,{color:e.color,className:"font-mono",children:t.toUpperCase()},a))]}),s.jsxs("span",{className:"type-data-xs text-fg-muted flex-shrink-0",children:["Bytes ",N.payloadStartByte+e.startByte,"-",N.payloadStartByte+e.endByte]})]}),s.jsx("div",{className:"min-w-0 overflow-hidden p-3 rounded-lg bg-black",children:e.decoded})]},e.id))]})})()})})]})});function Vs(e){if(!e)return[];if(Array.isArray(e))return e;try{const s=JSON.parse(e);return Array.isArray(s)?s:[]}catch{return[]}}function Os(e){return e?(e.startsWith("0x")?e.slice(2):e).slice(0,2).toUpperCase():""}function Qs({hop:e,compact:n=!1,index:l=0,highlightIndex:r=-1,isTrace:i=!1}){var c;const o=l===r,d=Ie();return a.useEffect(()=>{o&&i&&d.start({boxShadow:["0 0 0 0px rgba(113, 156, 223, 0)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 0px rgba(113, 156, 223, 0)"],transition:{duration:.5,times:[0,.2,.7,1],ease:"easeInOut"}})},[o,i,d]),s.jsxs(C.div,{className:t("flex items-center gap-1.5",n?"flex-row":"flex-col"),animate:{scale:o?1.05:1,opacity:o?1:.85},transition:{duration:.3,ease:"easeInOut"},children:[s.jsxs(C.div,{className:t("flex items-center gap-1.5 px-2.5 py-1 rounded-md","font-mono text-xs font-semibold",e.isLocal?"bg-sys-amber/20 text-sys-amber ring-1 ring-sys-amber/30":"bg-elevated/50 text-fg-primary ring-1 ring-edge-strong/50"),animate:d,initial:{boxShadow:"0 0 0 0px rgba(113, 156, 223, 0)"},children:[e.isLocal&&s.jsx(Me,{className:"w-3 h-3"}),s.jsx("span",{children:e.prefix}),void 0!==e.confidence&&e.confidence<.9&&s.jsxs("span",{className:"text-[9px] opacity-70",children:[(100*e.confidence).toFixed(0),"%"]})]}),!n&&(null==(c=e.neighborInfo)?void 0:c.name)&&s.jsx("span",{className:"text-xs text-fg-muted truncate max-w-[80px]",children:e.neighborInfo.name})]})}function Gs({snr:e}){const t=L(e),a=F()[t]||"#6b7280",n=Number.isInteger(e)?e.toString():e.toFixed(1);return s.jsxs(h,{customColor:a,compact:!0,className:"font-mono",children:[e>=0?"+":"",n,"dB"]})}function Ws({hops:e,compact:n,isTrace:l=!1}){const[r,i]=a.useState(-1);return a.useEffect(()=>{if(0===e.length)return;const s=setTimeout(()=>{i(0)},400),t=setInterval(()=>{i(s=>{const a=s+1;return a>=e.length?(clearInterval(t),-1):a})},l?500:600);return()=>{clearTimeout(s),clearInterval(t)}},[e.length,l]),s.jsx("div",{className:"p-6",style:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"4px 8px"},children:e.map((a,i)=>{const c=i%2==0,o=i===e.length-1;return s.jsxs("div",{className:"contents",children:[s.jsx("div",{className:t("flex items-center","justify-end"),children:c&&s.jsx(Qs,{hop:a,compact:n,index:i,highlightIndex:r,isTrace:l})}),s.jsx("div",{className:"flex flex-col items-center justify-center min-h-[28px]",children:!o&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px flex-1 bg-border-strong/40 min-h-[8px]"}),void 0!==a.snr&&s.jsx(Gs,{snr:a.snr}),s.jsx("svg",{className:"w-3 h-3 text-fg-muted flex-shrink-0",viewBox:"0 0 12 12",fill:"none",children:s.jsx("path",{d:"M6 2v8M3 7l3 3 3-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})}),s.jsx("div",{className:t("flex items-center","justify-start"),children:!c&&s.jsx(Qs,{hop:a,compact:n,index:i,highlightIndex:r,isTrace:l})})]},`${a.prefix}-${i}`)})})}const qs=a.memo(function({packet:e,neighbors:n,localHash:l,neighborAffinity:r,ghostPrefixes:i,direction:c="horizontal",compact:o=!1,traceSnr:d,overridePath:x}){const m=void 0!==d&&d.length>0,p=Vs(e.original_path),h=Vs(e.forwarded_path),u=x??(h.length>0?h:p),f=Os(l),y=a.useMemo(()=>u.map((e,s)=>{const t=e.toUpperCase(),a=t===f,l=(null==i?void 0:i.has(t))??!1,c=function(e,s,t){const a=e.toUpperCase();if(t){let e=null,n=0;if(t.forEach((s,t)=>{if(Os(t)===a){const a=s.combinedScore??0;a>n&&(n=a,e=t)}}),e&&s[e])return{hash:e,info:s[e],confidence:n}}for(const[n,l]of Object.entries(s))if(Os(n)===a)return{hash:n,info:l,confidence:void 0};return null}(t,n,r);return{prefix:t,fullHash:null==c?void 0:c.hash,neighborInfo:null==c?void 0:c.info,isLocal:a,isGhost:l,confidence:null==c?void 0:c.confidence,snr:null==d?void 0:d[s]}}),[u,n,r,f,i,d]);if(0===y.length)return s.jsxs("div",{className:"flex items-center gap-2 text-fg-muted text-xs",children:[s.jsx(g,{className:"w-4 h-4 opacity-50"}),s.jsx("span",{children:"Direct / No path data"})]});if("flowchart"===c)return s.jsx(Ws,{hops:y,compact:o,isTrace:m});const j="horizontal"===c?oe:fe;return s.jsx("div",{className:t("flex gap-1.5","horizontal"===c?"flex-row flex-wrap items-center":"flex-col items-start"),children:y.map((e,a)=>s.jsxs("div",{className:t("flex items-center gap-1.5","vertical"===c&&"flex-col"),children:[s.jsx(Qs,{hop:e,compact:o}),a0,i=ar&&n(a-1),disabled:!r,className:t("p-0.5 radius-badge transition-base",r?"text-fg-muted hover:text-fg-primary hover-bg":"text-fg-muted cursor-not-allowed"),"aria-label":"Previous observation",children:s.jsx(Pe,{className:l?"size-3":"size-4"})}),s.jsx("div",{className:"flex items-center gap-0.5",children:e.map((e,r)=>{const i=r===a,c=new Date(1e3*e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});return s.jsx(V,{color:i?"cyan":"zinc",filled:i,compact:l,onClick:()=>n(r),title:`Observation ${r+1} at ${c}`,className:t("transition-all duration-150",!i&&"opacity-60 hover:opacity-100"),children:l?s.jsx("span",{className:"tabular-nums",children:r+1}):s.jsxs("span",{className:"tabular-nums text-xs",children:["#",r+1,null!=e.rssi&&s.jsx("span",{className:"ml-1 opacity-70",children:e.rssi})]})},`${e.timestamp}_${r}`)})}),s.jsx("button",{onClick:()=>i&&n(a+1),disabled:!i,className:t("p-0.5 radius-badge transition-base",i?"text-fg-muted hover:text-fg-primary hover-bg":"text-fg-muted cursor-not-allowed"),"aria-label":"Next observation",children:s.jsx(je,{className:l?"size-3":"size-4"})}),s.jsxs("span",{className:t("text-fg-muted ml-1",l?"text-[9px]":"text-xs"),children:[s.jsx(ye,{className:"inline size-3 mr-0.5 opacity-50"}),e.length]})]})}function Ys({icon:e,label:a,disabled:n=!1}){return s.jsx(C.div,{className:"flex items-center gap-1 text-xs",title:a,animate:{opacity:n?.25:.6},transition:{duration:.15,ease:[.4,0,.2,1]},children:s.jsx("span",{className:t("flex items-center justify-center size-5 radius-badge border-control transition-base",n?"bg-subtle-fill border-edge-subtle":"bg-subtle-fill"),children:e})})}function Js({hasDuplicates:e,hasPrev:t,hasNext:a,canPrevDupe:n,canNextDupe:l}){return s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx(Ys,{icon:s.jsx(he,{className:"size-3"}),label:"Previous packet (↑)",disabled:!t}),s.jsx(Ys,{icon:s.jsx(O,{className:"size-3"}),label:"Next packet (↓)",disabled:!a})]}),e&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px h-3 bg-subtle-fill-strong"}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx(Ys,{icon:s.jsx(Pe,{className:"size-3"}),label:"Previous observation (←)",disabled:!n}),s.jsx(Ys,{icon:s.jsx(je,{className:"size-3"}),label:"Next observation (→)",disabled:!l})]})]})]})}const Zs=a.memo(function({packets:e,initialIndex:t=0,onClose:n,onNavigatePrev:l,onNavigateNext:r,hasPrev:i=!1,hasNext:c=!1}){const[o,d]=a.useState(t),x=e[o]??e[0],m=e.length>1,u=o>0,f=o{d(Math.max(0,Math.min(s,e.length-1)))},[e.length]);a.useEffect(()=>{const e=e=>{if(!(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))switch(e.key){case"ArrowUp":e.preventDefault(),null==l||l();break;case"ArrowDown":e.preventDefault(),null==r||r();break;case"ArrowLeft":e.preventDefault(),u&&d(e=>e-1);break;case"ArrowRight":e.preventDefault(),f&&d(e=>e+1)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[l,r,u,f]);const v=D(),k=z(),w=R(),_=A(),H=a.useMemo(()=>new Set(_.map(e=>e.prefix.toUpperCase())),[_]),M=x.payload_type_name||y(x.payload_type??x.type),P=x.route_type_name||j(x.route_type??x.route),B=x.payload_length??x.length??0,F=Ks(x.original_path),L=Ks(x.forwarded_path),V=F.length>0||L.length>0,O=L.length>0?L:F,Q=a.useMemo(()=>{var e;if(null==(e=null==v?void 0:v.config)?void 0:e.repeater)return{latitude:v.config.repeater.latitude,longitude:v.config.repeater.longitude,name:v.config.node_name||"Local Node"}},[v]),G=(null==v?void 0:v.neighbors)??{},W=w.size>0?w:void 0,q=x.raw_packet&&x.raw_packet.length>0,K=a.useMemo(()=>{if((x.payload_type??x.type)!==S.TRACE||!x.payload)return null;try{const e=p(x.payload),s=x.original_path||x.forwarded_path||[];let t=[];if("string"==typeof s)try{const e=JSON.parse(s);Array.isArray(e)&&(t=e.map(e=>parseInt(e,16)))}catch{t=[]}else Array.isArray(s)&&(t=s.map(e=>parseInt(e,16)));return X(e,t)}catch{return null}},[x]),Y=null==K?void 0:K.snrValues,J=a.useMemo(()=>{if((x.payload_type??x.type)!==S.ADVERT||!x.payload)return null;try{const e=p(x.payload),s=ee(e);if(!s)return null;const t=s.publicKey.slice(0,2).toUpperCase();return{...s,prefix:t}}catch{return null}},[x]),Z=a.useMemo(()=>{if((null==J?void 0:J.latitude)&&(null==J?void 0:J.longitude))return{latitude:J.latitude,longitude:J.longitude,name:J.name||`Node ${J.prefix||"??"}`,prefix:J.prefix,publicKey:J.publicKey}},[J]),se=e=>e&&0!==e?new Date(1e3*e).toLocaleString():"Unknown",te=$(x.packet_hash),ae=a.useMemo(()=>{if((x.payload_type??x.type)!==S.GRP_TXT)return null;if(!(null==te?void 0:te.decoded))return null;const e=te.decoded;return{type:"grp_txt",channelHash:e.channelHash,channelName:e.channelName,text:e.text??"",decrypted:e.decrypted,senderName:e.senderName,timestamp:e.timestamp,flags:e.flags,macCorrupted:e.macCorrupted}},[x,te]),ne=a.useCallback(e=>{if(!e)return null;const s=e.trim().match(/(-?\d+\.?\d*)\s*[,\s]\s*(-?\d+\.?\d*)/);if(!s)return null;const t=parseFloat(s[1]),a=parseFloat(s[2]);return isNaN(t)||isNaN(a)||t<-90||t>90||a<-180||a>180||0===t&&0===a?null:{lat:t,lon:a}},[]),re=a.useMemo(()=>{var e,s;if(!(null==ae?void 0:ae.decrypted))return;if(!(null==(e=ae.channelName)?void 0:e.toLowerCase().includes("wardrive")))return;const t=ne(ae.text);return t?{latitude:t.lat,longitude:t.lon,name:ae.senderName||"Wardrive Ping",prefix:(null==(s=ae.senderName)?void 0:s.slice(0,2).toUpperCase())||"WD",nodeType:"wardrive"}:void 0},[ae,ne]),ie=(x.payload_type??x.type)===S.ADVERT&&(void 0!==Z||V),ce=void 0!==re,oe=Z??re;if(0===O.length)return null;const me=(null==v?void 0:v.local_hash)?(v.local_hash.startsWith("0x")?v.local_hash.slice(2,4):v.local_hash.slice(0,2)).toUpperCase():"";for(const s of O){const e=s.toUpperCase();if(e!==me)if(W){let s=0,t=0;if(W.forEach((a,n)=>{(n.startsWith("0x")?n.slice(2,4):n.slice(0,2)).toUpperCase()===e&&(s++,t=Math.max(t,a.combinedScore??0))}),0===s)for(const a of Object.keys(G))if((a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase()===e)break}else for(const s of Object.keys(G))if((s.startsWith("0x")?s.slice(2,4):s.slice(0,2)).toUpperCase()===e)break}const he=le[M]??"zinc",ue=b[he]||b.zinc;return s.jsxs(E,{open:!0,onClose:n,size:"5xl",motionPlus:!0,className:"sm:h-[85vh] sm:max-h-[800px] md:h-[80vh] md:max-h-[900px]",children:[s.jsxs("div",{className:"sm:hidden",children:[s.jsx("div",{className:"flex justify-center pt-2 pb-1",children:s.jsx("div",{className:"w-9 h-1 rounded-full bg-fg-muted","aria-hidden":"true"})}),s.jsxs("div",{className:"flex items-center justify-between px-3 pb-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(h,{color:le[M]??"zinc",className:"!text-[9px] !px-1.5 !py-0",children:M}),s.jsx(h,{color:"DIRECT"===P||"T_DIRECT"===P?"cyan":"amber",className:"!text-[9px] !px-1.5 !py-0",children:P}),s.jsxs(h,{color:"zinc",className:"!text-[9px] !px-1.5 !py-0",children:[B,"B"]})]}),s.jsx("button",{onClick:n,className:"px-3 py-1.5 text-[15px] font-medium text-sys-blue active:text-sys-blue/80 transition-base flex-shrink-0 radius-inner active:bg-subtle-fill",children:"Done"})]}),m&&s.jsx("div",{className:"px-3 pb-2",children:s.jsx(Xs,{packets:e,selectedIndex:o,onSelect:N,compact:!0})})]}),s.jsx("div",{className:"hidden sm:block px-6 pt-5 pb-4",children:s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(h,{color:le[M]??"zinc",children:M}),s.jsx(h,{color:"DIRECT"===P||"T_DIRECT"===P?"cyan":"amber",children:P}),s.jsxs(h,{color:"zinc",children:[B,"B"]}),m&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px h-4 bg-subtle-fill-strong"}),s.jsx(Xs,{packets:e,selectedIndex:o,onSelect:N})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Js,{hasDuplicates:m,hasPrev:i,hasNext:c,canPrevDupe:u,canNextDupe:f}),s.jsx("button",{onClick:n,className:"p-1.5 -m-1.5 text-fg-muted hover:text-fg-primary transition-base radius-inner hover:bg-elevated flex-shrink-0",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}),s.jsx("div",{className:"sm:hidden h-[2px]",style:{backgroundColor:ue,opacity:.6}}),s.jsxs(U,{className:"p-0 overflow-hidden flex-1 flex flex-col min-h-0",children:[s.jsx("div",{className:"md:hidden flex-1 overflow-y-auto overflow-x-hidden",children:s.jsxs("div",{className:"p-2 space-y-2",children:[(null!=x.rssi||null!=x.snr)&&s.jsxs("div",{className:"relative flex items-center justify-between px-2 py-1.5 radius-inner bg-subtle-fill",children:[s.jsx(I,{mode:"popLayout",initial:!1,children:s.jsxs(C.div,{className:"flex items-center gap-3",initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15,ease:[.4,0,.2,1]},children:[s.jsx(de,{rssi:x.rssi,snr:x.snr,compact:!0,showValues:!0,validated:xe(x)}),s.jsx("span",{className:"text-[11px] text-fg-muted",children:pe(x.rssi)})]},o)}),O.length>0&&s.jsxs("span",{className:"type-data-xs text-fg-muted",children:[O.length," hop",1!==O.length?"s":""]})]}),(V&&O.length>0||ie||ce)&&s.jsx("div",{className:"overflow-hidden radius-inset",children:s.jsx("div",{className:"aspect-[4/3] w-full",children:s.jsx(fs,{path:O,neighbors:G,localNode:Q,localHash:null==v?void 0:v.local_hash,srcHash:x.src_hash,dstHash:x.dst_hash,neighborAffinity:W,hubNodes:[...k],traceSnr:Y,advertiserSource:oe})})}),K&&K.pathHashes.length>0&&s.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[s.jsx("div",{className:"px-3 py-2 space-y-1.5",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"type-micro text-fg-muted",children:"Trace Route"}),s.jsx("div",{className:"flex items-center gap-1.5",children:s.jsx(h,{color:K.isComplete?"green":"amber",compact:!0,children:K.isComplete?"Complete":"In Progress"})})]})}),s.jsx(qs,{packet:x,neighbors:G,localHash:null==v?void 0:v.local_hash,neighborAffinity:W,ghostPrefixes:H,direction:"flowchart",compact:!0,overridePath:K.pathHashes,traceSnr:K.snrValues})]}),V&&!K&&s.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[s.jsx("span",{className:"type-micro text-fg-muted",children:"Path"}),s.jsxs(h,{color:"zinc",compact:!0,children:[O.length," hop",1!==O.length?"s":""]})]}),s.jsx(qs,{packet:x,neighbors:G,localHash:null==v?void 0:v.local_hash,neighborAffinity:W,ghostPrefixes:H,direction:"flowchart",compact:!0,traceSnr:Y})]}),J&&s.jsxs("div",{className:"radius-inset bg-subtle-fill overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-edge-subtle",children:[s.jsx("span",{className:"type-micro text-fg-muted",children:"Advertiser Info"}),s.jsx(h,{color:"lime",compact:!0,children:J.nodeType})]}),s.jsxs("div",{className:"p-3 space-y-2",children:[J.name&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($e,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),s.jsx("span",{className:"type-label text-fg-primary truncate",children:J.name})]}),J.latitude&&J.longitude&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(be,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),s.jsxs("span",{className:"type-data-xs text-fg-secondary",children:[J.latitude.toFixed(5),", ",J.longitude.toFixed(5)]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ze,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),s.jsxs("span",{className:"type-data-xs text-fg-muted truncate",children:[J.publicKey.slice(0,16),"...",J.publicKey.slice(-8)]})]}),J.timestamp>0&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(T,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),s.jsx("span",{className:"text-xs text-fg-muted",children:se(J.timestamp)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(g,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),s.jsx("span",{className:"text-xs text-fg-muted",children:J.flagsDescription||`Flags: 0x${J.flags.toString(16).padStart(2,"0")}`})]})]})]}),q&&s.jsx("div",{className:"pt-1",children:s.jsx(Is,{packet:x,decodedGrpTxt:ae})})]})}),s.jsxs("div",{className:"hidden md:grid md:grid-cols-2 flex-1 overflow-hidden",children:[s.jsx("div",{className:"overflow-y-auto overflow-x-hidden scrollbar-none p-4 border-r border-edge-subtle",children:q&&s.jsx(Is,{packet:x,decodedGrpTxt:ae})}),s.jsxs("div",{className:"grid overflow-hidden",style:{gridTemplateRows:"minmax(280px, 1fr) auto"},children:[s.jsx("div",{className:"overflow-hidden p-2",children:V&&O.length>0||ie||ce?s.jsx("div",{className:"h-full w-full",children:s.jsx(fs,{path:O,neighbors:G,localNode:Q,localHash:null==v?void 0:v.local_hash,srcHash:x.src_hash,dstHash:x.dst_hash,neighborAffinity:W,hubNodes:[...k],traceSnr:Y,advertiserSource:oe})}):s.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center text-center px-4",children:[s.jsx(g,{className:"w-8 h-8 text-fg-muted/50 mb-2"}),s.jsx("span",{className:"text-sm text-fg-muted",children:"Direct Reception"}),s.jsx("span",{className:"text-xs text-fg-muted/70 mt-1",children:"Zero-hop packet — received directly from sender"})]})}),s.jsxs("div",{className:"overflow-y-auto max-h-[200px] p-2 space-y-2",children:[!K&&O.length<=1&&(null!=x.rssi||null!=x.snr)&&s.jsx("div",{className:"surface-base radius-inset p-4",children:s.jsxs("dl",{className:"text-xs grid grid-cols-2 gap-2",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-fg-muted mb-1",children:"Signal"}),s.jsx(I,{mode:"popLayout",initial:!1,children:s.jsxs(C.dd,{className:"flex items-center gap-2",initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15,ease:[.4,0,.2,1]},children:[s.jsx(de,{rssi:x.rssi,snr:x.snr,validated:xe(x)}),s.jsx("span",{className:"font-medium text-fg-primary",children:pe(x.rssi)})]},o)})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-fg-muted mb-1",children:"RF"}),s.jsx(I,{mode:"popLayout",initial:!1,children:s.jsxs(C.dd,{className:"type-data text-fg-secondary",initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15,ease:[.4,0,.2,1]},children:[null!=x.rssi&&`${x.rssi} dBm`,null!=x.snr&&` · ${x.snr.toFixed(1)} dB`]},o)})]})]})}),J&&s.jsxs("div",{className:"radius-inset bg-subtle-fill overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-edge-subtle",children:[s.jsx("span",{className:"type-micro text-fg-muted",children:"Advertiser"}),s.jsx(h,{color:"lime",compact:!0,children:J.nodeType})]}),s.jsxs("div",{className:"p-4 space-y-2.5",children:[J.name&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($e,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),s.jsx("span",{className:"type-label text-fg-primary truncate",children:J.name})]}),J.latitude&&J.longitude&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(be,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),s.jsxs("span",{className:"type-data-xs text-fg-secondary",children:[J.latitude.toFixed(5),", ",J.longitude.toFixed(5)]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ze,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),s.jsxs("span",{className:"text-[11px] font-mono text-fg-muted truncate",children:[J.publicKey.slice(0,16),"...",J.publicKey.slice(-8)]})]}),J.timestamp>0&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(T,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),s.jsx("span",{className:"text-xs text-fg-muted",children:se(J.timestamp)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(g,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),s.jsx("span",{className:"text-[11px] text-fg-muted",children:J.flagsDescription||`Flags: 0x${J.flags.toString(16).padStart(2,"0")}`})]})]})]}),K&&K.pathHashes.length>0&&s.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[s.jsxs("div",{className:"px-4 py-2 flex items-center justify-between",children:[s.jsx("span",{className:"type-micro text-fg-muted",children:"Trace Route"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(h,{color:K.isComplete?"green":"amber",compact:!0,children:K.isComplete?"Complete":"In Progress"}),s.jsxs(h,{color:"teal",compact:!0,children:[K.pathHashes.length,"h"]})]})]}),s.jsx(qs,{packet:x,neighbors:G,localHash:null==v?void 0:v.local_hash,neighborAffinity:W,ghostPrefixes:H,direction:"flowchart",compact:!0,overridePath:K.pathHashes,traceSnr:K.snrValues})]}),V&&!K&&s.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-2",children:[s.jsx("span",{className:"type-micro text-fg-muted",children:"Path"}),s.jsxs(h,{color:"zinc",compact:!0,children:[O.length,"h"]})]}),s.jsx(qs,{packet:x,neighbors:G,localHash:null==v?void 0:v.local_hash,neighborAffinity:W,ghostPrefixes:H,direction:"flowchart",compact:!0,traceSnr:Y})]})]})]})]})]})]})});function et({label:e,numericValue:t,unit:a,icon:n,subtext:l,showSign:r=!1}){return s.jsxs("div",{className:"radius-inner p-3 sm:radius-inset sm:p-4 bg-subtle-fill ring-1 ring-inset ring-edge-subtle",children:[s.jsx("div",{className:"mb-1.5 sm:mb-2",children:s.jsx("span",{className:"text-xs sm:type-micro text-fg-muted",children:e})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Te,{value:t,format:{minimumFractionDigits:1,maximumFractionDigits:1,signDisplay:r?"always":"auto"},className:"type-data-hero tracking-tight text-fg-primary"}),s.jsxs("div",{className:"flex flex-col items-center justify-center",children:[s.jsx(n,{className:"w-[14px] h-[14px] text-fg-muted"}),a&&s.jsx("span",{className:"text-xs font-medium leading-tight text-fg-muted",children:a})]})]}),l&&s.jsx("p",{className:"mt-1.5 sm:mt-2 type-data-xs sm:text-[11px] text-fg-muted/80 truncate",children:l})]})}function st({snr:e}){const a=e>=5?"bg-sys-teal":e>=0?"bg-sys-green":e>=-5?"bg-sys-amber":e>=-10?"bg-sys-orange":"bg-sys-red";return s.jsx("span",{className:t("w-1.5 h-1.5 rounded-full flex-shrink-0",a),title:`SNR: ${e.toFixed(1)} dB`})}function tt({fromPrefix:e,toPrefix:a,fromName:n,toName:l,snr:r,maxSnr:i,isWeakest:c,isStrongest:o,index:d=0}){const x=Math.max(i+5,15),m=Math.max(0,Math.min(100,(r- -20)/(x- -20)*100)),p="bg-[#0074BE]",u=r>=5?"bg-sys-teal":r>=0?"bg-sys-green":r>=-5?"bg-sys-amber":r>=-10?"bg-sys-orange":"bg-sys-red",g=.3+.15*d;return s.jsxs("div",{className:"relative p-3 pl-5 radius-inner bg-subtle-fill ring-1 ring-inset ring-edge-subtle",children:[s.jsx("span",{className:t("absolute left-0 top-1/2 -translate-y-1/2 h-4 w-0.5 rounded-full",u)}),s.jsx("span",{className:"absolute -top-0.5 -right-0.5",children:s.jsx(st,{snr:r})}),s.jsxs("div",{className:"sm:hidden",children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx("span",{className:"text-[13px] font-medium text-fg-secondary truncate",children:n||e}),s.jsx(oe,{className:"w-3 h-3 text-fg-muted flex-shrink-0"}),s.jsx("span",{className:"text-[13px] font-semibold text-fg-primary truncate",children:l||a})]}),s.jsxs("div",{className:"flex items-center gap-1.5 ml-2 flex-shrink-0",children:[c&&s.jsx(h,{color:"red",compact:!0,children:"Low"}),o&&!c&&s.jsxs(h,{color:"amber",compact:!0,children:[s.jsx(Ae,{className:"w-2.5 h-2.5"}),"Best"]}),s.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[12px] font-mono font-bold tabular-nums bg-subtle-fill-hover text-fg-primary ring-1 ring-inset ring-edge-subtle",children:[r>=0?"+":"−",Math.abs(r).toFixed(1)]})]})]}),s.jsx("div",{className:"h-1.5 bg-subtle-fill-strong rounded-full overflow-hidden",children:s.jsx(C.div,{className:t("h-full rounded-full",p),initial:{width:0},animate:{width:`${m}%`},transition:{duration:1.5,delay:g,ease:[.25,.1,.25,1]}})})]}),s.jsxs("div",{className:"hidden sm:block",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx("code",{className:"type-data-xs text-fg-muted",children:e}),n&&s.jsx("span",{className:"text-xs text-fg-secondary truncate max-w-[100px]",children:n})]}),s.jsx(oe,{className:"w-3 h-3 text-fg-muted/40 flex-shrink-0"}),s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx("code",{className:"font-mono text-xs font-semibold text-fg-primary",children:a}),l&&s.jsx("span",{className:"text-xs text-fg-secondary truncate max-w-[100px]",children:l})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[c&&s.jsx(h,{color:"red",compact:!0,children:"Bottleneck"}),o&&!c&&s.jsxs(h,{color:"amber",compact:!0,children:[s.jsx(Ae,{className:"w-3 h-3"}),"Strongest"]}),s.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-sm font-mono font-semibold tabular-nums bg-subtle-fill-hover text-fg-primary ring-1 ring-inset ring-edge-subtle",children:[r>=0?"+":"−",Math.abs(r).toFixed(1)]})]})]}),s.jsx("div",{className:"h-1.5 bg-elevated rounded-full overflow-hidden",children:s.jsx(C.div,{className:t("h-full rounded-full",p),initial:{width:0},animate:{width:`${m}%`},transition:{duration:1.5,delay:g,ease:[.25,.1,.25,1]}})})]})]})}function at(e,s){if("You"===e)return"You";const t=e.toUpperCase();for(const[a,n]of Object.entries(s))if((a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase()===t)return n.name||n.node_name||void 0}const nt=a.memo(function({report:e,onClose:t}){var a,n;const l=D(),r=(null==l?void 0:l.neighbors)??{},i=(null==(a=null==l?void 0:l.config)?void 0:a.repeater)?{latitude:l.config.repeater.latitude,longitude:l.config.repeater.longitude,name:l.config.node_name||"Local Node"}:void 0,c=null==(n=e.bestObservation)?void 0:n.decoded.snrValues,o=e.linkQuality?e.linkQuality.avgSnr>=5?"excellent":e.linkQuality.avgSnr>=0?"good":e.linkQuality.avgSnr>=-5?"fair":"poor":"unknown",d={excellent:"var(--signal-excellent)",good:"var(--signal-good)",fair:"var(--signal-fair)",poor:"var(--signal-poor)",unknown:"var(--fg-muted)"}[o];return s.jsxs(E,{open:!0,onClose:t,size:"5xl",motionPlus:!0,children:[s.jsxs("div",{className:"sm:hidden",children:[s.jsx("div",{className:"flex justify-center pt-2 pb-1",children:s.jsx("div",{className:"w-9 h-1 rounded-full bg-fg-primary/30","aria-hidden":"true"})}),s.jsxs("div",{className:"flex items-center justify-between px-4 pb-2",children:[s.jsx("h2",{className:"font-semibold text-[17px] text-fg-primary",children:"Trace Report"}),s.jsx("button",{onClick:t,className:"text-[17px] font-medium text-sys-blue active:text-sys-blue/80",children:"Done"})]})]}),s.jsx("div",{className:"sm:hidden h-[2px]",style:{backgroundColor:d,opacity:.6}}),s.jsx("div",{className:"hidden sm:block px-6 pt-5 pb-4",children:s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[s.jsx("h2",{className:"type-micro",children:"Trace Report"}),s.jsxs(h,{color:"excellent"===o||"good"===o?"green":"fair"===o?"amber":"red",children:[s.jsx(Re,{className:"w-3 h-3 mr-1"}),"excellent"===o?"Excellent":"good"===o?"Good":"fair"===o?"Fair":"Poor"]})]}),s.jsx("p",{className:"mt-1 text-xs sm:text-sm font-mono text-fg-muted tabular-nums",children:e.traceTag})]}),s.jsx("button",{onClick:t,className:"p-1.5 -m-1.5 text-fg-muted hover:text-fg-primary transition-base radius-inner hover:bg-elevated flex-shrink-0",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),s.jsxs("div",{className:"hidden sm:flex flex-wrap items-center gap-1.5 sm:gap-2 px-4 sm:px-6 pb-3 sm:pb-4 border-b border-edge-subtle",children:[s.jsxs(h,{color:"teal",children:[s.jsx("span",{className:"font-mono tabular-nums",children:e.targetHopCount}),s.jsxs("span",{className:"ml-1",children:["hop",1!==e.targetHopCount?"s":""]})]}),s.jsxs(h,{color:"zinc",children:[s.jsx("span",{className:"font-mono tabular-nums",children:e.observationCount}),s.jsx("span",{className:"ml-1",children:"obs"})]}),e.linkQuality&&s.jsxs(h,{color:"indigo",children:[s.jsx("span",{className:"font-mono tabular-nums",children:e.linkQuality.avgSnr.toFixed(1)}),s.jsx("span",{className:"ml-1",children:"dB avg"})]}),s.jsx("span",{className:"type-data-xs text-fg-muted",children:Q(e.duration)}),e.linkQuality&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-fg-muted/40",children:"•"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-sys-red/15 text-sys-red ring-1 ring-inset ring-sys-red/25",children:[s.jsx("span",{className:"opacity-70",children:"Min"}),s.jsx("span",{className:"font-mono tabular-nums",children:e.linkQuality.minSnr.toFixed(1)})]}),s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-sys-teal/15 text-sys-teal ring-1 ring-inset ring-sys-teal/25",children:[s.jsx("span",{className:"opacity-70",children:"Max"}),s.jsx("span",{className:"font-mono tabular-nums",children:e.linkQuality.maxSnr.toFixed(1)})]})]})]})]}),s.jsxs(U,{className:"p-0 overflow-hidden",children:[s.jsx("div",{className:"md:hidden h-[75vh] max-h-[calc(100vh-80px)] overflow-y-auto overflow-x-hidden",children:s.jsxs("div",{className:"px-4 py-3 space-y-3",children:[e.linkQuality&&s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("div",{className:"radius-inner bg-subtle-fill ring-1 ring-inset ring-edge-subtle p-2.5 text-center",children:[s.jsx(Te,{value:Math.abs(e.linkQuality.minSnr),format:{maximumFractionDigits:0,signDisplay:"never"},prefix:e.linkQuality.minSnr<0?"-":"",className:"text-[20px] font-bold font-mono tabular-nums flex items-center justify-center text-fg-primary"}),s.jsxs("div",{className:"flex items-center justify-center gap-1 mt-1",children:[s.jsx(Ne,{className:"w-2.5 h-2.5 text-fg-muted"}),s.jsx("span",{className:"text-xs text-fg-muted",children:"Min dB"})]})]}),s.jsxs("div",{className:"radius-inner bg-subtle-fill ring-1 ring-inset ring-edge-subtle p-2.5 text-center",children:[s.jsx(Te,{value:e.linkQuality.maxSnr,format:{maximumFractionDigits:0,signDisplay:"always"},className:"text-[20px] font-bold font-mono text-fg-primary tabular-nums flex items-center justify-center"}),s.jsxs("div",{className:"flex items-center justify-center gap-1 mt-1",children:[s.jsx(ue,{className:"w-2.5 h-2.5 text-fg-muted"}),s.jsx("span",{className:"text-xs text-fg-muted",children:"Max dB"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs(h,{color:"excellent"===o||"good"===o?"green":"fair"===o?"amber":"red",compact:!0,children:[s.jsx(Re,{className:"w-2.5 h-2.5 mr-0.5"}),"excellent"===o?"Excellent":"good"===o?"Good":"fair"===o?"Fair":"Poor"]}),s.jsxs(h,{color:"teal",compact:!0,children:[e.targetHopCount," hops"]}),s.jsxs(h,{color:"zinc",compact:!0,children:[e.observationCount," obs"]}),s.jsx("span",{className:"type-data-xs text-fg-muted ml-auto",children:e.traceTag.slice(0,8)})]}),e.targetPath.length>0&&s.jsx("div",{className:"overflow-hidden radius-inset",children:s.jsx("div",{className:"aspect-[4/3] w-full",children:s.jsx(fs,{path:e.targetPath,neighbors:r,localNode:i,localHash:null==l?void 0:l.local_hash,srcHash:e.srcHash,dstHash:e.dstHash,traceSnr:c})})}),s.jsxs("div",{className:"radius-inset bg-body overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-edge-subtle",children:[s.jsx("span",{className:"text-[11px] font-medium text-fg-secondary",children:"Route Path"}),e.linkQuality&&s.jsxs("span",{className:"type-data-xs text-fg-muted",children:["SNR ",e.linkQuality.minSnr.toFixed(1)," → ",e.linkQuality.maxSnr.toFixed(1)," dB"]})]}),e.bestObservation?s.jsx(qs,{packet:e.bestObservation.packet,neighbors:r,localHash:null==l?void 0:l.local_hash,direction:"flowchart",compact:!0,overridePath:e.targetPath,traceSnr:e.bestObservation.decoded.snrValues}):s.jsx("div",{className:"p-6 text-center text-fg-muted text-xs",children:"No path data available"})]}),s.jsxs("div",{children:[s.jsxs("h3",{className:"type-micro text-fg-muted mb-2",children:["Link Quality · ",e.hopStats.length," hops"]}),s.jsx("div",{className:"space-y-1.5",children:e.hopStats.length>0?e.hopStats.map((t,a)=>{var n,l,i;const c=a{const t=e.targetPath[e.linkQuality.weakestLinkPosition],a=e.targetPath[e.linkQuality.weakestLinkPosition+1]||"You",n=at(t,r),l=at(a,r),i=e.targetPath[e.linkQuality.strongestLinkPosition],c=e.targetPath[e.linkQuality.strongestLinkPosition+1]||"You",o=at(i,r),d=at(c,r);return s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(et,{label:"Weakest Link",numericValue:e.linkQuality.minSnr,unit:"dB",icon:Ne,subtext:`${n||t} → ${l||a}`}),s.jsx(et,{label:"Best Link",numericValue:e.linkQuality.maxSnr,showSign:!0,unit:"dB",icon:ue,subtext:`${o||i} → ${d||c}`})]})})(),s.jsxs("div",{children:[s.jsx("h3",{className:"type-micro text-fg-muted mb-3",children:"Link Details"}),s.jsx("div",{className:"space-y-2",children:e.hopStats.length>0?e.hopStats.map((t,a)=>{var n,l,i;const c=a0&&s.jsx("div",{className:"overflow-hidden",children:s.jsx("div",{className:"aspect-square w-full",children:s.jsx(fs,{path:e.targetPath,neighbors:r,localNode:i,localHash:null==l?void 0:l.local_hash,srcHash:e.srcHash,dstHash:e.dstHash,traceSnr:c})})}),s.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[s.jsx("span",{className:"type-micro text-fg-muted",children:"Trace Route"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(h,{color:e.isComplete?"green":"amber",compact:!0,children:e.isComplete?"Complete":`${e.maxHopsObserved}/${e.targetHopCount}`}),s.jsxs(h,{color:"teal",compact:!0,children:[e.targetHopCount," hop",1!==e.targetHopCount?"s":""]})]})]}),e.linkQuality&&e.bestObservation&&s.jsxs("div",{className:"flex items-center gap-4 px-4 pb-2 type-data-xs text-fg-muted",children:[s.jsxs("span",{children:[s.jsx("span",{className:"opacity-60",children:"Tag"})," ",s.jsx("code",{className:"text-sys-teal tabular-nums",children:e.traceTag.slice(0,8)})]}),s.jsxs("span",{children:[s.jsx("span",{className:"opacity-60",children:"SNR"})," ",s.jsxs("code",{className:"text-sys-indigo tabular-nums",children:[e.linkQuality.minSnr.toFixed(1),"–",e.linkQuality.maxSnr.toFixed(1)]}),s.jsx("span",{className:"opacity-60",children:" dB"})]})]}),e.bestObservation?s.jsx(qs,{packet:e.bestObservation.packet,neighbors:r,localHash:null==l?void 0:l.local_hash,direction:"flowchart",compact:!0,overridePath:e.targetPath,traceSnr:e.bestObservation.decoded.snrValues}):s.jsx("div",{className:"p-8 text-center text-fg-muted text-xs",children:"No path data available"})]})]})]})]})]})}),lt="(min-width: 640px)";let rt=null;function it(e){return"undefined"==typeof window?()=>{}:(rt||(rt=window.matchMedia(lt)),rt.addEventListener("change",e),()=>null==rt?void 0:rt.removeEventListener("change",e))}function ct(){return"undefined"==typeof window||(rt||(rt=window.matchMedia(lt)),rt.matches)}function ot(e){if(!e||e.length<6)return null;const s=e,t=parseInt(s.slice(0,2),16);if(isNaN(t))return null;const a=3&t;let n=2;if(0!==a&&3!==a||(n=10),n+2>s.length)return null;const l=parseInt(s.slice(n,n+2),16);if(isNaN(l))return null;if(n+=2+2*l,n>=s.length)return null;const r=s.slice(n);return r.length>=38?r.slice(0,38):r}function dt({message:e}){return s.jsxs("div",{className:"flex flex-col items-center justify-center py-14 text-center",children:[s.jsx(g,{className:"size-6 text-fg-muted mb-2"}),s.jsx("p",{className:"text-sm text-fg-primary",children:e}),s.jsx("p",{className:"text-xs text-fg-muted",children:"Packets will appear here"})]})}function xt(){return s.jsx("div",{className:"py-14 text-center text-sm text-fg-muted",children:"Loading packets…"})}function mt({showPagination:e,currentPage:t,perPage:a,displayCount:n,totalCount:l,action:r}){const i=e?(t-1)*a+1:1,c=e?Math.min(t*a,l):n;return s.jsxs("div",{className:"flex items-center justify-between gap-4 border-t border-edge-subtle px-4 py-3 text-xs text-fg-muted sm:px-6",children:[s.jsxs("span",{children:["Showing"," ",s.jsx("span",{className:"font-medium text-fg-secondary",children:e?`${i}–${c}`:n})," ","of"," ",s.jsx("span",{className:"font-medium text-fg-secondary",children:l})," ","packets"]}),r]})}function pt({packets:e,allPackets:n,localHash:l,neighbors:r,loading:i=!1,maxPackets:c,perPage:o=50,showPagination:d=!1,onPacketSelect:x,flashNewest:m=!1,emptyMessage:p="No packets found",className:h,footerAction:u,hideDupes:g=!1,decodedMessages:f,onChannelClick:y}){const[j,b]=a.useState(null),[N,v]=a.useState(null),[k,w]=a.useState({traceTag:null,dupeGroup:null});a.useLayoutEffect(()=>{w({traceTag:null,dupeGroup:null})},[e]);const C=n??e,S=a.useMemo(()=>c&&c>0&&!g?e.slice(0,c):e,[e,c,g]),_=a.useMemo(()=>{if(!g)return null;const e=function(e){if(0===e.length)return[];const s=[];let t=0;for(;t0?{packet:e[r].packet,dupeCount:e[r].dupeCount+s}:e[r])}return l}(e);return c&&c>0?s.slice(0,c):s},[S,g,c]),H=_?_.length:S.length,{currentPage:M,totalPages:T,goToPage:P,pageRange:B}=function(e,s,t){const[n,l]=a.useState(1),r=t?Math.ceil(e/s):1;a.useEffect(()=>{n>r&&r>0&&queueMicrotask(()=>l(1))},[r,n]);const i=a.useCallback(e=>l(Math.max(1,Math.min(e,r))),[r]),c=a.useMemo(()=>function(e,s,t=1){if(s<=7)return Array.from({length:s},(e,s)=>s+1);const a=Math.max(e-t,1),n=Math.min(e+t,s),l=a>2,r=ns+1),"gap",s]}if(l&&!r){const e=3+2*t;return[1,"gap",...Array.from({length:e},(t,a)=>s-e+a+1)]}return[1,"gap",...Array.from({length:n-a+1},(e,s)=>a+s),"gap",s]}(n,r),[n,r]);return{currentPage:n,totalPages:r,goToPage:i,pageRange:c}}(H,o,d),F=a.useMemo(()=>{if(g)return S;if(!d)return S;const e=(M-1)*o;return S.slice(e,e+o)},[S,d,M,o,g]),L=a.useMemo(()=>{if(!_)return null;if(!d)return _;const e=(M-1)*o;return _.slice(e,e+o)},[_,d,M,o]),D=a.useMemo(()=>{var e;if(!f)return f;const s=new Map,t=new Map,a=[];for(const r of S){const n=r.payload_type??r.type;if(n!==W.GRP_TXT)continue;const l=ot(r.raw_packet),i=`${n}:${r.payload_length??r.length??0}:${Math.floor((r.timestamp??0)/60)}`,c=f.get(r.packet_hash);(null==(e=null==c?void 0:c.decoded)?void 0:e.decrypted)&&!c.decoded.macCorrupted?(l&&!s.has(l)&&s.set(l,c),t.has(i)||t.set(i,c)):f.has(r.packet_hash)||a.push({hash:r.packet_hash,payloadHex:l,approxKey:i})}if(0===a.length||0===s.size&&0===t.size)return f;const n=new Map(f);let l=0;for(const{hash:r,payloadHex:i,approxKey:c}of a){if(n.has(r))continue;const e=(i?s.get(i):null)??t.get(c);e&&(n.set(r,e),l++)}return l>0?n:f},[f,S]),z=a.useMemo(()=>function(e){const s=new Map;for(const t of e)if((t.payload_type??t.type)===W.TRACE&&t.payload&&t.packet_hash){const e=Xe(t.payload);e&&s.set(t.packet_hash,e)}return s}(F),[F]),R=a.useMemo(()=>function(e){const s=new Map;if(0===e.length)return s;for(let t=0;t{var t,a;if(!s||!e.length)return;const r=(null==(t=e[0])?void 0:t.timestamp)??0,i=r>l.current&&l.current>0;if(l.current=r,!i)return;const c=null==(a=e[0])?void 0:a.packet_hash;if(!c)return;const o=requestAnimationFrame(()=>n(c)),d=setTimeout(()=>n(null),600);return()=>{cancelAnimationFrame(o),clearTimeout(d)}},[e,s]),t}(e,m),$=a.useCallback((e,s)=>{var t,a;const n=e.packet_hash;if(!n)return[e];let l=s;for(;l>0&&(null==(t=F[l-1])?void 0:t.packet_hash)===n;)l--;let r=s;for(;r{var s,t;const a=null==(s=F[e])?void 0:s.packet_hash;if(!a)return e;let n=e;for(;n>0&&(null==(t=F[n-1])?void 0:t.packet_hash)===a;)n--;return n},[F]),U=a.useCallback(e=>{var s,t;const a=null==(s=F[e])?void 0:s.packet_hash;if(!a)return e;let n=e;for(;n{if(x)x(e);else if(void 0!==s){const t=$(e,s),a=t.indexOf(e);b({packets:t,initialIndex:a>=0?a:0,rowIndex:s})}else b({packets:[e],initialIndex:0,rowIndex:0})},[x,$]),V=a.useCallback(()=>{if(!j)return;const e=E(j.rowIndex)-1;if(e<0)return;const s=F[e];if(!s)return;const t=$(s,e);b({packets:t,initialIndex:0,rowIndex:e})},[j,F,E,$]),O=a.useCallback(()=>{if(!j)return;const e=U(j.rowIndex)+1;if(e>=F.length)return;const s=F[e];if(!s)return;const t=$(s,e);b({packets:t,initialIndex:0,rowIndex:e})},[j,F,U,$]),Q=a.useMemo(()=>!!j&&E(j.rowIndex)>0,[j,E]),G=a.useMemo(()=>!!j&&U(j.rowIndex)w(s=>({...s,traceTag:e})),[]),K=a.useCallback(e=>w(s=>({...s,dupeGroup:e})),[]),X=a.useCallback(()=>{w({traceTag:null,dupeGroup:null})},[]),Y=a.useCallback(e=>{const s=C.filter(s=>(s.payload_type??s.type)===W.TRACE&&s.payload&&Xe(s.payload)===e);if(0===s.length)return;const t=function(e){const s=new Map;for(const t of e){const e=Je(t);if(!e)continue;const a=e.decoded.traceTag,n=s.get(a)||[];n.push(e),s.set(a,n)}for(const[t,a]of s)a.sort((e,s)=>e.timestamp-s.timestamp),s.set(t,a);return s}(s),a=t.get(e);(null==a?void 0:a.length)&&v(function(e,s){if(0===s.length)return{traceTag:e,traceTagValue:0,targetPath:[],targetHopCount:0,observations:[],observationCount:0,firstSeen:0,lastSeen:0,duration:0,isComplete:!1,maxHopsObserved:0,progressPercent:0,bestObservation:null,hopStats:[],linkQuality:null};const t=[...s].sort((e,s)=>e.timestamp-s.timestamp),a=t.reduce((e,s)=>s.hopCount>e.hopCount?s:e,t[0]),n=t[0].timestamp,l=t[t.length-1].timestamp,r=a.decoded.pathHashes,i=r.length,c=a.hopCount,o=a.decoded.isComplete,d=[],x=a.decoded.snrValues;for(let p=0;p0){const e=Math.min(...x),s=Math.max(...x);m={minSnr:e,maxSnr:s,avgSnr:x.reduce((e,s)=>e+s,0)/x.length,weakestLinkPosition:x.indexOf(e),strongestLinkPosition:x.indexOf(s)}}return{traceTag:e,traceTagValue:a.decoded.traceTagValue,targetPath:r,targetHopCount:i,observations:t,observationCount:t.length,firstSeen:n,lastSeen:l,duration:l-n,isComplete:o,maxHopsObserved:c,progressPercent:i>0?Math.round(c/i*100):0,bestObservation:a,hopStats:d,linkQuality:m,srcHash:a.packet.src_hash,dstHash:a.packet.dst_hash}}(e,a))},[C]),J=a.useCallback(e=>{const s=C.find(s=>s.packet_hash===e);s&&(v(null),I(s))},[C,I]),Z=a.useSyncExternalStore(it,ct,()=>!0);return s.jsxs("div",{className:t("flex flex-col",h),onMouseLeave:X,children:[s.jsx("div",{className:"divide-y divide-edge-subtle py-1",children:(()=>{if(i&&0===e.length)return s.jsx(xt,{});if(0===F.length)return s.jsx(dt,{message:p});const t=Z?ds:xs;return L?L.map(({packet:e,dupeCount:a},n)=>{const i=e.packet_hash?z.get(e.packet_hash):void 0,c=null!==k.traceTag&&i===k.traceTag;return s.jsx(t,{packet:e,onClick:e=>I(e,n),localHash:l,neighbors:r,isFlashing:m&&A===e.packet_hash,traceTag:i,isTraceHighlighted:c,onTraceHover:q,onViewTraceReport:Y,dupeCount:a,decodedMessages:D,onChannelClick:y},`${e.packet_hash}_${e.timestamp}_${n}`)}):F.map((e,a)=>{const n=e.packet_hash?z.get(e.packet_hash):void 0,i=null!==k.traceTag&&n===k.traceTag,c=R.get(a),o=void 0!==c&&null!==k.dupeGroup&&e.packet_hash===k.dupeGroup;return s.jsx(t,{packet:e,onClick:e=>I(e,a),localHash:l,neighbors:r,isFlashing:m&&A===e.packet_hash,traceTag:n,isTraceHighlighted:i,onTraceHover:q,onViewTraceReport:Y,dupeGroupPosition:c,isDupeGroupHovered:o,onDupeGroupHover:K,decodedMessages:D,onChannelClick:y},`${e.packet_hash}_${e.timestamp}_${a}`)})})()}),d&&T>1&&s.jsx("nav",{className:"border-t border-edge-subtle px-4 py-3",children:s.jsxs(Ve,{className:"justify-center",children:[s.jsx(Oe,{onClick:()=>P(M-1),disabled:1===M}),s.jsx(Ge,{children:B.map((e,t)=>"gap"===e?s.jsx(qe,{},`gap-${t}`):s.jsx(We,{page:e,current:e===M,onClick:P},e))}),s.jsx(Qe,{onClick:()=>P(M+1),disabled:M===T})]})}),s.jsx(mt,{showPagination:d,currentPage:M,perPage:o,displayCount:L?L.length:F.length,totalCount:d?H:e.length,action:u}),!x&&j&&s.jsx(Zs,{packets:j.packets,initialIndex:j.initialIndex,onClose:()=>b(null),onNavigatePrev:V,onNavigateNext:O,hasPrev:Q,hasNext:G}),N&&s.jsx(nt,{report:N,onClose:()=>v(null),onViewPacket:J})]})}export{ls as C,pt as P,Re as S,Ae as T,Ie as a,ts as g,Ke as u}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PathMapMapLibre-BuUgybSr.js","assets/vendor-react-j_fHog8x.js","assets/BasemapLayer-BT1oL_wV.js","assets/vendor-core-CmkNwW1A.js","assets/index-BBcIGlRT.js","assets/DelayedAnimateNumber-CRcNKpk-.js","assets/index-CCvUM2Hn.js","assets/payload-decoders-C74LtYDG.js","assets/node-types-CuQMppbD.js","assets/badge-colors-YAE4qQ7m.js","assets/chat-utils-I8bC4Iy5.js","assets/SignalIndicator-BnBRvoqf.js","assets/signal-scoring-CcBiRcks.js","assets/arrow-up-B5IQoVJ5.js","assets/copy-C_IB0gEd.js","assets/chevron-right-B6r5SVTI.js","assets/map-pin-FZNiPp_L.js","assets/triangle-alert-DH80WgOo.js","assets/DataBox-B8dpvpbW.js","assets/layers-BSSTaBST.js","assets/route-lCtw8lWd.js","assets/activity-_XXDiQ1M.js","assets/circle-check-DI0_62yI.js","assets/database-CO202xKy.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-QdsUNncv.css"])))=>i.map(i=>d[i]); +import{c as e}from"./vendor-core-CmkNwW1A.js";import{j as s,c as t,r as a,_ as n}from"./vendor-react-j_fHog8x.js";import{c as l,a6 as r,a7 as i,a8 as c,a9 as o,B as d,aa as x,ab as m,ac as p,j as h,ad as u,R as g,ae as f,af as y,ag as j,ah as b,ai as N,G as v,aj as k,ak as w,m as C,P as S,o as _,al as H,am as M,an as T,ao as P,ap as B,aq as F,ar as L,t as D,as as z,at as R,au as A,av as $,W as E,X as U,A as I,aw as V,Y as O,ax as Q,ay as G,az as W}from"./index-BBcIGlRT.js";import{P as q,d as K,a as X,b as Y,c as J,e as Z,f as ee}from"./payload-decoders-C74LtYDG.js";import{g as se,C as te}from"./node-types-CuQMppbD.js";import{D as ae,R as ne,P as le}from"./badge-colors-YAE4qQ7m.js";import{g as re,e as ie,a as ce}from"./chat-utils-I8bC4Iy5.js";import{A as oe,S as de,i as xe,a as me,g as pe,b as he,Z as ue}from"./SignalIndicator-BnBRvoqf.js";import{a as ge,A as fe}from"./arrow-up-B5IQoVJ5.js";import{C as ye}from"./copy-C_IB0gEd.js";import{C as je}from"./chevron-right-B6r5SVTI.js";import{M as be}from"./map-pin-FZNiPp_L.js";import{T as Ne}from"./triangle-alert-DH80WgOo.js";import{D as ve}from"./DataBox-B8dpvpbW.js";import{L as ke}from"./layers-BSSTaBST.js";import{H as we,R as Ce}from"./route-lCtw8lWd.js";import{A as Se}from"./activity-_XXDiQ1M.js";import{C as _e}from"./circle-check-DI0_62yI.js";import{D as He}from"./database-CO202xKy.js";import{H as Me,D as Te}from"./DelayedAnimateNumber-CRcNKpk-.js";const Pe=l("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),Be=l("corner-down-right",[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]),Fe=l("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),Le=l("message-circle-question-mark",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),De=l("reply",[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]),ze=l("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),Re=l("stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]),Ae=l("trophy",[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]]),$e=l("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);function Ee(e,s){[...s].reverse().forEach(t=>{const a=e.getVariant(t);a&&i(e,a),e.variantChildren&&e.variantChildren.forEach(e=>{Ee(e,s)})})}function Ue(){const e=new Set,s={subscribe:s=>(e.add(s),()=>{e.delete(s)}),start(s,t){const a=[];return e.forEach(e=>{a.push(r(e,s,{transitionOverride:t}))}),Promise.all(a)},set:s=>e.forEach(e=>{!function(e,s){Array.isArray(s)?Ee(e,s):"string"==typeof s?Ee(e,[s]):i(e,s)}(e,s)}),stop(){e.forEach(e=>{!function(e){e.values.forEach(e=>e.stop())}(e)})},mount:()=>()=>{s.stop()}};return s}function Ie(){const e=c(Ue);return o(e.mount,[]),e}function Ve({"aria-label":e="Page navigation",className:a,...n}){return s.jsx("nav",{"aria-label":e,...n,className:t("flex gap-x-2",a)})}function Oe({onClick:e,disabled:a=!1,className:n,children:l="Previous"}){return s.jsx("span",{className:t("grow basis-0",n),children:s.jsxs(d,{plain:!0,onClick:e,disabled:a,"aria-label":"Previous page",className:t("gap-1",a&&"invisible"),children:[s.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M2.75 8H13.25M2.75 8L5.25 5.5M2.75 8L5.25 10.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})}),l]})})}function Qe({onClick:e,disabled:a=!1,className:n,children:l="Next"}){return s.jsx("span",{className:t("flex grow basis-0 justify-end",n),children:s.jsxs(d,{plain:!0,onClick:e,disabled:a,"aria-label":"Next page",className:t("gap-1",a&&"invisible"),children:[l,s.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M13.25 8L2.75 8M13.25 8L10.75 10.5M13.25 8L10.75 5.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})]})})}function Ge({className:e,...a}){return s.jsx("span",{...a,className:t("hidden items-baseline gap-x-2 sm:flex",e)})}function We({page:e,current:a=!1,onClick:n,className:l,children:r}){return s.jsx(d,{plain:!a,outline:a,onClick:()=>null==n?void 0:n(e),"aria-label":`Page ${e}`,"aria-current":a?"page":void 0,className:t("min-w-[2.25rem] before:absolute before:-inset-px before:rounded-lg",a&&"before:bg-subtle-fill",l),children:r??e})}function qe({className:e,...a}){return s.jsx("span",{"aria-hidden":"true",...a,className:t("w-[2.25rem] select-none text-center text-sm text-fg-muted",e),children:"…"})}const Ke=e(e=>({requestedHash:null,requestChannel:s=>e({requestedHash:s}),clearRequest:()=>e({requestedHash:null})}));function Xe(e){if(!e||e.length<8)return null;const s=parseInt(e.slice(0,2),16),t=parseInt(e.slice(2,4),16),a=parseInt(e.slice(4,6),16),n=parseInt(e.slice(6,8),16);return isNaN(s)||isNaN(t)||isNaN(a)||isNaN(n)?null:((s|t<<8|a<<16|n<<24)>>>0).toString(16).toUpperCase().padStart(8,"0")}function Ye(e){return e>=10?"excellent":e>=5?"good":e>=0?"fair":e>=-5?"poor":"critical"}function Je(e){if(!e.payload)return null;try{const s=p(e.payload),t=function(e){const s=e.original_path||e.forwarded_path||[];if("string"==typeof s)try{const e=JSON.parse(s);if(Array.isArray(e))return e.map(e=>parseInt(e,16))}catch{return[]}else if(Array.isArray(s))return s.map(e=>parseInt(e,16));return[]}(e),a=X(s,t);return a?{packet:e,decoded:a,timestamp:e.timestamp??0,hopCount:a.snrValues.length,rssi:e.rssi,snr:e.snr}:null}catch{return null}}const Ze={rx:{icon:fe,label:"Rx",badgeColor:ae.rx,avatarBg:"bg-sys-green/15",avatarText:"text-sys-green"},forward:{icon:oe,label:"Fwd",badgeColor:ae.forward,avatarBg:"bg-sys-cyan/15",avatarText:"text-sys-cyan"},duplicate:{icon:ye,label:"Dupe",badgeColor:ae.duplicate,avatarBg:"bg-fg-muted/15",avatarText:"text-fg-secondary"},tx:{icon:ge,label:"Tx",badgeColor:ae.tx,avatarBg:"bg-sys-indigo/15",avatarText:"text-sys-indigo"},dropped:{icon:Be,label:"Drop",badgeColor:ae.dropped,avatarBg:"bg-sys-amber/15",avatarText:"text-sys-amber"}},es={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},ss={sm:"w-8 h-8",md:"w-9 h-9",lg:"w-10 h-10"};function ts(e){return"tx_local"===e.packet_origin?"tx":"tx_forward"===e.packet_origin?"forward":e.is_duplicate?"duplicate":e.transmitted?"forward":e.drop_reason?"dropped":"rx"}const as=a.memo(function({packet:e,showLabel:a=!0,variant:n="avatar",size:l="sm"}){const r=ts(e),i=Ze[r],c=i.icon;return"avatar"===n?s.jsx("div",{className:t("flex items-center justify-center rounded-full flex-shrink-0",i.avatarBg,ss[l]),children:s.jsx(c,{className:t(es[l],i.avatarText)})}):s.jsxs(h,{color:i.badgeColor,children:[s.jsx(c,{className:es[l]}),a&&i.label]})}),ns=a.memo(function({path:e,localHash:a,className:n}){if(!e||0===e.length)return s.jsx("span",{className:t("text-fg-muted text-xs",n),children:"—"});const l=a?(a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase():null;return s.jsx("span",{className:t("flex items-center gap-0.5 type-data-xs overflow-hidden",n),children:e.map((t,a)=>{const n=a===e.length-1,r=l&&t.toUpperCase()===l;return s.jsxs("span",{className:"flex items-center flex-shrink-0",children:[r?s.jsx("span",{className:"px-1 py-0.5 rounded bg-sys-amber/20 text-sys-amber text-[9px] font-medium",children:"You"}):s.jsx("span",{className:"px-1 py-0.5 rounded bg-subtle-fill-hover text-fg-secondary",children:t.toUpperCase()}),!n&&s.jsx(je,{className:"w-2.5 h-2.5 text-fg-muted mx-0.5 flex-shrink-0"})]},`${t}-${a}`)})})});function ls({channelName:e,onClick:a,active:n,compact:l,className:r}){const i=e.startsWith("#")?e:`#${e}`,c=t("inline-flex items-center flex-shrink-0","font-medium",l?"px-1.5 h-4 leading-4 rounded text-[10px]":"px-2 h-5 leading-5 rounded text-xs",n?"bg-sys-blue/20 text-sys-blue":"bg-sys-blue/10 text-sys-blue",a&&!n&&"hover:bg-sys-blue/20 cursor-pointer",r);return a?s.jsx("button",{type:"button",onClick:a,className:c,children:i}):s.jsx("span",{className:c,children:i})}function rs(e){return{"--data-box-accent":b[e]}}function is(e){const s=e.payload_type_name||y(e.payload_type??e.type),t=e.route_type_name||j(e.route_type??e.route);return{payloadType:s,routeType:t,payloadColor:le[s]??"zinc",routeColor:ne[t]??"zinc"}}function cs(e){if(!e)return[];if(Array.isArray(e))return e;try{const s=JSON.parse(e);return Array.isArray(s)?s:[]}catch{return[]}}function os(e,s){const{name:t,nodeType:a}=se(e,s);return{name:t,isCompanion:a.isCompanion||a.isClient,isRepeater:a.isRepeater}}const ds=a.memo(function({packet:e,onClick:n,localHash:l,neighbors:r,isFlashing:i=!1,isTraceHighlighted:c,onTraceHover:o,traceTag:d,onViewTraceReport:x,dupeGroupPosition:m,isDupeGroupHovered:p=!1,onDupeGroupHover:h,dupeCount:y,decodedMessages:j,onChannelClick:N}){const v=!y&&u(e.is_duplicate),k=void 0!==m,{payloadType:w,routeType:C,payloadColor:S,routeColor:_}=is(e),H="tx_local"===e.packet_origin,M="TRACE"===w,T=cs(e.original_path),P=cs(e.forwarded_path),B=P.length>0?P:T,F=e.src_hash?(e.src_hash.startsWith("0x")?e.src_hash.slice(2,6):e.src_hash.slice(0,4)).toUpperCase():null,{name:L,isRepeater:D}=os(e.src_hash,r);let z=null,R=null,A=null,$=null;if("GRP_TXT"===w&&j){const s=j.get(e.packet_hash),t=null==s?void 0:s.decoded;(null==t?void 0:t.decrypted)&&!t.macCorrupted&&t.text&&(R=t.senderName||null,z=t.text,A=t.channelName||null,$=t.channelHash||null)}else if("TXT_MSG"===w&&e.raw_packet)try{const s=q.fromHex(e.raw_packet);if(s.success&&s.packet){const e=Y(s.packet.payload);e&&!e.encrypted&&(z=e.text)}}catch{}const E=R||(D?null:L),U=!!E,I=!U&&D&&!!L,V=!U&&!I&&"GRP_TXT"===w&&!z,O=e.payload_length??e.length??0;e.lbt_attempts;const Q=a.useCallback(()=>{M&&d&&x?x(d):n(e)},[M,d,x,n,e]),G=a.useCallback(()=>{M&&d&&o&&o(d),k&&h&&e.packet_hash&&h(e.packet_hash)},[M,d,o,k,h,e.packet_hash]),W=a.useCallback(()=>{o&&o(null),h&&h(null)},[o,h]),K=b[S]||b.zinc,X=p;return s.jsxs("div",{onClick:Q,onMouseEnter:G,onMouseLeave:W,className:t("group relative cursor-pointer","hover:bg-subtle-fill",v&&!p&&"opacity-40",i&&"flash-row",H&&"bg-sys-indigo/5",c&&"bg-sys-teal/10"),children:[s.jsx("div",{className:t("absolute pointer-events-none transition-opacity duration-75",k?X?"opacity-100":"opacity-0":"opacity-0 group-hover:opacity-100"),style:(()=>{const e={pointerEvents:"none"};return"first"===m?{...e,borderTop:`2px solid ${K}`,borderLeft:`2px solid ${K}`,borderRight:`2px solid ${K}`,borderBottom:"none",borderRadius:"8px 8px 0 0",inset:"-2px -2px 0 -2px"}:"middle"===m?{...e,borderTop:"none",borderLeft:`2px solid ${K}`,borderRight:`2px solid ${K}`,borderBottom:"none",borderRadius:0,inset:"0 -2px"}:"last"===m?{...e,borderTop:"none",borderLeft:`2px solid ${K}`,borderRight:`2px solid ${K}`,borderBottom:`2px solid ${K}`,borderRadius:"0 0 8px 8px",inset:"0 -2px -2px -2px"}:{...e,border:`2px solid ${K}`,borderRadius:"8px",inset:"-2px"}})()}),s.jsxs("div",{className:"relative flex items-center gap-2 min-[600px]:gap-3 px-2 py-2 min-[600px]:px-3 min-[600px]:py-2.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[s.jsx("div",{className:"relative flex-shrink-0",children:U?s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-1 ring-edge-subtle",style:{backgroundColor:re(ie(E).cleanName)},children:ie(E).emoji?s.jsx("span",{className:"text-base leading-none",children:ie(E).emoji}):s.jsx("span",{className:"text-white text-[10px] font-bold tracking-tighter",children:ce(E)})}):I?s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:s.jsx(g,{className:"size-5 text-sys-blue"})}):V?s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-zinc-500/20 ring-1 ring-edge-subtle",children:s.jsx(Le,{className:"size-4 text-fg-muted"})}):s.jsx(as,{packet:e,variant:"avatar",size:"sm"})}),s.jsx("div",{className:"min-w-0",children:U?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"font-semibold text-[13px] text-fg-primary font-sans truncate max-w-[90px]",children:E}),F&&s.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate",children:F})]}):I?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"font-semibold text-[13px] text-fg-primary font-sans truncate max-w-[90px]",children:L}),F&&s.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate",children:F})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"font-bold text-[13px] text-fg-primary font-sans truncate",children:F||"—"}),L&&s.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate max-w-[70px]",children:L})]})})]}),s.jsxs("div",{className:"flex-1 flex items-center gap-1 min-[600px]:gap-1.5 min-[900px]:gap-2 min-w-0",children:[s.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:rs(S),children:w}),y&&y>1&&s.jsxs("span",{className:"data-box data-box-compact flex-shrink-0",children:["×",y]}),s.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:rs(_),children:C}),s.jsxs("span",{className:"hidden min-[520px]:inline type-data-xs text-fg-muted flex-shrink-0",children:[O,"B"]}),s.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:z?s.jsxs("span",{className:"text-[11px] text-fg-secondary truncate block flex items-center gap-1",children:[A&&s.jsx(ls,{channelName:A,compact:!0,onClick:N&&$?e=>{e.stopPropagation(),N($)}:void 0}),s.jsx("span",{className:"italic truncate",children:z})]}):s.jsx(ns,{path:B,localHash:l})})]}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[s.jsx("span",{className:"data-box data-box-compact",children:f(e.timestamp)}),s.jsx(de,{rssi:e.rssi,snr:e.snr,compact:!0,showValues:!0,validated:xe(e)})]})]})]})}),xs=a.memo(function({packet:e,onClick:a,localHash:n,neighbors:l,isFlashing:r=!1,isTraceHighlighted:i,traceTag:c,onViewTraceReport:o,dupeGroupPosition:d,isDupeGroupHovered:x=!1,onDupeGroupHover:m,dupeCount:p,decodedMessages:h,onChannelClick:y}){const{payloadType:j,routeType:N,payloadColor:v,routeColor:k}=is(e),w="tx_local"===e.packet_origin,C="TRACE"===j,S=!p&&u(e.is_duplicate),_=cs(e.original_path),H=cs(e.forwarded_path),M=H.length>0?H:_,T=M.length,P=e.src_hash?(e.src_hash.startsWith("0x")?e.src_hash.slice(2,6):e.src_hash.slice(0,4)).toUpperCase():null,{name:B,isRepeater:F}=os(e.src_hash,l);let L=null,D=null,z=null,R=null;if("GRP_TXT"===j&&h){const s=h.get(e.packet_hash),t=null==s?void 0:s.decoded;(null==t?void 0:t.decrypted)&&!t.macCorrupted&&t.text&&(D=t.senderName||null,L=t.text,z=t.channelName||null,R=t.channelHash||null)}else if("TXT_MSG"===j&&e.raw_packet)try{const s=q.fromHex(e.raw_packet);if(s.success&&s.packet){const e=Y(s.packet.payload);e&&!e.encrypted&&(L=e.text)}}catch{}const A=D||(F?null:B),$=!!A,E=!$&&F&&!!B,U=!$&&!E&&"GRP_TXT"===j&&!L,I=e.payload_length??e.length??0,V=e.lbt_attempts??0,O=b[v]||b.zinc;return s.jsxs("div",{onClick:()=>{C&&c&&o?o(c):a(e)},className:t("relative pl-3 pr-2.5 py-2 cursor-pointer","active:bg-subtle-fill-hover",S&&"opacity-40",r&&"flash-row",w&&"bg-sys-indigo/5",i&&"bg-sys-teal/10"),children:[s.jsx("div",{className:"absolute left-0 transition-all",style:(()=>{if(!d)return{opacity:0};const e=x?1:.4,s=x?"3px":"2px";return"first"===d?{backgroundColor:O,opacity:e,width:s,top:"6px",bottom:0,borderRadius:"0 9999px 0 0"}:"middle"===d?{backgroundColor:O,opacity:e,width:s,top:0,bottom:0,borderRadius:0}:"last"===d?{backgroundColor:O,opacity:e,width:s,top:0,bottom:"6px",borderRadius:"0 0 9999px 0"}:{backgroundColor:O,opacity:e,width:s,top:"6px",bottom:"6px",borderRadius:"9999px"}})()}),s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"relative flex-shrink-0 mt-0.5",children:$?s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-1 ring-edge-subtle",style:{backgroundColor:re(ie(A).cleanName)},children:ie(A).emoji?s.jsx("span",{className:"text-base leading-none",children:ie(A).emoji}):s.jsx("span",{className:"text-white text-[10px] font-bold tracking-tighter",children:ce(A)})}):E?s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:s.jsx(g,{className:"size-5 text-sys-blue"})}):U?s.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-zinc-500/20 ring-1 ring-edge-subtle",children:s.jsx(Le,{className:"size-4 text-fg-muted"})}):s.jsx(as,{packet:e,variant:"avatar",size:"sm"})}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[$?s.jsx("span",{className:"font-medium text-[14px] text-fg-primary tracking-tight truncate min-w-0",children:A}):E?s.jsx("span",{className:"font-medium text-[14px] text-fg-primary tracking-tight truncate min-w-0",children:B}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"font-semibold text-[14px] text-fg-primary tracking-tight flex-shrink-0",children:P||"—"}),B&&s.jsx("span",{className:"text-[12px] text-fg-muted truncate min-w-0",children:B})]}),s.jsx("div",{className:"flex-1"}),s.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:rs(v),children:j}),s.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:rs(k),children:N}),p&&p>1&&s.jsxs("span",{className:"data-box data-box-compact flex-shrink-0",children:["×",p]}),s.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[s.jsx("span",{className:"type-data-xs text-fg-muted w-[28px] text-right",children:e.rssi}),s.jsx(de,{rssi:e.rssi,compact:!0,showValues:!1,validated:xe(e)})]})]}),s.jsxs("div",{className:"flex items-center gap-1 type-data-xs text-fg-muted",children:[s.jsx("span",{className:"data-box data-box-compact flex-shrink-0",children:f(e.timestamp)}),I>0&&s.jsxs("span",{children:[I,"B"]}),V>0&&s.jsxs("span",{className:V>1?"text-sys-amber/60":void 0,children:["LBT:",V]}),null!=e.snr&&s.jsxs("span",{children:[e.snr.toFixed(0),"dB"]}),L?s.jsxs("span",{className:"text-[11px] text-fg-secondary truncate flex items-center gap-1 min-w-0",children:[z&&s.jsx(ls,{channelName:z,compact:!0,onClick:y&&R?e=>{e.stopPropagation(),y(R)}:void 0}),s.jsx("span",{className:"italic truncate",children:L})]}):T>0?s.jsx(ns,{path:M,localHash:n}):null]})]})]})]})});function ms(e){if(e.contact_type){const s=e.contact_type.toLowerCase();if("repeater"===s||"rep"===s)return!0;if("companion"===s||"client"===s||"cli"===s)return!1;if("room server"===s||"room_server"===s||"room"===s||"server"===s)return!1}return!0===e.is_repeater||(e.is_repeater,!1)}const ps=a.lazy(()=>n(()=>import("./PathMapMapLibre-BuUgybSr.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25])));function hs(e){return`${(100*e).toFixed(0)}%`}function us(e,s){const t=document.documentElement,a=getComputedStyle(t),n={success:a.getPropertyValue("--sys-green").trim()||"#39D98A",secondary:a.getPropertyValue("--sys-indigo").trim()||"#F9D26F",poor:a.getPropertyValue("--signal-poor").trim()||"#FF8A5C",danger:a.getPropertyValue("--sys-red").trim()||"#FF5C7A",muted:a.getPropertyValue("--text-muted").trim()||"#767688"};let l;return l=0===s?n.muted:e>=1?n.success:e>=.5?n.secondary:e>=.25?n.poor:e>0?n.danger:n.muted,{color:l}}class gs extends a.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?s.jsxs("div",{className:"h-[200px] flex items-center justify-center text-fg-muted",children:[s.jsx(Ne,{className:"w-4 h-4 mr-2"}),"Map failed to load"]}):this.props.children}}function fs({path:e,neighbors:n,localNode:l,localHash:r,srcHash:i,dstHash:c,neighborAffinity:o,prefixLookup:d,hubNodes:x,traceSnr:m,advertiserSource:p}){const[h,u]=a.useState(null),g=a.useMemo(()=>{if(!p)return null;const e="wardrive"===p.nodeType;return{prefix:p.prefix||"??",candidates:[{hash:p.publicKey||p.prefix||"source",name:p.name,latitude:p.latitude,longitude:p.longitude,probability:1,isLocal:!1,isWardrive:e}],confidence:1,totalMatches:1,isSource:!0}},[p]),f=a.useMemo(()=>{if(p)return null;if(!i)return null;const e=v(i),s=n[i];if((null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&(0!==s.latitude||0!==s.longitude))return{prefix:e,candidates:[{hash:i,name:s.node_name||s.name||"Source",latitude:s.latitude,longitude:s.longitude,probability:1,isLocal:!1,isDirectNeighbor:!0===s.zero_hop}],confidence:1,totalMatches:1,isSource:!0};const t=(null==s?void 0:s.node_name)||(null==s?void 0:s.name)||i.slice(0,8);return{prefix:e,candidates:[{hash:i,name:t,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isSource:!0}},[p,i,n]),y=a.useMemo(()=>{const e=(null==c?void 0:c.startsWith("0x"))?c.slice(2):c;if((!e||"00"===e||"0000000000000000"===e)&&l&&r){const e=v(r),s=0!==l.latitude||0!==l.longitude;return{prefix:e,candidates:[{hash:r,name:l.name||"Local Node",latitude:s?l.latitude:0,longitude:s?l.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}if(!c)return null;const s=v(c);if(r&&c===r&&l){const e=0!==l.latitude||0!==l.longitude;return{prefix:s,candidates:[{hash:c,name:l.name||"Local Node",latitude:e?l.latitude:0,longitude:e?l.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}const t=n[c];if((null==t?void 0:t.latitude)&&(null==t?void 0:t.longitude)&&(0!==t.latitude||0!==t.longitude))return{prefix:s,candidates:[{hash:c,name:t.node_name||t.name||"Destination",latitude:t.latitude,longitude:t.longitude,probability:1,isLocal:!1,isDirectNeighbor:!0===t.zero_hop}],confidence:1,totalMatches:1,isDestination:!0};const a=(null==t?void 0:t.node_name)||(null==t?void 0:t.name)||c.slice(0,8);return{prefix:s,candidates:[{hash:c,name:a,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isDestination:!0}},[c,n,l,r]),j=a.useMemo(()=>function(e,s,t,a,n,l){if(!e||0===e.length)return{hops:[],overallConfidence:0,hasValidPath:!1};const r=e.length-1,i=e.map((i,c)=>{const o=c===r,d=e.length-c,{candidates:x,totalMatches:m}=function(e,s,t,a,n=!1,l,r,i){const c=function(e){const s={};for(const[t,a]of Object.entries(e))ms(a)&&(s[t]=a);return s}(s);let o;if(r){const s=function(e,s,t){const a=s.toUpperCase(),n=e.get(a);if(!n||0===n.candidates.length)return{hash:null,confidence:0};if(null==t?void 0:t.isLastHop)return{hash:n.bestMatch,confidence:n.confidence};if(1===(null==t?void 0:t.position))return{hash:n.bestMatch,confidence:n.confidence};if((null==t?void 0:t.position)&&n.bestMatchForPosition.has(t.position)){const e=n.bestMatchForPosition.get(t.position),s=Math.max(e.confidence,n.confidence);return{hash:e.hash,confidence:s}}if((null==t?void 0:t.adjacentPrefixes)&&t.adjacentPrefixes.length>0){let e=n.bestMatch,s=0;for(const a of n.candidates){let n=0;for(const e of t.adjacentPrefixes)n+=a.adjacentPrefixCounts.get(e.toUpperCase())||0;const l=a.combinedScore+n/Math.max(1,a.totalAdjacentObservations)*.3;l>s&&(s=l,e=a.hash)}return{hash:e,confidence:n.confidence}}return{hash:n.bestMatch,confidence:n.confidence}}(r,e,{position:i,isLastHop:n});o=s.confidence}const{matches:d,probability:x}=function(e,s,t,a,n=!1){const l=e.toUpperCase(),r=[],i=t&&N(l,t);i&&r.push(t);for(const p of Object.keys(s))N(l,p)&&r.push(p);if(n&&i&&t&&1===r.length)return{matches:r,probability:1,bestMatch:t};if(n&&i&&r.length>1){const e=r.filter(e=>e!==t);if(1===e.length)return{matches:r,probability:1,bestMatch:e[0]}}const c=r.length>0?1/r.length:0,o=[...r].sort();let d=null,x=-1;if(1===o.length)d=o[0];else if(o.length>1&&a){for(const e of o){const s=a.get(e),t=s?"number"==typeof s?s:s.combinedScore:0;t>x&&(x=t,d=e)}d||(d=o[0])}else o.length>0&&(d=o[0]);let m=c;if(r.length>1&&a&&x>0){let e=0;for(const s of r){const t=a.get(s);e+=t?"number"==typeof t?t:t.combinedScore:0}e>0&&(m=Math.min(.95,x/e))}return{matches:r,probability:m,bestMatch:d}}(e,c,a,l,n),m=d.length,p=[],h=e.toUpperCase(),u=t&&void 0!==t.latitude&&void 0!==t.longitude&&(0!==t.latitude||0!==t.longitude);for(const f of d){if(a&&N(h,a)&&f===a&&u&&t){p.push({hash:f,name:t.name||"Local Node",latitude:t.latitude,longitude:t.longitude,probability:n?1:x,isLocal:!0});continue}const e=c[f];(null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude)&&(0!==e.latitude||0!==e.longitude)&&p.push({hash:f,name:e.node_name||e.name||"Unknown",latitude:e.latitude,longitude:e.longitude,probability:x,isLocal:!1,isDirectNeighbor:!0===e.zero_hop})}const g=p.length;if(1===g)p[0].probability=o??1;else if(g>1)if(void 0!==o&&o>0){p[0].probability=o;const e=1-o,s=g-1;p.slice(1).forEach(t=>{t.probability=e/s})}else{let e=0;const s=p.map(s=>{if(s.isLocal)return{candidate:s,score:1};const a=null==l?void 0:l.get(s.hash);let n=.5;var r;let i;return u&&t&&(n=(r=function(e,s,t,a){const n=(t-e)*Math.PI/180,l=(a-s)*Math.PI/180,r=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(t*Math.PI/180)*Math.sin(l/2)*Math.sin(l/2);return 2*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))*6371e3}(t.latitude,t.longitude,s.latitude,s.longitude))<100?1:r<500?.9:r<1e3?.7:r<5e3?.5:r<1e4?.3:.1),a?i=.3*n+.3*a.hopConsistencyScore+.4*a.frequencyScore:(i=n,s.isDirectNeighbor&&(i=Math.max(i,.8))),e+=i,{candidate:s,score:i}});if(e>0)s.forEach(({candidate:s,score:t})=>{s.probability=Math.min(.95,t/e)});else{const e=1/g;p.forEach(s=>s.probability=e)}}return{candidates:p,totalMatches:m}}(i,s,t,a,o,n,l,d),p=x.length>0?Math.max(...x.map(e=>e.probability)):0;return{prefix:i,candidates:x,confidence:p,totalMatches:m}}),c=i.reduce((e,s)=>0===s.confidence?0:e*s.confidence,1),o=i.some(e=>e.candidates.length>0);return{hops:i,overallConfidence:c,hasValidPath:o}}(e,n,l,r,o,d),[e,n,l,r,o,d]),b=a.useMemo(()=>{const e=[];g?e.push(g):f&&e.push(f),e.push(...j.hops),y&&e.push(y);const s=e.reduce((e,s)=>0===s.confidence?0:e*s.confidence,1),t=e.some(e=>e.candidates.some(e=>0!==e.latitude||0!==e.longitude));return{hops:e,overallConfidence:s,hasValidPath:t}},[g,f,j,y]);return b.hasValidPath?s.jsxs("div",{className:"h-full flex flex-col space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-fg-muted",children:"Path Confidence:"}),s.jsx("span",{className:(k=b.overallConfidence,k>=1?"text-sys-green":k>=.5?"text-sys-indigo":k>=.25?"text-signal-poor":k>0?"text-sys-red":"text-fg-muted"),children:hs(b.overallConfidence)}),s.jsx("button",{className:"text-fg-muted hover:text-fg-secondary transition-colors",title:"Confidence is calculated based on how many known nodes match each path prefix. Multiple matches reduce confidence due to collision probability.",children:s.jsx(te,{className:"w-3 h-3"})})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-sys-green"}),s.jsx("span",{className:"text-fg-muted",children:"Exact"})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-sys-indigo"}),s.jsx("span",{className:"text-fg-muted",children:"Multi"})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"w-2 h-2 rounded-full bg-fg-muted"}),s.jsx("span",{className:"text-fg-muted",children:"Unknown"})]})]})]}),s.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:s.jsx(gs,{children:s.jsx(a.Suspense,{fallback:s.jsx("div",{className:"h-full bg-elevated flex items-center justify-center text-fg-muted text-sm",children:"Loading map..."}),children:s.jsx(ps,{resolvedPath:b,localNode:l,hubNodes:x,hoveredHopIndex:h,onHoverHop:u,traceSnr:m})})})}),s.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:b.hops.map((e,a)=>{var n,l,r;const i=!0===e.isSource,c=!0===e.isDestination,o=h===a;let d;return d=i?`Source: ${(null==(n=e.candidates[0])?void 0:n.name)||"Unknown"}`:c?`Destination: ${(null==(l=e.candidates[0])?void 0:l.name)||"Unknown"}`:0===e.totalMatches?"No matching nodes found":1===e.totalMatches?`Exact match: ${(null==(r=e.candidates[0])?void 0:r.name)||"Unknown"}`:`${e.totalMatches} possible matches (${(100*e.confidence).toFixed(0)}% confidence)`,s.jsxs("div",{className:t("flex items-center gap-1 px-1.5 py-0.5 rounded type-data-xs cursor-pointer transition-all",o?"bg-sys-blue/20 ring-1 ring-sys-blue/50":"bg-elevated hover:bg-subtle",i&&"border border-sys-green/30",c&&"border border-sys-blue/30"),title:d,onMouseEnter:()=>u(a),onMouseLeave:()=>u(null),children:[i&&s.jsx("span",{className:"text-sys-green text-[8px] mr-0.5",children:"SRC"}),c&&s.jsx("span",{className:"text-sys-blue text-[8px] mr-0.5",children:"DST"}),s.jsx("span",{style:us(e.confidence,e.totalMatches),children:e.prefix}),!i&&!c&&e.totalMatches>1&&s.jsxs("span",{className:"text-fg-muted",children:["×",e.totalMatches]}),!i&&!c&&0===e.totalMatches&&s.jsx("span",{className:"text-fg-muted",children:"?"})]},a)})})]}):s.jsxs("div",{className:"flex items-center justify-center text-fg-muted text-xs py-4",children:[s.jsx(be,{className:"w-3.5 h-3.5 mr-1.5 opacity-50"}),"No location data available for path nodes"]});var k}function ys(e){return e.match(/.{1,2}/g)||[]}function js(e){return null!==e&&e.startsWith("payload:")}const bs=15,Ns="color-mix(in srgb, var(--elevated) 60%, var(--body))",vs="\n inset 0 0 0 1px color-mix(in srgb, var(--fg-primary) 6%, transparent),\n inset 0 1px 0 color-mix(in srgb, white 3%, transparent),\n 0 1px 2px color-mix(in srgb, black 5%, transparent)\n ",ks=2,ws={type:"tween",duration:.25,ease:[.25,.1,.25,1]};function Cs(e,s){return e?`inset 0 0 0 ${ks}px ${b[s]}`:vs}function Ss(e,s){return e?s:`color-mix(in srgb, ${s} ${bs}%, transparent)`}function _s({segments:e,selectedSegment:t,onSegmentClick:n}){const[l,r]=a.useState(null),[i,c]=a.useState(null),o=e.some(e=>void 0!==e.id)&&n,d=[];for(const s of e){const e=ys(s.hex);for(const t of e)d.push({byte:t.toUpperCase(),color:s.color,id:s.id})}const x=[];for(let s=0;s{const d=e.length<16;return s.jsx("div",{className:"flex rounded-md overflow-hidden",children:e.map(({byte:a,color:x,id:m},p)=>{const h=p===e.length-1,u=d&&h,g=b[x],f=m?l===m:i===x,y=Boolean(m&&t===m),j=f||y;return s.jsx("span",{className:"w-[1.75rem] text-xs text-center py-0.5 font-mono select-text "+(o?"cursor-pointer":""),style:{backgroundColor:Ss(j,g),color:j?"rgba(255,255,255,0.95)":g,transition:j?"none":"background-color 0.15s ease-out, color 0.15s ease-out",touchAction:"manipulation",...u?{borderRadius:"0 0.375rem 0.375rem 0"}:{}},onMouseEnter:()=>{m?r(m):c(x)},onMouseLeave:()=>{r(null),c(null)},onClick:()=>m&&(null==n?void 0:n(m)),onTouchStart:()=>{m?r(m):c(x)},onTouchEnd:()=>{r(null),c(null)},children:a},p)})},a)})})}function Hs({rawHex:e,hexSegments:t,selectedSegment:n,onSegmentClick:l}){const[r,i]=a.useState(!1),c=a.useCallback(async()=>{try{await navigator.clipboard.writeText(e.toUpperCase()),i(!0),setTimeout(()=>i(!1),2e3)}catch(s){}},[e]);return s.jsxs("div",{className:"bg-black rounded-2xl p-6 relative",children:[s.jsx(_s,{segments:t,selectedSegment:n,onSegmentClick:l}),s.jsx("button",{onClick:c,className:"absolute bottom-3 right-3 flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-subtle-fill-hover hover:bg-subtle-fill-strong text-fg-muted hover:text-fg-secondary transition-all text-xs font-sans",title:"Copy raw packet hex",children:r?s.jsxs(s.Fragment,{children:[s.jsx(_,{className:"w-3.5 h-3.5 text-sys-green"}),s.jsx("span",{className:"text-sys-green",children:"Copied"})]}):s.jsxs(s.Fragment,{children:[s.jsx(ye,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"Copy"})]})})]})}function Ms({bits:e,field:t,value:a,binary:n}){return s.jsxs("tr",{children:[s.jsx("td",{className:"py-1.5 text-xs text-fg-muted tabular-nums",children:e}),s.jsx("td",{className:"py-1.5 text-sm text-fg-secondary",children:t}),s.jsx("td",{className:"py-1.5",children:(()=>{if("Payload Type"===t){const e=le[a]||"zinc";return s.jsx(h,{color:e,children:a})}if("Route Type"===t){const e=ne[a]||"zinc";return s.jsx(h,{color:e,children:a})}return s.jsx("span",{className:"text-sm text-fg-primary",children:a})})()}),s.jsx("td",{className:"py-1.5 type-data-xs text-sys-cyan",children:n})]})}function Ts({id:e,title:t,color:a,hexBytes:n,startByte:l,endByte:r,isSelected:i,children:c}){const o=n?ys(n):[];return s.jsxs(C.div,{layout:"position",layoutId:e,transition:ws,className:"w-full min-w-0 overflow-hidden rounded-xl p-4 sm:p-5 space-y-4",style:{backgroundColor:Ns,boxShadow:Cs(i,a)},children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 min-w-0",children:[s.jsx(h,{color:a,children:t}),o.length>0&&o.length<=16&&o.map((e,t)=>s.jsx(h,{color:a,className:"font-mono",children:e.toUpperCase()},t))]}),s.jsxs("span",{className:"type-data-xs text-fg-muted flex-shrink-0",children:["Bytes ",l,"-",r]})]}),s.jsx("div",{className:"min-w-0 overflow-hidden",children:c})]})}function Ps({advert:e,timestamp:t}){const a=M(t||e.timestamp);return s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-indigo/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[s.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-indigo) 0%, var(--sys-blue) 100%)"},children:s.jsx(g,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:e.name||"Unknown Node"}),s.jsx("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:e.nodeType})]})]}),s.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),s.jsxs("div",{className:"px-4 py-3 space-y-2",children:[void 0!==e.latitude&&void 0!==e.longitude&&s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(be,{className:"w-4 h-4 text-sys-indigo flex-shrink-0"}),s.jsxs("span",{className:"text-sm text-fg-secondary font-mono",children:[e.latitude.toFixed(5),"°, ",e.longitude.toFixed(5),"°"]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(T,{className:"w-4 h-4 text-sys-indigo flex-shrink-0"}),s.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:a})]})]})]})})}function Bs({decoded:e,timestamp:t}){const a=t?M(t):"Unknown";return s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-teal/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[s.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-teal) 0%, var(--sys-cyan) 100%)"},children:s.jsx(He,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:e.channelName||"Channel Data"}),s.jsxs("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:[e.dataLength," bytes • ",e.decrypted?"Decrypted":"Encrypted"]})]})]}),s.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),s.jsxs("div",{className:"px-4 py-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(we,{className:"w-4 h-4 text-sys-teal flex-shrink-0"}),s.jsxs("span",{className:"text-sm text-fg-secondary font-sans",children:["Channel: ",s.jsxs("span",{className:"font-mono",children:["0x",e.channelHash]})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(T,{className:"w-4 h-4 text-sys-teal flex-shrink-0"}),s.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:a})]}),e.decrypted&&e.decryptedHex&&s.jsxs("div",{className:"mt-2 pt-2 border-t border-edge-subtle",children:[s.jsx("p",{className:"type-micro text-fg-muted mb-1 font-sans",children:"Decrypted Data"}),s.jsx("div",{className:"max-w-full overflow-x-auto",children:s.jsx(ve,{size:"compact",copy:!0,className:"inline-block",children:s.jsx("span",{className:"break-all text-xs",children:e.decryptedHex.toUpperCase()})})})]})]})]})})}function Fs({decoded:e,timestamp:t,isLoading:n=!1,onDecrypted:l}){const r=t?M(t):"Unknown",[i,c]=a.useState(""),[o,d]=a.useState(!1),[x,m]=a.useState(null),[h,u]=a.useState(!1),g=a.useCallback(async()=>{if(i.trim()&&e.ciphertextHex&&e.macHex){d(!0),m(null);try{const s=parseInt(e.channelHash,16),t=p(e.macHex),a=p(e.ciphertextHex),n=await P(i.trim(),s,t,a);if(n.success){const s=n.result.plaintext,t=new TextDecoder("utf-8",{fatal:!1}).decode(s.slice(5)),a=t.indexOf(": "),r={...e,channelName:n.result.channelName,decrypted:!0,timestamp:s[0]|s[1]<<8|s[2]<<16|s[3]<<24,flags:s[4],senderName:a>0?t.slice(0,a):void 0,text:a>0?t.slice(a+2):t};null==l||l(r),c(""),u(!1)}else m(n.error)}catch(s){m(s instanceof Error?s.message:"Unknown error")}finally{d(!1)}}},[i,e,l]);return n?s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-xl p-4 sm:p-5",style:{backgroundColor:"color-mix(in srgb, var(--elevated) 60%, var(--body))",boxShadow:"\n inset 0 0 0 1px color-mix(in srgb, var(--fg-primary) 6%, transparent),\n inset 0 1px 0 color-mix(in srgb, white 3%, transparent),\n 0 1px 2px color-mix(in srgb, black 5%, transparent)\n "},children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3 h-[15px]",children:[s.jsx("div",{className:"h-2.5 w-12 rounded bg-subtle-fill-hover animate-pulse"}),s.jsx("div",{className:"h-2.5 w-16 rounded bg-subtle-fill-hover animate-pulse"})]}),s.jsx("div",{className:"inline-block max-w-[85%] px-3.5 py-2 rounded-2xl rounded-tl-md",style:{background:"color-mix(in srgb, var(--sys-blue) 30%, transparent)"},children:s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("div",{className:"h-3.5 w-48 rounded bg-subtle-fill-strong animate-pulse"}),s.jsx("div",{className:"h-3.5 w-32 rounded bg-subtle-fill-strong animate-pulse"})]})})]})}):e.decrypted?s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-xl p-4 sm:p-5",style:{backgroundColor:"color-mix(in srgb, var(--elevated) 60%, var(--body))",boxShadow:"\n inset 0 0 0 1px color-mix(in srgb, var(--fg-primary) 6%, transparent),\n inset 0 1px 0 color-mix(in srgb, white 3%, transparent),\n 0 1px 2px color-mix(in srgb, black 5%, transparent)\n "},children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.senderName&&s.jsxs("span",{className:"text-[11px] text-fg-muted font-sans",children:["From ",s.jsx("span",{className:"text-fg-secondary font-medium",children:e.senderName})]}),e.channelName&&s.jsxs("span",{className:"text-[11px] text-fg-muted font-sans",children:["in ",s.jsx("span",{className:"text-sys-cyan font-medium",children:e.channelName})]})]}),s.jsx("div",{className:"inline-block max-w-[85%] px-3.5 py-2 rounded-2xl rounded-tl-md",style:{background:"linear-gradient(135deg, var(--sys-blue) 0%, color-mix(in srgb, var(--sys-blue) 85%, var(--sys-cyan)) 100%)"},children:s.jsx("p",{className:"text-sm text-white font-sans leading-relaxed whitespace-pre-wrap break-words",children:e.text})})]})}):s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-2xl overflow-hidden bg-zinc-500/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[s.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--zinc-500) 0%, color-mix(in srgb, var(--zinc-500) 70%, black) 100%)"},children:s.jsx(Fe,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:e.isPublicHashChannel?"Public Hash Channel":"Encrypted Message"}),s.jsxs("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:["Channel hash: ",s.jsxs("span",{className:"font-mono",children:["0x",e.channelHash]})]})]})]}),s.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),s.jsxs("div",{className:"px-4 py-3 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(T,{className:"w-4 h-4 text-zinc-400 flex-shrink-0"}),s.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:r})]}),e.ciphertextHex&&e.macHex&&s.jsx("div",{className:"space-y-2",children:h?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:i,onChange:e=>c(e.target.value),placeholder:"Channel name (e.g. south-bay)",className:"flex-1 px-3 py-1.5 text-sm rounded-lg bg-subtle-fill-strong border border-edge-subtle text-fg-primary placeholder:text-fg-muted focus:outline-none focus:border-zinc-500",onKeyDown:e=>"Enter"===e.key&&g(),disabled:o}),s.jsx("button",{onClick:g,disabled:o||!i.trim(),className:"px-3 py-1.5 text-sm font-medium rounded-lg bg-zinc-600 hover:bg-zinc-500 text-white disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:o?"Testing...":"Try"}),s.jsx("button",{onClick:()=>{u(!1),m(null),c("")},className:"px-2 py-1.5 text-sm rounded-lg hover:bg-subtle-fill-strong text-fg-muted transition-colors",children:"×"})]}),x&&s.jsx("p",{className:"text-xs text-sys-red",children:x})]}):s.jsx("button",{onClick:()=>u(!0),className:"text-xs text-zinc-400 hover:text-zinc-300 underline underline-offset-2 transition-colors",children:"Know the channel name? Try to decrypt"})}),!h&&s.jsx("p",{className:"text-xs text-fg-muted",children:e.isPublicHashChannel?"Public hash channel message. Key not in common channel list.":"Unknown hash channel. Channel name required for decryption."})]})]})})}function Ls({decoded:e,timestamp:t}){const a=t?M(t):"Unknown";return s.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:"linear-gradient(135deg, var(--sys-green) 0%, var(--sys-teal) 100%)"},children:s.jsx(_e,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-sm font-semibold text-fg-primary font-sans",children:"Acknowledgment"}),s.jsxs("p",{className:"text-xs text-fg-muted font-sans mt-0.5",children:["CRC: ",s.jsxs("span",{className:"font-mono text-sys-green",children:["0x",e.crc]})," · ",a]})]})]})}function Ds({decoded:e,timestamp:t}){const a=t?M(t):"Unknown",n=e.path.length;return s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-amber/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[s.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-amber) 0%, var(--sys-orange) 100%)"},children:s.jsx(Ce,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:"Path Response"}),s.jsxs("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:[n," ",1===n?"hop":"hops"]})]})]}),s.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),s.jsxs("div",{className:"px-4 py-3 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(T,{className:"w-4 h-4 text-sys-amber flex-shrink-0"}),s.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:a})]}),e.path.length>0&&s.jsx("div",{className:"mt-2 pt-2 border-t border-edge-subtle",children:s.jsx("div",{className:"flex flex-wrap items-center gap-2",children:e.path.map((e,t)=>s.jsxs("div",{className:"flex items-center gap-2",children:[t>0&&s.jsx(oe,{className:"w-4 h-4 text-sys-amber"}),s.jsx(h,{color:"amber",className:"font-mono",children:e})]},t))})})]})]})})}function zs({decoded:e,timestamp:t}){const a=t?M(t):"Unknown",n=e.pathHashes.length,l=e.snrValues.length;return s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-blue/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[s.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-blue) 0%, var(--sys-indigo) 100%)"},children:s.jsx(Se,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:["Trace ",e.isComplete?"Complete":"In Progress"]}),s.jsxs("p",{className:"text-sm text-fg-muted mt-0.5",children:["Tag: 0x",e.traceTag.slice(0,8),e.isComplete&&" • ✓"]})]})]}),s.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),s.jsxs("div",{className:"px-4 py-3 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(T,{className:"w-4 h-4 text-sys-blue flex-shrink-0"}),s.jsx("span",{className:"text-sm text-fg-secondary",children:a})]}),s.jsxs("div",{className:"flex items-center gap-4 text-xs text-fg-muted",children:[s.jsxs("span",{children:[n," target ",1===n?"hop":"hops"]}),s.jsx("span",{children:"•"}),s.jsxs("span",{children:[l," SNR ",1===l?"sample":"samples"]}),0!==e.authCode&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"•"}),s.jsxs("span",{children:["Auth: ",e.authCode]})]})]}),e.pathHashes.length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:e.pathHashes.map((t,a)=>{const n=e.snrValues[a],l=void 0!==n?(e=>e>=7?"green":e>=0?"yellow":e>=-5?"orange":"red")(n):"zinc",r=void 0!==n;return s.jsxs("div",{className:"flex items-center gap-2",children:[a>0&&s.jsx(oe,{className:"w-4 h-4 text-sys-blue flex-shrink-0"}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(h,{color:r?"blue":"zinc",className:"font-mono",children:t}),r&&s.jsxs(h,{color:l,className:"font-mono",children:[n>=0?"+":"",Number.isInteger(n)?n:n.toFixed(1),"dB"]})]})]},a)})})]})]})})}function Rs({decoded:e,timestamp:t}){const a=t?M(t):"Unknown";return e.encrypted?s.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:"linear-gradient(135deg, var(--sys-indigo) 0%, var(--sys-blue) 100%)"},children:s.jsx(Fe,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-sm font-semibold text-fg-primary font-sans",children:"Encrypted Message"}),s.jsxs("p",{className:"text-xs text-fg-muted font-sans mt-0.5",children:[e.srcHash," → ",e.destHash," · ",a]})]})]}):s.jsxs("div",{className:"mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1.5 px-1",children:[s.jsxs("span",{className:"text-[11px] text-fg-muted font-sans",children:[s.jsx("span",{className:"font-mono text-fg-secondary",children:e.srcHash})," → ",s.jsx("span",{className:"font-mono text-fg-secondary",children:e.destHash})]}),s.jsxs("span",{className:"text-[11px] text-fg-muted font-sans",children:["· ",a]})]}),s.jsx("div",{className:"inline-block max-w-[85%] px-3.5 py-2 rounded-2xl rounded-tr-md ml-auto",style:{background:"linear-gradient(135deg, var(--sys-green) 0%, var(--sys-teal) 100%)"},children:s.jsx("p",{className:"text-sm text-white font-sans leading-relaxed whitespace-pre-wrap break-words",children:e.text})})]})}function As({decoded:e,timestamp:t}){const a=t?M(t):"Unknown",n=(e.partNumber+1)/e.totalParts*100;return s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-yellow/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[s.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-yellow) 0%, var(--sys-amber) 100%)"},children:s.jsx(ke,{className:"w-6 h-6 text-white"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:"Multipart Segment"}),s.jsxs("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:["Part ",e.partNumber+1," of ",e.totalParts]})]})]}),s.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),s.jsxs("div",{className:"px-4 py-3 space-y-3",children:[s.jsx("div",{children:s.jsx("div",{className:"h-2 bg-subtle-fill-strong rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${n}%`,background:"linear-gradient(90deg, var(--sys-yellow), var(--sys-amber))"}})})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(we,{className:"w-4 h-4 text-sys-yellow flex-shrink-0"}),s.jsxs("span",{className:"text-sm text-fg-secondary font-sans",children:["Message ID: ",s.jsx("span",{className:"font-mono",children:e.messageId})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(T,{className:"w-4 h-4 text-sys-yellow flex-shrink-0"}),s.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:a})]})]})]})})}function $s({decoded:e,timestamp:t,payloadType:a}){const n=t?M(t):"Unknown",l=(()=>{switch(a){case S.REQ:return{icon:B,gradient:"var(--sys-orange), var(--sys-red)",bg:"rgba(249, 115, 22, 0.15)",label:"Request"};case S.RESPONSE:return{icon:De,gradient:"var(--sys-green), var(--sys-teal)",bg:"rgba(34, 197, 94, 0.15)",label:"Response"};case S.ANON_REQ:return{icon:Fe,gradient:"var(--sys-indigo), var(--sys-pink)",bg:"rgba(91, 91, 214, 0.15)",label:"Anonymous Request"};default:return{icon:me,gradient:"var(--sys-gray), var(--sys-slate)",bg:"rgba(107, 114, 128, 0.15)",label:e.payloadTypeName}}})(),r=l.icon;return s.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:`linear-gradient(135deg, ${l.gradient})`},children:s.jsx(r,{className:"w-5 h-5 text-white"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-sm font-semibold text-fg-primary font-sans",children:l.label}),s.jsxs("p",{className:"text-xs text-fg-muted font-sans mt-0.5",children:[e.length," bytes · ",n]})]})]})}function Es({pathHex:e}){if(!e)return null;const t=ys(e);return s.jsx("div",{className:"flex flex-wrap items-center gap-2 py-2",children:t.map((e,t)=>s.jsxs("div",{className:"flex items-center gap-2",children:[t>0&&s.jsx(oe,{className:"w-4 h-4 text-sys-amber flex-shrink-0"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(ve,{size:"compact",copy:!0,children:e.toUpperCase()}),s.jsx("span",{className:"text-xs text-fg-muted font-sans tabular-nums w-4 text-left",children:t+1})]})]},t))})}function Us({decoded:e,payloadType:t}){const a=H[t]||`TYPE_${t}`;switch(e.type){case"advert":{const t="chat"===e.nodeType?"companion":e.nodeType.replace("_"," "),a=void 0!==e.latitude&&void 0!==e.longitude&&!(0===e.latitude&&0===e.longitude);return s.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Role:"})," ",t]}),e.name&&s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Name:"})," ",e.name]}),a&&s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Location:"})," ",e.latitude.toFixed(4),"°, ",e.longitude.toFixed(4),"°"]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Time:"})," ",M(e.timestamp)]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Flags:"})," ",e.flagsDescription]})]})}case"ack":return s.jsx("div",{className:"text-xs text-fg-primary space-y-0.5",children:s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"CRC:"})," 0x",e.crc]})});case"path":return s.jsx("div",{className:"text-xs text-fg-primary space-y-1",children:s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Path:"})," ",e.pathString||"(empty)"]})});case"trace":return s.jsxs("div",{className:"text-xs text-fg-primary space-y-1",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Tag:"})," 0x",e.traceTag]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Target Path:"})," ",e.pathString||"(empty)"]}),e.snrValues.length>0&&s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"SNR:"})," ",e.snrValues.map(e=>`${e>=0?"+":""}${Number.isInteger(e)?e:e.toFixed(1)}dB`).join(" → ")]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Status:"})," ",e.isComplete?"✓ Complete":`In progress (${e.snrValues.length}/${e.pathHashes.length})`]})]});case"txt_msg":return s.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Dest:"})," ",e.destHash]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Src:"})," ",e.srcHash]}),e.encrypted?s.jsx("p",{className:"text-fg-muted italic",children:"Encrypted content"}):s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Text:"})," ",e.text]})]});case"grp_txt":return s.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Channel:"})," ",e.channelName?s.jsx("span",{className:"text-sys-green",children:e.channelName}):e.isPublicHashChannel?s.jsx("span",{className:"text-sys-indigo",children:"Public Hash Channel"}):s.jsxs("span",{className:"font-mono",children:["0x",e.channelHash]})]}),e.decrypted?s.jsxs(s.Fragment,{children:[e.senderName&&s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"From:"})," ",e.senderName]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Text:"})," ",e.text]})]}):e.isPublicHashChannel?s.jsx("p",{className:"text-fg-muted italic",children:"Encrypted (public hash channel)"}):s.jsx("p",{className:"text-fg-muted italic",children:"Encrypted (unknown channel)"})]});case"grp_data":return s.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Channel:"})," ",e.channelName?s.jsx("span",{className:"text-sys-teal",children:e.channelName}):s.jsxs("span",{className:"font-mono",children:["0x",e.channelHash]})]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Data:"})," ",e.dataLength," bytes ",e.decrypted?"(decrypted)":"(encrypted)"]})]});case"multipart":return s.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Part:"})," ",e.partNumber+1,"/",e.totalParts]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-fg-muted",children:"Message ID:"})," ",e.messageId]})]});default:return s.jsxs("p",{className:"text-xs text-fg-secondary",children:[a," (",e.length," bytes)"]})}}const Is=a.memo(function({packet:e,decodedGrpTxt:t}){var n,l;const r=e.raw_packet||"",i=r.length/2,c=k(),[o,d]=a.useState(null),[p,u]=a.useState(null),[g,f]=a.useState(!1),[y,j]=a.useState(null),b=a.useCallback(e=>{j(s=>s===e?null:e)},[]),N=a.useMemo(()=>function(e){if(!e||e.length<4)return null;const s=q.fromHex(e);if(!s.success||!s.packet)return null;const t=s.packet,a=function(e){const s=3&e,t=e>>2&15,a=e>>6&3;return[{bits:"0-1",field:"Route Type",value:x(s),binary:(3&s).toString(2).padStart(2,"0")},{bits:"2-5",field:"Payload Type",value:m(t),binary:(15&t).toString(2).padStart(4,"0")},{bits:"6-7",field:"Version",value:a.toString(),binary:(3&a).toString(2).padStart(2,"0")}]}(t.header),n=e.slice(0,2);let l=2,r="";t.hasTransportCodes()&&(r=e.slice(2,10),l=10);const i=e.slice(l,l+2),c=l+2,o=c+2*t.pathLen,d=e.slice(c,o),p=e.slice(o),h=K(t);return{packet:t,headerHex:n,headerFields:a,transportCodesHex:r,pathLengthHex:i,pathDataHex:d,payloadHex:p,payloadStartByte:Math.floor(o/2),decoded:h}}(r),[r]),v=null==(n=null==N?void 0:N.packet)?void 0:n.payloadType,_=(null==N?void 0:N.payloadHex)||"",H=null==(l=null==N?void 0:N.packet)?void 0:l.payload,T=v===S.GRP_TXT,P=v===S.GRP_DATA,B=T&&!t&&(!c||g);if(a.useEffect(()=>{if(d(null),f(!1),t)return;if(!T||!H||H.length<4)return;if(!c)return void f(!0);f(!0);let e=!1;return J(H).then(s=>{e||(d(s),f(!1))}),()=>{e=!0}},[_,T,c,t]),a.useEffect(()=>{if(u(null),!P||!H||H.length<4)return;if(!c)return;let e=!1;return Z(H).then(s=>{e||u(s)}),()=>{e=!0}},[_,P,c]),!N||0===r.length)return s.jsx("div",{className:"p-4 text-center text-fg-muted",children:s.jsx("p",{className:"text-sm",children:"No raw packet data available"})});const{packet:F}=N;let L=N.decoded;t&&"grp_txt"===N.decoded.type?L=t:o&&"grp_txt"===N.decoded.type?L=o:p&&"grp_data"===N.decoded.type&&(L=p);const D=a.useMemo(()=>function(e,t){switch(e.type){case"advert":return function(e,t){const a=[];let n=0;const l=t.slice(0,64);a.push({id:"payload:publicKey",title:"Public Key",color:"pink",hex:l,startByte:n,endByte:n+31,decoded:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:e.publicKey.toUpperCase()}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Ed25519 public key (32 bytes)"})]})}),n+=32;const r=t.slice(64,72);a.push({id:"payload:timestamp",title:"Timestamp",color:"orange",hex:r,startByte:n,endByte:n+3,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:r.toUpperCase()}),s.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:[e.timestamp," (",M(e.timestamp),")"]})]})}),n+=4;const i=t.slice(72,200);a.push({id:"payload:signature",title:"Signature",color:"teal",hex:i,startByte:n,endByte:n+63,decoded:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:e.signature.toUpperCase()}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Ed25519 signature (64 bytes)"})]})}),n+=64;const c=t.slice(200,202);if(a.push({id:"payload:flags",title:"Flags",color:"blue",hex:c,startByte:n,endByte:n,decoded:s.jsxs(s.Fragment,{children:[s.jsxs(ve,{size:"standard",copy:!0,children:["0x",e.flags.toString(16).padStart(2,"0").toUpperCase()]}),s.jsx("p",{className:"text-xs text-fg-primary mt-1",children:e.flagsDescription}),s.jsxs("p",{className:"text-xs text-fg-muted",children:["Node Type: ",e.nodeType]})]})}),n+=1,void 0!==e.latitude){const l=t.slice(2*n,2*n+8);a.push({id:"payload:latitude",title:"Latitude",color:"green",hex:l,startByte:n,endByte:n+3,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:l.toUpperCase()}),s.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:[e.latitude.toFixed(6),"°"]})]})}),n+=4}if(void 0!==e.longitude){const l=t.slice(2*n,2*n+8);a.push({id:"payload:longitude",title:"Longitude",color:"indigo",hex:l,startByte:n,endByte:n+3,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:l.toUpperCase()}),s.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:[e.longitude.toFixed(6),"°"]})]})}),n+=4}if(e.name){const l=t.slice(2*n),r=l.length/2;a.push({id:"payload:name",title:"Name",color:"amber",hex:l,startByte:n,endByte:n+r-1,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:l.toUpperCase()}),s.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:['"',e.name,'"']})]})})}return a}(e,t);case"ack":return function(e,t){return[{id:"payload:crc",title:"CRC",color:"green",hex:t.slice(0,8),startByte:0,endByte:3,decoded:s.jsxs(s.Fragment,{children:[s.jsxs(ve,{size:"standard",copy:!0,children:["0x",e.crc]}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"CRC32 of acknowledged packet"})]})}]}(e,t);case"grp_txt":return function(e,t){const a=[];a.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:t.slice(0,2),startByte:0,endByte:0,decoded:s.jsxs(s.Fragment,{children:[s.jsxs(ve,{size:"standard",copy:!0,children:["0x",e.channelHash]}),e.channelName&&s.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:["Channel: ",e.channelName]})]})}),e.macHex&&a.push({id:"payload:mac",title:"MAC",color:"indigo",hex:t.slice(2,6),startByte:1,endByte:2,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:e.macHex.toUpperCase()}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=t.slice(6);return n&&a.push({id:"payload:ciphertext",title:e.decrypted?"Message":"Ciphertext",color:e.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:e.decrypted?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-sm text-fg-primary",children:['"',e.text,'"']}),e.senderName&&s.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:["From: ",e.senderName]})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:n.toUpperCase()}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"AES-128-ECB encrypted"})]})}),a}(e,t);case"grp_data":return function(e,t){const a=[];a.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:t.slice(0,2),startByte:0,endByte:0,decoded:s.jsxs(s.Fragment,{children:[s.jsxs(ve,{size:"standard",copy:!0,children:["0x",e.channelHash]}),e.channelName&&s.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:["Channel: ",e.channelName]})]})}),e.macHex&&a.push({id:"payload:mac",title:"MAC",color:"indigo",hex:t.slice(2,6),startByte:1,endByte:2,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:e.macHex.toUpperCase()}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=t.slice(6);return n&&a.push({id:"payload:ciphertext",title:e.decrypted?"Decrypted Data":"Encrypted Data",color:e.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:(e.decryptedHex||n).toUpperCase()}),s.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[e.dataLength," bytes",e.decrypted?"":" (AES-128-ECB encrypted)"]})]})}),a}(e,t);case"path":return function(e,t){return[{id:"payload:path",title:"Path Hops",color:"amber",hex:t,startByte:0,endByte:t.length/2-1,decoded:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-wrap items-center gap-1",children:e.path.map((e,t)=>s.jsxs("span",{className:"flex items-center gap-1",children:[t>0&&s.jsx(oe,{className:"w-3 h-3 text-fg-muted"}),s.jsx(h,{color:"amber",className:"font-mono",children:e})]},t))}),s.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[e.path.length," hops"]})]})}]}(e,t);case"trace":return function(e,t){const a=[];a.push({id:"payload:crc",title:"Trace Tag",color:"blue",hex:t.slice(0,8),startByte:0,endByte:3,decoded:s.jsxs(s.Fragment,{children:[s.jsxs(ve,{size:"standard",copy:!0,children:["0x",e.traceTag]}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Unique trace request identifier"})]})}),a.push({id:"payload:mac",title:"Auth Code",color:"indigo",hex:t.slice(8,16),startByte:4,endByte:7,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:e.authCode}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Authentication/verification code"})]})}),a.push({id:"payload:flags",title:"Flags",color:"amber",hex:t.slice(16,18),startByte:8,endByte:8,decoded:s.jsxs(s.Fragment,{children:[s.jsxs(ve,{size:"standard",copy:!0,children:["0x",e.flags.toString(16).toUpperCase().padStart(2,"0")]}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:0===e.flags?"No flags set":`Flags: ${e.flags.toString(2).padStart(8,"0")}b`})]})});const n=t.slice(18);if(n){const t=e=>e>=7?"green":e>=0?"yellow":e>=-5?"orange":"red";a.push({id:"payload:path",title:"Target Path",color:"indigo",hex:n,startByte:9,endByte:9+n.length/2-1,decoded:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-wrap items-center gap-1",children:e.pathHashes.map((a,n)=>{const l=e.snrValues[n],r=void 0!==l?t(l):"zinc";return s.jsxs("span",{className:"flex items-center gap-1",children:[n>0&&s.jsx(oe,{className:"w-3 h-3 text-fg-muted"}),s.jsx(h,{color:"indigo",className:"font-mono",children:a}),void 0!==l&&s.jsxs(h,{color:r,className:"font-mono",children:[l>=0?"+":"",Number.isInteger(l)?l:l.toFixed(1),"dB"]})]},n)})}),s.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[e.pathHashes.length," target ",1===e.pathHashes.length?"hop":"hops",e.snrValues.length>0&&` • ${e.snrValues.length} SNR ${1===e.snrValues.length?"value":"values"} collected`,e.isComplete&&" • ✓ Complete"]})]})})}return a}(e,t);case"multipart":return function(e,t){const a=[];a.push({id:"payload:msgId",title:"Message ID",color:"blue",hex:t.slice(0,4),startByte:0,endByte:1,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:e.messageId.toUpperCase()}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Unique message identifier"})]})}),a.push({id:"payload:partNum",title:"Part Number",color:"amber",hex:t.slice(4,6),startByte:2,endByte:2,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:e.partNumber}),s.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"0-indexed part number"})]})}),a.push({id:"payload:totalParts",title:"Total Parts",color:"orange",hex:t.slice(6,8),startByte:3,endByte:3,decoded:s.jsxs(s.Fragment,{children:[s.jsx(ve,{size:"standard",copy:!0,children:e.totalParts}),s.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:["Part ",e.partNumber+1," of ",e.totalParts]})]})});const n=t.slice(8);return n&&a.push({id:"payload:partData",title:"Part Data",color:"cyan",hex:n,startByte:4,endByte:4+n.length/2-1,decoded:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:n.toUpperCase()}),s.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[n.length/2," bytes"]})]})}),a}(e,t);default:return[{id:"payload:ciphertext",title:"Raw Data",color:"zinc",hex:t,startByte:0,endByte:t.length/2-1,decoded:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:t.toUpperCase()}),s.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[t.length/2," bytes"]})]})}]}}(L,N.payloadHex),[L,N.payloadHex]),z="payload"===y||js(y),R=a.useMemo(()=>{const e=[{id:"header",hex:N.headerHex,color:"red"},...N.transportCodesHex?[{id:"transportCodes",hex:N.transportCodesHex,color:"indigo"}]:[],{id:"pathLength",hex:N.pathLengthHex,color:"green"},...N.pathDataHex?[{id:"pathData",hex:N.pathDataHex,color:"amber"}]:[]];return z?[...e,...(s=D,s.map(e=>({id:e.id,hex:e.hex,color:e.color})))]:[...e,{id:"payload",hex:N.payloadHex,color:"cyan"}];var s},[N,z,D]);return s.jsxs("div",{className:"font-mono space-y-2 min-w-0 overflow-hidden",children:[(()=>{switch(L.type){case"advert":return s.jsx(Ps,{advert:L,timestamp:e.timestamp});case"grp_data":return s.jsx(Bs,{decoded:L,timestamp:e.timestamp});case"grp_txt":return s.jsx(Fs,{decoded:L,timestamp:e.timestamp,isLoading:B,onDecrypted:d});case"ack":return s.jsx(Ls,{decoded:L,timestamp:e.timestamp});case"path":return s.jsx(Ds,{decoded:L,timestamp:e.timestamp});case"trace":return s.jsx(zs,{decoded:L,timestamp:e.timestamp});case"txt_msg":return s.jsx(Rs,{decoded:L,timestamp:e.timestamp});case"multipart":return s.jsx(As,{decoded:L,timestamp:e.timestamp});case"generic":return F.payloadType===S.REQ||F.payloadType===S.RESPONSE||F.payloadType===S.ANON_REQ?s.jsx($s,{decoded:L,timestamp:e.timestamp,payloadType:F.payloadType}):null;default:return null}})(),s.jsx(Hs,{rawHex:r,hexSegments:R,selectedSegment:y,onSegmentClick:b}),s.jsx(w,{children:s.jsx(C.div,{layout:!0,transition:ws,className:"space-y-2 min-w-0",children:(()=>{var e,t,a,n;const l=[{id:"header",title:"Header",color:"red",startByte:0,endByte:0,hexBytes:`0x${N.headerHex.toUpperCase()}`,condition:!0,content:s.jsxs("table",{className:"w-full text-left",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"type-micro text-fg-muted border-b border-edge-subtle font-sans",children:[s.jsx("th",{className:"py-1 font-medium",children:"Bits"}),s.jsx("th",{className:"py-1 font-medium",children:"Field"}),s.jsx("th",{className:"py-1 font-medium",children:"Value"}),s.jsx("th",{className:"py-1 font-medium",children:"Binary"})]})}),s.jsx("tbody",{children:N.headerFields.map(e=>s.jsx(Ms,{...e},e.bits))})]})},{id:"transportCodes",title:"Transport Codes",color:"indigo",startByte:1,endByte:4,hexBytes:(null==(e=N.transportCodesHex)?void 0:e.toUpperCase())||"",condition:!!N.transportCodesHex,content:s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-xs text-fg-muted",children:"Two 16-bit transport codes for encrypted routing"}),s.jsxs("div",{className:"mt-1 text-xs text-fg-secondary",children:["Code 1: 0x",null==(t=N.transportCodesHex)?void 0:t.slice(0,4).toUpperCase()," | Code 2: 0x",null==(a=N.transportCodesHex)?void 0:a.slice(4,8).toUpperCase()]})]})},{id:"pathLength",title:"Path Length",color:"green",startByte:N.transportCodesHex?5:1,endByte:N.transportCodesHex?5:1,hexBytes:`0x${N.pathLengthHex.toUpperCase()}`,condition:!0,content:s.jsxs("p",{className:"text-xs text-fg-muted pt-1",children:[F.pathLen," bytes showing route taken (increases as packet floods)"]})},{id:"pathData",title:"Path Data",color:"amber",startByte:N.transportCodesHex?6:2,endByte:(N.transportCodesHex?5:1)+F.pathLen,hexBytes:(null==(n=N.pathDataHex)?void 0:n.toUpperCase())||"",condition:F.pathLen>0,content:s.jsxs("div",{className:"space-y-3",children:[s.jsx(Es,{pathHex:N.pathDataHex}),s.jsx("p",{className:"text-xs text-fg-muted",children:"Historical route taken (bytes are added as packet floods through network)"})]})},{id:"payload",title:"Payload",color:"cyan",startByte:N.payloadStartByte,endByte:i-1,hexBytes:N.payloadHex.toUpperCase(),condition:!0,content:s.jsxs(s.Fragment,{children:[!js(y)&&s.jsxs("div",{className:"p-3 rounded-lg bg-black",children:[s.jsx("p",{className:"type-micro text-fg-muted mb-1.5 font-sans",children:"Decoded"}),s.jsx(Us,{decoded:L,payloadType:F.payloadType})]}),!js(y)&&D.length>0&&s.jsx("p",{className:"type-micro text-fg-muted mt-3 font-sans",children:"Click a field below to highlight its bytes"}),js(y)&&s.jsx("p",{className:"type-micro text-fg-muted font-sans",children:"↑ Selected field above • Other fields below ↓"})]})}].filter(e=>e.condition),r=js(y)?D.find(e=>e.id===y):null,c=js(y)?[...l].sort((e,s)=>"payload"===e.id?-1:"payload"===s.id?1:0):[...l].sort((e,s)=>e.id===y?-1:s.id===y?1:0),o=js(y)?D.filter(e=>e.id!==y):[];return s.jsxs(s.Fragment,{children:[r&&s.jsx(Ts,{id:`subfield-${r.id}`,title:r.title,color:r.color,startByte:N.payloadStartByte+r.startByte,endByte:N.payloadStartByte+r.endByte,hexBytes:r.hex.toUpperCase(),isSelected:!0,children:r.decoded},r.id),c.map(e=>s.jsx(Ts,{id:`section-${e.id}`,title:e.title,color:e.color,startByte:e.startByte,endByte:e.endByte,hexBytes:e.hexBytes,isSelected:e.id===y,children:e.content},e.id)),o.map(e=>s.jsxs(C.div,{layout:"position",layoutId:`subfield-${e.id}`,transition:ws,className:"w-full min-w-0 overflow-hidden rounded-xl p-4 sm:p-5 space-y-4",style:{backgroundColor:Ns,boxShadow:vs},children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 min-w-0",children:[s.jsx(h,{color:e.color,children:e.title}),e.hex.length<=32&&ys(e.hex).map((t,a)=>s.jsx(h,{color:e.color,className:"font-mono",children:t.toUpperCase()},a))]}),s.jsxs("span",{className:"type-data-xs text-fg-muted flex-shrink-0",children:["Bytes ",N.payloadStartByte+e.startByte,"-",N.payloadStartByte+e.endByte]})]}),s.jsx("div",{className:"min-w-0 overflow-hidden p-3 rounded-lg bg-black",children:e.decoded})]},e.id))]})})()})})]})});function Vs(e){if(!e)return[];if(Array.isArray(e))return e;try{const s=JSON.parse(e);return Array.isArray(s)?s:[]}catch{return[]}}function Os(e){return e?(e.startsWith("0x")?e.slice(2):e).slice(0,2).toUpperCase():""}function Qs({hop:e,compact:n=!1,index:l=0,highlightIndex:r=-1,isTrace:i=!1}){var c;const o=l===r,d=Ie();return a.useEffect(()=>{o&&i&&d.start({boxShadow:["0 0 0 0px rgba(113, 156, 223, 0)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 0px rgba(113, 156, 223, 0)"],transition:{duration:.5,times:[0,.2,.7,1],ease:"easeInOut"}})},[o,i,d]),s.jsxs(C.div,{className:t("flex items-center gap-1.5",n?"flex-row":"flex-col"),animate:{scale:o?1.05:1,opacity:o?1:.85},transition:{duration:.3,ease:"easeInOut"},children:[s.jsxs(C.div,{className:t("flex items-center gap-1.5 px-2.5 py-1 rounded-md","font-mono text-xs font-semibold",e.isLocal?"bg-sys-amber/20 text-sys-amber ring-1 ring-sys-amber/30":"bg-elevated/50 text-fg-primary ring-1 ring-edge-strong/50"),animate:d,initial:{boxShadow:"0 0 0 0px rgba(113, 156, 223, 0)"},children:[e.isLocal&&s.jsx(Me,{className:"w-3 h-3"}),s.jsx("span",{children:e.prefix}),void 0!==e.confidence&&e.confidence<.9&&s.jsxs("span",{className:"text-[9px] opacity-70",children:[(100*e.confidence).toFixed(0),"%"]})]}),!n&&(null==(c=e.neighborInfo)?void 0:c.name)&&s.jsx("span",{className:"text-xs text-fg-muted truncate max-w-[80px]",children:e.neighborInfo.name})]})}function Gs({snr:e}){const t=L(e),a=F()[t]||"#6b7280",n=Number.isInteger(e)?e.toString():e.toFixed(1);return s.jsxs(h,{customColor:a,compact:!0,className:"font-mono",children:[e>=0?"+":"",n,"dB"]})}function Ws({hops:e,compact:n,isTrace:l=!1}){const[r,i]=a.useState(-1);return a.useEffect(()=>{if(0===e.length)return;const s=setTimeout(()=>{i(0)},400),t=setInterval(()=>{i(s=>{const a=s+1;return a>=e.length?(clearInterval(t),-1):a})},l?500:600);return()=>{clearTimeout(s),clearInterval(t)}},[e.length,l]),s.jsx("div",{className:"p-6",style:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"4px 8px"},children:e.map((a,i)=>{const c=i%2==0,o=i===e.length-1;return s.jsxs("div",{className:"contents",children:[s.jsx("div",{className:t("flex items-center","justify-end"),children:c&&s.jsx(Qs,{hop:a,compact:n,index:i,highlightIndex:r,isTrace:l})}),s.jsx("div",{className:"flex flex-col items-center justify-center min-h-[28px]",children:!o&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px flex-1 bg-border-strong/40 min-h-[8px]"}),void 0!==a.snr&&s.jsx(Gs,{snr:a.snr}),s.jsx("svg",{className:"w-3 h-3 text-fg-muted flex-shrink-0",viewBox:"0 0 12 12",fill:"none",children:s.jsx("path",{d:"M6 2v8M3 7l3 3 3-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})}),s.jsx("div",{className:t("flex items-center","justify-start"),children:!c&&s.jsx(Qs,{hop:a,compact:n,index:i,highlightIndex:r,isTrace:l})})]},`${a.prefix}-${i}`)})})}const qs=a.memo(function({packet:e,neighbors:n,localHash:l,neighborAffinity:r,ghostPrefixes:i,direction:c="horizontal",compact:o=!1,traceSnr:d,overridePath:x}){const m=void 0!==d&&d.length>0,p=Vs(e.original_path),h=Vs(e.forwarded_path),u=x??(h.length>0?h:p),f=Os(l),y=a.useMemo(()=>u.map((e,s)=>{const t=e.toUpperCase(),a=t===f,l=(null==i?void 0:i.has(t))??!1,c=function(e,s,t){const a=e.toUpperCase();if(t){let e=null,n=0;if(t.forEach((s,t)=>{if(Os(t)===a){const a=s.combinedScore??0;a>n&&(n=a,e=t)}}),e&&s[e])return{hash:e,info:s[e],confidence:n}}for(const[n,l]of Object.entries(s))if(Os(n)===a)return{hash:n,info:l,confidence:void 0};return null}(t,n,r);return{prefix:t,fullHash:null==c?void 0:c.hash,neighborInfo:null==c?void 0:c.info,isLocal:a,isGhost:l,confidence:null==c?void 0:c.confidence,snr:null==d?void 0:d[s]}}),[u,n,r,f,i,d]);if(0===y.length)return s.jsxs("div",{className:"flex items-center gap-2 text-fg-muted text-xs",children:[s.jsx(g,{className:"w-4 h-4 opacity-50"}),s.jsx("span",{children:"Direct / No path data"})]});if("flowchart"===c)return s.jsx(Ws,{hops:y,compact:o,isTrace:m});const j="horizontal"===c?oe:fe;return s.jsx("div",{className:t("flex gap-1.5","horizontal"===c?"flex-row flex-wrap items-center":"flex-col items-start"),children:y.map((e,a)=>s.jsxs("div",{className:t("flex items-center gap-1.5","vertical"===c&&"flex-col"),children:[s.jsx(Qs,{hop:e,compact:o}),a0,i=ar&&n(a-1),disabled:!r,className:t("p-0.5 radius-badge transition-base",r?"text-fg-muted hover:text-fg-primary hover-bg":"text-fg-muted cursor-not-allowed"),"aria-label":"Previous observation",children:s.jsx(Pe,{className:l?"size-3":"size-4"})}),s.jsx("div",{className:"flex items-center gap-0.5",children:e.map((e,r)=>{const i=r===a,c=new Date(1e3*e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});return s.jsx(V,{color:i?"cyan":"zinc",filled:i,compact:l,onClick:()=>n(r),title:`Observation ${r+1} at ${c}`,className:t("transition-all duration-150",!i&&"opacity-60 hover:opacity-100"),children:l?s.jsx("span",{className:"tabular-nums",children:r+1}):s.jsxs("span",{className:"tabular-nums text-xs",children:["#",r+1,null!=e.rssi&&s.jsx("span",{className:"ml-1 opacity-70",children:e.rssi})]})},`${e.timestamp}_${r}`)})}),s.jsx("button",{onClick:()=>i&&n(a+1),disabled:!i,className:t("p-0.5 radius-badge transition-base",i?"text-fg-muted hover:text-fg-primary hover-bg":"text-fg-muted cursor-not-allowed"),"aria-label":"Next observation",children:s.jsx(je,{className:l?"size-3":"size-4"})}),s.jsxs("span",{className:t("text-fg-muted ml-1",l?"text-[9px]":"text-xs"),children:[s.jsx(ye,{className:"inline size-3 mr-0.5 opacity-50"}),e.length]})]})}function Ys({icon:e,label:a,disabled:n=!1}){return s.jsx(C.div,{className:"flex items-center gap-1 text-xs",title:a,animate:{opacity:n?.25:.6},transition:{duration:.15,ease:[.4,0,.2,1]},children:s.jsx("span",{className:t("flex items-center justify-center size-5 radius-badge border-control transition-base",n?"bg-subtle-fill border-edge-subtle":"bg-subtle-fill"),children:e})})}function Js({hasDuplicates:e,hasPrev:t,hasNext:a,canPrevDupe:n,canNextDupe:l}){return s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx(Ys,{icon:s.jsx(he,{className:"size-3"}),label:"Previous packet (↑)",disabled:!t}),s.jsx(Ys,{icon:s.jsx(O,{className:"size-3"}),label:"Next packet (↓)",disabled:!a})]}),e&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px h-3 bg-subtle-fill-strong"}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx(Ys,{icon:s.jsx(Pe,{className:"size-3"}),label:"Previous observation (←)",disabled:!n}),s.jsx(Ys,{icon:s.jsx(je,{className:"size-3"}),label:"Next observation (→)",disabled:!l})]})]})]})}const Zs=a.memo(function({packets:e,initialIndex:t=0,onClose:n,onNavigatePrev:l,onNavigateNext:r,hasPrev:i=!1,hasNext:c=!1}){const[o,d]=a.useState(t),x=e[o]??e[0],m=e.length>1,u=o>0,f=o{d(Math.max(0,Math.min(s,e.length-1)))},[e.length]);a.useEffect(()=>{const e=e=>{if(!(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))switch(e.key){case"ArrowUp":e.preventDefault(),null==l||l();break;case"ArrowDown":e.preventDefault(),null==r||r();break;case"ArrowLeft":e.preventDefault(),u&&d(e=>e-1);break;case"ArrowRight":e.preventDefault(),f&&d(e=>e+1)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[l,r,u,f]);const v=D(),k=z(),w=R(),_=A(),H=a.useMemo(()=>new Set(_.map(e=>e.prefix.toUpperCase())),[_]),M=x.payload_type_name||y(x.payload_type??x.type),P=x.route_type_name||j(x.route_type??x.route),B=x.payload_length??x.length??0,F=Ks(x.original_path),L=Ks(x.forwarded_path),V=F.length>0||L.length>0,O=L.length>0?L:F,Q=a.useMemo(()=>{var e;if(null==(e=null==v?void 0:v.config)?void 0:e.repeater)return{latitude:v.config.repeater.latitude,longitude:v.config.repeater.longitude,name:v.config.node_name||"Local Node"}},[v]),G=(null==v?void 0:v.neighbors)??{},W=w.size>0?w:void 0,q=x.raw_packet&&x.raw_packet.length>0,K=a.useMemo(()=>{if((x.payload_type??x.type)!==S.TRACE||!x.payload)return null;try{const e=p(x.payload),s=x.original_path||x.forwarded_path||[];let t=[];if("string"==typeof s)try{const e=JSON.parse(s);Array.isArray(e)&&(t=e.map(e=>parseInt(e,16)))}catch{t=[]}else Array.isArray(s)&&(t=s.map(e=>parseInt(e,16)));return X(e,t)}catch{return null}},[x]),Y=null==K?void 0:K.snrValues,J=a.useMemo(()=>{if((x.payload_type??x.type)!==S.ADVERT||!x.payload)return null;try{const e=p(x.payload),s=ee(e);if(!s)return null;const t=s.publicKey.slice(0,2).toUpperCase();return{...s,prefix:t}}catch{return null}},[x]),Z=a.useMemo(()=>{if((null==J?void 0:J.latitude)&&(null==J?void 0:J.longitude))return{latitude:J.latitude,longitude:J.longitude,name:J.name||`Node ${J.prefix||"??"}`,prefix:J.prefix,publicKey:J.publicKey}},[J]),se=e=>e&&0!==e?new Date(1e3*e).toLocaleString():"Unknown",te=$(x.packet_hash),ae=a.useMemo(()=>{if((x.payload_type??x.type)!==S.GRP_TXT)return null;if(!(null==te?void 0:te.decoded))return null;const e=te.decoded;return{type:"grp_txt",channelHash:e.channelHash,channelName:e.channelName,text:e.text??"",decrypted:e.decrypted,senderName:e.senderName,timestamp:e.timestamp,flags:e.flags,macCorrupted:e.macCorrupted}},[x,te]),ne=a.useCallback(e=>{if(!e)return null;const s=e.trim().match(/(-?\d+\.?\d*)\s*[,\s]\s*(-?\d+\.?\d*)/);if(!s)return null;const t=parseFloat(s[1]),a=parseFloat(s[2]);return isNaN(t)||isNaN(a)||t<-90||t>90||a<-180||a>180||0===t&&0===a?null:{lat:t,lon:a}},[]),re=a.useMemo(()=>{var e,s;if(!(null==ae?void 0:ae.decrypted))return;if(!(null==(e=ae.channelName)?void 0:e.toLowerCase().includes("wardrive")))return;const t=ne(ae.text);return t?{latitude:t.lat,longitude:t.lon,name:ae.senderName||"Wardrive Ping",prefix:(null==(s=ae.senderName)?void 0:s.slice(0,2).toUpperCase())||"WD",nodeType:"wardrive"}:void 0},[ae,ne]),ie=(x.payload_type??x.type)===S.ADVERT&&(void 0!==Z||V),ce=void 0!==re,oe=Z??re;if(0===O.length)return null;const me=(null==v?void 0:v.local_hash)?(v.local_hash.startsWith("0x")?v.local_hash.slice(2,4):v.local_hash.slice(0,2)).toUpperCase():"";for(const s of O){const e=s.toUpperCase();if(e!==me)if(W){let s=0,t=0;if(W.forEach((a,n)=>{(n.startsWith("0x")?n.slice(2,4):n.slice(0,2)).toUpperCase()===e&&(s++,t=Math.max(t,a.combinedScore??0))}),0===s)for(const a of Object.keys(G))if((a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase()===e)break}else for(const s of Object.keys(G))if((s.startsWith("0x")?s.slice(2,4):s.slice(0,2)).toUpperCase()===e)break}const he=le[M]??"zinc",ue=b[he]||b.zinc;return s.jsxs(E,{open:!0,onClose:n,size:"5xl",motionPlus:!0,className:"sm:h-[85vh] sm:max-h-[800px] md:h-[80vh] md:max-h-[900px]",children:[s.jsxs("div",{className:"sm:hidden",children:[s.jsx("div",{className:"flex justify-center pt-2 pb-1",children:s.jsx("div",{className:"w-9 h-1 rounded-full bg-fg-muted","aria-hidden":"true"})}),s.jsxs("div",{className:"flex items-center justify-between px-3 pb-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(h,{color:le[M]??"zinc",className:"!text-[9px] !px-1.5 !py-0",children:M}),s.jsx(h,{color:"DIRECT"===P||"T_DIRECT"===P?"cyan":"amber",className:"!text-[9px] !px-1.5 !py-0",children:P}),s.jsxs(h,{color:"zinc",className:"!text-[9px] !px-1.5 !py-0",children:[B,"B"]})]}),s.jsx("button",{onClick:n,className:"px-3 py-1.5 text-[15px] font-medium text-sys-blue active:text-sys-blue/80 transition-base flex-shrink-0 radius-inner active:bg-subtle-fill",children:"Done"})]}),m&&s.jsx("div",{className:"px-3 pb-2",children:s.jsx(Xs,{packets:e,selectedIndex:o,onSelect:N,compact:!0})})]}),s.jsx("div",{className:"hidden sm:block px-6 pt-5 pb-4",children:s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(h,{color:le[M]??"zinc",children:M}),s.jsx(h,{color:"DIRECT"===P||"T_DIRECT"===P?"cyan":"amber",children:P}),s.jsxs(h,{color:"zinc",children:[B,"B"]}),m&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-px h-4 bg-subtle-fill-strong"}),s.jsx(Xs,{packets:e,selectedIndex:o,onSelect:N})]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Js,{hasDuplicates:m,hasPrev:i,hasNext:c,canPrevDupe:u,canNextDupe:f}),s.jsx("button",{onClick:n,className:"p-1.5 -m-1.5 text-fg-muted hover:text-fg-primary transition-base radius-inner hover:bg-elevated flex-shrink-0",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}),s.jsx("div",{className:"sm:hidden h-[2px]",style:{backgroundColor:ue,opacity:.6}}),s.jsxs(U,{className:"p-0 overflow-hidden flex-1 flex flex-col min-h-0",children:[s.jsx("div",{className:"md:hidden flex-1 overflow-y-auto overflow-x-hidden",children:s.jsxs("div",{className:"p-2 space-y-2",children:[(null!=x.rssi||null!=x.snr)&&s.jsxs("div",{className:"relative flex items-center justify-between px-2 py-1.5 radius-inner bg-subtle-fill",children:[s.jsx(I,{mode:"popLayout",initial:!1,children:s.jsxs(C.div,{className:"flex items-center gap-3",initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15,ease:[.4,0,.2,1]},children:[s.jsx(de,{rssi:x.rssi,snr:x.snr,compact:!0,showValues:!0,validated:xe(x)}),s.jsx("span",{className:"text-[11px] text-fg-muted",children:pe(x.rssi)})]},o)}),O.length>0&&s.jsxs("span",{className:"type-data-xs text-fg-muted",children:[O.length," hop",1!==O.length?"s":""]})]}),(V&&O.length>0||ie||ce)&&s.jsx("div",{className:"overflow-hidden radius-inset",children:s.jsx("div",{className:"aspect-[4/3] w-full",children:s.jsx(fs,{path:O,neighbors:G,localNode:Q,localHash:null==v?void 0:v.local_hash,srcHash:x.src_hash,dstHash:x.dst_hash,neighborAffinity:W,hubNodes:[...k],traceSnr:Y,advertiserSource:oe})})}),K&&K.pathHashes.length>0&&s.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[s.jsx("div",{className:"px-3 py-2 space-y-1.5",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"type-micro text-fg-muted",children:"Trace Route"}),s.jsx("div",{className:"flex items-center gap-1.5",children:s.jsx(h,{color:K.isComplete?"green":"amber",compact:!0,children:K.isComplete?"Complete":"In Progress"})})]})}),s.jsx(qs,{packet:x,neighbors:G,localHash:null==v?void 0:v.local_hash,neighborAffinity:W,ghostPrefixes:H,direction:"flowchart",compact:!0,overridePath:K.pathHashes,traceSnr:K.snrValues})]}),V&&!K&&s.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[s.jsx("span",{className:"type-micro text-fg-muted",children:"Path"}),s.jsxs(h,{color:"zinc",compact:!0,children:[O.length," hop",1!==O.length?"s":""]})]}),s.jsx(qs,{packet:x,neighbors:G,localHash:null==v?void 0:v.local_hash,neighborAffinity:W,ghostPrefixes:H,direction:"flowchart",compact:!0,traceSnr:Y})]}),J&&s.jsxs("div",{className:"radius-inset bg-subtle-fill overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-edge-subtle",children:[s.jsx("span",{className:"type-micro text-fg-muted",children:"Advertiser Info"}),s.jsx(h,{color:"lime",compact:!0,children:J.nodeType})]}),s.jsxs("div",{className:"p-3 space-y-2",children:[J.name&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($e,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),s.jsx("span",{className:"type-label text-fg-primary truncate",children:J.name})]}),J.latitude&&J.longitude&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(be,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),s.jsxs("span",{className:"type-data-xs text-fg-secondary",children:[J.latitude.toFixed(5),", ",J.longitude.toFixed(5)]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ze,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),s.jsxs("span",{className:"type-data-xs text-fg-muted truncate",children:[J.publicKey.slice(0,16),"...",J.publicKey.slice(-8)]})]}),J.timestamp>0&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(T,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),s.jsx("span",{className:"text-xs text-fg-muted",children:se(J.timestamp)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(g,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),s.jsx("span",{className:"text-xs text-fg-muted",children:J.flagsDescription||`Flags: 0x${J.flags.toString(16).padStart(2,"0")}`})]})]})]}),q&&s.jsx("div",{className:"pt-1",children:s.jsx(Is,{packet:x,decodedGrpTxt:ae})})]})}),s.jsxs("div",{className:"hidden md:grid md:grid-cols-2 flex-1 overflow-hidden",children:[s.jsx("div",{className:"overflow-y-auto overflow-x-hidden scrollbar-none p-4 border-r border-edge-subtle",children:q&&s.jsx(Is,{packet:x,decodedGrpTxt:ae})}),s.jsxs("div",{className:"grid overflow-hidden",style:{gridTemplateRows:"minmax(280px, 1fr) auto"},children:[s.jsx("div",{className:"overflow-hidden p-2",children:V&&O.length>0||ie||ce?s.jsx("div",{className:"h-full w-full",children:s.jsx(fs,{path:O,neighbors:G,localNode:Q,localHash:null==v?void 0:v.local_hash,srcHash:x.src_hash,dstHash:x.dst_hash,neighborAffinity:W,hubNodes:[...k],traceSnr:Y,advertiserSource:oe})}):s.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center text-center px-4",children:[s.jsx(g,{className:"w-8 h-8 text-fg-muted/50 mb-2"}),s.jsx("span",{className:"text-sm text-fg-muted",children:"Direct Reception"}),s.jsx("span",{className:"text-xs text-fg-muted/70 mt-1",children:"Zero-hop packet — received directly from sender"})]})}),s.jsxs("div",{className:"overflow-y-auto max-h-[200px] p-2 space-y-2",children:[!K&&O.length<=1&&(null!=x.rssi||null!=x.snr)&&s.jsx("div",{className:"surface-base radius-inset p-4",children:s.jsxs("dl",{className:"text-xs grid grid-cols-2 gap-2",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-fg-muted mb-1",children:"Signal"}),s.jsx(I,{mode:"popLayout",initial:!1,children:s.jsxs(C.dd,{className:"flex items-center gap-2",initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15,ease:[.4,0,.2,1]},children:[s.jsx(de,{rssi:x.rssi,snr:x.snr,validated:xe(x)}),s.jsx("span",{className:"font-medium text-fg-primary",children:pe(x.rssi)})]},o)})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-fg-muted mb-1",children:"RF"}),s.jsx(I,{mode:"popLayout",initial:!1,children:s.jsxs(C.dd,{className:"type-data text-fg-secondary",initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15,ease:[.4,0,.2,1]},children:[null!=x.rssi&&`${x.rssi} dBm`,null!=x.snr&&` · ${x.snr.toFixed(1)} dB`]},o)})]})]})}),J&&s.jsxs("div",{className:"radius-inset bg-subtle-fill overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-edge-subtle",children:[s.jsx("span",{className:"type-micro text-fg-muted",children:"Advertiser"}),s.jsx(h,{color:"lime",compact:!0,children:J.nodeType})]}),s.jsxs("div",{className:"p-4 space-y-2.5",children:[J.name&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($e,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),s.jsx("span",{className:"type-label text-fg-primary truncate",children:J.name})]}),J.latitude&&J.longitude&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(be,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),s.jsxs("span",{className:"type-data-xs text-fg-secondary",children:[J.latitude.toFixed(5),", ",J.longitude.toFixed(5)]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ze,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),s.jsxs("span",{className:"text-[11px] font-mono text-fg-muted truncate",children:[J.publicKey.slice(0,16),"...",J.publicKey.slice(-8)]})]}),J.timestamp>0&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(T,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),s.jsx("span",{className:"text-xs text-fg-muted",children:se(J.timestamp)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(g,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),s.jsx("span",{className:"text-[11px] text-fg-muted",children:J.flagsDescription||`Flags: 0x${J.flags.toString(16).padStart(2,"0")}`})]})]})]}),K&&K.pathHashes.length>0&&s.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[s.jsxs("div",{className:"px-4 py-2 flex items-center justify-between",children:[s.jsx("span",{className:"type-micro text-fg-muted",children:"Trace Route"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(h,{color:K.isComplete?"green":"amber",compact:!0,children:K.isComplete?"Complete":"In Progress"}),s.jsxs(h,{color:"teal",compact:!0,children:[K.pathHashes.length,"h"]})]})]}),s.jsx(qs,{packet:x,neighbors:G,localHash:null==v?void 0:v.local_hash,neighborAffinity:W,ghostPrefixes:H,direction:"flowchart",compact:!0,overridePath:K.pathHashes,traceSnr:K.snrValues})]}),V&&!K&&s.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-2",children:[s.jsx("span",{className:"type-micro text-fg-muted",children:"Path"}),s.jsxs(h,{color:"zinc",compact:!0,children:[O.length,"h"]})]}),s.jsx(qs,{packet:x,neighbors:G,localHash:null==v?void 0:v.local_hash,neighborAffinity:W,ghostPrefixes:H,direction:"flowchart",compact:!0,traceSnr:Y})]})]})]})]})]})]})});function et({label:e,numericValue:t,unit:a,icon:n,subtext:l,showSign:r=!1}){return s.jsxs("div",{className:"radius-inner p-3 sm:radius-inset sm:p-4 bg-subtle-fill ring-1 ring-inset ring-edge-subtle",children:[s.jsx("div",{className:"mb-1.5 sm:mb-2",children:s.jsx("span",{className:"text-xs sm:type-micro text-fg-muted",children:e})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Te,{value:t,format:{minimumFractionDigits:1,maximumFractionDigits:1,signDisplay:r?"always":"auto"},className:"type-data-hero tracking-tight text-fg-primary"}),s.jsxs("div",{className:"flex flex-col items-center justify-center",children:[s.jsx(n,{className:"w-[14px] h-[14px] text-fg-muted"}),a&&s.jsx("span",{className:"text-xs font-medium leading-tight text-fg-muted",children:a})]})]}),l&&s.jsx("p",{className:"mt-1.5 sm:mt-2 type-data-xs sm:text-[11px] text-fg-muted/80 truncate",children:l})]})}function st({snr:e}){const a=e>=5?"bg-sys-teal":e>=0?"bg-sys-green":e>=-5?"bg-sys-amber":e>=-10?"bg-sys-orange":"bg-sys-red";return s.jsx("span",{className:t("w-1.5 h-1.5 rounded-full flex-shrink-0",a),title:`SNR: ${e.toFixed(1)} dB`})}function tt({fromPrefix:e,toPrefix:a,fromName:n,toName:l,snr:r,maxSnr:i,isWeakest:c,isStrongest:o,index:d=0}){const x=Math.max(i+5,15),m=Math.max(0,Math.min(100,(r- -20)/(x- -20)*100)),p="bg-[#0074BE]",u=r>=5?"bg-sys-teal":r>=0?"bg-sys-green":r>=-5?"bg-sys-amber":r>=-10?"bg-sys-orange":"bg-sys-red",g=.3+.15*d;return s.jsxs("div",{className:"relative p-3 pl-5 radius-inner bg-subtle-fill ring-1 ring-inset ring-edge-subtle",children:[s.jsx("span",{className:t("absolute left-0 top-1/2 -translate-y-1/2 h-4 w-0.5 rounded-full",u)}),s.jsx("span",{className:"absolute -top-0.5 -right-0.5",children:s.jsx(st,{snr:r})}),s.jsxs("div",{className:"sm:hidden",children:[s.jsxs("div",{className:"flex items-center justify-between mb-1",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx("span",{className:"text-[13px] font-medium text-fg-secondary truncate",children:n||e}),s.jsx(oe,{className:"w-3 h-3 text-fg-muted flex-shrink-0"}),s.jsx("span",{className:"text-[13px] font-semibold text-fg-primary truncate",children:l||a})]}),s.jsxs("div",{className:"flex items-center gap-1.5 ml-2 flex-shrink-0",children:[c&&s.jsx(h,{color:"red",compact:!0,children:"Low"}),o&&!c&&s.jsxs(h,{color:"amber",compact:!0,children:[s.jsx(Ae,{className:"w-2.5 h-2.5"}),"Best"]}),s.jsxs("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[12px] font-mono font-bold tabular-nums bg-subtle-fill-hover text-fg-primary ring-1 ring-inset ring-edge-subtle",children:[r>=0?"+":"−",Math.abs(r).toFixed(1)]})]})]}),s.jsx("div",{className:"h-1.5 bg-subtle-fill-strong rounded-full overflow-hidden",children:s.jsx(C.div,{className:t("h-full rounded-full",p),initial:{width:0},animate:{width:`${m}%`},transition:{duration:1.5,delay:g,ease:[.25,.1,.25,1]}})})]}),s.jsxs("div",{className:"hidden sm:block",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx("code",{className:"type-data-xs text-fg-muted",children:e}),n&&s.jsx("span",{className:"text-xs text-fg-secondary truncate max-w-[100px]",children:n})]}),s.jsx(oe,{className:"w-3 h-3 text-fg-muted/40 flex-shrink-0"}),s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx("code",{className:"font-mono text-xs font-semibold text-fg-primary",children:a}),l&&s.jsx("span",{className:"text-xs text-fg-secondary truncate max-w-[100px]",children:l})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[c&&s.jsx(h,{color:"red",compact:!0,children:"Bottleneck"}),o&&!c&&s.jsxs(h,{color:"amber",compact:!0,children:[s.jsx(Ae,{className:"w-3 h-3"}),"Strongest"]}),s.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-sm font-mono font-semibold tabular-nums bg-subtle-fill-hover text-fg-primary ring-1 ring-inset ring-edge-subtle",children:[r>=0?"+":"−",Math.abs(r).toFixed(1)]})]})]}),s.jsx("div",{className:"h-1.5 bg-elevated rounded-full overflow-hidden",children:s.jsx(C.div,{className:t("h-full rounded-full",p),initial:{width:0},animate:{width:`${m}%`},transition:{duration:1.5,delay:g,ease:[.25,.1,.25,1]}})})]})]})}function at(e,s){if("You"===e)return"You";const t=e.toUpperCase();for(const[a,n]of Object.entries(s))if((a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase()===t)return n.name||n.node_name||void 0}const nt=a.memo(function({report:e,onClose:t}){var a,n;const l=D(),r=(null==l?void 0:l.neighbors)??{},i=(null==(a=null==l?void 0:l.config)?void 0:a.repeater)?{latitude:l.config.repeater.latitude,longitude:l.config.repeater.longitude,name:l.config.node_name||"Local Node"}:void 0,c=null==(n=e.bestObservation)?void 0:n.decoded.snrValues,o=e.linkQuality?e.linkQuality.avgSnr>=5?"excellent":e.linkQuality.avgSnr>=0?"good":e.linkQuality.avgSnr>=-5?"fair":"poor":"unknown",d={excellent:"var(--signal-excellent)",good:"var(--signal-good)",fair:"var(--signal-fair)",poor:"var(--signal-poor)",unknown:"var(--fg-muted)"}[o];return s.jsxs(E,{open:!0,onClose:t,size:"5xl",motionPlus:!0,children:[s.jsxs("div",{className:"sm:hidden",children:[s.jsx("div",{className:"flex justify-center pt-2 pb-1",children:s.jsx("div",{className:"w-9 h-1 rounded-full bg-fg-primary/30","aria-hidden":"true"})}),s.jsxs("div",{className:"flex items-center justify-between px-4 pb-2",children:[s.jsx("h2",{className:"font-semibold text-[17px] text-fg-primary",children:"Trace Report"}),s.jsx("button",{onClick:t,className:"text-[17px] font-medium text-sys-blue active:text-sys-blue/80",children:"Done"})]})]}),s.jsx("div",{className:"sm:hidden h-[2px]",style:{backgroundColor:d,opacity:.6}}),s.jsx("div",{className:"hidden sm:block px-6 pt-5 pb-4",children:s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[s.jsx("h2",{className:"type-micro",children:"Trace Report"}),s.jsxs(h,{color:"excellent"===o||"good"===o?"green":"fair"===o?"amber":"red",children:[s.jsx(Re,{className:"w-3 h-3 mr-1"}),"excellent"===o?"Excellent":"good"===o?"Good":"fair"===o?"Fair":"Poor"]})]}),s.jsx("p",{className:"mt-1 text-xs sm:text-sm font-mono text-fg-muted tabular-nums",children:e.traceTag})]}),s.jsx("button",{onClick:t,className:"p-1.5 -m-1.5 text-fg-muted hover:text-fg-primary transition-base radius-inner hover:bg-elevated flex-shrink-0",children:s.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),s.jsxs("div",{className:"hidden sm:flex flex-wrap items-center gap-1.5 sm:gap-2 px-4 sm:px-6 pb-3 sm:pb-4 border-b border-edge-subtle",children:[s.jsxs(h,{color:"teal",children:[s.jsx("span",{className:"font-mono tabular-nums",children:e.targetHopCount}),s.jsxs("span",{className:"ml-1",children:["hop",1!==e.targetHopCount?"s":""]})]}),s.jsxs(h,{color:"zinc",children:[s.jsx("span",{className:"font-mono tabular-nums",children:e.observationCount}),s.jsx("span",{className:"ml-1",children:"obs"})]}),e.linkQuality&&s.jsxs(h,{color:"indigo",children:[s.jsx("span",{className:"font-mono tabular-nums",children:e.linkQuality.avgSnr.toFixed(1)}),s.jsx("span",{className:"ml-1",children:"dB avg"})]}),s.jsx("span",{className:"type-data-xs text-fg-muted",children:Q(e.duration)}),e.linkQuality&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-fg-muted/40",children:"•"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-sys-red/15 text-sys-red ring-1 ring-inset ring-sys-red/25",children:[s.jsx("span",{className:"opacity-70",children:"Min"}),s.jsx("span",{className:"font-mono tabular-nums",children:e.linkQuality.minSnr.toFixed(1)})]}),s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-sys-teal/15 text-sys-teal ring-1 ring-inset ring-sys-teal/25",children:[s.jsx("span",{className:"opacity-70",children:"Max"}),s.jsx("span",{className:"font-mono tabular-nums",children:e.linkQuality.maxSnr.toFixed(1)})]})]})]})]}),s.jsxs(U,{className:"p-0 overflow-hidden",children:[s.jsx("div",{className:"md:hidden h-[75vh] max-h-[calc(100vh-80px)] overflow-y-auto overflow-x-hidden",children:s.jsxs("div",{className:"px-4 py-3 space-y-3",children:[e.linkQuality&&s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsxs("div",{className:"radius-inner bg-subtle-fill ring-1 ring-inset ring-edge-subtle p-2.5 text-center",children:[s.jsx(Te,{value:Math.abs(e.linkQuality.minSnr),format:{maximumFractionDigits:0,signDisplay:"never"},prefix:e.linkQuality.minSnr<0?"-":"",className:"text-[20px] font-bold font-mono tabular-nums flex items-center justify-center text-fg-primary"}),s.jsxs("div",{className:"flex items-center justify-center gap-1 mt-1",children:[s.jsx(Ne,{className:"w-2.5 h-2.5 text-fg-muted"}),s.jsx("span",{className:"text-xs text-fg-muted",children:"Min dB"})]})]}),s.jsxs("div",{className:"radius-inner bg-subtle-fill ring-1 ring-inset ring-edge-subtle p-2.5 text-center",children:[s.jsx(Te,{value:e.linkQuality.maxSnr,format:{maximumFractionDigits:0,signDisplay:"always"},className:"text-[20px] font-bold font-mono text-fg-primary tabular-nums flex items-center justify-center"}),s.jsxs("div",{className:"flex items-center justify-center gap-1 mt-1",children:[s.jsx(ue,{className:"w-2.5 h-2.5 text-fg-muted"}),s.jsx("span",{className:"text-xs text-fg-muted",children:"Max dB"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs(h,{color:"excellent"===o||"good"===o?"green":"fair"===o?"amber":"red",compact:!0,children:[s.jsx(Re,{className:"w-2.5 h-2.5 mr-0.5"}),"excellent"===o?"Excellent":"good"===o?"Good":"fair"===o?"Fair":"Poor"]}),s.jsxs(h,{color:"teal",compact:!0,children:[e.targetHopCount," hops"]}),s.jsxs(h,{color:"zinc",compact:!0,children:[e.observationCount," obs"]}),s.jsx("span",{className:"type-data-xs text-fg-muted ml-auto",children:e.traceTag.slice(0,8)})]}),e.targetPath.length>0&&s.jsx("div",{className:"overflow-hidden radius-inset",children:s.jsx("div",{className:"aspect-[4/3] w-full",children:s.jsx(fs,{path:e.targetPath,neighbors:r,localNode:i,localHash:null==l?void 0:l.local_hash,srcHash:e.srcHash,dstHash:e.dstHash,traceSnr:c})})}),s.jsxs("div",{className:"radius-inset bg-body overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-edge-subtle",children:[s.jsx("span",{className:"text-[11px] font-medium text-fg-secondary",children:"Route Path"}),e.linkQuality&&s.jsxs("span",{className:"type-data-xs text-fg-muted",children:["SNR ",e.linkQuality.minSnr.toFixed(1)," → ",e.linkQuality.maxSnr.toFixed(1)," dB"]})]}),e.bestObservation?s.jsx(qs,{packet:e.bestObservation.packet,neighbors:r,localHash:null==l?void 0:l.local_hash,direction:"flowchart",compact:!0,overridePath:e.targetPath,traceSnr:e.bestObservation.decoded.snrValues}):s.jsx("div",{className:"p-6 text-center text-fg-muted text-xs",children:"No path data available"})]}),s.jsxs("div",{children:[s.jsxs("h3",{className:"type-micro text-fg-muted mb-2",children:["Link Quality · ",e.hopStats.length," hops"]}),s.jsx("div",{className:"space-y-1.5",children:e.hopStats.length>0?e.hopStats.map((t,a)=>{var n,l,i;const c=a{const t=e.targetPath[e.linkQuality.weakestLinkPosition],a=e.targetPath[e.linkQuality.weakestLinkPosition+1]||"You",n=at(t,r),l=at(a,r),i=e.targetPath[e.linkQuality.strongestLinkPosition],c=e.targetPath[e.linkQuality.strongestLinkPosition+1]||"You",o=at(i,r),d=at(c,r);return s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(et,{label:"Weakest Link",numericValue:e.linkQuality.minSnr,unit:"dB",icon:Ne,subtext:`${n||t} → ${l||a}`}),s.jsx(et,{label:"Best Link",numericValue:e.linkQuality.maxSnr,showSign:!0,unit:"dB",icon:ue,subtext:`${o||i} → ${d||c}`})]})})(),s.jsxs("div",{children:[s.jsx("h3",{className:"type-micro text-fg-muted mb-3",children:"Link Details"}),s.jsx("div",{className:"space-y-2",children:e.hopStats.length>0?e.hopStats.map((t,a)=>{var n,l,i;const c=a0&&s.jsx("div",{className:"overflow-hidden",children:s.jsx("div",{className:"aspect-square w-full",children:s.jsx(fs,{path:e.targetPath,neighbors:r,localNode:i,localHash:null==l?void 0:l.local_hash,srcHash:e.srcHash,dstHash:e.dstHash,traceSnr:c})})}),s.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[s.jsx("span",{className:"type-micro text-fg-muted",children:"Trace Route"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(h,{color:e.isComplete?"green":"amber",compact:!0,children:e.isComplete?"Complete":`${e.maxHopsObserved}/${e.targetHopCount}`}),s.jsxs(h,{color:"teal",compact:!0,children:[e.targetHopCount," hop",1!==e.targetHopCount?"s":""]})]})]}),e.linkQuality&&e.bestObservation&&s.jsxs("div",{className:"flex items-center gap-4 px-4 pb-2 type-data-xs text-fg-muted",children:[s.jsxs("span",{children:[s.jsx("span",{className:"opacity-60",children:"Tag"})," ",s.jsx("code",{className:"text-sys-teal tabular-nums",children:e.traceTag.slice(0,8)})]}),s.jsxs("span",{children:[s.jsx("span",{className:"opacity-60",children:"SNR"})," ",s.jsxs("code",{className:"text-sys-indigo tabular-nums",children:[e.linkQuality.minSnr.toFixed(1),"–",e.linkQuality.maxSnr.toFixed(1)]}),s.jsx("span",{className:"opacity-60",children:" dB"})]})]}),e.bestObservation?s.jsx(qs,{packet:e.bestObservation.packet,neighbors:r,localHash:null==l?void 0:l.local_hash,direction:"flowchart",compact:!0,overridePath:e.targetPath,traceSnr:e.bestObservation.decoded.snrValues}):s.jsx("div",{className:"p-8 text-center text-fg-muted text-xs",children:"No path data available"})]})]})]})]})]})}),lt="(min-width: 640px)";let rt=null;function it(e){return"undefined"==typeof window?()=>{}:(rt||(rt=window.matchMedia(lt)),rt.addEventListener("change",e),()=>null==rt?void 0:rt.removeEventListener("change",e))}function ct(){return"undefined"==typeof window||(rt||(rt=window.matchMedia(lt)),rt.matches)}function ot(e){if(!e||e.length<6)return null;const s=e,t=parseInt(s.slice(0,2),16);if(isNaN(t))return null;const a=3&t;let n=2;if(0!==a&&3!==a||(n=10),n+2>s.length)return null;const l=parseInt(s.slice(n,n+2),16);if(isNaN(l))return null;if(n+=2+2*l,n>=s.length)return null;const r=s.slice(n);return r.length>=38?r.slice(0,38):r}function dt({message:e}){return s.jsxs("div",{className:"flex flex-col items-center justify-center py-14 text-center",children:[s.jsx(g,{className:"size-6 text-fg-muted mb-2"}),s.jsx("p",{className:"text-sm text-fg-primary",children:e}),s.jsx("p",{className:"text-xs text-fg-muted",children:"Packets will appear here"})]})}function xt(){return s.jsx("div",{className:"py-14 text-center text-sm text-fg-muted",children:"Loading packets…"})}function mt({showPagination:e,currentPage:t,perPage:a,displayCount:n,totalCount:l,action:r}){const i=e?(t-1)*a+1:1,c=e?Math.min(t*a,l):n;return s.jsxs("div",{className:"flex items-center justify-between gap-4 border-t border-edge-subtle px-4 py-3 text-xs text-fg-muted sm:px-6",children:[s.jsxs("span",{children:["Showing"," ",s.jsx("span",{className:"font-medium text-fg-secondary",children:e?`${i}–${c}`:n})," ","of"," ",s.jsx("span",{className:"font-medium text-fg-secondary",children:l})," ","packets"]}),r]})}function pt({packets:e,allPackets:n,localHash:l,neighbors:r,loading:i=!1,maxPackets:c,perPage:o=50,showPagination:d=!1,onPacketSelect:x,flashNewest:m=!1,emptyMessage:p="No packets found",className:h,footerAction:u,hideDupes:g=!1,decodedMessages:f,onChannelClick:y}){const[j,b]=a.useState(null),[N,v]=a.useState(null),[k,w]=a.useState({traceTag:null,dupeGroup:null});a.useLayoutEffect(()=>{w({traceTag:null,dupeGroup:null})},[e]);const C=n??e,S=a.useMemo(()=>c&&c>0&&!g?e.slice(0,c):e,[e,c,g]),_=a.useMemo(()=>{if(!g)return null;const e=function(e){if(0===e.length)return[];const s=[];let t=0;for(;t0?{packet:e[r].packet,dupeCount:e[r].dupeCount+s}:e[r])}return l}(e);return c&&c>0?s.slice(0,c):s},[S,g,c]),H=_?_.length:S.length,{currentPage:M,totalPages:T,goToPage:P,pageRange:B}=function(e,s,t){const[n,l]=a.useState(1),r=t?Math.ceil(e/s):1;a.useEffect(()=>{n>r&&r>0&&queueMicrotask(()=>l(1))},[r,n]);const i=a.useCallback(e=>l(Math.max(1,Math.min(e,r))),[r]),c=a.useMemo(()=>function(e,s,t=1){if(s<=7)return Array.from({length:s},(e,s)=>s+1);const a=Math.max(e-t,1),n=Math.min(e+t,s),l=a>2,r=ns+1),"gap",s]}if(l&&!r){const e=3+2*t;return[1,"gap",...Array.from({length:e},(t,a)=>s-e+a+1)]}return[1,"gap",...Array.from({length:n-a+1},(e,s)=>a+s),"gap",s]}(n,r),[n,r]);return{currentPage:n,totalPages:r,goToPage:i,pageRange:c}}(H,o,d),F=a.useMemo(()=>{if(g)return S;if(!d)return S;const e=(M-1)*o;return S.slice(e,e+o)},[S,d,M,o,g]),L=a.useMemo(()=>{if(!_)return null;if(!d)return _;const e=(M-1)*o;return _.slice(e,e+o)},[_,d,M,o]),D=a.useMemo(()=>{var e;if(!f)return f;const s=new Map,t=new Map,a=[];for(const r of S){const n=r.payload_type??r.type;if(n!==W.GRP_TXT)continue;const l=ot(r.raw_packet),i=`${n}:${r.payload_length??r.length??0}:${Math.floor((r.timestamp??0)/60)}`,c=f.get(r.packet_hash);(null==(e=null==c?void 0:c.decoded)?void 0:e.decrypted)&&!c.decoded.macCorrupted?(l&&!s.has(l)&&s.set(l,c),t.has(i)||t.set(i,c)):f.has(r.packet_hash)||a.push({hash:r.packet_hash,payloadHex:l,approxKey:i})}if(0===a.length||0===s.size&&0===t.size)return f;const n=new Map(f);let l=0;for(const{hash:r,payloadHex:i,approxKey:c}of a){if(n.has(r))continue;const e=(i?s.get(i):null)??t.get(c);e&&(n.set(r,e),l++)}return l>0?n:f},[f,S]),z=a.useMemo(()=>function(e){const s=new Map;for(const t of e)if((t.payload_type??t.type)===W.TRACE&&t.payload&&t.packet_hash){const e=Xe(t.payload);e&&s.set(t.packet_hash,e)}return s}(F),[F]),R=a.useMemo(()=>function(e){const s=new Map;if(0===e.length)return s;for(let t=0;t{var t,a;if(!s||!e.length)return;const r=(null==(t=e[0])?void 0:t.timestamp)??0,i=r>l.current&&l.current>0;if(l.current=r,!i)return;const c=null==(a=e[0])?void 0:a.packet_hash;if(!c)return;const o=requestAnimationFrame(()=>n(c)),d=setTimeout(()=>n(null),600);return()=>{cancelAnimationFrame(o),clearTimeout(d)}},[e,s]),t}(e,m),$=a.useCallback((e,s)=>{var t,a;const n=e.packet_hash;if(!n)return[e];let l=s;for(;l>0&&(null==(t=F[l-1])?void 0:t.packet_hash)===n;)l--;let r=s;for(;r{var s,t;const a=null==(s=F[e])?void 0:s.packet_hash;if(!a)return e;let n=e;for(;n>0&&(null==(t=F[n-1])?void 0:t.packet_hash)===a;)n--;return n},[F]),U=a.useCallback(e=>{var s,t;const a=null==(s=F[e])?void 0:s.packet_hash;if(!a)return e;let n=e;for(;n{if(x)x(e);else if(void 0!==s){const t=$(e,s),a=t.indexOf(e);b({packets:t,initialIndex:a>=0?a:0,rowIndex:s})}else b({packets:[e],initialIndex:0,rowIndex:0})},[x,$]),V=a.useCallback(()=>{if(!j)return;const e=E(j.rowIndex)-1;if(e<0)return;const s=F[e];if(!s)return;const t=$(s,e);b({packets:t,initialIndex:0,rowIndex:e})},[j,F,E,$]),O=a.useCallback(()=>{if(!j)return;const e=U(j.rowIndex)+1;if(e>=F.length)return;const s=F[e];if(!s)return;const t=$(s,e);b({packets:t,initialIndex:0,rowIndex:e})},[j,F,U,$]),Q=a.useMemo(()=>!!j&&E(j.rowIndex)>0,[j,E]),G=a.useMemo(()=>!!j&&U(j.rowIndex)w(s=>({...s,traceTag:e})),[]),K=a.useCallback(e=>w(s=>({...s,dupeGroup:e})),[]),X=a.useCallback(()=>{w({traceTag:null,dupeGroup:null})},[]),Y=a.useCallback(e=>{const s=C.filter(s=>(s.payload_type??s.type)===W.TRACE&&s.payload&&Xe(s.payload)===e);if(0===s.length)return;const t=function(e){const s=new Map;for(const t of e){const e=Je(t);if(!e)continue;const a=e.decoded.traceTag,n=s.get(a)||[];n.push(e),s.set(a,n)}for(const[t,a]of s)a.sort((e,s)=>e.timestamp-s.timestamp),s.set(t,a);return s}(s),a=t.get(e);(null==a?void 0:a.length)&&v(function(e,s){if(0===s.length)return{traceTag:e,traceTagValue:0,targetPath:[],targetHopCount:0,observations:[],observationCount:0,firstSeen:0,lastSeen:0,duration:0,isComplete:!1,maxHopsObserved:0,progressPercent:0,bestObservation:null,hopStats:[],linkQuality:null};const t=[...s].sort((e,s)=>e.timestamp-s.timestamp),a=t.reduce((e,s)=>s.hopCount>e.hopCount?s:e,t[0]),n=t[0].timestamp,l=t[t.length-1].timestamp,r=a.decoded.pathHashes,i=r.length,c=a.hopCount,o=a.decoded.isComplete,d=[],x=a.decoded.snrValues;for(let p=0;p0){const e=Math.min(...x),s=Math.max(...x);m={minSnr:e,maxSnr:s,avgSnr:x.reduce((e,s)=>e+s,0)/x.length,weakestLinkPosition:x.indexOf(e),strongestLinkPosition:x.indexOf(s)}}return{traceTag:e,traceTagValue:a.decoded.traceTagValue,targetPath:r,targetHopCount:i,observations:t,observationCount:t.length,firstSeen:n,lastSeen:l,duration:l-n,isComplete:o,maxHopsObserved:c,progressPercent:i>0?Math.round(c/i*100):0,bestObservation:a,hopStats:d,linkQuality:m,srcHash:a.packet.src_hash,dstHash:a.packet.dst_hash}}(e,a))},[C]),J=a.useCallback(e=>{const s=C.find(s=>s.packet_hash===e);s&&(v(null),I(s))},[C,I]),Z=a.useSyncExternalStore(it,ct,()=>!0);return s.jsxs("div",{className:t("flex flex-col",h),onMouseLeave:X,children:[s.jsx("div",{className:"divide-y divide-edge-subtle py-1",children:(()=>{if(i&&0===e.length)return s.jsx(xt,{});if(0===F.length)return s.jsx(dt,{message:p});const t=Z?ds:xs;return L?L.map(({packet:e,dupeCount:a},n)=>{const i=e.packet_hash?z.get(e.packet_hash):void 0,c=null!==k.traceTag&&i===k.traceTag;return s.jsx(t,{packet:e,onClick:e=>I(e,n),localHash:l,neighbors:r,isFlashing:m&&A===e.packet_hash,traceTag:i,isTraceHighlighted:c,onTraceHover:q,onViewTraceReport:Y,dupeCount:a,decodedMessages:D,onChannelClick:y},`${e.packet_hash}_${e.timestamp}_${n}`)}):F.map((e,a)=>{const n=e.packet_hash?z.get(e.packet_hash):void 0,i=null!==k.traceTag&&n===k.traceTag,c=R.get(a),o=void 0!==c&&null!==k.dupeGroup&&e.packet_hash===k.dupeGroup;return s.jsx(t,{packet:e,onClick:e=>I(e,a),localHash:l,neighbors:r,isFlashing:m&&A===e.packet_hash,traceTag:n,isTraceHighlighted:i,onTraceHover:q,onViewTraceReport:Y,dupeGroupPosition:c,isDupeGroupHovered:o,onDupeGroupHover:K,decodedMessages:D,onChannelClick:y},`${e.packet_hash}_${e.timestamp}_${a}`)})})()}),d&&T>1&&s.jsx("nav",{className:"border-t border-edge-subtle px-4 py-3",children:s.jsxs(Ve,{className:"justify-center",children:[s.jsx(Oe,{onClick:()=>P(M-1),disabled:1===M}),s.jsx(Ge,{children:B.map((e,t)=>"gap"===e?s.jsx(qe,{},`gap-${t}`):s.jsx(We,{page:e,current:e===M,onClick:P},e))}),s.jsx(Qe,{onClick:()=>P(M+1),disabled:M===T})]})}),s.jsx(mt,{showPagination:d,currentPage:M,perPage:o,displayCount:L?L.length:F.length,totalCount:d?H:e.length,action:u}),!x&&j&&s.jsx(Zs,{packets:j.packets,initialIndex:j.initialIndex,onClose:()=>b(null),onNavigatePrev:V,onNavigateNext:O,hasPrev:Q,hasNext:G}),N&&s.jsx(nt,{report:N,onClose:()=>v(null),onViewPacket:J})]})}export{ls as C,pt as P,Re as S,Ae as T,Ie as a,ts as g,Ke as u}; diff --git a/frontend/dist/assets/Packets-CKR_k_Es.js b/frontend/dist/assets/Packets-B6m1oZw5.js similarity index 91% rename from frontend/dist/assets/Packets-CKR_k_Es.js rename to frontend/dist/assets/Packets-B6m1oZw5.js index 5f214b18..d22bb079 100644 --- a/frontend/dist/assets/Packets-CKR_k_Es.js +++ b/frontend/dist/assets/Packets-B6m1oZw5.js @@ -1 +1 @@ -import{r as e,j as a,H as s,c as l,k as t,B as i,U as r,g as o}from"./vendor-react-j_fHog8x.js";import{Y as n,o as c,p as d,t as m,v as u,a3 as p,a4 as x,R as h,B as b,a5 as g,T as j}from"./index-01Tx8g53.js";import{g as v,u as f,P as y}from"./PacketList-C6Vv6v7V.js";import{A as N}from"./arrow-up-C91otjLx.js";import{A as w,C}from"./SignalIndicator-CIKrVFY9.js";import{C as k}from"./copy-B5OWhmpX.js";import{U as S}from"./users-CIk0ES1a.js";import{P,b as R,B as M,a as L}from"./PageLayout-DrvMAhys.js";import{F}from"./funnel-4zcnjEgH.js";import{C as A}from"./Card-Dr9pbVV5.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CmkNwW1A.js";import"./payload-decoders-XckZ5vyB.js";import"./node-types-BT5BImck.js";import"./badge-colors-YAE4qQ7m.js";import"./chat-utils-CB1BFUm7.js";import"./chevron-right-BHZSwM7S.js";import"./map-pin-DZIYgupP.js";import"./triangle-alert-DI33YyZq.js";import"./DataBox-Dpf5ZHgV.js";import"./layers-BNjfohkH.js";import"./route-D7UU7r6_.js";import"./activity-DOuX3omM.js";import"./circle-check-DXO8ha7w.js";import"./database-Cxl-xDNL.js";import"./DelayedAnimateNumber-Ix4AeV6C.js";import"./index-D932VMrD.js";import"./signal-scoring-CcBiRcks.js";function D({options:o,value:c,onChange:d,defaultValue:m,displayValue:u,filter:p,placeholder:x,disabled:h,invalid:b,name:g,"aria-label":j,className:v,children:f}){const[y,N]=e.useState(""),w=u??(e=>null!=e?String(e):""),C=p??((e,a)=>w(e).toLowerCase().includes(a.toLowerCase())),k=e.useMemo(()=>y?o.filter(e=>C(e,y)):o,[o,y,C]);return a.jsx(s,{value:c,onChange:d,defaultValue:m,disabled:h,name:g,onClose:()=>N(""),children:a.jsxs("div",{className:l("relative",v),children:[a.jsxs("div",{className:"relative",children:[a.jsx(t,{"aria-label":j,displayValue:w,onChange:e=>N(e.target.value),placeholder:x,className:l(["w-full radius-inner py-2 pl-3 pr-10","text-sm text-fg-primary placeholder:text-fg-muted","bg-input-bg",b?"border border-sys-red":"border border-input-border","ring-focus-inset","hover:border-edge-strong","disabled:opacity-40 disabled:pointer-events-none disabled:cursor-not-allowed","transition-colors"])}),a.jsx(i,{className:"absolute inset-y-0 right-0 flex items-center pr-3 group",children:a.jsx(n,{className:"w-4 h-4 text-fg-muted transition-transform duration-200 group-data-[open]:rotate-180"})})]}),a.jsx(r,{anchor:"bottom start",transition:!0,className:l(["w-[var(--input-width)] min-w-[180px]","max-h-60 overflow-y-auto overscroll-contain scroll-py-1","radius-inset p-1 mt-1","surface-elevated","focus:outline-none","transition-opacity","data-[closed]:opacity-0","data-[enter]:duration-150 data-[leave]:duration-100","z-50"]),children:0===k.length&&""!==y?a.jsx("div",{className:"px-3 py-2 text-sm text-fg-muted",children:"No results found"}):k.map((s,l)=>a.jsx(e.Fragment,{children:f(s)},l))})]})})}function _({value:s,disabled:t,className:i,children:r}){return a.jsx(o,{as:e.Fragment,value:s,disabled:t,children:({selected:e,focus:s})=>a.jsxs("div",{className:l("flex items-center gap-2 px-3 py-2 radius-control cursor-default","text-sm",s&&"bg-sys-blue text-white",!s&&"text-fg-primary",e&&!s&&"text-sys-blue",t&&"opacity-50 cursor-not-allowed",i),children:[a.jsx("span",{className:"w-4 flex-shrink-0",children:e&&a.jsx(c,{className:"w-4 h-4"})}),a.jsx("span",{className:"truncate flex-1",children:r})]})})}function H({className:e,...s}){return a.jsx("span",{...s,className:l("truncate",e)})}function q({value:e,onChange:s,options:l,placeholder:t,disabled:i,className:r,"aria-label":o}){const n=l.find(a=>a.value===e);return a.jsx(D,{options:l,value:n,onChange:e=>{e&&s(e.value)},displayValue:e=>(null==e?void 0:e.label)??"",filter:(e,a)=>e.label.toLowerCase().includes(a.toLowerCase()),placeholder:t,disabled:i,className:r,"aria-label":o,children:e=>a.jsx(_,{value:e,disabled:e.disabled,children:a.jsx(H,{children:e.label})})})}function B({icon:e,label:s,value:t,color:i,percentage:r}){return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:l("p-1.5 rounded-md",i),children:e}),a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-semibold text-fg-primary",children:t.toLocaleString()}),a.jsxs("span",{className:"text-xs text-fg-muted leading-tight",children:[s,void 0!==r&&a.jsxs("span",{className:"ml-1 opacity-70",children:["(",r,"%)"]})]})]})]})}const T=e.memo(function({packets:s}){const l=e.useMemo(()=>{let e=0,a=0,l=0;const t=new Set;let i=0,r=0;for(const c of s){switch(v(c)){case"forward":e++;break;case"dropped":a++;break;case"duplicate":l++}c.src_hash&&t.add(c.src_hash),c.rssi&&(i+=c.rssi,r++)}const o=s.length,n=r>0?Math.round(i/r):0;return{total:o,rx:o,fwd:e,dropped:a,duplicate:l,uniqueSources:t.size,avgRssi:n,rxPercent:100,fwdPercent:o>0?Math.round(e/o*100):0,droppedPercent:o>0?Math.round(a/o*100):0}},[s]);return 0===s.length?null:a.jsx("div",{className:"surface-base neomorphic-outer rounded-2xl p-3 pr-4",children:a.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:flex sm:items-center sm:justify-between sm:gap-6",children:[a.jsx(B,{icon:a.jsx(N,{className:"w-3.5 h-3.5 text-sys-blue"}),label:"Received",value:l.rx,color:"bg-sys-blue/10",percentage:l.rxPercent}),a.jsx(B,{icon:a.jsx(w,{className:"w-3.5 h-3.5 text-sys-green"}),label:"Forwarded",value:l.fwd,color:"bg-sys-green/10",percentage:l.fwdPercent}),a.jsx(B,{icon:a.jsx(C,{className:"w-3.5 h-3.5 text-sys-red"}),label:"Dropped",value:l.dropped,color:"bg-sys-red/10",percentage:l.droppedPercent}),a.jsx(B,{icon:a.jsx(k,{className:"w-3.5 h-3.5 text-fg-muted"}),label:"Duplicates",value:l.duplicate,color:"bg-subtle-fill"}),a.jsxs("div",{className:"hidden sm:flex items-center gap-6 ml-auto",children:[a.jsx(B,{icon:a.jsx(S,{className:"w-3.5 h-3.5 text-sys-indigo"}),label:"Sources",value:l.uniqueSources,color:"bg-sys-indigo/10"}),a.jsxs("div",{className:"flex flex-col items-end pr-1",children:[a.jsxs("span",{className:"type-data-sm text-fg-secondary",children:[l.avgRssi," dBm"]}),a.jsx("span",{className:"text-xs text-fg-muted",children:"Avg Signal"})]})]})]})})});function V(){const s=d(),t=m(),i=u(),r=f(e=>e.requestChannel),o=null==t?void 0:t.local_hash,n=null==t?void 0:t.neighbors,[c,N]=e.useState(!1),[w,C]=e.useState(!0),k=e.useCallback(e=>C(e),[]),[S,D]=e.useState({limit:500,status:"all"}),[_,H]=e.useState(Date.now);e.useEffect(()=>{S.timeRange&&S.timeRange>0&&queueMicrotask(()=>H(Date.now()))},[S.timeRange,s]);const B=e.useMemo(()=>{const e=S.limit??500;return[...s.length<=e?s:s.slice(-e)].sort((e,a)=>(a.timestamp??0)-(e.timestamp??0))},[s,S.limit]),V=0===s.length,z=e.useMemo(()=>{let e=B;if(void 0!==S.type){const a=p[S.type];e=e.filter(e=>{const s=e.type??e.payload_type,l=e.payload_type_name;return s===S.type||l===a})}if(void 0!==S.route){const a=x[S.route];e=e.filter(e=>{const s=e.route??e.route_type,l=e.route_type_name;return s===S.route||l===a})}if(S.status&&"all"!==S.status&&(e=e.filter(e=>v(e)===S.status)),void 0!==S.signalMin&&(e=e.filter(e=>e.rssi>=S.signalMin)),S.timeRange&&S.timeRange>0){const a=_/1e3-3600*S.timeRange;e=e.filter(e=>e.timestamp>=a)}return e},[B,S.type,S.route,S.status,S.signalMin,S.timeRange,_]),O=(e,a)=>D(s=>({...s,[e]:a})),E=void 0!==S.type||void 0!==S.route||S.status&&"all"!==S.status||void 0!==S.signalMin||S.timeRange&&S.timeRange>0;return a.jsxs(P,{children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(R,{title:"Packet History",icon:a.jsx(h,{})}),a.jsxs(b,{outline:!0,color:E?"primary":"muted",onClick:()=>N(!c),className:"sm:hidden",children:[a.jsx(F,{"data-slot":"icon"}),E&&a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-sys-blue"})]})]}),a.jsxs(M,{children:[a.jsxs(L,{neomorphic:!0,noPadding:!0,className:l("overflow-hidden transition-all duration-200",c?"max-h-96 opacity-100":"max-h-0 opacity-0 sm:max-h-96 sm:opacity-100"),children:[a.jsx(A,{listHeader:!0,icon:a.jsx(F,{className:"icon-sm"}),title:"Filters",actions:E?a.jsxs(b,{plain:!0,color:"muted",onClick:()=>D({limit:S.limit,status:"all"}),className:"!text-xs !py-0.5 !px-1.5",children:[a.jsx(g,{"data-slot":"icon",className:"!w-3 !h-3"}),"Clear"]}):void 0}),a.jsx("div",{className:"p-3 sm:p-4",children:a.jsxs("div",{className:"grid grid-cols-2 sm:flex sm:flex-wrap gap-3",children:[a.jsxs("div",{className:"flex-1 min-w-[140px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Type"}),a.jsx(q,{value:S.type??"",onChange:e=>O("type",""===e?void 0:Number(e)),options:[{value:"",label:"All Types"},...Object.entries(p).map(([e,a])=>({value:Number(e),label:a}))],placeholder:"Search types...","aria-label":"Filter by packet type"})]}),a.jsxs("div",{className:"flex-1 min-w-[140px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Route"}),a.jsx(q,{value:S.route??"",onChange:e=>O("route",""===e?void 0:Number(e)),options:[{value:"",label:"All Routes"},...Object.entries(x).map(([e,a])=>({value:Number(e),label:a}))],placeholder:"Search routes...","aria-label":"Filter by route type"})]}),a.jsxs("div",{className:"flex-1 min-w-[140px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Status"}),a.jsx(q,{value:S.status??"all",onChange:e=>O("status",e),options:[{value:"all",label:"All Status"},{value:"rx",label:"Received"},{value:"forward",label:"Forwarded"},{value:"dropped",label:"Dropped"},{value:"duplicate",label:"Duplicate"}],placeholder:"Search status...","aria-label":"Filter by status"})]}),a.jsxs("div",{className:"flex-1 min-w-[120px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Time"}),a.jsx(q,{value:S.timeRange??0,onChange:e=>O("timeRange",0===e?void 0:e),options:[{value:0,label:"All Time"},{value:1,label:"Last 1h"},{value:6,label:"Last 6h"},{value:24,label:"Last 24h"},{value:168,label:"Last 7d"}],placeholder:"Search time...","aria-label":"Filter by time range"})]}),a.jsxs("div",{className:"flex-1 min-w-[130px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Signal"}),a.jsx(q,{value:S.signalMin??"",onChange:e=>O("signalMin",""===e?void 0:Number(e)),options:[{value:"",label:"Any Signal"},{value:-90,label:"Strong (≥-90)"},{value:-100,label:"Good (≥-100)"},{value:-110,label:"Fair (≥-110)"},{value:-120,label:"Weak (≥-120)"}],placeholder:"Search signal...","aria-label":"Filter by signal strength"})]}),a.jsxs("div",{className:"flex-1 min-w-[100px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Limit"}),a.jsx(q,{value:S.limit??500,onChange:e=>O("limit",e),options:[{value:100,label:"100"},{value:200,label:"200"},{value:500,label:"500"},{value:1e3,label:"1000"},{value:2e3,label:"2000"}],placeholder:"Limit...","aria-label":"Packet limit"})]})]})})]}),a.jsx(T,{packets:z}),a.jsxs(L,{neomorphic:!0,noPadding:!0,className:"!overflow-visible",children:[a.jsx(A,{listHeader:!0,icon:a.jsx(h,{className:"icon-sm"}),title:"Packet History",actions:a.jsx(j,{enabled:w,onChange:k,label:"Hide Dupes",size:"sm"})}),a.jsx(y,{packets:z,allPackets:s,localHash:o,neighbors:n,decodedMessages:i,onChannelClick:r,loading:V,showPagination:!0,perPage:50,hideDupes:w,emptyMessage:"No packets found"})]})]})]})}export{V as default}; +import{r as e,j as a,H as s,c as l,k as t,B as i,U as r,g as o}from"./vendor-react-j_fHog8x.js";import{Y as n,o as c,p as d,t as m,v as u,a3 as p,a4 as x,R as h,B as b,a5 as g,T as j}from"./index-BBcIGlRT.js";import{g as v,u as f,P as y}from"./PacketList-Bo8AKcoq.js";import{A as N}from"./arrow-up-B5IQoVJ5.js";import{A as w,C}from"./SignalIndicator-BnBRvoqf.js";import{C as k}from"./copy-C_IB0gEd.js";import{U as S}from"./users-DuzW_tmB.js";import{P,b as R,B as M,a as L}from"./PageLayout-CYYy29Pg.js";import{F}from"./funnel-Bb7d8E3s.js";import{C as A}from"./Card-QO4sXDu0.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CmkNwW1A.js";import"./payload-decoders-C74LtYDG.js";import"./node-types-CuQMppbD.js";import"./badge-colors-YAE4qQ7m.js";import"./chat-utils-I8bC4Iy5.js";import"./chevron-right-B6r5SVTI.js";import"./map-pin-FZNiPp_L.js";import"./triangle-alert-DH80WgOo.js";import"./DataBox-B8dpvpbW.js";import"./layers-BSSTaBST.js";import"./route-lCtw8lWd.js";import"./activity-_XXDiQ1M.js";import"./circle-check-DI0_62yI.js";import"./database-CO202xKy.js";import"./DelayedAnimateNumber-CRcNKpk-.js";import"./index-CCvUM2Hn.js";import"./signal-scoring-CcBiRcks.js";function D({options:o,value:c,onChange:d,defaultValue:m,displayValue:u,filter:p,placeholder:x,disabled:h,invalid:b,name:g,"aria-label":j,className:v,children:f}){const[y,N]=e.useState(""),w=u??(e=>null!=e?String(e):""),C=p??((e,a)=>w(e).toLowerCase().includes(a.toLowerCase())),k=e.useMemo(()=>y?o.filter(e=>C(e,y)):o,[o,y,C]);return a.jsx(s,{value:c,onChange:d,defaultValue:m,disabled:h,name:g,onClose:()=>N(""),children:a.jsxs("div",{className:l("relative",v),children:[a.jsxs("div",{className:"relative",children:[a.jsx(t,{"aria-label":j,displayValue:w,onChange:e=>N(e.target.value),placeholder:x,className:l(["w-full radius-inner py-2 pl-3 pr-10","text-sm text-fg-primary placeholder:text-fg-muted","bg-input-bg",b?"border border-sys-red":"border border-input-border","ring-focus-inset","hover:border-edge-strong","disabled:opacity-40 disabled:pointer-events-none disabled:cursor-not-allowed","transition-colors"])}),a.jsx(i,{className:"absolute inset-y-0 right-0 flex items-center pr-3 group",children:a.jsx(n,{className:"w-4 h-4 text-fg-muted transition-transform duration-200 group-data-[open]:rotate-180"})})]}),a.jsx(r,{anchor:"bottom start",transition:!0,className:l(["w-[var(--input-width)] min-w-[180px]","max-h-60 overflow-y-auto overscroll-contain scroll-py-1","radius-inset p-1 mt-1","surface-elevated","focus:outline-none","transition-opacity","data-[closed]:opacity-0","data-[enter]:duration-150 data-[leave]:duration-100","z-50"]),children:0===k.length&&""!==y?a.jsx("div",{className:"px-3 py-2 text-sm text-fg-muted",children:"No results found"}):k.map((s,l)=>a.jsx(e.Fragment,{children:f(s)},l))})]})})}function _({value:s,disabled:t,className:i,children:r}){return a.jsx(o,{as:e.Fragment,value:s,disabled:t,children:({selected:e,focus:s})=>a.jsxs("div",{className:l("flex items-center gap-2 px-3 py-2 radius-control cursor-default","text-sm",s&&"bg-sys-blue text-white",!s&&"text-fg-primary",e&&!s&&"text-sys-blue",t&&"opacity-50 cursor-not-allowed",i),children:[a.jsx("span",{className:"w-4 flex-shrink-0",children:e&&a.jsx(c,{className:"w-4 h-4"})}),a.jsx("span",{className:"truncate flex-1",children:r})]})})}function H({className:e,...s}){return a.jsx("span",{...s,className:l("truncate",e)})}function q({value:e,onChange:s,options:l,placeholder:t,disabled:i,className:r,"aria-label":o}){const n=l.find(a=>a.value===e);return a.jsx(D,{options:l,value:n,onChange:e=>{e&&s(e.value)},displayValue:e=>(null==e?void 0:e.label)??"",filter:(e,a)=>e.label.toLowerCase().includes(a.toLowerCase()),placeholder:t,disabled:i,className:r,"aria-label":o,children:e=>a.jsx(_,{value:e,disabled:e.disabled,children:a.jsx(H,{children:e.label})})})}function B({icon:e,label:s,value:t,color:i,percentage:r}){return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:l("p-1.5 rounded-md",i),children:e}),a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-semibold text-fg-primary",children:t.toLocaleString()}),a.jsxs("span",{className:"text-xs text-fg-muted leading-tight",children:[s,void 0!==r&&a.jsxs("span",{className:"ml-1 opacity-70",children:["(",r,"%)"]})]})]})]})}const T=e.memo(function({packets:s}){const l=e.useMemo(()=>{let e=0,a=0,l=0;const t=new Set;let i=0,r=0;for(const c of s){switch(v(c)){case"forward":e++;break;case"dropped":a++;break;case"duplicate":l++}c.src_hash&&t.add(c.src_hash),c.rssi&&(i+=c.rssi,r++)}const o=s.length,n=r>0?Math.round(i/r):0;return{total:o,rx:o,fwd:e,dropped:a,duplicate:l,uniqueSources:t.size,avgRssi:n,rxPercent:100,fwdPercent:o>0?Math.round(e/o*100):0,droppedPercent:o>0?Math.round(a/o*100):0}},[s]);return 0===s.length?null:a.jsx("div",{className:"surface-base neomorphic-outer rounded-2xl p-3 pr-4",children:a.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:flex sm:items-center sm:justify-between sm:gap-6",children:[a.jsx(B,{icon:a.jsx(N,{className:"w-3.5 h-3.5 text-sys-blue"}),label:"Received",value:l.rx,color:"bg-sys-blue/10",percentage:l.rxPercent}),a.jsx(B,{icon:a.jsx(w,{className:"w-3.5 h-3.5 text-sys-green"}),label:"Forwarded",value:l.fwd,color:"bg-sys-green/10",percentage:l.fwdPercent}),a.jsx(B,{icon:a.jsx(C,{className:"w-3.5 h-3.5 text-sys-red"}),label:"Dropped",value:l.dropped,color:"bg-sys-red/10",percentage:l.droppedPercent}),a.jsx(B,{icon:a.jsx(k,{className:"w-3.5 h-3.5 text-fg-muted"}),label:"Duplicates",value:l.duplicate,color:"bg-subtle-fill"}),a.jsxs("div",{className:"hidden sm:flex items-center gap-6 ml-auto",children:[a.jsx(B,{icon:a.jsx(S,{className:"w-3.5 h-3.5 text-sys-indigo"}),label:"Sources",value:l.uniqueSources,color:"bg-sys-indigo/10"}),a.jsxs("div",{className:"flex flex-col items-end pr-1",children:[a.jsxs("span",{className:"type-data-sm text-fg-secondary",children:[l.avgRssi," dBm"]}),a.jsx("span",{className:"text-xs text-fg-muted",children:"Avg Signal"})]})]})]})})});function V(){const s=d(),t=m(),i=u(),r=f(e=>e.requestChannel),o=null==t?void 0:t.local_hash,n=null==t?void 0:t.neighbors,[c,N]=e.useState(!1),[w,C]=e.useState(!0),k=e.useCallback(e=>C(e),[]),[S,D]=e.useState({limit:500,status:"all"}),[_,H]=e.useState(Date.now);e.useEffect(()=>{S.timeRange&&S.timeRange>0&&queueMicrotask(()=>H(Date.now()))},[S.timeRange,s]);const B=e.useMemo(()=>{const e=S.limit??500;return[...s.length<=e?s:s.slice(-e)].sort((e,a)=>(a.timestamp??0)-(e.timestamp??0))},[s,S.limit]),V=0===s.length,z=e.useMemo(()=>{let e=B;if(void 0!==S.type){const a=p[S.type];e=e.filter(e=>{const s=e.type??e.payload_type,l=e.payload_type_name;return s===S.type||l===a})}if(void 0!==S.route){const a=x[S.route];e=e.filter(e=>{const s=e.route??e.route_type,l=e.route_type_name;return s===S.route||l===a})}if(S.status&&"all"!==S.status&&(e=e.filter(e=>v(e)===S.status)),void 0!==S.signalMin&&(e=e.filter(e=>e.rssi>=S.signalMin)),S.timeRange&&S.timeRange>0){const a=_/1e3-3600*S.timeRange;e=e.filter(e=>e.timestamp>=a)}return e},[B,S.type,S.route,S.status,S.signalMin,S.timeRange,_]),O=(e,a)=>D(s=>({...s,[e]:a})),E=void 0!==S.type||void 0!==S.route||S.status&&"all"!==S.status||void 0!==S.signalMin||S.timeRange&&S.timeRange>0;return a.jsxs(P,{children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(R,{title:"Packet History",icon:a.jsx(h,{})}),a.jsxs(b,{outline:!0,color:E?"primary":"muted",onClick:()=>N(!c),className:"sm:hidden",children:[a.jsx(F,{"data-slot":"icon"}),E&&a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-sys-blue"})]})]}),a.jsxs(M,{children:[a.jsxs(L,{neomorphic:!0,noPadding:!0,className:l("overflow-hidden transition-all duration-200",c?"max-h-96 opacity-100":"max-h-0 opacity-0 sm:max-h-96 sm:opacity-100"),children:[a.jsx(A,{listHeader:!0,icon:a.jsx(F,{className:"icon-sm"}),title:"Filters",actions:E?a.jsxs(b,{plain:!0,color:"muted",onClick:()=>D({limit:S.limit,status:"all"}),className:"!text-xs !py-0.5 !px-1.5",children:[a.jsx(g,{"data-slot":"icon",className:"!w-3 !h-3"}),"Clear"]}):void 0}),a.jsx("div",{className:"p-3 sm:p-4",children:a.jsxs("div",{className:"grid grid-cols-2 sm:flex sm:flex-wrap gap-3",children:[a.jsxs("div",{className:"flex-1 min-w-[140px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Type"}),a.jsx(q,{value:S.type??"",onChange:e=>O("type",""===e?void 0:Number(e)),options:[{value:"",label:"All Types"},...Object.entries(p).map(([e,a])=>({value:Number(e),label:a}))],placeholder:"Search types...","aria-label":"Filter by packet type"})]}),a.jsxs("div",{className:"flex-1 min-w-[140px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Route"}),a.jsx(q,{value:S.route??"",onChange:e=>O("route",""===e?void 0:Number(e)),options:[{value:"",label:"All Routes"},...Object.entries(x).map(([e,a])=>({value:Number(e),label:a}))],placeholder:"Search routes...","aria-label":"Filter by route type"})]}),a.jsxs("div",{className:"flex-1 min-w-[140px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Status"}),a.jsx(q,{value:S.status??"all",onChange:e=>O("status",e),options:[{value:"all",label:"All Status"},{value:"rx",label:"Received"},{value:"forward",label:"Forwarded"},{value:"dropped",label:"Dropped"},{value:"duplicate",label:"Duplicate"}],placeholder:"Search status...","aria-label":"Filter by status"})]}),a.jsxs("div",{className:"flex-1 min-w-[120px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Time"}),a.jsx(q,{value:S.timeRange??0,onChange:e=>O("timeRange",0===e?void 0:e),options:[{value:0,label:"All Time"},{value:1,label:"Last 1h"},{value:6,label:"Last 6h"},{value:24,label:"Last 24h"},{value:168,label:"Last 7d"}],placeholder:"Search time...","aria-label":"Filter by time range"})]}),a.jsxs("div",{className:"flex-1 min-w-[130px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Signal"}),a.jsx(q,{value:S.signalMin??"",onChange:e=>O("signalMin",""===e?void 0:Number(e)),options:[{value:"",label:"Any Signal"},{value:-90,label:"Strong (≥-90)"},{value:-100,label:"Good (≥-100)"},{value:-110,label:"Fair (≥-110)"},{value:-120,label:"Weak (≥-120)"}],placeholder:"Search signal...","aria-label":"Filter by signal strength"})]}),a.jsxs("div",{className:"flex-1 min-w-[100px]",children:[a.jsx("label",{className:"type-micro block mb-1",children:"Limit"}),a.jsx(q,{value:S.limit??500,onChange:e=>O("limit",e),options:[{value:100,label:"100"},{value:200,label:"200"},{value:500,label:"500"},{value:1e3,label:"1000"},{value:2e3,label:"2000"}],placeholder:"Limit...","aria-label":"Packet limit"})]})]})})]}),a.jsx(T,{packets:z}),a.jsxs(L,{neomorphic:!0,noPadding:!0,className:"!overflow-visible",children:[a.jsx(A,{listHeader:!0,icon:a.jsx(h,{className:"icon-sm"}),title:"Packet History",actions:a.jsx(j,{enabled:w,onChange:k,label:"Hide Dupes",size:"sm"})}),a.jsx(y,{packets:z,allPackets:s,localHash:o,neighbors:n,decodedMessages:i,onChannelClick:r,loading:V,showPagination:!0,perPage:50,hideDupes:w,emptyMessage:"No packets found"})]})]})]})}export{V as default}; diff --git a/frontend/dist/assets/PageLayout-DrvMAhys.js b/frontend/dist/assets/PageLayout-CYYy29Pg.js similarity index 98% rename from frontend/dist/assets/PageLayout-DrvMAhys.js rename to frontend/dist/assets/PageLayout-CYYy29Pg.js index c6a2e0fc..a1ada02e 100644 --- a/frontend/dist/assets/PageLayout-DrvMAhys.js +++ b/frontend/dist/assets/PageLayout-CYYy29Pg.js @@ -1 +1 @@ -import{j as s,c as e}from"./vendor-react-j_fHog8x.js";import"./index-01Tx8g53.js";const a=[45,72,33,58,80,42,65,28,55,75,38,62];function l({className:a,style:l}){return s.jsx("div",{className:e("animate-pulse bg-subtle-fill radius-badge",a),style:l})}function c(){return s.jsx("div",{className:"p-3 radius-inner border-card bg-subtle",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(l,{className:"w-14 h-6 rounded shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[s.jsx(l,{className:"h-4 w-full"}),s.jsx(l,{className:"h-4 w-3/4"}),s.jsx(l,{className:"h-3 w-32 mt-1"})]})]})})}function r({count:e=8}){return s.jsx("div",{className:"space-y-2",children:Array.from({length:e}).map((e,a)=>s.jsx(c,{},a))})}function i(){return s.jsxs("div",{className:"flex flex-col gap-3 h-full","aria-hidden":"true",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(l,{className:"w-5 h-5"}),s.jsx(l,{className:"h-4 w-24"})]}),s.jsx(l,{className:"h-8 w-20"}),s.jsxs("div",{className:"flex-1 flex flex-col justify-end gap-2",children:[s.jsx(l,{className:"h-3 w-full"}),s.jsx(l,{className:"h-3 w-3/4"})]})]})}function n(){return s.jsxs("div",{className:"flex flex-col gap-3 h-full","aria-hidden":"true",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(l,{className:"w-5 h-5"}),s.jsx(l,{className:"h-4 w-24"})]}),s.jsx("div",{className:"flex-1 flex items-end gap-1",children:a.slice(0,8).map((e,a)=>s.jsx(l,{className:"flex-1",style:{height:`${e}%`}},a))})]})}function t({rows:e=5}){return s.jsxs("div",{className:"flex flex-col h-full","aria-hidden":"true",children:[s.jsx("div",{className:"pb-3 border-b border-edge-subtle",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(l,{className:"w-5 h-5"}),s.jsx(l,{className:"h-4 w-24"})]})}),s.jsx("div",{className:"flex-1 pt-3 flex flex-col gap-3",children:Array.from({length:e}).map((e,a)=>s.jsx(l,{className:"h-6 w-full"},a))})]})}function d({children:a,className:l}){return s.jsx("div",{className:e("section-gap",l),children:a})}function x({children:a,className:l}){return s.jsx("div",{className:e("bento-section",l),children:a})}function m({title:e,icon:a,controls:l,subtitle:c}){return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3",children:[s.jsxs("h1",{className:"type-title text-fg-primary flex items-center gap-2 sm:gap-3 h-9 min-w-0",children:[a&&s.jsx("span",{className:"w-5 h-5 sm:w-6 sm:h-6 text-icon-page-title flex-shrink-0",children:a}),s.jsx("span",{className:"truncate",children:e})]}),l&&s.jsx("div",{className:"flex items-center gap-2 sm:gap-3 h-9 flex-shrink-0",children:l})]}),c&&s.jsx("div",{children:c})]})}const h={sm:"card-sm",md:"card-md",lg:"card-lg",hero:"card-hero",auto:"card-auto"};function f({children:a,size:l,compact:c,noPadding:r,className:d,style:x,onClick:m,isLoaded:f=!0,skeletonType:o="card",neomorphic:u=!1}){return s.jsxs("div",{className:e(u?"bg-surface/80 backdrop-blur-lg neomorphic-outer rounded-2xl h-full flex flex-col relative":"surface-base rounded-2xl h-full flex flex-col relative",!r&&(c?"card-padding-sm":"card-padding"),l&&h[l],d),style:x,onClick:m,children:[a,!f&&(()=>{switch(o){case"chart":return s.jsx(n,{});case"list":return s.jsx(t,{});default:return s.jsx(i,{})}})()]})}export{x as B,i as C,r as L,d as P,l as S,f as a,m as b}; +import{j as s,c as e}from"./vendor-react-j_fHog8x.js";import"./index-BBcIGlRT.js";const a=[45,72,33,58,80,42,65,28,55,75,38,62];function l({className:a,style:l}){return s.jsx("div",{className:e("animate-pulse bg-subtle-fill radius-badge",a),style:l})}function c(){return s.jsx("div",{className:"p-3 radius-inner border-card bg-subtle",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(l,{className:"w-14 h-6 rounded shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[s.jsx(l,{className:"h-4 w-full"}),s.jsx(l,{className:"h-4 w-3/4"}),s.jsx(l,{className:"h-3 w-32 mt-1"})]})]})})}function r({count:e=8}){return s.jsx("div",{className:"space-y-2",children:Array.from({length:e}).map((e,a)=>s.jsx(c,{},a))})}function i(){return s.jsxs("div",{className:"flex flex-col gap-3 h-full","aria-hidden":"true",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(l,{className:"w-5 h-5"}),s.jsx(l,{className:"h-4 w-24"})]}),s.jsx(l,{className:"h-8 w-20"}),s.jsxs("div",{className:"flex-1 flex flex-col justify-end gap-2",children:[s.jsx(l,{className:"h-3 w-full"}),s.jsx(l,{className:"h-3 w-3/4"})]})]})}function n(){return s.jsxs("div",{className:"flex flex-col gap-3 h-full","aria-hidden":"true",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(l,{className:"w-5 h-5"}),s.jsx(l,{className:"h-4 w-24"})]}),s.jsx("div",{className:"flex-1 flex items-end gap-1",children:a.slice(0,8).map((e,a)=>s.jsx(l,{className:"flex-1",style:{height:`${e}%`}},a))})]})}function t({rows:e=5}){return s.jsxs("div",{className:"flex flex-col h-full","aria-hidden":"true",children:[s.jsx("div",{className:"pb-3 border-b border-edge-subtle",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(l,{className:"w-5 h-5"}),s.jsx(l,{className:"h-4 w-24"})]})}),s.jsx("div",{className:"flex-1 pt-3 flex flex-col gap-3",children:Array.from({length:e}).map((e,a)=>s.jsx(l,{className:"h-6 w-full"},a))})]})}function d({children:a,className:l}){return s.jsx("div",{className:e("section-gap",l),children:a})}function x({children:a,className:l}){return s.jsx("div",{className:e("bento-section",l),children:a})}function m({title:e,icon:a,controls:l,subtitle:c}){return s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3",children:[s.jsxs("h1",{className:"type-title text-fg-primary flex items-center gap-2 sm:gap-3 h-9 min-w-0",children:[a&&s.jsx("span",{className:"w-5 h-5 sm:w-6 sm:h-6 text-icon-page-title flex-shrink-0",children:a}),s.jsx("span",{className:"truncate",children:e})]}),l&&s.jsx("div",{className:"flex items-center gap-2 sm:gap-3 h-9 flex-shrink-0",children:l})]}),c&&s.jsx("div",{children:c})]})}const h={sm:"card-sm",md:"card-md",lg:"card-lg",hero:"card-hero",auto:"card-auto"};function f({children:a,size:l,compact:c,noPadding:r,className:d,style:x,onClick:m,isLoaded:f=!0,skeletonType:o="card",neomorphic:u=!1}){return s.jsxs("div",{className:e(u?"bg-surface/80 backdrop-blur-lg neomorphic-outer rounded-2xl h-full flex flex-col relative":"surface-base rounded-2xl h-full flex flex-col relative",!r&&(c?"card-padding-sm":"card-padding"),l&&h[l],d),style:x,onClick:m,children:[a,!f&&(()=>{switch(o){case"chart":return s.jsx(n,{});case"list":return s.jsx(t,{});default:return s.jsx(i,{})}})()]})}export{x as B,i as C,r as L,d as P,l as S,f as a,m as b}; diff --git a/frontend/dist/assets/PathMapMapLibre-QnAQ-gAh.js b/frontend/dist/assets/PathMapMapLibre-BuUgybSr.js similarity index 93% rename from frontend/dist/assets/PathMapMapLibre-QnAQ-gAh.js rename to frontend/dist/assets/PathMapMapLibre-BuUgybSr.js index 0969c01d..dec607e5 100644 --- a/frontend/dist/assets/PathMapMapLibre-QnAQ-gAh.js +++ b/frontend/dist/assets/PathMapMapLibre-BuUgybSr.js @@ -1 +1 @@ -import{r as e,j as t,c as o}from"./vendor-react-j_fHog8x.js";import{u as r,M as i,B as s,S as a,L as n,a as l,P as d}from"./BasemapLayer-BT1oL_wV.js";import"./maplibre-gl-b91ci4Kr.js";import{c,aj as u,c_ as m,Z as p,ar as h,j as g,m as x,c$ as f}from"./index-01Tx8g53.js";import{H as b}from"./DelayedAnimateNumber-Ix4AeV6C.js";import{a as y}from"./PacketList-C6Vv6v7V.js";import"./vendor-core-CmkNwW1A.js";import"./index-D932VMrD.js";import"./payload-decoders-XckZ5vyB.js";import"./node-types-BT5BImck.js";import"./badge-colors-YAE4qQ7m.js";import"./chat-utils-CB1BFUm7.js";import"./SignalIndicator-CIKrVFY9.js";import"./signal-scoring-CcBiRcks.js";import"./arrow-up-C91otjLx.js";import"./copy-B5OWhmpX.js";import"./chevron-right-BHZSwM7S.js";import"./map-pin-DZIYgupP.js";import"./triangle-alert-DI33YyZq.js";import"./DataBox-Dpf5ZHgV.js";import"./layers-BNjfohkH.js";import"./route-D7UU7r6_.js";import"./activity-DOuX3omM.js";import"./circle-check-DXO8ha7w.js";import"./database-Cxl-xDNL.js";const j=c("car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]),v={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"},C={nodeColor:"#4338CA",localColor:"#4F46E5",hubColor:"#6366F1",edgeColor:"#3B3F4A",ambiguousColor:"#F9D26F",highlightColor:"#B49DFF",sourceColor:"#39D98A",destinationColor:"#B49DFF"};function k(e,t){if(!e)return t;if(e.startsWith("#"))return e;const o=f(e);return o?`#${o.r.toString(16).padStart(2,"0")}${o.g.toString(16).padStart(2,"0")}${o.b.toString(16).padStart(2,"0")}`:t}function N(){if("undefined"==typeof document)return C;const e=document.documentElement,t=getComputedStyle(e);return{nodeColor:k(t.getPropertyValue("--map-node-stroke").trim(),C.nodeColor),localColor:k(t.getPropertyValue("--map-local-color").trim(),C.localColor),hubColor:k(t.getPropertyValue("--map-hub-color").trim(),C.hubColor),edgeColor:k(t.getPropertyValue("--map-edge-rest").trim(),C.edgeColor),ambiguousColor:k(t.getPropertyValue("--sys-indigo").trim(),C.ambiguousColor),highlightColor:k(t.getPropertyValue("--sys-blue").trim(),C.highlightColor),sourceColor:k(t.getPropertyValue("--sys-green").trim(),C.sourceColor),destinationColor:k(t.getPropertyValue("--sys-blue").trim(),C.destinationColor)}}function S({prefix:r,isLocal:i,isSource:s,isDestination:a,isLastHop:n,isHighlighted:l,isAnimating:d,isWardrive:c,candidate:u,onHover:m,onLeave:p,onClick:h}){const f=y(),[v,C]=e.useState(!1);e.useEffect(()=>{d&&f.start({boxShadow:["0 0 0 0px rgba(113, 156, 223, 0)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 0px rgba(113, 156, 223, 0)"],transition:{duration:.5,times:[0,.2,.7,1],ease:"easeInOut"}})},[d,f]);const k=e.useCallback(()=>{C(!0),m()},[m]),N=e.useCallback(()=>{C(!1),p()},[p]);return c?t.jsxs(x.div,{className:o("flex items-center cursor-pointer","transition-all duration-150",l&&"ring-2 ring-sys-blue/50 rounded-full",v&&"relative z-50"),animate:f,initial:{boxShadow:"0 0 0 0px rgba(249, 115, 22, 0)"},onMouseEnter:k,onMouseLeave:N,onClick:h,style:{pointerEvents:"auto"},children:[t.jsx("div",{className:o("flex items-center justify-center","w-7 h-7 rounded-full","bg-sys-orange text-white","shadow-lg border-2 border-sys-orange/50","transition-transform duration-150",v&&"scale-110"),children:t.jsx(j,{className:"w-4 h-4",strokeWidth:2.5})}),v&&t.jsxs(g,{color:"orange",filled:!0,className:"ml-1 type-data-xs shadow-lg",children:[r,u.name&&t.jsx("span",{className:"ml-1 opacity-75",children:u.name})]})]}):t.jsx(x.div,{className:o("flex items-center cursor-pointer","transition-all duration-150",l&&"ring-2 ring-sys-blue/50 rounded",v&&"relative z-50"),animate:f,initial:{boxShadow:"0 0 0 0px rgba(113, 156, 223, 0)"},onMouseEnter:k,onMouseLeave:N,onClick:h,style:{pointerEvents:"auto"},children:t.jsxs(g,{color:c?"orange":i?"amber":s?"green":n?"amber":a?"purple":"blue",filled:!0,className:"type-data-xs shadow-lg border border-current/30",children:[i&&t.jsx(b,{className:"w-2.5 h-2.5 mr-1"}),r,v&&u.name&&t.jsx("span",{className:"ml-1 opacity-75",children:u.name})]})})}function w({hopNumber:e,snr:o,edgeColor:r}){return t.jsxs("div",{className:"flex flex-col items-center gap-0.5 pointer-events-none",children:[t.jsx("span",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center font-mono font-bold tabular-nums shadow-md",style:{backgroundColor:r||p[500],color:"#fff",fontSize:"8px",lineHeight:1,textShadow:"0 1px 1px rgba(0,0,0,0.4)"},children:e}),void 0!==o&&t.jsx(g,{color:"zinc",compact:!0,className:"!text-[9px] font-mono tabular-nums shadow-sm",children:o.toFixed(1)})]})}function F({resolvedPath:c,localNode:g,hubNodes:x=[],hoveredHopIndex:f,onHoverHop:b,traceSnr:y}){const j=void 0!==y&&y.length>0,C=e.useRef(null),k=r(),F=e.useMemo(()=>new Set(x),[x]),[L,M]=e.useState(null),D=u(),[E,P]=e.useState(!1),[H,$]=e.useState(0);e.useEffect(()=>{var e;const t=null==(e=C.current)?void 0:e.getMap();if(!t)return;const o=t.getCanvas();if(!o)return;const r=e=>{e.preventDefault()},i=()=>{$(e=>e+1)};return o.addEventListener("webglcontextlost",r),o.addEventListener("webglcontextrestored",i),()=>{o.removeEventListener("webglcontextlost",r),o.removeEventListener("webglcontextrestored",i)}},[H]);const{positions:A,markers:I,edges:V}=e.useMemo(()=>{const e=[],t=[],o=[],r=[];let i=0,s=!1;return c.hops.forEach((a,n)=>{const l=a.candidates.filter(e=>{return t=e.latitude,o=e.longitude,0!==t||0!==o;var t,o});if(0===l.length)return;const d=[...l].sort((e,t)=>t.probability-e.probability)[0],c=[d.longitude,d.latitude];if(r.push(c),r.length>=2){const e=r[r.length-2],t=r.length-2,i=null==y?void 0:y[t],a=c[0]-e[0],n=c[1]-e[1],l=Math.atan2(a,n)*(180/Math.PI),d=N();let u;u=s?"#F97316":void 0!==i?m()[h(i)]||p[500]:d.edgeColor,o.push({from:e,to:c,snrFwd:i,midpoint:[(e[0]+c[0])/2,(e[1]+c[1])/2],bearing:l,color:u,isFromWardrive:s})}const u=!0===a.isSource,g=!0===a.isDestination,x=!0===d.isWardrive;s=x,l.forEach((o,r)=>{const s=[o.latitude,o.longitude];e.push(s);const d=0===r;t.push({position:s,prefix:a.prefix,confidence:a.confidence,candidateCount:l.length,hopIndex:n,candidate:o,isHub:F.has(o.hash),isPrimary:d,isSource:u,isDestination:g,validIndex:i})}),i++}),{positions:e,markers:t,edges:o}},[c,F,y]),B=e.useMemo(()=>{const e=I.filter(e=>e.isPrimary&&(e.confidence>=.5||e.isSource||e.isDestination));if(0===e.length)return null;let t=1/0,o=-1/0,r=1/0,i=-1/0;for(const s of e){const[e,a]=s.position;eo&&(o=e),ai&&(i=a)}return[[r,t],[i,o]]},[I]),W=e.useMemo(()=>{if(0===A.length)return g?[g.longitude,g.latitude]:[0,0];let e=0,t=0;for(const[o,r]of A)e+=o,t+=r;return[t/A.length,e/A.length]},[A,g]),z=e.useCallback(()=>{var e;const t=null==(e=C.current)?void 0:e.getMap();t&&B?(t.fitBounds(B,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:0}),setTimeout(()=>{P(!0)},50)):P(!0)},[B]),O=e.useMemo(()=>B?`${B[0][0].toFixed(5)},${B[0][1].toFixed(5)},${B[1][0].toFixed(5)},${B[1][1].toFixed(5)}`:"",[B]);e.useEffect(()=>{var e;if(!E)return;const t=null==(e=C.current)?void 0:e.getMap();t&&B&&t.fitBounds(B,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:300})},[O,E,B]);const R=D&&E,Z=e.useCallback(e=>{M({longitude:e.position[1],latitude:e.position[0],marker:e})},[]);return 0===A.length?t.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted text-sm bg-elevated",children:"No mappable path data"}):t.jsxs("div",{className:"h-full w-full relative",children:[t.jsx("div",{className:o("absolute inset-0 bg-elevated flex items-center justify-center","transition-opacity duration-200 ease-out pointer-events-none",R?"opacity-0":"opacity-100"),children:t.jsx("div",{className:"w-5 h-5 border-2 border-text-muted/30 border-t-text-muted rounded-full animate-spin"})}),t.jsx("div",{className:"h-full w-full transition-opacity duration-300 ease-out",style:{opacity:R?1:0},children:t.jsxs(i,{ref:C,initialViewState:{longitude:W[0],latitude:W[1],zoom:10},onLoad:z,style:{height:"100%",width:"100%"},mapStyle:v,attributionControl:!1,children:[t.jsx(s,{mode:k}),V.map((e,o)=>{const r={type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[e.from,e.to]}}]};return t.jsx(a,{id:`edge-${o}`,type:"geojson",data:r,children:t.jsx(n,{id:`edge-line-${o}`,type:"line",paint:{"line-color":e.color,"line-width":4,"line-opacity":1},layout:{"line-cap":"round","line-join":"round"}})},`edge-${o}`)}),V.map((e,o)=>t.jsx(l,{longitude:e.midpoint[0],latitude:e.midpoint[1],anchor:"center",children:t.jsx(w,{hopNumber:o+1,snr:j?e.snrFwd:void 0,edgeColor:e.color})},`hop-${o}`)),(()=>{const e=I.filter(e=>e.isPrimary),o=e.length>1?e.length-2:-1;return e.map((e,r)=>{const i=f===e.hopIndex,s=r===o&&!e.candidate.isLocal&&!e.isDestination;return t.jsx(l,{longitude:e.position[1],latitude:e.position[0],anchor:"center",children:t.jsx(S,{prefix:e.prefix,isLocal:e.candidate.isLocal||!1,isSource:e.isSource,isDestination:e.isDestination,isLastHop:s,isHighlighted:i,isAnimating:!1,isWardrive:e.candidate.isWardrive||!1,candidate:e.candidate,onHover:()=>null==b?void 0:b(e.hopIndex),onLeave:()=>null==b?void 0:b(null),onClick:()=>Z(e)})},`${e.hopIndex}-${e.candidate.hash}`)})})(),L&&t.jsx(d,{longitude:L.longitude,latitude:L.latitude,anchor:"bottom",offset:[0,-12],closeOnClick:!1,onClose:()=>M(null),className:"maplibre-popup",children:t.jsxs("div",{className:"text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"font-semibold",children:L.marker.candidate.name}),(()=>{const e=N();return t.jsxs(t.Fragment,{children:[L.marker.isSource&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.sourceColor,color:"#000"},children:"SRC"}),L.marker.isDestination&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.destinationColor,color:"#000"},children:"DST"}),L.marker.isHub&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.hubColor,color:"#000"},children:"HUB"}),L.marker.candidate.isLocal&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.localColor,color:"#fff"},children:"LOCAL"}),L.marker.candidate.isWardrive&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:"#F97316",color:"#fff"},children:"WARDRIVE"})]})})()]}),t.jsxs("div",{className:"text-fg-muted type-data-xs",children:[L.marker.prefix," • ",L.marker.candidate.hash.slice(0,10),"..."]}),!L.marker.isPrimary&&L.marker.candidateCount>1&&t.jsxs("div",{style:{color:N().ambiguousColor},children:["Alternative (",(100*L.marker.candidate.probability).toFixed(0),"%)"]}),L.marker.isPrimary&&L.marker.candidateCount>1&&t.jsxs("div",{className:"text-fg-muted",children:[L.marker.candidateCount," candidates"]})]})})]},H)})]})}export{F as default}; +import{r as e,j as t,c as o}from"./vendor-react-j_fHog8x.js";import{u as r,M as i,B as s,S as a,L as n,a as l,P as d}from"./BasemapLayer-BT1oL_wV.js";import"./maplibre-gl-b91ci4Kr.js";import{c,aj as u,c_ as m,Z as p,ar as h,j as g,m as x,c$ as f}from"./index-BBcIGlRT.js";import{H as b}from"./DelayedAnimateNumber-CRcNKpk-.js";import{a as y}from"./PacketList-Bo8AKcoq.js";import"./vendor-core-CmkNwW1A.js";import"./index-CCvUM2Hn.js";import"./payload-decoders-C74LtYDG.js";import"./node-types-CuQMppbD.js";import"./badge-colors-YAE4qQ7m.js";import"./chat-utils-I8bC4Iy5.js";import"./SignalIndicator-BnBRvoqf.js";import"./signal-scoring-CcBiRcks.js";import"./arrow-up-B5IQoVJ5.js";import"./copy-C_IB0gEd.js";import"./chevron-right-B6r5SVTI.js";import"./map-pin-FZNiPp_L.js";import"./triangle-alert-DH80WgOo.js";import"./DataBox-B8dpvpbW.js";import"./layers-BSSTaBST.js";import"./route-lCtw8lWd.js";import"./activity-_XXDiQ1M.js";import"./circle-check-DI0_62yI.js";import"./database-CO202xKy.js";const j=c("car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]),v={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"},C={nodeColor:"#4338CA",localColor:"#4F46E5",hubColor:"#6366F1",edgeColor:"#3B3F4A",ambiguousColor:"#F9D26F",highlightColor:"#B49DFF",sourceColor:"#39D98A",destinationColor:"#B49DFF"};function k(e,t){if(!e)return t;if(e.startsWith("#"))return e;const o=f(e);return o?`#${o.r.toString(16).padStart(2,"0")}${o.g.toString(16).padStart(2,"0")}${o.b.toString(16).padStart(2,"0")}`:t}function N(){if("undefined"==typeof document)return C;const e=document.documentElement,t=getComputedStyle(e);return{nodeColor:k(t.getPropertyValue("--map-node-stroke").trim(),C.nodeColor),localColor:k(t.getPropertyValue("--map-local-color").trim(),C.localColor),hubColor:k(t.getPropertyValue("--map-hub-color").trim(),C.hubColor),edgeColor:k(t.getPropertyValue("--map-edge-rest").trim(),C.edgeColor),ambiguousColor:k(t.getPropertyValue("--sys-indigo").trim(),C.ambiguousColor),highlightColor:k(t.getPropertyValue("--sys-blue").trim(),C.highlightColor),sourceColor:k(t.getPropertyValue("--sys-green").trim(),C.sourceColor),destinationColor:k(t.getPropertyValue("--sys-blue").trim(),C.destinationColor)}}function S({prefix:r,isLocal:i,isSource:s,isDestination:a,isLastHop:n,isHighlighted:l,isAnimating:d,isWardrive:c,candidate:u,onHover:m,onLeave:p,onClick:h}){const f=y(),[v,C]=e.useState(!1);e.useEffect(()=>{d&&f.start({boxShadow:["0 0 0 0px rgba(113, 156, 223, 0)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 2px rgba(113, 156, 223, 0.5)","0 0 0 0px rgba(113, 156, 223, 0)"],transition:{duration:.5,times:[0,.2,.7,1],ease:"easeInOut"}})},[d,f]);const k=e.useCallback(()=>{C(!0),m()},[m]),N=e.useCallback(()=>{C(!1),p()},[p]);return c?t.jsxs(x.div,{className:o("flex items-center cursor-pointer","transition-all duration-150",l&&"ring-2 ring-sys-blue/50 rounded-full",v&&"relative z-50"),animate:f,initial:{boxShadow:"0 0 0 0px rgba(249, 115, 22, 0)"},onMouseEnter:k,onMouseLeave:N,onClick:h,style:{pointerEvents:"auto"},children:[t.jsx("div",{className:o("flex items-center justify-center","w-7 h-7 rounded-full","bg-sys-orange text-white","shadow-lg border-2 border-sys-orange/50","transition-transform duration-150",v&&"scale-110"),children:t.jsx(j,{className:"w-4 h-4",strokeWidth:2.5})}),v&&t.jsxs(g,{color:"orange",filled:!0,className:"ml-1 type-data-xs shadow-lg",children:[r,u.name&&t.jsx("span",{className:"ml-1 opacity-75",children:u.name})]})]}):t.jsx(x.div,{className:o("flex items-center cursor-pointer","transition-all duration-150",l&&"ring-2 ring-sys-blue/50 rounded",v&&"relative z-50"),animate:f,initial:{boxShadow:"0 0 0 0px rgba(113, 156, 223, 0)"},onMouseEnter:k,onMouseLeave:N,onClick:h,style:{pointerEvents:"auto"},children:t.jsxs(g,{color:c?"orange":i?"amber":s?"green":n?"amber":a?"purple":"blue",filled:!0,className:"type-data-xs shadow-lg border border-current/30",children:[i&&t.jsx(b,{className:"w-2.5 h-2.5 mr-1"}),r,v&&u.name&&t.jsx("span",{className:"ml-1 opacity-75",children:u.name})]})})}function w({hopNumber:e,snr:o,edgeColor:r}){return t.jsxs("div",{className:"flex flex-col items-center gap-0.5 pointer-events-none",children:[t.jsx("span",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center font-mono font-bold tabular-nums shadow-md",style:{backgroundColor:r||p[500],color:"#fff",fontSize:"8px",lineHeight:1,textShadow:"0 1px 1px rgba(0,0,0,0.4)"},children:e}),void 0!==o&&t.jsx(g,{color:"zinc",compact:!0,className:"!text-[9px] font-mono tabular-nums shadow-sm",children:o.toFixed(1)})]})}function F({resolvedPath:c,localNode:g,hubNodes:x=[],hoveredHopIndex:f,onHoverHop:b,traceSnr:y}){const j=void 0!==y&&y.length>0,C=e.useRef(null),k=r(),F=e.useMemo(()=>new Set(x),[x]),[L,M]=e.useState(null),D=u(),[E,P]=e.useState(!1),[H,$]=e.useState(0);e.useEffect(()=>{var e;const t=null==(e=C.current)?void 0:e.getMap();if(!t)return;const o=t.getCanvas();if(!o)return;const r=e=>{e.preventDefault()},i=()=>{$(e=>e+1)};return o.addEventListener("webglcontextlost",r),o.addEventListener("webglcontextrestored",i),()=>{o.removeEventListener("webglcontextlost",r),o.removeEventListener("webglcontextrestored",i)}},[H]);const{positions:A,markers:I,edges:V}=e.useMemo(()=>{const e=[],t=[],o=[],r=[];let i=0,s=!1;return c.hops.forEach((a,n)=>{const l=a.candidates.filter(e=>{return t=e.latitude,o=e.longitude,0!==t||0!==o;var t,o});if(0===l.length)return;const d=[...l].sort((e,t)=>t.probability-e.probability)[0],c=[d.longitude,d.latitude];if(r.push(c),r.length>=2){const e=r[r.length-2],t=r.length-2,i=null==y?void 0:y[t],a=c[0]-e[0],n=c[1]-e[1],l=Math.atan2(a,n)*(180/Math.PI),d=N();let u;u=s?"#F97316":void 0!==i?m()[h(i)]||p[500]:d.edgeColor,o.push({from:e,to:c,snrFwd:i,midpoint:[(e[0]+c[0])/2,(e[1]+c[1])/2],bearing:l,color:u,isFromWardrive:s})}const u=!0===a.isSource,g=!0===a.isDestination,x=!0===d.isWardrive;s=x,l.forEach((o,r)=>{const s=[o.latitude,o.longitude];e.push(s);const d=0===r;t.push({position:s,prefix:a.prefix,confidence:a.confidence,candidateCount:l.length,hopIndex:n,candidate:o,isHub:F.has(o.hash),isPrimary:d,isSource:u,isDestination:g,validIndex:i})}),i++}),{positions:e,markers:t,edges:o}},[c,F,y]),B=e.useMemo(()=>{const e=I.filter(e=>e.isPrimary&&(e.confidence>=.5||e.isSource||e.isDestination));if(0===e.length)return null;let t=1/0,o=-1/0,r=1/0,i=-1/0;for(const s of e){const[e,a]=s.position;eo&&(o=e),ai&&(i=a)}return[[r,t],[i,o]]},[I]),W=e.useMemo(()=>{if(0===A.length)return g?[g.longitude,g.latitude]:[0,0];let e=0,t=0;for(const[o,r]of A)e+=o,t+=r;return[t/A.length,e/A.length]},[A,g]),z=e.useCallback(()=>{var e;const t=null==(e=C.current)?void 0:e.getMap();t&&B?(t.fitBounds(B,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:0}),setTimeout(()=>{P(!0)},50)):P(!0)},[B]),O=e.useMemo(()=>B?`${B[0][0].toFixed(5)},${B[0][1].toFixed(5)},${B[1][0].toFixed(5)},${B[1][1].toFixed(5)}`:"",[B]);e.useEffect(()=>{var e;if(!E)return;const t=null==(e=C.current)?void 0:e.getMap();t&&B&&t.fitBounds(B,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:300})},[O,E,B]);const R=D&&E,Z=e.useCallback(e=>{M({longitude:e.position[1],latitude:e.position[0],marker:e})},[]);return 0===A.length?t.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted text-sm bg-elevated",children:"No mappable path data"}):t.jsxs("div",{className:"h-full w-full relative",children:[t.jsx("div",{className:o("absolute inset-0 bg-elevated flex items-center justify-center","transition-opacity duration-200 ease-out pointer-events-none",R?"opacity-0":"opacity-100"),children:t.jsx("div",{className:"w-5 h-5 border-2 border-text-muted/30 border-t-text-muted rounded-full animate-spin"})}),t.jsx("div",{className:"h-full w-full transition-opacity duration-300 ease-out",style:{opacity:R?1:0},children:t.jsxs(i,{ref:C,initialViewState:{longitude:W[0],latitude:W[1],zoom:10},onLoad:z,style:{height:"100%",width:"100%"},mapStyle:v,attributionControl:!1,children:[t.jsx(s,{mode:k}),V.map((e,o)=>{const r={type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[e.from,e.to]}}]};return t.jsx(a,{id:`edge-${o}`,type:"geojson",data:r,children:t.jsx(n,{id:`edge-line-${o}`,type:"line",paint:{"line-color":e.color,"line-width":4,"line-opacity":1},layout:{"line-cap":"round","line-join":"round"}})},`edge-${o}`)}),V.map((e,o)=>t.jsx(l,{longitude:e.midpoint[0],latitude:e.midpoint[1],anchor:"center",children:t.jsx(w,{hopNumber:o+1,snr:j?e.snrFwd:void 0,edgeColor:e.color})},`hop-${o}`)),(()=>{const e=I.filter(e=>e.isPrimary),o=e.length>1?e.length-2:-1;return e.map((e,r)=>{const i=f===e.hopIndex,s=r===o&&!e.candidate.isLocal&&!e.isDestination;return t.jsx(l,{longitude:e.position[1],latitude:e.position[0],anchor:"center",children:t.jsx(S,{prefix:e.prefix,isLocal:e.candidate.isLocal||!1,isSource:e.isSource,isDestination:e.isDestination,isLastHop:s,isHighlighted:i,isAnimating:!1,isWardrive:e.candidate.isWardrive||!1,candidate:e.candidate,onHover:()=>null==b?void 0:b(e.hopIndex),onLeave:()=>null==b?void 0:b(null),onClick:()=>Z(e)})},`${e.hopIndex}-${e.candidate.hash}`)})})(),L&&t.jsx(d,{longitude:L.longitude,latitude:L.latitude,anchor:"bottom",offset:[0,-12],closeOnClick:!1,onClose:()=>M(null),className:"maplibre-popup",children:t.jsxs("div",{className:"text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"font-semibold",children:L.marker.candidate.name}),(()=>{const e=N();return t.jsxs(t.Fragment,{children:[L.marker.isSource&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.sourceColor,color:"#000"},children:"SRC"}),L.marker.isDestination&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.destinationColor,color:"#000"},children:"DST"}),L.marker.isHub&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.hubColor,color:"#000"},children:"HUB"}),L.marker.candidate.isLocal&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.localColor,color:"#fff"},children:"LOCAL"}),L.marker.candidate.isWardrive&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:"#F97316",color:"#fff"},children:"WARDRIVE"})]})})()]}),t.jsxs("div",{className:"text-fg-muted type-data-xs",children:[L.marker.prefix," • ",L.marker.candidate.hash.slice(0,10),"..."]}),!L.marker.isPrimary&&L.marker.candidateCount>1&&t.jsxs("div",{style:{color:N().ambiguousColor},children:["Alternative (",(100*L.marker.candidate.probability).toFixed(0),"%)"]}),L.marker.isPrimary&&L.marker.candidateCount>1&&t.jsxs("div",{className:"text-fg-muted",children:[L.marker.candidateCount," candidates"]})]})})]},H)})]})}export{F as default}; diff --git a/frontend/dist/assets/RoomServer-tW8KnEnb.js b/frontend/dist/assets/RoomServer-B0PNcG8D.js similarity index 97% rename from frontend/dist/assets/RoomServer-tW8KnEnb.js rename to frontend/dist/assets/RoomServer-B0PNcG8D.js index 8576d325..69ca5221 100644 --- a/frontend/dist/assets/RoomServer-tW8KnEnb.js +++ b/frontend/dist/assets/RoomServer-B0PNcG8D.js @@ -1 +1 @@ -import{j as e,W as s,c as t,Z as a,M as n,r as l}from"./vendor-react-j_fHog8x.js";import{a as i,P as r,b as o,B as d}from"./PageLayout-DrvMAhys.js";import{R as c,C as m}from"./Grid-OFJ4oe0a.js";import{c as u,bb as x,R as p,W as h,bR as g,X as y,j as v,I as j,cQ as f,B as N,ap as b,Y as k,bk as w,o as C,cR as S,cS as _,cT as M,cU as R,cV as T,cW as A,cX as D,cY as E,cZ as L,t as F,cL as I,aH as P}from"./index-01Tx8g53.js";import{L as $,a as z,b as K}from"./listbox-D30S1eZ7.js";import{P as O,T as q,C as H}from"./ConfirmModal-B8b131zF.js";import{M as U}from"./map-pin-DZIYgupP.js";import{S as B,K as V,r as W}from"./KeycapButton-6IH7dZJL.js";import{S as G,C as X,M as Y}from"./ChatBubble-B4FG9Nhp.js";import{C as J}from"./Card-Dr9pbVV5.js";import{e as Q,g as Z,a as ee}from"./chat-utils-CB1BFUm7.js";import{W as se}from"./wifi-DUOhGE6X.js";import{K as te}from"./key-round-D0AtlMOx.js";import{C as ae}from"./copy-B5OWhmpX.js";import{U as ne}from"./users-CIk0ES1a.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CmkNwW1A.js";import"./triangle-alert-DI33YyZq.js";import"./keycap-sfx-CAsrNe23.js";const le=u("message-circle",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]),ie=u("message-square-plus",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]]),re=u("repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]),oe=u("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),de=u("user-x",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);function ce({disabled:a,className:n,children:l}){return e.jsx(s,{disabled:a,className:t("flex flex-col gap-2",n),children:l})}function me({required:s,className:n,children:l,...i}){return e.jsxs(a,{className:t("text-sm font-medium text-fg-primary select-none","data-[disabled]:opacity-50",i.title&&"cursor-help",n),...i,children:[l,s&&e.jsx("span",{className:"text-sys-red ml-0.5","aria-hidden":"true",children:"*"})]})}function ue({className:s,children:a,...l}){return e.jsx(n,{className:t("text-sm text-fg-muted","data-[disabled]:opacity-50",s),...l,children:a})}function xe({icon:s,title:a,description:n,onClick:l,accent:i}){return e.jsxs("button",{onClick:l,className:t("flex flex-col items-center gap-3 p-6 rounded-2xl text-center","ring-1 ring-edge-subtle hover:ring-2 transition-all duration-150","w-full max-w-[260px]","primary"===i?"hover:ring-sys-blue hover:bg-sys-blue/5":"hover:ring-sys-indigo hover:bg-sys-indigo/5"),children:[e.jsx("div",{className:t("p-3 rounded-xl","primary"===i?"bg-sys-blue/10 text-sys-blue":"bg-sys-indigo/10 text-sys-indigo"),children:s}),e.jsx("p",{className:"type-body-sm font-medium text-fg-primary",children:a}),e.jsx("p",{className:"type-data-xs text-fg-muted leading-relaxed",children:n})]})}function pe({onCreateRoom:s}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4",children:[e.jsx(x,{className:"w-12 h-12 text-fg-muted opacity-30 mb-4"}),e.jsx("p",{className:"type-subheading text-fg-secondary mb-1",children:"Add a Room Server"}),e.jsx("p",{className:"type-body-sm text-fg-muted mb-8",children:"Choose how this device should operate."}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[e.jsx(xe,{icon:e.jsx(re,{className:"w-6 h-6"}),title:"Repeater + Room Server",description:"Keep forwarding packets and add group messaging.",onClick:()=>s("hybrid"),accent:"primary"}),e.jsx(xe,{icon:e.jsx(p,{className:"w-6 h-6"}),title:"Dedicated Room Server",description:"Stop repeating. Focus entirely on room server duties.",onClick:()=>s("dedicated"),accent:"secondary"})]})]})}function he({rooms:s,selected:a,onSelect:n,onAdd:l}){const i=l?e.jsx("button",{onClick:l,className:t("flex items-center justify-center px-2 py-1 rounded-md","text-fg-muted hover:text-fg-primary hover:bg-surface/60","transition-all duration-150"),title:"Add room server",children:e.jsx(O,{className:"w-4 h-4"})}):null;return s.length<=1?i:s.length<=3?e.jsxs("div",{className:"flex items-center gap-0.5 p-0.5 rounded-lg bg-subtle-fill",children:[s.map(s=>e.jsx("button",{onClick:()=>n(s.room_name),className:t("px-3 py-1 rounded-md text-sm font-medium transition-all duration-150",s.room_name===a?"bg-surface text-fg-primary shadow-sm":"text-fg-muted hover:text-fg-secondary"),children:s.room_name},s.room_name)),i]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx($,{value:a??"",onChange:n,children:s.map(s=>e.jsx(z,{value:s.room_name,children:e.jsx(K,{children:s.room_name})},s.room_name))}),i]})}function ge({open:s,onClose:t,mode:a,identity:n,repeaterConfig:i,onCreate:r,onUpdate:o,onDelete:d,onSendAdvert:c}){var m,u,x,p,k,w,C,S,_;const M="edit"===a&&n,R=`${s}-${(null==n?void 0:n.name)??""}-${a}`,[T,A]=l.useState(""),[D,E]=l.useState(""),[L,F]=l.useState(!1),[I,P]=l.useState(""),[$,z]=l.useState(""),[K,O]=l.useState(""),[H,B]=l.useState(""),[V,W]=l.useState(!1),[G,X]=l.useState(!1),[Y,J]=l.useState(!1),[Q,Z]=l.useState(null),[ee,se]=l.useState(R);if(R!==ee)if(se(R),Z(null),W(!1),X(!1),J(!1),M)A((null==(m=n.settings)?void 0:m.node_name)??n.name),E(n.identity_key??""),F(!1),P((null==(u=n.settings)?void 0:u.admin_password)??""),z((null==(x=n.settings)?void 0:x.guest_password)??""),O((null==(k=null==(p=n.settings)?void 0:p.latitude)?void 0:k.toString())??""),B((null==(C=null==(w=n.settings)?void 0:w.longitude)?void 0:C.toString())??"");else{const e=i;A(""),E(""),F(!1),P(""),z(""),O(null!=(null==(S=null==e?void 0:e.repeater)?void 0:S.latitude)?e.repeater.latitude.toString():""),B(null!=(null==(_=null==e?void 0:e.repeater)?void 0:_.longitude)?e.repeater.longitude.toString():"")}const te=l.useCallback(()=>{const e={};return T&&(e.node_name=T),I&&(e.admin_password=I),$&&(e.guest_password=$),""!==K&&(e.latitude=parseFloat(K)),""!==H&&(e.longitude=parseFloat(H)),e},[T,I,$,K,H]),ae=l.useCallback(async()=>{if(!T.trim())return void Z("Room name is required");W(!0),Z(null);const e=M?n.name:function(e){if(!e)return"";const s=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return s?`${s}-room`:""}(T);let s;if(M)s=await o({name:n.name,settings:te()});else{const t={name:e,type:"room_server",settings:te()};D.trim()&&(t.identity_key=D.trim()),s=await r(t)}W(!1),s?t():Z("Failed to save. Check that the name is unique and passwords differ.")},[T,M,n,te,r,o,t]),ne=l.useCallback(async()=>{if(!M)return;X(!0);const e=await d(n.name);X(!1),e&&t()},[M,n,d,t]),le=l.useCallback(async()=>{M&&(J(!0),await c(n.name),J(!1))},[M,n,c]);return e.jsxs(h,{open:s,onClose:t,size:"md",children:[e.jsx(g,{icon:M?void 0:e.jsx(ie,{className:"w-5 h-5"}),title:M?"Edit Room Server":"Add Room Server",onClose:t}),e.jsx(y,{children:e.jsxs("div",{className:"space-y-5",children:[M&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v,{color:n.registered?"green":"red",children:n.registered?"Active":"Inactive"}),n.identity_key&&e.jsxs("span",{className:"type-data-xs text-fg-muted truncate",title:n.identity_key,children:["Key: ",n.identity_key.slice(0,16),"…"]})]}),e.jsxs(ce,{children:[e.jsx(me,{title:"What people see on the mesh",children:"Room Name"}),e.jsx(j,{value:T,onChange:e=>A(e.target.value),placeholder:"Room Name"})]}),!M&&e.jsxs(ce,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(me,{title:"The unique hex public ID",children:["Identity Key ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx("button",{type:"button",onClick:()=>F(e=>!e),className:"type-data-xs text-fg-muted underline hover:text-fg-secondary",children:L?"Hide":"Show"})]}),L&&e.jsxs(e.Fragment,{children:[e.jsx(j,{value:D,onChange:e=>E(e.target.value),placeholder:"Leave empty to auto-generate"}),e.jsx(ue,{children:"Leave empty to automatically generate a secure key"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(ce,{children:[e.jsxs(me,{children:[e.jsx(U,{className:"inline w-3.5 h-3.5 -mt-0.5 mr-1 text-fg-muted"}),"Latitude"]}),e.jsx(j,{type:"number",step:"any",value:K,onChange:e=>O(e.target.value),placeholder:"0"})]}),e.jsxs(ce,{children:[e.jsxs(me,{children:[e.jsx(U,{className:"inline w-3.5 h-3.5 -mt-0.5 mr-1 text-fg-muted"}),"Longitude"]}),e.jsx(j,{type:"number",step:"any",value:H,onChange:e=>B(e.target.value),placeholder:"0"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(ce,{children:[e.jsxs(me,{title:"Full access to room server",children:["Admin Password ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx(j,{type:"password",value:I,onChange:e=>P(e.target.value),placeholder:"None Set"})]}),e.jsxs(ce,{children:[e.jsxs(me,{title:"Can post and read, but not administer the room",children:["Guest Password ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx(j,{type:"password",value:$,onChange:e=>z(e.target.value),placeholder:"None Set"})]})]}),Q&&e.jsx("p",{className:"type-data-xs text-sys-red",children:Q})]})}),e.jsxs(f,{children:[M&&e.jsxs("div",{className:"flex items-center gap-2 mr-auto",children:[e.jsxs(N,{color:"danger",plain:!0,onClick:ne,disabled:G,children:[e.jsx(q,{"data-slot":"icon"}),G?"Deleting…":"Delete"]}),e.jsxs(N,{color:"primary",plain:!0,onClick:le,disabled:Y,children:[e.jsx(b,{"data-slot":"icon"}),Y?"Sending…":"Send Advert"]})]}),e.jsx(N,{plain:!0,onClick:t,children:"Cancel"}),e.jsx(N,{color:"primary",onClick:ae,disabled:V,children:V?"Saving…":M?"Save Changes":"Create"})]})]})}const ye=l.createContext(null),ve="room-tui";function je({children:s}){const[t,a]=l.useState(()=>"0"!==localStorage.getItem(ve)),n=l.useCallback(()=>{a(e=>{const s=!e;return localStorage.setItem(ve,s?"1":"0"),s})},[]);return e.jsx(ye.Provider,{value:{terminalMode:t,toggleTerminalMode:n},children:s})}function fe(){const e=l.useContext(ye);if(!e)throw new Error("useTerminalMode must be used within RoomTerminalProvider");return e}const Ne=e=>"server"===e.author_pubkey||"system"===e.author_pubkey;function be({messages:s,onDelete:t,terminalMode:a,serverName:n}){const i=l.useRef(null),[r,o]=l.useState(!1),d=l.useMemo(()=>[...s].sort((e,s)=>e.post_timestamp-s.post_timestamp),[s]);l.useEffect(()=>{!r&&i.current&&(i.current.scrollTop=0)},[d.length,r]);const c=l.useCallback(()=>{i.current&&o(i.current.scrollTop<-100)},[]),m=l.useCallback(()=>{i.current&&i.current.scrollTo({top:0,behavior:"smooth"}),o(!1)},[]);return 0===d.length?e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center py-12 min-h-0"+(a?" font-mono":""),children:a?e.jsx("p",{className:"text-sm font-mono",style:{color:"var(--tui-accent)",opacity:.4},children:"> no messages in buffer_"}):e.jsxs(e.Fragment,{children:[e.jsx(x,{className:"w-10 h-10 text-fg-muted opacity-20 mb-2"}),e.jsx("p",{className:"type-data-sm text-fg-muted",children:"No messages yet"})]})}):a?e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:i,onScroll:c,className:"h-full overflow-y-auto scroll-smooth p-4 font-mono text-sm leading-relaxed flex flex-col-reverse",children:e.jsx("div",{children:d.map(s=>{const a=Ne(s),l=new Date(1e3*s.post_timestamp).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),i=a?"SYS":s.author_name||s.author_prefix,r=!a&&n&&i===n;return e.jsxs("div",{className:"group flex items-start gap-0 -mx-4 px-4 py-px",style:{"--tw-hover-bg":"var(--tui-hover-bg)"},onMouseEnter:e=>e.currentTarget.style.background="var(--tui-hover-bg)",onMouseLeave:e=>e.currentTarget.style.background="",children:[e.jsxs("span",{className:"select-none shrink-0",style:{color:"var(--tui-muted)"},children:["[",l,"]"]}),e.jsxs("span",{className:"mx-1.5 shrink-0",style:{color:r?"var(--tui-accent-local)":"var(--tui-accent)"},children:["<",i,">"]}),e.jsx("span",{style:{color:a?"var(--tui-system)":r?"var(--tui-body)":"var(--tui-accent)"},className:a?"italic":"",children:s.message_text}),e.jsx("button",{onClick:()=>t(s.id),className:"opacity-0 group-hover:opacity-100 ml-auto pl-2 shrink-0 transition-colors",style:{color:"var(--tui-muted)"},onMouseEnter:e=>e.currentTarget.style.color="var(--tui-danger)",onMouseLeave:e=>e.currentTarget.style.color="var(--tui-muted)",title:"Delete",children:"×"})]},s.id)})})}),r&&e.jsxs("button",{onClick:m,className:"absolute bottom-3 left-1/2 -translate-x-1/2 flex items-center gap-1.5 px-3 py-1 font-mono text-xs transition-colors duration-150",style:{background:"var(--tui-hover-bg)",border:"1px solid var(--tui-muted)",color:"var(--tui-accent)"},children:[e.jsx(k,{className:"w-3 h-3"}),"↓ scroll"]})]}):e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:i,onScroll:c,className:"h-full overflow-y-auto scroll-smooth flex flex-col-reverse",children:e.jsx("div",{className:"space-y-3 p-4",children:d.map(s=>Ne(s)?e.jsx(G,{text:s.message_text},s.id):e.jsx(X,{senderName:s.author_name||s.author_prefix,text:s.message_text,timestamp:s.post_timestamp,bubbleAccessory:e.jsx("button",{onClick:()=>t(s.id),className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150 p-1 text-fg-muted hover:text-sys-red flex-shrink-0",title:"Delete message",children:e.jsx(q,{className:"w-3.5 h-3.5"})})},s.id))})}),r&&e.jsxs("button",{onClick:m,className:"absolute bottom-3 left-1/2 -translate-x-1/2 flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-surface/90 backdrop-blur-sm ring-1 ring-edge-subtle shadow-md text-fg-secondary hover:text-fg-primary transition-colors duration-150",children:[e.jsx(k,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs",children:"New messages"})]})]})}function ke({roomName:s,onSend:t,disabled:a,terminalMode:n}){const[i,r]=l.useState(""),[o,d]=l.useState(!1),c=l.useRef(null),m=l.useCallback(async()=>{var e;const s=i.trim();if(!s||o)return;d(!0);const a=await t(s);d(!1),a&&(r(""),null==(e=c.current)||e.focus())},[i,o,t]),u=l.useCallback(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),m())},[m]);return n?e.jsxs("div",{className:"flex items-center gap-0 px-4 py-2 type-data-sm",children:[e.jsx("input",{ref:c,type:"text",value:i,onChange:e=>r(e.target.value),onKeyDown:u,placeholder:"type message...",disabled:a||o,className:"flex-1 bg-transparent outline-none ring-0 shadow-none border-none focus:outline-none focus:ring-0 font-mono tui-input",style:{color:"var(--tui-body)"}}),e.jsx("button",{onClick:m,disabled:!i.trim()||o||a,className:"transition-colors duration-100 px-1 font-mono text-xs disabled:opacity-30",style:{color:"var(--tui-accent)"},title:"Send",children:"[↵]"})]}):e.jsxs("div",{className:"flex items-center gap-2 p-3 border-t border-edge-subtle",children:[e.jsx("input",{ref:c,type:"text",value:i,onChange:e=>r(e.target.value),onKeyDown:u,placeholder:`Message ${s}…`,disabled:a||o,className:"flex-1 surface-input radius-inner px-3 py-2 type-body-sm text-fg-primary placeholder:text-fg-muted outline-none ring-focus"}),e.jsx("button",{onClick:m,disabled:!i.trim()||o||a,className:"p-2 rounded-lg text-sys-blue hover:bg-sys-blue/10 disabled:opacity-30 disabled:hover:bg-transparent transition-colors duration-150",title:"Send message",children:e.jsx(b,{className:"w-4.5 h-4.5"})})]})}function we({selectedName:s,selectedIdentity:t,messages:a,onSend:n,onDelete:r,onClear:o}){var d;const{terminalMode:c,toggleTerminalMode:m}=fe(),[u,x]=l.useState(!1),p=(null==(d=null==t?void 0:t.settings)?void 0:d.node_name)??s??void 0,h=l.useCallback(()=>{x(!1),o()},[o]);return c?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col h-full gap-1.5",children:[e.jsxs("div",{className:"card-terminal-header flex-shrink-0",children:[e.jsx("span",{className:"seven-seg-panel",children:e.jsx(B,{text:"chat",minChars:7,size:24})}),e.jsx("div",{className:"card-terminal-ridge flex-1"}),e.jsxs("div",{className:"header-well",children:[e.jsx(V,{icon:e.jsx(oe,{className:"!w-5.5 !h-5.5 translate-y-px"}),onClick:m,title:"Exit terminal mode"}),a.length>0&&e.jsx(V,{icon:e.jsx("span",{className:"text-[13px] font-bold font-mono leading-none translate-y-px",children:"DEL"}),onClick:()=>x(!0),title:"Clear all messages",variant:"red",iconActiveColor:w.red})]})]}),e.jsx(i,{noPadding:!0,className:"flex flex-col flex-1 min-h-0 overflow-hidden card-terminal",children:e.jsxs("div",{className:"card-terminal-well flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsx(be,{messages:a,onDelete:r,terminalMode:!0,serverName:p}),e.jsx("div",{className:"card-terminal-divider"}),s&&e.jsx(ke,{roomName:s,onSend:n,disabled:!(null==t?void 0:t.registered),terminalMode:!0})]})})]}),e.jsx(H,{isOpen:u,title:"Clear All Messages",message:`This will permanently delete all ${a.length} message${1===a.length?"":"s"} from this room. This cannot be undone.`,confirmLabel:"Clear Messages",variant:"danger",onConfirm:h,onCancel:()=>x(!1)})]}):e.jsxs(e.Fragment,{children:[e.jsxs(i,{noPadding:!0,className:"flex flex-col h-full overflow-hidden",children:[e.jsx(J,{listHeader:!0,icon:e.jsx(le,{className:"icon-sm"}),title:"Messages",actions:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(N,{plain:!0,onClick:m,title:"Terminal mode",children:e.jsx(oe,{"data-slot":"icon",className:"!w-5 !h-5 translate-y-px"})}),a.length>0&&e.jsx(N,{plain:!0,onClick:()=>x(!0),title:"Clear all messages",children:e.jsx("span",{"data-slot":"icon",className:"text-[12px] font-bold font-mono leading-none translate-y-px text-sys-red",children:"DEL"})})]})}),e.jsx(be,{messages:a,onDelete:r,terminalMode:!1,serverName:p}),s&&e.jsx(ke,{roomName:s,onSend:n,disabled:!(null==t?void 0:t.registered),terminalMode:!1})]}),e.jsx(H,{isOpen:u,title:"Clear All Messages",message:`This will permanently delete all ${a.length} message${1===a.length?"":"s"} from this room. This cannot be undone.`,confirmLabel:"Clear Messages",variant:"danger",onConfirm:h,onCancel:()=>x(!1)})]})}function Ce({pubkey:s,className:t}){const[a,n]=l.useState(!1),i=l.useCallback(()=>{navigator.clipboard.writeText(s),n(!0),setTimeout(()=>n(!1),1500)},[s]);return e.jsxs("button",{onClick:i,title:a?"Copied!":"Copy public key",className:`inline-flex items-center gap-1 type-data-xs leading-tight text-fg-muted hover:text-fg-secondary transition-colors duration-150 cursor-copy ${t??""}`,children:[e.jsx("span",{className:"truncate min-w-0",children:s.slice(0,8)}),a&&e.jsx(C,{className:"w-2.5 h-2.5 text-sys-green flex-shrink-0"})]})}const Se=l.memo(function({client:s,resolvedName:a,onRemove:n}){const l=s.name||a,i=0===s.unsynced_count,r=s.last_activity?new Date(1e3*s.last_activity).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"Never",{emoji:o,cleanName:d}=l?Q(l):{emoji:null,cleanName:s.pubkey_prefix},c=l?Z(d):void 0,m=l?ee(l):s.pubkey_prefix.slice(0,2).toUpperCase();return e.jsxs("div",{className:"group flex items-center gap-3 px-3 py-2.5 radius-inner row-hover transition-base",children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx("div",{className:t("w-8 h-8 rounded-full flex items-center justify-center",!c&&"bg-sys-blue/12"),style:c?{backgroundColor:c}:void 0,children:o?e.jsx("span",{className:"text-base leading-none",children:o}):e.jsx("span",{className:t("leading-none",c?"text-white text-[11px] font-bold tracking-tight":"text-sys-blue font-mono text-[11px]"),children:m})}),e.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-sm ring-2 ring-surface "+(i?"bg-sys-green":"bg-sys-indigo")})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[l?e.jsx("p",{className:"text-[13px] font-medium leading-tight text-fg-primary truncate",children:l}):e.jsx("p",{className:"font-mono text-[13px] leading-tight text-fg-primary truncate",children:s.pubkey_prefix}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[l&&e.jsx(Ce,{pubkey:s.pubkey}),l&&e.jsx("span",{className:"text-xs text-fg-muted/40",children:"·"}),e.jsxs("span",{className:"text-xs leading-tight text-fg-muted truncate",children:[!i&&e.jsxs("span",{className:"text-sys-indigo",children:[s.unsynced_count," unsynced · "]}),r]})]})]}),e.jsx("button",{onClick:()=>n(s.pubkey),className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150 p-1.5 -mr-1 rounded-md text-fg-muted hover:text-sys-red hover:bg-sys-red/8",title:"Remove client",children:e.jsx(de,{className:"w-3.5 h-3.5"})})]})});function _e({clients:s,onRemove:t,messages:a,terminalMode:n}){const i=l.useMemo(()=>{const e=new Map;if(!a)return e;for(let s=a.length-1;s>=0;s--){const t=a[s];t.author_name&&t.author_pubkey&&"server"!==t.author_pubkey&&"system"!==t.author_pubkey&&e.set(t.author_pubkey,t.author_name)}return e},[a]);return 0===s.length?n?e.jsx("p",{className:"type-data-sm text-left px-4 py-4",style:{color:"var(--tui-accent)"},children:"< NO CLIENTS CONNECTED >"}):e.jsx("p",{className:"type-data-xs text-fg-muted text-center py-4",children:"No clients connected"}):n?e.jsx("div",{className:"type-data-sm pt-2",children:s.map(s=>{const a=s.name||i.get(s.pubkey),n=0===s.unsynced_count,l=s.pubkey_prefix;return e.jsxs("div",{className:"group flex items-center gap-0 -mx-0 px-4 py-0.5",onMouseEnter:e=>e.currentTarget.style.background="var(--tui-hover-bg)",onMouseLeave:e=>e.currentTarget.style.background="",children:[e.jsx("span",{style:{color:n?"var(--tui-accent)":"var(--tui-warn)"},children:"■"}),e.jsx("span",{className:"ml-2 shrink-0",style:{color:"var(--tui-accent)"},children:a||l}),a&&e.jsxs("span",{className:"ml-1.5 shrink-0",style:{color:"var(--tui-accent)"},children:["[",l,"]"]}),!n&&e.jsxs("span",{className:"ml-1.5",style:{color:"var(--tui-warn)"},children:[s.unsynced_count,"unsync"]}),e.jsx("button",{onClick:()=>t(s.pubkey),className:"opacity-0 group-hover:opacity-100 ml-auto pl-2 shrink-0 transition-colors",style:{color:"var(--tui-muted)"},onMouseEnter:e=>e.currentTarget.style.color="var(--tui-danger)",onMouseLeave:e=>e.currentTarget.style.color="var(--tui-muted)",title:"Remove",children:"×"})]},s.pubkey)})}):e.jsx("div",{className:"space-y-0.5 pt-1",children:s.map(s=>e.jsx(Se,{client:s,resolvedName:i.get(s.pubkey),onRemove:t},s.pubkey))})}function Me({name:s,onSend:t}){const{terminalMode:a}=fe(),[n,i]=l.useState("idle"),r=l.useRef(),o=l.useCallback(async()=>{if("sending"===n)return;i("sending");const e=await t(s);i(e?"sent":"idle"),e&&(r.current=setTimeout(()=>i("idle"),2e3))},[s,t,n]);return l.useEffect(()=>()=>clearTimeout(r.current),[]),a?e.jsxs("button",{className:"btn-terminal",onClick:o,disabled:"sending"===n,children:["idle"===n&&"[ send_advert ]","sending"===n&&"[ broadcasting... ]","sent"===n&&"[ sent ✓ ]"]}):e.jsxs(N,{color:"sent"===n?"success":"primary",className:"w-full",onClick:o,disabled:"sending"===n,children:[e.jsx(se,{"data-slot":"icon"}),"idle"===n&&"Send Advert","sending"===n&&"Broadcasting…","sent"===n&&"Advert Sent"]})}function Re({identity:s,onSendAdvert:t}){var a,n,i,r,o,d,c,m,u,x,p,h,g,y,j,f,N,b,k,w,S,_,M,R,T,A,D,E,L,F;const{terminalMode:I}=fe(),[P,$]=l.useState(!1),z=l.useCallback(()=>{(null==s?void 0:s.identity_key)&&(navigator.clipboard.writeText(s.identity_key),$(!0),setTimeout(()=>$(!1),1500))},[null==s?void 0:s.identity_key]);return I?s?e.jsxs("div",{className:"space-y-1",children:[(null==(a=s.settings)?void 0:a.node_name)&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"node"}),e.jsx("span",{style:{color:"var(--tui-accent)"},children:s.settings.node_name})]}),(s.address||(null==(n=s.runtime)?void 0:n.address))&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"addr"}),e.jsx("span",{style:{color:"var(--tui-accent)"},children:s.address||(null==(i=s.runtime)?void 0:i.address)})]}),s.identity_key&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"key"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"truncate max-w-[140px]",style:{color:"var(--tui-accent)"},title:s.identity_key,children:[s.identity_key.slice(0,16),"…"]}),e.jsx("button",{type:"button",onClick:z,className:"text-xs",style:{color:"var(--tui-muted)"},children:P?"[copied ✓]":"[copy]"})]})]}),(null!=(null==(r=s.settings)?void 0:r.latitude)||null!=(null==(o=s.settings)?void 0:o.longitude))&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"loc"}),e.jsxs("span",{style:{color:"var(--tui-accent)"},title:`${(null==(d=s.settings)?void 0:d.latitude)??"—"}, ${(null==(c=s.settings)?void 0:c.longitude)??"—"}`,children:[(null==(u=null==(m=s.settings)?void 0:m.latitude)?void 0:u.toFixed(4))??"—",", ",(null==(p=null==(x=s.settings)?void 0:x.longitude)?void 0:p.toFixed(4))??"—"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"pass"}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{style:{color:(null==(h=s.settings)?void 0:h.admin_password)?"var(--tui-accent)":"var(--tui-muted)"},children:(null==(g=s.settings)?void 0:g.admin_password)?"[✓ admin]":"[— admin]"}),e.jsx("span",{style:{color:(null==(y=s.settings)?void 0:y.guest_password)?"var(--tui-accent)":"var(--tui-muted)"},children:(null==(j=s.settings)?void 0:j.guest_password)?"[✓ guest]":"[— guest]"})]})]})]}):e.jsx("span",{style:{color:"var(--tui-muted)"},children:"no identity configured"}):e.jsxs("div",{className:"flex-shrink-0 border-t border-edge-subtle",children:[e.jsx(J,{listHeader:!0,icon:e.jsx(Y,{className:"icon-sm"}),title:"Room Info"}),s?e.jsxs("div",{className:"space-y-2 px-4 py-3",children:[(null==(f=s.settings)?void 0:f.node_name)&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-xs text-fg-muted",children:"Node"}),e.jsx("span",{className:"type-data-sm text-fg-primary",children:s.settings.node_name})]}),(s.address||(null==(N=s.runtime)?void 0:N.address))&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-xs text-fg-muted",children:"Address"}),e.jsx("span",{className:"type-data-sm font-mono text-fg-primary",children:s.address||(null==(b=s.runtime)?void 0:b.address)})]}),s.identity_key&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"type-data-xs text-fg-muted flex items-center gap-1",title:"The unique hex public ID",children:[e.jsx(te,{className:"w-3 h-3"}),"Key"]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"type-data-sm font-mono text-fg-primary truncate max-w-[140px]",title:s.identity_key,children:[s.identity_key.slice(0,16),"…"]}),e.jsx("button",{type:"button",onClick:z,className:"inline-flex items-center gap-0.5",children:e.jsx(v,{color:P?"green":"zinc",children:P?e.jsxs(e.Fragment,{children:[e.jsx(C,{className:"w-3 h-3"}),"Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-3 h-3"}),"Copy"]})})})]})]}),(null!=(null==(k=s.settings)?void 0:k.latitude)||null!=(null==(w=s.settings)?void 0:w.longitude))&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"type-data-xs text-fg-muted flex items-center gap-1",children:[e.jsx(U,{className:"w-3 h-3"}),"Location"]}),e.jsxs("span",{className:"type-data-sm font-mono text-fg-primary",title:`${(null==(S=s.settings)?void 0:S.latitude)??"—"}, ${(null==(_=s.settings)?void 0:_.longitude)??"—"}`,children:[(null==(R=null==(M=s.settings)?void 0:M.latitude)?void 0:R.toFixed(4))??"—",", ",(null==(A=null==(T=s.settings)?void 0:T.longitude)?void 0:A.toFixed(4))??"—"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-xs text-fg-muted",children:"Passwords"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs(v,{color:(null==(D=s.settings)?void 0:D.admin_password)?"green":"zinc",children:[(null==(E=s.settings)?void 0:E.admin_password)&&e.jsx(C,{className:"w-3 h-3"}),"Admin"]}),e.jsxs(v,{color:(null==(L=s.settings)?void 0:L.guest_password)?"green":"zinc",children:[(null==(F=s.settings)?void 0:F.guest_password)&&e.jsx(C,{className:"w-3 h-3"}),"Guest"]})]})]}),e.jsx("div",{className:"pt-3",children:e.jsx(Me,{name:s.name,onSend:t})})]}):e.jsx("p",{className:"type-data-xs text-fg-muted text-center py-3",children:"No identity configured"})]})}function Te({selectedIdentity:s,clients:t,messages:a,onSendAdvert:n}){const{terminalMode:r}=fe(),o=l.useCallback(async e=>{S.setState(s=>({clients:s.clients.filter(s=>s.pubkey!==e)})),await W({public_key:e})},[]);return r?e.jsxs("div",{className:"flex flex-col h-full gap-1.5",children:[s&&e.jsx("div",{className:"card-terminal-header flex-shrink-0",children:e.jsx("div",{className:"header-well flex-1",children:e.jsx(V,{icon:e.jsx(se,{}),onPress:()=>n(s.name),title:"Send room server advert",indicators:[{label:"ADVERTISE",trackPress:!0},{label:"ACTIVE",active:s.registered}]})})}),e.jsxs("div",{className:"flex flex-col flex-1 min-h-0 gap-1.5",children:[e.jsx("div",{className:"card-terminal-header flex-shrink-0",children:e.jsx("span",{className:"seven-seg-panel",children:e.jsx(B,{text:`OnLInE ${String(t.length).padStart(3,"0")}`,size:24})})}),e.jsx(i,{noPadding:!0,className:"!h-auto flex flex-col flex-1 min-h-0 overflow-hidden card-terminal",children:e.jsx("div",{className:"card-terminal-well flex-1 min-h-0 overflow-y-auto",children:e.jsx(_e,{clients:t,onRemove:o,messages:a,terminalMode:!0})})}),e.jsx("div",{className:"card-terminal-header flex-shrink-0",children:e.jsx("span",{className:"seven-seg-panel",children:e.jsx(B,{text:"StAtUS "+((null==s?void 0:s.registered)?"On":"OFF"),size:24})})}),e.jsx(i,{noPadding:!0,className:"!h-auto flex-shrink-0 overflow-hidden card-terminal",children:e.jsx("div",{className:"card-terminal-well px-4 py-3 type-data-sm",children:e.jsx(Re,{identity:s,onSendAdvert:n})})})]})]}):e.jsxs(i,{compact:!0,className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsx(J,{listHeader:!0,icon:e.jsx(ne,{className:"icon-sm"}),title:"Clients",actions:t.length>0?e.jsx("span",{className:"type-data-xs text-fg-muted",children:t.length}):void 0}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsx(_e,{clients:t,onRemove:o,messages:a,terminalMode:!1})}),e.jsx(Re,{identity:s,onSendAdvert:n})]})}function Ae(){const s=_(),t=M(),a=R(),n=T(),i=A(),u=D(),p=E(),h=L(),g=F(),{selectRoom:y,postMessage:j,deleteMessage:f,clearMessages:b,createRoom:k,updateRoom:w,deleteRoom:C,sendAdvert:$,markAsRead:z,startActivePolling:K}=S.getState(),[O,q]=l.useState(!1),[H,U]=l.useState("create"),[B,V]=l.useState("hybrid");l.useEffect(()=>{z()},[t,z]),l.useEffect(()=>K(),[K]);const W=l.useCallback(async e=>!!t&&j({room_name:t,message:e,author_pubkey:"server"}),[t,j]),G=l.useCallback((e="hybrid")=>{V(e),U("create"),q(!0)},[]),X=l.useCallback(()=>{U("edit"),q(!0)},[]),Y=a?e.jsxs("span",{className:"type-data-sm text-fg-muted",children:[a.total_messages," messages · ",a.total_clients," clients",n&&e.jsxs(e.Fragment,{children:[" · ",e.jsx(v,{color:n.registered?"green":"red",className:"ml-0.5",children:n.registered?"Active":"Inactive"})]})]}):void 0,J=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{rooms:s,selected:t,onSelect:y,onAdd:()=>G("hybrid")}),s.length>0&&e.jsx(N,{plain:!0,onClick:X,title:"Manage room server",children:e.jsx(I,{"data-slot":"icon"})})]});return 0!==s.length||0!==p.length||h?e.jsx(je,{children:e.jsxs(r,{children:[e.jsx(o,{title:"Room Server",icon:e.jsx(x,{}),subtitle:Y,controls:J}),e.jsx(d,{children:e.jsxs(c,{template:"hero-tall",className:"!h-[calc(100vh-11rem)] !min-h-[400px]",children:[e.jsx(m,{span:12,lg:8,className:"h-full",children:e.jsx(we,{selectedName:t,selectedIdentity:n,messages:i,onSend:W,onDelete:f,onClear:b})}),e.jsx(m,{span:12,lg:4,className:"h-full",children:e.jsx(Te,{selectedIdentity:n,clients:u,messages:i,onSendAdvert:$})})]})}),e.jsx(ge,{open:O,onClose:()=>q(!1),mode:H,identity:n,repeaterConfig:null==g?void 0:g.config,onCreate:k,onUpdate:w,onDelete:C,onSendAdvert:$})]})}):e.jsx(je,{children:e.jsxs(r,{children:[e.jsx(o,{title:"Room Server",icon:e.jsx(x,{})}),e.jsx(pe,{onCreateRoom:e=>G(e)}),e.jsx(ge,{open:O,onClose:()=>q(!1),mode:"create",repeaterConfig:null==g?void 0:g.config,onCreate:async e=>{const s=await k(e);return s&&"dedicated"===B&&(await P.getState().setMode("monitor"),P.getState().clearModeMutation()),s},onUpdate:w,onDelete:C,onSendAdvert:$})]})})}export{Ae as default}; +import{j as e,W as s,c as t,Z as a,M as n,r as l}from"./vendor-react-j_fHog8x.js";import{a as i,P as r,b as o,B as d}from"./PageLayout-CYYy29Pg.js";import{R as c,C as m}from"./Grid-OFJ4oe0a.js";import{c as u,bb as x,R as p,W as h,bR as g,X as y,j as v,I as j,cQ as f,B as N,ap as b,Y as k,bk as w,o as C,cR as S,cS as _,cT as M,cU as R,cV as T,cW as A,cX as D,cY as E,cZ as L,t as F,cL as I,aH as P}from"./index-BBcIGlRT.js";import{L as $,a as z,b as K}from"./listbox-BsuBKhOY.js";import{P as O,T as q,C as H}from"./ConfirmModal-CX0HrTOx.js";import{M as U}from"./map-pin-FZNiPp_L.js";import{S as B,K as V,r as W}from"./KeycapButton-Dvk7y-ZW.js";import{S as G,C as X,M as Y}from"./ChatBubble-DX1ocHRQ.js";import{C as J}from"./Card-QO4sXDu0.js";import{e as Q,g as Z,a as ee}from"./chat-utils-I8bC4Iy5.js";import{W as se}from"./wifi-BGoUD8Dj.js";import{K as te}from"./key-round-0eVrrV09.js";import{C as ae}from"./copy-C_IB0gEd.js";import{U as ne}from"./users-DuzW_tmB.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CmkNwW1A.js";import"./triangle-alert-DH80WgOo.js";import"./keycap-sfx-CAsrNe23.js";const le=u("message-circle",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]),ie=u("message-square-plus",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]]),re=u("repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]),oe=u("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),de=u("user-x",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);function ce({disabled:a,className:n,children:l}){return e.jsx(s,{disabled:a,className:t("flex flex-col gap-2",n),children:l})}function me({required:s,className:n,children:l,...i}){return e.jsxs(a,{className:t("text-sm font-medium text-fg-primary select-none","data-[disabled]:opacity-50",i.title&&"cursor-help",n),...i,children:[l,s&&e.jsx("span",{className:"text-sys-red ml-0.5","aria-hidden":"true",children:"*"})]})}function ue({className:s,children:a,...l}){return e.jsx(n,{className:t("text-sm text-fg-muted","data-[disabled]:opacity-50",s),...l,children:a})}function xe({icon:s,title:a,description:n,onClick:l,accent:i}){return e.jsxs("button",{onClick:l,className:t("flex flex-col items-center gap-3 p-6 rounded-2xl text-center","ring-1 ring-edge-subtle hover:ring-2 transition-all duration-150","w-full max-w-[260px]","primary"===i?"hover:ring-sys-blue hover:bg-sys-blue/5":"hover:ring-sys-indigo hover:bg-sys-indigo/5"),children:[e.jsx("div",{className:t("p-3 rounded-xl","primary"===i?"bg-sys-blue/10 text-sys-blue":"bg-sys-indigo/10 text-sys-indigo"),children:s}),e.jsx("p",{className:"type-body-sm font-medium text-fg-primary",children:a}),e.jsx("p",{className:"type-data-xs text-fg-muted leading-relaxed",children:n})]})}function pe({onCreateRoom:s}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4",children:[e.jsx(x,{className:"w-12 h-12 text-fg-muted opacity-30 mb-4"}),e.jsx("p",{className:"type-subheading text-fg-secondary mb-1",children:"Add a Room Server"}),e.jsx("p",{className:"type-body-sm text-fg-muted mb-8",children:"Choose how this device should operate."}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[e.jsx(xe,{icon:e.jsx(re,{className:"w-6 h-6"}),title:"Repeater + Room Server",description:"Keep forwarding packets and add group messaging.",onClick:()=>s("hybrid"),accent:"primary"}),e.jsx(xe,{icon:e.jsx(p,{className:"w-6 h-6"}),title:"Dedicated Room Server",description:"Stop repeating. Focus entirely on room server duties.",onClick:()=>s("dedicated"),accent:"secondary"})]})]})}function he({rooms:s,selected:a,onSelect:n,onAdd:l}){const i=l?e.jsx("button",{onClick:l,className:t("flex items-center justify-center px-2 py-1 rounded-md","text-fg-muted hover:text-fg-primary hover:bg-surface/60","transition-all duration-150"),title:"Add room server",children:e.jsx(O,{className:"w-4 h-4"})}):null;return s.length<=1?i:s.length<=3?e.jsxs("div",{className:"flex items-center gap-0.5 p-0.5 rounded-lg bg-subtle-fill",children:[s.map(s=>e.jsx("button",{onClick:()=>n(s.room_name),className:t("px-3 py-1 rounded-md text-sm font-medium transition-all duration-150",s.room_name===a?"bg-surface text-fg-primary shadow-sm":"text-fg-muted hover:text-fg-secondary"),children:s.room_name},s.room_name)),i]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx($,{value:a??"",onChange:n,children:s.map(s=>e.jsx(z,{value:s.room_name,children:e.jsx(K,{children:s.room_name})},s.room_name))}),i]})}function ge({open:s,onClose:t,mode:a,identity:n,repeaterConfig:i,onCreate:r,onUpdate:o,onDelete:d,onSendAdvert:c}){var m,u,x,p,k,w,C,S,_;const M="edit"===a&&n,R=`${s}-${(null==n?void 0:n.name)??""}-${a}`,[T,A]=l.useState(""),[D,E]=l.useState(""),[L,F]=l.useState(!1),[I,P]=l.useState(""),[$,z]=l.useState(""),[K,O]=l.useState(""),[H,B]=l.useState(""),[V,W]=l.useState(!1),[G,X]=l.useState(!1),[Y,J]=l.useState(!1),[Q,Z]=l.useState(null),[ee,se]=l.useState(R);if(R!==ee)if(se(R),Z(null),W(!1),X(!1),J(!1),M)A((null==(m=n.settings)?void 0:m.node_name)??n.name),E(n.identity_key??""),F(!1),P((null==(u=n.settings)?void 0:u.admin_password)??""),z((null==(x=n.settings)?void 0:x.guest_password)??""),O((null==(k=null==(p=n.settings)?void 0:p.latitude)?void 0:k.toString())??""),B((null==(C=null==(w=n.settings)?void 0:w.longitude)?void 0:C.toString())??"");else{const e=i;A(""),E(""),F(!1),P(""),z(""),O(null!=(null==(S=null==e?void 0:e.repeater)?void 0:S.latitude)?e.repeater.latitude.toString():""),B(null!=(null==(_=null==e?void 0:e.repeater)?void 0:_.longitude)?e.repeater.longitude.toString():"")}const te=l.useCallback(()=>{const e={};return T&&(e.node_name=T),I&&(e.admin_password=I),$&&(e.guest_password=$),""!==K&&(e.latitude=parseFloat(K)),""!==H&&(e.longitude=parseFloat(H)),e},[T,I,$,K,H]),ae=l.useCallback(async()=>{if(!T.trim())return void Z("Room name is required");W(!0),Z(null);const e=M?n.name:function(e){if(!e)return"";const s=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return s?`${s}-room`:""}(T);let s;if(M)s=await o({name:n.name,settings:te()});else{const t={name:e,type:"room_server",settings:te()};D.trim()&&(t.identity_key=D.trim()),s=await r(t)}W(!1),s?t():Z("Failed to save. Check that the name is unique and passwords differ.")},[T,M,n,te,r,o,t]),ne=l.useCallback(async()=>{if(!M)return;X(!0);const e=await d(n.name);X(!1),e&&t()},[M,n,d,t]),le=l.useCallback(async()=>{M&&(J(!0),await c(n.name),J(!1))},[M,n,c]);return e.jsxs(h,{open:s,onClose:t,size:"md",children:[e.jsx(g,{icon:M?void 0:e.jsx(ie,{className:"w-5 h-5"}),title:M?"Edit Room Server":"Add Room Server",onClose:t}),e.jsx(y,{children:e.jsxs("div",{className:"space-y-5",children:[M&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(v,{color:n.registered?"green":"red",children:n.registered?"Active":"Inactive"}),n.identity_key&&e.jsxs("span",{className:"type-data-xs text-fg-muted truncate",title:n.identity_key,children:["Key: ",n.identity_key.slice(0,16),"…"]})]}),e.jsxs(ce,{children:[e.jsx(me,{title:"What people see on the mesh",children:"Room Name"}),e.jsx(j,{value:T,onChange:e=>A(e.target.value),placeholder:"Room Name"})]}),!M&&e.jsxs(ce,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(me,{title:"The unique hex public ID",children:["Identity Key ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx("button",{type:"button",onClick:()=>F(e=>!e),className:"type-data-xs text-fg-muted underline hover:text-fg-secondary",children:L?"Hide":"Show"})]}),L&&e.jsxs(e.Fragment,{children:[e.jsx(j,{value:D,onChange:e=>E(e.target.value),placeholder:"Leave empty to auto-generate"}),e.jsx(ue,{children:"Leave empty to automatically generate a secure key"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(ce,{children:[e.jsxs(me,{children:[e.jsx(U,{className:"inline w-3.5 h-3.5 -mt-0.5 mr-1 text-fg-muted"}),"Latitude"]}),e.jsx(j,{type:"number",step:"any",value:K,onChange:e=>O(e.target.value),placeholder:"0"})]}),e.jsxs(ce,{children:[e.jsxs(me,{children:[e.jsx(U,{className:"inline w-3.5 h-3.5 -mt-0.5 mr-1 text-fg-muted"}),"Longitude"]}),e.jsx(j,{type:"number",step:"any",value:H,onChange:e=>B(e.target.value),placeholder:"0"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(ce,{children:[e.jsxs(me,{title:"Full access to room server",children:["Admin Password ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx(j,{type:"password",value:I,onChange:e=>P(e.target.value),placeholder:"None Set"})]}),e.jsxs(ce,{children:[e.jsxs(me,{title:"Can post and read, but not administer the room",children:["Guest Password ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx(j,{type:"password",value:$,onChange:e=>z(e.target.value),placeholder:"None Set"})]})]}),Q&&e.jsx("p",{className:"type-data-xs text-sys-red",children:Q})]})}),e.jsxs(f,{children:[M&&e.jsxs("div",{className:"flex items-center gap-2 mr-auto",children:[e.jsxs(N,{color:"danger",plain:!0,onClick:ne,disabled:G,children:[e.jsx(q,{"data-slot":"icon"}),G?"Deleting…":"Delete"]}),e.jsxs(N,{color:"primary",plain:!0,onClick:le,disabled:Y,children:[e.jsx(b,{"data-slot":"icon"}),Y?"Sending…":"Send Advert"]})]}),e.jsx(N,{plain:!0,onClick:t,children:"Cancel"}),e.jsx(N,{color:"primary",onClick:ae,disabled:V,children:V?"Saving…":M?"Save Changes":"Create"})]})]})}const ye=l.createContext(null),ve="room-tui";function je({children:s}){const[t,a]=l.useState(()=>"0"!==localStorage.getItem(ve)),n=l.useCallback(()=>{a(e=>{const s=!e;return localStorage.setItem(ve,s?"1":"0"),s})},[]);return e.jsx(ye.Provider,{value:{terminalMode:t,toggleTerminalMode:n},children:s})}function fe(){const e=l.useContext(ye);if(!e)throw new Error("useTerminalMode must be used within RoomTerminalProvider");return e}const Ne=e=>"server"===e.author_pubkey||"system"===e.author_pubkey;function be({messages:s,onDelete:t,terminalMode:a,serverName:n}){const i=l.useRef(null),[r,o]=l.useState(!1),d=l.useMemo(()=>[...s].sort((e,s)=>e.post_timestamp-s.post_timestamp),[s]);l.useEffect(()=>{!r&&i.current&&(i.current.scrollTop=0)},[d.length,r]);const c=l.useCallback(()=>{i.current&&o(i.current.scrollTop<-100)},[]),m=l.useCallback(()=>{i.current&&i.current.scrollTo({top:0,behavior:"smooth"}),o(!1)},[]);return 0===d.length?e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center py-12 min-h-0"+(a?" font-mono":""),children:a?e.jsx("p",{className:"text-sm font-mono",style:{color:"var(--tui-accent)",opacity:.4},children:"> no messages in buffer_"}):e.jsxs(e.Fragment,{children:[e.jsx(x,{className:"w-10 h-10 text-fg-muted opacity-20 mb-2"}),e.jsx("p",{className:"type-data-sm text-fg-muted",children:"No messages yet"})]})}):a?e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:i,onScroll:c,className:"h-full overflow-y-auto scroll-smooth p-4 font-mono text-sm leading-relaxed flex flex-col-reverse",children:e.jsx("div",{children:d.map(s=>{const a=Ne(s),l=new Date(1e3*s.post_timestamp).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),i=a?"SYS":s.author_name||s.author_prefix,r=!a&&n&&i===n;return e.jsxs("div",{className:"group flex items-start gap-0 -mx-4 px-4 py-px",style:{"--tw-hover-bg":"var(--tui-hover-bg)"},onMouseEnter:e=>e.currentTarget.style.background="var(--tui-hover-bg)",onMouseLeave:e=>e.currentTarget.style.background="",children:[e.jsxs("span",{className:"select-none shrink-0",style:{color:"var(--tui-muted)"},children:["[",l,"]"]}),e.jsxs("span",{className:"mx-1.5 shrink-0",style:{color:r?"var(--tui-accent-local)":"var(--tui-accent)"},children:["<",i,">"]}),e.jsx("span",{style:{color:a?"var(--tui-system)":r?"var(--tui-body)":"var(--tui-accent)"},className:a?"italic":"",children:s.message_text}),e.jsx("button",{onClick:()=>t(s.id),className:"opacity-0 group-hover:opacity-100 ml-auto pl-2 shrink-0 transition-colors",style:{color:"var(--tui-muted)"},onMouseEnter:e=>e.currentTarget.style.color="var(--tui-danger)",onMouseLeave:e=>e.currentTarget.style.color="var(--tui-muted)",title:"Delete",children:"×"})]},s.id)})})}),r&&e.jsxs("button",{onClick:m,className:"absolute bottom-3 left-1/2 -translate-x-1/2 flex items-center gap-1.5 px-3 py-1 font-mono text-xs transition-colors duration-150",style:{background:"var(--tui-hover-bg)",border:"1px solid var(--tui-muted)",color:"var(--tui-accent)"},children:[e.jsx(k,{className:"w-3 h-3"}),"↓ scroll"]})]}):e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:i,onScroll:c,className:"h-full overflow-y-auto scroll-smooth flex flex-col-reverse",children:e.jsx("div",{className:"space-y-3 p-4",children:d.map(s=>Ne(s)?e.jsx(G,{text:s.message_text},s.id):e.jsx(X,{senderName:s.author_name||s.author_prefix,text:s.message_text,timestamp:s.post_timestamp,bubbleAccessory:e.jsx("button",{onClick:()=>t(s.id),className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150 p-1 text-fg-muted hover:text-sys-red flex-shrink-0",title:"Delete message",children:e.jsx(q,{className:"w-3.5 h-3.5"})})},s.id))})}),r&&e.jsxs("button",{onClick:m,className:"absolute bottom-3 left-1/2 -translate-x-1/2 flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-surface/90 backdrop-blur-sm ring-1 ring-edge-subtle shadow-md text-fg-secondary hover:text-fg-primary transition-colors duration-150",children:[e.jsx(k,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs",children:"New messages"})]})]})}function ke({roomName:s,onSend:t,disabled:a,terminalMode:n}){const[i,r]=l.useState(""),[o,d]=l.useState(!1),c=l.useRef(null),m=l.useCallback(async()=>{var e;const s=i.trim();if(!s||o)return;d(!0);const a=await t(s);d(!1),a&&(r(""),null==(e=c.current)||e.focus())},[i,o,t]),u=l.useCallback(e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),m())},[m]);return n?e.jsxs("div",{className:"flex items-center gap-0 px-4 py-2 type-data-sm",children:[e.jsx("input",{ref:c,type:"text",value:i,onChange:e=>r(e.target.value),onKeyDown:u,placeholder:"type message...",disabled:a||o,className:"flex-1 bg-transparent outline-none ring-0 shadow-none border-none focus:outline-none focus:ring-0 font-mono tui-input",style:{color:"var(--tui-body)"}}),e.jsx("button",{onClick:m,disabled:!i.trim()||o||a,className:"transition-colors duration-100 px-1 font-mono text-xs disabled:opacity-30",style:{color:"var(--tui-accent)"},title:"Send",children:"[↵]"})]}):e.jsxs("div",{className:"flex items-center gap-2 p-3 border-t border-edge-subtle",children:[e.jsx("input",{ref:c,type:"text",value:i,onChange:e=>r(e.target.value),onKeyDown:u,placeholder:`Message ${s}…`,disabled:a||o,className:"flex-1 surface-input radius-inner px-3 py-2 type-body-sm text-fg-primary placeholder:text-fg-muted outline-none ring-focus"}),e.jsx("button",{onClick:m,disabled:!i.trim()||o||a,className:"p-2 rounded-lg text-sys-blue hover:bg-sys-blue/10 disabled:opacity-30 disabled:hover:bg-transparent transition-colors duration-150",title:"Send message",children:e.jsx(b,{className:"w-4.5 h-4.5"})})]})}function we({selectedName:s,selectedIdentity:t,messages:a,onSend:n,onDelete:r,onClear:o}){var d;const{terminalMode:c,toggleTerminalMode:m}=fe(),[u,x]=l.useState(!1),p=(null==(d=null==t?void 0:t.settings)?void 0:d.node_name)??s??void 0,h=l.useCallback(()=>{x(!1),o()},[o]);return c?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col h-full gap-1.5",children:[e.jsxs("div",{className:"card-terminal-header flex-shrink-0",children:[e.jsx("span",{className:"seven-seg-panel",children:e.jsx(B,{text:"chat",minChars:7,size:24})}),e.jsx("div",{className:"card-terminal-ridge flex-1"}),e.jsxs("div",{className:"header-well",children:[e.jsx(V,{icon:e.jsx(oe,{className:"!w-5.5 !h-5.5 translate-y-px"}),onClick:m,title:"Exit terminal mode"}),a.length>0&&e.jsx(V,{icon:e.jsx("span",{className:"text-[13px] font-bold font-mono leading-none translate-y-px",children:"DEL"}),onClick:()=>x(!0),title:"Clear all messages",variant:"red",iconActiveColor:w.red})]})]}),e.jsx(i,{noPadding:!0,className:"flex flex-col flex-1 min-h-0 overflow-hidden card-terminal",children:e.jsxs("div",{className:"card-terminal-well flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsx(be,{messages:a,onDelete:r,terminalMode:!0,serverName:p}),e.jsx("div",{className:"card-terminal-divider"}),s&&e.jsx(ke,{roomName:s,onSend:n,disabled:!(null==t?void 0:t.registered),terminalMode:!0})]})})]}),e.jsx(H,{isOpen:u,title:"Clear All Messages",message:`This will permanently delete all ${a.length} message${1===a.length?"":"s"} from this room. This cannot be undone.`,confirmLabel:"Clear Messages",variant:"danger",onConfirm:h,onCancel:()=>x(!1)})]}):e.jsxs(e.Fragment,{children:[e.jsxs(i,{noPadding:!0,className:"flex flex-col h-full overflow-hidden",children:[e.jsx(J,{listHeader:!0,icon:e.jsx(le,{className:"icon-sm"}),title:"Messages",actions:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(N,{plain:!0,onClick:m,title:"Terminal mode",children:e.jsx(oe,{"data-slot":"icon",className:"!w-5 !h-5 translate-y-px"})}),a.length>0&&e.jsx(N,{plain:!0,onClick:()=>x(!0),title:"Clear all messages",children:e.jsx("span",{"data-slot":"icon",className:"text-[12px] font-bold font-mono leading-none translate-y-px text-sys-red",children:"DEL"})})]})}),e.jsx(be,{messages:a,onDelete:r,terminalMode:!1,serverName:p}),s&&e.jsx(ke,{roomName:s,onSend:n,disabled:!(null==t?void 0:t.registered),terminalMode:!1})]}),e.jsx(H,{isOpen:u,title:"Clear All Messages",message:`This will permanently delete all ${a.length} message${1===a.length?"":"s"} from this room. This cannot be undone.`,confirmLabel:"Clear Messages",variant:"danger",onConfirm:h,onCancel:()=>x(!1)})]})}function Ce({pubkey:s,className:t}){const[a,n]=l.useState(!1),i=l.useCallback(()=>{navigator.clipboard.writeText(s),n(!0),setTimeout(()=>n(!1),1500)},[s]);return e.jsxs("button",{onClick:i,title:a?"Copied!":"Copy public key",className:`inline-flex items-center gap-1 type-data-xs leading-tight text-fg-muted hover:text-fg-secondary transition-colors duration-150 cursor-copy ${t??""}`,children:[e.jsx("span",{className:"truncate min-w-0",children:s.slice(0,8)}),a&&e.jsx(C,{className:"w-2.5 h-2.5 text-sys-green flex-shrink-0"})]})}const Se=l.memo(function({client:s,resolvedName:a,onRemove:n}){const l=s.name||a,i=0===s.unsynced_count,r=s.last_activity?new Date(1e3*s.last_activity).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"Never",{emoji:o,cleanName:d}=l?Q(l):{emoji:null,cleanName:s.pubkey_prefix},c=l?Z(d):void 0,m=l?ee(l):s.pubkey_prefix.slice(0,2).toUpperCase();return e.jsxs("div",{className:"group flex items-center gap-3 px-3 py-2.5 radius-inner row-hover transition-base",children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx("div",{className:t("w-8 h-8 rounded-full flex items-center justify-center",!c&&"bg-sys-blue/12"),style:c?{backgroundColor:c}:void 0,children:o?e.jsx("span",{className:"text-base leading-none",children:o}):e.jsx("span",{className:t("leading-none",c?"text-white text-[11px] font-bold tracking-tight":"text-sys-blue font-mono text-[11px]"),children:m})}),e.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-sm ring-2 ring-surface "+(i?"bg-sys-green":"bg-sys-indigo")})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[l?e.jsx("p",{className:"text-[13px] font-medium leading-tight text-fg-primary truncate",children:l}):e.jsx("p",{className:"font-mono text-[13px] leading-tight text-fg-primary truncate",children:s.pubkey_prefix}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[l&&e.jsx(Ce,{pubkey:s.pubkey}),l&&e.jsx("span",{className:"text-xs text-fg-muted/40",children:"·"}),e.jsxs("span",{className:"text-xs leading-tight text-fg-muted truncate",children:[!i&&e.jsxs("span",{className:"text-sys-indigo",children:[s.unsynced_count," unsynced · "]}),r]})]})]}),e.jsx("button",{onClick:()=>n(s.pubkey),className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150 p-1.5 -mr-1 rounded-md text-fg-muted hover:text-sys-red hover:bg-sys-red/8",title:"Remove client",children:e.jsx(de,{className:"w-3.5 h-3.5"})})]})});function _e({clients:s,onRemove:t,messages:a,terminalMode:n}){const i=l.useMemo(()=>{const e=new Map;if(!a)return e;for(let s=a.length-1;s>=0;s--){const t=a[s];t.author_name&&t.author_pubkey&&"server"!==t.author_pubkey&&"system"!==t.author_pubkey&&e.set(t.author_pubkey,t.author_name)}return e},[a]);return 0===s.length?n?e.jsx("p",{className:"type-data-sm text-left px-4 py-4",style:{color:"var(--tui-accent)"},children:"< NO CLIENTS CONNECTED >"}):e.jsx("p",{className:"type-data-xs text-fg-muted text-center py-4",children:"No clients connected"}):n?e.jsx("div",{className:"type-data-sm pt-2",children:s.map(s=>{const a=s.name||i.get(s.pubkey),n=0===s.unsynced_count,l=s.pubkey_prefix;return e.jsxs("div",{className:"group flex items-center gap-0 -mx-0 px-4 py-0.5",onMouseEnter:e=>e.currentTarget.style.background="var(--tui-hover-bg)",onMouseLeave:e=>e.currentTarget.style.background="",children:[e.jsx("span",{style:{color:n?"var(--tui-accent)":"var(--tui-warn)"},children:"■"}),e.jsx("span",{className:"ml-2 shrink-0",style:{color:"var(--tui-accent)"},children:a||l}),a&&e.jsxs("span",{className:"ml-1.5 shrink-0",style:{color:"var(--tui-accent)"},children:["[",l,"]"]}),!n&&e.jsxs("span",{className:"ml-1.5",style:{color:"var(--tui-warn)"},children:[s.unsynced_count,"unsync"]}),e.jsx("button",{onClick:()=>t(s.pubkey),className:"opacity-0 group-hover:opacity-100 ml-auto pl-2 shrink-0 transition-colors",style:{color:"var(--tui-muted)"},onMouseEnter:e=>e.currentTarget.style.color="var(--tui-danger)",onMouseLeave:e=>e.currentTarget.style.color="var(--tui-muted)",title:"Remove",children:"×"})]},s.pubkey)})}):e.jsx("div",{className:"space-y-0.5 pt-1",children:s.map(s=>e.jsx(Se,{client:s,resolvedName:i.get(s.pubkey),onRemove:t},s.pubkey))})}function Me({name:s,onSend:t}){const{terminalMode:a}=fe(),[n,i]=l.useState("idle"),r=l.useRef(),o=l.useCallback(async()=>{if("sending"===n)return;i("sending");const e=await t(s);i(e?"sent":"idle"),e&&(r.current=setTimeout(()=>i("idle"),2e3))},[s,t,n]);return l.useEffect(()=>()=>clearTimeout(r.current),[]),a?e.jsxs("button",{className:"btn-terminal",onClick:o,disabled:"sending"===n,children:["idle"===n&&"[ send_advert ]","sending"===n&&"[ broadcasting... ]","sent"===n&&"[ sent ✓ ]"]}):e.jsxs(N,{color:"sent"===n?"success":"primary",className:"w-full",onClick:o,disabled:"sending"===n,children:[e.jsx(se,{"data-slot":"icon"}),"idle"===n&&"Send Advert","sending"===n&&"Broadcasting…","sent"===n&&"Advert Sent"]})}function Re({identity:s,onSendAdvert:t}){var a,n,i,r,o,d,c,m,u,x,p,h,g,y,j,f,N,b,k,w,S,_,M,R,T,A,D,E,L,F;const{terminalMode:I}=fe(),[P,$]=l.useState(!1),z=l.useCallback(()=>{(null==s?void 0:s.identity_key)&&(navigator.clipboard.writeText(s.identity_key),$(!0),setTimeout(()=>$(!1),1500))},[null==s?void 0:s.identity_key]);return I?s?e.jsxs("div",{className:"space-y-1",children:[(null==(a=s.settings)?void 0:a.node_name)&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"node"}),e.jsx("span",{style:{color:"var(--tui-accent)"},children:s.settings.node_name})]}),(s.address||(null==(n=s.runtime)?void 0:n.address))&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"addr"}),e.jsx("span",{style:{color:"var(--tui-accent)"},children:s.address||(null==(i=s.runtime)?void 0:i.address)})]}),s.identity_key&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"key"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"truncate max-w-[140px]",style:{color:"var(--tui-accent)"},title:s.identity_key,children:[s.identity_key.slice(0,16),"…"]}),e.jsx("button",{type:"button",onClick:z,className:"text-xs",style:{color:"var(--tui-muted)"},children:P?"[copied ✓]":"[copy]"})]})]}),(null!=(null==(r=s.settings)?void 0:r.latitude)||null!=(null==(o=s.settings)?void 0:o.longitude))&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"loc"}),e.jsxs("span",{style:{color:"var(--tui-accent)"},title:`${(null==(d=s.settings)?void 0:d.latitude)??"—"}, ${(null==(c=s.settings)?void 0:c.longitude)??"—"}`,children:[(null==(u=null==(m=s.settings)?void 0:m.latitude)?void 0:u.toFixed(4))??"—",", ",(null==(p=null==(x=s.settings)?void 0:x.longitude)?void 0:p.toFixed(4))??"—"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"pass"}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{style:{color:(null==(h=s.settings)?void 0:h.admin_password)?"var(--tui-accent)":"var(--tui-muted)"},children:(null==(g=s.settings)?void 0:g.admin_password)?"[✓ admin]":"[— admin]"}),e.jsx("span",{style:{color:(null==(y=s.settings)?void 0:y.guest_password)?"var(--tui-accent)":"var(--tui-muted)"},children:(null==(j=s.settings)?void 0:j.guest_password)?"[✓ guest]":"[— guest]"})]})]})]}):e.jsx("span",{style:{color:"var(--tui-muted)"},children:"no identity configured"}):e.jsxs("div",{className:"flex-shrink-0 border-t border-edge-subtle",children:[e.jsx(J,{listHeader:!0,icon:e.jsx(Y,{className:"icon-sm"}),title:"Room Info"}),s?e.jsxs("div",{className:"space-y-2 px-4 py-3",children:[(null==(f=s.settings)?void 0:f.node_name)&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-xs text-fg-muted",children:"Node"}),e.jsx("span",{className:"type-data-sm text-fg-primary",children:s.settings.node_name})]}),(s.address||(null==(N=s.runtime)?void 0:N.address))&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-xs text-fg-muted",children:"Address"}),e.jsx("span",{className:"type-data-sm font-mono text-fg-primary",children:s.address||(null==(b=s.runtime)?void 0:b.address)})]}),s.identity_key&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"type-data-xs text-fg-muted flex items-center gap-1",title:"The unique hex public ID",children:[e.jsx(te,{className:"w-3 h-3"}),"Key"]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"type-data-sm font-mono text-fg-primary truncate max-w-[140px]",title:s.identity_key,children:[s.identity_key.slice(0,16),"…"]}),e.jsx("button",{type:"button",onClick:z,className:"inline-flex items-center gap-0.5",children:e.jsx(v,{color:P?"green":"zinc",children:P?e.jsxs(e.Fragment,{children:[e.jsx(C,{className:"w-3 h-3"}),"Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"w-3 h-3"}),"Copy"]})})})]})]}),(null!=(null==(k=s.settings)?void 0:k.latitude)||null!=(null==(w=s.settings)?void 0:w.longitude))&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"type-data-xs text-fg-muted flex items-center gap-1",children:[e.jsx(U,{className:"w-3 h-3"}),"Location"]}),e.jsxs("span",{className:"type-data-sm font-mono text-fg-primary",title:`${(null==(S=s.settings)?void 0:S.latitude)??"—"}, ${(null==(_=s.settings)?void 0:_.longitude)??"—"}`,children:[(null==(R=null==(M=s.settings)?void 0:M.latitude)?void 0:R.toFixed(4))??"—",", ",(null==(A=null==(T=s.settings)?void 0:T.longitude)?void 0:A.toFixed(4))??"—"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-xs text-fg-muted",children:"Passwords"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs(v,{color:(null==(D=s.settings)?void 0:D.admin_password)?"green":"zinc",children:[(null==(E=s.settings)?void 0:E.admin_password)&&e.jsx(C,{className:"w-3 h-3"}),"Admin"]}),e.jsxs(v,{color:(null==(L=s.settings)?void 0:L.guest_password)?"green":"zinc",children:[(null==(F=s.settings)?void 0:F.guest_password)&&e.jsx(C,{className:"w-3 h-3"}),"Guest"]})]})]}),e.jsx("div",{className:"pt-3",children:e.jsx(Me,{name:s.name,onSend:t})})]}):e.jsx("p",{className:"type-data-xs text-fg-muted text-center py-3",children:"No identity configured"})]})}function Te({selectedIdentity:s,clients:t,messages:a,onSendAdvert:n}){const{terminalMode:r}=fe(),o=l.useCallback(async e=>{S.setState(s=>({clients:s.clients.filter(s=>s.pubkey!==e)})),await W({public_key:e})},[]);return r?e.jsxs("div",{className:"flex flex-col h-full gap-1.5",children:[s&&e.jsx("div",{className:"card-terminal-header flex-shrink-0",children:e.jsx("div",{className:"header-well flex-1",children:e.jsx(V,{icon:e.jsx(se,{}),onPress:()=>n(s.name),title:"Send room server advert",indicators:[{label:"ADVERTISE",trackPress:!0},{label:"ACTIVE",active:s.registered}]})})}),e.jsxs("div",{className:"flex flex-col flex-1 min-h-0 gap-1.5",children:[e.jsx("div",{className:"card-terminal-header flex-shrink-0",children:e.jsx("span",{className:"seven-seg-panel",children:e.jsx(B,{text:`OnLInE ${String(t.length).padStart(3,"0")}`,size:24})})}),e.jsx(i,{noPadding:!0,className:"!h-auto flex flex-col flex-1 min-h-0 overflow-hidden card-terminal",children:e.jsx("div",{className:"card-terminal-well flex-1 min-h-0 overflow-y-auto",children:e.jsx(_e,{clients:t,onRemove:o,messages:a,terminalMode:!0})})}),e.jsx("div",{className:"card-terminal-header flex-shrink-0",children:e.jsx("span",{className:"seven-seg-panel",children:e.jsx(B,{text:"StAtUS "+((null==s?void 0:s.registered)?"On":"OFF"),size:24})})}),e.jsx(i,{noPadding:!0,className:"!h-auto flex-shrink-0 overflow-hidden card-terminal",children:e.jsx("div",{className:"card-terminal-well px-4 py-3 type-data-sm",children:e.jsx(Re,{identity:s,onSendAdvert:n})})})]})]}):e.jsxs(i,{compact:!0,className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsx(J,{listHeader:!0,icon:e.jsx(ne,{className:"icon-sm"}),title:"Clients",actions:t.length>0?e.jsx("span",{className:"type-data-xs text-fg-muted",children:t.length}):void 0}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsx(_e,{clients:t,onRemove:o,messages:a,terminalMode:!1})}),e.jsx(Re,{identity:s,onSendAdvert:n})]})}function Ae(){const s=_(),t=M(),a=R(),n=T(),i=A(),u=D(),p=E(),h=L(),g=F(),{selectRoom:y,postMessage:j,deleteMessage:f,clearMessages:b,createRoom:k,updateRoom:w,deleteRoom:C,sendAdvert:$,markAsRead:z,startActivePolling:K}=S.getState(),[O,q]=l.useState(!1),[H,U]=l.useState("create"),[B,V]=l.useState("hybrid");l.useEffect(()=>{z()},[t,z]),l.useEffect(()=>K(),[K]);const W=l.useCallback(async e=>!!t&&j({room_name:t,message:e,author_pubkey:"server"}),[t,j]),G=l.useCallback((e="hybrid")=>{V(e),U("create"),q(!0)},[]),X=l.useCallback(()=>{U("edit"),q(!0)},[]),Y=a?e.jsxs("span",{className:"type-data-sm text-fg-muted",children:[a.total_messages," messages · ",a.total_clients," clients",n&&e.jsxs(e.Fragment,{children:[" · ",e.jsx(v,{color:n.registered?"green":"red",className:"ml-0.5",children:n.registered?"Active":"Inactive"})]})]}):void 0,J=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{rooms:s,selected:t,onSelect:y,onAdd:()=>G("hybrid")}),s.length>0&&e.jsx(N,{plain:!0,onClick:X,title:"Manage room server",children:e.jsx(I,{"data-slot":"icon"})})]});return 0!==s.length||0!==p.length||h?e.jsx(je,{children:e.jsxs(r,{children:[e.jsx(o,{title:"Room Server",icon:e.jsx(x,{}),subtitle:Y,controls:J}),e.jsx(d,{children:e.jsxs(c,{template:"hero-tall",className:"!h-[calc(100vh-11rem)] !min-h-[400px]",children:[e.jsx(m,{span:12,lg:8,className:"h-full",children:e.jsx(we,{selectedName:t,selectedIdentity:n,messages:i,onSend:W,onDelete:f,onClear:b})}),e.jsx(m,{span:12,lg:4,className:"h-full",children:e.jsx(Te,{selectedIdentity:n,clients:u,messages:i,onSendAdvert:$})})]})}),e.jsx(ge,{open:O,onClose:()=>q(!1),mode:H,identity:n,repeaterConfig:null==g?void 0:g.config,onCreate:k,onUpdate:w,onDelete:C,onSendAdvert:$})]})}):e.jsx(je,{children:e.jsxs(r,{children:[e.jsx(o,{title:"Room Server",icon:e.jsx(x,{})}),e.jsx(pe,{onCreateRoom:e=>G(e)}),e.jsx(ge,{open:O,onClose:()=>q(!1),mode:"create",repeaterConfig:null==g?void 0:g.config,onCreate:async e=>{const s=await k(e);return s&&"dedicated"===B&&(await P.getState().setMode("monitor"),P.getState().clearModeMutation()),s},onUpdate:w,onDelete:C,onSendAdvert:$})]})})}export{Ae as default}; diff --git a/frontend/dist/assets/SignalIndicator-CIKrVFY9.js b/frontend/dist/assets/SignalIndicator-BnBRvoqf.js similarity index 98% rename from frontend/dist/assets/SignalIndicator-CIKrVFY9.js rename to frontend/dist/assets/SignalIndicator-BnBRvoqf.js index 9572c3dd..3e889569 100644 --- a/frontend/dist/assets/SignalIndicator-CIKrVFY9.js +++ b/frontend/dist/assets/SignalIndicator-BnBRvoqf.js @@ -1 +1 @@ -import{c as e}from"./index-01Tx8g53.js";import{r as a,c as t,j as r}from"./vendor-react-j_fHog8x.js";import{s}from"./signal-scoring-CcBiRcks.js";const o=e("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),n=e("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),l=e("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),c=e("signal-high",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}]]),i=e("signal-low",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}]]),d=e("signal-medium",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}]]),p=e("signal-zero",[["path",{d:"M2 20h.01",key:"4haj6o"}]]),h=e("signal",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}],["path",{d:"M22 4v16",key:"sih9yq"}]]),x=e("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),u={excellent:"color(display-p3 0.00 1.00 0.00)",good:"color(display-p3 0.55 0.90 0.15)",fair:"color(display-p3 1.00 0.85 0.00)",weak:"color(display-p3 1.00 0.55 0.15)",poor:"color(display-p3 1.00 0.20 0.20)"},g={excellent:"#4ADE80",good:"#A3E635",fair:"#FACC15",weak:"#FB923C",poor:"#EF4444"};function f(e){return e>=-90?"excellent":e>=-100?"good":e>=-110?"fair":e>=-120?"weak":"poor"}function y(e,a,t=!0){return a?t?{backgroundColor:g[e],"--p3-color":u[e]}:{backgroundColor:"rgba(255, 255, 255, 0.25)"}:{backgroundColor:"rgba(255, 255, 255, 0.1)"}}function m(e,a=!0){return e&&a?"signal-bar-active":""}function k({rssi:e,className:a="w-4 h-4"}){const s=f(e),o=function(e){switch(e){case"excellent":return"text-signal-excellent";case"good":return"text-signal-good";case"fair":return"text-signal-fair";case"weak":return"text-signal-poor";case"poor":return"text-signal-critical";default:return"text-fg-muted"}}(s),n=t(o,a);switch(s){case"excellent":return r.jsx(h,{className:n});case"good":return r.jsx(c,{className:n});case"fair":return r.jsx(d,{className:n});case"weak":return r.jsx(i,{className:n});default:return r.jsx(p,{className:n})}}const j=a.memo(function({rssi:e,snr:a,compact:o=!1,showValues:n=!0,radioConfig:l,nfPenalty:c=0,validated:i=!0}){const d=void 0!==a?function(e,a,t,r=0){const o=s(a,e,t,r);return o?function(e){switch(e){case"excellent":return"excellent";case"good":return"good";case"fair":return"fair";case"poor":return"weak";case"critical":return"poor"}}(o.finalGrade):f(e)}(e,a,l,c):f(e),p={excellent:4,good:3,fair:2,weak:1,poor:0}[d];return o?r.jsxs("div",{className:"flex items-center gap-1.5",children:[n&&r.jsx("span",{className:t("type-data-xs w-[32px] text-left",i?"text-fg-secondary":"text-fg-muted"),children:e}),r.jsx("div",{className:"flex items-center gap-[2px] h-3 w-[14px]",children:Array.from({length:4}).map((e,a)=>r.jsx("div",{className:t("w-[3px] h-full rounded-[1px] transition-colors",m(ar.jsx("div",{className:t("w-[3px] h-full rounded-[1px] transition-colors",m(a0||t.length>0)}export{o as A,l as C,j as S,x as Z,h as a,n as b,k as c,w as g,v as i}; +import{c as e}from"./index-BBcIGlRT.js";import{r as a,c as t,j as r}from"./vendor-react-j_fHog8x.js";import{s}from"./signal-scoring-CcBiRcks.js";const o=e("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),n=e("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),l=e("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),c=e("signal-high",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}]]),i=e("signal-low",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}]]),d=e("signal-medium",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}]]),p=e("signal-zero",[["path",{d:"M2 20h.01",key:"4haj6o"}]]),h=e("signal",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}],["path",{d:"M22 4v16",key:"sih9yq"}]]),x=e("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),u={excellent:"color(display-p3 0.00 1.00 0.00)",good:"color(display-p3 0.55 0.90 0.15)",fair:"color(display-p3 1.00 0.85 0.00)",weak:"color(display-p3 1.00 0.55 0.15)",poor:"color(display-p3 1.00 0.20 0.20)"},g={excellent:"#4ADE80",good:"#A3E635",fair:"#FACC15",weak:"#FB923C",poor:"#EF4444"};function f(e){return e>=-90?"excellent":e>=-100?"good":e>=-110?"fair":e>=-120?"weak":"poor"}function y(e,a,t=!0){return a?t?{backgroundColor:g[e],"--p3-color":u[e]}:{backgroundColor:"rgba(255, 255, 255, 0.25)"}:{backgroundColor:"rgba(255, 255, 255, 0.1)"}}function m(e,a=!0){return e&&a?"signal-bar-active":""}function k({rssi:e,className:a="w-4 h-4"}){const s=f(e),o=function(e){switch(e){case"excellent":return"text-signal-excellent";case"good":return"text-signal-good";case"fair":return"text-signal-fair";case"weak":return"text-signal-poor";case"poor":return"text-signal-critical";default:return"text-fg-muted"}}(s),n=t(o,a);switch(s){case"excellent":return r.jsx(h,{className:n});case"good":return r.jsx(c,{className:n});case"fair":return r.jsx(d,{className:n});case"weak":return r.jsx(i,{className:n});default:return r.jsx(p,{className:n})}}const j=a.memo(function({rssi:e,snr:a,compact:o=!1,showValues:n=!0,radioConfig:l,nfPenalty:c=0,validated:i=!0}){const d=void 0!==a?function(e,a,t,r=0){const o=s(a,e,t,r);return o?function(e){switch(e){case"excellent":return"excellent";case"good":return"good";case"fair":return"fair";case"poor":return"weak";case"critical":return"poor"}}(o.finalGrade):f(e)}(e,a,l,c):f(e),p={excellent:4,good:3,fair:2,weak:1,poor:0}[d];return o?r.jsxs("div",{className:"flex items-center gap-1.5",children:[n&&r.jsx("span",{className:t("type-data-xs w-[32px] text-left",i?"text-fg-secondary":"text-fg-muted"),children:e}),r.jsx("div",{className:"flex items-center gap-[2px] h-3 w-[14px]",children:Array.from({length:4}).map((e,a)=>r.jsx("div",{className:t("w-[3px] h-full rounded-[1px] transition-colors",m(ar.jsx("div",{className:t("w-[3px] h-full rounded-[1px] transition-colors",m(a0||t.length>0)}export{o as A,l as C,j as S,x as Z,h as a,n as b,k as c,w as g,v as i}; diff --git a/frontend/dist/assets/Statistics-BaT7n0oZ.js b/frontend/dist/assets/Statistics-D9WTXlwy.js similarity index 98% rename from frontend/dist/assets/Statistics-BaT7n0oZ.js rename to frontend/dist/assets/Statistics-D9WTXlwy.js index 0ef02b7c..115b2761 100644 --- a/frontend/dist/assets/Statistics-BaT7n0oZ.js +++ b/frontend/dist/assets/Statistics-D9WTXlwy.js @@ -1 +1 @@ -import{r as e,j as t,c as s}from"./vendor-react-j_fHog8x.js";import{c as a,e as n,a3 as l,aQ as i,aR as r,aS as o,an as c,aT as d,j as m,aU as u,aV as h,u as x,aW as p,aX as f,aY as g,aZ as y,a_ as b,a$ as v,ar as j,b0 as N,b1 as w,b2 as k,aC as M,b3 as S,b4 as C,aD as T,b5 as A,R as L,a5 as F,t as P,y as E,x as R,p as _,aN as D,a0 as $,z,Q as H,b6 as B,E as q,b7 as I,az as O,G as W,a2 as G,b8 as X}from"./index-01Tx8g53.js";import{u as V}from"./usePolling-B1kG3uqm.js";import{L as Y}from"./layers-BNjfohkH.js";import{C as U,e as J}from"./easing-DMuAVfRm.js";import{E as K,A as Q,T as Z}from"./TimeRangeSelector-D9BP9uVt.js";import{a as ee,P as te,b as se,B as ae}from"./PageLayout-DrvMAhys.js";import{D as ne}from"./DataBox-Dpf5ZHgV.js";import{C as le,M as ie}from"./CollisionExplorerModal-CTPNNbNo.js";import{C as re,a as oe}from"./Card-Dr9pbVV5.js";import{H as ce,R as de}from"./route-D7UU7r6_.js";import{T as me}from"./triangle-alert-DI33YyZq.js";import{G as ue}from"./git-branch-Bz_gqcbv.js";import{L as he}from"./LightSparkline-BCL2qx0n.js";import{A as xe}from"./activity-DOuX3omM.js";import{c as pe,C as fe,m as ge,i as ye}from"./node-types-BT5BImck.js";import{F as be}from"./funnel-4zcnjEgH.js";import{M as ve}from"./message-square-B0UfZczh.js";import{S as je}from"./search-DGnzblbI.js";import{P as Ne,f as we}from"./payload-decoders-XckZ5vyB.js";import{R as ke,C as Me}from"./Grid-OFJ4oe0a.js";import{S as Se}from"./settings-2-CePlNpN3.js";import{N as Ce}from"./network-CCjpHq5M.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CmkNwW1A.js";import"./index-D932VMrD.js";import"./copy-B5OWhmpX.js";import"./BasemapLayer-BT1oL_wV.js";import"./map-pin-DZIYgupP.js";const Te=a("chart-line",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]),Ae=a("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),Le=a("grid-3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),Fe=a("grip",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]),Pe=a("id-card",[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]]),Ee=a("radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]),Re=a("sparkle",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}]]),_e=a("waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]),De={useAbsoluteThresholds:!0,baselinePercentile:6,spikePercentile:50,baselineDbm:-107,spikeDbm:-100,mergeGapSeconds:45,minSequenceLength:16,similarityToleranceDbm:5};function $e(e,t){if(0===e.length)return 0;const s=t/100*(e.length-1),a=Math.floor(s),n=Math.ceil(s);return a===n?e[a]:e[a]+(e[n]-e[a])*(s-a)}function ze(e){if(0===e.length)return{median:0,p90:0,p95:0,p99:0,max:0,min:0};const t=[...e].sort((e,t)=>e-t);return{median:$e(t,50),p90:$e(t,90),p95:$e(t,95),p99:$e(t,99),max:t[t.length-1],min:t[0]}}function He(e,t,s){const a=s-t;if(0===a)return"moderate";const n=(e-t)/a;return n>.66?"critical":n>.33?"severe":"moderate"}const Be=Object.entries(l).map(([e,t])=>{const s=parseInt(e,10);return{typeNum:s,key:`TYPE_${s}`,label:t}});function qe({sortedTypes:a,highlightedType:l,onTypeHover:i,aggregateShares:r,hoverData:o}){const c=e.useMemo(()=>{if(!o)return null;const e=new Map;for(const t of o.items)e.set(t.key,t.value);return e},[o]),d=null!==c,m=e.useMemo(()=>{const e=new Set(a.map(e=>e.key));return[...a.map(e=>({typeNum:e.typeNum,key:e.key,label:e.label})),...Be.filter(t=>!e.has(t.key))]},[a]);return t.jsxs("div",{className:"flex-shrink-0 pt-3 mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2 ml-9 mb-1.5 type-data-xs",children:[t.jsx("span",{className:"text-fg-muted",children:"Packet Types"}),d&&(null==o?void 0:o.timeLabel)&&t.jsx("span",{className:"text-sys-indigo tabular-nums",children:o.timeLabel})]}),t.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1 type-data-xs ml-9",onMouseLeave:()=>i(null),children:m.map(e=>{const a=n(e.typeNum),o=(null==c?void 0:c.get(e.key))??0,m=r.get(e.key)??0,u=d?o:m,h=u>1e-4,x=r.has(e.key),p=l===e.key,f=l&&!p||d&&o<=1e-4||!d&&!l&&!x;return t.jsxs("div",{className:s("flex items-center gap-1.5 transition-opacity cursor-pointer hover:opacity-80",f&&"opacity-30"),onMouseEnter:()=>i(e.key),children:[t.jsx("div",{className:"shrink-0 w-3 h-3 rounded-xs",style:{backgroundColor:a}}),t.jsx("span",{className:"text-fg-secondary whitespace-nowrap",children:e.label}),h&&t.jsxs("span",{className:s("tabular-nums",d?"text-fg-primary":"text-fg-muted"),children:[(100*u).toFixed(1),"%"]})]},e.key)})})]})}const Ie='ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace';function Oe(e,t,s,a,n){const l=e.reduce((e,t)=>e+t,0);if(l<=0||0===e.length)return[];const i=e.map((e,t)=>t).sort((t,s)=>e[s]-e[t]),r=i.map(t=>e[t]),o=new Array(e.length);return We(r,i,l,t,s,a,n,o),o}function We(e,t,s,a,n,l,i,r){if(0===e.length)return;if(1===e.length)return void(r[t[0]]={x:a,y:n,w:l,h:i,index:t[0]});const o=l*i/s,c=l>=i,d=c?i:l;let m=0,u=1/0,h=0;for(let b=0;bs?a/s:s/a,n>s?n/s:s/n);if(!(l<=u))break;u=l,h=b+1,m=t}const x=d>0?m*o/d:0;let p=0;for(let b=0;b0?e[b]/m:0)*d;r[t[b]]=c?{x:a,y:n+p,w:x,h:s,index:t[b]}:{x:a+p,y:n,w:s,h:x,index:t[b]},p+=s}const f=e.slice(h),g=t.slice(h),y=s-m;c?We(f,g,y,a+x,n,l-x,i,r):We(f,g,y,a,n+x,l,i-x,r)}function Ge(e,t,s,a,l,i){for(const r of t){const t=s[r.index];if(!t)continue;const o=2*i,c=r.x*i+o/2,d=r.y*i+o/2,m=r.w*i-o,u=r.h*i-o;if(m<=0||u<=0)continue;const h=n(t.typeNum),x=null!==l&&l!==r.index;e.save(),e.globalAlpha=x?.4:1;const p=3*i;e.beginPath(),e.moveTo(c+p,d),e.lineTo(c+m-p,d),e.quadraticCurveTo(c+m,d,c+m,d+p),e.lineTo(c+m,d+u-p),e.quadraticCurveTo(c+m,d+u,c+m-p,d+u),e.lineTo(c+p,d+u),e.quadraticCurveTo(c,d+u,c,d+u-p),e.lineTo(c,d+p),e.quadraticCurveTo(c,d,c+p,d),e.closePath(),e.fillStyle=h,e.fill(),e.strokeStyle="rgba(0,0,0,0.2)",e.lineWidth=1*i,e.stroke();const f=4*i,g=r.w>36&&r.h>20,y=r.w>36&&r.h>32;if(g){const s=11*i;if(y){const n=a>0?t.size/a*100:0;e.font=`500 ${8*i}px ${Ie}`,e.fillStyle="rgba(0,0,0,0.6)",e.textBaseline="alphabetic",e.textAlign="left",e.fillText(`${n.toFixed(1)}%`,c+f,d+u-f-s)}e.font=`600 ${9*i}px ${Ie}`,e.fillStyle="rgba(0,0,0,0.85)",e.textBaseline="alphabetic",e.textAlign="left",e.fillText(t.name,c+f,d+u-f)}e.restore()}}function Xe({data:e,total:s,color:a,position:n,containerWidth:l,isAirtime:i}){if(!e||!n)return null;const r=(e.value/s*100).toFixed(1),o=l-n.x<184?Math.max(8,n.x-160-8):n.x+16;return t.jsx("div",{className:"absolute z-50 pointer-events-none",style:{left:o,top:Math.max(8,n.y-60)},children:t.jsxs("div",{className:"bg-tooltip-bg border border-edge-subtle rounded-lg px-3 py-2 shadow-xl min-w-[140px]",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:a}}),t.jsx("span",{className:"type-data-sm font-semibold text-fg-primary",children:e.name})]}),t.jsxs("div",{className:"space-y-0.5 type-data-xs text-fg-muted",children:[t.jsxs("div",{className:"flex justify-between gap-4",children:[t.jsx("span",{children:i?"Airtime":"Count"}),t.jsx("span",{className:"text-fg-primary tabular-nums font-medium",children:i?Ve(e.value):e.value.toLocaleString()})]}),t.jsxs("div",{className:"flex justify-between gap-4",children:[t.jsx("span",{children:"Share"}),t.jsxs("span",{className:"text-fg-primary tabular-nums font-medium",children:[r,"%"]})]}),t.jsxs("div",{className:"flex justify-between gap-4",children:[t.jsx("span",{children:"Total"}),t.jsx("span",{className:"text-fg-primary tabular-nums font-medium",children:i?Ve(s):s.toLocaleString()})]})]})]})})}function Ve(e){return e>=6e4?`${(e/6e4).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`}function Ye({sortedTypes:s,aggregateShares:a,mode:l="share"}){var i,r,o;const[c,d]=e.useState(null),[m,u]=e.useState(null),[h,x]=e.useState(0),[p,f]=e.useState(null),g=e.useRef(null),y=e.useRef(null),b=e.useRef([]),v="airtime"===l,j=e.useMemo(()=>s.reduce((e,t)=>e+(v?t.totalAirtime:t.totalCount),0),[s,v]),N=e.useMemo(()=>s.map((e,t)=>({name:e.label,size:v?e.totalAirtime:e.totalCount,index:t,typeNum:e.typeNum,key:e.key})),[s,v]);e.useEffect(()=>{const e=y.current;if(!e)return;const t=e.parentElement;if(!t)return;const s=t.getBoundingClientRect(),a=s.width,n=s.height;if(a<=0||n<=0)return;const l=window.devicePixelRatio||1;e.width=Math.floor(a*l),e.height=Math.floor(n*l),e.style.width=`${a}px`,e.style.height=`${n}px`;const i=Oe(N.map(e=>e.size),0,0,a,n);b.current=i;const r=e.getContext("2d");r&&(r.clearRect(0,0,e.width,e.height),Ge(r,i,N,j,c,l))},[N,j,c]),e.useEffect(()=>{const e=g.current;if(!e)return;const t=new ResizeObserver(()=>{const t=y.current;if(!t)return;const s=e.getBoundingClientRect(),a=s.width,n=s.height;if(a<=0||n<=0)return;const l=window.devicePixelRatio||1;t.width=Math.floor(a*l),t.height=Math.floor(n*l),t.style.width=`${a}px`,t.style.height=`${n}px`;const i=Oe(N.map(e=>e.size),0,0,a,n);b.current=i;const r=t.getContext("2d");r&&(r.clearRect(0,0,t.width,t.height),Ge(r,i,N,j,c,l))});return t.observe(e),()=>t.disconnect()},[N,j]);const w=e.useCallback(e=>{const t=g.current;if(!t)return;const s=t.getBoundingClientRect(),a=e.clientX-s.left,n=e.clientY-s.top,l=function(e,t,s){for(const a of e)if(t>=a.x&&t<=a.x+a.w&&s>=a.y&&s<=a.y+a.h)return a.index;return null}(b.current,a,n);d(l),null!==l?(x(s.width),u({x:a,y:n})):u(null)},[]),k=e.useCallback(()=>{d(null),u(null)},[]),M=e.useCallback(e=>{if(f(e),e){const t=N.findIndex(t=>t.key===e);d(t>=0?t:null)}else d(null)},[N]),S=null!==c?{name:(null==(i=N[c])?void 0:i.name)??"",value:(null==(r=N[c])?void 0:r.size)??0}:null,C=null!==c?n(null==(o=N[c])?void 0:o.typeNum):"";return 0===s.length||0===j?t.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[t.jsx(Y,{className:"w-6 h-6 mr-2 opacity-50"}),t.jsx("span",{children:"No packet type data available"})]}):t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex-1 min-h-0 relative",ref:g,onMouseMove:w,onMouseLeave:k,children:[t.jsx("canvas",{ref:y,className:"absolute inset-0",style:{cursor:"default"}}),t.jsx(Xe,{data:S,total:j,color:C,position:m,containerWidth:h,isAirtime:v})]}),t.jsx("div",{style:{minHeight:80},children:t.jsx(qe,{sortedTypes:s,highlightedType:p,onTypeHover:M,aggregateShares:a})})]})}function Ue(e){return e>=1e9?`${(e/1e9).toFixed(1)} Gb`:e>=1e6?`${(e/1e6).toFixed(1)} Mb`:e>=1e3?`${(e/1e3).toFixed(1)} Kb`:`${e.toFixed(0)} B`}function Je({packets:s,mode:a,startTs:n,endTs:l,radioConfig:u,bucketCount:h,lockedYMax:x,legendMinH:p}){const f=e.useMemo(()=>i(),[]),g=f.blue,y=f.red,b=f.yellow,[v,j]=e.useState(null),{trendData:N,totals:w}=e.useMemo(()=>{if(0===s.length)return{trendData:[],totals:{rxBytes:0,txBytes:0,rxAirtime:0,txAirtime:0}};const e=l-n,t=Math.min(Math.ceil(e/300),h),i=e/t,c=[];let d=0,m=0,x=0,p=0;for(const a of s){const e=a.timestamp;if(e=l)continue;const t=r(a),s=o(a,{spreadingFactor:u.sf,bandwidthHz:u.bw,codingRate:u.cr,preambleLength:u.preamble}),i={timestamp:e,rxAirtime:0,txAirtime:0,rxBytes:0,txBytes:0};a.transmitted?(i.txAirtime=s,i.txBytes=t,m+=t,p+=s):(i.rxAirtime=s,i.rxBytes=t,d+=t,x+=s),c.push(i)}c.sort((e,t)=>e.timestamp-t.timestamp);const f=new Float64Array(c.length+1),g=new Float64Array(c.length+1),y=new Float64Array(c.length+1),b=new Float64Array(c.length+1),v=new Float64Array(c.length);for(let s=0;s{let t=0,s=v.length;for(;t>>1;v[a]0?t:null,tx:s>0?s:null})}else{const t=(f[r]-f[l])/w*100,s=(g[r]-g[l])/w*100;N.push({timestamp:e,rx:t>0?t:null,tx:s>0?s:null})}}const k=2/31;let M=null;return{trendData:N.map(e=>{const t=e.rx;return null!==t&&t>0&&(M=null===M?t:k*t+(1-k)*M),{...e,rxSmooth:null!==M&&M>0?M:null}}),totals:{rxBytes:d,txBytes:m,rxAirtime:x,txAirtime:p}}},[s,n,l,h,a,u]),k=e.useMemo(()=>{if(0===N.length)return"share"===a?100:10;let e=0;for(const s of N){const t=s.rx??0,a=s.tx??0;t>e&&(e=t),a>e&&(e=a)}const t=1.1*e;return"share"===a?t<=100?100:t<=500?100*Math.ceil(t/100):t<=1e3?200*Math.ceil(t/200):t<=5e3?500*Math.ceil(t/500):t<=1e4?1e3*Math.ceil(t/1e3):5e3*Math.ceil(t/5e3):Math.max(1,Math.ceil(t))},[N,a]),M=x??k,S=e.useMemo(()=>{if(null!==v&&N[v]){const e=N[v],t=e.rx??0,s=e.tx??0;return"share"===a?{rx:Ue(t),tx:Ue(s),total:Ue(t+s),isHovered:!0}:{rx:`${t.toFixed(2)}%`,tx:`${s.toFixed(2)}%`,total:`${(t+s).toFixed(2)}%`,isHovered:!0}}if("share"===a)return{rx:Ue(w.rxBytes),tx:Ue(w.txBytes),total:Ue(w.rxBytes+w.txBytes),isHovered:!1};{let e=0,t=0,s=0;for(const l of N)null===l.rx&&null===l.tx||(e+=l.rx??0,t+=l.tx??0,s++);const a=s>0?e/s:0,n=s>0?t/s:0;return{rx:`${a.toFixed(2)}%`,tx:`${n.toFixed(2)}%`,total:`${(a+n).toFixed(2)}%`,isHovered:!1}}},[v,N,w,a]),C=e.useMemo(()=>{const e=l-n,t=e/3600;return[0,.25,.5,.75,1].map(s=>{const a=new Date(1e3*(n+e*s)),l=a.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),i=a.toLocaleDateString([],{weekday:"short"});return{pct:s,label:t>24?`${i} ${l}`:l,mobileHidden:.25===s||.75===s}})},[n,l]),T=e.useCallback(e=>{j(e)},[]);return 0===N.length?t.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[t.jsx(Y,{className:"w-6 h-6 mr-2 opacity-50"}),t.jsx("span",{children:"No packet data available"})]}):t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex-1 min-h-0 relative",children:[t.jsx("div",{className:"absolute top-0 left-0 right-0 z-10 flex items-center text-fg-secondary",style:{height:20,paddingLeft:44,paddingRight:8},children:t.jsx("div",{className:"relative w-full h-full flex items-center",children:C.map((e,s)=>t.jsxs("div",{className:"absolute flex items-center gap-0.5 sm:gap-1 type-data-xs "+(e.mobileHidden?"hidden sm:flex":""),style:{left:100*e.pct+"%",transform:0===e.pct?"translateX(0)":1===e.pct?"translateX(-100%)":"translateX(-50%)"},children:[t.jsx(c,{className:"w-2.5 h-2.5 opacity-60 hidden sm:block"}),t.jsx("span",{className:"tabular-nums",children:e.label})]},s))})}),t.jsx("div",{className:"absolute inset-0 rounded-lg overflow-hidden",style:{paddingTop:20},children:t.jsx(d,{data:N,yAxisMode:"share"===a?"share":"airtime",yMax:M,onHover:T,startTs:n,endTs:l})})]}),t.jsxs("div",{className:"flex items-center justify-between mt-1.5 sm:mt-2",style:{minHeight:p},children:[t.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 type-data-xs pl-2 sm:pl-11",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("div",{className:"w-3 sm:w-4 h-0.5",style:{backgroundColor:g}}),t.jsx("span",{className:"text-fg-secondary",children:"RX"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("div",{className:"w-3 sm:w-4 h-0.5",style:{backgroundColor:y}}),t.jsx("span",{className:"text-fg-secondary",children:"TX"})]}),t.jsxs("div",{className:"hidden sm:flex items-center gap-1.5",children:[t.jsx("div",{className:"w-4 h-0.5",style:{backgroundColor:b}}),t.jsx("span",{className:"text-fg-secondary",children:"Avg"})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-4 sm:gap-8",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx("div",{className:"type-data-xl text-fg-primary",children:S.rx}),t.jsx(m,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"RX"})]}),t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx("div",{className:"type-data-xl text-fg-primary",children:S.tx}),t.jsx(m,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"TX"})]})]})]})]})}const Ke=u;function Qe({mode:s,packets:a,startTs:n,endTs:l,radioConfig:i,sortedTypes:c,aggregateShares:d,noiseFloorAnomalies:m,showNoiseFloorOverlay:u,overlayOpacity:x=.5,startLabel:p,endLabel:f,yAxisPad:g=28,lockedYMax:y,legendMinH:b}){const[v,j]=e.useState(null),[N,w]=e.useState(null),k=e.useMemo(()=>(l-n)/3600,[n,l]),M=e.useCallback(e=>{w(e)},[]),S=function(t,s,a,n,l){return e.useMemo(()=>{if(0===t.length||!l)return null;const e=t.filter(e=>e.timestamp>=s&&e.timestamp<=a);if(0===e.length)return null;const i=[],c=new Map;for(const t of e){const e=t.type??t.payload_type??-1,a=r(t);let d;if(d="airtime"===n?o(t,{spreadingFactor:l.sf,bandwidthHz:l.bw,codingRate:l.cr,preambleLength:l.preamble}):1,a<=0)continue;const m=Math.floor((t.timestamp-s)/300),u={timestamp:t.timestamp,airtimeMs:d,byteSize:a,packetType:e,bucketIndex:m};i.push(u),c.has(m)||c.set(m,[]),c.get(m).push(u)}if(0===i.length)return null;const d=[],m=[],u=[],h=new Map;if("share"===n)for(const[,t]of c)for(const e of t)h.set(e,e.byteSize);else for(const[,t]of c){const e=t.reduce((e,t)=>e+t.airtimeMs,0)/3e5*100;let s=0;for(const a of t)a.airtimeMs>s&&(s=a.airtimeMs);for(const a of t){const t=a.airtimeMs/s*e;h.set(a,t)}}for(const t of i){const e=h.get(t);void 0!==e&&(d.push(e),m.push(t.timestamp),u.push(t.packetType))}let x=m[0],p=m[0];for(let t=1;tp&&(p=m[t]);const f=p-x||1,g=[...d].sort((e,t)=>e-t),y=g[0],b=g[g.length-1],v=Math.floor(.05*g.length),j=Math.floor(.5*g.length),N=Math.min(Math.ceil(.95*g.length),g.length-1),w=g[v],k=g[j],M=g[N],S=new Map;for(const t of d){const e=Math.round(100*t)/100;S.set(e,(S.get(e)??0)+1)}const C=S.size,T=[...S.entries()].sort((e,t)=>t[1]-e[1]).slice(0,5).map(([e,t])=>({value:e,count:t,percent:t/d.length*100}));let A;if("share"===n)A=200;else{const e=5,t=Math.ceil(b/e)*e;A=t<=10?10:t+e}const L=new Float32Array(2*d.length),F=new Float32Array(d.length),P=new Uint8Array(d.length),E=new Float32Array(d.length);for(let t=0;t=0?u[t]:255,E[t]=m[t]}return{points:L,rawValues:F,packetTypes:P,timestamps:E,count:d.length,minTime:x,maxTime:p,minValue:0,maxValue:A,rawMinValue:y,rawMaxValue:b,unit:"%",stats:{p5:w,p50:k,p95:M,uniqueValues:C,topValues:T}}},[t,s,a,n,l])}(a,n,l,"share"===s?"share":"airtime",i),[C,T]=e.useState(null),A=e.useCallback((e,t)=>{j(e),T(t??null)},[]),L=e.useMemo(()=>{if(null===C||!S||0===S.count)return null;const e=S.maxTime-S.minTime||1,t=S.minTime+C*e;let s;s=k>=168?75:k>=72?35:k>=24?15:k>=3?10:5;const a=60*s/2;return{start:t-a,end:t+a}},[C,S,k]),F=e.useMemo(()=>L?new Date((L.start+L.end)/2*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}):null,[L]),P=e.useMemo(()=>{if(null===v||!L)return null;const e=F??"",{start:t,end:n}=L,l=a.filter(e=>e.timestamp>=t&&e.timestamp({key:e.key,label:e.label,value:0,color:Ke(e.typeNum)}))};const r=new Map,d=new Map;let m=0,u=0;for(const s of l){const e=`TYPE_${s.type??s.payload_type??-1}`;if(r.set(e,(r.get(e)??0)+1),m++,i){const t=o(s,{spreadingFactor:i.sf,bandwidthHz:i.bw,codingRate:i.cr,preambleLength:i.preamble});d.set(e,(d.get(e)??0)+t),u+=t}}const h=c.map(e=>{let t;return t="airtime"===s?u>0?(d.get(e.key)??0)/u:0:m>0?(r.get(e.key)??0)/m:0,{key:e.key,label:e.label,value:t,color:Ke(e.typeNum)}});return{timestamp:(t+n)/2,timeLabel:e,items:h}},[v,L,F,a,c,s,i]);return S&&0!==S.count?t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex-1 min-h-0 relative",children:[t.jsx("div",{className:"absolute inset-0 rounded-lg overflow-hidden",children:t.jsx(h,{scatterData:S,yAxisMode:"share"===s?"share":"airtime",onHover:A,noiseFloorAnomalies:m,showNoiseFloorOverlay:u,overlayOpacity:x,highlightedType:N,timeRangeHours:k,yAxisMaxOverride:y})}),F&&t.jsx("div",{className:"absolute top-1 right-1 px-2 py-0.5 bg-elevated/90 rounded type-data-xs text-sys-indigo pointer-events-none",children:F}),p&&f&&t.jsxs("div",{className:"absolute bottom-0.5 left-0 right-0 flex justify-between pointer-events-none type-data-xs text-fg-muted/60",style:{paddingLeft:g},children:[t.jsx("span",{children:p}),t.jsx("span",{children:f})]})]}),t.jsx("div",{style:{minHeight:b},children:t.jsx(qe,{sortedTypes:c,highlightedType:N,onTypeHover:M,aggregateShares:d,hoverData:P})})]}):t.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[t.jsx(Y,{className:"w-6 h-6 mr-2 opacity-50"}),t.jsx("span",{children:"No packet data available"})]})}function Ze({mode:e,onChange:s}){return t.jsxs("div",{className:"toggle-group toggle-group-sm",children:[t.jsx("button",{onClick:()=>s("share"),className:"toggle-group-item "+("share"===e?"active":""),children:"Total"}),t.jsx("button",{onClick:()=>s("airtime"),className:"toggle-group-item "+("airtime"===e?"active":""),children:"Airtime"})]})}function et({smoothing:e,onChange:s}){return t.jsxs("div",{className:"toggle-group toggle-group-sm",children:[t.jsx("button",{onClick:()=>s("stats"),className:"toggle-group-item "+("stats"===e?"active":""),title:"Statistics view (scatter plot)",children:t.jsx(Fe,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>s("trend"),className:"toggle-group-item "+("trend"===e?"active":""),title:"Trend line chart",children:t.jsx(Te,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>s("ema"),className:"toggle-group-item "+("ema"===e?"active":""),title:"Stacked area (moderate smoothing)",children:t.jsx(Y,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>s("ultra"),className:"toggle-group-item "+("ultra"===e?"active":""),title:"Stacked area (heavy smoothing)",children:t.jsx(_e,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>s("mosaic"),className:"toggle-group-item "+("mosaic"===e?"active":""),title:"Mosaic view (treemap)",children:t.jsx(Le,{className:"w-3.5 h-3.5"})})]})}function tt({enabled:e,onChange:s,anomalyCount:a=0,showTuning:n=!1,onTuningChange:l}){return t.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[e&&l&&t.jsx("button",{onClick:()=>l(!n),className:"toggle-group toggle-group-sm "+(n?"active":""),title:n?"Hide tuning panel":"Show tuning panel",children:t.jsx("span",{className:"toggle-group-item "+(n?"active":""),children:t.jsx(Se,{className:"w-3.5 h-3.5"})})}),t.jsx("button",{onClick:()=>s(!e),className:"toggle-group toggle-group-sm "+(e?"active":""),title:e?"Hide noise floor anomalies":"Show noise floor anomalies",children:t.jsx("span",{className:"toggle-group-item "+(e?"active":""),children:t.jsx(K,{className:"w-3.5 h-3.5"})})}),a>0&&t.jsx("span",{className:"absolute -top-2 -right-2 min-w-[18px] h-[18px] px-1 rounded-full bg-sys-red text-white text-xs font-bold flex items-center justify-center pointer-events-none z-10",children:a>99?"99+":a})]})}const st={sf:10,bw:25e4,cr:5,preamble:8};function at(e,t){const s=new Date(1e3*e),a=e=>e.toString().padStart(2,"0"),n=`${a(s.getHours())}:${a(s.getMinutes())}`;return t<=24?n:`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][s.getMonth()]} ${s.getDate()} ${n}`}function nt(e){return l[e]??`TYPE_${e.toString(16).toUpperCase()}`}function lt(e,t,s,a){const n=2*a+1;let l=0;for(let i=0;i<=a;i++)l+=e[Math.min(i,s-1)];for(let i=0;i{const e=Math.abs(s.length-T.current);if(0===e&&M.length>0)return;C.current&&clearTimeout(C.current);const t=e>100?50:500;return C.current=setTimeout(()=>{T.current=s.length,S(s)},t),()=>{C.current&&clearTimeout(C.current)}},[s,M.length]);const A=e.useMemo(()=>function(e,t){const s=new Map;for(const n of e){const e=n.type??n.payload_type??-1,a=o(n,{spreadingFactor:t.sf,bandwidthHz:t.bw,codingRate:t.cr,preambleLength:t.preamble}),l=s.get(e)??{count:0,airtime:0};s.set(e,{count:l.count+1,airtime:l.airtime+a})}const a=[];for(const[n,l]of s)a.push({typeNum:n,key:`TYPE_${n}`,label:nt(n),totalCount:l.count,totalAirtime:l.airtime});return a.sort((e,t)=>t.totalCount-e.totalCount)}(M,u),[M,u]),L=e.useMemo(()=>{if("ema"!==f&&"ultra"!==f)return 0;const e=(i-l)/m,{handleSize:t}=ot(f,e,m);return t},[f,l,i,m]),F=e.useMemo(()=>function(e,t,s,a,n,l,i=0){const r=s-t,c=r/a,d=1e3*c,m=r/3600,u=t-i*c,h=s+i*c,x=a+2*i,p=[];for(let o=0;o24?t.toLocaleDateString([],{weekday:"short",hour:"2-digit",minute:"2-digit",hour12:!1}):t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),counts:{},shares:{},airtimes:{},total:0,totalAirtime:0,bucketDurationMs:d};for(const a of l)s.counts[a.key]=0,s.airtimes[a.key]=0;p.push(s)}for(const f of e){const e=f.timestamp;if(e=h)continue;const t=Math.min(Math.floor((e-u)/c),x-1),s=`TYPE_${f.type??f.payload_type??-1}`;p[t].counts[s]=(p[t].counts[s]??0)+1,p[t].total++;const a=o(f,{spreadingFactor:n.sf,bandwidthHz:n.bw,codingRate:n.cr,preambleLength:n.preamble});p[t].airtimes[s]=(p[t].airtimes[s]??0)+a,p[t].totalAirtime+=a}for(const o of p)for(const e of l)o.shares[e.key]=o.total>0?o.counts[e.key]/o.total*100:0;return{buckets:p,visibleStart:i,visibleEnd:i+a}}(M,l,i,m,u,A,L),[M,l,i,m,u,A,L]),P=e.useMemo(()=>A.reduce((e,t)=>e+t.totalCount,0),[A]),E=e.useMemo(()=>A.reduce((e,t)=>e+t.totalAirtime,0),[A]),{sortedTypes:R,aggregateShares:_}=e.useMemo(()=>{const e=new Map,t="share"===h?P:E;if(t>0)for(const s of A){const a="share"===h?s.totalCount:s.totalAirtime;e.set(s.key,a/t)}return{sortedTypes:[...A].sort((t,s)=>(e.get(s.key)??0)-(e.get(t.key)??0)),aggregateShares:e}},[A,P,E,h]),D=e.useMemo(()=>function(e,t,s,a="ultra",n,l,i){var r;const{buckets:o,visibleStart:c,visibleEnd:d}=e,m=o.length,u=s.length,h=d-c;if(0===m||0===u)return[];const x=i&&void 0!==n&&void 0!==l?(l-n)/i:(null==(r=o[0])?void 0:r.bucketDurationMs)?o[0].bucketDurationMs/1e3:240,p=Array.from({length:u},()=>new Array(m).fill(0));for(let N=0;N0)for(let t=0;t0)for(let a=0;a0?p.map(e=>function(e,t){const s=e.length;if(0===s)return[];if(t<.5)return[...e];const a=Math.sqrt(12*t*t/3+1);let n=Math.floor(a);n%2==0&&n--;const l=n+2,i=(12*t*t-3*n*n-12*n-9)/(-4*n-4),r=Math.round(i),o=[r>0?n:l,r>1?n:l,r>2?n:l];let c=new Float32Array(e);const d=new Float32Array(s);for(const m of o){lt(c,d,s,(m-1)/2);const e=c;c=d,d.set(e)}return Array.from(c)}(e,f)):p.map(e=>function(e,t){if(0===e.length)return[];if(t<=1)return[...e];const s=e.length,a=new Float32Array(s),n=Math.floor(t/2);let l=0,i=0;for(let r=0;r<=Math.min(n,s-1);r++)l+=e[r],i++;for(let r=0;r=0&&(l-=e[t],i--),o0){const t=1/e;for(let e=0;e360?Math.ceil(h/360):1,v=Math.ceil(h/b),j=[];for(let N=0;N0){const e=1/l;for(let t=0;tN(e),[]),z=e.useCallback(e=>k(e),[]),H=e.useCallback(e=>N(e),[]),B=e.useMemo(()=>{if(null===w||!D[w])return null;const e=D[w];return{timestamp:e.timestamp,timeLabel:e.time,items:R.map(t=>({key:t.key,label:t.label,value:e[t.key]??0,color:n(t.typeNum)}))}},[w,D,R]),q=e.useMemo(()=>({timestamps:D.map(e=>e.timestamp),series:R.map(e=>({key:e.key,label:e.label,color:n(e.typeNum),values:D.map(t=>t[e.key]??0)}))}),[D,R]),I=a&&void 0!==c&&void 0!==d&&(l!==c||i!==d),O=e.useMemo(()=>{if(I&&a&&void 0!==c&&void 0!==d)return function(e,t,s,a,n){const l=Math.max(1,Math.ceil((s-t)/300));if("airtime"===a){const a=new Float64Array(l);for(const r of e){const e=r.timestamp;e=s||(a[Math.min(Math.floor((e-t)/300),l-1)]+=o(r,{spreadingFactor:n.sf,bandwidthHz:n.bw,codingRate:n.cr,preambleLength:n.preamble}))}let i=0;for(let e=0;ei&&(i=t)}return Math.max(1,Math.ceil(1.1*i))}{let a=0;for(const n of e){const e=n.timestamp;if(e=s)continue;const l=r(n);l>a&&(a=l)}return a<=200?200:50*Math.ceil(1.1*a/50)}}(a,c,d,h,u)},[I,a,c,d,h,u]);if(0===M.length)return 0===s.length?t.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[t.jsx(Y,{className:"w-6 h-6 mr-2 opacity-50"}),t.jsx("span",{children:"No packet data available"})]}):null;if("mosaic"===f)return t.jsx(Ye,{sortedTypes:R,aggregateShares:_,mode:h});const W=(i-l)/3600,G=at(l,W),X=at(i,W);return"stats"===f?t.jsx(Qe,{mode:h,packets:M,startTs:l,endTs:i,radioConfig:u,sortedTypes:R,aggregateShares:_,noiseFloorAnomalies:g,showNoiseFloorOverlay:y,overlayOpacity:b,startLabel:G,endLabel:X,yAxisPad:28,lockedYMax:O,legendMinH:80}):"trend"===f?t.jsx(Je,{packets:M,mode:h,startTs:l,endTs:i,radioConfig:u,bucketCount:m,lockedYMax:O,legendMinH:80}):t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex-1 min-h-0 relative",children:[t.jsx("div",{className:"absolute inset-0 rounded-lg overflow-hidden",children:t.jsx(p,{timestamps:q.timestamps,series:q.series,highlightedKey:j,cursorColor:v.cursor,onHover:z,onSeriesHover:H,overlayLine:null,startTs:l,endTs:i})}),t.jsxs("div",{className:"absolute bottom-0.5 left-0 right-0 flex justify-between pointer-events-none type-data-xs text-fg-muted/60",style:{paddingLeft:32},children:[t.jsx("span",{children:G}),t.jsx("span",{children:X})]})]}),t.jsx("div",{style:{minHeight:80},children:t.jsx(qe,{sortedTypes:R,highlightedType:j,onTypeHover:$,aggregateShares:_,hoverData:B})})]})}),dt={"1x":1,"2x":2,"4x":4,"8x":8,"16x":16,"36x":36},mt=[1,5,10,25,50,100,150],ut=22.5*Math.PI/180,ht=Math.sin(ut),xt=Math.cos(ut);function pt(e,t,s,a){const n=Math.PI/180,l=(a-t)*n,i=e*n,r=s*n,o=Math.sin(l)*Math.cos(r),c=Math.cos(i)*Math.sin(r)-Math.sin(i)*Math.cos(r)*Math.cos(l);return(180*Math.atan2(o,c)/Math.PI+360)%360}function ft(e,t,s,a){const n=Math.PI/180,l=(s-e)*n,i=(a-t)*n,r=Math.sin(l/2)**2+Math.cos(e*n)*Math.cos(s*n)*Math.sin(i/2)**2;return 12742*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))}const gt=[{min:10,label:"Excellent"},{min:7,label:"Very Good"},{min:4,label:"Good"},{min:1,label:"Fair+"},{min:-2,label:"Fair"},{min:-5,label:"Fair-"},{min:-8,label:"Poor"},{min:-11,label:"Bad"},{min:-1/0,label:"Critical"}];function yt(e,t){return t[j(e)]||"#808080"}const bt=e.memo(function({neighbors:s,quickNeighbors:a,localLat:n,localLon:l,onStatsChange:r,title:o,badge:c,stats:d}){const[u,h]=e.useState(null),[x,p]=e.useState(new Set),[j,N]=e.useState({width:0,height:0}),[w,k]=e.useState("1x"),[M,S]=e.useState(1),C=e.useRef(null),T=e.useRef({}),A=e.useRef(null),L=e.useRef(M);L.current=M;const F=f(),P=g(),E=y(),R=b(),_=i(),D=R?E.primary:E.secondary,$=R?.15:.4,z=R?.08:.25,H=R?_.blue:E.primary;e.useEffect(()=>{const e=A.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:s}=t.contentRect;e>0&&s>0&&N({width:e,height:s})}});t.observe(e);const s=e.getBoundingClientRect();return s.width>0&&s.height>0&&N({width:s.width,height:s.height}),()=>t.disconnect()},[]);const B=e.useMemo(()=>{const e=new Set;if(a)for(const t of a)e.add(t.hash);return e},[a]),q=e.useMemo(()=>{const e=new Map;if(a)for(const t of a)e.set(t.hash,{snr:t.avgSnr,rssi:t.avgRssi});return e},[a]),{processedNeighbors:I,maxDistance:O,totalNeighbors:W,zeroHopCount:G}=e.useMemo(()=>{const e=[];for(const[a,i]of Object.entries(s)){if(!i.latitude||!i.longitude||0===i.latitude||0===i.longitude)continue;if(!B.has(a))continue;const t=pt(n,l,i.latitude,i.longitude),s=ft(n,l,i.latitude,i.longitude),r=q.get(a);e.push({hash:a.slice(0,8),name:i.node_name||i.name||"Unknown",snr:(null==r?void 0:r.snr)??i.snr??null,rssi:(null==r?void 0:r.rssi)??i.rssi??null,bearing:t,distance:s,normalizedDistance:0,lastSeen:i.last_seen,isZeroHop:!0})}const t=1.08*(e.length>0?Math.max(...e.map(e=>e.distance)):0);return e.sort((e,t)=>(e.snr??-1/0)-(t.snr??-1/0)),{processedNeighbors:e,maxDistance:t,totalNeighbors:e.length,zeroHopCount:e.length}},[s,n,l,B,q]);e.useEffect(()=>{null==r||r({zeroHopCount:G,totalCount:W,maxDistanceKm:O})},[G,W,O]),e.useEffect(()=>{const e=dt[w],t=L.current;C.current&&cancelAnimationFrame(C.current);const s=performance.now(),a=n=>{const l=n-s,i=Math.min(l/400,1),r=J(i);S(t+(e-t)*r),C.current=i<1?requestAnimationFrame(a):null};return C.current=requestAnimationFrame(a),()=>{C.current&&cancelAnimationFrame(C.current)}},[w]);const X=O/M,V=e.useMemo(()=>mt.filter(e=>e<=1.1*X),[X]);e.useEffect(()=>{const e=[];for(const s of I){const t=T.current[s.hash];void 0!==t&&t!==s.lastSeen&&e.push(s.hash),T.current[s.hash]=s.lastSeen}if(0===e.length)return;queueMicrotask(()=>{p(t=>new Set([...t,...e]))});const t=setTimeout(()=>{p(t=>{const s=new Set(t);return e.forEach(e=>s.delete(e)),s})},600);return()=>clearTimeout(t)},[I]);const Y=0!==n&&0!==l,K=e.useMemo(()=>{const{width:e,height:t}=j,s=o?22:0,a=e/2,n=t/2+s,l=t-2*s,i=Math.min(e,l),r=Math.max(10,i/2-6);return{width:e,height:t,centerX:a,centerY:n,radius:Math.max(10,r-8),labelRadius:r}},[j,o]),{width:Q,height:Z,centerX:ee,centerY:te,radius:se,labelRadius:ae}=K,ne=e.useId(),le=e.useCallback((e,t)=>{const s=e*Math.PI/180;return{x:ee+se*t*Math.sin(s),y:te-se*t*Math.cos(s)}},[ee,te,se]),ie=e.useCallback(e=>{const t={N:0,NE:45,E:90,SE:135,S:180,SW:225,W:270,NW:315}[e]*Math.PI/180;return{x:ee+ae*Math.sin(t),y:te-ae*Math.cos(t)}},[ee,te,ae]),re=e.useCallback(e=>{h(e)},[]),oe=e.useCallback(e=>{k(e)},[]),ce=e.useCallback(e=>O<=0?0:e/O*M,[O,M]),de=e=>`${e}km`,me=e.useMemo(()=>{const e=[{x:ee,y:te-ae},{x:ee+ae*Math.SQRT1_2,y:te-ae*Math.SQRT1_2}],t=V.map(e=>{const t=e/O*M;return{km:e,scale:t,lx:ee+se*t*ht,ly:te-se*t*xt}}).filter(e=>e.scale<=1.05&&e.scale>=.02).sort((e,t)=>t.km-e.km),s=[];for(const a of t){const t=s.some(e=>{const t=e.lx-a.lx,s=e.ly-a.ly;return Math.sqrt(t*t+s*s)<28}),n=e.some(e=>{const t=e.x-a.lx,s=e.y-a.ly;return Math.sqrt(t*t+s*s)<28});t||n||s.push(a)}return s},[V,O,M,ee,te,se,ae]),ue=j.width>0&&j.height>0;return Y?0===W?t.jsxs("div",{ref:A,className:"flex flex-col items-center justify-center h-full text-fg-secondary",children:[t.jsx(U,{className:"w-8 h-8 mb-2 opacity-50"}),t.jsx("p",{children:"No nodes with location data"})]}):t.jsxs("div",{className:"flex h-full w-full overflow-hidden",children:[t.jsxs("div",{ref:A,className:"relative flex-1 min-w-0 h-full overflow-hidden",children:[o&&t.jsx("div",{className:"absolute top-0 left-0 right-0 z-20 pointer-events-none",children:t.jsx("div",{className:"flex flex-col gap-1 flex-shrink-0 px-4 pt-4 pb-2 sm:px-5 sm:pt-5",children:t.jsxs("div",{className:"flex items-center justify-between gap-2 min-h-[32px] whitespace-nowrap",children:[t.jsxs("div",{className:"flex items-center gap-3 pointer-events-auto flex-shrink-0",children:[t.jsx("span",{className:"icon-md flex items-center justify-center text-icon-card-title",children:t.jsx(U,{className:"w-4 h-4"})}),t.jsx("span",{className:"type-micro",children:o}),c&&t.jsx(m,{color:"zinc",children:c})]}),d&&t.jsx("div",{className:"pointer-events-auto hidden sm:flex items-center gap-1.5 min-w-0 overflow-hidden",children:d})]})})}),ue&&t.jsxs("svg",{width:Q,height:Z,className:"absolute inset-0 z-0",children:[t.jsxs("defs",{children:[t.jsx("style",{children:"\n @keyframes neighbor-blink-scale {\n 0%, 100% {\n transform: scale(1);\n opacity: 0;\n }\n 50% {\n transform: scale(1.3);\n opacity: 0.8;\n }\n }\n .neighbor-blink-ring {\n transform-origin: center;\n animation: neighbor-blink-scale 600ms ease-out forwards;\n }\n "}),t.jsx("clipPath",{id:ne,children:t.jsx("circle",{cx:ee,cy:te,r:se})})]}),V.map(e=>{const s=ce(e);if(s>1.05||s<.02)return null;const a=me.some(t=>t.km===e),n=ee+se*s*ht,l=te-se*s*xt;return t.jsxs("g",{children:[t.jsx("circle",{cx:ee,cy:te,r:se*s,fill:"none",stroke:D,strokeOpacity:$,strokeWidth:1}),a&&t.jsx("text",{x:n+4,y:l-2,textAnchor:"start",dominantBaseline:"auto",fill:E.secondary,fontSize:10,fontFamily:v,children:de(e)})]},`ring-${e}`)}),["N","E","S","W"].map(e=>{const s={N:0,E:90,S:180,W:270}[e]*Math.PI/180;return t.jsx("line",{x1:ee,y1:te,x2:ee+se*Math.sin(s),y2:te-se*Math.cos(s),stroke:D,strokeOpacity:$,strokeWidth:1,strokeDasharray:"4 4"},e)}),["NE","SE","SW","NW"].map(e=>{const s={NE:45,SE:135,SW:225,NW:315}[e]*Math.PI/180;return t.jsx("line",{x1:ee,y1:te,x2:ee+se*Math.sin(s),y2:te-se*Math.cos(s),stroke:D,strokeOpacity:z,strokeWidth:1,strokeDasharray:"4 4"},`diag-${e}`)}),["N","E","S","W"].map(e=>{const s=ie(e),a="E"===e?"end":"W"===e?"start":"middle",n="N"===e?"hanging":"S"===e?"auto":"middle";return t.jsx("text",{x:s.x,y:s.y,textAnchor:a,dominantBaseline:n,fill:H,fontSize:10,fontWeight:700,fontFamily:v,"aria-hidden":"true",children:e},e)}),["NE","SE","SW","NW"].map(e=>{const s=ie(e),a="NE"===e||"SE"===e?"end":"start",n="NE"===e||"NW"===e?"hanging":"auto";return t.jsx("text",{x:s.x,y:s.y,textAnchor:a,dominantBaseline:n,fill:H,fontSize:9,fontWeight:600,fontFamily:v,"aria-hidden":"true",children:e},e)}),t.jsx("circle",{cx:ee,cy:te,r:5,fill:P.chart6,stroke:R?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.2)",strokeWidth:1,role:"img","aria-label":"Local node"}),t.jsx("g",{clipPath:`url(#${ne})`,children:I.map(e=>{const s=O>0?e.distance/O*M:0;if(s>1)return null;const{x:a,y:n}=le(e.bearing,s),l=null!==e.snr?yt(e.snr,F):"#808080",i=(null==u?void 0:u.hash)===e.hash,r=x.has(e.hash);return t.jsxs("g",{role:"img","aria-label":`${e.name}: ${e.distance.toFixed(1)}km ${e.bearing.toFixed(0)}°`,children:[r&&t.jsx("circle",{cx:a,cy:n,r:10.5,fill:"none",stroke:R?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.7)",strokeWidth:2,className:"neighbor-blink-ring"}),i&&t.jsx("circle",{cx:a,cy:n,r:10.5,fill:l,opacity:.3}),t.jsx("circle",{cx:a,cy:n,r:i?7:5,fill:l,stroke:R?"rgba(0,0,0,0.5)":"rgba(0,0,0,0.25)",strokeWidth:1,style:{cursor:"pointer",transition:"r 0.15s"},onMouseEnter:()=>re(e),onMouseLeave:()=>re(null)})]},e.hash)})})]}),u&&t.jsxs("div",{className:"absolute bg-tooltip-bg border border-edge-subtle rounded-lg px-3 py-2 text-sm pointer-events-none z-10 shadow-xl",style:{left:"50%",bottom:8,transform:"translateX(-50%)"},children:[t.jsx("div",{className:"font-medium text-fg-primary",children:u.name}),t.jsx("div",{className:"type-data-xs text-fg-secondary",children:u.hash}),null!==u.snr?t.jsx("div",{className:"flex gap-3 mt-1 text-xs",children:t.jsxs("span",{children:[t.jsx("span",{className:"text-fg-secondary",children:"SNR:"})," ",t.jsxs("span",{className:"tabular-nums",style:{color:yt(u.snr,F)},children:[u.snr.toFixed(1)," dB"]}),t.jsxs("span",{className:"text-fg-secondary ml-1",children:["(",(he=u.snr,(null==(xe=gt.find(e=>he>=e.min))?void 0:xe.label)??"Critical"),")"]})]})}):t.jsx("div",{className:"text-xs text-fg-secondary mt-1",children:"No SNR data"}),t.jsxs("div",{className:"flex gap-3 text-xs",children:[t.jsxs("span",{children:[t.jsx("span",{className:"text-fg-secondary",children:"Distance:"})," ",t.jsxs("span",{className:"tabular-nums text-fg-primary",children:[u.distance.toFixed(2)," km"]})]}),t.jsxs("span",{children:[t.jsx("span",{className:"text-fg-secondary",children:"Bearing:"})," ",t.jsxs("span",{className:"tabular-nums text-fg-primary",children:[u.bearing.toFixed(0),"°"]})]})]})]})]}),t.jsx("div",{className:"flex flex-col gap-1 px-1.5 py-2 flex-shrink-0",role:"group","aria-label":"Zoom level",children:["1x","2x","4x","8x","16x","36x"].map(e=>t.jsx("button",{onClick:()=>oe(e),"aria-pressed":w===e,className:"flex flex-1 items-center justify-center min-w-[44px] sm:min-w-[32px] text-xs font-medium rounded transition-colors "+(w===e?"bg-sys-blue/20 text-sys-blue":"bg-subtle-fill/80 text-fg-secondary hover:bg-subtle-fill-strong hover:text-fg-primary"),children:e},e))})]}):t.jsxs("div",{ref:A,className:"flex flex-col items-center justify-center h-full text-fg-secondary",children:[t.jsx(U,{className:"w-8 h-8 mb-2 opacity-50"}),t.jsx("p",{children:"Local node coordinates not configured"}),t.jsx("p",{className:"text-xs mt-1",children:"Set latitude/longitude in config to enable"})]});var he,xe}),vt={repeater:"var(--sys-blue)",companion:"var(--sys-cyan)",room_server:"var(--sys-indigo)"};function jt(e){if(e.contact_type){const t=e.contact_type.toLowerCase();if("repeater"===t||"rep"===t)return"repeater";if("room server"===t||"room_server"===t||"room"===t||"server"===t)return"room_server";if("companion"===t||"client"===t||"cli"===t)return"companion"}return e.is_repeater?"repeater":"companion"}const Nt=e.memo(function({neighbors:s}){const a=e.useMemo(()=>{const e={repeater:0,companion:0,room_server:0};for(const a of Object.values(s)){const t=jt(a);e[t]=(e[t]||0)+1}const t=Object.values(e).reduce((e,t)=>e+t,0);return{items:[{label:"Repeaters",count:e.repeater,percent:0,color:vt.repeater},{label:"Companions",count:e.companion,percent:0,color:vt.companion},{label:"Room Servers",count:e.room_server,percent:0,color:vt.room_server}].map(e=>({...e,percent:t>0?e.count/t*100:0})).filter(e=>e.count>0).sort((e,t)=>t.count-e.count),total:t}},[s]);return 0===a.total?t.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted type-body-sm",children:"No neighbors discovered yet"}):t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx("div",{className:"flex-1 flex flex-col justify-evenly",children:a.items.map(e=>t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"type-data-sm text-fg-secondary",children:e.label}),t.jsxs("span",{className:"type-data-sm text-fg-secondary tabular-nums",children:[e.count," ",t.jsxs("span",{className:"text-fg-secondary/60",children:["(",e.percent.toFixed(0),"%)"]})]})]}),t.jsx("div",{className:"h-2.5 bg-elevated overflow-hidden",children:t.jsx("div",{className:"h-full transition-all duration-500 ease-out",style:{width:`${e.percent}%`,backgroundColor:e.color,minWidth:e.count>0?"4px":"0"}})})]},e.label))}),t.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-edge-subtle",children:[t.jsx("span",{className:"type-data-xs text-fg-secondary",children:"Total Nodes"}),t.jsx("span",{className:"type-data-sm text-fg-primary font-medium tabular-nums",children:a.total})]})]})});function wt({children:s,minHeight:a="100%",rootMargin:n="200px 0px",keepMounted:l=!0,className:i=""}){const r=e.useRef(null),[o,c]=e.useState(!1),[d,m]=e.useState(!1);e.useEffect(()=>{const e=r.current;if(!e)return;const t=new IntersectionObserver(([e])=>{const t=e.isIntersecting;m(t),t&&c(!0)},{rootMargin:n,threshold:0});return t.observe(e),()=>{t.disconnect()}},[n]);const u=d||l&&o;return t.jsx("div",{ref:r,className:`h-full w-full ${i}`,style:{minHeight:a},children:u?s:t.jsx("div",{className:"h-full w-full flex items-center justify-center text-fg-muted/50",children:t.jsx("div",{className:"animate-pulse text-xs",children:"Loading chart..."})})})}const kt={excellent:"text-signal-excellent",good:"text-signal-good",fair:"text-signal-fair",poor:"text-sys-blue"},Mt={excellent:"bg-signal-excellent/10",good:"bg-signal-good/10",fair:"bg-signal-fair/10",poor:"bg-sys-blue/10"};function St(){const s=N(),a=w(),[n,l]=e.useState(null),i=e.useCallback((e,t)=>{l({prefix:e,candidateHashes:t})},[]),r=e.useCallback(()=>{l(null)},[]);if(!a)return t.jsxs(ee,{neomorphic:!0,children:[t.jsx(re,{icon:t.jsx(ce,{}),title:"Prefix Conflicts"}),t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsxs("div",{className:"text-center text-fg-secondary",children:[t.jsx(k,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),t.jsx("p",{className:"type-data-xs",children:"No topology data available"}),t.jsx("p",{className:"type-data-xs opacity-70",children:"Run deep analysis to see stats"})]})})]});const o=(c=s.avgConfidence)>=.9?"excellent":c>=.7?"good":c>=.5?"fair":"poor";var c;const d=(u=s.collisionRate)<=10?"excellent":u<=25?"good":"poor";var u;const h="poor"===o||"poor"===d?"poor":"fair"===o||"fair"===d?"fair":"good"===o||"good"===d?"good":"excellent",x="excellent"===h||"good"===h?Ae:me;return t.jsxs(ee,{neomorphic:!0,className:"flex flex-col overflow-hidden",children:[t.jsx(re,{icon:t.jsx(ce,{}),title:"Prefix Conflicts",badgeColor:"zinc",actions:"poor"===h?t.jsxs(m,{color:"red",children:[t.jsx(me,{className:"w-3 h-3"}),"Needs Attention"]}):t.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full ${Mt[h]}`,children:[t.jsx(x,{className:`w-3.5 h-3.5 ${kt[h]}`}),t.jsx("span",{className:`type-data-xs font-medium ${kt[h]}`,children:"excellent"===h?"Excellent":"good"===h?"Good":"Fair"})]})}),t.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[t.jsxs("div",{className:"grid grid-cols-3 gap-1.5 sm:gap-2 py-3 sm:py-4",children:[t.jsxs("div",{className:"flex flex-col items-center cursor-help bg-subtle-fill radius-inner sm:radius-inset py-2 sm:py-3 px-1.5 sm:px-2",title:"Total unique 2-character prefixes observed in packet paths.",children:[t.jsx(Q,{value:s.totalPrefixes,className:"type-data-hero text-fg-primary",priority:"low"}),t.jsx("span",{className:"type-data-xs sm:type-data-sm text-fg-secondary mt-0.5 sm:mt-1",children:"Prefixes"})]}),t.jsxs("div",{className:"flex flex-col items-center cursor-help bg-subtle-fill radius-inner sm:radius-inset py-2 sm:py-3 px-1.5 sm:px-2",title:"Prefixes that map to exactly one known node. No disambiguation needed.",children:[t.jsx(Q,{value:s.unambiguousPrefixes,className:"type-data-hero text-fg-primary",priority:"low"}),t.jsx("span",{className:"type-data-xs sm:type-data-sm text-fg-secondary mt-0.5 sm:mt-1",children:"Unique"})]}),t.jsxs("div",{className:"flex flex-col items-center cursor-help radius-inner sm:radius-inset py-2 sm:py-3 px-1.5 sm:px-2 "+(s.collisionPrefixes>0?"bg-sys-blue/15":"bg-subtle-fill"),title:"Prefixes matching multiple known nodes. Click a prefix below to explore candidates.",children:[t.jsx(Q,{value:s.collisionPrefixes,className:"type-data-hero "+(s.collisionPrefixes>0?"text-sys-blue":"text-fg-primary"),priority:"low"}),t.jsx("span",{className:"type-data-xs sm:type-data-sm mt-0.5 sm:mt-1 "+(s.collisionPrefixes>0?"text-sys-blue":"text-fg-secondary"),children:"Conflicts"})]})]}),s.highCollisionPrefixes.length>0&&t.jsxs("div",{children:[t.jsx("div",{className:"type-data-xs text-fg-secondary mb-1.5",children:"Problem Prefixes"}),t.jsx("div",{className:"flex flex-wrap gap-1.5 content-start",children:s.highCollisionPrefixes.map(({prefix:e,candidateCount:s,candidateHashes:a})=>t.jsxs("button",{type:"button",onClick:()=>i(e,a),className:"inline-flex items-center gap-0.5 group",title:`${s} candidates - click to explore`,children:[t.jsx(ne,{children:e}),t.jsxs("span",{className:"text-fg-muted type-data-xs group-hover:text-fg-secondary transition-colors",children:["×",s]})]},e))})]}),0===s.lowConfidencePrefixes.length&&0===s.collisionPrefixes&&t.jsx("div",{className:"flex-1 flex items-center",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(Ae,{className:"w-3.5 h-3.5 text-signal-excellent"}),t.jsx("span",{className:"type-data-xs text-signal-excellent",children:"All prefixes uniquely identified"})]})}),t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 mt-auto pt-3",children:[t.jsxs("div",{className:"flex items-center gap-2 cursor-help",title:"Average confidence score across all disambiguated prefixes. Higher = more certain node identification.",children:[t.jsx("span",{className:"type-data-xs text-fg-secondary",children:"Confidence"}),t.jsxs("span",{className:`data-box ${kt[o]}`,children:[(100*s.avgConfidence).toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex items-center gap-2 cursor-help",title:"Percentage of 2-character prefixes that match multiple known nodes. Lower is better.",children:[t.jsx("span",{className:"type-data-xs text-fg-secondary",children:"Collisions"}),t.jsxs("span",{className:`data-box ${kt[d]}`,children:[s.collisionRate.toFixed(1),"%"]})]})]})]}),t.jsx(le,{isOpen:!!n,prefix:(null==n?void 0:n.prefix)||"",candidateHashes:(null==n?void 0:n.candidateHashes)||[],onClose:r})]})}function Ct({icon:e,label:s,value:a,sublabel:n,highlight:l,tooltip:i}){return t.jsxs("div",{className:"flex items-center justify-between gap-2 py-1.5 "+(i?"cursor-help":""),title:i,children:[t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 min-w-0",children:[t.jsx("span",{className:"icon-xs text-icon-widget flex-shrink-0",children:e}),t.jsx("span",{className:"type-body-sm text-fg-secondary truncate",children:s})]}),t.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5 flex-shrink-0",children:[t.jsx("span",{className:"data-box",style:l?{"--data-box-color":"var(--sys-blue)"}:void 0,children:a}),n&&t.jsx("span",{className:"type-data-xs text-fg-secondary hidden sm:inline",children:n})]})]})}function Tt(){const e=M(),s=S().length;if(!e||0===e.totalPaths)return null;const{totalPaths:a,pathsWithGhosts:n,observationOverrideCount:l,tracePacketsProcessed:i,pathPacketsProcessed:r,distantEdgesDiscovered:o,duplicateGroupsFound:c,duplicatePathsUnique:d,echolocationEdgesInferred:m}=e,u=a>0?((a-n)/a*100).toFixed(1):"0",h=a>0?(l/a*100).toFixed(1):"0",x=i+r,p=x>0||o>0,f=c>0||m>0;return t.jsxs(ee,{neomorphic:!0,children:[t.jsx(re,{title:"Path Decoder",icon:t.jsx(de,{}),badge:s>0?`${s} hidden`:void 0,badgeColor:"zinc"}),t.jsxs(oe,{children:[t.jsxs("div",{children:[t.jsx(Ct,{icon:t.jsx(Pe,{className:"w-3.5 h-3.5"}),label:"Traceable",value:`${u}%`,sublabel:`of ${a.toLocaleString()} paths`,tooltip:"Percentage of packet journeys where every hop was identified. Higher = better visibility into how traffic flows through your mesh."}),t.jsx(Ct,{icon:t.jsx(Re,{className:"w-3.5 h-3.5"}),label:"Learning Rate",value:`${h}%`,sublabel:"adapted",tooltip:"How often real traffic patterns improved our predictions over geography alone. Higher values mean the decoder is learning your mesh's actual behavior — which routes are preferred, which nodes are most active."})]}),p&&t.jsxs("div",{className:"mt-3",children:[t.jsx("p",{className:"type-micro mb-2",children:"Beyond Line-of-Sight"}),t.jsxs("div",{children:[t.jsx(Ct,{icon:t.jsx(Ee,{className:"w-3.5 h-3.5"}),label:"Route Reports",value:x.toLocaleString(),sublabel:i>0?`(${i} TRACE)`:void 0,tooltip:"TRACE/PATH packets from distant nodes share their routing tables. This reveals connections we can't directly observe — mapping parts of the mesh we don't touch."}),t.jsx(Ct,{icon:t.jsx(ue,{className:"w-3.5 h-3.5"}),label:"Remote Links",value:o.toLocaleString(),highlight:o>0,tooltip:"Node-to-node connections discovered from route reports. These links exist outside our RF range but help complete the topology picture."})]})]}),f&&t.jsx(Ct,{icon:t.jsx(C,{className:"w-3.5 h-3.5"}),label:"Multi-Path Packets",value:c.toLocaleString(),sublabel:d>0?`(${d} routes)`:void 0,tooltip:"Packets received via multiple paths simultaneously. Like sonar, these 'echoes' reveal redundant routes — important for understanding mesh resilience."}),s>0&&t.jsx(Ct,{icon:t.jsx(T,{className:"w-3.5 h-3.5 text-sys-blue"}),label:"Ghost Repeaters",value:s,highlight:!0,tooltip:"High-confidence hidden repeaters: appear in 10+ paths, have 2+ known neighbors, ≥30% confidence, and plausible location. View them on the Contacts map."})]})]})}const At=new Set(["Duplicate","Empty payload","Path too long","Unknown"]),Lt={excellent:"bg-status-success",good:"bg-sys-blue",fair:"bg-status-warning",poor:"bg-status-danger"};function Ft({packets:s,rangeMinutes:a,rangeHours:n,timeRangeLabel:l,isLoaded:i=!0}){const r=e.useMemo(()=>function(e,t){const s=Date.now()/1e3,a=60*t,n=s-a,l=a/24,i=new Array(24).fill(0),r=new Array(24).fill(0);let o=0,c=0,d=0,m=0;for(const h of e){if("tx_local"===h.packet_origin)continue;const e=h.timestamp;if(es)continue;o++;const t=Math.min(23,Math.floor((e-n)/l));r[t]++,h.transmitted||"tx_forward"===h.packet_origin?(c++,i[t]++):(h.is_duplicate||"Duplicate"===h.drop_reason)&&d++,h.drop_reason&&At.has(h.drop_reason)&&m++}const u=[];for(let h=0;h<24;h++){const e=r[h],t=i[h];u.push({count:e>0?Math.round(t/e*100):0,timestamp:1e3*(n+h*l)})}return{totalRx:o,forwarded:c,duplicates:d,waste:m,efficiency:o>0?c/o*100:0,duplicateRate:o>0?d/o*100:0,wasteRate:o>0?m/o*100:0,sparkline:u}}(s,a),[s,a]),[o,c]=e.useState(null),d=e.useCallback(async()=>{try{const e=await A(n);e.success&&e.data&&c(e.data.count)}catch{}},[n]);e.useEffect(()=>{d()},[d]);const m=(u=r.efficiency)>=90?"excellent":u>=75?"good":u>=60?"fair":"poor";var u;const h=r.totalRx>0;return t.jsx(ee,{neomorphic:!0,isLoaded:i,skeletonType:"chart",children:i&&t.jsxs(t.Fragment,{children:[t.jsx(re,{icon:t.jsx(xe,{}),title:"Packet Health",badge:l,badgeColor:"zinc"}),t.jsx(oe,{children:t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex items-baseline gap-2",children:[t.jsxs("div",{className:"type-data-xl text-fg-primary",children:[h?t.jsx(Q,{value:Math.round(10*r.efficiency)/10,className:"font-mono tabular-nums",priority:"medium",format:{minimumFractionDigits:1,maximumFractionDigits:1}}):t.jsx("span",{className:"opacity-30",children:"—"}),t.jsx("span",{className:"type-data-sm text-fg-muted ml-0.5",children:"%"})]}),h&&t.jsx("div",{className:`w-2 h-2 rounded-full ${Lt[m]}`})]}),t.jsx("div",{className:"type-micro mb-2 cursor-help",title:"Forwarded packets / total received. CRC failures, garbled packets, and RF collisions that destroy packets before reaching software are not included in this ratio — see CRC Errors for hardware-level failures.",children:"FORWARDING RATE"}),t.jsx("div",{className:"flex-1 min-h-[28px] max-h-[48px] mb-2",children:t.jsx(he,{data:r.sparkline,width:9999,height:36,color:"var(--sys-blue)",className:"w-full"})}),t.jsxs("div",{className:"flex gap-2 sm:gap-3 mt-auto",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Dupes"}),t.jsx("div",{className:"data-box data-box-fill data-box-left",children:h?`${r.duplicateRate.toFixed(1)}%`:"—"})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Waste"}),t.jsx("div",{className:"data-box data-box-fill data-box-left",children:h?`${r.wasteRate.toFixed(1)}%`:"—"})]}),null!==o&&o>0&&t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"data-box-label flex items-center gap-1",children:[t.jsx(me,{className:"w-3 h-3 text-status-warning"}),"CRC"]}),t.jsx("div",{className:"data-box data-box-fill data-box-left text-status-warning",children:o})]})]})]})})]})})}function Pt(e,t){const s=new Date(1e3*e),a=e=>e.toString().padStart(2,"0"),n=`${a(s.getHours())}:${a(s.getMinutes())}`;return t<=24?n:`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][s.getMonth()]} ${s.getDate()} ${n}`}const Et=[{type:"repeater",label:"Repeater",icon:L,color:"text-sys-blue"},{type:"companion",label:"Companion",icon:ie,color:"text-fg-muted"},{type:"room_server",label:"Room",icon:ve,color:"text-sys-pink"},{type:"unknown",label:"Unknown",icon:fe,color:"text-sys-amber"}],Rt=60,_t=.005;function Dt({min:s,max:a,valueStart:n,valueEnd:l,onChange:i}){const r=e.useRef(null),[o,c]=e.useState(null),d=e.useRef({valueStart:n,valueEnd:l,min:s,max:a});d.current={valueStart:n,valueEnd:l,min:s,max:a};const m=e.useRef({offset:0,width:0}),u=a-s||1,h=u/3600,x=n??s,p=l??a,f=(x-s)/u*100,g=(p-s)/u*100,y=null!==n||null!==l,b=e.useCallback(e=>{const t=r.current.getBoundingClientRect(),s=Math.max(0,Math.min(1,(e-t.left)/t.width)),{min:a,max:n}=d.current;return Math.round(a+s*(n-a||1))},[]),v=e.useCallback((e,t)=>{t.preventDefault(),t.stopPropagation();const s=t.currentTarget;s.setPointerCapture(t.pointerId),c(e);const a=t=>{const s=b(t.clientX),{valueStart:a,valueEnd:n,min:l,max:r}=d.current,o=r-l||1;if("start"===e){const e=Math.min(s,(n??r)-Rt);i(e<=l+o*_t?null:e,n)}else{const e=Math.max(s,(a??l)+Rt);i(a,e>=r-o*_t?null:e)}},n=()=>{c(null),s.removeEventListener("pointermove",a),s.removeEventListener("pointerup",n),s.removeEventListener("pointercancel",n)};s.addEventListener("pointermove",a),s.addEventListener("pointerup",n),s.addEventListener("pointercancel",n)},[b,i]),j=e.useCallback(e=>{e.preventDefault(),e.stopPropagation();const t=e.currentTarget;t.setPointerCapture(e.pointerId),c("range");const s=d.current.valueStart??d.current.min,a=d.current.valueEnd??d.current.max;m.current={offset:b(e.clientX)-s,width:a-s};const n=e=>{const t=b(e.clientX),{min:s,max:a}=d.current,{offset:n,width:l}=m.current;let r=t-n;r=Math.max(s,Math.min(a-l,r));const o=r+l;i(Math.round(r)<=s?null:Math.round(r),Math.round(o)>=a?null:Math.round(o))},l=()=>{c(null),t.removeEventListener("pointermove",n),t.removeEventListener("pointerup",l),t.removeEventListener("pointercancel",l)};t.addEventListener("pointermove",n),t.addEventListener("pointerup",l),t.addEventListener("pointercancel",l)},[b,i]),N=e.useCallback(e=>{const t=b(e.clientX),{valueStart:s,valueEnd:a,min:n,max:l}=d.current,r=l-n||1,o=s??n,c=a??l;if(Math.abs(t-o)<=Math.abs(t-c)){const e=Math.min(t,c-Rt);i(e<=n+r*_t?null:e,a)}else{const e=Math.max(t,o+Rt);i(s,e>=l-r*_t?null:e)}},[b,i]),w=e.useCallback(()=>i(null,null),[i]),k=e.useCallback((e,t)=>{const s="ArrowRight"===t.key||"ArrowUp"===t.key?1:"ArrowLeft"===t.key||"ArrowDown"===t.key?-1:0;if(!s)return;t.preventDefault();const a=(t.shiftKey?.1:.01)*u,{valueStart:n,valueEnd:l,min:r,max:o}=d.current,c=o-r||1;if("start"===e){const e=Math.max(r,Math.min((n??r)+s*a,(l??o)-Rt));i(e<=r+c*_t?null:e,l)}else{const e=Math.min(o,Math.max((l??o)+s*a,(n??r)+Rt));i(n,e>=o-c*_t?null:e)}},[u,i]),M=e=>{const t=o===e;return["absolute top-1/2 -translate-y-1/2 -translate-x-1/2 w-1 h-4 rounded-full","before:content-[''] before:absolute before:-inset-x-3 before:-inset-y-1","touch-none outline-none",t?"cursor-grabbing":"cursor-ew-resize",t?"bg-sys-blue shadow-[0_0_8px_var(--sys-blue)] scale-x-150 z-20":("start"===e?null!==n:null!==l)?"bg-sys-blue shadow-[0_0_4px_var(--sys-blue)] hover:shadow-[0_0_8px_var(--sys-blue)] hover:scale-x-150 z-10":"bg-edge-subtle hover:bg-fg-muted hover:scale-x-150 z-10",t?"":"transition-[transform,box-shadow,background-color] duration-150 ease-out","focus-visible:ring-2 focus-visible:ring-sys-blue/50"].filter(Boolean).join(" ")};return t.jsxs("div",{className:"flex flex-col gap-0.5 min-w-[160px] sm:min-w-[220px]",children:[t.jsxs("div",{className:"flex items-center justify-between type-data-xs text-fg-muted tabular-nums select-none",children:[t.jsx("span",{className:y&&null!==n?"text-sys-blue":"",children:Pt(x,h)}),t.jsx("span",{className:y&&null!==l?"text-sys-blue":"",children:Pt(p,h)})]}),t.jsxs("div",{ref:r,className:"relative h-5 select-none",onPointerDown:N,onDoubleClick:w,children:[t.jsx("div",{className:"absolute inset-x-0 top-1/2 -translate-y-1/2 h-1.5 rounded-full bg-white/[0.06] pointer-events-none"}),y?t.jsx("div",{className:["group/band absolute inset-y-0 touch-none","range"===o?"cursor-grabbing":"cursor-grab"].join(" "),style:{left:`${f}%`,right:100-g+"%"},onPointerDown:j,children:t.jsx("div",{className:["absolute inset-x-0 top-1/2 -translate-y-1/2 h-1.5 rounded-full pointer-events-none transition-colors","range"===o?"bg-sys-blue/40":"bg-sys-blue/25 group-hover/band:bg-sys-blue/35"].join(" ")})}):t.jsx("div",{className:"absolute inset-x-0 top-1/2 -translate-y-1/2 h-1.5 rounded-full bg-white/[0.04] pointer-events-none"}),t.jsx("div",{role:"slider",tabIndex:0,"aria-label":"Range start","aria-valuenow":x,className:M("start"),style:{left:`${f}%`},onPointerDown:e=>v("start",e),onKeyDown:e=>k("start",e)}),t.jsx("div",{role:"slider",tabIndex:0,"aria-label":"Range end","aria-valuenow":p,className:M("end"),style:{left:`${g}%`},onPointerDown:e=>v("end",e),onKeyDown:e=>k("end",e)})]})]})}function $t({parentStartTs:s,parentEndTs:a,neighbors:n,filter:l,onChange:i}){const[r,o]=e.useState(""),[c,d]=e.useState(!1),m=e.useRef(null);e.useEffect(()=>{function e(e){m.current&&!m.current.contains(e.target)&&d(!1)}if(c)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[c]);const u=e.useMemo(()=>Object.entries(n).map(([e,t])=>{const s=pe(t);return{hash:e,name:t.name??t.node_name??e.slice(0,8),type:s.type,label:s.label}}).sort((e,t)=>e.name.localeCompare(t.name)),[n]),h=e.useMemo(()=>{if(!r)return u;const e=r.toLowerCase();return u.filter(t=>t.name.toLowerCase().includes(e)||t.hash.toLowerCase().includes(e))},[u,r]),x=null!==l.timeStart||null!==l.timeEnd||l.deviceTypes.size>0||l.nodeIds.size>0,p=e.useCallback((e,t)=>{i({...l,timeStart:e,timeEnd:t})},[l,i]),f=e.useCallback(e=>{const t=new Set(l.deviceTypes);t.has(e)?t.delete(e):t.add(e),i({...l,deviceTypes:t})},[l,i]),g=e.useCallback(e=>{const t=new Set(l.nodeIds);t.has(e)?t.delete(e):t.add(e),i({...l,nodeIds:t}),o("")},[l,i]),y=e.useCallback(e=>{const t=new Set(l.nodeIds);t.delete(e),i({...l,nodeIds:t})},[l,i]),b=e.useCallback(()=>{i({timeStart:null,timeEnd:null,deviceTypes:new Set,nodeIds:new Set}),o("")},[i]),v=e.useMemo(()=>{const e=new Map;for(const t of l.nodeIds){const s=n[t];e.set(t,(null==s?void 0:s.name)??(null==s?void 0:s.node_name)??t.slice(0,8))}return e},[l.nodeIds,n]);return t.jsxs("div",{className:"flex flex-col gap-1.5 px-3 py-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-fg-muted shrink-0",children:[t.jsx(be,{className:"w-3.5 h-3.5"}),t.jsx("span",{className:"type-data-xs font-medium",children:"Filter"})]}),t.jsx(Dt,{min:s,max:a,valueStart:l.timeStart,valueEnd:l.timeEnd,onChange:p}),t.jsx("div",{className:"w-px h-4 bg-edge-subtle shrink-0 hidden sm:block"}),t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:Et.map(({type:e,label:s,icon:a,color:n})=>{const i=l.deviceTypes.has(e);return t.jsxs("button",{type:"button",onClick:()=>f(e),className:`\n flex items-center gap-1 px-2 py-0.5 rounded-full type-data-xs transition-colors\n ${i?"bg-sys-blue/20 text-sys-blue border border-sys-blue/40":"bg-transparent text-fg-muted border border-edge-subtle hover:border-fg-muted/40"}\n `,title:`Filter by ${s}`,children:[t.jsx(a,{className:`w-3 h-3 ${i?"text-sys-blue":n}`}),t.jsx("span",{className:"hidden sm:inline",children:s})]},e)})}),t.jsx("div",{className:"w-px h-4 bg-edge-subtle shrink-0 hidden sm:block"}),t.jsxs("div",{className:"relative flex items-center gap-1.5 flex-1 min-w-[140px] px-2 py-0.5 rounded-md border border-edge-subtle bg-white/[0.03] transition-colors focus-within:border-sys-blue",ref:m,children:[t.jsx(je,{className:"w-3 h-3 text-fg-muted/50 shrink-0"}),t.jsx("input",{type:"text",className:"flex-1 min-w-[80px] type-data-xs py-0.5 bg-transparent text-fg-secondary placeholder:text-fg-muted/40 border-none focus:outline-none",placeholder:"Search nodes...",value:r,onChange:e=>{o(e.target.value),d(!0)},onFocus:()=>d(!0)}),c&&h.length>0&&t.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 z-[200] surface-popover border border-edge-subtle radius-inner max-h-48 overflow-y-auto",children:h.slice(0,20).map(e=>{const s=l.nodeIds.has(e.hash);return t.jsxs("button",{type:"button",onClick:()=>g(e.hash),className:`\n w-full flex items-center gap-2 px-2.5 py-1.5 type-data-xs text-left transition-colors\n ${s?"bg-sys-indigo/15 text-sys-indigo":"text-fg-secondary hover:bg-subtle-fill"}\n `,children:[t.jsx("span",{className:"flex-1 truncate",children:e.name}),t.jsx("span",{className:"text-fg-muted type-data-xs shrink-0",children:e.label})]},e.hash)})})]}),x&&t.jsxs("button",{type:"button",onClick:b,className:"flex items-center gap-1 px-2 py-0.5 rounded-full type-data-xs text-fg-muted hover:text-fg-primary border border-edge-subtle hover:border-fg-muted/40 transition-colors shrink-0",title:"Clear all filters",children:[t.jsx(F,{className:"w-3 h-3"}),"Clear"]})]}),l.nodeIds.size>0&&t.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:Array.from(l.nodeIds).map(e=>t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-sys-indigo/15 text-sys-indigo type-data-xs border border-sys-indigo/25 transition-colors hover:bg-sys-indigo/25",children:[v.get(e)??e.slice(0,8),t.jsx("button",{type:"button",onClick:()=>y(e),className:"hover:text-fg-primary transition-colors -mr-0.5",children:t.jsx(F,{className:"w-3 h-3"})})]},e))})]})}function zt(){return{timeStart:null,timeEnd:null,deviceTypes:new Set,nodeIds:new Set}}function Ht(){var s,a,n,l,i,r,o,c,d,m,u,h,x,p,f,g,y;const b=P(),v=E(),j=R(),N=_(),w=D(),k=$(),M=z(),S=H(),[C,T]=e.useState([]),[A,F]=e.useState(null),[,U]=e.useState(null),[J,K]=e.useState(!0),[Q,ne]=e.useState(null),[le,ie]=e.useState(()=>{const e=localStorage.getItem("statistics-view-mode");return"share"===e||"airtime"===e?e:"airtime"});e.useEffect(()=>{localStorage.setItem("statistics-view-mode",le)},[le]);const[oe,ce]=e.useState(()=>{const e=localStorage.getItem("statistics-smoothing-mode");return["ema","ultra","mosaic","stats","trend"].includes(e)?e:"stats"});e.useEffect(()=>{localStorage.setItem("statistics-smoothing-mode",oe)},[oe]);const[de,me]=e.useState(!1),[ue,he]=e.useState(!1),[xe,fe]=e.useState(De),[be,ve]=e.useState(.5),[je,Se]=e.useState(zt),Te=e.useMemo(()=>({0:0,1:0,2:1,3:2,4:3,5:4,6:5,7:6,8:7,9:8,10:9}[M]??3),[M]),Ae=B[Te].hours,Le=60*Ae,Fe=B[Te],Pe=I(Ae),Ee=k.isBackgroundLoading,Re=e.useCallback(e=>{S({0:1,1:2,2:3,3:4,4:5,5:6,6:7,7:8,8:9,9:10}[e]??4)},[S]),_e=e.useMemo(()=>{var e;if(!(null==(e=null==b?void 0:b.config)?void 0:e.radio))return null;const t=b.config.radio;return{sf:t.spreading_factor??10,bw:t.bandwidth??25e4,cr:t.coding_rate??5,preamble:t.preamble_length??8}},[null==(a=null==(s=null==b?void 0:b.config)?void 0:s.radio)?void 0:a.spreading_factor,null==(l=null==(n=null==b?void 0:b.config)?void 0:n.radio)?void 0:l.bandwidth,null==(r=null==(i=null==b?void 0:b.config)?void 0:i.radio)?void 0:r.coding_rate,null==(c=null==(o=null==b?void 0:b.config)?void 0:o.radio)?void 0:c.preamble_length]);e.useEffect(()=>{!async function(){var e;ne(null);try{const t=await q(Ae);t.success&&(null==(e=t.data)?void 0:e.history)&&T(t.data.history)}catch(t){ne(t instanceof Error?t.message:"Failed to load chart data")}finally{K(!1)}}()},[Ae]);const Be=e.useMemo(()=>Ae>=504?72e5:336===Ae?36e5:168===Ae?18e5:72===Ae?6e5:3e5,[Ae]),qe=e.useCallback(async()=>{var e;try{const t=await q(Ae);t.success&&(null==(e=t.data)?void 0:e.history)&&T(t.data.history)}catch{}},[Ae]);V(qe,Be,!0,!0);const Ie=e.useMemo(()=>0===C.length?{timestamps:[],values:[]}:{timestamps:C.map(e=>e.timestamp),values:C.map(e=>e.noise_floor_dbm)},[C]),Oe=e.useMemo(()=>{if(C.length<10)return{anomalies:[],debug:void 0};const e=function(e,t={}){const s={...De,...t};if(e.length<10)return{anomalies:[],thresholds:ze([]),totalSamples:e.length,anomalySamples:0};const a=e.map(e=>e.noise_floor_dbm),n=ze(a),l=[...a].sort((e,t)=>e-t);let i,r;s.useAbsoluteThresholds?(i=s.baselineDbm,r=s.spikeDbm):(i=$e(l,s.baselinePercentile),r=$e(l,s.spikePercentile));const o=[...e].sort((e,t)=>e.timestamp-t.timestamp),c=[];let d=null,m=0;for(const u of o)if(u.noise_floor_dbm>i&&u.noise_floor_dbme+t,0)/d.values.length):(d.values.length>=s.minSequenceLength&&c.push(d),d={startTs:u.timestamp,endTs:u.timestamp,values:[u.noise_floor_dbm],timestamps:[u.timestamp],rollingAvg:u.noise_floor_dbm})}else d={startTs:u.timestamp,endTs:u.timestamp,values:[u.noise_floor_dbm],timestamps:[u.timestamp],rollingAvg:u.noise_floor_dbm};else d&&d.values.length>=s.minSequenceLength&&c.push(d),d=null;return d&&d.values.length>=s.minSequenceLength&&c.push(d),0===c.length?{anomalies:[],thresholds:n,totalSamples:e.length,anomalySamples:m,debug:{baselineCutoff:i,spikeCutoff:r,midBandSamples:m}}:{anomalies:c.map(e=>{const t=Math.max(...e.values),s=e.values.reduce((e,t)=>e+t,0)/e.values.length;return{startTs:e.startTs,endTs:e.endTs,peakValue:t,avgValue:s,severity:He(s,i,r),sampleCount:e.values.length}}),thresholds:n,totalSamples:e.length,anomalySamples:m,debug:{baselineCutoff:i,spikeCutoff:r,midBandSamples:m}}}(C,xe);return{anomalies:e.anomalies,debug:e.debug}},[C,xe]),We=Oe.anomalies,Ge=e.useMemo(()=>{const e=(null==b?void 0:b.neighbors)??{};return Object.fromEntries(Object.entries(e).filter(([e])=>!v.has(e)))},[null==b?void 0:b.neighbors,v]),Xe=e.useMemo(()=>{const e=Date.now()/1e3-3600*Ae;return Object.fromEntries(Object.entries(Ge).filter(([,t])=>t.last_seen>=e))},[Ge,Ae]),Ve=e.useMemo(()=>{const e=60*Le/Pe,t=Math.floor(Date.now()/1e3),s=Math.floor(t/e)*e;return{start:s-60*Le,end:s}},[Le,Pe]),Ye=je.timeStart??Ve.start,Ue=je.timeEnd??Ve.end,Je=I((Ue-Ye)/3600),Ke=e.useMemo(()=>{const e=new Map,t=new Map,s=(null==b?void 0:b.neighbors)??{},a=new Set(Object.keys(s));for(const n of N)if((n.type??n.payload_type)===O.ADVERT&&n.src_hash&&n.raw_packet&&!a.has(n.src_hash)&&!e.has(n.src_hash))try{const t=Ne.fromHex(n.raw_packet);if(!t.success||!t.packet)continue;const s=we(t.packet.payload);if(!s)continue;const a=ge(s.nodeType);"unknown"!==a&&e.set(n.src_hash,a)}catch{}for(const[n,l]of Object.entries(s)){const s=pe(l).type;e.set(n,s);const a=W(n),i=t.get(a);void 0===i?t.set(a,s):i!==s&&t.set(a,"ambiguous")}return{hashToType:e,prefixToType:t}},[N,null==b?void 0:b.neighbors]),Qe=e.useMemo(()=>{const{timeStart:e,timeEnd:t,deviceTypes:s,nodeIds:a}=je,n=null!==e||null!==t,l=s.size>0,i=a.size>0;if(!n&&!l&&!i)return N;const{hashToType:r,prefixToType:o}=Ke;let c=null;if(i){c=new Set;for(const e of a)c.add(W(e))}const d=e??Ve.start,m=t??Ve.end;return N.filter(e=>{if(n&&(e.timestampm))return!1;if(l){const t=e.src_hash;if(t){let a=r.get(t);if(void 0===a){const e=W(t),s=o.get(e);a=s&&"ambiguous"!==s?s:void 0}if(void 0===a&&(a=ye(e.type??e.payload_type)),!s.has(a))return!1}else{const t=ye(e.type??e.payload_type);if(!s.has(t))return!1}}if(i){const t=e.src_hash;if(!t)return!1;if(!a.has(t)){const e=W(t);if(!c.has(e))return!1}}return!0})},[N,je,Ke,Ve]);return t.jsxs(te,{children:[t.jsx(se,{title:"Statistics",icon:t.jsx(G,{}),controls:t.jsx(Z,{ranges:B,selectedIndex:Te,onSelect:Re,isPending:Ee})}),Q&&t.jsx(ee,{className:"border border-sys-red/50 bg-sys-red/10",children:t.jsx("p",{className:"text-sys-red",children:Q})}),de&&ue&&t.jsxs(ee,{className:"border border-sys-indigo/30 bg-surface/50",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"type-label",children:"Anomaly Detection Tuning"}),t.jsxs("span",{className:"type-data-xs text-fg-muted",children:["(",Fe.label,")"]})]}),t.jsx("button",{onClick:()=>fe(e=>({...e,useAbsoluteThresholds:!e.useAbsoluteThresholds})),className:"type-data-xs px-2 py-1 rounded transition-colors "+(xe.useAbsoluteThresholds?"bg-sys-indigo/30 text-sys-indigo":"bg-elevated text-fg-muted hover:text-fg-secondary"),children:xe.useAbsoluteThresholds?"Absolute dBm":"Percentile"})]}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[t.jsxs("div",{children:[t.jsx("span",{className:"type-micro",children:"Baseline"}),t.jsxs("span",{className:"ml-2 type-data-sm text-status-warning",children:[(null==(m=null==(d=Oe.debug)?void 0:d.baselineCutoff)?void 0:m.toFixed(1))??"—"," dBm"]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-micro",children:"Spike"}),t.jsxs("span",{className:"ml-2 type-data-sm text-status-warning",children:[(null==(h=null==(u=Oe.debug)?void 0:u.spikeCutoff)?void 0:h.toFixed(1))??"—"," dBm"]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-micro",children:"Mid-band"}),t.jsx("span",{className:"ml-2 type-data-sm text-sys-indigo",children:(null==(x=Oe.debug)?void 0:x.midBandSamples)??0})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-micro",children:"Anomalies"}),t.jsx("span",{className:"ml-2 type-data-sm text-status-danger",children:We.length})]})]}),t.jsxs("div",{className:"mt-4 pt-4 border-t border-edge-subtle space-y-4",children:[xe.useAbsoluteThresholds?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Baseline (",xe.baselineDbm," dBm)"]}),t.jsx("input",{type:"range",min:"-120",max:"-60",value:xe.baselineDbm,onChange:e=>fe(t=>({...t,baselineDbm:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Spike (",xe.spikeDbm," dBm)"]}),t.jsx("input",{type:"range",min:"-100",max:"-20",value:xe.spikeDbm,onChange:e=>fe(t=>({...t,spikeDbm:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",xe.mergeGapSeconds,"s)"]}),t.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:xe.mergeGapSeconds,onChange:e=>fe(t=>({...t,mergeGapSeconds:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]})]}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Min Sequence (",xe.minSequenceLength,")"]}),t.jsx("input",{type:"range",min:"2",max:"20",value:xe.minSequenceLength,onChange:e=>fe(t=>({...t,minSequenceLength:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",xe.similarityToleranceDbm," dBm)"]}),t.jsx("input",{type:"range",min:"1",max:"15",value:xe.similarityToleranceDbm,onChange:e=>fe(t=>({...t,similarityToleranceDbm:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(100*be),"%)"]}),t.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:be,onChange:e=>ve(Number(e.target.value)),className:"w-full accent-sys-indigo"})]})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Baseline (P",xe.baselinePercentile,")"]}),t.jsx("input",{type:"range",min:"1",max:"50",value:xe.baselinePercentile,onChange:e=>fe(t=>({...t,baselinePercentile:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Spike (P",xe.spikePercentile,")"]}),t.jsx("input",{type:"range",min:"50",max:"99",value:xe.spikePercentile,onChange:e=>fe(t=>({...t,spikePercentile:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",xe.mergeGapSeconds,"s)"]}),t.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:xe.mergeGapSeconds,onChange:e=>fe(t=>({...t,mergeGapSeconds:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]})]}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Min Sequence (",xe.minSequenceLength,")"]}),t.jsx("input",{type:"range",min:"2",max:"20",value:xe.minSequenceLength,onChange:e=>fe(t=>({...t,minSequenceLength:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",xe.similarityToleranceDbm," dBm)"]}),t.jsx("input",{type:"range",min:"1",max:"15",value:xe.similarityToleranceDbm,onChange:e=>fe(t=>({...t,similarityToleranceDbm:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(100*be),"%)"]}),t.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:be,onChange:e=>ve(Number(e.target.value)),className:"w-full accent-sys-indigo"})]})]})]}),t.jsxs("div",{className:"mt-4 p-3 bg-elevated radius-inner",children:[t.jsx("div",{className:"type-micro mb-1",children:"Config output"}),t.jsxs("div",{className:"type-data-sm text-status-success",children:[xe.useAbsoluteThresholds?`useAbsoluteThresholds: true, baselineDbm: ${xe.baselineDbm}, spikeDbm: ${xe.spikeDbm}`:`useAbsoluteThresholds: false, baselinePercentile: ${xe.baselinePercentile}, spikePercentile: ${xe.spikePercentile}`,", mergeGapSeconds: ",xe.mergeGapSeconds,", minSequenceLength: ",xe.minSequenceLength,", similarityToleranceDbm: ",xe.similarityToleranceDbm]})]})]})]}),t.jsxs(ae,{children:[Ee&&t.jsx(ke,{template:"auto",children:t.jsx(ee,{className:"border border-sys-blue/30 bg-sys-blue/5",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("div",{className:"relative flex h-3 w-3",children:[t.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-sys-blue opacity-75"}),t.jsx("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-sys-blue"})]}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("p",{className:"type-body-sm text-fg-primary",children:["Loading ",Fe.label," data..."]}),k.loadProgress&&t.jsxs("p",{className:"type-data-xs text-fg-muted mt-0.5",children:[k.loadProgress.loaded.toLocaleString()," packets (",k.loadProgress.percent,"%)"]})]})]})})}),J?t.jsx(ke,{template:"auto",children:t.jsx(ee,{neomorphic:!0,className:"text-center py-12",children:t.jsx("div",{className:"animate-pulse text-fg-muted",children:"Loading statistics..."})})}):t.jsxs(t.Fragment,{children:[t.jsx(ke,{template:"hero-auto",children:t.jsx(ee,{neomorphic:!0,isLoaded:w,skeletonType:"chart",children:w&&t.jsxs(t.Fragment,{children:[t.jsx(re,{icon:t.jsx(Y,{}),title:"Packet Analyzer",badge:Fe.label,badgeColor:"zinc",stackActionsOnMobile:!0,actions:t.jsxs("div",{className:"flex flex-wrap items-center gap-2 justify-end",children:["stats"===oe&&t.jsx(tt,{enabled:de,onChange:me,anomalyCount:We.length,showTuning:ue,onTuningChange:he}),t.jsx(et,{smoothing:oe,onChange:ce}),t.jsx(Ze,{mode:le,onChange:ie})]})}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(ct,{packets:Qe,allPackets:N,startTs:Ye,endTs:Ue,parentStartTs:Ve.start,parentEndTs:Ve.end,bucketCount:Je,radioConfig:_e??void 0,mode:le,smoothing:oe,noiseFloorAnomalies:We,showNoiseFloorOverlay:de,overlayOpacity:be})})]})})}),t.jsx(ke,{template:"auto",className:"relative z-10",children:t.jsx(ee,{neomorphic:!0,isLoaded:w,className:"overflow-visible",children:w&&t.jsx($t,{parentStartTs:Ve.start,parentEndTs:Ve.end,neighbors:Ge,filter:je,onChange:Se})})}),t.jsxs(ke,{template:"panel",children:[t.jsx(Me,{span:12,md:6,children:t.jsx(ee,{neomorphic:!0,isLoaded:w,skeletonType:"chart",noPadding:w,children:w&&t.jsx(wt,{children:t.jsx(bt,{neighbors:Xe,quickNeighbors:j,localLat:(null==(f=null==(p=null==b?void 0:b.config)?void 0:p.repeater)?void 0:f.latitude)??0,localLon:(null==(y=null==(g=null==b?void 0:b.config)?void 0:g.repeater)?void 0:y.longitude)??0,onStatsChange:U,title:"Link Quality",badge:Fe.label})})})}),t.jsx(Me,{span:12,md:6,children:t.jsx(ee,{neomorphic:!0,isLoaded:w,skeletonType:"chart",children:w&&t.jsxs(t.Fragment,{children:[t.jsx(re,{icon:t.jsx(Ce,{}),title:"Network Composition",badge:Fe.label,badgeColor:"zinc"}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(wt,{children:t.jsx(Nt,{neighbors:Xe})})})]})})})]}),t.jsxs(ke,{template:"panel",children:[t.jsx(Me,{span:12,md:6,children:t.jsx(St,{})}),t.jsx(Me,{span:12,md:6,children:t.jsx(Tt,{})})]}),t.jsxs(ke,{template:"panel",children:[t.jsx(Me,{span:12,md:8,children:t.jsx(ee,{neomorphic:!0,isLoaded:w,skeletonType:"chart",children:w&&t.jsxs(t.Fragment,{children:[t.jsx(re,{icon:t.jsx(L,{}),title:"RF Noise Floor",stackActionsOnMobile:!0,actions:A?t.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[t.jsxs("span",{className:"type-data-xs text-fg-muted whitespace-nowrap",children:["min ",t.jsx("span",{className:"text-fg-secondary tabular-nums",children:A.min.toFixed(0)})]}),t.jsxs("span",{className:"type-data-xs text-fg-muted whitespace-nowrap",children:["avg ",t.jsx("span",{className:"text-fg-secondary tabular-nums",children:A.avg.toFixed(0)})]}),t.jsxs("span",{className:"type-data-xs text-fg-muted whitespace-nowrap",children:["max ",t.jsx("span",{className:"text-fg-secondary tabular-nums",children:A.max.toFixed(0)})]}),t.jsx("span",{className:"type-data-xs text-fg-muted",children:"dBm"})]}):t.jsx("span",{className:"type-data-xs text-fg-muted",children:"dBm"})}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(wt,{children:t.jsx(X,{timestamps:Ie.timestamps,values:Ie.values,onStatsChange:F})})})]})})}),t.jsx(Me,{span:12,md:4,children:t.jsx(Ft,{packets:N,rangeMinutes:Le,rangeHours:Ae,timeRangeLabel:Fe.label,isLoaded:w})})]})]})]})]})}export{Ht as default}; +import{r as e,j as t,c as s}from"./vendor-react-j_fHog8x.js";import{c as a,e as n,a3 as l,aQ as i,aR as r,aS as o,an as c,aT as d,j as m,aU as u,aV as h,u as x,aW as p,aX as f,aY as g,aZ as y,a_ as b,a$ as v,ar as j,b0 as N,b1 as w,b2 as k,aC as M,b3 as S,b4 as C,aD as T,b5 as A,R as L,a5 as F,t as P,y as E,x as R,p as _,aN as D,a0 as $,z,Q as H,b6 as B,E as q,b7 as I,az as O,G as W,a2 as G,b8 as X}from"./index-BBcIGlRT.js";import{u as V}from"./usePolling-B1kG3uqm.js";import{L as Y}from"./layers-BSSTaBST.js";import{C as U,e as J}from"./easing-DWvlCTyt.js";import{E as K,A as Q,T as Z}from"./TimeRangeSelector-P4ymVxf5.js";import{a as ee,P as te,b as se,B as ae}from"./PageLayout-CYYy29Pg.js";import{D as ne}from"./DataBox-B8dpvpbW.js";import{C as le,M as ie}from"./CollisionExplorerModal-CbOUGWmc.js";import{C as re,a as oe}from"./Card-QO4sXDu0.js";import{H as ce,R as de}from"./route-lCtw8lWd.js";import{T as me}from"./triangle-alert-DH80WgOo.js";import{G as ue}from"./git-branch-CaPGs8Pg.js";import{L as he}from"./LightSparkline-BCL2qx0n.js";import{A as xe}from"./activity-_XXDiQ1M.js";import{c as pe,C as fe,m as ge,i as ye}from"./node-types-CuQMppbD.js";import{F as be}from"./funnel-Bb7d8E3s.js";import{M as ve}from"./message-square-Dq5-N0aR.js";import{S as je}from"./search-Cs3jReDi.js";import{P as Ne,f as we}from"./payload-decoders-C74LtYDG.js";import{R as ke,C as Me}from"./Grid-OFJ4oe0a.js";import{S as Se}from"./settings-2-YxRSYOZ0.js";import{N as Ce}from"./network-C6ho6RSo.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CmkNwW1A.js";import"./index-CCvUM2Hn.js";import"./copy-C_IB0gEd.js";import"./BasemapLayer-BT1oL_wV.js";import"./map-pin-FZNiPp_L.js";const Te=a("chart-line",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]),Ae=a("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),Le=a("grid-3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),Fe=a("grip",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]),Pe=a("id-card",[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]]),Ee=a("radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]),Re=a("sparkle",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}]]),_e=a("waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]),De={useAbsoluteThresholds:!0,baselinePercentile:6,spikePercentile:50,baselineDbm:-107,spikeDbm:-100,mergeGapSeconds:45,minSequenceLength:16,similarityToleranceDbm:5};function $e(e,t){if(0===e.length)return 0;const s=t/100*(e.length-1),a=Math.floor(s),n=Math.ceil(s);return a===n?e[a]:e[a]+(e[n]-e[a])*(s-a)}function ze(e){if(0===e.length)return{median:0,p90:0,p95:0,p99:0,max:0,min:0};const t=[...e].sort((e,t)=>e-t);return{median:$e(t,50),p90:$e(t,90),p95:$e(t,95),p99:$e(t,99),max:t[t.length-1],min:t[0]}}function He(e,t,s){const a=s-t;if(0===a)return"moderate";const n=(e-t)/a;return n>.66?"critical":n>.33?"severe":"moderate"}const Be=Object.entries(l).map(([e,t])=>{const s=parseInt(e,10);return{typeNum:s,key:`TYPE_${s}`,label:t}});function qe({sortedTypes:a,highlightedType:l,onTypeHover:i,aggregateShares:r,hoverData:o}){const c=e.useMemo(()=>{if(!o)return null;const e=new Map;for(const t of o.items)e.set(t.key,t.value);return e},[o]),d=null!==c,m=e.useMemo(()=>{const e=new Set(a.map(e=>e.key));return[...a.map(e=>({typeNum:e.typeNum,key:e.key,label:e.label})),...Be.filter(t=>!e.has(t.key))]},[a]);return t.jsxs("div",{className:"flex-shrink-0 pt-3 mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2 ml-9 mb-1.5 type-data-xs",children:[t.jsx("span",{className:"text-fg-muted",children:"Packet Types"}),d&&(null==o?void 0:o.timeLabel)&&t.jsx("span",{className:"text-sys-indigo tabular-nums",children:o.timeLabel})]}),t.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1 type-data-xs ml-9",onMouseLeave:()=>i(null),children:m.map(e=>{const a=n(e.typeNum),o=(null==c?void 0:c.get(e.key))??0,m=r.get(e.key)??0,u=d?o:m,h=u>1e-4,x=r.has(e.key),p=l===e.key,f=l&&!p||d&&o<=1e-4||!d&&!l&&!x;return t.jsxs("div",{className:s("flex items-center gap-1.5 transition-opacity cursor-pointer hover:opacity-80",f&&"opacity-30"),onMouseEnter:()=>i(e.key),children:[t.jsx("div",{className:"shrink-0 w-3 h-3 rounded-xs",style:{backgroundColor:a}}),t.jsx("span",{className:"text-fg-secondary whitespace-nowrap",children:e.label}),h&&t.jsxs("span",{className:s("tabular-nums",d?"text-fg-primary":"text-fg-muted"),children:[(100*u).toFixed(1),"%"]})]},e.key)})})]})}const Ie='ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace';function Oe(e,t,s,a,n){const l=e.reduce((e,t)=>e+t,0);if(l<=0||0===e.length)return[];const i=e.map((e,t)=>t).sort((t,s)=>e[s]-e[t]),r=i.map(t=>e[t]),o=new Array(e.length);return We(r,i,l,t,s,a,n,o),o}function We(e,t,s,a,n,l,i,r){if(0===e.length)return;if(1===e.length)return void(r[t[0]]={x:a,y:n,w:l,h:i,index:t[0]});const o=l*i/s,c=l>=i,d=c?i:l;let m=0,u=1/0,h=0;for(let b=0;bs?a/s:s/a,n>s?n/s:s/n);if(!(l<=u))break;u=l,h=b+1,m=t}const x=d>0?m*o/d:0;let p=0;for(let b=0;b0?e[b]/m:0)*d;r[t[b]]=c?{x:a,y:n+p,w:x,h:s,index:t[b]}:{x:a+p,y:n,w:s,h:x,index:t[b]},p+=s}const f=e.slice(h),g=t.slice(h),y=s-m;c?We(f,g,y,a+x,n,l-x,i,r):We(f,g,y,a,n+x,l,i-x,r)}function Ge(e,t,s,a,l,i){for(const r of t){const t=s[r.index];if(!t)continue;const o=2*i,c=r.x*i+o/2,d=r.y*i+o/2,m=r.w*i-o,u=r.h*i-o;if(m<=0||u<=0)continue;const h=n(t.typeNum),x=null!==l&&l!==r.index;e.save(),e.globalAlpha=x?.4:1;const p=3*i;e.beginPath(),e.moveTo(c+p,d),e.lineTo(c+m-p,d),e.quadraticCurveTo(c+m,d,c+m,d+p),e.lineTo(c+m,d+u-p),e.quadraticCurveTo(c+m,d+u,c+m-p,d+u),e.lineTo(c+p,d+u),e.quadraticCurveTo(c,d+u,c,d+u-p),e.lineTo(c,d+p),e.quadraticCurveTo(c,d,c+p,d),e.closePath(),e.fillStyle=h,e.fill(),e.strokeStyle="rgba(0,0,0,0.2)",e.lineWidth=1*i,e.stroke();const f=4*i,g=r.w>36&&r.h>20,y=r.w>36&&r.h>32;if(g){const s=11*i;if(y){const n=a>0?t.size/a*100:0;e.font=`500 ${8*i}px ${Ie}`,e.fillStyle="rgba(0,0,0,0.6)",e.textBaseline="alphabetic",e.textAlign="left",e.fillText(`${n.toFixed(1)}%`,c+f,d+u-f-s)}e.font=`600 ${9*i}px ${Ie}`,e.fillStyle="rgba(0,0,0,0.85)",e.textBaseline="alphabetic",e.textAlign="left",e.fillText(t.name,c+f,d+u-f)}e.restore()}}function Xe({data:e,total:s,color:a,position:n,containerWidth:l,isAirtime:i}){if(!e||!n)return null;const r=(e.value/s*100).toFixed(1),o=l-n.x<184?Math.max(8,n.x-160-8):n.x+16;return t.jsx("div",{className:"absolute z-50 pointer-events-none",style:{left:o,top:Math.max(8,n.y-60)},children:t.jsxs("div",{className:"bg-tooltip-bg border border-edge-subtle rounded-lg px-3 py-2 shadow-xl min-w-[140px]",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:a}}),t.jsx("span",{className:"type-data-sm font-semibold text-fg-primary",children:e.name})]}),t.jsxs("div",{className:"space-y-0.5 type-data-xs text-fg-muted",children:[t.jsxs("div",{className:"flex justify-between gap-4",children:[t.jsx("span",{children:i?"Airtime":"Count"}),t.jsx("span",{className:"text-fg-primary tabular-nums font-medium",children:i?Ve(e.value):e.value.toLocaleString()})]}),t.jsxs("div",{className:"flex justify-between gap-4",children:[t.jsx("span",{children:"Share"}),t.jsxs("span",{className:"text-fg-primary tabular-nums font-medium",children:[r,"%"]})]}),t.jsxs("div",{className:"flex justify-between gap-4",children:[t.jsx("span",{children:"Total"}),t.jsx("span",{className:"text-fg-primary tabular-nums font-medium",children:i?Ve(s):s.toLocaleString()})]})]})]})})}function Ve(e){return e>=6e4?`${(e/6e4).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`}function Ye({sortedTypes:s,aggregateShares:a,mode:l="share"}){var i,r,o;const[c,d]=e.useState(null),[m,u]=e.useState(null),[h,x]=e.useState(0),[p,f]=e.useState(null),g=e.useRef(null),y=e.useRef(null),b=e.useRef([]),v="airtime"===l,j=e.useMemo(()=>s.reduce((e,t)=>e+(v?t.totalAirtime:t.totalCount),0),[s,v]),N=e.useMemo(()=>s.map((e,t)=>({name:e.label,size:v?e.totalAirtime:e.totalCount,index:t,typeNum:e.typeNum,key:e.key})),[s,v]);e.useEffect(()=>{const e=y.current;if(!e)return;const t=e.parentElement;if(!t)return;const s=t.getBoundingClientRect(),a=s.width,n=s.height;if(a<=0||n<=0)return;const l=window.devicePixelRatio||1;e.width=Math.floor(a*l),e.height=Math.floor(n*l),e.style.width=`${a}px`,e.style.height=`${n}px`;const i=Oe(N.map(e=>e.size),0,0,a,n);b.current=i;const r=e.getContext("2d");r&&(r.clearRect(0,0,e.width,e.height),Ge(r,i,N,j,c,l))},[N,j,c]),e.useEffect(()=>{const e=g.current;if(!e)return;const t=new ResizeObserver(()=>{const t=y.current;if(!t)return;const s=e.getBoundingClientRect(),a=s.width,n=s.height;if(a<=0||n<=0)return;const l=window.devicePixelRatio||1;t.width=Math.floor(a*l),t.height=Math.floor(n*l),t.style.width=`${a}px`,t.style.height=`${n}px`;const i=Oe(N.map(e=>e.size),0,0,a,n);b.current=i;const r=t.getContext("2d");r&&(r.clearRect(0,0,t.width,t.height),Ge(r,i,N,j,c,l))});return t.observe(e),()=>t.disconnect()},[N,j]);const w=e.useCallback(e=>{const t=g.current;if(!t)return;const s=t.getBoundingClientRect(),a=e.clientX-s.left,n=e.clientY-s.top,l=function(e,t,s){for(const a of e)if(t>=a.x&&t<=a.x+a.w&&s>=a.y&&s<=a.y+a.h)return a.index;return null}(b.current,a,n);d(l),null!==l?(x(s.width),u({x:a,y:n})):u(null)},[]),k=e.useCallback(()=>{d(null),u(null)},[]),M=e.useCallback(e=>{if(f(e),e){const t=N.findIndex(t=>t.key===e);d(t>=0?t:null)}else d(null)},[N]),S=null!==c?{name:(null==(i=N[c])?void 0:i.name)??"",value:(null==(r=N[c])?void 0:r.size)??0}:null,C=null!==c?n(null==(o=N[c])?void 0:o.typeNum):"";return 0===s.length||0===j?t.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[t.jsx(Y,{className:"w-6 h-6 mr-2 opacity-50"}),t.jsx("span",{children:"No packet type data available"})]}):t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex-1 min-h-0 relative",ref:g,onMouseMove:w,onMouseLeave:k,children:[t.jsx("canvas",{ref:y,className:"absolute inset-0",style:{cursor:"default"}}),t.jsx(Xe,{data:S,total:j,color:C,position:m,containerWidth:h,isAirtime:v})]}),t.jsx("div",{style:{minHeight:80},children:t.jsx(qe,{sortedTypes:s,highlightedType:p,onTypeHover:M,aggregateShares:a})})]})}function Ue(e){return e>=1e9?`${(e/1e9).toFixed(1)} Gb`:e>=1e6?`${(e/1e6).toFixed(1)} Mb`:e>=1e3?`${(e/1e3).toFixed(1)} Kb`:`${e.toFixed(0)} B`}function Je({packets:s,mode:a,startTs:n,endTs:l,radioConfig:u,bucketCount:h,lockedYMax:x,legendMinH:p}){const f=e.useMemo(()=>i(),[]),g=f.blue,y=f.red,b=f.yellow,[v,j]=e.useState(null),{trendData:N,totals:w}=e.useMemo(()=>{if(0===s.length)return{trendData:[],totals:{rxBytes:0,txBytes:0,rxAirtime:0,txAirtime:0}};const e=l-n,t=Math.min(Math.ceil(e/300),h),i=e/t,c=[];let d=0,m=0,x=0,p=0;for(const a of s){const e=a.timestamp;if(e=l)continue;const t=r(a),s=o(a,{spreadingFactor:u.sf,bandwidthHz:u.bw,codingRate:u.cr,preambleLength:u.preamble}),i={timestamp:e,rxAirtime:0,txAirtime:0,rxBytes:0,txBytes:0};a.transmitted?(i.txAirtime=s,i.txBytes=t,m+=t,p+=s):(i.rxAirtime=s,i.rxBytes=t,d+=t,x+=s),c.push(i)}c.sort((e,t)=>e.timestamp-t.timestamp);const f=new Float64Array(c.length+1),g=new Float64Array(c.length+1),y=new Float64Array(c.length+1),b=new Float64Array(c.length+1),v=new Float64Array(c.length);for(let s=0;s{let t=0,s=v.length;for(;t>>1;v[a]0?t:null,tx:s>0?s:null})}else{const t=(f[r]-f[l])/w*100,s=(g[r]-g[l])/w*100;N.push({timestamp:e,rx:t>0?t:null,tx:s>0?s:null})}}const k=2/31;let M=null;return{trendData:N.map(e=>{const t=e.rx;return null!==t&&t>0&&(M=null===M?t:k*t+(1-k)*M),{...e,rxSmooth:null!==M&&M>0?M:null}}),totals:{rxBytes:d,txBytes:m,rxAirtime:x,txAirtime:p}}},[s,n,l,h,a,u]),k=e.useMemo(()=>{if(0===N.length)return"share"===a?100:10;let e=0;for(const s of N){const t=s.rx??0,a=s.tx??0;t>e&&(e=t),a>e&&(e=a)}const t=1.1*e;return"share"===a?t<=100?100:t<=500?100*Math.ceil(t/100):t<=1e3?200*Math.ceil(t/200):t<=5e3?500*Math.ceil(t/500):t<=1e4?1e3*Math.ceil(t/1e3):5e3*Math.ceil(t/5e3):Math.max(1,Math.ceil(t))},[N,a]),M=x??k,S=e.useMemo(()=>{if(null!==v&&N[v]){const e=N[v],t=e.rx??0,s=e.tx??0;return"share"===a?{rx:Ue(t),tx:Ue(s),total:Ue(t+s),isHovered:!0}:{rx:`${t.toFixed(2)}%`,tx:`${s.toFixed(2)}%`,total:`${(t+s).toFixed(2)}%`,isHovered:!0}}if("share"===a)return{rx:Ue(w.rxBytes),tx:Ue(w.txBytes),total:Ue(w.rxBytes+w.txBytes),isHovered:!1};{let e=0,t=0,s=0;for(const l of N)null===l.rx&&null===l.tx||(e+=l.rx??0,t+=l.tx??0,s++);const a=s>0?e/s:0,n=s>0?t/s:0;return{rx:`${a.toFixed(2)}%`,tx:`${n.toFixed(2)}%`,total:`${(a+n).toFixed(2)}%`,isHovered:!1}}},[v,N,w,a]),C=e.useMemo(()=>{const e=l-n,t=e/3600;return[0,.25,.5,.75,1].map(s=>{const a=new Date(1e3*(n+e*s)),l=a.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),i=a.toLocaleDateString([],{weekday:"short"});return{pct:s,label:t>24?`${i} ${l}`:l,mobileHidden:.25===s||.75===s}})},[n,l]),T=e.useCallback(e=>{j(e)},[]);return 0===N.length?t.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[t.jsx(Y,{className:"w-6 h-6 mr-2 opacity-50"}),t.jsx("span",{children:"No packet data available"})]}):t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex-1 min-h-0 relative",children:[t.jsx("div",{className:"absolute top-0 left-0 right-0 z-10 flex items-center text-fg-secondary",style:{height:20,paddingLeft:44,paddingRight:8},children:t.jsx("div",{className:"relative w-full h-full flex items-center",children:C.map((e,s)=>t.jsxs("div",{className:"absolute flex items-center gap-0.5 sm:gap-1 type-data-xs "+(e.mobileHidden?"hidden sm:flex":""),style:{left:100*e.pct+"%",transform:0===e.pct?"translateX(0)":1===e.pct?"translateX(-100%)":"translateX(-50%)"},children:[t.jsx(c,{className:"w-2.5 h-2.5 opacity-60 hidden sm:block"}),t.jsx("span",{className:"tabular-nums",children:e.label})]},s))})}),t.jsx("div",{className:"absolute inset-0 rounded-lg overflow-hidden",style:{paddingTop:20},children:t.jsx(d,{data:N,yAxisMode:"share"===a?"share":"airtime",yMax:M,onHover:T,startTs:n,endTs:l})})]}),t.jsxs("div",{className:"flex items-center justify-between mt-1.5 sm:mt-2",style:{minHeight:p},children:[t.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 type-data-xs pl-2 sm:pl-11",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("div",{className:"w-3 sm:w-4 h-0.5",style:{backgroundColor:g}}),t.jsx("span",{className:"text-fg-secondary",children:"RX"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("div",{className:"w-3 sm:w-4 h-0.5",style:{backgroundColor:y}}),t.jsx("span",{className:"text-fg-secondary",children:"TX"})]}),t.jsxs("div",{className:"hidden sm:flex items-center gap-1.5",children:[t.jsx("div",{className:"w-4 h-0.5",style:{backgroundColor:b}}),t.jsx("span",{className:"text-fg-secondary",children:"Avg"})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-4 sm:gap-8",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx("div",{className:"type-data-xl text-fg-primary",children:S.rx}),t.jsx(m,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"RX"})]}),t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx("div",{className:"type-data-xl text-fg-primary",children:S.tx}),t.jsx(m,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"TX"})]})]})]})]})}const Ke=u;function Qe({mode:s,packets:a,startTs:n,endTs:l,radioConfig:i,sortedTypes:c,aggregateShares:d,noiseFloorAnomalies:m,showNoiseFloorOverlay:u,overlayOpacity:x=.5,startLabel:p,endLabel:f,yAxisPad:g=28,lockedYMax:y,legendMinH:b}){const[v,j]=e.useState(null),[N,w]=e.useState(null),k=e.useMemo(()=>(l-n)/3600,[n,l]),M=e.useCallback(e=>{w(e)},[]),S=function(t,s,a,n,l){return e.useMemo(()=>{if(0===t.length||!l)return null;const e=t.filter(e=>e.timestamp>=s&&e.timestamp<=a);if(0===e.length)return null;const i=[],c=new Map;for(const t of e){const e=t.type??t.payload_type??-1,a=r(t);let d;if(d="airtime"===n?o(t,{spreadingFactor:l.sf,bandwidthHz:l.bw,codingRate:l.cr,preambleLength:l.preamble}):1,a<=0)continue;const m=Math.floor((t.timestamp-s)/300),u={timestamp:t.timestamp,airtimeMs:d,byteSize:a,packetType:e,bucketIndex:m};i.push(u),c.has(m)||c.set(m,[]),c.get(m).push(u)}if(0===i.length)return null;const d=[],m=[],u=[],h=new Map;if("share"===n)for(const[,t]of c)for(const e of t)h.set(e,e.byteSize);else for(const[,t]of c){const e=t.reduce((e,t)=>e+t.airtimeMs,0)/3e5*100;let s=0;for(const a of t)a.airtimeMs>s&&(s=a.airtimeMs);for(const a of t){const t=a.airtimeMs/s*e;h.set(a,t)}}for(const t of i){const e=h.get(t);void 0!==e&&(d.push(e),m.push(t.timestamp),u.push(t.packetType))}let x=m[0],p=m[0];for(let t=1;tp&&(p=m[t]);const f=p-x||1,g=[...d].sort((e,t)=>e-t),y=g[0],b=g[g.length-1],v=Math.floor(.05*g.length),j=Math.floor(.5*g.length),N=Math.min(Math.ceil(.95*g.length),g.length-1),w=g[v],k=g[j],M=g[N],S=new Map;for(const t of d){const e=Math.round(100*t)/100;S.set(e,(S.get(e)??0)+1)}const C=S.size,T=[...S.entries()].sort((e,t)=>t[1]-e[1]).slice(0,5).map(([e,t])=>({value:e,count:t,percent:t/d.length*100}));let A;if("share"===n)A=200;else{const e=5,t=Math.ceil(b/e)*e;A=t<=10?10:t+e}const L=new Float32Array(2*d.length),F=new Float32Array(d.length),P=new Uint8Array(d.length),E=new Float32Array(d.length);for(let t=0;t=0?u[t]:255,E[t]=m[t]}return{points:L,rawValues:F,packetTypes:P,timestamps:E,count:d.length,minTime:x,maxTime:p,minValue:0,maxValue:A,rawMinValue:y,rawMaxValue:b,unit:"%",stats:{p5:w,p50:k,p95:M,uniqueValues:C,topValues:T}}},[t,s,a,n,l])}(a,n,l,"share"===s?"share":"airtime",i),[C,T]=e.useState(null),A=e.useCallback((e,t)=>{j(e),T(t??null)},[]),L=e.useMemo(()=>{if(null===C||!S||0===S.count)return null;const e=S.maxTime-S.minTime||1,t=S.minTime+C*e;let s;s=k>=168?75:k>=72?35:k>=24?15:k>=3?10:5;const a=60*s/2;return{start:t-a,end:t+a}},[C,S,k]),F=e.useMemo(()=>L?new Date((L.start+L.end)/2*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}):null,[L]),P=e.useMemo(()=>{if(null===v||!L)return null;const e=F??"",{start:t,end:n}=L,l=a.filter(e=>e.timestamp>=t&&e.timestamp({key:e.key,label:e.label,value:0,color:Ke(e.typeNum)}))};const r=new Map,d=new Map;let m=0,u=0;for(const s of l){const e=`TYPE_${s.type??s.payload_type??-1}`;if(r.set(e,(r.get(e)??0)+1),m++,i){const t=o(s,{spreadingFactor:i.sf,bandwidthHz:i.bw,codingRate:i.cr,preambleLength:i.preamble});d.set(e,(d.get(e)??0)+t),u+=t}}const h=c.map(e=>{let t;return t="airtime"===s?u>0?(d.get(e.key)??0)/u:0:m>0?(r.get(e.key)??0)/m:0,{key:e.key,label:e.label,value:t,color:Ke(e.typeNum)}});return{timestamp:(t+n)/2,timeLabel:e,items:h}},[v,L,F,a,c,s,i]);return S&&0!==S.count?t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex-1 min-h-0 relative",children:[t.jsx("div",{className:"absolute inset-0 rounded-lg overflow-hidden",children:t.jsx(h,{scatterData:S,yAxisMode:"share"===s?"share":"airtime",onHover:A,noiseFloorAnomalies:m,showNoiseFloorOverlay:u,overlayOpacity:x,highlightedType:N,timeRangeHours:k,yAxisMaxOverride:y})}),F&&t.jsx("div",{className:"absolute top-1 right-1 px-2 py-0.5 bg-elevated/90 rounded type-data-xs text-sys-indigo pointer-events-none",children:F}),p&&f&&t.jsxs("div",{className:"absolute bottom-0.5 left-0 right-0 flex justify-between pointer-events-none type-data-xs text-fg-muted/60",style:{paddingLeft:g},children:[t.jsx("span",{children:p}),t.jsx("span",{children:f})]})]}),t.jsx("div",{style:{minHeight:b},children:t.jsx(qe,{sortedTypes:c,highlightedType:N,onTypeHover:M,aggregateShares:d,hoverData:P})})]}):t.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[t.jsx(Y,{className:"w-6 h-6 mr-2 opacity-50"}),t.jsx("span",{children:"No packet data available"})]})}function Ze({mode:e,onChange:s}){return t.jsxs("div",{className:"toggle-group toggle-group-sm",children:[t.jsx("button",{onClick:()=>s("share"),className:"toggle-group-item "+("share"===e?"active":""),children:"Total"}),t.jsx("button",{onClick:()=>s("airtime"),className:"toggle-group-item "+("airtime"===e?"active":""),children:"Airtime"})]})}function et({smoothing:e,onChange:s}){return t.jsxs("div",{className:"toggle-group toggle-group-sm",children:[t.jsx("button",{onClick:()=>s("stats"),className:"toggle-group-item "+("stats"===e?"active":""),title:"Statistics view (scatter plot)",children:t.jsx(Fe,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>s("trend"),className:"toggle-group-item "+("trend"===e?"active":""),title:"Trend line chart",children:t.jsx(Te,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>s("ema"),className:"toggle-group-item "+("ema"===e?"active":""),title:"Stacked area (moderate smoothing)",children:t.jsx(Y,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>s("ultra"),className:"toggle-group-item "+("ultra"===e?"active":""),title:"Stacked area (heavy smoothing)",children:t.jsx(_e,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:()=>s("mosaic"),className:"toggle-group-item "+("mosaic"===e?"active":""),title:"Mosaic view (treemap)",children:t.jsx(Le,{className:"w-3.5 h-3.5"})})]})}function tt({enabled:e,onChange:s,anomalyCount:a=0,showTuning:n=!1,onTuningChange:l}){return t.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[e&&l&&t.jsx("button",{onClick:()=>l(!n),className:"toggle-group toggle-group-sm "+(n?"active":""),title:n?"Hide tuning panel":"Show tuning panel",children:t.jsx("span",{className:"toggle-group-item "+(n?"active":""),children:t.jsx(Se,{className:"w-3.5 h-3.5"})})}),t.jsx("button",{onClick:()=>s(!e),className:"toggle-group toggle-group-sm "+(e?"active":""),title:e?"Hide noise floor anomalies":"Show noise floor anomalies",children:t.jsx("span",{className:"toggle-group-item "+(e?"active":""),children:t.jsx(K,{className:"w-3.5 h-3.5"})})}),a>0&&t.jsx("span",{className:"absolute -top-2 -right-2 min-w-[18px] h-[18px] px-1 rounded-full bg-sys-red text-white text-xs font-bold flex items-center justify-center pointer-events-none z-10",children:a>99?"99+":a})]})}const st={sf:10,bw:25e4,cr:5,preamble:8};function at(e,t){const s=new Date(1e3*e),a=e=>e.toString().padStart(2,"0"),n=`${a(s.getHours())}:${a(s.getMinutes())}`;return t<=24?n:`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][s.getMonth()]} ${s.getDate()} ${n}`}function nt(e){return l[e]??`TYPE_${e.toString(16).toUpperCase()}`}function lt(e,t,s,a){const n=2*a+1;let l=0;for(let i=0;i<=a;i++)l+=e[Math.min(i,s-1)];for(let i=0;i{const e=Math.abs(s.length-T.current);if(0===e&&M.length>0)return;C.current&&clearTimeout(C.current);const t=e>100?50:500;return C.current=setTimeout(()=>{T.current=s.length,S(s)},t),()=>{C.current&&clearTimeout(C.current)}},[s,M.length]);const A=e.useMemo(()=>function(e,t){const s=new Map;for(const n of e){const e=n.type??n.payload_type??-1,a=o(n,{spreadingFactor:t.sf,bandwidthHz:t.bw,codingRate:t.cr,preambleLength:t.preamble}),l=s.get(e)??{count:0,airtime:0};s.set(e,{count:l.count+1,airtime:l.airtime+a})}const a=[];for(const[n,l]of s)a.push({typeNum:n,key:`TYPE_${n}`,label:nt(n),totalCount:l.count,totalAirtime:l.airtime});return a.sort((e,t)=>t.totalCount-e.totalCount)}(M,u),[M,u]),L=e.useMemo(()=>{if("ema"!==f&&"ultra"!==f)return 0;const e=(i-l)/m,{handleSize:t}=ot(f,e,m);return t},[f,l,i,m]),F=e.useMemo(()=>function(e,t,s,a,n,l,i=0){const r=s-t,c=r/a,d=1e3*c,m=r/3600,u=t-i*c,h=s+i*c,x=a+2*i,p=[];for(let o=0;o24?t.toLocaleDateString([],{weekday:"short",hour:"2-digit",minute:"2-digit",hour12:!1}):t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),counts:{},shares:{},airtimes:{},total:0,totalAirtime:0,bucketDurationMs:d};for(const a of l)s.counts[a.key]=0,s.airtimes[a.key]=0;p.push(s)}for(const f of e){const e=f.timestamp;if(e=h)continue;const t=Math.min(Math.floor((e-u)/c),x-1),s=`TYPE_${f.type??f.payload_type??-1}`;p[t].counts[s]=(p[t].counts[s]??0)+1,p[t].total++;const a=o(f,{spreadingFactor:n.sf,bandwidthHz:n.bw,codingRate:n.cr,preambleLength:n.preamble});p[t].airtimes[s]=(p[t].airtimes[s]??0)+a,p[t].totalAirtime+=a}for(const o of p)for(const e of l)o.shares[e.key]=o.total>0?o.counts[e.key]/o.total*100:0;return{buckets:p,visibleStart:i,visibleEnd:i+a}}(M,l,i,m,u,A,L),[M,l,i,m,u,A,L]),P=e.useMemo(()=>A.reduce((e,t)=>e+t.totalCount,0),[A]),E=e.useMemo(()=>A.reduce((e,t)=>e+t.totalAirtime,0),[A]),{sortedTypes:R,aggregateShares:_}=e.useMemo(()=>{const e=new Map,t="share"===h?P:E;if(t>0)for(const s of A){const a="share"===h?s.totalCount:s.totalAirtime;e.set(s.key,a/t)}return{sortedTypes:[...A].sort((t,s)=>(e.get(s.key)??0)-(e.get(t.key)??0)),aggregateShares:e}},[A,P,E,h]),D=e.useMemo(()=>function(e,t,s,a="ultra",n,l,i){var r;const{buckets:o,visibleStart:c,visibleEnd:d}=e,m=o.length,u=s.length,h=d-c;if(0===m||0===u)return[];const x=i&&void 0!==n&&void 0!==l?(l-n)/i:(null==(r=o[0])?void 0:r.bucketDurationMs)?o[0].bucketDurationMs/1e3:240,p=Array.from({length:u},()=>new Array(m).fill(0));for(let N=0;N0)for(let t=0;t0)for(let a=0;a0?p.map(e=>function(e,t){const s=e.length;if(0===s)return[];if(t<.5)return[...e];const a=Math.sqrt(12*t*t/3+1);let n=Math.floor(a);n%2==0&&n--;const l=n+2,i=(12*t*t-3*n*n-12*n-9)/(-4*n-4),r=Math.round(i),o=[r>0?n:l,r>1?n:l,r>2?n:l];let c=new Float32Array(e);const d=new Float32Array(s);for(const m of o){lt(c,d,s,(m-1)/2);const e=c;c=d,d.set(e)}return Array.from(c)}(e,f)):p.map(e=>function(e,t){if(0===e.length)return[];if(t<=1)return[...e];const s=e.length,a=new Float32Array(s),n=Math.floor(t/2);let l=0,i=0;for(let r=0;r<=Math.min(n,s-1);r++)l+=e[r],i++;for(let r=0;r=0&&(l-=e[t],i--),o0){const t=1/e;for(let e=0;e360?Math.ceil(h/360):1,v=Math.ceil(h/b),j=[];for(let N=0;N0){const e=1/l;for(let t=0;tN(e),[]),z=e.useCallback(e=>k(e),[]),H=e.useCallback(e=>N(e),[]),B=e.useMemo(()=>{if(null===w||!D[w])return null;const e=D[w];return{timestamp:e.timestamp,timeLabel:e.time,items:R.map(t=>({key:t.key,label:t.label,value:e[t.key]??0,color:n(t.typeNum)}))}},[w,D,R]),q=e.useMemo(()=>({timestamps:D.map(e=>e.timestamp),series:R.map(e=>({key:e.key,label:e.label,color:n(e.typeNum),values:D.map(t=>t[e.key]??0)}))}),[D,R]),I=a&&void 0!==c&&void 0!==d&&(l!==c||i!==d),O=e.useMemo(()=>{if(I&&a&&void 0!==c&&void 0!==d)return function(e,t,s,a,n){const l=Math.max(1,Math.ceil((s-t)/300));if("airtime"===a){const a=new Float64Array(l);for(const r of e){const e=r.timestamp;e=s||(a[Math.min(Math.floor((e-t)/300),l-1)]+=o(r,{spreadingFactor:n.sf,bandwidthHz:n.bw,codingRate:n.cr,preambleLength:n.preamble}))}let i=0;for(let e=0;ei&&(i=t)}return Math.max(1,Math.ceil(1.1*i))}{let a=0;for(const n of e){const e=n.timestamp;if(e=s)continue;const l=r(n);l>a&&(a=l)}return a<=200?200:50*Math.ceil(1.1*a/50)}}(a,c,d,h,u)},[I,a,c,d,h,u]);if(0===M.length)return 0===s.length?t.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[t.jsx(Y,{className:"w-6 h-6 mr-2 opacity-50"}),t.jsx("span",{children:"No packet data available"})]}):null;if("mosaic"===f)return t.jsx(Ye,{sortedTypes:R,aggregateShares:_,mode:h});const W=(i-l)/3600,G=at(l,W),X=at(i,W);return"stats"===f?t.jsx(Qe,{mode:h,packets:M,startTs:l,endTs:i,radioConfig:u,sortedTypes:R,aggregateShares:_,noiseFloorAnomalies:g,showNoiseFloorOverlay:y,overlayOpacity:b,startLabel:G,endLabel:X,yAxisPad:28,lockedYMax:O,legendMinH:80}):"trend"===f?t.jsx(Je,{packets:M,mode:h,startTs:l,endTs:i,radioConfig:u,bucketCount:m,lockedYMax:O,legendMinH:80}):t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex-1 min-h-0 relative",children:[t.jsx("div",{className:"absolute inset-0 rounded-lg overflow-hidden",children:t.jsx(p,{timestamps:q.timestamps,series:q.series,highlightedKey:j,cursorColor:v.cursor,onHover:z,onSeriesHover:H,overlayLine:null,startTs:l,endTs:i})}),t.jsxs("div",{className:"absolute bottom-0.5 left-0 right-0 flex justify-between pointer-events-none type-data-xs text-fg-muted/60",style:{paddingLeft:32},children:[t.jsx("span",{children:G}),t.jsx("span",{children:X})]})]}),t.jsx("div",{style:{minHeight:80},children:t.jsx(qe,{sortedTypes:R,highlightedType:j,onTypeHover:$,aggregateShares:_,hoverData:B})})]})}),dt={"1x":1,"2x":2,"4x":4,"8x":8,"16x":16,"36x":36},mt=[1,5,10,25,50,100,150],ut=22.5*Math.PI/180,ht=Math.sin(ut),xt=Math.cos(ut);function pt(e,t,s,a){const n=Math.PI/180,l=(a-t)*n,i=e*n,r=s*n,o=Math.sin(l)*Math.cos(r),c=Math.cos(i)*Math.sin(r)-Math.sin(i)*Math.cos(r)*Math.cos(l);return(180*Math.atan2(o,c)/Math.PI+360)%360}function ft(e,t,s,a){const n=Math.PI/180,l=(s-e)*n,i=(a-t)*n,r=Math.sin(l/2)**2+Math.cos(e*n)*Math.cos(s*n)*Math.sin(i/2)**2;return 12742*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))}const gt=[{min:10,label:"Excellent"},{min:7,label:"Very Good"},{min:4,label:"Good"},{min:1,label:"Fair+"},{min:-2,label:"Fair"},{min:-5,label:"Fair-"},{min:-8,label:"Poor"},{min:-11,label:"Bad"},{min:-1/0,label:"Critical"}];function yt(e,t){return t[j(e)]||"#808080"}const bt=e.memo(function({neighbors:s,quickNeighbors:a,localLat:n,localLon:l,onStatsChange:r,title:o,badge:c,stats:d}){const[u,h]=e.useState(null),[x,p]=e.useState(new Set),[j,N]=e.useState({width:0,height:0}),[w,k]=e.useState("1x"),[M,S]=e.useState(1),C=e.useRef(null),T=e.useRef({}),A=e.useRef(null),L=e.useRef(M);L.current=M;const F=f(),P=g(),E=y(),R=b(),_=i(),D=R?E.primary:E.secondary,$=R?.15:.4,z=R?.08:.25,H=R?_.blue:E.primary;e.useEffect(()=>{const e=A.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:s}=t.contentRect;e>0&&s>0&&N({width:e,height:s})}});t.observe(e);const s=e.getBoundingClientRect();return s.width>0&&s.height>0&&N({width:s.width,height:s.height}),()=>t.disconnect()},[]);const B=e.useMemo(()=>{const e=new Set;if(a)for(const t of a)e.add(t.hash);return e},[a]),q=e.useMemo(()=>{const e=new Map;if(a)for(const t of a)e.set(t.hash,{snr:t.avgSnr,rssi:t.avgRssi});return e},[a]),{processedNeighbors:I,maxDistance:O,totalNeighbors:W,zeroHopCount:G}=e.useMemo(()=>{const e=[];for(const[a,i]of Object.entries(s)){if(!i.latitude||!i.longitude||0===i.latitude||0===i.longitude)continue;if(!B.has(a))continue;const t=pt(n,l,i.latitude,i.longitude),s=ft(n,l,i.latitude,i.longitude),r=q.get(a);e.push({hash:a.slice(0,8),name:i.node_name||i.name||"Unknown",snr:(null==r?void 0:r.snr)??i.snr??null,rssi:(null==r?void 0:r.rssi)??i.rssi??null,bearing:t,distance:s,normalizedDistance:0,lastSeen:i.last_seen,isZeroHop:!0})}const t=1.08*(e.length>0?Math.max(...e.map(e=>e.distance)):0);return e.sort((e,t)=>(e.snr??-1/0)-(t.snr??-1/0)),{processedNeighbors:e,maxDistance:t,totalNeighbors:e.length,zeroHopCount:e.length}},[s,n,l,B,q]);e.useEffect(()=>{null==r||r({zeroHopCount:G,totalCount:W,maxDistanceKm:O})},[G,W,O]),e.useEffect(()=>{const e=dt[w],t=L.current;C.current&&cancelAnimationFrame(C.current);const s=performance.now(),a=n=>{const l=n-s,i=Math.min(l/400,1),r=J(i);S(t+(e-t)*r),C.current=i<1?requestAnimationFrame(a):null};return C.current=requestAnimationFrame(a),()=>{C.current&&cancelAnimationFrame(C.current)}},[w]);const X=O/M,V=e.useMemo(()=>mt.filter(e=>e<=1.1*X),[X]);e.useEffect(()=>{const e=[];for(const s of I){const t=T.current[s.hash];void 0!==t&&t!==s.lastSeen&&e.push(s.hash),T.current[s.hash]=s.lastSeen}if(0===e.length)return;queueMicrotask(()=>{p(t=>new Set([...t,...e]))});const t=setTimeout(()=>{p(t=>{const s=new Set(t);return e.forEach(e=>s.delete(e)),s})},600);return()=>clearTimeout(t)},[I]);const Y=0!==n&&0!==l,K=e.useMemo(()=>{const{width:e,height:t}=j,s=o?22:0,a=e/2,n=t/2+s,l=t-2*s,i=Math.min(e,l),r=Math.max(10,i/2-6);return{width:e,height:t,centerX:a,centerY:n,radius:Math.max(10,r-8),labelRadius:r}},[j,o]),{width:Q,height:Z,centerX:ee,centerY:te,radius:se,labelRadius:ae}=K,ne=e.useId(),le=e.useCallback((e,t)=>{const s=e*Math.PI/180;return{x:ee+se*t*Math.sin(s),y:te-se*t*Math.cos(s)}},[ee,te,se]),ie=e.useCallback(e=>{const t={N:0,NE:45,E:90,SE:135,S:180,SW:225,W:270,NW:315}[e]*Math.PI/180;return{x:ee+ae*Math.sin(t),y:te-ae*Math.cos(t)}},[ee,te,ae]),re=e.useCallback(e=>{h(e)},[]),oe=e.useCallback(e=>{k(e)},[]),ce=e.useCallback(e=>O<=0?0:e/O*M,[O,M]),de=e=>`${e}km`,me=e.useMemo(()=>{const e=[{x:ee,y:te-ae},{x:ee+ae*Math.SQRT1_2,y:te-ae*Math.SQRT1_2}],t=V.map(e=>{const t=e/O*M;return{km:e,scale:t,lx:ee+se*t*ht,ly:te-se*t*xt}}).filter(e=>e.scale<=1.05&&e.scale>=.02).sort((e,t)=>t.km-e.km),s=[];for(const a of t){const t=s.some(e=>{const t=e.lx-a.lx,s=e.ly-a.ly;return Math.sqrt(t*t+s*s)<28}),n=e.some(e=>{const t=e.x-a.lx,s=e.y-a.ly;return Math.sqrt(t*t+s*s)<28});t||n||s.push(a)}return s},[V,O,M,ee,te,se,ae]),ue=j.width>0&&j.height>0;return Y?0===W?t.jsxs("div",{ref:A,className:"flex flex-col items-center justify-center h-full text-fg-secondary",children:[t.jsx(U,{className:"w-8 h-8 mb-2 opacity-50"}),t.jsx("p",{children:"No nodes with location data"})]}):t.jsxs("div",{className:"flex h-full w-full overflow-hidden",children:[t.jsxs("div",{ref:A,className:"relative flex-1 min-w-0 h-full overflow-hidden",children:[o&&t.jsx("div",{className:"absolute top-0 left-0 right-0 z-20 pointer-events-none",children:t.jsx("div",{className:"flex flex-col gap-1 flex-shrink-0 px-4 pt-4 pb-2 sm:px-5 sm:pt-5",children:t.jsxs("div",{className:"flex items-center justify-between gap-2 min-h-[32px] whitespace-nowrap",children:[t.jsxs("div",{className:"flex items-center gap-3 pointer-events-auto flex-shrink-0",children:[t.jsx("span",{className:"icon-md flex items-center justify-center text-icon-card-title",children:t.jsx(U,{className:"w-4 h-4"})}),t.jsx("span",{className:"type-micro",children:o}),c&&t.jsx(m,{color:"zinc",children:c})]}),d&&t.jsx("div",{className:"pointer-events-auto hidden sm:flex items-center gap-1.5 min-w-0 overflow-hidden",children:d})]})})}),ue&&t.jsxs("svg",{width:Q,height:Z,className:"absolute inset-0 z-0",children:[t.jsxs("defs",{children:[t.jsx("style",{children:"\n @keyframes neighbor-blink-scale {\n 0%, 100% {\n transform: scale(1);\n opacity: 0;\n }\n 50% {\n transform: scale(1.3);\n opacity: 0.8;\n }\n }\n .neighbor-blink-ring {\n transform-origin: center;\n animation: neighbor-blink-scale 600ms ease-out forwards;\n }\n "}),t.jsx("clipPath",{id:ne,children:t.jsx("circle",{cx:ee,cy:te,r:se})})]}),V.map(e=>{const s=ce(e);if(s>1.05||s<.02)return null;const a=me.some(t=>t.km===e),n=ee+se*s*ht,l=te-se*s*xt;return t.jsxs("g",{children:[t.jsx("circle",{cx:ee,cy:te,r:se*s,fill:"none",stroke:D,strokeOpacity:$,strokeWidth:1}),a&&t.jsx("text",{x:n+4,y:l-2,textAnchor:"start",dominantBaseline:"auto",fill:E.secondary,fontSize:10,fontFamily:v,children:de(e)})]},`ring-${e}`)}),["N","E","S","W"].map(e=>{const s={N:0,E:90,S:180,W:270}[e]*Math.PI/180;return t.jsx("line",{x1:ee,y1:te,x2:ee+se*Math.sin(s),y2:te-se*Math.cos(s),stroke:D,strokeOpacity:$,strokeWidth:1,strokeDasharray:"4 4"},e)}),["NE","SE","SW","NW"].map(e=>{const s={NE:45,SE:135,SW:225,NW:315}[e]*Math.PI/180;return t.jsx("line",{x1:ee,y1:te,x2:ee+se*Math.sin(s),y2:te-se*Math.cos(s),stroke:D,strokeOpacity:z,strokeWidth:1,strokeDasharray:"4 4"},`diag-${e}`)}),["N","E","S","W"].map(e=>{const s=ie(e),a="E"===e?"end":"W"===e?"start":"middle",n="N"===e?"hanging":"S"===e?"auto":"middle";return t.jsx("text",{x:s.x,y:s.y,textAnchor:a,dominantBaseline:n,fill:H,fontSize:10,fontWeight:700,fontFamily:v,"aria-hidden":"true",children:e},e)}),["NE","SE","SW","NW"].map(e=>{const s=ie(e),a="NE"===e||"SE"===e?"end":"start",n="NE"===e||"NW"===e?"hanging":"auto";return t.jsx("text",{x:s.x,y:s.y,textAnchor:a,dominantBaseline:n,fill:H,fontSize:9,fontWeight:600,fontFamily:v,"aria-hidden":"true",children:e},e)}),t.jsx("circle",{cx:ee,cy:te,r:5,fill:P.chart6,stroke:R?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.2)",strokeWidth:1,role:"img","aria-label":"Local node"}),t.jsx("g",{clipPath:`url(#${ne})`,children:I.map(e=>{const s=O>0?e.distance/O*M:0;if(s>1)return null;const{x:a,y:n}=le(e.bearing,s),l=null!==e.snr?yt(e.snr,F):"#808080",i=(null==u?void 0:u.hash)===e.hash,r=x.has(e.hash);return t.jsxs("g",{role:"img","aria-label":`${e.name}: ${e.distance.toFixed(1)}km ${e.bearing.toFixed(0)}°`,children:[r&&t.jsx("circle",{cx:a,cy:n,r:10.5,fill:"none",stroke:R?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.7)",strokeWidth:2,className:"neighbor-blink-ring"}),i&&t.jsx("circle",{cx:a,cy:n,r:10.5,fill:l,opacity:.3}),t.jsx("circle",{cx:a,cy:n,r:i?7:5,fill:l,stroke:R?"rgba(0,0,0,0.5)":"rgba(0,0,0,0.25)",strokeWidth:1,style:{cursor:"pointer",transition:"r 0.15s"},onMouseEnter:()=>re(e),onMouseLeave:()=>re(null)})]},e.hash)})})]}),u&&t.jsxs("div",{className:"absolute bg-tooltip-bg border border-edge-subtle rounded-lg px-3 py-2 text-sm pointer-events-none z-10 shadow-xl",style:{left:"50%",bottom:8,transform:"translateX(-50%)"},children:[t.jsx("div",{className:"font-medium text-fg-primary",children:u.name}),t.jsx("div",{className:"type-data-xs text-fg-secondary",children:u.hash}),null!==u.snr?t.jsx("div",{className:"flex gap-3 mt-1 text-xs",children:t.jsxs("span",{children:[t.jsx("span",{className:"text-fg-secondary",children:"SNR:"})," ",t.jsxs("span",{className:"tabular-nums",style:{color:yt(u.snr,F)},children:[u.snr.toFixed(1)," dB"]}),t.jsxs("span",{className:"text-fg-secondary ml-1",children:["(",(he=u.snr,(null==(xe=gt.find(e=>he>=e.min))?void 0:xe.label)??"Critical"),")"]})]})}):t.jsx("div",{className:"text-xs text-fg-secondary mt-1",children:"No SNR data"}),t.jsxs("div",{className:"flex gap-3 text-xs",children:[t.jsxs("span",{children:[t.jsx("span",{className:"text-fg-secondary",children:"Distance:"})," ",t.jsxs("span",{className:"tabular-nums text-fg-primary",children:[u.distance.toFixed(2)," km"]})]}),t.jsxs("span",{children:[t.jsx("span",{className:"text-fg-secondary",children:"Bearing:"})," ",t.jsxs("span",{className:"tabular-nums text-fg-primary",children:[u.bearing.toFixed(0),"°"]})]})]})]})]}),t.jsx("div",{className:"flex flex-col gap-1 px-1.5 py-2 flex-shrink-0",role:"group","aria-label":"Zoom level",children:["1x","2x","4x","8x","16x","36x"].map(e=>t.jsx("button",{onClick:()=>oe(e),"aria-pressed":w===e,className:"flex flex-1 items-center justify-center min-w-[44px] sm:min-w-[32px] text-xs font-medium rounded transition-colors "+(w===e?"bg-sys-blue/20 text-sys-blue":"bg-subtle-fill/80 text-fg-secondary hover:bg-subtle-fill-strong hover:text-fg-primary"),children:e},e))})]}):t.jsxs("div",{ref:A,className:"flex flex-col items-center justify-center h-full text-fg-secondary",children:[t.jsx(U,{className:"w-8 h-8 mb-2 opacity-50"}),t.jsx("p",{children:"Local node coordinates not configured"}),t.jsx("p",{className:"text-xs mt-1",children:"Set latitude/longitude in config to enable"})]});var he,xe}),vt={repeater:"var(--sys-blue)",companion:"var(--sys-cyan)",room_server:"var(--sys-indigo)"};function jt(e){if(e.contact_type){const t=e.contact_type.toLowerCase();if("repeater"===t||"rep"===t)return"repeater";if("room server"===t||"room_server"===t||"room"===t||"server"===t)return"room_server";if("companion"===t||"client"===t||"cli"===t)return"companion"}return e.is_repeater?"repeater":"companion"}const Nt=e.memo(function({neighbors:s}){const a=e.useMemo(()=>{const e={repeater:0,companion:0,room_server:0};for(const a of Object.values(s)){const t=jt(a);e[t]=(e[t]||0)+1}const t=Object.values(e).reduce((e,t)=>e+t,0);return{items:[{label:"Repeaters",count:e.repeater,percent:0,color:vt.repeater},{label:"Companions",count:e.companion,percent:0,color:vt.companion},{label:"Room Servers",count:e.room_server,percent:0,color:vt.room_server}].map(e=>({...e,percent:t>0?e.count/t*100:0})).filter(e=>e.count>0).sort((e,t)=>t.count-e.count),total:t}},[s]);return 0===a.total?t.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted type-body-sm",children:"No neighbors discovered yet"}):t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx("div",{className:"flex-1 flex flex-col justify-evenly",children:a.items.map(e=>t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"type-data-sm text-fg-secondary",children:e.label}),t.jsxs("span",{className:"type-data-sm text-fg-secondary tabular-nums",children:[e.count," ",t.jsxs("span",{className:"text-fg-secondary/60",children:["(",e.percent.toFixed(0),"%)"]})]})]}),t.jsx("div",{className:"h-2.5 bg-elevated overflow-hidden",children:t.jsx("div",{className:"h-full transition-all duration-500 ease-out",style:{width:`${e.percent}%`,backgroundColor:e.color,minWidth:e.count>0?"4px":"0"}})})]},e.label))}),t.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-edge-subtle",children:[t.jsx("span",{className:"type-data-xs text-fg-secondary",children:"Total Nodes"}),t.jsx("span",{className:"type-data-sm text-fg-primary font-medium tabular-nums",children:a.total})]})]})});function wt({children:s,minHeight:a="100%",rootMargin:n="200px 0px",keepMounted:l=!0,className:i=""}){const r=e.useRef(null),[o,c]=e.useState(!1),[d,m]=e.useState(!1);e.useEffect(()=>{const e=r.current;if(!e)return;const t=new IntersectionObserver(([e])=>{const t=e.isIntersecting;m(t),t&&c(!0)},{rootMargin:n,threshold:0});return t.observe(e),()=>{t.disconnect()}},[n]);const u=d||l&&o;return t.jsx("div",{ref:r,className:`h-full w-full ${i}`,style:{minHeight:a},children:u?s:t.jsx("div",{className:"h-full w-full flex items-center justify-center text-fg-muted/50",children:t.jsx("div",{className:"animate-pulse text-xs",children:"Loading chart..."})})})}const kt={excellent:"text-signal-excellent",good:"text-signal-good",fair:"text-signal-fair",poor:"text-sys-blue"},Mt={excellent:"bg-signal-excellent/10",good:"bg-signal-good/10",fair:"bg-signal-fair/10",poor:"bg-sys-blue/10"};function St(){const s=N(),a=w(),[n,l]=e.useState(null),i=e.useCallback((e,t)=>{l({prefix:e,candidateHashes:t})},[]),r=e.useCallback(()=>{l(null)},[]);if(!a)return t.jsxs(ee,{neomorphic:!0,children:[t.jsx(re,{icon:t.jsx(ce,{}),title:"Prefix Conflicts"}),t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsxs("div",{className:"text-center text-fg-secondary",children:[t.jsx(k,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),t.jsx("p",{className:"type-data-xs",children:"No topology data available"}),t.jsx("p",{className:"type-data-xs opacity-70",children:"Run deep analysis to see stats"})]})})]});const o=(c=s.avgConfidence)>=.9?"excellent":c>=.7?"good":c>=.5?"fair":"poor";var c;const d=(u=s.collisionRate)<=10?"excellent":u<=25?"good":"poor";var u;const h="poor"===o||"poor"===d?"poor":"fair"===o||"fair"===d?"fair":"good"===o||"good"===d?"good":"excellent",x="excellent"===h||"good"===h?Ae:me;return t.jsxs(ee,{neomorphic:!0,className:"flex flex-col overflow-hidden",children:[t.jsx(re,{icon:t.jsx(ce,{}),title:"Prefix Conflicts",badgeColor:"zinc",actions:"poor"===h?t.jsxs(m,{color:"red",children:[t.jsx(me,{className:"w-3 h-3"}),"Needs Attention"]}):t.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full ${Mt[h]}`,children:[t.jsx(x,{className:`w-3.5 h-3.5 ${kt[h]}`}),t.jsx("span",{className:`type-data-xs font-medium ${kt[h]}`,children:"excellent"===h?"Excellent":"good"===h?"Good":"Fair"})]})}),t.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[t.jsxs("div",{className:"grid grid-cols-3 gap-1.5 sm:gap-2 py-3 sm:py-4",children:[t.jsxs("div",{className:"flex flex-col items-center cursor-help bg-subtle-fill radius-inner sm:radius-inset py-2 sm:py-3 px-1.5 sm:px-2",title:"Total unique 2-character prefixes observed in packet paths.",children:[t.jsx(Q,{value:s.totalPrefixes,className:"type-data-hero text-fg-primary",priority:"low"}),t.jsx("span",{className:"type-data-xs sm:type-data-sm text-fg-secondary mt-0.5 sm:mt-1",children:"Prefixes"})]}),t.jsxs("div",{className:"flex flex-col items-center cursor-help bg-subtle-fill radius-inner sm:radius-inset py-2 sm:py-3 px-1.5 sm:px-2",title:"Prefixes that map to exactly one known node. No disambiguation needed.",children:[t.jsx(Q,{value:s.unambiguousPrefixes,className:"type-data-hero text-fg-primary",priority:"low"}),t.jsx("span",{className:"type-data-xs sm:type-data-sm text-fg-secondary mt-0.5 sm:mt-1",children:"Unique"})]}),t.jsxs("div",{className:"flex flex-col items-center cursor-help radius-inner sm:radius-inset py-2 sm:py-3 px-1.5 sm:px-2 "+(s.collisionPrefixes>0?"bg-sys-blue/15":"bg-subtle-fill"),title:"Prefixes matching multiple known nodes. Click a prefix below to explore candidates.",children:[t.jsx(Q,{value:s.collisionPrefixes,className:"type-data-hero "+(s.collisionPrefixes>0?"text-sys-blue":"text-fg-primary"),priority:"low"}),t.jsx("span",{className:"type-data-xs sm:type-data-sm mt-0.5 sm:mt-1 "+(s.collisionPrefixes>0?"text-sys-blue":"text-fg-secondary"),children:"Conflicts"})]})]}),s.highCollisionPrefixes.length>0&&t.jsxs("div",{children:[t.jsx("div",{className:"type-data-xs text-fg-secondary mb-1.5",children:"Problem Prefixes"}),t.jsx("div",{className:"flex flex-wrap gap-1.5 content-start",children:s.highCollisionPrefixes.map(({prefix:e,candidateCount:s,candidateHashes:a})=>t.jsxs("button",{type:"button",onClick:()=>i(e,a),className:"inline-flex items-center gap-0.5 group",title:`${s} candidates - click to explore`,children:[t.jsx(ne,{children:e}),t.jsxs("span",{className:"text-fg-muted type-data-xs group-hover:text-fg-secondary transition-colors",children:["×",s]})]},e))})]}),0===s.lowConfidencePrefixes.length&&0===s.collisionPrefixes&&t.jsx("div",{className:"flex-1 flex items-center",children:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(Ae,{className:"w-3.5 h-3.5 text-signal-excellent"}),t.jsx("span",{className:"type-data-xs text-signal-excellent",children:"All prefixes uniquely identified"})]})}),t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 mt-auto pt-3",children:[t.jsxs("div",{className:"flex items-center gap-2 cursor-help",title:"Average confidence score across all disambiguated prefixes. Higher = more certain node identification.",children:[t.jsx("span",{className:"type-data-xs text-fg-secondary",children:"Confidence"}),t.jsxs("span",{className:`data-box ${kt[o]}`,children:[(100*s.avgConfidence).toFixed(1),"%"]})]}),t.jsxs("div",{className:"flex items-center gap-2 cursor-help",title:"Percentage of 2-character prefixes that match multiple known nodes. Lower is better.",children:[t.jsx("span",{className:"type-data-xs text-fg-secondary",children:"Collisions"}),t.jsxs("span",{className:`data-box ${kt[d]}`,children:[s.collisionRate.toFixed(1),"%"]})]})]})]}),t.jsx(le,{isOpen:!!n,prefix:(null==n?void 0:n.prefix)||"",candidateHashes:(null==n?void 0:n.candidateHashes)||[],onClose:r})]})}function Ct({icon:e,label:s,value:a,sublabel:n,highlight:l,tooltip:i}){return t.jsxs("div",{className:"flex items-center justify-between gap-2 py-1.5 "+(i?"cursor-help":""),title:i,children:[t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 min-w-0",children:[t.jsx("span",{className:"icon-xs text-icon-widget flex-shrink-0",children:e}),t.jsx("span",{className:"type-body-sm text-fg-secondary truncate",children:s})]}),t.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5 flex-shrink-0",children:[t.jsx("span",{className:"data-box",style:l?{"--data-box-color":"var(--sys-blue)"}:void 0,children:a}),n&&t.jsx("span",{className:"type-data-xs text-fg-secondary hidden sm:inline",children:n})]})]})}function Tt(){const e=M(),s=S().length;if(!e||0===e.totalPaths)return null;const{totalPaths:a,pathsWithGhosts:n,observationOverrideCount:l,tracePacketsProcessed:i,pathPacketsProcessed:r,distantEdgesDiscovered:o,duplicateGroupsFound:c,duplicatePathsUnique:d,echolocationEdgesInferred:m}=e,u=a>0?((a-n)/a*100).toFixed(1):"0",h=a>0?(l/a*100).toFixed(1):"0",x=i+r,p=x>0||o>0,f=c>0||m>0;return t.jsxs(ee,{neomorphic:!0,children:[t.jsx(re,{title:"Path Decoder",icon:t.jsx(de,{}),badge:s>0?`${s} hidden`:void 0,badgeColor:"zinc"}),t.jsxs(oe,{children:[t.jsxs("div",{children:[t.jsx(Ct,{icon:t.jsx(Pe,{className:"w-3.5 h-3.5"}),label:"Traceable",value:`${u}%`,sublabel:`of ${a.toLocaleString()} paths`,tooltip:"Percentage of packet journeys where every hop was identified. Higher = better visibility into how traffic flows through your mesh."}),t.jsx(Ct,{icon:t.jsx(Re,{className:"w-3.5 h-3.5"}),label:"Learning Rate",value:`${h}%`,sublabel:"adapted",tooltip:"How often real traffic patterns improved our predictions over geography alone. Higher values mean the decoder is learning your mesh's actual behavior — which routes are preferred, which nodes are most active."})]}),p&&t.jsxs("div",{className:"mt-3",children:[t.jsx("p",{className:"type-micro mb-2",children:"Beyond Line-of-Sight"}),t.jsxs("div",{children:[t.jsx(Ct,{icon:t.jsx(Ee,{className:"w-3.5 h-3.5"}),label:"Route Reports",value:x.toLocaleString(),sublabel:i>0?`(${i} TRACE)`:void 0,tooltip:"TRACE/PATH packets from distant nodes share their routing tables. This reveals connections we can't directly observe — mapping parts of the mesh we don't touch."}),t.jsx(Ct,{icon:t.jsx(ue,{className:"w-3.5 h-3.5"}),label:"Remote Links",value:o.toLocaleString(),highlight:o>0,tooltip:"Node-to-node connections discovered from route reports. These links exist outside our RF range but help complete the topology picture."})]})]}),f&&t.jsx(Ct,{icon:t.jsx(C,{className:"w-3.5 h-3.5"}),label:"Multi-Path Packets",value:c.toLocaleString(),sublabel:d>0?`(${d} routes)`:void 0,tooltip:"Packets received via multiple paths simultaneously. Like sonar, these 'echoes' reveal redundant routes — important for understanding mesh resilience."}),s>0&&t.jsx(Ct,{icon:t.jsx(T,{className:"w-3.5 h-3.5 text-sys-blue"}),label:"Ghost Repeaters",value:s,highlight:!0,tooltip:"High-confidence hidden repeaters: appear in 10+ paths, have 2+ known neighbors, ≥30% confidence, and plausible location. View them on the Contacts map."})]})]})}const At=new Set(["Duplicate","Empty payload","Path too long","Unknown"]),Lt={excellent:"bg-status-success",good:"bg-sys-blue",fair:"bg-status-warning",poor:"bg-status-danger"};function Ft({packets:s,rangeMinutes:a,rangeHours:n,timeRangeLabel:l,isLoaded:i=!0}){const r=e.useMemo(()=>function(e,t){const s=Date.now()/1e3,a=60*t,n=s-a,l=a/24,i=new Array(24).fill(0),r=new Array(24).fill(0);let o=0,c=0,d=0,m=0;for(const h of e){if("tx_local"===h.packet_origin)continue;const e=h.timestamp;if(es)continue;o++;const t=Math.min(23,Math.floor((e-n)/l));r[t]++,h.transmitted||"tx_forward"===h.packet_origin?(c++,i[t]++):(h.is_duplicate||"Duplicate"===h.drop_reason)&&d++,h.drop_reason&&At.has(h.drop_reason)&&m++}const u=[];for(let h=0;h<24;h++){const e=r[h],t=i[h];u.push({count:e>0?Math.round(t/e*100):0,timestamp:1e3*(n+h*l)})}return{totalRx:o,forwarded:c,duplicates:d,waste:m,efficiency:o>0?c/o*100:0,duplicateRate:o>0?d/o*100:0,wasteRate:o>0?m/o*100:0,sparkline:u}}(s,a),[s,a]),[o,c]=e.useState(null),d=e.useCallback(async()=>{try{const e=await A(n);e.success&&e.data&&c(e.data.count)}catch{}},[n]);e.useEffect(()=>{d()},[d]);const m=(u=r.efficiency)>=90?"excellent":u>=75?"good":u>=60?"fair":"poor";var u;const h=r.totalRx>0;return t.jsx(ee,{neomorphic:!0,isLoaded:i,skeletonType:"chart",children:i&&t.jsxs(t.Fragment,{children:[t.jsx(re,{icon:t.jsx(xe,{}),title:"Packet Health",badge:l,badgeColor:"zinc"}),t.jsx(oe,{children:t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex items-baseline gap-2",children:[t.jsxs("div",{className:"type-data-xl text-fg-primary",children:[h?t.jsx(Q,{value:Math.round(10*r.efficiency)/10,className:"font-mono tabular-nums",priority:"medium",format:{minimumFractionDigits:1,maximumFractionDigits:1}}):t.jsx("span",{className:"opacity-30",children:"—"}),t.jsx("span",{className:"type-data-sm text-fg-muted ml-0.5",children:"%"})]}),h&&t.jsx("div",{className:`w-2 h-2 rounded-full ${Lt[m]}`})]}),t.jsx("div",{className:"type-micro mb-2 cursor-help",title:"Forwarded packets / total received. CRC failures, garbled packets, and RF collisions that destroy packets before reaching software are not included in this ratio — see CRC Errors for hardware-level failures.",children:"FORWARDING RATE"}),t.jsx("div",{className:"flex-1 min-h-[28px] max-h-[48px] mb-2",children:t.jsx(he,{data:r.sparkline,width:9999,height:36,color:"var(--sys-blue)",className:"w-full"})}),t.jsxs("div",{className:"flex gap-2 sm:gap-3 mt-auto",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Dupes"}),t.jsx("div",{className:"data-box data-box-fill data-box-left",children:h?`${r.duplicateRate.toFixed(1)}%`:"—"})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"data-box-label",children:"Waste"}),t.jsx("div",{className:"data-box data-box-fill data-box-left",children:h?`${r.wasteRate.toFixed(1)}%`:"—"})]}),null!==o&&o>0&&t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"data-box-label flex items-center gap-1",children:[t.jsx(me,{className:"w-3 h-3 text-status-warning"}),"CRC"]}),t.jsx("div",{className:"data-box data-box-fill data-box-left text-status-warning",children:o})]})]})]})})]})})}function Pt(e,t){const s=new Date(1e3*e),a=e=>e.toString().padStart(2,"0"),n=`${a(s.getHours())}:${a(s.getMinutes())}`;return t<=24?n:`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][s.getMonth()]} ${s.getDate()} ${n}`}const Et=[{type:"repeater",label:"Repeater",icon:L,color:"text-sys-blue"},{type:"companion",label:"Companion",icon:ie,color:"text-fg-muted"},{type:"room_server",label:"Room",icon:ve,color:"text-sys-pink"},{type:"unknown",label:"Unknown",icon:fe,color:"text-sys-amber"}],Rt=60,_t=.005;function Dt({min:s,max:a,valueStart:n,valueEnd:l,onChange:i}){const r=e.useRef(null),[o,c]=e.useState(null),d=e.useRef({valueStart:n,valueEnd:l,min:s,max:a});d.current={valueStart:n,valueEnd:l,min:s,max:a};const m=e.useRef({offset:0,width:0}),u=a-s||1,h=u/3600,x=n??s,p=l??a,f=(x-s)/u*100,g=(p-s)/u*100,y=null!==n||null!==l,b=e.useCallback(e=>{const t=r.current.getBoundingClientRect(),s=Math.max(0,Math.min(1,(e-t.left)/t.width)),{min:a,max:n}=d.current;return Math.round(a+s*(n-a||1))},[]),v=e.useCallback((e,t)=>{t.preventDefault(),t.stopPropagation();const s=t.currentTarget;s.setPointerCapture(t.pointerId),c(e);const a=t=>{const s=b(t.clientX),{valueStart:a,valueEnd:n,min:l,max:r}=d.current,o=r-l||1;if("start"===e){const e=Math.min(s,(n??r)-Rt);i(e<=l+o*_t?null:e,n)}else{const e=Math.max(s,(a??l)+Rt);i(a,e>=r-o*_t?null:e)}},n=()=>{c(null),s.removeEventListener("pointermove",a),s.removeEventListener("pointerup",n),s.removeEventListener("pointercancel",n)};s.addEventListener("pointermove",a),s.addEventListener("pointerup",n),s.addEventListener("pointercancel",n)},[b,i]),j=e.useCallback(e=>{e.preventDefault(),e.stopPropagation();const t=e.currentTarget;t.setPointerCapture(e.pointerId),c("range");const s=d.current.valueStart??d.current.min,a=d.current.valueEnd??d.current.max;m.current={offset:b(e.clientX)-s,width:a-s};const n=e=>{const t=b(e.clientX),{min:s,max:a}=d.current,{offset:n,width:l}=m.current;let r=t-n;r=Math.max(s,Math.min(a-l,r));const o=r+l;i(Math.round(r)<=s?null:Math.round(r),Math.round(o)>=a?null:Math.round(o))},l=()=>{c(null),t.removeEventListener("pointermove",n),t.removeEventListener("pointerup",l),t.removeEventListener("pointercancel",l)};t.addEventListener("pointermove",n),t.addEventListener("pointerup",l),t.addEventListener("pointercancel",l)},[b,i]),N=e.useCallback(e=>{const t=b(e.clientX),{valueStart:s,valueEnd:a,min:n,max:l}=d.current,r=l-n||1,o=s??n,c=a??l;if(Math.abs(t-o)<=Math.abs(t-c)){const e=Math.min(t,c-Rt);i(e<=n+r*_t?null:e,a)}else{const e=Math.max(t,o+Rt);i(s,e>=l-r*_t?null:e)}},[b,i]),w=e.useCallback(()=>i(null,null),[i]),k=e.useCallback((e,t)=>{const s="ArrowRight"===t.key||"ArrowUp"===t.key?1:"ArrowLeft"===t.key||"ArrowDown"===t.key?-1:0;if(!s)return;t.preventDefault();const a=(t.shiftKey?.1:.01)*u,{valueStart:n,valueEnd:l,min:r,max:o}=d.current,c=o-r||1;if("start"===e){const e=Math.max(r,Math.min((n??r)+s*a,(l??o)-Rt));i(e<=r+c*_t?null:e,l)}else{const e=Math.min(o,Math.max((l??o)+s*a,(n??r)+Rt));i(n,e>=o-c*_t?null:e)}},[u,i]),M=e=>{const t=o===e;return["absolute top-1/2 -translate-y-1/2 -translate-x-1/2 w-1 h-4 rounded-full","before:content-[''] before:absolute before:-inset-x-3 before:-inset-y-1","touch-none outline-none",t?"cursor-grabbing":"cursor-ew-resize",t?"bg-sys-blue shadow-[0_0_8px_var(--sys-blue)] scale-x-150 z-20":("start"===e?null!==n:null!==l)?"bg-sys-blue shadow-[0_0_4px_var(--sys-blue)] hover:shadow-[0_0_8px_var(--sys-blue)] hover:scale-x-150 z-10":"bg-edge-subtle hover:bg-fg-muted hover:scale-x-150 z-10",t?"":"transition-[transform,box-shadow,background-color] duration-150 ease-out","focus-visible:ring-2 focus-visible:ring-sys-blue/50"].filter(Boolean).join(" ")};return t.jsxs("div",{className:"flex flex-col gap-0.5 min-w-[160px] sm:min-w-[220px]",children:[t.jsxs("div",{className:"flex items-center justify-between type-data-xs text-fg-muted tabular-nums select-none",children:[t.jsx("span",{className:y&&null!==n?"text-sys-blue":"",children:Pt(x,h)}),t.jsx("span",{className:y&&null!==l?"text-sys-blue":"",children:Pt(p,h)})]}),t.jsxs("div",{ref:r,className:"relative h-5 select-none",onPointerDown:N,onDoubleClick:w,children:[t.jsx("div",{className:"absolute inset-x-0 top-1/2 -translate-y-1/2 h-1.5 rounded-full bg-white/[0.06] pointer-events-none"}),y?t.jsx("div",{className:["group/band absolute inset-y-0 touch-none","range"===o?"cursor-grabbing":"cursor-grab"].join(" "),style:{left:`${f}%`,right:100-g+"%"},onPointerDown:j,children:t.jsx("div",{className:["absolute inset-x-0 top-1/2 -translate-y-1/2 h-1.5 rounded-full pointer-events-none transition-colors","range"===o?"bg-sys-blue/40":"bg-sys-blue/25 group-hover/band:bg-sys-blue/35"].join(" ")})}):t.jsx("div",{className:"absolute inset-x-0 top-1/2 -translate-y-1/2 h-1.5 rounded-full bg-white/[0.04] pointer-events-none"}),t.jsx("div",{role:"slider",tabIndex:0,"aria-label":"Range start","aria-valuenow":x,className:M("start"),style:{left:`${f}%`},onPointerDown:e=>v("start",e),onKeyDown:e=>k("start",e)}),t.jsx("div",{role:"slider",tabIndex:0,"aria-label":"Range end","aria-valuenow":p,className:M("end"),style:{left:`${g}%`},onPointerDown:e=>v("end",e),onKeyDown:e=>k("end",e)})]})]})}function $t({parentStartTs:s,parentEndTs:a,neighbors:n,filter:l,onChange:i}){const[r,o]=e.useState(""),[c,d]=e.useState(!1),m=e.useRef(null);e.useEffect(()=>{function e(e){m.current&&!m.current.contains(e.target)&&d(!1)}if(c)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[c]);const u=e.useMemo(()=>Object.entries(n).map(([e,t])=>{const s=pe(t);return{hash:e,name:t.name??t.node_name??e.slice(0,8),type:s.type,label:s.label}}).sort((e,t)=>e.name.localeCompare(t.name)),[n]),h=e.useMemo(()=>{if(!r)return u;const e=r.toLowerCase();return u.filter(t=>t.name.toLowerCase().includes(e)||t.hash.toLowerCase().includes(e))},[u,r]),x=null!==l.timeStart||null!==l.timeEnd||l.deviceTypes.size>0||l.nodeIds.size>0,p=e.useCallback((e,t)=>{i({...l,timeStart:e,timeEnd:t})},[l,i]),f=e.useCallback(e=>{const t=new Set(l.deviceTypes);t.has(e)?t.delete(e):t.add(e),i({...l,deviceTypes:t})},[l,i]),g=e.useCallback(e=>{const t=new Set(l.nodeIds);t.has(e)?t.delete(e):t.add(e),i({...l,nodeIds:t}),o("")},[l,i]),y=e.useCallback(e=>{const t=new Set(l.nodeIds);t.delete(e),i({...l,nodeIds:t})},[l,i]),b=e.useCallback(()=>{i({timeStart:null,timeEnd:null,deviceTypes:new Set,nodeIds:new Set}),o("")},[i]),v=e.useMemo(()=>{const e=new Map;for(const t of l.nodeIds){const s=n[t];e.set(t,(null==s?void 0:s.name)??(null==s?void 0:s.node_name)??t.slice(0,8))}return e},[l.nodeIds,n]);return t.jsxs("div",{className:"flex flex-col gap-1.5 px-3 py-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-fg-muted shrink-0",children:[t.jsx(be,{className:"w-3.5 h-3.5"}),t.jsx("span",{className:"type-data-xs font-medium",children:"Filter"})]}),t.jsx(Dt,{min:s,max:a,valueStart:l.timeStart,valueEnd:l.timeEnd,onChange:p}),t.jsx("div",{className:"w-px h-4 bg-edge-subtle shrink-0 hidden sm:block"}),t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:Et.map(({type:e,label:s,icon:a,color:n})=>{const i=l.deviceTypes.has(e);return t.jsxs("button",{type:"button",onClick:()=>f(e),className:`\n flex items-center gap-1 px-2 py-0.5 rounded-full type-data-xs transition-colors\n ${i?"bg-sys-blue/20 text-sys-blue border border-sys-blue/40":"bg-transparent text-fg-muted border border-edge-subtle hover:border-fg-muted/40"}\n `,title:`Filter by ${s}`,children:[t.jsx(a,{className:`w-3 h-3 ${i?"text-sys-blue":n}`}),t.jsx("span",{className:"hidden sm:inline",children:s})]},e)})}),t.jsx("div",{className:"w-px h-4 bg-edge-subtle shrink-0 hidden sm:block"}),t.jsxs("div",{className:"relative flex items-center gap-1.5 flex-1 min-w-[140px] px-2 py-0.5 rounded-md border border-edge-subtle bg-white/[0.03] transition-colors focus-within:border-sys-blue",ref:m,children:[t.jsx(je,{className:"w-3 h-3 text-fg-muted/50 shrink-0"}),t.jsx("input",{type:"text",className:"flex-1 min-w-[80px] type-data-xs py-0.5 bg-transparent text-fg-secondary placeholder:text-fg-muted/40 border-none focus:outline-none",placeholder:"Search nodes...",value:r,onChange:e=>{o(e.target.value),d(!0)},onFocus:()=>d(!0)}),c&&h.length>0&&t.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 z-[200] surface-popover border border-edge-subtle radius-inner max-h-48 overflow-y-auto",children:h.slice(0,20).map(e=>{const s=l.nodeIds.has(e.hash);return t.jsxs("button",{type:"button",onClick:()=>g(e.hash),className:`\n w-full flex items-center gap-2 px-2.5 py-1.5 type-data-xs text-left transition-colors\n ${s?"bg-sys-indigo/15 text-sys-indigo":"text-fg-secondary hover:bg-subtle-fill"}\n `,children:[t.jsx("span",{className:"flex-1 truncate",children:e.name}),t.jsx("span",{className:"text-fg-muted type-data-xs shrink-0",children:e.label})]},e.hash)})})]}),x&&t.jsxs("button",{type:"button",onClick:b,className:"flex items-center gap-1 px-2 py-0.5 rounded-full type-data-xs text-fg-muted hover:text-fg-primary border border-edge-subtle hover:border-fg-muted/40 transition-colors shrink-0",title:"Clear all filters",children:[t.jsx(F,{className:"w-3 h-3"}),"Clear"]})]}),l.nodeIds.size>0&&t.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:Array.from(l.nodeIds).map(e=>t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-sys-indigo/15 text-sys-indigo type-data-xs border border-sys-indigo/25 transition-colors hover:bg-sys-indigo/25",children:[v.get(e)??e.slice(0,8),t.jsx("button",{type:"button",onClick:()=>y(e),className:"hover:text-fg-primary transition-colors -mr-0.5",children:t.jsx(F,{className:"w-3 h-3"})})]},e))})]})}function zt(){return{timeStart:null,timeEnd:null,deviceTypes:new Set,nodeIds:new Set}}function Ht(){var s,a,n,l,i,r,o,c,d,m,u,h,x,p,f,g,y;const b=P(),v=E(),j=R(),N=_(),w=D(),k=$(),M=z(),S=H(),[C,T]=e.useState([]),[A,F]=e.useState(null),[,U]=e.useState(null),[J,K]=e.useState(!0),[Q,ne]=e.useState(null),[le,ie]=e.useState(()=>{const e=localStorage.getItem("statistics-view-mode");return"share"===e||"airtime"===e?e:"airtime"});e.useEffect(()=>{localStorage.setItem("statistics-view-mode",le)},[le]);const[oe,ce]=e.useState(()=>{const e=localStorage.getItem("statistics-smoothing-mode");return["ema","ultra","mosaic","stats","trend"].includes(e)?e:"stats"});e.useEffect(()=>{localStorage.setItem("statistics-smoothing-mode",oe)},[oe]);const[de,me]=e.useState(!1),[ue,he]=e.useState(!1),[xe,fe]=e.useState(De),[be,ve]=e.useState(.5),[je,Se]=e.useState(zt),Te=e.useMemo(()=>({0:0,1:0,2:1,3:2,4:3,5:4,6:5,7:6,8:7,9:8,10:9}[M]??3),[M]),Ae=B[Te].hours,Le=60*Ae,Fe=B[Te],Pe=I(Ae),Ee=k.isBackgroundLoading,Re=e.useCallback(e=>{S({0:1,1:2,2:3,3:4,4:5,5:6,6:7,7:8,8:9,9:10}[e]??4)},[S]),_e=e.useMemo(()=>{var e;if(!(null==(e=null==b?void 0:b.config)?void 0:e.radio))return null;const t=b.config.radio;return{sf:t.spreading_factor??10,bw:t.bandwidth??25e4,cr:t.coding_rate??5,preamble:t.preamble_length??8}},[null==(a=null==(s=null==b?void 0:b.config)?void 0:s.radio)?void 0:a.spreading_factor,null==(l=null==(n=null==b?void 0:b.config)?void 0:n.radio)?void 0:l.bandwidth,null==(r=null==(i=null==b?void 0:b.config)?void 0:i.radio)?void 0:r.coding_rate,null==(c=null==(o=null==b?void 0:b.config)?void 0:o.radio)?void 0:c.preamble_length]);e.useEffect(()=>{!async function(){var e;ne(null);try{const t=await q(Ae);t.success&&(null==(e=t.data)?void 0:e.history)&&T(t.data.history)}catch(t){ne(t instanceof Error?t.message:"Failed to load chart data")}finally{K(!1)}}()},[Ae]);const Be=e.useMemo(()=>Ae>=504?72e5:336===Ae?36e5:168===Ae?18e5:72===Ae?6e5:3e5,[Ae]),qe=e.useCallback(async()=>{var e;try{const t=await q(Ae);t.success&&(null==(e=t.data)?void 0:e.history)&&T(t.data.history)}catch{}},[Ae]);V(qe,Be,!0,!0);const Ie=e.useMemo(()=>0===C.length?{timestamps:[],values:[]}:{timestamps:C.map(e=>e.timestamp),values:C.map(e=>e.noise_floor_dbm)},[C]),Oe=e.useMemo(()=>{if(C.length<10)return{anomalies:[],debug:void 0};const e=function(e,t={}){const s={...De,...t};if(e.length<10)return{anomalies:[],thresholds:ze([]),totalSamples:e.length,anomalySamples:0};const a=e.map(e=>e.noise_floor_dbm),n=ze(a),l=[...a].sort((e,t)=>e-t);let i,r;s.useAbsoluteThresholds?(i=s.baselineDbm,r=s.spikeDbm):(i=$e(l,s.baselinePercentile),r=$e(l,s.spikePercentile));const o=[...e].sort((e,t)=>e.timestamp-t.timestamp),c=[];let d=null,m=0;for(const u of o)if(u.noise_floor_dbm>i&&u.noise_floor_dbme+t,0)/d.values.length):(d.values.length>=s.minSequenceLength&&c.push(d),d={startTs:u.timestamp,endTs:u.timestamp,values:[u.noise_floor_dbm],timestamps:[u.timestamp],rollingAvg:u.noise_floor_dbm})}else d={startTs:u.timestamp,endTs:u.timestamp,values:[u.noise_floor_dbm],timestamps:[u.timestamp],rollingAvg:u.noise_floor_dbm};else d&&d.values.length>=s.minSequenceLength&&c.push(d),d=null;return d&&d.values.length>=s.minSequenceLength&&c.push(d),0===c.length?{anomalies:[],thresholds:n,totalSamples:e.length,anomalySamples:m,debug:{baselineCutoff:i,spikeCutoff:r,midBandSamples:m}}:{anomalies:c.map(e=>{const t=Math.max(...e.values),s=e.values.reduce((e,t)=>e+t,0)/e.values.length;return{startTs:e.startTs,endTs:e.endTs,peakValue:t,avgValue:s,severity:He(s,i,r),sampleCount:e.values.length}}),thresholds:n,totalSamples:e.length,anomalySamples:m,debug:{baselineCutoff:i,spikeCutoff:r,midBandSamples:m}}}(C,xe);return{anomalies:e.anomalies,debug:e.debug}},[C,xe]),We=Oe.anomalies,Ge=e.useMemo(()=>{const e=(null==b?void 0:b.neighbors)??{};return Object.fromEntries(Object.entries(e).filter(([e])=>!v.has(e)))},[null==b?void 0:b.neighbors,v]),Xe=e.useMemo(()=>{const e=Date.now()/1e3-3600*Ae;return Object.fromEntries(Object.entries(Ge).filter(([,t])=>t.last_seen>=e))},[Ge,Ae]),Ve=e.useMemo(()=>{const e=60*Le/Pe,t=Math.floor(Date.now()/1e3),s=Math.floor(t/e)*e;return{start:s-60*Le,end:s}},[Le,Pe]),Ye=je.timeStart??Ve.start,Ue=je.timeEnd??Ve.end,Je=I((Ue-Ye)/3600),Ke=e.useMemo(()=>{const e=new Map,t=new Map,s=(null==b?void 0:b.neighbors)??{},a=new Set(Object.keys(s));for(const n of N)if((n.type??n.payload_type)===O.ADVERT&&n.src_hash&&n.raw_packet&&!a.has(n.src_hash)&&!e.has(n.src_hash))try{const t=Ne.fromHex(n.raw_packet);if(!t.success||!t.packet)continue;const s=we(t.packet.payload);if(!s)continue;const a=ge(s.nodeType);"unknown"!==a&&e.set(n.src_hash,a)}catch{}for(const[n,l]of Object.entries(s)){const s=pe(l).type;e.set(n,s);const a=W(n),i=t.get(a);void 0===i?t.set(a,s):i!==s&&t.set(a,"ambiguous")}return{hashToType:e,prefixToType:t}},[N,null==b?void 0:b.neighbors]),Qe=e.useMemo(()=>{const{timeStart:e,timeEnd:t,deviceTypes:s,nodeIds:a}=je,n=null!==e||null!==t,l=s.size>0,i=a.size>0;if(!n&&!l&&!i)return N;const{hashToType:r,prefixToType:o}=Ke;let c=null;if(i){c=new Set;for(const e of a)c.add(W(e))}const d=e??Ve.start,m=t??Ve.end;return N.filter(e=>{if(n&&(e.timestampm))return!1;if(l){const t=e.src_hash;if(t){let a=r.get(t);if(void 0===a){const e=W(t),s=o.get(e);a=s&&"ambiguous"!==s?s:void 0}if(void 0===a&&(a=ye(e.type??e.payload_type)),!s.has(a))return!1}else{const t=ye(e.type??e.payload_type);if(!s.has(t))return!1}}if(i){const t=e.src_hash;if(!t)return!1;if(!a.has(t)){const e=W(t);if(!c.has(e))return!1}}return!0})},[N,je,Ke,Ve]);return t.jsxs(te,{children:[t.jsx(se,{title:"Statistics",icon:t.jsx(G,{}),controls:t.jsx(Z,{ranges:B,selectedIndex:Te,onSelect:Re,isPending:Ee})}),Q&&t.jsx(ee,{className:"border border-sys-red/50 bg-sys-red/10",children:t.jsx("p",{className:"text-sys-red",children:Q})}),de&&ue&&t.jsxs(ee,{className:"border border-sys-indigo/30 bg-surface/50",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"type-label",children:"Anomaly Detection Tuning"}),t.jsxs("span",{className:"type-data-xs text-fg-muted",children:["(",Fe.label,")"]})]}),t.jsx("button",{onClick:()=>fe(e=>({...e,useAbsoluteThresholds:!e.useAbsoluteThresholds})),className:"type-data-xs px-2 py-1 rounded transition-colors "+(xe.useAbsoluteThresholds?"bg-sys-indigo/30 text-sys-indigo":"bg-elevated text-fg-muted hover:text-fg-secondary"),children:xe.useAbsoluteThresholds?"Absolute dBm":"Percentile"})]}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[t.jsxs("div",{children:[t.jsx("span",{className:"type-micro",children:"Baseline"}),t.jsxs("span",{className:"ml-2 type-data-sm text-status-warning",children:[(null==(m=null==(d=Oe.debug)?void 0:d.baselineCutoff)?void 0:m.toFixed(1))??"—"," dBm"]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-micro",children:"Spike"}),t.jsxs("span",{className:"ml-2 type-data-sm text-status-warning",children:[(null==(h=null==(u=Oe.debug)?void 0:u.spikeCutoff)?void 0:h.toFixed(1))??"—"," dBm"]})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-micro",children:"Mid-band"}),t.jsx("span",{className:"ml-2 type-data-sm text-sys-indigo",children:(null==(x=Oe.debug)?void 0:x.midBandSamples)??0})]}),t.jsxs("div",{children:[t.jsx("span",{className:"type-micro",children:"Anomalies"}),t.jsx("span",{className:"ml-2 type-data-sm text-status-danger",children:We.length})]})]}),t.jsxs("div",{className:"mt-4 pt-4 border-t border-edge-subtle space-y-4",children:[xe.useAbsoluteThresholds?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Baseline (",xe.baselineDbm," dBm)"]}),t.jsx("input",{type:"range",min:"-120",max:"-60",value:xe.baselineDbm,onChange:e=>fe(t=>({...t,baselineDbm:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Spike (",xe.spikeDbm," dBm)"]}),t.jsx("input",{type:"range",min:"-100",max:"-20",value:xe.spikeDbm,onChange:e=>fe(t=>({...t,spikeDbm:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",xe.mergeGapSeconds,"s)"]}),t.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:xe.mergeGapSeconds,onChange:e=>fe(t=>({...t,mergeGapSeconds:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]})]}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Min Sequence (",xe.minSequenceLength,")"]}),t.jsx("input",{type:"range",min:"2",max:"20",value:xe.minSequenceLength,onChange:e=>fe(t=>({...t,minSequenceLength:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",xe.similarityToleranceDbm," dBm)"]}),t.jsx("input",{type:"range",min:"1",max:"15",value:xe.similarityToleranceDbm,onChange:e=>fe(t=>({...t,similarityToleranceDbm:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(100*be),"%)"]}),t.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:be,onChange:e=>ve(Number(e.target.value)),className:"w-full accent-sys-indigo"})]})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Baseline (P",xe.baselinePercentile,")"]}),t.jsx("input",{type:"range",min:"1",max:"50",value:xe.baselinePercentile,onChange:e=>fe(t=>({...t,baselinePercentile:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Spike (P",xe.spikePercentile,")"]}),t.jsx("input",{type:"range",min:"50",max:"99",value:xe.spikePercentile,onChange:e=>fe(t=>({...t,spikePercentile:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",xe.mergeGapSeconds,"s)"]}),t.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:xe.mergeGapSeconds,onChange:e=>fe(t=>({...t,mergeGapSeconds:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]})]}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Min Sequence (",xe.minSequenceLength,")"]}),t.jsx("input",{type:"range",min:"2",max:"20",value:xe.minSequenceLength,onChange:e=>fe(t=>({...t,minSequenceLength:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",xe.similarityToleranceDbm," dBm)"]}),t.jsx("input",{type:"range",min:"1",max:"15",value:xe.similarityToleranceDbm,onChange:e=>fe(t=>({...t,similarityToleranceDbm:Number(e.target.value)})),className:"w-full accent-sys-indigo"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(100*be),"%)"]}),t.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:be,onChange:e=>ve(Number(e.target.value)),className:"w-full accent-sys-indigo"})]})]})]}),t.jsxs("div",{className:"mt-4 p-3 bg-elevated radius-inner",children:[t.jsx("div",{className:"type-micro mb-1",children:"Config output"}),t.jsxs("div",{className:"type-data-sm text-status-success",children:[xe.useAbsoluteThresholds?`useAbsoluteThresholds: true, baselineDbm: ${xe.baselineDbm}, spikeDbm: ${xe.spikeDbm}`:`useAbsoluteThresholds: false, baselinePercentile: ${xe.baselinePercentile}, spikePercentile: ${xe.spikePercentile}`,", mergeGapSeconds: ",xe.mergeGapSeconds,", minSequenceLength: ",xe.minSequenceLength,", similarityToleranceDbm: ",xe.similarityToleranceDbm]})]})]})]}),t.jsxs(ae,{children:[Ee&&t.jsx(ke,{template:"auto",children:t.jsx(ee,{className:"border border-sys-blue/30 bg-sys-blue/5",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("div",{className:"relative flex h-3 w-3",children:[t.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-sys-blue opacity-75"}),t.jsx("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-sys-blue"})]}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("p",{className:"type-body-sm text-fg-primary",children:["Loading ",Fe.label," data..."]}),k.loadProgress&&t.jsxs("p",{className:"type-data-xs text-fg-muted mt-0.5",children:[k.loadProgress.loaded.toLocaleString()," packets (",k.loadProgress.percent,"%)"]})]})]})})}),J?t.jsx(ke,{template:"auto",children:t.jsx(ee,{neomorphic:!0,className:"text-center py-12",children:t.jsx("div",{className:"animate-pulse text-fg-muted",children:"Loading statistics..."})})}):t.jsxs(t.Fragment,{children:[t.jsx(ke,{template:"hero-auto",children:t.jsx(ee,{neomorphic:!0,isLoaded:w,skeletonType:"chart",children:w&&t.jsxs(t.Fragment,{children:[t.jsx(re,{icon:t.jsx(Y,{}),title:"Packet Analyzer",badge:Fe.label,badgeColor:"zinc",stackActionsOnMobile:!0,actions:t.jsxs("div",{className:"flex flex-wrap items-center gap-2 justify-end",children:["stats"===oe&&t.jsx(tt,{enabled:de,onChange:me,anomalyCount:We.length,showTuning:ue,onTuningChange:he}),t.jsx(et,{smoothing:oe,onChange:ce}),t.jsx(Ze,{mode:le,onChange:ie})]})}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(ct,{packets:Qe,allPackets:N,startTs:Ye,endTs:Ue,parentStartTs:Ve.start,parentEndTs:Ve.end,bucketCount:Je,radioConfig:_e??void 0,mode:le,smoothing:oe,noiseFloorAnomalies:We,showNoiseFloorOverlay:de,overlayOpacity:be})})]})})}),t.jsx(ke,{template:"auto",className:"relative z-10",children:t.jsx(ee,{neomorphic:!0,isLoaded:w,className:"overflow-visible",children:w&&t.jsx($t,{parentStartTs:Ve.start,parentEndTs:Ve.end,neighbors:Ge,filter:je,onChange:Se})})}),t.jsxs(ke,{template:"panel",children:[t.jsx(Me,{span:12,md:6,children:t.jsx(ee,{neomorphic:!0,isLoaded:w,skeletonType:"chart",noPadding:w,children:w&&t.jsx(wt,{children:t.jsx(bt,{neighbors:Xe,quickNeighbors:j,localLat:(null==(f=null==(p=null==b?void 0:b.config)?void 0:p.repeater)?void 0:f.latitude)??0,localLon:(null==(y=null==(g=null==b?void 0:b.config)?void 0:g.repeater)?void 0:y.longitude)??0,onStatsChange:U,title:"Link Quality",badge:Fe.label})})})}),t.jsx(Me,{span:12,md:6,children:t.jsx(ee,{neomorphic:!0,isLoaded:w,skeletonType:"chart",children:w&&t.jsxs(t.Fragment,{children:[t.jsx(re,{icon:t.jsx(Ce,{}),title:"Network Composition",badge:Fe.label,badgeColor:"zinc"}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(wt,{children:t.jsx(Nt,{neighbors:Xe})})})]})})})]}),t.jsxs(ke,{template:"panel",children:[t.jsx(Me,{span:12,md:6,children:t.jsx(St,{})}),t.jsx(Me,{span:12,md:6,children:t.jsx(Tt,{})})]}),t.jsxs(ke,{template:"panel",children:[t.jsx(Me,{span:12,md:8,children:t.jsx(ee,{neomorphic:!0,isLoaded:w,skeletonType:"chart",children:w&&t.jsxs(t.Fragment,{children:[t.jsx(re,{icon:t.jsx(L,{}),title:"RF Noise Floor",stackActionsOnMobile:!0,actions:A?t.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[t.jsxs("span",{className:"type-data-xs text-fg-muted whitespace-nowrap",children:["min ",t.jsx("span",{className:"text-fg-secondary tabular-nums",children:A.min.toFixed(0)})]}),t.jsxs("span",{className:"type-data-xs text-fg-muted whitespace-nowrap",children:["avg ",t.jsx("span",{className:"text-fg-secondary tabular-nums",children:A.avg.toFixed(0)})]}),t.jsxs("span",{className:"type-data-xs text-fg-muted whitespace-nowrap",children:["max ",t.jsx("span",{className:"text-fg-secondary tabular-nums",children:A.max.toFixed(0)})]}),t.jsx("span",{className:"type-data-xs text-fg-muted",children:"dBm"})]}):t.jsx("span",{className:"type-data-xs text-fg-muted",children:"dBm"})}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(wt,{children:t.jsx(X,{timestamps:Ie.timestamps,values:Ie.values,onStatsChange:F})})})]})})}),t.jsx(Me,{span:12,md:4,children:t.jsx(Ft,{packets:N,rangeMinutes:Le,rangeHours:Ae,timeRangeLabel:Fe.label,isLoaded:w})})]})]})]})]})}export{Ht as default}; diff --git a/frontend/dist/assets/System-iTOQgR9S.js b/frontend/dist/assets/System-Bl85VsR1.js similarity index 98% rename from frontend/dist/assets/System-iTOQgR9S.js rename to frontend/dist/assets/System-Bl85VsR1.js index abd7b3dd..8cadfbc9 100644 --- a/frontend/dist/assets/System-iTOQgR9S.js +++ b/frontend/dist/assets/System-Bl85VsR1.js @@ -1 +1 @@ -import{r as e,j as s,c as t}from"./vendor-react-j_fHog8x.js";import{c as r,br as a,bk as n,d as l,f as o,bs as i,bt as c,bu as m,bv as d,bw as u,aQ as x,B as p,bx as h,by as f}from"./index-01Tx8g53.js";import{a as g,P as y,b as j,B as b}from"./PageLayout-DrvMAhys.js";import{T as v}from"./triangle-alert-DI33YyZq.js";import{C as w}from"./Card-Dr9pbVV5.js";import{a as N,A as M}from"./arrow-up-C91otjLx.js";import{N as k}from"./network-CCjpHq5M.js";import{A as R}from"./activity-DOuX3omM.js";import{R as C}from"./refresh-cw-DYbYazpH.js";import{R as S,C as F}from"./Grid-OFJ4oe0a.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CmkNwW1A.js";const _=r("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),B=r("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),P=r("thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]),$=[{pos:0,color:a(n.purple)},{pos:.25,color:a(n.indigo)},{pos:.5,color:a(n.cyan)},{pos:.75,color:a(n.amber)},{pos:1,color:a(n.red)}];function E(e){const s=Math.max(0,Math.min(1,e));let t=$[0],r=$[$.length-1];for(let l=0;l<$.length-1;l++)if(s>=$[l].pos&&s<=$[l+1].pos){t=$[l],r=$[l+1];break}const a=r.pos-t.pos,n=a>0?(s-t.pos)/a:0;return function(e,s,t){const r=2.2,a=1/r,n=Math.pow(e.r/255,r),l=Math.pow(e.g/255,r),o=Math.pow(e.b/255,r),i=Math.pow(s.r/255,r),c=Math.pow(s.g/255,r),m=Math.pow(s.b/255,r);return{r:Math.round(255*Math.pow(n+t*(i-n),a)),g:Math.round(255*Math.pow(l+t*(c-l),a)),b:Math.round(255*Math.pow(o+t*(m-o),a))}}(t.color,r.color,n)}const T=o.hero;function A(){const e=getComputedStyle(document.documentElement);return{fontFamily:e.getPropertyValue("--font-data").trim()||'"JetBrains Mono", ui-monospace, monospace',textPrimary:e.getPropertyValue("--text-primary").trim()||"#FFFFFF",textMuted:e.getPropertyValue("--text-muted").trim()||"#727272",gridColor:e.getPropertyValue("--chart-grid").trim()||"rgba(255, 255, 255, 0.06)"}}const L=e.memo(function({data:t,cpuColor:r,memoryColor:a}){const n=e.useRef(null),o=e.useRef(null),i=e.useRef([]),c=e.useRef(r),m=e.useRef(a),d=e.useRef(null),u=e.useRef(t.length);e.useLayoutEffect(()=>{c.current=r,m.current=a}),e.useEffect(()=>{d.current=A()},[]);const x=e.useMemo(()=>function(e){const s=[],t=Math.max(0,T-e.length);for(let a=0;a{i.current=x},[x]);const p=e.useMemo(()=>[x.map(e=>e.timestamp),new Array(x.length).fill(1)],[x]),h=e.useMemo(()=>({hooks:{draw:e=>{const s=d.current||A();!function(e,s,t,r,a){if(0===s.length)return;const n=e.ctx,{left:l,top:o,width:i,height:c}=e.bbox,m=window.devicePixelRatio||1;if(i<=0||c<=0)return;const d=s.length;if(0===d)return;const u=i/d,x=e=>l+(e+.5)*u,p=e=>{const s=Math.min(Math.max(e/100,0),1);return o+c*(1-s)};n.save(),n.strokeStyle=a.textPrimary,n.globalAlpha=.1,n.lineWidth=1*m,n.setLineDash([4*m,4*m]);for(const b of[25,50,75]){const e=Math.round(p(b))+.5;n.beginPath(),n.moveTo(Math.round(l),e),n.lineTo(Math.round(l+i),e),n.stroke()}n.restore(),n.save(),n.font=`bold ${10*m}px ${a.fontFamily}`,n.fillStyle=a.textMuted,n.textBaseline="middle",n.textAlign="left";const h=8*m;for(const b of[0,25,50,75,100]){const e=p(b),s=Math.max(o+h,Math.min(o+c-h,e));n.fillText(`${b}%`,4*m,s)}n.restore(),n.save();for(let b=0;b0){const e=s[d-1];(null==e?void 0:e.time)&&(n.textAlign="right",n.fillText(e.time,x(d-1),y))}n.restore()}(e,i.current,c.current,m.current,s)}}}),[]),f=e.useMemo(()=>({width:400,height:240,padding:[4,8,4,36],cursor:{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!1},y:{range:[0,100]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],plugins:[h]}),[h]);return e.useEffect(()=>{const e=n.current;if(!e||0===x.length)return;const s=u.current,r=t.length,a=Math.abs(r-s);if(!(!o.current||a>50||s>0&&a/s>.2)&&o.current)return o.current.setData(p),void(u.current=r);o.current&&o.current.destroy();const i=e.getBoundingClientRect(),c=Math.floor(i.width)||400,m=Math.floor(i.height)||240,d=new l({...f,width:c,height:m},p,e);return o.current=d,u.current=r,()=>{d.destroy(),o.current=null}},[f,p,x.length,t.length]),e.useEffect(()=>{const e=n.current;if(!e)return;const s=new ResizeObserver(e=>{const s=e[0];if(!s||!o.current)return;const{width:t,height:r}=s.contentRect;t>0&&r>0&&o.current.setSize({width:Math.floor(t),height:Math.floor(r)})});return s.observe(e),()=>{s.disconnect()}},[]),e.useEffect(()=>{o.current&&o.current.redraw()},[r,a,x]),0===t.length?s.jsx("div",{className:"flex-1 min-h-[180px] flex items-center justify-center text-fg-muted",children:"Collecting data..."}):s.jsx("div",{className:"relative flex-1 min-h-[180px]",children:s.jsx("div",{ref:n,className:"absolute inset-0 radius-inner overflow-hidden"})})}),z=e.memo(function({data:t,color:r,flipped:a=!1,fixedSlots:n}){const o=e.useRef(null),i=e.useRef(null),c=e.useRef(t),m=e.useRef(r),d=e.useRef(a),u=e.useRef(n);e.useLayoutEffect(()=>{c.current=t,m.current=r,d.current=a,u.current=n});const x=e.useMemo(()=>[Array.from({length:n},(e,s)=>s),new Array(n).fill(1)],[n]),p=e.useMemo(()=>({hooks:{draw:e=>{!function(e,s,t,r,a){const n=e.ctx,{left:l,top:o,width:i,height:c}=e.bbox;if(i<=0||c<=0)return;const m=[...Array(Math.max(0,a-s.length)).fill(0),...s.slice(-a)],d=Math.max(...m,1),u=m.length,x=i/u,p=.03*c;n.save();for(let h=0;h({width:400,height:40,padding:[0,0,0,0],legend:{show:!1},cursor:{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!1},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1,label:""}],plugins:[p]}),[p]);return e.useEffect(()=>{const e=o.current;if(!e)return;i.current&&i.current.destroy();const s=e.getBoundingClientRect(),t=Math.floor(s.width)||400,r=Math.floor(s.height)||40,a=new l({...h,width:t,height:r},x,e);return i.current=a,()=>{a.destroy(),i.current=null}},[h,x]),e.useEffect(()=>{const e=o.current;if(!e)return;const s=new ResizeObserver(e=>{const s=e[0];if(!s||!i.current)return;const{width:t,height:r}=s.contentRect;t>0&&r>0&&i.current.setSize({width:Math.floor(t),height:Math.floor(r)})});return s.observe(e),()=>{s.disconnect()}},[]),e.useEffect(()=>{i.current&&i.current.redraw()},[t,r,a]),s.jsx("div",{ref:o,className:"w-full h-full"})}),D={warning:80,danger:95},H={warning:85,danger:95},O={warning:70,danger:85},U=[{threshold:30,color:"var(--sys-cyan)"},{threshold:50,color:"var(--sys-blue)"},{threshold:65,color:"var(--sys-indigo)"},{threshold:80,color:"var(--signal-poor)"}];function G(e,s,t){const r=t-s,a={cold:(30-s)/r*100,normal:(50-s)/r*100,warm:(65-s)/r*100,hot:(80-s)/r*100};return`linear-gradient(to right, ${[{pos:0,color:"var(--sys-cyan)"},{pos:a.cold,color:"var(--sys-cyan)"},{pos:a.cold,color:"var(--sys-blue)"},{pos:a.normal,color:"var(--sys-blue)"},{pos:a.normal,color:"var(--sys-indigo)"},{pos:a.warm,color:"var(--sys-indigo)"},{pos:a.warm,color:"var(--signal-poor)"},{pos:a.hot,color:"var(--signal-poor)"},{pos:a.hot,color:"var(--sys-red)"},{pos:100,color:"var(--sys-red)"}].map(s=>{const t=e>0?s.pos/e*100:0;return`${s.color} ${Math.min(t,100)}%`}).join(", ")})`}function V(e,s){return e>=s.danger?"danger":e>=s.warning?"warning":"none"}function W(e){let s="none";for(const t of Object.values(e)){const e=V(t,O);if("danger"===e)return"danger";"warning"===e&&(s="warning")}return s}function I(e){let s,t,r;return e>=1073741824?(s=e/1073741824,t="GB/s"):e>=1048576?(s=e/1048576,t="MB/s"):e>=1024?(s=e/1024,t="KB/s"):(s=e,t="B/s"),r=s>=100?s.toFixed(0):s.toFixed(1),`${r} ${t}`}function J(e){return e>=1073741824?{value:(e/1073741824).toFixed(1),unit:"GiB"}:e>=1048576?{value:(e/1048576).toFixed(1),unit:"MiB"}:e>=1024?{value:(e/1024).toFixed(1),unit:"KiB"}:{value:String(e),unit:"B"}}const K=e.memo(function({level:e}){return"none"===e?null:s.jsxs("span",{className:t("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium","danger"===e&&"bg-sys-red/20 text-sys-red","warning"===e&&"bg-sys-indigo/20 text-sys-indigo"),children:[s.jsx(v,{className:"w-3 h-3"}),"danger"===e?"High":"Warn"]})}),X=e.memo(function({value:e,max:t=100,width:r=10,color:a="primary"}){const n=Math.min(e/t,1),l=Math.round(n*r),o=r-l,i="■".repeat(l),c="·".repeat(o),m={primary:"text-sys-blue",secondary:"text-sys-indigo",success:"text-sys-green",danger:"text-sys-red"}[a];return s.jsxs("span",{className:"font-mono text-[10px] tracking-tight",children:[s.jsx("span",{className:m,children:i}),s.jsx("span",{className:"text-fg-muted/40",children:c})]})}),Z=e.memo(function({index:e,usage:r}){const a=r>90?"danger":r>70?"secondary":"primary";return s.jsxs("div",{className:"flex items-center gap-1 type-data-xs",children:[s.jsxs("span",{className:"text-fg-muted w-5",children:["C",e]}),s.jsx(X,{value:r,width:8,color:a}),s.jsxs("span",{className:t("w-7 text-right tabular-nums",r>90?"text-sys-red":r>70?"text-sys-indigo":"text-sys-green"),children:[r.toFixed(0),"%"]})]})}),q=e.memo(function({pid:e,name:r,cpu:a,mem:n,isTopCpu:l=!1,isTopMem:o=!1}){return s.jsxs("div",{className:"flex items-center gap-2 py-1 type-data-sm hover:bg-subtle-fill -mx-1 px-1 rounded",children:[s.jsx("span",{className:"text-fg-muted w-10 sm:w-14 tabular-nums",children:e}),s.jsx("span",{className:"flex-1 truncate text-fg-primary",children:r}),s.jsx("span",{className:"hidden sm:inline-flex",children:s.jsx(X,{value:a,max:100,width:6,color:a>50?"danger":a>20?"secondary":"success"})}),s.jsx("span",{className:t("w-10 sm:w-12 text-right tabular-nums",l?"text-fg-primary":a>50?"text-sys-red":a>20?"text-sys-indigo":"text-fg-muted"),children:a.toFixed(1)}),s.jsx("span",{className:t("w-10 sm:w-12 text-right tabular-nums",o?"text-fg-primary":n>50?"text-sys-red":n>20?"text-sys-indigo":"text-fg-muted"),children:n.toFixed(1)})]})}),Q=e.memo(function({value:e,label:t,min:r=20,max:a=100}){const n=Math.min(Math.max((e-r)/(a-r)*100,0),100),l=function(e){return e<30?{text:"Cool",color:"text-sys-cyan"}:e<50?{text:"Normal",color:"text-sys-blue"}:e<65?{text:"Warm",color:"text-sys-indigo"}:e<80?{text:"Hot",color:"text-signal-poor"}:{text:"Danger",color:"text-sys-red"}}(e),o=a-r;return s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"type-data-sm text-fg-muted",children:t}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"type-data-sm text-fg-muted",children:l.text}),s.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded type-data-sm",children:[s.jsx("span",{className:l.color,children:e.toFixed(1)}),s.jsx("span",{className:"text-fg-primary",children:"°C"})]})]})]}),s.jsxs("div",{className:"relative h-3 bg-subtle-fill overflow-hidden",children:[s.jsx("div",{className:"absolute inset-y-0 left-0 transition-all duration-300 ease-out",style:{background:G(n,r,a),width:`${n}%`}}),s.jsx("div",{className:"absolute inset-0 flex items-center pointer-events-none",children:U.map(({threshold:e,color:t})=>{const a=(e-r)/o*100;return a<0||a>100?null:s.jsx("div",{className:"absolute w-px h-full",style:{left:`${a}%`,backgroundColor:t}},e)})})]})]})});e.memo(function({data:e,color:t,flipped:r=!1,fixedSlots:a}){const n=[...Array(Math.max(0,a-e.length)).fill(0),...e.slice(-a)],l=Math.max(...n,1),o=n.map(e=>0===e?0:Math.max(e/l*100,3));return s.jsx("div",{className:"w-full h-full flex items-end",style:{transform:r?"scaleY(-1)":void 0},children:o.map((e,r)=>s.jsx("div",{className:"flex-1 min-w-0",style:{height:e>0?`${e}%`:"0%",backgroundColor:e>0?t:"transparent"}},r))})});const Y=e.memo(function({networkHistory:e,txRate:t,rxRate:r,totalBytesSent:a,totalBytesRecv:n,cpuColor:l,memoryColor:o,networkSlots:i}){return s.jsxs(g,{neomorphic:!0,className:"flex flex-col",children:[s.jsx(w,{icon:s.jsx(k,{}),title:"Network",actions:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(N,{className:"w-3.5 h-3.5",style:{color:o}}),s.jsx("span",{className:"type-data-xs",style:{color:o},children:"TX"}),s.jsx("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded type-data-sm text-fg-primary",children:I(t)})]})}),s.jsxs("div",{className:"flex flex-col h-[120px]",children:[s.jsx("div",{className:"h-[60px]",children:s.jsx(z,{data:e.map((e,s,t)=>{if(0===s)return 0;const r=(e.timestamp-t[s-1].timestamp)/1e3;return r>0?(e.bytesSent-t[s-1].bytesSent)/r:0}),color:o,fixedSlots:i})}),s.jsx("div",{className:"h-[60px]",children:s.jsx(z,{data:e.map((e,s,t)=>{if(0===s)return 0;const r=(e.timestamp-t[s-1].timestamp)/1e3;return r>0?(e.bytesRecv-t[s-1].bytesRecv)/r:0}),color:l,flipped:!0,fixedSlots:i})})]}),s.jsxs("div",{className:"pt-2 flex flex-wrap justify-between items-center gap-2 type-data-sm",children:[s.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[s.jsx("span",{className:"text-fg-muted",children:"Total"}),s.jsxs("span",{className:"px-1.5 sm:px-2 py-1 bg-subtle-fill-strong rounded tabular-nums",children:[s.jsx("span",{className:"text-sys-cyan",children:J(a).value})," ",s.jsx("span",{className:"text-fg-muted",children:J(a).unit})]}),s.jsxs("span",{className:"px-1.5 sm:px-2 py-1 bg-subtle-fill-strong rounded tabular-nums",children:[s.jsx("span",{className:"text-sys-blue",children:J(n).value})," ",s.jsx("span",{className:"text-fg-muted",children:J(n).unit})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(M,{className:"w-3.5 h-3.5",style:{color:l}}),s.jsx("span",{className:"type-data-xs",style:{color:l},children:"RX"}),s.jsx("span",{className:"px-1.5 sm:px-2 py-1 bg-subtle-fill-strong rounded tabular-nums text-fg-primary",children:I(r)})]})]})]})}),ee=e.memo(function({temperatures:e}){return s.jsxs(g,{neomorphic:!0,className:"flex flex-col",children:[s.jsx(w,{icon:s.jsx(P,{}),title:"Temperature",actions:e&&s.jsx(K,{level:W(e)})}),s.jsx("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:e&&Object.keys(e).length>0?s.jsxs("div",{className:"space-y-3",children:[void 0!==e.cpu_thermal&&s.jsx(Q,{value:e.cpu_thermal,label:"CPU",min:20,max:100}),Object.entries(e).filter(([e])=>"cpu_thermal"!==e).slice(0,2).map(([e,t])=>s.jsx(Q,{value:t,label:e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),min:20,max:100},e))]}):s.jsxs("div",{className:"flex items-center justify-center text-fg-muted text-sm",children:[s.jsx(R,{className:"w-4 h-4 mr-2"}),"No sensors"]})})]})}),se=e.memo(function({usagePercent:e,used:t,available:r,memoryColor:a}){return s.jsxs(g,{neomorphic:!0,className:"flex flex-col",children:[s.jsx(w,{icon:s.jsx(R,{}),title:"Memory",actions:s.jsxs("span",{className:"px-2 py-0.5 bg-subtle-fill-strong rounded type-data",style:{color:a},children:[e.toFixed(0),"%"]})}),s.jsxs("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:[s.jsxs("div",{className:"flex gap-1 h-12",children:[s.jsx("div",{className:"h-full transition-all duration-300 bg-sys-blue",style:{width:`${e}%`}}),s.jsx("div",{className:"h-full transition-all duration-300 bg-sys-indigo",style:{width:100-e+"%"}})]}),s.jsxs("div",{className:"flex items-center justify-between type-data-xs pt-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-sys-blue"}),s.jsx("span",{className:"text-fg-muted",children:"Used"}),s.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-fg-primary",children:[(t/1048576).toFixed(0)," MB"]})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-sys-indigo"}),s.jsx("span",{className:"text-fg-muted",children:"Avail"}),s.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-fg-muted",children:[(r/1048576).toFixed(0)," MB"]})]})]})]})]})}),te=e.memo(function({usagePercent:e,used:t,free:r,cpuColor:a}){return s.jsxs(g,{neomorphic:!0,className:"flex flex-col",children:[s.jsx(w,{icon:s.jsx(B,{}),title:"Disk",actions:s.jsxs("span",{className:"px-2 py-0.5 bg-subtle-fill-strong rounded type-data",style:{color:a},children:[e.toFixed(0),"%"]})}),s.jsxs("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:[s.jsxs("div",{className:"flex gap-1 h-12",children:[s.jsx("div",{className:"h-full transition-all duration-300 bg-sys-blue",style:{width:`${e}%`}}),s.jsx("div",{className:"h-full transition-all duration-300 bg-sys-indigo",style:{width:100-e+"%"}})]}),s.jsxs("div",{className:"flex items-center justify-between type-data-xs pt-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-sys-blue"}),s.jsx("span",{className:"text-fg-muted",children:"Used"}),s.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-fg-primary",children:[(t/1073741824).toFixed(1)," GB"]})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-sys-indigo"}),s.jsx("span",{className:"text-fg-muted",children:"Free"}),s.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-fg-muted",children:[(r/1073741824).toFixed(1)," GB"]})]})]})]})]})}),re=e.memo(function({processes:e}){if(0===e.length)return null;const t=e.slice(0,10),r=Math.max(...t.map(e=>e.cpu_percent)),a=Math.max(...t.map(e=>e.memory_percent));return s.jsx(g,{neomorphic:!0,noPadding:!0,children:s.jsxs("div",{className:"px-4 py-3",children:[s.jsx(w,{icon:s.jsx(R,{}),title:"Processes"}),s.jsxs("div",{className:"flex items-center gap-2 py-1.5 type-data-sm text-fg-muted",children:[s.jsx("span",{className:"w-10 sm:w-14",children:"PID"}),s.jsx("span",{className:"flex-1",children:"Program"}),s.jsx("span",{className:"hidden sm:block w-[52px]"}),s.jsx("span",{className:"w-10 sm:w-12 text-right",children:"CPU%"}),s.jsx("span",{className:"w-10 sm:w-12 text-right",children:"MEM%"})]}),t.map(e=>s.jsx(q,{pid:e.pid,name:e.name,cpu:e.cpu_percent,mem:e.memory_percent,isTopCpu:e.cpu_percent===r&&r>0,isTopMem:e.memory_percent===a&&a>0},e.pid))]})})}),ae=o.hero;function ne(){var r;const a=i(),n=c(),l=m(),v=d(),N=u(),[M,k]=e.useState([]),[B,P]=e.useState(!1),[$,E]=e.useState([]),[T,A]=e.useState(0),[z,O]=e.useState(0),U=e.useRef(null),G=x(),W=G.blue,I=G.amber,J=function(){const[s,t]=e.useState("undefined"!=typeof window&&window.matchMedia("(max-width: 767px)").matches);return e.useEffect(()=>{const e=window.matchMedia("(max-width: 767px)");t(e.matches);const s=e=>t(e.matches);return e.addEventListener("change",s),()=>e.removeEventListener("change",s)},[]),s?o.hero:40}();return e.useEffect(()=>{if(!a)return;const e=Date.now(),s={timestamp:e,bytesRecv:a.network.bytes_recv,bytesSent:a.network.bytes_sent};if(U.current){const t=(e-U.current.timestamp)/1e3;if(t>0){const e=(s.bytesRecv-U.current.bytesRecv)/t,r=(s.bytesSent-U.current.bytesSent)/t;e>=0&&r>=0&&(A(e),O(r))}}U.current=s,E(e=>[...e,s].slice(-ae))},[a]),e.useEffect(()=>{let e=!0;const s=async()=>{var s;const t=await f();e&&t.success&&(null==(s=t.data)?void 0:s.processes)&&k(t.data.processes)};s();const t=setInterval(s,5e3);return()=>{e=!1,clearInterval(t)}},[]),s.jsxs(y,{children:[s.jsx(j,{title:"System Stats",icon:s.jsx(_,{}),controls:s.jsxs(p,{color:"muted",onClick:async()=>{var e;P(!0),await v();const s=await f();s.success&&(null==(e=s.data)?void 0:e.processes)&&k(s.data.processes),P(!1)},disabled:B,children:[s.jsx(C,{"data-slot":"icon",className:t(B&&"animate-spin")}),"Refresh"]})}),s.jsxs(b,{children:[l&&s.jsx(g,{className:"border border-sys-red/50 bg-sys-red/10",children:s.jsx("p",{className:"text-sys-red",children:l})}),n?s.jsx(g,{neomorphic:!0,className:"p-12 text-center",children:s.jsx("div",{className:"animate-pulse text-fg-muted",children:"Loading system stats..."})}):a?s.jsxs(s.Fragment,{children:[s.jsx(S,{template:"hero",children:s.jsxs(g,{neomorphic:!0,className:"pb-2 sm:pb-3",children:[s.jsx(w,{icon:s.jsx(R,{}),title:"System Resources",stackActionsOnMobile:!0,actions:s.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 flex-wrap",children:[(null==(r=a.system)?void 0:r.uptime)&&s.jsx("span",{className:"px-2 py-0.5 bg-subtle-fill rounded type-data-sm text-fg-primary",children:h(a.system.uptime)}),s.jsx(K,{level:V(a.cpu.usage_percent,D)}),s.jsx(K,{level:V(a.memory.usage_percent,H)}),s.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[s.jsx("span",{className:"type-data-sm text-fg-muted",children:"CPU"}),s.jsxs("span",{className:"text-sm sm:text-base font-mono font-semibold tabular-nums",style:{color:W},children:[a.cpu.usage_percent.toFixed(0),"%"]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[s.jsx("span",{className:"type-data-sm text-fg-muted",children:"MEM"}),s.jsxs("span",{className:"text-sm sm:text-base font-mono font-semibold tabular-nums",style:{color:I},children:[a.memory.usage_percent.toFixed(0),"%"]})]})]})}),s.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:s.jsx(L,{data:N,cpuColor:W,memoryColor:I})}),a.cpu.per_core_percent&&a.cpu.per_core_percent.length>0&&s.jsx("div",{className:"mt-3 pt-3 border-t border-edge-subtle",children:s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-8 gap-x-3 gap-y-0.5",children:a.cpu.per_core_percent.map((e,t)=>s.jsx(Z,{index:t,usage:e},t))})})]})}),s.jsxs(S,{template:"compact",children:[s.jsx(F,{span:12,md:6,children:s.jsx(Y,{networkHistory:$,txRate:z,rxRate:T,totalBytesSent:a.network.bytes_sent,totalBytesRecv:a.network.bytes_recv,cpuColor:W,memoryColor:I,networkSlots:J})}),s.jsx(F,{span:12,md:6,children:s.jsx(ee,{temperatures:a.temperatures})})]}),s.jsxs(S,{template:"compact",children:[s.jsx(F,{span:12,sm:6,children:s.jsx(se,{usagePercent:a.memory.usage_percent,used:a.memory.used,available:a.memory.available,memoryColor:I})}),s.jsx(F,{span:12,sm:6,children:s.jsx(te,{usagePercent:a.disk.usage_percent,used:a.disk.used,free:a.disk.free,cpuColor:W})})]}),s.jsx(S,{template:"auto",children:s.jsx(re,{processes:M})})]}):null]})]})}export{ne as default}; +import{r as e,j as s,c as t}from"./vendor-react-j_fHog8x.js";import{c as r,br as a,bk as n,d as l,f as o,bs as i,bt as c,bu as m,bv as d,bw as u,aQ as x,B as p,bx as h,by as f}from"./index-BBcIGlRT.js";import{a as g,P as y,b as j,B as b}from"./PageLayout-CYYy29Pg.js";import{T as v}from"./triangle-alert-DH80WgOo.js";import{C as w}from"./Card-QO4sXDu0.js";import{a as N,A as M}from"./arrow-up-B5IQoVJ5.js";import{N as k}from"./network-C6ho6RSo.js";import{A as R}from"./activity-_XXDiQ1M.js";import{R as C}from"./refresh-cw-BJopKEHj.js";import{R as S,C as F}from"./Grid-OFJ4oe0a.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CmkNwW1A.js";const _=r("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),B=r("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),P=r("thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]),$=[{pos:0,color:a(n.purple)},{pos:.25,color:a(n.indigo)},{pos:.5,color:a(n.cyan)},{pos:.75,color:a(n.amber)},{pos:1,color:a(n.red)}];function E(e){const s=Math.max(0,Math.min(1,e));let t=$[0],r=$[$.length-1];for(let l=0;l<$.length-1;l++)if(s>=$[l].pos&&s<=$[l+1].pos){t=$[l],r=$[l+1];break}const a=r.pos-t.pos,n=a>0?(s-t.pos)/a:0;return function(e,s,t){const r=2.2,a=1/r,n=Math.pow(e.r/255,r),l=Math.pow(e.g/255,r),o=Math.pow(e.b/255,r),i=Math.pow(s.r/255,r),c=Math.pow(s.g/255,r),m=Math.pow(s.b/255,r);return{r:Math.round(255*Math.pow(n+t*(i-n),a)),g:Math.round(255*Math.pow(l+t*(c-l),a)),b:Math.round(255*Math.pow(o+t*(m-o),a))}}(t.color,r.color,n)}const T=o.hero;function A(){const e=getComputedStyle(document.documentElement);return{fontFamily:e.getPropertyValue("--font-data").trim()||'"JetBrains Mono", ui-monospace, monospace',textPrimary:e.getPropertyValue("--text-primary").trim()||"#FFFFFF",textMuted:e.getPropertyValue("--text-muted").trim()||"#727272",gridColor:e.getPropertyValue("--chart-grid").trim()||"rgba(255, 255, 255, 0.06)"}}const L=e.memo(function({data:t,cpuColor:r,memoryColor:a}){const n=e.useRef(null),o=e.useRef(null),i=e.useRef([]),c=e.useRef(r),m=e.useRef(a),d=e.useRef(null),u=e.useRef(t.length);e.useLayoutEffect(()=>{c.current=r,m.current=a}),e.useEffect(()=>{d.current=A()},[]);const x=e.useMemo(()=>function(e){const s=[],t=Math.max(0,T-e.length);for(let a=0;a{i.current=x},[x]);const p=e.useMemo(()=>[x.map(e=>e.timestamp),new Array(x.length).fill(1)],[x]),h=e.useMemo(()=>({hooks:{draw:e=>{const s=d.current||A();!function(e,s,t,r,a){if(0===s.length)return;const n=e.ctx,{left:l,top:o,width:i,height:c}=e.bbox,m=window.devicePixelRatio||1;if(i<=0||c<=0)return;const d=s.length;if(0===d)return;const u=i/d,x=e=>l+(e+.5)*u,p=e=>{const s=Math.min(Math.max(e/100,0),1);return o+c*(1-s)};n.save(),n.strokeStyle=a.textPrimary,n.globalAlpha=.1,n.lineWidth=1*m,n.setLineDash([4*m,4*m]);for(const b of[25,50,75]){const e=Math.round(p(b))+.5;n.beginPath(),n.moveTo(Math.round(l),e),n.lineTo(Math.round(l+i),e),n.stroke()}n.restore(),n.save(),n.font=`bold ${10*m}px ${a.fontFamily}`,n.fillStyle=a.textMuted,n.textBaseline="middle",n.textAlign="left";const h=8*m;for(const b of[0,25,50,75,100]){const e=p(b),s=Math.max(o+h,Math.min(o+c-h,e));n.fillText(`${b}%`,4*m,s)}n.restore(),n.save();for(let b=0;b0){const e=s[d-1];(null==e?void 0:e.time)&&(n.textAlign="right",n.fillText(e.time,x(d-1),y))}n.restore()}(e,i.current,c.current,m.current,s)}}}),[]),f=e.useMemo(()=>({width:400,height:240,padding:[4,8,4,36],cursor:{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!1},y:{range:[0,100]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],plugins:[h]}),[h]);return e.useEffect(()=>{const e=n.current;if(!e||0===x.length)return;const s=u.current,r=t.length,a=Math.abs(r-s);if(!(!o.current||a>50||s>0&&a/s>.2)&&o.current)return o.current.setData(p),void(u.current=r);o.current&&o.current.destroy();const i=e.getBoundingClientRect(),c=Math.floor(i.width)||400,m=Math.floor(i.height)||240,d=new l({...f,width:c,height:m},p,e);return o.current=d,u.current=r,()=>{d.destroy(),o.current=null}},[f,p,x.length,t.length]),e.useEffect(()=>{const e=n.current;if(!e)return;const s=new ResizeObserver(e=>{const s=e[0];if(!s||!o.current)return;const{width:t,height:r}=s.contentRect;t>0&&r>0&&o.current.setSize({width:Math.floor(t),height:Math.floor(r)})});return s.observe(e),()=>{s.disconnect()}},[]),e.useEffect(()=>{o.current&&o.current.redraw()},[r,a,x]),0===t.length?s.jsx("div",{className:"flex-1 min-h-[180px] flex items-center justify-center text-fg-muted",children:"Collecting data..."}):s.jsx("div",{className:"relative flex-1 min-h-[180px]",children:s.jsx("div",{ref:n,className:"absolute inset-0 radius-inner overflow-hidden"})})}),z=e.memo(function({data:t,color:r,flipped:a=!1,fixedSlots:n}){const o=e.useRef(null),i=e.useRef(null),c=e.useRef(t),m=e.useRef(r),d=e.useRef(a),u=e.useRef(n);e.useLayoutEffect(()=>{c.current=t,m.current=r,d.current=a,u.current=n});const x=e.useMemo(()=>[Array.from({length:n},(e,s)=>s),new Array(n).fill(1)],[n]),p=e.useMemo(()=>({hooks:{draw:e=>{!function(e,s,t,r,a){const n=e.ctx,{left:l,top:o,width:i,height:c}=e.bbox;if(i<=0||c<=0)return;const m=[...Array(Math.max(0,a-s.length)).fill(0),...s.slice(-a)],d=Math.max(...m,1),u=m.length,x=i/u,p=.03*c;n.save();for(let h=0;h({width:400,height:40,padding:[0,0,0,0],legend:{show:!1},cursor:{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!1},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1,label:""}],plugins:[p]}),[p]);return e.useEffect(()=>{const e=o.current;if(!e)return;i.current&&i.current.destroy();const s=e.getBoundingClientRect(),t=Math.floor(s.width)||400,r=Math.floor(s.height)||40,a=new l({...h,width:t,height:r},x,e);return i.current=a,()=>{a.destroy(),i.current=null}},[h,x]),e.useEffect(()=>{const e=o.current;if(!e)return;const s=new ResizeObserver(e=>{const s=e[0];if(!s||!i.current)return;const{width:t,height:r}=s.contentRect;t>0&&r>0&&i.current.setSize({width:Math.floor(t),height:Math.floor(r)})});return s.observe(e),()=>{s.disconnect()}},[]),e.useEffect(()=>{i.current&&i.current.redraw()},[t,r,a]),s.jsx("div",{ref:o,className:"w-full h-full"})}),D={warning:80,danger:95},H={warning:85,danger:95},O={warning:70,danger:85},U=[{threshold:30,color:"var(--sys-cyan)"},{threshold:50,color:"var(--sys-blue)"},{threshold:65,color:"var(--sys-indigo)"},{threshold:80,color:"var(--signal-poor)"}];function G(e,s,t){const r=t-s,a={cold:(30-s)/r*100,normal:(50-s)/r*100,warm:(65-s)/r*100,hot:(80-s)/r*100};return`linear-gradient(to right, ${[{pos:0,color:"var(--sys-cyan)"},{pos:a.cold,color:"var(--sys-cyan)"},{pos:a.cold,color:"var(--sys-blue)"},{pos:a.normal,color:"var(--sys-blue)"},{pos:a.normal,color:"var(--sys-indigo)"},{pos:a.warm,color:"var(--sys-indigo)"},{pos:a.warm,color:"var(--signal-poor)"},{pos:a.hot,color:"var(--signal-poor)"},{pos:a.hot,color:"var(--sys-red)"},{pos:100,color:"var(--sys-red)"}].map(s=>{const t=e>0?s.pos/e*100:0;return`${s.color} ${Math.min(t,100)}%`}).join(", ")})`}function V(e,s){return e>=s.danger?"danger":e>=s.warning?"warning":"none"}function W(e){let s="none";for(const t of Object.values(e)){const e=V(t,O);if("danger"===e)return"danger";"warning"===e&&(s="warning")}return s}function I(e){let s,t,r;return e>=1073741824?(s=e/1073741824,t="GB/s"):e>=1048576?(s=e/1048576,t="MB/s"):e>=1024?(s=e/1024,t="KB/s"):(s=e,t="B/s"),r=s>=100?s.toFixed(0):s.toFixed(1),`${r} ${t}`}function J(e){return e>=1073741824?{value:(e/1073741824).toFixed(1),unit:"GiB"}:e>=1048576?{value:(e/1048576).toFixed(1),unit:"MiB"}:e>=1024?{value:(e/1024).toFixed(1),unit:"KiB"}:{value:String(e),unit:"B"}}const K=e.memo(function({level:e}){return"none"===e?null:s.jsxs("span",{className:t("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium","danger"===e&&"bg-sys-red/20 text-sys-red","warning"===e&&"bg-sys-indigo/20 text-sys-indigo"),children:[s.jsx(v,{className:"w-3 h-3"}),"danger"===e?"High":"Warn"]})}),X=e.memo(function({value:e,max:t=100,width:r=10,color:a="primary"}){const n=Math.min(e/t,1),l=Math.round(n*r),o=r-l,i="■".repeat(l),c="·".repeat(o),m={primary:"text-sys-blue",secondary:"text-sys-indigo",success:"text-sys-green",danger:"text-sys-red"}[a];return s.jsxs("span",{className:"font-mono text-[10px] tracking-tight",children:[s.jsx("span",{className:m,children:i}),s.jsx("span",{className:"text-fg-muted/40",children:c})]})}),Z=e.memo(function({index:e,usage:r}){const a=r>90?"danger":r>70?"secondary":"primary";return s.jsxs("div",{className:"flex items-center gap-1 type-data-xs",children:[s.jsxs("span",{className:"text-fg-muted w-5",children:["C",e]}),s.jsx(X,{value:r,width:8,color:a}),s.jsxs("span",{className:t("w-7 text-right tabular-nums",r>90?"text-sys-red":r>70?"text-sys-indigo":"text-sys-green"),children:[r.toFixed(0),"%"]})]})}),q=e.memo(function({pid:e,name:r,cpu:a,mem:n,isTopCpu:l=!1,isTopMem:o=!1}){return s.jsxs("div",{className:"flex items-center gap-2 py-1 type-data-sm hover:bg-subtle-fill -mx-1 px-1 rounded",children:[s.jsx("span",{className:"text-fg-muted w-10 sm:w-14 tabular-nums",children:e}),s.jsx("span",{className:"flex-1 truncate text-fg-primary",children:r}),s.jsx("span",{className:"hidden sm:inline-flex",children:s.jsx(X,{value:a,max:100,width:6,color:a>50?"danger":a>20?"secondary":"success"})}),s.jsx("span",{className:t("w-10 sm:w-12 text-right tabular-nums",l?"text-fg-primary":a>50?"text-sys-red":a>20?"text-sys-indigo":"text-fg-muted"),children:a.toFixed(1)}),s.jsx("span",{className:t("w-10 sm:w-12 text-right tabular-nums",o?"text-fg-primary":n>50?"text-sys-red":n>20?"text-sys-indigo":"text-fg-muted"),children:n.toFixed(1)})]})}),Q=e.memo(function({value:e,label:t,min:r=20,max:a=100}){const n=Math.min(Math.max((e-r)/(a-r)*100,0),100),l=function(e){return e<30?{text:"Cool",color:"text-sys-cyan"}:e<50?{text:"Normal",color:"text-sys-blue"}:e<65?{text:"Warm",color:"text-sys-indigo"}:e<80?{text:"Hot",color:"text-signal-poor"}:{text:"Danger",color:"text-sys-red"}}(e),o=a-r;return s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("span",{className:"type-data-sm text-fg-muted",children:t}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"type-data-sm text-fg-muted",children:l.text}),s.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded type-data-sm",children:[s.jsx("span",{className:l.color,children:e.toFixed(1)}),s.jsx("span",{className:"text-fg-primary",children:"°C"})]})]})]}),s.jsxs("div",{className:"relative h-3 bg-subtle-fill overflow-hidden",children:[s.jsx("div",{className:"absolute inset-y-0 left-0 transition-all duration-300 ease-out",style:{background:G(n,r,a),width:`${n}%`}}),s.jsx("div",{className:"absolute inset-0 flex items-center pointer-events-none",children:U.map(({threshold:e,color:t})=>{const a=(e-r)/o*100;return a<0||a>100?null:s.jsx("div",{className:"absolute w-px h-full",style:{left:`${a}%`,backgroundColor:t}},e)})})]})]})});e.memo(function({data:e,color:t,flipped:r=!1,fixedSlots:a}){const n=[...Array(Math.max(0,a-e.length)).fill(0),...e.slice(-a)],l=Math.max(...n,1),o=n.map(e=>0===e?0:Math.max(e/l*100,3));return s.jsx("div",{className:"w-full h-full flex items-end",style:{transform:r?"scaleY(-1)":void 0},children:o.map((e,r)=>s.jsx("div",{className:"flex-1 min-w-0",style:{height:e>0?`${e}%`:"0%",backgroundColor:e>0?t:"transparent"}},r))})});const Y=e.memo(function({networkHistory:e,txRate:t,rxRate:r,totalBytesSent:a,totalBytesRecv:n,cpuColor:l,memoryColor:o,networkSlots:i}){return s.jsxs(g,{neomorphic:!0,className:"flex flex-col",children:[s.jsx(w,{icon:s.jsx(k,{}),title:"Network",actions:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(N,{className:"w-3.5 h-3.5",style:{color:o}}),s.jsx("span",{className:"type-data-xs",style:{color:o},children:"TX"}),s.jsx("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded type-data-sm text-fg-primary",children:I(t)})]})}),s.jsxs("div",{className:"flex flex-col h-[120px]",children:[s.jsx("div",{className:"h-[60px]",children:s.jsx(z,{data:e.map((e,s,t)=>{if(0===s)return 0;const r=(e.timestamp-t[s-1].timestamp)/1e3;return r>0?(e.bytesSent-t[s-1].bytesSent)/r:0}),color:o,fixedSlots:i})}),s.jsx("div",{className:"h-[60px]",children:s.jsx(z,{data:e.map((e,s,t)=>{if(0===s)return 0;const r=(e.timestamp-t[s-1].timestamp)/1e3;return r>0?(e.bytesRecv-t[s-1].bytesRecv)/r:0}),color:l,flipped:!0,fixedSlots:i})})]}),s.jsxs("div",{className:"pt-2 flex flex-wrap justify-between items-center gap-2 type-data-sm",children:[s.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[s.jsx("span",{className:"text-fg-muted",children:"Total"}),s.jsxs("span",{className:"px-1.5 sm:px-2 py-1 bg-subtle-fill-strong rounded tabular-nums",children:[s.jsx("span",{className:"text-sys-cyan",children:J(a).value})," ",s.jsx("span",{className:"text-fg-muted",children:J(a).unit})]}),s.jsxs("span",{className:"px-1.5 sm:px-2 py-1 bg-subtle-fill-strong rounded tabular-nums",children:[s.jsx("span",{className:"text-sys-blue",children:J(n).value})," ",s.jsx("span",{className:"text-fg-muted",children:J(n).unit})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(M,{className:"w-3.5 h-3.5",style:{color:l}}),s.jsx("span",{className:"type-data-xs",style:{color:l},children:"RX"}),s.jsx("span",{className:"px-1.5 sm:px-2 py-1 bg-subtle-fill-strong rounded tabular-nums text-fg-primary",children:I(r)})]})]})]})}),ee=e.memo(function({temperatures:e}){return s.jsxs(g,{neomorphic:!0,className:"flex flex-col",children:[s.jsx(w,{icon:s.jsx(P,{}),title:"Temperature",actions:e&&s.jsx(K,{level:W(e)})}),s.jsx("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:e&&Object.keys(e).length>0?s.jsxs("div",{className:"space-y-3",children:[void 0!==e.cpu_thermal&&s.jsx(Q,{value:e.cpu_thermal,label:"CPU",min:20,max:100}),Object.entries(e).filter(([e])=>"cpu_thermal"!==e).slice(0,2).map(([e,t])=>s.jsx(Q,{value:t,label:e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),min:20,max:100},e))]}):s.jsxs("div",{className:"flex items-center justify-center text-fg-muted text-sm",children:[s.jsx(R,{className:"w-4 h-4 mr-2"}),"No sensors"]})})]})}),se=e.memo(function({usagePercent:e,used:t,available:r,memoryColor:a}){return s.jsxs(g,{neomorphic:!0,className:"flex flex-col",children:[s.jsx(w,{icon:s.jsx(R,{}),title:"Memory",actions:s.jsxs("span",{className:"px-2 py-0.5 bg-subtle-fill-strong rounded type-data",style:{color:a},children:[e.toFixed(0),"%"]})}),s.jsxs("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:[s.jsxs("div",{className:"flex gap-1 h-12",children:[s.jsx("div",{className:"h-full transition-all duration-300 bg-sys-blue",style:{width:`${e}%`}}),s.jsx("div",{className:"h-full transition-all duration-300 bg-sys-indigo",style:{width:100-e+"%"}})]}),s.jsxs("div",{className:"flex items-center justify-between type-data-xs pt-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-sys-blue"}),s.jsx("span",{className:"text-fg-muted",children:"Used"}),s.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-fg-primary",children:[(t/1048576).toFixed(0)," MB"]})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-sys-indigo"}),s.jsx("span",{className:"text-fg-muted",children:"Avail"}),s.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-fg-muted",children:[(r/1048576).toFixed(0)," MB"]})]})]})]})]})}),te=e.memo(function({usagePercent:e,used:t,free:r,cpuColor:a}){return s.jsxs(g,{neomorphic:!0,className:"flex flex-col",children:[s.jsx(w,{icon:s.jsx(B,{}),title:"Disk",actions:s.jsxs("span",{className:"px-2 py-0.5 bg-subtle-fill-strong rounded type-data",style:{color:a},children:[e.toFixed(0),"%"]})}),s.jsxs("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:[s.jsxs("div",{className:"flex gap-1 h-12",children:[s.jsx("div",{className:"h-full transition-all duration-300 bg-sys-blue",style:{width:`${e}%`}}),s.jsx("div",{className:"h-full transition-all duration-300 bg-sys-indigo",style:{width:100-e+"%"}})]}),s.jsxs("div",{className:"flex items-center justify-between type-data-xs pt-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-sys-blue"}),s.jsx("span",{className:"text-fg-muted",children:"Used"}),s.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-fg-primary",children:[(t/1073741824).toFixed(1)," GB"]})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-sys-indigo"}),s.jsx("span",{className:"text-fg-muted",children:"Free"}),s.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-fg-muted",children:[(r/1073741824).toFixed(1)," GB"]})]})]})]})]})}),re=e.memo(function({processes:e}){if(0===e.length)return null;const t=e.slice(0,10),r=Math.max(...t.map(e=>e.cpu_percent)),a=Math.max(...t.map(e=>e.memory_percent));return s.jsx(g,{neomorphic:!0,noPadding:!0,children:s.jsxs("div",{className:"px-4 py-3",children:[s.jsx(w,{icon:s.jsx(R,{}),title:"Processes"}),s.jsxs("div",{className:"flex items-center gap-2 py-1.5 type-data-sm text-fg-muted",children:[s.jsx("span",{className:"w-10 sm:w-14",children:"PID"}),s.jsx("span",{className:"flex-1",children:"Program"}),s.jsx("span",{className:"hidden sm:block w-[52px]"}),s.jsx("span",{className:"w-10 sm:w-12 text-right",children:"CPU%"}),s.jsx("span",{className:"w-10 sm:w-12 text-right",children:"MEM%"})]}),t.map(e=>s.jsx(q,{pid:e.pid,name:e.name,cpu:e.cpu_percent,mem:e.memory_percent,isTopCpu:e.cpu_percent===r&&r>0,isTopMem:e.memory_percent===a&&a>0},e.pid))]})})}),ae=o.hero;function ne(){var r;const a=i(),n=c(),l=m(),v=d(),N=u(),[M,k]=e.useState([]),[B,P]=e.useState(!1),[$,E]=e.useState([]),[T,A]=e.useState(0),[z,O]=e.useState(0),U=e.useRef(null),G=x(),W=G.blue,I=G.amber,J=function(){const[s,t]=e.useState("undefined"!=typeof window&&window.matchMedia("(max-width: 767px)").matches);return e.useEffect(()=>{const e=window.matchMedia("(max-width: 767px)");t(e.matches);const s=e=>t(e.matches);return e.addEventListener("change",s),()=>e.removeEventListener("change",s)},[]),s?o.hero:40}();return e.useEffect(()=>{if(!a)return;const e=Date.now(),s={timestamp:e,bytesRecv:a.network.bytes_recv,bytesSent:a.network.bytes_sent};if(U.current){const t=(e-U.current.timestamp)/1e3;if(t>0){const e=(s.bytesRecv-U.current.bytesRecv)/t,r=(s.bytesSent-U.current.bytesSent)/t;e>=0&&r>=0&&(A(e),O(r))}}U.current=s,E(e=>[...e,s].slice(-ae))},[a]),e.useEffect(()=>{let e=!0;const s=async()=>{var s;const t=await f();e&&t.success&&(null==(s=t.data)?void 0:s.processes)&&k(t.data.processes)};s();const t=setInterval(s,5e3);return()=>{e=!1,clearInterval(t)}},[]),s.jsxs(y,{children:[s.jsx(j,{title:"System Stats",icon:s.jsx(_,{}),controls:s.jsxs(p,{color:"muted",onClick:async()=>{var e;P(!0),await v();const s=await f();s.success&&(null==(e=s.data)?void 0:e.processes)&&k(s.data.processes),P(!1)},disabled:B,children:[s.jsx(C,{"data-slot":"icon",className:t(B&&"animate-spin")}),"Refresh"]})}),s.jsxs(b,{children:[l&&s.jsx(g,{className:"border border-sys-red/50 bg-sys-red/10",children:s.jsx("p",{className:"text-sys-red",children:l})}),n?s.jsx(g,{neomorphic:!0,className:"p-12 text-center",children:s.jsx("div",{className:"animate-pulse text-fg-muted",children:"Loading system stats..."})}):a?s.jsxs(s.Fragment,{children:[s.jsx(S,{template:"hero",children:s.jsxs(g,{neomorphic:!0,className:"pb-2 sm:pb-3",children:[s.jsx(w,{icon:s.jsx(R,{}),title:"System Resources",stackActionsOnMobile:!0,actions:s.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 flex-wrap",children:[(null==(r=a.system)?void 0:r.uptime)&&s.jsx("span",{className:"px-2 py-0.5 bg-subtle-fill rounded type-data-sm text-fg-primary",children:h(a.system.uptime)}),s.jsx(K,{level:V(a.cpu.usage_percent,D)}),s.jsx(K,{level:V(a.memory.usage_percent,H)}),s.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[s.jsx("span",{className:"type-data-sm text-fg-muted",children:"CPU"}),s.jsxs("span",{className:"text-sm sm:text-base font-mono font-semibold tabular-nums",style:{color:W},children:[a.cpu.usage_percent.toFixed(0),"%"]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[s.jsx("span",{className:"type-data-sm text-fg-muted",children:"MEM"}),s.jsxs("span",{className:"text-sm sm:text-base font-mono font-semibold tabular-nums",style:{color:I},children:[a.memory.usage_percent.toFixed(0),"%"]})]})]})}),s.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:s.jsx(L,{data:N,cpuColor:W,memoryColor:I})}),a.cpu.per_core_percent&&a.cpu.per_core_percent.length>0&&s.jsx("div",{className:"mt-3 pt-3 border-t border-edge-subtle",children:s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-8 gap-x-3 gap-y-0.5",children:a.cpu.per_core_percent.map((e,t)=>s.jsx(Z,{index:t,usage:e},t))})})]})}),s.jsxs(S,{template:"compact",children:[s.jsx(F,{span:12,md:6,children:s.jsx(Y,{networkHistory:$,txRate:z,rxRate:T,totalBytesSent:a.network.bytes_sent,totalBytesRecv:a.network.bytes_recv,cpuColor:W,memoryColor:I,networkSlots:J})}),s.jsx(F,{span:12,md:6,children:s.jsx(ee,{temperatures:a.temperatures})})]}),s.jsxs(S,{template:"compact",children:[s.jsx(F,{span:12,sm:6,children:s.jsx(se,{usagePercent:a.memory.usage_percent,used:a.memory.used,available:a.memory.available,memoryColor:I})}),s.jsx(F,{span:12,sm:6,children:s.jsx(te,{usagePercent:a.disk.usage_percent,used:a.disk.used,free:a.disk.free,cpuColor:W})})]}),s.jsx(S,{template:"auto",children:s.jsx(re,{processes:M})})]}):null]})]})}export{ne as default}; diff --git a/frontend/dist/assets/Terminal-CKx-DNJQ.js b/frontend/dist/assets/Terminal-BvORGL-y.js similarity index 99% rename from frontend/dist/assets/Terminal-CKx-DNJQ.js rename to frontend/dist/assets/Terminal-BvORGL-y.js index bc4ab5f3..3c354529 100644 --- a/frontend/dist/assets/Terminal-CKx-DNJQ.js +++ b/frontend/dist/assets/Terminal-BvORGL-y.js @@ -1 +1 @@ -var e=Object.defineProperty,t=(t,r,a)=>((t,r,a)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a)(t,"symbol"!=typeof r?r+"":r,a);import{j as r,r as a,X as s,c as n,x as o,d as i}from"./vendor-react-j_fHog8x.js";import{D as c,o as l,L as d}from"./xterm-Cq-DlOOL.js";import{c as u,Z as p,bk as m,bG as h,bH as g,bI as f,bJ as y,n as x,bK as v,bL as $,bM as b,bc as w,ac as _,bN as k,a4 as C,a3 as S,aH as j,bO as N,bP as T,bQ as R,by as M,W as E,bR as A,X as I,B as F,A as L,m as B,bS as D,bT as O,ba as P,t as U,bU as z,bV as H,bW as q,bX as K}from"./index-01Tx8g53.js";import{s as W}from"./signal-scoring-CcBiRcks.js";import{h as G,c as X,D as V}from"./geo-utils-D72kdxDo.js";import{a as Y}from"./ping-CcgRdnC3.js";import{c as J}from"./vendor-core-CmkNwW1A.js";import{P as Q,d as Z}from"./payload-decoders-XckZ5vyB.js";import{g as ee,r as te}from"./system-DikvxgDQ.js";import{g as re,K as ae,S as se}from"./KeycapButton-6IH7dZJL.js";import{g as ne,B as oe,r as ie,T as ce}from"./ascii-burst-CXC_pYgi.js";import{P as le,b as de,B as ue,a as pe}from"./PageLayout-DrvMAhys.js";import{S as me}from"./search-DGnzblbI.js";import{C as he}from"./chevron-right-BHZSwM7S.js";import"./maplibre-gl-b91ci4Kr.js";import"./keycap-sfx-CAsrNe23.js";const ge=u("book-open-text",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]]),fe=u("folders",[["path",{d:"M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5a1.5 1.5 0 0 1 1.2.6l.6.8a1.5 1.5 0 0 0 1.2.6z",key:"a4852j"}],["path",{d:"M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1",key:"yxbcw3"}]]),ye=u("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);class xe{constructor(){t(this,"commands",[])}register(...e){this.commands.push(...e)}find(e){let t;for(const r of this.commands)r.matches(e)&&(!t||r.name.length>t.name.length)&&(t=r);return t}all(){return this.commands}}class ve{constructor(){t(this,"aliases",[]),t(this,"params")}matches(e){const t=e.toLowerCase().trim(),r=e=>t===e||t.startsWith(e+" ");return r(this.name)||this.aliases.some(r)}argsAfterName(e){const t=e.toLowerCase().trim(),r=[this.name,...this.aliases].sort((e,t)=>t.length-e.length);for(const a of r)if(t.startsWith(a))return e.trim().slice(a.length).trim();return e.trim()}}const $e="[",be=`${$e}0m`,we=`${$e}1m`,_e=`${$e}2m`,ke=`${$e}3m`,Ce=`${$e}32m`,Se=`${$e}31m`,je=`${$e}33m`,Ne=`${$e}36m`,Te=`${$e}34m`,Re=`${$e}90m`,Me=`${$e}92m`,Ee=`${$e}96m`;function Ae(e,t){switch(t){case"success":return`${Ce}${e}${be}`;case"error":return`${Se}${e}${be}`;case"warning":return`${je}${e}${be}`;case"info":return`${Ne}${e}${be}`;case"value":return`${Te}${e}${be}`;case"system":return`${Re}${e}${be}`;default:return e}}function Ie(e){return`${we}${e}${be}`}function Fe(e){return`${_e}${e}${be}`}function Le(e){return`${Te}${e}${be}`}function Be(e){return`${Re}${e}${be}`}function De(e,t){return`${Re}${e}: ${be}${Te}${we}${t}${be}`}function Oe(e,t,r=22){const a=e.split(" "),s=a[0];let n=Ne;return"get"===s?n=Ce:"set"===s&&(n=je),` ${a.length>1?`${n}${we}${s}${be} ${Te}${a.slice(1).join(" ")}${be}`:`${n}${we}${e}${be}`}${" ".repeat(Math.max(1,r-e.length))}${Re}${t}${be}`}function Pe(e){return`${we}${Te}${e}${be}`}function Ue(e){return`${Re}${ke}${e}${be}`}function ze(e){return`${Se}${we}●${be} ${Re}${e}${be}`}function He(e){const t=e<1e3?`${e.toFixed(0)}ms`:`${(e/1e3).toFixed(1)}s`;return`${function(e){return e<1500?Me:e<4e3?Ce:e<8e3?je:e<15e3?Se:`${Se}${we}`}(e)}${t}${be}`}function qe(e){switch(e){case"excellent":return Ee;case"good":return Ce;case"fair":return je;case"poor":return Se;case"critical":return`${Se}${we}`;default:return Re}}function Ke(e,t){return`${qe(t)}${e}${be}`}function We(e){return e.replace(/[\p{Emoji_Presentation}\p{Extended_Pictographic}\uFE0F\u200D]/gu,"").trim()}const Ge="\r";function Xe(e=1){return`[${e}A`}const Ve="[?1049l",Ye="[?25h";function Je(e){return e.replace(/\x1b\[[0-9;]*m/g,"")}function Qe(e){return Je(e).length}function Ze(e,t){let r=0;for(const a of e){const e=Je(a).length;r+=0===e?1:Math.ceil(e/t)}return r}function et(e,t){const r=function(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}(e);return r||t}function tt(){const e="light"===document.documentElement.dataset.mode,t=et("--terminal-bg","#0d0d0d"),r=et("--sys-blue",m.blue);if(e){const e="#EFF0F1";return{background:e,foreground:"#111314",cursor:m.blue,cursorAccent:e,selectionBackground:`${m.blue}30`,selectionForeground:"#111314",black:"#111314",red:m.red,green:m.green,yellow:m.amber,blue:m.blue,magenta:m.purple,cyan:m.cyan,white:e,brightBlack:p[500],brightRed:m.red,brightGreen:m.green,brightYellow:m.orange,brightBlue:m.indigo,brightMagenta:m.pink,brightCyan:m.teal,brightWhite:p[600]}}const a=et("--text-primary","#e0e0e0"),s=r+"40",n=et("--sys-red",m.red),o=et("--sys-green",m.green),i=et("--sys-purple",m.purple),c=et("--sys-blue",m.blue),l=et("--sys-cyan",m.cyan),d=et("--text-muted",p[500]),u=et("--text-secondary",p[400]);return{background:t,foreground:a,cursor:r,cursorAccent:t,selectionBackground:s,selectionForeground:a,black:et("--bg-surface",p[900]),red:n,green:o,yellow:i,blue:c,magenta:i,cyan:l,white:a,brightBlack:d,brightRed:n,brightGreen:"#4ADE80",brightYellow:i,brightBlue:c,brightMagenta:i,brightCyan:l,brightWhite:u}}const rt="[",at=`${rt}0m`,st=`${rt}1m`,nt=`${rt}2m`,ot=`${rt}34m`,it=`${rt}90m`,ct=" ",lt=[{label:"INFORMATION",entries:[{cmd:"status",desc:"Repeater status summary",alias:"st"},{cmd:"top",desc:"Live system overview (Ctrl+C to exit)",alias:"htop"},{cmd:"ver",desc:"Version info",alias:"version"},{cmd:"clock",desc:"System UTC time"},{cmd:"uptime",desc:"System uptime"},{cmd:"board",desc:"Board / platform info"},{cmd:"packets",desc:"Packet statistics"},{cmd:"stats-packets",desc:"Packet counters (firmware compat)"},{cmd:"stats-radio",desc:"Radio health stats (firmware compat)"},{cmd:"stats-core",desc:"Engine vitals (firmware compat)"}]},{label:"NETWORK",entries:[{cmd:"neighbors [sort]",desc:"Direct RF neighbors",alias:"nb",sub:"sig · name · rssi · snr · dist · heard"},{cmd:"ping {name}",desc:"Ping neighbor (name or 0xXX)"},{cmd:"identities",desc:"List configured identities",alias:"id ids"},{cmd:"keys",desc:"Transport keys"},{cmd:"acl",desc:"ACL statistics"},{cmd:"rooms",desc:"Room statistics"}]},{label:"RADIO",entries:[{cmd:"get {param}",desc:"Read parameter"},{cmd:"set {param} {value}",desc:"Write parameter"},{cmd:"advert",desc:"Send advertisement"}]},{label:"SYSTEM",entries:[{cmd:"restart",desc:"Restart service",alias:"reboot"},{cmd:"start cap [seconds]",desc:"Start packet capture"},{cmd:"end cap",desc:"Stop capture"},{cmd:"list cap",desc:"List captures"},{cmd:"export cap [id]",desc:"Download capture"}]},{label:"TOOLS",entries:[{cmd:"convert hex {value}",desc:"Hex → base64"},{cmd:"convert base64 {value}",desc:"Base64 → hex"},{cmd:"clear",desc:"Clear terminal",alias:"cls"},{cmd:"help [command]",desc:"Show this help",alias:"? h"}]}],dt=[{cat:"Identity",params:["name","role","lat","lon","public.key"]},{cat:"Radio",params:["radio","freq","tx","bw","sf","cr"]},{cat:"Timing",params:["txdelay","direct.txdelay","rxdelay"]},{cat:"Repeater",params:["mode","duty","repeat","flood.max","advert.interval"]},{cat:"Advanced",params:["multi.acks","int.thresh","agc.reset.interval"]},{cat:"set only",params:["log","prv.key"]}];function ut(e){return`${it}${"─".repeat(e)}${at}`}function pt(e){const t=Math.max(3,e-12-8-6);return` ${ot}${st}pymc console${at} ${ut(t)} ${it}terminal${at}`}function mt(e){return` ${it}${e}${at}`}function ht(e,t){const r=[],a=e.alias?` ${nt}${e.alias}${at}`:"";return 4+Math.max(e.cmd.length,24)+e.desc.length+(e.alias?2+e.alias.length:0)<=t?r.push(" "+Oe(e.cmd,e.desc,24)+a):(r.push(" "+Oe(e.cmd,"",24)),r.push(ct+Be(e.desc)+a)),e.sub&&r.push(`${ct}${Fe("└ "+e.sub)}`),r}function gt(e){return e.split(" · ").map(e=>`${ot}${e}${at}`).join(`${it} · ${at}`)}function ft(e,t){const r=[];let a=[],s=0;for(const n of e){const e=a.length>0?3+n.length:n.length;s+e>t&&a.length>0?(r.push(a),a=[n],s=n.length):(a.push(n),s+=e)}return a.length>0&&r.push(a),r}function yt(e){const t=["",mt("GET/SET QUALIFIERS")],r=Math.max(20,e-4-13);for(const a of dt){const e=`${it}${a.cat.padEnd(13)}${at}`,s=ft(a.params,r),n=" ".repeat(17);t.push(` ${e}${gt(s[0].join(" · "))}`);for(let r=1;r help for detailed usage")}`]}(r)),e.write(s.join("\n"))}}class vt extends ve{constructor(){super(...arguments),t(this,"name","clear"),t(this,"description","Clear terminal screen"),t(this,"aliases",["cls"])}execute({output:e,rawInput:t}){"help"!==this.argsAfterName(t).toLowerCase().trim()?e.clear():e.write([Pe("clear"),` ${Be("Clear all terminal output.")}`,"",Oe("clear","clear the screen"),"",Pe("Aliases"),` ${Be("cls")}`].join("\n"))}}function $t(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),a=Math.floor(e%3600/60);return t>0?`${t}d ${r}h ${a}m`:r>0?`${r}h ${a}m`:`${a}m`}class bt extends ve{constructor(){super(...arguments),t(this,"name","status"),t(this,"description","Get repeater status summary"),t(this,"aliases",["st"])}async execute({output:e,rawInput:t}){var r,a,s;if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("status"),` ${Be("Show a quick summary of mode, neighbor count, and uptime.")}`,"",Oe("status","show summary"),"",Pe("Aliases"),` ${Be("st")}`].join("\n"));const n=e.write("processing...","system");try{const t=await g(),o=(null==(a=null==(r=t.config)?void 0:r.repeater)?void 0:a.mode)||"unknown",i=Object.keys(t.neighbors||{}).length,c=Object.values(t.neighbors||{}).filter(e=>e.zero_hop).length,l=(null==(s=t.config)?void 0:s.node_name)||t.node_name||"unknown",d=$t(t.uptime_seconds||0);e.update(n,[`${Ie(l)} ${Be("repeater")}`,"",` ${De("Mode",Le(o))}`,` ${De("Neighbors",`${Le(String(c))} direct ${Be(`${i} total`)}`)}`,` ${De("RX / TX",`${Le(String(t.rx_count??0))} / ${Le(String(t.tx_count??0))}`)}`,` ${De("Uptime",Le(d))}`].join("\n"))}catch(o){e.update(n,`Error: ${o instanceof Error?o.message:"Command failed"}`,"error")}}}class wt extends ve{constructor(){super(...arguments),t(this,"name","uptime"),t(this,"description","Show system uptime")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("uptime"),` ${Be("Display how long the repeater service has been running.")}`,"",Oe("uptime","show uptime")].join("\n"));const r=e.write("processing...","system");try{const t=await g();e.update(r,De("Uptime",Le($t(t.uptime_seconds||0))))}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}class _t extends ve{constructor(){super(...arguments),t(this,"name","packets"),t(this,"description","Show packet statistics")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("packets"),` ${Be("Display packet counters (received, transmitted, forwarded, dropped).")}`,"",Oe("packets","show packet stats")].join("\n"));const r=e.write("processing...","system");try{const t=await g(),a=(t.rx_count??0)+(t.tx_count??0);e.update(r,[Pe("Packet Stats")+` ${Be(`${a} total`)}`,"",` ${De("Received",Le(String(t.rx_count??0)))}`,` ${De("Transmitted",Le(String(t.tx_count??0)))}`,` ${De("Forwarded",Le(String(t.forwarded_count??0)))}`,` ${De("Dropped",Le(String(t.dropped_count??0)))}`].join("\n"))}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}function kt(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GB`:e>=1048576?`${(e/1048576).toFixed(0)} MB`:`${(e/1024).toFixed(0)} KB`}function Ct(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),a=Math.floor(e%3600/60);return t>0?`${t}d ${r}h ${a}m`:r>0?`${r}h ${a}m`:`${a}m`}class St extends ve{constructor(){super(...arguments),t(this,"name","board"),t(this,"description","Show board/platform info")}async execute({output:e,rawInput:t}){var r;if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("board"),` ${Be("Display platform and hardware information.")}`,"",Oe("board","show board info")].join("\n"));const a=e.write("loading...","system");try{const[t,s]=await Promise.all([f(),g()]),n=[];if(n.push(` ${De("Node",Le(s.node_name||"Unknown"))}`),n.push(` ${De("Runtime",Le(`pyMC_Repeater v${s.version||"?"}`))}`),s.core_version&&n.push(` ${De("Core",Le(s.core_version))}`),n.push(""),t.success&&t.data){const e=t.data;n.push(` ${De("CPU",Le(`${e.cpu.usage_percent.toFixed(1)}%`))} ${Be(`${e.cpu.count} core${e.cpu.count>1?"s":""}`)}`),e.cpu.load_avg&&n.push(` ${De("Load",Le(`${e.cpu.load_avg["1min"].toFixed(2)} / ${e.cpu.load_avg["5min"].toFixed(2)} / ${e.cpu.load_avg["15min"].toFixed(2)}`))}`);const a=Object.entries(e.temperatures||{});if(a.length>0){const e=a[0];n.push(` ${De("Temp",Le(`${e[1].toFixed(1)}°C`))}${a.length>1?` ${Be(a.slice(1).map(([e,t])=>`${e}: ${t.toFixed(1)}°C`).join(", "))}`:""}`)}n.push(""),n.push(` ${De("Memory",Le(`${kt(e.memory.used)} / ${kt(e.memory.total)}`))} ${Be(`${e.memory.usage_percent.toFixed(0)}%`)}`),n.push(` ${De("Disk",Le(`${kt(e.disk.used)} / ${kt(e.disk.total)}`))} ${Be(`${e.disk.usage_percent.toFixed(0)}%`)}`),n.push(""),(null==(r=e.system)?void 0:r.uptime)&&n.push(` ${De("System uptime",Le(Ct(e.system.uptime)))}`),n.push(` ${De("Service uptime",Le(Ct(s.uptime_seconds)))}`),e.network&&n.push(` ${De("Net TX/RX",Le(`${kt(e.network.bytes_sent)} / ${kt(e.network.bytes_recv)}`))}`)}else n.push(` ${De("Platform",Le("Linux"))}`),n.push(` ${De("Service uptime",Le(Ct(s.uptime_seconds)))}`),n.push(` ${Be("Hardware stats unavailable")}`);e.update(a,n.join("\n"),"value")}catch(s){e.update(a,`Error: ${s instanceof Error?s.message:"Failed to load hardware stats"}`,"error")}}}const jt="",Nt="",Tt="",Rt="",Mt="",Et=48;function At(e,t,r,a){return s=>{if(s<=0)return 0;if(s>=1)return 1;let n=s;for(let t=0;t<8;t++){const t=3*(1-n)*(1-n)*n*e+3*(1-n)*n*n*r+n*n*n-s,a=3*(1-n)*(1-n)*e+6*(1-n)*n*(r-e)+3*n*n*(1-r);if(Math.abs(a)<1e-7)break;n=Math.max(0,Math.min(1,n-t/a))}return 3*(1-n)*(1-n)*n*t+3*(1-n)*n*n*a+n*n*n}}const It=At(.25,1,.5,1),Ft=At(.4,0,1,1);function Lt(e,t){const r=e%14;return Math.sin(.45*r+.04*r*r+.25*t)}const Bt=[8,16,32,128],Dt=[1,2,4,64].map((e,t)=>e|Bt[t]);function Ot(e,t,r,a){a<4?e[r]|=Dt[a]:t[r]|=Dt[a-4]}function Pt(e){return e>.8?""+Nt:e>.6?""+Nt:e>.4?Mt+Nt:e>.2?Mt:e>.08?Rt:Rt+Tt}function Ut(e,t,r){const a=new Uint8Array(Et),s=new Uint8Array(Et),n=new Float32Array(Et),o=.35*e;for(let i=0;i=t)continue;const l=t-c,d=Math.min(1,l/3),u=Math.min(1,c/2),p=l<5?1+.3*(1-l/5):1,m=Math.min(1,d*u*p);if(m<.04)continue;const h=1+.06*Math.sin(.7*e+.3*c),g=Lt(c,o)*m*h*3.5+3.5,f=Math.abs(g-3.5)/3.5,y=l<6?1-l/6:0;n[i]=Math.min(1,.65*f+.35*y)*m;const x=Math.max(0,Math.min(7,Math.round(g)));if(g>=3.5){for(let t=3;t<=x;t++)Ot(a,s,i,t);const e=Math.round(.4*(g-3.5));for(let t=Math.max(0,3-e);t<3;t++)Ot(a,s,i,t)}else{for(let t=x;t<=4;t++)Ot(a,s,i,t);const e=Math.round(.4*(3.5-g));for(let t=5;t<=Math.min(7,4+e);t++)Ot(a,s,i,t)}}return{top:a,bot:s,heat:n}}function zt(e,t,r){const a=new Uint8Array(Et),s=new Uint8Array(Et),n=new Float32Array(Et),o=Math.exp(.5*-t),i=Math.max(0,10-2.5*t),c=.7+.2*t;for(let l=0;l=Et)continue;const d=o*(1-l/i);if(d<.04)continue;n[t]=d;const u=Math.sin(l*c+.6*r)*d*3.5+3.5,p=Math.max(0,Math.min(7,Math.round(u)));if(u>=3.5)for(let e=3;e<=p;e++)Ot(a,s,t,e);else for(let e=p;e<=4;e++)Ot(a,s,t,e)}return{top:a,bot:s,heat:n}}function Ht(e,t){let r="",a="";for(let s=0;s{a++,e.update(s,qt(a,t,Date.now()-r).join("\n"))},50);return{id:s,stop:()=>clearInterval(n)}}class Wt extends ve{constructor(){super(...arguments),t(this,"name","advert"),t(this,"description","Send repeater advertisement")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("advert"),` ${Be("Broadcast a repeater advertisement to the mesh network.")}`,"",Oe("advert","send advert now"),"",Ue("Adverts announce this repeater's presence to neighbors.")].join("\n"));const r=Kt(e,"broadcast");try{const t=await y();r.stop(),t.success?e.update(r.id,`✓ ${Le("Advert sent")}`,"success"):e.update(r.id,`Error: ${t.error||"Failed"}`,"error")}catch(a){r.stop(),e.update(r.id,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}const Gt=["sig","name","rssi","snr","dist","heard"],Xt={excellent:5,good:4,fair:3,poor:2,critical:1};function Vt(e){const t=Math.floor(Date.now()/1e3-e);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Yt(e){return e<1e3?`${Math.round(e)}m`:`${(e/1e3).toFixed(1)}km`}const Jt={excellent:5,good:4,fair:3,poor:2,critical:1};function Qt(e){const t=Jt[e]??0,r=qe(e);return(t>0?`${r}${"█".repeat(t)}${be}`:"")+Be("⣿".repeat(5-t))}function Zt(e,t=e=>e){return{text:e,color:t}}function er(e){return Be("+"+e.map(e=>"-".repeat(e+2)).join("+")+"+")}function tr(e,t){const r=e.map((e,r)=>{if(null!=e.rendered){const a=Math.max(0,t[r]-e.text.length);return" "+e.rendered+" ".repeat(a)+" "}return" "+e.color((a=e.text,s=t[r],a.length>=s?a.slice(0,s):a+" ".repeat(s-a.length)))+" ";var a,s});return Be("|")+r.join(Be("|"))+Be("|")}class rr extends ve{constructor(){super(...arguments),t(this,"name","neighbors"),t(this,"description","Show direct RF neighbors with signal stats"),t(this,"aliases",["nb","get neighbors","get neighbor"]),t(this,"params","[sig|name|rssi|snr|dist|heard]")}async execute(e){const{output:t,cols:r}=e,a=this.argsAfterName(e.rawInput).toLowerCase().trim();if("help"===a)return void this.printUsage(t);const s=Gt.includes(a)?a:null,n=t.write("processing...","system");try{const e=await g(),a=e.neighbors||{},o=Object.entries(a).filter(([,e])=>e.zero_hop);if(0===o.length){const e=Object.keys(a).length;return void t.update(n,e>0?`No direct neighbors. ${e} relayed neighbor${1!==e?"s":""} known.`:"No neighbors discovered yet.","warning")}const i=function(e){var t;const r=null==(t=e.config)?void 0:t.radio;return(null==r?void 0:r.spreading_factor)&&(null==r?void 0:r.bandwidth)?{sf:r.spreading_factor,bwHz:r.bandwidth}:null}(e),c=function(e){var t;const r=null==(t=e.config)?void 0:t.repeater;return r&&G(r.latitude,r.longitude)?{lat:r.latitude,lon:r.longitude}:null}(e),l=e.noise_floor_dbm;this.sortNeighbors(o,s,i,c,l);const d=s?` ${Fe(`sorted by ${s}`)}`:"",u=[Pe(`Direct Neighbors (${o.length})`)+d,""];if(r<55)for(const[t,r]of o)u.push(...this.cardLayout(t,r,i,c,l));else{const e=r>=70&&null!=c,t=o.map(([t,r])=>this.buildRow(t,r,i,c,l,e)),a=e?["SIG","NAME","RSSI","SNR","DIST","HEARD"]:["SIG","NAME","RSSI","SNR","HEARD"],s=a.slice(1).map((e,r)=>Math.max(e.length,...t.map(e=>e[r+1].text.length))),n=5,d=s.reduce((e,t)=>e+t+3,0),p=Math.max(4,r-d-n-7),m=[n,Math.min(p,Math.max(4,...t.map(e=>e[1].text.length))),...s.slice(1)];u.push(er(m),...t.map(e=>tr(e,m)),er(m),tr(a.map(e=>Zt(e,Ie)),m),er(m)),u.push(this.footer(i,l))}t.update(n,u.join("\n"))}catch(o){t.update(n,`Error: ${o instanceof Error?o.message:"Command failed"}`,"error")}}sortNeighbors(e,t,r,a,s){switch(t){case"sig":e.sort(([,e],[,t])=>(Xt[this.gradeNeighbor(e,r,s)]??0)-(Xt[this.gradeNeighbor(t,r,s)]??0));break;case"name":e.sort(([e,t],[r,a])=>{const s=(t.name||t.node_name||e.slice(0,8)).toLowerCase(),n=(a.name||a.node_name||r.slice(0,8)).toLowerCase();return s.localeCompare(n)});break;case"rssi":e.sort(([,e],[,t])=>(e.rssi??-999)-(t.rssi??-999));break;case"snr":e.sort(([,e],[,t])=>(e.snr??-999)-(t.snr??-999));break;case"dist":e.sort(([,e],[,t])=>(this.distTo(e,a)??1/0)-(this.distTo(t,a)??1/0));break;case"heard":e.sort(([,e],[,t])=>(e.last_seen||0)-(t.last_seen||0));break;default:e.sort(([,e],[,t])=>(t.last_seen||0)-(e.last_seen||0))}}gradeNeighbor(e,t,r){const a=null!=e.rssi?e.rssi-3.5:null,s=null!=r&&r>-100?1:0,n=W(e.snr??null,a,t,s);return(null==n?void 0:n.finalGrade)??"critical"}distTo(e,t){return t&&G(e.latitude,e.longitude)?X(t.lat,t.lon,e.latitude,e.longitude):null}buildRow(e,t,r,a,s,n){const o=this.gradeNeighbor(t,r,s),i=We(t.name||t.node_name||e.slice(0,8))||e.slice(0,8),c=null!=t.rssi?`${t.rssi} dBm`:"-",l=null!=t.snr?`${t.snr} dB`:"-",d=t.last_seen?Vt(t.last_seen):"-",u=[(p=Qt(o),{text:"|||||",color:e=>e,rendered:p}),Zt(i,Ie),Zt(c,Le),Zt(l,Le)];var p;if(n){const e=this.distTo(t,a);u.push(Zt(null!=e?Yt(e):"-",Fe))}return u.push(Zt(d,Fe)),u}cardLayout(e,t,r,a,s){const n=this.gradeNeighbor(t,r,s),o=We(t.name||t.node_name||e.slice(0,8))||e.slice(0,8),i=null!=t.rssi?`${t.rssi}`:"-",c=null!=t.snr?`${t.snr}`:"-",l=t.last_seen?Vt(t.last_seen):"-",d=this.distTo(t,a),u=null!=d?` ${Be("dist")} ${Le(Yt(d))}`:"";return[`${Qt(n)} ${Ie(o)}`,` ${Be("rssi")} ${Le(i)} ${Be("snr")} ${Le(c)}${u} ${Fe(l)}`,""]}footer(e,t){const r=[];return e&&r.push(`SF${e.sf}/${e.bwHz>=1e3?e.bwHz/1e3+"kHz":e.bwHz+"Hz"}`),r.push("ant 3.5dBi"),null!=t&&r.push(`nf ${t}dBm`),Be(r.join(" "))}printUsage(e){const t=[Pe("neighbors"),` ${Be("Show direct RF neighbors with signal quality, RSSI, SNR, and distance.")}`,"",Pe("Usage"),Oe("neighbors","default sort (most recent)"),Oe("neighbors sig","sort by signal grade (weakest first)"),Oe("neighbors name","sort alphabetically"),Oe("neighbors rssi","sort by RSSI (weakest first)"),Oe("neighbors snr","sort by SNR (lowest first)"),Oe("neighbors dist","sort by distance (closest first)"),Oe("neighbors heard","sort by last seen (oldest first)"),Oe("neighbors help","show this help"),"",Pe("Aliases"),` ${Be("nb, get neighbors, get neighbor")}`,"",Ue("Signal bars factor radio config, noise floor, and 3.5 dBi antenna gain."),Ue("Only zero-hop (direct RF) neighbors are shown.")];e.write(t.join("\n"))}}class ar extends ve{constructor(){super(...arguments),t(this,"name","get"),t(this,"description","Get repeater parameter"),t(this,"params","{parameter}")}async execute({output:e,rawInput:t}){const r=this.argsAfterName(t).toLowerCase().trim();if("help"===r||!r)return void e.write([Pe("get"),` ${Be("Read a repeater configuration parameter.")}`,"",Pe("Identity"),Oe("get name","node name"),Oe("get role","node role"),Oe("get public.key","public key"),"",Pe("Location"),Oe("get lat","latitude"),Oe("get lon","longitude"),"",Pe("Radio"),Oe("get radio","full radio summary"),Oe("get freq","frequency (MHz)"),Oe("get tx","TX power (dBm)"),Oe("get bw","bandwidth (kHz)"),Oe("get sf","spreading factor"),Oe("get cr","coding rate"),"",Pe("Timing"),Oe("get af","airtime factor (pending backend)"),Oe("get txdelay","TX delay factor"),Oe("get direct.txdelay","direct TX delay"),Oe("get rxdelay","RX delay base"),"",Pe("Repeater"),Oe("get mode","forward or monitor"),Oe("get flood.max","max flood hops"),Oe("get advert.interval","advert interval"),Oe("get duty","duty cycle state"),"",Pe("Advanced"),Oe("get multi.acks","multi-ack count"),Oe("get int.thresh","interference threshold (dBm)"),Oe("get agc.reset.interval","AGC reset interval")].join("\n"));const a=e.write("processing...","system");try{const t=await g(),{result:s,type:n}=function(e,t){const r=t.config||{},a=r.radio||{},s=r.repeater||{},n=r.delays||{},o=r.duty_cycle||{},i=(e,t)=>({result:De(e,Le(t)),type:"value"});switch(e){case"name":return i("name",r.node_name||"Unknown");case"role":return i("role","repeater");case"lat":return i("lat",null!=s.latitude?String(s.latitude):"not set");case"lon":return i("lon",null!=s.longitude?String(s.longitude):"not set");case"freq":return i("freq",a.frequency?`${(a.frequency/1e6).toFixed(3)} MHz`:"?");case"tx":return i("tx",null!=a.tx_power?`${a.tx_power} dBm`:"?");case"bw":return i("bw",a.bandwidth?a.bandwidth/1e3+" kHz":"?");case"sf":return i("sf",String(a.spreading_factor??"?"));case"cr":return i("cr",a.coding_rate?`4/${a.coding_rate}`:"?");case"radio":return a.frequency?{result:[` ${De("freq",Le(`${(a.frequency/1e6).toFixed(3)} MHz`))}`,` ${De("bw",Le(a.bandwidth/1e3+" kHz"))}`,` ${De("sf",Le(String(a.spreading_factor)))}`,` ${De("cr",Le(`4/${a.coding_rate}`))}`,` ${De("tx",Le(`${a.tx_power} dBm`))}`].join("\n"),type:"value"}:i("radio","?");case"af":case"airtime.factor":return{result:`${Be("airtime_factor is not yet exposed by the pyMC_Repeater API.")}\n${Be("Firmware range: 0-9. Controls airtime budget fraction.")}\n${Be("Tracked in CLI-Alignment.md — needs backend support.")}`,type:"warning"};case"txdelay":return i("txdelay",String(n.tx_delay_factor??"1.0"));case"direct.txdelay":return i("direct.txdelay",String(n.direct_tx_delay_factor??"0.5"));case"rxdelay":return i("rxdelay",String(n.rx_delay_base??"0.0"));case"mode":return i("mode",s.mode||"forward");case"repeat":return i("repeat","forward"===s.mode?"on":"off");case"flood.max":return i("flood.max",String(s.max_flood_hops??"3"));case"flood.advert.interval":return i("flood.advert.interval",null!=s.send_advert_interval_hours?`${s.send_advert_interval_hours}h`:"?");case"advert.interval":return i("advert.interval",null!=s.advert_interval_minutes?`${s.advert_interval_minutes}m`:"120m");case"duty":case"duty.enabled":return i("duty",o.enforcement_enabled?"on":"off");case"duty.max":return i("duty.max",null!=o.max_airtime_percent?`${o.max_airtime_percent}%`:"?");case"multi.acks":return i("multi.acks",String(s.multi_acks??"0"));case"int.thresh":return i("int.thresh",`${s.interference_threshold??-120} dBm`);case"agc.reset.interval":return i("agc.reset.interval",String(s.agc_reset_interval??"0"));case"public.key":return i("public.key",t.public_key||"not available");case"prv.key":return{result:`${Be("Private key stored in /etc/pymc_repeater/config.yaml")}\n\n ${De("view",Le("sudo grep identity_key /etc/pymc_repeater/config.yaml"))}\n ${De("set",Le("sudo ./convert_firmware_key.sh <64-byte-hex>"))}`,type:"info"};case"guest.password":case"allow.read.only":return{result:`${Be("Security settings not exposed via stats API.")}\n${Be("Check /etc/pymc_repeater/config.yaml")}`,type:"warning"};default:return{result:`Unknown parameter: ${Le(e)}\n${Be('Run "get help" to see available parameters.')}`,type:"error"}}}(r,t);e.update(a,s,n)}catch(s){e.update(a,`Error: ${s instanceof Error?s.message:"Command failed"}`,"error")}}}class sr extends ve{constructor(){super(...arguments),t(this,"name","set"),t(this,"description","Set repeater parameter"),t(this,"params","{parameter} {value}")}async execute({output:e,rawInput:t}){var r;const a=this.argsAfterName(t).split(/\s+/),s=null==(r=a[0])?void 0:r.toLowerCase(),n=a.slice(1).join(" ");if("help"===s||!s)return void e.write([Pe("set"),` ${Be("Write a repeater configuration parameter.")}`,"",Pe("Identity"),Oe("set name ","node name"),Oe("set lat ","latitude (-90 to 90)"),Oe("set lon ","longitude (-180 to 180)"),"",Pe("Radio"),Oe("set freq ","frequency"),Oe("set tx ","TX power (2-22)"),Oe("set bw ","bandwidth"),Oe("set sf <5-12>","spreading factor"),Oe("set cr <5-8>","coding rate"),"",Pe("Timing"),Oe("set af <0-9>","airtime factor (pending backend)"),Oe("set txdelay <0-5>","TX delay factor"),Oe("set direct.txdelay <0-5>","direct TX delay"),Oe("set rxdelay ","RX delay base"),"",Pe("Repeater"),Oe("set mode ","forward or monitor"),Oe("set flood.max <0-64>","max flood hops"),Oe("set advert.interval ","advert interval (min)"),Oe("set duty ","duty cycle enforcement"),Oe("set log ","log level"),"",Pe("Advanced"),Oe("set multi.acks ","multi-ack count"),Oe("set int.thresh ","interference threshold"),Oe("set agc.reset.interval ","AGC reset interval (x4)"),"",Ue("Some changes require a service restart.")].join("\n"));const o=e.write("processing...","system");try{const{result:r,type:a}=await async function(e,t,r){switch(e){case"mode":return async function(e){const t=e.toLowerCase();return"forward"!==t&&"monitor"!==t?ur('Mode must be "forward" or "monitor"'):(await b(t)).success?dr(`OK - Mode set to ${t}`):ur("Failed")}(t);case"duty":return async function(e){const t="on"===e.toLowerCase()||"1"===e;return(await $(t)).success?dr("OK - Duty cycle "+(t?"enabled":"disabled")):ur("Failed")}(t);case"tx":return nr("tx_power",ir(t,2,22,"TX power must be 2-22 dBm"));case"sf":return nr("spreading_factor",ir(t,5,12,"SF must be 5-12"));case"af":case"airtime.factor":return{result:"Error: airtime_factor is not yet exposed by the pyMC_Repeater API.\nFirmware range: 0-9. Tracked in CLI-Alignment.md — needs backend support.",type:"info"};case"txdelay":return nr("tx_delay_factor",cr(t,0,5,"TX delay must be 0.0-5.0"));case"direct.txdelay":return nr("direct_tx_delay_factor",cr(t,0,5,"Direct TX delay must be 0.0-5.0"));case"rxdelay":return nr("rx_delay_base",function(e){const t=parseFloat(e);return isNaN(t)||t<0?{ok:!1,error:"Error: RX delay must be >= 0"}:{ok:!0,value:t}}(t));case"flood.max":return nr("max_flood_hops",ir(t,0,64,"Max flood hops must be 0-64"));case"log":return async function(e){const t=e.toUpperCase();if(!["DEBUG","INFO","WARNING","ERROR"].includes(t))return ur("Level must be debug, info, warning, or error");const r=await v(t);return r.success?dr(`OK - Log level set to ${t}`):ur(r.error||"Failed")}(t);case"multi.acks":return nr("multi_acks",ir(t,0,255,"Multi-acks must be 0-255"));case"int.thresh":return nr("interference_threshold",ir(t,-200,0,"Interference threshold must be -200 to 0 dBm"));case"agc.reset.interval":{const e=lr(t);if(!e.ok)return ur(e.error);if(e.value<0)return ur("AGC reset interval must be >= 0");const r=4*Math.floor(e.value/4);return or("agc_reset_interval",r,`OK - AGC reset interval set to ${r}${r!==e.value?` (rounded from ${e.value})`:""}`)}case"name":{const e=r.trim().substring(r.toLowerCase().indexOf("name")+5).trim();return e?/[\[\]\\/\\:,?*]/.test(e)?ur("Name contains invalid characters: [ ] \\ / : , ? * are not allowed"):nr("node_name",{ok:!0,value:e}):ur("Node name cannot be empty")}case"lat":return nr("latitude",cr(t,-90,90,"Latitude must be -90 to 90"));case"lon":return nr("longitude",cr(t,-180,180,"Longitude must be -180 to 180"));case"freq":{const e=cr(t,100,1e3,"Frequency must be 100-1000 MHz");return e.ok?nr("frequency",{ok:!0,value:1e6*e.value}):ur(e.error)}case"bw":{const e=[7.8,10.4,15.6,20.8,31.25,41.7,62.5,125,250,500],r=parseFloat(t);return isNaN(r)||!e.includes(r)?ur(`BW must be one of: ${e.join(", ")} kHz`):nr("bandwidth",{ok:!0,value:1e3*r})}case"cr":return nr("coding_rate",ir(t,5,8,"Coding rate must be 5-8"));case"advert.interval":{const e=lr(t);return e.ok?0!==e.value&&(e.value<1||e.value>10080)?ur("Advert interval must be 0 (off) or 1-10080 minutes"):or("advert_interval_minutes",e.value,0===e.value?"OK - Local adverts disabled":`OK - Local advert interval set to ${e.value}m`):ur(e.error)}case"flood.advert.interval":{const e=lr(t);return e.ok?0!==e.value&&(e.value<3||e.value>168)?ur("Flood advert interval must be 0 (off) or 3-168 hours"):or("flood_advert_interval_hours",e.value,0===e.value?"OK - Flood adverts disabled":`OK - Flood advert interval set to ${e.value}h`):ur(e.error)}case"prv.key":{const e=t.trim();return e?/^[0-9a-fA-F]+$/.test(e)?128!==e.length?ur(`Key must be 64 bytes (128 hex chars), got ${e.length} chars`):{result:`To set this key, run on the Pi:\n\n sudo ./convert_firmware_key.sh ${e}\n\nThen restart: sudo systemctl restart pymc-repeater`,type:"info"}:ur("Private key must be a hex string"):ur("Private key cannot be empty")}default:return ur(`Unknown parameter: ${e}`)}}(s,n,t);e.update(o,r,a)}catch(i){e.update(o,`Error: ${i instanceof Error?i.message:"Command failed"}`,"error")}}}async function nr(e,t){if(!t.ok)return ur(t.error);const r=await x({[e]:t.value});if(!r.success)return ur(r.error||"Failed");let a=`OK - ${e} set to ${t.value}`;return r.restart_required&&(a+="\n⚠ Service restart required for changes to take effect\nRun: sudo systemctl restart pymc_repeater"),dr(a)}async function or(e,t,r){const a=await x({[e]:t});if(!a.success)return ur(a.error||"Failed");let s=r;return a.restart_required&&(s+="\n⚠ Service restart required for changes to take effect\nRun: sudo systemctl restart pymc_repeater"),dr(s)}function ir(e,t,r,a){const s=parseInt(e);return isNaN(s)||sr?{ok:!1,error:`Error: ${a}`}:{ok:!0,value:s}}function cr(e,t,r,a){const s=parseFloat(e);return isNaN(s)||sr?{ok:!1,error:`Error: ${a}`}:{ok:!0,value:s}}function lr(e){const t=parseInt(e);return isNaN(t)?{ok:!1,error:"Error: Expected a number"}:{ok:!0,value:t}}function dr(e){return{result:e,type:"success"}}function ur(e){return{result:`Error: ${e}`,type:"error"}}const pr={excellent:5,good:4,fair:3,poor:2,critical:1};class mr extends ve{constructor(){super(...arguments),t(this,"name","ping"),t(this,"description","Ping neighbor (name or 0xXX)"),t(this,"params","{target} [timeout]")}async execute({output:e,rawInput:t}){var r,a,s,n;const o=this.argsAfterName(t).trim(),i=o.split(/\s+/);if("help"===(null==(r=i[0])?void 0:r.toLowerCase()))return void e.write([Pe("ping"),` ${Be("Send a ping to a neighbor and measure round-trip time, signal quality, and path.")}`,"",Oe("ping ","ping by node name"),Oe("ping 0xAB","ping by hex prefix"),Oe("ping 60","ping with custom timeout (seconds)"),"",Ue("Default timeout: 30s. Signal bars factor radio config and noise floor.")].join("\n"));const c=i[i.length-1],l=parseInt(c),d=i.length>1&&!isNaN(l)&&l>0,u=d?i.slice(0,-1).join(" "):o,p=d?l:30;if(!u)return void e.write([Pe("ping"),` ${Be("Send a ping to a neighbor and measure round-trip time.")}`,"",Oe("ping ","ping by node name"),Oe("ping 60","with custom timeout"),"",Ue('Run "ping help" for full usage.')].join("\n"));const m=Kt(e,u);try{const[t,r]=await Promise.all([Y(u,p),g()]);if(m.stop(),t.success&&t.data){const o=t.data,i=null==(a=r.config)?void 0:a.radio,c=(null==i?void 0:i.spreading_factor)&&(null==i?void 0:i.bandwidth)?{sf:i.spreading_factor,bwHz:i.bandwidth}:null,l=r.noise_floor_dbm,d=null!=l&&l>-100?1:0,u=o.rssi-3.5,p=W(o.snr_db,u,c,d),h=(null==p?void 0:p.finalGrade)??"critical",g=function(e){const t=pr[e]??0,r=qe(e);return(t>0?`${r}${"█".repeat(t)}${be}`:"")+Be("·".repeat(5-t))}(h),f=(null==(s=o.path)?void 0:s.length)?o.path.length:0,y=(null==(n=o.path)?void 0:n.length)?o.path.join(" > "):"direct",x=h.charAt(0).toUpperCase()+h.slice(1),v=[`${g} ${Ie("Reply from")} ${Le(o.target_id)}`,"",` ${De("RTT",He(o.rtt_ms))}`,` ${De("RSSI",`${o.rssi} dBm`)}`,` ${De("SNR",`${o.snr_db} dB`)}`,` ${De("Path",y)}${f>0?Be(` (${f} hop${1!==f?"s":""})`):""}`,` ${De("Quality",Ke(x,h))}`],$=[];c&&$.push(`SF${c.sf}/${c.bwHz>=1e3?c.bwHz/1e3+"kHz":c.bwHz+"Hz"}`),$.push("ant 3.5dBi"),null!=l&&$.push(`nf ${l}dBm`),v.push("",Be($.join(" "))),e.update(m.id,v.join("\n"))}else e.update(m.id,t.error||"Ping failed","error")}catch(h){m.stop(),e.update(m.id,`Error: ${h instanceof Error?h.message:"Ping failed"}`,"error")}}}class hr extends ve{constructor(){super(...arguments),t(this,"name","convert"),t(this,"description","Convert between hex and base64"),t(this,"params","hex|base64 {value}")}execute({output:e,args:t}){var r;const a=null==(r=t[1])?void 0:r.toLowerCase(),s=t.slice(2).join(" ").trim();"help"!==a&&(a||s)?"hex"===a?this.hexToBase64(e,s):"base64"===a?this.base64ToHex(e,s):e.write([Pe("convert"),` ${Be("Convert between hex and base64 encodings.")}`,"",Oe("convert hex ","hex → base64"),Oe("convert base64 ","base64 → hex")].join("\n")):e.write([Pe("convert"),` ${Be("Convert between hex and base64 encodings.")}`,"",Oe("convert hex ","hex → base64"),Oe("convert base64 ","base64 → hex"),"",Ue("Example: convert hex 48656C6C6F")].join("\n"))}hexToBase64(e,t){if(t)if(/^[0-9a-fA-F]+$/.test(t))if(t.length%2==0)try{const r=new Uint8Array(t.length/2);for(let e=0;e","error")}base64ToHex(e,t){if(t)try{const r="function"==typeof globalThis.atob?globalThis.atob(t):Buffer.from(t,"base64").toString("binary");let a="";for(let e=0;e","error")}}function gr(){const e=new Date;return`${e.toISOString().slice(0,10)}_${e.toTimeString().slice(0,8).replace(/:/g,"-")}`}function fr(e,t){return`pymc-${e.toISOString().slice(0,10)}-${e.toTimeString().slice(0,5).replace(":","")}-${t}s.json`}const yr=J((e,t)=>({isCapturing:!1,captureStartTime:null,captureStartPacketHashes:new Set,captureTimer:null,reports:[],startCapture:r=>{const{captureTimer:a}=t();a&&clearTimeout(a),e({isCapturing:!0,captureStartTime:new Date,captureStartPacketHashes:new Set(r.map(e=>e.packet_hash))})},stopCapture:r=>{const{isCapturing:a,captureStartTime:s,captureStartPacketHashes:n,captureTimer:o}=t();if(!a||!s)return null;o&&clearTimeout(o);const i=new Date,c=Math.round((i.getTime()-s.getTime())/1e3),l=s.getTime()/1e3,d=r.filter(e=>!n.has(e.packet_hash)&&e.timestamp>=l).sort((e,t)=>e.timestamp-t.timestamp),u={id:gr(),filename:fr(s,c),startTime:s,endTime:i,durationSec:c,packetCount:d.length,packets:d,sizeBytes:500*d.length};return e(e=>({isCapturing:!1,captureStartTime:null,captureStartPacketHashes:new Set,captureTimer:null,reports:[u,...e.reports].slice(0,10)})),u},getReport:e=>t().reports.find(t=>t.id===e),_setTimer:t=>e({captureTimer:t})})),xr=()=>yr(e=>e.reports);function vr(e){var t;return(null==(t=e.match(/.{1,2}/g))?void 0:t.join(" ").toUpperCase())||""}function $r(e){return void 0===e?"UNKNOWN":S[e]??`TYPE_${e}`}function br(e){return void 0===e?"UNKNOWN":C[e]??`ROUTE_${e}`}function wr(e,t){switch(e){case 4:return function(e){const t=[];let r=0;if(e.length>=32&&(t.push({name:"public_key",offset:r,length:32,bytes:vr(k(e.slice(r,r+32))),decoded:{value:k(e.slice(r,r+32))}}),r+=32),e.length>=r+4){const a=e.slice(r,r+4),s=a[0]|a[1]<<8|a[2]<<16|a[3]<<24;t.push({name:"timestamp",offset:r,length:4,bytes:vr(k(a)),decoded:{value:s>>>0,iso:new Date(1e3*s).toISOString()}}),r+=4}if(e.length>=r+64&&(t.push({name:"signature",offset:r,length:64,bytes:vr(k(e.slice(r,r+64))),decoded:{value:k(e.slice(r,r+64))}}),r+=64),e.length>r){const a=e[r],s=[];if(1&a&&s.push("CHAT_NODE"),2&a&&s.push("REPEATER"),3&a&&s.push("ROOM_SERVER"),16&a&&s.push("HAS_LOCATION"),128&a&&s.push("HAS_NAME"),t.push({name:"flags",offset:r,length:1,bytes:vr(k(e.slice(r,r+1))),decoded:{value:a,binary:a.toString(2).padStart(8,"0"),flags:s}}),r+=1,16&a&&e.length>=r+8){const a=e.slice(r,r+8),s=new ArrayBuffer(8);new Uint8Array(s).set(a);const n=new DataView(s),o=n.getInt32(0,!0),i=n.getInt32(4,!0);t.push({name:"location",offset:r,length:8,bytes:vr(k(a)),decoded:{lat_raw:o,lon_raw:i,latitude:o/1e6,longitude:i/1e6}}),r+=8}if(128&a&&e.length>r){const a=e.slice(r);let s=a.indexOf(0);-1===s&&(s=a.length);const n=(new TextDecoder).decode(a.slice(0,s));t.push({name:"name",offset:r,length:s+(0===a[s]?1:0),bytes:vr(k(a.slice(0,s+1))),decoded:{value:n,encoding:"utf-8",null_terminated:0===a[s]}})}}return t}(t);case 3:return function(e){if(e.length<4)return[];const t=e.slice(0,4),r=t[0]|t[1]<<8|t[2]<<16|t[3]<<24;return[{name:"crc",offset:0,length:4,bytes:vr(k(t)),decoded:{value:r>>>0,hex:(r>>>0).toString(16).toUpperCase().padStart(8,"0"),note:"CRC of the acknowledged packet (little-endian)"}}]}(t);case 9:return function(e){const t=[];if(e.length<9)return t;const r=e.slice(0,4),a=r[0]|r[1]<<8|r[2]<<16|r[3]<<24;t.push({name:"trace_tag",offset:0,length:4,bytes:vr(k(r)),decoded:{value:a>>>0,hex:(a>>>0).toString(16).toUpperCase().padStart(8,"0")}});const s=e.slice(4,8),n=s[0]|s[1]<<8|s[2]<<16|s[3]<<24;if(t.push({name:"auth_code",offset:4,length:4,bytes:vr(k(s)),decoded:{value:n>>>0}}),t.push({name:"flags",offset:8,length:1,bytes:vr(k(e.slice(8,9))),decoded:{value:e[8],binary:e[8].toString(2).padStart(8,"0")}}),e.length>9){const r=e.slice(9),a=Array.from(r).map(e=>e.toString(16).toUpperCase().padStart(2,"0"));t.push({name:"target_path",offset:9,length:r.length,bytes:vr(k(r)),decoded:{hops:a,path_string:a.join("->")}})}return t}(t);case 8:return function(e){if(0===e.length)return[];const t=Array.from(e).map(e=>e.toString(16).toUpperCase().padStart(2,"0"));return[{name:"path_hops",offset:0,length:e.length,bytes:vr(k(e)),decoded:{hops:t,path_string:t.join("->")}}]}(t);case 5:return function(e){const t=[];if(e.length<1)return t;if(t.push({name:"channel_hash",offset:0,length:1,bytes:vr(k(e.slice(0,1))),decoded:{value:e[0].toString(16).toUpperCase().padStart(2,"0")}}),e.length>13){const r=12,a=e.length-1-r;t.push({name:"ciphertext",offset:1,length:a,bytes:vr(k(e.slice(1,1+a))),decoded:{length:a,note:"Encrypted message content"}}),t.push({name:"mac",offset:1+a,length:r,bytes:vr(k(e.slice(-r))),decoded:{note:"Message authentication code"}})}return t}(t);default:return function(e){return 0===e.length?[]:[{name:"raw_data",offset:0,length:e.length,bytes:vr(k(e)),decoded:{length:e.length}}]}(t)}}function _r(e){const t=e.type??e.payload_type??0,r=e.route??e.route_type??0,a=e.raw_packet||"";let s,n=null;if(a){const t=Q.fromHex(a);if(t.success&&t.packet){const e=t.packet;try{n=Z(e)}catch{n=null}const r=_(a);let o=0;const i={offset:0,length:1,bytes:vr(a.slice(0,2)),decoded:{route_type:e.routeType,route_name:e.routeTypeName,payload_type:e.payloadType,payload_name:e.payloadTypeName,version:e.payloadVersion}};o+=1,e.hasTransportCodes()&&(o+=4);const c={offset:o,length:1,bytes:vr(k(r.slice(o,o+1))),decoded:{value:e.pathLen}};o+=1;const l=o,d=r.slice(o,o+e.pathLen),u=Array.from(e.path).map(e=>e.toString(16).toUpperCase().padStart(2,"0")),p=9===e.payloadType,m={offset:l,length:e.pathLen,bytes:vr(k(d)),decoded:{hops:u,path_string:u.length>0?u.join("->"):"(direct)",...p&&{note:"For TRACE packets, path bytes are SNR×4 values, not node hashes",snr_values:Array.from(e.path).map(e=>{let t=e;return t>127&&(t-=256),t/4})}}};o+=e.pathLen,s={header:i,path_length:c,path:m,payload:{offset:o,length:e.payload.length,bytes:vr(e.payloadHex),sections:wr(e.payloadType,e.payload)}}}else s=kr(e)}else s=kr(e);return{timestamp:e.timestamp,packet_hash:e.packet_hash,type:t,type_name:$r(t),route:r,route_name:br(r),rssi:e.rssi,snr:e.snr,length:e.length??0,src_hash:e.src_hash,dst_hash:e.dst_hash,transmitted:e.transmitted,drop_reason:e.drop_reason,is_duplicate:e.is_duplicate,lbt_attempts:e.lbt_attempts,lbt_backoff_delays_ms:e.lbt_backoff_delays_ms,lbt_channel_busy:e.lbt_channel_busy,raw_packet:a,structure:s,decoded:n}}function kr(e){var t;const r=e.type??e.payload_type??0,a=e.route??e.route_type??0,s=e.original_path??e.forwarded_path??[];return{header:{offset:0,length:1,bytes:"??",decoded:{route_type:a,route_name:br(a),payload_type:r,payload_name:$r(r),version:0}},path_length:{offset:1,length:1,bytes:s.length.toString(16).toUpperCase().padStart(2,"0"),decoded:{value:s.length}},path:{offset:2,length:s.length,bytes:s.join(" "),decoded:{hops:s,path_string:s.length>0?s.join("->"):"(direct)"}},payload:{offset:2+s.length,length:(null==(t=e.payload)?void 0:t.length)??0,bytes:e.payload??"",sections:e.payload?wr(r,_(e.payload)):[]}}}function Cr(e,t){const r=function(e,t){var r;return{capture:{start:e.startTime.toISOString(),end:e.endTime.toISOString(),duration_sec:e.durationSec,packet_count:e.packetCount,node_name:(null==t?void 0:t.node_name)??"unknown",local_hash:(null==t?void 0:t.local_hash)??"unknown",pymc_console_version:w,pymc_repeater_version:(null==t?void 0:t.version)??"unknown",radio_config:(null==(r=null==t?void 0:t.config)?void 0:r.radio)?{frequency:t.config.radio.frequency,tx_power:t.config.radio.tx_power,bandwidth:t.config.radio.bandwidth,spreading_factor:t.config.radio.spreading_factor}:null},packets:e.packets.map(_r)}}(e,t),a=JSON.stringify(r,null,2),s=new Blob([a],{type:"application/json"}),n=URL.createObjectURL(s),o=document.createElement("a");o.href=n,o.download=e.filename,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}function Sr(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}class jr extends ve{constructor(){super(...arguments),t(this,"name","cap"),t(this,"description","Packet capture (start/end/list/export)")}matches(e){const t=e.toLowerCase().trim();return"cap"===t||"cap help"===t||t.startsWith("start cap")||t.startsWith("end cap")||t.startsWith("list cap")||t.startsWith("export cap")}async execute({output:e,rawInput:t}){const r=t.toLowerCase().trim();return"cap"===r||"cap help"===r?this.showHelp(e):r.startsWith("start cap")?this.startCapture(e,r):"end cap"===r?this.endCapture(e):"list cap"===r?this.listCaptures(e):r.startsWith("export cap")?this.exportCapture(e,r):void this.showHelp(e)}showHelp(e){const t=yr.getState(),r=t.isCapturing?`\n${ze('Recording in progress... use "end cap" to stop')}`:"",a=t.reports.length,s=a>0?` (${a} saved)`:"",n=[Pe("Packet Capture"),"",Oe("start cap","Start capture (default: 120s)"),Oe("end cap","Stop capture early"),Oe("list cap",`List saved captures${s}`),Oe("export cap","Download capture by ID"),"",Ue("Captures stored in session memory. JSON includes decoded payloads."),r].filter(Boolean);e.write(n.join("\n"))}startCapture(e,t){const r=t.slice(9).trim(),a=r?parseInt(r):120;if(isNaN(a)||a<1||a>3600)return void e.write("Error: Duration must be 1-3600 seconds","error");const s=yr.getState();if(s.isCapturing)return void e.write('Error: Capture already in progress. Use "end cap" first.',"error");const n=j.getState().packets;s.startCapture(n);let o=a;const i=e.write(ze(`Capturing... ${o}s remaining`),"system"),c=setInterval(()=>{o--;const t=yr.getState();if(o>=0&&t.isCapturing){const r=j.getState().packets.filter(e=>{if(!t.captureStartTime)return!1;const r=t.captureStartTime.getTime()/1e3;return e.timestamp>=r&&!t.captureStartPacketHashes.has(e.packet_hash)}).length,a=o>0?`${o}s remaining`:"finishing...";e.update(i,ze(`Capturing... ${a} (${r} captured)`),"system")}},1e3),l=setTimeout(()=>{clearInterval(c);const t=yr.getState();if(t.isCapturing){const r=j.getState().packets,a=t.stopCapture(r);a?e.write(`✓ Capture complete!\n Captured: ${a.packetCount} packets\n Duration: ${a.durationSec}s\n Size: ~${Sr(a.sizeBytes)}\n\nRun \`export cap ${a.id}\` to download.`,"value"):e.write("Capture completed with no packets.","warning")}},1e3*a);s._setTimer(l)}endCapture(e){const t=yr.getState();if(!t.isCapturing)return void e.write("No capture in progress.","warning");const r=j.getState().packets,a=t.stopCapture(r);a?e.write(`✓ Capture stopped!\n Captured: ${a.packetCount} packets\n Duration: ${a.durationSec}s\n Size: ~${Sr(a.sizeBytes)}\n\nRun \`export cap ${a.id}\` to download.`,"value"):e.write("Capture stopped with no packets.","warning")}listCaptures(e){const{reports:t}=yr.getState();if(0===t.length)return void e.write("No capture reports available.\nStart a capture with: start cap [seconds]","info");const r=t.map((e,t)=>` ${t+1}. ${e.packetCount} pkts • ${e.durationSec}s • ~${Sr(e.sizeBytes)} (id: ${e.id})`);e.write(`Capture Reports (${t.length}):\n${r.join("\n")}`,"info")}exportCapture(e,t){const r=t.slice(10).trim(),a=yr.getState(),s=j.getState().stats;if(!r){if(0===a.reports.length)e.write("No capture reports available.\nStart a capture with: start cap [seconds]","info");else{const t=a.reports.map((e,t)=>` ${t+1}. ${e.id}`);e.write(`Usage: export cap \n\nAvailable reports:\n${t.join("\n")}`,"info")}return}let n=a.getReport(r);if(!n){const e=parseInt(r)-1;n=a.reports[e]}n?(Cr(n,s),e.write(`✓ Downloading ${n.filename}...`,"value")):e.write(`Error: Report "${r}" not found.\nUse "list cap" to see available reports.`,"error")}}class Nr extends ve{constructor(){super(...arguments),t(this,"name","identities"),t(this,"description","List configured identities"),t(this,"aliases",["id","ids"])}async execute({output:e,rawInput:t}){var r;if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("identities"),` ${Be("List all configured repeater and room server identities.")}`,"",Oe("identities","list identities"),"",Pe("Aliases"),` ${Be("id, ids")}`].join("\n"));const a=e.write("processing...","system");try{const t=await N();if(!t.success||!t.data)return void e.update(a,t.error||"Failed to fetch identities","error");const s=t.data,n=(null==(r=s.configured)?void 0:r.length)?s.configured:s.registered||[];if(0===n.length)return void e.update(a,"No identities configured.","warning");const o=[Pe(`Identities (${n.length})`),"",...n.map((e,t)=>{var r;const a=e.name||"Unnamed",s=e.type||"unknown",n=(null==(r=e.hash)?void 0:r.slice(0,8))||"—";return` ${Be(`${t+1}.`)} ${Ie(a)} ${Fe(s)} ${Le(n)}`})];e.update(a,o.join("\n"))}catch(s){e.update(a,`Error: ${s instanceof Error?s.message:"Command failed"}`,"error")}}}class Tr extends ve{constructor(){super(...arguments),t(this,"name","keys"),t(this,"description","List transport keys")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("keys"),` ${Be("List configured transport encryption keys.")}`,"",Oe("keys","list transport keys")].join("\n"));const r=e.write("processing...","system");try{const t=await ee();if(!t.success||!t.data)return void e.update(r,t.error||"Failed to fetch transport keys","error");const a=t.data;if(0===a.length)return void e.update(r,"No transport keys configured.","warning");const s=[Pe(`Transport Keys (${a.length})`),"",...a.map(e=>{const t=e.parent_id?` ${Fe(`parent: ${e.parent_id}`)}`:"";return` ${Ie(e.name)} ${De("flood",Le(e.flood_policy))}${t}`})];e.update(r,s.join("\n"))}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}class Rr extends ve{constructor(){super(...arguments),t(this,"name","acl"),t(this,"description","Show ACL statistics")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("acl"),` ${Be("Display access control list statistics.")}`,"",Oe("acl","show ACL stats")].join("\n"));const r=e.write("processing...","system");try{const t=await re();if(!t.success||!t.data)return void e.update(r,t.error||"Failed to fetch ACL stats","error");const a=t.data,s=[Pe("ACL Stats"),"",` ${De("Identities",Le(String(a.total_identities)))}`,` ${De("Total clients",Le(String(a.total_clients)))}`,` ${De("Admin",Le(String(a.admin_clients)))}`,` ${De("Guest",Le(String(a.guest_clients)))}`];if(a.by_identity_type){const e=a.by_identity_type.repeater,t=a.by_identity_type.room_server;e&&s.push(` ${De("Repeater",`${Le(String(e.count))} ids ${Be(`${e.clients} clients`)}`)}`),t&&s.push(` ${De("Room Server",`${Le(String(t.count))} ids ${Be(`${t.clients} clients`)}`)}`)}e.update(r,s.join("\n"))}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}class Mr extends ve{constructor(){super(...arguments),t(this,"name","rooms"),t(this,"description","Show room server statistics")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("rooms"),` ${Be("Display room server statistics and sync status.")}`,"",Oe("rooms","list rooms")].join("\n"));const r=e.write("processing...","system");try{const t=await T();if(!t.success||!t.data)return void e.update(r,t.error||"Failed to fetch room stats","error");const a=t.data.rooms||[];if(0===a.length)return void e.update(r,"No room servers configured.","warning");const s=[Pe(`Rooms (${a.length})`),"",...a.map(e=>[` ${Ie(e.room_name)}`,` ${De("msgs",Le(String(e.total_messages)))} ${De("clients",`${Le(String(e.active_clients))}${Fe(`/${e.total_clients}`)}`)} ${De("sync",e.sync_running?Le("running"):Fe("idle"))}`]).flat()];e.update(r,s.join("\n"))}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}class Er extends ve{constructor(){super(...arguments),t(this,"name","restart"),t(this,"description","Restart pymc-repeater service"),t(this,"aliases",["reboot"])}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("restart"),` ${Be("Restart the pymc-repeater systemd service.")}`,"",Oe("restart","restart the service"),"",Pe("Aliases"),` ${Be("reboot")}`,"",Ue("Requires polkit permissions for the web user."),Ue("The page will need a manual refresh after restart.")].join("\n"));const r=e.write("Restarting service...","system");try{const t=await te(AbortSignal.timeout(8e3));if(t.success)return e.update(r,"Service restart initiated.","success"),void this.waitForService(e);const a=t.status;if(403===a||401===a)return void e.update(r,"Error: Permission denied.\n\nThe web user needs polkit permissions to restart the service.\nSee: /etc/polkit-1/localauthority/50-local.d/pymc-repeater.pkla","error");e.update(r,t.error||"Restart failed","error")}catch(a){const t=a instanceof Error?a.message:"";t.includes("ERR_NETWORK")||t.includes("ECONNRESET")||t.includes("Failed to fetch")||t.includes("abort")||t.includes("timeout")||a instanceof DOMException&&"TimeoutError"===a.name||a instanceof DOMException&&"AbortError"===a.name?(e.update(r,"Service is restarting (connection dropped).","success"),this.waitForService(e)):e.update(r,`Error: ${t||"Restart failed"}`,"error")}}waitForService(e){const t=e.write("Waiting for service...","system");let r=0,a=!1;setTimeout(()=>{const s=setInterval(async()=>{if(!a){r++,e.update(t,`Waiting for service... ${r}s`,"system");try{await fetch(`${R}/api/stats`,{signal:AbortSignal.timeout(3e3)}),a=!0,clearInterval(s),e.update(t,`Service connected. (${r+4}s)`,"success")}catch{}!a&&r>=30&&(a=!0,clearInterval(s),e.update(t,"Service did not respond within 34s. Check manually.","warning"))}},1e3)},4e3)}}const Ar="[",Ir=`${Ar}0m`,Fr=`${Ar}32m`,Lr=`${Ar}33m`,Br=`${Ar}31m`,Dr=`${Ar}36m`,Or=`${Ar}90m`,Pr=`${Ar}1m`;function Ur(e){return e>=1073741824?`${(e/1073741824).toFixed(1)}G`:e>=1048576?`${(e/1048576).toFixed(0)}M`:e>=1024?`${(e/1024).toFixed(0)}K`:`${e}B`}function zr(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),a=Math.floor(e%3600/60);return t>0?`${t}d ${r}h ${a}m`:r>0?`${r}h ${a}m`:`${a}m`}function Hr(e,t){const r=" ".repeat(2),a=t-2,s=[];let n="",o=0;for(const i of e){const e=Qe(i);0===o?(n=i,o=e):o+2+e<=a?(n+=" "+i,o+=2+e):(s.push(r+n),n=i,o=e)}return o>0&&s.push(r+n),s}function qr(e,t,r,a,s){if(!e||!t)return` ${Or}Waiting for data…${Ir}`;const n=function(e,t,r){var a,s;const n=e.node_name||"unknown",o=e.version?`v${e.version}`:"",i=(null==(a=t.system)?void 0:a.uptime)?zr(t.system.uptime):"?",c=zr(e.uptime_seconds||0),l=Math.max(3,r-4),d=(null==(s=t.cpu.load_avg)?void 0:s["1min"].toFixed(2))??"?",u=t.cpu.load_avg?`${d} ${t.cpu.load_avg["5min"].toFixed(2)} ${t.cpu.load_avg["15min"].toFixed(2)}`:"?",p=r>=60?u:d;return[` ${Dr}${Pr}${n}${Ir} ${Or}${o}${Ir}`,` ${Or}${"─".repeat(l)}${Ir}`,...Hr([De("Sys",Le(i)),De("Svc",Le(c)),De("Load",Le(p))],r)]}(e,t,a),o=function(e,t){const r=Math.max(6,Math.min(30,t-15)),a=t-(15+r)-2,s=[""],n=`${e.cpu.count} core${e.cpu.count>1?"s":""}`,o=`${Ur(e.memory.used)}/${Ur(e.memory.total)}`,i=`${Ur(e.disk.used)}/${Ur(e.disk.total)}`,c=(e,t,s)=>{const n=function(e,t){const r=Math.max(0,Math.min(100,e)),a=Math.round(r/100*t),s=t-a,n=r>=90?Br:r>=70?Lr:Fr;return`[${n}${"█".repeat(a)}${Ir}${Or}${"░".repeat(s)}${Ir}] ${n}${`${r.toFixed(1)}%`.padStart(6)}${Ir}`}(t,r),o=a>=s.length?` ${Fe(s)}`:"";return` ${Be(e.padEnd(4))}${n}${o}`};s.push(c("CPU",e.cpu.usage_percent,n)),s.push(c("Mem",e.memory.usage_percent,o)),s.push(c("Dsk",e.disk.usage_percent,i));const l=Object.entries(e.temperatures||{});if(l.length>0){const e=l.map(([e,t])=>{return`${Fe(e+":")} ${r=t,r>=80?`${Br}${Pr}${r.toFixed(1)}°C${Ir}`:r>=60?`${Lr}${r.toFixed(1)}°C${Ir}`:`${Fr}${r.toFixed(1)}°C${Ir}`}`;var r});s.push(...Hr(e,t))}return s}(t,a),i=function(e,t){var r,a;const s=e.neighbors||{},n=Object.keys(s).length,o=Object.values(s).filter(e=>e.zero_hop).length,i=(null==(a=null==(r=e.config)?void 0:r.repeater)?void 0:a.mode)||"?",c=null!=e.noise_floor_dbm?`${e.noise_floor_dbm}dBm`:"?",l=e.duty_cycle_percent??0,d=["",` ${Or}MESH${Ir}`];return d.push(...Hr([De("Mode",Le(i)),De("Nbrs",`${Le(String(o))}${Fe(`/${n}`)}`),De("Noise",Le(c)),De("Air",Le(`${l.toFixed(1)}%`))],t)),d.push(...Hr([De("RX",Le(String(e.rx_count??0))),De("TX",Le(String(e.tx_count??0))),De("FWD",Le(String(e.forwarded_count??0))),De("Drop",Le(String(e.dropped_count??0)))],t)),d.push(...Hr([De("RX/h",Le(String(Math.round(e.rx_per_hour??0)))),De("FWD/h",Le(String(Math.round(e.forwarded_per_hour??0))))],t)),d}(e,a),c=function(e,t){if(!e.network)return[];const r=["",` ${Or}NET${Ir}`];return r.push(...Hr([De("TX",Le(Ur(e.network.bytes_sent))),De("RX",Le(Ur(e.network.bytes_recv))),De("Pkt",`${Le(String(e.network.packets_sent))}${Fe("/")}${Le(String(e.network.packets_recv))}`)],t)),r}(t,a),l=["",` ${Or}${(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})} · Ctrl+C to exit${Ir}`],d=[...n,...o,...i,...c,...l],u=s?Ze(d,a):0,p=function(e,t,r){if(0===e.length)return[];const a=t>=50,s=t>=50?6:5,n=t>=50?6:5,o=a?7:0,i=Math.max(4,t-2-o-s-n-4),c=t>=50?8:5,l=null!=r?Math.max(0,Math.min(c,r-3)):c;if(l<=0)return[];const d=["",` ${Or}PROCS${Ir}`],u=(a?"PID".padEnd(o):"")+"CPU".padStart(s)+"MEM".padStart(n)+" NAME";d.push(` ${Fe(u)}`);for(const p of e.slice(0,l)){const e=a?Fe(String(p.pid).padEnd(o)):"",r=(t>=50?p.cpu_percent.toFixed(1):p.cpu_percent.toFixed(0)).padStart(s),c=(t>=50?p.memory_percent.toFixed(1):p.memory_percent.toFixed(0)).padStart(n),l=p.name.length>i?p.name.slice(0,i-1)+"…":p.name,u=p.cpu_percent>=50?Br:p.cpu_percent>=20?Lr:"",m=u?`${u}${r}${Ir}`:r;d.push(` ${e}${m}${Fe(c)} ${l}`)}return d}(r,a,s?Math.max(0,s-u):void 0),m=[...d.slice(0,-l.length),...p,...l];return s&&m.length>s&&(m.length=s),m.join("\n")}class Kr extends ve{constructor(){super(...arguments),t(this,"name","top"),t(this,"description","Live system overview (Ctrl+C to exit)"),t(this,"aliases",["htop"])}async execute({output:e,rawInput:t,cols:r,signal:a}){var s,n;if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("top"),` ${Be("Live-updating system overview combining hardware")}`,` ${Be("stats, mesh metrics, and running processes.")}`,` ${Be("Refreshes every 3s. Press Ctrl+C to exit.")}`,"",Oe("top","start live display"),"",Pe("Sections"),` ${Be("Header Node name, version, uptime, load average")}`,` ${Be("Gauges CPU, memory, disk usage with bar charts")}`,` ${Be("Mesh Mode, neighbors, packet counts, airtime")}`,` ${Be("Network TCP/IP bytes and packet counters")}`,` ${Be("Processes Top 8 processes by CPU usage")}`,"",Pe("Aliases"),` ${Be("htop")}`].join("\n"));let o=j.getState().hardwareStats,i=[],c=j.getState().stats;try{const[e,t]=await Promise.all([f(),M()]);e.success&&e.data&&(o=e.data),t.success&&t.data&&(i=t.data.processes.sort((e,t)=>t.cpu_percent-e.cpu_percent))}catch{}if(!a.aborted){null==(s=e.enterFullscreen)||s.call(e);try{const t=e.write(qr(c,o,i,e.cols??r,e.rows));await new Promise(s=>{if(a.aborted)return void s();const n=setInterval(()=>{if(a.aborted)return clearInterval(n),void s();(async()=>{c=j.getState().stats;try{const[e,t]=await Promise.all([f(),M()]);e.success&&e.data&&(o=e.data),t.success&&t.data&&(i=t.data.processes.sort((e,t)=>t.cpu_percent-e.cpu_percent))}catch{}a.aborted||e.update(t,qr(c,o,i,e.cols??r,e.rows))})()},3e3);a.addEventListener("abort",()=>{clearInterval(n),s()},{once:!0})})}finally{null==(n=e.exitFullscreen)||n.call(e)}}}}const Wr=["DONT PANIC","C0FFEE","FEED C0DE","LOL","I CANNOT DO THAT"];function Gr(){return Wr[Math.floor(Math.random()*Wr.length)]}const Xr=new EventTarget,Vr="shell-phrase";function Yr(e){Xr.dispatchEvent(new CustomEvent(Vr,{detail:e??Gr()}))}class Jr extends ve{constructor(){super(...arguments),t(this,"name","fortune"),t(this,"description","Display a fortune on the header"),t(this,"aliases",["lol"])}execute({output:e}){const t=Gr();Yr(t),e.write(Be(` ${t}`))}}const Qr=new EventTarget,Zr="party-time";class ea extends ve{constructor(){super(...arguments),t(this,"name","partytime"),t(this,"description","Party on, Garth!"),t(this,"aliases",["party","excellent","waynesworld"])}execute({output:e}){Qr.dispatchEvent(new Event(Zr)),Yr("PARTY 0N GARTH"),e.write(Be(" SCHWING!"))}}class ta extends ve{constructor(){super(...arguments),t(this,"name","ver"),t(this,"description","Show version info"),t(this,"aliases",["version"])}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("ver"),` ${Be("Display pyMC_Repeater, core, and console version.")}`,` ${Be('Equivalent to firmware serial CLI "ver" command.')}`,"",Oe("ver","show version"),"",Pe("Aliases"),` ${Be("version")}`].join("\n"));const r=e.write("processing...","system");try{const t=await g(),a="0.9.261";e.update(r,[` ${De("pyMC_Repeater",Le(`v${t.version||"?"}`))}`,` ${De("pyMC_Core",Le(t.core_version||"?"))}`,` ${De("pyMC_Console",Le(`v${a}`))}`].join("\n"),"value")}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}class ra extends ve{constructor(){super(...arguments),t(this,"name","clock"),t(this,"description","Show system UTC time")}execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("clock"),` ${Be("Display the current system UTC time.")}`,` ${Be('Equivalent to firmware serial CLI "clock" command.')}`,` ${Be("Use to verify NTP sync and correlate packet timestamps.")}`,"",Oe("clock","show UTC time")].join("\n"));const r=new Date;e.write([` ${De("UTC",Le(r.toUTCString()))}`,` ${De("ISO",Le(r.toISOString()))}`,` ${De("Unix",Le(String(Math.floor(r.getTime()/1e3))))}`].join("\n"),"value")}}class aa extends ve{constructor(){super(...arguments),t(this,"name","stats-packets"),t(this,"description","Packet counters")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("stats-packets"),` ${Be("Display packet counters: sent, received, forwarded, dropped.")}`,` ${Be('Equivalent to firmware serial CLI "stats-packets" command.')}`,"",Oe("stats-packets","show packet counters")].join("\n"));const r=e.write("processing...","system");try{const t=await g(),a=t.rx_count??0,s=t.tx_count??0,n=t.forwarded_count??0,o=t.dropped_count??0,i=t.rx_per_hour??0,c=t.forwarded_per_hour??0,l=t.duplicate_cache_size??0;e.update(r,[` ${Ie("Packet Counters")}`,"",` ${De("RX",Le(String(a)))} ${Be(`${i.toFixed(1)}/hr`)}`,` ${De("TX",Le(String(s)))}`,` ${De("Forwarded",Le(String(n)))} ${Be(`${c.toFixed(1)}/hr`)}`,` ${De("Dropped",Le(String(o)))}`,"",` ${De("Dup cache",Le(String(l)))}`].join("\n"),"value")}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}function sa(e){return e>=6e4?`${(e/6e4).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(0)}ms`}class na extends ve{constructor(){super(...arguments),t(this,"name","stats-radio"),t(this,"description","Radio health stats")}async execute({output:e,rawInput:t}){var r;if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("stats-radio"),` ${Be("Display radio health: airtime, noise floor, duty cycle.")}`,` ${Be('Equivalent to firmware serial CLI "stats-radio" command.')}`,"",Oe("stats-radio","show radio stats")].join("\n"));const a=e.write("processing...","system");try{const t=await g(),s=null==(r=t.config)?void 0:r.radio,n=t.noise_floor_dbm,o=t.airtime_used_ms??0,i=t.airtime_remaining_ms??0,c=t.duty_cycle_percent??0,l=t.utilization_percent??0,d=t.total_airtime_ms??0,u=[` ${Ie("Radio Stats")}`,""];if(s){const e=s.frequency?`${(s.frequency/1e6).toFixed(3)} MHz`:"?",t=s.bandwidth?s.bandwidth/1e3+" kHz":"?";u.push(` ${De("Radio",Le(`${e} SF${s.spreading_factor??"?"} BW ${t} CR 4/${s.coding_rate??"?"} ${s.tx_power??"?"} dBm`))}`),u.push("")}u.push(` ${De("Noise floor",null!=n?Le(`${n} dBm`):Be("N/A"))}`),u.push(` ${De("Airtime used",Le(sa(o)))} ${Be(`remaining: ${sa(i)}`)}`),u.push(` ${De("Total airtime",Le(sa(d)))}`),u.push(` ${De("Duty cycle",Le(`${c.toFixed(1)}%`))}`),u.push(` ${De("Utilization",Le(`${l.toFixed(1)}%`))}`),e.update(a,u.join("\n"),"value")}catch(s){e.update(a,`Error: ${s instanceof Error?s.message:"Command failed"}`,"error")}}}function oa(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GB`:e>=1048576?`${(e/1048576).toFixed(0)} MB`:`${(e/1024).toFixed(0)} KB`}class ia extends ve{constructor(){super(...arguments),t(this,"name","stats-core"),t(this,"description","Engine vitals")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("stats-core"),` ${Be("Display engine vitals: uptime, memory, CPU, queue depth.")}`,` ${Be('Equivalent to firmware serial CLI "stats-core" command.')}`,` ${Be("On firmware this shows free heap — here we show Linux process health.")}`,"",Oe("stats-core","show core stats")].join("\n"));const r=e.write("processing...","system");try{const[t,a]=await Promise.all([g(),f()]),s=[` ${Ie("Core Stats")}`,"",` ${De("Uptime",Le($t(t.uptime_seconds??0)))}`,` ${De("Dup cache",Le(`${t.duplicate_cache_size??0} entries`))} ${Be(`TTL ${t.cache_ttl??"?"}s`)}`];if(a.success&&a.data){const e=a.data;s.push(""),s.push(` ${De("CPU",Le(`${e.cpu.usage_percent.toFixed(1)}%`))} ${Be(`${e.cpu.count} core${e.cpu.count>1?"s":""}`)}`),e.cpu.load_avg&&s.push(` ${De("Load",Le(`${e.cpu.load_avg["1min"].toFixed(2)} / ${e.cpu.load_avg["5min"].toFixed(2)} / ${e.cpu.load_avg["15min"].toFixed(2)}`))}`),s.push(` ${De("Memory",Le(`${oa(e.memory.used)} / ${oa(e.memory.total)}`))} ${Be(`${e.memory.usage_percent.toFixed(0)}%`)}`);const t=Object.entries(e.temperatures||{});t.length>0&&s.push(` ${De("Temp",Le(`${t[0][1].toFixed(1)}°C`))}`)}e.update(r,s.join("\n"),"value")}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}const ca=["@@@@@@@ @@@ @@@ @@@@@@@@@@ @@@@@@@ ","@@@@@@@@ @@@ @@@ @@@@@@@@@@@ @@@@@@@@ ","@@! @@@ @@! !@@ @@! @@! @@! !@@ ","!@! @!@ !@! @!! !@! !@! !@! !@! ","@!@@!@! !@!@! @!! !!@ @!@ !@! ","!!@!!! @!!! !@! ! !@! !!! ","!!: !!: !!: !!: :!! ",":!: :!: :!: :!: :!: "," :: :: ::: :: ::: ::: "," : : : : :: :: : "],la=ce-1;class da extends ve{constructor(){super(...arguments),t(this,"name","hello"),t(this,"description","Play the PYMC burst intro"),t(this,"aliases",["hi","intro"])}async execute({output:e,signal:t}){if(t.aborted)return;let r=0;const a=e.write(ne(ca,0).join("\n"));try{await new Promise(s=>{const n=setInterval(()=>{if(t.aborted||r>=la)return clearInterval(n),t.aborted||e.update(a,ne(ca,la).join("\n")),void s();r++,e.update(a,ne(ca,r).join("\n"))},oe);t.addEventListener("abort",()=>{clearInterval(n),s()},{once:!0})})}finally{ie()}}}const ua=J(e=>({entries:[],commandHistory:[],isInitialized:!1,addEntry:t=>{const r="undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),a={...t,id:r,timestamp:Date.now()};return e(e=>({entries:[...e.entries,a]})),r},updateEntry:(t,r)=>{e(e=>({entries:e.entries.map(e=>e.id===t?{...e,...r}:e)}))},addCommand:t=>{e(e=>({commandHistory:[...e.commandHistory,t]}))},clearEntries:()=>{e({entries:[],commandHistory:[]})},setInitialized:t=>{e({isInitialized:t})}}));function pa({isOpen:e,onClose:t}){const a=xr(),s=j(e=>e.stats);return r.jsxs(E,{open:e,onClose:t,size:"sm",children:[r.jsx(A,{icon:r.jsx(V,{size:20}),title:"Download Captures",onClose:t}),r.jsx(I,{className:"flex flex-col gap-2",children:0===a.length?r.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-fg-muted",children:[r.jsx(ye,{className:"w-8 h-8 opacity-40"}),r.jsx("p",{className:"text-sm",children:"No captures available."})]}):a.map(e=>r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 radius-inset bg-elevated/50 border border-edge-subtle",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"type-label text-fg-primary truncate",children:e.filename}),r.jsxs("p",{className:"text-xs text-fg-muted mt-0.5",children:[e.packetCount," packets · ",e.durationSec,"s · ~",Sr(e.sizeBytes)]})]}),r.jsx(F,{plain:!0,color:"primary",onClick:()=>(e=>{const t=a.find(t=>t.id===e);t&&Cr(t,s)})(e.id),title:"Download",className:"flex-shrink-0",children:r.jsx(V,{"data-slot":"icon"})})]},e.id))})]})}function ma(){const e=xr(),[t,s]=a.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsx(ae,{icon:r.jsx(fe,{size:20}),onClick:()=>s(!0),title:e.length>0?`Download captures (${e.length})`:"Captures",variant:"red",iconActiveColor:m.red}),r.jsx(pa,{isOpen:t,onClose:()=>s(!1)})]})}const ha=[{name:"acl",description:"Access control list statistics — identity and client counts.",body:["```","> acl","ACL Stats",""," Identities 2"," Total clients 5"," Admin 2"," Guest 3"," Repeater 1 ids 3 clients"," Room Server 1 ids 2 clients","```"],searchText:"acl access control list statistics identity client"},{name:"advert",description:"Broadcast a repeater advertisement to the mesh.",body:["```","> advert","✓ Advert sent","```"],searchText:"advert advertisement broadcast mesh"},{name:"board",description:"Hardware and platform info — CPU, memory, disk, temperatures, network I/O.",body:["```","> board"," Node Local-Node"," Runtime pyMC_Repeater v1.0.0"," Core v1.12.0",""," CPU 12.3% 4 cores"," Load 0.42 / 0.38 / 0.35"," Temp 48.2°C",""," Memory 412 MB / 664 MB 62%"," Disk 5.2 GB / 28.7 GB 18%",""," System uptime 14d 3h 22m"," Service uptime 2d 14h 32m"," Net TX/RX 128 MB / 342 MB","```"],searchText:"board hardware platform cpu memory disk temperature network"},{name:"cap",description:"Packet capture — start, stop, list, and export captures.",body:["**Sub-commands:** `start cap [sec]` · `end cap` · `list cap` · `export cap [id]`","","**`start cap [seconds]`** — Begin capture (default 120s, max 3600):","```","> start cap","Capturing... 118s remaining (4 captured)","","✓ Capture complete!"," Captured: 23 packets"," Duration: 120s"," Size: ~14.2 KB","```","","**`end cap`** — Stop capture early:","```","> end cap","✓ Capture stopped!"," Captured: 12 packets","```","","**`list cap`** — List saved captures:","```","> list cap","Capture Reports (2):"," 1. 23 pkts • 120s • ~14.2 KB (id: abc123)"," 2. 12 pkts • 34s • ~7.1 KB (id: def456)","```","","**`export cap [id]`** — Download by ID or index:","```","> export cap 1","✓ Downloading capture-abc123.json...","```"],searchText:"cap capture packet start end list export download diagnostic"},{name:"clear",description:"Clear the terminal screen.",body:["**Alias:** `cls`","```","> clear","```"],searchText:"clear cls screen"},{name:"clock",description:"Current system UTC time. Useful for NTP sync and packet timestamp correlation.",body:["```","> clock"," UTC Wed, 12 Feb 2026 00:01:34 GMT"," ISO 2026-02-12T00:01:34.000Z"," Unix 1770768094","```"],searchText:"clock time utc ntp unix iso timestamp"},{name:"convert",description:"Convert between hex and base64 encodings.",body:["**Usage:** `convert hex ` · `convert base64 `","```","> convert hex 48656C6C6F"," hex 48656C6C6F"," base64 SGVsbG8=","","> convert base64 SGVsbG8="," base64 SGVsbG8="," hex 48656C6C6F","```"],searchText:"convert hex base64 encoding decode"},{name:"get",description:"Read a configuration parameter.",body:[],interactive:"get",searchText:"get read config parameter name role lat lon radio freq tx bw sf cr txdelay mode duty flood advert"},{name:"help",description:"Show all commands, or detailed help for a specific command.",body:["**Alias:** `?` · `h`","```","> help Full command listing","> help ping Detailed help for ping","> ping help Same thing","```"],searchText:"help commands reference guide"},{name:"identities",description:"List all configured repeater and room server identities.",body:["**Alias:** `id` · `ids`","```","> identities","Identities (2)",""," 1. Local-Node repeater 0A1B2C3D"," 2. local-room room_server 0E5F6A7B","```"],searchText:"identities id ids repeater room server identity"},{name:"keys",description:"List configured transport encryption keys.",body:["```","> keys","Transport Keys (1)",""," main-transport flood: allow","```"],searchText:"keys transport encryption"},{name:"neighbors",description:"Direct RF neighbors with signal quality, RSSI, SNR, distance, and last-heard.",body:["**Alias:** `nb`","","**Sort qualifiers:** `sig` · `name` · `rssi` · `snr` · `dist` · `heard`","```","> neighbors","Direct Neighbors (4)","","+-------+-----------+-----------+--------+-------+--------+","| ▁▃▅▇█ | Node-1 | -87 dBm | 8.5 dB | 2.1km | 3m ago |","| ▁▃▅▇. | Relay-2 | -94 dBm | 5.2 dB | 4.8km | 1m ago |","| ▁▃▅.. | Node-3 | -108 dBm | 1.0 dB | 8.3km | 5m ago |","| ▁▃... | Node-4 | -118 dBm | -3 dB | 14km | 12m ago|","+-------+-----------+-----------+--------+-------+--------+","| SIG | NAME | RSSI | SNR | DIST | HEARD |","+-------+-----------+-----------+--------+-------+--------+","SF11/250kHz ant 3.5dBi nf -112dBm","```","","- **sig** — signal grade (weakest first)","- **name** — alphabetical","- **rssi** — RSSI (weakest first)","- **snr** — SNR (lowest first)","- **dist** — distance (closest first)","- **heard** — last seen (oldest first)"],searchText:"neighbors nb signal rssi snr distance sort direct rf"},{name:"packets",description:"Packet counters — received, transmitted, forwarded, dropped.",body:["```","> packets","Packet Stats 1321 total",""," Received 1284"," Transmitted 37"," Forwarded 891"," Dropped 14","```"],searchText:"packets received transmitted forwarded dropped counter"},{name:"ping",description:"Ping a neighbor by name or hex prefix. Shows RTT, signal quality, and path.",body:["**Usage:** `ping [timeout]`","```","> ping Node-1","▁▃▅▇█ Reply from Node-1",""," RTT 342ms"," RSSI -87 dBm"," SNR 8.5 dB"," Path direct"," Quality Excellent","```","","Custom timeout (default 30s):","```","> ping Node-4 60","```"],searchText:"ping rtt round trip time signal quality path neighbor"},{name:"restart",description:"Restart the pymc-repeater systemd service.",body:["**Alias:** `reboot`","```","> restart","Service is restarting (connection dropped).","Waiting for service... 8s","Service connected. (12s)","```","","The terminal polls automatically until the service comes back up."],searchText:"restart reboot service systemd"},{name:"rooms",description:"Room server statistics — message counts, active clients, sync status.",body:["```","> rooms","Rooms (1)",""," Local Room"," msgs 142 clients 3/5 sync running","```"],searchText:"rooms room server messages clients sync"},{name:"set",description:"Write a configuration parameter.",body:[],interactive:"set",searchText:"set write config parameter name lat lon freq tx bw sf cr txdelay mode duty log flood advert"},{name:"stats-core",description:"Engine vitals — uptime, duplicate cache, CPU, memory, temperature.",body:["```","> stats-core"," Core Stats",""," Uptime 2d 14h 32m"," Dup cache 128 entries TTL 900s",""," CPU 12.3% 4 cores"," Load 0.42 / 0.38 / 0.35"," Memory 412 MB / 664 MB 62%"," Temp 48.2°C","```"],searchText:"stats core engine vitals uptime cache cpu memory temperature"},{name:"stats-packets",description:"Firmware-compatible packet counters with rates and duplicate cache depth.",body:["```","> stats-packets"," Packet Counters",""," RX 1284 22.4/hr"," TX 37"," Forwarded 891 15.2/hr"," Dropped 14",""," Dup cache 128","```"],searchText:"stats packets firmware counter rate duplicate cache"},{name:"stats-radio",description:"Radio health — noise floor, airtime, duty cycle, and radio configuration.",body:["```","> stats-radio"," Radio Stats",""," Radio 906.875 MHz SF11 BW 250 kHz CR 4/5 22 dBm",""," Noise floor -112 dBm"," Airtime used 4.2s remaining: 55.8m"," Total airtime 1.2m"," Duty cycle 1.2%"," Utilization 0.8%","```"],searchText:"stats radio noise floor airtime duty cycle utilization"},{name:"status",description:"Quick summary of mode, neighbors, and uptime.",body:["**Alias:** `st`","```","> status","Local-Node repeater",""," Mode forward"," Neighbors 4 direct 12 total"," RX / TX 1284 / 37"," Uptime 2d 14h 32m","```"],searchText:"status st summary mode neighbors uptime"},{name:"top",description:"Live-updating system overview — CPU/memory gauges, mesh counters, processes.",body:["**Alias:** `htop`","","Refreshes every 3s. Press **Ctrl+C** to exit.","```","> top","Local-Node v1.0.0","──────────────────────────────────"," Sys 14d 3h 22m Svc 2d 14h 32m Load 0.42 0.38 0.35",""," CPU [████░░░░░░░░░░░░] 12.3% 4 cores"," Mem [██████████░░░░░░] 62.1% 412M/664M"," Dsk [███░░░░░░░░░░░░░] 18.4% 5.2G/28.7G"," cpu_thermal: 48.2°C",""," MESH"," Mode forward Nbrs 4/12 Noise -112dBm Air 1.2%"," RX 1284 TX 37 FWD 891 Drop 14"," RX/h 22 FWD/h 15",""," PROCS"," CPU MEM NAME"," 8.2 3.1 python3"," 2.1 1.4 cherrypy",""," 14:32:08 · Ctrl+C to exit","```","","Uses alternate screen buffer — scrollback is preserved."],searchText:"top htop live system overview cpu memory gauges mesh processes"},{name:"uptime",description:"How long the repeater service has been running.",body:["```","> uptime","Uptime 2d 14h 32m","```"],searchText:"uptime service running duration"},{name:"ver",description:"Version info for all three components.",body:["**Alias:** `version`","```","> ver"," pyMC_Repeater v1.0.0"," pyMC_Core v1.12.0"," pyMC_Console v1.0.0","```"],searchText:"ver version pymc repeater core console"}],ga=[{param:"name",category:"Identity",example:["> get name","name Local-Node"]},{param:"role",category:"Identity",example:["> get role","role repeater"]},{param:"lat",category:"Identity",example:["> get lat","lat 34.0522"],range:"-90 to 90"},{param:"lon",category:"Identity",example:["> get lon","lon -118.2437"],range:"-180 to 180"},{param:"public.key",category:"Identity",example:["> get public.key","public.key 0A1B2C3D4E5F..."]},{param:"radio",category:"Radio",example:["> get radio"," freq 906.875 MHz"," bw 250 kHz"," sf 11"," cr 4/5"," tx 22 dBm"]},{param:"freq",category:"Radio",example:["> get freq","freq 906.875 MHz"],range:"100–1000 MHz"},{param:"tx",category:"Radio",example:["> get tx","tx 22 dBm"],range:"2–22 dBm"},{param:"bw",category:"Radio",example:["> get bw","bw 250 kHz"],range:"7.8–500 kHz"},{param:"sf",category:"Radio",example:["> get sf","sf 11"],range:"5–12"},{param:"cr",category:"Radio",example:["> get cr","cr 4/5"],range:"5–8"},{param:"af",category:"Timing",example:["> get af","⚠ airtime_factor not yet exposed by pyMC_Repeater API."," Firmware range: 0-9. Tracked in CLI-Alignment.md."],range:"0–9 (pending)"},{param:"txdelay",category:"Timing",example:["> get txdelay","txdelay 1.0"],range:"0.0–5.0"},{param:"direct.txdelay",category:"Timing",example:["> get direct.txdelay","direct.txdelay 0.5"],range:"0.0–5.0"},{param:"rxdelay",category:"Timing",example:["> get rxdelay","rxdelay 0.0"],range:"≥ 0"},{param:"mode",category:"Repeater",example:["> get mode","mode forward"],range:"forward / monitor"},{param:"duty",category:"Repeater",example:["> get duty","duty on"],range:"on / off"},{param:"flood.max",category:"Repeater",example:["> get flood.max","flood.max 3"],range:"0–64"},{param:"advert.interval",category:"Repeater",example:["> get advert.interval","advert.interval 120m"],range:"0 (off) or 1–10080 min"},{param:"multi.acks",category:"Advanced",example:["> get multi.acks","multi.acks 0"],range:"0–255"},{param:"int.thresh",category:"Advanced",example:["> get int.thresh","int.thresh -120 dBm"],range:"-200 to 0 dBm"},{param:"agc.reset.interval",category:"Advanced",example:["> get agc.reset.interval","agc.reset.interval 0"],range:"≥ 0 (×4)"}],fa=[{param:"name",category:"Identity",example:["> set name Local-Node","OK - node_name set to Local-Node"],range:"text (no [ ] \\ / : , ? *)"},{param:"lat",category:"Identity",example:["> set lat 34.0522","OK - latitude set to 34.0522"],range:"-90 to 90"},{param:"lon",category:"Identity",example:["> set lon -118.2437","OK - longitude set to -118.2437"],range:"-180 to 180"},{param:"freq",category:"Radio",example:["> set freq 906.875","OK - frequency set to 906875000"],range:"100–1000 MHz"},{param:"tx",category:"Radio",example:["> set tx 22","OK - tx_power set to 22"],range:"2–22 dBm"},{param:"bw",category:"Radio",example:["> set bw 250","OK - bandwidth set to 250000"],range:"7.8, 10.4, 15.6, 20.8, 31.25, 41.7, 62.5, 125, 250, 500 kHz"},{param:"sf",category:"Radio",example:["> set sf 11","OK - spreading_factor set to 11"],range:"5–12"},{param:"cr",category:"Radio",example:["> set cr 5","OK - coding_rate set to 5"],range:"5–8"},{param:"af",category:"Timing",example:["> set af 2","⚠ airtime_factor not yet exposed by pyMC_Repeater API."," Firmware range: 0-9. Needs backend support."],range:"0–9 (pending)"},{param:"txdelay",category:"Timing",example:["> set txdelay 1.0","OK - tx_delay_factor set to 1"],range:"0.0–5.0"},{param:"direct.txdelay",category:"Timing",example:["> set direct.txdelay 0.5","OK - direct_tx_delay_factor set to 0.5"],range:"0.0–5.0"},{param:"rxdelay",category:"Timing",example:["> set rxdelay 0","OK - rx_delay_base set to 0"],range:"≥ 0"},{param:"mode",category:"Repeater",example:["> set mode forward","OK - Mode set to forward"],range:"forward / monitor"},{param:"flood.max",category:"Repeater",example:["> set flood.max 3","OK - max_flood_hops set to 3"],range:"0–64"},{param:"advert.interval",category:"Repeater",example:["> set advert.interval 120","OK - Local advert interval set to 120m"],range:"0 (off) or 1–10080 min"},{param:"duty",category:"Repeater",example:["> set duty on","OK - Duty cycle enabled"],range:"on / off"},{param:"log",category:"Repeater",example:["> set log info","OK - Log level set to INFO"],range:"debug, info, warning, error"},{param:"multi.acks",category:"Advanced",example:["> set multi.acks 0","OK - multi_acks set to 0"],range:"0–255"},{param:"int.thresh",category:"Advanced",example:["> set int.thresh -120","OK - interference_threshold set to -120"],range:"-200 to 0 dBm"},{param:"agc.reset.interval",category:"Advanced",example:["> set agc.reset.interval 8","OK - AGC reset interval set to 8"],range:"≥ 0 (rounded to ×4)"},{param:"prv.key",category:"Advanced",example:["> set prv.key <128-hex>","To set this key, run on the Pi:",""," sudo ./convert_firmware_key.sh ","","Then restart: sudo systemctl restart pymc-repeater"],range:"128-char hex (SSH only)"}];function ya({mode:e}){const t="get"===e?ga:fa,[s,o]=a.useState(0),i=t[s],c=a.useMemo(()=>{const e=new Map;for(const r of t){const t=e.get(r.category)||[];t.push(r),e.set(r.category,t)}return Array.from(e.entries())},[t]);return r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx("div",{className:"flex flex-col gap-1.5",children:c.map(([e,a])=>r.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[r.jsx("span",{className:"text-xs text-fg-muted w-16 shrink-0 text-right pr-1",children:e}),a.map(e=>{const a=t.indexOf(e),i=a===s;return r.jsx("button",{onClick:()=>o(a),className:n("px-1.5 py-0.5 type-data-xs radius-badge transition-colors cursor-pointer",i?"bg-sys-blue text-fg-invert font-semibold":"bg-elevated text-fg-secondary hover:bg-elevated/80 hover:text-sys-blue"),children:e.param},e.param)})]},e))}),r.jsx("pre",{className:"px-3 py-2.5 radius-inner bg-body text-fg-secondary type-code overflow-x-auto border border-edge-subtle",children:i.example.map((e,t)=>r.jsx("div",{children:e||" "},t))}),i.range&&r.jsxs("p",{className:"text-xs text-fg-muted",children:[r.jsx("span",{className:"text-fg-secondary font-medium",children:i.param})," — ",i.range]})]})}function xa(e,t){const a=e.split(/(\*\*[^*]+\*\*)/g);return r.jsx("span",{children:a.map((e,t)=>e.startsWith("**")&&e.endsWith("**")?r.jsx("strong",{className:"text-fg-primary font-semibold",children:e.slice(2,-2)},t):e.split(/(`[^`]+`)/g).map((e,a)=>e.startsWith("`")&&e.endsWith("`")?r.jsx("code",{className:"px-1 py-0.5 radius-badge bg-elevated text-sys-blue type-data-xs",children:e.slice(1,-1)},`${t}-${a}`):r.jsx("span",{children:e},`${t}-${a}`)))},t)}function va({lines:e}){const t=[];let a=0;for(;ar.jsx("div",{children:e||" "},t))},t.length));continue}s.trim()?s.startsWith("- ")?(t.push(r.jsxs("div",{className:"flex gap-2 text-sm text-fg-secondary pl-2 py-0.5",children:[r.jsx("span",{className:"text-fg-muted shrink-0",children:"•"}),r.jsx("span",{children:xa(s.slice(2),0)})]},t.length)),a++):(t.push(r.jsx("p",{className:"text-sm text-fg-secondary py-0.5",children:xa(s,0)},t.length)),a++):(t.push(r.jsx("div",{className:"h-1.5"},t.length)),a++)}return r.jsx(r.Fragment,{children:t})}function $a({isOpen:e,onClose:t,onUseCommand:c}){const[l,d]=a.useState(""),u=a.useMemo(()=>{if(!l.trim())return ha;const e=l.toLowerCase();return ha.filter(t=>t.name.includes(e)||t.searchText.includes(e)||t.description.toLowerCase().includes(e))},[l]),p=l.trim().length>0;return r.jsxs(E,{open:e,onClose:t,size:"3xl",motionPlus:!0,className:"sm:min-w-[540px] md:min-w-[680px]",children:[r.jsx(A,{icon:r.jsx(ge,{size:20}),title:"Terminal Command Guide",onClose:t}),r.jsxs(I,{className:"flex flex-col gap-0 !px-0 !py-0",children:[r.jsx("div",{className:"sticky top-0 z-10 px-5 py-3 border-b border-edge-subtle bg-surface/95 backdrop-blur-sm",children:r.jsxs("div",{className:"relative",children:[r.jsx(me,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-fg-muted"}),r.jsx("input",{type:"text",value:l,onChange:e=>d(e.target.value),placeholder:"Search commands...",className:"w-full pl-8 pr-3 py-1.5 text-sm bg-elevated border border-edge-subtle radius-inner text-fg-primary placeholder:text-fg-muted focus:outline-none focus:ring-1 focus:ring-sys-blue/50",autoFocus:!0})]})}),r.jsxs("div",{className:"overflow-y-auto px-5 py-3 h-[420px] sm:h-[520px] md:h-[600px]",children:[r.jsx(L,{mode:"popLayout",children:0===u.length?r.jsxs(B.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:O.normal,ease:D.easeOut},className:"flex flex-col items-center gap-2 py-10 text-fg-muted",children:[r.jsx(me,{className:"w-6 h-6 opacity-40"}),r.jsxs("p",{className:"text-sm",children:['No commands match "',l,'"']})]},"empty"):r.jsx(B.div,{initial:!1,className:"flex flex-col gap-1",children:r.jsx(L,{initial:!1,children:u.map(e=>r.jsx(B.div,{layout:"position",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:P.fade,className:"min-w-0",children:r.jsx(s,{children:({open:t})=>r.jsxs("div",{className:n("radius-inner border transition-colors",t?"border-edge-subtle bg-elevated/50":"border-transparent hover:bg-elevated/30"),children:[r.jsxs("div",{className:"flex items-center w-full min-w-0",children:[r.jsxs(o,{className:"flex items-center gap-3 flex-1 min-w-0 px-3 py-2 text-left cursor-pointer",children:[r.jsx(he,{size:14,className:n("shrink-0 text-fg-muted transition-transform duration-150",t&&"rotate-90")}),r.jsx("code",{className:"text-sm font-semibold text-sys-blue font-mono shrink-0",children:e.name}),r.jsx("span",{className:"text-xs text-fg-muted truncate min-w-0",children:e.description})]}),c&&r.jsx("button",{onClick:t=>{t.stopPropagation(),c(e.name)},className:"shrink-0 mr-2 px-2 py-0.5 text-xs font-semibold uppercase tracking-wider radius-badge bg-elevated text-fg-muted hover:text-sys-blue hover:bg-elevated/80 transition-colors cursor-pointer",title:`Use "${e.name}" in terminal`,children:"use"})]}),r.jsx(i,{className:"px-3 pb-3 pt-0 pl-9",children:e.interactive?r.jsx(ya,{mode:e.interactive}):r.jsx(va,{lines:e.body})})]})})},e.name))})},"list")}),r.jsx(L,{children:!p&&r.jsxs(B.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{duration:O.normal,ease:D.easeOut},className:"mt-4 px-3 py-3 radius-inner border border-edge-subtle bg-elevated/30",children:[r.jsx("p",{className:"text-xs font-semibold text-fg-muted mb-2",children:"Tips"}),r.jsxs("div",{className:"flex flex-col gap-1 text-xs text-fg-muted",children:[r.jsxs("p",{children:["Type ",r.jsx("code",{className:"px-1 py-0.5 radius-badge bg-elevated text-sys-blue font-mono",children:" help"})," in the terminal for detailed usage."]}),r.jsxs("p",{children:["Most commands have shorter aliases (e.g. ",r.jsx("code",{className:"px-1 py-0.5 radius-badge bg-elevated text-sys-blue font-mono",children:"st"}),", ",r.jsx("code",{className:"px-1 py-0.5 radius-badge bg-elevated text-sys-blue font-mono",children:"nb"}),", ",r.jsx("code",{className:"px-1 py-0.5 radius-badge bg-elevated text-sys-blue font-mono",children:"id"}),")."]}),r.jsxs("p",{children:["Signal bars ",r.jsx("span",{className:"font-mono",children:"▁▃▅▇█"})," are colored by link quality grade based on RSSI, SNR, and radio config."]}),r.jsx("p",{children:"Captures are stored in browser session only — export before closing the tab."})]})]})})]})]})]})}function ba({onUseCommand:e}){const[t,s]=a.useState(!1),n=e?t=>{s(!1),e(t)}:void 0;return r.jsxs(r.Fragment,{children:[r.jsx(ae,{icon:r.jsx(ge,{size:17,className:"translate-y-px"}),onClick:()=>s(!0),title:"CLI Command Guide"}),r.jsx($a,{isOpen:t,onClose:()=>s(!1),onUseCommand:n})]})}const wa=function(){const e=new xe,t=new xt(e);return e.register(t,new vt,new bt,new ta,new ra,new wt,new _t,new St,new aa,new na,new ia,new Wt,new rr,new mr,new ar,new sr,new hr,new jr,new Nr,new Tr,new Rr,new Mr,new Er,new Kr,new Jr,new ea,new da),e}(),_a=wa.all().flatMap(e=>[{cmd:e.name,desc:e.description,params:e.params,required:!!e.params},...e.aliases.filter(e=>e.includes(" ")).map(t=>({cmd:t,desc:e.description,params:e.params,required:!!e.params}))]);_a.push({cmd:"start cap",desc:"Start packet capture",params:"[seconds]",required:!0},{cmd:"end cap",desc:"Stop capture"},{cmd:"list cap",desc:"List captures"},{cmd:"export cap",desc:"Download capture",params:"[id]",required:!0});const ka=["sig","name","rssi","snr","dist","heard"],Ca={get:["name","role","lat","lon","radio","freq","tx","bw","sf","cr","af","txdelay","direct.txdelay","rxdelay","mode","repeat","flood.max","flood.advert.interval","advert.interval","duty","duty.max","multi.acks","int.thresh","agc.reset.interval","public.key","prv.key"],set:["name","lat","lon","freq","tx","bw","sf","cr","af","txdelay","direct.txdelay","rxdelay","mode","repeat","flood.max","flood.advert.interval","advert.interval","duty","log","multi.acks","int.thresh","agc.reset.interval","prv.key"],convert:["hex","base64"],neighbors:ka,nb:ka,"get neighbors":ka,"get neighbor":ka,"set mode":["forward","monitor"],"set duty":["on","off"],"set repeat":["on","off"],"set tx":["10","14","17","20","22"],"set sf":["7","8","9","10","11","12"],"set bw":["125","250","500"],"set cr":["5","6","7","8"],"set af":["0.5","1.0","1.5","2.0"],"set txdelay":["0.5","0.7","1.0","1.5"],"set direct.txdelay":["0.3","0.5","0.7"],"set log":["debug","info","warning","error"],"start cap":["30","60","120","300"]},Sa=["@@@@@@@ @@@ @@@ @@@@@@@@@@ @@@@@@@ ","@@@@@@@@ @@@ @@@ @@@@@@@@@@@ @@@@@@@@ ","@@! @@@ @@! !@@ @@! @@! @@! !@@ ","!@! @!@ !@! @!! !@! !@! !@! !@! ","@!@@!@! !@!@! @!! !!@ @!@ !@! ","!!@!!! @!!! !@! ! !@! !!! ","!!: !!: !!: !!: :!! ",":!: :!: :!: :!: :!: "," :: :: ::: :: ::: ::: "," : : : : :: :: : "];function ja(){return/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)||window.innerWidth<640}function Na(){const e=U(),{addCommand:t}=ua(),s=a.useRef(null),o=a.useRef(null),i=a.useRef(null),u=a.useRef(null),p=a.useRef(""),m=a.useRef(-1),g=a.useRef(""),f=a.useRef(!1),y=a.useRef(null),x=a.useRef(!1),v=a.useRef(!1),$=a.useRef(!1),b=a.useRef([]),w=a.useRef(()=>{}),_=z(),[k,C]=a.useState("C0dE"),[S,j]=a.useState(!1),N=a.useRef(null),T="C0dE",R=a.useCallback(e=>{N.current&&(clearInterval(N.current),N.current=null);const t=T.padEnd(7),r=t+" "+e+" "+t;let a=0;const s=r.length-7;j(!0),C(r.slice(0,7)),N.current=setInterval(()=>{if(a++,a>s)return clearInterval(N.current),N.current=null,j(!1),void C(T);C(r.slice(a,a+7))},280)},[]);a.useEffect(()=>{const e=function(e){const t=t=>e(t.detail);return Xr.addEventListener(Vr,t),()=>Xr.removeEventListener(Vr,t)}(R),t=setInterval(()=>{Math.random()<.02&&R(Gr())},45e3);return()=>{e(),clearInterval(t),N.current&&clearInterval(N.current)}},[R]);const[M,E]=a.useState(!1),A=a.useRef(null);a.useEffect(()=>{const e=(t=()=>{A.current&&clearTimeout(A.current),E(!0),A.current=setTimeout(()=>E(!1),5e3)},Qr.addEventListener(Zr,t),()=>Qr.removeEventListener(Zr,t));var t;return()=>{e(),A.current&&clearTimeout(A.current)}},[]);const[I,F]=a.useState({show:!1,options:[],selectedIndex:0,input:""}),L=a.useRef([]),B=a.useRef(0);a.useEffect(()=>{(null==e?void 0:e.neighbors)&&(b.current=Object.values(e.neighbors).map(e=>e.node_name||e.name).filter(e=>!!e).sort())},[null==e?void 0:e.neighbors]);const D=a.useCallback(()=>{var e;null==(e=o.current)||e.write(`${H()||"user"}@pyMC${be}: $${be} `)},[]),O=a.useCallback(()=>{const e=o.current;e&&(e.write(Ge),D(),e.write(p.current))},[D]),P=a.useCallback(e=>{const t=function(e,t){const r=e.toLowerCase(),a=r.trim();if(!a)return[];const s=r.length>a.length&&r.endsWith(" ");if(!a.includes(" ")&&!s)return _a.filter(e=>e.cmd.toLowerCase().startsWith(a));const n=s?a:a.substring(0,a.lastIndexOf(" ")),o=s?"":a.substring(a.lastIndexOf(" ")+1);if("ping"===n&&t.length>0)return t.filter(e=>e.toLowerCase().startsWith(o)).slice(0,10).map(e=>({cmd:`ping ${e}`,desc:`→ ${e}`}));const i=Ca[n];if(i){const e=i.filter(e=>e.toLowerCase().startsWith(o)).map(e=>({cmd:`${n} ${e}`,desc:`→ ${e}`}));if(!s&&o){const t=new Set(e.map(e=>e.cmd));for(const r of _a){const s=r.cmd.toLowerCase();s.startsWith(a)&&!t.has(s)&&(e.push(r),t.add(s))}}return e}return _a.filter(e=>e.cmd.toLowerCase().startsWith(a))}(e,b.current);L.current=t,B.current=0;const r=t.length>0&&e.trim().length>0;F({show:r,options:t,selectedIndex:0,input:e.trim()})},[]),W=a.useCallback(()=>{L.current=[],B.current=0,F({show:!1,options:[],selectedIndex:0,input:""})},[]),G=a.useCallback(e=>{var t;const r=L.current[e];r&&(p.current=r.required?r.cmd+" ":r.cmd,O(),r.required?P(p.current):W(),null==(t=o.current)||t.focus())},[O,P,W]),X=a.useCallback(async e=>{const r=o.current;if(!r)return;const a=e.trim();if(!a)return void D();f.current=!0;const s=new AbortController;y.current=s,t(a),m.current=-1;let n=0;const i={get cols(){return r.cols},get rows(){return r.rows},write(e,t="default"){const a=("default"===t?e:Ae(e,t)).split("\n");for(const s of a)r.writeln(s);return n=Ze(a,r.cols),String(n)},update(e,t,a){if($.current)r.write("");else if(n>0)for(let o=0;o{const t=o.current;if(!t)return;if(!v.current)return;if(f.current){for(let r=0;rrequestAnimationFrame(()=>{var t;return null==(t=document.querySelector(`[data-ac-index="${e}"]`))?void 0:t.scrollIntoView({block:"nearest"})});for(let s=0;s0){const e=L.current[B.current];e&&(p.current=e.cmd,O())}W();const e=p.current;p.current="",t.writeln(""),X(e);continue}if(127!==n&&8!==n)if(3!==n)if(12!==n)if(9!==n)if(27!==n)n>=32&&(p.current+=e[s],t.write(e[s]),m.current=-1,P(p.current));else{if(91===e.charCodeAt(s+1)){const t=e.charCodeAt(s+2);if(s+=2,65===t){if(L.current.length>0){const e=Math.max(B.current-1,0);B.current=e,F(t=>({...t,selectedIndex:e})),a(e)}else r.length>0&&(-1===m.current&&(g.current=p.current),m.current0){const e=Math.min(B.current+1,L.current.length-1);B.current=e,F(t=>({...t,selectedIndex:e})),a(e)}else m.current>0?(m.current--,p.current=r[r.length-1-m.current]||"",O()):0===m.current&&(m.current=-1,p.current=g.current,O());continue}if(67===t||68===t)continue;continue}L.current.length>0&&W()}else L.current.length>0&&G(B.current);else t.clear(),W(),O();else p.current="",W(),t.writeln("^C"),D();else p.current.length>0&&(p.current=p.current.slice(0,-1),t.write("\b \b"),P(p.current))}},[W,P,G,D,O,X]);a.useEffect(()=>{w.current=V},[V]);const Y=a.useCallback(async()=>{const e=o.current;if(!e||x.current)return;x.current=!0;const t="",r="",a=Sa.length,s=ce-1;try{const t=ne(Sa,0);for(const r of t)e.writeln(r);await new Promise(t=>{let r=0;const n=setInterval(()=>{if(r>=s)return clearInterval(n),void t();r++,e.write(`[${a}F`);const o=ne(Sa,r);for(const t of o)e.write(`${t}\n`)},oe)})}finally{ie()}e.writeln(""),e.write(Be("● Initializing terminal...")),await new Promise(e=>setTimeout(e,300)),e.write(Ge),e.writeln(`${t}✓ Initializing terminal...${r}`),e.write(Be("● Connecting to repeater...")),await new Promise(e=>setTimeout(e,500)),e.write(Ge),"connected"===q.getState().health?e.writeln(`${t}✓ Connected to repeater${r}`):e.writeln(`${je}~ Connection status unknown${be}`),e.writeln(Be("Ready. Type 'help' for commands.")),e.writeln(""),D(),v.current=!0},[D]);a.useEffect(()=>{const e=s.current;if(!e)return;const t=new c({theme:tt(),fontFamily:'"JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',fontSize:13,lineHeight:.65,cursorBlink:!1,cursorStyle:"underline",scrollback:1e4,convertEol:!0,allowTransparency:!0,rightClickSelectsWord:!1}),r=new l;t.loadAddon(r),t.loadAddon(new d),t.open(e),r.fit(),o.current=t,i.current=r;const a=t.onData(e=>w.current(e)),n=function(e){return h.subscribe(()=>{e.options.theme=tt()})}(t),u=new ResizeObserver(()=>{requestAnimationFrame(()=>r.fit())});return u.observe(e),Y(),ja()||t.focus(),()=>{var e;null==(e=y.current)||e.abort(),$.current&&(t.write(Ye+Ve),$.current=!1),a.dispose(),n(),u.disconnect(),t.dispose(),o.current=null,i.current=null}},[]);const J=a.useCallback(e=>{const t=e.target.value;t.length>0&&(V(t),e.target.value="")},[V]),Q=a.useCallback(e=>{"Enter"===e.key?(e.preventDefault(),V("\r")):"Backspace"===e.key?(e.preventDefault(),V("")):"ArrowUp"===e.key?(e.preventDefault(),V("")):"ArrowDown"===e.key&&(e.preventDefault(),V(""))},[V]),Z=a.useCallback(()=>{var e,t;ja()?null==(e=u.current)||e.focus():null==(t=o.current)||t.focus()},[]);a.useEffect(()=>{if(!ja())return;const e=()=>{var e;const t=null==(e=s.current)?void 0:e.querySelector(".xterm-viewport");t&&(t.scrollTop=t.scrollHeight),requestAnimationFrame(()=>{var e;return null==(e=i.current)?void 0:e.fit()})},t=window.visualViewport;if(t){const r=()=>{t.height<.75*window.innerHeight&&e()};return t.addEventListener("resize",r),()=>t.removeEventListener("resize",r)}const r=u.current;if(r){const t=()=>setTimeout(e,300);return r.addEventListener("focus",t),()=>r.removeEventListener("focus",t)}},[]);const ee=a.useCallback(e=>{p.current=e+" ",O(),P(p.current),setTimeout(()=>{var e;null==(e=s.current)||e.click()},400)},[O,P]);return r.jsxs(le,{children:[r.jsx(de,{title:"Terminal",icon:r.jsx(K,{})}),r.jsx(ue,{children:r.jsxs("div",{className:"terminal-card flex flex-col gap-1.5",children:[r.jsxs("div",{className:"card-terminal-header flex-wrap",children:[r.jsx("span",{className:"seven-seg-panel",children:r.jsx(se,{text:k,minChars:7,size:24,noCycle:S})}),r.jsxs("div",{className:"header-well flex items-center gap-1 sm:order-last",children:[r.jsx(ba,{onUseCommand:ee}),r.jsx(ma,{})]}),r.jsx("div",{className:"card-terminal-ridge flex-1 min-w-4 sm:hidden"}),r.jsx("div",{className:"header-well self-stretch flex-col sm:order-first",children:r.jsxs("div",{className:"indicator-key"+("connected"===_?" indicator-key--active":"degraded"===_?" indicator-key--sending":""),children:[r.jsx("span",{className:"indicator-key__label",children:"ONLINE"}),r.jsx("span",{className:"indicator-key__led"})]})}),r.jsx("div",{className:"card-terminal-ridge flex-1 min-w-8 hidden sm:block"})]}),r.jsx(pe,{noPadding:!0,className:"flex flex-col flex-1 min-h-0 overflow-hidden card-terminal",onClick:Z,children:r.jsxs("div",{className:"card-terminal-well flex-1 min-h-0 flex flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex-1 min-h-0 terminal-gutter relative",children:[r.jsx("div",{ref:s,className:"h-full w-full"}),M&&r.jsxs("div",{className:"absolute inset-0 z-10 flex items-center justify-center",onClick:()=>E(!1),children:[r.jsx("div",{className:"absolute inset-0 animate-[partytime-bg_5s_ease-out_forwards]",style:{background:"rgba(0,0,0,0.82)"}}),r.jsxs("div",{className:"relative z-10 animate-[partytime-crt_5s_ease-out_forwards] partytime-glow",children:[r.jsx("img",{src:"/assets/partytime.gif",alt:"No way.",className:"max-h-[60vh] max-w-[70vw] object-contain rounded"}),r.jsx("div",{className:"absolute inset-0 pointer-events-none rounded partytime-scanlines"})]})]})]}),I.show&&I.options.length>0&&r.jsxs("div",{className:"flex-shrink-0 overflow-hidden terminal-completions",style:{borderTop:"1px solid var(--terminal-border)",background:"var(--terminal-bg-input)"},children:[r.jsx("div",{className:"overflow-y-auto",style:{maxHeight:"176px"},children:I.options.map((e,t)=>{const a=t===I.selectedIndex,s=I.input.length;return r.jsxs("div",{"data-ac-index":t,onClick:()=>G(t),className:n("flex items-baseline gap-2 px-3 py-0.5 cursor-pointer transition-colors",a?"text-sys-blue":"text-fg-primary"),style:{background:a?"var(--terminal-autocomplete-hover)":void 0},onMouseEnter:e=>{a||(e.currentTarget.style.background="var(--terminal-autocomplete-hover)")},onMouseLeave:e=>{a||(e.currentTarget.style.background="")},children:[r.jsx("span",{className:"w-3 shrink-0 text-center text-sys-blue opacity-80",children:a?"▸":""}),r.jsxs("span",{className:"min-w-0 truncate flex-1",children:[r.jsx("span",{className:"font-semibold text-sys-blue",children:e.cmd.substring(0,s)}),e.cmd.substring(s)]}),r.jsx("span",{className:"shrink-0 text-[11px] text-fg-muted pl-3",children:e.desc})]},e.cmd)})}),r.jsxs("div",{className:"flex justify-between items-center px-3 py-0.5 text-xs text-fg-muted",style:{borderTop:"1px solid var(--terminal-border)"},children:[r.jsx("span",{children:"Tab · ↑↓ · Esc"}),r.jsxs("span",{children:[I.options.length," match",1!==I.options.length?"es":""]})]})]}),r.jsx("input",{ref:u,type:"text",className:"sr-only",onChange:J,onKeyDown:Q,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"aria-label":"Terminal input"}),r.jsxs("div",{className:"px-3 sm:px-4 py-1 flex justify-between text-xs text-fg-muted",style:{borderTop:"1px solid var(--terminal-border)"},children:[r.jsx("span",{className:"hidden sm:inline",children:"↑↓ History · Tab · Esc"}),r.jsx("span",{className:"sm:hidden",children:"Terminal"}),(null==e?void 0:e.version)&&r.jsxs("span",{children:["pyMC v",e.version]})]})]})})]})})]})}export{Na as default}; +var e=Object.defineProperty,t=(t,r,a)=>((t,r,a)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a)(t,"symbol"!=typeof r?r+"":r,a);import{j as r,r as a,X as s,c as n,x as o,d as i}from"./vendor-react-j_fHog8x.js";import{D as c,o as l,L as d}from"./xterm-Cq-DlOOL.js";import{c as u,Z as p,bk as m,bG as h,bH as g,bI as f,bJ as y,n as x,bK as v,bL as $,bM as b,bc as w,ac as _,bN as k,a4 as C,a3 as S,aH as j,bO as N,bP as T,bQ as R,by as M,W as E,bR as A,X as I,B as F,A as L,m as B,bS as D,bT as O,ba as P,t as U,bU as z,bV as H,bW as q,bX as K}from"./index-BBcIGlRT.js";import{s as W}from"./signal-scoring-CcBiRcks.js";import{h as G,c as X,D as V}from"./geo-utils-BJfOkt8p.js";import{a as Y}from"./ping-CZgZ44Jt.js";import{c as J}from"./vendor-core-CmkNwW1A.js";import{P as Q,d as Z}from"./payload-decoders-C74LtYDG.js";import{g as ee,r as te}from"./system-7wpk3UyT.js";import{g as re,K as ae,S as se}from"./KeycapButton-Dvk7y-ZW.js";import{g as ne,B as oe,r as ie,T as ce}from"./ascii-burst-CXC_pYgi.js";import{P as le,b as de,B as ue,a as pe}from"./PageLayout-CYYy29Pg.js";import{S as me}from"./search-Cs3jReDi.js";import{C as he}from"./chevron-right-B6r5SVTI.js";import"./maplibre-gl-b91ci4Kr.js";import"./keycap-sfx-CAsrNe23.js";const ge=u("book-open-text",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]]),fe=u("folders",[["path",{d:"M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5a1.5 1.5 0 0 1 1.2.6l.6.8a1.5 1.5 0 0 0 1.2.6z",key:"a4852j"}],["path",{d:"M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1",key:"yxbcw3"}]]),ye=u("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);class xe{constructor(){t(this,"commands",[])}register(...e){this.commands.push(...e)}find(e){let t;for(const r of this.commands)r.matches(e)&&(!t||r.name.length>t.name.length)&&(t=r);return t}all(){return this.commands}}class ve{constructor(){t(this,"aliases",[]),t(this,"params")}matches(e){const t=e.toLowerCase().trim(),r=e=>t===e||t.startsWith(e+" ");return r(this.name)||this.aliases.some(r)}argsAfterName(e){const t=e.toLowerCase().trim(),r=[this.name,...this.aliases].sort((e,t)=>t.length-e.length);for(const a of r)if(t.startsWith(a))return e.trim().slice(a.length).trim();return e.trim()}}const $e="[",be=`${$e}0m`,we=`${$e}1m`,_e=`${$e}2m`,ke=`${$e}3m`,Ce=`${$e}32m`,Se=`${$e}31m`,je=`${$e}33m`,Ne=`${$e}36m`,Te=`${$e}34m`,Re=`${$e}90m`,Me=`${$e}92m`,Ee=`${$e}96m`;function Ae(e,t){switch(t){case"success":return`${Ce}${e}${be}`;case"error":return`${Se}${e}${be}`;case"warning":return`${je}${e}${be}`;case"info":return`${Ne}${e}${be}`;case"value":return`${Te}${e}${be}`;case"system":return`${Re}${e}${be}`;default:return e}}function Ie(e){return`${we}${e}${be}`}function Fe(e){return`${_e}${e}${be}`}function Le(e){return`${Te}${e}${be}`}function Be(e){return`${Re}${e}${be}`}function De(e,t){return`${Re}${e}: ${be}${Te}${we}${t}${be}`}function Oe(e,t,r=22){const a=e.split(" "),s=a[0];let n=Ne;return"get"===s?n=Ce:"set"===s&&(n=je),` ${a.length>1?`${n}${we}${s}${be} ${Te}${a.slice(1).join(" ")}${be}`:`${n}${we}${e}${be}`}${" ".repeat(Math.max(1,r-e.length))}${Re}${t}${be}`}function Pe(e){return`${we}${Te}${e}${be}`}function Ue(e){return`${Re}${ke}${e}${be}`}function ze(e){return`${Se}${we}●${be} ${Re}${e}${be}`}function He(e){const t=e<1e3?`${e.toFixed(0)}ms`:`${(e/1e3).toFixed(1)}s`;return`${function(e){return e<1500?Me:e<4e3?Ce:e<8e3?je:e<15e3?Se:`${Se}${we}`}(e)}${t}${be}`}function qe(e){switch(e){case"excellent":return Ee;case"good":return Ce;case"fair":return je;case"poor":return Se;case"critical":return`${Se}${we}`;default:return Re}}function Ke(e,t){return`${qe(t)}${e}${be}`}function We(e){return e.replace(/[\p{Emoji_Presentation}\p{Extended_Pictographic}\uFE0F\u200D]/gu,"").trim()}const Ge="\r";function Xe(e=1){return`[${e}A`}const Ve="[?1049l",Ye="[?25h";function Je(e){return e.replace(/\x1b\[[0-9;]*m/g,"")}function Qe(e){return Je(e).length}function Ze(e,t){let r=0;for(const a of e){const e=Je(a).length;r+=0===e?1:Math.ceil(e/t)}return r}function et(e,t){const r=function(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}(e);return r||t}function tt(){const e="light"===document.documentElement.dataset.mode,t=et("--terminal-bg","#0d0d0d"),r=et("--sys-blue",m.blue);if(e){const e="#EFF0F1";return{background:e,foreground:"#111314",cursor:m.blue,cursorAccent:e,selectionBackground:`${m.blue}30`,selectionForeground:"#111314",black:"#111314",red:m.red,green:m.green,yellow:m.amber,blue:m.blue,magenta:m.purple,cyan:m.cyan,white:e,brightBlack:p[500],brightRed:m.red,brightGreen:m.green,brightYellow:m.orange,brightBlue:m.indigo,brightMagenta:m.pink,brightCyan:m.teal,brightWhite:p[600]}}const a=et("--text-primary","#e0e0e0"),s=r+"40",n=et("--sys-red",m.red),o=et("--sys-green",m.green),i=et("--sys-purple",m.purple),c=et("--sys-blue",m.blue),l=et("--sys-cyan",m.cyan),d=et("--text-muted",p[500]),u=et("--text-secondary",p[400]);return{background:t,foreground:a,cursor:r,cursorAccent:t,selectionBackground:s,selectionForeground:a,black:et("--bg-surface",p[900]),red:n,green:o,yellow:i,blue:c,magenta:i,cyan:l,white:a,brightBlack:d,brightRed:n,brightGreen:"#4ADE80",brightYellow:i,brightBlue:c,brightMagenta:i,brightCyan:l,brightWhite:u}}const rt="[",at=`${rt}0m`,st=`${rt}1m`,nt=`${rt}2m`,ot=`${rt}34m`,it=`${rt}90m`,ct=" ",lt=[{label:"INFORMATION",entries:[{cmd:"status",desc:"Repeater status summary",alias:"st"},{cmd:"top",desc:"Live system overview (Ctrl+C to exit)",alias:"htop"},{cmd:"ver",desc:"Version info",alias:"version"},{cmd:"clock",desc:"System UTC time"},{cmd:"uptime",desc:"System uptime"},{cmd:"board",desc:"Board / platform info"},{cmd:"packets",desc:"Packet statistics"},{cmd:"stats-packets",desc:"Packet counters (firmware compat)"},{cmd:"stats-radio",desc:"Radio health stats (firmware compat)"},{cmd:"stats-core",desc:"Engine vitals (firmware compat)"}]},{label:"NETWORK",entries:[{cmd:"neighbors [sort]",desc:"Direct RF neighbors",alias:"nb",sub:"sig · name · rssi · snr · dist · heard"},{cmd:"ping {name}",desc:"Ping neighbor (name or 0xXX)"},{cmd:"identities",desc:"List configured identities",alias:"id ids"},{cmd:"keys",desc:"Transport keys"},{cmd:"acl",desc:"ACL statistics"},{cmd:"rooms",desc:"Room statistics"}]},{label:"RADIO",entries:[{cmd:"get {param}",desc:"Read parameter"},{cmd:"set {param} {value}",desc:"Write parameter"},{cmd:"advert",desc:"Send advertisement"}]},{label:"SYSTEM",entries:[{cmd:"restart",desc:"Restart service",alias:"reboot"},{cmd:"start cap [seconds]",desc:"Start packet capture"},{cmd:"end cap",desc:"Stop capture"},{cmd:"list cap",desc:"List captures"},{cmd:"export cap [id]",desc:"Download capture"}]},{label:"TOOLS",entries:[{cmd:"convert hex {value}",desc:"Hex → base64"},{cmd:"convert base64 {value}",desc:"Base64 → hex"},{cmd:"clear",desc:"Clear terminal",alias:"cls"},{cmd:"help [command]",desc:"Show this help",alias:"? h"}]}],dt=[{cat:"Identity",params:["name","role","lat","lon","public.key"]},{cat:"Radio",params:["radio","freq","tx","bw","sf","cr"]},{cat:"Timing",params:["txdelay","direct.txdelay","rxdelay"]},{cat:"Repeater",params:["mode","duty","repeat","flood.max","advert.interval"]},{cat:"Advanced",params:["multi.acks","int.thresh","agc.reset.interval"]},{cat:"set only",params:["log","prv.key"]}];function ut(e){return`${it}${"─".repeat(e)}${at}`}function pt(e){const t=Math.max(3,e-12-8-6);return` ${ot}${st}pymc console${at} ${ut(t)} ${it}terminal${at}`}function mt(e){return` ${it}${e}${at}`}function ht(e,t){const r=[],a=e.alias?` ${nt}${e.alias}${at}`:"";return 4+Math.max(e.cmd.length,24)+e.desc.length+(e.alias?2+e.alias.length:0)<=t?r.push(" "+Oe(e.cmd,e.desc,24)+a):(r.push(" "+Oe(e.cmd,"",24)),r.push(ct+Be(e.desc)+a)),e.sub&&r.push(`${ct}${Fe("└ "+e.sub)}`),r}function gt(e){return e.split(" · ").map(e=>`${ot}${e}${at}`).join(`${it} · ${at}`)}function ft(e,t){const r=[];let a=[],s=0;for(const n of e){const e=a.length>0?3+n.length:n.length;s+e>t&&a.length>0?(r.push(a),a=[n],s=n.length):(a.push(n),s+=e)}return a.length>0&&r.push(a),r}function yt(e){const t=["",mt("GET/SET QUALIFIERS")],r=Math.max(20,e-4-13);for(const a of dt){const e=`${it}${a.cat.padEnd(13)}${at}`,s=ft(a.params,r),n=" ".repeat(17);t.push(` ${e}${gt(s[0].join(" · "))}`);for(let r=1;r help for detailed usage")}`]}(r)),e.write(s.join("\n"))}}class vt extends ve{constructor(){super(...arguments),t(this,"name","clear"),t(this,"description","Clear terminal screen"),t(this,"aliases",["cls"])}execute({output:e,rawInput:t}){"help"!==this.argsAfterName(t).toLowerCase().trim()?e.clear():e.write([Pe("clear"),` ${Be("Clear all terminal output.")}`,"",Oe("clear","clear the screen"),"",Pe("Aliases"),` ${Be("cls")}`].join("\n"))}}function $t(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),a=Math.floor(e%3600/60);return t>0?`${t}d ${r}h ${a}m`:r>0?`${r}h ${a}m`:`${a}m`}class bt extends ve{constructor(){super(...arguments),t(this,"name","status"),t(this,"description","Get repeater status summary"),t(this,"aliases",["st"])}async execute({output:e,rawInput:t}){var r,a,s;if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("status"),` ${Be("Show a quick summary of mode, neighbor count, and uptime.")}`,"",Oe("status","show summary"),"",Pe("Aliases"),` ${Be("st")}`].join("\n"));const n=e.write("processing...","system");try{const t=await g(),o=(null==(a=null==(r=t.config)?void 0:r.repeater)?void 0:a.mode)||"unknown",i=Object.keys(t.neighbors||{}).length,c=Object.values(t.neighbors||{}).filter(e=>e.zero_hop).length,l=(null==(s=t.config)?void 0:s.node_name)||t.node_name||"unknown",d=$t(t.uptime_seconds||0);e.update(n,[`${Ie(l)} ${Be("repeater")}`,"",` ${De("Mode",Le(o))}`,` ${De("Neighbors",`${Le(String(c))} direct ${Be(`${i} total`)}`)}`,` ${De("RX / TX",`${Le(String(t.rx_count??0))} / ${Le(String(t.tx_count??0))}`)}`,` ${De("Uptime",Le(d))}`].join("\n"))}catch(o){e.update(n,`Error: ${o instanceof Error?o.message:"Command failed"}`,"error")}}}class wt extends ve{constructor(){super(...arguments),t(this,"name","uptime"),t(this,"description","Show system uptime")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("uptime"),` ${Be("Display how long the repeater service has been running.")}`,"",Oe("uptime","show uptime")].join("\n"));const r=e.write("processing...","system");try{const t=await g();e.update(r,De("Uptime",Le($t(t.uptime_seconds||0))))}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}class _t extends ve{constructor(){super(...arguments),t(this,"name","packets"),t(this,"description","Show packet statistics")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("packets"),` ${Be("Display packet counters (received, transmitted, forwarded, dropped).")}`,"",Oe("packets","show packet stats")].join("\n"));const r=e.write("processing...","system");try{const t=await g(),a=(t.rx_count??0)+(t.tx_count??0);e.update(r,[Pe("Packet Stats")+` ${Be(`${a} total`)}`,"",` ${De("Received",Le(String(t.rx_count??0)))}`,` ${De("Transmitted",Le(String(t.tx_count??0)))}`,` ${De("Forwarded",Le(String(t.forwarded_count??0)))}`,` ${De("Dropped",Le(String(t.dropped_count??0)))}`].join("\n"))}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}function kt(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GB`:e>=1048576?`${(e/1048576).toFixed(0)} MB`:`${(e/1024).toFixed(0)} KB`}function Ct(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),a=Math.floor(e%3600/60);return t>0?`${t}d ${r}h ${a}m`:r>0?`${r}h ${a}m`:`${a}m`}class St extends ve{constructor(){super(...arguments),t(this,"name","board"),t(this,"description","Show board/platform info")}async execute({output:e,rawInput:t}){var r;if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("board"),` ${Be("Display platform and hardware information.")}`,"",Oe("board","show board info")].join("\n"));const a=e.write("loading...","system");try{const[t,s]=await Promise.all([f(),g()]),n=[];if(n.push(` ${De("Node",Le(s.node_name||"Unknown"))}`),n.push(` ${De("Runtime",Le(`pyMC_Repeater v${s.version||"?"}`))}`),s.core_version&&n.push(` ${De("Core",Le(s.core_version))}`),n.push(""),t.success&&t.data){const e=t.data;n.push(` ${De("CPU",Le(`${e.cpu.usage_percent.toFixed(1)}%`))} ${Be(`${e.cpu.count} core${e.cpu.count>1?"s":""}`)}`),e.cpu.load_avg&&n.push(` ${De("Load",Le(`${e.cpu.load_avg["1min"].toFixed(2)} / ${e.cpu.load_avg["5min"].toFixed(2)} / ${e.cpu.load_avg["15min"].toFixed(2)}`))}`);const a=Object.entries(e.temperatures||{});if(a.length>0){const e=a[0];n.push(` ${De("Temp",Le(`${e[1].toFixed(1)}°C`))}${a.length>1?` ${Be(a.slice(1).map(([e,t])=>`${e}: ${t.toFixed(1)}°C`).join(", "))}`:""}`)}n.push(""),n.push(` ${De("Memory",Le(`${kt(e.memory.used)} / ${kt(e.memory.total)}`))} ${Be(`${e.memory.usage_percent.toFixed(0)}%`)}`),n.push(` ${De("Disk",Le(`${kt(e.disk.used)} / ${kt(e.disk.total)}`))} ${Be(`${e.disk.usage_percent.toFixed(0)}%`)}`),n.push(""),(null==(r=e.system)?void 0:r.uptime)&&n.push(` ${De("System uptime",Le(Ct(e.system.uptime)))}`),n.push(` ${De("Service uptime",Le(Ct(s.uptime_seconds)))}`),e.network&&n.push(` ${De("Net TX/RX",Le(`${kt(e.network.bytes_sent)} / ${kt(e.network.bytes_recv)}`))}`)}else n.push(` ${De("Platform",Le("Linux"))}`),n.push(` ${De("Service uptime",Le(Ct(s.uptime_seconds)))}`),n.push(` ${Be("Hardware stats unavailable")}`);e.update(a,n.join("\n"),"value")}catch(s){e.update(a,`Error: ${s instanceof Error?s.message:"Failed to load hardware stats"}`,"error")}}}const jt="",Nt="",Tt="",Rt="",Mt="",Et=48;function At(e,t,r,a){return s=>{if(s<=0)return 0;if(s>=1)return 1;let n=s;for(let t=0;t<8;t++){const t=3*(1-n)*(1-n)*n*e+3*(1-n)*n*n*r+n*n*n-s,a=3*(1-n)*(1-n)*e+6*(1-n)*n*(r-e)+3*n*n*(1-r);if(Math.abs(a)<1e-7)break;n=Math.max(0,Math.min(1,n-t/a))}return 3*(1-n)*(1-n)*n*t+3*(1-n)*n*n*a+n*n*n}}const It=At(.25,1,.5,1),Ft=At(.4,0,1,1);function Lt(e,t){const r=e%14;return Math.sin(.45*r+.04*r*r+.25*t)}const Bt=[8,16,32,128],Dt=[1,2,4,64].map((e,t)=>e|Bt[t]);function Ot(e,t,r,a){a<4?e[r]|=Dt[a]:t[r]|=Dt[a-4]}function Pt(e){return e>.8?""+Nt:e>.6?""+Nt:e>.4?Mt+Nt:e>.2?Mt:e>.08?Rt:Rt+Tt}function Ut(e,t,r){const a=new Uint8Array(Et),s=new Uint8Array(Et),n=new Float32Array(Et),o=.35*e;for(let i=0;i=t)continue;const l=t-c,d=Math.min(1,l/3),u=Math.min(1,c/2),p=l<5?1+.3*(1-l/5):1,m=Math.min(1,d*u*p);if(m<.04)continue;const h=1+.06*Math.sin(.7*e+.3*c),g=Lt(c,o)*m*h*3.5+3.5,f=Math.abs(g-3.5)/3.5,y=l<6?1-l/6:0;n[i]=Math.min(1,.65*f+.35*y)*m;const x=Math.max(0,Math.min(7,Math.round(g)));if(g>=3.5){for(let t=3;t<=x;t++)Ot(a,s,i,t);const e=Math.round(.4*(g-3.5));for(let t=Math.max(0,3-e);t<3;t++)Ot(a,s,i,t)}else{for(let t=x;t<=4;t++)Ot(a,s,i,t);const e=Math.round(.4*(3.5-g));for(let t=5;t<=Math.min(7,4+e);t++)Ot(a,s,i,t)}}return{top:a,bot:s,heat:n}}function zt(e,t,r){const a=new Uint8Array(Et),s=new Uint8Array(Et),n=new Float32Array(Et),o=Math.exp(.5*-t),i=Math.max(0,10-2.5*t),c=.7+.2*t;for(let l=0;l=Et)continue;const d=o*(1-l/i);if(d<.04)continue;n[t]=d;const u=Math.sin(l*c+.6*r)*d*3.5+3.5,p=Math.max(0,Math.min(7,Math.round(u)));if(u>=3.5)for(let e=3;e<=p;e++)Ot(a,s,t,e);else for(let e=p;e<=4;e++)Ot(a,s,t,e)}return{top:a,bot:s,heat:n}}function Ht(e,t){let r="",a="";for(let s=0;s{a++,e.update(s,qt(a,t,Date.now()-r).join("\n"))},50);return{id:s,stop:()=>clearInterval(n)}}class Wt extends ve{constructor(){super(...arguments),t(this,"name","advert"),t(this,"description","Send repeater advertisement")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("advert"),` ${Be("Broadcast a repeater advertisement to the mesh network.")}`,"",Oe("advert","send advert now"),"",Ue("Adverts announce this repeater's presence to neighbors.")].join("\n"));const r=Kt(e,"broadcast");try{const t=await y();r.stop(),t.success?e.update(r.id,`✓ ${Le("Advert sent")}`,"success"):e.update(r.id,`Error: ${t.error||"Failed"}`,"error")}catch(a){r.stop(),e.update(r.id,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}const Gt=["sig","name","rssi","snr","dist","heard"],Xt={excellent:5,good:4,fair:3,poor:2,critical:1};function Vt(e){const t=Math.floor(Date.now()/1e3-e);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Yt(e){return e<1e3?`${Math.round(e)}m`:`${(e/1e3).toFixed(1)}km`}const Jt={excellent:5,good:4,fair:3,poor:2,critical:1};function Qt(e){const t=Jt[e]??0,r=qe(e);return(t>0?`${r}${"█".repeat(t)}${be}`:"")+Be("⣿".repeat(5-t))}function Zt(e,t=e=>e){return{text:e,color:t}}function er(e){return Be("+"+e.map(e=>"-".repeat(e+2)).join("+")+"+")}function tr(e,t){const r=e.map((e,r)=>{if(null!=e.rendered){const a=Math.max(0,t[r]-e.text.length);return" "+e.rendered+" ".repeat(a)+" "}return" "+e.color((a=e.text,s=t[r],a.length>=s?a.slice(0,s):a+" ".repeat(s-a.length)))+" ";var a,s});return Be("|")+r.join(Be("|"))+Be("|")}class rr extends ve{constructor(){super(...arguments),t(this,"name","neighbors"),t(this,"description","Show direct RF neighbors with signal stats"),t(this,"aliases",["nb","get neighbors","get neighbor"]),t(this,"params","[sig|name|rssi|snr|dist|heard]")}async execute(e){const{output:t,cols:r}=e,a=this.argsAfterName(e.rawInput).toLowerCase().trim();if("help"===a)return void this.printUsage(t);const s=Gt.includes(a)?a:null,n=t.write("processing...","system");try{const e=await g(),a=e.neighbors||{},o=Object.entries(a).filter(([,e])=>e.zero_hop);if(0===o.length){const e=Object.keys(a).length;return void t.update(n,e>0?`No direct neighbors. ${e} relayed neighbor${1!==e?"s":""} known.`:"No neighbors discovered yet.","warning")}const i=function(e){var t;const r=null==(t=e.config)?void 0:t.radio;return(null==r?void 0:r.spreading_factor)&&(null==r?void 0:r.bandwidth)?{sf:r.spreading_factor,bwHz:r.bandwidth}:null}(e),c=function(e){var t;const r=null==(t=e.config)?void 0:t.repeater;return r&&G(r.latitude,r.longitude)?{lat:r.latitude,lon:r.longitude}:null}(e),l=e.noise_floor_dbm;this.sortNeighbors(o,s,i,c,l);const d=s?` ${Fe(`sorted by ${s}`)}`:"",u=[Pe(`Direct Neighbors (${o.length})`)+d,""];if(r<55)for(const[t,r]of o)u.push(...this.cardLayout(t,r,i,c,l));else{const e=r>=70&&null!=c,t=o.map(([t,r])=>this.buildRow(t,r,i,c,l,e)),a=e?["SIG","NAME","RSSI","SNR","DIST","HEARD"]:["SIG","NAME","RSSI","SNR","HEARD"],s=a.slice(1).map((e,r)=>Math.max(e.length,...t.map(e=>e[r+1].text.length))),n=5,d=s.reduce((e,t)=>e+t+3,0),p=Math.max(4,r-d-n-7),m=[n,Math.min(p,Math.max(4,...t.map(e=>e[1].text.length))),...s.slice(1)];u.push(er(m),...t.map(e=>tr(e,m)),er(m),tr(a.map(e=>Zt(e,Ie)),m),er(m)),u.push(this.footer(i,l))}t.update(n,u.join("\n"))}catch(o){t.update(n,`Error: ${o instanceof Error?o.message:"Command failed"}`,"error")}}sortNeighbors(e,t,r,a,s){switch(t){case"sig":e.sort(([,e],[,t])=>(Xt[this.gradeNeighbor(e,r,s)]??0)-(Xt[this.gradeNeighbor(t,r,s)]??0));break;case"name":e.sort(([e,t],[r,a])=>{const s=(t.name||t.node_name||e.slice(0,8)).toLowerCase(),n=(a.name||a.node_name||r.slice(0,8)).toLowerCase();return s.localeCompare(n)});break;case"rssi":e.sort(([,e],[,t])=>(e.rssi??-999)-(t.rssi??-999));break;case"snr":e.sort(([,e],[,t])=>(e.snr??-999)-(t.snr??-999));break;case"dist":e.sort(([,e],[,t])=>(this.distTo(e,a)??1/0)-(this.distTo(t,a)??1/0));break;case"heard":e.sort(([,e],[,t])=>(e.last_seen||0)-(t.last_seen||0));break;default:e.sort(([,e],[,t])=>(t.last_seen||0)-(e.last_seen||0))}}gradeNeighbor(e,t,r){const a=null!=e.rssi?e.rssi-3.5:null,s=null!=r&&r>-100?1:0,n=W(e.snr??null,a,t,s);return(null==n?void 0:n.finalGrade)??"critical"}distTo(e,t){return t&&G(e.latitude,e.longitude)?X(t.lat,t.lon,e.latitude,e.longitude):null}buildRow(e,t,r,a,s,n){const o=this.gradeNeighbor(t,r,s),i=We(t.name||t.node_name||e.slice(0,8))||e.slice(0,8),c=null!=t.rssi?`${t.rssi} dBm`:"-",l=null!=t.snr?`${t.snr} dB`:"-",d=t.last_seen?Vt(t.last_seen):"-",u=[(p=Qt(o),{text:"|||||",color:e=>e,rendered:p}),Zt(i,Ie),Zt(c,Le),Zt(l,Le)];var p;if(n){const e=this.distTo(t,a);u.push(Zt(null!=e?Yt(e):"-",Fe))}return u.push(Zt(d,Fe)),u}cardLayout(e,t,r,a,s){const n=this.gradeNeighbor(t,r,s),o=We(t.name||t.node_name||e.slice(0,8))||e.slice(0,8),i=null!=t.rssi?`${t.rssi}`:"-",c=null!=t.snr?`${t.snr}`:"-",l=t.last_seen?Vt(t.last_seen):"-",d=this.distTo(t,a),u=null!=d?` ${Be("dist")} ${Le(Yt(d))}`:"";return[`${Qt(n)} ${Ie(o)}`,` ${Be("rssi")} ${Le(i)} ${Be("snr")} ${Le(c)}${u} ${Fe(l)}`,""]}footer(e,t){const r=[];return e&&r.push(`SF${e.sf}/${e.bwHz>=1e3?e.bwHz/1e3+"kHz":e.bwHz+"Hz"}`),r.push("ant 3.5dBi"),null!=t&&r.push(`nf ${t}dBm`),Be(r.join(" "))}printUsage(e){const t=[Pe("neighbors"),` ${Be("Show direct RF neighbors with signal quality, RSSI, SNR, and distance.")}`,"",Pe("Usage"),Oe("neighbors","default sort (most recent)"),Oe("neighbors sig","sort by signal grade (weakest first)"),Oe("neighbors name","sort alphabetically"),Oe("neighbors rssi","sort by RSSI (weakest first)"),Oe("neighbors snr","sort by SNR (lowest first)"),Oe("neighbors dist","sort by distance (closest first)"),Oe("neighbors heard","sort by last seen (oldest first)"),Oe("neighbors help","show this help"),"",Pe("Aliases"),` ${Be("nb, get neighbors, get neighbor")}`,"",Ue("Signal bars factor radio config, noise floor, and 3.5 dBi antenna gain."),Ue("Only zero-hop (direct RF) neighbors are shown.")];e.write(t.join("\n"))}}class ar extends ve{constructor(){super(...arguments),t(this,"name","get"),t(this,"description","Get repeater parameter"),t(this,"params","{parameter}")}async execute({output:e,rawInput:t}){const r=this.argsAfterName(t).toLowerCase().trim();if("help"===r||!r)return void e.write([Pe("get"),` ${Be("Read a repeater configuration parameter.")}`,"",Pe("Identity"),Oe("get name","node name"),Oe("get role","node role"),Oe("get public.key","public key"),"",Pe("Location"),Oe("get lat","latitude"),Oe("get lon","longitude"),"",Pe("Radio"),Oe("get radio","full radio summary"),Oe("get freq","frequency (MHz)"),Oe("get tx","TX power (dBm)"),Oe("get bw","bandwidth (kHz)"),Oe("get sf","spreading factor"),Oe("get cr","coding rate"),"",Pe("Timing"),Oe("get af","airtime factor (pending backend)"),Oe("get txdelay","TX delay factor"),Oe("get direct.txdelay","direct TX delay"),Oe("get rxdelay","RX delay base"),"",Pe("Repeater"),Oe("get mode","forward or monitor"),Oe("get flood.max","max flood hops"),Oe("get advert.interval","advert interval"),Oe("get duty","duty cycle state"),"",Pe("Advanced"),Oe("get multi.acks","multi-ack count"),Oe("get int.thresh","interference threshold (dBm)"),Oe("get agc.reset.interval","AGC reset interval")].join("\n"));const a=e.write("processing...","system");try{const t=await g(),{result:s,type:n}=function(e,t){const r=t.config||{},a=r.radio||{},s=r.repeater||{},n=r.delays||{},o=r.duty_cycle||{},i=(e,t)=>({result:De(e,Le(t)),type:"value"});switch(e){case"name":return i("name",r.node_name||"Unknown");case"role":return i("role","repeater");case"lat":return i("lat",null!=s.latitude?String(s.latitude):"not set");case"lon":return i("lon",null!=s.longitude?String(s.longitude):"not set");case"freq":return i("freq",a.frequency?`${(a.frequency/1e6).toFixed(3)} MHz`:"?");case"tx":return i("tx",null!=a.tx_power?`${a.tx_power} dBm`:"?");case"bw":return i("bw",a.bandwidth?a.bandwidth/1e3+" kHz":"?");case"sf":return i("sf",String(a.spreading_factor??"?"));case"cr":return i("cr",a.coding_rate?`4/${a.coding_rate}`:"?");case"radio":return a.frequency?{result:[` ${De("freq",Le(`${(a.frequency/1e6).toFixed(3)} MHz`))}`,` ${De("bw",Le(a.bandwidth/1e3+" kHz"))}`,` ${De("sf",Le(String(a.spreading_factor)))}`,` ${De("cr",Le(`4/${a.coding_rate}`))}`,` ${De("tx",Le(`${a.tx_power} dBm`))}`].join("\n"),type:"value"}:i("radio","?");case"af":case"airtime.factor":return{result:`${Be("airtime_factor is not yet exposed by the pyMC_Repeater API.")}\n${Be("Firmware range: 0-9. Controls airtime budget fraction.")}\n${Be("Tracked in CLI-Alignment.md — needs backend support.")}`,type:"warning"};case"txdelay":return i("txdelay",String(n.tx_delay_factor??"1.0"));case"direct.txdelay":return i("direct.txdelay",String(n.direct_tx_delay_factor??"0.5"));case"rxdelay":return i("rxdelay",String(n.rx_delay_base??"0.0"));case"mode":return i("mode",s.mode||"forward");case"repeat":return i("repeat","forward"===s.mode?"on":"off");case"flood.max":return i("flood.max",String(s.max_flood_hops??"3"));case"flood.advert.interval":return i("flood.advert.interval",null!=s.send_advert_interval_hours?`${s.send_advert_interval_hours}h`:"?");case"advert.interval":return i("advert.interval",null!=s.advert_interval_minutes?`${s.advert_interval_minutes}m`:"120m");case"duty":case"duty.enabled":return i("duty",o.enforcement_enabled?"on":"off");case"duty.max":return i("duty.max",null!=o.max_airtime_percent?`${o.max_airtime_percent}%`:"?");case"multi.acks":return i("multi.acks",String(s.multi_acks??"0"));case"int.thresh":return i("int.thresh",`${s.interference_threshold??-120} dBm`);case"agc.reset.interval":return i("agc.reset.interval",String(s.agc_reset_interval??"0"));case"public.key":return i("public.key",t.public_key||"not available");case"prv.key":return{result:`${Be("Private key stored in /etc/pymc_repeater/config.yaml")}\n\n ${De("view",Le("sudo grep identity_key /etc/pymc_repeater/config.yaml"))}\n ${De("set",Le("sudo ./convert_firmware_key.sh <64-byte-hex>"))}`,type:"info"};case"guest.password":case"allow.read.only":return{result:`${Be("Security settings not exposed via stats API.")}\n${Be("Check /etc/pymc_repeater/config.yaml")}`,type:"warning"};default:return{result:`Unknown parameter: ${Le(e)}\n${Be('Run "get help" to see available parameters.')}`,type:"error"}}}(r,t);e.update(a,s,n)}catch(s){e.update(a,`Error: ${s instanceof Error?s.message:"Command failed"}`,"error")}}}class sr extends ve{constructor(){super(...arguments),t(this,"name","set"),t(this,"description","Set repeater parameter"),t(this,"params","{parameter} {value}")}async execute({output:e,rawInput:t}){var r;const a=this.argsAfterName(t).split(/\s+/),s=null==(r=a[0])?void 0:r.toLowerCase(),n=a.slice(1).join(" ");if("help"===s||!s)return void e.write([Pe("set"),` ${Be("Write a repeater configuration parameter.")}`,"",Pe("Identity"),Oe("set name ","node name"),Oe("set lat ","latitude (-90 to 90)"),Oe("set lon ","longitude (-180 to 180)"),"",Pe("Radio"),Oe("set freq ","frequency"),Oe("set tx ","TX power (2-22)"),Oe("set bw ","bandwidth"),Oe("set sf <5-12>","spreading factor"),Oe("set cr <5-8>","coding rate"),"",Pe("Timing"),Oe("set af <0-9>","airtime factor (pending backend)"),Oe("set txdelay <0-5>","TX delay factor"),Oe("set direct.txdelay <0-5>","direct TX delay"),Oe("set rxdelay ","RX delay base"),"",Pe("Repeater"),Oe("set mode ","forward or monitor"),Oe("set flood.max <0-64>","max flood hops"),Oe("set advert.interval ","advert interval (min)"),Oe("set duty ","duty cycle enforcement"),Oe("set log ","log level"),"",Pe("Advanced"),Oe("set multi.acks ","multi-ack count"),Oe("set int.thresh ","interference threshold"),Oe("set agc.reset.interval ","AGC reset interval (x4)"),"",Ue("Some changes require a service restart.")].join("\n"));const o=e.write("processing...","system");try{const{result:r,type:a}=await async function(e,t,r){switch(e){case"mode":return async function(e){const t=e.toLowerCase();return"forward"!==t&&"monitor"!==t?ur('Mode must be "forward" or "monitor"'):(await b(t)).success?dr(`OK - Mode set to ${t}`):ur("Failed")}(t);case"duty":return async function(e){const t="on"===e.toLowerCase()||"1"===e;return(await $(t)).success?dr("OK - Duty cycle "+(t?"enabled":"disabled")):ur("Failed")}(t);case"tx":return nr("tx_power",ir(t,2,22,"TX power must be 2-22 dBm"));case"sf":return nr("spreading_factor",ir(t,5,12,"SF must be 5-12"));case"af":case"airtime.factor":return{result:"Error: airtime_factor is not yet exposed by the pyMC_Repeater API.\nFirmware range: 0-9. Tracked in CLI-Alignment.md — needs backend support.",type:"info"};case"txdelay":return nr("tx_delay_factor",cr(t,0,5,"TX delay must be 0.0-5.0"));case"direct.txdelay":return nr("direct_tx_delay_factor",cr(t,0,5,"Direct TX delay must be 0.0-5.0"));case"rxdelay":return nr("rx_delay_base",function(e){const t=parseFloat(e);return isNaN(t)||t<0?{ok:!1,error:"Error: RX delay must be >= 0"}:{ok:!0,value:t}}(t));case"flood.max":return nr("max_flood_hops",ir(t,0,64,"Max flood hops must be 0-64"));case"log":return async function(e){const t=e.toUpperCase();if(!["DEBUG","INFO","WARNING","ERROR"].includes(t))return ur("Level must be debug, info, warning, or error");const r=await v(t);return r.success?dr(`OK - Log level set to ${t}`):ur(r.error||"Failed")}(t);case"multi.acks":return nr("multi_acks",ir(t,0,255,"Multi-acks must be 0-255"));case"int.thresh":return nr("interference_threshold",ir(t,-200,0,"Interference threshold must be -200 to 0 dBm"));case"agc.reset.interval":{const e=lr(t);if(!e.ok)return ur(e.error);if(e.value<0)return ur("AGC reset interval must be >= 0");const r=4*Math.floor(e.value/4);return or("agc_reset_interval",r,`OK - AGC reset interval set to ${r}${r!==e.value?` (rounded from ${e.value})`:""}`)}case"name":{const e=r.trim().substring(r.toLowerCase().indexOf("name")+5).trim();return e?/[\[\]\\/\\:,?*]/.test(e)?ur("Name contains invalid characters: [ ] \\ / : , ? * are not allowed"):nr("node_name",{ok:!0,value:e}):ur("Node name cannot be empty")}case"lat":return nr("latitude",cr(t,-90,90,"Latitude must be -90 to 90"));case"lon":return nr("longitude",cr(t,-180,180,"Longitude must be -180 to 180"));case"freq":{const e=cr(t,100,1e3,"Frequency must be 100-1000 MHz");return e.ok?nr("frequency",{ok:!0,value:1e6*e.value}):ur(e.error)}case"bw":{const e=[7.8,10.4,15.6,20.8,31.25,41.7,62.5,125,250,500],r=parseFloat(t);return isNaN(r)||!e.includes(r)?ur(`BW must be one of: ${e.join(", ")} kHz`):nr("bandwidth",{ok:!0,value:1e3*r})}case"cr":return nr("coding_rate",ir(t,5,8,"Coding rate must be 5-8"));case"advert.interval":{const e=lr(t);return e.ok?0!==e.value&&(e.value<1||e.value>10080)?ur("Advert interval must be 0 (off) or 1-10080 minutes"):or("advert_interval_minutes",e.value,0===e.value?"OK - Local adverts disabled":`OK - Local advert interval set to ${e.value}m`):ur(e.error)}case"flood.advert.interval":{const e=lr(t);return e.ok?0!==e.value&&(e.value<3||e.value>168)?ur("Flood advert interval must be 0 (off) or 3-168 hours"):or("flood_advert_interval_hours",e.value,0===e.value?"OK - Flood adverts disabled":`OK - Flood advert interval set to ${e.value}h`):ur(e.error)}case"prv.key":{const e=t.trim();return e?/^[0-9a-fA-F]+$/.test(e)?128!==e.length?ur(`Key must be 64 bytes (128 hex chars), got ${e.length} chars`):{result:`To set this key, run on the Pi:\n\n sudo ./convert_firmware_key.sh ${e}\n\nThen restart: sudo systemctl restart pymc-repeater`,type:"info"}:ur("Private key must be a hex string"):ur("Private key cannot be empty")}default:return ur(`Unknown parameter: ${e}`)}}(s,n,t);e.update(o,r,a)}catch(i){e.update(o,`Error: ${i instanceof Error?i.message:"Command failed"}`,"error")}}}async function nr(e,t){if(!t.ok)return ur(t.error);const r=await x({[e]:t.value});if(!r.success)return ur(r.error||"Failed");let a=`OK - ${e} set to ${t.value}`;return r.restart_required&&(a+="\n⚠ Service restart required for changes to take effect\nRun: sudo systemctl restart pymc_repeater"),dr(a)}async function or(e,t,r){const a=await x({[e]:t});if(!a.success)return ur(a.error||"Failed");let s=r;return a.restart_required&&(s+="\n⚠ Service restart required for changes to take effect\nRun: sudo systemctl restart pymc_repeater"),dr(s)}function ir(e,t,r,a){const s=parseInt(e);return isNaN(s)||sr?{ok:!1,error:`Error: ${a}`}:{ok:!0,value:s}}function cr(e,t,r,a){const s=parseFloat(e);return isNaN(s)||sr?{ok:!1,error:`Error: ${a}`}:{ok:!0,value:s}}function lr(e){const t=parseInt(e);return isNaN(t)?{ok:!1,error:"Error: Expected a number"}:{ok:!0,value:t}}function dr(e){return{result:e,type:"success"}}function ur(e){return{result:`Error: ${e}`,type:"error"}}const pr={excellent:5,good:4,fair:3,poor:2,critical:1};class mr extends ve{constructor(){super(...arguments),t(this,"name","ping"),t(this,"description","Ping neighbor (name or 0xXX)"),t(this,"params","{target} [timeout]")}async execute({output:e,rawInput:t}){var r,a,s,n;const o=this.argsAfterName(t).trim(),i=o.split(/\s+/);if("help"===(null==(r=i[0])?void 0:r.toLowerCase()))return void e.write([Pe("ping"),` ${Be("Send a ping to a neighbor and measure round-trip time, signal quality, and path.")}`,"",Oe("ping ","ping by node name"),Oe("ping 0xAB","ping by hex prefix"),Oe("ping 60","ping with custom timeout (seconds)"),"",Ue("Default timeout: 30s. Signal bars factor radio config and noise floor.")].join("\n"));const c=i[i.length-1],l=parseInt(c),d=i.length>1&&!isNaN(l)&&l>0,u=d?i.slice(0,-1).join(" "):o,p=d?l:30;if(!u)return void e.write([Pe("ping"),` ${Be("Send a ping to a neighbor and measure round-trip time.")}`,"",Oe("ping ","ping by node name"),Oe("ping 60","with custom timeout"),"",Ue('Run "ping help" for full usage.')].join("\n"));const m=Kt(e,u);try{const[t,r]=await Promise.all([Y(u,p),g()]);if(m.stop(),t.success&&t.data){const o=t.data,i=null==(a=r.config)?void 0:a.radio,c=(null==i?void 0:i.spreading_factor)&&(null==i?void 0:i.bandwidth)?{sf:i.spreading_factor,bwHz:i.bandwidth}:null,l=r.noise_floor_dbm,d=null!=l&&l>-100?1:0,u=o.rssi-3.5,p=W(o.snr_db,u,c,d),h=(null==p?void 0:p.finalGrade)??"critical",g=function(e){const t=pr[e]??0,r=qe(e);return(t>0?`${r}${"█".repeat(t)}${be}`:"")+Be("·".repeat(5-t))}(h),f=(null==(s=o.path)?void 0:s.length)?o.path.length:0,y=(null==(n=o.path)?void 0:n.length)?o.path.join(" > "):"direct",x=h.charAt(0).toUpperCase()+h.slice(1),v=[`${g} ${Ie("Reply from")} ${Le(o.target_id)}`,"",` ${De("RTT",He(o.rtt_ms))}`,` ${De("RSSI",`${o.rssi} dBm`)}`,` ${De("SNR",`${o.snr_db} dB`)}`,` ${De("Path",y)}${f>0?Be(` (${f} hop${1!==f?"s":""})`):""}`,` ${De("Quality",Ke(x,h))}`],$=[];c&&$.push(`SF${c.sf}/${c.bwHz>=1e3?c.bwHz/1e3+"kHz":c.bwHz+"Hz"}`),$.push("ant 3.5dBi"),null!=l&&$.push(`nf ${l}dBm`),v.push("",Be($.join(" "))),e.update(m.id,v.join("\n"))}else e.update(m.id,t.error||"Ping failed","error")}catch(h){m.stop(),e.update(m.id,`Error: ${h instanceof Error?h.message:"Ping failed"}`,"error")}}}class hr extends ve{constructor(){super(...arguments),t(this,"name","convert"),t(this,"description","Convert between hex and base64"),t(this,"params","hex|base64 {value}")}execute({output:e,args:t}){var r;const a=null==(r=t[1])?void 0:r.toLowerCase(),s=t.slice(2).join(" ").trim();"help"!==a&&(a||s)?"hex"===a?this.hexToBase64(e,s):"base64"===a?this.base64ToHex(e,s):e.write([Pe("convert"),` ${Be("Convert between hex and base64 encodings.")}`,"",Oe("convert hex ","hex → base64"),Oe("convert base64 ","base64 → hex")].join("\n")):e.write([Pe("convert"),` ${Be("Convert between hex and base64 encodings.")}`,"",Oe("convert hex ","hex → base64"),Oe("convert base64 ","base64 → hex"),"",Ue("Example: convert hex 48656C6C6F")].join("\n"))}hexToBase64(e,t){if(t)if(/^[0-9a-fA-F]+$/.test(t))if(t.length%2==0)try{const r=new Uint8Array(t.length/2);for(let e=0;e","error")}base64ToHex(e,t){if(t)try{const r="function"==typeof globalThis.atob?globalThis.atob(t):Buffer.from(t,"base64").toString("binary");let a="";for(let e=0;e","error")}}function gr(){const e=new Date;return`${e.toISOString().slice(0,10)}_${e.toTimeString().slice(0,8).replace(/:/g,"-")}`}function fr(e,t){return`pymc-${e.toISOString().slice(0,10)}-${e.toTimeString().slice(0,5).replace(":","")}-${t}s.json`}const yr=J((e,t)=>({isCapturing:!1,captureStartTime:null,captureStartPacketHashes:new Set,captureTimer:null,reports:[],startCapture:r=>{const{captureTimer:a}=t();a&&clearTimeout(a),e({isCapturing:!0,captureStartTime:new Date,captureStartPacketHashes:new Set(r.map(e=>e.packet_hash))})},stopCapture:r=>{const{isCapturing:a,captureStartTime:s,captureStartPacketHashes:n,captureTimer:o}=t();if(!a||!s)return null;o&&clearTimeout(o);const i=new Date,c=Math.round((i.getTime()-s.getTime())/1e3),l=s.getTime()/1e3,d=r.filter(e=>!n.has(e.packet_hash)&&e.timestamp>=l).sort((e,t)=>e.timestamp-t.timestamp),u={id:gr(),filename:fr(s,c),startTime:s,endTime:i,durationSec:c,packetCount:d.length,packets:d,sizeBytes:500*d.length};return e(e=>({isCapturing:!1,captureStartTime:null,captureStartPacketHashes:new Set,captureTimer:null,reports:[u,...e.reports].slice(0,10)})),u},getReport:e=>t().reports.find(t=>t.id===e),_setTimer:t=>e({captureTimer:t})})),xr=()=>yr(e=>e.reports);function vr(e){var t;return(null==(t=e.match(/.{1,2}/g))?void 0:t.join(" ").toUpperCase())||""}function $r(e){return void 0===e?"UNKNOWN":S[e]??`TYPE_${e}`}function br(e){return void 0===e?"UNKNOWN":C[e]??`ROUTE_${e}`}function wr(e,t){switch(e){case 4:return function(e){const t=[];let r=0;if(e.length>=32&&(t.push({name:"public_key",offset:r,length:32,bytes:vr(k(e.slice(r,r+32))),decoded:{value:k(e.slice(r,r+32))}}),r+=32),e.length>=r+4){const a=e.slice(r,r+4),s=a[0]|a[1]<<8|a[2]<<16|a[3]<<24;t.push({name:"timestamp",offset:r,length:4,bytes:vr(k(a)),decoded:{value:s>>>0,iso:new Date(1e3*s).toISOString()}}),r+=4}if(e.length>=r+64&&(t.push({name:"signature",offset:r,length:64,bytes:vr(k(e.slice(r,r+64))),decoded:{value:k(e.slice(r,r+64))}}),r+=64),e.length>r){const a=e[r],s=[];if(1&a&&s.push("CHAT_NODE"),2&a&&s.push("REPEATER"),3&a&&s.push("ROOM_SERVER"),16&a&&s.push("HAS_LOCATION"),128&a&&s.push("HAS_NAME"),t.push({name:"flags",offset:r,length:1,bytes:vr(k(e.slice(r,r+1))),decoded:{value:a,binary:a.toString(2).padStart(8,"0"),flags:s}}),r+=1,16&a&&e.length>=r+8){const a=e.slice(r,r+8),s=new ArrayBuffer(8);new Uint8Array(s).set(a);const n=new DataView(s),o=n.getInt32(0,!0),i=n.getInt32(4,!0);t.push({name:"location",offset:r,length:8,bytes:vr(k(a)),decoded:{lat_raw:o,lon_raw:i,latitude:o/1e6,longitude:i/1e6}}),r+=8}if(128&a&&e.length>r){const a=e.slice(r);let s=a.indexOf(0);-1===s&&(s=a.length);const n=(new TextDecoder).decode(a.slice(0,s));t.push({name:"name",offset:r,length:s+(0===a[s]?1:0),bytes:vr(k(a.slice(0,s+1))),decoded:{value:n,encoding:"utf-8",null_terminated:0===a[s]}})}}return t}(t);case 3:return function(e){if(e.length<4)return[];const t=e.slice(0,4),r=t[0]|t[1]<<8|t[2]<<16|t[3]<<24;return[{name:"crc",offset:0,length:4,bytes:vr(k(t)),decoded:{value:r>>>0,hex:(r>>>0).toString(16).toUpperCase().padStart(8,"0"),note:"CRC of the acknowledged packet (little-endian)"}}]}(t);case 9:return function(e){const t=[];if(e.length<9)return t;const r=e.slice(0,4),a=r[0]|r[1]<<8|r[2]<<16|r[3]<<24;t.push({name:"trace_tag",offset:0,length:4,bytes:vr(k(r)),decoded:{value:a>>>0,hex:(a>>>0).toString(16).toUpperCase().padStart(8,"0")}});const s=e.slice(4,8),n=s[0]|s[1]<<8|s[2]<<16|s[3]<<24;if(t.push({name:"auth_code",offset:4,length:4,bytes:vr(k(s)),decoded:{value:n>>>0}}),t.push({name:"flags",offset:8,length:1,bytes:vr(k(e.slice(8,9))),decoded:{value:e[8],binary:e[8].toString(2).padStart(8,"0")}}),e.length>9){const r=e.slice(9),a=Array.from(r).map(e=>e.toString(16).toUpperCase().padStart(2,"0"));t.push({name:"target_path",offset:9,length:r.length,bytes:vr(k(r)),decoded:{hops:a,path_string:a.join("->")}})}return t}(t);case 8:return function(e){if(0===e.length)return[];const t=Array.from(e).map(e=>e.toString(16).toUpperCase().padStart(2,"0"));return[{name:"path_hops",offset:0,length:e.length,bytes:vr(k(e)),decoded:{hops:t,path_string:t.join("->")}}]}(t);case 5:return function(e){const t=[];if(e.length<1)return t;if(t.push({name:"channel_hash",offset:0,length:1,bytes:vr(k(e.slice(0,1))),decoded:{value:e[0].toString(16).toUpperCase().padStart(2,"0")}}),e.length>13){const r=12,a=e.length-1-r;t.push({name:"ciphertext",offset:1,length:a,bytes:vr(k(e.slice(1,1+a))),decoded:{length:a,note:"Encrypted message content"}}),t.push({name:"mac",offset:1+a,length:r,bytes:vr(k(e.slice(-r))),decoded:{note:"Message authentication code"}})}return t}(t);default:return function(e){return 0===e.length?[]:[{name:"raw_data",offset:0,length:e.length,bytes:vr(k(e)),decoded:{length:e.length}}]}(t)}}function _r(e){const t=e.type??e.payload_type??0,r=e.route??e.route_type??0,a=e.raw_packet||"";let s,n=null;if(a){const t=Q.fromHex(a);if(t.success&&t.packet){const e=t.packet;try{n=Z(e)}catch{n=null}const r=_(a);let o=0;const i={offset:0,length:1,bytes:vr(a.slice(0,2)),decoded:{route_type:e.routeType,route_name:e.routeTypeName,payload_type:e.payloadType,payload_name:e.payloadTypeName,version:e.payloadVersion}};o+=1,e.hasTransportCodes()&&(o+=4);const c={offset:o,length:1,bytes:vr(k(r.slice(o,o+1))),decoded:{value:e.pathLen}};o+=1;const l=o,d=r.slice(o,o+e.pathLen),u=Array.from(e.path).map(e=>e.toString(16).toUpperCase().padStart(2,"0")),p=9===e.payloadType,m={offset:l,length:e.pathLen,bytes:vr(k(d)),decoded:{hops:u,path_string:u.length>0?u.join("->"):"(direct)",...p&&{note:"For TRACE packets, path bytes are SNR×4 values, not node hashes",snr_values:Array.from(e.path).map(e=>{let t=e;return t>127&&(t-=256),t/4})}}};o+=e.pathLen,s={header:i,path_length:c,path:m,payload:{offset:o,length:e.payload.length,bytes:vr(e.payloadHex),sections:wr(e.payloadType,e.payload)}}}else s=kr(e)}else s=kr(e);return{timestamp:e.timestamp,packet_hash:e.packet_hash,type:t,type_name:$r(t),route:r,route_name:br(r),rssi:e.rssi,snr:e.snr,length:e.length??0,src_hash:e.src_hash,dst_hash:e.dst_hash,transmitted:e.transmitted,drop_reason:e.drop_reason,is_duplicate:e.is_duplicate,lbt_attempts:e.lbt_attempts,lbt_backoff_delays_ms:e.lbt_backoff_delays_ms,lbt_channel_busy:e.lbt_channel_busy,raw_packet:a,structure:s,decoded:n}}function kr(e){var t;const r=e.type??e.payload_type??0,a=e.route??e.route_type??0,s=e.original_path??e.forwarded_path??[];return{header:{offset:0,length:1,bytes:"??",decoded:{route_type:a,route_name:br(a),payload_type:r,payload_name:$r(r),version:0}},path_length:{offset:1,length:1,bytes:s.length.toString(16).toUpperCase().padStart(2,"0"),decoded:{value:s.length}},path:{offset:2,length:s.length,bytes:s.join(" "),decoded:{hops:s,path_string:s.length>0?s.join("->"):"(direct)"}},payload:{offset:2+s.length,length:(null==(t=e.payload)?void 0:t.length)??0,bytes:e.payload??"",sections:e.payload?wr(r,_(e.payload)):[]}}}function Cr(e,t){const r=function(e,t){var r;return{capture:{start:e.startTime.toISOString(),end:e.endTime.toISOString(),duration_sec:e.durationSec,packet_count:e.packetCount,node_name:(null==t?void 0:t.node_name)??"unknown",local_hash:(null==t?void 0:t.local_hash)??"unknown",pymc_console_version:w,pymc_repeater_version:(null==t?void 0:t.version)??"unknown",radio_config:(null==(r=null==t?void 0:t.config)?void 0:r.radio)?{frequency:t.config.radio.frequency,tx_power:t.config.radio.tx_power,bandwidth:t.config.radio.bandwidth,spreading_factor:t.config.radio.spreading_factor}:null},packets:e.packets.map(_r)}}(e,t),a=JSON.stringify(r,null,2),s=new Blob([a],{type:"application/json"}),n=URL.createObjectURL(s),o=document.createElement("a");o.href=n,o.download=e.filename,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}function Sr(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}class jr extends ve{constructor(){super(...arguments),t(this,"name","cap"),t(this,"description","Packet capture (start/end/list/export)")}matches(e){const t=e.toLowerCase().trim();return"cap"===t||"cap help"===t||t.startsWith("start cap")||t.startsWith("end cap")||t.startsWith("list cap")||t.startsWith("export cap")}async execute({output:e,rawInput:t}){const r=t.toLowerCase().trim();return"cap"===r||"cap help"===r?this.showHelp(e):r.startsWith("start cap")?this.startCapture(e,r):"end cap"===r?this.endCapture(e):"list cap"===r?this.listCaptures(e):r.startsWith("export cap")?this.exportCapture(e,r):void this.showHelp(e)}showHelp(e){const t=yr.getState(),r=t.isCapturing?`\n${ze('Recording in progress... use "end cap" to stop')}`:"",a=t.reports.length,s=a>0?` (${a} saved)`:"",n=[Pe("Packet Capture"),"",Oe("start cap","Start capture (default: 120s)"),Oe("end cap","Stop capture early"),Oe("list cap",`List saved captures${s}`),Oe("export cap","Download capture by ID"),"",Ue("Captures stored in session memory. JSON includes decoded payloads."),r].filter(Boolean);e.write(n.join("\n"))}startCapture(e,t){const r=t.slice(9).trim(),a=r?parseInt(r):120;if(isNaN(a)||a<1||a>3600)return void e.write("Error: Duration must be 1-3600 seconds","error");const s=yr.getState();if(s.isCapturing)return void e.write('Error: Capture already in progress. Use "end cap" first.',"error");const n=j.getState().packets;s.startCapture(n);let o=a;const i=e.write(ze(`Capturing... ${o}s remaining`),"system"),c=setInterval(()=>{o--;const t=yr.getState();if(o>=0&&t.isCapturing){const r=j.getState().packets.filter(e=>{if(!t.captureStartTime)return!1;const r=t.captureStartTime.getTime()/1e3;return e.timestamp>=r&&!t.captureStartPacketHashes.has(e.packet_hash)}).length,a=o>0?`${o}s remaining`:"finishing...";e.update(i,ze(`Capturing... ${a} (${r} captured)`),"system")}},1e3),l=setTimeout(()=>{clearInterval(c);const t=yr.getState();if(t.isCapturing){const r=j.getState().packets,a=t.stopCapture(r);a?e.write(`✓ Capture complete!\n Captured: ${a.packetCount} packets\n Duration: ${a.durationSec}s\n Size: ~${Sr(a.sizeBytes)}\n\nRun \`export cap ${a.id}\` to download.`,"value"):e.write("Capture completed with no packets.","warning")}},1e3*a);s._setTimer(l)}endCapture(e){const t=yr.getState();if(!t.isCapturing)return void e.write("No capture in progress.","warning");const r=j.getState().packets,a=t.stopCapture(r);a?e.write(`✓ Capture stopped!\n Captured: ${a.packetCount} packets\n Duration: ${a.durationSec}s\n Size: ~${Sr(a.sizeBytes)}\n\nRun \`export cap ${a.id}\` to download.`,"value"):e.write("Capture stopped with no packets.","warning")}listCaptures(e){const{reports:t}=yr.getState();if(0===t.length)return void e.write("No capture reports available.\nStart a capture with: start cap [seconds]","info");const r=t.map((e,t)=>` ${t+1}. ${e.packetCount} pkts • ${e.durationSec}s • ~${Sr(e.sizeBytes)} (id: ${e.id})`);e.write(`Capture Reports (${t.length}):\n${r.join("\n")}`,"info")}exportCapture(e,t){const r=t.slice(10).trim(),a=yr.getState(),s=j.getState().stats;if(!r){if(0===a.reports.length)e.write("No capture reports available.\nStart a capture with: start cap [seconds]","info");else{const t=a.reports.map((e,t)=>` ${t+1}. ${e.id}`);e.write(`Usage: export cap \n\nAvailable reports:\n${t.join("\n")}`,"info")}return}let n=a.getReport(r);if(!n){const e=parseInt(r)-1;n=a.reports[e]}n?(Cr(n,s),e.write(`✓ Downloading ${n.filename}...`,"value")):e.write(`Error: Report "${r}" not found.\nUse "list cap" to see available reports.`,"error")}}class Nr extends ve{constructor(){super(...arguments),t(this,"name","identities"),t(this,"description","List configured identities"),t(this,"aliases",["id","ids"])}async execute({output:e,rawInput:t}){var r;if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("identities"),` ${Be("List all configured repeater and room server identities.")}`,"",Oe("identities","list identities"),"",Pe("Aliases"),` ${Be("id, ids")}`].join("\n"));const a=e.write("processing...","system");try{const t=await N();if(!t.success||!t.data)return void e.update(a,t.error||"Failed to fetch identities","error");const s=t.data,n=(null==(r=s.configured)?void 0:r.length)?s.configured:s.registered||[];if(0===n.length)return void e.update(a,"No identities configured.","warning");const o=[Pe(`Identities (${n.length})`),"",...n.map((e,t)=>{var r;const a=e.name||"Unnamed",s=e.type||"unknown",n=(null==(r=e.hash)?void 0:r.slice(0,8))||"—";return` ${Be(`${t+1}.`)} ${Ie(a)} ${Fe(s)} ${Le(n)}`})];e.update(a,o.join("\n"))}catch(s){e.update(a,`Error: ${s instanceof Error?s.message:"Command failed"}`,"error")}}}class Tr extends ve{constructor(){super(...arguments),t(this,"name","keys"),t(this,"description","List transport keys")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("keys"),` ${Be("List configured transport encryption keys.")}`,"",Oe("keys","list transport keys")].join("\n"));const r=e.write("processing...","system");try{const t=await ee();if(!t.success||!t.data)return void e.update(r,t.error||"Failed to fetch transport keys","error");const a=t.data;if(0===a.length)return void e.update(r,"No transport keys configured.","warning");const s=[Pe(`Transport Keys (${a.length})`),"",...a.map(e=>{const t=e.parent_id?` ${Fe(`parent: ${e.parent_id}`)}`:"";return` ${Ie(e.name)} ${De("flood",Le(e.flood_policy))}${t}`})];e.update(r,s.join("\n"))}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}class Rr extends ve{constructor(){super(...arguments),t(this,"name","acl"),t(this,"description","Show ACL statistics")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("acl"),` ${Be("Display access control list statistics.")}`,"",Oe("acl","show ACL stats")].join("\n"));const r=e.write("processing...","system");try{const t=await re();if(!t.success||!t.data)return void e.update(r,t.error||"Failed to fetch ACL stats","error");const a=t.data,s=[Pe("ACL Stats"),"",` ${De("Identities",Le(String(a.total_identities)))}`,` ${De("Total clients",Le(String(a.total_clients)))}`,` ${De("Admin",Le(String(a.admin_clients)))}`,` ${De("Guest",Le(String(a.guest_clients)))}`];if(a.by_identity_type){const e=a.by_identity_type.repeater,t=a.by_identity_type.room_server;e&&s.push(` ${De("Repeater",`${Le(String(e.count))} ids ${Be(`${e.clients} clients`)}`)}`),t&&s.push(` ${De("Room Server",`${Le(String(t.count))} ids ${Be(`${t.clients} clients`)}`)}`)}e.update(r,s.join("\n"))}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}class Mr extends ve{constructor(){super(...arguments),t(this,"name","rooms"),t(this,"description","Show room server statistics")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("rooms"),` ${Be("Display room server statistics and sync status.")}`,"",Oe("rooms","list rooms")].join("\n"));const r=e.write("processing...","system");try{const t=await T();if(!t.success||!t.data)return void e.update(r,t.error||"Failed to fetch room stats","error");const a=t.data.rooms||[];if(0===a.length)return void e.update(r,"No room servers configured.","warning");const s=[Pe(`Rooms (${a.length})`),"",...a.map(e=>[` ${Ie(e.room_name)}`,` ${De("msgs",Le(String(e.total_messages)))} ${De("clients",`${Le(String(e.active_clients))}${Fe(`/${e.total_clients}`)}`)} ${De("sync",e.sync_running?Le("running"):Fe("idle"))}`]).flat()];e.update(r,s.join("\n"))}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}class Er extends ve{constructor(){super(...arguments),t(this,"name","restart"),t(this,"description","Restart pymc-repeater service"),t(this,"aliases",["reboot"])}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("restart"),` ${Be("Restart the pymc-repeater systemd service.")}`,"",Oe("restart","restart the service"),"",Pe("Aliases"),` ${Be("reboot")}`,"",Ue("Requires polkit permissions for the web user."),Ue("The page will need a manual refresh after restart.")].join("\n"));const r=e.write("Restarting service...","system");try{const t=await te(AbortSignal.timeout(8e3));if(t.success)return e.update(r,"Service restart initiated.","success"),void this.waitForService(e);const a=t.status;if(403===a||401===a)return void e.update(r,"Error: Permission denied.\n\nThe web user needs polkit permissions to restart the service.\nSee: /etc/polkit-1/localauthority/50-local.d/pymc-repeater.pkla","error");e.update(r,t.error||"Restart failed","error")}catch(a){const t=a instanceof Error?a.message:"";t.includes("ERR_NETWORK")||t.includes("ECONNRESET")||t.includes("Failed to fetch")||t.includes("abort")||t.includes("timeout")||a instanceof DOMException&&"TimeoutError"===a.name||a instanceof DOMException&&"AbortError"===a.name?(e.update(r,"Service is restarting (connection dropped).","success"),this.waitForService(e)):e.update(r,`Error: ${t||"Restart failed"}`,"error")}}waitForService(e){const t=e.write("Waiting for service...","system");let r=0,a=!1;setTimeout(()=>{const s=setInterval(async()=>{if(!a){r++,e.update(t,`Waiting for service... ${r}s`,"system");try{await fetch(`${R}/api/stats`,{signal:AbortSignal.timeout(3e3)}),a=!0,clearInterval(s),e.update(t,`Service connected. (${r+4}s)`,"success")}catch{}!a&&r>=30&&(a=!0,clearInterval(s),e.update(t,"Service did not respond within 34s. Check manually.","warning"))}},1e3)},4e3)}}const Ar="[",Ir=`${Ar}0m`,Fr=`${Ar}32m`,Lr=`${Ar}33m`,Br=`${Ar}31m`,Dr=`${Ar}36m`,Or=`${Ar}90m`,Pr=`${Ar}1m`;function Ur(e){return e>=1073741824?`${(e/1073741824).toFixed(1)}G`:e>=1048576?`${(e/1048576).toFixed(0)}M`:e>=1024?`${(e/1024).toFixed(0)}K`:`${e}B`}function zr(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),a=Math.floor(e%3600/60);return t>0?`${t}d ${r}h ${a}m`:r>0?`${r}h ${a}m`:`${a}m`}function Hr(e,t){const r=" ".repeat(2),a=t-2,s=[];let n="",o=0;for(const i of e){const e=Qe(i);0===o?(n=i,o=e):o+2+e<=a?(n+=" "+i,o+=2+e):(s.push(r+n),n=i,o=e)}return o>0&&s.push(r+n),s}function qr(e,t,r,a,s){if(!e||!t)return` ${Or}Waiting for data…${Ir}`;const n=function(e,t,r){var a,s;const n=e.node_name||"unknown",o=e.version?`v${e.version}`:"",i=(null==(a=t.system)?void 0:a.uptime)?zr(t.system.uptime):"?",c=zr(e.uptime_seconds||0),l=Math.max(3,r-4),d=(null==(s=t.cpu.load_avg)?void 0:s["1min"].toFixed(2))??"?",u=t.cpu.load_avg?`${d} ${t.cpu.load_avg["5min"].toFixed(2)} ${t.cpu.load_avg["15min"].toFixed(2)}`:"?",p=r>=60?u:d;return[` ${Dr}${Pr}${n}${Ir} ${Or}${o}${Ir}`,` ${Or}${"─".repeat(l)}${Ir}`,...Hr([De("Sys",Le(i)),De("Svc",Le(c)),De("Load",Le(p))],r)]}(e,t,a),o=function(e,t){const r=Math.max(6,Math.min(30,t-15)),a=t-(15+r)-2,s=[""],n=`${e.cpu.count} core${e.cpu.count>1?"s":""}`,o=`${Ur(e.memory.used)}/${Ur(e.memory.total)}`,i=`${Ur(e.disk.used)}/${Ur(e.disk.total)}`,c=(e,t,s)=>{const n=function(e,t){const r=Math.max(0,Math.min(100,e)),a=Math.round(r/100*t),s=t-a,n=r>=90?Br:r>=70?Lr:Fr;return`[${n}${"█".repeat(a)}${Ir}${Or}${"░".repeat(s)}${Ir}] ${n}${`${r.toFixed(1)}%`.padStart(6)}${Ir}`}(t,r),o=a>=s.length?` ${Fe(s)}`:"";return` ${Be(e.padEnd(4))}${n}${o}`};s.push(c("CPU",e.cpu.usage_percent,n)),s.push(c("Mem",e.memory.usage_percent,o)),s.push(c("Dsk",e.disk.usage_percent,i));const l=Object.entries(e.temperatures||{});if(l.length>0){const e=l.map(([e,t])=>{return`${Fe(e+":")} ${r=t,r>=80?`${Br}${Pr}${r.toFixed(1)}°C${Ir}`:r>=60?`${Lr}${r.toFixed(1)}°C${Ir}`:`${Fr}${r.toFixed(1)}°C${Ir}`}`;var r});s.push(...Hr(e,t))}return s}(t,a),i=function(e,t){var r,a;const s=e.neighbors||{},n=Object.keys(s).length,o=Object.values(s).filter(e=>e.zero_hop).length,i=(null==(a=null==(r=e.config)?void 0:r.repeater)?void 0:a.mode)||"?",c=null!=e.noise_floor_dbm?`${e.noise_floor_dbm}dBm`:"?",l=e.duty_cycle_percent??0,d=["",` ${Or}MESH${Ir}`];return d.push(...Hr([De("Mode",Le(i)),De("Nbrs",`${Le(String(o))}${Fe(`/${n}`)}`),De("Noise",Le(c)),De("Air",Le(`${l.toFixed(1)}%`))],t)),d.push(...Hr([De("RX",Le(String(e.rx_count??0))),De("TX",Le(String(e.tx_count??0))),De("FWD",Le(String(e.forwarded_count??0))),De("Drop",Le(String(e.dropped_count??0)))],t)),d.push(...Hr([De("RX/h",Le(String(Math.round(e.rx_per_hour??0)))),De("FWD/h",Le(String(Math.round(e.forwarded_per_hour??0))))],t)),d}(e,a),c=function(e,t){if(!e.network)return[];const r=["",` ${Or}NET${Ir}`];return r.push(...Hr([De("TX",Le(Ur(e.network.bytes_sent))),De("RX",Le(Ur(e.network.bytes_recv))),De("Pkt",`${Le(String(e.network.packets_sent))}${Fe("/")}${Le(String(e.network.packets_recv))}`)],t)),r}(t,a),l=["",` ${Or}${(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})} · Ctrl+C to exit${Ir}`],d=[...n,...o,...i,...c,...l],u=s?Ze(d,a):0,p=function(e,t,r){if(0===e.length)return[];const a=t>=50,s=t>=50?6:5,n=t>=50?6:5,o=a?7:0,i=Math.max(4,t-2-o-s-n-4),c=t>=50?8:5,l=null!=r?Math.max(0,Math.min(c,r-3)):c;if(l<=0)return[];const d=["",` ${Or}PROCS${Ir}`],u=(a?"PID".padEnd(o):"")+"CPU".padStart(s)+"MEM".padStart(n)+" NAME";d.push(` ${Fe(u)}`);for(const p of e.slice(0,l)){const e=a?Fe(String(p.pid).padEnd(o)):"",r=(t>=50?p.cpu_percent.toFixed(1):p.cpu_percent.toFixed(0)).padStart(s),c=(t>=50?p.memory_percent.toFixed(1):p.memory_percent.toFixed(0)).padStart(n),l=p.name.length>i?p.name.slice(0,i-1)+"…":p.name,u=p.cpu_percent>=50?Br:p.cpu_percent>=20?Lr:"",m=u?`${u}${r}${Ir}`:r;d.push(` ${e}${m}${Fe(c)} ${l}`)}return d}(r,a,s?Math.max(0,s-u):void 0),m=[...d.slice(0,-l.length),...p,...l];return s&&m.length>s&&(m.length=s),m.join("\n")}class Kr extends ve{constructor(){super(...arguments),t(this,"name","top"),t(this,"description","Live system overview (Ctrl+C to exit)"),t(this,"aliases",["htop"])}async execute({output:e,rawInput:t,cols:r,signal:a}){var s,n;if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("top"),` ${Be("Live-updating system overview combining hardware")}`,` ${Be("stats, mesh metrics, and running processes.")}`,` ${Be("Refreshes every 3s. Press Ctrl+C to exit.")}`,"",Oe("top","start live display"),"",Pe("Sections"),` ${Be("Header Node name, version, uptime, load average")}`,` ${Be("Gauges CPU, memory, disk usage with bar charts")}`,` ${Be("Mesh Mode, neighbors, packet counts, airtime")}`,` ${Be("Network TCP/IP bytes and packet counters")}`,` ${Be("Processes Top 8 processes by CPU usage")}`,"",Pe("Aliases"),` ${Be("htop")}`].join("\n"));let o=j.getState().hardwareStats,i=[],c=j.getState().stats;try{const[e,t]=await Promise.all([f(),M()]);e.success&&e.data&&(o=e.data),t.success&&t.data&&(i=t.data.processes.sort((e,t)=>t.cpu_percent-e.cpu_percent))}catch{}if(!a.aborted){null==(s=e.enterFullscreen)||s.call(e);try{const t=e.write(qr(c,o,i,e.cols??r,e.rows));await new Promise(s=>{if(a.aborted)return void s();const n=setInterval(()=>{if(a.aborted)return clearInterval(n),void s();(async()=>{c=j.getState().stats;try{const[e,t]=await Promise.all([f(),M()]);e.success&&e.data&&(o=e.data),t.success&&t.data&&(i=t.data.processes.sort((e,t)=>t.cpu_percent-e.cpu_percent))}catch{}a.aborted||e.update(t,qr(c,o,i,e.cols??r,e.rows))})()},3e3);a.addEventListener("abort",()=>{clearInterval(n),s()},{once:!0})})}finally{null==(n=e.exitFullscreen)||n.call(e)}}}}const Wr=["DONT PANIC","C0FFEE","FEED C0DE","LOL","I CANNOT DO THAT"];function Gr(){return Wr[Math.floor(Math.random()*Wr.length)]}const Xr=new EventTarget,Vr="shell-phrase";function Yr(e){Xr.dispatchEvent(new CustomEvent(Vr,{detail:e??Gr()}))}class Jr extends ve{constructor(){super(...arguments),t(this,"name","fortune"),t(this,"description","Display a fortune on the header"),t(this,"aliases",["lol"])}execute({output:e}){const t=Gr();Yr(t),e.write(Be(` ${t}`))}}const Qr=new EventTarget,Zr="party-time";class ea extends ve{constructor(){super(...arguments),t(this,"name","partytime"),t(this,"description","Party on, Garth!"),t(this,"aliases",["party","excellent","waynesworld"])}execute({output:e}){Qr.dispatchEvent(new Event(Zr)),Yr("PARTY 0N GARTH"),e.write(Be(" SCHWING!"))}}class ta extends ve{constructor(){super(...arguments),t(this,"name","ver"),t(this,"description","Show version info"),t(this,"aliases",["version"])}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("ver"),` ${Be("Display pyMC_Repeater, core, and console version.")}`,` ${Be('Equivalent to firmware serial CLI "ver" command.')}`,"",Oe("ver","show version"),"",Pe("Aliases"),` ${Be("version")}`].join("\n"));const r=e.write("processing...","system");try{const t=await g(),a="0.9.262";e.update(r,[` ${De("pyMC_Repeater",Le(`v${t.version||"?"}`))}`,` ${De("pyMC_Core",Le(t.core_version||"?"))}`,` ${De("pyMC_Console",Le(`v${a}`))}`].join("\n"),"value")}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}class ra extends ve{constructor(){super(...arguments),t(this,"name","clock"),t(this,"description","Show system UTC time")}execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("clock"),` ${Be("Display the current system UTC time.")}`,` ${Be('Equivalent to firmware serial CLI "clock" command.')}`,` ${Be("Use to verify NTP sync and correlate packet timestamps.")}`,"",Oe("clock","show UTC time")].join("\n"));const r=new Date;e.write([` ${De("UTC",Le(r.toUTCString()))}`,` ${De("ISO",Le(r.toISOString()))}`,` ${De("Unix",Le(String(Math.floor(r.getTime()/1e3))))}`].join("\n"),"value")}}class aa extends ve{constructor(){super(...arguments),t(this,"name","stats-packets"),t(this,"description","Packet counters")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("stats-packets"),` ${Be("Display packet counters: sent, received, forwarded, dropped.")}`,` ${Be('Equivalent to firmware serial CLI "stats-packets" command.')}`,"",Oe("stats-packets","show packet counters")].join("\n"));const r=e.write("processing...","system");try{const t=await g(),a=t.rx_count??0,s=t.tx_count??0,n=t.forwarded_count??0,o=t.dropped_count??0,i=t.rx_per_hour??0,c=t.forwarded_per_hour??0,l=t.duplicate_cache_size??0;e.update(r,[` ${Ie("Packet Counters")}`,"",` ${De("RX",Le(String(a)))} ${Be(`${i.toFixed(1)}/hr`)}`,` ${De("TX",Le(String(s)))}`,` ${De("Forwarded",Le(String(n)))} ${Be(`${c.toFixed(1)}/hr`)}`,` ${De("Dropped",Le(String(o)))}`,"",` ${De("Dup cache",Le(String(l)))}`].join("\n"),"value")}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}function sa(e){return e>=6e4?`${(e/6e4).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(0)}ms`}class na extends ve{constructor(){super(...arguments),t(this,"name","stats-radio"),t(this,"description","Radio health stats")}async execute({output:e,rawInput:t}){var r;if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("stats-radio"),` ${Be("Display radio health: airtime, noise floor, duty cycle.")}`,` ${Be('Equivalent to firmware serial CLI "stats-radio" command.')}`,"",Oe("stats-radio","show radio stats")].join("\n"));const a=e.write("processing...","system");try{const t=await g(),s=null==(r=t.config)?void 0:r.radio,n=t.noise_floor_dbm,o=t.airtime_used_ms??0,i=t.airtime_remaining_ms??0,c=t.duty_cycle_percent??0,l=t.utilization_percent??0,d=t.total_airtime_ms??0,u=[` ${Ie("Radio Stats")}`,""];if(s){const e=s.frequency?`${(s.frequency/1e6).toFixed(3)} MHz`:"?",t=s.bandwidth?s.bandwidth/1e3+" kHz":"?";u.push(` ${De("Radio",Le(`${e} SF${s.spreading_factor??"?"} BW ${t} CR 4/${s.coding_rate??"?"} ${s.tx_power??"?"} dBm`))}`),u.push("")}u.push(` ${De("Noise floor",null!=n?Le(`${n} dBm`):Be("N/A"))}`),u.push(` ${De("Airtime used",Le(sa(o)))} ${Be(`remaining: ${sa(i)}`)}`),u.push(` ${De("Total airtime",Le(sa(d)))}`),u.push(` ${De("Duty cycle",Le(`${c.toFixed(1)}%`))}`),u.push(` ${De("Utilization",Le(`${l.toFixed(1)}%`))}`),e.update(a,u.join("\n"),"value")}catch(s){e.update(a,`Error: ${s instanceof Error?s.message:"Command failed"}`,"error")}}}function oa(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GB`:e>=1048576?`${(e/1048576).toFixed(0)} MB`:`${(e/1024).toFixed(0)} KB`}class ia extends ve{constructor(){super(...arguments),t(this,"name","stats-core"),t(this,"description","Engine vitals")}async execute({output:e,rawInput:t}){if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([Pe("stats-core"),` ${Be("Display engine vitals: uptime, memory, CPU, queue depth.")}`,` ${Be('Equivalent to firmware serial CLI "stats-core" command.')}`,` ${Be("On firmware this shows free heap — here we show Linux process health.")}`,"",Oe("stats-core","show core stats")].join("\n"));const r=e.write("processing...","system");try{const[t,a]=await Promise.all([g(),f()]),s=[` ${Ie("Core Stats")}`,"",` ${De("Uptime",Le($t(t.uptime_seconds??0)))}`,` ${De("Dup cache",Le(`${t.duplicate_cache_size??0} entries`))} ${Be(`TTL ${t.cache_ttl??"?"}s`)}`];if(a.success&&a.data){const e=a.data;s.push(""),s.push(` ${De("CPU",Le(`${e.cpu.usage_percent.toFixed(1)}%`))} ${Be(`${e.cpu.count} core${e.cpu.count>1?"s":""}`)}`),e.cpu.load_avg&&s.push(` ${De("Load",Le(`${e.cpu.load_avg["1min"].toFixed(2)} / ${e.cpu.load_avg["5min"].toFixed(2)} / ${e.cpu.load_avg["15min"].toFixed(2)}`))}`),s.push(` ${De("Memory",Le(`${oa(e.memory.used)} / ${oa(e.memory.total)}`))} ${Be(`${e.memory.usage_percent.toFixed(0)}%`)}`);const t=Object.entries(e.temperatures||{});t.length>0&&s.push(` ${De("Temp",Le(`${t[0][1].toFixed(1)}°C`))}`)}e.update(r,s.join("\n"),"value")}catch(a){e.update(r,`Error: ${a instanceof Error?a.message:"Command failed"}`,"error")}}}const ca=["@@@@@@@ @@@ @@@ @@@@@@@@@@ @@@@@@@ ","@@@@@@@@ @@@ @@@ @@@@@@@@@@@ @@@@@@@@ ","@@! @@@ @@! !@@ @@! @@! @@! !@@ ","!@! @!@ !@! @!! !@! !@! !@! !@! ","@!@@!@! !@!@! @!! !!@ @!@ !@! ","!!@!!! @!!! !@! ! !@! !!! ","!!: !!: !!: !!: :!! ",":!: :!: :!: :!: :!: "," :: :: ::: :: ::: ::: "," : : : : :: :: : "],la=ce-1;class da extends ve{constructor(){super(...arguments),t(this,"name","hello"),t(this,"description","Play the PYMC burst intro"),t(this,"aliases",["hi","intro"])}async execute({output:e,signal:t}){if(t.aborted)return;let r=0;const a=e.write(ne(ca,0).join("\n"));try{await new Promise(s=>{const n=setInterval(()=>{if(t.aborted||r>=la)return clearInterval(n),t.aborted||e.update(a,ne(ca,la).join("\n")),void s();r++,e.update(a,ne(ca,r).join("\n"))},oe);t.addEventListener("abort",()=>{clearInterval(n),s()},{once:!0})})}finally{ie()}}}const ua=J(e=>({entries:[],commandHistory:[],isInitialized:!1,addEntry:t=>{const r="undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),a={...t,id:r,timestamp:Date.now()};return e(e=>({entries:[...e.entries,a]})),r},updateEntry:(t,r)=>{e(e=>({entries:e.entries.map(e=>e.id===t?{...e,...r}:e)}))},addCommand:t=>{e(e=>({commandHistory:[...e.commandHistory,t]}))},clearEntries:()=>{e({entries:[],commandHistory:[]})},setInitialized:t=>{e({isInitialized:t})}}));function pa({isOpen:e,onClose:t}){const a=xr(),s=j(e=>e.stats);return r.jsxs(E,{open:e,onClose:t,size:"sm",children:[r.jsx(A,{icon:r.jsx(V,{size:20}),title:"Download Captures",onClose:t}),r.jsx(I,{className:"flex flex-col gap-2",children:0===a.length?r.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-fg-muted",children:[r.jsx(ye,{className:"w-8 h-8 opacity-40"}),r.jsx("p",{className:"text-sm",children:"No captures available."})]}):a.map(e=>r.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 radius-inset bg-elevated/50 border border-edge-subtle",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"type-label text-fg-primary truncate",children:e.filename}),r.jsxs("p",{className:"text-xs text-fg-muted mt-0.5",children:[e.packetCount," packets · ",e.durationSec,"s · ~",Sr(e.sizeBytes)]})]}),r.jsx(F,{plain:!0,color:"primary",onClick:()=>(e=>{const t=a.find(t=>t.id===e);t&&Cr(t,s)})(e.id),title:"Download",className:"flex-shrink-0",children:r.jsx(V,{"data-slot":"icon"})})]},e.id))})]})}function ma(){const e=xr(),[t,s]=a.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsx(ae,{icon:r.jsx(fe,{size:20}),onClick:()=>s(!0),title:e.length>0?`Download captures (${e.length})`:"Captures",variant:"red",iconActiveColor:m.red}),r.jsx(pa,{isOpen:t,onClose:()=>s(!1)})]})}const ha=[{name:"acl",description:"Access control list statistics — identity and client counts.",body:["```","> acl","ACL Stats",""," Identities 2"," Total clients 5"," Admin 2"," Guest 3"," Repeater 1 ids 3 clients"," Room Server 1 ids 2 clients","```"],searchText:"acl access control list statistics identity client"},{name:"advert",description:"Broadcast a repeater advertisement to the mesh.",body:["```","> advert","✓ Advert sent","```"],searchText:"advert advertisement broadcast mesh"},{name:"board",description:"Hardware and platform info — CPU, memory, disk, temperatures, network I/O.",body:["```","> board"," Node Local-Node"," Runtime pyMC_Repeater v1.0.0"," Core v1.12.0",""," CPU 12.3% 4 cores"," Load 0.42 / 0.38 / 0.35"," Temp 48.2°C",""," Memory 412 MB / 664 MB 62%"," Disk 5.2 GB / 28.7 GB 18%",""," System uptime 14d 3h 22m"," Service uptime 2d 14h 32m"," Net TX/RX 128 MB / 342 MB","```"],searchText:"board hardware platform cpu memory disk temperature network"},{name:"cap",description:"Packet capture — start, stop, list, and export captures.",body:["**Sub-commands:** `start cap [sec]` · `end cap` · `list cap` · `export cap [id]`","","**`start cap [seconds]`** — Begin capture (default 120s, max 3600):","```","> start cap","Capturing... 118s remaining (4 captured)","","✓ Capture complete!"," Captured: 23 packets"," Duration: 120s"," Size: ~14.2 KB","```","","**`end cap`** — Stop capture early:","```","> end cap","✓ Capture stopped!"," Captured: 12 packets","```","","**`list cap`** — List saved captures:","```","> list cap","Capture Reports (2):"," 1. 23 pkts • 120s • ~14.2 KB (id: abc123)"," 2. 12 pkts • 34s • ~7.1 KB (id: def456)","```","","**`export cap [id]`** — Download by ID or index:","```","> export cap 1","✓ Downloading capture-abc123.json...","```"],searchText:"cap capture packet start end list export download diagnostic"},{name:"clear",description:"Clear the terminal screen.",body:["**Alias:** `cls`","```","> clear","```"],searchText:"clear cls screen"},{name:"clock",description:"Current system UTC time. Useful for NTP sync and packet timestamp correlation.",body:["```","> clock"," UTC Wed, 12 Feb 2026 00:01:34 GMT"," ISO 2026-02-12T00:01:34.000Z"," Unix 1770768094","```"],searchText:"clock time utc ntp unix iso timestamp"},{name:"convert",description:"Convert between hex and base64 encodings.",body:["**Usage:** `convert hex ` · `convert base64 `","```","> convert hex 48656C6C6F"," hex 48656C6C6F"," base64 SGVsbG8=","","> convert base64 SGVsbG8="," base64 SGVsbG8="," hex 48656C6C6F","```"],searchText:"convert hex base64 encoding decode"},{name:"get",description:"Read a configuration parameter.",body:[],interactive:"get",searchText:"get read config parameter name role lat lon radio freq tx bw sf cr txdelay mode duty flood advert"},{name:"help",description:"Show all commands, or detailed help for a specific command.",body:["**Alias:** `?` · `h`","```","> help Full command listing","> help ping Detailed help for ping","> ping help Same thing","```"],searchText:"help commands reference guide"},{name:"identities",description:"List all configured repeater and room server identities.",body:["**Alias:** `id` · `ids`","```","> identities","Identities (2)",""," 1. Local-Node repeater 0A1B2C3D"," 2. local-room room_server 0E5F6A7B","```"],searchText:"identities id ids repeater room server identity"},{name:"keys",description:"List configured transport encryption keys.",body:["```","> keys","Transport Keys (1)",""," main-transport flood: allow","```"],searchText:"keys transport encryption"},{name:"neighbors",description:"Direct RF neighbors with signal quality, RSSI, SNR, distance, and last-heard.",body:["**Alias:** `nb`","","**Sort qualifiers:** `sig` · `name` · `rssi` · `snr` · `dist` · `heard`","```","> neighbors","Direct Neighbors (4)","","+-------+-----------+-----------+--------+-------+--------+","| ▁▃▅▇█ | Node-1 | -87 dBm | 8.5 dB | 2.1km | 3m ago |","| ▁▃▅▇. | Relay-2 | -94 dBm | 5.2 dB | 4.8km | 1m ago |","| ▁▃▅.. | Node-3 | -108 dBm | 1.0 dB | 8.3km | 5m ago |","| ▁▃... | Node-4 | -118 dBm | -3 dB | 14km | 12m ago|","+-------+-----------+-----------+--------+-------+--------+","| SIG | NAME | RSSI | SNR | DIST | HEARD |","+-------+-----------+-----------+--------+-------+--------+","SF11/250kHz ant 3.5dBi nf -112dBm","```","","- **sig** — signal grade (weakest first)","- **name** — alphabetical","- **rssi** — RSSI (weakest first)","- **snr** — SNR (lowest first)","- **dist** — distance (closest first)","- **heard** — last seen (oldest first)"],searchText:"neighbors nb signal rssi snr distance sort direct rf"},{name:"packets",description:"Packet counters — received, transmitted, forwarded, dropped.",body:["```","> packets","Packet Stats 1321 total",""," Received 1284"," Transmitted 37"," Forwarded 891"," Dropped 14","```"],searchText:"packets received transmitted forwarded dropped counter"},{name:"ping",description:"Ping a neighbor by name or hex prefix. Shows RTT, signal quality, and path.",body:["**Usage:** `ping [timeout]`","```","> ping Node-1","▁▃▅▇█ Reply from Node-1",""," RTT 342ms"," RSSI -87 dBm"," SNR 8.5 dB"," Path direct"," Quality Excellent","```","","Custom timeout (default 30s):","```","> ping Node-4 60","```"],searchText:"ping rtt round trip time signal quality path neighbor"},{name:"restart",description:"Restart the pymc-repeater systemd service.",body:["**Alias:** `reboot`","```","> restart","Service is restarting (connection dropped).","Waiting for service... 8s","Service connected. (12s)","```","","The terminal polls automatically until the service comes back up."],searchText:"restart reboot service systemd"},{name:"rooms",description:"Room server statistics — message counts, active clients, sync status.",body:["```","> rooms","Rooms (1)",""," Local Room"," msgs 142 clients 3/5 sync running","```"],searchText:"rooms room server messages clients sync"},{name:"set",description:"Write a configuration parameter.",body:[],interactive:"set",searchText:"set write config parameter name lat lon freq tx bw sf cr txdelay mode duty log flood advert"},{name:"stats-core",description:"Engine vitals — uptime, duplicate cache, CPU, memory, temperature.",body:["```","> stats-core"," Core Stats",""," Uptime 2d 14h 32m"," Dup cache 128 entries TTL 900s",""," CPU 12.3% 4 cores"," Load 0.42 / 0.38 / 0.35"," Memory 412 MB / 664 MB 62%"," Temp 48.2°C","```"],searchText:"stats core engine vitals uptime cache cpu memory temperature"},{name:"stats-packets",description:"Firmware-compatible packet counters with rates and duplicate cache depth.",body:["```","> stats-packets"," Packet Counters",""," RX 1284 22.4/hr"," TX 37"," Forwarded 891 15.2/hr"," Dropped 14",""," Dup cache 128","```"],searchText:"stats packets firmware counter rate duplicate cache"},{name:"stats-radio",description:"Radio health — noise floor, airtime, duty cycle, and radio configuration.",body:["```","> stats-radio"," Radio Stats",""," Radio 906.875 MHz SF11 BW 250 kHz CR 4/5 22 dBm",""," Noise floor -112 dBm"," Airtime used 4.2s remaining: 55.8m"," Total airtime 1.2m"," Duty cycle 1.2%"," Utilization 0.8%","```"],searchText:"stats radio noise floor airtime duty cycle utilization"},{name:"status",description:"Quick summary of mode, neighbors, and uptime.",body:["**Alias:** `st`","```","> status","Local-Node repeater",""," Mode forward"," Neighbors 4 direct 12 total"," RX / TX 1284 / 37"," Uptime 2d 14h 32m","```"],searchText:"status st summary mode neighbors uptime"},{name:"top",description:"Live-updating system overview — CPU/memory gauges, mesh counters, processes.",body:["**Alias:** `htop`","","Refreshes every 3s. Press **Ctrl+C** to exit.","```","> top","Local-Node v1.0.0","──────────────────────────────────"," Sys 14d 3h 22m Svc 2d 14h 32m Load 0.42 0.38 0.35",""," CPU [████░░░░░░░░░░░░] 12.3% 4 cores"," Mem [██████████░░░░░░] 62.1% 412M/664M"," Dsk [███░░░░░░░░░░░░░] 18.4% 5.2G/28.7G"," cpu_thermal: 48.2°C",""," MESH"," Mode forward Nbrs 4/12 Noise -112dBm Air 1.2%"," RX 1284 TX 37 FWD 891 Drop 14"," RX/h 22 FWD/h 15",""," PROCS"," CPU MEM NAME"," 8.2 3.1 python3"," 2.1 1.4 cherrypy",""," 14:32:08 · Ctrl+C to exit","```","","Uses alternate screen buffer — scrollback is preserved."],searchText:"top htop live system overview cpu memory gauges mesh processes"},{name:"uptime",description:"How long the repeater service has been running.",body:["```","> uptime","Uptime 2d 14h 32m","```"],searchText:"uptime service running duration"},{name:"ver",description:"Version info for all three components.",body:["**Alias:** `version`","```","> ver"," pyMC_Repeater v1.0.0"," pyMC_Core v1.12.0"," pyMC_Console v1.0.0","```"],searchText:"ver version pymc repeater core console"}],ga=[{param:"name",category:"Identity",example:["> get name","name Local-Node"]},{param:"role",category:"Identity",example:["> get role","role repeater"]},{param:"lat",category:"Identity",example:["> get lat","lat 34.0522"],range:"-90 to 90"},{param:"lon",category:"Identity",example:["> get lon","lon -118.2437"],range:"-180 to 180"},{param:"public.key",category:"Identity",example:["> get public.key","public.key 0A1B2C3D4E5F..."]},{param:"radio",category:"Radio",example:["> get radio"," freq 906.875 MHz"," bw 250 kHz"," sf 11"," cr 4/5"," tx 22 dBm"]},{param:"freq",category:"Radio",example:["> get freq","freq 906.875 MHz"],range:"100–1000 MHz"},{param:"tx",category:"Radio",example:["> get tx","tx 22 dBm"],range:"2–22 dBm"},{param:"bw",category:"Radio",example:["> get bw","bw 250 kHz"],range:"7.8–500 kHz"},{param:"sf",category:"Radio",example:["> get sf","sf 11"],range:"5–12"},{param:"cr",category:"Radio",example:["> get cr","cr 4/5"],range:"5–8"},{param:"af",category:"Timing",example:["> get af","⚠ airtime_factor not yet exposed by pyMC_Repeater API."," Firmware range: 0-9. Tracked in CLI-Alignment.md."],range:"0–9 (pending)"},{param:"txdelay",category:"Timing",example:["> get txdelay","txdelay 1.0"],range:"0.0–5.0"},{param:"direct.txdelay",category:"Timing",example:["> get direct.txdelay","direct.txdelay 0.5"],range:"0.0–5.0"},{param:"rxdelay",category:"Timing",example:["> get rxdelay","rxdelay 0.0"],range:"≥ 0"},{param:"mode",category:"Repeater",example:["> get mode","mode forward"],range:"forward / monitor"},{param:"duty",category:"Repeater",example:["> get duty","duty on"],range:"on / off"},{param:"flood.max",category:"Repeater",example:["> get flood.max","flood.max 3"],range:"0–64"},{param:"advert.interval",category:"Repeater",example:["> get advert.interval","advert.interval 120m"],range:"0 (off) or 1–10080 min"},{param:"multi.acks",category:"Advanced",example:["> get multi.acks","multi.acks 0"],range:"0–255"},{param:"int.thresh",category:"Advanced",example:["> get int.thresh","int.thresh -120 dBm"],range:"-200 to 0 dBm"},{param:"agc.reset.interval",category:"Advanced",example:["> get agc.reset.interval","agc.reset.interval 0"],range:"≥ 0 (×4)"}],fa=[{param:"name",category:"Identity",example:["> set name Local-Node","OK - node_name set to Local-Node"],range:"text (no [ ] \\ / : , ? *)"},{param:"lat",category:"Identity",example:["> set lat 34.0522","OK - latitude set to 34.0522"],range:"-90 to 90"},{param:"lon",category:"Identity",example:["> set lon -118.2437","OK - longitude set to -118.2437"],range:"-180 to 180"},{param:"freq",category:"Radio",example:["> set freq 906.875","OK - frequency set to 906875000"],range:"100–1000 MHz"},{param:"tx",category:"Radio",example:["> set tx 22","OK - tx_power set to 22"],range:"2–22 dBm"},{param:"bw",category:"Radio",example:["> set bw 250","OK - bandwidth set to 250000"],range:"7.8, 10.4, 15.6, 20.8, 31.25, 41.7, 62.5, 125, 250, 500 kHz"},{param:"sf",category:"Radio",example:["> set sf 11","OK - spreading_factor set to 11"],range:"5–12"},{param:"cr",category:"Radio",example:["> set cr 5","OK - coding_rate set to 5"],range:"5–8"},{param:"af",category:"Timing",example:["> set af 2","⚠ airtime_factor not yet exposed by pyMC_Repeater API."," Firmware range: 0-9. Needs backend support."],range:"0–9 (pending)"},{param:"txdelay",category:"Timing",example:["> set txdelay 1.0","OK - tx_delay_factor set to 1"],range:"0.0–5.0"},{param:"direct.txdelay",category:"Timing",example:["> set direct.txdelay 0.5","OK - direct_tx_delay_factor set to 0.5"],range:"0.0–5.0"},{param:"rxdelay",category:"Timing",example:["> set rxdelay 0","OK - rx_delay_base set to 0"],range:"≥ 0"},{param:"mode",category:"Repeater",example:["> set mode forward","OK - Mode set to forward"],range:"forward / monitor"},{param:"flood.max",category:"Repeater",example:["> set flood.max 3","OK - max_flood_hops set to 3"],range:"0–64"},{param:"advert.interval",category:"Repeater",example:["> set advert.interval 120","OK - Local advert interval set to 120m"],range:"0 (off) or 1–10080 min"},{param:"duty",category:"Repeater",example:["> set duty on","OK - Duty cycle enabled"],range:"on / off"},{param:"log",category:"Repeater",example:["> set log info","OK - Log level set to INFO"],range:"debug, info, warning, error"},{param:"multi.acks",category:"Advanced",example:["> set multi.acks 0","OK - multi_acks set to 0"],range:"0–255"},{param:"int.thresh",category:"Advanced",example:["> set int.thresh -120","OK - interference_threshold set to -120"],range:"-200 to 0 dBm"},{param:"agc.reset.interval",category:"Advanced",example:["> set agc.reset.interval 8","OK - AGC reset interval set to 8"],range:"≥ 0 (rounded to ×4)"},{param:"prv.key",category:"Advanced",example:["> set prv.key <128-hex>","To set this key, run on the Pi:",""," sudo ./convert_firmware_key.sh ","","Then restart: sudo systemctl restart pymc-repeater"],range:"128-char hex (SSH only)"}];function ya({mode:e}){const t="get"===e?ga:fa,[s,o]=a.useState(0),i=t[s],c=a.useMemo(()=>{const e=new Map;for(const r of t){const t=e.get(r.category)||[];t.push(r),e.set(r.category,t)}return Array.from(e.entries())},[t]);return r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx("div",{className:"flex flex-col gap-1.5",children:c.map(([e,a])=>r.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[r.jsx("span",{className:"text-xs text-fg-muted w-16 shrink-0 text-right pr-1",children:e}),a.map(e=>{const a=t.indexOf(e),i=a===s;return r.jsx("button",{onClick:()=>o(a),className:n("px-1.5 py-0.5 type-data-xs radius-badge transition-colors cursor-pointer",i?"bg-sys-blue text-fg-invert font-semibold":"bg-elevated text-fg-secondary hover:bg-elevated/80 hover:text-sys-blue"),children:e.param},e.param)})]},e))}),r.jsx("pre",{className:"px-3 py-2.5 radius-inner bg-body text-fg-secondary type-code overflow-x-auto border border-edge-subtle",children:i.example.map((e,t)=>r.jsx("div",{children:e||" "},t))}),i.range&&r.jsxs("p",{className:"text-xs text-fg-muted",children:[r.jsx("span",{className:"text-fg-secondary font-medium",children:i.param})," — ",i.range]})]})}function xa(e,t){const a=e.split(/(\*\*[^*]+\*\*)/g);return r.jsx("span",{children:a.map((e,t)=>e.startsWith("**")&&e.endsWith("**")?r.jsx("strong",{className:"text-fg-primary font-semibold",children:e.slice(2,-2)},t):e.split(/(`[^`]+`)/g).map((e,a)=>e.startsWith("`")&&e.endsWith("`")?r.jsx("code",{className:"px-1 py-0.5 radius-badge bg-elevated text-sys-blue type-data-xs",children:e.slice(1,-1)},`${t}-${a}`):r.jsx("span",{children:e},`${t}-${a}`)))},t)}function va({lines:e}){const t=[];let a=0;for(;ar.jsx("div",{children:e||" "},t))},t.length));continue}s.trim()?s.startsWith("- ")?(t.push(r.jsxs("div",{className:"flex gap-2 text-sm text-fg-secondary pl-2 py-0.5",children:[r.jsx("span",{className:"text-fg-muted shrink-0",children:"•"}),r.jsx("span",{children:xa(s.slice(2),0)})]},t.length)),a++):(t.push(r.jsx("p",{className:"text-sm text-fg-secondary py-0.5",children:xa(s,0)},t.length)),a++):(t.push(r.jsx("div",{className:"h-1.5"},t.length)),a++)}return r.jsx(r.Fragment,{children:t})}function $a({isOpen:e,onClose:t,onUseCommand:c}){const[l,d]=a.useState(""),u=a.useMemo(()=>{if(!l.trim())return ha;const e=l.toLowerCase();return ha.filter(t=>t.name.includes(e)||t.searchText.includes(e)||t.description.toLowerCase().includes(e))},[l]),p=l.trim().length>0;return r.jsxs(E,{open:e,onClose:t,size:"3xl",motionPlus:!0,className:"sm:min-w-[540px] md:min-w-[680px]",children:[r.jsx(A,{icon:r.jsx(ge,{size:20}),title:"Terminal Command Guide",onClose:t}),r.jsxs(I,{className:"flex flex-col gap-0 !px-0 !py-0",children:[r.jsx("div",{className:"sticky top-0 z-10 px-5 py-3 border-b border-edge-subtle bg-surface/95 backdrop-blur-sm",children:r.jsxs("div",{className:"relative",children:[r.jsx(me,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-fg-muted"}),r.jsx("input",{type:"text",value:l,onChange:e=>d(e.target.value),placeholder:"Search commands...",className:"w-full pl-8 pr-3 py-1.5 text-sm bg-elevated border border-edge-subtle radius-inner text-fg-primary placeholder:text-fg-muted focus:outline-none focus:ring-1 focus:ring-sys-blue/50",autoFocus:!0})]})}),r.jsxs("div",{className:"overflow-y-auto px-5 py-3 h-[420px] sm:h-[520px] md:h-[600px]",children:[r.jsx(L,{mode:"popLayout",children:0===u.length?r.jsxs(B.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:O.normal,ease:D.easeOut},className:"flex flex-col items-center gap-2 py-10 text-fg-muted",children:[r.jsx(me,{className:"w-6 h-6 opacity-40"}),r.jsxs("p",{className:"text-sm",children:['No commands match "',l,'"']})]},"empty"):r.jsx(B.div,{initial:!1,className:"flex flex-col gap-1",children:r.jsx(L,{initial:!1,children:u.map(e=>r.jsx(B.div,{layout:"position",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:P.fade,className:"min-w-0",children:r.jsx(s,{children:({open:t})=>r.jsxs("div",{className:n("radius-inner border transition-colors",t?"border-edge-subtle bg-elevated/50":"border-transparent hover:bg-elevated/30"),children:[r.jsxs("div",{className:"flex items-center w-full min-w-0",children:[r.jsxs(o,{className:"flex items-center gap-3 flex-1 min-w-0 px-3 py-2 text-left cursor-pointer",children:[r.jsx(he,{size:14,className:n("shrink-0 text-fg-muted transition-transform duration-150",t&&"rotate-90")}),r.jsx("code",{className:"text-sm font-semibold text-sys-blue font-mono shrink-0",children:e.name}),r.jsx("span",{className:"text-xs text-fg-muted truncate min-w-0",children:e.description})]}),c&&r.jsx("button",{onClick:t=>{t.stopPropagation(),c(e.name)},className:"shrink-0 mr-2 px-2 py-0.5 text-xs font-semibold uppercase tracking-wider radius-badge bg-elevated text-fg-muted hover:text-sys-blue hover:bg-elevated/80 transition-colors cursor-pointer",title:`Use "${e.name}" in terminal`,children:"use"})]}),r.jsx(i,{className:"px-3 pb-3 pt-0 pl-9",children:e.interactive?r.jsx(ya,{mode:e.interactive}):r.jsx(va,{lines:e.body})})]})})},e.name))})},"list")}),r.jsx(L,{children:!p&&r.jsxs(B.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{duration:O.normal,ease:D.easeOut},className:"mt-4 px-3 py-3 radius-inner border border-edge-subtle bg-elevated/30",children:[r.jsx("p",{className:"text-xs font-semibold text-fg-muted mb-2",children:"Tips"}),r.jsxs("div",{className:"flex flex-col gap-1 text-xs text-fg-muted",children:[r.jsxs("p",{children:["Type ",r.jsx("code",{className:"px-1 py-0.5 radius-badge bg-elevated text-sys-blue font-mono",children:" help"})," in the terminal for detailed usage."]}),r.jsxs("p",{children:["Most commands have shorter aliases (e.g. ",r.jsx("code",{className:"px-1 py-0.5 radius-badge bg-elevated text-sys-blue font-mono",children:"st"}),", ",r.jsx("code",{className:"px-1 py-0.5 radius-badge bg-elevated text-sys-blue font-mono",children:"nb"}),", ",r.jsx("code",{className:"px-1 py-0.5 radius-badge bg-elevated text-sys-blue font-mono",children:"id"}),")."]}),r.jsxs("p",{children:["Signal bars ",r.jsx("span",{className:"font-mono",children:"▁▃▅▇█"})," are colored by link quality grade based on RSSI, SNR, and radio config."]}),r.jsx("p",{children:"Captures are stored in browser session only — export before closing the tab."})]})]})})]})]})]})}function ba({onUseCommand:e}){const[t,s]=a.useState(!1),n=e?t=>{s(!1),e(t)}:void 0;return r.jsxs(r.Fragment,{children:[r.jsx(ae,{icon:r.jsx(ge,{size:17,className:"translate-y-px"}),onClick:()=>s(!0),title:"CLI Command Guide"}),r.jsx($a,{isOpen:t,onClose:()=>s(!1),onUseCommand:n})]})}const wa=function(){const e=new xe,t=new xt(e);return e.register(t,new vt,new bt,new ta,new ra,new wt,new _t,new St,new aa,new na,new ia,new Wt,new rr,new mr,new ar,new sr,new hr,new jr,new Nr,new Tr,new Rr,new Mr,new Er,new Kr,new Jr,new ea,new da),e}(),_a=wa.all().flatMap(e=>[{cmd:e.name,desc:e.description,params:e.params,required:!!e.params},...e.aliases.filter(e=>e.includes(" ")).map(t=>({cmd:t,desc:e.description,params:e.params,required:!!e.params}))]);_a.push({cmd:"start cap",desc:"Start packet capture",params:"[seconds]",required:!0},{cmd:"end cap",desc:"Stop capture"},{cmd:"list cap",desc:"List captures"},{cmd:"export cap",desc:"Download capture",params:"[id]",required:!0});const ka=["sig","name","rssi","snr","dist","heard"],Ca={get:["name","role","lat","lon","radio","freq","tx","bw","sf","cr","af","txdelay","direct.txdelay","rxdelay","mode","repeat","flood.max","flood.advert.interval","advert.interval","duty","duty.max","multi.acks","int.thresh","agc.reset.interval","public.key","prv.key"],set:["name","lat","lon","freq","tx","bw","sf","cr","af","txdelay","direct.txdelay","rxdelay","mode","repeat","flood.max","flood.advert.interval","advert.interval","duty","log","multi.acks","int.thresh","agc.reset.interval","prv.key"],convert:["hex","base64"],neighbors:ka,nb:ka,"get neighbors":ka,"get neighbor":ka,"set mode":["forward","monitor"],"set duty":["on","off"],"set repeat":["on","off"],"set tx":["10","14","17","20","22"],"set sf":["7","8","9","10","11","12"],"set bw":["125","250","500"],"set cr":["5","6","7","8"],"set af":["0.5","1.0","1.5","2.0"],"set txdelay":["0.5","0.7","1.0","1.5"],"set direct.txdelay":["0.3","0.5","0.7"],"set log":["debug","info","warning","error"],"start cap":["30","60","120","300"]},Sa=["@@@@@@@ @@@ @@@ @@@@@@@@@@ @@@@@@@ ","@@@@@@@@ @@@ @@@ @@@@@@@@@@@ @@@@@@@@ ","@@! @@@ @@! !@@ @@! @@! @@! !@@ ","!@! @!@ !@! @!! !@! !@! !@! !@! ","@!@@!@! !@!@! @!! !!@ @!@ !@! ","!!@!!! @!!! !@! ! !@! !!! ","!!: !!: !!: !!: :!! ",":!: :!: :!: :!: :!: "," :: :: ::: :: ::: ::: "," : : : : :: :: : "];function ja(){return/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)||window.innerWidth<640}function Na(){const e=U(),{addCommand:t}=ua(),s=a.useRef(null),o=a.useRef(null),i=a.useRef(null),u=a.useRef(null),p=a.useRef(""),m=a.useRef(-1),g=a.useRef(""),f=a.useRef(!1),y=a.useRef(null),x=a.useRef(!1),v=a.useRef(!1),$=a.useRef(!1),b=a.useRef([]),w=a.useRef(()=>{}),_=z(),[k,C]=a.useState("C0dE"),[S,j]=a.useState(!1),N=a.useRef(null),T="C0dE",R=a.useCallback(e=>{N.current&&(clearInterval(N.current),N.current=null);const t=T.padEnd(7),r=t+" "+e+" "+t;let a=0;const s=r.length-7;j(!0),C(r.slice(0,7)),N.current=setInterval(()=>{if(a++,a>s)return clearInterval(N.current),N.current=null,j(!1),void C(T);C(r.slice(a,a+7))},280)},[]);a.useEffect(()=>{const e=function(e){const t=t=>e(t.detail);return Xr.addEventListener(Vr,t),()=>Xr.removeEventListener(Vr,t)}(R),t=setInterval(()=>{Math.random()<.02&&R(Gr())},45e3);return()=>{e(),clearInterval(t),N.current&&clearInterval(N.current)}},[R]);const[M,E]=a.useState(!1),A=a.useRef(null);a.useEffect(()=>{const e=(t=()=>{A.current&&clearTimeout(A.current),E(!0),A.current=setTimeout(()=>E(!1),5e3)},Qr.addEventListener(Zr,t),()=>Qr.removeEventListener(Zr,t));var t;return()=>{e(),A.current&&clearTimeout(A.current)}},[]);const[I,F]=a.useState({show:!1,options:[],selectedIndex:0,input:""}),L=a.useRef([]),B=a.useRef(0);a.useEffect(()=>{(null==e?void 0:e.neighbors)&&(b.current=Object.values(e.neighbors).map(e=>e.node_name||e.name).filter(e=>!!e).sort())},[null==e?void 0:e.neighbors]);const D=a.useCallback(()=>{var e;null==(e=o.current)||e.write(`${H()||"user"}@pyMC${be}: $${be} `)},[]),O=a.useCallback(()=>{const e=o.current;e&&(e.write(Ge),D(),e.write(p.current))},[D]),P=a.useCallback(e=>{const t=function(e,t){const r=e.toLowerCase(),a=r.trim();if(!a)return[];const s=r.length>a.length&&r.endsWith(" ");if(!a.includes(" ")&&!s)return _a.filter(e=>e.cmd.toLowerCase().startsWith(a));const n=s?a:a.substring(0,a.lastIndexOf(" ")),o=s?"":a.substring(a.lastIndexOf(" ")+1);if("ping"===n&&t.length>0)return t.filter(e=>e.toLowerCase().startsWith(o)).slice(0,10).map(e=>({cmd:`ping ${e}`,desc:`→ ${e}`}));const i=Ca[n];if(i){const e=i.filter(e=>e.toLowerCase().startsWith(o)).map(e=>({cmd:`${n} ${e}`,desc:`→ ${e}`}));if(!s&&o){const t=new Set(e.map(e=>e.cmd));for(const r of _a){const s=r.cmd.toLowerCase();s.startsWith(a)&&!t.has(s)&&(e.push(r),t.add(s))}}return e}return _a.filter(e=>e.cmd.toLowerCase().startsWith(a))}(e,b.current);L.current=t,B.current=0;const r=t.length>0&&e.trim().length>0;F({show:r,options:t,selectedIndex:0,input:e.trim()})},[]),W=a.useCallback(()=>{L.current=[],B.current=0,F({show:!1,options:[],selectedIndex:0,input:""})},[]),G=a.useCallback(e=>{var t;const r=L.current[e];r&&(p.current=r.required?r.cmd+" ":r.cmd,O(),r.required?P(p.current):W(),null==(t=o.current)||t.focus())},[O,P,W]),X=a.useCallback(async e=>{const r=o.current;if(!r)return;const a=e.trim();if(!a)return void D();f.current=!0;const s=new AbortController;y.current=s,t(a),m.current=-1;let n=0;const i={get cols(){return r.cols},get rows(){return r.rows},write(e,t="default"){const a=("default"===t?e:Ae(e,t)).split("\n");for(const s of a)r.writeln(s);return n=Ze(a,r.cols),String(n)},update(e,t,a){if($.current)r.write("");else if(n>0)for(let o=0;o{const t=o.current;if(!t)return;if(!v.current)return;if(f.current){for(let r=0;rrequestAnimationFrame(()=>{var t;return null==(t=document.querySelector(`[data-ac-index="${e}"]`))?void 0:t.scrollIntoView({block:"nearest"})});for(let s=0;s0){const e=L.current[B.current];e&&(p.current=e.cmd,O())}W();const e=p.current;p.current="",t.writeln(""),X(e);continue}if(127!==n&&8!==n)if(3!==n)if(12!==n)if(9!==n)if(27!==n)n>=32&&(p.current+=e[s],t.write(e[s]),m.current=-1,P(p.current));else{if(91===e.charCodeAt(s+1)){const t=e.charCodeAt(s+2);if(s+=2,65===t){if(L.current.length>0){const e=Math.max(B.current-1,0);B.current=e,F(t=>({...t,selectedIndex:e})),a(e)}else r.length>0&&(-1===m.current&&(g.current=p.current),m.current0){const e=Math.min(B.current+1,L.current.length-1);B.current=e,F(t=>({...t,selectedIndex:e})),a(e)}else m.current>0?(m.current--,p.current=r[r.length-1-m.current]||"",O()):0===m.current&&(m.current=-1,p.current=g.current,O());continue}if(67===t||68===t)continue;continue}L.current.length>0&&W()}else L.current.length>0&&G(B.current);else t.clear(),W(),O();else p.current="",W(),t.writeln("^C"),D();else p.current.length>0&&(p.current=p.current.slice(0,-1),t.write("\b \b"),P(p.current))}},[W,P,G,D,O,X]);a.useEffect(()=>{w.current=V},[V]);const Y=a.useCallback(async()=>{const e=o.current;if(!e||x.current)return;x.current=!0;const t="",r="",a=Sa.length,s=ce-1;try{const t=ne(Sa,0);for(const r of t)e.writeln(r);await new Promise(t=>{let r=0;const n=setInterval(()=>{if(r>=s)return clearInterval(n),void t();r++,e.write(`[${a}F`);const o=ne(Sa,r);for(const t of o)e.write(`${t}\n`)},oe)})}finally{ie()}e.writeln(""),e.write(Be("● Initializing terminal...")),await new Promise(e=>setTimeout(e,300)),e.write(Ge),e.writeln(`${t}✓ Initializing terminal...${r}`),e.write(Be("● Connecting to repeater...")),await new Promise(e=>setTimeout(e,500)),e.write(Ge),"connected"===q.getState().health?e.writeln(`${t}✓ Connected to repeater${r}`):e.writeln(`${je}~ Connection status unknown${be}`),e.writeln(Be("Ready. Type 'help' for commands.")),e.writeln(""),D(),v.current=!0},[D]);a.useEffect(()=>{const e=s.current;if(!e)return;const t=new c({theme:tt(),fontFamily:'"JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',fontSize:13,lineHeight:.65,cursorBlink:!1,cursorStyle:"underline",scrollback:1e4,convertEol:!0,allowTransparency:!0,rightClickSelectsWord:!1}),r=new l;t.loadAddon(r),t.loadAddon(new d),t.open(e),r.fit(),o.current=t,i.current=r;const a=t.onData(e=>w.current(e)),n=function(e){return h.subscribe(()=>{e.options.theme=tt()})}(t),u=new ResizeObserver(()=>{requestAnimationFrame(()=>r.fit())});return u.observe(e),Y(),ja()||t.focus(),()=>{var e;null==(e=y.current)||e.abort(),$.current&&(t.write(Ye+Ve),$.current=!1),a.dispose(),n(),u.disconnect(),t.dispose(),o.current=null,i.current=null}},[]);const J=a.useCallback(e=>{const t=e.target.value;t.length>0&&(V(t),e.target.value="")},[V]),Q=a.useCallback(e=>{"Enter"===e.key?(e.preventDefault(),V("\r")):"Backspace"===e.key?(e.preventDefault(),V("")):"ArrowUp"===e.key?(e.preventDefault(),V("")):"ArrowDown"===e.key&&(e.preventDefault(),V(""))},[V]),Z=a.useCallback(()=>{var e,t;ja()?null==(e=u.current)||e.focus():null==(t=o.current)||t.focus()},[]);a.useEffect(()=>{if(!ja())return;const e=()=>{var e;const t=null==(e=s.current)?void 0:e.querySelector(".xterm-viewport");t&&(t.scrollTop=t.scrollHeight),requestAnimationFrame(()=>{var e;return null==(e=i.current)?void 0:e.fit()})},t=window.visualViewport;if(t){const r=()=>{t.height<.75*window.innerHeight&&e()};return t.addEventListener("resize",r),()=>t.removeEventListener("resize",r)}const r=u.current;if(r){const t=()=>setTimeout(e,300);return r.addEventListener("focus",t),()=>r.removeEventListener("focus",t)}},[]);const ee=a.useCallback(e=>{p.current=e+" ",O(),P(p.current),setTimeout(()=>{var e;null==(e=s.current)||e.click()},400)},[O,P]);return r.jsxs(le,{children:[r.jsx(de,{title:"Terminal",icon:r.jsx(K,{})}),r.jsx(ue,{children:r.jsxs("div",{className:"terminal-card flex flex-col gap-1.5",children:[r.jsxs("div",{className:"card-terminal-header flex-wrap",children:[r.jsx("span",{className:"seven-seg-panel",children:r.jsx(se,{text:k,minChars:7,size:24,noCycle:S})}),r.jsxs("div",{className:"header-well flex items-center gap-1 sm:order-last",children:[r.jsx(ba,{onUseCommand:ee}),r.jsx(ma,{})]}),r.jsx("div",{className:"card-terminal-ridge flex-1 min-w-4 sm:hidden"}),r.jsx("div",{className:"header-well self-stretch flex-col sm:order-first",children:r.jsxs("div",{className:"indicator-key"+("connected"===_?" indicator-key--active":"degraded"===_?" indicator-key--sending":""),children:[r.jsx("span",{className:"indicator-key__label",children:"ONLINE"}),r.jsx("span",{className:"indicator-key__led"})]})}),r.jsx("div",{className:"card-terminal-ridge flex-1 min-w-8 hidden sm:block"})]}),r.jsx(pe,{noPadding:!0,className:"flex flex-col flex-1 min-h-0 overflow-hidden card-terminal",onClick:Z,children:r.jsxs("div",{className:"card-terminal-well flex-1 min-h-0 flex flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex-1 min-h-0 terminal-gutter relative",children:[r.jsx("div",{ref:s,className:"h-full w-full"}),M&&r.jsxs("div",{className:"absolute inset-0 z-10 flex items-center justify-center",onClick:()=>E(!1),children:[r.jsx("div",{className:"absolute inset-0 animate-[partytime-bg_5s_ease-out_forwards]",style:{background:"rgba(0,0,0,0.82)"}}),r.jsxs("div",{className:"relative z-10 animate-[partytime-crt_5s_ease-out_forwards] partytime-glow",children:[r.jsx("img",{src:"/assets/partytime.gif",alt:"No way.",className:"max-h-[60vh] max-w-[70vw] object-contain rounded"}),r.jsx("div",{className:"absolute inset-0 pointer-events-none rounded partytime-scanlines"})]})]})]}),I.show&&I.options.length>0&&r.jsxs("div",{className:"flex-shrink-0 overflow-hidden terminal-completions",style:{borderTop:"1px solid var(--terminal-border)",background:"var(--terminal-bg-input)"},children:[r.jsx("div",{className:"overflow-y-auto",style:{maxHeight:"176px"},children:I.options.map((e,t)=>{const a=t===I.selectedIndex,s=I.input.length;return r.jsxs("div",{"data-ac-index":t,onClick:()=>G(t),className:n("flex items-baseline gap-2 px-3 py-0.5 cursor-pointer transition-colors",a?"text-sys-blue":"text-fg-primary"),style:{background:a?"var(--terminal-autocomplete-hover)":void 0},onMouseEnter:e=>{a||(e.currentTarget.style.background="var(--terminal-autocomplete-hover)")},onMouseLeave:e=>{a||(e.currentTarget.style.background="")},children:[r.jsx("span",{className:"w-3 shrink-0 text-center text-sys-blue opacity-80",children:a?"▸":""}),r.jsxs("span",{className:"min-w-0 truncate flex-1",children:[r.jsx("span",{className:"font-semibold text-sys-blue",children:e.cmd.substring(0,s)}),e.cmd.substring(s)]}),r.jsx("span",{className:"shrink-0 text-[11px] text-fg-muted pl-3",children:e.desc})]},e.cmd)})}),r.jsxs("div",{className:"flex justify-between items-center px-3 py-0.5 text-xs text-fg-muted",style:{borderTop:"1px solid var(--terminal-border)"},children:[r.jsx("span",{children:"Tab · ↑↓ · Esc"}),r.jsxs("span",{children:[I.options.length," match",1!==I.options.length?"es":""]})]})]}),r.jsx("input",{ref:u,type:"text",className:"sr-only",onChange:J,onKeyDown:Q,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"aria-label":"Terminal input"}),r.jsxs("div",{className:"px-3 sm:px-4 py-1 flex justify-between text-xs text-fg-muted",style:{borderTop:"1px solid var(--terminal-border)"},children:[r.jsx("span",{className:"hidden sm:inline",children:"↑↓ History · Tab · Esc"}),r.jsx("span",{className:"sm:hidden",children:"Terminal"}),(null==e?void 0:e.version)&&r.jsxs("span",{children:["pyMC v",e.version]})]})]})})]})})]})}export{Na as default}; diff --git a/frontend/dist/assets/TimeRangeSelector-D9BP9uVt.js b/frontend/dist/assets/TimeRangeSelector-P4ymVxf5.js similarity index 87% rename from frontend/dist/assets/TimeRangeSelector-D9BP9uVt.js rename to frontend/dist/assets/TimeRangeSelector-P4ymVxf5.js index f02831b6..0ab795f2 100644 --- a/frontend/dist/assets/TimeRangeSelector-D9BP9uVt.js +++ b/frontend/dist/assets/TimeRangeSelector-P4ymVxf5.js @@ -1 +1 @@ -import{c as e,b9 as a,ba as s,m as t,b as o}from"./index-01Tx8g53.js";import{r,j as i,c as n}from"./vendor-react-j_fHog8x.js";import{A as c}from"./index-D932VMrD.js";const l=e("ear-off",[["path",{d:"M6 18.5a3.5 3.5 0 1 0 7 0c0-1.57.92-2.52 2.04-3.46",key:"1qngmn"}],["path",{d:"M6 8.5c0-.75.13-1.47.36-2.14",key:"b06bma"}],["path",{d:"M8.8 3.15A6.5 6.5 0 0 1 19 8.5c0 1.63-.44 2.81-1.09 3.76",key:"g10hsz"}],["path",{d:"M12.5 6A2.5 2.5 0 0 1 15 8.5M10 13a2 2 0 0 0 1.82-1.18",key:"ygzou7"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]),m=r.memo(function({value:e,format:t,prefix:o,suffix:n,className:l,priority:m="medium"}){const[u,g]=r.useState(!1),[p,d]=r.useState(e);r.useEffect(()=>a(()=>{g(!0),d(0)},m),[m]),r.useEffect(()=>{u&&d(e)},[u,e]);const f=`${o??""}${e.toLocaleString(void 0,t)}${n??""}`;return u?i.jsx(c,{className:`${l??""} overflow-hidden`,format:t,prefix:o,suffix:n,transition:s.numberTicker,children:p}):i.jsx("span",{className:l,children:f})}),u=r.memo(function({ranges:e,selectedIndex:a,onSelect:s,isPending:r,size:c="default",layoutId:l="time-range"}){const m="sm"===c?"toggle-group-sm":"micro"===c?"toggle-group-micro":"";return i.jsx("div",{className:n("toggle-group flex-shrink-0 overflow-x-auto",m,r&&"opacity-70"),children:e.map((e,r)=>{const c=a===r;return i.jsxs("button",{onClick:()=>s(r),className:n("toggle-group-item",c&&"active"),children:[c&&i.jsx(t.span,{layoutId:l,className:"toggle-group-highlight",transition:o.snappy}),i.jsx("span",{className:"relative z-[1]",children:e.label})]},e.label)})})});export{m as A,l as E,u as T}; +import{c as e,b9 as a,ba as s,m as t,b as o}from"./index-BBcIGlRT.js";import{r,j as i,c as n}from"./vendor-react-j_fHog8x.js";import{A as c}from"./index-CCvUM2Hn.js";const l=e("ear-off",[["path",{d:"M6 18.5a3.5 3.5 0 1 0 7 0c0-1.57.92-2.52 2.04-3.46",key:"1qngmn"}],["path",{d:"M6 8.5c0-.75.13-1.47.36-2.14",key:"b06bma"}],["path",{d:"M8.8 3.15A6.5 6.5 0 0 1 19 8.5c0 1.63-.44 2.81-1.09 3.76",key:"g10hsz"}],["path",{d:"M12.5 6A2.5 2.5 0 0 1 15 8.5M10 13a2 2 0 0 0 1.82-1.18",key:"ygzou7"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]),m=r.memo(function({value:e,format:t,prefix:o,suffix:n,className:l,priority:m="medium"}){const[u,g]=r.useState(!1),[p,d]=r.useState(e);r.useEffect(()=>a(()=>{g(!0),d(0)},m),[m]),r.useEffect(()=>{u&&d(e)},[u,e]);const f=`${o??""}${e.toLocaleString(void 0,t)}${n??""}`;return u?i.jsx(c,{className:`${l??""} overflow-hidden`,format:t,prefix:o,suffix:n,transition:s.numberTicker,children:p}):i.jsx("span",{className:l,children:f})}),u=r.memo(function({ranges:e,selectedIndex:a,onSelect:s,isPending:r,size:c="default",layoutId:l="time-range"}){const m="sm"===c?"toggle-group-sm":"micro"===c?"toggle-group-micro":"";return i.jsx("div",{className:n("toggle-group flex-shrink-0 overflow-x-auto",m,r&&"opacity-70"),children:e.map((e,r)=>{const c=a===r;return i.jsxs("button",{onClick:()=>s(r),className:n("toggle-group-item",c&&"active"),children:[c&&i.jsx(t.span,{layoutId:l,className:"toggle-group-highlight",transition:o.snappy}),i.jsx("span",{className:"relative z-[1]",children:e.label})]},e.label)})})});export{m as A,l as E,u as T}; diff --git a/frontend/dist/assets/activity-DOuX3omM.js b/frontend/dist/assets/activity-_XXDiQ1M.js similarity index 72% rename from frontend/dist/assets/activity-DOuX3omM.js rename to frontend/dist/assets/activity-_XXDiQ1M.js index 9b0037b8..875b53ef 100644 --- a/frontend/dist/assets/activity-DOuX3omM.js +++ b/frontend/dist/assets/activity-_XXDiQ1M.js @@ -1 +1 @@ -import{c as a}from"./index-01Tx8g53.js";const t=a("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);export{t as A}; +import{c as a}from"./index-BBcIGlRT.js";const t=a("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);export{t as A}; diff --git a/frontend/dist/assets/arrow-up-C91otjLx.js b/frontend/dist/assets/arrow-up-B5IQoVJ5.js similarity index 75% rename from frontend/dist/assets/arrow-up-C91otjLx.js rename to frontend/dist/assets/arrow-up-B5IQoVJ5.js index 1205975a..23b806f3 100644 --- a/frontend/dist/assets/arrow-up-C91otjLx.js +++ b/frontend/dist/assets/arrow-up-B5IQoVJ5.js @@ -1 +1 @@ -import{c as a}from"./index-01Tx8g53.js";const e=a("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),r=a("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);export{e as A,r as a}; +import{c as a}from"./index-BBcIGlRT.js";const e=a("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),r=a("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);export{e as A,r as a}; diff --git a/frontend/dist/assets/chat-utils-CB1BFUm7.js b/frontend/dist/assets/chat-utils-I8bC4Iy5.js similarity index 94% rename from frontend/dist/assets/chat-utils-CB1BFUm7.js rename to frontend/dist/assets/chat-utils-I8bC4Iy5.js index e10924dd..86b91b70 100644 --- a/frontend/dist/assets/chat-utils-CB1BFUm7.js +++ b/frontend/dist/assets/chat-utils-I8bC4Iy5.js @@ -1 +1 @@ -import{r as e}from"./vendor-react-j_fHog8x.js";import{bk as n}from"./index-01Tx8g53.js";const t=[n.green,n.blue,n.amber,n.pink,n.purple,n.cyan,n.orange,n.teal];function r(e){let n=0;for(let t=0;t0?{emoji:n[0],cleanName:e.replace(o,"").trim()||e}:{emoji:null,cleanName:e}}function i(e){const{cleanName:n}=a(e),t=n.split(/[\s-_]+/).filter(Boolean);return t.length>=2?((Array.from(t[0])[0]||"")+(Array.from(t[1])[0]||"")).toUpperCase():Array.from(n).slice(0,2).join("").toUpperCase()}function l(e){return new Date(1e3*e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}function s(n){const t=/@\[([^\]]+)\]/g,r=[];let o,a=0;for(;null!==(o=t.exec(n));)o.index>a&&r.push(n.slice(a,o.index)),r.push(e.createElement("span",{key:o.index,className:"font-extrabold text-white"},o[1])),a=o.index+o[0].length;return a0?r:n}export{i as a,l as b,a as e,s as f,r as g}; +import{r as e}from"./vendor-react-j_fHog8x.js";import{bk as n}from"./index-BBcIGlRT.js";const t=[n.green,n.blue,n.amber,n.pink,n.purple,n.cyan,n.orange,n.teal];function r(e){let n=0;for(let t=0;t0?{emoji:n[0],cleanName:e.replace(o,"").trim()||e}:{emoji:null,cleanName:e}}function i(e){const{cleanName:n}=a(e),t=n.split(/[\s-_]+/).filter(Boolean);return t.length>=2?((Array.from(t[0])[0]||"")+(Array.from(t[1])[0]||"")).toUpperCase():Array.from(n).slice(0,2).join("").toUpperCase()}function l(e){return new Date(1e3*e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}function s(n){const t=/@\[([^\]]+)\]/g,r=[];let o,a=0;for(;null!==(o=t.exec(n));)o.index>a&&r.push(n.slice(a,o.index)),r.push(e.createElement("span",{key:o.index,className:"font-extrabold text-white"},o[1])),a=o.index+o[0].length;return a0?r:n}export{i as a,l as b,a as e,s as f,r as g}; diff --git a/frontend/dist/assets/chevron-right-B6r5SVTI.js b/frontend/dist/assets/chevron-right-B6r5SVTI.js new file mode 100644 index 00000000..ad7fb162 --- /dev/null +++ b/frontend/dist/assets/chevron-right-B6r5SVTI.js @@ -0,0 +1 @@ +import{c as t}from"./index-BBcIGlRT.js";const h=t("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);export{h as C}; diff --git a/frontend/dist/assets/chevron-right-BHZSwM7S.js b/frontend/dist/assets/chevron-right-BHZSwM7S.js deleted file mode 100644 index ea6b5f8f..00000000 --- a/frontend/dist/assets/chevron-right-BHZSwM7S.js +++ /dev/null @@ -1 +0,0 @@ -import{c as t}from"./index-01Tx8g53.js";const h=t("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);export{h as C}; diff --git a/frontend/dist/assets/circle-check-DXO8ha7w.js b/frontend/dist/assets/circle-check-DI0_62yI.js similarity index 62% rename from frontend/dist/assets/circle-check-DXO8ha7w.js rename to frontend/dist/assets/circle-check-DI0_62yI.js index 9501c6d2..522185d5 100644 --- a/frontend/dist/assets/circle-check-DXO8ha7w.js +++ b/frontend/dist/assets/circle-check-DI0_62yI.js @@ -1 +1 @@ -import{c}from"./index-01Tx8g53.js";const e=c("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{e as C}; +import{c}from"./index-BBcIGlRT.js";const e=c("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);export{e as C}; diff --git a/frontend/dist/assets/copy-B5OWhmpX.js b/frontend/dist/assets/copy-C_IB0gEd.js similarity index 71% rename from frontend/dist/assets/copy-B5OWhmpX.js rename to frontend/dist/assets/copy-C_IB0gEd.js index 5d75ff85..95f67af5 100644 --- a/frontend/dist/assets/copy-B5OWhmpX.js +++ b/frontend/dist/assets/copy-C_IB0gEd.js @@ -1 +1 @@ -import{c}from"./index-01Tx8g53.js";const e=c("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);export{e as C}; +import{c}from"./index-BBcIGlRT.js";const e=c("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);export{e as C}; diff --git a/frontend/dist/assets/database-Cxl-xDNL.js b/frontend/dist/assets/database-CO202xKy.js similarity index 73% rename from frontend/dist/assets/database-Cxl-xDNL.js rename to frontend/dist/assets/database-CO202xKy.js index c5bce3be..de11e203 100644 --- a/frontend/dist/assets/database-Cxl-xDNL.js +++ b/frontend/dist/assets/database-CO202xKy.js @@ -1 +1 @@ -import{c as e}from"./index-01Tx8g53.js";const s=e("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);export{s as D}; +import{c as e}from"./index-BBcIGlRT.js";const s=e("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);export{s as D}; diff --git a/frontend/dist/assets/easing-DMuAVfRm.js b/frontend/dist/assets/easing-DWvlCTyt.js similarity index 81% rename from frontend/dist/assets/easing-DMuAVfRm.js rename to frontend/dist/assets/easing-DWvlCTyt.js index 01921d3f..8fbffe9c 100644 --- a/frontend/dist/assets/easing-DMuAVfRm.js +++ b/frontend/dist/assets/easing-DWvlCTyt.js @@ -1 +1 @@ -import{c as a,da as s}from"./index-01Tx8g53.js";const c=a("compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),e=s(.65,0,.35,1),m=s(.33,1,.68,1),o=s(.33,.67,.67,1),p=s(.76,0,.24,1);export{c as C,m as a,e as b,o as c,p as e}; +import{c as a,da as s}from"./index-BBcIGlRT.js";const c=a("compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),e=s(.65,0,.35,1),m=s(.33,1,.68,1),o=s(.33,.67,.67,1),p=s(.76,0,.24,1);export{c as C,m as a,e as b,o as c,p as e}; diff --git a/frontend/dist/assets/funnel-4zcnjEgH.js b/frontend/dist/assets/funnel-Bb7d8E3s.js similarity index 74% rename from frontend/dist/assets/funnel-4zcnjEgH.js rename to frontend/dist/assets/funnel-Bb7d8E3s.js index e3403545..dafba8a4 100644 --- a/frontend/dist/assets/funnel-4zcnjEgH.js +++ b/frontend/dist/assets/funnel-Bb7d8E3s.js @@ -1 +1 @@ -import{c as a}from"./index-01Tx8g53.js";const s=a("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]);export{s as F}; +import{c as a}from"./index-BBcIGlRT.js";const s=a("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]);export{s as F}; diff --git a/frontend/dist/assets/geo-utils-D72kdxDo.js b/frontend/dist/assets/geo-utils-BJfOkt8p.js similarity index 87% rename from frontend/dist/assets/geo-utils-D72kdxDo.js rename to frontend/dist/assets/geo-utils-BJfOkt8p.js index 40afb558..1b33ae4d 100644 --- a/frontend/dist/assets/geo-utils-D72kdxDo.js +++ b/frontend/dist/assets/geo-utils-BJfOkt8p.js @@ -1 +1 @@ -import{c as t}from"./index-01Tx8g53.js";const a=t("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);function h(t,a,h,n){const s=(h-t)*Math.PI/180,M=(n-a)*Math.PI/180,o=Math.sin(s/2)*Math.sin(s/2)+Math.cos(t*Math.PI/180)*Math.cos(h*Math.PI/180)*Math.sin(M/2)*Math.sin(M/2);return 2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o))*6371e3}function n(t,a){return void 0!==t&&void 0!==a&&(0!==t||0!==a)}export{a as D,h as c,n as h}; +import{c as t}from"./index-BBcIGlRT.js";const a=t("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);function h(t,a,h,n){const s=(h-t)*Math.PI/180,M=(n-a)*Math.PI/180,o=Math.sin(s/2)*Math.sin(s/2)+Math.cos(t*Math.PI/180)*Math.cos(h*Math.PI/180)*Math.sin(M/2)*Math.sin(M/2);return 2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o))*6371e3}function n(t,a){return void 0!==t&&void 0!==a&&(0!==t||0!==a)}export{a as D,h as c,n as h}; diff --git a/frontend/dist/assets/git-branch-Bz_gqcbv.js b/frontend/dist/assets/git-branch-CaPGs8Pg.js similarity index 76% rename from frontend/dist/assets/git-branch-Bz_gqcbv.js rename to frontend/dist/assets/git-branch-CaPGs8Pg.js index 1d75e2ae..296cd1b7 100644 --- a/frontend/dist/assets/git-branch-Bz_gqcbv.js +++ b/frontend/dist/assets/git-branch-CaPGs8Pg.js @@ -1 +1 @@ -import{c}from"./index-01Tx8g53.js";const e=c("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);export{e as G}; +import{c}from"./index-BBcIGlRT.js";const e=c("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);export{e as G}; diff --git a/frontend/dist/assets/index-01Tx8g53.js b/frontend/dist/assets/index-BBcIGlRT.js similarity index 99% rename from frontend/dist/assets/index-01Tx8g53.js rename to frontend/dist/assets/index-BBcIGlRT.js index 74b4b005..c1b7db41 100644 --- a/frontend/dist/assets/index-01Tx8g53.js +++ b/frontend/dist/assets/index-BBcIGlRT.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Login-CQwX9eZS.js","assets/vendor-react-j_fHog8x.js","assets/ascii-burst-CXC_pYgi.js","assets/vendor-core-CmkNwW1A.js","assets/maplibre-gl-B1CfjdFi.css","assets/Dashboard-CLZ_2cdd.js","assets/PageLayout-DrvMAhys.js","assets/sun-CkgnTZGI.js","assets/TimeRangeSelector-D9BP9uVt.js","assets/index-D932VMrD.js","assets/node-types-BT5BImck.js","assets/meshcore-tx-constants-BDLT5LMb.js","assets/PacketList-C6Vv6v7V.js","assets/payload-decoders-XckZ5vyB.js","assets/badge-colors-YAE4qQ7m.js","assets/chat-utils-CB1BFUm7.js","assets/SignalIndicator-CIKrVFY9.js","assets/signal-scoring-CcBiRcks.js","assets/arrow-up-C91otjLx.js","assets/copy-B5OWhmpX.js","assets/chevron-right-BHZSwM7S.js","assets/map-pin-DZIYgupP.js","assets/triangle-alert-DI33YyZq.js","assets/DataBox-Dpf5ZHgV.js","assets/layers-BNjfohkH.js","assets/route-D7UU7r6_.js","assets/activity-DOuX3omM.js","assets/circle-check-DXO8ha7w.js","assets/database-Cxl-xDNL.js","assets/DelayedAnimateNumber-Ix4AeV6C.js","assets/Card-Dr9pbVV5.js","assets/LightSparkline-BCL2qx0n.js","assets/link-scoring-LTbqUxGC.js","assets/NodeInformationCard-BswM4rjl.js","assets/ChatBubble-B4FG9Nhp.js","assets/message-square-B0UfZczh.js","assets/Grid-OFJ4oe0a.js","assets/Packets-CKR_k_Es.js","assets/users-CIk0ES1a.js","assets/funnel-4zcnjEgH.js","assets/Contacts-CiTyOtpU.js","assets/ping-CcgRdnC3.js","assets/listbox-D30S1eZ7.js","assets/git-branch-Bz_gqcbv.js","assets/target-L50EKHoJ.js","assets/ConfirmModal-B8b131zF.js","assets/CollisionExplorerModal-CTPNNbNo.js","assets/BasemapLayer-BT1oL_wV.js","assets/network-CCjpHq5M.js","assets/search-DGnzblbI.js","assets/Statistics-BaT7n0oZ.js","assets/usePolling-B1kG3uqm.js","assets/easing-DMuAVfRm.js","assets/settings-2-CePlNpN3.js","assets/MeshGraph-LoEY91Ly.js","assets/DeepAnalysisModal-BWClcGsg.js","assets/geo-utils-D72kdxDo.js","assets/System-iTOQgR9S.js","assets/refresh-cw-DYbYazpH.js","assets/Logs-Df-7DFJ4.js","assets/Terminal-CKx-DNJQ.js","assets/xterm-Cq-DlOOL.js","assets/system-DikvxgDQ.js","assets/KeycapButton-6IH7dZJL.js","assets/keycap-sfx-CAsrNe23.js","assets/xterm-6GBZ9nXN.css","assets/Configuration-CIgGarXY.js","assets/font-loader-BQzEmDrZ.js","assets/key-round-D0AtlMOx.js","assets/RoomServer-tW8KnEnb.js","assets/wifi-DUOhGE6X.js"])))=>i.map(i=>d[i]); -var e,t,n=Object.defineProperty,a=(e,t,a)=>((e,t,a)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);import{r as s,j as r,b as o,c as i,L as l,h as c,z as u,Q as d,y as h,x as m,X as p,d as g,e as f,W as y,t as b,Z as v,M as w,K as C,_ as k,f as x}from"./vendor-react-j_fHog8x.js";import{L as D,c as A,u as E,a as B,R as F,b as S,N as M,B as j}from"./vendor-core-CmkNwW1A.js";import"./maplibre-gl-b91ci4Kr.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const n of e)if("childList"===n.type)for(const e of n.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)}).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();const T={red:"#E5484D",orange:"#F76B15",amber:"#FFB224",yellow:"#F5D90A",brown:"#AD7F58",green:"#46A758",teal:"#12A594",cyan:"#00A2C7",blue:"#3B82F6",indigo:"#5B5BD6",purple:"#8E4EC6",pink:"#D6409F"},P={50:"#fafafa",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"};function L(e){const t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}const R={surfaces:{defaults:{tint:"#252525",light:"#ffffff",dark:"#000000",reflexLight:.15,reflexDark:.8,blur:6,blurElevated:8,brightness:1,opacity:8,opacityElevated:12},card:{radius:"1.125rem",padding:"1.25rem",paddingCompact:"0.75rem"},sidebar:{tint:"rgba(113, 156, 223, 0.06)",width:"16rem",drawerWidth:"85vw"},modal:{radius:"1.125rem",backdropBlur:"8px",backdropColor:"rgba(0, 0, 0, 0.6)"}},colors:{bg:{body:P[950],surface:P[900],elevated:P[800],subtle:P[800]},border:{subtle:P[800],strong:P[600]},text:{primary:"#ffffff",secondary:P[400],muted:P[500],inverse:P[950]},accent:{primary:T.blue,secondary:T.purple,tertiary:T.cyan,success:T.green,danger:T.red},signal:{excellent:T.green,good:T.yellow,fair:T.amber,poor:T.orange,critical:T.red,unknown:P[500]},status:{success:T.green,warning:T.amber,danger:T.red,info:T.blue,muted:P[500]},chart:{c1:T.blue,c2:T.teal,c3:T.amber,c4:T.orange,c5:T.pink,c6:T.purple,c7:T.cyan,c8:P[500],grid:"rgba(191, 191, 191, 0.15)",axis:P[400],cursor:"rgba(255, 255, 255, 0.2)"},metric:{received:T.blue,forwarded:T.teal,transmitted:T.orange,dropped:T.red},map:{nodeFill:T.blue,nodeStroke:"rgba(255,255,255,0.9)",hub:T.purple,local:T.amber,neighbor:T.green,mobile:T.orange,room:T.pink,edge:P[700],edgeHover:T.cyan}},typography:{font:{title:"'Inter', system-ui, sans-serif",display:"'Inter', system-ui, sans-serif",mono:"'JetBrains Mono', 'SF Mono', Monaco, monospace"},size:{xs:"0.64rem",sm:"0.8rem",base:"1rem",md:"1.125rem",lg:"1.25rem",xl:"1.563rem",xxl:"1.953rem",hero:"3.052rem"},weight:{normal:400,medium:500,semibold:600,bold:700},leading:{tight:1.1,snug:1.25,normal:1.5},tracking:{tight:"-0.02em",normal:"0",wide:"0.05em"}},spacing:{space:{gap:"1.5rem",gapMobile:"0.75rem",page:"1.5rem",pageMobile:"1rem",section:"2rem"},radius:{sm:"0.5rem",md:"0.875rem",lg:"1.125rem",xl:"1.5rem",pill:"9999px"}},motion:{fast:"0.1s",normal:"0.15s",slow:"0.4s",easing:"ease-out"}};function N(e){const t=e.replace("#","");if(6!==t.length&&3!==t.length)return e;let n,a,s;return 3===t.length?(n=parseInt(t[0]+t[0],16)/255,a=parseInt(t[1]+t[1],16)/255,s=parseInt(t[2]+t[2],16)/255):(n=parseInt(t.slice(0,2),16)/255,a=parseInt(t.slice(2,4),16)/255,s=parseInt(t.slice(4,6),16)/255),`color(display-p3 ${n.toFixed(3)} ${a.toFixed(3)} ${s.toFixed(3)})`}function z(){return"undefined"!=typeof window&&CSS.supports("color","color(display-p3 1 1 1)")}function _(e,t){const n={...e};for(const a of Object.keys(t)){const s=t[a],r=e[a];void 0!==s&&("object"!=typeof s||null===s||Array.isArray(s)||"object"!=typeof r||null===r||Array.isArray(r)?n[a]=s:n[a]=_(r,s))}return n}function I(e){return{meta:e.meta,display:e.display,surfaces:e.surfaces?_(R.surfaces,e.surfaces):R.surfaces,colors:e.colors?_(R.colors,e.colors):R.colors,typography:e.typography?_(R.typography,e.typography):R.typography,spacing:e.spacing?_(R.spacing,e.spacing):R.spacing,motion:e.motion?_(R.motion,e.motion):R.motion}}function V(e){const t=e.replace("#","");return 6===t.length?`${parseInt(t.slice(0,2),16)}, ${parseInt(t.slice(2,4),16)}, ${parseInt(t.slice(4,6),16)}`:"255, 255, 255"}const O={"Breeze Dark":I({meta:{id:"",name:"",dataTheme:"",previewColor:T.blue,backgroundImage:"",backgroundBrightness:100,isDark:!0},display:{font:"Inter, sans-serif",color:P[400],size:1,palette:[[T.blue,T.green,T.amber,T.orange,T.red],[P[950],P[900],P[800],P[700],P[50]]]},typography:{font:{title:"Inter, sans-serif",display:"Inter, sans-serif",mono:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},weight:{normal:400,medium:500,semibold:600,bold:700,badge:700},tracking:{tight:"-0.02em",normal:"0",wide:"0.025em"},badge:{textTransform:"capitalize"}},surfaces:{defaults:{tint:P[900],light:P[700],dark:P[950],reflexLight:0,reflexDark:0,blur:0,blurElevated:0,brightness:1,opacity:100,opacityElevated:100,catalystMode:!0},sidebar:{tint:`${P[800]}80`},card:{radius:"0.5rem"},modal:{radius:"0.75rem"}},colors:{bg:{body:P[950],surface:P[900],elevated:P[800],subtle:P[800]},border:{subtle:P[800],strong:P[600]},text:{primary:"#fff",secondary:P[400],muted:P[500],inverse:P[950]},accent:{primary:T.blue,secondary:T.amber,tertiary:T.cyan,success:T.green,danger:T.red},signal:{excellent:T.green,good:T.yellow,fair:T.amber,poor:T.orange,critical:T.red,unknown:P[500]},status:{success:T.green,warning:T.amber,danger:T.red,info:T.blue,muted:P[500]},chart:{c1:T.blue,c2:T.teal,c3:T.amber,c4:T.orange,c5:T.pink,c6:T.purple,c7:T.cyan,c8:P[500],grid:`${P[50]}0d`,axis:`${P[50]}33`,cursor:`${T.blue}33`},metric:{received:T.blue,forwarded:T.teal,transmitted:T.orange,dropped:T.red},map:{nodeFill:T.blue,nodeStroke:`${P[50]}e6`,hub:T.purple,local:T.amber,neighbor:T.green,mobile:T.orange,room:T.pink,edge:P[700],edgeHover:T.blue}}}),"Breeze Light":I({meta:{id:"",name:"",dataTheme:"",previewColor:T.blue,backgroundImage:"",backgroundColor:"#EFF0F1",backgroundBrightness:100,isDark:!1},display:{font:"Inter, sans-serif",color:P[600],size:1,palette:[[T.blue,T.green,T.amber,T.orange,T.red],["#EFF0F1","#FCFCFC","#DEE0E2",P[500],P[900]]]},typography:{font:{title:"Inter, sans-serif",display:"Inter, sans-serif",mono:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},weight:{normal:400,medium:500,semibold:600,bold:700,badge:700},tracking:{tight:"-0.02em",normal:"0",wide:"0.025em"},badge:{textTransform:"capitalize"}},surfaces:{defaults:{tint:"#FCFCFC",light:P[200],dark:P[400],reflexLight:0,reflexDark:0,blur:0,blurElevated:0,brightness:1,opacity:100,opacityElevated:100,catalystMode:!0},sidebar:{tint:"rgba(0, 0, 0, 0.02)"},card:{radius:"0.5rem"},modal:{radius:"0.75rem"}},colors:{bg:{body:"#EFF0F1",surface:"#FCFCFC",elevated:"#FFFFFF",subtle:"#E3E5E7"},border:{subtle:"#DEE0E2",strong:"#BFC2C5"},text:{primary:P[900],secondary:P[600],muted:P[500],inverse:"#FFFFFF"},accent:{primary:T.blue,secondary:T.amber,tertiary:T.cyan,success:T.green,danger:T.red},signal:{excellent:T.green,good:T.yellow,fair:T.amber,poor:T.orange,critical:T.red,unknown:P[400]},status:{success:T.green,warning:T.amber,danger:T.red,info:T.blue,muted:P[400]},chart:{c1:T.blue,c2:T.teal,c3:T.amber,c4:T.orange,c5:T.pink,c6:T.purple,c7:T.cyan,c8:P[400],grid:`${P[900]}0d`,axis:`${P[900]}80`,cursor:`${T.blue}1a`},metric:{received:T.blue,forwarded:T.teal,transmitted:T.orange,dropped:T.red},map:{nodeFill:T.blue,nodeStroke:"rgba(255,255,255,0.9)",hub:T.purple,local:T.amber,neighbor:T.green,mobile:T.orange,room:T.pink,edge:P[400],edgeHover:T.blue},sidebar:{bg:"rgba(0, 0, 0, 0.02)",navHoverBg:"rgba(0, 0, 0, 0.04)",navActiveBg:"rgba(59, 130, 246, 0.10)",navActiveText:T.blue}}})};function $(e,t){const n=e.toLowerCase();return{...t,meta:{...t.meta,id:n,name:e,dataTheme:n}}}const q=Object.fromEntries(Object.entries(O).map(([e,t])=>[e,$(e,t)])),U=Object.values(q);function W(e){return U.find(t=>t.meta.id===e)}function H(e){return"string"==typeof e&&U.some(t=>t.meta.id===e)}new Map(Object.entries(q));const Y=q["Breeze Dark"],G=Y.meta.id;Y.meta.backgroundImage;const K={themeId:G,brightness:Y.meta.backgroundBrightness},X="pymc-theme-id",J="pymc-bg-brightness",Z="pymc-color-scheme",Q="pymc-background";const ee={50:.97,100:.92,200:.84,300:.73,400:.62,500:.5,600:.4,700:.32,800:.24,900:.16},te=[50,100,200,300,400,500,600,700,800,900],ne=["red","orange","yellow","green","aqua","blue","purple"];function ae(e,t,n){const a=e=>Math.round(Math.max(0,Math.min(255,e))).toString(16).padStart(2,"0");return`#${a(e)}${a(t)}${a(n)}`}function se(e){const t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function re(e){const t=e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055;return Math.round(255*t)}function oe(e,t,n){const a=n*(Math.PI/180),s=t*Math.cos(a),r=t*Math.sin(a),o=e+.3963377774*s+.2158037573*r,i=e-.1055613458*s-.0638541728*r,l=e-.0894841775*s-1.291485548*r,c=o*o*o,u=i*i*i,d=l*l*l,h=-1.2684380046*c+2.6097574011*u-.3413193965*d,m=-.0041960863*c-.7034186147*u+1.707614701*d;return[re(4.0767416621*c-3.3077115913*u+.2309699292*d),re(h),re(m)]}function ie(e){const[t,n,a]=function(e){const t=e.replace("#","");return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}(e),[,s,r]=function(e,t,n){const a=se(e),s=se(t),r=se(n),o=.4122214708*a+.5363325363*s+.0514459929*r,i=.2119034982*a+.6806995451*s+.1073969566*r,l=.0883024619*a+.2817188376*s+.6299787005*r,c=Math.cbrt(o),u=Math.cbrt(i),d=Math.cbrt(l),h=.2104542553*c+.793617785*u-.0040720468*d,m=1.9779984951*c-2.428592205*u+.4505937099*d,p=.0259040371*c+.7827717662*u-.808675766*d,g=Math.sqrt(m*m+p*p);let f=Math.atan2(p,m)*(180/Math.PI);return f<0&&(f+=360),[h,g,f]}(t,n,a),o={};for(const i of te){const e=ee[i],t=s*(1-.3*Math.abs(e-.5)),[n,a,l]=oe(e,t,r);o[i]=ae(n,a,l)}return o}function le(e){return"undefined"==typeof window?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function ce(e,t){"undefined"!=typeof document&&document.documentElement.style.setProperty(e,t)}const ue="u-off",de="u-label",he="width",me="height",pe="top",ge="bottom",fe="left",ye="right",be="#000",ve=be+"0",we="mousemove",Ce="mousedown",ke="mouseup",xe="mouseenter",De="mouseleave",Ae="dblclick",Ee="change",Be="dppxchange",Fe="--",Se="undefined"!=typeof window,Me=Se?document:null,je=Se?window:null,Te=Se?navigator:null;let Pe,Le;function Re(e,t){if(null!=t){let n=e.classList;!n.contains(t)&&n.add(t)}}function Ne(e,t){let n=e.classList;n.contains(t)&&n.remove(t)}function ze(e,t,n){e.style[t]=n+"px"}function _e(e,t,n,a){let s=Me.createElement(e);return null!=t&&Re(s,t),null!=n&&n.insertBefore(s,a),s}function Ie(e,t){return _e("div",e,t)}const Ve=new WeakMap;function Oe(e,t,n,a,s){let r="translate("+t+"px,"+n+"px)";r!=Ve.get(e)&&(e.style.transform=r,Ve.set(e,r),t<0||n<0||t>a||n>s?Re(e,ue):Ne(e,ue))}const $e=new WeakMap;function qe(e,t,n){let a=t+n;a!=$e.get(e)&&($e.set(e,a),e.style.background=t,e.style.borderColor=n)}const Ue=new WeakMap;function We(e,t,n,a){let s=t+""+n;s!=Ue.get(e)&&(Ue.set(e,s),e.style.height=n+"px",e.style.width=t+"px",e.style.marginLeft=a?-t/2+"px":0,e.style.marginTop=a?-n/2+"px":0)}const He={passive:!0},Ye={...He,capture:!0};function Ge(e,t,n,a){t.addEventListener(e,n,a?Ye:He)}function Ke(e,t,n,a){t.removeEventListener(e,n,He)}function Xe(e,t,n,a){let s;n=n||0;let r=(a=a||t.length-1)<=2147483647;for(;a-n>1;)s=r?n+a>>1:gt((n+a)/2),t[s]{let s=-1,r=-1;for(let o=n;o<=a;o++)if(e(t[o])){s=o;break}for(let o=a;o>=n;o--)if(e(t[o])){r=o;break}return[s,r]}}Se&&function e(){let t=devicePixelRatio;Pe!=t&&(Pe=t,Le&&Ke(Ee,Le,e),Le=matchMedia(`(min-resolution: ${Pe-.001}dppx) and (max-resolution: ${Pe+.001}dppx)`),Ge(Ee,Le,e),je.dispatchEvent(new CustomEvent(Be)))}();const Ze=e=>null!=e,Qe=e=>null!=e&&e>0,et=Je(Ze),tt=Je(Qe);function nt(e,t,n,a){let s=Ct(e),r=Ct(t);e==t&&(-1==s?(e*=n,t/=n):(e/=n,t*=n));let o=10==n?kt:xt,i=1==r?yt:gt,l=(1==s?gt:yt)(o(pt(e))),c=i(o(pt(t))),u=wt(n,l),d=wt(n,c);return 10==n&&(l<0&&(u=Vt(u,-l)),c<0&&(d=Vt(d,-c))),a||2==n?(e=u*s,t=d*r):(e=It(e,u),t=_t(t,d)),[e,t]}function at(e,t,n,a){let s=nt(e,t,n,a);return 0==e&&(s[0]=0),0==t&&(s[1]=0),s}const st={mode:3,pad:.1},rt={pad:0,soft:null,mode:0},ot={min:rt,max:rt};function it(e,t,n,a){return Xt(n)?ct(e,t,n):(rt.pad=n,rt.soft=a?0:null,rt.mode=a?3:0,ct(e,t,ot))}function lt(e,t){return null==e?t:e}function ct(e,t,n){let a=n.min,s=n.max,r=lt(a.pad,0),o=lt(s.pad,0),i=lt(a.hard,-At),l=lt(s.hard,At),c=lt(a.soft,At),u=lt(s.soft,-At),d=lt(a.mode,0),h=lt(s.mode,0),m=t-e,p=kt(m),g=vt(pt(e),pt(t)),f=kt(g),y=pt(f-p);(m<1e-24||y>10)&&(m=0,0!=e&&0!=t||(m=1e-24,2==d&&c!=At&&(r=0),2==h&&u!=-At&&(o=0)));let b=m||g||1e3,v=kt(b),w=wt(10,gt(v)),C=Vt(It(e-b*(0==m?0==e?.1:1:r),w/10),24),k=e>=c&&(1==d||3==d&&C<=c||2==d&&C>=c)?c:At,x=vt(i,C=k?k:bt(k,C)),D=Vt(_t(t+b*(0==m?0==t?.1:1:o),w/10),24),A=t<=u&&(1==h||3==h&&D>=u||2==h&&D<=u)?u:-At,E=bt(l,D>A&&t<=A?A:vt(A,D));return x==E&&0==x&&(E=100),[x,E]}const ut=new Intl.NumberFormat(Se?Te.language:"en-US"),dt=e=>ut.format(e),ht=Math,mt=ht.PI,pt=ht.abs,gt=ht.floor,ft=ht.round,yt=ht.ceil,bt=ht.min,vt=ht.max,wt=ht.pow,Ct=ht.sign,kt=ht.log10,xt=ht.log2,Dt=(e,t=1)=>ht.asinh(e/t),At=1/0;function Et(e){return 1+(0|kt((e^e>>31)-(e>>31)))}function Bt(e,t,n){return bt(vt(e,t),n)}function Ft(e){return"function"==typeof e}function St(e){return Ft(e)?e:()=>e}const Mt=e=>e,jt=(e,t)=>t,Tt=e=>null,Pt=e=>!0,Lt=(e,t)=>e==t,Rt=/\.\d*?(?=9{6,}|0{6,})/gm,Nt=e=>{if(Gt(e)||Ot.has(e))return e;const t=`${e}`,n=t.match(Rt);if(null==n)return e;let a=n[0].length-1;if(-1!=t.indexOf("e-")){let[e,n]=t.split("e");return+`${Nt(e)}e${n}`}return Vt(e,a)};function zt(e,t){return Nt(Vt(Nt(e/t))*t)}function _t(e,t){return Nt(yt(Nt(e/t))*t)}function It(e,t){return Nt(gt(Nt(e/t))*t)}function Vt(e,t=0){if(Gt(e))return e;let n=10**t,a=e*n*(1+Number.EPSILON);return ft(a)/n}const Ot=new Map;function $t(e){return((""+e).split(".")[1]||"").length}function qt(e,t,n,a){let s=[],r=a.map($t);for(let o=t;o=0?0:t)+(o>=r[i]?0:r[i]),u=10==e?l:Vt(l,c);s.push(u),Ot.set(u,c)}}return s}const Ut={},Wt=[],Ht=[null,null],Yt=Array.isArray,Gt=Number.isInteger;function Kt(e){return"string"==typeof e}function Xt(e){let t=!1;if(null!=e){let n=e.constructor;t=null==n||n==Object}return t}function Jt(e){return null!=e&&"object"==typeof e}const Zt=Object.getPrototypeOf(Uint8Array),Qt="__proto__";function en(e,t=Xt){let n;if(Yt(e)){let a=e.find(e=>null!=e);if(Yt(a)||t(a)){n=Array(e.length);for(let a=0;ar){for(a=o-1;a>=0&&null==e[a];)e[a--]=null;for(a=o+1;aPromise.resolve().then(e):queueMicrotask,sn=["January","February","March","April","May","June","July","August","September","October","November","December"],rn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function on(e){return e.slice(0,3)}const ln=rn.map(on),cn=sn.map(on),un={MMMM:sn,MMM:cn,WWWW:rn,WWW:ln};function dn(e){return(e<10?"0":"")+e}const hn={YYYY:e=>e.getFullYear(),YY:e=>(e.getFullYear()+"").slice(2),MMMM:(e,t)=>t.MMMM[e.getMonth()],MMM:(e,t)=>t.MMM[e.getMonth()],MM:e=>dn(e.getMonth()+1),M:e=>e.getMonth()+1,DD:e=>dn(e.getDate()),D:e=>e.getDate(),WWWW:(e,t)=>t.WWWW[e.getDay()],WWW:(e,t)=>t.WWW[e.getDay()],HH:e=>dn(e.getHours()),H:e=>e.getHours(),h:e=>{let t=e.getHours();return 0==t?12:t>12?t-12:t},AA:e=>e.getHours()>=12?"PM":"AM",aa:e=>e.getHours()>=12?"pm":"am",a:e=>e.getHours()>=12?"p":"a",mm:e=>dn(e.getMinutes()),m:e=>e.getMinutes(),ss:e=>dn(e.getSeconds()),s:e=>e.getSeconds(),fff:e=>{return((t=e.getMilliseconds())<10?"00":t<100?"0":"")+t;var t}};function mn(e,t){t=t||un;let n,a=[],s=/\{([a-z]+)\}|[^{]+/gi;for(;n=s.exec(e);)a.push("{"==n[0][0]?hn[n[1]]:n[0]);return e=>{let n="";for(let s=0;se%1==0,fn=[1,2,2.5,5],yn=qt(10,-32,0,fn),bn=qt(10,0,32,fn),vn=bn.filter(gn),wn=yn.concat(bn),Cn="{YYYY}",kn="\n"+Cn,xn="{M}/{D}",Dn="\n"+xn,An=Dn+"/{YY}",En="{aa}",Bn="{h}:{mm}"+En,Fn="\n"+Bn,Sn=":{ss}",Mn=null;function jn(e){let t=1e3*e,n=60*t,a=60*n,s=24*a,r=30*s,o=365*s;return[(1==e?qt(10,0,3,fn).filter(gn):qt(10,-3,0,fn)).concat([t,5*t,10*t,15*t,30*t,n,5*n,10*n,15*n,30*n,a,2*a,3*a,4*a,6*a,8*a,12*a,s,2*s,3*s,4*s,5*s,6*s,7*s,8*s,9*s,10*s,15*s,r,2*r,3*r,4*r,6*r,o,2*o,5*o,10*o,25*o,50*o,100*o]),[[o,Cn,Mn,Mn,Mn,Mn,Mn,Mn,1],[28*s,"{MMM}",kn,Mn,Mn,Mn,Mn,Mn,1],[s,xn,kn,Mn,Mn,Mn,Mn,Mn,1],[a,"{h}"+En,An,Mn,Dn,Mn,Mn,Mn,1],[n,Bn,An,Mn,Dn,Mn,Mn,Mn,1],[t,Sn,An+" "+Bn,Mn,Dn+" "+Bn,Mn,Fn,Mn,1],[e,Sn+".{fff}",An+" "+Bn,Mn,Dn+" "+Bn,Mn,Fn,Mn,1]],function(t){return(i,l,c,u,d,h)=>{let m=[],p=d>=o,g=d>=r&&d=s?s:d,o=v+(gt(c)-gt(y))+_t(y-v,r);m.push(o);let p=t(o),g=p.getHours()+p.getMinutes()/n+p.getSeconds()/a,f=d/a,b=h/i.axes[l]._space;for(;o=Vt(o+d,1==e?0:3),!(o>u);)if(f>1){let e=gt(Vt(g+f,6))%24,n=t(o).getHours()-e;n>1&&(n=-1),o-=n*a,g=(g+f)%24,Vt((o-m[m.length-1])/d,3)*b>=.7&&m.push(o)}else m.push(o)}return m}}]}const[Tn,Pn,Ln]=jn(1),[Rn,Nn,zn]=jn(.001);function _n(e,t){return e.map(e=>e.map((n,a)=>0==a||8==a||null==n?n:t(1==a||0==e[8]?n:e[1]+n)))}function In(e,t){return(n,a,s,r,o)=>{let i,l,c,u,d,h,m=t.find(e=>o>=e[0])||t[t.length-1];return a.map(t=>{let n=e(t),a=n.getFullYear(),s=n.getMonth(),r=n.getDate(),o=n.getHours(),p=n.getMinutes(),g=n.getSeconds(),f=a!=i&&m[2]||s!=l&&m[3]||r!=c&&m[4]||o!=u&&m[5]||p!=d&&m[6]||g!=h&&m[7]||m[1];return i=a,l=s,c=r,u=o,d=p,h=g,f(n)})}}function Vn(e,t,n){return new Date(e,t,n)}function On(e,t){return t(e)}function $n(e,t){return(n,a,s,r)=>null==r?Fe:t(e(a))}qt(2,-53,53,[1]);const qn={show:!0,live:!0,isolate:!1,mount:()=>{},markers:{show:!0,width:2,stroke:function(e,t){let n=e.series[t];return n.width?n.stroke(e,t):n.points.width?n.points.stroke(e,t):null},fill:function(e,t){return e.series[t].fill(e,t)},dash:"solid"},idx:null,idxs:null,values:[]},Un=[0,0];function Wn(e,t,n,a=!0){return e=>{0==e.button&&(!a||e.target==t)&&n(e)}}function Hn(e,t,n,a=!0){return e=>{(!a||e.target==t)&&n(e)}}const Yn={show:!0,x:!0,y:!0,lock:!1,move:function(e,t,n){return Un[0]=t,Un[1]=n,Un},points:{one:!1,show:function(e,t){let n=e.cursor.points,a=Ie(),s=n.size(e,t);ze(a,he,s),ze(a,me,s);let r=s/-2;ze(a,"marginLeft",r),ze(a,"marginTop",r);let o=n.width(e,t,s);return o&&ze(a,"borderWidth",o),a},size:function(e,t){return e.series[t].points.size},width:0,stroke:function(e,t){let n=e.series[t].points;return n._stroke||n._fill},fill:function(e,t){let n=e.series[t].points;return n._fill||n._stroke}},bind:{mousedown:Wn,mouseup:Wn,click:Wn,dblclick:Wn,mousemove:Hn,mouseleave:Hn,mouseenter:Hn},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(e,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(e,t,n,a,s)=>a-s,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},Gn={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Kn=tn({},Gn,{filter:jt}),Xn=tn({},Kn,{size:10}),Jn=tn({},Gn,{show:!1}),Zn='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',Qn="bold "+Zn,ea={show:!0,scale:"x",stroke:be,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:Qn,side:2,grid:Kn,ticks:Xn,border:Jn,font:Zn,lineGap:1.5,rotate:0},ta={show:!0,scale:"x",auto:!1,sorted:1,min:At,max:-At,idxs:[]};function na(e,t,n,a,s){return t.map(e=>null==e?"":dt(e))}function aa(e,t,n,a,s,r,o){let i=[],l=Ot.get(s)||0;for(let c=n=o?n:Vt(_t(n,s),l);c<=a;c=Vt(c+s,l))i.push(Object.is(c,-0)?0:c);return i}function sa(e,t,n,a,s,r,o){const i=[],l=e.scales[e.axes[t].scale].log,c=gt((10==l?kt:xt)(n));s=wt(l,c),10==l&&(s=wn[Xe(s,wn)]);let u=n,d=s*l;10==l&&(d=wn[Xe(d,wn)]);do{i.push(u),u+=s,10!=l||Ot.has(u)||(u=Vt(u,Ot.get(s))),u>=d&&(d=(s=u)*l,10==l&&(d=wn[Xe(d,wn)]))}while(u<=a);return i}function ra(e,t,n,a,s,r,o){let i=e.scales[e.axes[t].scale].asinh,l=a>i?sa(e,t,vt(i,n),a,s):[i],c=a>=0&&n<=0?[0]:[];return(n<-i?sa(e,t,vt(i,-a),-n,s):[i]).reverse().map(e=>-e).concat(c,l)}const oa=/./,ia=/[12357]/,la=/[125]/,ca=/1/,ua=(e,t,n,a)=>e.map((e,s)=>4==t&&0==e||s%a==0&&n.test(e.toExponential()[e<0?1:0])?e:null);function da(e,t,n,a,s){let r=e.axes[n],o=r.scale,i=e.scales[o],l=e.valToPos,c=r._space,u=l(10,o),d=l(9,o)-u>=c?oa:l(7,o)-u>=c?ia:l(5,o)-u>=c?la:ca;if(d==ca){let e=pt(l(1,o)-u);if(es,ya={show:!0,auto:!0,sorted:0,gaps:fa,alpha:1,facets:[tn({},ga,{scale:"x"}),tn({},ga,{scale:"y"})]},ba={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:fa,alpha:1,points:{show:function(e,t){let{scale:n,idxs:a}=e.series[0],s=e._data[0],r=e.valToPos(s[a[0]],n,!0),o=e.valToPos(s[a[1]],n,!0),i=pt(o-r)/(e.series[t].points.space*Pe);return a[1]-a[0]<=i},filter:null},values:null,min:At,max:-At,idxs:[],path:null,clip:null};function va(e,t,n,a,s){return n/10}const wa={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},Ca=tn({},wa,{time:!1,ori:1}),ka={};function xa(e,t){let n=ka[e];return n||(n={key:e,plots:[],sub(e){n.plots.push(e)},unsub(e){n.plots=n.plots.filter(t=>t!=e)},pub(e,t,a,s,r,o,i){for(let l=0;l{let g=e.pxRound;const f=i.dir*(0==i.ori?1:-1),y=0==i.ori?La:Ra;let b,v;1==f?(b=n,v=a):(b=a,v=n);let w=g(c(t[b],i,m,d)),C=g(u(o[b],l,p,h)),k=g(c(t[v],i,m,d)),x=g(u(1==r?l.max:l.min,l,p,h)),D=new Path2D(s);return y(D,k,x),y(D,w,x),y(D,w,C),D})}function Fa(e,t,n,a,s,r){let o=null;if(e.length>0){o=new Path2D;const i=0==t?Na:za;let l=n;for(let t=0;tn[0]){let e=n[0]-l;e>0&&i(o,l,a,e,a+r),l=n[1]}}let c=n+s-l,u=10;c>0&&i(o,l,a-u/2,c,a+r+u)}return o}function Sa(e,t,n,a,s,r,o){let i=[],l=e.length;for(let c=1==s?n:a;c>=n&&c<=a;c+=s)if(null===t[c]){let u=c,d=c;if(1==s)for(;++c<=a&&null===t[c];)d=c;else for(;--c>=n&&null===t[c];)d=c;let h=r(e[u]),m=d==u?h:r(e[d]),p=u-s;h=o<=0&&p>=0&&p=0&&g>=0&&g=h&&i.push([h,m])}return i}function Ma(e){return 0==e?Mt:1==e?ft:t=>zt(t,e)}function ja(e){let t=0==e?Ta:Pa,n=0==e?(e,t,n,a,s,r)=>{e.arcTo(t,n,a,s,r)}:(e,t,n,a,s,r)=>{e.arcTo(n,t,s,a,r)},a=0==e?(e,t,n,a,s)=>{e.rect(t,n,a,s)}:(e,t,n,a,s)=>{e.rect(n,t,s,a)};return(e,s,r,o,i,l=0,c=0)=>{0==l&&0==c?a(e,s,r,o,i):(l=bt(l,o/2,i/2),c=bt(c,o/2,i/2),t(e,s+l,r),n(e,s+o,r,s+o,r+i,l),n(e,s+o,r+i,s,r+i,c),n(e,s,r+i,s,r,c),n(e,s,r,s+o,r,l),e.closePath())}}const Ta=(e,t,n)=>{e.moveTo(t,n)},Pa=(e,t,n)=>{e.moveTo(n,t)},La=(e,t,n)=>{e.lineTo(t,n)},Ra=(e,t,n)=>{e.lineTo(n,t)},Na=ja(0),za=ja(1),_a=(e,t,n,a,s,r)=>{e.arc(t,n,a,s,r)},Ia=(e,t,n,a,s,r)=>{e.arc(n,t,a,s,r)},Va=(e,t,n,a,s,r,o)=>{e.bezierCurveTo(t,n,a,s,r,o)},Oa=(e,t,n,a,s,r,o)=>{e.bezierCurveTo(n,t,s,a,o,r)};function $a(e){return(e,t,n,a,s)=>Da(e,t,(t,r,o,i,l,c,u,d,h,m,p)=>{let g,f,{pxRound:y,points:b}=t;0==i.ori?(g=Ta,f=_a):(g=Pa,f=Ia);const v=Vt(b.width*Pe,3);let w=(b.size-b.width)/2*Pe,C=Vt(2*w,3),k=new Path2D,x=new Path2D,{left:D,top:A,width:E,height:B}=e.bbox;Na(x,D-C,A-C,E+2*C,B+2*C);const F=e=>{if(null!=o[e]){let t=y(c(r[e],i,m,d)),n=y(u(o[e],l,p,h));g(k,t+w,n),f(k,t,n,w,0,2*mt)}};if(s)s.forEach(F);else for(let e=n;e<=a;e++)F(e);return{stroke:v>0?k:null,fill:k,clip:x,flags:3}})}function qa(e){return(t,n,a,s,r,o)=>{a!=s&&(r!=a&&o!=a&&e(t,n,a),r!=s&&o!=s&&e(t,n,s),e(t,n,o))}}const Ua=qa(La),Wa=qa(Ra);function Ha(e){const t=lt(null==e?void 0:e.alignGaps,0);return(e,n,a,s)=>Da(e,n,(r,o,i,l,c,u,d,h,m,p,g)=>{[a,s]=et(i,a,s);let f,y,b=r.pxRound,v=e=>b(u(e,l,p,h)),w=e=>b(d(e,c,g,m));0==l.ori?(f=La,y=Ua):(f=Ra,y=Wa);const C=l.dir*(0==l.ori?1:-1),k={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},x=k.stroke;let D=!1;if(s-a>=4*p){let t,n,r,c=t=>e.posToVal(t,l.key,!0),u=null,d=null,h=v(o[1==C?a:s]),m=v(o[a]),p=v(o[s]),g=c(1==C?m+1:p-1);for(let e=1==C?a:s;e>=a&&e<=s;e+=C){let a=o[e],s=(1==C?ag)?h:v(a),r=i[e];s==h?null!=r?(n=r,null==u?(f(x,s,w(n)),t=u=d=n):nd&&(d=n)):null===r&&(D=!0):(null!=u&&y(x,h,w(u),w(d),w(t),w(n)),null!=r?(n=r,f(x,s,w(n)),u=d=t=n):(u=d=null,null===r&&(D=!0)),h=s,g=c(h+C))}null!=u&&u!=d&&r!=h&&y(x,h,w(u),w(d),w(t),w(n))}else for(let e=1==C?a:s;e>=a&&e<=s;e+=C){let t=i[e];null===t?D=!0:null!=t&&f(x,v(o[e]),w(t))}let[A,E]=Aa(e,n);if(null!=r.fill||0!=A){let t=k.fill=new Path2D(x),i=w(r.fillTo(e,n,r.min,r.max,A)),l=v(o[a]),c=v(o[s]);-1==C&&([c,l]=[l,c]),f(t,c,i),f(t,l,i)}if(!r.spanGaps){let c=[];D&&c.push(...Sa(o,i,a,s,C,v,t)),k.gaps=c=r.gaps(e,n,a,s,c),k.clip=Fa(c,l.ori,h,m,p,g)}return 0!=E&&(k.band=2==E?[Ba(e,n,a,s,x,-1),Ba(e,n,a,s,x,1)]:Ba(e,n,a,s,x,E)),k})}function Ya(e,t,n,a,s,r,o=At){if(e.length>1){let i=null;for(let l=0,c=1/0;l0!=a[e]>0?n[e]=0:(n[e]=3*(l[e-1]+l[e])/((2*l[e]+l[e-1])/a[e-1]+(l[e]+2*l[e-1])/a[e]),isFinite(n[e])||(n[e]=0));n[o-1]=a[o-2];for(let c=0;c{us.pxRatio=Pe}));const Ja=Ha(),Za=$a();function Qa(e,t,n,a){return(a?[e[0],e[1]].concat(e.slice(2)):[e[0]].concat(e.slice(1))).map((e,a)=>es(e,a,t,n))}function es(e,t,n,a){return tn({},0==t?n:a,e)}function ts(e,t,n){return null==t?Ht:[t,n]}const ns=ts;function as(e,t,n){return null==t?Ht:it(t,n,.1,!0)}function ss(e,t,n,a){return null==t?Ht:nt(t,n,e.scales[a].log,!1)}const rs=ss;function os(e,t,n,a){return null==t?Ht:at(t,n,e.scales[a].log,!1)}const is=os;function ls(e){let t,n;return[e=e.replace(/(\d+)px/,(e,a)=>(t=ft((n=+a)*Pe))+"px"),t,n]}function cs(e){e.show&&[e.font,e.labelFont].forEach(e=>{let t=Vt(e[2]*Pe,1);e[0]=e[0].replace(/[0-9.]+px/,t+"px"),e[1]=t})}function us(e,t,n){const a={mode:lt(e.mode,1)},s=a.mode;function r(e,t,n,a){let s=t.valToPct(e);return a+n*(-1==t.dir?1-s:s)}function o(e,t,n,a){let s=t.valToPct(e);return a+n*(-1==t.dir?s:1-s)}function i(e,t,n,a){return 0==t.ori?r(e,t,n,a):o(e,t,n,a)}a.valToPosH=r,a.valToPosV=o;let l=!1;a.status=0;const c=a.root=Ie("uplot");null!=e.id&&(c.id=e.id),Re(c,e.class),e.title&&(Ie("u-title",c).textContent=e.title);const u=_e("canvas"),d=a.ctx=u.getContext("2d"),h=Ie("u-wrap",c);Ge("click",h,e=>{e.target===p&&(Fa!=ka||Sa!=Da)&&Ia.click(a,e)},!0);const m=a.under=Ie("u-under",h);h.appendChild(u);const p=a.over=Ie("u-over",h),g=+lt((e=en(e)).pxAlign,1),f=Ma(g);(e.plugins||[]).forEach(t=>{t.opts&&(e=t.opts(a,e)||e)});const y=e.ms||.001,b=a.series=1==s?Qa(e.series||[],ta,ba,!1):(v=e.series||[null],w=ya,v.map((e,t)=>0==t?{}:tn({},w,e)));var v,w;const C=a.axes=Qa(e.axes||[],ea,pa,!0),k=a.scales={},x=a.bands=e.bands||[];x.forEach(e=>{e.fill=St(e.fill||null),e.dir=lt(e.dir,-1)});const D=2==s?b[1].facets[0].scale:b[0].scale,A={axes:function(){for(let e=0;eAn[e]):y,v=2==m.distr?An[y[1]]-An[y[0]]:u,w=t.ticks,x=t.border,D=w.show?w.size:0,A=ft(D*Pe),E=ft((2==t.alignTo?t._size-D-t.gap:t.gap)*Pe),B=t._rotate*-mt/180,F=f(t._pos*Pe),S=F+(A+E)*c;s=0==o?S:0,n=1==o?S:0,Mn(t.font[0],l,1==t.align?fe:2==t.align?ye:B>0?fe:B<0?ye:0==o?"center":3==r?ye:fe,B||1==o?"middle":2==r?pe:ge);let M=t.font[1]*t.lineGap,j=y.map(e=>f(i(e,m,p,g))),T=t._values;for(let e=0;e0){let e=b.some(e=>e._focus)&&Dn!=Rt.alpha;e&&(d.globalAlpha=Dn=Rt.alpha),b.forEach((e,n)=>{if(n>0&&e.show&&(Un(n,!1),Un(n,!0),null==e._paths)){let r=Dn;Dn!=e.alpha&&(d.globalAlpha=Dn=e.alpha);let o=2==s?[0,t[n][0].length-1]:function(e){let t=Bt(cn-1,0,ln-1),n=Bt(un+1,0,ln-1);for(;null==e[t]&&t>0;)t--;for(;null==e[n]&&n{if(t>0&&e.show){let n=Dn;Dn!=e.alpha&&(d.globalAlpha=Dn=e.alpha),null!=e._paths&&Wn(t,!1);{let n=null!=e._paths?e._paths.gaps:null,s=e.points.show(a,t,cn,un,n),r=e.points.filter(a,t,s,n);(s||r)&&(e.points._paths=e.points.paths(a,t,cn,un,r),Wn(t,!0))}Dn!=n&&(d.globalAlpha=Dn=n),Rs("drawSeries",t)}}),e&&(d.globalAlpha=Dn=1)}}},E=(e.drawOrder||["axes","series"]).map(e=>A[e]);function B(e){const t=3==e.distr?t=>kt(t>0?t:e.clamp(a,t,e.min,e.max,e.key)):4==e.distr?t=>Dt(t,e.asinh):100==e.distr?t=>e.fwd(t):e=>e;return n=>{let a=t(n),{_min:s,_max:r}=e;return(a-s)/(r-s)}}function F(t){let n=k[t];if(null==n){let a=(e.scales||Ut)[t]||Ut;if(null!=a.from){F(a.from);let e=tn({},k[a.from],a,{key:t});e.valToPct=B(e),k[t]=e}else{n=k[t]=tn({},t==D?wa:Ca,a),n.key=t;let e=n.time,r=n.range,o=Yt(r);if((t!=D||2==s&&!e)&&(!o||null!=r[0]&&null!=r[1]||(r={min:null==r[0]?st:{mode:1,hard:r[0],soft:r[0]},max:null==r[1]?st:{mode:1,hard:r[1],soft:r[1]}},o=!1),!o&&Xt(r))){let e=r;r=(t,n,a)=>null==n?Ht:it(n,a,e)}n.range=St(r||(e?ns:t==D?3==n.distr?rs:4==n.distr?is:ts:3==n.distr?ss:4==n.distr?os:as)),n.auto=St(!o&&n.auto),n.clamp=St(n.clamp||va),n._min=n._max=null,n.valToPct=B(n)}}}F("x"),F("y"),1==s&&b.forEach(e=>{F(e.scale)}),C.forEach(e=>{F(e.scale)});for(let ue in e.scales)F(ue);const S=k[D],M=S.distr;let j,T;0==S.ori?(Re(c,"u-hz"),j=r,T=o):(Re(c,"u-vt"),j=o,T=r);const P={};for(let ue in k){let e=k[ue];null==e.min&&null==e.max||(P[ue]={min:e.min,max:e.max},e.min=e.max=null)}const L=e.tzDate||(e=>new Date(ft(e/y))),R=e.fmtDate||mn,N=1==y?Ln(L):zn(L),z=In(L,_n(1==y?Pn:Nn,R)),_=$n(L,On("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",R)),I=[],V=a.legend=tn({},qn,e.legend),O=a.cursor=tn({},Yn,{drag:{y:2==s}},e.cursor),$=V.show,q=O.show,U=V.markers;let W,H,Y;V.idxs=I,U.width=St(U.width),U.dash=St(U.dash),U.stroke=St(U.stroke),U.fill=St(U.fill);let G,K=[],X=[],J=!1,Z={};if(V.live){const e=b[1]?b[1].values:null;J=null!=e,G=J?e(a,1,0):{_:0};for(let t in G)Z[t]=Fe}if($)if(W=_e("table","u-legend",c),Y=_e("tbody",null,W),V.mount(a,W),J){H=_e("thead",null,W,Y);let e=_e("tr",null,H);for(var Q in _e("th",null,e),G)_e("th",de,e).textContent=Q}else Re(W,"u-inline"),V.live&&Re(W,"u-live");const ee={show:!0},te={show:!1},ne=new Map;function ae(e,t,n,s=!0){const r=ne.get(t)||{},o=O.bind[e](a,t,n,s);o&&(Ge(e,t,r[e]=o),ne.set(t,r))}function se(e,t,n){const a=ne.get(t)||{};for(let s in a)null!=e&&s!=e||(Ke(s,t,a[s]),delete a[s]);null==e&&ne.delete(t)}let re=0,oe=0,ie=0,le=0,ce=0,be=0,Ee=ce,Se=be,Te=ie,Le=le,Ve=0,$e=0,Ue=0,He=0;a.bbox={};let Ye=!1,Je=!1,rt=!1,ot=!1,ct=!1,ut=!1;function dt(e,t,n){(n||e!=a.width||t!=a.height)&>(e,t),oa(!1),rt=!0,Je=!0,Ra()}function gt(e,t){a.width=re=ie=e,a.height=oe=le=t,ce=be=0,function(){let e=!1,t=!1,n=!1,a=!1;C.forEach((s,r)=>{if(s.show&&s._show){let{side:r,_size:o}=s,i=r%2,l=o+(null!=s.label?s.labelSize:0);l>0&&(i?(ie-=l,3==r?(ce+=l,a=!0):n=!0):(le-=l,0==r?(be+=l,e=!0):t=!0))}}),nn[0]=e,nn[1]=n,nn[2]=t,nn[3]=a,ie-=on[1]+on[3],ce+=on[3],le-=on[2]+on[0],be+=on[0]}(),function(){let e=ce+ie,t=be+le,n=ce,a=be;function s(s,r){switch(s){case 1:return e+=r,e-r;case 2:return t+=r,t-r;case 3:return n-=r,n+r;case 0:return a-=r,a+r}}C.forEach((e,t)=>{if(e.show&&e._show){let t=e.side;e._pos=s(t,e._size),null!=e.label&&(e._lpos=s(t,e.labelSize))}})}();let n=a.bbox;Ve=n.left=zt(ce*Pe,.5),$e=n.top=zt(be*Pe,.5),Ue=n.width=zt(ie*Pe,.5),He=n.height=zt(le*Pe,.5)}const Ct=3;if(a.setSize=function({width:e,height:t}){dt(e,t)},null==O.dataIdx){let e=O.hover,n=e.skip=new Set(e.skip??[]);n.add(void 0);let a=e.prox=St(e.prox),s=e.bias??(e.bias=0);O.dataIdx=(e,r,o,i)=>{if(0==r)return o;let l=o,c=a(e,r,o,i)??At,u=c>=0&&c0;)n.has(p[e])||(t=e);if(0==s||1==s)for(e=o;null==a&&e++c&&(l=null);return l}}const xt=e=>{O.event=e};O.idxs=I,O._lock=!1;let Mt=O.points;Mt.show=St(Mt.show),Mt.size=St(Mt.size),Mt.stroke=St(Mt.stroke),Mt.width=St(Mt.width),Mt.fill=St(Mt.fill);const Rt=a.focus=tn({},e.focus||{alpha:.3},O.focus),Nt=Rt.prox>=0,_t=Nt&&Mt.one;let It=[],qt=[],Gt=[];function Zt(e,t){let n=Mt.show(a,t);if(n instanceof HTMLElement)return Re(n,"u-cursor-pt"),Re(n,e.class),Oe(n,-10,-10,ie,le),p.insertBefore(n,It[t]),n}function Qt(e,t){if(1==s||t>0){let t=1==s&&k[e.scale].time,n=e.value;e.value=t?Kt(n)?$n(L,On(n,R)):n||_:n||ma,e.label=e.label||(t?"Time":"Value")}if(_t||t>0){e.width=null==e.width?1:e.width,e.paths=e.paths||Ja||Tt,e.fillTo=St(e.fillTo||Ea),e.pxAlign=+lt(e.pxAlign,g),e.pxRound=Ma(e.pxAlign),e.stroke=St(e.stroke||null),e.fill=St(e.fill||null),e._stroke=e._fill=e._paths=e._focus=null;let t=Vt(1*(3+2*(vt(1,e.width)||1)),3),n=e.points=tn({},{size:t,width:vt(1,.2*t),stroke:e.stroke,space:2*t,paths:Za,_stroke:null,_fill:null},e.points);n.show=St(n.show),n.filter=St(n.filter),n.fill=St(n.fill),n.stroke=St(n.stroke),n.paths=St(n.paths),n.pxAlign=e.pxAlign}if($){let n=function(e,t){if(0==t&&(J||!V.live||2==s))return Ht;let n=[],r=_e("tr","u-series",Y,Y.childNodes[t]);Re(r,e.class),e.show||Re(r,ue);let o=_e("th",null,r);if(U.show){let e=Ie("u-marker",o);if(t>0){let n=U.width(a,t);n&&(e.style.border=n+"px "+U.dash(a,t)+" "+U.stroke(a,t)),e.style.background=U.fill(a,t)}}let i=Ie(de,o);for(var l in e.label instanceof HTMLElement?i.appendChild(e.label):i.textContent=e.label,t>0&&(U.show||(i.style.color=e.width>0?U.stroke(a,t):U.fill(a,t)),ae("click",o,t=>{if(O._lock)return;xt(t);let n=b.indexOf(e);if((t.ctrlKey||t.metaKey)!=V.isolate){let e=b.some((e,t)=>t>0&&t!=n&&e.show);b.forEach((t,a)=>{a>0&&Ha(a,e?a==n?ee:te:ee,!0,zs.setSeries)})}else Ha(n,{show:!e.show},!0,zs.setSeries)},!1),Nt&&ae(xe,o,t=>{O._lock||(xt(t),Ha(b.indexOf(e),us,!0,zs.setSeries))},!1)),G){let e=_e("td","u-value",r);e.textContent="--",n.push(e)}return[r,n]}(e,t);K.splice(t,0,n[0]),X.splice(t,0,n[1]),V.values.push(null)}if(q){I.splice(t,0,null);let n=null;_t?0==t&&(n=Zt(e,t)):t>0&&(n=Zt(e,t)),It.splice(t,0,n),qt.splice(t,0,0),Gt.splice(t,0,0)}Rs("addSeries",t)}a.addSeries=function(e,t){t=null==t?b.length:t,e=1==s?es(e,t,ta,ba):es(e,t,{},ya),b.splice(t,0,e),Qt(b[t],t)},a.delSeries=function(e){if(b.splice(e,1),$){V.values.splice(e,1),X.splice(e,1);let t=K.splice(e,1)[0];se(null,t.firstChild),t.remove()}q&&(I.splice(e,1),It.splice(e,1)[0].remove(),qt.splice(e,1),Gt.splice(e,1)),Rs("delSeries",e)};const nn=[!1,!1,!1,!1];function sn(e,t,n,a){let[s,r,o,i]=n,l=t%2,c=0;return 0==l&&(i||r)&&(c=0==t&&!s||2==t&&!o?ft(ea.size/3):0),1==l&&(s||o)&&(c=1==t&&!r||3==t&&!i?ft(pa.size/2):0),c}const rn=a.padding=(e.padding||[sn,sn,sn,sn]).map(e=>St(lt(e,sn))),on=a._padding=rn.map((e,t)=>e(a,t,nn,0));let ln,cn=null,un=null;const dn=1==s?b[0].idxs:null;let hn,pn,gn,fn,yn,bn,Cn,kn,xn,Dn,An=null,En=!1;function Bn(e,n){if(t=null==e?[]:e,a.data=a._data=t,2==s){ln=0;for(let e=1;e=0,ut=!0,Ra()}}function Fn(){let e,n;En=!0,1==s&&(ln>0?(cn=dn[0]=0,un=dn[1]=ln-1,e=t[0][cn],n=t[0][un],2==M?(e=cn,n=un):e==n&&(3==M?[e,n]=nt(e,e,S.log,!1):4==M?[e,n]=at(e,e,S.log,!1):S.time?n=e+ft(86400/y):[e,n]=it(e,n,.1,!0))):(cn=dn[0]=e=null,un=dn[1]=n=null)),Wa(D,e,n)}function Sn(e,t,n,a,s,r){e??(e=ve),n??(n=Wt),a??(a="butt"),s??(s=ve),r??(r="round"),e!=hn&&(d.strokeStyle=hn=e),s!=pn&&(d.fillStyle=pn=s),t!=gn&&(d.lineWidth=gn=t),r!=yn&&(d.lineJoin=yn=r),a!=bn&&(d.lineCap=bn=a),n!=fn&&d.setLineDash(fn=n)}function Mn(e,t,n,a){t!=pn&&(d.fillStyle=pn=t),e!=Cn&&(d.font=Cn=e),n!=kn&&(d.textAlign=kn=n),a!=xn&&(d.textBaseline=xn=a)}function jn(e,t,n,s,r=0){if(s.length>0&&e.auto(a,En)&&(null==t||null==t.min)){let t=lt(cn,0),a=lt(un,s.length-1),o=null==n.min?function(e,t,n,a=0,s=!1){let r=s?tt:et,o=s?Qe:Ze;[t,n]=r(e,t,n);let i=e[t],l=e[t];if(t>-1)if(1==a)i=e[t],l=e[n];else if(-1==a)i=e[n],l=e[t];else for(let c=t;c<=n;c++){let t=e[c];o(t)&&(tl&&(l=t))}return[i??At,l??-At]}(s,t,a,r,3==e.distr):[n.min,n.max];e.min=bt(e.min,n.min=o[0]),e.max=vt(e.max,n.max=o[1])}}a.setData=Bn;const Vn={min:null,max:null};function Un(e,t){let n=t?b[e].points:b[e];n._stroke=n.stroke(a,e),n._fill=n.fill(a,e)}function Wn(e,n){let s=n?b[e].points:b[e],{stroke:r,fill:o,clip:i,flags:l,_stroke:c=s._stroke,_fill:u=s._fill,_width:h=s.width}=s._paths;h=Vt(h*Pe,3);let m=null,p=h%2/2;n&&null==u&&(u=h>0?"#fff":c);let g=1==s.pxAlign&&p>0;if(g&&d.translate(p,p),!n){let e=Ve-h/2,t=$e-h/2,n=Ue+h,a=He+h;m=new Path2D,m.rect(e,t,n,a)}n?Gn(c,h,s.dash,s.cap,u,r,o,l,i):function(e,n,s,r,o,i,l,c,u,d,h){let m=!1;0!=u&&x.forEach((p,g)=>{if(p.series[0]==e){let e,f=b[p.series[1]],y=t[p.series[1]],v=(f._paths||Ut).band;Yt(v)&&(v=1==p.dir?v[0]:v[1]);let w=null;f.show&&v&&function(e,t,n){for(t=lt(t,0),n=lt(n,e.length-1);t<=n;){if(null!=e[t])return!0;t++}return!1}(y,cn,un)?(w=p.fill(a,g)||i,e=f._paths.clip):v=null,Gn(n,s,r,o,w,l,c,u,d,h,e,v),m=!0}}),m||Gn(n,s,r,o,i,l,c,u,d,h)}(e,c,h,s.dash,s.cap,u,r,o,l,m,i),g&&d.translate(-p,-p)}const Hn=3;function Gn(e,t,n,a,s,r,o,i,l,c,u,h){Sn(e,t,n,a,s),(l||c||h)&&(d.save(),l&&d.clip(l),c&&d.clip(c)),h?(i&Hn)==Hn?(d.clip(h),u&&d.clip(u),Xn(s,o),Kn(e,r,t)):2&i?(Xn(s,o),d.clip(h),Kn(e,r,t)):1&i&&(d.save(),d.clip(h),u&&d.clip(u),Xn(s,o),d.restore(),Kn(e,r,t)):(Xn(s,o),Kn(e,r,t)),(l||c||h)&&d.restore()}function Kn(e,t,n){n>0&&(t instanceof Map?t.forEach((e,t)=>{d.strokeStyle=hn=t,d.stroke(e)}):null!=t&&e&&d.stroke(t))}function Xn(e,t){t instanceof Map?t.forEach((e,t)=>{d.fillStyle=pn=t,d.fill(e)}):null!=t&&e&&d.fill(t)}function Jn(e,t,n,a,s,r,o,i,l,c){let u=o%2/2;1==g&&d.translate(u,u),Sn(i,o,l,c,i),d.beginPath();let h,m,p,f,y=s+(0==a||3==a?-r:r);0==n?(m=s,f=y):(h=s,p=y);for(let g=0;g{if(!n.show)return;let r=k[n.scale];if(null==r.min)return void(n._show&&(t=!1,n._show=!1,oa(!1)));n._show||(t=!1,n._show=!0,oa(!1));let o=n.side,i=o%2,{min:l,max:c}=r,[u,d]=function(e,t,n,s){let r,o=C[e];if(s<=0)r=[0,0];else{let i=o._space=o.space(a,e,t,n,s);r=function(e,t,n,a,s){let r=vt(Et(e),Et(t)),o=t-e,i=Xe(s/a*o,n);do{let e=n[i],t=a*e/o;if(t>=s&&r+(e<5?Ot.get(e):0)<=17)return[e,t]}while(++iAn[e]):m,g=2==r.distr?An[m[1]]-An[m[0]]:u,f=n._values=n.values(a,n.filter(a,p,s,d,g),s,d,g);n._rotate=2==o?n.rotate(a,f,s,d):0;let y=n._size;n._size=yt(n.size(a,f,s,e)),null!=y&&n._size!=y&&(t=!1)}),t}function Qn(e){let t=!0;return rn.forEach((n,s)=>{let r=n(a,s,nn,e);r!=on[s]&&(t=!1),on[s]=r}),t}function oa(e){b.forEach((t,n)=>{n>0&&(t._paths=null,e&&(1==s?(t.min=null,t.max=null):t.facets.forEach(e=>{e.min=null,e.max=null})))})}let ia,la,ca,ua,ga,fa,ka,Da,Aa,Ba,Fa,Sa,ja=!1,Ta=!1,Pa=[];function La(){Ta=!1;for(let e=0;e0){b.forEach((n,r)=>{if(1==s){let s=n.scale,o=P[s];if(null==o)return;let i=e[s];if(0==r){let e=i.range(a,i.min,i.max,s);i.min=e[0],i.max=e[1],cn=Xe(i.min,t[0]),un=Xe(i.max,t[0]),un-cn>1&&(t[0][cn]i.max&&un--),n.min=An[cn],n.max=An[un]}else n.show&&n.auto&&jn(i,o,n,t[r],n.sorted);n.idxs[0]=cn,n.idxs[1]=un}else if(r>0&&n.show&&n.auto){let[a,s]=n.facets,o=a.scale,i=s.scale,[l,c]=t[r],u=e[o],d=e[i];null!=u&&jn(u,P[o],a,l,a.sorted),null!=d&&jn(d,P[i],s,c,s.sorted),n.min=s.min,n.max=s.max}});for(let t in e){let n=e[t],s=P[t];if(null==n.from&&(null==s||null==s.min)){let e=n.range(a,n.min==At?null:n.min,n.max==-At?null:n.max,t);n.min=e[0],n.max=e[1]}}}for(let t in e){let n=e[t];if(null!=n.from){let s=e[n.from];if(null==s.min)n.min=n.max=null;else{let e=n.range(a,s.min,s.max,t);n.min=e[0],n.max=e[1]}}}let n={},r=!1;for(let t in e){let a=e[t],s=k[t];if(s.min!=a.min||s.max!=a.max){s.min=a.min,s.max=a.max;let e=s.distr;s._min=3==e?kt(s.min):4==e?Dt(s.min,s.asinh):100==e?s.fwd(s.min):s.min,s._max=3==e?kt(s.max):4==e?Dt(s.max,s.asinh):100==e?s.fwd(s.max):s.max,n[t]=r=!0}}if(r){b.forEach((e,t)=>{2==s?t>0&&n.y&&(e._paths=null):n[e.scale]&&(e._paths=null)});for(let e in n)rt=!0,Rs("setScale",e);q&&O.left>=0&&(ot=ut=!0)}for(let t in P)P[t]=null}(),Ye=!1),rt&&(function(){let e=!1,t=0;for(;!e;){t++;let n=Zn(t),s=Qn(t);e=t==Ct||n&&s,e||(gt(a.width,a.height),Je=!0)}}(),rt=!1),Je){if(ze(m,fe,ce),ze(m,pe,be),ze(m,he,ie),ze(m,me,le),ze(p,fe,ce),ze(p,pe,be),ze(p,he,ie),ze(p,me,le),ze(h,he,re),ze(h,me,oe),u.width=ft(re*Pe),u.height=ft(oe*Pe),C.forEach(({_el:e,_show:t,_size:n,_pos:a,side:s})=>{if(null!=e)if(t){let t=s%2==1;ze(e,t?"left":"top",a-(3===s||0===s?n:0)),ze(e,t?"width":"height",n),ze(e,t?"top":"left",t?be:ce),ze(e,t?"height":"width",t?le:ie),Ne(e,ue)}else Re(e,ue)}),hn=pn=gn=yn=bn=Cn=kn=xn=fn=null,Dn=1,ws(!0),ce!=Ee||be!=Se||ie!=Te||le!=Le){oa(!1);let e=ie/Te,t=le/Le;if(q&&!ot&&O.left>=0){O.left*=e,O.top*=t,ca&&Oe(ca,ft(O.left),0,ie,le),ua&&Oe(ua,0,ft(O.top),ie,le);for(let n=0;n=0&&$a.width>0){$a.left*=e,$a.width*=e,$a.top*=t,$a.height*=t;for(let e in xs)ze(qa,e,$a[e])}Ee=ce,Se=be,Te=ie,Le=le}Rs("setSize"),Je=!1}re>0&&oe>0&&(d.clearRect(0,0,u.width,u.height),Rs("drawClear"),E.forEach(e=>e()),Rs("draw")),$a.show&&ct&&(Ua($a),ct=!1),q&&ot&&(bs(null,!0,!1),ot=!1),V.show&&V.live&&ut&&(fs(),ut=!1),l||(l=!0,a.status=1,Rs("ready")),En=!1,ja=!1}function za(e,n){let s=k[e];if(null==s.from){if(0==ln){let t=s.range(a,n.min,n.max,e);n.min=t[0],n.max=t[1]}if(n.min>n.max){let e=n.min;n.min=n.max,n.max=e}if(ln>1&&null!=n.min&&null!=n.max&&n.max-n.min<1e-16)return;e==D&&2==s.distr&&ln>0&&(n.min=Xe(n.min,t[0]),n.max=Xe(n.max,t[0]),n.min==n.max&&n.max++),P[e]=n,Ye=!0,Ra()}}a.batch=function(e,t=!1){ja=!0,Ta=t,e(a),Na(),t&&Pa.length>0&&queueMicrotask(La)},a.redraw=(e,t)=>{rt=t||!1,!1!==e?Wa(D,S.min,S.max):Ra()},a.setScale=za;let _a=!1;const Ia=O.drag;let Va=Ia.x,Oa=Ia.y;q&&(O.x&&(ia=Ie("u-cursor-x",p)),O.y&&(la=Ie("u-cursor-y",p)),0==S.ori?(ca=ia,ua=la):(ca=la,ua=ia),Fa=O.left,Sa=O.top);const $a=a.select=tn({show:!0,over:!0,left:0,width:0,top:0,height:0},e.select),qa=$a.show?Ie("u-select",$a.over?p:m):null;function Ua(e,t){if($a.show){for(let t in e)$a[t]=e[t],t in xs&&ze(qa,t,e[t]);!1!==t&&Rs("setSelect")}}function Wa(e,t,n){za(e,{min:t,max:n})}function Ha(e,t,n,r){null!=t.focus&&function(e){if(e!=Xa){let t=null==e,n=1!=Rt.alpha;b.forEach((a,r)=>{if(1==s||r>0){let s=t||0==r||r==e;a._focus=t?null:s,n&&function(e,t){b[e].alpha=t,q&&null!=It[e]&&(It[e].style.opacity=t),$&&K[e]&&(K[e].style.opacity=t)}(r,s?1:Rt.alpha)}}),Xa=e,n&&Ra()}}(e),null!=t.show&&b.forEach((n,a)=>{a>0&&(e==a||null==e)&&(n.show=t.show,function(e){if(b[e].show)$&&Ne(K[e],ue);else if($&&Re(K[e],ue),q){let t=_t?It[0]:It[e];null!=t&&Oe(t,-10,-10,ie,le)}}(a),2==s?(Wa(n.facets[0].scale,null,null),Wa(n.facets[1].scale,null,null)):Wa(n.scale,null,null),Ra())}),!1!==n&&Rs("setSeries",e,t),r&&Vs("setSeries",a,e,t)}let Ya,Ga,Xa;a.setSelect=Ua,a.setSeries=Ha,a.addBand=function(e,t){e.fill=St(e.fill||null),e.dir=lt(e.dir,-1),t=null==t?x.length:t,x.splice(t,0,e)},a.setBand=function(e,t){tn(x[e],t)},a.delBand=function(e){null==e?x.length=0:x.splice(e,1)};const us={focus:!0};function ds(e,t,n){let a=k[t];n&&(e=e/Pe-(1==a.ori?be:ce));let s=ie;1==a.ori&&(s=le,e=s-e),-1==a.dir&&(e=s-e);let r=a._min,o=r+(a._max-r)*(e/s),i=a.distr;return 3==i?wt(10,o):4==i?((e,t=1)=>ht.sinh(e)*t)(o,a.asinh):100==i?a.bwd(o):o}function hs(e,t){ze(qa,fe,$a.left=e),ze(qa,he,$a.width=t)}function ms(e,t){ze(qa,pe,$a.top=e),ze(qa,me,$a.height=t)}$&&Nt&&ae(De,W,e=>{O._lock||(xt(e),null!=Xa&&Ha(null,us,!0,zs.setSeries))}),a.valToIdx=e=>Xe(e,t[0]),a.posToIdx=function(e,n){return Xe(ds(e,D,n),t[0],cn,un)},a.posToVal=ds,a.valToPos=(e,t,n)=>0==k[t].ori?r(e,k[t],n?Ue:ie,n?Ve:0):o(e,k[t],n?He:le,n?$e:0),a.setCursor=(e,t,n)=>{Fa=e.left,Sa=e.top,bs(null,t,n)};let ps=0==S.ori?hs:ms,gs=1==S.ori?hs:ms;function fs(e,t){if(null!=e&&(e.idxs?e.idxs.forEach((e,t)=>{I[t]=e}):void 0!==e.idx&&I.fill(e.idx),V.idx=I[0]),$&&V.live){for(let e=0;e0||1==s&&!J)&&ys(e,I[e]);!function(){if($&&V.live)for(let e=2==s?1:0;eun;Ya=At,Ga=null;let l=0==S.ori?ie:le,c=1==S.ori?ie:le;if(Fa<0||0==ln||i){o=O.idx=null;for(let e=0;e0&&e.show){let n=null==w?-10:w==o?r:j(1==s?t[0][w]:t[f][0][w],S,l,0),y=null==C?-10:T(C,1==s?k[e.scale]:k[e.facets[1].scale],c,0);if(Nt&&null!=C){let t=1==S.ori?Fa:Sa,n=pt(Rt.dist(a,f,w,y,t));if(n=0?1:-1;r==(C>=0?1:-1)&&(1==r?1==a?C>=s:C<=s:1==a?C<=s:C>=s)&&(Ya=n,Ga=f)}else Ya=n,Ga=f}}if(ut||_t){let e,t;0==S.ori?(e=n,t=y):(e=y,t=n);let s,r,o,l,c,b,v=!0,w=Mt.bbox;if(null!=w){v=!1;let e=w(a,f);o=e.left,l=e.top,s=e.width,r=e.height}else o=e,l=t,s=r=Mt.size(a,f);if(b=Mt.fill(a,f),c=Mt.stroke(a,f),_t)f==Ga&&Ya<=Rt.prox&&(i=o,u=l,d=s,h=r,m=v,p=b,g=c);else{let e=It[f];null!=e&&(qt[f]=o,Gt[f]=l,We(e,s,r,v),qe(e,b,c),Oe(e,yt(o),yt(l),ie,le))}}}}if(_t){let e=Rt.prox;if(ut||(null==Xa?Ya<=e:Ya>e||Ga!=Xa)){let e=It[0];null!=e&&(qt[0]=i,Gt[0]=u,We(e,d,h,m),qe(e,p,g),Oe(e,yt(i),yt(u),ie,le))}}}if($a.show&&_a)if(null!=e){let[t,n]=zs.scales,[a,s]=zs.match,[r,o]=e.cursor.sync.scales,i=e.cursor.drag;if(Va=i._x,Oa=i._y,Va||Oa){let i,u,d,h,m,{left:p,top:g,width:f,height:y}=e.select,b=e.scales[r].ori,v=e.posToVal,w=null!=t&&a(t,r),C=null!=n&&s(n,o);w&&Va?(0==b?(i=p,u=f):(i=g,u=y),d=k[t],h=j(v(i,r),d,l,0),m=j(v(i+u,r),d,l,0),ps(bt(h,m),pt(m-h))):ps(0,l),C&&Oa?(1==b?(i=p,u=f):(i=g,u=y),d=k[n],h=T(v(i,o),d,c,0),m=T(v(i+u,o),d,c,0),gs(bt(h,m),pt(m-h))):gs(0,c)}else Ds()}else{let e=pt(Aa-ga),t=pt(Ba-fa);if(1==S.ori){let n=e;e=t,t=n}Va=Ia.x&&e>=Ia.dist,Oa=Ia.y&&t>=Ia.dist;let n,a,s=Ia.uni;null!=s?Va&&Oa&&(Va=e>=s,Oa=t>=s,Va||Oa||(t>e?Oa=!0:Va=!0)):Ia.x&&Ia.y&&(Va||Oa)&&(Va=Oa=!0),Va&&(0==S.ori?(n=ka,a=Fa):(n=Da,a=Sa),ps(bt(n,a),pt(a-n)),Oa||gs(0,c)),Oa&&(1==S.ori?(n=ka,a=Fa):(n=Da,a=Sa),gs(bt(n,a),pt(a-n)),Va||ps(0,l)),Va||Oa||(ps(0,0),gs(0,0))}if(Ia._x=Va,Ia._y=Oa,null==e){if(r){if(null!=_s){let[e,t]=zs.scales;zs.values[0]=null!=e?ds(0==S.ori?Fa:Sa,e):null,zs.values[1]=null!=t?ds(1==S.ori?Fa:Sa,t):null}Vs(we,a,Fa,Sa,ie,le,o)}if(Nt){let e=r&&zs.setSeries,t=Rt.prox;null==Xa?Ya<=t&&Ha(Ga,us,!0,e):Ya>t?Ha(null,us,!0,e):Ga!=Xa&&Ha(Ga,us,!0,e)}}ut&&(V.idx=o,fs()),!1!==n&&Rs("setCursor")}a.setLegend=fs;let vs=null;function ws(e=!1){e?vs=null:(vs=p.getBoundingClientRect(),Rs("syncRect",vs))}function Cs(e,t,n,a,s,r,o){O._lock||_a&&null!=e&&0==e.movementX&&0==e.movementY||(ks(e,t,n,a,s,r,0,!1,null!=e),null!=e?bs(null,!0,!0):bs(t,!0,!1))}function ks(e,t,n,s,r,o,l,c,u){if(null==vs&&ws(!1),xt(e),null!=e)n=e.clientX-vs.left,s=e.clientY-vs.top;else{if(n<0||s<0)return Fa=-10,void(Sa=-10);let[e,a]=zs.scales,l=t.cursor.sync,[c,u]=l.values,[d,h]=l.scales,[m,p]=zs.match,g=t.axes[0].side%2==1,f=0==S.ori?ie:le,y=1==S.ori?ie:le,b=g?o:r,v=g?r:o,w=g?s:n,C=g?n:s;if(n=null!=d?m(e,d)?i(c,k[e],f,0):-10:f*(w/b),s=null!=h?p(a,h)?i(u,k[a],y,0):-10:y*(C/v),1==S.ori){let e=n;n=s,s=e}}!u||null!=t&&t.cursor.event.type!=we||((n<=1||n>=ie-1)&&(n=zt(n,ie)),(s<=1||s>=le-1)&&(s=zt(s,le))),c?(ga=n,fa=s,[ka,Da]=O.move(a,n,s)):(Fa=n,Sa=s)}Object.defineProperty(a,"rect",{get:()=>(null==vs&&ws(!1),vs)});const xs={width:0,height:0,left:0,top:0};function Ds(){Ua(xs,!1)}let As,Es,Bs,Fs;function Ss(e,t,n,s,r,o,i){_a=!0,Va=Oa=Ia._x=Ia._y=!1,ks(e,t,n,s,r,o,0,!0,!1),null!=e&&(ae(ke,Me,Ms,!1),Vs(Ce,a,ka,Da,ie,le,null));let{left:l,top:c,width:u,height:d}=$a;As=l,Es=c,Bs=u,Fs=d}function Ms(e,t,n,s,r,o,i){_a=Ia._x=Ia._y=!1,ks(e,t,n,s,r,o,0,!1,!0);let{left:l,top:c,width:u,height:d}=$a,h=u>0||d>0,m=As!=l||Es!=c||Bs!=u||Fs!=d;if(h&&m&&Ua($a),Ia.setScale&&h&&m){let e=l,t=u,n=c,a=d;if(1==S.ori&&(e=c,t=d,n=l,a=u),Va&&Wa(D,ds(e,D),ds(e+t,D)),Oa)for(let s in k){let e=k[s];s!=D&&null==e.from&&e.min!=At&&Wa(s,ds(n+a,s),ds(n,s))}Ds()}else O.lock&&(O._lock=!O._lock,bs(t,!0,null!=e));null!=e&&(se(ke,Me),Vs(ke,a,Fa,Sa,ie,le,null))}function js(e,t,n,s,r,o,i){O._lock||(xt(e),Fn(),Ds(),null!=e&&Vs(Ae,a,Fa,Sa,ie,le,null))}function Ts(){C.forEach(cs),dt(a.width,a.height,!0)}Ge(Be,je,Ts);const Ps={};Ps.mousedown=Ss,Ps.mousemove=Cs,Ps.mouseup=Ms,Ps.dblclick=js,Ps.setSeries=(e,t,n,s)=>{-1!=(n=(0,zs.match[2])(a,t,n))&&Ha(n,s,!0,!1)},q&&(ae(Ce,p,Ss),ae(we,p,Cs),ae(xe,p,e=>{xt(e),ws(!1)}),ae(De,p,function(e,t,n,a,s,r,o){if(O._lock)return;xt(e);let i=_a;if(_a){let e,t,n=!0,a=!0,s=10;0==S.ori?(e=Va,t=Oa):(e=Oa,t=Va),e&&t&&(n=Fa<=s||Fa>=ie-s,a=Sa<=s||Sa>=le-s),e&&n&&(Fa=Fa{e.call(null,a,t,n)})}(e.plugins||[]).forEach(e=>{for(let t in e.hooks)Ls[t]=(Ls[t]||[]).concat(e.hooks[t])});const Ns=(e,t,n)=>n,zs=tn({key:null,setSeries:!1,filters:{pub:Pt,sub:Pt},scales:[D,b[1]?b[1].scale:null],match:[Lt,Lt,Ns],values:[null,null]},O.sync);2==zs.match.length&&zs.match.push(Ns),O.sync=zs;const _s=zs.key,Is=xa(_s);function Vs(e,t,n,a,s,r,o){zs.filters.pub(e,t,n,a,s,r,o)&&Is.pub(e,t,n,a,s,r,o)}function Os(){Rs("init",e,t),Bn(t||e.data,!1),P[D]?za(D,P[D]):Fn(),ct=$a.show&&($a.width>0||$a.height>0),ot=ut=!0,dt(e.width,e.height)}return Is.sub(a),a.pub=function(e,t,n,a,s,r,o){zs.filters.sub(e,t,n,a,s,r,o)&&Ps[e](null,t,n,a,s,r,o)},a.destroy=function(){Is.unsub(a),Ka.delete(a),ne.clear(),Ke(Be,je,Ts),c.remove(),null==W||W.remove(),Rs("destroy")},b.forEach(Qt),C.forEach(function(e,t){if(e._show=e.show,e.show){let n=e.side%2,s=k[e.scale];null==s&&(e.scale=n?b[1].scale:D,s=k[e.scale]);let r=s.time;e.size=St(e.size),e.space=St(e.space),e.rotate=St(e.rotate),Yt(e.incrs)&&e.incrs.forEach(e=>{!Ot.has(e)&&Ot.set(e,$t(e))}),e.incrs=St(e.incrs||(2==s.distr?vn:r?1==y?Tn:Rn:wn)),e.splits=St(e.splits||(r&&1==s.distr?N:3==s.distr?sa:4==s.distr?ra:aa)),e.stroke=St(e.stroke),e.grid.stroke=St(e.grid.stroke),e.ticks.stroke=St(e.ticks.stroke),e.border.stroke=St(e.border.stroke);let o=e.values;e.values=Yt(o)&&!Yt(o[0])?St(o):r?Yt(o)?In(L,_n(o,R)):Kt(o)?function(e,t){let n=mn(t);return(t,a,s,r,o)=>a.map(t=>n(e(t)))}(L,o):o||z:o||na,e.filter=St(e.filter||(s.distr>=3&&10==s.log?da:3==s.distr&&2==s.log?ha:jt)),e.font=ls(e.font),e.labelFont=ls(e.labelFont),e._size=e.size(a,null,t,0),e._space=e._rotate=e._incrs=e._found=e._splits=e._values=null,e._size>0&&(nn[t]=!0,e._el=Ie("u-axis",h))}}),n?n instanceof HTMLElement?(n.appendChild(c),Os()):n(a,Os):Os(),a}us.assign=tn,us.fmtNum=dt,us.rangeNum=it,us.rangeLog=nt,us.rangeAsinh=at,us.orient=Da,us.pxRatio=Pe,us.join=function(e,t){if(function(e){let t=e[0][0],n=t.length;for(let a=1;a=a&&null==e[s];)s--;if(s<=a)return!0;const r=vt(1,gt((s-a+1)/t));for(let o=e[a],i=a+r;i<=s;i+=r){const t=e[i];if(null!=t){if(t<=o)return!1;o=t}}return!0}(t[0])||(t=function(e){let t=e[0],n=t.length,a=Array(n);for(let r=0;rt[e]-t[n]);let s=[];for(let r=0;re-t)],s=a[0].length,r=new Map;for(let o=0;oDa(e,r,(l,c,u,d,h,m,p,g,f,y,b)=>{[o,i]=et(u,o,i);let v=l.pxRound,{left:w,width:C}=e.bbox,k=e=>v(m(e,d,y,g)),x=e=>v(p(e,h,b,f)),D=0==d.ori?La:Ra;const A={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},E=A.stroke,B=d.dir*(0==d.ori?1:-1);let F=x(u[1==B?o:i]),S=k(c[1==B?o:i]),M=S,j=S;s&&-1==t&&(j=w,D(E,j,F)),D(E,S,F);for(let e=1==B?o:i;e>=o&&e<=i;e+=B){let n=u[e];if(null==n)continue;let a=k(c[e]),s=x(n);1==t?D(E,a,F):D(E,M,s),D(E,a,s),F=s,M=a}let T=M;s&&1==t&&(T=w+C,D(E,T,F));let[P,L]=Aa(e,r);if(null!=l.fill||0!=P){let t=A.fill=new Path2D(E),n=x(l.fillTo(e,r,l.min,l.max,P));D(t,T,n),D(t,j,n)}if(!l.spanGaps){let s=[];s.push(...Sa(c,u,o,i,B,k,a));let h=l.width*Pe/2,m=n||1==t?h:-h,p=n||-1==t?-h:h;s.forEach(e=>{e[0]+=m,e[1]+=p}),A.gaps=s=l.gaps(e,r,o,i,s),A.clip=Fa(s,d.ori,g,f,y,b)}return 0!=L&&(A.band=2==L?[Ba(e,r,o,i,E,-1),Ba(e,r,o,i,E,1)]:Ba(e,r,o,i,E,L)),A})},e.bars=function(e){const t=lt((e=e||Ut).size,[.6,At,1]),n=e.align||0,a=e.gap||0;let s=e.radius;s=null==s?[0,0]:"number"==typeof s?[s,0]:s;const r=St(s),o=1-t[0],i=lt(t[1],At),l=lt(t[2],1),c=lt(e.disp,Ut),u=lt(e.each,e=>{}),{fill:d,stroke:h}=c;return(e,t,s,m)=>Da(e,t,(p,g,f,y,b,v,w,C,k,x,D)=>{let A,E,B=p.pxRound,F=n,S=a*Pe,M=i*Pe,j=l*Pe;0==y.ori?[A,E]=r(e,t):[E,A]=r(e,t);const T=y.dir*(0==y.ori?1:-1);let P,L,R,N=0==y.ori?Na:za,z=0==y.ori?u:(e,t,n,a,s,r,o)=>{u(e,t,n,s,a,o,r)},_=lt(e.bands,Wt).find(e=>e.series[0]==t),I=null!=_?_.dir:0,V=p.fillTo(e,t,p.min,p.max,I),O=B(w(V,b,D,k)),$=x,q=B(p.width*Pe),U=!1,W=null,H=null,Y=null,G=null;null==d||0!=q&&null==h||(U=!0,W=d.values(e,t,s,m),H=new Map,new Set(W).forEach(e=>{null!=e&&H.set(e,new Path2D)}),q>0&&(Y=h.values(e,t,s,m),G=new Map,new Set(Y).forEach(e=>{null!=e&&G.set(e,new Path2D)})));let{x0:K,size:X}=c;if(null!=K&&null!=X){F=1,g=K.values(e,t,s,m),2==K.unit&&(g=g.map(t=>e.posToVal(C+t*x,y.key,!0)));let n=X.values(e,t,s,m);L=2==X.unit?n[0]*x:v(n[0],y,x,C)-v(0,y,x,C),$=Ya(g,f,v,y,x,C,$),R=$-L+S}else $=Ya(g,f,v,y,x,C,$),R=$*o+S,L=$-R;R<1&&(R=0),q>=L/2&&(q=0),R<5&&(B=Mt);let J=R>0;L=B(Bt($-R-(J?q:0),j,M)),P=(0==F?L/2:F==T?0:L)-F*T*((0==F?S/2:0)+(J?q/2:0));const Z={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Q=U?null:new Path2D;let ee=null;if(null!=_)ee=e.data[_.series[1]];else{let{y0:n,y1:a}=c;null!=n&&null!=a&&(f=a.values(e,t,s,m),ee=n.values(e,t,s,m))}let te=A*L,ne=E*L;for(let n=1==T?s:m;n>=s&&n<=m;n+=T){let a=f[n];if(null==a)continue;if(null!=ee){let e=ee[n]??0;if(a-e==0)continue;O=w(e,b,D,k)}let s=v(2!=y.distr||null!=c?g[n]:n,y,x,C),r=w(lt(a,V),b,D,k),o=B(s-P),i=B(vt(r,O)),l=B(bt(r,O)),u=i-l;if(null!=a){let s=a<0?ne:te,r=a<0?te:ne;U?(q>0&&null!=Y[n]&&N(G.get(Y[n]),o,l+gt(q/2),L,vt(0,u-q),s,r),null!=W[n]&&N(H.get(W[n]),o,l+gt(q/2),L,vt(0,u-q),s,r)):N(Q,o,l+gt(q/2),L,vt(0,u-q),s,r),z(e,t,n,o-q/2,l,L+q,u)}}return q>0?Z.stroke=U?G:Q:U||(Z._fill=0==p.width?p._fill:p._stroke??p._fill,Z.width=0),Z.fill=U?H:Q,Z})},e.spline=function(e){return function(e,t){const n=lt(null==t?void 0:t.alignGaps,0);return(t,a,s,r)=>Da(t,a,(o,i,l,c,u,d,h,m,p,g,f)=>{[s,r]=et(l,s,r);let y,b,v,w=o.pxRound,C=e=>w(d(e,c,g,m)),k=e=>w(h(e,u,f,p));0==c.ori?(y=Ta,v=La,b=Va):(y=Pa,v=Ra,b=Oa);const x=c.dir*(0==c.ori?1:-1);let D=C(i[1==x?s:r]),A=D,E=[],B=[];for(let e=1==x?s:r;e>=s&&e<=r;e+=x)if(null!=l[e]){let t=C(i[e]);E.push(A=t),B.push(k(l[e]))}const F={stroke:e(E,B,y,v,b,w),fill:null,clip:null,band:null,gaps:null,flags:1},S=F.stroke;let[M,j]=Aa(t,a);if(null!=o.fill||0!=M){let e=F.fill=new Path2D(S),n=k(o.fillTo(t,a,o.min,o.max,M));v(e,A,n),v(e,D,n)}if(!o.spanGaps){let e=[];e.push(...Sa(i,l,s,r,x,C,n)),F.gaps=e=o.gaps(t,a,s,r,e),F.clip=Fa(e,c.ori,m,p,g,f)}return 0!=j&&(F.band=2==j?[Ba(t,a,s,r,S,-1),Ba(t,a,s,r,S,1)]:Ba(t,a,s,r,S,j)),F})}(Ga,e)}}const ds=new Map;function hs(e){var t;if(!e.startsWith("var("))return e;const n=ds.get(e);if(n)return n;const a=e.match(/var\(([^,)]+)(?:,\s*([^)]+))?\)/);if(!a)return e;const s=a[1].trim(),r=(null==(t=a[2])?void 0:t.trim())||"#888888",o=getComputedStyle(document.documentElement).getPropertyValue(s).trim()||r;return ds.set(e,o),o}function ms(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];const n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);return n?[parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)]:[0,0,0]}let ps=null,gs=0;const fs=s.memo(function({timestamps:e,series:t,onHover:n,onSeriesHover:a,highlightedKey:o=null,cursorColor:i,overlayLine:l=null,startTs:c,endTs:u}){const d=s.useRef(null),h=s.useRef(null),m=s.useRef(t),p=s.useRef(o),g=s.useRef(l),f=s.useRef(n),y=s.useRef(a),b=s.useRef(null),v=s.useRef(c),w=s.useRef(u),C=s.useRef(e.length);s.useLayoutEffect(()=>{m.current=t,p.current=o,g.current=l,f.current=n,y.current=a,v.current=c,w.current=u});const k=s.useMemo(()=>{const t=new Array(e.length).fill(1);return[e,t]},[e]),x=s.useMemo(()=>({hooks:{draw:e=>{(function(e,t,n,a,s,r){if(0===t.length)return;const o=e.ctx,i=e.bbox,l=i.left,c=i.top,u=i.width,d=i.height;if(u<=0||d<=0)return;const h=8*(window.devicePixelRatio||1);o.save(),o.beginPath(),o.roundRect(l,c,u,d,h),o.clip();const m=e.data[0],p=m.length;if(0===p)return;const g=s??m[0],f=(r??m[p-1])-g||1,y=p>1?m[1]-m[0]:f/p,b=e=>l+(e-g)/f*u,v=e=>c+d*(1-e);for(let w=0;w=0;t--){const e=m[t],n=v(s[t]),a=b(t0&&o.lineTo(r,v(s[t-1]))}o.closePath(),o.fill(),o.restore()}a&&a.values.length>0&&function(e,t,n,a){const s=e.ctx,r=e.bbox,o=r.left,i=r.top,l=r.width,c=r.height;if(l<=0||c<=0)return;const u=e.data[0],d=u.length,h=t.values;if(0===d||0===h.length)return;const m=window.devicePixelRatio||1,p=n??u[0],g=(a??u[d-1])-p||1,f=e=>o+(e-p)/g*l,y=e=>i+c*(1-e),b=hs(t.color),v=(t.lineWidth??2)*m;s.save(),s.strokeStyle=b,s.lineWidth=v,s.lineCap="round",s.lineJoin="round",s.beginPath();let w=0;for(;w=d)return void s.restore();const C=f(u[w]),k=y(h[w]);s.moveTo(C,k);for(let D=w+1;D({width:400,height:200,padding:[8,0,0,32],cursor:{show:!0,x:!0,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],hooks:{setCursor:[e=>{var t,n,a,s;const r=e.cursor.idx;if(null!=r&&r>=0){const a=e.data[0][r];null==(t=f.current)||t.call(f,r,a);const s=e.cursor.left,o=e.cursor.top;if(void 0!==s&&void 0!==o&&null!==s&&null!==o){const t=window.devicePixelRatio||1,a=e.ctx,r=Math.round((e.bbox.left/t+s)*t),i=Math.round((e.bbox.top/t+o)*t),l=a.getImageData(r,i,1,1).data,c=l[0],u=l[1],d=l[2];let h=null;if(l[3]>10){const e=m.current;for(const t of e){const e=hs(t.color),[n,a,s]=ms(e),r=30;if(Math.abs(c-n)<=r&&Math.abs(u-a)<=r&&Math.abs(d-s)<=r){h=t.key;break}}}h!==b.current&&(b.current=h,null==(n=y.current)||n.call(y,h))}}else null==(a=f.current)||a.call(f,null,null),null!==b.current&&(b.current=null,null==(s=y.current)||s.call(y,null))}]},plugins:[x]}),[x]);s.useEffect(()=>{const t=d.current;if(!t||0===e.length)return;const n=C.current,a=e.length,s=Math.abs(a-n);if(!(!h.current||s>100||n>0&&s/n>.1)&&h.current)return h.current.setData(k),void(C.current=a);h.current&&h.current.destroy();const r=t.getBoundingClientRect(),o=Math.floor(r.width)||400,i=Math.floor(r.height)||200,l=new us({...D,width:o,height:i},k,t);return h.current=l,C.current=a,()=>{l.destroy(),h.current=null}},[D,k,e.length]),s.useEffect(()=>{const e=d.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!h.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&h.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{h.current&&h.current.redraw()},[o,t,l]);const A=s.useCallback(()=>{null==n||n(null,null),null==a||a(null),b.current=null},[n,a]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No data available"}):r.jsx("div",{ref:d,className:"w-full h-full overflow-hidden",onMouseLeave:A})}),ys=s.createContext(null),bs={blksand:"breeze dark",magma:"breeze dark",waves:"breeze dark",stars:"breeze dark",folds:"breeze dark","kde breeze":"breeze dark",ribbon:"breeze light"};function vs(e){const t=W(e);t&&function(e){if("undefined"==typeof document)return;const t=function(e){var t;const n={},a=e.surfaces.defaults;n["--default-tint"]=a.tint,n["--default-light"]=a.light,n["--default-dark"]=a.dark,n["--default-reflex-light"]=String(a.reflexLight),n["--default-reflex-dark"]=String(a.reflexDark),n["--default-blur"]=`${a.blur}px`,n["--default-blur-elevated"]=`${a.blurElevated}px`,n["--default-brightness"]=String(a.brightness),n["--default-bg-opacity"]=`${a.opacity}%`,n["--default-bg-opacity-elevated"]=`${a.opacityElevated}%`,n["--default-stroke-only"]=a.strokeOnly?"1":"0",n["--default-stroke-width"]=a.strokeWidth?`${a.strokeWidth}px`:"0px",n["--default-stroke-color"]=a.strokeColor||"transparent",n["--sidebar-tint"]=e.surfaces.sidebar.tint,n["--tooltip-bg"]=e.colors.bg.surface,n["--hover-tint"]=`rgba(${V(e.colors.accent.primary)}, 0.08)`,n["--shadow-tint"]=`rgba(${V(e.colors.accent.primary)}, 0.35)`,n["--body"]=e.colors.bg.body,n["--surface"]=e.colors.bg.surface,n["--elevated"]=e.colors.bg.elevated,n["--subtle"]=e.colors.bg.subtle,n["--edge-subtle"]=e.colors.border.subtle,n["--edge-strong"]=e.colors.border.strong,n["--fg-primary"]=e.colors.text.primary,n["--fg-secondary"]=e.colors.text.secondary,n["--fg-muted"]=e.colors.text.muted,n["--fg-invert"]=e.colors.text.inverse,n["--signal-excellent"]=e.colors.signal.excellent,n["--signal-good"]=e.colors.signal.good,n["--signal-fair"]=e.colors.signal.fair,n["--signal-poor"]=e.colors.signal.poor,n["--signal-critical"]=e.colors.signal.critical,n["--signal-unknown"]=e.colors.signal.unknown,n["--sparkline-excellent"]=e.colors.signal.excellent,n["--sparkline-good"]=e.colors.signal.good,n["--sparkline-fair"]=e.colors.signal.fair,n["--sparkline-poor"]=e.colors.signal.poor,n["--sparkline-critical"]=e.colors.signal.critical,n["--status-success"]=e.colors.status.success,n["--status-warning"]=e.colors.status.warning,n["--status-danger"]=e.colors.status.danger,n["--status-info"]=e.colors.status.info,n["--status-muted"]=e.colors.status.muted;const s=e.colors.chart;n["--pkt-advert"]=s.c3,n["--pkt-flood"]=s.c7,n["--pkt-txt-msg"]=e.colors.signal.excellent,n["--pkt-ack"]=s.c8,n["--pkt-trace"]=s.c3,n["--pkt-req"]=s.c2,n["--pkt-response"]=s.c5,n["--pkt-grp-txt"]=e.colors.map.room,n["--pkt-grp-data"]=e.colors.status.danger,n["--pkt-path"]=s.c3,n["--pkt-anon"]=s.c3,n["--pkt-unknown"]=e.colors.status.muted,n["--route-flood"]=s.c1,n["--route-direct"]=s.c3,n["--route-transport"]=s.c8,n["--chart-1"]=s.c1,n["--chart-2"]=s.c2,n["--chart-3"]=s.c3,n["--chart-4"]=s.c4,n["--chart-5"]=s.c5,n["--chart-6"]=s.c6,n["--chart-7"]=s.c7,n["--chart-8"]=s.c8,n["--chart-grid"]=s.grid,n["--chart-axis-tick"]=s.axis,n["--chart-cursor"]=s.cursor,n["--metric-received"]=e.colors.metric.received,n["--metric-forwarded"]=e.colors.metric.forwarded,n["--metric-transmitted"]=e.colors.metric.transmitted,n["--metric-dropped"]=e.colors.metric.dropped,n["--metric-neutral"]=e.colors.text.secondary,n["--log-debug"]=e.colors.status.muted,n["--log-info"]=e.colors.status.info,n["--log-warning"]=e.colors.status.warning,n["--log-error"]=e.colors.status.danger,n["--log-critical"]=e.colors.status.danger;const r=e.colors.map;n["--map-node-fill"]=T.blue,n["--map-node-stroke"]="rgba(255,255,255,0.9)",n["--map-hub-color"]=T.purple,n["--map-hub-stroke"]="rgba(255,255,255,0.9)",n["--map-gateway-color"]=T.indigo,n["--map-gateway-stroke"]="rgba(255,255,255,0.85)",n["--map-local-color"]=T.amber,n["--map-neighbor-color"]=T.amber,n["--map-neighbor-stroke"]="rgba(0,0,0,0.4)",n["--map-mobile-color"]=T.orange,n["--map-room-color"]=T.pink,n["--map-ghost-color"]=T.cyan,n["--map-edge-rest"]=r.edge,n["--map-edge-rest-bright"]=e.colors.border.strong,n["--map-edge-rest-dim"]=e.colors.bg.subtle,n["--map-edge-hover-direct"]=r.edgeHover,n["--map-edge-hover-loop"]=T.purple,n["--map-edge-hover-standard"]=e.colors.text.muted,n["--map-edge-hover-neighbor"]=T.amber,n["--link-strong"]=e.colors.signal.excellent,n["--link-medium"]=s.c3,n["--link-weak"]=e.colors.status.danger,n["--hop-0"]=s.c7,n["--hop-1"]=e.colors.signal.excellent,n["--hop-2"]=s.c2,n["--hop-3"]=s.c3,n["--hop-distant"]=e.colors.text.muted,n["--hop-hub"]=r.local;const o=e.colors.icon;n["--icon-page-title"]=(null==o?void 0:o.pageTitle)??s.c1,n["--icon-card-title"]=(null==o?void 0:o.cardTitle)??s.c1,n["--icon-widget"]=(null==o?void 0:o.widget)??e.colors.text.secondary,n["--icon-action"]=(null==o?void 0:o.action)??e.colors.text.secondary,n["--icon-nav"]=(null==o?void 0:o.nav)??e.colors.text.muted,n["--icon-nav-active"]=(null==o?void 0:o.navActive)??s.c1,n["--toggle-on"]=e.colors.signal.excellent,n["--toggle-off"]=e.colors.bg.elevated;const i=e.meta.isDark,l=e.colors.sidebar;n["--sidebar-bg"]=(null==l?void 0:l.bg)??"transparent",n["--sidebar-nav-hover-bg"]=(null==l?void 0:l.navHoverBg)??(i?"rgba(255, 255, 255, 0.05)":"rgba(0, 0, 0, 0.04)"),n["--sidebar-nav-active-bg"]=(null==l?void 0:l.navActiveBg)??`color-mix(in srgb, ${s.c1} 15%, transparent)`,n["--sidebar-nav-active-text"]=(null==l?void 0:l.navActiveText)??s.c1,n["--data-box-bg"]=i?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.03)",n["--data-box-border"]=i?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.08)",n["--subtle-fill"]=i?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.03)",n["--subtle-fill-hover"]=i?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.05)",n["--subtle-fill-strong"]=i?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.06)",n["--color-pill-bg"]=i?"rgba(0, 0, 0, 0.3)":"rgba(255, 255, 255, 0.3)",n["--terminal-bg"]=i?"rgba(0, 0, 0, 0.4)":"rgba(0, 0, 0, 0.03)",n["--terminal-bg-input"]=i?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.05)",n["--terminal-bg-status"]=i?"rgba(0, 0, 0, 0.3)":"rgba(0, 0, 0, 0.04)",n["--terminal-border"]=i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.1)",n["--terminal-autocomplete-bg"]=i?"rgba(0, 0, 0, 0.8)":"rgba(255, 255, 255, 0.95)",n["--terminal-autocomplete-border"]=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)",n["--terminal-autocomplete-hover"]=i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.05)",n["--livedot-idle"]=i?"#666677":"#999999",n["--ctrl-panel-top"]=i?"rgba(30, 30, 30, 0.95)":"rgba(240, 240, 240, 0.95)",n["--ctrl-panel-mid"]=i?"rgba(25, 25, 25, 0.95)":"rgba(235, 235, 235, 0.95)",n["--ctrl-panel-bottom"]=i?"rgba(20, 20, 20, 0.95)":"rgba(230, 230, 230, 0.95)",n["--ctrl-panel-border"]=i?"rgba(60, 60, 60, 1)":"rgba(200, 200, 200, 1)",n["--chart-grid-line"]=i?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.08)",n["--surface-ring"]=i?"inset 0 0 0 1px rgba(255, 255, 255, 0.1)":"inset 0 0 0 1px rgba(0, 0, 0, 0.08)",n["--surface-ring-strong"]=i?"inset 0 0 0 1px rgba(255, 255, 255, 0.15)":"inset 0 0 0 1px rgba(0, 0, 0, 0.12)",n["--surface-tint-subtle"]=i?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",n["--surface-tint-light"]=i?"rgba(255, 255, 255, 0.05)":"rgba(0, 0, 0, 0.03)",n["--surface-border-subtle"]=i?"rgba(255, 255, 255, 0.05)":"rgba(0, 0, 0, 0.06)",n["--map-control-active-amber"]=i?"rgba(251, 191, 36, 0.15)":"rgba(217, 119, 6, 0.12)",n["--map-control-active-sky"]=i?"rgba(56, 189, 248, 0.15)":"rgba(14, 165, 233, 0.12)",n["--map-control-active-teal"]=i?"rgba(45, 212, 191, 0.15)":"rgba(20, 184, 166, 0.12)",n["--sidebar-action-active-green"]=i?"rgba(10, 26, 10, 1)":"rgba(220, 252, 231, 1)",n["--sidebar-action-active-teal"]=i?"rgba(10, 36, 32, 1)":"rgba(204, 251, 241, 1)",n["--sidebar-action-active-amber"]=i?"rgba(26, 20, 8, 1)":"rgba(254, 243, 199, 1)",n["--thumbnail-brightness"]=i?"1.5":"1.8",n["--input-bg"]=i?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.03)",n["--input-border"]=i?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.08)",n["--font-title"]=e.typography.font.title,n["--font-display"]=e.typography.font.display,n["--font-data"]=e.typography.font.mono,n["--font-card-title"]=e.typography.font.cardTitle??e.typography.font.display,n["--font-badge"]=e.typography.font.badge??e.typography.font.display,n["--font-normal"]=String(e.typography.weight.normal),n["--font-medium"]=String(e.typography.weight.medium),n["--font-semibold"]=String(e.typography.weight.semibold),n["--font-bold"]=String(e.typography.weight.bold),n["--font-card-title-weight"]=String(e.typography.weight.cardTitle??e.typography.weight.semibold),n["--font-badge-weight"]=String(e.typography.weight.badge??e.typography.weight.medium),n["--badge-text-transform"]=(null==(t=e.typography.badge)?void 0:t.textTransform)??"none";const c=e.typography.size;c.xxl&&(n["--text-2xl"]=c.xxl),c.xl&&(n["--text-xl"]=c.xl),c.lg&&(n["--text-lg"]=c.lg),c.md&&(n["--text-md"]=c.md),c.base&&(n["--text-base"]=c.base),c.sm&&(n["--text-sm"]=c.sm),c.xs&&(n["--text-xs"]=c.xs),c.hero&&(n["--text-5xl"]=c.hero),c.cardTitle&&(n["--text-card-title"]=c.cardTitle);const u=e.typography.tracking;return u&&(n["--tracking-tight"]=u.tight,n["--tracking-normal"]=u.normal,n["--tracking-wide"]=u.wide),n["--theme-transition"]=`${e.motion.slow} ${e.motion.easing}`,function(e){if(!z())return e;const t={},n=/^#[0-9A-Fa-f]{3,6}$/;for(const[a,s]of Object.entries(e))t[a]=n.test(s)?N(s):s;return t}(n)}(e),n=document.documentElement;for(const[a,s]of Object.entries(t))n.style.setProperty(a,s);e.surfaces.defaults.strokeOnly?n.classList.add("stroke-only"):n.classList.remove("stroke-only"),e.surfaces.defaults.catalystMode?n.classList.add("catalyst-mode"):n.classList.remove("catalyst-mode"),n.dataset.mode=e.meta.isDark?"dark":"light"}(t),document.documentElement.dataset.themeId=e}function ws({children:e}){const[t,n]=s.useState(()=>function(){if("undefined"==typeof window)return K;try{let e=localStorage.getItem(X);const t=localStorage.getItem(J);if(!e){const t=localStorage.getItem(Z),n=localStorage.getItem(Q);t?e=t:n&&(e=n),e&&(localStorage.setItem(X,e),localStorage.removeItem(Z),localStorage.removeItem("pymc-background-image"),localStorage.removeItem(Q))}e&&e in bs&&(e=bs[e],localStorage.setItem(X,e));const n=e&&H(e)?e:K.themeId;let a=K.brightness;if(t){const e=parseInt(t,10);!isNaN(e)&&e>=0&&e<=100&&(a=e)}return{themeId:n,brightness:a}}catch{return K}}()),a=s.useRef(!1),o=s.useRef(null),[i,l]=s.useState(null);s.useEffect(()=>{o.current&&(clearTimeout(o.current),o.current=null),a.current&&(l("#808080"),o.current=setTimeout(()=>{l(null),o.current=null},1800)),a.current=!0,vs(t.themeId),ds.clear(),requestAnimationFrame(()=>{!function(){if("undefined"==typeof window)return;for(const t of ne){const e=le(`--palette-${t}-bright`),n=le(`--palette-${t}`),a=e||n;if(!a)continue;const s=ie(a);for(const r of te)ce(`--palette-${t}-${r}`,s[r])}const e=le("--palette-bg-4");if(e){const t=ie(e);for(const e of te)ce(`--palette-neutral-${e}`,t[e])}}()})},[t.themeId]),s.useEffect(()=>{!function(e){if("undefined"!=typeof window)try{localStorage.setItem(X,e.themeId),localStorage.setItem(J,String(e.brightness))}catch{}}(t)},[t]),s.useEffect(()=>{U.forEach(e=>{var t;e.meta.backgroundImage&&(t=e.meta.backgroundImage)&&((new Image).src=t)})},[]);const c=s.useCallback(e=>{if(!H(e))return;const t=W(e);t&&n(n=>({...n,themeId:e,brightness:t.meta.backgroundBrightness}))},[]),u=s.useCallback(e=>{const t=Math.max(0,Math.min(100,Math.round(e)));n(e=>({...e,brightness:t}))},[]),d=s.useMemo(()=>({theme:t,setTheme:c,setBrightness:u}),[t,c,u]);return r.jsxs(ys.Provider,{value:d,children:[e,i&&r.jsx("div",{className:"fixed inset-0 pointer-events-none z-[9999]",style:{backgroundColor:i,animation:"theme-crossfade 1.8s ease-out forwards"}},t.themeId),r.jsx("style",{children:"\n @keyframes theme-crossfade {\n from { opacity: 0.35; }\n to { opacity: 0; }\n }\n "})]})}function Cs(){const e=s.useContext(ys);if(!e)throw new Error("useTheme must be used within a ThemeProvider. Wrap your app with in App.tsx.");return e}const ks=s.forwardRef(function(e,t){const{href:n,...a}=e;return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("//")?r.jsx(o,{children:r.jsx("a",{...a,href:n,ref:t})}):r.jsx(o,{children:r.jsx(D,{...a,to:n,ref:t})})}),xs={0:"REQ",1:"RESPONSE",2:"TXT_MSG",3:"ACK",4:"ADVERT",5:"GRP_TXT",6:"GRP_DATA",7:"ANON_REQ",8:"PATH",9:"TRACE",10:"MULTIPART",15:"RAW_CUSTOM"},Ds={0:"T_FLOOD",1:"FLOOD",2:"DIRECT",3:"T_DIRECT"},As={REQ:0,RESPONSE:1,TXT_MSG:2,ACK:3,ADVERT:4,GRP_TXT:5,GRP_DATA:6,ANON_REQ:7,PATH:8,TRACE:9,MULTIPART:10,RAW_CUSTOM:15};function Es(e){return 1===e||0===e}const Bs={acton:{discrete:["#260D40","#2B1345","#2F194B","#342152","#382657","#3C2C5C","#403261","#443766","#483E6C","#4C4371","#504876","#544D7B","#57527F","#5D5884","#625C88","#685F8A","#6E618C","#74628D","#7B638D","#81638E","#88648E","#8E648E","#95658F","#9D658F","#A4668F","#AB6690","#B26790","#BB6992","#C26B94","#C86F97","#CD749B","#D07AA0","#D382A7","#D688AC","#D88FB2","#D995B8","#DB9CBD","#DEA4C4","#DFABC9","#E1B1CE","#E3B7D3","#E5BED8","#E6C5DE","#E8CBE2","#E9D0E6","#EBD6EA","#ECDBEE","#EDE1F3","#EFE6F6","#F0EAFA"],categorical:["#260D40","#F0EAFA","#A76690","#DDA1C2","#585380","#7D638E","#E8CAE1","#CF789E","#403261","#4C4371","#ECDBEE","#69608B","#E3B6D2","#D78CB0","#91648F","#BE6A92","#342152","#EAD3E8","#524B79","#73628D","#463A69","#605B86","#E5C0DA","#D382A7","#C86F97","#86648E","#EEE3F4","#DA97B9","#9B658F","#B26790","#2D1749","#E0ACCA","#3A2959","#8B648E","#311C4D","#EBD7EB","#EDDFF1","#AC6790","#A1668F","#6E618C","#E6C5DE","#78628D","#433665","#DEA7C6","#81638E","#554F7C","#B86891","#3D2D5D","#4F4775","#EFE7F7","#E9CEE4","#D27DA3","#2A1244","#655D89","#C36C94","#E1B1CE","#493F6D","#5C5783","#CC739A","#DB9CBD","#D892B4","#D587AB","#96658F","#E4BBD6","#362455","#4E4573","#7F638E","#D37FA5","#E1AECC","#382657","#EBD9ED","#DFA9C8","#A4668F","#8E648E","#99658F","#675F8A","#B56891","#BB6992","#E5BED8","#E2B4D0","#D07AA0","#71618C","#E6C2DC","#AA6690","#625C88","#EDE1F3","#E8CCE3","#AF6790","#CA7199","#C16B93","#453867","#57517E","#84638E","#4B416F","#E7C7DF","#423463","#514977","#3E2F5F","#544D7B","#93658F"]},bam:{discrete:["#65024B","#701057","#7B1B61","#88276E","#923078","#9B3881","#A4418A","#AC4993","#B5549C","#BC5CA3","#C266AB","#C970B2","#CF7AB9","#D587C1","#DA93C8","#DF9ECE","#E3AAD4","#E7B5DA","#EBC2E0","#EECCE5","#F1D5E9","#F3DDED","#F5E4F0","#F6EBF1","#F6EFF1","#F5F2F0","#F3F3ED","#EFF3E6","#EBF1DF","#E5EFD5","#DDEBCA","#D4E6BD","#C8DEAB","#BCD79B","#B0CE8C","#A3C67D","#97BC6F","#88B161","#7CA856","#72A04D","#679845","#5E903D","#538735","#4B7F2E","#427827","#397021","#306819","#245D10","#195507","#0D4C00"],categorical:["#65024B","#701057","#7B1B61","#88276E","#923078","#9B3881","#A4418A","#AC4993","#B5549C","#BC5CA3","#C266AB","#C970B2","#CF7AB9","#D587C1","#DA93C8","#DF9ECE","#E3AAD4","#E7B5DA","#EBC2E0","#EECCE5","#F1D5E9","#F3DDED","#F5E4F0","#F6EBF1","#F6EFF1","#F5F2F0","#F3F3ED","#EFF3E6","#EBF1DF","#E5EFD5","#DDEBCA","#D4E6BD","#C8DEAB","#BCD79B","#B0CE8C","#A3C67D","#97BC6F","#88B161","#7CA856","#72A04D","#679845","#5E903D","#538735","#4B7F2E","#427827","#397021","#306819","#245D10","#195507","#0D4C00"]},bamako:{discrete:["#003B47","#023C46","#053E45","#083F43","#0A4141","#0D4340","#0F443E","#12463C","#16483A","#194A38","#1C4D36","#204F34","#235132","#28542F","#2C572C","#305A2A","#355C27","#395F24","#3F6321","#44661E","#49691A","#4E6D17","#537014","#5A7410","#5F780D","#657C09","#6A7F05","#718302","#788501","#7F8700","#858800","#8C8A00","#948C01","#9B8E04","#A1920B","#A89713","#AE9C1B","#B7A225","#BEA82E","#C5AD37","#CBB341","#D2B84D","#D9BF5B","#DEC567","#E4CA73","#E9D07E","#EFD58A","#F5DB97","#FAE0A3","#FFE5AD"],categorical:["#003B47","#FFE5AD","#61790B","#B4A022","#245231","#406420","#898900","#DDC464","#0F443E","#EFD58A","#CAB23F","#194A38","#748401","#506E16","#9E9108","#315A29","#083F43","#A99815","#948C01","#6A7F05","#BFA930","#7F8700","#14473B","#1E4E35","#F7DD9C","#2A562D","#043D45","#597411","#E6CC77","#385F25","#48691B","#D4BB51","#0B4241","#8F8A00","#44661E","#1B4C37","#547113","#6F8203","#12463D","#998E03","#27542F","#4C6B18","#A4940E","#2E582B","#355C27","#B9A529","#215033","#EAD181","#FBE1A5","#C5AD37","#3C6122","#848800","#063E44","#E2C86E","#D9BF5B","#CFB648","#16493A","#798600","#023C46","#667C08","#5D770E","#0D433F","#AE9C1B","#F3D993","#094042","#A69611","#8C8A00","#053E45","#0C4240","#365E26","#6D8004","#9C8F05","#4A6A1A","#D6BD56","#B19E1F","#F9DFA0","#647B0A","#2F592A","#10453D","#818800","#C7AF3B","#46681C","#0E443F","#265330","#174A39","#335B28","#5B750F","#778501","#5F780D","#E8CF7C","#718302","#F1D78E","#978D02","#F5DB97","#204F34","#AC9A18","#29552E","#A1920B","#B7A225","#033C46"]},bamo:{discrete:["#4F3043","#56304B","#603354","#6D3961","#793F6B","#834675","#8D4E7E","#965587","#A05E91","#A86698","#B06EA0","#B877A7","#BF81AF","#C78DB8","#CD98BE","#D2A3C4","#D6ADC8","#D9B5CB","#DABECC","#DAC3CC","#D9C7CA","#D8CAC8","#D6CBC6","#D4CDC2","#D1CDBE","#CCCDB9","#C6CBB1","#BCC5A4","#B2BE97","#A7B58A","#9CAB7E","#92A174","#889669","#808D62","#79855C","#737D56","#6D7552","#666C4C","#616548","#5C5D45","#575642","#54503F","#50493D","#4D453C","#4B403B","#4A3C3A","#49393A","#49343B","#4A313E","#4E3042"],categorical:["#4F3043","#56304B","#603354","#6D3961","#793F6B","#834675","#8D4E7E","#965587","#A05E91","#A86698","#B06EA0","#B877A7","#BF81AF","#C78DB8","#CD98BE","#D2A3C4","#D6ADC8","#D9B5CB","#DABECC","#DAC3CC","#D9C7CA","#D8CAC8","#D6CBC6","#D4CDC2","#D1CDBE","#CCCDB9","#C6CBB1","#BCC5A4","#B2BE97","#A7B58A","#9CAB7E","#92A174","#889669","#808D62","#79855C","#737D56","#6D7552","#666C4C","#616548","#5C5D45","#575642","#54503F","#50493D","#4D453C","#4B403B","#4A3C3A","#49393A","#49343B","#4A313E","#4E3042"]},batlow:{discrete:["#011959","#06215B","#0A285C","#0D315D","#0E375E","#103D5F","#114260","#124761","#144D62","#165162","#195662","#1C5A62","#205E61","#26635F","#2C665D","#33695A","#3A6C57","#416F53","#4A724E","#52744A","#5A7745","#627941","#6A7B3D","#747E38","#7D8134","#868330","#8F862D","#9B892B","#A58B2C","#AF8D2E","#B98F32","#C29037","#CD923F","#D69446","#DE964F","#E69858","#ED9A62","#F39E70","#F8A17B","#FAA587","#FCA993","#FDAC9E","#FDB1AB","#FDB4B6","#FDB8C0","#FDBCCB","#FCBFD6","#FCC4E3","#FBC8EF","#FACCFA"],categorical:["#011959","#FACCFA","#828231","#226061","#F29D6D","#4D734D","#114360","#C09036","#FDB4B4","#DD954D","#356A59","#FCBFD6","#175262","#677B3E","#A18A2B","#0D315D","#FCA890","#FBC6E8","#2B655E","#B18D2F","#5A7745","#FDAEA2","#CF9340","#0F3B5F","#E9995C","#FDBAC4","#416F53","#91862D","#1B5962","#08255B","#747E38","#134B61","#F9A380","#8A842F","#0E365E","#124761","#154F62","#E39754","#7B8034","#1E5D62","#99882C","#195662","#0B2B5C","#FDB7BC","#C8913B","#FCC3DF","#EE9B64","#A98C2C","#FDB1AB","#FDBCCD","#FBC9F1","#051F5A","#F6A077","#607942","#FDAB9A","#477150","#3B6D56","#B98F32","#26635F","#537549","#D69446","#6D7C3B","#30685C","#103F60","#FBA689","#BD8F34","#CB923E","#EB9A60","#FDB8C0","#FBC7EC","#F09C69","#8E852E","#FDBBC9","#7F8133","#031C5A","#114160","#FDAC9E","#5D7844","#FCA995","#185462","#787F36","#A58B2C","#0A285C","#9D892B","#33695A","#0D335E","#637A40","#165062","#124561","#205E61","#144D62","#1D5B62","#0C2E5D","#D9954A","#3E6E55","#AD8C2D","#F49F72","#868330","#B58E30","#577647"]},batlowk:{discrete:["#04050A","#0A0D15","#0F141E","#121B29","#152233","#18293D","#1C3146","#21384F","#274156","#2C485B","#314E5E","#36535F","#3B575F","#405C5E","#445F5D","#49625B","#4D6558","#526756","#586B52","#5E6E4F","#63724B","#6A7548","#717845","#797D41","#81813E","#8A853B","#938839","#9F8D38","#A99139","#B3943B","#BE973E","#C89A43","#D39D4C","#DB9F54","#E2A15D","#E8A366","#EEA570","#F3A77C","#F6A986","#F8AC91","#FAAE9A","#FCB1A4","#FDB4B0","#FDB7B9","#FDBAC3","#FDBDCD","#FDC1D8","#FCC5E4","#FBC8EF","#FACCFA"],categorical:["#04050A","#FDC0D6","#787C41","#38555F","#E5A160","#536855","#AF933A","#FAAE9A","#1A2E43","#FDB6B7","#294458","#455F5C","#63724B","#CD9B47","#91883A","#F3A77E","#111A27","#F7AB8D","#FDBBC5","#FCB2AA","#D99E52","#A18E38","#4C6459","#21384F","#3F5B5E","#152335","#0C1019","#EEA570","#5B6D50","#6C7647","#314E5E","#85823D","#BE973E","#7E7F3F","#FBB0A2","#49625B","#576A53","#0F151F","#2D495B","#DFA059","#727944","#FDBDCD","#253E54","#EAA368","#C69942","#3C585F","#998B38","#677449","#F1A678","#F9AC92","#141F2F","#1D3248","#506657","#090C13","#A99139","#5F6F4E","#35525F","#435D5D","#FDB8BD","#F5A984","#B5953B","#FDB5B2","#17273B","#D39D4C","#8C853B","#9D8C38","#415C5E","#1F354B","#33505E","#FCB1A6","#101723","#3E595F","#121C2B","#757B43","#06080F","#FCB3AE","#3A565F","#274156","#61704D","#88843C","#2B475A","#FDBED1","#6A7548","#596C51","#192B3F","#6F7845","#233B51","#C99A45","#F0A574","#DC9F55","#2F4B5D","#47615C","#F6AA88","#FDB9C1","#C29840","#4A635A","#FAAD96","#81813E","#7B7E40","#E7A264"]},batloww:{discrete:["#011959","#06215B","#0A285C","#0D315D","#0E375E","#103D5F","#114260","#124761","#144C62","#165062","#185562","#1B5962","#1F5D62","#246261","#2A665F","#30695D","#366C5A","#3D7056","#467352","#4E764E","#56794A","#5E7C46","#667F42","#70823D","#798539","#828936","#8C8C33","#989032","#A29433","#AD9738","#B79B3F","#C19E48","#CBA154","#D3A45E","#D9A669","#DFA872","#E4AA7C","#E9AC88","#EEAF91","#F2B39C","#F6B9A8","#F9C0B5","#FCCAC4","#FED3CF","#FFDBDA","#FFE3E2","#FFEAEA","#FFF2F2","#FFF8F8","#FFFEFE"],categorical:["#FFFEFE","#011959","#7E8737","#205F61","#E7AB84","#497451","#114360","#FED1CD","#BF9D46","#637E44","#9E9233","#FFEAEA","#0D315D","#326B5C","#F5B7A6","#165162","#D7A564","#0F3B5F","#1A5862","#3D7056","#FFF5F5","#FFDFDD","#FAC3BA","#134A61","#08255B","#70823D","#EEB094","#56794A","#E0A874","#8E8D33","#28655F","#AF9839","#CBA154","#EBAD8B","#1D5C62","#051F5A","#124761","#FFE5E4","#B79B3F","#A79535","#386D59","#5C7B47","#185562","#DBA76D","#F8BDAF","#FFF0F0","#246261","#F2B39C","#868A35","#4F774D","#E4AA7C","#2D685E","#77853A","#FED8D6","#103F60","#FFFAF9","#968F32","#D1A35C","#144E62","#FCCAC4","#437254","#698040","#0E365E","#0B2B5C","#C59F4C","#30695D","#1C5A62","#A29433","#407155","#FFDBDA","#0C2E5D","#F7BAAA","#E5AB80","#175362","#828936","#1F5D62","#BB9C42","#E9AC88","#FFF7F7","#3A6E58","#9A9132","#8A8B34","#4C754F","#FFEDED","#D9A669","#144C62","#266460","#FDCDC9","#FCC6BF","#FFE2E1","#FFFCFC","#7B8639","#2B675E","#155062","#5F7C45","#F9C0B5","#356C5A","#F3B5A1","#EDAF8F","#FED5D2"]},berlin:{discrete:["#9EB0FF","#93AFFA","#87ADF4","#79ABED","#6CA9E6","#60A5DF","#54A0D5","#489ACA","#3E90BC","#3787AF","#327EA3","#2D7597","#296B8B","#25607C","#225771","#1E4E65","#1B465A","#183D4F","#153342","#122C38","#11242E","#101D25","#11181C","#121214","#160E0D","#1B0B07","#210B03","#270D01","#2D0E00","#340F00","#3B1100","#421301","#4B1602","#541905","#5D1E09","#68240F","#732B16","#803620","#8A3F2A","#944834","#9E513F","#A85A4A","#B46658","#BE6F63","#C8796F","#D2837A","#DD8D86","#EA9995","#F4A3A1","#FFADAD"],categorical:["#9EB0FF","#93AFFA","#87ADF4","#79ABED","#6CA9E6","#60A5DF","#54A0D5","#489ACA","#3E90BC","#3787AF","#327EA3","#2D7597","#296B8B","#25607C","#225771","#1E4E65","#1B465A","#183D4F","#153342","#122C38","#11242E","#101D25","#11181C","#121214","#160E0D","#1B0B07","#210B03","#270D01","#2D0E00","#340F00","#3B1100","#421301","#4B1602","#541905","#5D1E09","#68240F","#732B16","#803620","#8A3F2A","#944834","#9E513F","#A85A4A","#B46658","#BE6F63","#C8796F","#D2837A","#DD8D86","#EA9995","#F4A3A1","#FFADAD"]},bilbao:{discrete:["#4C0001","#54070B","#5B0E13","#64161A","#6B1D20","#712227","#77282D","#7D2E34","#84343B","#8A3A41","#8F4047","#94464B","#984C4F","#9B5253","#9D5754","#9E5C56","#A06057","#A16458","#A26959","#A36D5A","#A4715B","#A5745B","#A6785C","#A77C5D","#A8805E","#A9845F","#AA875F","#AC8C60","#AD9061","#AE9463","#AF9864","#B19D68","#B3A36E","#B6A975","#B8AD7E","#BBB287","#BDB590","#C0B99A","#C2BCA3","#C4BFAA","#C6C2B2","#C8C5B9","#CBCAC1","#CFCEC9","#D5D4D1","#DBDBDA","#E3E3E2","#EDEDED","#F6F6F6","#FFFFFF"],categorical:["#4C0001","#F8F8F8","#A9815E","#984D50","#BEB794","#AF9965","#CCCAC3","#78292F","#A26A59","#9F5D56","#64161A","#B6AA77","#C4C0AC","#A6765C","#8A3A41","#AC8C60","#DDDDDB","#A16358","#C7C5B7","#B3A16B","#A4705A","#6E2024","#EAEAE9","#92434A","#BAB185","#9C5554","#AD9262","#580B10","#813137","#C1BCA1","#AA865F","#D2D2CE","#A77C5D","#D7D7D4","#BCB48D","#B4A571","#C0B99A","#9E5955","#AB8960","#A6795C","#A36D5A","#8E3F46","#85353C","#A16758","#732529","#CAC7BD","#F1F1F0","#520509","#AC8F61","#5E1115","#C6C2B2","#E3E3E2","#691B1F","#B8AD7E","#95484D","#AE9663","#B19D68","#A5735B","#A06057","#9A5152","#A87E5D","#7D2E34","#A9835E","#C3BEA6","#CFCEC9","#A46E5A","#F4F4F4","#DADAD8","#B29F69","#EDEDED","#BBB289","#9D5754","#AF9764","#904148","#994F51","#B3A36E","#A87F5E","#A26859","#AC8D61","#BDB590","#AA875F","#A77A5D","#AB8A60","#A4715B","#611418","#BFB897","#E6E6E6","#9B5353","#D5D4D1","#974A4F","#C8C6BA","#A16558","#9F5E56","#76272C","#67191D","#8C3C43","#B9AF82","#C3BFA9","#B5A874","#4F0205"]},broc:{discrete:["#2C1A4C","#2B2154","#2B295B","#2A3164","#29396C","#284174","#29497C","#2A5183","#305C8C","#376593","#416D9A","#4B76A0","#567FA6","#6489AD","#6F92B3","#7B9BBA","#86A3C0","#92ACC6","#A0B7CD","#ACC0D3","#B8C9DA","#C4D2E0","#D0DBE6","#DEE5EC","#E7ECED","#EDEFE9","#EDEEE1","#E9E9D4","#E4E4C8","#DEDEBD","#D8D8B1","#D2D2A5","#C9C996","#C1C18A","#B8B87E","#AEAE73","#A3A369","#97975E","#8D8D56","#83834D","#797945","#70703D","#646434","#5B5B2C","#525224","#49491D","#404016","#36360F","#2E2E08","#262600"],categorical:["#2C1A4C","#2B2154","#2B295B","#2A3164","#29396C","#284174","#29497C","#2A5183","#305C8C","#376593","#416D9A","#4B76A0","#567FA6","#6489AD","#6F92B3","#7B9BBA","#86A3C0","#92ACC6","#A0B7CD","#ACC0D3","#B8C9DA","#C4D2E0","#D0DBE6","#DEE5EC","#E7ECED","#EDEFE9","#EDEEE1","#E9E9D4","#E4E4C8","#DEDEBD","#D8D8B1","#D2D2A5","#C9C996","#C1C18A","#B8B87E","#AEAE73","#A3A369","#97975E","#8D8D56","#83834D","#797945","#70703D","#646434","#5B5B2C","#525224","#49491D","#404016","#36360F","#2E2E08","#262600"]},broco:{discrete:["#372F38","#36303D","#363144","#36354E","#363957","#373F60","#39456A","#3C4D75","#415780","#47608A","#4D6992","#55729A","#5D7BA2","#6886AA","#728FB1","#7C97B7","#86A0BD","#91A8C2","#9DB2C8","#A7BACC","#B1C1CE","#BAC8D0","#C2CDD0","#CAD1CD","#CED3C8","#CFD3C2","#CFD1B9","#CBCCAD","#C6C6A2","#BFBF96","#B8B78B","#AFAF7F","#A4A472","#9B9A68","#91915E","#888755","#7E7E4C","#737243","#6B693D","#626137","#5B5932","#54512E","#4C482B","#474229","#423D29","#3F3829","#3C352B","#39322E","#383032","#372F37"],categorical:["#372F38","#36303D","#363144","#36354E","#363957","#373F60","#39456A","#3C4D75","#415780","#47608A","#4D6992","#55729A","#5D7BA2","#6886AA","#728FB1","#7C97B7","#86A0BD","#91A8C2","#9DB2C8","#A7BACC","#B1C1CE","#BAC8D0","#C2CDD0","#CAD1CD","#CED3C8","#CFD3C2","#CFD1B9","#CBCCAD","#C6C6A2","#BFBF96","#B8B78B","#AFAF7F","#A4A472","#9B9A68","#91915E","#888755","#7E7E4C","#737243","#6B693D","#626137","#5B5932","#54512E","#4C482B","#474229","#423D29","#3F3829","#3C352B","#39322E","#383032","#372F37"]},buda:{discrete:["#B301B3","#B30BAE","#B314AA","#B31CA6","#B323A2","#B3289F","#B32E9D","#B4339A","#B53998","#B63E96","#B84394","#B94892","#BB4C91","#BD528F","#BE568D","#C05B8C","#C15F8A","#C36389","#C46987","#C66D86","#C77184","#C97583","#CA7982","#CB7E80","#CD837F","#CE877E","#CF8B7D","#D0917B","#D1957A","#D29979","#D49E78","#D5A277","#D6A776","#D7AC75","#D8B073","#D9B572","#DAB971","#DCBF70","#DDC36F","#DEC86E","#DFCC6C","#E0D16B","#E2D76A","#E4DC69","#E6E168","#E9E667","#EDEC67","#F3F366","#F9F966","#FFFF66"],categorical:["#B301B3","#FFFF66","#CD857E","#BC4E90","#DBBD70","#C56A87","#B32F9C","#E3DB69","#D4A177","#EDEC67","#D1937B","#B73F95","#C05C8B","#DFCB6D","#C97882","#B31CA6","#D8AE74","#E7E368","#DAB572","#B311AC","#D39A79","#C36389","#C77184","#B53798","#E1D36B","#BE558E","#B94793","#CB7E80","#CF8C7C","#DDC46E","#B326A0","#F6F566","#D6A875","#DAB971","#C66E86","#E2D76A","#B32B9E","#B317A9","#B4339A","#BA4B91","#C46788","#C2608A","#B309AF","#D49E78","#B63B97","#BD528F","#DCC06F","#EAE767","#FAFA66","#D2977A","#F1F066","#D0907C","#CE897D","#C87483","#CC827F","#D5A576","#B321A3","#E5DF68","#B84394","#D9B273","#E0CF6C","#CA7B81","#DEC86E","#BF598C","#D7AB75","#E6E168","#D1957A","#CC8080","#D39C78","#E0CD6C","#CD847F","#B63D96","#C87384","#C66C86","#F8F866","#D49F78","#D9B473","#DAB772","#BF578D","#CB7D81","#CF8A7D","#B32D9D","#D08E7C","#DBBB71","#C2628A","#E2D56A","#DCBF70","#BC508F","#C46987","#C05B8C","#DFCA6D","#DDC26F","#C15E8B","#D7AD74","#F3F366","#DEC66E","#D5A377","#B31AA7","#BA4992","#CE877E"]},bukavu:{discrete:["#1A3333","#1B373D","#1C3C47","#1E4255","#1F4762","#214E71","#235582","#255E92","#2969A1","#2C73AD","#2F7CB8","#3485C2","#3B8EC7","#4799C8","#50A1C9","#59AAC9","#62B2CA","#6BBACB","#76C3CB","#81CCCD","#92D5D1","#A4DED5","#B6E7DA","#CCF2DF","#DDFBE3","#034224","#08491F","#115119","#1C5914","#2B6212","#3D6915","#4E6E1B","#617224","#6F742B","#7B7631","#867836","#917B3C","#9E7E45","#AA844F","#B48D5D","#BC976C","#C3A27C","#CAB08F","#CFBBA0","#D5C6B0","#DACFC1","#DFD7D0","#E4DFE0","#E9E6ED","#EDEDFC"],categorical:["#1A3333","#1B373D","#1C3C47","#1E4255","#1F4762","#214E71","#235582","#255E92","#2969A1","#2C73AD","#2F7CB8","#3485C2","#3B8EC7","#4799C8","#50A1C9","#59AAC9","#62B2CA","#6BBACB","#76C3CB","#81CCCD","#92D5D1","#A4DED5","#B6E7DA","#CCF2DF","#DDFBE3","#034224","#08491F","#115119","#1C5914","#2B6212","#3D6915","#4E6E1B","#617224","#6F742B","#7B7631","#867836","#917B3C","#9E7E45","#AA844F","#B48D5D","#BC976C","#C3A27C","#CAB08F","#CFBBA0","#D5C6B0","#DACFC1","#DFD7D0","#E4DFE0","#E9E6ED","#EDEDFC"]},cork:{discrete:["#2C194C","#2B2254","#2B295C","#2A3265","#293A6D","#284275","#284A7C","#2A5284","#2F5C8D","#366493","#3F6C99","#49749F","#527CA4","#5E85AA","#688DB0","#7395B6","#7E9DBB","#8AA6C2","#99B1C9","#A5BBD0","#B2C5D7","#C0CFDE","#CDD9E5","#DCE5EB","#E5ECED","#E6EEEA","#E0EAE1","#D4E2D4","#C8DBC8","#BCD3BC","#B0CAB0","#A4C2A3","#95B895","#89B088","#7DA87D","#71A071","#669966","#599059","#4F894E","#458244","#3B7B3A","#317430","#266A25","#1F611D","#1A5816","#174E12","#14450E","#123A0A","#103107","#0F2903"],categorical:["#2C194C","#2B2254","#2B295C","#2A3265","#293A6D","#284275","#284A7C","#2A5284","#2F5C8D","#366493","#3F6C99","#49749F","#527CA4","#5E85AA","#688DB0","#7395B6","#7E9DBB","#8AA6C2","#99B1C9","#A5BBD0","#B2C5D7","#C0CFDE","#CDD9E5","#DCE5EB","#E5ECED","#E6EEEA","#E0EAE1","#D4E2D4","#C8DBC8","#BCD3BC","#B0CAB0","#A4C2A3","#95B895","#89B088","#7DA87D","#71A071","#669966","#599059","#4F894E","#458244","#3B7B3A","#317430","#266A25","#1F611D","#1A5816","#174E12","#14450E","#123A0A","#103107","#0F2903"]},corko:{discrete:["#3F3E3A","#3E3D3F","#3E3D44","#3E3D4B","#3E3F52","#3E425A","#3F4762","#414C6C","#445578","#485D82","#4E658B","#546E94","#5C779C","#6581A5","#6E8AAC","#7792B2","#809BB8","#89A3BD","#94ACC2","#9CB3C5","#A3BAC7","#A9C0C8","#AEC5C7","#B0C9C4","#B0CABF","#ADCAB9","#A9C9B2","#A2C5A8","#9BC19F","#93BC95","#8BB68B","#82B081","#78A775","#709F6A","#689760","#608E56","#5A864C","#537B42","#4F733B","#4B6B35","#486431","#465D2E","#44562C","#43512C","#424D2D","#42492E","#414630","#404333","#404036","#3F3E3A"],categorical:["#3F3E3A","#3E3D3F","#3E3D44","#3E3D4B","#3E3F52","#3E425A","#3F4762","#414C6C","#445578","#485D82","#4E658B","#546E94","#5C779C","#6581A5","#6E8AAC","#7792B2","#809BB8","#89A3BD","#94ACC2","#9CB3C5","#A3BAC7","#A9C0C8","#AEC5C7","#B0C9C4","#B0CABF","#ADCAB9","#A9C9B2","#A2C5A8","#9BC19F","#93BC95","#8BB68B","#82B081","#78A775","#709F6A","#689760","#608E56","#5A864C","#537B42","#4F733B","#4B6B35","#486431","#465D2E","#44562C","#43512C","#424D2D","#42492E","#414630","#404333","#404036","#3F3E3A"]},davos:{discrete:["#00054A","#010E51","#041459","#081C61","#0C2368","#102A6F","#133075","#17377C","#1C3F83","#204588","#244C8D","#295291","#2D5895","#335F98","#38649A","#3C699C","#416E9D","#46729D","#4C779D","#517B9C","#567F9B","#5A829A","#5F8598","#658996","#698C94","#6E8F92","#739290","#78968D","#7D998C","#829D8A","#88A089","#8DA488","#95AA87","#9BAF88","#A3B489","#ABBB8C","#B4C190","#BFCA96","#C9D29E","#D2D9A6","#DBE0AF","#E3E7B8","#EBEDC4","#F0F1CD","#F4F4D6","#F7F7DE","#FAF9E6","#FCFCF0","#FDFDF7","#FEFEFE"],categorical:["#00054A","#FDFDF4","#688B94","#2D5895","#B2C08F","#E8EBC0","#87A089","#133075","#4B769D","#5A829A","#204588","#76958E","#D0D8A4","#99AD88","#F6F6DB","#3C699C","#081C61","#031256","#1A3B7F","#537C9C","#A4B68A","#C1CC98","#7E9A8B","#FAFAE8","#356199","#0E266B","#DEE3B3","#274F90","#6F9091","#618697","#8FA588","#F0F1CD","#43709D","#1D4084","#47739D","#F3F4D4","#658996","#567F9B","#17367A","#FCFBEE","#4F799D","#C9D29E","#93A987","#39659B","#D8DEAB","#ABBB8C","#739290","#B9C693","#F8F8E1","#234A8C","#112B70","#7A978D","#9EB188","#315C97","#829D8A","#05175B","#010C50","#3F6C9D","#0B2065","#5D8499","#2A5392","#8BA388","#6B8D93","#EDEFC7","#E3E7B8","#22488A","#638897","#122E73","#00094D","#AEBD8D","#4D789D","#CDD5A1","#5F8598","#58819A","#071A5E","#0C2368","#18387D","#91A787","#37639A","#EBEDC4","#F2F2D0","#FBFBEB","#74938F","#2F5A96","#335F98","#809B8B","#BDC995","#49759D","#719191","#9BAF88","#F7F7DE","#1B3E82","#A8B88B","#849E89","#557E9B","#E6E9BC","#45719D","#1E4386","#96AB87","#89A188"]},devon:{discrete:["#2C1A4C","#2B1E51","#2B2356","#2A295B","#2A2D60","#293265","#29376A","#283B6E","#274174","#27467A","#274C7F","#275186","#28568C","#2A5C95","#2D609C","#3064A3","#3468AA","#396BB1","#3F70B9","#4774C0","#4F79C6","#597DCC","#6382D1","#6F88D7","#798CDB","#8290DF","#8C95E2","#969AE6","#9E9EE9","#A6A3EB","#ACA7ED","#B1ACEF","#B7B1F0","#BBB5F1","#BFB9F2","#C3BEF3","#C7C2F4","#CCC7F4","#D0CCF5","#D4D0F6","#D8D4F7","#DCD9F8","#E1DEF9","#E5E3FA","#E9E7FB","#EDECFB","#F2F0FC","#F7F6FD","#FBFAFE","#FFFFFF"],categorical:["#2C1A4C","#F8F8FE","#758AD9","#C6C0F3","#28568C","#29376A","#AAA5ED","#DEDCF8","#3D6EB7","#EBE9FB","#9197E4","#3063A2","#274579","#577CCB","#D2CEF6","#2A285A","#BAB3F1","#B2ADEF","#F2F0FC","#274E82","#2A2F62","#CCC7F4","#9E9EE9","#4875C1","#C0BAF2","#2B5D98","#3669AD","#2B2154","#E4E2FA","#8290DF","#D8D4F7","#6784D3","#283E71","#C9C4F4","#BDB7F1","#DBD8F8","#283A6D","#4F79C6","#A4A2EB","#EEEDFC","#CFCBF5","#E8E5FA","#5F80CF","#4272BC","#B6B0F0","#2B1D50","#AEA9EE","#275287","#2A2B5E","#989BE7","#293366","#27497D","#8A94E1","#295A92","#3266A7","#F5F4FD","#7B8DDC","#274174","#2D609C","#2B2558","#6F88D7","#E1DEF9","#3A6CB2","#D5D1F6","#C3BEF3","#2E629F","#3165A4","#8D95E3","#3468AA","#DAD6F7","#D1CDF5","#9B9CE8","#275084","#B8B2F0","#27477B","#6382D1","#4573BF","#A2A0EA","#F7F6FD","#C7C2F4","#F3F2FD","#274376","#8692E0","#2B1F52","#CAC6F4","#ACA7ED","#E3E0F9","#F0EEFC","#E6E4FA","#386AB0","#2C1C4E","#6B86D5","#28396B","#283C6F","#2A5C95","#2A2D60","#BEB9F2","#C2BCF2","#7E8FDD","#3F70B9"]},fes:{discrete:["#0D0D0D","#181818","#212121","#2B2B2B","#343434","#3C3C3C","#454545","#4D4D4D","#565656","#5E5E5E","#656565","#6D6D6D","#747474","#7C7C7C","#848484","#8B8B8B","#939393","#9C9C9C","#A7A7A7","#B1B1B1","#BBBBBB","#C5C5C5","#D1D1D1","#DFDFDF","#ECECEC","#094225","#184822","#2B4F20","#3A5420","#485822","#555B24","#615E26","#6F6229","#7A652B","#86682E","#926B30","#9F7035","#AD7940","#B6834D","#BD8E5C","#C2996C","#C6A47C","#CCB18F","#D1BCA0","#D5C6B0","#DACFC1","#DFD7CF","#E4DFE0","#E8E6ED","#EDEDFC"],categorical:["#0D0D0D","#181818","#212121","#2B2B2B","#343434","#3C3C3C","#454545","#4D4D4D","#565656","#5E5E5E","#656565","#6D6D6D","#747474","#7C7C7C","#848484","#8B8B8B","#939393","#9C9C9C","#A7A7A7","#B1B1B1","#BBBBBB","#C5C5C5","#D1D1D1","#DFDFDF","#ECECEC","#094225","#184822","#2B4F20","#3A5420","#485822","#555B24","#615E26","#6F6229","#7A652B","#86682E","#926B30","#9F7035","#AD7940","#B6834D","#BD8E5C","#C2996C","#C6A47C","#CCB18F","#D1BCA0","#D5C6B0","#DACFC1","#DFD7CF","#E4DFE0","#E8E6ED","#EDEDFC"]},glasgow:{discrete:["#361338","#3B1434","#401530","#45172C","#491828","#4D1924","#511B21","#561C1D","#5B1E18","#602014","#662210","#6B260B","#6F2B07","#723203","#743802","#743E01","#754300","#744900","#744F01","#745402","#735905","#725F0B","#716413","#70691E","#6E6E27","#6C7231","#6B763A","#697B46","#677F4F","#658359","#648763","#628B6C","#618F78","#609381","#60978A","#619B94","#659F9D","#6CA5A8","#74A9B0","#7DADB8","#86B1BF","#8EB4C6","#99B9CE","#A1BCD5","#AABFDB","#B2C3E1","#BBC6E7","#C6CBF0","#D0CFF7","#DBD3FF"],categorical:["#361338","#DBD3FF","#6D702B","#69A3A5","#702D06","#A0BBD3","#638968","#521B20","#745101","#84B0BE","#754001","#5F9587","#BBC6E7","#612013","#45172C","#687D4A","#726210","#618F78","#4B1926","#3E1532","#629C96","#658359","#CACCF3","#76AAB2","#6B763A","#744900","#6A250C","#ADC1DD","#735905","#92B6C9","#591D1A","#743702","#70681C","#4F1A23","#754400","#6D2909","#60998E","#41162F","#744D00","#745503","#B4C3E2","#697A42","#7DADB8","#628C70","#8BB3C3","#561C1D","#D2D0F9","#99B9CE","#3A1435","#6F6C23","#743B01","#60927F","#662210","#648661","#659F9D","#678051","#725E0A","#481829","#6FA6AB","#6C7332","#5D1E17","#A6BED8","#C2C9ED","#723203","#716617","#68240E","#6F6A20","#C6CBF0","#79ABB5","#72600D","#754200","#43162D","#67A1A1","#6B7536","#5F1F15","#735B07","#571C1B","#72A8AF","#744F01","#BEC8EA","#381337","#8EB4C6","#628B6C","#677E4D","#60917B","#639E9A","#4A1827","#A3BDD6","#3C1433","#743901","#632112","#B7C5E5","#4D1924","#65845D","#618E74","#609483","#9CBAD1","#46172A","#87B1C1","#6D712F"]},grayc:{discrete:["#000000","#090909","#111111","#171717","#1C1C1C","#212121","#252525","#2A2A2A","#303030","#343434","#393939","#3D3D3D","#424242","#474747","#4B4B4B","#505050","#545454","#585858","#5D5D5D","#616161","#656565","#696969","#6D6D6D","#717171","#757575","#797979","#7D7D7D","#818181","#858585","#898989","#8E8E8E","#929292","#979797","#9C9C9C","#A1A1A1","#A6A6A6","#ABABAB","#B1B1B1","#B6B6B6","#BCBCBC","#C1C1C1","#C7C7C7","#CECECE","#D5D5D5","#DBDBDB","#E2E2E2","#E8E8E8","#F1F1F1","#F8F8F8","#FFFFFF"],categorical:["#070707","#F9F9F9","#777777","#454545","#AEAEAE","#909090","#292929","#5F5F5F","#D1D1D1","#9E9E9E","#525252","#E4E4E4","#6C6C6C","#BFBFBF","#1A1A1A","#373737","#848484","#595959","#222222","#B6B6B6","#A6A6A6","#3E3E3E","#7D7D7D","#666666","#969696","#8A8A8A","#4B4B4B","#DADADA","#C8C8C8","#313131","#717171","#131313","#EFEFEF","#C4C4C4","#A2A2A2","#424242","#878787","#252525","#2D2D2D","#4F4F4F","#3B3B3B","#808080","#1E1E1E","#BBBBBB","#AAAAAA","#EAEAEA","#696969","#7A7A7A","#DFDFDF","#636363","#565656","#B2B2B2","#0E0E0E","#9A9A9A","#5C5C5C","#747474","#F3F3F3","#333333","#6E6E6E","#D5D5D5","#8D8D8D","#939393","#494949","#CCCCCC","#171717","#BDBDBD","#575757","#C1C1C1","#404040","#828282","#E2E2E2","#151515","#1C1C1C","#0B0B0B","#9C9C9C","#858585","#2F2F2F","#B4B4B4","#888888","#242424","#272727","#3C3C3C","#B0B0B0","#353535","#545454","#5B5B5B","#393939","#D7D7D7","#A4A4A4","#A8A8A8","#959595","#767676","#646464","#989898","#444444","#474747","#111111","#F6F6F6","#ECECEC","#4D4D4D"]},hawaii:{discrete:["#8C0273","#8E0D6E","#8F1569","#901D63","#91235F","#91285A","#922D56","#933252","#94384D","#943D4A","#954246","#964742","#964C3F","#97523B","#985638","#985C34","#996131","#9A662E","#9B6C2A","#9B7226","#9C7823","#9C7E20","#9D841E","#9D8C1C","#9C921C","#9B991D","#9AA021","#97A828","#94AE30","#91B439","#8CB942","#88BE4C","#82C359","#7EC663","#79CA6E","#74CE79","#70D183","#6AD591","#66D89C","#62DCA7","#60DFB2","#5FE2BD","#61E6CA","#67E9D5","#6FEBDE","#7AEEE7","#87EFEE","#98F1F5","#A6F1F9","#B3F2FD"],categorical:["#8C0273","#B3F2FD","#9C951C","#6CD48C","#964D3E","#8ABC48","#9B6D29","#66E8D3","#922E55","#9C801F","#87EFEE","#995D34","#7BC969","#901D63","#60DEB0","#96AA2B","#943D4A","#975439","#82C359","#5FE4C2","#9AA021","#73CE7B","#65D99E","#954544","#9D8A1C","#8E126B","#91B439","#9DF1F7","#73ECE2","#91265C","#9C7724","#9A652E","#93364F","#922A59","#996131","#9D851D","#9D901C","#9A692C","#68D695","#902160","#9B9A1E","#985836","#9B7226","#933252","#77CC72","#9C7B21","#954147","#8D0A6F","#93AF32","#62DCA7","#92F0F3","#8F1867","#7DEEE8","#97513C","#6CEBDB","#61E6CA","#A8F2FA","#964941","#7FC661","#86BF50","#98A526","#70D183","#5FE1B9","#8DB840","#94394D","#9C7923","#8F1569","#985A35","#60E0B4","#9A6B2A","#91245E","#97A828","#9B7425","#6AD591","#95AD2E","#5FE2BD","#60E5C6","#953F48","#933054","#63E7CF","#84C154","#8D0671","#82EFEB","#9B9D1F","#99A323","#88BE4C","#6ED288","#6FEBDE","#9A672D","#91285A","#75CD76","#995F32","#68E9D7","#9B7028","#61DDAB","#943B4B","#933450","#8DF0F0","#8F1A65","#81C45D"]},imola:{discrete:["#1A33B3","#1C37B1","#1E3AAF","#203EAD","#2242AB","#2345AA","#2548A8","#274CA6","#2950A4","#2A53A3","#2C56A1","#2E599F","#2F5D9E","#32609B","#346499","#366797","#386A95","#3B6C92","#3E708F","#41738C","#44768A","#467987","#4A7C85","#4E8082","#518480","#56887E","#5A8C7D","#5F927B","#64967A","#689B79","#6DA078","#72A576","#78AB75","#7DB074","#82B572","#87BA71","#8CBF70","#93C66E","#98CB6D","#9ED06C","#A4D66A","#ACDB69","#B5E268","#BFE767","#C8EB67","#D3F066","#DDF466","#EAF866","#F5FB66","#FFFF66"],categorical:["#1A33B3","#FFFF66","#54867F","#305E9D","#91C36F","#3F718E","#2549A8","#BDE667","#70A377","#2B53A2","#376896","#80B373","#A3D56B","#DDF466","#203EAD","#487B86","#62947A","#2D59A0","#88BB71","#5B8D7D","#CDED66","#4E8082","#EEF966","#33639A","#284EA5","#44768A","#2344AA","#AFDE69","#3B6C92","#78AB75","#1D39B0","#99CC6D","#699C79","#3D6F90","#2C56A1","#2F5B9E","#5E917B","#4B7D84","#9ED06C","#1F3CAE","#C4EA67","#84B772","#274CA6","#D5F066","#2951A4","#74A776","#578A7E","#2446A9","#1C36B1","#A9D96A","#95C86E","#467888","#2141AC","#7CAF74","#356598","#B5E268","#66987A","#396A94","#F7FC66","#8CBF70","#E6F666","#32609B","#518380","#41738C","#6DA078","#6B9E78","#B9E468","#7AAD74","#528580","#32629B","#86B971","#3C6E91","#5C8F7C","#C8EB67","#ACDB69","#D1EF66","#E2F566","#97CA6D","#1B35B2","#1C37B0","#2345AA","#2F5D9E","#1F3DAE","#457789","#3A6B93","#598B7D","#D9F266","#346499","#386995","#A6D76A","#366797","#274DA6","#56887E","#A1D36B","#42748B","#7EB173","#72A576","#477987","#4C7F83","#F2FB66"]},lajolla:{discrete:["#191900","#1E1B02","#221C05","#271E08","#2C200B","#31220E","#362411","#3C2614","#442817","#4B2B1B","#532D1F","#5B3023","#633328","#6E362D","#783932","#813C37","#8B3F3B","#96423F","#A24543","#AD4746","#B74A48","#C04D49","#C9514B","#D1564C","#D75C4D","#DB634E","#DD694F","#E0714F","#E17750","#E37D50","#E48351","#E58951","#E79052","#E89652","#E99C52","#EAA253","#EBA853","#EDAF54","#EEB555","#F0BC57","#F1C25A","#F3CA5F","#F5D369","#F7DA74","#F9E282","#FBE890","#FCEF9F","#FDF5B0","#FEFABE","#FFFECB"],categorical:["#191900","#FFFECB","#D85F4D","#ECAC54","#653329","#F7D971","#A44544","#E58751","#362411","#E1744F","#C44E4A","#E99A52","#4B2B1B","#833D38","#F1C159","#FCEF9F","#271E08","#FEF7B6","#402716","#D0554C","#FAE587","#E79052","#EFB655","#B54947","#201C04","#E37D50","#743830","#DD694F","#EBA353","#94413E","#572F21","#F4CD61","#2E210C","#FDF3AB","#32220F","#241D06","#F5D369","#7B3B34","#1D1B02","#F0BC57","#5E3125","#F8DF7C","#512D1E","#CA514B","#E48251","#E68C51","#EA9E53","#E89552","#BC4C49","#6C362C","#EDB154","#9C4341","#E27950","#FBEA93","#3B2513","#FEFBC0","#452918","#EBA853","#F2C75C","#8B3F3B","#DB644E","#AD4746","#DF6E4F","#D55A4D","#2B200A","#783932","#E79352","#D75C4D","#FEF9BB","#EDAF54","#E0714F","#7F3C36","#613227","#F7DC77","#C7504B","#F1C45A","#30210D","#F4D065","#1E1B03","#FAE78D","#F9E282","#DA614E","#392412","#4E2C1D","#E99C52","#EFB956","#221C05","#EBA553","#FDF5B0","#984240","#E38050","#8F403D","#542E20","#ECAA54","#E68E51","#70372E","#DE6C4F","#B94A48","#291F09","#1B1A01"]},lapaz:{discrete:["#1A0C64","#1C1368","#1E196D","#202071","#212675","#222B79","#23317D","#253681","#263C85","#274189","#29478C","#2A4C8F","#2C5192","#2E5795","#305C98","#32609A","#35659C","#386A9E","#3C70A0","#3F74A1","#4379A2","#487DA3","#4D81A3","#5386A4","#588AA3","#5E8EA3","#6591A2","#6C95A1","#7398A0","#7A9A9E","#809D9D","#879F9B","#90A199","#97A397","#9EA596","#A5A795","#ADAA95","#B7AD96","#BFB199","#C8B69C","#D2BBA2","#DAC1A8","#E4C9B2","#EBCFBB","#F1D5C4","#F5DBCD","#F9E1D6","#FBE8E1","#FDEDEA","#FEF2F3"],categorical:["#1A0C64","#FEF2F3","#5B8BA3","#B3AC96","#2C5292","#3C70A0","#EACEB9","#859E9C","#24327E","#6F96A1","#33619A","#202071","#D0BAA0","#9BA496","#F9E1D6","#4A7FA3","#284289","#90A199","#FCEAE5","#1D176B","#37699D","#F3D8C8","#A7A895","#5285A4","#7A9A9E","#2F5A97","#4278A2","#263A84","#6591A2","#C1B299","#DEC3AB","#222978","#2A4B8E","#5688A4","#D7BEA6","#FDEEEC","#608EA3","#EFD3C0","#A1A696","#6A94A1","#FBE6DD","#ADAA95","#F6DDCF","#4E82A3","#2E5695","#3A6D9F","#C8B69C","#1C1268","#232D7B","#3F74A1","#467BA3","#1E1C6E","#7F9C9D","#BAAF97","#253681","#315E99","#29478C","#E4C9B2","#74989F","#273E87","#212575","#95A398","#8AA09A","#35659C","#2B4F91","#23307C","#E7CBB5","#F1D5C4","#2B4D90","#202373","#588AA3","#D3BCA3","#5487A4","#447AA2","#6792A2","#24347F","#253882","#ECD0BD","#879F9B","#305C98","#E1C6AF","#1E196D","#5D8DA3","#AAA995","#386B9E","#487DA3","#77999F","#F7DFD3","#BEB098","#1F1E70","#325F99","#4176A2","#F4DACB","#4C80A3","#2D5494","#8DA099","#6C95A1","#FAE3DA","#FDECE8","#B7AD96"]},lipari:{discrete:["#031326","#05192F","#062038","#092844","#0C2E4D","#103557","#163C5F","#1E4368","#294B70","#345075","#3E5578","#47587A","#4F5B7B","#575C7A","#5D5D79","#635E78","#695E76","#6E5F75","#765F73","#7C6071","#826070","#89606E","#90616C","#98616A","#A06268","#A86266","#B06364","#BA6462","#C36660","#CB685F","#D46B5E","#DB705F","#E27760","#E77E63","#E98567","#EA8D6B","#EA946F","#E89C75","#E7A279","#E6A87E","#E5AF84","#E5B58A","#E6BD92","#E7C49A","#EACCA3","#EDD3AD","#F0DBB7","#F5E5C4","#F9EDCF","#FDF5DA"],categorical:["#031326","#FDF5DA","#A56267","#525B7A","#E99B74","#785F72","#DA6F5E","#183E61","#E7C398","#8D616D","#365176","#092844","#655E77","#E98466","#BF6561","#F0DBB7","#E5AD82","#B26364","#EBCFA7","#5C5D79","#061D35","#25486D","#0E3353","#EA906D","#98616A","#E37861","#E5B88C","#826070","#CD685F","#6E5F75","#45587A","#F6E8C9","#E7A37A","#615E78","#E77E63","#D46B5E","#9F6268","#E99570","#93616B","#87606E","#7D6071","#F3E1C0","#575C7A","#0B2D4B","#2D4D72","#E6A87E","#E9C99F","#FAEED1","#1E4368","#EA8A69","#B86462","#6A5E76","#AB6365","#735F74","#DF735F","#E5B287","#13385A","#05182D","#E6BD92","#3E5578","#EDD5AF","#07223C","#C6665F","#4C5A7A","#E8A077","#B56363","#FBF1D6","#A26267","#E6C095","#0A2A48","#F8EBCD","#EACCA3","#AE6364","#7A5F72","#635E78","#E98768","#041629","#715F74","#ECD2AB","#A86266","#8A606E","#96616B","#545C7A","#EFD8B3","#F5E5C4","#9B6169","#F2DEBB","#765F73","#6C5F75","#294B70","#22466B","#E89D76","#E88165","#BC6461","#E6A67C","#85606F","#C36660","#1B4064","#D06A5E","#103557"]},lisbon:{discrete:["#E6E5FF","#D8DCF7","#CBD2EF","#BBC6E5","#ADBCDE","#A0B3D6","#93A9CE","#86A0C6","#7794BD","#6A8BB5","#5E81AC","#5177A4","#456E9B","#38628F","#2F5984","#274F78","#20476D","#1B3F61","#173653","#142E48","#12283E","#112233","#111D2A","#121921","#15181B","#181A18","#1E1D17","#252419","#2D2B1C","#353220","#3E3A25","#46422A","#514C31","#5A5536","#645E3C","#6D6741","#777047","#837B4F","#8D8556","#988F5E","#A29A67","#ADA470","#B9B17D","#C3BC89","#CDC795","#D7D2A2","#E0DCAF","#ECE9BE","#F5F4CB","#FFFFD9"],categorical:["#E6E5FF","#D8DCF7","#CBD2EF","#BBC6E5","#ADBCDE","#A0B3D6","#93A9CE","#86A0C6","#7794BD","#6A8BB5","#5E81AC","#5177A4","#456E9B","#38628F","#2F5984","#274F78","#20476D","#1B3F61","#173653","#142E48","#12283E","#112233","#111D2A","#121921","#15181B","#181A18","#1E1D17","#252419","#2D2B1C","#353220","#3E3A25","#46422A","#514C31","#5A5536","#645E3C","#6D6741","#777047","#837B4F","#8D8556","#988F5E","#A29A67","#ADA470","#B9B17D","#C3BC89","#CDC795","#D7D2A2","#E0DCAF","#ECE9BE","#F5F4CB","#FFFFD9"]},managua:{discrete:["#FFCF67","#F9C564","#F3BB60","#EBB05D","#E5A659","#DF9D56","#D99554","#D38C51","#CC824D","#C67B4B","#C07348","#B96C46","#B36444","#AB5C41","#A4553F","#9D4F3D","#95483C","#8E423A","#843B39","#7C3639","#743139","#6D2D3A","#662A3D","#5F2941","#5A2846","#552A4C","#522C53","#4F315D","#4D3566","#4C3B6F","#4C4179","#4C4883","#4D518E","#4F5897","#51609F","#5367A7","#556FAE","#5878B6","#5B80BC","#5E88C2","#6190C8","#6498CE","#68A3D5","#6BACDB","#6FB5E1","#72BEE6","#76C7EC","#7AD3F3","#7DDDF9","#81E7FF"],categorical:["#FFCF67","#F9C564","#F3BB60","#EBB05D","#E5A659","#DF9D56","#D99554","#D38C51","#CC824D","#C67B4B","#C07348","#B96C46","#B36444","#AB5C41","#A4553F","#9D4F3D","#95483C","#8E423A","#843B39","#7C3639","#743139","#6D2D3A","#662A3D","#5F2941","#5A2846","#552A4C","#522C53","#4F315D","#4D3566","#4C3B6F","#4C4179","#4C4883","#4D518E","#4F5897","#51609F","#5367A7","#556FAE","#5878B6","#5B80BC","#5E88C2","#6190C8","#6498CE","#68A3D5","#6BACDB","#6FB5E1","#72BEE6","#76C7EC","#7AD3F3","#7DDDF9","#81E7FF"]},navia:{discrete:["#031327","#041930","#051E3A","#052546","#062B50","#06315A","#073764","#083E6D","#0B4578","#0E4C80","#115286","#15588B","#195E8E","#1E6491","#216991","#246D91","#27718F","#2A748E","#2D788C","#307A8A","#337D89","#368087","#398385","#3C8683","#3F8981","#428C7F","#468F7D","#4A937A","#4E9678","#529A76","#579E73","#5BA271","#62A86E","#67AD6B","#6EB269","#76B768","#7FBD68","#8CC56A","#98CB6F","#A4D176","#B1D67F","#BCDB89","#C9E096","#D3E3A1","#DCE7AC","#E3EAB6","#EAEDBF","#F1F0CA","#F7F2D2","#FCF4D9"],categorical:["#031327","#FCF4D9","#408A80","#87C269","#1B608F","#59A072","#073966","#D1E39F","#2F798B","#EAEDBF","#052546","#266F90","#6BB06A","#0E4D81","#AED57D","#4C947A","#378186","#DFE8B0","#337D89","#2A748E","#14578A","#051C36","#9ACC70","#0A4374","#468F7D","#529A76","#F4F1CD","#062F56","#C1DC8D","#206891","#78B968","#62A86E","#3C8583","#569D74","#236C91","#F8F3D3","#D8E5A8","#0C487B","#04182E","#71B469","#B8D985","#07345E","#05213E","#4F9778","#5DA470","#3E8882","#062A4E","#7FBD68","#EFEFC6","#C9E096","#115286","#2C768D","#1E6491","#49917B","#66AC6C","#28718F","#A4D176","#90C76C","#438C7F","#175C8D","#083E6D","#E5EAB8","#317B8A","#357F87","#398385","#B3D781","#0D4A7E","#1C6290","#052342","#579F73","#9FCE73","#448D7E","#051A32","#FAF3D6","#428B7F","#29738F","#104F84","#5FA66F","#509877","#8CC56A","#094071","#2D788C","#083B6A","#D5E4A3","#2B758D","#226A91","#04162B","#BCDB89","#47907C","#4D9579","#E2E9B4","#7BBB68","#6EB269","#135488","#4A937A","#F1F0CA","#5BA271","#C5DE92","#F6F2D0","#CDE19B"]},naviaw:{discrete:["#041427","#051A31","#05203B","#062747","#072D52","#08345C","#0A3A66","#0C416F","#0F4979","#135080","#175686","#1B5D8A","#1F628D","#23698F","#276D8F","#2A728F","#2D758E","#30798D","#347D8B","#378089","#3A8388","#3D8686","#408984","#448C82","#489080","#4B937E","#50977C","#559C79","#5AA077","#5FA575","#65AA73","#6CAF71","#76B671","#7FBD71","#89C474","#95CB78","#A2D27F","#B1D98A","#BEDF95","#C9E5A1","#D3E9AD","#DBEDB9","#E4F1C6","#E9F4D0","#EEF6D9","#F2F8E1","#F6FAE9","#F9FCF1","#FCFDF7","#FEFEFD"],categorical:["#041427","#FBFDF6","#478F80","#9FD07D","#1F628D","#64A973","#E3F0C4","#0A3A66","#337C8B","#C7E49E","#7DBC71","#549B7A","#2A718F","#135080","#F2F8E1","#3C8586","#062747","#D7EBB2","#418A83","#B4DB8C","#2E778D","#6FB271","#EBF5D4","#0E4574","#051D37","#4D957D","#256B8F","#195A88","#388189","#F7FAEC","#5CA276","#8CC574","#073056","#31798C","#367E8A","#69AD72","#E7F3CC","#104A7A","#95CB78","#EFF6DB","#0B406D","#2C748E","#4A927F","#DDEEBB","#50987C","#165584","#589E78","#76B671","#3F8785","#05192F","#BEDF95","#448C82","#22678E","#06223F","#A9D684","#08355E","#CFE8A8","#F9FCF1","#286E8F","#85C172","#072C50","#F5F9E7","#1C5F8B","#3A8387","#60A675","#F3F9E4","#0C4271","#266D8F","#81BE72","#0A3D6A","#4B937E","#9ACD7B","#EDF5D7","#90C876","#A4D381","#378089","#1B5D8A","#489080","#145282","#DAECB6","#67AB73","#CBE6A3","#B9DD90","#3D8686","#23698F","#6CAF71","#FAFCF3","#79B971","#D3E9AD","#5AA077","#458E81","#72B471","#327B8C","#E5F1C8","#051B33","#F8FBEE","#062443","#398288","#2B728F","#06294C"]},nuuk:{discrete:["#05598C","#0E5B8B","#155C89","#1C5E87","#226085","#276184","#2C6383","#326682","#386982","#3E6C82","#446F82","#4A7283","#517584","#587A86","#5F7D88","#66818A","#6C858C","#73898E","#7B8E91","#819192","#879594","#8D9996","#939C97","#99A097","#9EA498","#A2A798","#A6AA97","#ABAD96","#AEAF95","#B1B194","#B3B492","#B6B690","#B8B88E","#BABA8C","#BDBC8A","#BFBE88","#C1C187","#C4C385","#C7C684","#CAC983","#CDCD83","#D2D184","#D7D787","#DDDD8B","#E3E290","#E8E895","#EEEE9C","#F4F4A4","#F9F9AB","#FEFEB2"],categorical:["#05598C","#FEFEB2","#A1A698","#537785","#C3C385","#B5B591","#7D8F91","#2D6483","#DDDD8B","#919B96","#BCBC8B","#3F6C82","#CDCD83","#1C5E87","#ADAE95","#68838B","#EEEE9C","#A7AA97","#879594","#C8C783","#F6F6A7","#135C89","#B9B98E","#497183","#73898E","#366882","#C0BF88","#D4D486","#99A097","#B1B293","#5E7D88","#256185","#E6E693","#829293","#788C90","#9DA398","#AAAC96","#E1E18F","#3B6A82","#638089","#B3B492","#A4A897","#446F82","#BABA8C","#D8D888","#185D88","#8C9895","#215F86","#BEBD89","#B7B78F","#CACA83","#4E7484","#C1C186","#959E97","#F2F2A1","#AFB094","#326682","#587A86","#296284","#FAFAAD","#6E868C","#C5C584","#D1D084","#0D5B8B","#E9E997","#DFDF8D","#66818A","#B0B194","#5B7B87","#2B6383","#859493","#CCCB83","#F8F8AA","#D2D285","#1F5F86","#70878D","#4B7383","#768B8F","#FCFCAF","#A9AB97","#BFBE88","#C9C983","#346782","#DBDA89","#236085","#BDBD8A","#BAB98D","#B8B88E","#2F6583","#939C97","#9FA498","#A2A798","#CFCF84","#B4B591","#C4C485","#979F97","#F0F09E","#155C89","#9BA298","#517584"]},oleron:{discrete:["#1A2659","#212E61","#293568","#323F72","#3A477A","#424F82","#4A578A","#535F92","#5D699C","#6572A5","#6E7BAE","#7784B7","#808DC0","#8B97CA","#94A1D3","#9DAADC","#A6B3E5","#AFBCEC","#B9C6F2","#C0CDF5","#C7D4F7","#CEDAF9","#D4E1FB","#DCE9FD","#E3F0FE","#1F4E00","#2C5100","#3A5600","#445900","#4F5C02","#5A6005","#65660C","#736D18","#7E7423","#8A7B2E","#94823A","#9F8945","#AC9253","#B79A5E","#C3A36A","#CEAC75","#D9B581","#E5C090","#EDC99D","#F2D2A9","#F6DAB5","#F8E2C0","#FAECCE","#FBF4DA","#FDFDE6"],categorical:["#1A2659","#212E61","#293568","#323F72","#3A477A","#424F82","#4A578A","#535F92","#5D699C","#6572A5","#6E7BAE","#7784B7","#808DC0","#8B97CA","#94A1D3","#9DAADC","#A6B3E5","#AFBCEC","#B9C6F2","#C0CDF5","#C7D4F7","#CEDAF9","#D4E1FB","#DCE9FD","#E3F0FE","#1F4E00","#2C5100","#3A5600","#445900","#4F5C02","#5A6005","#65660C","#736D18","#7E7423","#8A7B2E","#94823A","#9F8945","#AC9253","#B79A5E","#C3A36A","#CEAC75","#D9B581","#E5C090","#EDC99D","#F2D2A9","#F6DAB5","#F8E2C0","#FAECCE","#FBF4DA","#FDFDE6"]},oslo:{discrete:["#010101","#04070B","#060C13","#0A121B","#0C1620","#0D1927","#0E1D2D","#0F2133","#10263C","#112A43","#122E4A","#133251","#153758","#173C61","#194169","#1B4670","#1E4A78","#214F80","#255589","#295A91","#2E5F99","#3364A1","#3A6AA9","#4371B2","#4B77B9","#537DBE","#5B83C3","#6489C6","#6B8EC8","#7292C9","#7896C9","#7E9ACA","#859ECA","#8BA2C9","#91A6C9","#97A9C9","#9DADC9","#A4B2CA","#AAB6CA","#B1BBCB","#B8BFCD","#BFC5CF","#C7CCD3","#CFD2D8","#D7D9DD","#DEE0E2","#E6E7E9","#EFF0F1","#F7F7F8","#FFFFFF"],categorical:["#030609","#F9F9F9","#507BBC","#163B5E","#A0AFC9","#7B98CA","#27588E","#0E2032","#CACED5","#122D48","#3767A6","#1D4875","#8DA3C9","#E2E3E5","#678BC7","#B4BDCC","#0C151F","#BFC5CF","#97A9C9","#4371B2","#10263D","#080E16","#7292C9","#215081","#2E5F99","#AAB6CA","#ECEDEE","#0D1A28","#143454","#D5D8DC","#5B83C3","#19426A","#859ECA","#13314E","#0E1D2D","#3D6CAC","#6C8FC8","#7795C9","#F3F3F4","#4976B8","#245488","#DBDDE0","#112A43","#92A6C9","#C5C9D2","#809BCA","#0F2337","#3263A0","#050A10","#B9C1CD","#1F4C7B","#183E64","#A5B3CA","#0A121B","#9CACC9","#6187C5","#0D1824","#8AA1CA","#2A5B93","#547EBF","#D1D3D9","#E6E7E9","#1B456F","#B0BACB","#153758","#7494C9","#D8DADE","#6A8DC8","#90A5C9","#99ABC9","#235285","#133251","#060C13","#406EAF","#7E9ACA","#173C61","#4C78BA","#122F4B","#1C4772","#87A0CA","#CED1D7","#C2C7D1","#0F253A","#2C5D96","#C7CCD3","#112B45","#EFF0F1","#6F90C9","#0E1E2F","#ADB8CB","#7997CA","#4673B5","#15395B","#091018","#194067","#30619C","#94A8C9","#F6F6F6","#0F2135","#A3B1CA"]},roma:{discrete:["#7E1700","#832504","#883008","#8F3C0C","#934610","#984E14","#9C5717","#A05F1B","#A5681F","#A97023","#AD7826","#B0802B","#B58930","#BA9437","#BE9D3E","#C2A647","#C7B051","#CBBA5D","#CFC66D","#D1CF7B","#D2D78A","#D2DE98","#D0E4A6","#CBE8B4","#C4EABE","#BDEAC6","#B3E9CD","#A6E6D2","#9BE2D5","#8EDDD7","#81D7D7","#74CFD6","#64C6D5","#59BDD2","#4FB5D0","#46ACCC","#3EA4C9","#379AC5","#3292C2","#2E8ABF","#2B82BB","#287AB8","#2471B4","#2269B0","#1F60AD","#1C58A9","#194FA5","#1344A0","#0C3B9C","#033198"],categorical:["#7E1700","#832504","#883008","#8F3C0C","#934610","#984E14","#9C5717","#A05F1B","#A5681F","#A97023","#AD7826","#B0802B","#B58930","#BA9437","#BE9D3E","#C2A647","#C7B051","#CBBA5D","#CFC66D","#D1CF7B","#D2D78A","#D2DE98","#D0E4A6","#CBE8B4","#C4EABE","#BDEAC6","#B3E9CD","#A6E6D2","#9BE2D5","#8EDDD7","#81D7D7","#74CFD6","#64C6D5","#59BDD2","#4FB5D0","#46ACCC","#3EA4C9","#379AC5","#3292C2","#2E8ABF","#2B82BB","#287AB8","#2471B4","#2269B0","#1F60AD","#1C58A9","#194FA5","#1344A0","#0C3B9C","#033198"]},romao:{discrete:["#733957","#773850","#7A3849","#7E3942","#823C3D","#863F38","#8A4334","#8E4831","#94502E","#98572C","#9D5F2B","#A3672C","#A8712E","#AF7D32","#B58837","#BB933F","#C19F47","#C6AA52","#CDB761","#D1C26E","#D4CB7B","#D6D388","#D5D995","#D3DEA3","#CEE0AD","#C8E1B6","#C1E1BE","#B6DEC5","#ABDBC9","#A0D6CC","#94D0CE","#88C9CF","#7BC0CE","#70B8CD","#67AFCA","#5FA6C7","#589CC4","#5291BE","#4F88B9","#4E7EB3","#4F75AC","#516BA4","#55609A","#595891","#5D5087","#62497D","#664474","#6B3F69","#6F3B60","#723959"],categorical:["#733957","#773850","#7A3849","#7E3942","#823C3D","#863F38","#8A4334","#8E4831","#94502E","#98572C","#9D5F2B","#A3672C","#A8712E","#AF7D32","#B58837","#BB933F","#C19F47","#C6AA52","#CDB761","#D1C26E","#D4CB7B","#D6D388","#D5D995","#D3DEA3","#CEE0AD","#C8E1B6","#C1E1BE","#B6DEC5","#ABDBC9","#A0D6CC","#94D0CE","#88C9CF","#7BC0CE","#70B8CD","#67AFCA","#5FA6C7","#589CC4","#5291BE","#4F88B9","#4E7EB3","#4F75AC","#516BA4","#55609A","#595891","#5D5087","#62497D","#664474","#6B3F69","#6F3B60","#723959"]},tofino:{discrete:["#DED9FF","#D0CFF9","#C3C6F3","#B3BBEC","#A6B1E6","#98A8E1","#8B9FDB","#7E95D4","#6E89CB","#617FC3","#5575B8","#4A6BAC","#4262A0","#395790","#334F83","#2E4776","#293F6A","#24385D","#1F304F","#1B2943","#172338","#141D2E","#111824","#0F151B","#0D1516","#0D1712","#0F1B12","#112113","#142716","#162F19","#1A361C","#1D3E20","#224825","#26512A","#2A5A2E","#2E6233","#336C38","#39773E","#3F8144","#488B4A","#529551","#5FA059","#70AB63","#7FB46B","#8EBD73","#9DC57B","#ACCD83","#BDD68C","#CCDE94","#DBE69B"],categorical:["#DED9FF","#D0CFF9","#C3C6F3","#B3BBEC","#A6B1E6","#98A8E1","#8B9FDB","#7E95D4","#6E89CB","#617FC3","#5575B8","#4A6BAC","#4262A0","#395790","#334F83","#2E4776","#293F6A","#24385D","#1F304F","#1B2943","#172338","#141D2E","#111824","#0F151B","#0D1516","#0D1712","#0F1B12","#112113","#142716","#162F19","#1A361C","#1D3E20","#224825","#26512A","#2A5A2E","#2E6233","#336C38","#39773E","#3F8144","#488B4A","#529551","#5FA059","#70AB63","#7FB46B","#8EBD73","#9DC57B","#ACCD83","#BDD68C","#CCDE94","#DBE69B"]},tokyo:{discrete:["#1C0E34","#241036","#2D1339","#37163D","#3F1A40","#481E43","#4F2345","#562948","#5D304A","#62354C","#663B4D","#69404E","#6B454F","#6D4B50","#6E4F50","#6F5251","#6F5651","#705951","#715C52","#715F52","#716252","#726452","#726753","#736B53","#736E53","#747153","#757554","#757A54","#767E55","#778355","#788856","#798E57","#7B9558","#7C9B5A","#7EA25C","#81A95E","#84B062","#88B968","#8DC16E","#93CA76","#9BD27F","#A4DA8A","#AFE398","#BAEAA4","#C5EFB0","#CFF4BB","#D8F7C5","#E2F9CF","#E9FBD7","#EFFCDD"],categorical:["#1C0E34","#EFFCDD","#747053","#6C4750","#87B666","#B8E8A1","#512446","#715D52","#798B56","#7D9F5B","#37163D","#726653","#99D07D","#63374C","#6F5451","#D8F7C5","#767C54","#705951","#5B2D49","#7B9558","#441D41","#291238","#E5FAD2","#C9F1B4","#716252","#81AA5F","#683F4E","#736B53","#6E4E50","#757654","#8EC370","#A7DD8E","#778455","#747354","#84B062","#231036","#93CA76","#DFF9CC","#30143A","#A0D785","#7FA45D","#EAFBD8","#6A434F","#C1EDAB","#736D53","#562948","#6D4B50","#7A9057","#7C9A59","#4B2044","#715F52","#663B4D","#D1F4BD","#705651","#8ABD6A","#6E5151","#AFE398","#5F324B","#757954","#3E193F","#726853","#726452","#778055","#705B52","#788756","#61344C","#746E53","#ABE093","#532747","#85B364","#7EA25C","#261137","#736C53","#E8FBD5","#4E2245","#88B968","#798E57","#767E55","#726753","#757754","#715E52","#3A183E","#6E4F51","#778255","#7B9759","#DCF8C9","#EDFCDA","#411B40","#7D9C5A","#767B54","#726352","#6F5551","#726552","#82AD60","#D5F6C1","#34153C","#9CD481","#747454","#C5EFB0","#481E43"]},turku:{discrete:["#000000","#090908","#111110","#181816","#1D1D1A","#22221F","#272723","#2C2C27","#33322B","#38382F","#3D3D32","#424235","#474738","#4E4D3C","#53523E","#585841","#5D5D43","#626246","#686848","#6E6D4B","#73724D","#797750","#7F7D52","#878356","#8E8859","#968E5C","#9D9360","#A79864","#AF9C68","#B69F6C","#BEA270","#C4A474","#CCA579","#D1A67D","#D7A781","#DBA886","#E0A98B","#E6AB92","#EAAD98","#EFB09F","#F2B4A7","#F6B9AE","#F9BFB7","#FBC4BF","#FDC9C6","#FECFCC","#FED4D3","#FFDBDA","#FFE0E0","#FFE6E6"],categorical:["#070707","#FFE6E6","#948D5B","#E5AA90","#4D4C3B","#2C2C27","#C3A374","#6D6C4A","#FBC4BF","#D6A780","#F2B4A7","#1C1C19","#3D3D32","#AC9A67","#7E7C52","#FED6D4","#5D5D43","#35342D","#DDA888","#141312","#55543F","#242420","#FDCDCA","#F7BCB3","#898456","#B8A06D","#ECAE9B","#CDA57A","#FFDEDD","#646447","#454537","#9F9461","#76744E","#71704C","#30302A","#414135","#181816","#FCC8C4","#EFB1A1","#838054","#F5B8AD","#E1A98C","#C8A477","#686848","#595941","#20201D","#8E8859","#D1A67D","#B29D6A","#E9AC95","#BEA270","#FED1CF","#0E0E0D","#A59764","#DAA784","#282823","#F9C0B9","#51503D","#393930","#FFDAD9","#49493A","#606045","#FFE2E1","#9A915E","#797750","#F4B6AA","#F6BAB0","#CBA578","#FFD8D6","#FECFCC","#262622","#C0A272","#868255","#1A1A18","#FAC2BC","#8B8658","#E3AA8E","#161614","#4F4E3C","#C6A475","#2E2E28","#BBA16F","#6B6A49","#E7AB93","#CFA67C","#626246","#53523E","#5B5B42","#FED3D1","#7C7A51","#817E53","#73724D","#FFDCDB","#37372E","#F8BEB6","#0B0B0A","#575740","#DFA98A","#474738","#B59F6C"]},vanimo:{discrete:["#FFCDFD","#F7BEF2","#F0B0E8","#E6A0DC","#DE93D2","#D786C8","#CF7ABF","#C76FB5","#BD63AA","#B45AA1","#AB5198","#A1498E","#964184","#883977","#7C326B","#6E2C60","#612654","#542148","#451C3B","#391931","#2F1728","#281521","#22141C","#1D1417","#1A1414","#191612","#191811","#1B1D11","#1D2212","#212913","#253014","#2B3916","#324419","#384D1B","#3F561E","#456021","#4C6924","#547427","#5A7C2A","#60852E","#678E32","#6E9737","#77A33F","#7FAE47","#88BA51","#92C65D","#9CD26B","#A9E27F","#B3EF92","#BEFDA5"],categorical:["#FFCDFD","#F7BEF2","#F0B0E8","#E6A0DC","#DE93D2","#D786C8","#CF7ABF","#C76FB5","#BD63AA","#B45AA1","#AB5198","#A1498E","#964184","#883977","#7C326B","#6E2C60","#612654","#542148","#451C3B","#391931","#2F1728","#281521","#22141C","#1D1417","#1A1414","#191612","#191811","#1B1D11","#1D2212","#212913","#253014","#2B3916","#324419","#384D1B","#3F561E","#456021","#4C6924","#547427","#5A7C2A","#60852E","#678E32","#6E9737","#77A33F","#7FAE47","#88BA51","#92C65D","#9CD26B","#A9E27F","#B3EF92","#BEFDA5"]},vik:{discrete:["#001261","#011A66","#02226B","#022B71","#023376","#023A7B","#034280","#034A85","#06548B","#0B5D91","#136697","#1E6F9D","#2B79A4","#3C85AC","#4B90B3","#5A9ABA","#6AA4C1","#7AAEC8","#8DBAD0","#9DC4D6","#ADCDDD","#BDD6E3","#CCDFE8","#DEE6E9","#E8E7E5","#EEE3DC","#EEDBD0","#EBD0C0","#E7C6B2","#E3BCA5","#DFB298","#DBA88B","#D69D7C","#D29470","#CE8B64","#CA8258","#C6794C","#C26E3F","#BE6533","#B85C28","#B2511D","#A94512","#9C3709","#912D06","#872406","#7E1D06","#741506","#6A0D07","#620607","#590008"],categorical:["#001261","#011A66","#02226B","#022B71","#023376","#023A7B","#034280","#034A85","#06548B","#0B5D91","#136697","#1E6F9D","#2B79A4","#3C85AC","#4B90B3","#5A9ABA","#6AA4C1","#7AAEC8","#8DBAD0","#9DC4D6","#ADCDDD","#BDD6E3","#CCDFE8","#DEE6E9","#E8E7E5","#EEE3DC","#EEDBD0","#EBD0C0","#E7C6B2","#E3BCA5","#DFB298","#DBA88B","#D69D7C","#D29470","#CE8B64","#CA8258","#C6794C","#C26E3F","#BE6533","#B85C28","#B2511D","#A94512","#9C3709","#912D06","#872406","#7E1D06","#741506","#6A0D07","#620607","#590008"]},viko:{discrete:["#4F1A3D","#4B1D43","#48214A","#432653","#3F2C5B","#3C3263","#38396C","#354174","#334B7F","#345487","#365E8F","#3B6797","#42719E","#4D7DA6","#5787AD","#6391B4","#709ABA","#7DA4BF","#8EAEC4","#9BB5C7","#A9BBC8","#B5C0C8","#C0C2C5","#CBC2BF","#D2C0B8","#D6BDAF","#D9B7A6","#D9AF99","#D8A88D","#D6A082","#D39776","#CF8D6B","#C8825D","#C27752","#BB6D47","#B3623D","#AA5633","#9F492A","#953E25","#8C3521","#822C1F","#7A251E","#721F1F","#6B1A21","#661824","#611627","#5C152B","#571631","#531736","#50193C"],categorical:["#4F1A3D","#4B1D43","#48214A","#432653","#3F2C5B","#3C3263","#38396C","#354174","#334B7F","#345487","#365E8F","#3B6797","#42719E","#4D7DA6","#5787AD","#6391B4","#709ABA","#7DA4BF","#8EAEC4","#9BB5C7","#A9BBC8","#B5C0C8","#C0C2C5","#CBC2BF","#D2C0B8","#D6BDAF","#D9B7A6","#D9AF99","#D8A88D","#D6A082","#D39776","#CF8D6B","#C8825D","#C27752","#BB6D47","#B3623D","#AA5633","#9F492A","#953E25","#8C3521","#822C1F","#7A251E","#721F1F","#6B1A21","#661824","#611627","#5C152B","#571631","#531736","#50193C"]}};function Fs(e){const t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}const Ss={waves:"batlow",blksand:"tokyo",breeze:"imola",magma:"batlow",ribbon:"hawaii",stars:"batlow",folds:"imola"},Ms={[As.ADVERT]:1,[As.TXT_MSG]:4,[As.GRP_TXT]:2,[As.RESPONSE]:8,[As.REQ]:13,[As.ANON_REQ]:7,[As.ACK]:11,[As.PATH]:24,[As.TRACE]:16,[As.GRP_DATA]:34,[As.MULTIPART]:52,[As.RAW_CUSTOM]:14};function js(){let e="breeze dark",t=!0;if("undefined"!=typeof window){e=localStorage.getItem("pymc-theme-id")||"breeze dark";const n=W(e);t=(null==n?void 0:n.meta.isDark)??!0}const n=Ss[e]??"batlow",a=Bs[n],s=a.discrete.length,r=Math.floor(s/2);return{colormap:a,colormapName:n,isDark:t,baseIndex:t?r:0,halfSize:r}}let Ts=null;function Ps(e){const{colormap:t,isDark:n}=js();if("number"!=typeof e)return n?"#A5A5A5":"#666666";const a=Ms[e];if(void 0===a)return n?"#A5A5A5":"#666666";const s=t.categorical;return s[Math.min(a,s.length-1)]}function Ls(e){const t=Ps(e);return null===Ts&&(Ts=z()),Ts?function(e){return z()?N(e):e}(t):t}function Rs(e){return Fs(Ps(e))}function Ns(e){return null==e?"UNKNOWN":xs[e]||`TYPE_${e}`}function zs(e){return null==e?"UNKNOWN":Ds[e]||`ROUTE_${e}`}function _s(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function Is(e){const t=function(e){const t=e.replace("#",""),n=parseInt(t.slice(0,2),16)/255,a=parseInt(t.slice(2,4),16)/255,s=parseInt(t.slice(4,6),16)/255,r=e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4);return.2126*r(n)+.7152*r(a)+.0722*r(s)}(e);return _s(t,1)>_s(t,0)?"light":"dark"}function Vs(e){return 1===e||!0===e}const Os=i("inline-flex items-center gap-1","radius-badge px-1.5 py-0.5","text-xs"),$s={fontFamily:"var(--font-badge)",fontWeight:"var(--font-badge-weight)",textTransform:"var(--badge-text-transform, none)"},qs={red:"var(--sys-red)",orange:"var(--sys-orange)",amber:"var(--sys-amber)",yellow:"var(--sys-yellow)",lime:"var(--sys-green)",green:"var(--sys-green)",emerald:"var(--sys-green)",teal:"var(--sys-teal)",cyan:"var(--sys-cyan)",sky:"var(--sys-cyan)",blue:"var(--sys-blue)",indigo:"var(--sys-indigo)",violet:"var(--sys-indigo)",purple:"var(--sys-purple)",fuchsia:"var(--sys-pink)",pink:"var(--sys-pink)",rose:"var(--sys-red)",brown:"var(--sys-brown)",zinc:"var(--fg-muted)"};function Us(e){if(!e.startsWith("var("))return e;if("undefined"!=typeof window){const t=e.match(/var\((--[^,)]+)/);if(t){const e=getComputedStyle(document.documentElement).getPropertyValue(t[1]).trim();if(e&&e.startsWith("#"))return e}}return"#666666"}function Ws({color:e="zinc",customColor:t,filled:n=!1,compact:a=!1,className:o,title:l,children:c}){const u=s.useMemo(()=>{const a=t??qs[e];if(n){if(t){const e=Is(Us(t));return{backgroundColor:t,color:"light"===e?"rgba(255,255,255,0.95)":"rgba(0,0,0,0.85)"}}return{backgroundColor:a,color:["amber","yellow","lime"].includes(e)?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.95)"}}return{backgroundColor:`color-mix(in srgb, ${a} 15%, transparent)`,color:a}},[e,t,n]);return r.jsx("span",{className:i(Os,a&&"!px-1 !py-0 !text-[10px]",o),style:{...$s,...u},"data-color":e,title:l,children:c})}const Hs=s.forwardRef(function({color:e="zinc",customColor:t,filled:n=!1,compact:a=!1,className:o,children:c,...u},d){const h=s.useMemo(()=>{const a=t??qs[e];if(n){if(t){const e=Is(Us(t));return{backgroundColor:t,color:"light"===e?"rgba(255,255,255,0.95)":"rgba(0,0,0,0.85)"}}return{backgroundColor:a,color:["amber","yellow","lime"].includes(e)?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.95)"}}return{backgroundColor:`color-mix(in srgb, ${a} 15%, transparent)`,color:a}},[e,t,n]),m=i(Os,a&&"!px-1 !py-0 !text-[10px]","interactive hover-opacity",o);return"href"in u&&void 0!==u.href?r.jsx(ks,{...u,ref:d,className:m,style:{...$s,...h},children:c}):r.jsx(l,{...u,ref:d,className:m,style:{...$s,...h},children:c})}),Ys=i("relative inline-flex items-center justify-center gap-2","text-sm font-medium whitespace-nowrap","radius-inner px-3 py-1.5","ring-focus","disabled:opacity-40 disabled:pointer-events-none disabled:cursor-not-allowed","transition-base","[&>[data-slot=icon]]:w-4 [&>[data-slot=icon]]:h-4 [&>[data-slot=icon]]:shrink-0"),Gs={primary:i("bg-sys-blue text-white","hover:bg-sys-blue","active:bg-sys-blue/80","border-[1.5px] border-sys-blue"),success:i("bg-sys-green text-white","hover:bg-sys-green","active:bg-sys-green/80","border-[1.5px] border-sys-green"),danger:i("bg-sys-red text-white","hover:bg-sys-red","active:bg-sys-red/80","border-[1.5px] border-sys-red"),warning:i("bg-sys-indigo text-bg-body","hover:bg-sys-indigo","active:bg-sys-indigo/80","border-[1.5px] border-sys-indigo"),muted:i("bg-elevated text-fg-primary","hover:bg-subtle","active:bg-elevated","border-[1.5px] border-edge-subtle")},Ks={primary:i("bg-transparent text-sys-blue","border-[1.5px] border-sys-blue","hover:bg-sys-blue hover:text-white hover:border-sys-blue","active:bg-sys-blue/90 active:text-white"),success:i("bg-transparent text-sys-green","border-[1.5px] border-sys-green","hover:bg-sys-green hover:text-white hover:border-sys-green","active:bg-sys-green/90 active:text-white"),danger:i("bg-transparent text-sys-red","border-[1.5px] border-sys-red","hover:bg-sys-red hover:text-white hover:border-sys-red","active:bg-sys-red/90 active:text-white"),warning:i("bg-transparent text-sys-indigo","border-[1.5px] border-sys-indigo","hover:bg-sys-indigo hover:text-bg-body hover:border-sys-indigo","active:bg-sys-indigo/90 active:text-bg-body"),muted:i("bg-transparent text-fg-muted","border-[1.5px] border-edge-subtle","hover:bg-subtle hover:text-fg-primary hover:border-edge-strong","active:bg-elevated")},Xs={primary:i("bg-transparent text-sys-blue border-transparent","hover:bg-sys-blue hover:text-white","active:bg-sys-blue/90 active:text-white"),success:i("bg-transparent text-sys-green border-transparent","hover:bg-sys-green hover:text-white","active:bg-sys-green/90 active:text-white"),danger:i("bg-transparent text-sys-red border-transparent","hover:bg-sys-red hover:text-white","active:bg-sys-red/90 active:text-white"),warning:i("bg-transparent text-sys-indigo border-transparent","hover:bg-sys-indigo hover:text-bg-body","active:bg-sys-indigo/90 active:text-bg-body"),muted:i("bg-transparent text-fg-muted border-transparent","hover:bg-subtle hover:text-fg-primary","active:bg-elevated")},Js=s.forwardRef(function({color:e="muted",outline:t=!1,plain:n=!1,className:a,children:s,...o},c){const u=i(Ys,n?Xs[e]:t?Ks[e]:Gs[e],a);return"href"in o&&void 0!==o.href?r.jsx(ks,{...o,ref:c,className:u,children:s}):r.jsx(l,{...o,ref:c,className:u,children:s})}),Zs=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},Qs=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),er=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var tr={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const nr=s.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:r="",children:o,iconNode:i,...l},c)=>s.createElement("svg",{ref:c,...tr,width:t,height:t,stroke:e,strokeWidth:a?24*Number(n)/Number(t):n,className:Qs("lucide",r),...!o&&!er(l)&&{"aria-hidden":"true"},...l},[...i.map(([e,t])=>s.createElement(e,t)),...Array.isArray(o)?o:[o]])),ar=(e,t)=>{const n=s.forwardRef(({className:n,...a},r)=>{return s.createElement(nr,{ref:r,iconNode:t,className:Qs(`lucide-${o=Zs(e),o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,n),...a});var o});return n.displayName=Zs(e),n},sr=ar("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]),rr=ar("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),or=ar("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),ir=ar("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),lr=ar("expand",[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}],["path",{d:"M3 16v5h5",key:"1t08am"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 8V3h5",key:"1ln10m"}],["path",{d:"M9 9 3 3",key:"v551iv"}]]),cr=ar("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),ur=ar("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]),dr=ar("ghost",[["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}],["path",{d:"M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z",key:"uwwb07"}]]),hr=ar("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),mr=ar("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]),pr=ar("layout-list",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]]),gr=ar("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),fr=ar("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]),yr=ar("map-pin-plus",[["path",{d:"M19.914 11.105A7.298 7.298 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"fcdtly"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}],["path",{d:"M19 15v6",key:"10aioa"}]]),br=ar("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]),vr=ar("messages-square",[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]]),wr=ar("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),Cr=ar("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]),kr=ar("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),xr=ar("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),Dr=ar("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]),Ar=ar("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),Er=ar("shrink",[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]]),Br=ar("sliders-vertical",[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]]),Fr=ar("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),Sr=ar("waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]),Mr=ar("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),jr=s.createContext({});function Tr(e){const t=s.useRef(null);return null===t.current&&(t.current=e()),t.current}const Pr="undefined"!=typeof window,Lr=Pr?s.useLayoutEffect:s.useEffect,Rr=s.createContext(null);function Nr(e,t){-1===e.indexOf(t)&&e.push(t)}function zr(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const _r=(e,t,n)=>n>t?t:n/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Or(e){return"object"==typeof e&&null!==e}const $r=e=>/^0[^.\s]+$/u.test(e);function qr(e){let t;return()=>(void 0===t&&(t=e()),t)}const Ur=e=>e,Wr=(e,t)=>n=>t(e(n)),Hr=(...e)=>e.reduce(Wr),Yr=(e,t,n)=>{const a=t-e;return 0===a?1:(n-e)/a};class Gr{constructor(){this.subscriptions=[]}add(e){return Nr(this.subscriptions,e),()=>zr(this.subscriptions,e)}notify(e,t,n){const a=this.subscriptions.length;if(a)if(1===a)this.subscriptions[0](e,t,n);else for(let s=0;s1e3*e,Xr=e=>e/1e3;function Jr(e,t){return t?e*(1e3/t):0}const Zr=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function Qr(e,t,n,a){if(e===t&&n===a)return Ur;return s=>0===s||1===s?s:Zr(function(e,t,n,a,s){let r,o,i=0;do{o=t+(n-t)/2,r=Zr(o,a,s)-e,r>0?n=o:t=o}while(Math.abs(r)>1e-7&&++i<12);return o}(s,0,1,e,n),t,a)}const eo=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,to=e=>t=>1-e(1-t),no=Qr(.33,1.53,.69,.99),ao=to(no),so=eo(ao),ro=e=>(e*=2)<1?.5*ao(e):.5*(2-Math.pow(2,-10*(e-1))),oo=e=>1-Math.sin(Math.acos(e)),io=to(oo),lo=eo(oo),co=Qr(.42,0,1,1),uo=Qr(0,0,.58,1),ho=Qr(.42,0,.58,1),mo=e=>Array.isArray(e)&&"number"!=typeof e[0],po=e=>Array.isArray(e)&&"number"==typeof e[0],go={linear:Ur,easeIn:co,easeInOut:ho,easeOut:uo,circIn:oo,circInOut:lo,circOut:io,backIn:ao,backInOut:so,backOut:no,anticipate:ro},fo=e=>{if(po(e)){e.length;const[t,n,a,s]=e;return Qr(t,n,a,s)}return"string"==typeof e?go[e]:e},yo=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function bo(e,t){let n=!1,a=!0;const s={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,o=yo.reduce((e,t)=>(e[t]=function(e){let t=new Set,n=new Set,a=!1,s=!1;const r=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function i(t){r.has(t)&&(l.schedule(t),e()),t(o)}const l={schedule:(e,s=!1,o=!1)=>{const i=o&&a?t:n;return s&&r.add(e),i.has(e)||i.add(e),e},cancel:e=>{n.delete(e),r.delete(e)},process:e=>{o=e,a?s=!0:(a=!0,[t,n]=[n,t],t.forEach(i),t.clear(),a=!1,s&&(s=!1,l.process(e)))}};return l}(r),e),{}),{setup:i,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:h,render:m,postRender:p}=o,g=()=>{const r=Ir.useManualTiming?s.timestamp:performance.now();n=!1,Ir.useManualTiming||(s.delta=a?1e3/60:Math.max(Math.min(r-s.timestamp,40),1)),s.timestamp=r,s.isProcessing=!0,i.process(s),l.process(s),c.process(s),u.process(s),d.process(s),h.process(s),m.process(s),p.process(s),s.isProcessing=!1,n&&t&&(a=!1,e(g))};return{schedule:yo.reduce((t,r)=>{const i=o[r];return t[r]=(t,r=!1,o=!1)=>(n||(n=!0,a=!0,s.isProcessing||e(g)),i.schedule(t,r,o)),t},{}),cancel:e=>{for(let t=0;t(void 0===xo&&Ao.set(Co.isProcessing||Ir.useManualTiming?Co.timestamp:performance.now()),xo),set:e=>{xo=e,queueMicrotask(Do)}},Eo=e=>t=>"string"==typeof t&&t.startsWith(e),Bo=Eo("--"),Fo=Eo("var(--"),So=e=>!!Fo(e)&&Mo.test(e.split("/*")[0].trim()),Mo=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function jo(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}const To={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},Po={...To,transform:e=>_r(0,1,e)},Lo={...To,default:1},Ro=e=>Math.round(1e5*e)/1e5,No=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,zo=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,_o=(e,t)=>n=>Boolean("string"==typeof n&&zo.test(n)&&n.startsWith(e)||t&&!function(e){return null==e}(n)&&Object.prototype.hasOwnProperty.call(n,t)),Io=(e,t,n)=>a=>{if("string"!=typeof a)return a;const[s,r,o,i]=a.match(No);return{[e]:parseFloat(s),[t]:parseFloat(r),[n]:parseFloat(o),alpha:void 0!==i?parseFloat(i):1}},Vo={...To,transform:e=>Math.round((e=>_r(0,255,e))(e))},Oo={test:_o("rgb","red"),parse:Io("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:a=1})=>"rgba("+Vo.transform(e)+", "+Vo.transform(t)+", "+Vo.transform(n)+", "+Ro(Po.transform(a))+")"},$o={test:_o("#"),parse:function(e){let t="",n="",a="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),a=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),a=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,a+=a,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(a,16),alpha:s?parseInt(s,16)/255:1}},transform:Oo.transform},qo=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),Uo=qo("deg"),Wo=qo("%"),Ho=qo("px"),Yo=qo("vh"),Go=qo("vw"),Ko=(()=>({...Wo,parse:e=>Wo.parse(e)/100,transform:e=>Wo.transform(100*e)}))(),Xo={test:_o("hsl","hue"),parse:Io("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:a=1})=>"hsla("+Math.round(e)+", "+Wo.transform(Ro(t))+", "+Wo.transform(Ro(n))+", "+Ro(Po.transform(a))+")"},Jo={test:e=>Oo.test(e)||$o.test(e)||Xo.test(e),parse:e=>Oo.test(e)?Oo.parse(e):Xo.test(e)?Xo.parse(e):$o.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?Oo.transform(e):Xo.transform(e),getAnimatableNone:e=>{const t=Jo.parse(e);return t.alpha=0,Jo.transform(t)}},Zo=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Qo="number",ei="color",ti=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ni(e){const t=e.toString(),n=[],a={color:[],number:[],var:[]},s=[];let r=0;const o=t.replace(ti,e=>(Jo.test(e)?(a.color.push(r),s.push(ei),n.push(Jo.parse(e))):e.startsWith("var(")?(a.var.push(r),s.push("var"),n.push(e)):(a.number.push(r),s.push(Qo),n.push(parseFloat(e))),++r,"${}")).split("${}");return{values:n,split:o,indexes:a,types:s}}function ai(e){return ni(e).values}function si(e){const{split:t,types:n}=ni(e),a=t.length;return e=>{let s="";for(let r=0;r"number"==typeof e?0:Jo.test(e)?Jo.getAnimatableNone(e):e,oi={test:function(e){var t,n;return isNaN(e)&&"string"==typeof e&&((null==(t=e.match(No))?void 0:t.length)||0)+((null==(n=e.match(Zo))?void 0:n.length)||0)>0},parse:ai,createTransformer:si,getAnimatableNone:function(e){const t=ai(e);return si(e)(t.map(ri))}};function ii(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function li(e,t){return n=>n>0?t:e}const ci=(e,t,n)=>e+(t-e)*n,ui=(e,t,n)=>{const a=e*e,s=n*(t*t-a)+a;return s<0?0:Math.sqrt(s)},di=[$o,Oo,Xo];function hi(e){const t=(n=e,di.find(e=>e.test(n)));var n;if(!Boolean(t))return!1;let a=t.parse(e);return t===Xo&&(a=function({hue:e,saturation:t,lightness:n,alpha:a}){e/=360,n/=100;let s=0,r=0,o=0;if(t/=100){const a=n<.5?n*(1+t):n+t-n*t,i=2*n-a;s=ii(i,a,e+1/3),r=ii(i,a,e),o=ii(i,a,e-1/3)}else s=r=o=n;return{red:Math.round(255*s),green:Math.round(255*r),blue:Math.round(255*o),alpha:a}}(a)),a}const mi=(e,t)=>{const n=hi(e),a=hi(t);if(!n||!a)return li(e,t);const s={...n};return e=>(s.red=ui(n.red,a.red,e),s.green=ui(n.green,a.green,e),s.blue=ui(n.blue,a.blue,e),s.alpha=ci(n.alpha,a.alpha,e),Oo.transform(s))},pi=new Set(["none","hidden"]);function gi(e,t){return n=>ci(e,t,n)}function fi(e){return"number"==typeof e?gi:"string"==typeof e?So(e)?li:Jo.test(e)?mi:vi:Array.isArray(e)?yi:"object"==typeof e?Jo.test(e)?mi:bi:li}function yi(e,t){const n=[...e],a=n.length,s=e.map((e,n)=>fi(e)(e,t[n]));return e=>{for(let t=0;t{for(const t in a)n[t]=a[t](e);return n}}const vi=(e,t)=>{const n=oi.createTransformer(t),a=ni(e),s=ni(t);return a.indexes.var.length===s.indexes.var.length&&a.indexes.color.length===s.indexes.color.length&&a.indexes.number.length>=s.indexes.number.length?pi.has(e)&&!s.values.length||pi.has(t)&&!a.values.length?function(e,t){return pi.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}(e,t):Hr(yi(function(e,t){const n=[],a={color:0,var:0,number:0};for(let s=0;s{const t=({timestamp:t})=>e(t);return{start:(e=!0)=>vo.update(t,e),stop:()=>wo(t),now:()=>Co.isProcessing?Co.timestamp:Ao.now()}},ki=(e,t,n=10)=>{let a="";const s=Math.max(Math.round(t/n),2);for(let r=0;r=xi?1/0:t}function Ai(e,t=100,n){const a=n({...e,keyframes:[0,t]}),s=Math.min(Di(a),xi);return{type:"keyframes",ease:e=>a.next(s*e).value/t,duration:Xr(s)}}function Ei(e,t,n){const a=Math.max(t-5,0);return Jr(n-e(a),t-a)}const Bi=.01,Fi=2,Si=.005,Mi=.5;const ji=12;function Ti(e,t){return e*Math.sqrt(1-t*t)}const Pi=["duration","bounce"],Li=["stiffness","damping","mass"];function Ri(e,t){return t.some(t=>void 0!==e[t])}function Ni(e=.3,t=.3){const n="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:a,restDelta:s}=n;const r=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],i={done:!1,value:r},{stiffness:l,damping:c,mass:u,duration:d,velocity:h,isResolvedFromDuration:m}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!Ri(e,Li)&&Ri(e,Pi))if(e.visualDuration){const n=e.visualDuration,a=2*Math.PI/(1.2*n),s=a*a,r=2*_r(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:1,stiffness:s,damping:r}}else{const n=function({duration:e=800,bounce:t=.3,velocity:n=0,mass:a=1}){let s,r,o=1-t;o=_r(.05,1,o),e=_r(.01,10,Xr(e)),o<1?(s=t=>{const a=t*o,s=a*e;return.001-(a-n)/Ti(t,o)*Math.exp(-s)},r=t=>{const a=t*o*e,r=a*n+n,i=Math.pow(o,2)*Math.pow(t,2)*e,l=Math.exp(-a),c=Ti(Math.pow(t,2),o);return(.001-s(t)>0?-1:1)*((r-i)*l)/c}):(s=t=>Math.exp(-t*e)*((t-n)*e+1)-.001,r=t=>Math.exp(-t*e)*(e*e*(n-t)));const i=function(e,t,n){let a=n;for(let s=1;s{const n=Math.exp(-g*y*t);return o-n*((p+g*y*f)/e*Math.sin(e*t)+f*Math.cos(e*t))}}else if(1===g)v=e=>o-Math.exp(-y*e)*(f+(p+y*f)*e);else{const e=y*Math.sqrt(g*g-1);v=t=>{const n=Math.exp(-g*y*t),a=Math.min(e*t,300);return o-n*((p+g*y*f)*Math.sinh(a)+e*f*Math.cosh(a))/e}}const w={calculatedDuration:m&&d||null,next:e=>{const t=v(e);if(m)i.done=e>=d;else{let n=0===e?p:0;g<1&&(n=0===e?Kr(p):Ei(v,e,t));const r=Math.abs(n)<=a,l=Math.abs(o-t)<=s;i.done=r&&l}return i.value=i.done?o:t,i},toString:()=>{const e=Math.min(Di(w),xi),t=ki(t=>w.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return w}function zi({keyframes:e,velocity:t=0,power:n=.8,timeConstant:a=325,bounceDamping:s=10,bounceStiffness:r=500,modifyTarget:o,min:i,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],h={done:!1,value:d},m=e=>void 0===i?l:void 0===l||Math.abs(i-e)-p*Math.exp(-e/a),b=e=>f+y(e),v=e=>{const t=y(e),n=b(e);h.done=Math.abs(t)<=c,h.value=h.done?f:n};let w,C;const k=e=>{var t;t=h.value,(void 0!==i&&tl)&&(w=e,C=Ni({keyframes:[h.value,m(h.value)],velocity:Ei(b,e,h.value),damping:s,stiffness:r,restDelta:c,restSpeed:u}))};return k(0),{calculatedDuration:null,next:e=>{let t=!1;return C||void 0!==w||(t=!0,v(e),k(e)),void 0!==w&&e>=w?C.next(e-w):(!t&&v(e),h)}}}function _i(e,t){const n=e[e.length-1];for(let a=1;a<=t;a++){const s=Yr(0,t,a);e.push(ci(n,1,s))}}function Ii(e){const t=[0];return _i(t,e.length-1),t}function Vi({duration:e=300,keyframes:t,times:n,ease:a="easeInOut"}){const s=mo(a)?a.map(fo):fo(a),r={done:!1,value:t[0]},o=function(e,t){return e.map(e=>e*t)}(n&&n.length===t.length?n:Ii(t),e),i=function(e,t,{clamp:n=!0,ease:a,mixer:s}={}){const r=e.length;if(t.length,1===r)return()=>t[0];if(2===r&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[r-1]&&(e=[...e].reverse(),t=[...t].reverse());const i=function(e,t,n){const a=[],s=n||Ir.mix||wi,r=e.length-1;for(let o=0;o{if(o&&n1)for(;ac(_r(e[0],e[r-1],t)):c}(o,t,{ease:Array.isArray(s)?s:(l=t,c=s,l.map(()=>c||ho).splice(0,l.length-1))});var l,c;return{calculatedDuration:e,next:t=>(r.value=i(t),r.done=t>=e,r)}}Ni.applyToOptions=e=>{const t=Ai(e,100,Ni);return e.ease=t.ease,e.duration=Kr(t.duration),e.type="keyframes",e};const Oi=e=>null!==e;function $i(e,{repeat:t,repeatType:n="loop"},a,s=1){const r=e.filter(Oi),o=s<0||t&&"loop"!==n&&t%2==1?0:r.length-1;return o&&void 0!==a?a:r[o]}const qi={decay:zi,inertia:zi,tween:Vi,keyframes:Vi,spring:Ni};function Ui(e){"string"==typeof e.type&&(e.type=qi[e.type])}class Wi{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}const Hi=e=>e/100;class Yi extends Wi{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var e,t;const{motionValue:n}=this.options;n&&n.updatedAt!==Ao.now()&&this.tick(Ao.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),null==(t=(e=this.options).onStop)||t.call(e))},this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){const{options:e}=this;Ui(e);const{type:t=Vi,repeat:n=0,repeatDelay:a=0,repeatType:s,velocity:r=0}=e;let{keyframes:o}=e;const i=t||Vi;i!==Vi&&"number"!=typeof o[0]&&(this.mixKeyframes=Hr(Hi,wi(o[0],o[1])),o=[0,100]);const l=i({...e,keyframes:o});"mirror"===s&&(this.mirroredGenerator=i({...e,keyframes:[...o].reverse(),velocity:-r})),null===l.calculatedDuration&&(l.calculatedDuration=Di(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+a,this.totalDuration=this.resolvedDuration*(n+1)-a,this.generator=l}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:n,totalDuration:a,mixKeyframes:s,mirroredGenerator:r,resolvedDuration:o,calculatedDuration:i}=this;if(null===this.startTime)return n.next(0);const{delay:l=0,keyframes:c,repeat:u,repeatType:d,repeatDelay:h,type:m,onUpdate:p,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-a/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const f=this.currentTime-l*(this.playbackSpeed>=0?1:-1),y=this.playbackSpeed>=0?f<0:f>a;this.currentTime=Math.max(f,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=a);let b=this.currentTime,v=n;if(u){const e=Math.min(this.currentTime,a)/o;let t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),1===n&&t--,t=Math.min(t,u+1),Boolean(t%2)&&("reverse"===d?(n=1-n,h&&(n-=h/o)):"mirror"===d&&(v=r)),b=_r(0,1,n)*o}const w=y?{done:!1,value:c[0]}:v.next(b);s&&(w.value=s(w.value));let{done:C}=w;y||null===i||(C=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const k=null===this.holdTime&&("finished"===this.state||"running"===this.state&&C);return k&&m!==zi&&(w.value=$i(c,this.options,g,this.speed)),p&&p(w.value),k&&this.finish(),w}then(e,t){return this.finished.then(e,t)}get duration(){return Xr(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Xr(e)}get time(){return Xr(this.currentTime)}set time(e){var t;e=Kr(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),null==(t=this.driver)||t.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(Ao.now());const t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Xr(this.currentTime))}play(){var e,t;if(this.isStopped)return;const{driver:n=Ci,startTime:a}=this.options;this.driver||(this.driver=n(e=>this.tick(e))),null==(t=(e=this.options).onPlay)||t.call(e);const s=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=s):null!==this.holdTime?this.startTime=s-this.holdTime:this.startTime||(this.startTime=a??s),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Ao.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,t;this.notifyFinished(),this.teardown(),this.state="finished",null==(t=(e=this.options).onComplete)||t.call(e)}cancel(){var e,t;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),null==(t=(e=this.options).onCancel)||t.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var t;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),null==(t=this.driver)||t.stop(),e.observe(this)}}const Gi=e=>180*e/Math.PI,Ki=e=>{const t=Gi(Math.atan2(e[1],e[0]));return Ji(t)},Xi={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Ki,rotateZ:Ki,skewX:e=>Gi(Math.atan(e[1])),skewY:e=>Gi(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Ji=e=>((e%=360)<0&&(e+=360),e),Zi=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Qi=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),el={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Zi,scaleY:Qi,scale:e=>(Zi(e)+Qi(e))/2,rotateX:e=>Ji(Gi(Math.atan2(e[6],e[5]))),rotateY:e=>Ji(Gi(Math.atan2(-e[2],e[0]))),rotateZ:Ki,rotate:Ki,skewX:e=>Gi(Math.atan(e[4])),skewY:e=>Gi(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function tl(e){return e.includes("scale")?1:0}function nl(e,t){if(!e||"none"===e)return tl(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,s;if(n)a=el,s=n;else{const t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=Xi,s=t}if(!s)return tl(t);const r=a[t],o=s[1].split(",").map(al);return"function"==typeof r?r(o):o[r]}function al(e){return parseFloat(e.trim())}const sl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],rl=(()=>new Set(sl))(),ol=e=>e===To||e===Ho,il=new Set(["x","y","z"]),ll=sl.filter(e=>!il.has(e)),cl={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>nl(t,"x"),y:(e,{transform:t})=>nl(t,"y")};cl.translateX=cl.x,cl.translateY=cl.y;const ul=new Set;let dl=!1,hl=!1,ml=!1;function pl(){if(hl){const e=Array.from(ul).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{const t=function(e){const t=[];return ll.forEach(n=>{const a=e.getValue(n);void 0!==a&&(t.push([n,a.get()]),a.set(n.startsWith("scale")?1:0))}),t}(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();const t=n.get(e);t&&t.forEach(([t,n])=>{var a;null==(a=e.getValue(t))||a.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}hl=!1,dl=!1,ul.forEach(e=>e.complete(ml)),ul.clear()}function gl(){ul.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(hl=!0)})}class fl{constructor(e,t,n,a,s,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=a,this.element=s,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?(ul.add(this),dl||(dl=!0,vo.read(gl),vo.resolveKeyframes(pl))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:n,motionValue:a}=this;if(null===e[0]){const s=null==a?void 0:a.get(),r=e[e.length-1];if(void 0!==s)e[0]=s;else if(n&&t){const a=n.readValue(t,r);null!=a&&(e[0]=a)}void 0===e[0]&&(e[0]=r),a&&void 0===s&&a.set(e[0])}!function(e){for(let t=1;tvoid 0!==window.ScrollTimeline),bl={};function vl(e,t){const n=qr(e);return()=>bl[t]??n()}const wl=vl(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),Cl=([e,t,n,a])=>`cubic-bezier(${e}, ${t}, ${n}, ${a})`,kl={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Cl([0,.65,.55,1]),circOut:Cl([.55,0,1,.45]),backIn:Cl([.31,.01,.66,-.59]),backOut:Cl([.33,1.53,.69,.99])};function xl(e,t){return e?"function"==typeof e?wl()?ki(e,t):"ease-out":po(e)?Cl(e):Array.isArray(e)?e.map(e=>xl(e,t)||kl.easeOut):kl[e]:void 0}function Dl(e,t,n,{delay:a=0,duration:s=300,repeat:r=0,repeatType:o="loop",ease:i="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const d=xl(i,s);Array.isArray(d)&&(u.easing=d);const h={delay:a,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:r+1,direction:"reverse"===o?"alternate":"normal"};return c&&(h.pseudoElement=c),e.animate(u,h)}function Al(e){return"function"==typeof e&&"applyToOptions"in e}class El extends Wi{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:n,keyframes:a,pseudoElement:s,allowFlatten:r=!1,finalKeyframe:o,onComplete:i}=e;this.isPseudoElement=Boolean(s),this.allowFlatten=r,this.options=e,e.type;const l=function({type:e,...t}){return Al(e)&&wl()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=Dl(t,n,a,l,s),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const e=$i(a,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(e):function(e,t,n){(e=>e.startsWith("--"))(t)?e.style.setProperty(t,n):e.style[t]=n}(t,n,e),this.animation.cancel()}null==i||i(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,t;null==(t=(e=this.animation).finish)||t.call(e)}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,t;this.isPseudoElement||null==(t=(e=this.animation).commitStyles)||t.call(e)}get duration(){var e,t;const n=(null==(t=null==(e=this.animation.effect)?void 0:e.getComputedTiming)?void 0:t.call(e).duration)||0;return Xr(Number(n))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Xr(e)}get time(){return Xr(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Kr(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){var n;return this.allowFlatten&&(null==(n=this.animation.effect)||n.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&yl()?(this.animation.timeline=e,Ur):t(this)}}const Bl={anticipate:ro,backInOut:so,circInOut:lo};class Fl extends El{constructor(e){var t;"string"==typeof(t=e).ease&&t.ease in Bl&&(t.ease=Bl[t.ease]),Ui(e),super(e),void 0!==e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:n,onComplete:a,element:s,...r}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);const o=new Yi({...r,autoplay:!1}),i=Math.max(10,Ao.now()-this.startTime),l=_r(0,10,i-10);t.setWithVelocity(o.sample(Math.max(0,i-l)).value,o.sample(i).value,l),o.stop()}}const Sl=(e,t)=>!("zIndex"===t||"number"!=typeof e&&!Array.isArray(e)&&("string"!=typeof e||!oi.test(e)&&"0"!==e||e.startsWith("url(")));function Ml(e){e.duration=0,e.type="keyframes"}const jl=new Set(["opacity","clipPath","filter","transform"]),Tl=qr(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class Pl extends Wi{constructor({autoplay:e=!0,delay:t=0,type:n="keyframes",repeat:a=0,repeatDelay:s=0,repeatType:r="loop",keyframes:o,name:i,motionValue:l,element:c,...u}){var d;super(),this.stop=()=>{var e,t;this._animation&&(this._animation.stop(),null==(e=this.stopTimeline)||e.call(this)),null==(t=this.keyframeResolver)||t.cancel()},this.createdAt=Ao.now();const h={autoplay:e,delay:t,type:n,repeat:a,repeatDelay:s,repeatType:r,name:i,motionValue:l,element:c,...u},m=(null==c?void 0:c.KeyframeResolver)||fl;this.keyframeResolver=new m(o,(e,t,n)=>this.onKeyframesResolved(e,t,h,!n),i,l,c),null==(d=this.keyframeResolver)||d.scheduleResolve()}onKeyframesResolved(e,t,n,a){var s,r;this.keyframeResolver=void 0;const{name:o,type:i,velocity:l,delay:c,isHandoff:u,onUpdate:d}=n;this.resolvedAt=Ao.now(),function(e,t,n,a){const s=e[0];if(null===s)return!1;if("display"===t||"visibility"===t)return!0;const r=e[e.length-1],o=Sl(s,t),i=Sl(r,t);return!(!o||!i)&&(function(e){const t=e[0];if(1===e.length)return!0;for(let n=0;n40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},m=!u&&function(e){var t;const{motionValue:n,name:a,repeatDelay:s,repeatType:r,damping:o,type:i}=e;if(!((null==(t=null==n?void 0:n.owner)?void 0:t.current)instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=n.owner.getProps();return Tl()&&a&&jl.has(a)&&("transform"!==a||!c)&&!l&&!s&&"mirror"!==r&&0!==o&&"inertia"!==i}(h),p=null==(r=null==(s=h.motionValue)?void 0:s.owner)?void 0:r.current,g=m?new Fl({...h,element:p}):new Yi(h);g.finished.then(()=>{this.notifyFinished()}).catch(Ur),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||(null==(e=this.keyframeResolver)||e.resume(),ml=!0,gl(),pl(),ml=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),null==(e=this.keyframeResolver)||e.cancel()}}function Ll(e,t,n,a=0,s=1){const r=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,i=(o-1)*a;return"function"==typeof n?n(r,o):1===s?r*a:i-r*a}const Rl=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Nl(e,t,n=1){const[a,s]=function(e){const t=Rl.exec(e);if(!t)return[,];const[,n,a,s]=t;return[`--${n??a}`,s]}(e);if(!a)return;const r=window.getComputedStyle(t).getPropertyValue(a);if(r){const e=r.trim();return Vr(e)?parseFloat(e):e}return So(s)?Nl(s,t,n+1):s}const zl={type:"spring",stiffness:500,damping:25,restSpeed:10},_l={type:"keyframes",duration:.8},Il={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Vl=e=>null!==e;function Ol(e,t){return(null==e?void 0:e[t])??(null==e?void 0:e.default)??e}const $l=(e,t,n,a={},s,r)=>o=>{const i=Ol(a,e)||{},l=i.delay||a.delay||0;let{elapsed:c=0}=a;c-=Kr(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...i,delay:-c,onUpdate:e=>{t.set(e),i.onUpdate&&i.onUpdate(e)},onComplete:()=>{o(),i.onComplete&&i.onComplete()},name:e,motionValue:t,element:r?void 0:s};(function({when:e,delay:t,delayChildren:n,staggerChildren:a,staggerDirection:s,repeat:r,repeatType:o,repeatDelay:i,from:l,elapsed:c,...u}){return!!Object.keys(u).length})(i)||Object.assign(u,((e,{keyframes:t})=>t.length>2?_l:rl.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:zl:Il)(e,u)),u.duration&&(u.duration=Kr(u.duration)),u.repeatDelay&&(u.repeatDelay=Kr(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let d=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(Ml(u),0===u.delay&&(d=!0)),(Ir.instantAnimations||Ir.skipAnimations)&&(d=!0,Ml(u),u.delay=0),u.allowFlatten=!i.type&&!i.ease,d&&!r&&void 0!==t.get()){const e=function(e,{repeat:t,repeatType:n="loop"}){const a=e.filter(Vl);return a[t&&"loop"!==n&&t%2==1?0:a.length-1]}(u.keyframes,i);if(void 0!==e)return void vo.update(()=>{u.onUpdate(e),u.onComplete()})}return i.isSync?new Yi(u):new Pl(u)};function ql(e){const t=[{},{}];return null==e||e.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function Ul(e,t,n,a){if("function"==typeof t){const[s,r]=ql(a);t=t(void 0!==n?n:e.custom,s,r)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){const[s,r]=ql(a);t=t(void 0!==n?n:e.custom,s,r)}return t}function Wl(e,t,n){const a=e.getProps();return Ul(a,t,void 0!==n?n:a.custom,e)}const Hl=new Set(["width","height","top","left","right","bottom",...sl]);class Yl{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{var t;const n=Ao.now();if(this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(null==(t=this.events.change)||t.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){var t;this.current=e,this.updatedAt=Ao.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=(t=this.current,!isNaN(parseFloat(t))))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new Gr);const n=this.events[e].add(t);return"change"===e?()=>{n(),vo.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;null==(e=this.events.change)||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Ao.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return Jr(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,t;null==(e=this.dependents)||e.clear(),null==(t=this.events.destroy)||t.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Gl(e,t){return new Yl(e,t)}const Kl=e=>Array.isArray(e);function Xl(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Gl(n))}function Jl(e){return Kl(e)?e[e.length-1]||0:e}function Zl(e,t){const n=Wl(e,t);let{transitionEnd:a={},transition:s={},...r}=n||{};r={...r,...a};for(const o in r)Xl(e,o,Jl(r[o]))}const Ql=e=>Boolean(e&&e.getVelocity);function ec(e,t){const n=e.getValue("willChange");if(a=n,Boolean(Ql(a)&&a.add))return n.add(t);if(!n&&Ir.WillChange){const n=new Ir.WillChange("auto");e.addValue("willChange",n),n.add(t)}var a}function tc(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const nc="data-"+tc("framerAppearId");function ac(e){return e.props[nc]}function sc({protectedKeys:e,needsAnimating:t},n){const a=e.hasOwnProperty(n)&&!0!==t[n];return t[n]=!1,a}function rc(e,t,{delay:n=0,transitionOverride:a,type:s}={}){let{transition:r=e.getDefaultTransition(),transitionEnd:o,...i}=t;a&&(r=a);const l=[],c=s&&e.animationState&&e.animationState.getState()[s];for(const u in i){const t=e.getValue(u,e.latestValues[u]??null),a=i[u];if(void 0===a||c&&sc(c,u))continue;const s={delay:n,...Ol(r||{},u)},o=t.get();if(void 0!==o&&!t.isAnimating&&!Array.isArray(a)&&a===o&&!s.velocity)continue;let d=!1;if(window.MotionHandoffAnimation){const t=ac(e);if(t){const e=window.MotionHandoffAnimation(t,u,vo);null!==e&&(s.startTime=e,d=!0)}}ec(e,u),t.start($l(u,t,a,e.shouldReduceMotion&&Hl.has(u)?{type:!1}:s,e,d));const h=t.animation;h&&l.push(h)}return o&&Promise.all(l).then(()=>{vo.update(()=>{o&&Zl(e,o)})}),l}function oc(e,t,n={}){var a;const s=Wl(e,t,"exit"===n.type?null==(a=e.presenceContext)?void 0:a.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(r=n.transitionOverride);const o=s?()=>Promise.all(rc(e,s,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(a=0)=>{const{delayChildren:s=0,staggerChildren:o,staggerDirection:i}=r;return function(e,t,n=0,a=0,s=0,r=1,o){const i=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),i.push(oc(l,t,{...o,delay:n+("function"==typeof a?0:a)+Ll(e.variantChildren,l,a,s,r)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(i)}(e,t,a,s,o,i,n)}:()=>Promise.resolve(),{when:l}=r;if(l){const[e,t]="beforeChildren"===l?[o,i]:[i,o];return e().then(()=>t())}return Promise.all([o(),i(n.delay)])}function ic(e,t,n={}){let a;if(e.notify("AnimationStart",t),Array.isArray(t)){const s=t.map(t=>oc(e,t,n));a=Promise.all(s)}else if("string"==typeof t)a=oc(e,t,n);else{const s="function"==typeof t?Wl(e,t,n.custom):t;a=Promise.all(rc(e,s,n))}return a.then(()=>{e.notify("AnimationComplete",t)})}const lc=e=>t=>t.test(e),cc=[To,Ho,Wo,Uo,Go,Yo,{test:e=>"auto"===e,parse:e=>e}],uc=e=>cc.find(lc(e));function dc(e){return"number"==typeof e?0===e:null===e||"none"===e||"0"===e||$r(e)}const hc=new Set(["brightness","contrast","saturate","opacity"]);function mc(e){const[t,n]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[a]=n.match(No)||[];if(!a)return e;const s=n.replace(a,"");let r=hc.has(t)?1:0;return a!==n&&(r*=100),t+"("+r+s+")"}const pc=/\b([a-z-]*)\(.*?\)/gu,gc={...oi,getAnimatableNone:e=>{const t=e.match(pc);return t?t.map(mc).join(" "):e}},fc={...To,transform:Math.round},yc={borderWidth:Ho,borderTopWidth:Ho,borderRightWidth:Ho,borderBottomWidth:Ho,borderLeftWidth:Ho,borderRadius:Ho,borderTopLeftRadius:Ho,borderTopRightRadius:Ho,borderBottomRightRadius:Ho,borderBottomLeftRadius:Ho,width:Ho,maxWidth:Ho,height:Ho,maxHeight:Ho,top:Ho,right:Ho,bottom:Ho,left:Ho,inset:Ho,insetBlock:Ho,insetBlockStart:Ho,insetBlockEnd:Ho,insetInline:Ho,insetInlineStart:Ho,insetInlineEnd:Ho,padding:Ho,paddingTop:Ho,paddingRight:Ho,paddingBottom:Ho,paddingLeft:Ho,paddingBlock:Ho,paddingBlockStart:Ho,paddingBlockEnd:Ho,paddingInline:Ho,paddingInlineStart:Ho,paddingInlineEnd:Ho,margin:Ho,marginTop:Ho,marginRight:Ho,marginBottom:Ho,marginLeft:Ho,marginBlock:Ho,marginBlockStart:Ho,marginBlockEnd:Ho,marginInline:Ho,marginInlineStart:Ho,marginInlineEnd:Ho,fontSize:Ho,backgroundPositionX:Ho,backgroundPositionY:Ho,rotate:Uo,rotateX:Uo,rotateY:Uo,rotateZ:Uo,scale:Lo,scaleX:Lo,scaleY:Lo,scaleZ:Lo,skew:Uo,skewX:Uo,skewY:Uo,distance:Ho,translateX:Ho,translateY:Ho,translateZ:Ho,x:Ho,y:Ho,z:Ho,perspective:Ho,transformPerspective:Ho,opacity:Po,originX:Ko,originY:Ko,originZ:Ho,zIndex:fc,fillOpacity:Po,strokeOpacity:Po,numOctaves:fc},bc={...yc,color:Jo,backgroundColor:Jo,outlineColor:Jo,fill:Jo,stroke:Jo,borderColor:Jo,borderTopColor:Jo,borderRightColor:Jo,borderBottomColor:Jo,borderLeftColor:Jo,filter:gc,WebkitFilter:gc},vc=e=>bc[e];function wc(e,t){let n=vc(e);return n!==gc&&(n=oi),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Cc=new Set(["auto","none","0"]);class kc extends fl{constructor(e,t,n,a,s){super(e,t,n,a,s,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let i=0;i{t.getValue(e).set(n)}),this.resolveNoneKeyframes()}}function xc(e,t,n){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let t=document;const a=(null==n?void 0:n[e])??t.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e).filter(e=>null!=e)}const Dc=(e,t)=>t&&"number"==typeof e?t.transform(e):e;function Ac(e){return Or(e)&&"offsetHeight"in e}const{schedule:Ec}=bo(queueMicrotask,!1),Bc={x:!1,y:!1};function Fc(){return Bc.x||Bc.y}function Sc(e,t){const n=xc(e),a=new AbortController;return[n,{passive:!0,...t,signal:a.signal},()=>a.abort()]}function Mc(e){return!("touch"===e.pointerType||Fc())}const jc=(e,t)=>!!t&&(e===t||jc(e,t.parentElement)),Tc=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary,Pc=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Lc(e){return Pc.has(e.tagName)||!0===e.isContentEditable}const Rc=new WeakSet;function Nc(e){return t=>{"Enter"===t.key&&e(t)}}function zc(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function _c(e){return Tc(e)&&!Fc()}function Ic(e){return Or(e)&&"ownerSVGElement"in e}function Vc(e){return Ic(e)&&"svg"===e.tagName}const Oc=[...cc,Jo,oi],$c=()=>({x:{min:0,max:0},y:{min:0,max:0}}),qc={current:null},Uc={current:!1},Wc="undefined"!=typeof window,Hc=new WeakMap;function Yc(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function Gc(e){return"string"==typeof e||Array.isArray(e)}const Kc=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Xc=["initial",...Kc];function Jc(e){return Yc(e.animate)||Xc.some(t=>Gc(e[t]))}function Zc(e){return Boolean(Jc(e)||e.variants)}const Qc=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let eu={};function tu(e){eu=e}class nu{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:a,blockInitialAnimation:s,visualState:r},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=fl,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const e=Ao.now();this.renderScheduledAtthis.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(Uc.current||function(){if(Uc.current=!0,Wc)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>qc.current=e.matches;e.addEventListener("change",t),t()}else qc.current=!1}(),this.shouldReduceMotion=qc.current),null==(t=this.parent)||t.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),wo(this.notifyUpdate),wo(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),null==(e=this.parent)||e.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=rl.has(e);n&&this.onBindTransform&&this.onBindTransform();const a=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&vo.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{a(),s&&s(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in eu){const t=eu[e];if(!t)continue;const{isEnabled:n,Feature:a}=t;if(!this.features[e]&&a&&n(this.props)&&(this.features[e]=new a(this)),this.features[e]){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let n=0;nt.variantChildren.delete(e)}addValue(e,t){const n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return void 0===n&&void 0!==t&&(n=Gl(null===t?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];var a;return null!=n&&("string"==typeof n&&(Vr(n)||$r(n))?n=parseFloat(n):(a=n,!Oc.find(lc(a))&&oi.test(t)&&(n=wc(e,t))),this.setBaseTarget(e,Ql(n)?n.get():n)),Ql(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:n}=this.props;let a;if("string"==typeof n||"object"==typeof n){const s=Ul(this.props,n,null==(t=this.presenceContext)?void 0:t.custom);s&&(a=s[e])}if(n&&void 0!==a)return a;const s=this.getBaseTargetFromProps(this.props,e);return void 0===s||Ql(s)?void 0!==this.initialValues[e]&&void 0===a?void 0:this.baseTarget[e]:s}on(e,t){return this.events[e]||(this.events[e]=new Gr),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Ec.render(this.render)}}class au extends nu{constructor(){super(...arguments),this.KeyframeResolver=kc}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){const n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Ql(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}class su{constructor(e){this.isMounted=!1,this.node=e}update(){}}function ru({top:e,left:t,right:n,bottom:a}){return{x:{min:t,max:n},y:{min:e,max:a}}}function ou(e){return void 0===e||1===e}function iu({scale:e,scaleX:t,scaleY:n}){return!ou(e)||!ou(t)||!ou(n)}function lu(e){return iu(e)||cu(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function cu(e){return uu(e.x)||uu(e.y)}function uu(e){return e&&"0%"!==e}function du(e,t,n){return n+t*(e-n)}function hu(e,t,n,a,s){return void 0!==s&&(e=du(e,s,a)),du(e,n,a)+t}function mu(e,t=0,n=1,a,s){e.min=hu(e.min,t,n,a,s),e.max=hu(e.max,t,n,a,s)}function pu(e,{x:t,y:n}){mu(e.x,t.translate,t.scale,t.originPoint),mu(e.y,n.translate,n.scale,n.originPoint)}const gu=.999999999999,fu=1.0000000000001;function yu(e,t){e.min=e.min+t,e.max=e.max+t}function bu(e,t,n,a,s=.5){mu(e,t,n,ci(e.min,e.max,s),a)}function vu(e,t){bu(e.x,t.x,t.scaleX,t.scale,t.originX),bu(e.y,t.y,t.scaleY,t.scale,t.originY)}function wu(e,t){return ru(function(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),a=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:a.y,right:a.x}}(e.getBoundingClientRect(),t))}const Cu={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ku=sl.length;function xu(e,t,n){const{style:a,vars:s,transformOrigin:r}=e;let o=!1,i=!1;for(const l in t){const e=t[l];if(rl.has(l))o=!0;else if(Bo(l))s[l]=e;else{const t=Dc(e,yc[l]);l.startsWith("origin")?(i=!0,r[l]=t):a[l]=t}}if(t.transform||(o||n?a.transform=function(e,t,n){let a="",s=!0;for(let r=0;r{if(!t.target)return e;if("string"==typeof e){if(!Ho.test(e))return e;e=parseFloat(e)}return`${Au(e,t.target.x)}% ${Au(e,t.target.y)}%`}},Bu={correct:(e,{treeScale:t,projectionDelta:n})=>{const a=e,s=oi.parse(e);if(s.length>5)return a;const r=oi.createTransformer(e),o="number"!=typeof s[0]?1:0,i=n.x.scale*t.x,l=n.y.scale*t.y;s[0+o]/=i,s[1+o]/=l;const c=ci(i,l,.5);return"number"==typeof s[2+o]&&(s[2+o]/=c),"number"==typeof s[3+o]&&(s[3+o]/=c),r(s)}},Fu={borderRadius:{...Eu,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Eu,borderTopRightRadius:Eu,borderBottomLeftRadius:Eu,borderBottomRightRadius:Eu,boxShadow:Bu};function Su(e){for(const t in e)Fu[t]=e[t],Bo(t)&&(Fu[t].isCSSVariable=!0)}function Mu(e,{layout:t,layoutId:n}){return rl.has(e)||e.startsWith("origin")||(t||void 0!==n)&&(!!Fu[e]||"opacity"===e)}function ju(e,t,n){var a;const s=e.style,r=null==t?void 0:t.style,o={};if(!s)return o;for(const i in s)(Ql(s[i])||r&&Ql(r[i])||Mu(i,e)||void 0!==(null==(a=null==n?void 0:n.getValue(i))?void 0:a.liveStyle))&&(o[i]=s[i]);return o}class Tu extends au{constructor(){super(...arguments),this.type="html",this.renderInstance=Du}readValueFromInstance(e,t){var n,a;if(rl.has(t))return(null==(n=this.projection)?void 0:n.isProjecting)?tl(t):((e,t)=>{const{transform:n="none"}=getComputedStyle(e);return nl(n,t)})(e,t);{const n=(a=e,window.getComputedStyle(a)),s=(Bo(t)?n.getPropertyValue(t):n[t])||0;return"string"==typeof s?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:t}){return wu(e,t)}build(e,t,n){xu(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return ju(e,t,n)}}const Pu={offset:"stroke-dashoffset",array:"stroke-dasharray"},Lu={offset:"strokeDashoffset",array:"strokeDasharray"},Ru=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Nu(e,{attrX:t,attrY:n,attrScale:a,pathLength:s,pathSpacing:r=1,pathOffset:o=0,...i},l,c,u){if(xu(e,i,c),l)return void(e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox));e.attrs=e.style,e.style={};const{attrs:d,style:h}=e;d.transform&&(h.transform=d.transform,delete d.transform),(h.transform||d.transformOrigin)&&(h.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),h.transform&&(h.transformBox=(null==u?void 0:u.transformBox)??"fill-box",delete d.transformBox);for(const m of Ru)void 0!==d[m]&&(h[m]=d[m],delete d[m]);void 0!==t&&(d.x=t),void 0!==n&&(d.y=n),void 0!==a&&(d.scale=a),void 0!==s&&function(e,t,n=1,a=0,s=!0){e.pathLength=1;const r=s?Pu:Lu;e[r.offset]=""+-a,e[r.array]=`${t} ${n}`}(d,s,r,o,!1)}const zu=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),_u=e=>"string"==typeof e&&"svg"===e.toLowerCase();function Iu(e,t,n){const a=ju(e,t,n);for(const s in e)(Ql(e[s])||Ql(t[s]))&&(a[-1!==sl.indexOf(s)?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s]=e[s]);return a}class Vu extends au{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=$c}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(rl.has(t)){const e=vc(t);return e&&e.default||0}return t=zu.has(t)?t:tc(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Iu(e,t,n)}build(e,t,n){Nu(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,a){!function(e,t,n,a){Du(e,t,void 0,a);for(const s in t.attrs)e.setAttribute(zu.has(s)?s:tc(s),t.attrs[s])}(e,t,0,a)}mount(e){this.isSVGTag=_u(e.tagName),super.mount(e)}}const Ou=Xc.length;function $u(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent&&$u(e.parent)||{};return void 0!==e.props.initial&&(t.initial=e.props.initial),t}const t={};for(let n=0;nPromise.all(t.map(({animation:t,options:n})=>ic(e,t,n)))}(e),n=Ku(),a=!0;const s=t=>(n,a)=>{var s;const r=Wl(e,a,"exit"===t?null==(s=e.presenceContext)?void 0:s.custom:void 0);if(r){const{transition:e,transitionEnd:t,...a}=r;n={...n,...a,...t}}return n};function r(r){const{props:o}=e,i=$u(e.parent)||{},l=[],c=new Set;let u={},d=1/0;for(let t=0;td&&g,w=!1;const C=Array.isArray(p)?p:[p];let k=C.reduce(s(h),{});!1===f&&(k={});const{prevResolvedValues:x={}}=m,D={...x,...k},A=t=>{v=!0,c.has(t)&&(w=!0,c.delete(t)),m.needsAnimating[t]=!0;const n=e.getValue(t);n&&(n.liveStyle=!1)};for(const e in D){const t=k[e],n=x[e];if(u.hasOwnProperty(e))continue;let a=!1;a=Kl(t)&&Kl(n)?!qu(t,n):t!==n,a?null!=t?A(e):c.add(e):void 0!==t&&c.has(e)?A(e):m.protectedKeys[e]=!0}m.prevProp=p,m.prevResolvedValues=k,m.isActive&&(u={...u,...k}),a&&e.blockInitialAnimation&&(v=!1);const E=y&&b;v&&(!E||w)&&l.push(...C.map(t=>{const n={type:h};if("string"==typeof t&&a&&!E&&e.manuallyAnimateOnMount&&e.parent){const{parent:a}=e,s=Wl(a,t);if(a.enteringChildren&&s){const{delayChildren:t}=s.transition||{};n.delay=Ll(a.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(c.size){const t={};if("boolean"!=typeof o.initial){const n=Wl(e,Array.isArray(o.initial)?o.initial[0]:o.initial);n&&n.transition&&(t.transition=n.transition)}c.forEach(n=>{const a=e.getBaseTarget(n),s=e.getValue(n);s&&(s.liveStyle=!0),t[n]=a??null}),l.push({animation:t})}let h=Boolean(l.length);return!a||!1!==o.initial&&o.initial!==o.animate||e.manuallyAnimateOnMount||(h=!1),a=!1,h?t(l):Promise.resolve()}return{animateChanges:r,setActive:function(t,a){var s;if(n[t].isActive===a)return Promise.resolve();null==(s=e.variantChildren)||s.forEach(e=>{var n;return null==(n=e.animationState)?void 0:n.setActive(t,a)}),n[t].isActive=a;const o=r(t);for(const e in n)n[e].protectedKeys={};return o},setAnimateFunction:function(n){t=n(e)},getState:()=>n,reset:()=>{n=Ku()}}}function Yu(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!qu(t,e)}function Gu(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ku(){return{animate:Gu(!0),whileInView:Gu(),whileHover:Gu(),whileTap:Gu(),whileDrag:Gu(),whileFocus:Gu(),exit:Gu()}}function Xu(e,t){e.min=t.min,e.max=t.max}function Ju(e,t){Xu(e.x,t.x),Xu(e.y,t.y)}function Zu(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Qu(e){return e.max-e.min}function ed(e,t,n,a=.5){e.origin=a,e.originPoint=ci(t.min,t.max,e.origin),e.scale=Qu(n)/Qu(t),e.translate=ci(n.min,n.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function td(e,t,n,a){ed(e.x,t.x,n.x,a?a.originX:void 0),ed(e.y,t.y,n.y,a?a.originY:void 0)}function nd(e,t,n){e.min=n.min+t.min,e.max=e.min+Qu(t)}function ad(e,t,n){e.min=t.min-n.min,e.max=e.min+Qu(t)}function sd(e,t,n){ad(e.x,t.x,n.x),ad(e.y,t.y,n.y)}function rd(e,t,n,a,s){return e=du(e-=t,1/n,a),void 0!==s&&(e=du(e,1/s,a)),e}function od(e,t,[n,a,s],r,o){!function(e,t=0,n=1,a=.5,s,r=e,o=e){if(Wo.test(t)&&(t=parseFloat(t),t=ci(o.min,o.max,t/100)-o.min),"number"!=typeof t)return;let i=ci(r.min,r.max,a);e===r&&(i-=t),e.min=rd(e.min,t,n,i,s),e.max=rd(e.max,t,n,i,s)}(e,t[n],t[a],t[s],t.scale,r,o)}const id=["x","scaleX","originX"],ld=["y","scaleY","originY"];function cd(e,t,n,a){od(e.x,t,id,n?n.x:void 0,a?a.x:void 0),od(e.y,t,ld,n?n.y:void 0,a?a.y:void 0)}function ud(e){return 0===e.translate&&1===e.scale}function dd(e){return ud(e.x)&&ud(e.y)}function hd(e,t){return e.min===t.min&&e.max===t.max}function md(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function pd(e,t){return md(e.x,t.x)&&md(e.y,t.y)}function gd(e){return Qu(e.x)/Qu(e.y)}function fd(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function yd(e){return[e("x"),e("y")]}const bd=["TopLeft","TopRight","BottomLeft","BottomRight"],vd=bd.length,wd=e=>"string"==typeof e?parseFloat(e):e,Cd=e=>"number"==typeof e||Ho.test(e);function kd(e,t){return void 0!==e[t]?e[t]:e.borderRadius}const xd=Ad(0,.5,io),Dd=Ad(.5,.95,Ur);function Ad(e,t,n){return a=>at?1:n(Yr(e,t,a))}function Ed(e,t,n){const a=Ql(e)?e:Gl(e);return a.start($l("",a,t,n)),a.animation}function Bd(e,t,n,a={passive:!0}){return e.addEventListener(t,n,a),()=>e.removeEventListener(t,n)}const Fd=(e,t)=>e.depth-t.depth;class Sd{constructor(){this.children=[],this.isDirty=!1}add(e){Nr(this.children,e),this.isDirty=!0}remove(e){zr(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Fd),this.isDirty=!1,this.children.forEach(e)}}function Md(e,t){const n=Ao.now(),a=({timestamp:s})=>{const r=s-n;r>=t&&(wo(a),e(r-t))};return vo.setup(a,!0),()=>wo(a)}function jd(e){return Ql(e)?e.get():e}class Td{constructor(){this.members=[]}add(e){Nr(this.members,e),e.scheduleRender()}remove(e){if(zr(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){const t=this.members.findIndex(t=>e===t);if(0===t)return!1;let n;for(let a=t;a>=0;a--){const e=this.members[a];if(!1!==e.isPresent){n=e;break}}return!!n&&(this.promote(n),!0)}promote(e,t){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender();const a=n.options.layoutDependency,s=e.options.layoutDependency;void 0!==a&&void 0!==s&&a===s||(e.resumeFrom=n,t&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0));const{crossfade:r}=e.options;!1===r&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:t,resumingFrom:n}=e;t.onExitComplete&&t.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Pd={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Ld=["","X","Y","Z"];let Rd=0;function Nd(e,t,n,a){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),a&&(a[e]=0))}function zd(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=ac(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:t,layoutId:a}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",vo,!(t||a))}const{parent:a}=e;a&&!a.hasCheckedOptimisedAppear&&zd(a)}function _d({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:a,resetTransform:s}){return class{constructor(e={},n=(null==t?void 0:t())){this.id=Rd++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Od),this.nodes.forEach(Gd),this.nodes.forEach(Kd),this.nodes.forEach($d)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let t=0;tthis.root.updateBlockedByResize=!1;vo.read(()=>{a=window.innerWidth}),e(t,()=>{const e=window.innerWidth;e!==a&&(a=e,this.root.updateBlockedByResize=!0,n&&n(),n=Md(s,250),Pd.hasAnimatedSinceResize&&(Pd.hasAnimatedSinceResize=!1,this.nodes.forEach(Yd)))})}n&&this.root.registerSharedNode(n,this),!1!==this.options.animate&&s&&(n||a)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:a})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const r=this.options.transition||s.getDefaultTransition()||th,{onLayoutAnimationStart:o,onLayoutAnimationComplete:i}=s.getProps(),l=!this.targetLayout||!pd(this.targetLayout,a),c=!t&&n;if(this.options.layoutRoot||this.resumeFrom||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const t={...Ol(r,"layout"),onPlay:o,onComplete:i};(s.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c)}else t||Yd(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=a})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),wo(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Xd),this.animationId++)}getTransformTemplate(){const{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&zd(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let s=0;s{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||Qu(this.snapshot.measuredBox.x)||Qu(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let n=0;ngu&&(t.x=1),t.ygu&&(t.y=1)}(this.layoutCorrected,this.treeScale,this.path,n),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:l}=t;l?(this.projectionDelta&&this.prevProjectionDelta?(Zu(this.prevProjectionDelta.x,this.projectionDelta.x),Zu(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),td(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===o&&this.treeScale.y===i&&fd(this.projectionDelta.x,this.prevProjectionDelta.x)&&fd(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){var t;if(null==(t=this.options.visualElement)||t.scheduleRender(),e){const e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(e,t=!1){const n=this.snapshot,a=n?n.latestValues:{},s={...this.latestValues},r={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;const o={x:{min:0,max:0},y:{min:0,max:0}},i=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),c=!l||l.members.length<=1,u=Boolean(i&&!c&&!0===this.options.crossfade&&!this.path.some(eh));let d;this.animationProgress=0,this.mixTargetDelta=t=>{const n=t/1e3;var l,h,m,p,g,f;Zd(r.x,e.x,n),Zd(r.y,e.y,n),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(sd(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,p=this.relativeTargetOrigin,g=o,f=n,Qd(m.x,p.x,g.x,f),Qd(m.y,p.y,g.y,f),d&&(l=this.relativeTarget,h=d,hd(l.x,h.x)&&hd(l.y,h.y))&&(this.isProjectionDirty=!1),d||(d={x:{min:0,max:0},y:{min:0,max:0}}),Ju(d,this.relativeTarget)),i&&(this.animationValues=s,function(e,t,n,a,s,r){s?(e.opacity=ci(0,n.opacity??1,xd(a)),e.opacityExit=ci(t.opacity??1,0,Dd(a))):r&&(e.opacity=ci(t.opacity??1,n.opacity??1,a));for(let o=0;o{Pd.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Gl(0)),this.currentAnimation=Ed(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const e=this.getLead();let{targetWithTransforms:t,target:n,layout:a,latestValues:s}=e;if(t&&n&&a){if(this!==e&&this.layout&&a&&rh(this.options.animationType,this.layout.layoutBox,a.layoutBox)){n=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const t=Qu(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;const a=Qu(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+a}Ju(t,n),vu(t,s),td(this.projectionDeltaWithTransform,this.layoutCorrected,t,s)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Td),this.sharedNodes.get(e).add(t);const n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){const e=this.getStack();return!e||e.lead===this}getLead(){var e;const{layoutId:t}=this.options;return t&&(null==(e=this.getStack())?void 0:e.lead)||this}getPrevLead(){var e;const{layoutId:t}=this.options;return t?null==(e=this.getStack())?void 0:e.prevLead:void 0}getStack(){const{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){const a=this.getStack();a&&a.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){const e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){const{visualElement:e}=this.options;if(!e)return;let t=!1;const{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;const a={};n.z&&Nd("z",e,a,this.animationValues);for(let s=0;s{var t;return null==(t=e.currentAnimation)?void 0:t.stop()}),this.root.nodes.forEach(Ud),this.root.sharedNodes.clear()}}}function Id(e){e.updateLayout()}function Vd(e){var t;const n=(null==(t=e.resumeFrom)?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:t,measuredBox:a}=e.layout,{animationType:s}=e.options,r=n.source!==e.layout.source;"size"===s?yd(e=>{const a=r?n.measuredBox[e]:n.layoutBox[e],s=Qu(a);a.min=t[e].min,a.max=a.min+s}):rh(s,n.layoutBox,t)&&yd(a=>{const s=r?n.measuredBox[a]:n.layoutBox[a],o=Qu(t[a]);s.max=s.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[a].max=e.relativeTarget[a].min+o)});const o={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};td(o,t,n.layoutBox);const i={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};r?td(i,e.applyTransform(a,!0),n.measuredBox):td(i,t,n.layoutBox);const l=!dd(o);let c=!1;if(!e.resumeFrom){const a=e.getClosestProjectingParent();if(a&&!a.resumeFrom){const{snapshot:s,layout:r}=a;if(s&&r){const o={x:{min:0,max:0},y:{min:0,max:0}};sd(o,n.layoutBox,s.layoutBox);const i={x:{min:0,max:0},y:{min:0,max:0}};sd(i,t,r.layoutBox),pd(o,i)||(c=!0),a.options.layoutRoot&&(e.relativeTarget=i,e.relativeTargetOrigin=o,e.relativeParent=a)}}}e.notifyListeners("didUpdate",{layout:t,snapshot:n,delta:i,layoutDelta:o,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function Od(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=Boolean(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function $d(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function qd(e){e.clearSnapshot()}function Ud(e){e.clearMeasurements()}function Wd(e){e.isLayoutDirty=!1}function Hd(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Yd(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Gd(e){e.resolveTargetDelta()}function Kd(e){e.calcProjection()}function Xd(e){e.resetSkewAndRotation()}function Jd(e){e.removeLeadSnapshot()}function Zd(e,t,n){e.translate=ci(t.translate,0,n),e.scale=ci(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Qd(e,t,n,a){e.min=ci(t.min,n.min,a),e.max=ci(t.max,n.max,a)}function eh(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}const th={duration:.45,ease:[.4,0,.1,1]},nh=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),ah=nh("applewebkit/")&&!nh("chrome/")?Math.round:Ur;function sh(e){e.min=ah(e.min),e.max=ah(e.max)}function rh(e,t,n){return"position"===e||"preserve-aspect"===e&&(a=gd(t),s=gd(n),!(Math.abs(a-s)<=.2));var a,s}function oh(e){var t;return e!==e.root&&(null==(t=e.scroll)?void 0:t.wasRoot)}const ih=_d({attachResizeListener:(e,t)=>Bd(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||(null==(e=document.body)?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||(null==(t=document.body)?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),lh=e=>!e.isLayoutDirty&&e.willUpdate(!1);function ch(){const e=new Set,t=new WeakMap,n=()=>e.forEach(lh);return{add:a=>{e.add(a),t.set(a,a.addEventListener("willUpdate",n))},remove:a=>{e.delete(a);const s=t.get(a);s&&(s(),t.delete(a)),n()},dirty:n}}const uh={current:void 0},dh=_d({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!uh.current){const e=new ih({});e.mount(window),e.setOptions({layoutScroll:!0}),uh.current=e}return uh.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),hh=s.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function mh(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}class ph extends s.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){const e=t.offsetParent,n=Ac(e)&&e.offsetWidth||0,a=Ac(e)&&e.offsetHeight||0,s=this.props.sizeRef.current;s.height=t.offsetHeight||0,s.width=t.offsetWidth||0,s.top=t.offsetTop,s.left=t.offsetLeft,s.right=n-s.width-s.left,s.bottom=a-s.height-s.top}return null}componentDidUpdate(){}render(){return this.props.children}}function gh({children:e,isPresent:t,anchorX:n,anchorY:a,root:o}){var i;const l=s.useId(),c=s.useRef(null),u=s.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:d}=s.useContext(hh),h=(null==(i=e.props)?void 0:i.ref)??(null==e?void 0:e.ref),m=function(...e){return s.useCallback(function(...e){return t=>{let n=!1;const a=e.map(e=>{const a=mh(e,t);return n||"function"!=typeof a||(n=!0),a});if(n)return()=>{for(let t=0;t{const{width:e,height:s,top:r,left:i,right:h,bottom:m}=u.current;if(t||!c.current||!e||!s)return;const p="left"===n?`left: ${i}`:`right: ${h}`,g="bottom"===a?`bottom: ${m}`:`top: ${r}`;c.current.dataset.motionPopId=l;const f=document.createElement("style");d&&(f.nonce=d);const y=o??document.head;return y.appendChild(f),f.sheet&&f.sheet.insertRule(`\n [data-motion-pop-id="${l}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${s}px !important;\n ${p}px !important;\n ${g}px !important;\n }\n `),()=>{y.contains(f)&&y.removeChild(f)}},[t]),r.jsx(ph,{isPresent:t,childRef:c,sizeRef:u,children:s.cloneElement(e,{ref:m})})}const fh=({children:e,initial:t,isPresent:n,onExitComplete:a,custom:o,presenceAffectsLayout:i,mode:l,anchorX:c,anchorY:u,root:d})=>{const h=Tr(yh),m=s.useId();let p=!0,g=s.useMemo(()=>(p=!1,{id:m,initial:t,isPresent:n,custom:o,onExitComplete:e=>{h.set(e,!0);for(const t of h.values())if(!t)return;a&&a()},register:e=>(h.set(e,!1),()=>h.delete(e))}),[n,h,a]);return i&&p&&(g={...g}),s.useMemo(()=>{h.forEach((e,t)=>h.set(t,!1))},[n]),s.useEffect(()=>{!n&&!h.size&&a&&a()},[n]),"popLayout"===l&&(e=r.jsx(gh,{isPresent:n,anchorX:c,anchorY:u,root:d,children:e})),r.jsx(Rr.Provider,{value:g,children:e})};function yh(){return new Map}function bh(e=!0){const t=s.useContext(Rr);if(null===t)return[!0,null];const{isPresent:n,onExitComplete:a,register:r}=t,o=s.useId();s.useEffect(()=>{if(e)return r(o)},[e]);const i=s.useCallback(()=>e&&a&&a(o),[o,a,e]);return!n&&a?[!1,i]:[!0]}function vh(){return null===(e=s.useContext(Rr))||e.isPresent;var e}const wh=e=>e.key||"";function Ch(e){const t=[];return s.Children.forEach(e,e=>{s.isValidElement(e)&&t.push(e)}),t}const kh=({children:e,custom:t,initial:n=!0,onExitComplete:a,presenceAffectsLayout:o=!0,mode:i="sync",propagate:l=!1,anchorX:c="left",anchorY:u="top",root:d})=>{const[h,m]=bh(l),p=s.useMemo(()=>Ch(e),[e]),g=l&&!h?[]:p.map(wh),f=s.useRef(!0),y=s.useRef(p),b=Tr(()=>new Map),v=s.useRef(new Set),[w,C]=s.useState(p),[k,x]=s.useState(p);Lr(()=>{f.current=!1,y.current=p;for(let e=0;e{const s=wh(e),w=!(l&&!h)&&(p===k||g.includes(s));return r.jsx(fh,{isPresent:w,initial:!(f.current&&!n)&&void 0,custom:t,presenceAffectsLayout:o,mode:i,root:d,onExitComplete:w?void 0:()=>{if(v.current.has(s))return;if(v.current.add(s),!b.has(s))return;b.set(s,!0);let e=!0;b.forEach(t=>{t||(e=!1)}),e&&(null==A||A(),x(y.current),l&&(null==m||m()),a&&a())},anchorX:c,anchorY:u,children:e},s)})})},xh=s.createContext(null);const Dh=e=>!0===e,Ah=({children:e,id:t,inherit:n=!0})=>{const a=s.useContext(jr),o=s.useContext(xh),[i,l]=function(){const e=function(){const e=s.useRef(!1);return Lr(()=>(e.current=!0,()=>{e.current=!1}),[]),e}(),[t,n]=s.useState(0),a=s.useCallback(()=>{e.current&&n(t+1)},[t]);return[s.useCallback(()=>vo.postRender(a),[a]),t]}(),c=s.useRef(null),u=a.id||o;null===c.current&&((e=>Dh(!0===e)||"id"===e)(n)&&u&&(t=t?u+"-"+t:u),c.current={id:t,group:Dh(n)&&a.group||ch()});const d=s.useMemo(()=>({...c.current,forceRender:i}),[l]);return r.jsx(jr.Provider,{value:d,children:e})},Eh=s.createContext({strict:!1}),Bh={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Fh=!1;function Sh(){return function(){if(Fh)return;const e={};for(const t in Bh)e[t]={isEnabled:e=>Bh[t].some(t=>!!e[t])};tu(e),Fh=!0}(),eu}const Mh=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function jh(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Mh.has(e)}let Th=e=>!jh(e);function Ph(e){"function"==typeof e&&(Th=t=>t.startsWith("on")?!jh(t):e(t))}try{Ph(require("@emotion/is-prop-valid").default)}catch{}const Lh=s.createContext({});function Rh(e){return Array.isArray(e)?e.join(" "):e}function Nh(e,t,n){for(const a in t)Ql(t[a])||Mu(a,n)||(e[a]=t[a])}function zh(e,t){const n={},a=function(e,t){const n={};return Nh(n,e.style||{},e),Object.assign(n,function({transformTemplate:e},t){return s.useMemo(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{}};return xu(n,t,e),Object.assign({},n.vars,n.style)},[t])}(e,t)),n}(e,t);return e.drag&&!1!==e.dragListener&&(n.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=!0===e.drag?"none":"pan-"+("x"===e.drag?"y":"x")),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=a,n}function _h(e,t,n,a){const r=s.useMemo(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return Nu(n,t,_u(a),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){const t={};Nh(t,e.style,e),r.style={...t,...r.style}}return r}const Ih=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Vh(e){return"string"==typeof e&&!e.includes("-")&&!!(Ih.indexOf(e)>-1||/[A-Z]/u.test(e))}function Oh(e,t,n,{latestValues:a},r,o=!1,i){const l=(i??Vh(e)?_h:zh)(t,a,r,e),c=function(e,t,n){const a={};for(const s in e)"values"===s&&"object"==typeof e.values||(Th(s)||!0===n&&jh(s)||!t&&!jh(s)||e.draggable&&s.startsWith("onDrag"))&&(a[s]=e[s]);return a}(t,"string"==typeof e,o),u=e!==s.Fragment?{...c,...l,ref:n}:{},{children:d}=t,h=s.useMemo(()=>Ql(d)?d.get():d,[d]);return s.createElement(e,{...u,children:h})}function $h(e,t,n,a){const s={},r=a(e,{});for(const h in r)s[h]=jd(r[h]);let{initial:o,animate:i}=e;const l=Jc(e),c=Zc(e);t&&c&&!l&&!1!==e.inherit&&(void 0===o&&(o=t.initial),void 0===i&&(i=t.animate));let u=!!n&&!1===n.initial;u=u||!1===o;const d=u?i:o;if(d&&"boolean"!=typeof d&&!Yc(d)){const t=Array.isArray(d)?d:[d];for(let n=0;n(t,n)=>{const a=s.useContext(Lh),r=s.useContext(Rr),o=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t},n,a,s){return{latestValues:$h(n,a,s,e),renderState:t()}}(e,t,a,r);return n?o():Tr(o)},Uh=qh({scrapeMotionValuesFromProps:ju,createRenderState:()=>({style:{},transform:{},transformOrigin:{},vars:{}})}),Wh=qh({scrapeMotionValuesFromProps:Iu,createRenderState:()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}})}),Hh=Symbol.for("motionComponentSymbol");function Yh(e,t,n){const a=s.useRef(n);s.useInsertionEffect(()=>{a.current=n});const r=s.useRef(null);return s.useCallback(n=>{var s;n&&(null==(s=e.onMount)||s.call(e,n)),t&&(n?t.mount(n):t.unmount());const o=a.current;if("function"==typeof o)if(n){const e=o(n);"function"==typeof e&&(r.current=e)}else r.current?(r.current(),r.current=null):o(n);else o&&(o.current=n)},[t])}const Gh=s.createContext({});function Kh(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function Xh(e,t,n,a,r,o){var i,l;const{visualElement:c}=s.useContext(Lh),u=s.useContext(Eh),d=s.useContext(Rr),h=s.useContext(hh).reducedMotion,m=s.useRef(null),p=s.useRef(!1);a=a||u.renderer,!m.current&&a&&(m.current=a(e,{visualState:t,parent:c,props:n,presenceContext:d,blockInitialAnimation:!!d&&!1===d.initial,reducedMotionConfig:h,isSVG:o}),p.current&&m.current&&(m.current.manuallyAnimateOnMount=!0));const g=m.current,f=s.useContext(Gh);!g||g.projection||!r||"html"!==g.type&&"svg"!==g.type||function(e,t,n,a){const{layoutId:s,layout:r,drag:o,dragConstraints:i,layoutScroll:l,layoutRoot:c,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Jh(e.parent)),e.projection.setOptions({layoutId:s,layout:r,alwaysMeasureLayout:Boolean(o)||i&&Kh(i),visualElement:e,animationType:"string"==typeof r?r:"both",initialPromotionConfig:a,crossfade:u,layoutScroll:l,layoutRoot:c})}(m.current,n,r,f);const y=s.useRef(!1);s.useInsertionEffect(()=>{g&&y.current&&g.update(n,d)});const b=n[nc],v=s.useRef(Boolean(b)&&!(null==(i=window.MotionHandoffIsComplete)?void 0:i.call(window,b))&&(null==(l=window.MotionHasOptimisedAnimation)?void 0:l.call(window,b)));return Lr(()=>{p.current=!0,g&&(y.current=!0,window.MotionIsMounted=!0,g.updateFeatures(),g.scheduleRenderMicrotask(),v.current&&g.animationState&&g.animationState.animateChanges())}),s.useEffect(()=>{g&&(!v.current&&g.animationState&&g.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var e;null==(e=window.MotionHandoffMarkAsComplete)||e.call(window,b)}),v.current=!1),g.enteringChildren=void 0)}),g}function Jh(e){if(e)return!1!==e.options.allowProjection?e.projection:Jh(e.parent)}function Zh(e,{forwardMotionProps:t=!1,type:n}={},a,o){a&&function(e){const t=Sh();for(const n in e)t[n]={...t[n],...e[n]};tu(t)}(a);const i=n?"svg"===n:Vh(e),l=i?Wh:Uh;function c(n,a){let c;const u={...s.useContext(hh),...n,layoutId:Qh(n)},{isStatic:d}=u,h=function(e){const{initial:t,animate:n}=function(e,t){if(Jc(e)){const{initial:t,animate:n}=e;return{initial:!1===t||Gc(t)?t:void 0,animate:Gc(n)?n:void 0}}return!1!==e.inherit?t:{}}(e,s.useContext(Lh));return s.useMemo(()=>({initial:t,animate:n}),[Rh(t),Rh(n)])}(n),m=l(n,d);if(!d&&Pr){s.useContext(Eh).strict;const t=function(e){const t=Sh(),{drag:n,layout:a}=t;if(!n&&!a)return{};const s={...n,...a};return{MeasureLayout:(null==n?void 0:n.isEnabled(e))||(null==a?void 0:a.isEnabled(e))?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}(u);c=t.MeasureLayout,h.visualElement=Xh(e,m,u,o,t.ProjectionNode,i)}return r.jsxs(Lh.Provider,{value:h,children:[c&&h.visualElement?r.jsx(c,{visualElement:h.visualElement,...u}):null,Oh(e,n,Yh(m,h.visualElement,a),m,d,t,i)]})}c.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;const u=s.forwardRef(c);return u[Hh]=e,u}function Qh({layoutId:e}){const t=s.useContext(jr).id;return t&&void 0!==e?t+"-"+e:e}function em(e,t){if("undefined"==typeof Proxy)return Zh;const n=new Map,a=(n,a)=>Zh(n,a,e,t);return new Proxy((e,t)=>a(e,t),{get:(s,r)=>"create"===r?a:(n.has(r)||n.set(r,Zh(r,void 0,e,t)),n.get(r))})}const tm=(e,t)=>t.isSVG??Vh(e)?new Vu(t):new Tu(t,{allowProjection:e!==s.Fragment});let nm=0;const am={animation:{Feature:class extends su{constructor(e){super(e),e.animationState||(e.animationState=Hu(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Yc(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),null==(e=this.unmountControls)||e.call(this)}}},exit:{Feature:class extends su{constructor(){super(...arguments),this.id=nm++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const a=this.node.animationState.setActive("exit",!e);t&&!e&&a.then(()=>{t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function sm(e){return{point:{x:e.pageX,y:e.pageY}}}function rm(e,t,n,a){return Bd(e,t,(e=>t=>Tc(t)&&e(t,sm(t)))(n),a)}const om=({current:e})=>e?e.ownerDocument.defaultView:null,im=(e,t)=>Math.abs(e-t),lm=new Set(["auto","scroll"]);class cm{constructor(e,t,{transformPagePoint:n,contextWindow:a=window,dragSnapToOrigin:s=!1,distanceThreshold:r=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const e=hm(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,n=function(e,t){const n=im(e.x,t.x),a=im(e.y,t.y);return Math.sqrt(n**2+a**2)}(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;const{point:a}=e,{timestamp:s}=Co;this.history.push({...a,timestamp:s});const{onStart:r,onMove:o}=this.handlers;t||(r&&r(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=um(t,this.transformPagePoint),vo.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();const{onEnd:n,onSessionEnd:a,resumeAnimation:s}=this.handlers;if(!this.dragSnapToOrigin&&this.startEvent||s&&s(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const r=hm("pointercancel"===e.type?this.lastMoveEventInfo:um(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,r),a&&a(e,r)},!Tc(e))return;this.dragSnapToOrigin=s,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=r,this.contextWindow=a||window;const i=um(sm(e),this.transformPagePoint),{point:l}=i,{timestamp:c}=Co;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,hm(i,this.history)),this.removeListeners=Hr(rm(this.contextWindow,"pointermove",this.handlePointerMove),rm(this.contextWindow,"pointerup",this.handlePointerUp),rm(this.contextWindow,"pointercancel",this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){const e=getComputedStyle(t);(lm.has(e.overflowX)||lm.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const n=e===window,a=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},s=a.x-t.x,r=a.y-t.y;0===s&&0===r||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s,this.lastMoveEventInfo.point.y+=r):this.history.length>0&&(this.history[0].x-=s,this.history[0].y-=r),this.scrollPositions.set(e,a),vo.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),wo(this.updatePoint)}}function um(e,t){return t?{point:t(e.point)}:e}function dm(e,t){return{x:e.x-t.x,y:e.y-t.y}}function hm({point:e},t){return{point:e,delta:dm(e,pm(t)),offset:dm(e,mm(t)),velocity:gm(t,.1)}}function mm(e){return e[0]}function pm(e){return e[e.length-1]}function gm(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,a=null;const s=pm(e);for(;n>=0&&(a=e[n],!(s.timestamp-a.timestamp>Kr(t)));)n--;if(!a)return{x:0,y:0};const r=Xr(s.timestamp-a.timestamp);if(0===r)return{x:0,y:0};const o={x:(s.x-a.x)/r,y:(s.y-a.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function fm(e,t,n){return{min:void 0!==t?e.min+t:void 0,max:void 0!==n?e.max+n-(e.max-e.min):void 0}}function ym(e,t){let n=t.min-e.min,a=t.max-e.max;return t.max-t.min{t?(this.stopAnimation(),this.snapToCursor(sm(e).point)):this.pauseAnimation()},onStart:(e,t)=>{this.stopAnimation();const{drag:n,dragPropagation:a,onDragStart:s}=this.getProps();if(n&&!a&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(r=n)||"y"===r?Bc[r]?null:(Bc[r]=!0,()=>{Bc[r]=!1}):Bc.x||Bc.y?null:(Bc.x=Bc.y=!0,()=>{Bc.x=Bc.y=!1}),!this.openDragLock))return;var r;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),yd(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Wo.test(t)){const{projection:n}=this.visualElement;if(n&&n.layout){const a=n.layout.layoutBox[e];a&&(t=Qu(a)*(parseFloat(t)/100))}}this.originPoint[e]=t}),s&&vo.postRender(()=>s(e,t)),ec(this.visualElement,"transform");const{animationState:o}=this.visualElement;o&&o.setActive("whileDrag",!0)},onMove:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;const{dragPropagation:n,dragDirectionLock:a,onDirectionLock:s,onDrag:r}=this.getProps();if(!n&&!this.openDragLock)return;const{offset:o}=t;if(a&&null===this.currentDirection)return this.currentDirection=function(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}(o),void(null!==this.currentDirection&&s&&s(this.currentDirection));this.updateAxis("x",t.point,o),this.updateAxis("y",t.point,o),this.visualElement.render(),r&&r(e,t)},onSessionEnd:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>yd(e=>{var t;return"paused"===this.getAnimationState(e)&&(null==(t=this.getAxisMotionValue(e).animation)?void 0:t.play())})},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:s,distanceThreshold:n,contextWindow:om(this.visualElement),element:this.visualElement.current})}stop(e,t){const n=e||this.latestPointerEvent,a=t||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!a||!n)return;const{velocity:r}=a;this.startAnimation(r);const{onDragEnd:o}=this.getProps();o&&vo.postRender(()=>o(n,a))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){const{drag:a}=this.getProps();if(!n||!xm(e,a,this.currentDirection))return;const s=this.getAxisMotionValue(e);let r=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(r=function(e,{min:t,max:n},a){return void 0!==t&&en&&(e=a?ci(n,e,a.max):Math.min(e,n)),e}(r,this.constraints[e],this.elastic[e])),s.set(r)}resolveConstraints(){var e;const{dragConstraints:t,dragElastic:n}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null==(e=this.visualElement.projection)?void 0:e.layout,s=this.constraints;t&&Kh(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!a)&&function(e,{top:t,left:n,bottom:a,right:s}){return{x:fm(e.x,n,s),y:fm(e.y,t,a)}}(a.layoutBox,t),this.elastic=function(e=bm){return!1===e?e=0:!0===e&&(e=bm),{x:vm(e,"left","right"),y:vm(e,"top","bottom")}}(n),s!==this.constraints&&a&&this.constraints&&!this.hasMutatedConstraints&&yd(e=>{!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=function(e,t){const n={};return void 0!==t.min&&(n.min=t.min-e.min),void 0!==t.max&&(n.max=t.max-e.min),n}(a.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Kh(e))return!1;const n=e.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const s=function(e,t,n){const a=wu(e,n),{scroll:s}=t;return s&&(yu(a.x,s.offset.x),yu(a.y,s.offset.y)),a}(n,a.root,this.visualElement.getTransformPagePoint());let r=function(e,t){return{x:ym(e.x,t.x),y:ym(e.y,t.y)}}(a.layout.layoutBox,s);if(t){const e=t(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(r));this.hasMutatedConstraints=!!e,e&&(r=ru(e))}return r}startAnimation(e){const{drag:t,dragMomentum:n,dragElastic:a,dragTransition:s,dragSnapToOrigin:r,onDragTransitionEnd:o}=this.getProps(),i=this.constraints||{},l=yd(o=>{if(!xm(o,t,this.currentDirection))return;let l=i&&i[o]||{};r&&(l={min:0,max:0});const c=a?200:1e6,u=a?40:1e7,d={type:"inertia",velocity:n?e[o]:0,bounceStiffness:c,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...s,...l};return this.startAxisValueAnimation(o,d)});return Promise.all(l).then(o)}startAxisValueAnimation(e,t){const n=this.getAxisMotionValue(e);return ec(this.visualElement,e),n.start($l(e,n,0,t,this.visualElement,!1))}stopAnimation(){yd(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){yd(e=>{var t;return null==(t=this.getAxisMotionValue(e).animation)?void 0:t.pause()})}getAnimationState(e){var t;return null==(t=this.getAxisMotionValue(e).animation)?void 0:t.state}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){yd(t=>{const{drag:n}=this.getProps();if(!xm(t,n,this.currentDirection))return;const{projection:a}=this.visualElement,s=this.getAxisMotionValue(t);if(a&&a.layout){const{min:n,max:r}=a.layout.layoutBox[t],o=s.get()||0;s.set(e[t]-ci(n,r,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!Kh(t)||!n||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};yd(e=>{const t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){const n=t.get();a[e]=function(e,t){let n=.5;const a=Qu(e),s=Qu(t);return s>a?n=Yr(t.min,t.max-a,e.min):a>s&&(n=Yr(e.min,e.max-s,t.min)),_r(0,1,n)}({min:n,max:n},this.constraints[e])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),yd(t=>{if(!xm(t,e,null))return;const n=this.getAxisMotionValue(t),{min:s,max:r}=this.constraints[t];n.set(ci(s,r,a[t]))})}addListeners(){if(!this.visualElement.current)return;Cm.set(this.visualElement,this);const e=this.visualElement.current,t=rm(e,"pointerdown",t=>{const{drag:n,dragListener:a=!0}=this.getProps(),s=t.target,r=s!==e&&Lc(s);n&&a&&!r&&this.start(t)}),n=()=>{const{dragConstraints:e}=this.getProps();Kh(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:a}=this.visualElement,s=a.addEventListener("measure",n);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),vo.read(n);const r=Bd(window,"resize",()=>this.scalePositionWithinConstraints()),o=a.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(yd(t=>{const n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())});return()=>{r(),t(),s(),o&&o()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:a=!1,dragConstraints:s=!1,dragElastic:r=bm,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:a,dragConstraints:s,dragElastic:r,dragMomentum:o}}}function xm(e,t,n){return!(!0!==t&&t!==e||null!==n&&n!==e)}const Dm=e=>(t,n)=>{e&&vo.postRender(()=>e(t,n))};let Am=!1;class Em extends s.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:a}=this.props,{projection:s}=e;s&&(t.group&&t.group.add(s),n&&n.register&&a&&n.register(s),Am&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Pd.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:n,drag:a,isPresent:s}=this.props,{projection:r}=n;return r?(r.isPresent=s,e.layoutDependency!==t&&r.setOptions({...r.options,layoutDependency:t}),Am=!0,a||e.layoutDependency!==t||void 0===t||e.isPresent!==s?r.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?r.promote():r.relegate()||vo.postRender(()=>{const e=r.getStack();e&&e.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Ec.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:a}=e;Am=!0,a&&(a.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(a),n&&n.deregister&&n.deregister(a))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Bm(e){const[t,n]=bh(),a=s.useContext(jr);return r.jsx(Em,{...e,layoutGroup:a,switchLayoutGroup:s.useContext(Gh),isPresent:t,safeToRemove:n})}const Fm={pan:{Feature:class extends su{constructor(){super(...arguments),this.removePointerDownListener=Ur}onPointerDown(e){this.session=new cm(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:om(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:a}=this.node.getProps();return{onSessionStart:Dm(e),onStart:Dm(t),onMove:n,onEnd:(e,t)=>{delete this.session,a&&vo.postRender(()=>a(e,t))}}}mount(){this.removePointerDownListener=rm(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends su{constructor(e){super(e),this.removeGroupControls=Ur,this.removeListeners=Ur,this.controls=new km(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ur}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:dh,MeasureLayout:Bm}};function Sm(e,t,n){const{props:a}=e;e.animationState&&a.whileHover&&e.animationState.setActive("whileHover","Start"===n);const s=a["onHover"+n];s&&vo.postRender(()=>s(t,sm(t)))}function Mm(e,t,n){const{props:a}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&a.whileTap&&e.animationState.setActive("whileTap","Start"===n);const s=a["onTap"+("End"===n?"":n)];s&&vo.postRender(()=>s(t,sm(t)))}const jm=new WeakMap,Tm=new WeakMap,Pm=e=>{const t=jm.get(e.target);t&&t(e)},Lm=e=>{e.forEach(Pm)};const Rm={some:0,all:1},Nm=em({...am,inView:{Feature:class extends su{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:a="some",once:s}=e,r={root:t?t.current:void 0,rootMargin:n,threshold:"number"==typeof a?a:Rm[a]};return function(e,t,n){const a=function({root:e,...t}){const n=e||document;Tm.has(n)||Tm.set(n,{});const a=Tm.get(n),s=JSON.stringify(t);return a[s]||(a[s]=new IntersectionObserver(Lm,{root:e,...t})),a[s]}(t);return jm.set(e,n),a.observe(e),()=>{jm.delete(e),a.unobserve(e)}}(this.node.current,r,e=>{const{isIntersecting:t}=e;if(this.isInView===t)return;if(this.isInView=t,s&&!t&&this.hasEnteredView)return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const{onViewportEnter:n,onViewportLeave:a}=this.node.getProps(),r=t?n:a;r&&r(e)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends su{mount(){const{current:e}=this.node;e&&(this.unmount=function(e,t,n={}){const[a,s,r]=Sc(e,n),o=e=>{const a=e.currentTarget;if(!_c(e))return;Rc.add(a);const r=t(a,e),o=(e,t)=>{window.removeEventListener("pointerup",i),window.removeEventListener("pointercancel",l),Rc.has(a)&&Rc.delete(a),_c(e)&&"function"==typeof r&&r(e,{success:t})},i=e=>{o(e,a===window||a===document||n.useGlobalTarget||jc(a,e.target))},l=e=>{o(e,!1)};window.addEventListener("pointerup",i,s),window.addEventListener("pointercancel",l,s)};return a.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener("pointerdown",o,s),Ac(e)&&(e.addEventListener("focus",e=>((e,t)=>{const n=e.currentTarget;if(!n)return;const a=Nc(()=>{if(Rc.has(n))return;zc(n,"down");const e=Nc(()=>{zc(n,"up")});n.addEventListener("keyup",e,t),n.addEventListener("blur",()=>zc(n,"cancel"),t)});n.addEventListener("keydown",a,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",a),t)})(e,s)),Lc(e)||e.hasAttribute("tabindex")||(e.tabIndex=0))}),r}(e,(e,t)=>(Mm(this.node,t,"Start"),(e,{success:t})=>Mm(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends su{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Hr(Bd(this.node.current,"focus",()=>this.onFocus()),Bd(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends su{mount(){const{current:e}=this.node;e&&(this.unmount=function(e,t,n={}){const[a,s,r]=Sc(e,n),o=e=>{if(!Mc(e))return;const{target:n}=e,a=t(n,e);if("function"!=typeof a||!n)return;const r=e=>{Mc(e)&&(a(e),n.removeEventListener("pointerleave",r))};n.addEventListener("pointerleave",r,s)};return a.forEach(e=>{e.addEventListener("pointerenter",o,s)}),r}(e,(e,t)=>(Sm(this.node,t,"Start"),e=>Sm(this.node,e,"End"))))}unmount(){}}},...Fm,layout:{ProjectionNode:dh,MeasureLayout:Bm}},tm),zm={duration:.15,ease:[.4,0,.2,1]},_m={type:"tween",duration:.25,ease:[.4,0,.2,1]},Im={type:"tween",duration:.3,ease:[.4,0,.2,1]},Vm=s.createContext(!1);function Om(){return s.useContext(Vm)}const $m=s.createContext(void 0);function qm(){return s.useContext($m)}const Um="#1A1A1A",Wm="#737373",Hm={xs:"sm:max-w-xs",sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl","2xl":"sm:max-w-2xl","3xl":"sm:max-w-3xl","4xl":"sm:max-w-4xl","5xl":"sm:max-w-5xl",full:"sm:max-w-[calc(100vw-2rem)]"};function Ym({open:e,onClose:t,size:n="md",className:a,children:o,bottomSheet:l=!0,motionPlus:d=!1,basemapMode:h,solid:m=!1}){const p="light"===h,[g,f]=s.useState(!1),y=s.useRef(null);s.useEffect(()=>(y.current&&(clearTimeout(y.current),y.current=null),e?y.current=setTimeout(()=>{f(!0)},350):queueMicrotask(()=>f(!1)),()=>{y.current&&(clearTimeout(y.current),y.current=null)}),[e]);const b=s.useCallback((e,n)=>{(n.offset.y>100||n.velocity.y>500)&&t()},[t]),v=d?Im:_m,w=d?.98:.99,C=l?8:4;return r.jsx(kh,{mode:"wait",children:e&&r.jsxs(c,{static:!0,open:e,onClose:t,className:"relative z-[10010]",children:[r.jsx(Nm.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:zm,className:"fixed inset-0 bg-black/50 backdrop-blur-sm","aria-hidden":"true"}),r.jsx("div",{className:"fixed inset-0 overflow-y-auto",children:r.jsx("div",{className:i("flex min-h-full justify-center",l?"items-end sm:items-center sm:p-4":"items-center p-4"),children:r.jsx(Nm.div,{drag:!!l&&"y",dragConstraints:{top:0,bottom:0},dragElastic:{top:0,bottom:.4},onDragEnd:b,initial:{opacity:0,scale:w,y:C},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.99,y:l?40:4},transition:v,style:{willChange:"transform, opacity"},className:i(l&&"w-full sm:w-auto"),children:r.jsx(u,{className:i("relative w-full shadow-2xl flex flex-col",!h&&!m&&"bg-surface/80 backdrop-blur-xl",!h&&m&&"bg-surface",!h&&"ring-1 ring-inset ring-edge-subtle",Hm[n],l?"radius-card overflow-hidden pb-safe":"radius-card overflow-hidden",a),style:h?{backgroundColor:p?"#F8F8F8":"var(--surface)",boxShadow:"inset 0 0 0 1px "+(p?"rgba(0, 0, 0, 0.08)":"rgba(255, 255, 255, 0.1)")}:void 0,children:r.jsx($m.Provider,{value:h,children:r.jsx(Vm.Provider,{value:g,children:o})})})})})})]})})}function Gm({className:e,...t}){const n=qm(),a="light"===n;return r.jsx(d,{...t,className:i("text-base font-semibold sm:text-lg",!n&&"text-fg-primary",e),style:n?{color:a?Um:"var(--fg-primary)"}:void 0})}function Km({icon:e,title:t,onClose:n,className:a}){const s=qm(),o="light"===s;return r.jsxs("div",{className:i("flex items-center justify-between px-4 sm:px-6 py-3 sm:py-4 border-b",!s&&"border-edge-subtle",a),style:s?{borderColor:o?"rgba(0, 0, 0, 0.12)":"var(--edge-subtle)"}:void 0,children:[r.jsxs("div",{className:"flex items-center gap-3",children:[e&&r.jsx("div",{className:i(!s&&"text-icon-card-title"),style:s?{color:o?"#4A4A4A":"var(--icon-card-title)"}:void 0,children:e}),r.jsx(Gm,{children:t})]}),n&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:n,className:"sm:hidden min-h-[44px] min-w-[44px] px-3 flex items-center justify-center text-[15px] font-medium text-sys-blue active:text-sys-blue/70 transition-base radius-inner active:bg-subtle-fill",children:"Done"}),r.jsx("button",{onClick:n,className:i("hidden sm:flex items-center justify-center p-2 radius-inner transition-colors",!s&&"text-fg-muted hover:text-fg-primary hover:bg-subtle"),style:s?{color:o?Wm:"var(--fg-muted)"}:void 0,onMouseEnter:e=>{s&&(e.currentTarget.style.color=o?Um:"var(--fg-primary)",e.currentTarget.style.backgroundColor=o?"rgba(0, 0, 0, 0.06)":"var(--subtle)")},onMouseLeave:e=>{s&&(e.currentTarget.style.color=o?Wm:"var(--fg-muted)",e.currentTarget.style.backgroundColor="transparent")},"aria-label":"Close",children:r.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}function Xm({className:e,...t}){return r.jsx("div",{...t,className:i("px-6 py-5",e)})}function Jm({className:e,...t}){return r.jsx("div",{...t,className:i("flex flex-col-reverse gap-3 px-6 pb-6 pt-0","sm:flex-row sm:justify-end","*:w-full sm:*:w-auto",e)})}const Zm={snappy:{type:"spring",stiffness:500,damping:30},smooth:{type:"spring",stiffness:300,damping:30},gentle:{type:"spring",stiffness:200,damping:25}},Qm={fast:.15,normal:.2,medium:.3},ep={easeOut:[0,0,.2,1],easeIn:[.4,0,1,1]},tp={dropdown:{type:"spring",stiffness:500,damping:30},fade:{duration:Qm.fast,ease:ep.easeOut},numberTicker:{type:"spring",visualDuration:.4,bounce:.15,opacity:{duration:.15,ease:"linear"}},numberReveal:{type:"spring",visualDuration:.6,bounce:.25,opacity:{duration:.2,ease:"linear"}}},np={normal:.05};function ap({className:e,...t}){return r.jsx("nav",{...t,className:i(e,"flex h-full min-h-0 flex-col")})}function sp({className:e,...t}){return r.jsx("div",{...t,className:i(e,"flex flex-col border-b border-edge-subtle p-4","[&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function rp({className:e,...t}){return r.jsx("div",{...t,className:i(e,"flex flex-1 flex-col p-3","overflow-y-auto sidebar-scroll","[&>[data-slot=section]+[data-slot=section]]:mt-6")})}function op({className:e,...t}){return r.jsx("div",{...t,className:i(e,"mt-auto flex flex-col border-t border-edge-subtle","[&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function ip({className:e,...t}){const n=s.useId();return r.jsx(Ah,{id:n,children:r.jsx("div",{...t,"data-slot":"section",className:i(e,"flex flex-col gap-0.5")})})}const lp=s.forwardRef(function(e,t){const{current:n,className:a,children:s,accentColor:o,...c}=e,u=!!o,d=i("relative flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left","min-h-[44px]","text-sm font-medium","[&>svg]:w-5 [&>svg]:h-5 [&>svg]:flex-shrink-0",n?u?"text-white":"text-white [&_svg]:text-sys-blue":"text-fg-muted hover:text-fg-primary hover:bg-subtle-fill [&_svg]:text-fg-muted hover:[&_svg]:text-fg-primary","transition-all duration-150"),h=u?{willChange:"transform",backgroundColor:o}:{willChange:"transform"},m=u?{willChange:"transform",backgroundColor:`color-mix(in srgb, ${o} 10%, transparent)`,boxShadow:`inset 0 0 0 1.5px ${o}`}:{willChange:"transform"};return r.jsxs("span",{className:i(a,"relative"),children:[n&&r.jsx(Nm.span,{layout:"position",layoutId:"sidebar-current-indicator",className:i("absolute inset-y-2 -left-3 w-0.5 rounded-full",!u&&"bg-sys-blue"),style:h,transition:Zm.snappy}),"string"==typeof c.href?r.jsxs(D,{to:c.href,onClick:c.onClick,onMouseEnter:c.onMouseEnter,onMouseLeave:c.onMouseLeave,className:d,"data-current":n?"true":void 0,ref:t,children:[n&&r.jsx(Nm.span,{layout:"position",layoutId:"sidebar-current-highlight",className:i("absolute inset-px radius-inner",!u&&"bg-sys-blue/10 ring-[1.5px] ring-sys-blue"),style:m,transition:Zm.snappy}),s]}):r.jsxs(l,{...c,className:i("cursor-default",d),"data-current":n?"true":void 0,ref:t,children:[n&&r.jsx(Nm.span,{layout:"position",layoutId:"sidebar-current-highlight",className:i("absolute inset-px radius-inner",!u&&"bg-sys-blue/10 ring-[1.5px] ring-sys-blue"),style:m,transition:Zm.snappy}),s]})]})});function cp({className:e,...t}){return r.jsx("span",{...t,className:i(e,"truncate")})}function up({className:e,variant:t="default",...n}){return r.jsx("span",{...n,className:i("ml-auto flex items-center gap-1 px-1.5 py-0.5 rounded-full","text-xs font-medium",{default:"bg-subtle text-fg-muted",accent:"bg-sys-blue/20 text-sys-blue",success:"bg-sys-green/20 text-sys-green",warning:"bg-sys-indigo/20 text-sys-indigo",danger:"bg-sys-red/20 text-sys-red"}[t],e)})}const dp=s.createContext(null),hp={type:"spring",visualDuration:.35,bounce:.15};function mp({open:e,onClose:t,children:n}){return r.jsx(kh,{children:e&&r.jsxs(c,{static:!0,open:e,onClose:t,className:"lg:hidden relative z-[10002]",children:[r.jsx(Nm.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25,ease:"easeOut"},className:"fixed inset-0 bg-black/60 backdrop-blur-sm","aria-hidden":"true"}),r.jsx(Nm.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:hp,className:"fixed inset-y-0 left-0 w-72 max-w-[85vw] z-[10003]",children:r.jsx(u,{className:"h-full",children:r.jsxs("div",{className:"flex h-full flex-col sidebar-panel",children:[r.jsx("div",{className:"absolute top-4 right-4 z-10",children:r.jsx(h,{className:"p-2 rounded-lg text-fg-muted hover:text-fg-primary hover:bg-subtle-fill transition-colors","aria-label":"Close navigation",children:r.jsx(Mr,{className:"w-5 h-5"})})}),n]})})})]})})}function pp({sidebar:e,navbar:t,children:n,className:a}){const[o,l]=s.useState(!1),c=()=>l(!0),u=()=>l(!1),d={isOpen:o,open:c,close:u,toggle:()=>l(e=>!e)};return r.jsx(dp.Provider,{value:d,children:r.jsxs("div",{className:"flex h-screen overflow-hidden bg-body",children:[r.jsx("aside",{className:"hidden lg:flex flex-col w-64 flex-shrink-0 h-full relative sidebar-panel",children:e}),r.jsx(mp,{open:o,onClose:u,children:e}),r.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[r.jsx("header",{className:"lg:hidden sticky top-0 z-[10001] h-14 mobile-header",children:r.jsxs("div",{className:"flex items-center h-full px-4",children:[r.jsx("button",{onClick:c,className:"w-10 h-10 flex items-center justify-center rounded-lg hover:bg-subtle-fill active:bg-subtle-fill transition-colors mr-2","aria-label":"Open navigation",children:r.jsx(br,{className:"w-5 h-5 text-fg-primary"})}),r.jsx("div",{className:"flex-1 min-w-0",children:t})]})}),r.jsx("main",{className:i("flex-1 overflow-y-auto main-content",a),children:n})]})]})})}function gp({className:e,...t}){return r.jsx("nav",{...t,className:i(e,"flex flex-1 items-center gap-3")})}function fp({className:e,...t}){return r.jsx("div",{...t,className:i(e,"flex items-center gap-3")})}function yp({className:e,...t}){return r.jsx("div",{"aria-hidden":"true",...t,className:i(e,"flex-1")})}const bp="bg-surface/80 backdrop-blur-lg ring-1 ring-inset ring-edge-subtle",vp={sm:"radius-inner",md:"radius-inset",lg:"radius-card",xl:"radius-hero",full:"radius-pill",none:"radius-none"},wp=s.forwardRef(function({children:e,elevated:t,compact:n,noPadding:a,radius:s="lg",glass:o=!0,stroke:l=!0,shadow:c,reflex:u=!1,glow:d=!1,neomorphic:h=!1,onClick:m,className:p,style:g,...f},y){const b=c??t??!1,v=!h&&l,w={...g,...u?{"--surface-reflex":"1"}:{}};return r.jsx("div",{ref:y,"data-card-surface":!0,className:i(vp[s],o&&(t?"bg-surface/85 backdrop-blur-xl":"bg-surface/80 backdrop-blur-lg"),!o&&"bg-surface",h&&"neomorphic-outer",v&&!d&&"ring-1 ring-inset ring-edge-subtle",d&&"ring-1 ring-inset ring-sys-blue/40",b&&(t?"shadow-xl":"shadow-lg"),u&&"surface-reflex","h-full flex flex-col relative",!a&&(n?"p-3 sm:p-4":"p-4 sm:p-5"),m&&"cursor-pointer",p),style:w,onClick:m,...f,children:e})});function Cp({defaultOpen:e=!1,className:t,children:n}){return r.jsx(p,{defaultOpen:e,children:r.jsx("div",{className:i("flex flex-col",t),children:n})})}s.forwardRef(function({children:e,className:t,...n},a){return r.jsx("div",{ref:a,className:i("flex items-center justify-between gap-4","pb-4 mb-4","border-b border-edge-subtle",t),...n,children:e})}),s.forwardRef(function({children:e,icon:t,className:n,...a},s){return r.jsxs("h3",{ref:s,className:i("flex items-center gap-2","text-base font-semibold text-fg-primary",n),...a,children:[t&&r.jsx("span",{className:"text-icon-card-title w-5 h-5 flex-shrink-0",children:t}),e]})}),s.forwardRef(function({children:e,className:t,...n},a){return r.jsx("p",{ref:a,className:i("text-sm text-fg-muted",t),...n,children:e})}),s.forwardRef(function({children:e,className:t,...n},a){return r.jsx("div",{ref:a,className:i("flex-1 min-h-0",t),...n,children:e})}),s.forwardRef(function({children:e,className:t,...n},a){return r.jsx("div",{ref:a,className:i("flex items-center justify-end gap-3","pt-4 mt-4","border-t border-edge-subtle",t),...n,children:e})}),s.forwardRef(function({children:e,border:t,className:n,...a},s){return r.jsx("div",{ref:s,className:i(t&&"pt-4 mt-4 border-t border-edge-subtle",n),...a,children:e})});const kp=s.forwardRef(function({className:e,icon:t,children:n,...a},s){return r.jsx(m,{ref:s,className:i("flex w-full items-center justify-between gap-3","px-3 py-2 radius-inner","text-sm font-medium text-fg-muted","row-hover hover:text-fg-primary","ring-focus",e),...a,children:({open:e})=>r.jsxs(r.Fragment,{children:[n,r.jsx("span",{className:i("transition-transform duration-200",e?"rotate-180":"rotate-0"),children:t||r.jsx(or,{className:"w-4 h-4"})})]})})});function xp({direction:e="down",className:t,children:n}){const a={hidden:{height:0,opacity:0,y:"up"===e?8:-8},visible:{height:"auto",opacity:1,y:0}};return r.jsx(g,{static:!0,children:({open:s})=>r.jsx(kh,{initial:!1,children:s&&r.jsx(Nm.div,{initial:"hidden",animate:"visible",exit:"hidden",variants:a,transition:{height:{duration:.2,ease:[.4,0,.2,1]},opacity:{duration:.15},y:{duration:.15}},className:i("overflow-hidden",t),children:r.jsx("div",{className:i("up"===e?"pb-2":"pt-2"),children:n})})})})}function Dp({label:e,icon:t,defaultOpen:n=!0,direction:a="down",className:s,dataId:o,children:l}){const c=o?{[`data-${o}-disclosure`]:!0}:{},u=r.jsxs("span",{className:"flex items-center gap-3",children:[t&&r.jsx("span",{className:"icon-md flex items-center justify-center text-icon-card-title",children:t}),r.jsx("span",{className:"type-micro",children:e})]});return"up"===a?r.jsx(p,{defaultOpen:n,children:({open:n})=>r.jsxs("div",{className:i("relative",s),children:[r.jsx(g,{static:!0,className:"relative z-50",children:r.jsx(kh,{initial:!1,mode:"wait",children:n&&r.jsxs(Nm.div,{initial:{y:12,scale:.96,opacity:0},animate:{y:0,scale:1,opacity:1},exit:{y:6,scale:.98,opacity:0},transition:{type:"spring",stiffness:400,damping:30,mass:.5,opacity:{duration:.15,ease:"easeOut"}},className:"absolute bottom-full left-0 right-0 z-50 mb-1 mx-1 origin-bottom radius-inset shadow-lg border-card bg-surface/80 backdrop-blur-xl",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[r.jsxs("span",{className:"flex items-center gap-3",children:[t&&r.jsx("span",{className:"icon-md flex items-center justify-center text-icon-card-title",children:t}),r.jsx("span",{className:"type-micro",children:e})]}),r.jsx(m,{className:"p-1 rounded hover:bg-subtle-fill-strong transition-colors",children:r.jsx(Nm.span,{initial:{rotate:0},animate:{rotate:180},exit:{rotate:0},transition:{type:"spring",stiffness:400,damping:25},children:r.jsx(or,{className:"w-4 h-4"})})})]}),r.jsx("div",{className:"px-3 pb-3",children:l})]})})}),r.jsx(Nm.div,{animate:{opacity:n?.4:1,scale:n?.98:1},transition:{type:"spring",stiffness:500,damping:35},children:r.jsxs(m,{...c,className:i("flex w-full items-center justify-between gap-3","px-3 py-2 radius-inner","text-sm font-medium text-fg-muted","row-hover hover:text-fg-primary","ring-focus"),children:[u,r.jsx(Nm.span,{animate:{rotate:n?180:0},transition:{type:"spring",stiffness:400,damping:25},children:r.jsx(or,{className:"w-4 h-4"})})]})})]})}):r.jsxs(Cp,{defaultOpen:n,className:s,children:[r.jsx(kp,{...c,children:u}),r.jsx(xp,{direction:"down",children:r.jsx("div",{className:"bg-subtle-fill radius-inset mx-1 mt-1",children:l})})]})}function Ap({placement:e}){const t=i("absolute w-2 h-2 bg-elevated rotate-45","top"===e&&"bottom-[-4px] left-1/2 -translate-x-1/2","bottom"===e&&"top-[-4px] left-1/2 -translate-x-1/2","left"===e&&"right-[-4px] top-1/2 -translate-y-1/2","right"===e&&"left-[-4px] top-1/2 -translate-y-1/2");return r.jsx("span",{className:t})}function Ep({content:e,children:t,placement:n="top",delay:a=200,arrow:o=!0,disabled:l=!1,className:c}){const[u,d]=s.useState(!1),[h,m]=s.useState({top:0,left:0}),[p,g]=s.useState(!1),y=s.useRef(null),b=s.useRef(null),v=s.useRef();s.useEffect(()=>{g(!0)},[]),s.useEffect(()=>{if(!u||!y.current||!b.current)return;const e=y.current.getBoundingClientRect(),t=b.current.getBoundingClientRect(),a=function(e,t,n){const a=window.scrollY,s=window.scrollX;switch(n){case"top":return{top:e.top+a-t.height-8,left:e.left+s+(e.width-t.width)/2};case"bottom":return{top:e.bottom+a+8,left:e.left+s+(e.width-t.width)/2};case"left":return{top:e.top+a+(e.height-t.height)/2,left:e.left+s-t.width-8};case"right":return{top:e.top+a+(e.height-t.height)/2,left:e.right+s+8}}}(e,t,n),s=window.innerWidth-t.width-8,r=window.innerHeight+window.scrollY-t.height-8;m({top:Math.max(8,Math.min(a.top,r)),left:Math.max(8,Math.min(a.left,s))})},[u,n]);const w=s.useCallback(()=>{l||(v.current=setTimeout(()=>{d(!0)},a))},[a,l]),C=s.useCallback(()=>{v.current&&clearTimeout(v.current),d(!1)},[]);if(s.useEffect(()=>()=>{v.current&&clearTimeout(v.current)},[]),!s.isValidElement(t))return t;const k=s.cloneElement(t,{ref:y,onMouseEnter:e=>{var n,a;w(),null==(a=(n=t.props).onMouseEnter)||a.call(n,e)},onMouseLeave:e=>{var n,a;C(),null==(a=(n=t.props).onMouseLeave)||a.call(n,e)},onFocus:e=>{var n,a;w(),null==(a=(n=t.props).onFocus)||a.call(n,e)},onBlur:e=>{var n,a;C(),null==(a=(n=t.props).onBlur)||a.call(n,e)}}),x=(e=>({hidden:{opacity:0,scale:.96,...{top:{y:4},bottom:{y:-4},left:{x:4},right:{x:-4}}[e]},visible:{opacity:1,scale:1,x:0,y:0}}))(n),D=r.jsx(kh,{children:u&&r.jsxs(Nm.div,{ref:b,initial:"hidden",animate:"visible",exit:"hidden",variants:x,transition:{duration:.15,ease:"easeOut"},className:i("fixed z-[10020] px-2.5 py-1.5 text-xs font-medium","bg-elevated text-fg-primary","rounded-lg shadow-lg","ring-1 ring-inset ring-edge-subtle","pointer-events-none",c),style:{top:h.top,left:h.left},role:"tooltip",children:[e,o&&r.jsx(Ap,{placement:n})]})});return r.jsxs(r.Fragment,{children:[k,p&&f.createPortal(D,document.body)]})}const Bp={sm:{track:"h-5 w-9",thumb:"h-3.5 w-3.5",translate:"translate-x-[18px]",icon:"w-3 h-3",dot:"w-2 h-2"},md:{track:"h-6 w-11",thumb:"h-4 w-4",translate:"translate-x-[22px]",icon:"w-4 h-4",dot:"w-2.5 h-2.5"},lg:{track:"h-7 w-14",thumb:"h-5 w-5",translate:"translate-x-[30px]",icon:"w-4 h-4",dot:"w-3 h-3"}},Fp=s.forwardRef(function({enabled:e,onChange:t,label:n,description:a,tooltip:s,size:o="md",color:l="muted",dangerOff:c=!1,disabled:u=!1,status:d="idle",name:h,className:m},p){const g=Bp[o],f="loading"===d,C="muted"===l;return r.jsxs(y,{disabled:u||f,className:i("flex items-center gap-3",m),children:[r.jsx(b,{ref:p,checked:e,onChange:t,name:h,className:i(C?"toggle-switch-track":"group relative inline-flex shrink-0 items-center rounded-full border-2",g.track,!C&&(e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-edge-subtle"),"disabled:opacity-50 disabled:cursor-not-allowed","ring-focus","transition-all duration-200"),"data-size":o,children:r.jsx("span",{className:i(C?"toggle-switch-thumb":"relative inline-flex items-center justify-center bg-white shadow-lg","transform rounded-full transition-transform duration-200",g.thumb,e?g.translate:"translate-x-[4px]"),children:C&&r.jsx("span",{className:i("toggle-switch-dot",g.dot,c?i("opacity-100",!e&&"toggle-switch-dot-danger"):e?"opacity-100":"opacity-0")})})}),(n||a||s)&&r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[n&&r.jsx(v,{className:i("text-sm font-medium cursor-pointer select-none",u?"text-fg-muted":"text-fg-primary"),children:n}),s&&r.jsx(Ep,{content:s,placement:"top",children:r.jsx("span",{className:"text-fg-muted hover:text-fg-secondary cursor-help transition-colors",children:r.jsx(hr,{className:"w-3.5 h-3.5"})})}),a&&!s&&r.jsx(w,{className:"text-xs text-fg-muted",children:a})]}),"idle"!==d&&r.jsxs("div",{className:"flex items-center shrink-0",children:["loading"===d&&r.jsx(gr,{className:i(g.icon,"text-fg-muted animate-spin")}),"success"===d&&r.jsx(rr,{className:i(g.icon,"text-sys-green")}),"error"===d&&r.jsx(Mr,{className:i(g.icon,"text-sys-red")})]})]})}),Sp=s.forwardRef(function({enabled:e,onChange:t,size:n="md",disabled:a=!1,"aria-label":s,className:o},l){const c=Bp[n];return r.jsx(b,{ref:l,checked:e,onChange:t,disabled:a,"aria-label":s,className:i("toggle-switch-track",c.track,"disabled:opacity-50 disabled:cursor-not-allowed","ring-focus","transition-all duration-200",o),"data-size":n,children:r.jsx("span",{className:i("toggle-switch-thumb","transform rounded-full transition-transform duration-200",c.thumb,e?c.translate:"translate-x-[4px]"),children:r.jsx("span",{className:i("toggle-switch-dot",c.dot,e?"opacity-100":"opacity-0")})})})}),Mp={sm:{input:"h-8 text-sm px-3",icon:"w-4 h-4",iconPadding:"pl-8",trailingIconPadding:"pr-8"},md:{input:"h-[38px] text-sm px-4",icon:"w-4 h-4",iconPadding:"pl-10",trailingIconPadding:"pr-10"},lg:{input:"h-11 text-base px-4",icon:"w-5 h-5",iconPadding:"pl-11",trailingIconPadding:"pr-11"}},jp=s.forwardRef(function({type:e="text",size:t="md",invalid:n=!1,leadingIcon:a,trailingIcon:s,leadingAddon:o,trailingAddon:l,className:c,disabled:u,...d},h){const m=Mp[t],p=a||o,g=s||l;return o||l?r.jsxs("div",{className:i("flex",c),children:[o&&r.jsx("span",{className:i("inline-flex items-center px-3 rounded-l-lg border border-r-0","bg-input-bg text-fg-muted text-sm",n?"border-sys-red":"border-input-border"),children:o}),r.jsx("input",{ref:h,type:e,disabled:u,className:i("flex-1 min-w-0 font-mono",m.input,"bg-input-bg",n?"border border-sys-red":"border border-input-border","text-fg-primary placeholder:text-fg-muted",n?"ring-focus-error":"ring-focus-inset",!u&&"hover:border-edge-strong","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors",o&&!l&&"rounded-r-lg",l&&!o&&"rounded-l-lg",!o&&!l&&"radius-inner"),...d}),l&&r.jsx("span",{className:i("inline-flex items-center px-3 rounded-r-lg border border-l-0","bg-input-bg text-fg-muted text-sm",n?"border-sys-red":"border-input-border"),children:l})]}):r.jsxs("div",{className:i("relative",c),children:[a&&r.jsx("div",{className:i("absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none","text-fg-muted"),children:r.jsx("span",{className:m.icon,children:a})}),r.jsx("input",{ref:h,type:e,disabled:u,className:i("w-full radius-inner font-mono",m.input,p&&m.iconPadding,g&&m.trailingIconPadding,"bg-input-bg",n?"border border-sys-red":"border border-input-border","text-fg-primary placeholder:text-fg-muted",n?"ring-focus-error":"ring-focus-inset",!u&&"hover:border-edge-strong","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors"),...d}),s&&r.jsx("div",{className:i("absolute inset-y-0 right-0 flex items-center pr-3","text-fg-muted"),children:r.jsx("span",{className:m.icon,children:s})})]})}),Tp=s.forwardRef(function({label:e,description:t,errorMessage:n,required:a,invalid:s,className:o,...l},c){const u=s&&n;return r.jsxs(y,{className:i("flex flex-col gap-1.5",o),children:[e&&r.jsxs(v,{className:"text-sm font-medium text-fg-primary",children:[e,a&&r.jsx("span",{className:"text-sys-red ml-0.5",children:"*"})]}),t&&!u&&r.jsx(w,{className:"text-xs text-fg-muted -mt-0.5",children:t}),r.jsx(jp,{ref:c,invalid:s,...l}),u&&r.jsx("p",{className:"text-xs text-sys-red",children:n})]})});s.forwardRef(function({value:e,onChange:t,min:n,max:a,step:s=1,precision:o,...i},l){const c=void 0!==o&&"number"==typeof e?e.toFixed(o):e;return r.jsx(jp,{ref:l,type:"number",value:c,onChange:e=>{const s=e.target.value;if(""===s||"-"===s)return void t(0);const r=parseFloat(s);if(!isNaN(r)){const e=void 0!==n&&void 0!==a?Math.min(Math.max(r,n),a):void 0!==n?Math.max(r,n):void 0!==a?Math.min(r,a):r;t(e)}},min:n,max:a,step:s,...i})});const Pp={none:"resize-none",vertical:"resize-y",horizontal:"resize-x",both:"resize"},Lp=s.forwardRef(function({rows:e=3,resize:t="vertical",invalid:n=!1,disabled:a,className:s,...o},l){return r.jsx("textarea",{ref:l,rows:e,disabled:a,className:i("w-full radius-inner px-4 py-3 text-sm",Pp[t],"bg-subtle",n?"border border-sys-red":"border-control","text-fg-primary placeholder:text-fg-muted",n?"ring-focus-error":"ring-focus-inset",!a&&"hover:border-edge-strong","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors",s),...o})});s.forwardRef(function({label:e,description:t,errorMessage:n,required:a,invalid:s,showCount:o,maxLength:l,value:c,className:u,...d},h){const m=s&&n,p="string"==typeof c?c.length:0;return r.jsxs(y,{className:i("flex flex-col gap-1.5",u),children:[e&&r.jsxs(v,{className:"text-sm font-medium text-fg-primary",children:[e,a&&r.jsx("span",{className:"text-sys-red ml-0.5",children:"*"})]}),t&&!m&&r.jsx(w,{className:"text-xs text-fg-muted -mt-0.5",children:t}),r.jsx(Lp,{ref:h,invalid:s,maxLength:l,value:c,...d}),r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m?r.jsx("p",{className:"text-xs text-sys-red flex-1",children:n}):r.jsx("span",{}),o&&l&&r.jsxs("span",{className:i("text-xs",p>l?"text-sys-red":"text-fg-muted"),children:[p,"/",l]})]})]})});const Rp={sm:{box:"h-4 w-4",icon:"h-3 w-3",radius:"rounded"},md:{box:"h-5 w-5",icon:"h-3.5 w-3.5",radius:"rounded-md"},lg:{box:"h-6 w-6",icon:"h-4 w-4",radius:"rounded-md"}},Np=s.forwardRef(function({checked:e,onChange:t,indeterminate:n=!1,label:a,description:s,size:o="md",disabled:l=!1,name:c,value:u,className:d},h){const m=Rp[o];return r.jsxs(y,{disabled:l,className:i("flex items-start gap-3",d),children:[r.jsxs(C,{ref:h,checked:e,onChange:t,name:c,value:u,className:i("group relative flex shrink-0 items-center justify-center",m.box,m.radius,"border-2 transition-all duration-150",!e&&!n&&"border-edge-subtle bg-subtle",(e||n)&&"border-sys-blue bg-sys-blue",!e&&!n&&!l&&"hover:border-edge-strong","ring-focus","disabled:opacity-50 disabled:cursor-not-allowed"),children:[e&&!n&&r.jsx(rr,{className:i(m.icon,"text-white stroke-[3]")}),n&&r.jsx(wr,{className:i(m.icon,"text-white stroke-[3]")})]}),(a||s)&&r.jsxs("div",{className:"flex-1 min-w-0 select-none",children:[a&&r.jsx(v,{className:i("text-sm font-medium cursor-pointer",l?"text-fg-muted":"text-fg-primary"),children:a}),s&&r.jsx(w,{className:"text-xs text-fg-muted mt-0.5",children:s})]})]})});s.createContext({variant:"default",divider:"subtle",grid:!0});const zp="0.9.261",_p="'JetBrains Mono', monospace",Ip=s.memo(function({height:e=16,responsive:t=!1,className:n=""}){const a="var(--sys-blue)",s="var(--fg-primary)";if(t){const e=145,t=24;return r.jsxs("svg",{className:n,viewBox:`0 0 ${e} ${t}`,preserveAspectRatio:"xMidYMid meet",role:"img","aria-label":"pyMC:Console",style:{display:"block",width:"80%",height:"auto"},children:[r.jsx("style",{children:`\n .logo-text {\n font-family: ${_p};\n }\n .logo-accent {\n fill: var(--sys-blue, #719CDF);\n }\n .logo-main {\n fill: var(--fg-primary, #FFFFFF);\n }\n `}),r.jsxs("text",{x:"0",y:"18",className:"logo-text",fontSize:"20",fontWeight:"400",letterSpacing:"-0.02em",children:[r.jsx("tspan",{className:"logo-accent",children:"py"}),r.jsx("tspan",{className:"logo-main",children:"MC"}),r.jsx("tspan",{className:"logo-accent",children:":"}),r.jsx("tspan",{className:"logo-main",children:"Console"})]})]})}const o="string"==typeof e?parseFloat(e):e,i={fontFamily:_p,fontSize:.8*o+"px",fontWeight:400,lineHeight:1,letterSpacing:"-0.02em",whiteSpace:"nowrap"};return r.jsxs("span",{className:n,style:i,role:"img","aria-label":"pyMC:Console",children:[r.jsx("span",{style:{color:a},children:"py"}),r.jsx("span",{style:{color:s},children:"MC"}),r.jsx("span",{style:{color:a},children:":"}),r.jsx("span",{style:{color:s},children:"Console"})]})}),Vp="pymc_jwt_token",Op="pymc_client_id",$p="pymc_remember_me",qp=new Set;function Up(e){for(const n of qp)try{n(e)}catch(t){}}function Wp(){let e=localStorage.getItem(Op);return e||(e=`${Date.now()}-${Math.random().toString(36).substring(2,15)}`,localStorage.setItem(Op,e)),e}function Hp(){return"true"===localStorage.getItem($p)}function Yp(e){e?localStorage.setItem($p,"true"):localStorage.removeItem($p)}function Gp(){return Hp()?localStorage:sessionStorage}function Kp(){return Gp().getItem(Vp)||localStorage.getItem(Vp)||sessionStorage.getItem(Vp)}function Xp(e){Gp().setItem(Vp,e),Hp()?sessionStorage.removeItem(Vp):localStorage.removeItem(Vp),Up(e)}function Jp(){localStorage.removeItem(Vp),sessionStorage.removeItem(Vp),Up(null)}function Zp(){return!(!Kp()||eg()&&(Jp(),1))}function Qp(e){try{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(atob(t).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(n)}catch{return null}}function eg(){const e=Kp();if(!e)return!0;const t=Qp(e);return!t||!t.exp||Date.now()>=1e3*t.exp-6e4}function tg(){const e=Kp();if(!e)return 0;const t=Qp(e);return t&&t.exp?Math.max(0,Math.floor((1e3*t.exp-Date.now())/1e3)):0}function ng(){const e=Kp();if(!e)return!1;const t=Qp(e);if(!t||!t.exp)return!1;const n=1e3*t.exp-Date.now();return n>0&&n<3e5}function ag(){const e=Kp();if(!e)return null;const t=Qp(e);return t&&t.sub?t.sub:null}async function sg(e,t,n=!1){Yp(n);try{const n=await fetch("/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t,client_id:Wp()})}),a=n.headers.get("content-type");if(!a||!a.includes("application/json"))return{success:!1,error:`Server error: ${n.status}`};const s=await n.json();return s.success&&s.token?(Xp(s.token),{success:!0}):{success:!1,error:s.error||"Login failed"}}catch(a){return{success:!1,error:"Connection error. Please try again."}}}async function rg(){const e=Kp();if(!e)return!1;const t=Qp(e);(null==t?void 0:t.exp)&&Math.floor((1e3*t.exp-Date.now())/1e3);try{const t=await fetch("/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({client_id:Wp()})});if(!t.ok){let e="";try{const n=await t.json();e=n.error||JSON.stringify(n)}catch{e=t.statusText}return!1}const n=await t.json();if(n.success&&n.token){Xp(n.token);const e=Qp(n.token);return(null==e?void 0:e.exp)&&Math.floor((1e3*e.exp-Date.now())/1e3),!0}return!1}catch(n){return!1}}let og=null;async function ig(){const e=Kp();if(!e)return!1;const t=Qp(e);return(null==t?void 0:t.exp)&&Math.floor((1e3*t.exp-Date.now())/1e3),!ng()||og||(og=rg().finally(()=>{og=null}),og)}let lg=!1;const cg="",ug=new Map;let dg=!1;async function hg(e,t,n=!1){const a=function(e,t){return(null==t?void 0:t.method)&&"GET"!==t.method?"":e}(e,t);if(a){const e=ug.get(a);if(e)return e}const s=`${e}`;!n&&ng()&&await rg();const r=Kp();if(!r&&!e.includes("/auth/"))throw window.location.href="/login",new Error("Not authenticated");const o={Accept:"application/json",...r?{Authorization:`Bearer ${r}`}:{}};if(null==t?void 0:t.headers){const e=t.headers;e instanceof Headers?e.forEach((e,t)=>{o[t]=e}):Array.isArray(e)?e.forEach(([e,t])=>{o[e]=t}):Object.assign(o,e)}(null==t?void 0:t.body)&&(o["Content-Type"]="application/json");const i=(async()=>{const a=await fetch(s,{...t,headers:o});if(401===a.status){if(!n&&!dg&&await rg())return hg(e,t,!0);throw dg||(dg=!0,Jp(),window.location.replace("/login")),new Error("Session expired. Please log in again.")}if(!a.ok)throw new Error(`API error: ${a.status} ${a.statusText} (${e})`);return a.json()})();return a&&(ug.set(a,i),i.finally(()=>{ug.delete(a)})),i}const mg={spreadingFactor:7,bandwidthHz:125e3,codingRate:5,preambleLength:8,crcEnabled:!0,explicitHeader:!0};function pg(e){if(e.raw_packet){const t=e.raw_packet;if(/^[0-9a-fA-F]+$/.test(t)&&t.length%2==0)return t.length/2;if(/^[A-Za-z0-9+/=]+$/.test(t)){const e=(t.match(/=+$/)||[""])[0].length;return Math.floor(3*t.length/4)-e}return t.length}if(e.length&&e.length>0)return e.length;if(e.payload_length&&e.payload_length>0)return e.payload_length;if(e.payload){const t=e.payload;return/^[0-9a-fA-F]+$/.test(t)&&t.length%2==0?t.length/2:t.length}return 32}function gg(e,t={}){return void 0!==e.airtime_ms&&e.airtime_ms>0?e.airtime_ms:function(e,t={}){const n=t.spreadingFactor??mg.spreadingFactor,a=t.bandwidthHz??mg.bandwidthHz,s=t.codingRate??mg.codingRate,r=t.preambleLength??mg.preambleLength??8,o=t.crcEnabled??mg.crcEnabled?1:0,i=t.explicitHeader??mg.explicitHeader?0:1,l=n>=11&&a<=125e3?1:0,c=a/1e3,u=Math.pow(2,n)/c,d=(r+4.25)*u,h=Math.max(8*e-4*n+28+16*o-20*i,0),m=4*(n-2*l);return d+(8+Math.ceil(h/m)*s)*u}(pg(e),t)}function fg(e){return e&&"chat node"===e.toLowerCase()?"Companion":e}async function yg(){return function(e){if(e.neighbors)for(const t of Object.values(e.neighbors))t.contact_type=fg(t.contact_type);return e}(await hg("/api/stats"))}async function bg(){return hg("/api/logs")}async function vg(e=24){return hg(`/api/noise_floor_history?hours=${e}`)}const wg=new Map;function Cg(e=!1){if(e)wg.clear();else for(const[t]of wg)parseInt(t.split("-")[0],10)<=60&&wg.delete(t)}function kg(e,t,n,a){const s=60*e/t,r=Math.floor(Date.now()/1e3),o=Math.floor(r/s)*s,i=o-60*e,l=n.filter(e=>e.timestamp>=i&&e.timestamp<=o),c=a?function(e){var t;const n=null==(t=null==e?void 0:e.config)?void 0:t.radio;return{spreadingFactor:(null==n?void 0:n.spreading_factor)??mg.spreadingFactor,bandwidthHz:(null==n?void 0:n.bandwidth)??mg.bandwidthHz,codingRate:(null==n?void 0:n.coding_rate)??mg.codingRate,preambleLength:(null==n?void 0:n.preamble_length)??mg.preambleLength,crcEnabled:!0,explicitHeader:!0}}(a):mg,u=function(e,t,n,a,s){const r=new Array(t),o=new Array(t),i=new Array(t),l=new Array(t),c=new Array(t),u=new Array(t),d=new Array(t);for(let m=0;m=t)continue;const g=gg(h,s),f=h.packet_origin;if("tx_local"===f?(i[p].count++,i[p].airtime_ms+=g):"tx_forward"===f||h.transmitted?(l[p].count++,l[p].airtime_ms+=g):h.drop_reason&&(c[p].count++,c[p].airtime_ms+=g),"tx_local"!==f){r[p].count++,r[p].airtime_ms+=g,u[p].snr+=h.snr||0,u[p].rssi+=h.rssi||0,u[p].count++;const e=h.packet_hash;e&&!d[p].has(e)&&(d[p].add(e),o[p].count++,o[p].airtime_ms+=g)}}for(let m=0;m0&&(r[m].avg_snr=u[m].snr/u[m].count,r[m].avg_rssi=u[m].rssi/u[m].count);return{received:r,unique_received:o,transmitted:i,forwarded:l,dropped:c}}(l,t,i,s,c);return{time_range_minutes:e,bucket_count:t,bucket_duration_seconds:s,start_time:i,end_time:o,...u}}async function xg(e=24){return hg(`/api/crc_count?hours=${e}`)}let Dg=1;async function Ag(){var e,t;const n=await hg("/api/hardware_stats");return n.success&&(null==(t=null==(e=n.data)?void 0:e.cpu)?void 0:t.count)&&(Dg=n.data.cpu.count),n}async function Eg(){var e;const t=await hg("/api/hardware_processes");if(t.success&&(null==(e=t.data)?void 0:e.processes)&&Dg>1)for(const n of t.data.processes)n.cpu_percent=n.cpu_percent/Dg;return t}async function Bg(e){const t={...e};return null!=e.frequency_mhz&&(t.frequency=Math.round(1e6*e.frequency_mhz),delete t.frequency_mhz),null!=e.bandwidth_khz&&(t.bandwidth=Math.round(1e3*e.bandwidth_khz),delete t.bandwidth_khz),hg("/api/update_radio_config",{method:"POST",body:JSON.stringify(t)})}async function Fg(){return hg("/api/send_advert",{method:"POST",body:"{}"})}async function Sg(e){return hg("/api/set_mode",{method:"POST",body:JSON.stringify({mode:e})})}async function Mg(e){return hg("/api/set_duty_cycle",{method:"POST",body:JSON.stringify({enabled:e})})}async function jg(e){try{return await hg("/api/log_level",{method:"POST",body:JSON.stringify({level:e})})}catch(t){return{success:!1,error:t instanceof Error?t.message:"Unknown error"}}}async function Tg(){return hg("/api/identities")}async function Pg(e){const t=(new URLSearchParams).toString();return hg("/api/room_stats"+(t?"?"+t:""))}async function Lg(e,t,n,a,s=!1){const r=`/api/bulk_packets?${new URLSearchParams({limit:String(n),start_timestamp:String(e),end_timestamp:String(t)})}`,o={Accept:"application/json"},i=Kp();i&&(o.Authorization=`Bearer ${i}`);const l=new AbortController,c=setTimeout(()=>l.abort(),6e4);try{const i=await fetch(r,{headers:o,signal:l.signal});if(401===i.status&&!s&&await rg())return Lg(e,t,n,a,!0);if(!i.ok)throw new Error(`API ${i.status}`);const c=await i.json();return c.success&&c.data?c.data:[]}finally{clearTimeout(c)}}async function Rg(e,t,n,a,s){try{const r=await async function(e,t,n,a,s){const r=[];for(let l=s??Math.floor(Date.now()/1e3);l>e;l-=21600)r.push({start:Math.max(e,l-21600),end:l});let o=0,i=0;null==t||t({loaded:0,phase:"fetching",chunk:0});for(let l=0;l0&&await new Promise(e=>setTimeout(e,100));const e=r.slice(l,l+2);i++;const s=await Promise.all(e.map(e=>Ng(e.start,e.end,a,n)));for(const t of s)o+=t;null==t||t({loaded:o,phase:"fetching",chunk:i})}return null==t||t({loaded:o,phase:"complete",chunk:i}),o}(e,t,n,a,s);if(r>0)return r}catch{}return async function(e,t,n,a,s){let r=0,o=0,i=s??Math.floor(Date.now()/1e3);for(null==t||t({loaded:0,phase:"fetching",chunk:0});i>e&&o<100;){o++;try{const s=await Lg(e,i,1e4,a);if(0===s.length)break;r+=s.length;let l=i;for(let e=0;e=i)break;if(i=c,null==n||n(s),null==t||t({loaded:r,phase:"fetching",chunk:o}),s.length<1e4)break}catch(l){if(l instanceof Error&&"AbortError"===l.name)break;break}}return null==t||t({loaded:r,phase:"complete",chunk:o}),r}(e,t,n,a,s)}async function Ng(e,t,n,a){let s=t,r=0,o=0;for(;s>e&&o<100;){o++;const t=await Lg(e,s,2500,n);if(0===t.length)break;r+=t.length,null==a||a(t);let i=s;for(let e=0;e=s)break;if(s=l,t.length<2500)break}return r}"undefined"!=typeof window&&(window.diagnoseBulkFetch=async()=>{Date.now();const e=Kp();try{const t=`/api/bulk_packets?limit=100&start_timestamp=0&end_timestamp=${Math.floor(Date.now()/1e3)}`,n={Accept:"application/json"};e&&(n.Authorization=`Bearer ${e}`);const a=await fetch(t,{headers:n}),s=await a.text();try{JSON.parse(s).success}catch{}}catch(t){}});const zg="pymc-packet-cache",_g="pymc-packet-cache-meta",Ig=36e5,Vg=2592e5,Og=6048e5,$g=12096e5,qg=18144e5,Ug=2592e6,Wg=7776e6,Hg=5e5,Yg=class e{constructor(){a(this,"packets",new Map),a(this,"sortedPackets",[]),a(this,"sortedDirty",!0),a(this,"meta",{oldestTimestamp:0,newestTimestamp:0,lastUpdated:0,packetCount:0,backgroundLoadComplete:!1,topologyLoadComplete:!1,dataTier:"24h",threeDayLoadComplete:!1,sevenDayLoadComplete:!1,fourteenDayLoadComplete:!1,twentyOneDayLoadComplete:!1,thirtyDayLoadComplete:!1,ninetyDayLoadComplete:!1}),a(this,"isLoading",!1),a(this,"isBackgroundLoading",!1),a(this,"isTopologyLoading",!1),a(this,"listeners",new Set),a(this,"loadProgress",null),a(this,"saveTimer",null),a(this,"statusMessage",""),this.loadFromStorage()}subscribe(e){return this.listeners.add(e),e(this.getState()),()=>this.listeners.delete(e)}getState(){return{isLoading:this.isLoading,isBackgroundLoading:this.isBackgroundLoading,isTopologyLoading:this.isTopologyLoading,backgroundLoadComplete:this.meta.backgroundLoadComplete,topologyLoadComplete:this.meta.topologyLoadComplete,packetCount:this.packets.size,statusMessage:this.statusMessage,loadProgress:this.loadProgress,dataTier:this.meta.dataTier,threeDayLoadComplete:this.meta.threeDayLoadComplete,sevenDayLoadComplete:this.meta.sevenDayLoadComplete,fourteenDayLoadComplete:this.meta.fourteenDayLoadComplete,twentyOneDayLoadComplete:this.meta.twentyOneDayLoadComplete,thirtyDayLoadComplete:this.meta.thirtyDayLoadComplete,ninetyDayLoadComplete:this.meta.ninetyDayLoadComplete,maxRetentionDays:this.getMaxRetentionDays()}}getDataTier(){return this.meta.dataTier}getMaxRetentionDays(){if(!(this.meta.threeDayLoadComplete||this.meta.sevenDayLoadComplete||this.meta.fourteenDayLoadComplete||this.meta.twentyOneDayLoadComplete||this.meta.thirtyDayLoadComplete||this.meta.ninetyDayLoadComplete))return;const e=this.meta.oldestTimestamp;if(!e||e===1/0)return;const t=(Date.now()/1e3-e)/86400;return Math.ceil(t)+1}getPackets(){return this.sortedDirty&&(this.sortedPackets=Array.from(this.packets.values()).sort((e,t)=>(e.timestamp??0)-(t.timestamp??0)),this.sortedDirty=!1),this.sortedPackets}getNewestTimestamp(){return this.meta.newestTimestamp}getOldestTimestamp(){return this.meta.oldestTimestamp}isStale(){return 0===this.packets.size||Date.now()-this.meta.lastUpdated>Ig}isHeavyLoadInProgress(){return this.isBackgroundLoading||this.isTopologyLoading}async initialLoad(e){if(this.meta.backgroundLoadComplete&&this.packets.size>0)return this.getPackets();0===this.packets.size&&(this.meta.oldestTimestamp=1/0,this.meta.newestTimestamp=0),this.sortedDirty=!0,this.isLoading=!0,this.loadProgress={loaded:this.packets.size,target:3e4,percent:0},this.notifyListeners();const t=Math.floor((Date.now()-864e5)/1e3);try{await Rg(t,e=>{this.loadProgress={loaded:e.loaded,target:Math.max(3e4,e.loaded),percent:"complete"===e.phase?100:Math.min(95,10*e.chunk)},e.chunk%2==0&&this.notifyListeners()},t=>{this.bulkInsert(t),null==e||e()}),this.meta.packetCount=this.packets.size,this.meta.backgroundLoadComplete=!0,this.meta.dataTier="24h",this.loadProgress={loaded:this.packets.size,target:this.packets.size,percent:100},this.saveToStorage()}catch(n){}finally{this.isLoading=!1,this.loadProgress=null,this.notifyListeners()}return this.getPackets()}bulkInsert(e){let t=this.meta.oldestTimestamp;t!==1/0&&0!==t||(t=Number.MAX_SAFE_INTEGER);let n=this.meta.newestTimestamp;for(let a=0;an&&(n=o)}t0&&o<1/0?o:s;if(i<=r)return void(this.isBackgroundLoading=!1);const l=3e4*({"3d":2,"7d":6,"14d":13,"21d":20,"30d":29,"90d":89}[e]??13),c=this.packets.size,u=c+l;this.loadProgress={loaded:c,target:u,percent:0},this.statusMessage=`Loading ${e} history...`,this.notifyListeners();let d=0;try{await Rg(r,e=>{this.loadProgress={loaded:c+e.loaded,target:Math.max(u,c+e.loaded),percent:Math.min(99,Math.round((c+e.loaded)/u*100))},e.chunk%2==0&&this.notifyListeners()},e=>{const t=this.packets.size;this.bulkInsert(e),d+=this.packets.size-t,null==n||n()},void 0,i),this.enforceMemoryCap();const t=Date.now()-1e3*this.meta.oldestTimestamp;"3d"===e?(this.meta.threeDayLoadComplete=t>=Vg,this.meta.threeDayLoadComplete&&(this.meta.dataTier="3d")):"7d"===e?(this.meta.sevenDayLoadComplete=t>=Og,this.meta.sevenDayLoadComplete&&(this.meta.dataTier="7d")):"14d"===e?(this.meta.fourteenDayLoadComplete=t>=$g,this.meta.fourteenDayLoadComplete&&(this.meta.dataTier="14d")):"21d"===e?(this.meta.twentyOneDayLoadComplete=t>=qg,this.meta.twentyOneDayLoadComplete&&(this.meta.dataTier="21d")):"30d"===e?(this.meta.thirtyDayLoadComplete=t>=Ug,this.meta.thirtyDayLoadComplete&&(this.meta.dataTier="30d")):"90d"===e&&(this.meta.ninetyDayLoadComplete=t>=Wg,this.meta.ninetyDayLoadComplete&&(this.meta.dataTier="90d")),this.loadProgress={loaded:this.packets.size,target:this.packets.size,percent:100},this.notifyListeners(),this.saveToStorage()}catch(h){this.statusMessage=`${e} load failed`}finally{this.isBackgroundLoading=!1,this.statusMessage="",this.loadProgress=null,this.notifyListeners()}}isDataTierAvailable(e){switch(e){case"24h":return this.meta.backgroundLoadComplete;case"3d":return this.meta.threeDayLoadComplete;case"7d":return this.meta.sevenDayLoadComplete;case"14d":return this.meta.fourteenDayLoadComplete;case"21d":return this.meta.twentyOneDayLoadComplete;case"30d":return this.meta.thirtyDayLoadComplete;case"90d":return this.meta.ninetyDayLoadComplete;default:return!1}}async topologyLoad(){if(!this.meta.topologyLoadComplete&&!this.isTopologyLoading)return this.doTopologyLoad()}async forceTopologyLoad(){if(!this.isTopologyLoading)return this.meta.topologyLoadComplete=!1,this.doTopologyLoad()}async forceDeepLoad(){return this.forceTopologyLoad()}async doTopologyLoad(){this.isTopologyLoading=!0;const e=Date.now(),t=Math.floor(e/1e3),n=Math.floor((e-$g)/1e3),a=this.meta.oldestTimestamp,s=a>0&&a<1/0?a:t;if(s<=n)return this.meta.topologyLoadComplete=!0,void(this.isTopologyLoading=!1);const r=this.packets.size,o=r+42e4;this.statusMessage="Loading topology data...",this.loadProgress={loaded:r,target:o,percent:0},this.notifyListeners();let i=0;try{await Rg(n,e=>{this.loadProgress={loaded:r+e.loaded,target:Math.max(o,r+e.loaded),percent:Math.min(99,Math.round((r+e.loaded)/o*100))},e.chunk%2==0&&this.notifyListeners()},e=>{const t=this.packets.size;this.bulkInsert(e),i+=this.packets.size-t},void 0,s),this.enforceMemoryCap(),this.statusMessage=`Processing ${this.packets.size.toLocaleString()} packets...`,this.loadProgress={loaded:this.packets.size,target:this.packets.size,percent:100},this.notifyListeners(),this.meta.topologyLoadComplete=!0,this.meta.threeDayLoadComplete=!0,this.meta.sevenDayLoadComplete=!0,this.meta.fourteenDayLoadComplete=!0,this.meta.dataTier="14d",this.saveToStorage()}catch(l){this.statusMessage="Load failed"}finally{this.isTopologyLoading=!1,this.statusMessage="",this.loadProgress=null,this.notifyListeners()}}async poll(){try{const e=await this.fetchRecentPackets(100);if(e.success&&e.data){const t=this.packets.size;this.mergePackets(e.data),this.packets.size>t&&(this.saveToStorage(),this.notifyListeners())}}catch(e){}return this.getPackets()}clear(){this.packets.clear(),this.sortedPackets=[],this.sortedDirty=!0,this.meta={oldestTimestamp:0,newestTimestamp:0,lastUpdated:0,packetCount:0,backgroundLoadComplete:!1,topologyLoadComplete:!1,dataTier:"24h",threeDayLoadComplete:!1,sevenDayLoadComplete:!1,fourteenDayLoadComplete:!1,twentyOneDayLoadComplete:!1,thirtyDayLoadComplete:!1,ninetyDayLoadComplete:!1},this.clearStorage(),this.notifyListeners()}mergePacketsDirectly(e){const t=this.packets.size;this.mergePackets(e);const n=this.packets.size-t;return n>0&&(this.enforceMemoryCap(),this.saveToStorage(),this.notifyListeners()),n}mergePackets(e){let t=!1;for(const n of e){const e=n.packet_hash;if(!e)continue;const a=n.timestamp??0,s=`${e}:${a}`;this.packets.has(s)||(this.packets.set(s,n),t=!0),(0===this.meta.oldestTimestamp||athis.meta.newestTimestamp&&(this.meta.newestTimestamp=a)}t&&(this.sortedDirty=!0),this.meta.lastUpdated=Date.now(),this.meta.packetCount=this.packets.size}notifyListeners(){const e=this.getState();for(const t of this.listeners)t(e)}enforceMemoryCap(){if(this.packets.size<=Hg)return;const e=this.getPackets(),t=e.length-Hg;for(let n=0;nt&&(this.meta.oldestTimestamp=e[t].timestamp??0)}loadFromStorage(){if("undefined"!=typeof window)try{const e=localStorage.getItem(_g);e&&(this.meta=JSON.parse(e));const t=localStorage.getItem(zg);if(t){const e=JSON.parse(t);let n=1/0,a=0;for(const t of e)if(t.packet_hash){const e=t.timestamp??0,s=`${t.packet_hash}:${e}`;this.packets.set(s,t),e>0&&ea&&(a=e)}this.packets.size>0&&n!==1/0&&(this.meta.oldestTimestamp=n,this.meta.newestTimestamp=a)}if(this.meta.lastUpdated>0&&Date.now()-this.meta.lastUpdated>Ig)return void this.clear();this.meta.backgroundLoadComplete=!1,this.meta.threeDayLoadComplete=!1,this.meta.sevenDayLoadComplete=!1,this.meta.fourteenDayLoadComplete=!1,this.meta.dataTier="24h";const n=37500;this.meta.topologyLoadComplete&&this.packets.size{this.saveTimer=null,this.flushToStorage()},e.SAVE_DEBOUNCE_MS)))}flushToStorage(){try{localStorage.setItem(_g,JSON.stringify(this.meta));const e=this.getPackets(),t=e.length>3e3?e.slice(-3e3):e;localStorage.setItem(zg,JSON.stringify(t))}catch(e){if(e instanceof DOMException&&"QuotaExceededError"===e.name)try{localStorage.removeItem(zg),localStorage.setItem(_g,JSON.stringify(this.meta))}catch{}}}clearStorage(){if("undefined"!=typeof window)try{localStorage.removeItem(zg),localStorage.removeItem(_g)}catch(e){}}async fetchRecentPackets(e=1e3,t=!1){const n=`/api/recent_packets?limit=${e}`,a=Kp(),s={Accept:"application/json"};a&&(s.Authorization=`Bearer ${a}`);const r=await fetch(n,{headers:s});if(401===r.status&&!t&&await rg())return this.fetchRecentPackets(e,!0);if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}};a(Yg,"SAVE_DEBOUNCE_MS",1e4);const Gg=new Yg;function Kg(e){return{paths:e.paths,byEndpoints:new Map(e.byEndpointsEntries),canonicalPaths:new Map(e.canonicalPathsEntries),totalObservations:e.totalObservations,uniquePathCount:e.uniquePathCount}}function Xg(){return{paths:[],byEndpoints:new Map,canonicalPaths:new Map,totalObservations:0,uniquePathCount:0}}const Jg=new class{constructor(){a(this,"worker",null),a(this,"listeners",new Set),a(this,"currentTopology",{edges:[],validatedEdges:[],weakEdges:[],certainEdges:[],uncertainEdges:[],edgeMap:new Map,maxPacketCount:0,maxCertainCount:0,neighborAffinity:new Map,fullAffinity:new Map,localPrefix:null,centrality:new Map,hubNodes:[],gatewayNodes:[],loops:[],loopEdgeKeys:new Set,txDelayRecommendations:new Map,pathRegistry:Xg(),edgeBetweenness:new Map,backboneEdges:[],nodeMobility:new Map,mobileNodes:[],pathHealth:[],lastHopNeighbors:[],disambiguationStats:{totalPrefixes:0,unambiguousPrefixes:0,collisionPrefixes:0,collisionRate:0,avgConfidence:0,lowConfidencePrefixes:[],highCollisionPrefixes:[],totalResolutions:0},discoveredNodes:[],viterbiStats:{totalPaths:0,pathsWithGhosts:0,avgPathCost:0,avgPathConfidence:0,observationOverrideCount:0,tracePacketsProcessed:0,pathPacketsProcessed:0,distantEdgesDiscovered:0,duplicateGroupsFound:0,duplicatePathsUnique:0,echolocationEdgesInferred:0},nodeMetrics:new Map,communityCount:0,backboneNodes:[],traceLinks:new Map,traceLinkSummary:{totalDirectedLinks:0,totalTraces:0,totalObservations:0,bidirectionalLinks:0,avgSnr:0,qualityCounts:{excellent:0,good:0,fair:0,poor:0,critical:0}}}),a(this,"isComputing",!1),a(this,"pendingRequest",null),a(this,"debounceTimer",null),a(this,"debounceMs",100)}ensureWorker(){if(this.worker)return this.worker;if("undefined"==typeof window)return null;try{this.worker=new Worker(new URL("/assets/topology.worker-DMNQ8G_E.js",import.meta.url),{type:"module"}),this.worker.onmessage=e=>{this.handleWorkerMessage(e.data)},this.worker.onerror=e=>{}}catch(e){}return this.worker}handleWorkerMessage(e){if(this.isComputing=!1,"error"!==e.type){var t;this.currentTopology={edges:(t=e.payload).edges??[],validatedEdges:t.validatedEdges??[],weakEdges:t.weakEdges??[],certainEdges:t.certainEdges??[],uncertainEdges:t.uncertainEdges??[],maxPacketCount:t.maxPacketCount??0,maxCertainCount:t.maxCertainCount??0,localPrefix:t.localPrefix??null,hubNodes:t.hubNodes??[],gatewayNodes:t.gatewayNodes??[],edgeMap:new Map(t.edgeMapEntries??[]),neighborAffinity:new Map(t.neighborAffinityEntries??[]),fullAffinity:new Map(t.fullAffinityEntries??[]),centrality:new Map(t.centralityEntries??[]),loops:t.loops??[],loopEdgeKeys:new Set(t.loopEdgeKeyEntries??[]),txDelayRecommendations:new Map(t.txDelayRecommendationEntries??[]),pathRegistry:t.pathRegistry?Kg(t.pathRegistry):Xg(),edgeBetweenness:new Map(t.edgeBetweennessEntries??[]),backboneEdges:t.backboneEdges??[],nodeMobility:new Map(t.nodeMobilityEntries??[]),mobileNodes:t.mobileNodes??[],pathHealth:t.pathHealth??[],lastHopNeighbors:t.lastHopNeighbors??[],disambiguationStats:t.disambiguationStats??{totalPrefixes:0,unambiguousPrefixes:0,collisionPrefixes:0,collisionRate:0,avgConfidence:0,lowConfidencePrefixes:[],highCollisionPrefixes:[],totalResolutions:0},discoveredNodes:t.discoveredNodes??[],viterbiStats:t.viterbiStats??{totalPaths:0,pathsWithGhosts:0,avgPathCost:0,avgPathConfidence:0,observationOverrideCount:0,tracePacketsProcessed:0,pathPacketsProcessed:0,distantEdgesDiscovered:0,duplicateGroupsFound:0,duplicatePathsUnique:0,echolocationEdgesInferred:0},nodeMetrics:new Map(t.nodeMetricsEntries??[]),communityCount:t.communityCount??0,backboneNodes:t.backboneNodes??[],traceLinks:new Map(t.traceLinkEntries??[]),traceLinkSummary:t.traceLinkSummary??{totalDirectedLinks:0,totalTraces:0,totalObservations:0,bidirectionalLinks:0,avgSnr:0,qualityCounts:{excellent:0,good:0,fair:0,poor:0,critical:0}}};for(const t of this.listeners)try{t(this.currentTopology,e.computeTimeMs)}catch(n){}if(this.pendingRequest){const e=this.pendingRequest;this.pendingRequest=null,this.computeInternal(e)}}}computeInternal(e){const t=this.ensureWorker();if(!t)return;this.isComputing=!0;const n={type:"compute",payload:e};t.postMessage(n)}compute(e,t,n,a,s,r,o,i){const l={packets:e,neighbors:t,localHash:n,localLat:a,localLon:s,airtimeMs:r,zeroHopNeighbors:o,terrainGrid:i,enableTerrainAware:void 0!==i};this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.isComputing?this.pendingRequest=l:this.computeInternal(l)},this.debounceMs)}subscribe(e){return this.listeners.add(e),this.currentTopology.edges.length>0&&e(this.currentTopology,0),()=>{this.listeners.delete(e)}}getTopology(){return this.currentTopology}isWorking(){return this.isComputing}terminate(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.worker&&(this.worker.terminate(),this.worker=null),this.listeners.clear()}},Zg=new class{constructor(){a(this,"worker",null),a(this,"listeners",new Set),a(this,"sparklines",new Map),a(this,"isComputing",!1),a(this,"lastComputeTimeMs",0),a(this,"pendingRequest",null),a(this,"debounceTimer",null),a(this,"debounceMs",150),this.initWorker()}initWorker(){if("undefined"!=typeof window)try{this.worker=new Worker(new URL("/assets/sparkline.worker-CmKhBAy5.js",import.meta.url),{type:"module"}),this.worker.onmessage=e=>{this.handleWorkerMessage(e.data)},this.worker.onerror=e=>{this.isComputing=!1,this.notifyListeners()}}catch(e){}}handleWorkerMessage(e){if(this.isComputing=!1,"error"!==e.type){if(this.sparklines=new Map(e.payload.sparklineEntries),this.lastComputeTimeMs=e.computeTimeMs,this.notifyListeners(),this.pendingRequest){const e=this.pendingRequest;this.pendingRequest=null,this.computeInternal(e.packets,e.nodeHashes)}}else this.notifyListeners()}computeInternal(e,t){if(!this.worker)return;if(0===t.length)return this.isComputing=!1,void this.notifyListeners();this.isComputing=!0,this.notifyListeners();const n={type:"compute",payload:{packets:e,nodeHashes:t}};this.worker.postMessage(n)}notifyListeners(){for(const t of this.listeners)try{t(this.sparklines,this.isComputing)}catch(e){}}compute(e,t){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.isComputing?this.pendingRequest={packets:e,nodeHashes:t}:this.computeInternal(e,t)},this.debounceMs)}getSparkline(e){return this.sparklines.get(e)??[]}getAllSparklines(){return this.sparklines}hasSparkline(e){return this.sparklines.has(e)}isWorking(){return this.isComputing}getLastComputeTime(){return this.lastComputeTimeMs}subscribe(e){return this.listeners.add(e),e(this.sparklines,this.isComputing),()=>{this.listeners.delete(e)}}clear(){this.sparklines.clear(),this.notifyListeners()}terminate(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.worker&&(this.worker.terminate(),this.worker=null),this.listeners.clear()}},Qg=new class{constructor(){a(this,"ws",null),a(this,"connectionState","disconnected"),a(this,"reconnectAttempts",0),a(this,"pingIntervalId",null),a(this,"lastPongTime",Date.now()),a(this,"reconnectTimeoutId",null),a(this,"packetListeners",new Set),a(this,"statsListeners",new Set),a(this,"systemStatsListeners",new Set),a(this,"packetStatsListeners",new Set),a(this,"connectionListeners",new Set),a(this,"unsubscribeTokenChange",null),a(this,"wsSupported",!0)}buildWsUrl(){const e=Kp(),t=Wp(),n=new URLSearchParams;e&&n.set("token",e),t&&n.set("client_id",t);const a=n.toString()?`?${n.toString()}`:"";return`${"https:"===window.location.protocol?"wss:":"ws:"}//${window.location.host}/ws/packets${a}`}connect(){var e,t;if((null==(e=this.ws)?void 0:e.readyState)!==WebSocket.OPEN&&(null==(t=this.ws)?void 0:t.readyState)!==WebSocket.CONNECTING&&this.wsSupported){this.setConnectionState("connecting");try{const e=this.buildWsUrl();this.ws=new WebSocket(e),this.ws.onopen=this.handleOpen.bind(this),this.ws.onmessage=this.handleMessage.bind(this),this.ws.onerror=this.handleError.bind(this),this.ws.onclose=this.handleClose.bind(this),this.unsubscribeTokenChange||(this.unsubscribeTokenChange=(n=e=>{e&&"connected"===this.connectionState&&(this.disconnect(),this.connect())},qp.add(n),()=>qp.delete(n)))}catch(a){this.wsSupported=!1,this.setConnectionState("disconnected")}var n}}disconnect(){this.clearPingInterval(),this.clearReconnectTimeout(),this.ws&&(this.ws.onopen=null,this.ws.onmessage=null,this.ws.onerror=null,this.ws.onclose=null,this.ws.readyState!==WebSocket.OPEN&&this.ws.readyState!==WebSocket.CONNECTING||this.ws.close(1e3,"Client disconnect"),this.ws=null),this.setConnectionState("disconnected"),this.reconnectAttempts=0}isConnected(){var e;return(null==(e=this.ws)?void 0:e.readyState)===WebSocket.OPEN}getConnectionState(){return this.connectionState}isSupported(){return this.wsSupported}resetSupported(){this.wsSupported||(this.wsSupported=!0,this.reconnectAttempts=0)}send(e){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(e)),!0}catch(t){return!1}}onPacket(e){return this.packetListeners.add(e),()=>this.packetListeners.delete(e)}onStats(e){return this.statsListeners.add(e),()=>this.statsListeners.delete(e)}onSystemStats(e){return this.systemStatsListeners.add(e),()=>this.systemStatsListeners.delete(e)}onPacketStats(e){return this.packetStatsListeners.add(e),()=>this.packetStatsListeners.delete(e)}onConnectionChange(e){return this.connectionListeners.add(e),e(this.connectionState,this.reconnectAttempts),()=>this.connectionListeners.delete(e)}handleOpen(){this.setConnectionState("connected"),this.reconnectAttempts=0,this.lastPongTime=Date.now();const e=Kp();e&&this.ws&&this.ws.send(JSON.stringify({type:"auth",token:e})),this.startPingInterval()}handleMessage(e){try{const t=JSON.parse(e.data);switch(t.type){case"packet":this.notifyPacketListeners(t.data);break;case"stats":{const e=t.data;e&&"noise_floor_dbm"in e&&this.notifyStatsListeners(e),(null==e?void 0:e.packet_stats)&&this.notifyPacketStatsListeners(e.packet_stats),(null==e?void 0:e.system_stats)&&this.notifySystemStatsListeners(e.system_stats);break}case"packet_stats":{const e=t.data;this.notifyPacketStatsListeners(e);break}case"system_stats":this.notifySystemStatsListeners(t.data);break;case"ping":this.lastPongTime=Date.now(),this.send({type:"pong"});break;case"pong":this.lastPongTime=Date.now()}}catch(t){}}handleError(e){}handleClose(e){this.clearPingInterval(),1e3!==e.code?(1006===e.code&&this.reconnectAttempts,this.scheduleReconnect()):this.setConnectionState("disconnected")}setConnectionState(e){if(this.connectionState!==e){this.connectionState=e;for(const n of this.connectionListeners)try{n(e,this.reconnectAttempts)}catch(t){}}}notifyPacketListeners(e){for(const n of this.packetListeners)try{n(e)}catch(t){}}notifyStatsListeners(e){for(const n of this.statsListeners)try{n(e)}catch(t){}}notifySystemStatsListeners(e){for(const n of this.systemStatsListeners)try{n(e)}catch(t){}}notifyPacketStatsListeners(e){for(const n of this.packetStatsListeners)try{n(e)}catch(t){}}startPingInterval(){this.clearPingInterval(),this.pingIntervalId=setInterval(()=>{var e;(null==(e=this.ws)?void 0:e.readyState)===WebSocket.OPEN&&(this.send({type:"ping"}),Date.now()-this.lastPongTime>6e4&&(this.disconnect(),this.connect()))},3e4)}async verifyConnection(e=5e3){return!(!this.ws||this.ws.readyState!==WebSocket.OPEN)&&new Promise(t=>{const n=Date.now(),a=this.lastPongTime;this.send({type:"ping"});const s=setInterval(()=>{this.lastPongTime>a?(clearInterval(s),t(!0)):Date.now()-n>e&&(clearInterval(s),t(!1))},100)})}clearPingInterval(){this.pingIntervalId&&(clearInterval(this.pingIntervalId),this.pingIntervalId=null)}scheduleReconnect(){if(this.reconnectAttempts>=20)return this.wsSupported=!1,void this.setConnectionState("disconnected");this.setConnectionState("reconnecting");const e=Math.min(1e3*Math.pow(2,Math.min(this.reconnectAttempts,5)),3e4);this.reconnectAttempts++,this.reconnectTimeoutId=setTimeout(()=>{this.reconnectTimeoutId=null,this.connect()},e)}clearReconnectTimeout(){this.reconnectTimeoutId&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=null)}terminate(){this.disconnect(),this.unsubscribeTokenChange&&(this.unsubscribeTokenChange(),this.unsubscribeTokenChange=null),this.packetListeners.clear(),this.statsListeners.clear(),this.systemStatsListeners.clear(),this.packetStatsListeners.clear(),this.connectionListeners.clear()}},ef=A(e=>({connectionState:"disconnected",isSupported:!0,reconnectAttempt:0,lastConnected:null,initialize:()=>{Qg.onConnectionChange((t,n)=>{e(e=>({connectionState:t,reconnectAttempt:n??0,isSupported:Qg.isSupported(),lastConnected:"connected"===t?Date.now():e.lastConnected}))}),Qg.connect()}})),tf=.05,nf=1e3,af="terrarium";function sf(e,t,n){try{return e.queryTerrainElevation({lng:t,lat:n})??0}catch{return 0}}const rf=A((e,t)=>({terrainGrid:null,isLoading:!1,error:null,lastLoadedAt:null,cachedBounds:null,terrainDisambiguationEnabled:!0,loadTerrain:async(n,a)=>{const s=t();if(!(s.isLoading||(r=s.cachedBounds,o=n,r&&r.minLat<=o.minLat&&r.maxLat>=o.maxLat&&r.minLng<=o.minLng&&r.maxLng>=o.maxLng))){var r,o;e({isLoading:!0,error:null});try{a.getTerrain()||(a.getSource(af)||(a.addSource(af,{type:"raster-dem",tiles:["https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png"],encoding:"terrarium",tileSize:256}),await new Promise((e,t)=>{const n=setTimeout(()=>t(new Error("Terrain source load timeout")),1e4),s=t=>{t.sourceId===af&&t.isSourceLoaded&&(clearTimeout(n),a.off("sourcedata",s),e())};a.on("sourcedata",s)})),a.setTerrain({source:af}),await new Promise(e=>setTimeout(e,500)));const t=await async function(e,t){const{minLat:n,maxLat:a,minLng:s,maxLng:r}=t;let o=Math.ceil((r-s)/.001),i=Math.ceil((a-n)/.001);o>nf&&(o=nf),i>nf&&(i=nf);const l=(r-s)/o,c=(a-n)/i,u=Math.max(l,c),d=new Float32Array(o*i);let h=0;for(let m=0;msetTimeout(e,0))}}return{origin:[n,s],cellSize:u,width:o,height:i,elevations:d}}(a,n);e({terrainGrid:t,isLoading:!1,lastLoadedAt:Date.now(),cachedBounds:n})}catch(i){const t=i instanceof Error?i.message:"Unknown error loading terrain";e({isLoading:!1,error:t})}}},preloadFromNodes:async(e,n)=>{const a=function(e){const t=e.filter(e=>void 0!==e.latitude&&void 0!==e.longitude&&(0!==e.latitude||0!==e.longitude));if(0===t.length)return null;let n=1/0,a=-1/0,s=1/0,r=-1/0;for(const o of t)n=Math.min(n,o.latitude),a=Math.max(a,o.latitude),s=Math.min(s,o.longitude),r=Math.max(r,o.longitude);return{minLat:n-tf,maxLat:a+tf,minLng:s-tf,maxLng:r+tf}}(e);a&&await t().loadTerrain(a,n)},clearTerrain:()=>{e({terrainGrid:null,cachedBounds:null,lastLoadedAt:null,error:null})},setTerrainDisambiguationEnabled:t=>{e({terrainDisambiguationEnabled:t})},getTerrainGridForDisambiguation:()=>{const e=t();return e.terrainDisambiguationEnabled?e.terrainGrid:null}})),of="pymc-stealth-location";function lf(e){if("undefined"!=typeof window)try{localStorage.setItem(of,JSON.stringify(e))}catch{}}function cf(e){return!isNaN(e)&&e>=-90&&e<=90}function uf(e){return!isNaN(e)&&e>=-180&&e<=180}const df=function(){if("undefined"==typeof window)return{};try{const e=localStorage.getItem(of);if(!e)return{};const t=JSON.parse(e);if("number"==typeof t.latitude&&"number"==typeof t.longitude&&"boolean"==typeof t.enabled&&cf(t.latitude)&&uf(t.longitude))return t}catch{}return{}}(),hf=A((e,t)=>({latitude:df.latitude??null,longitude:df.longitude??null,enabled:df.enabled??!1,setLocation:(n,a)=>{cf(n)&&uf(a)&&(e({latitude:n,longitude:a}),lf({latitude:n,longitude:a,enabled:t().enabled}))},enable:()=>{const{latitude:n,longitude:a}=t();null!==n&&null!==a&&(e({enabled:!0}),lf({latitude:n,longitude:a,enabled:!0}))},disable:()=>{e({enabled:!1});const{latitude:n,longitude:a}=t();null!==n&&null!==a&&lf({latitude:n,longitude:a,enabled:!1})},clear:()=>{e({latitude:null,longitude:null,enabled:!1}),function(){if("undefined"!=typeof window)try{localStorage.removeItem(of)}catch{}}()},getEffectiveLocation:()=>{const{latitude:e,longitude:n,enabled:a}=t();return a&&null!==e&&null!==n?{latitude:e,longitude:n}:null},isActive:()=>{const{latitude:e,longitude:n,enabled:a}=t();return a&&null!==e&&null!==n}}));function mf(e,t,n,a){return!t&&a>=3?"offline":n?"connected"!==e&&t||a>0&&a<3?"degraded":"connected":"offline"}const pf=A((e,t)=>({wsState:"disconnected",wsReconnectAttempt:0,restHealthy:!0,lastSuccessfulFetch:null,consecutiveFailures:0,authValid:!0,authExpiresIn:null,health:"connected",bannerDismissed:!1,isInitializing:!0,initialize:()=>{Qg.onConnectionChange((n,a)=>{const{restHealthy:s,authValid:r,consecutiveFailures:o,health:i,isInitializing:l}=t(),c=l&&"connected"===n,u=mf(n,s,r,o);e({wsState:n,wsReconnectAttempt:a??0,health:u,isInitializing:!c&&l,bannerDismissed:(u===i||"connected"!==u)&&t().bannerDismissed})}),t().updateAuthState(),setTimeout(()=>{t().isInitializing&&e({isInitializing:!1})},1e4),setInterval(()=>{t().updateAuthState()},3e4)},updateRestHealth:n=>{const{wsState:a,authValid:s,consecutiveFailures:r,health:o}=t(),i=n?0:r+1,l=n||i<3,c=n?Date.now():t().lastSuccessfulFetch,u=mf(a,l,s,i);e({restHealthy:l,lastSuccessfulFetch:c,consecutiveFailures:i,health:u,bannerDismissed:"connected"!==u&&u===o&&t().bannerDismissed})},updateAuthState:()=>{const n=Zp()&&!eg(),a=tg(),{wsState:s,restHealthy:r,consecutiveFailures:o,health:i}=t(),l=mf(s,r,n,o);e({authValid:n,authExpiresIn:a>0?a:null,health:l,bannerDismissed:l===i&&t().bannerDismissed})},dismissBanner:()=>{e({bannerDismissed:!0})}})),gf=()=>pf(e=>e.health),ff=new class{constructor(){a(this,"worker",null),a(this,"isReady",!1),a(this,"pendingRequests",[]),a(this,"currentRequest",null),this.initWorker()}initWorker(){if("undefined"!=typeof window)try{this.worker=new Worker(new URL("/assets/decryption.worker-D2Jy06E5.js",import.meta.url),{type:"module"}),this.worker.onmessage=this.handleMessage.bind(this),this.worker.onerror=e=>{}}catch(e){}}handleMessage(e){var t,n,a,s;const r=e.data;switch(r.type){case"ready":this.isReady=!0,this.processNextRequest();break;case"progress":(null==(t=this.currentRequest)?void 0:t.onProgress)&&this.currentRequest.onProgress(r.processed,r.total);break;case"result":(null==(n=this.currentRequest)?void 0:n.onResult)&&this.currentRequest.onResult(r.result);break;case"results":if(null==(a=this.currentRequest)?void 0:a.onResults)this.currentRequest.onResults(r.results);else if(null==(s=this.currentRequest)?void 0:s.onResult)for(const e of r.results)this.currentRequest.onResult(e);break;case"batchComplete":this.currentRequest&&(this.currentRequest.onBatchComplete(r.successCount,r.totalCount,r.computeTimeMs),this.currentRequest=null),this.processNextRequest();break;case"error":this.currentRequest&&(this.currentRequest.onBatchComplete(0,0,0),this.currentRequest=null),this.processNextRequest()}}processNextRequest(){if(!this.isReady||!this.worker||this.currentRequest)return;const e=this.pendingRequests.shift();if(!e)return;this.currentRequest={onProgress:e.onProgress,onResult:e.onResult,onResults:e.onResults,onBatchComplete:e.onBatchComplete};const t={type:"decrypt",packets:e.packets,knownKey:e.knownKey};this.worker.postMessage(t)}decrypt(e,t){return new Promise(n=>{const a=e.map(e=>({packet_hash:e.packet_hash,raw_packet:e.raw_packet||"",timestamp:e.timestamp??0,rssi:e.rssi,snr:e.snr,type:e.type,payload_type:e.payload_type}));this.pendingRequests.push({packets:a,knownKey:null==t?void 0:t.knownKey,onProgress:null==t?void 0:t.onProgress,onResults:null==t?void 0:t.onResults,onResult:null==t?void 0:t.onResult,onBatchComplete:(e,t,a)=>{n({successCount:e,totalCount:t,computeTimeMs:a})}}),this.processNextRequest()})}isServiceReady(){return this.isReady}isProcessing(){return null!==this.currentRequest}getPendingCount(){return this.pendingRequests.length}pause(){if(this.worker){const e={type:"pause"};this.worker.postMessage(e)}}resume(){if(this.worker){const e={type:"resume"};this.worker.postMessage(e)}}terminate(){if(this.worker){const e={type:"stop"};this.worker.postMessage(e),this.worker.terminate(),this.worker=null}this.isReady=!1,this.pendingRequests=[],this.currentRequest=null}},yf=3,bf=2,vf=15,wf=6,Cf=3,kf=0,xf=1,Df=2,Af=3,Ef={[kf]:"T_FLOOD",[xf]:"FLOOD",[Df]:"DIRECT",[Af]:"T_DIRECT"},Bf=0,Ff=1,Sf=2,Mf=3,jf=4,Tf=5,Pf=6,Lf=7,Rf=8,Nf=9,zf=10,_f=11,If=15,Vf={REQ:0,RESPONSE:1,ADVERT:4,GRP_TXT:5,GRP_DATA:6,ANON_REQ:7,TRACE:9},Of={[Bf]:"REQ",[Ff]:"RESPONSE",[Sf]:"TXT_MSG",[Mf]:"ACK",[jf]:"ADVERT",[Tf]:"GRP_TXT",[Pf]:"GRP_DATA",[Lf]:"ANON_REQ",[Rf]:"PATH",[Nf]:"TRACE",[zf]:"MULTIPART",[_f]:"CONTROL",[If]:"RAW_CUSTOM"},$f=1,qf=32,Uf=64,Wf=64,Hf=4,Yf=1,Gf=2,Kf=3,Xf=4,Jf=16,Zf=128,Qf=15;function ey(e){return 1===e||0===e}function ty(e){return 2===e||3===e}function ny(e){return 0===e||3===e}function ay(e){const t=[];switch(15&e){case 1:t.push("is companion");break;case 2:t.push("is repeater");break;case 3:t.push("is room server");break;case 4:t.push("is sensor")}return 16&e&&t.push("has location"),32&e&&t.push("has feature 1"),64&e&&t.push("has feature 2"),128&e&&t.push("has name"),t.join(", ")||"none"}function sy(e){return Ef[e]??`UNKNOWN(${e})`}function ry(e){return Of[e]??`UNKNOWN(${e})`}function oy(e){const t=e.replace(/^0x/i,"").replace(/\s/g,"");if(t.length%2!=0)throw new Error("Invalid hex string: odd number of characters");const n=new Uint8Array(t.length/2);for(let a=0;ae.toString(16).padStart(2,"0")).join("");return t&&(a=a.toUpperCase()),n&&(a="0x"+a),a}function ly(e,t=!0){const n=(255&e).toString(16).padStart(2,"0");return t?n.toUpperCase():n}function cy(e,t,n,a){if(e+t>n)throw new Error(a)}function uy(e){if(e>256)throw new Error(`payload too large: ${e} > 256`)}function dy(){return"undefined"!=typeof crypto&&void 0!==crypto.subtle&&"function"==typeof crypto.subtle.digest}const hy=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),my=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);function py(e,t){return(e>>>t|e<<32-t)>>>0}function gy(e,t){let n=e[0],a=e[1],s=e[2],r=e[3],o=e[4],i=e[5],l=e[6],c=e[7];for(let u=0;u<64;u++){if(u>=16){const e=py(t[u-15&15],7)^py(t[u-15&15],18)^t[u-15&15]>>>3,n=py(t[u-2&15],17)^py(t[u-2&15],19)^t[u-2&15]>>>10;t[15&u]=t[15&u]+e+t[u-7&15]+n>>>0}const e=c+(py(o,6)^py(o,11)^py(o,25))+(o&i^~o&l)+hy[u]+t[15&u]>>>0,d=n&a^n&s^a&s;c=l,l=i,i=o,o=r+e>>>0,r=s,s=a,a=n,n=e+((py(n,2)^py(n,13)^py(n,22))+d>>>0)>>>0}e[0]=e[0]+n>>>0,e[1]=e[1]+a>>>0,e[2]=e[2]+s>>>0,e[3]=e[3]+r>>>0,e[4]=e[4]+o>>>0,e[5]=e[5]+i>>>0,e[6]=e[6]+l>>>0,e[7]=e[7]+c>>>0}function fy(e){const t=new Uint32Array(my),n=new Uint32Array(16),a=8*e.length,s=e.length+9+63&-64,r=new Uint8Array(s);r.set(e),r[e.length]=128;const o=new DataView(r.buffer);o.setUint32(s-4,a,!1);for(let c=0;c>=1}return n}function ky(e){let t=e[13];e[13]=e[9],e[9]=e[5],e[5]=e[1],e[1]=t,t=e[2],e[2]=e[10],e[10]=t,t=e[6],e[6]=e[14],e[14]=t,t=e[3],e[3]=e[7],e[7]=e[11],e[11]=e[15],e[15]=t}function xy(e){for(let t=0;t<16;t++)e[t]=vy[e[t]]}function Dy(e,t){for(let n=0;n<16;n++)e[n]^=t[n]}function Ay(e){for(let t=0;t<4;t++){const n=4*t,a=e[n],s=e[n+1],r=e[n+2],o=e[n+3];e[n]=Cy(14,a)^Cy(11,s)^Cy(13,r)^Cy(9,o),e[n+1]=Cy(9,a)^Cy(14,s)^Cy(11,r)^Cy(13,o),e[n+2]=Cy(13,a)^Cy(9,s)^Cy(14,r)^Cy(11,o),e[n+3]=Cy(11,a)^Cy(13,s)^Cy(9,r)^Cy(14,o)}}function Ey(e,t){const n=new Uint8Array(e);Dy(n,t[10]);for(let a=9;a>=1;a--)ky(n),xy(n),Dy(n,t[a]),Ay(n);return ky(n),xy(n),Dy(n,t[0]),n}function By(e,t){const n=function(e){const t=[],n=new Uint8Array(176);n.set(e.slice(0,16));for(let a=16;a<176;a+=4){let e=n[a-4],t=n[a-3],s=n[a-2],r=n[a-1];if(a%16==0){const n=e;e=by[t]^wy[a/16-1],t=by[s],s=by[r],r=by[n]}n[a]=n[a-16]^e,n[a+1]=n[a-15]^t,n[a+2]=n[a-14]^s,n[a+3]=n[a-13]^r}for(let a=0;a<11;a++)t.push(n.slice(16*a,16*(a+1)));return t}(e),a=new Uint8Array(t.length);for(let s=0;s>>0}function jy(e,t){return e[t]|e[t+1]<<8}function Ty(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Py(e,t,n){t[n]=255&e,t[n+1]=e>>8&255}function Ly(e){return(e instanceof Uint8Array?Array.from(e):e).map(e=>ly(e,!0)).join("->")}const Ry={name:"Public",secret:"8b3387e9c5cdea6ac9e5edbaa115cd72"},Ny=["southbay","south-bay","bot","ventura","weather","wardrive","test","icewatch","sbcountymesh","sb-county-mesh","sbcounty","sb-county","meshbud","mesh-bud","ai-bot","aibot","hdmesh","hd-mesh","hdme","hdme7","hdme7yard","hdmeyard","hdmeshtayrd","hdmestayrd","hdmestyard","hdmetayrd","hdmeshtnyard","mustard","socalmesh","socal-mesh","meshla","mesh-la","lamesh","la-mesh","westcoast","west-coast","wcmesh","wc-mesh","eastcoast","east-coast","midwest","southwest","northwest","northeast","southeast","california","cali","santaclarita","santa-clarita","scv","newhall","valencia","saugus","castaic","palmdale","lancaster","antelopevalley","antelope-valley","avmesh","av-mesh","highdesert","high-desert","mojave","victorville","hesperia","barstow","pomona","claremont","glendora","azusa","covina","westcovina","west-covina","walnut","diamondbar","diamond-bar","whittier","brea","yorbalinda","yorba-linda","montebello","montereypark","monterey-park","alhambra","arcadia","monrovia","duarte","hermosabeach","hermosa-beach","manhattanbeach","manhattan-beach","redondobeach","redondo-beach","palosverdes","palos-verdes","sanpedro","san-pedro","ojai","fillmore","santapaula","santa-paula","porthueneme","port-hueneme","general","public","main","default","chat","local","mesh","network","emergency","sos","help","news","info","status","alerts","announce","random","offtopic","off-topic","lobby","lounge","hangout","testing","dev","development","beta","alpha","experimental","personaltest","personal-test","mytest","my-test","testchannel","test-channel","meshcore","mesh-core","meshtastic","lora","lo-ra","lorawan","lora-wan","radio","ham","amateur","hamradio","ham-radio","amateurradio","repeater","repeaters","gateway","node","nodes","rf","rfmesh","offgrid","off-grid","prepper","preppers","emcomm","ares","races","socal","so-cal","southerncalifornia","southern-california","losangeles","los-angeles","la","laarea","la-area","greaterla","sfv","sfvalley","sf-valley","sanfernandovalley","san-fernando-valley","sanfernando","san-fernando","valley","thevalley","the-valley","westla","west-la","eastla","east-la","southla","south-la","dtla","downtown","downtownla","downtown-la","hollywood","beverlyhills","beverly-hills","santamonica","santa-monica","culvercity","culver-city","marinadelrey","marina-del-rey","longbeach","long-beach","torrance","carson","compton","inglewood","pasadena","glendale","burbank","noho","northhollywood","north-hollywood","encino","tarzana","woodland","woodlandhills","woodland-hills","calabasas","malibu","topanga","agoura","agourahills","agoura-hills","thousandoaks","thousand-oaks","simivalley","simi-valley","simi","venturacounty","ventura-county","oxnard","camarillo","moorpark","santabarbara","santa-barbara","sb","goleta","carpinteria","orangecounty","orange-county","oc","irvine","anaheim","fullerton","costamesa","costa-mesa","newportbeach","newport-beach","huntingtonbeach","inlandempire","inland-empire","ie","riverside","sanbernardino","san-bernardino","ontario","rancho","ranchocucamonga","rancho-cucamonga","fontana","corona","palmsprings","palm-springs","palmdesert","palm-desert","coachella","temecula","murrieta","hemet","perris","menifee","sandiego","san-diego","sd","sdmesh","sd-mesh","norcal","nor-cal","northerncalifornia","northern-california","bayarea","bay-area","sfbay","sf-bay","sfbayarea","sf-bay-area","sanfrancisco","san-francisco","sf","sfmesh","sf-mesh","oakland","berkeley","eastbay","east-bay","alameda","sanjose","san-jose","sj","southbay","south-bay","siliconvalley","silicon-valley","santaclara","santa-clara","sunnyvale","mountainview","mountain-view","paloalto","palo-alto","menlopark","menlo-park","redwoodcity","redwood-city","fremont","hayward","unioncity","union-city","newark","milpitas","santacruz","santa-cruz","watsonville","monterey","montereybay","monterey-bay","salinas","carmel","pacificgrove","pacific-grove","sacramento","sac","sactown","westsac","west-sac","roseville","folsom","fresno","bakersfield","stockton","modesto","visalia","seattle","seattlemesh","seattle-mesh","pnw","pacificnorthwest","pacific-northwest","portland","pdx","portlandmesh","portland-mesh","oregon","denver","denvermesh","denver-mesh","colorado","boulder","fortcollins","austin","austinmesh","austin-mesh","atx","texas","sanantonio","san-antonio","dallas","dfw","dallasmesh","dallas-mesh","fortworth","fort-worth","houston","houstonmesh","houston-mesh","htx","phoenix","phoenixmesh","phoenix-mesh","arizona","az","tucson","mesa","tempe","lasvegas","las-vegas","vegas","vegasmesh","vegas-mesh","nevada","henderson","saltlake","salt-lake","slc","saltlakecity","salt-lake-city","utah","chicago","chicagomesh","chicago-mesh","chitown","illinois","detroit","detroitmesh","detroit-mesh","michigan","annarbor","ann-arbor","minneapolis","twincities","twin-cities","minnesota","stpaul","st-paul","atlanta","atlantamesh","atlanta-mesh","atl","georgia","miami","miamimesh","miami-mesh","florida","tampa","orlando","jacksonville","boston","bostonmesh","boston-mesh","massachusetts","cambridge","newyork","new-york","nyc","nycmesh","nyc-mesh","brooklyn","manhattan","queens","newjersey","new-jersey","nj","jersey","philly","philadelphia","philadelphiamesh","philadelphia-mesh","pennsylvania","dc","washingtondc","washington-dc","dmv","nova","maryland","virginia","raleigh","durham","rdu","triangle","northcarolina","north-carolina","charlotte","clt","southcarolina","south-carolina","nashville","tennessee","memphis","knoxville","neworleans","new-orleans","nola","louisiana","hawaii","oahu","honolulu","maui","bigisland","big-island","alaska","anchorage","fairbanks","canada","toronto","vancouver","montreal","calgary","edmonton","ottawa","uk","london","manchester","birmingham","edinburgh","glasgow","bristol","germany","berlin","munich","hamburg","frankfurt","cologne","france","paris","lyon","marseille","spain","madrid","barcelona","italy","rome","milan","netherlands","amsterdam","rotterdam","brabant","flevoland","gelderland","noordbrabant","noordholland","zuid-holland","zuidholland","zeeland","twente","alkmaar","almere","amstelland","capelleaandenijssel","denhaag","dordrecht","drechtsteden","eindhoven","haarlem","hellevoetsluis","hilversum","katwijk","lelystad","maassluis","middelburg","rijnmond","tilburg","utrecht","vlissingen","voorburg","voorne-putten","walcheren","west-friesland","zaandam","zaanstreek-waterland","024-bot","afrithonbot","ai","amradio","analyser","angrynerds","bemesh","buch","burgernet","chatgpt","dares","dekroeg","dtis","english","evenvroegopstaan","fosdem","gezellig","gmr","gmrbot","goedemorgen","gyverbot","haagscourant","hackerspacenijmegen","hamradionederland","hetweerinjegemeente","hsnl","jokes","kanalen","koffie","linux","nerd","nl-alert","nl-prio","noodkanaal","nsagov","pi4hm","pi4utr","pingbot","sensemakers","sports","survival","uitdagingen","valleibot","valleirug","vleesboek","wardrive","weer","australia","sydney","melbourne","brisbane","perth","adelaide","newzealand","new-zealand","auckland","wellington","japan","tokyo","osaka","kyoto","southkorea","south-korea","korea","seoul","taiwan","taipei","singapore","hongkong","hong-kong","india","mumbai","delhi","bangalore","brazil","saopaulo","sao-paulo","rio","mexico","mexicocity","mexico-city","guadalajara","tijuana","gps","location","tracking","tracker","position","coordinates","sensor","sensors","telemetry","data","iot","aprs","beacon","beacons","ping","pings","debug","admin","ops","operations","monitor","monitoring","security","secure","private","encrypted","hiking","camping","outdoors","outdoor","backcountry","trails","offroad","off-road","overlanding","jeep","offroading","sailing","boating","marine","maritime","aviation","flying","pilots","drone","drones","weather","wx","storm","storms","skywarn","traffic","commute","transit","community","group","team","club","family","friends","neighbors","neighborhood","block","street","local","town","city","county","region","north","south","east","west","central","downtown","uptown","midtown","home","house","cabin","ranch","farm","test1","test2","test3","test4","test5","channel1","channel2","channel3","mesh1","mesh2","mesh3","group1","group2","group3","team1","team2","team3","net1","net2","net3","relay","relays","link","links","hub","hubs","core","backbone","qso","ragchew","net","nets","roundtable","simplex","duplex","vhf","uhf","hf","2m","70cm","33cm","23cm","900mhz","915mhz","ism","ism-band","ism915","ism868","license-free","event","events","exercise","drill","training","practice","race","marathon","cycling","running","triathlon","ironman","festival","concert","gathering","meetup","meet-up","convention","hamfest","ham-fest","field-day","fieldday","winter-field-day","sota","pota","summits","parks","parks-on-the-air","2024","2025","2026","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec","winter","spring","summer","fall","autumn","mountain","mountains","hills","peak","summit","ridge","canyon","beach","coast","coastal","shore","bay","lake","river","creek","park","forest","woods","desert","island","peninsula","urban","suburban","rural","metro","area","zone","sector","base","mobile","portable","handheld","fixed","station","primary","secondary","backup","alternate","spare","alpha","bravo","charlie","delta","echo","foxtrot","red","blue","green","yellow","orange","purple","black","white","trace","traces","log","logs","metrics","stats","statistics","raw","stream","feed","live","realtime","real-time","sync","replication","mirror","copy","archive","open","closed","free","premium","pro","plus","lite","basic","new","old","legacy","current","next","future","one","two","three","four","five","six","seven","eight","nine","ten","hamradio","ham-radio","amateurradio","amateur-radio","arrl","dxcc","dxing","morsecode","morse-code","fldigi","js8call","winlink","vara","pactor","packet","ax25","aprsmesh","qrp","qro","qrz","qsl","qth","ragchew","rag-chew","elmer","elmers","technician","amateur","microwave","satellite","ariss","amsat","cubesat","sdr","rtlsdr","rtl-sdr","hackrf","portapack","yaesu","icom","kenwood","elecraft","flexradio","alinco","baofeng","quansheng","antennas","dipole","vertical","yagi","efhw","endfed","wwff","iota","contesting","cwops","auxcomm","satern","maker","makers","makerspace","maker-space","hackerspace","hacker-space","fablab","fab-lab","doityourself","homebrew","home-brew","fromscratch","arduino","esp32","esp8266","stm32","teensy","pico","rp2040","attiny","raspberrypi","raspberry-pi","rpi","beaglebone","beagle-bone","orangepi","orange-pi","kicad","eagle","altium","oshpark","jlcpcb","pcbway","soldering","throughhole","oscilloscope","multimeter","logicanalyzer","logic-analyzer","testbench","3dprinting","3d-printing","3dprint","printer","prusa","ender","creality","bambu","voron","lasercutter","laser-cutter","woodworking","metalworking","welding","resin","fdm","sla","fusion360","fusion-360","freecad","openscad","solidworks","programming","coding","software","developer","developers","devops","sysadmin","linux","unix","bsd","freebsd","openbsd","netbsd","macos","windows","android","ios","python","javascript","typescript","rust","golang","java","kotlin","swift","ruby","perl","csharp","dotnet","haskell","lisp","clojure","elixir","erlang","react","angular","svelte","nodejs","deno","nextjs","nuxt","docker","kubernetes","terraform","ansible","puppet","vagrant","github","gitlab","bitbucket","opensource","open-source","foss","floss","homelab","home-lab","selfhost","self-host","selfhosted","self-hosted","homelabbers","homeassistant","home-assistant","hass","openhab","domoticz","nodered","node-red","mqtt","zigbee","zwave","thread","wifi","bluetooth","rfid","infosec","cybersec","cybersecurity","cyber-security","netsec","opsec","hacking","hacker","hackers","pentest","pentesting","redteam","red-team","blueteam","blue-team","capture-the-flag","bugbounty","bug-bounty","vuln","exploit","malware","reverse","defcon","blackhat","bsides","shmoocon","derbycon","toorcon","hacktheplanet","lockpicking","locksport","toool","deviant","socialeng","social-eng","osint","privacy","anonymity","encryption","crypto","signal","hiking","hiker","hikers","backpacking","backpacker","thru-hike","thruhike","camper","campers","glamping","dispersed","primitive","wilderness","climbing","climber","climbers","rockclimbing","rock-climbing","bouldering","trad","sport","mountaineering","alpine","peaks","fourteeners","14ers","highpoints","skiing","skier","snowboard","snowboarder","backcountry-ski","touring","splitboard","kayak","kayaking","kayaker","canoe","canoeing","paddle","paddling","paddleboard","surfing","surfer","surfers","bodyboard","longboard","shortboard","waves","scuba","freedive","freediving","snorkel","underwater","spearfishing","fishing","angler","anglers","flyfishing","fly-fishing","trout","hunting","hunter","hunters","archery","bowhunting","bow-hunting","rifle","shotgun","cyclist","biking","bicycle","bicycling","roadbike","road-bike","mountainbike","mountain-bike","mountainbiking","mountain-biking","trailriding","ebike","e-bike","ebikes","electric-bike","peloton","strava","zwift","gravel","gravelbike","gravel-bike","bikepacking","bike-packing","randonneur","fixie","fixedgear","fixed-gear","singlespeed","single-speed","commuter","offroading","off-roading","fourwheeling","4wd","awd","jeeping","wrangler","gladiator","tacoma","runner","4runner","overland","overlander","rooftoptent","rooftop-tent","expedition","utv","sxs","sidebyside","side-by-side","rzr","canam","polaris","dirtbike","dirt-bike","motocross","enduro","dualsport","dual-sport","motorcycle","moto","harley","sportbike","cruiser","rving","motorhome","campervan","camper-van","vanlife","van-life","skoolie","trucker","trucking","diesel","semi","bigrig","big-rig","pilot","pilots","flying","flight","airplane","aircraft","planes","cessna","piper","cirrus","beechcraft","mooney","bonanza","skyhawk","helicopter","heli","rotor","rotorcraft","chopper","robinson","glider","gliding","soaring","sailplane","paraglider","paragliding","hangglider","drones","uav","uas","fpv","quadcopter","multirotor","mavic","phantom","rocketry","rockets","hpr","nar","tripoli","model-rocket","amateur-rocket","spacex","nasa","esa","starlink","starship","falcon","artemis","boat","boats","boater","boaters","yachting","yacht","sail","sailor","powerboat","speedboat","fishing-boat","pontoon","jetski","jet-ski","pwc","waverunner","marina","harbor","harbour","dock","pier","anchorage","mooring","liveaboard","cruising","bluewater","blue-water","inshore","intracoastal","marine-radio","marineradio","ais","chartplotter","navionics","opencpn","prepper","preppers","prepping","survival","survivalist","shtf","teotwawki","bol","bugout","bug-out","bugin","bug-in","edc","everyday-carry","loadout","firstaid","first-aid","trauma","tccc","stopthebleed","aed","waterpurification","water-purification","berkey","sawyer","lifestraw","foodstorage","food-storage","canning","dehydrating","freezedried","freeze-dried","battery","generator","inverter","offgrid","off-grid","griddown","grid-down","communications","gmrs","frs","murs","citizens-band","shortwave","homestead","homesteading","homesteader","farming","farmer","farmers","ranching","garden","gardening","gardener","permaculture","organic","regenerative","sustainable","chickens","poultry","goats","sheep","cattle","pigs","livestock","beekeeping","bees","apiary","greenhouse","hydroponics","aquaponics","vertical-farm","indoor-garden","growroom","grow-room","meteorology","stormchasing","storm-chasing","tornado","hurricane","earthquake","quake","seismic","tsunami","volcano","volcanic","geology","geologist","astronomy","stargazing","telescope","astrophotography","astrophoto","deepsky","deep-sky","citizen-science","citizenscience","research","science","stem","education","learning","gaming","gamer","gamers","videogames","video-games","pcgaming","pc-gaming","console","esports","e-sports","competitive","tournament","lan-party","retrogaming","minecraft","terraria","valheim","rust-game","dayz","tarkov","pubg","fortnite","apex","virtualreality","virtual-reality","augmentedreality","augmented-reality","oculus","tabletop","boardgames","board-games","dungeons-dragons","ttrpg","pathfinder","musician","musicians","bands","livemusic","live-music","concerts","guitar","guitarist","bassist","drums","drummer","keyboard","synth","synthesizer","production","producer","producers","beatmaking","beat-making","ableton","flstudio","audiophile","hifi","hi-fi","vinyl","records","turntable","headphones","speakers","podcast","podcasting","podcaster","streaming","streamer","twitch","youtube","content","photography","photographer","photographers","photog","cameras","dslr","mirrorless","canon","nikon","fuji","fujifilm","panasonic","olympus","leica","hasselblad","portrait","wildlife","macro","nightsky","night-sky","timelapse","videography","videographer","filmmaker","filmmaking","cinematography","editing","premiere","davinci","finalcut","final-cut","aftereffects","after-effects","vfx","artist","artists","artwork","creative","creatives","designer","designers","illustration","illustrator","drawing","sketch","sketching","digital-art","digitalart","graphicdesign","graphic-design","uiux","ui-ux","webdesign","web-design","animation","animator","motion","motiongraphics","motion-graphics","3dart","3d-art","blender","foodie","foodies","cooking","cooks","chef","chefs","culinary","kitchen","barbecue","grilling","smoking","smoker","brisket","ribs","pulled-pork","lownslow","baking","baker","sourdough","pastry","dessert","cakes","cookies","brewing","craft-beer","craftbeer","ipa","lager","stout","espresso","barista","roasting","whiskey","bourbon","cocktails","fitness","workout","lifting","weightlifting","powerlifting","bodybuilding","crossfit","hiit","cardio","runners","ultramarathon","triathlete","swimming","swimmer","openwater","open-water","yoga","pilates","meditation","mindfulness","wellness","nutrition","basketball","football","soccer","baseball","hockey","tennis","volleyball","dogs","puppy","puppies","canine","dogtraining","dog-training","cats","kitten","kittens","feline","meow","pets","animals","birding","birdwatching","bird-watching","aquarium","reeftank","reef-tank","saltwater","freshwater","planted-tank","reptiles","reptile","snakes","lizard","gecko","bearded-dragon","neighborhood","nextdoor","meet-up","volunteer","volunteering","nonprofit","non-profit","charity","mutual-aid","mutualaid","parents","parenting","families","children","youth","teens","seniors","lgbtq","pride","queer","nonbinary","ally","allies","inclusive","diversity","burningman","burning-man","playa","blackrock","coachella","sxsw","defcon","hope","layerone","layer-one","supercon","makerfaire","maker-faire","bamboozle","lightning","ragbrai","burnitdown","burning","regional","decomp","toorcamp","chaos","congress","hackathon","ctf-event","capture","wardriving","foxhunt","fox-hunt","brc","ttitd","center-camp","centercamp","esplanade","deep-playa","effigy","temple","soundcamp","sound-camp","mutant-vehicle","art-car","ranger","rangers","lamplighters","dgs","leave-no-trace","moop","gifting","radical-self","immediacy","participation","decommodification","overlandexpo","overland-expo","overlandtrail","overland-trail","overlandbound","overlandjournal","adventurebike","adventure-bike","dirtevery","rubicontrail","rubicon-trail","moab","deathvalley","death-valley","joshua-tree","joshuatree","bigbear","big-bear","mammoth","tahoe","yosemite","sequoia","kingscyn","kings-canyon","meshcore","mesh-core","meshcore-test","meshcore-dev","meshcore-beta","mctest","mc-test","mcdev","mc-dev","mcmain","mc-main","mcpublic","meshcorebot","meshcore-bot","mcbot","mc-bot","meshchat","mesh-chat","meshnet","mesh-net","meshnetwork","mesh-network","meshlink","mesh-link","meshhub","mesh-hub","meshnode","mesh-node","meshrelay","mesh-relay","meshgateway","mesh-gateway","meshbridge","mesh-bridge","meshrouter","meshtalk","mesh-talk","meshvoice","mesh-voice","meshdata","mesh-data","meshsensor","mesh-sensor","meshtrack","mesh-track","meshgps","mesh-gps","meshmap","mesh-map","meshstatus","mesh-status","meshping","mesh-ping","meshtest","mesh-test","meshtesting","mesh-testing","meshdev","mesh-dev","meshops","mesh-ops","meshadmin","mesh-admin","meshmon","mesh-mon","meshlog","mesh-log","meshdebug","mesh-debug","meshdiag","mesh-diag","meshcore-alpha","meshcore-stable","meshcore-main","meshcore-local","mc-alpha","mc-beta","mc-stable","mc-local","mc-ops","mc-admin","meshcoretest","meshcoredev","meshcorebeta","meshcorealpha","meshcoremain","meshcorelocal","meshcoreops","meshcoreadmin","meshcoremon","meshcorelog","meshcorechat","meshcorenet","meshcorelink","meshcorehub","meshcorenode","meshcorerelay","meshcoregateway","meshcorebridge","meshcorerouter","meshcoresensor","meshcoretrack","meshcoregps","meshcoremap","meshcoreping","mcnetwork","mc-network","mcchat","mc-chat","mclink","mc-link","mchub","mc-hub","mcnode","mc-node","mcrelay","mc-relay","mcgateway","mc-gateway","mcbridge","mc-bridge","mcrouter","mc-router","mcsensor","mc-sensor","mctrack","mc-track","mcgps","mc-gps","mcmap","mc-map","mcstatus","mc-status","mcping","mc-ping","mcmon","mc-mon","mclog","mc-log","mcdebug","mc-debug","mcdiag","mc-diag","meshroom","mesh-room","meshrooms","mesh-rooms","meshserver","mesh-server","meshclient","mesh-client","meshcompanion","mesh-companion","meshrepeater","mesh-repeater","meshbase","mesh-base","meshportal","mesh-portal","meshtastic","mesh-tastic","meshtastictest","meshtastic-test","meshtasticdev","meshtastic-dev","meshtasticlocal","meshtastic-local","mttest","mt-test","mtdev","mt-dev","mtlocal","mt-local","longfast","long-fast","longmod","long-mod","longslow","long-slow","shortfast","short-fast","shortslow","short-slow","medfast","med-fast","medslow","med-slow","verylongslow","very-long-slow","meshtastic-alpha","meshtastic-beta","meshtastic-main","meshtastic-stable","meshtasticbeta","meshtasticalpha","meshtasticmain","meshtasticstable","mtbeta","mt-beta","mtalpha","mt-alpha","mtmain","mt-main","mtstable","mt-stable","mtops","mt-ops","mtadmin","mt-admin","mtchat","mt-chat","mtnet","mt-net","mtlink","mt-link","mthub","mt-hub","mtnode","mt-node","mtrelay","mt-relay","longrange","long-range","shortrange","short-range","medrange","med-range","ultralong","ultra-long","ultrafast","ultra-fast","ultraslow","ultra-slow","mediumfast","medium-fast","mediumslow","medium-slow","mediummod","medium-mod","turbofast","turbo-fast","turboslow","turbo-slow","lora","lo-ra","lorawan","lora-wan","loratest","lora-test","loradev","lora-dev","loranet","lora-net","loramesh","lora-mesh","loralink","lora-link","lorahub","lora-hub","loranode","lora-node","lora915","lora-915","lora868","lora-868","lora433","lora-433","sx1262","sx1276","sx1278","semtech","chirp","chirpstack","lorabeta","lora-beta","loraalpha","lora-alpha","loramain","lora-main","lorastable","lora-stable","loraops","lora-ops","loraadmin","lora-admin","lorachat","lora-chat","lorarelay","lora-relay","loragateway","lora-gateway","lorabridge","lora-bridge","lorarouter","lora-router","loraserver","lora-server","lorasensor","lora-sensor","loratrack","lora-track","loragps","lora-gps","loramap","lora-map","lorastatus","lora-status","loraping","lora-ping","loramon","lora-mon","loralog","lora-log","loradebug","lora-debug","lora923","lora-923","lora865","lora-865","lora470","lora-470","sx1261","sx1280","sx1268","sx126x","sx127x","sx128x","llcc68","lr1110","lr1120","lr1121","stm32wl","ra01","ra02","heltec","heltec-lora","ttgo","ttgo-lora","lilygo","lilygo-lora","rak","rak-lora","rak4631","rak3172","rak811","wisblock","test","testing","test1","test2","test3","test123","testchannel","test-channel","testnet","test-net","testmesh","test-mesh","dev","devel","develop","development","devtest","dev-test","sandbox","playground","scratch","temp","temporary","tmp","debug","debugging","diag","diagnostic","diagnostics","alpha","beta","gamma","canary","nightly","unstable","stable","experiment","experimental","trial","pilot","prototype","poc","test4","test5","test6","test7","test8","test9","test10","test01","test02","test03","test-1","test-2","test-3","testA","testB","testC","test-a","test-b","test-c","testing1","testing2","testing3","testing-1","testing-2","testing-3","devnet","dev-net","devmesh","dev-mesh","devchannel","dev-channel","stagenet","stage-net","staging","stage","stagetest","stage-test","qanet","qa-net","qa","qatest","qa-test","qachannel","qa-channel","labnet","lab-net","lab","labtest","lab-test","testlab","test-lab","benchnet","bench-net","benchmark","bench","perftest","perf-test","loadtest","load-test","stresstest","stress-test","smoketest","smoke-test","unittest","unit-test","integtest","integ-test","e2etest","e2e-test","mocknet","mock-net","mock","faker","dummy","sample","example","demonet","demo-net","demo","showcase","preview","prerelease","pre-release","release","rc","release-candidate","releasecandidate","final","production","emergency","emergencies","emer","emerg","911","999","112","sos","mayday","help","rescue","distress","urgent","priority","alert","alerts","warning","warnings","alarm","alarms","safety","safe","danger","hazard","caution","critical","evacuation","evac","evacuate","shelter","shelterinplace","shelter-in-place","lockdown","allclear","all-clear","fire","fires","wildfire","wildfires","brushfire","forestfire","flood","floods","flooding","flashflood","flash-flood","quake","earthquake","aftershock","tsunami","tremor","tornado","hurricane","cyclone","typhoon","storm","severe","missing","missingperson","missing-person","amber","silveralert","medical","medic","ems","ambulance","paramedic","firstaid","first-aid","police","sheriff","lawenforcement","law-enforcement","cert","cert-team","certteam","voad","redcross","red-cross","emergencynet","emergency-net","emergencychannel","emergency-channel","emeralert","emer-alert","sosnet","sos-net","soschannel","sos-channel","maydaynet","mayday-net","maydaychannel","mayday-channel","helpnet","help-net","helpchannel","help-channel","helpline","help-line","rescuenet","rescue-net","rescuechannel","rescue-channel","rescueteam","rescue-team","disaster","disasters","disasternet","disaster-net","disasterrelief","disaster-relief","crisis","crisisnet","crisis-net","crisischannel","crisis-channel","incident","incidentnet","incident-net","incidentchannel","incident-channel","alertnet","alert-net","alertchannel","alert-channel","alertsystem","alert-system","warningnet","warning-net","warningchannel","warning-channel","safetynet","safety-net","safetychannel","safety-channel","safetycheck","safety-check","hazardnet","hazard-net","hazardchannel","hazard-channel","hazmat","haz-mat","firenet","fire-net","firechannel","fire-channel","firefighter","fire-fighter","firedept","fire-dept","firehouse","fire-house","firestation","fire-station","wildfirenet","wildfire-net","wildfirechannel","wildfire-channel","campfire","camp-fire","structurefire","structure-fire","grassfire","grass-fire","floodnet","flood-net","floodchannel","flood-channel","floodwatch","flood-watch","floodwarning","flood-warning","highwater","high-water","risingwater","rising-water","earthquakenet","earthquake-net","earthquakechannel","earthquake-channel","tornadonet","tornado-net","tornadochannel","tornado-channel","hurricanenet","hurricane-net","hurricanechannel","hurricane-channel","stormnet","storm-net","stormchannel","storm-channel","severeweather","severe-weather","medicalnet","medical-net","medicalchannel","medical-channel","traumanet","trauma-net","traumachannel","trauma-channel","traumacenter","trauma-center","hospital","hospitals","clinic","clinics","urgent-care","urgentcare","poisoncontrol","poison-control","cpr-net","cprnet","lifesaver","life-saver","searchandrescue","search-and-rescue","sar","sarnet","sar-net","sarteam","sar-team","coastguard","coast-guard","uscg","lifeguard","life-guard","beachpatrol","beach-patrol","mountainrescue","mountain-rescue","caverescue","cave-rescue","swiftwater","swift-water","k9unit","k9-unit","searchdog","search-dog","rescuedog","rescue-dog","civildefense","civil-defense","fema","dhs","oem","eoc","eocnet","eoc-net","weather","wx","wxalert","wx-alert","wxwatch","wx-watch","wxwarning","wx-warning","wxreport","wx-report","wxupdate","wx-update","forecast","conditions","climate","temperature","temp","temps","rain","rainfall","precipitation","precip","snow","snowfall","wind","winds","windy","gust","gusts","breeze","humidity","humid","dewpoint","dew-point","barometer","pressure","sunny","cloudy","overcast","fog","foggy","mist","haze","smog","heat","heatwave","heat-wave","cold","coldsnap","cold-snap","freeze","lightning","thunder","thunderstorm","tstorm","t-storm","hail","sleet","ice","icy","blackice","black-ice","frost","noaa","nws","skywarn","spotter","spotters","stormspotter","weathernet","weather-net","weatherchannel","weather-channel","wxnet","wx-net","wxchannel","wx-channel","wxstation","wx-station","forecastnet","forecast-net","forecastchannel","forecast-channel","localwx","local-wx","localweather","local-weather","dailywx","daily-wx","hourlywx","hourly-wx","weeklyforecast","weekly-forecast","rainnet","rain-net","rainchannel","rain-channel","rainalert","rain-alert","rainwatch","rain-watch","rainwarning","rain-warning","heavyrain","heavy-rain","snownet","snow-net","snowchannel","snow-channel","snowalert","snow-alert","snowwatch","snow-watch","snowwarning","snow-warning","heavysnow","heavy-snow","blizzard","blizzardwatch","blizzard-watch","blizzardwarning","blizzard-warning","windnet","wind-net","windchannel","wind-channel","windalert","wind-alert","windwatch","wind-watch","windwarning","wind-warning","highwind","high-wind","tempnet","temp-net","tempchannel","temp-channel","tempalert","temp-alert","heatnet","heat-net","heatchannel","heat-channel","heatalert","heat-alert","heatwatch","heat-watch","heatwarning","heat-warning","extremeheat","extreme-heat","coldnet","cold-net","coldchannel","cold-channel","coldalert","cold-alert","coldwatch","cold-watch","coldwarning","cold-warning","extremecold","extreme-cold","winterstorm","winter-storm","icestorm","ice-storm","freezingrain","freezing-rain","thunderstormnet","thunderstorm-net","thunderstormwatch","thunderstorm-watch","thunderstormwarning","thunderstorm-warning","severethunderstorm","severe-thunderstorm","lightningnet","lightning-net","lightningchannel","lightning-channel","lightningalert","lightning-alert","lightningwatch","lightning-watch","tornadowatch","tornado-watch","tornadowarning","tornado-warning","hurricanewatch","hurricane-watch","hurricanewarning","hurricane-warning","tropicalstorm","tropical-storm","tropicaldepression","tropical-depression","stormwatch","storm-watch","stormwarning","storm-warning","stormalert","storm-alert","skywarnnet","skywarn-net","skywarnchannel","skywarn-channel","spotternetwork","spotter-network","stormchase","storm-chase","stormchaser","storm-chaser","amateurwx","amateur-wx","citizenwx","citizen-wx","pwswx","pws-wx","weatherstation","weather-station","wxstation","wx-station","metar","taf","status","stat","stats","statistics","metrics","health","healthcheck","monitor","monitoring","mon","watch","watcher","watchdog","uptime","downtime","outage","outages","incident","incidents","report","reports","reporting","update","updates","bulletin","announce","announcement","announcements","broadcast","broadcasts","notify","notification","notifications","ping","pong","heartbeat","check","checkin","check-in","checkout","check-out","rollcall","roll-call","statusnet","status-net","statuschannel","status-channel","statusupdate","status-update","statusreport","status-report","statuscheck","status-check","statusboard","status-board","monitornet","monitor-net","monitorchannel","monitor-channel","monitoringnet","monitoring-net","monitoringchannel","monitoring-channel","watchnet","watch-net","watchchannel","watch-channel","watchlist","watch-list","healthnet","health-net","healthchannel","health-channel","healthstatus","health-status","uptimenet","uptime-net","uptimechannel","uptime-channel","uptimemonitor","uptime-monitor","outagenet","outage-net","outagechannel","outage-channel","outagereport","outage-report","incidentnet","incident-net","incidentchannel","incident-channel","incidentreport","incident-report","incidentresponse","incident-response","alertsnet","alerts-net","alertschannel","alerts-channel","updatenet","update-net","updatechannel","update-channel","updatefeed","update-feed","bulletinnet","bulletin-net","bulletinchannel","bulletin-channel","bulletinboard","bulletin-board","noticeboard","notice-board","announcenet","announce-net","announcechannel","announce-channel","broadcastnet","broadcast-net","broadcastchannel","broadcast-channel","notifynet","notify-net","notifychannel","notify-channel","pingnet","ping-net","pingchannel","ping-channel","pingtest","ping-test","heartbeatnet","heartbeat-net","heartbeatchannel","heartbeat-channel","rollcallnet","rollcall-net","rollcallchannel","rollcall-channel","checkinnet","checkin-net","checkinchannel","checkin-channel","headcount","head-count","accountability","welfare","wellbeing","well-being","ops","operations","opsnet","ops-net","opschannel","ops-channel","admin","admins","administrator","root","superuser","sudo","control","command","cmd","hq","headquarters","base","basecamp","dispatch","dispatcher","coord","coordinate","coordination","tactical","tac","tacnet","tac-net","tacchannel","tac-channel","logistics","logi","supply","supplies","resource","resources","comms","comm","communications","radio","radionet","radio-net","opsteam","ops-team","opsgroup","ops-group","opscenter","ops-center","opsroom","ops-room","opsdesk","ops-desk","opslead","ops-lead","adminnet","admin-net","adminchannel","admin-channel","adminteam","admin-team","adminops","admin-ops","admingroup","admin-group","admindesk","admin-desk","controlnet","control-net","controlchannel","control-channel","controlroom","control-room","controlcenter","control-center","commandnet","command-net","commandchannel","command-channel","commandpost","command-post","commandcenter","command-center","hqnet","hq-net","hqchannel","hq-channel","hqops","hq-ops","dispatchnet","dispatch-net","dispatchchannel","dispatch-channel","dispatchcenter","dispatch-center","dispatchdesk","dispatch-desk","coordnet","coord-net","coordchannel","coord-channel","coordteam","coord-team","coordcenter","coord-center","coordinationcenter","coordination-center","tacops","tac-ops","tacteam","tac-team","tacgroup","tac-group","taccom","tac-com","taccomms","tac-comms","tacradio","tac-radio","logisticsnet","logistics-net","logisticschannel","logistics-channel","logisticsteam","logistics-team","logisticsops","logistics-ops","supplynet","supply-net","supplychannel","supply-channel","supplychain","supply-chain","resourcenet","resource-net","resourcechannel","resource-channel","commsnet","comms-net","commschannel","comms-channel","commsteam","comms-team","commsops","comms-ops","commscheck","comms-check","commstest","comms-test","radioops","radio-ops","radioteam","radio-team","radiocheck","radio-check","netcontrol","net-control","netops","net-ops","noc","nocnet","noc-net","info","information","infochannel","info-channel","fyi","news","newsfeed","news-feed","headlines","breaking","latest","traffic","trafficreport","traffic-report","roadconditions","road-conditions","transit","bus","train","subway","metro","commute","commuter","events","calendar","schedule","agenda","upcoming","whats-on","infonet","info-net","infohub","info-hub","infodesk","info-desk","infoboard","info-board","infopoint","info-point","infoline","info-line","newsnet","news-net","newschannel","news-channel","newshub","news-hub","newsdesk","news-desk","newsroom","news-room","newsflash","news-flash","breakingnews","breaking-news","latestnews","latest-news","topnews","top-news","localnews","local-news","regionalnews","regional-news","worldnews","world-news","trafficnet","traffic-net","trafficchannel","traffic-channel","trafficupdate","traffic-update","trafficalert","traffic-alert","roadnet","road-net","roadchannel","road-channel","roadupdate","road-update","transitnet","transit-net","transitchannel","transit-channel","transitupdate","transit-update","transitalert","transit-alert","busnet","bus-net","buschannel","bus-channel","busupdate","bus-update","trainnet","train-net","trainchannel","train-channel","trainupdate","train-update","subwaynet","subway-net","subwaychannel","subway-channel","metronet","metro-net","metrochannel","metro-channel","metroupdate","metro-update","commuternet","commuter-net","commuterchannel","commuter-channel","eventsnet","events-net","eventschannel","events-channel","eventshub","events-hub","eventcalendar","event-calendar","localevents","local-events","calendarnet","calendar-net","calendarchannel","calendar-channel","schedulenet","schedule-net","schedulechannel","schedule-channel","agendanet","agenda-net","agendachannel","agenda-channel","upcomingnet","upcoming-net","upcomingchannel","upcoming-channel","location","locations","gps","position","positions","coordinates","track","tracker","tracking","trace","tracer","tracing","beacon","beacons","waypoint","waypoints","checkpoint","checkpoints","geofence","geolocation","geo","mapping","maps","navigate","navigation","locationnet","location-net","locationchannel","location-channel","locationtrack","location-track","locationshare","location-share","gpsnet","gps-net","gpschannel","gps-channel","gpstrack","gps-track","gpsshare","gps-share","gpslog","gps-log","gpsdata","gps-data","positionnet","position-net","positionchannel","position-channel","positiontrack","position-track","positionshare","position-share","coordnet","coord-net","coordchannel","coord-channel","coordshare","coord-share","tracknet","track-net","trackchannel","track-channel","trackshare","track-share","trackingnet","tracking-net","trackingchannel","tracking-channel","tracernet","tracer-net","tracerchannel","tracer-channel","beaconnet","beacon-net","beaconchannel","beacon-channel","beacontrack","beacon-track","beaconshare","beacon-share","waypointnet","waypoint-net","waypointchannel","waypoint-channel","waypointshare","waypoint-share","waypointlog","waypoint-log","checkpointnet","checkpoint-net","checkpointchannel","checkpoint-channel","geofencenet","geofence-net","geofencechannel","geofence-channel","geofencealert","geofence-alert","geozonenet","geozone-net","geonet","geo-net","geochannel","geo-channel","geotrack","geo-track","mappingnet","mapping-net","mappingchannel","mapping-channel","mapnet","map-net","mapchannel","map-channel","mapshare","map-share","navnet","nav-net","navchannel","nav-channel","navtrack","nav-track","navigationnet","navigation-net","navigationchannel","navigation-channel","fleettrack","fleet-track","fleetnet","fleet-net","assettrack","asset-track","whereis","where-is","findme","find-me","locateme","locate-me","nocap","no-cap","frfr","fr-fr","bussin","sheesh","slay","slaps","goated","goat","goats","based","cringe","mid","lowkey","highkey","vibe","vibes","vibing","vibecheck","vibe-check","goodvibes","good-vibes","sus","sussy","sussy-baka","imposter","amongus","among-us","bet","bets","yeet","yeeted","yoink","skibidi","rizz","ohio","bruh","bruv","fam","bestie","besties","squad","squadgoals","squad-goals","slayyy","periodt","purr","queen","king","icon","iconic","legend","main-character","maincharacter","npc","npcs","side-quest","sidequest","understood-the-assignment","ate","served","mother","mothering","rent-free","rentfree","living-rent-free","touch-grass","touchgrass","copium","hopium","doom","doomer","bloomer","zoomer","zoomers","ratio","ratiod","caught-in-4k","receipts","tea","spillthetea","spill-the-tea","simp","simping","stan","stanning","oomf","moots","mutuals","tiktok","fyp","foryou","for-you","foryoupage","trending","viral","cheugy","basic","pick-me","pickme","girlboss","girl-boss","iykyk","iyky","ifykyk","valid","hits-different","hitsdifferent","unhinged","chaotic","feral","unalive","delulu","delusion","bereal","be-real","dump","photodump","photo-dump","core","coded","aesthetic","cottagecore","darkacademia","dark-academia","goblinmode","goblin-mode","softlaunch","soft-launch","hardlaunch","hard-launch","ngl","tbh","ong","on-god","ongod","deadass","dead-ass","fr","real","cap","capping","no-cap-fr","nocapfr","respectfully","allegedly","understood","assignment","ate-that","atethat","devoured","cleared","snatched","slayed","bodied","ended","finished","done","over","deceased","screaming","crying","sobbing","im-weak","imweak","sending-me","sendingme","its-giving","itsgiving","giving","serve","serving","ate-left-no-crumbs","main","protagonist","background-character","backgroundcharacter","side-character","sidecharacter","villain-era","villainera","redemption-arc","character-development","characterdevelopment","plot-twist","plottwist","lore","lore-drop","loredrop","deep-lore","deeplore","canon","fanon","ick","icks","red-flag","redflag","green-flag","greenflag","beige-flag","situationship","talking-stage","talkingstage","roster","rotation","era","eras","villain-arc","healing-era","flop-era","flopping","ate-and-left","understood-assignment","no-thoughts","nothoughts","brain-rot","brainrot","rotted","chronically-online","chronicallyonline","parasocial","hyperfixation","hyperfixating","special-interest","infodump","info-dump","infodumping","yapping","yap","yapper","glazing","glaze","glazer","meat-riding","meatriding","dickriding","aura","aura-points","aurapoints","negative-aura","positiveaura","sigma","sigma-grindset","sigmagrindset","alpha","beta","omega","mewing","mew","looksmax","looksmaxxing","mogging","mog","mogger","gyat","gyatt","bussin-bussin","respectfully-disrespectfully","real-ones","realones","day-ones","dayones","ride-or-die","rideordie","caught-lacking","caughtlacking","down-bad","downbad","down-tremendous","downhorrendous","down-horrendous","astronomically-down","abysmal","its-joever","joever","its-so-over","we-are-so-back","weareback","lock-in","lockin","locked-in","lockedin","locked-tf-in","cooked","cooking","cookin","chef","michelin","gourmet","fr-ong","frong","no-diddy","nodiddy","pause","unpause","resume","edging","edged","gooning","gooned","fanum-tax","fanumtax","hawk-tuah","hawktuah","kai-cenat","speed","ishowspeed","prime","adulting","adult","grown","grownup","grown-up","oldmillennial","avocadotoast","avocado-toast","brunch","brunching","mimosas","doggo","doggie","pupper","puppers","floof","chonk","chonky","birb","smol","smoll","smolbean","smol-bean","boop","snoot","blep","mlem","feels","allthefeels","all-the-feels","rightinthefeels","right-in-the-feels","mood","bigmood","big-mood","sadboi","sad-boi","sadgirl","sad-girl","aesthetic","vsco","vsco-girl","vscogirl","sksksk","andioop","and-i-oop","netflix","netflixandchill","netflix-and-chill","binge","bingewatch","throwback","tbt","throwbackthursday","throwback-thursday","flashback","nostalgia","nostalgic","90skid","90s-kid","80skid","80s-kid","pokemon","pikachu","nintendo","zelda","mario","sonic","sega","harrypotter","harry-potter","hogwarts","hufflepuff","gryffindor","slytherin","ravenclaw","muggle","potterhead","potter-head","starwars","star-wars","jedi","sith","mandalorian","mando","yoda","marvel","mcu","avengers","thanos","ironman","iron-man","spiderman","lotr","lordoftherings","lord-of-the-rings","hobbit","gandalf","frodo","gameofthrones","game-of-thrones","got","thrones","winteriscoming","nailed-it","nailedit","winning","fail","fails","epic","epicfail","fml","yolo","swag","swagger","legit","literally","literally-cant","cant-even","canteven","dying","dead","imdead","im-dead","deceased","goals","lifegoals","life-goals","relationshipgoals","relationship-goals","bae","babe","babes","hubby","wifey","fiance","soulmate","soul-mate","foodporn","food-porn","foodie","nomnom","nom-nom","yummy","delish","wanderlust","travelbug","travel-bug","jetset","jet-set","jetsetter","selfie","selfies","selfietime","selfie-time","groupie","photobomb","blessed","grateful","thankful","humbled","mindblown","mind-blown","extra","salty","shook","triggered","woke","cancelled","cancel","ghosting","ghosted","ghost","friendzone","friend-zone","friendzoned","shade","throwing-shade","tea","spill","spilltea","spill-tea","savage","clap-back","clapback","drag","dragged","read","receipts","tfw","mfw","mrw","dae","eli5","tldr","tl-dr","ama","iama","reddit","redditor","upvote","downvote","karma","cakeday","cake-day","meme","memes","dank","dankmemes","dank-memes","memelord","meme-lord","oldmillenial","xennial","geriatricmillennial","geriatric-millennial","youngmillennial","young-millennial","eldermillennial","elder-millennial","millennialproblems","millennial-problems","millenniallife","millennial-life","firstworldproblems","first-world-problems","struggle","struggles","thestruggle","broke","brokemillennial","broke-millennial","studentloans","student-loans","sidehustle","side-hustle","hustleculture","hustle-culture","grind","grinding","worklifebalance","work-life-balance","burnout","burn-out","selfcare","self-care","treatyoself","treat-yo-self","treatyourself","indulgence","splurge","athleisure","leggings","yoga","yogapants","yoga-pants","pilates","kale","quinoa","acai","matcha","oatmilk","oat-milk","plantbased","plant-based","glutenfree","gluten-free","organic","nongmo","non-gmo","farmtotable","farm-to-table","craftbeer","craft-beer","craftcocktails","craft-cocktails","speakeasy","rooftopbar","rooftop-bar","happyhour","happy-hour","winenight","wine-night","tacotuesday","taco-tuesday","pizzanight","pizza-night","takeout","take-out","doordash","ubereats","uber-eats","grubhub","postmates","instacart","plantmom","plant-mom","plantdad","plant-dad","plantparent","plant-parent","crazycatlady","crazy-cat-lady","dogmom","dog-mom","dogdad","dog-dad","furbaby","fur-baby","furbabies","rescuedog","rescue-dog","adoptdontshop","engagement","engaged","shesaidyes","she-said-yes","weddingplanning","wedding-planning","bridesquad","bride-squad","groomsmen","bachelorette","bachelor","honeymoon","firsthome","first-home","homeowner","home-owner","housegoals","house-goals","diy","diyer","fixer-upper","fixerupper","hgtv","pinterestfail","pinterest-fail","netflix-queue","netflixqueue","bingeing","binge-watching","streamingwars","truecrimeobsessed","true-crime-obsessed","truecrime","true-crime","murderino","podcastaddict","podcast-addict","serialpodcast","serial-podcast","officelife","office-life","corporatelife","corporate-life","cubicle","openoffice","slack","slackchannel","slack-channel","zoomlife","zoom-life","zoommeetings","wfh","workfromhome","work-from-home","remotework","remote-work","hybridwork","quietquitting","quiet-quitting","thegreatresignation","thegreatreshuffling","sundayscaries","sunday-scaries","mondaymotivation","monday-motivation","humpday","hump-day","tgif","fridayfeeling","friday-feeling","fridayvibes","itstheweekend","weekendvibes","weekend-vibes","weekendmode","weekend-mode","lol","lmao","lmfao","rofl","roflmao","omg","wtf","ftw","smh","tbh","icymi","fomo","jomo","fwiw","imho","imo","brb","gtg","ttyl","nbd","idk","idgaf","stfu","nsfw","tmi","btw","afaik","iirc","ymmv","ianal","whatever","whatev","whatevs","meh","blah","ugh","duh","psych","noway","no-way","asif","as-if","getreal","get-real","talktotheh","talk-to-the-hand","nottt","not","sike","syke","psyche","gnarly","rad","radical","tubular","bodacious","righteous","excellent","bogus","heinous","grody","gag-me","gagme","barf","barfbag","gross","dude","dudes","dudette","bro","bros","broski","homie","homies","homes","peeps","posse","crew","gang","clique","tribe","chill","chillax","chillaxin","chilling","chillin","kickin","kickback","kick-back","hangout","hang-out","hangtime","hang-time","couch","couchpotato","couch-potato","vegging","veggingout","vegging-out","slacker","slackers","slack","slacking","procrastinate","procrastinating","grunge","grungy","alternative","alt","indie","underground","mtv","vh1","headbangers","headbanging","moshing","moshpit","mosh-pit","nirvana","cobain","soundgarden","pearljam","pearl-jam","aliceinchains","beavis","butthead","beavisandbutthead","daria","simpsons","bartman","waynesworld","waynes-world","partyon","party-on","schwing","excellent","billted","bill-ted","bogusjourney","bogus-journey","stationn","ferris","ferrisbueller","ferris-bueller","dayoff","day-off","buellerr","breakfast-club","breakfastclub","sixteen-candles","sixteencandles","pretty-in-pink","prettyinpink","mollyringwald","molly-ringwald","johnhughes","john-hughes","hughes","brat-pack","bratpack","pager","beeper","pagenme","page-me","callme","call-me","hitmeup","snailmail","snail-mail","aol","aim","icq","uh-oh","a-s-l","asl","netscape","geocities","angelfire","tripod","webcrawler","askjeeves","gen-x","genx","genxer","gen-xer","xer","xers","forgottengeneration","latchkeykid","latchkey-kid","latchkey","unsupervised","freerange","free-range","mtv-generation","mtvgeneration","mtvkids","mtv-kids","videokilled","video-killed","reagan-era","reaganera","coldwar","cold-war","coldwarkids","cold-war-kids","afterschoolspecial","after-school-special","justdontdoit","saynotodrugs","dareprogram","dare-program","scared-straight","scaredstraight","whatcha-talkin-bout","diffrentstrokes","factsoflife","facts-of-life","familyties","family-ties","growinpains","growin-pains","cosby","cheers","thirtysomething","thirty-something","madaboutyou","mad-about-you","seinfeld","seinfeldian","kramers","masterofyourdomain","yada-yada-yada","friends","centralpark","central-perk","rachel","ross","chandler","monica","melrose","melroseplace","melrose-place","90210","beverlyhills90210","myso-called-life","mysocalledlife","angela","jordan-catalano","jordancatalano","freaksandgeeks","freaks-and-geeks","lindsay","undeclared","realworld","real-world","truestory","true-story","roadrules","road-rules","unplugged","mtv-unplugged","mtvunplugged","acoustic","coffehouse","grunge-era","grungeera","seattlesound","seattle-sound","subpop","sub-pop","smellsliketeenspirit","smells-like-teen-spirit","nevermind","bleach","ten","superunknown","dirt","facelift","jaroffies","jar-of-flies","greenday","green-day","dookie","basketcase","basket-case","wheniseptember","blink182","blink-182","enema","whats-my-age-again","allthesmallthings","sublime","santeria","wrongway","wrong-way","40oz","forty-oz","rage","ratm","rageagainstthemachine","killinginthename","bulls-on-parade","tool","lateralus","aenima","undertow","opiate","spiralout","spiral-out","nineinchnails","nine-inch-nails","nin","closer","headlikeahole","smashingpumpkins","smashing-pumpkins","siamesedream","mellon-collie","radiohead","okcomputer","ok-computer","creep","karma-police","paranoidandroid","beck","loser","odelay","whereitsat","where-its-at","twoturnstables","pulpfiction","pulp-fiction","royalewithcheese","saywhatagain","ezekiel","clerks","viewaskew","view-askew","jayandsilentbob","snootchie","officespace","office-space","tpsreports","tps-reports","piecesofflair","thematrix","the-matrix","redpill","bluepill","neo","morpheus","followthewhiterabbit","fightclub","fight-club","firstrandbeof","projectmayhem","tylerdurden","xfiles","x-files","mulderandscully","thetruthisoutthere","iwanttobelieve","buffy","buffythevampireslayer","buffy-tvs","scoobygang","sunnydale","groovy","far-out","farout","outtasite","outta-sight","righteous","cool","coolio","coolcat","cool-cat","coolbeans","cool-beans","neato","solid","solidgold","solid-gold","golden","goldies","oldies","classics","keen","swell","peachy","peachykeen","peachy-keen","hunky-dory","hunkydory","hip","hipster","hipcat","hip-cat","hep","hepcat","hep-cat","jazzy","square","squares","squaresville","uptight","uncool","unhip","bread","dough","moolah","bucks","clams","greenbacks","benjamins","pad","crib","digs","joint","spot","place","casa","hacienda","wheels","ride","whip","jalopy","hooptie","beater","clunker","oldtimer","old-timer","oldschool","old-school","vintage","retro","classic","backyard","frontporch","front-porch","patio","deck","garage","workshop","hamshack","ham-shack","radioshack","radio-shack","basement","attic","lodge","elks","moose","eagles","vfw","legion","american-legion","rotary","kiwanis","lions","shriners","masons","masonic","fraternal","church","chapel","parish","congregation","fellowship","ministry","sunday","sabbath","potluck","pot-luck","social","supper","supperclub","bridge","bridgeclub","bridge-club","cards","cardgame","card-game","bingo","bunco","poker","pokernight","poker-night","gamenight","game-night","bowling","bowlingalley","bowling-alley","bowlingleague","bowling-league","golf","golfclub","golf-club","teeoff","tee-off","links","fairway","fishing","fishinghole","fishing-hole","fishingbuddy","fishing-buddy","hunting","huntingcamp","hunting-camp","deercamp","deer-camp","cabin","rv","rvclub","rv-club","camper","campground","koa","goodsam","good-sam","snowbird","snowbirds","sunbird","sunbirds","winter-texan","wintertexan","retired","retirement","goldenage","golden-age","goldenyears","golden-years","aarp","seniors","seniormoments","senior-moments","grandkids","grandchildren","boomer","boomers","babyboomer","baby-boomer","babyboomers","baby-boomers","woodstock","woodstocknation","woodstock-nation","hippie","hippies","hippy","peacelove","peace-love","peacesign","peace-sign","makelovenotowar","flowerpower","flower-power","flowerchild","flower-child","summerofove","counterculture","counter-culture","freebird","free-bird","freespirit","tune-in-turn-on","dropmeout","trippingout","tripping-out","psychedelic","grateful-dead","gratefuldead","deadhead","dead-head","deadheads","beatles","beatlemania","fab-four","fabfour","johnpaugeorgeringo","rollingstones","rolling-stones","stones","jagger","keithrichards","thewho","the-who","mygeneration","my-generation","tommyboy","ledzeppelin","led-zeppelin","zeppelin","stairway","stairwaytoheaven","pinkfloyd","pink-floyd","thewall","the-wall","darkside","darksidemoon","doors","thedoors","jimmorrison","jim-morrison","lightmyfire","riders","hendrix","jimi","jimihendrix","purplehaze","purple-haze","voodoo-child","janis","janisjoplin","janis-joplin","mercedesbenz","piecemyheart","ccr","creedence","creedence-clearwater","fortunateson","badmoonrising","eagles","hotelcalifornia","hotel-california","desperado","takiteasy","fleetwood","fleetwoodmac","fleetwood-mac","rumours","dreams","thchain","carlysimon","carly-simon","youresovain","anticipation","simongarfunkel","simon-garfunkel","soundofsilence","bridgeovertroubledwater","caroleking","carole-king","tapestry","youvegotafriend","naturalwoman","crosbystillsnash","crosby-stills-nash","csny","suite-judy-blue-eyes","vietnam","vietnamera","vietnam-era","vietnamvet","vietnam-vet","napalm","civilrights","civil-rights","mlk","martin-luther-king","ihaveadream","moonlanding","moon-landing","apollo","apollo11","onesmallstep","jfk","kennedy","camelot","asknotwhat","cubanmissilecrisis","coldwars","watergate","nixon","rosemarywoods","18minutes","deepthroat","mash","allinthefamily","all-in-the-family","archie","archiebunker","happydays","happy-days","fonzie","thfonz","aaayyyy","jumptheshark","laverne-shirley","laverneshirley","schlemiel","schlimazel","marytylermore","mary-tyler-moore","rhoda","lou-grant","lourant","bobnehart","bob-newhart","newhart","hiimbob","thisislarrybrother","sanford-son","sanfordandson","bigdummy","elizabethimcoming","jeffersons","thejeffersons","movingonup","moving-on-up","deluxe","goodtimes","good-times","dynomite","dy-no-mite","jj","chico-man","chicoman","chicoandtheman","lookingfordwardo","kolchak","nightstalker","night-stalker","barnaby","barnabyjones","columbo","onmorething","one-more-thing","justonemorething","magnum","magnumpi","magnum-pi","selleck","tomelleck","ferrari308","rockfordfiles","rockford-files","jimrockford","answeringmachine","dallastv","dallas-tv","whoshotjr","who-shot-jr","ewingsouthfork","dynasty","alexis","crystalcarrington","catfight","shoulderpads","sixmilliondollarman","bionicwoman","bionic-woman","wecanrebuildhim","the","be","to","of","and","a","in","that","have","i","it","for","not","on","with","he","as","you","do","at","this","but","his","by","from","they","we","say","her","she","or","an","will","my","one","all","would","there","their","what","so","up","out","if","about","who","get","which","go","me","when","make","can","like","time","no","just","him","know","take","people","into","year","your","good","some","could","them","see","other","than","then","now","look","only","come","its","over","think","also","back","after","use","two","how","our","work","first","well","way","even","new","want","because","any","these","give","day","most","us","is","are","was","were","been","good","bad","great","best","worst","first","last","next","only","own","free","open","close","closed","new","old","young","big","small","little","long","short","high","low","fast","slow","quick","hot","cold","warm","cool","hard","soft","easy","difficult","simple","complex","clear","dark","light","bright","deep","shallow","wide","narrow","thick","thin","heavy","full","empty","clean","dirty","wet","dry","loud","quiet","silent","strong","weak","rich","poor","cheap","expensive","safe","dangerous","healthy","sick","happy","sad","angry","calm","busy","lazy","crazy","smart","stupid","clever","wise","dumb","funny","serious","strange","normal","weird","perfect","broken","whole","complete","partial","ready","active","passive","alive","dead","awake","asleep","aware","blind","bold","brave","calm","careful","certain","chief","common","curious","current","direct","double","early","entire","exact","extra","fair","false","famous","final","fine","firm","flat","former","forward","fresh","front","frozen","general","giant","global","golden","grand","green","gross","guilty","hidden","hollow","honest","huge","human","humble","hungry","ideal","ill","inner","instant","intense","internal","joint","just","keen","key","kind","known","large","late","latter","leading","legal","likely","limited","linear","liquid","live","living","local","logical","lonely","loose","lost","lovely","lower","lucky","mad","magic","main","major","male","female","manual","married","massive","master","maximum","mean","medium","mental","middle","military","minimum","minor","missing","mixed","mobile","modern","monthly","moral","mutual","naked","narrow","nasty","native","natural","nearby","neat","negative","nervous","neutral","next","nice","noble","noisy","normal","northern","novel","obvious","odd","official","ok","okay","olympic","only","open","opening","opposite","optional","orange","ordinary","organic","original","other","outdoor","outer","outside","overall","overseas","owing","own","pale","parallel","partial","particular","past","patient","peaceful","peculiar","permanent","personal","petty","physical","pink","plain","pleasant","plenty","plus","pointed","polite","political","popular","positive","possible","potential","powerful","practical","precious","precise","pregnant","present","presidential","pretty","previous","primary","prime","principal","prior","private","probable","productive","professional","profound","progressive","prominent","proper","prospective","protective","proud","provincial","psychological","public","pure","purple","qualified","quick","quiet","radical","random","rapid","rare","raw","ready","real","realistic","reasonable","recent","red","redundant","regional","regular","relative","relevant","reliable","religious","reluctant","remaining","remarkable","remote","representative","resident","resistant","respective","responsible","resulting","revolutionary","rich","ridiculous","right","rigid","rising","risky","rival","romantic","rough","round","royal","ruling","running","rural","sacred","sad","safe","salty","same","sample","go","come","get","give","take","make","do","say","see","look","find","use","tell","ask","work","seem","feel","try","leave","call","keep","let","begin","start","show","hear","play","run","move","live","believe","hold","bring","happen","write","provide","sit","stand","lose","pay","meet","include","continue","set","learn","change","lead","understand","watch","follow","stop","create","speak","read","allow","add","spend","grow","open","walk","win","offer","remember","love","consider","appear","buy","wait","serve","die","send","expect","build","stay","fall","cut","reach","kill","remain","suggest","raise","pass","sell","require","report","decide","pull","break","push","throw","catch","jump","kick","hit","fly","swim","drive","ride","climb","dance","sing","cook","eat","drink","sleep","wake","wash","dress","fight","help","save","teach","study","test","check","join","connect","link","share","post","send","receive","accept","reject","approve","deny","confirm","cancel","reset","restart","refresh","reload","update","upgrade","install","uninstall","download","upload","sync","backup","restore","recover","repair","fix","solve","resolve","complete","finish","time","year","people","way","day","man","woman","child","world","life","hand","part","place","case","week","company","system","program","question","work","government","number","night","point","home","water","room","mother","area","money","story","fact","month","lot","right","study","book","eye","job","word","business","issue","side","kind","head","house","service","friend","father","power","hour","game","line","end","member","law","car","city","community","name","president","team","minute","idea","kid","body","information","back","parent","face","others","level","office","door","health","person","art","war","history","party","result","change","morning","reason","research","girl","guy","moment","air","teacher","force","education","hello","hi","hey","hola","bonjour","ciao","aloha","howdy","greetings","welcome","goodbye","bye","farewell","later","peace","cheers","thanks","thankyou","thank-you","please","sorry","excuse","pardon","congrats","congratulations","bravo","wow","amazing","awesome","cool","nice","great","excellent","perfect","wonderful","fantastic","incredible","unbelievable","omg","wtf","lol","lmao","rofl","haha","hehe","xoxo","hugs","kisses","python","javascript","typescript","java","csharp","cpp","cplusplus","golang","go-lang","rust","rustlang","rust-lang","ruby","php","perl","swift","kotlin","scala","haskell","lisp","clojure","erlang","elixir","fsharp","ocaml","lua","r-lang","rlang","julia","dart","fortran","cobol","assembly","asm","wasm","webassembly","sql","nosql","graphql","mongodb","postgres","postgresql","mysql","mariadb","sqlite","redis","memcached","cassandra","dynamodb","firebase","supabase","prisma","sequelize","typeorm","react","reactjs","react-native","reactnative","angular","angularjs","vue","vuejs","svelte","sveltekit","nextjs","next-js","nuxt","nuxtjs","gatsby","remix","astro","solid","solidjs","preact","qwik","htmx","alpine","tailwind","tailwindcss","bootstrap","bulma","foundation","materialui","chakra","antd","ant-design","shadcn","radix","headlessui","daisyui","nodejs","node-js","deno","bun","express","fastify","koa","nestjs","django","flask","fastapi","rails","rubyonrails","laravel","symfony","spring","springboot","spring-boot","dotnet","aspnet","blazor","maui","electron","tauri","flutter","ionic","capacitor","cordova","xamarin","unity","unreal","godot","pygame","phaser","threejs","three-js","babylon","webpack","vite","rollup","parcel","esbuild","swc","babel","eslint","prettier","jest","vitest","mocha","jasmine","cypress","playwright","selenium","puppeteer","storybook","chromatic","ladle","histoire","docker","kubernetes","k8s","k3s","minikube","helm","istio","envoy","podman","containerd","crio","rancher","openshift","nomad","consul","terraform","pulumi","crossplane","ansible","puppet","chef","saltstack","vagrant","packer","vault","boundary","waypoint","atlantis","argocd","argo-cd","fluxcd","flux-cd","jenkins","circleci","travisci","travis-ci","github-actions","githubactions","gitlab-ci","gitlabci","bitbucket-pipelines","azure-devops","azuredevops","teamcity","bamboo","drone","tekton","spinnaker","aws","amazon","azure","gcp","google-cloud","googlecloud","digitalocean","linode","vultr","hetzner","ovh","scaleway","upcloud","heroku","vercel","netlify","cloudflare","fastly","akamai","cloudfront","railway","render","fly-io","flyio","deno-deploy","workers","cloudflare-workers","lambda","serverless","faas","paas","iaas","saas","baas","kaas","daas","nginx","apache","caddy","traefik","haproxy","envoy","kong","apisix","grafana","prometheus","loki","tempo","jaeger","zipkin","datadog","newrelic","splunk","elastic","elasticsearch","kibana","logstash","elk","fluentd","fluentbit","vector","telegraf","influxdb","timescaledb","questdb","pagerduty","opsgenie","victorops","statuspage","incident-io","rootly","ai","artificial-intelligence","ml","machine-learning","machinelearning","deep-learning","deeplearning","neural","neuralnet","neural-network","tensorflow","pytorch","keras","jax","flax","scikit","sklearn","scipy","numpy","pandas","matplotlib","seaborn","plotly","bokeh","altair","huggingface","hugging-face","transformers","diffusers","datasets","openai","gpt","gpt4","gpt-4","chatgpt","chat-gpt","claude","anthropic","gemini","bard","palm","llama","llama2","llama-2","mistral","mixtral","falcon","mpt","dolly","alpaca","vicuna","orca","phi","zephyr","yi","qwen","deepseek","codellama","code-llama","starcoder","codegen","copilot","cursor","tabnine","codeium","replit","sourcegraph","cody","continue","langchain","llamaindex","llama-index","autogpt","auto-gpt","babyagi","agentgpt","superagi","crewai","autogen","semantic-kernel","guidance","ollama","lmstudio","lm-studio","localai","local-ai","gpt4all","koboldai","oobabooga","text-generation-webui","vllm","tgi","triton","tensorrt","stable-diffusion","stablediffusion","midjourney","dalle","dall-e","imagen","sdxl","controlnet","lora","dreambooth","textual-inversion","automatic1111","comfyui","invokeai","fooocus","kohya","runpod","replicate","banana","modal","anyscale","ray","mlflow","weights-biases","wandb","comet","neptune","clearml","dvc","lakefs","pachyderm","kubeflow","mlrun","seldon","bentoml","mlserver","torchserve","triton-inference","sagemaker","vertex","azure-ml","databricks","snowflake","dbt","airbyte","fivetran","security","cybersec","infosec","netsec","appsec","devsecops","secops","hacking","hacker","hackers","pentest","pentesting","redteam","red-team","blueteam","blue-team","purpleteam","purple-team","bugbounty","bug-bounty","ctf","capture-the-flag","wargames","hackthebox","tryhackme","picoctf","overthewire","vulnhub","exploit","exploits","exploit-db","cve","nvd","mitre","attck","att-ck","owasp","sans","nist","iso27001","soc2","gdpr","hipaa","pci","pci-dss","compliance","audit","forensics","malware","ransomware","trojan","virus","worm","rootkit","botnet","phishing","spearphishing","whaling","vishing","smishing","social-eng","osint","recon","reconnaissance","footprinting","scanning","enumeration","privilege-escalation","privesc","lateral-movement","persistence","exfil","firewall","ids","ips","waf","siem","soar","edr","xdr","mdr","ndr","vpn","proxy","tor","onion","i2p","freenet","darknet","darkweb","encryption","decryption","cipher","hash","hashing","sha","md5","bcrypt","argon2","scrypt","aes","rsa","ecc","ecdsa","ed25519","curve25519","ssl","tls","https","certificates","pki","x509","acme","letsencrypt","oauth","oauth2","oidc","saml","jwt","tokens","sessions","cookies","mfa","2fa","totp","hotp","fido","fido2","webauthn","passkeys","biometrics","password","passwords","passphrase","keychain","vault","secrets","keys","nmap","masscan","zmap","shodan","censys","greynoise","binaryedge","burp","burpsuite","zap","owasp-zap","nikto","sqlmap","metasploit","cobalt-strike","cobaltstrike","empire","covenant","sliver","mythic","mimikatz","bloodhound","responder","impacket","crackmapexec","evil-winrm","hashcat","john","johntheripper","hydra","medusa","aircrack","aircrack-ng","wireshark","tcpdump","tshark","scapy","ettercap","bettercap","mitmproxy","ghidra","ida","radare2","r2","binary-ninja","hopper","cutter","x64dbg","immunity","ollydbg","gdb","lldb","windbg","frida","objection","cycript","blockchain","crypto","cryptocurrency","defi","de-fi","cefi","ce-fi","bitcoin","btc","ethereum","eth","solana","sol","cardano","ada","polkadot","dot","avalanche","avax","polygon","matic","arbitrum","arb","optimism","op","base","zksync","zk-sync","starknet","scroll","linea","cosmos","atom","osmosis","osmo","celestia","tia","injective","inj","near","nearprotocol","aptos","apt","sui","mina","algorand","algo","tezos","xtz","hedera","hbar","fantom","ftm","harmony","one","elrond","egld","flow","icp","internet-computer","filecoin","fil","arweave","ar","storj","sia","akash","akt","render","rndr","chainlink","link","thegraph","grt","api3","band","uma","tellor","uniswap","uni","sushiswap","sushi","pancakeswap","cake","curve","crv","aave","compound","comp","makerdao","maker","mkr","dai","synthetix","lido","steth","rocketpool","reth","frax","convex","cvx","yearn","yfi","dydx","gmx","perpetual","perp","vertex","hyperliquid","drift","opensea","blur","looksrare","x2y2","sudoswap","nftx","rarible","foundation","nft","nfts","pfp","generative","ordinals","inscriptions","brc20","brc-20","wallet","wallets","metamask","phantom","rainbow","rabby","frame","zerion","ledger","trezor","coldcard","bitbox","keystone","hardware-wallet","seed","seedphrase","seed-phrase","mnemonic","private-key","privatekey","mining","miner","miners","hashrate","hash-rate","pow","pos","dpos","staking","stake","validator","validators","delegation","slashing","gas","gwei","eip","eip1559","erc20","erc721","erc1155","erc4626","dao","daos","governance","proposal","voting","snapshot","tally","multisig","multi-sig","gnosis","safe","timelock","vesting","airdrop","hardware","electronics","circuits","pcb","breadboard","soldering","arduino","esp32","esp8266","stm32","teensy","pico","rp2040","attiny","raspberrypi","raspberry-pi","rpi","rpi4","rpi5","rpi-zero","rpizero","beaglebone","beagle-bone","orangepi","orange-pi","bananapi","banana-pi","jetson","nvidia-jetson","nano","xavier","orin","coral","edge-tpu","fpga","verilog","vhdl","systemverilog","chisel","myhdl","amaranth","xilinx","altera","intel-fpga","lattice","gowin","efinix","anlogic","asic","risc","risc-v","riscv","arm","arm64","aarch64","x86","x64","mips","powerpc","sparc","xtensa","avr","pic","msp430","8051","microcontroller","mcu","soc","cpu","gpu","npu","tpu","dpu","ipu","memory","ram","dram","sram","flash","eeprom","rom","nvram","mram","ssd","nvme","hdd","storage","raid","nas","san","das","iscsi","usb","usb-c","thunderbolt","pcie","sata","nvlink","hdmi","displayport","ethernet","wifi","bluetooth","ble","zigbee","zwave","thread","matter","lora","lorawan","sigfox","nbiot","nb-iot","lte-m","catm1","5g","4g","antenna","antennas","rf","sdr","rtl-sdr","hackrf","limesdr","pluto","oscilloscope","logic-analyzer","multimeter","power-supply","signal-gen","3dprinter","3d-printer","3dprinting","fdm","sla","resin","filament","cnc","laser","lasercutter","laser-cutter","plasma","waterjet","edm","physics","quantum","quantum-physics","quantumphysics","quantummechanics","relativity","einstein","newton","particle","particles","hadron","cern","fermion","boson","higgs","quark","lepton","neutrino","photon","electron","proton","neutron","atom","atoms","atomic","nuclear","fission","fusion","plasma","magnetism","electromagnetism","gravity","gravitation","spacetime","blackhole","black-hole","singularity","wormhole","darkmatter","dark-matter","darkenergy","dark-energy","cosmology","bigbang","big-bang","inflation","astronomy","astrophysics","cosmos","universe","multiverse","galaxy","galaxies","milkyway","milky-way","andromeda","nebula","nebulae","pulsar","quasar","magnetar","supernova","nova","dwarf","whitedwarf","reddwarf","star","stars","stellar","solar","sun","sunspot","corona","flare","planet","planets","planetary","exoplanet","mercury","venus","earth","mars","jupiter","saturn","uranus","neptune","pluto","ceres","eris","moon","moons","lunar","asteroid","asteroids","comet","comets","meteor","telescope","telescopes","hubble","webb","jwst","james-webb","chandra","spitzer","kepler","tess","gaia","vlt","elt","keck","alma","ska","nasa","esa","jaxa","isro","roscosmos","cnsa","spacex","blueorigin","virgin-galactic","rocketlab","relativity-space","firefly","astra","chemistry","chem","chemical","chemicals","molecule","molecules","molecular","organic","inorganic","polymer","polymers","catalyst","reaction","synthesis","element","elements","periodic","periodic-table","hydrogen","helium","lithium","carbon","nitrogen","oxygen","sulfur","phosphorus","potassium","calcium","iron","copper","zinc","silver","gold","platinum","uranium","plutonium","biology","bio","biological","bioscience","lifescience","life-science","cell","cells","cellular","dna","rna","mrna","gene","genes","genetic","genetics","genomics","genome","chromosome","protein","proteins","enzyme","bacteria","bacterial","virus","viral","microbe","microbes","microbiology","fungus","fungi","yeast","algae","plankton","protozoa","amoeba","evolution","darwin","natural-selection","species","taxonomy","phylogeny","ecology","ecosystem","biodiversity","conservation","endangered","extinction","botany","botanical","plant","plants","flora","flower","flowers","tree","trees","forest","forests","rainforest","jungle","grassland","savanna","zoology","animal","animals","fauna","mammal","mammals","reptile","reptiles","amphibian","amphibians","bird","birds","avian","fish","fishes","marine","insect","insects","arthropod","arachnid","spider","spiders","butterfly","earth","earthscience","earth-science","geology","geological","geologist","rock","rocks","mineral","minerals","crystal","crystals","gem","gems","volcano","volcanoes","volcanic","lava","magma","eruption","tectonic","earthquake","earthquakes","seismic","seismology","fault","faults","mountain","mountains","peak","peaks","summit","ridge","range","alps","himalayas","rockies","andes","everest","kilimanjaro","fuji","denali","ocean","oceans","oceanic","atlantic","pacific","indian","arctic","antarctic","sea","seas","mediterranean","caribbean","baltic","adriatic","aegean","river","rivers","stream","streams","creek","creeks","delta","estuary","lake","lakes","pond","ponds","reservoir","wetland","wetlands","swamp","island","islands","peninsula","cape","bay","gulf","strait","channel","continent","continents","africa","asia","europe","northamerica","southamerica","australia","oceania","antarctica","arctic","polar","tropical","equator","climate","weather","meteorology","atmosphere","stratosphere","troposphere","temperature","precipitation","humidity","pressure","wind","winds","storm","storms","hurricane","typhoon","cyclone","tornado","tornadoes","lightning","thunder","thunderstorm","monsoon","blizzard","drought","environment","environmental","eco","ecology","green","sustainable","sustainability","renewable","renewables","solar","solar-power","solarpower","wind-power","windpower","hydro","hydroelectric","geothermal","biomass","nuclear-power","nuclearpower","fusion-power","fusionpower","clean-energy","carbon","carbon-neutral","carbonneutral","netzero","net-zero","emissions","greenhouse","co2","methane","ozone","pollution","pollutants","smog","recycle","recycling","compost","composting","waste","zerowaste","zero-waste","plastic","plastics","microplastic","biodegradable","reusable","disposable","organic","natural","vegan","vegetarian","plantbased","plant-based","climate-change","climatechange","global-warming","globalwarming","ipcc","paris-agreement","cop","cop28","unfccc","epa","wwf","greenpeace","sports","sport","athletics","athletic","athlete","athletes","fitness","workout","workouts","exercise","exercises","training","trainer","gym","football","nfl","soccer","fifa","worldcup","world-cup","premier-league","champions-league","laliga","la-liga","bundesliga","seriea","serie-a","basketball","nba","wnba","ncaa","march-madness","hoops","dunk","slam","baseball","mlb","homerun","home-run","worldseries","world-series","hockey","nhl","ice-hockey","icehockey","puck","slap-shot","goalie","tennis","atp","wta","wimbledon","usopen","us-open","roland-garros","golf","pga","lpga","masters","ryder-cup","birdie","eagle","hole-in-one","boxing","mma","ufc","bellator","wrestling","wwe","aew","judo","karate","taekwondo","jiu-jitsu","jiujitsu","bjj","muay-thai","kickboxing","kung-fu","olympics","olympic","paralympics","paralympic","commonwealthgames","running","runner","runners","marathon","marathons","half-marathon","5k","10k","ultra","ultramarathon","trail-running","trailrunning","cross-country","cycling","cyclist","cycling","tour-de-france","tourdefrance","giro","vuelta","time-trial","peloton","velodrome","bmx","mountainbike","mtb","swimming","swimmer","swimmers","pool","freestyle","backstroke","butterfly","triathlon","triathlete","ironman","sprint-tri","olympic-tri","duathlon","weightlifting","powerlifting","crossfit","bodybuilding","strongman","yoga","pilates","aerobics","zumba","hiit","cardio","stretching","mobility","surfing","surf","surfer","surfers","waves","barrel","pipeline","wsl","skateboarding","skate","skater","skaters","sk8","halfpipe","vert","street","snowboarding","snowboard","snowboarder","skiing","ski","skier","slopes","climbing","climber","climbers","bouldering","trad","sport-climbing","parkour","freerunning","free-running","traceur","movement","calisthenics","music","musician","musicians","musical","song","songs","album","albums","artist","artists","band","bands","singer","singers","vocalist","voice","rock","rock-music","rockmusic","rocknroll","rock-n-roll","classic-rock","pop","pop-music","popmusic","kpop","k-pop","jpop","j-pop","cpop","c-pop","hiphop","hip-hop","rap","rapper","rappers","trap","drill","grime","rnb","r-n-b","soul","funk","disco","motown","reggae","dancehall","ska","jazz","jazz-music","jazzmusic","bebop","swing","bigband","big-band","blues","blues-music","bluesmusic","delta-blues","chicago-blues","electric","country","country-music","countrymusic","bluegrass","americana","folk","electronic","edm","techno","house","trance","dubstep","drum-and-bass","dnb","drumnbass","ambient","chillout","chill-out","lofi","lo-fi","beats","classical","classical-music","classicalmusic","orchestra","symphony","opera","choir","choral","chamber","baroque","romantic","contemporary","metal","heavy-metal","heavymetal","death-metal","black-metal","thrash","punk","punk-rock","punkrock","hardcore","emo","screamo","post-punk","indie","indie-rock","indierock","indie-pop","indiepop","alternative","grunge","shoegaze","dream-pop","dreampop","noise","experimental","world-music","worldmusic","latin","salsa","merengue","bachata","cumbia","afrobeat","afro-beat","afropop","afro-pop","highlife","juju","mbalax","guitar","guitarist","bass","bassist","drums","drummer","percussion","keyboard","keyboardist","piano","pianist","synth","synthesizer","keys","violin","violinist","cello","cellist","viola","bass","doublebass","saxophone","sax","trumpet","trombone","clarinet","flute","oboe","horn","dj","deejay","turntable","turntables","mixing","mixer","scratching","producer","producers","production","beatmaker","beat-maker","beats","recording","studio","studios","mastering","mixing","mixing-board","spotify","apple-music","applemusic","tidal","deezer","soundcloud","bandcamp","youtube-music","youtubemusic","amazon-music","amazonmusic","vinyl","records","record","lp","ep","single","singles","discography","concert","concerts","gig","gigs","tour","touring","festival","festivals","coachella","glastonbury","lollapalooza","bonnaroo","burning-man","sxsw","grammy","grammys","brit-awards","vma","ama","billboard","rolling-stone","movies","movie","film","films","cinema","cinematic","theater","theatre","hollywood","bollywood","nollywood","tollywood","anime","animation","documentary","documentaries","doc","docs","docuseries","docu-series","tv","television","series","show","shows","episode","episodes","season","drama","dramas","comedy","comedies","romcom","rom-com","sitcom","sitcoms","action","adventure","thriller","thrillers","horror","scary","slasher","scifi","sci-fi","science-fiction","sciencefiction","fantasy","dystopia","superhero","superheroes","marvel","mcu","dc","dceu","batman","superman","spiderman","spider-man","avengers","xmen","x-men","fantastic-four","starwars","star-wars","startrek","star-trek","trekkie","trekkies","lotr","lord-of-the-rings","lordoftherings","hobbit","tolkien","middle-earth","harrypotter","harry-potter","hogwarts","wizarding","potterhead","gameofthrones","game-of-thrones","got","westeros","houseofdragon","stranger-things","strangerthings","breaking-bad","breakingbad","bettercallsaul","netflix","hulu","disney-plus","disneyplus","hbo","hbomax","max","amazon-prime","amazonprime","primevideo","prime-video","appletv","paramount-plus","paramountplus","peacock","criterion","mubi","shudder","director","directors","filmmaker","filmmakers","cinematographer","dop","actor","actors","actress","actresses","cast","casting","audition","screenwriter","screenwriting","script","scripts","screenplay","storyboard","oscar","oscars","academy-awards","academyawards","emmy","emmys","golden-globe","goldenglobes","bafta","cannes","sundance","tribeca","toronto","tiff","venice","berlinale","sxsw-film","telluride","gaming","gamer","gamers","games","game","videogames","video-games","pc-gaming","pcgaming","console","consoles","handheld","mobile-gaming","playstation","ps5","ps4","ps3","psn","xbox","xboxone","xbox-series","nintendo","switch","switch-2","wii","wiiu","gamecube","n64","snes","nes","steam","steamdeck","steam-deck","epic","epicgames","epic-games","gog","rpg","jrpg","mmorpg","mmo","fps","tps","rts","moba","battle-royale","sandbox","survival","roguelike","roguelite","metroidvania","souls-like","platformer","puzzle","adventure","simulation","sim","sims","strategy","minecraft","fortnite","valorant","csgo","cs2","counterstrike","counter-strike","league","leagueoflegends","league-of-legends","lol","dota","dota2","overwatch","ow2","apex","apexlegends","apex-legends","warzone","callofduty","gta","grandtheftauto","grand-theft-auto","gta6","gta5","rockstar","eldenring","elden-ring","darksouls","dark-souls","bloodborne","sekiro","zelda","totk","botw","tears-of-the-kingdom","breath-of-the-wild","link","mario","supermario","super-mario","mariokart","mario-kart","smashbros","pokemon","pokemongo","pokemon-go","pikachu","scarlet","violet","finalfantasy","final-fantasy","ff16","ff14","ffxiv","squareenix","destiny","destiny2","bungie","halo","haloinfinite","343industries","diablo","diablo4","worldofwarcraft","world-of-warcraft","wow","blizzard","starcraft","hearthstone","overwatch","battlenet","battle-net","assassinscreed","assassins-creed","farcry","far-cry","watchdogs","ubisoft","cyberpunk","cyberpunk2077","witcher","witcher3","cdprojekt","cdpr","baldursgate","baldurs-gate","bg3","larian","divinity","dos2","esports","e-sports","competitive","tournament","tournaments","lan","twitch","streamer","streamers","streaming","youtube-gaming","kick","speedrun","speedrunner","speedrunning","gdq","agdq","sgdq","food","foods","foodie","foodies","cooking","cook","cooks","chef","chefs","recipe","recipes","kitchen","kitchens","culinary","gastronomy","gourmet","restaurant","restaurants","dining","dine","eat","eating","meal","meals","breakfast","brunch","lunch","dinner","supper","snack","snacks","dessert","appetizer","appetizers","entree","entrees","side","sides","course","pizza","pizzas","burger","burgers","sandwich","sandwiches","wrap","wraps","taco","tacos","burrito","burritos","quesadilla","nachos","enchilada","sushi","sashimi","ramen","udon","soba","tempura","teriyaki","bento","pasta","spaghetti","lasagna","ravioli","gnocchi","risotto","italian","steak","steaks","bbq","barbeque","barbecue","grill","grilling","smoker","chicken","beef","pork","lamb","fish","seafood","shrimp","lobster","crab","vegetarian","vegan","plantbased","plant-based","meatless","tofu","tempeh","salad","salads","soup","soups","stew","stews","chili","curry","curries","bread","breads","baking","baker","bakery","pastry","pastries","cake","cookies","brownies","pie","pies","tart","tarts","donut","donuts","coffee","espresso","latte","cappuccino","mocha","americano","coldbrew","tea","teas","greentea","green-tea","blacktea","black-tea","herbal","chai","beer","beers","craft-beer","craftbeer","ipa","lager","stout","ale","brew","wine","wines","redwine","red-wine","whitewine","white-wine","rose","sparkling","cocktail","cocktails","mixology","bartender","bartending","spirits","whiskey","whisky","bourbon","scotch","vodka","gin","rum","tequila","fashion","style","styling","stylist","stylish","trendy","trend","trends","clothing","clothes","outfit","outfits","ootd","lookbook","wardrobe","dress","dresses","shirt","shirts","pants","jeans","shorts","skirt","jacket","jackets","coat","coats","sweater","hoodie","hoodies","blazer","shoes","sneakers","boots","heels","sandals","loafers","footwear","accessories","accessory","jewelry","jewellery","watch","watches","bag","bags","handbag","purse","wallet","sunglasses","hat","hats","scarf","designer","designers","luxury","luxe","haute-couture","hautecouture","runway","catwalk","model","models","modeling","modelling","supermodel","vogue","elle","harpers-bazaar","gq","esquire","cosmopolitan","instyle","beauty","beautiful","gorgeous","stunning","glam","glamour","glamorous","makeup","make-up","cosmetics","lipstick","mascara","eyeliner","eyeshadow","foundation","concealer","blush","bronzer","highlighter","contour","skincare","skin-care","skincareroutine","cleanser","moisturizer","serum","sunscreen","spf","anti-aging","antiaging","wrinkles","acne","pores","hair","haircare","hair-care","hairstyle","hairstyles","haircut","haircolor","blonde","brunette","redhead","highlights","balayage","ombre","extensions","nails","manicure","pedicure","nailart","nail-art","gelnails","acrylics","fragrance","perfume","cologne","scent","scents","aromatherapy","essentials","travel","traveling","travelling","traveler","traveller","travelers","trip","trips","vacation","vacations","holiday","holidays","getaway","adventure","adventures","explore","exploring","explorer","wanderlust","backpacking","backpacker","backpackers","hostel","hostels","hotel","hotels","airbnb","vrbo","booking","expedia","tripadvisor","kayak","skyscanner","flight","flights","airline","airlines","airport","airports","terminal","cruise","cruises","cruising","sailing","yacht","charter","island-hopping","roadtrip","road-trip","roadtrips","driving","scenic","route","routes","hiking","hike","hikes","trail","trails","trek","trekking","camping","beach","beaches","coastal","seaside","oceanfront","beachfront","shore","mountain","mountains","alpine","summit","peak","valley","canyon","gorge","city","cities","urban","metropolitan","downtown","cityscape","skyline","village","villages","town","towns","countryside","rural","scenic","landmark","landmarks","monument","monuments","heritage","unesco","historic","paris","london","newyork","new-york","tokyo","rome","barcelona","amsterdam","berlin","vienna","prague","budapest","lisbon","madrid","athens","istanbul","dubai","singapore","hongkong","hong-kong","bangkok","seoul","taipei","sydney","melbourne","auckland","capetown","cape-town","cairo","marrakech","nairobi","rio","buenosaires","buenos-aires","mexicocity","mexico-city","lima","bogota","sanfrancisco","san-francisco","losangeles","los-angeles","chicago","miami","lasvegas","las-vegas","seattle","boston","austin","denver","portland","vancouver","toronto","montreal","calgary","ottawa","quebec","edmonton","family","families","familytime","family-time","familyfirst","famfam","parents","parenting","parent","parenthood","parentlife","parent-life","mom","moms","momlife","mom-life","mommy","mother","mothers","motherhood","dad","dads","dadlife","dad-life","daddy","father","fathers","fatherhood","kids","kid","children","child","childhood","kidlife","kid-life","toddler","baby","babies","newborn","infant","pregnancy","pregnant","expecting","grandparents","grandma","grandpa","grandmother","grandfather","nana","papa","siblings","sibling","brother","brothers","sister","sisters","twins","friends","friend","friendship","friendships","bestfriend","best-friend","bff","besties","bestie","squad","squadgoals","squad-goals","crew","gang","dating","date","dates","relationship","relationships","couple","couples","boyfriend","girlfriend","partner","partners","significant-other","so","engaged","engagement","fiance","fiancee","wedding","weddings","bride","groom","married","marriage","spouse","husband","wife","newlyweds","anniversary","anniversaries","love","loving","romance","romantic","single","singles","singlelife","single-life","bachelor","bachelorette","divorce","divorced","separated","coparenting","co-parenting","stepparent","blended","blendedfamily","blended-family","adoption","adopted","foster","lgbtq","lgbt","lgbtqia","queer","pride","pridemonth","pride-month","gay","gays","lesbian","lesbians","bisexual","bi","pansexual","pan","transgender","trans","nonbinary","non-binary","nb","genderfluid","genderqueer","asexual","ace","aromantic","aro","demisexual","demi","intersex","ally","coming-out","comingout","outandproud","out-and-proud","loveislove","love-is-love","feminist","feminism","feminists","womensrights","womens-rights","equality","civilrights","civil-rights","humanrights","human-rights","socialjustice","blm","blacklivesmatter","black-lives-matter","antiracism","anti-racism","indigenous","native","firstnations","first-nations","aboriginal","tribal","disability","disabled","accessibility","a11y","inclusion","inclusive","neurodivergent","adhd","autism","autistic","dyslexia","dyslexic","mental-health","mentalhealth","anxiety","depression","bipolar","ptsd","ocd","therapy","selfcare","self-care","wellness","wellbeing","well-being","mindfulness","meditation","meditate","mindful","zen","calm","peace","peaceful","serenity","recovery","sober","sobriety","clean","aa","na","12steps","12-steps","support","supportgroup","support-group","community","communities","tribe","religion","religious","faith","faithful","belief","believe","believer","spiritual","spirituality","spirit","spirits","soul","souls","divine","christian","christianity","christians","church","churches","jesus","christ","catholic","catholicism","catholics","protestant","evangelical","baptist","methodist","lutheran","presbyterian","orthodox","episcopal","anglican","mormon","lds","latterday","latter-day","jehovah","adventist","pentecostal","jewish","judaism","jews","hebrew","israel","israeli","kosher","sabbath","torah","talmud","synagogue","temple","rabbi","hanukkah","passover","yom-kippur","muslim","islam","islamic","muslims","quran","koran","allah","muhammad","mosque","masjid","imam","halal","ramadan","eid","hajj","mecca","medina","hindu","hinduism","hindus","vedic","yoga","karma","dharma","mantra","temple","temples","krishna","shiva","vishnu","ganesh","diwali","holi","buddhist","buddhism","buddhists","buddha","zen","tibetan","dalai-lama","meditation","enlightenment","nirvana","sangha","dharma","sutra","sikh","sikhism","sikhs","guru","gurus","gurdwara","punjabi","pagan","paganism","wicca","wiccan","witchcraft","witch","witches","atheist","atheism","agnostic","agnosticism","secular","humanist","humanism","prayer","prayers","praying","worship","worshipping","praise","praising","blessing","blessings","blessed","miracle","miracles","grace","salvation","heaven","hell","afterlife","eternal","eternity","resurrection","redemption","work","working","worker","workers","workplace","worklife","work-life","job","jobs","career","careers","profession","professional","professionals","office","offices","corporate","corporation","company","companies","business","startup","startups","entrepreneur","entrepreneurs","entrepreneurship","founder","ceo","cto","cfo","coo","cmo","ciso","vp","director","manager","lead","employee","employees","employer","employers","hr","humanresources","human-resources","hiring","hire","recruit","recruiting","recruitment","talent","headhunter","interview","interviews","interviewing","resume","cv","linkedin","networking","salary","salaries","compensation","benefits","perks","bonus","bonuses","promotion","promoted","raise","negotiation","negotiate","contract","contracts","remote","remotework","remote-work","wfh","workfromhome","work-from-home","hybrid","flexible","flexibility","freelance","freelancer","freelancing","gig","gigeconomy","gig-economy","sideproject","side-project","sidehustle","meeting","meetings","presentation","presentations","conference","conferences","project","projects","deadline","deadlines","milestone","milestones","deliverable","team","teams","teamwork","collaboration","collaborate","agile","scrum","kanban","leadership","leader","leaders","management","manage","managing","productivity","efficiency","efficient","effective","performance","kpi","okr","metrics","burnout","stress","stressed","workload","overtime","quit","quitting","resign","retirement","retired","retiring","pension","401k","ira","savings","invest","0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","42","50","60","69","70","80","88","90","99","100","101","111","123","200","222","247","300","333","365","400","404","420","444","500","555","666","700","777","800","888","900","911","999","1000","1111","1234","2000","2020","2021","2022","2023","2024","2025","2026","2027","2028","2029","2030","2050","3000","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","ch1","ch2","ch3","ch4","ch5","ch6","ch7","ch8","ch9","ch10","ch11","ch12","ch13","ch14","ch15","ch16","ch17","ch18","ch19","ch20","channel1","channel2","channel3","channel4","channel5","channel6","channel7","channel8","channel9","channel10","channel11","channel12","channel13","room1","room2","room3","room4","room5","room6","room7","room8","room9","room10","group1","group2","group3","group4","group5","group6","group7","group8","group9","group10","team1","team2","team3","team4","team5","team6","team7","team8","team9","team10","zone1","zone2","zone3","zone4","zone5","zone6","zone7","zone8","zone9","zone10","area1","area2","area3","area4","area5","area6","area7","area8","area9","area10","sector1","sector2","sector3","sector4","sector5","sector6","sector7","sector8","net1","net2","net3","net4","net5","net6","net7","net8","net9","net10","link1","link2","link3","link4","link5","link6","link7","link8","link9","link10","node1","node2","node3","node4","node5","node6","node7","node8","node9","node10","hub1","hub2","hub3","hub4","hub5","hub6","hub7","hub8","hub9","hub10","mesh1","mesh2","mesh3","mesh4","mesh5","mesh6","mesh7","mesh8","mesh9","mesh10","radio1","radio2","radio3","radio4","radio5","radio6","radio7","radio8","radio9","relay1","relay2","relay3","relay4","relay5","relay6","relay7","relay8","relay9","base1","base2","base3","base4","base5","base6","base7","base8","base9","base10","unit1","unit2","unit3","unit4","unit5","unit6","unit7","unit8","unit9","unit10","server1","server2","server3","server4","server5","server6","server7","server8","dev1","dev2","dev3","dev4","dev5","prod1","prod2","prod3","stage1","stage2","test1","test2","test3","test4","test5","test6","test7","test8","test9","test10","user1","user2","user3","user4","user5","admin1","admin2","admin3","ops1","ops2","alpha","bravo","charlie","delta","echo","foxtrot","golf","hotel","india","juliet","kilo","lima","mike","november","oscar","papa","quebec","romeo","sierra","tango","uniform","victor","whiskey","xray","x-ray","yankee","zulu","alpha1","bravo1","charlie1","delta1","echo1","foxtrot1","alpha-team","bravo-team","charlie-team","delta-team","echo-team","team-alpha","team-bravo","team-charlie","team-delta","team-echo","red","blue","green","yellow","orange","purple","pink","black","white","gray","grey","brown","gold","silver","bronze","copper","platinum","cyan","magenta","teal","navy","maroon","olive","lime","aqua","coral","crimson","indigo","violet","turquoise","beige","ivory","tan","khaki","red-team","blue-team","green-team","yellow-team","orange-team","purple-team","team-red","team-blue","team-green","team-yellow","team-orange","team-purple","rednet","bluenet","greennet","blacknet","whitenet","darknet","clearnet","monday","tuesday","wednesday","thursday","friday","saturday","sunday","mon","tue","wed","thu","fri","sat","sun","weekday","weekend","january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","jun","jul","aug","sep","oct","nov","dec","spring","summer","fall","autumn","winter","season","seasons","seasonal","morning","afternoon","evening","night","midnight","noon","dawn","dusk","daily","weekly","monthly","yearly","annual","quarterly","hourly","today","tomorrow","yesterday","now","later","soon","always","never","24-7","247","round-the-clock","nonstop","non-stop","always-on","alwayson","north","south","east","west","northeast","northwest","southeast","southwest","northern","southern","eastern","western","central","middle","center","up","down","left","right","top","bottom","front","back","side","upper","lower","inner","outer","inside","outside","above","below","near","far","close","distant","local","remote","nearby","faraway","here","there","everywhere","anywhere","somewhere","nowhere","wherever","mini","micro","nano","tiny","small","little","medium","large","big","huge","giant","massive","mega","giga","tera","peta","exa","ultra","super","hyper","extreme","max","maximum","min","minimum","plus","extra","lite","light","heavy","full","empty","half","partial","complete","total","all-chat","allchat","main-chat","mainchat","public-chat","publicchat","general-chat","generalchat","global-chat","globalchat","world-chat","worldchat","local-chat","localchat","open-chat","openchat","free-chat","freechat","random-chat","randomchat","voice-chat","voicechat","text-chat","textchat","all-net","allnet","main-net","mainnet","test-net","testnet","dev-net","devnet","local-net","localnet","global-net","globalnet","public-net","publicnet","mesh-net","meshnet","radio-net","radionet","ham-net","hamnet","emerg-net","emergnet","all-hands","allhands","town-hall","townhall","standby","stand-by","on-call","oncall","help-desk","helpdesk","support","tech-support","techsupport","customer-support","feedback","suggestions","ideas","feature-requests","featurerequests","bug-reports","watercooler","water-cooler","coffee-break","coffeebreak","break-room","breakroom","off-topic","offtopic","random","misc","miscellaneous","other","everything-else","introductions","intro","intros","welcome","new-members","newmembers","onboarding","announcements","announce","news","updates","changelog","releases","roadmap","rules","guidelines","faq","faqs","help","how-to","howto","tutorial","tutorials","resources","links","useful-links","usefullinks","bookmarks","reference","docs","showcase","show-and-tell","showandtell","gallery","portfolio","projects","builds","jobs","hiring","careers","opportunities","gigs","freelance","classifieds","buy-sell","buysell","marketplace","trade","trading","swap","swaps","deals","events","meetups","meetup","gatherings","conferences","workshops","webinars","study-group","studygroup","book-club","bookclub","movie-night","movienight","game-night","gamenight","trivia","quiz","contests","challenges","competitions","reddit","twitter","x","facebook","fb","instagram","ig","insta","tiktok","youtube","yt","pinterest","snapchat","snap","linkedin","tumblr","threads","mastodon","fediverse","bluesky","bsky","discord","slack","telegram","signal","whatsapp","messenger","wechat","line","kakao","viber","matrix","element","clubhouse","spaces","periscope","vine","myspace","digg","stumbleupon","quora","medium","substack","patreon","onlyfans","fanhouse","gumroad","behance","dribbble","deviantart","artstation","pixiv","flickr","500px","meme","memes","dank","dankmemes","dank-memes","cursed","blessed","blursed","cringe","based","redpill","redpilled","blackpill","copium","hopium","cope","poggers","pog","pogchamp","pepe","wojak","gigachad","chad","virgin","simp","simping","stan","stanning","parasocial","irl","afk","brb","ttyl","fomo","yolo","goat","goated","lit","fire","slay","slaying","periodt","sus","sussy","imposter","amogus","amongus","among-us","crewmate","ratio","ratiod","L","W","big-L","big-W","touch-grass","touchgrass","npc","npcs","normie","normies","sheeple","boomer","zoomer","doomer","coomer","consoomer","wagie","neet","incel","volcel","blackpilled","glowie","janny","jannie","based-and-redpilled","keyed","kino","sovl","tfw","mfw","mrw","imo","imho","afaik","eli5","tldr","tl-dr","reddit-moment","leddit","hivemind","groupthink","echo-chamber","circlejerk","wholesome","wholesome100","chungus","big-chungus","keanu","reeves","stonks","not-stonks","diamond-hands","diamondhands","paper-hands","hodl","to-the-moon","tothemoon","moon","mooning","ape","apes","ape-together","tendies","gme","gamestop","wallstreetbets","wsb","yeet","yeeted","yoink","noob","newb","newbie","scrub","pwned","owned","rekt","wrecked","gg","ggwp","ggez","ez","ezpz","no-cap","nocap","cap","capping","fr","frfr","bussin","valid","bet","no-shot","sheesh","sheeesh","ong","ongggg","mid","L-take","W-take","hot-take","cold-take","spicy","spicy-take","rent-free","rentfree","living-rent-free","unhinged","brainrot","brain-rot","vtuber","vtubers","vtubing","hololive","nijisanji","vshoujo","idol","content","content-creator","contentcreator","creator","creators","influencer","influencers","viral","viralvideo","viral-video","trending","fyp","foryou","for-you","foryoupage","algorithm","algo","engagement","analytics","metrics","subscriber","subscribers","subs","sub","follower","followers","following","like","likes","share","shares","repost","reposts","retweet","rt","quote","comment","comments","reply","replies","dm","dms","direct-message","inbox","notification","notifications","notif","notifs","ping","pings","mention","highlight","highlights","clip","clips","vod","vods","archive","archives","premiere","premieres","watchparty","watch-party","reaction","reactions","react","reacting","review","reviews","tier-list","tierlist","ranking","collab","collabs","collaboration","crossover","feature","featured","guest","host","hosting","cohost","co-host","panel","panels","podcast","podcasts","episode","ep","eps","season","seasons","series","miniseries","mini-series","subreddit","subreddits","sub","subs","thread","threads","post","posts","forum","forums","board","boards","chan","chans","4chan","8chan","8kun","imageboard","textboard","bbs","bulletin-board","usenet","newsgroup","irc","ircnet","efnet","freenode","libera","oftc","rizon","undernet","xmpp","jabber","mumble","teamspeak","ts3","ventrilo","vent","raidcall","wiki","wikipedia","wikia","fandom","tvtropes","knowyourmeme","kym","encyclopediadramatica","ed","urban-dictionary","urbandictionary","ud","google","alphabet","apple","microsoft","msft","amazon","meta","facebook","nvidia","nvda","amd","intel","qualcomm","broadcom","samsung","tsmc","oracle","sap","salesforce","adobe","autodesk","vmware","dell","hp","hpe","ibm","cisco","juniper","arista","palo-alto","fortinet","crowdstrike","palantir","snowflake","databricks","mongodb","elastic","splunk","datadog","zoom","webex","teams","meet","slack","atlassian","jira","confluence","notion","airtable","coda","asana","monday","clickup","trello","basecamp","figma","sketch","invision","zeplin","framer","webflow","squarespace","wix","shopify","bigcommerce","magento","woocommerce","stripe","paypal","square","plaid","brex","ramp","affirm","klarna","afterpay","coinbase","binance","robinhood","fidelity","vanguard","schwab","etrade","interactive-brokers","uber","lyft","doordash","grubhub","instacart","postmates","deliveroo","airbnb","vrbo","booking","expedia","kayak","tripadvisor","yelp","spotify","apple-music","pandora","soundcloud","bandcamp","tidal","deezer","dropbox","box","onedrive","gdrive","google-drive","icloud","mega","nintendo","sony","playstation","xbox","microsoft-gaming","activision","blizzard","activision-blizzard","ea","electronic-arts","ubisoft","epic","valve","steam","rockstar","take-two","2k","bethesda","zenimax","id-software","bioware","dice","respawn","bungie","343","naughtydog","insomniac","santa-monica","guerrilla","sucker-punch","bend","bluepoint","housemarque","fromsoftware","from-software","bandainamco","bandai-namco","capcom","konami","sega","atlus","squareenix","square-enix","enix","square","level5","gamefreak","game-freak","creatures","pokemon-company","mihoyo","hoyoverse","riot","riot-games","tencent","netease","nexon","ncsoft","krafton","pubg","supercell","king","rovio","zynga","playtika","scopely","jam-city","paradox","firaxis","amplitude","creative-assembly","relic","obsidian","larian","cd-projekt","cdpr","techland","4a-games","remedy","io-interactive","disney","pixar","marvel","lucasfilm","warner","warnerbros","warner-bros","universal","paramount","sony-pictures","lionsgate","mgm","dreamworks","illumination","laika","ghibli","studio-ghibli","toei","sunrise","bones","madhouse","mappa","wit","trigger","kyoani","kyoto-animation","ufotable","a1-pictures","cloverworks","shaft","gainax","khara","production-ig","ig","netflix","hulu","hbo","max","disney-plus","prime-video","peacock","paramount-plus","apple-tv","crunchyroll","funimation","hidive","vrv","cbs","nbc","abc","fox","cw","amc","fx","showtime","starz","epix","bbc","itv","channel4","sky","britbox","hayu","acorn","curiositystream","discovery","discovery-plus","history","natgeo","nat-geo","animal-planet","tesla","rivian","lucid","nio","xpeng","byd","polestar","fisker","ford","gm","general-motors","chevy","chevrolet","dodge","ram","jeep","chrysler","toyota","honda","nissan","mazda","subaru","mitsubishi","hyundai","kia","genesis","volkswagen","vw","audi","bmw","mercedes","porsche","lamborghini","ferrari","maserati","alfa-romeo","fiat","volvo","land-rover","range-rover","jaguar","bentley","rolls-royce","aston-martin","mclaren","bugatti","koenigsegg","pagani","rimac","lotus","alpine","medical","medicine","healthcare","health-care","hospital","hospitals","doctor","doctors","dr","physician","physicians","surgeon","surgeons","nurse","nurses","nursing","rn","lpn","cna","np","pa","physician-assistant","pharmacy","pharmacist","pharmacists","pharma","pharmaceutical","rx","dentist","dentists","dental","dentistry","orthodontist","orthodontics","optometrist","ophthalmologist","optometry","vision","eye-care","eyecare","therapist","therapists","therapy","counselor","counseling","psychologist","psychiatrist","psychiatry","psychology","mental-health","mentalhealth","physical-therapy","pt","occupational-therapy","ot","speech-therapy","slp","chiropractor","chiropractic","acupuncture","acupuncturist","naturopath","emt","paramedic","paramedics","ems","emergency","er","icu","nicu","radiology","radiologist","xray","mri","ct","ultrasound","imaging","pathology","pathologist","lab","laboratory","diagnostics","testing","oncology","oncologist","cancer","tumor","chemotherapy","radiation","cardiology","cardiologist","heart","cardiac","cardiovascular","cv","neurology","neurologist","neuro","brain","spine","neurosurgery","pediatrics","pediatrician","peds","children","child-health","childhealth","geriatrics","geriatrician","elderly","senior-care","seniorcare","aging","dermatology","dermatologist","derm","skin","skincare","skin-care","orthopedics","orthopedic","ortho","bone","joint","sports-medicine","gastroenterology","gastro","gi","digestive","gut","intestinal","endocrinology","endocrine","diabetes","thyroid","hormone","hormones","pulmonology","pulmonologist","respiratory","lung","lungs","breathing","nephrology","nephrologist","kidney","kidneys","renal","dialysis","urology","urologist","bladder","prostate","urinary","reproductive","obgyn","ob-gyn","obstetrics","gynecology","obstetrician","gynecologist","fertility","ivf","reproductive-health","reproductivehealth","prenatal","legal","lawyer","lawyers","attorney","attorneys","law","laws","lawfirm","paralegal","paralegals","legal-assistant","legalassistant","clerk","clerks","judge","judges","court","courts","courthouse","trial","trials","jury","litigation","litigator","litigators","lawsuit","lawsuits","case","cases","criminal","criminal-law","defense","defender","prosecution","prosecutor","civil","civil-law","tort","torts","injury","personal-injury","malpractice","corporate-law","corporatelaw","business-law","commercial","contracts","intellectual-property","ip","patent","patents","trademark","copyright","family-law","familylaw","divorce","custody","child-support","alimony","immigration","immigration-law","visa","visas","citizenship","naturalization","real-estate-law","property-law","estate","estates","probate","trusts","tax-law","taxlaw","irs","tax-attorney","taxattorney","audit","audits","employment-law","labor-law","hr-law","discrimination","harassment","constitutional","constitutional-law","civil-rights","human-rights","environmental-law","epa","regulation","regulations","compliance","bankruptcy","restructuring","insolvency","creditor","debtor","debt","education","educator","educators","teach","teaching","teacher","teachers","professor","professors","prof","profs","faculty","academic","academics","student","students","pupil","pupils","learner","learners","learning","school","schools","elementary","primary","middle-school","middleschool","high-school","highschool","secondary","k12","k-12","grade","grades","college","colleges","university","universities","uni","campus","campuses","undergraduate","undergrad","graduate","grad","postgrad","phd","doctorate","masters","bachelors","associates","degree","degrees","diploma","diplomas","curriculum","syllabus","course","courses","class","classes","lecture","seminar","seminars","workshop","workshops","lab","labs","laboratory","tutor","tutors","tutoring","mentor","mentors","mentoring","mentorship","homeschool","homeschooling","unschool","unschooling","montessori","waldorf","stem","steam","science","math","mathematics","calculus","algebra","english","literature","writing","grammar","composition","rhetoric","history","geography","social-studies","socialstudies","civics","economics","art","arts","music","drama","theater","theatre","dance","visual-arts","physical-education","pe","gym","athletics","sports","health","wellness","construction","contractor","contractors","builder","builders","building","carpenter","carpenters","carpentry","woodwork","woodworking","woodworker","electrician","electricians","electrical","electric","wiring","power","plumber","plumbers","plumbing","pipes","piping","drainage","sewage","hvac","heating","cooling","ac","air-conditioning","ventilation","duct","roofer","roofers","roofing","roof","roofs","shingles","gutters","mason","masons","masonry","brick","bricks","stone","concrete","cement","painter","painters","painting","paint","wallpaper","drywall","finishing","welder","welders","welding","fabrication","fabricator","metalwork","machinist","machinists","machining","lathe","mill","milling","turning","mechanic","mechanics","mechanical","automotive","auto","car-repair","landscaper","landscapers","landscaping","lawn","garden","gardening","surveyor","surveyors","surveying","survey","land","property","boundary","architect","architects","architecture","architectural","design","drafting","engineer","engineers","engineering","structural","civil-engineering","inspector","inspectors","inspection","code","codes","permit","permits","firefighter","firefighters","fire","fire-department","firedepartment","fd","police","police-officer","policeofficer","cop","cops","officer","officers","sheriff","sheriffs","deputy","deputies","detective","detectives","state-trooper","trooper","troopers","highway-patrol","patrol","patrolling","swat","tactical","k9","k-9","canine","bomb-squad","bombsquad","hostage","emt","emts","paramedic","paramedics","ambulance","ems","first-responder","dispatcher","dispatchers","dispatch","911","emergency","emergencies","search-rescue","sar","rescue","rescuer","rescuers","coast-guard","lifeguard","hazmat","hazardous","decon","decontamination","chemical","biological","military","armed-forces","armedforces","defense","defence","dod","mod","army","soldier","soldiers","infantry","armor","artillery","cavalry","navy","sailor","sailors","naval","fleet","submarine","surface","carrier","airforce","air-force","pilot","pilots","aviator","aviation","fighter","marines","marine","marinecorps","marine-corps","leatherneck","oorah","coastguard","coast-guard","uscg","maritime","port","harbor","border","spaceforce","space-force","ussf","space","satellite","orbital","launch","national-guard","nationalguard","guard","reserve","reserves","reservist","veteran","veterans","vet","vets","retired","retiree","retirees","officer","officers","enlisted","nco","warrant","general","admiral","special-ops","specialops","specops","sof","delta","seals","rangers","green-berets","greenberets","airborne","paratrooper","paratroopers","outdoor","outdoors","outside","nature","wilderness","wild","backcountry","hiking","hiker","hikers","backpacking","backpacker","thru-hike","thruhike","camping","camper","campers","campsite","tent","tenting","glamping","rv","rving","campervan","vanlife","van-life","overlanding","overland","fishing","fisher","fishers","angler","anglers","angling","fly-fishing","hunting","hunter","hunters","hunt","game","wildlife","deer","elk","duck","birding","birdwatching","bird-watching","birder","birders","ornithology","foraging","forager","foragers","mushroom","mushrooms","fungi","mycology","kayaking","kayak","kayaker","kayakers","canoeing","canoe","paddling","rafting","raft","rafts","whitewater","white-water","rapids","river","scuba","diving","diver","divers","snorkeling","snorkel","freediving","sailing","sailor","sailors","sail","sailboat","yacht","yachting","rock-climbing","rockclimbing","bouldering","climber","climbers","crag","mountaineering","mountaineer","alpinism","alpine","summit","peak-bagging","caving","caver","cavers","spelunking","spelunker","cave","caves","offroad","off-road","atv","utv","sxs","dirtbike","dirt-bike","quad","photography","photographer","photographers","photo","photos","camera","videography","videographer","video","videos","filming","filmmaking","painting","painter","painters","canvas","acrylic","oil","watercolor","drawing","drawer","drawers","sketch","sketching","pencil","charcoal","sculpting","sculptor","sculptors","sculpture","clay","pottery","ceramics","knitting","knitter","knitters","knit","yarn","wool","needles","pattern","crocheting","crochet","crocheter","hook","hooks","amigurumi","blanket","sewing","sewer","sewers","seamstress","tailor","fabric","quilting","embroidery","embroiderer","cross-stitch","crossstitch","needlepoint","woodworking","woodworker","woodworkers","carpentry","furniture","lathe","metalworking","metalworker","blacksmith","blacksmithing","forge","forging","leatherworking","leatherwork","leather","leathercraft","tanning","tooling","jewelry-making","jewelrymaking","jeweler","beading","beads","wirework","origami","paper-craft","papercraft","scrapbooking","scrapbook","cardmaking","calligraphy","calligrapher","lettering","hand-lettering","handlettering","candle-making","candlemaking","soap-making","soapmaking","bath-bombs","collecting","collector","collectors","collection","collections","collectible","stamps","stamp","philately","philatelist","postage","postal","letters","coins","coin","numismatics","numismatist","currency","bullion","precious","cards","card","trading-cards","tradingcards","tcg","ccg","mtg","pokemon-tcg","comics","comic","comic-books","comicbooks","graphic-novels","graphicnovels","manga","manhwa","manhua","webtoon","webtoons","light-novel","lightnovel","figurines","figure","figures","statue","statues","action-figures","toys","funko","funko-pop","funkopop","pop","pops","nendoroid","figma","sh-figuarts","model-kits","modelkits","gunpla","gundam","plamo","scale-models","miniatures","lego","legos","bricks","moc","mocs","afol","tfol","kfol","megabloks","antiques","antique","vintage","retro","thrift","thrifting","estate-sale","vinyl","records","record","lp","lps","turntable","audiophile","hifi","watches","watch","horology","horologist","timepiece","wristwatch","pocket","boardgame","boardgames","board-games","board-game","tabletop","table-top","cardgame","cardgames","card-games","card-game","deckbuilder","deck-builder","rpg","rpgs","tabletop-rpg","ttrpg","pen-and-paper","roleplay","roleplaying","dnd","d-and-d","dungeons-and-dragons","dungeonsanddragons","dungeon","dragon","pathfinder","starfinder","call-of-cthulhu","coc","shadowrun","cyberpunk-red","warhammer","warhammer40k","40k","age-of-sigmar","aos","sigmar","gw","warmachine","hordes","infinity","malifaux","necromunda","kill-team","killteam","miniature","miniatures","minis","mini","wargaming","wargames","wargamer","painting-minis","paintingminis","mini-painting","minipainting","terrain","chess","checkers","go","baduk","weiqi","shogi","mahjong","mah-jong","poker","blackjack","bridge","canasta","rummy","hearts","spades","solitaire","catan","settlers","ticket-to-ride","tickettoride","pandemic","wingspan","gloomhaven","spirit-island","spiritisland","terraforming-mars","scythe","pets","pet","petcare","pet-care","petowner","pet-owner","petparents","dogs","dog","puppy","puppies","pupper","doggo","doggos","canine","k9","cats","cat","kitten","kittens","kitty","kitties","feline","meow","birds","bird","parrot","parrots","parakeet","budgie","cockatiel","finch","fish","aquarium","aquariums","fishtank","fish-tank","freshwater","saltwater","reef","reeftank","reef-tank","coral","corals","marine","aquascape","reptiles","reptile","snake","snakes","lizard","lizards","gecko","bearded","turtle","turtles","tortoise","tortoises","terrapin","amphibian","frog","rabbit","rabbits","bunny","bunnies","hare","lagomorph","binky","binkies","hamster","hamsters","gerbil","gerbils","mouse","mice","rat","rats","guinea-pig","guineapig","guinea","cavy","cavies","chinchilla","ferret","horse","horses","equine","equestrian","pony","ponies","riding","stable","farm","farming","farmlife","farm-life","livestock","chicken","chickens","goat","goats","sheep","lamb","lambs","pig","pigs","cow","cows","cattle","english","spanish","espanol","french","francais","german","deutsch","italian","italiano","portuguese","portugues","russian","russkiy","japanese","nihongo","chinese","mandarin","cantonese","zhongwen","korean","hangul","hangugeo","arabic","hindi","urdu","bengali","turkish","turkce","persian","farsi","dutch","nederlands","polish","swedish","svenska","norwegian","norsk","danish","dansk","finnish","greek","ellinika","hebrew","ivrit","vietnamese","tiengviet","thai","indonesian","bahasa","malay","tagalog","filipino","swahili","kiswahili","czech","cestina","hungarian","magyar","romanian","romana","ukrainian","usa","united-states","unitedstates","america","american","americans","canada","canadian","canadians","mexico","mexican","mexicans","brasil","brazil","brazilian","argentina","argentine","chile","chilean","peru","colombia","colombian","venezuela","venezuelan","ecuador","uruguay","uk","united-kingdom","unitedkingdom","britain","british","england","scotland","scottish","wales","welsh","ireland","irish","northern-ireland","france","french","germany","german","germans","italy","italian","italians","spain","spanish","portugal","portuguese","netherlands","dutch","belgium","switzerland","swiss","austria","austrian","poland","polish","czech","russia","russian","russians","ukraine","ukrainian","ukrainians","belarus","china","chinese","taiwan","taiwanese","hongkong","hong-kong","macau","japan","japanese","korea","korean","koreans","north-korea","south-korea","india","indian","indians","pakistan","pakistani","bangladesh","bangladeshi","australia","australian","australians","aussie","aussies","nz","newzealand","new-zealand","kiwi","kiwis","fiji","fijian","samoa","samoan","tonga","philippines","filipino","filipinos","pinoy","pinay","vietnam","vietnamese","thailand","thai","thais","indonesia","indonesian","malaysia","malaysian","singapore","singaporean","brunei","myanmar","burmese","cambodia","cambodian","laos","laotian","nepal","nepali","srilanka","sri-lanka","srilankan","egypt","egyptian","egyptians","morocco","moroccan","algeria","algerian","tunisia","tunisian","libya","libyan","sudan","sudanese","ethiopia","kenya","kenyan","kenyans","tanzania","tanzanian","uganda","ugandan","nigeria","nigerian","nigerians","ghana","ghanaian","senegal","senegalese","southafrica","south-africa","southafrican","south-african","namibia","botswana","zimbabwe","zambia","mozambique","angola","congo","congolese","israel","israeli","israelis","palestine","palestinian","palestinians","jordan","jordanian","lebanon","lebanese","syria","syrian","iraq","iraqi","iran","iranian","iranians","persian","persians","saudi","saudi-arabia","uae","emirates","emirati","dubai","abudhabi","abu-dhabi","qatar","qatari","kuwait","kuwaiti","bahrain","bahraini","oman","omani","yemen","yemeni","turkey","turkish","turks","greece","greek","greeks","cyprus","cypriot","scandinavia","scandinavian","nordic","norway","norwegian","sweden","swedish","denmark","danish","finland","finnish","finns","iceland","icelandic","baltics","baltic","estonia","estonian","latvia","latvian","lithuania","balkans","balkan","serbia","serbian","croatia","croatian","bosnia","slovenia","slovenian","macedonia","macedonian","albania","albanian","romania","romanian","bulgaria","bulgarian","hungary","hungarian","slovakia","slovak","slovakian","moldova","moldovan","georgia","georgian","armenia","armenian","azerbaijan","azerbaijani","kazakhstan","kazakh","uzbekistan","uzbek","turkmenistan","kyrgyzstan","tajikistan","mongolia","caribbean","jamaica","jamaican","bahamas","bahamian","barbados","trinidad","cuba","cuban","haiti","haitian","dominican","puerto-rico","puertorico","latin","latino","latina","latinx","hispanic","latinoamerica","latam","california","cali","ca","socal","norcal","bayarea","bay-area","la","texas","tx","houston","dallas","austin","sanantonio","san-antonio","florida","fl","miami","orlando","tampa","jacksonville","fortlauderdale","newyork","new-york","ny","nyc","brooklyn","manhattan","queens","bronx","pennsylvania","pa","philly","philadelphia","pittsburgh","harrisburg","illinois","il","chicago","chi","chiraq","chitown","springfield","ohio","oh","cleveland","columbus","cincinnati","toledo","akron","georgia","ga","atlanta","atl","savannah","augusta","macon","northcarolina","north-carolina","nc","charlotte","raleigh","durham","southcarolina","south-carolina","sc","charleston","columbia","greenville","michigan","mi","detroit","annarbor","ann-arbor","grandrapids","lansing","newjersey","new-jersey","nj","jersey","newark","trenton","atlantic-city","virginia","va","richmond","norfolk","vb","virginia-beach","alexandria","washington","wa","seattle","tacoma","spokane","olympia","bellevue","arizona","az","phoenix","phx","tucson","scottsdale","mesa","tempe","massachusetts","ma","boston","cambridge","worcester","springfield","tennessee","tn","nashville","memphis","knoxville","chattanooga","indiana","in","indianapolis","indy","fortwayne","fort-wayne","southbend","missouri","mo","stlouis","st-louis","kansascity","kansas-city","springfield","maryland","md","baltimore","bmore","annapolis","bethesda","rockville","wisconsin","wi","milwaukee","madison","greenbay","green-bay","kenosha","colorado","co","denver","boulder","coloradosprings","colorado-springs","minnesota","mn","minneapolis","stpaul","st-paul","twincities","twin-cities","alabama","al","birmingham","montgomery","mobile","huntsville","tuscaloosa","louisiana","la","neworleans","new-orleans","nola","batonrouge","baton-rouge","kentucky","ky","louisville","lexington","bowling-green","frankfort","oregon","or","portland","pdx","eugene","salem","bend","medford","oklahoma","ok","okc","oklahomacity","oklahoma-city","tulsa","norman","connecticut","ct","hartford","newhaven","new-haven","stamford","bridgeport","utah","ut","saltlakecity","salt-lake-city","slc","provo","ogden","iowa","ia","desmoines","des-moines","cedarrapids","cedar-rapids","davenport","nevada","nv","lasvegas","las-vegas","vegas","reno","henderson","sparks","arkansas","ar","littlerock","little-rock","fayetteville","fortsmith","mississippi","ms","jackson","gulfport","biloxi","hattiesburg","southaven","kansas","ks","wichita","overlandpark","overland-park","kansascity","topeka","newmexico","new-mexico","nm","albuquerque","santafe","santa-fe","lascruces","nebraska","ne","omaha","lincoln","bellevue","grandisland","grand-island","idaho","id","boise","meridian","nampa","idahofalls","idaho-falls","pocatello","westvirginia","west-virginia","wv","charleston","huntington","morgantown","hawaii","hi","honolulu","maui","oahu","kauai","bigisland","big-island","newhampshire","new-hampshire","nh","manchester","nashua","concord","portsmouth","maine","me","portland","lewiston","bangor","auburn","augusta","rhodeisland","rhode-island","ri","providence","warwick","cranston","newport","montana","mt","billings","missoula","greatfalls","great-falls","bozeman","delaware","de","wilmington","dover","newark","middletown","smyrna","southdakota","south-dakota","sd","siouxfalls","sioux-falls","rapidcity","northdakota","north-dakota","nd","fargo","bismarck","grandforks","grand-forks","alaska","ak","anchorage","fairbanks","juneau","sitka","ketchikan","vermont","vt","burlington","essex","rutland","colchester","bennington","wyoming","wy","cheyenne","casper","laramie","gillette","rocksprings","dc","washingtondc","washington-dc","dmv","nova","northern-virginia","puertorico","puerto-rico","pr","sanjuan","san-juan","bayamon","carolina","midwest","midwestern","northeast","northeastern","southeast","southeastern","southwest","southwestern","northwest","northwestern","pacificnorthwest","pnw","newengland","new-england","deepouth","deep-south","sunbelt","sun-belt","rustbelt","rust-belt","biblebelt","bible-belt","cornbelt","corn-belt"];async function zy(e){const t=function(e){let t=e.startsWith("#")?e.slice(1):e;return t=t.toLowerCase().replace(/[^a-z0-9-]/g,""),t=t.replace(/-+/g,"-"),t=t.replace(/^-+|-+$/g,""),t}(e);if(!t)throw new Error(`Invalid channel name: "${e}" filters to empty string`);const n=`#${t}`,a=(new TextEncoder).encode(n),s=(await yy(a)).slice(0,16),r=(await yy(s))[0],o=new Uint8Array(32);return o.set(s),{name:`#${t}`,channelHash:r,aesKey:s,hmacKey:o,autoDiscovered:!0}}let _y=null,Iy=null;const Vy=new Map;let Oy=null;const $y="pymc_discovered_channels";function qy(e){Vy.set(e.channelHash,e),e.autoDiscovered&&function(){try{const e=[];for(const t of Vy.values())t.autoDiscovered&&e.push({name:t.name,hash:t.channelHash});localStorage.setItem($y,JSON.stringify(e))}catch(e){}}()}async function Uy(){_y||(Iy||(Iy=(async()=>{await async function(){try{const e=localStorage.getItem($y);if(!e)return;const t=JSON.parse(e);for(const{name:n}of t)try{const e=await zy(n);Vy.set(e.channelHash,e)}catch{}t.length}catch(e){}}();const e=await async function(){const{default:e}=await k(async()=>{const{default:e}=await import("./generated-geo-channels-CkSMgZLG.js");return{default:e}},[]);return[...Ny,...e]}(),t=new Map;for(const n of e)try{const e=await zy(n),a=t.get(e.channelHash)||[];a.push(e),t.set(e.channelHash,a)}catch{}_y=t})()),await Iy)}async function Wy(e,t,n){const a=await async function(e,t){if(dy())try{const n=new ArrayBuffer(e.length);new Uint8Array(n).set(e);const a=new ArrayBuffer(t.length);new Uint8Array(a).set(t);const s=await crypto.subtle.importKey("raw",n,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),r=await crypto.subtle.sign("HMAC",s,a);return new Uint8Array(r)}catch{}return async function(e,t){const n=64;let a;e.length>n?(a=new Uint8Array(n),a.set(fy(e))):(a=new Uint8Array(n),a.set(e));const s=new Uint8Array(n),r=new Uint8Array(n);for(let c=0;c=2024&&n<=2030;if(!a)return{valid:!1,confidence:"low"};const s=e.slice(5);if(0===s.length)return{valid:!1,confidence:"low"};let r=0,o=!1;for(let l=0;l=32&&e<=126||0===e||10===e||13===e||9===e)&&r++,58===e&&(o=!0)}const i=r/s.length;return i>=.85&&o&&a?{valid:!0,confidence:"high"}:i>=.7&&a?{valid:!0,confidence:"medium"}:{valid:!1,confidence:"low"}}async function Yy(e,t,n){await Uy();const a=await async function(){return Oy||(Oy=await async function(e,t=!1){const n=oy(e.secret),a=(await yy(n))[0],s=new Uint8Array(32);return s.set(n.slice(0,32)),{name:e.name,channelHash:a,aesKey:s.slice(0,16),hmacKey:s,autoDiscovered:t}}(Ry)),Oy}();if(a.channelHash===e&&await Wy(a.hmacKey,t,n))return{channelName:"Public",plaintext:By(a.aesKey,n),keys:a};const s=Vy.get(e);if(s&&await Wy(s.hmacKey,t,n)){const e=By(s.aesKey,n);return{channelName:s.name,plaintext:e,keys:s}}const r=(null==_y?void 0:_y.get(e))||[],o=[];for(const l of r){if(await Wy(l.hmacKey,t,n)){qy(l);const e=By(l.aesKey,n);return{channelName:l.name,plaintext:e,keys:l}}o.push(l)}let i=null;for(const l of o)try{const e=By(l.aesKey,n),t=Hy(e);if(t.valid){if("high"===t.confidence)return{channelName:l.name,plaintext:e,keys:l,macCorrupted:!0};"medium"!==t.confidence||i||(i={keys:l,plaintext:e,confidence:"medium"})}}catch{}return i?{channelName:i.keys.name,plaintext:i.plaintext,keys:i.keys,macCorrupted:!0}:null}async function Gy(e){return await Uy(),((null==_y?void 0:_y.get(e))||[]).map(e=>e.name)}async function Ky(e,t,n,a){try{const s=await zy(e);if(s.channelHash!==t)return{success:!1,error:`Hash mismatch: "${e}" has hash 0x${s.channelHash.toString(16).toUpperCase().padStart(2,"0")}, packet has 0x${t.toString(16).toUpperCase().padStart(2,"0")}`};if(!(await Wy(s.hmacKey,n,a)))return{success:!1,error:"MAC verification failed - wrong channel name or corrupted data"};const r=By(s.aesKey,a);return qy(s),{success:!0,result:{channelName:s.name,plaintext:r,keys:s}}}catch(s){return{success:!1,error:`Error: ${s instanceof Error?s.message:String(s)}`}}}let Xy=null,Jy=[];function Zy(e){return{decoded:e.success?{type:"grp_txt",channelHash:e.channelHash,channelName:e.channelName,text:e.text??"",decrypted:!0,senderName:e.senderName,timestamp:e.timestamp,flags:e.flags,macCorrupted:e.macCorrupted,isPublicHashChannel:!0}:null,timestamp:e.packetTimestamp,rssi:e.rssi,snr:e.snr}}const Qy=A((e,t)=>{let n=!1;return{messages:new Map,stableMessages:new Map,lastSnapshotUpdate:0,processing:new Set,progress:{total:0,processed:0,percent:0,isDecoding:!1},initialDecodeComplete:!1,queueDecryption:async(a,s)=>{const{messages:r,processing:o}=t(),i=(null==s?void 0:s.quickMode)??!1;let l=a.filter(e=>(e.type??e.payload_type)===Vf.GRP_TXT&&e.raw_packet&&!r.has(e.packet_hash)&&!o.has(e.packet_hash));if(0===l.length)return;if(i&&l.length>100&&(l=l.sort((e,t)=>(t.timestamp??0)-(e.timestamp??0)).slice(0,100)),n){const e=new Set(Jy.map(e=>e.packet_hash)),t=l.filter(t=>!e.has(t.packet_hash));return void(t.length>0&&Jy.push(...t))}n=!0;const c=new Set(l.map(e=>e.packet_hash));e(e=>({processing:new Set([...e.processing,...c]),progress:{total:l.length,processed:0,percent:0,isDecoding:!0}}));try{const{totalCount:n}=await ff.decrypt(l,{onProgress:(t,n)=>{e({progress:{total:n,processed:t,percent:Math.round(t/n*100),isDecoding:!0}})},onResults:n=>{const{messages:a}=t();for(const e of n)a.set(e.packetHash,Zy(e));e({messages:a}),Xy&&clearTimeout(Xy),Xy=setTimeout(()=>{e({stableMessages:new Map(t().messages),lastSnapshotUpdate:Date.now()})},500)}});Xy&&(clearTimeout(Xy),Xy=null);const a=t().messages;if(a.size>5e4){const e=Array.from(a.entries()).sort((e,t)=>e[1].timestamp-t[1].timestamp).slice(0,a.size-5e4);for(const[t]of e)a.delete(t)}if(e({messages:a,stableMessages:new Map(a),lastSnapshotUpdate:Date.now(),processing:new Set,initialDecodeComplete:!0,progress:{total:n,processed:n,percent:100,isDecoding:!1}}),Jy.length>0){const e=Jy;Jy=[],setTimeout(()=>{t().queueDecryption(e)},50)}}catch(u){e({processing:new Set,progress:{total:0,processed:0,percent:0,isDecoding:!1}})}finally{n=!1}},queueChannelDecryption:async(a,s)=>{const{messages:r,processing:o}=t(),i=await async function(e){const t=await async function(e){return zy(e.startsWith("#")?e.slice(1):e)}(e);return{name:t.name,channelHash:t.channelHash,aesKeyHex:iy(t.aesKey),hmacKeyHex:iy(t.hmacKey)}}(s),l=a.filter(e=>{if((e.type??e.payload_type)!==Vf.GRP_TXT||!e.raw_packet)return!1;if(r.has(e.packet_hash)||o.has(e.packet_hash))return!1;const t=e.raw_packet;if(t.length<4)return!1;const n=3&parseInt(t.slice(0,2),16);let a=2;return 0!==n&&3!==n||(a=10),a+=2+2*parseInt(t.slice(a,a+2),16),parseInt(t.slice(a,a+2),16)===i.channelHash});if(0===l.length)return;if(n)return;n=!0;const c=new Set(l.map(e=>e.packet_hash));e(e=>({processing:new Set([...e.processing,...c]),progress:{total:l.length,processed:0,percent:0,isDecoding:!0}}));try{const{totalCount:n}=await ff.decrypt(l,{knownKey:i,onProgress:(t,n)=>{e({progress:{total:n,processed:t,percent:Math.round(t/n*100),isDecoding:!0}})},onResults:n=>{const{messages:a}=t();for(const e of n)a.set(e.packetHash,Zy(e));e({messages:a}),Xy&&clearTimeout(Xy),Xy=setTimeout(()=>{e({stableMessages:new Map(t().messages),lastSnapshotUpdate:Date.now()})},500)}});Xy&&(clearTimeout(Xy),Xy=null),e({stableMessages:new Map(t().messages),lastSnapshotUpdate:Date.now(),processing:new Set,progress:{total:n,processed:n,percent:100,isDecoding:!1}})}catch(u){e({processing:new Set,progress:{total:0,processed:0,percent:0,isDecoding:!1}})}finally{n=!1}},getMessage:e=>t().messages.get(e),getSuccessfulMessages:()=>{var e;const{messages:n}=t(),a=[];for(const t of n.values())(null==(e=t.decoded)?void 0:e.decrypted)&&!t.decoded.macCorrupted&&a.push(t);return a.sort((e,t)=>e.timestamp-t.timestamp)},clear:()=>{Xy&&(clearTimeout(Xy),Xy=null),e({messages:new Map,stableMessages:new Map,lastSnapshotUpdate:0,processing:new Set,progress:{total:0,processed:0,percent:0,isDecoding:!1},initialDecodeComplete:!1})}}});function eb(e){return Qy(t=>t.messages.get(e))}function tb(){return Qy(e=>e.progress)}function nb(){return Qy(e=>e.initialDecodeComplete)}function ab(){return Qy(e=>e.stableMessages)}function sb(){return Qy(e=>e.stableMessages)}const rb=[{label:"20m",minutes:20,buckets:80},{label:"1h",minutes:60,buckets:80},{label:"3h",minutes:180,buckets:80},{label:"12h",minutes:720,buckets:80},{label:"24h",minutes:1440,buckets:80},{label:"3d",minutes:4320,buckets:80},{label:"7d",minutes:10080,buckets:80},{label:"14d",minutes:20160,buckets:80},{label:"21d",minutes:30240,buckets:80},{label:"30d",minutes:43200,buckets:80},{label:"90d",minutes:129600,buckets:80}],ob=[{label:"1h",hours:1},{label:"3h",hours:3},{label:"12h",hours:12},{label:"24h",hours:24},{label:"3d",hours:72},{label:"7d",hours:168},{label:"14d",hours:336},{label:"21d",hours:504},{label:"30d",hours:720},{label:"90d",hours:2160}];function ib(e,t=12){return Math.max(t,Math.round(e/15))}const lb={hero:ib(1200),statsCard:ib(380)};function cb(e){switch(e){case 1:return 3600;case 3:case 12:return 5400;case 24:return 8640;case 72:case 168:case 336:case 504:case 720:case 2160:return 720;default:{const t=3600*e,n=Math.round(t/10);return Math.min(Math.max(360,n),720)}}}const ub="'JetBrains Mono', 'SF Mono', Monaco, monospace",db={stats:3e3,logs:2e3,system:3e3},hb={DEBUG:"text-sys-orange",INFO:"text-sys-cyan",WARNING:"text-sys-amber",ERROR:"text-sys-red",CRITICAL:"text-sys-pink"};function mb(e){return hb[e]??"text-fg-muted border-edge-subtle"}function pb(e){return e?(e.startsWith("0x")?e.slice(2):e).slice(0,2).toUpperCase():""}function gb(e,t){if(!e)return"expired";const n=t/1e3-e;return n<=10800?"active":n<=86400?"stale":"expired"}function fb(e,t,n=Date.now()){if(!e)return[];const a=Object.keys(e);if(0===a.length)return[];const s=[];for(let r=0;rt.count!==e.count?t.count-e.count:t.lastSeen-e.lastSeen),s}const yb={critical:0,high:150,medium:300,low:450};let bb=!1;const vb=[],wb=new Set;function Cb(e,t="medium"){if(bb){const n=setTimeout(()=>{e(),wb.delete(n)},yb[t]);return wb.add(n),()=>{clearTimeout(n),wb.delete(n)}}{const n={callback:e,priority:t};return vb.push(n),()=>{const e=vb.indexOf(n);-1!==e&&vb.splice(e,1)}}}function kb(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2,4).toUpperCase():e.slice(0,2).toUpperCase()}function xb(e,t){let n=e.forwarded_path??e.original_path;if("string"==typeof n)try{n=JSON.parse(n)}catch{return null}if(!n||!Array.isArray(n)||0===n.length)return null;const a=n.map(e=>String(e).toUpperCase()),s=t?kb(t):null,r=a[a.length-1],o=null!==s&&r===s,i=o?a.slice(0,-1):[...a];return{effective:i,original:a,hadLocal:o,effectiveLength:i.length}}function Db(e,t){let n=e;if("string"==typeof n)try{n=JSON.parse(n)}catch{return null}if(!n||!Array.isArray(n)||0===n.length)return null;const a=n.map(e=>String(e).toUpperCase()),s=t?kb(t):null,r=a[a.length-1],o=null!==s&&r===s,i=o?a.slice(0,-1):[...a];return{effective:i,original:a,hadLocal:o,effectiveLength:i.length}}function Ab(e,t){const n=e.toUpperCase();return t.startsWith("0x")||t.startsWith("0X")?t.slice(2).toUpperCase().startsWith(n):t.toUpperCase().startsWith(n)}function Eb(e){return 4===(e.type??e.payload_type)&&!0!==e.transmitted&&function(e){const t=function(e){if(Array.isArray(e))return e;if("string"==typeof e&&e.startsWith("["))try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}return[]}(e.original_path),n=e.route??e.route_type;return 2===(a=n)||3===a?0===t.length:Es(n)?t.length<=1:0===t.length;var a}(e)}function Bb(e,t,n,a){if(!e)return null;let s=e;if(e.length<=4){const a=e.replace(/^0x/i,"").toUpperCase();if(a===t)return null;const r=n.get(a);if(!r)return null;s=r}return a.has(s)?kb(s)===t?null:s:null}function Fb(e,t){e.count++,void 0!==t.rssi&&null!==t.rssi&&(e.rssiSum+=t.rssi,e.rssiCount++),void 0!==t.snr&&null!==t.snr&&(e.snrSum+=t.snr,e.snrCount++);const n=t.timestamp??0;n>e.lastSeen&&(e.lastSeen=n)}function Sb(e){return{hash:e,count:0,rssiSum:0,rssiCount:0,snrSum:0,snrCount:0,lastSeen:0}}function Mb(e,t){const n=function(e,t){const n=t-1e3*e;return n<=6048e5?"active":n<=12096e5?"stale":"expired"}(e.lastSeen,t);return"expired"===n?null:{hash:e.hash,prefix:kb(e.hash),count:e.count,avgRssi:e.rssiCount>0?e.rssiSum/e.rssiCount:null,avgSnr:e.snrCount>0?e.snrSum/e.snrCount:null,lastSeen:e.lastSeen,status:n}}const jb="pymc-hidden-contacts",Tb="pymc-quick-neighbors",Pb="pymc-local-hash",Lb="pymc-global-time-range";let Rb=null;function Nb(){if("undefined"==typeof window)return[];try{const e=localStorage.getItem(Tb);if(e)return JSON.parse(e)}catch{}return[]}function zb(e){"undefined"!=typeof window&&(Rb&&clearTimeout(Rb),Rb=setTimeout(()=>{try{localStorage.setItem(Tb,JSON.stringify(e))}catch{}Rb=null},1e3))}function _b(){if("undefined"!=typeof window)try{const e=localStorage.getItem(Pb);if(e)return e}catch{}}function Ib(e){if("undefined"!=typeof window)try{localStorage.setItem(Pb,e)}catch{}}function Vb(){if("undefined"==typeof window)return new Set;try{const e=localStorage.getItem(jb);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function Ob(){if("undefined"==typeof window)return 4;try{const e=localStorage.getItem(Lb);if(e){const t=parseInt(e,10);if(!isNaN(t)&&t>=0&&t<=10)return t>4?4:t}}catch{}return 4}const $b=A((e,t)=>({stats:null,statsLoading:!1,statsError:null,packets:Gg.getPackets(),packetsLoading:!1,packetsError:null,lastPacketTimestamp:Gg.getNewestTimestamp(),logs:[],logsLoading:!1,liveMode:!0,flashReceived:0,flashAdvert:0,pendingAdvertLocalHash:null,pendingAdvertTimestamp:null,resourceHistory:[],lastResourceFetch:0,hardwareStats:null,hardwareStatsLoading:!1,hardwareStatsError:null,hiddenContacts:Vb(),quickNeighbors:Nb(),cachedLocalHash:_b(),initialized:!1,packetCacheState:Gg.getState(),mutationsInFlight:new Set,globalTimeRangeIndex:Ob(),initializeApp:async()=>{const{initialized:n}=t();if(n)return;e({initialized:!0,statsLoading:!0,packetsLoading:!0}),Gg.subscribe(t=>{e({packetCacheState:t})});const{hiddenContacts:a}=t();let s=0;yg().then(t=>{const n=fb(t.neighbors,a),s=t.local_hash;e({stats:t,statsLoading:!1,quickNeighbors:n,cachedLocalHash:s}),zb(n),s&&Ib(s)}).catch(t=>{e({statsError:t instanceof Error?t.message:"Failed to fetch stats",statsLoading:!1})}),Gg.initialLoad(()=>{const t=Date.now();if(t-s>=50){s=t;const n=Gg.getPackets();if(n.length>0){const t=Gg.getNewestTimestamp();e({packets:n,lastPacketTimestamp:t})}}}).then(n=>{if(n.length>0){const a=Gg.getNewestTimestamp();e({packets:n,packetsLoading:!1,lastPacketTimestamp:a});const s=(e,t)=>{"requestIdleCallback"in window?requestIdleCallback(()=>e(),{timeout:t}):setTimeout(e,100)};s(()=>t().triggerTopologyCompute(),2e3),s(()=>t().triggerSparklineCompute(),1e3),setTimeout(()=>function(){if(!bb){bb=!0;for(const e of vb){const t=yb[e.priority],n=setTimeout(()=>{e.callback(),wb.delete(n)},t);wb.add(n)}vb.length=0}}(),16),setTimeout(()=>{Qy.getState().queueDecryption(n,{quickMode:!0})},500)}else e({packetsLoading:!1})}).catch(t=>{e({packetsError:t instanceof Error?t.message:"Failed to load packets",packetsLoading:!1})}),ef.getState().initialize(),Qg.onPacket(n=>{const{lastPacketTimestamp:a,mutationsInFlight:s}=t();if(s.size>0)return;Gg.mergePacketsDirectly([n]);const r=n.timestamp??0;if(r>a){const n=Gg.getPackets();e({packets:n,flashReceived:t().flashReceived+1,lastPacketTimestamp:r}),Cg()}Qy.getState().queueDecryption([n])}),Qg.onStats(n=>{const{mutationsInFlight:a,hiddenContacts:s}=t();if(a.size>0)return;const r=fb(n.neighbors,s),o=n.local_hash;e({stats:n,statsLoading:!1,statsError:null,quickNeighbors:r,cachedLocalHash:o}),zb(r),o&&Ib(o)}),Qg.onPacketStats(n=>{const{stats:a,mutationsInFlight:s}=t();if(!a||s.size>0)return;const r={...a,rx_count:n.rx_count??a.rx_count,tx_count:n.tx_count??a.tx_count,forwarded_count:n.forwarded_count??a.forwarded_count,dropped_count:n.dropped_count??a.dropped_count};e({stats:r})}),function(e){if(setInterval(()=>{Gg.isHeavyLoadInProgress()||e().mutationsInFlight.size>0||e().fetchStats().then(()=>{pf.getState().updateRestHealth(!0)}).catch(()=>{pf.getState().updateRestHealth(!1)})},db.stats),function t(){const n=Qg.isConnected()?15e3:3e3;setTimeout(async()=>{e().liveMode&&!Gg.isHeavyLoadInProgress()&&await e().fetchPackets(),t()},n)}(),"undefined"!=typeof document){let t=Date.now();const n=3e5;document.addEventListener("visibilitychange",async()=>{document.hidden?t=Date.now():(Date.now()-t>n&&(Qg.resetSupported(),Qg.isConnected()?await Qg.verifyConnection(3e3)||(Qg.disconnect(),Qg.connect()):Qg.isSupported()&&Qg.connect()),e().fetchStats({force:!0}),e().fetchPackets())})}}(t),t().fetchHardwareStats(),setInterval(()=>{"undefined"!=typeof document&&document.hidden||t().fetchHardwareStats()},db.system)},prefetchForRoute:e=>{switch(e){case"/logs":bg().catch(()=>{});break;case"/system":Ag().catch(()=>{});break;case"/statistics":(async function(e=24){return hg(`/api/packet_type_graph_data?hours=${e}`)})(3).catch(()=>{}),vg(3).catch(()=>{});break;case"/settings":(async function(){return hg("/api/radio_presets")})().catch(()=>{})}},fetchStats:async n=>{const{stats:a,mutationsInFlight:s,hiddenContacts:r}=t();if(!(s.size>0)||(null==n?void 0:n.force)){a||e({statsLoading:!0}),e({statsError:null});try{const t=await yg(),n=fb(t.neighbors,r),a=t.local_hash;e({stats:t,statsLoading:!1,quickNeighbors:n,cachedLocalHash:a}),zb(n),a&&Ib(a)}catch(o){e({statsError:o instanceof Error?o.message:"Failed to fetch stats",statsLoading:!1})}}},fetchPackets:async n=>{const{packets:a,lastPacketTimestamp:s}=t();0===a.length&&e({packetsLoading:!0}),e({packetsError:null});try{const n=await Gg.poll(),r=Gg.getNewestTimestamp(),o=r>s&&s>0,i=n.length!==a.length||o;o&&(e({flashReceived:t().flashReceived+1}),Cg()),i?(e({packets:n,packetsLoading:!1,lastPacketTimestamp:r||s}),Qy.getState().queueDecryption(n)):e({packetsLoading:!1})}catch(r){e({packetsError:r instanceof Error?r.message:"Failed to fetch packets",packetsLoading:!1})}},fetchLogs:async()=>{const{logs:n}=t();0===n.length&&e({logsLoading:!0});try{const t=await bg();e({logs:t.logs,logsLoading:!1})}catch{e({logsLoading:!1})}},setLiveMode:t=>{e({liveMode:t})},setMode:async n=>{const a="setMode",{mutationsInFlight:s}=t(),r=new Set(s);r.add(a),e({mutationsInFlight:r});try{if(!(await Sg(n)).success)throw new Error("Backend returned unsuccessful response");await t().fetchStats({force:!0})}catch(o){const{mutationsInFlight:n}=t(),s=new Set(n);throw s.delete(a),e({mutationsInFlight:s}),o}},clearModeMutation:()=>{const{mutationsInFlight:n}=t(),a=new Set(n);a.delete("setMode"),e({mutationsInFlight:a})},setDutyCycle:async n=>{const a="setDutyCycle",{mutationsInFlight:s}=t(),r=new Set(s);r.add(a),e({mutationsInFlight:r});try{if(!(await Mg(n)).success)throw new Error("Backend returned unsuccessful response");await t().fetchStats({force:!0})}finally{const{mutationsInFlight:n}=t(),s=new Set(n);s.delete(a),e({mutationsInFlight:s})}},setDutyCycleConfig:async n=>{var a;const s="setDutyCycleConfig",{mutationsInFlight:r}=t(),o=new Set(r);o.add(s),e({mutationsInFlight:o});try{const e=await async function(e){return hg("/api/update_duty_cycle_config",{method:"POST",body:JSON.stringify(e)})}(n);if(!e.success&&!(null==(a=e.data)?void 0:a.persisted))throw new Error("Backend returned unsuccessful response");await t().fetchStats({force:!0})}catch(i){const{mutationsInFlight:n}=t(),a=new Set(n);throw a.delete(s),e({mutationsInFlight:a}),i}},clearDutyCycleMutation:()=>{const{mutationsInFlight:n}=t(),a=new Set(n);a.delete("setDutyCycleConfig"),e({mutationsInFlight:a})},startMutation:n=>{const{mutationsInFlight:a}=t(),s=new Set(a);s.add(n),e({mutationsInFlight:s})},clearMutation:n=>{const{mutationsInFlight:a}=t(),s=new Set(a);s.delete(n),e({mutationsInFlight:s})},sendAdvert:async()=>{try{const n=await Fg();return n.success?(e({flashAdvert:t().flashAdvert+1}),{success:!0}):{success:!1,error:n.error||"Failed to send advert"}}catch(n){return{success:!1,error:n instanceof Error?n.message:"Unknown error"}}},triggerFlashReceived:()=>{e({flashReceived:t().flashReceived+1})},triggerFlashAdvert:()=>{e({flashAdvert:t().flashAdvert+1})},fetchHardwareStats:async()=>{try{const n=await Ag();if(n.success&&n.data){const a=n.data;e({hardwareStats:a,hardwareStatsLoading:!1,hardwareStatsError:null});const s=80;t().addResourceDataPoint(a.cpu.usage_percent,a.memory.usage_percent,s)}else e({hardwareStatsError:n.error??"Failed to fetch hardware stats",hardwareStatsLoading:!1})}catch(n){e({hardwareStatsError:n instanceof Error?n.message:"Failed to fetch hardware stats",hardwareStatsLoading:!1})}},addResourceDataPoint:(n,a,s)=>{const r=Date.now(),{lastResourceFetch:o,resourceHistory:i}=t();if(r-o<1e3)return;const l=[...i,{timestamp:r,time:new Date(r).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),cpu:n,memory:a}],c=l.length>s?l.slice(-s):l;e({resourceHistory:c,lastResourceFetch:r})},hideContact:n=>{const{hiddenContacts:a}=t(),s=new Set(a);s.add(n),e({hiddenContacts:s}),function(e){if("undefined"!=typeof window)try{localStorage.setItem(jb,JSON.stringify([...e]))}catch{}}(s)},clearPacketCache:()=>{Gg.clear(),e({packets:[],lastPacketTimestamp:0}),Gg.quickLoad().then(n=>{if(n.length>0){const a=n.reduce((e,t)=>Math.max(e,t.timestamp??0),0);e({packets:n,lastPacketTimestamp:a}),t().triggerTopologyCompute()}})},triggerTopologyCompute:()=>{var e,n,a,s;const{packets:r,stats:o,hiddenContacts:i}=t();if(0===r.length||!o)return;const l=o.neighbors??{},c=Object.fromEntries(Object.entries(l).filter(([e])=>!i.has(e))),u=o.local_hash;let d=null==(n=null==(e=o.config)?void 0:e.repeater)?void 0:n.latitude,h=null==(s=null==(a=o.config)?void 0:a.repeater)?void 0:s.longitude;if(!d||!h||0===d&&0===h){const e=hf.getState().getEffectiveLocation();e&&(d=e.latitude,h=e.longitude)}const m=[];for(const[t,g]of Object.entries(c))g.zero_hop&&m.push({hash:t,advertCount:g.advert_count??1,avgRssi:g.rssi??null,avgSnr:g.snr??null,lastSeen:g.last_seen??0,latitude:g.latitude,longitude:g.longitude});const p=rf.getState().getTerrainGridForDisambiguation();Jg.compute(r,c,u,d,h,void 0,m,p??void 0)},triggerDeepAnalysis:async()=>{await Gg.forceDeepLoad();const n=Gg.getPackets();if(n.length>0){const a=n.reduce((e,t)=>Math.max(e,t.timestamp??0),0);e({packets:n,lastPacketTimestamp:a}),t().triggerTopologyCompute(),t().triggerSparklineCompute()}},updateQuickNeighbors:()=>{const{packets:n,stats:a,hiddenContacts:s}=t();if(0===n.length||!a)return;const r=a.neighbors??{},o=function(e,t,n){if(!n||0===e.length||0===Object.keys(t).length)return[];const a=Date.now(),s=kb(n),r=new Set(Object.keys(t)),o=function(e){var t,n;const a=new Map;for(const s of Object.keys(e)){const r=kb(s),o=a.get(r);if(o){const i=null==(t=e[o])?void 0:t.zero_hop;(null==(n=e[s])?void 0:n.zero_hop)&&!i&&a.set(r,s)}else a.set(r,s)}return a}(t),i=new Map;for(const c of e){if(!Eb(c))continue;const e=Bb(c.src_hash,s,o,r);if(!e)continue;let t=i.get(e);t||(t=Sb(e),i.set(e,t)),Fb(t,c)}for(const[c,u]of Object.entries(t))kb(c)!==s&&u.zero_hop&&!i.has(c)&&i.set(c,{hash:c,count:u.advert_count??0,rssiSum:u.rssi??0,rssiCount:void 0!==u.rssi?1:0,snrSum:u.snr??0,snrCount:void 0!==u.snr?1:0,lastSeen:u.last_seen??0});const l=[];for(const c of i.values()){const e=Mb(c,a);e&&l.push(e)}return l.sort((e,t)=>t.count!==e.count?t.count-e.count:t.lastSeen-e.lastSeen),l}(n,Object.fromEntries(Object.entries(r).filter(([e])=>!s.has(e))),a.local_hash),i=t().quickNeighbors;(o.length!==i.length||o.some((e,t)=>{var n,a;return e.hash!==(null==(n=i[t])?void 0:n.hash)||e.count!==(null==(a=i[t])?void 0:a.count)}))&&(e({quickNeighbors:o}),zb(o))},triggerSparklineCompute:()=>{const{packets:e,stats:n,hiddenContacts:a}=t();if(0===e.length||!n)return;const s=n.neighbors??{},r=Object.keys(s).filter(e=>!a.has(e));0!==r.length&&Zg.compute(e,r)},requestSevenDayData:async()=>{let n=0;await Gg.loadSevenDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:Gg.getPackets()}))});const a=Gg.getPackets();e({packets:a,lastPacketTimestamp:Gg.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Qy.getState().queueDecryption(a)},{timeout:2e3})},requestThreeDayData:async()=>{let n=0;await Gg.loadThreeDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:Gg.getPackets()}))});const a=Gg.getPackets();e({packets:a,lastPacketTimestamp:Gg.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Qy.getState().queueDecryption(a)},{timeout:2e3})},requestFourteenDayData:async()=>{let n=0;await Gg.loadFourteenDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:Gg.getPackets()}))});const a=Gg.getPackets();e({packets:a,lastPacketTimestamp:Gg.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Qy.getState().queueDecryption(a)},{timeout:5e3})},requestTwentyOneDayData:async()=>{let n=0;await Gg.loadTwentyOneDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:Gg.getPackets()}))});const a=Gg.getPackets();e({packets:a,lastPacketTimestamp:Gg.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Qy.getState().queueDecryption(a)},{timeout:5e3})},requestThirtyDayData:async()=>{let n=0;await Gg.loadThirtyDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:Gg.getPackets()}))});const a=Gg.getPackets();e({packets:a,lastPacketTimestamp:Gg.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Qy.getState().queueDecryption(a)},{timeout:8e3})},requestNinetyDayData:async()=>{let n=0;await Gg.loadNinetyDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:Gg.getPackets()}))});const a=Gg.getPackets();e({packets:a,lastPacketTimestamp:Gg.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Qy.getState().queueDecryption(a)},{timeout:1e4})},setGlobalTimeRange:n=>{e({globalTimeRangeIndex:n}),function(e){if("undefined"!=typeof window)try{localStorage.setItem(Lb,e.toString())}catch{}}(n);const{packetCacheState:a,requestThreeDayData:s,requestSevenDayData:r,requestFourteenDayData:o,requestTwentyOneDayData:i,requestThirtyDayData:l,requestNinetyDayData:c,triggerTopologyCompute:u,triggerSparklineCompute:d}=t();let h=!1;const m={5:{complete:a.threeDayLoadComplete,load:()=>s()},6:{complete:a.sevenDayLoadComplete,load:()=>r()},7:{complete:a.fourteenDayLoadComplete,load:()=>o()},8:{complete:a.twentyOneDayLoadComplete,load:()=>i()},9:{complete:a.thirtyDayLoadComplete,load:()=>l()},10:{complete:a.ninetyDayLoadComplete,load:()=>c()}}[n];if(!m||m.complete||a.isBackgroundLoading||(m.load(),h=!0),!h&&n>=5&&(u(),d()),!h){const{packets:e}=t();Qy.getState().queueDecryption(e)}}})),qb=$b,Ub=()=>$b(e=>e.stats),Wb=()=>$b(e=>e.statsError),Hb=()=>$b(e=>e.packets),Yb=()=>$b(e=>e.packetsLoading),Gb=()=>$b(e=>e.logs),Kb=()=>$b(e=>e.logsLoading),Xb=()=>$b(e=>e.liveMode),Jb=()=>$b(e=>e.fetchLogs),Zb=()=>$b(e=>e.setLiveMode),Qb=()=>$b(e=>e.resourceHistory),ev=()=>$b(e=>e.hardwareStats),tv=()=>$b(e=>e.hardwareStatsLoading),nv=()=>$b(e=>e.hardwareStatsError),av=()=>$b(e=>e.fetchHardwareStats),sv=()=>$b(e=>e.hiddenContacts),rv=()=>$b(e=>e.hideContact),ov=()=>$b(e=>e.packetCacheState),iv=()=>$b(e=>e.quickNeighbors),lv=()=>$b(e=>e.cachedLocalHash),cv=()=>$b(e=>e.lastPacketTimestamp),uv=()=>$b(e=>e.globalTimeRangeIndex),dv=()=>$b(e=>e.setGlobalTimeRange),hv=()=>$b(e=>null!==e.stats&&e.packetCacheState.backgroundLoadComplete),mv=()=>$b(e=>e.packets.length>0);function pv(){const e=$b(e=>{var t,n,a;return null==(a=null==(n=null==(t=e.stats)?void 0:t.config)?void 0:n.repeater)?void 0:a.latitude}),t=$b(e=>{var t,n,a;return null==(a=null==(n=null==(t=e.stats)?void 0:t.config)?void 0:n.repeater)?void 0:a.longitude}),n=$b(e=>{var t,n,a;return(null==(n=null==(t=e.stats)?void 0:t.config)?void 0:n.node_name)||(null==(a=e.stats)?void 0:a.node_name)||"Local Node"}),a=hf(e=>e.latitude),s=hf(e=>e.longitude),r=hf(e=>e.enabled);return e&&t&&(0!==e||0!==t)?{latitude:e,longitude:t,name:n,isStealth:!1}:r&&null!==a&&null!==s?{latitude:a,longitude:s,name:n,isStealth:!0}:null}const gv={healthy:{p3:"color(display-p3 0.2 1 0.4)",fallback:"#00FF66"},degraded:{p3:"color(display-p3 1 0.7 0.2)",fallback:"#FFB020"},offline:{p3:"color(display-p3 1 0.3 0.3)",fallback:"#EF4444"},connecting:{p3:"color(display-p3 0.4 0.6 1)",fallback:"#6699FF"},rx:{p3:"color(display-p3 0.2 1 0.4)",fallback:"#00FF66"},tx:{p3:"color(display-p3 1 0.9 0.2)",fallback:"#FFDD00"},idle:{p3:"color(display-p3 0.3 0.3 0.35)",fallback:"#4A4A55"}};function fv({color:e,pulse:t=!1,className:n}){var a;return r.jsx("span",{className:i("inline-block rounded-full w-1 h-1",t&&"animate-pulse",n),style:{backgroundColor:e.fallback,...(null==(a=CSS.supports)?void 0:a.call(CSS,"color","color(display-p3 1 1 1)"))&&{backgroundColor:e.p3}}})}function yv({showLabel:e=!1,className:t}){const n=$b(e=>e.flashReceived),a=$b(e=>e.flashAdvert),o=ef(e=>"connected"===e.connectionState),l=gf(),c=pf(e=>e.isInitializing),[u,d]=s.useState("idle"),h=s.useRef(0),m=s.useRef(0);s.useEffect(()=>{if(n<=0)return;const e=Date.now();if(e-h.current<50)return;h.current=e,d("rx");const t=setTimeout(()=>d("idle"),100);return()=>clearTimeout(t)},[n]),s.useEffect(()=>{if(a<=0)return;const e=Date.now();if(e-m.current<50)return;m.current=e,d("tx");const t=setTimeout(()=>d("idle"),100);return()=>clearTimeout(t)},[a]);let p=gv.healthy,g=!1,f="LIVE",y="Real-time (WebSocket)";c?(p=gv.connecting,g=!0,f="WAIT",y="Connecting..."):"offline"===l?(p=gv.offline,g=!0,f="DOWN",y="Cannot reach server"):"degraded"===l?(p=gv.degraded,f="POLL",y="Real-time unavailable, using REST polling"):o?(p=gv.healthy,f="LIVE",y="Real-time (WebSocket)"):(p=gv.healthy,f="POLL",y="Database polling");const b="rx"===u?gv.rx:"tx"===u?gv.tx:gv.idle;return r.jsxs("span",{className:i("inline-flex items-center gap-1.5",t),title:y,children:[r.jsxs("span",{className:"inline-flex items-center justify-center gap-1 w-5 h-5 rounded bg-body border border-edge-subtle",children:[r.jsx(fv,{color:p,pulse:g}),r.jsx(fv,{color:b})]}),e&&r.jsx("span",{className:i("type-data-xs","DOWN"===f?"text-status-danger":"WAIT"===f?"text-sys-blue":"POLL"===f?"text-status-warning":"text-fg-muted"),children:f})]})}function bv({borderRadius:e}){return r.jsx(Nm.div,{initial:{opacity:0},animate:{opacity:.8,backgroundPosition:["200% 0%","-200% 0%"]},exit:{opacity:0},transition:{opacity:{duration:.2},backgroundPosition:{duration:2,ease:"easeInOut",repeat:1/0}},style:{position:"absolute",inset:0,zIndex:1,pointerEvents:"none",borderRadius:e,padding:2,background:"linear-gradient(\n 90deg,\n transparent 0%,\n transparent 25%,\n var(--sys-blue) 50%,\n transparent 75%,\n transparent 100%\n )",backgroundSize:"200% 100%",mask:"\n linear-gradient(#fff 0 0) content-box,\n linear-gradient(#fff 0 0)\n ",maskComposite:"exclude",WebkitMaskComposite:"xor"}})}function vv({children:e,isLoading:t=!0,className:n,borderRadius:a=12}){return r.jsxs("div",{className:i("relative overflow-hidden",n),style:{borderRadius:a},children:[r.jsx(kh,{children:t&&r.jsx(bv,{borderRadius:a})}),r.jsx("div",{className:"relative z-10",children:e})]})}function wv({className:e}){return r.jsx("div",{className:i("relative w-10 h-1 rounded-sm overflow-hidden","bg-elevated",e),children:r.jsx(Nm.div,{animate:{backgroundPosition:["200% 0%","-200% 0%"]},transition:{duration:1.5,ease:"easeInOut",repeat:1/0},className:"absolute inset-0",style:{background:"linear-gradient(\n 90deg,\n transparent 0%,\n var(--sys-blue) 50%,\n transparent 100%\n )",backgroundSize:"200% 100%"}})})}const Cv=A(e=>({sparklines:new Map,isComputing:!1,lastUpdated:0,nodeCount:0,setSparklines:t=>e({sparklines:t,lastUpdated:Date.now(),nodeCount:t.size,isComputing:!1}),setComputing:t=>e({isComputing:t})}));"undefined"!=typeof window&&setTimeout(()=>{Zg.subscribe((e,t)=>{const n=Cv.getState();t&&!n.isComputing?n.setComputing(!0):!t&&e.size>0?n.setSparklines(e):!t&&n.isComputing&&n.setComputing(!1)})},0);const kv=()=>Cv(e=>e.sparklines),xv=()=>Cv(e=>e.isComputing),Dv=[],Av=new Map;function Ev(e){return Cv(t=>{const n=t.sparklines.get(e);if(!n||0===n.length)return Dv;const a=Av.get(e);return a===n?a:(Av.set(e,n),n)})}const Bv="pymc_room_seen_",Fv="pymc_room_selected";function Sv(e){try{const t=localStorage.getItem(`${Bv}${e}`);return t?Number(t):0}catch{return 0}}function Mv(e){const t=new Map;for(const n of e){const e=Math.floor(n.post_timestamp/30),a=`${n.author_pubkey}|${e}|${n.message_text}`,s=t.get(a);(!s||n.ids&&e{let n=null;return{rooms:[],selectedRoom:null,messages:[],clients:[],identities:[],unreadCount:0,lastSeenMap:new Map,isLoading:!1,error:null,initialize:()=>{n||(t().fetchRooms(),n=setInterval(()=>{t().fetchRooms()},1e4))},fetchRooms:async()=>{try{const[n,a]=await Promise.all([Pg(),Tg()]),s=n.success&&n.data?n.data.rooms:[],r=(a.success&&a.data?a.data.configured:[]).filter(e=>"room_server"===e.type),o=new Set(r.map(e=>e.name)),i=s.filter(e=>o.has(e.room_name)),l=new Map;for(const e of i)l.set(e.room_name,Sv(e.room_name));const c=Tv(i,l);e({rooms:i,identities:r,lastSeenMap:l,unreadCount:c,error:null});const{selectedRoom:u}=t();if(!u&&i.length>0){const e=function(){try{return localStorage.getItem(Fv)}catch{return null}}(),n=e&&i.some(t=>t.room_name===e)?e:i[0].room_name;t().selectRoom(n)}}catch(n){e({error:n instanceof Error?n.message:"Failed to fetch rooms"})}},selectRoom:async n=>{const{selectedRoom:a}=t();e(a!==n?{selectedRoom:n,messages:[],clients:[],isLoading:!0}:{selectedRoom:n,isLoading:!0}),function(e){try{localStorage.setItem(Fv,e)}catch{}}(n),await Promise.all([t().fetchMessages(),t().fetchClients()]),e({isLoading:!1})},fetchMessages:async n=>{const{selectedRoom:a,messages:s}=t();if(!a)return;const r={room_name:a,limit:200};if((null==n?void 0:n.incremental)&&s.length>0){const e=Math.max(...s.map(e=>e.post_timestamp));r.since_timestamp=e}try{const t=await async function(e){const t=new URLSearchParams;return e.room_name&&t.set("room_name",e.room_name),e.room_hash&&t.set("room_hash",e.room_hash),void 0!==e.limit&&t.set("limit",e.limit.toString()),void 0!==e.offset&&t.set("offset",e.offset.toString()),void 0!==e.since_timestamp&&t.set("since_timestamp",e.since_timestamp.toString()),hg(`/api/room_messages?${t.toString()}`)}(r);if(!t.success||!t.data)return;if((null==n?void 0:n.incremental)&&s.length>0){const n=new Set(s.map(e=>e.id)),a=t.data.messages.filter(e=>!n.has(e.id));a.length>0&&e({messages:Mv([...s,...a])})}else e({messages:Mv(t.data.messages)})}catch(o){}},postMessage:async e=>{try{return!!(await async function(e){return hg("/api/room_post_message",{method:"POST",body:JSON.stringify(e)})}(e)).success&&(await t().fetchMessages(),!0)}catch{return!1}},deleteMessage:async n=>{const{selectedRoom:a}=t();if(!a)return!1;try{return!!(await async function(e){const t=new URLSearchParams;return e.room_name&&t.set("room_name",e.room_name),e.room_hash&&t.set("room_hash",e.room_hash),t.set("message_id",e.message_id.toString()),hg(`/api/room_message?${t.toString()}`,{method:"DELETE"})}({room_name:a,message_id:n})).success&&(e({messages:t().messages.filter(e=>e.id!==n)}),!0)}catch{return!1}},clearMessages:async()=>{const{selectedRoom:n}=t();if(!n)return!1;try{return!!(await async function(e){const t=new URLSearchParams;return e.room_name&&t.set("room_name",e.room_name),e.room_hash&&t.set("room_hash",e.room_hash),hg(`/api/room_messages_clear?${t.toString()}`,{method:"DELETE"})}({room_name:n})).success&&(e({messages:[]}),!0)}catch{return!1}},fetchClients:async()=>{const{selectedRoom:n}=t();if(n)try{const t=await async function(e){const t=new URLSearchParams;return e.room_name&&t.set("room_name",e.room_name),e.room_hash&&t.set("room_hash",e.room_hash),hg(`/api/room_clients?${t.toString()}`)}({room_name:n});t.success&&t.data&&e({clients:t.data.clients.filter(e=>e.in_acl)})}catch{}},markAsRead:()=>{const{selectedRoom:n,rooms:a,lastSeenMap:s}=t();if(!n)return;const r=Math.floor(Date.now()/1e3);!function(e,t){try{localStorage.setItem(`${Bv}${e}`,String(t))}catch{}}(n,r);const o=new Map(s);o.set(n,r),e({lastSeenMap:o,unreadCount:Tv(a,o)})},createRoom:async e=>{try{return!!(await async function(e){return hg("/api/create_identity",{method:"POST",body:JSON.stringify(e)})}(e)).success&&(await t().fetchRooms(),!0)}catch{return!1}},updateRoom:async e=>{try{return!!(await async function(e){return hg("/api/update_identity",{method:"PUT",body:JSON.stringify(e)})}(e)).success&&(await t().fetchRooms(),!0)}catch{return!1}},deleteRoom:async n=>{try{const a=await async function(e){return hg(`/api/delete_identity?name=${encodeURIComponent(e)}`,{method:"DELETE"})}(n);if(a.success){const{selectedRoom:a}=t();return a===n&&e({selectedRoom:null,messages:[],clients:[]}),await t().fetchRooms(),!0}return!1}catch{return!1}},sendAdvert:async e=>{try{const t=await async function(e){return hg("/api/send_room_server_advert",{method:"POST",body:JSON.stringify({name:e})})}(e);return!!t.success}catch{return!1}},startActivePolling:()=>{const e=setInterval(()=>{t().fetchMessages({incremental:!0}),t().fetchClients()},5e3);return()=>clearInterval(e)}}}),Lv=()=>Pv(e=>e.rooms),Rv=()=>Pv(e=>e.selectedRoom),Nv=()=>Pv(e=>e.messages),zv=()=>Pv(e=>e.clients),_v=()=>Pv(e=>e.identities),Iv=()=>Pv(e=>e.isLoading),Vv=()=>Pv(e=>e.rooms.find(t=>t.room_name===e.selectedRoom)??null),Ov=()=>Pv(e=>e.identities.find(t=>{var n;return t.name===e.selectedRoom||(null==(n=t.settings)?void 0:n.node_name)===e.selectedRoom})??null),$v=A(e=>({topology:{edges:[],validatedEdges:[],weakEdges:[],certainEdges:[],uncertainEdges:[],edgeMap:new Map,maxPacketCount:0,maxCertainCount:0,neighborAffinity:new Map,fullAffinity:new Map,localPrefix:null,centrality:new Map,hubNodes:[],gatewayNodes:[],loops:[],loopEdgeKeys:new Set,txDelayRecommendations:new Map,pathRegistry:Xg(),edgeBetweenness:new Map,backboneEdges:[],nodeMobility:new Map,mobileNodes:[],pathHealth:[],lastHopNeighbors:[],disambiguationStats:{totalPrefixes:0,unambiguousPrefixes:0,collisionPrefixes:0,collisionRate:0,avgConfidence:0,lowConfidencePrefixes:[],highCollisionPrefixes:[],totalResolutions:0},discoveredNodes:[],viterbiStats:{totalPaths:0,pathsWithGhosts:0,avgPathCost:0,avgPathConfidence:0,observationOverrideCount:0,tracePacketsProcessed:0,pathPacketsProcessed:0,distantEdgesDiscovered:0,duplicateGroupsFound:0,duplicatePathsUnique:0,echolocationEdgesInferred:0},nodeMetrics:new Map,communityCount:0,backboneNodes:[],traceLinks:new Map,traceLinkSummary:{totalDirectedLinks:0,totalTraces:0,totalObservations:0,bidirectionalLinks:0,avgSnr:0,qualityCounts:{excellent:0,good:0,fair:0,poor:0,critical:0}}},isComputing:!1,lastComputeTimeMs:0,lastUpdated:0,setTopology:(t,n)=>e({topology:t,lastComputeTimeMs:n,lastUpdated:Date.now(),isComputing:!1}),setComputing:t=>e({isComputing:t})}));"undefined"!=typeof window&&Jg.subscribe((e,t)=>{$v.getState().setTopology(e,t)});const qv=()=>$v(e=>e.topology),Uv=()=>$v(e=>e.topology.hubNodes),Wv=()=>$v(e=>e.topology.centrality),Hv=()=>$v(e=>e.topology.fullAffinity),Yv=()=>$v(e=>e.isComputing),Gv=()=>$v(e=>e.lastUpdated);let Kv=null,Xv=null,Jv=null,Zv=null,Qv=null,ew=null;const tw=()=>$v(e=>(e.topology.hubNodes!==Xv&&(Xv=e.topology.hubNodes,Kv=new Set(e.topology.hubNodes)),Kv)),nw=()=>$v(e=>e.topology.txDelayRecommendations),aw=()=>$v(e=>e.topology.pathRegistry.canonicalPaths),sw=()=>$v(e=>(e.topology.mobileNodes!==Zv&&(Zv=e.topology.mobileNodes,Jv=new Set(e.topology.mobileNodes)),Jv)),rw=()=>$v(e=>e.topology.pathHealth),ow=()=>$v(e=>e.topology.lastHopNeighbors),iw=()=>$v(e=>e.topology.disambiguationStats),lw=()=>$v(e=>e.topology.disambiguationStats.highCollisionPrefixes),cw=()=>$v(e=>e.topology.disambiguationStats.totalPrefixes>0),uw=()=>$v(e=>e.topology.discoveredNodes),dw=()=>$v(e=>e.topology.viterbiStats),hw=()=>$v(e=>(e.topology.discoveredNodes!==ew&&(ew=e.topology.discoveredNodes,Qv=e.topology.discoveredNodes.filter(e=>e.isLikelyReal)),Qv)),mw=()=>$v(e=>e.topology.nodeMetrics),pw=()=>$v(e=>e.topology.communityCount);let gw=null,fw=null;const yw=()=>$v(e=>{if(e.topology.nodeMetrics!==fw){fw=e.topology.nodeMetrics,gw={local:0,hub:0,gateway:0,backbone:0,neighbor:0,mobile:0,ghost:0,standard:0};for(const t of e.topology.nodeMetrics.values())gw[t.nodeClass]++}return gw});function bw(e){if(e<60)return`${Math.floor(e)}s`;const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),a=Math.floor(e%3600/60),s=[];return t>0&&s.push(`${t}d`),n>0&&s.push(`${n}h`),(a>0||0===s.length)&&s.push(`${a}m`),s.join(" ")}function vw(e){const t=Date.now()/1e3-e;return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function ww(e){const t=Date.now()/1e3-e;return t<60?`${Math.floor(t)}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}function Cw(e){return new Date(1e3*e).toLocaleString()}function kw(e){const t=new Date(1e3*e);return`${t.toLocaleString("en-US",{month:"short"})} ${t.getDate()}, ${t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}`}function xw(e){return new Date(1e3*e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Dw(e){return`${(e/1e6).toFixed(3)} MHz`}function Aw(e){return`${(e/1e3).toFixed(1)} kHz`}function Ew(e){const t=e>1e12?e:1e3*e,n=Date.now(),a=Math.abs(n-t),s=Math.floor(a/1e3),r=Math.floor(s/60),o=Math.floor(r/60),i=Math.floor(o/24);return i>0?`${i} day${1!==i?"s":""}`:o>0?`${o} hour${1!==o?"s":""}`:r>0?`${r} minute${1!==r?"s":""}`:`${s} second${1!==s?"s":""}`}function Bw(e){e<0&&(e=0);const t=Math.floor(e/1e3),n=Math.floor(t/60),a=Math.floor(n/60);if(a>0){const e=n%60;return e>0?`${a}h ${e}m`:`${a}h`}if(n>0){const e=t%60;return e>0?`${n}m ${e}s`:`${n}m`}if(t>0){const n=e%1e3;return n>0?`${t}.${Math.floor(n/100)}s`:`${t}s`}return`${e}ms`}function Fw(e){return e<1024?`${e}B`:e<1048576?`${(e/1024).toFixed(1)}K`:`${(e/1048576).toFixed(1)}M`}s.memo(function({options:e,data:t,className:n="",onCreate:a}){const o=s.useRef(null),i=s.useRef(null);return s.useEffect(()=>{const n=o.current;if(!n)return;const s=n.getBoundingClientRect(),r=Math.floor(s.width)||400,l=Math.floor(s.height)||200,c=new us({...e,width:r,height:l},t,n);return i.current=c,null==a||a(c),()=>{c.destroy(),i.current=null}},[e]),s.useEffect(()=>{i.current&&t&&i.current.setData(t)},[t]),s.useEffect(()=>{const e=o.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!i.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&i.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),r.jsx("div",{ref:o,className:`w-full h-full ${n}`,style:{minHeight:100}})});const Sw=s.memo(function({items:e,direction:t="horizontal",size:n="sm",className:a,highlightedKey:s,onItemClick:o,onItemHover:l}){const c="horizontal"===t,u="sm"===n;return r.jsx("div",{className:i("flex font-mono",c?"flex-wrap gap-x-4 gap-y-1":"flex-col gap-1",u?"text-xs":"text-sm",a),children:e.map(e=>{const t=null!=s&&s!==e.key,n=o||l;return r.jsxs("div",{className:i("flex items-center gap-1.5 transition-opacity",t&&"opacity-30",n&&"cursor-pointer hover:opacity-80"),onClick:()=>null==o?void 0:o(e.key),onMouseEnter:()=>null==l?void 0:l(e.key),onMouseLeave:()=>null==l?void 0:l(null),children:[r.jsx("div",{className:i("shrink-0 rounded-xs",u?"w-3 h-3":"w-4 h-4"),style:{backgroundColor:e.color}}),r.jsx("span",{className:"text-fg-secondary whitespace-nowrap",children:e.label}),void 0!==e.value&&r.jsx("span",{className:"text-fg-muted tabular-nums",children:e.formatValue?e.formatValue(e.value):e.value})]},e.key)})})}),Mw={4:T.blue,5:T.indigo,6:T.purple,0:T.cyan,2:T.teal,7:T.green,1:T.yellow,10:T.amber,8:T.orange,9:T.red,3:T.pink,15:T.brown},jw=T.brown;function Tw(e){return Mw[e]??jw}let Pw=null,Lw=0;const Rw=1e3;function Nw({activeTypes:e,totalByType:t}){const n=[...e].reverse().map(e=>({key:String(e),label:xs[e]??`TYPE_${e}`,color:Tw(e),value:t[e]??0,formatValue:e=>Fw(e)}));return r.jsx(Sw,{items:n})}const zw=s.memo(function({buckets:e,activeTypes:t,onHover:n,gridColor:a,axisTickColor:o}){const i=s.useRef(null),l=s.useRef(null),c=s.useRef(e),u=s.useRef(t),d="undefined"!=typeof document&&"light"!==document.documentElement.dataset.mode,h=a||(d?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)"),m=o||(d?"rgba(255,255,255,0.6)":"rgba(0,0,0,0.6)"),p=s.useRef({gridColor:h,axisTickColor:m});c.current=e,u.current=t,p.current={gridColor:h,axisTickColor:m};const g=e.length,f=s.useMemo(()=>[e.map(e=>e.start),e.map(()=>1)],[g]),y=s.useCallback(t=>{if(!i.current||0===e.length)return;const a=i.current.getBoundingClientRect(),s=(t.clientX-a.left-48)/(a.width-48-8);if(s<0||s>1)return void(null==n||n(null,null,null));const r=Math.min(e.length-1,Math.max(0,Math.floor(s*e.length)));null==n||n(r,e[r],s)},[e,n]),b=s.useCallback(()=>{null==n||n(null,null,null)},[n]);return s.useEffect(()=>{if(!i.current||0===g)return;const e=i.current,t=e.getBoundingClientRect(),n={width:Math.floor(t.width)||400,height:Math.floor(t.height)||200,padding:[8,8,28,48],cursor:{show:!1},scales:{x:{time:!1},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],legend:{show:!1},hooks:{draw:[e=>{const t=e.ctx,{left:n,top:a,width:s,height:r}=e.bbox,o=window.devicePixelRatio||1,i=p.current;!function(e,t,n,a,s,r,o){if(0===t.length||0===n.length)return;const i=t.length,l=r/i;let c=0;for(const u of t)u.totalBytes>c&&(c=u.totalBytes);0===c&&(c=1);for(let u=0;uc&&(c=y.totalBytes);if(0===c)return;const u=function(){const e=performance.now();if(Pw&&e-Lw{const t=e.getBoundingClientRect();t.width>0&&t.height>0&&l.current&&l.current.setSize({width:Math.floor(t.width),height:Math.floor(t.height)})});return s.observe(e),()=>{s.disconnect(),a.destroy(),l.current=null}},[g]),s.useEffect(()=>{l.current&&l.current.redraw()},[e,t]),0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No data available"}):r.jsx("div",{ref:i,className:"w-full h-full",onMouseMove:y,onMouseLeave:b})}),_w=new Map;function Iw(e){var t;if(!e.startsWith("var("))return e;const n=_w.get(e);if(n)return n;const a=e.match(/var\(([^,)]+)(?:,\s*([^)]+))?\)/);if(!a)return e;const s=a[1].trim(),r=(null==(t=a[2])?void 0:t.trim())||"#888888",o=getComputedStyle(document.documentElement).getPropertyValue(s).trim()||r;return _w.set(e,o),o}const Vw="undefined"!=typeof document&&"light"!==document.documentElement.dataset.mode?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.3)";function Ow(e,t,n=!1){if(t.length<2)return;if(e.beginPath(),e.moveTo(t[0].x,t[0].y),2===t.length)return void e.lineTo(t[1].x,t[1].y);const a=.5;for(let s=0;s{p.current=e,g.current=t,f.current=a,y.current=n});const v=s.useRef({band:o,innerBand:i,mean:l,median:c,average:u,cursor:d});s.useLayoutEffect(()=>{v.current={band:o,innerBand:i,mean:l,median:c,average:u,cursor:d}});const w=s.useMemo(()=>[e.map(e=>e.timestamp),e.map(e=>e.max)],[e]),C=s.useMemo(()=>{const e=function(e,t,n,a){return{hooks:{draw:s=>{const r=e.current,o=t.current,i=n.current,l=a.current;if(0===r.length)return;const c=s.ctx,u=s.bbox,d=u.left,h=u.top,m=u.width,p=u.height;if(m<=0||p<=0)return;const g=s.data[0],f=g.length;if(0===f)return;const y=g[0],b=g[f-1]-y||1,v=e=>d+(e-y)/b*m,w=e=>h+p*(1-e/o),C={min:r.map(e=>({x:v(e.timestamp),y:w(e.min)})),max:r.map(e=>({x:v(e.timestamp),y:w(e.max)})),p5:r.map(e=>({x:v(e.timestamp),y:w(e.p5)})),p95:r.map(e=>({x:v(e.timestamp),y:w(e.p95)})),p25:r.map(e=>({x:v(e.timestamp),y:w(e.p25)})),p75:r.map(e=>({x:v(e.timestamp),y:w(e.p75)})),mean:r.map(e=>({x:v(e.timestamp),y:w(e.mean)})),median:r.map(e=>({x:v(e.timestamp),y:w(e.median)})),average:r.map(e=>({x:v(e.timestamp),y:w(e.average)}))},k=(e,t)=>i?i===e?Math.min(1,1.5*t):"minMax"===i||"p5p95"===i||"p25p75"===i?.3*t:t:t,x=e=>i?i===e?1:"mean"===i||"median"===i||"average"===i?.3:1:1,D={band:Iw(l.band),innerBand:Iw(l.innerBand),mean:Iw(l.mean),median:Iw(l.median),average:Iw(l.average)};c.save(),c.strokeStyle=D.average,c.lineWidth=4,c.globalAlpha=x("average"),Ow(c,C.average),c.stroke(),c.globalAlpha=k("minMax",.15),c.fillStyle=D.band,c.beginPath(),Ow(c,C.max);const A=[...C.min].reverse();for(const e of A)c.lineTo(e.x,e.y);c.closePath(),c.fill(),c.globalAlpha=k("p5p95",.3),c.fillStyle=D.band,c.beginPath(),Ow(c,C.p95);const E=[...C.p5].reverse();for(const e of E)c.lineTo(e.x,e.y);c.closePath(),c.fill(),c.globalAlpha=k("p25p75",.55),c.fillStyle=D.innerBand,c.beginPath(),Ow(c,C.p75);const B=[...C.p25].reverse();for(const e of B)c.lineTo(e.x,e.y);c.closePath(),c.fill(),c.strokeStyle=D.median,c.lineWidth=1.5,c.globalAlpha=x("median"),c.setLineDash([4,4]),Ow(c,C.median),c.stroke(),c.strokeStyle=D.mean,c.lineWidth=1.5,c.globalAlpha=x("mean"),c.setLineDash([]),Ow(c,C.mean),c.stroke(),c.restore()}}}}(p,g,f,v);return{width:400,height:200,padding:[4,4,4,4],cursor:{show:!0,x:!0,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,t]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],hooks:{setCursor:[e=>{var t,n;const a=e.cursor.idx;null!=a&&a>=0?null==(t=y.current)||t.call(y,a):null==(n=y.current)||n.call(y,null)}]},plugins:[e]}},[t]);s.useEffect(()=>{const t=h.current;if(!t||0===e.length)return;const n=b.current,a=e.length,s=Math.abs(a-n);if(!(!m.current||s>100||n>0&&s/n>.1)&&m.current)return m.current.setData(w),void(b.current=a);m.current&&m.current.destroy();const r=t.getBoundingClientRect(),o=Math.floor(r.width)||400,i=Math.floor(r.height)||200,l=new us({...C,width:o,height:i},w,t);return m.current=l,b.current=a,()=>{l.destroy(),m.current=null}},[C,w,e.length]),s.useEffect(()=>{const e=h.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!m.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&m.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{m.current&&m.current.redraw()},[a,e]);const k=s.useCallback(()=>{null==n||n(null)},[n]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No data available"}):r.jsx("div",{ref:h,className:"w-full h-full rounded-2xl overflow-hidden",onMouseLeave:k})});const $w="undefined"!=typeof window&&(null==(t=null==(e=window.matchMedia)?void 0:e.call(window,"(color-gamut: p3)"))?void 0:t.matches);let qw=null,Uw=0;function Ww(){const e=performance.now();if(qw&&e-Uw<1e3)return qw;const t=getComputedStyle(document.documentElement),n=t.getPropertyValue("--font-data").trim()||'"JetBrains Mono", ui-monospace, monospace',a="light"!==document.documentElement.dataset.mode,s=t.getPropertyValue("--chart-axis-tick").trim()||(a?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.4)"),r=t.getPropertyValue("--chart-grid").trim()||(a?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.06)"),o=t.getPropertyValue("--text-muted").trim()||"#727272",i=t.getPropertyValue("--text-primary").trim()||(a?"#FFFFFF":"#1A1A1A"),l=t.getPropertyValue("--signal-critical").trim()||"#EF4444",c=t.getPropertyValue("--bg-body").trim()||(a?"#171717":"#F5F5F5");return qw={fontFamily:n,axisColor:s,gridColor:r,textMuted:o,textPrimary:i,signalCritical:l,bgBody:c},Uw=e,qw}const Hw=["min","max","p75","p95","p99","mean","median","average","midpoint"];function Yw(e){const t=Fs(function(e){const{colormap:t,baseIndex:n,halfSize:a}=js(),s=Math.max(0,Math.min(1,e)),r=Math.min(n+Math.floor(s*(a-1)),t.discrete.length-1);return t.discrete[r]}(e)),n=`color(display-p3 ${(t.r/255).toFixed(3)} ${(t.g/255).toFixed(3)} ${(t.b/255).toFixed(3)})`;return{...t,p3:n}}function Gw(e,t,n,a,s,r,o,i,l,c=null,u=null,d=1,h=null,m="airtime",p=.5){if(0===t.length)return;const g=e.ctx,{left:f,top:y,width:b,height:v}=e.bbox,w=window.devicePixelRatio||1;if(b<=0||v<=0)return;const C=e.data[0],k=C.length;if(0===k)return;const x=C[0],D=C[k-1],A=n,E="share"===m,B=E?function(e){const t=[10,20,25,50,100,200,250,500,1e3],n=e/4.5;for(const a of t)if(a>=n)return a;return e>5e3?1e3*Math.ceil(n/1e3):100*Math.ceil(n/100)}(A):5,F=r.signalCritical,S=r.bgBody;g.save(),g.fillStyle="#000000";const M=8*w;g.beginPath(),g.roundRect(f,y,b,v,M),g.fill(),g.restore();const j=parseInt(S.slice(1,3),16)||23,T=parseInt(S.slice(3,5),16)||23,P=parseInt(S.slice(5,7),16)||23;if(!E&&A>=20){g.save();const e=y+v*(1-20/A);g.fillStyle=`rgba(${j}, ${T}, ${P}, 0.5)`,g.fillRect(f,y,b,e-y),g.restore()}g.save(),g.lineWidth=1*w,g.setLineDash([4*w,4*w]);for(let R=B;Rn+s)return;const i=Ww().textPrimary;e.save(),e.strokeStyle=i,e.globalAlpha=.5,e.lineWidth=1*o,e.setLineDash([4*o,4*o]),e.beginPath(),e.moveTo(Math.round(t)+.5,a),e.lineTo(Math.round(t)+.5,a+r),e.stroke(),e.restore()}(g,h,f,y,b,v,w),o){!function(e,t,n,a,s,r,o=null,i=null,l=1,c=25){const{points:u,rawValues:d,count:h,packetTypes:m,timestamps:p}=t,g=1*l*(window.devicePixelRatio||1);e.globalCompositeOperation="source-over";const f=o?parseInt(o.replace("TYPE_",""),10):null;for(let y=0;y=i.start&&e0&&function(e,t,n,a,s,r,o,i,l,c,u=.5){if(0===t.length)return;const d=l-i||1,h=function(e,t=1.3,n=.15){const a=function(e){const t=e.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);if(t){const e=parseFloat(t[1]),n=parseFloat(t[2]),a=parseFloat(t[3]);return{r:Math.round(255*e),g:Math.round(255*n),b:Math.round(255*a),p3r:e,p3g:n,p3b:a}}if(e.startsWith("#")){const t=e.replace("#",""),n=parseInt(t.slice(0,2),16),a=parseInt(t.slice(2,4),16),s=parseInt(t.slice(4,6),16);return{r:n,g:a,b:s,p3r:n/255,p3g:a/255,p3b:s/255}}const n=e.match(/rgba?\(([\d.]+),?\s*([\d.]+),?\s*([\d.]+)/);if(n){const e=Math.round(parseFloat(n[1])),t=Math.round(parseFloat(n[2])),a=Math.round(parseFloat(n[3]));return{r:e,g:t,b:a,p3r:e/255,p3g:t/255,p3b:a/255}}return{r:255,g:255,b:255,p3r:1,p3g:1,p3b:1}}(e),s=function(e,t,n,a=1.25,s=.15){const r=(Math.max(e,t,n)+Math.min(e,t,n))/2;return{p3r:Math.min(1,r+(e-r)*a+s),p3g:Math.min(1,r+(t-r)*a+s),p3b:Math.min(1,r+(n-r)*a+s)}}(a.p3r,a.p3g,a.p3b,t,n);return{r:Math.round(255*Math.min(1,s.p3r)),g:Math.round(255*Math.min(1,s.p3g)),b:Math.round(255*Math.min(1,s.p3b)),p3r:Math.min(1,s.p3r),p3g:Math.min(1,s.p3g),p3b:Math.min(1,s.p3b)}}(Ww().signalCritical);e.save(),e.globalAlpha=u,e.fillStyle=$w?`color(display-p3 ${h.p3r} ${h.p3g} ${h.p3b})`:`rgb(${h.r}, ${h.g}, ${h.b})`;for(const m of t){if(m.endTsl)continue;const t=a+(Math.max(m.startTs,i)-i)/d*r,n=a+(Math.min(m.endTs,l)-i)/d*r,u=Math.max(n-t,2*c);e.fillRect(t,s,u,o)}e.restore()}(g,i,0,f,y,b,v,x,D,w,u?Math.max(.03,.03*p):p)}s.memo(function({data:e,maxValue:t,visibleLines:n=Hw,highlightedLine:a=null,onHover:o,scatterData:i=null,noiseFloorAnomalies:l=null,showNoiseFloorOverlay:c=!1,overlayOpacity:u=.5,highlightedType:d=null,hoveredTimeRange:h=null,timeRangeHours:m=24,yAxisMode:p="airtime"}){const g=s.useRef(null),f=s.useRef(null),y=s.useRef(e),b=s.useRef(t),v=s.useRef(n),w=s.useRef(a),C=s.useRef(o),k=s.useRef(i),x=s.useRef(l),D=s.useRef(c),A=s.useRef(d),E=s.useRef(h),B=s.useRef(null),F=s.useRef(null),S=s.useRef(p),M=s.useRef(u),j=m<=12?1.2:1,T=s.useRef(j),P=s.useRef(e.length);s.useLayoutEffect(()=>{y.current=e,b.current=t,v.current=n,w.current=a,C.current=o,k.current=i,x.current=l,D.current=c,A.current=d,E.current=h,T.current=j,S.current=p,M.current=u}),s.useEffect(()=>{B.current=Ww()},[]);const L=s.useMemo(()=>[e.map(e=>e.timestamp),new Array(e.length).fill(1)],[e]),R=s.useMemo(()=>({hooks:{draw:e=>{const t=B.current||Ww();Gw(e,y.current,b.current,v.current,w.current,t,k.current,x.current,D.current,A.current,E.current,T.current,F.current,S.current,M.current)}}}),[]),N=s.useMemo(()=>({width:400,height:200,padding:[8,0,8,28],cursor:{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],plugins:[R]}),[R]);s.useEffect(()=>{const t=g.current;if(!t||0===e.length)return;const n=P.current,a=e.length,s=Math.abs(a-n);if(!(!f.current||s>100||n>0&&s/n>.1)&&f.current)return f.current.setData(L),void(P.current=a);f.current&&f.current.destroy();const r=t.getBoundingClientRect(),o=Math.floor(r.width)||400,i=Math.floor(r.height)||200,l=new us({...N,width:o,height:i},L,t);return f.current=l,P.current=a,()=>{l.destroy(),f.current=null}},[N,L,e.length]),s.useEffect(()=>{const e=g.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!f.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&f.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{f.current&&f.current.redraw()},[a,n,e,i,l,c,u,d,h,j]);const z=s.useCallback(t=>{var n,a;const s=g.current,r=f.current;if(!s||!r||0===e.length)return;const o=s.getBoundingClientRect(),i=t.clientX-o.left,l=window.devicePixelRatio||1,c=r.bbox,u=c.left/l,d=c.width/l;if(iu+d)return F.current=null,r.redraw(),void(null==(n=C.current)||n.call(C,null));F.current=i*l;const h=(i-u)/d,m=e.length,p=Math.floor(h*m),y=Math.max(0,Math.min(m-1,p));r.redraw(),null==(a=C.current)||a.call(C,y)},[e.length]),_=s.useCallback(()=>{var e;F.current=null,f.current&&f.current.redraw(),null==(e=C.current)||e.call(C,null)},[]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No data available"}):r.jsx("div",{ref:g,className:"w-full h-full rounded-lg overflow-hidden",onMouseMove:z,onMouseLeave:_})});const Kw=-70;let Xw=null,Jw=0;function Zw(e,t){if(0===e.length)return 0;const n=t/100*(e.length-1),a=Math.floor(n),s=Math.ceil(n);return a===s?e[a]:e[a]+(e[s]-e[a])*(n-a)}function Qw(e){const t=e.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\)/);if(t)return{r:Math.round(255*parseFloat(t[1])),g:Math.round(255*parseFloat(t[2])),b:Math.round(255*parseFloat(t[3]))};const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}:{r:250,g:189,b:47}}function eC(e,t){const n=Math.max(0,Math.min(1,e))*(t.length-1),a=Math.floor(n),s=n-a;if(a>=t.length-1)return t[t.length-1];const r=t[a],o=t[a+1];return{r:Math.round(r.r+(o.r-r.r)*s),g:Math.round(r.g+(o.g-r.g)*s),b:Math.round(r.b+(o.b-r.b)*s)}}function tC(e,t,n){const a=Math.max(0,Math.min(1,e));return{r:Math.round(t.r+(n.r-t.r)*a),g:Math.round(t.g+(n.g-t.g)*a),b:Math.round(t.b+(n.b-t.b)*a)}}const nC=s.memo(function({timestamps:e,values:t,onStatsChange:n,compact:a=!1,height:o}){var i,l;const[c,u]=s.useState(!0),d=s.useRef(null),h=s.useRef(null),m=s.useRef(null),p=s.useRef(null),g=s.useRef(null),f=s.useRef(a),y=s.useMemo(()=>{const e=t.filter(e=>e<=Kw);if(0===e.length)return null;const n=Math.min(...e),a=Math.max(...e),s=e.reduce((e,t)=>e+t,0)/e.length,r=[...e].sort((e,t)=>e-t);return{min:n,max:a,avg:s,p5:Zw(r,5),p95:Zw(r,95)}},[t]);s.useEffect(()=>{null==n||n(y)},[y]);const b=s.useCallback(()=>{u(e=>!e)},[]),{heatmapData:v,xLabels:w,yLabels:C}=s.useMemo(()=>{if(0===e.length||0===t.length||!y)return{heatmapData:null,xLabels:[],yLabels:[]};let n,s;if(c){const e=t.filter(e=>e<=Kw);if(0===e.length)return{heatmapData:null,xLabels:[],yLabels:[]};const a=[...e].sort((e,t)=>e-t),r=Zw(a,5),o=Zw(a,95),i=.1*(o-r||1);n=r-i,s=o+i}else{const e=t.filter(e=>e<=Kw);if(0===e.length)return{heatmapData:null,xLabels:[],yLabels:[]};const a=Math.min(...e),r=Math.max(...e),o=.1*(r-a||1);n=a-o,s=r+o}const r=s-n,o=e[0],i=e[e.length-1],l=i-o||1,u=120,d=48,h=new Float32Array(5760),m=[];for(let a=0;aKw)continue;const c=(e[a]-o)/l,p=1-(Math.max(n,Math.min(s,i))-n)/r;h[Math.min(119,Math.floor(c*u))*d+Math.min(47,Math.floor(p*d))]++,m.push(e[a])}let p=0;for(let e=0;ep&&(p=h[e]);const g=[],f=[];for(let e=0;et&&(t=a,n=s)}if(-1===n||0===t)continue;const a=s-(n+.5)/d*r,i=o+(e+.5)/u*l;g.push(i),f.push(a)}const b=function(e,t,n){if(0===e.length)return[];const a=function(e,t){if(0===e.length)return[];const n=Math.floor(t/2),a=new Array(e.length),s=new Array(t);for(let r=0;re-t),a[r]=s[n]}return a}(e,t),s=new Array(e.length);s[0]=a[0];for(let r=1;r0){const e=Math.min(...b),t=Math.max(...b),n=.4*(t-e||1);v=e-n,w=t+n,C=w-v}const k=[];for(let e=0;e{g.current=v,f.current=a});const k=s.useMemo(()=>{if(0===e.length)return[[],[]];const t=new Array(e.length).fill(1);return[e,t]},[e]),x=s.useMemo(()=>({hooks:{draw:e=>{!function(e,t,n){if(!t)return;const a=e.ctx,{left:s,top:r,width:o,height:i}=e.bbox,l=window.devicePixelRatio||1;if(o<=0||i<=0)return;const c=function(){const e=performance.now();if(Xw&&e-Jw<1e3)return Xw;const t=getComputedStyle(document.documentElement);return Xw={heatGradient:[Qw(t.getPropertyValue("--sys-indigo").trim()),Qw(t.getPropertyValue("--sys-blue").trim()),Qw(t.getPropertyValue("--sys-teal").trim()),Qw(t.getPropertyValue("--sys-amber").trim()),Qw(t.getPropertyValue("--sys-orange").trim())],trendLineColor:Qw(t.getPropertyValue("--sys-indigo").trim()),stabilityHot:Qw(t.getPropertyValue("--sys-amber").trim()),stabilityCool:Qw(t.getPropertyValue("--sys-blue").trim()),typography:{fontFamily:t.getPropertyValue("--font-data").trim()||'"JetBrains Mono", ui-monospace, monospace',textMuted:t.getPropertyValue("--text-muted").trim()||"#727272",textSecondary:t.getPropertyValue("--text-secondary").trim()||"#A0A0A0",gridColor:t.getPropertyValue("--chart-grid-line").trim()||"rgba(255,255,255,0.06)"}},Jw=e,Xw}();a.clearRect(s,r,o,i),n||function(e,t,n,a,s,r,o){e.save(),e.strokeStyle=o,e.lineWidth=1*r,e.setLineDash([3*r,3*r]);for(const i of[0,.25,.5,.75,1]){const r=Math.round(n+s*i)+.5;e.beginPath(),e.moveTo(t,r),e.lineTo(t+a,r),e.stroke()}e.restore()}(a,s,r,o,i,l,c.typography.gridColor),function(e,t,n,a,s,r,o,i,l){const{trendLine:c,trendCount:u}=t;if(u<2)return;e.save();const d=o?3*.6:3;if(e.lineWidth=d*i,e.lineCap="round",e.lineJoin="round",o){let t=1/0,o=-1/0;for(let e=0;eo&&(o=n)}const i=(t+o)/2,d=(o-t)/2||.01;for(let h=1;h{const t=m.current,n=p.current;if(!t&&!n||f.current)return;const{left:a,top:s}=e.cursor,r=g.current;if(null==a||null==s||a<0||s<0||!r)return t&&(t.style.display="none"),void(n&&(n.style.display="none"));const o=window.devicePixelRatio||1,i=e.bbox.width/o,l=e.bbox.height/o,c=a/i,u=s/l;if(c<0||c>1||u<0||u>1)return t&&(t.style.display="none"),void(n&&(n.style.display="none"));const d=Math.min(r.xBins-1,Math.max(0,Math.floor(c*r.xBins))),h=Math.min(r.yBins-1,Math.max(0,Math.floor(u*r.yBins))),y=r.densityGrid[d*r.yBins+h],b=r.minTime+(d+.5)/r.xBins*r.timeRange,v=r.yMax-(h+.5)/r.yBins*r.yRange,w=new Date(1e3*b).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});if(n){n.style.display="block";const e=n.children;e[0].style.transform=`translateX(${Math.round(a)}px)`,e[1].style.transform=`translateY(${Math.round(s)}px)`;const t=i/r.xBins,o=l/r.yBins,c=e[2];c.style.left=d*t+"px",c.style.top=h*o+"px",c.style.width=`${t}px`,c.style.height=`${o}px`,c.style.opacity=y>0?"1":"0.5"}if(t){const e=t.children;e[0].textContent=w,e[1].textContent=`${Math.round(v)} dBm`,e[2].textContent=y>0?`${y} sample${1!==y?"s":""}`:"no data";const n=a>i-130,r=s>l-64;t.style.display="block",t.style.left=`${a+(n?-116:12)}px`,t.style.top=`${s+(r?-58:8)}px`}}}}),[]),D=s.useMemo(()=>({width:400,height:200,padding:[0,0,0,0],cursor:a?{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}}:{show:!0,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],plugins:[x]}),[x,a]);return s.useEffect(()=>{const t=d.current;if(!t||0===e.length)return;h.current&&h.current.destroy();const n=t.getBoundingClientRect(),a=Math.floor(n.width)||400,s=Math.floor(n.height)||200,r=new us({...D,width:a,height:s},k,t);return h.current=r,()=>{r.destroy(),h.current=null}},[D,k,e.length]),s.useEffect(()=>{const e=d.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!h.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&h.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{h.current&&h.current.redraw()},[v,c]),v?a?r.jsx("div",{ref:d,className:"w-full",style:{height:o??28},role:"img","aria-label":"Noise floor sparkline"}):r.jsxs("div",{className:"relative w-full h-full",role:"img","aria-label":`RF noise floor heatmap showing values from ${(null==(i=null==y?void 0:y.min)?void 0:i.toFixed(0))??"N/A"} to ${(null==(l=null==y?void 0:y.max)?void 0:l.toFixed(0))??"N/A"} dBm`,children:[r.jsx("div",{className:"absolute top-0 left-0 flex flex-col justify-between",style:{width:32,bottom:20},"aria-hidden":"true",children:C.map((e,t)=>r.jsx("span",{className:"type-data-xs text-fg-secondary text-right pr-1.5",style:{position:"absolute",top:`${e.pos}%`,transform:"translateY(-50%)",right:0},children:e.label},t))}),r.jsxs("div",{ref:d,className:"absolute overflow-hidden",style:{left:32,right:0,top:0,bottom:20},children:[r.jsxs("div",{ref:p,className:"absolute inset-0 z-10 pointer-events-none",style:{display:"none"},children:[r.jsx("div",{className:"absolute top-0 bottom-0 w-px bg-subtle-fill-strong"}),r.jsx("div",{className:"absolute left-0 right-0 h-px bg-subtle-fill-strong"}),r.jsx("div",{className:"absolute bg-subtle-fill-strong ring-1 ring-inset ring-edge-strong"})]}),r.jsxs("div",{ref:m,className:"absolute z-20 pointer-events-none radius-inner bg-tooltip-bg px-2.5 py-1.5 shadow-lg",style:{display:"none"},children:[r.jsx("div",{className:"type-data-xs text-fg-muted"}),r.jsx("div",{className:"type-data-xs text-fg-primary"}),r.jsx("div",{className:"type-data-xs text-fg-muted"})]}),r.jsx("button",{type:"button",onClick:b,className:"absolute bottom-1 right-1 z-10 p-1.5 rounded bg-tooltip-bg/80 hover:bg-tooltip-bg active:bg-tooltip-bg transition-colors touch-manipulation",title:c?"Show full range (min/max)":"Show trimmed range (P5-P95)","aria-label":c?"Expand to show full data range":"Shrink to show trimmed percentile range","aria-pressed":!c,children:c?r.jsx(lr,{className:"w-3.5 h-3.5 text-fg-muted","aria-hidden":"true"}):r.jsx(Er,{className:"w-3.5 h-3.5 text-fg-muted","aria-hidden":"true"})})]}),r.jsx("div",{className:"absolute left-0 right-0 bottom-0",style:{left:32,height:20},"aria-hidden":"true",children:w.map((e,t)=>r.jsx("span",{className:"type-data-xs text-fg-secondary absolute top-1",style:{left:`${e.pos}%`,transform:"translateX(-50%)"},children:e.label},t))})]}):a?r.jsx("div",{className:"w-full rounded bg-subtle/50",style:{height:o??28},"aria-hidden":"true"}):r.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No noise floor data available"})});let aC=null,sC=0;function rC(){const e=performance.now();if(aC&&e-sC<1e3)return aC;const t=getComputedStyle(document.documentElement),n=t.getPropertyValue("--font-data").trim()||'"JetBrains Mono", ui-monospace, monospace',a="light"!==document.documentElement.dataset.mode,s=t.getPropertyValue("--chart-axis-tick").trim()||(a?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.4)"),r=t.getPropertyValue("--chart-grid").trim()||(a?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.06)"),o=t.getPropertyValue("--text-muted").trim()||"#727272",i=t.getPropertyValue("--text-primary").trim()||(a?"#FFFFFF":"#1A1A1A"),l=t.getPropertyValue("--signal-critical").trim()||"#EF4444",c=t.getPropertyValue("--bg-body").trim()||(a?"#171717":"#F5F5F5");return aC={fontFamily:n,axisColor:s,gridColor:r,textMuted:o,textPrimary:i,signalCritical:l,bgBody:c},sC=e,aC}function oC(e){const t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function iC(e){return oC(Tw(e))}const lC=s.memo(function({scatterData:e,yAxisMode:t,onHover:n,noiseFloorAnomalies:a=null,showNoiseFloorOverlay:o=!1,overlayOpacity:i=.5,highlightedType:l=null,timeRangeHours:c=24,yAxisMaxOverride:u}){const d=s.useRef(null),h=s.useRef(null),m=s.useRef(e),p=s.useRef(t),g=s.useRef(n),f=s.useRef(a),y=s.useRef(o),b=s.useRef(i),v=s.useRef(l),w=s.useRef(null),C=s.useRef(null),k=c<=12?1.2:1,x=s.useRef(k),D=u??(null==e?void 0:e.maxValue)??("share"===t?200:10),A=s.useRef(D);s.useLayoutEffect(()=>{m.current=e,p.current=t,g.current=n,f.current=a,y.current=o,b.current=i,v.current=l,x.current=k,A.current=D}),s.useEffect(()=>{w.current=rC()},[]);const E=s.useMemo(()=>{if(!e||0===e.count)return[[0],[0]];const t=[];for(let a=0;ae-t);const n=t.map(()=>1);return[t,n]},[e]),B=s.useMemo(()=>({hooks:{draw:e=>{const t=w.current||rC();!function(e,t,n,a,s,r,o,i,l,c,u){if(!t||0===t.count)return;const d=e.ctx,{left:h,top:m,width:p,height:g}=e.bbox,f=window.devicePixelRatio||1;if(p<=0||g<=0)return;const y=e.data[0],b=y.length;if(0===b)return;const v=y[0],w=y[b-1],C="share"===a,k=function(e,t){if("airtime"===t)return 5;const n=[10,20,25,50,100,200,250,500,1e3],a=e/4.5;for(const s of n)if(s>=a)return s;return e>5e3?1e3*Math.ceil(a/1e3):100*Math.ceil(a/100)}(n,a);if(!C&&n>=20){d.save();const e=m+g*(1-20/n),t=parseInt(s.bgBody.slice(1,3),16)||23,a=parseInt(s.bgBody.slice(3,5),16)||23,r=parseInt(s.bgBody.slice(5,7),16)||23;d.fillStyle=`rgba(${t}, ${a}, ${r}, 0.5)`,d.fillRect(h,m,p,e-m),d.restore()}d.save(),d.lineWidth=1*f,d.setLineDash([4*f,4*f]);for(let D=k;Dn+s||(e.save(),e.strokeStyle=i.textPrimary,e.globalAlpha=.5,e.lineWidth=1*o,e.setLineDash([4*o,4*o]),e.beginPath(),e.moveTo(Math.round(t)+.5,a),e.lineTo(Math.round(t)+.5,a+r),e.stroke(),e.restore()))}(d,u,h,m,p,g,f,s),function(e,t,n,a,s,r,o,i,l){const{points:c,rawValues:u,count:d,packetTypes:h}=t,m=.8*i*(window.devicePixelRatio||1),p=2*m;e.globalCompositeOperation="source-over";const g=o?parseInt(o.replace("TYPE_",""),10):null;for(let f=0;f0&&function(e,t,n,a,s,r,o,i,l,c,u){if(0===t.length)return;const d=i-o||1,h=oC(u.signalCritical);e.save(),e.globalAlpha=c,e.fillStyle=`rgb(${h.r}, ${h.g}, ${h.b})`;for(const m of t){if(m.endTsi)continue;const t=n+(Math.max(m.startTs,o)-o)/d*s,c=n+(Math.min(m.endTs,i)-o)/d*s,u=Math.max(c-t,2*l);e.fillRect(t,a,u,r)}e.restore()}(d,r,h,m,p,g,v,w,f,i,s)}(e,m.current,A.current,p.current,t,f.current,y.current,b.current,v.current,x.current,C.current)}}}),[]),F=s.useMemo(()=>({width:400,height:200,padding:[8,0,8,28],cursor:{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],plugins:[B]}),[B]);s.useEffect(()=>{const t=d.current;if(!t||!e||0===e.count)return;h.current&&h.current.destroy();const n=t.getBoundingClientRect(),a=Math.floor(n.width)||400,s=Math.floor(n.height)||200,r=new us({...F,width:a,height:s},E,t);return h.current=r,()=>{r.destroy(),h.current=null}},[F,E,null==e?void 0:e.count]),s.useEffect(()=>{const e=d.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!h.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&h.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{h.current&&h.current.redraw()},[e,a,o,i,l,k,t]);const S=s.useCallback(t=>{var n,a;const s=d.current,r=h.current;if(!s||!r||!e||0===e.count)return;const o=s.getBoundingClientRect(),i=t.clientX-o.left,l=window.devicePixelRatio||1,c=r.bbox,u=c.left/l,m=c.width/l;if(iu+m)return C.current=null,r.redraw(),void(null==(n=g.current)||n.call(g,null,void 0));C.current=i*l;const p=(i-u)/m,f=Math.floor(p*e.count),y=Math.max(0,Math.min(e.count-1,f));r.redraw(),null==(a=g.current)||a.call(g,y,p)},[null==e?void 0:e.count]),M=s.useCallback(()=>{var e;C.current=null,h.current&&h.current.redraw(),null==(e=g.current)||e.call(g,null,void 0)},[]);return e&&0!==e.count?r.jsx("div",{ref:d,className:"w-full h-full rounded-lg overflow-hidden",onMouseMove:S,onMouseLeave:M}):r.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No data available"})}),cC=new class{constructor(){a(this,"observer",null),a(this,"subscribers",new Set),a(this,"isObserving",!1)}subscribe(e){return this.subscribers.add(e),this.isObserving||this.startObserving(),()=>{this.subscribers.delete(e),0===this.subscribers.size&&this.stopObserving()}}get subscriberCount(){return this.subscribers.size}startObserving(){"undefined"!=typeof window&&(this.isObserving||(this.observer=new MutationObserver(e=>{for(const t of e)if("data-theme"===t.attributeName||"data-color-scheme"===t.attributeName||"class"===t.attributeName){setTimeout(()=>this.notifySubscribers(),50);break}}),this.observer.observe(document.documentElement,{attributes:!0}),this.isObserving=!0))}stopObserving(){this.observer&&(this.observer.disconnect(),this.observer=null),this.isObserving=!1}notifySubscribers(){for(const t of this.subscribers)try{t()}catch(e){}}};function uC(e){if(!e)return null;const t=e.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);if(t)return{r:Math.round(255*Math.min(1,Math.max(0,parseFloat(t[1])))),g:Math.round(255*Math.min(1,Math.max(0,parseFloat(t[2])))),b:Math.round(255*Math.min(1,Math.max(0,parseFloat(t[3]))))};if(e.startsWith("#")){const t=e.replace("#","");if(3===t.length)return{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16)};if(t.length>=6)return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}const n=e.match(/rgba?\(([\d.]+),?\s*([\d.]+),?\s*([\d.]+)/);return n?{r:Math.round(parseFloat(n[1])),g:Math.round(parseFloat(n[2])),b:Math.round(parseFloat(n[3]))}:null}function dC(e){return"undefined"==typeof window?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function hC(e){return function(e){if(!e)return"";if(e.startsWith("#"))return e;const t=e.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);if(t){const e=Math.round(255*Math.min(1,Math.max(0,parseFloat(t[1])))),n=Math.round(255*Math.min(1,Math.max(0,parseFloat(t[2])))),a=Math.round(255*Math.min(1,Math.max(0,parseFloat(t[3]))));return`#${e.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`}const n=e.match(/rgba?\(([\d.]+),?\s*([\d.]+),?\s*([\d.]+)/);if(n){const e=Math.round(parseFloat(n[1])),t=Math.round(parseFloat(n[2])),a=Math.round(parseFloat(n[3]));return`#${e.toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`}return e}(dC(e))}function mC(e,t){const[n,a]=s.useState(t),r=s.useCallback(()=>{a(e())},[e]);return s.useEffect(()=>(r(),cC.subscribe(r)),[r]),n}const pC={chart1:T.blue,chart2:T.teal,chart3:T.amber,chart4:T.orange,chart5:T.pink,chart6:T.purple,chart7:T.cyan,chart8:P[500]},gC={excellent:T.green,good:T.yellow,fair:T.amber,poor:T.orange,critical:T.red},fC={primary:"#ffffff",secondary:P[400],muted:P[500]},yC={nodeFill:T.blue,nodeStroke:"rgba(255,255,255,0.9)",hubColor:T.purple,hubStroke:"rgba(255,255,255,0.9)",gatewayColor:T.indigo,gatewayStroke:"rgba(255,255,255,0.85)",localColor:T.amber,neighborColor:T.amber,neighborStroke:"rgba(0,0,0,0.4)",mobileColor:T.orange,roomColor:T.pink,ghostColor:T.cyan};function bC(){return"undefined"==typeof window?pC:{chart1:dC("--chart-1")||pC.chart1,chart2:dC("--chart-2")||pC.chart2,chart3:dC("--chart-3")||pC.chart3,chart4:dC("--chart-4")||pC.chart4,chart5:dC("--chart-5")||pC.chart5,chart6:dC("--chart-6")||pC.chart6,chart7:dC("--chart-7")||pC.chart7,chart8:dC("--chart-8")||pC.chart8}}function vC(){return"undefined"==typeof window?fC:{primary:dC("--text-primary")||fC.primary,secondary:dC("--text-secondary")||fC.secondary,muted:dC("--text-muted")||fC.muted}}function wC(){return mC(bC,pC)}function CC(){return mC(vC,fC)}function kC(){return"undefined"==typeof window?yC:{nodeFill:dC("--map-node-fill")||yC.nodeFill,nodeStroke:dC("--map-node-stroke")||yC.nodeStroke,hubColor:dC("--map-hub-color")||yC.hubColor,hubStroke:dC("--map-hub-stroke")||yC.hubStroke,gatewayColor:dC("--map-gateway-color")||yC.gatewayColor,gatewayStroke:dC("--map-gateway-stroke")||yC.gatewayStroke,localColor:dC("--map-local-color")||yC.localColor,neighborColor:dC("--map-neighbor-color")||yC.neighborColor,neighborStroke:dC("--map-neighbor-stroke")||yC.neighborStroke,mobileColor:dC("--map-mobile-color")||yC.mobileColor,roomColor:dC("--map-room-color")||yC.roomColor,ghostColor:dC("--map-ghost-color")||yC.ghostColor}}function xC(){return mC(kC,yC)}const DC={nodeStroke:"rgba(0,0,0,0.6)",hubStroke:"rgba(0,0,0,0.5)",gatewayStroke:"rgba(0,0,0,0.45)",neighborStroke:"rgba(0,0,0,0.5)"},AC={nodeStroke:"rgba(255,255,255,0.9)",hubStroke:"rgba(255,255,255,0.9)",gatewayStroke:"rgba(255,255,255,0.85)",neighborStroke:"rgba(0,0,0,0.4)"};function EC(e){if("undefined"==typeof window)return yC;const t="light"===function(){if("undefined"==typeof window)return"dark";const e=document.querySelector("[data-basemap]");return e&&e.getAttribute("data-basemap")||"dark"}()?DC:AC;return{nodeFill:hC("--map-node-fill")||yC.nodeFill,nodeStroke:t.nodeStroke,hubColor:hC("--map-hub-color")||yC.hubColor,hubStroke:t.hubStroke,gatewayColor:hC("--map-gateway-color")||yC.gatewayColor,gatewayStroke:t.gatewayStroke,localColor:hC("--map-local-color")||yC.localColor,neighborColor:hC("--map-neighbor-color")||yC.neighborColor,neighborStroke:t.neighborStroke,mobileColor:hC("--map-mobile-color")||yC.mobileColor,roomColor:hC("--map-room-color")||yC.roomColor,ghostColor:hC("--map-ghost-color")||yC.ghostColor}}const BC={rest:"rgba(255, 255, 255, 0.25)",restBright:"rgba(255, 255, 255, 0.35)",restDim:"rgba(255, 255, 255, 0.15)",hoverDirect:T.cyan,hoverLoop:T.purple,hoverStandard:P[400],hoverNeighbor:T.amber,highlight:"#FFD700"},FC={rest:"rgba(0, 0, 0, 0.20)",restBright:"rgba(0, 0, 0, 0.30)",restDim:"rgba(0, 0, 0, 0.12)"},SC={rest:"rgba(255, 255, 255, 0.25)",restBright:"rgba(255, 255, 255, 0.35)",restDim:"rgba(255, 255, 255, 0.15)"};function MC(e){if("undefined"==typeof window)return BC;const t="light"===e?FC:SC;return{rest:t.rest,restBright:t.restBright,restDim:t.restDim,hoverDirect:hC("--map-edge-hover-direct")||BC.hoverDirect,hoverLoop:hC("--map-edge-hover-loop")||BC.hoverLoop,hoverStandard:hC("--map-edge-hover-standard")||BC.hoverStandard,hoverNeighbor:hC("--map-edge-hover-neighbor")||BC.hoverNeighbor,highlight:hC("--map-edge-highlight")||BC.highlight}}const jC={grid:"rgba(191, 191, 191, 0.15)",axisTick:P[400],cursor:"rgba(255, 255, 255, 0.2)"};function TC(){return"undefined"==typeof window?jC:{grid:dC("--chart-grid")||jC.grid,axisTick:dC("--chart-axis-tick")||jC.axisTick,cursor:dC("--chart-cursor")||jC.cursor}}function PC(){return mC(TC,jC)}function LC(e,t){return dC(`--palette-${e}-${t}`)||""}function RC(){const e=[];for(let t=0;t<24;t++){const n=t/23,a=1-n,s=LC("aqua",[900,800,700,600,500,400,300,200,100,50][Math.min(8,Math.floor(9*a))]),r=parseInt(s.slice(1,3),16)||0,o=parseInt(s.slice(3,5),16)||0,i=parseInt(s.slice(5,7),16)||0,l=Math.round(80+130*n);e.push([r,o,i,l])}return e}function NC(){const e=dC("--signal-excellent")||gC.excellent,t=dC("--signal-good")||gC.good,n=dC("--signal-fair")||gC.fair,a=dC("--signal-poor")||gC.poor,s=dC("--signal-critical")||gC.critical,r=[];for(let o=0;o<24;o++){let i;i=o<5?e:o<10?t:o<15?n:o<20?a:s,r.push(i)}return r}function zC(){const e=hC("--signal-excellent")||gC.excellent,t=hC("--signal-good")||gC.good,n=hC("--signal-fair")||gC.fair,a=hC("--signal-poor")||gC.poor,s=hC("--signal-critical")||gC.critical,r=[];for(let o=0;o<24;o++){let i;i=o<5?e:o<10?t:o<15?n:o<20?a:s,r.push(i)}return r}function _C(){const[e,t]=s.useState(()=>NC());return s.useEffect(()=>{const e=()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t(NC())})})};return e(),cC.subscribe(e)},[]),e}function IC(e){const t=(Math.max(-12,Math.min(12,e))- -12)/24;return Math.round(23*(1-t))}const VC={...T};function OC(){return"undefined"==typeof window?VC:{red:hC("--sys-red")||VC.red,orange:hC("--sys-orange")||VC.orange,amber:hC("--sys-amber")||VC.amber,yellow:hC("--sys-yellow")||VC.yellow,brown:hC("--sys-brown")||VC.brown,green:hC("--sys-green")||VC.green,teal:hC("--sys-teal")||VC.teal,cyan:hC("--sys-cyan")||VC.cyan,blue:hC("--sys-blue")||VC.blue,indigo:hC("--sys-indigo")||VC.indigo,purple:hC("--sys-purple")||VC.purple,pink:hC("--sys-pink")||VC.pink}}function $C(){const e=s.useCallback(()=>"undefined"==typeof document||"light"!==document.documentElement.dataset.mode,[]),[t,n]=s.useState(e);return s.useEffect(()=>(n(e()),cC.subscribe(()=>n(e()))),[e]),t}function qC(){return"undefined"==typeof document||"light"!==document.documentElement.dataset.mode}let UC=null,WC=0;function HC(){const e=performance.now();if(UC&&e-WC<1e3)return UC;const t=getComputedStyle(document.documentElement),n=t.getPropertyValue("--font-data").trim()||'"JetBrains Mono", ui-monospace, monospace',a="light"!==document.documentElement.dataset.mode,s=t.getPropertyValue("--text-primary").trim()||(a?"#FFFFFF":"#1A1A1A"),r=t.getPropertyValue("--text-secondary").trim()||(a?"#BFBFBF":"#4A4A4A"),o=t.getPropertyValue("--chart-grid").trim()||(a?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.06)");return UC={fontFamily:n,textPrimary:s,textSecondary:r,gridColor:o},WC=e,UC}function YC(e){const t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}let GC=null,KC=0;function XC(e,t){return"airtime"===t?`${e}%`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function JC(e,t,n,a,s,r,o,i,l,c,u,d=.9,h=!1,m,p){if(0===t.length)return;const g=m??t[0].timestamp,f=(p??t[t.length-1].timestamp)-g||1;if(e.save(),e.strokeStyle=`rgba(${a.r}, ${a.g}, ${a.b}, ${d})`,e.lineWidth=u*c,e.lineCap="round",e.lineJoin="round",h){e.beginPath();let a=!1,c=0,u=0;for(let d=0;d{u.current=e,d.current=t,h.current=n,m.current=a,f.current=o,y.current=i}),s.useEffect(()=>{p.current=HC()},[]);const b=s.useMemo(()=>0===e.length?[[0],[0]]:[e.map(e=>e.timestamp),e.map(()=>1)],[e]),v=s.useMemo(()=>({hooks:{draw:e=>{const t=p.current||HC();!function(e,t,n,a,s,r,o,i){if(0===t.length)return;const l=e.ctx,{left:c,top:u,width:d,height:h}=e.bbox,m=window.devicePixelRatio||1;if(d<=0||h<=0)return;const p=function(){const e=performance.now();return GC&&e-KC<1e3||(GC=OC(),KC=e),GC}(),g=YC(p.blue),f=YC(p.red),y=YC(p.yellow),b=(v=n,"airtime"===a?v<=5?1:v<=10?2:v<=20?5:Math.ceil(v/5):v<=100?25:v<=500?100:v<=1e3?200:v<=5e3?1e3:v<=1e4?2e3:1e3*Math.ceil(v/5e3));var v;l.save(),l.strokeStyle=s.textSecondary,l.globalAlpha=.3,l.lineWidth=1*m,l.setLineDash([3*m,3*m]);for(let C=b;Cn+s||(e.save(),e.strokeStyle=i.textPrimary,e.globalAlpha=.5,e.lineWidth=1*o,e.setLineDash([4*o,4*o]),e.beginPath(),e.moveTo(Math.round(t)+.5,a),e.lineTo(Math.round(t)+.5,a+r),e.stroke(),e.restore()))}(l,r,c,u,d,h,m,s),JC(l,t,"rxSmooth",y,c,u,d,h,n,m,2,1,!0,o,i),JC(l,t,"tx",f,c,u,d,h,n,m,2.5,.9,!1,o,i),JC(l,t,"rx",g,c,u,d,h,n,m,2.5,.9,!1,o,i)}(e,u.current,h.current,d.current,t,g.current,f.current,y.current)}}}),[]),w=s.useMemo(()=>({width:400,height:200,padding:[8,8,8,44],cursor:{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],plugins:[v]}),[v]);s.useEffect(()=>{const t=l.current;if(!t||0===e.length)return;c.current&&c.current.destroy();const n=t.getBoundingClientRect(),a=Math.floor(n.width)||400,s=Math.floor(n.height)||200,r=new us({...w,width:a,height:s},b,t);return c.current=r,()=>{r.destroy(),c.current=null}},[w,b,e.length]),s.useEffect(()=>{const e=l.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!c.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&c.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{c.current&&c.current.redraw()},[e,n,t]);const C=s.useCallback(t=>{var n,a;const s=l.current,r=c.current;if(!s||!r||0===e.length)return;const o=s.getBoundingClientRect(),i=t.clientX-o.left,u=window.devicePixelRatio||1,d=r.bbox,h=d.left/u,p=d.width/u;if(ih+p)return g.current=null,r.redraw(),void(null==(n=m.current)||n.call(m,null));g.current=i*u;const f=(i-h)/p,y=Math.floor(f*e.length),b=Math.max(0,Math.min(e.length-1,y));r.redraw(),null==(a=m.current)||a.call(m,b)},[e.length]),k=s.useCallback(()=>{var e;g.current=null,c.current&&c.current.redraw(),null==(e=m.current)||e.call(m,null)},[]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No data available"}):r.jsx("div",{ref:l,className:"w-full h-full rounded-lg overflow-hidden",onMouseMove:C,onMouseLeave:k})}),QC=[{name:"Dashboard",to:"/",icon:mr},{name:"Contacts",to:"/contacts",icon:yr},{name:"Packets",to:"/packets",icon:pr},{name:"Room Server",to:"/room-server",icon:vr},{name:"Statistics",to:"/statistics",icon:sr},{name:"MeshGraph",to:"/meshgraph",icon:Sr},{name:"System",to:"/system",icon:ur},{name:"Logs",to:"/logs",icon:cr},{name:"Terminal",to:"/terminal",icon:Fr},{name:"Configuration",to:"/configuration",icon:Ar}];function ek(){var e,t,n,a,o,l;const{pathname:c}=E(),u=B(),{stats:d,setMode:h,setDutyCycle:m,sendAdvert:p}=qb(),g=ag(),f=$b(e=>e.prefetchForRoute),y=ov(),b=$b(e=>e.packetCacheState.dataTier),v=uv(),w=Math.max(1,Math.ceil(rb[v].minutes/60)),C=xv(),k=Yv(),x=hw(),D=Pv(e=>e.unreadCount);let A=null;try{A=function(){const e=s.useContext(dp);if(!e)throw new Error("useSidebar must be used within a SidebarLayout");return e}()}catch{}const[F,S]=s.useState(!1),[M,j]=s.useState("idle"),[T,P]=s.useState(null),[L,R]=s.useState([]),N=s.useRef(null),z=s.useCallback(e=>{e!==c&&(N.current&&clearTimeout(N.current),N.current=setTimeout(()=>{f(e)},100))},[c,f]),_=s.useCallback(()=>{N.current&&(clearTimeout(N.current),N.current=null)},[]);s.useEffect(()=>{const e=async()=>{var e;try{const t=await vg(w);t.success&&(null==(e=t.data)?void 0:e.history)&&R(t.data.history)}catch{}};e();const t=setInterval(e,6e4);return()=>clearInterval(t)},[w]);const I=null==d?void 0:d.noise_floor_dbm,V=(null==(t=null==(e=null==d?void 0:d.config)?void 0:e.repeater)?void 0:t.mode)??"forward",O=(null==(a=null==(n=null==d?void 0:d.config)?void 0:n.duty_cycle)?void 0:a.enforcement_enabled)??!1,$=(null==(l=null==(o=null==d?void 0:d.config)?void 0:o.duty_cycle)?void 0:l.max_airtime_percent)??10,q=y.isLoading||y.isBackgroundLoading||y.isTopologyLoading,U=q||C||k,W=y.loadProgress,H=s.useCallback((e,t)=>{e.preventDefault(),null==A||A.close(),u(t)},[u,A]);return r.jsxs(ap,{children:[r.jsxs(sp,{className:"px-5 pt-3 pb-4",children:[r.jsx("h1",{className:"sr-only",children:"pyMC Console"}),r.jsxs("span",{className:"inline-flex self-start px-1.5 py-0.5 rounded text-[10px] font-medium tabular-nums bg-zinc-500/10 text-fg-muted mb-1",children:["v",zp]}),r.jsx(Ip,{responsive:!0,className:"block"})]}),r.jsxs(rp,{className:"pt-[13px] pb-4",children:[r.jsx(ip,{children:QC.map(e=>{const t=c===e.to,n="/terminal"===e.to,a="#6545EE";return r.jsxs(lp,{href:e.to,current:t,accentColor:n?a:void 0,onClick:t=>H(t,e.to),onMouseEnter:()=>z(e.to),onMouseLeave:_,children:[r.jsxs("span",{className:"relative",children:[r.jsx(e.icon,{className:i("size-[19px]",t&&!n&&"text-sys-blue"),style:t&&n?{color:a}:void 0}),"/room-server"===e.to&&D>0&&r.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-sys-red ring-2 ring-body"})]}),r.jsx(cp,{children:e.name}),"/contacts"===e.to&&x.length>0&&r.jsxs(up,{variant:"accent",children:[r.jsx(dr,{className:"w-3 h-3"}),r.jsx("span",{children:x.length})]}),"/meshgraph"===e.to&&r.jsx(up,{variant:"default",children:"Beta"})]},e.name)})}),U&&r.jsx("div",{className:"px-0 py-3",children:r.jsx(vv,{isLoading:q,borderRadius:12,children:r.jsxs("div",{className:"bg-surface/50 rounded-xl p-2",children:[r.jsxs("div",{className:"flex items-center gap-2 px-1 py-0.5",children:[r.jsxs("div",{className:"relative flex h-2 w-2",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-sys-blue opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-sys-blue"})]}),r.jsx("span",{className:"type-data-xs text-fg-muted flex-1 truncate",children:y.isLoading&&W?"Loading 24h history...":y.isBackgroundLoading&&W?y.statusMessage||`Loading ${b} history...`:y.isTopologyLoading?"Loading topology data...":C?"Computing sparklines":k?"Building topology":"Analyzing database"}),null!==(null==W?void 0:W.percent)&&void 0!==(null==W?void 0:W.percent)&&q&&r.jsxs("span",{className:"type-data-xs text-fg-muted",children:[W.percent,"%"]})]}),r.jsx("div",{className:"mt-1.5 h-1 bg-subtle-fill rounded-full overflow-hidden",children:null!==(null==W?void 0:W.percent)&&void 0!==(null==W?void 0:W.percent)&&q?r.jsx("div",{className:"h-full bg-sys-blue/60 rounded-full transition-all duration-300 ease-out",style:{width:`${W.percent}%`}}):r.jsx("div",{className:"h-full bg-sys-blue/40 rounded-full w-full"})}),!q&&r.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 px-1",children:[r.jsx("span",{className:"type-micro text-fg-muted",children:"Data:"}),r.jsx("span",{className:"type-data-xs text-sys-blue",children:(e=>{switch(e){case"24h":return"24 hours";case"3d":return"3 days";case"7d":return"7 days";case"14d":return"14 days";default:return e}})(b)})]})]})})}),r.jsx("div",{className:"flex-1"}),r.jsx(Dp,{label:"Controls",icon:r.jsx(Br,{className:"w-5 h-5 text-sys-blue"}),defaultOpen:!1,direction:"up",dataId:"controls",children:r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(Js,{color:"success"===M?"success":"error"===M?"danger":"primary",onClick:async()=>{S(!0),j("idle"),P(null);const e=await p();S(!1),e.success?(j("success"),setTimeout(()=>j("idle"),1500)):(j("error"),P(e.error||"Failed to send"),setTimeout(()=>{j("idle"),P(null)},3e3))},disabled:F,className:"w-full justify-center",children:F?r.jsxs(r.Fragment,{children:[r.jsxs("svg",{"data-slot":"icon",className:"animate-spin",viewBox:"0 0 24 24",fill:"none",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Sending..."]}):"success"===M?r.jsxs(r.Fragment,{children:[r.jsx("svg",{"data-slot":"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Sent!"]}):"error"===M?r.jsxs(r.Fragment,{children:[r.jsxs("svg",{"data-slot":"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),"Failed"]}):r.jsxs(r.Fragment,{children:[r.jsx(Dr,{"data-slot":"icon"}),"Send Advert"]})}),T&&r.jsx("p",{className:"text-sys-red text-xs text-center",children:T}),r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-xs text-fg-muted",children:"Repeat"}),r.jsx("span",{className:i("text-xs font-medium","forward"===V?"text-sys-green":"text-sys-indigo"),children:"forward"===V?"ON":"OFF"})]}),r.jsx(Js,{color:"forward"===V?"success":"warning",onClick:()=>{h("forward"===V?"monitor":"forward")},className:"w-full justify-center",children:"forward"===V?r.jsxs(r.Fragment,{children:[r.jsx(kr,{"data-slot":"icon"}),"Repeating"]}):r.jsxs(r.Fragment,{children:[r.jsx(Cr,{"data-slot":"icon"}),"Monitor Only"]})}),r.jsxs("div",{className:"flex items-center justify-between gap-2 mt-1",children:[r.jsx("span",{className:"text-xs text-fg-muted",children:"Duty Cycle"}),r.jsx("span",{className:i("text-xs font-medium tabular-nums",O?"text-sys-indigo":"text-fg-muted"),children:O?`${$}%`:"OFF"})]}),r.jsxs(Js,{color:O?"warning":"muted",onClick:()=>{m(!O)},className:"w-full justify-center",children:[r.jsx(ur,{"data-slot":"icon"}),O?`Limited to ${$}%`:"Disabled"]})]})})]}),r.jsx(op,{children:r.jsxs("div",{className:"p-3 flex flex-col gap-1",children:[void 0!==(null==d?void 0:d.uptime_seconds)&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[r.jsx(ir,{className:"w-5 h-5 text-fg-muted flex-shrink-0"}),r.jsxs("span",{className:"type-data-xs text-fg-secondary",children:[bw(d.uptime_seconds)," uptime"]})]}),r.jsxs("div",{className:"flex items-center gap-3 px-3 pt-2 pb-0.5",children:[r.jsx(xr,{className:"w-5 h-5 text-sys-blue flex-shrink-0"}),r.jsx("span",{className:"type-data-xs text-fg-muted",children:"Noise Floor"}),r.jsx("span",{className:"ml-auto type-data text-fg-primary tabular-nums",children:null!=I?`${I.toFixed(0)} dBm`:"—"})]}),L.length>0&&r.jsx("div",{className:"pt-1 pb-1",children:r.jsx("div",{className:"relative radius-inner bg-zinc-500/10 ring-1 ring-inset ring-edge-subtle overflow-hidden py-2",children:r.jsx(nC,{timestamps:L.map(e=>e.timestamp),values:L.map(e=>e.noise_floor_dbm),compact:!0,height:28})})}),r.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[r.jsx(yv,{showLabel:!0}),(null==d?void 0:d.version)&&r.jsxs("span",{className:"type-data-xs text-fg-muted truncate",title:`v${d.version}`,children:["v",d.version]})]}),r.jsxs("button",{onClick:()=>{Jp(),window.location.href="/login"},className:"group flex items-center gap-3 px-3 py-2 radius-inner bg-zinc-500/10 ring-1 ring-inset ring-edge-subtle hover:bg-sys-red hover:ring-sys-red text-fg-muted hover:!text-black transition-all duration-150",children:[r.jsx(fr,{className:"w-5 h-5 flex-shrink-0"}),r.jsx("span",{className:"type-body-sm group-hover:!text-black",children:"Sign Out"}),g&&r.jsxs("span",{className:"ml-auto type-data-xs group-hover:!text-black",children:["(",g,")"]})]})]})})]})}function tk(){const e=ov(),t=e.isLoading||e.isBackgroundLoading||e.isTopologyLoading;return r.jsxs(gp,{children:[r.jsxs(fp,{children:[r.jsx("h1",{className:"sr-only",children:"pyMC Console"}),r.jsx(Ip,{height:26,className:"block"}),t&&r.jsx(wv,{className:"ml-2"})]}),r.jsx(yp,{}),r.jsxs(fp,{children:[r.jsxs("p",{className:"type-data-xs text-fg-muted",children:["v",zp]}),r.jsx(yv,{})]})]})}const nk=s.memo(function(){const{theme:e}=Cs(),{themeId:t,brightness:n}=e,a=W(t),s=null==a?void 0:a.meta.backgroundImage,o=null==a?void 0:a.meta.backgroundColor,i=(100-n)/100;return r.jsxs(r.Fragment,{children:[s?r.jsx("div",{className:"fixed inset-0 -z-20",style:{contain:"paint"},"aria-hidden":"true",children:r.jsx("div",{className:"absolute inset-0 bg-cover bg-center bg-no-repeat transition-opacity duration-300 ease-out",style:{backgroundImage:`url(${s})`}})}):o?r.jsx("div",{className:"fixed inset-0 -z-20 transition-colors duration-300 ease-out",style:{backgroundColor:o,contain:"paint"},"aria-hidden":"true"}):null,r.jsx("div",{className:"fixed inset-0 -z-10 bg-black pointer-events-none transition-opacity duration-200 ease-out",style:{opacity:i,contain:"paint"},"aria-hidden":"true"})]})}),ak=20,sk=12,rk=s.createContext(null);function ok({children:e}){const[t,n]=s.useState({content:null,mouseX:0,mouseY:0,visible:!1}),a=s.useRef(null),[o,i]=s.useState({x:0,y:0}),l=s.useCallback((e,t,a)=>{n({content:e,mouseX:t,mouseY:a,visible:!0})},[]),c=s.useCallback(()=>{n(e=>({...e,visible:!1}))},[]),u=s.useCallback((e,t)=>{n(n=>n.visible?{...n,mouseX:e,mouseY:t}:n)},[]);s.useEffect(()=>{if(!t.visible||!a.current)return;const e=a.current.getBoundingClientRect(),{mouseX:n,mouseY:s}=t,r=window.innerWidth,o=window.innerHeight;let l,c;l=n+ak+e.width+sk>r?n-ak-e.width:n+ak,l=Math.max(sk,Math.min(l,r-e.width-sk)),c=s-ak-e.height{c.current&&(clearTimeout(c.current),c.current=null)},h=s.useCallback(t=>{d(),c.current=setTimeout(()=>{u.current=!0,a(e,t.clientX,t.clientY)},n)},[a,e,n]),m=s.useCallback(e=>{u.current&&i(e.clientX,e.clientY)},[i]),p=s.useCallback(()=>{d(),u.current=!1,o()},[o]),g=s.useCallback(()=>{if(d(),!l.current)return;const t=l.current.getBoundingClientRect();c.current=setTimeout(()=>{u.current=!0,a(e,t.left+t.width/2,t.top)},n)},[a,e,n]),f=s.useCallback(()=>{d(),u.current=!1,o()},[o]);return s.useEffect(()=>()=>{d(),u.current&&(u.current=!1,o())},[o]),s.useEffect(()=>{const e=()=>{u.current&&(d(),u.current=!1,o())};return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)},[o]),r.jsx("span",{ref:l,onMouseEnter:h,onMouseMove:m,onMouseLeave:p,onFocus:g,onBlur:f,className:"contents",children:t})}function lk({label:e}){return r.jsx("div",{className:"min-h-[50vh]","aria-label":`Loading ${e}`,"aria-busy":"true"})}function ck(){return r.jsx(lk,{label:"dashboard"})}function uk(){return r.jsx(lk,{label:"list"})}function dk(){return r.jsx(lk,{label:"map"})}function hk(){return r.jsx(lk,{label:"charts"})}function mk(){return r.jsx(lk,{label:"settings"})}function pk(){return r.jsx(lk,{label:"system"})}function gk({children:e}){return r.jsx(r.Fragment,{children:e})}const fk=s.lazy(()=>k(()=>import("./Login-CQwX9eZS.js"),__vite__mapDeps([0,1,2,3,4]))),yk=s.lazy(()=>k(()=>import("./Dashboard-CLZ_2cdd.js"),__vite__mapDeps([5,1,6,7,8,9,10,11,12,3,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,4]))),bk=s.lazy(()=>k(()=>import("./Packets-CKR_k_Es.js"),__vite__mapDeps([37,1,12,3,13,10,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,9,38,6,39,30,4]))),vk=s.lazy(()=>k(()=>import("./Contacts-CiTyOtpU.js").then(e=>e.C),__vite__mapDeps([40,1,41,10,6,42,30,22,16,17,43,44,26,23,19,39,45,38,21,27,15,46,47,3,14,35,48,49,4]))),wk=s.lazy(()=>k(()=>import("./Statistics-BaT7n0oZ.js"),__vite__mapDeps([50,1,51,24,52,8,9,6,23,19,46,47,3,22,21,30,25,43,31,26,10,39,35,49,13,36,53,48,4]))),Ck=s.lazy(()=>k(()=>import("./MeshGraph-LoEY91Ly.js"),__vite__mapDeps([54,1,55,56,43,28,23,19,14,11,44,24,49,53,20,48,3,4]))),kk=s.lazy(()=>k(()=>import("./System-iTOQgR9S.js"),__vite__mapDeps([57,1,6,22,30,18,48,26,58,36,3,4]))),xk=s.lazy(()=>k(()=>import("./Logs-Df-7DFJ4.js"),__vite__mapDeps([59,1,51,6,30,3,4]))),Dk=s.lazy(()=>k(()=>import("./Terminal-CKx-DNJQ.js"),__vite__mapDeps([60,1,61,17,56,41,3,13,62,63,64,2,6,49,20,4,65]))),Ak=s.lazy(()=>k(()=>import("./Configuration-CIgGarXY.js"),__vite__mapDeps([66,1,62,45,22,67,7,33,6,23,19,30,64,36,68,27,58,20,3,4]))),Ek=s.lazy(()=>k(()=>import("./RoomServer-tW8KnEnb.js"),__vite__mapDeps([69,1,6,36,42,45,22,21,63,64,34,15,30,70,68,19,38,3,4])));function Bk({children:e}){const t=E();return Zp()?r.jsx(r.Fragment,{children:e}):r.jsx(M,{to:"/login",state:{from:t},replace:!0})}class Fk extends s.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){var e;return this.state.hasError?r.jsxs("div",{className:"surface-base rounded-2xl p-8 text-center",children:[r.jsx("p",{className:"type-subheading text-sys-red mb-2",children:"Page failed to render"}),r.jsx("p",{className:"type-body text-fg-muted mb-4",children:(null==(e=this.state.error)?void 0:e.message)||"Unknown error"}),r.jsx("button",{onClick:()=>this.setState({hasError:!1}),className:"px-4 py-2 bg-sys-blue/20 text-sys-blue rounded-lg hover:bg-sys-blue/30 transition-colors",children:"Try Again"})]}):this.props.children}}function Sk(){const e=$b(e=>e.initializeApp),t=Zp();return s.useEffect(()=>{if(!t)return;e(),pf.getState().initialize(),Pv.getState().initialize();const n=setInterval(()=>{ig()},3e4);return ig(),function(){if(lg)return;if("undefined"==typeof document)return;const e=async()=>{if("visible"!==document.visibilityState)return;if(!Kp())return;if(eg())return Jp(),void("undefined"==typeof window||window.location.pathname.includes("/login")||(window.location.href="/login"));const e=tg();e>0&&e<300&&await rg()};document.addEventListener("visibilitychange",e),lg=!0,"visible"===document.visibilityState&&e()}(),()=>clearInterval(n)},[e,t]),r.jsxs(ok,{children:[r.jsx(nk,{}),r.jsxs(F,{children:[r.jsx(S,{path:"/login",element:r.jsx(s.Suspense,{fallback:r.jsx("div",{className:"min-h-screen bg-body"}),children:r.jsx(fk,{})})}),r.jsx(S,{path:"/*",element:r.jsx(Bk,{children:r.jsx(pp,{sidebar:r.jsx(ek,{}),navbar:r.jsx(tk,{}),children:r.jsx("div",{className:"px-1 sm:px-4 lg:px-4 pt-5 pb-4 sm:pb-6 lg:pb-8 max-w-7xl mx-auto",children:r.jsx(Fk,{children:r.jsxs(F,{children:[r.jsx(S,{path:"/",element:r.jsx(s.Suspense,{fallback:r.jsx(ck,{}),children:r.jsx(gk,{children:r.jsx(yk,{})})})}),r.jsx(S,{path:"/packets",element:r.jsx(s.Suspense,{fallback:r.jsx(uk,{}),children:r.jsx(gk,{children:r.jsx(bk,{})})})}),r.jsx(S,{path:"/contacts",element:r.jsx(s.Suspense,{fallback:r.jsx(dk,{}),children:r.jsx(gk,{children:r.jsx(vk,{})})})}),r.jsx(S,{path:"/statistics",element:r.jsx(s.Suspense,{fallback:r.jsx(hk,{}),children:r.jsx(gk,{children:r.jsx(wk,{})})})}),r.jsx(S,{path:"/meshgraph",element:r.jsx(s.Suspense,{fallback:r.jsx(hk,{}),children:r.jsx(gk,{children:r.jsx(Ck,{})})})}),r.jsx(S,{path:"/system",element:r.jsx(s.Suspense,{fallback:r.jsx(pk,{}),children:r.jsx(gk,{children:r.jsx(kk,{})})})}),r.jsx(S,{path:"/logs",element:r.jsx(s.Suspense,{fallback:r.jsx(uk,{}),children:r.jsx(gk,{children:r.jsx(xk,{})})})}),r.jsx(S,{path:"/terminal",element:r.jsx(s.Suspense,{fallback:r.jsx(uk,{}),children:r.jsx(gk,{children:r.jsx(Dk,{})})})}),r.jsx(S,{path:"/room-server",element:r.jsx(s.Suspense,{fallback:r.jsx(uk,{}),children:r.jsx(gk,{children:r.jsx(Ek,{})})})}),r.jsx(S,{path:"/configuration",element:r.jsx(s.Suspense,{fallback:r.jsx(mk,{}),children:r.jsx(gk,{children:r.jsx(Ak,{})})})})]})})})})})})]})]})}const Mk=console.warn;console.warn=(...e)=>{const t=e[0];"string"==typeof t&&t.includes("Unable to load glyph range")||Mk.apply(console,e)},x.createRoot(document.getElementById("root")).render(r.jsx(s.StrictMode,{children:r.jsx(ws,{children:r.jsx(j,{children:r.jsx(Sk,{})})})}));export{mv as $,kh as A,Js as B,Np as C,rb as D,vg as E,cv as F,kb as G,ik as H,jp as I,Qy as J,tb as K,gr as L,nb as M,sb as N,vw as O,Vf as P,dv as Q,xr as R,Nw as S,Fp as T,zw as U,ff as V,Ym as W,Xm as X,or as Y,P as Z,Wb as _,np as a,ub as a$,ov as a0,kg as a1,sr as a2,xs as a3,Ds as a4,Mr as a5,ic as a6,Zl as a7,Tr as a8,Lr as a9,bp as aA,rw as aB,dw as aC,dr as aD,wr as aE,Ew as aF,lw as aG,qb as aH,rv as aI,Uv as aJ,Wv as aK,aw as aL,sw as aM,hv as aN,kv as aO,pv as aP,OC as aQ,pg as aR,gg as aS,ZC as aT,Ls as aU,lC as aV,fs as aW,_C as aX,wC as aY,CC as aZ,$C as a_,sy as aa,ry as ab,oy as ac,Vs as ad,xw as ae,Ns as af,zs as ag,qs as ah,Ab as ai,Om as aj,Ah as ak,Of as al,Cw as am,ir as an,Ky as ao,Dr as ap,NC as aq,IC as ar,tw as as,Hv as at,uw as au,eb as av,Hs as aw,Bw as ax,kw as ay,As as az,Zm as b,bf as b$,iw as b0,cw as b1,hr as b2,hw as b3,Sr as b4,xg as b5,ob as b6,cb as b7,nC as b8,Cb as b9,Kb as bA,Jb as bB,Zb as bC,cr as bD,db as bE,mb as bF,cC as bG,yg as bH,Ag as bI,Fg as bJ,jg as bK,Mg as bL,Sg as bM,iy as bN,Tg as bO,Pg as bP,cg as bQ,Km as bR,ep as bS,Qm as bT,gf as bU,ag as bV,pf as bW,Fr as bX,hg as bY,yf as bZ,Ef as b_,tp as ba,vr as bb,zp as bc,Db as bd,Es as be,qv as bf,mw as bg,yw as bh,pw as bi,nw as bj,T as bk,Cr as bl,kr as bm,ww as bn,Sp as bo,qC as bp,lr as bq,L as br,ev as bs,tv as bt,nv as bu,av as bv,Qb as bw,bw as bx,Eg as by,Gb as bz,ar as c,uC as c$,vf as c0,wf as c1,Cf as c2,ny as c3,ey as c4,ty as c5,Ly as c6,ly as c7,cy as c8,$f as c9,Rf as cA,Mf as cB,jf as cC,Xf as cD,Kf as cE,Gf as cF,Yf as cG,Qf as cH,Cs as cI,U as cJ,hf as cK,Ar as cL,Br as cM,Dw as cN,Aw as cO,Tp as cP,Jm as cQ,Pv as cR,Lv as cS,Rv as cT,Vv as cU,Ov as cV,Nv as cW,zv as cX,_v as cY,Iv as cZ,zC as c_,jy as ca,Wf as cb,uy as cc,Py as cd,Fy as ce,Sy as cf,My as cg,qf as ch,Hf as ci,Uf as cj,Ty as ck,ay as cl,Jf as cm,Zf as cn,Yy as co,Gy as cp,If as cq,_f as cr,Lf as cs,Ff as ct,Bf as cu,zf as cv,Pf as cw,Tf as cx,Sf as cy,Nf as cz,us as d,EC as d0,MC as d1,xC as d2,RC as d3,Gg as d4,xb as d5,Ev as d6,xv as d7,lv as d8,rf as d9,Su as dA,vh as dB,uo as dC,Md as dD,Yv as dE,Gv as dF,vv as dG,Qr as da,mo as db,nu as dc,$c as dd,Ph as de,hh as df,Gl as dg,xc as dh,ci as di,zr as dj,Ql as dk,Ii as dl,Ai as dm,_i as dn,Al as dp,Kr as dq,Yr as dr,Ic as ds,Vc as dt,Vu as du,Tu as dv,Hc as dw,Ed as dx,rc as dy,Ni as dz,Tw as e,lb as f,Hp as g,wp as h,Zp as i,Ws as j,ow as k,sg as l,Nm as m,Bg as n,rr as o,Hb as p,Yb as q,Xb as r,Yp as s,Ub as t,PC as u,ab as v,yv as w,iv as x,sv as y,uv as z}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Login-Q9eTfSur.js","assets/vendor-react-j_fHog8x.js","assets/ascii-burst-CXC_pYgi.js","assets/vendor-core-CmkNwW1A.js","assets/maplibre-gl-B1CfjdFi.css","assets/Dashboard-D9ScohcH.js","assets/PageLayout-CYYy29Pg.js","assets/sun-GNUT-ucn.js","assets/TimeRangeSelector-P4ymVxf5.js","assets/index-CCvUM2Hn.js","assets/node-types-CuQMppbD.js","assets/meshcore-tx-constants-BDLT5LMb.js","assets/PacketList-Bo8AKcoq.js","assets/payload-decoders-C74LtYDG.js","assets/badge-colors-YAE4qQ7m.js","assets/chat-utils-I8bC4Iy5.js","assets/SignalIndicator-BnBRvoqf.js","assets/signal-scoring-CcBiRcks.js","assets/arrow-up-B5IQoVJ5.js","assets/copy-C_IB0gEd.js","assets/chevron-right-B6r5SVTI.js","assets/map-pin-FZNiPp_L.js","assets/triangle-alert-DH80WgOo.js","assets/DataBox-B8dpvpbW.js","assets/layers-BSSTaBST.js","assets/route-lCtw8lWd.js","assets/activity-_XXDiQ1M.js","assets/circle-check-DI0_62yI.js","assets/database-CO202xKy.js","assets/DelayedAnimateNumber-CRcNKpk-.js","assets/Card-QO4sXDu0.js","assets/LightSparkline-BCL2qx0n.js","assets/link-scoring-BHmEi4Ug.js","assets/NodeInformationCard-DQTRuz7_.js","assets/ChatBubble-DX1ocHRQ.js","assets/message-square-Dq5-N0aR.js","assets/Grid-OFJ4oe0a.js","assets/Packets-B6m1oZw5.js","assets/users-DuzW_tmB.js","assets/funnel-Bb7d8E3s.js","assets/Contacts-DbMN-LnJ.js","assets/ping-CZgZ44Jt.js","assets/listbox-BsuBKhOY.js","assets/git-branch-CaPGs8Pg.js","assets/target-MKB3Qhi3.js","assets/ConfirmModal-CX0HrTOx.js","assets/CollisionExplorerModal-CbOUGWmc.js","assets/BasemapLayer-BT1oL_wV.js","assets/network-C6ho6RSo.js","assets/search-Cs3jReDi.js","assets/Statistics-D9WTXlwy.js","assets/usePolling-B1kG3uqm.js","assets/easing-DWvlCTyt.js","assets/settings-2-YxRSYOZ0.js","assets/MeshGraph-7WLMHygh.js","assets/DeepAnalysisModal--yROqPOt.js","assets/geo-utils-BJfOkt8p.js","assets/System-Bl85VsR1.js","assets/refresh-cw-BJopKEHj.js","assets/Logs-B5-CJrX4.js","assets/Terminal-BvORGL-y.js","assets/xterm-Cq-DlOOL.js","assets/system-7wpk3UyT.js","assets/KeycapButton-Dvk7y-ZW.js","assets/keycap-sfx-CAsrNe23.js","assets/xterm-6GBZ9nXN.css","assets/Configuration-ribtJFkN.js","assets/font-loader-BQzEmDrZ.js","assets/key-round-0eVrrV09.js","assets/RoomServer-B0PNcG8D.js","assets/wifi-BGoUD8Dj.js"])))=>i.map(i=>d[i]); +var e,t,n=Object.defineProperty,a=(e,t,a)=>((e,t,a)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a)(e,"symbol"!=typeof t?t+"":t,a);import{r as s,j as r,b as o,c as i,L as l,h as c,z as u,Q as d,y as h,x as m,X as p,d as g,e as f,W as y,t as b,Z as v,M as w,K as C,_ as k,f as x}from"./vendor-react-j_fHog8x.js";import{L as D,c as A,u as E,a as B,R as F,b as S,N as M,B as j}from"./vendor-core-CmkNwW1A.js";import"./maplibre-gl-b91ci4Kr.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const n of e)if("childList"===n.type)for(const e of n.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)}).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();const T={red:"#E5484D",orange:"#F76B15",amber:"#FFB224",yellow:"#F5D90A",brown:"#AD7F58",green:"#46A758",teal:"#12A594",cyan:"#00A2C7",blue:"#3B82F6",indigo:"#5B5BD6",purple:"#8E4EC6",pink:"#D6409F"},P={50:"#fafafa",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"};function L(e){const t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}const R={surfaces:{defaults:{tint:"#252525",light:"#ffffff",dark:"#000000",reflexLight:.15,reflexDark:.8,blur:6,blurElevated:8,brightness:1,opacity:8,opacityElevated:12},card:{radius:"1.125rem",padding:"1.25rem",paddingCompact:"0.75rem"},sidebar:{tint:"rgba(113, 156, 223, 0.06)",width:"16rem",drawerWidth:"85vw"},modal:{radius:"1.125rem",backdropBlur:"8px",backdropColor:"rgba(0, 0, 0, 0.6)"}},colors:{bg:{body:P[950],surface:P[900],elevated:P[800],subtle:P[800]},border:{subtle:P[800],strong:P[600]},text:{primary:"#ffffff",secondary:P[400],muted:P[500],inverse:P[950]},accent:{primary:T.blue,secondary:T.purple,tertiary:T.cyan,success:T.green,danger:T.red},signal:{excellent:T.green,good:T.yellow,fair:T.amber,poor:T.orange,critical:T.red,unknown:P[500]},status:{success:T.green,warning:T.amber,danger:T.red,info:T.blue,muted:P[500]},chart:{c1:T.blue,c2:T.teal,c3:T.amber,c4:T.orange,c5:T.pink,c6:T.purple,c7:T.cyan,c8:P[500],grid:"rgba(191, 191, 191, 0.15)",axis:P[400],cursor:"rgba(255, 255, 255, 0.2)"},metric:{received:T.blue,forwarded:T.teal,transmitted:T.orange,dropped:T.red},map:{nodeFill:T.blue,nodeStroke:"rgba(255,255,255,0.9)",hub:T.purple,local:T.amber,neighbor:T.green,mobile:T.orange,room:T.pink,edge:P[700],edgeHover:T.cyan}},typography:{font:{title:"'Inter', system-ui, sans-serif",display:"'Inter', system-ui, sans-serif",mono:"'JetBrains Mono', 'SF Mono', Monaco, monospace"},size:{xs:"0.64rem",sm:"0.8rem",base:"1rem",md:"1.125rem",lg:"1.25rem",xl:"1.563rem",xxl:"1.953rem",hero:"3.052rem"},weight:{normal:400,medium:500,semibold:600,bold:700},leading:{tight:1.1,snug:1.25,normal:1.5},tracking:{tight:"-0.02em",normal:"0",wide:"0.05em"}},spacing:{space:{gap:"1.5rem",gapMobile:"0.75rem",page:"1.5rem",pageMobile:"1rem",section:"2rem"},radius:{sm:"0.5rem",md:"0.875rem",lg:"1.125rem",xl:"1.5rem",pill:"9999px"}},motion:{fast:"0.1s",normal:"0.15s",slow:"0.4s",easing:"ease-out"}};function N(e){const t=e.replace("#","");if(6!==t.length&&3!==t.length)return e;let n,a,s;return 3===t.length?(n=parseInt(t[0]+t[0],16)/255,a=parseInt(t[1]+t[1],16)/255,s=parseInt(t[2]+t[2],16)/255):(n=parseInt(t.slice(0,2),16)/255,a=parseInt(t.slice(2,4),16)/255,s=parseInt(t.slice(4,6),16)/255),`color(display-p3 ${n.toFixed(3)} ${a.toFixed(3)} ${s.toFixed(3)})`}function z(){return"undefined"!=typeof window&&CSS.supports("color","color(display-p3 1 1 1)")}function _(e,t){const n={...e};for(const a of Object.keys(t)){const s=t[a],r=e[a];void 0!==s&&("object"!=typeof s||null===s||Array.isArray(s)||"object"!=typeof r||null===r||Array.isArray(r)?n[a]=s:n[a]=_(r,s))}return n}function I(e){return{meta:e.meta,display:e.display,surfaces:e.surfaces?_(R.surfaces,e.surfaces):R.surfaces,colors:e.colors?_(R.colors,e.colors):R.colors,typography:e.typography?_(R.typography,e.typography):R.typography,spacing:e.spacing?_(R.spacing,e.spacing):R.spacing,motion:e.motion?_(R.motion,e.motion):R.motion}}function V(e){const t=e.replace("#","");return 6===t.length?`${parseInt(t.slice(0,2),16)}, ${parseInt(t.slice(2,4),16)}, ${parseInt(t.slice(4,6),16)}`:"255, 255, 255"}const O={"Breeze Dark":I({meta:{id:"",name:"",dataTheme:"",previewColor:T.blue,backgroundImage:"",backgroundBrightness:100,isDark:!0},display:{font:"Inter, sans-serif",color:P[400],size:1,palette:[[T.blue,T.green,T.amber,T.orange,T.red],[P[950],P[900],P[800],P[700],P[50]]]},typography:{font:{title:"Inter, sans-serif",display:"Inter, sans-serif",mono:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},weight:{normal:400,medium:500,semibold:600,bold:700,badge:700},tracking:{tight:"-0.02em",normal:"0",wide:"0.025em"},badge:{textTransform:"capitalize"}},surfaces:{defaults:{tint:P[900],light:P[700],dark:P[950],reflexLight:0,reflexDark:0,blur:0,blurElevated:0,brightness:1,opacity:100,opacityElevated:100,catalystMode:!0},sidebar:{tint:`${P[800]}80`},card:{radius:"0.5rem"},modal:{radius:"0.75rem"}},colors:{bg:{body:P[950],surface:P[900],elevated:P[800],subtle:P[800]},border:{subtle:P[800],strong:P[600]},text:{primary:"#fff",secondary:P[400],muted:P[500],inverse:P[950]},accent:{primary:T.blue,secondary:T.amber,tertiary:T.cyan,success:T.green,danger:T.red},signal:{excellent:T.green,good:T.yellow,fair:T.amber,poor:T.orange,critical:T.red,unknown:P[500]},status:{success:T.green,warning:T.amber,danger:T.red,info:T.blue,muted:P[500]},chart:{c1:T.blue,c2:T.teal,c3:T.amber,c4:T.orange,c5:T.pink,c6:T.purple,c7:T.cyan,c8:P[500],grid:`${P[50]}0d`,axis:`${P[50]}33`,cursor:`${T.blue}33`},metric:{received:T.blue,forwarded:T.teal,transmitted:T.orange,dropped:T.red},map:{nodeFill:T.blue,nodeStroke:`${P[50]}e6`,hub:T.purple,local:T.amber,neighbor:T.green,mobile:T.orange,room:T.pink,edge:P[700],edgeHover:T.blue}}}),"Breeze Light":I({meta:{id:"",name:"",dataTheme:"",previewColor:T.blue,backgroundImage:"",backgroundColor:"#EFF0F1",backgroundBrightness:100,isDark:!1},display:{font:"Inter, sans-serif",color:P[600],size:1,palette:[[T.blue,T.green,T.amber,T.orange,T.red],["#EFF0F1","#FCFCFC","#DEE0E2",P[500],P[900]]]},typography:{font:{title:"Inter, sans-serif",display:"Inter, sans-serif",mono:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},weight:{normal:400,medium:500,semibold:600,bold:700,badge:700},tracking:{tight:"-0.02em",normal:"0",wide:"0.025em"},badge:{textTransform:"capitalize"}},surfaces:{defaults:{tint:"#FCFCFC",light:P[200],dark:P[400],reflexLight:0,reflexDark:0,blur:0,blurElevated:0,brightness:1,opacity:100,opacityElevated:100,catalystMode:!0},sidebar:{tint:"rgba(0, 0, 0, 0.02)"},card:{radius:"0.5rem"},modal:{radius:"0.75rem"}},colors:{bg:{body:"#EFF0F1",surface:"#FCFCFC",elevated:"#FFFFFF",subtle:"#E3E5E7"},border:{subtle:"#DEE0E2",strong:"#BFC2C5"},text:{primary:P[900],secondary:P[600],muted:P[500],inverse:"#FFFFFF"},accent:{primary:T.blue,secondary:T.amber,tertiary:T.cyan,success:T.green,danger:T.red},signal:{excellent:T.green,good:T.yellow,fair:T.amber,poor:T.orange,critical:T.red,unknown:P[400]},status:{success:T.green,warning:T.amber,danger:T.red,info:T.blue,muted:P[400]},chart:{c1:T.blue,c2:T.teal,c3:T.amber,c4:T.orange,c5:T.pink,c6:T.purple,c7:T.cyan,c8:P[400],grid:`${P[900]}0d`,axis:`${P[900]}80`,cursor:`${T.blue}1a`},metric:{received:T.blue,forwarded:T.teal,transmitted:T.orange,dropped:T.red},map:{nodeFill:T.blue,nodeStroke:"rgba(255,255,255,0.9)",hub:T.purple,local:T.amber,neighbor:T.green,mobile:T.orange,room:T.pink,edge:P[400],edgeHover:T.blue},sidebar:{bg:"rgba(0, 0, 0, 0.02)",navHoverBg:"rgba(0, 0, 0, 0.04)",navActiveBg:"rgba(59, 130, 246, 0.10)",navActiveText:T.blue}}})};function $(e,t){const n=e.toLowerCase();return{...t,meta:{...t.meta,id:n,name:e,dataTheme:n}}}const q=Object.fromEntries(Object.entries(O).map(([e,t])=>[e,$(e,t)])),U=Object.values(q);function W(e){return U.find(t=>t.meta.id===e)}function H(e){return"string"==typeof e&&U.some(t=>t.meta.id===e)}new Map(Object.entries(q));const Y=q["Breeze Dark"],G=Y.meta.id;Y.meta.backgroundImage;const K={themeId:G,brightness:Y.meta.backgroundBrightness},X="pymc-theme-id",J="pymc-bg-brightness",Z="pymc-color-scheme",Q="pymc-background";const ee={50:.97,100:.92,200:.84,300:.73,400:.62,500:.5,600:.4,700:.32,800:.24,900:.16},te=[50,100,200,300,400,500,600,700,800,900],ne=["red","orange","yellow","green","aqua","blue","purple"];function ae(e,t,n){const a=e=>Math.round(Math.max(0,Math.min(255,e))).toString(16).padStart(2,"0");return`#${a(e)}${a(t)}${a(n)}`}function se(e){const t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function re(e){const t=e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055;return Math.round(255*t)}function oe(e,t,n){const a=n*(Math.PI/180),s=t*Math.cos(a),r=t*Math.sin(a),o=e+.3963377774*s+.2158037573*r,i=e-.1055613458*s-.0638541728*r,l=e-.0894841775*s-1.291485548*r,c=o*o*o,u=i*i*i,d=l*l*l,h=-1.2684380046*c+2.6097574011*u-.3413193965*d,m=-.0041960863*c-.7034186147*u+1.707614701*d;return[re(4.0767416621*c-3.3077115913*u+.2309699292*d),re(h),re(m)]}function ie(e){const[t,n,a]=function(e){const t=e.replace("#","");return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}(e),[,s,r]=function(e,t,n){const a=se(e),s=se(t),r=se(n),o=.4122214708*a+.5363325363*s+.0514459929*r,i=.2119034982*a+.6806995451*s+.1073969566*r,l=.0883024619*a+.2817188376*s+.6299787005*r,c=Math.cbrt(o),u=Math.cbrt(i),d=Math.cbrt(l),h=.2104542553*c+.793617785*u-.0040720468*d,m=1.9779984951*c-2.428592205*u+.4505937099*d,p=.0259040371*c+.7827717662*u-.808675766*d,g=Math.sqrt(m*m+p*p);let f=Math.atan2(p,m)*(180/Math.PI);return f<0&&(f+=360),[h,g,f]}(t,n,a),o={};for(const i of te){const e=ee[i],t=s*(1-.3*Math.abs(e-.5)),[n,a,l]=oe(e,t,r);o[i]=ae(n,a,l)}return o}function le(e){return"undefined"==typeof window?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function ce(e,t){"undefined"!=typeof document&&document.documentElement.style.setProperty(e,t)}const ue="u-off",de="u-label",he="width",me="height",pe="top",ge="bottom",fe="left",ye="right",be="#000",ve=be+"0",we="mousemove",Ce="mousedown",ke="mouseup",xe="mouseenter",De="mouseleave",Ae="dblclick",Ee="change",Be="dppxchange",Fe="--",Se="undefined"!=typeof window,Me=Se?document:null,je=Se?window:null,Te=Se?navigator:null;let Pe,Le;function Re(e,t){if(null!=t){let n=e.classList;!n.contains(t)&&n.add(t)}}function Ne(e,t){let n=e.classList;n.contains(t)&&n.remove(t)}function ze(e,t,n){e.style[t]=n+"px"}function _e(e,t,n,a){let s=Me.createElement(e);return null!=t&&Re(s,t),null!=n&&n.insertBefore(s,a),s}function Ie(e,t){return _e("div",e,t)}const Ve=new WeakMap;function Oe(e,t,n,a,s){let r="translate("+t+"px,"+n+"px)";r!=Ve.get(e)&&(e.style.transform=r,Ve.set(e,r),t<0||n<0||t>a||n>s?Re(e,ue):Ne(e,ue))}const $e=new WeakMap;function qe(e,t,n){let a=t+n;a!=$e.get(e)&&($e.set(e,a),e.style.background=t,e.style.borderColor=n)}const Ue=new WeakMap;function We(e,t,n,a){let s=t+""+n;s!=Ue.get(e)&&(Ue.set(e,s),e.style.height=n+"px",e.style.width=t+"px",e.style.marginLeft=a?-t/2+"px":0,e.style.marginTop=a?-n/2+"px":0)}const He={passive:!0},Ye={...He,capture:!0};function Ge(e,t,n,a){t.addEventListener(e,n,a?Ye:He)}function Ke(e,t,n,a){t.removeEventListener(e,n,He)}function Xe(e,t,n,a){let s;n=n||0;let r=(a=a||t.length-1)<=2147483647;for(;a-n>1;)s=r?n+a>>1:gt((n+a)/2),t[s]{let s=-1,r=-1;for(let o=n;o<=a;o++)if(e(t[o])){s=o;break}for(let o=a;o>=n;o--)if(e(t[o])){r=o;break}return[s,r]}}Se&&function e(){let t=devicePixelRatio;Pe!=t&&(Pe=t,Le&&Ke(Ee,Le,e),Le=matchMedia(`(min-resolution: ${Pe-.001}dppx) and (max-resolution: ${Pe+.001}dppx)`),Ge(Ee,Le,e),je.dispatchEvent(new CustomEvent(Be)))}();const Ze=e=>null!=e,Qe=e=>null!=e&&e>0,et=Je(Ze),tt=Je(Qe);function nt(e,t,n,a){let s=Ct(e),r=Ct(t);e==t&&(-1==s?(e*=n,t/=n):(e/=n,t*=n));let o=10==n?kt:xt,i=1==r?yt:gt,l=(1==s?gt:yt)(o(pt(e))),c=i(o(pt(t))),u=wt(n,l),d=wt(n,c);return 10==n&&(l<0&&(u=Vt(u,-l)),c<0&&(d=Vt(d,-c))),a||2==n?(e=u*s,t=d*r):(e=It(e,u),t=_t(t,d)),[e,t]}function at(e,t,n,a){let s=nt(e,t,n,a);return 0==e&&(s[0]=0),0==t&&(s[1]=0),s}const st={mode:3,pad:.1},rt={pad:0,soft:null,mode:0},ot={min:rt,max:rt};function it(e,t,n,a){return Xt(n)?ct(e,t,n):(rt.pad=n,rt.soft=a?0:null,rt.mode=a?3:0,ct(e,t,ot))}function lt(e,t){return null==e?t:e}function ct(e,t,n){let a=n.min,s=n.max,r=lt(a.pad,0),o=lt(s.pad,0),i=lt(a.hard,-At),l=lt(s.hard,At),c=lt(a.soft,At),u=lt(s.soft,-At),d=lt(a.mode,0),h=lt(s.mode,0),m=t-e,p=kt(m),g=vt(pt(e),pt(t)),f=kt(g),y=pt(f-p);(m<1e-24||y>10)&&(m=0,0!=e&&0!=t||(m=1e-24,2==d&&c!=At&&(r=0),2==h&&u!=-At&&(o=0)));let b=m||g||1e3,v=kt(b),w=wt(10,gt(v)),C=Vt(It(e-b*(0==m?0==e?.1:1:r),w/10),24),k=e>=c&&(1==d||3==d&&C<=c||2==d&&C>=c)?c:At,x=vt(i,C=k?k:bt(k,C)),D=Vt(_t(t+b*(0==m?0==t?.1:1:o),w/10),24),A=t<=u&&(1==h||3==h&&D>=u||2==h&&D<=u)?u:-At,E=bt(l,D>A&&t<=A?A:vt(A,D));return x==E&&0==x&&(E=100),[x,E]}const ut=new Intl.NumberFormat(Se?Te.language:"en-US"),dt=e=>ut.format(e),ht=Math,mt=ht.PI,pt=ht.abs,gt=ht.floor,ft=ht.round,yt=ht.ceil,bt=ht.min,vt=ht.max,wt=ht.pow,Ct=ht.sign,kt=ht.log10,xt=ht.log2,Dt=(e,t=1)=>ht.asinh(e/t),At=1/0;function Et(e){return 1+(0|kt((e^e>>31)-(e>>31)))}function Bt(e,t,n){return bt(vt(e,t),n)}function Ft(e){return"function"==typeof e}function St(e){return Ft(e)?e:()=>e}const Mt=e=>e,jt=(e,t)=>t,Tt=e=>null,Pt=e=>!0,Lt=(e,t)=>e==t,Rt=/\.\d*?(?=9{6,}|0{6,})/gm,Nt=e=>{if(Gt(e)||Ot.has(e))return e;const t=`${e}`,n=t.match(Rt);if(null==n)return e;let a=n[0].length-1;if(-1!=t.indexOf("e-")){let[e,n]=t.split("e");return+`${Nt(e)}e${n}`}return Vt(e,a)};function zt(e,t){return Nt(Vt(Nt(e/t))*t)}function _t(e,t){return Nt(yt(Nt(e/t))*t)}function It(e,t){return Nt(gt(Nt(e/t))*t)}function Vt(e,t=0){if(Gt(e))return e;let n=10**t,a=e*n*(1+Number.EPSILON);return ft(a)/n}const Ot=new Map;function $t(e){return((""+e).split(".")[1]||"").length}function qt(e,t,n,a){let s=[],r=a.map($t);for(let o=t;o=0?0:t)+(o>=r[i]?0:r[i]),u=10==e?l:Vt(l,c);s.push(u),Ot.set(u,c)}}return s}const Ut={},Wt=[],Ht=[null,null],Yt=Array.isArray,Gt=Number.isInteger;function Kt(e){return"string"==typeof e}function Xt(e){let t=!1;if(null!=e){let n=e.constructor;t=null==n||n==Object}return t}function Jt(e){return null!=e&&"object"==typeof e}const Zt=Object.getPrototypeOf(Uint8Array),Qt="__proto__";function en(e,t=Xt){let n;if(Yt(e)){let a=e.find(e=>null!=e);if(Yt(a)||t(a)){n=Array(e.length);for(let a=0;ar){for(a=o-1;a>=0&&null==e[a];)e[a--]=null;for(a=o+1;aPromise.resolve().then(e):queueMicrotask,sn=["January","February","March","April","May","June","July","August","September","October","November","December"],rn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function on(e){return e.slice(0,3)}const ln=rn.map(on),cn=sn.map(on),un={MMMM:sn,MMM:cn,WWWW:rn,WWW:ln};function dn(e){return(e<10?"0":"")+e}const hn={YYYY:e=>e.getFullYear(),YY:e=>(e.getFullYear()+"").slice(2),MMMM:(e,t)=>t.MMMM[e.getMonth()],MMM:(e,t)=>t.MMM[e.getMonth()],MM:e=>dn(e.getMonth()+1),M:e=>e.getMonth()+1,DD:e=>dn(e.getDate()),D:e=>e.getDate(),WWWW:(e,t)=>t.WWWW[e.getDay()],WWW:(e,t)=>t.WWW[e.getDay()],HH:e=>dn(e.getHours()),H:e=>e.getHours(),h:e=>{let t=e.getHours();return 0==t?12:t>12?t-12:t},AA:e=>e.getHours()>=12?"PM":"AM",aa:e=>e.getHours()>=12?"pm":"am",a:e=>e.getHours()>=12?"p":"a",mm:e=>dn(e.getMinutes()),m:e=>e.getMinutes(),ss:e=>dn(e.getSeconds()),s:e=>e.getSeconds(),fff:e=>{return((t=e.getMilliseconds())<10?"00":t<100?"0":"")+t;var t}};function mn(e,t){t=t||un;let n,a=[],s=/\{([a-z]+)\}|[^{]+/gi;for(;n=s.exec(e);)a.push("{"==n[0][0]?hn[n[1]]:n[0]);return e=>{let n="";for(let s=0;se%1==0,fn=[1,2,2.5,5],yn=qt(10,-32,0,fn),bn=qt(10,0,32,fn),vn=bn.filter(gn),wn=yn.concat(bn),Cn="{YYYY}",kn="\n"+Cn,xn="{M}/{D}",Dn="\n"+xn,An=Dn+"/{YY}",En="{aa}",Bn="{h}:{mm}"+En,Fn="\n"+Bn,Sn=":{ss}",Mn=null;function jn(e){let t=1e3*e,n=60*t,a=60*n,s=24*a,r=30*s,o=365*s;return[(1==e?qt(10,0,3,fn).filter(gn):qt(10,-3,0,fn)).concat([t,5*t,10*t,15*t,30*t,n,5*n,10*n,15*n,30*n,a,2*a,3*a,4*a,6*a,8*a,12*a,s,2*s,3*s,4*s,5*s,6*s,7*s,8*s,9*s,10*s,15*s,r,2*r,3*r,4*r,6*r,o,2*o,5*o,10*o,25*o,50*o,100*o]),[[o,Cn,Mn,Mn,Mn,Mn,Mn,Mn,1],[28*s,"{MMM}",kn,Mn,Mn,Mn,Mn,Mn,1],[s,xn,kn,Mn,Mn,Mn,Mn,Mn,1],[a,"{h}"+En,An,Mn,Dn,Mn,Mn,Mn,1],[n,Bn,An,Mn,Dn,Mn,Mn,Mn,1],[t,Sn,An+" "+Bn,Mn,Dn+" "+Bn,Mn,Fn,Mn,1],[e,Sn+".{fff}",An+" "+Bn,Mn,Dn+" "+Bn,Mn,Fn,Mn,1]],function(t){return(i,l,c,u,d,h)=>{let m=[],p=d>=o,g=d>=r&&d=s?s:d,o=v+(gt(c)-gt(y))+_t(y-v,r);m.push(o);let p=t(o),g=p.getHours()+p.getMinutes()/n+p.getSeconds()/a,f=d/a,b=h/i.axes[l]._space;for(;o=Vt(o+d,1==e?0:3),!(o>u);)if(f>1){let e=gt(Vt(g+f,6))%24,n=t(o).getHours()-e;n>1&&(n=-1),o-=n*a,g=(g+f)%24,Vt((o-m[m.length-1])/d,3)*b>=.7&&m.push(o)}else m.push(o)}return m}}]}const[Tn,Pn,Ln]=jn(1),[Rn,Nn,zn]=jn(.001);function _n(e,t){return e.map(e=>e.map((n,a)=>0==a||8==a||null==n?n:t(1==a||0==e[8]?n:e[1]+n)))}function In(e,t){return(n,a,s,r,o)=>{let i,l,c,u,d,h,m=t.find(e=>o>=e[0])||t[t.length-1];return a.map(t=>{let n=e(t),a=n.getFullYear(),s=n.getMonth(),r=n.getDate(),o=n.getHours(),p=n.getMinutes(),g=n.getSeconds(),f=a!=i&&m[2]||s!=l&&m[3]||r!=c&&m[4]||o!=u&&m[5]||p!=d&&m[6]||g!=h&&m[7]||m[1];return i=a,l=s,c=r,u=o,d=p,h=g,f(n)})}}function Vn(e,t,n){return new Date(e,t,n)}function On(e,t){return t(e)}function $n(e,t){return(n,a,s,r)=>null==r?Fe:t(e(a))}qt(2,-53,53,[1]);const qn={show:!0,live:!0,isolate:!1,mount:()=>{},markers:{show:!0,width:2,stroke:function(e,t){let n=e.series[t];return n.width?n.stroke(e,t):n.points.width?n.points.stroke(e,t):null},fill:function(e,t){return e.series[t].fill(e,t)},dash:"solid"},idx:null,idxs:null,values:[]},Un=[0,0];function Wn(e,t,n,a=!0){return e=>{0==e.button&&(!a||e.target==t)&&n(e)}}function Hn(e,t,n,a=!0){return e=>{(!a||e.target==t)&&n(e)}}const Yn={show:!0,x:!0,y:!0,lock:!1,move:function(e,t,n){return Un[0]=t,Un[1]=n,Un},points:{one:!1,show:function(e,t){let n=e.cursor.points,a=Ie(),s=n.size(e,t);ze(a,he,s),ze(a,me,s);let r=s/-2;ze(a,"marginLeft",r),ze(a,"marginTop",r);let o=n.width(e,t,s);return o&&ze(a,"borderWidth",o),a},size:function(e,t){return e.series[t].points.size},width:0,stroke:function(e,t){let n=e.series[t].points;return n._stroke||n._fill},fill:function(e,t){let n=e.series[t].points;return n._fill||n._stroke}},bind:{mousedown:Wn,mouseup:Wn,click:Wn,dblclick:Wn,mousemove:Hn,mouseleave:Hn,mouseenter:Hn},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(e,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(e,t,n,a,s)=>a-s,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},Gn={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Kn=tn({},Gn,{filter:jt}),Xn=tn({},Kn,{size:10}),Jn=tn({},Gn,{show:!1}),Zn='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',Qn="bold "+Zn,ea={show:!0,scale:"x",stroke:be,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:Qn,side:2,grid:Kn,ticks:Xn,border:Jn,font:Zn,lineGap:1.5,rotate:0},ta={show:!0,scale:"x",auto:!1,sorted:1,min:At,max:-At,idxs:[]};function na(e,t,n,a,s){return t.map(e=>null==e?"":dt(e))}function aa(e,t,n,a,s,r,o){let i=[],l=Ot.get(s)||0;for(let c=n=o?n:Vt(_t(n,s),l);c<=a;c=Vt(c+s,l))i.push(Object.is(c,-0)?0:c);return i}function sa(e,t,n,a,s,r,o){const i=[],l=e.scales[e.axes[t].scale].log,c=gt((10==l?kt:xt)(n));s=wt(l,c),10==l&&(s=wn[Xe(s,wn)]);let u=n,d=s*l;10==l&&(d=wn[Xe(d,wn)]);do{i.push(u),u+=s,10!=l||Ot.has(u)||(u=Vt(u,Ot.get(s))),u>=d&&(d=(s=u)*l,10==l&&(d=wn[Xe(d,wn)]))}while(u<=a);return i}function ra(e,t,n,a,s,r,o){let i=e.scales[e.axes[t].scale].asinh,l=a>i?sa(e,t,vt(i,n),a,s):[i],c=a>=0&&n<=0?[0]:[];return(n<-i?sa(e,t,vt(i,-a),-n,s):[i]).reverse().map(e=>-e).concat(c,l)}const oa=/./,ia=/[12357]/,la=/[125]/,ca=/1/,ua=(e,t,n,a)=>e.map((e,s)=>4==t&&0==e||s%a==0&&n.test(e.toExponential()[e<0?1:0])?e:null);function da(e,t,n,a,s){let r=e.axes[n],o=r.scale,i=e.scales[o],l=e.valToPos,c=r._space,u=l(10,o),d=l(9,o)-u>=c?oa:l(7,o)-u>=c?ia:l(5,o)-u>=c?la:ca;if(d==ca){let e=pt(l(1,o)-u);if(es,ya={show:!0,auto:!0,sorted:0,gaps:fa,alpha:1,facets:[tn({},ga,{scale:"x"}),tn({},ga,{scale:"y"})]},ba={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:fa,alpha:1,points:{show:function(e,t){let{scale:n,idxs:a}=e.series[0],s=e._data[0],r=e.valToPos(s[a[0]],n,!0),o=e.valToPos(s[a[1]],n,!0),i=pt(o-r)/(e.series[t].points.space*Pe);return a[1]-a[0]<=i},filter:null},values:null,min:At,max:-At,idxs:[],path:null,clip:null};function va(e,t,n,a,s){return n/10}const wa={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},Ca=tn({},wa,{time:!1,ori:1}),ka={};function xa(e,t){let n=ka[e];return n||(n={key:e,plots:[],sub(e){n.plots.push(e)},unsub(e){n.plots=n.plots.filter(t=>t!=e)},pub(e,t,a,s,r,o,i){for(let l=0;l{let g=e.pxRound;const f=i.dir*(0==i.ori?1:-1),y=0==i.ori?La:Ra;let b,v;1==f?(b=n,v=a):(b=a,v=n);let w=g(c(t[b],i,m,d)),C=g(u(o[b],l,p,h)),k=g(c(t[v],i,m,d)),x=g(u(1==r?l.max:l.min,l,p,h)),D=new Path2D(s);return y(D,k,x),y(D,w,x),y(D,w,C),D})}function Fa(e,t,n,a,s,r){let o=null;if(e.length>0){o=new Path2D;const i=0==t?Na:za;let l=n;for(let t=0;tn[0]){let e=n[0]-l;e>0&&i(o,l,a,e,a+r),l=n[1]}}let c=n+s-l,u=10;c>0&&i(o,l,a-u/2,c,a+r+u)}return o}function Sa(e,t,n,a,s,r,o){let i=[],l=e.length;for(let c=1==s?n:a;c>=n&&c<=a;c+=s)if(null===t[c]){let u=c,d=c;if(1==s)for(;++c<=a&&null===t[c];)d=c;else for(;--c>=n&&null===t[c];)d=c;let h=r(e[u]),m=d==u?h:r(e[d]),p=u-s;h=o<=0&&p>=0&&p=0&&g>=0&&g=h&&i.push([h,m])}return i}function Ma(e){return 0==e?Mt:1==e?ft:t=>zt(t,e)}function ja(e){let t=0==e?Ta:Pa,n=0==e?(e,t,n,a,s,r)=>{e.arcTo(t,n,a,s,r)}:(e,t,n,a,s,r)=>{e.arcTo(n,t,s,a,r)},a=0==e?(e,t,n,a,s)=>{e.rect(t,n,a,s)}:(e,t,n,a,s)=>{e.rect(n,t,s,a)};return(e,s,r,o,i,l=0,c=0)=>{0==l&&0==c?a(e,s,r,o,i):(l=bt(l,o/2,i/2),c=bt(c,o/2,i/2),t(e,s+l,r),n(e,s+o,r,s+o,r+i,l),n(e,s+o,r+i,s,r+i,c),n(e,s,r+i,s,r,c),n(e,s,r,s+o,r,l),e.closePath())}}const Ta=(e,t,n)=>{e.moveTo(t,n)},Pa=(e,t,n)=>{e.moveTo(n,t)},La=(e,t,n)=>{e.lineTo(t,n)},Ra=(e,t,n)=>{e.lineTo(n,t)},Na=ja(0),za=ja(1),_a=(e,t,n,a,s,r)=>{e.arc(t,n,a,s,r)},Ia=(e,t,n,a,s,r)=>{e.arc(n,t,a,s,r)},Va=(e,t,n,a,s,r,o)=>{e.bezierCurveTo(t,n,a,s,r,o)},Oa=(e,t,n,a,s,r,o)=>{e.bezierCurveTo(n,t,s,a,o,r)};function $a(e){return(e,t,n,a,s)=>Da(e,t,(t,r,o,i,l,c,u,d,h,m,p)=>{let g,f,{pxRound:y,points:b}=t;0==i.ori?(g=Ta,f=_a):(g=Pa,f=Ia);const v=Vt(b.width*Pe,3);let w=(b.size-b.width)/2*Pe,C=Vt(2*w,3),k=new Path2D,x=new Path2D,{left:D,top:A,width:E,height:B}=e.bbox;Na(x,D-C,A-C,E+2*C,B+2*C);const F=e=>{if(null!=o[e]){let t=y(c(r[e],i,m,d)),n=y(u(o[e],l,p,h));g(k,t+w,n),f(k,t,n,w,0,2*mt)}};if(s)s.forEach(F);else for(let e=n;e<=a;e++)F(e);return{stroke:v>0?k:null,fill:k,clip:x,flags:3}})}function qa(e){return(t,n,a,s,r,o)=>{a!=s&&(r!=a&&o!=a&&e(t,n,a),r!=s&&o!=s&&e(t,n,s),e(t,n,o))}}const Ua=qa(La),Wa=qa(Ra);function Ha(e){const t=lt(null==e?void 0:e.alignGaps,0);return(e,n,a,s)=>Da(e,n,(r,o,i,l,c,u,d,h,m,p,g)=>{[a,s]=et(i,a,s);let f,y,b=r.pxRound,v=e=>b(u(e,l,p,h)),w=e=>b(d(e,c,g,m));0==l.ori?(f=La,y=Ua):(f=Ra,y=Wa);const C=l.dir*(0==l.ori?1:-1),k={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},x=k.stroke;let D=!1;if(s-a>=4*p){let t,n,r,c=t=>e.posToVal(t,l.key,!0),u=null,d=null,h=v(o[1==C?a:s]),m=v(o[a]),p=v(o[s]),g=c(1==C?m+1:p-1);for(let e=1==C?a:s;e>=a&&e<=s;e+=C){let a=o[e],s=(1==C?ag)?h:v(a),r=i[e];s==h?null!=r?(n=r,null==u?(f(x,s,w(n)),t=u=d=n):nd&&(d=n)):null===r&&(D=!0):(null!=u&&y(x,h,w(u),w(d),w(t),w(n)),null!=r?(n=r,f(x,s,w(n)),u=d=t=n):(u=d=null,null===r&&(D=!0)),h=s,g=c(h+C))}null!=u&&u!=d&&r!=h&&y(x,h,w(u),w(d),w(t),w(n))}else for(let e=1==C?a:s;e>=a&&e<=s;e+=C){let t=i[e];null===t?D=!0:null!=t&&f(x,v(o[e]),w(t))}let[A,E]=Aa(e,n);if(null!=r.fill||0!=A){let t=k.fill=new Path2D(x),i=w(r.fillTo(e,n,r.min,r.max,A)),l=v(o[a]),c=v(o[s]);-1==C&&([c,l]=[l,c]),f(t,c,i),f(t,l,i)}if(!r.spanGaps){let c=[];D&&c.push(...Sa(o,i,a,s,C,v,t)),k.gaps=c=r.gaps(e,n,a,s,c),k.clip=Fa(c,l.ori,h,m,p,g)}return 0!=E&&(k.band=2==E?[Ba(e,n,a,s,x,-1),Ba(e,n,a,s,x,1)]:Ba(e,n,a,s,x,E)),k})}function Ya(e,t,n,a,s,r,o=At){if(e.length>1){let i=null;for(let l=0,c=1/0;l0!=a[e]>0?n[e]=0:(n[e]=3*(l[e-1]+l[e])/((2*l[e]+l[e-1])/a[e-1]+(l[e]+2*l[e-1])/a[e]),isFinite(n[e])||(n[e]=0));n[o-1]=a[o-2];for(let c=0;c{us.pxRatio=Pe}));const Ja=Ha(),Za=$a();function Qa(e,t,n,a){return(a?[e[0],e[1]].concat(e.slice(2)):[e[0]].concat(e.slice(1))).map((e,a)=>es(e,a,t,n))}function es(e,t,n,a){return tn({},0==t?n:a,e)}function ts(e,t,n){return null==t?Ht:[t,n]}const ns=ts;function as(e,t,n){return null==t?Ht:it(t,n,.1,!0)}function ss(e,t,n,a){return null==t?Ht:nt(t,n,e.scales[a].log,!1)}const rs=ss;function os(e,t,n,a){return null==t?Ht:at(t,n,e.scales[a].log,!1)}const is=os;function ls(e){let t,n;return[e=e.replace(/(\d+)px/,(e,a)=>(t=ft((n=+a)*Pe))+"px"),t,n]}function cs(e){e.show&&[e.font,e.labelFont].forEach(e=>{let t=Vt(e[2]*Pe,1);e[0]=e[0].replace(/[0-9.]+px/,t+"px"),e[1]=t})}function us(e,t,n){const a={mode:lt(e.mode,1)},s=a.mode;function r(e,t,n,a){let s=t.valToPct(e);return a+n*(-1==t.dir?1-s:s)}function o(e,t,n,a){let s=t.valToPct(e);return a+n*(-1==t.dir?s:1-s)}function i(e,t,n,a){return 0==t.ori?r(e,t,n,a):o(e,t,n,a)}a.valToPosH=r,a.valToPosV=o;let l=!1;a.status=0;const c=a.root=Ie("uplot");null!=e.id&&(c.id=e.id),Re(c,e.class),e.title&&(Ie("u-title",c).textContent=e.title);const u=_e("canvas"),d=a.ctx=u.getContext("2d"),h=Ie("u-wrap",c);Ge("click",h,e=>{e.target===p&&(Fa!=ka||Sa!=Da)&&Ia.click(a,e)},!0);const m=a.under=Ie("u-under",h);h.appendChild(u);const p=a.over=Ie("u-over",h),g=+lt((e=en(e)).pxAlign,1),f=Ma(g);(e.plugins||[]).forEach(t=>{t.opts&&(e=t.opts(a,e)||e)});const y=e.ms||.001,b=a.series=1==s?Qa(e.series||[],ta,ba,!1):(v=e.series||[null],w=ya,v.map((e,t)=>0==t?{}:tn({},w,e)));var v,w;const C=a.axes=Qa(e.axes||[],ea,pa,!0),k=a.scales={},x=a.bands=e.bands||[];x.forEach(e=>{e.fill=St(e.fill||null),e.dir=lt(e.dir,-1)});const D=2==s?b[1].facets[0].scale:b[0].scale,A={axes:function(){for(let e=0;eAn[e]):y,v=2==m.distr?An[y[1]]-An[y[0]]:u,w=t.ticks,x=t.border,D=w.show?w.size:0,A=ft(D*Pe),E=ft((2==t.alignTo?t._size-D-t.gap:t.gap)*Pe),B=t._rotate*-mt/180,F=f(t._pos*Pe),S=F+(A+E)*c;s=0==o?S:0,n=1==o?S:0,Mn(t.font[0],l,1==t.align?fe:2==t.align?ye:B>0?fe:B<0?ye:0==o?"center":3==r?ye:fe,B||1==o?"middle":2==r?pe:ge);let M=t.font[1]*t.lineGap,j=y.map(e=>f(i(e,m,p,g))),T=t._values;for(let e=0;e0){let e=b.some(e=>e._focus)&&Dn!=Rt.alpha;e&&(d.globalAlpha=Dn=Rt.alpha),b.forEach((e,n)=>{if(n>0&&e.show&&(Un(n,!1),Un(n,!0),null==e._paths)){let r=Dn;Dn!=e.alpha&&(d.globalAlpha=Dn=e.alpha);let o=2==s?[0,t[n][0].length-1]:function(e){let t=Bt(cn-1,0,ln-1),n=Bt(un+1,0,ln-1);for(;null==e[t]&&t>0;)t--;for(;null==e[n]&&n{if(t>0&&e.show){let n=Dn;Dn!=e.alpha&&(d.globalAlpha=Dn=e.alpha),null!=e._paths&&Wn(t,!1);{let n=null!=e._paths?e._paths.gaps:null,s=e.points.show(a,t,cn,un,n),r=e.points.filter(a,t,s,n);(s||r)&&(e.points._paths=e.points.paths(a,t,cn,un,r),Wn(t,!0))}Dn!=n&&(d.globalAlpha=Dn=n),Rs("drawSeries",t)}}),e&&(d.globalAlpha=Dn=1)}}},E=(e.drawOrder||["axes","series"]).map(e=>A[e]);function B(e){const t=3==e.distr?t=>kt(t>0?t:e.clamp(a,t,e.min,e.max,e.key)):4==e.distr?t=>Dt(t,e.asinh):100==e.distr?t=>e.fwd(t):e=>e;return n=>{let a=t(n),{_min:s,_max:r}=e;return(a-s)/(r-s)}}function F(t){let n=k[t];if(null==n){let a=(e.scales||Ut)[t]||Ut;if(null!=a.from){F(a.from);let e=tn({},k[a.from],a,{key:t});e.valToPct=B(e),k[t]=e}else{n=k[t]=tn({},t==D?wa:Ca,a),n.key=t;let e=n.time,r=n.range,o=Yt(r);if((t!=D||2==s&&!e)&&(!o||null!=r[0]&&null!=r[1]||(r={min:null==r[0]?st:{mode:1,hard:r[0],soft:r[0]},max:null==r[1]?st:{mode:1,hard:r[1],soft:r[1]}},o=!1),!o&&Xt(r))){let e=r;r=(t,n,a)=>null==n?Ht:it(n,a,e)}n.range=St(r||(e?ns:t==D?3==n.distr?rs:4==n.distr?is:ts:3==n.distr?ss:4==n.distr?os:as)),n.auto=St(!o&&n.auto),n.clamp=St(n.clamp||va),n._min=n._max=null,n.valToPct=B(n)}}}F("x"),F("y"),1==s&&b.forEach(e=>{F(e.scale)}),C.forEach(e=>{F(e.scale)});for(let ue in e.scales)F(ue);const S=k[D],M=S.distr;let j,T;0==S.ori?(Re(c,"u-hz"),j=r,T=o):(Re(c,"u-vt"),j=o,T=r);const P={};for(let ue in k){let e=k[ue];null==e.min&&null==e.max||(P[ue]={min:e.min,max:e.max},e.min=e.max=null)}const L=e.tzDate||(e=>new Date(ft(e/y))),R=e.fmtDate||mn,N=1==y?Ln(L):zn(L),z=In(L,_n(1==y?Pn:Nn,R)),_=$n(L,On("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",R)),I=[],V=a.legend=tn({},qn,e.legend),O=a.cursor=tn({},Yn,{drag:{y:2==s}},e.cursor),$=V.show,q=O.show,U=V.markers;let W,H,Y;V.idxs=I,U.width=St(U.width),U.dash=St(U.dash),U.stroke=St(U.stroke),U.fill=St(U.fill);let G,K=[],X=[],J=!1,Z={};if(V.live){const e=b[1]?b[1].values:null;J=null!=e,G=J?e(a,1,0):{_:0};for(let t in G)Z[t]=Fe}if($)if(W=_e("table","u-legend",c),Y=_e("tbody",null,W),V.mount(a,W),J){H=_e("thead",null,W,Y);let e=_e("tr",null,H);for(var Q in _e("th",null,e),G)_e("th",de,e).textContent=Q}else Re(W,"u-inline"),V.live&&Re(W,"u-live");const ee={show:!0},te={show:!1},ne=new Map;function ae(e,t,n,s=!0){const r=ne.get(t)||{},o=O.bind[e](a,t,n,s);o&&(Ge(e,t,r[e]=o),ne.set(t,r))}function se(e,t,n){const a=ne.get(t)||{};for(let s in a)null!=e&&s!=e||(Ke(s,t,a[s]),delete a[s]);null==e&&ne.delete(t)}let re=0,oe=0,ie=0,le=0,ce=0,be=0,Ee=ce,Se=be,Te=ie,Le=le,Ve=0,$e=0,Ue=0,He=0;a.bbox={};let Ye=!1,Je=!1,rt=!1,ot=!1,ct=!1,ut=!1;function dt(e,t,n){(n||e!=a.width||t!=a.height)&>(e,t),oa(!1),rt=!0,Je=!0,Ra()}function gt(e,t){a.width=re=ie=e,a.height=oe=le=t,ce=be=0,function(){let e=!1,t=!1,n=!1,a=!1;C.forEach((s,r)=>{if(s.show&&s._show){let{side:r,_size:o}=s,i=r%2,l=o+(null!=s.label?s.labelSize:0);l>0&&(i?(ie-=l,3==r?(ce+=l,a=!0):n=!0):(le-=l,0==r?(be+=l,e=!0):t=!0))}}),nn[0]=e,nn[1]=n,nn[2]=t,nn[3]=a,ie-=on[1]+on[3],ce+=on[3],le-=on[2]+on[0],be+=on[0]}(),function(){let e=ce+ie,t=be+le,n=ce,a=be;function s(s,r){switch(s){case 1:return e+=r,e-r;case 2:return t+=r,t-r;case 3:return n-=r,n+r;case 0:return a-=r,a+r}}C.forEach((e,t)=>{if(e.show&&e._show){let t=e.side;e._pos=s(t,e._size),null!=e.label&&(e._lpos=s(t,e.labelSize))}})}();let n=a.bbox;Ve=n.left=zt(ce*Pe,.5),$e=n.top=zt(be*Pe,.5),Ue=n.width=zt(ie*Pe,.5),He=n.height=zt(le*Pe,.5)}const Ct=3;if(a.setSize=function({width:e,height:t}){dt(e,t)},null==O.dataIdx){let e=O.hover,n=e.skip=new Set(e.skip??[]);n.add(void 0);let a=e.prox=St(e.prox),s=e.bias??(e.bias=0);O.dataIdx=(e,r,o,i)=>{if(0==r)return o;let l=o,c=a(e,r,o,i)??At,u=c>=0&&c0;)n.has(p[e])||(t=e);if(0==s||1==s)for(e=o;null==a&&e++c&&(l=null);return l}}const xt=e=>{O.event=e};O.idxs=I,O._lock=!1;let Mt=O.points;Mt.show=St(Mt.show),Mt.size=St(Mt.size),Mt.stroke=St(Mt.stroke),Mt.width=St(Mt.width),Mt.fill=St(Mt.fill);const Rt=a.focus=tn({},e.focus||{alpha:.3},O.focus),Nt=Rt.prox>=0,_t=Nt&&Mt.one;let It=[],qt=[],Gt=[];function Zt(e,t){let n=Mt.show(a,t);if(n instanceof HTMLElement)return Re(n,"u-cursor-pt"),Re(n,e.class),Oe(n,-10,-10,ie,le),p.insertBefore(n,It[t]),n}function Qt(e,t){if(1==s||t>0){let t=1==s&&k[e.scale].time,n=e.value;e.value=t?Kt(n)?$n(L,On(n,R)):n||_:n||ma,e.label=e.label||(t?"Time":"Value")}if(_t||t>0){e.width=null==e.width?1:e.width,e.paths=e.paths||Ja||Tt,e.fillTo=St(e.fillTo||Ea),e.pxAlign=+lt(e.pxAlign,g),e.pxRound=Ma(e.pxAlign),e.stroke=St(e.stroke||null),e.fill=St(e.fill||null),e._stroke=e._fill=e._paths=e._focus=null;let t=Vt(1*(3+2*(vt(1,e.width)||1)),3),n=e.points=tn({},{size:t,width:vt(1,.2*t),stroke:e.stroke,space:2*t,paths:Za,_stroke:null,_fill:null},e.points);n.show=St(n.show),n.filter=St(n.filter),n.fill=St(n.fill),n.stroke=St(n.stroke),n.paths=St(n.paths),n.pxAlign=e.pxAlign}if($){let n=function(e,t){if(0==t&&(J||!V.live||2==s))return Ht;let n=[],r=_e("tr","u-series",Y,Y.childNodes[t]);Re(r,e.class),e.show||Re(r,ue);let o=_e("th",null,r);if(U.show){let e=Ie("u-marker",o);if(t>0){let n=U.width(a,t);n&&(e.style.border=n+"px "+U.dash(a,t)+" "+U.stroke(a,t)),e.style.background=U.fill(a,t)}}let i=Ie(de,o);for(var l in e.label instanceof HTMLElement?i.appendChild(e.label):i.textContent=e.label,t>0&&(U.show||(i.style.color=e.width>0?U.stroke(a,t):U.fill(a,t)),ae("click",o,t=>{if(O._lock)return;xt(t);let n=b.indexOf(e);if((t.ctrlKey||t.metaKey)!=V.isolate){let e=b.some((e,t)=>t>0&&t!=n&&e.show);b.forEach((t,a)=>{a>0&&Ha(a,e?a==n?ee:te:ee,!0,zs.setSeries)})}else Ha(n,{show:!e.show},!0,zs.setSeries)},!1),Nt&&ae(xe,o,t=>{O._lock||(xt(t),Ha(b.indexOf(e),us,!0,zs.setSeries))},!1)),G){let e=_e("td","u-value",r);e.textContent="--",n.push(e)}return[r,n]}(e,t);K.splice(t,0,n[0]),X.splice(t,0,n[1]),V.values.push(null)}if(q){I.splice(t,0,null);let n=null;_t?0==t&&(n=Zt(e,t)):t>0&&(n=Zt(e,t)),It.splice(t,0,n),qt.splice(t,0,0),Gt.splice(t,0,0)}Rs("addSeries",t)}a.addSeries=function(e,t){t=null==t?b.length:t,e=1==s?es(e,t,ta,ba):es(e,t,{},ya),b.splice(t,0,e),Qt(b[t],t)},a.delSeries=function(e){if(b.splice(e,1),$){V.values.splice(e,1),X.splice(e,1);let t=K.splice(e,1)[0];se(null,t.firstChild),t.remove()}q&&(I.splice(e,1),It.splice(e,1)[0].remove(),qt.splice(e,1),Gt.splice(e,1)),Rs("delSeries",e)};const nn=[!1,!1,!1,!1];function sn(e,t,n,a){let[s,r,o,i]=n,l=t%2,c=0;return 0==l&&(i||r)&&(c=0==t&&!s||2==t&&!o?ft(ea.size/3):0),1==l&&(s||o)&&(c=1==t&&!r||3==t&&!i?ft(pa.size/2):0),c}const rn=a.padding=(e.padding||[sn,sn,sn,sn]).map(e=>St(lt(e,sn))),on=a._padding=rn.map((e,t)=>e(a,t,nn,0));let ln,cn=null,un=null;const dn=1==s?b[0].idxs:null;let hn,pn,gn,fn,yn,bn,Cn,kn,xn,Dn,An=null,En=!1;function Bn(e,n){if(t=null==e?[]:e,a.data=a._data=t,2==s){ln=0;for(let e=1;e=0,ut=!0,Ra()}}function Fn(){let e,n;En=!0,1==s&&(ln>0?(cn=dn[0]=0,un=dn[1]=ln-1,e=t[0][cn],n=t[0][un],2==M?(e=cn,n=un):e==n&&(3==M?[e,n]=nt(e,e,S.log,!1):4==M?[e,n]=at(e,e,S.log,!1):S.time?n=e+ft(86400/y):[e,n]=it(e,n,.1,!0))):(cn=dn[0]=e=null,un=dn[1]=n=null)),Wa(D,e,n)}function Sn(e,t,n,a,s,r){e??(e=ve),n??(n=Wt),a??(a="butt"),s??(s=ve),r??(r="round"),e!=hn&&(d.strokeStyle=hn=e),s!=pn&&(d.fillStyle=pn=s),t!=gn&&(d.lineWidth=gn=t),r!=yn&&(d.lineJoin=yn=r),a!=bn&&(d.lineCap=bn=a),n!=fn&&d.setLineDash(fn=n)}function Mn(e,t,n,a){t!=pn&&(d.fillStyle=pn=t),e!=Cn&&(d.font=Cn=e),n!=kn&&(d.textAlign=kn=n),a!=xn&&(d.textBaseline=xn=a)}function jn(e,t,n,s,r=0){if(s.length>0&&e.auto(a,En)&&(null==t||null==t.min)){let t=lt(cn,0),a=lt(un,s.length-1),o=null==n.min?function(e,t,n,a=0,s=!1){let r=s?tt:et,o=s?Qe:Ze;[t,n]=r(e,t,n);let i=e[t],l=e[t];if(t>-1)if(1==a)i=e[t],l=e[n];else if(-1==a)i=e[n],l=e[t];else for(let c=t;c<=n;c++){let t=e[c];o(t)&&(tl&&(l=t))}return[i??At,l??-At]}(s,t,a,r,3==e.distr):[n.min,n.max];e.min=bt(e.min,n.min=o[0]),e.max=vt(e.max,n.max=o[1])}}a.setData=Bn;const Vn={min:null,max:null};function Un(e,t){let n=t?b[e].points:b[e];n._stroke=n.stroke(a,e),n._fill=n.fill(a,e)}function Wn(e,n){let s=n?b[e].points:b[e],{stroke:r,fill:o,clip:i,flags:l,_stroke:c=s._stroke,_fill:u=s._fill,_width:h=s.width}=s._paths;h=Vt(h*Pe,3);let m=null,p=h%2/2;n&&null==u&&(u=h>0?"#fff":c);let g=1==s.pxAlign&&p>0;if(g&&d.translate(p,p),!n){let e=Ve-h/2,t=$e-h/2,n=Ue+h,a=He+h;m=new Path2D,m.rect(e,t,n,a)}n?Gn(c,h,s.dash,s.cap,u,r,o,l,i):function(e,n,s,r,o,i,l,c,u,d,h){let m=!1;0!=u&&x.forEach((p,g)=>{if(p.series[0]==e){let e,f=b[p.series[1]],y=t[p.series[1]],v=(f._paths||Ut).band;Yt(v)&&(v=1==p.dir?v[0]:v[1]);let w=null;f.show&&v&&function(e,t,n){for(t=lt(t,0),n=lt(n,e.length-1);t<=n;){if(null!=e[t])return!0;t++}return!1}(y,cn,un)?(w=p.fill(a,g)||i,e=f._paths.clip):v=null,Gn(n,s,r,o,w,l,c,u,d,h,e,v),m=!0}}),m||Gn(n,s,r,o,i,l,c,u,d,h)}(e,c,h,s.dash,s.cap,u,r,o,l,m,i),g&&d.translate(-p,-p)}const Hn=3;function Gn(e,t,n,a,s,r,o,i,l,c,u,h){Sn(e,t,n,a,s),(l||c||h)&&(d.save(),l&&d.clip(l),c&&d.clip(c)),h?(i&Hn)==Hn?(d.clip(h),u&&d.clip(u),Xn(s,o),Kn(e,r,t)):2&i?(Xn(s,o),d.clip(h),Kn(e,r,t)):1&i&&(d.save(),d.clip(h),u&&d.clip(u),Xn(s,o),d.restore(),Kn(e,r,t)):(Xn(s,o),Kn(e,r,t)),(l||c||h)&&d.restore()}function Kn(e,t,n){n>0&&(t instanceof Map?t.forEach((e,t)=>{d.strokeStyle=hn=t,d.stroke(e)}):null!=t&&e&&d.stroke(t))}function Xn(e,t){t instanceof Map?t.forEach((e,t)=>{d.fillStyle=pn=t,d.fill(e)}):null!=t&&e&&d.fill(t)}function Jn(e,t,n,a,s,r,o,i,l,c){let u=o%2/2;1==g&&d.translate(u,u),Sn(i,o,l,c,i),d.beginPath();let h,m,p,f,y=s+(0==a||3==a?-r:r);0==n?(m=s,f=y):(h=s,p=y);for(let g=0;g{if(!n.show)return;let r=k[n.scale];if(null==r.min)return void(n._show&&(t=!1,n._show=!1,oa(!1)));n._show||(t=!1,n._show=!0,oa(!1));let o=n.side,i=o%2,{min:l,max:c}=r,[u,d]=function(e,t,n,s){let r,o=C[e];if(s<=0)r=[0,0];else{let i=o._space=o.space(a,e,t,n,s);r=function(e,t,n,a,s){let r=vt(Et(e),Et(t)),o=t-e,i=Xe(s/a*o,n);do{let e=n[i],t=a*e/o;if(t>=s&&r+(e<5?Ot.get(e):0)<=17)return[e,t]}while(++iAn[e]):m,g=2==r.distr?An[m[1]]-An[m[0]]:u,f=n._values=n.values(a,n.filter(a,p,s,d,g),s,d,g);n._rotate=2==o?n.rotate(a,f,s,d):0;let y=n._size;n._size=yt(n.size(a,f,s,e)),null!=y&&n._size!=y&&(t=!1)}),t}function Qn(e){let t=!0;return rn.forEach((n,s)=>{let r=n(a,s,nn,e);r!=on[s]&&(t=!1),on[s]=r}),t}function oa(e){b.forEach((t,n)=>{n>0&&(t._paths=null,e&&(1==s?(t.min=null,t.max=null):t.facets.forEach(e=>{e.min=null,e.max=null})))})}let ia,la,ca,ua,ga,fa,ka,Da,Aa,Ba,Fa,Sa,ja=!1,Ta=!1,Pa=[];function La(){Ta=!1;for(let e=0;e0){b.forEach((n,r)=>{if(1==s){let s=n.scale,o=P[s];if(null==o)return;let i=e[s];if(0==r){let e=i.range(a,i.min,i.max,s);i.min=e[0],i.max=e[1],cn=Xe(i.min,t[0]),un=Xe(i.max,t[0]),un-cn>1&&(t[0][cn]i.max&&un--),n.min=An[cn],n.max=An[un]}else n.show&&n.auto&&jn(i,o,n,t[r],n.sorted);n.idxs[0]=cn,n.idxs[1]=un}else if(r>0&&n.show&&n.auto){let[a,s]=n.facets,o=a.scale,i=s.scale,[l,c]=t[r],u=e[o],d=e[i];null!=u&&jn(u,P[o],a,l,a.sorted),null!=d&&jn(d,P[i],s,c,s.sorted),n.min=s.min,n.max=s.max}});for(let t in e){let n=e[t],s=P[t];if(null==n.from&&(null==s||null==s.min)){let e=n.range(a,n.min==At?null:n.min,n.max==-At?null:n.max,t);n.min=e[0],n.max=e[1]}}}for(let t in e){let n=e[t];if(null!=n.from){let s=e[n.from];if(null==s.min)n.min=n.max=null;else{let e=n.range(a,s.min,s.max,t);n.min=e[0],n.max=e[1]}}}let n={},r=!1;for(let t in e){let a=e[t],s=k[t];if(s.min!=a.min||s.max!=a.max){s.min=a.min,s.max=a.max;let e=s.distr;s._min=3==e?kt(s.min):4==e?Dt(s.min,s.asinh):100==e?s.fwd(s.min):s.min,s._max=3==e?kt(s.max):4==e?Dt(s.max,s.asinh):100==e?s.fwd(s.max):s.max,n[t]=r=!0}}if(r){b.forEach((e,t)=>{2==s?t>0&&n.y&&(e._paths=null):n[e.scale]&&(e._paths=null)});for(let e in n)rt=!0,Rs("setScale",e);q&&O.left>=0&&(ot=ut=!0)}for(let t in P)P[t]=null}(),Ye=!1),rt&&(function(){let e=!1,t=0;for(;!e;){t++;let n=Zn(t),s=Qn(t);e=t==Ct||n&&s,e||(gt(a.width,a.height),Je=!0)}}(),rt=!1),Je){if(ze(m,fe,ce),ze(m,pe,be),ze(m,he,ie),ze(m,me,le),ze(p,fe,ce),ze(p,pe,be),ze(p,he,ie),ze(p,me,le),ze(h,he,re),ze(h,me,oe),u.width=ft(re*Pe),u.height=ft(oe*Pe),C.forEach(({_el:e,_show:t,_size:n,_pos:a,side:s})=>{if(null!=e)if(t){let t=s%2==1;ze(e,t?"left":"top",a-(3===s||0===s?n:0)),ze(e,t?"width":"height",n),ze(e,t?"top":"left",t?be:ce),ze(e,t?"height":"width",t?le:ie),Ne(e,ue)}else Re(e,ue)}),hn=pn=gn=yn=bn=Cn=kn=xn=fn=null,Dn=1,ws(!0),ce!=Ee||be!=Se||ie!=Te||le!=Le){oa(!1);let e=ie/Te,t=le/Le;if(q&&!ot&&O.left>=0){O.left*=e,O.top*=t,ca&&Oe(ca,ft(O.left),0,ie,le),ua&&Oe(ua,0,ft(O.top),ie,le);for(let n=0;n=0&&$a.width>0){$a.left*=e,$a.width*=e,$a.top*=t,$a.height*=t;for(let e in xs)ze(qa,e,$a[e])}Ee=ce,Se=be,Te=ie,Le=le}Rs("setSize"),Je=!1}re>0&&oe>0&&(d.clearRect(0,0,u.width,u.height),Rs("drawClear"),E.forEach(e=>e()),Rs("draw")),$a.show&&ct&&(Ua($a),ct=!1),q&&ot&&(bs(null,!0,!1),ot=!1),V.show&&V.live&&ut&&(fs(),ut=!1),l||(l=!0,a.status=1,Rs("ready")),En=!1,ja=!1}function za(e,n){let s=k[e];if(null==s.from){if(0==ln){let t=s.range(a,n.min,n.max,e);n.min=t[0],n.max=t[1]}if(n.min>n.max){let e=n.min;n.min=n.max,n.max=e}if(ln>1&&null!=n.min&&null!=n.max&&n.max-n.min<1e-16)return;e==D&&2==s.distr&&ln>0&&(n.min=Xe(n.min,t[0]),n.max=Xe(n.max,t[0]),n.min==n.max&&n.max++),P[e]=n,Ye=!0,Ra()}}a.batch=function(e,t=!1){ja=!0,Ta=t,e(a),Na(),t&&Pa.length>0&&queueMicrotask(La)},a.redraw=(e,t)=>{rt=t||!1,!1!==e?Wa(D,S.min,S.max):Ra()},a.setScale=za;let _a=!1;const Ia=O.drag;let Va=Ia.x,Oa=Ia.y;q&&(O.x&&(ia=Ie("u-cursor-x",p)),O.y&&(la=Ie("u-cursor-y",p)),0==S.ori?(ca=ia,ua=la):(ca=la,ua=ia),Fa=O.left,Sa=O.top);const $a=a.select=tn({show:!0,over:!0,left:0,width:0,top:0,height:0},e.select),qa=$a.show?Ie("u-select",$a.over?p:m):null;function Ua(e,t){if($a.show){for(let t in e)$a[t]=e[t],t in xs&&ze(qa,t,e[t]);!1!==t&&Rs("setSelect")}}function Wa(e,t,n){za(e,{min:t,max:n})}function Ha(e,t,n,r){null!=t.focus&&function(e){if(e!=Xa){let t=null==e,n=1!=Rt.alpha;b.forEach((a,r)=>{if(1==s||r>0){let s=t||0==r||r==e;a._focus=t?null:s,n&&function(e,t){b[e].alpha=t,q&&null!=It[e]&&(It[e].style.opacity=t),$&&K[e]&&(K[e].style.opacity=t)}(r,s?1:Rt.alpha)}}),Xa=e,n&&Ra()}}(e),null!=t.show&&b.forEach((n,a)=>{a>0&&(e==a||null==e)&&(n.show=t.show,function(e){if(b[e].show)$&&Ne(K[e],ue);else if($&&Re(K[e],ue),q){let t=_t?It[0]:It[e];null!=t&&Oe(t,-10,-10,ie,le)}}(a),2==s?(Wa(n.facets[0].scale,null,null),Wa(n.facets[1].scale,null,null)):Wa(n.scale,null,null),Ra())}),!1!==n&&Rs("setSeries",e,t),r&&Vs("setSeries",a,e,t)}let Ya,Ga,Xa;a.setSelect=Ua,a.setSeries=Ha,a.addBand=function(e,t){e.fill=St(e.fill||null),e.dir=lt(e.dir,-1),t=null==t?x.length:t,x.splice(t,0,e)},a.setBand=function(e,t){tn(x[e],t)},a.delBand=function(e){null==e?x.length=0:x.splice(e,1)};const us={focus:!0};function ds(e,t,n){let a=k[t];n&&(e=e/Pe-(1==a.ori?be:ce));let s=ie;1==a.ori&&(s=le,e=s-e),-1==a.dir&&(e=s-e);let r=a._min,o=r+(a._max-r)*(e/s),i=a.distr;return 3==i?wt(10,o):4==i?((e,t=1)=>ht.sinh(e)*t)(o,a.asinh):100==i?a.bwd(o):o}function hs(e,t){ze(qa,fe,$a.left=e),ze(qa,he,$a.width=t)}function ms(e,t){ze(qa,pe,$a.top=e),ze(qa,me,$a.height=t)}$&&Nt&&ae(De,W,e=>{O._lock||(xt(e),null!=Xa&&Ha(null,us,!0,zs.setSeries))}),a.valToIdx=e=>Xe(e,t[0]),a.posToIdx=function(e,n){return Xe(ds(e,D,n),t[0],cn,un)},a.posToVal=ds,a.valToPos=(e,t,n)=>0==k[t].ori?r(e,k[t],n?Ue:ie,n?Ve:0):o(e,k[t],n?He:le,n?$e:0),a.setCursor=(e,t,n)=>{Fa=e.left,Sa=e.top,bs(null,t,n)};let ps=0==S.ori?hs:ms,gs=1==S.ori?hs:ms;function fs(e,t){if(null!=e&&(e.idxs?e.idxs.forEach((e,t)=>{I[t]=e}):void 0!==e.idx&&I.fill(e.idx),V.idx=I[0]),$&&V.live){for(let e=0;e0||1==s&&!J)&&ys(e,I[e]);!function(){if($&&V.live)for(let e=2==s?1:0;eun;Ya=At,Ga=null;let l=0==S.ori?ie:le,c=1==S.ori?ie:le;if(Fa<0||0==ln||i){o=O.idx=null;for(let e=0;e0&&e.show){let n=null==w?-10:w==o?r:j(1==s?t[0][w]:t[f][0][w],S,l,0),y=null==C?-10:T(C,1==s?k[e.scale]:k[e.facets[1].scale],c,0);if(Nt&&null!=C){let t=1==S.ori?Fa:Sa,n=pt(Rt.dist(a,f,w,y,t));if(n=0?1:-1;r==(C>=0?1:-1)&&(1==r?1==a?C>=s:C<=s:1==a?C<=s:C>=s)&&(Ya=n,Ga=f)}else Ya=n,Ga=f}}if(ut||_t){let e,t;0==S.ori?(e=n,t=y):(e=y,t=n);let s,r,o,l,c,b,v=!0,w=Mt.bbox;if(null!=w){v=!1;let e=w(a,f);o=e.left,l=e.top,s=e.width,r=e.height}else o=e,l=t,s=r=Mt.size(a,f);if(b=Mt.fill(a,f),c=Mt.stroke(a,f),_t)f==Ga&&Ya<=Rt.prox&&(i=o,u=l,d=s,h=r,m=v,p=b,g=c);else{let e=It[f];null!=e&&(qt[f]=o,Gt[f]=l,We(e,s,r,v),qe(e,b,c),Oe(e,yt(o),yt(l),ie,le))}}}}if(_t){let e=Rt.prox;if(ut||(null==Xa?Ya<=e:Ya>e||Ga!=Xa)){let e=It[0];null!=e&&(qt[0]=i,Gt[0]=u,We(e,d,h,m),qe(e,p,g),Oe(e,yt(i),yt(u),ie,le))}}}if($a.show&&_a)if(null!=e){let[t,n]=zs.scales,[a,s]=zs.match,[r,o]=e.cursor.sync.scales,i=e.cursor.drag;if(Va=i._x,Oa=i._y,Va||Oa){let i,u,d,h,m,{left:p,top:g,width:f,height:y}=e.select,b=e.scales[r].ori,v=e.posToVal,w=null!=t&&a(t,r),C=null!=n&&s(n,o);w&&Va?(0==b?(i=p,u=f):(i=g,u=y),d=k[t],h=j(v(i,r),d,l,0),m=j(v(i+u,r),d,l,0),ps(bt(h,m),pt(m-h))):ps(0,l),C&&Oa?(1==b?(i=p,u=f):(i=g,u=y),d=k[n],h=T(v(i,o),d,c,0),m=T(v(i+u,o),d,c,0),gs(bt(h,m),pt(m-h))):gs(0,c)}else Ds()}else{let e=pt(Aa-ga),t=pt(Ba-fa);if(1==S.ori){let n=e;e=t,t=n}Va=Ia.x&&e>=Ia.dist,Oa=Ia.y&&t>=Ia.dist;let n,a,s=Ia.uni;null!=s?Va&&Oa&&(Va=e>=s,Oa=t>=s,Va||Oa||(t>e?Oa=!0:Va=!0)):Ia.x&&Ia.y&&(Va||Oa)&&(Va=Oa=!0),Va&&(0==S.ori?(n=ka,a=Fa):(n=Da,a=Sa),ps(bt(n,a),pt(a-n)),Oa||gs(0,c)),Oa&&(1==S.ori?(n=ka,a=Fa):(n=Da,a=Sa),gs(bt(n,a),pt(a-n)),Va||ps(0,l)),Va||Oa||(ps(0,0),gs(0,0))}if(Ia._x=Va,Ia._y=Oa,null==e){if(r){if(null!=_s){let[e,t]=zs.scales;zs.values[0]=null!=e?ds(0==S.ori?Fa:Sa,e):null,zs.values[1]=null!=t?ds(1==S.ori?Fa:Sa,t):null}Vs(we,a,Fa,Sa,ie,le,o)}if(Nt){let e=r&&zs.setSeries,t=Rt.prox;null==Xa?Ya<=t&&Ha(Ga,us,!0,e):Ya>t?Ha(null,us,!0,e):Ga!=Xa&&Ha(Ga,us,!0,e)}}ut&&(V.idx=o,fs()),!1!==n&&Rs("setCursor")}a.setLegend=fs;let vs=null;function ws(e=!1){e?vs=null:(vs=p.getBoundingClientRect(),Rs("syncRect",vs))}function Cs(e,t,n,a,s,r,o){O._lock||_a&&null!=e&&0==e.movementX&&0==e.movementY||(ks(e,t,n,a,s,r,0,!1,null!=e),null!=e?bs(null,!0,!0):bs(t,!0,!1))}function ks(e,t,n,s,r,o,l,c,u){if(null==vs&&ws(!1),xt(e),null!=e)n=e.clientX-vs.left,s=e.clientY-vs.top;else{if(n<0||s<0)return Fa=-10,void(Sa=-10);let[e,a]=zs.scales,l=t.cursor.sync,[c,u]=l.values,[d,h]=l.scales,[m,p]=zs.match,g=t.axes[0].side%2==1,f=0==S.ori?ie:le,y=1==S.ori?ie:le,b=g?o:r,v=g?r:o,w=g?s:n,C=g?n:s;if(n=null!=d?m(e,d)?i(c,k[e],f,0):-10:f*(w/b),s=null!=h?p(a,h)?i(u,k[a],y,0):-10:y*(C/v),1==S.ori){let e=n;n=s,s=e}}!u||null!=t&&t.cursor.event.type!=we||((n<=1||n>=ie-1)&&(n=zt(n,ie)),(s<=1||s>=le-1)&&(s=zt(s,le))),c?(ga=n,fa=s,[ka,Da]=O.move(a,n,s)):(Fa=n,Sa=s)}Object.defineProperty(a,"rect",{get:()=>(null==vs&&ws(!1),vs)});const xs={width:0,height:0,left:0,top:0};function Ds(){Ua(xs,!1)}let As,Es,Bs,Fs;function Ss(e,t,n,s,r,o,i){_a=!0,Va=Oa=Ia._x=Ia._y=!1,ks(e,t,n,s,r,o,0,!0,!1),null!=e&&(ae(ke,Me,Ms,!1),Vs(Ce,a,ka,Da,ie,le,null));let{left:l,top:c,width:u,height:d}=$a;As=l,Es=c,Bs=u,Fs=d}function Ms(e,t,n,s,r,o,i){_a=Ia._x=Ia._y=!1,ks(e,t,n,s,r,o,0,!1,!0);let{left:l,top:c,width:u,height:d}=$a,h=u>0||d>0,m=As!=l||Es!=c||Bs!=u||Fs!=d;if(h&&m&&Ua($a),Ia.setScale&&h&&m){let e=l,t=u,n=c,a=d;if(1==S.ori&&(e=c,t=d,n=l,a=u),Va&&Wa(D,ds(e,D),ds(e+t,D)),Oa)for(let s in k){let e=k[s];s!=D&&null==e.from&&e.min!=At&&Wa(s,ds(n+a,s),ds(n,s))}Ds()}else O.lock&&(O._lock=!O._lock,bs(t,!0,null!=e));null!=e&&(se(ke,Me),Vs(ke,a,Fa,Sa,ie,le,null))}function js(e,t,n,s,r,o,i){O._lock||(xt(e),Fn(),Ds(),null!=e&&Vs(Ae,a,Fa,Sa,ie,le,null))}function Ts(){C.forEach(cs),dt(a.width,a.height,!0)}Ge(Be,je,Ts);const Ps={};Ps.mousedown=Ss,Ps.mousemove=Cs,Ps.mouseup=Ms,Ps.dblclick=js,Ps.setSeries=(e,t,n,s)=>{-1!=(n=(0,zs.match[2])(a,t,n))&&Ha(n,s,!0,!1)},q&&(ae(Ce,p,Ss),ae(we,p,Cs),ae(xe,p,e=>{xt(e),ws(!1)}),ae(De,p,function(e,t,n,a,s,r,o){if(O._lock)return;xt(e);let i=_a;if(_a){let e,t,n=!0,a=!0,s=10;0==S.ori?(e=Va,t=Oa):(e=Oa,t=Va),e&&t&&(n=Fa<=s||Fa>=ie-s,a=Sa<=s||Sa>=le-s),e&&n&&(Fa=Fa{e.call(null,a,t,n)})}(e.plugins||[]).forEach(e=>{for(let t in e.hooks)Ls[t]=(Ls[t]||[]).concat(e.hooks[t])});const Ns=(e,t,n)=>n,zs=tn({key:null,setSeries:!1,filters:{pub:Pt,sub:Pt},scales:[D,b[1]?b[1].scale:null],match:[Lt,Lt,Ns],values:[null,null]},O.sync);2==zs.match.length&&zs.match.push(Ns),O.sync=zs;const _s=zs.key,Is=xa(_s);function Vs(e,t,n,a,s,r,o){zs.filters.pub(e,t,n,a,s,r,o)&&Is.pub(e,t,n,a,s,r,o)}function Os(){Rs("init",e,t),Bn(t||e.data,!1),P[D]?za(D,P[D]):Fn(),ct=$a.show&&($a.width>0||$a.height>0),ot=ut=!0,dt(e.width,e.height)}return Is.sub(a),a.pub=function(e,t,n,a,s,r,o){zs.filters.sub(e,t,n,a,s,r,o)&&Ps[e](null,t,n,a,s,r,o)},a.destroy=function(){Is.unsub(a),Ka.delete(a),ne.clear(),Ke(Be,je,Ts),c.remove(),null==W||W.remove(),Rs("destroy")},b.forEach(Qt),C.forEach(function(e,t){if(e._show=e.show,e.show){let n=e.side%2,s=k[e.scale];null==s&&(e.scale=n?b[1].scale:D,s=k[e.scale]);let r=s.time;e.size=St(e.size),e.space=St(e.space),e.rotate=St(e.rotate),Yt(e.incrs)&&e.incrs.forEach(e=>{!Ot.has(e)&&Ot.set(e,$t(e))}),e.incrs=St(e.incrs||(2==s.distr?vn:r?1==y?Tn:Rn:wn)),e.splits=St(e.splits||(r&&1==s.distr?N:3==s.distr?sa:4==s.distr?ra:aa)),e.stroke=St(e.stroke),e.grid.stroke=St(e.grid.stroke),e.ticks.stroke=St(e.ticks.stroke),e.border.stroke=St(e.border.stroke);let o=e.values;e.values=Yt(o)&&!Yt(o[0])?St(o):r?Yt(o)?In(L,_n(o,R)):Kt(o)?function(e,t){let n=mn(t);return(t,a,s,r,o)=>a.map(t=>n(e(t)))}(L,o):o||z:o||na,e.filter=St(e.filter||(s.distr>=3&&10==s.log?da:3==s.distr&&2==s.log?ha:jt)),e.font=ls(e.font),e.labelFont=ls(e.labelFont),e._size=e.size(a,null,t,0),e._space=e._rotate=e._incrs=e._found=e._splits=e._values=null,e._size>0&&(nn[t]=!0,e._el=Ie("u-axis",h))}}),n?n instanceof HTMLElement?(n.appendChild(c),Os()):n(a,Os):Os(),a}us.assign=tn,us.fmtNum=dt,us.rangeNum=it,us.rangeLog=nt,us.rangeAsinh=at,us.orient=Da,us.pxRatio=Pe,us.join=function(e,t){if(function(e){let t=e[0][0],n=t.length;for(let a=1;a=a&&null==e[s];)s--;if(s<=a)return!0;const r=vt(1,gt((s-a+1)/t));for(let o=e[a],i=a+r;i<=s;i+=r){const t=e[i];if(null!=t){if(t<=o)return!1;o=t}}return!0}(t[0])||(t=function(e){let t=e[0],n=t.length,a=Array(n);for(let r=0;rt[e]-t[n]);let s=[];for(let r=0;re-t)],s=a[0].length,r=new Map;for(let o=0;oDa(e,r,(l,c,u,d,h,m,p,g,f,y,b)=>{[o,i]=et(u,o,i);let v=l.pxRound,{left:w,width:C}=e.bbox,k=e=>v(m(e,d,y,g)),x=e=>v(p(e,h,b,f)),D=0==d.ori?La:Ra;const A={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},E=A.stroke,B=d.dir*(0==d.ori?1:-1);let F=x(u[1==B?o:i]),S=k(c[1==B?o:i]),M=S,j=S;s&&-1==t&&(j=w,D(E,j,F)),D(E,S,F);for(let e=1==B?o:i;e>=o&&e<=i;e+=B){let n=u[e];if(null==n)continue;let a=k(c[e]),s=x(n);1==t?D(E,a,F):D(E,M,s),D(E,a,s),F=s,M=a}let T=M;s&&1==t&&(T=w+C,D(E,T,F));let[P,L]=Aa(e,r);if(null!=l.fill||0!=P){let t=A.fill=new Path2D(E),n=x(l.fillTo(e,r,l.min,l.max,P));D(t,T,n),D(t,j,n)}if(!l.spanGaps){let s=[];s.push(...Sa(c,u,o,i,B,k,a));let h=l.width*Pe/2,m=n||1==t?h:-h,p=n||-1==t?-h:h;s.forEach(e=>{e[0]+=m,e[1]+=p}),A.gaps=s=l.gaps(e,r,o,i,s),A.clip=Fa(s,d.ori,g,f,y,b)}return 0!=L&&(A.band=2==L?[Ba(e,r,o,i,E,-1),Ba(e,r,o,i,E,1)]:Ba(e,r,o,i,E,L)),A})},e.bars=function(e){const t=lt((e=e||Ut).size,[.6,At,1]),n=e.align||0,a=e.gap||0;let s=e.radius;s=null==s?[0,0]:"number"==typeof s?[s,0]:s;const r=St(s),o=1-t[0],i=lt(t[1],At),l=lt(t[2],1),c=lt(e.disp,Ut),u=lt(e.each,e=>{}),{fill:d,stroke:h}=c;return(e,t,s,m)=>Da(e,t,(p,g,f,y,b,v,w,C,k,x,D)=>{let A,E,B=p.pxRound,F=n,S=a*Pe,M=i*Pe,j=l*Pe;0==y.ori?[A,E]=r(e,t):[E,A]=r(e,t);const T=y.dir*(0==y.ori?1:-1);let P,L,R,N=0==y.ori?Na:za,z=0==y.ori?u:(e,t,n,a,s,r,o)=>{u(e,t,n,s,a,o,r)},_=lt(e.bands,Wt).find(e=>e.series[0]==t),I=null!=_?_.dir:0,V=p.fillTo(e,t,p.min,p.max,I),O=B(w(V,b,D,k)),$=x,q=B(p.width*Pe),U=!1,W=null,H=null,Y=null,G=null;null==d||0!=q&&null==h||(U=!0,W=d.values(e,t,s,m),H=new Map,new Set(W).forEach(e=>{null!=e&&H.set(e,new Path2D)}),q>0&&(Y=h.values(e,t,s,m),G=new Map,new Set(Y).forEach(e=>{null!=e&&G.set(e,new Path2D)})));let{x0:K,size:X}=c;if(null!=K&&null!=X){F=1,g=K.values(e,t,s,m),2==K.unit&&(g=g.map(t=>e.posToVal(C+t*x,y.key,!0)));let n=X.values(e,t,s,m);L=2==X.unit?n[0]*x:v(n[0],y,x,C)-v(0,y,x,C),$=Ya(g,f,v,y,x,C,$),R=$-L+S}else $=Ya(g,f,v,y,x,C,$),R=$*o+S,L=$-R;R<1&&(R=0),q>=L/2&&(q=0),R<5&&(B=Mt);let J=R>0;L=B(Bt($-R-(J?q:0),j,M)),P=(0==F?L/2:F==T?0:L)-F*T*((0==F?S/2:0)+(J?q/2:0));const Z={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Q=U?null:new Path2D;let ee=null;if(null!=_)ee=e.data[_.series[1]];else{let{y0:n,y1:a}=c;null!=n&&null!=a&&(f=a.values(e,t,s,m),ee=n.values(e,t,s,m))}let te=A*L,ne=E*L;for(let n=1==T?s:m;n>=s&&n<=m;n+=T){let a=f[n];if(null==a)continue;if(null!=ee){let e=ee[n]??0;if(a-e==0)continue;O=w(e,b,D,k)}let s=v(2!=y.distr||null!=c?g[n]:n,y,x,C),r=w(lt(a,V),b,D,k),o=B(s-P),i=B(vt(r,O)),l=B(bt(r,O)),u=i-l;if(null!=a){let s=a<0?ne:te,r=a<0?te:ne;U?(q>0&&null!=Y[n]&&N(G.get(Y[n]),o,l+gt(q/2),L,vt(0,u-q),s,r),null!=W[n]&&N(H.get(W[n]),o,l+gt(q/2),L,vt(0,u-q),s,r)):N(Q,o,l+gt(q/2),L,vt(0,u-q),s,r),z(e,t,n,o-q/2,l,L+q,u)}}return q>0?Z.stroke=U?G:Q:U||(Z._fill=0==p.width?p._fill:p._stroke??p._fill,Z.width=0),Z.fill=U?H:Q,Z})},e.spline=function(e){return function(e,t){const n=lt(null==t?void 0:t.alignGaps,0);return(t,a,s,r)=>Da(t,a,(o,i,l,c,u,d,h,m,p,g,f)=>{[s,r]=et(l,s,r);let y,b,v,w=o.pxRound,C=e=>w(d(e,c,g,m)),k=e=>w(h(e,u,f,p));0==c.ori?(y=Ta,v=La,b=Va):(y=Pa,v=Ra,b=Oa);const x=c.dir*(0==c.ori?1:-1);let D=C(i[1==x?s:r]),A=D,E=[],B=[];for(let e=1==x?s:r;e>=s&&e<=r;e+=x)if(null!=l[e]){let t=C(i[e]);E.push(A=t),B.push(k(l[e]))}const F={stroke:e(E,B,y,v,b,w),fill:null,clip:null,band:null,gaps:null,flags:1},S=F.stroke;let[M,j]=Aa(t,a);if(null!=o.fill||0!=M){let e=F.fill=new Path2D(S),n=k(o.fillTo(t,a,o.min,o.max,M));v(e,A,n),v(e,D,n)}if(!o.spanGaps){let e=[];e.push(...Sa(i,l,s,r,x,C,n)),F.gaps=e=o.gaps(t,a,s,r,e),F.clip=Fa(e,c.ori,m,p,g,f)}return 0!=j&&(F.band=2==j?[Ba(t,a,s,r,S,-1),Ba(t,a,s,r,S,1)]:Ba(t,a,s,r,S,j)),F})}(Ga,e)}}const ds=new Map;function hs(e){var t;if(!e.startsWith("var("))return e;const n=ds.get(e);if(n)return n;const a=e.match(/var\(([^,)]+)(?:,\s*([^)]+))?\)/);if(!a)return e;const s=a[1].trim(),r=(null==(t=a[2])?void 0:t.trim())||"#888888",o=getComputedStyle(document.documentElement).getPropertyValue(s).trim()||r;return ds.set(e,o),o}function ms(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];const n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);return n?[parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)]:[0,0,0]}let ps=null,gs=0;const fs=s.memo(function({timestamps:e,series:t,onHover:n,onSeriesHover:a,highlightedKey:o=null,cursorColor:i,overlayLine:l=null,startTs:c,endTs:u}){const d=s.useRef(null),h=s.useRef(null),m=s.useRef(t),p=s.useRef(o),g=s.useRef(l),f=s.useRef(n),y=s.useRef(a),b=s.useRef(null),v=s.useRef(c),w=s.useRef(u),C=s.useRef(e.length);s.useLayoutEffect(()=>{m.current=t,p.current=o,g.current=l,f.current=n,y.current=a,v.current=c,w.current=u});const k=s.useMemo(()=>{const t=new Array(e.length).fill(1);return[e,t]},[e]),x=s.useMemo(()=>({hooks:{draw:e=>{(function(e,t,n,a,s,r){if(0===t.length)return;const o=e.ctx,i=e.bbox,l=i.left,c=i.top,u=i.width,d=i.height;if(u<=0||d<=0)return;const h=8*(window.devicePixelRatio||1);o.save(),o.beginPath(),o.roundRect(l,c,u,d,h),o.clip();const m=e.data[0],p=m.length;if(0===p)return;const g=s??m[0],f=(r??m[p-1])-g||1,y=p>1?m[1]-m[0]:f/p,b=e=>l+(e-g)/f*u,v=e=>c+d*(1-e);for(let w=0;w=0;t--){const e=m[t],n=v(s[t]),a=b(t0&&o.lineTo(r,v(s[t-1]))}o.closePath(),o.fill(),o.restore()}a&&a.values.length>0&&function(e,t,n,a){const s=e.ctx,r=e.bbox,o=r.left,i=r.top,l=r.width,c=r.height;if(l<=0||c<=0)return;const u=e.data[0],d=u.length,h=t.values;if(0===d||0===h.length)return;const m=window.devicePixelRatio||1,p=n??u[0],g=(a??u[d-1])-p||1,f=e=>o+(e-p)/g*l,y=e=>i+c*(1-e),b=hs(t.color),v=(t.lineWidth??2)*m;s.save(),s.strokeStyle=b,s.lineWidth=v,s.lineCap="round",s.lineJoin="round",s.beginPath();let w=0;for(;w=d)return void s.restore();const C=f(u[w]),k=y(h[w]);s.moveTo(C,k);for(let D=w+1;D({width:400,height:200,padding:[8,0,0,32],cursor:{show:!0,x:!0,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],hooks:{setCursor:[e=>{var t,n,a,s;const r=e.cursor.idx;if(null!=r&&r>=0){const a=e.data[0][r];null==(t=f.current)||t.call(f,r,a);const s=e.cursor.left,o=e.cursor.top;if(void 0!==s&&void 0!==o&&null!==s&&null!==o){const t=window.devicePixelRatio||1,a=e.ctx,r=Math.round((e.bbox.left/t+s)*t),i=Math.round((e.bbox.top/t+o)*t),l=a.getImageData(r,i,1,1).data,c=l[0],u=l[1],d=l[2];let h=null;if(l[3]>10){const e=m.current;for(const t of e){const e=hs(t.color),[n,a,s]=ms(e),r=30;if(Math.abs(c-n)<=r&&Math.abs(u-a)<=r&&Math.abs(d-s)<=r){h=t.key;break}}}h!==b.current&&(b.current=h,null==(n=y.current)||n.call(y,h))}}else null==(a=f.current)||a.call(f,null,null),null!==b.current&&(b.current=null,null==(s=y.current)||s.call(y,null))}]},plugins:[x]}),[x]);s.useEffect(()=>{const t=d.current;if(!t||0===e.length)return;const n=C.current,a=e.length,s=Math.abs(a-n);if(!(!h.current||s>100||n>0&&s/n>.1)&&h.current)return h.current.setData(k),void(C.current=a);h.current&&h.current.destroy();const r=t.getBoundingClientRect(),o=Math.floor(r.width)||400,i=Math.floor(r.height)||200,l=new us({...D,width:o,height:i},k,t);return h.current=l,C.current=a,()=>{l.destroy(),h.current=null}},[D,k,e.length]),s.useEffect(()=>{const e=d.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!h.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&h.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{h.current&&h.current.redraw()},[o,t,l]);const A=s.useCallback(()=>{null==n||n(null,null),null==a||a(null),b.current=null},[n,a]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No data available"}):r.jsx("div",{ref:d,className:"w-full h-full overflow-hidden",onMouseLeave:A})}),ys=s.createContext(null),bs={blksand:"breeze dark",magma:"breeze dark",waves:"breeze dark",stars:"breeze dark",folds:"breeze dark","kde breeze":"breeze dark",ribbon:"breeze light"};function vs(e){const t=W(e);t&&function(e){if("undefined"==typeof document)return;const t=function(e){var t;const n={},a=e.surfaces.defaults;n["--default-tint"]=a.tint,n["--default-light"]=a.light,n["--default-dark"]=a.dark,n["--default-reflex-light"]=String(a.reflexLight),n["--default-reflex-dark"]=String(a.reflexDark),n["--default-blur"]=`${a.blur}px`,n["--default-blur-elevated"]=`${a.blurElevated}px`,n["--default-brightness"]=String(a.brightness),n["--default-bg-opacity"]=`${a.opacity}%`,n["--default-bg-opacity-elevated"]=`${a.opacityElevated}%`,n["--default-stroke-only"]=a.strokeOnly?"1":"0",n["--default-stroke-width"]=a.strokeWidth?`${a.strokeWidth}px`:"0px",n["--default-stroke-color"]=a.strokeColor||"transparent",n["--sidebar-tint"]=e.surfaces.sidebar.tint,n["--tooltip-bg"]=e.colors.bg.surface,n["--hover-tint"]=`rgba(${V(e.colors.accent.primary)}, 0.08)`,n["--shadow-tint"]=`rgba(${V(e.colors.accent.primary)}, 0.35)`,n["--body"]=e.colors.bg.body,n["--surface"]=e.colors.bg.surface,n["--elevated"]=e.colors.bg.elevated,n["--subtle"]=e.colors.bg.subtle,n["--edge-subtle"]=e.colors.border.subtle,n["--edge-strong"]=e.colors.border.strong,n["--fg-primary"]=e.colors.text.primary,n["--fg-secondary"]=e.colors.text.secondary,n["--fg-muted"]=e.colors.text.muted,n["--fg-invert"]=e.colors.text.inverse,n["--signal-excellent"]=e.colors.signal.excellent,n["--signal-good"]=e.colors.signal.good,n["--signal-fair"]=e.colors.signal.fair,n["--signal-poor"]=e.colors.signal.poor,n["--signal-critical"]=e.colors.signal.critical,n["--signal-unknown"]=e.colors.signal.unknown,n["--sparkline-excellent"]=e.colors.signal.excellent,n["--sparkline-good"]=e.colors.signal.good,n["--sparkline-fair"]=e.colors.signal.fair,n["--sparkline-poor"]=e.colors.signal.poor,n["--sparkline-critical"]=e.colors.signal.critical,n["--status-success"]=e.colors.status.success,n["--status-warning"]=e.colors.status.warning,n["--status-danger"]=e.colors.status.danger,n["--status-info"]=e.colors.status.info,n["--status-muted"]=e.colors.status.muted;const s=e.colors.chart;n["--pkt-advert"]=s.c3,n["--pkt-flood"]=s.c7,n["--pkt-txt-msg"]=e.colors.signal.excellent,n["--pkt-ack"]=s.c8,n["--pkt-trace"]=s.c3,n["--pkt-req"]=s.c2,n["--pkt-response"]=s.c5,n["--pkt-grp-txt"]=e.colors.map.room,n["--pkt-grp-data"]=e.colors.status.danger,n["--pkt-path"]=s.c3,n["--pkt-anon"]=s.c3,n["--pkt-unknown"]=e.colors.status.muted,n["--route-flood"]=s.c1,n["--route-direct"]=s.c3,n["--route-transport"]=s.c8,n["--chart-1"]=s.c1,n["--chart-2"]=s.c2,n["--chart-3"]=s.c3,n["--chart-4"]=s.c4,n["--chart-5"]=s.c5,n["--chart-6"]=s.c6,n["--chart-7"]=s.c7,n["--chart-8"]=s.c8,n["--chart-grid"]=s.grid,n["--chart-axis-tick"]=s.axis,n["--chart-cursor"]=s.cursor,n["--metric-received"]=e.colors.metric.received,n["--metric-forwarded"]=e.colors.metric.forwarded,n["--metric-transmitted"]=e.colors.metric.transmitted,n["--metric-dropped"]=e.colors.metric.dropped,n["--metric-neutral"]=e.colors.text.secondary,n["--log-debug"]=e.colors.status.muted,n["--log-info"]=e.colors.status.info,n["--log-warning"]=e.colors.status.warning,n["--log-error"]=e.colors.status.danger,n["--log-critical"]=e.colors.status.danger;const r=e.colors.map;n["--map-node-fill"]=T.blue,n["--map-node-stroke"]="rgba(255,255,255,0.9)",n["--map-hub-color"]=T.purple,n["--map-hub-stroke"]="rgba(255,255,255,0.9)",n["--map-gateway-color"]=T.indigo,n["--map-gateway-stroke"]="rgba(255,255,255,0.85)",n["--map-local-color"]=T.amber,n["--map-neighbor-color"]=T.amber,n["--map-neighbor-stroke"]="rgba(0,0,0,0.4)",n["--map-mobile-color"]=T.orange,n["--map-room-color"]=T.pink,n["--map-ghost-color"]=T.cyan,n["--map-edge-rest"]=r.edge,n["--map-edge-rest-bright"]=e.colors.border.strong,n["--map-edge-rest-dim"]=e.colors.bg.subtle,n["--map-edge-hover-direct"]=r.edgeHover,n["--map-edge-hover-loop"]=T.purple,n["--map-edge-hover-standard"]=e.colors.text.muted,n["--map-edge-hover-neighbor"]=T.amber,n["--link-strong"]=e.colors.signal.excellent,n["--link-medium"]=s.c3,n["--link-weak"]=e.colors.status.danger,n["--hop-0"]=s.c7,n["--hop-1"]=e.colors.signal.excellent,n["--hop-2"]=s.c2,n["--hop-3"]=s.c3,n["--hop-distant"]=e.colors.text.muted,n["--hop-hub"]=r.local;const o=e.colors.icon;n["--icon-page-title"]=(null==o?void 0:o.pageTitle)??s.c1,n["--icon-card-title"]=(null==o?void 0:o.cardTitle)??s.c1,n["--icon-widget"]=(null==o?void 0:o.widget)??e.colors.text.secondary,n["--icon-action"]=(null==o?void 0:o.action)??e.colors.text.secondary,n["--icon-nav"]=(null==o?void 0:o.nav)??e.colors.text.muted,n["--icon-nav-active"]=(null==o?void 0:o.navActive)??s.c1,n["--toggle-on"]=e.colors.signal.excellent,n["--toggle-off"]=e.colors.bg.elevated;const i=e.meta.isDark,l=e.colors.sidebar;n["--sidebar-bg"]=(null==l?void 0:l.bg)??"transparent",n["--sidebar-nav-hover-bg"]=(null==l?void 0:l.navHoverBg)??(i?"rgba(255, 255, 255, 0.05)":"rgba(0, 0, 0, 0.04)"),n["--sidebar-nav-active-bg"]=(null==l?void 0:l.navActiveBg)??`color-mix(in srgb, ${s.c1} 15%, transparent)`,n["--sidebar-nav-active-text"]=(null==l?void 0:l.navActiveText)??s.c1,n["--data-box-bg"]=i?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.03)",n["--data-box-border"]=i?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.08)",n["--subtle-fill"]=i?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.03)",n["--subtle-fill-hover"]=i?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.05)",n["--subtle-fill-strong"]=i?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.06)",n["--color-pill-bg"]=i?"rgba(0, 0, 0, 0.3)":"rgba(255, 255, 255, 0.3)",n["--terminal-bg"]=i?"rgba(0, 0, 0, 0.4)":"rgba(0, 0, 0, 0.03)",n["--terminal-bg-input"]=i?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.05)",n["--terminal-bg-status"]=i?"rgba(0, 0, 0, 0.3)":"rgba(0, 0, 0, 0.04)",n["--terminal-border"]=i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.1)",n["--terminal-autocomplete-bg"]=i?"rgba(0, 0, 0, 0.8)":"rgba(255, 255, 255, 0.95)",n["--terminal-autocomplete-border"]=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)",n["--terminal-autocomplete-hover"]=i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.05)",n["--livedot-idle"]=i?"#666677":"#999999",n["--ctrl-panel-top"]=i?"rgba(30, 30, 30, 0.95)":"rgba(240, 240, 240, 0.95)",n["--ctrl-panel-mid"]=i?"rgba(25, 25, 25, 0.95)":"rgba(235, 235, 235, 0.95)",n["--ctrl-panel-bottom"]=i?"rgba(20, 20, 20, 0.95)":"rgba(230, 230, 230, 0.95)",n["--ctrl-panel-border"]=i?"rgba(60, 60, 60, 1)":"rgba(200, 200, 200, 1)",n["--chart-grid-line"]=i?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.08)",n["--surface-ring"]=i?"inset 0 0 0 1px rgba(255, 255, 255, 0.1)":"inset 0 0 0 1px rgba(0, 0, 0, 0.08)",n["--surface-ring-strong"]=i?"inset 0 0 0 1px rgba(255, 255, 255, 0.15)":"inset 0 0 0 1px rgba(0, 0, 0, 0.12)",n["--surface-tint-subtle"]=i?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",n["--surface-tint-light"]=i?"rgba(255, 255, 255, 0.05)":"rgba(0, 0, 0, 0.03)",n["--surface-border-subtle"]=i?"rgba(255, 255, 255, 0.05)":"rgba(0, 0, 0, 0.06)",n["--map-control-active-amber"]=i?"rgba(251, 191, 36, 0.15)":"rgba(217, 119, 6, 0.12)",n["--map-control-active-sky"]=i?"rgba(56, 189, 248, 0.15)":"rgba(14, 165, 233, 0.12)",n["--map-control-active-teal"]=i?"rgba(45, 212, 191, 0.15)":"rgba(20, 184, 166, 0.12)",n["--sidebar-action-active-green"]=i?"rgba(10, 26, 10, 1)":"rgba(220, 252, 231, 1)",n["--sidebar-action-active-teal"]=i?"rgba(10, 36, 32, 1)":"rgba(204, 251, 241, 1)",n["--sidebar-action-active-amber"]=i?"rgba(26, 20, 8, 1)":"rgba(254, 243, 199, 1)",n["--thumbnail-brightness"]=i?"1.5":"1.8",n["--input-bg"]=i?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.03)",n["--input-border"]=i?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.08)",n["--font-title"]=e.typography.font.title,n["--font-display"]=e.typography.font.display,n["--font-data"]=e.typography.font.mono,n["--font-card-title"]=e.typography.font.cardTitle??e.typography.font.display,n["--font-badge"]=e.typography.font.badge??e.typography.font.display,n["--font-normal"]=String(e.typography.weight.normal),n["--font-medium"]=String(e.typography.weight.medium),n["--font-semibold"]=String(e.typography.weight.semibold),n["--font-bold"]=String(e.typography.weight.bold),n["--font-card-title-weight"]=String(e.typography.weight.cardTitle??e.typography.weight.semibold),n["--font-badge-weight"]=String(e.typography.weight.badge??e.typography.weight.medium),n["--badge-text-transform"]=(null==(t=e.typography.badge)?void 0:t.textTransform)??"none";const c=e.typography.size;c.xxl&&(n["--text-2xl"]=c.xxl),c.xl&&(n["--text-xl"]=c.xl),c.lg&&(n["--text-lg"]=c.lg),c.md&&(n["--text-md"]=c.md),c.base&&(n["--text-base"]=c.base),c.sm&&(n["--text-sm"]=c.sm),c.xs&&(n["--text-xs"]=c.xs),c.hero&&(n["--text-5xl"]=c.hero),c.cardTitle&&(n["--text-card-title"]=c.cardTitle);const u=e.typography.tracking;return u&&(n["--tracking-tight"]=u.tight,n["--tracking-normal"]=u.normal,n["--tracking-wide"]=u.wide),n["--theme-transition"]=`${e.motion.slow} ${e.motion.easing}`,function(e){if(!z())return e;const t={},n=/^#[0-9A-Fa-f]{3,6}$/;for(const[a,s]of Object.entries(e))t[a]=n.test(s)?N(s):s;return t}(n)}(e),n=document.documentElement;for(const[a,s]of Object.entries(t))n.style.setProperty(a,s);e.surfaces.defaults.strokeOnly?n.classList.add("stroke-only"):n.classList.remove("stroke-only"),e.surfaces.defaults.catalystMode?n.classList.add("catalyst-mode"):n.classList.remove("catalyst-mode"),n.dataset.mode=e.meta.isDark?"dark":"light"}(t),document.documentElement.dataset.themeId=e}function ws({children:e}){const[t,n]=s.useState(()=>function(){if("undefined"==typeof window)return K;try{let e=localStorage.getItem(X);const t=localStorage.getItem(J);if(!e){const t=localStorage.getItem(Z),n=localStorage.getItem(Q);t?e=t:n&&(e=n),e&&(localStorage.setItem(X,e),localStorage.removeItem(Z),localStorage.removeItem("pymc-background-image"),localStorage.removeItem(Q))}e&&e in bs&&(e=bs[e],localStorage.setItem(X,e));const n=e&&H(e)?e:K.themeId;let a=K.brightness;if(t){const e=parseInt(t,10);!isNaN(e)&&e>=0&&e<=100&&(a=e)}return{themeId:n,brightness:a}}catch{return K}}()),a=s.useRef(!1),o=s.useRef(null),[i,l]=s.useState(null);s.useEffect(()=>{o.current&&(clearTimeout(o.current),o.current=null),a.current&&(l("#808080"),o.current=setTimeout(()=>{l(null),o.current=null},1800)),a.current=!0,vs(t.themeId),ds.clear(),requestAnimationFrame(()=>{!function(){if("undefined"==typeof window)return;for(const t of ne){const e=le(`--palette-${t}-bright`),n=le(`--palette-${t}`),a=e||n;if(!a)continue;const s=ie(a);for(const r of te)ce(`--palette-${t}-${r}`,s[r])}const e=le("--palette-bg-4");if(e){const t=ie(e);for(const e of te)ce(`--palette-neutral-${e}`,t[e])}}()})},[t.themeId]),s.useEffect(()=>{!function(e){if("undefined"!=typeof window)try{localStorage.setItem(X,e.themeId),localStorage.setItem(J,String(e.brightness))}catch{}}(t)},[t]),s.useEffect(()=>{U.forEach(e=>{var t;e.meta.backgroundImage&&(t=e.meta.backgroundImage)&&((new Image).src=t)})},[]);const c=s.useCallback(e=>{if(!H(e))return;const t=W(e);t&&n(n=>({...n,themeId:e,brightness:t.meta.backgroundBrightness}))},[]),u=s.useCallback(e=>{const t=Math.max(0,Math.min(100,Math.round(e)));n(e=>({...e,brightness:t}))},[]),d=s.useMemo(()=>({theme:t,setTheme:c,setBrightness:u}),[t,c,u]);return r.jsxs(ys.Provider,{value:d,children:[e,i&&r.jsx("div",{className:"fixed inset-0 pointer-events-none z-[9999]",style:{backgroundColor:i,animation:"theme-crossfade 1.8s ease-out forwards"}},t.themeId),r.jsx("style",{children:"\n @keyframes theme-crossfade {\n from { opacity: 0.35; }\n to { opacity: 0; }\n }\n "})]})}function Cs(){const e=s.useContext(ys);if(!e)throw new Error("useTheme must be used within a ThemeProvider. Wrap your app with in App.tsx.");return e}const ks=s.forwardRef(function(e,t){const{href:n,...a}=e;return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("//")?r.jsx(o,{children:r.jsx("a",{...a,href:n,ref:t})}):r.jsx(o,{children:r.jsx(D,{...a,to:n,ref:t})})}),xs={0:"REQ",1:"RESPONSE",2:"TXT_MSG",3:"ACK",4:"ADVERT",5:"GRP_TXT",6:"GRP_DATA",7:"ANON_REQ",8:"PATH",9:"TRACE",10:"MULTIPART",15:"RAW_CUSTOM"},Ds={0:"T_FLOOD",1:"FLOOD",2:"DIRECT",3:"T_DIRECT"},As={REQ:0,RESPONSE:1,TXT_MSG:2,ACK:3,ADVERT:4,GRP_TXT:5,GRP_DATA:6,ANON_REQ:7,PATH:8,TRACE:9,MULTIPART:10,RAW_CUSTOM:15};function Es(e){return 1===e||0===e}const Bs={acton:{discrete:["#260D40","#2B1345","#2F194B","#342152","#382657","#3C2C5C","#403261","#443766","#483E6C","#4C4371","#504876","#544D7B","#57527F","#5D5884","#625C88","#685F8A","#6E618C","#74628D","#7B638D","#81638E","#88648E","#8E648E","#95658F","#9D658F","#A4668F","#AB6690","#B26790","#BB6992","#C26B94","#C86F97","#CD749B","#D07AA0","#D382A7","#D688AC","#D88FB2","#D995B8","#DB9CBD","#DEA4C4","#DFABC9","#E1B1CE","#E3B7D3","#E5BED8","#E6C5DE","#E8CBE2","#E9D0E6","#EBD6EA","#ECDBEE","#EDE1F3","#EFE6F6","#F0EAFA"],categorical:["#260D40","#F0EAFA","#A76690","#DDA1C2","#585380","#7D638E","#E8CAE1","#CF789E","#403261","#4C4371","#ECDBEE","#69608B","#E3B6D2","#D78CB0","#91648F","#BE6A92","#342152","#EAD3E8","#524B79","#73628D","#463A69","#605B86","#E5C0DA","#D382A7","#C86F97","#86648E","#EEE3F4","#DA97B9","#9B658F","#B26790","#2D1749","#E0ACCA","#3A2959","#8B648E","#311C4D","#EBD7EB","#EDDFF1","#AC6790","#A1668F","#6E618C","#E6C5DE","#78628D","#433665","#DEA7C6","#81638E","#554F7C","#B86891","#3D2D5D","#4F4775","#EFE7F7","#E9CEE4","#D27DA3","#2A1244","#655D89","#C36C94","#E1B1CE","#493F6D","#5C5783","#CC739A","#DB9CBD","#D892B4","#D587AB","#96658F","#E4BBD6","#362455","#4E4573","#7F638E","#D37FA5","#E1AECC","#382657","#EBD9ED","#DFA9C8","#A4668F","#8E648E","#99658F","#675F8A","#B56891","#BB6992","#E5BED8","#E2B4D0","#D07AA0","#71618C","#E6C2DC","#AA6690","#625C88","#EDE1F3","#E8CCE3","#AF6790","#CA7199","#C16B93","#453867","#57517E","#84638E","#4B416F","#E7C7DF","#423463","#514977","#3E2F5F","#544D7B","#93658F"]},bam:{discrete:["#65024B","#701057","#7B1B61","#88276E","#923078","#9B3881","#A4418A","#AC4993","#B5549C","#BC5CA3","#C266AB","#C970B2","#CF7AB9","#D587C1","#DA93C8","#DF9ECE","#E3AAD4","#E7B5DA","#EBC2E0","#EECCE5","#F1D5E9","#F3DDED","#F5E4F0","#F6EBF1","#F6EFF1","#F5F2F0","#F3F3ED","#EFF3E6","#EBF1DF","#E5EFD5","#DDEBCA","#D4E6BD","#C8DEAB","#BCD79B","#B0CE8C","#A3C67D","#97BC6F","#88B161","#7CA856","#72A04D","#679845","#5E903D","#538735","#4B7F2E","#427827","#397021","#306819","#245D10","#195507","#0D4C00"],categorical:["#65024B","#701057","#7B1B61","#88276E","#923078","#9B3881","#A4418A","#AC4993","#B5549C","#BC5CA3","#C266AB","#C970B2","#CF7AB9","#D587C1","#DA93C8","#DF9ECE","#E3AAD4","#E7B5DA","#EBC2E0","#EECCE5","#F1D5E9","#F3DDED","#F5E4F0","#F6EBF1","#F6EFF1","#F5F2F0","#F3F3ED","#EFF3E6","#EBF1DF","#E5EFD5","#DDEBCA","#D4E6BD","#C8DEAB","#BCD79B","#B0CE8C","#A3C67D","#97BC6F","#88B161","#7CA856","#72A04D","#679845","#5E903D","#538735","#4B7F2E","#427827","#397021","#306819","#245D10","#195507","#0D4C00"]},bamako:{discrete:["#003B47","#023C46","#053E45","#083F43","#0A4141","#0D4340","#0F443E","#12463C","#16483A","#194A38","#1C4D36","#204F34","#235132","#28542F","#2C572C","#305A2A","#355C27","#395F24","#3F6321","#44661E","#49691A","#4E6D17","#537014","#5A7410","#5F780D","#657C09","#6A7F05","#718302","#788501","#7F8700","#858800","#8C8A00","#948C01","#9B8E04","#A1920B","#A89713","#AE9C1B","#B7A225","#BEA82E","#C5AD37","#CBB341","#D2B84D","#D9BF5B","#DEC567","#E4CA73","#E9D07E","#EFD58A","#F5DB97","#FAE0A3","#FFE5AD"],categorical:["#003B47","#FFE5AD","#61790B","#B4A022","#245231","#406420","#898900","#DDC464","#0F443E","#EFD58A","#CAB23F","#194A38","#748401","#506E16","#9E9108","#315A29","#083F43","#A99815","#948C01","#6A7F05","#BFA930","#7F8700","#14473B","#1E4E35","#F7DD9C","#2A562D","#043D45","#597411","#E6CC77","#385F25","#48691B","#D4BB51","#0B4241","#8F8A00","#44661E","#1B4C37","#547113","#6F8203","#12463D","#998E03","#27542F","#4C6B18","#A4940E","#2E582B","#355C27","#B9A529","#215033","#EAD181","#FBE1A5","#C5AD37","#3C6122","#848800","#063E44","#E2C86E","#D9BF5B","#CFB648","#16493A","#798600","#023C46","#667C08","#5D770E","#0D433F","#AE9C1B","#F3D993","#094042","#A69611","#8C8A00","#053E45","#0C4240","#365E26","#6D8004","#9C8F05","#4A6A1A","#D6BD56","#B19E1F","#F9DFA0","#647B0A","#2F592A","#10453D","#818800","#C7AF3B","#46681C","#0E443F","#265330","#174A39","#335B28","#5B750F","#778501","#5F780D","#E8CF7C","#718302","#F1D78E","#978D02","#F5DB97","#204F34","#AC9A18","#29552E","#A1920B","#B7A225","#033C46"]},bamo:{discrete:["#4F3043","#56304B","#603354","#6D3961","#793F6B","#834675","#8D4E7E","#965587","#A05E91","#A86698","#B06EA0","#B877A7","#BF81AF","#C78DB8","#CD98BE","#D2A3C4","#D6ADC8","#D9B5CB","#DABECC","#DAC3CC","#D9C7CA","#D8CAC8","#D6CBC6","#D4CDC2","#D1CDBE","#CCCDB9","#C6CBB1","#BCC5A4","#B2BE97","#A7B58A","#9CAB7E","#92A174","#889669","#808D62","#79855C","#737D56","#6D7552","#666C4C","#616548","#5C5D45","#575642","#54503F","#50493D","#4D453C","#4B403B","#4A3C3A","#49393A","#49343B","#4A313E","#4E3042"],categorical:["#4F3043","#56304B","#603354","#6D3961","#793F6B","#834675","#8D4E7E","#965587","#A05E91","#A86698","#B06EA0","#B877A7","#BF81AF","#C78DB8","#CD98BE","#D2A3C4","#D6ADC8","#D9B5CB","#DABECC","#DAC3CC","#D9C7CA","#D8CAC8","#D6CBC6","#D4CDC2","#D1CDBE","#CCCDB9","#C6CBB1","#BCC5A4","#B2BE97","#A7B58A","#9CAB7E","#92A174","#889669","#808D62","#79855C","#737D56","#6D7552","#666C4C","#616548","#5C5D45","#575642","#54503F","#50493D","#4D453C","#4B403B","#4A3C3A","#49393A","#49343B","#4A313E","#4E3042"]},batlow:{discrete:["#011959","#06215B","#0A285C","#0D315D","#0E375E","#103D5F","#114260","#124761","#144D62","#165162","#195662","#1C5A62","#205E61","#26635F","#2C665D","#33695A","#3A6C57","#416F53","#4A724E","#52744A","#5A7745","#627941","#6A7B3D","#747E38","#7D8134","#868330","#8F862D","#9B892B","#A58B2C","#AF8D2E","#B98F32","#C29037","#CD923F","#D69446","#DE964F","#E69858","#ED9A62","#F39E70","#F8A17B","#FAA587","#FCA993","#FDAC9E","#FDB1AB","#FDB4B6","#FDB8C0","#FDBCCB","#FCBFD6","#FCC4E3","#FBC8EF","#FACCFA"],categorical:["#011959","#FACCFA","#828231","#226061","#F29D6D","#4D734D","#114360","#C09036","#FDB4B4","#DD954D","#356A59","#FCBFD6","#175262","#677B3E","#A18A2B","#0D315D","#FCA890","#FBC6E8","#2B655E","#B18D2F","#5A7745","#FDAEA2","#CF9340","#0F3B5F","#E9995C","#FDBAC4","#416F53","#91862D","#1B5962","#08255B","#747E38","#134B61","#F9A380","#8A842F","#0E365E","#124761","#154F62","#E39754","#7B8034","#1E5D62","#99882C","#195662","#0B2B5C","#FDB7BC","#C8913B","#FCC3DF","#EE9B64","#A98C2C","#FDB1AB","#FDBCCD","#FBC9F1","#051F5A","#F6A077","#607942","#FDAB9A","#477150","#3B6D56","#B98F32","#26635F","#537549","#D69446","#6D7C3B","#30685C","#103F60","#FBA689","#BD8F34","#CB923E","#EB9A60","#FDB8C0","#FBC7EC","#F09C69","#8E852E","#FDBBC9","#7F8133","#031C5A","#114160","#FDAC9E","#5D7844","#FCA995","#185462","#787F36","#A58B2C","#0A285C","#9D892B","#33695A","#0D335E","#637A40","#165062","#124561","#205E61","#144D62","#1D5B62","#0C2E5D","#D9954A","#3E6E55","#AD8C2D","#F49F72","#868330","#B58E30","#577647"]},batlowk:{discrete:["#04050A","#0A0D15","#0F141E","#121B29","#152233","#18293D","#1C3146","#21384F","#274156","#2C485B","#314E5E","#36535F","#3B575F","#405C5E","#445F5D","#49625B","#4D6558","#526756","#586B52","#5E6E4F","#63724B","#6A7548","#717845","#797D41","#81813E","#8A853B","#938839","#9F8D38","#A99139","#B3943B","#BE973E","#C89A43","#D39D4C","#DB9F54","#E2A15D","#E8A366","#EEA570","#F3A77C","#F6A986","#F8AC91","#FAAE9A","#FCB1A4","#FDB4B0","#FDB7B9","#FDBAC3","#FDBDCD","#FDC1D8","#FCC5E4","#FBC8EF","#FACCFA"],categorical:["#04050A","#FDC0D6","#787C41","#38555F","#E5A160","#536855","#AF933A","#FAAE9A","#1A2E43","#FDB6B7","#294458","#455F5C","#63724B","#CD9B47","#91883A","#F3A77E","#111A27","#F7AB8D","#FDBBC5","#FCB2AA","#D99E52","#A18E38","#4C6459","#21384F","#3F5B5E","#152335","#0C1019","#EEA570","#5B6D50","#6C7647","#314E5E","#85823D","#BE973E","#7E7F3F","#FBB0A2","#49625B","#576A53","#0F151F","#2D495B","#DFA059","#727944","#FDBDCD","#253E54","#EAA368","#C69942","#3C585F","#998B38","#677449","#F1A678","#F9AC92","#141F2F","#1D3248","#506657","#090C13","#A99139","#5F6F4E","#35525F","#435D5D","#FDB8BD","#F5A984","#B5953B","#FDB5B2","#17273B","#D39D4C","#8C853B","#9D8C38","#415C5E","#1F354B","#33505E","#FCB1A6","#101723","#3E595F","#121C2B","#757B43","#06080F","#FCB3AE","#3A565F","#274156","#61704D","#88843C","#2B475A","#FDBED1","#6A7548","#596C51","#192B3F","#6F7845","#233B51","#C99A45","#F0A574","#DC9F55","#2F4B5D","#47615C","#F6AA88","#FDB9C1","#C29840","#4A635A","#FAAD96","#81813E","#7B7E40","#E7A264"]},batloww:{discrete:["#011959","#06215B","#0A285C","#0D315D","#0E375E","#103D5F","#114260","#124761","#144C62","#165062","#185562","#1B5962","#1F5D62","#246261","#2A665F","#30695D","#366C5A","#3D7056","#467352","#4E764E","#56794A","#5E7C46","#667F42","#70823D","#798539","#828936","#8C8C33","#989032","#A29433","#AD9738","#B79B3F","#C19E48","#CBA154","#D3A45E","#D9A669","#DFA872","#E4AA7C","#E9AC88","#EEAF91","#F2B39C","#F6B9A8","#F9C0B5","#FCCAC4","#FED3CF","#FFDBDA","#FFE3E2","#FFEAEA","#FFF2F2","#FFF8F8","#FFFEFE"],categorical:["#FFFEFE","#011959","#7E8737","#205F61","#E7AB84","#497451","#114360","#FED1CD","#BF9D46","#637E44","#9E9233","#FFEAEA","#0D315D","#326B5C","#F5B7A6","#165162","#D7A564","#0F3B5F","#1A5862","#3D7056","#FFF5F5","#FFDFDD","#FAC3BA","#134A61","#08255B","#70823D","#EEB094","#56794A","#E0A874","#8E8D33","#28655F","#AF9839","#CBA154","#EBAD8B","#1D5C62","#051F5A","#124761","#FFE5E4","#B79B3F","#A79535","#386D59","#5C7B47","#185562","#DBA76D","#F8BDAF","#FFF0F0","#246261","#F2B39C","#868A35","#4F774D","#E4AA7C","#2D685E","#77853A","#FED8D6","#103F60","#FFFAF9","#968F32","#D1A35C","#144E62","#FCCAC4","#437254","#698040","#0E365E","#0B2B5C","#C59F4C","#30695D","#1C5A62","#A29433","#407155","#FFDBDA","#0C2E5D","#F7BAAA","#E5AB80","#175362","#828936","#1F5D62","#BB9C42","#E9AC88","#FFF7F7","#3A6E58","#9A9132","#8A8B34","#4C754F","#FFEDED","#D9A669","#144C62","#266460","#FDCDC9","#FCC6BF","#FFE2E1","#FFFCFC","#7B8639","#2B675E","#155062","#5F7C45","#F9C0B5","#356C5A","#F3B5A1","#EDAF8F","#FED5D2"]},berlin:{discrete:["#9EB0FF","#93AFFA","#87ADF4","#79ABED","#6CA9E6","#60A5DF","#54A0D5","#489ACA","#3E90BC","#3787AF","#327EA3","#2D7597","#296B8B","#25607C","#225771","#1E4E65","#1B465A","#183D4F","#153342","#122C38","#11242E","#101D25","#11181C","#121214","#160E0D","#1B0B07","#210B03","#270D01","#2D0E00","#340F00","#3B1100","#421301","#4B1602","#541905","#5D1E09","#68240F","#732B16","#803620","#8A3F2A","#944834","#9E513F","#A85A4A","#B46658","#BE6F63","#C8796F","#D2837A","#DD8D86","#EA9995","#F4A3A1","#FFADAD"],categorical:["#9EB0FF","#93AFFA","#87ADF4","#79ABED","#6CA9E6","#60A5DF","#54A0D5","#489ACA","#3E90BC","#3787AF","#327EA3","#2D7597","#296B8B","#25607C","#225771","#1E4E65","#1B465A","#183D4F","#153342","#122C38","#11242E","#101D25","#11181C","#121214","#160E0D","#1B0B07","#210B03","#270D01","#2D0E00","#340F00","#3B1100","#421301","#4B1602","#541905","#5D1E09","#68240F","#732B16","#803620","#8A3F2A","#944834","#9E513F","#A85A4A","#B46658","#BE6F63","#C8796F","#D2837A","#DD8D86","#EA9995","#F4A3A1","#FFADAD"]},bilbao:{discrete:["#4C0001","#54070B","#5B0E13","#64161A","#6B1D20","#712227","#77282D","#7D2E34","#84343B","#8A3A41","#8F4047","#94464B","#984C4F","#9B5253","#9D5754","#9E5C56","#A06057","#A16458","#A26959","#A36D5A","#A4715B","#A5745B","#A6785C","#A77C5D","#A8805E","#A9845F","#AA875F","#AC8C60","#AD9061","#AE9463","#AF9864","#B19D68","#B3A36E","#B6A975","#B8AD7E","#BBB287","#BDB590","#C0B99A","#C2BCA3","#C4BFAA","#C6C2B2","#C8C5B9","#CBCAC1","#CFCEC9","#D5D4D1","#DBDBDA","#E3E3E2","#EDEDED","#F6F6F6","#FFFFFF"],categorical:["#4C0001","#F8F8F8","#A9815E","#984D50","#BEB794","#AF9965","#CCCAC3","#78292F","#A26A59","#9F5D56","#64161A","#B6AA77","#C4C0AC","#A6765C","#8A3A41","#AC8C60","#DDDDDB","#A16358","#C7C5B7","#B3A16B","#A4705A","#6E2024","#EAEAE9","#92434A","#BAB185","#9C5554","#AD9262","#580B10","#813137","#C1BCA1","#AA865F","#D2D2CE","#A77C5D","#D7D7D4","#BCB48D","#B4A571","#C0B99A","#9E5955","#AB8960","#A6795C","#A36D5A","#8E3F46","#85353C","#A16758","#732529","#CAC7BD","#F1F1F0","#520509","#AC8F61","#5E1115","#C6C2B2","#E3E3E2","#691B1F","#B8AD7E","#95484D","#AE9663","#B19D68","#A5735B","#A06057","#9A5152","#A87E5D","#7D2E34","#A9835E","#C3BEA6","#CFCEC9","#A46E5A","#F4F4F4","#DADAD8","#B29F69","#EDEDED","#BBB289","#9D5754","#AF9764","#904148","#994F51","#B3A36E","#A87F5E","#A26859","#AC8D61","#BDB590","#AA875F","#A77A5D","#AB8A60","#A4715B","#611418","#BFB897","#E6E6E6","#9B5353","#D5D4D1","#974A4F","#C8C6BA","#A16558","#9F5E56","#76272C","#67191D","#8C3C43","#B9AF82","#C3BFA9","#B5A874","#4F0205"]},broc:{discrete:["#2C1A4C","#2B2154","#2B295B","#2A3164","#29396C","#284174","#29497C","#2A5183","#305C8C","#376593","#416D9A","#4B76A0","#567FA6","#6489AD","#6F92B3","#7B9BBA","#86A3C0","#92ACC6","#A0B7CD","#ACC0D3","#B8C9DA","#C4D2E0","#D0DBE6","#DEE5EC","#E7ECED","#EDEFE9","#EDEEE1","#E9E9D4","#E4E4C8","#DEDEBD","#D8D8B1","#D2D2A5","#C9C996","#C1C18A","#B8B87E","#AEAE73","#A3A369","#97975E","#8D8D56","#83834D","#797945","#70703D","#646434","#5B5B2C","#525224","#49491D","#404016","#36360F","#2E2E08","#262600"],categorical:["#2C1A4C","#2B2154","#2B295B","#2A3164","#29396C","#284174","#29497C","#2A5183","#305C8C","#376593","#416D9A","#4B76A0","#567FA6","#6489AD","#6F92B3","#7B9BBA","#86A3C0","#92ACC6","#A0B7CD","#ACC0D3","#B8C9DA","#C4D2E0","#D0DBE6","#DEE5EC","#E7ECED","#EDEFE9","#EDEEE1","#E9E9D4","#E4E4C8","#DEDEBD","#D8D8B1","#D2D2A5","#C9C996","#C1C18A","#B8B87E","#AEAE73","#A3A369","#97975E","#8D8D56","#83834D","#797945","#70703D","#646434","#5B5B2C","#525224","#49491D","#404016","#36360F","#2E2E08","#262600"]},broco:{discrete:["#372F38","#36303D","#363144","#36354E","#363957","#373F60","#39456A","#3C4D75","#415780","#47608A","#4D6992","#55729A","#5D7BA2","#6886AA","#728FB1","#7C97B7","#86A0BD","#91A8C2","#9DB2C8","#A7BACC","#B1C1CE","#BAC8D0","#C2CDD0","#CAD1CD","#CED3C8","#CFD3C2","#CFD1B9","#CBCCAD","#C6C6A2","#BFBF96","#B8B78B","#AFAF7F","#A4A472","#9B9A68","#91915E","#888755","#7E7E4C","#737243","#6B693D","#626137","#5B5932","#54512E","#4C482B","#474229","#423D29","#3F3829","#3C352B","#39322E","#383032","#372F37"],categorical:["#372F38","#36303D","#363144","#36354E","#363957","#373F60","#39456A","#3C4D75","#415780","#47608A","#4D6992","#55729A","#5D7BA2","#6886AA","#728FB1","#7C97B7","#86A0BD","#91A8C2","#9DB2C8","#A7BACC","#B1C1CE","#BAC8D0","#C2CDD0","#CAD1CD","#CED3C8","#CFD3C2","#CFD1B9","#CBCCAD","#C6C6A2","#BFBF96","#B8B78B","#AFAF7F","#A4A472","#9B9A68","#91915E","#888755","#7E7E4C","#737243","#6B693D","#626137","#5B5932","#54512E","#4C482B","#474229","#423D29","#3F3829","#3C352B","#39322E","#383032","#372F37"]},buda:{discrete:["#B301B3","#B30BAE","#B314AA","#B31CA6","#B323A2","#B3289F","#B32E9D","#B4339A","#B53998","#B63E96","#B84394","#B94892","#BB4C91","#BD528F","#BE568D","#C05B8C","#C15F8A","#C36389","#C46987","#C66D86","#C77184","#C97583","#CA7982","#CB7E80","#CD837F","#CE877E","#CF8B7D","#D0917B","#D1957A","#D29979","#D49E78","#D5A277","#D6A776","#D7AC75","#D8B073","#D9B572","#DAB971","#DCBF70","#DDC36F","#DEC86E","#DFCC6C","#E0D16B","#E2D76A","#E4DC69","#E6E168","#E9E667","#EDEC67","#F3F366","#F9F966","#FFFF66"],categorical:["#B301B3","#FFFF66","#CD857E","#BC4E90","#DBBD70","#C56A87","#B32F9C","#E3DB69","#D4A177","#EDEC67","#D1937B","#B73F95","#C05C8B","#DFCB6D","#C97882","#B31CA6","#D8AE74","#E7E368","#DAB572","#B311AC","#D39A79","#C36389","#C77184","#B53798","#E1D36B","#BE558E","#B94793","#CB7E80","#CF8C7C","#DDC46E","#B326A0","#F6F566","#D6A875","#DAB971","#C66E86","#E2D76A","#B32B9E","#B317A9","#B4339A","#BA4B91","#C46788","#C2608A","#B309AF","#D49E78","#B63B97","#BD528F","#DCC06F","#EAE767","#FAFA66","#D2977A","#F1F066","#D0907C","#CE897D","#C87483","#CC827F","#D5A576","#B321A3","#E5DF68","#B84394","#D9B273","#E0CF6C","#CA7B81","#DEC86E","#BF598C","#D7AB75","#E6E168","#D1957A","#CC8080","#D39C78","#E0CD6C","#CD847F","#B63D96","#C87384","#C66C86","#F8F866","#D49F78","#D9B473","#DAB772","#BF578D","#CB7D81","#CF8A7D","#B32D9D","#D08E7C","#DBBB71","#C2628A","#E2D56A","#DCBF70","#BC508F","#C46987","#C05B8C","#DFCA6D","#DDC26F","#C15E8B","#D7AD74","#F3F366","#DEC66E","#D5A377","#B31AA7","#BA4992","#CE877E"]},bukavu:{discrete:["#1A3333","#1B373D","#1C3C47","#1E4255","#1F4762","#214E71","#235582","#255E92","#2969A1","#2C73AD","#2F7CB8","#3485C2","#3B8EC7","#4799C8","#50A1C9","#59AAC9","#62B2CA","#6BBACB","#76C3CB","#81CCCD","#92D5D1","#A4DED5","#B6E7DA","#CCF2DF","#DDFBE3","#034224","#08491F","#115119","#1C5914","#2B6212","#3D6915","#4E6E1B","#617224","#6F742B","#7B7631","#867836","#917B3C","#9E7E45","#AA844F","#B48D5D","#BC976C","#C3A27C","#CAB08F","#CFBBA0","#D5C6B0","#DACFC1","#DFD7D0","#E4DFE0","#E9E6ED","#EDEDFC"],categorical:["#1A3333","#1B373D","#1C3C47","#1E4255","#1F4762","#214E71","#235582","#255E92","#2969A1","#2C73AD","#2F7CB8","#3485C2","#3B8EC7","#4799C8","#50A1C9","#59AAC9","#62B2CA","#6BBACB","#76C3CB","#81CCCD","#92D5D1","#A4DED5","#B6E7DA","#CCF2DF","#DDFBE3","#034224","#08491F","#115119","#1C5914","#2B6212","#3D6915","#4E6E1B","#617224","#6F742B","#7B7631","#867836","#917B3C","#9E7E45","#AA844F","#B48D5D","#BC976C","#C3A27C","#CAB08F","#CFBBA0","#D5C6B0","#DACFC1","#DFD7D0","#E4DFE0","#E9E6ED","#EDEDFC"]},cork:{discrete:["#2C194C","#2B2254","#2B295C","#2A3265","#293A6D","#284275","#284A7C","#2A5284","#2F5C8D","#366493","#3F6C99","#49749F","#527CA4","#5E85AA","#688DB0","#7395B6","#7E9DBB","#8AA6C2","#99B1C9","#A5BBD0","#B2C5D7","#C0CFDE","#CDD9E5","#DCE5EB","#E5ECED","#E6EEEA","#E0EAE1","#D4E2D4","#C8DBC8","#BCD3BC","#B0CAB0","#A4C2A3","#95B895","#89B088","#7DA87D","#71A071","#669966","#599059","#4F894E","#458244","#3B7B3A","#317430","#266A25","#1F611D","#1A5816","#174E12","#14450E","#123A0A","#103107","#0F2903"],categorical:["#2C194C","#2B2254","#2B295C","#2A3265","#293A6D","#284275","#284A7C","#2A5284","#2F5C8D","#366493","#3F6C99","#49749F","#527CA4","#5E85AA","#688DB0","#7395B6","#7E9DBB","#8AA6C2","#99B1C9","#A5BBD0","#B2C5D7","#C0CFDE","#CDD9E5","#DCE5EB","#E5ECED","#E6EEEA","#E0EAE1","#D4E2D4","#C8DBC8","#BCD3BC","#B0CAB0","#A4C2A3","#95B895","#89B088","#7DA87D","#71A071","#669966","#599059","#4F894E","#458244","#3B7B3A","#317430","#266A25","#1F611D","#1A5816","#174E12","#14450E","#123A0A","#103107","#0F2903"]},corko:{discrete:["#3F3E3A","#3E3D3F","#3E3D44","#3E3D4B","#3E3F52","#3E425A","#3F4762","#414C6C","#445578","#485D82","#4E658B","#546E94","#5C779C","#6581A5","#6E8AAC","#7792B2","#809BB8","#89A3BD","#94ACC2","#9CB3C5","#A3BAC7","#A9C0C8","#AEC5C7","#B0C9C4","#B0CABF","#ADCAB9","#A9C9B2","#A2C5A8","#9BC19F","#93BC95","#8BB68B","#82B081","#78A775","#709F6A","#689760","#608E56","#5A864C","#537B42","#4F733B","#4B6B35","#486431","#465D2E","#44562C","#43512C","#424D2D","#42492E","#414630","#404333","#404036","#3F3E3A"],categorical:["#3F3E3A","#3E3D3F","#3E3D44","#3E3D4B","#3E3F52","#3E425A","#3F4762","#414C6C","#445578","#485D82","#4E658B","#546E94","#5C779C","#6581A5","#6E8AAC","#7792B2","#809BB8","#89A3BD","#94ACC2","#9CB3C5","#A3BAC7","#A9C0C8","#AEC5C7","#B0C9C4","#B0CABF","#ADCAB9","#A9C9B2","#A2C5A8","#9BC19F","#93BC95","#8BB68B","#82B081","#78A775","#709F6A","#689760","#608E56","#5A864C","#537B42","#4F733B","#4B6B35","#486431","#465D2E","#44562C","#43512C","#424D2D","#42492E","#414630","#404333","#404036","#3F3E3A"]},davos:{discrete:["#00054A","#010E51","#041459","#081C61","#0C2368","#102A6F","#133075","#17377C","#1C3F83","#204588","#244C8D","#295291","#2D5895","#335F98","#38649A","#3C699C","#416E9D","#46729D","#4C779D","#517B9C","#567F9B","#5A829A","#5F8598","#658996","#698C94","#6E8F92","#739290","#78968D","#7D998C","#829D8A","#88A089","#8DA488","#95AA87","#9BAF88","#A3B489","#ABBB8C","#B4C190","#BFCA96","#C9D29E","#D2D9A6","#DBE0AF","#E3E7B8","#EBEDC4","#F0F1CD","#F4F4D6","#F7F7DE","#FAF9E6","#FCFCF0","#FDFDF7","#FEFEFE"],categorical:["#00054A","#FDFDF4","#688B94","#2D5895","#B2C08F","#E8EBC0","#87A089","#133075","#4B769D","#5A829A","#204588","#76958E","#D0D8A4","#99AD88","#F6F6DB","#3C699C","#081C61","#031256","#1A3B7F","#537C9C","#A4B68A","#C1CC98","#7E9A8B","#FAFAE8","#356199","#0E266B","#DEE3B3","#274F90","#6F9091","#618697","#8FA588","#F0F1CD","#43709D","#1D4084","#47739D","#F3F4D4","#658996","#567F9B","#17367A","#FCFBEE","#4F799D","#C9D29E","#93A987","#39659B","#D8DEAB","#ABBB8C","#739290","#B9C693","#F8F8E1","#234A8C","#112B70","#7A978D","#9EB188","#315C97","#829D8A","#05175B","#010C50","#3F6C9D","#0B2065","#5D8499","#2A5392","#8BA388","#6B8D93","#EDEFC7","#E3E7B8","#22488A","#638897","#122E73","#00094D","#AEBD8D","#4D789D","#CDD5A1","#5F8598","#58819A","#071A5E","#0C2368","#18387D","#91A787","#37639A","#EBEDC4","#F2F2D0","#FBFBEB","#74938F","#2F5A96","#335F98","#809B8B","#BDC995","#49759D","#719191","#9BAF88","#F7F7DE","#1B3E82","#A8B88B","#849E89","#557E9B","#E6E9BC","#45719D","#1E4386","#96AB87","#89A188"]},devon:{discrete:["#2C1A4C","#2B1E51","#2B2356","#2A295B","#2A2D60","#293265","#29376A","#283B6E","#274174","#27467A","#274C7F","#275186","#28568C","#2A5C95","#2D609C","#3064A3","#3468AA","#396BB1","#3F70B9","#4774C0","#4F79C6","#597DCC","#6382D1","#6F88D7","#798CDB","#8290DF","#8C95E2","#969AE6","#9E9EE9","#A6A3EB","#ACA7ED","#B1ACEF","#B7B1F0","#BBB5F1","#BFB9F2","#C3BEF3","#C7C2F4","#CCC7F4","#D0CCF5","#D4D0F6","#D8D4F7","#DCD9F8","#E1DEF9","#E5E3FA","#E9E7FB","#EDECFB","#F2F0FC","#F7F6FD","#FBFAFE","#FFFFFF"],categorical:["#2C1A4C","#F8F8FE","#758AD9","#C6C0F3","#28568C","#29376A","#AAA5ED","#DEDCF8","#3D6EB7","#EBE9FB","#9197E4","#3063A2","#274579","#577CCB","#D2CEF6","#2A285A","#BAB3F1","#B2ADEF","#F2F0FC","#274E82","#2A2F62","#CCC7F4","#9E9EE9","#4875C1","#C0BAF2","#2B5D98","#3669AD","#2B2154","#E4E2FA","#8290DF","#D8D4F7","#6784D3","#283E71","#C9C4F4","#BDB7F1","#DBD8F8","#283A6D","#4F79C6","#A4A2EB","#EEEDFC","#CFCBF5","#E8E5FA","#5F80CF","#4272BC","#B6B0F0","#2B1D50","#AEA9EE","#275287","#2A2B5E","#989BE7","#293366","#27497D","#8A94E1","#295A92","#3266A7","#F5F4FD","#7B8DDC","#274174","#2D609C","#2B2558","#6F88D7","#E1DEF9","#3A6CB2","#D5D1F6","#C3BEF3","#2E629F","#3165A4","#8D95E3","#3468AA","#DAD6F7","#D1CDF5","#9B9CE8","#275084","#B8B2F0","#27477B","#6382D1","#4573BF","#A2A0EA","#F7F6FD","#C7C2F4","#F3F2FD","#274376","#8692E0","#2B1F52","#CAC6F4","#ACA7ED","#E3E0F9","#F0EEFC","#E6E4FA","#386AB0","#2C1C4E","#6B86D5","#28396B","#283C6F","#2A5C95","#2A2D60","#BEB9F2","#C2BCF2","#7E8FDD","#3F70B9"]},fes:{discrete:["#0D0D0D","#181818","#212121","#2B2B2B","#343434","#3C3C3C","#454545","#4D4D4D","#565656","#5E5E5E","#656565","#6D6D6D","#747474","#7C7C7C","#848484","#8B8B8B","#939393","#9C9C9C","#A7A7A7","#B1B1B1","#BBBBBB","#C5C5C5","#D1D1D1","#DFDFDF","#ECECEC","#094225","#184822","#2B4F20","#3A5420","#485822","#555B24","#615E26","#6F6229","#7A652B","#86682E","#926B30","#9F7035","#AD7940","#B6834D","#BD8E5C","#C2996C","#C6A47C","#CCB18F","#D1BCA0","#D5C6B0","#DACFC1","#DFD7CF","#E4DFE0","#E8E6ED","#EDEDFC"],categorical:["#0D0D0D","#181818","#212121","#2B2B2B","#343434","#3C3C3C","#454545","#4D4D4D","#565656","#5E5E5E","#656565","#6D6D6D","#747474","#7C7C7C","#848484","#8B8B8B","#939393","#9C9C9C","#A7A7A7","#B1B1B1","#BBBBBB","#C5C5C5","#D1D1D1","#DFDFDF","#ECECEC","#094225","#184822","#2B4F20","#3A5420","#485822","#555B24","#615E26","#6F6229","#7A652B","#86682E","#926B30","#9F7035","#AD7940","#B6834D","#BD8E5C","#C2996C","#C6A47C","#CCB18F","#D1BCA0","#D5C6B0","#DACFC1","#DFD7CF","#E4DFE0","#E8E6ED","#EDEDFC"]},glasgow:{discrete:["#361338","#3B1434","#401530","#45172C","#491828","#4D1924","#511B21","#561C1D","#5B1E18","#602014","#662210","#6B260B","#6F2B07","#723203","#743802","#743E01","#754300","#744900","#744F01","#745402","#735905","#725F0B","#716413","#70691E","#6E6E27","#6C7231","#6B763A","#697B46","#677F4F","#658359","#648763","#628B6C","#618F78","#609381","#60978A","#619B94","#659F9D","#6CA5A8","#74A9B0","#7DADB8","#86B1BF","#8EB4C6","#99B9CE","#A1BCD5","#AABFDB","#B2C3E1","#BBC6E7","#C6CBF0","#D0CFF7","#DBD3FF"],categorical:["#361338","#DBD3FF","#6D702B","#69A3A5","#702D06","#A0BBD3","#638968","#521B20","#745101","#84B0BE","#754001","#5F9587","#BBC6E7","#612013","#45172C","#687D4A","#726210","#618F78","#4B1926","#3E1532","#629C96","#658359","#CACCF3","#76AAB2","#6B763A","#744900","#6A250C","#ADC1DD","#735905","#92B6C9","#591D1A","#743702","#70681C","#4F1A23","#754400","#6D2909","#60998E","#41162F","#744D00","#745503","#B4C3E2","#697A42","#7DADB8","#628C70","#8BB3C3","#561C1D","#D2D0F9","#99B9CE","#3A1435","#6F6C23","#743B01","#60927F","#662210","#648661","#659F9D","#678051","#725E0A","#481829","#6FA6AB","#6C7332","#5D1E17","#A6BED8","#C2C9ED","#723203","#716617","#68240E","#6F6A20","#C6CBF0","#79ABB5","#72600D","#754200","#43162D","#67A1A1","#6B7536","#5F1F15","#735B07","#571C1B","#72A8AF","#744F01","#BEC8EA","#381337","#8EB4C6","#628B6C","#677E4D","#60917B","#639E9A","#4A1827","#A3BDD6","#3C1433","#743901","#632112","#B7C5E5","#4D1924","#65845D","#618E74","#609483","#9CBAD1","#46172A","#87B1C1","#6D712F"]},grayc:{discrete:["#000000","#090909","#111111","#171717","#1C1C1C","#212121","#252525","#2A2A2A","#303030","#343434","#393939","#3D3D3D","#424242","#474747","#4B4B4B","#505050","#545454","#585858","#5D5D5D","#616161","#656565","#696969","#6D6D6D","#717171","#757575","#797979","#7D7D7D","#818181","#858585","#898989","#8E8E8E","#929292","#979797","#9C9C9C","#A1A1A1","#A6A6A6","#ABABAB","#B1B1B1","#B6B6B6","#BCBCBC","#C1C1C1","#C7C7C7","#CECECE","#D5D5D5","#DBDBDB","#E2E2E2","#E8E8E8","#F1F1F1","#F8F8F8","#FFFFFF"],categorical:["#070707","#F9F9F9","#777777","#454545","#AEAEAE","#909090","#292929","#5F5F5F","#D1D1D1","#9E9E9E","#525252","#E4E4E4","#6C6C6C","#BFBFBF","#1A1A1A","#373737","#848484","#595959","#222222","#B6B6B6","#A6A6A6","#3E3E3E","#7D7D7D","#666666","#969696","#8A8A8A","#4B4B4B","#DADADA","#C8C8C8","#313131","#717171","#131313","#EFEFEF","#C4C4C4","#A2A2A2","#424242","#878787","#252525","#2D2D2D","#4F4F4F","#3B3B3B","#808080","#1E1E1E","#BBBBBB","#AAAAAA","#EAEAEA","#696969","#7A7A7A","#DFDFDF","#636363","#565656","#B2B2B2","#0E0E0E","#9A9A9A","#5C5C5C","#747474","#F3F3F3","#333333","#6E6E6E","#D5D5D5","#8D8D8D","#939393","#494949","#CCCCCC","#171717","#BDBDBD","#575757","#C1C1C1","#404040","#828282","#E2E2E2","#151515","#1C1C1C","#0B0B0B","#9C9C9C","#858585","#2F2F2F","#B4B4B4","#888888","#242424","#272727","#3C3C3C","#B0B0B0","#353535","#545454","#5B5B5B","#393939","#D7D7D7","#A4A4A4","#A8A8A8","#959595","#767676","#646464","#989898","#444444","#474747","#111111","#F6F6F6","#ECECEC","#4D4D4D"]},hawaii:{discrete:["#8C0273","#8E0D6E","#8F1569","#901D63","#91235F","#91285A","#922D56","#933252","#94384D","#943D4A","#954246","#964742","#964C3F","#97523B","#985638","#985C34","#996131","#9A662E","#9B6C2A","#9B7226","#9C7823","#9C7E20","#9D841E","#9D8C1C","#9C921C","#9B991D","#9AA021","#97A828","#94AE30","#91B439","#8CB942","#88BE4C","#82C359","#7EC663","#79CA6E","#74CE79","#70D183","#6AD591","#66D89C","#62DCA7","#60DFB2","#5FE2BD","#61E6CA","#67E9D5","#6FEBDE","#7AEEE7","#87EFEE","#98F1F5","#A6F1F9","#B3F2FD"],categorical:["#8C0273","#B3F2FD","#9C951C","#6CD48C","#964D3E","#8ABC48","#9B6D29","#66E8D3","#922E55","#9C801F","#87EFEE","#995D34","#7BC969","#901D63","#60DEB0","#96AA2B","#943D4A","#975439","#82C359","#5FE4C2","#9AA021","#73CE7B","#65D99E","#954544","#9D8A1C","#8E126B","#91B439","#9DF1F7","#73ECE2","#91265C","#9C7724","#9A652E","#93364F","#922A59","#996131","#9D851D","#9D901C","#9A692C","#68D695","#902160","#9B9A1E","#985836","#9B7226","#933252","#77CC72","#9C7B21","#954147","#8D0A6F","#93AF32","#62DCA7","#92F0F3","#8F1867","#7DEEE8","#97513C","#6CEBDB","#61E6CA","#A8F2FA","#964941","#7FC661","#86BF50","#98A526","#70D183","#5FE1B9","#8DB840","#94394D","#9C7923","#8F1569","#985A35","#60E0B4","#9A6B2A","#91245E","#97A828","#9B7425","#6AD591","#95AD2E","#5FE2BD","#60E5C6","#953F48","#933054","#63E7CF","#84C154","#8D0671","#82EFEB","#9B9D1F","#99A323","#88BE4C","#6ED288","#6FEBDE","#9A672D","#91285A","#75CD76","#995F32","#68E9D7","#9B7028","#61DDAB","#943B4B","#933450","#8DF0F0","#8F1A65","#81C45D"]},imola:{discrete:["#1A33B3","#1C37B1","#1E3AAF","#203EAD","#2242AB","#2345AA","#2548A8","#274CA6","#2950A4","#2A53A3","#2C56A1","#2E599F","#2F5D9E","#32609B","#346499","#366797","#386A95","#3B6C92","#3E708F","#41738C","#44768A","#467987","#4A7C85","#4E8082","#518480","#56887E","#5A8C7D","#5F927B","#64967A","#689B79","#6DA078","#72A576","#78AB75","#7DB074","#82B572","#87BA71","#8CBF70","#93C66E","#98CB6D","#9ED06C","#A4D66A","#ACDB69","#B5E268","#BFE767","#C8EB67","#D3F066","#DDF466","#EAF866","#F5FB66","#FFFF66"],categorical:["#1A33B3","#FFFF66","#54867F","#305E9D","#91C36F","#3F718E","#2549A8","#BDE667","#70A377","#2B53A2","#376896","#80B373","#A3D56B","#DDF466","#203EAD","#487B86","#62947A","#2D59A0","#88BB71","#5B8D7D","#CDED66","#4E8082","#EEF966","#33639A","#284EA5","#44768A","#2344AA","#AFDE69","#3B6C92","#78AB75","#1D39B0","#99CC6D","#699C79","#3D6F90","#2C56A1","#2F5B9E","#5E917B","#4B7D84","#9ED06C","#1F3CAE","#C4EA67","#84B772","#274CA6","#D5F066","#2951A4","#74A776","#578A7E","#2446A9","#1C36B1","#A9D96A","#95C86E","#467888","#2141AC","#7CAF74","#356598","#B5E268","#66987A","#396A94","#F7FC66","#8CBF70","#E6F666","#32609B","#518380","#41738C","#6DA078","#6B9E78","#B9E468","#7AAD74","#528580","#32629B","#86B971","#3C6E91","#5C8F7C","#C8EB67","#ACDB69","#D1EF66","#E2F566","#97CA6D","#1B35B2","#1C37B0","#2345AA","#2F5D9E","#1F3DAE","#457789","#3A6B93","#598B7D","#D9F266","#346499","#386995","#A6D76A","#366797","#274DA6","#56887E","#A1D36B","#42748B","#7EB173","#72A576","#477987","#4C7F83","#F2FB66"]},lajolla:{discrete:["#191900","#1E1B02","#221C05","#271E08","#2C200B","#31220E","#362411","#3C2614","#442817","#4B2B1B","#532D1F","#5B3023","#633328","#6E362D","#783932","#813C37","#8B3F3B","#96423F","#A24543","#AD4746","#B74A48","#C04D49","#C9514B","#D1564C","#D75C4D","#DB634E","#DD694F","#E0714F","#E17750","#E37D50","#E48351","#E58951","#E79052","#E89652","#E99C52","#EAA253","#EBA853","#EDAF54","#EEB555","#F0BC57","#F1C25A","#F3CA5F","#F5D369","#F7DA74","#F9E282","#FBE890","#FCEF9F","#FDF5B0","#FEFABE","#FFFECB"],categorical:["#191900","#FFFECB","#D85F4D","#ECAC54","#653329","#F7D971","#A44544","#E58751","#362411","#E1744F","#C44E4A","#E99A52","#4B2B1B","#833D38","#F1C159","#FCEF9F","#271E08","#FEF7B6","#402716","#D0554C","#FAE587","#E79052","#EFB655","#B54947","#201C04","#E37D50","#743830","#DD694F","#EBA353","#94413E","#572F21","#F4CD61","#2E210C","#FDF3AB","#32220F","#241D06","#F5D369","#7B3B34","#1D1B02","#F0BC57","#5E3125","#F8DF7C","#512D1E","#CA514B","#E48251","#E68C51","#EA9E53","#E89552","#BC4C49","#6C362C","#EDB154","#9C4341","#E27950","#FBEA93","#3B2513","#FEFBC0","#452918","#EBA853","#F2C75C","#8B3F3B","#DB644E","#AD4746","#DF6E4F","#D55A4D","#2B200A","#783932","#E79352","#D75C4D","#FEF9BB","#EDAF54","#E0714F","#7F3C36","#613227","#F7DC77","#C7504B","#F1C45A","#30210D","#F4D065","#1E1B03","#FAE78D","#F9E282","#DA614E","#392412","#4E2C1D","#E99C52","#EFB956","#221C05","#EBA553","#FDF5B0","#984240","#E38050","#8F403D","#542E20","#ECAA54","#E68E51","#70372E","#DE6C4F","#B94A48","#291F09","#1B1A01"]},lapaz:{discrete:["#1A0C64","#1C1368","#1E196D","#202071","#212675","#222B79","#23317D","#253681","#263C85","#274189","#29478C","#2A4C8F","#2C5192","#2E5795","#305C98","#32609A","#35659C","#386A9E","#3C70A0","#3F74A1","#4379A2","#487DA3","#4D81A3","#5386A4","#588AA3","#5E8EA3","#6591A2","#6C95A1","#7398A0","#7A9A9E","#809D9D","#879F9B","#90A199","#97A397","#9EA596","#A5A795","#ADAA95","#B7AD96","#BFB199","#C8B69C","#D2BBA2","#DAC1A8","#E4C9B2","#EBCFBB","#F1D5C4","#F5DBCD","#F9E1D6","#FBE8E1","#FDEDEA","#FEF2F3"],categorical:["#1A0C64","#FEF2F3","#5B8BA3","#B3AC96","#2C5292","#3C70A0","#EACEB9","#859E9C","#24327E","#6F96A1","#33619A","#202071","#D0BAA0","#9BA496","#F9E1D6","#4A7FA3","#284289","#90A199","#FCEAE5","#1D176B","#37699D","#F3D8C8","#A7A895","#5285A4","#7A9A9E","#2F5A97","#4278A2","#263A84","#6591A2","#C1B299","#DEC3AB","#222978","#2A4B8E","#5688A4","#D7BEA6","#FDEEEC","#608EA3","#EFD3C0","#A1A696","#6A94A1","#FBE6DD","#ADAA95","#F6DDCF","#4E82A3","#2E5695","#3A6D9F","#C8B69C","#1C1268","#232D7B","#3F74A1","#467BA3","#1E1C6E","#7F9C9D","#BAAF97","#253681","#315E99","#29478C","#E4C9B2","#74989F","#273E87","#212575","#95A398","#8AA09A","#35659C","#2B4F91","#23307C","#E7CBB5","#F1D5C4","#2B4D90","#202373","#588AA3","#D3BCA3","#5487A4","#447AA2","#6792A2","#24347F","#253882","#ECD0BD","#879F9B","#305C98","#E1C6AF","#1E196D","#5D8DA3","#AAA995","#386B9E","#487DA3","#77999F","#F7DFD3","#BEB098","#1F1E70","#325F99","#4176A2","#F4DACB","#4C80A3","#2D5494","#8DA099","#6C95A1","#FAE3DA","#FDECE8","#B7AD96"]},lipari:{discrete:["#031326","#05192F","#062038","#092844","#0C2E4D","#103557","#163C5F","#1E4368","#294B70","#345075","#3E5578","#47587A","#4F5B7B","#575C7A","#5D5D79","#635E78","#695E76","#6E5F75","#765F73","#7C6071","#826070","#89606E","#90616C","#98616A","#A06268","#A86266","#B06364","#BA6462","#C36660","#CB685F","#D46B5E","#DB705F","#E27760","#E77E63","#E98567","#EA8D6B","#EA946F","#E89C75","#E7A279","#E6A87E","#E5AF84","#E5B58A","#E6BD92","#E7C49A","#EACCA3","#EDD3AD","#F0DBB7","#F5E5C4","#F9EDCF","#FDF5DA"],categorical:["#031326","#FDF5DA","#A56267","#525B7A","#E99B74","#785F72","#DA6F5E","#183E61","#E7C398","#8D616D","#365176","#092844","#655E77","#E98466","#BF6561","#F0DBB7","#E5AD82","#B26364","#EBCFA7","#5C5D79","#061D35","#25486D","#0E3353","#EA906D","#98616A","#E37861","#E5B88C","#826070","#CD685F","#6E5F75","#45587A","#F6E8C9","#E7A37A","#615E78","#E77E63","#D46B5E","#9F6268","#E99570","#93616B","#87606E","#7D6071","#F3E1C0","#575C7A","#0B2D4B","#2D4D72","#E6A87E","#E9C99F","#FAEED1","#1E4368","#EA8A69","#B86462","#6A5E76","#AB6365","#735F74","#DF735F","#E5B287","#13385A","#05182D","#E6BD92","#3E5578","#EDD5AF","#07223C","#C6665F","#4C5A7A","#E8A077","#B56363","#FBF1D6","#A26267","#E6C095","#0A2A48","#F8EBCD","#EACCA3","#AE6364","#7A5F72","#635E78","#E98768","#041629","#715F74","#ECD2AB","#A86266","#8A606E","#96616B","#545C7A","#EFD8B3","#F5E5C4","#9B6169","#F2DEBB","#765F73","#6C5F75","#294B70","#22466B","#E89D76","#E88165","#BC6461","#E6A67C","#85606F","#C36660","#1B4064","#D06A5E","#103557"]},lisbon:{discrete:["#E6E5FF","#D8DCF7","#CBD2EF","#BBC6E5","#ADBCDE","#A0B3D6","#93A9CE","#86A0C6","#7794BD","#6A8BB5","#5E81AC","#5177A4","#456E9B","#38628F","#2F5984","#274F78","#20476D","#1B3F61","#173653","#142E48","#12283E","#112233","#111D2A","#121921","#15181B","#181A18","#1E1D17","#252419","#2D2B1C","#353220","#3E3A25","#46422A","#514C31","#5A5536","#645E3C","#6D6741","#777047","#837B4F","#8D8556","#988F5E","#A29A67","#ADA470","#B9B17D","#C3BC89","#CDC795","#D7D2A2","#E0DCAF","#ECE9BE","#F5F4CB","#FFFFD9"],categorical:["#E6E5FF","#D8DCF7","#CBD2EF","#BBC6E5","#ADBCDE","#A0B3D6","#93A9CE","#86A0C6","#7794BD","#6A8BB5","#5E81AC","#5177A4","#456E9B","#38628F","#2F5984","#274F78","#20476D","#1B3F61","#173653","#142E48","#12283E","#112233","#111D2A","#121921","#15181B","#181A18","#1E1D17","#252419","#2D2B1C","#353220","#3E3A25","#46422A","#514C31","#5A5536","#645E3C","#6D6741","#777047","#837B4F","#8D8556","#988F5E","#A29A67","#ADA470","#B9B17D","#C3BC89","#CDC795","#D7D2A2","#E0DCAF","#ECE9BE","#F5F4CB","#FFFFD9"]},managua:{discrete:["#FFCF67","#F9C564","#F3BB60","#EBB05D","#E5A659","#DF9D56","#D99554","#D38C51","#CC824D","#C67B4B","#C07348","#B96C46","#B36444","#AB5C41","#A4553F","#9D4F3D","#95483C","#8E423A","#843B39","#7C3639","#743139","#6D2D3A","#662A3D","#5F2941","#5A2846","#552A4C","#522C53","#4F315D","#4D3566","#4C3B6F","#4C4179","#4C4883","#4D518E","#4F5897","#51609F","#5367A7","#556FAE","#5878B6","#5B80BC","#5E88C2","#6190C8","#6498CE","#68A3D5","#6BACDB","#6FB5E1","#72BEE6","#76C7EC","#7AD3F3","#7DDDF9","#81E7FF"],categorical:["#FFCF67","#F9C564","#F3BB60","#EBB05D","#E5A659","#DF9D56","#D99554","#D38C51","#CC824D","#C67B4B","#C07348","#B96C46","#B36444","#AB5C41","#A4553F","#9D4F3D","#95483C","#8E423A","#843B39","#7C3639","#743139","#6D2D3A","#662A3D","#5F2941","#5A2846","#552A4C","#522C53","#4F315D","#4D3566","#4C3B6F","#4C4179","#4C4883","#4D518E","#4F5897","#51609F","#5367A7","#556FAE","#5878B6","#5B80BC","#5E88C2","#6190C8","#6498CE","#68A3D5","#6BACDB","#6FB5E1","#72BEE6","#76C7EC","#7AD3F3","#7DDDF9","#81E7FF"]},navia:{discrete:["#031327","#041930","#051E3A","#052546","#062B50","#06315A","#073764","#083E6D","#0B4578","#0E4C80","#115286","#15588B","#195E8E","#1E6491","#216991","#246D91","#27718F","#2A748E","#2D788C","#307A8A","#337D89","#368087","#398385","#3C8683","#3F8981","#428C7F","#468F7D","#4A937A","#4E9678","#529A76","#579E73","#5BA271","#62A86E","#67AD6B","#6EB269","#76B768","#7FBD68","#8CC56A","#98CB6F","#A4D176","#B1D67F","#BCDB89","#C9E096","#D3E3A1","#DCE7AC","#E3EAB6","#EAEDBF","#F1F0CA","#F7F2D2","#FCF4D9"],categorical:["#031327","#FCF4D9","#408A80","#87C269","#1B608F","#59A072","#073966","#D1E39F","#2F798B","#EAEDBF","#052546","#266F90","#6BB06A","#0E4D81","#AED57D","#4C947A","#378186","#DFE8B0","#337D89","#2A748E","#14578A","#051C36","#9ACC70","#0A4374","#468F7D","#529A76","#F4F1CD","#062F56","#C1DC8D","#206891","#78B968","#62A86E","#3C8583","#569D74","#236C91","#F8F3D3","#D8E5A8","#0C487B","#04182E","#71B469","#B8D985","#07345E","#05213E","#4F9778","#5DA470","#3E8882","#062A4E","#7FBD68","#EFEFC6","#C9E096","#115286","#2C768D","#1E6491","#49917B","#66AC6C","#28718F","#A4D176","#90C76C","#438C7F","#175C8D","#083E6D","#E5EAB8","#317B8A","#357F87","#398385","#B3D781","#0D4A7E","#1C6290","#052342","#579F73","#9FCE73","#448D7E","#051A32","#FAF3D6","#428B7F","#29738F","#104F84","#5FA66F","#509877","#8CC56A","#094071","#2D788C","#083B6A","#D5E4A3","#2B758D","#226A91","#04162B","#BCDB89","#47907C","#4D9579","#E2E9B4","#7BBB68","#6EB269","#135488","#4A937A","#F1F0CA","#5BA271","#C5DE92","#F6F2D0","#CDE19B"]},naviaw:{discrete:["#041427","#051A31","#05203B","#062747","#072D52","#08345C","#0A3A66","#0C416F","#0F4979","#135080","#175686","#1B5D8A","#1F628D","#23698F","#276D8F","#2A728F","#2D758E","#30798D","#347D8B","#378089","#3A8388","#3D8686","#408984","#448C82","#489080","#4B937E","#50977C","#559C79","#5AA077","#5FA575","#65AA73","#6CAF71","#76B671","#7FBD71","#89C474","#95CB78","#A2D27F","#B1D98A","#BEDF95","#C9E5A1","#D3E9AD","#DBEDB9","#E4F1C6","#E9F4D0","#EEF6D9","#F2F8E1","#F6FAE9","#F9FCF1","#FCFDF7","#FEFEFD"],categorical:["#041427","#FBFDF6","#478F80","#9FD07D","#1F628D","#64A973","#E3F0C4","#0A3A66","#337C8B","#C7E49E","#7DBC71","#549B7A","#2A718F","#135080","#F2F8E1","#3C8586","#062747","#D7EBB2","#418A83","#B4DB8C","#2E778D","#6FB271","#EBF5D4","#0E4574","#051D37","#4D957D","#256B8F","#195A88","#388189","#F7FAEC","#5CA276","#8CC574","#073056","#31798C","#367E8A","#69AD72","#E7F3CC","#104A7A","#95CB78","#EFF6DB","#0B406D","#2C748E","#4A927F","#DDEEBB","#50987C","#165584","#589E78","#76B671","#3F8785","#05192F","#BEDF95","#448C82","#22678E","#06223F","#A9D684","#08355E","#CFE8A8","#F9FCF1","#286E8F","#85C172","#072C50","#F5F9E7","#1C5F8B","#3A8387","#60A675","#F3F9E4","#0C4271","#266D8F","#81BE72","#0A3D6A","#4B937E","#9ACD7B","#EDF5D7","#90C876","#A4D381","#378089","#1B5D8A","#489080","#145282","#DAECB6","#67AB73","#CBE6A3","#B9DD90","#3D8686","#23698F","#6CAF71","#FAFCF3","#79B971","#D3E9AD","#5AA077","#458E81","#72B471","#327B8C","#E5F1C8","#051B33","#F8FBEE","#062443","#398288","#2B728F","#06294C"]},nuuk:{discrete:["#05598C","#0E5B8B","#155C89","#1C5E87","#226085","#276184","#2C6383","#326682","#386982","#3E6C82","#446F82","#4A7283","#517584","#587A86","#5F7D88","#66818A","#6C858C","#73898E","#7B8E91","#819192","#879594","#8D9996","#939C97","#99A097","#9EA498","#A2A798","#A6AA97","#ABAD96","#AEAF95","#B1B194","#B3B492","#B6B690","#B8B88E","#BABA8C","#BDBC8A","#BFBE88","#C1C187","#C4C385","#C7C684","#CAC983","#CDCD83","#D2D184","#D7D787","#DDDD8B","#E3E290","#E8E895","#EEEE9C","#F4F4A4","#F9F9AB","#FEFEB2"],categorical:["#05598C","#FEFEB2","#A1A698","#537785","#C3C385","#B5B591","#7D8F91","#2D6483","#DDDD8B","#919B96","#BCBC8B","#3F6C82","#CDCD83","#1C5E87","#ADAE95","#68838B","#EEEE9C","#A7AA97","#879594","#C8C783","#F6F6A7","#135C89","#B9B98E","#497183","#73898E","#366882","#C0BF88","#D4D486","#99A097","#B1B293","#5E7D88","#256185","#E6E693","#829293","#788C90","#9DA398","#AAAC96","#E1E18F","#3B6A82","#638089","#B3B492","#A4A897","#446F82","#BABA8C","#D8D888","#185D88","#8C9895","#215F86","#BEBD89","#B7B78F","#CACA83","#4E7484","#C1C186","#959E97","#F2F2A1","#AFB094","#326682","#587A86","#296284","#FAFAAD","#6E868C","#C5C584","#D1D084","#0D5B8B","#E9E997","#DFDF8D","#66818A","#B0B194","#5B7B87","#2B6383","#859493","#CCCB83","#F8F8AA","#D2D285","#1F5F86","#70878D","#4B7383","#768B8F","#FCFCAF","#A9AB97","#BFBE88","#C9C983","#346782","#DBDA89","#236085","#BDBD8A","#BAB98D","#B8B88E","#2F6583","#939C97","#9FA498","#A2A798","#CFCF84","#B4B591","#C4C485","#979F97","#F0F09E","#155C89","#9BA298","#517584"]},oleron:{discrete:["#1A2659","#212E61","#293568","#323F72","#3A477A","#424F82","#4A578A","#535F92","#5D699C","#6572A5","#6E7BAE","#7784B7","#808DC0","#8B97CA","#94A1D3","#9DAADC","#A6B3E5","#AFBCEC","#B9C6F2","#C0CDF5","#C7D4F7","#CEDAF9","#D4E1FB","#DCE9FD","#E3F0FE","#1F4E00","#2C5100","#3A5600","#445900","#4F5C02","#5A6005","#65660C","#736D18","#7E7423","#8A7B2E","#94823A","#9F8945","#AC9253","#B79A5E","#C3A36A","#CEAC75","#D9B581","#E5C090","#EDC99D","#F2D2A9","#F6DAB5","#F8E2C0","#FAECCE","#FBF4DA","#FDFDE6"],categorical:["#1A2659","#212E61","#293568","#323F72","#3A477A","#424F82","#4A578A","#535F92","#5D699C","#6572A5","#6E7BAE","#7784B7","#808DC0","#8B97CA","#94A1D3","#9DAADC","#A6B3E5","#AFBCEC","#B9C6F2","#C0CDF5","#C7D4F7","#CEDAF9","#D4E1FB","#DCE9FD","#E3F0FE","#1F4E00","#2C5100","#3A5600","#445900","#4F5C02","#5A6005","#65660C","#736D18","#7E7423","#8A7B2E","#94823A","#9F8945","#AC9253","#B79A5E","#C3A36A","#CEAC75","#D9B581","#E5C090","#EDC99D","#F2D2A9","#F6DAB5","#F8E2C0","#FAECCE","#FBF4DA","#FDFDE6"]},oslo:{discrete:["#010101","#04070B","#060C13","#0A121B","#0C1620","#0D1927","#0E1D2D","#0F2133","#10263C","#112A43","#122E4A","#133251","#153758","#173C61","#194169","#1B4670","#1E4A78","#214F80","#255589","#295A91","#2E5F99","#3364A1","#3A6AA9","#4371B2","#4B77B9","#537DBE","#5B83C3","#6489C6","#6B8EC8","#7292C9","#7896C9","#7E9ACA","#859ECA","#8BA2C9","#91A6C9","#97A9C9","#9DADC9","#A4B2CA","#AAB6CA","#B1BBCB","#B8BFCD","#BFC5CF","#C7CCD3","#CFD2D8","#D7D9DD","#DEE0E2","#E6E7E9","#EFF0F1","#F7F7F8","#FFFFFF"],categorical:["#030609","#F9F9F9","#507BBC","#163B5E","#A0AFC9","#7B98CA","#27588E","#0E2032","#CACED5","#122D48","#3767A6","#1D4875","#8DA3C9","#E2E3E5","#678BC7","#B4BDCC","#0C151F","#BFC5CF","#97A9C9","#4371B2","#10263D","#080E16","#7292C9","#215081","#2E5F99","#AAB6CA","#ECEDEE","#0D1A28","#143454","#D5D8DC","#5B83C3","#19426A","#859ECA","#13314E","#0E1D2D","#3D6CAC","#6C8FC8","#7795C9","#F3F3F4","#4976B8","#245488","#DBDDE0","#112A43","#92A6C9","#C5C9D2","#809BCA","#0F2337","#3263A0","#050A10","#B9C1CD","#1F4C7B","#183E64","#A5B3CA","#0A121B","#9CACC9","#6187C5","#0D1824","#8AA1CA","#2A5B93","#547EBF","#D1D3D9","#E6E7E9","#1B456F","#B0BACB","#153758","#7494C9","#D8DADE","#6A8DC8","#90A5C9","#99ABC9","#235285","#133251","#060C13","#406EAF","#7E9ACA","#173C61","#4C78BA","#122F4B","#1C4772","#87A0CA","#CED1D7","#C2C7D1","#0F253A","#2C5D96","#C7CCD3","#112B45","#EFF0F1","#6F90C9","#0E1E2F","#ADB8CB","#7997CA","#4673B5","#15395B","#091018","#194067","#30619C","#94A8C9","#F6F6F6","#0F2135","#A3B1CA"]},roma:{discrete:["#7E1700","#832504","#883008","#8F3C0C","#934610","#984E14","#9C5717","#A05F1B","#A5681F","#A97023","#AD7826","#B0802B","#B58930","#BA9437","#BE9D3E","#C2A647","#C7B051","#CBBA5D","#CFC66D","#D1CF7B","#D2D78A","#D2DE98","#D0E4A6","#CBE8B4","#C4EABE","#BDEAC6","#B3E9CD","#A6E6D2","#9BE2D5","#8EDDD7","#81D7D7","#74CFD6","#64C6D5","#59BDD2","#4FB5D0","#46ACCC","#3EA4C9","#379AC5","#3292C2","#2E8ABF","#2B82BB","#287AB8","#2471B4","#2269B0","#1F60AD","#1C58A9","#194FA5","#1344A0","#0C3B9C","#033198"],categorical:["#7E1700","#832504","#883008","#8F3C0C","#934610","#984E14","#9C5717","#A05F1B","#A5681F","#A97023","#AD7826","#B0802B","#B58930","#BA9437","#BE9D3E","#C2A647","#C7B051","#CBBA5D","#CFC66D","#D1CF7B","#D2D78A","#D2DE98","#D0E4A6","#CBE8B4","#C4EABE","#BDEAC6","#B3E9CD","#A6E6D2","#9BE2D5","#8EDDD7","#81D7D7","#74CFD6","#64C6D5","#59BDD2","#4FB5D0","#46ACCC","#3EA4C9","#379AC5","#3292C2","#2E8ABF","#2B82BB","#287AB8","#2471B4","#2269B0","#1F60AD","#1C58A9","#194FA5","#1344A0","#0C3B9C","#033198"]},romao:{discrete:["#733957","#773850","#7A3849","#7E3942","#823C3D","#863F38","#8A4334","#8E4831","#94502E","#98572C","#9D5F2B","#A3672C","#A8712E","#AF7D32","#B58837","#BB933F","#C19F47","#C6AA52","#CDB761","#D1C26E","#D4CB7B","#D6D388","#D5D995","#D3DEA3","#CEE0AD","#C8E1B6","#C1E1BE","#B6DEC5","#ABDBC9","#A0D6CC","#94D0CE","#88C9CF","#7BC0CE","#70B8CD","#67AFCA","#5FA6C7","#589CC4","#5291BE","#4F88B9","#4E7EB3","#4F75AC","#516BA4","#55609A","#595891","#5D5087","#62497D","#664474","#6B3F69","#6F3B60","#723959"],categorical:["#733957","#773850","#7A3849","#7E3942","#823C3D","#863F38","#8A4334","#8E4831","#94502E","#98572C","#9D5F2B","#A3672C","#A8712E","#AF7D32","#B58837","#BB933F","#C19F47","#C6AA52","#CDB761","#D1C26E","#D4CB7B","#D6D388","#D5D995","#D3DEA3","#CEE0AD","#C8E1B6","#C1E1BE","#B6DEC5","#ABDBC9","#A0D6CC","#94D0CE","#88C9CF","#7BC0CE","#70B8CD","#67AFCA","#5FA6C7","#589CC4","#5291BE","#4F88B9","#4E7EB3","#4F75AC","#516BA4","#55609A","#595891","#5D5087","#62497D","#664474","#6B3F69","#6F3B60","#723959"]},tofino:{discrete:["#DED9FF","#D0CFF9","#C3C6F3","#B3BBEC","#A6B1E6","#98A8E1","#8B9FDB","#7E95D4","#6E89CB","#617FC3","#5575B8","#4A6BAC","#4262A0","#395790","#334F83","#2E4776","#293F6A","#24385D","#1F304F","#1B2943","#172338","#141D2E","#111824","#0F151B","#0D1516","#0D1712","#0F1B12","#112113","#142716","#162F19","#1A361C","#1D3E20","#224825","#26512A","#2A5A2E","#2E6233","#336C38","#39773E","#3F8144","#488B4A","#529551","#5FA059","#70AB63","#7FB46B","#8EBD73","#9DC57B","#ACCD83","#BDD68C","#CCDE94","#DBE69B"],categorical:["#DED9FF","#D0CFF9","#C3C6F3","#B3BBEC","#A6B1E6","#98A8E1","#8B9FDB","#7E95D4","#6E89CB","#617FC3","#5575B8","#4A6BAC","#4262A0","#395790","#334F83","#2E4776","#293F6A","#24385D","#1F304F","#1B2943","#172338","#141D2E","#111824","#0F151B","#0D1516","#0D1712","#0F1B12","#112113","#142716","#162F19","#1A361C","#1D3E20","#224825","#26512A","#2A5A2E","#2E6233","#336C38","#39773E","#3F8144","#488B4A","#529551","#5FA059","#70AB63","#7FB46B","#8EBD73","#9DC57B","#ACCD83","#BDD68C","#CCDE94","#DBE69B"]},tokyo:{discrete:["#1C0E34","#241036","#2D1339","#37163D","#3F1A40","#481E43","#4F2345","#562948","#5D304A","#62354C","#663B4D","#69404E","#6B454F","#6D4B50","#6E4F50","#6F5251","#6F5651","#705951","#715C52","#715F52","#716252","#726452","#726753","#736B53","#736E53","#747153","#757554","#757A54","#767E55","#778355","#788856","#798E57","#7B9558","#7C9B5A","#7EA25C","#81A95E","#84B062","#88B968","#8DC16E","#93CA76","#9BD27F","#A4DA8A","#AFE398","#BAEAA4","#C5EFB0","#CFF4BB","#D8F7C5","#E2F9CF","#E9FBD7","#EFFCDD"],categorical:["#1C0E34","#EFFCDD","#747053","#6C4750","#87B666","#B8E8A1","#512446","#715D52","#798B56","#7D9F5B","#37163D","#726653","#99D07D","#63374C","#6F5451","#D8F7C5","#767C54","#705951","#5B2D49","#7B9558","#441D41","#291238","#E5FAD2","#C9F1B4","#716252","#81AA5F","#683F4E","#736B53","#6E4E50","#757654","#8EC370","#A7DD8E","#778455","#747354","#84B062","#231036","#93CA76","#DFF9CC","#30143A","#A0D785","#7FA45D","#EAFBD8","#6A434F","#C1EDAB","#736D53","#562948","#6D4B50","#7A9057","#7C9A59","#4B2044","#715F52","#663B4D","#D1F4BD","#705651","#8ABD6A","#6E5151","#AFE398","#5F324B","#757954","#3E193F","#726853","#726452","#778055","#705B52","#788756","#61344C","#746E53","#ABE093","#532747","#85B364","#7EA25C","#261137","#736C53","#E8FBD5","#4E2245","#88B968","#798E57","#767E55","#726753","#757754","#715E52","#3A183E","#6E4F51","#778255","#7B9759","#DCF8C9","#EDFCDA","#411B40","#7D9C5A","#767B54","#726352","#6F5551","#726552","#82AD60","#D5F6C1","#34153C","#9CD481","#747454","#C5EFB0","#481E43"]},turku:{discrete:["#000000","#090908","#111110","#181816","#1D1D1A","#22221F","#272723","#2C2C27","#33322B","#38382F","#3D3D32","#424235","#474738","#4E4D3C","#53523E","#585841","#5D5D43","#626246","#686848","#6E6D4B","#73724D","#797750","#7F7D52","#878356","#8E8859","#968E5C","#9D9360","#A79864","#AF9C68","#B69F6C","#BEA270","#C4A474","#CCA579","#D1A67D","#D7A781","#DBA886","#E0A98B","#E6AB92","#EAAD98","#EFB09F","#F2B4A7","#F6B9AE","#F9BFB7","#FBC4BF","#FDC9C6","#FECFCC","#FED4D3","#FFDBDA","#FFE0E0","#FFE6E6"],categorical:["#070707","#FFE6E6","#948D5B","#E5AA90","#4D4C3B","#2C2C27","#C3A374","#6D6C4A","#FBC4BF","#D6A780","#F2B4A7","#1C1C19","#3D3D32","#AC9A67","#7E7C52","#FED6D4","#5D5D43","#35342D","#DDA888","#141312","#55543F","#242420","#FDCDCA","#F7BCB3","#898456","#B8A06D","#ECAE9B","#CDA57A","#FFDEDD","#646447","#454537","#9F9461","#76744E","#71704C","#30302A","#414135","#181816","#FCC8C4","#EFB1A1","#838054","#F5B8AD","#E1A98C","#C8A477","#686848","#595941","#20201D","#8E8859","#D1A67D","#B29D6A","#E9AC95","#BEA270","#FED1CF","#0E0E0D","#A59764","#DAA784","#282823","#F9C0B9","#51503D","#393930","#FFDAD9","#49493A","#606045","#FFE2E1","#9A915E","#797750","#F4B6AA","#F6BAB0","#CBA578","#FFD8D6","#FECFCC","#262622","#C0A272","#868255","#1A1A18","#FAC2BC","#8B8658","#E3AA8E","#161614","#4F4E3C","#C6A475","#2E2E28","#BBA16F","#6B6A49","#E7AB93","#CFA67C","#626246","#53523E","#5B5B42","#FED3D1","#7C7A51","#817E53","#73724D","#FFDCDB","#37372E","#F8BEB6","#0B0B0A","#575740","#DFA98A","#474738","#B59F6C"]},vanimo:{discrete:["#FFCDFD","#F7BEF2","#F0B0E8","#E6A0DC","#DE93D2","#D786C8","#CF7ABF","#C76FB5","#BD63AA","#B45AA1","#AB5198","#A1498E","#964184","#883977","#7C326B","#6E2C60","#612654","#542148","#451C3B","#391931","#2F1728","#281521","#22141C","#1D1417","#1A1414","#191612","#191811","#1B1D11","#1D2212","#212913","#253014","#2B3916","#324419","#384D1B","#3F561E","#456021","#4C6924","#547427","#5A7C2A","#60852E","#678E32","#6E9737","#77A33F","#7FAE47","#88BA51","#92C65D","#9CD26B","#A9E27F","#B3EF92","#BEFDA5"],categorical:["#FFCDFD","#F7BEF2","#F0B0E8","#E6A0DC","#DE93D2","#D786C8","#CF7ABF","#C76FB5","#BD63AA","#B45AA1","#AB5198","#A1498E","#964184","#883977","#7C326B","#6E2C60","#612654","#542148","#451C3B","#391931","#2F1728","#281521","#22141C","#1D1417","#1A1414","#191612","#191811","#1B1D11","#1D2212","#212913","#253014","#2B3916","#324419","#384D1B","#3F561E","#456021","#4C6924","#547427","#5A7C2A","#60852E","#678E32","#6E9737","#77A33F","#7FAE47","#88BA51","#92C65D","#9CD26B","#A9E27F","#B3EF92","#BEFDA5"]},vik:{discrete:["#001261","#011A66","#02226B","#022B71","#023376","#023A7B","#034280","#034A85","#06548B","#0B5D91","#136697","#1E6F9D","#2B79A4","#3C85AC","#4B90B3","#5A9ABA","#6AA4C1","#7AAEC8","#8DBAD0","#9DC4D6","#ADCDDD","#BDD6E3","#CCDFE8","#DEE6E9","#E8E7E5","#EEE3DC","#EEDBD0","#EBD0C0","#E7C6B2","#E3BCA5","#DFB298","#DBA88B","#D69D7C","#D29470","#CE8B64","#CA8258","#C6794C","#C26E3F","#BE6533","#B85C28","#B2511D","#A94512","#9C3709","#912D06","#872406","#7E1D06","#741506","#6A0D07","#620607","#590008"],categorical:["#001261","#011A66","#02226B","#022B71","#023376","#023A7B","#034280","#034A85","#06548B","#0B5D91","#136697","#1E6F9D","#2B79A4","#3C85AC","#4B90B3","#5A9ABA","#6AA4C1","#7AAEC8","#8DBAD0","#9DC4D6","#ADCDDD","#BDD6E3","#CCDFE8","#DEE6E9","#E8E7E5","#EEE3DC","#EEDBD0","#EBD0C0","#E7C6B2","#E3BCA5","#DFB298","#DBA88B","#D69D7C","#D29470","#CE8B64","#CA8258","#C6794C","#C26E3F","#BE6533","#B85C28","#B2511D","#A94512","#9C3709","#912D06","#872406","#7E1D06","#741506","#6A0D07","#620607","#590008"]},viko:{discrete:["#4F1A3D","#4B1D43","#48214A","#432653","#3F2C5B","#3C3263","#38396C","#354174","#334B7F","#345487","#365E8F","#3B6797","#42719E","#4D7DA6","#5787AD","#6391B4","#709ABA","#7DA4BF","#8EAEC4","#9BB5C7","#A9BBC8","#B5C0C8","#C0C2C5","#CBC2BF","#D2C0B8","#D6BDAF","#D9B7A6","#D9AF99","#D8A88D","#D6A082","#D39776","#CF8D6B","#C8825D","#C27752","#BB6D47","#B3623D","#AA5633","#9F492A","#953E25","#8C3521","#822C1F","#7A251E","#721F1F","#6B1A21","#661824","#611627","#5C152B","#571631","#531736","#50193C"],categorical:["#4F1A3D","#4B1D43","#48214A","#432653","#3F2C5B","#3C3263","#38396C","#354174","#334B7F","#345487","#365E8F","#3B6797","#42719E","#4D7DA6","#5787AD","#6391B4","#709ABA","#7DA4BF","#8EAEC4","#9BB5C7","#A9BBC8","#B5C0C8","#C0C2C5","#CBC2BF","#D2C0B8","#D6BDAF","#D9B7A6","#D9AF99","#D8A88D","#D6A082","#D39776","#CF8D6B","#C8825D","#C27752","#BB6D47","#B3623D","#AA5633","#9F492A","#953E25","#8C3521","#822C1F","#7A251E","#721F1F","#6B1A21","#661824","#611627","#5C152B","#571631","#531736","#50193C"]}};function Fs(e){const t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}const Ss={waves:"batlow",blksand:"tokyo",breeze:"imola",magma:"batlow",ribbon:"hawaii",stars:"batlow",folds:"imola"},Ms={[As.ADVERT]:1,[As.TXT_MSG]:4,[As.GRP_TXT]:2,[As.RESPONSE]:8,[As.REQ]:13,[As.ANON_REQ]:7,[As.ACK]:11,[As.PATH]:24,[As.TRACE]:16,[As.GRP_DATA]:34,[As.MULTIPART]:52,[As.RAW_CUSTOM]:14};function js(){let e="breeze dark",t=!0;if("undefined"!=typeof window){e=localStorage.getItem("pymc-theme-id")||"breeze dark";const n=W(e);t=(null==n?void 0:n.meta.isDark)??!0}const n=Ss[e]??"batlow",a=Bs[n],s=a.discrete.length,r=Math.floor(s/2);return{colormap:a,colormapName:n,isDark:t,baseIndex:t?r:0,halfSize:r}}let Ts=null;function Ps(e){const{colormap:t,isDark:n}=js();if("number"!=typeof e)return n?"#A5A5A5":"#666666";const a=Ms[e];if(void 0===a)return n?"#A5A5A5":"#666666";const s=t.categorical;return s[Math.min(a,s.length-1)]}function Ls(e){const t=Ps(e);return null===Ts&&(Ts=z()),Ts?function(e){return z()?N(e):e}(t):t}function Rs(e){return Fs(Ps(e))}function Ns(e){return null==e?"UNKNOWN":xs[e]||`TYPE_${e}`}function zs(e){return null==e?"UNKNOWN":Ds[e]||`ROUTE_${e}`}function _s(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function Is(e){const t=function(e){const t=e.replace("#",""),n=parseInt(t.slice(0,2),16)/255,a=parseInt(t.slice(2,4),16)/255,s=parseInt(t.slice(4,6),16)/255,r=e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4);return.2126*r(n)+.7152*r(a)+.0722*r(s)}(e);return _s(t,1)>_s(t,0)?"light":"dark"}function Vs(e){return 1===e||!0===e}const Os=i("inline-flex items-center gap-1","radius-badge px-1.5 py-0.5","text-xs"),$s={fontFamily:"var(--font-badge)",fontWeight:"var(--font-badge-weight)",textTransform:"var(--badge-text-transform, none)"},qs={red:"var(--sys-red)",orange:"var(--sys-orange)",amber:"var(--sys-amber)",yellow:"var(--sys-yellow)",lime:"var(--sys-green)",green:"var(--sys-green)",emerald:"var(--sys-green)",teal:"var(--sys-teal)",cyan:"var(--sys-cyan)",sky:"var(--sys-cyan)",blue:"var(--sys-blue)",indigo:"var(--sys-indigo)",violet:"var(--sys-indigo)",purple:"var(--sys-purple)",fuchsia:"var(--sys-pink)",pink:"var(--sys-pink)",rose:"var(--sys-red)",brown:"var(--sys-brown)",zinc:"var(--fg-muted)"};function Us(e){if(!e.startsWith("var("))return e;if("undefined"!=typeof window){const t=e.match(/var\((--[^,)]+)/);if(t){const e=getComputedStyle(document.documentElement).getPropertyValue(t[1]).trim();if(e&&e.startsWith("#"))return e}}return"#666666"}function Ws({color:e="zinc",customColor:t,filled:n=!1,compact:a=!1,className:o,title:l,children:c}){const u=s.useMemo(()=>{const a=t??qs[e];if(n){if(t){const e=Is(Us(t));return{backgroundColor:t,color:"light"===e?"rgba(255,255,255,0.95)":"rgba(0,0,0,0.85)"}}return{backgroundColor:a,color:["amber","yellow","lime"].includes(e)?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.95)"}}return{backgroundColor:`color-mix(in srgb, ${a} 15%, transparent)`,color:a}},[e,t,n]);return r.jsx("span",{className:i(Os,a&&"!px-1 !py-0 !text-[10px]",o),style:{...$s,...u},"data-color":e,title:l,children:c})}const Hs=s.forwardRef(function({color:e="zinc",customColor:t,filled:n=!1,compact:a=!1,className:o,children:c,...u},d){const h=s.useMemo(()=>{const a=t??qs[e];if(n){if(t){const e=Is(Us(t));return{backgroundColor:t,color:"light"===e?"rgba(255,255,255,0.95)":"rgba(0,0,0,0.85)"}}return{backgroundColor:a,color:["amber","yellow","lime"].includes(e)?"rgba(0,0,0,0.85)":"rgba(255,255,255,0.95)"}}return{backgroundColor:`color-mix(in srgb, ${a} 15%, transparent)`,color:a}},[e,t,n]),m=i(Os,a&&"!px-1 !py-0 !text-[10px]","interactive hover-opacity",o);return"href"in u&&void 0!==u.href?r.jsx(ks,{...u,ref:d,className:m,style:{...$s,...h},children:c}):r.jsx(l,{...u,ref:d,className:m,style:{...$s,...h},children:c})}),Ys=i("relative inline-flex items-center justify-center gap-2","text-sm font-medium whitespace-nowrap","radius-inner px-3 py-1.5","ring-focus","disabled:opacity-40 disabled:pointer-events-none disabled:cursor-not-allowed","transition-base","[&>[data-slot=icon]]:w-4 [&>[data-slot=icon]]:h-4 [&>[data-slot=icon]]:shrink-0"),Gs={primary:i("bg-sys-blue text-white","hover:bg-sys-blue","active:bg-sys-blue/80","border-[1.5px] border-sys-blue"),success:i("bg-sys-green text-white","hover:bg-sys-green","active:bg-sys-green/80","border-[1.5px] border-sys-green"),danger:i("bg-sys-red text-white","hover:bg-sys-red","active:bg-sys-red/80","border-[1.5px] border-sys-red"),warning:i("bg-sys-indigo text-bg-body","hover:bg-sys-indigo","active:bg-sys-indigo/80","border-[1.5px] border-sys-indigo"),muted:i("bg-elevated text-fg-primary","hover:bg-subtle","active:bg-elevated","border-[1.5px] border-edge-subtle")},Ks={primary:i("bg-transparent text-sys-blue","border-[1.5px] border-sys-blue","hover:bg-sys-blue hover:text-white hover:border-sys-blue","active:bg-sys-blue/90 active:text-white"),success:i("bg-transparent text-sys-green","border-[1.5px] border-sys-green","hover:bg-sys-green hover:text-white hover:border-sys-green","active:bg-sys-green/90 active:text-white"),danger:i("bg-transparent text-sys-red","border-[1.5px] border-sys-red","hover:bg-sys-red hover:text-white hover:border-sys-red","active:bg-sys-red/90 active:text-white"),warning:i("bg-transparent text-sys-indigo","border-[1.5px] border-sys-indigo","hover:bg-sys-indigo hover:text-bg-body hover:border-sys-indigo","active:bg-sys-indigo/90 active:text-bg-body"),muted:i("bg-transparent text-fg-muted","border-[1.5px] border-edge-subtle","hover:bg-subtle hover:text-fg-primary hover:border-edge-strong","active:bg-elevated")},Xs={primary:i("bg-transparent text-sys-blue border-transparent","hover:bg-sys-blue hover:text-white","active:bg-sys-blue/90 active:text-white"),success:i("bg-transparent text-sys-green border-transparent","hover:bg-sys-green hover:text-white","active:bg-sys-green/90 active:text-white"),danger:i("bg-transparent text-sys-red border-transparent","hover:bg-sys-red hover:text-white","active:bg-sys-red/90 active:text-white"),warning:i("bg-transparent text-sys-indigo border-transparent","hover:bg-sys-indigo hover:text-bg-body","active:bg-sys-indigo/90 active:text-bg-body"),muted:i("bg-transparent text-fg-muted border-transparent","hover:bg-subtle hover:text-fg-primary","active:bg-elevated")},Js=s.forwardRef(function({color:e="muted",outline:t=!1,plain:n=!1,className:a,children:s,...o},c){const u=i(Ys,n?Xs[e]:t?Ks[e]:Gs[e],a);return"href"in o&&void 0!==o.href?r.jsx(ks,{...o,ref:c,className:u,children:s}):r.jsx(l,{...o,ref:c,className:u,children:s})}),Zs=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},Qs=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),er=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var tr={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const nr=s.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:r="",children:o,iconNode:i,...l},c)=>s.createElement("svg",{ref:c,...tr,width:t,height:t,stroke:e,strokeWidth:a?24*Number(n)/Number(t):n,className:Qs("lucide",r),...!o&&!er(l)&&{"aria-hidden":"true"},...l},[...i.map(([e,t])=>s.createElement(e,t)),...Array.isArray(o)?o:[o]])),ar=(e,t)=>{const n=s.forwardRef(({className:n,...a},r)=>{return s.createElement(nr,{ref:r,iconNode:t,className:Qs(`lucide-${o=Zs(e),o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,n),...a});var o});return n.displayName=Zs(e),n},sr=ar("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]),rr=ar("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),or=ar("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),ir=ar("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),lr=ar("expand",[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}],["path",{d:"M3 16v5h5",key:"1t08am"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 8V3h5",key:"1ln10m"}],["path",{d:"M9 9 3 3",key:"v551iv"}]]),cr=ar("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),ur=ar("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]),dr=ar("ghost",[["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}],["path",{d:"M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z",key:"uwwb07"}]]),hr=ar("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),mr=ar("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]),pr=ar("layout-list",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]]),gr=ar("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),fr=ar("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]),yr=ar("map-pin-plus",[["path",{d:"M19.914 11.105A7.298 7.298 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"fcdtly"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}],["path",{d:"M19 15v6",key:"10aioa"}]]),br=ar("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]),vr=ar("messages-square",[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]]),wr=ar("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),Cr=ar("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]),kr=ar("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),xr=ar("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),Dr=ar("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]),Ar=ar("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),Er=ar("shrink",[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]]),Br=ar("sliders-vertical",[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]]),Fr=ar("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),Sr=ar("waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]),Mr=ar("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),jr=s.createContext({});function Tr(e){const t=s.useRef(null);return null===t.current&&(t.current=e()),t.current}const Pr="undefined"!=typeof window,Lr=Pr?s.useLayoutEffect:s.useEffect,Rr=s.createContext(null);function Nr(e,t){-1===e.indexOf(t)&&e.push(t)}function zr(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const _r=(e,t,n)=>n>t?t:n/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Or(e){return"object"==typeof e&&null!==e}const $r=e=>/^0[^.\s]+$/u.test(e);function qr(e){let t;return()=>(void 0===t&&(t=e()),t)}const Ur=e=>e,Wr=(e,t)=>n=>t(e(n)),Hr=(...e)=>e.reduce(Wr),Yr=(e,t,n)=>{const a=t-e;return 0===a?1:(n-e)/a};class Gr{constructor(){this.subscriptions=[]}add(e){return Nr(this.subscriptions,e),()=>zr(this.subscriptions,e)}notify(e,t,n){const a=this.subscriptions.length;if(a)if(1===a)this.subscriptions[0](e,t,n);else for(let s=0;s1e3*e,Xr=e=>e/1e3;function Jr(e,t){return t?e*(1e3/t):0}const Zr=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function Qr(e,t,n,a){if(e===t&&n===a)return Ur;return s=>0===s||1===s?s:Zr(function(e,t,n,a,s){let r,o,i=0;do{o=t+(n-t)/2,r=Zr(o,a,s)-e,r>0?n=o:t=o}while(Math.abs(r)>1e-7&&++i<12);return o}(s,0,1,e,n),t,a)}const eo=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,to=e=>t=>1-e(1-t),no=Qr(.33,1.53,.69,.99),ao=to(no),so=eo(ao),ro=e=>(e*=2)<1?.5*ao(e):.5*(2-Math.pow(2,-10*(e-1))),oo=e=>1-Math.sin(Math.acos(e)),io=to(oo),lo=eo(oo),co=Qr(.42,0,1,1),uo=Qr(0,0,.58,1),ho=Qr(.42,0,.58,1),mo=e=>Array.isArray(e)&&"number"!=typeof e[0],po=e=>Array.isArray(e)&&"number"==typeof e[0],go={linear:Ur,easeIn:co,easeInOut:ho,easeOut:uo,circIn:oo,circInOut:lo,circOut:io,backIn:ao,backInOut:so,backOut:no,anticipate:ro},fo=e=>{if(po(e)){e.length;const[t,n,a,s]=e;return Qr(t,n,a,s)}return"string"==typeof e?go[e]:e},yo=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function bo(e,t){let n=!1,a=!0;const s={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,o=yo.reduce((e,t)=>(e[t]=function(e){let t=new Set,n=new Set,a=!1,s=!1;const r=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function i(t){r.has(t)&&(l.schedule(t),e()),t(o)}const l={schedule:(e,s=!1,o=!1)=>{const i=o&&a?t:n;return s&&r.add(e),i.has(e)||i.add(e),e},cancel:e=>{n.delete(e),r.delete(e)},process:e=>{o=e,a?s=!0:(a=!0,[t,n]=[n,t],t.forEach(i),t.clear(),a=!1,s&&(s=!1,l.process(e)))}};return l}(r),e),{}),{setup:i,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:h,render:m,postRender:p}=o,g=()=>{const r=Ir.useManualTiming?s.timestamp:performance.now();n=!1,Ir.useManualTiming||(s.delta=a?1e3/60:Math.max(Math.min(r-s.timestamp,40),1)),s.timestamp=r,s.isProcessing=!0,i.process(s),l.process(s),c.process(s),u.process(s),d.process(s),h.process(s),m.process(s),p.process(s),s.isProcessing=!1,n&&t&&(a=!1,e(g))};return{schedule:yo.reduce((t,r)=>{const i=o[r];return t[r]=(t,r=!1,o=!1)=>(n||(n=!0,a=!0,s.isProcessing||e(g)),i.schedule(t,r,o)),t},{}),cancel:e=>{for(let t=0;t(void 0===xo&&Ao.set(Co.isProcessing||Ir.useManualTiming?Co.timestamp:performance.now()),xo),set:e=>{xo=e,queueMicrotask(Do)}},Eo=e=>t=>"string"==typeof t&&t.startsWith(e),Bo=Eo("--"),Fo=Eo("var(--"),So=e=>!!Fo(e)&&Mo.test(e.split("/*")[0].trim()),Mo=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function jo(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}const To={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},Po={...To,transform:e=>_r(0,1,e)},Lo={...To,default:1},Ro=e=>Math.round(1e5*e)/1e5,No=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,zo=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,_o=(e,t)=>n=>Boolean("string"==typeof n&&zo.test(n)&&n.startsWith(e)||t&&!function(e){return null==e}(n)&&Object.prototype.hasOwnProperty.call(n,t)),Io=(e,t,n)=>a=>{if("string"!=typeof a)return a;const[s,r,o,i]=a.match(No);return{[e]:parseFloat(s),[t]:parseFloat(r),[n]:parseFloat(o),alpha:void 0!==i?parseFloat(i):1}},Vo={...To,transform:e=>Math.round((e=>_r(0,255,e))(e))},Oo={test:_o("rgb","red"),parse:Io("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:a=1})=>"rgba("+Vo.transform(e)+", "+Vo.transform(t)+", "+Vo.transform(n)+", "+Ro(Po.transform(a))+")"},$o={test:_o("#"),parse:function(e){let t="",n="",a="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),a=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),a=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,a+=a,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(a,16),alpha:s?parseInt(s,16)/255:1}},transform:Oo.transform},qo=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),Uo=qo("deg"),Wo=qo("%"),Ho=qo("px"),Yo=qo("vh"),Go=qo("vw"),Ko=(()=>({...Wo,parse:e=>Wo.parse(e)/100,transform:e=>Wo.transform(100*e)}))(),Xo={test:_o("hsl","hue"),parse:Io("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:a=1})=>"hsla("+Math.round(e)+", "+Wo.transform(Ro(t))+", "+Wo.transform(Ro(n))+", "+Ro(Po.transform(a))+")"},Jo={test:e=>Oo.test(e)||$o.test(e)||Xo.test(e),parse:e=>Oo.test(e)?Oo.parse(e):Xo.test(e)?Xo.parse(e):$o.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?Oo.transform(e):Xo.transform(e),getAnimatableNone:e=>{const t=Jo.parse(e);return t.alpha=0,Jo.transform(t)}},Zo=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Qo="number",ei="color",ti=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ni(e){const t=e.toString(),n=[],a={color:[],number:[],var:[]},s=[];let r=0;const o=t.replace(ti,e=>(Jo.test(e)?(a.color.push(r),s.push(ei),n.push(Jo.parse(e))):e.startsWith("var(")?(a.var.push(r),s.push("var"),n.push(e)):(a.number.push(r),s.push(Qo),n.push(parseFloat(e))),++r,"${}")).split("${}");return{values:n,split:o,indexes:a,types:s}}function ai(e){return ni(e).values}function si(e){const{split:t,types:n}=ni(e),a=t.length;return e=>{let s="";for(let r=0;r"number"==typeof e?0:Jo.test(e)?Jo.getAnimatableNone(e):e,oi={test:function(e){var t,n;return isNaN(e)&&"string"==typeof e&&((null==(t=e.match(No))?void 0:t.length)||0)+((null==(n=e.match(Zo))?void 0:n.length)||0)>0},parse:ai,createTransformer:si,getAnimatableNone:function(e){const t=ai(e);return si(e)(t.map(ri))}};function ii(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function li(e,t){return n=>n>0?t:e}const ci=(e,t,n)=>e+(t-e)*n,ui=(e,t,n)=>{const a=e*e,s=n*(t*t-a)+a;return s<0?0:Math.sqrt(s)},di=[$o,Oo,Xo];function hi(e){const t=(n=e,di.find(e=>e.test(n)));var n;if(!Boolean(t))return!1;let a=t.parse(e);return t===Xo&&(a=function({hue:e,saturation:t,lightness:n,alpha:a}){e/=360,n/=100;let s=0,r=0,o=0;if(t/=100){const a=n<.5?n*(1+t):n+t-n*t,i=2*n-a;s=ii(i,a,e+1/3),r=ii(i,a,e),o=ii(i,a,e-1/3)}else s=r=o=n;return{red:Math.round(255*s),green:Math.round(255*r),blue:Math.round(255*o),alpha:a}}(a)),a}const mi=(e,t)=>{const n=hi(e),a=hi(t);if(!n||!a)return li(e,t);const s={...n};return e=>(s.red=ui(n.red,a.red,e),s.green=ui(n.green,a.green,e),s.blue=ui(n.blue,a.blue,e),s.alpha=ci(n.alpha,a.alpha,e),Oo.transform(s))},pi=new Set(["none","hidden"]);function gi(e,t){return n=>ci(e,t,n)}function fi(e){return"number"==typeof e?gi:"string"==typeof e?So(e)?li:Jo.test(e)?mi:vi:Array.isArray(e)?yi:"object"==typeof e?Jo.test(e)?mi:bi:li}function yi(e,t){const n=[...e],a=n.length,s=e.map((e,n)=>fi(e)(e,t[n]));return e=>{for(let t=0;t{for(const t in a)n[t]=a[t](e);return n}}const vi=(e,t)=>{const n=oi.createTransformer(t),a=ni(e),s=ni(t);return a.indexes.var.length===s.indexes.var.length&&a.indexes.color.length===s.indexes.color.length&&a.indexes.number.length>=s.indexes.number.length?pi.has(e)&&!s.values.length||pi.has(t)&&!a.values.length?function(e,t){return pi.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}(e,t):Hr(yi(function(e,t){const n=[],a={color:0,var:0,number:0};for(let s=0;s{const t=({timestamp:t})=>e(t);return{start:(e=!0)=>vo.update(t,e),stop:()=>wo(t),now:()=>Co.isProcessing?Co.timestamp:Ao.now()}},ki=(e,t,n=10)=>{let a="";const s=Math.max(Math.round(t/n),2);for(let r=0;r=xi?1/0:t}function Ai(e,t=100,n){const a=n({...e,keyframes:[0,t]}),s=Math.min(Di(a),xi);return{type:"keyframes",ease:e=>a.next(s*e).value/t,duration:Xr(s)}}function Ei(e,t,n){const a=Math.max(t-5,0);return Jr(n-e(a),t-a)}const Bi=.01,Fi=2,Si=.005,Mi=.5;const ji=12;function Ti(e,t){return e*Math.sqrt(1-t*t)}const Pi=["duration","bounce"],Li=["stiffness","damping","mass"];function Ri(e,t){return t.some(t=>void 0!==e[t])}function Ni(e=.3,t=.3){const n="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:a,restDelta:s}=n;const r=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],i={done:!1,value:r},{stiffness:l,damping:c,mass:u,duration:d,velocity:h,isResolvedFromDuration:m}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!Ri(e,Li)&&Ri(e,Pi))if(e.visualDuration){const n=e.visualDuration,a=2*Math.PI/(1.2*n),s=a*a,r=2*_r(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:1,stiffness:s,damping:r}}else{const n=function({duration:e=800,bounce:t=.3,velocity:n=0,mass:a=1}){let s,r,o=1-t;o=_r(.05,1,o),e=_r(.01,10,Xr(e)),o<1?(s=t=>{const a=t*o,s=a*e;return.001-(a-n)/Ti(t,o)*Math.exp(-s)},r=t=>{const a=t*o*e,r=a*n+n,i=Math.pow(o,2)*Math.pow(t,2)*e,l=Math.exp(-a),c=Ti(Math.pow(t,2),o);return(.001-s(t)>0?-1:1)*((r-i)*l)/c}):(s=t=>Math.exp(-t*e)*((t-n)*e+1)-.001,r=t=>Math.exp(-t*e)*(e*e*(n-t)));const i=function(e,t,n){let a=n;for(let s=1;s{const n=Math.exp(-g*y*t);return o-n*((p+g*y*f)/e*Math.sin(e*t)+f*Math.cos(e*t))}}else if(1===g)v=e=>o-Math.exp(-y*e)*(f+(p+y*f)*e);else{const e=y*Math.sqrt(g*g-1);v=t=>{const n=Math.exp(-g*y*t),a=Math.min(e*t,300);return o-n*((p+g*y*f)*Math.sinh(a)+e*f*Math.cosh(a))/e}}const w={calculatedDuration:m&&d||null,next:e=>{const t=v(e);if(m)i.done=e>=d;else{let n=0===e?p:0;g<1&&(n=0===e?Kr(p):Ei(v,e,t));const r=Math.abs(n)<=a,l=Math.abs(o-t)<=s;i.done=r&&l}return i.value=i.done?o:t,i},toString:()=>{const e=Math.min(Di(w),xi),t=ki(t=>w.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return w}function zi({keyframes:e,velocity:t=0,power:n=.8,timeConstant:a=325,bounceDamping:s=10,bounceStiffness:r=500,modifyTarget:o,min:i,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],h={done:!1,value:d},m=e=>void 0===i?l:void 0===l||Math.abs(i-e)-p*Math.exp(-e/a),b=e=>f+y(e),v=e=>{const t=y(e),n=b(e);h.done=Math.abs(t)<=c,h.value=h.done?f:n};let w,C;const k=e=>{var t;t=h.value,(void 0!==i&&tl)&&(w=e,C=Ni({keyframes:[h.value,m(h.value)],velocity:Ei(b,e,h.value),damping:s,stiffness:r,restDelta:c,restSpeed:u}))};return k(0),{calculatedDuration:null,next:e=>{let t=!1;return C||void 0!==w||(t=!0,v(e),k(e)),void 0!==w&&e>=w?C.next(e-w):(!t&&v(e),h)}}}function _i(e,t){const n=e[e.length-1];for(let a=1;a<=t;a++){const s=Yr(0,t,a);e.push(ci(n,1,s))}}function Ii(e){const t=[0];return _i(t,e.length-1),t}function Vi({duration:e=300,keyframes:t,times:n,ease:a="easeInOut"}){const s=mo(a)?a.map(fo):fo(a),r={done:!1,value:t[0]},o=function(e,t){return e.map(e=>e*t)}(n&&n.length===t.length?n:Ii(t),e),i=function(e,t,{clamp:n=!0,ease:a,mixer:s}={}){const r=e.length;if(t.length,1===r)return()=>t[0];if(2===r&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[r-1]&&(e=[...e].reverse(),t=[...t].reverse());const i=function(e,t,n){const a=[],s=n||Ir.mix||wi,r=e.length-1;for(let o=0;o{if(o&&n1)for(;ac(_r(e[0],e[r-1],t)):c}(o,t,{ease:Array.isArray(s)?s:(l=t,c=s,l.map(()=>c||ho).splice(0,l.length-1))});var l,c;return{calculatedDuration:e,next:t=>(r.value=i(t),r.done=t>=e,r)}}Ni.applyToOptions=e=>{const t=Ai(e,100,Ni);return e.ease=t.ease,e.duration=Kr(t.duration),e.type="keyframes",e};const Oi=e=>null!==e;function $i(e,{repeat:t,repeatType:n="loop"},a,s=1){const r=e.filter(Oi),o=s<0||t&&"loop"!==n&&t%2==1?0:r.length-1;return o&&void 0!==a?a:r[o]}const qi={decay:zi,inertia:zi,tween:Vi,keyframes:Vi,spring:Ni};function Ui(e){"string"==typeof e.type&&(e.type=qi[e.type])}class Wi{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}const Hi=e=>e/100;class Yi extends Wi{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var e,t;const{motionValue:n}=this.options;n&&n.updatedAt!==Ao.now()&&this.tick(Ao.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),null==(t=(e=this.options).onStop)||t.call(e))},this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){const{options:e}=this;Ui(e);const{type:t=Vi,repeat:n=0,repeatDelay:a=0,repeatType:s,velocity:r=0}=e;let{keyframes:o}=e;const i=t||Vi;i!==Vi&&"number"!=typeof o[0]&&(this.mixKeyframes=Hr(Hi,wi(o[0],o[1])),o=[0,100]);const l=i({...e,keyframes:o});"mirror"===s&&(this.mirroredGenerator=i({...e,keyframes:[...o].reverse(),velocity:-r})),null===l.calculatedDuration&&(l.calculatedDuration=Di(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+a,this.totalDuration=this.resolvedDuration*(n+1)-a,this.generator=l}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:n,totalDuration:a,mixKeyframes:s,mirroredGenerator:r,resolvedDuration:o,calculatedDuration:i}=this;if(null===this.startTime)return n.next(0);const{delay:l=0,keyframes:c,repeat:u,repeatType:d,repeatDelay:h,type:m,onUpdate:p,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-a/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const f=this.currentTime-l*(this.playbackSpeed>=0?1:-1),y=this.playbackSpeed>=0?f<0:f>a;this.currentTime=Math.max(f,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=a);let b=this.currentTime,v=n;if(u){const e=Math.min(this.currentTime,a)/o;let t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),1===n&&t--,t=Math.min(t,u+1),Boolean(t%2)&&("reverse"===d?(n=1-n,h&&(n-=h/o)):"mirror"===d&&(v=r)),b=_r(0,1,n)*o}const w=y?{done:!1,value:c[0]}:v.next(b);s&&(w.value=s(w.value));let{done:C}=w;y||null===i||(C=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const k=null===this.holdTime&&("finished"===this.state||"running"===this.state&&C);return k&&m!==zi&&(w.value=$i(c,this.options,g,this.speed)),p&&p(w.value),k&&this.finish(),w}then(e,t){return this.finished.then(e,t)}get duration(){return Xr(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Xr(e)}get time(){return Xr(this.currentTime)}set time(e){var t;e=Kr(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),null==(t=this.driver)||t.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(Ao.now());const t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Xr(this.currentTime))}play(){var e,t;if(this.isStopped)return;const{driver:n=Ci,startTime:a}=this.options;this.driver||(this.driver=n(e=>this.tick(e))),null==(t=(e=this.options).onPlay)||t.call(e);const s=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=s):null!==this.holdTime?this.startTime=s-this.holdTime:this.startTime||(this.startTime=a??s),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Ao.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,t;this.notifyFinished(),this.teardown(),this.state="finished",null==(t=(e=this.options).onComplete)||t.call(e)}cancel(){var e,t;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),null==(t=(e=this.options).onCancel)||t.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var t;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),null==(t=this.driver)||t.stop(),e.observe(this)}}const Gi=e=>180*e/Math.PI,Ki=e=>{const t=Gi(Math.atan2(e[1],e[0]));return Ji(t)},Xi={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Ki,rotateZ:Ki,skewX:e=>Gi(Math.atan(e[1])),skewY:e=>Gi(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Ji=e=>((e%=360)<0&&(e+=360),e),Zi=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Qi=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),el={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Zi,scaleY:Qi,scale:e=>(Zi(e)+Qi(e))/2,rotateX:e=>Ji(Gi(Math.atan2(e[6],e[5]))),rotateY:e=>Ji(Gi(Math.atan2(-e[2],e[0]))),rotateZ:Ki,rotate:Ki,skewX:e=>Gi(Math.atan(e[4])),skewY:e=>Gi(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function tl(e){return e.includes("scale")?1:0}function nl(e,t){if(!e||"none"===e)return tl(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,s;if(n)a=el,s=n;else{const t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=Xi,s=t}if(!s)return tl(t);const r=a[t],o=s[1].split(",").map(al);return"function"==typeof r?r(o):o[r]}function al(e){return parseFloat(e.trim())}const sl=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],rl=(()=>new Set(sl))(),ol=e=>e===To||e===Ho,il=new Set(["x","y","z"]),ll=sl.filter(e=>!il.has(e)),cl={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>nl(t,"x"),y:(e,{transform:t})=>nl(t,"y")};cl.translateX=cl.x,cl.translateY=cl.y;const ul=new Set;let dl=!1,hl=!1,ml=!1;function pl(){if(hl){const e=Array.from(ul).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{const t=function(e){const t=[];return ll.forEach(n=>{const a=e.getValue(n);void 0!==a&&(t.push([n,a.get()]),a.set(n.startsWith("scale")?1:0))}),t}(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();const t=n.get(e);t&&t.forEach(([t,n])=>{var a;null==(a=e.getValue(t))||a.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}hl=!1,dl=!1,ul.forEach(e=>e.complete(ml)),ul.clear()}function gl(){ul.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(hl=!0)})}class fl{constructor(e,t,n,a,s,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=a,this.element=s,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?(ul.add(this),dl||(dl=!0,vo.read(gl),vo.resolveKeyframes(pl))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:n,motionValue:a}=this;if(null===e[0]){const s=null==a?void 0:a.get(),r=e[e.length-1];if(void 0!==s)e[0]=s;else if(n&&t){const a=n.readValue(t,r);null!=a&&(e[0]=a)}void 0===e[0]&&(e[0]=r),a&&void 0===s&&a.set(e[0])}!function(e){for(let t=1;tvoid 0!==window.ScrollTimeline),bl={};function vl(e,t){const n=qr(e);return()=>bl[t]??n()}const wl=vl(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),Cl=([e,t,n,a])=>`cubic-bezier(${e}, ${t}, ${n}, ${a})`,kl={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Cl([0,.65,.55,1]),circOut:Cl([.55,0,1,.45]),backIn:Cl([.31,.01,.66,-.59]),backOut:Cl([.33,1.53,.69,.99])};function xl(e,t){return e?"function"==typeof e?wl()?ki(e,t):"ease-out":po(e)?Cl(e):Array.isArray(e)?e.map(e=>xl(e,t)||kl.easeOut):kl[e]:void 0}function Dl(e,t,n,{delay:a=0,duration:s=300,repeat:r=0,repeatType:o="loop",ease:i="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const d=xl(i,s);Array.isArray(d)&&(u.easing=d);const h={delay:a,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:r+1,direction:"reverse"===o?"alternate":"normal"};return c&&(h.pseudoElement=c),e.animate(u,h)}function Al(e){return"function"==typeof e&&"applyToOptions"in e}class El extends Wi{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:n,keyframes:a,pseudoElement:s,allowFlatten:r=!1,finalKeyframe:o,onComplete:i}=e;this.isPseudoElement=Boolean(s),this.allowFlatten=r,this.options=e,e.type;const l=function({type:e,...t}){return Al(e)&&wl()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=Dl(t,n,a,l,s),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const e=$i(a,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(e):function(e,t,n){(e=>e.startsWith("--"))(t)?e.style.setProperty(t,n):e.style[t]=n}(t,n,e),this.animation.cancel()}null==i||i(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,t;null==(t=(e=this.animation).finish)||t.call(e)}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,t;this.isPseudoElement||null==(t=(e=this.animation).commitStyles)||t.call(e)}get duration(){var e,t;const n=(null==(t=null==(e=this.animation.effect)?void 0:e.getComputedTiming)?void 0:t.call(e).duration)||0;return Xr(Number(n))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Xr(e)}get time(){return Xr(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Kr(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){var n;return this.allowFlatten&&(null==(n=this.animation.effect)||n.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&yl()?(this.animation.timeline=e,Ur):t(this)}}const Bl={anticipate:ro,backInOut:so,circInOut:lo};class Fl extends El{constructor(e){var t;"string"==typeof(t=e).ease&&t.ease in Bl&&(t.ease=Bl[t.ease]),Ui(e),super(e),void 0!==e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:n,onComplete:a,element:s,...r}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);const o=new Yi({...r,autoplay:!1}),i=Math.max(10,Ao.now()-this.startTime),l=_r(0,10,i-10);t.setWithVelocity(o.sample(Math.max(0,i-l)).value,o.sample(i).value,l),o.stop()}}const Sl=(e,t)=>!("zIndex"===t||"number"!=typeof e&&!Array.isArray(e)&&("string"!=typeof e||!oi.test(e)&&"0"!==e||e.startsWith("url(")));function Ml(e){e.duration=0,e.type="keyframes"}const jl=new Set(["opacity","clipPath","filter","transform"]),Tl=qr(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class Pl extends Wi{constructor({autoplay:e=!0,delay:t=0,type:n="keyframes",repeat:a=0,repeatDelay:s=0,repeatType:r="loop",keyframes:o,name:i,motionValue:l,element:c,...u}){var d;super(),this.stop=()=>{var e,t;this._animation&&(this._animation.stop(),null==(e=this.stopTimeline)||e.call(this)),null==(t=this.keyframeResolver)||t.cancel()},this.createdAt=Ao.now();const h={autoplay:e,delay:t,type:n,repeat:a,repeatDelay:s,repeatType:r,name:i,motionValue:l,element:c,...u},m=(null==c?void 0:c.KeyframeResolver)||fl;this.keyframeResolver=new m(o,(e,t,n)=>this.onKeyframesResolved(e,t,h,!n),i,l,c),null==(d=this.keyframeResolver)||d.scheduleResolve()}onKeyframesResolved(e,t,n,a){var s,r;this.keyframeResolver=void 0;const{name:o,type:i,velocity:l,delay:c,isHandoff:u,onUpdate:d}=n;this.resolvedAt=Ao.now(),function(e,t,n,a){const s=e[0];if(null===s)return!1;if("display"===t||"visibility"===t)return!0;const r=e[e.length-1],o=Sl(s,t),i=Sl(r,t);return!(!o||!i)&&(function(e){const t=e[0];if(1===e.length)return!0;for(let n=0;n40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},m=!u&&function(e){var t;const{motionValue:n,name:a,repeatDelay:s,repeatType:r,damping:o,type:i}=e;if(!((null==(t=null==n?void 0:n.owner)?void 0:t.current)instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=n.owner.getProps();return Tl()&&a&&jl.has(a)&&("transform"!==a||!c)&&!l&&!s&&"mirror"!==r&&0!==o&&"inertia"!==i}(h),p=null==(r=null==(s=h.motionValue)?void 0:s.owner)?void 0:r.current,g=m?new Fl({...h,element:p}):new Yi(h);g.finished.then(()=>{this.notifyFinished()}).catch(Ur),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||(null==(e=this.keyframeResolver)||e.resume(),ml=!0,gl(),pl(),ml=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),null==(e=this.keyframeResolver)||e.cancel()}}function Ll(e,t,n,a=0,s=1){const r=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,i=(o-1)*a;return"function"==typeof n?n(r,o):1===s?r*a:i-r*a}const Rl=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Nl(e,t,n=1){const[a,s]=function(e){const t=Rl.exec(e);if(!t)return[,];const[,n,a,s]=t;return[`--${n??a}`,s]}(e);if(!a)return;const r=window.getComputedStyle(t).getPropertyValue(a);if(r){const e=r.trim();return Vr(e)?parseFloat(e):e}return So(s)?Nl(s,t,n+1):s}const zl={type:"spring",stiffness:500,damping:25,restSpeed:10},_l={type:"keyframes",duration:.8},Il={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Vl=e=>null!==e;function Ol(e,t){return(null==e?void 0:e[t])??(null==e?void 0:e.default)??e}const $l=(e,t,n,a={},s,r)=>o=>{const i=Ol(a,e)||{},l=i.delay||a.delay||0;let{elapsed:c=0}=a;c-=Kr(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...i,delay:-c,onUpdate:e=>{t.set(e),i.onUpdate&&i.onUpdate(e)},onComplete:()=>{o(),i.onComplete&&i.onComplete()},name:e,motionValue:t,element:r?void 0:s};(function({when:e,delay:t,delayChildren:n,staggerChildren:a,staggerDirection:s,repeat:r,repeatType:o,repeatDelay:i,from:l,elapsed:c,...u}){return!!Object.keys(u).length})(i)||Object.assign(u,((e,{keyframes:t})=>t.length>2?_l:rl.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:zl:Il)(e,u)),u.duration&&(u.duration=Kr(u.duration)),u.repeatDelay&&(u.repeatDelay=Kr(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let d=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(Ml(u),0===u.delay&&(d=!0)),(Ir.instantAnimations||Ir.skipAnimations)&&(d=!0,Ml(u),u.delay=0),u.allowFlatten=!i.type&&!i.ease,d&&!r&&void 0!==t.get()){const e=function(e,{repeat:t,repeatType:n="loop"}){const a=e.filter(Vl);return a[t&&"loop"!==n&&t%2==1?0:a.length-1]}(u.keyframes,i);if(void 0!==e)return void vo.update(()=>{u.onUpdate(e),u.onComplete()})}return i.isSync?new Yi(u):new Pl(u)};function ql(e){const t=[{},{}];return null==e||e.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function Ul(e,t,n,a){if("function"==typeof t){const[s,r]=ql(a);t=t(void 0!==n?n:e.custom,s,r)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){const[s,r]=ql(a);t=t(void 0!==n?n:e.custom,s,r)}return t}function Wl(e,t,n){const a=e.getProps();return Ul(a,t,void 0!==n?n:a.custom,e)}const Hl=new Set(["width","height","top","left","right","bottom",...sl]);class Yl{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{var t;const n=Ao.now();if(this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(null==(t=this.events.change)||t.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){var t;this.current=e,this.updatedAt=Ao.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=(t=this.current,!isNaN(parseFloat(t))))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new Gr);const n=this.events[e].add(t);return"change"===e?()=>{n(),vo.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;null==(e=this.events.change)||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Ao.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return Jr(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,t;null==(e=this.dependents)||e.clear(),null==(t=this.events.destroy)||t.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Gl(e,t){return new Yl(e,t)}const Kl=e=>Array.isArray(e);function Xl(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Gl(n))}function Jl(e){return Kl(e)?e[e.length-1]||0:e}function Zl(e,t){const n=Wl(e,t);let{transitionEnd:a={},transition:s={},...r}=n||{};r={...r,...a};for(const o in r)Xl(e,o,Jl(r[o]))}const Ql=e=>Boolean(e&&e.getVelocity);function ec(e,t){const n=e.getValue("willChange");if(a=n,Boolean(Ql(a)&&a.add))return n.add(t);if(!n&&Ir.WillChange){const n=new Ir.WillChange("auto");e.addValue("willChange",n),n.add(t)}var a}function tc(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const nc="data-"+tc("framerAppearId");function ac(e){return e.props[nc]}function sc({protectedKeys:e,needsAnimating:t},n){const a=e.hasOwnProperty(n)&&!0!==t[n];return t[n]=!1,a}function rc(e,t,{delay:n=0,transitionOverride:a,type:s}={}){let{transition:r=e.getDefaultTransition(),transitionEnd:o,...i}=t;a&&(r=a);const l=[],c=s&&e.animationState&&e.animationState.getState()[s];for(const u in i){const t=e.getValue(u,e.latestValues[u]??null),a=i[u];if(void 0===a||c&&sc(c,u))continue;const s={delay:n,...Ol(r||{},u)},o=t.get();if(void 0!==o&&!t.isAnimating&&!Array.isArray(a)&&a===o&&!s.velocity)continue;let d=!1;if(window.MotionHandoffAnimation){const t=ac(e);if(t){const e=window.MotionHandoffAnimation(t,u,vo);null!==e&&(s.startTime=e,d=!0)}}ec(e,u),t.start($l(u,t,a,e.shouldReduceMotion&&Hl.has(u)?{type:!1}:s,e,d));const h=t.animation;h&&l.push(h)}return o&&Promise.all(l).then(()=>{vo.update(()=>{o&&Zl(e,o)})}),l}function oc(e,t,n={}){var a;const s=Wl(e,t,"exit"===n.type?null==(a=e.presenceContext)?void 0:a.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(r=n.transitionOverride);const o=s?()=>Promise.all(rc(e,s,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(a=0)=>{const{delayChildren:s=0,staggerChildren:o,staggerDirection:i}=r;return function(e,t,n=0,a=0,s=0,r=1,o){const i=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),i.push(oc(l,t,{...o,delay:n+("function"==typeof a?0:a)+Ll(e.variantChildren,l,a,s,r)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(i)}(e,t,a,s,o,i,n)}:()=>Promise.resolve(),{when:l}=r;if(l){const[e,t]="beforeChildren"===l?[o,i]:[i,o];return e().then(()=>t())}return Promise.all([o(),i(n.delay)])}function ic(e,t,n={}){let a;if(e.notify("AnimationStart",t),Array.isArray(t)){const s=t.map(t=>oc(e,t,n));a=Promise.all(s)}else if("string"==typeof t)a=oc(e,t,n);else{const s="function"==typeof t?Wl(e,t,n.custom):t;a=Promise.all(rc(e,s,n))}return a.then(()=>{e.notify("AnimationComplete",t)})}const lc=e=>t=>t.test(e),cc=[To,Ho,Wo,Uo,Go,Yo,{test:e=>"auto"===e,parse:e=>e}],uc=e=>cc.find(lc(e));function dc(e){return"number"==typeof e?0===e:null===e||"none"===e||"0"===e||$r(e)}const hc=new Set(["brightness","contrast","saturate","opacity"]);function mc(e){const[t,n]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[a]=n.match(No)||[];if(!a)return e;const s=n.replace(a,"");let r=hc.has(t)?1:0;return a!==n&&(r*=100),t+"("+r+s+")"}const pc=/\b([a-z-]*)\(.*?\)/gu,gc={...oi,getAnimatableNone:e=>{const t=e.match(pc);return t?t.map(mc).join(" "):e}},fc={...To,transform:Math.round},yc={borderWidth:Ho,borderTopWidth:Ho,borderRightWidth:Ho,borderBottomWidth:Ho,borderLeftWidth:Ho,borderRadius:Ho,borderTopLeftRadius:Ho,borderTopRightRadius:Ho,borderBottomRightRadius:Ho,borderBottomLeftRadius:Ho,width:Ho,maxWidth:Ho,height:Ho,maxHeight:Ho,top:Ho,right:Ho,bottom:Ho,left:Ho,inset:Ho,insetBlock:Ho,insetBlockStart:Ho,insetBlockEnd:Ho,insetInline:Ho,insetInlineStart:Ho,insetInlineEnd:Ho,padding:Ho,paddingTop:Ho,paddingRight:Ho,paddingBottom:Ho,paddingLeft:Ho,paddingBlock:Ho,paddingBlockStart:Ho,paddingBlockEnd:Ho,paddingInline:Ho,paddingInlineStart:Ho,paddingInlineEnd:Ho,margin:Ho,marginTop:Ho,marginRight:Ho,marginBottom:Ho,marginLeft:Ho,marginBlock:Ho,marginBlockStart:Ho,marginBlockEnd:Ho,marginInline:Ho,marginInlineStart:Ho,marginInlineEnd:Ho,fontSize:Ho,backgroundPositionX:Ho,backgroundPositionY:Ho,rotate:Uo,rotateX:Uo,rotateY:Uo,rotateZ:Uo,scale:Lo,scaleX:Lo,scaleY:Lo,scaleZ:Lo,skew:Uo,skewX:Uo,skewY:Uo,distance:Ho,translateX:Ho,translateY:Ho,translateZ:Ho,x:Ho,y:Ho,z:Ho,perspective:Ho,transformPerspective:Ho,opacity:Po,originX:Ko,originY:Ko,originZ:Ho,zIndex:fc,fillOpacity:Po,strokeOpacity:Po,numOctaves:fc},bc={...yc,color:Jo,backgroundColor:Jo,outlineColor:Jo,fill:Jo,stroke:Jo,borderColor:Jo,borderTopColor:Jo,borderRightColor:Jo,borderBottomColor:Jo,borderLeftColor:Jo,filter:gc,WebkitFilter:gc},vc=e=>bc[e];function wc(e,t){let n=vc(e);return n!==gc&&(n=oi),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Cc=new Set(["auto","none","0"]);class kc extends fl{constructor(e,t,n,a,s){super(e,t,n,a,s,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let i=0;i{t.getValue(e).set(n)}),this.resolveNoneKeyframes()}}function xc(e,t,n){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let t=document;const a=(null==n?void 0:n[e])??t.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e).filter(e=>null!=e)}const Dc=(e,t)=>t&&"number"==typeof e?t.transform(e):e;function Ac(e){return Or(e)&&"offsetHeight"in e}const{schedule:Ec}=bo(queueMicrotask,!1),Bc={x:!1,y:!1};function Fc(){return Bc.x||Bc.y}function Sc(e,t){const n=xc(e),a=new AbortController;return[n,{passive:!0,...t,signal:a.signal},()=>a.abort()]}function Mc(e){return!("touch"===e.pointerType||Fc())}const jc=(e,t)=>!!t&&(e===t||jc(e,t.parentElement)),Tc=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary,Pc=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Lc(e){return Pc.has(e.tagName)||!0===e.isContentEditable}const Rc=new WeakSet;function Nc(e){return t=>{"Enter"===t.key&&e(t)}}function zc(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function _c(e){return Tc(e)&&!Fc()}function Ic(e){return Or(e)&&"ownerSVGElement"in e}function Vc(e){return Ic(e)&&"svg"===e.tagName}const Oc=[...cc,Jo,oi],$c=()=>({x:{min:0,max:0},y:{min:0,max:0}}),qc={current:null},Uc={current:!1},Wc="undefined"!=typeof window,Hc=new WeakMap;function Yc(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function Gc(e){return"string"==typeof e||Array.isArray(e)}const Kc=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Xc=["initial",...Kc];function Jc(e){return Yc(e.animate)||Xc.some(t=>Gc(e[t]))}function Zc(e){return Boolean(Jc(e)||e.variants)}const Qc=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let eu={};function tu(e){eu=e}class nu{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:a,blockInitialAnimation:s,visualState:r},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=fl,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const e=Ao.now();this.renderScheduledAtthis.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(Uc.current||function(){if(Uc.current=!0,Wc)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>qc.current=e.matches;e.addEventListener("change",t),t()}else qc.current=!1}(),this.shouldReduceMotion=qc.current),null==(t=this.parent)||t.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),wo(this.notifyUpdate),wo(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),null==(e=this.parent)||e.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=rl.has(e);n&&this.onBindTransform&&this.onBindTransform();const a=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&vo.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{a(),s&&s(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in eu){const t=eu[e];if(!t)continue;const{isEnabled:n,Feature:a}=t;if(!this.features[e]&&a&&n(this.props)&&(this.features[e]=new a(this)),this.features[e]){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let n=0;nt.variantChildren.delete(e)}addValue(e,t){const n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return void 0===n&&void 0!==t&&(n=Gl(null===t?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];var a;return null!=n&&("string"==typeof n&&(Vr(n)||$r(n))?n=parseFloat(n):(a=n,!Oc.find(lc(a))&&oi.test(t)&&(n=wc(e,t))),this.setBaseTarget(e,Ql(n)?n.get():n)),Ql(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:n}=this.props;let a;if("string"==typeof n||"object"==typeof n){const s=Ul(this.props,n,null==(t=this.presenceContext)?void 0:t.custom);s&&(a=s[e])}if(n&&void 0!==a)return a;const s=this.getBaseTargetFromProps(this.props,e);return void 0===s||Ql(s)?void 0!==this.initialValues[e]&&void 0===a?void 0:this.baseTarget[e]:s}on(e,t){return this.events[e]||(this.events[e]=new Gr),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Ec.render(this.render)}}class au extends nu{constructor(){super(...arguments),this.KeyframeResolver=kc}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){const n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Ql(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}class su{constructor(e){this.isMounted=!1,this.node=e}update(){}}function ru({top:e,left:t,right:n,bottom:a}){return{x:{min:t,max:n},y:{min:e,max:a}}}function ou(e){return void 0===e||1===e}function iu({scale:e,scaleX:t,scaleY:n}){return!ou(e)||!ou(t)||!ou(n)}function lu(e){return iu(e)||cu(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function cu(e){return uu(e.x)||uu(e.y)}function uu(e){return e&&"0%"!==e}function du(e,t,n){return n+t*(e-n)}function hu(e,t,n,a,s){return void 0!==s&&(e=du(e,s,a)),du(e,n,a)+t}function mu(e,t=0,n=1,a,s){e.min=hu(e.min,t,n,a,s),e.max=hu(e.max,t,n,a,s)}function pu(e,{x:t,y:n}){mu(e.x,t.translate,t.scale,t.originPoint),mu(e.y,n.translate,n.scale,n.originPoint)}const gu=.999999999999,fu=1.0000000000001;function yu(e,t){e.min=e.min+t,e.max=e.max+t}function bu(e,t,n,a,s=.5){mu(e,t,n,ci(e.min,e.max,s),a)}function vu(e,t){bu(e.x,t.x,t.scaleX,t.scale,t.originX),bu(e.y,t.y,t.scaleY,t.scale,t.originY)}function wu(e,t){return ru(function(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),a=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:a.y,right:a.x}}(e.getBoundingClientRect(),t))}const Cu={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ku=sl.length;function xu(e,t,n){const{style:a,vars:s,transformOrigin:r}=e;let o=!1,i=!1;for(const l in t){const e=t[l];if(rl.has(l))o=!0;else if(Bo(l))s[l]=e;else{const t=Dc(e,yc[l]);l.startsWith("origin")?(i=!0,r[l]=t):a[l]=t}}if(t.transform||(o||n?a.transform=function(e,t,n){let a="",s=!0;for(let r=0;r{if(!t.target)return e;if("string"==typeof e){if(!Ho.test(e))return e;e=parseFloat(e)}return`${Au(e,t.target.x)}% ${Au(e,t.target.y)}%`}},Bu={correct:(e,{treeScale:t,projectionDelta:n})=>{const a=e,s=oi.parse(e);if(s.length>5)return a;const r=oi.createTransformer(e),o="number"!=typeof s[0]?1:0,i=n.x.scale*t.x,l=n.y.scale*t.y;s[0+o]/=i,s[1+o]/=l;const c=ci(i,l,.5);return"number"==typeof s[2+o]&&(s[2+o]/=c),"number"==typeof s[3+o]&&(s[3+o]/=c),r(s)}},Fu={borderRadius:{...Eu,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Eu,borderTopRightRadius:Eu,borderBottomLeftRadius:Eu,borderBottomRightRadius:Eu,boxShadow:Bu};function Su(e){for(const t in e)Fu[t]=e[t],Bo(t)&&(Fu[t].isCSSVariable=!0)}function Mu(e,{layout:t,layoutId:n}){return rl.has(e)||e.startsWith("origin")||(t||void 0!==n)&&(!!Fu[e]||"opacity"===e)}function ju(e,t,n){var a;const s=e.style,r=null==t?void 0:t.style,o={};if(!s)return o;for(const i in s)(Ql(s[i])||r&&Ql(r[i])||Mu(i,e)||void 0!==(null==(a=null==n?void 0:n.getValue(i))?void 0:a.liveStyle))&&(o[i]=s[i]);return o}class Tu extends au{constructor(){super(...arguments),this.type="html",this.renderInstance=Du}readValueFromInstance(e,t){var n,a;if(rl.has(t))return(null==(n=this.projection)?void 0:n.isProjecting)?tl(t):((e,t)=>{const{transform:n="none"}=getComputedStyle(e);return nl(n,t)})(e,t);{const n=(a=e,window.getComputedStyle(a)),s=(Bo(t)?n.getPropertyValue(t):n[t])||0;return"string"==typeof s?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:t}){return wu(e,t)}build(e,t,n){xu(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return ju(e,t,n)}}const Pu={offset:"stroke-dashoffset",array:"stroke-dasharray"},Lu={offset:"strokeDashoffset",array:"strokeDasharray"},Ru=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Nu(e,{attrX:t,attrY:n,attrScale:a,pathLength:s,pathSpacing:r=1,pathOffset:o=0,...i},l,c,u){if(xu(e,i,c),l)return void(e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox));e.attrs=e.style,e.style={};const{attrs:d,style:h}=e;d.transform&&(h.transform=d.transform,delete d.transform),(h.transform||d.transformOrigin)&&(h.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),h.transform&&(h.transformBox=(null==u?void 0:u.transformBox)??"fill-box",delete d.transformBox);for(const m of Ru)void 0!==d[m]&&(h[m]=d[m],delete d[m]);void 0!==t&&(d.x=t),void 0!==n&&(d.y=n),void 0!==a&&(d.scale=a),void 0!==s&&function(e,t,n=1,a=0,s=!0){e.pathLength=1;const r=s?Pu:Lu;e[r.offset]=""+-a,e[r.array]=`${t} ${n}`}(d,s,r,o,!1)}const zu=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),_u=e=>"string"==typeof e&&"svg"===e.toLowerCase();function Iu(e,t,n){const a=ju(e,t,n);for(const s in e)(Ql(e[s])||Ql(t[s]))&&(a[-1!==sl.indexOf(s)?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s]=e[s]);return a}class Vu extends au{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=$c}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(rl.has(t)){const e=vc(t);return e&&e.default||0}return t=zu.has(t)?t:tc(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Iu(e,t,n)}build(e,t,n){Nu(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,a){!function(e,t,n,a){Du(e,t,void 0,a);for(const s in t.attrs)e.setAttribute(zu.has(s)?s:tc(s),t.attrs[s])}(e,t,0,a)}mount(e){this.isSVGTag=_u(e.tagName),super.mount(e)}}const Ou=Xc.length;function $u(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent&&$u(e.parent)||{};return void 0!==e.props.initial&&(t.initial=e.props.initial),t}const t={};for(let n=0;nPromise.all(t.map(({animation:t,options:n})=>ic(e,t,n)))}(e),n=Ku(),a=!0;const s=t=>(n,a)=>{var s;const r=Wl(e,a,"exit"===t?null==(s=e.presenceContext)?void 0:s.custom:void 0);if(r){const{transition:e,transitionEnd:t,...a}=r;n={...n,...a,...t}}return n};function r(r){const{props:o}=e,i=$u(e.parent)||{},l=[],c=new Set;let u={},d=1/0;for(let t=0;td&&g,w=!1;const C=Array.isArray(p)?p:[p];let k=C.reduce(s(h),{});!1===f&&(k={});const{prevResolvedValues:x={}}=m,D={...x,...k},A=t=>{v=!0,c.has(t)&&(w=!0,c.delete(t)),m.needsAnimating[t]=!0;const n=e.getValue(t);n&&(n.liveStyle=!1)};for(const e in D){const t=k[e],n=x[e];if(u.hasOwnProperty(e))continue;let a=!1;a=Kl(t)&&Kl(n)?!qu(t,n):t!==n,a?null!=t?A(e):c.add(e):void 0!==t&&c.has(e)?A(e):m.protectedKeys[e]=!0}m.prevProp=p,m.prevResolvedValues=k,m.isActive&&(u={...u,...k}),a&&e.blockInitialAnimation&&(v=!1);const E=y&&b;v&&(!E||w)&&l.push(...C.map(t=>{const n={type:h};if("string"==typeof t&&a&&!E&&e.manuallyAnimateOnMount&&e.parent){const{parent:a}=e,s=Wl(a,t);if(a.enteringChildren&&s){const{delayChildren:t}=s.transition||{};n.delay=Ll(a.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(c.size){const t={};if("boolean"!=typeof o.initial){const n=Wl(e,Array.isArray(o.initial)?o.initial[0]:o.initial);n&&n.transition&&(t.transition=n.transition)}c.forEach(n=>{const a=e.getBaseTarget(n),s=e.getValue(n);s&&(s.liveStyle=!0),t[n]=a??null}),l.push({animation:t})}let h=Boolean(l.length);return!a||!1!==o.initial&&o.initial!==o.animate||e.manuallyAnimateOnMount||(h=!1),a=!1,h?t(l):Promise.resolve()}return{animateChanges:r,setActive:function(t,a){var s;if(n[t].isActive===a)return Promise.resolve();null==(s=e.variantChildren)||s.forEach(e=>{var n;return null==(n=e.animationState)?void 0:n.setActive(t,a)}),n[t].isActive=a;const o=r(t);for(const e in n)n[e].protectedKeys={};return o},setAnimateFunction:function(n){t=n(e)},getState:()=>n,reset:()=>{n=Ku()}}}function Yu(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!qu(t,e)}function Gu(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ku(){return{animate:Gu(!0),whileInView:Gu(),whileHover:Gu(),whileTap:Gu(),whileDrag:Gu(),whileFocus:Gu(),exit:Gu()}}function Xu(e,t){e.min=t.min,e.max=t.max}function Ju(e,t){Xu(e.x,t.x),Xu(e.y,t.y)}function Zu(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Qu(e){return e.max-e.min}function ed(e,t,n,a=.5){e.origin=a,e.originPoint=ci(t.min,t.max,e.origin),e.scale=Qu(n)/Qu(t),e.translate=ci(n.min,n.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function td(e,t,n,a){ed(e.x,t.x,n.x,a?a.originX:void 0),ed(e.y,t.y,n.y,a?a.originY:void 0)}function nd(e,t,n){e.min=n.min+t.min,e.max=e.min+Qu(t)}function ad(e,t,n){e.min=t.min-n.min,e.max=e.min+Qu(t)}function sd(e,t,n){ad(e.x,t.x,n.x),ad(e.y,t.y,n.y)}function rd(e,t,n,a,s){return e=du(e-=t,1/n,a),void 0!==s&&(e=du(e,1/s,a)),e}function od(e,t,[n,a,s],r,o){!function(e,t=0,n=1,a=.5,s,r=e,o=e){if(Wo.test(t)&&(t=parseFloat(t),t=ci(o.min,o.max,t/100)-o.min),"number"!=typeof t)return;let i=ci(r.min,r.max,a);e===r&&(i-=t),e.min=rd(e.min,t,n,i,s),e.max=rd(e.max,t,n,i,s)}(e,t[n],t[a],t[s],t.scale,r,o)}const id=["x","scaleX","originX"],ld=["y","scaleY","originY"];function cd(e,t,n,a){od(e.x,t,id,n?n.x:void 0,a?a.x:void 0),od(e.y,t,ld,n?n.y:void 0,a?a.y:void 0)}function ud(e){return 0===e.translate&&1===e.scale}function dd(e){return ud(e.x)&&ud(e.y)}function hd(e,t){return e.min===t.min&&e.max===t.max}function md(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function pd(e,t){return md(e.x,t.x)&&md(e.y,t.y)}function gd(e){return Qu(e.x)/Qu(e.y)}function fd(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function yd(e){return[e("x"),e("y")]}const bd=["TopLeft","TopRight","BottomLeft","BottomRight"],vd=bd.length,wd=e=>"string"==typeof e?parseFloat(e):e,Cd=e=>"number"==typeof e||Ho.test(e);function kd(e,t){return void 0!==e[t]?e[t]:e.borderRadius}const xd=Ad(0,.5,io),Dd=Ad(.5,.95,Ur);function Ad(e,t,n){return a=>at?1:n(Yr(e,t,a))}function Ed(e,t,n){const a=Ql(e)?e:Gl(e);return a.start($l("",a,t,n)),a.animation}function Bd(e,t,n,a={passive:!0}){return e.addEventListener(t,n,a),()=>e.removeEventListener(t,n)}const Fd=(e,t)=>e.depth-t.depth;class Sd{constructor(){this.children=[],this.isDirty=!1}add(e){Nr(this.children,e),this.isDirty=!0}remove(e){zr(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Fd),this.isDirty=!1,this.children.forEach(e)}}function Md(e,t){const n=Ao.now(),a=({timestamp:s})=>{const r=s-n;r>=t&&(wo(a),e(r-t))};return vo.setup(a,!0),()=>wo(a)}function jd(e){return Ql(e)?e.get():e}class Td{constructor(){this.members=[]}add(e){Nr(this.members,e),e.scheduleRender()}remove(e){if(zr(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){const t=this.members.findIndex(t=>e===t);if(0===t)return!1;let n;for(let a=t;a>=0;a--){const e=this.members[a];if(!1!==e.isPresent){n=e;break}}return!!n&&(this.promote(n),!0)}promote(e,t){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender();const a=n.options.layoutDependency,s=e.options.layoutDependency;void 0!==a&&void 0!==s&&a===s||(e.resumeFrom=n,t&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0));const{crossfade:r}=e.options;!1===r&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:t,resumingFrom:n}=e;t.onExitComplete&&t.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Pd={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Ld=["","X","Y","Z"];let Rd=0;function Nd(e,t,n,a){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),a&&(a[e]=0))}function zd(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=ac(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:t,layoutId:a}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",vo,!(t||a))}const{parent:a}=e;a&&!a.hasCheckedOptimisedAppear&&zd(a)}function _d({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:a,resetTransform:s}){return class{constructor(e={},n=(null==t?void 0:t())){this.id=Rd++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Od),this.nodes.forEach(Gd),this.nodes.forEach(Kd),this.nodes.forEach($d)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let t=0;tthis.root.updateBlockedByResize=!1;vo.read(()=>{a=window.innerWidth}),e(t,()=>{const e=window.innerWidth;e!==a&&(a=e,this.root.updateBlockedByResize=!0,n&&n(),n=Md(s,250),Pd.hasAnimatedSinceResize&&(Pd.hasAnimatedSinceResize=!1,this.nodes.forEach(Yd)))})}n&&this.root.registerSharedNode(n,this),!1!==this.options.animate&&s&&(n||a)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:a})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const r=this.options.transition||s.getDefaultTransition()||th,{onLayoutAnimationStart:o,onLayoutAnimationComplete:i}=s.getProps(),l=!this.targetLayout||!pd(this.targetLayout,a),c=!t&&n;if(this.options.layoutRoot||this.resumeFrom||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const t={...Ol(r,"layout"),onPlay:o,onComplete:i};(s.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c)}else t||Yd(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=a})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),wo(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Xd),this.animationId++)}getTransformTemplate(){const{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&zd(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let s=0;s{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||Qu(this.snapshot.measuredBox.x)||Qu(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let n=0;ngu&&(t.x=1),t.ygu&&(t.y=1)}(this.layoutCorrected,this.treeScale,this.path,n),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:l}=t;l?(this.projectionDelta&&this.prevProjectionDelta?(Zu(this.prevProjectionDelta.x,this.projectionDelta.x),Zu(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),td(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===o&&this.treeScale.y===i&&fd(this.projectionDelta.x,this.prevProjectionDelta.x)&&fd(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){var t;if(null==(t=this.options.visualElement)||t.scheduleRender(),e){const e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(e,t=!1){const n=this.snapshot,a=n?n.latestValues:{},s={...this.latestValues},r={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;const o={x:{min:0,max:0},y:{min:0,max:0}},i=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),c=!l||l.members.length<=1,u=Boolean(i&&!c&&!0===this.options.crossfade&&!this.path.some(eh));let d;this.animationProgress=0,this.mixTargetDelta=t=>{const n=t/1e3;var l,h,m,p,g,f;Zd(r.x,e.x,n),Zd(r.y,e.y,n),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(sd(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,p=this.relativeTargetOrigin,g=o,f=n,Qd(m.x,p.x,g.x,f),Qd(m.y,p.y,g.y,f),d&&(l=this.relativeTarget,h=d,hd(l.x,h.x)&&hd(l.y,h.y))&&(this.isProjectionDirty=!1),d||(d={x:{min:0,max:0},y:{min:0,max:0}}),Ju(d,this.relativeTarget)),i&&(this.animationValues=s,function(e,t,n,a,s,r){s?(e.opacity=ci(0,n.opacity??1,xd(a)),e.opacityExit=ci(t.opacity??1,0,Dd(a))):r&&(e.opacity=ci(t.opacity??1,n.opacity??1,a));for(let o=0;o{Pd.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Gl(0)),this.currentAnimation=Ed(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const e=this.getLead();let{targetWithTransforms:t,target:n,layout:a,latestValues:s}=e;if(t&&n&&a){if(this!==e&&this.layout&&a&&rh(this.options.animationType,this.layout.layoutBox,a.layoutBox)){n=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const t=Qu(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;const a=Qu(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+a}Ju(t,n),vu(t,s),td(this.projectionDeltaWithTransform,this.layoutCorrected,t,s)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Td),this.sharedNodes.get(e).add(t);const n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){const e=this.getStack();return!e||e.lead===this}getLead(){var e;const{layoutId:t}=this.options;return t&&(null==(e=this.getStack())?void 0:e.lead)||this}getPrevLead(){var e;const{layoutId:t}=this.options;return t?null==(e=this.getStack())?void 0:e.prevLead:void 0}getStack(){const{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){const a=this.getStack();a&&a.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){const e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){const{visualElement:e}=this.options;if(!e)return;let t=!1;const{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;const a={};n.z&&Nd("z",e,a,this.animationValues);for(let s=0;s{var t;return null==(t=e.currentAnimation)?void 0:t.stop()}),this.root.nodes.forEach(Ud),this.root.sharedNodes.clear()}}}function Id(e){e.updateLayout()}function Vd(e){var t;const n=(null==(t=e.resumeFrom)?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:t,measuredBox:a}=e.layout,{animationType:s}=e.options,r=n.source!==e.layout.source;"size"===s?yd(e=>{const a=r?n.measuredBox[e]:n.layoutBox[e],s=Qu(a);a.min=t[e].min,a.max=a.min+s}):rh(s,n.layoutBox,t)&&yd(a=>{const s=r?n.measuredBox[a]:n.layoutBox[a],o=Qu(t[a]);s.max=s.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[a].max=e.relativeTarget[a].min+o)});const o={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};td(o,t,n.layoutBox);const i={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};r?td(i,e.applyTransform(a,!0),n.measuredBox):td(i,t,n.layoutBox);const l=!dd(o);let c=!1;if(!e.resumeFrom){const a=e.getClosestProjectingParent();if(a&&!a.resumeFrom){const{snapshot:s,layout:r}=a;if(s&&r){const o={x:{min:0,max:0},y:{min:0,max:0}};sd(o,n.layoutBox,s.layoutBox);const i={x:{min:0,max:0},y:{min:0,max:0}};sd(i,t,r.layoutBox),pd(o,i)||(c=!0),a.options.layoutRoot&&(e.relativeTarget=i,e.relativeTargetOrigin=o,e.relativeParent=a)}}}e.notifyListeners("didUpdate",{layout:t,snapshot:n,delta:i,layoutDelta:o,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function Od(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=Boolean(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function $d(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function qd(e){e.clearSnapshot()}function Ud(e){e.clearMeasurements()}function Wd(e){e.isLayoutDirty=!1}function Hd(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Yd(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Gd(e){e.resolveTargetDelta()}function Kd(e){e.calcProjection()}function Xd(e){e.resetSkewAndRotation()}function Jd(e){e.removeLeadSnapshot()}function Zd(e,t,n){e.translate=ci(t.translate,0,n),e.scale=ci(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Qd(e,t,n,a){e.min=ci(t.min,n.min,a),e.max=ci(t.max,n.max,a)}function eh(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}const th={duration:.45,ease:[.4,0,.1,1]},nh=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),ah=nh("applewebkit/")&&!nh("chrome/")?Math.round:Ur;function sh(e){e.min=ah(e.min),e.max=ah(e.max)}function rh(e,t,n){return"position"===e||"preserve-aspect"===e&&(a=gd(t),s=gd(n),!(Math.abs(a-s)<=.2));var a,s}function oh(e){var t;return e!==e.root&&(null==(t=e.scroll)?void 0:t.wasRoot)}const ih=_d({attachResizeListener:(e,t)=>Bd(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||(null==(e=document.body)?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||(null==(t=document.body)?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),lh=e=>!e.isLayoutDirty&&e.willUpdate(!1);function ch(){const e=new Set,t=new WeakMap,n=()=>e.forEach(lh);return{add:a=>{e.add(a),t.set(a,a.addEventListener("willUpdate",n))},remove:a=>{e.delete(a);const s=t.get(a);s&&(s(),t.delete(a)),n()},dirty:n}}const uh={current:void 0},dh=_d({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!uh.current){const e=new ih({});e.mount(window),e.setOptions({layoutScroll:!0}),uh.current=e}return uh.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),hh=s.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function mh(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}class ph extends s.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){const e=t.offsetParent,n=Ac(e)&&e.offsetWidth||0,a=Ac(e)&&e.offsetHeight||0,s=this.props.sizeRef.current;s.height=t.offsetHeight||0,s.width=t.offsetWidth||0,s.top=t.offsetTop,s.left=t.offsetLeft,s.right=n-s.width-s.left,s.bottom=a-s.height-s.top}return null}componentDidUpdate(){}render(){return this.props.children}}function gh({children:e,isPresent:t,anchorX:n,anchorY:a,root:o}){var i;const l=s.useId(),c=s.useRef(null),u=s.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:d}=s.useContext(hh),h=(null==(i=e.props)?void 0:i.ref)??(null==e?void 0:e.ref),m=function(...e){return s.useCallback(function(...e){return t=>{let n=!1;const a=e.map(e=>{const a=mh(e,t);return n||"function"!=typeof a||(n=!0),a});if(n)return()=>{for(let t=0;t{const{width:e,height:s,top:r,left:i,right:h,bottom:m}=u.current;if(t||!c.current||!e||!s)return;const p="left"===n?`left: ${i}`:`right: ${h}`,g="bottom"===a?`bottom: ${m}`:`top: ${r}`;c.current.dataset.motionPopId=l;const f=document.createElement("style");d&&(f.nonce=d);const y=o??document.head;return y.appendChild(f),f.sheet&&f.sheet.insertRule(`\n [data-motion-pop-id="${l}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${s}px !important;\n ${p}px !important;\n ${g}px !important;\n }\n `),()=>{y.contains(f)&&y.removeChild(f)}},[t]),r.jsx(ph,{isPresent:t,childRef:c,sizeRef:u,children:s.cloneElement(e,{ref:m})})}const fh=({children:e,initial:t,isPresent:n,onExitComplete:a,custom:o,presenceAffectsLayout:i,mode:l,anchorX:c,anchorY:u,root:d})=>{const h=Tr(yh),m=s.useId();let p=!0,g=s.useMemo(()=>(p=!1,{id:m,initial:t,isPresent:n,custom:o,onExitComplete:e=>{h.set(e,!0);for(const t of h.values())if(!t)return;a&&a()},register:e=>(h.set(e,!1),()=>h.delete(e))}),[n,h,a]);return i&&p&&(g={...g}),s.useMemo(()=>{h.forEach((e,t)=>h.set(t,!1))},[n]),s.useEffect(()=>{!n&&!h.size&&a&&a()},[n]),"popLayout"===l&&(e=r.jsx(gh,{isPresent:n,anchorX:c,anchorY:u,root:d,children:e})),r.jsx(Rr.Provider,{value:g,children:e})};function yh(){return new Map}function bh(e=!0){const t=s.useContext(Rr);if(null===t)return[!0,null];const{isPresent:n,onExitComplete:a,register:r}=t,o=s.useId();s.useEffect(()=>{if(e)return r(o)},[e]);const i=s.useCallback(()=>e&&a&&a(o),[o,a,e]);return!n&&a?[!1,i]:[!0]}function vh(){return null===(e=s.useContext(Rr))||e.isPresent;var e}const wh=e=>e.key||"";function Ch(e){const t=[];return s.Children.forEach(e,e=>{s.isValidElement(e)&&t.push(e)}),t}const kh=({children:e,custom:t,initial:n=!0,onExitComplete:a,presenceAffectsLayout:o=!0,mode:i="sync",propagate:l=!1,anchorX:c="left",anchorY:u="top",root:d})=>{const[h,m]=bh(l),p=s.useMemo(()=>Ch(e),[e]),g=l&&!h?[]:p.map(wh),f=s.useRef(!0),y=s.useRef(p),b=Tr(()=>new Map),v=s.useRef(new Set),[w,C]=s.useState(p),[k,x]=s.useState(p);Lr(()=>{f.current=!1,y.current=p;for(let e=0;e{const s=wh(e),w=!(l&&!h)&&(p===k||g.includes(s));return r.jsx(fh,{isPresent:w,initial:!(f.current&&!n)&&void 0,custom:t,presenceAffectsLayout:o,mode:i,root:d,onExitComplete:w?void 0:()=>{if(v.current.has(s))return;if(v.current.add(s),!b.has(s))return;b.set(s,!0);let e=!0;b.forEach(t=>{t||(e=!1)}),e&&(null==A||A(),x(y.current),l&&(null==m||m()),a&&a())},anchorX:c,anchorY:u,children:e},s)})})},xh=s.createContext(null);const Dh=e=>!0===e,Ah=({children:e,id:t,inherit:n=!0})=>{const a=s.useContext(jr),o=s.useContext(xh),[i,l]=function(){const e=function(){const e=s.useRef(!1);return Lr(()=>(e.current=!0,()=>{e.current=!1}),[]),e}(),[t,n]=s.useState(0),a=s.useCallback(()=>{e.current&&n(t+1)},[t]);return[s.useCallback(()=>vo.postRender(a),[a]),t]}(),c=s.useRef(null),u=a.id||o;null===c.current&&((e=>Dh(!0===e)||"id"===e)(n)&&u&&(t=t?u+"-"+t:u),c.current={id:t,group:Dh(n)&&a.group||ch()});const d=s.useMemo(()=>({...c.current,forceRender:i}),[l]);return r.jsx(jr.Provider,{value:d,children:e})},Eh=s.createContext({strict:!1}),Bh={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Fh=!1;function Sh(){return function(){if(Fh)return;const e={};for(const t in Bh)e[t]={isEnabled:e=>Bh[t].some(t=>!!e[t])};tu(e),Fh=!0}(),eu}const Mh=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function jh(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Mh.has(e)}let Th=e=>!jh(e);function Ph(e){"function"==typeof e&&(Th=t=>t.startsWith("on")?!jh(t):e(t))}try{Ph(require("@emotion/is-prop-valid").default)}catch{}const Lh=s.createContext({});function Rh(e){return Array.isArray(e)?e.join(" "):e}function Nh(e,t,n){for(const a in t)Ql(t[a])||Mu(a,n)||(e[a]=t[a])}function zh(e,t){const n={},a=function(e,t){const n={};return Nh(n,e.style||{},e),Object.assign(n,function({transformTemplate:e},t){return s.useMemo(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{}};return xu(n,t,e),Object.assign({},n.vars,n.style)},[t])}(e,t)),n}(e,t);return e.drag&&!1!==e.dragListener&&(n.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=!0===e.drag?"none":"pan-"+("x"===e.drag?"y":"x")),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=a,n}function _h(e,t,n,a){const r=s.useMemo(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return Nu(n,t,_u(a),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){const t={};Nh(t,e.style,e),r.style={...t,...r.style}}return r}const Ih=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Vh(e){return"string"==typeof e&&!e.includes("-")&&!!(Ih.indexOf(e)>-1||/[A-Z]/u.test(e))}function Oh(e,t,n,{latestValues:a},r,o=!1,i){const l=(i??Vh(e)?_h:zh)(t,a,r,e),c=function(e,t,n){const a={};for(const s in e)"values"===s&&"object"==typeof e.values||(Th(s)||!0===n&&jh(s)||!t&&!jh(s)||e.draggable&&s.startsWith("onDrag"))&&(a[s]=e[s]);return a}(t,"string"==typeof e,o),u=e!==s.Fragment?{...c,...l,ref:n}:{},{children:d}=t,h=s.useMemo(()=>Ql(d)?d.get():d,[d]);return s.createElement(e,{...u,children:h})}function $h(e,t,n,a){const s={},r=a(e,{});for(const h in r)s[h]=jd(r[h]);let{initial:o,animate:i}=e;const l=Jc(e),c=Zc(e);t&&c&&!l&&!1!==e.inherit&&(void 0===o&&(o=t.initial),void 0===i&&(i=t.animate));let u=!!n&&!1===n.initial;u=u||!1===o;const d=u?i:o;if(d&&"boolean"!=typeof d&&!Yc(d)){const t=Array.isArray(d)?d:[d];for(let n=0;n(t,n)=>{const a=s.useContext(Lh),r=s.useContext(Rr),o=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t},n,a,s){return{latestValues:$h(n,a,s,e),renderState:t()}}(e,t,a,r);return n?o():Tr(o)},Uh=qh({scrapeMotionValuesFromProps:ju,createRenderState:()=>({style:{},transform:{},transformOrigin:{},vars:{}})}),Wh=qh({scrapeMotionValuesFromProps:Iu,createRenderState:()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}})}),Hh=Symbol.for("motionComponentSymbol");function Yh(e,t,n){const a=s.useRef(n);s.useInsertionEffect(()=>{a.current=n});const r=s.useRef(null);return s.useCallback(n=>{var s;n&&(null==(s=e.onMount)||s.call(e,n)),t&&(n?t.mount(n):t.unmount());const o=a.current;if("function"==typeof o)if(n){const e=o(n);"function"==typeof e&&(r.current=e)}else r.current?(r.current(),r.current=null):o(n);else o&&(o.current=n)},[t])}const Gh=s.createContext({});function Kh(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function Xh(e,t,n,a,r,o){var i,l;const{visualElement:c}=s.useContext(Lh),u=s.useContext(Eh),d=s.useContext(Rr),h=s.useContext(hh).reducedMotion,m=s.useRef(null),p=s.useRef(!1);a=a||u.renderer,!m.current&&a&&(m.current=a(e,{visualState:t,parent:c,props:n,presenceContext:d,blockInitialAnimation:!!d&&!1===d.initial,reducedMotionConfig:h,isSVG:o}),p.current&&m.current&&(m.current.manuallyAnimateOnMount=!0));const g=m.current,f=s.useContext(Gh);!g||g.projection||!r||"html"!==g.type&&"svg"!==g.type||function(e,t,n,a){const{layoutId:s,layout:r,drag:o,dragConstraints:i,layoutScroll:l,layoutRoot:c,layoutCrossfade:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:Jh(e.parent)),e.projection.setOptions({layoutId:s,layout:r,alwaysMeasureLayout:Boolean(o)||i&&Kh(i),visualElement:e,animationType:"string"==typeof r?r:"both",initialPromotionConfig:a,crossfade:u,layoutScroll:l,layoutRoot:c})}(m.current,n,r,f);const y=s.useRef(!1);s.useInsertionEffect(()=>{g&&y.current&&g.update(n,d)});const b=n[nc],v=s.useRef(Boolean(b)&&!(null==(i=window.MotionHandoffIsComplete)?void 0:i.call(window,b))&&(null==(l=window.MotionHasOptimisedAnimation)?void 0:l.call(window,b)));return Lr(()=>{p.current=!0,g&&(y.current=!0,window.MotionIsMounted=!0,g.updateFeatures(),g.scheduleRenderMicrotask(),v.current&&g.animationState&&g.animationState.animateChanges())}),s.useEffect(()=>{g&&(!v.current&&g.animationState&&g.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var e;null==(e=window.MotionHandoffMarkAsComplete)||e.call(window,b)}),v.current=!1),g.enteringChildren=void 0)}),g}function Jh(e){if(e)return!1!==e.options.allowProjection?e.projection:Jh(e.parent)}function Zh(e,{forwardMotionProps:t=!1,type:n}={},a,o){a&&function(e){const t=Sh();for(const n in e)t[n]={...t[n],...e[n]};tu(t)}(a);const i=n?"svg"===n:Vh(e),l=i?Wh:Uh;function c(n,a){let c;const u={...s.useContext(hh),...n,layoutId:Qh(n)},{isStatic:d}=u,h=function(e){const{initial:t,animate:n}=function(e,t){if(Jc(e)){const{initial:t,animate:n}=e;return{initial:!1===t||Gc(t)?t:void 0,animate:Gc(n)?n:void 0}}return!1!==e.inherit?t:{}}(e,s.useContext(Lh));return s.useMemo(()=>({initial:t,animate:n}),[Rh(t),Rh(n)])}(n),m=l(n,d);if(!d&&Pr){s.useContext(Eh).strict;const t=function(e){const t=Sh(),{drag:n,layout:a}=t;if(!n&&!a)return{};const s={...n,...a};return{MeasureLayout:(null==n?void 0:n.isEnabled(e))||(null==a?void 0:a.isEnabled(e))?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}(u);c=t.MeasureLayout,h.visualElement=Xh(e,m,u,o,t.ProjectionNode,i)}return r.jsxs(Lh.Provider,{value:h,children:[c&&h.visualElement?r.jsx(c,{visualElement:h.visualElement,...u}):null,Oh(e,n,Yh(m,h.visualElement,a),m,d,t,i)]})}c.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;const u=s.forwardRef(c);return u[Hh]=e,u}function Qh({layoutId:e}){const t=s.useContext(jr).id;return t&&void 0!==e?t+"-"+e:e}function em(e,t){if("undefined"==typeof Proxy)return Zh;const n=new Map,a=(n,a)=>Zh(n,a,e,t);return new Proxy((e,t)=>a(e,t),{get:(s,r)=>"create"===r?a:(n.has(r)||n.set(r,Zh(r,void 0,e,t)),n.get(r))})}const tm=(e,t)=>t.isSVG??Vh(e)?new Vu(t):new Tu(t,{allowProjection:e!==s.Fragment});let nm=0;const am={animation:{Feature:class extends su{constructor(e){super(e),e.animationState||(e.animationState=Hu(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Yc(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),null==(e=this.unmountControls)||e.call(this)}}},exit:{Feature:class extends su{constructor(){super(...arguments),this.id=nm++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const a=this.node.animationState.setActive("exit",!e);t&&!e&&a.then(()=>{t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function sm(e){return{point:{x:e.pageX,y:e.pageY}}}function rm(e,t,n,a){return Bd(e,t,(e=>t=>Tc(t)&&e(t,sm(t)))(n),a)}const om=({current:e})=>e?e.ownerDocument.defaultView:null,im=(e,t)=>Math.abs(e-t),lm=new Set(["auto","scroll"]);class cm{constructor(e,t,{transformPagePoint:n,contextWindow:a=window,dragSnapToOrigin:s=!1,distanceThreshold:r=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const e=hm(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,n=function(e,t){const n=im(e.x,t.x),a=im(e.y,t.y);return Math.sqrt(n**2+a**2)}(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;const{point:a}=e,{timestamp:s}=Co;this.history.push({...a,timestamp:s});const{onStart:r,onMove:o}=this.handlers;t||(r&&r(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=um(t,this.transformPagePoint),vo.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();const{onEnd:n,onSessionEnd:a,resumeAnimation:s}=this.handlers;if(!this.dragSnapToOrigin&&this.startEvent||s&&s(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const r=hm("pointercancel"===e.type?this.lastMoveEventInfo:um(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,r),a&&a(e,r)},!Tc(e))return;this.dragSnapToOrigin=s,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=r,this.contextWindow=a||window;const i=um(sm(e),this.transformPagePoint),{point:l}=i,{timestamp:c}=Co;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,hm(i,this.history)),this.removeListeners=Hr(rm(this.contextWindow,"pointermove",this.handlePointerMove),rm(this.contextWindow,"pointerup",this.handlePointerUp),rm(this.contextWindow,"pointercancel",this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){const e=getComputedStyle(t);(lm.has(e.overflowX)||lm.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const n=e===window,a=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},s=a.x-t.x,r=a.y-t.y;0===s&&0===r||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s,this.lastMoveEventInfo.point.y+=r):this.history.length>0&&(this.history[0].x-=s,this.history[0].y-=r),this.scrollPositions.set(e,a),vo.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),wo(this.updatePoint)}}function um(e,t){return t?{point:t(e.point)}:e}function dm(e,t){return{x:e.x-t.x,y:e.y-t.y}}function hm({point:e},t){return{point:e,delta:dm(e,pm(t)),offset:dm(e,mm(t)),velocity:gm(t,.1)}}function mm(e){return e[0]}function pm(e){return e[e.length-1]}function gm(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,a=null;const s=pm(e);for(;n>=0&&(a=e[n],!(s.timestamp-a.timestamp>Kr(t)));)n--;if(!a)return{x:0,y:0};const r=Xr(s.timestamp-a.timestamp);if(0===r)return{x:0,y:0};const o={x:(s.x-a.x)/r,y:(s.y-a.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function fm(e,t,n){return{min:void 0!==t?e.min+t:void 0,max:void 0!==n?e.max+n-(e.max-e.min):void 0}}function ym(e,t){let n=t.min-e.min,a=t.max-e.max;return t.max-t.min{t?(this.stopAnimation(),this.snapToCursor(sm(e).point)):this.pauseAnimation()},onStart:(e,t)=>{this.stopAnimation();const{drag:n,dragPropagation:a,onDragStart:s}=this.getProps();if(n&&!a&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(r=n)||"y"===r?Bc[r]?null:(Bc[r]=!0,()=>{Bc[r]=!1}):Bc.x||Bc.y?null:(Bc.x=Bc.y=!0,()=>{Bc.x=Bc.y=!1}),!this.openDragLock))return;var r;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),yd(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Wo.test(t)){const{projection:n}=this.visualElement;if(n&&n.layout){const a=n.layout.layoutBox[e];a&&(t=Qu(a)*(parseFloat(t)/100))}}this.originPoint[e]=t}),s&&vo.postRender(()=>s(e,t)),ec(this.visualElement,"transform");const{animationState:o}=this.visualElement;o&&o.setActive("whileDrag",!0)},onMove:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;const{dragPropagation:n,dragDirectionLock:a,onDirectionLock:s,onDrag:r}=this.getProps();if(!n&&!this.openDragLock)return;const{offset:o}=t;if(a&&null===this.currentDirection)return this.currentDirection=function(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}(o),void(null!==this.currentDirection&&s&&s(this.currentDirection));this.updateAxis("x",t.point,o),this.updateAxis("y",t.point,o),this.visualElement.render(),r&&r(e,t)},onSessionEnd:(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>yd(e=>{var t;return"paused"===this.getAnimationState(e)&&(null==(t=this.getAxisMotionValue(e).animation)?void 0:t.play())})},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:s,distanceThreshold:n,contextWindow:om(this.visualElement),element:this.visualElement.current})}stop(e,t){const n=e||this.latestPointerEvent,a=t||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!a||!n)return;const{velocity:r}=a;this.startAnimation(r);const{onDragEnd:o}=this.getProps();o&&vo.postRender(()=>o(n,a))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){const{drag:a}=this.getProps();if(!n||!xm(e,a,this.currentDirection))return;const s=this.getAxisMotionValue(e);let r=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(r=function(e,{min:t,max:n},a){return void 0!==t&&en&&(e=a?ci(n,e,a.max):Math.min(e,n)),e}(r,this.constraints[e],this.elastic[e])),s.set(r)}resolveConstraints(){var e;const{dragConstraints:t,dragElastic:n}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null==(e=this.visualElement.projection)?void 0:e.layout,s=this.constraints;t&&Kh(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!a)&&function(e,{top:t,left:n,bottom:a,right:s}){return{x:fm(e.x,n,s),y:fm(e.y,t,a)}}(a.layoutBox,t),this.elastic=function(e=bm){return!1===e?e=0:!0===e&&(e=bm),{x:vm(e,"left","right"),y:vm(e,"top","bottom")}}(n),s!==this.constraints&&a&&this.constraints&&!this.hasMutatedConstraints&&yd(e=>{!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=function(e,t){const n={};return void 0!==t.min&&(n.min=t.min-e.min),void 0!==t.max&&(n.max=t.max-e.min),n}(a.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Kh(e))return!1;const n=e.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const s=function(e,t,n){const a=wu(e,n),{scroll:s}=t;return s&&(yu(a.x,s.offset.x),yu(a.y,s.offset.y)),a}(n,a.root,this.visualElement.getTransformPagePoint());let r=function(e,t){return{x:ym(e.x,t.x),y:ym(e.y,t.y)}}(a.layout.layoutBox,s);if(t){const e=t(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(r));this.hasMutatedConstraints=!!e,e&&(r=ru(e))}return r}startAnimation(e){const{drag:t,dragMomentum:n,dragElastic:a,dragTransition:s,dragSnapToOrigin:r,onDragTransitionEnd:o}=this.getProps(),i=this.constraints||{},l=yd(o=>{if(!xm(o,t,this.currentDirection))return;let l=i&&i[o]||{};r&&(l={min:0,max:0});const c=a?200:1e6,u=a?40:1e7,d={type:"inertia",velocity:n?e[o]:0,bounceStiffness:c,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...s,...l};return this.startAxisValueAnimation(o,d)});return Promise.all(l).then(o)}startAxisValueAnimation(e,t){const n=this.getAxisMotionValue(e);return ec(this.visualElement,e),n.start($l(e,n,0,t,this.visualElement,!1))}stopAnimation(){yd(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){yd(e=>{var t;return null==(t=this.getAxisMotionValue(e).animation)?void 0:t.pause()})}getAnimationState(e){var t;return null==(t=this.getAxisMotionValue(e).animation)?void 0:t.state}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){yd(t=>{const{drag:n}=this.getProps();if(!xm(t,n,this.currentDirection))return;const{projection:a}=this.visualElement,s=this.getAxisMotionValue(t);if(a&&a.layout){const{min:n,max:r}=a.layout.layoutBox[t],o=s.get()||0;s.set(e[t]-ci(n,r,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!Kh(t)||!n||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};yd(e=>{const t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){const n=t.get();a[e]=function(e,t){let n=.5;const a=Qu(e),s=Qu(t);return s>a?n=Yr(t.min,t.max-a,e.min):a>s&&(n=Yr(e.min,e.max-s,t.min)),_r(0,1,n)}({min:n,max:n},this.constraints[e])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),yd(t=>{if(!xm(t,e,null))return;const n=this.getAxisMotionValue(t),{min:s,max:r}=this.constraints[t];n.set(ci(s,r,a[t]))})}addListeners(){if(!this.visualElement.current)return;Cm.set(this.visualElement,this);const e=this.visualElement.current,t=rm(e,"pointerdown",t=>{const{drag:n,dragListener:a=!0}=this.getProps(),s=t.target,r=s!==e&&Lc(s);n&&a&&!r&&this.start(t)}),n=()=>{const{dragConstraints:e}=this.getProps();Kh(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:a}=this.visualElement,s=a.addEventListener("measure",n);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),vo.read(n);const r=Bd(window,"resize",()=>this.scalePositionWithinConstraints()),o=a.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(yd(t=>{const n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())});return()=>{r(),t(),s(),o&&o()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:a=!1,dragConstraints:s=!1,dragElastic:r=bm,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:a,dragConstraints:s,dragElastic:r,dragMomentum:o}}}function xm(e,t,n){return!(!0!==t&&t!==e||null!==n&&n!==e)}const Dm=e=>(t,n)=>{e&&vo.postRender(()=>e(t,n))};let Am=!1;class Em extends s.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:a}=this.props,{projection:s}=e;s&&(t.group&&t.group.add(s),n&&n.register&&a&&n.register(s),Am&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Pd.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:n,drag:a,isPresent:s}=this.props,{projection:r}=n;return r?(r.isPresent=s,e.layoutDependency!==t&&r.setOptions({...r.options,layoutDependency:t}),Am=!0,a||e.layoutDependency!==t||void 0===t||e.isPresent!==s?r.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?r.promote():r.relegate()||vo.postRender(()=>{const e=r.getStack();e&&e.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Ec.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:a}=e;Am=!0,a&&(a.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(a),n&&n.deregister&&n.deregister(a))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Bm(e){const[t,n]=bh(),a=s.useContext(jr);return r.jsx(Em,{...e,layoutGroup:a,switchLayoutGroup:s.useContext(Gh),isPresent:t,safeToRemove:n})}const Fm={pan:{Feature:class extends su{constructor(){super(...arguments),this.removePointerDownListener=Ur}onPointerDown(e){this.session=new cm(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:om(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:a}=this.node.getProps();return{onSessionStart:Dm(e),onStart:Dm(t),onMove:n,onEnd:(e,t)=>{delete this.session,a&&vo.postRender(()=>a(e,t))}}}mount(){this.removePointerDownListener=rm(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends su{constructor(e){super(e),this.removeGroupControls=Ur,this.removeListeners=Ur,this.controls=new km(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ur}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:dh,MeasureLayout:Bm}};function Sm(e,t,n){const{props:a}=e;e.animationState&&a.whileHover&&e.animationState.setActive("whileHover","Start"===n);const s=a["onHover"+n];s&&vo.postRender(()=>s(t,sm(t)))}function Mm(e,t,n){const{props:a}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&a.whileTap&&e.animationState.setActive("whileTap","Start"===n);const s=a["onTap"+("End"===n?"":n)];s&&vo.postRender(()=>s(t,sm(t)))}const jm=new WeakMap,Tm=new WeakMap,Pm=e=>{const t=jm.get(e.target);t&&t(e)},Lm=e=>{e.forEach(Pm)};const Rm={some:0,all:1},Nm=em({...am,inView:{Feature:class extends su{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:a="some",once:s}=e,r={root:t?t.current:void 0,rootMargin:n,threshold:"number"==typeof a?a:Rm[a]};return function(e,t,n){const a=function({root:e,...t}){const n=e||document;Tm.has(n)||Tm.set(n,{});const a=Tm.get(n),s=JSON.stringify(t);return a[s]||(a[s]=new IntersectionObserver(Lm,{root:e,...t})),a[s]}(t);return jm.set(e,n),a.observe(e),()=>{jm.delete(e),a.unobserve(e)}}(this.node.current,r,e=>{const{isIntersecting:t}=e;if(this.isInView===t)return;if(this.isInView=t,s&&!t&&this.hasEnteredView)return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const{onViewportEnter:n,onViewportLeave:a}=this.node.getProps(),r=t?n:a;r&&r(e)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends su{mount(){const{current:e}=this.node;e&&(this.unmount=function(e,t,n={}){const[a,s,r]=Sc(e,n),o=e=>{const a=e.currentTarget;if(!_c(e))return;Rc.add(a);const r=t(a,e),o=(e,t)=>{window.removeEventListener("pointerup",i),window.removeEventListener("pointercancel",l),Rc.has(a)&&Rc.delete(a),_c(e)&&"function"==typeof r&&r(e,{success:t})},i=e=>{o(e,a===window||a===document||n.useGlobalTarget||jc(a,e.target))},l=e=>{o(e,!1)};window.addEventListener("pointerup",i,s),window.addEventListener("pointercancel",l,s)};return a.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener("pointerdown",o,s),Ac(e)&&(e.addEventListener("focus",e=>((e,t)=>{const n=e.currentTarget;if(!n)return;const a=Nc(()=>{if(Rc.has(n))return;zc(n,"down");const e=Nc(()=>{zc(n,"up")});n.addEventListener("keyup",e,t),n.addEventListener("blur",()=>zc(n,"cancel"),t)});n.addEventListener("keydown",a,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",a),t)})(e,s)),Lc(e)||e.hasAttribute("tabindex")||(e.tabIndex=0))}),r}(e,(e,t)=>(Mm(this.node,t,"Start"),(e,{success:t})=>Mm(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends su{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Hr(Bd(this.node.current,"focus",()=>this.onFocus()),Bd(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends su{mount(){const{current:e}=this.node;e&&(this.unmount=function(e,t,n={}){const[a,s,r]=Sc(e,n),o=e=>{if(!Mc(e))return;const{target:n}=e,a=t(n,e);if("function"!=typeof a||!n)return;const r=e=>{Mc(e)&&(a(e),n.removeEventListener("pointerleave",r))};n.addEventListener("pointerleave",r,s)};return a.forEach(e=>{e.addEventListener("pointerenter",o,s)}),r}(e,(e,t)=>(Sm(this.node,t,"Start"),e=>Sm(this.node,e,"End"))))}unmount(){}}},...Fm,layout:{ProjectionNode:dh,MeasureLayout:Bm}},tm),zm={duration:.15,ease:[.4,0,.2,1]},_m={type:"tween",duration:.25,ease:[.4,0,.2,1]},Im={type:"tween",duration:.3,ease:[.4,0,.2,1]},Vm=s.createContext(!1);function Om(){return s.useContext(Vm)}const $m=s.createContext(void 0);function qm(){return s.useContext($m)}const Um="#1A1A1A",Wm="#737373",Hm={xs:"sm:max-w-xs",sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl","2xl":"sm:max-w-2xl","3xl":"sm:max-w-3xl","4xl":"sm:max-w-4xl","5xl":"sm:max-w-5xl",full:"sm:max-w-[calc(100vw-2rem)]"};function Ym({open:e,onClose:t,size:n="md",className:a,children:o,bottomSheet:l=!0,motionPlus:d=!1,basemapMode:h,solid:m=!1}){const p="light"===h,[g,f]=s.useState(!1),y=s.useRef(null);s.useEffect(()=>(y.current&&(clearTimeout(y.current),y.current=null),e?y.current=setTimeout(()=>{f(!0)},350):queueMicrotask(()=>f(!1)),()=>{y.current&&(clearTimeout(y.current),y.current=null)}),[e]);const b=s.useCallback((e,n)=>{(n.offset.y>100||n.velocity.y>500)&&t()},[t]),v=d?Im:_m,w=d?.98:.99,C=l?8:4;return r.jsx(kh,{mode:"wait",children:e&&r.jsxs(c,{static:!0,open:e,onClose:t,className:"relative z-[10010]",children:[r.jsx(Nm.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:zm,className:"fixed inset-0 bg-black/50 backdrop-blur-sm","aria-hidden":"true"}),r.jsx("div",{className:"fixed inset-0 overflow-y-auto",children:r.jsx("div",{className:i("flex min-h-full justify-center",l?"items-end sm:items-center sm:p-4":"items-center p-4"),children:r.jsx(Nm.div,{drag:!!l&&"y",dragConstraints:{top:0,bottom:0},dragElastic:{top:0,bottom:.4},onDragEnd:b,initial:{opacity:0,scale:w,y:C},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.99,y:l?40:4},transition:v,style:{willChange:"transform, opacity"},className:i(l&&"w-full sm:w-auto"),children:r.jsx(u,{className:i("relative w-full shadow-2xl flex flex-col",!h&&!m&&"bg-surface/80 backdrop-blur-xl",!h&&m&&"bg-surface",!h&&"ring-1 ring-inset ring-edge-subtle",Hm[n],l?"radius-card overflow-hidden pb-safe":"radius-card overflow-hidden",a),style:h?{backgroundColor:p?"#F8F8F8":"var(--surface)",boxShadow:"inset 0 0 0 1px "+(p?"rgba(0, 0, 0, 0.08)":"rgba(255, 255, 255, 0.1)")}:void 0,children:r.jsx($m.Provider,{value:h,children:r.jsx(Vm.Provider,{value:g,children:o})})})})})})]})})}function Gm({className:e,...t}){const n=qm(),a="light"===n;return r.jsx(d,{...t,className:i("text-base font-semibold sm:text-lg",!n&&"text-fg-primary",e),style:n?{color:a?Um:"var(--fg-primary)"}:void 0})}function Km({icon:e,title:t,onClose:n,className:a}){const s=qm(),o="light"===s;return r.jsxs("div",{className:i("flex items-center justify-between px-4 sm:px-6 py-3 sm:py-4 border-b",!s&&"border-edge-subtle",a),style:s?{borderColor:o?"rgba(0, 0, 0, 0.12)":"var(--edge-subtle)"}:void 0,children:[r.jsxs("div",{className:"flex items-center gap-3",children:[e&&r.jsx("div",{className:i(!s&&"text-icon-card-title"),style:s?{color:o?"#4A4A4A":"var(--icon-card-title)"}:void 0,children:e}),r.jsx(Gm,{children:t})]}),n&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:n,className:"sm:hidden min-h-[44px] min-w-[44px] px-3 flex items-center justify-center text-[15px] font-medium text-sys-blue active:text-sys-blue/70 transition-base radius-inner active:bg-subtle-fill",children:"Done"}),r.jsx("button",{onClick:n,className:i("hidden sm:flex items-center justify-center p-2 radius-inner transition-colors",!s&&"text-fg-muted hover:text-fg-primary hover:bg-subtle"),style:s?{color:o?Wm:"var(--fg-muted)"}:void 0,onMouseEnter:e=>{s&&(e.currentTarget.style.color=o?Um:"var(--fg-primary)",e.currentTarget.style.backgroundColor=o?"rgba(0, 0, 0, 0.06)":"var(--subtle)")},onMouseLeave:e=>{s&&(e.currentTarget.style.color=o?Wm:"var(--fg-muted)",e.currentTarget.style.backgroundColor="transparent")},"aria-label":"Close",children:r.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}function Xm({className:e,...t}){return r.jsx("div",{...t,className:i("px-6 py-5",e)})}function Jm({className:e,...t}){return r.jsx("div",{...t,className:i("flex flex-col-reverse gap-3 px-6 pb-6 pt-0","sm:flex-row sm:justify-end","*:w-full sm:*:w-auto",e)})}const Zm={snappy:{type:"spring",stiffness:500,damping:30},smooth:{type:"spring",stiffness:300,damping:30},gentle:{type:"spring",stiffness:200,damping:25}},Qm={fast:.15,normal:.2,medium:.3},ep={easeOut:[0,0,.2,1],easeIn:[.4,0,1,1]},tp={dropdown:{type:"spring",stiffness:500,damping:30},fade:{duration:Qm.fast,ease:ep.easeOut},numberTicker:{type:"spring",visualDuration:.4,bounce:.15,opacity:{duration:.15,ease:"linear"}},numberReveal:{type:"spring",visualDuration:.6,bounce:.25,opacity:{duration:.2,ease:"linear"}}},np={normal:.05};function ap({className:e,...t}){return r.jsx("nav",{...t,className:i(e,"flex h-full min-h-0 flex-col")})}function sp({className:e,...t}){return r.jsx("div",{...t,className:i(e,"flex flex-col border-b border-edge-subtle p-4","[&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function rp({className:e,...t}){return r.jsx("div",{...t,className:i(e,"flex flex-1 flex-col p-3","overflow-y-auto sidebar-scroll","[&>[data-slot=section]+[data-slot=section]]:mt-6")})}function op({className:e,...t}){return r.jsx("div",{...t,className:i(e,"mt-auto flex flex-col border-t border-edge-subtle","[&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function ip({className:e,...t}){const n=s.useId();return r.jsx(Ah,{id:n,children:r.jsx("div",{...t,"data-slot":"section",className:i(e,"flex flex-col gap-0.5")})})}const lp=s.forwardRef(function(e,t){const{current:n,className:a,children:s,accentColor:o,...c}=e,u=!!o,d=i("relative flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left","min-h-[44px]","text-sm font-medium","[&>svg]:w-5 [&>svg]:h-5 [&>svg]:flex-shrink-0",n?u?"text-white":"text-white [&_svg]:text-sys-blue":"text-fg-muted hover:text-fg-primary hover:bg-subtle-fill [&_svg]:text-fg-muted hover:[&_svg]:text-fg-primary","transition-all duration-150"),h=u?{willChange:"transform",backgroundColor:o}:{willChange:"transform"},m=u?{willChange:"transform",backgroundColor:`color-mix(in srgb, ${o} 10%, transparent)`,boxShadow:`inset 0 0 0 1.5px ${o}`}:{willChange:"transform"};return r.jsxs("span",{className:i(a,"relative"),children:[n&&r.jsx(Nm.span,{layout:"position",layoutId:"sidebar-current-indicator",className:i("absolute inset-y-2 -left-3 w-0.5 rounded-full",!u&&"bg-sys-blue"),style:h,transition:Zm.snappy}),"string"==typeof c.href?r.jsxs(D,{to:c.href,onClick:c.onClick,onMouseEnter:c.onMouseEnter,onMouseLeave:c.onMouseLeave,className:d,"data-current":n?"true":void 0,ref:t,children:[n&&r.jsx(Nm.span,{layout:"position",layoutId:"sidebar-current-highlight",className:i("absolute inset-px radius-inner",!u&&"bg-sys-blue/10 ring-[1.5px] ring-sys-blue"),style:m,transition:Zm.snappy}),s]}):r.jsxs(l,{...c,className:i("cursor-default",d),"data-current":n?"true":void 0,ref:t,children:[n&&r.jsx(Nm.span,{layout:"position",layoutId:"sidebar-current-highlight",className:i("absolute inset-px radius-inner",!u&&"bg-sys-blue/10 ring-[1.5px] ring-sys-blue"),style:m,transition:Zm.snappy}),s]})]})});function cp({className:e,...t}){return r.jsx("span",{...t,className:i(e,"truncate")})}function up({className:e,variant:t="default",...n}){return r.jsx("span",{...n,className:i("ml-auto flex items-center gap-1 px-1.5 py-0.5 rounded-full","text-xs font-medium",{default:"bg-subtle text-fg-muted",accent:"bg-sys-blue/20 text-sys-blue",success:"bg-sys-green/20 text-sys-green",warning:"bg-sys-indigo/20 text-sys-indigo",danger:"bg-sys-red/20 text-sys-red"}[t],e)})}const dp=s.createContext(null),hp={type:"spring",visualDuration:.35,bounce:.15};function mp({open:e,onClose:t,children:n}){return r.jsx(kh,{children:e&&r.jsxs(c,{static:!0,open:e,onClose:t,className:"lg:hidden relative z-[10002]",children:[r.jsx(Nm.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25,ease:"easeOut"},className:"fixed inset-0 bg-black/60 backdrop-blur-sm","aria-hidden":"true"}),r.jsx(Nm.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:hp,className:"fixed inset-y-0 left-0 w-72 max-w-[85vw] z-[10003]",children:r.jsx(u,{className:"h-full",children:r.jsxs("div",{className:"flex h-full flex-col sidebar-panel",children:[r.jsx("div",{className:"absolute top-4 right-4 z-10",children:r.jsx(h,{className:"p-2 rounded-lg text-fg-muted hover:text-fg-primary hover:bg-subtle-fill transition-colors","aria-label":"Close navigation",children:r.jsx(Mr,{className:"w-5 h-5"})})}),n]})})})]})})}function pp({sidebar:e,navbar:t,children:n,className:a}){const[o,l]=s.useState(!1),c=()=>l(!0),u=()=>l(!1),d={isOpen:o,open:c,close:u,toggle:()=>l(e=>!e)};return r.jsx(dp.Provider,{value:d,children:r.jsxs("div",{className:"flex h-screen overflow-hidden bg-body",children:[r.jsx("aside",{className:"hidden lg:flex flex-col w-64 flex-shrink-0 h-full relative sidebar-panel",children:e}),r.jsx(mp,{open:o,onClose:u,children:e}),r.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[r.jsx("header",{className:"lg:hidden sticky top-0 z-[10001] h-14 mobile-header",children:r.jsxs("div",{className:"flex items-center h-full px-4",children:[r.jsx("button",{onClick:c,className:"w-10 h-10 flex items-center justify-center rounded-lg hover:bg-subtle-fill active:bg-subtle-fill transition-colors mr-2","aria-label":"Open navigation",children:r.jsx(br,{className:"w-5 h-5 text-fg-primary"})}),r.jsx("div",{className:"flex-1 min-w-0",children:t})]})}),r.jsx("main",{className:i("flex-1 overflow-y-auto main-content",a),children:n})]})]})})}function gp({className:e,...t}){return r.jsx("nav",{...t,className:i(e,"flex flex-1 items-center gap-3")})}function fp({className:e,...t}){return r.jsx("div",{...t,className:i(e,"flex items-center gap-3")})}function yp({className:e,...t}){return r.jsx("div",{"aria-hidden":"true",...t,className:i(e,"flex-1")})}const bp="bg-surface/80 backdrop-blur-lg ring-1 ring-inset ring-edge-subtle",vp={sm:"radius-inner",md:"radius-inset",lg:"radius-card",xl:"radius-hero",full:"radius-pill",none:"radius-none"},wp=s.forwardRef(function({children:e,elevated:t,compact:n,noPadding:a,radius:s="lg",glass:o=!0,stroke:l=!0,shadow:c,reflex:u=!1,glow:d=!1,neomorphic:h=!1,onClick:m,className:p,style:g,...f},y){const b=c??t??!1,v=!h&&l,w={...g,...u?{"--surface-reflex":"1"}:{}};return r.jsx("div",{ref:y,"data-card-surface":!0,className:i(vp[s],o&&(t?"bg-surface/85 backdrop-blur-xl":"bg-surface/80 backdrop-blur-lg"),!o&&"bg-surface",h&&"neomorphic-outer",v&&!d&&"ring-1 ring-inset ring-edge-subtle",d&&"ring-1 ring-inset ring-sys-blue/40",b&&(t?"shadow-xl":"shadow-lg"),u&&"surface-reflex","h-full flex flex-col relative",!a&&(n?"p-3 sm:p-4":"p-4 sm:p-5"),m&&"cursor-pointer",p),style:w,onClick:m,...f,children:e})});function Cp({defaultOpen:e=!1,className:t,children:n}){return r.jsx(p,{defaultOpen:e,children:r.jsx("div",{className:i("flex flex-col",t),children:n})})}s.forwardRef(function({children:e,className:t,...n},a){return r.jsx("div",{ref:a,className:i("flex items-center justify-between gap-4","pb-4 mb-4","border-b border-edge-subtle",t),...n,children:e})}),s.forwardRef(function({children:e,icon:t,className:n,...a},s){return r.jsxs("h3",{ref:s,className:i("flex items-center gap-2","text-base font-semibold text-fg-primary",n),...a,children:[t&&r.jsx("span",{className:"text-icon-card-title w-5 h-5 flex-shrink-0",children:t}),e]})}),s.forwardRef(function({children:e,className:t,...n},a){return r.jsx("p",{ref:a,className:i("text-sm text-fg-muted",t),...n,children:e})}),s.forwardRef(function({children:e,className:t,...n},a){return r.jsx("div",{ref:a,className:i("flex-1 min-h-0",t),...n,children:e})}),s.forwardRef(function({children:e,className:t,...n},a){return r.jsx("div",{ref:a,className:i("flex items-center justify-end gap-3","pt-4 mt-4","border-t border-edge-subtle",t),...n,children:e})}),s.forwardRef(function({children:e,border:t,className:n,...a},s){return r.jsx("div",{ref:s,className:i(t&&"pt-4 mt-4 border-t border-edge-subtle",n),...a,children:e})});const kp=s.forwardRef(function({className:e,icon:t,children:n,...a},s){return r.jsx(m,{ref:s,className:i("flex w-full items-center justify-between gap-3","px-3 py-2 radius-inner","text-sm font-medium text-fg-muted","row-hover hover:text-fg-primary","ring-focus",e),...a,children:({open:e})=>r.jsxs(r.Fragment,{children:[n,r.jsx("span",{className:i("transition-transform duration-200",e?"rotate-180":"rotate-0"),children:t||r.jsx(or,{className:"w-4 h-4"})})]})})});function xp({direction:e="down",className:t,children:n}){const a={hidden:{height:0,opacity:0,y:"up"===e?8:-8},visible:{height:"auto",opacity:1,y:0}};return r.jsx(g,{static:!0,children:({open:s})=>r.jsx(kh,{initial:!1,children:s&&r.jsx(Nm.div,{initial:"hidden",animate:"visible",exit:"hidden",variants:a,transition:{height:{duration:.2,ease:[.4,0,.2,1]},opacity:{duration:.15},y:{duration:.15}},className:i("overflow-hidden",t),children:r.jsx("div",{className:i("up"===e?"pb-2":"pt-2"),children:n})})})})}function Dp({label:e,icon:t,defaultOpen:n=!0,direction:a="down",className:s,dataId:o,children:l}){const c=o?{[`data-${o}-disclosure`]:!0}:{},u=r.jsxs("span",{className:"flex items-center gap-3",children:[t&&r.jsx("span",{className:"icon-md flex items-center justify-center text-icon-card-title",children:t}),r.jsx("span",{className:"type-micro",children:e})]});return"up"===a?r.jsx(p,{defaultOpen:n,children:({open:n})=>r.jsxs("div",{className:i("relative",s),children:[r.jsx(g,{static:!0,className:"relative z-50",children:r.jsx(kh,{initial:!1,mode:"wait",children:n&&r.jsxs(Nm.div,{initial:{y:12,scale:.96,opacity:0},animate:{y:0,scale:1,opacity:1},exit:{y:6,scale:.98,opacity:0},transition:{type:"spring",stiffness:400,damping:30,mass:.5,opacity:{duration:.15,ease:"easeOut"}},className:"absolute bottom-full left-0 right-0 z-50 mb-1 mx-1 origin-bottom radius-inset shadow-lg border-card bg-surface/80 backdrop-blur-xl",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[r.jsxs("span",{className:"flex items-center gap-3",children:[t&&r.jsx("span",{className:"icon-md flex items-center justify-center text-icon-card-title",children:t}),r.jsx("span",{className:"type-micro",children:e})]}),r.jsx(m,{className:"p-1 rounded hover:bg-subtle-fill-strong transition-colors",children:r.jsx(Nm.span,{initial:{rotate:0},animate:{rotate:180},exit:{rotate:0},transition:{type:"spring",stiffness:400,damping:25},children:r.jsx(or,{className:"w-4 h-4"})})})]}),r.jsx("div",{className:"px-3 pb-3",children:l})]})})}),r.jsx(Nm.div,{animate:{opacity:n?.4:1,scale:n?.98:1},transition:{type:"spring",stiffness:500,damping:35},children:r.jsxs(m,{...c,className:i("flex w-full items-center justify-between gap-3","px-3 py-2 radius-inner","text-sm font-medium text-fg-muted","row-hover hover:text-fg-primary","ring-focus"),children:[u,r.jsx(Nm.span,{animate:{rotate:n?180:0},transition:{type:"spring",stiffness:400,damping:25},children:r.jsx(or,{className:"w-4 h-4"})})]})})]})}):r.jsxs(Cp,{defaultOpen:n,className:s,children:[r.jsx(kp,{...c,children:u}),r.jsx(xp,{direction:"down",children:r.jsx("div",{className:"bg-subtle-fill radius-inset mx-1 mt-1",children:l})})]})}function Ap({placement:e}){const t=i("absolute w-2 h-2 bg-elevated rotate-45","top"===e&&"bottom-[-4px] left-1/2 -translate-x-1/2","bottom"===e&&"top-[-4px] left-1/2 -translate-x-1/2","left"===e&&"right-[-4px] top-1/2 -translate-y-1/2","right"===e&&"left-[-4px] top-1/2 -translate-y-1/2");return r.jsx("span",{className:t})}function Ep({content:e,children:t,placement:n="top",delay:a=200,arrow:o=!0,disabled:l=!1,className:c}){const[u,d]=s.useState(!1),[h,m]=s.useState({top:0,left:0}),[p,g]=s.useState(!1),y=s.useRef(null),b=s.useRef(null),v=s.useRef();s.useEffect(()=>{g(!0)},[]),s.useEffect(()=>{if(!u||!y.current||!b.current)return;const e=y.current.getBoundingClientRect(),t=b.current.getBoundingClientRect(),a=function(e,t,n){const a=window.scrollY,s=window.scrollX;switch(n){case"top":return{top:e.top+a-t.height-8,left:e.left+s+(e.width-t.width)/2};case"bottom":return{top:e.bottom+a+8,left:e.left+s+(e.width-t.width)/2};case"left":return{top:e.top+a+(e.height-t.height)/2,left:e.left+s-t.width-8};case"right":return{top:e.top+a+(e.height-t.height)/2,left:e.right+s+8}}}(e,t,n),s=window.innerWidth-t.width-8,r=window.innerHeight+window.scrollY-t.height-8;m({top:Math.max(8,Math.min(a.top,r)),left:Math.max(8,Math.min(a.left,s))})},[u,n]);const w=s.useCallback(()=>{l||(v.current=setTimeout(()=>{d(!0)},a))},[a,l]),C=s.useCallback(()=>{v.current&&clearTimeout(v.current),d(!1)},[]);if(s.useEffect(()=>()=>{v.current&&clearTimeout(v.current)},[]),!s.isValidElement(t))return t;const k=s.cloneElement(t,{ref:y,onMouseEnter:e=>{var n,a;w(),null==(a=(n=t.props).onMouseEnter)||a.call(n,e)},onMouseLeave:e=>{var n,a;C(),null==(a=(n=t.props).onMouseLeave)||a.call(n,e)},onFocus:e=>{var n,a;w(),null==(a=(n=t.props).onFocus)||a.call(n,e)},onBlur:e=>{var n,a;C(),null==(a=(n=t.props).onBlur)||a.call(n,e)}}),x=(e=>({hidden:{opacity:0,scale:.96,...{top:{y:4},bottom:{y:-4},left:{x:4},right:{x:-4}}[e]},visible:{opacity:1,scale:1,x:0,y:0}}))(n),D=r.jsx(kh,{children:u&&r.jsxs(Nm.div,{ref:b,initial:"hidden",animate:"visible",exit:"hidden",variants:x,transition:{duration:.15,ease:"easeOut"},className:i("fixed z-[10020] px-2.5 py-1.5 text-xs font-medium","bg-elevated text-fg-primary","rounded-lg shadow-lg","ring-1 ring-inset ring-edge-subtle","pointer-events-none",c),style:{top:h.top,left:h.left},role:"tooltip",children:[e,o&&r.jsx(Ap,{placement:n})]})});return r.jsxs(r.Fragment,{children:[k,p&&f.createPortal(D,document.body)]})}const Bp={sm:{track:"h-5 w-9",thumb:"h-3.5 w-3.5",translate:"translate-x-[18px]",icon:"w-3 h-3",dot:"w-2 h-2"},md:{track:"h-6 w-11",thumb:"h-4 w-4",translate:"translate-x-[22px]",icon:"w-4 h-4",dot:"w-2.5 h-2.5"},lg:{track:"h-7 w-14",thumb:"h-5 w-5",translate:"translate-x-[30px]",icon:"w-4 h-4",dot:"w-3 h-3"}},Fp=s.forwardRef(function({enabled:e,onChange:t,label:n,description:a,tooltip:s,size:o="md",color:l="muted",dangerOff:c=!1,disabled:u=!1,status:d="idle",name:h,className:m},p){const g=Bp[o],f="loading"===d,C="muted"===l;return r.jsxs(y,{disabled:u||f,className:i("flex items-center gap-3",m),children:[r.jsx(b,{ref:p,checked:e,onChange:t,name:h,className:i(C?"toggle-switch-track":"group relative inline-flex shrink-0 items-center rounded-full border-2",g.track,!C&&(e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-edge-subtle"),"disabled:opacity-50 disabled:cursor-not-allowed","ring-focus","transition-all duration-200"),"data-size":o,children:r.jsx("span",{className:i(C?"toggle-switch-thumb":"relative inline-flex items-center justify-center bg-white shadow-lg","transform rounded-full transition-transform duration-200",g.thumb,e?g.translate:"translate-x-[4px]"),children:C&&r.jsx("span",{className:i("toggle-switch-dot",g.dot,c?i("opacity-100",!e&&"toggle-switch-dot-danger"):e?"opacity-100":"opacity-0")})})}),(n||a||s)&&r.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[n&&r.jsx(v,{className:i("text-sm font-medium cursor-pointer select-none",u?"text-fg-muted":"text-fg-primary"),children:n}),s&&r.jsx(Ep,{content:s,placement:"top",children:r.jsx("span",{className:"text-fg-muted hover:text-fg-secondary cursor-help transition-colors",children:r.jsx(hr,{className:"w-3.5 h-3.5"})})}),a&&!s&&r.jsx(w,{className:"text-xs text-fg-muted",children:a})]}),"idle"!==d&&r.jsxs("div",{className:"flex items-center shrink-0",children:["loading"===d&&r.jsx(gr,{className:i(g.icon,"text-fg-muted animate-spin")}),"success"===d&&r.jsx(rr,{className:i(g.icon,"text-sys-green")}),"error"===d&&r.jsx(Mr,{className:i(g.icon,"text-sys-red")})]})]})}),Sp=s.forwardRef(function({enabled:e,onChange:t,size:n="md",disabled:a=!1,"aria-label":s,className:o},l){const c=Bp[n];return r.jsx(b,{ref:l,checked:e,onChange:t,disabled:a,"aria-label":s,className:i("toggle-switch-track",c.track,"disabled:opacity-50 disabled:cursor-not-allowed","ring-focus","transition-all duration-200",o),"data-size":n,children:r.jsx("span",{className:i("toggle-switch-thumb","transform rounded-full transition-transform duration-200",c.thumb,e?c.translate:"translate-x-[4px]"),children:r.jsx("span",{className:i("toggle-switch-dot",c.dot,e?"opacity-100":"opacity-0")})})})}),Mp={sm:{input:"h-8 text-sm px-3",icon:"w-4 h-4",iconPadding:"pl-8",trailingIconPadding:"pr-8"},md:{input:"h-[38px] text-sm px-4",icon:"w-4 h-4",iconPadding:"pl-10",trailingIconPadding:"pr-10"},lg:{input:"h-11 text-base px-4",icon:"w-5 h-5",iconPadding:"pl-11",trailingIconPadding:"pr-11"}},jp=s.forwardRef(function({type:e="text",size:t="md",invalid:n=!1,leadingIcon:a,trailingIcon:s,leadingAddon:o,trailingAddon:l,className:c,disabled:u,...d},h){const m=Mp[t],p=a||o,g=s||l;return o||l?r.jsxs("div",{className:i("flex",c),children:[o&&r.jsx("span",{className:i("inline-flex items-center px-3 rounded-l-lg border border-r-0","bg-input-bg text-fg-muted text-sm",n?"border-sys-red":"border-input-border"),children:o}),r.jsx("input",{ref:h,type:e,disabled:u,className:i("flex-1 min-w-0 font-mono",m.input,"bg-input-bg",n?"border border-sys-red":"border border-input-border","text-fg-primary placeholder:text-fg-muted",n?"ring-focus-error":"ring-focus-inset",!u&&"hover:border-edge-strong","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors",o&&!l&&"rounded-r-lg",l&&!o&&"rounded-l-lg",!o&&!l&&"radius-inner"),...d}),l&&r.jsx("span",{className:i("inline-flex items-center px-3 rounded-r-lg border border-l-0","bg-input-bg text-fg-muted text-sm",n?"border-sys-red":"border-input-border"),children:l})]}):r.jsxs("div",{className:i("relative",c),children:[a&&r.jsx("div",{className:i("absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none","text-fg-muted"),children:r.jsx("span",{className:m.icon,children:a})}),r.jsx("input",{ref:h,type:e,disabled:u,className:i("w-full radius-inner font-mono",m.input,p&&m.iconPadding,g&&m.trailingIconPadding,"bg-input-bg",n?"border border-sys-red":"border border-input-border","text-fg-primary placeholder:text-fg-muted",n?"ring-focus-error":"ring-focus-inset",!u&&"hover:border-edge-strong","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors"),...d}),s&&r.jsx("div",{className:i("absolute inset-y-0 right-0 flex items-center pr-3","text-fg-muted"),children:r.jsx("span",{className:m.icon,children:s})})]})}),Tp=s.forwardRef(function({label:e,description:t,errorMessage:n,required:a,invalid:s,className:o,...l},c){const u=s&&n;return r.jsxs(y,{className:i("flex flex-col gap-1.5",o),children:[e&&r.jsxs(v,{className:"text-sm font-medium text-fg-primary",children:[e,a&&r.jsx("span",{className:"text-sys-red ml-0.5",children:"*"})]}),t&&!u&&r.jsx(w,{className:"text-xs text-fg-muted -mt-0.5",children:t}),r.jsx(jp,{ref:c,invalid:s,...l}),u&&r.jsx("p",{className:"text-xs text-sys-red",children:n})]})});s.forwardRef(function({value:e,onChange:t,min:n,max:a,step:s=1,precision:o,...i},l){const c=void 0!==o&&"number"==typeof e?e.toFixed(o):e;return r.jsx(jp,{ref:l,type:"number",value:c,onChange:e=>{const s=e.target.value;if(""===s||"-"===s)return void t(0);const r=parseFloat(s);if(!isNaN(r)){const e=void 0!==n&&void 0!==a?Math.min(Math.max(r,n),a):void 0!==n?Math.max(r,n):void 0!==a?Math.min(r,a):r;t(e)}},min:n,max:a,step:s,...i})});const Pp={none:"resize-none",vertical:"resize-y",horizontal:"resize-x",both:"resize"},Lp=s.forwardRef(function({rows:e=3,resize:t="vertical",invalid:n=!1,disabled:a,className:s,...o},l){return r.jsx("textarea",{ref:l,rows:e,disabled:a,className:i("w-full radius-inner px-4 py-3 text-sm",Pp[t],"bg-subtle",n?"border border-sys-red":"border-control","text-fg-primary placeholder:text-fg-muted",n?"ring-focus-error":"ring-focus-inset",!a&&"hover:border-edge-strong","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors",s),...o})});s.forwardRef(function({label:e,description:t,errorMessage:n,required:a,invalid:s,showCount:o,maxLength:l,value:c,className:u,...d},h){const m=s&&n,p="string"==typeof c?c.length:0;return r.jsxs(y,{className:i("flex flex-col gap-1.5",u),children:[e&&r.jsxs(v,{className:"text-sm font-medium text-fg-primary",children:[e,a&&r.jsx("span",{className:"text-sys-red ml-0.5",children:"*"})]}),t&&!m&&r.jsx(w,{className:"text-xs text-fg-muted -mt-0.5",children:t}),r.jsx(Lp,{ref:h,invalid:s,maxLength:l,value:c,...d}),r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[m?r.jsx("p",{className:"text-xs text-sys-red flex-1",children:n}):r.jsx("span",{}),o&&l&&r.jsxs("span",{className:i("text-xs",p>l?"text-sys-red":"text-fg-muted"),children:[p,"/",l]})]})]})});const Rp={sm:{box:"h-4 w-4",icon:"h-3 w-3",radius:"rounded"},md:{box:"h-5 w-5",icon:"h-3.5 w-3.5",radius:"rounded-md"},lg:{box:"h-6 w-6",icon:"h-4 w-4",radius:"rounded-md"}},Np=s.forwardRef(function({checked:e,onChange:t,indeterminate:n=!1,label:a,description:s,size:o="md",disabled:l=!1,name:c,value:u,className:d},h){const m=Rp[o];return r.jsxs(y,{disabled:l,className:i("flex items-start gap-3",d),children:[r.jsxs(C,{ref:h,checked:e,onChange:t,name:c,value:u,className:i("group relative flex shrink-0 items-center justify-center",m.box,m.radius,"border-2 transition-all duration-150",!e&&!n&&"border-edge-subtle bg-subtle",(e||n)&&"border-sys-blue bg-sys-blue",!e&&!n&&!l&&"hover:border-edge-strong","ring-focus","disabled:opacity-50 disabled:cursor-not-allowed"),children:[e&&!n&&r.jsx(rr,{className:i(m.icon,"text-white stroke-[3]")}),n&&r.jsx(wr,{className:i(m.icon,"text-white stroke-[3]")})]}),(a||s)&&r.jsxs("div",{className:"flex-1 min-w-0 select-none",children:[a&&r.jsx(v,{className:i("text-sm font-medium cursor-pointer",l?"text-fg-muted":"text-fg-primary"),children:a}),s&&r.jsx(w,{className:"text-xs text-fg-muted mt-0.5",children:s})]})]})});s.createContext({variant:"default",divider:"subtle",grid:!0});const zp="0.9.262",_p="'JetBrains Mono', monospace",Ip=s.memo(function({height:e=16,responsive:t=!1,className:n=""}){const a="var(--sys-blue)",s="var(--fg-primary)";if(t){const e=145,t=24;return r.jsxs("svg",{className:n,viewBox:`0 0 ${e} ${t}`,preserveAspectRatio:"xMidYMid meet",role:"img","aria-label":"pyMC:Console",style:{display:"block",width:"80%",height:"auto"},children:[r.jsx("style",{children:`\n .logo-text {\n font-family: ${_p};\n }\n .logo-accent {\n fill: var(--sys-blue, #719CDF);\n }\n .logo-main {\n fill: var(--fg-primary, #FFFFFF);\n }\n `}),r.jsxs("text",{x:"0",y:"18",className:"logo-text",fontSize:"20",fontWeight:"400",letterSpacing:"-0.02em",children:[r.jsx("tspan",{className:"logo-accent",children:"py"}),r.jsx("tspan",{className:"logo-main",children:"MC"}),r.jsx("tspan",{className:"logo-accent",children:":"}),r.jsx("tspan",{className:"logo-main",children:"Console"})]})]})}const o="string"==typeof e?parseFloat(e):e,i={fontFamily:_p,fontSize:.8*o+"px",fontWeight:400,lineHeight:1,letterSpacing:"-0.02em",whiteSpace:"nowrap"};return r.jsxs("span",{className:n,style:i,role:"img","aria-label":"pyMC:Console",children:[r.jsx("span",{style:{color:a},children:"py"}),r.jsx("span",{style:{color:s},children:"MC"}),r.jsx("span",{style:{color:a},children:":"}),r.jsx("span",{style:{color:s},children:"Console"})]})}),Vp="pymc_jwt_token",Op="pymc_client_id",$p="pymc_remember_me",qp=new Set;function Up(e){for(const n of qp)try{n(e)}catch(t){}}function Wp(){let e=localStorage.getItem(Op);return e||(e=`${Date.now()}-${Math.random().toString(36).substring(2,15)}`,localStorage.setItem(Op,e)),e}function Hp(){return"true"===localStorage.getItem($p)}function Yp(e){e?localStorage.setItem($p,"true"):localStorage.removeItem($p)}function Gp(){return Hp()?localStorage:sessionStorage}function Kp(){return Gp().getItem(Vp)||localStorage.getItem(Vp)||sessionStorage.getItem(Vp)}function Xp(e){Gp().setItem(Vp,e),Hp()?sessionStorage.removeItem(Vp):localStorage.removeItem(Vp),Up(e)}function Jp(){localStorage.removeItem(Vp),sessionStorage.removeItem(Vp),Up(null)}function Zp(){return!(!Kp()||eg()&&(Jp(),1))}function Qp(e){try{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(atob(t).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(n)}catch{return null}}function eg(){const e=Kp();if(!e)return!0;const t=Qp(e);return!t||!t.exp||Date.now()>=1e3*t.exp-6e4}function tg(){const e=Kp();if(!e)return 0;const t=Qp(e);return t&&t.exp?Math.max(0,Math.floor((1e3*t.exp-Date.now())/1e3)):0}function ng(){const e=Kp();if(!e)return!1;const t=Qp(e);if(!t||!t.exp)return!1;const n=1e3*t.exp-Date.now();return n>0&&n<3e5}function ag(){const e=Kp();if(!e)return null;const t=Qp(e);return t&&t.sub?t.sub:null}async function sg(e,t,n=!1){Yp(n);try{const n=await fetch("/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t,client_id:Wp()})}),a=n.headers.get("content-type");if(!a||!a.includes("application/json"))return{success:!1,error:`Server error: ${n.status}`};const s=await n.json();return s.success&&s.token?(Xp(s.token),{success:!0}):{success:!1,error:s.error||"Login failed"}}catch(a){return{success:!1,error:"Connection error. Please try again."}}}async function rg(){const e=Kp();if(!e)return!1;const t=Qp(e);(null==t?void 0:t.exp)&&Math.floor((1e3*t.exp-Date.now())/1e3);try{const t=await fetch("/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({client_id:Wp()})});if(!t.ok){let e="";try{const n=await t.json();e=n.error||JSON.stringify(n)}catch{e=t.statusText}return!1}const n=await t.json();if(n.success&&n.token){Xp(n.token);const e=Qp(n.token);return(null==e?void 0:e.exp)&&Math.floor((1e3*e.exp-Date.now())/1e3),!0}return!1}catch(n){return!1}}let og=null;async function ig(){const e=Kp();if(!e)return!1;const t=Qp(e);return(null==t?void 0:t.exp)&&Math.floor((1e3*t.exp-Date.now())/1e3),!ng()||og||(og=rg().finally(()=>{og=null}),og)}let lg=!1;const cg="",ug=new Map;let dg=!1;async function hg(e,t,n=!1){const a=function(e,t){return(null==t?void 0:t.method)&&"GET"!==t.method?"":e}(e,t);if(a){const e=ug.get(a);if(e)return e}const s=`${e}`;!n&&ng()&&await rg();const r=Kp();if(!r&&!e.includes("/auth/"))throw window.location.href="/login",new Error("Not authenticated");const o={Accept:"application/json",...r?{Authorization:`Bearer ${r}`}:{}};if(null==t?void 0:t.headers){const e=t.headers;e instanceof Headers?e.forEach((e,t)=>{o[t]=e}):Array.isArray(e)?e.forEach(([e,t])=>{o[e]=t}):Object.assign(o,e)}(null==t?void 0:t.body)&&(o["Content-Type"]="application/json");const i=(async()=>{const a=await fetch(s,{...t,headers:o});if(401===a.status){if(!n&&!dg&&await rg())return hg(e,t,!0);throw dg||(dg=!0,Jp(),window.location.replace("/login")),new Error("Session expired. Please log in again.")}if(!a.ok)throw new Error(`API error: ${a.status} ${a.statusText} (${e})`);return a.json()})();return a&&(ug.set(a,i),i.finally(()=>{ug.delete(a)})),i}const mg={spreadingFactor:7,bandwidthHz:125e3,codingRate:5,preambleLength:8,crcEnabled:!0,explicitHeader:!0};function pg(e){if(e.raw_packet){const t=e.raw_packet;if(/^[0-9a-fA-F]+$/.test(t)&&t.length%2==0)return t.length/2;if(/^[A-Za-z0-9+/=]+$/.test(t)){const e=(t.match(/=+$/)||[""])[0].length;return Math.floor(3*t.length/4)-e}return t.length}if(e.length&&e.length>0)return e.length;if(e.payload_length&&e.payload_length>0)return e.payload_length;if(e.payload){const t=e.payload;return/^[0-9a-fA-F]+$/.test(t)&&t.length%2==0?t.length/2:t.length}return 32}function gg(e,t={}){return void 0!==e.airtime_ms&&e.airtime_ms>0?e.airtime_ms:function(e,t={}){const n=t.spreadingFactor??mg.spreadingFactor,a=t.bandwidthHz??mg.bandwidthHz,s=t.codingRate??mg.codingRate,r=t.preambleLength??mg.preambleLength??8,o=t.crcEnabled??mg.crcEnabled?1:0,i=t.explicitHeader??mg.explicitHeader?0:1,l=n>=11&&a<=125e3?1:0,c=a/1e3,u=Math.pow(2,n)/c,d=(r+4.25)*u,h=Math.max(8*e-4*n+28+16*o-20*i,0),m=4*(n-2*l);return d+(8+Math.ceil(h/m)*s)*u}(pg(e),t)}function fg(e){return e&&"chat node"===e.toLowerCase()?"Companion":e}async function yg(){return function(e){if(e.neighbors)for(const t of Object.values(e.neighbors))t.contact_type=fg(t.contact_type);return e}(await hg("/api/stats"))}async function bg(){return hg("/api/logs")}async function vg(e=24){return hg(`/api/noise_floor_history?hours=${e}`)}const wg=new Map;function Cg(e=!1){if(e)wg.clear();else for(const[t]of wg)parseInt(t.split("-")[0],10)<=60&&wg.delete(t)}function kg(e,t,n,a){const s=60*e/t,r=Math.floor(Date.now()/1e3),o=Math.floor(r/s)*s,i=o-60*e,l=n.filter(e=>e.timestamp>=i&&e.timestamp<=o),c=a?function(e){var t;const n=null==(t=null==e?void 0:e.config)?void 0:t.radio;return{spreadingFactor:(null==n?void 0:n.spreading_factor)??mg.spreadingFactor,bandwidthHz:(null==n?void 0:n.bandwidth)??mg.bandwidthHz,codingRate:(null==n?void 0:n.coding_rate)??mg.codingRate,preambleLength:(null==n?void 0:n.preamble_length)??mg.preambleLength,crcEnabled:!0,explicitHeader:!0}}(a):mg,u=function(e,t,n,a,s){const r=new Array(t),o=new Array(t),i=new Array(t),l=new Array(t),c=new Array(t),u=new Array(t),d=new Array(t);for(let m=0;m=t)continue;const g=gg(h,s),f=h.packet_origin;if("tx_local"===f?(i[p].count++,i[p].airtime_ms+=g):"tx_forward"===f||h.transmitted?(l[p].count++,l[p].airtime_ms+=g):h.drop_reason&&(c[p].count++,c[p].airtime_ms+=g),"tx_local"!==f){r[p].count++,r[p].airtime_ms+=g,u[p].snr+=h.snr||0,u[p].rssi+=h.rssi||0,u[p].count++;const e=h.packet_hash;e&&!d[p].has(e)&&(d[p].add(e),o[p].count++,o[p].airtime_ms+=g)}}for(let m=0;m0&&(r[m].avg_snr=u[m].snr/u[m].count,r[m].avg_rssi=u[m].rssi/u[m].count);return{received:r,unique_received:o,transmitted:i,forwarded:l,dropped:c}}(l,t,i,s,c);return{time_range_minutes:e,bucket_count:t,bucket_duration_seconds:s,start_time:i,end_time:o,...u}}async function xg(e=24){return hg(`/api/crc_count?hours=${e}`)}let Dg=1;async function Ag(){var e,t;const n=await hg("/api/hardware_stats");return n.success&&(null==(t=null==(e=n.data)?void 0:e.cpu)?void 0:t.count)&&(Dg=n.data.cpu.count),n}async function Eg(){var e;const t=await hg("/api/hardware_processes");if(t.success&&(null==(e=t.data)?void 0:e.processes)&&Dg>1)for(const n of t.data.processes)n.cpu_percent=n.cpu_percent/Dg;return t}async function Bg(e){const t={...e};return null!=e.frequency_mhz&&(t.frequency=Math.round(1e6*e.frequency_mhz),delete t.frequency_mhz),null!=e.bandwidth_khz&&(t.bandwidth=Math.round(1e3*e.bandwidth_khz),delete t.bandwidth_khz),hg("/api/update_radio_config",{method:"POST",body:JSON.stringify(t)})}async function Fg(){return hg("/api/send_advert",{method:"POST",body:"{}"})}async function Sg(e){return hg("/api/set_mode",{method:"POST",body:JSON.stringify({mode:e})})}async function Mg(e){return hg("/api/set_duty_cycle",{method:"POST",body:JSON.stringify({enabled:e})})}async function jg(e){try{return await hg("/api/log_level",{method:"POST",body:JSON.stringify({level:e})})}catch(t){return{success:!1,error:t instanceof Error?t.message:"Unknown error"}}}async function Tg(){return hg("/api/identities")}async function Pg(e){const t=(new URLSearchParams).toString();return hg("/api/room_stats"+(t?"?"+t:""))}async function Lg(e,t,n,a,s=!1){const r=`/api/bulk_packets?${new URLSearchParams({limit:String(n),start_timestamp:String(e),end_timestamp:String(t)})}`,o={Accept:"application/json"},i=Kp();i&&(o.Authorization=`Bearer ${i}`);const l=new AbortController,c=setTimeout(()=>l.abort(),6e4);try{const i=await fetch(r,{headers:o,signal:l.signal});if(401===i.status&&!s&&await rg())return Lg(e,t,n,a,!0);if(!i.ok)throw new Error(`API ${i.status}`);const c=await i.json();return c.success&&c.data?c.data:[]}finally{clearTimeout(c)}}async function Rg(e,t,n,a,s){try{const r=await async function(e,t,n,a,s){const r=[];for(let l=s??Math.floor(Date.now()/1e3);l>e;l-=21600)r.push({start:Math.max(e,l-21600),end:l});let o=0,i=0;null==t||t({loaded:0,phase:"fetching",chunk:0});for(let l=0;l0&&await new Promise(e=>setTimeout(e,100));const e=r.slice(l,l+2);i++;const s=await Promise.all(e.map(e=>Ng(e.start,e.end,a,n)));for(const t of s)o+=t;null==t||t({loaded:o,phase:"fetching",chunk:i})}return null==t||t({loaded:o,phase:"complete",chunk:i}),o}(e,t,n,a,s);if(r>0)return r}catch{}return async function(e,t,n,a,s){let r=0,o=0,i=s??Math.floor(Date.now()/1e3);for(null==t||t({loaded:0,phase:"fetching",chunk:0});i>e&&o<100;){o++;try{const s=await Lg(e,i,1e4,a);if(0===s.length)break;r+=s.length;let l=i;for(let e=0;e=i)break;if(i=c,null==n||n(s),null==t||t({loaded:r,phase:"fetching",chunk:o}),s.length<1e4)break}catch(l){if(l instanceof Error&&"AbortError"===l.name)break;break}}return null==t||t({loaded:r,phase:"complete",chunk:o}),r}(e,t,n,a,s)}async function Ng(e,t,n,a){let s=t,r=0,o=0;for(;s>e&&o<100;){o++;const t=await Lg(e,s,2500,n);if(0===t.length)break;r+=t.length,null==a||a(t);let i=s;for(let e=0;e=s)break;if(s=l,t.length<2500)break}return r}"undefined"!=typeof window&&(window.diagnoseBulkFetch=async()=>{Date.now();const e=Kp();try{const t=`/api/bulk_packets?limit=100&start_timestamp=0&end_timestamp=${Math.floor(Date.now()/1e3)}`,n={Accept:"application/json"};e&&(n.Authorization=`Bearer ${e}`);const a=await fetch(t,{headers:n}),s=await a.text();try{JSON.parse(s).success}catch{}}catch(t){}});const zg="pymc-packet-cache",_g="pymc-packet-cache-meta",Ig=36e5,Vg=2592e5,Og=6048e5,$g=12096e5,qg=18144e5,Ug=2592e6,Wg=7776e6,Hg=5e5,Yg=class e{constructor(){a(this,"packets",new Map),a(this,"sortedPackets",[]),a(this,"sortedDirty",!0),a(this,"meta",{oldestTimestamp:0,newestTimestamp:0,lastUpdated:0,packetCount:0,backgroundLoadComplete:!1,topologyLoadComplete:!1,dataTier:"24h",threeDayLoadComplete:!1,sevenDayLoadComplete:!1,fourteenDayLoadComplete:!1,twentyOneDayLoadComplete:!1,thirtyDayLoadComplete:!1,ninetyDayLoadComplete:!1}),a(this,"isLoading",!1),a(this,"isBackgroundLoading",!1),a(this,"isTopologyLoading",!1),a(this,"listeners",new Set),a(this,"loadProgress",null),a(this,"saveTimer",null),a(this,"statusMessage",""),this.loadFromStorage()}subscribe(e){return this.listeners.add(e),e(this.getState()),()=>this.listeners.delete(e)}getState(){return{isLoading:this.isLoading,isBackgroundLoading:this.isBackgroundLoading,isTopologyLoading:this.isTopologyLoading,backgroundLoadComplete:this.meta.backgroundLoadComplete,topologyLoadComplete:this.meta.topologyLoadComplete,packetCount:this.packets.size,statusMessage:this.statusMessage,loadProgress:this.loadProgress,dataTier:this.meta.dataTier,threeDayLoadComplete:this.meta.threeDayLoadComplete,sevenDayLoadComplete:this.meta.sevenDayLoadComplete,fourteenDayLoadComplete:this.meta.fourteenDayLoadComplete,twentyOneDayLoadComplete:this.meta.twentyOneDayLoadComplete,thirtyDayLoadComplete:this.meta.thirtyDayLoadComplete,ninetyDayLoadComplete:this.meta.ninetyDayLoadComplete,maxRetentionDays:this.getMaxRetentionDays()}}getDataTier(){return this.meta.dataTier}getMaxRetentionDays(){if(!(this.meta.threeDayLoadComplete||this.meta.sevenDayLoadComplete||this.meta.fourteenDayLoadComplete||this.meta.twentyOneDayLoadComplete||this.meta.thirtyDayLoadComplete||this.meta.ninetyDayLoadComplete))return;const e=this.meta.oldestTimestamp;if(!e||e===1/0)return;const t=(Date.now()/1e3-e)/86400;return Math.ceil(t)+1}getPackets(){return this.sortedDirty&&(this.sortedPackets=Array.from(this.packets.values()).sort((e,t)=>(e.timestamp??0)-(t.timestamp??0)),this.sortedDirty=!1),this.sortedPackets}getNewestTimestamp(){return this.meta.newestTimestamp}getOldestTimestamp(){return this.meta.oldestTimestamp}isStale(){return 0===this.packets.size||Date.now()-this.meta.lastUpdated>Ig}isHeavyLoadInProgress(){return this.isBackgroundLoading||this.isTopologyLoading}async initialLoad(e){if(this.meta.backgroundLoadComplete&&this.packets.size>0)return this.getPackets();0===this.packets.size&&(this.meta.oldestTimestamp=1/0,this.meta.newestTimestamp=0),this.sortedDirty=!0,this.isLoading=!0,this.loadProgress={loaded:this.packets.size,target:3e4,percent:0},this.notifyListeners();const t=Math.floor((Date.now()-864e5)/1e3);try{await Rg(t,e=>{this.loadProgress={loaded:e.loaded,target:Math.max(3e4,e.loaded),percent:"complete"===e.phase?100:Math.min(95,10*e.chunk)},e.chunk%2==0&&this.notifyListeners()},t=>{this.bulkInsert(t),null==e||e()}),this.meta.packetCount=this.packets.size,this.meta.backgroundLoadComplete=!0,this.meta.dataTier="24h",this.loadProgress={loaded:this.packets.size,target:this.packets.size,percent:100},this.saveToStorage()}catch(n){}finally{this.isLoading=!1,this.loadProgress=null,this.notifyListeners()}return this.getPackets()}bulkInsert(e){let t=this.meta.oldestTimestamp;t!==1/0&&0!==t||(t=Number.MAX_SAFE_INTEGER);let n=this.meta.newestTimestamp;for(let a=0;an&&(n=o)}t0&&o<1/0?o:s;if(i<=r)return void(this.isBackgroundLoading=!1);const l=3e4*({"3d":2,"7d":6,"14d":13,"21d":20,"30d":29,"90d":89}[e]??13),c=this.packets.size,u=c+l;this.loadProgress={loaded:c,target:u,percent:0},this.statusMessage=`Loading ${e} history...`,this.notifyListeners();let d=0;try{await Rg(r,e=>{this.loadProgress={loaded:c+e.loaded,target:Math.max(u,c+e.loaded),percent:Math.min(99,Math.round((c+e.loaded)/u*100))},e.chunk%2==0&&this.notifyListeners()},e=>{const t=this.packets.size;this.bulkInsert(e),d+=this.packets.size-t,null==n||n()},void 0,i),this.enforceMemoryCap();const t=Date.now()-1e3*this.meta.oldestTimestamp;"3d"===e?(this.meta.threeDayLoadComplete=t>=Vg,this.meta.threeDayLoadComplete&&(this.meta.dataTier="3d")):"7d"===e?(this.meta.sevenDayLoadComplete=t>=Og,this.meta.sevenDayLoadComplete&&(this.meta.dataTier="7d")):"14d"===e?(this.meta.fourteenDayLoadComplete=t>=$g,this.meta.fourteenDayLoadComplete&&(this.meta.dataTier="14d")):"21d"===e?(this.meta.twentyOneDayLoadComplete=t>=qg,this.meta.twentyOneDayLoadComplete&&(this.meta.dataTier="21d")):"30d"===e?(this.meta.thirtyDayLoadComplete=t>=Ug,this.meta.thirtyDayLoadComplete&&(this.meta.dataTier="30d")):"90d"===e&&(this.meta.ninetyDayLoadComplete=t>=Wg,this.meta.ninetyDayLoadComplete&&(this.meta.dataTier="90d")),this.loadProgress={loaded:this.packets.size,target:this.packets.size,percent:100},this.notifyListeners(),this.saveToStorage()}catch(h){this.statusMessage=`${e} load failed`}finally{this.isBackgroundLoading=!1,this.statusMessage="",this.loadProgress=null,this.notifyListeners()}}isDataTierAvailable(e){switch(e){case"24h":return this.meta.backgroundLoadComplete;case"3d":return this.meta.threeDayLoadComplete;case"7d":return this.meta.sevenDayLoadComplete;case"14d":return this.meta.fourteenDayLoadComplete;case"21d":return this.meta.twentyOneDayLoadComplete;case"30d":return this.meta.thirtyDayLoadComplete;case"90d":return this.meta.ninetyDayLoadComplete;default:return!1}}async topologyLoad(){if(!this.meta.topologyLoadComplete&&!this.isTopologyLoading)return this.doTopologyLoad()}async forceTopologyLoad(){if(!this.isTopologyLoading)return this.meta.topologyLoadComplete=!1,this.doTopologyLoad()}async forceDeepLoad(){return this.forceTopologyLoad()}async doTopologyLoad(){this.isTopologyLoading=!0;const e=Date.now(),t=Math.floor(e/1e3),n=Math.floor((e-$g)/1e3),a=this.meta.oldestTimestamp,s=a>0&&a<1/0?a:t;if(s<=n)return this.meta.topologyLoadComplete=!0,void(this.isTopologyLoading=!1);const r=this.packets.size,o=r+42e4;this.statusMessage="Loading topology data...",this.loadProgress={loaded:r,target:o,percent:0},this.notifyListeners();let i=0;try{await Rg(n,e=>{this.loadProgress={loaded:r+e.loaded,target:Math.max(o,r+e.loaded),percent:Math.min(99,Math.round((r+e.loaded)/o*100))},e.chunk%2==0&&this.notifyListeners()},e=>{const t=this.packets.size;this.bulkInsert(e),i+=this.packets.size-t},void 0,s),this.enforceMemoryCap(),this.statusMessage=`Processing ${this.packets.size.toLocaleString()} packets...`,this.loadProgress={loaded:this.packets.size,target:this.packets.size,percent:100},this.notifyListeners(),this.meta.topologyLoadComplete=!0,this.meta.threeDayLoadComplete=!0,this.meta.sevenDayLoadComplete=!0,this.meta.fourteenDayLoadComplete=!0,this.meta.dataTier="14d",this.saveToStorage()}catch(l){this.statusMessage="Load failed"}finally{this.isTopologyLoading=!1,this.statusMessage="",this.loadProgress=null,this.notifyListeners()}}async poll(){try{const e=await this.fetchRecentPackets(100);if(e.success&&e.data){const t=this.packets.size;this.mergePackets(e.data),this.packets.size>t&&(this.saveToStorage(),this.notifyListeners())}}catch(e){}return this.getPackets()}clear(){this.packets.clear(),this.sortedPackets=[],this.sortedDirty=!0,this.meta={oldestTimestamp:0,newestTimestamp:0,lastUpdated:0,packetCount:0,backgroundLoadComplete:!1,topologyLoadComplete:!1,dataTier:"24h",threeDayLoadComplete:!1,sevenDayLoadComplete:!1,fourteenDayLoadComplete:!1,twentyOneDayLoadComplete:!1,thirtyDayLoadComplete:!1,ninetyDayLoadComplete:!1},this.clearStorage(),this.notifyListeners()}mergePacketsDirectly(e){const t=this.packets.size;this.mergePackets(e);const n=this.packets.size-t;return n>0&&(this.enforceMemoryCap(),this.saveToStorage(),this.notifyListeners()),n}mergePackets(e){let t=!1;for(const n of e){const e=n.packet_hash;if(!e)continue;const a=n.timestamp??0,s=`${e}:${a}`;this.packets.has(s)||(this.packets.set(s,n),t=!0),(0===this.meta.oldestTimestamp||athis.meta.newestTimestamp&&(this.meta.newestTimestamp=a)}t&&(this.sortedDirty=!0),this.meta.lastUpdated=Date.now(),this.meta.packetCount=this.packets.size}notifyListeners(){const e=this.getState();for(const t of this.listeners)t(e)}enforceMemoryCap(){if(this.packets.size<=Hg)return;const e=this.getPackets(),t=e.length-Hg;for(let n=0;nt&&(this.meta.oldestTimestamp=e[t].timestamp??0)}loadFromStorage(){if("undefined"!=typeof window)try{const e=localStorage.getItem(_g);e&&(this.meta=JSON.parse(e));const t=localStorage.getItem(zg);if(t){const e=JSON.parse(t);let n=1/0,a=0;for(const t of e)if(t.packet_hash){const e=t.timestamp??0,s=`${t.packet_hash}:${e}`;this.packets.set(s,t),e>0&&ea&&(a=e)}this.packets.size>0&&n!==1/0&&(this.meta.oldestTimestamp=n,this.meta.newestTimestamp=a)}if(this.meta.lastUpdated>0&&Date.now()-this.meta.lastUpdated>Ig)return void this.clear();this.meta.backgroundLoadComplete=!1,this.meta.threeDayLoadComplete=!1,this.meta.sevenDayLoadComplete=!1,this.meta.fourteenDayLoadComplete=!1,this.meta.dataTier="24h";const n=37500;this.meta.topologyLoadComplete&&this.packets.size{this.saveTimer=null,this.flushToStorage()},e.SAVE_DEBOUNCE_MS)))}flushToStorage(){try{localStorage.setItem(_g,JSON.stringify(this.meta));const e=this.getPackets(),t=e.length>3e3?e.slice(-3e3):e;localStorage.setItem(zg,JSON.stringify(t))}catch(e){if(e instanceof DOMException&&"QuotaExceededError"===e.name)try{localStorage.removeItem(zg),localStorage.setItem(_g,JSON.stringify(this.meta))}catch{}}}clearStorage(){if("undefined"!=typeof window)try{localStorage.removeItem(zg),localStorage.removeItem(_g)}catch(e){}}async fetchRecentPackets(e=1e3,t=!1){const n=`/api/recent_packets?limit=${e}`,a=Kp(),s={Accept:"application/json"};a&&(s.Authorization=`Bearer ${a}`);const r=await fetch(n,{headers:s});if(401===r.status&&!t&&await rg())return this.fetchRecentPackets(e,!0);if(!r.ok)throw new Error(`API error: ${r.status}`);return r.json()}};a(Yg,"SAVE_DEBOUNCE_MS",1e4);const Gg=new Yg;function Kg(e){return{paths:e.paths,byEndpoints:new Map(e.byEndpointsEntries),canonicalPaths:new Map(e.canonicalPathsEntries),totalObservations:e.totalObservations,uniquePathCount:e.uniquePathCount}}function Xg(){return{paths:[],byEndpoints:new Map,canonicalPaths:new Map,totalObservations:0,uniquePathCount:0}}const Jg=new class{constructor(){a(this,"worker",null),a(this,"listeners",new Set),a(this,"currentTopology",{edges:[],validatedEdges:[],weakEdges:[],certainEdges:[],uncertainEdges:[],edgeMap:new Map,maxPacketCount:0,maxCertainCount:0,neighborAffinity:new Map,fullAffinity:new Map,localPrefix:null,centrality:new Map,hubNodes:[],gatewayNodes:[],loops:[],loopEdgeKeys:new Set,txDelayRecommendations:new Map,pathRegistry:Xg(),edgeBetweenness:new Map,backboneEdges:[],nodeMobility:new Map,mobileNodes:[],pathHealth:[],lastHopNeighbors:[],disambiguationStats:{totalPrefixes:0,unambiguousPrefixes:0,collisionPrefixes:0,collisionRate:0,avgConfidence:0,lowConfidencePrefixes:[],highCollisionPrefixes:[],totalResolutions:0},discoveredNodes:[],viterbiStats:{totalPaths:0,pathsWithGhosts:0,avgPathCost:0,avgPathConfidence:0,observationOverrideCount:0,tracePacketsProcessed:0,pathPacketsProcessed:0,distantEdgesDiscovered:0,duplicateGroupsFound:0,duplicatePathsUnique:0,echolocationEdgesInferred:0},nodeMetrics:new Map,communityCount:0,backboneNodes:[],traceLinks:new Map,traceLinkSummary:{totalDirectedLinks:0,totalTraces:0,totalObservations:0,bidirectionalLinks:0,avgSnr:0,qualityCounts:{excellent:0,good:0,fair:0,poor:0,critical:0}}}),a(this,"isComputing",!1),a(this,"pendingRequest",null),a(this,"debounceTimer",null),a(this,"debounceMs",100)}ensureWorker(){if(this.worker)return this.worker;if("undefined"==typeof window)return null;try{this.worker=new Worker(new URL("/assets/topology.worker-DMNQ8G_E.js",import.meta.url),{type:"module"}),this.worker.onmessage=e=>{this.handleWorkerMessage(e.data)},this.worker.onerror=e=>{}}catch(e){}return this.worker}handleWorkerMessage(e){if(this.isComputing=!1,"error"!==e.type){var t;this.currentTopology={edges:(t=e.payload).edges??[],validatedEdges:t.validatedEdges??[],weakEdges:t.weakEdges??[],certainEdges:t.certainEdges??[],uncertainEdges:t.uncertainEdges??[],maxPacketCount:t.maxPacketCount??0,maxCertainCount:t.maxCertainCount??0,localPrefix:t.localPrefix??null,hubNodes:t.hubNodes??[],gatewayNodes:t.gatewayNodes??[],edgeMap:new Map(t.edgeMapEntries??[]),neighborAffinity:new Map(t.neighborAffinityEntries??[]),fullAffinity:new Map(t.fullAffinityEntries??[]),centrality:new Map(t.centralityEntries??[]),loops:t.loops??[],loopEdgeKeys:new Set(t.loopEdgeKeyEntries??[]),txDelayRecommendations:new Map(t.txDelayRecommendationEntries??[]),pathRegistry:t.pathRegistry?Kg(t.pathRegistry):Xg(),edgeBetweenness:new Map(t.edgeBetweennessEntries??[]),backboneEdges:t.backboneEdges??[],nodeMobility:new Map(t.nodeMobilityEntries??[]),mobileNodes:t.mobileNodes??[],pathHealth:t.pathHealth??[],lastHopNeighbors:t.lastHopNeighbors??[],disambiguationStats:t.disambiguationStats??{totalPrefixes:0,unambiguousPrefixes:0,collisionPrefixes:0,collisionRate:0,avgConfidence:0,lowConfidencePrefixes:[],highCollisionPrefixes:[],totalResolutions:0},discoveredNodes:t.discoveredNodes??[],viterbiStats:t.viterbiStats??{totalPaths:0,pathsWithGhosts:0,avgPathCost:0,avgPathConfidence:0,observationOverrideCount:0,tracePacketsProcessed:0,pathPacketsProcessed:0,distantEdgesDiscovered:0,duplicateGroupsFound:0,duplicatePathsUnique:0,echolocationEdgesInferred:0},nodeMetrics:new Map(t.nodeMetricsEntries??[]),communityCount:t.communityCount??0,backboneNodes:t.backboneNodes??[],traceLinks:new Map(t.traceLinkEntries??[]),traceLinkSummary:t.traceLinkSummary??{totalDirectedLinks:0,totalTraces:0,totalObservations:0,bidirectionalLinks:0,avgSnr:0,qualityCounts:{excellent:0,good:0,fair:0,poor:0,critical:0}}};for(const t of this.listeners)try{t(this.currentTopology,e.computeTimeMs)}catch(n){}if(this.pendingRequest){const e=this.pendingRequest;this.pendingRequest=null,this.computeInternal(e)}}}computeInternal(e){const t=this.ensureWorker();if(!t)return;this.isComputing=!0;const n={type:"compute",payload:e};t.postMessage(n)}compute(e,t,n,a,s,r,o,i){const l={packets:e,neighbors:t,localHash:n,localLat:a,localLon:s,airtimeMs:r,zeroHopNeighbors:o,terrainGrid:i,enableTerrainAware:void 0!==i};this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.isComputing?this.pendingRequest=l:this.computeInternal(l)},this.debounceMs)}subscribe(e){return this.listeners.add(e),this.currentTopology.edges.length>0&&e(this.currentTopology,0),()=>{this.listeners.delete(e)}}getTopology(){return this.currentTopology}isWorking(){return this.isComputing}terminate(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.worker&&(this.worker.terminate(),this.worker=null),this.listeners.clear()}},Zg=new class{constructor(){a(this,"worker",null),a(this,"listeners",new Set),a(this,"sparklines",new Map),a(this,"isComputing",!1),a(this,"lastComputeTimeMs",0),a(this,"pendingRequest",null),a(this,"debounceTimer",null),a(this,"debounceMs",150),this.initWorker()}initWorker(){if("undefined"!=typeof window)try{this.worker=new Worker(new URL("/assets/sparkline.worker-CmKhBAy5.js",import.meta.url),{type:"module"}),this.worker.onmessage=e=>{this.handleWorkerMessage(e.data)},this.worker.onerror=e=>{this.isComputing=!1,this.notifyListeners()}}catch(e){}}handleWorkerMessage(e){if(this.isComputing=!1,"error"!==e.type){if(this.sparklines=new Map(e.payload.sparklineEntries),this.lastComputeTimeMs=e.computeTimeMs,this.notifyListeners(),this.pendingRequest){const e=this.pendingRequest;this.pendingRequest=null,this.computeInternal(e.packets,e.nodeHashes)}}else this.notifyListeners()}computeInternal(e,t){if(!this.worker)return;if(0===t.length)return this.isComputing=!1,void this.notifyListeners();this.isComputing=!0,this.notifyListeners();const n={type:"compute",payload:{packets:e,nodeHashes:t}};this.worker.postMessage(n)}notifyListeners(){for(const t of this.listeners)try{t(this.sparklines,this.isComputing)}catch(e){}}compute(e,t){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.isComputing?this.pendingRequest={packets:e,nodeHashes:t}:this.computeInternal(e,t)},this.debounceMs)}getSparkline(e){return this.sparklines.get(e)??[]}getAllSparklines(){return this.sparklines}hasSparkline(e){return this.sparklines.has(e)}isWorking(){return this.isComputing}getLastComputeTime(){return this.lastComputeTimeMs}subscribe(e){return this.listeners.add(e),e(this.sparklines,this.isComputing),()=>{this.listeners.delete(e)}}clear(){this.sparklines.clear(),this.notifyListeners()}terminate(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.worker&&(this.worker.terminate(),this.worker=null),this.listeners.clear()}},Qg=new class{constructor(){a(this,"ws",null),a(this,"connectionState","disconnected"),a(this,"reconnectAttempts",0),a(this,"pingIntervalId",null),a(this,"lastPongTime",Date.now()),a(this,"reconnectTimeoutId",null),a(this,"packetListeners",new Set),a(this,"statsListeners",new Set),a(this,"systemStatsListeners",new Set),a(this,"packetStatsListeners",new Set),a(this,"connectionListeners",new Set),a(this,"unsubscribeTokenChange",null),a(this,"wsSupported",!0)}buildWsUrl(){const e=Kp(),t=Wp(),n=new URLSearchParams;e&&n.set("token",e),t&&n.set("client_id",t);const a=n.toString()?`?${n.toString()}`:"";return`${"https:"===window.location.protocol?"wss:":"ws:"}//${window.location.host}/ws/packets${a}`}connect(){var e,t;if((null==(e=this.ws)?void 0:e.readyState)!==WebSocket.OPEN&&(null==(t=this.ws)?void 0:t.readyState)!==WebSocket.CONNECTING&&this.wsSupported){this.setConnectionState("connecting");try{const e=this.buildWsUrl();this.ws=new WebSocket(e),this.ws.onopen=this.handleOpen.bind(this),this.ws.onmessage=this.handleMessage.bind(this),this.ws.onerror=this.handleError.bind(this),this.ws.onclose=this.handleClose.bind(this),this.unsubscribeTokenChange||(this.unsubscribeTokenChange=(n=e=>{e&&"connected"===this.connectionState&&(this.disconnect(),this.connect())},qp.add(n),()=>qp.delete(n)))}catch(a){this.wsSupported=!1,this.setConnectionState("disconnected")}var n}}disconnect(){this.clearPingInterval(),this.clearReconnectTimeout(),this.ws&&(this.ws.onopen=null,this.ws.onmessage=null,this.ws.onerror=null,this.ws.onclose=null,this.ws.readyState!==WebSocket.OPEN&&this.ws.readyState!==WebSocket.CONNECTING||this.ws.close(1e3,"Client disconnect"),this.ws=null),this.setConnectionState("disconnected"),this.reconnectAttempts=0}isConnected(){var e;return(null==(e=this.ws)?void 0:e.readyState)===WebSocket.OPEN}getConnectionState(){return this.connectionState}isSupported(){return this.wsSupported}resetSupported(){this.wsSupported||(this.wsSupported=!0,this.reconnectAttempts=0)}send(e){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(e)),!0}catch(t){return!1}}onPacket(e){return this.packetListeners.add(e),()=>this.packetListeners.delete(e)}onStats(e){return this.statsListeners.add(e),()=>this.statsListeners.delete(e)}onSystemStats(e){return this.systemStatsListeners.add(e),()=>this.systemStatsListeners.delete(e)}onPacketStats(e){return this.packetStatsListeners.add(e),()=>this.packetStatsListeners.delete(e)}onConnectionChange(e){return this.connectionListeners.add(e),e(this.connectionState,this.reconnectAttempts),()=>this.connectionListeners.delete(e)}handleOpen(){this.setConnectionState("connected"),this.reconnectAttempts=0,this.lastPongTime=Date.now();const e=Kp();e&&this.ws&&this.ws.send(JSON.stringify({type:"auth",token:e})),this.startPingInterval()}handleMessage(e){try{const t=JSON.parse(e.data);switch(t.type){case"packet":this.notifyPacketListeners(t.data);break;case"stats":{const e=t.data;e&&"noise_floor_dbm"in e&&this.notifyStatsListeners(e),(null==e?void 0:e.packet_stats)&&this.notifyPacketStatsListeners(e.packet_stats),(null==e?void 0:e.system_stats)&&this.notifySystemStatsListeners(e.system_stats);break}case"packet_stats":{const e=t.data;this.notifyPacketStatsListeners(e);break}case"system_stats":this.notifySystemStatsListeners(t.data);break;case"ping":this.lastPongTime=Date.now(),this.send({type:"pong"});break;case"pong":this.lastPongTime=Date.now()}}catch(t){}}handleError(e){}handleClose(e){this.clearPingInterval(),1e3!==e.code?(1006===e.code&&this.reconnectAttempts,this.scheduleReconnect()):this.setConnectionState("disconnected")}setConnectionState(e){if(this.connectionState!==e){this.connectionState=e;for(const n of this.connectionListeners)try{n(e,this.reconnectAttempts)}catch(t){}}}notifyPacketListeners(e){for(const n of this.packetListeners)try{n(e)}catch(t){}}notifyStatsListeners(e){for(const n of this.statsListeners)try{n(e)}catch(t){}}notifySystemStatsListeners(e){for(const n of this.systemStatsListeners)try{n(e)}catch(t){}}notifyPacketStatsListeners(e){for(const n of this.packetStatsListeners)try{n(e)}catch(t){}}startPingInterval(){this.clearPingInterval(),this.pingIntervalId=setInterval(()=>{var e;(null==(e=this.ws)?void 0:e.readyState)===WebSocket.OPEN&&(this.send({type:"ping"}),Date.now()-this.lastPongTime>6e4&&(this.disconnect(),this.connect()))},3e4)}async verifyConnection(e=5e3){return!(!this.ws||this.ws.readyState!==WebSocket.OPEN)&&new Promise(t=>{const n=Date.now(),a=this.lastPongTime;this.send({type:"ping"});const s=setInterval(()=>{this.lastPongTime>a?(clearInterval(s),t(!0)):Date.now()-n>e&&(clearInterval(s),t(!1))},100)})}clearPingInterval(){this.pingIntervalId&&(clearInterval(this.pingIntervalId),this.pingIntervalId=null)}scheduleReconnect(){if(this.reconnectAttempts>=20)return this.wsSupported=!1,void this.setConnectionState("disconnected");this.setConnectionState("reconnecting");const e=Math.min(1e3*Math.pow(2,Math.min(this.reconnectAttempts,5)),3e4);this.reconnectAttempts++,this.reconnectTimeoutId=setTimeout(()=>{this.reconnectTimeoutId=null,this.connect()},e)}clearReconnectTimeout(){this.reconnectTimeoutId&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=null)}terminate(){this.disconnect(),this.unsubscribeTokenChange&&(this.unsubscribeTokenChange(),this.unsubscribeTokenChange=null),this.packetListeners.clear(),this.statsListeners.clear(),this.systemStatsListeners.clear(),this.packetStatsListeners.clear(),this.connectionListeners.clear()}},ef=A(e=>({connectionState:"disconnected",isSupported:!0,reconnectAttempt:0,lastConnected:null,initialize:()=>{Qg.onConnectionChange((t,n)=>{e(e=>({connectionState:t,reconnectAttempt:n??0,isSupported:Qg.isSupported(),lastConnected:"connected"===t?Date.now():e.lastConnected}))}),Qg.connect()}})),tf=.05,nf=1e3,af="terrarium";function sf(e,t,n){try{return e.queryTerrainElevation({lng:t,lat:n})??0}catch{return 0}}const rf=A((e,t)=>({terrainGrid:null,isLoading:!1,error:null,lastLoadedAt:null,cachedBounds:null,terrainDisambiguationEnabled:!0,loadTerrain:async(n,a)=>{const s=t();if(!(s.isLoading||(r=s.cachedBounds,o=n,r&&r.minLat<=o.minLat&&r.maxLat>=o.maxLat&&r.minLng<=o.minLng&&r.maxLng>=o.maxLng))){var r,o;e({isLoading:!0,error:null});try{a.getTerrain()||(a.getSource(af)||(a.addSource(af,{type:"raster-dem",tiles:["https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png"],encoding:"terrarium",tileSize:256}),await new Promise((e,t)=>{const n=setTimeout(()=>t(new Error("Terrain source load timeout")),1e4),s=t=>{t.sourceId===af&&t.isSourceLoaded&&(clearTimeout(n),a.off("sourcedata",s),e())};a.on("sourcedata",s)})),a.setTerrain({source:af}),await new Promise(e=>setTimeout(e,500)));const t=await async function(e,t){const{minLat:n,maxLat:a,minLng:s,maxLng:r}=t;let o=Math.ceil((r-s)/.001),i=Math.ceil((a-n)/.001);o>nf&&(o=nf),i>nf&&(i=nf);const l=(r-s)/o,c=(a-n)/i,u=Math.max(l,c),d=new Float32Array(o*i);let h=0;for(let m=0;msetTimeout(e,0))}}return{origin:[n,s],cellSize:u,width:o,height:i,elevations:d}}(a,n);e({terrainGrid:t,isLoading:!1,lastLoadedAt:Date.now(),cachedBounds:n})}catch(i){const t=i instanceof Error?i.message:"Unknown error loading terrain";e({isLoading:!1,error:t})}}},preloadFromNodes:async(e,n)=>{const a=function(e){const t=e.filter(e=>void 0!==e.latitude&&void 0!==e.longitude&&(0!==e.latitude||0!==e.longitude));if(0===t.length)return null;let n=1/0,a=-1/0,s=1/0,r=-1/0;for(const o of t)n=Math.min(n,o.latitude),a=Math.max(a,o.latitude),s=Math.min(s,o.longitude),r=Math.max(r,o.longitude);return{minLat:n-tf,maxLat:a+tf,minLng:s-tf,maxLng:r+tf}}(e);a&&await t().loadTerrain(a,n)},clearTerrain:()=>{e({terrainGrid:null,cachedBounds:null,lastLoadedAt:null,error:null})},setTerrainDisambiguationEnabled:t=>{e({terrainDisambiguationEnabled:t})},getTerrainGridForDisambiguation:()=>{const e=t();return e.terrainDisambiguationEnabled?e.terrainGrid:null}})),of="pymc-stealth-location";function lf(e){if("undefined"!=typeof window)try{localStorage.setItem(of,JSON.stringify(e))}catch{}}function cf(e){return!isNaN(e)&&e>=-90&&e<=90}function uf(e){return!isNaN(e)&&e>=-180&&e<=180}const df=function(){if("undefined"==typeof window)return{};try{const e=localStorage.getItem(of);if(!e)return{};const t=JSON.parse(e);if("number"==typeof t.latitude&&"number"==typeof t.longitude&&"boolean"==typeof t.enabled&&cf(t.latitude)&&uf(t.longitude))return t}catch{}return{}}(),hf=A((e,t)=>({latitude:df.latitude??null,longitude:df.longitude??null,enabled:df.enabled??!1,setLocation:(n,a)=>{cf(n)&&uf(a)&&(e({latitude:n,longitude:a}),lf({latitude:n,longitude:a,enabled:t().enabled}))},enable:()=>{const{latitude:n,longitude:a}=t();null!==n&&null!==a&&(e({enabled:!0}),lf({latitude:n,longitude:a,enabled:!0}))},disable:()=>{e({enabled:!1});const{latitude:n,longitude:a}=t();null!==n&&null!==a&&lf({latitude:n,longitude:a,enabled:!1})},clear:()=>{e({latitude:null,longitude:null,enabled:!1}),function(){if("undefined"!=typeof window)try{localStorage.removeItem(of)}catch{}}()},getEffectiveLocation:()=>{const{latitude:e,longitude:n,enabled:a}=t();return a&&null!==e&&null!==n?{latitude:e,longitude:n}:null},isActive:()=>{const{latitude:e,longitude:n,enabled:a}=t();return a&&null!==e&&null!==n}}));function mf(e,t,n,a){return!t&&a>=3?"offline":n?"connected"!==e&&t||a>0&&a<3?"degraded":"connected":"offline"}const pf=A((e,t)=>({wsState:"disconnected",wsReconnectAttempt:0,restHealthy:!0,lastSuccessfulFetch:null,consecutiveFailures:0,authValid:!0,authExpiresIn:null,health:"connected",bannerDismissed:!1,isInitializing:!0,initialize:()=>{Qg.onConnectionChange((n,a)=>{const{restHealthy:s,authValid:r,consecutiveFailures:o,health:i,isInitializing:l}=t(),c=l&&"connected"===n,u=mf(n,s,r,o);e({wsState:n,wsReconnectAttempt:a??0,health:u,isInitializing:!c&&l,bannerDismissed:(u===i||"connected"!==u)&&t().bannerDismissed})}),t().updateAuthState(),setTimeout(()=>{t().isInitializing&&e({isInitializing:!1})},1e4),setInterval(()=>{t().updateAuthState()},3e4)},updateRestHealth:n=>{const{wsState:a,authValid:s,consecutiveFailures:r,health:o}=t(),i=n?0:r+1,l=n||i<3,c=n?Date.now():t().lastSuccessfulFetch,u=mf(a,l,s,i);e({restHealthy:l,lastSuccessfulFetch:c,consecutiveFailures:i,health:u,bannerDismissed:"connected"!==u&&u===o&&t().bannerDismissed})},updateAuthState:()=>{const n=Zp()&&!eg(),a=tg(),{wsState:s,restHealthy:r,consecutiveFailures:o,health:i}=t(),l=mf(s,r,n,o);e({authValid:n,authExpiresIn:a>0?a:null,health:l,bannerDismissed:l===i&&t().bannerDismissed})},dismissBanner:()=>{e({bannerDismissed:!0})}})),gf=()=>pf(e=>e.health),ff=new class{constructor(){a(this,"worker",null),a(this,"isReady",!1),a(this,"pendingRequests",[]),a(this,"currentRequest",null),this.initWorker()}initWorker(){if("undefined"!=typeof window)try{this.worker=new Worker(new URL("/assets/decryption.worker-D2Jy06E5.js",import.meta.url),{type:"module"}),this.worker.onmessage=this.handleMessage.bind(this),this.worker.onerror=e=>{}}catch(e){}}handleMessage(e){var t,n,a,s;const r=e.data;switch(r.type){case"ready":this.isReady=!0,this.processNextRequest();break;case"progress":(null==(t=this.currentRequest)?void 0:t.onProgress)&&this.currentRequest.onProgress(r.processed,r.total);break;case"result":(null==(n=this.currentRequest)?void 0:n.onResult)&&this.currentRequest.onResult(r.result);break;case"results":if(null==(a=this.currentRequest)?void 0:a.onResults)this.currentRequest.onResults(r.results);else if(null==(s=this.currentRequest)?void 0:s.onResult)for(const e of r.results)this.currentRequest.onResult(e);break;case"batchComplete":this.currentRequest&&(this.currentRequest.onBatchComplete(r.successCount,r.totalCount,r.computeTimeMs),this.currentRequest=null),this.processNextRequest();break;case"error":this.currentRequest&&(this.currentRequest.onBatchComplete(0,0,0),this.currentRequest=null),this.processNextRequest()}}processNextRequest(){if(!this.isReady||!this.worker||this.currentRequest)return;const e=this.pendingRequests.shift();if(!e)return;this.currentRequest={onProgress:e.onProgress,onResult:e.onResult,onResults:e.onResults,onBatchComplete:e.onBatchComplete};const t={type:"decrypt",packets:e.packets,knownKey:e.knownKey};this.worker.postMessage(t)}decrypt(e,t){return new Promise(n=>{const a=e.map(e=>({packet_hash:e.packet_hash,raw_packet:e.raw_packet||"",timestamp:e.timestamp??0,rssi:e.rssi,snr:e.snr,type:e.type,payload_type:e.payload_type}));this.pendingRequests.push({packets:a,knownKey:null==t?void 0:t.knownKey,onProgress:null==t?void 0:t.onProgress,onResults:null==t?void 0:t.onResults,onResult:null==t?void 0:t.onResult,onBatchComplete:(e,t,a)=>{n({successCount:e,totalCount:t,computeTimeMs:a})}}),this.processNextRequest()})}isServiceReady(){return this.isReady}isProcessing(){return null!==this.currentRequest}getPendingCount(){return this.pendingRequests.length}pause(){if(this.worker){const e={type:"pause"};this.worker.postMessage(e)}}resume(){if(this.worker){const e={type:"resume"};this.worker.postMessage(e)}}terminate(){if(this.worker){const e={type:"stop"};this.worker.postMessage(e),this.worker.terminate(),this.worker=null}this.isReady=!1,this.pendingRequests=[],this.currentRequest=null}},yf=3,bf=2,vf=15,wf=6,Cf=3,kf=0,xf=1,Df=2,Af=3,Ef={[kf]:"T_FLOOD",[xf]:"FLOOD",[Df]:"DIRECT",[Af]:"T_DIRECT"},Bf=0,Ff=1,Sf=2,Mf=3,jf=4,Tf=5,Pf=6,Lf=7,Rf=8,Nf=9,zf=10,_f=11,If=15,Vf={REQ:0,RESPONSE:1,ADVERT:4,GRP_TXT:5,GRP_DATA:6,ANON_REQ:7,TRACE:9},Of={[Bf]:"REQ",[Ff]:"RESPONSE",[Sf]:"TXT_MSG",[Mf]:"ACK",[jf]:"ADVERT",[Tf]:"GRP_TXT",[Pf]:"GRP_DATA",[Lf]:"ANON_REQ",[Rf]:"PATH",[Nf]:"TRACE",[zf]:"MULTIPART",[_f]:"CONTROL",[If]:"RAW_CUSTOM"},$f=1,qf=32,Uf=64,Wf=64,Hf=4,Yf=1,Gf=2,Kf=3,Xf=4,Jf=16,Zf=128,Qf=15;function ey(e){return 1===e||0===e}function ty(e){return 2===e||3===e}function ny(e){return 0===e||3===e}function ay(e){const t=[];switch(15&e){case 1:t.push("is companion");break;case 2:t.push("is repeater");break;case 3:t.push("is room server");break;case 4:t.push("is sensor")}return 16&e&&t.push("has location"),32&e&&t.push("has feature 1"),64&e&&t.push("has feature 2"),128&e&&t.push("has name"),t.join(", ")||"none"}function sy(e){return Ef[e]??`UNKNOWN(${e})`}function ry(e){return Of[e]??`UNKNOWN(${e})`}function oy(e){const t=e.replace(/^0x/i,"").replace(/\s/g,"");if(t.length%2!=0)throw new Error("Invalid hex string: odd number of characters");const n=new Uint8Array(t.length/2);for(let a=0;ae.toString(16).padStart(2,"0")).join("");return t&&(a=a.toUpperCase()),n&&(a="0x"+a),a}function ly(e,t=!0){const n=(255&e).toString(16).padStart(2,"0");return t?n.toUpperCase():n}function cy(e,t,n,a){if(e+t>n)throw new Error(a)}function uy(e){if(e>256)throw new Error(`payload too large: ${e} > 256`)}function dy(){return"undefined"!=typeof crypto&&void 0!==crypto.subtle&&"function"==typeof crypto.subtle.digest}const hy=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),my=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);function py(e,t){return(e>>>t|e<<32-t)>>>0}function gy(e,t){let n=e[0],a=e[1],s=e[2],r=e[3],o=e[4],i=e[5],l=e[6],c=e[7];for(let u=0;u<64;u++){if(u>=16){const e=py(t[u-15&15],7)^py(t[u-15&15],18)^t[u-15&15]>>>3,n=py(t[u-2&15],17)^py(t[u-2&15],19)^t[u-2&15]>>>10;t[15&u]=t[15&u]+e+t[u-7&15]+n>>>0}const e=c+(py(o,6)^py(o,11)^py(o,25))+(o&i^~o&l)+hy[u]+t[15&u]>>>0,d=n&a^n&s^a&s;c=l,l=i,i=o,o=r+e>>>0,r=s,s=a,a=n,n=e+((py(n,2)^py(n,13)^py(n,22))+d>>>0)>>>0}e[0]=e[0]+n>>>0,e[1]=e[1]+a>>>0,e[2]=e[2]+s>>>0,e[3]=e[3]+r>>>0,e[4]=e[4]+o>>>0,e[5]=e[5]+i>>>0,e[6]=e[6]+l>>>0,e[7]=e[7]+c>>>0}function fy(e){const t=new Uint32Array(my),n=new Uint32Array(16),a=8*e.length,s=e.length+9+63&-64,r=new Uint8Array(s);r.set(e),r[e.length]=128;const o=new DataView(r.buffer);o.setUint32(s-4,a,!1);for(let c=0;c>=1}return n}function ky(e){let t=e[13];e[13]=e[9],e[9]=e[5],e[5]=e[1],e[1]=t,t=e[2],e[2]=e[10],e[10]=t,t=e[6],e[6]=e[14],e[14]=t,t=e[3],e[3]=e[7],e[7]=e[11],e[11]=e[15],e[15]=t}function xy(e){for(let t=0;t<16;t++)e[t]=vy[e[t]]}function Dy(e,t){for(let n=0;n<16;n++)e[n]^=t[n]}function Ay(e){for(let t=0;t<4;t++){const n=4*t,a=e[n],s=e[n+1],r=e[n+2],o=e[n+3];e[n]=Cy(14,a)^Cy(11,s)^Cy(13,r)^Cy(9,o),e[n+1]=Cy(9,a)^Cy(14,s)^Cy(11,r)^Cy(13,o),e[n+2]=Cy(13,a)^Cy(9,s)^Cy(14,r)^Cy(11,o),e[n+3]=Cy(11,a)^Cy(13,s)^Cy(9,r)^Cy(14,o)}}function Ey(e,t){const n=new Uint8Array(e);Dy(n,t[10]);for(let a=9;a>=1;a--)ky(n),xy(n),Dy(n,t[a]),Ay(n);return ky(n),xy(n),Dy(n,t[0]),n}function By(e,t){const n=function(e){const t=[],n=new Uint8Array(176);n.set(e.slice(0,16));for(let a=16;a<176;a+=4){let e=n[a-4],t=n[a-3],s=n[a-2],r=n[a-1];if(a%16==0){const n=e;e=by[t]^wy[a/16-1],t=by[s],s=by[r],r=by[n]}n[a]=n[a-16]^e,n[a+1]=n[a-15]^t,n[a+2]=n[a-14]^s,n[a+3]=n[a-13]^r}for(let a=0;a<11;a++)t.push(n.slice(16*a,16*(a+1)));return t}(e),a=new Uint8Array(t.length);for(let s=0;s>>0}function jy(e,t){return e[t]|e[t+1]<<8}function Ty(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Py(e,t,n){t[n]=255&e,t[n+1]=e>>8&255}function Ly(e){return(e instanceof Uint8Array?Array.from(e):e).map(e=>ly(e,!0)).join("->")}const Ry={name:"Public",secret:"8b3387e9c5cdea6ac9e5edbaa115cd72"},Ny=["southbay","south-bay","bot","ventura","weather","wardrive","test","icewatch","sbcountymesh","sb-county-mesh","sbcounty","sb-county","meshbud","mesh-bud","ai-bot","aibot","hdmesh","hd-mesh","hdme","hdme7","hdme7yard","hdmeyard","hdmeshtayrd","hdmestayrd","hdmestyard","hdmetayrd","hdmeshtnyard","mustard","socalmesh","socal-mesh","meshla","mesh-la","lamesh","la-mesh","westcoast","west-coast","wcmesh","wc-mesh","eastcoast","east-coast","midwest","southwest","northwest","northeast","southeast","california","cali","santaclarita","santa-clarita","scv","newhall","valencia","saugus","castaic","palmdale","lancaster","antelopevalley","antelope-valley","avmesh","av-mesh","highdesert","high-desert","mojave","victorville","hesperia","barstow","pomona","claremont","glendora","azusa","covina","westcovina","west-covina","walnut","diamondbar","diamond-bar","whittier","brea","yorbalinda","yorba-linda","montebello","montereypark","monterey-park","alhambra","arcadia","monrovia","duarte","hermosabeach","hermosa-beach","manhattanbeach","manhattan-beach","redondobeach","redondo-beach","palosverdes","palos-verdes","sanpedro","san-pedro","ojai","fillmore","santapaula","santa-paula","porthueneme","port-hueneme","general","public","main","default","chat","local","mesh","network","emergency","sos","help","news","info","status","alerts","announce","random","offtopic","off-topic","lobby","lounge","hangout","testing","dev","development","beta","alpha","experimental","personaltest","personal-test","mytest","my-test","testchannel","test-channel","meshcore","mesh-core","meshtastic","lora","lo-ra","lorawan","lora-wan","radio","ham","amateur","hamradio","ham-radio","amateurradio","repeater","repeaters","gateway","node","nodes","rf","rfmesh","offgrid","off-grid","prepper","preppers","emcomm","ares","races","socal","so-cal","southerncalifornia","southern-california","losangeles","los-angeles","la","laarea","la-area","greaterla","sfv","sfvalley","sf-valley","sanfernandovalley","san-fernando-valley","sanfernando","san-fernando","valley","thevalley","the-valley","westla","west-la","eastla","east-la","southla","south-la","dtla","downtown","downtownla","downtown-la","hollywood","beverlyhills","beverly-hills","santamonica","santa-monica","culvercity","culver-city","marinadelrey","marina-del-rey","longbeach","long-beach","torrance","carson","compton","inglewood","pasadena","glendale","burbank","noho","northhollywood","north-hollywood","encino","tarzana","woodland","woodlandhills","woodland-hills","calabasas","malibu","topanga","agoura","agourahills","agoura-hills","thousandoaks","thousand-oaks","simivalley","simi-valley","simi","venturacounty","ventura-county","oxnard","camarillo","moorpark","santabarbara","santa-barbara","sb","goleta","carpinteria","orangecounty","orange-county","oc","irvine","anaheim","fullerton","costamesa","costa-mesa","newportbeach","newport-beach","huntingtonbeach","inlandempire","inland-empire","ie","riverside","sanbernardino","san-bernardino","ontario","rancho","ranchocucamonga","rancho-cucamonga","fontana","corona","palmsprings","palm-springs","palmdesert","palm-desert","coachella","temecula","murrieta","hemet","perris","menifee","sandiego","san-diego","sd","sdmesh","sd-mesh","norcal","nor-cal","northerncalifornia","northern-california","bayarea","bay-area","sfbay","sf-bay","sfbayarea","sf-bay-area","sanfrancisco","san-francisco","sf","sfmesh","sf-mesh","oakland","berkeley","eastbay","east-bay","alameda","sanjose","san-jose","sj","southbay","south-bay","siliconvalley","silicon-valley","santaclara","santa-clara","sunnyvale","mountainview","mountain-view","paloalto","palo-alto","menlopark","menlo-park","redwoodcity","redwood-city","fremont","hayward","unioncity","union-city","newark","milpitas","santacruz","santa-cruz","watsonville","monterey","montereybay","monterey-bay","salinas","carmel","pacificgrove","pacific-grove","sacramento","sac","sactown","westsac","west-sac","roseville","folsom","fresno","bakersfield","stockton","modesto","visalia","seattle","seattlemesh","seattle-mesh","pnw","pacificnorthwest","pacific-northwest","portland","pdx","portlandmesh","portland-mesh","oregon","denver","denvermesh","denver-mesh","colorado","boulder","fortcollins","austin","austinmesh","austin-mesh","atx","texas","sanantonio","san-antonio","dallas","dfw","dallasmesh","dallas-mesh","fortworth","fort-worth","houston","houstonmesh","houston-mesh","htx","phoenix","phoenixmesh","phoenix-mesh","arizona","az","tucson","mesa","tempe","lasvegas","las-vegas","vegas","vegasmesh","vegas-mesh","nevada","henderson","saltlake","salt-lake","slc","saltlakecity","salt-lake-city","utah","chicago","chicagomesh","chicago-mesh","chitown","illinois","detroit","detroitmesh","detroit-mesh","michigan","annarbor","ann-arbor","minneapolis","twincities","twin-cities","minnesota","stpaul","st-paul","atlanta","atlantamesh","atlanta-mesh","atl","georgia","miami","miamimesh","miami-mesh","florida","tampa","orlando","jacksonville","boston","bostonmesh","boston-mesh","massachusetts","cambridge","newyork","new-york","nyc","nycmesh","nyc-mesh","brooklyn","manhattan","queens","newjersey","new-jersey","nj","jersey","philly","philadelphia","philadelphiamesh","philadelphia-mesh","pennsylvania","dc","washingtondc","washington-dc","dmv","nova","maryland","virginia","raleigh","durham","rdu","triangle","northcarolina","north-carolina","charlotte","clt","southcarolina","south-carolina","nashville","tennessee","memphis","knoxville","neworleans","new-orleans","nola","louisiana","hawaii","oahu","honolulu","maui","bigisland","big-island","alaska","anchorage","fairbanks","canada","toronto","vancouver","montreal","calgary","edmonton","ottawa","uk","london","manchester","birmingham","edinburgh","glasgow","bristol","germany","berlin","munich","hamburg","frankfurt","cologne","france","paris","lyon","marseille","spain","madrid","barcelona","italy","rome","milan","netherlands","amsterdam","rotterdam","brabant","flevoland","gelderland","noordbrabant","noordholland","zuid-holland","zuidholland","zeeland","twente","alkmaar","almere","amstelland","capelleaandenijssel","denhaag","dordrecht","drechtsteden","eindhoven","haarlem","hellevoetsluis","hilversum","katwijk","lelystad","maassluis","middelburg","rijnmond","tilburg","utrecht","vlissingen","voorburg","voorne-putten","walcheren","west-friesland","zaandam","zaanstreek-waterland","024-bot","afrithonbot","ai","amradio","analyser","angrynerds","bemesh","buch","burgernet","chatgpt","dares","dekroeg","dtis","english","evenvroegopstaan","fosdem","gezellig","gmr","gmrbot","goedemorgen","gyverbot","haagscourant","hackerspacenijmegen","hamradionederland","hetweerinjegemeente","hsnl","jokes","kanalen","koffie","linux","nerd","nl-alert","nl-prio","noodkanaal","nsagov","pi4hm","pi4utr","pingbot","sensemakers","sports","survival","uitdagingen","valleibot","valleirug","vleesboek","wardrive","weer","australia","sydney","melbourne","brisbane","perth","adelaide","newzealand","new-zealand","auckland","wellington","japan","tokyo","osaka","kyoto","southkorea","south-korea","korea","seoul","taiwan","taipei","singapore","hongkong","hong-kong","india","mumbai","delhi","bangalore","brazil","saopaulo","sao-paulo","rio","mexico","mexicocity","mexico-city","guadalajara","tijuana","gps","location","tracking","tracker","position","coordinates","sensor","sensors","telemetry","data","iot","aprs","beacon","beacons","ping","pings","debug","admin","ops","operations","monitor","monitoring","security","secure","private","encrypted","hiking","camping","outdoors","outdoor","backcountry","trails","offroad","off-road","overlanding","jeep","offroading","sailing","boating","marine","maritime","aviation","flying","pilots","drone","drones","weather","wx","storm","storms","skywarn","traffic","commute","transit","community","group","team","club","family","friends","neighbors","neighborhood","block","street","local","town","city","county","region","north","south","east","west","central","downtown","uptown","midtown","home","house","cabin","ranch","farm","test1","test2","test3","test4","test5","channel1","channel2","channel3","mesh1","mesh2","mesh3","group1","group2","group3","team1","team2","team3","net1","net2","net3","relay","relays","link","links","hub","hubs","core","backbone","qso","ragchew","net","nets","roundtable","simplex","duplex","vhf","uhf","hf","2m","70cm","33cm","23cm","900mhz","915mhz","ism","ism-band","ism915","ism868","license-free","event","events","exercise","drill","training","practice","race","marathon","cycling","running","triathlon","ironman","festival","concert","gathering","meetup","meet-up","convention","hamfest","ham-fest","field-day","fieldday","winter-field-day","sota","pota","summits","parks","parks-on-the-air","2024","2025","2026","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec","winter","spring","summer","fall","autumn","mountain","mountains","hills","peak","summit","ridge","canyon","beach","coast","coastal","shore","bay","lake","river","creek","park","forest","woods","desert","island","peninsula","urban","suburban","rural","metro","area","zone","sector","base","mobile","portable","handheld","fixed","station","primary","secondary","backup","alternate","spare","alpha","bravo","charlie","delta","echo","foxtrot","red","blue","green","yellow","orange","purple","black","white","trace","traces","log","logs","metrics","stats","statistics","raw","stream","feed","live","realtime","real-time","sync","replication","mirror","copy","archive","open","closed","free","premium","pro","plus","lite","basic","new","old","legacy","current","next","future","one","two","three","four","five","six","seven","eight","nine","ten","hamradio","ham-radio","amateurradio","amateur-radio","arrl","dxcc","dxing","morsecode","morse-code","fldigi","js8call","winlink","vara","pactor","packet","ax25","aprsmesh","qrp","qro","qrz","qsl","qth","ragchew","rag-chew","elmer","elmers","technician","amateur","microwave","satellite","ariss","amsat","cubesat","sdr","rtlsdr","rtl-sdr","hackrf","portapack","yaesu","icom","kenwood","elecraft","flexradio","alinco","baofeng","quansheng","antennas","dipole","vertical","yagi","efhw","endfed","wwff","iota","contesting","cwops","auxcomm","satern","maker","makers","makerspace","maker-space","hackerspace","hacker-space","fablab","fab-lab","doityourself","homebrew","home-brew","fromscratch","arduino","esp32","esp8266","stm32","teensy","pico","rp2040","attiny","raspberrypi","raspberry-pi","rpi","beaglebone","beagle-bone","orangepi","orange-pi","kicad","eagle","altium","oshpark","jlcpcb","pcbway","soldering","throughhole","oscilloscope","multimeter","logicanalyzer","logic-analyzer","testbench","3dprinting","3d-printing","3dprint","printer","prusa","ender","creality","bambu","voron","lasercutter","laser-cutter","woodworking","metalworking","welding","resin","fdm","sla","fusion360","fusion-360","freecad","openscad","solidworks","programming","coding","software","developer","developers","devops","sysadmin","linux","unix","bsd","freebsd","openbsd","netbsd","macos","windows","android","ios","python","javascript","typescript","rust","golang","java","kotlin","swift","ruby","perl","csharp","dotnet","haskell","lisp","clojure","elixir","erlang","react","angular","svelte","nodejs","deno","nextjs","nuxt","docker","kubernetes","terraform","ansible","puppet","vagrant","github","gitlab","bitbucket","opensource","open-source","foss","floss","homelab","home-lab","selfhost","self-host","selfhosted","self-hosted","homelabbers","homeassistant","home-assistant","hass","openhab","domoticz","nodered","node-red","mqtt","zigbee","zwave","thread","wifi","bluetooth","rfid","infosec","cybersec","cybersecurity","cyber-security","netsec","opsec","hacking","hacker","hackers","pentest","pentesting","redteam","red-team","blueteam","blue-team","capture-the-flag","bugbounty","bug-bounty","vuln","exploit","malware","reverse","defcon","blackhat","bsides","shmoocon","derbycon","toorcon","hacktheplanet","lockpicking","locksport","toool","deviant","socialeng","social-eng","osint","privacy","anonymity","encryption","crypto","signal","hiking","hiker","hikers","backpacking","backpacker","thru-hike","thruhike","camper","campers","glamping","dispersed","primitive","wilderness","climbing","climber","climbers","rockclimbing","rock-climbing","bouldering","trad","sport","mountaineering","alpine","peaks","fourteeners","14ers","highpoints","skiing","skier","snowboard","snowboarder","backcountry-ski","touring","splitboard","kayak","kayaking","kayaker","canoe","canoeing","paddle","paddling","paddleboard","surfing","surfer","surfers","bodyboard","longboard","shortboard","waves","scuba","freedive","freediving","snorkel","underwater","spearfishing","fishing","angler","anglers","flyfishing","fly-fishing","trout","hunting","hunter","hunters","archery","bowhunting","bow-hunting","rifle","shotgun","cyclist","biking","bicycle","bicycling","roadbike","road-bike","mountainbike","mountain-bike","mountainbiking","mountain-biking","trailriding","ebike","e-bike","ebikes","electric-bike","peloton","strava","zwift","gravel","gravelbike","gravel-bike","bikepacking","bike-packing","randonneur","fixie","fixedgear","fixed-gear","singlespeed","single-speed","commuter","offroading","off-roading","fourwheeling","4wd","awd","jeeping","wrangler","gladiator","tacoma","runner","4runner","overland","overlander","rooftoptent","rooftop-tent","expedition","utv","sxs","sidebyside","side-by-side","rzr","canam","polaris","dirtbike","dirt-bike","motocross","enduro","dualsport","dual-sport","motorcycle","moto","harley","sportbike","cruiser","rving","motorhome","campervan","camper-van","vanlife","van-life","skoolie","trucker","trucking","diesel","semi","bigrig","big-rig","pilot","pilots","flying","flight","airplane","aircraft","planes","cessna","piper","cirrus","beechcraft","mooney","bonanza","skyhawk","helicopter","heli","rotor","rotorcraft","chopper","robinson","glider","gliding","soaring","sailplane","paraglider","paragliding","hangglider","drones","uav","uas","fpv","quadcopter","multirotor","mavic","phantom","rocketry","rockets","hpr","nar","tripoli","model-rocket","amateur-rocket","spacex","nasa","esa","starlink","starship","falcon","artemis","boat","boats","boater","boaters","yachting","yacht","sail","sailor","powerboat","speedboat","fishing-boat","pontoon","jetski","jet-ski","pwc","waverunner","marina","harbor","harbour","dock","pier","anchorage","mooring","liveaboard","cruising","bluewater","blue-water","inshore","intracoastal","marine-radio","marineradio","ais","chartplotter","navionics","opencpn","prepper","preppers","prepping","survival","survivalist","shtf","teotwawki","bol","bugout","bug-out","bugin","bug-in","edc","everyday-carry","loadout","firstaid","first-aid","trauma","tccc","stopthebleed","aed","waterpurification","water-purification","berkey","sawyer","lifestraw","foodstorage","food-storage","canning","dehydrating","freezedried","freeze-dried","battery","generator","inverter","offgrid","off-grid","griddown","grid-down","communications","gmrs","frs","murs","citizens-band","shortwave","homestead","homesteading","homesteader","farming","farmer","farmers","ranching","garden","gardening","gardener","permaculture","organic","regenerative","sustainable","chickens","poultry","goats","sheep","cattle","pigs","livestock","beekeeping","bees","apiary","greenhouse","hydroponics","aquaponics","vertical-farm","indoor-garden","growroom","grow-room","meteorology","stormchasing","storm-chasing","tornado","hurricane","earthquake","quake","seismic","tsunami","volcano","volcanic","geology","geologist","astronomy","stargazing","telescope","astrophotography","astrophoto","deepsky","deep-sky","citizen-science","citizenscience","research","science","stem","education","learning","gaming","gamer","gamers","videogames","video-games","pcgaming","pc-gaming","console","esports","e-sports","competitive","tournament","lan-party","retrogaming","minecraft","terraria","valheim","rust-game","dayz","tarkov","pubg","fortnite","apex","virtualreality","virtual-reality","augmentedreality","augmented-reality","oculus","tabletop","boardgames","board-games","dungeons-dragons","ttrpg","pathfinder","musician","musicians","bands","livemusic","live-music","concerts","guitar","guitarist","bassist","drums","drummer","keyboard","synth","synthesizer","production","producer","producers","beatmaking","beat-making","ableton","flstudio","audiophile","hifi","hi-fi","vinyl","records","turntable","headphones","speakers","podcast","podcasting","podcaster","streaming","streamer","twitch","youtube","content","photography","photographer","photographers","photog","cameras","dslr","mirrorless","canon","nikon","fuji","fujifilm","panasonic","olympus","leica","hasselblad","portrait","wildlife","macro","nightsky","night-sky","timelapse","videography","videographer","filmmaker","filmmaking","cinematography","editing","premiere","davinci","finalcut","final-cut","aftereffects","after-effects","vfx","artist","artists","artwork","creative","creatives","designer","designers","illustration","illustrator","drawing","sketch","sketching","digital-art","digitalart","graphicdesign","graphic-design","uiux","ui-ux","webdesign","web-design","animation","animator","motion","motiongraphics","motion-graphics","3dart","3d-art","blender","foodie","foodies","cooking","cooks","chef","chefs","culinary","kitchen","barbecue","grilling","smoking","smoker","brisket","ribs","pulled-pork","lownslow","baking","baker","sourdough","pastry","dessert","cakes","cookies","brewing","craft-beer","craftbeer","ipa","lager","stout","espresso","barista","roasting","whiskey","bourbon","cocktails","fitness","workout","lifting","weightlifting","powerlifting","bodybuilding","crossfit","hiit","cardio","runners","ultramarathon","triathlete","swimming","swimmer","openwater","open-water","yoga","pilates","meditation","mindfulness","wellness","nutrition","basketball","football","soccer","baseball","hockey","tennis","volleyball","dogs","puppy","puppies","canine","dogtraining","dog-training","cats","kitten","kittens","feline","meow","pets","animals","birding","birdwatching","bird-watching","aquarium","reeftank","reef-tank","saltwater","freshwater","planted-tank","reptiles","reptile","snakes","lizard","gecko","bearded-dragon","neighborhood","nextdoor","meet-up","volunteer","volunteering","nonprofit","non-profit","charity","mutual-aid","mutualaid","parents","parenting","families","children","youth","teens","seniors","lgbtq","pride","queer","nonbinary","ally","allies","inclusive","diversity","burningman","burning-man","playa","blackrock","coachella","sxsw","defcon","hope","layerone","layer-one","supercon","makerfaire","maker-faire","bamboozle","lightning","ragbrai","burnitdown","burning","regional","decomp","toorcamp","chaos","congress","hackathon","ctf-event","capture","wardriving","foxhunt","fox-hunt","brc","ttitd","center-camp","centercamp","esplanade","deep-playa","effigy","temple","soundcamp","sound-camp","mutant-vehicle","art-car","ranger","rangers","lamplighters","dgs","leave-no-trace","moop","gifting","radical-self","immediacy","participation","decommodification","overlandexpo","overland-expo","overlandtrail","overland-trail","overlandbound","overlandjournal","adventurebike","adventure-bike","dirtevery","rubicontrail","rubicon-trail","moab","deathvalley","death-valley","joshua-tree","joshuatree","bigbear","big-bear","mammoth","tahoe","yosemite","sequoia","kingscyn","kings-canyon","meshcore","mesh-core","meshcore-test","meshcore-dev","meshcore-beta","mctest","mc-test","mcdev","mc-dev","mcmain","mc-main","mcpublic","meshcorebot","meshcore-bot","mcbot","mc-bot","meshchat","mesh-chat","meshnet","mesh-net","meshnetwork","mesh-network","meshlink","mesh-link","meshhub","mesh-hub","meshnode","mesh-node","meshrelay","mesh-relay","meshgateway","mesh-gateway","meshbridge","mesh-bridge","meshrouter","meshtalk","mesh-talk","meshvoice","mesh-voice","meshdata","mesh-data","meshsensor","mesh-sensor","meshtrack","mesh-track","meshgps","mesh-gps","meshmap","mesh-map","meshstatus","mesh-status","meshping","mesh-ping","meshtest","mesh-test","meshtesting","mesh-testing","meshdev","mesh-dev","meshops","mesh-ops","meshadmin","mesh-admin","meshmon","mesh-mon","meshlog","mesh-log","meshdebug","mesh-debug","meshdiag","mesh-diag","meshcore-alpha","meshcore-stable","meshcore-main","meshcore-local","mc-alpha","mc-beta","mc-stable","mc-local","mc-ops","mc-admin","meshcoretest","meshcoredev","meshcorebeta","meshcorealpha","meshcoremain","meshcorelocal","meshcoreops","meshcoreadmin","meshcoremon","meshcorelog","meshcorechat","meshcorenet","meshcorelink","meshcorehub","meshcorenode","meshcorerelay","meshcoregateway","meshcorebridge","meshcorerouter","meshcoresensor","meshcoretrack","meshcoregps","meshcoremap","meshcoreping","mcnetwork","mc-network","mcchat","mc-chat","mclink","mc-link","mchub","mc-hub","mcnode","mc-node","mcrelay","mc-relay","mcgateway","mc-gateway","mcbridge","mc-bridge","mcrouter","mc-router","mcsensor","mc-sensor","mctrack","mc-track","mcgps","mc-gps","mcmap","mc-map","mcstatus","mc-status","mcping","mc-ping","mcmon","mc-mon","mclog","mc-log","mcdebug","mc-debug","mcdiag","mc-diag","meshroom","mesh-room","meshrooms","mesh-rooms","meshserver","mesh-server","meshclient","mesh-client","meshcompanion","mesh-companion","meshrepeater","mesh-repeater","meshbase","mesh-base","meshportal","mesh-portal","meshtastic","mesh-tastic","meshtastictest","meshtastic-test","meshtasticdev","meshtastic-dev","meshtasticlocal","meshtastic-local","mttest","mt-test","mtdev","mt-dev","mtlocal","mt-local","longfast","long-fast","longmod","long-mod","longslow","long-slow","shortfast","short-fast","shortslow","short-slow","medfast","med-fast","medslow","med-slow","verylongslow","very-long-slow","meshtastic-alpha","meshtastic-beta","meshtastic-main","meshtastic-stable","meshtasticbeta","meshtasticalpha","meshtasticmain","meshtasticstable","mtbeta","mt-beta","mtalpha","mt-alpha","mtmain","mt-main","mtstable","mt-stable","mtops","mt-ops","mtadmin","mt-admin","mtchat","mt-chat","mtnet","mt-net","mtlink","mt-link","mthub","mt-hub","mtnode","mt-node","mtrelay","mt-relay","longrange","long-range","shortrange","short-range","medrange","med-range","ultralong","ultra-long","ultrafast","ultra-fast","ultraslow","ultra-slow","mediumfast","medium-fast","mediumslow","medium-slow","mediummod","medium-mod","turbofast","turbo-fast","turboslow","turbo-slow","lora","lo-ra","lorawan","lora-wan","loratest","lora-test","loradev","lora-dev","loranet","lora-net","loramesh","lora-mesh","loralink","lora-link","lorahub","lora-hub","loranode","lora-node","lora915","lora-915","lora868","lora-868","lora433","lora-433","sx1262","sx1276","sx1278","semtech","chirp","chirpstack","lorabeta","lora-beta","loraalpha","lora-alpha","loramain","lora-main","lorastable","lora-stable","loraops","lora-ops","loraadmin","lora-admin","lorachat","lora-chat","lorarelay","lora-relay","loragateway","lora-gateway","lorabridge","lora-bridge","lorarouter","lora-router","loraserver","lora-server","lorasensor","lora-sensor","loratrack","lora-track","loragps","lora-gps","loramap","lora-map","lorastatus","lora-status","loraping","lora-ping","loramon","lora-mon","loralog","lora-log","loradebug","lora-debug","lora923","lora-923","lora865","lora-865","lora470","lora-470","sx1261","sx1280","sx1268","sx126x","sx127x","sx128x","llcc68","lr1110","lr1120","lr1121","stm32wl","ra01","ra02","heltec","heltec-lora","ttgo","ttgo-lora","lilygo","lilygo-lora","rak","rak-lora","rak4631","rak3172","rak811","wisblock","test","testing","test1","test2","test3","test123","testchannel","test-channel","testnet","test-net","testmesh","test-mesh","dev","devel","develop","development","devtest","dev-test","sandbox","playground","scratch","temp","temporary","tmp","debug","debugging","diag","diagnostic","diagnostics","alpha","beta","gamma","canary","nightly","unstable","stable","experiment","experimental","trial","pilot","prototype","poc","test4","test5","test6","test7","test8","test9","test10","test01","test02","test03","test-1","test-2","test-3","testA","testB","testC","test-a","test-b","test-c","testing1","testing2","testing3","testing-1","testing-2","testing-3","devnet","dev-net","devmesh","dev-mesh","devchannel","dev-channel","stagenet","stage-net","staging","stage","stagetest","stage-test","qanet","qa-net","qa","qatest","qa-test","qachannel","qa-channel","labnet","lab-net","lab","labtest","lab-test","testlab","test-lab","benchnet","bench-net","benchmark","bench","perftest","perf-test","loadtest","load-test","stresstest","stress-test","smoketest","smoke-test","unittest","unit-test","integtest","integ-test","e2etest","e2e-test","mocknet","mock-net","mock","faker","dummy","sample","example","demonet","demo-net","demo","showcase","preview","prerelease","pre-release","release","rc","release-candidate","releasecandidate","final","production","emergency","emergencies","emer","emerg","911","999","112","sos","mayday","help","rescue","distress","urgent","priority","alert","alerts","warning","warnings","alarm","alarms","safety","safe","danger","hazard","caution","critical","evacuation","evac","evacuate","shelter","shelterinplace","shelter-in-place","lockdown","allclear","all-clear","fire","fires","wildfire","wildfires","brushfire","forestfire","flood","floods","flooding","flashflood","flash-flood","quake","earthquake","aftershock","tsunami","tremor","tornado","hurricane","cyclone","typhoon","storm","severe","missing","missingperson","missing-person","amber","silveralert","medical","medic","ems","ambulance","paramedic","firstaid","first-aid","police","sheriff","lawenforcement","law-enforcement","cert","cert-team","certteam","voad","redcross","red-cross","emergencynet","emergency-net","emergencychannel","emergency-channel","emeralert","emer-alert","sosnet","sos-net","soschannel","sos-channel","maydaynet","mayday-net","maydaychannel","mayday-channel","helpnet","help-net","helpchannel","help-channel","helpline","help-line","rescuenet","rescue-net","rescuechannel","rescue-channel","rescueteam","rescue-team","disaster","disasters","disasternet","disaster-net","disasterrelief","disaster-relief","crisis","crisisnet","crisis-net","crisischannel","crisis-channel","incident","incidentnet","incident-net","incidentchannel","incident-channel","alertnet","alert-net","alertchannel","alert-channel","alertsystem","alert-system","warningnet","warning-net","warningchannel","warning-channel","safetynet","safety-net","safetychannel","safety-channel","safetycheck","safety-check","hazardnet","hazard-net","hazardchannel","hazard-channel","hazmat","haz-mat","firenet","fire-net","firechannel","fire-channel","firefighter","fire-fighter","firedept","fire-dept","firehouse","fire-house","firestation","fire-station","wildfirenet","wildfire-net","wildfirechannel","wildfire-channel","campfire","camp-fire","structurefire","structure-fire","grassfire","grass-fire","floodnet","flood-net","floodchannel","flood-channel","floodwatch","flood-watch","floodwarning","flood-warning","highwater","high-water","risingwater","rising-water","earthquakenet","earthquake-net","earthquakechannel","earthquake-channel","tornadonet","tornado-net","tornadochannel","tornado-channel","hurricanenet","hurricane-net","hurricanechannel","hurricane-channel","stormnet","storm-net","stormchannel","storm-channel","severeweather","severe-weather","medicalnet","medical-net","medicalchannel","medical-channel","traumanet","trauma-net","traumachannel","trauma-channel","traumacenter","trauma-center","hospital","hospitals","clinic","clinics","urgent-care","urgentcare","poisoncontrol","poison-control","cpr-net","cprnet","lifesaver","life-saver","searchandrescue","search-and-rescue","sar","sarnet","sar-net","sarteam","sar-team","coastguard","coast-guard","uscg","lifeguard","life-guard","beachpatrol","beach-patrol","mountainrescue","mountain-rescue","caverescue","cave-rescue","swiftwater","swift-water","k9unit","k9-unit","searchdog","search-dog","rescuedog","rescue-dog","civildefense","civil-defense","fema","dhs","oem","eoc","eocnet","eoc-net","weather","wx","wxalert","wx-alert","wxwatch","wx-watch","wxwarning","wx-warning","wxreport","wx-report","wxupdate","wx-update","forecast","conditions","climate","temperature","temp","temps","rain","rainfall","precipitation","precip","snow","snowfall","wind","winds","windy","gust","gusts","breeze","humidity","humid","dewpoint","dew-point","barometer","pressure","sunny","cloudy","overcast","fog","foggy","mist","haze","smog","heat","heatwave","heat-wave","cold","coldsnap","cold-snap","freeze","lightning","thunder","thunderstorm","tstorm","t-storm","hail","sleet","ice","icy","blackice","black-ice","frost","noaa","nws","skywarn","spotter","spotters","stormspotter","weathernet","weather-net","weatherchannel","weather-channel","wxnet","wx-net","wxchannel","wx-channel","wxstation","wx-station","forecastnet","forecast-net","forecastchannel","forecast-channel","localwx","local-wx","localweather","local-weather","dailywx","daily-wx","hourlywx","hourly-wx","weeklyforecast","weekly-forecast","rainnet","rain-net","rainchannel","rain-channel","rainalert","rain-alert","rainwatch","rain-watch","rainwarning","rain-warning","heavyrain","heavy-rain","snownet","snow-net","snowchannel","snow-channel","snowalert","snow-alert","snowwatch","snow-watch","snowwarning","snow-warning","heavysnow","heavy-snow","blizzard","blizzardwatch","blizzard-watch","blizzardwarning","blizzard-warning","windnet","wind-net","windchannel","wind-channel","windalert","wind-alert","windwatch","wind-watch","windwarning","wind-warning","highwind","high-wind","tempnet","temp-net","tempchannel","temp-channel","tempalert","temp-alert","heatnet","heat-net","heatchannel","heat-channel","heatalert","heat-alert","heatwatch","heat-watch","heatwarning","heat-warning","extremeheat","extreme-heat","coldnet","cold-net","coldchannel","cold-channel","coldalert","cold-alert","coldwatch","cold-watch","coldwarning","cold-warning","extremecold","extreme-cold","winterstorm","winter-storm","icestorm","ice-storm","freezingrain","freezing-rain","thunderstormnet","thunderstorm-net","thunderstormwatch","thunderstorm-watch","thunderstormwarning","thunderstorm-warning","severethunderstorm","severe-thunderstorm","lightningnet","lightning-net","lightningchannel","lightning-channel","lightningalert","lightning-alert","lightningwatch","lightning-watch","tornadowatch","tornado-watch","tornadowarning","tornado-warning","hurricanewatch","hurricane-watch","hurricanewarning","hurricane-warning","tropicalstorm","tropical-storm","tropicaldepression","tropical-depression","stormwatch","storm-watch","stormwarning","storm-warning","stormalert","storm-alert","skywarnnet","skywarn-net","skywarnchannel","skywarn-channel","spotternetwork","spotter-network","stormchase","storm-chase","stormchaser","storm-chaser","amateurwx","amateur-wx","citizenwx","citizen-wx","pwswx","pws-wx","weatherstation","weather-station","wxstation","wx-station","metar","taf","status","stat","stats","statistics","metrics","health","healthcheck","monitor","monitoring","mon","watch","watcher","watchdog","uptime","downtime","outage","outages","incident","incidents","report","reports","reporting","update","updates","bulletin","announce","announcement","announcements","broadcast","broadcasts","notify","notification","notifications","ping","pong","heartbeat","check","checkin","check-in","checkout","check-out","rollcall","roll-call","statusnet","status-net","statuschannel","status-channel","statusupdate","status-update","statusreport","status-report","statuscheck","status-check","statusboard","status-board","monitornet","monitor-net","monitorchannel","monitor-channel","monitoringnet","monitoring-net","monitoringchannel","monitoring-channel","watchnet","watch-net","watchchannel","watch-channel","watchlist","watch-list","healthnet","health-net","healthchannel","health-channel","healthstatus","health-status","uptimenet","uptime-net","uptimechannel","uptime-channel","uptimemonitor","uptime-monitor","outagenet","outage-net","outagechannel","outage-channel","outagereport","outage-report","incidentnet","incident-net","incidentchannel","incident-channel","incidentreport","incident-report","incidentresponse","incident-response","alertsnet","alerts-net","alertschannel","alerts-channel","updatenet","update-net","updatechannel","update-channel","updatefeed","update-feed","bulletinnet","bulletin-net","bulletinchannel","bulletin-channel","bulletinboard","bulletin-board","noticeboard","notice-board","announcenet","announce-net","announcechannel","announce-channel","broadcastnet","broadcast-net","broadcastchannel","broadcast-channel","notifynet","notify-net","notifychannel","notify-channel","pingnet","ping-net","pingchannel","ping-channel","pingtest","ping-test","heartbeatnet","heartbeat-net","heartbeatchannel","heartbeat-channel","rollcallnet","rollcall-net","rollcallchannel","rollcall-channel","checkinnet","checkin-net","checkinchannel","checkin-channel","headcount","head-count","accountability","welfare","wellbeing","well-being","ops","operations","opsnet","ops-net","opschannel","ops-channel","admin","admins","administrator","root","superuser","sudo","control","command","cmd","hq","headquarters","base","basecamp","dispatch","dispatcher","coord","coordinate","coordination","tactical","tac","tacnet","tac-net","tacchannel","tac-channel","logistics","logi","supply","supplies","resource","resources","comms","comm","communications","radio","radionet","radio-net","opsteam","ops-team","opsgroup","ops-group","opscenter","ops-center","opsroom","ops-room","opsdesk","ops-desk","opslead","ops-lead","adminnet","admin-net","adminchannel","admin-channel","adminteam","admin-team","adminops","admin-ops","admingroup","admin-group","admindesk","admin-desk","controlnet","control-net","controlchannel","control-channel","controlroom","control-room","controlcenter","control-center","commandnet","command-net","commandchannel","command-channel","commandpost","command-post","commandcenter","command-center","hqnet","hq-net","hqchannel","hq-channel","hqops","hq-ops","dispatchnet","dispatch-net","dispatchchannel","dispatch-channel","dispatchcenter","dispatch-center","dispatchdesk","dispatch-desk","coordnet","coord-net","coordchannel","coord-channel","coordteam","coord-team","coordcenter","coord-center","coordinationcenter","coordination-center","tacops","tac-ops","tacteam","tac-team","tacgroup","tac-group","taccom","tac-com","taccomms","tac-comms","tacradio","tac-radio","logisticsnet","logistics-net","logisticschannel","logistics-channel","logisticsteam","logistics-team","logisticsops","logistics-ops","supplynet","supply-net","supplychannel","supply-channel","supplychain","supply-chain","resourcenet","resource-net","resourcechannel","resource-channel","commsnet","comms-net","commschannel","comms-channel","commsteam","comms-team","commsops","comms-ops","commscheck","comms-check","commstest","comms-test","radioops","radio-ops","radioteam","radio-team","radiocheck","radio-check","netcontrol","net-control","netops","net-ops","noc","nocnet","noc-net","info","information","infochannel","info-channel","fyi","news","newsfeed","news-feed","headlines","breaking","latest","traffic","trafficreport","traffic-report","roadconditions","road-conditions","transit","bus","train","subway","metro","commute","commuter","events","calendar","schedule","agenda","upcoming","whats-on","infonet","info-net","infohub","info-hub","infodesk","info-desk","infoboard","info-board","infopoint","info-point","infoline","info-line","newsnet","news-net","newschannel","news-channel","newshub","news-hub","newsdesk","news-desk","newsroom","news-room","newsflash","news-flash","breakingnews","breaking-news","latestnews","latest-news","topnews","top-news","localnews","local-news","regionalnews","regional-news","worldnews","world-news","trafficnet","traffic-net","trafficchannel","traffic-channel","trafficupdate","traffic-update","trafficalert","traffic-alert","roadnet","road-net","roadchannel","road-channel","roadupdate","road-update","transitnet","transit-net","transitchannel","transit-channel","transitupdate","transit-update","transitalert","transit-alert","busnet","bus-net","buschannel","bus-channel","busupdate","bus-update","trainnet","train-net","trainchannel","train-channel","trainupdate","train-update","subwaynet","subway-net","subwaychannel","subway-channel","metronet","metro-net","metrochannel","metro-channel","metroupdate","metro-update","commuternet","commuter-net","commuterchannel","commuter-channel","eventsnet","events-net","eventschannel","events-channel","eventshub","events-hub","eventcalendar","event-calendar","localevents","local-events","calendarnet","calendar-net","calendarchannel","calendar-channel","schedulenet","schedule-net","schedulechannel","schedule-channel","agendanet","agenda-net","agendachannel","agenda-channel","upcomingnet","upcoming-net","upcomingchannel","upcoming-channel","location","locations","gps","position","positions","coordinates","track","tracker","tracking","trace","tracer","tracing","beacon","beacons","waypoint","waypoints","checkpoint","checkpoints","geofence","geolocation","geo","mapping","maps","navigate","navigation","locationnet","location-net","locationchannel","location-channel","locationtrack","location-track","locationshare","location-share","gpsnet","gps-net","gpschannel","gps-channel","gpstrack","gps-track","gpsshare","gps-share","gpslog","gps-log","gpsdata","gps-data","positionnet","position-net","positionchannel","position-channel","positiontrack","position-track","positionshare","position-share","coordnet","coord-net","coordchannel","coord-channel","coordshare","coord-share","tracknet","track-net","trackchannel","track-channel","trackshare","track-share","trackingnet","tracking-net","trackingchannel","tracking-channel","tracernet","tracer-net","tracerchannel","tracer-channel","beaconnet","beacon-net","beaconchannel","beacon-channel","beacontrack","beacon-track","beaconshare","beacon-share","waypointnet","waypoint-net","waypointchannel","waypoint-channel","waypointshare","waypoint-share","waypointlog","waypoint-log","checkpointnet","checkpoint-net","checkpointchannel","checkpoint-channel","geofencenet","geofence-net","geofencechannel","geofence-channel","geofencealert","geofence-alert","geozonenet","geozone-net","geonet","geo-net","geochannel","geo-channel","geotrack","geo-track","mappingnet","mapping-net","mappingchannel","mapping-channel","mapnet","map-net","mapchannel","map-channel","mapshare","map-share","navnet","nav-net","navchannel","nav-channel","navtrack","nav-track","navigationnet","navigation-net","navigationchannel","navigation-channel","fleettrack","fleet-track","fleetnet","fleet-net","assettrack","asset-track","whereis","where-is","findme","find-me","locateme","locate-me","nocap","no-cap","frfr","fr-fr","bussin","sheesh","slay","slaps","goated","goat","goats","based","cringe","mid","lowkey","highkey","vibe","vibes","vibing","vibecheck","vibe-check","goodvibes","good-vibes","sus","sussy","sussy-baka","imposter","amongus","among-us","bet","bets","yeet","yeeted","yoink","skibidi","rizz","ohio","bruh","bruv","fam","bestie","besties","squad","squadgoals","squad-goals","slayyy","periodt","purr","queen","king","icon","iconic","legend","main-character","maincharacter","npc","npcs","side-quest","sidequest","understood-the-assignment","ate","served","mother","mothering","rent-free","rentfree","living-rent-free","touch-grass","touchgrass","copium","hopium","doom","doomer","bloomer","zoomer","zoomers","ratio","ratiod","caught-in-4k","receipts","tea","spillthetea","spill-the-tea","simp","simping","stan","stanning","oomf","moots","mutuals","tiktok","fyp","foryou","for-you","foryoupage","trending","viral","cheugy","basic","pick-me","pickme","girlboss","girl-boss","iykyk","iyky","ifykyk","valid","hits-different","hitsdifferent","unhinged","chaotic","feral","unalive","delulu","delusion","bereal","be-real","dump","photodump","photo-dump","core","coded","aesthetic","cottagecore","darkacademia","dark-academia","goblinmode","goblin-mode","softlaunch","soft-launch","hardlaunch","hard-launch","ngl","tbh","ong","on-god","ongod","deadass","dead-ass","fr","real","cap","capping","no-cap-fr","nocapfr","respectfully","allegedly","understood","assignment","ate-that","atethat","devoured","cleared","snatched","slayed","bodied","ended","finished","done","over","deceased","screaming","crying","sobbing","im-weak","imweak","sending-me","sendingme","its-giving","itsgiving","giving","serve","serving","ate-left-no-crumbs","main","protagonist","background-character","backgroundcharacter","side-character","sidecharacter","villain-era","villainera","redemption-arc","character-development","characterdevelopment","plot-twist","plottwist","lore","lore-drop","loredrop","deep-lore","deeplore","canon","fanon","ick","icks","red-flag","redflag","green-flag","greenflag","beige-flag","situationship","talking-stage","talkingstage","roster","rotation","era","eras","villain-arc","healing-era","flop-era","flopping","ate-and-left","understood-assignment","no-thoughts","nothoughts","brain-rot","brainrot","rotted","chronically-online","chronicallyonline","parasocial","hyperfixation","hyperfixating","special-interest","infodump","info-dump","infodumping","yapping","yap","yapper","glazing","glaze","glazer","meat-riding","meatriding","dickriding","aura","aura-points","aurapoints","negative-aura","positiveaura","sigma","sigma-grindset","sigmagrindset","alpha","beta","omega","mewing","mew","looksmax","looksmaxxing","mogging","mog","mogger","gyat","gyatt","bussin-bussin","respectfully-disrespectfully","real-ones","realones","day-ones","dayones","ride-or-die","rideordie","caught-lacking","caughtlacking","down-bad","downbad","down-tremendous","downhorrendous","down-horrendous","astronomically-down","abysmal","its-joever","joever","its-so-over","we-are-so-back","weareback","lock-in","lockin","locked-in","lockedin","locked-tf-in","cooked","cooking","cookin","chef","michelin","gourmet","fr-ong","frong","no-diddy","nodiddy","pause","unpause","resume","edging","edged","gooning","gooned","fanum-tax","fanumtax","hawk-tuah","hawktuah","kai-cenat","speed","ishowspeed","prime","adulting","adult","grown","grownup","grown-up","oldmillennial","avocadotoast","avocado-toast","brunch","brunching","mimosas","doggo","doggie","pupper","puppers","floof","chonk","chonky","birb","smol","smoll","smolbean","smol-bean","boop","snoot","blep","mlem","feels","allthefeels","all-the-feels","rightinthefeels","right-in-the-feels","mood","bigmood","big-mood","sadboi","sad-boi","sadgirl","sad-girl","aesthetic","vsco","vsco-girl","vscogirl","sksksk","andioop","and-i-oop","netflix","netflixandchill","netflix-and-chill","binge","bingewatch","throwback","tbt","throwbackthursday","throwback-thursday","flashback","nostalgia","nostalgic","90skid","90s-kid","80skid","80s-kid","pokemon","pikachu","nintendo","zelda","mario","sonic","sega","harrypotter","harry-potter","hogwarts","hufflepuff","gryffindor","slytherin","ravenclaw","muggle","potterhead","potter-head","starwars","star-wars","jedi","sith","mandalorian","mando","yoda","marvel","mcu","avengers","thanos","ironman","iron-man","spiderman","lotr","lordoftherings","lord-of-the-rings","hobbit","gandalf","frodo","gameofthrones","game-of-thrones","got","thrones","winteriscoming","nailed-it","nailedit","winning","fail","fails","epic","epicfail","fml","yolo","swag","swagger","legit","literally","literally-cant","cant-even","canteven","dying","dead","imdead","im-dead","deceased","goals","lifegoals","life-goals","relationshipgoals","relationship-goals","bae","babe","babes","hubby","wifey","fiance","soulmate","soul-mate","foodporn","food-porn","foodie","nomnom","nom-nom","yummy","delish","wanderlust","travelbug","travel-bug","jetset","jet-set","jetsetter","selfie","selfies","selfietime","selfie-time","groupie","photobomb","blessed","grateful","thankful","humbled","mindblown","mind-blown","extra","salty","shook","triggered","woke","cancelled","cancel","ghosting","ghosted","ghost","friendzone","friend-zone","friendzoned","shade","throwing-shade","tea","spill","spilltea","spill-tea","savage","clap-back","clapback","drag","dragged","read","receipts","tfw","mfw","mrw","dae","eli5","tldr","tl-dr","ama","iama","reddit","redditor","upvote","downvote","karma","cakeday","cake-day","meme","memes","dank","dankmemes","dank-memes","memelord","meme-lord","oldmillenial","xennial","geriatricmillennial","geriatric-millennial","youngmillennial","young-millennial","eldermillennial","elder-millennial","millennialproblems","millennial-problems","millenniallife","millennial-life","firstworldproblems","first-world-problems","struggle","struggles","thestruggle","broke","brokemillennial","broke-millennial","studentloans","student-loans","sidehustle","side-hustle","hustleculture","hustle-culture","grind","grinding","worklifebalance","work-life-balance","burnout","burn-out","selfcare","self-care","treatyoself","treat-yo-self","treatyourself","indulgence","splurge","athleisure","leggings","yoga","yogapants","yoga-pants","pilates","kale","quinoa","acai","matcha","oatmilk","oat-milk","plantbased","plant-based","glutenfree","gluten-free","organic","nongmo","non-gmo","farmtotable","farm-to-table","craftbeer","craft-beer","craftcocktails","craft-cocktails","speakeasy","rooftopbar","rooftop-bar","happyhour","happy-hour","winenight","wine-night","tacotuesday","taco-tuesday","pizzanight","pizza-night","takeout","take-out","doordash","ubereats","uber-eats","grubhub","postmates","instacart","plantmom","plant-mom","plantdad","plant-dad","plantparent","plant-parent","crazycatlady","crazy-cat-lady","dogmom","dog-mom","dogdad","dog-dad","furbaby","fur-baby","furbabies","rescuedog","rescue-dog","adoptdontshop","engagement","engaged","shesaidyes","she-said-yes","weddingplanning","wedding-planning","bridesquad","bride-squad","groomsmen","bachelorette","bachelor","honeymoon","firsthome","first-home","homeowner","home-owner","housegoals","house-goals","diy","diyer","fixer-upper","fixerupper","hgtv","pinterestfail","pinterest-fail","netflix-queue","netflixqueue","bingeing","binge-watching","streamingwars","truecrimeobsessed","true-crime-obsessed","truecrime","true-crime","murderino","podcastaddict","podcast-addict","serialpodcast","serial-podcast","officelife","office-life","corporatelife","corporate-life","cubicle","openoffice","slack","slackchannel","slack-channel","zoomlife","zoom-life","zoommeetings","wfh","workfromhome","work-from-home","remotework","remote-work","hybridwork","quietquitting","quiet-quitting","thegreatresignation","thegreatreshuffling","sundayscaries","sunday-scaries","mondaymotivation","monday-motivation","humpday","hump-day","tgif","fridayfeeling","friday-feeling","fridayvibes","itstheweekend","weekendvibes","weekend-vibes","weekendmode","weekend-mode","lol","lmao","lmfao","rofl","roflmao","omg","wtf","ftw","smh","tbh","icymi","fomo","jomo","fwiw","imho","imo","brb","gtg","ttyl","nbd","idk","idgaf","stfu","nsfw","tmi","btw","afaik","iirc","ymmv","ianal","whatever","whatev","whatevs","meh","blah","ugh","duh","psych","noway","no-way","asif","as-if","getreal","get-real","talktotheh","talk-to-the-hand","nottt","not","sike","syke","psyche","gnarly","rad","radical","tubular","bodacious","righteous","excellent","bogus","heinous","grody","gag-me","gagme","barf","barfbag","gross","dude","dudes","dudette","bro","bros","broski","homie","homies","homes","peeps","posse","crew","gang","clique","tribe","chill","chillax","chillaxin","chilling","chillin","kickin","kickback","kick-back","hangout","hang-out","hangtime","hang-time","couch","couchpotato","couch-potato","vegging","veggingout","vegging-out","slacker","slackers","slack","slacking","procrastinate","procrastinating","grunge","grungy","alternative","alt","indie","underground","mtv","vh1","headbangers","headbanging","moshing","moshpit","mosh-pit","nirvana","cobain","soundgarden","pearljam","pearl-jam","aliceinchains","beavis","butthead","beavisandbutthead","daria","simpsons","bartman","waynesworld","waynes-world","partyon","party-on","schwing","excellent","billted","bill-ted","bogusjourney","bogus-journey","stationn","ferris","ferrisbueller","ferris-bueller","dayoff","day-off","buellerr","breakfast-club","breakfastclub","sixteen-candles","sixteencandles","pretty-in-pink","prettyinpink","mollyringwald","molly-ringwald","johnhughes","john-hughes","hughes","brat-pack","bratpack","pager","beeper","pagenme","page-me","callme","call-me","hitmeup","snailmail","snail-mail","aol","aim","icq","uh-oh","a-s-l","asl","netscape","geocities","angelfire","tripod","webcrawler","askjeeves","gen-x","genx","genxer","gen-xer","xer","xers","forgottengeneration","latchkeykid","latchkey-kid","latchkey","unsupervised","freerange","free-range","mtv-generation","mtvgeneration","mtvkids","mtv-kids","videokilled","video-killed","reagan-era","reaganera","coldwar","cold-war","coldwarkids","cold-war-kids","afterschoolspecial","after-school-special","justdontdoit","saynotodrugs","dareprogram","dare-program","scared-straight","scaredstraight","whatcha-talkin-bout","diffrentstrokes","factsoflife","facts-of-life","familyties","family-ties","growinpains","growin-pains","cosby","cheers","thirtysomething","thirty-something","madaboutyou","mad-about-you","seinfeld","seinfeldian","kramers","masterofyourdomain","yada-yada-yada","friends","centralpark","central-perk","rachel","ross","chandler","monica","melrose","melroseplace","melrose-place","90210","beverlyhills90210","myso-called-life","mysocalledlife","angela","jordan-catalano","jordancatalano","freaksandgeeks","freaks-and-geeks","lindsay","undeclared","realworld","real-world","truestory","true-story","roadrules","road-rules","unplugged","mtv-unplugged","mtvunplugged","acoustic","coffehouse","grunge-era","grungeera","seattlesound","seattle-sound","subpop","sub-pop","smellsliketeenspirit","smells-like-teen-spirit","nevermind","bleach","ten","superunknown","dirt","facelift","jaroffies","jar-of-flies","greenday","green-day","dookie","basketcase","basket-case","wheniseptember","blink182","blink-182","enema","whats-my-age-again","allthesmallthings","sublime","santeria","wrongway","wrong-way","40oz","forty-oz","rage","ratm","rageagainstthemachine","killinginthename","bulls-on-parade","tool","lateralus","aenima","undertow","opiate","spiralout","spiral-out","nineinchnails","nine-inch-nails","nin","closer","headlikeahole","smashingpumpkins","smashing-pumpkins","siamesedream","mellon-collie","radiohead","okcomputer","ok-computer","creep","karma-police","paranoidandroid","beck","loser","odelay","whereitsat","where-its-at","twoturnstables","pulpfiction","pulp-fiction","royalewithcheese","saywhatagain","ezekiel","clerks","viewaskew","view-askew","jayandsilentbob","snootchie","officespace","office-space","tpsreports","tps-reports","piecesofflair","thematrix","the-matrix","redpill","bluepill","neo","morpheus","followthewhiterabbit","fightclub","fight-club","firstrandbeof","projectmayhem","tylerdurden","xfiles","x-files","mulderandscully","thetruthisoutthere","iwanttobelieve","buffy","buffythevampireslayer","buffy-tvs","scoobygang","sunnydale","groovy","far-out","farout","outtasite","outta-sight","righteous","cool","coolio","coolcat","cool-cat","coolbeans","cool-beans","neato","solid","solidgold","solid-gold","golden","goldies","oldies","classics","keen","swell","peachy","peachykeen","peachy-keen","hunky-dory","hunkydory","hip","hipster","hipcat","hip-cat","hep","hepcat","hep-cat","jazzy","square","squares","squaresville","uptight","uncool","unhip","bread","dough","moolah","bucks","clams","greenbacks","benjamins","pad","crib","digs","joint","spot","place","casa","hacienda","wheels","ride","whip","jalopy","hooptie","beater","clunker","oldtimer","old-timer","oldschool","old-school","vintage","retro","classic","backyard","frontporch","front-porch","patio","deck","garage","workshop","hamshack","ham-shack","radioshack","radio-shack","basement","attic","lodge","elks","moose","eagles","vfw","legion","american-legion","rotary","kiwanis","lions","shriners","masons","masonic","fraternal","church","chapel","parish","congregation","fellowship","ministry","sunday","sabbath","potluck","pot-luck","social","supper","supperclub","bridge","bridgeclub","bridge-club","cards","cardgame","card-game","bingo","bunco","poker","pokernight","poker-night","gamenight","game-night","bowling","bowlingalley","bowling-alley","bowlingleague","bowling-league","golf","golfclub","golf-club","teeoff","tee-off","links","fairway","fishing","fishinghole","fishing-hole","fishingbuddy","fishing-buddy","hunting","huntingcamp","hunting-camp","deercamp","deer-camp","cabin","rv","rvclub","rv-club","camper","campground","koa","goodsam","good-sam","snowbird","snowbirds","sunbird","sunbirds","winter-texan","wintertexan","retired","retirement","goldenage","golden-age","goldenyears","golden-years","aarp","seniors","seniormoments","senior-moments","grandkids","grandchildren","boomer","boomers","babyboomer","baby-boomer","babyboomers","baby-boomers","woodstock","woodstocknation","woodstock-nation","hippie","hippies","hippy","peacelove","peace-love","peacesign","peace-sign","makelovenotowar","flowerpower","flower-power","flowerchild","flower-child","summerofove","counterculture","counter-culture","freebird","free-bird","freespirit","tune-in-turn-on","dropmeout","trippingout","tripping-out","psychedelic","grateful-dead","gratefuldead","deadhead","dead-head","deadheads","beatles","beatlemania","fab-four","fabfour","johnpaugeorgeringo","rollingstones","rolling-stones","stones","jagger","keithrichards","thewho","the-who","mygeneration","my-generation","tommyboy","ledzeppelin","led-zeppelin","zeppelin","stairway","stairwaytoheaven","pinkfloyd","pink-floyd","thewall","the-wall","darkside","darksidemoon","doors","thedoors","jimmorrison","jim-morrison","lightmyfire","riders","hendrix","jimi","jimihendrix","purplehaze","purple-haze","voodoo-child","janis","janisjoplin","janis-joplin","mercedesbenz","piecemyheart","ccr","creedence","creedence-clearwater","fortunateson","badmoonrising","eagles","hotelcalifornia","hotel-california","desperado","takiteasy","fleetwood","fleetwoodmac","fleetwood-mac","rumours","dreams","thchain","carlysimon","carly-simon","youresovain","anticipation","simongarfunkel","simon-garfunkel","soundofsilence","bridgeovertroubledwater","caroleking","carole-king","tapestry","youvegotafriend","naturalwoman","crosbystillsnash","crosby-stills-nash","csny","suite-judy-blue-eyes","vietnam","vietnamera","vietnam-era","vietnamvet","vietnam-vet","napalm","civilrights","civil-rights","mlk","martin-luther-king","ihaveadream","moonlanding","moon-landing","apollo","apollo11","onesmallstep","jfk","kennedy","camelot","asknotwhat","cubanmissilecrisis","coldwars","watergate","nixon","rosemarywoods","18minutes","deepthroat","mash","allinthefamily","all-in-the-family","archie","archiebunker","happydays","happy-days","fonzie","thfonz","aaayyyy","jumptheshark","laverne-shirley","laverneshirley","schlemiel","schlimazel","marytylermore","mary-tyler-moore","rhoda","lou-grant","lourant","bobnehart","bob-newhart","newhart","hiimbob","thisislarrybrother","sanford-son","sanfordandson","bigdummy","elizabethimcoming","jeffersons","thejeffersons","movingonup","moving-on-up","deluxe","goodtimes","good-times","dynomite","dy-no-mite","jj","chico-man","chicoman","chicoandtheman","lookingfordwardo","kolchak","nightstalker","night-stalker","barnaby","barnabyjones","columbo","onmorething","one-more-thing","justonemorething","magnum","magnumpi","magnum-pi","selleck","tomelleck","ferrari308","rockfordfiles","rockford-files","jimrockford","answeringmachine","dallastv","dallas-tv","whoshotjr","who-shot-jr","ewingsouthfork","dynasty","alexis","crystalcarrington","catfight","shoulderpads","sixmilliondollarman","bionicwoman","bionic-woman","wecanrebuildhim","the","be","to","of","and","a","in","that","have","i","it","for","not","on","with","he","as","you","do","at","this","but","his","by","from","they","we","say","her","she","or","an","will","my","one","all","would","there","their","what","so","up","out","if","about","who","get","which","go","me","when","make","can","like","time","no","just","him","know","take","people","into","year","your","good","some","could","them","see","other","than","then","now","look","only","come","its","over","think","also","back","after","use","two","how","our","work","first","well","way","even","new","want","because","any","these","give","day","most","us","is","are","was","were","been","good","bad","great","best","worst","first","last","next","only","own","free","open","close","closed","new","old","young","big","small","little","long","short","high","low","fast","slow","quick","hot","cold","warm","cool","hard","soft","easy","difficult","simple","complex","clear","dark","light","bright","deep","shallow","wide","narrow","thick","thin","heavy","full","empty","clean","dirty","wet","dry","loud","quiet","silent","strong","weak","rich","poor","cheap","expensive","safe","dangerous","healthy","sick","happy","sad","angry","calm","busy","lazy","crazy","smart","stupid","clever","wise","dumb","funny","serious","strange","normal","weird","perfect","broken","whole","complete","partial","ready","active","passive","alive","dead","awake","asleep","aware","blind","bold","brave","calm","careful","certain","chief","common","curious","current","direct","double","early","entire","exact","extra","fair","false","famous","final","fine","firm","flat","former","forward","fresh","front","frozen","general","giant","global","golden","grand","green","gross","guilty","hidden","hollow","honest","huge","human","humble","hungry","ideal","ill","inner","instant","intense","internal","joint","just","keen","key","kind","known","large","late","latter","leading","legal","likely","limited","linear","liquid","live","living","local","logical","lonely","loose","lost","lovely","lower","lucky","mad","magic","main","major","male","female","manual","married","massive","master","maximum","mean","medium","mental","middle","military","minimum","minor","missing","mixed","mobile","modern","monthly","moral","mutual","naked","narrow","nasty","native","natural","nearby","neat","negative","nervous","neutral","next","nice","noble","noisy","normal","northern","novel","obvious","odd","official","ok","okay","olympic","only","open","opening","opposite","optional","orange","ordinary","organic","original","other","outdoor","outer","outside","overall","overseas","owing","own","pale","parallel","partial","particular","past","patient","peaceful","peculiar","permanent","personal","petty","physical","pink","plain","pleasant","plenty","plus","pointed","polite","political","popular","positive","possible","potential","powerful","practical","precious","precise","pregnant","present","presidential","pretty","previous","primary","prime","principal","prior","private","probable","productive","professional","profound","progressive","prominent","proper","prospective","protective","proud","provincial","psychological","public","pure","purple","qualified","quick","quiet","radical","random","rapid","rare","raw","ready","real","realistic","reasonable","recent","red","redundant","regional","regular","relative","relevant","reliable","religious","reluctant","remaining","remarkable","remote","representative","resident","resistant","respective","responsible","resulting","revolutionary","rich","ridiculous","right","rigid","rising","risky","rival","romantic","rough","round","royal","ruling","running","rural","sacred","sad","safe","salty","same","sample","go","come","get","give","take","make","do","say","see","look","find","use","tell","ask","work","seem","feel","try","leave","call","keep","let","begin","start","show","hear","play","run","move","live","believe","hold","bring","happen","write","provide","sit","stand","lose","pay","meet","include","continue","set","learn","change","lead","understand","watch","follow","stop","create","speak","read","allow","add","spend","grow","open","walk","win","offer","remember","love","consider","appear","buy","wait","serve","die","send","expect","build","stay","fall","cut","reach","kill","remain","suggest","raise","pass","sell","require","report","decide","pull","break","push","throw","catch","jump","kick","hit","fly","swim","drive","ride","climb","dance","sing","cook","eat","drink","sleep","wake","wash","dress","fight","help","save","teach","study","test","check","join","connect","link","share","post","send","receive","accept","reject","approve","deny","confirm","cancel","reset","restart","refresh","reload","update","upgrade","install","uninstall","download","upload","sync","backup","restore","recover","repair","fix","solve","resolve","complete","finish","time","year","people","way","day","man","woman","child","world","life","hand","part","place","case","week","company","system","program","question","work","government","number","night","point","home","water","room","mother","area","money","story","fact","month","lot","right","study","book","eye","job","word","business","issue","side","kind","head","house","service","friend","father","power","hour","game","line","end","member","law","car","city","community","name","president","team","minute","idea","kid","body","information","back","parent","face","others","level","office","door","health","person","art","war","history","party","result","change","morning","reason","research","girl","guy","moment","air","teacher","force","education","hello","hi","hey","hola","bonjour","ciao","aloha","howdy","greetings","welcome","goodbye","bye","farewell","later","peace","cheers","thanks","thankyou","thank-you","please","sorry","excuse","pardon","congrats","congratulations","bravo","wow","amazing","awesome","cool","nice","great","excellent","perfect","wonderful","fantastic","incredible","unbelievable","omg","wtf","lol","lmao","rofl","haha","hehe","xoxo","hugs","kisses","python","javascript","typescript","java","csharp","cpp","cplusplus","golang","go-lang","rust","rustlang","rust-lang","ruby","php","perl","swift","kotlin","scala","haskell","lisp","clojure","erlang","elixir","fsharp","ocaml","lua","r-lang","rlang","julia","dart","fortran","cobol","assembly","asm","wasm","webassembly","sql","nosql","graphql","mongodb","postgres","postgresql","mysql","mariadb","sqlite","redis","memcached","cassandra","dynamodb","firebase","supabase","prisma","sequelize","typeorm","react","reactjs","react-native","reactnative","angular","angularjs","vue","vuejs","svelte","sveltekit","nextjs","next-js","nuxt","nuxtjs","gatsby","remix","astro","solid","solidjs","preact","qwik","htmx","alpine","tailwind","tailwindcss","bootstrap","bulma","foundation","materialui","chakra","antd","ant-design","shadcn","radix","headlessui","daisyui","nodejs","node-js","deno","bun","express","fastify","koa","nestjs","django","flask","fastapi","rails","rubyonrails","laravel","symfony","spring","springboot","spring-boot","dotnet","aspnet","blazor","maui","electron","tauri","flutter","ionic","capacitor","cordova","xamarin","unity","unreal","godot","pygame","phaser","threejs","three-js","babylon","webpack","vite","rollup","parcel","esbuild","swc","babel","eslint","prettier","jest","vitest","mocha","jasmine","cypress","playwright","selenium","puppeteer","storybook","chromatic","ladle","histoire","docker","kubernetes","k8s","k3s","minikube","helm","istio","envoy","podman","containerd","crio","rancher","openshift","nomad","consul","terraform","pulumi","crossplane","ansible","puppet","chef","saltstack","vagrant","packer","vault","boundary","waypoint","atlantis","argocd","argo-cd","fluxcd","flux-cd","jenkins","circleci","travisci","travis-ci","github-actions","githubactions","gitlab-ci","gitlabci","bitbucket-pipelines","azure-devops","azuredevops","teamcity","bamboo","drone","tekton","spinnaker","aws","amazon","azure","gcp","google-cloud","googlecloud","digitalocean","linode","vultr","hetzner","ovh","scaleway","upcloud","heroku","vercel","netlify","cloudflare","fastly","akamai","cloudfront","railway","render","fly-io","flyio","deno-deploy","workers","cloudflare-workers","lambda","serverless","faas","paas","iaas","saas","baas","kaas","daas","nginx","apache","caddy","traefik","haproxy","envoy","kong","apisix","grafana","prometheus","loki","tempo","jaeger","zipkin","datadog","newrelic","splunk","elastic","elasticsearch","kibana","logstash","elk","fluentd","fluentbit","vector","telegraf","influxdb","timescaledb","questdb","pagerduty","opsgenie","victorops","statuspage","incident-io","rootly","ai","artificial-intelligence","ml","machine-learning","machinelearning","deep-learning","deeplearning","neural","neuralnet","neural-network","tensorflow","pytorch","keras","jax","flax","scikit","sklearn","scipy","numpy","pandas","matplotlib","seaborn","plotly","bokeh","altair","huggingface","hugging-face","transformers","diffusers","datasets","openai","gpt","gpt4","gpt-4","chatgpt","chat-gpt","claude","anthropic","gemini","bard","palm","llama","llama2","llama-2","mistral","mixtral","falcon","mpt","dolly","alpaca","vicuna","orca","phi","zephyr","yi","qwen","deepseek","codellama","code-llama","starcoder","codegen","copilot","cursor","tabnine","codeium","replit","sourcegraph","cody","continue","langchain","llamaindex","llama-index","autogpt","auto-gpt","babyagi","agentgpt","superagi","crewai","autogen","semantic-kernel","guidance","ollama","lmstudio","lm-studio","localai","local-ai","gpt4all","koboldai","oobabooga","text-generation-webui","vllm","tgi","triton","tensorrt","stable-diffusion","stablediffusion","midjourney","dalle","dall-e","imagen","sdxl","controlnet","lora","dreambooth","textual-inversion","automatic1111","comfyui","invokeai","fooocus","kohya","runpod","replicate","banana","modal","anyscale","ray","mlflow","weights-biases","wandb","comet","neptune","clearml","dvc","lakefs","pachyderm","kubeflow","mlrun","seldon","bentoml","mlserver","torchserve","triton-inference","sagemaker","vertex","azure-ml","databricks","snowflake","dbt","airbyte","fivetran","security","cybersec","infosec","netsec","appsec","devsecops","secops","hacking","hacker","hackers","pentest","pentesting","redteam","red-team","blueteam","blue-team","purpleteam","purple-team","bugbounty","bug-bounty","ctf","capture-the-flag","wargames","hackthebox","tryhackme","picoctf","overthewire","vulnhub","exploit","exploits","exploit-db","cve","nvd","mitre","attck","att-ck","owasp","sans","nist","iso27001","soc2","gdpr","hipaa","pci","pci-dss","compliance","audit","forensics","malware","ransomware","trojan","virus","worm","rootkit","botnet","phishing","spearphishing","whaling","vishing","smishing","social-eng","osint","recon","reconnaissance","footprinting","scanning","enumeration","privilege-escalation","privesc","lateral-movement","persistence","exfil","firewall","ids","ips","waf","siem","soar","edr","xdr","mdr","ndr","vpn","proxy","tor","onion","i2p","freenet","darknet","darkweb","encryption","decryption","cipher","hash","hashing","sha","md5","bcrypt","argon2","scrypt","aes","rsa","ecc","ecdsa","ed25519","curve25519","ssl","tls","https","certificates","pki","x509","acme","letsencrypt","oauth","oauth2","oidc","saml","jwt","tokens","sessions","cookies","mfa","2fa","totp","hotp","fido","fido2","webauthn","passkeys","biometrics","password","passwords","passphrase","keychain","vault","secrets","keys","nmap","masscan","zmap","shodan","censys","greynoise","binaryedge","burp","burpsuite","zap","owasp-zap","nikto","sqlmap","metasploit","cobalt-strike","cobaltstrike","empire","covenant","sliver","mythic","mimikatz","bloodhound","responder","impacket","crackmapexec","evil-winrm","hashcat","john","johntheripper","hydra","medusa","aircrack","aircrack-ng","wireshark","tcpdump","tshark","scapy","ettercap","bettercap","mitmproxy","ghidra","ida","radare2","r2","binary-ninja","hopper","cutter","x64dbg","immunity","ollydbg","gdb","lldb","windbg","frida","objection","cycript","blockchain","crypto","cryptocurrency","defi","de-fi","cefi","ce-fi","bitcoin","btc","ethereum","eth","solana","sol","cardano","ada","polkadot","dot","avalanche","avax","polygon","matic","arbitrum","arb","optimism","op","base","zksync","zk-sync","starknet","scroll","linea","cosmos","atom","osmosis","osmo","celestia","tia","injective","inj","near","nearprotocol","aptos","apt","sui","mina","algorand","algo","tezos","xtz","hedera","hbar","fantom","ftm","harmony","one","elrond","egld","flow","icp","internet-computer","filecoin","fil","arweave","ar","storj","sia","akash","akt","render","rndr","chainlink","link","thegraph","grt","api3","band","uma","tellor","uniswap","uni","sushiswap","sushi","pancakeswap","cake","curve","crv","aave","compound","comp","makerdao","maker","mkr","dai","synthetix","lido","steth","rocketpool","reth","frax","convex","cvx","yearn","yfi","dydx","gmx","perpetual","perp","vertex","hyperliquid","drift","opensea","blur","looksrare","x2y2","sudoswap","nftx","rarible","foundation","nft","nfts","pfp","generative","ordinals","inscriptions","brc20","brc-20","wallet","wallets","metamask","phantom","rainbow","rabby","frame","zerion","ledger","trezor","coldcard","bitbox","keystone","hardware-wallet","seed","seedphrase","seed-phrase","mnemonic","private-key","privatekey","mining","miner","miners","hashrate","hash-rate","pow","pos","dpos","staking","stake","validator","validators","delegation","slashing","gas","gwei","eip","eip1559","erc20","erc721","erc1155","erc4626","dao","daos","governance","proposal","voting","snapshot","tally","multisig","multi-sig","gnosis","safe","timelock","vesting","airdrop","hardware","electronics","circuits","pcb","breadboard","soldering","arduino","esp32","esp8266","stm32","teensy","pico","rp2040","attiny","raspberrypi","raspberry-pi","rpi","rpi4","rpi5","rpi-zero","rpizero","beaglebone","beagle-bone","orangepi","orange-pi","bananapi","banana-pi","jetson","nvidia-jetson","nano","xavier","orin","coral","edge-tpu","fpga","verilog","vhdl","systemverilog","chisel","myhdl","amaranth","xilinx","altera","intel-fpga","lattice","gowin","efinix","anlogic","asic","risc","risc-v","riscv","arm","arm64","aarch64","x86","x64","mips","powerpc","sparc","xtensa","avr","pic","msp430","8051","microcontroller","mcu","soc","cpu","gpu","npu","tpu","dpu","ipu","memory","ram","dram","sram","flash","eeprom","rom","nvram","mram","ssd","nvme","hdd","storage","raid","nas","san","das","iscsi","usb","usb-c","thunderbolt","pcie","sata","nvlink","hdmi","displayport","ethernet","wifi","bluetooth","ble","zigbee","zwave","thread","matter","lora","lorawan","sigfox","nbiot","nb-iot","lte-m","catm1","5g","4g","antenna","antennas","rf","sdr","rtl-sdr","hackrf","limesdr","pluto","oscilloscope","logic-analyzer","multimeter","power-supply","signal-gen","3dprinter","3d-printer","3dprinting","fdm","sla","resin","filament","cnc","laser","lasercutter","laser-cutter","plasma","waterjet","edm","physics","quantum","quantum-physics","quantumphysics","quantummechanics","relativity","einstein","newton","particle","particles","hadron","cern","fermion","boson","higgs","quark","lepton","neutrino","photon","electron","proton","neutron","atom","atoms","atomic","nuclear","fission","fusion","plasma","magnetism","electromagnetism","gravity","gravitation","spacetime","blackhole","black-hole","singularity","wormhole","darkmatter","dark-matter","darkenergy","dark-energy","cosmology","bigbang","big-bang","inflation","astronomy","astrophysics","cosmos","universe","multiverse","galaxy","galaxies","milkyway","milky-way","andromeda","nebula","nebulae","pulsar","quasar","magnetar","supernova","nova","dwarf","whitedwarf","reddwarf","star","stars","stellar","solar","sun","sunspot","corona","flare","planet","planets","planetary","exoplanet","mercury","venus","earth","mars","jupiter","saturn","uranus","neptune","pluto","ceres","eris","moon","moons","lunar","asteroid","asteroids","comet","comets","meteor","telescope","telescopes","hubble","webb","jwst","james-webb","chandra","spitzer","kepler","tess","gaia","vlt","elt","keck","alma","ska","nasa","esa","jaxa","isro","roscosmos","cnsa","spacex","blueorigin","virgin-galactic","rocketlab","relativity-space","firefly","astra","chemistry","chem","chemical","chemicals","molecule","molecules","molecular","organic","inorganic","polymer","polymers","catalyst","reaction","synthesis","element","elements","periodic","periodic-table","hydrogen","helium","lithium","carbon","nitrogen","oxygen","sulfur","phosphorus","potassium","calcium","iron","copper","zinc","silver","gold","platinum","uranium","plutonium","biology","bio","biological","bioscience","lifescience","life-science","cell","cells","cellular","dna","rna","mrna","gene","genes","genetic","genetics","genomics","genome","chromosome","protein","proteins","enzyme","bacteria","bacterial","virus","viral","microbe","microbes","microbiology","fungus","fungi","yeast","algae","plankton","protozoa","amoeba","evolution","darwin","natural-selection","species","taxonomy","phylogeny","ecology","ecosystem","biodiversity","conservation","endangered","extinction","botany","botanical","plant","plants","flora","flower","flowers","tree","trees","forest","forests","rainforest","jungle","grassland","savanna","zoology","animal","animals","fauna","mammal","mammals","reptile","reptiles","amphibian","amphibians","bird","birds","avian","fish","fishes","marine","insect","insects","arthropod","arachnid","spider","spiders","butterfly","earth","earthscience","earth-science","geology","geological","geologist","rock","rocks","mineral","minerals","crystal","crystals","gem","gems","volcano","volcanoes","volcanic","lava","magma","eruption","tectonic","earthquake","earthquakes","seismic","seismology","fault","faults","mountain","mountains","peak","peaks","summit","ridge","range","alps","himalayas","rockies","andes","everest","kilimanjaro","fuji","denali","ocean","oceans","oceanic","atlantic","pacific","indian","arctic","antarctic","sea","seas","mediterranean","caribbean","baltic","adriatic","aegean","river","rivers","stream","streams","creek","creeks","delta","estuary","lake","lakes","pond","ponds","reservoir","wetland","wetlands","swamp","island","islands","peninsula","cape","bay","gulf","strait","channel","continent","continents","africa","asia","europe","northamerica","southamerica","australia","oceania","antarctica","arctic","polar","tropical","equator","climate","weather","meteorology","atmosphere","stratosphere","troposphere","temperature","precipitation","humidity","pressure","wind","winds","storm","storms","hurricane","typhoon","cyclone","tornado","tornadoes","lightning","thunder","thunderstorm","monsoon","blizzard","drought","environment","environmental","eco","ecology","green","sustainable","sustainability","renewable","renewables","solar","solar-power","solarpower","wind-power","windpower","hydro","hydroelectric","geothermal","biomass","nuclear-power","nuclearpower","fusion-power","fusionpower","clean-energy","carbon","carbon-neutral","carbonneutral","netzero","net-zero","emissions","greenhouse","co2","methane","ozone","pollution","pollutants","smog","recycle","recycling","compost","composting","waste","zerowaste","zero-waste","plastic","plastics","microplastic","biodegradable","reusable","disposable","organic","natural","vegan","vegetarian","plantbased","plant-based","climate-change","climatechange","global-warming","globalwarming","ipcc","paris-agreement","cop","cop28","unfccc","epa","wwf","greenpeace","sports","sport","athletics","athletic","athlete","athletes","fitness","workout","workouts","exercise","exercises","training","trainer","gym","football","nfl","soccer","fifa","worldcup","world-cup","premier-league","champions-league","laliga","la-liga","bundesliga","seriea","serie-a","basketball","nba","wnba","ncaa","march-madness","hoops","dunk","slam","baseball","mlb","homerun","home-run","worldseries","world-series","hockey","nhl","ice-hockey","icehockey","puck","slap-shot","goalie","tennis","atp","wta","wimbledon","usopen","us-open","roland-garros","golf","pga","lpga","masters","ryder-cup","birdie","eagle","hole-in-one","boxing","mma","ufc","bellator","wrestling","wwe","aew","judo","karate","taekwondo","jiu-jitsu","jiujitsu","bjj","muay-thai","kickboxing","kung-fu","olympics","olympic","paralympics","paralympic","commonwealthgames","running","runner","runners","marathon","marathons","half-marathon","5k","10k","ultra","ultramarathon","trail-running","trailrunning","cross-country","cycling","cyclist","cycling","tour-de-france","tourdefrance","giro","vuelta","time-trial","peloton","velodrome","bmx","mountainbike","mtb","swimming","swimmer","swimmers","pool","freestyle","backstroke","butterfly","triathlon","triathlete","ironman","sprint-tri","olympic-tri","duathlon","weightlifting","powerlifting","crossfit","bodybuilding","strongman","yoga","pilates","aerobics","zumba","hiit","cardio","stretching","mobility","surfing","surf","surfer","surfers","waves","barrel","pipeline","wsl","skateboarding","skate","skater","skaters","sk8","halfpipe","vert","street","snowboarding","snowboard","snowboarder","skiing","ski","skier","slopes","climbing","climber","climbers","bouldering","trad","sport-climbing","parkour","freerunning","free-running","traceur","movement","calisthenics","music","musician","musicians","musical","song","songs","album","albums","artist","artists","band","bands","singer","singers","vocalist","voice","rock","rock-music","rockmusic","rocknroll","rock-n-roll","classic-rock","pop","pop-music","popmusic","kpop","k-pop","jpop","j-pop","cpop","c-pop","hiphop","hip-hop","rap","rapper","rappers","trap","drill","grime","rnb","r-n-b","soul","funk","disco","motown","reggae","dancehall","ska","jazz","jazz-music","jazzmusic","bebop","swing","bigband","big-band","blues","blues-music","bluesmusic","delta-blues","chicago-blues","electric","country","country-music","countrymusic","bluegrass","americana","folk","electronic","edm","techno","house","trance","dubstep","drum-and-bass","dnb","drumnbass","ambient","chillout","chill-out","lofi","lo-fi","beats","classical","classical-music","classicalmusic","orchestra","symphony","opera","choir","choral","chamber","baroque","romantic","contemporary","metal","heavy-metal","heavymetal","death-metal","black-metal","thrash","punk","punk-rock","punkrock","hardcore","emo","screamo","post-punk","indie","indie-rock","indierock","indie-pop","indiepop","alternative","grunge","shoegaze","dream-pop","dreampop","noise","experimental","world-music","worldmusic","latin","salsa","merengue","bachata","cumbia","afrobeat","afro-beat","afropop","afro-pop","highlife","juju","mbalax","guitar","guitarist","bass","bassist","drums","drummer","percussion","keyboard","keyboardist","piano","pianist","synth","synthesizer","keys","violin","violinist","cello","cellist","viola","bass","doublebass","saxophone","sax","trumpet","trombone","clarinet","flute","oboe","horn","dj","deejay","turntable","turntables","mixing","mixer","scratching","producer","producers","production","beatmaker","beat-maker","beats","recording","studio","studios","mastering","mixing","mixing-board","spotify","apple-music","applemusic","tidal","deezer","soundcloud","bandcamp","youtube-music","youtubemusic","amazon-music","amazonmusic","vinyl","records","record","lp","ep","single","singles","discography","concert","concerts","gig","gigs","tour","touring","festival","festivals","coachella","glastonbury","lollapalooza","bonnaroo","burning-man","sxsw","grammy","grammys","brit-awards","vma","ama","billboard","rolling-stone","movies","movie","film","films","cinema","cinematic","theater","theatre","hollywood","bollywood","nollywood","tollywood","anime","animation","documentary","documentaries","doc","docs","docuseries","docu-series","tv","television","series","show","shows","episode","episodes","season","drama","dramas","comedy","comedies","romcom","rom-com","sitcom","sitcoms","action","adventure","thriller","thrillers","horror","scary","slasher","scifi","sci-fi","science-fiction","sciencefiction","fantasy","dystopia","superhero","superheroes","marvel","mcu","dc","dceu","batman","superman","spiderman","spider-man","avengers","xmen","x-men","fantastic-four","starwars","star-wars","startrek","star-trek","trekkie","trekkies","lotr","lord-of-the-rings","lordoftherings","hobbit","tolkien","middle-earth","harrypotter","harry-potter","hogwarts","wizarding","potterhead","gameofthrones","game-of-thrones","got","westeros","houseofdragon","stranger-things","strangerthings","breaking-bad","breakingbad","bettercallsaul","netflix","hulu","disney-plus","disneyplus","hbo","hbomax","max","amazon-prime","amazonprime","primevideo","prime-video","appletv","paramount-plus","paramountplus","peacock","criterion","mubi","shudder","director","directors","filmmaker","filmmakers","cinematographer","dop","actor","actors","actress","actresses","cast","casting","audition","screenwriter","screenwriting","script","scripts","screenplay","storyboard","oscar","oscars","academy-awards","academyawards","emmy","emmys","golden-globe","goldenglobes","bafta","cannes","sundance","tribeca","toronto","tiff","venice","berlinale","sxsw-film","telluride","gaming","gamer","gamers","games","game","videogames","video-games","pc-gaming","pcgaming","console","consoles","handheld","mobile-gaming","playstation","ps5","ps4","ps3","psn","xbox","xboxone","xbox-series","nintendo","switch","switch-2","wii","wiiu","gamecube","n64","snes","nes","steam","steamdeck","steam-deck","epic","epicgames","epic-games","gog","rpg","jrpg","mmorpg","mmo","fps","tps","rts","moba","battle-royale","sandbox","survival","roguelike","roguelite","metroidvania","souls-like","platformer","puzzle","adventure","simulation","sim","sims","strategy","minecraft","fortnite","valorant","csgo","cs2","counterstrike","counter-strike","league","leagueoflegends","league-of-legends","lol","dota","dota2","overwatch","ow2","apex","apexlegends","apex-legends","warzone","callofduty","gta","grandtheftauto","grand-theft-auto","gta6","gta5","rockstar","eldenring","elden-ring","darksouls","dark-souls","bloodborne","sekiro","zelda","totk","botw","tears-of-the-kingdom","breath-of-the-wild","link","mario","supermario","super-mario","mariokart","mario-kart","smashbros","pokemon","pokemongo","pokemon-go","pikachu","scarlet","violet","finalfantasy","final-fantasy","ff16","ff14","ffxiv","squareenix","destiny","destiny2","bungie","halo","haloinfinite","343industries","diablo","diablo4","worldofwarcraft","world-of-warcraft","wow","blizzard","starcraft","hearthstone","overwatch","battlenet","battle-net","assassinscreed","assassins-creed","farcry","far-cry","watchdogs","ubisoft","cyberpunk","cyberpunk2077","witcher","witcher3","cdprojekt","cdpr","baldursgate","baldurs-gate","bg3","larian","divinity","dos2","esports","e-sports","competitive","tournament","tournaments","lan","twitch","streamer","streamers","streaming","youtube-gaming","kick","speedrun","speedrunner","speedrunning","gdq","agdq","sgdq","food","foods","foodie","foodies","cooking","cook","cooks","chef","chefs","recipe","recipes","kitchen","kitchens","culinary","gastronomy","gourmet","restaurant","restaurants","dining","dine","eat","eating","meal","meals","breakfast","brunch","lunch","dinner","supper","snack","snacks","dessert","appetizer","appetizers","entree","entrees","side","sides","course","pizza","pizzas","burger","burgers","sandwich","sandwiches","wrap","wraps","taco","tacos","burrito","burritos","quesadilla","nachos","enchilada","sushi","sashimi","ramen","udon","soba","tempura","teriyaki","bento","pasta","spaghetti","lasagna","ravioli","gnocchi","risotto","italian","steak","steaks","bbq","barbeque","barbecue","grill","grilling","smoker","chicken","beef","pork","lamb","fish","seafood","shrimp","lobster","crab","vegetarian","vegan","plantbased","plant-based","meatless","tofu","tempeh","salad","salads","soup","soups","stew","stews","chili","curry","curries","bread","breads","baking","baker","bakery","pastry","pastries","cake","cookies","brownies","pie","pies","tart","tarts","donut","donuts","coffee","espresso","latte","cappuccino","mocha","americano","coldbrew","tea","teas","greentea","green-tea","blacktea","black-tea","herbal","chai","beer","beers","craft-beer","craftbeer","ipa","lager","stout","ale","brew","wine","wines","redwine","red-wine","whitewine","white-wine","rose","sparkling","cocktail","cocktails","mixology","bartender","bartending","spirits","whiskey","whisky","bourbon","scotch","vodka","gin","rum","tequila","fashion","style","styling","stylist","stylish","trendy","trend","trends","clothing","clothes","outfit","outfits","ootd","lookbook","wardrobe","dress","dresses","shirt","shirts","pants","jeans","shorts","skirt","jacket","jackets","coat","coats","sweater","hoodie","hoodies","blazer","shoes","sneakers","boots","heels","sandals","loafers","footwear","accessories","accessory","jewelry","jewellery","watch","watches","bag","bags","handbag","purse","wallet","sunglasses","hat","hats","scarf","designer","designers","luxury","luxe","haute-couture","hautecouture","runway","catwalk","model","models","modeling","modelling","supermodel","vogue","elle","harpers-bazaar","gq","esquire","cosmopolitan","instyle","beauty","beautiful","gorgeous","stunning","glam","glamour","glamorous","makeup","make-up","cosmetics","lipstick","mascara","eyeliner","eyeshadow","foundation","concealer","blush","bronzer","highlighter","contour","skincare","skin-care","skincareroutine","cleanser","moisturizer","serum","sunscreen","spf","anti-aging","antiaging","wrinkles","acne","pores","hair","haircare","hair-care","hairstyle","hairstyles","haircut","haircolor","blonde","brunette","redhead","highlights","balayage","ombre","extensions","nails","manicure","pedicure","nailart","nail-art","gelnails","acrylics","fragrance","perfume","cologne","scent","scents","aromatherapy","essentials","travel","traveling","travelling","traveler","traveller","travelers","trip","trips","vacation","vacations","holiday","holidays","getaway","adventure","adventures","explore","exploring","explorer","wanderlust","backpacking","backpacker","backpackers","hostel","hostels","hotel","hotels","airbnb","vrbo","booking","expedia","tripadvisor","kayak","skyscanner","flight","flights","airline","airlines","airport","airports","terminal","cruise","cruises","cruising","sailing","yacht","charter","island-hopping","roadtrip","road-trip","roadtrips","driving","scenic","route","routes","hiking","hike","hikes","trail","trails","trek","trekking","camping","beach","beaches","coastal","seaside","oceanfront","beachfront","shore","mountain","mountains","alpine","summit","peak","valley","canyon","gorge","city","cities","urban","metropolitan","downtown","cityscape","skyline","village","villages","town","towns","countryside","rural","scenic","landmark","landmarks","monument","monuments","heritage","unesco","historic","paris","london","newyork","new-york","tokyo","rome","barcelona","amsterdam","berlin","vienna","prague","budapest","lisbon","madrid","athens","istanbul","dubai","singapore","hongkong","hong-kong","bangkok","seoul","taipei","sydney","melbourne","auckland","capetown","cape-town","cairo","marrakech","nairobi","rio","buenosaires","buenos-aires","mexicocity","mexico-city","lima","bogota","sanfrancisco","san-francisco","losangeles","los-angeles","chicago","miami","lasvegas","las-vegas","seattle","boston","austin","denver","portland","vancouver","toronto","montreal","calgary","ottawa","quebec","edmonton","family","families","familytime","family-time","familyfirst","famfam","parents","parenting","parent","parenthood","parentlife","parent-life","mom","moms","momlife","mom-life","mommy","mother","mothers","motherhood","dad","dads","dadlife","dad-life","daddy","father","fathers","fatherhood","kids","kid","children","child","childhood","kidlife","kid-life","toddler","baby","babies","newborn","infant","pregnancy","pregnant","expecting","grandparents","grandma","grandpa","grandmother","grandfather","nana","papa","siblings","sibling","brother","brothers","sister","sisters","twins","friends","friend","friendship","friendships","bestfriend","best-friend","bff","besties","bestie","squad","squadgoals","squad-goals","crew","gang","dating","date","dates","relationship","relationships","couple","couples","boyfriend","girlfriend","partner","partners","significant-other","so","engaged","engagement","fiance","fiancee","wedding","weddings","bride","groom","married","marriage","spouse","husband","wife","newlyweds","anniversary","anniversaries","love","loving","romance","romantic","single","singles","singlelife","single-life","bachelor","bachelorette","divorce","divorced","separated","coparenting","co-parenting","stepparent","blended","blendedfamily","blended-family","adoption","adopted","foster","lgbtq","lgbt","lgbtqia","queer","pride","pridemonth","pride-month","gay","gays","lesbian","lesbians","bisexual","bi","pansexual","pan","transgender","trans","nonbinary","non-binary","nb","genderfluid","genderqueer","asexual","ace","aromantic","aro","demisexual","demi","intersex","ally","coming-out","comingout","outandproud","out-and-proud","loveislove","love-is-love","feminist","feminism","feminists","womensrights","womens-rights","equality","civilrights","civil-rights","humanrights","human-rights","socialjustice","blm","blacklivesmatter","black-lives-matter","antiracism","anti-racism","indigenous","native","firstnations","first-nations","aboriginal","tribal","disability","disabled","accessibility","a11y","inclusion","inclusive","neurodivergent","adhd","autism","autistic","dyslexia","dyslexic","mental-health","mentalhealth","anxiety","depression","bipolar","ptsd","ocd","therapy","selfcare","self-care","wellness","wellbeing","well-being","mindfulness","meditation","meditate","mindful","zen","calm","peace","peaceful","serenity","recovery","sober","sobriety","clean","aa","na","12steps","12-steps","support","supportgroup","support-group","community","communities","tribe","religion","religious","faith","faithful","belief","believe","believer","spiritual","spirituality","spirit","spirits","soul","souls","divine","christian","christianity","christians","church","churches","jesus","christ","catholic","catholicism","catholics","protestant","evangelical","baptist","methodist","lutheran","presbyterian","orthodox","episcopal","anglican","mormon","lds","latterday","latter-day","jehovah","adventist","pentecostal","jewish","judaism","jews","hebrew","israel","israeli","kosher","sabbath","torah","talmud","synagogue","temple","rabbi","hanukkah","passover","yom-kippur","muslim","islam","islamic","muslims","quran","koran","allah","muhammad","mosque","masjid","imam","halal","ramadan","eid","hajj","mecca","medina","hindu","hinduism","hindus","vedic","yoga","karma","dharma","mantra","temple","temples","krishna","shiva","vishnu","ganesh","diwali","holi","buddhist","buddhism","buddhists","buddha","zen","tibetan","dalai-lama","meditation","enlightenment","nirvana","sangha","dharma","sutra","sikh","sikhism","sikhs","guru","gurus","gurdwara","punjabi","pagan","paganism","wicca","wiccan","witchcraft","witch","witches","atheist","atheism","agnostic","agnosticism","secular","humanist","humanism","prayer","prayers","praying","worship","worshipping","praise","praising","blessing","blessings","blessed","miracle","miracles","grace","salvation","heaven","hell","afterlife","eternal","eternity","resurrection","redemption","work","working","worker","workers","workplace","worklife","work-life","job","jobs","career","careers","profession","professional","professionals","office","offices","corporate","corporation","company","companies","business","startup","startups","entrepreneur","entrepreneurs","entrepreneurship","founder","ceo","cto","cfo","coo","cmo","ciso","vp","director","manager","lead","employee","employees","employer","employers","hr","humanresources","human-resources","hiring","hire","recruit","recruiting","recruitment","talent","headhunter","interview","interviews","interviewing","resume","cv","linkedin","networking","salary","salaries","compensation","benefits","perks","bonus","bonuses","promotion","promoted","raise","negotiation","negotiate","contract","contracts","remote","remotework","remote-work","wfh","workfromhome","work-from-home","hybrid","flexible","flexibility","freelance","freelancer","freelancing","gig","gigeconomy","gig-economy","sideproject","side-project","sidehustle","meeting","meetings","presentation","presentations","conference","conferences","project","projects","deadline","deadlines","milestone","milestones","deliverable","team","teams","teamwork","collaboration","collaborate","agile","scrum","kanban","leadership","leader","leaders","management","manage","managing","productivity","efficiency","efficient","effective","performance","kpi","okr","metrics","burnout","stress","stressed","workload","overtime","quit","quitting","resign","retirement","retired","retiring","pension","401k","ira","savings","invest","0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","42","50","60","69","70","80","88","90","99","100","101","111","123","200","222","247","300","333","365","400","404","420","444","500","555","666","700","777","800","888","900","911","999","1000","1111","1234","2000","2020","2021","2022","2023","2024","2025","2026","2027","2028","2029","2030","2050","3000","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","ch1","ch2","ch3","ch4","ch5","ch6","ch7","ch8","ch9","ch10","ch11","ch12","ch13","ch14","ch15","ch16","ch17","ch18","ch19","ch20","channel1","channel2","channel3","channel4","channel5","channel6","channel7","channel8","channel9","channel10","channel11","channel12","channel13","room1","room2","room3","room4","room5","room6","room7","room8","room9","room10","group1","group2","group3","group4","group5","group6","group7","group8","group9","group10","team1","team2","team3","team4","team5","team6","team7","team8","team9","team10","zone1","zone2","zone3","zone4","zone5","zone6","zone7","zone8","zone9","zone10","area1","area2","area3","area4","area5","area6","area7","area8","area9","area10","sector1","sector2","sector3","sector4","sector5","sector6","sector7","sector8","net1","net2","net3","net4","net5","net6","net7","net8","net9","net10","link1","link2","link3","link4","link5","link6","link7","link8","link9","link10","node1","node2","node3","node4","node5","node6","node7","node8","node9","node10","hub1","hub2","hub3","hub4","hub5","hub6","hub7","hub8","hub9","hub10","mesh1","mesh2","mesh3","mesh4","mesh5","mesh6","mesh7","mesh8","mesh9","mesh10","radio1","radio2","radio3","radio4","radio5","radio6","radio7","radio8","radio9","relay1","relay2","relay3","relay4","relay5","relay6","relay7","relay8","relay9","base1","base2","base3","base4","base5","base6","base7","base8","base9","base10","unit1","unit2","unit3","unit4","unit5","unit6","unit7","unit8","unit9","unit10","server1","server2","server3","server4","server5","server6","server7","server8","dev1","dev2","dev3","dev4","dev5","prod1","prod2","prod3","stage1","stage2","test1","test2","test3","test4","test5","test6","test7","test8","test9","test10","user1","user2","user3","user4","user5","admin1","admin2","admin3","ops1","ops2","alpha","bravo","charlie","delta","echo","foxtrot","golf","hotel","india","juliet","kilo","lima","mike","november","oscar","papa","quebec","romeo","sierra","tango","uniform","victor","whiskey","xray","x-ray","yankee","zulu","alpha1","bravo1","charlie1","delta1","echo1","foxtrot1","alpha-team","bravo-team","charlie-team","delta-team","echo-team","team-alpha","team-bravo","team-charlie","team-delta","team-echo","red","blue","green","yellow","orange","purple","pink","black","white","gray","grey","brown","gold","silver","bronze","copper","platinum","cyan","magenta","teal","navy","maroon","olive","lime","aqua","coral","crimson","indigo","violet","turquoise","beige","ivory","tan","khaki","red-team","blue-team","green-team","yellow-team","orange-team","purple-team","team-red","team-blue","team-green","team-yellow","team-orange","team-purple","rednet","bluenet","greennet","blacknet","whitenet","darknet","clearnet","monday","tuesday","wednesday","thursday","friday","saturday","sunday","mon","tue","wed","thu","fri","sat","sun","weekday","weekend","january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","jun","jul","aug","sep","oct","nov","dec","spring","summer","fall","autumn","winter","season","seasons","seasonal","morning","afternoon","evening","night","midnight","noon","dawn","dusk","daily","weekly","monthly","yearly","annual","quarterly","hourly","today","tomorrow","yesterday","now","later","soon","always","never","24-7","247","round-the-clock","nonstop","non-stop","always-on","alwayson","north","south","east","west","northeast","northwest","southeast","southwest","northern","southern","eastern","western","central","middle","center","up","down","left","right","top","bottom","front","back","side","upper","lower","inner","outer","inside","outside","above","below","near","far","close","distant","local","remote","nearby","faraway","here","there","everywhere","anywhere","somewhere","nowhere","wherever","mini","micro","nano","tiny","small","little","medium","large","big","huge","giant","massive","mega","giga","tera","peta","exa","ultra","super","hyper","extreme","max","maximum","min","minimum","plus","extra","lite","light","heavy","full","empty","half","partial","complete","total","all-chat","allchat","main-chat","mainchat","public-chat","publicchat","general-chat","generalchat","global-chat","globalchat","world-chat","worldchat","local-chat","localchat","open-chat","openchat","free-chat","freechat","random-chat","randomchat","voice-chat","voicechat","text-chat","textchat","all-net","allnet","main-net","mainnet","test-net","testnet","dev-net","devnet","local-net","localnet","global-net","globalnet","public-net","publicnet","mesh-net","meshnet","radio-net","radionet","ham-net","hamnet","emerg-net","emergnet","all-hands","allhands","town-hall","townhall","standby","stand-by","on-call","oncall","help-desk","helpdesk","support","tech-support","techsupport","customer-support","feedback","suggestions","ideas","feature-requests","featurerequests","bug-reports","watercooler","water-cooler","coffee-break","coffeebreak","break-room","breakroom","off-topic","offtopic","random","misc","miscellaneous","other","everything-else","introductions","intro","intros","welcome","new-members","newmembers","onboarding","announcements","announce","news","updates","changelog","releases","roadmap","rules","guidelines","faq","faqs","help","how-to","howto","tutorial","tutorials","resources","links","useful-links","usefullinks","bookmarks","reference","docs","showcase","show-and-tell","showandtell","gallery","portfolio","projects","builds","jobs","hiring","careers","opportunities","gigs","freelance","classifieds","buy-sell","buysell","marketplace","trade","trading","swap","swaps","deals","events","meetups","meetup","gatherings","conferences","workshops","webinars","study-group","studygroup","book-club","bookclub","movie-night","movienight","game-night","gamenight","trivia","quiz","contests","challenges","competitions","reddit","twitter","x","facebook","fb","instagram","ig","insta","tiktok","youtube","yt","pinterest","snapchat","snap","linkedin","tumblr","threads","mastodon","fediverse","bluesky","bsky","discord","slack","telegram","signal","whatsapp","messenger","wechat","line","kakao","viber","matrix","element","clubhouse","spaces","periscope","vine","myspace","digg","stumbleupon","quora","medium","substack","patreon","onlyfans","fanhouse","gumroad","behance","dribbble","deviantart","artstation","pixiv","flickr","500px","meme","memes","dank","dankmemes","dank-memes","cursed","blessed","blursed","cringe","based","redpill","redpilled","blackpill","copium","hopium","cope","poggers","pog","pogchamp","pepe","wojak","gigachad","chad","virgin","simp","simping","stan","stanning","parasocial","irl","afk","brb","ttyl","fomo","yolo","goat","goated","lit","fire","slay","slaying","periodt","sus","sussy","imposter","amogus","amongus","among-us","crewmate","ratio","ratiod","L","W","big-L","big-W","touch-grass","touchgrass","npc","npcs","normie","normies","sheeple","boomer","zoomer","doomer","coomer","consoomer","wagie","neet","incel","volcel","blackpilled","glowie","janny","jannie","based-and-redpilled","keyed","kino","sovl","tfw","mfw","mrw","imo","imho","afaik","eli5","tldr","tl-dr","reddit-moment","leddit","hivemind","groupthink","echo-chamber","circlejerk","wholesome","wholesome100","chungus","big-chungus","keanu","reeves","stonks","not-stonks","diamond-hands","diamondhands","paper-hands","hodl","to-the-moon","tothemoon","moon","mooning","ape","apes","ape-together","tendies","gme","gamestop","wallstreetbets","wsb","yeet","yeeted","yoink","noob","newb","newbie","scrub","pwned","owned","rekt","wrecked","gg","ggwp","ggez","ez","ezpz","no-cap","nocap","cap","capping","fr","frfr","bussin","valid","bet","no-shot","sheesh","sheeesh","ong","ongggg","mid","L-take","W-take","hot-take","cold-take","spicy","spicy-take","rent-free","rentfree","living-rent-free","unhinged","brainrot","brain-rot","vtuber","vtubers","vtubing","hololive","nijisanji","vshoujo","idol","content","content-creator","contentcreator","creator","creators","influencer","influencers","viral","viralvideo","viral-video","trending","fyp","foryou","for-you","foryoupage","algorithm","algo","engagement","analytics","metrics","subscriber","subscribers","subs","sub","follower","followers","following","like","likes","share","shares","repost","reposts","retweet","rt","quote","comment","comments","reply","replies","dm","dms","direct-message","inbox","notification","notifications","notif","notifs","ping","pings","mention","highlight","highlights","clip","clips","vod","vods","archive","archives","premiere","premieres","watchparty","watch-party","reaction","reactions","react","reacting","review","reviews","tier-list","tierlist","ranking","collab","collabs","collaboration","crossover","feature","featured","guest","host","hosting","cohost","co-host","panel","panels","podcast","podcasts","episode","ep","eps","season","seasons","series","miniseries","mini-series","subreddit","subreddits","sub","subs","thread","threads","post","posts","forum","forums","board","boards","chan","chans","4chan","8chan","8kun","imageboard","textboard","bbs","bulletin-board","usenet","newsgroup","irc","ircnet","efnet","freenode","libera","oftc","rizon","undernet","xmpp","jabber","mumble","teamspeak","ts3","ventrilo","vent","raidcall","wiki","wikipedia","wikia","fandom","tvtropes","knowyourmeme","kym","encyclopediadramatica","ed","urban-dictionary","urbandictionary","ud","google","alphabet","apple","microsoft","msft","amazon","meta","facebook","nvidia","nvda","amd","intel","qualcomm","broadcom","samsung","tsmc","oracle","sap","salesforce","adobe","autodesk","vmware","dell","hp","hpe","ibm","cisco","juniper","arista","palo-alto","fortinet","crowdstrike","palantir","snowflake","databricks","mongodb","elastic","splunk","datadog","zoom","webex","teams","meet","slack","atlassian","jira","confluence","notion","airtable","coda","asana","monday","clickup","trello","basecamp","figma","sketch","invision","zeplin","framer","webflow","squarespace","wix","shopify","bigcommerce","magento","woocommerce","stripe","paypal","square","plaid","brex","ramp","affirm","klarna","afterpay","coinbase","binance","robinhood","fidelity","vanguard","schwab","etrade","interactive-brokers","uber","lyft","doordash","grubhub","instacart","postmates","deliveroo","airbnb","vrbo","booking","expedia","kayak","tripadvisor","yelp","spotify","apple-music","pandora","soundcloud","bandcamp","tidal","deezer","dropbox","box","onedrive","gdrive","google-drive","icloud","mega","nintendo","sony","playstation","xbox","microsoft-gaming","activision","blizzard","activision-blizzard","ea","electronic-arts","ubisoft","epic","valve","steam","rockstar","take-two","2k","bethesda","zenimax","id-software","bioware","dice","respawn","bungie","343","naughtydog","insomniac","santa-monica","guerrilla","sucker-punch","bend","bluepoint","housemarque","fromsoftware","from-software","bandainamco","bandai-namco","capcom","konami","sega","atlus","squareenix","square-enix","enix","square","level5","gamefreak","game-freak","creatures","pokemon-company","mihoyo","hoyoverse","riot","riot-games","tencent","netease","nexon","ncsoft","krafton","pubg","supercell","king","rovio","zynga","playtika","scopely","jam-city","paradox","firaxis","amplitude","creative-assembly","relic","obsidian","larian","cd-projekt","cdpr","techland","4a-games","remedy","io-interactive","disney","pixar","marvel","lucasfilm","warner","warnerbros","warner-bros","universal","paramount","sony-pictures","lionsgate","mgm","dreamworks","illumination","laika","ghibli","studio-ghibli","toei","sunrise","bones","madhouse","mappa","wit","trigger","kyoani","kyoto-animation","ufotable","a1-pictures","cloverworks","shaft","gainax","khara","production-ig","ig","netflix","hulu","hbo","max","disney-plus","prime-video","peacock","paramount-plus","apple-tv","crunchyroll","funimation","hidive","vrv","cbs","nbc","abc","fox","cw","amc","fx","showtime","starz","epix","bbc","itv","channel4","sky","britbox","hayu","acorn","curiositystream","discovery","discovery-plus","history","natgeo","nat-geo","animal-planet","tesla","rivian","lucid","nio","xpeng","byd","polestar","fisker","ford","gm","general-motors","chevy","chevrolet","dodge","ram","jeep","chrysler","toyota","honda","nissan","mazda","subaru","mitsubishi","hyundai","kia","genesis","volkswagen","vw","audi","bmw","mercedes","porsche","lamborghini","ferrari","maserati","alfa-romeo","fiat","volvo","land-rover","range-rover","jaguar","bentley","rolls-royce","aston-martin","mclaren","bugatti","koenigsegg","pagani","rimac","lotus","alpine","medical","medicine","healthcare","health-care","hospital","hospitals","doctor","doctors","dr","physician","physicians","surgeon","surgeons","nurse","nurses","nursing","rn","lpn","cna","np","pa","physician-assistant","pharmacy","pharmacist","pharmacists","pharma","pharmaceutical","rx","dentist","dentists","dental","dentistry","orthodontist","orthodontics","optometrist","ophthalmologist","optometry","vision","eye-care","eyecare","therapist","therapists","therapy","counselor","counseling","psychologist","psychiatrist","psychiatry","psychology","mental-health","mentalhealth","physical-therapy","pt","occupational-therapy","ot","speech-therapy","slp","chiropractor","chiropractic","acupuncture","acupuncturist","naturopath","emt","paramedic","paramedics","ems","emergency","er","icu","nicu","radiology","radiologist","xray","mri","ct","ultrasound","imaging","pathology","pathologist","lab","laboratory","diagnostics","testing","oncology","oncologist","cancer","tumor","chemotherapy","radiation","cardiology","cardiologist","heart","cardiac","cardiovascular","cv","neurology","neurologist","neuro","brain","spine","neurosurgery","pediatrics","pediatrician","peds","children","child-health","childhealth","geriatrics","geriatrician","elderly","senior-care","seniorcare","aging","dermatology","dermatologist","derm","skin","skincare","skin-care","orthopedics","orthopedic","ortho","bone","joint","sports-medicine","gastroenterology","gastro","gi","digestive","gut","intestinal","endocrinology","endocrine","diabetes","thyroid","hormone","hormones","pulmonology","pulmonologist","respiratory","lung","lungs","breathing","nephrology","nephrologist","kidney","kidneys","renal","dialysis","urology","urologist","bladder","prostate","urinary","reproductive","obgyn","ob-gyn","obstetrics","gynecology","obstetrician","gynecologist","fertility","ivf","reproductive-health","reproductivehealth","prenatal","legal","lawyer","lawyers","attorney","attorneys","law","laws","lawfirm","paralegal","paralegals","legal-assistant","legalassistant","clerk","clerks","judge","judges","court","courts","courthouse","trial","trials","jury","litigation","litigator","litigators","lawsuit","lawsuits","case","cases","criminal","criminal-law","defense","defender","prosecution","prosecutor","civil","civil-law","tort","torts","injury","personal-injury","malpractice","corporate-law","corporatelaw","business-law","commercial","contracts","intellectual-property","ip","patent","patents","trademark","copyright","family-law","familylaw","divorce","custody","child-support","alimony","immigration","immigration-law","visa","visas","citizenship","naturalization","real-estate-law","property-law","estate","estates","probate","trusts","tax-law","taxlaw","irs","tax-attorney","taxattorney","audit","audits","employment-law","labor-law","hr-law","discrimination","harassment","constitutional","constitutional-law","civil-rights","human-rights","environmental-law","epa","regulation","regulations","compliance","bankruptcy","restructuring","insolvency","creditor","debtor","debt","education","educator","educators","teach","teaching","teacher","teachers","professor","professors","prof","profs","faculty","academic","academics","student","students","pupil","pupils","learner","learners","learning","school","schools","elementary","primary","middle-school","middleschool","high-school","highschool","secondary","k12","k-12","grade","grades","college","colleges","university","universities","uni","campus","campuses","undergraduate","undergrad","graduate","grad","postgrad","phd","doctorate","masters","bachelors","associates","degree","degrees","diploma","diplomas","curriculum","syllabus","course","courses","class","classes","lecture","seminar","seminars","workshop","workshops","lab","labs","laboratory","tutor","tutors","tutoring","mentor","mentors","mentoring","mentorship","homeschool","homeschooling","unschool","unschooling","montessori","waldorf","stem","steam","science","math","mathematics","calculus","algebra","english","literature","writing","grammar","composition","rhetoric","history","geography","social-studies","socialstudies","civics","economics","art","arts","music","drama","theater","theatre","dance","visual-arts","physical-education","pe","gym","athletics","sports","health","wellness","construction","contractor","contractors","builder","builders","building","carpenter","carpenters","carpentry","woodwork","woodworking","woodworker","electrician","electricians","electrical","electric","wiring","power","plumber","plumbers","plumbing","pipes","piping","drainage","sewage","hvac","heating","cooling","ac","air-conditioning","ventilation","duct","roofer","roofers","roofing","roof","roofs","shingles","gutters","mason","masons","masonry","brick","bricks","stone","concrete","cement","painter","painters","painting","paint","wallpaper","drywall","finishing","welder","welders","welding","fabrication","fabricator","metalwork","machinist","machinists","machining","lathe","mill","milling","turning","mechanic","mechanics","mechanical","automotive","auto","car-repair","landscaper","landscapers","landscaping","lawn","garden","gardening","surveyor","surveyors","surveying","survey","land","property","boundary","architect","architects","architecture","architectural","design","drafting","engineer","engineers","engineering","structural","civil-engineering","inspector","inspectors","inspection","code","codes","permit","permits","firefighter","firefighters","fire","fire-department","firedepartment","fd","police","police-officer","policeofficer","cop","cops","officer","officers","sheriff","sheriffs","deputy","deputies","detective","detectives","state-trooper","trooper","troopers","highway-patrol","patrol","patrolling","swat","tactical","k9","k-9","canine","bomb-squad","bombsquad","hostage","emt","emts","paramedic","paramedics","ambulance","ems","first-responder","dispatcher","dispatchers","dispatch","911","emergency","emergencies","search-rescue","sar","rescue","rescuer","rescuers","coast-guard","lifeguard","hazmat","hazardous","decon","decontamination","chemical","biological","military","armed-forces","armedforces","defense","defence","dod","mod","army","soldier","soldiers","infantry","armor","artillery","cavalry","navy","sailor","sailors","naval","fleet","submarine","surface","carrier","airforce","air-force","pilot","pilots","aviator","aviation","fighter","marines","marine","marinecorps","marine-corps","leatherneck","oorah","coastguard","coast-guard","uscg","maritime","port","harbor","border","spaceforce","space-force","ussf","space","satellite","orbital","launch","national-guard","nationalguard","guard","reserve","reserves","reservist","veteran","veterans","vet","vets","retired","retiree","retirees","officer","officers","enlisted","nco","warrant","general","admiral","special-ops","specialops","specops","sof","delta","seals","rangers","green-berets","greenberets","airborne","paratrooper","paratroopers","outdoor","outdoors","outside","nature","wilderness","wild","backcountry","hiking","hiker","hikers","backpacking","backpacker","thru-hike","thruhike","camping","camper","campers","campsite","tent","tenting","glamping","rv","rving","campervan","vanlife","van-life","overlanding","overland","fishing","fisher","fishers","angler","anglers","angling","fly-fishing","hunting","hunter","hunters","hunt","game","wildlife","deer","elk","duck","birding","birdwatching","bird-watching","birder","birders","ornithology","foraging","forager","foragers","mushroom","mushrooms","fungi","mycology","kayaking","kayak","kayaker","kayakers","canoeing","canoe","paddling","rafting","raft","rafts","whitewater","white-water","rapids","river","scuba","diving","diver","divers","snorkeling","snorkel","freediving","sailing","sailor","sailors","sail","sailboat","yacht","yachting","rock-climbing","rockclimbing","bouldering","climber","climbers","crag","mountaineering","mountaineer","alpinism","alpine","summit","peak-bagging","caving","caver","cavers","spelunking","spelunker","cave","caves","offroad","off-road","atv","utv","sxs","dirtbike","dirt-bike","quad","photography","photographer","photographers","photo","photos","camera","videography","videographer","video","videos","filming","filmmaking","painting","painter","painters","canvas","acrylic","oil","watercolor","drawing","drawer","drawers","sketch","sketching","pencil","charcoal","sculpting","sculptor","sculptors","sculpture","clay","pottery","ceramics","knitting","knitter","knitters","knit","yarn","wool","needles","pattern","crocheting","crochet","crocheter","hook","hooks","amigurumi","blanket","sewing","sewer","sewers","seamstress","tailor","fabric","quilting","embroidery","embroiderer","cross-stitch","crossstitch","needlepoint","woodworking","woodworker","woodworkers","carpentry","furniture","lathe","metalworking","metalworker","blacksmith","blacksmithing","forge","forging","leatherworking","leatherwork","leather","leathercraft","tanning","tooling","jewelry-making","jewelrymaking","jeweler","beading","beads","wirework","origami","paper-craft","papercraft","scrapbooking","scrapbook","cardmaking","calligraphy","calligrapher","lettering","hand-lettering","handlettering","candle-making","candlemaking","soap-making","soapmaking","bath-bombs","collecting","collector","collectors","collection","collections","collectible","stamps","stamp","philately","philatelist","postage","postal","letters","coins","coin","numismatics","numismatist","currency","bullion","precious","cards","card","trading-cards","tradingcards","tcg","ccg","mtg","pokemon-tcg","comics","comic","comic-books","comicbooks","graphic-novels","graphicnovels","manga","manhwa","manhua","webtoon","webtoons","light-novel","lightnovel","figurines","figure","figures","statue","statues","action-figures","toys","funko","funko-pop","funkopop","pop","pops","nendoroid","figma","sh-figuarts","model-kits","modelkits","gunpla","gundam","plamo","scale-models","miniatures","lego","legos","bricks","moc","mocs","afol","tfol","kfol","megabloks","antiques","antique","vintage","retro","thrift","thrifting","estate-sale","vinyl","records","record","lp","lps","turntable","audiophile","hifi","watches","watch","horology","horologist","timepiece","wristwatch","pocket","boardgame","boardgames","board-games","board-game","tabletop","table-top","cardgame","cardgames","card-games","card-game","deckbuilder","deck-builder","rpg","rpgs","tabletop-rpg","ttrpg","pen-and-paper","roleplay","roleplaying","dnd","d-and-d","dungeons-and-dragons","dungeonsanddragons","dungeon","dragon","pathfinder","starfinder","call-of-cthulhu","coc","shadowrun","cyberpunk-red","warhammer","warhammer40k","40k","age-of-sigmar","aos","sigmar","gw","warmachine","hordes","infinity","malifaux","necromunda","kill-team","killteam","miniature","miniatures","minis","mini","wargaming","wargames","wargamer","painting-minis","paintingminis","mini-painting","minipainting","terrain","chess","checkers","go","baduk","weiqi","shogi","mahjong","mah-jong","poker","blackjack","bridge","canasta","rummy","hearts","spades","solitaire","catan","settlers","ticket-to-ride","tickettoride","pandemic","wingspan","gloomhaven","spirit-island","spiritisland","terraforming-mars","scythe","pets","pet","petcare","pet-care","petowner","pet-owner","petparents","dogs","dog","puppy","puppies","pupper","doggo","doggos","canine","k9","cats","cat","kitten","kittens","kitty","kitties","feline","meow","birds","bird","parrot","parrots","parakeet","budgie","cockatiel","finch","fish","aquarium","aquariums","fishtank","fish-tank","freshwater","saltwater","reef","reeftank","reef-tank","coral","corals","marine","aquascape","reptiles","reptile","snake","snakes","lizard","lizards","gecko","bearded","turtle","turtles","tortoise","tortoises","terrapin","amphibian","frog","rabbit","rabbits","bunny","bunnies","hare","lagomorph","binky","binkies","hamster","hamsters","gerbil","gerbils","mouse","mice","rat","rats","guinea-pig","guineapig","guinea","cavy","cavies","chinchilla","ferret","horse","horses","equine","equestrian","pony","ponies","riding","stable","farm","farming","farmlife","farm-life","livestock","chicken","chickens","goat","goats","sheep","lamb","lambs","pig","pigs","cow","cows","cattle","english","spanish","espanol","french","francais","german","deutsch","italian","italiano","portuguese","portugues","russian","russkiy","japanese","nihongo","chinese","mandarin","cantonese","zhongwen","korean","hangul","hangugeo","arabic","hindi","urdu","bengali","turkish","turkce","persian","farsi","dutch","nederlands","polish","swedish","svenska","norwegian","norsk","danish","dansk","finnish","greek","ellinika","hebrew","ivrit","vietnamese","tiengviet","thai","indonesian","bahasa","malay","tagalog","filipino","swahili","kiswahili","czech","cestina","hungarian","magyar","romanian","romana","ukrainian","usa","united-states","unitedstates","america","american","americans","canada","canadian","canadians","mexico","mexican","mexicans","brasil","brazil","brazilian","argentina","argentine","chile","chilean","peru","colombia","colombian","venezuela","venezuelan","ecuador","uruguay","uk","united-kingdom","unitedkingdom","britain","british","england","scotland","scottish","wales","welsh","ireland","irish","northern-ireland","france","french","germany","german","germans","italy","italian","italians","spain","spanish","portugal","portuguese","netherlands","dutch","belgium","switzerland","swiss","austria","austrian","poland","polish","czech","russia","russian","russians","ukraine","ukrainian","ukrainians","belarus","china","chinese","taiwan","taiwanese","hongkong","hong-kong","macau","japan","japanese","korea","korean","koreans","north-korea","south-korea","india","indian","indians","pakistan","pakistani","bangladesh","bangladeshi","australia","australian","australians","aussie","aussies","nz","newzealand","new-zealand","kiwi","kiwis","fiji","fijian","samoa","samoan","tonga","philippines","filipino","filipinos","pinoy","pinay","vietnam","vietnamese","thailand","thai","thais","indonesia","indonesian","malaysia","malaysian","singapore","singaporean","brunei","myanmar","burmese","cambodia","cambodian","laos","laotian","nepal","nepali","srilanka","sri-lanka","srilankan","egypt","egyptian","egyptians","morocco","moroccan","algeria","algerian","tunisia","tunisian","libya","libyan","sudan","sudanese","ethiopia","kenya","kenyan","kenyans","tanzania","tanzanian","uganda","ugandan","nigeria","nigerian","nigerians","ghana","ghanaian","senegal","senegalese","southafrica","south-africa","southafrican","south-african","namibia","botswana","zimbabwe","zambia","mozambique","angola","congo","congolese","israel","israeli","israelis","palestine","palestinian","palestinians","jordan","jordanian","lebanon","lebanese","syria","syrian","iraq","iraqi","iran","iranian","iranians","persian","persians","saudi","saudi-arabia","uae","emirates","emirati","dubai","abudhabi","abu-dhabi","qatar","qatari","kuwait","kuwaiti","bahrain","bahraini","oman","omani","yemen","yemeni","turkey","turkish","turks","greece","greek","greeks","cyprus","cypriot","scandinavia","scandinavian","nordic","norway","norwegian","sweden","swedish","denmark","danish","finland","finnish","finns","iceland","icelandic","baltics","baltic","estonia","estonian","latvia","latvian","lithuania","balkans","balkan","serbia","serbian","croatia","croatian","bosnia","slovenia","slovenian","macedonia","macedonian","albania","albanian","romania","romanian","bulgaria","bulgarian","hungary","hungarian","slovakia","slovak","slovakian","moldova","moldovan","georgia","georgian","armenia","armenian","azerbaijan","azerbaijani","kazakhstan","kazakh","uzbekistan","uzbek","turkmenistan","kyrgyzstan","tajikistan","mongolia","caribbean","jamaica","jamaican","bahamas","bahamian","barbados","trinidad","cuba","cuban","haiti","haitian","dominican","puerto-rico","puertorico","latin","latino","latina","latinx","hispanic","latinoamerica","latam","california","cali","ca","socal","norcal","bayarea","bay-area","la","texas","tx","houston","dallas","austin","sanantonio","san-antonio","florida","fl","miami","orlando","tampa","jacksonville","fortlauderdale","newyork","new-york","ny","nyc","brooklyn","manhattan","queens","bronx","pennsylvania","pa","philly","philadelphia","pittsburgh","harrisburg","illinois","il","chicago","chi","chiraq","chitown","springfield","ohio","oh","cleveland","columbus","cincinnati","toledo","akron","georgia","ga","atlanta","atl","savannah","augusta","macon","northcarolina","north-carolina","nc","charlotte","raleigh","durham","southcarolina","south-carolina","sc","charleston","columbia","greenville","michigan","mi","detroit","annarbor","ann-arbor","grandrapids","lansing","newjersey","new-jersey","nj","jersey","newark","trenton","atlantic-city","virginia","va","richmond","norfolk","vb","virginia-beach","alexandria","washington","wa","seattle","tacoma","spokane","olympia","bellevue","arizona","az","phoenix","phx","tucson","scottsdale","mesa","tempe","massachusetts","ma","boston","cambridge","worcester","springfield","tennessee","tn","nashville","memphis","knoxville","chattanooga","indiana","in","indianapolis","indy","fortwayne","fort-wayne","southbend","missouri","mo","stlouis","st-louis","kansascity","kansas-city","springfield","maryland","md","baltimore","bmore","annapolis","bethesda","rockville","wisconsin","wi","milwaukee","madison","greenbay","green-bay","kenosha","colorado","co","denver","boulder","coloradosprings","colorado-springs","minnesota","mn","minneapolis","stpaul","st-paul","twincities","twin-cities","alabama","al","birmingham","montgomery","mobile","huntsville","tuscaloosa","louisiana","la","neworleans","new-orleans","nola","batonrouge","baton-rouge","kentucky","ky","louisville","lexington","bowling-green","frankfort","oregon","or","portland","pdx","eugene","salem","bend","medford","oklahoma","ok","okc","oklahomacity","oklahoma-city","tulsa","norman","connecticut","ct","hartford","newhaven","new-haven","stamford","bridgeport","utah","ut","saltlakecity","salt-lake-city","slc","provo","ogden","iowa","ia","desmoines","des-moines","cedarrapids","cedar-rapids","davenport","nevada","nv","lasvegas","las-vegas","vegas","reno","henderson","sparks","arkansas","ar","littlerock","little-rock","fayetteville","fortsmith","mississippi","ms","jackson","gulfport","biloxi","hattiesburg","southaven","kansas","ks","wichita","overlandpark","overland-park","kansascity","topeka","newmexico","new-mexico","nm","albuquerque","santafe","santa-fe","lascruces","nebraska","ne","omaha","lincoln","bellevue","grandisland","grand-island","idaho","id","boise","meridian","nampa","idahofalls","idaho-falls","pocatello","westvirginia","west-virginia","wv","charleston","huntington","morgantown","hawaii","hi","honolulu","maui","oahu","kauai","bigisland","big-island","newhampshire","new-hampshire","nh","manchester","nashua","concord","portsmouth","maine","me","portland","lewiston","bangor","auburn","augusta","rhodeisland","rhode-island","ri","providence","warwick","cranston","newport","montana","mt","billings","missoula","greatfalls","great-falls","bozeman","delaware","de","wilmington","dover","newark","middletown","smyrna","southdakota","south-dakota","sd","siouxfalls","sioux-falls","rapidcity","northdakota","north-dakota","nd","fargo","bismarck","grandforks","grand-forks","alaska","ak","anchorage","fairbanks","juneau","sitka","ketchikan","vermont","vt","burlington","essex","rutland","colchester","bennington","wyoming","wy","cheyenne","casper","laramie","gillette","rocksprings","dc","washingtondc","washington-dc","dmv","nova","northern-virginia","puertorico","puerto-rico","pr","sanjuan","san-juan","bayamon","carolina","midwest","midwestern","northeast","northeastern","southeast","southeastern","southwest","southwestern","northwest","northwestern","pacificnorthwest","pnw","newengland","new-england","deepouth","deep-south","sunbelt","sun-belt","rustbelt","rust-belt","biblebelt","bible-belt","cornbelt","corn-belt"];async function zy(e){const t=function(e){let t=e.startsWith("#")?e.slice(1):e;return t=t.toLowerCase().replace(/[^a-z0-9-]/g,""),t=t.replace(/-+/g,"-"),t=t.replace(/^-+|-+$/g,""),t}(e);if(!t)throw new Error(`Invalid channel name: "${e}" filters to empty string`);const n=`#${t}`,a=(new TextEncoder).encode(n),s=(await yy(a)).slice(0,16),r=(await yy(s))[0],o=new Uint8Array(32);return o.set(s),{name:`#${t}`,channelHash:r,aesKey:s,hmacKey:o,autoDiscovered:!0}}let _y=null,Iy=null;const Vy=new Map;let Oy=null;const $y="pymc_discovered_channels";function qy(e){Vy.set(e.channelHash,e),e.autoDiscovered&&function(){try{const e=[];for(const t of Vy.values())t.autoDiscovered&&e.push({name:t.name,hash:t.channelHash});localStorage.setItem($y,JSON.stringify(e))}catch(e){}}()}async function Uy(){_y||(Iy||(Iy=(async()=>{await async function(){try{const e=localStorage.getItem($y);if(!e)return;const t=JSON.parse(e);for(const{name:n}of t)try{const e=await zy(n);Vy.set(e.channelHash,e)}catch{}t.length}catch(e){}}();const e=await async function(){const{default:e}=await k(async()=>{const{default:e}=await import("./generated-geo-channels-CkSMgZLG.js");return{default:e}},[]);return[...Ny,...e]}(),t=new Map;for(const n of e)try{const e=await zy(n),a=t.get(e.channelHash)||[];a.push(e),t.set(e.channelHash,a)}catch{}_y=t})()),await Iy)}async function Wy(e,t,n){const a=await async function(e,t){if(dy())try{const n=new ArrayBuffer(e.length);new Uint8Array(n).set(e);const a=new ArrayBuffer(t.length);new Uint8Array(a).set(t);const s=await crypto.subtle.importKey("raw",n,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),r=await crypto.subtle.sign("HMAC",s,a);return new Uint8Array(r)}catch{}return async function(e,t){const n=64;let a;e.length>n?(a=new Uint8Array(n),a.set(fy(e))):(a=new Uint8Array(n),a.set(e));const s=new Uint8Array(n),r=new Uint8Array(n);for(let c=0;c=2024&&n<=2030;if(!a)return{valid:!1,confidence:"low"};const s=e.slice(5);if(0===s.length)return{valid:!1,confidence:"low"};let r=0,o=!1;for(let l=0;l=32&&e<=126||0===e||10===e||13===e||9===e)&&r++,58===e&&(o=!0)}const i=r/s.length;return i>=.85&&o&&a?{valid:!0,confidence:"high"}:i>=.7&&a?{valid:!0,confidence:"medium"}:{valid:!1,confidence:"low"}}async function Yy(e,t,n){await Uy();const a=await async function(){return Oy||(Oy=await async function(e,t=!1){const n=oy(e.secret),a=(await yy(n))[0],s=new Uint8Array(32);return s.set(n.slice(0,32)),{name:e.name,channelHash:a,aesKey:s.slice(0,16),hmacKey:s,autoDiscovered:t}}(Ry)),Oy}();if(a.channelHash===e&&await Wy(a.hmacKey,t,n))return{channelName:"Public",plaintext:By(a.aesKey,n),keys:a};const s=Vy.get(e);if(s&&await Wy(s.hmacKey,t,n)){const e=By(s.aesKey,n);return{channelName:s.name,plaintext:e,keys:s}}const r=(null==_y?void 0:_y.get(e))||[],o=[];for(const l of r){if(await Wy(l.hmacKey,t,n)){qy(l);const e=By(l.aesKey,n);return{channelName:l.name,plaintext:e,keys:l}}o.push(l)}let i=null;for(const l of o)try{const e=By(l.aesKey,n),t=Hy(e);if(t.valid){if("high"===t.confidence)return{channelName:l.name,plaintext:e,keys:l,macCorrupted:!0};"medium"!==t.confidence||i||(i={keys:l,plaintext:e,confidence:"medium"})}}catch{}return i?{channelName:i.keys.name,plaintext:i.plaintext,keys:i.keys,macCorrupted:!0}:null}async function Gy(e){return await Uy(),((null==_y?void 0:_y.get(e))||[]).map(e=>e.name)}async function Ky(e,t,n,a){try{const s=await zy(e);if(s.channelHash!==t)return{success:!1,error:`Hash mismatch: "${e}" has hash 0x${s.channelHash.toString(16).toUpperCase().padStart(2,"0")}, packet has 0x${t.toString(16).toUpperCase().padStart(2,"0")}`};if(!(await Wy(s.hmacKey,n,a)))return{success:!1,error:"MAC verification failed - wrong channel name or corrupted data"};const r=By(s.aesKey,a);return qy(s),{success:!0,result:{channelName:s.name,plaintext:r,keys:s}}}catch(s){return{success:!1,error:`Error: ${s instanceof Error?s.message:String(s)}`}}}let Xy=null,Jy=[];function Zy(e){return{decoded:e.success?{type:"grp_txt",channelHash:e.channelHash,channelName:e.channelName,text:e.text??"",decrypted:!0,senderName:e.senderName,timestamp:e.timestamp,flags:e.flags,macCorrupted:e.macCorrupted,isPublicHashChannel:!0}:null,timestamp:e.packetTimestamp,rssi:e.rssi,snr:e.snr}}const Qy=A((e,t)=>{let n=!1;return{messages:new Map,stableMessages:new Map,lastSnapshotUpdate:0,processing:new Set,progress:{total:0,processed:0,percent:0,isDecoding:!1},initialDecodeComplete:!1,queueDecryption:async(a,s)=>{const{messages:r,processing:o}=t(),i=(null==s?void 0:s.quickMode)??!1;let l=a.filter(e=>(e.type??e.payload_type)===Vf.GRP_TXT&&e.raw_packet&&!r.has(e.packet_hash)&&!o.has(e.packet_hash));if(0===l.length)return;if(i&&l.length>100&&(l=l.sort((e,t)=>(t.timestamp??0)-(e.timestamp??0)).slice(0,100)),n){const e=new Set(Jy.map(e=>e.packet_hash)),t=l.filter(t=>!e.has(t.packet_hash));return void(t.length>0&&Jy.push(...t))}n=!0;const c=new Set(l.map(e=>e.packet_hash));e(e=>({processing:new Set([...e.processing,...c]),progress:{total:l.length,processed:0,percent:0,isDecoding:!0}}));try{const{totalCount:n}=await ff.decrypt(l,{onProgress:(t,n)=>{e({progress:{total:n,processed:t,percent:Math.round(t/n*100),isDecoding:!0}})},onResults:n=>{const{messages:a}=t();for(const e of n)a.set(e.packetHash,Zy(e));e({messages:a}),Xy&&clearTimeout(Xy),Xy=setTimeout(()=>{e({stableMessages:new Map(t().messages),lastSnapshotUpdate:Date.now()})},500)}});Xy&&(clearTimeout(Xy),Xy=null);const a=t().messages;if(a.size>5e4){const e=Array.from(a.entries()).sort((e,t)=>e[1].timestamp-t[1].timestamp).slice(0,a.size-5e4);for(const[t]of e)a.delete(t)}if(e({messages:a,stableMessages:new Map(a),lastSnapshotUpdate:Date.now(),processing:new Set,initialDecodeComplete:!0,progress:{total:n,processed:n,percent:100,isDecoding:!1}}),Jy.length>0){const e=Jy;Jy=[],setTimeout(()=>{t().queueDecryption(e)},50)}}catch(u){e({processing:new Set,progress:{total:0,processed:0,percent:0,isDecoding:!1}})}finally{n=!1}},queueChannelDecryption:async(a,s)=>{const{messages:r,processing:o}=t(),i=await async function(e){const t=await async function(e){return zy(e.startsWith("#")?e.slice(1):e)}(e);return{name:t.name,channelHash:t.channelHash,aesKeyHex:iy(t.aesKey),hmacKeyHex:iy(t.hmacKey)}}(s),l=a.filter(e=>{if((e.type??e.payload_type)!==Vf.GRP_TXT||!e.raw_packet)return!1;if(r.has(e.packet_hash)||o.has(e.packet_hash))return!1;const t=e.raw_packet;if(t.length<4)return!1;const n=3&parseInt(t.slice(0,2),16);let a=2;return 0!==n&&3!==n||(a=10),a+=2+2*parseInt(t.slice(a,a+2),16),parseInt(t.slice(a,a+2),16)===i.channelHash});if(0===l.length)return;if(n)return;n=!0;const c=new Set(l.map(e=>e.packet_hash));e(e=>({processing:new Set([...e.processing,...c]),progress:{total:l.length,processed:0,percent:0,isDecoding:!0}}));try{const{totalCount:n}=await ff.decrypt(l,{knownKey:i,onProgress:(t,n)=>{e({progress:{total:n,processed:t,percent:Math.round(t/n*100),isDecoding:!0}})},onResults:n=>{const{messages:a}=t();for(const e of n)a.set(e.packetHash,Zy(e));e({messages:a}),Xy&&clearTimeout(Xy),Xy=setTimeout(()=>{e({stableMessages:new Map(t().messages),lastSnapshotUpdate:Date.now()})},500)}});Xy&&(clearTimeout(Xy),Xy=null),e({stableMessages:new Map(t().messages),lastSnapshotUpdate:Date.now(),processing:new Set,progress:{total:n,processed:n,percent:100,isDecoding:!1}})}catch(u){e({processing:new Set,progress:{total:0,processed:0,percent:0,isDecoding:!1}})}finally{n=!1}},getMessage:e=>t().messages.get(e),getSuccessfulMessages:()=>{var e;const{messages:n}=t(),a=[];for(const t of n.values())(null==(e=t.decoded)?void 0:e.decrypted)&&!t.decoded.macCorrupted&&a.push(t);return a.sort((e,t)=>e.timestamp-t.timestamp)},clear:()=>{Xy&&(clearTimeout(Xy),Xy=null),e({messages:new Map,stableMessages:new Map,lastSnapshotUpdate:0,processing:new Set,progress:{total:0,processed:0,percent:0,isDecoding:!1},initialDecodeComplete:!1})}}});function eb(e){return Qy(t=>t.messages.get(e))}function tb(){return Qy(e=>e.progress)}function nb(){return Qy(e=>e.initialDecodeComplete)}function ab(){return Qy(e=>e.stableMessages)}function sb(){return Qy(e=>e.stableMessages)}const rb=[{label:"20m",minutes:20,buckets:80},{label:"1h",minutes:60,buckets:80},{label:"3h",minutes:180,buckets:80},{label:"12h",minutes:720,buckets:80},{label:"24h",minutes:1440,buckets:80},{label:"3d",minutes:4320,buckets:80},{label:"7d",minutes:10080,buckets:80},{label:"14d",minutes:20160,buckets:80},{label:"21d",minutes:30240,buckets:80},{label:"30d",minutes:43200,buckets:80},{label:"90d",minutes:129600,buckets:80}],ob=[{label:"1h",hours:1},{label:"3h",hours:3},{label:"12h",hours:12},{label:"24h",hours:24},{label:"3d",hours:72},{label:"7d",hours:168},{label:"14d",hours:336},{label:"21d",hours:504},{label:"30d",hours:720},{label:"90d",hours:2160}];function ib(e,t=12){return Math.max(t,Math.round(e/15))}const lb={hero:ib(1200),statsCard:ib(380)};function cb(e){switch(e){case 1:return 3600;case 3:case 12:return 5400;case 24:return 8640;case 72:case 168:case 336:case 504:case 720:case 2160:return 720;default:{const t=3600*e,n=Math.round(t/10);return Math.min(Math.max(360,n),720)}}}const ub="'JetBrains Mono', 'SF Mono', Monaco, monospace",db={stats:3e3,logs:2e3,system:3e3},hb={DEBUG:"text-sys-orange",INFO:"text-sys-cyan",WARNING:"text-sys-amber",ERROR:"text-sys-red",CRITICAL:"text-sys-pink"};function mb(e){return hb[e]??"text-fg-muted border-edge-subtle"}function pb(e){return e?(e.startsWith("0x")?e.slice(2):e).slice(0,2).toUpperCase():""}function gb(e,t){if(!e)return"expired";const n=t/1e3-e;return n<=10800?"active":n<=86400?"stale":"expired"}function fb(e,t,n=Date.now()){if(!e)return[];const a=Object.keys(e);if(0===a.length)return[];const s=[];for(let r=0;rt.count!==e.count?t.count-e.count:t.lastSeen-e.lastSeen),s}const yb={critical:0,high:150,medium:300,low:450};let bb=!1;const vb=[],wb=new Set;function Cb(e,t="medium"){if(bb){const n=setTimeout(()=>{e(),wb.delete(n)},yb[t]);return wb.add(n),()=>{clearTimeout(n),wb.delete(n)}}{const n={callback:e,priority:t};return vb.push(n),()=>{const e=vb.indexOf(n);-1!==e&&vb.splice(e,1)}}}function kb(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2,4).toUpperCase():e.slice(0,2).toUpperCase()}function xb(e,t){let n=e.forwarded_path??e.original_path;if("string"==typeof n)try{n=JSON.parse(n)}catch{return null}if(!n||!Array.isArray(n)||0===n.length)return null;const a=n.map(e=>String(e).toUpperCase()),s=t?kb(t):null,r=a[a.length-1],o=null!==s&&r===s,i=o?a.slice(0,-1):[...a];return{effective:i,original:a,hadLocal:o,effectiveLength:i.length}}function Db(e,t){let n=e;if("string"==typeof n)try{n=JSON.parse(n)}catch{return null}if(!n||!Array.isArray(n)||0===n.length)return null;const a=n.map(e=>String(e).toUpperCase()),s=t?kb(t):null,r=a[a.length-1],o=null!==s&&r===s,i=o?a.slice(0,-1):[...a];return{effective:i,original:a,hadLocal:o,effectiveLength:i.length}}function Ab(e,t){const n=e.toUpperCase();return t.startsWith("0x")||t.startsWith("0X")?t.slice(2).toUpperCase().startsWith(n):t.toUpperCase().startsWith(n)}function Eb(e){return 4===(e.type??e.payload_type)&&!0!==e.transmitted&&function(e){const t=function(e){if(Array.isArray(e))return e;if("string"==typeof e&&e.startsWith("["))try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}return[]}(e.original_path),n=e.route??e.route_type;return 2===(a=n)||3===a?0===t.length:Es(n)?t.length<=1:0===t.length;var a}(e)}function Bb(e,t,n,a){if(!e)return null;let s=e;if(e.length<=4){const a=e.replace(/^0x/i,"").toUpperCase();if(a===t)return null;const r=n.get(a);if(!r)return null;s=r}return a.has(s)?kb(s)===t?null:s:null}function Fb(e,t){e.count++,void 0!==t.rssi&&null!==t.rssi&&(e.rssiSum+=t.rssi,e.rssiCount++),void 0!==t.snr&&null!==t.snr&&(e.snrSum+=t.snr,e.snrCount++);const n=t.timestamp??0;n>e.lastSeen&&(e.lastSeen=n)}function Sb(e){return{hash:e,count:0,rssiSum:0,rssiCount:0,snrSum:0,snrCount:0,lastSeen:0}}function Mb(e,t){const n=function(e,t){const n=t-1e3*e;return n<=6048e5?"active":n<=12096e5?"stale":"expired"}(e.lastSeen,t);return"expired"===n?null:{hash:e.hash,prefix:kb(e.hash),count:e.count,avgRssi:e.rssiCount>0?e.rssiSum/e.rssiCount:null,avgSnr:e.snrCount>0?e.snrSum/e.snrCount:null,lastSeen:e.lastSeen,status:n}}const jb="pymc-hidden-contacts",Tb="pymc-quick-neighbors",Pb="pymc-local-hash",Lb="pymc-global-time-range";let Rb=null;function Nb(){if("undefined"==typeof window)return[];try{const e=localStorage.getItem(Tb);if(e)return JSON.parse(e)}catch{}return[]}function zb(e){"undefined"!=typeof window&&(Rb&&clearTimeout(Rb),Rb=setTimeout(()=>{try{localStorage.setItem(Tb,JSON.stringify(e))}catch{}Rb=null},1e3))}function _b(){if("undefined"!=typeof window)try{const e=localStorage.getItem(Pb);if(e)return e}catch{}}function Ib(e){if("undefined"!=typeof window)try{localStorage.setItem(Pb,e)}catch{}}function Vb(){if("undefined"==typeof window)return new Set;try{const e=localStorage.getItem(jb);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function Ob(){if("undefined"==typeof window)return 4;try{const e=localStorage.getItem(Lb);if(e){const t=parseInt(e,10);if(!isNaN(t)&&t>=0&&t<=10)return t>4?4:t}}catch{}return 4}const $b=A((e,t)=>({stats:null,statsLoading:!1,statsError:null,packets:Gg.getPackets(),packetsLoading:!1,packetsError:null,lastPacketTimestamp:Gg.getNewestTimestamp(),logs:[],logsLoading:!1,liveMode:!0,flashReceived:0,flashAdvert:0,pendingAdvertLocalHash:null,pendingAdvertTimestamp:null,resourceHistory:[],lastResourceFetch:0,hardwareStats:null,hardwareStatsLoading:!1,hardwareStatsError:null,hiddenContacts:Vb(),quickNeighbors:Nb(),cachedLocalHash:_b(),initialized:!1,packetCacheState:Gg.getState(),mutationsInFlight:new Set,globalTimeRangeIndex:Ob(),initializeApp:async()=>{const{initialized:n}=t();if(n)return;e({initialized:!0,statsLoading:!0,packetsLoading:!0}),Gg.subscribe(t=>{e({packetCacheState:t})});const{hiddenContacts:a}=t();let s=0;yg().then(t=>{const n=fb(t.neighbors,a),s=t.local_hash;e({stats:t,statsLoading:!1,quickNeighbors:n,cachedLocalHash:s}),zb(n),s&&Ib(s)}).catch(t=>{e({statsError:t instanceof Error?t.message:"Failed to fetch stats",statsLoading:!1})}),Gg.initialLoad(()=>{const t=Date.now();if(t-s>=50){s=t;const n=Gg.getPackets();if(n.length>0){const t=Gg.getNewestTimestamp();e({packets:n,lastPacketTimestamp:t})}}}).then(n=>{if(n.length>0){const a=Gg.getNewestTimestamp();e({packets:n,packetsLoading:!1,lastPacketTimestamp:a});const s=(e,t)=>{"requestIdleCallback"in window?requestIdleCallback(()=>e(),{timeout:t}):setTimeout(e,100)};s(()=>t().triggerTopologyCompute(),2e3),s(()=>t().triggerSparklineCompute(),1e3),setTimeout(()=>function(){if(!bb){bb=!0;for(const e of vb){const t=yb[e.priority],n=setTimeout(()=>{e.callback(),wb.delete(n)},t);wb.add(n)}vb.length=0}}(),16),setTimeout(()=>{Qy.getState().queueDecryption(n,{quickMode:!0})},500)}else e({packetsLoading:!1})}).catch(t=>{e({packetsError:t instanceof Error?t.message:"Failed to load packets",packetsLoading:!1})}),ef.getState().initialize(),Qg.onPacket(n=>{const{lastPacketTimestamp:a,mutationsInFlight:s}=t();if(s.size>0)return;Gg.mergePacketsDirectly([n]);const r=n.timestamp??0;if(r>a){const n=Gg.getPackets();e({packets:n,flashReceived:t().flashReceived+1,lastPacketTimestamp:r}),Cg()}Qy.getState().queueDecryption([n])}),Qg.onStats(n=>{const{mutationsInFlight:a,hiddenContacts:s}=t();if(a.size>0)return;const r=fb(n.neighbors,s),o=n.local_hash;e({stats:n,statsLoading:!1,statsError:null,quickNeighbors:r,cachedLocalHash:o}),zb(r),o&&Ib(o)}),Qg.onPacketStats(n=>{const{stats:a,mutationsInFlight:s}=t();if(!a||s.size>0)return;const r={...a,rx_count:n.rx_count??a.rx_count,tx_count:n.tx_count??a.tx_count,forwarded_count:n.forwarded_count??a.forwarded_count,dropped_count:n.dropped_count??a.dropped_count};e({stats:r})}),function(e){if(setInterval(()=>{Gg.isHeavyLoadInProgress()||e().mutationsInFlight.size>0||e().fetchStats().then(()=>{pf.getState().updateRestHealth(!0)}).catch(()=>{pf.getState().updateRestHealth(!1)})},db.stats),function t(){const n=Qg.isConnected()?15e3:3e3;setTimeout(async()=>{e().liveMode&&!Gg.isHeavyLoadInProgress()&&await e().fetchPackets(),t()},n)}(),"undefined"!=typeof document){let t=Date.now();const n=3e5;document.addEventListener("visibilitychange",async()=>{document.hidden?t=Date.now():(Date.now()-t>n&&(Qg.resetSupported(),Qg.isConnected()?await Qg.verifyConnection(3e3)||(Qg.disconnect(),Qg.connect()):Qg.isSupported()&&Qg.connect()),e().fetchStats({force:!0}),e().fetchPackets())})}}(t),t().fetchHardwareStats(),setInterval(()=>{"undefined"!=typeof document&&document.hidden||t().fetchHardwareStats()},db.system)},prefetchForRoute:e=>{switch(e){case"/logs":bg().catch(()=>{});break;case"/system":Ag().catch(()=>{});break;case"/statistics":(async function(e=24){return hg(`/api/packet_type_graph_data?hours=${e}`)})(3).catch(()=>{}),vg(3).catch(()=>{});break;case"/settings":(async function(){return hg("/api/radio_presets")})().catch(()=>{})}},fetchStats:async n=>{const{stats:a,mutationsInFlight:s,hiddenContacts:r}=t();if(!(s.size>0)||(null==n?void 0:n.force)){a||e({statsLoading:!0}),e({statsError:null});try{const t=await yg(),n=fb(t.neighbors,r),a=t.local_hash;e({stats:t,statsLoading:!1,quickNeighbors:n,cachedLocalHash:a}),zb(n),a&&Ib(a)}catch(o){e({statsError:o instanceof Error?o.message:"Failed to fetch stats",statsLoading:!1})}}},fetchPackets:async n=>{const{packets:a,lastPacketTimestamp:s}=t();0===a.length&&e({packetsLoading:!0}),e({packetsError:null});try{const n=await Gg.poll(),r=Gg.getNewestTimestamp(),o=r>s&&s>0,i=n.length!==a.length||o;o&&(e({flashReceived:t().flashReceived+1}),Cg()),i?(e({packets:n,packetsLoading:!1,lastPacketTimestamp:r||s}),Qy.getState().queueDecryption(n)):e({packetsLoading:!1})}catch(r){e({packetsError:r instanceof Error?r.message:"Failed to fetch packets",packetsLoading:!1})}},fetchLogs:async()=>{const{logs:n}=t();0===n.length&&e({logsLoading:!0});try{const t=await bg();e({logs:t.logs,logsLoading:!1})}catch{e({logsLoading:!1})}},setLiveMode:t=>{e({liveMode:t})},setMode:async n=>{const a="setMode",{mutationsInFlight:s}=t(),r=new Set(s);r.add(a),e({mutationsInFlight:r});try{if(!(await Sg(n)).success)throw new Error("Backend returned unsuccessful response");await t().fetchStats({force:!0})}catch(o){const{mutationsInFlight:n}=t(),s=new Set(n);throw s.delete(a),e({mutationsInFlight:s}),o}},clearModeMutation:()=>{const{mutationsInFlight:n}=t(),a=new Set(n);a.delete("setMode"),e({mutationsInFlight:a})},setDutyCycle:async n=>{const a="setDutyCycle",{mutationsInFlight:s}=t(),r=new Set(s);r.add(a),e({mutationsInFlight:r});try{if(!(await Mg(n)).success)throw new Error("Backend returned unsuccessful response");await t().fetchStats({force:!0})}finally{const{mutationsInFlight:n}=t(),s=new Set(n);s.delete(a),e({mutationsInFlight:s})}},setDutyCycleConfig:async n=>{var a;const s="setDutyCycleConfig",{mutationsInFlight:r}=t(),o=new Set(r);o.add(s),e({mutationsInFlight:o});try{const e=await async function(e){return hg("/api/update_duty_cycle_config",{method:"POST",body:JSON.stringify(e)})}(n);if(!e.success&&!(null==(a=e.data)?void 0:a.persisted))throw new Error("Backend returned unsuccessful response");await t().fetchStats({force:!0})}catch(i){const{mutationsInFlight:n}=t(),a=new Set(n);throw a.delete(s),e({mutationsInFlight:a}),i}},clearDutyCycleMutation:()=>{const{mutationsInFlight:n}=t(),a=new Set(n);a.delete("setDutyCycleConfig"),e({mutationsInFlight:a})},startMutation:n=>{const{mutationsInFlight:a}=t(),s=new Set(a);s.add(n),e({mutationsInFlight:s})},clearMutation:n=>{const{mutationsInFlight:a}=t(),s=new Set(a);s.delete(n),e({mutationsInFlight:s})},sendAdvert:async()=>{try{const n=await Fg();return n.success?(e({flashAdvert:t().flashAdvert+1}),{success:!0}):{success:!1,error:n.error||"Failed to send advert"}}catch(n){return{success:!1,error:n instanceof Error?n.message:"Unknown error"}}},triggerFlashReceived:()=>{e({flashReceived:t().flashReceived+1})},triggerFlashAdvert:()=>{e({flashAdvert:t().flashAdvert+1})},fetchHardwareStats:async()=>{try{const n=await Ag();if(n.success&&n.data){const a=n.data;e({hardwareStats:a,hardwareStatsLoading:!1,hardwareStatsError:null});const s=80;t().addResourceDataPoint(a.cpu.usage_percent,a.memory.usage_percent,s)}else e({hardwareStatsError:n.error??"Failed to fetch hardware stats",hardwareStatsLoading:!1})}catch(n){e({hardwareStatsError:n instanceof Error?n.message:"Failed to fetch hardware stats",hardwareStatsLoading:!1})}},addResourceDataPoint:(n,a,s)=>{const r=Date.now(),{lastResourceFetch:o,resourceHistory:i}=t();if(r-o<1e3)return;const l=[...i,{timestamp:r,time:new Date(r).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),cpu:n,memory:a}],c=l.length>s?l.slice(-s):l;e({resourceHistory:c,lastResourceFetch:r})},hideContact:n=>{const{hiddenContacts:a}=t(),s=new Set(a);s.add(n),e({hiddenContacts:s}),function(e){if("undefined"!=typeof window)try{localStorage.setItem(jb,JSON.stringify([...e]))}catch{}}(s)},clearPacketCache:()=>{Gg.clear(),e({packets:[],lastPacketTimestamp:0}),Gg.quickLoad().then(n=>{if(n.length>0){const a=n.reduce((e,t)=>Math.max(e,t.timestamp??0),0);e({packets:n,lastPacketTimestamp:a}),t().triggerTopologyCompute()}})},triggerTopologyCompute:()=>{var e,n,a,s;const{packets:r,stats:o,hiddenContacts:i}=t();if(0===r.length||!o)return;const l=o.neighbors??{},c=Object.fromEntries(Object.entries(l).filter(([e])=>!i.has(e))),u=o.local_hash;let d=null==(n=null==(e=o.config)?void 0:e.repeater)?void 0:n.latitude,h=null==(s=null==(a=o.config)?void 0:a.repeater)?void 0:s.longitude;if(!d||!h||0===d&&0===h){const e=hf.getState().getEffectiveLocation();e&&(d=e.latitude,h=e.longitude)}const m=[];for(const[t,g]of Object.entries(c))g.zero_hop&&m.push({hash:t,advertCount:g.advert_count??1,avgRssi:g.rssi??null,avgSnr:g.snr??null,lastSeen:g.last_seen??0,latitude:g.latitude,longitude:g.longitude});const p=rf.getState().getTerrainGridForDisambiguation();Jg.compute(r,c,u,d,h,void 0,m,p??void 0)},triggerDeepAnalysis:async()=>{await Gg.forceDeepLoad();const n=Gg.getPackets();if(n.length>0){const a=n.reduce((e,t)=>Math.max(e,t.timestamp??0),0);e({packets:n,lastPacketTimestamp:a}),t().triggerTopologyCompute(),t().triggerSparklineCompute()}},updateQuickNeighbors:()=>{const{packets:n,stats:a,hiddenContacts:s}=t();if(0===n.length||!a)return;const r=a.neighbors??{},o=function(e,t,n){if(!n||0===e.length||0===Object.keys(t).length)return[];const a=Date.now(),s=kb(n),r=new Set(Object.keys(t)),o=function(e){var t,n;const a=new Map;for(const s of Object.keys(e)){const r=kb(s),o=a.get(r);if(o){const i=null==(t=e[o])?void 0:t.zero_hop;(null==(n=e[s])?void 0:n.zero_hop)&&!i&&a.set(r,s)}else a.set(r,s)}return a}(t),i=new Map;for(const c of e){if(!Eb(c))continue;const e=Bb(c.src_hash,s,o,r);if(!e)continue;let t=i.get(e);t||(t=Sb(e),i.set(e,t)),Fb(t,c)}for(const[c,u]of Object.entries(t))kb(c)!==s&&u.zero_hop&&!i.has(c)&&i.set(c,{hash:c,count:u.advert_count??0,rssiSum:u.rssi??0,rssiCount:void 0!==u.rssi?1:0,snrSum:u.snr??0,snrCount:void 0!==u.snr?1:0,lastSeen:u.last_seen??0});const l=[];for(const c of i.values()){const e=Mb(c,a);e&&l.push(e)}return l.sort((e,t)=>t.count!==e.count?t.count-e.count:t.lastSeen-e.lastSeen),l}(n,Object.fromEntries(Object.entries(r).filter(([e])=>!s.has(e))),a.local_hash),i=t().quickNeighbors;(o.length!==i.length||o.some((e,t)=>{var n,a;return e.hash!==(null==(n=i[t])?void 0:n.hash)||e.count!==(null==(a=i[t])?void 0:a.count)}))&&(e({quickNeighbors:o}),zb(o))},triggerSparklineCompute:()=>{const{packets:e,stats:n,hiddenContacts:a}=t();if(0===e.length||!n)return;const s=n.neighbors??{},r=Object.keys(s).filter(e=>!a.has(e));0!==r.length&&Zg.compute(e,r)},requestSevenDayData:async()=>{let n=0;await Gg.loadSevenDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:Gg.getPackets()}))});const a=Gg.getPackets();e({packets:a,lastPacketTimestamp:Gg.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Qy.getState().queueDecryption(a)},{timeout:2e3})},requestThreeDayData:async()=>{let n=0;await Gg.loadThreeDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:Gg.getPackets()}))});const a=Gg.getPackets();e({packets:a,lastPacketTimestamp:Gg.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Qy.getState().queueDecryption(a)},{timeout:2e3})},requestFourteenDayData:async()=>{let n=0;await Gg.loadFourteenDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:Gg.getPackets()}))});const a=Gg.getPackets();e({packets:a,lastPacketTimestamp:Gg.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Qy.getState().queueDecryption(a)},{timeout:5e3})},requestTwentyOneDayData:async()=>{let n=0;await Gg.loadTwentyOneDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:Gg.getPackets()}))});const a=Gg.getPackets();e({packets:a,lastPacketTimestamp:Gg.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Qy.getState().queueDecryption(a)},{timeout:5e3})},requestThirtyDayData:async()=>{let n=0;await Gg.loadThirtyDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:Gg.getPackets()}))});const a=Gg.getPackets();e({packets:a,lastPacketTimestamp:Gg.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Qy.getState().queueDecryption(a)},{timeout:8e3})},requestNinetyDayData:async()=>{let n=0;await Gg.loadNinetyDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:Gg.getPackets()}))});const a=Gg.getPackets();e({packets:a,lastPacketTimestamp:Gg.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Qy.getState().queueDecryption(a)},{timeout:1e4})},setGlobalTimeRange:n=>{e({globalTimeRangeIndex:n}),function(e){if("undefined"!=typeof window)try{localStorage.setItem(Lb,e.toString())}catch{}}(n);const{packetCacheState:a,requestThreeDayData:s,requestSevenDayData:r,requestFourteenDayData:o,requestTwentyOneDayData:i,requestThirtyDayData:l,requestNinetyDayData:c,triggerTopologyCompute:u,triggerSparklineCompute:d}=t();let h=!1;const m={5:{complete:a.threeDayLoadComplete,load:()=>s()},6:{complete:a.sevenDayLoadComplete,load:()=>r()},7:{complete:a.fourteenDayLoadComplete,load:()=>o()},8:{complete:a.twentyOneDayLoadComplete,load:()=>i()},9:{complete:a.thirtyDayLoadComplete,load:()=>l()},10:{complete:a.ninetyDayLoadComplete,load:()=>c()}}[n];if(!m||m.complete||a.isBackgroundLoading||(m.load(),h=!0),!h&&n>=5&&(u(),d()),!h){const{packets:e}=t();Qy.getState().queueDecryption(e)}}})),qb=$b,Ub=()=>$b(e=>e.stats),Wb=()=>$b(e=>e.statsError),Hb=()=>$b(e=>e.packets),Yb=()=>$b(e=>e.packetsLoading),Gb=()=>$b(e=>e.logs),Kb=()=>$b(e=>e.logsLoading),Xb=()=>$b(e=>e.liveMode),Jb=()=>$b(e=>e.fetchLogs),Zb=()=>$b(e=>e.setLiveMode),Qb=()=>$b(e=>e.resourceHistory),ev=()=>$b(e=>e.hardwareStats),tv=()=>$b(e=>e.hardwareStatsLoading),nv=()=>$b(e=>e.hardwareStatsError),av=()=>$b(e=>e.fetchHardwareStats),sv=()=>$b(e=>e.hiddenContacts),rv=()=>$b(e=>e.hideContact),ov=()=>$b(e=>e.packetCacheState),iv=()=>$b(e=>e.quickNeighbors),lv=()=>$b(e=>e.cachedLocalHash),cv=()=>$b(e=>e.lastPacketTimestamp),uv=()=>$b(e=>e.globalTimeRangeIndex),dv=()=>$b(e=>e.setGlobalTimeRange),hv=()=>$b(e=>null!==e.stats&&e.packetCacheState.backgroundLoadComplete),mv=()=>$b(e=>e.packets.length>0);function pv(){const e=$b(e=>{var t,n,a;return null==(a=null==(n=null==(t=e.stats)?void 0:t.config)?void 0:n.repeater)?void 0:a.latitude}),t=$b(e=>{var t,n,a;return null==(a=null==(n=null==(t=e.stats)?void 0:t.config)?void 0:n.repeater)?void 0:a.longitude}),n=$b(e=>{var t,n,a;return(null==(n=null==(t=e.stats)?void 0:t.config)?void 0:n.node_name)||(null==(a=e.stats)?void 0:a.node_name)||"Local Node"}),a=hf(e=>e.latitude),s=hf(e=>e.longitude),r=hf(e=>e.enabled);return e&&t&&(0!==e||0!==t)?{latitude:e,longitude:t,name:n,isStealth:!1}:r&&null!==a&&null!==s?{latitude:a,longitude:s,name:n,isStealth:!0}:null}const gv={healthy:{p3:"color(display-p3 0.2 1 0.4)",fallback:"#00FF66"},degraded:{p3:"color(display-p3 1 0.7 0.2)",fallback:"#FFB020"},offline:{p3:"color(display-p3 1 0.3 0.3)",fallback:"#EF4444"},connecting:{p3:"color(display-p3 0.4 0.6 1)",fallback:"#6699FF"},rx:{p3:"color(display-p3 0.2 1 0.4)",fallback:"#00FF66"},tx:{p3:"color(display-p3 1 0.9 0.2)",fallback:"#FFDD00"},idle:{p3:"color(display-p3 0.3 0.3 0.35)",fallback:"#4A4A55"}};function fv({color:e,pulse:t=!1,className:n}){var a;return r.jsx("span",{className:i("inline-block rounded-full w-1 h-1",t&&"animate-pulse",n),style:{backgroundColor:e.fallback,...(null==(a=CSS.supports)?void 0:a.call(CSS,"color","color(display-p3 1 1 1)"))&&{backgroundColor:e.p3}}})}function yv({showLabel:e=!1,className:t}){const n=$b(e=>e.flashReceived),a=$b(e=>e.flashAdvert),o=ef(e=>"connected"===e.connectionState),l=gf(),c=pf(e=>e.isInitializing),[u,d]=s.useState("idle"),h=s.useRef(0),m=s.useRef(0);s.useEffect(()=>{if(n<=0)return;const e=Date.now();if(e-h.current<50)return;h.current=e,d("rx");const t=setTimeout(()=>d("idle"),100);return()=>clearTimeout(t)},[n]),s.useEffect(()=>{if(a<=0)return;const e=Date.now();if(e-m.current<50)return;m.current=e,d("tx");const t=setTimeout(()=>d("idle"),100);return()=>clearTimeout(t)},[a]);let p=gv.healthy,g=!1,f="LIVE",y="Real-time (WebSocket)";c?(p=gv.connecting,g=!0,f="WAIT",y="Connecting..."):"offline"===l?(p=gv.offline,g=!0,f="DOWN",y="Cannot reach server"):"degraded"===l?(p=gv.degraded,f="POLL",y="Real-time unavailable, using REST polling"):o?(p=gv.healthy,f="LIVE",y="Real-time (WebSocket)"):(p=gv.healthy,f="POLL",y="Database polling");const b="rx"===u?gv.rx:"tx"===u?gv.tx:gv.idle;return r.jsxs("span",{className:i("inline-flex items-center gap-1.5",t),title:y,children:[r.jsxs("span",{className:"inline-flex items-center justify-center gap-1 w-5 h-5 rounded bg-body border border-edge-subtle",children:[r.jsx(fv,{color:p,pulse:g}),r.jsx(fv,{color:b})]}),e&&r.jsx("span",{className:i("type-data-xs","DOWN"===f?"text-status-danger":"WAIT"===f?"text-sys-blue":"POLL"===f?"text-status-warning":"text-fg-muted"),children:f})]})}function bv({borderRadius:e}){return r.jsx(Nm.div,{initial:{opacity:0},animate:{opacity:.8,backgroundPosition:["200% 0%","-200% 0%"]},exit:{opacity:0},transition:{opacity:{duration:.2},backgroundPosition:{duration:2,ease:"easeInOut",repeat:1/0}},style:{position:"absolute",inset:0,zIndex:1,pointerEvents:"none",borderRadius:e,padding:2,background:"linear-gradient(\n 90deg,\n transparent 0%,\n transparent 25%,\n var(--sys-blue) 50%,\n transparent 75%,\n transparent 100%\n )",backgroundSize:"200% 100%",mask:"\n linear-gradient(#fff 0 0) content-box,\n linear-gradient(#fff 0 0)\n ",maskComposite:"exclude",WebkitMaskComposite:"xor"}})}function vv({children:e,isLoading:t=!0,className:n,borderRadius:a=12}){return r.jsxs("div",{className:i("relative overflow-hidden",n),style:{borderRadius:a},children:[r.jsx(kh,{children:t&&r.jsx(bv,{borderRadius:a})}),r.jsx("div",{className:"relative z-10",children:e})]})}function wv({className:e}){return r.jsx("div",{className:i("relative w-10 h-1 rounded-sm overflow-hidden","bg-elevated",e),children:r.jsx(Nm.div,{animate:{backgroundPosition:["200% 0%","-200% 0%"]},transition:{duration:1.5,ease:"easeInOut",repeat:1/0},className:"absolute inset-0",style:{background:"linear-gradient(\n 90deg,\n transparent 0%,\n var(--sys-blue) 50%,\n transparent 100%\n )",backgroundSize:"200% 100%"}})})}const Cv=A(e=>({sparklines:new Map,isComputing:!1,lastUpdated:0,nodeCount:0,setSparklines:t=>e({sparklines:t,lastUpdated:Date.now(),nodeCount:t.size,isComputing:!1}),setComputing:t=>e({isComputing:t})}));"undefined"!=typeof window&&setTimeout(()=>{Zg.subscribe((e,t)=>{const n=Cv.getState();t&&!n.isComputing?n.setComputing(!0):!t&&e.size>0?n.setSparklines(e):!t&&n.isComputing&&n.setComputing(!1)})},0);const kv=()=>Cv(e=>e.sparklines),xv=()=>Cv(e=>e.isComputing),Dv=[],Av=new Map;function Ev(e){return Cv(t=>{const n=t.sparklines.get(e);if(!n||0===n.length)return Dv;const a=Av.get(e);return a===n?a:(Av.set(e,n),n)})}const Bv="pymc_room_seen_",Fv="pymc_room_selected";function Sv(e){try{const t=localStorage.getItem(`${Bv}${e}`);return t?Number(t):0}catch{return 0}}function Mv(e){const t=new Map;for(const n of e){const e=Math.floor(n.post_timestamp/30),a=`${n.author_pubkey}|${e}|${n.message_text}`,s=t.get(a);(!s||n.ids&&e{let n=null;return{rooms:[],selectedRoom:null,messages:[],clients:[],identities:[],unreadCount:0,lastSeenMap:new Map,isLoading:!1,error:null,initialize:()=>{n||(t().fetchRooms(),n=setInterval(()=>{t().fetchRooms()},1e4))},fetchRooms:async()=>{try{const[n,a]=await Promise.all([Pg(),Tg()]),s=n.success&&n.data?n.data.rooms:[],r=(a.success&&a.data?a.data.configured:[]).filter(e=>"room_server"===e.type),o=new Set(r.map(e=>e.name)),i=s.filter(e=>o.has(e.room_name)),l=new Map;for(const e of i)l.set(e.room_name,Sv(e.room_name));const c=Tv(i,l);e({rooms:i,identities:r,lastSeenMap:l,unreadCount:c,error:null});const{selectedRoom:u}=t();if(!u&&i.length>0){const e=function(){try{return localStorage.getItem(Fv)}catch{return null}}(),n=e&&i.some(t=>t.room_name===e)?e:i[0].room_name;t().selectRoom(n)}}catch(n){e({error:n instanceof Error?n.message:"Failed to fetch rooms"})}},selectRoom:async n=>{const{selectedRoom:a}=t();e(a!==n?{selectedRoom:n,messages:[],clients:[],isLoading:!0}:{selectedRoom:n,isLoading:!0}),function(e){try{localStorage.setItem(Fv,e)}catch{}}(n),await Promise.all([t().fetchMessages(),t().fetchClients()]),e({isLoading:!1})},fetchMessages:async n=>{const{selectedRoom:a,messages:s}=t();if(!a)return;const r={room_name:a,limit:200};if((null==n?void 0:n.incremental)&&s.length>0){const e=Math.max(...s.map(e=>e.post_timestamp));r.since_timestamp=e}try{const t=await async function(e){const t=new URLSearchParams;return e.room_name&&t.set("room_name",e.room_name),e.room_hash&&t.set("room_hash",e.room_hash),void 0!==e.limit&&t.set("limit",e.limit.toString()),void 0!==e.offset&&t.set("offset",e.offset.toString()),void 0!==e.since_timestamp&&t.set("since_timestamp",e.since_timestamp.toString()),hg(`/api/room_messages?${t.toString()}`)}(r);if(!t.success||!t.data)return;if((null==n?void 0:n.incremental)&&s.length>0){const n=new Set(s.map(e=>e.id)),a=t.data.messages.filter(e=>!n.has(e.id));a.length>0&&e({messages:Mv([...s,...a])})}else e({messages:Mv(t.data.messages)})}catch(o){}},postMessage:async e=>{try{return!!(await async function(e){return hg("/api/room_post_message",{method:"POST",body:JSON.stringify(e)})}(e)).success&&(await t().fetchMessages(),!0)}catch{return!1}},deleteMessage:async n=>{const{selectedRoom:a}=t();if(!a)return!1;try{return!!(await async function(e){const t=new URLSearchParams;return e.room_name&&t.set("room_name",e.room_name),e.room_hash&&t.set("room_hash",e.room_hash),t.set("message_id",e.message_id.toString()),hg(`/api/room_message?${t.toString()}`,{method:"DELETE"})}({room_name:a,message_id:n})).success&&(e({messages:t().messages.filter(e=>e.id!==n)}),!0)}catch{return!1}},clearMessages:async()=>{const{selectedRoom:n}=t();if(!n)return!1;try{return!!(await async function(e){const t=new URLSearchParams;return e.room_name&&t.set("room_name",e.room_name),e.room_hash&&t.set("room_hash",e.room_hash),hg(`/api/room_messages_clear?${t.toString()}`,{method:"DELETE"})}({room_name:n})).success&&(e({messages:[]}),!0)}catch{return!1}},fetchClients:async()=>{const{selectedRoom:n}=t();if(n)try{const t=await async function(e){const t=new URLSearchParams;return e.room_name&&t.set("room_name",e.room_name),e.room_hash&&t.set("room_hash",e.room_hash),hg(`/api/room_clients?${t.toString()}`)}({room_name:n});t.success&&t.data&&e({clients:t.data.clients.filter(e=>e.in_acl)})}catch{}},markAsRead:()=>{const{selectedRoom:n,rooms:a,lastSeenMap:s}=t();if(!n)return;const r=Math.floor(Date.now()/1e3);!function(e,t){try{localStorage.setItem(`${Bv}${e}`,String(t))}catch{}}(n,r);const o=new Map(s);o.set(n,r),e({lastSeenMap:o,unreadCount:Tv(a,o)})},createRoom:async e=>{try{return!!(await async function(e){return hg("/api/create_identity",{method:"POST",body:JSON.stringify(e)})}(e)).success&&(await t().fetchRooms(),!0)}catch{return!1}},updateRoom:async e=>{try{return!!(await async function(e){return hg("/api/update_identity",{method:"PUT",body:JSON.stringify(e)})}(e)).success&&(await t().fetchRooms(),!0)}catch{return!1}},deleteRoom:async n=>{try{const a=await async function(e){return hg(`/api/delete_identity?name=${encodeURIComponent(e)}`,{method:"DELETE"})}(n);if(a.success){const{selectedRoom:a}=t();return a===n&&e({selectedRoom:null,messages:[],clients:[]}),await t().fetchRooms(),!0}return!1}catch{return!1}},sendAdvert:async e=>{try{const t=await async function(e){return hg("/api/send_room_server_advert",{method:"POST",body:JSON.stringify({name:e})})}(e);return!!t.success}catch{return!1}},startActivePolling:()=>{const e=setInterval(()=>{t().fetchMessages({incremental:!0}),t().fetchClients()},5e3);return()=>clearInterval(e)}}}),Lv=()=>Pv(e=>e.rooms),Rv=()=>Pv(e=>e.selectedRoom),Nv=()=>Pv(e=>e.messages),zv=()=>Pv(e=>e.clients),_v=()=>Pv(e=>e.identities),Iv=()=>Pv(e=>e.isLoading),Vv=()=>Pv(e=>e.rooms.find(t=>t.room_name===e.selectedRoom)??null),Ov=()=>Pv(e=>e.identities.find(t=>{var n;return t.name===e.selectedRoom||(null==(n=t.settings)?void 0:n.node_name)===e.selectedRoom})??null),$v=A(e=>({topology:{edges:[],validatedEdges:[],weakEdges:[],certainEdges:[],uncertainEdges:[],edgeMap:new Map,maxPacketCount:0,maxCertainCount:0,neighborAffinity:new Map,fullAffinity:new Map,localPrefix:null,centrality:new Map,hubNodes:[],gatewayNodes:[],loops:[],loopEdgeKeys:new Set,txDelayRecommendations:new Map,pathRegistry:Xg(),edgeBetweenness:new Map,backboneEdges:[],nodeMobility:new Map,mobileNodes:[],pathHealth:[],lastHopNeighbors:[],disambiguationStats:{totalPrefixes:0,unambiguousPrefixes:0,collisionPrefixes:0,collisionRate:0,avgConfidence:0,lowConfidencePrefixes:[],highCollisionPrefixes:[],totalResolutions:0},discoveredNodes:[],viterbiStats:{totalPaths:0,pathsWithGhosts:0,avgPathCost:0,avgPathConfidence:0,observationOverrideCount:0,tracePacketsProcessed:0,pathPacketsProcessed:0,distantEdgesDiscovered:0,duplicateGroupsFound:0,duplicatePathsUnique:0,echolocationEdgesInferred:0},nodeMetrics:new Map,communityCount:0,backboneNodes:[],traceLinks:new Map,traceLinkSummary:{totalDirectedLinks:0,totalTraces:0,totalObservations:0,bidirectionalLinks:0,avgSnr:0,qualityCounts:{excellent:0,good:0,fair:0,poor:0,critical:0}}},isComputing:!1,lastComputeTimeMs:0,lastUpdated:0,setTopology:(t,n)=>e({topology:t,lastComputeTimeMs:n,lastUpdated:Date.now(),isComputing:!1}),setComputing:t=>e({isComputing:t})}));"undefined"!=typeof window&&Jg.subscribe((e,t)=>{$v.getState().setTopology(e,t)});const qv=()=>$v(e=>e.topology),Uv=()=>$v(e=>e.topology.hubNodes),Wv=()=>$v(e=>e.topology.centrality),Hv=()=>$v(e=>e.topology.fullAffinity),Yv=()=>$v(e=>e.isComputing),Gv=()=>$v(e=>e.lastUpdated);let Kv=null,Xv=null,Jv=null,Zv=null,Qv=null,ew=null;const tw=()=>$v(e=>(e.topology.hubNodes!==Xv&&(Xv=e.topology.hubNodes,Kv=new Set(e.topology.hubNodes)),Kv)),nw=()=>$v(e=>e.topology.txDelayRecommendations),aw=()=>$v(e=>e.topology.pathRegistry.canonicalPaths),sw=()=>$v(e=>(e.topology.mobileNodes!==Zv&&(Zv=e.topology.mobileNodes,Jv=new Set(e.topology.mobileNodes)),Jv)),rw=()=>$v(e=>e.topology.pathHealth),ow=()=>$v(e=>e.topology.lastHopNeighbors),iw=()=>$v(e=>e.topology.disambiguationStats),lw=()=>$v(e=>e.topology.disambiguationStats.highCollisionPrefixes),cw=()=>$v(e=>e.topology.disambiguationStats.totalPrefixes>0),uw=()=>$v(e=>e.topology.discoveredNodes),dw=()=>$v(e=>e.topology.viterbiStats),hw=()=>$v(e=>(e.topology.discoveredNodes!==ew&&(ew=e.topology.discoveredNodes,Qv=e.topology.discoveredNodes.filter(e=>e.isLikelyReal)),Qv)),mw=()=>$v(e=>e.topology.nodeMetrics),pw=()=>$v(e=>e.topology.communityCount);let gw=null,fw=null;const yw=()=>$v(e=>{if(e.topology.nodeMetrics!==fw){fw=e.topology.nodeMetrics,gw={local:0,hub:0,gateway:0,backbone:0,neighbor:0,mobile:0,ghost:0,standard:0};for(const t of e.topology.nodeMetrics.values())gw[t.nodeClass]++}return gw});function bw(e){if(e<60)return`${Math.floor(e)}s`;const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),a=Math.floor(e%3600/60),s=[];return t>0&&s.push(`${t}d`),n>0&&s.push(`${n}h`),(a>0||0===s.length)&&s.push(`${a}m`),s.join(" ")}function vw(e){const t=Date.now()/1e3-e;return t<60?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function ww(e){const t=Date.now()/1e3-e;return t<60?`${Math.floor(t)}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}function Cw(e){return new Date(1e3*e).toLocaleString()}function kw(e){const t=new Date(1e3*e);return`${t.toLocaleString("en-US",{month:"short"})} ${t.getDate()}, ${t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}`}function xw(e){return new Date(1e3*e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Dw(e){return`${(e/1e6).toFixed(3)} MHz`}function Aw(e){return`${(e/1e3).toFixed(1)} kHz`}function Ew(e){const t=e>1e12?e:1e3*e,n=Date.now(),a=Math.abs(n-t),s=Math.floor(a/1e3),r=Math.floor(s/60),o=Math.floor(r/60),i=Math.floor(o/24);return i>0?`${i} day${1!==i?"s":""}`:o>0?`${o} hour${1!==o?"s":""}`:r>0?`${r} minute${1!==r?"s":""}`:`${s} second${1!==s?"s":""}`}function Bw(e){e<0&&(e=0);const t=Math.floor(e/1e3),n=Math.floor(t/60),a=Math.floor(n/60);if(a>0){const e=n%60;return e>0?`${a}h ${e}m`:`${a}h`}if(n>0){const e=t%60;return e>0?`${n}m ${e}s`:`${n}m`}if(t>0){const n=e%1e3;return n>0?`${t}.${Math.floor(n/100)}s`:`${t}s`}return`${e}ms`}function Fw(e){return e<1024?`${e}B`:e<1048576?`${(e/1024).toFixed(1)}K`:`${(e/1048576).toFixed(1)}M`}s.memo(function({options:e,data:t,className:n="",onCreate:a}){const o=s.useRef(null),i=s.useRef(null);return s.useEffect(()=>{const n=o.current;if(!n)return;const s=n.getBoundingClientRect(),r=Math.floor(s.width)||400,l=Math.floor(s.height)||200,c=new us({...e,width:r,height:l},t,n);return i.current=c,null==a||a(c),()=>{c.destroy(),i.current=null}},[e]),s.useEffect(()=>{i.current&&t&&i.current.setData(t)},[t]),s.useEffect(()=>{const e=o.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!i.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&i.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),r.jsx("div",{ref:o,className:`w-full h-full ${n}`,style:{minHeight:100}})});const Sw=s.memo(function({items:e,direction:t="horizontal",size:n="sm",className:a,highlightedKey:s,onItemClick:o,onItemHover:l}){const c="horizontal"===t,u="sm"===n;return r.jsx("div",{className:i("flex font-mono",c?"flex-wrap gap-x-4 gap-y-1":"flex-col gap-1",u?"text-xs":"text-sm",a),children:e.map(e=>{const t=null!=s&&s!==e.key,n=o||l;return r.jsxs("div",{className:i("flex items-center gap-1.5 transition-opacity",t&&"opacity-30",n&&"cursor-pointer hover:opacity-80"),onClick:()=>null==o?void 0:o(e.key),onMouseEnter:()=>null==l?void 0:l(e.key),onMouseLeave:()=>null==l?void 0:l(null),children:[r.jsx("div",{className:i("shrink-0 rounded-xs",u?"w-3 h-3":"w-4 h-4"),style:{backgroundColor:e.color}}),r.jsx("span",{className:"text-fg-secondary whitespace-nowrap",children:e.label}),void 0!==e.value&&r.jsx("span",{className:"text-fg-muted tabular-nums",children:e.formatValue?e.formatValue(e.value):e.value})]},e.key)})})}),Mw={4:T.blue,5:T.indigo,6:T.purple,0:T.cyan,2:T.teal,7:T.green,1:T.yellow,10:T.amber,8:T.orange,9:T.red,3:T.pink,15:T.brown},jw=T.brown;function Tw(e){return Mw[e]??jw}let Pw=null,Lw=0;const Rw=1e3;function Nw({activeTypes:e,totalByType:t}){const n=[...e].reverse().map(e=>({key:String(e),label:xs[e]??`TYPE_${e}`,color:Tw(e),value:t[e]??0,formatValue:e=>Fw(e)}));return r.jsx(Sw,{items:n})}const zw=s.memo(function({buckets:e,activeTypes:t,onHover:n,gridColor:a,axisTickColor:o}){const i=s.useRef(null),l=s.useRef(null),c=s.useRef(e),u=s.useRef(t),d="undefined"!=typeof document&&"light"!==document.documentElement.dataset.mode,h=a||(d?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)"),m=o||(d?"rgba(255,255,255,0.6)":"rgba(0,0,0,0.6)"),p=s.useRef({gridColor:h,axisTickColor:m});c.current=e,u.current=t,p.current={gridColor:h,axisTickColor:m};const g=e.length,f=s.useMemo(()=>[e.map(e=>e.start),e.map(()=>1)],[g]),y=s.useCallback(t=>{if(!i.current||0===e.length)return;const a=i.current.getBoundingClientRect(),s=(t.clientX-a.left-48)/(a.width-48-8);if(s<0||s>1)return void(null==n||n(null,null,null));const r=Math.min(e.length-1,Math.max(0,Math.floor(s*e.length)));null==n||n(r,e[r],s)},[e,n]),b=s.useCallback(()=>{null==n||n(null,null,null)},[n]);return s.useEffect(()=>{if(!i.current||0===g)return;const e=i.current,t=e.getBoundingClientRect(),n={width:Math.floor(t.width)||400,height:Math.floor(t.height)||200,padding:[8,8,28,48],cursor:{show:!1},scales:{x:{time:!1},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],legend:{show:!1},hooks:{draw:[e=>{const t=e.ctx,{left:n,top:a,width:s,height:r}=e.bbox,o=window.devicePixelRatio||1,i=p.current;!function(e,t,n,a,s,r,o){if(0===t.length||0===n.length)return;const i=t.length,l=r/i;let c=0;for(const u of t)u.totalBytes>c&&(c=u.totalBytes);0===c&&(c=1);for(let u=0;uc&&(c=y.totalBytes);if(0===c)return;const u=function(){const e=performance.now();if(Pw&&e-Lw{const t=e.getBoundingClientRect();t.width>0&&t.height>0&&l.current&&l.current.setSize({width:Math.floor(t.width),height:Math.floor(t.height)})});return s.observe(e),()=>{s.disconnect(),a.destroy(),l.current=null}},[g]),s.useEffect(()=>{l.current&&l.current.redraw()},[e,t]),0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No data available"}):r.jsx("div",{ref:i,className:"w-full h-full",onMouseMove:y,onMouseLeave:b})}),_w=new Map;function Iw(e){var t;if(!e.startsWith("var("))return e;const n=_w.get(e);if(n)return n;const a=e.match(/var\(([^,)]+)(?:,\s*([^)]+))?\)/);if(!a)return e;const s=a[1].trim(),r=(null==(t=a[2])?void 0:t.trim())||"#888888",o=getComputedStyle(document.documentElement).getPropertyValue(s).trim()||r;return _w.set(e,o),o}const Vw="undefined"!=typeof document&&"light"!==document.documentElement.dataset.mode?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.3)";function Ow(e,t,n=!1){if(t.length<2)return;if(e.beginPath(),e.moveTo(t[0].x,t[0].y),2===t.length)return void e.lineTo(t[1].x,t[1].y);const a=.5;for(let s=0;s{p.current=e,g.current=t,f.current=a,y.current=n});const v=s.useRef({band:o,innerBand:i,mean:l,median:c,average:u,cursor:d});s.useLayoutEffect(()=>{v.current={band:o,innerBand:i,mean:l,median:c,average:u,cursor:d}});const w=s.useMemo(()=>[e.map(e=>e.timestamp),e.map(e=>e.max)],[e]),C=s.useMemo(()=>{const e=function(e,t,n,a){return{hooks:{draw:s=>{const r=e.current,o=t.current,i=n.current,l=a.current;if(0===r.length)return;const c=s.ctx,u=s.bbox,d=u.left,h=u.top,m=u.width,p=u.height;if(m<=0||p<=0)return;const g=s.data[0],f=g.length;if(0===f)return;const y=g[0],b=g[f-1]-y||1,v=e=>d+(e-y)/b*m,w=e=>h+p*(1-e/o),C={min:r.map(e=>({x:v(e.timestamp),y:w(e.min)})),max:r.map(e=>({x:v(e.timestamp),y:w(e.max)})),p5:r.map(e=>({x:v(e.timestamp),y:w(e.p5)})),p95:r.map(e=>({x:v(e.timestamp),y:w(e.p95)})),p25:r.map(e=>({x:v(e.timestamp),y:w(e.p25)})),p75:r.map(e=>({x:v(e.timestamp),y:w(e.p75)})),mean:r.map(e=>({x:v(e.timestamp),y:w(e.mean)})),median:r.map(e=>({x:v(e.timestamp),y:w(e.median)})),average:r.map(e=>({x:v(e.timestamp),y:w(e.average)}))},k=(e,t)=>i?i===e?Math.min(1,1.5*t):"minMax"===i||"p5p95"===i||"p25p75"===i?.3*t:t:t,x=e=>i?i===e?1:"mean"===i||"median"===i||"average"===i?.3:1:1,D={band:Iw(l.band),innerBand:Iw(l.innerBand),mean:Iw(l.mean),median:Iw(l.median),average:Iw(l.average)};c.save(),c.strokeStyle=D.average,c.lineWidth=4,c.globalAlpha=x("average"),Ow(c,C.average),c.stroke(),c.globalAlpha=k("minMax",.15),c.fillStyle=D.band,c.beginPath(),Ow(c,C.max);const A=[...C.min].reverse();for(const e of A)c.lineTo(e.x,e.y);c.closePath(),c.fill(),c.globalAlpha=k("p5p95",.3),c.fillStyle=D.band,c.beginPath(),Ow(c,C.p95);const E=[...C.p5].reverse();for(const e of E)c.lineTo(e.x,e.y);c.closePath(),c.fill(),c.globalAlpha=k("p25p75",.55),c.fillStyle=D.innerBand,c.beginPath(),Ow(c,C.p75);const B=[...C.p25].reverse();for(const e of B)c.lineTo(e.x,e.y);c.closePath(),c.fill(),c.strokeStyle=D.median,c.lineWidth=1.5,c.globalAlpha=x("median"),c.setLineDash([4,4]),Ow(c,C.median),c.stroke(),c.strokeStyle=D.mean,c.lineWidth=1.5,c.globalAlpha=x("mean"),c.setLineDash([]),Ow(c,C.mean),c.stroke(),c.restore()}}}}(p,g,f,v);return{width:400,height:200,padding:[4,4,4,4],cursor:{show:!0,x:!0,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,t]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],hooks:{setCursor:[e=>{var t,n;const a=e.cursor.idx;null!=a&&a>=0?null==(t=y.current)||t.call(y,a):null==(n=y.current)||n.call(y,null)}]},plugins:[e]}},[t]);s.useEffect(()=>{const t=h.current;if(!t||0===e.length)return;const n=b.current,a=e.length,s=Math.abs(a-n);if(!(!m.current||s>100||n>0&&s/n>.1)&&m.current)return m.current.setData(w),void(b.current=a);m.current&&m.current.destroy();const r=t.getBoundingClientRect(),o=Math.floor(r.width)||400,i=Math.floor(r.height)||200,l=new us({...C,width:o,height:i},w,t);return m.current=l,b.current=a,()=>{l.destroy(),m.current=null}},[C,w,e.length]),s.useEffect(()=>{const e=h.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!m.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&m.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{m.current&&m.current.redraw()},[a,e]);const k=s.useCallback(()=>{null==n||n(null)},[n]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No data available"}):r.jsx("div",{ref:h,className:"w-full h-full rounded-2xl overflow-hidden",onMouseLeave:k})});const $w="undefined"!=typeof window&&(null==(t=null==(e=window.matchMedia)?void 0:e.call(window,"(color-gamut: p3)"))?void 0:t.matches);let qw=null,Uw=0;function Ww(){const e=performance.now();if(qw&&e-Uw<1e3)return qw;const t=getComputedStyle(document.documentElement),n=t.getPropertyValue("--font-data").trim()||'"JetBrains Mono", ui-monospace, monospace',a="light"!==document.documentElement.dataset.mode,s=t.getPropertyValue("--chart-axis-tick").trim()||(a?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.4)"),r=t.getPropertyValue("--chart-grid").trim()||(a?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.06)"),o=t.getPropertyValue("--text-muted").trim()||"#727272",i=t.getPropertyValue("--text-primary").trim()||(a?"#FFFFFF":"#1A1A1A"),l=t.getPropertyValue("--signal-critical").trim()||"#EF4444",c=t.getPropertyValue("--bg-body").trim()||(a?"#171717":"#F5F5F5");return qw={fontFamily:n,axisColor:s,gridColor:r,textMuted:o,textPrimary:i,signalCritical:l,bgBody:c},Uw=e,qw}const Hw=["min","max","p75","p95","p99","mean","median","average","midpoint"];function Yw(e){const t=Fs(function(e){const{colormap:t,baseIndex:n,halfSize:a}=js(),s=Math.max(0,Math.min(1,e)),r=Math.min(n+Math.floor(s*(a-1)),t.discrete.length-1);return t.discrete[r]}(e)),n=`color(display-p3 ${(t.r/255).toFixed(3)} ${(t.g/255).toFixed(3)} ${(t.b/255).toFixed(3)})`;return{...t,p3:n}}function Gw(e,t,n,a,s,r,o,i,l,c=null,u=null,d=1,h=null,m="airtime",p=.5){if(0===t.length)return;const g=e.ctx,{left:f,top:y,width:b,height:v}=e.bbox,w=window.devicePixelRatio||1;if(b<=0||v<=0)return;const C=e.data[0],k=C.length;if(0===k)return;const x=C[0],D=C[k-1],A=n,E="share"===m,B=E?function(e){const t=[10,20,25,50,100,200,250,500,1e3],n=e/4.5;for(const a of t)if(a>=n)return a;return e>5e3?1e3*Math.ceil(n/1e3):100*Math.ceil(n/100)}(A):5,F=r.signalCritical,S=r.bgBody;g.save(),g.fillStyle="#000000";const M=8*w;g.beginPath(),g.roundRect(f,y,b,v,M),g.fill(),g.restore();const j=parseInt(S.slice(1,3),16)||23,T=parseInt(S.slice(3,5),16)||23,P=parseInt(S.slice(5,7),16)||23;if(!E&&A>=20){g.save();const e=y+v*(1-20/A);g.fillStyle=`rgba(${j}, ${T}, ${P}, 0.5)`,g.fillRect(f,y,b,e-y),g.restore()}g.save(),g.lineWidth=1*w,g.setLineDash([4*w,4*w]);for(let R=B;Rn+s)return;const i=Ww().textPrimary;e.save(),e.strokeStyle=i,e.globalAlpha=.5,e.lineWidth=1*o,e.setLineDash([4*o,4*o]),e.beginPath(),e.moveTo(Math.round(t)+.5,a),e.lineTo(Math.round(t)+.5,a+r),e.stroke(),e.restore()}(g,h,f,y,b,v,w),o){!function(e,t,n,a,s,r,o=null,i=null,l=1,c=25){const{points:u,rawValues:d,count:h,packetTypes:m,timestamps:p}=t,g=1*l*(window.devicePixelRatio||1);e.globalCompositeOperation="source-over";const f=o?parseInt(o.replace("TYPE_",""),10):null;for(let y=0;y=i.start&&e0&&function(e,t,n,a,s,r,o,i,l,c,u=.5){if(0===t.length)return;const d=l-i||1,h=function(e,t=1.3,n=.15){const a=function(e){const t=e.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);if(t){const e=parseFloat(t[1]),n=parseFloat(t[2]),a=parseFloat(t[3]);return{r:Math.round(255*e),g:Math.round(255*n),b:Math.round(255*a),p3r:e,p3g:n,p3b:a}}if(e.startsWith("#")){const t=e.replace("#",""),n=parseInt(t.slice(0,2),16),a=parseInt(t.slice(2,4),16),s=parseInt(t.slice(4,6),16);return{r:n,g:a,b:s,p3r:n/255,p3g:a/255,p3b:s/255}}const n=e.match(/rgba?\(([\d.]+),?\s*([\d.]+),?\s*([\d.]+)/);if(n){const e=Math.round(parseFloat(n[1])),t=Math.round(parseFloat(n[2])),a=Math.round(parseFloat(n[3]));return{r:e,g:t,b:a,p3r:e/255,p3g:t/255,p3b:a/255}}return{r:255,g:255,b:255,p3r:1,p3g:1,p3b:1}}(e),s=function(e,t,n,a=1.25,s=.15){const r=(Math.max(e,t,n)+Math.min(e,t,n))/2;return{p3r:Math.min(1,r+(e-r)*a+s),p3g:Math.min(1,r+(t-r)*a+s),p3b:Math.min(1,r+(n-r)*a+s)}}(a.p3r,a.p3g,a.p3b,t,n);return{r:Math.round(255*Math.min(1,s.p3r)),g:Math.round(255*Math.min(1,s.p3g)),b:Math.round(255*Math.min(1,s.p3b)),p3r:Math.min(1,s.p3r),p3g:Math.min(1,s.p3g),p3b:Math.min(1,s.p3b)}}(Ww().signalCritical);e.save(),e.globalAlpha=u,e.fillStyle=$w?`color(display-p3 ${h.p3r} ${h.p3g} ${h.p3b})`:`rgb(${h.r}, ${h.g}, ${h.b})`;for(const m of t){if(m.endTsl)continue;const t=a+(Math.max(m.startTs,i)-i)/d*r,n=a+(Math.min(m.endTs,l)-i)/d*r,u=Math.max(n-t,2*c);e.fillRect(t,s,u,o)}e.restore()}(g,i,0,f,y,b,v,x,D,w,u?Math.max(.03,.03*p):p)}s.memo(function({data:e,maxValue:t,visibleLines:n=Hw,highlightedLine:a=null,onHover:o,scatterData:i=null,noiseFloorAnomalies:l=null,showNoiseFloorOverlay:c=!1,overlayOpacity:u=.5,highlightedType:d=null,hoveredTimeRange:h=null,timeRangeHours:m=24,yAxisMode:p="airtime"}){const g=s.useRef(null),f=s.useRef(null),y=s.useRef(e),b=s.useRef(t),v=s.useRef(n),w=s.useRef(a),C=s.useRef(o),k=s.useRef(i),x=s.useRef(l),D=s.useRef(c),A=s.useRef(d),E=s.useRef(h),B=s.useRef(null),F=s.useRef(null),S=s.useRef(p),M=s.useRef(u),j=m<=12?1.2:1,T=s.useRef(j),P=s.useRef(e.length);s.useLayoutEffect(()=>{y.current=e,b.current=t,v.current=n,w.current=a,C.current=o,k.current=i,x.current=l,D.current=c,A.current=d,E.current=h,T.current=j,S.current=p,M.current=u}),s.useEffect(()=>{B.current=Ww()},[]);const L=s.useMemo(()=>[e.map(e=>e.timestamp),new Array(e.length).fill(1)],[e]),R=s.useMemo(()=>({hooks:{draw:e=>{const t=B.current||Ww();Gw(e,y.current,b.current,v.current,w.current,t,k.current,x.current,D.current,A.current,E.current,T.current,F.current,S.current,M.current)}}}),[]),N=s.useMemo(()=>({width:400,height:200,padding:[8,0,8,28],cursor:{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],plugins:[R]}),[R]);s.useEffect(()=>{const t=g.current;if(!t||0===e.length)return;const n=P.current,a=e.length,s=Math.abs(a-n);if(!(!f.current||s>100||n>0&&s/n>.1)&&f.current)return f.current.setData(L),void(P.current=a);f.current&&f.current.destroy();const r=t.getBoundingClientRect(),o=Math.floor(r.width)||400,i=Math.floor(r.height)||200,l=new us({...N,width:o,height:i},L,t);return f.current=l,P.current=a,()=>{l.destroy(),f.current=null}},[N,L,e.length]),s.useEffect(()=>{const e=g.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!f.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&f.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{f.current&&f.current.redraw()},[a,n,e,i,l,c,u,d,h,j]);const z=s.useCallback(t=>{var n,a;const s=g.current,r=f.current;if(!s||!r||0===e.length)return;const o=s.getBoundingClientRect(),i=t.clientX-o.left,l=window.devicePixelRatio||1,c=r.bbox,u=c.left/l,d=c.width/l;if(iu+d)return F.current=null,r.redraw(),void(null==(n=C.current)||n.call(C,null));F.current=i*l;const h=(i-u)/d,m=e.length,p=Math.floor(h*m),y=Math.max(0,Math.min(m-1,p));r.redraw(),null==(a=C.current)||a.call(C,y)},[e.length]),_=s.useCallback(()=>{var e;F.current=null,f.current&&f.current.redraw(),null==(e=C.current)||e.call(C,null)},[]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No data available"}):r.jsx("div",{ref:g,className:"w-full h-full rounded-lg overflow-hidden",onMouseMove:z,onMouseLeave:_})});const Kw=-70;let Xw=null,Jw=0;function Zw(e,t){if(0===e.length)return 0;const n=t/100*(e.length-1),a=Math.floor(n),s=Math.ceil(n);return a===s?e[a]:e[a]+(e[s]-e[a])*(n-a)}function Qw(e){const t=e.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\)/);if(t)return{r:Math.round(255*parseFloat(t[1])),g:Math.round(255*parseFloat(t[2])),b:Math.round(255*parseFloat(t[3]))};const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}:{r:250,g:189,b:47}}function eC(e,t){const n=Math.max(0,Math.min(1,e))*(t.length-1),a=Math.floor(n),s=n-a;if(a>=t.length-1)return t[t.length-1];const r=t[a],o=t[a+1];return{r:Math.round(r.r+(o.r-r.r)*s),g:Math.round(r.g+(o.g-r.g)*s),b:Math.round(r.b+(o.b-r.b)*s)}}function tC(e,t,n){const a=Math.max(0,Math.min(1,e));return{r:Math.round(t.r+(n.r-t.r)*a),g:Math.round(t.g+(n.g-t.g)*a),b:Math.round(t.b+(n.b-t.b)*a)}}const nC=s.memo(function({timestamps:e,values:t,onStatsChange:n,compact:a=!1,height:o}){var i,l;const[c,u]=s.useState(!0),d=s.useRef(null),h=s.useRef(null),m=s.useRef(null),p=s.useRef(null),g=s.useRef(null),f=s.useRef(a),y=s.useMemo(()=>{const e=t.filter(e=>e<=Kw);if(0===e.length)return null;const n=Math.min(...e),a=Math.max(...e),s=e.reduce((e,t)=>e+t,0)/e.length,r=[...e].sort((e,t)=>e-t);return{min:n,max:a,avg:s,p5:Zw(r,5),p95:Zw(r,95)}},[t]);s.useEffect(()=>{null==n||n(y)},[y]);const b=s.useCallback(()=>{u(e=>!e)},[]),{heatmapData:v,xLabels:w,yLabels:C}=s.useMemo(()=>{if(0===e.length||0===t.length||!y)return{heatmapData:null,xLabels:[],yLabels:[]};let n,s;if(c){const e=t.filter(e=>e<=Kw);if(0===e.length)return{heatmapData:null,xLabels:[],yLabels:[]};const a=[...e].sort((e,t)=>e-t),r=Zw(a,5),o=Zw(a,95),i=.1*(o-r||1);n=r-i,s=o+i}else{const e=t.filter(e=>e<=Kw);if(0===e.length)return{heatmapData:null,xLabels:[],yLabels:[]};const a=Math.min(...e),r=Math.max(...e),o=.1*(r-a||1);n=a-o,s=r+o}const r=s-n,o=e[0],i=e[e.length-1],l=i-o||1,u=120,d=48,h=new Float32Array(5760),m=[];for(let a=0;aKw)continue;const c=(e[a]-o)/l,p=1-(Math.max(n,Math.min(s,i))-n)/r;h[Math.min(119,Math.floor(c*u))*d+Math.min(47,Math.floor(p*d))]++,m.push(e[a])}let p=0;for(let e=0;ep&&(p=h[e]);const g=[],f=[];for(let e=0;et&&(t=a,n=s)}if(-1===n||0===t)continue;const a=s-(n+.5)/d*r,i=o+(e+.5)/u*l;g.push(i),f.push(a)}const b=function(e,t,n){if(0===e.length)return[];const a=function(e,t){if(0===e.length)return[];const n=Math.floor(t/2),a=new Array(e.length),s=new Array(t);for(let r=0;re-t),a[r]=s[n]}return a}(e,t),s=new Array(e.length);s[0]=a[0];for(let r=1;r0){const e=Math.min(...b),t=Math.max(...b),n=.4*(t-e||1);v=e-n,w=t+n,C=w-v}const k=[];for(let e=0;e{g.current=v,f.current=a});const k=s.useMemo(()=>{if(0===e.length)return[[],[]];const t=new Array(e.length).fill(1);return[e,t]},[e]),x=s.useMemo(()=>({hooks:{draw:e=>{!function(e,t,n){if(!t)return;const a=e.ctx,{left:s,top:r,width:o,height:i}=e.bbox,l=window.devicePixelRatio||1;if(o<=0||i<=0)return;const c=function(){const e=performance.now();if(Xw&&e-Jw<1e3)return Xw;const t=getComputedStyle(document.documentElement);return Xw={heatGradient:[Qw(t.getPropertyValue("--sys-indigo").trim()),Qw(t.getPropertyValue("--sys-blue").trim()),Qw(t.getPropertyValue("--sys-teal").trim()),Qw(t.getPropertyValue("--sys-amber").trim()),Qw(t.getPropertyValue("--sys-orange").trim())],trendLineColor:Qw(t.getPropertyValue("--sys-indigo").trim()),stabilityHot:Qw(t.getPropertyValue("--sys-amber").trim()),stabilityCool:Qw(t.getPropertyValue("--sys-blue").trim()),typography:{fontFamily:t.getPropertyValue("--font-data").trim()||'"JetBrains Mono", ui-monospace, monospace',textMuted:t.getPropertyValue("--text-muted").trim()||"#727272",textSecondary:t.getPropertyValue("--text-secondary").trim()||"#A0A0A0",gridColor:t.getPropertyValue("--chart-grid-line").trim()||"rgba(255,255,255,0.06)"}},Jw=e,Xw}();a.clearRect(s,r,o,i),n||function(e,t,n,a,s,r,o){e.save(),e.strokeStyle=o,e.lineWidth=1*r,e.setLineDash([3*r,3*r]);for(const i of[0,.25,.5,.75,1]){const r=Math.round(n+s*i)+.5;e.beginPath(),e.moveTo(t,r),e.lineTo(t+a,r),e.stroke()}e.restore()}(a,s,r,o,i,l,c.typography.gridColor),function(e,t,n,a,s,r,o,i,l){const{trendLine:c,trendCount:u}=t;if(u<2)return;e.save();const d=o?3*.6:3;if(e.lineWidth=d*i,e.lineCap="round",e.lineJoin="round",o){let t=1/0,o=-1/0;for(let e=0;eo&&(o=n)}const i=(t+o)/2,d=(o-t)/2||.01;for(let h=1;h{const t=m.current,n=p.current;if(!t&&!n||f.current)return;const{left:a,top:s}=e.cursor,r=g.current;if(null==a||null==s||a<0||s<0||!r)return t&&(t.style.display="none"),void(n&&(n.style.display="none"));const o=window.devicePixelRatio||1,i=e.bbox.width/o,l=e.bbox.height/o,c=a/i,u=s/l;if(c<0||c>1||u<0||u>1)return t&&(t.style.display="none"),void(n&&(n.style.display="none"));const d=Math.min(r.xBins-1,Math.max(0,Math.floor(c*r.xBins))),h=Math.min(r.yBins-1,Math.max(0,Math.floor(u*r.yBins))),y=r.densityGrid[d*r.yBins+h],b=r.minTime+(d+.5)/r.xBins*r.timeRange,v=r.yMax-(h+.5)/r.yBins*r.yRange,w=new Date(1e3*b).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});if(n){n.style.display="block";const e=n.children;e[0].style.transform=`translateX(${Math.round(a)}px)`,e[1].style.transform=`translateY(${Math.round(s)}px)`;const t=i/r.xBins,o=l/r.yBins,c=e[2];c.style.left=d*t+"px",c.style.top=h*o+"px",c.style.width=`${t}px`,c.style.height=`${o}px`,c.style.opacity=y>0?"1":"0.5"}if(t){const e=t.children;e[0].textContent=w,e[1].textContent=`${Math.round(v)} dBm`,e[2].textContent=y>0?`${y} sample${1!==y?"s":""}`:"no data";const n=a>i-130,r=s>l-64;t.style.display="block",t.style.left=`${a+(n?-116:12)}px`,t.style.top=`${s+(r?-58:8)}px`}}}}),[]),D=s.useMemo(()=>({width:400,height:200,padding:[0,0,0,0],cursor:a?{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}}:{show:!0,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],plugins:[x]}),[x,a]);return s.useEffect(()=>{const t=d.current;if(!t||0===e.length)return;h.current&&h.current.destroy();const n=t.getBoundingClientRect(),a=Math.floor(n.width)||400,s=Math.floor(n.height)||200,r=new us({...D,width:a,height:s},k,t);return h.current=r,()=>{r.destroy(),h.current=null}},[D,k,e.length]),s.useEffect(()=>{const e=d.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!h.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&h.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{h.current&&h.current.redraw()},[v,c]),v?a?r.jsx("div",{ref:d,className:"w-full",style:{height:o??28},role:"img","aria-label":"Noise floor sparkline"}):r.jsxs("div",{className:"relative w-full h-full",role:"img","aria-label":`RF noise floor heatmap showing values from ${(null==(i=null==y?void 0:y.min)?void 0:i.toFixed(0))??"N/A"} to ${(null==(l=null==y?void 0:y.max)?void 0:l.toFixed(0))??"N/A"} dBm`,children:[r.jsx("div",{className:"absolute top-0 left-0 flex flex-col justify-between",style:{width:32,bottom:20},"aria-hidden":"true",children:C.map((e,t)=>r.jsx("span",{className:"type-data-xs text-fg-secondary text-right pr-1.5",style:{position:"absolute",top:`${e.pos}%`,transform:"translateY(-50%)",right:0},children:e.label},t))}),r.jsxs("div",{ref:d,className:"absolute overflow-hidden",style:{left:32,right:0,top:0,bottom:20},children:[r.jsxs("div",{ref:p,className:"absolute inset-0 z-10 pointer-events-none",style:{display:"none"},children:[r.jsx("div",{className:"absolute top-0 bottom-0 w-px bg-subtle-fill-strong"}),r.jsx("div",{className:"absolute left-0 right-0 h-px bg-subtle-fill-strong"}),r.jsx("div",{className:"absolute bg-subtle-fill-strong ring-1 ring-inset ring-edge-strong"})]}),r.jsxs("div",{ref:m,className:"absolute z-20 pointer-events-none radius-inner bg-tooltip-bg px-2.5 py-1.5 shadow-lg",style:{display:"none"},children:[r.jsx("div",{className:"type-data-xs text-fg-muted"}),r.jsx("div",{className:"type-data-xs text-fg-primary"}),r.jsx("div",{className:"type-data-xs text-fg-muted"})]}),r.jsx("button",{type:"button",onClick:b,className:"absolute bottom-1 right-1 z-10 p-1.5 rounded bg-tooltip-bg/80 hover:bg-tooltip-bg active:bg-tooltip-bg transition-colors touch-manipulation",title:c?"Show full range (min/max)":"Show trimmed range (P5-P95)","aria-label":c?"Expand to show full data range":"Shrink to show trimmed percentile range","aria-pressed":!c,children:c?r.jsx(lr,{className:"w-3.5 h-3.5 text-fg-muted","aria-hidden":"true"}):r.jsx(Er,{className:"w-3.5 h-3.5 text-fg-muted","aria-hidden":"true"})})]}),r.jsx("div",{className:"absolute left-0 right-0 bottom-0",style:{left:32,height:20},"aria-hidden":"true",children:w.map((e,t)=>r.jsx("span",{className:"type-data-xs text-fg-secondary absolute top-1",style:{left:`${e.pos}%`,transform:"translateX(-50%)"},children:e.label},t))})]}):a?r.jsx("div",{className:"w-full rounded bg-subtle/50",style:{height:o??28},"aria-hidden":"true"}):r.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No noise floor data available"})});let aC=null,sC=0;function rC(){const e=performance.now();if(aC&&e-sC<1e3)return aC;const t=getComputedStyle(document.documentElement),n=t.getPropertyValue("--font-data").trim()||'"JetBrains Mono", ui-monospace, monospace',a="light"!==document.documentElement.dataset.mode,s=t.getPropertyValue("--chart-axis-tick").trim()||(a?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.4)"),r=t.getPropertyValue("--chart-grid").trim()||(a?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.06)"),o=t.getPropertyValue("--text-muted").trim()||"#727272",i=t.getPropertyValue("--text-primary").trim()||(a?"#FFFFFF":"#1A1A1A"),l=t.getPropertyValue("--signal-critical").trim()||"#EF4444",c=t.getPropertyValue("--bg-body").trim()||(a?"#171717":"#F5F5F5");return aC={fontFamily:n,axisColor:s,gridColor:r,textMuted:o,textPrimary:i,signalCritical:l,bgBody:c},sC=e,aC}function oC(e){const t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function iC(e){return oC(Tw(e))}const lC=s.memo(function({scatterData:e,yAxisMode:t,onHover:n,noiseFloorAnomalies:a=null,showNoiseFloorOverlay:o=!1,overlayOpacity:i=.5,highlightedType:l=null,timeRangeHours:c=24,yAxisMaxOverride:u}){const d=s.useRef(null),h=s.useRef(null),m=s.useRef(e),p=s.useRef(t),g=s.useRef(n),f=s.useRef(a),y=s.useRef(o),b=s.useRef(i),v=s.useRef(l),w=s.useRef(null),C=s.useRef(null),k=c<=12?1.2:1,x=s.useRef(k),D=u??(null==e?void 0:e.maxValue)??("share"===t?200:10),A=s.useRef(D);s.useLayoutEffect(()=>{m.current=e,p.current=t,g.current=n,f.current=a,y.current=o,b.current=i,v.current=l,x.current=k,A.current=D}),s.useEffect(()=>{w.current=rC()},[]);const E=s.useMemo(()=>{if(!e||0===e.count)return[[0],[0]];const t=[];for(let a=0;ae-t);const n=t.map(()=>1);return[t,n]},[e]),B=s.useMemo(()=>({hooks:{draw:e=>{const t=w.current||rC();!function(e,t,n,a,s,r,o,i,l,c,u){if(!t||0===t.count)return;const d=e.ctx,{left:h,top:m,width:p,height:g}=e.bbox,f=window.devicePixelRatio||1;if(p<=0||g<=0)return;const y=e.data[0],b=y.length;if(0===b)return;const v=y[0],w=y[b-1],C="share"===a,k=function(e,t){if("airtime"===t)return 5;const n=[10,20,25,50,100,200,250,500,1e3],a=e/4.5;for(const s of n)if(s>=a)return s;return e>5e3?1e3*Math.ceil(a/1e3):100*Math.ceil(a/100)}(n,a);if(!C&&n>=20){d.save();const e=m+g*(1-20/n),t=parseInt(s.bgBody.slice(1,3),16)||23,a=parseInt(s.bgBody.slice(3,5),16)||23,r=parseInt(s.bgBody.slice(5,7),16)||23;d.fillStyle=`rgba(${t}, ${a}, ${r}, 0.5)`,d.fillRect(h,m,p,e-m),d.restore()}d.save(),d.lineWidth=1*f,d.setLineDash([4*f,4*f]);for(let D=k;Dn+s||(e.save(),e.strokeStyle=i.textPrimary,e.globalAlpha=.5,e.lineWidth=1*o,e.setLineDash([4*o,4*o]),e.beginPath(),e.moveTo(Math.round(t)+.5,a),e.lineTo(Math.round(t)+.5,a+r),e.stroke(),e.restore()))}(d,u,h,m,p,g,f,s),function(e,t,n,a,s,r,o,i,l){const{points:c,rawValues:u,count:d,packetTypes:h}=t,m=.8*i*(window.devicePixelRatio||1),p=2*m;e.globalCompositeOperation="source-over";const g=o?parseInt(o.replace("TYPE_",""),10):null;for(let f=0;f0&&function(e,t,n,a,s,r,o,i,l,c,u){if(0===t.length)return;const d=i-o||1,h=oC(u.signalCritical);e.save(),e.globalAlpha=c,e.fillStyle=`rgb(${h.r}, ${h.g}, ${h.b})`;for(const m of t){if(m.endTsi)continue;const t=n+(Math.max(m.startTs,o)-o)/d*s,c=n+(Math.min(m.endTs,i)-o)/d*s,u=Math.max(c-t,2*l);e.fillRect(t,a,u,r)}e.restore()}(d,r,h,m,p,g,v,w,f,i,s)}(e,m.current,A.current,p.current,t,f.current,y.current,b.current,v.current,x.current,C.current)}}}),[]),F=s.useMemo(()=>({width:400,height:200,padding:[8,0,8,28],cursor:{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],plugins:[B]}),[B]);s.useEffect(()=>{const t=d.current;if(!t||!e||0===e.count)return;h.current&&h.current.destroy();const n=t.getBoundingClientRect(),a=Math.floor(n.width)||400,s=Math.floor(n.height)||200,r=new us({...F,width:a,height:s},E,t);return h.current=r,()=>{r.destroy(),h.current=null}},[F,E,null==e?void 0:e.count]),s.useEffect(()=>{const e=d.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!h.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&h.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{h.current&&h.current.redraw()},[e,a,o,i,l,k,t]);const S=s.useCallback(t=>{var n,a;const s=d.current,r=h.current;if(!s||!r||!e||0===e.count)return;const o=s.getBoundingClientRect(),i=t.clientX-o.left,l=window.devicePixelRatio||1,c=r.bbox,u=c.left/l,m=c.width/l;if(iu+m)return C.current=null,r.redraw(),void(null==(n=g.current)||n.call(g,null,void 0));C.current=i*l;const p=(i-u)/m,f=Math.floor(p*e.count),y=Math.max(0,Math.min(e.count-1,f));r.redraw(),null==(a=g.current)||a.call(g,y,p)},[null==e?void 0:e.count]),M=s.useCallback(()=>{var e;C.current=null,h.current&&h.current.redraw(),null==(e=g.current)||e.call(g,null,void 0)},[]);return e&&0!==e.count?r.jsx("div",{ref:d,className:"w-full h-full rounded-lg overflow-hidden",onMouseMove:S,onMouseLeave:M}):r.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No data available"})}),cC=new class{constructor(){a(this,"observer",null),a(this,"subscribers",new Set),a(this,"isObserving",!1)}subscribe(e){return this.subscribers.add(e),this.isObserving||this.startObserving(),()=>{this.subscribers.delete(e),0===this.subscribers.size&&this.stopObserving()}}get subscriberCount(){return this.subscribers.size}startObserving(){"undefined"!=typeof window&&(this.isObserving||(this.observer=new MutationObserver(e=>{for(const t of e)if("data-theme"===t.attributeName||"data-color-scheme"===t.attributeName||"class"===t.attributeName){setTimeout(()=>this.notifySubscribers(),50);break}}),this.observer.observe(document.documentElement,{attributes:!0}),this.isObserving=!0))}stopObserving(){this.observer&&(this.observer.disconnect(),this.observer=null),this.isObserving=!1}notifySubscribers(){for(const t of this.subscribers)try{t()}catch(e){}}};function uC(e){if(!e)return null;const t=e.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);if(t)return{r:Math.round(255*Math.min(1,Math.max(0,parseFloat(t[1])))),g:Math.round(255*Math.min(1,Math.max(0,parseFloat(t[2])))),b:Math.round(255*Math.min(1,Math.max(0,parseFloat(t[3]))))};if(e.startsWith("#")){const t=e.replace("#","");if(3===t.length)return{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16)};if(t.length>=6)return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}const n=e.match(/rgba?\(([\d.]+),?\s*([\d.]+),?\s*([\d.]+)/);return n?{r:Math.round(parseFloat(n[1])),g:Math.round(parseFloat(n[2])),b:Math.round(parseFloat(n[3]))}:null}function dC(e){return"undefined"==typeof window?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function hC(e){return function(e){if(!e)return"";if(e.startsWith("#"))return e;const t=e.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);if(t){const e=Math.round(255*Math.min(1,Math.max(0,parseFloat(t[1])))),n=Math.round(255*Math.min(1,Math.max(0,parseFloat(t[2])))),a=Math.round(255*Math.min(1,Math.max(0,parseFloat(t[3]))));return`#${e.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`}const n=e.match(/rgba?\(([\d.]+),?\s*([\d.]+),?\s*([\d.]+)/);if(n){const e=Math.round(parseFloat(n[1])),t=Math.round(parseFloat(n[2])),a=Math.round(parseFloat(n[3]));return`#${e.toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`}return e}(dC(e))}function mC(e,t){const[n,a]=s.useState(t),r=s.useCallback(()=>{a(e())},[e]);return s.useEffect(()=>(r(),cC.subscribe(r)),[r]),n}const pC={chart1:T.blue,chart2:T.teal,chart3:T.amber,chart4:T.orange,chart5:T.pink,chart6:T.purple,chart7:T.cyan,chart8:P[500]},gC={excellent:T.green,good:T.yellow,fair:T.amber,poor:T.orange,critical:T.red},fC={primary:"#ffffff",secondary:P[400],muted:P[500]},yC={nodeFill:T.blue,nodeStroke:"rgba(255,255,255,0.9)",hubColor:T.purple,hubStroke:"rgba(255,255,255,0.9)",gatewayColor:T.indigo,gatewayStroke:"rgba(255,255,255,0.85)",localColor:T.amber,neighborColor:T.amber,neighborStroke:"rgba(0,0,0,0.4)",mobileColor:T.orange,roomColor:T.pink,ghostColor:T.cyan};function bC(){return"undefined"==typeof window?pC:{chart1:dC("--chart-1")||pC.chart1,chart2:dC("--chart-2")||pC.chart2,chart3:dC("--chart-3")||pC.chart3,chart4:dC("--chart-4")||pC.chart4,chart5:dC("--chart-5")||pC.chart5,chart6:dC("--chart-6")||pC.chart6,chart7:dC("--chart-7")||pC.chart7,chart8:dC("--chart-8")||pC.chart8}}function vC(){return"undefined"==typeof window?fC:{primary:dC("--text-primary")||fC.primary,secondary:dC("--text-secondary")||fC.secondary,muted:dC("--text-muted")||fC.muted}}function wC(){return mC(bC,pC)}function CC(){return mC(vC,fC)}function kC(){return"undefined"==typeof window?yC:{nodeFill:dC("--map-node-fill")||yC.nodeFill,nodeStroke:dC("--map-node-stroke")||yC.nodeStroke,hubColor:dC("--map-hub-color")||yC.hubColor,hubStroke:dC("--map-hub-stroke")||yC.hubStroke,gatewayColor:dC("--map-gateway-color")||yC.gatewayColor,gatewayStroke:dC("--map-gateway-stroke")||yC.gatewayStroke,localColor:dC("--map-local-color")||yC.localColor,neighborColor:dC("--map-neighbor-color")||yC.neighborColor,neighborStroke:dC("--map-neighbor-stroke")||yC.neighborStroke,mobileColor:dC("--map-mobile-color")||yC.mobileColor,roomColor:dC("--map-room-color")||yC.roomColor,ghostColor:dC("--map-ghost-color")||yC.ghostColor}}function xC(){return mC(kC,yC)}const DC={nodeStroke:"rgba(0,0,0,0.6)",hubStroke:"rgba(0,0,0,0.5)",gatewayStroke:"rgba(0,0,0,0.45)",neighborStroke:"rgba(0,0,0,0.5)"},AC={nodeStroke:"rgba(255,255,255,0.9)",hubStroke:"rgba(255,255,255,0.9)",gatewayStroke:"rgba(255,255,255,0.85)",neighborStroke:"rgba(0,0,0,0.4)"};function EC(e){if("undefined"==typeof window)return yC;const t="light"===function(){if("undefined"==typeof window)return"dark";const e=document.querySelector("[data-basemap]");return e&&e.getAttribute("data-basemap")||"dark"}()?DC:AC;return{nodeFill:hC("--map-node-fill")||yC.nodeFill,nodeStroke:t.nodeStroke,hubColor:hC("--map-hub-color")||yC.hubColor,hubStroke:t.hubStroke,gatewayColor:hC("--map-gateway-color")||yC.gatewayColor,gatewayStroke:t.gatewayStroke,localColor:hC("--map-local-color")||yC.localColor,neighborColor:hC("--map-neighbor-color")||yC.neighborColor,neighborStroke:t.neighborStroke,mobileColor:hC("--map-mobile-color")||yC.mobileColor,roomColor:hC("--map-room-color")||yC.roomColor,ghostColor:hC("--map-ghost-color")||yC.ghostColor}}const BC={rest:"rgba(255, 255, 255, 0.25)",restBright:"rgba(255, 255, 255, 0.35)",restDim:"rgba(255, 255, 255, 0.15)",hoverDirect:T.cyan,hoverLoop:T.purple,hoverStandard:P[400],hoverNeighbor:T.amber,highlight:"#FFD700"},FC={rest:"rgba(0, 0, 0, 0.20)",restBright:"rgba(0, 0, 0, 0.30)",restDim:"rgba(0, 0, 0, 0.12)"},SC={rest:"rgba(255, 255, 255, 0.25)",restBright:"rgba(255, 255, 255, 0.35)",restDim:"rgba(255, 255, 255, 0.15)"};function MC(e){if("undefined"==typeof window)return BC;const t="light"===e?FC:SC;return{rest:t.rest,restBright:t.restBright,restDim:t.restDim,hoverDirect:hC("--map-edge-hover-direct")||BC.hoverDirect,hoverLoop:hC("--map-edge-hover-loop")||BC.hoverLoop,hoverStandard:hC("--map-edge-hover-standard")||BC.hoverStandard,hoverNeighbor:hC("--map-edge-hover-neighbor")||BC.hoverNeighbor,highlight:hC("--map-edge-highlight")||BC.highlight}}const jC={grid:"rgba(191, 191, 191, 0.15)",axisTick:P[400],cursor:"rgba(255, 255, 255, 0.2)"};function TC(){return"undefined"==typeof window?jC:{grid:dC("--chart-grid")||jC.grid,axisTick:dC("--chart-axis-tick")||jC.axisTick,cursor:dC("--chart-cursor")||jC.cursor}}function PC(){return mC(TC,jC)}function LC(e,t){return dC(`--palette-${e}-${t}`)||""}function RC(){const e=[];for(let t=0;t<24;t++){const n=t/23,a=1-n,s=LC("aqua",[900,800,700,600,500,400,300,200,100,50][Math.min(8,Math.floor(9*a))]),r=parseInt(s.slice(1,3),16)||0,o=parseInt(s.slice(3,5),16)||0,i=parseInt(s.slice(5,7),16)||0,l=Math.round(80+130*n);e.push([r,o,i,l])}return e}function NC(){const e=dC("--signal-excellent")||gC.excellent,t=dC("--signal-good")||gC.good,n=dC("--signal-fair")||gC.fair,a=dC("--signal-poor")||gC.poor,s=dC("--signal-critical")||gC.critical,r=[];for(let o=0;o<24;o++){let i;i=o<5?e:o<10?t:o<15?n:o<20?a:s,r.push(i)}return r}function zC(){const e=hC("--signal-excellent")||gC.excellent,t=hC("--signal-good")||gC.good,n=hC("--signal-fair")||gC.fair,a=hC("--signal-poor")||gC.poor,s=hC("--signal-critical")||gC.critical,r=[];for(let o=0;o<24;o++){let i;i=o<5?e:o<10?t:o<15?n:o<20?a:s,r.push(i)}return r}function _C(){const[e,t]=s.useState(()=>NC());return s.useEffect(()=>{const e=()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t(NC())})})};return e(),cC.subscribe(e)},[]),e}function IC(e){const t=(Math.max(-12,Math.min(12,e))- -12)/24;return Math.round(23*(1-t))}const VC={...T};function OC(){return"undefined"==typeof window?VC:{red:hC("--sys-red")||VC.red,orange:hC("--sys-orange")||VC.orange,amber:hC("--sys-amber")||VC.amber,yellow:hC("--sys-yellow")||VC.yellow,brown:hC("--sys-brown")||VC.brown,green:hC("--sys-green")||VC.green,teal:hC("--sys-teal")||VC.teal,cyan:hC("--sys-cyan")||VC.cyan,blue:hC("--sys-blue")||VC.blue,indigo:hC("--sys-indigo")||VC.indigo,purple:hC("--sys-purple")||VC.purple,pink:hC("--sys-pink")||VC.pink}}function $C(){const e=s.useCallback(()=>"undefined"==typeof document||"light"!==document.documentElement.dataset.mode,[]),[t,n]=s.useState(e);return s.useEffect(()=>(n(e()),cC.subscribe(()=>n(e()))),[e]),t}function qC(){return"undefined"==typeof document||"light"!==document.documentElement.dataset.mode}let UC=null,WC=0;function HC(){const e=performance.now();if(UC&&e-WC<1e3)return UC;const t=getComputedStyle(document.documentElement),n=t.getPropertyValue("--font-data").trim()||'"JetBrains Mono", ui-monospace, monospace',a="light"!==document.documentElement.dataset.mode,s=t.getPropertyValue("--text-primary").trim()||(a?"#FFFFFF":"#1A1A1A"),r=t.getPropertyValue("--text-secondary").trim()||(a?"#BFBFBF":"#4A4A4A"),o=t.getPropertyValue("--chart-grid").trim()||(a?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.06)");return UC={fontFamily:n,textPrimary:s,textSecondary:r,gridColor:o},WC=e,UC}function YC(e){const t=e.replace("#","");return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}let GC=null,KC=0;function XC(e,t){return"airtime"===t?`${e}%`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function JC(e,t,n,a,s,r,o,i,l,c,u,d=.9,h=!1,m,p){if(0===t.length)return;const g=m??t[0].timestamp,f=(p??t[t.length-1].timestamp)-g||1;if(e.save(),e.strokeStyle=`rgba(${a.r}, ${a.g}, ${a.b}, ${d})`,e.lineWidth=u*c,e.lineCap="round",e.lineJoin="round",h){e.beginPath();let a=!1,c=0,u=0;for(let d=0;d{u.current=e,d.current=t,h.current=n,m.current=a,f.current=o,y.current=i}),s.useEffect(()=>{p.current=HC()},[]);const b=s.useMemo(()=>0===e.length?[[0],[0]]:[e.map(e=>e.timestamp),e.map(()=>1)],[e]),v=s.useMemo(()=>({hooks:{draw:e=>{const t=p.current||HC();!function(e,t,n,a,s,r,o,i){if(0===t.length)return;const l=e.ctx,{left:c,top:u,width:d,height:h}=e.bbox,m=window.devicePixelRatio||1;if(d<=0||h<=0)return;const p=function(){const e=performance.now();return GC&&e-KC<1e3||(GC=OC(),KC=e),GC}(),g=YC(p.blue),f=YC(p.red),y=YC(p.yellow),b=(v=n,"airtime"===a?v<=5?1:v<=10?2:v<=20?5:Math.ceil(v/5):v<=100?25:v<=500?100:v<=1e3?200:v<=5e3?1e3:v<=1e4?2e3:1e3*Math.ceil(v/5e3));var v;l.save(),l.strokeStyle=s.textSecondary,l.globalAlpha=.3,l.lineWidth=1*m,l.setLineDash([3*m,3*m]);for(let C=b;Cn+s||(e.save(),e.strokeStyle=i.textPrimary,e.globalAlpha=.5,e.lineWidth=1*o,e.setLineDash([4*o,4*o]),e.beginPath(),e.moveTo(Math.round(t)+.5,a),e.lineTo(Math.round(t)+.5,a+r),e.stroke(),e.restore()))}(l,r,c,u,d,h,m,s),JC(l,t,"rxSmooth",y,c,u,d,h,n,m,2,1,!0,o,i),JC(l,t,"tx",f,c,u,d,h,n,m,2.5,.9,!1,o,i),JC(l,t,"rx",g,c,u,d,h,n,m,2.5,.9,!1,o,i)}(e,u.current,h.current,d.current,t,g.current,f.current,y.current)}}}),[]),w=s.useMemo(()=>({width:400,height:200,padding:[8,8,8,44],cursor:{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],plugins:[v]}),[v]);s.useEffect(()=>{const t=l.current;if(!t||0===e.length)return;c.current&&c.current.destroy();const n=t.getBoundingClientRect(),a=Math.floor(n.width)||400,s=Math.floor(n.height)||200,r=new us({...w,width:a,height:s},b,t);return c.current=r,()=>{r.destroy(),c.current=null}},[w,b,e.length]),s.useEffect(()=>{const e=l.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!c.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&c.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{c.current&&c.current.redraw()},[e,n,t]);const C=s.useCallback(t=>{var n,a;const s=l.current,r=c.current;if(!s||!r||0===e.length)return;const o=s.getBoundingClientRect(),i=t.clientX-o.left,u=window.devicePixelRatio||1,d=r.bbox,h=d.left/u,p=d.width/u;if(ih+p)return g.current=null,r.redraw(),void(null==(n=m.current)||n.call(m,null));g.current=i*u;const f=(i-h)/p,y=Math.floor(f*e.length),b=Math.max(0,Math.min(e.length-1,y));r.redraw(),null==(a=m.current)||a.call(m,b)},[e.length]),k=s.useCallback(()=>{var e;g.current=null,c.current&&c.current.redraw(),null==(e=m.current)||e.call(m,null)},[]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted",children:"No data available"}):r.jsx("div",{ref:l,className:"w-full h-full rounded-lg overflow-hidden",onMouseMove:C,onMouseLeave:k})}),QC=[{name:"Dashboard",to:"/",icon:mr},{name:"Contacts",to:"/contacts",icon:yr},{name:"Packets",to:"/packets",icon:pr},{name:"Room Server",to:"/room-server",icon:vr},{name:"Statistics",to:"/statistics",icon:sr},{name:"MeshGraph",to:"/meshgraph",icon:Sr},{name:"System",to:"/system",icon:ur},{name:"Logs",to:"/logs",icon:cr},{name:"Terminal",to:"/terminal",icon:Fr},{name:"Configuration",to:"/configuration",icon:Ar}];function ek(){var e,t,n,a,o,l;const{pathname:c}=E(),u=B(),{stats:d,setMode:h,setDutyCycle:m,sendAdvert:p}=qb(),g=ag(),f=$b(e=>e.prefetchForRoute),y=ov(),b=$b(e=>e.packetCacheState.dataTier),v=uv(),w=Math.max(1,Math.ceil(rb[v].minutes/60)),C=xv(),k=Yv(),x=hw(),D=Pv(e=>e.unreadCount);let A=null;try{A=function(){const e=s.useContext(dp);if(!e)throw new Error("useSidebar must be used within a SidebarLayout");return e}()}catch{}const[F,S]=s.useState(!1),[M,j]=s.useState("idle"),[T,P]=s.useState(null),[L,R]=s.useState([]),N=s.useRef(null),z=s.useCallback(e=>{e!==c&&(N.current&&clearTimeout(N.current),N.current=setTimeout(()=>{f(e)},100))},[c,f]),_=s.useCallback(()=>{N.current&&(clearTimeout(N.current),N.current=null)},[]);s.useEffect(()=>{const e=async()=>{var e;try{const t=await vg(w);t.success&&(null==(e=t.data)?void 0:e.history)&&R(t.data.history)}catch{}};e();const t=setInterval(e,6e4);return()=>clearInterval(t)},[w]);const I=null==d?void 0:d.noise_floor_dbm,V=(null==(t=null==(e=null==d?void 0:d.config)?void 0:e.repeater)?void 0:t.mode)??"forward",O=(null==(a=null==(n=null==d?void 0:d.config)?void 0:n.duty_cycle)?void 0:a.enforcement_enabled)??!1,$=(null==(l=null==(o=null==d?void 0:d.config)?void 0:o.duty_cycle)?void 0:l.max_airtime_percent)??10,q=y.isLoading||y.isBackgroundLoading||y.isTopologyLoading,U=q||C||k,W=y.loadProgress,H=s.useCallback((e,t)=>{e.preventDefault(),null==A||A.close(),u(t)},[u,A]);return r.jsxs(ap,{children:[r.jsxs(sp,{className:"px-5 pt-3 pb-4",children:[r.jsx("h1",{className:"sr-only",children:"pyMC Console"}),r.jsxs("span",{className:"inline-flex self-start px-1.5 py-0.5 rounded text-[10px] font-medium tabular-nums bg-zinc-500/10 text-fg-muted mb-1",children:["v",zp]}),r.jsx(Ip,{responsive:!0,className:"block"})]}),r.jsxs(rp,{className:"pt-[13px] pb-4",children:[r.jsx(ip,{children:QC.map(e=>{const t=c===e.to,n="/terminal"===e.to,a="#6545EE";return r.jsxs(lp,{href:e.to,current:t,accentColor:n?a:void 0,onClick:t=>H(t,e.to),onMouseEnter:()=>z(e.to),onMouseLeave:_,children:[r.jsxs("span",{className:"relative",children:[r.jsx(e.icon,{className:i("size-[19px]",t&&!n&&"text-sys-blue"),style:t&&n?{color:a}:void 0}),"/room-server"===e.to&&D>0&&r.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-sys-red ring-2 ring-body"})]}),r.jsx(cp,{children:e.name}),"/contacts"===e.to&&x.length>0&&r.jsxs(up,{variant:"accent",children:[r.jsx(dr,{className:"w-3 h-3"}),r.jsx("span",{children:x.length})]}),"/meshgraph"===e.to&&r.jsx(up,{variant:"default",children:"Beta"})]},e.name)})}),U&&r.jsx("div",{className:"px-0 py-3",children:r.jsx(vv,{isLoading:q,borderRadius:12,children:r.jsxs("div",{className:"bg-surface/50 rounded-xl p-2",children:[r.jsxs("div",{className:"flex items-center gap-2 px-1 py-0.5",children:[r.jsxs("div",{className:"relative flex h-2 w-2",children:[r.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-sys-blue opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-sys-blue"})]}),r.jsx("span",{className:"type-data-xs text-fg-muted flex-1 truncate",children:y.isLoading&&W?"Loading 24h history...":y.isBackgroundLoading&&W?y.statusMessage||`Loading ${b} history...`:y.isTopologyLoading?"Loading topology data...":C?"Computing sparklines":k?"Building topology":"Analyzing database"}),null!==(null==W?void 0:W.percent)&&void 0!==(null==W?void 0:W.percent)&&q&&r.jsxs("span",{className:"type-data-xs text-fg-muted",children:[W.percent,"%"]})]}),r.jsx("div",{className:"mt-1.5 h-1 bg-subtle-fill rounded-full overflow-hidden",children:null!==(null==W?void 0:W.percent)&&void 0!==(null==W?void 0:W.percent)&&q?r.jsx("div",{className:"h-full bg-sys-blue/60 rounded-full transition-all duration-300 ease-out",style:{width:`${W.percent}%`}}):r.jsx("div",{className:"h-full bg-sys-blue/40 rounded-full w-full"})}),!q&&r.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 px-1",children:[r.jsx("span",{className:"type-micro text-fg-muted",children:"Data:"}),r.jsx("span",{className:"type-data-xs text-sys-blue",children:(e=>{switch(e){case"24h":return"24 hours";case"3d":return"3 days";case"7d":return"7 days";case"14d":return"14 days";default:return e}})(b)})]})]})})}),r.jsx("div",{className:"flex-1"}),r.jsx(Dp,{label:"Controls",icon:r.jsx(Br,{className:"w-5 h-5 text-sys-blue"}),defaultOpen:!1,direction:"up",dataId:"controls",children:r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(Js,{color:"success"===M?"success":"error"===M?"danger":"primary",onClick:async()=>{S(!0),j("idle"),P(null);const e=await p();S(!1),e.success?(j("success"),setTimeout(()=>j("idle"),1500)):(j("error"),P(e.error||"Failed to send"),setTimeout(()=>{j("idle"),P(null)},3e3))},disabled:F,className:"w-full justify-center",children:F?r.jsxs(r.Fragment,{children:[r.jsxs("svg",{"data-slot":"icon",className:"animate-spin",viewBox:"0 0 24 24",fill:"none",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),r.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Sending..."]}):"success"===M?r.jsxs(r.Fragment,{children:[r.jsx("svg",{"data-slot":"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Sent!"]}):"error"===M?r.jsxs(r.Fragment,{children:[r.jsxs("svg",{"data-slot":"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),"Failed"]}):r.jsxs(r.Fragment,{children:[r.jsx(Dr,{"data-slot":"icon"}),"Send Advert"]})}),T&&r.jsx("p",{className:"text-sys-red text-xs text-center",children:T}),r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-xs text-fg-muted",children:"Repeat"}),r.jsx("span",{className:i("text-xs font-medium","forward"===V?"text-sys-green":"text-sys-indigo"),children:"forward"===V?"ON":"OFF"})]}),r.jsx(Js,{color:"forward"===V?"success":"warning",onClick:()=>{h("forward"===V?"monitor":"forward")},className:"w-full justify-center",children:"forward"===V?r.jsxs(r.Fragment,{children:[r.jsx(kr,{"data-slot":"icon"}),"Repeating"]}):r.jsxs(r.Fragment,{children:[r.jsx(Cr,{"data-slot":"icon"}),"Monitor Only"]})}),r.jsxs("div",{className:"flex items-center justify-between gap-2 mt-1",children:[r.jsx("span",{className:"text-xs text-fg-muted",children:"Duty Cycle"}),r.jsx("span",{className:i("text-xs font-medium tabular-nums",O?"text-sys-indigo":"text-fg-muted"),children:O?`${$}%`:"OFF"})]}),r.jsxs(Js,{color:O?"warning":"muted",onClick:()=>{m(!O)},className:"w-full justify-center",children:[r.jsx(ur,{"data-slot":"icon"}),O?`Limited to ${$}%`:"Disabled"]})]})})]}),r.jsx(op,{children:r.jsxs("div",{className:"p-3 flex flex-col gap-1",children:[void 0!==(null==d?void 0:d.uptime_seconds)&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[r.jsx(ir,{className:"w-5 h-5 text-fg-muted flex-shrink-0"}),r.jsxs("span",{className:"type-data-xs text-fg-secondary",children:[bw(d.uptime_seconds)," uptime"]})]}),r.jsxs("div",{className:"flex items-center gap-3 px-3 pt-2 pb-0.5",children:[r.jsx(xr,{className:"w-5 h-5 text-sys-blue flex-shrink-0"}),r.jsx("span",{className:"type-data-xs text-fg-muted",children:"Noise Floor"}),r.jsx("span",{className:"ml-auto type-data text-fg-primary tabular-nums",children:null!=I?`${I.toFixed(0)} dBm`:"—"})]}),L.length>0&&r.jsx("div",{className:"pt-1 pb-1",children:r.jsx("div",{className:"relative radius-inner bg-zinc-500/10 ring-1 ring-inset ring-edge-subtle overflow-hidden py-2",children:r.jsx(nC,{timestamps:L.map(e=>e.timestamp),values:L.map(e=>e.noise_floor_dbm),compact:!0,height:28})})}),r.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[r.jsx(yv,{showLabel:!0}),(null==d?void 0:d.version)&&r.jsxs("span",{className:"type-data-xs text-fg-muted truncate",title:`v${d.version}`,children:["v",d.version]})]}),r.jsxs("button",{onClick:()=>{Jp(),window.location.href="/login"},className:"group flex items-center gap-3 px-3 py-2 radius-inner bg-zinc-500/10 ring-1 ring-inset ring-edge-subtle hover:bg-sys-red hover:ring-sys-red text-fg-muted hover:!text-black transition-all duration-150",children:[r.jsx(fr,{className:"w-5 h-5 flex-shrink-0"}),r.jsx("span",{className:"type-body-sm group-hover:!text-black",children:"Sign Out"}),g&&r.jsxs("span",{className:"ml-auto type-data-xs group-hover:!text-black",children:["(",g,")"]})]})]})})]})}function tk(){const e=ov(),t=e.isLoading||e.isBackgroundLoading||e.isTopologyLoading;return r.jsxs(gp,{children:[r.jsxs(fp,{children:[r.jsx("h1",{className:"sr-only",children:"pyMC Console"}),r.jsx(Ip,{height:26,className:"block"}),t&&r.jsx(wv,{className:"ml-2"})]}),r.jsx(yp,{}),r.jsxs(fp,{children:[r.jsxs("p",{className:"type-data-xs text-fg-muted",children:["v",zp]}),r.jsx(yv,{})]})]})}const nk=s.memo(function(){const{theme:e}=Cs(),{themeId:t,brightness:n}=e,a=W(t),s=null==a?void 0:a.meta.backgroundImage,o=null==a?void 0:a.meta.backgroundColor,i=(100-n)/100;return r.jsxs(r.Fragment,{children:[s?r.jsx("div",{className:"fixed inset-0 -z-20",style:{contain:"paint"},"aria-hidden":"true",children:r.jsx("div",{className:"absolute inset-0 bg-cover bg-center bg-no-repeat transition-opacity duration-300 ease-out",style:{backgroundImage:`url(${s})`}})}):o?r.jsx("div",{className:"fixed inset-0 -z-20 transition-colors duration-300 ease-out",style:{backgroundColor:o,contain:"paint"},"aria-hidden":"true"}):null,r.jsx("div",{className:"fixed inset-0 -z-10 bg-black pointer-events-none transition-opacity duration-200 ease-out",style:{opacity:i,contain:"paint"},"aria-hidden":"true"})]})}),ak=20,sk=12,rk=s.createContext(null);function ok({children:e}){const[t,n]=s.useState({content:null,mouseX:0,mouseY:0,visible:!1}),a=s.useRef(null),[o,i]=s.useState({x:0,y:0}),l=s.useCallback((e,t,a)=>{n({content:e,mouseX:t,mouseY:a,visible:!0})},[]),c=s.useCallback(()=>{n(e=>({...e,visible:!1}))},[]),u=s.useCallback((e,t)=>{n(n=>n.visible?{...n,mouseX:e,mouseY:t}:n)},[]);s.useEffect(()=>{if(!t.visible||!a.current)return;const e=a.current.getBoundingClientRect(),{mouseX:n,mouseY:s}=t,r=window.innerWidth,o=window.innerHeight;let l,c;l=n+ak+e.width+sk>r?n-ak-e.width:n+ak,l=Math.max(sk,Math.min(l,r-e.width-sk)),c=s-ak-e.height{c.current&&(clearTimeout(c.current),c.current=null)},h=s.useCallback(t=>{d(),c.current=setTimeout(()=>{u.current=!0,a(e,t.clientX,t.clientY)},n)},[a,e,n]),m=s.useCallback(e=>{u.current&&i(e.clientX,e.clientY)},[i]),p=s.useCallback(()=>{d(),u.current=!1,o()},[o]),g=s.useCallback(()=>{if(d(),!l.current)return;const t=l.current.getBoundingClientRect();c.current=setTimeout(()=>{u.current=!0,a(e,t.left+t.width/2,t.top)},n)},[a,e,n]),f=s.useCallback(()=>{d(),u.current=!1,o()},[o]);return s.useEffect(()=>()=>{d(),u.current&&(u.current=!1,o())},[o]),s.useEffect(()=>{const e=()=>{u.current&&(d(),u.current=!1,o())};return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)},[o]),r.jsx("span",{ref:l,onMouseEnter:h,onMouseMove:m,onMouseLeave:p,onFocus:g,onBlur:f,className:"contents",children:t})}function lk({label:e}){return r.jsx("div",{className:"min-h-[50vh]","aria-label":`Loading ${e}`,"aria-busy":"true"})}function ck(){return r.jsx(lk,{label:"dashboard"})}function uk(){return r.jsx(lk,{label:"list"})}function dk(){return r.jsx(lk,{label:"map"})}function hk(){return r.jsx(lk,{label:"charts"})}function mk(){return r.jsx(lk,{label:"settings"})}function pk(){return r.jsx(lk,{label:"system"})}function gk({children:e}){return r.jsx(r.Fragment,{children:e})}const fk=s.lazy(()=>k(()=>import("./Login-Q9eTfSur.js"),__vite__mapDeps([0,1,2,3,4]))),yk=s.lazy(()=>k(()=>import("./Dashboard-D9ScohcH.js"),__vite__mapDeps([5,1,6,7,8,9,10,11,12,3,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,4]))),bk=s.lazy(()=>k(()=>import("./Packets-B6m1oZw5.js"),__vite__mapDeps([37,1,12,3,13,10,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,9,38,6,39,30,4]))),vk=s.lazy(()=>k(()=>import("./Contacts-DbMN-LnJ.js").then(e=>e.C),__vite__mapDeps([40,1,41,10,6,42,30,22,16,17,43,44,26,23,19,39,45,38,21,27,15,46,47,3,14,35,48,49,4]))),wk=s.lazy(()=>k(()=>import("./Statistics-D9WTXlwy.js"),__vite__mapDeps([50,1,51,24,52,8,9,6,23,19,46,47,3,22,21,30,25,43,31,26,10,39,35,49,13,36,53,48,4]))),Ck=s.lazy(()=>k(()=>import("./MeshGraph-7WLMHygh.js"),__vite__mapDeps([54,1,55,56,43,28,23,19,14,11,44,24,49,53,20,48,3,4]))),kk=s.lazy(()=>k(()=>import("./System-Bl85VsR1.js"),__vite__mapDeps([57,1,6,22,30,18,48,26,58,36,3,4]))),xk=s.lazy(()=>k(()=>import("./Logs-B5-CJrX4.js"),__vite__mapDeps([59,1,51,6,30,3,4]))),Dk=s.lazy(()=>k(()=>import("./Terminal-BvORGL-y.js"),__vite__mapDeps([60,1,61,17,56,41,3,13,62,63,64,2,6,49,20,4,65]))),Ak=s.lazy(()=>k(()=>import("./Configuration-ribtJFkN.js"),__vite__mapDeps([66,1,62,45,22,67,7,33,6,23,19,30,64,36,68,27,58,20,3,4]))),Ek=s.lazy(()=>k(()=>import("./RoomServer-B0PNcG8D.js"),__vite__mapDeps([69,1,6,36,42,45,22,21,63,64,34,15,30,70,68,19,38,3,4])));function Bk({children:e}){const t=E();return Zp()?r.jsx(r.Fragment,{children:e}):r.jsx(M,{to:"/login",state:{from:t},replace:!0})}class Fk extends s.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){var e;return this.state.hasError?r.jsxs("div",{className:"surface-base rounded-2xl p-8 text-center",children:[r.jsx("p",{className:"type-subheading text-sys-red mb-2",children:"Page failed to render"}),r.jsx("p",{className:"type-body text-fg-muted mb-4",children:(null==(e=this.state.error)?void 0:e.message)||"Unknown error"}),r.jsx("button",{onClick:()=>this.setState({hasError:!1}),className:"px-4 py-2 bg-sys-blue/20 text-sys-blue rounded-lg hover:bg-sys-blue/30 transition-colors",children:"Try Again"})]}):this.props.children}}function Sk(){const e=$b(e=>e.initializeApp),t=Zp();return s.useEffect(()=>{if(!t)return;e(),pf.getState().initialize(),Pv.getState().initialize();const n=setInterval(()=>{ig()},3e4);return ig(),function(){if(lg)return;if("undefined"==typeof document)return;const e=async()=>{if("visible"!==document.visibilityState)return;if(!Kp())return;if(eg())return Jp(),void("undefined"==typeof window||window.location.pathname.includes("/login")||(window.location.href="/login"));const e=tg();e>0&&e<300&&await rg()};document.addEventListener("visibilitychange",e),lg=!0,"visible"===document.visibilityState&&e()}(),()=>clearInterval(n)},[e,t]),r.jsxs(ok,{children:[r.jsx(nk,{}),r.jsxs(F,{children:[r.jsx(S,{path:"/login",element:r.jsx(s.Suspense,{fallback:r.jsx("div",{className:"min-h-screen bg-body"}),children:r.jsx(fk,{})})}),r.jsx(S,{path:"/*",element:r.jsx(Bk,{children:r.jsx(pp,{sidebar:r.jsx(ek,{}),navbar:r.jsx(tk,{}),children:r.jsx("div",{className:"px-1 sm:px-4 lg:px-4 pt-5 pb-4 sm:pb-6 lg:pb-8 max-w-7xl mx-auto",children:r.jsx(Fk,{children:r.jsxs(F,{children:[r.jsx(S,{path:"/",element:r.jsx(s.Suspense,{fallback:r.jsx(ck,{}),children:r.jsx(gk,{children:r.jsx(yk,{})})})}),r.jsx(S,{path:"/packets",element:r.jsx(s.Suspense,{fallback:r.jsx(uk,{}),children:r.jsx(gk,{children:r.jsx(bk,{})})})}),r.jsx(S,{path:"/contacts",element:r.jsx(s.Suspense,{fallback:r.jsx(dk,{}),children:r.jsx(gk,{children:r.jsx(vk,{})})})}),r.jsx(S,{path:"/statistics",element:r.jsx(s.Suspense,{fallback:r.jsx(hk,{}),children:r.jsx(gk,{children:r.jsx(wk,{})})})}),r.jsx(S,{path:"/meshgraph",element:r.jsx(s.Suspense,{fallback:r.jsx(hk,{}),children:r.jsx(gk,{children:r.jsx(Ck,{})})})}),r.jsx(S,{path:"/system",element:r.jsx(s.Suspense,{fallback:r.jsx(pk,{}),children:r.jsx(gk,{children:r.jsx(kk,{})})})}),r.jsx(S,{path:"/logs",element:r.jsx(s.Suspense,{fallback:r.jsx(uk,{}),children:r.jsx(gk,{children:r.jsx(xk,{})})})}),r.jsx(S,{path:"/terminal",element:r.jsx(s.Suspense,{fallback:r.jsx(uk,{}),children:r.jsx(gk,{children:r.jsx(Dk,{})})})}),r.jsx(S,{path:"/room-server",element:r.jsx(s.Suspense,{fallback:r.jsx(uk,{}),children:r.jsx(gk,{children:r.jsx(Ek,{})})})}),r.jsx(S,{path:"/configuration",element:r.jsx(s.Suspense,{fallback:r.jsx(mk,{}),children:r.jsx(gk,{children:r.jsx(Ak,{})})})})]})})})})})})]})]})}const Mk=console.warn;console.warn=(...e)=>{const t=e[0];"string"==typeof t&&t.includes("Unable to load glyph range")||Mk.apply(console,e)},x.createRoot(document.getElementById("root")).render(r.jsx(s.StrictMode,{children:r.jsx(ws,{children:r.jsx(j,{children:r.jsx(Sk,{})})})}));export{mv as $,kh as A,Js as B,Np as C,rb as D,vg as E,cv as F,kb as G,ik as H,jp as I,Qy as J,tb as K,gr as L,nb as M,sb as N,vw as O,Vf as P,dv as Q,xr as R,Nw as S,Fp as T,zw as U,ff as V,Ym as W,Xm as X,or as Y,P as Z,Wb as _,np as a,ub as a$,ov as a0,kg as a1,sr as a2,xs as a3,Ds as a4,Mr as a5,ic as a6,Zl as a7,Tr as a8,Lr as a9,bp as aA,rw as aB,dw as aC,dr as aD,wr as aE,Ew as aF,lw as aG,qb as aH,rv as aI,Uv as aJ,Wv as aK,aw as aL,sw as aM,hv as aN,kv as aO,pv as aP,OC as aQ,pg as aR,gg as aS,ZC as aT,Ls as aU,lC as aV,fs as aW,_C as aX,wC as aY,CC as aZ,$C as a_,sy as aa,ry as ab,oy as ac,Vs as ad,xw as ae,Ns as af,zs as ag,qs as ah,Ab as ai,Om as aj,Ah as ak,Of as al,Cw as am,ir as an,Ky as ao,Dr as ap,NC as aq,IC as ar,tw as as,Hv as at,uw as au,eb as av,Hs as aw,Bw as ax,kw as ay,As as az,Zm as b,bf as b$,iw as b0,cw as b1,hr as b2,hw as b3,Sr as b4,xg as b5,ob as b6,cb as b7,nC as b8,Cb as b9,Kb as bA,Jb as bB,Zb as bC,cr as bD,db as bE,mb as bF,cC as bG,yg as bH,Ag as bI,Fg as bJ,jg as bK,Mg as bL,Sg as bM,iy as bN,Tg as bO,Pg as bP,cg as bQ,Km as bR,ep as bS,Qm as bT,gf as bU,ag as bV,pf as bW,Fr as bX,hg as bY,yf as bZ,Ef as b_,tp as ba,vr as bb,zp as bc,Db as bd,Es as be,qv as bf,mw as bg,yw as bh,pw as bi,nw as bj,T as bk,Cr as bl,kr as bm,ww as bn,Sp as bo,qC as bp,lr as bq,L as br,ev as bs,tv as bt,nv as bu,av as bv,Qb as bw,bw as bx,Eg as by,Gb as bz,ar as c,uC as c$,vf as c0,wf as c1,Cf as c2,ny as c3,ey as c4,ty as c5,Ly as c6,ly as c7,cy as c8,$f as c9,Rf as cA,Mf as cB,jf as cC,Xf as cD,Kf as cE,Gf as cF,Yf as cG,Qf as cH,Cs as cI,U as cJ,hf as cK,Ar as cL,Br as cM,Dw as cN,Aw as cO,Tp as cP,Jm as cQ,Pv as cR,Lv as cS,Rv as cT,Vv as cU,Ov as cV,Nv as cW,zv as cX,_v as cY,Iv as cZ,zC as c_,jy as ca,Wf as cb,uy as cc,Py as cd,Fy as ce,Sy as cf,My as cg,qf as ch,Hf as ci,Uf as cj,Ty as ck,ay as cl,Jf as cm,Zf as cn,Yy as co,Gy as cp,If as cq,_f as cr,Lf as cs,Ff as ct,Bf as cu,zf as cv,Pf as cw,Tf as cx,Sf as cy,Nf as cz,us as d,EC as d0,MC as d1,xC as d2,RC as d3,Gg as d4,xb as d5,Ev as d6,xv as d7,lv as d8,rf as d9,Su as dA,vh as dB,uo as dC,Md as dD,Yv as dE,Gv as dF,vv as dG,Qr as da,mo as db,nu as dc,$c as dd,Ph as de,hh as df,Gl as dg,xc as dh,ci as di,zr as dj,Ql as dk,Ii as dl,Ai as dm,_i as dn,Al as dp,Kr as dq,Yr as dr,Ic as ds,Vc as dt,Vu as du,Tu as dv,Hc as dw,Ed as dx,rc as dy,Ni as dz,Tw as e,lb as f,Hp as g,wp as h,Zp as i,Ws as j,ow as k,sg as l,Nm as m,Bg as n,rr as o,Hb as p,Yb as q,Xb as r,Yp as s,Ub as t,PC as u,ab as v,yv as w,iv as x,sv as y,uv as z}; diff --git a/frontend/dist/assets/index-D932VMrD.js b/frontend/dist/assets/index-CCvUM2Hn.js similarity index 99% rename from frontend/dist/assets/index-D932VMrD.js rename to frontend/dist/assets/index-CCvUM2Hn.js index d7ba352e..f63cd076 100644 --- a/frontend/dist/assets/index-D932VMrD.js +++ b/frontend/dist/assets/index-CCvUM2Hn.js @@ -1 +1 @@ -import{r as t,j as e}from"./vendor-react-j_fHog8x.js";import{db as n,dc as r,dd as a,de as s,df as i,a8 as o,dg as l,dh as u,di as c,dj as f,dk as p,dl as d,dm as y,dn as h,dp as m,dq as g,dr as x,ds as v,dt as j,du as b,dv as w,dw as k,dx as A,dy as $,dz as D,m as M,dA as S,dB as C,A as R,ak as I,dC as E,dD as F}from"./index-01Tx8g53.js";function N(t,e){return n(t)?t[((t,e,n)=>{const r=e-0;return((n-0)%r+r)%r+0})(0,t.length,e)]:t}class P{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;ne.attachTimeline(t));return()=>{e.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return T(this.animations,"duration")}get iterationDuration(){return T(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(e=>e[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function T(t,e){let n=0;for(let r=0;rn&&(n=a)}return n}class O extends P{then(t,e){return this.finished.finally(t).then(()=>{})}}class W extends r{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,e){if(function(t,e){return t in e}(e,t)){const n=t[e];if("string"==typeof n||"number"==typeof n)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(t,e){delete e.output[t]}measureInstanceViewportBox(){return a()}build(t,e){Object.assign(t.output,e)}renderInstance(t,{output:e}){Object.assign(t,e)}sortInstanceNodePosition(){return 0}}function B({children:n,isValidProp:r,...a}){r&&s(r),(a={...t.useContext(i),...a}).isStatic=o(()=>a.isStatic);const l=t.useMemo(()=>a,[JSON.stringify(a.transition),a.transformPagePoint,a.reducedMotion]);return e.jsx(i.Provider,{value:l,children:n})}function L(t){return"object"==typeof t&&!Array.isArray(t)}function V(t,e,n,r){return null==t?[]:"string"==typeof t&&L(e)?u(t,n,r):t instanceof NodeList?Array.from(t):Array.isArray(t)?t.filter(t=>null!=t):[t]}function z(t,e,n){return t*(e+1)}function H(t,e,n,r){return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:e.startsWith("<")?Math.max(0,n+parseFloat(e.slice(1))):r.get(e)??t}function K(t,e,n,r,a,s){!function(t,e,n){for(let r=0;re&&a.at"number"==typeof t,Y=t=>t.every(U);function Z(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=v(t)&&!j(t)?new b(e):new w(e);n.mount(t),k.set(t,n)}function tt(t){const e=new W({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});e.mount(t),k.set(t,e)}function et(t,e,n,r){const a=[];if(function(t,e){return p(t)||"number"==typeof t||"string"==typeof t&&!L(e)}(t,e))a.push(A(t,L(e)&&e.default||e,n&&n.default||n));else{if(null==t)return a;const s=V(t,e,r),i=s.length;for(let t=0;t{const l=G(t),{delay:u=0,times:c=d(l),type:p=e.type||"keyframes",repeat:x,repeatType:j,repeatDelay:b=0,...k}=n;let{ease:A=e.ease||"easeOut",duration:$}=n;const D="function"==typeof u?u(i,o):u,M=l.length,S=m(p)?p:null==a?void 0:a[p||"keyframes"];if(M<=2&&S){let t=100;if(2===M&&Y(l)){const e=l[1]-l[0];t=Math.abs(e)}const n={...e,...k};void 0!==$&&(n.duration=g($));const r=y(n,t,S);A=r.ease,$=r.duration}$??($=s);const C=f+D;1===c.length&&0===c[0]&&(c[1]=1);const R=c.length-l.length;if(R>0&&h(c,R),1===l.length&&l.unshift(null),x){$=z($,x);const t=[...l],e=[...c];A=Array.isArray(A)?[...A]:[A];const n=[...A];for(let r=0;r{for(const a in t){const s=t[a];s.sort(q);const o=[],l=[],u=[];for(let t=0;t{r.push(...et(n,t,e))}),r}(t,e,rt);else{const{onComplete:s,...i}=n||{};"function"==typeof s&&(r=s),a=et(t,e,i,rt)}var s;const i=new O(a);return r&&i.finished.then(r),i};var rt;const at="var(--mask-height, 0.15em)",st="var(--mask-width, 0.5em)",it=`calc(${st} / var(--invert-x, 1))`,ot="#000 0, transparent 71%",lt=`linear-gradient(to right, transparent 0, #000 ${it}, #000 calc(100% - ${it}), transparent),linear-gradient(to bottom, transparent 0, #000 ${at}, #000 calc(100% - ${at}), transparent 100%),radial-gradient(at bottom right, ${ot}),radial-gradient(at bottom left, ${ot}), radial-gradient(at top left, ${ot}), radial-gradient(at top right, ${ot})`,ut=`100% calc(100% - ${at} * 2),calc(100% - ${it} * 2) 100%,${it} ${at},${it} ${at},${it} ${at},${it} ${at}`;function ct({children:t,layoutDependency:n}){return e.jsx(M.span,{layout:!0,layoutDependency:n,"aria-hidden":!0,style:{display:"inline-flex","--invert-x":1,margin:`0 calc(-1*${st})`,padding:`calc(${at}/2) ${st}`,position:"relative",zIndex:-1,overflow:"clip",WebkitMaskImage:lt,WebkitMaskSize:ut,WebkitMaskPosition:"center, center, top left, top right, bottom right, bottom left",WebkitMaskRepeat:"no-repeat"},children:t})}function ft(){const e=t.useRef(!0);return t.useEffect(()=>{e.current=!1},[]),e.current}function pt(t){const{width:e,fontSize:n}=getComputedStyle(t);return parseFloat(e)/parseFloat(n)+"em"}S({"--invert-x":{correct:(t,{treeScale:e,projectionDelta:n})=>n.x.scale*e.x}});const dt=new WeakMap,yt=t.forwardRef(function({value:n,initialValue:r=n,...a},s){const{transition:o}=t.useContext(i),l=t.useRef(r).current,u=ft(),c=t.useRef(null),f=t.useRef(null);t.useImperativeHandle(s,()=>f.current,[]);const p=t.useRef(new Array(10)),d=C(),y=d?n:0;t.useLayoutEffect(()=>{c.current&&p.current[l]&&(c.current.style.width=pt(p.current[l]))},[]);const h=t.useRef(r);t.useLayoutEffect(()=>{var t;if(!c.current||y===h.current)return;const e=c.current.getBoundingClientRect(),n=null==(t=f.current)?void 0:t.getBoundingClientRect(),r=e.height*(y-h.current)+(e.top-(n?n.top||0:e.top));return nt(c.current,{y:[r,0]},o),()=>{h.current=y}},[y]);const[m,g]=t.useState();t.useEffect(()=>{if(u&&l===y)return;if(!p.current[y])return;const t=pt(p.current[y]);f.current&&dt.set(f.current,t),g(t)},[y]);const x=t=>e.jsx("span",{style:{display:"inline-block",padding:`calc(${at}/2) 0`},ref:e=>{p.current[t]=e},children:t},t);return e.jsx(M.span,{...a,ref:f,layout:"position","data-state":d?void 0:"exiting",style:{display:"inline-flex",justifyContent:"center",width:m},children:e.jsxs("span",{ref:c,style:{display:"inline-flex",justifyContent:"center",flexDirection:"column",alignItems:"center",position:"relative"},children:[0!==y&&e.jsx("span",{style:{...ht,bottom:"100%",left:0},children:new Array(y).fill(null).map((t,e)=>x(e))}),x(y),9!==y&&e.jsx("span",{style:{...ht,top:"100%",left:0},children:new Array(9-y).fill(null).map((t,e)=>x(y+e+1))})]})})}),ht={display:"flex",flexDirection:"column",alignItems:"center",position:"absolute",width:"100%"},mt=t.createContext({justify:"left"}),gt=t.forwardRef(function({partKey:n,type:r,children:a,layoutDependency:s,...i},o){const l=C(),{justify:u}=t.useContext(mt);return e.jsx(M.span,{...i,"data-state":l?void 0:"exiting",style:{display:"inline-flex",justifyContent:u,padding:`calc(${at}/2) 0`,position:"relative"},layout:"position",layoutDependency:s,ref:o,children:e.jsx(R,{mode:"popLayout",anchorX:u,initial:!1,children:e.jsx(M.span,{layout:"right"===u&&"position",layoutDependency:s,initial:{opacity:0},animate:{opacity:[null,1]},exit:{opacity:[null,0]},style:{display:"inline-block",whiteSpace:"pre"},children:a},a)})})}),xt=t.forwardRef(function({parts:n,justify:r="left",mode:a,style:s,name:i,layoutDependency:o,...l},u){const c=t.useRef(null);t.useImperativeHandle(u,()=>c.current,[]);const f=t.useMemo(()=>({justify:r}),[r]),p=t.useRef(null),d=ft(),[y,h]=t.useState();return t.useEffect(()=>{if(!p.current)return;if(d)return void(c.current&&(c.current.style.width=pt(p.current)));const t=Array.from(p.current.children).map(t=>{if(!(t instanceof HTMLElement))return;if("exiting"===t.dataset.state){const e=t.nextSibling;return t.remove(),()=>{p.current&&p.current.insertBefore(t,e)}}const e=dt.get(t);if(!e)return;const n=t.style.width;return t.style.width=e,()=>{t.style.width=n}});h(pt(p.current));for(let e=t.length-1;e>=0;e--){const n=t[e];n&&n()}},[n.map(t=>t.value).join("")]),e.jsx(mt.Provider,{value:f,children:e.jsx(M.span,{layoutDependency:o,...l,ref:c,className:`number-section-${i}`,style:{...s,display:"inline-flex",justifyContent:r,width:y},children:e.jsxs("span",{ref:p,style:{display:"inline-flex",justifyContent:"inherit",position:"relative"},children:["​",e.jsx(R,{mode:a,anchorX:r,initial:!1,children:n.map(t=>"integer"===t.type||"fraction"===t.type?e.jsx(yt,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},value:t.value,initialValue:d?void 0:0,layoutDependency:o},t.key):e.jsx(gt,{type:t.type,partKey:t.key,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},layoutDependency:o,children:t.value},"literal"===t.type?`${t.key}:${t.value}`:t.key))})]})})})}),vt={opacity:{duration:1,ease:E},layout:{type:"spring",duration:1,bounce:0},y:{type:"spring",duration:1,bounce:0}},jt=t.forwardRef(function({children:n,locales:r,format:a,transition:s,style:o,suffix:l,prefix:u,...c},f){const p=t.useMemo(()=>((t,{locales:e,format:n},r,a)=>{const s=new Intl.NumberFormat(e,n).formatToParts(Number(t));r&&s.unshift({type:"prefix",value:r}),a&&s.push({type:"suffix",value:a});const i=[],o=[],l=[],u=[],c={},f=t=>`${t}:${c[t]=(c[t]??-1)+1}`;let p="",d=!1,y=!1;for(const m of s){p+=m.value;const t="minusSign"===m.type||"plusSign"===m.type?"sign":m.type;switch(t){case"integer":d=!0,o.push(...m.value.split("").map(e=>({type:t,value:parseInt(e)})));break;case"group":o.push({type:t,value:m.value});break;case"decimal":y=!0,l.push({type:t,value:m.value,key:f(t)});break;case"fraction":l.push(...m.value.split("").map(e=>({type:t,value:parseInt(e),key:f(t)})));break;default:(d||y?u:i).push({type:t,value:m.value,key:f(t)})}}const h=[];for(let m=o.length-1;m>=0;m--)h.unshift({...o[m],key:f(o[m].type)});return{pre:i,integer:h,fraction:l,post:u,formatted:p}})(n,{locales:r,format:a},u,l),[n,r,a]),{pre:d,integer:y,fraction:h,post:m,formatted:g}=p,x=t.useContext(i).transition;s=s??x??vt;const{layoutDependency:v}=c,j=t.useMemo(()=>{if(void 0!==v)return{layoutDependency:v,value:n}},[v,n]);return e.jsx(I,{children:e.jsx(B,{transition:s,children:e.jsx(M.div,{...c,ref:f,layout:!0,layoutDependency:j,style:{lineHeight:1,...o,display:"inline-flex",isolation:"isolate",whiteSpace:"nowrap"},children:e.jsxs(M.div,{layout:!0,layoutDependency:j,"aria-label":g,style:{display:"inline-flex",direction:"ltr",isolation:"isolate",position:"relative",zIndex:-1},children:[e.jsx(xt,{style:{padding:`calc(${at}/2) 0`},layoutDependency:j,"aria-hidden":!0,justify:"right",mode:"popLayout",parts:d,name:"pre"}),e.jsxs(ct,{layoutDependency:j,children:[e.jsx(xt,{layoutDependency:j,justify:"right",parts:y,name:"integer"}),e.jsx(xt,{layout:"position",layoutDependency:j,parts:h,name:"fraction"})]}),e.jsx(xt,{style:{padding:`calc(${at}/2) 0`},"aria-hidden":!0,layout:"position",layoutDependency:j,mode:"popLayout",parts:m,name:"post"})]})})})})});function bt(t,e){return t.length>e.length||t.length>0&&!e.startsWith(t)}function wt(t,e,n){return t+(e-t)*n}M.create(t.Fragment);const kt=new Set([".",",","!","?",":",";","'",'"',"-","(",")"]),At=new Set(["!","@","#","$","%","^","&","*","(",")","_","+","{","}","|",":",'"',"<",">","?"]);const $t={slow:130,normal:75,fast:30};t.forwardRef(function({children:n="",as:r,speed:a="normal",variance:s="natural",cursorClassName:u="motion-typewriter-cursor",cursorStyle:c,cursorBlinkDuration:f=.5,onComplete:p,play:d=!0,"aria-label":y,textClassName:h,textStyle:m,replace:g="type",backspace:x="character",backspaceFactor:v=.2,...j},b){const w=r||"span",k=t.useRef(n),A=function(){const e=o(()=>l("")),{isStatic:n}=t.useContext(i);if(n){const[,n]=t.useState("");t.useEffect(()=>e.on("change",n),[])}return e}(),$=t.useRef(null),D=t.useRef(null),S=t.useRef(null),C="number"==typeof a?a:$t[a],R=()=>{var t;null==(t=$.current)||t.call($),$.current=null},I=()=>{D.current=nt(S.current,{opacity:[1,1,0,0]},{duration:f,times:[0,.5,.5,1],ease:"linear",repeat:1/0,repeatType:"reverse"})};return t.useEffect(()=>{"all"===g&&n!==k.current&&A.set(""),k.current=n},[n,g]),t.useEffect(()=>{var t;if(!d)return I(),void R();null==(t=D.current)||t.cancel();const e=()=>{const t=function(t,e,n,r){if("type"===n&&bt(t,e)){if("all"===r)return e.slice(0,function(t,e){const n=Math.min(t.length,e.length);let r=0;for(let a=0;a=0&&/\s/.test(t[n]);)n--;for(;n>=0&&!/\s/.test(t[n]);)n--;return Math.max(0,n+1)}(t,t.length);return t.slice(0,e)}return t.slice(0,-1)}return e.slice(0,t.length+1)}(A.get(),n,g,x);A.set(t),t!==n?r():(I(),null==p||p())},r=()=>{$.current=F(e,function(t,e,n,r,a){if(bt(e,t))return n*a;if("natural"===r)return function(t,e,n){const r=e.length,a=t[r],s=t[r-1];if(!a)return n;const i=t.slice(0,r).lastIndexOf(" "),o=r-i-1,l=i+1,u=t.slice(r).indexOf(" "),c=(-1===u?t.length:r+u)-l;let f=1;s&&/[.!?]/.test(s)&&" "===a&&(f*=3),c<=3?f*=.7:(0===o&&" "!==a&&(f*=1.5),o===c-1&&(f*=1.4)),o>0&&o3&&(f*=1-Math.min(o/c,.4)),kt.has(a)&&(f*=1.5),At.has(a)&&(f*=1.5),/\d/.test(a)&&(f*=1.3),c>8&&(f*=1.3),a!==a.toLowerCase()&&(f*=1.25),r>200&&(f*=1+Math.min((r-200)/1e3,.3)),f*=1+wt(-.25,.25,Math.random());const p=n*f;return Math.max(.2*n,p)}(t,e,n);if("number"==typeof r&&r>0){const t=n*(r/100);return n+wt(-t,t,Math.random())}return n}(n,A.get(),C,s,v))};return $.current||r(),R},[d,p,n,C,s,v,x]),e.jsxs(w,{ref:b,...j,"aria-label":y||n,children:[e.jsx(M.span,{className:h,style:m,children:A}),e.jsx(M.span,{ref:S,className:u,style:{display:"inline-block",width:"2px",height:"1em",backgroundColor:"currentColor",position:"relative",top:"0.1em",left:"0.2em",...c}})]})});export{jt as A}; +import{r as t,j as e}from"./vendor-react-j_fHog8x.js";import{db as n,dc as r,dd as a,de as s,df as i,a8 as o,dg as l,dh as u,di as c,dj as f,dk as p,dl as d,dm as y,dn as h,dp as m,dq as g,dr as x,ds as v,dt as j,du as b,dv as w,dw as k,dx as A,dy as $,dz as D,m as M,dA as S,dB as C,A as R,ak as I,dC as E,dD as F}from"./index-BBcIGlRT.js";function N(t,e){return n(t)?t[((t,e,n)=>{const r=e-0;return((n-0)%r+r)%r+0})(0,t.length,e)]:t}class P{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;ne.attachTimeline(t));return()=>{e.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return T(this.animations,"duration")}get iterationDuration(){return T(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(e=>e[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function T(t,e){let n=0;for(let r=0;rn&&(n=a)}return n}class O extends P{then(t,e){return this.finished.finally(t).then(()=>{})}}class W extends r{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,e){if(function(t,e){return t in e}(e,t)){const n=t[e];if("string"==typeof n||"number"==typeof n)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(t,e){delete e.output[t]}measureInstanceViewportBox(){return a()}build(t,e){Object.assign(t.output,e)}renderInstance(t,{output:e}){Object.assign(t,e)}sortInstanceNodePosition(){return 0}}function B({children:n,isValidProp:r,...a}){r&&s(r),(a={...t.useContext(i),...a}).isStatic=o(()=>a.isStatic);const l=t.useMemo(()=>a,[JSON.stringify(a.transition),a.transformPagePoint,a.reducedMotion]);return e.jsx(i.Provider,{value:l,children:n})}function L(t){return"object"==typeof t&&!Array.isArray(t)}function V(t,e,n,r){return null==t?[]:"string"==typeof t&&L(e)?u(t,n,r):t instanceof NodeList?Array.from(t):Array.isArray(t)?t.filter(t=>null!=t):[t]}function z(t,e,n){return t*(e+1)}function H(t,e,n,r){return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:e.startsWith("<")?Math.max(0,n+parseFloat(e.slice(1))):r.get(e)??t}function K(t,e,n,r,a,s){!function(t,e,n){for(let r=0;re&&a.at"number"==typeof t,Y=t=>t.every(U);function Z(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=v(t)&&!j(t)?new b(e):new w(e);n.mount(t),k.set(t,n)}function tt(t){const e=new W({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});e.mount(t),k.set(t,e)}function et(t,e,n,r){const a=[];if(function(t,e){return p(t)||"number"==typeof t||"string"==typeof t&&!L(e)}(t,e))a.push(A(t,L(e)&&e.default||e,n&&n.default||n));else{if(null==t)return a;const s=V(t,e,r),i=s.length;for(let t=0;t{const l=G(t),{delay:u=0,times:c=d(l),type:p=e.type||"keyframes",repeat:x,repeatType:j,repeatDelay:b=0,...k}=n;let{ease:A=e.ease||"easeOut",duration:$}=n;const D="function"==typeof u?u(i,o):u,M=l.length,S=m(p)?p:null==a?void 0:a[p||"keyframes"];if(M<=2&&S){let t=100;if(2===M&&Y(l)){const e=l[1]-l[0];t=Math.abs(e)}const n={...e,...k};void 0!==$&&(n.duration=g($));const r=y(n,t,S);A=r.ease,$=r.duration}$??($=s);const C=f+D;1===c.length&&0===c[0]&&(c[1]=1);const R=c.length-l.length;if(R>0&&h(c,R),1===l.length&&l.unshift(null),x){$=z($,x);const t=[...l],e=[...c];A=Array.isArray(A)?[...A]:[A];const n=[...A];for(let r=0;r{for(const a in t){const s=t[a];s.sort(q);const o=[],l=[],u=[];for(let t=0;t{r.push(...et(n,t,e))}),r}(t,e,rt);else{const{onComplete:s,...i}=n||{};"function"==typeof s&&(r=s),a=et(t,e,i,rt)}var s;const i=new O(a);return r&&i.finished.then(r),i};var rt;const at="var(--mask-height, 0.15em)",st="var(--mask-width, 0.5em)",it=`calc(${st} / var(--invert-x, 1))`,ot="#000 0, transparent 71%",lt=`linear-gradient(to right, transparent 0, #000 ${it}, #000 calc(100% - ${it}), transparent),linear-gradient(to bottom, transparent 0, #000 ${at}, #000 calc(100% - ${at}), transparent 100%),radial-gradient(at bottom right, ${ot}),radial-gradient(at bottom left, ${ot}), radial-gradient(at top left, ${ot}), radial-gradient(at top right, ${ot})`,ut=`100% calc(100% - ${at} * 2),calc(100% - ${it} * 2) 100%,${it} ${at},${it} ${at},${it} ${at},${it} ${at}`;function ct({children:t,layoutDependency:n}){return e.jsx(M.span,{layout:!0,layoutDependency:n,"aria-hidden":!0,style:{display:"inline-flex","--invert-x":1,margin:`0 calc(-1*${st})`,padding:`calc(${at}/2) ${st}`,position:"relative",zIndex:-1,overflow:"clip",WebkitMaskImage:lt,WebkitMaskSize:ut,WebkitMaskPosition:"center, center, top left, top right, bottom right, bottom left",WebkitMaskRepeat:"no-repeat"},children:t})}function ft(){const e=t.useRef(!0);return t.useEffect(()=>{e.current=!1},[]),e.current}function pt(t){const{width:e,fontSize:n}=getComputedStyle(t);return parseFloat(e)/parseFloat(n)+"em"}S({"--invert-x":{correct:(t,{treeScale:e,projectionDelta:n})=>n.x.scale*e.x}});const dt=new WeakMap,yt=t.forwardRef(function({value:n,initialValue:r=n,...a},s){const{transition:o}=t.useContext(i),l=t.useRef(r).current,u=ft(),c=t.useRef(null),f=t.useRef(null);t.useImperativeHandle(s,()=>f.current,[]);const p=t.useRef(new Array(10)),d=C(),y=d?n:0;t.useLayoutEffect(()=>{c.current&&p.current[l]&&(c.current.style.width=pt(p.current[l]))},[]);const h=t.useRef(r);t.useLayoutEffect(()=>{var t;if(!c.current||y===h.current)return;const e=c.current.getBoundingClientRect(),n=null==(t=f.current)?void 0:t.getBoundingClientRect(),r=e.height*(y-h.current)+(e.top-(n?n.top||0:e.top));return nt(c.current,{y:[r,0]},o),()=>{h.current=y}},[y]);const[m,g]=t.useState();t.useEffect(()=>{if(u&&l===y)return;if(!p.current[y])return;const t=pt(p.current[y]);f.current&&dt.set(f.current,t),g(t)},[y]);const x=t=>e.jsx("span",{style:{display:"inline-block",padding:`calc(${at}/2) 0`},ref:e=>{p.current[t]=e},children:t},t);return e.jsx(M.span,{...a,ref:f,layout:"position","data-state":d?void 0:"exiting",style:{display:"inline-flex",justifyContent:"center",width:m},children:e.jsxs("span",{ref:c,style:{display:"inline-flex",justifyContent:"center",flexDirection:"column",alignItems:"center",position:"relative"},children:[0!==y&&e.jsx("span",{style:{...ht,bottom:"100%",left:0},children:new Array(y).fill(null).map((t,e)=>x(e))}),x(y),9!==y&&e.jsx("span",{style:{...ht,top:"100%",left:0},children:new Array(9-y).fill(null).map((t,e)=>x(y+e+1))})]})})}),ht={display:"flex",flexDirection:"column",alignItems:"center",position:"absolute",width:"100%"},mt=t.createContext({justify:"left"}),gt=t.forwardRef(function({partKey:n,type:r,children:a,layoutDependency:s,...i},o){const l=C(),{justify:u}=t.useContext(mt);return e.jsx(M.span,{...i,"data-state":l?void 0:"exiting",style:{display:"inline-flex",justifyContent:u,padding:`calc(${at}/2) 0`,position:"relative"},layout:"position",layoutDependency:s,ref:o,children:e.jsx(R,{mode:"popLayout",anchorX:u,initial:!1,children:e.jsx(M.span,{layout:"right"===u&&"position",layoutDependency:s,initial:{opacity:0},animate:{opacity:[null,1]},exit:{opacity:[null,0]},style:{display:"inline-block",whiteSpace:"pre"},children:a},a)})})}),xt=t.forwardRef(function({parts:n,justify:r="left",mode:a,style:s,name:i,layoutDependency:o,...l},u){const c=t.useRef(null);t.useImperativeHandle(u,()=>c.current,[]);const f=t.useMemo(()=>({justify:r}),[r]),p=t.useRef(null),d=ft(),[y,h]=t.useState();return t.useEffect(()=>{if(!p.current)return;if(d)return void(c.current&&(c.current.style.width=pt(p.current)));const t=Array.from(p.current.children).map(t=>{if(!(t instanceof HTMLElement))return;if("exiting"===t.dataset.state){const e=t.nextSibling;return t.remove(),()=>{p.current&&p.current.insertBefore(t,e)}}const e=dt.get(t);if(!e)return;const n=t.style.width;return t.style.width=e,()=>{t.style.width=n}});h(pt(p.current));for(let e=t.length-1;e>=0;e--){const n=t[e];n&&n()}},[n.map(t=>t.value).join("")]),e.jsx(mt.Provider,{value:f,children:e.jsx(M.span,{layoutDependency:o,...l,ref:c,className:`number-section-${i}`,style:{...s,display:"inline-flex",justifyContent:r,width:y},children:e.jsxs("span",{ref:p,style:{display:"inline-flex",justifyContent:"inherit",position:"relative"},children:["​",e.jsx(R,{mode:a,anchorX:r,initial:!1,children:n.map(t=>"integer"===t.type||"fraction"===t.type?e.jsx(yt,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},value:t.value,initialValue:d?void 0:0,layoutDependency:o},t.key):e.jsx(gt,{type:t.type,partKey:t.key,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},layoutDependency:o,children:t.value},"literal"===t.type?`${t.key}:${t.value}`:t.key))})]})})})}),vt={opacity:{duration:1,ease:E},layout:{type:"spring",duration:1,bounce:0},y:{type:"spring",duration:1,bounce:0}},jt=t.forwardRef(function({children:n,locales:r,format:a,transition:s,style:o,suffix:l,prefix:u,...c},f){const p=t.useMemo(()=>((t,{locales:e,format:n},r,a)=>{const s=new Intl.NumberFormat(e,n).formatToParts(Number(t));r&&s.unshift({type:"prefix",value:r}),a&&s.push({type:"suffix",value:a});const i=[],o=[],l=[],u=[],c={},f=t=>`${t}:${c[t]=(c[t]??-1)+1}`;let p="",d=!1,y=!1;for(const m of s){p+=m.value;const t="minusSign"===m.type||"plusSign"===m.type?"sign":m.type;switch(t){case"integer":d=!0,o.push(...m.value.split("").map(e=>({type:t,value:parseInt(e)})));break;case"group":o.push({type:t,value:m.value});break;case"decimal":y=!0,l.push({type:t,value:m.value,key:f(t)});break;case"fraction":l.push(...m.value.split("").map(e=>({type:t,value:parseInt(e),key:f(t)})));break;default:(d||y?u:i).push({type:t,value:m.value,key:f(t)})}}const h=[];for(let m=o.length-1;m>=0;m--)h.unshift({...o[m],key:f(o[m].type)});return{pre:i,integer:h,fraction:l,post:u,formatted:p}})(n,{locales:r,format:a},u,l),[n,r,a]),{pre:d,integer:y,fraction:h,post:m,formatted:g}=p,x=t.useContext(i).transition;s=s??x??vt;const{layoutDependency:v}=c,j=t.useMemo(()=>{if(void 0!==v)return{layoutDependency:v,value:n}},[v,n]);return e.jsx(I,{children:e.jsx(B,{transition:s,children:e.jsx(M.div,{...c,ref:f,layout:!0,layoutDependency:j,style:{lineHeight:1,...o,display:"inline-flex",isolation:"isolate",whiteSpace:"nowrap"},children:e.jsxs(M.div,{layout:!0,layoutDependency:j,"aria-label":g,style:{display:"inline-flex",direction:"ltr",isolation:"isolate",position:"relative",zIndex:-1},children:[e.jsx(xt,{style:{padding:`calc(${at}/2) 0`},layoutDependency:j,"aria-hidden":!0,justify:"right",mode:"popLayout",parts:d,name:"pre"}),e.jsxs(ct,{layoutDependency:j,children:[e.jsx(xt,{layoutDependency:j,justify:"right",parts:y,name:"integer"}),e.jsx(xt,{layout:"position",layoutDependency:j,parts:h,name:"fraction"})]}),e.jsx(xt,{style:{padding:`calc(${at}/2) 0`},"aria-hidden":!0,layout:"position",layoutDependency:j,mode:"popLayout",parts:m,name:"post"})]})})})})});function bt(t,e){return t.length>e.length||t.length>0&&!e.startsWith(t)}function wt(t,e,n){return t+(e-t)*n}M.create(t.Fragment);const kt=new Set([".",",","!","?",":",";","'",'"',"-","(",")"]),At=new Set(["!","@","#","$","%","^","&","*","(",")","_","+","{","}","|",":",'"',"<",">","?"]);const $t={slow:130,normal:75,fast:30};t.forwardRef(function({children:n="",as:r,speed:a="normal",variance:s="natural",cursorClassName:u="motion-typewriter-cursor",cursorStyle:c,cursorBlinkDuration:f=.5,onComplete:p,play:d=!0,"aria-label":y,textClassName:h,textStyle:m,replace:g="type",backspace:x="character",backspaceFactor:v=.2,...j},b){const w=r||"span",k=t.useRef(n),A=function(){const e=o(()=>l("")),{isStatic:n}=t.useContext(i);if(n){const[,n]=t.useState("");t.useEffect(()=>e.on("change",n),[])}return e}(),$=t.useRef(null),D=t.useRef(null),S=t.useRef(null),C="number"==typeof a?a:$t[a],R=()=>{var t;null==(t=$.current)||t.call($),$.current=null},I=()=>{D.current=nt(S.current,{opacity:[1,1,0,0]},{duration:f,times:[0,.5,.5,1],ease:"linear",repeat:1/0,repeatType:"reverse"})};return t.useEffect(()=>{"all"===g&&n!==k.current&&A.set(""),k.current=n},[n,g]),t.useEffect(()=>{var t;if(!d)return I(),void R();null==(t=D.current)||t.cancel();const e=()=>{const t=function(t,e,n,r){if("type"===n&&bt(t,e)){if("all"===r)return e.slice(0,function(t,e){const n=Math.min(t.length,e.length);let r=0;for(let a=0;a=0&&/\s/.test(t[n]);)n--;for(;n>=0&&!/\s/.test(t[n]);)n--;return Math.max(0,n+1)}(t,t.length);return t.slice(0,e)}return t.slice(0,-1)}return e.slice(0,t.length+1)}(A.get(),n,g,x);A.set(t),t!==n?r():(I(),null==p||p())},r=()=>{$.current=F(e,function(t,e,n,r,a){if(bt(e,t))return n*a;if("natural"===r)return function(t,e,n){const r=e.length,a=t[r],s=t[r-1];if(!a)return n;const i=t.slice(0,r).lastIndexOf(" "),o=r-i-1,l=i+1,u=t.slice(r).indexOf(" "),c=(-1===u?t.length:r+u)-l;let f=1;s&&/[.!?]/.test(s)&&" "===a&&(f*=3),c<=3?f*=.7:(0===o&&" "!==a&&(f*=1.5),o===c-1&&(f*=1.4)),o>0&&o3&&(f*=1-Math.min(o/c,.4)),kt.has(a)&&(f*=1.5),At.has(a)&&(f*=1.5),/\d/.test(a)&&(f*=1.3),c>8&&(f*=1.3),a!==a.toLowerCase()&&(f*=1.25),r>200&&(f*=1+Math.min((r-200)/1e3,.3)),f*=1+wt(-.25,.25,Math.random());const p=n*f;return Math.max(.2*n,p)}(t,e,n);if("number"==typeof r&&r>0){const t=n*(r/100);return n+wt(-t,t,Math.random())}return n}(n,A.get(),C,s,v))};return $.current||r(),R},[d,p,n,C,s,v,x]),e.jsxs(w,{ref:b,...j,"aria-label":y||n,children:[e.jsx(M.span,{className:h,style:m,children:A}),e.jsx(M.span,{ref:S,className:u,style:{display:"inline-block",width:"2px",height:"1em",backgroundColor:"currentColor",position:"relative",top:"0.1em",left:"0.2em",...c}})]})});export{jt as A}; diff --git a/frontend/dist/assets/key-round-D0AtlMOx.js b/frontend/dist/assets/key-round-0eVrrV09.js similarity index 81% rename from frontend/dist/assets/key-round-D0AtlMOx.js rename to frontend/dist/assets/key-round-0eVrrV09.js index 96ae85e0..2e3fc6d2 100644 --- a/frontend/dist/assets/key-round-D0AtlMOx.js +++ b/frontend/dist/assets/key-round-0eVrrV09.js @@ -1 +1 @@ -import{c as a}from"./index-01Tx8g53.js";const r=a("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);export{r as K}; +import{c as a}from"./index-BBcIGlRT.js";const r=a("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);export{r as K}; diff --git a/frontend/dist/assets/layers-BNjfohkH.js b/frontend/dist/assets/layers-BSSTaBST.js similarity index 84% rename from frontend/dist/assets/layers-BNjfohkH.js rename to frontend/dist/assets/layers-BSSTaBST.js index 991e1806..27ae6dfa 100644 --- a/frontend/dist/assets/layers-BNjfohkH.js +++ b/frontend/dist/assets/layers-BSSTaBST.js @@ -1 +1 @@ -import{c as a}from"./index-01Tx8g53.js";const l=a("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);export{l as L}; +import{c as a}from"./index-BBcIGlRT.js";const l=a("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);export{l as L}; diff --git a/frontend/dist/assets/link-scoring-LTbqUxGC.js b/frontend/dist/assets/link-scoring-BHmEi4Ug.js similarity index 94% rename from frontend/dist/assets/link-scoring-LTbqUxGC.js rename to frontend/dist/assets/link-scoring-BHmEi4Ug.js index b1ea0514..2fbd09e5 100644 --- a/frontend/dist/assets/link-scoring-LTbqUxGC.js +++ b/frontend/dist/assets/link-scoring-BHmEi4Ug.js @@ -1 +1 @@ -import{G as t,be as e,bk as n}from"./index-01Tx8g53.js";function o(t){if(Array.isArray(t))return t;if("string"==typeof t&&t.startsWith("["))try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}return[]}function r(n,r,s){const a=new Map;for(const e of r){const n=t(e);a.has(n)||a.set(n,e)}const c=new Map,i=new Map;for(const t of n){const n=t.route??t.route_type;if(!e(n))continue;const r=o(t.original_path);if(0===r.length)continue;const f=r.map(t=>t.toUpperCase());if(!t.transmitted&&f.length>=2){const t=f[f.length-2];if(t){const e=a.get(t);e&&i.set(e,(i.get(e)??0)+1)}}if(f.includes(s))for(const t of f){if(t===s)continue;const e=a.get(t);e&&c.set(e,(c.get(e)??0)+1)}}let f=0,u=0;for(const t of r)f=Math.max(f,c.get(t)??0),u=Math.max(u,i.get(t)??0);const h=new Map;let g=0,d=0,l=0;for(const t of r){const e=c.get(t)??0,n=i.get(t)??0,o=f>0?Math.round(e/f*100):0,r=u>0?Math.round(n/u*100):0,s=o+r;h.set(t,{hash:t,listenerCount:e,loudCount:n,listenerScore:o,loudScore:r,blendedScore:s}),g=Math.max(g,o),d=Math.max(d,r),l=Math.max(l,s)}return{scores:h,maxListenerScore:g,maxLoudScore:d,maxBlendedScore:l}}const s={YELLOW:n.amber,GREEN:n.green,RED:n.red,GRAY:"#505050"};export{s as L,r as c}; +import{G as t,be as e,bk as n}from"./index-BBcIGlRT.js";function o(t){if(Array.isArray(t))return t;if("string"==typeof t&&t.startsWith("["))try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}return[]}function r(n,r,s){const a=new Map;for(const e of r){const n=t(e);a.has(n)||a.set(n,e)}const c=new Map,i=new Map;for(const t of n){const n=t.route??t.route_type;if(!e(n))continue;const r=o(t.original_path);if(0===r.length)continue;const f=r.map(t=>t.toUpperCase());if(!t.transmitted&&f.length>=2){const t=f[f.length-2];if(t){const e=a.get(t);e&&i.set(e,(i.get(e)??0)+1)}}if(f.includes(s))for(const t of f){if(t===s)continue;const e=a.get(t);e&&c.set(e,(c.get(e)??0)+1)}}let f=0,u=0;for(const t of r)f=Math.max(f,c.get(t)??0),u=Math.max(u,i.get(t)??0);const h=new Map;let g=0,d=0,l=0;for(const t of r){const e=c.get(t)??0,n=i.get(t)??0,o=f>0?Math.round(e/f*100):0,r=u>0?Math.round(n/u*100):0,s=o+r;h.set(t,{hash:t,listenerCount:e,loudCount:n,listenerScore:o,loudScore:r,blendedScore:s}),g=Math.max(g,o),d=Math.max(d,r),l=Math.max(l,s)}return{scores:h,maxListenerScore:g,maxLoudScore:d,maxBlendedScore:l}}const s={YELLOW:n.amber,GREEN:n.green,RED:n.red,GRAY:"#505050"};export{s as L,r as c}; diff --git a/frontend/dist/assets/listbox-D30S1eZ7.js b/frontend/dist/assets/listbox-BsuBKhOY.js similarity index 96% rename from frontend/dist/assets/listbox-D30S1eZ7.js rename to frontend/dist/assets/listbox-BsuBKhOY.js index bf3feade..b09b9cec 100644 --- a/frontend/dist/assets/listbox-D30S1eZ7.js +++ b/frontend/dist/assets/listbox-BsuBKhOY.js @@ -1 +1 @@ -import{j as e,l as a,c as s,n as t,o as r,p as l,I as n,r as i}from"./vendor-react-j_fHog8x.js";import{Y as o,A as c,m as d,ba as u,o as m}from"./index-01Tx8g53.js";function x({value:n,onChange:i,className:m,placeholder:x,disabled:p,"aria-label":b,children:h}){return e.jsx(a,{value:n,onChange:i,disabled:p,children:({open:a})=>e.jsxs("div",{className:s("relative",m),children:[e.jsxs(t,{"aria-label":b,className:s(["relative flex w-full items-center justify-between gap-2","radius-inner px-3 py-2","text-left text-sm text-fg-primary","bg-input-bg border border-input-border","ring-focus-inset","hover:border-edge-strong","disabled:opacity-40 disabled:pointer-events-none disabled:cursor-not-allowed","transition-colors"]),children:[e.jsx(r,{as:"span",options:h,placeholder:x&&e.jsx("span",{className:"text-fg-muted",children:x}),className:"block truncate"}),e.jsx(o,{className:s("w-4 h-4 text-fg-muted transition-transform duration-200",a&&"rotate-180")})]}),e.jsx(c,{children:a&&e.jsx(d.div,{initial:{opacity:0,y:-4,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.98},transition:u.dropdown,className:"absolute z-50 mt-1",children:e.jsx(l,{static:!0,anchor:"bottom start",className:s(["w-[var(--button-width)] min-w-[180px]","max-h-60 overflow-y-auto overscroll-contain scroll-py-1","radius-inset p-1","surface-elevated","focus:outline-none"]),children:h})})})]})})}function p({value:a,disabled:t,className:r,children:l}){return e.jsx(n,{as:i.Fragment,value:a,disabled:t,children:({selected:a,focus:n})=>e.jsxs("div",{className:s("flex items-center gap-2 px-3 py-2 radius-control cursor-default","text-sm",n&&"bg-sys-blue text-white",!n&&"text-fg-primary",a&&!n&&"text-sys-blue",t&&"opacity-50 cursor-not-allowed",r),children:[e.jsx("span",{className:"w-4 flex-shrink-0",children:a&&e.jsx(m,{className:"w-4 h-4"})}),e.jsx("span",{className:"truncate",children:l})]})})}function b({className:a,...t}){return e.jsx("span",{...t,className:s("truncate",a)})}export{x as L,p as a,b}; +import{j as e,l as a,c as s,n as t,o as r,p as l,I as n,r as i}from"./vendor-react-j_fHog8x.js";import{Y as o,A as c,m as d,ba as u,o as m}from"./index-BBcIGlRT.js";function x({value:n,onChange:i,className:m,placeholder:x,disabled:p,"aria-label":b,children:h}){return e.jsx(a,{value:n,onChange:i,disabled:p,children:({open:a})=>e.jsxs("div",{className:s("relative",m),children:[e.jsxs(t,{"aria-label":b,className:s(["relative flex w-full items-center justify-between gap-2","radius-inner px-3 py-2","text-left text-sm text-fg-primary","bg-input-bg border border-input-border","ring-focus-inset","hover:border-edge-strong","disabled:opacity-40 disabled:pointer-events-none disabled:cursor-not-allowed","transition-colors"]),children:[e.jsx(r,{as:"span",options:h,placeholder:x&&e.jsx("span",{className:"text-fg-muted",children:x}),className:"block truncate"}),e.jsx(o,{className:s("w-4 h-4 text-fg-muted transition-transform duration-200",a&&"rotate-180")})]}),e.jsx(c,{children:a&&e.jsx(d.div,{initial:{opacity:0,y:-4,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.98},transition:u.dropdown,className:"absolute z-50 mt-1",children:e.jsx(l,{static:!0,anchor:"bottom start",className:s(["w-[var(--button-width)] min-w-[180px]","max-h-60 overflow-y-auto overscroll-contain scroll-py-1","radius-inset p-1","surface-elevated","focus:outline-none"]),children:h})})})]})})}function p({value:a,disabled:t,className:r,children:l}){return e.jsx(n,{as:i.Fragment,value:a,disabled:t,children:({selected:a,focus:n})=>e.jsxs("div",{className:s("flex items-center gap-2 px-3 py-2 radius-control cursor-default","text-sm",n&&"bg-sys-blue text-white",!n&&"text-fg-primary",a&&!n&&"text-sys-blue",t&&"opacity-50 cursor-not-allowed",r),children:[e.jsx("span",{className:"w-4 flex-shrink-0",children:a&&e.jsx(m,{className:"w-4 h-4"})}),e.jsx("span",{className:"truncate",children:l})]})})}function b({className:a,...t}){return e.jsx("span",{...t,className:s("truncate",a)})}export{x as L,p as a,b}; diff --git a/frontend/dist/assets/map-pin-DZIYgupP.js b/frontend/dist/assets/map-pin-FZNiPp_L.js similarity index 74% rename from frontend/dist/assets/map-pin-DZIYgupP.js rename to frontend/dist/assets/map-pin-FZNiPp_L.js index 334816e5..9a1bb767 100644 --- a/frontend/dist/assets/map-pin-DZIYgupP.js +++ b/frontend/dist/assets/map-pin-FZNiPp_L.js @@ -1 +1 @@ -import{c}from"./index-01Tx8g53.js";const r=c("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);export{r as M}; +import{c}from"./index-BBcIGlRT.js";const r=c("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);export{r as M}; diff --git a/frontend/dist/assets/message-square-B0UfZczh.js b/frontend/dist/assets/message-square-Dq5-N0aR.js similarity index 72% rename from frontend/dist/assets/message-square-B0UfZczh.js rename to frontend/dist/assets/message-square-Dq5-N0aR.js index 8ca926be..7a7d4f04 100644 --- a/frontend/dist/assets/message-square-B0UfZczh.js +++ b/frontend/dist/assets/message-square-Dq5-N0aR.js @@ -1 +1 @@ -import{c as a}from"./index-01Tx8g53.js";const s=a("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);export{s as M}; +import{c as a}from"./index-BBcIGlRT.js";const s=a("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);export{s as M}; diff --git a/frontend/dist/assets/network-CCjpHq5M.js b/frontend/dist/assets/network-C6ho6RSo.js similarity index 83% rename from frontend/dist/assets/network-CCjpHq5M.js rename to frontend/dist/assets/network-C6ho6RSo.js index 4beb372e..631ab46f 100644 --- a/frontend/dist/assets/network-CCjpHq5M.js +++ b/frontend/dist/assets/network-C6ho6RSo.js @@ -1 +1 @@ -import{c as e}from"./index-01Tx8g53.js";const t=e("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);export{t as N}; +import{c as e}from"./index-BBcIGlRT.js";const t=e("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);export{t as N}; diff --git a/frontend/dist/assets/node-types-BT5BImck.js b/frontend/dist/assets/node-types-CuQMppbD.js similarity index 96% rename from frontend/dist/assets/node-types-BT5BImck.js rename to frontend/dist/assets/node-types-CuQMppbD.js index eda4bc1a..5da4d5d2 100644 --- a/frontend/dist/assets/node-types-BT5BImck.js +++ b/frontend/dist/assets/node-types-CuQMppbD.js @@ -1 +1 @@ -import{c as e,az as r}from"./index-01Tx8g53.js";const n=e("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);function o(e){var r;const n=(null==(r=e.contact_type)?void 0:r.toLowerCase())??"";return"room server"===n||"room_server"===n||"room"===n||"server"===n?{type:"room_server",isRepeater:!0===e.is_repeater,isCompanion:!1,isRoomServer:!0,isClient:!1,label:"Room Server",badgeText:"ROOM"}:"companion"===n?{type:"companion",isRepeater:!1,isCompanion:!0,isRoomServer:!1,isClient:!1,label:"Companion",badgeText:"COMP"}:"client"===n||"cli"===n?{type:"companion",isRepeater:!1,isCompanion:!1,isRoomServer:!1,isClient:!0,label:"Client",badgeText:"CLI"}:"repeater"===n||"rep"===n||!0===e.is_repeater?{type:"repeater",isRepeater:!0,isCompanion:!1,isRoomServer:!1,isClient:!1,label:"Repeater",badgeText:"RPT"}:{type:"unknown",isRepeater:!1,isCompanion:!1,isRoomServer:!1,isClient:!1,label:"Unknown",badgeText:""}}function t(e,r){const n=o({});if(!e||!r)return{name:null,nodeType:n};const t=e.startsWith("0x")?e.slice(2):e;for(const[a,s]of Object.entries(r))if((a.startsWith("0x")?a.slice(2):a).toLowerCase().startsWith(t.toLowerCase()))return{name:s.name||s.node_name||null,nodeType:o(s)};return{name:null,nodeType:n}}function a(e){switch(e){case r.GRP_TXT:case r.TXT_MSG:case r.REQ:case r.ANON_REQ:return"companion";case r.TRACE:case r.PATH:return"repeater";case r.GRP_DATA:return"room_server";default:return"unknown"}}function s(e){switch(e){case"chat":return"companion";case"repeater":return"repeater";case"room_server":return"room_server";default:return"unknown"}}export{n as C,o as c,t as g,a as i,s as m}; +import{c as e,az as r}from"./index-BBcIGlRT.js";const n=e("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);function o(e){var r;const n=(null==(r=e.contact_type)?void 0:r.toLowerCase())??"";return"room server"===n||"room_server"===n||"room"===n||"server"===n?{type:"room_server",isRepeater:!0===e.is_repeater,isCompanion:!1,isRoomServer:!0,isClient:!1,label:"Room Server",badgeText:"ROOM"}:"companion"===n?{type:"companion",isRepeater:!1,isCompanion:!0,isRoomServer:!1,isClient:!1,label:"Companion",badgeText:"COMP"}:"client"===n||"cli"===n?{type:"companion",isRepeater:!1,isCompanion:!1,isRoomServer:!1,isClient:!0,label:"Client",badgeText:"CLI"}:"repeater"===n||"rep"===n||!0===e.is_repeater?{type:"repeater",isRepeater:!0,isCompanion:!1,isRoomServer:!1,isClient:!1,label:"Repeater",badgeText:"RPT"}:{type:"unknown",isRepeater:!1,isCompanion:!1,isRoomServer:!1,isClient:!1,label:"Unknown",badgeText:""}}function t(e,r){const n=o({});if(!e||!r)return{name:null,nodeType:n};const t=e.startsWith("0x")?e.slice(2):e;for(const[a,s]of Object.entries(r))if((a.startsWith("0x")?a.slice(2):a).toLowerCase().startsWith(t.toLowerCase()))return{name:s.name||s.node_name||null,nodeType:o(s)};return{name:null,nodeType:n}}function a(e){switch(e){case r.GRP_TXT:case r.TXT_MSG:case r.REQ:case r.ANON_REQ:return"companion";case r.TRACE:case r.PATH:return"repeater";case r.GRP_DATA:return"room_server";default:return"unknown"}}function s(e){switch(e){case"chat":return"companion";case"repeater":return"repeater";case"room_server":return"room_server";default:return"unknown"}}export{n as C,o as c,t as g,a as i,s as m}; diff --git a/frontend/dist/assets/payload-decoders-XckZ5vyB.js b/frontend/dist/assets/payload-decoders-C74LtYDG.js similarity index 98% rename from frontend/dist/assets/payload-decoders-XckZ5vyB.js rename to frontend/dist/assets/payload-decoders-C74LtYDG.js index ef9076bc..364caf4b 100644 --- a/frontend/dist/assets/payload-decoders-XckZ5vyB.js +++ b/frontend/dist/assets/payload-decoders-C74LtYDG.js @@ -1 +1 @@ -var t=Object.defineProperty,e=(e,a,s)=>((e,a,s)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[a]=s)(e,"symbol"!=typeof a?a+"":a,s);import{ac as a,bZ as s,b_ as r,b$ as n,c0 as h,al as i,c1 as c,c2 as o,c3 as p,c4 as l,c5 as u,c6 as d,c7 as y,bN as g,c8 as f,c9 as m,ca as x,cb as T,cc as C,cd as H,ce as w,cf as N,cg as S,ch as L,ci as b,cj as A,ck as $,cl as _,cm as F,cn as U,co as D,cp as V,cq as k,cr as v,cs as B,ct as E,cu as j,cv as P,cw as O,cx as I,cy as K,cz as M,cA as R,cB as W,cC as q,cD as z,cE as G,cF as Z,cG as J,cH as Q}from"./index-01Tx8g53.js";class X{constructor(){e(this,"header",0),e(this,"transportCodes",[0,0]),e(this,"pathLen",0),e(this,"path",new Uint8Array(0)),e(this,"payload",new Uint8Array(0)),e(this,"decrypted",{}),e(this,"_rssi",0),e(this,"_snr",0)}static fromBytes(t){const e=new X;try{return e.readFrom(t),{success:!0,packet:e}}catch(a){return{success:!1,error:a instanceof Error?a.message:String(a)}}}static fromHex(t){try{const e=a(t);return X.fromBytes(e)}catch(e){return{success:!1,error:e instanceof Error?e.message:String(e)}}}get routeType(){return this.header&s}get routeTypeName(){return r[this.routeType]??`UNKNOWN(${this.routeType})`}get payloadType(){return this.header>>n&h}get payloadTypeName(){return i[this.payloadType]??`UNKNOWN(${this.payloadType})`}get payloadVersion(){return this.header>>c&o}hasTransportCodes(){return p(this.routeType)}isFlood(){return l(this.routeType)}isDirect(){return u(this.routeType)}get pathBytes(){return Array.from(this.path)}get pathString(){return d(this.path)}get pathHexArray(){return Array.from(this.path).map(t=>y(t,!0))}get payloadLen(){return this.payload.length}get payloadHex(){return g(this.payload,!0)}getPayloadAppData(){const t=L+b+A;return this.payload.length>=t?this.payload.slice(t):new Uint8Array(0)}get rssi(){return this._rssi}set rssi(t){this._rssi=t}get snr(){return this._snr}set snr(t){this._snr=t}readFrom(t){let e=0;const a=t.length;f(e,1,a,"Missing header byte"),this.header=t[e++];const s=this.payloadVersion;if(s>m)throw new Error(`Unsupported packet version: ${s}`);if(this.hasTransportCodes()?(f(e,4,a,"Missing transport codes"),this.transportCodes=[x(t,e),x(t,e+2)],e+=4):this.transportCodes=[0,0],f(e,1,a,"Missing path_len"),this.pathLen=t[e++],this.pathLen>T)throw new Error(`path_len too large: ${this.pathLen} > ${T}`);return f(e,this.pathLen,a,"Truncated path"),this.path=t.slice(e,e+this.pathLen),e+=this.pathLen,this.payload=t.slice(e),C(this.payload.length),!0}writeTo(){let t=1;this.hasTransportCodes()&&(t+=4),t+=1,t+=this.path.length,t+=this.payload.length;const e=new Uint8Array(t);let a=0;return e[a++]=this.header,this.hasTransportCodes()&&(H(this.transportCodes[0],e,a),H(this.transportCodes[1],e,a+2),a+=4),e[a++]=this.path.length,e.set(this.path,a),a+=this.path.length,e.set(this.payload,a),e}toHex(){return g(this.writeTo(),!0)}async calculateHash(){return w(this.payloadType,this.pathLen,this.payload)}async calculateHashString(t){return N(this.payloadType,this.pathLen,this.payload,t)}async calculateCRC(){return S(this.payloadType,this.pathLen,this.payload)}getRawLength(){let t=2+this.pathLen+this.payload.length;return this.hasTransportCodes()&&(t+=4),t}getSummary(){return{header:y(this.header,!0),routeType:this.routeTypeName,payloadType:this.payloadTypeName,version:this.payloadVersion,pathLen:this.pathLen,pathStr:this.pathString,transportCodes:this.hasTransportCodes()?[this.transportCodes[0].toString(16).toUpperCase().padStart(4,"0"),this.transportCodes[1].toString(16).toUpperCase().padStart(4,"0")]:null,payloadLen:this.payload.length,payloadHex:this.payloadHex,rawLength:this.getRawLength()}}toString(){const t=[`[${this.routeTypeName}/${this.payloadTypeName} v${this.payloadVersion}]`,`path=${this.pathString||"(empty)"}`,`payload=${this.payload.length}B`];return this.hasTransportCodes()&&t.push(`transport=[${this.transportCodes[0]},${this.transportCodes[1]}]`),t.join(" ")}}function Y(t){const e=L+b+A+1;if(t.lengtha&&(o.name=(new TextDecoder).decode(t.slice(a,e)))}return o}function tt(t,e){const a=function(t){if(t.length<9)return{type:"trace",traceTag:"00000000",traceTagValue:0,authCode:0,flags:0,pathHashes:[],pathString:"",snrValues:[],isComplete:!1,path:[],targetHash:""};const e=$(t,0),a=e.toString(16).toUpperCase().padStart(8,"0"),s=$(t,4),r=t[8],n=t.slice(9),h=Array.from(n).map(t=>y(t,!0)),i=h.join("->");return{type:"trace",traceTag:a,traceTagValue:e,authCode:s,flags:r,pathHashes:h,pathString:i,snrValues:[],isComplete:!1,path:h,targetHash:h.length>0?h[0]:""}}(t);if(!a)return null;const s=[],r=e instanceof Uint8Array?Array.from(e):e;for(let h=0;h127&&(t-=256),s.push(t/4)}const n=s.length>=a.pathHashes.length;return{...a,snrValues:s,isComplete:n}}function et(t){if(t.length<2)return null;const e=y(t[0],!0),a=y(t[1],!0),s=t.slice(2);let r="",n=!0;try{const t=new TextDecoder("utf-8",{fatal:!0}).decode(s);/^[\x20-\x7E\u00A0-\uFFFF\n\r\t]*$/.test(t)&&(r=t,n=!1)}catch{}return n&&(r=g(s)),{type:"txt_msg",destHash:e,srcHash:a,timestamp:0,text:r,encrypted:n}}async function at(t){if(t.length<4)return null;const e=t[0],a=y(e,!0),s=t.slice(1,3),r=t.slice(3),n={type:"grp_txt",channelHash:a,text:g(r),decrypted:!1,ciphertextHex:g(r),macHex:g(s)};try{const t=await D(e,s,r);if(t&&t.plaintext.length>=5){n.channelName=t.channelName;const e=t.plaintext,a=$(e,0),s=e[4],r=new TextDecoder("utf-8",{fatal:!1}).decode(e.slice(5)).replace(/\uFFFD/g,"").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/g,"").replace(/\x00+$/,"").trim();n.decrypted=!0,n.isPublicHashChannel=!0,n.timestamp=a,n.flags=s,t.macCorrupted&&(n.macCorrupted=!0);const h=r.indexOf(": ");h>0?(n.senderName=r.slice(0,h),n.text=r.slice(h+2)):n.text=r}else{const t=await V(e);n.isPublicHashChannel=t.length>0}}catch{}return n}async function st(t){if(t.length<4)return null;const e=t[0],a=y(e,!0),s=t.slice(1,3),r=t.slice(3),n={type:"grp_data",channelHash:a,dataHex:g(r),dataLength:r.length,decrypted:!1,macHex:g(s)};try{const t=await D(e,s,r);t&&(n.channelName=t.channelName,n.decrypted=!0,n.decryptedHex=g(t.plaintext))}catch{}return n}function rt(t,e,a){return{type:"generic",payloadType:e,payloadTypeName:a,rawHex:g(t),length:t.length}}function nt(t){const{payload:e,payloadType:a,payloadTypeName:s}=t;switch(a){case q:return Y(e)??rt(e,a,s);case W:return function(t){if(t.length<4)return null;const e=$(t,0);return{type:"ack",crc:e.toString(16).toUpperCase().padStart(8,"0"),crcValue:e}}(e)??rt(e,a,s);case R:return function(t){if(0===t.length)return{type:"path",path:[],pathString:""};const e=Array.from(t).map(t=>y(t,!0)),a=e.join("->");return{type:"path",path:e,pathString:a}}(e)??rt(e,a,s);case M:return tt(e,t.path)??rt(e,a,s);case K:return et(e)??rt(e,a,s);case I:return function(t){if(t.length<4)return null;const e=t[0],a=y(e,!0),s=t.slice(1,3),r=t.slice(3);return{type:"grp_txt",channelHash:a,text:g(r),decrypted:!1,ciphertextHex:g(r),macHex:g(s)}}(e)??rt(e,a,s);case O:return function(t){if(t.length<4)return null;const e=t[0],a=y(e,!0),s=t.slice(1,3),r=t.slice(3);return{type:"grp_data",channelHash:a,dataHex:g(r),dataLength:r.length,decrypted:!1,macHex:g(s)}}(e)??rt(e,a,s);case P:return function(t){return t.length<4?null:{type:"multipart",messageId:g(t.slice(0,2)),partNumber:t[2],totalParts:t[3],partData:g(t.slice(4))}}(e)??rt(e,a,s);default:return rt(e,a,s)}}export{X as P,tt as a,et as b,at as c,nt as d,st as e,Y as f}; +var t=Object.defineProperty,e=(e,a,s)=>((e,a,s)=>a in e?t(e,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[a]=s)(e,"symbol"!=typeof a?a+"":a,s);import{ac as a,bZ as s,b_ as r,b$ as n,c0 as h,al as i,c1 as c,c2 as o,c3 as p,c4 as l,c5 as u,c6 as d,c7 as y,bN as g,c8 as f,c9 as m,ca as x,cb as T,cc as C,cd as H,ce as w,cf as N,cg as S,ch as L,ci as b,cj as A,ck as $,cl as _,cm as F,cn as U,co as D,cp as V,cq as k,cr as v,cs as B,ct as E,cu as j,cv as P,cw as O,cx as I,cy as K,cz as M,cA as R,cB as W,cC as q,cD as z,cE as G,cF as Z,cG as J,cH as Q}from"./index-BBcIGlRT.js";class X{constructor(){e(this,"header",0),e(this,"transportCodes",[0,0]),e(this,"pathLen",0),e(this,"path",new Uint8Array(0)),e(this,"payload",new Uint8Array(0)),e(this,"decrypted",{}),e(this,"_rssi",0),e(this,"_snr",0)}static fromBytes(t){const e=new X;try{return e.readFrom(t),{success:!0,packet:e}}catch(a){return{success:!1,error:a instanceof Error?a.message:String(a)}}}static fromHex(t){try{const e=a(t);return X.fromBytes(e)}catch(e){return{success:!1,error:e instanceof Error?e.message:String(e)}}}get routeType(){return this.header&s}get routeTypeName(){return r[this.routeType]??`UNKNOWN(${this.routeType})`}get payloadType(){return this.header>>n&h}get payloadTypeName(){return i[this.payloadType]??`UNKNOWN(${this.payloadType})`}get payloadVersion(){return this.header>>c&o}hasTransportCodes(){return p(this.routeType)}isFlood(){return l(this.routeType)}isDirect(){return u(this.routeType)}get pathBytes(){return Array.from(this.path)}get pathString(){return d(this.path)}get pathHexArray(){return Array.from(this.path).map(t=>y(t,!0))}get payloadLen(){return this.payload.length}get payloadHex(){return g(this.payload,!0)}getPayloadAppData(){const t=L+b+A;return this.payload.length>=t?this.payload.slice(t):new Uint8Array(0)}get rssi(){return this._rssi}set rssi(t){this._rssi=t}get snr(){return this._snr}set snr(t){this._snr=t}readFrom(t){let e=0;const a=t.length;f(e,1,a,"Missing header byte"),this.header=t[e++];const s=this.payloadVersion;if(s>m)throw new Error(`Unsupported packet version: ${s}`);if(this.hasTransportCodes()?(f(e,4,a,"Missing transport codes"),this.transportCodes=[x(t,e),x(t,e+2)],e+=4):this.transportCodes=[0,0],f(e,1,a,"Missing path_len"),this.pathLen=t[e++],this.pathLen>T)throw new Error(`path_len too large: ${this.pathLen} > ${T}`);return f(e,this.pathLen,a,"Truncated path"),this.path=t.slice(e,e+this.pathLen),e+=this.pathLen,this.payload=t.slice(e),C(this.payload.length),!0}writeTo(){let t=1;this.hasTransportCodes()&&(t+=4),t+=1,t+=this.path.length,t+=this.payload.length;const e=new Uint8Array(t);let a=0;return e[a++]=this.header,this.hasTransportCodes()&&(H(this.transportCodes[0],e,a),H(this.transportCodes[1],e,a+2),a+=4),e[a++]=this.path.length,e.set(this.path,a),a+=this.path.length,e.set(this.payload,a),e}toHex(){return g(this.writeTo(),!0)}async calculateHash(){return w(this.payloadType,this.pathLen,this.payload)}async calculateHashString(t){return N(this.payloadType,this.pathLen,this.payload,t)}async calculateCRC(){return S(this.payloadType,this.pathLen,this.payload)}getRawLength(){let t=2+this.pathLen+this.payload.length;return this.hasTransportCodes()&&(t+=4),t}getSummary(){return{header:y(this.header,!0),routeType:this.routeTypeName,payloadType:this.payloadTypeName,version:this.payloadVersion,pathLen:this.pathLen,pathStr:this.pathString,transportCodes:this.hasTransportCodes()?[this.transportCodes[0].toString(16).toUpperCase().padStart(4,"0"),this.transportCodes[1].toString(16).toUpperCase().padStart(4,"0")]:null,payloadLen:this.payload.length,payloadHex:this.payloadHex,rawLength:this.getRawLength()}}toString(){const t=[`[${this.routeTypeName}/${this.payloadTypeName} v${this.payloadVersion}]`,`path=${this.pathString||"(empty)"}`,`payload=${this.payload.length}B`];return this.hasTransportCodes()&&t.push(`transport=[${this.transportCodes[0]},${this.transportCodes[1]}]`),t.join(" ")}}function Y(t){const e=L+b+A+1;if(t.lengtha&&(o.name=(new TextDecoder).decode(t.slice(a,e)))}return o}function tt(t,e){const a=function(t){if(t.length<9)return{type:"trace",traceTag:"00000000",traceTagValue:0,authCode:0,flags:0,pathHashes:[],pathString:"",snrValues:[],isComplete:!1,path:[],targetHash:""};const e=$(t,0),a=e.toString(16).toUpperCase().padStart(8,"0"),s=$(t,4),r=t[8],n=t.slice(9),h=Array.from(n).map(t=>y(t,!0)),i=h.join("->");return{type:"trace",traceTag:a,traceTagValue:e,authCode:s,flags:r,pathHashes:h,pathString:i,snrValues:[],isComplete:!1,path:h,targetHash:h.length>0?h[0]:""}}(t);if(!a)return null;const s=[],r=e instanceof Uint8Array?Array.from(e):e;for(let h=0;h127&&(t-=256),s.push(t/4)}const n=s.length>=a.pathHashes.length;return{...a,snrValues:s,isComplete:n}}function et(t){if(t.length<2)return null;const e=y(t[0],!0),a=y(t[1],!0),s=t.slice(2);let r="",n=!0;try{const t=new TextDecoder("utf-8",{fatal:!0}).decode(s);/^[\x20-\x7E\u00A0-\uFFFF\n\r\t]*$/.test(t)&&(r=t,n=!1)}catch{}return n&&(r=g(s)),{type:"txt_msg",destHash:e,srcHash:a,timestamp:0,text:r,encrypted:n}}async function at(t){if(t.length<4)return null;const e=t[0],a=y(e,!0),s=t.slice(1,3),r=t.slice(3),n={type:"grp_txt",channelHash:a,text:g(r),decrypted:!1,ciphertextHex:g(r),macHex:g(s)};try{const t=await D(e,s,r);if(t&&t.plaintext.length>=5){n.channelName=t.channelName;const e=t.plaintext,a=$(e,0),s=e[4],r=new TextDecoder("utf-8",{fatal:!1}).decode(e.slice(5)).replace(/\uFFFD/g,"").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/g,"").replace(/\x00+$/,"").trim();n.decrypted=!0,n.isPublicHashChannel=!0,n.timestamp=a,n.flags=s,t.macCorrupted&&(n.macCorrupted=!0);const h=r.indexOf(": ");h>0?(n.senderName=r.slice(0,h),n.text=r.slice(h+2)):n.text=r}else{const t=await V(e);n.isPublicHashChannel=t.length>0}}catch{}return n}async function st(t){if(t.length<4)return null;const e=t[0],a=y(e,!0),s=t.slice(1,3),r=t.slice(3),n={type:"grp_data",channelHash:a,dataHex:g(r),dataLength:r.length,decrypted:!1,macHex:g(s)};try{const t=await D(e,s,r);t&&(n.channelName=t.channelName,n.decrypted=!0,n.decryptedHex=g(t.plaintext))}catch{}return n}function rt(t,e,a){return{type:"generic",payloadType:e,payloadTypeName:a,rawHex:g(t),length:t.length}}function nt(t){const{payload:e,payloadType:a,payloadTypeName:s}=t;switch(a){case q:return Y(e)??rt(e,a,s);case W:return function(t){if(t.length<4)return null;const e=$(t,0);return{type:"ack",crc:e.toString(16).toUpperCase().padStart(8,"0"),crcValue:e}}(e)??rt(e,a,s);case R:return function(t){if(0===t.length)return{type:"path",path:[],pathString:""};const e=Array.from(t).map(t=>y(t,!0)),a=e.join("->");return{type:"path",path:e,pathString:a}}(e)??rt(e,a,s);case M:return tt(e,t.path)??rt(e,a,s);case K:return et(e)??rt(e,a,s);case I:return function(t){if(t.length<4)return null;const e=t[0],a=y(e,!0),s=t.slice(1,3),r=t.slice(3);return{type:"grp_txt",channelHash:a,text:g(r),decrypted:!1,ciphertextHex:g(r),macHex:g(s)}}(e)??rt(e,a,s);case O:return function(t){if(t.length<4)return null;const e=t[0],a=y(e,!0),s=t.slice(1,3),r=t.slice(3);return{type:"grp_data",channelHash:a,dataHex:g(r),dataLength:r.length,decrypted:!1,macHex:g(s)}}(e)??rt(e,a,s);case P:return function(t){return t.length<4?null:{type:"multipart",messageId:g(t.slice(0,2)),partNumber:t[2],totalParts:t[3],partData:g(t.slice(4))}}(e)??rt(e,a,s);default:return rt(e,a,s)}}export{X as P,tt as a,et as b,at as c,nt as d,st as e,Y as f}; diff --git a/frontend/dist/assets/ping-CcgRdnC3.js b/frontend/dist/assets/ping-CZgZ44Jt.js similarity index 94% rename from frontend/dist/assets/ping-CcgRdnC3.js rename to frontend/dist/assets/ping-CZgZ44Jt.js index 7a986165..9c8cd6dd 100644 --- a/frontend/dist/assets/ping-CcgRdnC3.js +++ b/frontend/dist/assets/ping-CZgZ44Jt.js @@ -1 +1 @@ -import{bY as t}from"./index-01Tx8g53.js";async function e(e,r=10){return t("/api/ping_neighbor",{method:"POST",body:JSON.stringify({target_id:e,timeout:r})})}const r=["Chat Node","Repeater","Room Server","Hybrid Node","Unknown"];async function s(s,o=10){if(o<1||o>60)return{success:!1,error:"Timeout must be 1-60 seconds"};let n;const a=s.match(/^(0x)?([0-9a-fA-F]{1,2})$/);if(a)n=`0x${a[2].padStart(2,"0")}`;else{const e=await async function(e){const s=e.toLowerCase();for(const o of r)try{const e=await t(`/api/adverts_by_contact_type?contact_type=${encodeURIComponent(o)}&hours=168`),r=e.success&&e.data?e.data:e,n=(Array.isArray(r)?r:[]).find(t=>t.node_name&&t.node_name.toLowerCase()===s);if(n&&n.pubkey)return`0x${n.pubkey.substring(0,2)}`}catch{continue}return null}(s);if(!e)return{success:!1,error:`Node '${s}' not found`};n=e}const c=await e(n,o);if(!c.success||!c.data)return{success:!1,error:c.error||"Ping failed"};const i=(u=c.data).rtt_ms>500||u.rssi<-120?"Poor":u.rtt_ms>250||u.rssi<-100?"Fair":u.rtt_ms>100||u.rssi<-80?"Good":"Excellent";var u;return{success:!0,data:{...c.data,quality:i}}}export{s as a,e as p}; +import{bY as t}from"./index-BBcIGlRT.js";async function e(e,r=10){return t("/api/ping_neighbor",{method:"POST",body:JSON.stringify({target_id:e,timeout:r})})}const r=["Chat Node","Repeater","Room Server","Hybrid Node","Unknown"];async function s(s,o=10){if(o<1||o>60)return{success:!1,error:"Timeout must be 1-60 seconds"};let n;const a=s.match(/^(0x)?([0-9a-fA-F]{1,2})$/);if(a)n=`0x${a[2].padStart(2,"0")}`;else{const e=await async function(e){const s=e.toLowerCase();for(const o of r)try{const e=await t(`/api/adverts_by_contact_type?contact_type=${encodeURIComponent(o)}&hours=168`),r=e.success&&e.data?e.data:e,n=(Array.isArray(r)?r:[]).find(t=>t.node_name&&t.node_name.toLowerCase()===s);if(n&&n.pubkey)return`0x${n.pubkey.substring(0,2)}`}catch{continue}return null}(s);if(!e)return{success:!1,error:`Node '${s}' not found`};n=e}const c=await e(n,o);if(!c.success||!c.data)return{success:!1,error:c.error||"Ping failed"};const i=(u=c.data).rtt_ms>500||u.rssi<-120?"Poor":u.rtt_ms>250||u.rssi<-100?"Fair":u.rtt_ms>100||u.rssi<-80?"Good":"Excellent";var u;return{success:!0,data:{...c.data,quality:i}}}export{s as a,e as p}; diff --git a/frontend/dist/assets/refresh-cw-DYbYazpH.js b/frontend/dist/assets/refresh-cw-BJopKEHj.js similarity index 79% rename from frontend/dist/assets/refresh-cw-DYbYazpH.js rename to frontend/dist/assets/refresh-cw-BJopKEHj.js index bcb0a1a8..5d8123f2 100644 --- a/frontend/dist/assets/refresh-cw-DYbYazpH.js +++ b/frontend/dist/assets/refresh-cw-BJopKEHj.js @@ -1 +1 @@ -import{c as a}from"./index-01Tx8g53.js";const e=a("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);export{e as R}; +import{c as a}from"./index-BBcIGlRT.js";const e=a("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);export{e as R}; diff --git a/frontend/dist/assets/route-D7UU7r6_.js b/frontend/dist/assets/route-lCtw8lWd.js similarity index 86% rename from frontend/dist/assets/route-D7UU7r6_.js rename to frontend/dist/assets/route-lCtw8lWd.js index d20c4df7..0bdb888d 100644 --- a/frontend/dist/assets/route-D7UU7r6_.js +++ b/frontend/dist/assets/route-lCtw8lWd.js @@ -1 +1 @@ -import{c as y}from"./index-01Tx8g53.js";const e=y("hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]),c=y("route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);export{e as H,c as R}; +import{c as y}from"./index-BBcIGlRT.js";const e=y("hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]),c=y("route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);export{e as H,c as R}; diff --git a/frontend/dist/assets/search-DGnzblbI.js b/frontend/dist/assets/search-Cs3jReDi.js similarity index 61% rename from frontend/dist/assets/search-DGnzblbI.js rename to frontend/dist/assets/search-Cs3jReDi.js index f1d388ae..8ba46a52 100644 --- a/frontend/dist/assets/search-DGnzblbI.js +++ b/frontend/dist/assets/search-Cs3jReDi.js @@ -1 +1 @@ -import{c}from"./index-01Tx8g53.js";const e=c("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);export{e as S}; +import{c}from"./index-BBcIGlRT.js";const e=c("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);export{e as S}; diff --git a/frontend/dist/assets/settings-2-CePlNpN3.js b/frontend/dist/assets/settings-2-YxRSYOZ0.js similarity index 73% rename from frontend/dist/assets/settings-2-CePlNpN3.js rename to frontend/dist/assets/settings-2-YxRSYOZ0.js index 7826012a..cdf2d0ea 100644 --- a/frontend/dist/assets/settings-2-CePlNpN3.js +++ b/frontend/dist/assets/settings-2-YxRSYOZ0.js @@ -1 +1 @@ -import{c}from"./index-01Tx8g53.js";const e=c("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);export{e as S}; +import{c}from"./index-BBcIGlRT.js";const e=c("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);export{e as S}; diff --git a/frontend/dist/assets/sun-CkgnTZGI.js b/frontend/dist/assets/sun-GNUT-ucn.js similarity index 89% rename from frontend/dist/assets/sun-CkgnTZGI.js rename to frontend/dist/assets/sun-GNUT-ucn.js index b536517f..c7a18be3 100644 --- a/frontend/dist/assets/sun-CkgnTZGI.js +++ b/frontend/dist/assets/sun-GNUT-ucn.js @@ -1 +1 @@ -import{c as t}from"./index-01Tx8g53.js";const a=t("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),e=t("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);export{a as M,e as S}; +import{c as t}from"./index-BBcIGlRT.js";const a=t("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),e=t("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);export{a as M,e as S}; diff --git a/frontend/dist/assets/system-DikvxgDQ.js b/frontend/dist/assets/system-7wpk3UyT.js similarity index 91% rename from frontend/dist/assets/system-DikvxgDQ.js rename to frontend/dist/assets/system-7wpk3UyT.js index 6046de55..6520bf54 100644 --- a/frontend/dist/assets/system-DikvxgDQ.js +++ b/frontend/dist/assets/system-7wpk3UyT.js @@ -1 +1 @@ -import{bY as n}from"./index-01Tx8g53.js";async function o(){return n("/api/transport_keys")}async function a(o){return n("/api/transport_keys",{method:"POST",body:JSON.stringify(o)})}async function t(o,a){return n(`/api/transport_key/${o}`,{method:"PUT",body:JSON.stringify(a)})}async function r(o){return n(`/api/transport_key/${o}`,{method:"DELETE"})}async function s(){return n("/api/global_flood_policy")}async function i(o){return n("/api/global_flood_policy",{method:"POST",body:JSON.stringify({global_flood_allow:o})})}async function c(o){return n("/api/restart_service",{method:"POST",body:"{}",signal:o})}async function e(){return n("/api/check_pymc_console")}export{s as a,a as b,e as c,r as d,o as g,c as r,i as s,t as u}; +import{bY as n}from"./index-BBcIGlRT.js";async function o(){return n("/api/transport_keys")}async function a(o){return n("/api/transport_keys",{method:"POST",body:JSON.stringify(o)})}async function t(o,a){return n(`/api/transport_key/${o}`,{method:"PUT",body:JSON.stringify(a)})}async function r(o){return n(`/api/transport_key/${o}`,{method:"DELETE"})}async function s(){return n("/api/global_flood_policy")}async function i(o){return n("/api/global_flood_policy",{method:"POST",body:JSON.stringify({global_flood_allow:o})})}async function c(o){return n("/api/restart_service",{method:"POST",body:"{}",signal:o})}async function e(){return n("/api/check_pymc_console")}export{s as a,a as b,e as c,r as d,o as g,c as r,i as s,t as u}; diff --git a/frontend/dist/assets/target-L50EKHoJ.js b/frontend/dist/assets/target-MKB3Qhi3.js similarity index 90% rename from frontend/dist/assets/target-L50EKHoJ.js rename to frontend/dist/assets/target-MKB3Qhi3.js index f8a36f58..2ff063ca 100644 --- a/frontend/dist/assets/target-L50EKHoJ.js +++ b/frontend/dist/assets/target-MKB3Qhi3.js @@ -1 +1 @@ -import{c}from"./index-01Tx8g53.js";const e=c("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),a=c("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),r=c("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);export{e as E,a as S,r as T}; +import{c}from"./index-BBcIGlRT.js";const e=c("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),a=c("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),r=c("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);export{e as E,a as S,r as T}; diff --git a/frontend/dist/assets/triangle-alert-DI33YyZq.js b/frontend/dist/assets/triangle-alert-DH80WgOo.js similarity index 75% rename from frontend/dist/assets/triangle-alert-DI33YyZq.js rename to frontend/dist/assets/triangle-alert-DH80WgOo.js index 60440bd5..7b01d237 100644 --- a/frontend/dist/assets/triangle-alert-DI33YyZq.js +++ b/frontend/dist/assets/triangle-alert-DH80WgOo.js @@ -1 +1 @@ -import{c as a}from"./index-01Tx8g53.js";const e=a("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);export{e as T}; +import{c as a}from"./index-BBcIGlRT.js";const e=a("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);export{e as T}; diff --git a/frontend/dist/assets/users-CIk0ES1a.js b/frontend/dist/assets/users-DuzW_tmB.js similarity index 78% rename from frontend/dist/assets/users-CIk0ES1a.js rename to frontend/dist/assets/users-DuzW_tmB.js index eecbe5ff..4cc4f767 100644 --- a/frontend/dist/assets/users-CIk0ES1a.js +++ b/frontend/dist/assets/users-DuzW_tmB.js @@ -1 +1 @@ -import{c as a}from"./index-01Tx8g53.js";const e=a("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);export{e as U}; +import{c as a}from"./index-BBcIGlRT.js";const e=a("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);export{e as U}; diff --git a/frontend/dist/assets/wifi-DUOhGE6X.js b/frontend/dist/assets/wifi-BGoUD8Dj.js similarity index 76% rename from frontend/dist/assets/wifi-DUOhGE6X.js rename to frontend/dist/assets/wifi-BGoUD8Dj.js index 8eb3c31f..942af80f 100644 --- a/frontend/dist/assets/wifi-DUOhGE6X.js +++ b/frontend/dist/assets/wifi-BGoUD8Dj.js @@ -1 +1 @@ -import{c as a}from"./index-01Tx8g53.js";const e=a("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);export{e as W}; +import{c as a}from"./index-BBcIGlRT.js";const e=a("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);export{e as W}; diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 23969aa5..bf6e9a2a 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -39,7 +39,7 @@ --font-data: 'JetBrains Mono', 'SF Mono', Monaco, monospace; } - + diff --git a/frontend/package.json b/frontend/package.json index 86fd8e3c..161d84f2 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "pymc_console", - "version": "0.9.261", + "version": "0.9.262", "description": "Vite + React Dashboard for pyMC_Repeater", "private": true, "type": "module",