diff --git a/frontend/dist/VERSION b/frontend/dist/VERSION index cb5b97b7..9e2492a6 100644 --- a/frontend/dist/VERSION +++ b/frontend/dist/VERSION @@ -1 +1 @@ -0.9.232 +0.9.233 diff --git a/frontend/dist/assets/Card-DfIcRbRE.js b/frontend/dist/assets/Card-BC0izdLh.js similarity index 96% rename from frontend/dist/assets/Card-DfIcRbRE.js rename to frontend/dist/assets/Card-BC0izdLh.js index 47cd1fc9..5dd4b78d 100644 --- a/frontend/dist/assets/Card-DfIcRbRE.js +++ b/frontend/dist/assets/Card-BC0izdLh.js @@ -1 +1 @@ -import{j as e,c as s}from"./vendor-react-j_fHog8x.js";import{e as l}from"./index-CImKXCRQ.js";function t({title:t,icon:r,badge:i,badgeColor:a="teal",subtitle:c,actions:n,iconColor:x="text-icon-card-title",largeTitle:d=!1,listHeader:m=!1,stackActionsOnMobile:o=!1}){return o&&n?e.jsxs("div",{className:s("flex flex-col gap-1 flex-shrink-0",m?"px-4 py-3 border-b border-border-subtle bg-bg-elevated/20":"mb-3"),children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 min-h-[32px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("span",{className:s("icon-md flex items-center justify-center",x),children:r}),e.jsx("span",{className:s(d?"type-subheading text-text-primary":"type-micro"),children:t}),i&&e.jsx(l,{color:a,children:i})]}),e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:n})]}),c&&e.jsx("p",{className:"type-label text-text-muted ml-8",children:c})]}):e.jsxs("div",{className:s("flex flex-col gap-1 flex-shrink-0",m?"px-4 py-3 border-b border-border-subtle bg-bg-elevated/20":"mb-3"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 min-h-[32px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("span",{className:s("icon-md flex items-center justify-center",x),children:r}),e.jsx("span",{className:s(d?"type-subheading text-text-primary":"type-micro"),children:t}),i&&e.jsx(l,{color:a,children:i})]}),n&&e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:n})]}),c&&e.jsx("p",{className:"type-label text-text-muted ml-8",children:c})]})}function r({children:l,centered:t,className:r}){return e.jsx("div",{className:s("flex-1 min-h-0",t&&"flex items-center justify-center",r),children:l})}export{t as C,r as a}; +import{j as e,c as s}from"./vendor-react-j_fHog8x.js";import{e as l}from"./index-B51aMfiH.js";function t({title:t,icon:r,badge:i,badgeColor:a="teal",subtitle:c,actions:n,iconColor:x="text-icon-card-title",largeTitle:d=!1,listHeader:m=!1,stackActionsOnMobile:o=!1}){return o&&n?e.jsxs("div",{className:s("flex flex-col gap-1 flex-shrink-0",m?"px-4 py-3 border-b border-border-subtle bg-bg-elevated/20":"mb-3"),children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 min-h-[32px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("span",{className:s("icon-md flex items-center justify-center",x),children:r}),e.jsx("span",{className:s(d?"type-subheading text-text-primary":"type-micro"),children:t}),i&&e.jsx(l,{color:a,children:i})]}),e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:n})]}),c&&e.jsx("p",{className:"type-label text-text-muted ml-8",children:c})]}):e.jsxs("div",{className:s("flex flex-col gap-1 flex-shrink-0",m?"px-4 py-3 border-b border-border-subtle bg-bg-elevated/20":"mb-3"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 min-h-[32px]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsx("span",{className:s("icon-md flex items-center justify-center",x),children:r}),e.jsx("span",{className:s(d?"type-subheading text-text-primary":"type-micro"),children:t}),i&&e.jsx(l,{color:a,children:i})]}),n&&e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:n})]}),c&&e.jsx("p",{className:"type-label text-text-muted ml-8",children:c})]})}function r({children:l,centered:t,className:r}){return e.jsx("div",{className:s("flex-1 min-h-0",t&&"flex items-center justify-center",r),children:l})}export{t as C,r as a}; diff --git a/frontend/dist/assets/ChatBubble-jJzikYsj.js b/frontend/dist/assets/ChatBubble-D6wREMt8.js similarity index 97% rename from frontend/dist/assets/ChatBubble-jJzikYsj.js rename to frontend/dist/assets/ChatBubble-D6wREMt8.js index c619eb5f..bd00494c 100644 --- a/frontend/dist/assets/ChatBubble-jJzikYsj.js +++ b/frontend/dist/assets/ChatBubble-D6wREMt8.js @@ -1 +1 @@ -import{c as e}from"./index-CImKXCRQ.js";import{r as t,j as s,c as n}from"./vendor-react-j_fHog8x.js";const a=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"}]]),l=["#22c55e","#3b82f6","#f59e0b","#ec4899","#8b5cf6","#06b6d4","#f97316","#84cc16"];function r(e){let t=0;for(let s=0;s0?{emoji:t[0],cleanName:e.replace(i,"").trim()||e}:{emoji:null,cleanName:e}}function o(e){const{cleanName:t}=c(e),s=t.split(/[\s-_]+/).filter(Boolean);return s.length>=2?((Array.from(s[0])[0]||"")+(Array.from(s[1])[0]||"")).toUpperCase():Array.from(t).slice(0,2).join("").toUpperCase()}function d(e){return new Date(1e3*e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}function m(e){const s=/@\[([^\]]+)\]/g,n=[];let a,l=0;for(;null!==(a=s.exec(e));)a.index>l&&n.push(e.slice(l,a.index)),n.push(t.createElement("span",{key:a.index,className:"font-extrabold text-white"},a[1])),l=a.index+a[0].length;return l0?n:e}const x=t.memo(function({senderName:e,text:t,timestamp:a,nameAccessory:l,bubbleAccessory:i,className:x}){const{emoji:u,cleanName:h}=c(e),p=r(h),f=o(e);return s.jsxs("div",{className:n("group flex items-start gap-3 w-full",x),children:[s.jsxs("div",{className:"flex-shrink-0 w-9 flex flex-col items-center gap-1",children:[s.jsx("div",{className:n("w-9 h-9 rounded-full flex items-center justify-center","shadow-md ring-1 ring-border-subtle",u?"text-lg":"text-white text-[13px] font-bold tracking-tight"),style:{backgroundColor:p},children:u||f}),s.jsx("span",{className:"text-[10px] text-text-muted tabular-nums h-4 leading-4",children:d(a)})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 h-5 mb-1",children:[s.jsx("span",{className:"text-[13px] font-medium truncate",style:{color:p,lineHeight:"20px"},children:h}),l]}),s.jsxs("div",{className:"flex items-end gap-1.5",children:[s.jsx("div",{className:n("inline-block px-3.5 py-2.5 max-w-full","rounded-2xl rounded-tl-md","bg-[#007AFF]"),children:s.jsx("p",{className:"text-sm text-white leading-relaxed tracking-wide whitespace-pre-wrap break-words",children:m(t)})}),i]})]})]})});function u({text:e}){return s.jsx("div",{className:"flex justify-center my-1",children:s.jsx("span",{className:n("px-3 py-1 rounded-full","bg-subtle-fill text-[11px] text-text-muted/80 font-medium","ring-1 ring-border-subtle"),children:e})})}export{x as C,a as M,u as S,o as a,c as e,m as f,r as g}; +import{c as e}from"./index-B51aMfiH.js";import{r as t,j as s,c as n}from"./vendor-react-j_fHog8x.js";const a=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"}]]),l=["#22c55e","#3b82f6","#f59e0b","#ec4899","#8b5cf6","#06b6d4","#f97316","#84cc16"];function r(e){let t=0;for(let s=0;s0?{emoji:t[0],cleanName:e.replace(i,"").trim()||e}:{emoji:null,cleanName:e}}function o(e){const{cleanName:t}=c(e),s=t.split(/[\s-_]+/).filter(Boolean);return s.length>=2?((Array.from(s[0])[0]||"")+(Array.from(s[1])[0]||"")).toUpperCase():Array.from(t).slice(0,2).join("").toUpperCase()}function d(e){return new Date(1e3*e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}function m(e){const s=/@\[([^\]]+)\]/g,n=[];let a,l=0;for(;null!==(a=s.exec(e));)a.index>l&&n.push(e.slice(l,a.index)),n.push(t.createElement("span",{key:a.index,className:"font-extrabold text-white"},a[1])),l=a.index+a[0].length;return l0?n:e}const x=t.memo(function({senderName:e,text:t,timestamp:a,nameAccessory:l,bubbleAccessory:i,className:x}){const{emoji:u,cleanName:h}=c(e),p=r(h),f=o(e);return s.jsxs("div",{className:n("group flex items-start gap-3 w-full",x),children:[s.jsxs("div",{className:"flex-shrink-0 w-9 flex flex-col items-center gap-1",children:[s.jsx("div",{className:n("w-9 h-9 rounded-full flex items-center justify-center","shadow-md ring-1 ring-border-subtle",u?"text-lg":"text-white text-[13px] font-bold tracking-tight"),style:{backgroundColor:p},children:u||f}),s.jsx("span",{className:"text-[10px] text-text-muted tabular-nums h-4 leading-4",children:d(a)})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 h-5 mb-1",children:[s.jsx("span",{className:"text-[13px] font-medium truncate",style:{color:p,lineHeight:"20px"},children:h}),l]}),s.jsxs("div",{className:"flex items-end gap-1.5",children:[s.jsx("div",{className:n("inline-block px-3.5 py-2.5 max-w-full","rounded-2xl rounded-tl-md","bg-[#007AFF]"),children:s.jsx("p",{className:"text-sm text-white leading-relaxed tracking-wide whitespace-pre-wrap break-words",children:m(t)})}),i]})]})]})});function u({text:e}){return s.jsx("div",{className:"flex justify-center my-1",children:s.jsx("span",{className:n("px-3 py-1 rounded-full","bg-subtle-fill text-[11px] text-text-muted/80 font-medium","ring-1 ring-border-subtle"),children:e})})}export{x as C,a as M,u as S,o as a,c as e,m as f,r as g}; diff --git a/frontend/dist/assets/CollisionExplorerModal-EDF-OEuX.js b/frontend/dist/assets/CollisionExplorerModal-COcb8LoT.js similarity index 97% rename from frontend/dist/assets/CollisionExplorerModal-EDF-OEuX.js rename to frontend/dist/assets/CollisionExplorerModal-COcb8LoT.js index 0a6ee854..e898ad56 100644 --- a/frontend/dist/assets/CollisionExplorerModal-EDF-OEuX.js +++ b/frontend/dist/assets/CollisionExplorerModal-COcb8LoT.js @@ -1 +1 @@ -import{r as e,j as s,c as t}from"./vendor-react-j_fHog8x.js";import{u as a,M as i,B as o,S as n,L as l,a as r}from"./BasemapLayer-Dkb0XoZP.js";import"./maplibre-gl-b91ci4Kr.js";import{c as d,n as c,am as h,o as u,K as m,N as x,ad as p,e as g,f as v,b2 as b}from"./index-CImKXCRQ.js";import{T as f}from"./triangle-alert-DRA45BSe.js";import{M as j}from"./map-pin-lRKxIpXD.js";import{C as y}from"./copy-CfZtRqCt.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"}]]),M={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"};function k({node:a,isHovered:i,onHover:o}){const[n,l]=e.useState(!1),r=e.useCallback(e=>{var s,t;e.stopPropagation(),s=a.hash,(null==(t=navigator.clipboard)?void 0:t.writeText)&&navigator.clipboard.writeText(s).catch(()=>{}),l(!0),setTimeout(()=>l(!1),2e3)},[a.hash]),d=a.contactType.toLowerCase(),c=d.includes("room")||d.includes("server");let h=w,u="text-accent-primary";return c?(h=b,u="text-signal-fair"):"companion"===d||"client"===d?(h=N,u="text-text-muted"):a.isNeighbor&&(u="text-accent-success"),s.jsxs("div",{className:t("flex items-center gap-3 px-3 py-2.5 radius-inner transition-base cursor-pointer",i?"bg-accent-primary/10":"hover:bg-subtle-fill"),onMouseEnter:()=>o(a.hash),onMouseLeave:()=>o(null),children:[s.jsx(h,{className:t("w-4 h-4 flex-shrink-0",u)}),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:"text-sm font-medium text-text-primary truncate",children:a.name}),a.isNeighbor&&s.jsx(g,{color:"green",compact:!0,children:"NBR"}),a.isRepeater&&s.jsx(g,{color:"zinc",compact:!0,children:"RPT"}),a.isHub&&s.jsx(g,{color:"purple",compact:!0,children:"HUB"})]}),s.jsxs("button",{onClick:r,className:t("mt-1 inline-flex items-center gap-1 text-[10px] font-mono px-1.5 py-0.5 rounded","border transition-all cursor-pointer",n?"border-accent-success/50 bg-accent-success/10 text-accent-success":"border-border-subtle bg-bg-subtle/50 text-text-muted hover:border-border-strong"),title:`Copy: ${a.hash}`,children:[a.hash.slice(0,12),"…",n?s.jsx(v,{className:"w-2.5 h-2.5"}):s.jsx(y,{className:"w-2.5 h-2.5 opacity-50"})]})]})]})}function H({nodes:d,hoveredHash:c,onHover:h}){const u=a(),m=e.useRef(null),x=p(),[v,b]=e.useState(!1),f=e.useMemo(()=>d.filter(e=>null!=e.latitude&&null!=e.longitude&&(0!==e.latitude||0!==e.longitude)),[d]),y=e.useMemo(()=>{if(0===f.length)return null;let e=1/0,s=-1/0,t=1/0,a=-1/0;for(const i of f)e=Math.min(e,i.longitude),s=Math.max(s,i.longitude),t=Math.min(t,i.latitude),a=Math.max(a,i.latitude);if(a-t<.01){const e=(a+t)/2;t=e-.005,a=e+.005}if(s-e<.01){const t=(s+e)/2;e=t-.005,s=t+.005}return[[e,t],[s,a]]},[f]),N=e.useMemo(()=>y?{longitude:(y[0][0]+y[1][0])/2,latitude:(y[0][1]+y[1][1])/2}:{longitude:0,latitude:0},[y]),w=e.useMemo(()=>{if(f.length<2)return null;const e=[];for(let s=0;s{var e;const s=null==(e=m.current)?void 0:e.getMap();s&&y?(s.fitBounds(y,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:13,duration:0}),setTimeout(()=>b(!0),50)):b(!0)},[y]),H=x&&v;return 0===f.length?s.jsx("div",{className:"h-full flex items-center justify-center bg-bg-subtle/30 radius-inner",children:s.jsxs("div",{className:"text-center text-text-secondary p-4",children:[s.jsx(j,{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-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-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(i,{ref:m,initialViewState:{longitude:N.longitude,latitude:N.latitude,zoom:10},style:{height:"100%",width:"100%"},mapStyle:M,attributionControl:!1,onLoad:k,children:[s.jsx(o,{mode:u}),w&&s.jsx(n,{id:"collision-edges",type:"geojson",data:w,children:s.jsx(l,{id:"collision-edges-line",type:"line",paint:{"line-color":"#3B3F4A","line-width":2,"line-opacity":.8},layout:{"line-cap":"round","line-join":"round"}})}),f.map(e=>{const t=e.hash===c,a=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:()=>h(e.hash),onMouseLeave:()=>h(null),style:{pointerEvents:"auto"},children:s.jsxs(g,{color:"amber",filled:!0,className:"font-mono text-[10px] shadow-lg",children:[a,t&&s.jsx("span",{className:"ml-1 opacity-75 font-sans",children:e.name})]})})},e.hash)})]})})]})}const C=e.memo(function({isOpen:t,prefix:a,candidateHashes:i,onClose:o}){const n=c(),l=h(),r=u(),[d,p]=e.useState(null),g=e.useMemo(()=>new Set(r.map(e=>e.hash)),[r]),v=(null==n?void 0:n.neighbors)??{},b=e.useMemo(()=>i.map(e=>{var s;const t=(e=>v[e]?v[e]:!e.startsWith("0x")&&v["0x"+e]?v["0x"+e]:e.startsWith("0x")&&v[e.slice(2)]?v[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:l.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)),[i,v,g,l]),j=e.useMemo(()=>b.some(e=>null!=e.latitude&&null!=e.longitude&&(0!==e.latitude||0!==e.longitude)),[b]),y=e.useCallback(e=>{p(e)},[]),N=j?"4xl":"lg";return t?s.jsxs(m,{open:t,onClose:o,size:N,motionPlus:!0,className:j?"sm:h-[500px] sm:max-h-[600px]":"",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-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(f,{className:"w-5 h-5 text-signal-fair"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-base font-semibold text-text-primary",children:["Prefix Collision: ",s.jsx("span",{className:"font-mono text-accent-primary",children:a})]}),s.jsxs("p",{className:"text-xs text-text-secondary",children:[b.length," nodes share this prefix"]})]})]}),s.jsx("button",{onClick:o,className:"p-2 text-text-muted hover:text-text-primary transition-base radius-inner hover:bg-bg-subtle",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:[j&&s.jsx("div",{className:"h-64 p-2 border-b border-border-subtle",children:s.jsx(H,{nodes:b,hoveredHash:d,onHover:y})}),s.jsx("div",{className:"p-2",children:b.map(e=>s.jsx(k,{node:e,isHovered:d===e.hash,onHover:y},e.hash))})]}),j?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-border-subtle",children:s.jsx("div",{className:"p-2",children:b.map(e=>s.jsx(k,{node:e,isHovered:d===e.hash,onHover:y},e.hash))})}),s.jsx("div",{className:"overflow-hidden p-2",children:s.jsx(H,{nodes:b,hoveredHash:d,onHover:y})})]}):s.jsx("div",{className:"hidden sm:block flex-1 overflow-y-auto",children:s.jsx("div",{className:"p-2",children:b.map(e=>s.jsx(k,{node:e,isHovered:d===e.hash,onHover:y},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 a,M as i,B as o,S as n,L as l,a as r}from"./BasemapLayer-Dkb0XoZP.js";import"./maplibre-gl-b91ci4Kr.js";import{c as d,n as c,am as h,o as u,K as m,N as x,ad as p,e as g,f as v,b2 as b}from"./index-B51aMfiH.js";import{T as f}from"./triangle-alert-JpcXY4mr.js";import{M as j}from"./map-pin-C3ieg9t_.js";import{C as y}from"./copy-jAVnwXtf.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"}]]),M={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"};function k({node:a,isHovered:i,onHover:o}){const[n,l]=e.useState(!1),r=e.useCallback(e=>{var s,t;e.stopPropagation(),s=a.hash,(null==(t=navigator.clipboard)?void 0:t.writeText)&&navigator.clipboard.writeText(s).catch(()=>{}),l(!0),setTimeout(()=>l(!1),2e3)},[a.hash]),d=a.contactType.toLowerCase(),c=d.includes("room")||d.includes("server");let h=w,u="text-accent-primary";return c?(h=b,u="text-signal-fair"):"companion"===d||"client"===d?(h=N,u="text-text-muted"):a.isNeighbor&&(u="text-accent-success"),s.jsxs("div",{className:t("flex items-center gap-3 px-3 py-2.5 radius-inner transition-base cursor-pointer",i?"bg-accent-primary/10":"hover:bg-subtle-fill"),onMouseEnter:()=>o(a.hash),onMouseLeave:()=>o(null),children:[s.jsx(h,{className:t("w-4 h-4 flex-shrink-0",u)}),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:"text-sm font-medium text-text-primary truncate",children:a.name}),a.isNeighbor&&s.jsx(g,{color:"green",compact:!0,children:"NBR"}),a.isRepeater&&s.jsx(g,{color:"zinc",compact:!0,children:"RPT"}),a.isHub&&s.jsx(g,{color:"purple",compact:!0,children:"HUB"})]}),s.jsxs("button",{onClick:r,className:t("mt-1 inline-flex items-center gap-1 text-[10px] font-mono px-1.5 py-0.5 rounded","border transition-all cursor-pointer",n?"border-accent-success/50 bg-accent-success/10 text-accent-success":"border-border-subtle bg-bg-subtle/50 text-text-muted hover:border-border-strong"),title:`Copy: ${a.hash}`,children:[a.hash.slice(0,12),"…",n?s.jsx(v,{className:"w-2.5 h-2.5"}):s.jsx(y,{className:"w-2.5 h-2.5 opacity-50"})]})]})]})}function H({nodes:d,hoveredHash:c,onHover:h}){const u=a(),m=e.useRef(null),x=p(),[v,b]=e.useState(!1),f=e.useMemo(()=>d.filter(e=>null!=e.latitude&&null!=e.longitude&&(0!==e.latitude||0!==e.longitude)),[d]),y=e.useMemo(()=>{if(0===f.length)return null;let e=1/0,s=-1/0,t=1/0,a=-1/0;for(const i of f)e=Math.min(e,i.longitude),s=Math.max(s,i.longitude),t=Math.min(t,i.latitude),a=Math.max(a,i.latitude);if(a-t<.01){const e=(a+t)/2;t=e-.005,a=e+.005}if(s-e<.01){const t=(s+e)/2;e=t-.005,s=t+.005}return[[e,t],[s,a]]},[f]),N=e.useMemo(()=>y?{longitude:(y[0][0]+y[1][0])/2,latitude:(y[0][1]+y[1][1])/2}:{longitude:0,latitude:0},[y]),w=e.useMemo(()=>{if(f.length<2)return null;const e=[];for(let s=0;s{var e;const s=null==(e=m.current)?void 0:e.getMap();s&&y?(s.fitBounds(y,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:13,duration:0}),setTimeout(()=>b(!0),50)):b(!0)},[y]),H=x&&v;return 0===f.length?s.jsx("div",{className:"h-full flex items-center justify-center bg-bg-subtle/30 radius-inner",children:s.jsxs("div",{className:"text-center text-text-secondary p-4",children:[s.jsx(j,{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-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-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(i,{ref:m,initialViewState:{longitude:N.longitude,latitude:N.latitude,zoom:10},style:{height:"100%",width:"100%"},mapStyle:M,attributionControl:!1,onLoad:k,children:[s.jsx(o,{mode:u}),w&&s.jsx(n,{id:"collision-edges",type:"geojson",data:w,children:s.jsx(l,{id:"collision-edges-line",type:"line",paint:{"line-color":"#3B3F4A","line-width":2,"line-opacity":.8},layout:{"line-cap":"round","line-join":"round"}})}),f.map(e=>{const t=e.hash===c,a=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:()=>h(e.hash),onMouseLeave:()=>h(null),style:{pointerEvents:"auto"},children:s.jsxs(g,{color:"amber",filled:!0,className:"font-mono text-[10px] shadow-lg",children:[a,t&&s.jsx("span",{className:"ml-1 opacity-75 font-sans",children:e.name})]})})},e.hash)})]})})]})}const C=e.memo(function({isOpen:t,prefix:a,candidateHashes:i,onClose:o}){const n=c(),l=h(),r=u(),[d,p]=e.useState(null),g=e.useMemo(()=>new Set(r.map(e=>e.hash)),[r]),v=(null==n?void 0:n.neighbors)??{},b=e.useMemo(()=>i.map(e=>{var s;const t=(e=>v[e]?v[e]:!e.startsWith("0x")&&v["0x"+e]?v["0x"+e]:e.startsWith("0x")&&v[e.slice(2)]?v[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:l.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)),[i,v,g,l]),j=e.useMemo(()=>b.some(e=>null!=e.latitude&&null!=e.longitude&&(0!==e.latitude||0!==e.longitude)),[b]),y=e.useCallback(e=>{p(e)},[]),N=j?"4xl":"lg";return t?s.jsxs(m,{open:t,onClose:o,size:N,motionPlus:!0,className:j?"sm:h-[500px] sm:max-h-[600px]":"",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-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(f,{className:"w-5 h-5 text-signal-fair"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"text-base font-semibold text-text-primary",children:["Prefix Collision: ",s.jsx("span",{className:"font-mono text-accent-primary",children:a})]}),s.jsxs("p",{className:"text-xs text-text-secondary",children:[b.length," nodes share this prefix"]})]})]}),s.jsx("button",{onClick:o,className:"p-2 text-text-muted hover:text-text-primary transition-base radius-inner hover:bg-bg-subtle",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:[j&&s.jsx("div",{className:"h-64 p-2 border-b border-border-subtle",children:s.jsx(H,{nodes:b,hoveredHash:d,onHover:y})}),s.jsx("div",{className:"p-2",children:b.map(e=>s.jsx(k,{node:e,isHovered:d===e.hash,onHover:y},e.hash))})]}),j?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-border-subtle",children:s.jsx("div",{className:"p-2",children:b.map(e=>s.jsx(k,{node:e,isHovered:d===e.hash,onHover:y},e.hash))})}),s.jsx("div",{className:"overflow-hidden p-2",children:s.jsx(H,{nodes:b,hoveredHash:d,onHover:y})})]}):s.jsx("div",{className:"hidden sm:block flex-1 overflow-y-auto",children:s.jsx("div",{className:"p-2",children:b.map(e=>s.jsx(k,{node:e,isHovered:d===e.hash,onHover:y},e.hash))})})]})]}):null});export{C,N as M,w as S}; diff --git a/frontend/dist/assets/Configuration-Csaz7snm.js b/frontend/dist/assets/Configuration-CoqoluHU.js similarity index 98% rename from frontend/dist/assets/Configuration-Csaz7snm.js rename to frontend/dist/assets/Configuration-CoqoluHU.js index 219c3d55..b4d13ea1 100644 --- a/frontend/dist/assets/Configuration-Csaz7snm.js +++ b/frontend/dist/assets/Configuration-CoqoluHU.js @@ -1 +1 @@ -import{r as e,j as t,c as a}from"./vendor-react-j_fHog8x.js";import{c as s,Q as r,f as n,a0 as l,O as c,ct as i,cu as o,cv as d,cw as m,aA as u,by as x,cx as p,cy as h,cz as y,cA as b,R as f,cB as g,cC as j,I as v}from"./index-CImKXCRQ.js";import{g as N,c as w,r as k,s as C,a as S,u as _,d as F}from"./system-nunPUnlB.js";import{T,P as E,C as P}from"./ConfirmModal-C50H21Nf.js";import{l as M}from"./font-loader-BQzEmDrZ.js";import{N as R}from"./NodeInformationCard-DO5yOP6K.js";import{a as z,P as A,b as L,B as D}from"./PageLayout-CBx7rIBL.js";import{C as I}from"./Card-DfIcRbRE.js";import{I as K}from"./info-CBhRp85T.js";import{R as V,C as H}from"./Grid-OFJ4oe0a.js";import{K as q}from"./key-round-D-rRp0r8.js";import{C as O}from"./circle-check-DK-UNKLb.js";import{T as $}from"./triangle-alert-DRA45BSe.js";import{R as B}from"./refresh-cw-DElcO6pC.js";import{C as X}from"./copy-CfZtRqCt.js";import{C as G}from"./chevron-right-DZcqArkG.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CDNU4oKM.js";import"./DataBox-BUgVf-3d.js";const U=s("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"}]]),W=s("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"}]]),Y=s("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"}]]),J=s("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"}]]),Q=s("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"}]]),Z=s("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"}]]),ee=s("shield-check",[["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:"m9 12 2 2 4-4",key:"dzmm74"}]]),te=s("shield-x",[["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:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]),ae=s("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"}]]),se=1500,re="h-[38px]",ne="h-[32px]",le="px-3",ce="px-2.5",ie="rounded-lg";function oe({label:s,value:c,editValue:i,onSave:o,type:d="text",suffix:m,placeholder:u,readOnly:x=!1,layout:p="stacked",min:h,max:y,step:b,maxLength:f,description:g,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&&!!o;e.useEffect(()=>(F.current=!0,()=>{F.current=!1,T.current&&clearTimeout(T.current)}),[]);const P=e.useCallback(()=>{E&&(k(i??c),N(!0),S("idle"),requestAnimationFrame(()=>{var e;return null==(e=_.current)?void 0:e.select()}))},[E,i,c]),M=e.useCallback(()=>{N(!1),k(""),S("idle")},[]),R=e.useCallback(async()=>{if(o&&"loading"!==C)if(w!==(i??c)){T.current&&clearTimeout(T.current),S("loading");try{if(await o(w),!F.current)return;S("success"),N(!1),T.current=setTimeout(()=>{F.current&&S("idle")},se)}catch{if(!F.current)return;S("error"),T.current=setTimeout(()=>{F.current&&S("idle")},se)}}else M()},[o,w,i,c,M,C]),z=e.useCallback(e=>{"Enter"===e.key?(e.preventDefault(),R()):"Escape"===e.key&&(e.preventDefault(),M())},[R,M]);return"inline"===p?t.jsxs("div",{className:a("group flex items-center justify-between",j),children:[t.jsx("label",{className:"type-label text-text-muted shrink-0",children:s}),v?t.jsxs("div",{className:a(ne,ie,ce,"flex items-center transition-all","bg-transparent border border-accent-primary/50 ring-1 ring-accent-primary/20","min-w-[100px]"),children:[t.jsx("input",{ref:_,type:d,value:w,onChange:e=>k(e.target.value),onKeyDown:z,placeholder:u,min:h,max:y,step:b,maxLength:f,disabled:"loading"===C,className:a("bg-transparent text-text-primary focus:outline-none type-data flex-1 min-w-0",m?"w-12 text-right":"w-full")}),m&&t.jsx("span",{className:"text-text-muted type-data ml-1 shrink-0",children:m}),t.jsx("div",{className:"flex items-center gap-0.5 ml-2 shrink-0",children:"loading"===C?t.jsx(r,{className:"w-3.5 h-3.5 text-text-muted animate-spin"}):t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:R,className:"p-0.5 rounded hover:bg-accent-success/15 text-accent-success transition-colors",title:"Save (Enter)",children:t.jsx(n,{className:"w-3 h-3"})}),t.jsx("button",{onClick:M,className:"p-0.5 rounded hover:bg-accent-danger/15 text-text-muted hover:text-accent-danger transition-colors",title:"Cancel (Esc)",children:t.jsx(l,{className:"w-3 h-3"})})]})})]}):t.jsxs("div",{className:a(ne,ie,ce,"flex items-center justify-end transition-all min-w-[80px]","bg-white/[0.03] border border-white/[0.06]",E&&"cursor-pointer hover:border-white/10 hover:bg-white/[0.05]"),onClick:E?P:void 0,children:[t.jsx("span",{className:"type-data text-text-primary",children:c}),"success"===C&&t.jsx(n,{className:"w-3 h-3 text-accent-success ml-1.5 shrink-0"}),"error"===C&&t.jsx(l,{className:"w-3 h-3 text-accent-danger ml-1.5 shrink-0"}),"idle"===C&&E&&t.jsx(Z,{className:"w-3 h-3 text-text-muted ml-1.5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})]})]}):t.jsxs("div",{className:a("group",j),children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:s}),v?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:a(re,ie,le,"flex items-center transition-all","bg-transparent border border-accent-primary/50 ring-1 ring-accent-primary/20"),children:[t.jsx("input",{ref:_,type:d,value:w,onChange:e=>k(e.target.value),onKeyDown:z,placeholder:u,min:h,max:y,step:b,maxLength:f,disabled:"loading"===C,className:"w-full bg-transparent text-text-primary focus:outline-none type-data flex-1 min-w-0"}),m&&t.jsx("span",{className:"text-text-muted type-data ml-1 shrink-0",children:m}),t.jsx("div",{className:"flex items-center gap-0.5 ml-2 shrink-0",children:"loading"===C?t.jsx(r,{className:"w-3.5 h-3.5 text-text-muted animate-spin"}):t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:R,className:"p-1 rounded hover:bg-accent-success/15 text-accent-success transition-colors",title:"Save (Enter)",children:t.jsx(n,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:M,className:"p-1 rounded hover:bg-accent-danger/15 text-text-muted hover:text-accent-danger transition-colors",title:"Cancel (Esc)",children:t.jsx(l,{className:"w-3.5 h-3.5"})})]})})]}),g&&t.jsx("p",{className:"type-data-xs text-text-muted mt-1 ml-3",children:g})]}):t.jsxs("div",{className:a(re,ie,le,"flex items-center transition-all","bg-white/[0.03] border border-white/[0.06]",E&&"cursor-pointer hover:border-white/10 hover:bg-white/[0.05]"),onClick:E?P:void 0,children:[t.jsx("span",{className:"type-data text-text-primary flex-1",children:c}),"success"===C&&t.jsx(n,{className:"w-3.5 h-3.5 text-accent-success shrink-0"}),"error"===C&&t.jsx(l,{className:"w-3.5 h-3.5 text-accent-danger shrink-0"}),"idle"===C&&E&&t.jsx(Z,{className:"w-3.5 h-3.5 text-text-muted opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})]})]})}function de({label:s,value:i,editValue:o,options:d,onSave:m,readOnly:u=!1,layout:x="stacked",className:p}){const[h,y]=e.useState(!1),[b,f]=e.useState(""),[g,j]=e.useState("idle"),v=e.useRef(null),N=e.useRef(!0),w=e.useRef(null),k=!u&&!!m;e.useEffect(()=>(N.current=!0,()=>{N.current=!1,w.current&&clearTimeout(w.current)}),[]);const C=e.useCallback(()=>{k&&(f(String(o)),y(!0),j("idle"),requestAnimationFrame(()=>{var e;return null==(e=v.current)?void 0:e.focus()}))},[k,o]),S=e.useCallback(()=>{y(!1),f(""),j("idle")},[]),_=e.useCallback(async()=>{if(m&&"loading"!==g)if(b!==String(o)){w.current&&clearTimeout(w.current),j("loading");try{if(await m(b),!N.current)return;j("success"),y(!1),w.current=setTimeout(()=>{N.current&&j("idle")},se)}catch{if(!N.current)return;j("error"),w.current=setTimeout(()=>{N.current&&j("idle")},se)}}else S()},[m,b,o,S,g]),F=e.useCallback(e=>{"Escape"===e.key&&(e.preventDefault(),S())},[S]),T="inline"===x,E=T?ne:re,P=T?ce:le,M=t.jsxs("div",{className:a(E,ie,P,"flex items-center transition-all relative","bg-transparent border border-accent-primary/50 ring-1 ring-accent-primary/20",T&&"min-w-[100px]"),children:[t.jsx("select",{ref:v,value:b,onChange:e=>f(e.target.value),onKeyDown:F,disabled:"loading"===g,className:a("bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data flex-1 min-w-0","pr-6"),children:d.map(e=>t.jsx("option",{value:e.value,children:e.label},String(e.value)))}),t.jsx(c,{className:"absolute right-auto w-3.5 h-3.5 text-text-muted pointer-events-none",style:{right:"loading"===g?"2rem":"3.5rem"}}),t.jsx("div",{className:"flex items-center gap-0.5 ml-1 shrink-0",children:"loading"===g?t.jsx(r,{className:a("text-text-muted animate-spin",T?"w-3 h-3":"w-3.5 h-3.5")}):t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:_,className:a("rounded hover:bg-accent-success/15 text-accent-success transition-colors",T?"p-0.5":"p-1"),title:"Save",children:t.jsx(n,{className:T?"w-3 h-3":"w-3.5 h-3.5"})}),t.jsx("button",{onClick:S,className:a("rounded hover:bg-accent-danger/15 text-text-muted hover:text-accent-danger transition-colors",T?"p-0.5":"p-1"),title:"Cancel (Esc)",children:t.jsx(l,{className:T?"w-3 h-3":"w-3.5 h-3.5"})})]})})]}),R=t.jsxs("div",{className:a(E,ie,P,"flex items-center transition-all","bg-white/[0.03] border border-white/[0.06]",k&&"cursor-pointer hover:border-white/10 hover:bg-white/[0.05]",T?"justify-end min-w-[80px]":""),onClick:k?C:void 0,children:[t.jsx("span",{className:a("type-data text-text-primary",!T&&"flex-1"),children:i}),"success"===g&&t.jsx(n,{className:a("text-accent-success shrink-0",T?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")}),"error"===g&&t.jsx(l,{className:a("text-accent-danger shrink-0",T?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")}),"idle"===g&&k&&t.jsx(c,{className:a("text-text-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?t.jsxs("div",{className:a("group flex items-center justify-between",p),children:[t.jsx("label",{className:"type-label text-text-muted shrink-0",children:s}),h?M:R]}):t.jsxs("div",{className:a("group",p),children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:s}),h?M:R]})}async function me(e){return i("/api/update_web_config",{method:"POST",body:JSON.stringify(e)})}const ue=e.memo(function(){const{theme:e}=o(),{colorScheme:a}=e,s=d.find(e=>e.colorScheme===a)??d[0];return t.jsx("div",{className:"h-10 flex items-center justify-center",children:t.jsx("span",{className:"font-medium transition-all duration-300 leading-none text-center text-text-secondary",style:{fontFamily:"Inter, system-ui, sans-serif",fontSize:"clamp(0.75rem, 0.6rem + 1.5vw, 1.1rem)",letterSpacing:"-0.02em"},children:s.displayName})})}),xe=e.memo(function(){const{theme:e,setThemePreset:s}=o(),{colorScheme:r}=e,n=(d.find(e=>e.colorScheme===r)??d[0]).id;return t.jsx("div",{className:"grid grid-cols-2 gap-3 w-full",children:d.map(e=>{const r=n===e.id,l="breeze dark"===e.id;return t.jsxs("button",{type:"button",title:e.displayName,className:a("flex flex-col items-stretch rounded-lg transition-all duration-200 ease-out overflow-hidden cursor-pointer",r?"ring-2 ring-accent-primary scale-[1.02]":"opacity-70 hover:opacity-100"),onClick:()=>s(e.id),children:[t.jsx("div",{className:a("w-full aspect-[3/2] flex items-center justify-center",l?"bg-[#242627]":"bg-[#EFF0F1]"),children:t.jsx("span",{className:a("text-[1.5em] font-bold font-mono",l?"text-[#58b99d]":"text-[#31363B]"),children:l?">":"☀"})}),t.jsx("div",{className:"flex flex-col w-full",children:e.paletteColors.map((e,a)=>t.jsx("div",{className:"flex",children:e.map((e,a)=>t.jsx("div",{className:"flex-1 aspect-[2/1]",style:{backgroundColor:e}},a))},a))})]},e.id)})})}),pe=e.memo(function({layout:a="horizontal"}){return e.useEffect(()=>{M()},[]),"logo-only"===a?t.jsx(ue,{}):"thumbnails-only"===a?t.jsx(xe,{}):t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsx(ue,{}),t.jsx(xe,{})]})}),he=2e3;function ye(t,a,s){const[r,n]=e.useState("idle"),[l,c]=e.useState(null),i=e.useRef(!0),o=e.useRef(null),d=e.useRef(null),m=e.useRef(!1),u=e.useRef("idle"),x=e.useRef(t),p=e.useRef(a),h=e.useRef(s);return u.current=r,x.current=t,p.current=a,h.current=s,e.useEffect(()=>(i.current=!0,()=>{i.current=!1,o.current&&clearTimeout(o.current),d.current&&clearTimeout(d.current)}),[]),{enabled:null!==l?l:t,status:r,toggle:e.useCallback(async e=>{if("loading"===u.current)return;const t=x.current;o.current&&clearTimeout(o.current),d.current&&clearTimeout(d.current),m.current=!1,c(e),n("loading"),o.current=setTimeout(()=>{!m.current&&i.current&&(c(t),n("error"),d.current=setTimeout(()=>{i.current&&(n("idle"),c(null))},he))},1e4);try{if(await p.current(e),m.current=!0,o.current&&clearTimeout(o.current),!i.current)return;n("success"),d.current=setTimeout(()=>{var e;i.current&&(n("idle"),c(null),null==(e=h.current)||e.call(h))},he)}catch{if(m.current=!0,o.current&&clearTimeout(o.current),!i.current)return;c(t),n("error"),d.current=setTimeout(()=>{i.current&&(n("idle"),c(null))},he)}},[])}}function be(){const{latitude:s,longitude:c,enabled:i,setLocation:o,enable:d,disable:u,clear:x}=m(),[p,h]=e.useState(!1),[y,b]=e.useState(""),[f,g]=e.useState(""),[j,v]=e.useState("idle"),[N,w]=e.useState(null),k=e.useRef(null),C=e.useRef(null),S=e.useRef(!0);e.useEffect(()=>(S.current=!0,()=>{S.current=!1,C.current&&clearTimeout(C.current)}),[]);const _=()=>{h(!1),w(null)};e.useEffect(()=>{if(!p)return;const e=e=>{"loading"!==j&&k.current&&!k.current.contains(e.target)&&_()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[p,j]);const F=null!==s&&null!==c;return t.jsx(z,{children:t.jsxs("div",{ref:k,children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx(I,{icon:t.jsx(ae,{}),title:"Stealth",largeTitle:!0}),t.jsxs("div",{className:"flex items-center gap-1",children:[F&&!p&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>{i?u():d()},className:a("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2 mr-2",i?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle"),title:i?"Disable stealth location":"Enable stealth location",children:t.jsx("span",{className:a("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",i?"translate-x-5":"translate-x-0.5")})}),t.jsx("button",{onClick:()=>{x(),h(!1)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-accent-danger hover:bg-accent-danger/10",title:"Clear stealth location",children:t.jsx(T,{className:"w-4 h-4"})})]}),p?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:_,disabled:"loading"===j,className:a("p-2 rounded-lg transition-colors","loading"===j?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:t.jsx(l,{className:"w-4 h-4"})}),t.jsx("button",{onClick:()=>{if("loading"===j)return;C.current&&clearTimeout(C.current);const e=((e,t)=>{const a=parseFloat(e),s=parseFloat(t);return isNaN(a)||isNaN(s)?"Please enter valid numbers":a<-90||a>90?"Latitude must be between -90 and 90":s<-180||s>180?"Longitude must be between -180 and 180":0===a&&0===s?"Coordinates (0, 0) are invalid":null})(y,f);if(e)return void w(e);v("loading"),w(null);const t=parseFloat(y),a=parseFloat(f);o(t,a),i||d(),v("success"),C.current=setTimeout(()=>{S.current&&(v("idle"),h(!1))},1e3)},disabled:"loading"===j,className:a("p-2 rounded-lg transition-colors","loading"===j?"text-accent-primary cursor-wait":"success"===j?"text-accent-success":"error"===j?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===j?t.jsx(r,{className:"w-4 h-4 animate-spin"}):"success"===j?t.jsx(n,{className:"w-4 h-4"}):"error"===j?t.jsx(l,{className:"w-4 h-4"}):t.jsx(n,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:()=>{b((null==s?void 0:s.toFixed(6))??""),g((null==c?void 0:c.toFixed(6))??""),w(null),h(!0)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:F?"Edit stealth location":"Set stealth location",children:t.jsx(Z,{className:"w-4 h-4"})})]})]}),t.jsx("div",{className:"bg-accent-tertiary/5 rounded-xl p-3 mb-4",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx(K,{className:"w-4 h-4 text-accent-tertiary flex-shrink-0 mt-0.5"}),t.jsxs("p",{className:"type-body-sm text-text-muted",children:[t.jsx("span",{className:"text-text-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 — ",t.jsx("span",{className:"text-accent-tertiary",children:"never sent to config.yaml or the mesh"}),"."]})]})}),N&&t.jsx("div",{className:"text-xs mb-3 px-2 py-1.5 rounded-md text-accent-danger bg-accent-danger/10",children:N}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:p?"Latitude (°)":"Latitude"}),t.jsx("div",{className:a("h-[38px] rounded-full px-4 flex items-center transition-colors","bg-subtle-fill"),children:p?t.jsx("input",{type:"number",value:y,onChange:e=>b(e.target.value),step:"0.000001",min:"-90",max:"90",placeholder:"e.g. 34.052234",className:"w-full bg-transparent text-text-primary focus:outline-none type-data placeholder:text-text-muted/50"}):t.jsx("span",{className:a("type-data",F&&i?"text-text-primary":"text-text-muted"),children:F?s.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:p?"Longitude (°)":"Longitude"}),t.jsx("div",{className:a("h-[38px] rounded-full px-4 flex items-center transition-colors","bg-subtle-fill"),children:p?t.jsx("input",{type:"number",value:f,onChange:e=>g(e.target.value),step:"0.000001",min:"-180",max:"180",placeholder:"e.g. -118.243685",className:"w-full bg-transparent text-text-primary focus:outline-none type-data placeholder:text-text-muted/50"}):t.jsx("span",{className:a("type-data",F&&i?"text-text-primary":"text-text-muted"),children:F?c.toFixed(6):"Not set"})})]})]}),F&&!p&&t.jsx("div",{className:"mt-3 pt-3 border-t border-border-subtle",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:a("w-2 h-2 rounded-full",i?"bg-accent-success":"bg-text-muted")}),t.jsx("span",{className:"type-body-sm text-text-muted",children:i?"Stealth location active — you appear on maps with these coordinates":"Stealth location disabled — coordinates saved but not in use"})]})})]})})}const fe=[{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"}],ge=[5,6,7,8,9,10,11,12],je=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}],ve="radioConfig";function Ne({node:e,level:s,expandedKeys:r,selectedKeyId:n,globalFloodPolicy:l,onSelect:c,onToggle:i}){const o=r.has(e.id),d=n===e.id,m=e.children&&e.children.length>0,u="allow"===l;return t.jsxs("div",{children:[t.jsxs("div",{className:a("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",d?"bg-accent-primary/15":"hover:bg-subtle-fill",u&&"opacity-50 cursor-not-allowed"),style:{marginLeft:16*s+"px"},onClick:()=>!u&&c(e.id),children:[m?t.jsx("button",{onClick:t=>{t.stopPropagation(),i(e.id)},className:"p-1 hover:bg-subtle-fill-hover rounded-full transition-colors",children:t.jsx(G,{className:a("w-3.5 h-3.5 text-text-muted transition-transform",o&&"rotate-90")})}):t.jsx("span",{className:"w-5"}),t.jsx(Y,{className:"w-4 h-4 text-accent-primary flex-shrink-0"}),t.jsx("span",{className:"type-data text-text-primary flex-1 truncate",children:e.name}),t.jsx("span",{className:a("type-data-xs px-2 py-0.5 rounded-full","allow"===e.floodPolicy?"bg-accent-success/15 text-accent-success":"bg-accent-danger/15 text-accent-danger"),children:"allow"===e.floodPolicy?"Allow":"Deny"})]}),m&&o&&t.jsx("div",{children:e.children.map(e=>t.jsx(Ne,{node:e,level:s+1,expandedKeys:r,selectedKeyId:n,globalFloodPolicy:l,onSelect:c,onToggle:i},e.id))})]})}function we(){var s,l,c,o,d,m;const{stats:M,setMode:G,clearModeMutation:Y,setDutyCycleConfig:Z,clearDutyCycleMutation:ae,fetchStats:se,startMutation:re,clearMutation:ne}=u(),le=null==(s=null==M?void 0:M.config)?void 0:s.radio,ce=null==(l=null==M?void 0:M.config)?void 0:l.repeater,ie=null==(c=null==M?void 0:M.config)?void 0:c.duty_cycle,ue=(null==M?void 0:M.node_name)||(null==(o=null==M?void 0:M.config)?void 0:o.node_name)||"Unknown Node",xe=(null==ce?void 0:ce.mode)??"forward",he=(null==ie?void 0:ie.enforcement_enabled)??!1,we=null==(d=null==M?void 0:M.config)?void 0:d.delays,ke=e.useRef(!0);e.useEffect(()=>(ke.current=!0,()=>{ke.current=!1}),[]);const Ce=null==(m=null==M?void 0:M.config)?void 0:m.web,[Se,_e]=e.useState([]),[Fe,Te]=e.useState(!1),[Ee,Pe]=e.useState(null),[Me,Re]=e.useState(!1),[ze,Ae]=e.useState(""),[Le,De]=e.useState(null),[Ie,Ke]=e.useState(!1),[Ve,He]=e.useState(null),[qe,Oe]=e.useState(!1),[$e,Be]=e.useState(!1),[Xe,Ge]=e.useState(!1),[Ue,We]=e.useState([]),[Ye,Je]=e.useState(!1),[Qe,Ze]=e.useState(null),[et,tt]=e.useState("deny"),[at,st]=e.useState(!1),[rt,nt]=e.useState(null),[lt,ct]=e.useState(new Set),[it,ot]=e.useState(!1),[dt,mt]=e.useState(!1),[ut,xt]=e.useState(!1),[pt,ht]=e.useState(null),[yt,bt]=e.useState(null),[ft,gt]=e.useState(""),[jt,vt]=e.useState("deny"),[Nt,wt]=e.useState(!1),[kt,Ct]=e.useState(!0),[St,_t]=e.useState(!1),[Ft,Tt]=e.useState(!0),[Et,Pt]=e.useState("idle"),[Mt,Rt]=e.useState(!1),[zt,At]=e.useState(!1),Lt=e.useCallback(()=>{const e=null==we?void 0:we.tx_delay_factor;return e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??1:"number"==typeof e?e:1},[we]),Dt=e.useCallback(()=>{const e=null==we?void 0:we.direct_tx_delay_factor;return"number"==typeof e?e:.5},[we]),It=e.useCallback(()=>{const e=null==ie?void 0:ie.max_airtime_percent;return"number"==typeof e?e:e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??6:6},[ie]),Kt=ye("forward"===xe,async e=>{await G(e?"forward":"monitor")},Y),Vt=ye(he,async e=>{await Z({max_airtime_percent:It(),enforcement_enabled:e})},ae),Ht=ye((null==Ce?void 0:Ce.cors_enabled)??!1,async e=>{var t;const a=await me({web:{cors_enabled:e}});if(!a.success&&!(null==(t=a.data)?void 0:t.persisted))throw new Error("CORS update failed");await se()}),qt=e.useCallback(async e=>{re(ve);try{const t=await x(e);if(!t.success)throw new Error(t.error||"Failed to save");await se({force:!0}).catch(()=>{})}finally{ne(ve)}},[re,ne,se]);e.useEffect(()=>{(async()=>{Tt(!0);try{const e=await w();e.success&&e.data?_t(e.data.exists):_t(!1);const t=null==Ce?void 0:Ce.web_path;Ct(!t||""===t)}catch{_t(!1)}finally{Tt(!1)}})()},[null==Ce?void 0:Ce.web_path]);const Ot=async e=>{var t;if("loading"!==Et){Pt("loading");try{const a=await me({web:{web_path:e?null:"/opt/pymc_console/web/html"}});if(!ke.current)return;a.success||(null==(t=a.data)?void 0:t.persisted)?(Ct(e),Pt("success"),Rt(!0),setTimeout(()=>{ke.current&&Pt("idle")},2e3)):(Pt("error"),setTimeout(()=>{ke.current&&Pt("idle")},2e3))}catch{if(!ke.current)return;Pt("error"),setTimeout(()=>{ke.current&&Pt("idle")},2e3)}}},$t=e.useCallback(async()=>{Te(!0),Pe(null);try{const e=await async function(){return i("/auth/tokens")}();_e(e.tokens||[])}catch(e){Pe(e instanceof Error?e.message:"Failed to fetch tokens")}finally{Te(!1)}},[]);e.useEffect(()=>{$t()},[$t]);const Bt=async()=>{if(ze.trim()){Oe(!0),Pe(null);try{const e=await async function(e){return i("/auth/tokens",{method:"POST",body:JSON.stringify({name:e})})}(ze.trim());De(e.token||null),Re(!1),Ke(!0),Ae(""),await $t()}catch(e){Pe(e instanceof Error?e.message:"Failed to create token")}finally{Oe(!1)}}else Pe("Token name is required")},Xt=e=>e?new Date(1e3*e).toLocaleString():"Never",Gt=e.useCallback(e=>{const t=new Map,a=[];return e.forEach(e=>{const a={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:[]};t.set(e.id,a)}),t.forEach(e=>{e.parent_id&&t.has(e.parent_id)?t.get(e.parent_id).children.push(e):a.push(e)}),a},[]),Ut=e.useCallback(async()=>{Je(!0),Ze(null);try{const e=await N();e.success&&e.data?We(Gt(e.data)):Ze(e.error||"Failed to load transport keys")}catch(e){Ze(e instanceof Error?e.message:"Unknown error occurred")}finally{Je(!1)}},[Gt]);e.useEffect(()=>{Ut()},[Ut]);const Wt=e.useCallback((e,t)=>{for(const a of e){if(a.id===t)return a;if(a.children){const e=Wt(a.children,t);if(e)return e}}return null},[]),Yt=e.useCallback(()=>{if(!rt)return;const e=Wt(Ue,rt);return null==e?void 0:e.name},[rt,Ue,Wt]),Jt=e.useCallback(e=>{ct(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),Qt=async e=>{st(!0),Ze(null);try{const t=await C("allow"===e);t.success?tt(e):Ze(t.error||"Failed to update global flood policy")}catch(t){Ze(t instanceof Error?t.message:"Failed to update global flood policy")}finally{st(!1)}},Zt=async()=>{if(ft.trim()){wt(!0),Ze(null);try{const e=await S({name:ft.trim(),flood_policy:jt,parent_id:rt??void 0});e.success?(await Ut(),ot(!1),gt(""),vt("deny")):Ze(e.error||"Failed to add transport key")}catch(e){Ze(e instanceof Error?e.message:"Failed to add transport key")}finally{wt(!1)}}else Ze("Key name is required")},ea=e.useCallback(()=>{if(!rt)return;const e=Wt(Ue,rt);e&&(ht({...e}),mt(!0))},[rt,Ue,Wt]);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&(it&&(ot(!1),gt(""),vt("deny")),dt&&(mt(!1),ht(null)),ut&&(xt(!1),bt(null)),Me&&(Re(!1),Ae("")),Ie&&(Ke(!1),De(null)))};if(it||dt||ut||Me||Ie)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[it,dt,ut,Me,Ie]);const ta=e.useCallback(()=>{if(!rt)return;const e=Wt(Ue,rt);e&&(bt(e),xt(!0))},[rt,Ue,Wt]);return t.jsxs(A,{children:[t.jsx(L,{title:"Configuration",icon:t.jsx(p,{})}),t.jsxs(D,{children:[t.jsxs(V,{template:"standard",children:[t.jsx(H,{span:12,md:6,children:t.jsxs(z,{children:[t.jsx(I,{icon:t.jsx(h,{}),title:"Repeater Settings",largeTitle:!0}),ce?t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx("div",{className:"col-span-2",children:t.jsx(oe,{label:"Node Name",value:ue,onSave:async e=>qt({node_name:e}),placeholder:"Enter node name",maxLength:50})}),t.jsx(oe,{label:"Latitude",value:0!==ce.latitude?ce.latitude.toFixed(6):"Not set",editValue:String(ce.latitude),type:"number",suffix:"°",step:1e-6,min:-90,max:90,onSave:async e=>qt({latitude:parseFloat(e)})}),t.jsx(oe,{label:"Longitude",value:0!==ce.longitude?ce.longitude.toFixed(6):"Not set",editValue:String(ce.longitude),type:"number",suffix:"°",step:1e-6,min:-180,max:180,onSave:async e=>qt({longitude:parseFloat(e)})}),t.jsx(oe,{label:"Advert Interval",value:ce.send_advert_interval_hours>0?`${ce.send_advert_interval_hours}h`:"Disabled",editValue:String(ce.send_advert_interval_hours),type:"number",suffix:"hours",min:0,max:48,description:"0 = disabled, 3-48 hours",onSave:async e=>qt({flood_advert_interval_hours:parseInt(e,10)})}),t.jsx(oe,{label:"Score-based TX",value:ce.use_score_for_tx?"Enabled":"Disabled",readOnly:!0})]}):t.jsx("p",{className:"text-text-muted",children:"Loading repeater settings..."})]})}),t.jsx(H,{span:12,md:6,children:t.jsxs(z,{children:[t.jsx(I,{icon:t.jsx(U,{}),title:"Radio Configuration",largeTitle:!0}),le?t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(oe,{label:"Frequency",value:y(le.frequency),editValue:(le.frequency/1e6).toFixed(3),type:"number",suffix:"MHz",step:.001,min:400,max:930,onSave:async e=>qt({frequency_mhz:parseFloat(e)})}),t.jsx(oe,{label:"TX Power",value:`${le.tx_power} dBm`,editValue:String(le.tx_power),type:"number",suffix:"dBm",min:2,max:30,onSave:async e=>qt({tx_power:parseInt(e,10)})}),t.jsx(de,{label:"Bandwidth",value:b(le.bandwidth),editValue:le.bandwidth/1e3,options:fe,onSave:async e=>qt({bandwidth_khz:parseFloat(e)})}),t.jsx(de,{label:"Spreading Factor",value:`SF${le.spreading_factor}`,editValue:le.spreading_factor,options:ge.map(e=>({value:e,label:`SF${e}`})),onSave:async e=>qt({spreading_factor:parseInt(e,10)})}),t.jsx(de,{label:"Coding Rate",value:`4/${le.coding_rate}`,editValue:le.coding_rate,options:je,onSave:async e=>qt({coding_rate:parseInt(e,10)})}),t.jsx(oe,{label:"Preamble",value:`${le.preamble_length} symbols`,readOnly:!0})]}):t.jsx("p",{className:"text-text-muted",children:"Loading radio configuration..."})]})})]}),t.jsxs(V,{template:"standard",children:[t.jsx(H,{span:12,md:6,children:t.jsxs(z,{children:[t.jsx(I,{icon:t.jsx(f,{}),title:"Operating Mode",largeTitle:!0}),t.jsx("p",{className:"type-label text-text-muted mb-3",children:"Control how the repeater handles packets"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[t.jsxs("div",{className:"flex-1 space-y-4",children:[t.jsx(g,{enabled:Kt.enabled,onChange:Kt.toggle,label:"Repeat",status:Kt.status,size:"md"}),t.jsx(g,{enabled:Vt.enabled,onChange:Vt.toggle,label:"Duty Cycle",status:Vt.status,size:"md"}),t.jsx(oe,{label:"Max Airtime",layout:"inline",value:`${It().toFixed(1)}%`,editValue:String(It()),type:"number",suffix:"%",step:.5,min:.1,max:100,onSave:async e=>{await Z({max_airtime_percent:parseFloat(e),enforcement_enabled:he}),ae()}})]}),t.jsx("div",{className:"hidden sm:block w-px bg-border-subtle"}),t.jsxs("div",{className:"flex-1 pt-4 sm:pt-0 border-t sm:border-t-0 border-border-subtle",children:[t.jsx("label",{className:"type-label text-text-muted block mb-3",children:"TX Delays"}),t.jsxs("div",{className:"space-y-3",children:[t.jsx(oe,{label:"Flood",layout:"inline",value:`${Lt().toFixed(2)}x`,editValue:String(Lt()),type:"number",suffix:"x",step:.1,min:0,max:5,onSave:async e=>qt({tx_delay_factor:parseFloat(e)})}),t.jsx(oe,{label:"Direct",layout:"inline",value:`${Dt().toFixed(2)}s`,editValue:String(Dt()),type:"number",suffix:"s",step:.1,min:0,max:5,onSave:async e=>qt({direct_tx_delay_factor:parseFloat(e)})})]})]})]})]})}),t.jsx(H,{span:12,md:6,children:t.jsxs(z,{children:[t.jsx(I,{icon:t.jsx(p,{}),title:"App Settings",largeTitle:!0}),t.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Appearance and web server options."}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(g,{enabled:Ht.enabled,onChange:Ht.toggle,label:"Enable CORS",description:"Allow cross-origin API access",status:Ht.status,size:"md"}),t.jsx("div",{children:t.jsx(pe,{})})]})]})})]}),t.jsx(V,{template:"auto",children:t.jsxs(z,{children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(J,{className:"icon-md text-accent-primary"}),"Regions / Transport Keys"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage regional key hierarchy for flood control"})]}),t.jsxs("div",{className:"flex gap-2 flex-wrap",children:[t.jsxs("button",{onClick:()=>ot(!0),disabled:"allow"===et,className:a("flex items-center gap-1.5 h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium","allow"===et?"bg-subtle-fill text-text-muted cursor-not-allowed":"bg-accent-success/10 hover:bg-accent-success/20 text-accent-success"),children:[t.jsx(E,{className:"w-3.5 h-3.5"}),"Add"]}),t.jsx("button",{onClick:ea,disabled:!rt||"allow"===et,className:a("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",rt&&"allow"!==et?"bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary":"bg-subtle-fill text-text-muted cursor-not-allowed"),children:"Edit"}),t.jsx("button",{onClick:ta,disabled:!rt||"allow"===et,className:a("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",rt&&"allow"!==et?"bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger":"bg-subtle-fill text-text-muted cursor-not-allowed"),children:"Delete"})]})]}),t.jsx("div",{className:"bg-subtle-fill radius-card p-4 mb-4",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:a("w-10 h-10 rounded-full flex items-center justify-center","allow"===et?"bg-accent-success/20":"bg-accent-danger/20"),children:"allow"===et?t.jsx(ee,{className:"w-5 h-5 text-accent-success"}):t.jsx(te,{className:"w-5 h-5 text-accent-danger"})}),t.jsxs("div",{children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Global Flood Policy"}),t.jsx("p",{className:"type-body-sm text-text-muted",children:"Master control for repeater flooding"})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex bg-subtle-fill rounded-full p-1",children:[t.jsx("button",{onClick:()=>Qt("deny"),disabled:at,className:a("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","deny"===et?"bg-accent-danger/20 text-accent-danger":"text-text-muted hover:text-text-secondary",at&&"opacity-50"),children:"Deny"}),t.jsx("button",{onClick:()=>Qt("allow"),disabled:at,className:a("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","allow"===et?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-secondary",at&&"opacity-50"),children:"Allow"})]}),at&&t.jsx(r,{className:"w-4 h-4 animate-spin text-text-muted"})]})]})}),Qe&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:Qe}),t.jsx("div",{className:"bg-subtle-fill radius-card p-4 min-h-[120px]",children:Ye?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(r,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading transport keys..."})]}):0===Ue.length?t.jsxs("div",{className:"text-center py-6",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-subtle-fill mx-auto mb-3 flex items-center justify-center",children:t.jsx(J,{className:"w-6 h-6 text-text-muted/50"})}),t.jsx("p",{className:"type-body text-text-muted",children:"No transport keys found"}),t.jsx("p",{className:"type-body-sm text-text-muted/70 mt-1",children:"Add your first transport key to get started"})]}):t.jsx("div",{className:"space-y-1",children:Ue.map(e=>t.jsx(Ne,{node:e,level:0,expandedKeys:lt,selectedKeyId:rt,globalFloodPolicy:et,onSelect:nt,onToggle:Jt},e.id))})})]})}),t.jsx(V,{template:"auto",children:t.jsxs(z,{children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(q,{className:"icon-md text-accent-primary"}),"API Tokens"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage API tokens for machine-to-machine authentication"})]}),t.jsxs("button",{onClick:()=>Re(!0),className:"flex items-center justify-center gap-2 h-[32px] px-4 bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary rounded-full transition-colors type-body-sm font-medium",children:[t.jsx(E,{className:"w-4 h-4"}),"Create Token"]})]}),t.jsx("div",{className:"bg-accent-tertiary/5 radius-card p-4 mb-4",children:t.jsxs("div",{className:"flex gap-3",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-tertiary/20 flex items-center justify-center flex-shrink-0",children:t.jsx(K,{className:"w-4 h-4 text-accent-tertiary"})}),t.jsxs("div",{className:"type-body-sm text-text-muted",children:[t.jsxs("p",{children:[t.jsx("span",{className:"text-text-secondary",children:"API tokens"})," are used for machine-to-machine authentication. Include the token in the ",t.jsx("code",{className:"type-code bg-accent-tertiary/20 px-1.5 py-0.5 rounded-full text-accent-tertiary",children:"X-API-Key"})," header when making API requests."]}),t.jsx("p",{className:"mt-1 text-text-muted/70",children:"Tokens are only shown once at creation. Store them securely."})]})]})}),Ee&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:Ee}),Fe&&0===Se.length?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(r,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading tokens..."})]}):Se.length>0?t.jsx("div",{className:"space-y-2",children:Se.map(e=>t.jsx("div",{className:"bg-subtle-fill hover:bg-subtle-fill-strong radius-card p-4 transition-base",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-accent-primary/10 flex items-center justify-center flex-shrink-0",children:t.jsx(q,{className:"w-5 h-5 text-accent-primary"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h3",{className:"type-body text-text-primary font-medium truncate",children:e.name}),t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-0.5",children:[t.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Created: ",Xt(e.created_at)]}),t.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Last used: ",Xt(e.last_used)]})]})]})]}),t.jsxs("button",{onClick:()=>He({id:e.id,name:e.name}),disabled:$e,className:"h-[32px] px-4 bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger rounded-full transition-colors disabled:opacity-50 type-body-sm font-medium flex items-center justify-center gap-1.5",children:[t.jsx(T,{className:"w-3.5 h-3.5"}),"Revoke"]})]})},e.id))}):t.jsxs("div",{className:"bg-subtle-fill radius-card p-6 text-center",children:[t.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:t.jsx(q,{className:"w-7 h-7 text-text-muted/50"})}),t.jsx("h3",{className:"type-body text-text-primary font-medium mb-1",children:"No API Tokens"}),t.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Create a token to enable API access"}),t.jsx("button",{onClick:()=>Re(!0),className:"h-[32px] px-4 bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary rounded-full transition-colors type-body-sm font-medium",children:"Create Your First Token"})]})]})}),t.jsx(V,{template:"auto",children:t.jsxs(z,{children:[t.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(Q,{className:"icon-md text-accent-primary"}),"Web Frontend"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Choose which web interface to use"})]})}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-3",children:[t.jsxs("label",{className:a("flex items-start gap-3 p-4 bg-subtle-fill radius-card border-2 cursor-pointer transition-base",kt?"border-accent-primary bg-accent-primary/5":"border-transparent hover:border-accent-primary/30","loading"===Et&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:kt,onChange:()=>Ot(!0),disabled:"loading"===Et,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"type-body text-text-primary font-medium",children:"Default Frontend"}),t.jsx("a",{href:"https://github.com/rightup/pyMC_Repeater",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"type-data-xs bg-accent-tertiary/15 text-accent-tertiary px-2.5 py-0.5 rounded-full font-medium hover:bg-accent-tertiary/25 transition-colors",children:"@RightUp"})]}),t.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Built-in pyMC Repeater web interface"}),t.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_repeater/repeater/web/html"})]})]}),t.jsxs("label",{className:a("flex items-start gap-3 p-4 bg-subtle-fill radius-card border-2 cursor-pointer transition-base",kt?"border-transparent hover:border-accent-primary/30":"border-accent-primary bg-accent-primary/5","loading"===Et&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:!kt,onChange:()=>Ot(!1),disabled:"loading"===Et,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"type-body text-text-primary font-medium",children:"PyMC Console"}),t.jsx("span",{className:"type-data-xs bg-accent-secondary/15 text-accent-secondary px-2.5 py-0.5 rounded-full font-medium",children:"@Treehouse ⚡"})]}),t.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Alternative web interface for pyMC Repeater"}),t.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_console/web/html"})]})]})]}),!Ft&&t.jsx("div",{className:a("bg-subtle-fill radius-card p-4",St?"border border-accent-success/20":"border border-accent-tertiary/20"),children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:a("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",St?"bg-accent-success/20":"bg-accent-tertiary/20"),children:St?t.jsx(O,{className:"w-4 h-4 text-accent-success"}):t.jsx(K,{className:"w-4 h-4 text-accent-tertiary"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:St?"PyMC Console has been detected":"PyMC Console Not Installed"}),St?t.jsxs("p",{className:"type-body-sm text-text-muted mt-1",children:["PyMC Console is installed at ",t.jsx("code",{className:"type-code bg-accent-success/10 px-1.5 py-0.5 rounded-full text-accent-success",children:"/opt/pymc_console/web/html"})]}):t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"type-body-sm text-text-muted mt-1 mb-3",children:["PyMC Console must be installed at ",t.jsx("code",{className:"type-code bg-accent-tertiary/10 px-1.5 py-0.5 rounded-full text-accent-tertiary",children:"/opt/pymc_console/web/html"})," before selecting this option."]}),t.jsxs("a",{href:"https://github.com/dmduran12/pymc_console-dist",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 h-[32px] px-4 bg-accent-tertiary/10 hover:bg-accent-tertiary/20 text-accent-tertiary rounded-full type-body-sm font-medium transition-colors",children:[t.jsx(W,{className:"w-4 h-4"}),"PyMC Console Install Instructions"]})]})]})]})}),Mt&&t.jsx("div",{className:"bg-subtle-fill radius-card p-4 border border-accent-secondary/30",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-secondary/20 flex items-center justify-center flex-shrink-0",children:t.jsx($,{className:"w-4 h-4 text-accent-secondary"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Service restart required"}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Web frontend changes will take effect after restarting the pymc-repeater service."})]})]}),t.jsx("button",{onClick:async()=>{if(!zt){At(!0);try{await k(),Rt(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{Rt(!1),setTimeout(()=>{window.location.reload()},3e3)}}},disabled:zt,className:"h-[32px] px-4 bg-accent-secondary/10 hover:bg-accent-secondary/20 text-accent-secondary rounded-full transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2 whitespace-nowrap type-body-sm font-medium",children:zt?t.jsxs(t.Fragment,{children:[t.jsx(r,{className:"w-4 h-4 animate-spin"}),"Restarting..."]}):t.jsxs(t.Fragment,{children:[t.jsx(B,{className:"w-4 h-4"}),"Restart Now"]})})]})})]})]})}),M&&t.jsx(V,{template:"auto",children:t.jsx(R,{nodeName:ue,repeaterVersion:M.version,coreVersion:M.core_version,localHash:M.local_hash,publicKey:M.public_key})}),M&&(0===(null==ce?void 0:ce.latitude)||!(null==ce?void 0:ce.latitude))&&(0===(null==ce?void 0:ce.longitude)||!(null==ce?void 0:ce.longitude))&&t.jsx(V,{template:"auto",children:t.jsx(be,{})})]}),Me&&t.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:t.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[t.jsx("h3",{id:"create-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Create API Token"}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(j,{label:"Token Name",type:"text",value:ze,onChange:e=>Ae(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&&Bt(),autoFocus:!0}),t.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{Re(!1),Ae(""),Pe(null)},disabled:qe,className:"px-4 py-2 bg-bg-subtle hover-bg text-text-secondary radius-inner border-control transition-base disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:Bt,disabled:qe||!ze.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary radius-inner border border-accent-primary/50 transition-base disabled:opacity-50 flex items-center gap-2",children:qe?t.jsxs(t.Fragment,{children:[t.jsx(r,{className:"w-4 h-4 animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),Ie&&Le&&t.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&&Ke(!1),role:"dialog","aria-modal":"true","aria-labelledby":"show-token-modal-title",children:t.jsxs("div",{className:"surface-modal radius-card p-6 max-w-lg w-full",children:[t.jsx("h3",{id:"show-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Token Created Successfully"}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 radius-inner p-3",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx($,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm text-text-secondary",children:[t.jsx("strong",{children:"Save this token now!"})," For security reasons, it will not be shown again."]})]})}),t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-text-primary block mb-1.5",children:"Your API Token"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(v,{value:Le,readOnly:!0,className:"flex-1 font-mono"}),t.jsxs("button",{onClick:()=>{Le&&(navigator.clipboard.writeText(Le),Ge(!0),setTimeout(()=>Ge(!1),2e3))},className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary radius-inner border border-accent-primary/50 transition-base flex items-center gap-2",title:"Copy to clipboard",children:[Xe?t.jsx(n,{className:"w-4 h-4 text-accent-success"}):t.jsx(X,{className:"w-4 h-4"}),Xe?"Copied!":"Copy"]})]})]}),t.jsxs("div",{className:"bg-accent-tertiary/10 border border-accent-tertiary/30 radius-inner p-3",children:[t.jsx("p",{className:"text-sm text-text-secondary mb-2",children:t.jsx("strong",{children:"Usage Example:"})}),t.jsxs("code",{className:"block bg-accent-tertiary/20 px-3 py-2 rounded text-xs text-accent-tertiary font-mono overflow-x-auto",children:['curl -H "X-API-Key: ',Le.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),t.jsx("div",{className:"flex justify-end mt-6",children:t.jsx("button",{onClick:()=>{Ke(!1),De(null)},className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary radius-inner border border-accent-primary/50 transition-base",children:"Done"})})]})]})}),t.jsx(P,{isOpen:!!Ve,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${null==Ve?void 0:Ve.name}'? This action cannot be undone.`,confirmLabel:$e?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:async()=>{if(Ve){Be(!0),Pe(null);try{await async function(e){return i(`/auth/tokens/${e}`,{method:"DELETE"})}(Ve.id),await $t(),He(null)}catch(e){Pe(e instanceof Error?e.message:"Failed to revoke token")}finally{Be(!1)}}},onCancel:()=>He(null)}),it&&t.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&&ot(!1),role:"dialog","aria-modal":"true","aria-labelledby":"add-key-modal-title",children:t.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[t.jsx("h3",{id:"add-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Add Transport Key"}),t.jsxs("div",{className:"space-y-4",children:[rt&&t.jsxs("div",{className:"bg-accent-tertiary/10 border border-accent-tertiary/30 radius-inner p-3 text-sm text-text-secondary",children:["Adding as child of: ",t.jsx("strong",{className:"text-text-primary",children:Yt()})]}),t.jsx(j,{label:"Key Name",type:"text",value:ft,onChange:e=>gt(e.target.value),placeholder:"e.g., Region Name, Group Key",onKeyDown:e=>"Enter"===e.key&&Zt(),autoFocus:!0}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),t.jsxs("div",{className:"flex bg-bg-subtle radius-inner border-control p-1",children:[t.jsx("button",{onClick:()=>vt("deny"),className:a("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===jt?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),t.jsx("button",{onClick:()=>vt("allow"),className:a("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===jt?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),t.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{ot(!1),gt(""),vt("deny")},disabled:Nt,className:"px-4 py-2 bg-bg-subtle hover-bg text-text-secondary radius-inner border-control transition-base disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:Zt,disabled:Nt||!ft.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary radius-inner border border-accent-primary/50 transition-base disabled:opacity-50 flex items-center gap-2",children:Nt?t.jsxs(t.Fragment,{children:[t.jsx(r,{className:"w-4 h-4 animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),dt&&pt&&t.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&&mt(!1),role:"dialog","aria-modal":"true","aria-labelledby":"edit-key-modal-title",children:t.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[t.jsx("h3",{id:"edit-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Edit Transport Key"}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(j,{label:"Key Name",type:"text",value:pt.name,onChange:e=>ht({...pt,name:e.target.value}),autoFocus:!0}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),t.jsxs("div",{className:"flex bg-bg-subtle radius-inner border-control p-1",children:[t.jsx("button",{onClick:()=>ht({...pt,floodPolicy:"deny"}),className:a("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===pt.floodPolicy?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),t.jsx("button",{onClick:()=>ht({...pt,floodPolicy:"allow"}),className:a("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===pt.floodPolicy?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),pt.transport_key&&t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Transport Key"}),t.jsx("code",{className:"block bg-bg-subtle px-3 py-2 radius-inner text-xs text-text-muted font-mono overflow-x-auto",children:pt.transport_key})]}),t.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{mt(!1),bt(pt),xt(!0),ht(null)},disabled:Nt,className:"px-4 py-2 bg-accent-danger/20 hover:bg-accent-danger/30 text-accent-danger radius-inner border border-accent-danger/50 transition-base disabled:opacity-50",children:"Delete"}),t.jsxs("div",{className:"flex gap-3",children:[t.jsx("button",{onClick:()=>{mt(!1),ht(null)},disabled:Nt,className:"px-4 py-2 bg-bg-subtle hover-bg text-text-secondary radius-inner border-control transition-base disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:async()=>{if(pt){wt(!0),Ze(null);try{const e=await _(pt.id,{name:pt.name,flood_policy:pt.floodPolicy});e.success?(await Ut(),mt(!1),ht(null)):Ze(e.error||"Failed to update transport key")}catch(e){Ze(e instanceof Error?e.message:"Failed to update transport key")}finally{wt(!1)}}},disabled:Nt||!pt.name.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary radius-inner border border-accent-primary/50 transition-base disabled:opacity-50 flex items-center gap-2",children:Nt?t.jsxs(t.Fragment,{children:[t.jsx(r,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),ut&&yt&&t.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&&xt(!1),role:"dialog","aria-modal":"true","aria-labelledby":"delete-key-modal-title",children:t.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[t.jsx("h3",{id:"delete-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Delete Transport Key"}),t.jsxs("p",{className:"text-text-secondary mb-4",children:["Are you sure you want to delete ",t.jsxs("strong",{className:"text-text-primary",children:["'",yt.name,"'"]}),"?"]}),yt.children&&yt.children.length>0&&t.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 radius-inner p-3 mb-4",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx($,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm text-text-secondary",children:["This key has ",yt.children.length," child key(s). Deleting will also remove all children."]})]})}),t.jsxs("div",{className:"flex justify-end gap-3",children:[t.jsx("button",{onClick:()=>{xt(!1),bt(null)},disabled:Nt,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:async()=>{if(yt){wt(!0),Ze(null);try{const e=await F(yt.id);e.success?(await Ut(),xt(!1),bt(null),nt(null)):Ze(e.error||"Failed to delete transport key")}catch(e){Ze(e instanceof Error?e.message:"Failed to delete transport key")}finally{wt(!1)}}},disabled:Nt,className:"px-4 py-2 bg-accent-danger/20 hover:bg-accent-danger/30 text-accent-danger radius-inner border border-accent-danger/50 transition-base disabled:opacity-50 flex items-center gap-2",children:Nt?t.jsxs(t.Fragment,{children:[t.jsx(r,{className:"w-4 h-4 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{we as default}; +import{r as e,j as t,c as a}from"./vendor-react-j_fHog8x.js";import{c as s,Q as r,f as n,a0 as l,O as c,ct as i,cu as o,cv as d,cw as m,aA as u,by as x,cx as p,cy as h,cz as y,cA as b,R as f,cB as g,cC as j,I as v}from"./index-B51aMfiH.js";import{g as N,c as w,r as k,s as C,a as S,u as _,d as F}from"./system-BlyXhV8d.js";import{T,P as E,C as P}from"./ConfirmModal-ptKJzd5A.js";import{l as M}from"./font-loader-BQzEmDrZ.js";import{N as R}from"./NodeInformationCard-y7LNSCha.js";import{a as z,P as A,b as L,B as D}from"./PageLayout-DUXmuiZg.js";import{C as I}from"./Card-BC0izdLh.js";import{I as K}from"./info-DFWt9Iwg.js";import{R as V,C as H}from"./Grid-OFJ4oe0a.js";import{K as q}from"./key-round-DyppBhTK.js";import{C as O}from"./circle-check-DBemvAXd.js";import{T as $}from"./triangle-alert-JpcXY4mr.js";import{R as B}from"./refresh-cw-BcvCKflD.js";import{C as X}from"./copy-jAVnwXtf.js";import{C as G}from"./chevron-right-DiVetJOJ.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CDNU4oKM.js";import"./DataBox-B4su-zzA.js";const U=s("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"}]]),W=s("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"}]]),Y=s("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"}]]),J=s("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"}]]),Q=s("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"}]]),Z=s("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"}]]),ee=s("shield-check",[["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:"m9 12 2 2 4-4",key:"dzmm74"}]]),te=s("shield-x",[["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:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]),ae=s("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"}]]),se=1500,re="h-[38px]",ne="h-[32px]",le="px-3",ce="px-2.5",ie="rounded-lg";function oe({label:s,value:c,editValue:i,onSave:o,type:d="text",suffix:m,placeholder:u,readOnly:x=!1,layout:p="stacked",min:h,max:y,step:b,maxLength:f,description:g,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&&!!o;e.useEffect(()=>(F.current=!0,()=>{F.current=!1,T.current&&clearTimeout(T.current)}),[]);const P=e.useCallback(()=>{E&&(k(i??c),N(!0),S("idle"),requestAnimationFrame(()=>{var e;return null==(e=_.current)?void 0:e.select()}))},[E,i,c]),M=e.useCallback(()=>{N(!1),k(""),S("idle")},[]),R=e.useCallback(async()=>{if(o&&"loading"!==C)if(w!==(i??c)){T.current&&clearTimeout(T.current),S("loading");try{if(await o(w),!F.current)return;S("success"),N(!1),T.current=setTimeout(()=>{F.current&&S("idle")},se)}catch{if(!F.current)return;S("error"),T.current=setTimeout(()=>{F.current&&S("idle")},se)}}else M()},[o,w,i,c,M,C]),z=e.useCallback(e=>{"Enter"===e.key?(e.preventDefault(),R()):"Escape"===e.key&&(e.preventDefault(),M())},[R,M]);return"inline"===p?t.jsxs("div",{className:a("group flex items-center justify-between",j),children:[t.jsx("label",{className:"type-label text-text-muted shrink-0",children:s}),v?t.jsxs("div",{className:a(ne,ie,ce,"flex items-center transition-all","bg-transparent border border-accent-primary/50 ring-1 ring-accent-primary/20","min-w-[100px]"),children:[t.jsx("input",{ref:_,type:d,value:w,onChange:e=>k(e.target.value),onKeyDown:z,placeholder:u,min:h,max:y,step:b,maxLength:f,disabled:"loading"===C,className:a("bg-transparent text-text-primary focus:outline-none type-data flex-1 min-w-0",m?"w-12 text-right":"w-full")}),m&&t.jsx("span",{className:"text-text-muted type-data ml-1 shrink-0",children:m}),t.jsx("div",{className:"flex items-center gap-0.5 ml-2 shrink-0",children:"loading"===C?t.jsx(r,{className:"w-3.5 h-3.5 text-text-muted animate-spin"}):t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:R,className:"p-0.5 rounded hover:bg-accent-success/15 text-accent-success transition-colors",title:"Save (Enter)",children:t.jsx(n,{className:"w-3 h-3"})}),t.jsx("button",{onClick:M,className:"p-0.5 rounded hover:bg-accent-danger/15 text-text-muted hover:text-accent-danger transition-colors",title:"Cancel (Esc)",children:t.jsx(l,{className:"w-3 h-3"})})]})})]}):t.jsxs("div",{className:a(ne,ie,ce,"flex items-center justify-end transition-all min-w-[80px]","bg-white/[0.03] border border-white/[0.06]",E&&"cursor-pointer hover:border-white/10 hover:bg-white/[0.05]"),onClick:E?P:void 0,children:[t.jsx("span",{className:"type-data text-text-primary",children:c}),"success"===C&&t.jsx(n,{className:"w-3 h-3 text-accent-success ml-1.5 shrink-0"}),"error"===C&&t.jsx(l,{className:"w-3 h-3 text-accent-danger ml-1.5 shrink-0"}),"idle"===C&&E&&t.jsx(Z,{className:"w-3 h-3 text-text-muted ml-1.5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})]})]}):t.jsxs("div",{className:a("group",j),children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:s}),v?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:a(re,ie,le,"flex items-center transition-all","bg-transparent border border-accent-primary/50 ring-1 ring-accent-primary/20"),children:[t.jsx("input",{ref:_,type:d,value:w,onChange:e=>k(e.target.value),onKeyDown:z,placeholder:u,min:h,max:y,step:b,maxLength:f,disabled:"loading"===C,className:"w-full bg-transparent text-text-primary focus:outline-none type-data flex-1 min-w-0"}),m&&t.jsx("span",{className:"text-text-muted type-data ml-1 shrink-0",children:m}),t.jsx("div",{className:"flex items-center gap-0.5 ml-2 shrink-0",children:"loading"===C?t.jsx(r,{className:"w-3.5 h-3.5 text-text-muted animate-spin"}):t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:R,className:"p-1 rounded hover:bg-accent-success/15 text-accent-success transition-colors",title:"Save (Enter)",children:t.jsx(n,{className:"w-3.5 h-3.5"})}),t.jsx("button",{onClick:M,className:"p-1 rounded hover:bg-accent-danger/15 text-text-muted hover:text-accent-danger transition-colors",title:"Cancel (Esc)",children:t.jsx(l,{className:"w-3.5 h-3.5"})})]})})]}),g&&t.jsx("p",{className:"type-data-xs text-text-muted mt-1 ml-3",children:g})]}):t.jsxs("div",{className:a(re,ie,le,"flex items-center transition-all","bg-white/[0.03] border border-white/[0.06]",E&&"cursor-pointer hover:border-white/10 hover:bg-white/[0.05]"),onClick:E?P:void 0,children:[t.jsx("span",{className:"type-data text-text-primary flex-1",children:c}),"success"===C&&t.jsx(n,{className:"w-3.5 h-3.5 text-accent-success shrink-0"}),"error"===C&&t.jsx(l,{className:"w-3.5 h-3.5 text-accent-danger shrink-0"}),"idle"===C&&E&&t.jsx(Z,{className:"w-3.5 h-3.5 text-text-muted opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})]})]})}function de({label:s,value:i,editValue:o,options:d,onSave:m,readOnly:u=!1,layout:x="stacked",className:p}){const[h,y]=e.useState(!1),[b,f]=e.useState(""),[g,j]=e.useState("idle"),v=e.useRef(null),N=e.useRef(!0),w=e.useRef(null),k=!u&&!!m;e.useEffect(()=>(N.current=!0,()=>{N.current=!1,w.current&&clearTimeout(w.current)}),[]);const C=e.useCallback(()=>{k&&(f(String(o)),y(!0),j("idle"),requestAnimationFrame(()=>{var e;return null==(e=v.current)?void 0:e.focus()}))},[k,o]),S=e.useCallback(()=>{y(!1),f(""),j("idle")},[]),_=e.useCallback(async()=>{if(m&&"loading"!==g)if(b!==String(o)){w.current&&clearTimeout(w.current),j("loading");try{if(await m(b),!N.current)return;j("success"),y(!1),w.current=setTimeout(()=>{N.current&&j("idle")},se)}catch{if(!N.current)return;j("error"),w.current=setTimeout(()=>{N.current&&j("idle")},se)}}else S()},[m,b,o,S,g]),F=e.useCallback(e=>{"Escape"===e.key&&(e.preventDefault(),S())},[S]),T="inline"===x,E=T?ne:re,P=T?ce:le,M=t.jsxs("div",{className:a(E,ie,P,"flex items-center transition-all relative","bg-transparent border border-accent-primary/50 ring-1 ring-accent-primary/20",T&&"min-w-[100px]"),children:[t.jsx("select",{ref:v,value:b,onChange:e=>f(e.target.value),onKeyDown:F,disabled:"loading"===g,className:a("bg-transparent text-text-primary focus:outline-none appearance-none cursor-pointer type-data flex-1 min-w-0","pr-6"),children:d.map(e=>t.jsx("option",{value:e.value,children:e.label},String(e.value)))}),t.jsx(c,{className:"absolute right-auto w-3.5 h-3.5 text-text-muted pointer-events-none",style:{right:"loading"===g?"2rem":"3.5rem"}}),t.jsx("div",{className:"flex items-center gap-0.5 ml-1 shrink-0",children:"loading"===g?t.jsx(r,{className:a("text-text-muted animate-spin",T?"w-3 h-3":"w-3.5 h-3.5")}):t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:_,className:a("rounded hover:bg-accent-success/15 text-accent-success transition-colors",T?"p-0.5":"p-1"),title:"Save",children:t.jsx(n,{className:T?"w-3 h-3":"w-3.5 h-3.5"})}),t.jsx("button",{onClick:S,className:a("rounded hover:bg-accent-danger/15 text-text-muted hover:text-accent-danger transition-colors",T?"p-0.5":"p-1"),title:"Cancel (Esc)",children:t.jsx(l,{className:T?"w-3 h-3":"w-3.5 h-3.5"})})]})})]}),R=t.jsxs("div",{className:a(E,ie,P,"flex items-center transition-all","bg-white/[0.03] border border-white/[0.06]",k&&"cursor-pointer hover:border-white/10 hover:bg-white/[0.05]",T?"justify-end min-w-[80px]":""),onClick:k?C:void 0,children:[t.jsx("span",{className:a("type-data text-text-primary",!T&&"flex-1"),children:i}),"success"===g&&t.jsx(n,{className:a("text-accent-success shrink-0",T?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")}),"error"===g&&t.jsx(l,{className:a("text-accent-danger shrink-0",T?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")}),"idle"===g&&k&&t.jsx(c,{className:a("text-text-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?t.jsxs("div",{className:a("group flex items-center justify-between",p),children:[t.jsx("label",{className:"type-label text-text-muted shrink-0",children:s}),h?M:R]}):t.jsxs("div",{className:a("group",p),children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:s}),h?M:R]})}async function me(e){return i("/api/update_web_config",{method:"POST",body:JSON.stringify(e)})}const ue=e.memo(function(){const{theme:e}=o(),{colorScheme:a}=e,s=d.find(e=>e.colorScheme===a)??d[0];return t.jsx("div",{className:"h-10 flex items-center justify-center",children:t.jsx("span",{className:"font-medium transition-all duration-300 leading-none text-center text-text-secondary",style:{fontFamily:"Inter, system-ui, sans-serif",fontSize:"clamp(0.75rem, 0.6rem + 1.5vw, 1.1rem)",letterSpacing:"-0.02em"},children:s.displayName})})}),xe=e.memo(function(){const{theme:e,setThemePreset:s}=o(),{colorScheme:r}=e,n=(d.find(e=>e.colorScheme===r)??d[0]).id;return t.jsx("div",{className:"grid grid-cols-2 gap-3 w-full",children:d.map(e=>{const r=n===e.id,l="breeze dark"===e.id;return t.jsxs("button",{type:"button",title:e.displayName,className:a("flex flex-col items-stretch rounded-lg transition-all duration-200 ease-out overflow-hidden cursor-pointer",r?"ring-2 ring-accent-primary scale-[1.02]":"opacity-70 hover:opacity-100"),onClick:()=>s(e.id),children:[t.jsx("div",{className:a("w-full aspect-[3/2] flex items-center justify-center",l?"bg-[#242627]":"bg-[#EFF0F1]"),children:t.jsx("span",{className:a("text-[1.5em] font-bold font-mono",l?"text-[#58b99d]":"text-[#31363B]"),children:l?">":"☀"})}),t.jsx("div",{className:"flex flex-col w-full",children:e.paletteColors.map((e,a)=>t.jsx("div",{className:"flex",children:e.map((e,a)=>t.jsx("div",{className:"flex-1 aspect-[2/1]",style:{backgroundColor:e}},a))},a))})]},e.id)})})}),pe=e.memo(function({layout:a="horizontal"}){return e.useEffect(()=>{M()},[]),"logo-only"===a?t.jsx(ue,{}):"thumbnails-only"===a?t.jsx(xe,{}):t.jsxs("div",{className:"flex flex-col items-center gap-3",children:[t.jsx(ue,{}),t.jsx(xe,{})]})}),he=2e3;function ye(t,a,s){const[r,n]=e.useState("idle"),[l,c]=e.useState(null),i=e.useRef(!0),o=e.useRef(null),d=e.useRef(null),m=e.useRef(!1),u=e.useRef("idle"),x=e.useRef(t),p=e.useRef(a),h=e.useRef(s);return u.current=r,x.current=t,p.current=a,h.current=s,e.useEffect(()=>(i.current=!0,()=>{i.current=!1,o.current&&clearTimeout(o.current),d.current&&clearTimeout(d.current)}),[]),{enabled:null!==l?l:t,status:r,toggle:e.useCallback(async e=>{if("loading"===u.current)return;const t=x.current;o.current&&clearTimeout(o.current),d.current&&clearTimeout(d.current),m.current=!1,c(e),n("loading"),o.current=setTimeout(()=>{!m.current&&i.current&&(c(t),n("error"),d.current=setTimeout(()=>{i.current&&(n("idle"),c(null))},he))},1e4);try{if(await p.current(e),m.current=!0,o.current&&clearTimeout(o.current),!i.current)return;n("success"),d.current=setTimeout(()=>{var e;i.current&&(n("idle"),c(null),null==(e=h.current)||e.call(h))},he)}catch{if(m.current=!0,o.current&&clearTimeout(o.current),!i.current)return;c(t),n("error"),d.current=setTimeout(()=>{i.current&&(n("idle"),c(null))},he)}},[])}}function be(){const{latitude:s,longitude:c,enabled:i,setLocation:o,enable:d,disable:u,clear:x}=m(),[p,h]=e.useState(!1),[y,b]=e.useState(""),[f,g]=e.useState(""),[j,v]=e.useState("idle"),[N,w]=e.useState(null),k=e.useRef(null),C=e.useRef(null),S=e.useRef(!0);e.useEffect(()=>(S.current=!0,()=>{S.current=!1,C.current&&clearTimeout(C.current)}),[]);const _=()=>{h(!1),w(null)};e.useEffect(()=>{if(!p)return;const e=e=>{"loading"!==j&&k.current&&!k.current.contains(e.target)&&_()};return document.addEventListener("mouseup",e),()=>document.removeEventListener("mouseup",e)},[p,j]);const F=null!==s&&null!==c;return t.jsx(z,{children:t.jsxs("div",{ref:k,children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx(I,{icon:t.jsx(ae,{}),title:"Stealth",largeTitle:!0}),t.jsxs("div",{className:"flex items-center gap-1",children:[F&&!p&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>{i?u():d()},className:a("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2 mr-2",i?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle"),title:i?"Disable stealth location":"Enable stealth location",children:t.jsx("span",{className:a("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",i?"translate-x-5":"translate-x-0.5")})}),t.jsx("button",{onClick:()=>{x(),h(!1)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-accent-danger hover:bg-accent-danger/10",title:"Clear stealth location",children:t.jsx(T,{className:"w-4 h-4"})})]}),p?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:_,disabled:"loading"===j,className:a("p-2 rounded-lg transition-colors","loading"===j?"text-text-muted cursor-not-allowed":"text-text-muted hover:text-accent-danger hover:bg-accent-danger/10"),title:"Cancel",children:t.jsx(l,{className:"w-4 h-4"})}),t.jsx("button",{onClick:()=>{if("loading"===j)return;C.current&&clearTimeout(C.current);const e=((e,t)=>{const a=parseFloat(e),s=parseFloat(t);return isNaN(a)||isNaN(s)?"Please enter valid numbers":a<-90||a>90?"Latitude must be between -90 and 90":s<-180||s>180?"Longitude must be between -180 and 180":0===a&&0===s?"Coordinates (0, 0) are invalid":null})(y,f);if(e)return void w(e);v("loading"),w(null);const t=parseFloat(y),a=parseFloat(f);o(t,a),i||d(),v("success"),C.current=setTimeout(()=>{S.current&&(v("idle"),h(!1))},1e3)},disabled:"loading"===j,className:a("p-2 rounded-lg transition-colors","loading"===j?"text-accent-primary cursor-wait":"success"===j?"text-accent-success":"error"===j?"text-accent-danger":"text-accent-success hover:bg-accent-success/10"),title:"Save",children:"loading"===j?t.jsx(r,{className:"w-4 h-4 animate-spin"}):"success"===j?t.jsx(n,{className:"w-4 h-4"}):"error"===j?t.jsx(l,{className:"w-4 h-4"}):t.jsx(n,{className:"w-4 h-4"})})]}):t.jsx("button",{onClick:()=>{b((null==s?void 0:s.toFixed(6))??""),g((null==c?void 0:c.toFixed(6))??""),w(null),h(!0)},className:"p-2 rounded-lg transition-colors text-text-muted hover:text-text-primary hover:bg-bg-subtle",title:F?"Edit stealth location":"Set stealth location",children:t.jsx(Z,{className:"w-4 h-4"})})]})]}),t.jsx("div",{className:"bg-accent-tertiary/5 rounded-xl p-3 mb-4",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx(K,{className:"w-4 h-4 text-accent-tertiary flex-shrink-0 mt-0.5"}),t.jsxs("p",{className:"type-body-sm text-text-muted",children:[t.jsx("span",{className:"text-text-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 — ",t.jsx("span",{className:"text-accent-tertiary",children:"never sent to config.yaml or the mesh"}),"."]})]})}),N&&t.jsx("div",{className:"text-xs mb-3 px-2 py-1.5 rounded-md text-accent-danger bg-accent-danger/10",children:N}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:p?"Latitude (°)":"Latitude"}),t.jsx("div",{className:a("h-[38px] rounded-full px-4 flex items-center transition-colors","bg-subtle-fill"),children:p?t.jsx("input",{type:"number",value:y,onChange:e=>b(e.target.value),step:"0.000001",min:"-90",max:"90",placeholder:"e.g. 34.052234",className:"w-full bg-transparent text-text-primary focus:outline-none type-data placeholder:text-text-muted/50"}):t.jsx("span",{className:a("type-data",F&&i?"text-text-primary":"text-text-muted"),children:F?s.toFixed(6):"Not set"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-1",children:p?"Longitude (°)":"Longitude"}),t.jsx("div",{className:a("h-[38px] rounded-full px-4 flex items-center transition-colors","bg-subtle-fill"),children:p?t.jsx("input",{type:"number",value:f,onChange:e=>g(e.target.value),step:"0.000001",min:"-180",max:"180",placeholder:"e.g. -118.243685",className:"w-full bg-transparent text-text-primary focus:outline-none type-data placeholder:text-text-muted/50"}):t.jsx("span",{className:a("type-data",F&&i?"text-text-primary":"text-text-muted"),children:F?c.toFixed(6):"Not set"})})]})]}),F&&!p&&t.jsx("div",{className:"mt-3 pt-3 border-t border-border-subtle",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:a("w-2 h-2 rounded-full",i?"bg-accent-success":"bg-text-muted")}),t.jsx("span",{className:"type-body-sm text-text-muted",children:i?"Stealth location active — you appear on maps with these coordinates":"Stealth location disabled — coordinates saved but not in use"})]})})]})})}const fe=[{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"}],ge=[5,6,7,8,9,10,11,12],je=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}],ve="radioConfig";function Ne({node:e,level:s,expandedKeys:r,selectedKeyId:n,globalFloodPolicy:l,onSelect:c,onToggle:i}){const o=r.has(e.id),d=n===e.id,m=e.children&&e.children.length>0,u="allow"===l;return t.jsxs("div",{children:[t.jsxs("div",{className:a("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",d?"bg-accent-primary/15":"hover:bg-subtle-fill",u&&"opacity-50 cursor-not-allowed"),style:{marginLeft:16*s+"px"},onClick:()=>!u&&c(e.id),children:[m?t.jsx("button",{onClick:t=>{t.stopPropagation(),i(e.id)},className:"p-1 hover:bg-subtle-fill-hover rounded-full transition-colors",children:t.jsx(G,{className:a("w-3.5 h-3.5 text-text-muted transition-transform",o&&"rotate-90")})}):t.jsx("span",{className:"w-5"}),t.jsx(Y,{className:"w-4 h-4 text-accent-primary flex-shrink-0"}),t.jsx("span",{className:"type-data text-text-primary flex-1 truncate",children:e.name}),t.jsx("span",{className:a("type-data-xs px-2 py-0.5 rounded-full","allow"===e.floodPolicy?"bg-accent-success/15 text-accent-success":"bg-accent-danger/15 text-accent-danger"),children:"allow"===e.floodPolicy?"Allow":"Deny"})]}),m&&o&&t.jsx("div",{children:e.children.map(e=>t.jsx(Ne,{node:e,level:s+1,expandedKeys:r,selectedKeyId:n,globalFloodPolicy:l,onSelect:c,onToggle:i},e.id))})]})}function we(){var s,l,c,o,d,m;const{stats:M,setMode:G,clearModeMutation:Y,setDutyCycleConfig:Z,clearDutyCycleMutation:ae,fetchStats:se,startMutation:re,clearMutation:ne}=u(),le=null==(s=null==M?void 0:M.config)?void 0:s.radio,ce=null==(l=null==M?void 0:M.config)?void 0:l.repeater,ie=null==(c=null==M?void 0:M.config)?void 0:c.duty_cycle,ue=(null==M?void 0:M.node_name)||(null==(o=null==M?void 0:M.config)?void 0:o.node_name)||"Unknown Node",xe=(null==ce?void 0:ce.mode)??"forward",he=(null==ie?void 0:ie.enforcement_enabled)??!1,we=null==(d=null==M?void 0:M.config)?void 0:d.delays,ke=e.useRef(!0);e.useEffect(()=>(ke.current=!0,()=>{ke.current=!1}),[]);const Ce=null==(m=null==M?void 0:M.config)?void 0:m.web,[Se,_e]=e.useState([]),[Fe,Te]=e.useState(!1),[Ee,Pe]=e.useState(null),[Me,Re]=e.useState(!1),[ze,Ae]=e.useState(""),[Le,De]=e.useState(null),[Ie,Ke]=e.useState(!1),[Ve,He]=e.useState(null),[qe,Oe]=e.useState(!1),[$e,Be]=e.useState(!1),[Xe,Ge]=e.useState(!1),[Ue,We]=e.useState([]),[Ye,Je]=e.useState(!1),[Qe,Ze]=e.useState(null),[et,tt]=e.useState("deny"),[at,st]=e.useState(!1),[rt,nt]=e.useState(null),[lt,ct]=e.useState(new Set),[it,ot]=e.useState(!1),[dt,mt]=e.useState(!1),[ut,xt]=e.useState(!1),[pt,ht]=e.useState(null),[yt,bt]=e.useState(null),[ft,gt]=e.useState(""),[jt,vt]=e.useState("deny"),[Nt,wt]=e.useState(!1),[kt,Ct]=e.useState(!0),[St,_t]=e.useState(!1),[Ft,Tt]=e.useState(!0),[Et,Pt]=e.useState("idle"),[Mt,Rt]=e.useState(!1),[zt,At]=e.useState(!1),Lt=e.useCallback(()=>{const e=null==we?void 0:we.tx_delay_factor;return e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??1:"number"==typeof e?e:1},[we]),Dt=e.useCallback(()=>{const e=null==we?void 0:we.direct_tx_delay_factor;return"number"==typeof e?e:.5},[we]),It=e.useCallback(()=>{const e=null==ie?void 0:ie.max_airtime_percent;return"number"==typeof e?e:e&&"object"==typeof e&&"parsedValue"in e?e.parsedValue??6:6},[ie]),Kt=ye("forward"===xe,async e=>{await G(e?"forward":"monitor")},Y),Vt=ye(he,async e=>{await Z({max_airtime_percent:It(),enforcement_enabled:e})},ae),Ht=ye((null==Ce?void 0:Ce.cors_enabled)??!1,async e=>{var t;const a=await me({web:{cors_enabled:e}});if(!a.success&&!(null==(t=a.data)?void 0:t.persisted))throw new Error("CORS update failed");await se()}),qt=e.useCallback(async e=>{re(ve);try{const t=await x(e);if(!t.success)throw new Error(t.error||"Failed to save");await se({force:!0}).catch(()=>{})}finally{ne(ve)}},[re,ne,se]);e.useEffect(()=>{(async()=>{Tt(!0);try{const e=await w();e.success&&e.data?_t(e.data.exists):_t(!1);const t=null==Ce?void 0:Ce.web_path;Ct(!t||""===t)}catch{_t(!1)}finally{Tt(!1)}})()},[null==Ce?void 0:Ce.web_path]);const Ot=async e=>{var t;if("loading"!==Et){Pt("loading");try{const a=await me({web:{web_path:e?null:"/opt/pymc_console/web/html"}});if(!ke.current)return;a.success||(null==(t=a.data)?void 0:t.persisted)?(Ct(e),Pt("success"),Rt(!0),setTimeout(()=>{ke.current&&Pt("idle")},2e3)):(Pt("error"),setTimeout(()=>{ke.current&&Pt("idle")},2e3))}catch{if(!ke.current)return;Pt("error"),setTimeout(()=>{ke.current&&Pt("idle")},2e3)}}},$t=e.useCallback(async()=>{Te(!0),Pe(null);try{const e=await async function(){return i("/auth/tokens")}();_e(e.tokens||[])}catch(e){Pe(e instanceof Error?e.message:"Failed to fetch tokens")}finally{Te(!1)}},[]);e.useEffect(()=>{$t()},[$t]);const Bt=async()=>{if(ze.trim()){Oe(!0),Pe(null);try{const e=await async function(e){return i("/auth/tokens",{method:"POST",body:JSON.stringify({name:e})})}(ze.trim());De(e.token||null),Re(!1),Ke(!0),Ae(""),await $t()}catch(e){Pe(e instanceof Error?e.message:"Failed to create token")}finally{Oe(!1)}}else Pe("Token name is required")},Xt=e=>e?new Date(1e3*e).toLocaleString():"Never",Gt=e.useCallback(e=>{const t=new Map,a=[];return e.forEach(e=>{const a={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:[]};t.set(e.id,a)}),t.forEach(e=>{e.parent_id&&t.has(e.parent_id)?t.get(e.parent_id).children.push(e):a.push(e)}),a},[]),Ut=e.useCallback(async()=>{Je(!0),Ze(null);try{const e=await N();e.success&&e.data?We(Gt(e.data)):Ze(e.error||"Failed to load transport keys")}catch(e){Ze(e instanceof Error?e.message:"Unknown error occurred")}finally{Je(!1)}},[Gt]);e.useEffect(()=>{Ut()},[Ut]);const Wt=e.useCallback((e,t)=>{for(const a of e){if(a.id===t)return a;if(a.children){const e=Wt(a.children,t);if(e)return e}}return null},[]),Yt=e.useCallback(()=>{if(!rt)return;const e=Wt(Ue,rt);return null==e?void 0:e.name},[rt,Ue,Wt]),Jt=e.useCallback(e=>{ct(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),Qt=async e=>{st(!0),Ze(null);try{const t=await C("allow"===e);t.success?tt(e):Ze(t.error||"Failed to update global flood policy")}catch(t){Ze(t instanceof Error?t.message:"Failed to update global flood policy")}finally{st(!1)}},Zt=async()=>{if(ft.trim()){wt(!0),Ze(null);try{const e=await S({name:ft.trim(),flood_policy:jt,parent_id:rt??void 0});e.success?(await Ut(),ot(!1),gt(""),vt("deny")):Ze(e.error||"Failed to add transport key")}catch(e){Ze(e instanceof Error?e.message:"Failed to add transport key")}finally{wt(!1)}}else Ze("Key name is required")},ea=e.useCallback(()=>{if(!rt)return;const e=Wt(Ue,rt);e&&(ht({...e}),mt(!0))},[rt,Ue,Wt]);e.useEffect(()=>{const e=e=>{"Escape"===e.key&&(it&&(ot(!1),gt(""),vt("deny")),dt&&(mt(!1),ht(null)),ut&&(xt(!1),bt(null)),Me&&(Re(!1),Ae("")),Ie&&(Ke(!1),De(null)))};if(it||dt||ut||Me||Ie)return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[it,dt,ut,Me,Ie]);const ta=e.useCallback(()=>{if(!rt)return;const e=Wt(Ue,rt);e&&(bt(e),xt(!0))},[rt,Ue,Wt]);return t.jsxs(A,{children:[t.jsx(L,{title:"Configuration",icon:t.jsx(p,{})}),t.jsxs(D,{children:[t.jsxs(V,{template:"standard",children:[t.jsx(H,{span:12,md:6,children:t.jsxs(z,{children:[t.jsx(I,{icon:t.jsx(h,{}),title:"Repeater Settings",largeTitle:!0}),ce?t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx("div",{className:"col-span-2",children:t.jsx(oe,{label:"Node Name",value:ue,onSave:async e=>qt({node_name:e}),placeholder:"Enter node name",maxLength:50})}),t.jsx(oe,{label:"Latitude",value:0!==ce.latitude?ce.latitude.toFixed(6):"Not set",editValue:String(ce.latitude),type:"number",suffix:"°",step:1e-6,min:-90,max:90,onSave:async e=>qt({latitude:parseFloat(e)})}),t.jsx(oe,{label:"Longitude",value:0!==ce.longitude?ce.longitude.toFixed(6):"Not set",editValue:String(ce.longitude),type:"number",suffix:"°",step:1e-6,min:-180,max:180,onSave:async e=>qt({longitude:parseFloat(e)})}),t.jsx(oe,{label:"Advert Interval",value:ce.send_advert_interval_hours>0?`${ce.send_advert_interval_hours}h`:"Disabled",editValue:String(ce.send_advert_interval_hours),type:"number",suffix:"hours",min:0,max:48,description:"0 = disabled, 3-48 hours",onSave:async e=>qt({flood_advert_interval_hours:parseInt(e,10)})}),t.jsx(oe,{label:"Score-based TX",value:ce.use_score_for_tx?"Enabled":"Disabled",readOnly:!0})]}):t.jsx("p",{className:"text-text-muted",children:"Loading repeater settings..."})]})}),t.jsx(H,{span:12,md:6,children:t.jsxs(z,{children:[t.jsx(I,{icon:t.jsx(U,{}),title:"Radio Configuration",largeTitle:!0}),le?t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(oe,{label:"Frequency",value:y(le.frequency),editValue:(le.frequency/1e6).toFixed(3),type:"number",suffix:"MHz",step:.001,min:400,max:930,onSave:async e=>qt({frequency_mhz:parseFloat(e)})}),t.jsx(oe,{label:"TX Power",value:`${le.tx_power} dBm`,editValue:String(le.tx_power),type:"number",suffix:"dBm",min:2,max:30,onSave:async e=>qt({tx_power:parseInt(e,10)})}),t.jsx(de,{label:"Bandwidth",value:b(le.bandwidth),editValue:le.bandwidth/1e3,options:fe,onSave:async e=>qt({bandwidth_khz:parseFloat(e)})}),t.jsx(de,{label:"Spreading Factor",value:`SF${le.spreading_factor}`,editValue:le.spreading_factor,options:ge.map(e=>({value:e,label:`SF${e}`})),onSave:async e=>qt({spreading_factor:parseInt(e,10)})}),t.jsx(de,{label:"Coding Rate",value:`4/${le.coding_rate}`,editValue:le.coding_rate,options:je,onSave:async e=>qt({coding_rate:parseInt(e,10)})}),t.jsx(oe,{label:"Preamble",value:`${le.preamble_length} symbols`,readOnly:!0})]}):t.jsx("p",{className:"text-text-muted",children:"Loading radio configuration..."})]})})]}),t.jsxs(V,{template:"standard",children:[t.jsx(H,{span:12,md:6,children:t.jsxs(z,{children:[t.jsx(I,{icon:t.jsx(f,{}),title:"Operating Mode",largeTitle:!0}),t.jsx("p",{className:"type-label text-text-muted mb-3",children:"Control how the repeater handles packets"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[t.jsxs("div",{className:"flex-1 space-y-4",children:[t.jsx(g,{enabled:Kt.enabled,onChange:Kt.toggle,label:"Repeat",status:Kt.status,size:"md"}),t.jsx(g,{enabled:Vt.enabled,onChange:Vt.toggle,label:"Duty Cycle",status:Vt.status,size:"md"}),t.jsx(oe,{label:"Max Airtime",layout:"inline",value:`${It().toFixed(1)}%`,editValue:String(It()),type:"number",suffix:"%",step:.5,min:.1,max:100,onSave:async e=>{await Z({max_airtime_percent:parseFloat(e),enforcement_enabled:he}),ae()}})]}),t.jsx("div",{className:"hidden sm:block w-px bg-border-subtle"}),t.jsxs("div",{className:"flex-1 pt-4 sm:pt-0 border-t sm:border-t-0 border-border-subtle",children:[t.jsx("label",{className:"type-label text-text-muted block mb-3",children:"TX Delays"}),t.jsxs("div",{className:"space-y-3",children:[t.jsx(oe,{label:"Flood",layout:"inline",value:`${Lt().toFixed(2)}x`,editValue:String(Lt()),type:"number",suffix:"x",step:.1,min:0,max:5,onSave:async e=>qt({tx_delay_factor:parseFloat(e)})}),t.jsx(oe,{label:"Direct",layout:"inline",value:`${Dt().toFixed(2)}s`,editValue:String(Dt()),type:"number",suffix:"s",step:.1,min:0,max:5,onSave:async e=>qt({direct_tx_delay_factor:parseFloat(e)})})]})]})]})]})}),t.jsx(H,{span:12,md:6,children:t.jsxs(z,{children:[t.jsx(I,{icon:t.jsx(p,{}),title:"App Settings",largeTitle:!0}),t.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Appearance and web server options."}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(g,{enabled:Ht.enabled,onChange:Ht.toggle,label:"Enable CORS",description:"Allow cross-origin API access",status:Ht.status,size:"md"}),t.jsx("div",{children:t.jsx(pe,{})})]})]})})]}),t.jsx(V,{template:"auto",children:t.jsxs(z,{children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(J,{className:"icon-md text-accent-primary"}),"Regions / Transport Keys"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage regional key hierarchy for flood control"})]}),t.jsxs("div",{className:"flex gap-2 flex-wrap",children:[t.jsxs("button",{onClick:()=>ot(!0),disabled:"allow"===et,className:a("flex items-center gap-1.5 h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium","allow"===et?"bg-subtle-fill text-text-muted cursor-not-allowed":"bg-accent-success/10 hover:bg-accent-success/20 text-accent-success"),children:[t.jsx(E,{className:"w-3.5 h-3.5"}),"Add"]}),t.jsx("button",{onClick:ea,disabled:!rt||"allow"===et,className:a("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",rt&&"allow"!==et?"bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary":"bg-subtle-fill text-text-muted cursor-not-allowed"),children:"Edit"}),t.jsx("button",{onClick:ta,disabled:!rt||"allow"===et,className:a("h-[32px] px-3 rounded-full transition-colors type-body-sm font-medium",rt&&"allow"!==et?"bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger":"bg-subtle-fill text-text-muted cursor-not-allowed"),children:"Delete"})]})]}),t.jsx("div",{className:"bg-subtle-fill radius-card p-4 mb-4",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:a("w-10 h-10 rounded-full flex items-center justify-center","allow"===et?"bg-accent-success/20":"bg-accent-danger/20"),children:"allow"===et?t.jsx(ee,{className:"w-5 h-5 text-accent-success"}):t.jsx(te,{className:"w-5 h-5 text-accent-danger"})}),t.jsxs("div",{children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Global Flood Policy"}),t.jsx("p",{className:"type-body-sm text-text-muted",children:"Master control for repeater flooding"})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex bg-subtle-fill rounded-full p-1",children:[t.jsx("button",{onClick:()=>Qt("deny"),disabled:at,className:a("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","deny"===et?"bg-accent-danger/20 text-accent-danger":"text-text-muted hover:text-text-secondary",at&&"opacity-50"),children:"Deny"}),t.jsx("button",{onClick:()=>Qt("allow"),disabled:at,className:a("px-4 py-1.5 rounded-full transition-colors type-body-sm font-medium","allow"===et?"bg-accent-success/20 text-accent-success":"text-text-muted hover:text-text-secondary",at&&"opacity-50"),children:"Allow"})]}),at&&t.jsx(r,{className:"w-4 h-4 animate-spin text-text-muted"})]})]})}),Qe&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:Qe}),t.jsx("div",{className:"bg-subtle-fill radius-card p-4 min-h-[120px]",children:Ye?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(r,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading transport keys..."})]}):0===Ue.length?t.jsxs("div",{className:"text-center py-6",children:[t.jsx("div",{className:"w-12 h-12 rounded-full bg-subtle-fill mx-auto mb-3 flex items-center justify-center",children:t.jsx(J,{className:"w-6 h-6 text-text-muted/50"})}),t.jsx("p",{className:"type-body text-text-muted",children:"No transport keys found"}),t.jsx("p",{className:"type-body-sm text-text-muted/70 mt-1",children:"Add your first transport key to get started"})]}):t.jsx("div",{className:"space-y-1",children:Ue.map(e=>t.jsx(Ne,{node:e,level:0,expandedKeys:lt,selectedKeyId:rt,globalFloodPolicy:et,onSelect:nt,onToggle:Jt},e.id))})})]})}),t.jsx(V,{template:"auto",children:t.jsxs(z,{children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(q,{className:"icon-md text-accent-primary"}),"API Tokens"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Manage API tokens for machine-to-machine authentication"})]}),t.jsxs("button",{onClick:()=>Re(!0),className:"flex items-center justify-center gap-2 h-[32px] px-4 bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary rounded-full transition-colors type-body-sm font-medium",children:[t.jsx(E,{className:"w-4 h-4"}),"Create Token"]})]}),t.jsx("div",{className:"bg-accent-tertiary/5 radius-card p-4 mb-4",children:t.jsxs("div",{className:"flex gap-3",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-tertiary/20 flex items-center justify-center flex-shrink-0",children:t.jsx(K,{className:"w-4 h-4 text-accent-tertiary"})}),t.jsxs("div",{className:"type-body-sm text-text-muted",children:[t.jsxs("p",{children:[t.jsx("span",{className:"text-text-secondary",children:"API tokens"})," are used for machine-to-machine authentication. Include the token in the ",t.jsx("code",{className:"type-code bg-accent-tertiary/20 px-1.5 py-0.5 rounded-full text-accent-tertiary",children:"X-API-Key"})," header when making API requests."]}),t.jsx("p",{className:"mt-1 text-text-muted/70",children:"Tokens are only shown once at creation. Store them securely."})]})]})}),Ee&&t.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-accent-danger bg-accent-danger/10",children:Ee}),Fe&&0===Se.length?t.jsxs("div",{className:"flex items-center justify-center py-6",children:[t.jsx(r,{className:"w-5 h-5 animate-spin text-accent-primary mr-2"}),t.jsx("span",{className:"type-body-sm text-text-muted",children:"Loading tokens..."})]}):Se.length>0?t.jsx("div",{className:"space-y-2",children:Se.map(e=>t.jsx("div",{className:"bg-subtle-fill hover:bg-subtle-fill-strong radius-card p-4 transition-base",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx("div",{className:"w-10 h-10 rounded-full bg-accent-primary/10 flex items-center justify-center flex-shrink-0",children:t.jsx(q,{className:"w-5 h-5 text-accent-primary"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h3",{className:"type-body text-text-primary font-medium truncate",children:e.name}),t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-0.5",children:[t.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Created: ",Xt(e.created_at)]}),t.jsxs("span",{className:"type-data-sm text-text-muted truncate",children:["Last used: ",Xt(e.last_used)]})]})]})]}),t.jsxs("button",{onClick:()=>He({id:e.id,name:e.name}),disabled:$e,className:"h-[32px] px-4 bg-accent-danger/10 hover:bg-accent-danger/20 text-accent-danger rounded-full transition-colors disabled:opacity-50 type-body-sm font-medium flex items-center justify-center gap-1.5",children:[t.jsx(T,{className:"w-3.5 h-3.5"}),"Revoke"]})]})},e.id))}):t.jsxs("div",{className:"bg-subtle-fill radius-card p-6 text-center",children:[t.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:t.jsx(q,{className:"w-7 h-7 text-text-muted/50"})}),t.jsx("h3",{className:"type-body text-text-primary font-medium mb-1",children:"No API Tokens"}),t.jsx("p",{className:"type-body-sm text-text-muted mb-4",children:"Create a token to enable API access"}),t.jsx("button",{onClick:()=>Re(!0),className:"h-[32px] px-4 bg-accent-primary/10 hover:bg-accent-primary/20 text-accent-primary rounded-full transition-colors type-body-sm font-medium",children:"Create Your First Token"})]})]})}),t.jsx(V,{template:"auto",children:t.jsxs(z,{children:[t.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:t.jsxs("div",{children:[t.jsxs("h2",{className:"type-heading text-text-primary flex items-center gap-2",children:[t.jsx(Q,{className:"icon-md text-accent-primary"}),"Web Frontend"]}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Choose which web interface to use"})]})}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-3",children:[t.jsxs("label",{className:a("flex items-start gap-3 p-4 bg-subtle-fill radius-card border-2 cursor-pointer transition-base",kt?"border-accent-primary bg-accent-primary/5":"border-transparent hover:border-accent-primary/30","loading"===Et&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:kt,onChange:()=>Ot(!0),disabled:"loading"===Et,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"type-body text-text-primary font-medium",children:"Default Frontend"}),t.jsx("a",{href:"https://github.com/rightup/pyMC_Repeater",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"type-data-xs bg-accent-tertiary/15 text-accent-tertiary px-2.5 py-0.5 rounded-full font-medium hover:bg-accent-tertiary/25 transition-colors",children:"@RightUp"})]}),t.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Built-in pyMC Repeater web interface"}),t.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_repeater/repeater/web/html"})]})]}),t.jsxs("label",{className:a("flex items-start gap-3 p-4 bg-subtle-fill radius-card border-2 cursor-pointer transition-base",kt?"border-transparent hover:border-accent-primary/30":"border-accent-primary bg-accent-primary/5","loading"===Et&&"opacity-50 pointer-events-none"),children:[t.jsx("input",{type:"radio",name:"frontend",checked:!kt,onChange:()=>Ot(!1),disabled:"loading"===Et,className:"mt-1 h-4 w-4 text-accent-primary focus:ring-accent-primary focus:ring-offset-bg-elevated"}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"type-body text-text-primary font-medium",children:"PyMC Console"}),t.jsx("span",{className:"type-data-xs bg-accent-secondary/15 text-accent-secondary px-2.5 py-0.5 rounded-full font-medium",children:"@Treehouse ⚡"})]}),t.jsx("div",{className:"type-body-sm text-text-muted mt-1",children:"Alternative web interface for pyMC Repeater"}),t.jsx("div",{className:"type-data-xs text-text-muted/60 mt-1 font-mono",children:"/opt/pymc_console/web/html"})]})]})]}),!Ft&&t.jsx("div",{className:a("bg-subtle-fill radius-card p-4",St?"border border-accent-success/20":"border border-accent-tertiary/20"),children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:a("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",St?"bg-accent-success/20":"bg-accent-tertiary/20"),children:St?t.jsx(O,{className:"w-4 h-4 text-accent-success"}):t.jsx(K,{className:"w-4 h-4 text-accent-tertiary"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:St?"PyMC Console has been detected":"PyMC Console Not Installed"}),St?t.jsxs("p",{className:"type-body-sm text-text-muted mt-1",children:["PyMC Console is installed at ",t.jsx("code",{className:"type-code bg-accent-success/10 px-1.5 py-0.5 rounded-full text-accent-success",children:"/opt/pymc_console/web/html"})]}):t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"type-body-sm text-text-muted mt-1 mb-3",children:["PyMC Console must be installed at ",t.jsx("code",{className:"type-code bg-accent-tertiary/10 px-1.5 py-0.5 rounded-full text-accent-tertiary",children:"/opt/pymc_console/web/html"})," before selecting this option."]}),t.jsxs("a",{href:"https://github.com/dmduran12/pymc_console-dist",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 h-[32px] px-4 bg-accent-tertiary/10 hover:bg-accent-tertiary/20 text-accent-tertiary rounded-full type-body-sm font-medium transition-colors",children:[t.jsx(W,{className:"w-4 h-4"}),"PyMC Console Install Instructions"]})]})]})]})}),Mt&&t.jsx("div",{className:"bg-subtle-fill radius-card p-4 border border-accent-secondary/30",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[t.jsx("div",{className:"w-8 h-8 rounded-full bg-accent-secondary/20 flex items-center justify-center flex-shrink-0",children:t.jsx($,{className:"w-4 h-4 text-accent-secondary"})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h4",{className:"type-body text-text-primary font-medium",children:"Service restart required"}),t.jsx("p",{className:"type-body-sm text-text-muted mt-1",children:"Web frontend changes will take effect after restarting the pymc-repeater service."})]})]}),t.jsx("button",{onClick:async()=>{if(!zt){At(!0);try{await k(),Rt(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{Rt(!1),setTimeout(()=>{window.location.reload()},3e3)}}},disabled:zt,className:"h-[32px] px-4 bg-accent-secondary/10 hover:bg-accent-secondary/20 text-accent-secondary rounded-full transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2 whitespace-nowrap type-body-sm font-medium",children:zt?t.jsxs(t.Fragment,{children:[t.jsx(r,{className:"w-4 h-4 animate-spin"}),"Restarting..."]}):t.jsxs(t.Fragment,{children:[t.jsx(B,{className:"w-4 h-4"}),"Restart Now"]})})]})})]})]})}),M&&t.jsx(V,{template:"auto",children:t.jsx(R,{nodeName:ue,repeaterVersion:M.version,coreVersion:M.core_version,localHash:M.local_hash,publicKey:M.public_key})}),M&&(0===(null==ce?void 0:ce.latitude)||!(null==ce?void 0:ce.latitude))&&(0===(null==ce?void 0:ce.longitude)||!(null==ce?void 0:ce.longitude))&&t.jsx(V,{template:"auto",children:t.jsx(be,{})})]}),Me&&t.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:t.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[t.jsx("h3",{id:"create-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Create API Token"}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(j,{label:"Token Name",type:"text",value:ze,onChange:e=>Ae(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&&Bt(),autoFocus:!0}),t.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{Re(!1),Ae(""),Pe(null)},disabled:qe,className:"px-4 py-2 bg-bg-subtle hover-bg text-text-secondary radius-inner border-control transition-base disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:Bt,disabled:qe||!ze.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary radius-inner border border-accent-primary/50 transition-base disabled:opacity-50 flex items-center gap-2",children:qe?t.jsxs(t.Fragment,{children:[t.jsx(r,{className:"w-4 h-4 animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),Ie&&Le&&t.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&&Ke(!1),role:"dialog","aria-modal":"true","aria-labelledby":"show-token-modal-title",children:t.jsxs("div",{className:"surface-modal radius-card p-6 max-w-lg w-full",children:[t.jsx("h3",{id:"show-token-modal-title",className:"type-subheading text-text-primary mb-4",children:"Token Created Successfully"}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 radius-inner p-3",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx($,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm text-text-secondary",children:[t.jsx("strong",{children:"Save this token now!"})," For security reasons, it will not be shown again."]})]})}),t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-text-primary block mb-1.5",children:"Your API Token"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(v,{value:Le,readOnly:!0,className:"flex-1 font-mono"}),t.jsxs("button",{onClick:()=>{Le&&(navigator.clipboard.writeText(Le),Ge(!0),setTimeout(()=>Ge(!1),2e3))},className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary radius-inner border border-accent-primary/50 transition-base flex items-center gap-2",title:"Copy to clipboard",children:[Xe?t.jsx(n,{className:"w-4 h-4 text-accent-success"}):t.jsx(X,{className:"w-4 h-4"}),Xe?"Copied!":"Copy"]})]})]}),t.jsxs("div",{className:"bg-accent-tertiary/10 border border-accent-tertiary/30 radius-inner p-3",children:[t.jsx("p",{className:"text-sm text-text-secondary mb-2",children:t.jsx("strong",{children:"Usage Example:"})}),t.jsxs("code",{className:"block bg-accent-tertiary/20 px-3 py-2 rounded text-xs text-accent-tertiary font-mono overflow-x-auto",children:['curl -H "X-API-Key: ',Le.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),t.jsx("div",{className:"flex justify-end mt-6",children:t.jsx("button",{onClick:()=>{Ke(!1),De(null)},className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary radius-inner border border-accent-primary/50 transition-base",children:"Done"})})]})]})}),t.jsx(P,{isOpen:!!Ve,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${null==Ve?void 0:Ve.name}'? This action cannot be undone.`,confirmLabel:$e?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:async()=>{if(Ve){Be(!0),Pe(null);try{await async function(e){return i(`/auth/tokens/${e}`,{method:"DELETE"})}(Ve.id),await $t(),He(null)}catch(e){Pe(e instanceof Error?e.message:"Failed to revoke token")}finally{Be(!1)}}},onCancel:()=>He(null)}),it&&t.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&&ot(!1),role:"dialog","aria-modal":"true","aria-labelledby":"add-key-modal-title",children:t.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[t.jsx("h3",{id:"add-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Add Transport Key"}),t.jsxs("div",{className:"space-y-4",children:[rt&&t.jsxs("div",{className:"bg-accent-tertiary/10 border border-accent-tertiary/30 radius-inner p-3 text-sm text-text-secondary",children:["Adding as child of: ",t.jsx("strong",{className:"text-text-primary",children:Yt()})]}),t.jsx(j,{label:"Key Name",type:"text",value:ft,onChange:e=>gt(e.target.value),placeholder:"e.g., Region Name, Group Key",onKeyDown:e=>"Enter"===e.key&&Zt(),autoFocus:!0}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),t.jsxs("div",{className:"flex bg-bg-subtle radius-inner border-control p-1",children:[t.jsx("button",{onClick:()=>vt("deny"),className:a("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===jt?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),t.jsx("button",{onClick:()=>vt("allow"),className:a("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===jt?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),t.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{ot(!1),gt(""),vt("deny")},disabled:Nt,className:"px-4 py-2 bg-bg-subtle hover-bg text-text-secondary radius-inner border-control transition-base disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:Zt,disabled:Nt||!ft.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary radius-inner border border-accent-primary/50 transition-base disabled:opacity-50 flex items-center gap-2",children:Nt?t.jsxs(t.Fragment,{children:[t.jsx(r,{className:"w-4 h-4 animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),dt&&pt&&t.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&&mt(!1),role:"dialog","aria-modal":"true","aria-labelledby":"edit-key-modal-title",children:t.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[t.jsx("h3",{id:"edit-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Edit Transport Key"}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(j,{label:"Key Name",type:"text",value:pt.name,onChange:e=>ht({...pt,name:e.target.value}),autoFocus:!0}),t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Flood Policy"}),t.jsxs("div",{className:"flex bg-bg-subtle radius-inner border-control p-1",children:[t.jsx("button",{onClick:()=>ht({...pt,floodPolicy:"deny"}),className:a("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","deny"===pt.floodPolicy?"bg-accent-danger/20 text-accent-danger border border-accent-danger/50":"text-text-muted hover:text-text-secondary"),children:"DENY"}),t.jsx("button",{onClick:()=>ht({...pt,floodPolicy:"allow"}),className:a("flex-1 px-3 py-2 text-sm font-medium rounded transition-colors","allow"===pt.floodPolicy?"bg-accent-success/20 text-accent-success border border-accent-success/50":"text-text-muted hover:text-text-secondary"),children:"ALLOW"})]})]}),pt.transport_key&&t.jsxs("div",{children:[t.jsx("label",{className:"type-label text-text-muted block mb-2",children:"Transport Key"}),t.jsx("code",{className:"block bg-bg-subtle px-3 py-2 radius-inner text-xs text-text-muted font-mono overflow-x-auto",children:pt.transport_key})]}),t.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[t.jsx("button",{onClick:()=>{mt(!1),bt(pt),xt(!0),ht(null)},disabled:Nt,className:"px-4 py-2 bg-accent-danger/20 hover:bg-accent-danger/30 text-accent-danger radius-inner border border-accent-danger/50 transition-base disabled:opacity-50",children:"Delete"}),t.jsxs("div",{className:"flex gap-3",children:[t.jsx("button",{onClick:()=>{mt(!1),ht(null)},disabled:Nt,className:"px-4 py-2 bg-bg-subtle hover-bg text-text-secondary radius-inner border-control transition-base disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:async()=>{if(pt){wt(!0),Ze(null);try{const e=await _(pt.id,{name:pt.name,flood_policy:pt.floodPolicy});e.success?(await Ut(),mt(!1),ht(null)):Ze(e.error||"Failed to update transport key")}catch(e){Ze(e instanceof Error?e.message:"Failed to update transport key")}finally{wt(!1)}}},disabled:Nt||!pt.name.trim(),className:"px-4 py-2 bg-accent-primary/20 hover:bg-accent-primary/30 text-text-primary radius-inner border border-accent-primary/50 transition-base disabled:opacity-50 flex items-center gap-2",children:Nt?t.jsxs(t.Fragment,{children:[t.jsx(r,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),ut&&yt&&t.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&&xt(!1),role:"dialog","aria-modal":"true","aria-labelledby":"delete-key-modal-title",children:t.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[t.jsx("h3",{id:"delete-key-modal-title",className:"type-subheading text-text-primary mb-4",children:"Delete Transport Key"}),t.jsxs("p",{className:"text-text-secondary mb-4",children:["Are you sure you want to delete ",t.jsxs("strong",{className:"text-text-primary",children:["'",yt.name,"'"]}),"?"]}),yt.children&&yt.children.length>0&&t.jsx("div",{className:"bg-accent-secondary/10 border border-accent-secondary/30 radius-inner p-3 mb-4",children:t.jsxs("div",{className:"flex gap-2",children:[t.jsx($,{className:"w-4 h-4 text-accent-secondary flex-shrink-0 mt-0.5"}),t.jsxs("div",{className:"text-sm text-text-secondary",children:["This key has ",yt.children.length," child key(s). Deleting will also remove all children."]})]})}),t.jsxs("div",{className:"flex justify-end gap-3",children:[t.jsx("button",{onClick:()=>{xt(!1),bt(null)},disabled:Nt,className:"px-4 py-2 bg-bg-subtle hover:bg-bg-elevated text-text-secondary rounded-lg border border-border-subtle transition-colors disabled:opacity-50",children:"Cancel"}),t.jsx("button",{onClick:async()=>{if(yt){wt(!0),Ze(null);try{const e=await F(yt.id);e.success?(await Ut(),xt(!1),bt(null),nt(null)):Ze(e.error||"Failed to delete transport key")}catch(e){Ze(e instanceof Error?e.message:"Failed to delete transport key")}finally{wt(!1)}}},disabled:Nt,className:"px-4 py-2 bg-accent-danger/20 hover:bg-accent-danger/30 text-accent-danger radius-inner border border-accent-danger/50 transition-base disabled:opacity-50 flex items-center gap-2",children:Nt?t.jsxs(t.Fragment,{children:[t.jsx(r,{className:"w-4 h-4 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{we as default}; diff --git a/frontend/dist/assets/ConfirmModal-C50H21Nf.js b/frontend/dist/assets/ConfirmModal-ptKJzd5A.js similarity index 89% rename from frontend/dist/assets/ConfirmModal-C50H21Nf.js rename to frontend/dist/assets/ConfirmModal-ptKJzd5A.js index 08e8b9b2..85d0e273 100644 --- a/frontend/dist/assets/ConfirmModal-C50H21Nf.js +++ b/frontend/dist/assets/ConfirmModal-ptKJzd5A.js @@ -1 +1 @@ -import{c as a,K as e,bG as s,N as n,cD as t,B as r}from"./index-CImKXCRQ.js";import{r as c,j as o,c as l}from"./vendor-react-j_fHog8x.js";import{T as i}from"./triangle-alert-DRA45BSe.js";const d=a("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),m=a("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-accent-danger",warning:"text-accent-secondary",default:"text-accent-primary"},x={danger:"danger",warning:"warning",default:"primary"},p=c.memo(function({isOpen:a,title:c="Confirm",message:d,confirmLabel:m="Confirm",cancelLabel:p="Cancel",variant:j="default",onConfirm:f,onCancel:y}){return o.jsxs(e,{open:a,onClose:y,size:"sm",children:[o.jsx(s,{icon:o.jsx(i,{className:l("w-5 h-5",h[j])}),title:c,onClose:y}),o.jsx(n,{children:o.jsx("p",{className:"text-sm text-text-secondary",children:d})}),o.jsxs(t,{children:[o.jsx(r,{color:"muted",onClick:y,className:"flex-1",children:p}),o.jsx(r,{color:x[j],onClick:f,className:"flex-1",children:m})]})]})});export{p as C,d as P,m as T}; +import{c as a,K as e,bG as s,N as n,cD as t,B as r}from"./index-B51aMfiH.js";import{r as c,j as o,c as l}from"./vendor-react-j_fHog8x.js";import{T as i}from"./triangle-alert-JpcXY4mr.js";const d=a("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),m=a("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-accent-danger",warning:"text-accent-secondary",default:"text-accent-primary"},x={danger:"danger",warning:"warning",default:"primary"},p=c.memo(function({isOpen:a,title:c="Confirm",message:d,confirmLabel:m="Confirm",cancelLabel:p="Cancel",variant:j="default",onConfirm:f,onCancel:y}){return o.jsxs(e,{open:a,onClose:y,size:"sm",children:[o.jsx(s,{icon:o.jsx(i,{className:l("w-5 h-5",h[j])}),title:c,onClose:y}),o.jsx(n,{children:o.jsx("p",{className:"text-sm text-text-secondary",children:d})}),o.jsxs(t,{children:[o.jsx(r,{color:"muted",onClick:y,className:"flex-1",children:p}),o.jsx(r,{color:x[j],onClick:f,className:"flex-1",children:m})]})]})});export{p as C,d as P,m as T}; diff --git a/frontend/dist/assets/Contacts-CATHuNF1.js b/frontend/dist/assets/Contacts-CJ7zcVr1.js similarity index 95% rename from frontend/dist/assets/Contacts-CATHuNF1.js rename to frontend/dist/assets/Contacts-CJ7zcVr1.js index 79d1ac9b..ff036e2a 100644 --- a/frontend/dist/assets/Contacts-CATHuNF1.js +++ b/frontend/dist/assets/Contacts-CJ7zcVr1.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-DKxJWyoZ.js","assets/vendor-react-j_fHog8x.js","assets/BasemapLayer-Dkb0XoZP.js","assets/vendor-core-CDNU4oKM.js","assets/link-scoring-B0M8cDnn.js","assets/index-CImKXCRQ.js","assets/ConfirmModal-C50H21Nf.js","assets/triangle-alert-DRA45BSe.js","assets/DeepAnalysisModal-C0GEcHVb.js","assets/geo-utils-qEuqoaud.js","assets/config-CTM8_93T.js","assets/git-branch-CIWPjlTx.js","assets/database-1Jgt_gPe.js","assets/trending-up-BBUOgjQN.js","assets/DelayedAnimateNumber-B6DSbUSU.js","assets/index-CGYcizrv.js","assets/refresh-cw-DElcO6pC.js","assets/target-BLCR6B60.js","assets/easing-BgpNFdtT.js","assets/SignalIndicator-JkITXu3r.js","assets/signal-scoring-CcBiRcks.js","assets/font-loader-BQzEmDrZ.js","assets/users-BZZVk2mu.js","assets/LightSparkline-96Ro4wc3.js","assets/copy-CfZtRqCt.js","assets/map-pin-lRKxIpXD.js","assets/ping-C1JzD5-V.js","assets/PageLayout-CBx7rIBL.js","assets/listbox-DnYSFKvT.js","assets/activity-3eg63twO.js","assets/DataBox-BUgVf-3d.js","assets/funnel-BR-9uKC6.js","assets/circle-check-DK-UNKLb.js","assets/CollisionExplorerModal-EDF-OEuX.js","assets/network-CY6CQ8MF.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-gDSZCHkY.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,au as l,av as i,aw as r,ao as c,ax as o,O as d,M as x,f as m,ah as h,ay as p,az as u,v as g,e as j,G as b,Q as N,aA as v,p as f,aB as y,aC as w,aD as k,o as C,aE as M,aF as S,aG as L,X as P,aH as R,I as F,a0 as H,R as E}from"./index-CImKXCRQ.js";import{p as T}from"./ping-C1JzD5-V.js";import{P as _,b as O,B as z}from"./PageLayout-CBx7rIBL.js";import{L as $,a as D}from"./listbox-DnYSFKvT.js";import{G as I}from"./git-branch-CIWPjlTx.js";import{T as A}from"./triangle-alert-DRA45BSe.js";import{a as G,T as V,M as U}from"./trending-up-BBUOgjQN.js";import{c as K,Z as B,a as W,C as q,d as Q,e as Z}from"./SignalIndicator-JkITXu3r.js";import{E as X,S as J,T as Y,a as ee}from"./target-BLCR6B60.js";import{A as se}from"./activity-3eg63twO.js";import{D as te}from"./DataBox-BUgVf-3d.js";import{F as ae}from"./funnel-BR-9uKC6.js";import{P as ne,T as le,C as ie}from"./ConfirmModal-C50H21Nf.js";import{U as re}from"./users-BZZVk2mu.js";import{M as ce}from"./map-pin-lRKxIpXD.js";import{C as oe}from"./circle-check-DK-UNKLb.js";import{L as de}from"./LightSparkline-96Ro4wc3.js";import{C as xe,S as me,M as he}from"./CollisionExplorerModal-EDF-OEuX.js";import{N as pe}from"./network-CY6CQ8MF.js";const ue=n("arrow-left-right",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]),ge=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"}]]),je=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"}]]),be=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"}]]),Ne=n("list-filter",[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]]),ve=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"}]]),fe=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"}]]);class ye 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-text-muted p-4",children:[e.jsx("p",{className:"text-lg mb-2",children:"Map failed to load"}),e.jsx("p",{className:"text-sm text-text-muted",children:(null==(s=this.state.error)?void 0:s.message)||"Unknown error"}),e.jsx("p",{className:"text-xs text-text-muted mt-2",children:"Try refreshing the page or check your browser's WebGL support."})]})}):this.props.children}}const we=s.lazy(()=>a(()=>import("./ContactsMapMapLibre-DKxJWyoZ.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])));function ke({neighbors:a,localNode:n,localHash:i,onRemoveNode:r,selectedNodeHash:c,onNodeSelected:o,highlightedEdgeKey:d,highlightedGhost:x}){return e.jsx(ye,{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-text-muted flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading map..."})]})}),children:e.jsx(we,{neighbors:a,localNode:n,localHash:i,onRemoveNode:r,selectedNodeHash:c,onNodeSelected:o,highlightedEdgeKey:d,highlightedGhost:x})})})}function Ce(e){return e>=.7?"text-accent-success":e>=.5?"text-accent-secondary":e>=.3?"text-signal-poor":"text-accent-danger"}function Me(e){return`${Math.round(100*e)}%`}function Se(e,s){return s.has(e.toUpperCase())}const Le=s.memo(function({path:s,isHighlighted:t,onHighlight:a,ghostPrefixes:n}){const l=function(s){return s>.2?{icon:e.jsx(V,{className:"w-3 h-3"}),color:"text-accent-success"}:s<-.2?{icon:e.jsx(G,{className:"w-3 h-3"}),color:"text-accent-danger"}:{icon:e.jsx(x,{className:"w-3 h-3"}),color:"text-text-muted"}}(s.observationTrend),i=s.weakestLinkKey&&s.weakestLinkConfidence<.5,r=s.hops.some(e=>Se(e,n));return e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md transition-colors cursor-pointer "+(t?"bg-accent-primary/20 border border-accent-primary/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-accent-success/10":c>=.5?"bg-accent-secondary/10":c>=.3?"bg-signal-poor/10":"bg-accent-danger/10"),children:e.jsx("span",{className:`text-xs font-semibold tabular-nums ${Ce(s.healthScore)}`,children:Me(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=Se(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:"text-[10px] font-mono px-1.5 py-0.5 rounded flex items-center gap-0.5 "+(r?"bg-accent-tertiary/20 text-accent-tertiary border border-accent-tertiary/30":c?"bg-accent-danger/20 text-accent-danger":"bg-subtle-fill-strong text-text-secondary"),children:[r&&e.jsx(o,{className:"w-2.5 h-2.5"}),t]}),anew Set(m.map(e=>e.prefix.toUpperCase())),[m]),g=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("div",{className:"chart-container",children:[e.jsxs("button",{onClick:()=>p(!h),className:"w-full chart-header hover:bg-subtle-fill transition-colors rounded-t-lg cursor-pointer",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(I,{className:"chart-title-icon"}),"Path Health",e.jsxs("span",{className:"ml-2 text-[10px] font-normal text-text-muted",children:["(",l.length," paths)"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[j&&e.jsxs("div",{className:"flex items-center gap-3 text-[10px]",children:[e.jsxs("span",{className:`tabular-nums ${Ce(j.avgHealth)}`,children:["Avg: ",Me(j.avgHealth)]}),j.weakLinks>0&&e.jsxs("span",{className:"text-accent-danger flex items-center gap-1",children:[e.jsx(A,{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(G,{className:"w-3 h-3"}),j.declining," declining"]}),j.pathsWithGhosts>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(o,{className:"w-3 h-3"}),j.pathsWithGhosts," ghost"]})]}),h?e.jsx(K,{className:"w-4 h-4 text-text-muted"}):e.jsx(d,{className:"w-4 h-4 text-text-muted"})]})]}),h&&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-[10px] text-text-muted pb-2 border-b border-border-subtle",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(X,{className:"w-3 h-3 text-accent-primary"}),e.jsx("span",{className:"text-text-secondary",children:x.totalPaths.toLocaleString()})," Viterbi decoded"]}),x.observationOverrideCount>0&&e.jsxs("span",{className:"text-accent-success",children:[Math.round(x.observationOverrideCount/x.totalPaths*100),"% observation override"]}),m.length>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(o,{className:"w-3 h-3"}),m.length," ghost",1!==m.length?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-text-muted pb-2 border-b border-border-subtle",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-success"})," Healthy (≥70%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-secondary"})," 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-accent-danger"})," Critical (<30%)"]}),m.length>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(o,{className:"w-3 h-3 text-accent-tertiary"})," Ghost"]})]}),e.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:g.map(s=>e.jsx(Le,{path:s,isHighlighted:n===s.weakestLinkKey,onHighlight:b,ghostPrefixes:u},s.pathKey))}),l.length>t&&e.jsxs("div",{className:"text-center text-[10px] text-text-muted pt-2",children:["Showing top ",t," of ",l.length," paths"]})]})]})});function Re(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 Fe={confirmed:{label:"Confirmed",icon:e.jsx(fe,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-success/40",bgClass:"bg-accent-success/10",textClass:"text-accent-success",badgeClass:"bg-accent-success/20 text-accent-success"},likely:{label:"Likely",icon:e.jsx(m,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-tertiary/30",bgClass:"bg-accent-tertiary/5",textClass:"text-accent-tertiary",badgeClass:"bg-accent-tertiary/20 text-accent-tertiary"},possible:{label:"Possible",icon:e.jsx(W,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-secondary/20",bgClass:"bg-accent-secondary/5",textClass:"text-accent-secondary",badgeClass:"bg-accent-secondary/20 text-accent-secondary"},noise:{label:"Noise",icon:e.jsx(A,{className:"w-3.5 h-3.5"}),borderClass:"border-border-muted",bgClass:"bg-bg-card/30",textClass:"text-text-muted",badgeClass:"bg-bg-elevated text-text-muted"}};function He({ghost:a,neighbors:n,isExpanded:l,onToggle:i,compact:r}){var c,x;const m=(null==(c=a.classification)?void 0:c.tier)??"noise",u=Fe[m],g="clusterId"in(j=a)&&"temporal"in j;var j;const b=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]),N=a.estimatedLocation?a.estimatedLocation.uncertaintyM>=1e3?`±${(a.estimatedLocation.uncertaintyM/1e3).toFixed(1)}km`:`±${Math.round(a.estimatedLocation.uncertaintyM)}m`:null,v=g&&a.temporal?(f=a.temporal.consistency)>=.7?{label:"Steady",color:"text-accent-success"}:f>=.4?{label:"Regular",color:"text-accent-tertiary"}:f>=.2?{label:"Sporadic",color:"text-accent-secondary"}:{label:"Bursty",color:"text-signal-poor"}:null;var f;const y=g&&a.collisionCandidates&&a.collisionCandidates.length>0,w=y?a.collisionCandidates[0]:null;return r?e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded bg-bg-elevated/50 text-sm",children:[e.jsx("span",{className:"font-mono font-medium text-text-secondary",children:a.prefix.toUpperCase()}),e.jsx("span",{className:"text-text-muted",children:a.observationCount})]}):e.jsxs("div",{className:t("rounded-lg border transition-all duration-150",u.borderClass,u.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(o,{className:t("w-5 h-5 flex-shrink-0",u.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-text-primary",children:a.prefix.toUpperCase()}),e.jsx("span",{className:t("px-1.5 py-0.5 rounded text-sm font-medium",u.badgeClass),children:u.label})]}),e.jsx("div",{className:t("text-sm mt-0.5",u.textClass),children:(null==(x=a.classification)?void 0:x.reason)??"Unknown"}),e.jsxs("div",{className:"flex items-center gap-3 text-sm text-text-muted mt-1",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(X,{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(re,{className:"w-3 h-3"}),a.commonNeighbors.size]}),a.estimatedLocation&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ce,{className:"w-3 h-3"}),N]}),v&&e.jsxs("span",{className:t("flex items-center gap-1",v.color),children:[e.jsx(se,{className:"w-3 h-3"}),v.label]}),y&&e.jsxs("span",{className:"flex items-center gap-1 text-signal-poor",children:[e.jsx(J,{className:"w-3 h-3"}),"Collision?"]})]})]}),l?e.jsx(K,{className:"w-4 h-4 text-text-muted"}):e.jsx(d,{className:"w-4 h-4 text-text-muted"})]}),l&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-border-muted/50 mt-1 pt-3",children:[y&&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(J,{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-text-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(te,{copy:!0,size:"compact",className:"inline",children:w.knownNodeHash})," ","(",(100*w.collisionProbability).toFixed(0),"% probability)"]})}),w.evidence&&e.jsxs("div",{className:"text-text-muted mt-1 text-[10px]",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-accent-secondary",children:"Within uncertainty radius"})]})]})]})}),a.estimatedLocation?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ce,{className:"w-4 h-4 text-accent-primary mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary font-medium",children:[a.estimatedLocation.lat.toFixed(5),", ",a.estimatedLocation.lon.toFixed(5)]}),e.jsxs("div",{className:"text-text-muted",children:["Uncertainty: ",N]}),g&&a.location&&e.jsxs("div",{className:"mt-1 text-text-muted",children:[e.jsxs("div",{children:["Method: ",Re(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-text-muted",children:[e.jsx(A,{className:"w-4 h-4 text-signal-poor"}),"Location unknown (neighbors lack coordinates)"]}),g&&a.temporal&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(se,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary font-medium",children:["Temporal Pattern: ",e.jsx("span",{className:null==v?void 0:v.color,children:null==v?void 0:v.label})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5 mt-1 text-text-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"]})]})]})]}),!g&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(h,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary",children:["First seen: ",p(a.firstSeen)," ago"]}),e.jsxs("div",{className:"text-text-muted",children:["Last seen: ",p(a.lastSeen)," ago"]})]})]}),g&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(je,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary",children:["Active period: ",p(a.firstSeen)," – ",p(a.lastSeen)," ago"]}),a.temporal&&e.jsxs("div",{className:"text-text-muted",children:["Obs/hour avg: ",a.temporal.observationsPerHour.toFixed(1)]})]})]}),b.length>0&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(re,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-muted mb-1",children:["Adjacent to ",b.length," known node",1!==b.length?"s":"",":"]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[b.slice(0,5).map(({hash:s})=>e.jsx(te,{copy:!0,size:"compact",children:s},s)),b.length>5&&e.jsxs("span",{className:"text-text-muted",children:["+",b.length-5," more"]})]})]})]}),g&&a.validationStages&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30",children:[e.jsx("div",{className:"text-[10px] text-text-muted mb-1.5 uppercase tracking-wide",children:"Validation Stages"}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(Ee,{label:"Candidates",passed:a.validationStages.candidateExhaustion}),e.jsx(Ee,{label:"Temporal",passed:a.validationStages.temporalConsistency}),e.jsx(Ee,{label:"Topology",passed:a.validationStages.topologicalFit}),e.jsx(Ee,{label:"Location",passed:a.validationStages.locationPlausible})]})]}),a.classification&&!g&&e.jsx("div",{className:"pt-2 border-t border-border-muted/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-[10px] bg-accent-success/20 text-accent-success",children:"200+ obs"}),a.classification.criteria.hasHighObservations&&!a.classification.criteria.hasVeryHighObservations&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-tertiary/20 text-accent-tertiary",children:"50+ obs"}),a.classification.criteria.hasHighConfidence&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-success/20 text-accent-success",children:"70%+ conf"}),a.classification.criteria.hasCommonNeighbors&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-primary/20 text-accent-primary",children:"2+ neighbors"}),a.classification.criteria.hasGoodLocation&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-primary/20 text-accent-primary",children:"good loc"}),a.classification.criteria.isRecent&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-text-muted/20 text-text-muted",children:"recent"})]})}),g&&a.upgradeRequirements&&a.upgradeRequirements.length>0&&"confirmed"!==m&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30",children:[e.jsx("div",{className:"text-[10px] text-text-muted mb-1 uppercase tracking-wide",children:"To upgrade tier:"}),e.jsx("ul",{className:"text-xs text-text-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-accent-tertiary",children:"•"})," ",s]},t))})]})]})]})}function Ee({label:s,passed:a}){return e.jsxs("span",{className:t("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium",a?"bg-accent-success/20 text-accent-success":"bg-bg-elevated text-text-muted"),children:[a?e.jsx(oe,{className:"w-2.5 h-2.5"}):e.jsx(q,{className:"w-2.5 h-2.5"}),s]})}function Te({neighbors:a,className:n,onGhostSelect:l}){const i=c(),h=r(),[p,u]=s.useState(new Set),[g,j]=s.useState("actionable"),[b,N]=s.useState(!1),[v,f]=s.useState(!0),[y,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,y)),[i,y]),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&&!v?{prefix:M.prefix,commonNeighbors:Array.from(M.commonNeighbors),estimatedLocation:M.estimatedLocation}:null)},[M,v,l]),s.useEffect(()=>{v&&u(new Set)},[v]);const{confirmed:S,likely:L,possible:P,noise:R,actionableCount:F}=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 H=e=>{u(s=>s.has(e)?new Set:new Set([e]))},E="all"===g,T=S.length+L.length+(E?P.length:0)+(b?R.length:0);return e.jsxs("div",{className:n,children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(o,{className:"chart-title-icon"}),"Ghost Buster",F>0&&e.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-accent-success/20 text-accent-success",children:[F," actionable"]}),v&&k.length>0&&e.jsxs("span",{className:"text-xs text-text-muted ml-2",children:["(",k.length," total)"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!v&&e.jsxs("button",{onClick:()=>j(e=>"actionable"===e?"all":"actionable"),className:t("flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors","all"===g?"bg-accent-primary/20 text-accent-primary":"bg-bg-elevated text-text-muted hover:text-text-secondary"),children:[e.jsx(ae,{className:"w-3 h-3"}),"actionable"===g?"Actionable":"All"]}),e.jsx("button",{onClick:()=>f(e=>!e),className:"flex items-center gap-1 px-2 py-1 rounded text-xs bg-bg-elevated text-text-muted hover:text-text-secondary transition-colors",title:v?"Expand panel":"Minimize panel",children:v?e.jsx(ne,{className:"w-3 h-3"}):e.jsx(x,{className:"w-3 h-3"})})]})]}),v?e.jsxs("div",{className:"px-5 py-3 flex items-center gap-3 text-xs cursor-pointer hover:bg-subtle-fill transition-colors",onClick:()=>f(!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-accent-success",children:[e.jsx(fe,{className:"w-3 h-3"}),S.length," confirmed"]}),L.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent-tertiary",children:[e.jsx(m,{className:"w-3 h-3"}),L.length," likely"]}),P.length>0&&e.jsxs("span",{className:"text-accent-secondary",children:[P.length," possible"]}),R.length>0&&e.jsxs("span",{className:"text-text-muted",children:[R.length," noise"]})]}),e.jsx("span",{className:"text-text-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-border-muted/30",children:[e.jsxs("span",{className:"text-text-muted",children:[h.pathsWithGhosts.toLocaleString()," / ",h.totalPaths.toLocaleString()," paths"]}),e.jsx("span",{className:"text-text-muted",children:"•"}),e.jsxs("div",{className:"flex items-center gap-2",children:[S.length>0&&e.jsxs("span",{className:"text-accent-success",children:[S.length," confirmed"]}),L.length>0&&e.jsxs("span",{className:"text-accent-tertiary",children:[L.length," likely"]}),P.length>0&&e.jsxs("span",{className:"text-accent-secondary",children:[P.length," possible"]}),R.length>0&&e.jsxs("span",{className:"text-text-muted",children:[R.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-accent-success",children:[e.jsx(fe,{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(He,{ghost:s,neighbors:a,isExpanded:p.has(s.prefix),onToggle:()=>H(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-accent-tertiary",children:[e.jsx(m,{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(He,{ghost:s,neighbors:a,isExpanded:p.has(s.prefix),onToggle:()=>H(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-accent-secondary",children:[e.jsx(W,{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(He,{ghost:s,neighbors:a,isExpanded:p.has(s.prefix),onToggle:()=>H(s.prefix)},s.prefix)),P.length>10&&e.jsxs("div",{className:"text-xs text-text-muted text-center py-1",children:["+",P.length-10," more possible nodes"]})]})]}),R.length>0&&"all"===g&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{onClick:()=>N(!b),className:"flex items-center gap-2 text-xs text-text-muted hover:text-text-secondary transition-colors",children:[b?e.jsx(K,{className:"w-3.5 h-3.5"}):e.jsx(d,{className:"w-3.5 h-3.5"}),e.jsx(A,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["Noise (",R.length,")"]})]}),b&&e.jsx("div",{className:"flex flex-wrap gap-1",children:R.map(s=>e.jsx(He,{ghost:s,neighbors:a,isExpanded:!1,onToggle:()=>{},compact:!0},s.prefix))})]}),"actionable"===g&&0===F&&e.jsxs("div",{className:"text-center py-6 text-sm text-text-muted",children:[e.jsx(o,{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+R.length," prefixes need more evidence."]}),e.jsxs("button",{onClick:()=>j("all"),className:"mt-3 text-accent-primary hover:underline",children:["View all ",k.length," discovered nodes"]})]}),h.observationOverrideCount>0&&T>0&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30 text-xs text-text-muted",children:[e.jsx("span",{className:"text-accent-primary",children:h.observationOverrideCount})," observation overrides • Avg confidence: ",e.jsxs("span",{className:"text-accent-secondary",children:[(100*h.avgPathConfidence).toFixed(0),"%"]})]})]})]})]})}const _e=s.memo(function({hash:t,className:a="",size:n="sm",collisionInfo:l,isViterbiResolved:i}){const c=u(),o=r(),[d,x]=s.useState(!1),h=s.useMemo(()=>g(t),[t]),p=s.useMemo(()=>void 0!==l?l:h?c.find(e=>e.prefix===h)??null:null,[h,c,l]),j=i??(o.totalPaths>0&&o.avgPathConfidence>=.7),b=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),x(!0)},[]),N=s.useCallback(()=>{x(!1)},[]);if(!p)return null;const v="sm"===n?"w-3.5 h-3.5":"w-4 h-4",f=j?"text-accent-tertiary hover:text-accent-tertiary hover:bg-accent-tertiary/10 focus:ring-accent-tertiary/50":"text-signal-fair hover:text-accent-secondary hover:bg-signal-fair/10 focus:ring-signal-fair/50",y=j?`Prefix conflict resolved by Viterbi HMM (${(100*o.avgPathConfidence).toFixed(0)}% confidence)`:`Prefix conflict: ${p.candidateCount} nodes share prefix "${h}"`;return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:b,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${f} ${a}`,title:y,"aria-label":`View prefix conflict for ${h}${j?" (Viterbi resolved)":""}`,children:j?e.jsxs("span",{className:"relative",children:[e.jsx(X,{className:v}),e.jsx(m,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-accent-success"})]}):e.jsx(be,{className:v})}),e.jsx(xe,{isOpen:d,prefix:p.prefix,candidateHashes:p.candidateHashes,onClose:N})]})}),Oe=s.memo(function({hash:s,contact:t,isHub:a,isNeighbor:n,distance:l,centrality:i,sparklineData:r,isSparklineLoading:c,neighborSignal:o,collisionInfo:d,isViterbiResolved:x,isPinging:h,isPingingThis:p,pingResult:u,pingError:g,onRowClick:v,onPing:f,onRemove:y}){var w;const k=t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude,C=t.node_name||t.name||"Unknown",M=n&&o,S=null==(w=t.contact_type)?void 0:w.toLowerCase(),L="room server"===S||"room_server"===S||"room"===S||"server"===S,P="companion"===S,R="client"===S||"cli"===S,F=t.is_repeater||"repeater"===S||"rep"===S,H=n?"direct":"flood",E=n?"Direct RF contact (zero-hop neighbor)":"Flood routing (multi-hop via mesh)";return e.jsxs("div",{className:`contacts-grid-row ${a?"bg-amber-500/5 border-l-2 border-l-amber-400":""} ${k?"cursor-pointer hover:bg-subtle-fill":""}`,onClick:()=>v(s),children:[e.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[M&&null!==(null==o?void 0:o.avgSnr)?e.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0 self-center "+(_=o.avgSnr,void 0===_?"bg-[var(--signal-unknown)]":_>=5?"bg-[var(--signal-excellent)]":_>=0?"bg-[var(--signal-good)]":_>=-5?"bg-[var(--signal-fair)]":_>=-10?"bg-[var(--signal-poor)]":"bg-[var(--signal-critical)]")}):e.jsx("div",{className:"w-2 flex-shrink-0"}),e.jsx("div",{className:"roster-icon flex-shrink-0",title:E,children:L&&F?e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(U,{className:"w-5 h-5 absolute inset-0 text-sys-pink"}),e.jsx(me,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-sys-teal"})]}):L?e.jsx(U,{className:"w-5 h-5 text-sys-pink"}):P?e.jsx(he,{className:"w-5 h-5 text-text-muted"}):F?"direct"===H?e.jsx(ue,{className:"w-5 h-5 text-sys-green"}):e.jsx(me,{className:"w-5 h-5 text-sys-cyan"}):e.jsx(he,{className:"w-5 h-5 text-text-muted"})}),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:C,children:C}),n&&e.jsx(j,{color:Q.neighbor,compact:!0,className:"flex-shrink-0",children:"NBR"}),a&&e.jsxs(j,{color:Q.hub,compact:!0,className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(pe,{className:"w-3 h-3"}),"HUB"]}),F&&e.jsx(j,{color:Q.repeater,compact:!0,className:"flex-shrink-0",children:"RPT"}),L&&e.jsx(j,{color:Q.room,compact:!0,className:"flex-shrink-0",children:"ROOM"}),P&&e.jsx(j,{color:Q.companion,compact:!0,className:"flex-shrink-0",children:"COMP"}),R&&e.jsx(j,{color:Q.client,compact:!0,className:"flex-shrink-0",children:"CLIENT"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(te,{copy:!0,size:"compact",truncate:[8,6],children:s}),e.jsx(_e,{hash:s,collisionInfo:d,isViterbiResolved:x})]})]})]}),e.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[M&&null!==(null==o?void 0:o.avgRssi)&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Z,{rssi:o.avgRssi,className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs tabular-nums text-text-muted",children:Math.round(o.avgRssi)})]}),M&&null!==(null==o?void 0:o.avgSnr)&&e.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[o.avgSnr.toFixed(1)," dB"]})]}),e.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-text-muted",children:null!=l&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs tabular-nums",children:(T=l,T<1e3?`${Math.round(T)}m`:`${(T/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(se,{className:"w-3 h-3 text-accent-secondary"}),e.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[(100*i).toFixed(0),"%"]})]})}),e.jsx("div",{className:"contacts-col-activity flex items-center justify-center",children:e.jsx(de,{data:r,width:48,height:16,isLoading:c})}),e.jsx("div",{className:"contacts-col-seen flex items-center justify-end",children:e.jsx("span",{className:"type-data-xs tabular-nums text-text-primary whitespace-nowrap",children:t.last_seen?b(t.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[n&&e.jsx(e.Fragment,{children:u?e.jsxs("div",{className:"flex items-center gap-1 text-accent-success",title:`RTT: ${u.rtt_ms.toFixed(0)}ms`,children:[e.jsx(m,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"type-data-xs tabular-nums hidden sm:inline",children:[u.snr_db.toFixed(1),"dB"]})]}):g?e.jsx("span",{className:"text-red-400 text-[10px]",title:g,children:"✗"}):e.jsx("button",{onClick:e=>f(s,e),disabled:h,className:"p-1 sm:p-1.5 radius-inner text-text-muted/50 hover:text-accent-primary hover:bg-accent-primary/10 transition-base disabled:opacity-50 disabled:cursor-not-allowed",title:"Ping neighbor for updated signal info",children:p?e.jsx(N,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):e.jsx(Y,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),e.jsx("button",{onClick:e=>{e.stopPropagation(),y(s,C)},className:"p-1 sm:p-1.5 radius-inner text-text-muted/50 hover:text-red-400 hover:bg-red-500/10 transition-base",title:"Remove contact",children:e.jsx(le,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]});var T,_}),ze=[];function $e(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 De=Object.freeze(Object.defineProperty({__proto__:null,default:function(){const{stats:t}=v(),a=f(),n=y(),l=w(),i=k(),o=C(),d=c(),x=M(),p=u(),j=r(),b=S(),I=L(),A=P(),G=j.totalPaths>0&&j.avgPathConfidence>=.7,V=s.useMemo(()=>{const e=new Map;for(const s of p)e.set(s.prefix,s);return e},[p]),U=!A.backgroundLoadComplete||I,[K,B]=s.useState(null),[W,q]=s.useState("lastHeard"),[Q,Z]=s.useState("desc"),[X,J]=s.useState(""),[Y,te]=s.useState(!1),[ae,ne]=s.useState(new Set),[le,oe]=s.useState(!1),[de,xe]=s.useState(null),[me,he]=s.useState(null),[pe,ue]=s.useState(null),[je,be]=s.useState(null),[fe,ye]=s.useState(new Map),[we,Ce]=s.useState(new Map),[Me,Se]=s.useState(25),[Le,Re]=s.useState(25),Fe=s.useRef(null),He=s.useMemo(()=>(null==t?void 0:t.neighbors)??{},[null==t?void 0:t.neighbors]),Ee=s.useMemo(()=>Object.fromEntries(Object.entries(He).filter(([e])=>!a.has(e))),[He,a]),_e=R(),De=null==t?void 0:t.local_hash,Ie=s.useMemo(()=>{const e=new Map;if(!(null==_e?void 0:_e.latitude)||!(null==_e?void 0:_e.longitude))return e;for(const[s,t]of Object.entries(Ee))t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude?e.set(s,$e(_e.latitude,_e.longitude,t.latitude,t.longitude)):e.set(s,null);return e},[Ee,_e]),{neighborHashSet:Ae,neighborSignalMap:Ge}=s.useMemo(()=>{const e=new Set,s=new Map;for(const t of o)e.add(t.hash),s.set(t.hash,{avgRssi:t.avgRssi,avgSnr:t.avgSnr});return{neighborHashSet:e,neighborSignalMap:s}},[o]),Ve=s.useMemo(()=>{const e=X.toLowerCase().trim(),s="neighbor"===e||"neighbors"===e,t=Y||s,a=ae.size>0;return Object.fromEntries(Object.entries(Ee).filter(([n,l])=>{if(a){const e=function(e){var s;const t=(null==(s=e.contact_type)?void 0:s.toLowerCase())??"";return"room server"===t||"room_server"===t||"room"===t||"server"===t?"room":"companion"===t||"client"===t||"cli"===t?"companion":"repeater"===t||"rep"===t||!0===e.is_repeater?"repeater":"companion"}(l);if(!ae.has(e))return!1}if(t&&!Ae.has(n))return!1;if(s)return!0;if(!e)return!0;const i=(l.node_name||l.name||"").toLowerCase(),r=g(n).toLowerCase();return i.includes(e)||r.includes(e)||n.toLowerCase().includes(e)}))},[Ee,X,Y,Ae,ae]),Ue=s.useMemo(()=>{const e=Object.entries(Ve),s=X.toLowerCase().trim(),t=2===s.length&&/^[0-9a-f]{2}$/i.test(s);return e.sort(([e,a],[n,l])=>{if(t){const t=g(e).toLowerCase(),a=g(n).toLowerCase(),l=t===s,i=a===s;if(l&&!i)return-1;if(i&&!l)return 1}let r=0;switch(W){case"lastHeard":r=(a.last_seen||0)-(l.last_seen||0);break;case"distance":{const s=Ie.get(e)??null,t=Ie.get(n)??null;r=null===s&&null===t?0:null===s?1:null===t?-1:s-t;break}case"centrality":r=(i.get(e)||0)-(i.get(n)||0)}return"desc"===Q?-r:r})},[Ve,W,Q,Ie,i,X]),Ke=Ue.filter(([,e])=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude).length,Be=s.useMemo(()=>new Set(l),[l]),We=s.useMemo(()=>0===Me?Ue:Ue.slice(0,Le),[Ue,Le,Me]);s.useEffect(()=>{Re(Me||Ue.length)},[W,Q,X,Y,ae,Me,Ue.length]),s.useEffect(()=>{const e=e=>{e.target.closest("[data-dropdown]")||oe(!1)};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[]),s.useEffect(()=>{if(0===Me)return;const e=new IntersectionObserver(e=>{e[0].isIntersecting&&LeMath.min(e+Me,Ue.length))},{threshold:.1,rootMargin:"100px"});return Fe.current&&e.observe(Fe.current),()=>e.disconnect()},[Me,Le,Ue.length]);const qe=s.useCallback(e=>{Se(e),Re(e||Ue.length)},[Ue.length]),Qe=s.useCallback(e=>{W===e?Z(e=>"desc"===e?"asc":"desc"):(q(e),Z("desc"))},[W]),Ze=s.useCallback(e=>{const s=Ee[e];(null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&0!==s.latitude&&0!==s.longitude&&xe(e)},[Ee]),Xe=s.useCallback(()=>{xe(null)},[]),Je=s.useCallback((e,s)=>{B({hash:e,name:s})},[]),Ye=s.useCallback(async(e,s)=>{if(s.stopPropagation(),!je){be(e),ye(s=>{const t=new Map(s);return t.delete(e),t}),Ce(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?(ye(s=>new Map(s).set(e,t.data)),setTimeout(()=>{ye(s=>{const t=new Map(s);return t.delete(e),t})},1e4)):(Ce(s=>new Map(s).set(e,t.error||"Ping failed")),setTimeout(()=>{Ce(s=>{const t=new Map(s);return t.delete(e),t})},5e3))}catch(t){const s=t instanceof Error?t.message:"Ping failed";Ce(t=>new Map(t).set(e,s)),setTimeout(()=>{Ce(s=>{const t=new Map(s);return t.delete(e),t})},5e3)}finally{be(null)}}},[je]);return e.jsxs(_,{children:[e.jsx(O,{title:"Contacts",icon:e.jsx(re,{}),controls:e.jsxs("div",{className:"flex items-baseline gap-3 sm:gap-4",children:[e.jsxs("span",{className:"roster-title tabular-nums",children:[Ue.length," node",1!==Ue.length?"s":""]}),Ke>0&&e.jsxs("span",{className:"roster-title flex items-baseline gap-1.5 tabular-nums",children:[e.jsx(ce,{className:"w-3.5 h-3.5 relative top-[2px]"}),Ke," with location"]})]})}),e.jsxs(z,{children:[x?e.jsx(ke,{neighbors:Ee,localNode:_e??void 0,localHash:De,onRemoveNode:n,selectedNodeHash:de,onNodeSelected:Xe,highlightedEdgeKey:me,highlightedGhost:pe}):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-accent-primary border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-text-muted",children:"Loading map..."})]})}),e.jsx(Pe,{maxPaths:10,highlightedEdge:me,onHighlightEdge:he}),d.length>0&&(x?e.jsx("div",{className:"chart-container",children:e.jsx(Te,{neighbors:Ee,onGhostSelect:ue})}):e.jsxs("div",{className:"surface-base radius-card",children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-4 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-6 h-6 rounded bg-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-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-bg-elevated animate-pulse"})]})})]})),e.jsx("div",{className:"chart-container",children:x?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(re,{className:"chart-title-icon"}),"Discovered Contacts"]}),e.jsx(F,{type:"search",size:"sm",value:X,onChange:e=>J(e.target.value),placeholder:"Search...",leadingIcon:e.jsx(ee,{className:"w-3.5 h-3.5"}),trailingIcon:X?e.jsx("button",{onClick:()=>{J(""),"neighbor"!==X.toLowerCase().trim()&&"neighbors"!==X.toLowerCase().trim()||te(!1)},className:"text-text-muted hover:text-text-secondary",children:e.jsx(H,{className:"w-3 h-3"})}):void 0,className:"w-24 sm:w-32","aria-label":"Search contacts"}),e.jsxs("div",{className:"relative","data-dropdown":!0,children:[e.jsxs("button",{onClick:()=>oe(!le),className:"flex items-center gap-1 px-1.5 sm:px-2.5 py-1.5 text-sm radius-inner transition-base "+(ae.size>0?"bg-accent-primary/20 text-accent-primary border border-accent-primary/30":"text-text-muted hover:text-text-secondary hover-bg border border-transparent"),title:"Filter by contact type",children:[e.jsx(Ne,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Filter"}),ae.size>0&&e.jsx("span",{className:"tabular-nums text-xs bg-accent-primary/30 px-1 rounded",children:ae.size})]}),le&&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:t})=>e.jsxs("button",{onClick:()=>{ne(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:"w-4 h-4 flex items-center justify-center radius-badge border "+(ae.has(s)?"bg-accent-primary border-accent-primary text-white":"border-border-subtle"),children:ae.has(s)&&e.jsx(m,{className:"w-3 h-3"})}),e.jsx("span",{className:ae.has(s)?"text-text-primary":"text-text-secondary",children:t})]},s)),ae.size>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-border-subtle my-1"}),e.jsx("button",{onClick:()=>ne(new Set),className:"w-full px-3 py-1.5 text-sm text-left text-text-muted hover:text-text-secondary hover-bg transition-base",children:"Clear filters"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[Ae.size>0&&e.jsxs("button",{onClick:()=>te(!Y),className:"flex items-center gap-1 px-1.5 sm:px-2.5 py-1.5 text-sm radius-inner transition-base "+(Y?"bg-accent-success/20 text-accent-success border border-accent-success/30":"text-text-muted hover:text-text-secondary hover-bg border border-transparent"),title:Y?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[e.jsx(E,{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:Ae.size})]}),e.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[e.jsxs("button",{onClick:()=>Qe("lastHeard"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm radius-inner transition-base "+("lastHeard"===W?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover-bg"),title:"Sort by last heard",children:[e.jsx(h,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Recent"}),"lastHeard"===W&&e.jsx(ge,{className:"w-3 h-3 "+("asc"===Q?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>Qe("distance"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm radius-inner transition-base "+("distance"===W?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover-bg"),title:"Sort by distance",children:[e.jsx(ve,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Distance"}),"distance"===W&&e.jsx(ge,{className:"w-3 h-3 "+("asc"===Q?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>Qe("centrality"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm radius-inner transition-base "+("centrality"===W?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover-bg"),title:"Sort by network centrality",children:[e.jsx(se,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Centrality"}),"centrality"===W&&e.jsx(ge,{className:"w-3 h-3 "+("asc"===Q?"rotate-180":"")})]})]}),e.jsxs($,{value:Me,onChange:qe,className:"w-auto min-w-[70px]","aria-label":"Items per page",children:[e.jsx(D,{value:25,children:"25"}),e.jsx(D,{value:50,children:"50"}),e.jsx(D,{value:100,children:"100"}),e.jsx(D,{value:0,children:"All"})]})]})]}),Ue.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden sm:grid contacts-grid-header border-b border-border-subtle/50 px-3 py-2 text-[10px] uppercase tracking-wider text-text-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-activity text-center",children:"Activity"}),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-border-subtle/30",children:We.map(([s,t])=>{const a=g(s),n=Be.has(s),l=Ae.has(s),r=Ie.get(s)??null,c=i.get(s)||0,o=l?Ge.get(s):void 0,d=a?V.get(a)??null:null,x=b.get(s)??ze;return e.jsx(Oe,{hash:s,contact:t,isHub:n,isNeighbor:l,distance:r,centrality:c,sparklineData:x,isSparklineLoading:U,neighborSignal:o,collisionInfo:d,isViterbiResolved:G,isPinging:null!==je,isPingingThis:je===s,pingResult:fe.get(s),pingError:we.get(s),onRowClick:Ze,onPing:Ye,onRemove:Je},s)})}),Me>0&&Le0&&LeRe(e=>Math.min(e+Me,Ue.length)),className:"text-accent-primary hover:text-accent-primary/80 transition-base",children:"Load more"})]})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(re,{className:"roster-empty-icon"}),e.jsx("div",{className:"type-label text-text-secondary",children:"No Contacts Discovered"}),e.jsx("div",{className:"type-data-xs text-text-muted mt-1",children:"Contacts will appear here as they advertise on the mesh network."})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-32 h-4 rounded bg-bg-elevated animate-pulse"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-16 h-6 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-6 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-6 rounded bg-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-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-bg-elevated animate-pulse"}),e.jsx("div",{className:"h-3 w-24 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-12 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-bg-elevated animate-pulse"})]},t))})]})})]}),e.jsx(ie,{isOpen:!!K,title:"Remove Contact",message:`Are you sure you would like to remove ${(null==K?void 0:K.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{K&&n(K.hash),B(null)},onCancel:()=>B(null)})]})}},Symbol.toStringTag,{value:"Module"}));export{De as C,_e as P,ve as R}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-C5Y-8xim.js","assets/vendor-react-j_fHog8x.js","assets/BasemapLayer-Dkb0XoZP.js","assets/vendor-core-CDNU4oKM.js","assets/link-scoring-DtQvFOcN.js","assets/index-B51aMfiH.js","assets/ConfirmModal-ptKJzd5A.js","assets/triangle-alert-JpcXY4mr.js","assets/DeepAnalysisModal-gcjnHw1P.js","assets/geo-utils-n2lfanuR.js","assets/config-CTM8_93T.js","assets/git-branch-C_xw1lQX.js","assets/database-IcctMW15.js","assets/trending-up-CsysmbvI.js","assets/DelayedAnimateNumber-BXZBlojL.js","assets/index-Ch_XDzqB.js","assets/refresh-cw-BcvCKflD.js","assets/target-CE6nI9QD.js","assets/easing-xoQNL31J.js","assets/SignalIndicator-DvKCjwKG.js","assets/signal-scoring-CcBiRcks.js","assets/font-loader-BQzEmDrZ.js","assets/users-cobitl86.js","assets/LightSparkline-96Ro4wc3.js","assets/copy-jAVnwXtf.js","assets/map-pin-C3ieg9t_.js","assets/ping-DLWlYTPp.js","assets/PageLayout-DUXmuiZg.js","assets/listbox-D8VLFZST.js","assets/activity-48nFba-7.js","assets/DataBox-B4su-zzA.js","assets/funnel-BWvj-vnP.js","assets/circle-check-DBemvAXd.js","assets/CollisionExplorerModal-COcb8LoT.js","assets/network-D76gOy_X.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-gDSZCHkY.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,au as l,av as i,aw as r,ao as c,ax as o,O as d,M as x,f as m,ah as h,ay as p,az as u,v as g,e as j,G as b,Q as N,aA as v,p as f,aB as y,aC as w,aD as k,o as C,aE as M,aF as S,aG as L,X as P,aH as R,I as F,a0 as H,R as E}from"./index-B51aMfiH.js";import{p as T}from"./ping-DLWlYTPp.js";import{P as _,b as O,B as z}from"./PageLayout-DUXmuiZg.js";import{L as $,a as D}from"./listbox-D8VLFZST.js";import{G as I}from"./git-branch-C_xw1lQX.js";import{T as A}from"./triangle-alert-JpcXY4mr.js";import{a as G,T as V,M as U}from"./trending-up-CsysmbvI.js";import{c as K,Z as B,a as W,C as q,d as Q,e as Z}from"./SignalIndicator-DvKCjwKG.js";import{E as X,S as J,T as Y,a as ee}from"./target-CE6nI9QD.js";import{A as se}from"./activity-48nFba-7.js";import{D as te}from"./DataBox-B4su-zzA.js";import{F as ae}from"./funnel-BWvj-vnP.js";import{P as ne,T as le,C as ie}from"./ConfirmModal-ptKJzd5A.js";import{U as re}from"./users-cobitl86.js";import{M as ce}from"./map-pin-C3ieg9t_.js";import{C as oe}from"./circle-check-DBemvAXd.js";import{L as de}from"./LightSparkline-96Ro4wc3.js";import{C as xe,S as me,M as he}from"./CollisionExplorerModal-COcb8LoT.js";import{N as pe}from"./network-D76gOy_X.js";const ue=n("arrow-left-right",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]),ge=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"}]]),je=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"}]]),be=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"}]]),Ne=n("list-filter",[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]]),ve=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"}]]),fe=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"}]]);class ye 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-text-muted p-4",children:[e.jsx("p",{className:"text-lg mb-2",children:"Map failed to load"}),e.jsx("p",{className:"text-sm text-text-muted",children:(null==(s=this.state.error)?void 0:s.message)||"Unknown error"}),e.jsx("p",{className:"text-xs text-text-muted mt-2",children:"Try refreshing the page or check your browser's WebGL support."})]})}):this.props.children}}const we=s.lazy(()=>a(()=>import("./ContactsMapMapLibre-C5Y-8xim.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])));function ke({neighbors:a,localNode:n,localHash:i,onRemoveNode:r,selectedNodeHash:c,onNodeSelected:o,highlightedEdgeKey:d,highlightedGhost:x}){return e.jsx(ye,{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-text-muted flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-accent-primary border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading map..."})]})}),children:e.jsx(we,{neighbors:a,localNode:n,localHash:i,onRemoveNode:r,selectedNodeHash:c,onNodeSelected:o,highlightedEdgeKey:d,highlightedGhost:x})})})}function Ce(e){return e>=.7?"text-accent-success":e>=.5?"text-accent-secondary":e>=.3?"text-signal-poor":"text-accent-danger"}function Me(e){return`${Math.round(100*e)}%`}function Se(e,s){return s.has(e.toUpperCase())}const Le=s.memo(function({path:s,isHighlighted:t,onHighlight:a,ghostPrefixes:n}){const l=function(s){return s>.2?{icon:e.jsx(V,{className:"w-3 h-3"}),color:"text-accent-success"}:s<-.2?{icon:e.jsx(G,{className:"w-3 h-3"}),color:"text-accent-danger"}:{icon:e.jsx(x,{className:"w-3 h-3"}),color:"text-text-muted"}}(s.observationTrend),i=s.weakestLinkKey&&s.weakestLinkConfidence<.5,r=s.hops.some(e=>Se(e,n));return e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md transition-colors cursor-pointer "+(t?"bg-accent-primary/20 border border-accent-primary/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-accent-success/10":c>=.5?"bg-accent-secondary/10":c>=.3?"bg-signal-poor/10":"bg-accent-danger/10"),children:e.jsx("span",{className:`text-xs font-semibold tabular-nums ${Ce(s.healthScore)}`,children:Me(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=Se(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:"text-[10px] font-mono px-1.5 py-0.5 rounded flex items-center gap-0.5 "+(r?"bg-accent-tertiary/20 text-accent-tertiary border border-accent-tertiary/30":c?"bg-accent-danger/20 text-accent-danger":"bg-subtle-fill-strong text-text-secondary"),children:[r&&e.jsx(o,{className:"w-2.5 h-2.5"}),t]}),anew Set(m.map(e=>e.prefix.toUpperCase())),[m]),g=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("div",{className:"chart-container",children:[e.jsxs("button",{onClick:()=>p(!h),className:"w-full chart-header hover:bg-subtle-fill transition-colors rounded-t-lg cursor-pointer",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(I,{className:"chart-title-icon"}),"Path Health",e.jsxs("span",{className:"ml-2 text-[10px] font-normal text-text-muted",children:["(",l.length," paths)"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[j&&e.jsxs("div",{className:"flex items-center gap-3 text-[10px]",children:[e.jsxs("span",{className:`tabular-nums ${Ce(j.avgHealth)}`,children:["Avg: ",Me(j.avgHealth)]}),j.weakLinks>0&&e.jsxs("span",{className:"text-accent-danger flex items-center gap-1",children:[e.jsx(A,{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(G,{className:"w-3 h-3"}),j.declining," declining"]}),j.pathsWithGhosts>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(o,{className:"w-3 h-3"}),j.pathsWithGhosts," ghost"]})]}),h?e.jsx(K,{className:"w-4 h-4 text-text-muted"}):e.jsx(d,{className:"w-4 h-4 text-text-muted"})]})]}),h&&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-[10px] text-text-muted pb-2 border-b border-border-subtle",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(X,{className:"w-3 h-3 text-accent-primary"}),e.jsx("span",{className:"text-text-secondary",children:x.totalPaths.toLocaleString()})," Viterbi decoded"]}),x.observationOverrideCount>0&&e.jsxs("span",{className:"text-accent-success",children:[Math.round(x.observationOverrideCount/x.totalPaths*100),"% observation override"]}),m.length>0&&e.jsxs("span",{className:"text-accent-tertiary flex items-center gap-1",children:[e.jsx(o,{className:"w-3 h-3"}),m.length," ghost",1!==m.length?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-[10px] text-text-muted pb-2 border-b border-border-subtle",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-success"})," Healthy (≥70%)"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-accent-secondary"})," 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-accent-danger"})," Critical (<30%)"]}),m.length>0&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(o,{className:"w-3 h-3 text-accent-tertiary"})," Ghost"]})]}),e.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:g.map(s=>e.jsx(Le,{path:s,isHighlighted:n===s.weakestLinkKey,onHighlight:b,ghostPrefixes:u},s.pathKey))}),l.length>t&&e.jsxs("div",{className:"text-center text-[10px] text-text-muted pt-2",children:["Showing top ",t," of ",l.length," paths"]})]})]})});function Re(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 Fe={confirmed:{label:"Confirmed",icon:e.jsx(fe,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-success/40",bgClass:"bg-accent-success/10",textClass:"text-accent-success",badgeClass:"bg-accent-success/20 text-accent-success"},likely:{label:"Likely",icon:e.jsx(m,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-tertiary/30",bgClass:"bg-accent-tertiary/5",textClass:"text-accent-tertiary",badgeClass:"bg-accent-tertiary/20 text-accent-tertiary"},possible:{label:"Possible",icon:e.jsx(W,{className:"w-3.5 h-3.5"}),borderClass:"border-accent-secondary/20",bgClass:"bg-accent-secondary/5",textClass:"text-accent-secondary",badgeClass:"bg-accent-secondary/20 text-accent-secondary"},noise:{label:"Noise",icon:e.jsx(A,{className:"w-3.5 h-3.5"}),borderClass:"border-border-muted",bgClass:"bg-bg-card/30",textClass:"text-text-muted",badgeClass:"bg-bg-elevated text-text-muted"}};function He({ghost:a,neighbors:n,isExpanded:l,onToggle:i,compact:r}){var c,x;const m=(null==(c=a.classification)?void 0:c.tier)??"noise",u=Fe[m],g="clusterId"in(j=a)&&"temporal"in j;var j;const b=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]),N=a.estimatedLocation?a.estimatedLocation.uncertaintyM>=1e3?`±${(a.estimatedLocation.uncertaintyM/1e3).toFixed(1)}km`:`±${Math.round(a.estimatedLocation.uncertaintyM)}m`:null,v=g&&a.temporal?(f=a.temporal.consistency)>=.7?{label:"Steady",color:"text-accent-success"}:f>=.4?{label:"Regular",color:"text-accent-tertiary"}:f>=.2?{label:"Sporadic",color:"text-accent-secondary"}:{label:"Bursty",color:"text-signal-poor"}:null;var f;const y=g&&a.collisionCandidates&&a.collisionCandidates.length>0,w=y?a.collisionCandidates[0]:null;return r?e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded bg-bg-elevated/50 text-sm",children:[e.jsx("span",{className:"font-mono font-medium text-text-secondary",children:a.prefix.toUpperCase()}),e.jsx("span",{className:"text-text-muted",children:a.observationCount})]}):e.jsxs("div",{className:t("rounded-lg border transition-all duration-150",u.borderClass,u.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(o,{className:t("w-5 h-5 flex-shrink-0",u.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-text-primary",children:a.prefix.toUpperCase()}),e.jsx("span",{className:t("px-1.5 py-0.5 rounded text-sm font-medium",u.badgeClass),children:u.label})]}),e.jsx("div",{className:t("text-sm mt-0.5",u.textClass),children:(null==(x=a.classification)?void 0:x.reason)??"Unknown"}),e.jsxs("div",{className:"flex items-center gap-3 text-sm text-text-muted mt-1",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(X,{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(re,{className:"w-3 h-3"}),a.commonNeighbors.size]}),a.estimatedLocation&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ce,{className:"w-3 h-3"}),N]}),v&&e.jsxs("span",{className:t("flex items-center gap-1",v.color),children:[e.jsx(se,{className:"w-3 h-3"}),v.label]}),y&&e.jsxs("span",{className:"flex items-center gap-1 text-signal-poor",children:[e.jsx(J,{className:"w-3 h-3"}),"Collision?"]})]})]}),l?e.jsx(K,{className:"w-4 h-4 text-text-muted"}):e.jsx(d,{className:"w-4 h-4 text-text-muted"})]}),l&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-border-muted/50 mt-1 pt-3",children:[y&&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(J,{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-text-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(te,{copy:!0,size:"compact",className:"inline",children:w.knownNodeHash})," ","(",(100*w.collisionProbability).toFixed(0),"% probability)"]})}),w.evidence&&e.jsxs("div",{className:"text-text-muted mt-1 text-[10px]",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-accent-secondary",children:"Within uncertainty radius"})]})]})]})}),a.estimatedLocation?e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ce,{className:"w-4 h-4 text-accent-primary mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary font-medium",children:[a.estimatedLocation.lat.toFixed(5),", ",a.estimatedLocation.lon.toFixed(5)]}),e.jsxs("div",{className:"text-text-muted",children:["Uncertainty: ",N]}),g&&a.location&&e.jsxs("div",{className:"mt-1 text-text-muted",children:[e.jsxs("div",{children:["Method: ",Re(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-text-muted",children:[e.jsx(A,{className:"w-4 h-4 text-signal-poor"}),"Location unknown (neighbors lack coordinates)"]}),g&&a.temporal&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(se,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary font-medium",children:["Temporal Pattern: ",e.jsx("span",{className:null==v?void 0:v.color,children:null==v?void 0:v.label})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-0.5 mt-1 text-text-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"]})]})]})]}),!g&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(h,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary",children:["First seen: ",p(a.firstSeen)," ago"]}),e.jsxs("div",{className:"text-text-muted",children:["Last seen: ",p(a.lastSeen)," ago"]})]})]}),g&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(je,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-primary",children:["Active period: ",p(a.firstSeen)," – ",p(a.lastSeen)," ago"]}),a.temporal&&e.jsxs("div",{className:"text-text-muted",children:["Obs/hour avg: ",a.temporal.observationsPerHour.toFixed(1)]})]})]}),b.length>0&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(re,{className:"w-4 h-4 text-text-muted mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:"text-text-muted mb-1",children:["Adjacent to ",b.length," known node",1!==b.length?"s":"",":"]}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[b.slice(0,5).map(({hash:s})=>e.jsx(te,{copy:!0,size:"compact",children:s},s)),b.length>5&&e.jsxs("span",{className:"text-text-muted",children:["+",b.length-5," more"]})]})]})]}),g&&a.validationStages&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30",children:[e.jsx("div",{className:"text-[10px] text-text-muted mb-1.5 uppercase tracking-wide",children:"Validation Stages"}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(Ee,{label:"Candidates",passed:a.validationStages.candidateExhaustion}),e.jsx(Ee,{label:"Temporal",passed:a.validationStages.temporalConsistency}),e.jsx(Ee,{label:"Topology",passed:a.validationStages.topologicalFit}),e.jsx(Ee,{label:"Location",passed:a.validationStages.locationPlausible})]})]}),a.classification&&!g&&e.jsx("div",{className:"pt-2 border-t border-border-muted/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-[10px] bg-accent-success/20 text-accent-success",children:"200+ obs"}),a.classification.criteria.hasHighObservations&&!a.classification.criteria.hasVeryHighObservations&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-tertiary/20 text-accent-tertiary",children:"50+ obs"}),a.classification.criteria.hasHighConfidence&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-success/20 text-accent-success",children:"70%+ conf"}),a.classification.criteria.hasCommonNeighbors&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-primary/20 text-accent-primary",children:"2+ neighbors"}),a.classification.criteria.hasGoodLocation&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-accent-primary/20 text-accent-primary",children:"good loc"}),a.classification.criteria.isRecent&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-text-muted/20 text-text-muted",children:"recent"})]})}),g&&a.upgradeRequirements&&a.upgradeRequirements.length>0&&"confirmed"!==m&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30",children:[e.jsx("div",{className:"text-[10px] text-text-muted mb-1 uppercase tracking-wide",children:"To upgrade tier:"}),e.jsx("ul",{className:"text-xs text-text-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-accent-tertiary",children:"•"})," ",s]},t))})]})]})]})}function Ee({label:s,passed:a}){return e.jsxs("span",{className:t("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium",a?"bg-accent-success/20 text-accent-success":"bg-bg-elevated text-text-muted"),children:[a?e.jsx(oe,{className:"w-2.5 h-2.5"}):e.jsx(q,{className:"w-2.5 h-2.5"}),s]})}function Te({neighbors:a,className:n,onGhostSelect:l}){const i=c(),h=r(),[p,u]=s.useState(new Set),[g,j]=s.useState("actionable"),[b,N]=s.useState(!1),[v,f]=s.useState(!0),[y,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,y)),[i,y]),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&&!v?{prefix:M.prefix,commonNeighbors:Array.from(M.commonNeighbors),estimatedLocation:M.estimatedLocation}:null)},[M,v,l]),s.useEffect(()=>{v&&u(new Set)},[v]);const{confirmed:S,likely:L,possible:P,noise:R,actionableCount:F}=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 H=e=>{u(s=>s.has(e)?new Set:new Set([e]))},E="all"===g,T=S.length+L.length+(E?P.length:0)+(b?R.length:0);return e.jsxs("div",{className:n,children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(o,{className:"chart-title-icon"}),"Ghost Buster",F>0&&e.jsxs("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-accent-success/20 text-accent-success",children:[F," actionable"]}),v&&k.length>0&&e.jsxs("span",{className:"text-xs text-text-muted ml-2",children:["(",k.length," total)"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!v&&e.jsxs("button",{onClick:()=>j(e=>"actionable"===e?"all":"actionable"),className:t("flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors","all"===g?"bg-accent-primary/20 text-accent-primary":"bg-bg-elevated text-text-muted hover:text-text-secondary"),children:[e.jsx(ae,{className:"w-3 h-3"}),"actionable"===g?"Actionable":"All"]}),e.jsx("button",{onClick:()=>f(e=>!e),className:"flex items-center gap-1 px-2 py-1 rounded text-xs bg-bg-elevated text-text-muted hover:text-text-secondary transition-colors",title:v?"Expand panel":"Minimize panel",children:v?e.jsx(ne,{className:"w-3 h-3"}):e.jsx(x,{className:"w-3 h-3"})})]})]}),v?e.jsxs("div",{className:"px-5 py-3 flex items-center gap-3 text-xs cursor-pointer hover:bg-subtle-fill transition-colors",onClick:()=>f(!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-accent-success",children:[e.jsx(fe,{className:"w-3 h-3"}),S.length," confirmed"]}),L.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-accent-tertiary",children:[e.jsx(m,{className:"w-3 h-3"}),L.length," likely"]}),P.length>0&&e.jsxs("span",{className:"text-accent-secondary",children:[P.length," possible"]}),R.length>0&&e.jsxs("span",{className:"text-text-muted",children:[R.length," noise"]})]}),e.jsx("span",{className:"text-text-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-border-muted/30",children:[e.jsxs("span",{className:"text-text-muted",children:[h.pathsWithGhosts.toLocaleString()," / ",h.totalPaths.toLocaleString()," paths"]}),e.jsx("span",{className:"text-text-muted",children:"•"}),e.jsxs("div",{className:"flex items-center gap-2",children:[S.length>0&&e.jsxs("span",{className:"text-accent-success",children:[S.length," confirmed"]}),L.length>0&&e.jsxs("span",{className:"text-accent-tertiary",children:[L.length," likely"]}),P.length>0&&e.jsxs("span",{className:"text-accent-secondary",children:[P.length," possible"]}),R.length>0&&e.jsxs("span",{className:"text-text-muted",children:[R.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-accent-success",children:[e.jsx(fe,{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(He,{ghost:s,neighbors:a,isExpanded:p.has(s.prefix),onToggle:()=>H(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-accent-tertiary",children:[e.jsx(m,{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(He,{ghost:s,neighbors:a,isExpanded:p.has(s.prefix),onToggle:()=>H(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-accent-secondary",children:[e.jsx(W,{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(He,{ghost:s,neighbors:a,isExpanded:p.has(s.prefix),onToggle:()=>H(s.prefix)},s.prefix)),P.length>10&&e.jsxs("div",{className:"text-xs text-text-muted text-center py-1",children:["+",P.length-10," more possible nodes"]})]})]}),R.length>0&&"all"===g&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{onClick:()=>N(!b),className:"flex items-center gap-2 text-xs text-text-muted hover:text-text-secondary transition-colors",children:[b?e.jsx(K,{className:"w-3.5 h-3.5"}):e.jsx(d,{className:"w-3.5 h-3.5"}),e.jsx(A,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["Noise (",R.length,")"]})]}),b&&e.jsx("div",{className:"flex flex-wrap gap-1",children:R.map(s=>e.jsx(He,{ghost:s,neighbors:a,isExpanded:!1,onToggle:()=>{},compact:!0},s.prefix))})]}),"actionable"===g&&0===F&&e.jsxs("div",{className:"text-center py-6 text-sm text-text-muted",children:[e.jsx(o,{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+R.length," prefixes need more evidence."]}),e.jsxs("button",{onClick:()=>j("all"),className:"mt-3 text-accent-primary hover:underline",children:["View all ",k.length," discovered nodes"]})]}),h.observationOverrideCount>0&&T>0&&e.jsxs("div",{className:"pt-2 border-t border-border-muted/30 text-xs text-text-muted",children:[e.jsx("span",{className:"text-accent-primary",children:h.observationOverrideCount})," observation overrides • Avg confidence: ",e.jsxs("span",{className:"text-accent-secondary",children:[(100*h.avgPathConfidence).toFixed(0),"%"]})]})]})]})]})}const _e=s.memo(function({hash:t,className:a="",size:n="sm",collisionInfo:l,isViterbiResolved:i}){const c=u(),o=r(),[d,x]=s.useState(!1),h=s.useMemo(()=>g(t),[t]),p=s.useMemo(()=>void 0!==l?l:h?c.find(e=>e.prefix===h)??null:null,[h,c,l]),j=i??(o.totalPaths>0&&o.avgPathConfidence>=.7),b=s.useCallback(e=>{e.preventDefault(),e.stopPropagation(),x(!0)},[]),N=s.useCallback(()=>{x(!1)},[]);if(!p)return null;const v="sm"===n?"w-3.5 h-3.5":"w-4 h-4",f=j?"text-accent-tertiary hover:text-accent-tertiary hover:bg-accent-tertiary/10 focus:ring-accent-tertiary/50":"text-signal-fair hover:text-accent-secondary hover:bg-signal-fair/10 focus:ring-signal-fair/50",y=j?`Prefix conflict resolved by Viterbi HMM (${(100*o.avgPathConfidence).toFixed(0)}% confidence)`:`Prefix conflict: ${p.candidateCount} nodes share prefix "${h}"`;return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:b,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${f} ${a}`,title:y,"aria-label":`View prefix conflict for ${h}${j?" (Viterbi resolved)":""}`,children:j?e.jsxs("span",{className:"relative",children:[e.jsx(X,{className:v}),e.jsx(m,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-accent-success"})]}):e.jsx(be,{className:v})}),e.jsx(xe,{isOpen:d,prefix:p.prefix,candidateHashes:p.candidateHashes,onClose:N})]})}),Oe=s.memo(function({hash:s,contact:t,isHub:a,isNeighbor:n,distance:l,centrality:i,sparklineData:r,isSparklineLoading:c,neighborSignal:o,collisionInfo:d,isViterbiResolved:x,isPinging:h,isPingingThis:p,pingResult:u,pingError:g,onRowClick:v,onPing:f,onRemove:y}){var w;const k=t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude,C=t.node_name||t.name||"Unknown",M=n&&o,S=null==(w=t.contact_type)?void 0:w.toLowerCase(),L="room server"===S||"room_server"===S||"room"===S||"server"===S,P="companion"===S,R="client"===S||"cli"===S,F=t.is_repeater||"repeater"===S||"rep"===S,H=n?"direct":"flood",E=n?"Direct RF contact (zero-hop neighbor)":"Flood routing (multi-hop via mesh)";return e.jsxs("div",{className:`contacts-grid-row ${a?"bg-amber-500/5 border-l-2 border-l-amber-400":""} ${k?"cursor-pointer hover:bg-subtle-fill":""}`,onClick:()=>v(s),children:[e.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[M&&null!==(null==o?void 0:o.avgSnr)?e.jsx("div",{className:"w-2 h-2 rounded-full flex-shrink-0 self-center "+(_=o.avgSnr,void 0===_?"bg-[var(--signal-unknown)]":_>=5?"bg-[var(--signal-excellent)]":_>=0?"bg-[var(--signal-good)]":_>=-5?"bg-[var(--signal-fair)]":_>=-10?"bg-[var(--signal-poor)]":"bg-[var(--signal-critical)]")}):e.jsx("div",{className:"w-2 flex-shrink-0"}),e.jsx("div",{className:"roster-icon flex-shrink-0",title:E,children:L&&F?e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(U,{className:"w-5 h-5 absolute inset-0 text-sys-pink"}),e.jsx(me,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-sys-teal"})]}):L?e.jsx(U,{className:"w-5 h-5 text-sys-pink"}):P?e.jsx(he,{className:"w-5 h-5 text-text-muted"}):F?"direct"===H?e.jsx(ue,{className:"w-5 h-5 text-sys-green"}):e.jsx(me,{className:"w-5 h-5 text-sys-cyan"}):e.jsx(he,{className:"w-5 h-5 text-text-muted"})}),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:C,children:C}),n&&e.jsx(j,{color:Q.neighbor,compact:!0,className:"flex-shrink-0",children:"NBR"}),a&&e.jsxs(j,{color:Q.hub,compact:!0,className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(pe,{className:"w-3 h-3"}),"HUB"]}),F&&e.jsx(j,{color:Q.repeater,compact:!0,className:"flex-shrink-0",children:"RPT"}),L&&e.jsx(j,{color:Q.room,compact:!0,className:"flex-shrink-0",children:"ROOM"}),P&&e.jsx(j,{color:Q.companion,compact:!0,className:"flex-shrink-0",children:"COMP"}),R&&e.jsx(j,{color:Q.client,compact:!0,className:"flex-shrink-0",children:"CLIENT"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(te,{copy:!0,size:"compact",truncate:[8,6],children:s}),e.jsx(_e,{hash:s,collisionInfo:d,isViterbiResolved:x})]})]})]}),e.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[M&&null!==(null==o?void 0:o.avgRssi)&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Z,{rssi:o.avgRssi,className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs tabular-nums text-text-muted",children:Math.round(o.avgRssi)})]}),M&&null!==(null==o?void 0:o.avgSnr)&&e.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[o.avgSnr.toFixed(1)," dB"]})]}),e.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-text-muted",children:null!=l&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs tabular-nums",children:(T=l,T<1e3?`${Math.round(T)}m`:`${(T/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(se,{className:"w-3 h-3 text-accent-secondary"}),e.jsxs("span",{className:"type-data-xs tabular-nums text-text-muted",children:[(100*i).toFixed(0),"%"]})]})}),e.jsx("div",{className:"contacts-col-activity flex items-center justify-center",children:e.jsx(de,{data:r,width:48,height:16,isLoading:c})}),e.jsx("div",{className:"contacts-col-seen flex items-center justify-end",children:e.jsx("span",{className:"type-data-xs tabular-nums text-text-primary whitespace-nowrap",children:t.last_seen?b(t.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[n&&e.jsx(e.Fragment,{children:u?e.jsxs("div",{className:"flex items-center gap-1 text-accent-success",title:`RTT: ${u.rtt_ms.toFixed(0)}ms`,children:[e.jsx(m,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"type-data-xs tabular-nums hidden sm:inline",children:[u.snr_db.toFixed(1),"dB"]})]}):g?e.jsx("span",{className:"text-red-400 text-[10px]",title:g,children:"✗"}):e.jsx("button",{onClick:e=>f(s,e),disabled:h,className:"p-1 sm:p-1.5 radius-inner text-text-muted/50 hover:text-accent-primary hover:bg-accent-primary/10 transition-base disabled:opacity-50 disabled:cursor-not-allowed",title:"Ping neighbor for updated signal info",children:p?e.jsx(N,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):e.jsx(Y,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),e.jsx("button",{onClick:e=>{e.stopPropagation(),y(s,C)},className:"p-1 sm:p-1.5 radius-inner text-text-muted/50 hover:text-red-400 hover:bg-red-500/10 transition-base",title:"Remove contact",children:e.jsx(le,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]});var T,_}),ze=[];function $e(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 De=Object.freeze(Object.defineProperty({__proto__:null,default:function(){const{stats:t}=v(),a=f(),n=y(),l=w(),i=k(),o=C(),d=c(),x=M(),p=u(),j=r(),b=S(),I=L(),A=P(),G=j.totalPaths>0&&j.avgPathConfidence>=.7,V=s.useMemo(()=>{const e=new Map;for(const s of p)e.set(s.prefix,s);return e},[p]),U=!A.backgroundLoadComplete||I,[K,B]=s.useState(null),[W,q]=s.useState("lastHeard"),[Q,Z]=s.useState("desc"),[X,J]=s.useState(""),[Y,te]=s.useState(!1),[ae,ne]=s.useState(new Set),[le,oe]=s.useState(!1),[de,xe]=s.useState(null),[me,he]=s.useState(null),[pe,ue]=s.useState(null),[je,be]=s.useState(null),[fe,ye]=s.useState(new Map),[we,Ce]=s.useState(new Map),[Me,Se]=s.useState(25),[Le,Re]=s.useState(25),Fe=s.useRef(null),He=s.useMemo(()=>(null==t?void 0:t.neighbors)??{},[null==t?void 0:t.neighbors]),Ee=s.useMemo(()=>Object.fromEntries(Object.entries(He).filter(([e])=>!a.has(e))),[He,a]),_e=R(),De=null==t?void 0:t.local_hash,Ie=s.useMemo(()=>{const e=new Map;if(!(null==_e?void 0:_e.latitude)||!(null==_e?void 0:_e.longitude))return e;for(const[s,t]of Object.entries(Ee))t.latitude&&t.longitude&&0!==t.latitude&&0!==t.longitude?e.set(s,$e(_e.latitude,_e.longitude,t.latitude,t.longitude)):e.set(s,null);return e},[Ee,_e]),{neighborHashSet:Ae,neighborSignalMap:Ge}=s.useMemo(()=>{const e=new Set,s=new Map;for(const t of o)e.add(t.hash),s.set(t.hash,{avgRssi:t.avgRssi,avgSnr:t.avgSnr});return{neighborHashSet:e,neighborSignalMap:s}},[o]),Ve=s.useMemo(()=>{const e=X.toLowerCase().trim(),s="neighbor"===e||"neighbors"===e,t=Y||s,a=ae.size>0;return Object.fromEntries(Object.entries(Ee).filter(([n,l])=>{if(a){const e=function(e){var s;const t=(null==(s=e.contact_type)?void 0:s.toLowerCase())??"";return"room server"===t||"room_server"===t||"room"===t||"server"===t?"room":"companion"===t||"client"===t||"cli"===t?"companion":"repeater"===t||"rep"===t||!0===e.is_repeater?"repeater":"companion"}(l);if(!ae.has(e))return!1}if(t&&!Ae.has(n))return!1;if(s)return!0;if(!e)return!0;const i=(l.node_name||l.name||"").toLowerCase(),r=g(n).toLowerCase();return i.includes(e)||r.includes(e)||n.toLowerCase().includes(e)}))},[Ee,X,Y,Ae,ae]),Ue=s.useMemo(()=>{const e=Object.entries(Ve),s=X.toLowerCase().trim(),t=2===s.length&&/^[0-9a-f]{2}$/i.test(s);return e.sort(([e,a],[n,l])=>{if(t){const t=g(e).toLowerCase(),a=g(n).toLowerCase(),l=t===s,i=a===s;if(l&&!i)return-1;if(i&&!l)return 1}let r=0;switch(W){case"lastHeard":r=(a.last_seen||0)-(l.last_seen||0);break;case"distance":{const s=Ie.get(e)??null,t=Ie.get(n)??null;r=null===s&&null===t?0:null===s?1:null===t?-1:s-t;break}case"centrality":r=(i.get(e)||0)-(i.get(n)||0)}return"desc"===Q?-r:r})},[Ve,W,Q,Ie,i,X]),Ke=Ue.filter(([,e])=>e.latitude&&e.longitude&&0!==e.latitude&&0!==e.longitude).length,Be=s.useMemo(()=>new Set(l),[l]),We=s.useMemo(()=>0===Me?Ue:Ue.slice(0,Le),[Ue,Le,Me]);s.useEffect(()=>{Re(Me||Ue.length)},[W,Q,X,Y,ae,Me,Ue.length]),s.useEffect(()=>{const e=e=>{e.target.closest("[data-dropdown]")||oe(!1)};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[]),s.useEffect(()=>{if(0===Me)return;const e=new IntersectionObserver(e=>{e[0].isIntersecting&&LeMath.min(e+Me,Ue.length))},{threshold:.1,rootMargin:"100px"});return Fe.current&&e.observe(Fe.current),()=>e.disconnect()},[Me,Le,Ue.length]);const qe=s.useCallback(e=>{Se(e),Re(e||Ue.length)},[Ue.length]),Qe=s.useCallback(e=>{W===e?Z(e=>"desc"===e?"asc":"desc"):(q(e),Z("desc"))},[W]),Ze=s.useCallback(e=>{const s=Ee[e];(null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&0!==s.latitude&&0!==s.longitude&&xe(e)},[Ee]),Xe=s.useCallback(()=>{xe(null)},[]),Je=s.useCallback((e,s)=>{B({hash:e,name:s})},[]),Ye=s.useCallback(async(e,s)=>{if(s.stopPropagation(),!je){be(e),ye(s=>{const t=new Map(s);return t.delete(e),t}),Ce(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?(ye(s=>new Map(s).set(e,t.data)),setTimeout(()=>{ye(s=>{const t=new Map(s);return t.delete(e),t})},1e4)):(Ce(s=>new Map(s).set(e,t.error||"Ping failed")),setTimeout(()=>{Ce(s=>{const t=new Map(s);return t.delete(e),t})},5e3))}catch(t){const s=t instanceof Error?t.message:"Ping failed";Ce(t=>new Map(t).set(e,s)),setTimeout(()=>{Ce(s=>{const t=new Map(s);return t.delete(e),t})},5e3)}finally{be(null)}}},[je]);return e.jsxs(_,{children:[e.jsx(O,{title:"Contacts",icon:e.jsx(re,{}),controls:e.jsxs("div",{className:"flex items-baseline gap-3 sm:gap-4",children:[e.jsxs("span",{className:"roster-title tabular-nums",children:[Ue.length," node",1!==Ue.length?"s":""]}),Ke>0&&e.jsxs("span",{className:"roster-title flex items-baseline gap-1.5 tabular-nums",children:[e.jsx(ce,{className:"w-3.5 h-3.5 relative top-[2px]"}),Ke," with location"]})]})}),e.jsxs(z,{children:[x?e.jsx(ke,{neighbors:Ee,localNode:_e??void 0,localHash:De,onRemoveNode:n,selectedNodeHash:de,onNodeSelected:Xe,highlightedEdgeKey:me,highlightedGhost:pe}):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-accent-primary border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-text-muted",children:"Loading map..."})]})}),e.jsx(Pe,{maxPaths:10,highlightedEdge:me,onHighlightEdge:he}),d.length>0&&(x?e.jsx("div",{className:"chart-container",children:e.jsx(Te,{neighbors:Ee,onGhostSelect:ue})}):e.jsxs("div",{className:"surface-base radius-card",children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-4 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-6 h-6 rounded bg-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-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-bg-elevated animate-pulse"})]})})]})),e.jsx("div",{className:"chart-container",children:x?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"chart-title",children:[e.jsx(re,{className:"chart-title-icon"}),"Discovered Contacts"]}),e.jsx(F,{type:"search",size:"sm",value:X,onChange:e=>J(e.target.value),placeholder:"Search...",leadingIcon:e.jsx(ee,{className:"w-3.5 h-3.5"}),trailingIcon:X?e.jsx("button",{onClick:()=>{J(""),"neighbor"!==X.toLowerCase().trim()&&"neighbors"!==X.toLowerCase().trim()||te(!1)},className:"text-text-muted hover:text-text-secondary",children:e.jsx(H,{className:"w-3 h-3"})}):void 0,className:"w-24 sm:w-32","aria-label":"Search contacts"}),e.jsxs("div",{className:"relative","data-dropdown":!0,children:[e.jsxs("button",{onClick:()=>oe(!le),className:"flex items-center gap-1 px-1.5 sm:px-2.5 py-1.5 text-sm radius-inner transition-base "+(ae.size>0?"bg-accent-primary/20 text-accent-primary border border-accent-primary/30":"text-text-muted hover:text-text-secondary hover-bg border border-transparent"),title:"Filter by contact type",children:[e.jsx(Ne,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Filter"}),ae.size>0&&e.jsx("span",{className:"tabular-nums text-xs bg-accent-primary/30 px-1 rounded",children:ae.size})]}),le&&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:t})=>e.jsxs("button",{onClick:()=>{ne(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:"w-4 h-4 flex items-center justify-center radius-badge border "+(ae.has(s)?"bg-accent-primary border-accent-primary text-white":"border-border-subtle"),children:ae.has(s)&&e.jsx(m,{className:"w-3 h-3"})}),e.jsx("span",{className:ae.has(s)?"text-text-primary":"text-text-secondary",children:t})]},s)),ae.size>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-border-subtle my-1"}),e.jsx("button",{onClick:()=>ne(new Set),className:"w-full px-3 py-1.5 text-sm text-left text-text-muted hover:text-text-secondary hover-bg transition-base",children:"Clear filters"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[Ae.size>0&&e.jsxs("button",{onClick:()=>te(!Y),className:"flex items-center gap-1 px-1.5 sm:px-2.5 py-1.5 text-sm radius-inner transition-base "+(Y?"bg-accent-success/20 text-accent-success border border-accent-success/30":"text-text-muted hover:text-text-secondary hover-bg border border-transparent"),title:Y?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[e.jsx(E,{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:Ae.size})]}),e.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[e.jsxs("button",{onClick:()=>Qe("lastHeard"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm radius-inner transition-base "+("lastHeard"===W?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover-bg"),title:"Sort by last heard",children:[e.jsx(h,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Recent"}),"lastHeard"===W&&e.jsx(ge,{className:"w-3 h-3 "+("asc"===Q?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>Qe("distance"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm radius-inner transition-base "+("distance"===W?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover-bg"),title:"Sort by distance",children:[e.jsx(ve,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Distance"}),"distance"===W&&e.jsx(ge,{className:"w-3 h-3 "+("asc"===Q?"rotate-180":"")})]}),e.jsxs("button",{onClick:()=>Qe("centrality"),className:"flex items-center gap-1 p-1.5 sm:px-2 sm:py-1.5 text-sm radius-inner transition-base "+("centrality"===W?"bg-accent-primary/20 text-accent-primary":"text-text-muted hover:text-text-secondary hover-bg"),title:"Sort by network centrality",children:[e.jsx(se,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Centrality"}),"centrality"===W&&e.jsx(ge,{className:"w-3 h-3 "+("asc"===Q?"rotate-180":"")})]})]}),e.jsxs($,{value:Me,onChange:qe,className:"w-auto min-w-[70px]","aria-label":"Items per page",children:[e.jsx(D,{value:25,children:"25"}),e.jsx(D,{value:50,children:"50"}),e.jsx(D,{value:100,children:"100"}),e.jsx(D,{value:0,children:"All"})]})]})]}),Ue.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden sm:grid contacts-grid-header border-b border-border-subtle/50 px-3 py-2 text-[10px] uppercase tracking-wider text-text-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-activity text-center",children:"Activity"}),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-border-subtle/30",children:We.map(([s,t])=>{const a=g(s),n=Be.has(s),l=Ae.has(s),r=Ie.get(s)??null,c=i.get(s)||0,o=l?Ge.get(s):void 0,d=a?V.get(a)??null:null,x=b.get(s)??ze;return e.jsx(Oe,{hash:s,contact:t,isHub:n,isNeighbor:l,distance:r,centrality:c,sparklineData:x,isSparklineLoading:U,neighborSignal:o,collisionInfo:d,isViterbiResolved:G,isPinging:null!==je,isPingingThis:je===s,pingResult:fe.get(s),pingError:we.get(s),onRowClick:Ze,onPing:Ye,onRemove:Je},s)})}),Me>0&&Le0&&LeRe(e=>Math.min(e+Me,Ue.length)),className:"text-accent-primary hover:text-accent-primary/80 transition-base",children:"Load more"})]})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(re,{className:"roster-empty-icon"}),e.jsx("div",{className:"type-label text-text-secondary",children:"No Contacts Discovered"}),e.jsx("div",{className:"type-data-xs text-text-muted mt-1",children:"Contacts will appear here as they advertise on the mesh network."})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"chart-header",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-32 h-4 rounded bg-bg-elevated animate-pulse"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-16 h-6 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-24 h-6 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-6 rounded bg-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-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-bg-elevated animate-pulse"}),e.jsx("div",{className:"h-3 w-24 rounded bg-bg-elevated animate-pulse"})]}),e.jsx("div",{className:"w-12 h-4 rounded bg-bg-elevated animate-pulse"}),e.jsx("div",{className:"w-16 h-4 rounded bg-bg-elevated animate-pulse"})]},t))})]})})]}),e.jsx(ie,{isOpen:!!K,title:"Remove Contact",message:`Are you sure you would like to remove ${(null==K?void 0:K.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{K&&n(K.hash),B(null)},onCancel:()=>B(null)})]})}},Symbol.toStringTag,{value:"Module"}));export{De as C,_e as P,ve as R}; diff --git a/frontend/dist/assets/ContactsMapMapLibre-DKxJWyoZ.js b/frontend/dist/assets/ContactsMapMapLibre-C5Y-8xim.js similarity index 99% rename from frontend/dist/assets/ContactsMapMapLibre-DKxJWyoZ.js rename to frontend/dist/assets/ContactsMapMapLibre-C5Y-8xim.js index 164f4e0b..47adf9be 100644 --- a/frontend/dist/assets/ContactsMapMapLibre-DKxJWyoZ.js +++ b/frontend/dist/assets/ContactsMapMapLibre-C5Y-8xim.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-Dkb0XoZP.js";import"./maplibre-gl-b91ci4Kr.js";import{L as f,S as g,M as h,c as m}from"./link-scoring-B0M8cDnn.js";import{c as b,cP as p,cQ as v,cR as y,ao as w,aw as x,ax as k,T as C,m as B,O as M,A as D,B as E,aY as j,aq as Q,M as N,Q as S,K as F,R as P,a0 as T,N as L,f as R,ah as I,cS as _,t as z,cT as H,cU as G,v as O,b5 as U,cV as Y,aG as W,X as V,e as Z,G as K,b6 as J,o as X,cW as q,cX as $}from"./index-CImKXCRQ.js";import{P as AA,T as eA,C as tA}from"./ConfirmModal-C50H21Nf.js";import{a as rA,M as nA,E as oA,u as iA,G as aA,g as sA,b as lA,d as cA,D as uA}from"./DeepAnalysisModal-C0GEcHVb.js";import{a as dA}from"./config-CTM8_93T.js";import{M as fA}from"./trending-up-BBUOgjQN.js";import{H as gA,D as hA}from"./DelayedAnimateNumber-B6DSbUSU.js";import{R as mA}from"./refresh-cw-DElcO6pC.js";import{E as bA}from"./target-BLCR6B60.js";import{C as pA,a as vA,b as yA,c as wA}from"./easing-BgpNFdtT.js";import{G as xA}from"./git-branch-CIWPjlTx.js";import{Z as kA,H as CA,d as BA,N as MA,f as DA}from"./SignalIndicator-JkITXu3r.js";import{l as EA}from"./font-loader-BQzEmDrZ.js";import{c as jA,p as QA,d as NA}from"./vendor-core-CDNU4oKM.js";import{D as SA,c as FA}from"./geo-utils-qEuqoaud.js";import{U as PA}from"./users-BZZVk2mu.js";import{L as TA}from"./LightSparkline-96Ro4wc3.js";import{P as LA,R as RA}from"./Contacts-CATHuNF1.js";import{C as IA}from"./copy-CfZtRqCt.js";import{M as _A}from"./map-pin-lRKxIpXD.js";import"./triangle-alert-DRA45BSe.js";import"./database-1Jgt_gPe.js";import"./index-CGYcizrv.js";import"./signal-scoring-CcBiRcks.js";import"./ping-C1JzD5-V.js";import"./PageLayout-CBx7rIBL.js";import"./listbox-DnYSFKvT.js";import"./activity-3eg63twO.js";import"./DataBox-BUgVf-3d.js";import"./funnel-BR-9uKC6.js";import"./circle-check-DK-UNKLb.js";import"./CollisionExplorerModal-EDF-OEuX.js";import"./network-CY6CQ8MF.js";const zA=b("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"}]]),HA=b("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"}]]),GA=b("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"}]]),OA=b("mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]),UA=b("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"}]]),YA=b("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"}]]),WA=b("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"}]]),VA=b("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"}]]),ZA=b("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 KA(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 JA={nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",nodeColor:"#4338CA",localColor:"#FFB224",hubColor:"#8E4EC6",gatewayColor:"#5B5BD6",mobileColor:"#F76B15",roomServerColor:"#D6409F",neighborColor:"#FFB224",edges:{rest:"#4B4B4B",restBright:"#616161",restDim:"#3F3F3F",hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:"#8A8A8A",hoverNeighbor:"#FBBF24",neighborRest:"#6B7280",neighborHover:"#FBBF24",highlight:"#FFD700"},edgeOpacity:.82};function XA(){if("undefined"==typeof window)return JA;const A=p(),e=v();return{nodeFill:A.nodeFill,nodeStroke:A.nodeStroke,nodeColor:JA.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:JA.edges.neighborRest,neighborHover:JA.edges.neighborHover,highlight:e.highlight},edgeOpacity:JA.edgeOpacity}}const qA=2e3,$A=dA.snappy,Ae="#4A4A4A",ee="#737373",te="rgba(0, 0, 0, 0.12)",re=A.createContext("dark"),ne=()=>A.useContext(re);function oe({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 ie({color:A}){return e.jsx("span",{className:"shrink-0 rounded-sm",style:{width:16,height:3,backgroundColor:A}})}function ae({indicator:A,label:r,tooltip:n}){const o="light"===ne();return e.jsxs("div",{className:"flex items-center gap-1.5",children:[A,e.jsx("span",{className:t(!o&&"text-text-secondary"),style:o?{color:Ae}: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-text-muted"),style:o?{color:ee}:void 0,children:"ⓘ"})})]})}function se({title:A,tooltip:r,isOpen:n,onToggle:o,showDivider:i,children:a}){const s="light"===ne();return e.jsxs("div",{className:i?"mt-2 pt-2 border-t":"",style:i?{borderColor:s?te:"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-text-secondary hover:text-text-primary"),style:s?{color:Ae}: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-text-muted"),style:s?{color:ee}: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:ee}:{color:"var(--text-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:$A,className:"overflow-hidden",children:e.jsx("div",{className:"flex flex-col gap-1 pt-1.5",children:a})})})]})}function le({label:A,value:r,color:n}){const o="light"===ne();return e.jsxs("div",{className:t("flex justify-between tabular-nums",!o&&"text-text-muted"),style:o?{color:ee}:void 0,children:[e.jsx("span",{children:A}),e.jsx("span",{style:n?{color:n}:o?{color:Ae}:{color:"var(--text-secondary)"},children:r})]})}function ce({icon:A,color:r,title:n,subtitle:o}){const i="light"===ne();return e.jsx("div",{className:"mt-1.5 pt-1.5 border-t",style:{borderColor:i?te:"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-text-muted"),style:i?{color:ee}:void 0,children:o})]})]})})}function ue({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(re.Provider,{value:l,children:e.jsxs("div",{className:"map-control-glass p-2.5 text-xs",children:[e.jsxs(se,{title:"Nodes",tooltip:"Node type shown by shape + color. Yellow = direct RF neighbor.",isOpen:b,onToggle:()=>p(A=>!A),children:[e.jsx(ae,{indicator:e.jsx(oe,{color:c.nodeFill}),label:"Node",tooltip:"Standard mesh node. Repeater, client, or companion device."}),e.jsx(ae,{indicator:e.jsx(oe,{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(ae,{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(ae,{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(ae,{indicator:e.jsx(oe,{color:c.neighborColor}),label:"Neighbor",tooltip:"Zero-hop direct RF contact."}),i.gatewayNodes.length>0&&e.jsx(ae,{indicator:e.jsx(oe,{color:c.gatewayColor}),label:"Gateway",tooltip:"Significant forwarder (7-10% traffic)."}),h>0&&e.jsx(ae,{indicator:e.jsx(oe,{color:c.hubColor}),label:"Backbone",tooltip:"Critical relay with high centrality."}),i.mobileNodes.length>0&&e.jsx(ae,{indicator:e.jsx(oe,{color:c.mobileColor,ring:!0}),label:"Mobile",tooltip:"Volatile node that appears/disappears."}),g>0&&e.jsx(ae,{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(se,{title:"Link Quality",tooltip:"Neighbor edge colors based on bidirectional balance.",isOpen:v,onToggle:()=>C(A=>!A),showDivider:!0,children:[e.jsx(ae,{indicator:e.jsx(ie,{color:f.YELLOW}),label:"2-Way",tooltip:"33-67% balanced. Ideal bidirectional link."}),e.jsx(ae,{indicator:e.jsx(ie,{color:f.GREEN}),label:"Listener",tooltip:">67% listener. They hear us well."}),e.jsx(ae,{indicator:e.jsx(ie,{color:f.RED}),label:"Loud",tooltip:"<33% listener. They route more to us."})]}),t&&r>0&&e.jsxs(se,{title:"Topology",tooltip:"Links with 5+ validations. Thickness = strength.",isOpen:B,onToggle:()=>M(A=>!A),showDivider:!0,children:[e.jsx(le,{label:"Nodes",value:n+(o?1:0)}),i.hubNodes.length>0&&e.jsx(le,{label:"Hubs",value:i.hubNodes.length,color:JA.hubColor}),i.loops.length>0&&e.jsx(ce,{icon:e.jsx(mA,{className:"w-3 h-3"}),color:JA.edges.hoverLoop,title:`${i.loops.length} ${1===i.loops.length?"Loop":"Loops"}`,subtitle:"Redundant paths"}),d.totalPaths>0&&e.jsx(ce,{icon:e.jsx(bA,{className:"w-3 h-3"}),color:c.ghostColor,title:`${d.totalPaths.toLocaleString()} Viterbi`,subtitle:"HMM decoded paths"})]})]})});var D}function de({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:m,onToggle3DTerrain:b,basemapMode:p,onToggleBasemap:v,isFullscreen:y,onToggleFullscreen:w}){const x="w-4 h-4",k="light"===p?"#737373":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-glass flex items-center gap-1 p-1",children:[n&&e.jsx(E,{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(j,{className:x})}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(Q,{color:"all"===o?"green":"zinc",customColor:"all"!==o?k:void 0,onClick:()=>i("all"),title:"Show all nodes",children:"All"}),a&&e.jsx(Q,{color:"hubs"===o?"green":"zinc",customColor:"hubs"!==o?k:void 0,onClick:()=>i("hubs"),title:"Show only hub nodes and their connections",children:"Hubs"}),s&&e.jsx(Q,{color:"direct"===o?"green":"zinc",customColor:"direct"!==o?k:void 0,onClick:()=>i("direct"),title:"Show only zero-hop (direct RF) neighbors",children:"Direct"})]}),f&&d&&e.jsx(E,{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(zA,{className:x})}),e.jsx(E,{plain:!0,color:"light"===p?"primary":"muted",onClick:v,title:"light"===p?"Switch to dark map":"Switch to light map","aria-label":"light"===p?"Switch to dark map":"Switch to light map","aria-pressed":"light"===p,className:"!p-1.5 !rounded-md",children:"light"===p?e.jsx(g,{className:x}):e.jsx(h,{className:x})}),e.jsx(E,{plain:!0,color:m?"success":"muted",onClick:b,title:m?"Disable 3D terrain":"Enable 3D terrain","aria-label":m?"Disable 3D terrain":"Enable 3D terrain","aria-pressed":m,className:"!p-1.5 !rounded-md",children:e.jsx(OA,{className:x})}),e.jsx(E,{plain:!0,color:"muted",onClick:w,title:y?"Exit fullscreen":"Fullscreen","aria-label":y?"Exit fullscreen":"Enter fullscreen","aria-pressed":y,className:"!p-1.5 !rounded-md",children:y?e.jsx(rA,{className:x}):e.jsx(nA,{className:x})})]}),e.jsxs("div",{className:"map-control-glass flex flex-col items-stretch !overflow-hidden self-end !p-0",children:[e.jsx(E,{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(AA,{className:x})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx(E,{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(N,{className:x})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx(E,{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(pA,{className:x})})]})]})})}const fe="DeepAnalysis";function ge(){return"abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())]}function he({isActive:t,hasAnalyzed:r,isLoading:n,onClick:o,basemapMode:i="dark"}){const a="light"===i,s=a?"#4A4A4A":void 0,l=a?"#16A34A":"#4ADE80",[c,u]=A.useState(!1),[d,f]=A.useState(fe),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?"rgba(220, 252, 231, 1)":"rgba(10, 26, 10, 1)":"var(--map-ui-bg, var(--bg-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(S,{className:"w-3.5 h-3.5 flex-shrink-0 animate-spin",style:{color:l}}):e.jsx(xA,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"":"text-text-secondary"),style:{...t&&{color:l},...b&&{color:l},...!t&&!b&&s&&{color:s}}}),e.jsx("span",{className:t?"":"text-text-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})]})}function me({isActive:t,onClick:r,basemapMode:n="dark"}){const o="light"===n,i=o?"#4A4A4A":void 0,a=o?"#0D7377":"#12A594",[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?"rgba(204, 251, 241, 1)":"rgba(10, 36, 32, 1)":"var(--map-ui-bg, var(--bg-surface))"},title:t?"Disable live packet tracing (reduces CPU usage)":"Enable live packet tracing",children:[e.jsx(kA,{className:"w-3.5 h-3.5 flex-shrink-0 "+(t?"":"text-text-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-text-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 be="rgba(0, 0, 0, 0.06)",pe="rgba(0, 0, 0, 0.25)",ve="#fe8019";function ye({isActive:t,onClick:r,brightness:n=.7,onBrightnessChange:o,basemapMode:i="dark"}){const a="light"===i,s=a?"#4A4A4A":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(()=>{EA()},[]),A.useEffect(()=>{if(!l||t)return;const A=requestAnimationFrame(()=>d(!0)),e=setTimeout(()=>d(!1),80);return()=>{cancelAnimationFrame(A),clearTimeout(e)}},[l,t]);const m=Math.max(.01,Math.min(1,n)),b=m<.999,p=m>.011,v=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?"rgba(254, 243, 199, 1)":"rgba(26, 20, 8, 1)":"var(--map-ui-bg, var(--bg-surface))"},title:t?"Configure wardriving coverage":"Show wardriving coverage",children:[e.jsx(YA,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"text-amber-400":"text-text-secondary"),style:v?{color:ve}:!t&&s?{color:s}:void 0}),e.jsx("span",{className:t?"text-amber-400":"text-text-secondary",style:{fontFamily:t||v?"'Jacquard 12', serif":"ui-monospace, SFMono-Regular, monospace",fontSize:t||v?"0.75rem":"0.6875rem",fontWeight:500,letterSpacing:"-0.01em",lineHeight:1,transition:"none",transform:t?"scale(1.45)":v?`scale(${u?1.595:1.45})`:void 0,transformOrigin:"left center",...v?{color:ve}:!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,m-.2);null==o||o(e)},disabled:!p,className:"p-0.5 rounded transition-colors "+(p?"text-amber-400":"cursor-not-allowed"),style:{...p&&{"--hover-bg":a?be:"var(--bg-elevated)"},...!p&&{color:a?pe:"rgba(251, 191, 36, 0.3)"}},onMouseEnter:A=>p&&(A.currentTarget.style.backgroundColor=a?be:"var(--bg-elevated)"),onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",title:`Decrease opacity (${Math.round(100*m)}%)`,children:e.jsx(h,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.min(1,m+.2);null==o||o(e)},disabled:!b,className:"p-0.5 rounded transition-colors "+(b?"text-amber-400":"cursor-not-allowed"),style:{...b&&{"--hover-bg":a?be:"var(--bg-elevated)"},...!b&&{color:a?pe:"rgba(251, 191, 36, 0.3)"}},onMouseEnter:A=>b&&(A.currentTarget.style.backgroundColor=a?be:"var(--bg-elevated)"),onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",title:`Increase opacity (${Math.round(100*m)}%)`,children:e.jsx(g,{className:"w-3.5 h-3.5"})})]})]})}function we(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 xe(A){return Math.exp(-A*Math.LN2/7)}const ke="pymc-wardriving-url",Ce="pymc-wardriving-enabled",Be="pymc-wardriving-brightness";function Me(A){"undefined"!=typeof localStorage&&(A?localStorage.setItem(ke,A):localStorage.removeItem(ke))}function De(A){"undefined"!=typeof localStorage&&localStorage.setItem(Ce,String(A))}function Ee(){if("undefined"==typeof localStorage)return.7;const A=localStorage.getItem(Be);if(A){const e=parseFloat(A);if(!isNaN(e)&&e>=.01&&e<=1)return e}return.7}function je(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 Qe=jA((A,e)=>({status:"idle",isVisible:"undefined"!=typeof localStorage&&"true"===localStorage.getItem(Ce),coveragePoints:[],repeaters:[],error:null,stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},url:"undefined"==typeof localStorage?"":localStorage.getItem(ke)||"",brightness:Ee(),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(Be,String(e))}(t),A({brightness:t})},toggleVisibility:()=>{const t=!e().isVisible;De(t),A({isVisible:t})},setVisible:e=>{De(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}=we(r.hash),o=parseInt(r.time,10),i=isNaN(o)?30:(Date.now()-o)/864e5,a=xe(i),s=je(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()}),Me(e.trim()),De(!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:""}),Me(""),De(!1)}})),Ne={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"},Se={bg:"var(--bg-surface)",bgSubtle:"var(--bg-subtle)",bgElevated:"var(--bg-elevated)",bgInput:"var(--bg-subtle)",border:"var(--border-subtle)",borderStrong:"var(--border-strong)",borderFocus:"var(--accent-primary)",text:"var(--text-primary)",textSecondary:"var(--text-secondary)",textMuted:"var(--text-muted)",success:"var(--accent-success)",successBg:"rgba(74, 222, 128, 0.1)",successBorder:"rgba(74, 222, 128, 0.3)",error:"var(--accent-danger)",errorBg:"rgba(239, 68, 68, 0.1)",errorBorder:"rgba(239, 68, 68, 0.3)",info:"var(--accent-secondary)",infoBg:"rgba(249, 210, 111, 0.1)",infoBorder:"rgba(249, 210, 111, 0.3)",warning:"var(--accent-secondary)",warningBg:"rgba(249, 210, 111, 0.1)",warningBorder:"rgba(249, 210, 111, 0.3)",primary:"var(--accent-secondary)",hoverBg:"var(--hover-tint)",sliderTrack:"var(--bg-elevated)",sliderThumb:"var(--accent-secondary)"},Fe=A.createContext({theme:Se,isLight:!1});function Pe(){return A.useContext(Fe)}function Te({status:t,hasData:r}){const{theme:n,isLight:o}=Pe(),i=A.useMemo(()=>"connecting"===t||"loading"===t||"processing"===t?{icon:e.jsx(S,{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(WA,{className:"w-3.5 h-3.5"}),label:"Disconnected",color:n.error,bg:n.errorBg}:r?{icon:e.jsx(VA,{className:"w-3.5 h-3.5"}),label:"Connected",color:n.success,bg:n.successBg}:{icon:e.jsx(P,{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 Le({status:t}){const{theme:r}=Pe(),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 Re({variant:t,title:r,description:n,onDismiss:o}){const{theme:i}=Pe(),a=A.useMemo(()=>{switch(t){case"success":return{icon:e.jsx(R,{className:"w-4 h-4"}),color:i.success,bg:i.successBg,border:i.successBorder};case"error":return{icon:e.jsx(HA,{className:"w-4 h-4"}),color:i.error,bg:i.errorBg,border:i.errorBorder};case"info":return{icon:e.jsx(GA,{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:dA.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(T,{className:"w-3.5 h-3.5"})})]})}function Ie({value:r,onChange:n,onSubmit:o,disabled:i}){const{theme:a,isLight:s}=Pe(),[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(T,{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 _e({value:A,onChange:r}){const{theme:n,isLight:o}=Pe(),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:dA.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(h,{className:"w-4 h-4 absolute inset-0 transition-opacity",style:{color:n.textMuted,opacity:A<.5?1:0}}),e.jsx(g,{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 ze({coverageCount:A,repeaterCount:t,lastUpdated:r}){const{theme:n}=Pe();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(I,{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 He({icon:r,label:n,onClick:o,disabled:i,variant:a="default",active:s}){const{theme:l,isLight:c}=Pe(),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 Ge(){const t=n(),r="light"===t,o=r?Ne:Se,{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}=Qe(),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]),j=A.useCallback(()=>{C(""),h()},[h]),Q=A.useCallback(A=>{C(A),b(A)},[b]),N=A.useCallback(()=>{v||a()},[v,a]),R=k.trim().length>0&&!v;return e.jsx(Fe.Provider,{value:{theme:o,isLight:r},children:e.jsxs(F,{open:i,onClose:N,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(P,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold",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(Te,{status:s,hasData:y}),!v&&e.jsx("button",{onClick:N,className:"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(T,{className:"w-5 h-5"})})]})]}),e.jsx(D,{children:v&&e.jsx(Le,{status:s})}),e.jsxs(L,{className:"space-y-4",children:[e.jsx(Ie,{value:k,onChange:Q,onSubmit:M,disabled:v}),e.jsx(D,{children:"error"===s&&u&&w&&e.jsx(Re,{variant:"error",title:"Connection Failed",description:u,onDismiss:()=>x(!1)})}),e.jsx(D,{children:"success"===s&&y&&e.jsx(Re,{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:dA.snappy,children:e.jsx(ze,{coverageCount:c.coverageCount,repeaterCount:c.repeaterCount,lastUpdated:c.lastUpdated})})}),e.jsx(D,{children:y&&!v&&e.jsx(_e,{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:dA.snappy,className:"flex items-center gap-1",children:[e.jsx(He,{icon:l?e.jsx(oA,{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(He,{icon:e.jsx(eA,{className:"w-4 h-4"}),label:"Clear",onClick:j,disabled:v,variant:"danger"})]})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{plain:!0,color:"muted",onClick:N,disabled:v,children:y?"Done":"Cancel"}),e.jsx(E,{color:"warning",onClick:M,disabled:!R,children:v?e.jsxs(e.Fragment,{children:[e.jsx(S,{"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(SA,{"data-slot":"icon"}),"Connect"]})})]})]})]})})}const Oe={bandwidth:.07,threshold:.1,opacity:1,strokeWidth:4.5},Ue="#1A1A1A",Ye="#4A4A4A",We="#737373",Ve="rgba(0, 0, 0, 0.12)";function Ze({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:Ye}:{color:"var(--text-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-accent-secondary\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:"rgba(0, 0, 0, 0.12)"}:{backgroundColor:"var(--bg-elevated)"}}),e.jsxs("span",{className:"text-xs font-mono tabular-nums w-12 sm:w-14 text-right flex-shrink-0",style:l?{color:Ue}:{color:"var(--text-muted)"},children:[c,i&&e.jsx("span",{className:"ml-0.5 opacity-70",style:l?{color:We}:void 0,children:i})]})]})}function Ke({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:We}:{color:"var(--text-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:Ye}:{color:"var(--text-secondary)"},children:t})}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-xs font-mono tabular-nums",style:o?{color:Ue}:{color:"var(--text-primary)"},children:r}),n&&e.jsx("div",{className:"text-[9px] leading-tight opacity-70",style:o?{color:We}:{color:"var(--text-muted)"},children:n})]})]})}function Je({visible:t,onClose:r,settings:n,onSettingsChange:o,partition:i,totalNodes:a,basemapMode:s="dark"}){const l=iA(),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:dA.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-glass 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:Ve}:void 0,onPointerDown:A=>l.start(A),children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-1.5",children:[e.jsx(aA,{className:"w-4 h-4 sm:w-3 sm:h-3",style:u?{color:We}:void 0}),e.jsx(zA,{className:"w-4 h-4 sm:w-3.5 sm:h-3.5 text-accent-primary"}),e.jsx("span",{className:"text-sm sm:text-xs font-medium",style:u?{color:Ue}:void 0,children:"Partition"})]}),e.jsx(E,{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(T,{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:Ve}: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(Ke,{icon:e.jsx(zA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Communities",value:d.numCommunities,isLightMode:u}),e.jsx(Ke,{icon:e.jsx(PA,{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(Ke,{icon:e.jsx(UA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Fiedler λ₂",value:d.fiedlerValue.toFixed(3),isLightMode:u}),e.jsx(Ke,{icon:e.jsx(PA,{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(Ze,{label:"Bandwidth",value:n.bandwidth,min:.01,max:.15,step:.005,formatValue:()=>g,unit:"km",onChange:A=>f("bandwidth",A),isLightMode:u}),e.jsx(Ze,{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(Ze,{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(Ze,{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 Xe={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{}}},qe=jA()(QA(A=>({isEnabled:!1,toggle:()=>A(A=>({isEnabled:!A.isEnabled})),setEnabled:e=>A({isEnabled:e})}),{name:"pymc-live-trace",storage:NA(()=>Xe)}));var $e=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 $e?$e:{}),At="number",et={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"},tt={1e3:"Unknown unit",1001:"Array length out of bounds",1002:"Got unexpected null value for H3 index"};function rt(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 nt(A){if(0!==A)throw function(A,e){return rt(et,A,2===arguments.length?{value:e}:{})}(A)}var ot={};[["sizeOfH3Index",At],["sizeOfLatLng",At],["sizeOfCellBoundary",At],["sizeOfGeoLoop",At],["sizeOfGeoPolygon",At],["sizeOfLinkedGeoPolygon",At],["sizeOfCoordIJ",At],["readInt64AsDoubleFromPointer",At],["isValidCell",At,[At,At]],["isValidIndex",At,[At,At]],["latLngToCell",At,[At,At,At,At]],["cellToLatLng",At,[At,At,At]],["cellToBoundary",At,[At,At,At]],["maxGridDiskSize",At,[At,At]],["gridDisk",At,[At,At,At,At]],["gridDiskDistances",At,[At,At,At,At,At]],["gridRing",At,[At,At,At,At]],["gridRingUnsafe",At,[At,At,At,At]],["maxPolygonToCellsSize",At,[At,At,At,At]],["polygonToCells",At,[At,At,At,At]],["maxPolygonToCellsSizeExperimental",At,[At,At,At,At]],["polygonToCellsExperimental",At,[At,At,At,At,At,At]],["cellsToLinkedMultiPolygon",At,[At,At,At]],["destroyLinkedMultiPolygon",null,[At]],["compactCells",At,[At,At,At,At]],["uncompactCells",At,[At,At,At,At,At,At]],["uncompactCellsSize",At,[At,At,At,At,At]],["isPentagon",At,[At,At]],["isResClassIII",At,[At,At]],["getBaseCellNumber",At,[At,At]],["getResolution",At,[At,At]],["getIndexDigit",At,[At,At,At]],["constructCell",At,[At,At,At,At]],["maxFaceCount",At,[At,At,At]],["getIcosahedronFaces",At,[At,At,At]],["cellToParent",At,[At,At,At,At]],["cellToChildren",At,[At,At,At,At]],["cellToCenterChild",At,[At,At,At,At]],["cellToChildrenSize",At,[At,At,At,At]],["cellToChildPos",At,[At,At,At,At]],["childPosToCell",At,[At,At,At,At,At,At]],["areNeighborCells",At,[At,At,At,At,At]],["cellsToDirectedEdge",At,[At,At,At,At,At]],["getDirectedEdgeOrigin",At,[At,At,At]],["getDirectedEdgeDestination",At,[At,At,At]],["isValidDirectedEdge",At,[At,At]],["directedEdgeToCells",At,[At,At,At]],["originToDirectedEdges",At,[At,At,At]],["directedEdgeToBoundary",At,[At,At,At]],["gridDistance",At,[At,At,At,At,At]],["gridPathCells",At,[At,At,At,At,At]],["gridPathCellsSize",At,[At,At,At,At,At]],["cellToLocalIj",At,[At,At,At,At,At,At]],["localIjToCell",At,[At,At,At,At,At]],["getHexagonAreaAvgM2",At,[At,At]],["getHexagonAreaAvgKm2",At,[At,At]],["getHexagonEdgeLengthAvgM",At,[At,At]],["getHexagonEdgeLengthAvgKm",At,[At,At]],["greatCircleDistanceM",At,[At,At]],["greatCircleDistanceKm",At,[At,At]],["greatCircleDistanceRads",At,[At,At]],["cellAreaM2",At,[At,At,At]],["cellAreaKm2",At,[At,At,At]],["cellAreaRads2",At,[At,At,At]],["edgeLengthM",At,[At,At,At]],["edgeLengthKm",At,[At,At,At]],["edgeLengthRads",At,[At,At,At]],["getNumCells",At,[At,At]],["getRes0Cells",At,[At]],["res0CellCount",At],["getPentagons",At,[At,At]],["pentagonCount",At],["cellToVertex",At,[At,At,At,At]],["cellToVertexes",At,[At,At,At]],["vertexToLatLng",At,[At,At,At]],["isValidVertex",At,[At,At]]].forEach(function(A){ot[A[0]]=$e.cwrap.apply($e,A)});var it=16,at=ot.sizeOfH3Index(),st=ot.sizeOfLatLng(),lt=ot.sizeOfCellBoundary();ot.sizeOfGeoPolygon(),ot.sizeOfGeoLoop(),ot.sizeOfLinkedGeoPolygon(),ot.sizeOfCoordIJ();var ct=/[^0-9a-fA-F]/;function ut(A){if(A>=0)return A.toString(it);var e=dt(8,(A&=2147483647).toString(it));return(parseInt(e[0],it)+8).toString(it)+e.substring(1)}function dt(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 xt(r[Math.min(23,Math.floor(24*o))])}function Ct({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 wt;const t=_();return 24===t.length&&0!==(null==(e=t[0])?void 0:e[0])?t:yt}(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=ht(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=mt(o.hexId).map(([A,e])=>[e,A]);A.push(A[0]);const i=kt(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=kt(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(vt),n=l.getSource(pt);if(r&&u&&u.features.length>0){if(n?l.getSource(pt).setData(u):l.addSource(pt,{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:vt,type:"fill",source:pt,paint:{"fill-color":["get","color"],"fill-opacity":i}},n)}}else t&&l.removeLayer(vt),n&&l.removeSource(pt)}catch(t){}};l.isStyleLoaded()?A():l.once("style.load",A)},[l,r,u,n]),A.useEffect(()=>{if(l&&r)try{l.getLayer(vt)&&l.setPaintProperty(vt,"fill-opacity",i)}catch{}},[l,i,r]),A.useEffect(()=>()=>{if(l)try{l.getLayer(vt)&&l.removeLayer(vt),l.getSource(pt)&&l.removeSource(pt)}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 Bt="https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png",Mt="terrarium",Dt="terrain-dem",Et="hillshade-dem",jt="terrain-hillshade";function Qt({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(Et)||n.addSource(Et,{type:"raster-dem",tiles:[Bt],encoding:Mt,tileSize:256,maxzoom:14}),!n.getLayer(jt)){const A=null==(t=null==(e=n.getStyle())?void 0:e.layers)?void 0:t.find(A=>"symbol"===A.type);n.addLayer({id:jt,type:"hillshade",source:Et,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(Dt)||n.addSource(Dt,{type:"raster-dem",tiles:[Bt],encoding:Mt,tileSize:256,maxzoom:14})}catch(r){}};return n.isStyleLoaded()?e():(n.once("style.load",e),n.once("load",()=>{A&&!n.getSource(Et)&&e()})),()=>{A=!1}},[n]),A.useEffect(()=>{if(!n)return;let A=!0,r=!1;const o=()=>{if(A&&n.getSource(Dt))try{e?(n.setCenterClampedToGround(!1),n.setTerrain({source:Dt,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(Dt))o();else{const A=()=>{n.getSource(Dt)&&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(jt)&&n.removeLayer(jt),n.getSource(Et)&&n.removeSource(Et),n.getSource(Dt)&&n.removeSource(Dt))}catch{}},[n]),null}const Nt=.03,St=.1,Ft=2;function Pt(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 Tt(A,e={}){const t=function(A,e={}){if(A.length<3)return{coordinates:[],valid:!1};const{bandwidth:t=Nt,threshold:n=St,cellSize:o=Ft}=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=Pt(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 Lt(A,e,t){return(e[0]-A[0])*(t[1]-A[1])-(e[1]-A[1])*(t[0]-A[0])}function Rt(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 It(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&&Lt(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&&Lt(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=Tt(A,{bandwidth:t,threshold:r});a||(a=It(A)),a&&n.push({type:"Feature",properties:{community:o,color:lA(o),borderColor:sA(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 zt={showTopology:!1,showNeighborLines:!0,show3DTerrain:!1,showMinCut:!1,nodeFilter:"all"},Ht=jA()(QA(A=>({viewState:null,setViewState:e=>A({viewState:e,lastSavedAt:Date.now()}),toggles:zt,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:zt,hasAnalyzed:!1,lastSavedAt:null})}),{name:"pymc-map-view",partialize:A=>({viewState:A.viewState,toggles:A.toggles,hasAnalyzed:A.hasAnalyzed,lastSavedAt:A.lastSavedAt})}));function Gt(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 Ot(A){return[A[1],A[0]]}function Ut(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 Yt(A,e,t,r,n,o,i,a,s,l,c,u="dark"){const d=XA(),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)??KA(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:Gt(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:[Ot(A),Ot(E)]}})}return{type:"FeatureCollection",features:f}}function Wt(A,e){const t=XA(),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=Ut(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 Vt(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 Zt(A,e,t){const r=t?O(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 Kt="edge-blink-source",Jt="edge-blink-layer",Xt=1e3,qt=1e3,$t="node-markers-layer";function Ar(A){return A<0||A>=Xt?0:1-A/Xt}function er(A){if(A<0)return 0;if(A>=qt)return 0;const e=A/qt;return Math.pow(1-e,3)}function tr(A){return[A[1],A[0]]}const rr=A.memo(function({nodeHash:A,width:t=60,height:r=20,color:n,showArea:o=!0,showTooltip:i=!1,className:a=""}){const s=Y(A),l=W(),c=!V().backgroundLoadComplete||l,u="number"==typeof t?t:60;return e.jsx(TA,{data:s,width:u,height:r,color:n,isLoading:c,className:a})});function nr(A){const e=new Date(1e3*A);return`${(e.getMonth()+1).toString().padStart(2,"0")}/${e.getDate().toString().padStart(2,"0")}`}function or({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-[10px]",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-amber-400/5 hover:bg-amber-400/10 rounded transition-colors group",title:"Click to copy CLI commands",children:[e.jsx(ZA,{className:"w-3 h-3 text-amber-400 shrink-0"}),e.jsx("span",{className:"text-text-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-text-muted",children:"F"}),e.jsxs("span",{className:"data-box data-box-compact text-amber-400",children:["×",i.toFixed(1)]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-text-muted",children:"D"}),e.jsxs("span",{className:"data-box data-box-compact text-amber-400",children:["×",a.toFixed(1)]})]})]}),n?e.jsx(R,{className:"w-3 h-3 text-green-400 ml-auto"}):e.jsx(IA,{className:"w-3 h-3 text-text-muted opacity-0 group-hover:opacity-100 transition-opacity ml-auto"})]}),r&&e.jsx("button",{onClick:r,className:"p-1 text-text-secondary hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",title:"Remove from contacts",children:e.jsx(eA,{className:"w-3.5 h-3.5"})})]})}function ir({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-text-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:"font-mono text-[10px] text-text-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(R,{className:"w-3 h-3 text-sys-green"}):e.jsx(IA,{className:"w-3 h-3 text-text-secondary"})}),e.jsx(LA,{hash:t,size:"sm"}),x&&e.jsx(Z,{color:s?CA.direct:CA.multihop,compact:!0,children:x}),b.is_repeater&&e.jsx(Z,{color:BA.repeater,compact:!0,children:"Rptr"}),o&&e.jsx(Z,{color:BA.hub,compact:!0,title:"Hub: ≥10% of last-hop traffic",children:"Hub"}),i&&!o&&e.jsx(Z,{color:BA.gateway,compact:!0,title:"Gateway: 7-10% of last-hop traffic",children:"Gate"}),a&&e.jsx(Z,{color:BA.backbone,compact:!0,title:"Backbone",children:"Bone"}),l&&e.jsx(Z,{color:BA.mobile,compact:!0,children:"Mobile"}),c&&e.jsx(Z,{color:BA.room,compact:!0,children:"Room"}),u&&d&&e.jsxs(Z,{compact:!0,title:"Neighbor not heard in 7+ days",children:["Idle ",nr(d)]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-text-secondary mb-1.5",children:[e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(I,{className:"w-3 h-3 text-text-muted shrink-0"}),e.jsx("span",{className:"font-mono",children:K(b.last_seen)})]}),(null==g?void 0:g.distanceMeters)&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(RA,{className:"w-3 h-3 text-text-muted shrink-0"}),e.jsx("span",{className:"font-mono font-semibold text-text-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(_A,{className:"w-3 h-3 text-text-muted shrink-0"}),e.jsxs("span",{className:"font-mono text-text-muted",children:[b.latitude.toFixed(2),", ",b.longitude.toFixed(2)]})]})]}),e.jsx("div",{className:"mb-1.5",style:{width:224},children:e.jsx(rr,{nodeHash:t,width:224,height:26,showArea:!0,showTooltip:!0})}),e.jsxs("div",{className:"flex gap-3 text-[10px] 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-text-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-text-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-text-muted",children:"Role"}),e.jsx(Z,{color:MA[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-text-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-text-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-text-muted",children:"Data"}),e.jsx(Z,{color:DA[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-text-secondary hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",title:"Remove from contacts",children:e.jsx(eA,{className:"w-3.5 h-3.5"})})]}),k&&e.jsx(or,{txDelayRec:v,onRemove:p})]});var C}const ar="node-markers-native",sr="node-markers-layer",lr="node-markers-layer-local",cr="marker-standard",ur="marker-standard-neighbor",dr="marker-hub",fr="marker-hub-neighbor",gr="marker-gateway",hr="marker-gateway-neighbor",mr="marker-mobile",br="marker-mobile-neighbor",pr="marker-room-server",vr="marker-room-server-neighbor",yr="marker-local",wr="marker-stale-5day",xr="marker-stale-10day",kr="marker-blink-black",Cr="marker-blink-black-local",Br="marker-blink",Mr="marker-blink-local";function Dr(A){if(!A)return 0;const e=(Date.now()-1e3*A)/864e5;return e>=10?2:e>=5?1:0}function Er(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 jr(A){return A.startsWith("0x")?A.slice(2,4).toUpperCase():A.slice(0,2).toUpperCase()}function Qr({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={[cr]:t(e.nodeFill),[ur]:t(e.neighborColor),[dr]:t(e.hubColor),[fr]:t(e.neighborColor),[gr]:t(e.gatewayColor),[hr]:t(e.neighborColor),[mr]:t("transparent",e.mobileColor,2.5),[br]:t(e.neighborColor),[pr]:n(e.roomColor),[vr]:n(e.neighborColor,"#1a1a1c"),[yr]:r(e.localColor),[wr]:t("#808080"),[xr]:t("#404040"),[kr]:t("#000000"),[Cr]:r("#000000"),[Br]:t(o,void 0,0,!0),[Mr]: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(cr)||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 Er(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=Er(o),b=u.centrality.get(t)||0,p=c.get(t),v=o.last_seen||(null==p?void 0:p.lastSeen),y=Dr(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:jr(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?jr(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=[sr,lr];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(ar),r=e.getSource(`${ar}-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],Br,[">",["get","blinkIntensity"],.33],kr,["==",["get","staleTier"],2],xr,["==",["get","staleTier"],1],wr,["==",["get","iconType"],"roomServer"],["case",["get","isNeighbor"],vr,pr],["==",["get","iconType"],"hub"],["case",["get","isNeighbor"],fr,dr],["==",["get","iconType"],"gateway"],["case",["get","isNeighbor"],hr,gr],["==",["get","iconType"],"mobile"],["case",["get","isNeighbor"],br,mr],["case",["get","isNeighbor"],ur,cr]],R=["interpolate",["linear"],["zoom"],6,.25,10,1];return e.jsxs(e.Fragment,{children:[e.jsx(i,{id:ar,type:"geojson",data:D,children:e.jsx(a,{id:sr,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:`${ar}-local`,type:"geojson",data:E,children:e.jsx(a,{id:lr,type:"symbol",layout:{"icon-image":["case",[">",["get","blinkIntensity"],.66],Mr,[">",["get","blinkIntensity"],.33],Cr,yr],"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-text-muted surface-badge px-1.5 py-0.5 rounded",children:jr(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-text-muted",children:[r.latitude.toFixed(5),", ",r.longitude.toFixed(5)]})]}):P.neighbor&&P.hash?e.jsx(ir,{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 Nr=[sr,lr],Sr="topology-validated-edges-native",Fr="topology-weak-edges-native",Pr="neighbor-edges-native",Tr="topology-weak-edges-native",Lr="topology-validated-edges-native",Rr="neighbor-edges-native",Ir={type:"FeatureCollection",features:[]},_r={"line-cap":"round","line-join":"round"},zr={"line-color":"transparent","line-width":16,"line-opacity":0};function Hr({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(Rr,"node-markers-layer"),r("neighbor-edges-hitarea-native",Rr),(r(Lr,"neighbor-edges-hitarea-native")||r(Lr,"node-markers-layer"))&&r("topology-validated-edges-hitarea-native",Lr),r(Tr,"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===Sr||A.sourceId===Fr||A.sourceId===Pr)&&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=XA(),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??"#A78BFA";return{"line-color":h?["case",g,s?m:l?"#FFD700":["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:Fr,type:"geojson",data:Ir,children:e.jsx(a,{id:Tr,type:"line",paint:P,layout:{..._r,visibility:k}})}),w&&e.jsxs(i,{id:Sr,type:"geojson",data:Ir,children:[e.jsx(a,{id:"topology-validated-edges-hitarea-native",type:"line",paint:zr,layout:{..._r,visibility:k}}),e.jsx(a,{id:Lr,type:"line",paint:P,layout:{..._r,visibility:k}})]}),e.jsxs(i,{id:Pr,type:"geojson",data:Ir,children:[e.jsx(a,{id:"neighbor-edges-hitarea-native",type:"line",paint:zr,layout:{..._r,visibility:k}}),e.jsx(a,{id:Rr,type:"line",paint:T,layout:{..._r,visibility:k}})]})]})}const Gr=["topology-validated-edges-hitarea-native","topology-validated-edges-native","topology-weak-edges-native","neighbor-edges-hitarea-native","neighbor-edges-native"];function Or({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 Ur({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 Yr(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 Wr({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:[Yr(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 Vr={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"},Zr={longitude:0,latitude:0,zoom:2};function Kr({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:"font-mono text-[10px] text-text-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-text-primary"}`,children:A.value}),e.jsx("span",{className:"text-text-muted ml-1",children:A.label}),A.unit&&e.jsx("span",{className:"text-text-muted/50 ml-0.5",children:A.unit})]},t))})]})}function Jr({neighbors:t,localNode:r,localHash:o,onRemoveNode:i,selectedNodeHash:a,onNodeSelected:s,highlightedEdgeKey:f,highlightedGhost:g}){const h=A.useRef(null),b=J(),p=X(),v=V(),y=q(),[w,x]=A.useState(!1),k=Ht(A=>A.viewState),C=Ht(A=>A.toggles),B=Ht(A=>A.hasAnalyzed),M=Ht(A=>A.setViewState),D=Ht(A=>A.setToggle),E=Ht(A=>A.setHasAnalyzed),j=$(A=>A.preloadFromNodes),Q=$(A=>A.isLoading),N=$(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,FA(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??Zr),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[_,Y]=A.useState(!1),[W,Z]=A.useState(()=>!(C.showTopology&&!v.topologyLoadComplete)&&C.showTopology),[K,AA]=A.useState(C.showNeighborLines),[eA,rA]=A.useState(!1),[nA,oA]=A.useState(C.showMinCut),[iA,aA]=A.useState(Oe),[sA,lA]=A.useState(C.show3DTerrain),[dA,fA]=A.useState(C.nodeFilter),gA=A.useCallback(A=>{Z(e=>{const t="function"==typeof A?A(e):A;return queueMicrotask(()=>D("showTopology",t)),t})},[D]),hA=A.useCallback(A=>{AA(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]),[xA,kA]=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),[NA,SA]=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=Qe(A=>A.coveragePoints),JA=Qe(A=>A.isVisible),XA=Qe(A=>A.brightness),$A=Qe(A=>A.openModal),Ae=qe(A=>A.isEnabled),ee=qe(A=>A.toggle),te=n(),re=l(),ne=A.useRef(!1);A.useEffect(()=>{ZA.length>0&&JA&&!ne.current&&(hA(!1),ne.current=!0)},[ZA.length,JA]);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)},[]),fe=A.useCallback((A,e)=>{le(A),A&&ae(null)},[]),ge=A.useMemo(()=>{var A;if(!W)return null;if(!xA)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}}(xA,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,xA,CA,b.loops,b.edgeMap,t,S]);A.useEffect(()=>{CA||le(ge)},[ge,CA]);const be=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]),pe=A.useMemo(()=>Object.entries(t).filter(([,A])=>A.latitude&&A.longitude),[t]),ve=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 pe)t.latitude&&t.longitude&&A.set(e,[t.latitude,t.longitude]);return A},[S,r,pe]),we=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]),xe=A.useMemo(()=>{var A,e;const r=new Set;for(const n of we.keys())(null==(A=t[n])?void 0:A.latitude)&&(null==(e=t[n])?void 0:e.longitude)&&r.add(n);return r},[we,t]),ke=A.useMemo(()=>{if(0===xe.size||!S)return new Map;const A=H.getPackets();if(0===A.length)return new Map;const e=O(S);return m(A,xe,e).scores},[xe,S,v.packetCount]),Ce=A.useCallback(A=>!!(S&&(A.fromHash===S&&xe.has(A.toHash)||A.toHash===S&&xe.has(A.fromHash))),[S,xe]),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=ve.get(e.fromHash),r=ve.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A}for(const e of b.validatedEdges){if(Ce(e))continue;const t=ve.get(e.fromHash),r=ve.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[b.validatedEdges,ve,Ce,Be,v.backgroundLoadComplete]),De=A.useMemo(()=>{const A=[];for(const e of b.weakEdges){if(Ce(e))continue;const t=ve.get(e.fromHash),r=ve.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[b.weakEdges,ve,Ce]),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 xe){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:we.get(r)??null,rxAdvertCount:a,txProxyCount:s})}return A},[r,xe,t,we,b.lastHopNeighbors,p]),je=A.useMemo(()=>new Set(b.loopEdgeKeys),[b.loopEdgeKeys]),Ne=A.useMemo(()=>new Set(b.backboneEdges),[b.backboneEdges]),Se=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]),Fe=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]),Pe=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=>ve.has(A)).sort();if(e.length<3)return null;const t=new Map;for(const r of e){const A=ve.get(r);A&&t.set(r,A)}return cA(b.validatedEdges,e,t,b.edgeBetweenness)},[b.validatedEdges,ve,b.edgeBetweenness]),Te=A.useCallback(()=>{mA(A=>{const e=!A;if(e&&Pe&&h.current){const A=h.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 Pe.communities)for(const A of e){const e=ve.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})},[Pe,ve]),Le=A.useRef(null);A.useLayoutEffect(()=>{var A,e;Le.current=(null==(e=null==(A=h.current)?void 0:A.getMap)?void 0:e.call(A))??null});const Re=z(),Ie=A.useMemo(()=>H.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=O(r);t.has(A)||t.set(A,r)}if(e){const A=O(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(Kt);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(Jt)&&A.removeLayer(Jt),A.getSource(Kt)&&A.removeSource(Kt),A.addSource(Kt,{type:"geojson",data:{type:"FeatureCollection",features:[]}});const t=A.getLayer($t)?$t:void 0;A.addLayer({id:Jt,type:"line",source:Kt,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["any",["==",["get","isSpeculative"],!0],["==",["get","isSpeculative"],"true"]],"#8B7BAD","#12A594"],"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(Jt)&&A.removeLayer(Jt),A.getSource(Kt)&&A.removeSource(Kt)}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(Kt);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?qt:Xt)){o.push(i);const e=i.isSpeculative?er(A):Ar(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(Jt))return;const e=A.getLayer($t)?$t:void 0;try{A.moveLayer(Jt,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=G(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:tr(e),toCoord:tr(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:ve,packets:Ie,localHash:S,neighbors:t,meshTopology:b,enabled:Ae});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=Yt(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=Yt(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=Wt(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=vA(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=KA(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,qA/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/qA,1);v.current=yA(A)}G(!0);const o=qA+(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=Wt(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:Fe,loopEdgeKeys:je,backboneEdgeKeys:Ne,highlightedEdgeKey:f,neighbors:t,validatedSourceId:Sr,weakSourceId:Fr,neighborPolylines:Ee,showNeighborLines:K,neighborSourceId:Pr,neighborLinkScores:ke,basemapMode:te}),Ue=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]),Ye=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:We}=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)*yA(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"===dA,soloHubs:"hubs"===dA,neighborHashes:pe.map(([A])=>A),hubConnectedNodes:Ue,directNodeSet:xe,localConnectedNodes:Ye,showTopology:W}),{blinkingNodes:Ve,blinkColor:Ze}=function({neighbors:e,localHash:t,enabled:r=!0}){const[n,o]=A.useState(new Map),i=z(),a=A.useRef(H.getPackets());A.useEffect(()=>{a.current=H.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=O(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=Vt(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=G(r,t);if(!A||0===A.original.length)continue;const e=Zt(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:Ae}),Ke=A.useCallback(A=>{if("all"===dA)return!0;if("direct"===dA)return xe.has(A);if("hubs"===dA){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},[dA,xe,b.hubNodes,b.validatedEdges]),Xe=A.useCallback(()=>{_A(!0),RA(!0)},[]),$e=A.useCallback(()=>{zA?gA(A=>!A):Xe()},[zA,Xe]),At=A.useCallback(A=>{R(A.viewState),(A.viewState.pitch??0)>10&&!sA&&bA(!0)},[sA]),et=A.useCallback(()=>{Y(A=>{var e,t,r,n,o,i,a;const s=!A,l=null==(r=null==(t=null==(e=h.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(()=>{rA(A=>!A)},[]),ot=A.useCallback(()=>{bA(A=>{const e=!A;if(h.current){const A=h.current.getMap();A&&A.stop()}if(e&&h.current){const A=h.current.getMap();A&&A.easeTo({pitch:45,duration:1500,easing:vA})}if(!e&&h.current){const A=h.current.getMap();A&&A.easeTo({pitch:0,bearing:0,duration:800,easing:wA})}return e})},[]),it=A.useCallback(()=>{W||gA(!0)},[W]),at=A.useCallback((A,e)=>{SA(A),TA(e)},[]),st=A.useCallback(()=>{NA&&i&&i(NA),SA(null),TA("")},[NA,i]),lt=A.useMemo(()=>[...Gr,...Nr],[]),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=h.current)?void 0:t.getCanvas())&&(h.current.getCanvas().style.cursor="pointer")}catch{}},[CA]),gt=A.useCallback(()=>{var A;BA(null),ae(null);try{(null==(A=h.current)?void 0:A.getCanvas())&&(h.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-accent-primary border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-text-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:h,...T,onMove:At,mapStyle:Vr,style:{width:"100%",height:"100%"},attributionControl:!1,interactiveLayerIds:lt,onMouseMove:ft,onMouseLeave:gt,onClick:ut,onError:A=>{},onIdle:()=>{if(!N&&!Q&&h.current){const A=h.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(Qt,{enabled:sA,exaggeration:4}),e.jsx(Ct,{coveragePoints:ZA,visible:ZA.length>0&&JA,terrainEnabled:sA,brightness:XA,basemapMode:te}),e.jsx(_t,{partition:Pe,nodeCoordinates:ve,visible:nA&&zA,opacity:iA.opacity,bandwidth:iA.bandwidth,threshold:iA.threshold,strokeWidth:iA.strokeWidth}),e.jsx(Hr,{showTopology:W,isExiting:_e,hoveredEdgeKey:CA,highlightedLoopEdges:null==se?void 0:se.highlightedEdgeKeys,highlightedFocusEdges:Se,onEdgeHover:ce,onLoopHover:fe,loops:b.loops,neighborNames:be,opacityBias:EA,widthMultiplier:jA,trafficFilter:QA,showNeighborLines:K,disableHover:ze||IA}),a&&e.jsx(Or,{targetHash:a,nodeCoordinates:ve,onComplete:s}),f&&e.jsx(Ur,{highlightedEdgeKey:f,validatedPolylines:Me,weakPolylines:De,onEnsureTopology:it}),e.jsx(Wr,{ghost:g??null,neighborCoordinates:ve,onHighlightedNeighborsChange:VA}),e.jsx(Qr,{neighborsWithLocation:pe,localNode:r,localHash:o,zeroHopNeighbors:xe,lastHopNeighborMap:we,meshTopology:b,hoveredMarker:xA,onMarkerHover:kA,getNodeOpacity:We,shouldShowNode:Ke,onRequestRemove:i?at:void 0,openPopupId:OA,onOpenPopup:YA,onClosePopup:WA,onNodeClick:dt,blinkingNodes:Ve,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-amber-400"}),t>1&&n.push({text:`+${t-1} overlapping`,color:"text-violet-400/70"}),{type:"loop",title:{icon:"⟳",text:"Redundant Path"+(t>1?"s":""),color:"text-violet-400"},subtitle:{text:`${e.nodeNames.join(" → ")} → ${e.nodeNames[0]}`,color:"text-text-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-accent-success"}),t.push({label:"loud",value:n,color:"text-accent-danger"})),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-amber-400"},subtitle:{text:"Direct RF Neighbor",color:"text-amber-400/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-text-muted"})}const o=[];return e.isBackbone&&o.push({text:"Backbone",color:"text-gray-300"}),e.isLoopEdge&&o.push({text:"Redundant",color:"text-violet-400"}),e.isDirectPath&&o.push({text:"Direct Path",color:"text-teal-400"}),{type:"topology",title:{icon:"",text:`${e.fromName} ↔ ${e.toName}`,color:"text-text-primary"},stats:n,badges:o}}return null}(ie?{type:ie.type,properties:ie.properties}:null,se,Fe);return A&&e.jsx("div",{className:"map-edge-tooltip",children:e.jsx("div",{className:"map-control-glass map-edge-tooltip-inner",children:e.jsx(Kr,{data:A})})})})(),e.jsx(de,{mapRef:h,showNeighborLines:K,onToggleNeighborLines:rt,hasNeighborPolylines:Ee.length>0,nodeFilter:dA,onNodeFilterChange:tt,hasHubNodes:b.hubNodes.length>0,hasZeroHopNeighbors:xe.size>0,showCoverage:eA,onToggleCoverage:nt,showMinCut:nA,onToggleMinCut:Te,hasMinCutData:zA&&null!==Pe&&Pe.numCommunities>1,show3DTerrain:sA,onToggle3DTerrain:ot,basemapMode:te,onToggleBasemap:re,isFullscreen:_,onToggleFullscreen:et}),e.jsxs("div",{className:"map-legend-stack",children:[e.jsx(he,{isActive:W,hasAnalyzed:zA,isLoading:IA,onClick:$e,basemapMode:te}),e.jsx(me,{isActive:Ae,onClick:ee,basemapMode:te}),e.jsx(ye,{isActive:ZA.length>0&&JA,onClick:$A,basemapMode:te}),e.jsx(ue,{showTopology:W,validatedPolylineCount:Me.length,filteredNeighborCount:pe.length,hasLocalNode:!(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude)),meshTopology:b,zeroHopNeighbors:xe,neighborsWithLocation:pe,basemapMode:te})]}),!_&&e.jsx("div",{className:"glass-card-frame absolute inset-0 pointer-events-none rounded-[1.125rem]",style:{zIndex:9999},"aria-hidden":"true"}),e.jsx(tA,{isOpen:null!==NA,onCancel:()=>SA(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(uA,{isOpen:LA,onClose:()=>{RA(!1),_A(!1),He(),GA(!0),setTimeout(()=>gA(!0),150)}}),e.jsx(Ge,{}),e.jsx(Je,{visible:nA&&zA,onClose:()=>mA(!1),settings:iA,onSettingsChange:aA,partition:Pe,totalNodes:Object.keys(t).length,basemapMode:te})]})}export{Jr 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-Dkb0XoZP.js";import"./maplibre-gl-b91ci4Kr.js";import{L as f,S as g,M as h,c as m}from"./link-scoring-DtQvFOcN.js";import{c as b,cP as p,cQ as v,cR as y,ao as w,aw as x,ax as k,T as C,m as B,O as M,A as D,B as E,aY as j,aq as Q,M as N,Q as S,K as F,R as P,a0 as T,N as L,f as R,ah as I,cS as _,t as z,cT as H,cU as G,v as O,b5 as U,cV as Y,aG as W,X as V,e as Z,G as K,b6 as J,o as X,cW as q,cX as $}from"./index-B51aMfiH.js";import{P as AA,T as eA,C as tA}from"./ConfirmModal-ptKJzd5A.js";import{a as rA,M as nA,E as oA,u as iA,G as aA,g as sA,b as lA,d as cA,D as uA}from"./DeepAnalysisModal-gcjnHw1P.js";import{a as dA}from"./config-CTM8_93T.js";import{M as fA}from"./trending-up-CsysmbvI.js";import{H as gA,D as hA}from"./DelayedAnimateNumber-BXZBlojL.js";import{R as mA}from"./refresh-cw-BcvCKflD.js";import{E as bA}from"./target-CE6nI9QD.js";import{C as pA,a as vA,b as yA,c as wA}from"./easing-xoQNL31J.js";import{G as xA}from"./git-branch-C_xw1lQX.js";import{Z as kA,H as CA,d as BA,N as MA,f as DA}from"./SignalIndicator-DvKCjwKG.js";import{l as EA}from"./font-loader-BQzEmDrZ.js";import{c as jA,p as QA,d as NA}from"./vendor-core-CDNU4oKM.js";import{D as SA,c as FA}from"./geo-utils-n2lfanuR.js";import{U as PA}from"./users-cobitl86.js";import{L as TA}from"./LightSparkline-96Ro4wc3.js";import{P as LA,R as RA}from"./Contacts-CJ7zcVr1.js";import{C as IA}from"./copy-jAVnwXtf.js";import{M as _A}from"./map-pin-C3ieg9t_.js";import"./triangle-alert-JpcXY4mr.js";import"./database-IcctMW15.js";import"./index-Ch_XDzqB.js";import"./signal-scoring-CcBiRcks.js";import"./ping-DLWlYTPp.js";import"./PageLayout-DUXmuiZg.js";import"./listbox-D8VLFZST.js";import"./activity-48nFba-7.js";import"./DataBox-B4su-zzA.js";import"./funnel-BWvj-vnP.js";import"./circle-check-DBemvAXd.js";import"./CollisionExplorerModal-COcb8LoT.js";import"./network-D76gOy_X.js";const zA=b("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"}]]),HA=b("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"}]]),GA=b("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"}]]),OA=b("mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]),UA=b("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"}]]),YA=b("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"}]]),WA=b("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"}]]),VA=b("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"}]]),ZA=b("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 KA(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 JA={nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",nodeColor:"#4338CA",localColor:"#FFB224",hubColor:"#8E4EC6",gatewayColor:"#5B5BD6",mobileColor:"#F76B15",roomServerColor:"#D6409F",neighborColor:"#FFB224",edges:{rest:"#4B4B4B",restBright:"#616161",restDim:"#3F3F3F",hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:"#8A8A8A",hoverNeighbor:"#FBBF24",neighborRest:"#6B7280",neighborHover:"#FBBF24",highlight:"#FFD700"},edgeOpacity:.82};function XA(){if("undefined"==typeof window)return JA;const A=p(),e=v();return{nodeFill:A.nodeFill,nodeStroke:A.nodeStroke,nodeColor:JA.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:JA.edges.neighborRest,neighborHover:JA.edges.neighborHover,highlight:e.highlight},edgeOpacity:JA.edgeOpacity}}const qA=2e3,$A=dA.snappy,Ae="#4A4A4A",ee="#737373",te="rgba(0, 0, 0, 0.12)",re=A.createContext("dark"),ne=()=>A.useContext(re);function oe({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 ie({color:A}){return e.jsx("span",{className:"shrink-0 rounded-sm",style:{width:16,height:3,backgroundColor:A}})}function ae({indicator:A,label:r,tooltip:n}){const o="light"===ne();return e.jsxs("div",{className:"flex items-center gap-1.5",children:[A,e.jsx("span",{className:t(!o&&"text-text-secondary"),style:o?{color:Ae}: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-text-muted"),style:o?{color:ee}:void 0,children:"ⓘ"})})]})}function se({title:A,tooltip:r,isOpen:n,onToggle:o,showDivider:i,children:a}){const s="light"===ne();return e.jsxs("div",{className:i?"mt-2 pt-2 border-t":"",style:i?{borderColor:s?te:"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-text-secondary hover:text-text-primary"),style:s?{color:Ae}: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-text-muted"),style:s?{color:ee}: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:ee}:{color:"var(--text-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:$A,className:"overflow-hidden",children:e.jsx("div",{className:"flex flex-col gap-1 pt-1.5",children:a})})})]})}function le({label:A,value:r,color:n}){const o="light"===ne();return e.jsxs("div",{className:t("flex justify-between tabular-nums",!o&&"text-text-muted"),style:o?{color:ee}:void 0,children:[e.jsx("span",{children:A}),e.jsx("span",{style:n?{color:n}:o?{color:Ae}:{color:"var(--text-secondary)"},children:r})]})}function ce({icon:A,color:r,title:n,subtitle:o}){const i="light"===ne();return e.jsx("div",{className:"mt-1.5 pt-1.5 border-t",style:{borderColor:i?te:"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-text-muted"),style:i?{color:ee}:void 0,children:o})]})]})})}function ue({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(re.Provider,{value:l,children:e.jsxs("div",{className:"map-control-glass p-2.5 text-xs",children:[e.jsxs(se,{title:"Nodes",tooltip:"Node type shown by shape + color. Yellow = direct RF neighbor.",isOpen:b,onToggle:()=>p(A=>!A),children:[e.jsx(ae,{indicator:e.jsx(oe,{color:c.nodeFill}),label:"Node",tooltip:"Standard mesh node. Repeater, client, or companion device."}),e.jsx(ae,{indicator:e.jsx(oe,{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(ae,{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(ae,{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(ae,{indicator:e.jsx(oe,{color:c.neighborColor}),label:"Neighbor",tooltip:"Zero-hop direct RF contact."}),i.gatewayNodes.length>0&&e.jsx(ae,{indicator:e.jsx(oe,{color:c.gatewayColor}),label:"Gateway",tooltip:"Significant forwarder (7-10% traffic)."}),h>0&&e.jsx(ae,{indicator:e.jsx(oe,{color:c.hubColor}),label:"Backbone",tooltip:"Critical relay with high centrality."}),i.mobileNodes.length>0&&e.jsx(ae,{indicator:e.jsx(oe,{color:c.mobileColor,ring:!0}),label:"Mobile",tooltip:"Volatile node that appears/disappears."}),g>0&&e.jsx(ae,{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(se,{title:"Link Quality",tooltip:"Neighbor edge colors based on bidirectional balance.",isOpen:v,onToggle:()=>C(A=>!A),showDivider:!0,children:[e.jsx(ae,{indicator:e.jsx(ie,{color:f.YELLOW}),label:"2-Way",tooltip:"33-67% balanced. Ideal bidirectional link."}),e.jsx(ae,{indicator:e.jsx(ie,{color:f.GREEN}),label:"Listener",tooltip:">67% listener. They hear us well."}),e.jsx(ae,{indicator:e.jsx(ie,{color:f.RED}),label:"Loud",tooltip:"<33% listener. They route more to us."})]}),t&&r>0&&e.jsxs(se,{title:"Topology",tooltip:"Links with 5+ validations. Thickness = strength.",isOpen:B,onToggle:()=>M(A=>!A),showDivider:!0,children:[e.jsx(le,{label:"Nodes",value:n+(o?1:0)}),i.hubNodes.length>0&&e.jsx(le,{label:"Hubs",value:i.hubNodes.length,color:JA.hubColor}),i.loops.length>0&&e.jsx(ce,{icon:e.jsx(mA,{className:"w-3 h-3"}),color:JA.edges.hoverLoop,title:`${i.loops.length} ${1===i.loops.length?"Loop":"Loops"}`,subtitle:"Redundant paths"}),d.totalPaths>0&&e.jsx(ce,{icon:e.jsx(bA,{className:"w-3 h-3"}),color:c.ghostColor,title:`${d.totalPaths.toLocaleString()} Viterbi`,subtitle:"HMM decoded paths"})]})]})});var D}function de({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:m,onToggle3DTerrain:b,basemapMode:p,onToggleBasemap:v,isFullscreen:y,onToggleFullscreen:w}){const x="w-4 h-4",k="light"===p?"#737373":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-glass flex items-center gap-1 p-1",children:[n&&e.jsx(E,{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(j,{className:x})}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(Q,{color:"all"===o?"green":"zinc",customColor:"all"!==o?k:void 0,onClick:()=>i("all"),title:"Show all nodes",children:"All"}),a&&e.jsx(Q,{color:"hubs"===o?"green":"zinc",customColor:"hubs"!==o?k:void 0,onClick:()=>i("hubs"),title:"Show only hub nodes and their connections",children:"Hubs"}),s&&e.jsx(Q,{color:"direct"===o?"green":"zinc",customColor:"direct"!==o?k:void 0,onClick:()=>i("direct"),title:"Show only zero-hop (direct RF) neighbors",children:"Direct"})]}),f&&d&&e.jsx(E,{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(zA,{className:x})}),e.jsx(E,{plain:!0,color:"light"===p?"primary":"muted",onClick:v,title:"light"===p?"Switch to dark map":"Switch to light map","aria-label":"light"===p?"Switch to dark map":"Switch to light map","aria-pressed":"light"===p,className:"!p-1.5 !rounded-md",children:"light"===p?e.jsx(g,{className:x}):e.jsx(h,{className:x})}),e.jsx(E,{plain:!0,color:m?"success":"muted",onClick:b,title:m?"Disable 3D terrain":"Enable 3D terrain","aria-label":m?"Disable 3D terrain":"Enable 3D terrain","aria-pressed":m,className:"!p-1.5 !rounded-md",children:e.jsx(OA,{className:x})}),e.jsx(E,{plain:!0,color:"muted",onClick:w,title:y?"Exit fullscreen":"Fullscreen","aria-label":y?"Exit fullscreen":"Enter fullscreen","aria-pressed":y,className:"!p-1.5 !rounded-md",children:y?e.jsx(rA,{className:x}):e.jsx(nA,{className:x})})]}),e.jsxs("div",{className:"map-control-glass flex flex-col items-stretch !overflow-hidden self-end !p-0",children:[e.jsx(E,{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(AA,{className:x})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx(E,{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(N,{className:x})}),e.jsx("div",{className:"h-px bg-border-subtle"}),e.jsx(E,{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(pA,{className:x})})]})]})})}const fe="DeepAnalysis";function ge(){return"abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())]}function he({isActive:t,hasAnalyzed:r,isLoading:n,onClick:o,basemapMode:i="dark"}){const a="light"===i,s=a?"#4A4A4A":void 0,l=a?"#16A34A":"#4ADE80",[c,u]=A.useState(!1),[d,f]=A.useState(fe),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?"rgba(220, 252, 231, 1)":"rgba(10, 26, 10, 1)":"var(--map-ui-bg, var(--bg-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(S,{className:"w-3.5 h-3.5 flex-shrink-0 animate-spin",style:{color:l}}):e.jsx(xA,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"":"text-text-secondary"),style:{...t&&{color:l},...b&&{color:l},...!t&&!b&&s&&{color:s}}}),e.jsx("span",{className:t?"":"text-text-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})]})}function me({isActive:t,onClick:r,basemapMode:n="dark"}){const o="light"===n,i=o?"#4A4A4A":void 0,a=o?"#0D7377":"#12A594",[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?"rgba(204, 251, 241, 1)":"rgba(10, 36, 32, 1)":"var(--map-ui-bg, var(--bg-surface))"},title:t?"Disable live packet tracing (reduces CPU usage)":"Enable live packet tracing",children:[e.jsx(kA,{className:"w-3.5 h-3.5 flex-shrink-0 "+(t?"":"text-text-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-text-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 be="rgba(0, 0, 0, 0.06)",pe="rgba(0, 0, 0, 0.25)",ve="#fe8019";function ye({isActive:t,onClick:r,brightness:n=.7,onBrightnessChange:o,basemapMode:i="dark"}){const a="light"===i,s=a?"#4A4A4A":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(()=>{EA()},[]),A.useEffect(()=>{if(!l||t)return;const A=requestAnimationFrame(()=>d(!0)),e=setTimeout(()=>d(!1),80);return()=>{cancelAnimationFrame(A),clearTimeout(e)}},[l,t]);const m=Math.max(.01,Math.min(1,n)),b=m<.999,p=m>.011,v=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?"rgba(254, 243, 199, 1)":"rgba(26, 20, 8, 1)":"var(--map-ui-bg, var(--bg-surface))"},title:t?"Configure wardriving coverage":"Show wardriving coverage",children:[e.jsx(YA,{className:"w-3.5 h-3.5 flex-shrink-0 transition-colors "+(t?"text-amber-400":"text-text-secondary"),style:v?{color:ve}:!t&&s?{color:s}:void 0}),e.jsx("span",{className:t?"text-amber-400":"text-text-secondary",style:{fontFamily:t||v?"'Jacquard 12', serif":"ui-monospace, SFMono-Regular, monospace",fontSize:t||v?"0.75rem":"0.6875rem",fontWeight:500,letterSpacing:"-0.01em",lineHeight:1,transition:"none",transform:t?"scale(1.45)":v?`scale(${u?1.595:1.45})`:void 0,transformOrigin:"left center",...v?{color:ve}:!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,m-.2);null==o||o(e)},disabled:!p,className:"p-0.5 rounded transition-colors "+(p?"text-amber-400":"cursor-not-allowed"),style:{...p&&{"--hover-bg":a?be:"var(--bg-elevated)"},...!p&&{color:a?pe:"rgba(251, 191, 36, 0.3)"}},onMouseEnter:A=>p&&(A.currentTarget.style.backgroundColor=a?be:"var(--bg-elevated)"),onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",title:`Decrease opacity (${Math.round(100*m)}%)`,children:e.jsx(h,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:A=>{A.stopPropagation();const e=Math.min(1,m+.2);null==o||o(e)},disabled:!b,className:"p-0.5 rounded transition-colors "+(b?"text-amber-400":"cursor-not-allowed"),style:{...b&&{"--hover-bg":a?be:"var(--bg-elevated)"},...!b&&{color:a?pe:"rgba(251, 191, 36, 0.3)"}},onMouseEnter:A=>b&&(A.currentTarget.style.backgroundColor=a?be:"var(--bg-elevated)"),onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",title:`Increase opacity (${Math.round(100*m)}%)`,children:e.jsx(g,{className:"w-3.5 h-3.5"})})]})]})}function we(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 xe(A){return Math.exp(-A*Math.LN2/7)}const ke="pymc-wardriving-url",Ce="pymc-wardriving-enabled",Be="pymc-wardriving-brightness";function Me(A){"undefined"!=typeof localStorage&&(A?localStorage.setItem(ke,A):localStorage.removeItem(ke))}function De(A){"undefined"!=typeof localStorage&&localStorage.setItem(Ce,String(A))}function Ee(){if("undefined"==typeof localStorage)return.7;const A=localStorage.getItem(Be);if(A){const e=parseFloat(A);if(!isNaN(e)&&e>=.01&&e<=1)return e}return.7}function je(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 Qe=jA((A,e)=>({status:"idle",isVisible:"undefined"!=typeof localStorage&&"true"===localStorage.getItem(Ce),coveragePoints:[],repeaters:[],error:null,stats:{coverageCount:0,repeaterCount:0,lastUpdated:null},url:"undefined"==typeof localStorage?"":localStorage.getItem(ke)||"",brightness:Ee(),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(Be,String(e))}(t),A({brightness:t})},toggleVisibility:()=>{const t=!e().isVisible;De(t),A({isVisible:t})},setVisible:e=>{De(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}=we(r.hash),o=parseInt(r.time,10),i=isNaN(o)?30:(Date.now()-o)/864e5,a=xe(i),s=je(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()}),Me(e.trim()),De(!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:""}),Me(""),De(!1)}})),Ne={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"},Se={bg:"var(--bg-surface)",bgSubtle:"var(--bg-subtle)",bgElevated:"var(--bg-elevated)",bgInput:"var(--bg-subtle)",border:"var(--border-subtle)",borderStrong:"var(--border-strong)",borderFocus:"var(--accent-primary)",text:"var(--text-primary)",textSecondary:"var(--text-secondary)",textMuted:"var(--text-muted)",success:"var(--accent-success)",successBg:"rgba(74, 222, 128, 0.1)",successBorder:"rgba(74, 222, 128, 0.3)",error:"var(--accent-danger)",errorBg:"rgba(239, 68, 68, 0.1)",errorBorder:"rgba(239, 68, 68, 0.3)",info:"var(--accent-secondary)",infoBg:"rgba(249, 210, 111, 0.1)",infoBorder:"rgba(249, 210, 111, 0.3)",warning:"var(--accent-secondary)",warningBg:"rgba(249, 210, 111, 0.1)",warningBorder:"rgba(249, 210, 111, 0.3)",primary:"var(--accent-secondary)",hoverBg:"var(--hover-tint)",sliderTrack:"var(--bg-elevated)",sliderThumb:"var(--accent-secondary)"},Fe=A.createContext({theme:Se,isLight:!1});function Pe(){return A.useContext(Fe)}function Te({status:t,hasData:r}){const{theme:n,isLight:o}=Pe(),i=A.useMemo(()=>"connecting"===t||"loading"===t||"processing"===t?{icon:e.jsx(S,{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(WA,{className:"w-3.5 h-3.5"}),label:"Disconnected",color:n.error,bg:n.errorBg}:r?{icon:e.jsx(VA,{className:"w-3.5 h-3.5"}),label:"Connected",color:n.success,bg:n.successBg}:{icon:e.jsx(P,{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 Le({status:t}){const{theme:r}=Pe(),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 Re({variant:t,title:r,description:n,onDismiss:o}){const{theme:i}=Pe(),a=A.useMemo(()=>{switch(t){case"success":return{icon:e.jsx(R,{className:"w-4 h-4"}),color:i.success,bg:i.successBg,border:i.successBorder};case"error":return{icon:e.jsx(HA,{className:"w-4 h-4"}),color:i.error,bg:i.errorBg,border:i.errorBorder};case"info":return{icon:e.jsx(GA,{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:dA.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(T,{className:"w-3.5 h-3.5"})})]})}function Ie({value:r,onChange:n,onSubmit:o,disabled:i}){const{theme:a,isLight:s}=Pe(),[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(T,{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 _e({value:A,onChange:r}){const{theme:n,isLight:o}=Pe(),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:dA.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(h,{className:"w-4 h-4 absolute inset-0 transition-opacity",style:{color:n.textMuted,opacity:A<.5?1:0}}),e.jsx(g,{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 ze({coverageCount:A,repeaterCount:t,lastUpdated:r}){const{theme:n}=Pe();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(I,{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 He({icon:r,label:n,onClick:o,disabled:i,variant:a="default",active:s}){const{theme:l,isLight:c}=Pe(),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 Ge(){const t=n(),r="light"===t,o=r?Ne:Se,{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}=Qe(),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]),j=A.useCallback(()=>{C(""),h()},[h]),Q=A.useCallback(A=>{C(A),b(A)},[b]),N=A.useCallback(()=>{v||a()},[v,a]),R=k.trim().length>0&&!v;return e.jsx(Fe.Provider,{value:{theme:o,isLight:r},children:e.jsxs(F,{open:i,onClose:N,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(P,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold",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(Te,{status:s,hasData:y}),!v&&e.jsx("button",{onClick:N,className:"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(T,{className:"w-5 h-5"})})]})]}),e.jsx(D,{children:v&&e.jsx(Le,{status:s})}),e.jsxs(L,{className:"space-y-4",children:[e.jsx(Ie,{value:k,onChange:Q,onSubmit:M,disabled:v}),e.jsx(D,{children:"error"===s&&u&&w&&e.jsx(Re,{variant:"error",title:"Connection Failed",description:u,onDismiss:()=>x(!1)})}),e.jsx(D,{children:"success"===s&&y&&e.jsx(Re,{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:dA.snappy,children:e.jsx(ze,{coverageCount:c.coverageCount,repeaterCount:c.repeaterCount,lastUpdated:c.lastUpdated})})}),e.jsx(D,{children:y&&!v&&e.jsx(_e,{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:dA.snappy,className:"flex items-center gap-1",children:[e.jsx(He,{icon:l?e.jsx(oA,{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(He,{icon:e.jsx(eA,{className:"w-4 h-4"}),label:"Clear",onClick:j,disabled:v,variant:"danger"})]})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{plain:!0,color:"muted",onClick:N,disabled:v,children:y?"Done":"Cancel"}),e.jsx(E,{color:"warning",onClick:M,disabled:!R,children:v?e.jsxs(e.Fragment,{children:[e.jsx(S,{"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(SA,{"data-slot":"icon"}),"Connect"]})})]})]})]})})}const Oe={bandwidth:.07,threshold:.1,opacity:1,strokeWidth:4.5},Ue="#1A1A1A",Ye="#4A4A4A",We="#737373",Ve="rgba(0, 0, 0, 0.12)";function Ze({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:Ye}:{color:"var(--text-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-accent-secondary\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:"rgba(0, 0, 0, 0.12)"}:{backgroundColor:"var(--bg-elevated)"}}),e.jsxs("span",{className:"text-xs font-mono tabular-nums w-12 sm:w-14 text-right flex-shrink-0",style:l?{color:Ue}:{color:"var(--text-muted)"},children:[c,i&&e.jsx("span",{className:"ml-0.5 opacity-70",style:l?{color:We}:void 0,children:i})]})]})}function Ke({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:We}:{color:"var(--text-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:Ye}:{color:"var(--text-secondary)"},children:t})}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-xs font-mono tabular-nums",style:o?{color:Ue}:{color:"var(--text-primary)"},children:r}),n&&e.jsx("div",{className:"text-[9px] leading-tight opacity-70",style:o?{color:We}:{color:"var(--text-muted)"},children:n})]})]})}function Je({visible:t,onClose:r,settings:n,onSettingsChange:o,partition:i,totalNodes:a,basemapMode:s="dark"}){const l=iA(),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:dA.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-glass 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:Ve}:void 0,onPointerDown:A=>l.start(A),children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-1.5",children:[e.jsx(aA,{className:"w-4 h-4 sm:w-3 sm:h-3",style:u?{color:We}:void 0}),e.jsx(zA,{className:"w-4 h-4 sm:w-3.5 sm:h-3.5 text-accent-primary"}),e.jsx("span",{className:"text-sm sm:text-xs font-medium",style:u?{color:Ue}:void 0,children:"Partition"})]}),e.jsx(E,{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(T,{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:Ve}: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(Ke,{icon:e.jsx(zA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Communities",value:d.numCommunities,isLightMode:u}),e.jsx(Ke,{icon:e.jsx(PA,{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(Ke,{icon:e.jsx(UA,{className:"w-3.5 h-3.5 sm:w-3 sm:h-3"}),label:"Fiedler λ₂",value:d.fiedlerValue.toFixed(3),isLightMode:u}),e.jsx(Ke,{icon:e.jsx(PA,{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(Ze,{label:"Bandwidth",value:n.bandwidth,min:.01,max:.15,step:.005,formatValue:()=>g,unit:"km",onChange:A=>f("bandwidth",A),isLightMode:u}),e.jsx(Ze,{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(Ze,{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(Ze,{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 Xe={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{}}},qe=jA()(QA(A=>({isEnabled:!1,toggle:()=>A(A=>({isEnabled:!A.isEnabled})),setEnabled:e=>A({isEnabled:e})}),{name:"pymc-live-trace",storage:NA(()=>Xe)}));var $e=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 $e?$e:{}),At="number",et={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"},tt={1e3:"Unknown unit",1001:"Array length out of bounds",1002:"Got unexpected null value for H3 index"};function rt(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 nt(A){if(0!==A)throw function(A,e){return rt(et,A,2===arguments.length?{value:e}:{})}(A)}var ot={};[["sizeOfH3Index",At],["sizeOfLatLng",At],["sizeOfCellBoundary",At],["sizeOfGeoLoop",At],["sizeOfGeoPolygon",At],["sizeOfLinkedGeoPolygon",At],["sizeOfCoordIJ",At],["readInt64AsDoubleFromPointer",At],["isValidCell",At,[At,At]],["isValidIndex",At,[At,At]],["latLngToCell",At,[At,At,At,At]],["cellToLatLng",At,[At,At,At]],["cellToBoundary",At,[At,At,At]],["maxGridDiskSize",At,[At,At]],["gridDisk",At,[At,At,At,At]],["gridDiskDistances",At,[At,At,At,At,At]],["gridRing",At,[At,At,At,At]],["gridRingUnsafe",At,[At,At,At,At]],["maxPolygonToCellsSize",At,[At,At,At,At]],["polygonToCells",At,[At,At,At,At]],["maxPolygonToCellsSizeExperimental",At,[At,At,At,At]],["polygonToCellsExperimental",At,[At,At,At,At,At,At]],["cellsToLinkedMultiPolygon",At,[At,At,At]],["destroyLinkedMultiPolygon",null,[At]],["compactCells",At,[At,At,At,At]],["uncompactCells",At,[At,At,At,At,At,At]],["uncompactCellsSize",At,[At,At,At,At,At]],["isPentagon",At,[At,At]],["isResClassIII",At,[At,At]],["getBaseCellNumber",At,[At,At]],["getResolution",At,[At,At]],["getIndexDigit",At,[At,At,At]],["constructCell",At,[At,At,At,At]],["maxFaceCount",At,[At,At,At]],["getIcosahedronFaces",At,[At,At,At]],["cellToParent",At,[At,At,At,At]],["cellToChildren",At,[At,At,At,At]],["cellToCenterChild",At,[At,At,At,At]],["cellToChildrenSize",At,[At,At,At,At]],["cellToChildPos",At,[At,At,At,At]],["childPosToCell",At,[At,At,At,At,At,At]],["areNeighborCells",At,[At,At,At,At,At]],["cellsToDirectedEdge",At,[At,At,At,At,At]],["getDirectedEdgeOrigin",At,[At,At,At]],["getDirectedEdgeDestination",At,[At,At,At]],["isValidDirectedEdge",At,[At,At]],["directedEdgeToCells",At,[At,At,At]],["originToDirectedEdges",At,[At,At,At]],["directedEdgeToBoundary",At,[At,At,At]],["gridDistance",At,[At,At,At,At,At]],["gridPathCells",At,[At,At,At,At,At]],["gridPathCellsSize",At,[At,At,At,At,At]],["cellToLocalIj",At,[At,At,At,At,At,At]],["localIjToCell",At,[At,At,At,At,At]],["getHexagonAreaAvgM2",At,[At,At]],["getHexagonAreaAvgKm2",At,[At,At]],["getHexagonEdgeLengthAvgM",At,[At,At]],["getHexagonEdgeLengthAvgKm",At,[At,At]],["greatCircleDistanceM",At,[At,At]],["greatCircleDistanceKm",At,[At,At]],["greatCircleDistanceRads",At,[At,At]],["cellAreaM2",At,[At,At,At]],["cellAreaKm2",At,[At,At,At]],["cellAreaRads2",At,[At,At,At]],["edgeLengthM",At,[At,At,At]],["edgeLengthKm",At,[At,At,At]],["edgeLengthRads",At,[At,At,At]],["getNumCells",At,[At,At]],["getRes0Cells",At,[At]],["res0CellCount",At],["getPentagons",At,[At,At]],["pentagonCount",At],["cellToVertex",At,[At,At,At,At]],["cellToVertexes",At,[At,At,At]],["vertexToLatLng",At,[At,At,At]],["isValidVertex",At,[At,At]]].forEach(function(A){ot[A[0]]=$e.cwrap.apply($e,A)});var it=16,at=ot.sizeOfH3Index(),st=ot.sizeOfLatLng(),lt=ot.sizeOfCellBoundary();ot.sizeOfGeoPolygon(),ot.sizeOfGeoLoop(),ot.sizeOfLinkedGeoPolygon(),ot.sizeOfCoordIJ();var ct=/[^0-9a-fA-F]/;function ut(A){if(A>=0)return A.toString(it);var e=dt(8,(A&=2147483647).toString(it));return(parseInt(e[0],it)+8).toString(it)+e.substring(1)}function dt(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 xt(r[Math.min(23,Math.floor(24*o))])}function Ct({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 wt;const t=_();return 24===t.length&&0!==(null==(e=t[0])?void 0:e[0])?t:yt}(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=ht(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=mt(o.hexId).map(([A,e])=>[e,A]);A.push(A[0]);const i=kt(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=kt(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(vt),n=l.getSource(pt);if(r&&u&&u.features.length>0){if(n?l.getSource(pt).setData(u):l.addSource(pt,{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:vt,type:"fill",source:pt,paint:{"fill-color":["get","color"],"fill-opacity":i}},n)}}else t&&l.removeLayer(vt),n&&l.removeSource(pt)}catch(t){}};l.isStyleLoaded()?A():l.once("style.load",A)},[l,r,u,n]),A.useEffect(()=>{if(l&&r)try{l.getLayer(vt)&&l.setPaintProperty(vt,"fill-opacity",i)}catch{}},[l,i,r]),A.useEffect(()=>()=>{if(l)try{l.getLayer(vt)&&l.removeLayer(vt),l.getSource(pt)&&l.removeSource(pt)}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 Bt="https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png",Mt="terrarium",Dt="terrain-dem",Et="hillshade-dem",jt="terrain-hillshade";function Qt({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(Et)||n.addSource(Et,{type:"raster-dem",tiles:[Bt],encoding:Mt,tileSize:256,maxzoom:14}),!n.getLayer(jt)){const A=null==(t=null==(e=n.getStyle())?void 0:e.layers)?void 0:t.find(A=>"symbol"===A.type);n.addLayer({id:jt,type:"hillshade",source:Et,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(Dt)||n.addSource(Dt,{type:"raster-dem",tiles:[Bt],encoding:Mt,tileSize:256,maxzoom:14})}catch(r){}};return n.isStyleLoaded()?e():(n.once("style.load",e),n.once("load",()=>{A&&!n.getSource(Et)&&e()})),()=>{A=!1}},[n]),A.useEffect(()=>{if(!n)return;let A=!0,r=!1;const o=()=>{if(A&&n.getSource(Dt))try{e?(n.setCenterClampedToGround(!1),n.setTerrain({source:Dt,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(Dt))o();else{const A=()=>{n.getSource(Dt)&&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(jt)&&n.removeLayer(jt),n.getSource(Et)&&n.removeSource(Et),n.getSource(Dt)&&n.removeSource(Dt))}catch{}},[n]),null}const Nt=.03,St=.1,Ft=2;function Pt(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 Tt(A,e={}){const t=function(A,e={}){if(A.length<3)return{coordinates:[],valid:!1};const{bandwidth:t=Nt,threshold:n=St,cellSize:o=Ft}=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=Pt(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 Lt(A,e,t){return(e[0]-A[0])*(t[1]-A[1])-(e[1]-A[1])*(t[0]-A[0])}function Rt(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 It(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&&Lt(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&&Lt(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=Tt(A,{bandwidth:t,threshold:r});a||(a=It(A)),a&&n.push({type:"Feature",properties:{community:o,color:lA(o),borderColor:sA(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 zt={showTopology:!1,showNeighborLines:!0,show3DTerrain:!1,showMinCut:!1,nodeFilter:"all"},Ht=jA()(QA(A=>({viewState:null,setViewState:e=>A({viewState:e,lastSavedAt:Date.now()}),toggles:zt,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:zt,hasAnalyzed:!1,lastSavedAt:null})}),{name:"pymc-map-view",partialize:A=>({viewState:A.viewState,toggles:A.toggles,hasAnalyzed:A.hasAnalyzed,lastSavedAt:A.lastSavedAt})}));function Gt(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 Ot(A){return[A[1],A[0]]}function Ut(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 Yt(A,e,t,r,n,o,i,a,s,l,c,u="dark"){const d=XA(),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)??KA(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:Gt(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:[Ot(A),Ot(E)]}})}return{type:"FeatureCollection",features:f}}function Wt(A,e){const t=XA(),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=Ut(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 Vt(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 Zt(A,e,t){const r=t?O(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 Kt="edge-blink-source",Jt="edge-blink-layer",Xt=1e3,qt=1e3,$t="node-markers-layer";function Ar(A){return A<0||A>=Xt?0:1-A/Xt}function er(A){if(A<0)return 0;if(A>=qt)return 0;const e=A/qt;return Math.pow(1-e,3)}function tr(A){return[A[1],A[0]]}const rr=A.memo(function({nodeHash:A,width:t=60,height:r=20,color:n,showArea:o=!0,showTooltip:i=!1,className:a=""}){const s=Y(A),l=W(),c=!V().backgroundLoadComplete||l,u="number"==typeof t?t:60;return e.jsx(TA,{data:s,width:u,height:r,color:n,isLoading:c,className:a})});function nr(A){const e=new Date(1e3*A);return`${(e.getMonth()+1).toString().padStart(2,"0")}/${e.getDate().toString().padStart(2,"0")}`}function or({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-[10px]",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-amber-400/5 hover:bg-amber-400/10 rounded transition-colors group",title:"Click to copy CLI commands",children:[e.jsx(ZA,{className:"w-3 h-3 text-amber-400 shrink-0"}),e.jsx("span",{className:"text-text-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-text-muted",children:"F"}),e.jsxs("span",{className:"data-box data-box-compact text-amber-400",children:["×",i.toFixed(1)]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-text-muted",children:"D"}),e.jsxs("span",{className:"data-box data-box-compact text-amber-400",children:["×",a.toFixed(1)]})]})]}),n?e.jsx(R,{className:"w-3 h-3 text-green-400 ml-auto"}):e.jsx(IA,{className:"w-3 h-3 text-text-muted opacity-0 group-hover:opacity-100 transition-opacity ml-auto"})]}),r&&e.jsx("button",{onClick:r,className:"p-1 text-text-secondary hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",title:"Remove from contacts",children:e.jsx(eA,{className:"w-3.5 h-3.5"})})]})}function ir({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-text-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:"font-mono text-[10px] text-text-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(R,{className:"w-3 h-3 text-sys-green"}):e.jsx(IA,{className:"w-3 h-3 text-text-secondary"})}),e.jsx(LA,{hash:t,size:"sm"}),x&&e.jsx(Z,{color:s?CA.direct:CA.multihop,compact:!0,children:x}),b.is_repeater&&e.jsx(Z,{color:BA.repeater,compact:!0,children:"Rptr"}),o&&e.jsx(Z,{color:BA.hub,compact:!0,title:"Hub: ≥10% of last-hop traffic",children:"Hub"}),i&&!o&&e.jsx(Z,{color:BA.gateway,compact:!0,title:"Gateway: 7-10% of last-hop traffic",children:"Gate"}),a&&e.jsx(Z,{color:BA.backbone,compact:!0,title:"Backbone",children:"Bone"}),l&&e.jsx(Z,{color:BA.mobile,compact:!0,children:"Mobile"}),c&&e.jsx(Z,{color:BA.room,compact:!0,children:"Room"}),u&&d&&e.jsxs(Z,{compact:!0,title:"Neighbor not heard in 7+ days",children:["Idle ",nr(d)]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-text-secondary mb-1.5",children:[e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(I,{className:"w-3 h-3 text-text-muted shrink-0"}),e.jsx("span",{className:"font-mono",children:K(b.last_seen)})]}),(null==g?void 0:g.distanceMeters)&&e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(RA,{className:"w-3 h-3 text-text-muted shrink-0"}),e.jsx("span",{className:"font-mono font-semibold text-text-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(_A,{className:"w-3 h-3 text-text-muted shrink-0"}),e.jsxs("span",{className:"font-mono text-text-muted",children:[b.latitude.toFixed(2),", ",b.longitude.toFixed(2)]})]})]}),e.jsx("div",{className:"mb-1.5",style:{width:224},children:e.jsx(rr,{nodeHash:t,width:224,height:26,showArea:!0,showTooltip:!0})}),e.jsxs("div",{className:"flex gap-3 text-[10px] 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-text-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-text-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-text-muted",children:"Role"}),e.jsx(Z,{color:MA[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-text-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-text-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-text-muted",children:"Data"}),e.jsx(Z,{color:DA[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-text-secondary hover:text-red-400 hover:bg-red-500/10 rounded transition-colors",title:"Remove from contacts",children:e.jsx(eA,{className:"w-3.5 h-3.5"})})]}),k&&e.jsx(or,{txDelayRec:v,onRemove:p})]});var C}const ar="node-markers-native",sr="node-markers-layer",lr="node-markers-layer-local",cr="marker-standard",ur="marker-standard-neighbor",dr="marker-hub",fr="marker-hub-neighbor",gr="marker-gateway",hr="marker-gateway-neighbor",mr="marker-mobile",br="marker-mobile-neighbor",pr="marker-room-server",vr="marker-room-server-neighbor",yr="marker-local",wr="marker-stale-5day",xr="marker-stale-10day",kr="marker-blink-black",Cr="marker-blink-black-local",Br="marker-blink",Mr="marker-blink-local";function Dr(A){if(!A)return 0;const e=(Date.now()-1e3*A)/864e5;return e>=10?2:e>=5?1:0}function Er(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 jr(A){return A.startsWith("0x")?A.slice(2,4).toUpperCase():A.slice(0,2).toUpperCase()}function Qr({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={[cr]:t(e.nodeFill),[ur]:t(e.neighborColor),[dr]:t(e.hubColor),[fr]:t(e.neighborColor),[gr]:t(e.gatewayColor),[hr]:t(e.neighborColor),[mr]:t("transparent",e.mobileColor,2.5),[br]:t(e.neighborColor),[pr]:n(e.roomColor),[vr]:n(e.neighborColor,"#1a1a1c"),[yr]:r(e.localColor),[wr]:t("#808080"),[xr]:t("#404040"),[kr]:t("#000000"),[Cr]:r("#000000"),[Br]:t(o,void 0,0,!0),[Mr]: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(cr)||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 Er(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=Er(o),b=u.centrality.get(t)||0,p=c.get(t),v=o.last_seen||(null==p?void 0:p.lastSeen),y=Dr(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:jr(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?jr(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=[sr,lr];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(ar),r=e.getSource(`${ar}-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],Br,[">",["get","blinkIntensity"],.33],kr,["==",["get","staleTier"],2],xr,["==",["get","staleTier"],1],wr,["==",["get","iconType"],"roomServer"],["case",["get","isNeighbor"],vr,pr],["==",["get","iconType"],"hub"],["case",["get","isNeighbor"],fr,dr],["==",["get","iconType"],"gateway"],["case",["get","isNeighbor"],hr,gr],["==",["get","iconType"],"mobile"],["case",["get","isNeighbor"],br,mr],["case",["get","isNeighbor"],ur,cr]],R=["interpolate",["linear"],["zoom"],6,.25,10,1];return e.jsxs(e.Fragment,{children:[e.jsx(i,{id:ar,type:"geojson",data:D,children:e.jsx(a,{id:sr,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:`${ar}-local`,type:"geojson",data:E,children:e.jsx(a,{id:lr,type:"symbol",layout:{"icon-image":["case",[">",["get","blinkIntensity"],.66],Mr,[">",["get","blinkIntensity"],.33],Cr,yr],"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-text-muted surface-badge px-1.5 py-0.5 rounded",children:jr(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-text-muted",children:[r.latitude.toFixed(5),", ",r.longitude.toFixed(5)]})]}):P.neighbor&&P.hash?e.jsx(ir,{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 Nr=[sr,lr],Sr="topology-validated-edges-native",Fr="topology-weak-edges-native",Pr="neighbor-edges-native",Tr="topology-weak-edges-native",Lr="topology-validated-edges-native",Rr="neighbor-edges-native",Ir={type:"FeatureCollection",features:[]},_r={"line-cap":"round","line-join":"round"},zr={"line-color":"transparent","line-width":16,"line-opacity":0};function Hr({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(Rr,"node-markers-layer"),r("neighbor-edges-hitarea-native",Rr),(r(Lr,"neighbor-edges-hitarea-native")||r(Lr,"node-markers-layer"))&&r("topology-validated-edges-hitarea-native",Lr),r(Tr,"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===Sr||A.sourceId===Fr||A.sourceId===Pr)&&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=XA(),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??"#A78BFA";return{"line-color":h?["case",g,s?m:l?"#FFD700":["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:Fr,type:"geojson",data:Ir,children:e.jsx(a,{id:Tr,type:"line",paint:P,layout:{..._r,visibility:k}})}),w&&e.jsxs(i,{id:Sr,type:"geojson",data:Ir,children:[e.jsx(a,{id:"topology-validated-edges-hitarea-native",type:"line",paint:zr,layout:{..._r,visibility:k}}),e.jsx(a,{id:Lr,type:"line",paint:P,layout:{..._r,visibility:k}})]}),e.jsxs(i,{id:Pr,type:"geojson",data:Ir,children:[e.jsx(a,{id:"neighbor-edges-hitarea-native",type:"line",paint:zr,layout:{..._r,visibility:k}}),e.jsx(a,{id:Rr,type:"line",paint:T,layout:{..._r,visibility:k}})]})]})}const Gr=["topology-validated-edges-hitarea-native","topology-validated-edges-native","topology-weak-edges-native","neighbor-edges-hitarea-native","neighbor-edges-native"];function Or({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 Ur({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 Yr(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 Wr({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:[Yr(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 Vr={version:8,sources:{},layers:[],glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf"},Zr={longitude:0,latitude:0,zoom:2};function Kr({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:"font-mono text-[10px] text-text-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-text-primary"}`,children:A.value}),e.jsx("span",{className:"text-text-muted ml-1",children:A.label}),A.unit&&e.jsx("span",{className:"text-text-muted/50 ml-0.5",children:A.unit})]},t))})]})}function Jr({neighbors:t,localNode:r,localHash:o,onRemoveNode:i,selectedNodeHash:a,onNodeSelected:s,highlightedEdgeKey:f,highlightedGhost:g}){const h=A.useRef(null),b=J(),p=X(),v=V(),y=q(),[w,x]=A.useState(!1),k=Ht(A=>A.viewState),C=Ht(A=>A.toggles),B=Ht(A=>A.hasAnalyzed),M=Ht(A=>A.setViewState),D=Ht(A=>A.setToggle),E=Ht(A=>A.setHasAnalyzed),j=$(A=>A.preloadFromNodes),Q=$(A=>A.isLoading),N=$(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,FA(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??Zr),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[_,Y]=A.useState(!1),[W,Z]=A.useState(()=>!(C.showTopology&&!v.topologyLoadComplete)&&C.showTopology),[K,AA]=A.useState(C.showNeighborLines),[eA,rA]=A.useState(!1),[nA,oA]=A.useState(C.showMinCut),[iA,aA]=A.useState(Oe),[sA,lA]=A.useState(C.show3DTerrain),[dA,fA]=A.useState(C.nodeFilter),gA=A.useCallback(A=>{Z(e=>{const t="function"==typeof A?A(e):A;return queueMicrotask(()=>D("showTopology",t)),t})},[D]),hA=A.useCallback(A=>{AA(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]),[xA,kA]=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),[NA,SA]=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=Qe(A=>A.coveragePoints),JA=Qe(A=>A.isVisible),XA=Qe(A=>A.brightness),$A=Qe(A=>A.openModal),Ae=qe(A=>A.isEnabled),ee=qe(A=>A.toggle),te=n(),re=l(),ne=A.useRef(!1);A.useEffect(()=>{ZA.length>0&&JA&&!ne.current&&(hA(!1),ne.current=!0)},[ZA.length,JA]);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)},[]),fe=A.useCallback((A,e)=>{le(A),A&&ae(null)},[]),ge=A.useMemo(()=>{var A;if(!W)return null;if(!xA)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}}(xA,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,xA,CA,b.loops,b.edgeMap,t,S]);A.useEffect(()=>{CA||le(ge)},[ge,CA]);const be=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]),pe=A.useMemo(()=>Object.entries(t).filter(([,A])=>A.latitude&&A.longitude),[t]),ve=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 pe)t.latitude&&t.longitude&&A.set(e,[t.latitude,t.longitude]);return A},[S,r,pe]),we=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]),xe=A.useMemo(()=>{var A,e;const r=new Set;for(const n of we.keys())(null==(A=t[n])?void 0:A.latitude)&&(null==(e=t[n])?void 0:e.longitude)&&r.add(n);return r},[we,t]),ke=A.useMemo(()=>{if(0===xe.size||!S)return new Map;const A=H.getPackets();if(0===A.length)return new Map;const e=O(S);return m(A,xe,e).scores},[xe,S,v.packetCount]),Ce=A.useCallback(A=>!!(S&&(A.fromHash===S&&xe.has(A.toHash)||A.toHash===S&&xe.has(A.fromHash))),[S,xe]),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=ve.get(e.fromHash),r=ve.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A}for(const e of b.validatedEdges){if(Ce(e))continue;const t=ve.get(e.fromHash),r=ve.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[b.validatedEdges,ve,Ce,Be,v.backgroundLoadComplete]),De=A.useMemo(()=>{const A=[];for(const e of b.weakEdges){if(Ce(e))continue;const t=ve.get(e.fromHash),r=ve.get(e.toHash);t&&r&&A.push({from:t,to:r,edge:e})}return A},[b.weakEdges,ve,Ce]),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 xe){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:we.get(r)??null,rxAdvertCount:a,txProxyCount:s})}return A},[r,xe,t,we,b.lastHopNeighbors,p]),je=A.useMemo(()=>new Set(b.loopEdgeKeys),[b.loopEdgeKeys]),Ne=A.useMemo(()=>new Set(b.backboneEdges),[b.backboneEdges]),Se=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]),Fe=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]),Pe=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=>ve.has(A)).sort();if(e.length<3)return null;const t=new Map;for(const r of e){const A=ve.get(r);A&&t.set(r,A)}return cA(b.validatedEdges,e,t,b.edgeBetweenness)},[b.validatedEdges,ve,b.edgeBetweenness]),Te=A.useCallback(()=>{mA(A=>{const e=!A;if(e&&Pe&&h.current){const A=h.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 Pe.communities)for(const A of e){const e=ve.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})},[Pe,ve]),Le=A.useRef(null);A.useLayoutEffect(()=>{var A,e;Le.current=(null==(e=null==(A=h.current)?void 0:A.getMap)?void 0:e.call(A))??null});const Re=z(),Ie=A.useMemo(()=>H.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=O(r);t.has(A)||t.set(A,r)}if(e){const A=O(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(Kt);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(Jt)&&A.removeLayer(Jt),A.getSource(Kt)&&A.removeSource(Kt),A.addSource(Kt,{type:"geojson",data:{type:"FeatureCollection",features:[]}});const t=A.getLayer($t)?$t:void 0;A.addLayer({id:Jt,type:"line",source:Kt,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["any",["==",["get","isSpeculative"],!0],["==",["get","isSpeculative"],"true"]],"#8B7BAD","#12A594"],"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(Jt)&&A.removeLayer(Jt),A.getSource(Kt)&&A.removeSource(Kt)}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(Kt);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?qt:Xt)){o.push(i);const e=i.isSpeculative?er(A):Ar(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(Jt))return;const e=A.getLayer($t)?$t:void 0;try{A.moveLayer(Jt,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=G(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:tr(e),toCoord:tr(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:ve,packets:Ie,localHash:S,neighbors:t,meshTopology:b,enabled:Ae});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=Yt(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=Yt(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=Wt(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=vA(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=KA(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,qA/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/qA,1);v.current=yA(A)}G(!0);const o=qA+(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=Wt(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:Fe,loopEdgeKeys:je,backboneEdgeKeys:Ne,highlightedEdgeKey:f,neighbors:t,validatedSourceId:Sr,weakSourceId:Fr,neighborPolylines:Ee,showNeighborLines:K,neighborSourceId:Pr,neighborLinkScores:ke,basemapMode:te}),Ue=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]),Ye=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:We}=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)*yA(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"===dA,soloHubs:"hubs"===dA,neighborHashes:pe.map(([A])=>A),hubConnectedNodes:Ue,directNodeSet:xe,localConnectedNodes:Ye,showTopology:W}),{blinkingNodes:Ve,blinkColor:Ze}=function({neighbors:e,localHash:t,enabled:r=!0}){const[n,o]=A.useState(new Map),i=z(),a=A.useRef(H.getPackets());A.useEffect(()=>{a.current=H.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=O(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=Vt(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=G(r,t);if(!A||0===A.original.length)continue;const e=Zt(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:Ae}),Ke=A.useCallback(A=>{if("all"===dA)return!0;if("direct"===dA)return xe.has(A);if("hubs"===dA){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},[dA,xe,b.hubNodes,b.validatedEdges]),Xe=A.useCallback(()=>{_A(!0),RA(!0)},[]),$e=A.useCallback(()=>{zA?gA(A=>!A):Xe()},[zA,Xe]),At=A.useCallback(A=>{R(A.viewState),(A.viewState.pitch??0)>10&&!sA&&bA(!0)},[sA]),et=A.useCallback(()=>{Y(A=>{var e,t,r,n,o,i,a;const s=!A,l=null==(r=null==(t=null==(e=h.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(()=>{rA(A=>!A)},[]),ot=A.useCallback(()=>{bA(A=>{const e=!A;if(h.current){const A=h.current.getMap();A&&A.stop()}if(e&&h.current){const A=h.current.getMap();A&&A.easeTo({pitch:45,duration:1500,easing:vA})}if(!e&&h.current){const A=h.current.getMap();A&&A.easeTo({pitch:0,bearing:0,duration:800,easing:wA})}return e})},[]),it=A.useCallback(()=>{W||gA(!0)},[W]),at=A.useCallback((A,e)=>{SA(A),TA(e)},[]),st=A.useCallback(()=>{NA&&i&&i(NA),SA(null),TA("")},[NA,i]),lt=A.useMemo(()=>[...Gr,...Nr],[]),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=h.current)?void 0:t.getCanvas())&&(h.current.getCanvas().style.cursor="pointer")}catch{}},[CA]),gt=A.useCallback(()=>{var A;BA(null),ae(null);try{(null==(A=h.current)?void 0:A.getCanvas())&&(h.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-accent-primary border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-text-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:h,...T,onMove:At,mapStyle:Vr,style:{width:"100%",height:"100%"},attributionControl:!1,interactiveLayerIds:lt,onMouseMove:ft,onMouseLeave:gt,onClick:ut,onError:A=>{},onIdle:()=>{if(!N&&!Q&&h.current){const A=h.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(Qt,{enabled:sA,exaggeration:4}),e.jsx(Ct,{coveragePoints:ZA,visible:ZA.length>0&&JA,terrainEnabled:sA,brightness:XA,basemapMode:te}),e.jsx(_t,{partition:Pe,nodeCoordinates:ve,visible:nA&&zA,opacity:iA.opacity,bandwidth:iA.bandwidth,threshold:iA.threshold,strokeWidth:iA.strokeWidth}),e.jsx(Hr,{showTopology:W,isExiting:_e,hoveredEdgeKey:CA,highlightedLoopEdges:null==se?void 0:se.highlightedEdgeKeys,highlightedFocusEdges:Se,onEdgeHover:ce,onLoopHover:fe,loops:b.loops,neighborNames:be,opacityBias:EA,widthMultiplier:jA,trafficFilter:QA,showNeighborLines:K,disableHover:ze||IA}),a&&e.jsx(Or,{targetHash:a,nodeCoordinates:ve,onComplete:s}),f&&e.jsx(Ur,{highlightedEdgeKey:f,validatedPolylines:Me,weakPolylines:De,onEnsureTopology:it}),e.jsx(Wr,{ghost:g??null,neighborCoordinates:ve,onHighlightedNeighborsChange:VA}),e.jsx(Qr,{neighborsWithLocation:pe,localNode:r,localHash:o,zeroHopNeighbors:xe,lastHopNeighborMap:we,meshTopology:b,hoveredMarker:xA,onMarkerHover:kA,getNodeOpacity:We,shouldShowNode:Ke,onRequestRemove:i?at:void 0,openPopupId:OA,onOpenPopup:YA,onClosePopup:WA,onNodeClick:dt,blinkingNodes:Ve,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-amber-400"}),t>1&&n.push({text:`+${t-1} overlapping`,color:"text-violet-400/70"}),{type:"loop",title:{icon:"⟳",text:"Redundant Path"+(t>1?"s":""),color:"text-violet-400"},subtitle:{text:`${e.nodeNames.join(" → ")} → ${e.nodeNames[0]}`,color:"text-text-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-accent-success"}),t.push({label:"loud",value:n,color:"text-accent-danger"})),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-amber-400"},subtitle:{text:"Direct RF Neighbor",color:"text-amber-400/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-text-muted"})}const o=[];return e.isBackbone&&o.push({text:"Backbone",color:"text-gray-300"}),e.isLoopEdge&&o.push({text:"Redundant",color:"text-violet-400"}),e.isDirectPath&&o.push({text:"Direct Path",color:"text-teal-400"}),{type:"topology",title:{icon:"",text:`${e.fromName} ↔ ${e.toName}`,color:"text-text-primary"},stats:n,badges:o}}return null}(ie?{type:ie.type,properties:ie.properties}:null,se,Fe);return A&&e.jsx("div",{className:"map-edge-tooltip",children:e.jsx("div",{className:"map-control-glass map-edge-tooltip-inner",children:e.jsx(Kr,{data:A})})})})(),e.jsx(de,{mapRef:h,showNeighborLines:K,onToggleNeighborLines:rt,hasNeighborPolylines:Ee.length>0,nodeFilter:dA,onNodeFilterChange:tt,hasHubNodes:b.hubNodes.length>0,hasZeroHopNeighbors:xe.size>0,showCoverage:eA,onToggleCoverage:nt,showMinCut:nA,onToggleMinCut:Te,hasMinCutData:zA&&null!==Pe&&Pe.numCommunities>1,show3DTerrain:sA,onToggle3DTerrain:ot,basemapMode:te,onToggleBasemap:re,isFullscreen:_,onToggleFullscreen:et}),e.jsxs("div",{className:"map-legend-stack",children:[e.jsx(he,{isActive:W,hasAnalyzed:zA,isLoading:IA,onClick:$e,basemapMode:te}),e.jsx(me,{isActive:Ae,onClick:ee,basemapMode:te}),e.jsx(ye,{isActive:ZA.length>0&&JA,onClick:$A,basemapMode:te}),e.jsx(ue,{showTopology:W,validatedPolylineCount:Me.length,filteredNeighborCount:pe.length,hasLocalNode:!(!(null==r?void 0:r.latitude)||!(null==r?void 0:r.longitude)),meshTopology:b,zeroHopNeighbors:xe,neighborsWithLocation:pe,basemapMode:te})]}),!_&&e.jsx("div",{className:"glass-card-frame absolute inset-0 pointer-events-none rounded-[1.125rem]",style:{zIndex:9999},"aria-hidden":"true"}),e.jsx(tA,{isOpen:null!==NA,onCancel:()=>SA(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(uA,{isOpen:LA,onClose:()=>{RA(!1),_A(!1),He(),GA(!0),setTimeout(()=>gA(!0),150)}}),e.jsx(Ge,{}),e.jsx(Je,{visible:nA&&zA,onClose:()=>mA(!1),settings:iA,onSettingsChange:aA,partition:Pe,totalNodes:Object.keys(t).length,basemapMode:te})]})}export{Jr as default}; diff --git a/frontend/dist/assets/Dashboard-D3Izm5d2.js b/frontend/dist/assets/Dashboard-BwRsG8HD.js similarity index 97% rename from frontend/dist/assets/Dashboard-D3Izm5d2.js rename to frontend/dist/assets/Dashboard-BwRsG8HD.js index c2d5874c..a535c6ca 100644 --- a/frontend/dist/assets/Dashboard-D3Izm5d2.js +++ b/frontend/dist/assets/Dashboard-BwRsG8HD.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 r,S as o,a as c,b as d,d as m,e as u,M as x,f as h,h as p,j as f,k as g,n as b,R as v,L as j,o as y,p as N,q as k,D as w,r as M,t as C,v as L,T as S,w as _,x as B,y as T,z as R,E as F,F as D,G as H,H as A,J as P,K as $,N as I,O as z,Q as E,V as O,W as q,X as W,Y as G,Z as V}from"./index-CImKXCRQ.js";import{C as U,S as J,a as K,P as X,b as Q,B as Y}from"./PageLayout-CBx7rIBL.js";import{S as Z,M as ee,c as te}from"./link-scoring-B0M8cDnn.js";import{A as se,E as ae,T as ne}from"./TimeRangeSelector-B3Qt990z.js";import{S as le,A as ie,P as re,T as oe}from"./PacketList-FKMq_1Wb.js";import{T as ce,a as de,M as me}from"./trending-up-BBUOgjQN.js";import{C as ue}from"./copy-CfZtRqCt.js";import{L as xe,b as he}from"./vendor-core-CDNU4oKM.js";import{s as pe}from"./signal-scoring-CcBiRcks.js";import{L as fe}from"./LightSparkline-96Ro4wc3.js";import{Z as ge,C as be}from"./SignalIndicator-JkITXu3r.js";import{N as ve}from"./NodeInformationCard-DO5yOP6K.js";import{M as je,g as ye,e as Ne,a as ke,f as we,C as Me}from"./ChatBubble-jJzikYsj.js";import{C as Ce}from"./chevron-right-DZcqArkG.js";import{H as Le}from"./route-DJfT3Jo2.js";import{H as Se}from"./DelayedAnimateNumber-B6DSbUSU.js";import{R as _e,C as Be}from"./Grid-OFJ4oe0a.js";import{C as Te}from"./Card-DfIcRbRE.js";import"./maplibre-gl-b91ci4Kr.js";import"./index-CGYcizrv.js";import"./config-CTM8_93T.js";import"./payload-decoders-BbTIgSA8.js";import"./arrow-up-CPFFRV-b.js";import"./map-pin-lRKxIpXD.js";import"./triangle-alert-DRA45BSe.js";import"./DataBox-BUgVf-3d.js";import"./layers-CTDI7uhn.js";import"./activity-3eg63twO.js";import"./circle-check-DK-UNKLb.js";import"./database-1Jgt_gPe.js";const Re=a("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]),Fe=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"}]]),De=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"}]]),He=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"}]]),Ae=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"}]]),Pe=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"}]]),$e=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 Ie({packets:s,rangeMinutes:a,bucketCount:c}){const d=n(),[m,u]=e.useState(null),[x,h]=e.useState(null),[p,f]=e.useState(null),{buckets:g,activeTypes:b,totalByType:v}=e.useMemo(()=>function(e,t,s){const a=Date.now()/1e3,n=60*t,l=a-n,i=n/s,r=[];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=r[t];m.bytesByType[n]=(m.bytesByType[n]??0)+d,m.totalBytes+=d,o[n]=(o[n]??0)+d}return{buckets:r,activeTypes:Object.keys(o).map(e=>parseInt(e,10)).filter(e=>o[e]>0).sort((e,t)=>o[t]-o[e]),totalByType:o}}(s,a,c),[s,a,c]),j=e.useCallback((e,t,s)=>{u(t),h(s)},[]),y=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!==x&&t.jsxs("div",{className:"absolute flex items-center gap-1.5 text-sm font-mono tabular-nums -translate-x-1/2",style:{left:`calc(48px + ${100*x}% * (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(Z,{className:"w-4 h-4 text-amber-400"}):t.jsx(ee,{className:"w-4 h-4 text-blue-400"})},N?"sun":"moon")}),t.jsx("span",{className:"text-text-secondary",children:k})]})}),t.jsx("div",{className:"flex-1 min-h-0",children:y&&t.jsx(r,{buckets:g,activeTypes:b,gridColor:d.grid,axisTickColor:d.axisTick,onHover:j})}),t.jsx("div",{className:"pt-2 px-1 pb-2 shrink-0",children:y&&t.jsx(o,{activeTypes:b,totalByType:v})})]})}const ze=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 r=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,o=Math.floor(t.height)||60,u=new c({width:a,height:o,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:r}=e.bbox;!function(e,t,s,a,n,l,i){if(0===t.length)return;const r=function(e,t,s){var a,n;if(e.length<=s)return e;const l=e.length/s,i=[];for(let r=0;r0&&(d.bytesByType[s]=(d.bytesByType[s]??0)+t)}}i.push(d)}return i}(t,s,m.statsCard),o=r.length,c=l/o,u=r.map(e=>e.totalBytes).filter(e=>e>0);if(0===u.length)return;const x=Math.max(...u),h=Math.min(...u),p=x-h;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 x.observe(e),()=>{x.disconnect(),u.destroy()}},[r,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-text-muted/15"})}):t.jsx("div",{ref:n,className:"w-full h-full"})});function Ee({value:s,receivedCount:a,packets:n,rangeMinutes:l,bucketCount:i,timeRangeLabel:r,icon:o,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,r=[];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=r[t];u.bytesByType[n]=(u.bytesByType[n]??0)+d,u.totalBytes+=d,o[n]=(o[n]??0)+d,c++}const d=t/60;return{buckets:r,activeTypes:Object.keys(o).map(e=>parseInt(e,10)).filter(e=>o[e]>0).sort((e,t)=>o[t]-o[e]),ratePerHour:d>0?Math.round(c/d):0}}(n,l,i),[n,l,i]),h=a>0?(s/a*100).toFixed(1):null;return c?t.jsxs("div",{className:"data-card flex flex-col relative",children:[t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[o&&t.jsx("span",{className:"icon-sm text-icon-card-title",children:o}),t.jsx("span",{className:"type-micro",children:"FORWARDED"}),r&&t.jsx(u,{color:"zinc",className:"hidden sm:inline-flex",children:r})]}),t.jsx("div",{className:"type-data-xl text-text-primary",children:t.jsx(se,{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(ze,{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-text-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!==h&&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:[h,"%"]})]})]})})]}):t.jsx("div",{className:"data-card flex flex-col relative",children:t.jsx(U,{})})}function Oe({value:s,receivedCount:a,packets:n,rangeMinutes:l,bucketCount:i,timeRangeLabel:r,icon:o,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,r=[];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=r[t];u.bytesByType[n]=(u.bytesByType[n]??0)+d,u.totalBytes+=d,o[n]=(o[n]??0)+d,c++}const d=t/60;return{buckets:r,activeTypes:Object.keys(o).map(e=>parseInt(e,10)).filter(e=>o[e]>0).sort((e,t)=>o[t]-o[e]),ratePerHour:d>0?Math.round(c/d):0}}(n,l,i),[n,l,i]),h=a>0?(s/a*100).toFixed(1):null;return c?t.jsxs("div",{className:"data-card flex flex-col relative",children:[t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[o&&t.jsx("span",{className:"icon-sm text-icon-card-title",children:o}),t.jsx("span",{className:"type-micro",children:"DROPPED"}),r&&t.jsx(u,{color:"zinc",className:"hidden sm:inline-flex",children:r})]}),t.jsx("div",{className:"type-data-xl text-text-primary",children:t.jsx(se,{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(ze,{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-text-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!==h&&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:[h,"%"]})]})]})})]}):t.jsx("div",{className:"data-card flex flex-col relative",children:t.jsx(U,{})})}const qe={",":"punc",".":"punc-period",":":"punc-colon","/":"punc-slash"},We=/([,\.:\/])/g,Ge=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??""),We.test(e)?(We.lastIndex=0,e.split(We).map((e,s)=>{const a=qe[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})}),Ve=.2;function Ue(e,t=1){return Math.floor(5*t*e)}function Je(e){const t=Math.round(e/Ve)*Ve;return Math.max(0,Math.min(5,t))}function Ke({stats:s,receivedBuckets:a,droppedBuckets:n,forwardedBuckets:l,bucketDurationSeconds:i,timeRangeLabel:r,isLoaded:o=!0}){var c,d,m,p;const[f,g]=e.useState(!1);if(!o)return t.jsx("div",{className:"data-card flex flex-col relative",children:t.jsx(U,{})});const b=function(e,t,s,a,n){var l,i;const r=e=>(null==e?void 0:e.reduce((e,t)=>e+t.count,0))??0,o=r(t),c=r(s),d=r(a),m=o||(null==e?void 0:e.rx_count)||1,u=c||(null==e?void 0:e.dropped_count)||0,x=m>0?u/(m+u)*100:0;let h=0;if((null==a?void 0:a.length)&&n)h=100*d/(a.length*n*1e3)*100;else if(e){const t=1e3*(e.uptime_seconds||1);h=(e.total_airtime_ms||e.airtime_used_ms||0)/t*100}const p=(null==e?void 0:e.neighbors)??{},f=Object.values(p).filter(e=>e.zero_hop).length;let g=1;x<3?g-=Ve:x>15?g+=.4:x>10&&(g+=Ve),h>5&&(g+=Ve),f>10&&(g+=Ve);const b=Je(g),v=Je(.28*b),j=Ue(b),y=Ue(v),N=Ue((null==(i=null==(l=null==e?void 0:e.config)?void 0:l.delays)?void 0:i.tx_delay_factor)??1);return{floodFactor:b,directFactor:v,floodSlots:j,directSlots:y,adjustment:j>N?"increase":j{const e=`set txdelay ${b.floodFactor.toFixed(1)}\nset direct.txdelay ${b.directFactor.toFixed(1)}`;try{await navigator.clipboard.writeText(e),g(!0),setTimeout(()=>g(!1),1500)}catch(t){const s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();try{document.execCommand("copy"),g(!0),setTimeout(()=>g(!1),1500)}catch{}document.body.removeChild(s)}},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:"Click to copy CLI commands",children:[t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx("span",{className:"type-data-xl text-text-primary",children:t.jsxs(Ge,{children:["×",b.floodFactor.toFixed(1)]})}),t.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide 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-accent-primary",children:t.jsxs(Ge,{children:["×",b.directFactor.toFixed(1)]})}),t.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide 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:f?t.jsx(h,{className:"w-4 h-4 text-green-400"}):t.jsx(ue,{className:"w-4 h-4 text-text-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 "+(b.duplicateRate>10?"text-accent-warning":""),children:[b.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:[b.txUtilization.toFixed(2),"%"]})]})]})}),t.jsxs("div",{className:"pt-2 mt-2",children:[t.jsx("div",{className:"data-box-label",children:"Current"}),t.jsx("div",{className:"flex gap-2",children:null!==v?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"data-box",children:["×",v.toFixed(2)]}),t.jsxs("div",{className:"data-box",style:{color:"var(--accent-primary)"},children:["×",(null==j?void 0:j.toFixed(2))??"—"]})]}):t.jsx("span",{className:"text-sm text-text-muted",children:"No config"})})]})]})}function Xe(){const s=p(),a=f(),n=g(),l=b(),i=e.useMemo(()=>[...s.length<=100?s:s.slice(-100)].sort((e,t)=>(t.timestamp??0)-(e.timestamp??0)),[s]),r=null==l?void 0:l.local_hash,o=null==l?void 0:l.neighbors;return t.jsxs("div",{className:"chart-container h-full flex flex-col !overflow-visible",children:[t.jsxs("div",{className:"chart-header",children:[t.jsxs("div",{className:"chart-title",children:[t.jsx(v,{className:"chart-title-icon"}),"Recent Packets"]}),t.jsxs("div",{className:"flex items-center gap-3",children:[n&&t.jsx(j,{showLabel:!0}),t.jsxs(xe,{to:"/packets",className:"pill-subtle",children:["View all ",t.jsx(ie,{className:"w-3 h-3"})]})]})]}),t.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-1",children:t.jsx(re,{packets:i,allPackets:s,localHash:r,neighbors:o,loading:a,maxPackets:25,showPagination:!1,flashNewest:!0,emptyMessage:"No packets received",footerAction:t.jsxs(xe,{to:"/packets",className:"pill-subtle",children:["View all ",t.jsx(ie,{className:"w-3 h-3"})]})})})]})}const Qe={stable:"M5 12h14",up:"M5 15l7-7 7 7",down:"M19 9l-7 7-7-7"};function Ye({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:Qe[e]})})})}function Ze(){return t.jsx("div",{className:"mini-widget-loading",children:t.jsx("div",{className:"mini-widget-loading-spinner"})})}function et({message:e}){return t.jsx("div",{className:"mini-widget-error",children:t.jsx("span",{title:e,children:"No data"})})}function tt({title:e,icon:s,value:a,unit:n,valueSize:l="md",status:i,subtitle:r,trend:o,children:c,isLoading:d=!1,error:m,className:u="",onClick:x}){const h=["mini-widget-value","lg"===l&&"mini-widget-value-lg","sm"===l&&"mini-widget-value-sm"].filter(Boolean).join(" "),p=["mini-widget",x&&"cursor-pointer",u].filter(Boolean).join(" ");return t.jsxs("div",{className:p,onClick:x,role:x?"button":void 0,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}`}),o&&t.jsx(Ye,{trend:o})]}),d?t.jsx(Ze,{}):m?t.jsx(et,{message:m}):t.jsxs(t.Fragment,{children:[void 0!==a&&t.jsxs("div",{className:h,children:["number"==typeof a?t.jsx(se,{value:a,className:"font-mono tabular-nums",priority:"medium",format:Number.isInteger(a)?void 0:{minimumFractionDigits:1,maximumFractionDigits:1}}):t.jsx(Ge,{children:a}),n&&t.jsx("span",{className:"mini-widget-unit",children:n})]}),r&&t.jsx("div",{className:"mini-widget-subtitle",children:r}),c]})]})}const st={DELTA_CRITICAL:10,SLOPE_CRITICAL:4,JITTER_CRITICAL:6,DELTA_WARNING:5,SLOPE_WARNING:2,JITTER_WARNING:4},at={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 nt(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 lt(e){return nt(e,50)}function it(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 rt(e){return null!=e&&0!==e&&!Object.is(e,-0)&&!(e>-50||e<-130)}function ot(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 ct={lbtStats:null,noiseFloor:null,sparklineNoiseFloor:[],linkQuality:null,channelHealth:null,nfTrend:at,radioConfig:null,trends:null,stats:null,recentPackets:[],quickNeighbors:[],isLoading:!0,error:null,refresh:async()=>{}},dt=e.createContext(ct);function mt({children:s}){var a;const n=b(),l=p(),i=y(),r=N(),o=k(),c=w[o],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,r=l>0?i/l*100:0,o=n.filter(e=>(e.lbt_attempts??0)>1),c=o.length>0?o.reduce((e,t)=>e+(t.lbt_attempts??0),0)/o.length:0,d=n.filter(e=>(e.lbt_attempts??0)>=5).length,m=l>0?d/l*100:0,u=[];for(const j of n){const e=it(j.lbt_backoff_delays_ms);u.push(...e)}const x=u.reduce((e,t)=>e+t,0),h=u.length>0?x/u.length:0,p=u.length>0?Math.min(...u):0,f=u.length>0?Math.max(...u):0,g=s/24,b=[],v=[];for(let j=0;j<24;j++){const e=a+j*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,r=[];for(const a of s){const e=it(a.lbt_backoff_delays_ms);r.push(...e)}const o=r.length>0?r.reduce((e,t)=>e+t,0)/r.length:0;if(b.push(o),0===s.length)v.push(0);else{const e=s.filter(e=>(e.lbt_attempts??0)>=5).length,t=r.length>0?Math.max(...r):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;o>100&&(m=Math.min(8*Math.log10(o/100),15));let u=0;t>500&&o>0&&t>2*o&&(u=Math.min((t-500)/200,5));const x=l+d+m+u;v.push(Math.min(x*a,85))}}return{totalPacketsWithLBT:l,packetsWithRetries:i,retryRate:r,avgRetries:c,channelBusyCount:d,channelBusyRate:m,avgBackoffMs:h,minBackoffMs:p,maxBackoffMs:f,totalBackoffMs:x,sparklineBackoff:b,sparklineCollisionRisk:v,windowHours:t,packetCount:e.length}}(l,d),[l,d]),x=(null==n?void 0:n.noise_floor_dbm)??null,h=e.useMemo(()=>rt(x)?x:null,[x]),f=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]),[g,v]=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 M(Math.max(s,24));t.success&&(null==(e=t.data)?void 0:e.history)&&v(t.data.history)}catch{}}};e();const t=setInterval(e,6e4);return()=>clearInterval(t)},[d]);const C=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 r=0;r<24;r++){const t=n+r*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}(g,d),[g,d]),L=null==n?void 0:n.neighbors,S=e.useMemo(()=>{const e=L??{};return Object.fromEntries(Object.entries(e).filter(([e])=>!r.has(e)))},[L,r]),_=e.useMemo(()=>i.filter(e=>!r.has(e.hash)),[i,r]),B=e.useMemo(()=>function(e){if(0===e.length)return{...at,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=lt(s),i=nt(s,10),r=nt(s,90),o=lt(a),c=null!==o&&null!==i?o-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 o of e){const e=(o.timestamp-i)/3600,t=o.value;s+=e,a+=t,n+=e*t,l+=e*e}const r=t*l-s*s;return Math.abs(r)<1e-4?0:(t*n-s*a)/r}(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,[x,h]=u?function(e,t,s){const a=st;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:r,currentMedian:o,currentSampleCount:a.length,delta:c,slope:d,jitter:m,penalty:x,penaltyReason:h,computedAt:t,isReliable:u}}(C),[C]),T=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=pe(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}}(_,S,f),[_,S,f]),R=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 r;return r=i>=85?"excellent":i>=70?"good":i>=50?"fair":i>=30?"congested":"critical",{score:i,status:r,components:{lbtHealth:Math.round(a),noiseHealth:Math.round(n),linkHealth:Math.round(l)}}}(u,h,T),[u,h,T]),[F,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:h,networkScore:(null==T?void 0:T.networkScore)??null,channelHealth:(null==R?void 0:R.score)??null}))};e();const t=setInterval(e,5e3);return()=>clearInterval(t)},[h,null==T?void 0:T.networkScore,null==R?void 0:R.score]);const A=e.useMemo(()=>({noiseFloor:{current:h,previous:F.noiseFloor,trend:null!==h?ot(h,F.noiseFloor,2,!0):"stable"},networkScore:{current:(null==T?void 0:T.networkScore)??0,previous:F.networkScore,trend:ot((null==T?void 0:T.networkScore)??0,F.networkScore,3,!1)},channelHealth:{current:(null==R?void 0:R.score)??0,previous:F.channelHealth,trend:ot((null==R?void 0:R.score)??0,F.channelHealth,3,!1)}}),[h,null==T?void 0:T.networkScore,null==R?void 0:R.score,F]),P={lbtStats:u,noiseFloor:h,sparklineNoiseFloor:C,linkQuality:T,channelHealth:R,nfTrend:B,radioConfig:f,trends:A,stats:n,recentPackets:l,quickNeighbors:i,isLoading:m,error:null,refresh:async()=>{}};return t.jsx(dt.Provider,{value:P,children:s})}function ut(){const t=e.useContext(dt);if(void 0===t)throw new Error("useLBTData must be used within an LBTDataProvider");return t}function xt(e,t){return 0===e?"No backoffs":`${t.toFixed(0)}% retry rate`}function ht(){const{lbtStats:s,isLoading:a,error:n}=ut(),l=he(),i=(null==s?void 0:s.avgBackoffMs)??0,r=(null==s?void 0:s.retryRate)??0,o=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(tt,{title:"LBT Backoff",icon:t.jsx($e,{className:"mini-widget-icon"}),value:Math.round(i),unit:"ms",status:o,subtitle:s?xt(i,r):void 0,isLoading:a,error:n,onClick:()=>l("/packets"),children:t.jsx("div",{className:"mini-widget-sparkline w-full",children:t.jsx(fe,{data:m,width:9999,height:24,color:"var(--accent-primary)",isLoading:a,className:"w-full"})})})}function pt(e){return 0===e?"—":e<1?"<1":Math.round(e).toString()}function ft(){const{lbtStats:e,isLoading:s,error:a}=ut(),n=he(),l=(null==e?void 0:e.channelBusyCount)??0,i=(null==e?void 0:e.totalPacketsWithLBT)??0,r=(null==e?void 0:e.channelBusyRate)??0,o=(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=o>0?Math.max(0,(o-r)/o*100):100;return t.jsx(tt,{title:"Ch. Busy",icon:t.jsx(ae,{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)_auto_minmax(0,1fr)] gap-x-2 gap-y-2 w-full items-baseline",children:[t.jsx("span",{className:"data-box-label mb-0",title:`${l} packets exceeded max CAD attempts (5) out of ${i} total transmissions.`,children:"Failed:"}),t.jsxs("div",{className:"data-box justify-self-start",title:`${l} packets exceeded max CAD attempts (5) out of ${i} total transmissions.`,children:[t.jsx(Ge,{children:l}),t.jsx("span",{className:"text-text-muted punc-slash",children:"/"}),t.jsx(Ge,{children:i})]}),t.jsx("span",{className:"data-box-label mb-0",title:`${u.toFixed(1)}% of packets that needed LBT retries were sent successfully.`,children:"Sent:"}),t.jsx("div",{className:"data-box justify-self-start",title:`${u.toFixed(1)}% of packets that needed LBT retries were sent successfully.`,children:t.jsxs(Ge,{children:[u.toFixed(0),"%"]})}),t.jsx("span",{className:"data-box-label mb-0",title:`Average LBT backoff delay: ${c.toFixed(0)}ms.`,children:"Mean:"}),t.jsxs("div",{className:"data-box justify-self-start",title:`Average LBT backoff delay: ${c.toFixed(0)}ms.`,children:[t.jsx(Ge,{children:pt(c)}),t.jsx("span",{className:"text-text-muted text-xs",children:"ms"})]}),t.jsx("span",{className:"data-box-label mb-0",title:`Backoff range: ${d.toFixed(0)}ms min, ${m.toFixed(0)}ms max.`,children:"Range:"}),t.jsxs("div",{className:"data-box justify-self-start",title:`Backoff range: ${d.toFixed(0)}ms min, ${m.toFixed(0)}ms max.`,children:[t.jsx(Ge,{children:pt(d)}),t.jsx("span",{className:"text-text-muted punc-slash",children:"/"}),t.jsx(Ge,{children:pt(m)})]})]})})})}function gt(e){return null===e?"No reading":e<-115?"Very quiet":e<-105?"Quiet":e<-95?"Moderate":e<-85?"Elevated":"High interference"}function bt(){const{noiseFloor:s,sparklineNoiseFloor:a,trends:n,isLoading:l,error:i}=ut(),r=null===(o=s)||o<-110?"excellent":o<-100?"good":o<-90?"fair":o<-80?"congested":"critical";var o;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(tt,{title:"Noise Floor",icon:t.jsx(Fe,{className:"mini-widget-icon"}),value:m,unit:null!==s?"dBm":void 0,status:r,trend:c,subtitle:gt(s),isLoading:l,error:i,children:t.jsx("div",{className:"mini-widget-sparkline w-full",children:t.jsx(fe,{data:d,width:9999,height:24,color:"var(--accent-primary)",isLoading:l,className:"w-full"})})})}function vt(){const s=he(),a=y(),n=p(),l=b(),i=k(),r=60*w[i].minutes,o=C(),c=e.useMemo(()=>{if(0===o)return n;const e=o-r;return n.filter(t=>t.timestamp>=e)},[n,r,o]),d=null===l,m=(null==l?void 0:l.local_hash)?L(l.local_hash):"",u=(null==l?void 0:l.neighbors)??{},{neighborHashes:x,neighborNames:h}=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]),f=e.useMemo(()=>{if(0===x.size||0===c.length||!m)return{champion:null,listener:null,loudest:null};const{scores:e}=te(c,x,m),t=[];for(const[l,i]of e)0!==i.blendedScore&&t.push({...i,name:h.get(l)??L(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,x,m,h]),{champion:g,listener:v,loudest:j}=f,N=g||v||j?t.jsxs("div",{className:"flex flex-col gap-0.5 mt-auto",children:[g&&t.jsx(S,{content:(M=g,t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["🏆 Champion: ",M.name]}),t.jsxs("div",{className:"text-text-muted mb-1",children:["Blended Score: ",M.blendedScore,t.jsx("span",{className:"text-text-muted/60 ml-1",children:"(Listener + Loud)"})]}),t.jsxs("div",{className:"border-t border-border-subtle pt-1 mt-1 space-y-0.5",children:[t.jsxs("div",{children:["Listener: ",M.listenerScore,"/100 (",M.listenerCount," shared paths)"]}),t.jsxs("div",{children:["Loud: ",M.loudScore,"/100 (",M.loudCount," packets relayed)"]})]})]})),children:t.jsxs("div",{className:"flex items-center gap-1 text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx(oe,{className:"w-3 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:g.name}),t.jsx("span",{className:"text-map-neighbor-color pl-2 tabular-nums flex-shrink-0 w-9 text-right",children:g.blendedScore})]})}),v&&t.jsx(S,{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-text-muted mb-1",children:["Score: ",e.listenerScore,"/100"]}),t.jsx("div",{className:"border-t border-border-subtle pt-1 mt-1",children:t.jsxs("div",{children:[e.listenerCount," packets where they heard your transmissions"]})})]}))(v),children:t.jsxs("div",{className:"flex items-center gap-1 text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx(De,{className:"w-3 h-3 text-text-muted flex-shrink-0"}),t.jsx("span",{className:"text-text-muted font-mono truncate flex-1 min-w-0",children:v.name}),t.jsx("span",{className:"text-text-muted pl-2 tabular-nums flex-shrink-0 w-9 text-right",children:v.listenerScore})]})}),j&&t.jsx(S,{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-text-muted mb-1",children:["Score: ",e.loudScore,"/100"]}),t.jsx("div",{className:"border-t border-border-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-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx(He,{className:"w-3 h-3 text-text-muted flex-shrink-0"}),t.jsx("span",{className:"text-text-muted font-mono truncate flex-1 min-w-0",children:j.name}),t.jsx("span",{className:"text-text-muted pl-2 tabular-nums flex-shrink-0 w-9 text-right",children:j.loudScore})]})})]}):0===a.length?t.jsx("div",{className:"flex items-center justify-center text-sm text-text-muted mt-auto",children:"No direct neighbors"}):t.jsx("div",{className:"flex items-center justify-center text-sm text-text-muted mt-auto",children:"No routing data yet"});var M;return t.jsx(tt,{title:"Link Leaders",icon:t.jsx(Ae,{className:"mini-widget-icon"}),isLoading:d,onClick:()=>s("/contacts"),children:N})}function jt(){const{lbtStats:s,isLoading:a,error:n}=ut(),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),r=Math.log(1+.15*t)/Math.log(16)*40,o=s/a*100,c=Math.min(.5*o,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=(r+c+d+m)*i;return Math.min(u,85)}(s):0,i=s?(r=l)<15?"excellent":r<30?"good":r<45?"fair":r<60?"congested":"critical":"unknown";var r;const o=(null==s?void 0:s.maxBackoffMs)??0,c=s?o>200?`Max backoff: ${Math.round(o)}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(tt,{title:"Collision Risk",icon:t.jsx(ge,{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(fe,{data:m,width:9999,height:24,color:"var(--accent-primary)",isLoading:a,className:"w-full"})})})}function yt(){const[s,a]=e.useState(!1),[n]=e.useState(0),{stats:l,lbtStats:i,isLoading:r}=ut(),o=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==o?void 0:o.utilizationPercent)??0,m=(u=d)<30?"excellent":u<50?"good":u<70?"fair":u<90?"congested":"critical";var u;const x=(null==o?void 0:o.remainingMs)??0,h=c<95?`${c.toFixed(0)}% clean TX`:((p=x)<1e3?`${Math.round(p)}ms`:p<6e4?`${(p/1e3).toFixed(1)}s`:`${(p/6e4).toFixed(1)}m`)+" remaining";var p;const f=o?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(tt,{title:"Duty Cycle",icon:t.jsx(v,{className:"mini-widget-icon"}),value:d.toFixed(1),unit:"%",status:m,subtitle:h,isLoading:r,children:f})}function Nt(){return t.jsxs("div",{className:"mini-widget",children:[t.jsxs("div",{className:"mini-widget-header",children:[t.jsx(J,{className:"w-4 h-4"}),t.jsx(J,{className:"h-3 w-16"})]}),t.jsx(J,{className:"h-7 w-12 mt-2"}),t.jsx(J,{className:"h-3 w-20 mt-2"})]})}function kt(){return t.jsx("div",{className:"widget-row",children:Array.from({length:6}).map((e,s)=>t.jsx(Nt,{},s))})}function wt({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(Pe,{className:"w-4 h-4 text-accent-primary"}),t.jsx("span",{className:"type-label text-text-muted",children:"MESH HEALTH"})]}),s?t.jsx(mt,{children:t.jsxs("div",{className:"widget-row",children:[t.jsx(ht,{}),t.jsx(jt,{}),t.jsx(bt,{}),t.jsx(yt,{}),t.jsx(ft,{}),t.jsx(vt,{})]})}):t.jsx(kt,{})]})}const Mt={sm:{button:"w-3 h-3",icon:"w-1.5 h-1.5",stroke:"ring-1"},md:{button:"w-3.5 h-3.5",icon:"w-2 h-2",stroke:"ring-1"},lg:{button:"w-4 h-4",icon:"w-2.5 h-2.5",stroke:"ring-[1.5px]"}},Ct=e.forwardRef(function({size:e="md",showIconOnHover:a=!0,className:n,...l},i){const r=Mt[e];return t.jsx("button",{ref:i,type:"button","aria-label":"Close",className:s("group relative inline-flex items-center justify-center rounded-full","transition-all duration-150 ease-out",r.button,"bg-[#FF5F57]",r.stroke,"ring-inset ring-[#E0443E]","hover:bg-[#FF6961]","active:bg-[#E04840] active:scale-95","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2","focus-visible:ring-[#FF5F57] focus-visible:ring-offset-bg-base",n),...l,children:a&&t.jsx("svg",{className:s(r.icon,"opacity-0 group-hover:opacity-100 transition-opacity duration-100","text-[#4A0000]"),fill:"none",viewBox:"0 0 10 10",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",children:t.jsx("path",{d:"M2.5 2.5L7.5 7.5M7.5 2.5L2.5 7.5"})})})});let Lt="",St="",_t="";function Bt(e){!function(){const e=new Date,t=e.toDateString();if(t!==_t){_t=t,Lt=t;const s=new Date(e);s.setDate(s.getDate()-1),St=s.toDateString()}}();const t=new Date(1e3*e).toDateString();return t===Lt?"Today":t===St?"Yesterday":new Date(1e3*e).toLocaleDateString([],{weekday:"short",month:"short",day:"numeric"})}function Tt(e,t,s){return`${e||""}|${t}|${s}`}const Rt=e.memo(function({message:e,onChannelClick:a,isChannelSelected:n}){const l=e.channelName||e.channelHash.slice(0,6);return t.jsx("div",{style:{transform:"translateZ(0)",willChange:"transform"},children:t.jsx(Me,{senderName:e.senderName||"Unknown",text:e.text,timestamp:e.timestamp,nameAccessory:t.jsx("button",{onClick:()=>null==a?void 0:a(e.channelHash),className:s("px-2 rounded text-[10px] font-medium flex-shrink-0","ring-1 ring-inset h-5 leading-5",n?"bg-accent-primary/20 text-accent-primary ring-accent-primary/30":"bg-subtle-fill text-text-secondary ring-border-subtle hover:bg-subtle-fill-strong"),children:l})})})},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 Ft({open:a,onClose:n,messages:l,onLoadMore:i,hasMoreToLoad:r,isDecoding:o}){const c=e.useRef(null),d=e.useRef(!0),m=k(),u=A(),x=e.useRef(!1);e.useEffect(()=>{a?(x.current=!0,P.resume()):x.current&&P.pause()},[a]);const h=e.useMemo(()=>{const e=Date.now()/1e3-60*w[m].minutes;return[...l].filter(t=>t.timestamp>=e).sort((e,t)=>e.timestamp-t.timestamp)},[l,m]),p=e.useCallback(()=>{const e=c.current;e&&(d.current=e.scrollTop>=-50)},[]),f=e.useMemo(()=>{const e=new Map;for(const t of h){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)},[h]),g=f.length,[b,v]=e.useState(null),[j,y]=e.useState(!1),N=e.useCallback(()=>{i(b,f)},[i,b,f]),M=e.useMemo(()=>b?h.filter(e=>e.channelHash===b):h,[h,b]),C=e.useMemo(()=>{const e=[];let t="";for(const s of M){const a=Bt(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=c.current;e&&d.current&&(e.scrollTop=0)},[M.length]);const L=f.slice(0,19),S=f.slice(19),_=S.length>0;return t.jsxs($,{open:a,onClose:n,size:"lg",motionPlus:!0,solid:!0,children:[t.jsx(Ct,{onClick:n,size:"md",style:{position:"absolute",top:12,right:12,zIndex:10}}),t.jsxs(I,{className:"p-0 flex flex-col h-[80vh] max-h-[700px] rounded-2xl",children:[t.jsx("div",{className:"flex-shrink-0 px-5 py-4 pr-12",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(je,{className:"size-5 text-icon-card-title flex-shrink-0"}),t.jsx("h2",{className:"text-base font-semibold text-text-primary",children:"Public Channels"})]}),t.jsx(ne,{ranges:w,selectedIndex:m,onSelect:u,size:"micro"})]})}),t.jsx("div",{className:"flex-shrink-0 px-3 pb-2 relative z-10 isolate",style:{minHeight:g>0?void 0:0},children:g>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-[10px] font-medium transition-all","ring-1 ring-inset",null===b?"bg-accent-primary/20 text-accent-primary ring-accent-primary/30":"bg-subtle-fill text-text-secondary ring-border-subtle hover:bg-subtle-fill-strong"),children:"All"}),L.map(e=>t.jsx("button",{onClick:()=>v(e.hash),className:s("flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-medium transition-all","ring-1 ring-inset",b===e.hash?"bg-accent-primary/20 text-accent-primary ring-accent-primary/30":"bg-subtle-fill text-text-secondary ring-border-subtle hover:bg-subtle-fill-strong"),children:t.jsx("span",{className:"truncate max-w-[80px]",children:e.name})},e.hash)),_&&t.jsxs("div",{className:"relative",children:[t.jsxs("button",{onClick:()=>y(!j),className:s("flex items-center gap-0.5 px-2 py-0.5 rounded text-[10px] font-medium transition-all","ring-1 ring-inset",j||S.some(e=>e.hash===b)?"bg-accent-primary/20 text-accent-primary ring-accent-primary/30":"bg-subtle-fill text-text-secondary ring-border-subtle hover:bg-subtle-fill-strong"),children:["+",S.length,t.jsx(z,{className:s("size-3 transition-transform",j&&"rotate-180")})]}),j&&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-bg-elevated backdrop-blur-xl","ring-1 ring-border-subtle shadow-xl"),children:S.map(e=>t.jsxs("button",{onClick:()=>{v(e.hash),y(!1)},className:s("w-full flex items-center gap-1.5 px-2 py-1 rounded text-[10px] font-medium transition-all text-left",b===e.hash?"bg-accent-primary/20 text-accent-primary":"text-text-secondary hover:bg-subtle-fill-strong"),children:[t.jsx(Le,{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:c,onScroll:p,className:s("flex-1 overflow-y-auto overflow-x-hidden","mx-3 mb-3 rounded-md","bg-bg-body","ring-1 ring-inset ring-border-subtle","flex flex-col-reverse"),children:o&&0===M.length?t.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[300px] text-text-muted px-4 py-4",children:[t.jsx(E,{className:"size-12 mb-4 text-accent-purple 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-text-muted px-4 py-4",children:[t.jsx(me,{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:b?"No messages in this channel":"Public channel messages will appear here"})]}):t.jsxs("div",{className:"px-4 py-4",children:[r&&t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("button",{onClick:N,disabled:o,className:s("px-4 py-1.5 rounded-full","text-[11px] font-medium","ring-1 ring-inset",o?"bg-subtle-fill text-text-muted ring-border-subtle cursor-wait":"bg-accent-primary/10 text-accent-primary ring-accent-primary/20 hover:bg-accent-primary/20 hover:ring-accent-primary/30"),children:o?t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx(E,{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-text-muted/80 font-medium","ring-1 ring-border-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(Rt,{message:e.message,onChannelClick:v,isChannelSelected:b===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-text-muted",children:[M.length," messages · ",g," ",1===g?"channel":"channels",o&&t.jsxs("span",{className:"ml-2 text-accent-purple",children:[t.jsx(E,{className:"inline size-3 animate-spin mr-1"}),"Decrypting..."]})]})})]})]})}function Dt({isLoaded:a=!0}){const n=p(),[r,o]=e.useState(!1),c=k(),d=e.useCallback(()=>{o(!0),_.getState().queueDecryption(n)},[n]),m=B(),u=T(),x=R(),h=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=Tt(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}(m),[m]),f=e.useMemo(()=>{const e=Date.now()/1e3-60*w[c].minutes;return h.filter(t=>t.timestamp>=e)},[h,c]),g=e.useMemo(()=>0===f.length?null:f.reduce((e,t)=>t.timestamp>e.timestamp?t:e),[f]),b=u.isDecoding,v=e.useMemo(()=>{const e=Date.now()/1e3-60*w[c].minutes,t=new Set;let s=0;for(const a of n)(a.type??a.payload_type)===F.GRP_TXT&&((a.timestamp??0){const e=Date.now()/1e3-60*w[c].minutes;for(const t of n)if((t.type??t.payload_type)===F.GRP_TXT&&!((t.timestamp??0){if(!b){if(e){const s=t.find(t=>t.hash===e);if(s)return void _.getState().queueChannelDecryption(n,s.name)}_.getState().queueDecryption(n)}},[n,b]);return a?t.jsxs(t.Fragment,{children:[t.jsx("div",{onClick:d,className:s("group cursor-pointer rounded-xl transition-all duration-150","ring-1 ring-inset ring-border-subtle hover:ring-accent-primary/50","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(je,{className:"size-4 text-icon-card-title flex-shrink-0"}),t.jsx("span",{className:"type-micro",children:"CHAT ACTIVITY"}),v>0&&t.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-subtle-fill ring-1 ring-inset ring-border-subtle text-sm tabular-nums text-text-secondary",children:v}),t.jsx(Ce,{className:"size-4 text-text-muted group-hover:text-accent-purple 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:g?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:[g.channelName&&t.jsxs("span",{className:"hidden sm:inline-flex items-center px-2 py-1 rounded-md bg-subtle-fill ring-1 ring-inset ring-border-subtle text-sm text-text-secondary flex-shrink-0",children:["#",g.channelName.replace(/^#/,"")]}),t.jsx("div",{className:"hidden sm:flex w-[30px] h-[30px] rounded-full items-center justify-center flex-shrink-0 ring-1 ring-border-subtle",style:{backgroundColor:ye(Ne(g.senderName||"").cleanName)},children:Ne(g.senderName||"").emoji?t.jsx("span",{className:"text-base",children:Ne(g.senderName||"").emoji}):t.jsx("span",{className:"text-white text-xs font-bold tracking-tighter",children:ke(g.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:we(g.text)})}),t.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-subtle-fill ring-1 ring-inset ring-border-subtle text-sm tabular-nums text-text-secondary flex-shrink-0",children:H(g.timestamp)})]},`msg-${g.timestamp}-${g.senderName}-${g.channelHash}`):x?t.jsx(i.span,{initial:{opacity:0},animate:{opacity:1},className:"text-sm text-text-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(Ce,{className:"size-4 text-text-muted group-hover:text-accent-purple transition-colors flex-shrink-0 hidden sm:block ml-1"})]})]})}),t.jsx(Ft,{open:r,onClose:()=>o(!1),messages:h,onLoadMore:N,hasMoreToLoad:y,isDecoding:b})]}):t.jsx("div",{className:"h-14 rounded-xl bg-bg-elevated/50 animate-pulse"})}function Ht(){var s,a;const n=b(),l=O(),i=p(),r=q(),o=e.useRef(!1);r&&!o.current&&(o.current=!0);const c=o.current,d=k(),m=A(),x=W(),h=w[d],f=5===d&&!x.threeDayLoadComplete,g=6===d&&!x.sevenDayLoadComplete,v=7===d&&!x.fourteenDayLoadComplete,j=x.isBackgroundLoading&&(f||g||v),y=null==(s=null==n?void 0:n.config)?void 0:s.radio,N=e.useMemo(()=>y?{sf:y.spreading_factor??10,bw:y.bandwidth??25e4,cr:y.coding_rate??5,preamble:y.preamble_length??8}:null,[y]),M=i.length,C=e.useMemo(()=>M?G(h.minutes,h.buckets,i,n):null,[M,h.minutes,h.buckets,N]),L=e.useMemo(()=>{const e=e=>(null==e?void 0:e.reduce((e,t)=>e+t.count,0))??0,t=e(null==C?void 0:C.received),s=e(null==C?void 0:C.unique_received),a=e(null==C?void 0:C.forwarded),n=e(null==C?void 0:C.dropped),l=e(null==C?void 0:C.transmitted),i=((null==C?void 0:C.time_range_minutes)??h.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}},[C,h.minutes]),S=e.useMemo(()=>{if(!i.length)return{totalBytes:0,kbPerHour:0};const e=Date.now()/1e3,t=e-60*h.minutes;let s=0;for(const n of i)n.transmitted||n.timestampe||(s+=n.length??n.payload_length??0);const a=h.minutes/60;return{totalBytes:s,kbPerHour:a>0?Math.round(s/1024/a):0}},[i,h.minutes]),_=(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(()=>{_&&"Unknown Node"!==_&&(document.title=`pyMC: ${_}`)},[_]),l?t.jsxs(K,{className:"p-8 text-center",children:[t.jsx("p",{className:"type-subheading text-accent-red mb-2",children:"Failed to connect to backend"}),t.jsx("p",{className:"type-body text-text-muted",children:l}),t.jsx("p",{className:"type-data-sm text-text-muted mt-4",children:"Make sure the backend is running on port 8000"})]}):t.jsxs(X,{children:[t.jsx(Q,{title:_,icon:t.jsx(Se,{}),controls:t.jsx(ne,{ranges:w,selectedIndex:d,onSelect:m,isPending:j})}),t.jsxs(Y,{children:[t.jsx(Dt,{isLoaded:c}),t.jsx(_e,{template:"hero-auto",children:t.jsxs(K,{compact:!0,children:[t.jsx(Te,{icon:t.jsx(V,{}),title:"PACKETS RECEIVED",badge:h.label,badgeColor:"zinc",actions:c?t.jsxs("div",{className:"data-box",children:[S.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-text-primary",children:c?t.jsx(se,{value:L.received,className:"font-mono tabular-nums",priority:"high"}):t.jsx("span",{className:"opacity-30",children:"—"})}),t.jsx(u,{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-text-primary",children:c?t.jsx(se,{value:L.uniqueReceived,className:"font-mono tabular-nums",priority:"high"}):t.jsx("span",{className:"opacity-30",children:"—"})}),t.jsx(u,{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(Ie,{packets:i,rangeMinutes:h.minutes,bucketCount:h.buckets})})]})]})}),t.jsxs(_e,{template:"compact",children:[t.jsx(Be,{span:6,lg:4,children:t.jsx(Ee,{value:L.forwarded,receivedCount:L.received,packets:i,rangeMinutes:h.minutes,bucketCount:h.buckets,timeRangeLabel:h.label,icon:t.jsx(Re,{className:"w-4 h-4"}),isLoaded:c})}),t.jsx(Be,{span:6,lg:4,children:t.jsx(Oe,{value:L.dropped,receivedCount:L.received,packets:i,rangeMinutes:h.minutes,bucketCount:h.buckets,timeRangeLabel:h.label,icon:t.jsx(be,{className:"w-4 h-4"}),isLoaded:c})}),t.jsx(Be,{span:12,lg:4,children:t.jsx(Ke,{stats:n,receivedBuckets:null==C?void 0:C.received,droppedBuckets:null==C?void 0:C.dropped,forwardedBuckets:null==C?void 0:C.forwarded,bucketDurationSeconds:null==C?void 0:C.bucket_duration_seconds,timeRangeLabel:h.label,isLoaded:c})})]}),t.jsx(wt,{isLoaded:c}),t.jsx(Xe,{}),n&&t.jsx(_e,{template:"auto",children:t.jsx(ve,{nodeName:_,repeaterVersion:n.version,coreVersion:n.core_version,localHash:n.local_hash,publicKey:n.public_key})})]})]})}export{Ht 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 r,S as o,a as c,b as d,d as m,e as u,M as x,f as h,h as p,j as f,k as g,n as b,R as v,L as j,o as y,p as N,q as k,D as w,r as M,t as C,v as L,T as S,w as _,x as B,y as T,z as R,E as F,F as D,G as H,H as A,J as P,K as $,N as I,O as z,Q as E,V as O,W as q,X as W,Y as G,Z as V}from"./index-B51aMfiH.js";import{C as U,S as J,a as K,P as X,b as Q,B as Y}from"./PageLayout-DUXmuiZg.js";import{S as Z,M as ee,c as te}from"./link-scoring-DtQvFOcN.js";import{A as se,E as ae,T as ne}from"./TimeRangeSelector-DOdtPPj_.js";import{S as le,A as ie,P as re,T as oe}from"./PacketList-XLhbtedS.js";import{T as ce,a as de,M as me}from"./trending-up-CsysmbvI.js";import{C as ue}from"./copy-jAVnwXtf.js";import{L as xe,b as he}from"./vendor-core-CDNU4oKM.js";import{s as pe}from"./signal-scoring-CcBiRcks.js";import{L as fe}from"./LightSparkline-96Ro4wc3.js";import{Z as ge,C as be}from"./SignalIndicator-DvKCjwKG.js";import{N as ve}from"./NodeInformationCard-y7LNSCha.js";import{M as je,g as ye,e as Ne,a as ke,f as we,C as Me}from"./ChatBubble-D6wREMt8.js";import{C as Ce}from"./chevron-right-DiVetJOJ.js";import{H as Le}from"./route-BTnuOvzt.js";import{H as Se}from"./DelayedAnimateNumber-BXZBlojL.js";import{R as _e,C as Be}from"./Grid-OFJ4oe0a.js";import{C as Te}from"./Card-BC0izdLh.js";import"./maplibre-gl-b91ci4Kr.js";import"./index-Ch_XDzqB.js";import"./config-CTM8_93T.js";import"./payload-decoders-ClAu_OX0.js";import"./arrow-up-By-lyY8m.js";import"./map-pin-C3ieg9t_.js";import"./triangle-alert-JpcXY4mr.js";import"./DataBox-B4su-zzA.js";import"./layers-Dd_4LhZ4.js";import"./activity-48nFba-7.js";import"./circle-check-DBemvAXd.js";import"./database-IcctMW15.js";const Re=a("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]),Fe=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"}]]),De=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"}]]),He=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"}]]),Ae=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"}]]),Pe=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"}]]),$e=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 Ie({packets:s,rangeMinutes:a,bucketCount:c}){const d=n(),[m,u]=e.useState(null),[x,h]=e.useState(null),[p,f]=e.useState(null),{buckets:g,activeTypes:b,totalByType:v}=e.useMemo(()=>function(e,t,s){const a=Date.now()/1e3,n=60*t,l=a-n,i=n/s,r=[];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=r[t];m.bytesByType[n]=(m.bytesByType[n]??0)+d,m.totalBytes+=d,o[n]=(o[n]??0)+d}return{buckets:r,activeTypes:Object.keys(o).map(e=>parseInt(e,10)).filter(e=>o[e]>0).sort((e,t)=>o[t]-o[e]),totalByType:o}}(s,a,c),[s,a,c]),j=e.useCallback((e,t,s)=>{u(t),h(s)},[]),y=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!==x&&t.jsxs("div",{className:"absolute flex items-center gap-1.5 text-sm font-mono tabular-nums -translate-x-1/2",style:{left:`calc(48px + ${100*x}% * (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(Z,{className:"w-4 h-4 text-amber-400"}):t.jsx(ee,{className:"w-4 h-4 text-blue-400"})},N?"sun":"moon")}),t.jsx("span",{className:"text-text-secondary",children:k})]})}),t.jsx("div",{className:"flex-1 min-h-0",children:y&&t.jsx(r,{buckets:g,activeTypes:b,gridColor:d.grid,axisTickColor:d.axisTick,onHover:j})}),t.jsx("div",{className:"pt-2 px-1 pb-2 shrink-0",children:y&&t.jsx(o,{activeTypes:b,totalByType:v})})]})}const ze=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 r=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,o=Math.floor(t.height)||60,u=new c({width:a,height:o,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:r}=e.bbox;!function(e,t,s,a,n,l,i){if(0===t.length)return;const r=function(e,t,s){var a,n;if(e.length<=s)return e;const l=e.length/s,i=[];for(let r=0;r0&&(d.bytesByType[s]=(d.bytesByType[s]??0)+t)}}i.push(d)}return i}(t,s,m.statsCard),o=r.length,c=l/o,u=r.map(e=>e.totalBytes).filter(e=>e>0);if(0===u.length)return;const x=Math.max(...u),h=Math.min(...u),p=x-h;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 x.observe(e),()=>{x.disconnect(),u.destroy()}},[r,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-text-muted/15"})}):t.jsx("div",{ref:n,className:"w-full h-full"})});function Ee({value:s,receivedCount:a,packets:n,rangeMinutes:l,bucketCount:i,timeRangeLabel:r,icon:o,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,r=[];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=r[t];u.bytesByType[n]=(u.bytesByType[n]??0)+d,u.totalBytes+=d,o[n]=(o[n]??0)+d,c++}const d=t/60;return{buckets:r,activeTypes:Object.keys(o).map(e=>parseInt(e,10)).filter(e=>o[e]>0).sort((e,t)=>o[t]-o[e]),ratePerHour:d>0?Math.round(c/d):0}}(n,l,i),[n,l,i]),h=a>0?(s/a*100).toFixed(1):null;return c?t.jsxs("div",{className:"data-card flex flex-col relative",children:[t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[o&&t.jsx("span",{className:"icon-sm text-icon-card-title",children:o}),t.jsx("span",{className:"type-micro",children:"FORWARDED"}),r&&t.jsx(u,{color:"zinc",className:"hidden sm:inline-flex",children:r})]}),t.jsx("div",{className:"type-data-xl text-text-primary",children:t.jsx(se,{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(ze,{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-text-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!==h&&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:[h,"%"]})]})]})})]}):t.jsx("div",{className:"data-card flex flex-col relative",children:t.jsx(U,{})})}function Oe({value:s,receivedCount:a,packets:n,rangeMinutes:l,bucketCount:i,timeRangeLabel:r,icon:o,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,r=[];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=r[t];u.bytesByType[n]=(u.bytesByType[n]??0)+d,u.totalBytes+=d,o[n]=(o[n]??0)+d,c++}const d=t/60;return{buckets:r,activeTypes:Object.keys(o).map(e=>parseInt(e,10)).filter(e=>o[e]>0).sort((e,t)=>o[t]-o[e]),ratePerHour:d>0?Math.round(c/d):0}}(n,l,i),[n,l,i]),h=a>0?(s/a*100).toFixed(1):null;return c?t.jsxs("div",{className:"data-card flex flex-col relative",children:[t.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[o&&t.jsx("span",{className:"icon-sm text-icon-card-title",children:o}),t.jsx("span",{className:"type-micro",children:"DROPPED"}),r&&t.jsx(u,{color:"zinc",className:"hidden sm:inline-flex",children:r})]}),t.jsx("div",{className:"type-data-xl text-text-primary",children:t.jsx(se,{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(ze,{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-text-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!==h&&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:[h,"%"]})]})]})})]}):t.jsx("div",{className:"data-card flex flex-col relative",children:t.jsx(U,{})})}const qe={",":"punc",".":"punc-period",":":"punc-colon","/":"punc-slash"},We=/([,\.:\/])/g,Ge=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??""),We.test(e)?(We.lastIndex=0,e.split(We).map((e,s)=>{const a=qe[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})}),Ve=.2;function Ue(e,t=1){return Math.floor(5*t*e)}function Je(e){const t=Math.round(e/Ve)*Ve;return Math.max(0,Math.min(5,t))}function Ke({stats:s,receivedBuckets:a,droppedBuckets:n,forwardedBuckets:l,bucketDurationSeconds:i,timeRangeLabel:r,isLoaded:o=!0}){var c,d,m,p;const[f,g]=e.useState(!1);if(!o)return t.jsx("div",{className:"data-card flex flex-col relative",children:t.jsx(U,{})});const b=function(e,t,s,a,n){var l,i;const r=e=>(null==e?void 0:e.reduce((e,t)=>e+t.count,0))??0,o=r(t),c=r(s),d=r(a),m=o||(null==e?void 0:e.rx_count)||1,u=c||(null==e?void 0:e.dropped_count)||0,x=m>0?u/(m+u)*100:0;let h=0;if((null==a?void 0:a.length)&&n)h=100*d/(a.length*n*1e3)*100;else if(e){const t=1e3*(e.uptime_seconds||1);h=(e.total_airtime_ms||e.airtime_used_ms||0)/t*100}const p=(null==e?void 0:e.neighbors)??{},f=Object.values(p).filter(e=>e.zero_hop).length;let g=1;x<3?g-=Ve:x>15?g+=.4:x>10&&(g+=Ve),h>5&&(g+=Ve),f>10&&(g+=Ve);const b=Je(g),v=Je(.28*b),j=Ue(b),y=Ue(v),N=Ue((null==(i=null==(l=null==e?void 0:e.config)?void 0:l.delays)?void 0:i.tx_delay_factor)??1);return{floodFactor:b,directFactor:v,floodSlots:j,directSlots:y,adjustment:j>N?"increase":j{const e=`set txdelay ${b.floodFactor.toFixed(1)}\nset direct.txdelay ${b.directFactor.toFixed(1)}`;try{await navigator.clipboard.writeText(e),g(!0),setTimeout(()=>g(!1),1500)}catch(t){const s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();try{document.execCommand("copy"),g(!0),setTimeout(()=>g(!1),1500)}catch{}document.body.removeChild(s)}},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:"Click to copy CLI commands",children:[t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx("span",{className:"type-data-xl text-text-primary",children:t.jsxs(Ge,{children:["×",b.floodFactor.toFixed(1)]})}),t.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide 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-accent-primary",children:t.jsxs(Ge,{children:["×",b.directFactor.toFixed(1)]})}),t.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide 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:f?t.jsx(h,{className:"w-4 h-4 text-green-400"}):t.jsx(ue,{className:"w-4 h-4 text-text-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 "+(b.duplicateRate>10?"text-accent-warning":""),children:[b.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:[b.txUtilization.toFixed(2),"%"]})]})]})}),t.jsxs("div",{className:"pt-2 mt-2",children:[t.jsx("div",{className:"data-box-label",children:"Current"}),t.jsx("div",{className:"flex gap-2",children:null!==v?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"data-box",children:["×",v.toFixed(2)]}),t.jsxs("div",{className:"data-box",style:{color:"var(--accent-primary)"},children:["×",(null==j?void 0:j.toFixed(2))??"—"]})]}):t.jsx("span",{className:"text-sm text-text-muted",children:"No config"})})]})]})}function Xe(){const s=p(),a=f(),n=g(),l=b(),i=e.useMemo(()=>[...s.length<=100?s:s.slice(-100)].sort((e,t)=>(t.timestamp??0)-(e.timestamp??0)),[s]),r=null==l?void 0:l.local_hash,o=null==l?void 0:l.neighbors;return t.jsxs("div",{className:"chart-container h-full flex flex-col !overflow-visible",children:[t.jsxs("div",{className:"chart-header",children:[t.jsxs("div",{className:"chart-title",children:[t.jsx(v,{className:"chart-title-icon"}),"Recent Packets"]}),t.jsxs("div",{className:"flex items-center gap-3",children:[n&&t.jsx(j,{showLabel:!0}),t.jsxs(xe,{to:"/packets",className:"pill-subtle",children:["View all ",t.jsx(ie,{className:"w-3 h-3"})]})]})]}),t.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-1",children:t.jsx(re,{packets:i,allPackets:s,localHash:r,neighbors:o,loading:a,maxPackets:25,showPagination:!1,flashNewest:!0,emptyMessage:"No packets received",footerAction:t.jsxs(xe,{to:"/packets",className:"pill-subtle",children:["View all ",t.jsx(ie,{className:"w-3 h-3"})]})})})]})}const Qe={stable:"M5 12h14",up:"M5 15l7-7 7 7",down:"M19 9l-7 7-7-7"};function Ye({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:Qe[e]})})})}function Ze(){return t.jsx("div",{className:"mini-widget-loading",children:t.jsx("div",{className:"mini-widget-loading-spinner"})})}function et({message:e}){return t.jsx("div",{className:"mini-widget-error",children:t.jsx("span",{title:e,children:"No data"})})}function tt({title:e,icon:s,value:a,unit:n,valueSize:l="md",status:i,subtitle:r,trend:o,children:c,isLoading:d=!1,error:m,className:u="",onClick:x}){const h=["mini-widget-value","lg"===l&&"mini-widget-value-lg","sm"===l&&"mini-widget-value-sm"].filter(Boolean).join(" "),p=["mini-widget",x&&"cursor-pointer",u].filter(Boolean).join(" ");return t.jsxs("div",{className:p,onClick:x,role:x?"button":void 0,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}`}),o&&t.jsx(Ye,{trend:o})]}),d?t.jsx(Ze,{}):m?t.jsx(et,{message:m}):t.jsxs(t.Fragment,{children:[void 0!==a&&t.jsxs("div",{className:h,children:["number"==typeof a?t.jsx(se,{value:a,className:"font-mono tabular-nums",priority:"medium",format:Number.isInteger(a)?void 0:{minimumFractionDigits:1,maximumFractionDigits:1}}):t.jsx(Ge,{children:a}),n&&t.jsx("span",{className:"mini-widget-unit",children:n})]}),r&&t.jsx("div",{className:"mini-widget-subtitle",children:r}),c]})]})}const st={DELTA_CRITICAL:10,SLOPE_CRITICAL:4,JITTER_CRITICAL:6,DELTA_WARNING:5,SLOPE_WARNING:2,JITTER_WARNING:4},at={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 nt(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 lt(e){return nt(e,50)}function it(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 rt(e){return null!=e&&0!==e&&!Object.is(e,-0)&&!(e>-50||e<-130)}function ot(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 ct={lbtStats:null,noiseFloor:null,sparklineNoiseFloor:[],linkQuality:null,channelHealth:null,nfTrend:at,radioConfig:null,trends:null,stats:null,recentPackets:[],quickNeighbors:[],isLoading:!0,error:null,refresh:async()=>{}},dt=e.createContext(ct);function mt({children:s}){var a;const n=b(),l=p(),i=y(),r=N(),o=k(),c=w[o],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,r=l>0?i/l*100:0,o=n.filter(e=>(e.lbt_attempts??0)>1),c=o.length>0?o.reduce((e,t)=>e+(t.lbt_attempts??0),0)/o.length:0,d=n.filter(e=>(e.lbt_attempts??0)>=5).length,m=l>0?d/l*100:0,u=[];for(const j of n){const e=it(j.lbt_backoff_delays_ms);u.push(...e)}const x=u.reduce((e,t)=>e+t,0),h=u.length>0?x/u.length:0,p=u.length>0?Math.min(...u):0,f=u.length>0?Math.max(...u):0,g=s/24,b=[],v=[];for(let j=0;j<24;j++){const e=a+j*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,r=[];for(const a of s){const e=it(a.lbt_backoff_delays_ms);r.push(...e)}const o=r.length>0?r.reduce((e,t)=>e+t,0)/r.length:0;if(b.push(o),0===s.length)v.push(0);else{const e=s.filter(e=>(e.lbt_attempts??0)>=5).length,t=r.length>0?Math.max(...r):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;o>100&&(m=Math.min(8*Math.log10(o/100),15));let u=0;t>500&&o>0&&t>2*o&&(u=Math.min((t-500)/200,5));const x=l+d+m+u;v.push(Math.min(x*a,85))}}return{totalPacketsWithLBT:l,packetsWithRetries:i,retryRate:r,avgRetries:c,channelBusyCount:d,channelBusyRate:m,avgBackoffMs:h,minBackoffMs:p,maxBackoffMs:f,totalBackoffMs:x,sparklineBackoff:b,sparklineCollisionRisk:v,windowHours:t,packetCount:e.length}}(l,d),[l,d]),x=(null==n?void 0:n.noise_floor_dbm)??null,h=e.useMemo(()=>rt(x)?x:null,[x]),f=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]),[g,v]=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 M(Math.max(s,24));t.success&&(null==(e=t.data)?void 0:e.history)&&v(t.data.history)}catch{}}};e();const t=setInterval(e,6e4);return()=>clearInterval(t)},[d]);const C=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 r=0;r<24;r++){const t=n+r*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}(g,d),[g,d]),L=null==n?void 0:n.neighbors,S=e.useMemo(()=>{const e=L??{};return Object.fromEntries(Object.entries(e).filter(([e])=>!r.has(e)))},[L,r]),_=e.useMemo(()=>i.filter(e=>!r.has(e.hash)),[i,r]),B=e.useMemo(()=>function(e){if(0===e.length)return{...at,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=lt(s),i=nt(s,10),r=nt(s,90),o=lt(a),c=null!==o&&null!==i?o-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 o of e){const e=(o.timestamp-i)/3600,t=o.value;s+=e,a+=t,n+=e*t,l+=e*e}const r=t*l-s*s;return Math.abs(r)<1e-4?0:(t*n-s*a)/r}(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,[x,h]=u?function(e,t,s){const a=st;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:r,currentMedian:o,currentSampleCount:a.length,delta:c,slope:d,jitter:m,penalty:x,penaltyReason:h,computedAt:t,isReliable:u}}(C),[C]),T=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=pe(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}}(_,S,f),[_,S,f]),R=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 r;return r=i>=85?"excellent":i>=70?"good":i>=50?"fair":i>=30?"congested":"critical",{score:i,status:r,components:{lbtHealth:Math.round(a),noiseHealth:Math.round(n),linkHealth:Math.round(l)}}}(u,h,T),[u,h,T]),[F,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:h,networkScore:(null==T?void 0:T.networkScore)??null,channelHealth:(null==R?void 0:R.score)??null}))};e();const t=setInterval(e,5e3);return()=>clearInterval(t)},[h,null==T?void 0:T.networkScore,null==R?void 0:R.score]);const A=e.useMemo(()=>({noiseFloor:{current:h,previous:F.noiseFloor,trend:null!==h?ot(h,F.noiseFloor,2,!0):"stable"},networkScore:{current:(null==T?void 0:T.networkScore)??0,previous:F.networkScore,trend:ot((null==T?void 0:T.networkScore)??0,F.networkScore,3,!1)},channelHealth:{current:(null==R?void 0:R.score)??0,previous:F.channelHealth,trend:ot((null==R?void 0:R.score)??0,F.channelHealth,3,!1)}}),[h,null==T?void 0:T.networkScore,null==R?void 0:R.score,F]),P={lbtStats:u,noiseFloor:h,sparklineNoiseFloor:C,linkQuality:T,channelHealth:R,nfTrend:B,radioConfig:f,trends:A,stats:n,recentPackets:l,quickNeighbors:i,isLoading:m,error:null,refresh:async()=>{}};return t.jsx(dt.Provider,{value:P,children:s})}function ut(){const t=e.useContext(dt);if(void 0===t)throw new Error("useLBTData must be used within an LBTDataProvider");return t}function xt(e,t){return 0===e?"No backoffs":`${t.toFixed(0)}% retry rate`}function ht(){const{lbtStats:s,isLoading:a,error:n}=ut(),l=he(),i=(null==s?void 0:s.avgBackoffMs)??0,r=(null==s?void 0:s.retryRate)??0,o=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(tt,{title:"LBT Backoff",icon:t.jsx($e,{className:"mini-widget-icon"}),value:Math.round(i),unit:"ms",status:o,subtitle:s?xt(i,r):void 0,isLoading:a,error:n,onClick:()=>l("/packets"),children:t.jsx("div",{className:"mini-widget-sparkline w-full",children:t.jsx(fe,{data:m,width:9999,height:24,color:"var(--accent-primary)",isLoading:a,className:"w-full"})})})}function pt(e){return 0===e?"—":e<1?"<1":Math.round(e).toString()}function ft(){const{lbtStats:e,isLoading:s,error:a}=ut(),n=he(),l=(null==e?void 0:e.channelBusyCount)??0,i=(null==e?void 0:e.totalPacketsWithLBT)??0,r=(null==e?void 0:e.channelBusyRate)??0,o=(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=o>0?Math.max(0,(o-r)/o*100):100;return t.jsx(tt,{title:"Ch. Busy",icon:t.jsx(ae,{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)_auto_minmax(0,1fr)] gap-x-2 gap-y-2 w-full items-baseline",children:[t.jsx("span",{className:"data-box-label mb-0",title:`${l} packets exceeded max CAD attempts (5) out of ${i} total transmissions.`,children:"Failed:"}),t.jsxs("div",{className:"data-box justify-self-start",title:`${l} packets exceeded max CAD attempts (5) out of ${i} total transmissions.`,children:[t.jsx(Ge,{children:l}),t.jsx("span",{className:"text-text-muted punc-slash",children:"/"}),t.jsx(Ge,{children:i})]}),t.jsx("span",{className:"data-box-label mb-0",title:`${u.toFixed(1)}% of packets that needed LBT retries were sent successfully.`,children:"Sent:"}),t.jsx("div",{className:"data-box justify-self-start",title:`${u.toFixed(1)}% of packets that needed LBT retries were sent successfully.`,children:t.jsxs(Ge,{children:[u.toFixed(0),"%"]})}),t.jsx("span",{className:"data-box-label mb-0",title:`Average LBT backoff delay: ${c.toFixed(0)}ms.`,children:"Mean:"}),t.jsxs("div",{className:"data-box justify-self-start",title:`Average LBT backoff delay: ${c.toFixed(0)}ms.`,children:[t.jsx(Ge,{children:pt(c)}),t.jsx("span",{className:"text-text-muted text-xs",children:"ms"})]}),t.jsx("span",{className:"data-box-label mb-0",title:`Backoff range: ${d.toFixed(0)}ms min, ${m.toFixed(0)}ms max.`,children:"Range:"}),t.jsxs("div",{className:"data-box justify-self-start",title:`Backoff range: ${d.toFixed(0)}ms min, ${m.toFixed(0)}ms max.`,children:[t.jsx(Ge,{children:pt(d)}),t.jsx("span",{className:"text-text-muted punc-slash",children:"/"}),t.jsx(Ge,{children:pt(m)})]})]})})})}function gt(e){return null===e?"No reading":e<-115?"Very quiet":e<-105?"Quiet":e<-95?"Moderate":e<-85?"Elevated":"High interference"}function bt(){const{noiseFloor:s,sparklineNoiseFloor:a,trends:n,isLoading:l,error:i}=ut(),r=null===(o=s)||o<-110?"excellent":o<-100?"good":o<-90?"fair":o<-80?"congested":"critical";var o;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(tt,{title:"Noise Floor",icon:t.jsx(Fe,{className:"mini-widget-icon"}),value:m,unit:null!==s?"dBm":void 0,status:r,trend:c,subtitle:gt(s),isLoading:l,error:i,children:t.jsx("div",{className:"mini-widget-sparkline w-full",children:t.jsx(fe,{data:d,width:9999,height:24,color:"var(--accent-primary)",isLoading:l,className:"w-full"})})})}function vt(){const s=he(),a=y(),n=p(),l=b(),i=k(),r=60*w[i].minutes,o=C(),c=e.useMemo(()=>{if(0===o)return n;const e=o-r;return n.filter(t=>t.timestamp>=e)},[n,r,o]),d=null===l,m=(null==l?void 0:l.local_hash)?L(l.local_hash):"",u=(null==l?void 0:l.neighbors)??{},{neighborHashes:x,neighborNames:h}=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]),f=e.useMemo(()=>{if(0===x.size||0===c.length||!m)return{champion:null,listener:null,loudest:null};const{scores:e}=te(c,x,m),t=[];for(const[l,i]of e)0!==i.blendedScore&&t.push({...i,name:h.get(l)??L(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,x,m,h]),{champion:g,listener:v,loudest:j}=f,N=g||v||j?t.jsxs("div",{className:"flex flex-col gap-0.5 mt-auto",children:[g&&t.jsx(S,{content:(M=g,t.jsxs("div",{className:"max-w-[220px]",children:[t.jsxs("div",{className:"font-semibold mb-1",children:["🏆 Champion: ",M.name]}),t.jsxs("div",{className:"text-text-muted mb-1",children:["Blended Score: ",M.blendedScore,t.jsx("span",{className:"text-text-muted/60 ml-1",children:"(Listener + Loud)"})]}),t.jsxs("div",{className:"border-t border-border-subtle pt-1 mt-1 space-y-0.5",children:[t.jsxs("div",{children:["Listener: ",M.listenerScore,"/100 (",M.listenerCount," shared paths)"]}),t.jsxs("div",{children:["Loud: ",M.loudScore,"/100 (",M.loudCount," packets relayed)"]})]})]})),children:t.jsxs("div",{className:"flex items-center gap-1 text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx(oe,{className:"w-3 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:g.name}),t.jsx("span",{className:"text-map-neighbor-color pl-2 tabular-nums flex-shrink-0 w-9 text-right",children:g.blendedScore})]})}),v&&t.jsx(S,{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-text-muted mb-1",children:["Score: ",e.listenerScore,"/100"]}),t.jsx("div",{className:"border-t border-border-subtle pt-1 mt-1",children:t.jsxs("div",{children:[e.listenerCount," packets where they heard your transmissions"]})})]}))(v),children:t.jsxs("div",{className:"flex items-center gap-1 text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx(De,{className:"w-3 h-3 text-text-muted flex-shrink-0"}),t.jsx("span",{className:"text-text-muted font-mono truncate flex-1 min-w-0",children:v.name}),t.jsx("span",{className:"text-text-muted pl-2 tabular-nums flex-shrink-0 w-9 text-right",children:v.listenerScore})]})}),j&&t.jsx(S,{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-text-muted mb-1",children:["Score: ",e.loudScore,"/100"]}),t.jsx("div",{className:"border-t border-border-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-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[t.jsx(He,{className:"w-3 h-3 text-text-muted flex-shrink-0"}),t.jsx("span",{className:"text-text-muted font-mono truncate flex-1 min-w-0",children:j.name}),t.jsx("span",{className:"text-text-muted pl-2 tabular-nums flex-shrink-0 w-9 text-right",children:j.loudScore})]})})]}):0===a.length?t.jsx("div",{className:"flex items-center justify-center text-sm text-text-muted mt-auto",children:"No direct neighbors"}):t.jsx("div",{className:"flex items-center justify-center text-sm text-text-muted mt-auto",children:"No routing data yet"});var M;return t.jsx(tt,{title:"Link Leaders",icon:t.jsx(Ae,{className:"mini-widget-icon"}),isLoading:d,onClick:()=>s("/contacts"),children:N})}function jt(){const{lbtStats:s,isLoading:a,error:n}=ut(),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),r=Math.log(1+.15*t)/Math.log(16)*40,o=s/a*100,c=Math.min(.5*o,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=(r+c+d+m)*i;return Math.min(u,85)}(s):0,i=s?(r=l)<15?"excellent":r<30?"good":r<45?"fair":r<60?"congested":"critical":"unknown";var r;const o=(null==s?void 0:s.maxBackoffMs)??0,c=s?o>200?`Max backoff: ${Math.round(o)}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(tt,{title:"Collision Risk",icon:t.jsx(ge,{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(fe,{data:m,width:9999,height:24,color:"var(--accent-primary)",isLoading:a,className:"w-full"})})})}function yt(){const[s,a]=e.useState(!1),[n]=e.useState(0),{stats:l,lbtStats:i,isLoading:r}=ut(),o=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==o?void 0:o.utilizationPercent)??0,m=(u=d)<30?"excellent":u<50?"good":u<70?"fair":u<90?"congested":"critical";var u;const x=(null==o?void 0:o.remainingMs)??0,h=c<95?`${c.toFixed(0)}% clean TX`:((p=x)<1e3?`${Math.round(p)}ms`:p<6e4?`${(p/1e3).toFixed(1)}s`:`${(p/6e4).toFixed(1)}m`)+" remaining";var p;const f=o?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(tt,{title:"Duty Cycle",icon:t.jsx(v,{className:"mini-widget-icon"}),value:d.toFixed(1),unit:"%",status:m,subtitle:h,isLoading:r,children:f})}function Nt(){return t.jsxs("div",{className:"mini-widget",children:[t.jsxs("div",{className:"mini-widget-header",children:[t.jsx(J,{className:"w-4 h-4"}),t.jsx(J,{className:"h-3 w-16"})]}),t.jsx(J,{className:"h-7 w-12 mt-2"}),t.jsx(J,{className:"h-3 w-20 mt-2"})]})}function kt(){return t.jsx("div",{className:"widget-row",children:Array.from({length:6}).map((e,s)=>t.jsx(Nt,{},s))})}function wt({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(Pe,{className:"w-4 h-4 text-accent-primary"}),t.jsx("span",{className:"type-label text-text-muted",children:"MESH HEALTH"})]}),s?t.jsx(mt,{children:t.jsxs("div",{className:"widget-row",children:[t.jsx(ht,{}),t.jsx(jt,{}),t.jsx(bt,{}),t.jsx(yt,{}),t.jsx(ft,{}),t.jsx(vt,{})]})}):t.jsx(kt,{})]})}const Mt={sm:{button:"w-3 h-3",icon:"w-1.5 h-1.5",stroke:"ring-1"},md:{button:"w-3.5 h-3.5",icon:"w-2 h-2",stroke:"ring-1"},lg:{button:"w-4 h-4",icon:"w-2.5 h-2.5",stroke:"ring-[1.5px]"}},Ct=e.forwardRef(function({size:e="md",showIconOnHover:a=!0,className:n,...l},i){const r=Mt[e];return t.jsx("button",{ref:i,type:"button","aria-label":"Close",className:s("group relative inline-flex items-center justify-center rounded-full","transition-all duration-150 ease-out",r.button,"bg-[#FF5F57]",r.stroke,"ring-inset ring-[#E0443E]","hover:bg-[#FF6961]","active:bg-[#E04840] active:scale-95","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2","focus-visible:ring-[#FF5F57] focus-visible:ring-offset-bg-base",n),...l,children:a&&t.jsx("svg",{className:s(r.icon,"opacity-0 group-hover:opacity-100 transition-opacity duration-100","text-[#4A0000]"),fill:"none",viewBox:"0 0 10 10",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",children:t.jsx("path",{d:"M2.5 2.5L7.5 7.5M7.5 2.5L2.5 7.5"})})})});let Lt="",St="",_t="";function Bt(e){!function(){const e=new Date,t=e.toDateString();if(t!==_t){_t=t,Lt=t;const s=new Date(e);s.setDate(s.getDate()-1),St=s.toDateString()}}();const t=new Date(1e3*e).toDateString();return t===Lt?"Today":t===St?"Yesterday":new Date(1e3*e).toLocaleDateString([],{weekday:"short",month:"short",day:"numeric"})}function Tt(e,t,s){return`${e||""}|${t}|${s}`}const Rt=e.memo(function({message:e,onChannelClick:a,isChannelSelected:n}){const l=e.channelName||e.channelHash.slice(0,6);return t.jsx("div",{style:{transform:"translateZ(0)",willChange:"transform"},children:t.jsx(Me,{senderName:e.senderName||"Unknown",text:e.text,timestamp:e.timestamp,nameAccessory:t.jsx("button",{onClick:()=>null==a?void 0:a(e.channelHash),className:s("px-2 rounded text-[10px] font-medium flex-shrink-0","ring-1 ring-inset h-5 leading-5",n?"bg-accent-primary/20 text-accent-primary ring-accent-primary/30":"bg-subtle-fill text-text-secondary ring-border-subtle hover:bg-subtle-fill-strong"),children:l})})})},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 Ft({open:a,onClose:n,messages:l,onLoadMore:i,hasMoreToLoad:r,isDecoding:o}){const c=e.useRef(null),d=e.useRef(!0),m=k(),u=A(),x=e.useRef(!1);e.useEffect(()=>{a?(x.current=!0,P.resume()):x.current&&P.pause()},[a]);const h=e.useMemo(()=>{const e=Date.now()/1e3-60*w[m].minutes;return[...l].filter(t=>t.timestamp>=e).sort((e,t)=>e.timestamp-t.timestamp)},[l,m]),p=e.useCallback(()=>{const e=c.current;e&&(d.current=e.scrollTop>=-50)},[]),f=e.useMemo(()=>{const e=new Map;for(const t of h){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)},[h]),g=f.length,[b,v]=e.useState(null),[j,y]=e.useState(!1),N=e.useCallback(()=>{i(b,f)},[i,b,f]),M=e.useMemo(()=>b?h.filter(e=>e.channelHash===b):h,[h,b]),C=e.useMemo(()=>{const e=[];let t="";for(const s of M){const a=Bt(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=c.current;e&&d.current&&(e.scrollTop=0)},[M.length]);const L=f.slice(0,19),S=f.slice(19),_=S.length>0;return t.jsxs($,{open:a,onClose:n,size:"lg",motionPlus:!0,solid:!0,children:[t.jsx(Ct,{onClick:n,size:"md",style:{position:"absolute",top:12,right:12,zIndex:10}}),t.jsxs(I,{className:"p-0 flex flex-col h-[80vh] max-h-[700px] rounded-2xl",children:[t.jsx("div",{className:"flex-shrink-0 px-5 py-4 pr-12",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(je,{className:"size-5 text-icon-card-title flex-shrink-0"}),t.jsx("h2",{className:"text-base font-semibold text-text-primary",children:"Public Channels"})]}),t.jsx(ne,{ranges:w,selectedIndex:m,onSelect:u,size:"micro"})]})}),t.jsx("div",{className:"flex-shrink-0 px-3 pb-2 relative z-10 isolate",style:{minHeight:g>0?void 0:0},children:g>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-[10px] font-medium transition-all","ring-1 ring-inset",null===b?"bg-accent-primary/20 text-accent-primary ring-accent-primary/30":"bg-subtle-fill text-text-secondary ring-border-subtle hover:bg-subtle-fill-strong"),children:"All"}),L.map(e=>t.jsx("button",{onClick:()=>v(e.hash),className:s("flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-medium transition-all","ring-1 ring-inset",b===e.hash?"bg-accent-primary/20 text-accent-primary ring-accent-primary/30":"bg-subtle-fill text-text-secondary ring-border-subtle hover:bg-subtle-fill-strong"),children:t.jsx("span",{className:"truncate max-w-[80px]",children:e.name})},e.hash)),_&&t.jsxs("div",{className:"relative",children:[t.jsxs("button",{onClick:()=>y(!j),className:s("flex items-center gap-0.5 px-2 py-0.5 rounded text-[10px] font-medium transition-all","ring-1 ring-inset",j||S.some(e=>e.hash===b)?"bg-accent-primary/20 text-accent-primary ring-accent-primary/30":"bg-subtle-fill text-text-secondary ring-border-subtle hover:bg-subtle-fill-strong"),children:["+",S.length,t.jsx(z,{className:s("size-3 transition-transform",j&&"rotate-180")})]}),j&&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-bg-elevated backdrop-blur-xl","ring-1 ring-border-subtle shadow-xl"),children:S.map(e=>t.jsxs("button",{onClick:()=>{v(e.hash),y(!1)},className:s("w-full flex items-center gap-1.5 px-2 py-1 rounded text-[10px] font-medium transition-all text-left",b===e.hash?"bg-accent-primary/20 text-accent-primary":"text-text-secondary hover:bg-subtle-fill-strong"),children:[t.jsx(Le,{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:c,onScroll:p,className:s("flex-1 overflow-y-auto overflow-x-hidden","mx-3 mb-3 rounded-md","bg-bg-body","ring-1 ring-inset ring-border-subtle","flex flex-col-reverse"),children:o&&0===M.length?t.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[300px] text-text-muted px-4 py-4",children:[t.jsx(E,{className:"size-12 mb-4 text-accent-purple 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-text-muted px-4 py-4",children:[t.jsx(me,{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:b?"No messages in this channel":"Public channel messages will appear here"})]}):t.jsxs("div",{className:"px-4 py-4",children:[r&&t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("button",{onClick:N,disabled:o,className:s("px-4 py-1.5 rounded-full","text-[11px] font-medium","ring-1 ring-inset",o?"bg-subtle-fill text-text-muted ring-border-subtle cursor-wait":"bg-accent-primary/10 text-accent-primary ring-accent-primary/20 hover:bg-accent-primary/20 hover:ring-accent-primary/30"),children:o?t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx(E,{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-text-muted/80 font-medium","ring-1 ring-border-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(Rt,{message:e.message,onChannelClick:v,isChannelSelected:b===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-text-muted",children:[M.length," messages · ",g," ",1===g?"channel":"channels",o&&t.jsxs("span",{className:"ml-2 text-accent-purple",children:[t.jsx(E,{className:"inline size-3 animate-spin mr-1"}),"Decrypting..."]})]})})]})]})}function Dt({isLoaded:a=!0}){const n=p(),[r,o]=e.useState(!1),c=k(),d=e.useCallback(()=>{o(!0),_.getState().queueDecryption(n)},[n]),m=B(),u=T(),x=R(),h=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=Tt(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}(m),[m]),f=e.useMemo(()=>{const e=Date.now()/1e3-60*w[c].minutes;return h.filter(t=>t.timestamp>=e)},[h,c]),g=e.useMemo(()=>0===f.length?null:f.reduce((e,t)=>t.timestamp>e.timestamp?t:e),[f]),b=u.isDecoding,v=e.useMemo(()=>{const e=Date.now()/1e3-60*w[c].minutes,t=new Set;let s=0;for(const a of n)(a.type??a.payload_type)===F.GRP_TXT&&((a.timestamp??0){const e=Date.now()/1e3-60*w[c].minutes;for(const t of n)if((t.type??t.payload_type)===F.GRP_TXT&&!((t.timestamp??0){if(!b){if(e){const s=t.find(t=>t.hash===e);if(s)return void _.getState().queueChannelDecryption(n,s.name)}_.getState().queueDecryption(n)}},[n,b]);return a?t.jsxs(t.Fragment,{children:[t.jsx("div",{onClick:d,className:s("group cursor-pointer rounded-xl transition-all duration-150","ring-1 ring-inset ring-border-subtle hover:ring-accent-primary/50","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(je,{className:"size-4 text-icon-card-title flex-shrink-0"}),t.jsx("span",{className:"type-micro",children:"CHAT ACTIVITY"}),v>0&&t.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-subtle-fill ring-1 ring-inset ring-border-subtle text-sm tabular-nums text-text-secondary",children:v}),t.jsx(Ce,{className:"size-4 text-text-muted group-hover:text-accent-purple 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:g?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:[g.channelName&&t.jsxs("span",{className:"hidden sm:inline-flex items-center px-2 py-1 rounded-md bg-subtle-fill ring-1 ring-inset ring-border-subtle text-sm text-text-secondary flex-shrink-0",children:["#",g.channelName.replace(/^#/,"")]}),t.jsx("div",{className:"hidden sm:flex w-[30px] h-[30px] rounded-full items-center justify-center flex-shrink-0 ring-1 ring-border-subtle",style:{backgroundColor:ye(Ne(g.senderName||"").cleanName)},children:Ne(g.senderName||"").emoji?t.jsx("span",{className:"text-base",children:Ne(g.senderName||"").emoji}):t.jsx("span",{className:"text-white text-xs font-bold tracking-tighter",children:ke(g.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:we(g.text)})}),t.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-subtle-fill ring-1 ring-inset ring-border-subtle text-sm tabular-nums text-text-secondary flex-shrink-0",children:H(g.timestamp)})]},`msg-${g.timestamp}-${g.senderName}-${g.channelHash}`):x?t.jsx(i.span,{initial:{opacity:0},animate:{opacity:1},className:"text-sm text-text-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(Ce,{className:"size-4 text-text-muted group-hover:text-accent-purple transition-colors flex-shrink-0 hidden sm:block ml-1"})]})]})}),t.jsx(Ft,{open:r,onClose:()=>o(!1),messages:h,onLoadMore:N,hasMoreToLoad:y,isDecoding:b})]}):t.jsx("div",{className:"h-14 rounded-xl bg-bg-elevated/50 animate-pulse"})}function Ht(){var s,a;const n=b(),l=O(),i=p(),r=q(),o=e.useRef(!1);r&&!o.current&&(o.current=!0);const c=o.current,d=k(),m=A(),x=W(),h=w[d],f=5===d&&!x.threeDayLoadComplete,g=6===d&&!x.sevenDayLoadComplete,v=7===d&&!x.fourteenDayLoadComplete,j=x.isBackgroundLoading&&(f||g||v),y=null==(s=null==n?void 0:n.config)?void 0:s.radio,N=e.useMemo(()=>y?{sf:y.spreading_factor??10,bw:y.bandwidth??25e4,cr:y.coding_rate??5,preamble:y.preamble_length??8}:null,[y]),M=i.length,C=e.useMemo(()=>M?G(h.minutes,h.buckets,i,n):null,[M,h.minutes,h.buckets,N]),L=e.useMemo(()=>{const e=e=>(null==e?void 0:e.reduce((e,t)=>e+t.count,0))??0,t=e(null==C?void 0:C.received),s=e(null==C?void 0:C.unique_received),a=e(null==C?void 0:C.forwarded),n=e(null==C?void 0:C.dropped),l=e(null==C?void 0:C.transmitted),i=((null==C?void 0:C.time_range_minutes)??h.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}},[C,h.minutes]),S=e.useMemo(()=>{if(!i.length)return{totalBytes:0,kbPerHour:0};const e=Date.now()/1e3,t=e-60*h.minutes;let s=0;for(const n of i)n.transmitted||n.timestampe||(s+=n.length??n.payload_length??0);const a=h.minutes/60;return{totalBytes:s,kbPerHour:a>0?Math.round(s/1024/a):0}},[i,h.minutes]),_=(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(()=>{_&&"Unknown Node"!==_&&(document.title=`pyMC: ${_}`)},[_]),l?t.jsxs(K,{className:"p-8 text-center",children:[t.jsx("p",{className:"type-subheading text-accent-red mb-2",children:"Failed to connect to backend"}),t.jsx("p",{className:"type-body text-text-muted",children:l}),t.jsx("p",{className:"type-data-sm text-text-muted mt-4",children:"Make sure the backend is running on port 8000"})]}):t.jsxs(X,{children:[t.jsx(Q,{title:_,icon:t.jsx(Se,{}),controls:t.jsx(ne,{ranges:w,selectedIndex:d,onSelect:m,isPending:j})}),t.jsxs(Y,{children:[t.jsx(Dt,{isLoaded:c}),t.jsx(_e,{template:"hero-auto",children:t.jsxs(K,{compact:!0,children:[t.jsx(Te,{icon:t.jsx(V,{}),title:"PACKETS RECEIVED",badge:h.label,badgeColor:"zinc",actions:c?t.jsxs("div",{className:"data-box",children:[S.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-text-primary",children:c?t.jsx(se,{value:L.received,className:"font-mono tabular-nums",priority:"high"}):t.jsx("span",{className:"opacity-30",children:"—"})}),t.jsx(u,{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-text-primary",children:c?t.jsx(se,{value:L.uniqueReceived,className:"font-mono tabular-nums",priority:"high"}):t.jsx("span",{className:"opacity-30",children:"—"})}),t.jsx(u,{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(Ie,{packets:i,rangeMinutes:h.minutes,bucketCount:h.buckets})})]})]})}),t.jsxs(_e,{template:"compact",children:[t.jsx(Be,{span:6,lg:4,children:t.jsx(Ee,{value:L.forwarded,receivedCount:L.received,packets:i,rangeMinutes:h.minutes,bucketCount:h.buckets,timeRangeLabel:h.label,icon:t.jsx(Re,{className:"w-4 h-4"}),isLoaded:c})}),t.jsx(Be,{span:6,lg:4,children:t.jsx(Oe,{value:L.dropped,receivedCount:L.received,packets:i,rangeMinutes:h.minutes,bucketCount:h.buckets,timeRangeLabel:h.label,icon:t.jsx(be,{className:"w-4 h-4"}),isLoaded:c})}),t.jsx(Be,{span:12,lg:4,children:t.jsx(Ke,{stats:n,receivedBuckets:null==C?void 0:C.received,droppedBuckets:null==C?void 0:C.dropped,forwardedBuckets:null==C?void 0:C.forwarded,bucketDurationSeconds:null==C?void 0:C.bucket_duration_seconds,timeRangeLabel:h.label,isLoaded:c})})]}),t.jsx(wt,{isLoaded:c}),t.jsx(Xe,{}),n&&t.jsx(_e,{template:"auto",children:t.jsx(ve,{nodeName:_,repeaterVersion:n.version,coreVersion:n.core_version,localHash:n.local_hash,publicKey:n.public_key})})]})]})}export{Ht as default}; diff --git a/frontend/dist/assets/DataBox-BUgVf-3d.js b/frontend/dist/assets/DataBox-B4su-zzA.js similarity index 94% rename from frontend/dist/assets/DataBox-BUgVf-3d.js rename to frontend/dist/assets/DataBox-B4su-zzA.js index 853c1efb..3a6030f2 100644 --- a/frontend/dist/assets/DataBox-BUgVf-3d.js +++ b/frontend/dist/assets/DataBox-B4su-zzA.js @@ -1 +1 @@ -import{r as e,j as t,c as o}from"./vendor-react-j_fHog8x.js";import{f as n}from"./index-CImKXCRQ.js";import{C as s}from"./copy-CfZtRqCt.js";const c={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 a({children:a,copyValue:r,copy:i=!1,size:l="standard",className:p,title:u,color:d,truncate:m}){const[x,h]=e.useState(!1),[w,y]=e.useState(!1),f=e.useRef(null),v=r??("string"==typeof a?a:""),b=c[l],j=(()=>{if(!m||"string"!=typeof a)return a;const e=a,[t,o]=!0===m?[6,4]:m;return e.length<=t+o+3?e:`${e.slice(0,t)}…${e.slice(-o)}`})(),g=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),h(!0),f.current=setTimeout(()=>h(!1),2e3))},[i,v]),C="compact"===l?"data-box-compact":"responsive"===l?"data-box-responsive":"",N=i?u||`Click to copy: ${v}`:u;return i?t.jsxs("button",{type:"button",onClick:g,onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),className:o("data-box interactive",C,"cursor-pointer select-none gap-1","hover-bg",d,p),title:N,"aria-label":`Copy ${v}`,children:[t.jsx("span",{className:o("transition-colors duration-200",x?"text-accent-success":""),children:j}),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-accent-success",b)}):t.jsx(s,{className:o("transition-opacity duration-200",w?"opacity-70":"opacity-40",b)})})]}):t.jsx("span",{className:o("data-box",C,d,p),title:N,children:j})}export{a as D}; +import{r as e,j as t,c as o}from"./vendor-react-j_fHog8x.js";import{f as n}from"./index-B51aMfiH.js";import{C as s}from"./copy-jAVnwXtf.js";const c={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 a({children:a,copyValue:r,copy:i=!1,size:l="standard",className:p,title:u,color:d,truncate:m}){const[x,h]=e.useState(!1),[w,y]=e.useState(!1),f=e.useRef(null),v=r??("string"==typeof a?a:""),b=c[l],j=(()=>{if(!m||"string"!=typeof a)return a;const e=a,[t,o]=!0===m?[6,4]:m;return e.length<=t+o+3?e:`${e.slice(0,t)}…${e.slice(-o)}`})(),g=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),h(!0),f.current=setTimeout(()=>h(!1),2e3))},[i,v]),C="compact"===l?"data-box-compact":"responsive"===l?"data-box-responsive":"",N=i?u||`Click to copy: ${v}`:u;return i?t.jsxs("button",{type:"button",onClick:g,onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),className:o("data-box interactive",C,"cursor-pointer select-none gap-1","hover-bg",d,p),title:N,"aria-label":`Copy ${v}`,children:[t.jsx("span",{className:o("transition-colors duration-200",x?"text-accent-success":""),children:j}),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-accent-success",b)}):t.jsx(s,{className:o("transition-opacity duration-200",w?"opacity-70":"opacity-40",b)})})]}):t.jsx("span",{className:o("data-box",C,d,p),title:N,children:j})}export{a as D}; diff --git a/frontend/dist/assets/DeepAnalysisModal-C0GEcHVb.js b/frontend/dist/assets/DeepAnalysisModal-gcjnHw1P.js similarity index 97% rename from frontend/dist/assets/DeepAnalysisModal-C0GEcHVb.js rename to frontend/dist/assets/DeepAnalysisModal-gcjnHw1P.js index 8159d737..e4b2b848 100644 --- a/frontend/dist/assets/DeepAnalysisModal-C0GEcHVb.js +++ b/frontend/dist/assets/DeepAnalysisModal-gcjnHw1P.js @@ -1 +1 @@ -import{c as e,a3 as t,aA as n,dq as s,dr as a,K as i,ds as r,N as o,m as c,f as l,ax as m,Q as f}from"./index-CImKXCRQ.js";import{c as h,D as d}from"./geo-utils-qEuqoaud.js";import{r as u,j as g,c as p}from"./vendor-react-j_fHog8x.js";import{e as x,d as y}from"./config-CTM8_93T.js";import{G as b}from"./git-branch-CIWPjlTx.js";import{D as j}from"./database-1Jgt_gPe.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"}]]),M=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"}]]),k=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(n=>{n.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:y.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:y.medium,ease:x.easeIn}}};function z(e,t){let n=0;for(let s=0;s0)for(let n=0;nArray(t).fill(0));for(let s=0;sArray(t).fill(0));for(let o=0;o43758.5453*Math.sin(12.9898*t)%1-.5);D(i,n),V(i);let r=0;for(let o=0;o<100;o++){const e=E(a,i);D(e,n);const t=z(e,e)/z(i,e);if(V(e),i=e,Math.abs(t-r)<1e-8)return{vector:i,eigenvalue:s-t};r=t}return{vector:i,eigenvalue:s-r}}function $(e,t){if(e.length<2)return 0;const n=[];for(const r of e){const e=t.get(r);e&&n.push(e)}if(n.length<2)return 0;const s=Math.min(n.length,20),a=n.length<=s?n:function(e,t){if(t>=e.length)return e;const n=[],s=e.length/t;for(let a=0;ai.has(e.fromHash)&&i.has(e.toHash));if(0===r.length)return null;const o=function(e,t,n,s){const a=t.length,i=new Map(t.map((e,t)=>[e,t])),r=Array(a).fill(null).map(()=>Array(a).fill(0));for(const o of e){const e=i.get(o.fromHash),t=i.get(o.toHash);if(void 0!==e&&void 0!==t&&e!==t){const a=o.strength*o.certainCount;let i=1;if(n){const e=n.get(o.fromHash),t=n.get(o.toHash);e&&t&&(i=L(h(e[0],e[1],t[0],t[1])/1e3))}let c=1;if(s){const e=[o.fromHash,o.toHash].sort().join("-");c=1-.7*(s.get(e)??0)}const l=.3+.7*(o.symmetryRatio??0),m=Math.pow(a,.7)*Math.pow(i,.3)*c*l;r[e][t]=m,r[t][e]=m}}return r}(r,t,n,s),c=S(o),{vector:l,eigenvalue:m}=P(c);if(m<.001)return null;const f=[],d=[];for(let h=0;h({hash:e,community:0,fiedlerValue:0})),numCommunities:1,fiedlerValue:0,isConnected:a<=1};const i=[];let r=1/0;const o=[[t,0]];for(;o.length>0;){const[t,a]=o.shift();if((n?$(t,n):0)>20&&a<4&&t.length>=10){const i=q(e,t,n,s);if(i){r=Math.min(r,i.fiedlerValue),o.push([i.group0,a+1]),o.push([i.group1,a+1]);continue}}i.push(t)}const c=new Map,l=[],m=new Map;for(let f=0;f[e,t])),a=Array(n).fill(null).map(()=>Array(n).fill(0));for(const o of e){const e=s.get(o.fromHash),t=s.get(o.toHash);void 0!==e&&void 0!==t&&e!==t&&(a[e][t]=1,a[t][e]=1)}const i=S(a),{eigenvalue:r}=P(i);return Math.max(0,r)}function B(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 G({label:e,icon:t,status:n,detail:s}){return g.jsxs("div",{className:p("flex items-center gap-3 py-3 px-4 radius-inset transition-base","active"===n&&"bg-accent-primary/10","complete"===n&&"bg-accent-primary/10 ring-2 ring-inset ring-accent-primary","pending"===n&&"opacity-40"),children:[g.jsx("div",{className:p("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-all duration-300","active"===n&&"bg-accent-primary/20","complete"===n&&"bg-accent-primary/20","pending"===n&&"bg-subtle-fill"),children:"complete"===n?g.jsx(l,{className:"w-4 h-4 text-accent-primary"}):"active"===n?g.jsx(f,{className:"w-4 h-4 animate-spin text-accent-primary"}):g.jsx("span",{className:"text-text-muted",children:t})}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:p("text-sm font-medium transition-colors","active"===n&&"text-accent-primary","complete"===n&&"text-accent-primary","pending"===n&&"text-text-muted"),children:e}),s&&"pending"!==n&&g.jsx("div",{className:"text-xs text-text-muted mt-0.5 truncate",children:s})]})]})}const Q=u.memo(function({isOpen:e,onClose:t}){const{packetCacheState:f,triggerDeepAnalysis:h}=n(),p=s(),x=a(),y=f.packetCount,[v,M]=u.useState("fetching");u.useEffect(()=>{e&&h()},[e,h]),u.useEffect(()=>{if(e)if(f.isTopologyLoading)M("fetching");else if(p)M("analyzing"),setTimeout(()=>M("building"),500),setTimeout(()=>M("discovering"),1e3);else if(x>0&&!f.isTopologyLoading){M("complete");const e=setTimeout(()=>{t()},1500);return()=>clearTimeout(e)}},[e,f.isTopologyLoading,p,x,t]);const k="complete"===v,w=f.loadProgress,N=u.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"],n=t.indexOf(v),s=t.indexOf(e);return s{};return g.jsx(i,{open:e,onClose:A,size:"sm",bottomSheet:!1,children:g.jsx(r,{isLoading:!k,borderRadius:16,children:g.jsx(o,{className:"p-6 radius-card overflow-hidden",children:k?g.jsxs("div",{className:"flex flex-col items-center py-6",children:[g.jsx(c.div,{variants:H,initial:"hidden",animate:"visible",className:"w-16 h-16 rounded-full flex items-center justify-center mb-4 bg-accent-primary/20",children:g.jsx(l,{className:"w-8 h-8 text-accent-primary"})}),g.jsx("h3",{className:"text-lg font-semibold text-accent-primary",children:"Ready!"})]}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[g.jsx("div",{className:"w-10 h-10 radius-inset flex items-center justify-center bg-accent-primary/15",children:g.jsx(b,{className:"w-5 h-5 text-accent-primary"})}),g.jsxs("div",{children:[g.jsx("h3",{className:"text-base font-semibold text-text-primary",children:"Deep Analysis"}),g.jsx("p",{className:"text-xs text-text-muted",children:"Building mesh topology"})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsx(G,{label:"Fetching Packets",icon:g.jsx(d,{className:"w-4 h-4"}),status:C("fetching"),detail:N}),g.jsx(G,{label:"Analyzing Database",icon:g.jsx(j,{className:"w-4 h-4"}),status:C("analyzing"),detail:"Processing packet paths"}),g.jsx(G,{label:"Building Topology",icon:g.jsx(b,{className:"w-4 h-4"}),status:C("building"),detail:"Computing mesh edges"}),g.jsx(G,{label:"Discovering Nodes",icon:g.jsx(m,{className:"w-4 h-4"}),status:C("discovering"),detail:"Viterbi HMM ghost detection"})]}),g.jsx("p",{className:"text-xs text-text-muted text-center mt-5",children:"This may take a few seconds..."})]})})})})});export{Q as D,v as E,M as G,k as M,w as a,O as b,R as c,F as d,B as g,T as s,A as u}; +import{c as e,a3 as t,aA as n,dq as s,dr as a,K as i,ds as r,N as o,m as c,f as l,ax as m,Q as f}from"./index-B51aMfiH.js";import{c as h,D as d}from"./geo-utils-n2lfanuR.js";import{r as u,j as g,c as p}from"./vendor-react-j_fHog8x.js";import{e as x,d as y}from"./config-CTM8_93T.js";import{G as b}from"./git-branch-C_xw1lQX.js";import{D as j}from"./database-IcctMW15.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"}]]),M=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"}]]),k=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(n=>{n.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:y.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:y.medium,ease:x.easeIn}}};function z(e,t){let n=0;for(let s=0;s0)for(let n=0;nArray(t).fill(0));for(let s=0;sArray(t).fill(0));for(let o=0;o43758.5453*Math.sin(12.9898*t)%1-.5);D(i,n),V(i);let r=0;for(let o=0;o<100;o++){const e=E(a,i);D(e,n);const t=z(e,e)/z(i,e);if(V(e),i=e,Math.abs(t-r)<1e-8)return{vector:i,eigenvalue:s-t};r=t}return{vector:i,eigenvalue:s-r}}function $(e,t){if(e.length<2)return 0;const n=[];for(const r of e){const e=t.get(r);e&&n.push(e)}if(n.length<2)return 0;const s=Math.min(n.length,20),a=n.length<=s?n:function(e,t){if(t>=e.length)return e;const n=[],s=e.length/t;for(let a=0;ai.has(e.fromHash)&&i.has(e.toHash));if(0===r.length)return null;const o=function(e,t,n,s){const a=t.length,i=new Map(t.map((e,t)=>[e,t])),r=Array(a).fill(null).map(()=>Array(a).fill(0));for(const o of e){const e=i.get(o.fromHash),t=i.get(o.toHash);if(void 0!==e&&void 0!==t&&e!==t){const a=o.strength*o.certainCount;let i=1;if(n){const e=n.get(o.fromHash),t=n.get(o.toHash);e&&t&&(i=L(h(e[0],e[1],t[0],t[1])/1e3))}let c=1;if(s){const e=[o.fromHash,o.toHash].sort().join("-");c=1-.7*(s.get(e)??0)}const l=.3+.7*(o.symmetryRatio??0),m=Math.pow(a,.7)*Math.pow(i,.3)*c*l;r[e][t]=m,r[t][e]=m}}return r}(r,t,n,s),c=S(o),{vector:l,eigenvalue:m}=P(c);if(m<.001)return null;const f=[],d=[];for(let h=0;h({hash:e,community:0,fiedlerValue:0})),numCommunities:1,fiedlerValue:0,isConnected:a<=1};const i=[];let r=1/0;const o=[[t,0]];for(;o.length>0;){const[t,a]=o.shift();if((n?$(t,n):0)>20&&a<4&&t.length>=10){const i=q(e,t,n,s);if(i){r=Math.min(r,i.fiedlerValue),o.push([i.group0,a+1]),o.push([i.group1,a+1]);continue}}i.push(t)}const c=new Map,l=[],m=new Map;for(let f=0;f[e,t])),a=Array(n).fill(null).map(()=>Array(n).fill(0));for(const o of e){const e=s.get(o.fromHash),t=s.get(o.toHash);void 0!==e&&void 0!==t&&e!==t&&(a[e][t]=1,a[t][e]=1)}const i=S(a),{eigenvalue:r}=P(i);return Math.max(0,r)}function B(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 G({label:e,icon:t,status:n,detail:s}){return g.jsxs("div",{className:p("flex items-center gap-3 py-3 px-4 radius-inset transition-base","active"===n&&"bg-accent-primary/10","complete"===n&&"bg-accent-primary/10 ring-2 ring-inset ring-accent-primary","pending"===n&&"opacity-40"),children:[g.jsx("div",{className:p("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 transition-all duration-300","active"===n&&"bg-accent-primary/20","complete"===n&&"bg-accent-primary/20","pending"===n&&"bg-subtle-fill"),children:"complete"===n?g.jsx(l,{className:"w-4 h-4 text-accent-primary"}):"active"===n?g.jsx(f,{className:"w-4 h-4 animate-spin text-accent-primary"}):g.jsx("span",{className:"text-text-muted",children:t})}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:p("text-sm font-medium transition-colors","active"===n&&"text-accent-primary","complete"===n&&"text-accent-primary","pending"===n&&"text-text-muted"),children:e}),s&&"pending"!==n&&g.jsx("div",{className:"text-xs text-text-muted mt-0.5 truncate",children:s})]})]})}const Q=u.memo(function({isOpen:e,onClose:t}){const{packetCacheState:f,triggerDeepAnalysis:h}=n(),p=s(),x=a(),y=f.packetCount,[v,M]=u.useState("fetching");u.useEffect(()=>{e&&h()},[e,h]),u.useEffect(()=>{if(e)if(f.isTopologyLoading)M("fetching");else if(p)M("analyzing"),setTimeout(()=>M("building"),500),setTimeout(()=>M("discovering"),1e3);else if(x>0&&!f.isTopologyLoading){M("complete");const e=setTimeout(()=>{t()},1500);return()=>clearTimeout(e)}},[e,f.isTopologyLoading,p,x,t]);const k="complete"===v,w=f.loadProgress,N=u.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"],n=t.indexOf(v),s=t.indexOf(e);return s{};return g.jsx(i,{open:e,onClose:A,size:"sm",bottomSheet:!1,children:g.jsx(r,{isLoading:!k,borderRadius:16,children:g.jsx(o,{className:"p-6 radius-card overflow-hidden",children:k?g.jsxs("div",{className:"flex flex-col items-center py-6",children:[g.jsx(c.div,{variants:H,initial:"hidden",animate:"visible",className:"w-16 h-16 rounded-full flex items-center justify-center mb-4 bg-accent-primary/20",children:g.jsx(l,{className:"w-8 h-8 text-accent-primary"})}),g.jsx("h3",{className:"text-lg font-semibold text-accent-primary",children:"Ready!"})]}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[g.jsx("div",{className:"w-10 h-10 radius-inset flex items-center justify-center bg-accent-primary/15",children:g.jsx(b,{className:"w-5 h-5 text-accent-primary"})}),g.jsxs("div",{children:[g.jsx("h3",{className:"text-base font-semibold text-text-primary",children:"Deep Analysis"}),g.jsx("p",{className:"text-xs text-text-muted",children:"Building mesh topology"})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsx(G,{label:"Fetching Packets",icon:g.jsx(d,{className:"w-4 h-4"}),status:C("fetching"),detail:N}),g.jsx(G,{label:"Analyzing Database",icon:g.jsx(j,{className:"w-4 h-4"}),status:C("analyzing"),detail:"Processing packet paths"}),g.jsx(G,{label:"Building Topology",icon:g.jsx(b,{className:"w-4 h-4"}),status:C("building"),detail:"Computing mesh edges"}),g.jsx(G,{label:"Discovering Nodes",icon:g.jsx(m,{className:"w-4 h-4"}),status:C("discovering"),detail:"Viterbi HMM ghost detection"})]}),g.jsx("p",{className:"text-xs text-text-muted text-center mt-5",children:"This may take a few seconds..."})]})})})})});export{Q as D,v as E,M as G,k as M,w as a,O as b,R as c,F as d,B as g,T as s,A as u}; diff --git a/frontend/dist/assets/DelayedAnimateNumber-B6DSbUSU.js b/frontend/dist/assets/DelayedAnimateNumber-BXZBlojL.js similarity index 79% rename from frontend/dist/assets/DelayedAnimateNumber-B6DSbUSU.js rename to frontend/dist/assets/DelayedAnimateNumber-BXZBlojL.js index 9937161f..c76787b2 100644 --- a/frontend/dist/assets/DelayedAnimateNumber-B6DSbUSU.js +++ b/frontend/dist/assets/DelayedAnimateNumber-BXZBlojL.js @@ -1 +1 @@ -import{c as e}from"./index-CImKXCRQ.js";import{r as t,j as a}from"./vendor-react-j_fHog8x.js";import{A as s}from"./index-CGYcizrv.js";import{t as n}from"./config-CTM8_93T.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,f]=t.useState("waiting");if(t.useEffect(()=>{const e=setTimeout(()=>f("mounted"),400);return()=>clearTimeout(e)},[]),t.useEffect(()=>{if("mounted"===c){const e=requestAnimationFrame(()=>f("animating"));return()=>cancelAnimationFrame(e)}},[c]),"waiting"===c){const e=(0).toLocaleString(void 0,r);return a.jsxs("span",{className:o,style:m,children:[i,e]})}return a.jsx(s,{className:o,style:m,format:r,prefix:i,transition:n.numberReveal,children:"animating"===c?e:0})}export{i as D,r as H}; +import{c as e}from"./index-B51aMfiH.js";import{r as t,j as a}from"./vendor-react-j_fHog8x.js";import{A as s}from"./index-Ch_XDzqB.js";import{t as n}from"./config-CTM8_93T.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,f]=t.useState("waiting");if(t.useEffect(()=>{const e=setTimeout(()=>f("mounted"),400);return()=>clearTimeout(e)},[]),t.useEffect(()=>{if("mounted"===c){const e=requestAnimationFrame(()=>f("animating"));return()=>cancelAnimationFrame(e)}},[c]),"waiting"===c){const e=(0).toLocaleString(void 0,r);return a.jsxs("span",{className:o,style:m,children:[i,e]})}return a.jsx(s,{className:o,style:m,format:r,prefix:i,transition:n.numberReveal,children:"animating"===c?e:0})}export{i as D,r as H}; diff --git a/frontend/dist/assets/KeycapButton-DjJYg-26.js b/frontend/dist/assets/KeycapButton-edNKeR5-.js similarity index 97% rename from frontend/dist/assets/KeycapButton-DjJYg-26.js rename to frontend/dist/assets/KeycapButton-edNKeR5-.js index 373d33ce..63390c19 100644 --- a/frontend/dist/assets/KeycapButton-DjJYg-26.js +++ b/frontend/dist/assets/KeycapButton-edNKeR5-.js @@ -1 +1 @@ -import{c as e,ct as a}from"./index-CImKXCRQ.js";import{r as c,j as s}from"./vendor-react-j_fHog8x.js";const n=e("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"}]]);async function t(e){return a("/api/acl_remove_client",{method:"POST",body:JSON.stringify(e)})}async function o(){return a("/api/acl_stats")}const d={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"},r=Object.keys(d),f={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",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"};function l(e,a){const c=Array.from(e).map(e=>f[e.toUpperCase()]??f[e]??""),s=Math.max(0,(a??0)-e.length);for(let n=0;n{if(o)return;const a=l(e,t),c=6+2*(a.length-1);let s,n=0,d=!1;const f=()=>{d||(n++,n>=c?b(null):(b(a.map((e,a)=>n>=6+2*a?e:r.filter(()=>Math.random()>.45).join(""))),s=setTimeout(f,56)))};return f(),()=>{d=!0,clearTimeout(s)}},[e,t,o]);const u=l(e,t),p=i??u;return s.jsxs("span",{className:"seven-seg"+(f?` ${f}`:""),children:[p.map((e,c)=>((e,c)=>s.jsx("svg",{viewBox:"0 0 100 182",width:g,height:n,className:"seven-seg__char","aria-hidden":"true",children:r.map(c=>s.jsx("polygon",{points:d[c],fill:a,stroke:a,strokeWidth:4,strokeLinejoin:"round",opacity:e.includes(c)?1:.16},c))},c))(e,`${c}-${e}`)),s.jsx("span",{className:"sr-only",children:e})]})}function i({icon:e,onClick:a,title:n,iconColor:t="#000000",iconActiveColor:o="#FFDEB0",disabled:d=!1,className:r,keycapSrc:f="/assets/keycap.svg"}){const[l,g]=c.useState(!1),i=c.useCallback(()=>{d||g(!0)},[d]),b=c.useCallback(()=>{l&&(g(!1),a())},[l,a]),u=c.useCallback(()=>{g(!1)},[]);return s.jsx("button",{onMouseDown:i,onMouseUp:b,onMouseLeave:u,onTouchStart:i,onTouchEnd:b,onTouchCancel:u,disabled:d,className:`keycap-btn${l?" keycap-btn--pressed":""}${r?` ${r}`:""}`,title:n,children:s.jsxs("div",{className:"keycap-wrap",children:[s.jsx("img",{src:f,alt:"",className:"keycap-btn__img",draggable:!1}),s.jsx("span",{className:"keycap-icon-overlay",style:{color:l?o:t},children:e})]})})}export{n as F,i as K,g as S,o as g,t as r}; +import{c as e,ct as a}from"./index-B51aMfiH.js";import{r as c,j as s}from"./vendor-react-j_fHog8x.js";const n=e("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"}]]);async function t(e){return a("/api/acl_remove_client",{method:"POST",body:JSON.stringify(e)})}async function o(){return a("/api/acl_stats")}const d={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"},r=Object.keys(d),f={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",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"};function l(e,a){const c=Array.from(e).map(e=>f[e.toUpperCase()]??f[e]??""),s=Math.max(0,(a??0)-e.length);for(let n=0;n{if(o)return;const a=l(e,t),c=6+2*(a.length-1);let s,n=0,d=!1;const f=()=>{d||(n++,n>=c?b(null):(b(a.map((e,a)=>n>=6+2*a?e:r.filter(()=>Math.random()>.45).join(""))),s=setTimeout(f,56)))};return f(),()=>{d=!0,clearTimeout(s)}},[e,t,o]);const u=l(e,t),p=i??u;return s.jsxs("span",{className:"seven-seg"+(f?` ${f}`:""),children:[p.map((e,c)=>((e,c)=>s.jsx("svg",{viewBox:"0 0 100 182",width:g,height:n,className:"seven-seg__char","aria-hidden":"true",children:r.map(c=>s.jsx("polygon",{points:d[c],fill:a,stroke:a,strokeWidth:4,strokeLinejoin:"round",opacity:e.includes(c)?1:.16},c))},c))(e,`${c}-${e}`)),s.jsx("span",{className:"sr-only",children:e})]})}function i({icon:e,onClick:a,title:n,iconColor:t="#000000",iconActiveColor:o="#FFDEB0",disabled:d=!1,className:r,keycapSrc:f="/assets/keycap.svg"}){const[l,g]=c.useState(!1),i=c.useCallback(()=>{d||g(!0)},[d]),b=c.useCallback(()=>{l&&(g(!1),a())},[l,a]),u=c.useCallback(()=>{g(!1)},[]);return s.jsx("button",{onMouseDown:i,onMouseUp:b,onMouseLeave:u,onTouchStart:i,onTouchEnd:b,onTouchCancel:u,disabled:d,className:`keycap-btn${l?" keycap-btn--pressed":""}${r?` ${r}`:""}`,title:n,children:s.jsxs("div",{className:"keycap-wrap",children:[s.jsx("img",{src:f,alt:"",className:"keycap-btn__img",draggable:!1}),s.jsx("span",{className:"keycap-icon-overlay",style:{color:l?o:t},children:e})]})})}export{n as F,i as K,g as S,o as g,t as r}; diff --git a/frontend/dist/assets/Login-CEaQVZyH.js b/frontend/dist/assets/Login-DbpkJTe5.js similarity index 99% rename from frontend/dist/assets/Login-CEaQVZyH.js rename to frontend/dist/assets/Login-DbpkJTe5.js index a007fc98..ec4611cd 100644 --- a/frontend/dist/assets/Login-CEaQVZyH.js +++ b/frontend/dist/assets/Login-DbpkJTe5.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 r,l as n,m as l,P as o,I as c,C as d,A as m,B as C}from"./index-CImKXCRQ.js";import{s as h,a as x}from"./config-CTM8_93T.js";import{b as p}from"./vendor-core-CDNU4oKM.js";import"./maplibre-gl-b91ci4Kr.js";const L=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"})]})}),u="#9cf15b",f={container:{hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:h.normal,delayChildren:.1}}},item:{hidden:{opacity:0,y:12},visible:{opacity:1,y:0,transition:x.smooth}},footer:{hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{...x.gentle,delay:.4}}},error:{hidden:{opacity:0,height:0,marginTop:0},visible:{opacity:1,height:"auto",marginTop:24,transition:x.snappy},exit:{opacity:0,height:0,marginTop:0,transition:{duration:.15}}}},j=t("block font-mono text-xs font-medium uppercase tracking-wider text-text-secondary"),g=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"})]})}),v=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})}),y=()=>s.jsx("span",{className:"text-white/20 text-xs","aria-hidden":"true",children:"•"}),b=e.memo(function(){return s.jsx("div",{className:"fixed inset-0 -z-10",style:{backgroundColor:"#09090b"},"aria-hidden":"true"})}),N=e.memo(function(){return s.jsxs(l.footer,{variants:f.footer,initial:"hidden",animate:"visible",className:"fixed bottom-0 inset-x-0 px-4 py-6",children:[s.jsx("p",{className:"text-center font-mono text-[10px] uppercase tracking-widest 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(v,{href:"https://github.com/rightup/pyMC_Repeater",children:s.jsxs("span",{className:"font-mono text-sm font-semibold tracking-tight",children:[s.jsx("span",{style:{color:u},children:"py"}),s.jsx("span",{className:"text-white",children:"MC"})]})}),s.jsx(y,{}),s.jsx(v,{href:"https://meshcore.co.uk",children:s.jsx(L,{height:12,className:"text-white"})}),s.jsx(y,{}),s.jsxs(v,{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 w(){const t=p(),[h,x]=e.useState("admin"),[L,v]=e.useState(""),[y,w]=e.useState(a),[k,M]=e.useState(!1),[Z,S]=e.useState(null),T=h.length>0&&L.length>0&&!k;e.useEffect(()=>{i()&&t("/",{replace:!0})},[t]);const z=e.useCallback(()=>S(null),[]),R=e.useCallback(e=>{x(e.target.value),Z&&z()},[Z,z]),B=e.useCallback(e=>{v(e.target.value),Z&&z()},[Z,z]),F=e.useCallback(e=>{w(e),r(e)},[]),P=e.useCallback(async e=>{if(e.preventDefault(),!T)return;M(!0),S(null);const s=await n(h,L,y);M(!1),s.success?window.location.href="/":S(s.error??"Login failed")},[T,h,L,y]);return s.jsxs(s.Fragment,{children:[s.jsx(b,{}),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:f.container,initial:"hidden",animate:"visible",className:"w-full max-w-sm space-y-10",children:[s.jsx(l.div,{variants:f.item,className:"flex justify-center",children:s.jsx(o,{height:32})}),s.jsxs(l.form,{variants:f.item,onSubmit:P,className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("label",{htmlFor:"username",className:j,children:"Username"}),s.jsx("div",{className:"mt-2",children:s.jsx(c,{id:"username",name:"username",type:"text",value:h,onChange:R,required:!0,autoComplete:"username",autoFocus:!0,className:"font-mono text-sm font-semibold"})})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"password",className:j,children:"Password"}),s.jsx("div",{className:"mt-2",children:s.jsx(c,{id:"password",name:"password",type:"password",value:L,onChange:B,required:!0,autoComplete:"current-password",className:"font-mono text-sm font-semibold"})})]}),s.jsx(d,{checked:y,onChange:F,label:s.jsx("span",{className:"font-mono text-xs uppercase tracking-wider text-text-secondary",children:"Remember me"}),size:"sm"}),s.jsx(m,{mode:"wait",children:Z&&s.jsx(l.div,{variants:f.error,initial:"hidden",animate:"visible",exit:"exit",role:"alert",className:"rounded-md bg-accent-danger/10 p-3 overflow-hidden",children:s.jsx("p",{className:"text-sm text-accent-danger text-center",children:Z})},"error")}),s.jsx(l.div,{whileTap:T?{scale:.98}:void 0,children:s.jsx(C,{type:"submit",disabled:!T,className:"w-full font-mono text-sm font-semibold uppercase tracking-wide text-black shadow-sm",style:{backgroundColor:u},onMouseEnter:e=>e.currentTarget.style.backgroundColor="#8de04a",onMouseLeave:e=>e.currentTarget.style.backgroundColor=u,children:k?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(g,{className:"size-4"}),"Signing in…"]}):"Sign in"})})]}),s.jsxs(l.p,{variants:f.item,className:"text-center text-sm/6 text-text-muted",children:["A ",s.jsx("span",{style:{color:u},children:"@RightUp"})," X"," ",s.jsx("span",{style:{color:u},children:"@Treehouse⚡"})," Collab"]})]})}),s.jsx(N,{})]})}export{w 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 r,l as n,m as l,P as o,I as c,C as d,A as m,B as C}from"./index-B51aMfiH.js";import{s as h,a as x}from"./config-CTM8_93T.js";import{b as p}from"./vendor-core-CDNU4oKM.js";import"./maplibre-gl-b91ci4Kr.js";const L=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"})]})}),u="#9cf15b",f={container:{hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:h.normal,delayChildren:.1}}},item:{hidden:{opacity:0,y:12},visible:{opacity:1,y:0,transition:x.smooth}},footer:{hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{...x.gentle,delay:.4}}},error:{hidden:{opacity:0,height:0,marginTop:0},visible:{opacity:1,height:"auto",marginTop:24,transition:x.snappy},exit:{opacity:0,height:0,marginTop:0,transition:{duration:.15}}}},j=t("block font-mono text-xs font-medium uppercase tracking-wider text-text-secondary"),g=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"})]})}),v=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})}),y=()=>s.jsx("span",{className:"text-white/20 text-xs","aria-hidden":"true",children:"•"}),b=e.memo(function(){return s.jsx("div",{className:"fixed inset-0 -z-10",style:{backgroundColor:"#09090b"},"aria-hidden":"true"})}),N=e.memo(function(){return s.jsxs(l.footer,{variants:f.footer,initial:"hidden",animate:"visible",className:"fixed bottom-0 inset-x-0 px-4 py-6",children:[s.jsx("p",{className:"text-center font-mono text-[10px] uppercase tracking-widest 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(v,{href:"https://github.com/rightup/pyMC_Repeater",children:s.jsxs("span",{className:"font-mono text-sm font-semibold tracking-tight",children:[s.jsx("span",{style:{color:u},children:"py"}),s.jsx("span",{className:"text-white",children:"MC"})]})}),s.jsx(y,{}),s.jsx(v,{href:"https://meshcore.co.uk",children:s.jsx(L,{height:12,className:"text-white"})}),s.jsx(y,{}),s.jsxs(v,{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 w(){const t=p(),[h,x]=e.useState("admin"),[L,v]=e.useState(""),[y,w]=e.useState(a),[k,M]=e.useState(!1),[Z,S]=e.useState(null),T=h.length>0&&L.length>0&&!k;e.useEffect(()=>{i()&&t("/",{replace:!0})},[t]);const z=e.useCallback(()=>S(null),[]),R=e.useCallback(e=>{x(e.target.value),Z&&z()},[Z,z]),B=e.useCallback(e=>{v(e.target.value),Z&&z()},[Z,z]),F=e.useCallback(e=>{w(e),r(e)},[]),P=e.useCallback(async e=>{if(e.preventDefault(),!T)return;M(!0),S(null);const s=await n(h,L,y);M(!1),s.success?window.location.href="/":S(s.error??"Login failed")},[T,h,L,y]);return s.jsxs(s.Fragment,{children:[s.jsx(b,{}),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:f.container,initial:"hidden",animate:"visible",className:"w-full max-w-sm space-y-10",children:[s.jsx(l.div,{variants:f.item,className:"flex justify-center",children:s.jsx(o,{height:32})}),s.jsxs(l.form,{variants:f.item,onSubmit:P,className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("label",{htmlFor:"username",className:j,children:"Username"}),s.jsx("div",{className:"mt-2",children:s.jsx(c,{id:"username",name:"username",type:"text",value:h,onChange:R,required:!0,autoComplete:"username",autoFocus:!0,className:"font-mono text-sm font-semibold"})})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"password",className:j,children:"Password"}),s.jsx("div",{className:"mt-2",children:s.jsx(c,{id:"password",name:"password",type:"password",value:L,onChange:B,required:!0,autoComplete:"current-password",className:"font-mono text-sm font-semibold"})})]}),s.jsx(d,{checked:y,onChange:F,label:s.jsx("span",{className:"font-mono text-xs uppercase tracking-wider text-text-secondary",children:"Remember me"}),size:"sm"}),s.jsx(m,{mode:"wait",children:Z&&s.jsx(l.div,{variants:f.error,initial:"hidden",animate:"visible",exit:"exit",role:"alert",className:"rounded-md bg-accent-danger/10 p-3 overflow-hidden",children:s.jsx("p",{className:"text-sm text-accent-danger text-center",children:Z})},"error")}),s.jsx(l.div,{whileTap:T?{scale:.98}:void 0,children:s.jsx(C,{type:"submit",disabled:!T,className:"w-full font-mono text-sm font-semibold uppercase tracking-wide text-black shadow-sm",style:{backgroundColor:u},onMouseEnter:e=>e.currentTarget.style.backgroundColor="#8de04a",onMouseLeave:e=>e.currentTarget.style.backgroundColor=u,children:k?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(g,{className:"size-4"}),"Signing in…"]}):"Sign in"})})]}),s.jsxs(l.p,{variants:f.item,className:"text-center text-sm/6 text-text-muted",children:["A ",s.jsx("span",{style:{color:u},children:"@RightUp"})," X"," ",s.jsx("span",{style:{color:u},children:"@Treehouse⚡"})," Collab"]})]})}),s.jsx(N,{})]})}export{w as default}; diff --git a/frontend/dist/assets/Logs-CX6fCEhO.js b/frontend/dist/assets/Logs-ClX8uzox.js similarity index 92% rename from frontend/dist/assets/Logs-CX6fCEhO.js rename to frontend/dist/assets/Logs-ClX8uzox.js index 06f6a94c..6dc3ab7c 100644 --- a/frontend/dist/assets/Logs-CX6fCEhO.js +++ b/frontend/dist/assets/Logs-ClX8uzox.js @@ -1 +1 @@ -import{r as s,j as e,c as a}from"./vendor-react-j_fHog8x.js";import{c as t,bo as l,bp as r,k as c,bq as i,br as o,bs as n,B as m,bg as x,bd as d,bt as p}from"./index-CImKXCRQ.js";import{u as h}from"./usePolling-B1kG3uqm.js";import{P as g,b as j,B as u,a as y,L as b}from"./PageLayout-CBx7rIBL.js";import{C as f}from"./Card-DfIcRbRE.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CDNU4oKM.js";const N=t("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"}]]),v=t("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-text-primary break-words whitespace-pre-wrap",children:s.message}),e.jsx("p",{className:"type-data-xs text-text-muted mt-1",children:new Date(s.timestamp).toLocaleString()})]})]})})});function k({showDebug:s,onToggle:t}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:a("type-data-sm",s?"text-accent-tertiary":"text-accent-primary"),children:s?"DEBUG":"INFO"}),e.jsx(d,{enabled:s,onChange:t,size:"sm"})]})}function C(){const t=l(),d=r(),p=c(),C=i(),D=o(),[L,P]=s.useState(!1),B=s.useCallback(()=>{P(s=>!s)},[]),z=L?t:t.filter(s=>"DEBUG"!==s.level);return h(C,x.logs,p),e.jsxs(g,{children:[e.jsx(j,{title:"System Logs",icon:e.jsx(n,{}),controls:e.jsx(k,{showDebug:L,onToggle:B})}),e.jsx(u,{children:e.jsxs(y,{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(v,{"data-slot":"icon",className:"!w-5 !h-5"}):e.jsx(N,{"data-slot":"icon",className:"!w-5 !h-5"})})}),e.jsx("div",{className:"space-y-2 max-h-[calc(100vh-300px)] sm:max-h-[calc(100vh-250px)] overflow-y-auto p-4",children:d&&0===t.length?e.jsx(b,{count:10}):0===z.length?e.jsx("div",{className:"text-center py-12 text-text-muted",children:0===t.length?"No logs available":"No logs match selected filters"}):z.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 t,bo as l,bp as r,k as c,bq as i,br as o,bs as n,B as m,bg as x,bd as d,bt as p}from"./index-B51aMfiH.js";import{u as h}from"./usePolling-B1kG3uqm.js";import{P as g,b as j,B as u,a as y,L as b}from"./PageLayout-DUXmuiZg.js";import{C as f}from"./Card-BC0izdLh.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CDNU4oKM.js";const N=t("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"}]]),v=t("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-text-primary break-words whitespace-pre-wrap",children:s.message}),e.jsx("p",{className:"type-data-xs text-text-muted mt-1",children:new Date(s.timestamp).toLocaleString()})]})]})})});function k({showDebug:s,onToggle:t}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:a("type-data-sm",s?"text-accent-tertiary":"text-accent-primary"),children:s?"DEBUG":"INFO"}),e.jsx(d,{enabled:s,onChange:t,size:"sm"})]})}function C(){const t=l(),d=r(),p=c(),C=i(),D=o(),[L,P]=s.useState(!1),B=s.useCallback(()=>{P(s=>!s)},[]),z=L?t:t.filter(s=>"DEBUG"!==s.level);return h(C,x.logs,p),e.jsxs(g,{children:[e.jsx(j,{title:"System Logs",icon:e.jsx(n,{}),controls:e.jsx(k,{showDebug:L,onToggle:B})}),e.jsx(u,{children:e.jsxs(y,{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(v,{"data-slot":"icon",className:"!w-5 !h-5"}):e.jsx(N,{"data-slot":"icon",className:"!w-5 !h-5"})})}),e.jsx("div",{className:"space-y-2 max-h-[calc(100vh-300px)] sm:max-h-[calc(100vh-250px)] overflow-y-auto p-4",children:d&&0===t.length?e.jsx(b,{count:10}):0===z.length?e.jsx("div",{className:"text-center py-12 text-text-muted",children:0===t.length?"No logs available":"No logs match selected filters"}):z.map((s,a)=>e.jsx(w,{log:s},`${s.timestamp}-${a}`))})]})})]})}export{C as default}; diff --git a/frontend/dist/assets/MeshGraph-DCyLnsQa.js b/frontend/dist/assets/MeshGraph-Duci9p1U.js similarity index 99% rename from frontend/dist/assets/MeshGraph-DCyLnsQa.js rename to frontend/dist/assets/MeshGraph-Duci9p1U.js index bc724282..97666e2a 100644 --- a/frontend/dist/assets/MeshGraph-DCyLnsQa.js +++ b/frontend/dist/assets/MeshGraph-Duci9p1U.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 r,Z as o}from"./vendor-react-j_fHog8x.js";import{c as l,b3 as c,b4 as d,b5 as u,A as x,m,M as h,a0 as p,aE as g,b6 as f,b7 as v,aX as b,b8 as y,b9 as j,av as N,n as w,aT as C,r as k,aY as S,e as D,T as F,ba as L,bb as R,R as M,bc as B,O as H,Q as A,bd as E,be as P,B as z,bf as T,aA as $}from"./index-CImKXCRQ.js";import{u as I,G,M as O,c as Z,E as W,a as V,D as K,s as _}from"./DeepAnalysisModal-C0GEcHVb.js";import{D as U}from"./DataBox-BUgVf-3d.js";import{h as q,c as X,D as Y}from"./geo-utils-qEuqoaud.js";import{E as Q,a as J,S as ee,T as te}from"./target-BLCR6B60.js";import{L as se}from"./layers-CTDI7uhn.js";import{S as ne}from"./settings-2-C32u1U6g.js";import{C as ae}from"./chevron-right-DZcqArkG.js";import{N as ie}from"./network-CY6CQ8MF.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CDNU4oKM.js";import"./config-CTM8_93T.js";import"./git-branch-CIWPjlTx.js";import"./database-1Jgt_gPe.js";import"./copy-CfZtRqCt.js";const re=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"}]]),oe=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"}]]),le=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"}]]),ce=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"}]]),de=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 ue(e){if(null==e)return"";const t=String(e);return t.includes(",")||t.includes('"')||t.includes("\n")?`"${t.replace(/"/g,'""')}"`:t}function xe(e,t){const s=[e.join(",")];for(const n of t)s.push(n.map(ue).join(","));return s.join("\n")}function me(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function he(e){return!e||e<=0?"":new Date(1e3*e).toISOString()}function pe(e,t){return`${e}-${(new Date).toISOString().replace(/[:.]/g,"-").slice(0,19)}.${t}`}const ge=["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 fe(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,he(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 ve(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 be=["fromHash","toHash","key","packetCount","certainCount","avgConfidence","strength","forwardCount","reverseCount","symmetryRatio","dominantDirection","floodCount","directCount","isDirectPathEdge","isZeroHop","isLoopEdge","isCertain","avgRssi","avgSnr","avgRecency","hopDistanceFromLocal","edgeBetweenness","isBackbone"];function ye(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 je=["pathKey","hops","hopCount","healthScore","weakestLinkKey","weakestLinkConfidence","avgEdgeCertainty","observationTrend","alternatePathsCount","estimatedLatencyMs","observationCount","routeType","lastSeen","involvesHub"];function Ne(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,he(e.lastSeen),e.involvesHub]}const we=["nodeHash","nodePrefix","nodeName","networkRole","floodFactor","directFactor","floodSlots","directSlots","trafficIntensity","directNeighborCount","collisionRisk","confidence","adjustment","dataConfidence","observationSymmetry","rationale"];function Ce(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 ke(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 r of e.nodeMetrics.values()){if(!t&&r.isGhost)continue;const e=me(r.name??r.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!=r.avgRssi&&i.push(` `),null!=r.avgSnr&&i.push(` `),i.push(" "),null==r.latitude||null==r.longitude||0===r.latitude&&0===r.longitude||i.push(` `),i.push(" ")}i.push(" "),i.push(""),i.push(" ");for(const r of e.validatedEdges){const o=e.nodeMetrics;if(!t&&((null==(s=o.get(r.fromHash))?void 0:s.isGhost)||(null==(n=o.get(r.toHash))?void 0:n.isGhost)))continue;const l=e.edgeBetweenness.get(r.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 Se(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:ve(e,t),edges:ye(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 De(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(fe(n));return xe(ge,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 xe(be,a)}(e,n),i="mesh-edges";break;case"pathHealth":a=function(e){const t=e.pathHealth.map(Ne);return xe(je,t)}(e),i="mesh-path-health";break;case"txDelay":a=function(e){const t=[];for(const[s,n]of e.txDelayRecommendations)t.push(Ce(s,n,e.nodeMetrics));return xe(we,t)}(e),i="mesh-tx-delay"}return{content:a,filename:pe(i,"csv"),mimeType:"text/csv"}}case"gexf":return{content:ke(e,s),filename:pe("mesh-topology","gexf"),mimeType:"application/xml"};default:return{content:Se(e,s,n),filename:pe("mesh-topology","json"),mimeType:"application/json"}}}function Fe(e,t,s=1){const{n:n,adjList:a,totalWeight:i,degree:r}=e;if(0===i)return!1;const o=2*i,l=new Float64Array(n);for(let u=0;up+1e-7&&(p=a,h=e)}h!==n&&(l[n]-=u,l[h]+=u,t[e]=h,d=!0,c=!0)}}return c}function Le(e,t){const{n:s,adjList:n}=e,a=new Set;for(let m=0;me-t),r=new Map;for(let m=0;m[]);for(const[m,h]of c){const[e,t]=m.split("-").map(Number),s=h/2;x[e].push({j:t,w:s}),x[t].push({j:e,w:s}),d[e]+=s,d[t]+=s,u+=s}return{newGraph:{n:o,adjList:x,totalWeight:u,degree:Array.from(d)},mapping:l}}function Re(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:r}=function(e,t,s=1){const n=t.length,a=new Map;for(let l=0;l[]),r=new Array(n).fill(0);let o=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}),r[e]+=c,r[t]+=c,o+=c}return{graph:{n:n,adjList:i,totalWeight:o,degree:r},hashToIdx:a}}(e,t,a);let o=r,l=new Int32Array(i);for(let v=0;v=o.n)break;o=e,l=new Int32Array(e.n);for(let s=0;se-t),h=new Map;for(let v=0;v=20?"excellent":e>=10?"good":e>=3?"fair":e>=0?"marginal":"critical"}function Te(e){return e>=15?"anomalous-good":e>=5?"better":e>=-5?"expected":e>=-20?"worse":"anomalous-bad"}function $e(e,t,s,n,a){const i=n.tx_power??22,r=n.spreading_factor??12,o=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,x=(null==a?void 0:a.sensitivityOverrideDbm)??Ee(r,u,o);let m=null,h=null;t&&s&&q(t.latitude??void 0,t.longitude??void 0)&&q(s.latitude??void 0,s.longitude??void 0)&&(m=X(t.latitude,t.longitude,s.latitude,s.longitude),h=m/1e3);let p=null,g=null;null!=m&&m>0&&(p=Ae(m,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=Te(b));let j=null,N=null;null!=f&&(j=f-x,N=ze(j));const w=null!=f,C="anomalous-good"===y||"anomalous-bad"===y;return{edgeKey:e.key,fromHash:e.fromHash,toHash:e.toHash,distanceM:m,distanceKm:h,fsplDb:p,theoreticalRxPowerDbm:g,observedRssiDbm:f,observedSnrDb:v,deviationDb:b,deviationClass:y,marginDb:j,marginClass:N,sensitivityDbm:x,txPowerDbm:i,frequencyMhz:c,spreadingFactor:r,bandwidthKhz:u,noiseFloorDbm:null,isZeroHop:e.isZeroHop??!1,isTraceEstimated:!1,hasData:w,isAnomalous:C}}function Ie(e,t,s,n,a=22,i){const r=e.traceQuality;if(!r)return null;let o=null;if(o=null!=r.forwardSnr&&null!=r.reverseSnr?Math.min(r.forwardSnr,r.reverseSnr):r.forwardSnr??r.reverseSnr,null==o)return null;const l=n.spreading_factor??12,c=n.coding_rate??5,d=n.bandwidth??0,u=d>1e3?d/1e3:d||125,x=1e3*u,m=n.frequency??0,h=m>1e5?m/1e6:m||915,p=(null==i?void 0:i.sensitivityOverrideDbm)??Ee(l,u,c),g=(null==i?void 0:i.observedNoiseFloorDbm)??Pe(x),f=g+o;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=X(t.latitude,t.longitude,s.latitude,s.longitude),b=v/1e3);let y=null,j=null;null!=v&&v>0&&(y=Ae(v,h),j=a+2.15+2.15-y);let N=null,w=null;null!=j&&(N=f-j,w=Te(N));const C=f-p,k=ze(C);return{edgeKey:e.key,fromHash:e.fromHash,toHash:e.toHash,distanceM:v,distanceKm:b,fsplDb:y,theoreticalRxPowerDbm:j,observedRssiDbm:f,observedSnrDb:o,deviationDb:N,deviationClass:w,marginDb:C,marginClass:k,sensitivityDbm:p,noiseFloorDbm:g,txPowerDbm:a,frequencyMhz:h,spreadingFactor:l,bandwidthKhz:u,isZeroHop:!1,isTraceEstimated:!0,hasData:!0,isAnomalous:"anomalous-good"===w||"anomalous-bad"===w}}const Ge={"anomalous-good":"#2DD4BF",better:"#34D399",expected:"#9CA3AF",worse:"#FB923C","anomalous-bad":"#EF4444"},Oe={excellent:"#34D399",good:"#A3E635",fair:"#FBBF24",marginal:"#FB923C",critical:"#EF4444"};function Ze(e,t="margin"){return e.hasData?"deviation"===t?e.deviationClass?Ge[e.deviationClass]:"#505058":e.marginClass?Oe[e.marginClass]:"#505058":"#505058"}function We(e,t=.5,s=4){return null==e.marginDb?t:t+Math.max(0,Math.min(1,e.marginDb/40))*(s-t)}let Ve=0;function Ke(){return`ta-${++Ve}-${Date.now()}`}function _e(e){return{standard:0,ghost:1,mobile:2,neighbor:3,backbone:4,gateway:5,hub:6,local:7}[e]??0}class Ue{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 o of e.edges)t.add(o.key);const s=new Map,n=new Map,a=new Map,i=new Set;for(const[o,l]of e.nodeMetrics)s.set(o,l.betweenness),n.set(o,l.communityId),a.set(o,l.nodeClass),i.add(o);const r=new Set;for(const o of e.discoveredNodes)o.isLikelyReal&&r.add(o.prefix);return{timestamp:Date.now(),edgeKeys:t,betweenness:s,communities:n,nodeClasses:a,ghostPrefixes:r,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)),r=i(t)??(null==t?void 0:t.slice(0,6));a.push({id:Ke(),detectedAt:n,category:"edge-appeared",severity:"info",description:`New edge: ${s} ↔ ${r}`,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)),r=i(t)??(null==t?void 0:t.slice(0,6));a.push({id:Ke(),detectedAt:n,category:"edge-disappeared",severity:"warning",description:`Edge lost: ${s} ↔ ${r}`,edgeKey:d})}for(const d of t.nodeHashes)if(!e.nodeHashes.has(d)){const e=i(d);a.push({id:Ke(),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:Ke(),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:Ke(),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:Ke(),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),r=u>t?"increased":"decreased";a.push({id:Ke(),detectedAt:n,category:"betweenness-shift",severity:s>=.3?"critical":"warning",description:`${e??d.slice(0,8)} betweenness ${r}: ${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:Ke(),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=_e(u)>_e(t);a.push({id:Ke(),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 r={},o={},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)r[d]=0;for(const d of c)o[d]=0;for(const d of a)r[d.category]++,o[d.severity]++;return a.sort((e,t)=>t.detectedAt-e.detectedAt),{anomalies:a,categoryCounts:r,severityCounts:o,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("-"),r=t[0],o=t[1],l=r?null==n?void 0:n.get(r):void 0,c=o?null==n?void 0:n.get(o):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=qe(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 qe(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 Xe(e){if(e.length<2)return 0;const t=e.length;let s=0,n=0,a=0,i=0;for(let o=0;o.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 r=0;0===e.alternatePathsCount?(r=1,n.push({name:"No alternate paths",description:"Single route to destination — no failover available",score:r,weight:.2})):1===e.alternatePathsCount&&(r=.5,n.push({name:"Limited redundancy",description:"Only 1 alternate path available",score:r,weight:.2}));let o=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?(o=1,n.push({name:"Signal near sensitivity",description:`Weakest link: ${e.toFixed(1)} dB margin (< 3 dB)`,score:o,weight:Ye})):e<10&&(o=1-(e-3)/7,n.push({name:"Low signal margin",description:`Weakest link: ${e.toFixed(1)} dB margin`,score:o,weight:Ye}))}}const l=.35*a+.3*i+.2*r+o*Ye;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 Je=100;function et(){return++Je}const tt="meshgraph-panel-";function st(e){try{const t=localStorage.getItem(tt+e);return t?JSON.parse(t):null}catch{return null}}function nt({id:e,title:t,icon:a,open:i,onClose:r,defaultPosition:o,defaultSize:l,minSize:c={width:180,height:120},maxSize:d,autoHeight:u=!1,headerActions:g,children:f}){const v=I(),b=s.useRef(null),y=s.useRef(null),j=s.useMemo(()=>{const t=st(e);return t?{x:t.x,y:t.y,w:t.w,h:u?l.height:t.h,minimized:t.minimized}:{x:o.x,y:o.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,D]=s.useState(()=>et()),[F,L]=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=st(e),a=(r=(null==n?void 0:n.x)??j.x,o=(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(r,Math.max(8,c-l-8))),y:Math.max(8,Math.min(o,Math.max(8,d-36)))});var r,o,l,c,d;L(a)},[i,e]);const[R,M]=s.useState(!1),B=s.useRef({startX:0,startY:0,startW:0,startH:0,edge:""}),H=s.useRef(),A=s.useCallback(()=>{H.current&&clearTimeout(H.current),H.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(tt+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(()=>{A()},[N,C,A]);const E=s.useCallback(()=>{D(et())},[]),P=s.useCallback(()=>{k(e=>!e)},[]),z=s.useCallback((e,t)=>{e.preventDefault(),e.stopPropagation(),M(!0),B.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}=B.current,r=e.clientX-t,o=e.clientY-s;let l=n,u=a;"e"!==i&&"se"!==i||(l=Math.max(c.width,n+r),d&&(l=Math.min(d.width,l))),"s"!==i&&"se"!==i||(u=Math.max(c.height,a+o),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(x,{children:i&&n.jsxs(m.div,{ref:y,drag:!R,dragControls:v,dragConstraints:b,dragElastic:.05,dragMomentum:!1,dragListener:!1,initial:{opacity:0,scale:.96,x:F.x,y:F.y},animate:{opacity:1,scale:1,x:F.x,y:F.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-border-subtle cursor-grab active:cursor-grabbing select-none shrink-0",onPointerDown:e=>{E(),v.start(e)},children:[n.jsx(G,{className:"w-3 h-3 text-text-muted/50 shrink-0"}),a&&n.jsx("span",{className:"text-text-muted shrink-0 [&>svg]:w-3 [&>svg]:h-3",children:a}),n.jsx("span",{className:"text-[11px] font-medium text-text-primary flex-1 truncate",children:t}),g,n.jsx("button",{onClick:P,className:"p-0.5 radius-badge hover-bg transition-base",title:C?"Expand":"Minimize",children:C?n.jsx(O,{className:"w-2.5 h-2.5 text-text-muted"}):n.jsx(h,{className:"w-2.5 h-2.5 text-text-muted"})}),n.jsx("button",{onClick:r,className:"p-0.5 radius-badge hover-bg transition-base",title:"Close",children:n.jsx(p,{className:"w-2.5 h-2.5 text-text-muted"})})]}),n.jsx(x,{initial:!1,children:!C&&n.jsx(m.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=>z(e,"e")}),n.jsx("div",{className:"absolute -bottom-1 left-0 w-full h-2 cursor-ns-resize",onPointerDown:e=>z(e,"s")}),n.jsx("div",{className:"absolute -bottom-1 -right-1 w-3 h-3 cursor-nwse-resize",onPointerDown:e=>z(e,"se"),children:n.jsxs("svg",{className:"w-full h-full text-text-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 at=800,it={critical:["#EF4444","#DC2626"],poor:["#F97316","#EA580C"],fair:["#FBBF24","#D97706"],good:["#34D399","#059669"],excellent:["#60A5FA","#2563EB"]},rt={active:1,recent:.85,stale:.45,inactive:.25},ot=["#A78BFA","#34D399","#FBBF24","#F87171","#60A5FA","#F472B6","#2DD4BF","#FB923C"],lt=["#7C3AED","#059669","#D97706","#DC2626","#2563EB","#DB2777","#0D9488","#EA580C"],ct={zeroHop:"#C8A850",directPath:"#70A8AA",loop:"#9888B0",backbone:"#B0B0B8",standard:"#707078",standardDim:"#505058",ghost:"#606068"},dt={zeroHop:"#A08030",directPath:"#308080",loop:"#685898",backbone:"#404048",standard:"#909098",standardDim:"#B0B0B8",ghost:"#A0A0A8"},ut=!1,xt=!0,mt=!0,ht=!0,pt=!0,gt=!0,ft={local:"#FFB224",hub:"#A78BFA",gateway:"#60A5FA",backbone:"#34D399",neighbor:"#F472B6",mobile:"#FB923C",ghost:"#A1A1AA",standard:"#D4D4D8"},vt={local:"#FFB224",hub:"#7C3AED",gateway:"#2563EB",backbone:"#059669",neighbor:"#DB2777",mobile:"#EA580C",ghost:"#71717A",standard:"#52525B"},bt={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 yt(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 jt(e,t,s){const[n,a,i]=yt(e),[r,o,l]=yt(t),c=Math.max(0,Math.min(1,s)),d=Math.round(n*c+r*(1-c)),u=Math.round(a*c+o*(1-c)),x=Math.round(i*c+l*(1-c));return`#${d.toString(16).padStart(2,"0")}${u.toString(16).padStart(2,"0")}${x.toString(16).padStart(2,"0")}`}function Nt(e,t){return e.isZeroHop?"zero-hop":e.isDirectPathEdge?"direct-path":e.isLoopEdge?"loop":t.has(e.key)?"backbone":"standard"}function wt(e,t,s){const n=s?ct:dt;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 Ct={"zero-hop":"Zero-Hop (Direct RF)","direct-path":"Direct Path (Unicast)",loop:"Redundant Loop",backbone:"Backbone",standard:"Standard",ghost:"Ghost (Inferred)"},kt={"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"},St=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),[r,o]=e.snrRange,l=Math.max(1,o-r),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-r)/l);return`${s.toFixed(1)},${n.toFixed(1)}`}).join(" "),x=e.rssiTrend>.1?"↑":e.rssiTrend<-.1?"↓":"→",m=e.snrTrend>.1?"↑":e.snrTrend<-.1?"↓":"→",h=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],r=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||r>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-border-subtle/50",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx(F,{content:n.jsxs("div",{className:"max-w-xs space-y-1.5",children:[n.jsx("div",{className:"font-semibold text-text-primary",children:"Signal Quality Over Time"}),n.jsx("div",{className:"text-text-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-border-subtle/30 space-y-0.5 font-mono text-[10px]",children:[n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Samples"}),n.jsx("span",{className:"text-text-primary tabular-nums",children:e.totalSamples})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Time span"}),n.jsxs("span",{className:"text-text-primary tabular-nums",children:[g,"h"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Avg RSSI"}),n.jsxs("span",{className:"text-text-primary tabular-nums",children:[e.avgRssi.toFixed(1)," dBm"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Avg SNR"}),n.jsxs("span",{className:"text-text-primary tabular-nums",children:[e.avgSnr.toFixed(1)," dB"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"RSSI trend"}),n.jsxs("span",{className:"tabular-nums",style:{color:h},children:[e.rssiTrend>0?"+":"",e.rssiTrend.toFixed(3)," dBm/bucket"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-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-text-muted italic",children:["Trend is linear regression slope across ",t.length," time buckets. ↑ = improving, ↓ = degrading, → = stable."]})]}),children:n.jsx("span",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Signal Timeline"})}),n.jsxs("span",{className:"text-[9px] text-text-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-text-muted",children:"RSSI"}),n.jsx("span",{className:"tabular-nums",style:{color:h},children:x})]}),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-text-muted",children:"SNR"}),n.jsx("span",{className:"tabular-nums",style:{color:p},children:m})]})]}),n.jsxs("div",{className:"flex items-center gap-2 text-text-muted tabular-nums",children:[n.jsxs("span",{children:[s.toFixed(0),"…",a.toFixed(0)," dBm"]}),n.jsxs("span",{children:[r.toFixed(0),"…",o.toFixed(0)," dB"]})]})]}),n.jsx("div",{className:"mt-1 text-[9px] leading-tight",style:{color:f.color},children:f.text})]})}),Dt=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=$.getState().packets,s=$.getState().cachedLocalHash??void 0,n=function(e,t,s,n,a=24){const i=function(e,t,s,n){var a;const i=[],r=t.replace(/^0x/i,"").slice(0,2).toLowerCase();for(const o of e){if(o.transmitted)continue;if(null==o.rssi||null==o.snr)continue;if(0===o.rssi&&0===o.snr)continue;const e=(null==(a=o.src_hash)?void 0:a.replace(/^0x/i,""))??"";if(e.slice(0,2).toLowerCase()!==r&&e!==t.replace(/^0x/i,""))continue;const s=o.original_path??o.forwarded_path??[],l=d(s,n),c=(null==l?void 0:l.effectiveLength)??0,x=o.route??o.route_type;let m=!1;m=null!=x&&u(x)?c<=1:0===c,m&&i.push({timestamp:1e3*o.timestamp,rssi:o.rssi,snr:o.snr})}if(i.sort((e,t)=>e.timestamp-t.timestamp),i.length>0&&i[0].timestamp<4102444800)for(const o of i)o.timestamp*=1e3;return i}(e,t,0,n);if(i.length<3)return null;const r=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 o=0;o0&&(o.avgRssi/=o.count,o.avgSnr/=o.count,r.push(o));return r}(i,a);if(r.length<2)return null;let o=0,l=0,c=1/0,x=-1/0,m=1/0,h=-1/0;for(const d of i)o+=d.rssi,l+=d.snr,c=Math.min(c,d.rssi),x=Math.max(x,d.rssi),m=Math.min(m,d.snr),h=Math.max(h,d.snr);const p=Xe(r.map(e=>e.avgRssi)),g=Xe(r.map(e=>e.avgSnr)),f=i[0].timestamp,v=i[i.length-1].timestamp;return{buckets:r,totalSamples:i.length,rssiRange:[c,x],snrRange:[m,h],avgRssi:o/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(m.div,{variants:_,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-border-subtle/50",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(re,{className:"size-3.5 text-text-muted shrink-0"}),n.jsxs("span",{className:"text-sm font-semibold text-text-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(D,{color:"zinc",compact:!0,children:Ct[e.edgeType]}),e.isBackbone&&n.jsx(D,{color:"emerald",compact:!0,children:"BONE"}),e.isLoopEdge&&n.jsx(D,{color:"purple",compact:!0,children:"LOOP"}),e.isGhost&&n.jsx(D,{color:"zinc",compact:!0,children:"GHOST"})]})]}),n.jsx(z,{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(F,{content:"Average disambiguation confidence across all observations of this edge",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Confidence"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[(100*e.confidence).toFixed(0),"%"]})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Observations where both endpoints had high-confidence disambiguation",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Certain"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.certainCount.toLocaleString()})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Total packets observed traversing this edge",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Packets"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.packetCount.toLocaleString()})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Combined certainCount × confidence metric for edge ranking",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Strength"})}),n.jsx("div",{className:"text-text-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(F,{content:"Bidirectional balance (min/max) — 0 = one-way traffic, 1 = perfectly balanced",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Symmetry"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.symmetryRatio.toFixed(2)})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Dominant traffic flow direction between these nodes",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Direction"})}),n.jsx("div",{className:"text-text-primary capitalize",children:e.dominantDirection})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Forward (A→B) vs reverse (B→A) observation counts",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Fwd / Rev"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[e.forwardCount," / ",e.reverseCount]})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Routing method — broadcast flood vs unicast direct routing",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Flood / Direct"})}),n.jsxs("div",{className:"text-text-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-border-subtle/50",children:[null!=e.avgRssi&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-muted uppercase",children:"RSSI"}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[e.avgRssi.toFixed(1)," dBm"]})]}),null!=e.avgSnr&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-muted uppercase",children:"SNR"}),n.jsxs("div",{className:"text-text-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-border-subtle/50",children:[null!=e.linkBudget.distanceKm&&n.jsxs("div",{children:[n.jsx(F,{content:"Haversine distance between endpoint locations",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Distance"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[e.linkBudget.distanceKm.toFixed(2)," km"]})]}),null!=e.linkBudget.fsplDb&&n.jsxs("div",{children:[n.jsx(F,{content:"Free Space Path Loss — theoretical signal attenuation over this distance at configured frequency",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"FSPL"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[e.linkBudget.fsplDb.toFixed(1)," dB"]})]}),null!=e.linkBudget.marginDb&&n.jsxs("div",{children:[n.jsx(F,{content:"Link margin — observed RSSI minus receiver sensitivity. Positive = signal headroom above minimum.",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Margin"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",style:{color:e.linkBudget.marginClass?Oe[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(F,{content:"Deviation from theoretical FSPL — positive means better signal than free-space prediction",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"vs Theory"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[e.linkBudget.deviationDb>0?"+":"",e.linkBudget.deviationDb.toFixed(1)," dB"]})]})]}),a&&n.jsx(St,{timeline:a})]})]})}),Ft=s.memo(function({node:e,onClose:t,egoMetrics:a,onExpandEgo:i,neighbors:r,onSelectNeighbor:o}){const[l,c]=s.useState(!1);return n.jsxs(m.div,{variants:_,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-border-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:(P()?ft:vt)[e.nodeClass]}}),n.jsx("code",{className:"text-sm font-semibold text-text-primary shrink-0",children:e.prefix}),e.name&&n.jsx("span",{className:"text-sm text-text-secondary truncate",children:e.name}),n.jsxs("div",{className:"flex gap-1 shrink-0",children:[e.isLocal&&n.jsx(D,{color:"yellow",compact:!0,children:"LOCAL"}),e.isHub&&n.jsx(D,{color:"violet",compact:!0,children:"HUB"}),e.isGateway&&n.jsx(D,{color:"sky",compact:!0,children:"GW"}),e.isBackbone&&n.jsx(D,{color:"emerald",compact:!0,children:"BONE"}),e.isMobile&&n.jsx(D,{color:"orange",compact:!0,children:"MOB"}),e.isZeroHop&&n.jsx(D,{color:"amber",compact:!0,children:"RF"}),e.isGhost&&n.jsx(D,{color:"zinc",compact:!0,children:"GHOST"}),e.isInLoop&&n.jsx(D,{color:"purple",compact:!0,children:"LOOP"})]})]}),n.jsx(z,{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(U,{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(F,{content:"Total connections (edges) to this node",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Degree"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.degree})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Inbound vs outbound edge count — indicates traffic directionality",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"In / Out"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[e.inDegree," / ",e.outDegree]})]}),n.jsxs("div",{children:[n.jsx(F,{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-text-muted uppercase cursor-help",children:"Between."})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.betweenness.toFixed(3)})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Total packets observed involving this node",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Packets"})}),n.jsx("div",{className:"text-text-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(F,{content:"Number of topology edges connected to this node",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Edges"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.edgeCount})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Community cluster assignment from graph partitioning algorithm",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Community"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:["#",e.communityId]})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Prefix disambiguation confidence — how certain the 2-char prefix→node mapping is (multi-factor scoring)",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Confidence"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[(100*e.prefixConfidence).toFixed(0),"%"]})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Recency level — active (<1h), recent (<6h), stale (<24h), inactive (>24h)",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Activity"})}),n.jsx("div",{className:"text-text-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-border-subtle/50",children:[null!=e.avgRssi&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-muted uppercase",children:"RSSI"}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[e.avgRssi.toFixed(1)," dBm"]})]}),null!=e.avgSnr&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-muted uppercase",children:"SNR"}),n.jsxs("div",{className:"text-text-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-border-subtle/50",children:[n.jsxs("div",{children:[n.jsx(F,{content:"Number of direct 1-hop neighbors in the topology",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Ego Size"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:a.neighborCount})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Local clustering coefficient — how interconnected this node's neighbors are (0 = none, 1 = fully connected)",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Clustering"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:a.clusteringCoeff.toFixed(3)})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Average betweenness centrality of this node's direct neighbors",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Avg Nbr Btw."})}),n.jsx("div",{className:"text-text-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(F,{content:"Average disambiguation confidence across all connected edges",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Edge Conf."})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[(100*a.avgEdgeConfidence).toFixed(0),"%"]})]}),null!=a.avgRssi&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-muted uppercase",children:"Avg RSSI"}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[a.avgRssi.toFixed(1)," dBm"]})]}),null!=a.avgSnr&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-muted uppercase",children:"Avg SNR"}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[a.avgSnr.toFixed(1)," dB"]})]})]})]}),i&&n.jsx("div",{className:"mt-2 pt-2 border-t border-border-subtle/50",children:n.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 text-[10px] text-accent-primary hover:text-accent-primary/80 transition-base",children:[n.jsx(T,{className:"w-3 h-3"}),"Expand 2-hop neighborhood"]})}),r&&r.length>0&&n.jsxs("div",{className:"mt-2 pt-2 border-t border-border-subtle/50",children:[n.jsxs("button",{onClick:()=>c(e=>!e),className:"flex items-center justify-between w-full text-[9px] text-text-muted uppercase tracking-wide cursor-pointer hover:text-text-secondary transition-base",children:[n.jsxs("span",{children:["Neighbors (",r.length,")"]}),n.jsx(H,{className:"w-3 h-3 transition-transform "+(l?"rotate-180":"")})]}),l&&n.jsx("div",{className:"mt-1.5 max-h-32 overflow-y-auto space-y-0.5",children:r.map(e=>n.jsxs("button",{onClick:()=>null==o?void 0:o(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-accent-primary shrink-0 tabular-nums",children:e.prefix}),n.jsx("span",{className:"text-[10px] text-text-secondary truncate flex-1",children:e.name||"—"}),null!=e.avgSnr&&n.jsxs("span",{className:"text-[9px] text-text-muted tabular-nums shrink-0",children:[e.avgSnr.toFixed(0)," dB"]}),null!=e.avgRssi&&n.jsx("span",{className:"text-[9px] text-text-muted tabular-nums shrink-0",children:e.avgRssi.toFixed(0)}),n.jsxs("span",{className:"text-[9px] text-text-muted/60 tabular-nums shrink-0",children:[(100*e.edgeConfidence).toFixed(0),"%"]})]},e.hash))})]})]})]})}),Lt=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(m.div,{variants:_,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-border-subtle/50",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(ce,{className:"size-3.5 text-text-muted shrink-0"}),n.jsx("span",{className:"text-sm font-semibold text-text-primary",children:"Subgraph Analysis"}),n.jsxs(D,{color:"violet",compact:!0,children:[e.nodeCount," nodes"]})]}),n.jsx(z,{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-text-muted uppercase",children:"Nodes"}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.nodeCount})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Edges where both endpoints are within the lasso selection",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Internal Edges"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.edgeCount})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Mean betweenness centrality of selected nodes",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Avg Between."})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.avgBetweenness.toFixed(3)})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Mean edge disambiguation confidence for internal edges",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Avg Confidence"})}),n.jsxs("div",{className:"text-text-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-border-subtle/50",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-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-text-secondary",children:["#",e,"×",t]},e))})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-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-text-secondary capitalize",children:[e,"×",t]},e))})]})]}),e.nodeCount>1&&n.jsx("div",{className:"mt-2 pt-2 border-t border-border-subtle/50",children:n.jsxs("div",{className:"text-[9px] text-text-muted flex items-center gap-1 flex-wrap",children:[n.jsx(F,{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(F,{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(F,{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 Rt(){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(ie,{className:"w-8 h-8 text-text-muted"})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h2",{className:"type-subheading text-text-primary",children:"No Topology Data"}),n.jsx("p",{className:"type-body text-text-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-text-muted",children:[n.jsx(M,{className:"w-4 h-4 animate-pulse"}),n.jsx("span",{children:"Waiting for mesh traffic..."})]})]})}const Mt=s.memo(function({label:e,value:t,onChange:a,min:i,max:r,step:o}){const[l,c]=s.useState(!1),[d,u]=s.useState(""),x=s.useRef(null),m=s.useCallback(()=>{const e=parseFloat(d);isNaN(e)||a(Math.min(r,Math.max(i,Math.round(e/o)*o))),c(!1)},[d,a,i,r,o]),h=s.useCallback(()=>{u(t.toFixed(2)),c(!0),setTimeout(()=>{var e;return null==(e=x.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-text-muted",children:e}),l?n.jsx("input",{ref:x,type:"number",value:d,onChange:e=>u(e.target.value),onBlur:m,onKeyDown:e=>{"Enter"===e.key&&m(),"Escape"===e.key&&c(!1)},min:i,max:r,step:o,className:"w-14 text-right text-[10px] text-text-secondary tabular-nums bg-subtle-fill radius-badge px-1 py-0.5 border border-border-subtle focus:outline-none focus:border-accent-primary"}):n.jsx("button",{onClick:h,className:"text-[10px] text-text-secondary tabular-nums hover:text-accent-primary cursor-text transition-colors",title:"Click to type a value",children:t.toFixed(2)})]}),n.jsx("input",{type:"range",min:i,max:r,step:o,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-accent-primary [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:cursor-pointer"})]})}),Bt=s.memo(function({label:e,checked:t,onChange:s}){return n.jsxs(r,{className:"flex items-center justify-between",children:[n.jsx(o,{className:"text-[10px] text-text-muted cursor-pointer select-none",children:e}),n.jsx(E,{enabled:t,onChange:s,size:"sm"})]})});function Ht(){var e,t,r,o,l,c,d,u,h,E,P,z,T,$,I;const G=g(),[_,U]=s.useState(!1),[q,X]=s.useState(!1),ie=s.useRef(!1);s.useEffect(()=>{G&&!ie.current&&(ie.current=!0,X(!0))},[G]);const re=s.useCallback(()=>{X(!1),U(!0)},[]),ue=f(),xe=function(e,t=1e3){const[n,a]=s.useState(e),i=s.useRef(Date.now()),r=s.useRef(null);return s.useEffect(()=>{const s=Date.now(),n=t-(s-i.current);return n<=0?(a(e),i.current=s):(r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{a(e),i.current=Date.now()},n)),()=>{r.current&&clearTimeout(r.current)}},[e,t]),n}(v(),2e3),me=b(),he=y(),pe=j(),ge=N(),fe=w(),ve=C(),be=ve?ft:vt,ye=ve?ot:lt,je=s.useMemo(()=>function(e){if("undefined"==typeof document)return e?"#171717":"#EFF0F1";const t=getComputedStyle(document.documentElement).getPropertyValue("--bg-body").trim();return t.startsWith("#")?t:e?"#171717":"#EFF0F1"}(ve),[ve]),Ne=s.useMemo(()=>function(e){if("undefined"==typeof document)return e?"#A1A1AA":"#71717A";const t=getComputedStyle(document.documentElement).getPropertyValue("--text-secondary").trim();return t.startsWith("#")?t:e?"#A1A1AA":"#71717A"}(ve),[ve]),[we,Ce]=s.useState(!0),[ke,Se]=s.useState(null),[Fe,Le]=s.useState(null),[Me,Be]=s.useState(!1),[He,Ae]=s.useState(""),[ze,Te]=s.useState(!1),[Ge,Ve]=s.useState(!1),[Ke,_e]=s.useState("simulation"),[qe,Xe]=s.useState(!0),[Ye,Je]=s.useState(!1),[et,tt]=s.useState(!0),[st,yt]=s.useState(!1),[Ct,St]=s.useState(!1),[Ht,At]=s.useState(new Set),[Et,Pt]=s.useState(!1),[zt,Tt]=s.useState("spectral"),[$t,It]=s.useState(1),[Gt,Ot]=s.useState(1),[Zt,Wt]=s.useState(!1),[Vt,Kt]=s.useState(null),[_t,Ut]=s.useState(!1),[qt,Xt]=s.useState(!1),[Yt,Qt]=s.useState(null),[Jt,es]=s.useState(null),[ts,ss]=s.useState(null),[ns,as]=s.useState(null),[is,rs]=s.useState(null),[os,ls]=s.useState(null),cs=s.useRef(!1),[ds,us]=s.useState(!1),[xs,ms]=s.useState([]),[hs,ps]=s.useState(0),[gs,fs]=s.useState(null),vs=s.useRef(new Ue),bs=s.useRef(null),ys=s.useRef(null),[js,Ns]=s.useState(null),[ws,Cs]=s.useState(null),[ks,Ss]=s.useState({}),[Ds,Fs]=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:ut,curvedLinkWeight:.8,linkDefaultArrows:xt,linkArrowsSizeScale:1.7,scalePointsOnZoom:mt,scaleLinksOnZoom:ht,renderLinks:pt,renderHoveredPointRing:gt,spaceSize:4096}),Ls=s.useCallback((e,t)=>{Fs(s=>({...s,[e]:t}))},[]),Rs=s.useCallback(()=>{Fs({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:ut,curvedLinkWeight:.8,linkDefaultArrows:xt,linkArrowsSizeScale:1.7,scalePointsOnZoom:mt,scaleLinksOnZoom:ht,renderLinks:pt,renderHoveredPointRing:gt,spaceSize:4096})},[]);s.useEffect(()=>()=>{var e;try{null==(e=ys.current)||e.destroy()}catch{}ys.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=ys.current)||t.fitView(at));break;case"escape":ze?(Te(!1),Ae("")):ke&&(Se(null),null==(s=ys.current)||s.unselectAllPoints());break;case"/":ze||(e.preventDefault(),Te(!0),setTimeout(()=>{var e;return null==(e=bs.current)?void 0:e.focus()},50));break;case" ":e.preventDefault(),ys.current&&(we?ys.current.pause():ys.current.start(),Ce(e=>!e));break;case"l":Xe(e=>!e)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ze,ke,we]);const Ms=s.useMemo(()=>new Set((null==ue?void 0:ue.backboneEdges)??[]),[null==ue?void 0:ue.backboneEdges]),Bs=s.useMemo(()=>({resolution:$t,kWeight:Gt}),[$t,Gt]),Hs=s.useMemo(()=>{if("louvain"!==zt)return null;const e=null==ue?void 0:ue.edges;return!e||0===e.length||!xe||xe.size<3?null:Re(e,Array.from(xe.keys()),Bs).communities},[zt,null==ue?void 0:ue.edges,xe,Bs]),As=s.useMemo(()=>{var e;if(!xe||0===xe.size||!_)return[];const t=[],s=(null==fe?void 0:fe.node_name)??(null==(e=null==fe?void 0:fe.config)?void 0:e.node_name)??null,n=ve?"#171717":"#EFF0F1";let a=1;for(const i of xe.values())i.degree>a&&(a=i.degree);for(const i of xe.values()){const e=i,r=e.degree>0?Math.log10(e.degree+1)/Math.log10(a+1):0,o=5+23*Math.min(1,r),l=6*e.betweenness,c=e.isLocal?28:Math.min(34,o+l),d=(null==Hs?void 0:Hs.get(e.hash))??e.communityId,u=Et&&d>=0?ye[d%ye.length]:be[e.nodeClass],x=rt[e.activityLevel]??1,m=e.isLocal?be.local:x<1?jt(u,n,x):u,h=e.isLocal?s??e.name:e.name;t.push({id:e.hash,label:h?`${e.prefix} ${h}`:e.prefix,color:m,size:c,nodeClass:e.nodeClass,name:h,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==Hs?void 0:Hs.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 me){const e=`ghost-${i.prefix}`;if(t.some(t=>t.id===e))continue;const s=jt(be.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},[xe,_,null==fe?void 0:fe.node_name,null==(e=null==fe?void 0:fe.config)?void 0:e.node_name,be,ve,me,ye,Et,zt,Hs]),Es=s.useMemo(()=>new Set(As.map(e=>e.id)),[As]),Ps=s.useMemo(()=>{const e=new Map;if(!xe)return e;for(const t of xe.values())e.set(t.hash,t.name);return e},[xe]),zs=s.useMemo(()=>{const e=(null==ue?void 0:ue.edges)??[];if(!e.length||!_)return[];const t=[],s=(null==ue?void 0:ue.edgeBetweenness)??new Map;for(const a of e){if(!Es.has(a.fromHash)||!Es.has(a.toHash))continue;const e=Nt(a,Ms),n=wt(e,a.avgConfidence,ve),i=s.get(a.key)??0,r=i>0?.5+4*i:.5+2*Math.min(1,a.certainCount/50);t.push({source:a.fromHash,target:a.toHash,color:n,width:r,key:a.key,packetCount:a.packetCount,certainCount:a.certainCount,confidence:a.avgConfidence,symmetryRatio:a.symmetryRatio,dominantDirection:a.dominantDirection,isBackbone:Ms.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:Ps.get(a.fromHash)??null,toName:Ps.get(a.toHash)??null,edgeType:e})}const n=ve?ct:dt;for(const a of me){const e=`ghost-${a.prefix}`;if(Es.has(e))for(const s of a.commonNeighbors)Es.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:Ps.get(s)??null,edgeType:"ghost"})}return t},[null==ue?void 0:ue.edges,null==ue?void 0:ue.edgeBetweenness,_,Es,ve,Ms,Ps,me]),Ts=null==(r=null==(t=null==fe?void 0:fe.config)?void 0:t.radio)?void 0:r.frequency,$s=null==(l=null==(o=null==fe?void 0:fe.config)?void 0:o.radio)?void 0:l.bandwidth,Is=null==(d=null==(c=null==fe?void 0:fe.config)?void 0:c.radio)?void 0:d.spreading_factor,Gs=null==(h=null==(u=null==fe?void 0:fe.config)?void 0:u.radio)?void 0:h.tx_power,Os=null==(P=null==(E=null==fe?void 0:fe.config)?void 0:E.radio)?void 0:P.coding_rate;s.useEffect(()=>{qt&&!cs.current&&(cs.current=!0,(async()=>{var e,t;try{const s=await k(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)];ls(s)}}}catch{}})())},[qt]);const Zs=s.useMemo(()=>{if(!ue||!qt)return null;const e={frequency:Ts,bandwidth:null!=ts?1e3*ts:$s,spreading_factor:Jt??Is,tx_power:Yt??Gs,coding_rate:ns??Os},t={};return null!=is&&(t.sensitivityOverrideDbm=is),null!=os&&(t.observedNoiseFloorDbm=os),function(e,t,s){const n=[],a=e.nodeMetrics,i=new Set,r=t.tx_power??22;for(const o of e.edges){if(!o.isZeroHop)continue;const e=a.get(o.fromHash),r=a.get(o.toHash);n.push($e(o,e,r,t,s)),i.add(o.key)}for(const o of e.edges){if(i.has(o.key))continue;if(!o.traceQuality)continue;const e=Ie(o,a.get(o.fromHash),a.get(o.toHash),t,r,s);e&&(n.push(e),i.add(o.key))}return n}(ue,e,t)},[ue,qt,Ts,$s,Is,Gs,Os,Yt,Jt,ts,ns,is,os]),Ws=s.useMemo(()=>{if(!Zs)return null;const e=new Map;for(const t of Zs)e.set(t.edgeKey,t);return e},[Zs]),Vs=s.useMemo(()=>Zs&&0!==Zs.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,r=null,o=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),(!r||c.marginDb>(r.marginDb??-1/0))&&(r=c)),c.marginClass&&s[c.marginClass]++,null!=c.deviationDb&&c.deviationClass?(t[c.deviationClass]++,l++):o++);return{totalEdges:e.length,analyzedEdges:l,rssiOnlyEdges:o,avgMarginDb:a>0?n/a:null,worstMargin:i,bestMargin:r,deviationCounts:t,marginCounts:s,anomalousCount:t["anomalous-good"]+t["anomalous-bad"]}}(Zs):null,[Zs]),Ks=s.useMemo(()=>{if(!qt||!Ws)return zs;const e=ve?"#303038":"#D0D0D8";return zs.map(t=>{const s=Ws.get(t.key);return s&&s.hasData?{...t,color:Ze(s,"margin"),width:We(s),linkBudget:s}:{...t,color:e,width:.3}})},[zs,qt,Ws,ve]),_s=s.useMemo(()=>0===Ht.size?As:As.filter(e=>!Ht.has(e.nodeClass)),[As,Ht]),Us=s.useMemo(()=>{if(0===Ht.size)return Ks;const e=new Set(_s.map(e=>e.id));return Ks.filter(t=>e.has(t.source)&&e.has(t.target))},[Ks,_s,Ht]),qs=s.useRef([]);s.useEffect(()=>{qs.current=Us},[Us]);const Xs=s.useMemo(()=>{const e=new Map;for(const t of zs)e.set(t.source,(e.get(t.source)??0)+1),e.set(t.target,(e.get(t.target)??0)+1);return e},[zs]),Ys=s.useMemo(()=>{const e=new Map;for(const t of As)e.set(t.id,t);return e},[As]);s.useEffect(()=>{if(0===_s.length)return Ns(null),Cs(null),void Ss({});let e=!1;const t=setTimeout(async()=>{try{const t=_s.map(e=>({id:e.id,label:e.label,color:e.color,size:e.size,communityId:String(e.communityId)})),s=Us.map(e=>({source:e.source,target:e.target,color:e.color,width:e.width})),n={points:{pointIdBy:"id",pointColorBy:"color",pointColorStrategy:"direct",pointDefaultColor:ve?"#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:ve?"#6B7280":"#9CA3AF",linkWidthBy:"width",linkWidthStrategy:"direct",linkDefaultWidth:1,linkWidthScale:1,linkGreyoutOpacity:.1}},a=await i(n,t,s);if(e||!a)return;Ns(a.points??null),Cs(a.links??null),Ss(a.cosmographConfig??{})}catch(t){}},100);return()=>{e=!0,clearTimeout(t)}},[_s,Us,ve]);const Qs=s.useCallback(e=>{e&&(ys.current=e,e.start(),setTimeout(()=>{e.fitView(at)},1500))},[]),Js=s.useCallback(()=>{var e;null==(e=ys.current)||e.fitView(at)},[]),en=s.useCallback(()=>{const e=ys.current;e&&(we?e.pause():e.start(),Ce(!we))},[we]),tn=s.useCallback(async e=>{const t=ys.current,s=Ys.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{}Le(null),Se({hash:e,name:s.name,prefix:s.prefix,nodeClass:s.nodeClass,packetCount:s.packetCount,edgeCount:Xs.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})}},[Ys,Xs]),sn=s.useRef(null);s.useEffect(()=>{sn.current=Ws},[Ws]);const nn=s.useCallback(e=>{var t;if(void 0===e)return void Le(null);const s=qs.current[e];if(!s)return;const n=null==(t=sn.current)?void 0:t.get(s.key);Le(n&&!s.linkBudget?{...s,linkBudget:n}:s),Se(null)},[]),an=s.useCallback(async(e,t,s)=>{var n;if(void 0===e)return Se(null),Kt(null),void(null==(n=ys.current)||n.unselectAllPoints());Le(null);const a=ys.current;if(a)try{const t=await a.getPointIdsByIndices([e]);if(!t||0===t.length)return;const s=t[0],n=Ys.get(s);if(!n)return;a.selectPoint(e,!1,!0),Se({hash:s,name:n.name,prefix:n.prefix,nodeClass:n.nodeClass,packetCount:n.packetCount,edgeCount:Xs.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{}},[Ys,Xs]),rn=s.useMemo(()=>{if(!ze||!He.trim())return[];const e=He.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,He,ze]),on=s.useCallback(e=>{Te(!1),Ae(""),tn(e.id)},[tn]),ln=s.useCallback(()=>{Be(e=>!e)},[]),cn=s.useCallback(e=>{At(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),dn=s.useCallback(()=>{Pt(e=>{const t=!e,s=ys.current;return s&&s.start(.5),t})},[]),un=s.useCallback(()=>{Wt(e=>{const t=!e,s=ys.current;return s?(t?s.activatePolygonalSelection():(s.deactivatePolygonalSelection(),Kt(null),s.unselectAllPoints()),t):t})},[]),xn=s.useCallback(async()=>{const e=ys.current;if(!e)return;await new Promise(e=>setTimeout(e,80));const t=e.getSelectedPointIndices();if(!t||0===t.length)return void Kt(null);const s=await e.getPointIdsByIndices(t);if(!s||0===s.length)return void Kt(null);const n=new Set(s);let a=0,i=0;for(const x of qs.current)n.has(x.source)&&n.has(x.target)&&(a++,i+=x.confidence);let r=0;const o={},l={};for(const x of s){const e=Ys.get(x);e&&(r+=e.betweenness,o[e.communityId]=(o[e.communityId]??0)+1,l[e.nodeClass]=(l[e.nodeClass]??0)+1)}const c=new Set;for(const x of s){const e=Ys.get(x);e&&c.add(e.prefix.toLowerCase())}let d=0,u=0;for(const x of ge)if(x.hops.length>=2){const e=x.hops[0].toLowerCase(),t=x.hops[x.hops.length-1].toLowerCase();c.has(e)&&c.has(t)&&(d+=x.healthScore,u++)}Kt({nodeCount:s.length,edgeCount:a,avgBetweenness:s.length>0?r/s.length:0,avgConfidence:a>0?i/a:0,avgPathHealth:u>0?d/u:null,communities:o,nodeClasses:l}),Se(null),Le(null)},[Ys,ge]),mn=s.useCallback(()=>{var e;Kt(null),null==(e=ys.current)||e.unselectAllPoints()},[]),hn=s.useMemo(()=>{var e;if(!ke)return null;const t=ke.hash,s=new Set;for(const m of Us)m.source===t?s.add(m.target):m.target===t&&s.add(m.source);if(0===s.size)return{clusteringCoeff:0,avgNeighborBetweenness:0,neighborCount:0,avgEdgeConfidence:0,avgRssi:null,avgSnr:null};let n=0;for(const m of Us)s.has(m.source)&&s.has(m.target)&&n++;const a=s.size,i=a>1?2*n/(a*(a-1)):0;let r=0;for(const m of s)r+=(null==(e=Ys.get(m))?void 0:e.betweenness)??0;let o=0,l=0,c=0,d=0,u=0,x=0;for(const m of Us)m.source!==t&&m.target!==t||(o+=m.confidence,l++,null!=m.avgRssi&&(c+=m.avgRssi,d++),null!=m.avgSnr&&(u+=m.avgSnr,x++));return{clusteringCoeff:Math.min(1,i),avgNeighborBetweenness:r/a,neighborCount:a,avgEdgeConfidence:l>0?o/l:0,avgRssi:d>0?c/d:null,avgSnr:x>0?u/x:null}},[ke,Us,Ys]),pn=s.useMemo(()=>{if(!ke)return[];const e=ke.hash,t=[],s=new Set;for(const n of Us){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=Ys.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},[ke,Us,Ys]),gn=s.useCallback(async()=>{const e=ys.current;if(!e||!ke)return;const t=await e.getPointIndicesByIds([ke.hash]);if(!t||void 0===t[0])return;const s=t[0],n=e.getConnectedPointIndices(s)??[],a=new Set([s,...n]);for(const r of n){const t=e.getConnectedPointIndices(r)??[];for(const e of t)a.add(e)}const i=Array.from(a);e.selectPoints(i),e.fitViewByIndices(i,at,.15)},[ke]);s.useEffect(()=>{if(!Zt)return;const e=e=>{var t,s;"Escape"===e.key&&(Wt(!1),null==(t=ys.current)||t.deactivatePolygonalSelection(),Kt(null),null==(s=ys.current)||s.unselectAllPoints())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[Zt]);const fn=s.useCallback((e,t)=>{ue&&(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)}(De(e,t))}(ue,{format:e,dataset:t}),Ut(!1))},[ue]),vn=s.useMemo(()=>{if(!ue||!ge.length)return null;const e=ue.edges??[];return 0===e.length?null:function(e,t,s=-137){const n=new Map;for(const r of t)n.set(r.key,r);const a=t.filter(e=>null!=e.avgRssi).length,i=[];for(const r of e){const e=Qe(r,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}}(ge,e)},[ue,ge]),bn=s.useMemo(()=>{const e=null==ue?void 0:ue.edges;if(!e||0===e.length||!xe||xe.size<3)return null;const t=Array.from(xe.keys());return Z(e,t)},[null==ue?void 0:ue.edges,xe]),yn=s.useMemo(()=>{if("louvain"!==zt)return null;const e=null==ue?void 0:ue.edges;return!e||0===e.length||!xe||xe.size<3?null:Re(e,Array.from(xe.keys()),Bs)},[zt,null==ue?void 0:ue.edges,xe,Bs]);s.useEffect(()=>{if(!ue)return;const e=new Map;for(const[s,n]of ue.nodeMetrics)e.set(s,n.name);const t=vs.current.update(ue,e);t.totalCount>0&&(ms(vs.current.getLog()),ps(e=>e+t.totalCount))},[ue]);const jn=s.useCallback(()=>{ps(0),us(e=>!e)},[]),Nn=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,r;a<10?(i="critical",r="Partition risk"):a<30?(i="poor",r="Weak connectivity"):a<55?(i="fair",r="Moderate resilience"):a<80?(i="good",r="Well connected"):(i="excellent",r="Highly resilient");const[o,l]=it[i];return{score:a,grade:i,label:r,color:t?o:l}}(bn,ve),[bn,ve]),wn=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-text-primary flex items-center gap-2 sm:gap-3 pointer-events-auto",children:[n.jsx(S,{className:"w-5 h-5 sm:w-6 sm:h-6 text-icon-page-title"}),n.jsx("span",{children:"MeshGraph"}),n.jsx(D,{color:"violet",compact:!0,children:"Analytics"})]}),Nn&&n.jsx(F,{content:n.jsxs("div",{className:"max-w-xs space-y-2",children:[n.jsx("div",{className:"font-semibold text-text-primary",children:"Mesh Resilience Score"}),n.jsx("div",{className:"text-text-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-text-muted",children:"Raw λ₂"}),n.jsx("span",{className:"text-text-primary tabular-nums",children:(null==bn?void 0:bn.toFixed(6))??"—"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Score"}),n.jsxs("span",{className:"tabular-nums",style:{color:Nn.color},children:[Nn.score,"/100"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Grade"}),n.jsx("span",{className:"capitalize",style:{color:Nn.color},children:Nn.grade})]})]}),n.jsxs("div",{className:"pt-1 border-t border-border-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-text-muted font-medium",children:"Grade thresholds"}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:it.excellent[0]},children:"Excellent"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"80-100 (λ₂ > 0.3)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:it.good[0]},children:"Good"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"55-79 (λ₂ 0.03-0.3)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:it.fair[0]},children:"Fair"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"30-54 (λ₂ 0.003-0.03)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:it.poor[0]},children:"Poor"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"10-29 (λ₂ 0.0001-0.003)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:it.critical[0]},children:"Critical"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"<10 (λ₂ ≈ 0)"})]})]}),n.jsx("div",{className:"text-[10px] text-text-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-text-muted uppercase tracking-wider",children:"Resilience"}),n.jsx("span",{className:"text-lg font-semibold tabular-nums leading-none",style:{color:Nn.color},children:Nn.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:`${Nn.score}%`,backgroundColor:Nn.color}})})]})})]}),Cn=(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-accent-primary/20 text-accent-primary shadow-inner`:`${s} hover:bg-white/5 hover:scale-105 text-text-secondary`},kn=n.jsx("div",{className:"w-px h-6 bg-border-subtle/40 mx-0.5 shrink-0"}),Sn=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(F,{content:"Visible nodes / edges in the graph",children:n.jsxs("span",{className:"text-[9px] text-text-muted tabular-nums mr-1.5 leading-none cursor-help",children:[_s.length,n.jsx("br",{}),Us.length]})}),kn,n.jsx(F,{content:qe?"Hide labels (L)":"Show labels (L)",children:n.jsxs("button",{onClick:()=>Xe(e=>!e),className:Cn(!qe,!0),children:[qe?n.jsx(Q,{className:"w-3.5 h-3.5"}):n.jsx(W,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Lbl"})]})}),n.jsx(F,{content:Et?"Disable clustering":"Community clustering",children:n.jsxs("button",{onClick:dn,className:Cn(Et),children:[n.jsx(le,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Grp"})]})}),n.jsx(F,{content:Zt?"Exit lasso (Esc)":"Lasso selection",children:n.jsxs("button",{onClick:un,className:Cn(Zt,!0),children:[n.jsx(ce,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Sel"})]})}),kn,n.jsx(F,{content:"Legend",children:n.jsxs("button",{onClick:()=>Je(e=>!e),className:Cn(Ye),children:[n.jsx(se,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Map"})]})}),n.jsx(F,{content:"Search (/)",children:n.jsxs("button",{onClick:()=>{Te(!0),setTimeout(()=>{var e;return null==(e=bs.current)?void 0:e.focus()},50)},className:Cn(ze),children:[n.jsx(J,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Fnd"})]})}),kn,n.jsx(F,{content:we?"Pause (Space)":"Play (Space)",children:n.jsxs("button",{onClick:en,className:Cn(!we),children:[we?n.jsx(L,{className:"w-3.5 h-3.5 text-accent-success"}):n.jsx(R,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:we?"Run":"Stop"})]})}),n.jsx(F,{content:"Fit view (F)",children:n.jsxs("button",{onClick:Js,className:Cn(!1),children:[n.jsx(oe,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Fit"})]})}),kn,n.jsx(F,{content:qt?"Disable link budget":"Link budget overlay",children:n.jsxs("button",{onClick:()=>Xt(e=>!e),className:Cn(qt),children:[n.jsx(M,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"RF"})]})}),n.jsx(F,{content:"Anomaly log",children:n.jsxs("button",{onClick:jn,className:`relative ${Cn(ds,!0)}`,children:[n.jsx(ee,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Alert"}),hs>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:hs>9?"9+":hs})]})}),n.jsx(F,{content:"Export topology",children:n.jsxs("button",{onClick:()=>Ut(e=>!e),className:Cn(_t),children:[n.jsx(Y,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Exp"})]})}),n.jsx(F,{content:"Settings",children:n.jsxs("button",{onClick:()=>Ve(e=>!e),className:Cn(Ge),children:[n.jsx(ne,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Cfg"})]})}),kn,n.jsx(F,{content:Me?"Exit fullscreen":"Fullscreen",children:n.jsxs("button",{onClick:ln,className:Cn(Me),children:[Me?n.jsx(V,{className:"w-3.5 h-3.5"}):n.jsx(O,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Max"})]})})]}),Dn=n.jsxs(nt,{id:"settings",title:"Graph Settings",icon:n.jsx(ne,{}),open:Ge,onClose:()=>Ve(!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(F,{content:"Reset to defaults",children:n.jsx("button",{onClick:Rs,className:"p-0.5 radius-badge hover-bg transition-base",children:n.jsx(de,{className:"w-2.5 h-2.5 text-text-muted"})})}),children:[n.jsx("div",{className:"flex border-b border-border-subtle",children:["simulation","points","links","rendering"].map(e=>n.jsx("button",{onClick:()=>_e(e),className:"flex-1 px-2 py-1.5 text-[10px] font-medium capitalize transition-colors "+(Ke===e?"text-accent-primary border-b-2 border-accent-primary":"text-text-muted hover:text-text-secondary"),children:e},e))}),n.jsxs("div",{className:"p-3 space-y-3",children:["simulation"===Ke&&n.jsxs(n.Fragment,{children:[n.jsx(Mt,{label:"Gravity",value:Ds.simulationGravity,onChange:e=>Ls("simulationGravity",e),min:0,max:1,step:.01}),n.jsx(Mt,{label:"Repulsion",value:Ds.simulationRepulsion,onChange:e=>Ls("simulationRepulsion",e),min:0,max:5,step:.1}),n.jsx(Mt,{label:"Link Spring",value:Ds.simulationLinkSpring,onChange:e=>Ls("simulationLinkSpring",e),min:0,max:2,step:.05}),n.jsx(Mt,{label:"Link Distance",value:Ds.simulationLinkDistance,onChange:e=>Ls("simulationLinkDistance",e),min:1,max:100,step:1}),n.jsx(Mt,{label:"Friction",value:Ds.simulationFriction,onChange:e=>Ls("simulationFriction",e),min:0,max:1,step:.01}),n.jsx(Mt,{label:"Center Force",value:Ds.simulationCenter,onChange:e=>Ls("simulationCenter",e),min:0,max:1,step:.01}),n.jsx(Mt,{label:"Decay",value:Ds.simulationDecay,onChange:e=>Ls("simulationDecay",e),min:100,max:2e4,step:100}),n.jsx(Mt,{label:"Repulsion Theta",value:Ds.simulationRepulsionTheta,onChange:e=>Ls("simulationRepulsionTheta",e),min:.1,max:3,step:.05}),n.jsx(Mt,{label:"Mouse Repulsion",value:Ds.simulationRepulsionFromMouse,onChange:e=>Ls("simulationRepulsionFromMouse",e),min:0,max:10,step:.5})]}),"points"===Ke&&n.jsxs(n.Fragment,{children:[n.jsx(Mt,{label:"Size Scale",value:Ds.pointSizeScale,onChange:e=>Ls("pointSizeScale",e),min:.1,max:5,step:.1}),n.jsx(Mt,{label:"Opacity",value:Ds.pointOpacity,onChange:e=>Ls("pointOpacity",e),min:0,max:1,step:.05}),n.jsx(Mt,{label:"Greyout Opacity",value:Ds.pointGreyoutOpacity,onChange:e=>Ls("pointGreyoutOpacity",e),min:0,max:1,step:.05}),n.jsx(Bt,{label:"Scale on Zoom",checked:Ds.scalePointsOnZoom,onChange:e=>Ls("scalePointsOnZoom",e)}),n.jsx(Bt,{label:"Hover Ring",checked:Ds.renderHoveredPointRing,onChange:e=>Ls("renderHoveredPointRing",e)})]}),"links"===Ke&&n.jsxs(n.Fragment,{children:[n.jsx(Bt,{label:"Show Links",checked:Ds.renderLinks,onChange:e=>Ls("renderLinks",e)}),n.jsx(Bt,{label:"Curved Links",checked:Ds.curvedLinks,onChange:e=>Ls("curvedLinks",e)}),n.jsx(Bt,{label:"Show Arrows",checked:Ds.linkDefaultArrows,onChange:e=>Ls("linkDefaultArrows",e)}),n.jsx(Mt,{label:"Width Scale",value:Ds.linkWidthScale,onChange:e=>Ls("linkWidthScale",e),min:.1,max:5,step:.1}),n.jsx(Mt,{label:"Opacity",value:Ds.linkOpacity,onChange:e=>Ls("linkOpacity",e),min:0,max:1,step:.05}),n.jsx(Mt,{label:"Greyout Opacity",value:Ds.linkGreyoutOpacity,onChange:e=>Ls("linkGreyoutOpacity",e),min:0,max:1,step:.05}),Ds.curvedLinks&&n.jsx(Mt,{label:"Curve Weight",value:Ds.curvedLinkWeight,onChange:e=>Ls("curvedLinkWeight",e),min:0,max:1,step:.05}),Ds.linkDefaultArrows&&n.jsx(Mt,{label:"Arrow Size",value:Ds.linkArrowsSizeScale,onChange:e=>Ls("linkArrowsSizeScale",e),min:.1,max:3,step:.1}),n.jsx(Bt,{label:"Scale on Zoom",checked:Ds.scaleLinksOnZoom,onChange:e=>Ls("scaleLinksOnZoom",e)})]}),"rendering"===Ke&&n.jsxs(n.Fragment,{children:[n.jsx(Mt,{label:"Space Size",value:Ds.spaceSize,onChange:e=>Ls("spaceSize",e),min:1024,max:16384,step:512}),n.jsx("div",{className:"pt-2 border-t border-border-subtle/50",children:n.jsx("p",{className:"text-[9px] text-text-muted",children:"Space size defines the simulation boundary. Larger values allow more spread."})})]})]})]}),Fn=n.jsxs(nt,{id:"export",title:"Export Topology",icon:n.jsx(Y,{}),open:_t,onClose:()=>Ut(!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:()=>fn(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-text-primary",children:e}),n.jsx("span",{className:"text-[9px] text-text-muted",children:a})]},`${t}-${s}`))}),n.jsx("div",{className:"px-3 py-1.5 border-t border-border-subtle",children:n.jsxs("span",{className:"text-[9px] text-text-muted",children:[(null==(z=null==ue?void 0:ue.nodeMetrics)?void 0:z.size)??0," nodes · ",(null==(T=null==ue?void 0:ue.validatedEdges)?void 0:T.length)??0," edges"]})})]}),Ln={info:{dot:"bg-accent-primary",text:"text-text-secondary"},warning:{dot:"bg-status-warning",text:"text-status-warning"},critical:{dot:"bg-status-danger",text:"text-status-danger"}},Rn={"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"},Mn=(e,t,s)=>null==t||""===t?null:n.jsxs("div",{className:"flex justify-between gap-2",children:[n.jsx("span",{className:"text-text-muted",children:e}),n.jsx("span",{className:`tabular-nums text-right ${s??"text-text-secondary"}`,children:t})]}),Bn=e=>{const t=[];return e.isZeroHop&&t.push({label:"Zero-Hop",color:"text-status-warning"}),e.isDirectPath&&t.push({label:"Direct",color:"text-accent-primary"}),e.isBackbone&&t.push({label:"Backbone",color:"text-text-primary"}),e.isLoop&&t.push({label:"Loop",color:"text-accent-secondary"}),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))})},Hn=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-text-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"})]}),Mn("Degree",e.degree),e.betweenness>.01&&Mn("Betweenness",e.betweenness.toFixed(3)),Mn("Packets",e.packetCount),Mn("Community",`#${e.communityId}`),Mn("Activity",e.activityLevel),null!=e.avgRssi&&Mn("RSSI",`${e.avgRssi.toFixed(0)} dBm`),null!=e.avgSnr&&Mn("SNR",`${e.avgSnr.toFixed(1)} dB`)]}),An=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-text-muted font-mono",children:"number"==typeof e.previousValue?e.previousValue.toFixed(3):e.previousValue}),n.jsx("span",{className:"text-text-muted/40",children:"→"}),n.jsx("span",{className:"text-text-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-accent-success":"text-signal-poor",children:["(",e.currentValue>e.previousValue?"+":"",(e.currentValue-e.previousValue).toFixed(3),")"]})]}),e.nodeDetail&&n.jsxs(n.Fragment,{children:[Mn("Class",e.nodeDetail.nodeClass),Mn("Degree",e.nodeDetail.degree),e.nodeDetail.betweenness>.01&&Mn("Betweenness",e.nodeDetail.betweenness.toFixed(3))]})]}),En=s.useCallback(e=>{fs(t=>t===e?null:e)},[]),Pn=n.jsxs(nt,{id:"anomaly",title:"Anomaly Log",icon:n.jsx(ee,{}),open:ds,onClose:()=>us(!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:xs.length>0?n.jsx("button",{onClick:()=>{vs.current.clear(),ms([]),fs(null)},className:"p-0.5 radius-badge hover-bg transition-base",title:"Clear all",children:n.jsx(de,{className:"w-2.5 h-2.5 text-text-muted"})}):void 0,children:[0===xs.length?n.jsxs("div",{className:"px-3 py-6 text-center",children:[n.jsx(ee,{className:"w-5 h-5 text-text-muted mx-auto mb-1.5"}),n.jsx("p",{className:"text-[11px] text-text-muted",children:"No anomalies detected yet"}),n.jsx("p",{className:"text-[9px] text-text-muted/60 mt-0.5",children:"Changes appear after topology recomputes"})]}):n.jsx("div",{className:"overflow-y-auto",children:xs.slice(0,50).map(e=>{const t=Ln[e.severity],s=B(e.detectedAt/1e3),a=gs===e.id,i=!(!e.edgeDetail&&!e.nodeDetail&&null==e.previousValue);return n.jsxs("div",{className:`border-b border-border-subtle/50 last:border-0 transition-colors ${i?"cursor-pointer hover-bg":""} ${a?"bg-subtle-fill/50":""}`,onClick:i?()=>En(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-text-muted/60 mt-0.5",children:[Rn[e.category]??e.category," · ",s]})]}),i&&n.jsx(H,{className:"w-3 h-3 text-text-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-border-subtle/60 pl-2 py-0.5",children:[e.edgeDetail&&(r=e.edgeDetail,o=e.category,n.jsxs("div",{className:"text-[9px] space-y-0.5",children:[(r.fromClass||r.toClass)&&n.jsxs("div",{className:"flex items-center gap-1 text-text-muted",children:[n.jsx("span",{className:"capitalize",children:r.fromClass??"?"}),n.jsx("span",{className:"text-text-muted/40",children:"↔"}),n.jsx("span",{className:"capitalize",children:r.toClass??"?"})]}),"edge-appeared"===o&&r.packetCount>0&&n.jsxs(n.Fragment,{children:[Mn("Packets",r.packetCount),Mn("Confidence",`${(100*r.confidence).toFixed(0)}%`,r.confidence>=.8?"text-accent-success":r.confidence>=.5?"text-accent-secondary":"text-signal-poor"),Mn("Symmetry",`${(100*r.symmetryRatio).toFixed(0)}%`)]}),r.isZeroHop&&null!=r.avgRssi&&Mn("RSSI",`${r.avgRssi.toFixed(0)} dBm`),r.isZeroHop&&null!=r.avgSnr&&Mn("SNR",`${r.avgSnr.toFixed(1)} dB`),null!=r.fromBetweenness&&r.fromBetweenness>.01&&Mn(`${r.fromName??"A"} centrality`,r.fromBetweenness.toFixed(3)),null!=r.toBetweenness&&r.toBetweenness>.01&&Mn(`${r.toName??"B"} centrality`,r.toBetweenness.toFixed(3)),Bn(r)]})),e.nodeDetail&&!e.edgeDetail&&("node-appeared"===e.category||"node-disappeared"===e.category)&&Hn(e.nodeDetail),("betweenness-shift"===e.category||"community-change"===e.category||"class-change"===e.category)&&An(e)]})})]},e.id);var r,o})}),xs.length>0&&n.jsx("div",{className:"px-3 py-1.5 border-t border-border-subtle",children:n.jsxs("span",{className:"text-[9px] text-text-muted",children:[xs.length," total · showing ",Math.min(xs.length,50)]})})]}),zn=s.useMemo(()=>{const e={};for(const t of zs)e[t.edgeType]=(e[t.edgeType]??0)+1;return e},[zs]),Tn=n.jsxs(nt,{id:"legend",title:"Legend",icon:n.jsx(se,{}),open:Ye,onClose:()=>Je(!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-border-subtle",children:[n.jsxs("button",{onClick:()=>tt(e=>!e),className:"w-full flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-medium text-text-secondary hover-bg transition-base",children:[et?n.jsx(H,{className:"w-3 h-3"}):n.jsx(ae,{className:"w-3 h-3"}),"Nodes",n.jsx("span",{className:"text-text-muted ml-auto tabular-nums",children:_s.length})]}),et&&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=he[e]??0;if(0===s&&"local"!==e)return null;const a=Ht.has(e);return n.jsx(F,{content:bt[e],children:n.jsxs("button",{onClick:()=>cn(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:be[e]}}),n.jsx("span",{className:"text-[10px] text-text-secondary flex-1",children:t}),n.jsx("span",{className:"text-[10px] text-text-muted tabular-nums",children:s})]})},e)})})]}),n.jsxs("div",{className:"border-b border-border-subtle",children:[n.jsxs("button",{onClick:()=>yt(e=>!e),className:"w-full flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-medium text-text-secondary hover-bg transition-base",children:[st?n.jsx(H,{className:"w-3 h-3"}):n.jsx(ae,{className:"w-3 h-3"}),"Edges",n.jsx("span",{className:"text-text-muted ml-auto tabular-nums",children:Us.length})]}),st&&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=zn[e]??0;if(0===s)return null;const a=wt(e,.8,ve);return n.jsx(F,{content:kt[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-text-secondary flex-1",children:t}),n.jsx("span",{className:"text-[10px] text-text-muted tabular-nums",children:s})]})},e)})})]}),qt&&Vs&&n.jsxs("div",{className:"border-b border-border-subtle",children:[n.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-medium text-accent-success flex items-center gap-1.5",children:[n.jsx(M,{className:"w-3 h-3"}),"Link Budget",n.jsxs("span",{className:"text-text-muted ml-auto tabular-nums",children:[Vs.analyzedEdges+Vs.rssiOnlyEdges,"/",Vs.totalEdges]})]}),n.jsxs("div",{className:"px-3 pb-2 space-y-0.5",children:[(()=>{const e=Ts&&Ts>1e5?Ts/1e6:Ts||915,t=Jt??Is??12,s=ts??($s&&$s>1e3?$s/1e3:$s||125),a=ns??Os??5,i=Yt??Gs??22,r=Ee(t,s,a),o=is??r,l=Pe(1e3*s),c=os??l,d=(null==Zs?void 0:Zs.filter(e=>e.isTraceEstimated).length)??0,u=(null==Zs?void 0:Zs.filter(e=>e.isZeroHop).length)??0,x=null!=Yt||null!=Jt||null!=ts||null!=ns||null!=is,m="w-10 px-1 py-0 text-[10px] text-right tabular-nums bg-subtle-fill border border-border-subtle rounded text-text-secondary focus:outline-none focus:border-accent-primary";return n.jsxs("div",{className:"pb-1 mb-1 border-b border-border-subtle space-y-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx("span",{className:"text-text-muted",children:"Frequency"}),n.jsxs("span",{className:"text-text-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-text-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);es(t===(Is??12)?null:t)},className:m+" w-12 appearance-none",children:[7,8,9,10,11,12].map(e=>n.jsxs("option",{value:e,children:["SF",e]},e))}),null!=Jt&&n.jsx("button",{onClick:()=>es(null),className:"text-[8px] text-accent-primary hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-text-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);ss(t===($s&&$s>1e3?$s/1e3:$s||125)?null:t)},className:m+" w-14 appearance-none",children:[62.5,125,250,500].map(e=>n.jsxs("option",{value:e,children:[e," kHz"]},e))}),null!=ts&&n.jsx("button",{onClick:()=>ss(null),className:"text-[8px] text-accent-primary hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-text-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);as(t===(Os??5)?null:t)},className:m+" w-12 appearance-none",children:[5,6,7,8].map(e=>n.jsxs("option",{value:e,children:["4/",e]},e))}),null!=ns&&n.jsx("button",{onClick:()=>as(null),className:"text-[8px] text-accent-primary hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-text-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)||Qt(t)},onBlur:e=>{const t=parseInt(e.target.value,10);isNaN(t)?Qt(null):Qt(Math.max(1,Math.min(36,t)))},className:m}),n.jsx("span",{className:"text-text-muted",children:"dBm"}),null!=Yt&&n.jsx("button",{onClick:()=>Qt(null),className:"text-[8px] text-accent-primary hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-text-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*o)/10,onChange:e=>{const t=parseFloat(e.target.value);isNaN(t)||rs(t)},onBlur:e=>{const t=parseFloat(e.target.value);isNaN(t)?rs(null):rs(Math.max(-150,Math.min(-80,t)))},className:m+" w-12"}),n.jsx("span",{className:"text-text-muted",children:"dBm"}),null!=is&&n.jsx("button",{onClick:()=>rs(null),className:"text-[8px] text-accent-primary hover:underline",title:"Reset",children:"↺"})]})]}),d>0&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx("span",{className:"text-text-muted",children:"Noise Floor"}),n.jsxs("span",{className:"text-text-secondary tabular-nums "+(null!=os?"":"italic text-text-muted"),children:[c.toFixed(1)," dBm",null!=os?"":" (est.)"]})]}),x&&n.jsx("button",{onClick:()=>{Qt(null),es(null),ss(null),as(null),rs(null)},className:"w-full text-[9px] text-accent-primary 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-text-muted",children:"Sources"}),n.jsxs("span",{className:"text-text-secondary tabular-nums",children:[u>0&&n.jsxs("span",{children:[u," direct"]}),u>0&&d>0&&n.jsx("span",{className:"text-text-muted",children:" · "}),d>0&&n.jsxs("span",{className:"text-accent-secondary",children:[d," trace"]})]})]})]})})(),null!=Vs.avgMarginDb&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx("span",{className:"text-text-muted",children:"Avg Margin"}),n.jsxs("span",{className:"text-text-secondary tabular-nums",children:[Vs.avgMarginDb>0?"+":"",Vs.avgMarginDb.toFixed(1)," dB"]})]}),["excellent","good","fair","marginal","critical"].map(e=>{const t=Vs.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:Oe[e]}}),n.jsx("span",{className:"text-[10px] text-text-secondary flex-1 capitalize",children:e}),n.jsx("span",{className:"text-[10px] text-text-muted tabular-nums",children:t})]},e)}),Vs.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:Vs.anomalousCount})]})]})]}),vn&&vn.atRiskPaths.length>0&&n.jsxs("div",{className:"border-b border-border-subtle",children:[n.jsxs("div",{className:"flex items-center",children:[n.jsxs("button",{onClick:()=>St(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:[Ct?n.jsx(H,{className:"w-3 h-3"}):n.jsx(ae,{className:"w-3 h-3"}),"At-Risk Paths",n.jsxs("span",{className:"text-text-muted ml-auto tabular-nums",children:[vn.criticalCount>0&&n.jsxs("span",{className:"text-status-danger",children:[vn.criticalCount,"c"]}),vn.criticalCount>0&&vn.highCount>0&&" ",vn.highCount>0&&n.jsxs("span",{className:"text-status-warning",children:[vn.highCount,"h"]}),(vn.criticalCount>0||vn.highCount>0)&&vn.moderateCount>0&&" ",vn.moderateCount>0&&n.jsxs("span",{className:"text-text-muted",children:[vn.moderateCount,"m"]})]})]}),n.jsx(F,{content:n.jsxs("div",{className:"max-w-xs space-y-1.5",children:[n.jsx("div",{className:"font-semibold text-text-primary",children:"Predictive Path Failure"}),n.jsx("div",{className:"text-text-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-border-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-text-muted font-medium",children:"Factor weights"}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-secondary",children:"Declining usage"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"35%"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-secondary",children:"Weak link certainty"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"30%"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-secondary",children:"No alternate paths"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"20%"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-secondary",children:"Low signal margin"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"15%"})]})]}),n.jsxs("div",{className:"pt-1 border-t border-border-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-text-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-text-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-text-muted tabular-nums",children:"55-74% — significant risk"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Moderate"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"35-54% — worth monitoring"})]})]}),n.jsxs("div",{className:"pt-1 border-t border-border-subtle/30 text-[10px] text-text-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:vn.edgesAnalyzed})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{children:"With signal data"}),n.jsx("span",{className:"tabular-nums",children:vn.edgesWithSignal})]})]})]}),children:n.jsx("span",{className:"px-2 py-1.5 text-text-muted cursor-help",children:n.jsx(ee,{className:"w-3 h-3"})})})]}),Ct&&n.jsx("div",{className:"px-2 pb-2 space-y-1",children:vn.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(F,{content:n.jsxs("div",{className:"max-w-xs space-y-1.5",children:[n.jsx("div",{className:"font-semibold text-text-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-text-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-text-muted",children:"Health score"}),n.jsxs("span",{className:"text-text-primary tabular-nums",children:[(100*e.healthScore).toFixed(0),"%"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Obs. trend"}),n.jsxs("span",{className:"tabular-nums "+(e.observationTrend<0?"text-status-danger":"text-text-secondary"),children:[e.observationTrend>0?"+":"",e.observationTrend.toFixed(3)]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Alt. paths"}),n.jsx("span",{className:"tabular-nums "+(0===e.alternatePathsCount?"text-status-danger":"text-text-secondary"),children:e.alternatePathsCount})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-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-border-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-text-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-text-secondary",children:e.name}),n.jsxs("span",{className:"text-text-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-text-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-text-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-text-muted",children:[t.name," (",(t.score*t.weight*100).toFixed(0),"%)",sTt(e=>"spectral"===e?"louvain":"spectral"),className:"text-accent-primary hover:underline cursor-pointer",children:"spectral"===zt?"Spectral":"Louvain"})]}),"louvain"===zt&&yn&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(F,{content:"Louvain modularity score — quality of community partition (higher = better defined communities)",children:n.jsx("span",{className:"text-text-muted cursor-help",children:"Modularity Q"})}),n.jsx("span",{className:"text-text-secondary tabular-nums",children:yn.modularity.toFixed(4)})]}),"louvain"===zt&&n.jsxs("div",{className:"mt-1.5 pt-1.5 border-t border-border-subtle space-y-1.5",children:[n.jsx(Mt,{label:"Resolution γ",value:$t,onChange:It,min:.01,max:5,step:.01}),n.jsx(Mt,{label:"K-weight",value:Gt,onChange:Ot,min:.01,max:5,step:.01}),(1!==$t||1!==Gt)&&n.jsx("button",{onClick:()=>{It(1),Ot(1)},className:"w-full text-[10px] text-accent-primary hover:underline text-center",children:"Reset defaults"})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(F,{content:"Redundant path cycles in the topology — indicates alternate routing options",children:n.jsx("span",{className:"text-text-muted cursor-help",children:"Loops"})}),n.jsx("span",{className:"text-text-secondary tabular-nums",children:(null==($=null==ue?void 0:ue.loops)?void 0:$.length)??0})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(F,{content:"High-betweenness edges that carry disproportionate traffic flow",children:n.jsx("span",{className:"text-text-muted cursor-help",children:"Backbone"})}),n.jsx("span",{className:"text-text-secondary tabular-nums",children:(null==(I=null==ue?void 0:ue.backboneEdges)?void 0:I.length)??0})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(F,{content:"Unresolved prefix nodes inferred by Viterbi HMM from repeated path patterns",children:n.jsx("span",{className:"text-text-muted cursor-help",children:"Ghosts"})}),n.jsx("span",{className:"text-text-secondary tabular-nums",children:me.length})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(F,{content:"Community-aware node coloring — groups nodes by cluster assignment",children:n.jsx("span",{className:"text-text-muted cursor-help",children:"Clustering"})}),n.jsx("span",{className:"tabular-nums "+(Et?"text-accent-primary":"text-text-muted"),children:Et?"On":"Off"})]}),null!=bn&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(F,{content:"Algebraic connectivity — 2nd-smallest eigenvalue of the graph Laplacian. Near-zero = one bridge from network partition.",children:n.jsx("span",{className:"text-text-muted cursor-help",children:"Fiedler λ₂"})}),n.jsx("span",{className:"tabular-nums "+(bn<.01?"text-status-warning":"text-text-secondary"),children:bn.toFixed(4)})]}),Ht.size>0&&n.jsxs("button",{onClick:()=>At(new Set),className:"w-full mt-1 text-[10px] text-accent-primary hover:underline text-center",children:["Clear filters (",Ht.size,")"]})]})]}),$n=n.jsx(x,{children:ze&&n.jsx(m.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-border-subtle",children:[n.jsx(J,{className:"w-4 h-4 text-text-muted shrink-0"}),n.jsx("input",{ref:bs,type:"text",value:He,onChange:e=>Ae(e.target.value),placeholder:"Search by name or prefix...",className:"flex-1 bg-transparent text-sm text-text-primary placeholder:text-text-muted focus:outline-none",onKeyDown:e=>{"Escape"===e.key?(Te(!1),Ae("")):"Enter"===e.key&&rn.length>0&&on(rn[0])}}),He&&n.jsx("button",{onClick:()=>Ae(""),className:"p-0.5 radius-badge hover-bg transition-base",children:n.jsx(p,{className:"w-3 h-3 text-text-muted"})})]}),rn.length>0&&n.jsx("div",{className:"max-h-64 overflow-y-auto",children:rn.map((e,t)=>n.jsxs("button",{onClick:()=>on(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:be[e.nodeClass]}}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-sm text-text-primary truncate",children:e.name||e.prefix}),e.name&&n.jsx("div",{className:"text-[10px] text-text-muted",children:e.prefix})]}),n.jsx(te,{className:"w-3 h-3 text-text-muted shrink-0"})]},e.id))}),He&&0===rn.length&&n.jsx("div",{className:"px-3 py-4 text-center text-sm text-text-muted",children:"No nodes found"}),!He&&n.jsx("div",{className:"px-3 py-2 type-data-xs text-text-muted",children:"Type to search • Enter to select • Esc to close"})]})})});return _?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:[wn,n.jsx("div",{className:"absolute inset-0 bg-bg-body flex items-center justify-center",children:n.jsx(Rt,{})})]}):js?Me?n.jsxs("div",{className:"fixed inset-0 z-50 bg-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(S,{className:"w-5 h-5 text-icon-page-title"}),n.jsxs("h1",{className:"type-title text-text-primary flex items-center gap-2",children:["MeshGraph",n.jsx(D,{color:"violet",compact:!0,children:"Analytics"})]}),n.jsxs("span",{className:"text-[10px] text-text-muted tabular-nums",children:[_s.length," nodes • ",Us.length," edges"]})]}),n.jsx(F,{content:"Exit fullscreen",children:n.jsx("button",{onClick:ln,className:"p-1.5 radius-inner hover-bg transition-base",children:n.jsx(V,{className:"w-4 h-4 text-text-muted"})})})]}),n.jsxs("div",{className:"flex-1 relative min-h-0 m-2 surface-base radius-inset overflow-hidden border border-border-subtle",children:[n.jsx(a,{className:"absolute inset-0",points:js,links:ws,...ks,...Ds,backgroundColor:je,fitViewOnInit:!0,fitViewPadding:.15,showLabels:qe,showDynamicLabels:!1,showTopLabels:qe,showTopLabelsLimit:200,showHoveredPointLabel:!0,pointLabelColor:Ne,pointClusterBy:Et?"communityId":void 0,onPolygonSelected:Zt?xn:void 0,polygonalSelectorStrokeColor:ve?"#FBBF24":"#D97706",onClick:an,onLinkClick:nn,onMount:Qs,hoveredPointRingColor:ve?"#FBBF24":"#D97706",hoveredPointCursor:"pointer",hoveredLinkCursor:"pointer"}),$n,Tn,Sn,Dn,Fn,Pn,n.jsxs(x,{children:[ke&&n.jsx(Ft,{node:ke,egoMetrics:hn,onExpandEgo:gn,neighbors:pn,onSelectNeighbor:tn,onClose:()=>{var e;Se(null),null==(e=ys.current)||e.unselectAllPoints()}}),Fe&&!ke&&n.jsx(Dt,{edge:Fe,onClose:()=>Le(null)}),Vt&&!ke&&!Fe&&n.jsx(Lt,{metrics:Vt,onClose:mn})]})]})]}):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:[wn,n.jsxs("div",{className:"absolute inset-0",children:[n.jsx(a,{className:"absolute inset-0",points:js,links:ws,...ks,...Ds,backgroundColor:je,fitViewOnInit:!0,fitViewPadding:.15,showLabels:qe,showDynamicLabels:!1,showTopLabels:qe,showTopLabelsLimit:200,showHoveredPointLabel:!0,pointLabelColor:Ne,pointClusterBy:Et?"communityId":void 0,onPolygonSelected:Zt?xn:void 0,polygonalSelectorStrokeColor:ve?"#FBBF24":"#D97706",onClick:an,onLinkClick:nn,onMount:Qs,hoveredPointRingColor:ve?"#FBBF24":"#D97706",hoveredPointCursor:"pointer",hoveredLinkCursor:"pointer"}),$n,Tn,Sn,Dn,Fn,Pn,n.jsxs("div",{className:"absolute bottom-4 right-4 z-10 hidden lg:flex items-center gap-3 type-data-xs text-text-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(x,{children:[ke&&n.jsx(Ft,{node:ke,egoMetrics:hn,onExpandEgo:gn,neighbors:pn,onSelectNeighbor:tn,onClose:()=>{var e;Se(null),null==(e=ys.current)||e.unselectAllPoints()}}),Fe&&!ke&&n.jsx(Dt,{edge:Fe,onClose:()=>Le(null)}),Vt&&!ke&&!Fe&&n.jsx(Lt,{metrics:Vt,onClose:mn})]})]})]}):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:[wn,n.jsxs("div",{className:"absolute inset-0 bg-bg-body flex flex-col items-center justify-center gap-3",children:[n.jsx(A,{className:"w-8 h-8 text-accent-primary animate-spin"}),n.jsx("span",{className:"type-body text-text-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:[wn,n.jsxs("div",{className:"absolute inset-0 bg-bg-body flex items-center justify-center",children:[n.jsx(K,{isOpen:q,onClose:re}),!q&&n.jsx(A,{className:"w-8 h-8 text-accent-primary animate-spin"})]})]})}export{Ht 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 r,Z as o}from"./vendor-react-j_fHog8x.js";import{c as l,b3 as c,b4 as d,b5 as u,A as x,m,M as h,a0 as p,aE as g,b6 as f,b7 as v,aX as b,b8 as y,b9 as j,av as N,n as w,aT as C,r as k,aY as S,e as D,T as F,ba as L,bb as R,R as M,bc as B,O as H,Q as A,bd as E,be as P,B as z,bf as T,aA as $}from"./index-B51aMfiH.js";import{u as I,G,M as O,c as Z,E as W,a as V,D as K,s as _}from"./DeepAnalysisModal-gcjnHw1P.js";import{D as U}from"./DataBox-B4su-zzA.js";import{h as q,c as X,D as Y}from"./geo-utils-n2lfanuR.js";import{E as Q,a as J,S as ee,T as te}from"./target-CE6nI9QD.js";import{L as se}from"./layers-Dd_4LhZ4.js";import{S as ne}from"./settings-2-B0bBfCqU.js";import{C as ae}from"./chevron-right-DiVetJOJ.js";import{N as ie}from"./network-D76gOy_X.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CDNU4oKM.js";import"./config-CTM8_93T.js";import"./git-branch-C_xw1lQX.js";import"./database-IcctMW15.js";import"./copy-jAVnwXtf.js";const re=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"}]]),oe=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"}]]),le=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"}]]),ce=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"}]]),de=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 ue(e){if(null==e)return"";const t=String(e);return t.includes(",")||t.includes('"')||t.includes("\n")?`"${t.replace(/"/g,'""')}"`:t}function xe(e,t){const s=[e.join(",")];for(const n of t)s.push(n.map(ue).join(","));return s.join("\n")}function me(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function he(e){return!e||e<=0?"":new Date(1e3*e).toISOString()}function pe(e,t){return`${e}-${(new Date).toISOString().replace(/[:.]/g,"-").slice(0,19)}.${t}`}const ge=["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 fe(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,he(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 ve(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 be=["fromHash","toHash","key","packetCount","certainCount","avgConfidence","strength","forwardCount","reverseCount","symmetryRatio","dominantDirection","floodCount","directCount","isDirectPathEdge","isZeroHop","isLoopEdge","isCertain","avgRssi","avgSnr","avgRecency","hopDistanceFromLocal","edgeBetweenness","isBackbone"];function ye(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 je=["pathKey","hops","hopCount","healthScore","weakestLinkKey","weakestLinkConfidence","avgEdgeCertainty","observationTrend","alternatePathsCount","estimatedLatencyMs","observationCount","routeType","lastSeen","involvesHub"];function Ne(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,he(e.lastSeen),e.involvesHub]}const we=["nodeHash","nodePrefix","nodeName","networkRole","floodFactor","directFactor","floodSlots","directSlots","trafficIntensity","directNeighborCount","collisionRisk","confidence","adjustment","dataConfidence","observationSymmetry","rationale"];function Ce(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 ke(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 r of e.nodeMetrics.values()){if(!t&&r.isGhost)continue;const e=me(r.name??r.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!=r.avgRssi&&i.push(` `),null!=r.avgSnr&&i.push(` `),i.push(" "),null==r.latitude||null==r.longitude||0===r.latitude&&0===r.longitude||i.push(` `),i.push(" ")}i.push(" "),i.push(""),i.push(" ");for(const r of e.validatedEdges){const o=e.nodeMetrics;if(!t&&((null==(s=o.get(r.fromHash))?void 0:s.isGhost)||(null==(n=o.get(r.toHash))?void 0:n.isGhost)))continue;const l=e.edgeBetweenness.get(r.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 Se(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:ve(e,t),edges:ye(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 De(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(fe(n));return xe(ge,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 xe(be,a)}(e,n),i="mesh-edges";break;case"pathHealth":a=function(e){const t=e.pathHealth.map(Ne);return xe(je,t)}(e),i="mesh-path-health";break;case"txDelay":a=function(e){const t=[];for(const[s,n]of e.txDelayRecommendations)t.push(Ce(s,n,e.nodeMetrics));return xe(we,t)}(e),i="mesh-tx-delay"}return{content:a,filename:pe(i,"csv"),mimeType:"text/csv"}}case"gexf":return{content:ke(e,s),filename:pe("mesh-topology","gexf"),mimeType:"application/xml"};default:return{content:Se(e,s,n),filename:pe("mesh-topology","json"),mimeType:"application/json"}}}function Fe(e,t,s=1){const{n:n,adjList:a,totalWeight:i,degree:r}=e;if(0===i)return!1;const o=2*i,l=new Float64Array(n);for(let u=0;up+1e-7&&(p=a,h=e)}h!==n&&(l[n]-=u,l[h]+=u,t[e]=h,d=!0,c=!0)}}return c}function Le(e,t){const{n:s,adjList:n}=e,a=new Set;for(let m=0;me-t),r=new Map;for(let m=0;m[]);for(const[m,h]of c){const[e,t]=m.split("-").map(Number),s=h/2;x[e].push({j:t,w:s}),x[t].push({j:e,w:s}),d[e]+=s,d[t]+=s,u+=s}return{newGraph:{n:o,adjList:x,totalWeight:u,degree:Array.from(d)},mapping:l}}function Re(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:r}=function(e,t,s=1){const n=t.length,a=new Map;for(let l=0;l[]),r=new Array(n).fill(0);let o=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}),r[e]+=c,r[t]+=c,o+=c}return{graph:{n:n,adjList:i,totalWeight:o,degree:r},hashToIdx:a}}(e,t,a);let o=r,l=new Int32Array(i);for(let v=0;v=o.n)break;o=e,l=new Int32Array(e.n);for(let s=0;se-t),h=new Map;for(let v=0;v=20?"excellent":e>=10?"good":e>=3?"fair":e>=0?"marginal":"critical"}function Te(e){return e>=15?"anomalous-good":e>=5?"better":e>=-5?"expected":e>=-20?"worse":"anomalous-bad"}function $e(e,t,s,n,a){const i=n.tx_power??22,r=n.spreading_factor??12,o=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,x=(null==a?void 0:a.sensitivityOverrideDbm)??Ee(r,u,o);let m=null,h=null;t&&s&&q(t.latitude??void 0,t.longitude??void 0)&&q(s.latitude??void 0,s.longitude??void 0)&&(m=X(t.latitude,t.longitude,s.latitude,s.longitude),h=m/1e3);let p=null,g=null;null!=m&&m>0&&(p=Ae(m,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=Te(b));let j=null,N=null;null!=f&&(j=f-x,N=ze(j));const w=null!=f,C="anomalous-good"===y||"anomalous-bad"===y;return{edgeKey:e.key,fromHash:e.fromHash,toHash:e.toHash,distanceM:m,distanceKm:h,fsplDb:p,theoreticalRxPowerDbm:g,observedRssiDbm:f,observedSnrDb:v,deviationDb:b,deviationClass:y,marginDb:j,marginClass:N,sensitivityDbm:x,txPowerDbm:i,frequencyMhz:c,spreadingFactor:r,bandwidthKhz:u,noiseFloorDbm:null,isZeroHop:e.isZeroHop??!1,isTraceEstimated:!1,hasData:w,isAnomalous:C}}function Ie(e,t,s,n,a=22,i){const r=e.traceQuality;if(!r)return null;let o=null;if(o=null!=r.forwardSnr&&null!=r.reverseSnr?Math.min(r.forwardSnr,r.reverseSnr):r.forwardSnr??r.reverseSnr,null==o)return null;const l=n.spreading_factor??12,c=n.coding_rate??5,d=n.bandwidth??0,u=d>1e3?d/1e3:d||125,x=1e3*u,m=n.frequency??0,h=m>1e5?m/1e6:m||915,p=(null==i?void 0:i.sensitivityOverrideDbm)??Ee(l,u,c),g=(null==i?void 0:i.observedNoiseFloorDbm)??Pe(x),f=g+o;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=X(t.latitude,t.longitude,s.latitude,s.longitude),b=v/1e3);let y=null,j=null;null!=v&&v>0&&(y=Ae(v,h),j=a+2.15+2.15-y);let N=null,w=null;null!=j&&(N=f-j,w=Te(N));const C=f-p,k=ze(C);return{edgeKey:e.key,fromHash:e.fromHash,toHash:e.toHash,distanceM:v,distanceKm:b,fsplDb:y,theoreticalRxPowerDbm:j,observedRssiDbm:f,observedSnrDb:o,deviationDb:N,deviationClass:w,marginDb:C,marginClass:k,sensitivityDbm:p,noiseFloorDbm:g,txPowerDbm:a,frequencyMhz:h,spreadingFactor:l,bandwidthKhz:u,isZeroHop:!1,isTraceEstimated:!0,hasData:!0,isAnomalous:"anomalous-good"===w||"anomalous-bad"===w}}const Ge={"anomalous-good":"#2DD4BF",better:"#34D399",expected:"#9CA3AF",worse:"#FB923C","anomalous-bad":"#EF4444"},Oe={excellent:"#34D399",good:"#A3E635",fair:"#FBBF24",marginal:"#FB923C",critical:"#EF4444"};function Ze(e,t="margin"){return e.hasData?"deviation"===t?e.deviationClass?Ge[e.deviationClass]:"#505058":e.marginClass?Oe[e.marginClass]:"#505058":"#505058"}function We(e,t=.5,s=4){return null==e.marginDb?t:t+Math.max(0,Math.min(1,e.marginDb/40))*(s-t)}let Ve=0;function Ke(){return`ta-${++Ve}-${Date.now()}`}function _e(e){return{standard:0,ghost:1,mobile:2,neighbor:3,backbone:4,gateway:5,hub:6,local:7}[e]??0}class Ue{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 o of e.edges)t.add(o.key);const s=new Map,n=new Map,a=new Map,i=new Set;for(const[o,l]of e.nodeMetrics)s.set(o,l.betweenness),n.set(o,l.communityId),a.set(o,l.nodeClass),i.add(o);const r=new Set;for(const o of e.discoveredNodes)o.isLikelyReal&&r.add(o.prefix);return{timestamp:Date.now(),edgeKeys:t,betweenness:s,communities:n,nodeClasses:a,ghostPrefixes:r,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)),r=i(t)??(null==t?void 0:t.slice(0,6));a.push({id:Ke(),detectedAt:n,category:"edge-appeared",severity:"info",description:`New edge: ${s} ↔ ${r}`,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)),r=i(t)??(null==t?void 0:t.slice(0,6));a.push({id:Ke(),detectedAt:n,category:"edge-disappeared",severity:"warning",description:`Edge lost: ${s} ↔ ${r}`,edgeKey:d})}for(const d of t.nodeHashes)if(!e.nodeHashes.has(d)){const e=i(d);a.push({id:Ke(),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:Ke(),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:Ke(),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:Ke(),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),r=u>t?"increased":"decreased";a.push({id:Ke(),detectedAt:n,category:"betweenness-shift",severity:s>=.3?"critical":"warning",description:`${e??d.slice(0,8)} betweenness ${r}: ${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:Ke(),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=_e(u)>_e(t);a.push({id:Ke(),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 r={},o={},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)r[d]=0;for(const d of c)o[d]=0;for(const d of a)r[d.category]++,o[d.severity]++;return a.sort((e,t)=>t.detectedAt-e.detectedAt),{anomalies:a,categoryCounts:r,severityCounts:o,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("-"),r=t[0],o=t[1],l=r?null==n?void 0:n.get(r):void 0,c=o?null==n?void 0:n.get(o):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=qe(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 qe(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 Xe(e){if(e.length<2)return 0;const t=e.length;let s=0,n=0,a=0,i=0;for(let o=0;o.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 r=0;0===e.alternatePathsCount?(r=1,n.push({name:"No alternate paths",description:"Single route to destination — no failover available",score:r,weight:.2})):1===e.alternatePathsCount&&(r=.5,n.push({name:"Limited redundancy",description:"Only 1 alternate path available",score:r,weight:.2}));let o=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?(o=1,n.push({name:"Signal near sensitivity",description:`Weakest link: ${e.toFixed(1)} dB margin (< 3 dB)`,score:o,weight:Ye})):e<10&&(o=1-(e-3)/7,n.push({name:"Low signal margin",description:`Weakest link: ${e.toFixed(1)} dB margin`,score:o,weight:Ye}))}}const l=.35*a+.3*i+.2*r+o*Ye;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 Je=100;function et(){return++Je}const tt="meshgraph-panel-";function st(e){try{const t=localStorage.getItem(tt+e);return t?JSON.parse(t):null}catch{return null}}function nt({id:e,title:t,icon:a,open:i,onClose:r,defaultPosition:o,defaultSize:l,minSize:c={width:180,height:120},maxSize:d,autoHeight:u=!1,headerActions:g,children:f}){const v=I(),b=s.useRef(null),y=s.useRef(null),j=s.useMemo(()=>{const t=st(e);return t?{x:t.x,y:t.y,w:t.w,h:u?l.height:t.h,minimized:t.minimized}:{x:o.x,y:o.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,D]=s.useState(()=>et()),[F,L]=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=st(e),a=(r=(null==n?void 0:n.x)??j.x,o=(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(r,Math.max(8,c-l-8))),y:Math.max(8,Math.min(o,Math.max(8,d-36)))});var r,o,l,c,d;L(a)},[i,e]);const[R,M]=s.useState(!1),B=s.useRef({startX:0,startY:0,startW:0,startH:0,edge:""}),H=s.useRef(),A=s.useCallback(()=>{H.current&&clearTimeout(H.current),H.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(tt+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(()=>{A()},[N,C,A]);const E=s.useCallback(()=>{D(et())},[]),P=s.useCallback(()=>{k(e=>!e)},[]),z=s.useCallback((e,t)=>{e.preventDefault(),e.stopPropagation(),M(!0),B.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}=B.current,r=e.clientX-t,o=e.clientY-s;let l=n,u=a;"e"!==i&&"se"!==i||(l=Math.max(c.width,n+r),d&&(l=Math.min(d.width,l))),"s"!==i&&"se"!==i||(u=Math.max(c.height,a+o),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(x,{children:i&&n.jsxs(m.div,{ref:y,drag:!R,dragControls:v,dragConstraints:b,dragElastic:.05,dragMomentum:!1,dragListener:!1,initial:{opacity:0,scale:.96,x:F.x,y:F.y},animate:{opacity:1,scale:1,x:F.x,y:F.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-border-subtle cursor-grab active:cursor-grabbing select-none shrink-0",onPointerDown:e=>{E(),v.start(e)},children:[n.jsx(G,{className:"w-3 h-3 text-text-muted/50 shrink-0"}),a&&n.jsx("span",{className:"text-text-muted shrink-0 [&>svg]:w-3 [&>svg]:h-3",children:a}),n.jsx("span",{className:"text-[11px] font-medium text-text-primary flex-1 truncate",children:t}),g,n.jsx("button",{onClick:P,className:"p-0.5 radius-badge hover-bg transition-base",title:C?"Expand":"Minimize",children:C?n.jsx(O,{className:"w-2.5 h-2.5 text-text-muted"}):n.jsx(h,{className:"w-2.5 h-2.5 text-text-muted"})}),n.jsx("button",{onClick:r,className:"p-0.5 radius-badge hover-bg transition-base",title:"Close",children:n.jsx(p,{className:"w-2.5 h-2.5 text-text-muted"})})]}),n.jsx(x,{initial:!1,children:!C&&n.jsx(m.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=>z(e,"e")}),n.jsx("div",{className:"absolute -bottom-1 left-0 w-full h-2 cursor-ns-resize",onPointerDown:e=>z(e,"s")}),n.jsx("div",{className:"absolute -bottom-1 -right-1 w-3 h-3 cursor-nwse-resize",onPointerDown:e=>z(e,"se"),children:n.jsxs("svg",{className:"w-full h-full text-text-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 at=800,it={critical:["#EF4444","#DC2626"],poor:["#F97316","#EA580C"],fair:["#FBBF24","#D97706"],good:["#34D399","#059669"],excellent:["#60A5FA","#2563EB"]},rt={active:1,recent:.85,stale:.45,inactive:.25},ot=["#A78BFA","#34D399","#FBBF24","#F87171","#60A5FA","#F472B6","#2DD4BF","#FB923C"],lt=["#7C3AED","#059669","#D97706","#DC2626","#2563EB","#DB2777","#0D9488","#EA580C"],ct={zeroHop:"#C8A850",directPath:"#70A8AA",loop:"#9888B0",backbone:"#B0B0B8",standard:"#707078",standardDim:"#505058",ghost:"#606068"},dt={zeroHop:"#A08030",directPath:"#308080",loop:"#685898",backbone:"#404048",standard:"#909098",standardDim:"#B0B0B8",ghost:"#A0A0A8"},ut=!1,xt=!0,mt=!0,ht=!0,pt=!0,gt=!0,ft={local:"#FFB224",hub:"#A78BFA",gateway:"#60A5FA",backbone:"#34D399",neighbor:"#F472B6",mobile:"#FB923C",ghost:"#A1A1AA",standard:"#D4D4D8"},vt={local:"#FFB224",hub:"#7C3AED",gateway:"#2563EB",backbone:"#059669",neighbor:"#DB2777",mobile:"#EA580C",ghost:"#71717A",standard:"#52525B"},bt={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 yt(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 jt(e,t,s){const[n,a,i]=yt(e),[r,o,l]=yt(t),c=Math.max(0,Math.min(1,s)),d=Math.round(n*c+r*(1-c)),u=Math.round(a*c+o*(1-c)),x=Math.round(i*c+l*(1-c));return`#${d.toString(16).padStart(2,"0")}${u.toString(16).padStart(2,"0")}${x.toString(16).padStart(2,"0")}`}function Nt(e,t){return e.isZeroHop?"zero-hop":e.isDirectPathEdge?"direct-path":e.isLoopEdge?"loop":t.has(e.key)?"backbone":"standard"}function wt(e,t,s){const n=s?ct:dt;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 Ct={"zero-hop":"Zero-Hop (Direct RF)","direct-path":"Direct Path (Unicast)",loop:"Redundant Loop",backbone:"Backbone",standard:"Standard",ghost:"Ghost (Inferred)"},kt={"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"},St=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),[r,o]=e.snrRange,l=Math.max(1,o-r),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-r)/l);return`${s.toFixed(1)},${n.toFixed(1)}`}).join(" "),x=e.rssiTrend>.1?"↑":e.rssiTrend<-.1?"↓":"→",m=e.snrTrend>.1?"↑":e.snrTrend<-.1?"↓":"→",h=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],r=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||r>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-border-subtle/50",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx(F,{content:n.jsxs("div",{className:"max-w-xs space-y-1.5",children:[n.jsx("div",{className:"font-semibold text-text-primary",children:"Signal Quality Over Time"}),n.jsx("div",{className:"text-text-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-border-subtle/30 space-y-0.5 font-mono text-[10px]",children:[n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Samples"}),n.jsx("span",{className:"text-text-primary tabular-nums",children:e.totalSamples})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Time span"}),n.jsxs("span",{className:"text-text-primary tabular-nums",children:[g,"h"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Avg RSSI"}),n.jsxs("span",{className:"text-text-primary tabular-nums",children:[e.avgRssi.toFixed(1)," dBm"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Avg SNR"}),n.jsxs("span",{className:"text-text-primary tabular-nums",children:[e.avgSnr.toFixed(1)," dB"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"RSSI trend"}),n.jsxs("span",{className:"tabular-nums",style:{color:h},children:[e.rssiTrend>0?"+":"",e.rssiTrend.toFixed(3)," dBm/bucket"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-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-text-muted italic",children:["Trend is linear regression slope across ",t.length," time buckets. ↑ = improving, ↓ = degrading, → = stable."]})]}),children:n.jsx("span",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Signal Timeline"})}),n.jsxs("span",{className:"text-[9px] text-text-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-text-muted",children:"RSSI"}),n.jsx("span",{className:"tabular-nums",style:{color:h},children:x})]}),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-text-muted",children:"SNR"}),n.jsx("span",{className:"tabular-nums",style:{color:p},children:m})]})]}),n.jsxs("div",{className:"flex items-center gap-2 text-text-muted tabular-nums",children:[n.jsxs("span",{children:[s.toFixed(0),"…",a.toFixed(0)," dBm"]}),n.jsxs("span",{children:[r.toFixed(0),"…",o.toFixed(0)," dB"]})]})]}),n.jsx("div",{className:"mt-1 text-[9px] leading-tight",style:{color:f.color},children:f.text})]})}),Dt=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=$.getState().packets,s=$.getState().cachedLocalHash??void 0,n=function(e,t,s,n,a=24){const i=function(e,t,s,n){var a;const i=[],r=t.replace(/^0x/i,"").slice(0,2).toLowerCase();for(const o of e){if(o.transmitted)continue;if(null==o.rssi||null==o.snr)continue;if(0===o.rssi&&0===o.snr)continue;const e=(null==(a=o.src_hash)?void 0:a.replace(/^0x/i,""))??"";if(e.slice(0,2).toLowerCase()!==r&&e!==t.replace(/^0x/i,""))continue;const s=o.original_path??o.forwarded_path??[],l=d(s,n),c=(null==l?void 0:l.effectiveLength)??0,x=o.route??o.route_type;let m=!1;m=null!=x&&u(x)?c<=1:0===c,m&&i.push({timestamp:1e3*o.timestamp,rssi:o.rssi,snr:o.snr})}if(i.sort((e,t)=>e.timestamp-t.timestamp),i.length>0&&i[0].timestamp<4102444800)for(const o of i)o.timestamp*=1e3;return i}(e,t,0,n);if(i.length<3)return null;const r=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 o=0;o0&&(o.avgRssi/=o.count,o.avgSnr/=o.count,r.push(o));return r}(i,a);if(r.length<2)return null;let o=0,l=0,c=1/0,x=-1/0,m=1/0,h=-1/0;for(const d of i)o+=d.rssi,l+=d.snr,c=Math.min(c,d.rssi),x=Math.max(x,d.rssi),m=Math.min(m,d.snr),h=Math.max(h,d.snr);const p=Xe(r.map(e=>e.avgRssi)),g=Xe(r.map(e=>e.avgSnr)),f=i[0].timestamp,v=i[i.length-1].timestamp;return{buckets:r,totalSamples:i.length,rssiRange:[c,x],snrRange:[m,h],avgRssi:o/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(m.div,{variants:_,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-border-subtle/50",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(re,{className:"size-3.5 text-text-muted shrink-0"}),n.jsxs("span",{className:"text-sm font-semibold text-text-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(D,{color:"zinc",compact:!0,children:Ct[e.edgeType]}),e.isBackbone&&n.jsx(D,{color:"emerald",compact:!0,children:"BONE"}),e.isLoopEdge&&n.jsx(D,{color:"purple",compact:!0,children:"LOOP"}),e.isGhost&&n.jsx(D,{color:"zinc",compact:!0,children:"GHOST"})]})]}),n.jsx(z,{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(F,{content:"Average disambiguation confidence across all observations of this edge",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Confidence"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[(100*e.confidence).toFixed(0),"%"]})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Observations where both endpoints had high-confidence disambiguation",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Certain"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.certainCount.toLocaleString()})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Total packets observed traversing this edge",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Packets"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.packetCount.toLocaleString()})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Combined certainCount × confidence metric for edge ranking",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Strength"})}),n.jsx("div",{className:"text-text-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(F,{content:"Bidirectional balance (min/max) — 0 = one-way traffic, 1 = perfectly balanced",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Symmetry"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.symmetryRatio.toFixed(2)})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Dominant traffic flow direction between these nodes",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Direction"})}),n.jsx("div",{className:"text-text-primary capitalize",children:e.dominantDirection})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Forward (A→B) vs reverse (B→A) observation counts",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Fwd / Rev"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[e.forwardCount," / ",e.reverseCount]})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Routing method — broadcast flood vs unicast direct routing",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Flood / Direct"})}),n.jsxs("div",{className:"text-text-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-border-subtle/50",children:[null!=e.avgRssi&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-muted uppercase",children:"RSSI"}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[e.avgRssi.toFixed(1)," dBm"]})]}),null!=e.avgSnr&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-muted uppercase",children:"SNR"}),n.jsxs("div",{className:"text-text-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-border-subtle/50",children:[null!=e.linkBudget.distanceKm&&n.jsxs("div",{children:[n.jsx(F,{content:"Haversine distance between endpoint locations",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Distance"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[e.linkBudget.distanceKm.toFixed(2)," km"]})]}),null!=e.linkBudget.fsplDb&&n.jsxs("div",{children:[n.jsx(F,{content:"Free Space Path Loss — theoretical signal attenuation over this distance at configured frequency",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"FSPL"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[e.linkBudget.fsplDb.toFixed(1)," dB"]})]}),null!=e.linkBudget.marginDb&&n.jsxs("div",{children:[n.jsx(F,{content:"Link margin — observed RSSI minus receiver sensitivity. Positive = signal headroom above minimum.",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Margin"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",style:{color:e.linkBudget.marginClass?Oe[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(F,{content:"Deviation from theoretical FSPL — positive means better signal than free-space prediction",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"vs Theory"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[e.linkBudget.deviationDb>0?"+":"",e.linkBudget.deviationDb.toFixed(1)," dB"]})]})]}),a&&n.jsx(St,{timeline:a})]})]})}),Ft=s.memo(function({node:e,onClose:t,egoMetrics:a,onExpandEgo:i,neighbors:r,onSelectNeighbor:o}){const[l,c]=s.useState(!1);return n.jsxs(m.div,{variants:_,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-border-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:(P()?ft:vt)[e.nodeClass]}}),n.jsx("code",{className:"text-sm font-semibold text-text-primary shrink-0",children:e.prefix}),e.name&&n.jsx("span",{className:"text-sm text-text-secondary truncate",children:e.name}),n.jsxs("div",{className:"flex gap-1 shrink-0",children:[e.isLocal&&n.jsx(D,{color:"yellow",compact:!0,children:"LOCAL"}),e.isHub&&n.jsx(D,{color:"violet",compact:!0,children:"HUB"}),e.isGateway&&n.jsx(D,{color:"sky",compact:!0,children:"GW"}),e.isBackbone&&n.jsx(D,{color:"emerald",compact:!0,children:"BONE"}),e.isMobile&&n.jsx(D,{color:"orange",compact:!0,children:"MOB"}),e.isZeroHop&&n.jsx(D,{color:"amber",compact:!0,children:"RF"}),e.isGhost&&n.jsx(D,{color:"zinc",compact:!0,children:"GHOST"}),e.isInLoop&&n.jsx(D,{color:"purple",compact:!0,children:"LOOP"})]})]}),n.jsx(z,{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(U,{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(F,{content:"Total connections (edges) to this node",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Degree"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.degree})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Inbound vs outbound edge count — indicates traffic directionality",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"In / Out"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[e.inDegree," / ",e.outDegree]})]}),n.jsxs("div",{children:[n.jsx(F,{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-text-muted uppercase cursor-help",children:"Between."})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.betweenness.toFixed(3)})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Total packets observed involving this node",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Packets"})}),n.jsx("div",{className:"text-text-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(F,{content:"Number of topology edges connected to this node",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Edges"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.edgeCount})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Community cluster assignment from graph partitioning algorithm",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Community"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:["#",e.communityId]})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Prefix disambiguation confidence — how certain the 2-char prefix→node mapping is (multi-factor scoring)",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Confidence"})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[(100*e.prefixConfidence).toFixed(0),"%"]})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Recency level — active (<1h), recent (<6h), stale (<24h), inactive (>24h)",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Activity"})}),n.jsx("div",{className:"text-text-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-border-subtle/50",children:[null!=e.avgRssi&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-muted uppercase",children:"RSSI"}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[e.avgRssi.toFixed(1)," dBm"]})]}),null!=e.avgSnr&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-muted uppercase",children:"SNR"}),n.jsxs("div",{className:"text-text-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-border-subtle/50",children:[n.jsxs("div",{children:[n.jsx(F,{content:"Number of direct 1-hop neighbors in the topology",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Ego Size"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:a.neighborCount})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Local clustering coefficient — how interconnected this node's neighbors are (0 = none, 1 = fully connected)",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Clustering"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:a.clusteringCoeff.toFixed(3)})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Average betweenness centrality of this node's direct neighbors",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Avg Nbr Btw."})}),n.jsx("div",{className:"text-text-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(F,{content:"Average disambiguation confidence across all connected edges",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Edge Conf."})}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[(100*a.avgEdgeConfidence).toFixed(0),"%"]})]}),null!=a.avgRssi&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-muted uppercase",children:"Avg RSSI"}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[a.avgRssi.toFixed(1)," dBm"]})]}),null!=a.avgSnr&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-muted uppercase",children:"Avg SNR"}),n.jsxs("div",{className:"text-text-primary tabular-nums",children:[a.avgSnr.toFixed(1)," dB"]})]})]})]}),i&&n.jsx("div",{className:"mt-2 pt-2 border-t border-border-subtle/50",children:n.jsxs("button",{onClick:i,className:"flex items-center gap-1.5 text-[10px] text-accent-primary hover:text-accent-primary/80 transition-base",children:[n.jsx(T,{className:"w-3 h-3"}),"Expand 2-hop neighborhood"]})}),r&&r.length>0&&n.jsxs("div",{className:"mt-2 pt-2 border-t border-border-subtle/50",children:[n.jsxs("button",{onClick:()=>c(e=>!e),className:"flex items-center justify-between w-full text-[9px] text-text-muted uppercase tracking-wide cursor-pointer hover:text-text-secondary transition-base",children:[n.jsxs("span",{children:["Neighbors (",r.length,")"]}),n.jsx(H,{className:"w-3 h-3 transition-transform "+(l?"rotate-180":"")})]}),l&&n.jsx("div",{className:"mt-1.5 max-h-32 overflow-y-auto space-y-0.5",children:r.map(e=>n.jsxs("button",{onClick:()=>null==o?void 0:o(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-accent-primary shrink-0 tabular-nums",children:e.prefix}),n.jsx("span",{className:"text-[10px] text-text-secondary truncate flex-1",children:e.name||"—"}),null!=e.avgSnr&&n.jsxs("span",{className:"text-[9px] text-text-muted tabular-nums shrink-0",children:[e.avgSnr.toFixed(0)," dB"]}),null!=e.avgRssi&&n.jsx("span",{className:"text-[9px] text-text-muted tabular-nums shrink-0",children:e.avgRssi.toFixed(0)}),n.jsxs("span",{className:"text-[9px] text-text-muted/60 tabular-nums shrink-0",children:[(100*e.edgeConfidence).toFixed(0),"%"]})]},e.hash))})]})]})]})}),Lt=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(m.div,{variants:_,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-border-subtle/50",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(ce,{className:"size-3.5 text-text-muted shrink-0"}),n.jsx("span",{className:"text-sm font-semibold text-text-primary",children:"Subgraph Analysis"}),n.jsxs(D,{color:"violet",compact:!0,children:[e.nodeCount," nodes"]})]}),n.jsx(z,{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-text-muted uppercase",children:"Nodes"}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.nodeCount})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Edges where both endpoints are within the lasso selection",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Internal Edges"})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.edgeCount})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Mean betweenness centrality of selected nodes",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Avg Between."})}),n.jsx("div",{className:"text-text-primary tabular-nums",children:e.avgBetweenness.toFixed(3)})]}),n.jsxs("div",{children:[n.jsx(F,{content:"Mean edge disambiguation confidence for internal edges",children:n.jsx("div",{className:"text-[9px] text-text-muted uppercase cursor-help",children:"Avg Confidence"})}),n.jsxs("div",{className:"text-text-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-border-subtle/50",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-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-text-secondary",children:["#",e,"×",t]},e))})]}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[9px] text-text-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-text-secondary capitalize",children:[e,"×",t]},e))})]})]}),e.nodeCount>1&&n.jsx("div",{className:"mt-2 pt-2 border-t border-border-subtle/50",children:n.jsxs("div",{className:"text-[9px] text-text-muted flex items-center gap-1 flex-wrap",children:[n.jsx(F,{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(F,{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(F,{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 Rt(){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(ie,{className:"w-8 h-8 text-text-muted"})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("h2",{className:"type-subheading text-text-primary",children:"No Topology Data"}),n.jsx("p",{className:"type-body text-text-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-text-muted",children:[n.jsx(M,{className:"w-4 h-4 animate-pulse"}),n.jsx("span",{children:"Waiting for mesh traffic..."})]})]})}const Mt=s.memo(function({label:e,value:t,onChange:a,min:i,max:r,step:o}){const[l,c]=s.useState(!1),[d,u]=s.useState(""),x=s.useRef(null),m=s.useCallback(()=>{const e=parseFloat(d);isNaN(e)||a(Math.min(r,Math.max(i,Math.round(e/o)*o))),c(!1)},[d,a,i,r,o]),h=s.useCallback(()=>{u(t.toFixed(2)),c(!0),setTimeout(()=>{var e;return null==(e=x.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-text-muted",children:e}),l?n.jsx("input",{ref:x,type:"number",value:d,onChange:e=>u(e.target.value),onBlur:m,onKeyDown:e=>{"Enter"===e.key&&m(),"Escape"===e.key&&c(!1)},min:i,max:r,step:o,className:"w-14 text-right text-[10px] text-text-secondary tabular-nums bg-subtle-fill radius-badge px-1 py-0.5 border border-border-subtle focus:outline-none focus:border-accent-primary"}):n.jsx("button",{onClick:h,className:"text-[10px] text-text-secondary tabular-nums hover:text-accent-primary cursor-text transition-colors",title:"Click to type a value",children:t.toFixed(2)})]}),n.jsx("input",{type:"range",min:i,max:r,step:o,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-accent-primary [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:cursor-pointer"})]})}),Bt=s.memo(function({label:e,checked:t,onChange:s}){return n.jsxs(r,{className:"flex items-center justify-between",children:[n.jsx(o,{className:"text-[10px] text-text-muted cursor-pointer select-none",children:e}),n.jsx(E,{enabled:t,onChange:s,size:"sm"})]})});function Ht(){var e,t,r,o,l,c,d,u,h,E,P,z,T,$,I;const G=g(),[_,U]=s.useState(!1),[q,X]=s.useState(!1),ie=s.useRef(!1);s.useEffect(()=>{G&&!ie.current&&(ie.current=!0,X(!0))},[G]);const re=s.useCallback(()=>{X(!1),U(!0)},[]),ue=f(),xe=function(e,t=1e3){const[n,a]=s.useState(e),i=s.useRef(Date.now()),r=s.useRef(null);return s.useEffect(()=>{const s=Date.now(),n=t-(s-i.current);return n<=0?(a(e),i.current=s):(r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{a(e),i.current=Date.now()},n)),()=>{r.current&&clearTimeout(r.current)}},[e,t]),n}(v(),2e3),me=b(),he=y(),pe=j(),ge=N(),fe=w(),ve=C(),be=ve?ft:vt,ye=ve?ot:lt,je=s.useMemo(()=>function(e){if("undefined"==typeof document)return e?"#171717":"#EFF0F1";const t=getComputedStyle(document.documentElement).getPropertyValue("--bg-body").trim();return t.startsWith("#")?t:e?"#171717":"#EFF0F1"}(ve),[ve]),Ne=s.useMemo(()=>function(e){if("undefined"==typeof document)return e?"#A1A1AA":"#71717A";const t=getComputedStyle(document.documentElement).getPropertyValue("--text-secondary").trim();return t.startsWith("#")?t:e?"#A1A1AA":"#71717A"}(ve),[ve]),[we,Ce]=s.useState(!0),[ke,Se]=s.useState(null),[Fe,Le]=s.useState(null),[Me,Be]=s.useState(!1),[He,Ae]=s.useState(""),[ze,Te]=s.useState(!1),[Ge,Ve]=s.useState(!1),[Ke,_e]=s.useState("simulation"),[qe,Xe]=s.useState(!0),[Ye,Je]=s.useState(!1),[et,tt]=s.useState(!0),[st,yt]=s.useState(!1),[Ct,St]=s.useState(!1),[Ht,At]=s.useState(new Set),[Et,Pt]=s.useState(!1),[zt,Tt]=s.useState("spectral"),[$t,It]=s.useState(1),[Gt,Ot]=s.useState(1),[Zt,Wt]=s.useState(!1),[Vt,Kt]=s.useState(null),[_t,Ut]=s.useState(!1),[qt,Xt]=s.useState(!1),[Yt,Qt]=s.useState(null),[Jt,es]=s.useState(null),[ts,ss]=s.useState(null),[ns,as]=s.useState(null),[is,rs]=s.useState(null),[os,ls]=s.useState(null),cs=s.useRef(!1),[ds,us]=s.useState(!1),[xs,ms]=s.useState([]),[hs,ps]=s.useState(0),[gs,fs]=s.useState(null),vs=s.useRef(new Ue),bs=s.useRef(null),ys=s.useRef(null),[js,Ns]=s.useState(null),[ws,Cs]=s.useState(null),[ks,Ss]=s.useState({}),[Ds,Fs]=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:ut,curvedLinkWeight:.8,linkDefaultArrows:xt,linkArrowsSizeScale:1.7,scalePointsOnZoom:mt,scaleLinksOnZoom:ht,renderLinks:pt,renderHoveredPointRing:gt,spaceSize:4096}),Ls=s.useCallback((e,t)=>{Fs(s=>({...s,[e]:t}))},[]),Rs=s.useCallback(()=>{Fs({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:ut,curvedLinkWeight:.8,linkDefaultArrows:xt,linkArrowsSizeScale:1.7,scalePointsOnZoom:mt,scaleLinksOnZoom:ht,renderLinks:pt,renderHoveredPointRing:gt,spaceSize:4096})},[]);s.useEffect(()=>()=>{var e;try{null==(e=ys.current)||e.destroy()}catch{}ys.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=ys.current)||t.fitView(at));break;case"escape":ze?(Te(!1),Ae("")):ke&&(Se(null),null==(s=ys.current)||s.unselectAllPoints());break;case"/":ze||(e.preventDefault(),Te(!0),setTimeout(()=>{var e;return null==(e=bs.current)?void 0:e.focus()},50));break;case" ":e.preventDefault(),ys.current&&(we?ys.current.pause():ys.current.start(),Ce(e=>!e));break;case"l":Xe(e=>!e)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ze,ke,we]);const Ms=s.useMemo(()=>new Set((null==ue?void 0:ue.backboneEdges)??[]),[null==ue?void 0:ue.backboneEdges]),Bs=s.useMemo(()=>({resolution:$t,kWeight:Gt}),[$t,Gt]),Hs=s.useMemo(()=>{if("louvain"!==zt)return null;const e=null==ue?void 0:ue.edges;return!e||0===e.length||!xe||xe.size<3?null:Re(e,Array.from(xe.keys()),Bs).communities},[zt,null==ue?void 0:ue.edges,xe,Bs]),As=s.useMemo(()=>{var e;if(!xe||0===xe.size||!_)return[];const t=[],s=(null==fe?void 0:fe.node_name)??(null==(e=null==fe?void 0:fe.config)?void 0:e.node_name)??null,n=ve?"#171717":"#EFF0F1";let a=1;for(const i of xe.values())i.degree>a&&(a=i.degree);for(const i of xe.values()){const e=i,r=e.degree>0?Math.log10(e.degree+1)/Math.log10(a+1):0,o=5+23*Math.min(1,r),l=6*e.betweenness,c=e.isLocal?28:Math.min(34,o+l),d=(null==Hs?void 0:Hs.get(e.hash))??e.communityId,u=Et&&d>=0?ye[d%ye.length]:be[e.nodeClass],x=rt[e.activityLevel]??1,m=e.isLocal?be.local:x<1?jt(u,n,x):u,h=e.isLocal?s??e.name:e.name;t.push({id:e.hash,label:h?`${e.prefix} ${h}`:e.prefix,color:m,size:c,nodeClass:e.nodeClass,name:h,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==Hs?void 0:Hs.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 me){const e=`ghost-${i.prefix}`;if(t.some(t=>t.id===e))continue;const s=jt(be.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},[xe,_,null==fe?void 0:fe.node_name,null==(e=null==fe?void 0:fe.config)?void 0:e.node_name,be,ve,me,ye,Et,zt,Hs]),Es=s.useMemo(()=>new Set(As.map(e=>e.id)),[As]),Ps=s.useMemo(()=>{const e=new Map;if(!xe)return e;for(const t of xe.values())e.set(t.hash,t.name);return e},[xe]),zs=s.useMemo(()=>{const e=(null==ue?void 0:ue.edges)??[];if(!e.length||!_)return[];const t=[],s=(null==ue?void 0:ue.edgeBetweenness)??new Map;for(const a of e){if(!Es.has(a.fromHash)||!Es.has(a.toHash))continue;const e=Nt(a,Ms),n=wt(e,a.avgConfidence,ve),i=s.get(a.key)??0,r=i>0?.5+4*i:.5+2*Math.min(1,a.certainCount/50);t.push({source:a.fromHash,target:a.toHash,color:n,width:r,key:a.key,packetCount:a.packetCount,certainCount:a.certainCount,confidence:a.avgConfidence,symmetryRatio:a.symmetryRatio,dominantDirection:a.dominantDirection,isBackbone:Ms.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:Ps.get(a.fromHash)??null,toName:Ps.get(a.toHash)??null,edgeType:e})}const n=ve?ct:dt;for(const a of me){const e=`ghost-${a.prefix}`;if(Es.has(e))for(const s of a.commonNeighbors)Es.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:Ps.get(s)??null,edgeType:"ghost"})}return t},[null==ue?void 0:ue.edges,null==ue?void 0:ue.edgeBetweenness,_,Es,ve,Ms,Ps,me]),Ts=null==(r=null==(t=null==fe?void 0:fe.config)?void 0:t.radio)?void 0:r.frequency,$s=null==(l=null==(o=null==fe?void 0:fe.config)?void 0:o.radio)?void 0:l.bandwidth,Is=null==(d=null==(c=null==fe?void 0:fe.config)?void 0:c.radio)?void 0:d.spreading_factor,Gs=null==(h=null==(u=null==fe?void 0:fe.config)?void 0:u.radio)?void 0:h.tx_power,Os=null==(P=null==(E=null==fe?void 0:fe.config)?void 0:E.radio)?void 0:P.coding_rate;s.useEffect(()=>{qt&&!cs.current&&(cs.current=!0,(async()=>{var e,t;try{const s=await k(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)];ls(s)}}}catch{}})())},[qt]);const Zs=s.useMemo(()=>{if(!ue||!qt)return null;const e={frequency:Ts,bandwidth:null!=ts?1e3*ts:$s,spreading_factor:Jt??Is,tx_power:Yt??Gs,coding_rate:ns??Os},t={};return null!=is&&(t.sensitivityOverrideDbm=is),null!=os&&(t.observedNoiseFloorDbm=os),function(e,t,s){const n=[],a=e.nodeMetrics,i=new Set,r=t.tx_power??22;for(const o of e.edges){if(!o.isZeroHop)continue;const e=a.get(o.fromHash),r=a.get(o.toHash);n.push($e(o,e,r,t,s)),i.add(o.key)}for(const o of e.edges){if(i.has(o.key))continue;if(!o.traceQuality)continue;const e=Ie(o,a.get(o.fromHash),a.get(o.toHash),t,r,s);e&&(n.push(e),i.add(o.key))}return n}(ue,e,t)},[ue,qt,Ts,$s,Is,Gs,Os,Yt,Jt,ts,ns,is,os]),Ws=s.useMemo(()=>{if(!Zs)return null;const e=new Map;for(const t of Zs)e.set(t.edgeKey,t);return e},[Zs]),Vs=s.useMemo(()=>Zs&&0!==Zs.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,r=null,o=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),(!r||c.marginDb>(r.marginDb??-1/0))&&(r=c)),c.marginClass&&s[c.marginClass]++,null!=c.deviationDb&&c.deviationClass?(t[c.deviationClass]++,l++):o++);return{totalEdges:e.length,analyzedEdges:l,rssiOnlyEdges:o,avgMarginDb:a>0?n/a:null,worstMargin:i,bestMargin:r,deviationCounts:t,marginCounts:s,anomalousCount:t["anomalous-good"]+t["anomalous-bad"]}}(Zs):null,[Zs]),Ks=s.useMemo(()=>{if(!qt||!Ws)return zs;const e=ve?"#303038":"#D0D0D8";return zs.map(t=>{const s=Ws.get(t.key);return s&&s.hasData?{...t,color:Ze(s,"margin"),width:We(s),linkBudget:s}:{...t,color:e,width:.3}})},[zs,qt,Ws,ve]),_s=s.useMemo(()=>0===Ht.size?As:As.filter(e=>!Ht.has(e.nodeClass)),[As,Ht]),Us=s.useMemo(()=>{if(0===Ht.size)return Ks;const e=new Set(_s.map(e=>e.id));return Ks.filter(t=>e.has(t.source)&&e.has(t.target))},[Ks,_s,Ht]),qs=s.useRef([]);s.useEffect(()=>{qs.current=Us},[Us]);const Xs=s.useMemo(()=>{const e=new Map;for(const t of zs)e.set(t.source,(e.get(t.source)??0)+1),e.set(t.target,(e.get(t.target)??0)+1);return e},[zs]),Ys=s.useMemo(()=>{const e=new Map;for(const t of As)e.set(t.id,t);return e},[As]);s.useEffect(()=>{if(0===_s.length)return Ns(null),Cs(null),void Ss({});let e=!1;const t=setTimeout(async()=>{try{const t=_s.map(e=>({id:e.id,label:e.label,color:e.color,size:e.size,communityId:String(e.communityId)})),s=Us.map(e=>({source:e.source,target:e.target,color:e.color,width:e.width})),n={points:{pointIdBy:"id",pointColorBy:"color",pointColorStrategy:"direct",pointDefaultColor:ve?"#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:ve?"#6B7280":"#9CA3AF",linkWidthBy:"width",linkWidthStrategy:"direct",linkDefaultWidth:1,linkWidthScale:1,linkGreyoutOpacity:.1}},a=await i(n,t,s);if(e||!a)return;Ns(a.points??null),Cs(a.links??null),Ss(a.cosmographConfig??{})}catch(t){}},100);return()=>{e=!0,clearTimeout(t)}},[_s,Us,ve]);const Qs=s.useCallback(e=>{e&&(ys.current=e,e.start(),setTimeout(()=>{e.fitView(at)},1500))},[]),Js=s.useCallback(()=>{var e;null==(e=ys.current)||e.fitView(at)},[]),en=s.useCallback(()=>{const e=ys.current;e&&(we?e.pause():e.start(),Ce(!we))},[we]),tn=s.useCallback(async e=>{const t=ys.current,s=Ys.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{}Le(null),Se({hash:e,name:s.name,prefix:s.prefix,nodeClass:s.nodeClass,packetCount:s.packetCount,edgeCount:Xs.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})}},[Ys,Xs]),sn=s.useRef(null);s.useEffect(()=>{sn.current=Ws},[Ws]);const nn=s.useCallback(e=>{var t;if(void 0===e)return void Le(null);const s=qs.current[e];if(!s)return;const n=null==(t=sn.current)?void 0:t.get(s.key);Le(n&&!s.linkBudget?{...s,linkBudget:n}:s),Se(null)},[]),an=s.useCallback(async(e,t,s)=>{var n;if(void 0===e)return Se(null),Kt(null),void(null==(n=ys.current)||n.unselectAllPoints());Le(null);const a=ys.current;if(a)try{const t=await a.getPointIdsByIndices([e]);if(!t||0===t.length)return;const s=t[0],n=Ys.get(s);if(!n)return;a.selectPoint(e,!1,!0),Se({hash:s,name:n.name,prefix:n.prefix,nodeClass:n.nodeClass,packetCount:n.packetCount,edgeCount:Xs.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{}},[Ys,Xs]),rn=s.useMemo(()=>{if(!ze||!He.trim())return[];const e=He.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,He,ze]),on=s.useCallback(e=>{Te(!1),Ae(""),tn(e.id)},[tn]),ln=s.useCallback(()=>{Be(e=>!e)},[]),cn=s.useCallback(e=>{At(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]),dn=s.useCallback(()=>{Pt(e=>{const t=!e,s=ys.current;return s&&s.start(.5),t})},[]),un=s.useCallback(()=>{Wt(e=>{const t=!e,s=ys.current;return s?(t?s.activatePolygonalSelection():(s.deactivatePolygonalSelection(),Kt(null),s.unselectAllPoints()),t):t})},[]),xn=s.useCallback(async()=>{const e=ys.current;if(!e)return;await new Promise(e=>setTimeout(e,80));const t=e.getSelectedPointIndices();if(!t||0===t.length)return void Kt(null);const s=await e.getPointIdsByIndices(t);if(!s||0===s.length)return void Kt(null);const n=new Set(s);let a=0,i=0;for(const x of qs.current)n.has(x.source)&&n.has(x.target)&&(a++,i+=x.confidence);let r=0;const o={},l={};for(const x of s){const e=Ys.get(x);e&&(r+=e.betweenness,o[e.communityId]=(o[e.communityId]??0)+1,l[e.nodeClass]=(l[e.nodeClass]??0)+1)}const c=new Set;for(const x of s){const e=Ys.get(x);e&&c.add(e.prefix.toLowerCase())}let d=0,u=0;for(const x of ge)if(x.hops.length>=2){const e=x.hops[0].toLowerCase(),t=x.hops[x.hops.length-1].toLowerCase();c.has(e)&&c.has(t)&&(d+=x.healthScore,u++)}Kt({nodeCount:s.length,edgeCount:a,avgBetweenness:s.length>0?r/s.length:0,avgConfidence:a>0?i/a:0,avgPathHealth:u>0?d/u:null,communities:o,nodeClasses:l}),Se(null),Le(null)},[Ys,ge]),mn=s.useCallback(()=>{var e;Kt(null),null==(e=ys.current)||e.unselectAllPoints()},[]),hn=s.useMemo(()=>{var e;if(!ke)return null;const t=ke.hash,s=new Set;for(const m of Us)m.source===t?s.add(m.target):m.target===t&&s.add(m.source);if(0===s.size)return{clusteringCoeff:0,avgNeighborBetweenness:0,neighborCount:0,avgEdgeConfidence:0,avgRssi:null,avgSnr:null};let n=0;for(const m of Us)s.has(m.source)&&s.has(m.target)&&n++;const a=s.size,i=a>1?2*n/(a*(a-1)):0;let r=0;for(const m of s)r+=(null==(e=Ys.get(m))?void 0:e.betweenness)??0;let o=0,l=0,c=0,d=0,u=0,x=0;for(const m of Us)m.source!==t&&m.target!==t||(o+=m.confidence,l++,null!=m.avgRssi&&(c+=m.avgRssi,d++),null!=m.avgSnr&&(u+=m.avgSnr,x++));return{clusteringCoeff:Math.min(1,i),avgNeighborBetweenness:r/a,neighborCount:a,avgEdgeConfidence:l>0?o/l:0,avgRssi:d>0?c/d:null,avgSnr:x>0?u/x:null}},[ke,Us,Ys]),pn=s.useMemo(()=>{if(!ke)return[];const e=ke.hash,t=[],s=new Set;for(const n of Us){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=Ys.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},[ke,Us,Ys]),gn=s.useCallback(async()=>{const e=ys.current;if(!e||!ke)return;const t=await e.getPointIndicesByIds([ke.hash]);if(!t||void 0===t[0])return;const s=t[0],n=e.getConnectedPointIndices(s)??[],a=new Set([s,...n]);for(const r of n){const t=e.getConnectedPointIndices(r)??[];for(const e of t)a.add(e)}const i=Array.from(a);e.selectPoints(i),e.fitViewByIndices(i,at,.15)},[ke]);s.useEffect(()=>{if(!Zt)return;const e=e=>{var t,s;"Escape"===e.key&&(Wt(!1),null==(t=ys.current)||t.deactivatePolygonalSelection(),Kt(null),null==(s=ys.current)||s.unselectAllPoints())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[Zt]);const fn=s.useCallback((e,t)=>{ue&&(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)}(De(e,t))}(ue,{format:e,dataset:t}),Ut(!1))},[ue]),vn=s.useMemo(()=>{if(!ue||!ge.length)return null;const e=ue.edges??[];return 0===e.length?null:function(e,t,s=-137){const n=new Map;for(const r of t)n.set(r.key,r);const a=t.filter(e=>null!=e.avgRssi).length,i=[];for(const r of e){const e=Qe(r,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}}(ge,e)},[ue,ge]),bn=s.useMemo(()=>{const e=null==ue?void 0:ue.edges;if(!e||0===e.length||!xe||xe.size<3)return null;const t=Array.from(xe.keys());return Z(e,t)},[null==ue?void 0:ue.edges,xe]),yn=s.useMemo(()=>{if("louvain"!==zt)return null;const e=null==ue?void 0:ue.edges;return!e||0===e.length||!xe||xe.size<3?null:Re(e,Array.from(xe.keys()),Bs)},[zt,null==ue?void 0:ue.edges,xe,Bs]);s.useEffect(()=>{if(!ue)return;const e=new Map;for(const[s,n]of ue.nodeMetrics)e.set(s,n.name);const t=vs.current.update(ue,e);t.totalCount>0&&(ms(vs.current.getLog()),ps(e=>e+t.totalCount))},[ue]);const jn=s.useCallback(()=>{ps(0),us(e=>!e)},[]),Nn=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,r;a<10?(i="critical",r="Partition risk"):a<30?(i="poor",r="Weak connectivity"):a<55?(i="fair",r="Moderate resilience"):a<80?(i="good",r="Well connected"):(i="excellent",r="Highly resilient");const[o,l]=it[i];return{score:a,grade:i,label:r,color:t?o:l}}(bn,ve),[bn,ve]),wn=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-text-primary flex items-center gap-2 sm:gap-3 pointer-events-auto",children:[n.jsx(S,{className:"w-5 h-5 sm:w-6 sm:h-6 text-icon-page-title"}),n.jsx("span",{children:"MeshGraph"}),n.jsx(D,{color:"violet",compact:!0,children:"Analytics"})]}),Nn&&n.jsx(F,{content:n.jsxs("div",{className:"max-w-xs space-y-2",children:[n.jsx("div",{className:"font-semibold text-text-primary",children:"Mesh Resilience Score"}),n.jsx("div",{className:"text-text-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-text-muted",children:"Raw λ₂"}),n.jsx("span",{className:"text-text-primary tabular-nums",children:(null==bn?void 0:bn.toFixed(6))??"—"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Score"}),n.jsxs("span",{className:"tabular-nums",style:{color:Nn.color},children:[Nn.score,"/100"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Grade"}),n.jsx("span",{className:"capitalize",style:{color:Nn.color},children:Nn.grade})]})]}),n.jsxs("div",{className:"pt-1 border-t border-border-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-text-muted font-medium",children:"Grade thresholds"}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:it.excellent[0]},children:"Excellent"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"80-100 (λ₂ > 0.3)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:it.good[0]},children:"Good"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"55-79 (λ₂ 0.03-0.3)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:it.fair[0]},children:"Fair"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"30-54 (λ₂ 0.003-0.03)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:it.poor[0]},children:"Poor"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"10-29 (λ₂ 0.0001-0.003)"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{style:{color:it.critical[0]},children:"Critical"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"<10 (λ₂ ≈ 0)"})]})]}),n.jsx("div",{className:"text-[10px] text-text-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-text-muted uppercase tracking-wider",children:"Resilience"}),n.jsx("span",{className:"text-lg font-semibold tabular-nums leading-none",style:{color:Nn.color},children:Nn.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:`${Nn.score}%`,backgroundColor:Nn.color}})})]})})]}),Cn=(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-accent-primary/20 text-accent-primary shadow-inner`:`${s} hover:bg-white/5 hover:scale-105 text-text-secondary`},kn=n.jsx("div",{className:"w-px h-6 bg-border-subtle/40 mx-0.5 shrink-0"}),Sn=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(F,{content:"Visible nodes / edges in the graph",children:n.jsxs("span",{className:"text-[9px] text-text-muted tabular-nums mr-1.5 leading-none cursor-help",children:[_s.length,n.jsx("br",{}),Us.length]})}),kn,n.jsx(F,{content:qe?"Hide labels (L)":"Show labels (L)",children:n.jsxs("button",{onClick:()=>Xe(e=>!e),className:Cn(!qe,!0),children:[qe?n.jsx(Q,{className:"w-3.5 h-3.5"}):n.jsx(W,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Lbl"})]})}),n.jsx(F,{content:Et?"Disable clustering":"Community clustering",children:n.jsxs("button",{onClick:dn,className:Cn(Et),children:[n.jsx(le,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Grp"})]})}),n.jsx(F,{content:Zt?"Exit lasso (Esc)":"Lasso selection",children:n.jsxs("button",{onClick:un,className:Cn(Zt,!0),children:[n.jsx(ce,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Sel"})]})}),kn,n.jsx(F,{content:"Legend",children:n.jsxs("button",{onClick:()=>Je(e=>!e),className:Cn(Ye),children:[n.jsx(se,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Map"})]})}),n.jsx(F,{content:"Search (/)",children:n.jsxs("button",{onClick:()=>{Te(!0),setTimeout(()=>{var e;return null==(e=bs.current)?void 0:e.focus()},50)},className:Cn(ze),children:[n.jsx(J,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Fnd"})]})}),kn,n.jsx(F,{content:we?"Pause (Space)":"Play (Space)",children:n.jsxs("button",{onClick:en,className:Cn(!we),children:[we?n.jsx(L,{className:"w-3.5 h-3.5 text-accent-success"}):n.jsx(R,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:we?"Run":"Stop"})]})}),n.jsx(F,{content:"Fit view (F)",children:n.jsxs("button",{onClick:Js,className:Cn(!1),children:[n.jsx(oe,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Fit"})]})}),kn,n.jsx(F,{content:qt?"Disable link budget":"Link budget overlay",children:n.jsxs("button",{onClick:()=>Xt(e=>!e),className:Cn(qt),children:[n.jsx(M,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"RF"})]})}),n.jsx(F,{content:"Anomaly log",children:n.jsxs("button",{onClick:jn,className:`relative ${Cn(ds,!0)}`,children:[n.jsx(ee,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Alert"}),hs>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:hs>9?"9+":hs})]})}),n.jsx(F,{content:"Export topology",children:n.jsxs("button",{onClick:()=>Ut(e=>!e),className:Cn(_t),children:[n.jsx(Y,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Exp"})]})}),n.jsx(F,{content:"Settings",children:n.jsxs("button",{onClick:()=>Ve(e=>!e),className:Cn(Ge),children:[n.jsx(ne,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Cfg"})]})}),kn,n.jsx(F,{content:Me?"Exit fullscreen":"Fullscreen",children:n.jsxs("button",{onClick:ln,className:Cn(Me),children:[Me?n.jsx(V,{className:"w-3.5 h-3.5"}):n.jsx(O,{className:"w-3.5 h-3.5"}),n.jsx("span",{className:"text-[7px] uppercase tracking-wider leading-none",children:"Max"})]})})]}),Dn=n.jsxs(nt,{id:"settings",title:"Graph Settings",icon:n.jsx(ne,{}),open:Ge,onClose:()=>Ve(!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(F,{content:"Reset to defaults",children:n.jsx("button",{onClick:Rs,className:"p-0.5 radius-badge hover-bg transition-base",children:n.jsx(de,{className:"w-2.5 h-2.5 text-text-muted"})})}),children:[n.jsx("div",{className:"flex border-b border-border-subtle",children:["simulation","points","links","rendering"].map(e=>n.jsx("button",{onClick:()=>_e(e),className:"flex-1 px-2 py-1.5 text-[10px] font-medium capitalize transition-colors "+(Ke===e?"text-accent-primary border-b-2 border-accent-primary":"text-text-muted hover:text-text-secondary"),children:e},e))}),n.jsxs("div",{className:"p-3 space-y-3",children:["simulation"===Ke&&n.jsxs(n.Fragment,{children:[n.jsx(Mt,{label:"Gravity",value:Ds.simulationGravity,onChange:e=>Ls("simulationGravity",e),min:0,max:1,step:.01}),n.jsx(Mt,{label:"Repulsion",value:Ds.simulationRepulsion,onChange:e=>Ls("simulationRepulsion",e),min:0,max:5,step:.1}),n.jsx(Mt,{label:"Link Spring",value:Ds.simulationLinkSpring,onChange:e=>Ls("simulationLinkSpring",e),min:0,max:2,step:.05}),n.jsx(Mt,{label:"Link Distance",value:Ds.simulationLinkDistance,onChange:e=>Ls("simulationLinkDistance",e),min:1,max:100,step:1}),n.jsx(Mt,{label:"Friction",value:Ds.simulationFriction,onChange:e=>Ls("simulationFriction",e),min:0,max:1,step:.01}),n.jsx(Mt,{label:"Center Force",value:Ds.simulationCenter,onChange:e=>Ls("simulationCenter",e),min:0,max:1,step:.01}),n.jsx(Mt,{label:"Decay",value:Ds.simulationDecay,onChange:e=>Ls("simulationDecay",e),min:100,max:2e4,step:100}),n.jsx(Mt,{label:"Repulsion Theta",value:Ds.simulationRepulsionTheta,onChange:e=>Ls("simulationRepulsionTheta",e),min:.1,max:3,step:.05}),n.jsx(Mt,{label:"Mouse Repulsion",value:Ds.simulationRepulsionFromMouse,onChange:e=>Ls("simulationRepulsionFromMouse",e),min:0,max:10,step:.5})]}),"points"===Ke&&n.jsxs(n.Fragment,{children:[n.jsx(Mt,{label:"Size Scale",value:Ds.pointSizeScale,onChange:e=>Ls("pointSizeScale",e),min:.1,max:5,step:.1}),n.jsx(Mt,{label:"Opacity",value:Ds.pointOpacity,onChange:e=>Ls("pointOpacity",e),min:0,max:1,step:.05}),n.jsx(Mt,{label:"Greyout Opacity",value:Ds.pointGreyoutOpacity,onChange:e=>Ls("pointGreyoutOpacity",e),min:0,max:1,step:.05}),n.jsx(Bt,{label:"Scale on Zoom",checked:Ds.scalePointsOnZoom,onChange:e=>Ls("scalePointsOnZoom",e)}),n.jsx(Bt,{label:"Hover Ring",checked:Ds.renderHoveredPointRing,onChange:e=>Ls("renderHoveredPointRing",e)})]}),"links"===Ke&&n.jsxs(n.Fragment,{children:[n.jsx(Bt,{label:"Show Links",checked:Ds.renderLinks,onChange:e=>Ls("renderLinks",e)}),n.jsx(Bt,{label:"Curved Links",checked:Ds.curvedLinks,onChange:e=>Ls("curvedLinks",e)}),n.jsx(Bt,{label:"Show Arrows",checked:Ds.linkDefaultArrows,onChange:e=>Ls("linkDefaultArrows",e)}),n.jsx(Mt,{label:"Width Scale",value:Ds.linkWidthScale,onChange:e=>Ls("linkWidthScale",e),min:.1,max:5,step:.1}),n.jsx(Mt,{label:"Opacity",value:Ds.linkOpacity,onChange:e=>Ls("linkOpacity",e),min:0,max:1,step:.05}),n.jsx(Mt,{label:"Greyout Opacity",value:Ds.linkGreyoutOpacity,onChange:e=>Ls("linkGreyoutOpacity",e),min:0,max:1,step:.05}),Ds.curvedLinks&&n.jsx(Mt,{label:"Curve Weight",value:Ds.curvedLinkWeight,onChange:e=>Ls("curvedLinkWeight",e),min:0,max:1,step:.05}),Ds.linkDefaultArrows&&n.jsx(Mt,{label:"Arrow Size",value:Ds.linkArrowsSizeScale,onChange:e=>Ls("linkArrowsSizeScale",e),min:.1,max:3,step:.1}),n.jsx(Bt,{label:"Scale on Zoom",checked:Ds.scaleLinksOnZoom,onChange:e=>Ls("scaleLinksOnZoom",e)})]}),"rendering"===Ke&&n.jsxs(n.Fragment,{children:[n.jsx(Mt,{label:"Space Size",value:Ds.spaceSize,onChange:e=>Ls("spaceSize",e),min:1024,max:16384,step:512}),n.jsx("div",{className:"pt-2 border-t border-border-subtle/50",children:n.jsx("p",{className:"text-[9px] text-text-muted",children:"Space size defines the simulation boundary. Larger values allow more spread."})})]})]})]}),Fn=n.jsxs(nt,{id:"export",title:"Export Topology",icon:n.jsx(Y,{}),open:_t,onClose:()=>Ut(!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:()=>fn(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-text-primary",children:e}),n.jsx("span",{className:"text-[9px] text-text-muted",children:a})]},`${t}-${s}`))}),n.jsx("div",{className:"px-3 py-1.5 border-t border-border-subtle",children:n.jsxs("span",{className:"text-[9px] text-text-muted",children:[(null==(z=null==ue?void 0:ue.nodeMetrics)?void 0:z.size)??0," nodes · ",(null==(T=null==ue?void 0:ue.validatedEdges)?void 0:T.length)??0," edges"]})})]}),Ln={info:{dot:"bg-accent-primary",text:"text-text-secondary"},warning:{dot:"bg-status-warning",text:"text-status-warning"},critical:{dot:"bg-status-danger",text:"text-status-danger"}},Rn={"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"},Mn=(e,t,s)=>null==t||""===t?null:n.jsxs("div",{className:"flex justify-between gap-2",children:[n.jsx("span",{className:"text-text-muted",children:e}),n.jsx("span",{className:`tabular-nums text-right ${s??"text-text-secondary"}`,children:t})]}),Bn=e=>{const t=[];return e.isZeroHop&&t.push({label:"Zero-Hop",color:"text-status-warning"}),e.isDirectPath&&t.push({label:"Direct",color:"text-accent-primary"}),e.isBackbone&&t.push({label:"Backbone",color:"text-text-primary"}),e.isLoop&&t.push({label:"Loop",color:"text-accent-secondary"}),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))})},Hn=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-text-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"})]}),Mn("Degree",e.degree),e.betweenness>.01&&Mn("Betweenness",e.betweenness.toFixed(3)),Mn("Packets",e.packetCount),Mn("Community",`#${e.communityId}`),Mn("Activity",e.activityLevel),null!=e.avgRssi&&Mn("RSSI",`${e.avgRssi.toFixed(0)} dBm`),null!=e.avgSnr&&Mn("SNR",`${e.avgSnr.toFixed(1)} dB`)]}),An=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-text-muted font-mono",children:"number"==typeof e.previousValue?e.previousValue.toFixed(3):e.previousValue}),n.jsx("span",{className:"text-text-muted/40",children:"→"}),n.jsx("span",{className:"text-text-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-accent-success":"text-signal-poor",children:["(",e.currentValue>e.previousValue?"+":"",(e.currentValue-e.previousValue).toFixed(3),")"]})]}),e.nodeDetail&&n.jsxs(n.Fragment,{children:[Mn("Class",e.nodeDetail.nodeClass),Mn("Degree",e.nodeDetail.degree),e.nodeDetail.betweenness>.01&&Mn("Betweenness",e.nodeDetail.betweenness.toFixed(3))]})]}),En=s.useCallback(e=>{fs(t=>t===e?null:e)},[]),Pn=n.jsxs(nt,{id:"anomaly",title:"Anomaly Log",icon:n.jsx(ee,{}),open:ds,onClose:()=>us(!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:xs.length>0?n.jsx("button",{onClick:()=>{vs.current.clear(),ms([]),fs(null)},className:"p-0.5 radius-badge hover-bg transition-base",title:"Clear all",children:n.jsx(de,{className:"w-2.5 h-2.5 text-text-muted"})}):void 0,children:[0===xs.length?n.jsxs("div",{className:"px-3 py-6 text-center",children:[n.jsx(ee,{className:"w-5 h-5 text-text-muted mx-auto mb-1.5"}),n.jsx("p",{className:"text-[11px] text-text-muted",children:"No anomalies detected yet"}),n.jsx("p",{className:"text-[9px] text-text-muted/60 mt-0.5",children:"Changes appear after topology recomputes"})]}):n.jsx("div",{className:"overflow-y-auto",children:xs.slice(0,50).map(e=>{const t=Ln[e.severity],s=B(e.detectedAt/1e3),a=gs===e.id,i=!(!e.edgeDetail&&!e.nodeDetail&&null==e.previousValue);return n.jsxs("div",{className:`border-b border-border-subtle/50 last:border-0 transition-colors ${i?"cursor-pointer hover-bg":""} ${a?"bg-subtle-fill/50":""}`,onClick:i?()=>En(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-text-muted/60 mt-0.5",children:[Rn[e.category]??e.category," · ",s]})]}),i&&n.jsx(H,{className:"w-3 h-3 text-text-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-border-subtle/60 pl-2 py-0.5",children:[e.edgeDetail&&(r=e.edgeDetail,o=e.category,n.jsxs("div",{className:"text-[9px] space-y-0.5",children:[(r.fromClass||r.toClass)&&n.jsxs("div",{className:"flex items-center gap-1 text-text-muted",children:[n.jsx("span",{className:"capitalize",children:r.fromClass??"?"}),n.jsx("span",{className:"text-text-muted/40",children:"↔"}),n.jsx("span",{className:"capitalize",children:r.toClass??"?"})]}),"edge-appeared"===o&&r.packetCount>0&&n.jsxs(n.Fragment,{children:[Mn("Packets",r.packetCount),Mn("Confidence",`${(100*r.confidence).toFixed(0)}%`,r.confidence>=.8?"text-accent-success":r.confidence>=.5?"text-accent-secondary":"text-signal-poor"),Mn("Symmetry",`${(100*r.symmetryRatio).toFixed(0)}%`)]}),r.isZeroHop&&null!=r.avgRssi&&Mn("RSSI",`${r.avgRssi.toFixed(0)} dBm`),r.isZeroHop&&null!=r.avgSnr&&Mn("SNR",`${r.avgSnr.toFixed(1)} dB`),null!=r.fromBetweenness&&r.fromBetweenness>.01&&Mn(`${r.fromName??"A"} centrality`,r.fromBetweenness.toFixed(3)),null!=r.toBetweenness&&r.toBetweenness>.01&&Mn(`${r.toName??"B"} centrality`,r.toBetweenness.toFixed(3)),Bn(r)]})),e.nodeDetail&&!e.edgeDetail&&("node-appeared"===e.category||"node-disappeared"===e.category)&&Hn(e.nodeDetail),("betweenness-shift"===e.category||"community-change"===e.category||"class-change"===e.category)&&An(e)]})})]},e.id);var r,o})}),xs.length>0&&n.jsx("div",{className:"px-3 py-1.5 border-t border-border-subtle",children:n.jsxs("span",{className:"text-[9px] text-text-muted",children:[xs.length," total · showing ",Math.min(xs.length,50)]})})]}),zn=s.useMemo(()=>{const e={};for(const t of zs)e[t.edgeType]=(e[t.edgeType]??0)+1;return e},[zs]),Tn=n.jsxs(nt,{id:"legend",title:"Legend",icon:n.jsx(se,{}),open:Ye,onClose:()=>Je(!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-border-subtle",children:[n.jsxs("button",{onClick:()=>tt(e=>!e),className:"w-full flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-medium text-text-secondary hover-bg transition-base",children:[et?n.jsx(H,{className:"w-3 h-3"}):n.jsx(ae,{className:"w-3 h-3"}),"Nodes",n.jsx("span",{className:"text-text-muted ml-auto tabular-nums",children:_s.length})]}),et&&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=he[e]??0;if(0===s&&"local"!==e)return null;const a=Ht.has(e);return n.jsx(F,{content:bt[e],children:n.jsxs("button",{onClick:()=>cn(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:be[e]}}),n.jsx("span",{className:"text-[10px] text-text-secondary flex-1",children:t}),n.jsx("span",{className:"text-[10px] text-text-muted tabular-nums",children:s})]})},e)})})]}),n.jsxs("div",{className:"border-b border-border-subtle",children:[n.jsxs("button",{onClick:()=>yt(e=>!e),className:"w-full flex items-center gap-1.5 px-3 py-1.5 text-[10px] font-medium text-text-secondary hover-bg transition-base",children:[st?n.jsx(H,{className:"w-3 h-3"}):n.jsx(ae,{className:"w-3 h-3"}),"Edges",n.jsx("span",{className:"text-text-muted ml-auto tabular-nums",children:Us.length})]}),st&&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=zn[e]??0;if(0===s)return null;const a=wt(e,.8,ve);return n.jsx(F,{content:kt[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-text-secondary flex-1",children:t}),n.jsx("span",{className:"text-[10px] text-text-muted tabular-nums",children:s})]})},e)})})]}),qt&&Vs&&n.jsxs("div",{className:"border-b border-border-subtle",children:[n.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-medium text-accent-success flex items-center gap-1.5",children:[n.jsx(M,{className:"w-3 h-3"}),"Link Budget",n.jsxs("span",{className:"text-text-muted ml-auto tabular-nums",children:[Vs.analyzedEdges+Vs.rssiOnlyEdges,"/",Vs.totalEdges]})]}),n.jsxs("div",{className:"px-3 pb-2 space-y-0.5",children:[(()=>{const e=Ts&&Ts>1e5?Ts/1e6:Ts||915,t=Jt??Is??12,s=ts??($s&&$s>1e3?$s/1e3:$s||125),a=ns??Os??5,i=Yt??Gs??22,r=Ee(t,s,a),o=is??r,l=Pe(1e3*s),c=os??l,d=(null==Zs?void 0:Zs.filter(e=>e.isTraceEstimated).length)??0,u=(null==Zs?void 0:Zs.filter(e=>e.isZeroHop).length)??0,x=null!=Yt||null!=Jt||null!=ts||null!=ns||null!=is,m="w-10 px-1 py-0 text-[10px] text-right tabular-nums bg-subtle-fill border border-border-subtle rounded text-text-secondary focus:outline-none focus:border-accent-primary";return n.jsxs("div",{className:"pb-1 mb-1 border-b border-border-subtle space-y-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx("span",{className:"text-text-muted",children:"Frequency"}),n.jsxs("span",{className:"text-text-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-text-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);es(t===(Is??12)?null:t)},className:m+" w-12 appearance-none",children:[7,8,9,10,11,12].map(e=>n.jsxs("option",{value:e,children:["SF",e]},e))}),null!=Jt&&n.jsx("button",{onClick:()=>es(null),className:"text-[8px] text-accent-primary hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-text-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);ss(t===($s&&$s>1e3?$s/1e3:$s||125)?null:t)},className:m+" w-14 appearance-none",children:[62.5,125,250,500].map(e=>n.jsxs("option",{value:e,children:[e," kHz"]},e))}),null!=ts&&n.jsx("button",{onClick:()=>ss(null),className:"text-[8px] text-accent-primary hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-text-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);as(t===(Os??5)?null:t)},className:m+" w-12 appearance-none",children:[5,6,7,8].map(e=>n.jsxs("option",{value:e,children:["4/",e]},e))}),null!=ns&&n.jsx("button",{onClick:()=>as(null),className:"text-[8px] text-accent-primary hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-text-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)||Qt(t)},onBlur:e=>{const t=parseInt(e.target.value,10);isNaN(t)?Qt(null):Qt(Math.max(1,Math.min(36,t)))},className:m}),n.jsx("span",{className:"text-text-muted",children:"dBm"}),null!=Yt&&n.jsx("button",{onClick:()=>Qt(null),className:"text-[8px] text-accent-primary hover:underline",title:"Reset",children:"↺"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px] gap-1",children:[n.jsx("span",{className:"text-text-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*o)/10,onChange:e=>{const t=parseFloat(e.target.value);isNaN(t)||rs(t)},onBlur:e=>{const t=parseFloat(e.target.value);isNaN(t)?rs(null):rs(Math.max(-150,Math.min(-80,t)))},className:m+" w-12"}),n.jsx("span",{className:"text-text-muted",children:"dBm"}),null!=is&&n.jsx("button",{onClick:()=>rs(null),className:"text-[8px] text-accent-primary hover:underline",title:"Reset",children:"↺"})]})]}),d>0&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx("span",{className:"text-text-muted",children:"Noise Floor"}),n.jsxs("span",{className:"text-text-secondary tabular-nums "+(null!=os?"":"italic text-text-muted"),children:[c.toFixed(1)," dBm",null!=os?"":" (est.)"]})]}),x&&n.jsx("button",{onClick:()=>{Qt(null),es(null),ss(null),as(null),rs(null)},className:"w-full text-[9px] text-accent-primary 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-text-muted",children:"Sources"}),n.jsxs("span",{className:"text-text-secondary tabular-nums",children:[u>0&&n.jsxs("span",{children:[u," direct"]}),u>0&&d>0&&n.jsx("span",{className:"text-text-muted",children:" · "}),d>0&&n.jsxs("span",{className:"text-accent-secondary",children:[d," trace"]})]})]})]})})(),null!=Vs.avgMarginDb&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx("span",{className:"text-text-muted",children:"Avg Margin"}),n.jsxs("span",{className:"text-text-secondary tabular-nums",children:[Vs.avgMarginDb>0?"+":"",Vs.avgMarginDb.toFixed(1)," dB"]})]}),["excellent","good","fair","marginal","critical"].map(e=>{const t=Vs.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:Oe[e]}}),n.jsx("span",{className:"text-[10px] text-text-secondary flex-1 capitalize",children:e}),n.jsx("span",{className:"text-[10px] text-text-muted tabular-nums",children:t})]},e)}),Vs.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:Vs.anomalousCount})]})]})]}),vn&&vn.atRiskPaths.length>0&&n.jsxs("div",{className:"border-b border-border-subtle",children:[n.jsxs("div",{className:"flex items-center",children:[n.jsxs("button",{onClick:()=>St(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:[Ct?n.jsx(H,{className:"w-3 h-3"}):n.jsx(ae,{className:"w-3 h-3"}),"At-Risk Paths",n.jsxs("span",{className:"text-text-muted ml-auto tabular-nums",children:[vn.criticalCount>0&&n.jsxs("span",{className:"text-status-danger",children:[vn.criticalCount,"c"]}),vn.criticalCount>0&&vn.highCount>0&&" ",vn.highCount>0&&n.jsxs("span",{className:"text-status-warning",children:[vn.highCount,"h"]}),(vn.criticalCount>0||vn.highCount>0)&&vn.moderateCount>0&&" ",vn.moderateCount>0&&n.jsxs("span",{className:"text-text-muted",children:[vn.moderateCount,"m"]})]})]}),n.jsx(F,{content:n.jsxs("div",{className:"max-w-xs space-y-1.5",children:[n.jsx("div",{className:"font-semibold text-text-primary",children:"Predictive Path Failure"}),n.jsx("div",{className:"text-text-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-border-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-text-muted font-medium",children:"Factor weights"}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-secondary",children:"Declining usage"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"35%"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-secondary",children:"Weak link certainty"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"30%"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-secondary",children:"No alternate paths"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"20%"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-secondary",children:"Low signal margin"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"15%"})]})]}),n.jsxs("div",{className:"pt-1 border-t border-border-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-text-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-text-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-text-muted tabular-nums",children:"55-74% — significant risk"})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Moderate"}),n.jsx("span",{className:"text-text-muted tabular-nums",children:"35-54% — worth monitoring"})]})]}),n.jsxs("div",{className:"pt-1 border-t border-border-subtle/30 text-[10px] text-text-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:vn.edgesAnalyzed})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{children:"With signal data"}),n.jsx("span",{className:"tabular-nums",children:vn.edgesWithSignal})]})]})]}),children:n.jsx("span",{className:"px-2 py-1.5 text-text-muted cursor-help",children:n.jsx(ee,{className:"w-3 h-3"})})})]}),Ct&&n.jsx("div",{className:"px-2 pb-2 space-y-1",children:vn.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(F,{content:n.jsxs("div",{className:"max-w-xs space-y-1.5",children:[n.jsx("div",{className:"font-semibold text-text-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-text-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-text-muted",children:"Health score"}),n.jsxs("span",{className:"text-text-primary tabular-nums",children:[(100*e.healthScore).toFixed(0),"%"]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Obs. trend"}),n.jsxs("span",{className:"tabular-nums "+(e.observationTrend<0?"text-status-danger":"text-text-secondary"),children:[e.observationTrend>0?"+":"",e.observationTrend.toFixed(3)]})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-muted",children:"Alt. paths"}),n.jsx("span",{className:"tabular-nums "+(0===e.alternatePathsCount?"text-status-danger":"text-text-secondary"),children:e.alternatePathsCount})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-text-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-border-subtle/30 space-y-0.5 text-[10px]",children:[n.jsx("div",{className:"text-text-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-text-secondary",children:e.name}),n.jsxs("span",{className:"text-text-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-text-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-text-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-text-muted",children:[t.name," (",(t.score*t.weight*100).toFixed(0),"%)",sTt(e=>"spectral"===e?"louvain":"spectral"),className:"text-accent-primary hover:underline cursor-pointer",children:"spectral"===zt?"Spectral":"Louvain"})]}),"louvain"===zt&&yn&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(F,{content:"Louvain modularity score — quality of community partition (higher = better defined communities)",children:n.jsx("span",{className:"text-text-muted cursor-help",children:"Modularity Q"})}),n.jsx("span",{className:"text-text-secondary tabular-nums",children:yn.modularity.toFixed(4)})]}),"louvain"===zt&&n.jsxs("div",{className:"mt-1.5 pt-1.5 border-t border-border-subtle space-y-1.5",children:[n.jsx(Mt,{label:"Resolution γ",value:$t,onChange:It,min:.01,max:5,step:.01}),n.jsx(Mt,{label:"K-weight",value:Gt,onChange:Ot,min:.01,max:5,step:.01}),(1!==$t||1!==Gt)&&n.jsx("button",{onClick:()=>{It(1),Ot(1)},className:"w-full text-[10px] text-accent-primary hover:underline text-center",children:"Reset defaults"})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(F,{content:"Redundant path cycles in the topology — indicates alternate routing options",children:n.jsx("span",{className:"text-text-muted cursor-help",children:"Loops"})}),n.jsx("span",{className:"text-text-secondary tabular-nums",children:(null==($=null==ue?void 0:ue.loops)?void 0:$.length)??0})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(F,{content:"High-betweenness edges that carry disproportionate traffic flow",children:n.jsx("span",{className:"text-text-muted cursor-help",children:"Backbone"})}),n.jsx("span",{className:"text-text-secondary tabular-nums",children:(null==(I=null==ue?void 0:ue.backboneEdges)?void 0:I.length)??0})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(F,{content:"Unresolved prefix nodes inferred by Viterbi HMM from repeated path patterns",children:n.jsx("span",{className:"text-text-muted cursor-help",children:"Ghosts"})}),n.jsx("span",{className:"text-text-secondary tabular-nums",children:me.length})]}),n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(F,{content:"Community-aware node coloring — groups nodes by cluster assignment",children:n.jsx("span",{className:"text-text-muted cursor-help",children:"Clustering"})}),n.jsx("span",{className:"tabular-nums "+(Et?"text-accent-primary":"text-text-muted"),children:Et?"On":"Off"})]}),null!=bn&&n.jsxs("div",{className:"flex items-center justify-between text-[10px]",children:[n.jsx(F,{content:"Algebraic connectivity — 2nd-smallest eigenvalue of the graph Laplacian. Near-zero = one bridge from network partition.",children:n.jsx("span",{className:"text-text-muted cursor-help",children:"Fiedler λ₂"})}),n.jsx("span",{className:"tabular-nums "+(bn<.01?"text-status-warning":"text-text-secondary"),children:bn.toFixed(4)})]}),Ht.size>0&&n.jsxs("button",{onClick:()=>At(new Set),className:"w-full mt-1 text-[10px] text-accent-primary hover:underline text-center",children:["Clear filters (",Ht.size,")"]})]})]}),$n=n.jsx(x,{children:ze&&n.jsx(m.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-border-subtle",children:[n.jsx(J,{className:"w-4 h-4 text-text-muted shrink-0"}),n.jsx("input",{ref:bs,type:"text",value:He,onChange:e=>Ae(e.target.value),placeholder:"Search by name or prefix...",className:"flex-1 bg-transparent text-sm text-text-primary placeholder:text-text-muted focus:outline-none",onKeyDown:e=>{"Escape"===e.key?(Te(!1),Ae("")):"Enter"===e.key&&rn.length>0&&on(rn[0])}}),He&&n.jsx("button",{onClick:()=>Ae(""),className:"p-0.5 radius-badge hover-bg transition-base",children:n.jsx(p,{className:"w-3 h-3 text-text-muted"})})]}),rn.length>0&&n.jsx("div",{className:"max-h-64 overflow-y-auto",children:rn.map((e,t)=>n.jsxs("button",{onClick:()=>on(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:be[e.nodeClass]}}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-sm text-text-primary truncate",children:e.name||e.prefix}),e.name&&n.jsx("div",{className:"text-[10px] text-text-muted",children:e.prefix})]}),n.jsx(te,{className:"w-3 h-3 text-text-muted shrink-0"})]},e.id))}),He&&0===rn.length&&n.jsx("div",{className:"px-3 py-4 text-center text-sm text-text-muted",children:"No nodes found"}),!He&&n.jsx("div",{className:"px-3 py-2 type-data-xs text-text-muted",children:"Type to search • Enter to select • Esc to close"})]})})});return _?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:[wn,n.jsx("div",{className:"absolute inset-0 bg-bg-body flex items-center justify-center",children:n.jsx(Rt,{})})]}):js?Me?n.jsxs("div",{className:"fixed inset-0 z-50 bg-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(S,{className:"w-5 h-5 text-icon-page-title"}),n.jsxs("h1",{className:"type-title text-text-primary flex items-center gap-2",children:["MeshGraph",n.jsx(D,{color:"violet",compact:!0,children:"Analytics"})]}),n.jsxs("span",{className:"text-[10px] text-text-muted tabular-nums",children:[_s.length," nodes • ",Us.length," edges"]})]}),n.jsx(F,{content:"Exit fullscreen",children:n.jsx("button",{onClick:ln,className:"p-1.5 radius-inner hover-bg transition-base",children:n.jsx(V,{className:"w-4 h-4 text-text-muted"})})})]}),n.jsxs("div",{className:"flex-1 relative min-h-0 m-2 surface-base radius-inset overflow-hidden border border-border-subtle",children:[n.jsx(a,{className:"absolute inset-0",points:js,links:ws,...ks,...Ds,backgroundColor:je,fitViewOnInit:!0,fitViewPadding:.15,showLabels:qe,showDynamicLabels:!1,showTopLabels:qe,showTopLabelsLimit:200,showHoveredPointLabel:!0,pointLabelColor:Ne,pointClusterBy:Et?"communityId":void 0,onPolygonSelected:Zt?xn:void 0,polygonalSelectorStrokeColor:ve?"#FBBF24":"#D97706",onClick:an,onLinkClick:nn,onMount:Qs,hoveredPointRingColor:ve?"#FBBF24":"#D97706",hoveredPointCursor:"pointer",hoveredLinkCursor:"pointer"}),$n,Tn,Sn,Dn,Fn,Pn,n.jsxs(x,{children:[ke&&n.jsx(Ft,{node:ke,egoMetrics:hn,onExpandEgo:gn,neighbors:pn,onSelectNeighbor:tn,onClose:()=>{var e;Se(null),null==(e=ys.current)||e.unselectAllPoints()}}),Fe&&!ke&&n.jsx(Dt,{edge:Fe,onClose:()=>Le(null)}),Vt&&!ke&&!Fe&&n.jsx(Lt,{metrics:Vt,onClose:mn})]})]})]}):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:[wn,n.jsxs("div",{className:"absolute inset-0",children:[n.jsx(a,{className:"absolute inset-0",points:js,links:ws,...ks,...Ds,backgroundColor:je,fitViewOnInit:!0,fitViewPadding:.15,showLabels:qe,showDynamicLabels:!1,showTopLabels:qe,showTopLabelsLimit:200,showHoveredPointLabel:!0,pointLabelColor:Ne,pointClusterBy:Et?"communityId":void 0,onPolygonSelected:Zt?xn:void 0,polygonalSelectorStrokeColor:ve?"#FBBF24":"#D97706",onClick:an,onLinkClick:nn,onMount:Qs,hoveredPointRingColor:ve?"#FBBF24":"#D97706",hoveredPointCursor:"pointer",hoveredLinkCursor:"pointer"}),$n,Tn,Sn,Dn,Fn,Pn,n.jsxs("div",{className:"absolute bottom-4 right-4 z-10 hidden lg:flex items-center gap-3 type-data-xs text-text-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(x,{children:[ke&&n.jsx(Ft,{node:ke,egoMetrics:hn,onExpandEgo:gn,neighbors:pn,onSelectNeighbor:tn,onClose:()=>{var e;Se(null),null==(e=ys.current)||e.unselectAllPoints()}}),Fe&&!ke&&n.jsx(Dt,{edge:Fe,onClose:()=>Le(null)}),Vt&&!ke&&!Fe&&n.jsx(Lt,{metrics:Vt,onClose:mn})]})]})]}):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:[wn,n.jsxs("div",{className:"absolute inset-0 bg-bg-body flex flex-col items-center justify-center gap-3",children:[n.jsx(A,{className:"w-8 h-8 text-accent-primary animate-spin"}),n.jsx("span",{className:"type-body text-text-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:[wn,n.jsxs("div",{className:"absolute inset-0 bg-bg-body flex items-center justify-center",children:[n.jsx(K,{isOpen:q,onClose:re}),!q&&n.jsx(A,{className:"w-8 h-8 text-accent-primary animate-spin"})]})]})}export{Ht as default}; diff --git a/frontend/dist/assets/NodeInformationCard-DO5yOP6K.js b/frontend/dist/assets/NodeInformationCard-y7LNSCha.js similarity index 90% rename from frontend/dist/assets/NodeInformationCard-DO5yOP6K.js rename to frontend/dist/assets/NodeInformationCard-y7LNSCha.js index acab0bee..44d258f0 100644 --- a/frontend/dist/assets/NodeInformationCard-DO5yOP6K.js +++ b/frontend/dist/assets/NodeInformationCard-y7LNSCha.js @@ -1 +1 @@ -import{j as e}from"./vendor-react-j_fHog8x.js";import{a as s}from"./PageLayout-CBx7rIBL.js";import{D as t}from"./DataBox-BUgVf-3d.js";import{R as a,b3 as r}from"./index-CImKXCRQ.js";import{C as l}from"./Card-DfIcRbRE.js";function c({nodeName:c,repeaterVersion:m,coreVersion:i,localHash:n,publicKey:d}){return e.jsxs(s,{children:[e.jsx(l,{icon:e.jsx(a,{}),title:"Node Information",largeTitle:!0}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 sm:gap-4",children:[e.jsxs("div",{className:"min-w-0 col-span-2 sm:col-span-1",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Node Name"}),e.jsx("p",{className:"type-body text-text-primary mt-0.5 sm:mt-1 truncate",title:c,children:c})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Repeater"}),e.jsxs("p",{className:"type-data text-text-primary mt-0.5 sm:mt-1 truncate",title:`v${m}`,children:["v",m]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Core"}),e.jsxs("p",{className:"type-data text-text-primary mt-0.5 sm:mt-1 truncate",title:`v${i}`,children:["v",i]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Console"}),e.jsxs("p",{className:"type-data text-text-primary mt-0.5 sm:mt-1 truncate",title:`v${r}`,children:["v",r]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Local Hash"}),e.jsx("div",{className:"mt-0.5 sm:mt-1",children:n?e.jsx(t,{copy:!0,size:"compact",children:n}):e.jsx("span",{className:"type-data-sm text-text-secondary",children:"N/A"})})]})]}),d&&e.jsxs("div",{className:"mt-3 sm:mt-4 pt-3 sm:pt-4 border-t border-border-subtle",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Public Key"}),e.jsx("div",{className:"mt-0.5 sm:mt-1",children:e.jsx(t,{copy:!0,size:"responsive",children:d})})]})]})}export{c as N}; +import{j as e}from"./vendor-react-j_fHog8x.js";import{a as s}from"./PageLayout-DUXmuiZg.js";import{D as t}from"./DataBox-B4su-zzA.js";import{R as a,b3 as r}from"./index-B51aMfiH.js";import{C as l}from"./Card-BC0izdLh.js";function c({nodeName:c,repeaterVersion:m,coreVersion:i,localHash:n,publicKey:d}){return e.jsxs(s,{children:[e.jsx(l,{icon:e.jsx(a,{}),title:"Node Information",largeTitle:!0}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 sm:gap-4",children:[e.jsxs("div",{className:"min-w-0 col-span-2 sm:col-span-1",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Node Name"}),e.jsx("p",{className:"type-body text-text-primary mt-0.5 sm:mt-1 truncate",title:c,children:c})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Repeater"}),e.jsxs("p",{className:"type-data text-text-primary mt-0.5 sm:mt-1 truncate",title:`v${m}`,children:["v",m]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Core"}),e.jsxs("p",{className:"type-data text-text-primary mt-0.5 sm:mt-1 truncate",title:`v${i}`,children:["v",i]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Console"}),e.jsxs("p",{className:"type-data text-text-primary mt-0.5 sm:mt-1 truncate",title:`v${r}`,children:["v",r]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Local Hash"}),e.jsx("div",{className:"mt-0.5 sm:mt-1",children:n?e.jsx(t,{copy:!0,size:"compact",children:n}):e.jsx("span",{className:"type-data-sm text-text-secondary",children:"N/A"})})]})]}),d&&e.jsxs("div",{className:"mt-3 sm:mt-4 pt-3 sm:pt-4 border-t border-border-subtle",children:[e.jsx("span",{className:"type-label text-text-secondary",children:"Public Key"}),e.jsx("div",{className:"mt-0.5 sm:mt-1",children:e.jsx(t,{copy:!0,size:"responsive",children:d})})]})]})}export{c as N}; diff --git a/frontend/dist/assets/PacketList-FKMq_1Wb.js b/frontend/dist/assets/PacketList-XLhbtedS.js similarity index 98% rename from frontend/dist/assets/PacketList-FKMq_1Wb.js rename to frontend/dist/assets/PacketList-XLhbtedS.js index 233e150d..5fac0021 100644 --- a/frontend/dist/assets/PacketList-FKMq_1Wb.js +++ b/frontend/dist/assets/PacketList-XLhbtedS.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PathMapMapLibre-COhYm69t.js","assets/vendor-react-j_fHog8x.js","assets/BasemapLayer-Dkb0XoZP.js","assets/vendor-core-CDNU4oKM.js","assets/index-CImKXCRQ.js","assets/DelayedAnimateNumber-B6DSbUSU.js","assets/index-CGYcizrv.js","assets/config-CTM8_93T.js","assets/payload-decoders-BbTIgSA8.js","assets/SignalIndicator-JkITXu3r.js","assets/signal-scoring-CcBiRcks.js","assets/arrow-up-CPFFRV-b.js","assets/copy-CfZtRqCt.js","assets/chevron-right-DZcqArkG.js","assets/map-pin-lRKxIpXD.js","assets/triangle-alert-DRA45BSe.js","assets/DataBox-BUgVf-3d.js","assets/layers-CTDI7uhn.js","assets/route-DJfT3Jo2.js","assets/activity-3eg63twO.js","assets/circle-check-DK-UNKLb.js","assets/database-1Jgt_gPe.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-gDSZCHkY.css"])))=>i.map(i=>d[i]); -import{j as e,c as t,r as s,_ as a}from"./vendor-react-j_fHog8x.js";import{c as n,a1 as r,a2 as l,a3 as i,a4 as c,B as o,a5 as d,a6 as x,a7 as m,e as p,a8 as h,a9 as u,aa as g,ab as f,ac as b,v as y,ad as j,ae as v,m as N,E as k,f as w,af as C,ag as S,ah as H,ai as P,R as M,aj as _,ak as T,al as B,n as F,am as L,an as z,ao as D,ap as A,K as E,N as R,A as U,aq as I,O as $,ar as V,as as O,at as Q}from"./index-CImKXCRQ.js";import{P as W,d as G,a as q,b as K,c as Y,e as J}from"./payload-decoders-BbTIgSA8.js";import{D as X,S as Z,R as ee,P as te,a as se,b as ae,g as ne,c as re,Z as le}from"./SignalIndicator-JkITXu3r.js";import{a as ie,A as ce}from"./arrow-up-CPFFRV-b.js";import{C as oe}from"./copy-CfZtRqCt.js";import{C as de}from"./chevron-right-DZcqArkG.js";import{M as xe}from"./map-pin-lRKxIpXD.js";import{T as me}from"./triangle-alert-DRA45BSe.js";import{D as pe}from"./DataBox-BUgVf-3d.js";import{L as he}from"./layers-CTDI7uhn.js";import{H as ue,R as ge}from"./route-DJfT3Jo2.js";import{A as fe}from"./activity-3eg63twO.js";import{C as be}from"./circle-check-DK-UNKLb.js";import{D as ye}from"./database-1Jgt_gPe.js";import{H as je,D as ve}from"./DelayedAnimateNumber-B6DSbUSU.js";const Ne=n("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),ke=n("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),we=n("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"}]]),Ce=n("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"}]]),Se=n("reply",[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]),He=n("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"}]]),Pe=n("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"}]]),Me=n("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=n("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 Te(e,t){[...t].reverse().forEach(s=>{const a=e.getVariant(s);a&&l(e,a),e.variantChildren&&e.variantChildren.forEach(e=>{Te(e,t)})})}function Be(){const e=new Set,t={subscribe:t=>(e.add(t),()=>{e.delete(t)}),start(t,s){const a=[];return e.forEach(e=>{a.push(r(e,t,{transitionOverride:s}))}),Promise.all(a)},set:t=>e.forEach(e=>{!function(e,t){Array.isArray(t)?Te(e,t):"string"==typeof t?Te(e,[t]):l(e,t)}(e,t)}),stop(){e.forEach(e=>{!function(e){e.values.forEach(e=>e.stop())}(e)})},mount:()=>()=>{t.stop()}};return t}function Fe(){const e=i(Be);return c(e.mount,[]),e}function Le({"aria-label":s="Page navigation",className:a,...n}){return e.jsx("nav",{"aria-label":s,...n,className:t("flex gap-x-2",a)})}function ze({onClick:s,disabled:a=!1,className:n,children:r="Previous"}){return e.jsx("span",{className:t("grow basis-0",n),children:e.jsxs(o,{plain:!0,onClick:s,disabled:a,"aria-label":"Previous page",className:t("gap-1",a&&"invisible"),children:[e.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M2.75 8H13.25M2.75 8L5.25 5.5M2.75 8L5.25 10.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})}),r]})})}function De({onClick:s,disabled:a=!1,className:n,children:r="Next"}){return e.jsx("span",{className:t("flex grow basis-0 justify-end",n),children:e.jsxs(o,{plain:!0,onClick:s,disabled:a,"aria-label":"Next page",className:t("gap-1",a&&"invisible"),children:[r,e.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.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 Ae({className:s,...a}){return e.jsx("span",{...a,className:t("hidden items-baseline gap-x-2 sm:flex",s)})}function Ee({page:s,current:a=!1,onClick:n,className:r,children:l}){return e.jsx(o,{plain:!a,outline:a,onClick:()=>null==n?void 0:n(s),"aria-label":`Page ${s}`,"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",r),children:l??s})}function Re({className:s,...a}){return e.jsx("span",{"aria-hidden":"true",...a,className:t("w-[2.25rem] select-none text-center text-sm text-text-muted",s),children:"…"})}function Ue(e){if(!e||e.length<8)return null;const t=parseInt(e.slice(0,2),16),s=parseInt(e.slice(2,4),16),a=parseInt(e.slice(4,6),16),n=parseInt(e.slice(6,8),16);return isNaN(t)||isNaN(s)||isNaN(a)||isNaN(n)?null:((t|s<<8|a<<16|n<<24)>>>0).toString(16).toUpperCase().padStart(8,"0")}function Ie(e){return e>=10?"excellent":e>=5?"good":e>=0?"fair":e>=-5?"poor":"critical"}function $e(e){if(!e.payload)return null;try{const t=m(e.payload),s=function(e){const t=e.original_path||e.forwarded_path||[];if("string"==typeof t)try{const e=JSON.parse(t);if(Array.isArray(e))return e.map(e=>parseInt(e,16))}catch{return[]}else if(Array.isArray(t))return t.map(e=>parseInt(e,16));return[]}(e),a=q(t,s);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 Ve={rx:{icon:ce,label:"Rx",badgeColor:X.rx,avatarBg:"bg-emerald-500/15",avatarText:"text-emerald-400"},forward:{icon:Ne,label:"Fwd",badgeColor:X.forward,avatarBg:"bg-sky-500/15",avatarText:"text-sky-400"},duplicate:{icon:oe,label:"Dupe",badgeColor:X.duplicate,avatarBg:"bg-zinc-500/15",avatarText:"text-zinc-400"},tx:{icon:ie,label:"Tx",badgeColor:X.tx,avatarBg:"bg-violet-500/15",avatarText:"text-violet-400"},dropped:{icon:we,label:"Drop",badgeColor:X.dropped,avatarBg:"bg-amber-500/15",avatarText:"text-amber-400"}},Oe={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},Qe={sm:"w-7 h-7",md:"w-8 h-8",lg:"w-9 h-9"};function We(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 Ge=s.memo(function({packet:s,showLabel:a=!0,variant:n="avatar",size:r="sm"}){const l=We(s),i=Ve[l],c=i.icon;return"avatar"===n?e.jsx("div",{className:t("flex items-center justify-center rounded-full flex-shrink-0",i.avatarBg,Qe[r]),children:e.jsx(c,{className:t(Oe[r],i.avatarText)})}):e.jsxs(p,{color:i.badgeColor,children:[e.jsx(c,{className:Oe[r]}),a&&i.label]})}),qe=s.memo(function({path:s,localHash:a,className:n}){if(!s||0===s.length)return e.jsx("span",{className:t("text-text-muted text-[10px]",n),children:"—"});const r=a?(a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase():null;return e.jsx("span",{className:t("flex items-center gap-0.5 font-mono text-[10px] overflow-hidden",n),children:s.map((t,a)=>{const n=a===s.length-1,l=r&&t.toUpperCase()===r;return e.jsxs("span",{className:"flex items-center flex-shrink-0",children:[l?e.jsx("span",{className:"px-1 py-0.5 rounded bg-amber-500/20 text-amber-400 text-[9px] font-medium",children:"You"}):e.jsx("span",{className:"px-1 py-0.5 rounded bg-subtle-fill-hover text-text-secondary",children:t.toUpperCase()}),!n&&e.jsx(de,{className:"w-2.5 h-2.5 text-text-muted mx-0.5 flex-shrink-0"})]},`${t}-${a}`)})})}),Ke=s.memo(function({count:s,className:a}){const n=s>=2;return e.jsxs("span",{className:t("font-mono text-xs tabular-nums",n?"text-text-secondary":"text-text-muted",a),children:[s,e.jsx("span",{className:"text-text-muted",children:"→"})]})});function Ye(e){const t=e.payload_type_name||g(e.payload_type??e.type),s=e.route_type_name||f(e.route_type??e.route);return{payloadType:t,routeType:s,payloadColor:te[t]??"zinc",routeColor:ee[s]??"zinc"}}function Je(e){if(!e)return[];if(Array.isArray(e))return e;try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Xe(e,t){if(!e||!t)return null;const s=e.startsWith("0x")?e.slice(2):e;for(const[a,n]of Object.entries(t))if((a.startsWith("0x")?a.slice(2):a).toLowerCase().startsWith(s.toLowerCase()))return n.name||n.node_name||null;return null}const Ze=s.memo(function({packet:a,onClick:n,localHash:r,neighbors:l,isFlashing:i=!1,isTraceHighlighted:c,onTraceHover:o,traceTag:d,onViewTraceReport:x,dupeGroupPosition:m,isDupeGroupHovered:g=!1,onDupeGroupHover:f}){const b=h(a.is_duplicate),y=void 0!==m,{payloadType:j,routeType:v,payloadColor:N,routeColor:k}=Ye(a),w="tx_local"===a.packet_origin,C="TRACE"===j,S=Je(a.original_path),H=Je(a.forwarded_path),P=H.length>0?H:S,M=P.length,_=a.src_hash?(a.src_hash.startsWith("0x")?a.src_hash.slice(2,6):a.src_hash.slice(0,4)).toUpperCase():null,T=Xe(a.src_hash,l),B=a.payload_length??a.length??0;a.lbt_attempts;const F=s.useCallback(()=>{C&&d&&x?x(d):n(a)},[C,d,x,n,a]),L=s.useCallback(()=>{C&&d&&o&&o(d),y&&f&&a.packet_hash&&f(a.packet_hash)},[C,d,o,y,f,a.packet_hash]),z=s.useCallback(()=>{o&&o(null),f&&f(null)},[o,f]),D={lime:"rgb(132, 204, 22)",cyan:"rgb(34, 211, 238)",amber:"rgb(251, 191, 36)",violet:"rgb(167, 139, 250)",rose:"rgb(251, 113, 133)",emerald:"rgb(52, 211, 153)",sky:"rgb(56, 189, 248)",orange:"rgb(251, 146, 60)",pink:"rgb(244, 114, 182)",zinc:"rgb(161, 161, 170)",purple:"rgb(168, 85, 247)",indigo:"rgb(129, 140, 248)",teal:"rgb(45, 212, 191)",fuchsia:"rgb(232, 121, 249)",blue:"rgb(59, 130, 246)",green:"rgb(34, 197, 94)",yellow:"rgb(250, 204, 21)",red:"rgb(239, 68, 68)",brown:"rgb(168, 133, 107)"},A=D[N]||D.zinc,E=g;return e.jsxs("div",{onClick:F,onMouseEnter:L,onMouseLeave:z,className:t("group relative cursor-pointer","hover:bg-subtle-fill",b&&!g&&"opacity-40",i&&"flash-row",w&&"bg-violet-500/5",c&&"bg-teal-500/10"),children:[e.jsx("div",{className:t("absolute pointer-events-none transition-opacity duration-75",y?E?"opacity-100":"opacity-0":"opacity-0 group-hover:opacity-100"),style:(()=>{const e={pointerEvents:"none"};return"first"===m?{...e,borderTop:`2px solid ${A}`,borderLeft:`2px solid ${A}`,borderRight:`2px solid ${A}`,borderBottom:"none",borderRadius:"8px 8px 0 0",inset:"-2px -2px 0 -2px"}:"middle"===m?{...e,borderTop:"none",borderLeft:`2px solid ${A}`,borderRight:`2px solid ${A}`,borderBottom:"none",borderRadius:0,inset:"0 -2px"}:"last"===m?{...e,borderTop:"none",borderLeft:`2px solid ${A}`,borderRight:`2px solid ${A}`,borderBottom:`2px solid ${A}`,borderRadius:"0 0 8px 8px",inset:"0 -2px -2px -2px"}:{...e,border:`2px solid ${A}`,borderRadius:"8px",inset:"-2px"}})()}),e.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:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e.jsx("div",{className:"relative flex-shrink-0",children:e.jsx(Ge,{packet:a,variant:"avatar",size:"sm"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-bold text-[13px] text-text-primary font-sans truncate",children:_||"—"}),T&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-text-muted truncate max-w-[70px]",children:T})]})]}),e.jsxs("div",{className:"flex-1 flex items-center gap-1 min-[600px]:gap-1.5 min-[900px]:gap-2 min-w-0",children:[e.jsx("span",{className:"text-[10px] min-[600px]:text-[11px] text-text-muted font-mono tabular-nums whitespace-nowrap flex-shrink-0",children:u(a.timestamp)}),e.jsx(p,{color:N,className:"flex-shrink-0",children:j}),e.jsx("span",{className:"min-[600px]:hidden text-[10px] font-mono text-text-muted flex-shrink-0",children:v.charAt(0)}),e.jsx(p,{color:k,className:"flex-shrink-0 hidden min-[600px]:inline-flex",children:v}),e.jsx("div",{className:"flex-shrink-0 flex items-center",children:e.jsx(Ke,{count:M})}),e.jsxs("span",{className:"hidden min-[520px]:inline text-[10px] text-text-muted font-mono flex-shrink-0",children:[B,"B"]}),e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:e.jsx(qe,{path:P,localHash:r})})]}),e.jsx("div",{className:"flex-shrink-0",children:e.jsx(Z,{rssi:a.rssi,snr:a.snr,compact:!0,showValues:!0})})]})]})}),et=s.memo(function({packet:s,onClick:a,localHash:n,neighbors:r,isFlashing:l=!1,isTraceHighlighted:i,traceTag:c,onViewTraceReport:o,dupeGroupPosition:d,isDupeGroupHovered:x=!1,onDupeGroupHover:m}){const{payloadType:g,routeType:f,payloadColor:b,routeColor:y}=Ye(s),j="tx_local"===s.packet_origin,v="TRACE"===g,N=h(s.is_duplicate),k=Je(s.original_path),w=Je(s.forwarded_path),C=w.length>0?w:k,S=C.length,H=s.src_hash?(s.src_hash.startsWith("0x")?s.src_hash.slice(2,6):s.src_hash.slice(0,4)).toUpperCase():null,P=Xe(s.src_hash,r),M=s.payload_length??s.length??0,_=s.lbt_attempts??0,T={lime:"rgb(132, 204, 22)",cyan:"rgb(34, 211, 238)",amber:"rgb(251, 191, 36)",violet:"rgb(167, 139, 250)",rose:"rgb(251, 113, 133)",emerald:"rgb(52, 211, 153)",sky:"rgb(56, 189, 248)",orange:"rgb(251, 146, 60)",pink:"rgb(244, 114, 182)",zinc:"rgb(161, 161, 170)",purple:"rgb(168, 85, 247)",indigo:"rgb(129, 140, 248)",teal:"rgb(45, 212, 191)",fuchsia:"rgb(232, 121, 249)",blue:"rgb(59, 130, 246)",green:"rgb(34, 197, 94)",yellow:"rgb(250, 204, 21)",red:"rgb(239, 68, 68)"},B=T[b]||T.zinc;return e.jsxs("div",{onClick:()=>{v&&c&&o?o(c):a(s)},className:t("relative pl-3 pr-2.5 py-2 cursor-pointer","active:bg-subtle-fill-hover",N&&"opacity-40",l&&"flash-row",j&&"bg-violet-500/5",i&&"bg-teal-500/10"),children:[e.jsx("div",{className:"absolute left-0 transition-all",style:(()=>{if(!d)return{opacity:0};const e=x?1:.4,t=x?"3px":"2px";return"first"===d?{backgroundColor:B,opacity:e,width:t,top:"6px",bottom:0,borderRadius:"0 9999px 0 0"}:"middle"===d?{backgroundColor:B,opacity:e,width:t,top:0,bottom:0,borderRadius:0}:"last"===d?{backgroundColor:B,opacity:e,width:t,top:0,bottom:"6px",borderRadius:"0 0 9999px 0"}:{backgroundColor:B,opacity:e,width:t,top:"6px",bottom:"6px",borderRadius:"9999px"}})()}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"relative flex-shrink-0 mt-0.5",children:e.jsx(Ge,{packet:s,variant:"avatar",size:"sm"})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-semibold text-[14px] text-text-primary tracking-tight",children:H||"—"}),P&&e.jsx("span",{className:"text-[12px] text-text-muted truncate max-w-[80px]",children:P}),e.jsx("div",{className:"flex-1"}),e.jsx(p,{color:b,className:"flex-shrink-0 !text-[9px] !px-1.5 !py-0",children:g}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("span",{className:"text-[10px] font-mono text-text-muted tabular-nums w-[28px] text-right",children:s.rssi}),e.jsx(Z,{rssi:s.rssi,compact:!0,showValues:!1})]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-text-muted font-mono",children:[e.jsx("span",{className:"tabular-nums",children:u(s.timestamp)}),e.jsx(p,{color:y,className:"!text-[8px] !px-1 !py-0 !leading-none",children:f.charAt(0)}),S>0&&e.jsxs("span",{children:[S,"h"]}),M>0&&e.jsxs("span",{children:[M,"B"]}),_>0&&e.jsxs("span",{className:_>1?"text-amber-400/60":void 0,children:["LBT:",_]}),null!=s.snr&&e.jsxs("span",{children:[s.snr.toFixed(0),"dB"]})]}),S>0&&e.jsx("div",{className:"pt-0.5",children:e.jsx(qe,{path:C,localHash:n})})]})]})]})});function tt(e){if(e.contact_type){const t=e.contact_type.toLowerCase();if("repeater"===t||"rep"===t)return!0;if("companion"===t||"client"===t||"cli"===t)return!1;if("room server"===t||"room_server"===t||"room"===t||"server"===t)return!1}return!0===e.is_repeater||(e.is_repeater,!1)}const st=s.lazy(()=>a(()=>import("./PathMapMapLibre-COhYm69t.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])));function at(e){return`${(100*e).toFixed(0)}%`}function nt(e,t){const s=document.documentElement,a=getComputedStyle(s),n={success:a.getPropertyValue("--accent-success").trim()||"#39D98A",secondary:a.getPropertyValue("--accent-secondary").trim()||"#F9D26F",poor:a.getPropertyValue("--signal-poor").trim()||"#FF8A5C",danger:a.getPropertyValue("--accent-danger").trim()||"#FF5C7A",muted:a.getPropertyValue("--text-muted").trim()||"#767688"};let r;return r=0===t?n.muted:e>=1?n.success:e>=.5?n.secondary:e>=.25?n.poor:e>0?n.danger:n.muted,{color:r}}class rt extends s.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?e.jsxs("div",{className:"h-[200px] flex items-center justify-center text-text-muted",children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),"Map failed to load"]}):this.props.children}}function lt({path:a,neighbors:n,localNode:r,localHash:l,srcHash:i,dstHash:c,neighborAffinity:o,prefixLookup:d,hubNodes:x,traceSnr:m,advertiserSource:p}){const[h,u]=s.useState(null),g=s.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=s.useMemo(()=>{if(p)return null;if(!i)return null;const e=y(i),t=n[i];if((null==t?void 0:t.latitude)&&(null==t?void 0:t.longitude)&&(0!==t.latitude||0!==t.longitude))return{prefix:e,candidates:[{hash:i,name:t.node_name||t.name||"Source",latitude:t.latitude,longitude:t.longitude,probability:1,isLocal:!1,isDirectNeighbor:!0===t.zero_hop}],confidence:1,totalMatches:1,isSource:!0};const s=(null==t?void 0:t.node_name)||(null==t?void 0:t.name)||i.slice(0,8);return{prefix:e,candidates:[{hash:i,name:s,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isSource:!0}},[p,i,n]),j=s.useMemo(()=>{const e=(null==c?void 0:c.startsWith("0x"))?c.slice(2):c;if((!e||"00"===e||"0000000000000000"===e)&&r&&l){const e=y(l),t=0!==r.latitude||0!==r.longitude;return{prefix:e,candidates:[{hash:l,name:r.name||"Local Node",latitude:t?r.latitude:0,longitude:t?r.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}if(!c)return null;const t=y(c);if(l&&c===l&&r){const e=0!==r.latitude||0!==r.longitude;return{prefix:t,candidates:[{hash:c,name:r.name||"Local Node",latitude:e?r.latitude:0,longitude:e?r.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}const s=n[c];if((null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&(0!==s.latitude||0!==s.longitude))return{prefix:t,candidates:[{hash:c,name:s.node_name||s.name||"Destination",latitude:s.latitude,longitude:s.longitude,probability:1,isLocal:!1,isDirectNeighbor:!0===s.zero_hop}],confidence:1,totalMatches:1,isDestination:!0};const a=(null==s?void 0:s.node_name)||(null==s?void 0:s.name)||c.slice(0,8);return{prefix:t,candidates:[{hash:c,name:a,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isDestination:!0}},[c,n,r,l]),v=s.useMemo(()=>function(e,t,s,a,n,r){if(!e||0===e.length)return{hops:[],overallConfidence:0,hasValidPath:!1};const l=e.length-1,i=e.map((i,c)=>{const o=c===l,d=e.length-c,{candidates:x,totalMatches:m}=function(e,t,s,a,n=!1,r,l,i){const c=function(e){const t={};for(const[s,a]of Object.entries(e))tt(a)&&(t[s]=a);return t}(t);let o;if(l){const t=function(e,t,s){const a=t.toUpperCase(),n=e.get(a);if(!n||0===n.candidates.length)return{hash:null,confidence:0};if(null==s?void 0:s.isLastHop)return{hash:n.bestMatch,confidence:n.confidence};if(1===(null==s?void 0:s.position))return{hash:n.bestMatch,confidence:n.confidence};if((null==s?void 0:s.position)&&n.bestMatchForPosition.has(s.position)){const e=n.bestMatchForPosition.get(s.position),t=Math.max(e.confidence,n.confidence);return{hash:e.hash,confidence:t}}if((null==s?void 0:s.adjacentPrefixes)&&s.adjacentPrefixes.length>0){let e=n.bestMatch,t=0;for(const a of n.candidates){let n=0;for(const e of s.adjacentPrefixes)n+=a.adjacentPrefixCounts.get(e.toUpperCase())||0;const r=a.combinedScore+n/Math.max(1,a.totalAdjacentObservations)*.3;r>t&&(t=r,e=a.hash)}return{hash:e,confidence:n.confidence}}return{hash:n.bestMatch,confidence:n.confidence}}(l,e,{position:i,isLastHop:n});o=t.confidence}const{matches:d,probability:x}=function(e,t,s,a,n=!1){const r=e.toUpperCase(),l=[],i=s&&b(r,s);i&&l.push(s);for(const p of Object.keys(t))b(r,p)&&l.push(p);if(n&&i&&s&&1===l.length)return{matches:l,probability:1,bestMatch:s};if(n&&i&&l.length>1){const e=l.filter(e=>e!==s);if(1===e.length)return{matches:l,probability:1,bestMatch:e[0]}}const c=l.length>0?1/l.length:0,o=[...l].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 t=a.get(e),s=t?"number"==typeof t?t:t.combinedScore:0;s>x&&(x=s,d=e)}d||(d=o[0])}else o.length>0&&(d=o[0]);let m=c;if(l.length>1&&a&&x>0){let e=0;for(const t of l){const s=a.get(t);e+=s?"number"==typeof s?s:s.combinedScore:0}e>0&&(m=Math.min(.95,x/e))}return{matches:l,probability:m,bestMatch:d}}(e,c,a,r,n),m=d.length,p=[],h=e.toUpperCase(),u=s&&void 0!==s.latitude&&void 0!==s.longitude&&(0!==s.latitude||0!==s.longitude);for(const f of d){if(a&&b(h,a)&&f===a&&u&&s){p.push({hash:f,name:s.name||"Local Node",latitude:s.latitude,longitude:s.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,t=g-1;p.slice(1).forEach(s=>{s.probability=e/t})}else{let e=0;const t=p.map(t=>{if(t.isLocal)return{candidate:t,score:1};const a=null==r?void 0:r.get(t.hash);let n=.5;var l;let i;return u&&s&&(n=(l=function(e,t,s,a){const n=(s-e)*Math.PI/180,r=(a-t)*Math.PI/180,l=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(s*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2);return 2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l))*6371e3}(s.latitude,s.longitude,t.latitude,t.longitude))<100?1:l<500?.9:l<1e3?.7:l<5e3?.5:l<1e4?.3:.1),a?i=.3*n+.3*a.hopConsistencyScore+.4*a.frequencyScore:(i=n,t.isDirectNeighbor&&(i=Math.max(i,.8))),e+=i,{candidate:t,score:i}});if(e>0)t.forEach(({candidate:t,score:s})=>{t.probability=Math.min(.95,s/e)});else{const e=1/g;p.forEach(t=>t.probability=e)}}return{candidates:p,totalMatches:m}}(i,t,s,a,o,n,r,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,t)=>0===t.confidence?0:e*t.confidence,1),o=i.some(e=>e.candidates.length>0);return{hops:i,overallConfidence:c,hasValidPath:o}}(a,n,r,l,o,d),[a,n,r,l,o,d]),N=s.useMemo(()=>{const e=[];g?e.push(g):f&&e.push(f),e.push(...v.hops),j&&e.push(j);const t=e.reduce((e,t)=>0===t.confidence?0:e*t.confidence,1),s=e.some(e=>e.candidates.some(e=>0!==e.latitude||0!==e.longitude));return{hops:e,overallConfidence:t,hasValidPath:s}},[g,f,v,j]);return N.hasValidPath?e.jsxs("div",{className:"h-full flex flex-col space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-text-muted",children:"Path Confidence:"}),e.jsx("span",{className:(k=N.overallConfidence,k>=1?"text-accent-success":k>=.5?"text-accent-secondary":k>=.25?"text-signal-poor":k>0?"text-accent-danger":"text-text-muted"),children:at(N.overallConfidence)}),e.jsx("button",{className:"text-text-muted hover:text-text-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:e.jsx(se,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-success"}),e.jsx("span",{className:"text-text-muted",children:"Exact"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-secondary"}),e.jsx("span",{className:"text-text-muted",children:"Multi"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-text-muted"}),e.jsx("span",{className:"text-text-muted",children:"Unknown"})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(rt,{children:e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"h-full bg-bg-elevated flex items-center justify-center text-text-muted text-sm",children:"Loading map..."}),children:e.jsx(st,{resolvedPath:N,localNode:r,hubNodes:x,hoveredHopIndex:h,onHoverHop:u,traceSnr:m})})})}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:N.hops.map((s,a)=>{var n,r,l;const i=!0===s.isSource,c=!0===s.isDestination,o=h===a;let d;return d=i?`Source: ${(null==(n=s.candidates[0])?void 0:n.name)||"Unknown"}`:c?`Destination: ${(null==(r=s.candidates[0])?void 0:r.name)||"Unknown"}`:0===s.totalMatches?"No matching nodes found":1===s.totalMatches?`Exact match: ${(null==(l=s.candidates[0])?void 0:l.name)||"Unknown"}`:`${s.totalMatches} possible matches (${(100*s.confidence).toFixed(0)}% confidence)`,e.jsxs("div",{className:t("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-mono cursor-pointer transition-all",o?"bg-accent-primary/20 ring-1 ring-accent-primary/50":"bg-bg-elevated hover:bg-bg-subtle",i&&"border border-accent-success/30",c&&"border border-accent-primary/30"),title:d,onMouseEnter:()=>u(a),onMouseLeave:()=>u(null),children:[i&&e.jsx("span",{className:"text-accent-success text-[8px] mr-0.5",children:"SRC"}),c&&e.jsx("span",{className:"text-accent-primary text-[8px] mr-0.5",children:"DST"}),e.jsx("span",{style:nt(s.confidence,s.totalMatches),children:s.prefix}),!i&&!c&&s.totalMatches>1&&e.jsxs("span",{className:"text-text-muted",children:["×",s.totalMatches]}),!i&&!c&&0===s.totalMatches&&e.jsx("span",{className:"text-text-muted",children:"?"})]},a)})})]}):e.jsxs("div",{className:"flex items-center justify-center text-text-muted text-xs py-4",children:[e.jsx(xe,{className:"w-3.5 h-3.5 mr-1.5 opacity-50"}),"No location data available for path nodes"]});var k}function it(e){return e.match(/.{1,2}/g)||[]}function ct(e){return null!==e&&e.startsWith("payload:")}const ot={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(--text-muted)"},dt=15,xt="color-mix(in srgb, var(--bg-elevated) 60%, var(--bg-body))",mt="\n inset 0 0 0 1px color-mix(in srgb, var(--text-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 ",pt=2,ht={type:"tween",duration:.25,ease:[.25,.1,.25,1]};function ut(e,t){return e?`inset 0 0 0 ${pt}px ${ot[t]}`:mt}function gt(e,t){return e?t:`color-mix(in srgb, ${t} ${dt}%, transparent)`}function ft({segments:t,selectedSegment:a,onSegmentClick:n}){const[r,l]=s.useState(null),[i,c]=s.useState(null),o=t.some(e=>void 0!==e.id)&&n,d=[];for(const e of t){const t=it(e.hex);for(const s of t)d.push({byte:s.toUpperCase(),color:e.color,id:e.id})}const x=[];for(let e=0;e{const d=t.length<16;return e.jsx("div",{className:"flex rounded-md overflow-hidden",children:t.map(({byte:s,color:x,id:m},p)=>{const h=p===t.length-1,u=d&&h,g=ot[x],f=m?r===m:i===x,b=Boolean(m&&a===m),y=f||b;return e.jsx("span",{className:"w-[1.75rem] text-xs text-center py-0.5 font-mono select-text "+(o?"cursor-pointer":""),style:{backgroundColor:gt(y,g),color:y?"rgba(255,255,255,0.95)":g,transition:y?"none":"background-color 0.15s ease-out, color 0.15s ease-out",touchAction:"manipulation",...u?{borderRadius:"0 0.375rem 0.375rem 0"}:{}},onMouseEnter:()=>{m?l(m):c(x)},onMouseLeave:()=>{l(null),c(null)},onClick:()=>m&&(null==n?void 0:n(m)),onTouchStart:()=>{m?l(m):c(x)},onTouchEnd:()=>{l(null),c(null)},children:s},p)})},s)})})}function bt({rawHex:t,hexSegments:a,selectedSegment:n,onSegmentClick:r}){const[l,i]=s.useState(!1),c=s.useCallback(async()=>{try{await navigator.clipboard.writeText(t.toUpperCase()),i(!0),setTimeout(()=>i(!1),2e3)}catch(e){}},[t]);return e.jsxs("div",{className:"bg-black rounded-2xl p-6 relative",children:[e.jsx(ft,{segments:a,selectedSegment:n,onSegmentClick:r}),e.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-text-muted hover:text-text-secondary transition-all text-xs font-sans",title:"Copy raw packet hex",children:l?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"w-3.5 h-3.5 text-green-400"}),e.jsx("span",{className:"text-green-400",children:"Copied"})]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Copy"})]})})]})}function yt({bits:t,field:s,value:a,binary:n}){return e.jsxs("tr",{children:[e.jsx("td",{className:"py-1.5 text-xs text-text-muted tabular-nums",children:t}),e.jsx("td",{className:"py-1.5 text-sm text-text-secondary",children:s}),e.jsx("td",{className:"py-1.5",children:(()=>{if("Payload Type"===s){const t=te[a]||"zinc";return e.jsx(p,{color:t,children:a})}if("Route Type"===s){const t=ee[a]||"zinc";return e.jsx(p,{color:t,children:a})}return e.jsx("span",{className:"text-sm text-text-primary",children:a})})()}),e.jsx("td",{className:"py-1.5 font-mono text-xs text-sys-cyan",children:n})]})}function jt({id:t,title:s,color:a,hexBytes:n,startByte:r,endByte:l,isSelected:i,children:c}){const o=n?it(n):[];return e.jsxs(N.div,{layout:"position",layoutId:t,transition:ht,className:"w-full min-w-0 overflow-hidden rounded-xl p-4 sm:p-5 space-y-4",style:{backgroundColor:xt,boxShadow:ut(i,a)},children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 min-w-0",children:[e.jsx(p,{color:a,children:s}),o.length>0&&o.length<=16&&o.map((t,s)=>e.jsx(p,{color:a,className:"font-mono",children:t.toUpperCase()},s))]}),e.jsxs("span",{className:"text-[10px] text-text-muted font-mono flex-shrink-0",children:["Bytes ",r,"-",l]})]}),e.jsx("div",{className:"min-w-0 overflow-hidden",children:c})]})}function vt({advert:t,timestamp:s}){const a=S(s||t.timestamp);return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-purple-500/10 dark:bg-purple-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-purple) 0%, var(--sys-blue) 100%)"},children:e.jsx(M,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:t.name||"Unknown Node"}),e.jsx("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:t.nodeType})]})]}),e.jsx("div",{className:"mx-4 border-t border-border-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-2",children:[void 0!==t.latitude&&void 0!==t.longitude&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(xe,{className:"w-4 h-4 text-purple-600 dark:text-purple-400 flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-text-secondary font-mono",children:[t.latitude.toFixed(5),"°, ",t.longitude.toFixed(5),"°"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(H,{className:"w-4 h-4 text-purple-600 dark:text-purple-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]})]})]})})}function Nt({decoded:t,timestamp:s}){const a=s?S(s):"Unknown";return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-teal-500/10 dark:bg-teal-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.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:e.jsx(ye,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:t.channelName||"Channel Data"}),e.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:[t.dataLength," bytes • ",t.decrypted?"Decrypted":"Encrypted"]})]})]}),e.jsx("div",{className:"mx-4 border-t border-border-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ue,{className:"w-4 h-4 text-teal-600 dark:text-teal-400 flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-text-secondary font-sans",children:["Channel: ",e.jsxs("span",{className:"font-mono",children:["0x",t.channelHash]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(H,{className:"w-4 h-4 text-teal-600 dark:text-teal-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]}),t.decrypted&&t.decryptedHex&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-border-subtle",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted mb-1 font-sans",children:"Decrypted Data"}),e.jsx("div",{className:"max-w-full overflow-x-auto",children:e.jsx(pe,{size:"compact",copy:!0,className:"inline-block",children:e.jsx("span",{className:"break-all text-xs",children:t.decryptedHex.toUpperCase()})})})]})]})]})})}function kt({decoded:t,timestamp:a,isLoading:n=!1,onDecrypted:r}){const l=a?S(a):"Unknown",[i,c]=s.useState(""),[o,d]=s.useState(!1),[x,p]=s.useState(null),[h,u]=s.useState(!1),g=s.useCallback(async()=>{if(i.trim()&&t.ciphertextHex&&t.macHex){d(!0),p(null);try{const e=parseInt(t.channelHash,16),s=m(t.macHex),a=m(t.ciphertextHex),n=await P(i.trim(),e,s,a);if(n.success){const e=n.result.plaintext,s=new TextDecoder("utf-8",{fatal:!1}).decode(e.slice(5)),a=s.indexOf(": "),l={...t,channelName:n.result.channelName,decrypted:!0,timestamp:e[0]|e[1]<<8|e[2]<<16|e[3]<<24,flags:e[4],senderName:a>0?s.slice(0,a):void 0,text:a>0?s.slice(a+2):s};null==r||r(l),c(""),u(!1)}else p(n.error)}catch(e){p(e instanceof Error?e.message:"Unknown error")}finally{d(!1)}}},[i,t,r]);return n?e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-xl p-4 sm:p-5",style:{backgroundColor:"color-mix(in srgb, var(--bg-elevated) 60%, var(--bg-body))",boxShadow:"\n inset 0 0 0 1px color-mix(in srgb, var(--text-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:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 h-[15px]",children:[e.jsx("div",{className:"h-2.5 w-12 rounded bg-subtle-fill-hover animate-pulse"}),e.jsx("div",{className:"h-2.5 w-16 rounded bg-subtle-fill-hover animate-pulse"})]}),e.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:e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"h-3.5 w-48 rounded bg-subtle-fill-strong animate-pulse"}),e.jsx("div",{className:"h-3.5 w-32 rounded bg-subtle-fill-strong animate-pulse"})]})})]})}):t.decrypted?e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-xl p-4 sm:p-5",style:{backgroundColor:"color-mix(in srgb, var(--bg-elevated) 60%, var(--bg-body))",boxShadow:"\n inset 0 0 0 1px color-mix(in srgb, var(--text-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:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.senderName&&e.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:["From ",e.jsx("span",{className:"text-text-secondary font-medium",children:t.senderName})]}),t.channelName&&e.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:["in ",e.jsx("span",{className:"text-sys-cyan font-medium",children:t.channelName})]})]}),e.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:e.jsx("p",{className:"text-sm text-white font-sans leading-relaxed whitespace-pre-wrap break-words",children:t.text})})]})}):e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-zinc-500/10 dark:bg-zinc-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-zinc) 0%, color-mix(in srgb, var(--sys-zinc) 70%, black) 100%)"},children:e.jsx(Ce,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:t.isPublicHashChannel?"Public Hash Channel":"Encrypted Message"}),e.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:["Channel hash: ",e.jsxs("span",{className:"font-mono",children:["0x",t.channelHash]})]})]})]}),e.jsx("div",{className:"mx-4 border-t border-border-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(H,{className:"w-4 h-4 text-zinc-500 dark:text-zinc-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary font-sans",children:l})]}),t.ciphertextHex&&t.macHex&&e.jsx("div",{className:"space-y-2",children:h?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.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-border-subtle text-text-primary placeholder:text-text-muted focus:outline-none focus:border-zinc-500",onKeyDown:e=>"Enter"===e.key&&g(),disabled:o}),e.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"}),e.jsx("button",{onClick:()=>{u(!1),p(null),c("")},className:"px-2 py-1.5 text-sm rounded-lg hover:bg-subtle-fill-strong text-text-muted transition-colors",children:"×"})]}),x&&e.jsx("p",{className:"text-xs text-red-400",children:x})]}):e.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&&e.jsx("p",{className:"text-xs text-text-muted",children:t.isPublicHashChannel?"Public hash channel message. Key not in common channel list.":"Unknown hash channel. Channel name required for decryption."})]})]})})}function wt({decoded:t,timestamp:s}){const a=s?S(s):"Unknown";return e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.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:e.jsx(be,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-text-primary font-sans",children:"Acknowledgment"}),e.jsxs("p",{className:"text-xs text-text-muted font-sans mt-0.5",children:["CRC: ",e.jsxs("span",{className:"font-mono text-sys-green",children:["0x",t.crc]})," · ",a]})]})]})}function Ct({decoded:t,timestamp:s}){const a=s?S(s):"Unknown",n=t.path.length;return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-amber-500/10 dark:bg-amber-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.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:e.jsx(ge,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:"Path Response"}),e.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:[n," ",1===n?"hop":"hops"]})]})]}),e.jsx("div",{className:"mx-4 border-t border-border-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(H,{className:"w-4 h-4 text-amber-600 dark:text-amber-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]}),t.path.length>0&&e.jsx("div",{className:"mt-2 pt-2 border-t border-border-subtle",children:e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:t.path.map((t,s)=>e.jsxs("div",{className:"flex items-center gap-2",children:[s>0&&e.jsx(Ne,{className:"w-4 h-4 text-amber-500 dark:text-amber-400"}),e.jsx(p,{color:"amber",className:"font-mono",children:t})]},s))})})]})]})})}function St({decoded:t,timestamp:s}){const a=s?S(s):"Unknown",n=t.pathHashes.length,r=t.snrValues.length;return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-blue-500/10 dark:bg-blue-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.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:e.jsx(fe,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("h3",{className:"text-lg font-medium text-text-primary truncate leading-tight",children:["Trace ",t.isComplete?"Complete":"In Progress"]}),e.jsxs("p",{className:"text-sm text-text-muted mt-0.5",children:["Tag: 0x",t.traceTag.slice(0,8),t.isComplete&&" • ✓"]})]})]}),e.jsx("div",{className:"mx-4 border-t border-border-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(H,{className:"w-4 h-4 text-blue-600 dark:text-blue-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary",children:a})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-text-muted",children:[e.jsxs("span",{children:[n," target ",1===n?"hop":"hops"]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:[r," SNR ",1===r?"sample":"samples"]}),0!==t.authCode&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsxs("span",{children:["Auth: ",t.authCode]})]})]}),t.pathHashes.length>0&&e.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:t.pathHashes.map((s,a)=>{const n=t.snrValues[a],r=void 0!==n?(e=>e>=7?"green":e>=0?"yellow":e>=-5?"orange":"red")(n):"zinc",l=void 0!==n;return e.jsxs("div",{className:"flex items-center gap-2",children:[a>0&&e.jsx(Ne,{className:"w-4 h-4 text-blue-500 dark:text-blue-400 flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(p,{color:l?"blue":"zinc",className:"font-mono",children:s}),l&&e.jsxs(p,{color:r,className:"font-mono",children:[n>=0?"+":"",Number.isInteger(n)?n:n.toFixed(1),"dB"]})]})]},a)})})]})]})})}function Ht({decoded:t,timestamp:s}){const a=s?S(s):"Unknown";return t.encrypted?e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:"linear-gradient(135deg, var(--sys-purple) 0%, var(--sys-indigo) 100%)"},children:e.jsx(Ce,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-text-primary font-sans",children:"Encrypted Message"}),e.jsxs("p",{className:"text-xs text-text-muted font-sans mt-0.5",children:[t.srcHash," → ",t.destHash," · ",a]})]})]}):e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5 px-1",children:[e.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:[e.jsx("span",{className:"font-mono text-text-secondary",children:t.srcHash})," → ",e.jsx("span",{className:"font-mono text-text-secondary",children:t.destHash})]}),e.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:["· ",a]})]}),e.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:e.jsx("p",{className:"text-sm text-white font-sans leading-relaxed whitespace-pre-wrap break-words",children:t.text})})]})}function Pt({decoded:t,timestamp:s}){const a=s?S(s):"Unknown",n=(t.partNumber+1)/t.totalParts*100;return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-yellow-500/10 dark:bg-yellow-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.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:e.jsx(he,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:"Multipart Segment"}),e.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:["Part ",t.partNumber+1," of ",t.totalParts]})]})]}),e.jsx("div",{className:"mx-4 border-t border-border-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-3",children:[e.jsx("div",{children:e.jsx("div",{className:"h-2 bg-subtle-fill-strong rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${n}%`,background:"linear-gradient(90deg, var(--sys-yellow), var(--sys-amber))"}})})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ue,{className:"w-4 h-4 text-yellow-600 dark:text-yellow-400 flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-text-secondary font-sans",children:["Message ID: ",e.jsx("span",{className:"font-mono",children:t.messageId})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(H,{className:"w-4 h-4 text-yellow-600 dark:text-yellow-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]})]})]})})}function Mt({decoded:t,timestamp:s,payloadType:a}){const n=s?S(s):"Unknown",r=(()=>{switch(a){case k.REQ:return{icon:_,gradient:"var(--sys-orange), var(--sys-red)",bg:"rgba(249, 115, 22, 0.15)",label:"Request"};case k.RESPONSE:return{icon:Se,gradient:"var(--sys-green), var(--sys-teal)",bg:"rgba(34, 197, 94, 0.15)",label:"Response"};case k.ANON_REQ:return{icon:Ce,gradient:"var(--sys-purple), var(--sys-pink)",bg:"rgba(168, 85, 247, 0.15)",label:"Anonymous Request"};default:return{icon:ae,gradient:"var(--sys-gray), var(--sys-slate)",bg:"rgba(107, 114, 128, 0.15)",label:t.payloadTypeName}}})(),l=r.icon;return e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:`linear-gradient(135deg, ${r.gradient})`},children:e.jsx(l,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-text-primary font-sans",children:r.label}),e.jsxs("p",{className:"text-xs text-text-muted font-sans mt-0.5",children:[t.length," bytes · ",n]})]})]})}function _t({pathHex:t}){if(!t)return null;const s=it(t);return e.jsx("div",{className:"flex flex-wrap items-center gap-2 py-2",children:s.map((t,s)=>e.jsxs("div",{className:"flex items-center gap-2",children:[s>0&&e.jsx(Ne,{className:"w-4 h-4 text-sys-amber flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(pe,{size:"compact",copy:!0,children:t.toUpperCase()}),e.jsx("span",{className:"text-[10px] text-text-muted font-sans tabular-nums w-4 text-left",children:s+1})]})]},s))})}function Tt({decoded:t,payloadType:s}){const a=C[s]||`TYPE_${s}`;switch(t.type){case"advert":{const s="chat"===t.nodeType?"companion":t.nodeType.replace("_"," "),a=void 0!==t.latitude&&void 0!==t.longitude&&!(0===t.latitude&&0===t.longitude);return e.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Role:"})," ",s]}),t.name&&e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Name:"})," ",t.name]}),a&&e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Location:"})," ",t.latitude.toFixed(4),"°, ",t.longitude.toFixed(4),"°"]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Time:"})," ",S(t.timestamp)]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Flags:"})," ",t.flagsDescription]})]})}case"ack":return e.jsx("div",{className:"text-xs text-text-primary space-y-0.5",children:e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"CRC:"})," 0x",t.crc]})});case"path":return e.jsx("div",{className:"text-xs text-text-primary space-y-1",children:e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Path:"})," ",t.pathString||"(empty)"]})});case"trace":return e.jsxs("div",{className:"text-xs text-text-primary space-y-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Tag:"})," 0x",t.traceTag]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Target Path:"})," ",t.pathString||"(empty)"]}),t.snrValues.length>0&&e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"SNR:"})," ",t.snrValues.map(e=>`${e>=0?"+":""}${Number.isInteger(e)?e:e.toFixed(1)}dB`).join(" → ")]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Status:"})," ",t.isComplete?"✓ Complete":`In progress (${t.snrValues.length}/${t.pathHashes.length})`]})]});case"txt_msg":return e.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Dest:"})," ",t.destHash]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Src:"})," ",t.srcHash]}),t.encrypted?e.jsx("p",{className:"text-text-muted italic",children:"Encrypted content"}):e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Text:"})," ",t.text]})]});case"grp_txt":return e.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Channel:"})," ",t.channelName?e.jsx("span",{className:"text-accent-success",children:t.channelName}):t.isPublicHashChannel?e.jsx("span",{className:"text-accent-secondary",children:"Public Hash Channel"}):e.jsxs("span",{className:"font-mono",children:["0x",t.channelHash]})]}),t.decrypted?e.jsxs(e.Fragment,{children:[t.senderName&&e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"From:"})," ",t.senderName]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Text:"})," ",t.text]})]}):t.isPublicHashChannel?e.jsx("p",{className:"text-text-muted italic",children:"Encrypted (public hash channel)"}):e.jsx("p",{className:"text-text-muted italic",children:"Encrypted (unknown channel)"})]});case"grp_data":return e.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Channel:"})," ",t.channelName?e.jsx("span",{className:"text-sys-teal",children:t.channelName}):e.jsxs("span",{className:"font-mono",children:["0x",t.channelHash]})]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Data:"})," ",t.dataLength," bytes ",t.decrypted?"(decrypted)":"(encrypted)"]})]});case"multipart":return e.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Part:"})," ",t.partNumber+1,"/",t.totalParts]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Message ID:"})," ",t.messageId]})]});default:return e.jsxs("p",{className:"text-xs text-text-secondary",children:[a," (",t.length," bytes)"]})}}const Bt=s.memo(function({packet:t,decodedGrpTxt:a}){var n,r;const l=t.raw_packet||"",i=l.length/2,c=j(),[o,m]=s.useState(null),[h,u]=s.useState(null),[g,f]=s.useState(!1),[b,y]=s.useState(null),w=s.useCallback(e=>{y(t=>t===e?null:e)},[]),C=s.useMemo(()=>function(e){if(!e||e.length<4)return null;const t=W.fromHex(e);if(!t.success||!t.packet)return null;const s=t.packet,a=function(e){const t=3&e,s=e>>2&15,a=e>>6&3;return[{bits:"0-1",field:"Route Type",value:d(t),binary:(3&t).toString(2).padStart(2,"0")},{bits:"2-5",field:"Payload Type",value:x(s),binary:(15&s).toString(2).padStart(4,"0")},{bits:"6-7",field:"Version",value:a.toString(),binary:(3&a).toString(2).padStart(2,"0")}]}(s.header),n=e.slice(0,2);let r=2,l="";s.hasTransportCodes()&&(l=e.slice(2,10),r=10);const i=e.slice(r,r+2),c=r+2,o=c+2*s.pathLen,m=e.slice(c,o),p=e.slice(o),h=G(s);return{packet:s,headerHex:n,headerFields:a,transportCodesHex:l,pathLengthHex:i,pathDataHex:m,payloadHex:p,payloadStartByte:Math.floor(o/2),decoded:h}}(l),[l]),H=null==(n=null==C?void 0:C.packet)?void 0:n.payloadType,P=(null==C?void 0:C.payloadHex)||"",M=null==(r=null==C?void 0:C.packet)?void 0:r.payload,_=H===k.GRP_TXT,T=H===k.GRP_DATA,B=_&&!a&&(!c||g);if(s.useEffect(()=>{if(m(null),f(!1),a)return;if(!_||!M||M.length<4)return;if(!c)return void f(!0);f(!0);let e=!1;return K(M).then(t=>{e||(m(t),f(!1))}),()=>{e=!0}},[P,_,c,a]),s.useEffect(()=>{if(u(null),!T||!M||M.length<4)return;if(!c)return;let e=!1;return Y(M).then(t=>{e||u(t)}),()=>{e=!0}},[P,T,c]),!C||0===l.length)return e.jsx("div",{className:"p-4 text-center text-text-muted",children:e.jsx("p",{className:"text-sm",children:"No raw packet data available"})});const{packet:F}=C;let L=C.decoded;a&&"grp_txt"===C.decoded.type?L=a:o&&"grp_txt"===C.decoded.type?L=o:h&&"grp_data"===C.decoded.type&&(L=h);const z=s.useMemo(()=>function(t,s){switch(t.type){case"advert":return function(t,s){const a=[];let n=0;const r=s.slice(0,64);a.push({id:"payload:publicKey",title:"Public Key",color:"pink",hex:r,startByte:n,endByte:n+31,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:t.publicKey.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Ed25519 public key (32 bytes)"})]})}),n+=32;const l=s.slice(64,72);a.push({id:"payload:timestamp",title:"Timestamp",color:"orange",hex:l,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:l.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:[t.timestamp," (",S(t.timestamp),")"]})]})}),n+=4;const i=s.slice(72,200);a.push({id:"payload:signature",title:"Signature",color:"teal",hex:i,startByte:n,endByte:n+63,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:t.signature.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Ed25519 signature (64 bytes)"})]})}),n+=64;const c=s.slice(200,202);if(a.push({id:"payload:flags",title:"Flags",color:"blue",hex:c,startByte:n,endByte:n,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(pe,{size:"standard",copy:!0,children:["0x",t.flags.toString(16).padStart(2,"0").toUpperCase()]}),e.jsx("p",{className:"text-xs text-text-primary mt-1",children:t.flagsDescription}),e.jsxs("p",{className:"text-xs text-text-muted",children:["Node Type: ",t.nodeType]})]})}),n+=1,void 0!==t.latitude){const r=s.slice(2*n,2*n+8);a.push({id:"payload:latitude",title:"Latitude",color:"green",hex:r,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:r.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:[t.latitude.toFixed(6),"°"]})]})}),n+=4}if(void 0!==t.longitude){const r=s.slice(2*n,2*n+8);a.push({id:"payload:longitude",title:"Longitude",color:"purple",hex:r,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:r.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:[t.longitude.toFixed(6),"°"]})]})}),n+=4}if(t.name){const r=s.slice(2*n),l=r.length/2;a.push({id:"payload:name",title:"Name",color:"amber",hex:r,startByte:n,endByte:n+l-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:r.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:['"',t.name,'"']})]})})}return a}(t,s);case"ack":return function(t,s){return[{id:"payload:crc",title:"CRC",color:"green",hex:s.slice(0,8),startByte:0,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(pe,{size:"standard",copy:!0,children:["0x",t.crc]}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"CRC32 of acknowledged packet"})]})}]}(t,s);case"grp_txt":return function(t,s){const a=[];a.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:s.slice(0,2),startByte:0,endByte:0,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(pe,{size:"standard",copy:!0,children:["0x",t.channelHash]}),t.channelName&&e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:["Channel: ",t.channelName]})]})}),t.macHex&&a.push({id:"payload:mac",title:"MAC",color:"purple",hex:s.slice(2,6),startByte:1,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:t.macHex.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=s.slice(6);return n&&a.push({id:"payload:ciphertext",title:t.decrypted?"Message":"Ciphertext",color:t.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:t.decrypted?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-text-primary",children:['"',t.text,'"']}),t.senderName&&e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:["From: ",t.senderName]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:n.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"AES-128-ECB encrypted"})]})}),a}(t,s);case"grp_data":return function(t,s){const a=[];a.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:s.slice(0,2),startByte:0,endByte:0,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(pe,{size:"standard",copy:!0,children:["0x",t.channelHash]}),t.channelName&&e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:["Channel: ",t.channelName]})]})}),t.macHex&&a.push({id:"payload:mac",title:"MAC",color:"purple",hex:s.slice(2,6),startByte:1,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:t.macHex.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=s.slice(6);return n&&a.push({id:"payload:ciphertext",title:t.decrypted?"Decrypted Data":"Encrypted Data",color:t.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:(t.decryptedHex||n).toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[t.dataLength," bytes",t.decrypted?"":" (AES-128-ECB encrypted)"]})]})}),a}(t,s);case"path":return function(t,s){return[{id:"payload:path",title:"Path Hops",color:"amber",hex:s,startByte:0,endByte:s.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:t.path.map((t,s)=>e.jsxs("span",{className:"flex items-center gap-1",children:[s>0&&e.jsx(Ne,{className:"w-3 h-3 text-text-muted"}),e.jsx(p,{color:"amber",className:"font-mono",children:t})]},s))}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[t.path.length," hops"]})]})}]}(t,s);case"trace":return function(t,s){const a=[];a.push({id:"payload:crc",title:"Trace Tag",color:"blue",hex:s.slice(0,8),startByte:0,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(pe,{size:"standard",copy:!0,children:["0x",t.traceTag]}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Unique trace request identifier"})]})}),a.push({id:"payload:mac",title:"Auth Code",color:"purple",hex:s.slice(8,16),startByte:4,endByte:7,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:t.authCode}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Authentication/verification code"})]})}),a.push({id:"payload:flags",title:"Flags",color:"amber",hex:s.slice(16,18),startByte:8,endByte:8,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(pe,{size:"standard",copy:!0,children:["0x",t.flags.toString(16).toUpperCase().padStart(2,"0")]}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:0===t.flags?"No flags set":`Flags: ${t.flags.toString(2).padStart(8,"0")}b`})]})});const n=s.slice(18);if(n){const s=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:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:t.pathHashes.map((a,n)=>{const r=t.snrValues[n],l=void 0!==r?s(r):"zinc";return e.jsxs("span",{className:"flex items-center gap-1",children:[n>0&&e.jsx(Ne,{className:"w-3 h-3 text-text-muted"}),e.jsx(p,{color:"indigo",className:"font-mono",children:a}),void 0!==r&&e.jsxs(p,{color:l,className:"font-mono",children:[r>=0?"+":"",Number.isInteger(r)?r:r.toFixed(1),"dB"]})]},n)})}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[t.pathHashes.length," target ",1===t.pathHashes.length?"hop":"hops",t.snrValues.length>0&&` • ${t.snrValues.length} SNR ${1===t.snrValues.length?"value":"values"} collected`,t.isComplete&&" • ✓ Complete"]})]})})}return a}(t,s);case"multipart":return function(t,s){const a=[];a.push({id:"payload:msgId",title:"Message ID",color:"blue",hex:s.slice(0,4),startByte:0,endByte:1,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:t.messageId.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Unique message identifier"})]})}),a.push({id:"payload:partNum",title:"Part Number",color:"amber",hex:s.slice(4,6),startByte:2,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:t.partNumber}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"0-indexed part number"})]})}),a.push({id:"payload:totalParts",title:"Total Parts",color:"orange",hex:s.slice(6,8),startByte:3,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:t.totalParts}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:["Part ",t.partNumber+1," of ",t.totalParts]})]})});const n=s.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:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:n.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[n.length/2," bytes"]})]})}),a}(t,s);default:return[{id:"payload:ciphertext",title:"Raw Data",color:"zinc",hex:s,startByte:0,endByte:s.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:s.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[s.length/2," bytes"]})]})}]}}(L,C.payloadHex),[L,C.payloadHex]),D="payload"===b||ct(b),A=s.useMemo(()=>{const e=[{id:"header",hex:C.headerHex,color:"red"},...C.transportCodesHex?[{id:"transportCodes",hex:C.transportCodesHex,color:"purple"}]:[],{id:"pathLength",hex:C.pathLengthHex,color:"green"},...C.pathDataHex?[{id:"pathData",hex:C.pathDataHex,color:"amber"}]:[]];return D?[...e,...(t=z,t.map(e=>({id:e.id,hex:e.hex,color:e.color})))]:[...e,{id:"payload",hex:C.payloadHex,color:"cyan"}];var t},[C,D,z]);return e.jsxs("div",{className:"font-mono space-y-2 min-w-0 overflow-hidden",children:[(()=>{switch(L.type){case"advert":return e.jsx(vt,{advert:L,timestamp:t.timestamp});case"grp_data":return e.jsx(Nt,{decoded:L,timestamp:t.timestamp});case"grp_txt":return e.jsx(kt,{decoded:L,timestamp:t.timestamp,isLoading:B,onDecrypted:m});case"ack":return e.jsx(wt,{decoded:L,timestamp:t.timestamp});case"path":return e.jsx(Ct,{decoded:L,timestamp:t.timestamp});case"trace":return e.jsx(St,{decoded:L,timestamp:t.timestamp});case"txt_msg":return e.jsx(Ht,{decoded:L,timestamp:t.timestamp});case"multipart":return e.jsx(Pt,{decoded:L,timestamp:t.timestamp});case"generic":return F.payloadType===k.REQ||F.payloadType===k.RESPONSE||F.payloadType===k.ANON_REQ?e.jsx(Mt,{decoded:L,timestamp:t.timestamp,payloadType:F.payloadType}):null;default:return null}})(),e.jsx(bt,{rawHex:l,hexSegments:A,selectedSegment:b,onSegmentClick:w}),e.jsx(v,{children:e.jsx(N.div,{layout:!0,transition:ht,className:"space-y-2 min-w-0",children:(()=>{var t,s,a,n;const r=[{id:"header",title:"Header",color:"red",startByte:0,endByte:0,hexBytes:`0x${C.headerHex.toUpperCase()}`,condition:!0,content:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted border-b border-border-subtle font-sans",children:[e.jsx("th",{className:"py-1 font-medium",children:"Bits"}),e.jsx("th",{className:"py-1 font-medium",children:"Field"}),e.jsx("th",{className:"py-1 font-medium",children:"Value"}),e.jsx("th",{className:"py-1 font-medium",children:"Binary"})]})}),e.jsx("tbody",{children:C.headerFields.map(t=>e.jsx(yt,{...t},t.bits))})]})},{id:"transportCodes",title:"Transport Codes",color:"purple",startByte:1,endByte:4,hexBytes:(null==(t=C.transportCodesHex)?void 0:t.toUpperCase())||"",condition:!!C.transportCodesHex,content:e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Two 16-bit transport codes for encrypted routing"}),e.jsxs("div",{className:"mt-1 text-xs text-text-secondary",children:["Code 1: 0x",null==(s=C.transportCodesHex)?void 0:s.slice(0,4).toUpperCase()," | Code 2: 0x",null==(a=C.transportCodesHex)?void 0:a.slice(4,8).toUpperCase()]})]})},{id:"pathLength",title:"Path Length",color:"green",startByte:C.transportCodesHex?5:1,endByte:C.transportCodesHex?5:1,hexBytes:`0x${C.pathLengthHex.toUpperCase()}`,condition:!0,content:e.jsxs("p",{className:"text-xs text-text-muted pt-1",children:[F.pathLen," bytes showing route taken (increases as packet floods)"]})},{id:"pathData",title:"Path Data",color:"amber",startByte:C.transportCodesHex?6:2,endByte:(C.transportCodesHex?5:1)+F.pathLen,hexBytes:(null==(n=C.pathDataHex)?void 0:n.toUpperCase())||"",condition:F.pathLen>0,content:e.jsxs("div",{className:"space-y-3",children:[e.jsx(_t,{pathHex:C.pathDataHex}),e.jsx("p",{className:"text-xs text-text-muted",children:"Historical route taken (bytes are added as packet floods through network)"})]})},{id:"payload",title:"Payload",color:"cyan",startByte:C.payloadStartByte,endByte:i-1,hexBytes:C.payloadHex.toUpperCase(),condition:!0,content:e.jsxs(e.Fragment,{children:[!ct(b)&&e.jsxs("div",{className:"p-3 rounded-lg bg-black",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted mb-1.5 font-sans",children:"Decoded"}),e.jsx(Tt,{decoded:L,payloadType:F.payloadType})]}),!ct(b)&&z.length>0&&e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted mt-3 font-sans",children:"Click a field below to highlight its bytes"}),ct(b)&&e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted font-sans",children:"↑ Selected field above • Other fields below ↓"})]})}].filter(e=>e.condition),l=ct(b)?z.find(e=>e.id===b):null,c=ct(b)?[...r].sort((e,t)=>"payload"===e.id?-1:"payload"===t.id?1:0):[...r].sort((e,t)=>e.id===b?-1:t.id===b?1:0),o=ct(b)?z.filter(e=>e.id!==b):[];return e.jsxs(e.Fragment,{children:[l&&e.jsx(jt,{id:`subfield-${l.id}`,title:l.title,color:l.color,startByte:C.payloadStartByte+l.startByte,endByte:C.payloadStartByte+l.endByte,hexBytes:l.hex.toUpperCase(),isSelected:!0,children:l.decoded},l.id),c.map(t=>e.jsx(jt,{id:`section-${t.id}`,title:t.title,color:t.color,startByte:t.startByte,endByte:t.endByte,hexBytes:t.hexBytes,isSelected:t.id===b,children:t.content},t.id)),o.map(t=>e.jsxs(N.div,{layout:"position",layoutId:`subfield-${t.id}`,transition:ht,className:"w-full min-w-0 overflow-hidden rounded-xl p-4 sm:p-5 space-y-4",style:{backgroundColor:xt,boxShadow:mt},children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 min-w-0",children:[e.jsx(p,{color:t.color,children:t.title}),t.hex.length<=32&&it(t.hex).map((s,a)=>e.jsx(p,{color:t.color,className:"font-mono",children:s.toUpperCase()},a))]}),e.jsxs("span",{className:"text-[10px] text-text-muted font-mono flex-shrink-0",children:["Bytes ",C.payloadStartByte+t.startByte,"-",C.payloadStartByte+t.endByte]})]}),e.jsx("div",{className:"min-w-0 overflow-hidden p-3 rounded-lg bg-black",children:t.decoded})]},t.id))]})})()})})]})});function Ft(e){if(!e)return[];if(Array.isArray(e))return e;try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Lt(e){return e?(e.startsWith("0x")?e.slice(2):e).slice(0,2).toUpperCase():""}function zt({hop:a,compact:n=!1,index:r=0,highlightIndex:l=-1,isTrace:i=!1}){var c;const o=r===l,d=Fe();return s.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]),e.jsxs(N.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:[e.jsxs(N.div,{className:t("flex items-center gap-1.5 px-2.5 py-1 rounded-md","font-mono text-xs font-semibold",a.isLocal?"bg-amber-500/20 text-amber-300 ring-1 ring-amber-500/30":"bg-zinc-700/50 text-zinc-200 ring-1 ring-zinc-600/50"),animate:d,initial:{boxShadow:"0 0 0 0px rgba(113, 156, 223, 0)"},children:[a.isLocal&&e.jsx(je,{className:"w-3 h-3"}),e.jsx("span",{children:a.prefix}),void 0!==a.confidence&&a.confidence<.9&&e.jsxs("span",{className:"text-[9px] opacity-70",children:[(100*a.confidence).toFixed(0),"%"]})]}),!n&&(null==(c=a.neighborInfo)?void 0:c.name)&&e.jsx("span",{className:"text-[10px] text-text-muted truncate max-w-[80px]",children:a.neighborInfo.name})]})}function Dt({snr:t}){const s=B(t),a=T()[s]||"#6b7280",n=Number.isInteger(t)?t.toString():t.toFixed(1);return e.jsxs(p,{customColor:a,compact:!0,className:"font-mono",children:[t>=0?"+":"",n,"dB"]})}function At({hops:a,compact:n,isTrace:r=!1}){const[l,i]=s.useState(-1);return s.useEffect(()=>{if(0===a.length)return;const e=setTimeout(()=>{i(0)},400),t=setInterval(()=>{i(e=>{const s=e+1;return s>=a.length?(clearInterval(t),-1):s})},r?500:600);return()=>{clearTimeout(e),clearInterval(t)}},[a.length,r]),e.jsx("div",{className:"p-6",style:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"4px 8px"},children:a.map((s,i)=>{const c=i%2==0,o=i===a.length-1;return e.jsxs("div",{className:"contents",children:[e.jsx("div",{className:t("flex items-center","justify-end"),children:c&&e.jsx(zt,{hop:s,compact:n,index:i,highlightIndex:l,isTrace:r})}),e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[28px]",children:!o&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px flex-1 bg-zinc-600/40 min-h-[8px]"}),void 0!==s.snr&&e.jsx(Dt,{snr:s.snr}),e.jsx("svg",{className:"w-3 h-3 text-zinc-500 flex-shrink-0",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M6 2v8M3 7l3 3 3-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})}),e.jsx("div",{className:t("flex items-center","justify-start"),children:!c&&e.jsx(zt,{hop:s,compact:n,index:i,highlightIndex:l,isTrace:r})})]},`${s.prefix}-${i}`)})})}const Et=s.memo(function({packet:a,neighbors:n,localHash:r,neighborAffinity:l,ghostPrefixes:i,direction:c="horizontal",compact:o=!1,traceSnr:d,overridePath:x}){const m=void 0!==d&&d.length>0,p=Ft(a.original_path),h=Ft(a.forwarded_path),u=x??(h.length>0?h:p),g=Lt(r),f=s.useMemo(()=>u.map((e,t)=>{const s=e.toUpperCase(),a=s===g,r=(null==i?void 0:i.has(s))??!1,c=function(e,t,s){const a=e.toUpperCase();if(s){let e=null,n=0;if(s.forEach((t,s)=>{if(Lt(s)===a){const a=t.combinedScore??0;a>n&&(n=a,e=s)}}),e&&t[e])return{hash:e,info:t[e],confidence:n}}for(const[n,r]of Object.entries(t))if(Lt(n)===a)return{hash:n,info:r,confidence:void 0};return null}(s,n,l);return{prefix:s,fullHash:null==c?void 0:c.hash,neighborInfo:null==c?void 0:c.info,isLocal:a,isGhost:r,confidence:null==c?void 0:c.confidence,snr:null==d?void 0:d[t]}}),[u,n,l,g,i,d]);if(0===f.length)return e.jsxs("div",{className:"flex items-center gap-2 text-text-muted text-xs",children:[e.jsx(M,{className:"w-4 h-4 opacity-50"}),e.jsx("span",{children:"Direct / No path data"})]});if("flowchart"===c)return e.jsx(At,{hops:f,compact:o,isTrace:m});const b="horizontal"===c?Ne:ce;return e.jsx("div",{className:t("flex gap-1.5","horizontal"===c?"flex-row flex-wrap items-center":"flex-col items-start"),children:f.map((s,a)=>e.jsxs("div",{className:t("flex items-center gap-1.5","vertical"===c&&"flex-col"),children:[e.jsx(zt,{hop:s,compact:o}),a0,i=al&&n(a-1),disabled:!l,className:t("p-0.5 radius-badge transition-base",l?"text-text-muted hover:text-text-primary hover-bg":"text-text-muted cursor-not-allowed"),"aria-label":"Previous observation",children:e.jsx(ke,{className:r?"size-3":"size-4"})}),e.jsx("div",{className:"flex items-center gap-0.5",children:s.map((s,l)=>{const i=l===a,c=new Date(1e3*s.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});return e.jsx(I,{color:i?"cyan":"zinc",filled:i,compact:r,onClick:()=>n(l),title:`Observation ${l+1} at ${c}`,className:t("transition-all duration-150",!i&&"opacity-60 hover:opacity-100"),children:r?e.jsx("span",{className:"tabular-nums",children:l+1}):e.jsxs("span",{className:"tabular-nums text-[10px]",children:["#",l+1,null!=s.rssi&&e.jsx("span",{className:"ml-1 opacity-70",children:s.rssi})]})},`${s.timestamp}_${l}`)})}),e.jsx("button",{onClick:()=>i&&n(a+1),disabled:!i,className:t("p-0.5 radius-badge transition-base",i?"text-text-muted hover:text-text-primary hover-bg":"text-text-muted cursor-not-allowed"),"aria-label":"Next observation",children:e.jsx(de,{className:r?"size-3":"size-4"})}),e.jsxs("span",{className:t("text-text-muted ml-1",r?"text-[9px]":"text-[10px]"),children:[e.jsx(oe,{className:"inline size-3 mr-0.5 opacity-50"}),s.length]})]})}function It({icon:s,label:a,disabled:n=!1}){return e.jsx(N.div,{className:"flex items-center gap-1 text-[10px]",title:a,animate:{opacity:n?.25:.6},transition:{duration:.15,ease:[.4,0,.2,1]},children:e.jsx("span",{className:t("flex items-center justify-center size-5 radius-badge border-control transition-base",n?"bg-subtle-fill border-border-subtle":"bg-subtle-fill"),children:s})})}function $t({hasDuplicates:t,hasPrev:s,hasNext:a,canPrevDupe:n,canNextDupe:r}){return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(It,{icon:e.jsx(re,{className:"size-3"}),label:"Previous packet (↑)",disabled:!s}),e.jsx(It,{icon:e.jsx($,{className:"size-3"}),label:"Next packet (↓)",disabled:!a})]}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-3 bg-subtle-fill-strong"}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(It,{icon:e.jsx(ke,{className:"size-3"}),label:"Previous observation (←)",disabled:!n}),e.jsx(It,{icon:e.jsx(de,{className:"size-3"}),label:"Next observation (→)",disabled:!r})]})]})]})}const Vt=s.memo(function({packets:t,initialIndex:a=0,onClose:n,onNavigatePrev:r,onNavigateNext:l,hasPrev:i=!1,hasNext:c=!1}){const[o,d]=s.useState(a),x=t[o]??t[0],h=t.length>1,u=o>0,b=o{d(Math.max(0,Math.min(e,t.length-1)))},[t.length]);s.useEffect(()=>{const e=e=>{if(!(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))switch(e.key){case"ArrowUp":e.preventDefault(),null==r||r();break;case"ArrowDown":e.preventDefault(),null==l||l();break;case"ArrowLeft":e.preventDefault(),u&&d(e=>e-1);break;case"ArrowRight":e.preventDefault(),b&&d(e=>e+1)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,l,u,b]);const j=F(),v=L(),w=z(),C=D(),S=s.useMemo(()=>new Set(C.map(e=>e.prefix.toUpperCase())),[C]),P=x.payload_type_name||g(x.payload_type??x.type),_=x.route_type_name||f(x.route_type??x.route),T=x.payload_length??x.length??0,B=Rt(x.original_path),I=Rt(x.forwarded_path),$=B.length>0||I.length>0,V=I.length>0?I:B,O=s.useMemo(()=>{var e;if(null==(e=null==j?void 0:j.config)?void 0:e.repeater)return{latitude:j.config.repeater.latitude,longitude:j.config.repeater.longitude,name:j.config.node_name||"Local Node"}},[j]),Q=(null==j?void 0:j.neighbors)??{},W=w.size>0?w:void 0,G=x.raw_packet&&x.raw_packet.length>0,K=s.useMemo(()=>{if((x.payload_type??x.type)!==k.TRACE||!x.payload)return null;try{const e=m(x.payload),t=x.original_path||x.forwarded_path||[];let s=[];if("string"==typeof t)try{const e=JSON.parse(t);Array.isArray(e)&&(s=e.map(e=>parseInt(e,16)))}catch{s=[]}else Array.isArray(t)&&(s=t.map(e=>parseInt(e,16)));return q(e,s)}catch{return null}},[x]),Y=null==K?void 0:K.snrValues,X=s.useMemo(()=>{if((x.payload_type??x.type)!==k.ADVERT||!x.payload)return null;try{const e=m(x.payload),t=J(e);if(!t)return null;const s=t.publicKey.slice(0,2).toUpperCase();return{...t,prefix:s}}catch{return null}},[x]),ee=s.useMemo(()=>{if((null==X?void 0:X.latitude)&&(null==X?void 0:X.longitude))return{latitude:X.latitude,longitude:X.longitude,name:X.name||`Node ${X.prefix||"??"}`,prefix:X.prefix,publicKey:X.publicKey}},[X]),se=e=>e&&0!==e?new Date(1e3*e).toLocaleString():"Unknown",ae=A(x.packet_hash),re=s.useMemo(()=>{if((x.payload_type??x.type)!==k.GRP_TXT)return null;if(!(null==ae?void 0:ae.decoded))return null;const e=ae.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,ae]),le=s.useCallback(e=>{if(!e)return null;const t=e.trim().match(/(-?\d+\.?\d*)\s*[,\s]\s*(-?\d+\.?\d*)/);if(!t)return null;const s=parseFloat(t[1]),a=parseFloat(t[2]);return isNaN(s)||isNaN(a)||s<-90||s>90||a<-180||a>180||0===s&&0===a?null:{lat:s,lon:a}},[]),ie=s.useMemo(()=>{var e,t;if(!(null==re?void 0:re.decrypted))return;if(!(null==(e=re.channelName)?void 0:e.toLowerCase().includes("wardrive")))return;const s=le(re.text);return s?{latitude:s.lat,longitude:s.lon,name:re.senderName||"Wardrive Ping",prefix:(null==(t=re.senderName)?void 0:t.slice(0,2).toUpperCase())||"WD",nodeType:"wardrive"}:void 0},[re,le]),ce=(x.payload_type??x.type)===k.ADVERT&&(void 0!==ee||$),oe=void 0!==ie,de=ee??ie;if(0===V.length)return null;const me=(null==j?void 0:j.local_hash)?(j.local_hash.startsWith("0x")?j.local_hash.slice(2,4):j.local_hash.slice(0,2)).toUpperCase():"";for(const e of V){const t=e.toUpperCase();if(t!==me)if(W){let e=0,s=0;if(W.forEach((a,n)=>{(n.startsWith("0x")?n.slice(2,4):n.slice(0,2)).toUpperCase()===t&&(e++,s=Math.max(s,a.combinedScore??0))}),0===e)for(const a of Object.keys(Q))if((a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase()===t)break}else for(const e of Object.keys(Q))if((e.startsWith("0x")?e.slice(2,4):e.slice(0,2)).toUpperCase()===t)break}const pe={lime:"rgb(132, 204, 22)",cyan:"rgb(34, 211, 238)",amber:"rgb(251, 191, 36)",violet:"rgb(167, 139, 250)",rose:"rgb(251, 113, 133)",emerald:"rgb(52, 211, 153)",sky:"rgb(56, 189, 248)",orange:"rgb(251, 146, 60)",pink:"rgb(244, 114, 182)",zinc:"rgb(161, 161, 170)",purple:"rgb(168, 85, 247)",indigo:"rgb(129, 140, 248)",teal:"rgb(45, 212, 191)",fuchsia:"rgb(232, 121, 249)",blue:"rgb(59, 130, 246)",green:"rgb(34, 197, 94)",yellow:"rgb(250, 204, 21)",red:"rgb(239, 68, 68)"},he=pe[te[P]??"zinc"]||pe.zinc;return e.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:[e.jsxs("div",{className:"sm:hidden",children:[e.jsx("div",{className:"flex justify-center pt-2 pb-1",children:e.jsx("div",{className:"w-9 h-1 rounded-full bg-text-muted","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-center justify-between px-3 pb-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(p,{color:te[P]??"zinc",className:"!text-[9px] !px-1.5 !py-0",children:P}),e.jsx(p,{color:"DIRECT"===_||"T_DIRECT"===_?"cyan":"amber",className:"!text-[9px] !px-1.5 !py-0",children:_}),e.jsxs(p,{color:"zinc",className:"!text-[9px] !px-1.5 !py-0",children:[T,"B"]})]}),e.jsx("button",{onClick:n,className:"px-3 py-1.5 text-[15px] font-medium text-blue-400 active:text-blue-300 transition-base flex-shrink-0 radius-inner active:bg-subtle-fill",children:"Done"})]}),h&&e.jsx("div",{className:"px-3 pb-2",children:e.jsx(Ut,{packets:t,selectedIndex:o,onSelect:y,compact:!0})})]}),e.jsx("div",{className:"hidden sm:block px-6 pt-5 pb-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{color:te[P]??"zinc",children:P}),e.jsx(p,{color:"DIRECT"===_||"T_DIRECT"===_?"cyan":"amber",children:_}),e.jsxs(p,{color:"zinc",children:[T,"B"]}),h&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-4 bg-subtle-fill-strong"}),e.jsx(Ut,{packets:t,selectedIndex:o,onSelect:y})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx($t,{hasDuplicates:h,hasPrev:i,hasNext:c,canPrevDupe:u,canNextDupe:b}),e.jsx("button",{onClick:n,className:"p-1.5 -m-1.5 text-text-muted hover:text-text-primary transition-base radius-inner hover:bg-bg-elevated flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}),e.jsx("div",{className:"sm:hidden h-[2px]",style:{backgroundColor:he,opacity:.6}}),e.jsxs(R,{className:"p-0 overflow-hidden flex-1 flex flex-col min-h-0",children:[e.jsx("div",{className:"md:hidden flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxs("div",{className:"p-2 space-y-2",children:[(null!=x.rssi||null!=x.snr)&&e.jsxs("div",{className:"relative flex items-center justify-between px-2 py-1.5 radius-inner bg-subtle-fill",children:[e.jsx(U,{mode:"popLayout",initial:!1,children:e.jsxs(N.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:[e.jsx(Z,{rssi:x.rssi,snr:x.snr,compact:!0,showValues:!0}),e.jsx("span",{className:"text-[11px] text-text-muted",children:ne(x.rssi)})]},o)}),V.length>0&&e.jsxs("span",{className:"text-[10px] font-mono text-text-muted",children:[V.length," hop",1!==V.length?"s":""]})]}),($&&V.length>0||ce||oe)&&e.jsx("div",{className:"overflow-hidden radius-inset",children:e.jsx("div",{className:"aspect-[4/3] w-full",children:e.jsx(lt,{path:V,neighbors:Q,localNode:O,localHash:null==j?void 0:j.local_hash,srcHash:x.src_hash,dstHash:x.dst_hash,neighborAffinity:W,hubNodes:[...v],traceSnr:Y,advertiserSource:de})})}),K&&K.pathHashes.length>0&&e.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[e.jsx("div",{className:"px-3 py-2 space-y-1.5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] font-medium text-text-muted uppercase tracking-wide",children:"Trace Route"}),e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx(p,{color:K.isComplete?"green":"amber",compact:!0,children:K.isComplete?"Complete":"In Progress"})})]})}),e.jsx(Et,{packet:x,neighbors:Q,localHash:null==j?void 0:j.local_hash,neighborAffinity:W,ghostPrefixes:S,direction:"flowchart",compact:!0,overridePath:K.pathHashes,traceSnr:K.snrValues})]}),$&&!K&&e.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[e.jsx("span",{className:"text-[10px] font-medium text-text-muted uppercase tracking-wide",children:"Path"}),e.jsxs(p,{color:"zinc",compact:!0,children:[V.length," hop",1!==V.length?"s":""]})]}),e.jsx(Et,{packet:x,neighbors:Q,localHash:null==j?void 0:j.local_hash,neighborAffinity:W,ghostPrefixes:S,direction:"flowchart",compact:!0,traceSnr:Y})]}),X&&e.jsxs("div",{className:"radius-inset bg-subtle-fill overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border-subtle",children:[e.jsx("span",{className:"text-[10px] font-medium text-text-muted uppercase tracking-wide",children:"Advertiser Info"}),e.jsx(p,{color:"lime",compact:!0,children:X.nodeType})]}),e.jsxs("div",{className:"p-3 space-y-2",children:[X.name&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_e,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:X.name})]}),X.latitude&&X.longitude&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),e.jsxs("span",{className:"text-xs font-mono text-text-secondary",children:[X.latitude.toFixed(5),", ",X.longitude.toFixed(5)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(He,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),e.jsxs("span",{className:"text-[10px] font-mono text-text-muted truncate",children:[X.publicKey.slice(0,16),"...",X.publicKey.slice(-8)]})]}),X.timestamp>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-xs text-text-muted",children:se(X.timestamp)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-[10px] text-text-muted",children:X.flagsDescription||`Flags: 0x${X.flags.toString(16).padStart(2,"0")}`})]})]})]}),G&&e.jsx("div",{className:"pt-1",children:e.jsx(Bt,{packet:x,decodedGrpTxt:re})})]})}),e.jsxs("div",{className:"hidden md:grid md:grid-cols-2 flex-1 overflow-hidden",children:[e.jsx("div",{className:"overflow-y-auto overflow-x-hidden scrollbar-none p-4 border-r border-border-subtle",children:G&&e.jsx(Bt,{packet:x,decodedGrpTxt:re})}),e.jsxs("div",{className:"grid overflow-hidden",style:{gridTemplateRows:"minmax(280px, 1fr) auto"},children:[e.jsx("div",{className:"overflow-hidden p-2",children:$&&V.length>0||ce||oe?e.jsx("div",{className:"h-full w-full",children:e.jsx(lt,{path:V,neighbors:Q,localNode:O,localHash:null==j?void 0:j.local_hash,srcHash:x.src_hash,dstHash:x.dst_hash,neighborAffinity:W,hubNodes:[...v],traceSnr:Y,advertiserSource:de})}):e.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center text-center px-4",children:[e.jsx(M,{className:"w-8 h-8 text-text-muted/50 mb-2"}),e.jsx("span",{className:"text-sm text-text-muted",children:"Direct Reception"}),e.jsx("span",{className:"text-xs text-text-muted/70 mt-1",children:"Zero-hop packet — received directly from sender"})]})}),e.jsxs("div",{className:"overflow-y-auto max-h-[200px] p-2 space-y-2",children:[!K&&V.length<=1&&(null!=x.rssi||null!=x.snr)&&e.jsx("div",{className:"surface-base radius-inset p-4",children:e.jsxs("dl",{className:"text-xs grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-text-muted mb-1",children:"Signal"}),e.jsx(U,{mode:"popLayout",initial:!1,children:e.jsxs(N.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:[e.jsx(Z,{rssi:x.rssi,snr:x.snr}),e.jsx("span",{className:"font-medium text-text-primary",children:ne(x.rssi)})]},o)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-text-muted mb-1",children:"RF"}),e.jsx(U,{mode:"popLayout",initial:!1,children:e.jsxs(N.dd,{className:"font-mono text-text-secondary tabular-nums",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)})]})]})}),X&&e.jsxs("div",{className:"radius-inset bg-subtle-fill overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border-subtle",children:[e.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Advertiser"}),e.jsx(p,{color:"lime",compact:!0,children:X.nodeType})]}),e.jsxs("div",{className:"p-4 space-y-2.5",children:[X.name&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_e,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:X.name})]}),X.latitude&&X.longitude&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),e.jsxs("span",{className:"text-xs font-mono text-text-secondary",children:[X.latitude.toFixed(5),", ",X.longitude.toFixed(5)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(He,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),e.jsxs("span",{className:"text-[11px] font-mono text-text-muted truncate",children:[X.publicKey.slice(0,16),"...",X.publicKey.slice(-8)]})]}),X.timestamp>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-xs text-text-muted",children:se(X.timestamp)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-[11px] text-text-muted",children:X.flagsDescription||`Flags: 0x${X.flags.toString(16).padStart(2,"0")}`})]})]})]}),K&&K.pathHashes.length>0&&e.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Trace Route"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(p,{color:K.isComplete?"green":"amber",compact:!0,children:K.isComplete?"Complete":"In Progress"}),e.jsxs(p,{color:"teal",compact:!0,children:[K.pathHashes.length,"h"]})]})]}),e.jsx(Et,{packet:x,neighbors:Q,localHash:null==j?void 0:j.local_hash,neighborAffinity:W,ghostPrefixes:S,direction:"flowchart",compact:!0,overridePath:K.pathHashes,traceSnr:K.snrValues})]}),$&&!K&&e.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2",children:[e.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Path"}),e.jsxs(p,{color:"zinc",compact:!0,children:[V.length,"h"]})]}),e.jsx(Et,{packet:x,neighbors:Q,localHash:null==j?void 0:j.local_hash,neighborAffinity:W,ghostPrefixes:S,direction:"flowchart",compact:!0,traceSnr:Y})]})]})]})]})]})]})});function Ot({label:t,numericValue:s,unit:a,icon:n,subtext:r,showSign:l=!1}){return e.jsxs("div",{className:"radius-inner p-3 sm:radius-inset sm:p-4 bg-subtle-fill ring-1 ring-inset ring-border-subtle",children:[e.jsx("div",{className:"mb-1.5 sm:mb-2",children:e.jsx("span",{className:"text-[10px] sm:text-[11px] font-medium uppercase tracking-wide text-text-muted",children:t})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ve,{value:s,format:{minimumFractionDigits:1,maximumFractionDigits:1,signDisplay:l?"always":"auto"},className:"font-mono text-xl sm:text-2xl font-semibold tabular-nums tracking-tight text-text-primary"}),e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsx(n,{className:"w-[14px] h-[14px] text-text-muted"}),a&&e.jsx("span",{className:"text-[10px] sm:text-xs font-medium leading-tight text-text-muted",children:a})]})]}),r&&e.jsx("p",{className:"mt-1.5 sm:mt-2 font-mono text-[10px] sm:text-[11px] text-text-muted/80 truncate",children:r})]})}function Qt({snr:s}){const a=s>=5?"bg-sys-teal":s>=0?"bg-sys-green":s>=-5?"bg-sys-amber":s>=-10?"bg-sys-orange":"bg-sys-red";return e.jsx("span",{className:t("w-1.5 h-1.5 rounded-full flex-shrink-0",a),title:`SNR: ${s.toFixed(1)} dB`})}function Wt({fromPrefix:s,toPrefix:a,fromName:n,toName:r,snr:l,maxSnr:i,isWeakest:c,isStrongest:o,index:d=0}){const x=Math.max(i+5,15),m=Math.max(0,Math.min(100,(l- -20)/(x- -20)*100)),h="bg-[#0074BE]",u=l>=5?"bg-sys-teal":l>=0?"bg-sys-green":l>=-5?"bg-sys-amber":l>=-10?"bg-sys-orange":"bg-sys-red",g=.3+.15*d;return e.jsxs("div",{className:"relative p-3 pl-5 radius-inner bg-subtle-fill ring-1 ring-inset ring-border-subtle",children:[e.jsx("span",{className:t("absolute left-0 top-1/2 -translate-y-1/2 h-4 w-0.5 rounded-full",u)}),e.jsx("span",{className:"absolute -top-0.5 -right-0.5",children:e.jsx(Qt,{snr:l})}),e.jsxs("div",{className:"sm:hidden",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx("span",{className:"text-[13px] font-medium text-text-secondary truncate",children:n||s}),e.jsx(Ne,{className:"w-3 h-3 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-[13px] font-semibold text-text-primary truncate",children:r||a})]}),e.jsxs("div",{className:"flex items-center gap-1.5 ml-2 flex-shrink-0",children:[c&&e.jsx(p,{color:"red",compact:!0,children:"Low"}),o&&!c&&e.jsxs(p,{color:"amber",compact:!0,children:[e.jsx(Me,{className:"w-2.5 h-2.5"}),"Best"]}),e.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-text-primary ring-1 ring-inset ring-border-subtle",children:[l>=0?"+":"−",Math.abs(l).toFixed(1)]})]})]}),e.jsx("div",{className:"h-1.5 bg-subtle-fill-strong rounded-full overflow-hidden",children:e.jsx(N.div,{className:t("h-full rounded-full",h),initial:{width:0},animate:{width:`${m}%`},transition:{duration:1.5,delay:g,ease:[.25,.1,.25,1]}})})]}),e.jsxs("div",{className:"hidden sm:block",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("code",{className:"font-mono text-xs text-text-muted",children:s}),n&&e.jsx("span",{className:"text-xs text-text-secondary truncate max-w-[100px]",children:n})]}),e.jsx(Ne,{className:"w-3 h-3 text-text-muted/40 flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("code",{className:"font-mono text-xs font-semibold text-text-primary",children:a}),r&&e.jsx("span",{className:"text-xs text-text-secondary truncate max-w-[100px]",children:r})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[c&&e.jsx(p,{color:"red",compact:!0,children:"Bottleneck"}),o&&!c&&e.jsxs(p,{color:"amber",compact:!0,children:[e.jsx(Me,{className:"w-3 h-3"}),"Strongest"]}),e.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-text-primary ring-1 ring-inset ring-border-subtle",children:[l>=0?"+":"−",Math.abs(l).toFixed(1)]})]})]}),e.jsx("div",{className:"h-1.5 bg-bg-elevated rounded-full overflow-hidden",children:e.jsx(N.div,{className:t("h-full rounded-full",h),initial:{width:0},animate:{width:`${m}%`},transition:{duration:1.5,delay:g,ease:[.25,.1,.25,1]}})})]})]})}function Gt(e,t){if("You"===e)return"You";const s=e.toUpperCase();for(const[a,n]of Object.entries(t))if((a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase()===s)return n.name||n.node_name||void 0}const qt=s.memo(function({report:t,onClose:s}){var a,n;const r=F(),l=(null==r?void 0:r.neighbors)??{},i=(null==(a=null==r?void 0:r.config)?void 0:a.repeater)?{latitude:r.config.repeater.latitude,longitude:r.config.repeater.longitude,name:r.config.node_name||"Local Node"}:void 0,c=null==(n=t.bestObservation)?void 0:n.decoded.snrValues,o=t.linkQuality?t.linkQuality.avgSnr>=5?"excellent":t.linkQuality.avgSnr>=0?"good":t.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(--text-muted)"}[o];return e.jsxs(E,{open:!0,onClose:s,size:"5xl",motionPlus:!0,children:[e.jsxs("div",{className:"sm:hidden",children:[e.jsx("div",{className:"flex justify-center pt-2 pb-1",children:e.jsx("div",{className:"w-9 h-1 rounded-full bg-text-primary/30","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-center justify-between px-4 pb-2",children:[e.jsx("h2",{className:"font-semibold text-[17px] text-text-primary",children:"Trace Report"}),e.jsx("button",{onClick:s,className:"text-[17px] font-medium text-blue-400 active:text-blue-300",children:"Done"})]})]}),e.jsx("div",{className:"sm:hidden h-[2px]",style:{backgroundColor:d,opacity:.6}}),e.jsx("div",{className:"hidden sm:block px-6 pt-5 pb-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[e.jsx("h2",{className:"text-base sm:text-lg font-semibold text-text-primary",children:"Trace Report"}),e.jsxs(p,{color:"excellent"===o||"good"===o?"green":"fair"===o?"amber":"red",children:[e.jsx(Pe,{className:"w-3 h-3 mr-1"}),"excellent"===o?"Excellent":"good"===o?"Good":"fair"===o?"Fair":"Poor"]})]}),e.jsx("p",{className:"mt-1 text-xs sm:text-sm font-mono text-text-muted tabular-nums",children:t.traceTag})]}),e.jsx("button",{onClick:s,className:"p-1.5 -m-1.5 text-text-muted hover:text-text-primary transition-base radius-inner hover:bg-bg-elevated flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),e.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-border-subtle",children:[e.jsxs(p,{color:"teal",children:[e.jsx("span",{className:"font-mono tabular-nums",children:t.targetHopCount}),e.jsxs("span",{className:"ml-1",children:["hop",1!==t.targetHopCount?"s":""]})]}),e.jsxs(p,{color:"zinc",children:[e.jsx("span",{className:"font-mono tabular-nums",children:t.observationCount}),e.jsx("span",{className:"ml-1",children:"obs"})]}),t.linkQuality&&e.jsxs(p,{color:"purple",children:[e.jsx("span",{className:"font-mono tabular-nums",children:t.linkQuality.avgSnr.toFixed(1)}),e.jsx("span",{className:"ml-1",children:"dB avg"})]}),e.jsx("span",{className:"font-mono text-xs text-text-muted tabular-nums",children:V(t.duration)}),t.linkQuality&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-text-muted/40",children:"•"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-sys-red/15 text-sys-red ring-1 ring-inset ring-sys-red/25",children:[e.jsx("span",{className:"opacity-70",children:"Min"}),e.jsx("span",{className:"font-mono tabular-nums",children:t.linkQuality.minSnr.toFixed(1)})]}),e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-sys-teal/15 text-sys-teal ring-1 ring-inset ring-sys-teal/25",children:[e.jsx("span",{className:"opacity-70",children:"Max"}),e.jsx("span",{className:"font-mono tabular-nums",children:t.linkQuality.maxSnr.toFixed(1)})]})]})]})]}),e.jsxs(R,{className:"p-0 overflow-hidden",children:[e.jsx("div",{className:"md:hidden h-[75vh] max-h-[calc(100vh-80px)] overflow-y-auto overflow-x-hidden",children:e.jsxs("div",{className:"px-4 py-3 space-y-3",children:[t.linkQuality&&e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"radius-inner bg-subtle-fill ring-1 ring-inset ring-border-subtle p-2.5 text-center",children:[e.jsx(ve,{value:Math.abs(t.linkQuality.minSnr),format:{maximumFractionDigits:0,signDisplay:"never"},prefix:t.linkQuality.minSnr<0?"-":"",className:"text-[20px] font-bold font-mono tabular-nums flex items-center justify-center text-text-primary"}),e.jsxs("div",{className:"flex items-center justify-center gap-1 mt-1",children:[e.jsx(me,{className:"w-2.5 h-2.5 text-text-muted"}),e.jsx("span",{className:"text-[10px] text-text-muted",children:"Min dB"})]})]}),e.jsxs("div",{className:"radius-inner bg-subtle-fill ring-1 ring-inset ring-border-subtle p-2.5 text-center",children:[e.jsx(ve,{value:t.linkQuality.maxSnr,format:{maximumFractionDigits:0,signDisplay:"always"},className:"text-[20px] font-bold font-mono text-text-primary tabular-nums flex items-center justify-center"}),e.jsxs("div",{className:"flex items-center justify-center gap-1 mt-1",children:[e.jsx(le,{className:"w-2.5 h-2.5 text-text-muted"}),e.jsx("span",{className:"text-[10px] text-text-muted",children:"Max dB"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(p,{color:"excellent"===o||"good"===o?"green":"fair"===o?"amber":"red",compact:!0,children:[e.jsx(Pe,{className:"w-2.5 h-2.5 mr-0.5"}),"excellent"===o?"Excellent":"good"===o?"Good":"fair"===o?"Fair":"Poor"]}),e.jsxs(p,{color:"teal",compact:!0,children:[t.targetHopCount," hops"]}),e.jsxs(p,{color:"zinc",compact:!0,children:[t.observationCount," obs"]}),e.jsx("span",{className:"text-[10px] font-mono text-text-muted ml-auto",children:t.traceTag.slice(0,8)})]}),t.targetPath.length>0&&e.jsx("div",{className:"overflow-hidden radius-inset",children:e.jsx("div",{className:"aspect-[4/3] w-full",children:e.jsx(lt,{path:t.targetPath,neighbors:l,localNode:i,localHash:null==r?void 0:r.local_hash,srcHash:t.srcHash,dstHash:t.dstHash,traceSnr:c})})}),e.jsxs("div",{className:"radius-inset bg-bg-body overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border-subtle",children:[e.jsx("span",{className:"text-[11px] font-medium text-text-secondary",children:"Route Path"}),t.linkQuality&&e.jsxs("span",{className:"text-[10px] font-mono text-text-muted",children:["SNR ",t.linkQuality.minSnr.toFixed(1)," → ",t.linkQuality.maxSnr.toFixed(1)," dB"]})]}),t.bestObservation?e.jsx(Et,{packet:t.bestObservation.packet,neighbors:l,localHash:null==r?void 0:r.local_hash,direction:"flowchart",compact:!0,overridePath:t.targetPath,traceSnr:t.bestObservation.decoded.snrValues}):e.jsx("div",{className:"p-6 text-center text-text-muted text-[11px]",children:"No path data available"})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-[11px] font-medium uppercase tracking-wide text-text-muted mb-2",children:["Link Quality · ",t.hopStats.length," hops"]}),e.jsx("div",{className:"space-y-1.5",children:t.hopStats.length>0?t.hopStats.map((s,a)=>{var n,r,i;const c=a{const s=t.targetPath[t.linkQuality.weakestLinkPosition],a=t.targetPath[t.linkQuality.weakestLinkPosition+1]||"You",n=Gt(s,l),r=Gt(a,l),i=t.targetPath[t.linkQuality.strongestLinkPosition],c=t.targetPath[t.linkQuality.strongestLinkPosition+1]||"You",o=Gt(i,l),d=Gt(c,l);return e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(Ot,{label:"Weakest Link",numericValue:t.linkQuality.minSnr,unit:"dB",icon:me,subtext:`${n||s} → ${r||a}`}),e.jsx(Ot,{label:"Best Link",numericValue:t.linkQuality.maxSnr,showSign:!0,unit:"dB",icon:le,subtext:`${o||i} → ${d||c}`})]})})(),e.jsxs("div",{children:[e.jsx("h3",{className:"text-[11px] font-medium uppercase tracking-wide text-text-muted mb-3",children:"Link Details"}),e.jsx("div",{className:"space-y-2",children:t.hopStats.length>0?t.hopStats.map((s,a)=>{var n,r,i;const c=a0&&e.jsx("div",{className:"overflow-hidden",children:e.jsx("div",{className:"aspect-square w-full",children:e.jsx(lt,{path:t.targetPath,neighbors:l,localNode:i,localHash:null==r?void 0:r.local_hash,srcHash:t.srcHash,dstHash:t.dstHash,traceSnr:c})})}),e.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[e.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Trace Route"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(p,{color:t.isComplete?"green":"amber",compact:!0,children:t.isComplete?"Complete":`${t.maxHopsObserved}/${t.targetHopCount}`}),e.jsxs(p,{color:"teal",compact:!0,children:[t.targetHopCount," hop",1!==t.targetHopCount?"s":""]})]})]}),t.linkQuality&&t.bestObservation&&e.jsxs("div",{className:"flex items-center gap-4 px-4 pb-2 font-mono text-[10px] text-text-muted",children:[e.jsxs("span",{children:[e.jsx("span",{className:"opacity-60",children:"Tag"})," ",e.jsx("code",{className:"text-teal-400 tabular-nums",children:t.traceTag.slice(0,8)})]}),e.jsxs("span",{children:[e.jsx("span",{className:"opacity-60",children:"SNR"})," ",e.jsxs("code",{className:"text-accent-secondary tabular-nums",children:[t.linkQuality.minSnr.toFixed(1),"–",t.linkQuality.maxSnr.toFixed(1)]}),e.jsx("span",{className:"opacity-60",children:" dB"})]})]}),t.bestObservation?e.jsx(Et,{packet:t.bestObservation.packet,neighbors:l,localHash:null==r?void 0:r.local_hash,direction:"flowchart",compact:!0,overridePath:t.targetPath,traceSnr:t.bestObservation.decoded.snrValues}):e.jsx("div",{className:"p-8 text-center text-text-muted text-xs",children:"No path data available"})]})]})]})]})]})}),Kt="(min-width: 640px)";let Yt=null;function Jt(e){return"undefined"==typeof window?()=>{}:(Yt||(Yt=window.matchMedia(Kt)),Yt.addEventListener("change",e),()=>null==Yt?void 0:Yt.removeEventListener("change",e))}function Xt(){return"undefined"==typeof window||(Yt||(Yt=window.matchMedia(Kt)),Yt.matches)}function Zt({message:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-14 text-center",children:[e.jsx(M,{className:"size-6 text-text-muted mb-2"}),e.jsx("p",{className:"text-sm text-text-primary",children:t}),e.jsx("p",{className:"text-xs text-text-muted",children:"Packets will appear here"})]})}function es(){return e.jsx("div",{className:"py-14 text-center text-sm text-text-muted",children:"Loading packets…"})}function ts({showPagination:t,currentPage:s,perPage:a,displayCount:n,totalCount:r,action:l}){const i=t?(s-1)*a+1:1,c=t?Math.min(s*a,r):n;return e.jsxs("div",{className:"flex items-center justify-between gap-4 border-t border-border-subtle px-4 py-3 text-xs text-text-muted sm:px-6",children:[e.jsxs("span",{children:["Showing"," ",e.jsx("span",{className:"font-medium text-text-secondary",children:t?`${i}–${c}`:n})," ","of"," ",e.jsx("span",{className:"font-medium text-text-secondary",children:r})," ","packets"]}),l]})}function ss({packets:a,allPackets:n,localHash:r,neighbors:l,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}){const[g,f]=s.useState(null),[b,y]=s.useState(null),[j,v]=s.useState({traceTag:null,dupeGroup:null});s.useLayoutEffect(()=>{v({traceTag:null,dupeGroup:null})},[a]);const N=n??a,k=s.useMemo(()=>c&&c>0?a.slice(0,c):a,[a,c]),{currentPage:w,totalPages:C,goToPage:S,pageRange:H}=function(e,t,a){const[n,r]=s.useState(1),l=a?Math.ceil(e/t):1;s.useEffect(()=>{n>l&&l>0&&queueMicrotask(()=>r(1))},[l,n]);const i=s.useCallback(e=>r(Math.max(1,Math.min(e,l))),[l]),c=s.useMemo(()=>function(e,t,s=1){if(t<=7)return Array.from({length:t},(e,t)=>t+1);const a=Math.max(e-s,1),n=Math.min(e+s,t),r=a>2,l=nt+1),"gap",t]}if(r&&!l){const e=3+2*s;return[1,"gap",...Array.from({length:e},(s,a)=>t-e+a+1)]}return[1,"gap",...Array.from({length:n-a+1},(e,t)=>a+t),"gap",t]}(n,l),[n,l]);return{currentPage:n,totalPages:l,goToPage:i,pageRange:c}}(k.length,o,d),P=s.useMemo(()=>{if(!d)return k;const e=(w-1)*o;return k.slice(e,e+o)},[k,d,w,o]),M=s.useMemo(()=>function(e){const t=new Map;for(const s of e)if((s.payload_type??s.type)===Q.TRACE&&s.payload&&s.packet_hash){const e=Ue(s.payload);e&&t.set(s.packet_hash,e)}return t}(P),[P]),_=s.useMemo(()=>function(e){const t=new Map;if(0===e.length)return t;for(let s=0;s{var s,a;if(!t||!e.length)return;const l=(null==(s=e[0])?void 0:s.timestamp)??0,i=l>r.current&&r.current>0;if(r.current=l,!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,t]),a}(a,m),B=s.useCallback((e,t)=>{var s,a;const n=e.packet_hash;if(!n)return[e];let r=t;for(;r>0&&(null==(s=P[r-1])?void 0:s.packet_hash)===n;)r--;let l=t;for(;l{var t,s;const a=null==(t=P[e])?void 0:t.packet_hash;if(!a)return e;let n=e;for(;n>0&&(null==(s=P[n-1])?void 0:s.packet_hash)===a;)n--;return n},[P]),L=s.useCallback(e=>{var t,s;const a=null==(t=P[e])?void 0:t.packet_hash;if(!a)return e;let n=e;for(;n{if(x)x(e);else if(void 0!==t){const s=B(e,t),a=s.indexOf(e);f({packets:s,initialIndex:a>=0?a:0,rowIndex:t})}else f({packets:[e],initialIndex:0,rowIndex:0})},[x,B]),D=s.useCallback(()=>{if(!g)return;const e=F(g.rowIndex)-1;if(e<0)return;const t=P[e];if(!t)return;const s=B(t,e);f({packets:s,initialIndex:0,rowIndex:e})},[g,P,F,B]),A=s.useCallback(()=>{if(!g)return;const e=L(g.rowIndex)+1;if(e>=P.length)return;const t=P[e];if(!t)return;const s=B(t,e);f({packets:s,initialIndex:0,rowIndex:e})},[g,P,L,B]),E=s.useMemo(()=>!!g&&F(g.rowIndex)>0,[g,F]),R=s.useMemo(()=>!!g&&L(g.rowIndex)v(t=>({...t,traceTag:e})),[]),I=s.useCallback(e=>v(t=>({...t,dupeGroup:e})),[]),$=s.useCallback(()=>{v({traceTag:null,dupeGroup:null})},[]),V=s.useCallback(e=>{const t=N.filter(t=>(t.payload_type??t.type)===Q.TRACE&&t.payload&&Ue(t.payload)===e);if(0===t.length)return;const s=function(e){const t=new Map;for(const s of e){const e=$e(s);if(!e)continue;const a=e.decoded.traceTag,n=t.get(a)||[];n.push(e),t.set(a,n)}for(const[s,a]of t)a.sort((e,t)=>e.timestamp-t.timestamp),t.set(s,a);return t}(t),a=s.get(e);(null==a?void 0:a.length)&&y(function(e,t){if(0===t.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 s=[...t].sort((e,t)=>e.timestamp-t.timestamp),a=s.reduce((e,t)=>t.hopCount>e.hopCount?t:e,s[0]),n=s[0].timestamp,r=s[s.length-1].timestamp,l=a.decoded.pathHashes,i=l.length,c=a.hopCount,o=a.decoded.isComplete,d=[],x=a.decoded.snrValues;for(let p=0;p0){const e=Math.min(...x),t=Math.max(...x);m={minSnr:e,maxSnr:t,avgSnr:x.reduce((e,t)=>e+t,0)/x.length,weakestLinkPosition:x.indexOf(e),strongestLinkPosition:x.indexOf(t)}}return{traceTag:e,traceTagValue:a.decoded.traceTagValue,targetPath:l,targetHopCount:i,observations:s,observationCount:s.length,firstSeen:n,lastSeen:r,duration:r-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))},[N]),O=s.useCallback(e=>{const t=N.find(t=>t.packet_hash===e);t&&(y(null),z(t))},[N,z]),W=s.useSyncExternalStore(Jt,Xt,()=>!0);return e.jsxs("div",{className:t("flex flex-col",h),onMouseLeave:$,children:[e.jsx("div",{className:"divide-y divide-white/5 py-1",children:(()=>{if(i&&0===a.length)return e.jsx(es,{});if(0===P.length)return e.jsx(Zt,{message:p});const t=W?Ze:et;return P.map((s,a)=>{const n=s.packet_hash?M.get(s.packet_hash):void 0,i=null!==j.traceTag&&n===j.traceTag,c=_.get(a),o=void 0!==c&&null!==j.dupeGroup&&s.packet_hash===j.dupeGroup;return e.jsx(t,{packet:s,onClick:e=>z(e,a),localHash:r,neighbors:l,isFlashing:m&&T===s.packet_hash,traceTag:n,isTraceHighlighted:i,onTraceHover:U,onViewTraceReport:V,dupeGroupPosition:c,isDupeGroupHovered:o,onDupeGroupHover:I},`${s.packet_hash}_${s.timestamp}_${a}`)})})()}),d&&C>1&&e.jsx("nav",{className:"border-t border-border-subtle px-4 py-3",children:e.jsxs(Le,{className:"justify-center",children:[e.jsx(ze,{onClick:()=>S(w-1),disabled:1===w}),e.jsx(Ae,{children:H.map((t,s)=>"gap"===t?e.jsx(Re,{},`gap-${s}`):e.jsx(Ee,{page:t,current:t===w,onClick:S},t))}),e.jsx(De,{onClick:()=>S(w+1),disabled:w===C})]})}),e.jsx(ts,{showPagination:d,currentPage:w,perPage:o,displayCount:P.length,totalCount:d?k.length:a.length,action:u}),!x&&g&&e.jsx(Vt,{packets:g.packets,initialIndex:g.initialIndex,onClose:()=>f(null),onNavigatePrev:D,onNavigateNext:A,hasPrev:E,hasNext:R}),b&&e.jsx(qt,{report:b,onClose:()=>y(null),onViewPacket:O})]})}export{Ne as A,ss as P,Pe as S,Me as T,We as g,Fe as u}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PathMapMapLibre-BqsWS2Hd.js","assets/vendor-react-j_fHog8x.js","assets/BasemapLayer-Dkb0XoZP.js","assets/vendor-core-CDNU4oKM.js","assets/index-B51aMfiH.js","assets/DelayedAnimateNumber-BXZBlojL.js","assets/index-Ch_XDzqB.js","assets/config-CTM8_93T.js","assets/payload-decoders-ClAu_OX0.js","assets/SignalIndicator-DvKCjwKG.js","assets/signal-scoring-CcBiRcks.js","assets/arrow-up-By-lyY8m.js","assets/copy-jAVnwXtf.js","assets/chevron-right-DiVetJOJ.js","assets/map-pin-C3ieg9t_.js","assets/triangle-alert-JpcXY4mr.js","assets/DataBox-B4su-zzA.js","assets/layers-Dd_4LhZ4.js","assets/route-BTnuOvzt.js","assets/activity-48nFba-7.js","assets/circle-check-DBemvAXd.js","assets/database-IcctMW15.js","assets/maplibre-gl-B1CfjdFi.css","assets/index-gDSZCHkY.css"])))=>i.map(i=>d[i]); +import{j as e,c as t,r as s,_ as a}from"./vendor-react-j_fHog8x.js";import{c as n,a1 as r,a2 as l,a3 as i,a4 as c,B as o,a5 as d,a6 as x,a7 as m,e as p,a8 as h,a9 as u,aa as g,ab as f,ac as b,v as y,ad as j,ae as v,m as N,E as k,f as w,af as C,ag as S,ah as H,ai as P,R as M,aj as _,ak as T,al as B,n as F,am as L,an as z,ao as D,ap as A,K as E,N as R,A as U,aq as I,O as $,ar as V,as as O,at as Q}from"./index-B51aMfiH.js";import{P as W,d as G,a as q,b as K,c as Y,e as J}from"./payload-decoders-ClAu_OX0.js";import{D as X,S as Z,R as ee,P as te,a as se,b as ae,g as ne,c as re,Z as le}from"./SignalIndicator-DvKCjwKG.js";import{a as ie,A as ce}from"./arrow-up-By-lyY8m.js";import{C as oe}from"./copy-jAVnwXtf.js";import{C as de}from"./chevron-right-DiVetJOJ.js";import{M as xe}from"./map-pin-C3ieg9t_.js";import{T as me}from"./triangle-alert-JpcXY4mr.js";import{D as pe}from"./DataBox-B4su-zzA.js";import{L as he}from"./layers-Dd_4LhZ4.js";import{H as ue,R as ge}from"./route-BTnuOvzt.js";import{A as fe}from"./activity-48nFba-7.js";import{C as be}from"./circle-check-DBemvAXd.js";import{D as ye}from"./database-IcctMW15.js";import{H as je,D as ve}from"./DelayedAnimateNumber-BXZBlojL.js";const Ne=n("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),ke=n("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),we=n("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"}]]),Ce=n("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"}]]),Se=n("reply",[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]),He=n("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"}]]),Pe=n("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"}]]),Me=n("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=n("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 Te(e,t){[...t].reverse().forEach(s=>{const a=e.getVariant(s);a&&l(e,a),e.variantChildren&&e.variantChildren.forEach(e=>{Te(e,t)})})}function Be(){const e=new Set,t={subscribe:t=>(e.add(t),()=>{e.delete(t)}),start(t,s){const a=[];return e.forEach(e=>{a.push(r(e,t,{transitionOverride:s}))}),Promise.all(a)},set:t=>e.forEach(e=>{!function(e,t){Array.isArray(t)?Te(e,t):"string"==typeof t?Te(e,[t]):l(e,t)}(e,t)}),stop(){e.forEach(e=>{!function(e){e.values.forEach(e=>e.stop())}(e)})},mount:()=>()=>{t.stop()}};return t}function Fe(){const e=i(Be);return c(e.mount,[]),e}function Le({"aria-label":s="Page navigation",className:a,...n}){return e.jsx("nav",{"aria-label":s,...n,className:t("flex gap-x-2",a)})}function ze({onClick:s,disabled:a=!1,className:n,children:r="Previous"}){return e.jsx("span",{className:t("grow basis-0",n),children:e.jsxs(o,{plain:!0,onClick:s,disabled:a,"aria-label":"Previous page",className:t("gap-1",a&&"invisible"),children:[e.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M2.75 8H13.25M2.75 8L5.25 5.5M2.75 8L5.25 10.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})}),r]})})}function De({onClick:s,disabled:a=!1,className:n,children:r="Next"}){return e.jsx("span",{className:t("flex grow basis-0 justify-end",n),children:e.jsxs(o,{plain:!0,onClick:s,disabled:a,"aria-label":"Next page",className:t("gap-1",a&&"invisible"),children:[r,e.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.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 Ae({className:s,...a}){return e.jsx("span",{...a,className:t("hidden items-baseline gap-x-2 sm:flex",s)})}function Ee({page:s,current:a=!1,onClick:n,className:r,children:l}){return e.jsx(o,{plain:!a,outline:a,onClick:()=>null==n?void 0:n(s),"aria-label":`Page ${s}`,"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",r),children:l??s})}function Re({className:s,...a}){return e.jsx("span",{"aria-hidden":"true",...a,className:t("w-[2.25rem] select-none text-center text-sm text-text-muted",s),children:"…"})}function Ue(e){if(!e||e.length<8)return null;const t=parseInt(e.slice(0,2),16),s=parseInt(e.slice(2,4),16),a=parseInt(e.slice(4,6),16),n=parseInt(e.slice(6,8),16);return isNaN(t)||isNaN(s)||isNaN(a)||isNaN(n)?null:((t|s<<8|a<<16|n<<24)>>>0).toString(16).toUpperCase().padStart(8,"0")}function Ie(e){return e>=10?"excellent":e>=5?"good":e>=0?"fair":e>=-5?"poor":"critical"}function $e(e){if(!e.payload)return null;try{const t=m(e.payload),s=function(e){const t=e.original_path||e.forwarded_path||[];if("string"==typeof t)try{const e=JSON.parse(t);if(Array.isArray(e))return e.map(e=>parseInt(e,16))}catch{return[]}else if(Array.isArray(t))return t.map(e=>parseInt(e,16));return[]}(e),a=q(t,s);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 Ve={rx:{icon:ce,label:"Rx",badgeColor:X.rx,avatarBg:"bg-emerald-500/15",avatarText:"text-emerald-400"},forward:{icon:Ne,label:"Fwd",badgeColor:X.forward,avatarBg:"bg-sky-500/15",avatarText:"text-sky-400"},duplicate:{icon:oe,label:"Dupe",badgeColor:X.duplicate,avatarBg:"bg-zinc-500/15",avatarText:"text-zinc-400"},tx:{icon:ie,label:"Tx",badgeColor:X.tx,avatarBg:"bg-violet-500/15",avatarText:"text-violet-400"},dropped:{icon:we,label:"Drop",badgeColor:X.dropped,avatarBg:"bg-amber-500/15",avatarText:"text-amber-400"}},Oe={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},Qe={sm:"w-7 h-7",md:"w-8 h-8",lg:"w-9 h-9"};function We(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 Ge=s.memo(function({packet:s,showLabel:a=!0,variant:n="avatar",size:r="sm"}){const l=We(s),i=Ve[l],c=i.icon;return"avatar"===n?e.jsx("div",{className:t("flex items-center justify-center rounded-full flex-shrink-0",i.avatarBg,Qe[r]),children:e.jsx(c,{className:t(Oe[r],i.avatarText)})}):e.jsxs(p,{color:i.badgeColor,children:[e.jsx(c,{className:Oe[r]}),a&&i.label]})}),qe=s.memo(function({path:s,localHash:a,className:n}){if(!s||0===s.length)return e.jsx("span",{className:t("text-text-muted text-[10px]",n),children:"—"});const r=a?(a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase():null;return e.jsx("span",{className:t("flex items-center gap-0.5 font-mono text-[10px] overflow-hidden",n),children:s.map((t,a)=>{const n=a===s.length-1,l=r&&t.toUpperCase()===r;return e.jsxs("span",{className:"flex items-center flex-shrink-0",children:[l?e.jsx("span",{className:"px-1 py-0.5 rounded bg-amber-500/20 text-amber-400 text-[9px] font-medium",children:"You"}):e.jsx("span",{className:"px-1 py-0.5 rounded bg-subtle-fill-hover text-text-secondary",children:t.toUpperCase()}),!n&&e.jsx(de,{className:"w-2.5 h-2.5 text-text-muted mx-0.5 flex-shrink-0"})]},`${t}-${a}`)})})}),Ke=s.memo(function({count:s,className:a}){const n=s>=2;return e.jsxs("span",{className:t("font-mono text-xs tabular-nums",n?"text-text-secondary":"text-text-muted",a),children:[s,e.jsx("span",{className:"text-text-muted",children:"→"})]})});function Ye(e){const t=e.payload_type_name||g(e.payload_type??e.type),s=e.route_type_name||f(e.route_type??e.route);return{payloadType:t,routeType:s,payloadColor:te[t]??"zinc",routeColor:ee[s]??"zinc"}}function Je(e){if(!e)return[];if(Array.isArray(e))return e;try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Xe(e,t){if(!e||!t)return null;const s=e.startsWith("0x")?e.slice(2):e;for(const[a,n]of Object.entries(t))if((a.startsWith("0x")?a.slice(2):a).toLowerCase().startsWith(s.toLowerCase()))return n.name||n.node_name||null;return null}const Ze=s.memo(function({packet:a,onClick:n,localHash:r,neighbors:l,isFlashing:i=!1,isTraceHighlighted:c,onTraceHover:o,traceTag:d,onViewTraceReport:x,dupeGroupPosition:m,isDupeGroupHovered:g=!1,onDupeGroupHover:f}){const b=h(a.is_duplicate),y=void 0!==m,{payloadType:j,routeType:v,payloadColor:N,routeColor:k}=Ye(a),w="tx_local"===a.packet_origin,C="TRACE"===j,S=Je(a.original_path),H=Je(a.forwarded_path),P=H.length>0?H:S,M=P.length,_=a.src_hash?(a.src_hash.startsWith("0x")?a.src_hash.slice(2,6):a.src_hash.slice(0,4)).toUpperCase():null,T=Xe(a.src_hash,l),B=a.payload_length??a.length??0;a.lbt_attempts;const F=s.useCallback(()=>{C&&d&&x?x(d):n(a)},[C,d,x,n,a]),L=s.useCallback(()=>{C&&d&&o&&o(d),y&&f&&a.packet_hash&&f(a.packet_hash)},[C,d,o,y,f,a.packet_hash]),z=s.useCallback(()=>{o&&o(null),f&&f(null)},[o,f]),D={lime:"rgb(132, 204, 22)",cyan:"rgb(34, 211, 238)",amber:"rgb(251, 191, 36)",violet:"rgb(167, 139, 250)",rose:"rgb(251, 113, 133)",emerald:"rgb(52, 211, 153)",sky:"rgb(56, 189, 248)",orange:"rgb(251, 146, 60)",pink:"rgb(244, 114, 182)",zinc:"rgb(161, 161, 170)",purple:"rgb(168, 85, 247)",indigo:"rgb(129, 140, 248)",teal:"rgb(45, 212, 191)",fuchsia:"rgb(232, 121, 249)",blue:"rgb(59, 130, 246)",green:"rgb(34, 197, 94)",yellow:"rgb(250, 204, 21)",red:"rgb(239, 68, 68)",brown:"rgb(168, 133, 107)"},A=D[N]||D.zinc,E=g;return e.jsxs("div",{onClick:F,onMouseEnter:L,onMouseLeave:z,className:t("group relative cursor-pointer","hover:bg-subtle-fill",b&&!g&&"opacity-40",i&&"flash-row",w&&"bg-violet-500/5",c&&"bg-teal-500/10"),children:[e.jsx("div",{className:t("absolute pointer-events-none transition-opacity duration-75",y?E?"opacity-100":"opacity-0":"opacity-0 group-hover:opacity-100"),style:(()=>{const e={pointerEvents:"none"};return"first"===m?{...e,borderTop:`2px solid ${A}`,borderLeft:`2px solid ${A}`,borderRight:`2px solid ${A}`,borderBottom:"none",borderRadius:"8px 8px 0 0",inset:"-2px -2px 0 -2px"}:"middle"===m?{...e,borderTop:"none",borderLeft:`2px solid ${A}`,borderRight:`2px solid ${A}`,borderBottom:"none",borderRadius:0,inset:"0 -2px"}:"last"===m?{...e,borderTop:"none",borderLeft:`2px solid ${A}`,borderRight:`2px solid ${A}`,borderBottom:`2px solid ${A}`,borderRadius:"0 0 8px 8px",inset:"0 -2px -2px -2px"}:{...e,border:`2px solid ${A}`,borderRadius:"8px",inset:"-2px"}})()}),e.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:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e.jsx("div",{className:"relative flex-shrink-0",children:e.jsx(Ge,{packet:a,variant:"avatar",size:"sm"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-bold text-[13px] text-text-primary font-sans truncate",children:_||"—"}),T&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-text-muted truncate max-w-[70px]",children:T})]})]}),e.jsxs("div",{className:"flex-1 flex items-center gap-1 min-[600px]:gap-1.5 min-[900px]:gap-2 min-w-0",children:[e.jsx("span",{className:"text-[10px] min-[600px]:text-[11px] text-text-muted font-mono tabular-nums whitespace-nowrap flex-shrink-0",children:u(a.timestamp)}),e.jsx(p,{color:N,className:"flex-shrink-0",children:j}),e.jsx("span",{className:"min-[600px]:hidden text-[10px] font-mono text-text-muted flex-shrink-0",children:v.charAt(0)}),e.jsx(p,{color:k,className:"flex-shrink-0 hidden min-[600px]:inline-flex",children:v}),e.jsx("div",{className:"flex-shrink-0 flex items-center",children:e.jsx(Ke,{count:M})}),e.jsxs("span",{className:"hidden min-[520px]:inline text-[10px] text-text-muted font-mono flex-shrink-0",children:[B,"B"]}),e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:e.jsx(qe,{path:P,localHash:r})})]}),e.jsx("div",{className:"flex-shrink-0",children:e.jsx(Z,{rssi:a.rssi,snr:a.snr,compact:!0,showValues:!0})})]})]})}),et=s.memo(function({packet:s,onClick:a,localHash:n,neighbors:r,isFlashing:l=!1,isTraceHighlighted:i,traceTag:c,onViewTraceReport:o,dupeGroupPosition:d,isDupeGroupHovered:x=!1,onDupeGroupHover:m}){const{payloadType:g,routeType:f,payloadColor:b,routeColor:y}=Ye(s),j="tx_local"===s.packet_origin,v="TRACE"===g,N=h(s.is_duplicate),k=Je(s.original_path),w=Je(s.forwarded_path),C=w.length>0?w:k,S=C.length,H=s.src_hash?(s.src_hash.startsWith("0x")?s.src_hash.slice(2,6):s.src_hash.slice(0,4)).toUpperCase():null,P=Xe(s.src_hash,r),M=s.payload_length??s.length??0,_=s.lbt_attempts??0,T={lime:"rgb(132, 204, 22)",cyan:"rgb(34, 211, 238)",amber:"rgb(251, 191, 36)",violet:"rgb(167, 139, 250)",rose:"rgb(251, 113, 133)",emerald:"rgb(52, 211, 153)",sky:"rgb(56, 189, 248)",orange:"rgb(251, 146, 60)",pink:"rgb(244, 114, 182)",zinc:"rgb(161, 161, 170)",purple:"rgb(168, 85, 247)",indigo:"rgb(129, 140, 248)",teal:"rgb(45, 212, 191)",fuchsia:"rgb(232, 121, 249)",blue:"rgb(59, 130, 246)",green:"rgb(34, 197, 94)",yellow:"rgb(250, 204, 21)",red:"rgb(239, 68, 68)"},B=T[b]||T.zinc;return e.jsxs("div",{onClick:()=>{v&&c&&o?o(c):a(s)},className:t("relative pl-3 pr-2.5 py-2 cursor-pointer","active:bg-subtle-fill-hover",N&&"opacity-40",l&&"flash-row",j&&"bg-violet-500/5",i&&"bg-teal-500/10"),children:[e.jsx("div",{className:"absolute left-0 transition-all",style:(()=>{if(!d)return{opacity:0};const e=x?1:.4,t=x?"3px":"2px";return"first"===d?{backgroundColor:B,opacity:e,width:t,top:"6px",bottom:0,borderRadius:"0 9999px 0 0"}:"middle"===d?{backgroundColor:B,opacity:e,width:t,top:0,bottom:0,borderRadius:0}:"last"===d?{backgroundColor:B,opacity:e,width:t,top:0,bottom:"6px",borderRadius:"0 0 9999px 0"}:{backgroundColor:B,opacity:e,width:t,top:"6px",bottom:"6px",borderRadius:"9999px"}})()}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"relative flex-shrink-0 mt-0.5",children:e.jsx(Ge,{packet:s,variant:"avatar",size:"sm"})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-semibold text-[14px] text-text-primary tracking-tight",children:H||"—"}),P&&e.jsx("span",{className:"text-[12px] text-text-muted truncate max-w-[80px]",children:P}),e.jsx("div",{className:"flex-1"}),e.jsx(p,{color:b,className:"flex-shrink-0 !text-[9px] !px-1.5 !py-0",children:g}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("span",{className:"text-[10px] font-mono text-text-muted tabular-nums w-[28px] text-right",children:s.rssi}),e.jsx(Z,{rssi:s.rssi,compact:!0,showValues:!1})]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-text-muted font-mono",children:[e.jsx("span",{className:"tabular-nums",children:u(s.timestamp)}),e.jsx(p,{color:y,className:"!text-[8px] !px-1 !py-0 !leading-none",children:f.charAt(0)}),S>0&&e.jsxs("span",{children:[S,"h"]}),M>0&&e.jsxs("span",{children:[M,"B"]}),_>0&&e.jsxs("span",{className:_>1?"text-amber-400/60":void 0,children:["LBT:",_]}),null!=s.snr&&e.jsxs("span",{children:[s.snr.toFixed(0),"dB"]})]}),S>0&&e.jsx("div",{className:"pt-0.5",children:e.jsx(qe,{path:C,localHash:n})})]})]})]})});function tt(e){if(e.contact_type){const t=e.contact_type.toLowerCase();if("repeater"===t||"rep"===t)return!0;if("companion"===t||"client"===t||"cli"===t)return!1;if("room server"===t||"room_server"===t||"room"===t||"server"===t)return!1}return!0===e.is_repeater||(e.is_repeater,!1)}const st=s.lazy(()=>a(()=>import("./PathMapMapLibre-BqsWS2Hd.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])));function at(e){return`${(100*e).toFixed(0)}%`}function nt(e,t){const s=document.documentElement,a=getComputedStyle(s),n={success:a.getPropertyValue("--accent-success").trim()||"#39D98A",secondary:a.getPropertyValue("--accent-secondary").trim()||"#F9D26F",poor:a.getPropertyValue("--signal-poor").trim()||"#FF8A5C",danger:a.getPropertyValue("--accent-danger").trim()||"#FF5C7A",muted:a.getPropertyValue("--text-muted").trim()||"#767688"};let r;return r=0===t?n.muted:e>=1?n.success:e>=.5?n.secondary:e>=.25?n.poor:e>0?n.danger:n.muted,{color:r}}class rt extends s.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?e.jsxs("div",{className:"h-[200px] flex items-center justify-center text-text-muted",children:[e.jsx(me,{className:"w-4 h-4 mr-2"}),"Map failed to load"]}):this.props.children}}function lt({path:a,neighbors:n,localNode:r,localHash:l,srcHash:i,dstHash:c,neighborAffinity:o,prefixLookup:d,hubNodes:x,traceSnr:m,advertiserSource:p}){const[h,u]=s.useState(null),g=s.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=s.useMemo(()=>{if(p)return null;if(!i)return null;const e=y(i),t=n[i];if((null==t?void 0:t.latitude)&&(null==t?void 0:t.longitude)&&(0!==t.latitude||0!==t.longitude))return{prefix:e,candidates:[{hash:i,name:t.node_name||t.name||"Source",latitude:t.latitude,longitude:t.longitude,probability:1,isLocal:!1,isDirectNeighbor:!0===t.zero_hop}],confidence:1,totalMatches:1,isSource:!0};const s=(null==t?void 0:t.node_name)||(null==t?void 0:t.name)||i.slice(0,8);return{prefix:e,candidates:[{hash:i,name:s,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isSource:!0}},[p,i,n]),j=s.useMemo(()=>{const e=(null==c?void 0:c.startsWith("0x"))?c.slice(2):c;if((!e||"00"===e||"0000000000000000"===e)&&r&&l){const e=y(l),t=0!==r.latitude||0!==r.longitude;return{prefix:e,candidates:[{hash:l,name:r.name||"Local Node",latitude:t?r.latitude:0,longitude:t?r.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}if(!c)return null;const t=y(c);if(l&&c===l&&r){const e=0!==r.latitude||0!==r.longitude;return{prefix:t,candidates:[{hash:c,name:r.name||"Local Node",latitude:e?r.latitude:0,longitude:e?r.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}const s=n[c];if((null==s?void 0:s.latitude)&&(null==s?void 0:s.longitude)&&(0!==s.latitude||0!==s.longitude))return{prefix:t,candidates:[{hash:c,name:s.node_name||s.name||"Destination",latitude:s.latitude,longitude:s.longitude,probability:1,isLocal:!1,isDirectNeighbor:!0===s.zero_hop}],confidence:1,totalMatches:1,isDestination:!0};const a=(null==s?void 0:s.node_name)||(null==s?void 0:s.name)||c.slice(0,8);return{prefix:t,candidates:[{hash:c,name:a,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isDestination:!0}},[c,n,r,l]),v=s.useMemo(()=>function(e,t,s,a,n,r){if(!e||0===e.length)return{hops:[],overallConfidence:0,hasValidPath:!1};const l=e.length-1,i=e.map((i,c)=>{const o=c===l,d=e.length-c,{candidates:x,totalMatches:m}=function(e,t,s,a,n=!1,r,l,i){const c=function(e){const t={};for(const[s,a]of Object.entries(e))tt(a)&&(t[s]=a);return t}(t);let o;if(l){const t=function(e,t,s){const a=t.toUpperCase(),n=e.get(a);if(!n||0===n.candidates.length)return{hash:null,confidence:0};if(null==s?void 0:s.isLastHop)return{hash:n.bestMatch,confidence:n.confidence};if(1===(null==s?void 0:s.position))return{hash:n.bestMatch,confidence:n.confidence};if((null==s?void 0:s.position)&&n.bestMatchForPosition.has(s.position)){const e=n.bestMatchForPosition.get(s.position),t=Math.max(e.confidence,n.confidence);return{hash:e.hash,confidence:t}}if((null==s?void 0:s.adjacentPrefixes)&&s.adjacentPrefixes.length>0){let e=n.bestMatch,t=0;for(const a of n.candidates){let n=0;for(const e of s.adjacentPrefixes)n+=a.adjacentPrefixCounts.get(e.toUpperCase())||0;const r=a.combinedScore+n/Math.max(1,a.totalAdjacentObservations)*.3;r>t&&(t=r,e=a.hash)}return{hash:e,confidence:n.confidence}}return{hash:n.bestMatch,confidence:n.confidence}}(l,e,{position:i,isLastHop:n});o=t.confidence}const{matches:d,probability:x}=function(e,t,s,a,n=!1){const r=e.toUpperCase(),l=[],i=s&&b(r,s);i&&l.push(s);for(const p of Object.keys(t))b(r,p)&&l.push(p);if(n&&i&&s&&1===l.length)return{matches:l,probability:1,bestMatch:s};if(n&&i&&l.length>1){const e=l.filter(e=>e!==s);if(1===e.length)return{matches:l,probability:1,bestMatch:e[0]}}const c=l.length>0?1/l.length:0,o=[...l].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 t=a.get(e),s=t?"number"==typeof t?t:t.combinedScore:0;s>x&&(x=s,d=e)}d||(d=o[0])}else o.length>0&&(d=o[0]);let m=c;if(l.length>1&&a&&x>0){let e=0;for(const t of l){const s=a.get(t);e+=s?"number"==typeof s?s:s.combinedScore:0}e>0&&(m=Math.min(.95,x/e))}return{matches:l,probability:m,bestMatch:d}}(e,c,a,r,n),m=d.length,p=[],h=e.toUpperCase(),u=s&&void 0!==s.latitude&&void 0!==s.longitude&&(0!==s.latitude||0!==s.longitude);for(const f of d){if(a&&b(h,a)&&f===a&&u&&s){p.push({hash:f,name:s.name||"Local Node",latitude:s.latitude,longitude:s.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,t=g-1;p.slice(1).forEach(s=>{s.probability=e/t})}else{let e=0;const t=p.map(t=>{if(t.isLocal)return{candidate:t,score:1};const a=null==r?void 0:r.get(t.hash);let n=.5;var l;let i;return u&&s&&(n=(l=function(e,t,s,a){const n=(s-e)*Math.PI/180,r=(a-t)*Math.PI/180,l=Math.sin(n/2)*Math.sin(n/2)+Math.cos(e*Math.PI/180)*Math.cos(s*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2);return 2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l))*6371e3}(s.latitude,s.longitude,t.latitude,t.longitude))<100?1:l<500?.9:l<1e3?.7:l<5e3?.5:l<1e4?.3:.1),a?i=.3*n+.3*a.hopConsistencyScore+.4*a.frequencyScore:(i=n,t.isDirectNeighbor&&(i=Math.max(i,.8))),e+=i,{candidate:t,score:i}});if(e>0)t.forEach(({candidate:t,score:s})=>{t.probability=Math.min(.95,s/e)});else{const e=1/g;p.forEach(t=>t.probability=e)}}return{candidates:p,totalMatches:m}}(i,t,s,a,o,n,r,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,t)=>0===t.confidence?0:e*t.confidence,1),o=i.some(e=>e.candidates.length>0);return{hops:i,overallConfidence:c,hasValidPath:o}}(a,n,r,l,o,d),[a,n,r,l,o,d]),N=s.useMemo(()=>{const e=[];g?e.push(g):f&&e.push(f),e.push(...v.hops),j&&e.push(j);const t=e.reduce((e,t)=>0===t.confidence?0:e*t.confidence,1),s=e.some(e=>e.candidates.some(e=>0!==e.latitude||0!==e.longitude));return{hops:e,overallConfidence:t,hasValidPath:s}},[g,f,v,j]);return N.hasValidPath?e.jsxs("div",{className:"h-full flex flex-col space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-text-muted",children:"Path Confidence:"}),e.jsx("span",{className:(k=N.overallConfidence,k>=1?"text-accent-success":k>=.5?"text-accent-secondary":k>=.25?"text-signal-poor":k>0?"text-accent-danger":"text-text-muted"),children:at(N.overallConfidence)}),e.jsx("button",{className:"text-text-muted hover:text-text-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:e.jsx(se,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-success"}),e.jsx("span",{className:"text-text-muted",children:"Exact"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-secondary"}),e.jsx("span",{className:"text-text-muted",children:"Multi"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-text-muted"}),e.jsx("span",{className:"text-text-muted",children:"Unknown"})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(rt,{children:e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"h-full bg-bg-elevated flex items-center justify-center text-text-muted text-sm",children:"Loading map..."}),children:e.jsx(st,{resolvedPath:N,localNode:r,hubNodes:x,hoveredHopIndex:h,onHoverHop:u,traceSnr:m})})})}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:N.hops.map((s,a)=>{var n,r,l;const i=!0===s.isSource,c=!0===s.isDestination,o=h===a;let d;return d=i?`Source: ${(null==(n=s.candidates[0])?void 0:n.name)||"Unknown"}`:c?`Destination: ${(null==(r=s.candidates[0])?void 0:r.name)||"Unknown"}`:0===s.totalMatches?"No matching nodes found":1===s.totalMatches?`Exact match: ${(null==(l=s.candidates[0])?void 0:l.name)||"Unknown"}`:`${s.totalMatches} possible matches (${(100*s.confidence).toFixed(0)}% confidence)`,e.jsxs("div",{className:t("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-mono cursor-pointer transition-all",o?"bg-accent-primary/20 ring-1 ring-accent-primary/50":"bg-bg-elevated hover:bg-bg-subtle",i&&"border border-accent-success/30",c&&"border border-accent-primary/30"),title:d,onMouseEnter:()=>u(a),onMouseLeave:()=>u(null),children:[i&&e.jsx("span",{className:"text-accent-success text-[8px] mr-0.5",children:"SRC"}),c&&e.jsx("span",{className:"text-accent-primary text-[8px] mr-0.5",children:"DST"}),e.jsx("span",{style:nt(s.confidence,s.totalMatches),children:s.prefix}),!i&&!c&&s.totalMatches>1&&e.jsxs("span",{className:"text-text-muted",children:["×",s.totalMatches]}),!i&&!c&&0===s.totalMatches&&e.jsx("span",{className:"text-text-muted",children:"?"})]},a)})})]}):e.jsxs("div",{className:"flex items-center justify-center text-text-muted text-xs py-4",children:[e.jsx(xe,{className:"w-3.5 h-3.5 mr-1.5 opacity-50"}),"No location data available for path nodes"]});var k}function it(e){return e.match(/.{1,2}/g)||[]}function ct(e){return null!==e&&e.startsWith("payload:")}const ot={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(--text-muted)"},dt=15,xt="color-mix(in srgb, var(--bg-elevated) 60%, var(--bg-body))",mt="\n inset 0 0 0 1px color-mix(in srgb, var(--text-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 ",pt=2,ht={type:"tween",duration:.25,ease:[.25,.1,.25,1]};function ut(e,t){return e?`inset 0 0 0 ${pt}px ${ot[t]}`:mt}function gt(e,t){return e?t:`color-mix(in srgb, ${t} ${dt}%, transparent)`}function ft({segments:t,selectedSegment:a,onSegmentClick:n}){const[r,l]=s.useState(null),[i,c]=s.useState(null),o=t.some(e=>void 0!==e.id)&&n,d=[];for(const e of t){const t=it(e.hex);for(const s of t)d.push({byte:s.toUpperCase(),color:e.color,id:e.id})}const x=[];for(let e=0;e{const d=t.length<16;return e.jsx("div",{className:"flex rounded-md overflow-hidden",children:t.map(({byte:s,color:x,id:m},p)=>{const h=p===t.length-1,u=d&&h,g=ot[x],f=m?r===m:i===x,b=Boolean(m&&a===m),y=f||b;return e.jsx("span",{className:"w-[1.75rem] text-xs text-center py-0.5 font-mono select-text "+(o?"cursor-pointer":""),style:{backgroundColor:gt(y,g),color:y?"rgba(255,255,255,0.95)":g,transition:y?"none":"background-color 0.15s ease-out, color 0.15s ease-out",touchAction:"manipulation",...u?{borderRadius:"0 0.375rem 0.375rem 0"}:{}},onMouseEnter:()=>{m?l(m):c(x)},onMouseLeave:()=>{l(null),c(null)},onClick:()=>m&&(null==n?void 0:n(m)),onTouchStart:()=>{m?l(m):c(x)},onTouchEnd:()=>{l(null),c(null)},children:s},p)})},s)})})}function bt({rawHex:t,hexSegments:a,selectedSegment:n,onSegmentClick:r}){const[l,i]=s.useState(!1),c=s.useCallback(async()=>{try{await navigator.clipboard.writeText(t.toUpperCase()),i(!0),setTimeout(()=>i(!1),2e3)}catch(e){}},[t]);return e.jsxs("div",{className:"bg-black rounded-2xl p-6 relative",children:[e.jsx(ft,{segments:a,selectedSegment:n,onSegmentClick:r}),e.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-text-muted hover:text-text-secondary transition-all text-xs font-sans",title:"Copy raw packet hex",children:l?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"w-3.5 h-3.5 text-green-400"}),e.jsx("span",{className:"text-green-400",children:"Copied"})]}):e.jsxs(e.Fragment,{children:[e.jsx(oe,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Copy"})]})})]})}function yt({bits:t,field:s,value:a,binary:n}){return e.jsxs("tr",{children:[e.jsx("td",{className:"py-1.5 text-xs text-text-muted tabular-nums",children:t}),e.jsx("td",{className:"py-1.5 text-sm text-text-secondary",children:s}),e.jsx("td",{className:"py-1.5",children:(()=>{if("Payload Type"===s){const t=te[a]||"zinc";return e.jsx(p,{color:t,children:a})}if("Route Type"===s){const t=ee[a]||"zinc";return e.jsx(p,{color:t,children:a})}return e.jsx("span",{className:"text-sm text-text-primary",children:a})})()}),e.jsx("td",{className:"py-1.5 font-mono text-xs text-sys-cyan",children:n})]})}function jt({id:t,title:s,color:a,hexBytes:n,startByte:r,endByte:l,isSelected:i,children:c}){const o=n?it(n):[];return e.jsxs(N.div,{layout:"position",layoutId:t,transition:ht,className:"w-full min-w-0 overflow-hidden rounded-xl p-4 sm:p-5 space-y-4",style:{backgroundColor:xt,boxShadow:ut(i,a)},children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 min-w-0",children:[e.jsx(p,{color:a,children:s}),o.length>0&&o.length<=16&&o.map((t,s)=>e.jsx(p,{color:a,className:"font-mono",children:t.toUpperCase()},s))]}),e.jsxs("span",{className:"text-[10px] text-text-muted font-mono flex-shrink-0",children:["Bytes ",r,"-",l]})]}),e.jsx("div",{className:"min-w-0 overflow-hidden",children:c})]})}function vt({advert:t,timestamp:s}){const a=S(s||t.timestamp);return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-purple-500/10 dark:bg-purple-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-purple) 0%, var(--sys-blue) 100%)"},children:e.jsx(M,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:t.name||"Unknown Node"}),e.jsx("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:t.nodeType})]})]}),e.jsx("div",{className:"mx-4 border-t border-border-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-2",children:[void 0!==t.latitude&&void 0!==t.longitude&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(xe,{className:"w-4 h-4 text-purple-600 dark:text-purple-400 flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-text-secondary font-mono",children:[t.latitude.toFixed(5),"°, ",t.longitude.toFixed(5),"°"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(H,{className:"w-4 h-4 text-purple-600 dark:text-purple-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]})]})]})})}function Nt({decoded:t,timestamp:s}){const a=s?S(s):"Unknown";return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-teal-500/10 dark:bg-teal-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.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:e.jsx(ye,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:t.channelName||"Channel Data"}),e.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:[t.dataLength," bytes • ",t.decrypted?"Decrypted":"Encrypted"]})]})]}),e.jsx("div",{className:"mx-4 border-t border-border-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ue,{className:"w-4 h-4 text-teal-600 dark:text-teal-400 flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-text-secondary font-sans",children:["Channel: ",e.jsxs("span",{className:"font-mono",children:["0x",t.channelHash]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(H,{className:"w-4 h-4 text-teal-600 dark:text-teal-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]}),t.decrypted&&t.decryptedHex&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-border-subtle",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted mb-1 font-sans",children:"Decrypted Data"}),e.jsx("div",{className:"max-w-full overflow-x-auto",children:e.jsx(pe,{size:"compact",copy:!0,className:"inline-block",children:e.jsx("span",{className:"break-all text-xs",children:t.decryptedHex.toUpperCase()})})})]})]})]})})}function kt({decoded:t,timestamp:a,isLoading:n=!1,onDecrypted:r}){const l=a?S(a):"Unknown",[i,c]=s.useState(""),[o,d]=s.useState(!1),[x,p]=s.useState(null),[h,u]=s.useState(!1),g=s.useCallback(async()=>{if(i.trim()&&t.ciphertextHex&&t.macHex){d(!0),p(null);try{const e=parseInt(t.channelHash,16),s=m(t.macHex),a=m(t.ciphertextHex),n=await P(i.trim(),e,s,a);if(n.success){const e=n.result.plaintext,s=new TextDecoder("utf-8",{fatal:!1}).decode(e.slice(5)),a=s.indexOf(": "),l={...t,channelName:n.result.channelName,decrypted:!0,timestamp:e[0]|e[1]<<8|e[2]<<16|e[3]<<24,flags:e[4],senderName:a>0?s.slice(0,a):void 0,text:a>0?s.slice(a+2):s};null==r||r(l),c(""),u(!1)}else p(n.error)}catch(e){p(e instanceof Error?e.message:"Unknown error")}finally{d(!1)}}},[i,t,r]);return n?e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-xl p-4 sm:p-5",style:{backgroundColor:"color-mix(in srgb, var(--bg-elevated) 60%, var(--bg-body))",boxShadow:"\n inset 0 0 0 1px color-mix(in srgb, var(--text-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:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 h-[15px]",children:[e.jsx("div",{className:"h-2.5 w-12 rounded bg-subtle-fill-hover animate-pulse"}),e.jsx("div",{className:"h-2.5 w-16 rounded bg-subtle-fill-hover animate-pulse"})]}),e.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:e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"h-3.5 w-48 rounded bg-subtle-fill-strong animate-pulse"}),e.jsx("div",{className:"h-3.5 w-32 rounded bg-subtle-fill-strong animate-pulse"})]})})]})}):t.decrypted?e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-xl p-4 sm:p-5",style:{backgroundColor:"color-mix(in srgb, var(--bg-elevated) 60%, var(--bg-body))",boxShadow:"\n inset 0 0 0 1px color-mix(in srgb, var(--text-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:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[t.senderName&&e.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:["From ",e.jsx("span",{className:"text-text-secondary font-medium",children:t.senderName})]}),t.channelName&&e.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:["in ",e.jsx("span",{className:"text-sys-cyan font-medium",children:t.channelName})]})]}),e.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:e.jsx("p",{className:"text-sm text-white font-sans leading-relaxed whitespace-pre-wrap break-words",children:t.text})})]})}):e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-zinc-500/10 dark:bg-zinc-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-zinc) 0%, color-mix(in srgb, var(--sys-zinc) 70%, black) 100%)"},children:e.jsx(Ce,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:t.isPublicHashChannel?"Public Hash Channel":"Encrypted Message"}),e.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:["Channel hash: ",e.jsxs("span",{className:"font-mono",children:["0x",t.channelHash]})]})]})]}),e.jsx("div",{className:"mx-4 border-t border-border-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(H,{className:"w-4 h-4 text-zinc-500 dark:text-zinc-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary font-sans",children:l})]}),t.ciphertextHex&&t.macHex&&e.jsx("div",{className:"space-y-2",children:h?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.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-border-subtle text-text-primary placeholder:text-text-muted focus:outline-none focus:border-zinc-500",onKeyDown:e=>"Enter"===e.key&&g(),disabled:o}),e.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"}),e.jsx("button",{onClick:()=>{u(!1),p(null),c("")},className:"px-2 py-1.5 text-sm rounded-lg hover:bg-subtle-fill-strong text-text-muted transition-colors",children:"×"})]}),x&&e.jsx("p",{className:"text-xs text-red-400",children:x})]}):e.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&&e.jsx("p",{className:"text-xs text-text-muted",children:t.isPublicHashChannel?"Public hash channel message. Key not in common channel list.":"Unknown hash channel. Channel name required for decryption."})]})]})})}function wt({decoded:t,timestamp:s}){const a=s?S(s):"Unknown";return e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.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:e.jsx(be,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-text-primary font-sans",children:"Acknowledgment"}),e.jsxs("p",{className:"text-xs text-text-muted font-sans mt-0.5",children:["CRC: ",e.jsxs("span",{className:"font-mono text-sys-green",children:["0x",t.crc]})," · ",a]})]})]})}function Ct({decoded:t,timestamp:s}){const a=s?S(s):"Unknown",n=t.path.length;return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-amber-500/10 dark:bg-amber-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.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:e.jsx(ge,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:"Path Response"}),e.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:[n," ",1===n?"hop":"hops"]})]})]}),e.jsx("div",{className:"mx-4 border-t border-border-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(H,{className:"w-4 h-4 text-amber-600 dark:text-amber-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]}),t.path.length>0&&e.jsx("div",{className:"mt-2 pt-2 border-t border-border-subtle",children:e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:t.path.map((t,s)=>e.jsxs("div",{className:"flex items-center gap-2",children:[s>0&&e.jsx(Ne,{className:"w-4 h-4 text-amber-500 dark:text-amber-400"}),e.jsx(p,{color:"amber",className:"font-mono",children:t})]},s))})})]})]})})}function St({decoded:t,timestamp:s}){const a=s?S(s):"Unknown",n=t.pathHashes.length,r=t.snrValues.length;return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-blue-500/10 dark:bg-blue-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.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:e.jsx(fe,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("h3",{className:"text-lg font-medium text-text-primary truncate leading-tight",children:["Trace ",t.isComplete?"Complete":"In Progress"]}),e.jsxs("p",{className:"text-sm text-text-muted mt-0.5",children:["Tag: 0x",t.traceTag.slice(0,8),t.isComplete&&" • ✓"]})]})]}),e.jsx("div",{className:"mx-4 border-t border-border-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(H,{className:"w-4 h-4 text-blue-600 dark:text-blue-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary",children:a})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-text-muted",children:[e.jsxs("span",{children:[n," target ",1===n?"hop":"hops"]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:[r," SNR ",1===r?"sample":"samples"]}),0!==t.authCode&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsxs("span",{children:["Auth: ",t.authCode]})]})]}),t.pathHashes.length>0&&e.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:t.pathHashes.map((s,a)=>{const n=t.snrValues[a],r=void 0!==n?(e=>e>=7?"green":e>=0?"yellow":e>=-5?"orange":"red")(n):"zinc",l=void 0!==n;return e.jsxs("div",{className:"flex items-center gap-2",children:[a>0&&e.jsx(Ne,{className:"w-4 h-4 text-blue-500 dark:text-blue-400 flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(p,{color:l?"blue":"zinc",className:"font-mono",children:s}),l&&e.jsxs(p,{color:r,className:"font-mono",children:[n>=0?"+":"",Number.isInteger(n)?n:n.toFixed(1),"dB"]})]})]},a)})})]})]})})}function Ht({decoded:t,timestamp:s}){const a=s?S(s):"Unknown";return t.encrypted?e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:"linear-gradient(135deg, var(--sys-purple) 0%, var(--sys-indigo) 100%)"},children:e.jsx(Ce,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-text-primary font-sans",children:"Encrypted Message"}),e.jsxs("p",{className:"text-xs text-text-muted font-sans mt-0.5",children:[t.srcHash," → ",t.destHash," · ",a]})]})]}):e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5 px-1",children:[e.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:[e.jsx("span",{className:"font-mono text-text-secondary",children:t.srcHash})," → ",e.jsx("span",{className:"font-mono text-text-secondary",children:t.destHash})]}),e.jsxs("span",{className:"text-[11px] text-text-muted font-sans",children:["· ",a]})]}),e.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:e.jsx("p",{className:"text-sm text-white font-sans leading-relaxed whitespace-pre-wrap break-words",children:t.text})})]})}function Pt({decoded:t,timestamp:s}){const a=s?S(s):"Unknown",n=(t.partNumber+1)/t.totalParts*100;return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-yellow-500/10 dark:bg-yellow-400/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.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:e.jsx(he,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text-primary font-sans truncate leading-tight",children:"Multipart Segment"}),e.jsxs("p",{className:"text-sm text-text-muted font-sans mt-0.5",children:["Part ",t.partNumber+1," of ",t.totalParts]})]})]}),e.jsx("div",{className:"mx-4 border-t border-border-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-3",children:[e.jsx("div",{children:e.jsx("div",{className:"h-2 bg-subtle-fill-strong rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${n}%`,background:"linear-gradient(90deg, var(--sys-yellow), var(--sys-amber))"}})})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ue,{className:"w-4 h-4 text-yellow-600 dark:text-yellow-400 flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-text-secondary font-sans",children:["Message ID: ",e.jsx("span",{className:"font-mono",children:t.messageId})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(H,{className:"w-4 h-4 text-yellow-600 dark:text-yellow-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-text-secondary font-sans",children:a})]})]})]})})}function Mt({decoded:t,timestamp:s,payloadType:a}){const n=s?S(s):"Unknown",r=(()=>{switch(a){case k.REQ:return{icon:_,gradient:"var(--sys-orange), var(--sys-red)",bg:"rgba(249, 115, 22, 0.15)",label:"Request"};case k.RESPONSE:return{icon:Se,gradient:"var(--sys-green), var(--sys-teal)",bg:"rgba(34, 197, 94, 0.15)",label:"Response"};case k.ANON_REQ:return{icon:Ce,gradient:"var(--sys-purple), var(--sys-pink)",bg:"rgba(168, 85, 247, 0.15)",label:"Anonymous Request"};default:return{icon:ae,gradient:"var(--sys-gray), var(--sys-slate)",bg:"rgba(107, 114, 128, 0.15)",label:t.payloadTypeName}}})(),l=r.icon;return e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-md",style:{background:`linear-gradient(135deg, ${r.gradient})`},children:e.jsx(l,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-text-primary font-sans",children:r.label}),e.jsxs("p",{className:"text-xs text-text-muted font-sans mt-0.5",children:[t.length," bytes · ",n]})]})]})}function _t({pathHex:t}){if(!t)return null;const s=it(t);return e.jsx("div",{className:"flex flex-wrap items-center gap-2 py-2",children:s.map((t,s)=>e.jsxs("div",{className:"flex items-center gap-2",children:[s>0&&e.jsx(Ne,{className:"w-4 h-4 text-sys-amber flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(pe,{size:"compact",copy:!0,children:t.toUpperCase()}),e.jsx("span",{className:"text-[10px] text-text-muted font-sans tabular-nums w-4 text-left",children:s+1})]})]},s))})}function Tt({decoded:t,payloadType:s}){const a=C[s]||`TYPE_${s}`;switch(t.type){case"advert":{const s="chat"===t.nodeType?"companion":t.nodeType.replace("_"," "),a=void 0!==t.latitude&&void 0!==t.longitude&&!(0===t.latitude&&0===t.longitude);return e.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Role:"})," ",s]}),t.name&&e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Name:"})," ",t.name]}),a&&e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Location:"})," ",t.latitude.toFixed(4),"°, ",t.longitude.toFixed(4),"°"]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Time:"})," ",S(t.timestamp)]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Flags:"})," ",t.flagsDescription]})]})}case"ack":return e.jsx("div",{className:"text-xs text-text-primary space-y-0.5",children:e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"CRC:"})," 0x",t.crc]})});case"path":return e.jsx("div",{className:"text-xs text-text-primary space-y-1",children:e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Path:"})," ",t.pathString||"(empty)"]})});case"trace":return e.jsxs("div",{className:"text-xs text-text-primary space-y-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Tag:"})," 0x",t.traceTag]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Target Path:"})," ",t.pathString||"(empty)"]}),t.snrValues.length>0&&e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"SNR:"})," ",t.snrValues.map(e=>`${e>=0?"+":""}${Number.isInteger(e)?e:e.toFixed(1)}dB`).join(" → ")]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Status:"})," ",t.isComplete?"✓ Complete":`In progress (${t.snrValues.length}/${t.pathHashes.length})`]})]});case"txt_msg":return e.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Dest:"})," ",t.destHash]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Src:"})," ",t.srcHash]}),t.encrypted?e.jsx("p",{className:"text-text-muted italic",children:"Encrypted content"}):e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Text:"})," ",t.text]})]});case"grp_txt":return e.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Channel:"})," ",t.channelName?e.jsx("span",{className:"text-accent-success",children:t.channelName}):t.isPublicHashChannel?e.jsx("span",{className:"text-accent-secondary",children:"Public Hash Channel"}):e.jsxs("span",{className:"font-mono",children:["0x",t.channelHash]})]}),t.decrypted?e.jsxs(e.Fragment,{children:[t.senderName&&e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"From:"})," ",t.senderName]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Text:"})," ",t.text]})]}):t.isPublicHashChannel?e.jsx("p",{className:"text-text-muted italic",children:"Encrypted (public hash channel)"}):e.jsx("p",{className:"text-text-muted italic",children:"Encrypted (unknown channel)"})]});case"grp_data":return e.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Channel:"})," ",t.channelName?e.jsx("span",{className:"text-sys-teal",children:t.channelName}):e.jsxs("span",{className:"font-mono",children:["0x",t.channelHash]})]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Data:"})," ",t.dataLength," bytes ",t.decrypted?"(decrypted)":"(encrypted)"]})]});case"multipart":return e.jsxs("div",{className:"text-xs text-text-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Part:"})," ",t.partNumber+1,"/",t.totalParts]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-text-muted",children:"Message ID:"})," ",t.messageId]})]});default:return e.jsxs("p",{className:"text-xs text-text-secondary",children:[a," (",t.length," bytes)"]})}}const Bt=s.memo(function({packet:t,decodedGrpTxt:a}){var n,r;const l=t.raw_packet||"",i=l.length/2,c=j(),[o,m]=s.useState(null),[h,u]=s.useState(null),[g,f]=s.useState(!1),[b,y]=s.useState(null),w=s.useCallback(e=>{y(t=>t===e?null:e)},[]),C=s.useMemo(()=>function(e){if(!e||e.length<4)return null;const t=W.fromHex(e);if(!t.success||!t.packet)return null;const s=t.packet,a=function(e){const t=3&e,s=e>>2&15,a=e>>6&3;return[{bits:"0-1",field:"Route Type",value:d(t),binary:(3&t).toString(2).padStart(2,"0")},{bits:"2-5",field:"Payload Type",value:x(s),binary:(15&s).toString(2).padStart(4,"0")},{bits:"6-7",field:"Version",value:a.toString(),binary:(3&a).toString(2).padStart(2,"0")}]}(s.header),n=e.slice(0,2);let r=2,l="";s.hasTransportCodes()&&(l=e.slice(2,10),r=10);const i=e.slice(r,r+2),c=r+2,o=c+2*s.pathLen,m=e.slice(c,o),p=e.slice(o),h=G(s);return{packet:s,headerHex:n,headerFields:a,transportCodesHex:l,pathLengthHex:i,pathDataHex:m,payloadHex:p,payloadStartByte:Math.floor(o/2),decoded:h}}(l),[l]),H=null==(n=null==C?void 0:C.packet)?void 0:n.payloadType,P=(null==C?void 0:C.payloadHex)||"",M=null==(r=null==C?void 0:C.packet)?void 0:r.payload,_=H===k.GRP_TXT,T=H===k.GRP_DATA,B=_&&!a&&(!c||g);if(s.useEffect(()=>{if(m(null),f(!1),a)return;if(!_||!M||M.length<4)return;if(!c)return void f(!0);f(!0);let e=!1;return K(M).then(t=>{e||(m(t),f(!1))}),()=>{e=!0}},[P,_,c,a]),s.useEffect(()=>{if(u(null),!T||!M||M.length<4)return;if(!c)return;let e=!1;return Y(M).then(t=>{e||u(t)}),()=>{e=!0}},[P,T,c]),!C||0===l.length)return e.jsx("div",{className:"p-4 text-center text-text-muted",children:e.jsx("p",{className:"text-sm",children:"No raw packet data available"})});const{packet:F}=C;let L=C.decoded;a&&"grp_txt"===C.decoded.type?L=a:o&&"grp_txt"===C.decoded.type?L=o:h&&"grp_data"===C.decoded.type&&(L=h);const z=s.useMemo(()=>function(t,s){switch(t.type){case"advert":return function(t,s){const a=[];let n=0;const r=s.slice(0,64);a.push({id:"payload:publicKey",title:"Public Key",color:"pink",hex:r,startByte:n,endByte:n+31,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:t.publicKey.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Ed25519 public key (32 bytes)"})]})}),n+=32;const l=s.slice(64,72);a.push({id:"payload:timestamp",title:"Timestamp",color:"orange",hex:l,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:l.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:[t.timestamp," (",S(t.timestamp),")"]})]})}),n+=4;const i=s.slice(72,200);a.push({id:"payload:signature",title:"Signature",color:"teal",hex:i,startByte:n,endByte:n+63,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:t.signature.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Ed25519 signature (64 bytes)"})]})}),n+=64;const c=s.slice(200,202);if(a.push({id:"payload:flags",title:"Flags",color:"blue",hex:c,startByte:n,endByte:n,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(pe,{size:"standard",copy:!0,children:["0x",t.flags.toString(16).padStart(2,"0").toUpperCase()]}),e.jsx("p",{className:"text-xs text-text-primary mt-1",children:t.flagsDescription}),e.jsxs("p",{className:"text-xs text-text-muted",children:["Node Type: ",t.nodeType]})]})}),n+=1,void 0!==t.latitude){const r=s.slice(2*n,2*n+8);a.push({id:"payload:latitude",title:"Latitude",color:"green",hex:r,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:r.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:[t.latitude.toFixed(6),"°"]})]})}),n+=4}if(void 0!==t.longitude){const r=s.slice(2*n,2*n+8);a.push({id:"payload:longitude",title:"Longitude",color:"purple",hex:r,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:r.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:[t.longitude.toFixed(6),"°"]})]})}),n+=4}if(t.name){const r=s.slice(2*n),l=r.length/2;a.push({id:"payload:name",title:"Name",color:"amber",hex:r,startByte:n,endByte:n+l-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:r.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:['"',t.name,'"']})]})})}return a}(t,s);case"ack":return function(t,s){return[{id:"payload:crc",title:"CRC",color:"green",hex:s.slice(0,8),startByte:0,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(pe,{size:"standard",copy:!0,children:["0x",t.crc]}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"CRC32 of acknowledged packet"})]})}]}(t,s);case"grp_txt":return function(t,s){const a=[];a.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:s.slice(0,2),startByte:0,endByte:0,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(pe,{size:"standard",copy:!0,children:["0x",t.channelHash]}),t.channelName&&e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:["Channel: ",t.channelName]})]})}),t.macHex&&a.push({id:"payload:mac",title:"MAC",color:"purple",hex:s.slice(2,6),startByte:1,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:t.macHex.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=s.slice(6);return n&&a.push({id:"payload:ciphertext",title:t.decrypted?"Message":"Ciphertext",color:t.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:t.decrypted?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-text-primary",children:['"',t.text,'"']}),t.senderName&&e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:["From: ",t.senderName]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:n.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"AES-128-ECB encrypted"})]})}),a}(t,s);case"grp_data":return function(t,s){const a=[];a.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:s.slice(0,2),startByte:0,endByte:0,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(pe,{size:"standard",copy:!0,children:["0x",t.channelHash]}),t.channelName&&e.jsxs("p",{className:"text-xs text-text-primary mt-1",children:["Channel: ",t.channelName]})]})}),t.macHex&&a.push({id:"payload:mac",title:"MAC",color:"purple",hex:s.slice(2,6),startByte:1,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:t.macHex.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=s.slice(6);return n&&a.push({id:"payload:ciphertext",title:t.decrypted?"Decrypted Data":"Encrypted Data",color:t.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:(t.decryptedHex||n).toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[t.dataLength," bytes",t.decrypted?"":" (AES-128-ECB encrypted)"]})]})}),a}(t,s);case"path":return function(t,s){return[{id:"payload:path",title:"Path Hops",color:"amber",hex:s,startByte:0,endByte:s.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:t.path.map((t,s)=>e.jsxs("span",{className:"flex items-center gap-1",children:[s>0&&e.jsx(Ne,{className:"w-3 h-3 text-text-muted"}),e.jsx(p,{color:"amber",className:"font-mono",children:t})]},s))}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[t.path.length," hops"]})]})}]}(t,s);case"trace":return function(t,s){const a=[];a.push({id:"payload:crc",title:"Trace Tag",color:"blue",hex:s.slice(0,8),startByte:0,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(pe,{size:"standard",copy:!0,children:["0x",t.traceTag]}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Unique trace request identifier"})]})}),a.push({id:"payload:mac",title:"Auth Code",color:"purple",hex:s.slice(8,16),startByte:4,endByte:7,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:t.authCode}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Authentication/verification code"})]})}),a.push({id:"payload:flags",title:"Flags",color:"amber",hex:s.slice(16,18),startByte:8,endByte:8,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(pe,{size:"standard",copy:!0,children:["0x",t.flags.toString(16).toUpperCase().padStart(2,"0")]}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:0===t.flags?"No flags set":`Flags: ${t.flags.toString(2).padStart(8,"0")}b`})]})});const n=s.slice(18);if(n){const s=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:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:t.pathHashes.map((a,n)=>{const r=t.snrValues[n],l=void 0!==r?s(r):"zinc";return e.jsxs("span",{className:"flex items-center gap-1",children:[n>0&&e.jsx(Ne,{className:"w-3 h-3 text-text-muted"}),e.jsx(p,{color:"indigo",className:"font-mono",children:a}),void 0!==r&&e.jsxs(p,{color:l,className:"font-mono",children:[r>=0?"+":"",Number.isInteger(r)?r:r.toFixed(1),"dB"]})]},n)})}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[t.pathHashes.length," target ",1===t.pathHashes.length?"hop":"hops",t.snrValues.length>0&&` • ${t.snrValues.length} SNR ${1===t.snrValues.length?"value":"values"} collected`,t.isComplete&&" • ✓ Complete"]})]})})}return a}(t,s);case"multipart":return function(t,s){const a=[];a.push({id:"payload:msgId",title:"Message ID",color:"blue",hex:s.slice(0,4),startByte:0,endByte:1,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:t.messageId.toUpperCase()}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"Unique message identifier"})]})}),a.push({id:"payload:partNum",title:"Part Number",color:"amber",hex:s.slice(4,6),startByte:2,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:t.partNumber}),e.jsx("p",{className:"text-xs text-text-muted mt-1",children:"0-indexed part number"})]})}),a.push({id:"payload:totalParts",title:"Total Parts",color:"orange",hex:s.slice(6,8),startByte:3,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(pe,{size:"standard",copy:!0,children:t.totalParts}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:["Part ",t.partNumber+1," of ",t.totalParts]})]})});const n=s.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:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:n.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[n.length/2," bytes"]})]})}),a}(t,s);default:return[{id:"payload:ciphertext",title:"Raw Data",color:"zinc",hex:s,startByte:0,endByte:s.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-text-secondary break-all p-2 rounded bg-bg-body/50 font-mono",children:s.toUpperCase()}),e.jsxs("p",{className:"text-xs text-text-muted mt-1",children:[s.length/2," bytes"]})]})}]}}(L,C.payloadHex),[L,C.payloadHex]),D="payload"===b||ct(b),A=s.useMemo(()=>{const e=[{id:"header",hex:C.headerHex,color:"red"},...C.transportCodesHex?[{id:"transportCodes",hex:C.transportCodesHex,color:"purple"}]:[],{id:"pathLength",hex:C.pathLengthHex,color:"green"},...C.pathDataHex?[{id:"pathData",hex:C.pathDataHex,color:"amber"}]:[]];return D?[...e,...(t=z,t.map(e=>({id:e.id,hex:e.hex,color:e.color})))]:[...e,{id:"payload",hex:C.payloadHex,color:"cyan"}];var t},[C,D,z]);return e.jsxs("div",{className:"font-mono space-y-2 min-w-0 overflow-hidden",children:[(()=>{switch(L.type){case"advert":return e.jsx(vt,{advert:L,timestamp:t.timestamp});case"grp_data":return e.jsx(Nt,{decoded:L,timestamp:t.timestamp});case"grp_txt":return e.jsx(kt,{decoded:L,timestamp:t.timestamp,isLoading:B,onDecrypted:m});case"ack":return e.jsx(wt,{decoded:L,timestamp:t.timestamp});case"path":return e.jsx(Ct,{decoded:L,timestamp:t.timestamp});case"trace":return e.jsx(St,{decoded:L,timestamp:t.timestamp});case"txt_msg":return e.jsx(Ht,{decoded:L,timestamp:t.timestamp});case"multipart":return e.jsx(Pt,{decoded:L,timestamp:t.timestamp});case"generic":return F.payloadType===k.REQ||F.payloadType===k.RESPONSE||F.payloadType===k.ANON_REQ?e.jsx(Mt,{decoded:L,timestamp:t.timestamp,payloadType:F.payloadType}):null;default:return null}})(),e.jsx(bt,{rawHex:l,hexSegments:A,selectedSegment:b,onSegmentClick:w}),e.jsx(v,{children:e.jsx(N.div,{layout:!0,transition:ht,className:"space-y-2 min-w-0",children:(()=>{var t,s,a,n;const r=[{id:"header",title:"Header",color:"red",startByte:0,endByte:0,hexBytes:`0x${C.headerHex.toUpperCase()}`,condition:!0,content:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-text-muted border-b border-border-subtle font-sans",children:[e.jsx("th",{className:"py-1 font-medium",children:"Bits"}),e.jsx("th",{className:"py-1 font-medium",children:"Field"}),e.jsx("th",{className:"py-1 font-medium",children:"Value"}),e.jsx("th",{className:"py-1 font-medium",children:"Binary"})]})}),e.jsx("tbody",{children:C.headerFields.map(t=>e.jsx(yt,{...t},t.bits))})]})},{id:"transportCodes",title:"Transport Codes",color:"purple",startByte:1,endByte:4,hexBytes:(null==(t=C.transportCodesHex)?void 0:t.toUpperCase())||"",condition:!!C.transportCodesHex,content:e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-text-muted",children:"Two 16-bit transport codes for encrypted routing"}),e.jsxs("div",{className:"mt-1 text-xs text-text-secondary",children:["Code 1: 0x",null==(s=C.transportCodesHex)?void 0:s.slice(0,4).toUpperCase()," | Code 2: 0x",null==(a=C.transportCodesHex)?void 0:a.slice(4,8).toUpperCase()]})]})},{id:"pathLength",title:"Path Length",color:"green",startByte:C.transportCodesHex?5:1,endByte:C.transportCodesHex?5:1,hexBytes:`0x${C.pathLengthHex.toUpperCase()}`,condition:!0,content:e.jsxs("p",{className:"text-xs text-text-muted pt-1",children:[F.pathLen," bytes showing route taken (increases as packet floods)"]})},{id:"pathData",title:"Path Data",color:"amber",startByte:C.transportCodesHex?6:2,endByte:(C.transportCodesHex?5:1)+F.pathLen,hexBytes:(null==(n=C.pathDataHex)?void 0:n.toUpperCase())||"",condition:F.pathLen>0,content:e.jsxs("div",{className:"space-y-3",children:[e.jsx(_t,{pathHex:C.pathDataHex}),e.jsx("p",{className:"text-xs text-text-muted",children:"Historical route taken (bytes are added as packet floods through network)"})]})},{id:"payload",title:"Payload",color:"cyan",startByte:C.payloadStartByte,endByte:i-1,hexBytes:C.payloadHex.toUpperCase(),condition:!0,content:e.jsxs(e.Fragment,{children:[!ct(b)&&e.jsxs("div",{className:"p-3 rounded-lg bg-black",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted mb-1.5 font-sans",children:"Decoded"}),e.jsx(Tt,{decoded:L,payloadType:F.payloadType})]}),!ct(b)&&z.length>0&&e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted mt-3 font-sans",children:"Click a field below to highlight its bytes"}),ct(b)&&e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-text-muted font-sans",children:"↑ Selected field above • Other fields below ↓"})]})}].filter(e=>e.condition),l=ct(b)?z.find(e=>e.id===b):null,c=ct(b)?[...r].sort((e,t)=>"payload"===e.id?-1:"payload"===t.id?1:0):[...r].sort((e,t)=>e.id===b?-1:t.id===b?1:0),o=ct(b)?z.filter(e=>e.id!==b):[];return e.jsxs(e.Fragment,{children:[l&&e.jsx(jt,{id:`subfield-${l.id}`,title:l.title,color:l.color,startByte:C.payloadStartByte+l.startByte,endByte:C.payloadStartByte+l.endByte,hexBytes:l.hex.toUpperCase(),isSelected:!0,children:l.decoded},l.id),c.map(t=>e.jsx(jt,{id:`section-${t.id}`,title:t.title,color:t.color,startByte:t.startByte,endByte:t.endByte,hexBytes:t.hexBytes,isSelected:t.id===b,children:t.content},t.id)),o.map(t=>e.jsxs(N.div,{layout:"position",layoutId:`subfield-${t.id}`,transition:ht,className:"w-full min-w-0 overflow-hidden rounded-xl p-4 sm:p-5 space-y-4",style:{backgroundColor:xt,boxShadow:mt},children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 min-w-0",children:[e.jsx(p,{color:t.color,children:t.title}),t.hex.length<=32&&it(t.hex).map((s,a)=>e.jsx(p,{color:t.color,className:"font-mono",children:s.toUpperCase()},a))]}),e.jsxs("span",{className:"text-[10px] text-text-muted font-mono flex-shrink-0",children:["Bytes ",C.payloadStartByte+t.startByte,"-",C.payloadStartByte+t.endByte]})]}),e.jsx("div",{className:"min-w-0 overflow-hidden p-3 rounded-lg bg-black",children:t.decoded})]},t.id))]})})()})})]})});function Ft(e){if(!e)return[];if(Array.isArray(e))return e;try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Lt(e){return e?(e.startsWith("0x")?e.slice(2):e).slice(0,2).toUpperCase():""}function zt({hop:a,compact:n=!1,index:r=0,highlightIndex:l=-1,isTrace:i=!1}){var c;const o=r===l,d=Fe();return s.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]),e.jsxs(N.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:[e.jsxs(N.div,{className:t("flex items-center gap-1.5 px-2.5 py-1 rounded-md","font-mono text-xs font-semibold",a.isLocal?"bg-amber-500/20 text-amber-300 ring-1 ring-amber-500/30":"bg-zinc-700/50 text-zinc-200 ring-1 ring-zinc-600/50"),animate:d,initial:{boxShadow:"0 0 0 0px rgba(113, 156, 223, 0)"},children:[a.isLocal&&e.jsx(je,{className:"w-3 h-3"}),e.jsx("span",{children:a.prefix}),void 0!==a.confidence&&a.confidence<.9&&e.jsxs("span",{className:"text-[9px] opacity-70",children:[(100*a.confidence).toFixed(0),"%"]})]}),!n&&(null==(c=a.neighborInfo)?void 0:c.name)&&e.jsx("span",{className:"text-[10px] text-text-muted truncate max-w-[80px]",children:a.neighborInfo.name})]})}function Dt({snr:t}){const s=B(t),a=T()[s]||"#6b7280",n=Number.isInteger(t)?t.toString():t.toFixed(1);return e.jsxs(p,{customColor:a,compact:!0,className:"font-mono",children:[t>=0?"+":"",n,"dB"]})}function At({hops:a,compact:n,isTrace:r=!1}){const[l,i]=s.useState(-1);return s.useEffect(()=>{if(0===a.length)return;const e=setTimeout(()=>{i(0)},400),t=setInterval(()=>{i(e=>{const s=e+1;return s>=a.length?(clearInterval(t),-1):s})},r?500:600);return()=>{clearTimeout(e),clearInterval(t)}},[a.length,r]),e.jsx("div",{className:"p-6",style:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"4px 8px"},children:a.map((s,i)=>{const c=i%2==0,o=i===a.length-1;return e.jsxs("div",{className:"contents",children:[e.jsx("div",{className:t("flex items-center","justify-end"),children:c&&e.jsx(zt,{hop:s,compact:n,index:i,highlightIndex:l,isTrace:r})}),e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[28px]",children:!o&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px flex-1 bg-zinc-600/40 min-h-[8px]"}),void 0!==s.snr&&e.jsx(Dt,{snr:s.snr}),e.jsx("svg",{className:"w-3 h-3 text-zinc-500 flex-shrink-0",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M6 2v8M3 7l3 3 3-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})}),e.jsx("div",{className:t("flex items-center","justify-start"),children:!c&&e.jsx(zt,{hop:s,compact:n,index:i,highlightIndex:l,isTrace:r})})]},`${s.prefix}-${i}`)})})}const Et=s.memo(function({packet:a,neighbors:n,localHash:r,neighborAffinity:l,ghostPrefixes:i,direction:c="horizontal",compact:o=!1,traceSnr:d,overridePath:x}){const m=void 0!==d&&d.length>0,p=Ft(a.original_path),h=Ft(a.forwarded_path),u=x??(h.length>0?h:p),g=Lt(r),f=s.useMemo(()=>u.map((e,t)=>{const s=e.toUpperCase(),a=s===g,r=(null==i?void 0:i.has(s))??!1,c=function(e,t,s){const a=e.toUpperCase();if(s){let e=null,n=0;if(s.forEach((t,s)=>{if(Lt(s)===a){const a=t.combinedScore??0;a>n&&(n=a,e=s)}}),e&&t[e])return{hash:e,info:t[e],confidence:n}}for(const[n,r]of Object.entries(t))if(Lt(n)===a)return{hash:n,info:r,confidence:void 0};return null}(s,n,l);return{prefix:s,fullHash:null==c?void 0:c.hash,neighborInfo:null==c?void 0:c.info,isLocal:a,isGhost:r,confidence:null==c?void 0:c.confidence,snr:null==d?void 0:d[t]}}),[u,n,l,g,i,d]);if(0===f.length)return e.jsxs("div",{className:"flex items-center gap-2 text-text-muted text-xs",children:[e.jsx(M,{className:"w-4 h-4 opacity-50"}),e.jsx("span",{children:"Direct / No path data"})]});if("flowchart"===c)return e.jsx(At,{hops:f,compact:o,isTrace:m});const b="horizontal"===c?Ne:ce;return e.jsx("div",{className:t("flex gap-1.5","horizontal"===c?"flex-row flex-wrap items-center":"flex-col items-start"),children:f.map((s,a)=>e.jsxs("div",{className:t("flex items-center gap-1.5","vertical"===c&&"flex-col"),children:[e.jsx(zt,{hop:s,compact:o}),a0,i=al&&n(a-1),disabled:!l,className:t("p-0.5 radius-badge transition-base",l?"text-text-muted hover:text-text-primary hover-bg":"text-text-muted cursor-not-allowed"),"aria-label":"Previous observation",children:e.jsx(ke,{className:r?"size-3":"size-4"})}),e.jsx("div",{className:"flex items-center gap-0.5",children:s.map((s,l)=>{const i=l===a,c=new Date(1e3*s.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});return e.jsx(I,{color:i?"cyan":"zinc",filled:i,compact:r,onClick:()=>n(l),title:`Observation ${l+1} at ${c}`,className:t("transition-all duration-150",!i&&"opacity-60 hover:opacity-100"),children:r?e.jsx("span",{className:"tabular-nums",children:l+1}):e.jsxs("span",{className:"tabular-nums text-[10px]",children:["#",l+1,null!=s.rssi&&e.jsx("span",{className:"ml-1 opacity-70",children:s.rssi})]})},`${s.timestamp}_${l}`)})}),e.jsx("button",{onClick:()=>i&&n(a+1),disabled:!i,className:t("p-0.5 radius-badge transition-base",i?"text-text-muted hover:text-text-primary hover-bg":"text-text-muted cursor-not-allowed"),"aria-label":"Next observation",children:e.jsx(de,{className:r?"size-3":"size-4"})}),e.jsxs("span",{className:t("text-text-muted ml-1",r?"text-[9px]":"text-[10px]"),children:[e.jsx(oe,{className:"inline size-3 mr-0.5 opacity-50"}),s.length]})]})}function It({icon:s,label:a,disabled:n=!1}){return e.jsx(N.div,{className:"flex items-center gap-1 text-[10px]",title:a,animate:{opacity:n?.25:.6},transition:{duration:.15,ease:[.4,0,.2,1]},children:e.jsx("span",{className:t("flex items-center justify-center size-5 radius-badge border-control transition-base",n?"bg-subtle-fill border-border-subtle":"bg-subtle-fill"),children:s})})}function $t({hasDuplicates:t,hasPrev:s,hasNext:a,canPrevDupe:n,canNextDupe:r}){return e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(It,{icon:e.jsx(re,{className:"size-3"}),label:"Previous packet (↑)",disabled:!s}),e.jsx(It,{icon:e.jsx($,{className:"size-3"}),label:"Next packet (↓)",disabled:!a})]}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-3 bg-subtle-fill-strong"}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(It,{icon:e.jsx(ke,{className:"size-3"}),label:"Previous observation (←)",disabled:!n}),e.jsx(It,{icon:e.jsx(de,{className:"size-3"}),label:"Next observation (→)",disabled:!r})]})]})]})}const Vt=s.memo(function({packets:t,initialIndex:a=0,onClose:n,onNavigatePrev:r,onNavigateNext:l,hasPrev:i=!1,hasNext:c=!1}){const[o,d]=s.useState(a),x=t[o]??t[0],h=t.length>1,u=o>0,b=o{d(Math.max(0,Math.min(e,t.length-1)))},[t.length]);s.useEffect(()=>{const e=e=>{if(!(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement))switch(e.key){case"ArrowUp":e.preventDefault(),null==r||r();break;case"ArrowDown":e.preventDefault(),null==l||l();break;case"ArrowLeft":e.preventDefault(),u&&d(e=>e-1);break;case"ArrowRight":e.preventDefault(),b&&d(e=>e+1)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,l,u,b]);const j=F(),v=L(),w=z(),C=D(),S=s.useMemo(()=>new Set(C.map(e=>e.prefix.toUpperCase())),[C]),P=x.payload_type_name||g(x.payload_type??x.type),_=x.route_type_name||f(x.route_type??x.route),T=x.payload_length??x.length??0,B=Rt(x.original_path),I=Rt(x.forwarded_path),$=B.length>0||I.length>0,V=I.length>0?I:B,O=s.useMemo(()=>{var e;if(null==(e=null==j?void 0:j.config)?void 0:e.repeater)return{latitude:j.config.repeater.latitude,longitude:j.config.repeater.longitude,name:j.config.node_name||"Local Node"}},[j]),Q=(null==j?void 0:j.neighbors)??{},W=w.size>0?w:void 0,G=x.raw_packet&&x.raw_packet.length>0,K=s.useMemo(()=>{if((x.payload_type??x.type)!==k.TRACE||!x.payload)return null;try{const e=m(x.payload),t=x.original_path||x.forwarded_path||[];let s=[];if("string"==typeof t)try{const e=JSON.parse(t);Array.isArray(e)&&(s=e.map(e=>parseInt(e,16)))}catch{s=[]}else Array.isArray(t)&&(s=t.map(e=>parseInt(e,16)));return q(e,s)}catch{return null}},[x]),Y=null==K?void 0:K.snrValues,X=s.useMemo(()=>{if((x.payload_type??x.type)!==k.ADVERT||!x.payload)return null;try{const e=m(x.payload),t=J(e);if(!t)return null;const s=t.publicKey.slice(0,2).toUpperCase();return{...t,prefix:s}}catch{return null}},[x]),ee=s.useMemo(()=>{if((null==X?void 0:X.latitude)&&(null==X?void 0:X.longitude))return{latitude:X.latitude,longitude:X.longitude,name:X.name||`Node ${X.prefix||"??"}`,prefix:X.prefix,publicKey:X.publicKey}},[X]),se=e=>e&&0!==e?new Date(1e3*e).toLocaleString():"Unknown",ae=A(x.packet_hash),re=s.useMemo(()=>{if((x.payload_type??x.type)!==k.GRP_TXT)return null;if(!(null==ae?void 0:ae.decoded))return null;const e=ae.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,ae]),le=s.useCallback(e=>{if(!e)return null;const t=e.trim().match(/(-?\d+\.?\d*)\s*[,\s]\s*(-?\d+\.?\d*)/);if(!t)return null;const s=parseFloat(t[1]),a=parseFloat(t[2]);return isNaN(s)||isNaN(a)||s<-90||s>90||a<-180||a>180||0===s&&0===a?null:{lat:s,lon:a}},[]),ie=s.useMemo(()=>{var e,t;if(!(null==re?void 0:re.decrypted))return;if(!(null==(e=re.channelName)?void 0:e.toLowerCase().includes("wardrive")))return;const s=le(re.text);return s?{latitude:s.lat,longitude:s.lon,name:re.senderName||"Wardrive Ping",prefix:(null==(t=re.senderName)?void 0:t.slice(0,2).toUpperCase())||"WD",nodeType:"wardrive"}:void 0},[re,le]),ce=(x.payload_type??x.type)===k.ADVERT&&(void 0!==ee||$),oe=void 0!==ie,de=ee??ie;if(0===V.length)return null;const me=(null==j?void 0:j.local_hash)?(j.local_hash.startsWith("0x")?j.local_hash.slice(2,4):j.local_hash.slice(0,2)).toUpperCase():"";for(const e of V){const t=e.toUpperCase();if(t!==me)if(W){let e=0,s=0;if(W.forEach((a,n)=>{(n.startsWith("0x")?n.slice(2,4):n.slice(0,2)).toUpperCase()===t&&(e++,s=Math.max(s,a.combinedScore??0))}),0===e)for(const a of Object.keys(Q))if((a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase()===t)break}else for(const e of Object.keys(Q))if((e.startsWith("0x")?e.slice(2,4):e.slice(0,2)).toUpperCase()===t)break}const pe={lime:"rgb(132, 204, 22)",cyan:"rgb(34, 211, 238)",amber:"rgb(251, 191, 36)",violet:"rgb(167, 139, 250)",rose:"rgb(251, 113, 133)",emerald:"rgb(52, 211, 153)",sky:"rgb(56, 189, 248)",orange:"rgb(251, 146, 60)",pink:"rgb(244, 114, 182)",zinc:"rgb(161, 161, 170)",purple:"rgb(168, 85, 247)",indigo:"rgb(129, 140, 248)",teal:"rgb(45, 212, 191)",fuchsia:"rgb(232, 121, 249)",blue:"rgb(59, 130, 246)",green:"rgb(34, 197, 94)",yellow:"rgb(250, 204, 21)",red:"rgb(239, 68, 68)"},he=pe[te[P]??"zinc"]||pe.zinc;return e.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:[e.jsxs("div",{className:"sm:hidden",children:[e.jsx("div",{className:"flex justify-center pt-2 pb-1",children:e.jsx("div",{className:"w-9 h-1 rounded-full bg-text-muted","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-center justify-between px-3 pb-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(p,{color:te[P]??"zinc",className:"!text-[9px] !px-1.5 !py-0",children:P}),e.jsx(p,{color:"DIRECT"===_||"T_DIRECT"===_?"cyan":"amber",className:"!text-[9px] !px-1.5 !py-0",children:_}),e.jsxs(p,{color:"zinc",className:"!text-[9px] !px-1.5 !py-0",children:[T,"B"]})]}),e.jsx("button",{onClick:n,className:"px-3 py-1.5 text-[15px] font-medium text-blue-400 active:text-blue-300 transition-base flex-shrink-0 radius-inner active:bg-subtle-fill",children:"Done"})]}),h&&e.jsx("div",{className:"px-3 pb-2",children:e.jsx(Ut,{packets:t,selectedIndex:o,onSelect:y,compact:!0})})]}),e.jsx("div",{className:"hidden sm:block px-6 pt-5 pb-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{color:te[P]??"zinc",children:P}),e.jsx(p,{color:"DIRECT"===_||"T_DIRECT"===_?"cyan":"amber",children:_}),e.jsxs(p,{color:"zinc",children:[T,"B"]}),h&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-4 bg-subtle-fill-strong"}),e.jsx(Ut,{packets:t,selectedIndex:o,onSelect:y})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx($t,{hasDuplicates:h,hasPrev:i,hasNext:c,canPrevDupe:u,canNextDupe:b}),e.jsx("button",{onClick:n,className:"p-1.5 -m-1.5 text-text-muted hover:text-text-primary transition-base radius-inner hover:bg-bg-elevated flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}),e.jsx("div",{className:"sm:hidden h-[2px]",style:{backgroundColor:he,opacity:.6}}),e.jsxs(R,{className:"p-0 overflow-hidden flex-1 flex flex-col min-h-0",children:[e.jsx("div",{className:"md:hidden flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxs("div",{className:"p-2 space-y-2",children:[(null!=x.rssi||null!=x.snr)&&e.jsxs("div",{className:"relative flex items-center justify-between px-2 py-1.5 radius-inner bg-subtle-fill",children:[e.jsx(U,{mode:"popLayout",initial:!1,children:e.jsxs(N.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:[e.jsx(Z,{rssi:x.rssi,snr:x.snr,compact:!0,showValues:!0}),e.jsx("span",{className:"text-[11px] text-text-muted",children:ne(x.rssi)})]},o)}),V.length>0&&e.jsxs("span",{className:"text-[10px] font-mono text-text-muted",children:[V.length," hop",1!==V.length?"s":""]})]}),($&&V.length>0||ce||oe)&&e.jsx("div",{className:"overflow-hidden radius-inset",children:e.jsx("div",{className:"aspect-[4/3] w-full",children:e.jsx(lt,{path:V,neighbors:Q,localNode:O,localHash:null==j?void 0:j.local_hash,srcHash:x.src_hash,dstHash:x.dst_hash,neighborAffinity:W,hubNodes:[...v],traceSnr:Y,advertiserSource:de})})}),K&&K.pathHashes.length>0&&e.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[e.jsx("div",{className:"px-3 py-2 space-y-1.5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] font-medium text-text-muted uppercase tracking-wide",children:"Trace Route"}),e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx(p,{color:K.isComplete?"green":"amber",compact:!0,children:K.isComplete?"Complete":"In Progress"})})]})}),e.jsx(Et,{packet:x,neighbors:Q,localHash:null==j?void 0:j.local_hash,neighborAffinity:W,ghostPrefixes:S,direction:"flowchart",compact:!0,overridePath:K.pathHashes,traceSnr:K.snrValues})]}),$&&!K&&e.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[e.jsx("span",{className:"text-[10px] font-medium text-text-muted uppercase tracking-wide",children:"Path"}),e.jsxs(p,{color:"zinc",compact:!0,children:[V.length," hop",1!==V.length?"s":""]})]}),e.jsx(Et,{packet:x,neighbors:Q,localHash:null==j?void 0:j.local_hash,neighborAffinity:W,ghostPrefixes:S,direction:"flowchart",compact:!0,traceSnr:Y})]}),X&&e.jsxs("div",{className:"radius-inset bg-subtle-fill overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border-subtle",children:[e.jsx("span",{className:"text-[10px] font-medium text-text-muted uppercase tracking-wide",children:"Advertiser Info"}),e.jsx(p,{color:"lime",compact:!0,children:X.nodeType})]}),e.jsxs("div",{className:"p-3 space-y-2",children:[X.name&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_e,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:X.name})]}),X.latitude&&X.longitude&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),e.jsxs("span",{className:"text-xs font-mono text-text-secondary",children:[X.latitude.toFixed(5),", ",X.longitude.toFixed(5)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(He,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),e.jsxs("span",{className:"text-[10px] font-mono text-text-muted truncate",children:[X.publicKey.slice(0,16),"...",X.publicKey.slice(-8)]})]}),X.timestamp>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-xs text-text-muted",children:se(X.timestamp)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-3.5 h-3.5 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-[10px] text-text-muted",children:X.flagsDescription||`Flags: 0x${X.flags.toString(16).padStart(2,"0")}`})]})]})]}),G&&e.jsx("div",{className:"pt-1",children:e.jsx(Bt,{packet:x,decodedGrpTxt:re})})]})}),e.jsxs("div",{className:"hidden md:grid md:grid-cols-2 flex-1 overflow-hidden",children:[e.jsx("div",{className:"overflow-y-auto overflow-x-hidden scrollbar-none p-4 border-r border-border-subtle",children:G&&e.jsx(Bt,{packet:x,decodedGrpTxt:re})}),e.jsxs("div",{className:"grid overflow-hidden",style:{gridTemplateRows:"minmax(280px, 1fr) auto"},children:[e.jsx("div",{className:"overflow-hidden p-2",children:$&&V.length>0||ce||oe?e.jsx("div",{className:"h-full w-full",children:e.jsx(lt,{path:V,neighbors:Q,localNode:O,localHash:null==j?void 0:j.local_hash,srcHash:x.src_hash,dstHash:x.dst_hash,neighborAffinity:W,hubNodes:[...v],traceSnr:Y,advertiserSource:de})}):e.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center text-center px-4",children:[e.jsx(M,{className:"w-8 h-8 text-text-muted/50 mb-2"}),e.jsx("span",{className:"text-sm text-text-muted",children:"Direct Reception"}),e.jsx("span",{className:"text-xs text-text-muted/70 mt-1",children:"Zero-hop packet — received directly from sender"})]})}),e.jsxs("div",{className:"overflow-y-auto max-h-[200px] p-2 space-y-2",children:[!K&&V.length<=1&&(null!=x.rssi||null!=x.snr)&&e.jsx("div",{className:"surface-base radius-inset p-4",children:e.jsxs("dl",{className:"text-xs grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-text-muted mb-1",children:"Signal"}),e.jsx(U,{mode:"popLayout",initial:!1,children:e.jsxs(N.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:[e.jsx(Z,{rssi:x.rssi,snr:x.snr}),e.jsx("span",{className:"font-medium text-text-primary",children:ne(x.rssi)})]},o)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-text-muted mb-1",children:"RF"}),e.jsx(U,{mode:"popLayout",initial:!1,children:e.jsxs(N.dd,{className:"font-mono text-text-secondary tabular-nums",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)})]})]})}),X&&e.jsxs("div",{className:"radius-inset bg-subtle-fill overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border-subtle",children:[e.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Advertiser"}),e.jsx(p,{color:"lime",compact:!0,children:X.nodeType})]}),e.jsxs("div",{className:"p-4 space-y-2.5",children:[X.name&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_e,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-sm font-medium text-text-primary truncate",children:X.name})]}),X.latitude&&X.longitude&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),e.jsxs("span",{className:"text-xs font-mono text-text-secondary",children:[X.latitude.toFixed(5),", ",X.longitude.toFixed(5)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(He,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),e.jsxs("span",{className:"text-[11px] font-mono text-text-muted truncate",children:[X.publicKey.slice(0,16),"...",X.publicKey.slice(-8)]})]}),X.timestamp>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-xs text-text-muted",children:se(X.timestamp)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-[11px] text-text-muted",children:X.flagsDescription||`Flags: 0x${X.flags.toString(16).padStart(2,"0")}`})]})]})]}),K&&K.pathHashes.length>0&&e.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-2 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Trace Route"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(p,{color:K.isComplete?"green":"amber",compact:!0,children:K.isComplete?"Complete":"In Progress"}),e.jsxs(p,{color:"teal",compact:!0,children:[K.pathHashes.length,"h"]})]})]}),e.jsx(Et,{packet:x,neighbors:Q,localHash:null==j?void 0:j.local_hash,neighborAffinity:W,ghostPrefixes:S,direction:"flowchart",compact:!0,overridePath:K.pathHashes,traceSnr:K.snrValues})]}),$&&!K&&e.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2",children:[e.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Path"}),e.jsxs(p,{color:"zinc",compact:!0,children:[V.length,"h"]})]}),e.jsx(Et,{packet:x,neighbors:Q,localHash:null==j?void 0:j.local_hash,neighborAffinity:W,ghostPrefixes:S,direction:"flowchart",compact:!0,traceSnr:Y})]})]})]})]})]})]})});function Ot({label:t,numericValue:s,unit:a,icon:n,subtext:r,showSign:l=!1}){return e.jsxs("div",{className:"radius-inner p-3 sm:radius-inset sm:p-4 bg-subtle-fill ring-1 ring-inset ring-border-subtle",children:[e.jsx("div",{className:"mb-1.5 sm:mb-2",children:e.jsx("span",{className:"text-[10px] sm:text-[11px] font-medium uppercase tracking-wide text-text-muted",children:t})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ve,{value:s,format:{minimumFractionDigits:1,maximumFractionDigits:1,signDisplay:l?"always":"auto"},className:"font-mono text-xl sm:text-2xl font-semibold tabular-nums tracking-tight text-text-primary"}),e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsx(n,{className:"w-[14px] h-[14px] text-text-muted"}),a&&e.jsx("span",{className:"text-[10px] sm:text-xs font-medium leading-tight text-text-muted",children:a})]})]}),r&&e.jsx("p",{className:"mt-1.5 sm:mt-2 font-mono text-[10px] sm:text-[11px] text-text-muted/80 truncate",children:r})]})}function Qt({snr:s}){const a=s>=5?"bg-sys-teal":s>=0?"bg-sys-green":s>=-5?"bg-sys-amber":s>=-10?"bg-sys-orange":"bg-sys-red";return e.jsx("span",{className:t("w-1.5 h-1.5 rounded-full flex-shrink-0",a),title:`SNR: ${s.toFixed(1)} dB`})}function Wt({fromPrefix:s,toPrefix:a,fromName:n,toName:r,snr:l,maxSnr:i,isWeakest:c,isStrongest:o,index:d=0}){const x=Math.max(i+5,15),m=Math.max(0,Math.min(100,(l- -20)/(x- -20)*100)),h="bg-[#0074BE]",u=l>=5?"bg-sys-teal":l>=0?"bg-sys-green":l>=-5?"bg-sys-amber":l>=-10?"bg-sys-orange":"bg-sys-red",g=.3+.15*d;return e.jsxs("div",{className:"relative p-3 pl-5 radius-inner bg-subtle-fill ring-1 ring-inset ring-border-subtle",children:[e.jsx("span",{className:t("absolute left-0 top-1/2 -translate-y-1/2 h-4 w-0.5 rounded-full",u)}),e.jsx("span",{className:"absolute -top-0.5 -right-0.5",children:e.jsx(Qt,{snr:l})}),e.jsxs("div",{className:"sm:hidden",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx("span",{className:"text-[13px] font-medium text-text-secondary truncate",children:n||s}),e.jsx(Ne,{className:"w-3 h-3 text-text-muted flex-shrink-0"}),e.jsx("span",{className:"text-[13px] font-semibold text-text-primary truncate",children:r||a})]}),e.jsxs("div",{className:"flex items-center gap-1.5 ml-2 flex-shrink-0",children:[c&&e.jsx(p,{color:"red",compact:!0,children:"Low"}),o&&!c&&e.jsxs(p,{color:"amber",compact:!0,children:[e.jsx(Me,{className:"w-2.5 h-2.5"}),"Best"]}),e.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-text-primary ring-1 ring-inset ring-border-subtle",children:[l>=0?"+":"−",Math.abs(l).toFixed(1)]})]})]}),e.jsx("div",{className:"h-1.5 bg-subtle-fill-strong rounded-full overflow-hidden",children:e.jsx(N.div,{className:t("h-full rounded-full",h),initial:{width:0},animate:{width:`${m}%`},transition:{duration:1.5,delay:g,ease:[.25,.1,.25,1]}})})]}),e.jsxs("div",{className:"hidden sm:block",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("code",{className:"font-mono text-xs text-text-muted",children:s}),n&&e.jsx("span",{className:"text-xs text-text-secondary truncate max-w-[100px]",children:n})]}),e.jsx(Ne,{className:"w-3 h-3 text-text-muted/40 flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("code",{className:"font-mono text-xs font-semibold text-text-primary",children:a}),r&&e.jsx("span",{className:"text-xs text-text-secondary truncate max-w-[100px]",children:r})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[c&&e.jsx(p,{color:"red",compact:!0,children:"Bottleneck"}),o&&!c&&e.jsxs(p,{color:"amber",compact:!0,children:[e.jsx(Me,{className:"w-3 h-3"}),"Strongest"]}),e.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-text-primary ring-1 ring-inset ring-border-subtle",children:[l>=0?"+":"−",Math.abs(l).toFixed(1)]})]})]}),e.jsx("div",{className:"h-1.5 bg-bg-elevated rounded-full overflow-hidden",children:e.jsx(N.div,{className:t("h-full rounded-full",h),initial:{width:0},animate:{width:`${m}%`},transition:{duration:1.5,delay:g,ease:[.25,.1,.25,1]}})})]})]})}function Gt(e,t){if("You"===e)return"You";const s=e.toUpperCase();for(const[a,n]of Object.entries(t))if((a.startsWith("0x")?a.slice(2,4):a.slice(0,2)).toUpperCase()===s)return n.name||n.node_name||void 0}const qt=s.memo(function({report:t,onClose:s}){var a,n;const r=F(),l=(null==r?void 0:r.neighbors)??{},i=(null==(a=null==r?void 0:r.config)?void 0:a.repeater)?{latitude:r.config.repeater.latitude,longitude:r.config.repeater.longitude,name:r.config.node_name||"Local Node"}:void 0,c=null==(n=t.bestObservation)?void 0:n.decoded.snrValues,o=t.linkQuality?t.linkQuality.avgSnr>=5?"excellent":t.linkQuality.avgSnr>=0?"good":t.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(--text-muted)"}[o];return e.jsxs(E,{open:!0,onClose:s,size:"5xl",motionPlus:!0,children:[e.jsxs("div",{className:"sm:hidden",children:[e.jsx("div",{className:"flex justify-center pt-2 pb-1",children:e.jsx("div",{className:"w-9 h-1 rounded-full bg-text-primary/30","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-center justify-between px-4 pb-2",children:[e.jsx("h2",{className:"font-semibold text-[17px] text-text-primary",children:"Trace Report"}),e.jsx("button",{onClick:s,className:"text-[17px] font-medium text-blue-400 active:text-blue-300",children:"Done"})]})]}),e.jsx("div",{className:"sm:hidden h-[2px]",style:{backgroundColor:d,opacity:.6}}),e.jsx("div",{className:"hidden sm:block px-6 pt-5 pb-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:[e.jsx("h2",{className:"text-base sm:text-lg font-semibold text-text-primary",children:"Trace Report"}),e.jsxs(p,{color:"excellent"===o||"good"===o?"green":"fair"===o?"amber":"red",children:[e.jsx(Pe,{className:"w-3 h-3 mr-1"}),"excellent"===o?"Excellent":"good"===o?"Good":"fair"===o?"Fair":"Poor"]})]}),e.jsx("p",{className:"mt-1 text-xs sm:text-sm font-mono text-text-muted tabular-nums",children:t.traceTag})]}),e.jsx("button",{onClick:s,className:"p-1.5 -m-1.5 text-text-muted hover:text-text-primary transition-base radius-inner hover:bg-bg-elevated flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),e.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-border-subtle",children:[e.jsxs(p,{color:"teal",children:[e.jsx("span",{className:"font-mono tabular-nums",children:t.targetHopCount}),e.jsxs("span",{className:"ml-1",children:["hop",1!==t.targetHopCount?"s":""]})]}),e.jsxs(p,{color:"zinc",children:[e.jsx("span",{className:"font-mono tabular-nums",children:t.observationCount}),e.jsx("span",{className:"ml-1",children:"obs"})]}),t.linkQuality&&e.jsxs(p,{color:"purple",children:[e.jsx("span",{className:"font-mono tabular-nums",children:t.linkQuality.avgSnr.toFixed(1)}),e.jsx("span",{className:"ml-1",children:"dB avg"})]}),e.jsx("span",{className:"font-mono text-xs text-text-muted tabular-nums",children:V(t.duration)}),t.linkQuality&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-text-muted/40",children:"•"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-sys-red/15 text-sys-red ring-1 ring-inset ring-sys-red/25",children:[e.jsx("span",{className:"opacity-70",children:"Min"}),e.jsx("span",{className:"font-mono tabular-nums",children:t.linkQuality.minSnr.toFixed(1)})]}),e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-sys-teal/15 text-sys-teal ring-1 ring-inset ring-sys-teal/25",children:[e.jsx("span",{className:"opacity-70",children:"Max"}),e.jsx("span",{className:"font-mono tabular-nums",children:t.linkQuality.maxSnr.toFixed(1)})]})]})]})]}),e.jsxs(R,{className:"p-0 overflow-hidden",children:[e.jsx("div",{className:"md:hidden h-[75vh] max-h-[calc(100vh-80px)] overflow-y-auto overflow-x-hidden",children:e.jsxs("div",{className:"px-4 py-3 space-y-3",children:[t.linkQuality&&e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{className:"radius-inner bg-subtle-fill ring-1 ring-inset ring-border-subtle p-2.5 text-center",children:[e.jsx(ve,{value:Math.abs(t.linkQuality.minSnr),format:{maximumFractionDigits:0,signDisplay:"never"},prefix:t.linkQuality.minSnr<0?"-":"",className:"text-[20px] font-bold font-mono tabular-nums flex items-center justify-center text-text-primary"}),e.jsxs("div",{className:"flex items-center justify-center gap-1 mt-1",children:[e.jsx(me,{className:"w-2.5 h-2.5 text-text-muted"}),e.jsx("span",{className:"text-[10px] text-text-muted",children:"Min dB"})]})]}),e.jsxs("div",{className:"radius-inner bg-subtle-fill ring-1 ring-inset ring-border-subtle p-2.5 text-center",children:[e.jsx(ve,{value:t.linkQuality.maxSnr,format:{maximumFractionDigits:0,signDisplay:"always"},className:"text-[20px] font-bold font-mono text-text-primary tabular-nums flex items-center justify-center"}),e.jsxs("div",{className:"flex items-center justify-center gap-1 mt-1",children:[e.jsx(le,{className:"w-2.5 h-2.5 text-text-muted"}),e.jsx("span",{className:"text-[10px] text-text-muted",children:"Max dB"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(p,{color:"excellent"===o||"good"===o?"green":"fair"===o?"amber":"red",compact:!0,children:[e.jsx(Pe,{className:"w-2.5 h-2.5 mr-0.5"}),"excellent"===o?"Excellent":"good"===o?"Good":"fair"===o?"Fair":"Poor"]}),e.jsxs(p,{color:"teal",compact:!0,children:[t.targetHopCount," hops"]}),e.jsxs(p,{color:"zinc",compact:!0,children:[t.observationCount," obs"]}),e.jsx("span",{className:"text-[10px] font-mono text-text-muted ml-auto",children:t.traceTag.slice(0,8)})]}),t.targetPath.length>0&&e.jsx("div",{className:"overflow-hidden radius-inset",children:e.jsx("div",{className:"aspect-[4/3] w-full",children:e.jsx(lt,{path:t.targetPath,neighbors:l,localNode:i,localHash:null==r?void 0:r.local_hash,srcHash:t.srcHash,dstHash:t.dstHash,traceSnr:c})})}),e.jsxs("div",{className:"radius-inset bg-bg-body overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border-subtle",children:[e.jsx("span",{className:"text-[11px] font-medium text-text-secondary",children:"Route Path"}),t.linkQuality&&e.jsxs("span",{className:"text-[10px] font-mono text-text-muted",children:["SNR ",t.linkQuality.minSnr.toFixed(1)," → ",t.linkQuality.maxSnr.toFixed(1)," dB"]})]}),t.bestObservation?e.jsx(Et,{packet:t.bestObservation.packet,neighbors:l,localHash:null==r?void 0:r.local_hash,direction:"flowchart",compact:!0,overridePath:t.targetPath,traceSnr:t.bestObservation.decoded.snrValues}):e.jsx("div",{className:"p-6 text-center text-text-muted text-[11px]",children:"No path data available"})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-[11px] font-medium uppercase tracking-wide text-text-muted mb-2",children:["Link Quality · ",t.hopStats.length," hops"]}),e.jsx("div",{className:"space-y-1.5",children:t.hopStats.length>0?t.hopStats.map((s,a)=>{var n,r,i;const c=a{const s=t.targetPath[t.linkQuality.weakestLinkPosition],a=t.targetPath[t.linkQuality.weakestLinkPosition+1]||"You",n=Gt(s,l),r=Gt(a,l),i=t.targetPath[t.linkQuality.strongestLinkPosition],c=t.targetPath[t.linkQuality.strongestLinkPosition+1]||"You",o=Gt(i,l),d=Gt(c,l);return e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(Ot,{label:"Weakest Link",numericValue:t.linkQuality.minSnr,unit:"dB",icon:me,subtext:`${n||s} → ${r||a}`}),e.jsx(Ot,{label:"Best Link",numericValue:t.linkQuality.maxSnr,showSign:!0,unit:"dB",icon:le,subtext:`${o||i} → ${d||c}`})]})})(),e.jsxs("div",{children:[e.jsx("h3",{className:"text-[11px] font-medium uppercase tracking-wide text-text-muted mb-3",children:"Link Details"}),e.jsx("div",{className:"space-y-2",children:t.hopStats.length>0?t.hopStats.map((s,a)=>{var n,r,i;const c=a0&&e.jsx("div",{className:"overflow-hidden",children:e.jsx("div",{className:"aspect-square w-full",children:e.jsx(lt,{path:t.targetPath,neighbors:l,localNode:i,localHash:null==r?void 0:r.local_hash,srcHash:t.srcHash,dstHash:t.dstHash,traceSnr:c})})}),e.jsxs("div",{className:"radius-inset bg-black overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[e.jsx("span",{className:"text-xs font-medium text-text-muted uppercase tracking-wide",children:"Trace Route"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(p,{color:t.isComplete?"green":"amber",compact:!0,children:t.isComplete?"Complete":`${t.maxHopsObserved}/${t.targetHopCount}`}),e.jsxs(p,{color:"teal",compact:!0,children:[t.targetHopCount," hop",1!==t.targetHopCount?"s":""]})]})]}),t.linkQuality&&t.bestObservation&&e.jsxs("div",{className:"flex items-center gap-4 px-4 pb-2 font-mono text-[10px] text-text-muted",children:[e.jsxs("span",{children:[e.jsx("span",{className:"opacity-60",children:"Tag"})," ",e.jsx("code",{className:"text-teal-400 tabular-nums",children:t.traceTag.slice(0,8)})]}),e.jsxs("span",{children:[e.jsx("span",{className:"opacity-60",children:"SNR"})," ",e.jsxs("code",{className:"text-accent-secondary tabular-nums",children:[t.linkQuality.minSnr.toFixed(1),"–",t.linkQuality.maxSnr.toFixed(1)]}),e.jsx("span",{className:"opacity-60",children:" dB"})]})]}),t.bestObservation?e.jsx(Et,{packet:t.bestObservation.packet,neighbors:l,localHash:null==r?void 0:r.local_hash,direction:"flowchart",compact:!0,overridePath:t.targetPath,traceSnr:t.bestObservation.decoded.snrValues}):e.jsx("div",{className:"p-8 text-center text-text-muted text-xs",children:"No path data available"})]})]})]})]})]})}),Kt="(min-width: 640px)";let Yt=null;function Jt(e){return"undefined"==typeof window?()=>{}:(Yt||(Yt=window.matchMedia(Kt)),Yt.addEventListener("change",e),()=>null==Yt?void 0:Yt.removeEventListener("change",e))}function Xt(){return"undefined"==typeof window||(Yt||(Yt=window.matchMedia(Kt)),Yt.matches)}function Zt({message:t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-14 text-center",children:[e.jsx(M,{className:"size-6 text-text-muted mb-2"}),e.jsx("p",{className:"text-sm text-text-primary",children:t}),e.jsx("p",{className:"text-xs text-text-muted",children:"Packets will appear here"})]})}function es(){return e.jsx("div",{className:"py-14 text-center text-sm text-text-muted",children:"Loading packets…"})}function ts({showPagination:t,currentPage:s,perPage:a,displayCount:n,totalCount:r,action:l}){const i=t?(s-1)*a+1:1,c=t?Math.min(s*a,r):n;return e.jsxs("div",{className:"flex items-center justify-between gap-4 border-t border-border-subtle px-4 py-3 text-xs text-text-muted sm:px-6",children:[e.jsxs("span",{children:["Showing"," ",e.jsx("span",{className:"font-medium text-text-secondary",children:t?`${i}–${c}`:n})," ","of"," ",e.jsx("span",{className:"font-medium text-text-secondary",children:r})," ","packets"]}),l]})}function ss({packets:a,allPackets:n,localHash:r,neighbors:l,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}){const[g,f]=s.useState(null),[b,y]=s.useState(null),[j,v]=s.useState({traceTag:null,dupeGroup:null});s.useLayoutEffect(()=>{v({traceTag:null,dupeGroup:null})},[a]);const N=n??a,k=s.useMemo(()=>c&&c>0?a.slice(0,c):a,[a,c]),{currentPage:w,totalPages:C,goToPage:S,pageRange:H}=function(e,t,a){const[n,r]=s.useState(1),l=a?Math.ceil(e/t):1;s.useEffect(()=>{n>l&&l>0&&queueMicrotask(()=>r(1))},[l,n]);const i=s.useCallback(e=>r(Math.max(1,Math.min(e,l))),[l]),c=s.useMemo(()=>function(e,t,s=1){if(t<=7)return Array.from({length:t},(e,t)=>t+1);const a=Math.max(e-s,1),n=Math.min(e+s,t),r=a>2,l=nt+1),"gap",t]}if(r&&!l){const e=3+2*s;return[1,"gap",...Array.from({length:e},(s,a)=>t-e+a+1)]}return[1,"gap",...Array.from({length:n-a+1},(e,t)=>a+t),"gap",t]}(n,l),[n,l]);return{currentPage:n,totalPages:l,goToPage:i,pageRange:c}}(k.length,o,d),P=s.useMemo(()=>{if(!d)return k;const e=(w-1)*o;return k.slice(e,e+o)},[k,d,w,o]),M=s.useMemo(()=>function(e){const t=new Map;for(const s of e)if((s.payload_type??s.type)===Q.TRACE&&s.payload&&s.packet_hash){const e=Ue(s.payload);e&&t.set(s.packet_hash,e)}return t}(P),[P]),_=s.useMemo(()=>function(e){const t=new Map;if(0===e.length)return t;for(let s=0;s{var s,a;if(!t||!e.length)return;const l=(null==(s=e[0])?void 0:s.timestamp)??0,i=l>r.current&&r.current>0;if(r.current=l,!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,t]),a}(a,m),B=s.useCallback((e,t)=>{var s,a;const n=e.packet_hash;if(!n)return[e];let r=t;for(;r>0&&(null==(s=P[r-1])?void 0:s.packet_hash)===n;)r--;let l=t;for(;l{var t,s;const a=null==(t=P[e])?void 0:t.packet_hash;if(!a)return e;let n=e;for(;n>0&&(null==(s=P[n-1])?void 0:s.packet_hash)===a;)n--;return n},[P]),L=s.useCallback(e=>{var t,s;const a=null==(t=P[e])?void 0:t.packet_hash;if(!a)return e;let n=e;for(;n{if(x)x(e);else if(void 0!==t){const s=B(e,t),a=s.indexOf(e);f({packets:s,initialIndex:a>=0?a:0,rowIndex:t})}else f({packets:[e],initialIndex:0,rowIndex:0})},[x,B]),D=s.useCallback(()=>{if(!g)return;const e=F(g.rowIndex)-1;if(e<0)return;const t=P[e];if(!t)return;const s=B(t,e);f({packets:s,initialIndex:0,rowIndex:e})},[g,P,F,B]),A=s.useCallback(()=>{if(!g)return;const e=L(g.rowIndex)+1;if(e>=P.length)return;const t=P[e];if(!t)return;const s=B(t,e);f({packets:s,initialIndex:0,rowIndex:e})},[g,P,L,B]),E=s.useMemo(()=>!!g&&F(g.rowIndex)>0,[g,F]),R=s.useMemo(()=>!!g&&L(g.rowIndex)v(t=>({...t,traceTag:e})),[]),I=s.useCallback(e=>v(t=>({...t,dupeGroup:e})),[]),$=s.useCallback(()=>{v({traceTag:null,dupeGroup:null})},[]),V=s.useCallback(e=>{const t=N.filter(t=>(t.payload_type??t.type)===Q.TRACE&&t.payload&&Ue(t.payload)===e);if(0===t.length)return;const s=function(e){const t=new Map;for(const s of e){const e=$e(s);if(!e)continue;const a=e.decoded.traceTag,n=t.get(a)||[];n.push(e),t.set(a,n)}for(const[s,a]of t)a.sort((e,t)=>e.timestamp-t.timestamp),t.set(s,a);return t}(t),a=s.get(e);(null==a?void 0:a.length)&&y(function(e,t){if(0===t.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 s=[...t].sort((e,t)=>e.timestamp-t.timestamp),a=s.reduce((e,t)=>t.hopCount>e.hopCount?t:e,s[0]),n=s[0].timestamp,r=s[s.length-1].timestamp,l=a.decoded.pathHashes,i=l.length,c=a.hopCount,o=a.decoded.isComplete,d=[],x=a.decoded.snrValues;for(let p=0;p0){const e=Math.min(...x),t=Math.max(...x);m={minSnr:e,maxSnr:t,avgSnr:x.reduce((e,t)=>e+t,0)/x.length,weakestLinkPosition:x.indexOf(e),strongestLinkPosition:x.indexOf(t)}}return{traceTag:e,traceTagValue:a.decoded.traceTagValue,targetPath:l,targetHopCount:i,observations:s,observationCount:s.length,firstSeen:n,lastSeen:r,duration:r-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))},[N]),O=s.useCallback(e=>{const t=N.find(t=>t.packet_hash===e);t&&(y(null),z(t))},[N,z]),W=s.useSyncExternalStore(Jt,Xt,()=>!0);return e.jsxs("div",{className:t("flex flex-col",h),onMouseLeave:$,children:[e.jsx("div",{className:"divide-y divide-white/5 py-1",children:(()=>{if(i&&0===a.length)return e.jsx(es,{});if(0===P.length)return e.jsx(Zt,{message:p});const t=W?Ze:et;return P.map((s,a)=>{const n=s.packet_hash?M.get(s.packet_hash):void 0,i=null!==j.traceTag&&n===j.traceTag,c=_.get(a),o=void 0!==c&&null!==j.dupeGroup&&s.packet_hash===j.dupeGroup;return e.jsx(t,{packet:s,onClick:e=>z(e,a),localHash:r,neighbors:l,isFlashing:m&&T===s.packet_hash,traceTag:n,isTraceHighlighted:i,onTraceHover:U,onViewTraceReport:V,dupeGroupPosition:c,isDupeGroupHovered:o,onDupeGroupHover:I},`${s.packet_hash}_${s.timestamp}_${a}`)})})()}),d&&C>1&&e.jsx("nav",{className:"border-t border-border-subtle px-4 py-3",children:e.jsxs(Le,{className:"justify-center",children:[e.jsx(ze,{onClick:()=>S(w-1),disabled:1===w}),e.jsx(Ae,{children:H.map((t,s)=>"gap"===t?e.jsx(Re,{},`gap-${s}`):e.jsx(Ee,{page:t,current:t===w,onClick:S},t))}),e.jsx(De,{onClick:()=>S(w+1),disabled:w===C})]})}),e.jsx(ts,{showPagination:d,currentPage:w,perPage:o,displayCount:P.length,totalCount:d?k.length:a.length,action:u}),!x&&g&&e.jsx(Vt,{packets:g.packets,initialIndex:g.initialIndex,onClose:()=>f(null),onNavigatePrev:D,onNavigateNext:A,hasPrev:E,hasNext:R}),b&&e.jsx(qt,{report:b,onClose:()=>y(null),onViewPacket:O})]})}export{Ne as A,ss as P,Pe as S,Me as T,We as g,Fe as u}; diff --git a/frontend/dist/assets/Packets-CQBNFl_1.js b/frontend/dist/assets/Packets-lSdRKAGr.js similarity index 91% rename from frontend/dist/assets/Packets-CQBNFl_1.js rename to frontend/dist/assets/Packets-lSdRKAGr.js index 2c7a65d1..00e8e15d 100644 --- a/frontend/dist/assets/Packets-CQBNFl_1.js +++ b/frontend/dist/assets/Packets-lSdRKAGr.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 n}from"./vendor-react-j_fHog8x.js";import{O as o,f as c,h as d,n as m,_ as u,$ as p,L as x,B as h,R as b,a0 as j}from"./index-CImKXCRQ.js";import{g as v,A as g,P as f}from"./PacketList-FKMq_1Wb.js";import{A as y}from"./arrow-up-CPFFRV-b.js";import{C as N}from"./SignalIndicator-JkITXu3r.js";import{C as w}from"./copy-CfZtRqCt.js";import{U as k}from"./users-BZZVk2mu.js";import{P as C,b as S,B as R,a as P}from"./PageLayout-CBx7rIBL.js";import{F as L}from"./funnel-BR-9uKC6.js";import{C as M}from"./Card-DfIcRbRE.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CDNU4oKM.js";import"./payload-decoders-BbTIgSA8.js";import"./chevron-right-DZcqArkG.js";import"./map-pin-lRKxIpXD.js";import"./triangle-alert-DRA45BSe.js";import"./DataBox-BUgVf-3d.js";import"./layers-CTDI7uhn.js";import"./route-DJfT3Jo2.js";import"./activity-3eg63twO.js";import"./circle-check-DK-UNKLb.js";import"./database-1Jgt_gPe.js";import"./DelayedAnimateNumber-B6DSbUSU.js";import"./index-CGYcizrv.js";import"./config-CTM8_93T.js";import"./signal-scoring-CcBiRcks.js";function F({options:n,value:c,onChange:d,defaultValue:m,displayValue:u,filter:p,placeholder:x,disabled:h,invalid:b,name:j,"aria-label":v,className:g,children:f}){const[y,N]=e.useState(""),w=u??(e=>null!=e?String(e):""),k=p??((e,a)=>w(e).toLowerCase().includes(a.toLowerCase())),C=e.useMemo(()=>y?n.filter(e=>k(e,y)):n,[n,y,k]);return a.jsx(s,{value:c,onChange:d,defaultValue:m,disabled:h,name:j,onClose:()=>N(""),children:a.jsxs("div",{className:l("relative",g),children:[a.jsxs("div",{className:"relative",children:[a.jsx(t,{"aria-label":v,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-text-primary placeholder:text-text-muted","bg-bg-subtle",b?"border border-accent-danger":"border-control","ring-focus-inset","hover:border-border-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(o,{className:"w-4 h-4 text-text-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===C.length&&""!==y?a.jsx("div",{className:"px-3 py-2 text-sm text-text-muted",children:"No results found"}):C.map((s,l)=>a.jsx(e.Fragment,{children:f(s)},l))})]})})}function A({value:s,disabled:t,className:i,children:r}){return a.jsx(n,{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-accent-primary text-white",!s&&"text-text-primary",e&&!s&&"text-accent-primary",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 _({className:e,...s}){return a.jsx("span",{...s,className:l("truncate",e)})}function D({value:e,onChange:s,options:l,placeholder:t,disabled:i,className:r,"aria-label":n}){const o=l.find(a=>a.value===e);return a.jsx(F,{options:l,value:o,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":n,children:e=>a.jsx(A,{value:e,disabled:e.disabled,children:a.jsx(_,{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-text-primary",children:t.toLocaleString()}),a.jsxs("span",{className:"text-[10px] text-text-muted leading-tight",children:[s,void 0!==r&&a.jsxs("span",{className:"ml-1 opacity-70",children:["(",r,"%)"]})]})]})]})}const H=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 n=s.length,o=r>0?Math.round(i/r):0;return{total:n,rx:n,fwd:e,dropped:a,duplicate:l,uniqueSources:t.size,avgRssi:o,rxPercent:100,fwdPercent:n>0?Math.round(e/n*100):0,droppedPercent:n>0?Math.round(a/n*100):0}},[s]);return 0===s.length?null:a.jsx("div",{className:"surface-base 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(y,{className:"w-3.5 h-3.5 text-accent-primary"}),label:"Received",value:l.rx,color:"bg-accent-primary/10",percentage:l.rxPercent}),a.jsx(B,{icon:a.jsx(g,{className:"w-3.5 h-3.5 text-accent-success"}),label:"Forwarded",value:l.fwd,color:"bg-accent-success/10",percentage:l.fwdPercent}),a.jsx(B,{icon:a.jsx(N,{className:"w-3.5 h-3.5 text-accent-danger"}),label:"Dropped",value:l.dropped,color:"bg-accent-danger/10",percentage:l.droppedPercent}),a.jsx(B,{icon:a.jsx(w,{className:"w-3.5 h-3.5 text-text-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(k,{className:"w-3.5 h-3.5 text-accent-secondary"}),label:"Sources",value:l.uniqueSources,color:"bg-accent-secondary/10"}),a.jsxs("div",{className:"flex flex-col items-end pr-1",children:[a.jsxs("span",{className:"text-sm font-mono text-text-secondary",children:[l.avgRssi," dBm"]}),a.jsx("span",{className:"text-[10px] text-text-muted",children:"Avg Signal"})]})]})]})})});function V(){const s=d(),t=m(),i=null==t?void 0:t.local_hash,r=null==t?void 0:t.neighbors,[n,o]=e.useState(!1),[c,g]=e.useState({limit:500,status:"all"}),[y,N]=e.useState(Date.now);e.useEffect(()=>{c.timeRange&&c.timeRange>0&&queueMicrotask(()=>N(Date.now()))},[c.timeRange,s]);const w=e.useMemo(()=>{const e=c.limit??500;return[...s.length<=e?s:s.slice(-e)].sort((e,a)=>(a.timestamp??0)-(e.timestamp??0))},[s,c.limit]),k=0===s.length,F=e.useMemo(()=>{let e=w;if(void 0!==c.type){const a=u[c.type];e=e.filter(e=>{const s=e.type??e.payload_type,l=e.payload_type_name;return s===c.type||l===a})}if(void 0!==c.route){const a=p[c.route];e=e.filter(e=>{const s=e.route??e.route_type,l=e.route_type_name;return s===c.route||l===a})}if(c.status&&"all"!==c.status&&(e=e.filter(e=>v(e)===c.status)),void 0!==c.signalMin&&(e=e.filter(e=>e.rssi>=c.signalMin)),c.timeRange&&c.timeRange>0){const a=y/1e3-3600*c.timeRange;e=e.filter(e=>e.timestamp>=a)}return e},[w,c.type,c.route,c.status,c.signalMin,c.timeRange,y]),A=(e,a)=>g(s=>({...s,[e]:a})),_=void 0!==c.type||void 0!==c.route||c.status&&"all"!==c.status||void 0!==c.signalMin||c.timeRange&&c.timeRange>0;return a.jsxs(C,{children:[a.jsx(S,{title:"Packet History",icon:a.jsx(b,{}),controls:a.jsxs(a.Fragment,{children:[a.jsx(x,{showLabel:!0}),a.jsxs(h,{outline:!0,color:_?"primary":"muted",onClick:()=>o(!n),className:"sm:hidden",children:[a.jsx(L,{"data-slot":"icon"}),_&&a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})]})]})}),a.jsxs(R,{children:[a.jsxs(P,{noPadding:!0,className:l("overflow-hidden transition-all duration-200",n?"max-h-96 opacity-100":"max-h-0 opacity-0 sm:max-h-96 sm:opacity-100"),children:[a.jsx(M,{listHeader:!0,icon:a.jsx(L,{className:"icon-sm"}),title:"Filters",actions:_?a.jsxs(h,{plain:!0,color:"muted",onClick:()=>g({limit:c.limit,status:"all"}),className:"!text-xs !py-0.5 !px-1.5",children:[a.jsx(j,{"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(D,{value:c.type??"",onChange:e=>A("type",""===e?void 0:Number(e)),options:[{value:"",label:"All Types"},...Object.entries(u).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(D,{value:c.route??"",onChange:e=>A("route",""===e?void 0:Number(e)),options:[{value:"",label:"All Routes"},...Object.entries(p).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(D,{value:c.status??"all",onChange:e=>A("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(D,{value:c.timeRange??0,onChange:e=>A("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(D,{value:c.signalMin??"",onChange:e=>A("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(D,{value:c.limit??500,onChange:e=>A("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(H,{packets:F}),a.jsx(P,{noPadding:!0,className:"!overflow-visible",children:a.jsx(f,{packets:F,allPackets:s,localHash:i,neighbors:r,loading:k,showPagination:!0,perPage:50,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 n}from"./vendor-react-j_fHog8x.js";import{O as o,f as c,h as d,n as m,_ as u,$ as p,L as x,B as h,R as b,a0 as j}from"./index-B51aMfiH.js";import{g as v,A as g,P as f}from"./PacketList-XLhbtedS.js";import{A as y}from"./arrow-up-By-lyY8m.js";import{C as N}from"./SignalIndicator-DvKCjwKG.js";import{C as w}from"./copy-jAVnwXtf.js";import{U as k}from"./users-cobitl86.js";import{P as C,b as S,B as R,a as P}from"./PageLayout-DUXmuiZg.js";import{F as L}from"./funnel-BWvj-vnP.js";import{C as M}from"./Card-BC0izdLh.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CDNU4oKM.js";import"./payload-decoders-ClAu_OX0.js";import"./chevron-right-DiVetJOJ.js";import"./map-pin-C3ieg9t_.js";import"./triangle-alert-JpcXY4mr.js";import"./DataBox-B4su-zzA.js";import"./layers-Dd_4LhZ4.js";import"./route-BTnuOvzt.js";import"./activity-48nFba-7.js";import"./circle-check-DBemvAXd.js";import"./database-IcctMW15.js";import"./DelayedAnimateNumber-BXZBlojL.js";import"./index-Ch_XDzqB.js";import"./config-CTM8_93T.js";import"./signal-scoring-CcBiRcks.js";function F({options:n,value:c,onChange:d,defaultValue:m,displayValue:u,filter:p,placeholder:x,disabled:h,invalid:b,name:j,"aria-label":v,className:g,children:f}){const[y,N]=e.useState(""),w=u??(e=>null!=e?String(e):""),k=p??((e,a)=>w(e).toLowerCase().includes(a.toLowerCase())),C=e.useMemo(()=>y?n.filter(e=>k(e,y)):n,[n,y,k]);return a.jsx(s,{value:c,onChange:d,defaultValue:m,disabled:h,name:j,onClose:()=>N(""),children:a.jsxs("div",{className:l("relative",g),children:[a.jsxs("div",{className:"relative",children:[a.jsx(t,{"aria-label":v,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-text-primary placeholder:text-text-muted","bg-bg-subtle",b?"border border-accent-danger":"border-control","ring-focus-inset","hover:border-border-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(o,{className:"w-4 h-4 text-text-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===C.length&&""!==y?a.jsx("div",{className:"px-3 py-2 text-sm text-text-muted",children:"No results found"}):C.map((s,l)=>a.jsx(e.Fragment,{children:f(s)},l))})]})})}function A({value:s,disabled:t,className:i,children:r}){return a.jsx(n,{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-accent-primary text-white",!s&&"text-text-primary",e&&!s&&"text-accent-primary",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 _({className:e,...s}){return a.jsx("span",{...s,className:l("truncate",e)})}function D({value:e,onChange:s,options:l,placeholder:t,disabled:i,className:r,"aria-label":n}){const o=l.find(a=>a.value===e);return a.jsx(F,{options:l,value:o,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":n,children:e=>a.jsx(A,{value:e,disabled:e.disabled,children:a.jsx(_,{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-text-primary",children:t.toLocaleString()}),a.jsxs("span",{className:"text-[10px] text-text-muted leading-tight",children:[s,void 0!==r&&a.jsxs("span",{className:"ml-1 opacity-70",children:["(",r,"%)"]})]})]})]})}const H=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 n=s.length,o=r>0?Math.round(i/r):0;return{total:n,rx:n,fwd:e,dropped:a,duplicate:l,uniqueSources:t.size,avgRssi:o,rxPercent:100,fwdPercent:n>0?Math.round(e/n*100):0,droppedPercent:n>0?Math.round(a/n*100):0}},[s]);return 0===s.length?null:a.jsx("div",{className:"surface-base 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(y,{className:"w-3.5 h-3.5 text-accent-primary"}),label:"Received",value:l.rx,color:"bg-accent-primary/10",percentage:l.rxPercent}),a.jsx(B,{icon:a.jsx(g,{className:"w-3.5 h-3.5 text-accent-success"}),label:"Forwarded",value:l.fwd,color:"bg-accent-success/10",percentage:l.fwdPercent}),a.jsx(B,{icon:a.jsx(N,{className:"w-3.5 h-3.5 text-accent-danger"}),label:"Dropped",value:l.dropped,color:"bg-accent-danger/10",percentage:l.droppedPercent}),a.jsx(B,{icon:a.jsx(w,{className:"w-3.5 h-3.5 text-text-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(k,{className:"w-3.5 h-3.5 text-accent-secondary"}),label:"Sources",value:l.uniqueSources,color:"bg-accent-secondary/10"}),a.jsxs("div",{className:"flex flex-col items-end pr-1",children:[a.jsxs("span",{className:"text-sm font-mono text-text-secondary",children:[l.avgRssi," dBm"]}),a.jsx("span",{className:"text-[10px] text-text-muted",children:"Avg Signal"})]})]})]})})});function V(){const s=d(),t=m(),i=null==t?void 0:t.local_hash,r=null==t?void 0:t.neighbors,[n,o]=e.useState(!1),[c,g]=e.useState({limit:500,status:"all"}),[y,N]=e.useState(Date.now);e.useEffect(()=>{c.timeRange&&c.timeRange>0&&queueMicrotask(()=>N(Date.now()))},[c.timeRange,s]);const w=e.useMemo(()=>{const e=c.limit??500;return[...s.length<=e?s:s.slice(-e)].sort((e,a)=>(a.timestamp??0)-(e.timestamp??0))},[s,c.limit]),k=0===s.length,F=e.useMemo(()=>{let e=w;if(void 0!==c.type){const a=u[c.type];e=e.filter(e=>{const s=e.type??e.payload_type,l=e.payload_type_name;return s===c.type||l===a})}if(void 0!==c.route){const a=p[c.route];e=e.filter(e=>{const s=e.route??e.route_type,l=e.route_type_name;return s===c.route||l===a})}if(c.status&&"all"!==c.status&&(e=e.filter(e=>v(e)===c.status)),void 0!==c.signalMin&&(e=e.filter(e=>e.rssi>=c.signalMin)),c.timeRange&&c.timeRange>0){const a=y/1e3-3600*c.timeRange;e=e.filter(e=>e.timestamp>=a)}return e},[w,c.type,c.route,c.status,c.signalMin,c.timeRange,y]),A=(e,a)=>g(s=>({...s,[e]:a})),_=void 0!==c.type||void 0!==c.route||c.status&&"all"!==c.status||void 0!==c.signalMin||c.timeRange&&c.timeRange>0;return a.jsxs(C,{children:[a.jsx(S,{title:"Packet History",icon:a.jsx(b,{}),controls:a.jsxs(a.Fragment,{children:[a.jsx(x,{showLabel:!0}),a.jsxs(h,{outline:!0,color:_?"primary":"muted",onClick:()=>o(!n),className:"sm:hidden",children:[a.jsx(L,{"data-slot":"icon"}),_&&a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-primary"})]})]})}),a.jsxs(R,{children:[a.jsxs(P,{noPadding:!0,className:l("overflow-hidden transition-all duration-200",n?"max-h-96 opacity-100":"max-h-0 opacity-0 sm:max-h-96 sm:opacity-100"),children:[a.jsx(M,{listHeader:!0,icon:a.jsx(L,{className:"icon-sm"}),title:"Filters",actions:_?a.jsxs(h,{plain:!0,color:"muted",onClick:()=>g({limit:c.limit,status:"all"}),className:"!text-xs !py-0.5 !px-1.5",children:[a.jsx(j,{"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(D,{value:c.type??"",onChange:e=>A("type",""===e?void 0:Number(e)),options:[{value:"",label:"All Types"},...Object.entries(u).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(D,{value:c.route??"",onChange:e=>A("route",""===e?void 0:Number(e)),options:[{value:"",label:"All Routes"},...Object.entries(p).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(D,{value:c.status??"all",onChange:e=>A("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(D,{value:c.timeRange??0,onChange:e=>A("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(D,{value:c.signalMin??"",onChange:e=>A("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(D,{value:c.limit??500,onChange:e=>A("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(H,{packets:F}),a.jsx(P,{noPadding:!0,className:"!overflow-visible",children:a.jsx(f,{packets:F,allPackets:s,localHash:i,neighbors:r,loading:k,showPagination:!0,perPage:50,emptyMessage:"No packets found"})})]})]})}export{V as default}; diff --git a/frontend/dist/assets/PageLayout-CBx7rIBL.js b/frontend/dist/assets/PageLayout-DUXmuiZg.js similarity index 98% rename from frontend/dist/assets/PageLayout-CBx7rIBL.js rename to frontend/dist/assets/PageLayout-DUXmuiZg.js index 1f5e0a09..8640f632 100644 --- a/frontend/dist/assets/PageLayout-CBx7rIBL.js +++ b/frontend/dist/assets/PageLayout-DUXmuiZg.js @@ -1 +1 @@ -import{j as s,c as e}from"./vendor-react-j_fHog8x.js";import"./index-CImKXCRQ.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-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-border-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-text-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"}){return s.jsxs("div",{className:e("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-B51aMfiH.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-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-border-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-text-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"}){return s.jsxs("div",{className:e("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-COhYm69t.js b/frontend/dist/assets/PathMapMapLibre-BqsWS2Hd.js similarity index 93% rename from frontend/dist/assets/PathMapMapLibre-COhYm69t.js rename to frontend/dist/assets/PathMapMapLibre-BqsWS2Hd.js index e2cb9f15..ac829880 100644 --- a/frontend/dist/assets/PathMapMapLibre-COhYm69t.js +++ b/frontend/dist/assets/PathMapMapLibre-BqsWS2Hd.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 n,S as a,L as s,a as l,P as d}from"./BasemapLayer-Dkb0XoZP.js";import"./maplibre-gl-b91ci4Kr.js";import{c,ad as u,cN as m,al as p,e as h,m as x,cO as g}from"./index-CImKXCRQ.js";import{H as f}from"./DelayedAnimateNumber-B6DSbUSU.js";import{u as b}from"./PacketList-FKMq_1Wb.js";import"./vendor-core-CDNU4oKM.js";import"./index-CGYcizrv.js";import"./config-CTM8_93T.js";import"./payload-decoders-BbTIgSA8.js";import"./SignalIndicator-JkITXu3r.js";import"./signal-scoring-CcBiRcks.js";import"./arrow-up-CPFFRV-b.js";import"./copy-CfZtRqCt.js";import"./chevron-right-DZcqArkG.js";import"./map-pin-lRKxIpXD.js";import"./triangle-alert-DRA45BSe.js";import"./DataBox-BUgVf-3d.js";import"./layers-CTDI7uhn.js";import"./route-DJfT3Jo2.js";import"./activity-3eg63twO.js";import"./circle-check-DK-UNKLb.js";import"./database-1Jgt_gPe.js";const y=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"},j={nodeColor:"#4338CA",localColor:"#4F46E5",hubColor:"#6366F1",edgeColor:"#3B3F4A",ambiguousColor:"#F9D26F",highlightColor:"#B49DFF",sourceColor:"#39D98A",destinationColor:"#B49DFF"};function C(e,t){if(!e)return t;if(e.startsWith("#"))return e;const o=g(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 k(){if("undefined"==typeof document)return j;const e=document.documentElement,t=getComputedStyle(e);return{nodeColor:C(t.getPropertyValue("--map-node-stroke").trim(),j.nodeColor),localColor:C(t.getPropertyValue("--map-local-color").trim(),j.localColor),hubColor:C(t.getPropertyValue("--map-hub-color").trim(),j.hubColor),edgeColor:C(t.getPropertyValue("--map-edge-rest").trim(),j.edgeColor),ambiguousColor:C(t.getPropertyValue("--accent-secondary").trim(),j.ambiguousColor),highlightColor:C(t.getPropertyValue("--accent-primary").trim(),j.highlightColor),sourceColor:C(t.getPropertyValue("--accent-success").trim(),j.sourceColor),destinationColor:C(t.getPropertyValue("--accent-primary").trim(),j.destinationColor)}}function N({prefix:r,isLocal:i,isSource:n,isDestination:a,isLastHop:s,isHighlighted:l,isAnimating:d,isWardrive:c,candidate:u,onHover:m,onLeave:p,onClick:g}){const v=b(),[j,C]=e.useState(!1);e.useEffect(()=>{d&&v.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,v]);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-accent-primary/50 rounded-full",j&&"relative z-50"),animate:v,initial:{boxShadow:"0 0 0 0px rgba(249, 115, 22, 0)"},onMouseEnter:k,onMouseLeave:N,onClick:g,style:{pointerEvents:"auto"},children:[t.jsx("div",{className:o("flex items-center justify-center","w-7 h-7 rounded-full","bg-orange-500 text-white","shadow-lg border-2 border-orange-300/50","transition-transform duration-150",j&&"scale-110"),children:t.jsx(y,{className:"w-4 h-4",strokeWidth:2.5})}),j&&t.jsxs(h,{color:"orange",filled:!0,className:"ml-1 text-[10px] font-mono 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-accent-primary/50 rounded",j&&"relative z-50"),animate:v,initial:{boxShadow:"0 0 0 0px rgba(113, 156, 223, 0)"},onMouseEnter:k,onMouseLeave:N,onClick:g,style:{pointerEvents:"auto"},children:t.jsxs(h,{color:c?"orange":i?"amber":n?"green":s?"amber":a?"purple":"blue",filled:!0,className:"font-mono text-[10px] shadow-lg border border-current/30",children:[i&&t.jsx(f,{className:"w-2.5 h-2.5 mr-1"}),r,j&&u.name&&t.jsx("span",{className:"ml-1 opacity-75",children:u.name})]})})}function S({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||"#71717a",color:"#fff",fontSize:"8px",lineHeight:1,textShadow:"0 1px 1px rgba(0,0,0,0.4)"},children:e}),void 0!==o&&t.jsx(h,{color:"zinc",compact:!0,className:"!text-[9px] font-mono tabular-nums shadow-sm",children:o.toFixed(1)})]})}function w({resolvedPath:c,localNode:h,hubNodes:x=[],hoveredHopIndex:g,onHoverHop:f,traceSnr:b}){const y=void 0!==b&&b.length>0,j=e.useRef(null),C=r(),w=e.useMemo(()=>new Set(x),[x]),[F,L]=e.useState(null),D=u(),[E,M]=e.useState(!1),[P,H]=e.useState(0);e.useEffect(()=>{var e;const t=null==(e=j.current)?void 0:e.getMap();if(!t)return;const o=t.getCanvas();if(!o)return;const r=e=>{e.preventDefault()},i=()=>{H(e=>e+1)};return o.addEventListener("webglcontextlost",r),o.addEventListener("webglcontextrestored",i),()=>{o.removeEventListener("webglcontextlost",r),o.removeEventListener("webglcontextrestored",i)}},[P]);const{positions:$,markers:A,edges:I}=e.useMemo(()=>{const e=[],t=[],o=[],r=[];let i=0,n=!1;return c.hops.forEach((a,s)=>{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==b?void 0:b[t],a=c[0]-e[0],s=c[1]-e[1],l=Math.atan2(a,s)*(180/Math.PI),d=k();let u;u=n?"#F97316":void 0!==i?m()[p(i)]||"#71717a":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:n})}const u=!0===a.isSource,h=!0===a.isDestination,x=!0===d.isWardrive;n=x,l.forEach((o,r)=>{const n=[o.latitude,o.longitude];e.push(n);const d=0===r;t.push({position:n,prefix:a.prefix,confidence:a.confidence,candidateCount:l.length,hopIndex:s,candidate:o,isHub:w.has(o.hash),isPrimary:d,isSource:u,isDestination:h,validIndex:i})}),i++}),{positions:e,markers:t,edges:o}},[c,w,b]),B=e.useMemo(()=>{const e=A.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 n of e){const[e,a]=n.position;eo&&(o=e),ai&&(i=a)}return[[r,t],[i,o]]},[A]),V=e.useMemo(()=>{if(0===$.length)return h?[h.longitude,h.latitude]:[0,0];let e=0,t=0;for(const[o,r]of $)e+=o,t+=r;return[t/$.length,e/$.length]},[$,h]),W=e.useCallback(()=>{var e;const t=null==(e=j.current)?void 0:e.getMap();t&&B?(t.fitBounds(B,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:0}),setTimeout(()=>{M(!0)},50)):M(!0)},[B]),z=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=j.current)?void 0:e.getMap();t&&B&&t.fitBounds(B,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:300})},[z,E,B]);const O=D&&E,R=e.useCallback(e=>{L({longitude:e.position[1],latitude:e.position[0],marker:e})},[]);return 0===$.length?t.jsx("div",{className:"h-full flex items-center justify-center text-text-muted text-sm bg-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-bg-elevated flex items-center justify-center","transition-opacity duration-200 ease-out pointer-events-none",O?"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:O?1:0},children:t.jsxs(i,{ref:j,initialViewState:{longitude:V[0],latitude:V[1],zoom:10},onLoad:W,style:{height:"100%",width:"100%"},mapStyle:v,attributionControl:!1,children:[t.jsx(n,{mode:C}),I.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(s,{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}`)}),I.map((e,o)=>t.jsx(l,{longitude:e.midpoint[0],latitude:e.midpoint[1],anchor:"center",children:t.jsx(S,{hopNumber:o+1,snr:y?e.snrFwd:void 0,edgeColor:e.color})},`hop-${o}`)),(()=>{const e=A.filter(e=>e.isPrimary),o=e.length>1?e.length-2:-1;return e.map((e,r)=>{const i=g===e.hopIndex,n=r===o&&!e.candidate.isLocal&&!e.isDestination;return t.jsx(l,{longitude:e.position[1],latitude:e.position[0],anchor:"center",children:t.jsx(N,{prefix:e.prefix,isLocal:e.candidate.isLocal||!1,isSource:e.isSource,isDestination:e.isDestination,isLastHop:n,isHighlighted:i,isAnimating:!1,isWardrive:e.candidate.isWardrive||!1,candidate:e.candidate,onHover:()=>null==f?void 0:f(e.hopIndex),onLeave:()=>null==f?void 0:f(null),onClick:()=>R(e)})},`${e.hopIndex}-${e.candidate.hash}`)})})(),F&&t.jsx(d,{longitude:F.longitude,latitude:F.latitude,anchor:"bottom",offset:[0,-12],closeOnClick:!1,onClose:()=>L(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:F.marker.candidate.name}),(()=>{const e=k();return t.jsxs(t.Fragment,{children:[F.marker.isSource&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.sourceColor,color:"#000"},children:"SRC"}),F.marker.isDestination&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.destinationColor,color:"#000"},children:"DST"}),F.marker.isHub&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.hubColor,color:"#000"},children:"HUB"}),F.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"}),F.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-text-muted font-mono text-[10px]",children:[F.marker.prefix," • ",F.marker.candidate.hash.slice(0,10),"..."]}),!F.marker.isPrimary&&F.marker.candidateCount>1&&t.jsxs("div",{style:{color:k().ambiguousColor},children:["Alternative (",(100*F.marker.candidate.probability).toFixed(0),"%)"]}),F.marker.isPrimary&&F.marker.candidateCount>1&&t.jsxs("div",{className:"text-text-muted",children:[F.marker.candidateCount," candidates"]})]})})]},P)})]})}export{w 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 n,S as a,L as s,a as l,P as d}from"./BasemapLayer-Dkb0XoZP.js";import"./maplibre-gl-b91ci4Kr.js";import{c,ad as u,cN as m,al as p,e as h,m as x,cO as g}from"./index-B51aMfiH.js";import{H as f}from"./DelayedAnimateNumber-BXZBlojL.js";import{u as b}from"./PacketList-XLhbtedS.js";import"./vendor-core-CDNU4oKM.js";import"./index-Ch_XDzqB.js";import"./config-CTM8_93T.js";import"./payload-decoders-ClAu_OX0.js";import"./SignalIndicator-DvKCjwKG.js";import"./signal-scoring-CcBiRcks.js";import"./arrow-up-By-lyY8m.js";import"./copy-jAVnwXtf.js";import"./chevron-right-DiVetJOJ.js";import"./map-pin-C3ieg9t_.js";import"./triangle-alert-JpcXY4mr.js";import"./DataBox-B4su-zzA.js";import"./layers-Dd_4LhZ4.js";import"./route-BTnuOvzt.js";import"./activity-48nFba-7.js";import"./circle-check-DBemvAXd.js";import"./database-IcctMW15.js";const y=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"},j={nodeColor:"#4338CA",localColor:"#4F46E5",hubColor:"#6366F1",edgeColor:"#3B3F4A",ambiguousColor:"#F9D26F",highlightColor:"#B49DFF",sourceColor:"#39D98A",destinationColor:"#B49DFF"};function C(e,t){if(!e)return t;if(e.startsWith("#"))return e;const o=g(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 k(){if("undefined"==typeof document)return j;const e=document.documentElement,t=getComputedStyle(e);return{nodeColor:C(t.getPropertyValue("--map-node-stroke").trim(),j.nodeColor),localColor:C(t.getPropertyValue("--map-local-color").trim(),j.localColor),hubColor:C(t.getPropertyValue("--map-hub-color").trim(),j.hubColor),edgeColor:C(t.getPropertyValue("--map-edge-rest").trim(),j.edgeColor),ambiguousColor:C(t.getPropertyValue("--accent-secondary").trim(),j.ambiguousColor),highlightColor:C(t.getPropertyValue("--accent-primary").trim(),j.highlightColor),sourceColor:C(t.getPropertyValue("--accent-success").trim(),j.sourceColor),destinationColor:C(t.getPropertyValue("--accent-primary").trim(),j.destinationColor)}}function N({prefix:r,isLocal:i,isSource:n,isDestination:a,isLastHop:s,isHighlighted:l,isAnimating:d,isWardrive:c,candidate:u,onHover:m,onLeave:p,onClick:g}){const v=b(),[j,C]=e.useState(!1);e.useEffect(()=>{d&&v.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,v]);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-accent-primary/50 rounded-full",j&&"relative z-50"),animate:v,initial:{boxShadow:"0 0 0 0px rgba(249, 115, 22, 0)"},onMouseEnter:k,onMouseLeave:N,onClick:g,style:{pointerEvents:"auto"},children:[t.jsx("div",{className:o("flex items-center justify-center","w-7 h-7 rounded-full","bg-orange-500 text-white","shadow-lg border-2 border-orange-300/50","transition-transform duration-150",j&&"scale-110"),children:t.jsx(y,{className:"w-4 h-4",strokeWidth:2.5})}),j&&t.jsxs(h,{color:"orange",filled:!0,className:"ml-1 text-[10px] font-mono 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-accent-primary/50 rounded",j&&"relative z-50"),animate:v,initial:{boxShadow:"0 0 0 0px rgba(113, 156, 223, 0)"},onMouseEnter:k,onMouseLeave:N,onClick:g,style:{pointerEvents:"auto"},children:t.jsxs(h,{color:c?"orange":i?"amber":n?"green":s?"amber":a?"purple":"blue",filled:!0,className:"font-mono text-[10px] shadow-lg border border-current/30",children:[i&&t.jsx(f,{className:"w-2.5 h-2.5 mr-1"}),r,j&&u.name&&t.jsx("span",{className:"ml-1 opacity-75",children:u.name})]})})}function S({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||"#71717a",color:"#fff",fontSize:"8px",lineHeight:1,textShadow:"0 1px 1px rgba(0,0,0,0.4)"},children:e}),void 0!==o&&t.jsx(h,{color:"zinc",compact:!0,className:"!text-[9px] font-mono tabular-nums shadow-sm",children:o.toFixed(1)})]})}function w({resolvedPath:c,localNode:h,hubNodes:x=[],hoveredHopIndex:g,onHoverHop:f,traceSnr:b}){const y=void 0!==b&&b.length>0,j=e.useRef(null),C=r(),w=e.useMemo(()=>new Set(x),[x]),[F,L]=e.useState(null),D=u(),[E,M]=e.useState(!1),[P,H]=e.useState(0);e.useEffect(()=>{var e;const t=null==(e=j.current)?void 0:e.getMap();if(!t)return;const o=t.getCanvas();if(!o)return;const r=e=>{e.preventDefault()},i=()=>{H(e=>e+1)};return o.addEventListener("webglcontextlost",r),o.addEventListener("webglcontextrestored",i),()=>{o.removeEventListener("webglcontextlost",r),o.removeEventListener("webglcontextrestored",i)}},[P]);const{positions:$,markers:A,edges:I}=e.useMemo(()=>{const e=[],t=[],o=[],r=[];let i=0,n=!1;return c.hops.forEach((a,s)=>{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==b?void 0:b[t],a=c[0]-e[0],s=c[1]-e[1],l=Math.atan2(a,s)*(180/Math.PI),d=k();let u;u=n?"#F97316":void 0!==i?m()[p(i)]||"#71717a":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:n})}const u=!0===a.isSource,h=!0===a.isDestination,x=!0===d.isWardrive;n=x,l.forEach((o,r)=>{const n=[o.latitude,o.longitude];e.push(n);const d=0===r;t.push({position:n,prefix:a.prefix,confidence:a.confidence,candidateCount:l.length,hopIndex:s,candidate:o,isHub:w.has(o.hash),isPrimary:d,isSource:u,isDestination:h,validIndex:i})}),i++}),{positions:e,markers:t,edges:o}},[c,w,b]),B=e.useMemo(()=>{const e=A.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 n of e){const[e,a]=n.position;eo&&(o=e),ai&&(i=a)}return[[r,t],[i,o]]},[A]),V=e.useMemo(()=>{if(0===$.length)return h?[h.longitude,h.latitude]:[0,0];let e=0,t=0;for(const[o,r]of $)e+=o,t+=r;return[t/$.length,e/$.length]},[$,h]),W=e.useCallback(()=>{var e;const t=null==(e=j.current)?void 0:e.getMap();t&&B?(t.fitBounds(B,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:0}),setTimeout(()=>{M(!0)},50)):M(!0)},[B]),z=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=j.current)?void 0:e.getMap();t&&B&&t.fitBounds(B,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:300})},[z,E,B]);const O=D&&E,R=e.useCallback(e=>{L({longitude:e.position[1],latitude:e.position[0],marker:e})},[]);return 0===$.length?t.jsx("div",{className:"h-full flex items-center justify-center text-text-muted text-sm bg-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-bg-elevated flex items-center justify-center","transition-opacity duration-200 ease-out pointer-events-none",O?"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:O?1:0},children:t.jsxs(i,{ref:j,initialViewState:{longitude:V[0],latitude:V[1],zoom:10},onLoad:W,style:{height:"100%",width:"100%"},mapStyle:v,attributionControl:!1,children:[t.jsx(n,{mode:C}),I.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(s,{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}`)}),I.map((e,o)=>t.jsx(l,{longitude:e.midpoint[0],latitude:e.midpoint[1],anchor:"center",children:t.jsx(S,{hopNumber:o+1,snr:y?e.snrFwd:void 0,edgeColor:e.color})},`hop-${o}`)),(()=>{const e=A.filter(e=>e.isPrimary),o=e.length>1?e.length-2:-1;return e.map((e,r)=>{const i=g===e.hopIndex,n=r===o&&!e.candidate.isLocal&&!e.isDestination;return t.jsx(l,{longitude:e.position[1],latitude:e.position[0],anchor:"center",children:t.jsx(N,{prefix:e.prefix,isLocal:e.candidate.isLocal||!1,isSource:e.isSource,isDestination:e.isDestination,isLastHop:n,isHighlighted:i,isAnimating:!1,isWardrive:e.candidate.isWardrive||!1,candidate:e.candidate,onHover:()=>null==f?void 0:f(e.hopIndex),onLeave:()=>null==f?void 0:f(null),onClick:()=>R(e)})},`${e.hopIndex}-${e.candidate.hash}`)})})(),F&&t.jsx(d,{longitude:F.longitude,latitude:F.latitude,anchor:"bottom",offset:[0,-12],closeOnClick:!1,onClose:()=>L(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:F.marker.candidate.name}),(()=>{const e=k();return t.jsxs(t.Fragment,{children:[F.marker.isSource&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.sourceColor,color:"#000"},children:"SRC"}),F.marker.isDestination&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.destinationColor,color:"#000"},children:"DST"}),F.marker.isHub&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.hubColor,color:"#000"},children:"HUB"}),F.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"}),F.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-text-muted font-mono text-[10px]",children:[F.marker.prefix," • ",F.marker.candidate.hash.slice(0,10),"..."]}),!F.marker.isPrimary&&F.marker.candidateCount>1&&t.jsxs("div",{style:{color:k().ambiguousColor},children:["Alternative (",(100*F.marker.candidate.probability).toFixed(0),"%)"]}),F.marker.isPrimary&&F.marker.candidateCount>1&&t.jsxs("div",{className:"text-text-muted",children:[F.marker.candidateCount," candidates"]})]})})]},P)})]})}export{w as default}; diff --git a/frontend/dist/assets/RoomServer-BBBzVK_B.js b/frontend/dist/assets/RoomServer-bASTDJzO.js similarity index 98% rename from frontend/dist/assets/RoomServer-BBBzVK_B.js rename to frontend/dist/assets/RoomServer-bASTDJzO.js index f46b9c1d..ac7f1593 100644 --- a/frontend/dist/assets/RoomServer-BBBzVK_B.js +++ b/frontend/dist/assets/RoomServer-bASTDJzO.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 c}from"./PageLayout-CBx7rIBL.js";import{R as d,C as m}from"./Grid-OFJ4oe0a.js";import{c as x,b2 as u,R as p,K as h,bG as g,N as j,e as y,I as v,cD as f,B as N,aj as b,O as k,f as C,cE as w,cF as _,cG as S,cH as F,cI as M,cJ as A,cK as R,cL as T,cM as D,n as E,cx as I,aA as $}from"./index-CImKXCRQ.js";import{L,a as z,b as P}from"./listbox-DnYSFKvT.js";import{P as K,T as q,C as B}from"./ConfirmModal-C50H21Nf.js";import{M as H}from"./map-pin-lRKxIpXD.js";import{S as O,K as U,F as G,r as V}from"./KeycapButton-DjJYg-26.js";import{S as J,C as W,e as Y,g as Q,a as X,M as Z}from"./ChatBubble-jJzikYsj.js";import{C as ee}from"./Card-DfIcRbRE.js";import{K as se}from"./key-round-D-rRp0r8.js";import{C as te}from"./copy-CfZtRqCt.js";import{U as ae}from"./users-BZZVk2mu.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CDNU4oKM.js";import"./config-CTM8_93T.js";import"./triangle-alert-DRA45BSe.js";const ne=x("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"}]]),le=x("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"}]]),ie=x("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"}]]),re=x("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),oe=x("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 de({required:s,className:n,children:l,...i}){return e.jsxs(a,{className:t("text-sm font-medium text-text-primary select-none","data-[disabled]:opacity-50",i.title&&"cursor-help",n),...i,children:[l,s&&e.jsx("span",{className:"text-accent-danger ml-0.5","aria-hidden":"true",children:"*"})]})}function me({className:s,children:a,...l}){return e.jsx(n,{className:t("text-sm text-text-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-border-subtle hover:ring-2 transition-all duration-150","w-full max-w-[260px]","primary"===i?"hover:ring-accent-primary hover:bg-accent-primary/5":"hover:ring-accent-secondary hover:bg-accent-secondary/5"),children:[e.jsx("div",{className:t("p-3 rounded-xl","primary"===i?"bg-accent-primary/10 text-accent-primary":"bg-accent-secondary/10 text-accent-secondary"),children:s}),e.jsx("p",{className:"type-body-sm font-medium text-text-primary",children:a}),e.jsx("p",{className:"type-data-xs text-text-muted leading-relaxed",children:n})]})}function ue({onCreateRoom:s}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4",children:[e.jsx(u,{className:"w-12 h-12 text-text-muted opacity-30 mb-4"}),e.jsx("p",{className:"type-subheading text-text-secondary mb-1",children:"Add a Room Server"}),e.jsx("p",{className:"type-body-sm text-text-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(ie,{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 pe({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-text-muted hover:text-text-primary hover:bg-bg-surface/60","transition-all duration-150"),title:"Add room server",children:e.jsx(K,{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-bg-surface text-text-primary shadow-sm":"text-text-muted hover:text-text-secondary"),children:s.room_name},s.room_name)),i]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(L,{value:a??"",onChange:n,children:s.map(s=>e.jsx(z,{value:s.room_name,children:e.jsx(P,{children:s.room_name})},s.room_name))}),i]})}function he({open:s,onClose:t,mode:a,identity:n,repeaterConfig:i,onCreate:r,onUpdate:o,onDelete:c,onSendAdvert:d}){var m,x,u,p,k,C,w,_,S;const F="edit"===a&&n,M=`${s}-${(null==n?void 0:n.name)??""}-${a}`,[A,R]=l.useState(""),[T,D]=l.useState(""),[E,I]=l.useState(!1),[$,L]=l.useState(""),[z,P]=l.useState(""),[K,B]=l.useState(""),[O,U]=l.useState(""),[G,V]=l.useState(!1),[J,W]=l.useState(!1),[Y,Q]=l.useState(!1),[X,Z]=l.useState(null),[ee,se]=l.useState(M);if(M!==ee)if(se(M),Z(null),V(!1),W(!1),Q(!1),F)R((null==(m=n.settings)?void 0:m.node_name)??n.name),D(n.identity_key??""),I(!1),L((null==(x=n.settings)?void 0:x.admin_password)??""),P((null==(u=n.settings)?void 0:u.guest_password)??""),B((null==(k=null==(p=n.settings)?void 0:p.latitude)?void 0:k.toString())??""),U((null==(w=null==(C=n.settings)?void 0:C.longitude)?void 0:w.toString())??"");else{const e=i;R(""),D(""),I(!1),L(""),P(""),B(null!=(null==(_=null==e?void 0:e.repeater)?void 0:_.latitude)?e.repeater.latitude.toString():""),U(null!=(null==(S=null==e?void 0:e.repeater)?void 0:S.longitude)?e.repeater.longitude.toString():"")}const te=l.useCallback(()=>{const e={};return A&&(e.node_name=A),$&&(e.admin_password=$),z&&(e.guest_password=z),""!==K&&(e.latitude=parseFloat(K)),""!==O&&(e.longitude=parseFloat(O)),e},[A,$,z,K,O]),ae=l.useCallback(async()=>{if(!A.trim())return void Z("Room name is required");V(!0),Z(null);const e=F?n.name:function(e){if(!e)return"";const s=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return s?`${s}-room`:""}(A);let s;if(F)s=await o({name:n.name,settings:te()});else{const t={name:e,type:"room_server",settings:te()};T.trim()&&(t.identity_key=T.trim()),s=await r(t)}V(!1),s?t():Z("Failed to save. Check that the name is unique and passwords differ.")},[A,F,n,te,r,o,t]),ne=l.useCallback(async()=>{if(!F)return;W(!0);const e=await c(n.name);W(!1),e&&t()},[F,n,c,t]),ie=l.useCallback(async()=>{F&&(Q(!0),await d(n.name),Q(!1))},[F,n,d]);return e.jsxs(h,{open:s,onClose:t,size:"md",children:[e.jsx(g,{icon:F?void 0:e.jsx(le,{className:"w-5 h-5"}),title:F?"Edit Room Server":"Add Room Server"}),e.jsx(j,{children:e.jsxs("div",{className:"space-y-5",children:[F&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{color:n.registered?"green":"red",children:n.registered?"Active":"Inactive"}),n.identity_key&&e.jsxs("span",{className:"type-data-xs text-text-muted truncate",title:n.identity_key,children:["Key: ",n.identity_key.slice(0,16),"…"]})]}),e.jsxs(ce,{children:[e.jsx(de,{title:"What people see on the mesh",children:"Room Name"}),e.jsx(v,{value:A,onChange:e=>R(e.target.value),placeholder:"Room Name"})]}),!F&&e.jsxs(ce,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(de,{title:"The unique hex public ID",children:["Identity Key ",e.jsx("span",{className:"text-text-muted font-normal",children:"(Optional)"})]}),e.jsx("button",{type:"button",onClick:()=>I(e=>!e),className:"type-data-xs text-text-muted underline hover:text-text-secondary",children:E?"Hide":"Show"})]}),E&&e.jsxs(e.Fragment,{children:[e.jsx(v,{value:T,onChange:e=>D(e.target.value),placeholder:"Leave empty to auto-generate"}),e.jsx(me,{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(de,{children:[e.jsx(H,{className:"inline w-3.5 h-3.5 -mt-0.5 mr-1 text-text-muted"}),"Latitude"]}),e.jsx(v,{type:"number",step:"any",value:K,onChange:e=>B(e.target.value),placeholder:"0"})]}),e.jsxs(ce,{children:[e.jsxs(de,{children:[e.jsx(H,{className:"inline w-3.5 h-3.5 -mt-0.5 mr-1 text-text-muted"}),"Longitude"]}),e.jsx(v,{type:"number",step:"any",value:O,onChange:e=>U(e.target.value),placeholder:"0"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(ce,{children:[e.jsxs(de,{title:"Full access to room server",children:["Admin Password ",e.jsx("span",{className:"text-text-muted font-normal",children:"(Optional)"})]}),e.jsx(v,{type:"password",value:$,onChange:e=>L(e.target.value),placeholder:"None Set"})]}),e.jsxs(ce,{children:[e.jsxs(de,{title:"Can post and read, but not administer the room",children:["Guest Password ",e.jsx("span",{className:"text-text-muted font-normal",children:"(Optional)"})]}),e.jsx(v,{type:"password",value:z,onChange:e=>P(e.target.value),placeholder:"None Set"})]})]}),X&&e.jsx("p",{className:"type-data-xs text-accent-danger",children:X})]})}),e.jsxs(f,{children:[F&&e.jsxs("div",{className:"flex items-center gap-2 mr-auto",children:[e.jsxs(N,{color:"danger",plain:!0,onClick:ne,disabled:J,children:[e.jsx(q,{"data-slot":"icon"}),J?"Deleting…":"Delete"]}),e.jsxs(N,{color:"primary",plain:!0,onClick:ie,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:G,children:G?"Saving…":F?"Save Changes":"Create"})]})]})}const ge=l.createContext(null),je="room-tui";function ye({children:s}){const[t,a]=l.useState(()=>"1"===localStorage.getItem(je)),n=l.useCallback(()=>{a(e=>{const s=!e;return localStorage.setItem(je,s?"1":"0"),s})},[]);return e.jsx(ge.Provider,{value:{terminalMode:t,toggleTerminalMode:n},children:s})}function ve(){const e=l.useContext(ge);if(!e)throw new Error("useTerminalMode must be used within RoomTerminalProvider");return e}const fe=e=>"server"===e.author_pubkey||"system"===e.author_pubkey;function Ne({messages:s,onDelete:t,terminalMode:a,serverName:n}){const i=l.useRef(null),[r,o]=l.useState(!1),c=l.useMemo(()=>[...s].sort((e,s)=>e.post_timestamp-s.post_timestamp),[s]);l.useEffect(()=>{!r&&i.current&&(i.current.scrollTop=0)},[c.length,r]);const d=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===c.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-[#FF8C00]/40 text-sm font-mono",children:"> no messages in buffer_"}):e.jsxs(e.Fragment,{children:[e.jsx(u,{className:"w-10 h-10 text-text-muted opacity-20 mb-2"}),e.jsx("p",{className:"type-data-sm text-text-muted",children:"No messages yet"})]})}):a?e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:i,onScroll:d,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:c.map(s=>{const a=fe(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 hover:bg-[#1a1f2e] hover:shadow-[inset_2px_0_0_#3b82f6]",children:[e.jsxs("span",{className:"select-none shrink-0 text-[#666]",children:["[",l,"]"]}),e.jsxs("span",{className:"mx-1.5 shrink-0",children:[e.jsx("span",{className:r?"text-[#3B82F6]":"text-[#FF8C00]",children:"<"}),e.jsx("span",{className:r?"text-[#3B82F6]":"text-[#FF8C00]",children:i}),e.jsx("span",{className:r?"text-[#3B82F6]":"text-[#FF8C00]",children:">"})]}),e.jsx("span",{className:a?"text-[#888] italic":r?"text-white":"text-[#FF8C00]",children:s.message_text}),e.jsx("button",{onClick:()=>t(s.id),className:"opacity-0 group-hover:opacity-100 ml-auto pl-2 text-[#666] hover:text-[#E5484D] shrink-0",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 bg-[#1a1a1a] border border-[#333] text-[#FF8C00] hover:bg-[#222] transition-colors duration-150",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:d,className:"h-full overflow-y-auto scroll-smooth flex flex-col-reverse",children:e.jsx("div",{className:"space-y-3 p-4",children:c.map(s=>fe(s)?e.jsx(J,{text:s.message_text},s.id):e.jsx(W,{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-text-muted hover:text-accent-danger 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-bg-surface/90 backdrop-blur-sm ring-1 ring-border-subtle shadow-md text-text-secondary hover:text-text-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 be({roomName:s,onSend:t,disabled:a,terminalMode:n}){const[i,r]=l.useState(""),[o,c]=l.useState(!1),d=l.useRef(null),m=l.useCallback(async()=>{var e;const s=i.trim();if(!s||o)return;c(!0);const a=await t(s);c(!1),a&&(r(""),null==(e=d.current)||e.focus())},[i,o,t]),x=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 font-mono text-sm",children:[e.jsx("input",{ref:d,type:"text",value:i,onChange:e=>r(e.target.value),onKeyDown:x,placeholder:"type message...",disabled:a||o,className:"flex-1 bg-transparent text-white placeholder:text-[#666] outline-none ring-0 shadow-none border-none focus:outline-none focus:ring-0 font-mono"}),e.jsx("button",{onClick:m,disabled:!i.trim()||o||a,className:"text-[#FF8C00] disabled:text-[#333] hover:text-[#FFA540] transition-colors duration-100 px-1 font-mono text-xs",title:"Send",children:"[↵]"})]}):e.jsxs("div",{className:"flex items-center gap-2 p-3 border-t border-border-subtle",children:[e.jsx("input",{ref:d,type:"text",value:i,onChange:e=>r(e.target.value),onKeyDown:x,placeholder:`Message ${s}…`,disabled:a||o,className:"flex-1 surface-input radius-inner px-3 py-2 type-body-sm text-text-primary placeholder:text-text-muted outline-none ring-focus"}),e.jsx("button",{onClick:m,disabled:!i.trim()||o||a,className:"p-2 rounded-lg text-accent-primary hover:bg-accent-primary/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 ke({selectedName:s,selectedIdentity:t,messages:a,onSend:n,onDelete:r,onClear:o}){var c;const{terminalMode:d,toggleTerminalMode:m}=ve(),[x,u]=l.useState(!1),p=(null==(c=null==t?void 0:t.settings)?void 0:c.node_name)??s??void 0,h=l.useCallback(()=>{u(!1),o()},[o]);return d?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(O,{text:"chat",minChars:7,size:24})}),e.jsx("div",{className:"card-terminal-ridge flex-1"}),e.jsxs("div",{className:"keycap-well keycap-well--rounded flex items-center gap-1",children:[e.jsx(U,{icon:e.jsx(re,{className:"!w-4.5 !h-4.5"}),onClick:m,title:"Exit terminal mode"}),a.length>0&&e.jsx(U,{icon:e.jsx(q,{className:"!w-4 !h-4"}),onClick:()=>u(!0),title:"Clear all messages",iconActiveColor:"#E5484D",keycapSrc:"/assets/keycap-red.svg"})]})]}),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(Ne,{messages:a,onDelete:r,terminalMode:!0,serverName:p}),e.jsx("div",{className:"card-terminal-divider"}),s&&e.jsx(be,{roomName:s,onSend:n,disabled:!(null==t?void 0:t.registered),terminalMode:!0})]})})]}),e.jsx(B,{isOpen:x,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:()=>u(!1)})]}):e.jsxs(e.Fragment,{children:[e.jsxs(i,{noPadding:!0,className:"flex flex-col h-full overflow-hidden",children:[e.jsx(ee,{listHeader:!0,icon:e.jsx(ne,{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(re,{"data-slot":"icon",className:"!w-4 !h-4"})}),a.length>0&&e.jsx(N,{plain:!0,color:"danger",onClick:()=>u(!0),title:"Clear all messages",children:e.jsx(q,{"data-slot":"icon",className:"!w-4 !h-4"})})]})}),e.jsx(Ne,{messages:a,onDelete:r,terminalMode:!1,serverName:p}),s&&e.jsx(be,{roomName:s,onSend:n,disabled:!(null==t?void 0:t.registered),terminalMode:!1})]}),e.jsx(B,{isOpen:x,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:()=>u(!1)})]})}function Ce({name:s,onSend:t,isActive:a=!1}){const[n,i]=l.useState("idle"),r="held"===n,o="sending"===n||"sent"===n,c=l.useRef(),d=l.useCallback(()=>{o||i("held")},[o]),m=l.useCallback(async()=>{if("held"!==n)return;i("sending");const e=await t(s);i(e?"sent":"idle"),e&&(c.current=setTimeout(()=>i("idle"),2e3))},[s,t,n]),x=l.useCallback(()=>{"held"===n&&i("idle")},[n]);return l.useEffect(()=>()=>clearTimeout(c.current),[]),e.jsxs("div",{className:"keycap-group",children:[e.jsx("button",{onMouseDown:d,onMouseUp:m,onMouseLeave:x,onTouchStart:d,onTouchEnd:m,onTouchCancel:x,disabled:o,className:"keycap-btn"+(r||"sending"===n?" keycap-btn--pressed":""),title:"Send room server advert",children:e.jsx("div",{className:"keycap-well keycap-well--rounded",children:e.jsxs("div",{className:"keycap-wrap",children:[e.jsx("img",{src:"/assets/keycap-red.svg",alt:"",className:"keycap-btn__img",draggable:!1}),e.jsx("span",{className:"keycap-icon-overlay",style:{color:r||"sending"===n?"#E5484D":"#000000"},children:e.jsx(G,{})})]})})}),e.jsx("div",{className:"keycap-well keycap-well--fill",children:e.jsxs("div",{className:"indicator-key-pair",children:[e.jsxs("div",{className:`indicator-key indicator-key--${n}`,children:[e.jsx("span",{className:"indicator-key__label",children:"ADVERTISE"}),e.jsx("span",{className:"indicator-key__led"})]}),e.jsxs("div",{className:"indicator-key"+(a?" indicator-key--active":""),children:[e.jsx("span",{className:"indicator-key__label",children:"ACTIVE"}),e.jsx("span",{className:"indicator-key__led"})]})]})})]})}function we({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 font-mono text-[10px] leading-tight text-text-muted hover:text-text-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-accent-success flex-shrink-0"})]})}const _e=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:c}=l?Y(l):{emoji:null,cleanName:s.pubkey_prefix},d=l?Q(c):void 0,m=l?X(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",!d&&"bg-accent-primary/12"),style:d?{backgroundColor:d}:void 0,children:o?e.jsx("span",{className:"text-base leading-none",children:o}):e.jsx("span",{className:t("leading-none",d?"text-white text-[11px] font-bold tracking-tight":"text-accent-primary 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-bg-surface "+(i?"bg-accent-success":"bg-accent-secondary")})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[l?e.jsx("p",{className:"text-[13px] font-medium leading-tight text-text-primary truncate",children:l}):e.jsx("p",{className:"font-mono text-[13px] leading-tight text-text-primary truncate",children:s.pubkey_prefix}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[l&&e.jsx(we,{pubkey:s.pubkey}),l&&e.jsx("span",{className:"text-[10px] text-text-muted/40",children:"·"}),e.jsxs("span",{className:"text-[10px] leading-tight text-text-muted truncate",children:[!i&&e.jsxs("span",{className:"text-accent-secondary",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-text-muted hover:text-accent-danger hover:bg-accent-danger/8",title:"Remove client",children:e.jsx(oe,{className:"w-3.5 h-3.5"})})]})});function Se({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:"text-[#FF8C00] font-mono text-sm text-left px-4 py-4",children:""}):e.jsx("p",{className:"type-data-xs text-text-muted text-center py-4",children:"No clients connected"}):n?e.jsx("div",{className:"font-mono text-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 hover:bg-[#1a1f2e] hover:shadow-[inset_2px_0_0_#3b82f6]",children:[e.jsx("span",{className:n?"text-[#FF8C00]":"text-[#f59e0b]",children:"■"}),e.jsx("span",{className:"text-[#FF8C00] ml-2 shrink-0",children:a||l}),a&&e.jsxs("span",{className:"text-[#FF8C00] ml-1.5 shrink-0",children:["[",l,"]"]}),!n&&e.jsxs("span",{className:"text-[#f59e0b] ml-1.5",children:[s.unsynced_count,"unsync"]}),e.jsx("button",{onClick:()=>t(s.pubkey),className:"opacity-0 group-hover:opacity-100 ml-auto pl-2 text-[#666] hover:text-[#E5484D] shrink-0",title:"Remove",children:"×"})]},s.pubkey)})}):e.jsx("div",{className:"space-y-0.5 pt-1",children:s.map(s=>e.jsx(_e,{client:s,resolvedName:i.get(s.pubkey),onRemove:t},s.pubkey))})}function Fe({name:s,onSend:t}){const{terminalMode:a}=ve(),[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(b,{"data-slot":"icon"}),"idle"===n&&"Send Advert","sending"===n&&"Broadcasting…","sent"===n&&"Advert Sent"]})}function Me({identity:s,onSendAdvert:t}){var a,n,i,r,o,c,d,m,x,u,p,h,g,j,v,f,N,b,k,w,_,S,F,M,A,R,T,D,E,I;const{terminalMode:$}=ve(),[L,z]=l.useState(!1),P=l.useCallback(()=>{(null==s?void 0:s.identity_key)&&(navigator.clipboard.writeText(s.identity_key),z(!0),setTimeout(()=>z(!1),1500))},[null==s?void 0:s.identity_key]);return $?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",{className:"text-[#666]",children:"node"}),e.jsx("span",{className:"text-[#FF8C00]",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:"text-[#666]",children:"addr"}),e.jsx("span",{className:"text-[#FF8C00]",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",{className:"text-[#666]",children:"key"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-[#FF8C00] truncate max-w-[140px]",title:s.identity_key,children:[s.identity_key.slice(0,16),"…"]}),e.jsx("button",{type:"button",onClick:P,className:L?"text-[#666] text-xs":"text-[#666] hover:text-[#888] text-xs",children:L?"[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",{className:"text-[#666]",children:"loc"}),e.jsxs("span",{className:"text-[#FF8C00]",title:`${(null==(c=s.settings)?void 0:c.latitude)??"—"}, ${(null==(d=s.settings)?void 0:d.longitude)??"—"}`,children:[(null==(x=null==(m=s.settings)?void 0:m.latitude)?void 0:x.toFixed(4))??"—",", ",(null==(p=null==(u=s.settings)?void 0:u.longitude)?void 0:p.toFixed(4))??"—"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[#666]",children:"pass"}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:(null==(h=s.settings)?void 0:h.admin_password)?"text-[#FF8C00]":"text-[#666]",children:(null==(g=s.settings)?void 0:g.admin_password)?"[✓ admin]":"[— admin]"}),e.jsx("span",{className:(null==(j=s.settings)?void 0:j.guest_password)?"text-[#FF8C00]":"text-[#666]",children:(null==(v=s.settings)?void 0:v.guest_password)?"[✓ guest]":"[— guest]"})]})]})]}):e.jsx("span",{className:"text-[#666]",children:"no identity configured"}):e.jsxs("div",{className:"flex-shrink-0 border-t border-border-subtle",children:[e.jsx(ee,{listHeader:!0,icon:e.jsx(Z,{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-text-muted",children:"Node"}),e.jsx("span",{className:"type-data-sm text-text-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-text-muted",children:"Address"}),e.jsx("span",{className:"type-data-sm font-mono text-text-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-text-muted flex items-center gap-1",title:"The unique hex public ID",children:[e.jsx(se,{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-text-primary truncate max-w-[140px]",title:s.identity_key,children:[s.identity_key.slice(0,16),"…"]}),e.jsx("button",{type:"button",onClick:P,className:"inline-flex items-center gap-0.5",children:e.jsx(y,{color:L?"green":"zinc",children:L?e.jsxs(e.Fragment,{children:[e.jsx(C,{className:"w-3 h-3"}),"Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(te,{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-text-muted flex items-center gap-1",children:[e.jsx(H,{className:"w-3 h-3"}),"Location"]}),e.jsxs("span",{className:"type-data-sm font-mono text-text-primary",title:`${(null==(_=s.settings)?void 0:_.latitude)??"—"}, ${(null==(S=s.settings)?void 0:S.longitude)??"—"}`,children:[(null==(M=null==(F=s.settings)?void 0:F.latitude)?void 0:M.toFixed(4))??"—",", ",(null==(R=null==(A=s.settings)?void 0:A.longitude)?void 0:R.toFixed(4))??"—"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-xs text-text-muted",children:"Passwords"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs(y,{color:(null==(T=s.settings)?void 0:T.admin_password)?"green":"zinc",children:[(null==(D=s.settings)?void 0:D.admin_password)&&e.jsx(C,{className:"w-3 h-3"}),"Admin"]}),e.jsxs(y,{color:(null==(E=s.settings)?void 0:E.guest_password)?"green":"zinc",children:[(null==(I=s.settings)?void 0:I.guest_password)&&e.jsx(C,{className:"w-3 h-3"}),"Guest"]})]})]}),e.jsx("div",{className:"pt-3",children:e.jsx(Fe,{name:s.name,onSend:t})})]}):e.jsx("p",{className:"type-data-xs text-text-muted text-center py-3",children:"No identity configured"})]})}function Ae({selectedIdentity:s,clients:t,messages:a,onSendAdvert:n}){const{terminalMode:r}=ve(),o=l.useCallback(async e=>{w.setState(s=>({clients:s.clients.filter(s=>s.pubkey!==e)})),await V({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:"keycap-well keycap-well--rounded flex",style:{flex:1},children:e.jsx(Ce,{name:s.name,onSend:n,isActive:s.registered})})}),e.jsxs("div",{className:"flex flex-col flex-1 min-h-0 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(O,{text:"peers",minChars:7,size:24})}),e.jsx("div",{className:"card-terminal-ridge flex-1"}),e.jsx("span",{className:"seven-seg-panel",children:e.jsx(O,{text: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(Se,{clients:t,onRemove:o,messages:a,terminalMode:!0})})}),e.jsxs("div",{className:"card-terminal-header flex-shrink-0",children:[e.jsx("span",{className:"seven-seg-panel",children:e.jsx(O,{text:"status",minChars:8,size:24})}),e.jsx("div",{className:"card-terminal-ridge flex-1"}),e.jsx("span",{className:"seven-seg-panel",children:e.jsx(O,{text:(null==s?void 0:s.registered)?"on":"off",minChars:3,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 font-mono text-sm",children:e.jsx(Me,{identity:s,onSendAdvert:n})})})]})]}):e.jsxs(i,{compact:!0,className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsx(ee,{listHeader:!0,icon:e.jsx(ae,{className:"icon-sm"}),title:"Clients",actions:t.length>0?e.jsx("span",{className:"type-data-xs text-text-muted",children:t.length}):void 0}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsx(Se,{clients:t,onRemove:o,messages:a,terminalMode:!1})}),e.jsx(Me,{identity:s,onSendAdvert:n})]})}function Re(){const s=_(),t=S(),a=F(),n=M(),i=A(),x=R(),p=T(),h=D(),g=E(),{selectRoom:j,postMessage:v,deleteMessage:f,clearMessages:b,createRoom:k,updateRoom:C,deleteRoom:L,sendAdvert:z,markAsRead:P,startActivePolling:K}=w.getState(),[q,B]=l.useState(!1),[H,O]=l.useState("create"),[U,G]=l.useState("hybrid");l.useEffect(()=>{P()},[t,P]),l.useEffect(()=>K(),[K]);const V=l.useCallback(async e=>!!t&&v({room_name:t,message:e,author_pubkey:"server"}),[t,v]),J=l.useCallback((e="hybrid")=>{G(e),O("create"),B(!0)},[]),W=l.useCallback(()=>{O("edit"),B(!0)},[]),Y=a?e.jsxs("span",{className:"type-data-sm text-text-muted",children:[a.total_messages," messages · ",a.total_clients," clients",n&&e.jsxs(e.Fragment,{children:[" · ",e.jsx(y,{color:n.registered?"green":"red",className:"ml-0.5",children:n.registered?"Active":"Inactive"})]})]}):void 0,Q=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(pe,{rooms:s,selected:t,onSelect:j,onAdd:()=>J("hybrid")}),s.length>0&&e.jsx(N,{plain:!0,onClick:W,title:"Manage room server",children:e.jsx(I,{"data-slot":"icon"})})]});return 0!==s.length||0!==p.length||h?e.jsx(ye,{children:e.jsxs(r,{children:[e.jsx(o,{title:"Room Server",icon:e.jsx(u,{}),subtitle:Y,controls:Q}),e.jsx(c,{children:e.jsxs(d,{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(ke,{selectedName:t,selectedIdentity:n,messages:i,onSend:V,onDelete:f,onClear:b})}),e.jsx(m,{span:12,lg:4,className:"h-full",children:e.jsx(Ae,{selectedIdentity:n,clients:x,messages:i,onSendAdvert:z})})]})}),e.jsx(he,{open:q,onClose:()=>B(!1),mode:H,identity:n,repeaterConfig:null==g?void 0:g.config,onCreate:k,onUpdate:C,onDelete:L,onSendAdvert:z})]})}):e.jsx(ye,{children:e.jsxs(r,{children:[e.jsx(o,{title:"Room Server",icon:e.jsx(u,{})}),e.jsx(ue,{onCreateRoom:e=>J(e)}),e.jsx(he,{open:q,onClose:()=>B(!1),mode:"create",repeaterConfig:null==g?void 0:g.config,onCreate:async e=>{const s=await k(e);return s&&"dedicated"===U&&(await $.getState().setMode("monitor"),$.getState().clearModeMutation()),s},onUpdate:C,onDelete:L,onSendAdvert:z})]})})}export{Re 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 c}from"./PageLayout-DUXmuiZg.js";import{R as d,C as m}from"./Grid-OFJ4oe0a.js";import{c as x,b2 as u,R as p,K as h,bG as g,N as j,e as y,I as v,cD as f,B as N,aj as b,O as k,f as C,cE as w,cF as _,cG as S,cH as F,cI as M,cJ as A,cK as R,cL as T,cM as D,n as E,cx as I,aA as $}from"./index-B51aMfiH.js";import{L,a as z,b as P}from"./listbox-D8VLFZST.js";import{P as K,T as q,C as B}from"./ConfirmModal-ptKJzd5A.js";import{M as H}from"./map-pin-C3ieg9t_.js";import{S as O,K as U,F as G,r as V}from"./KeycapButton-edNKeR5-.js";import{S as J,C as W,e as Y,g as Q,a as X,M as Z}from"./ChatBubble-D6wREMt8.js";import{C as ee}from"./Card-BC0izdLh.js";import{K as se}from"./key-round-DyppBhTK.js";import{C as te}from"./copy-jAVnwXtf.js";import{U as ae}from"./users-cobitl86.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CDNU4oKM.js";import"./config-CTM8_93T.js";import"./triangle-alert-JpcXY4mr.js";const ne=x("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"}]]),le=x("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"}]]),ie=x("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"}]]),re=x("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),oe=x("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 de({required:s,className:n,children:l,...i}){return e.jsxs(a,{className:t("text-sm font-medium text-text-primary select-none","data-[disabled]:opacity-50",i.title&&"cursor-help",n),...i,children:[l,s&&e.jsx("span",{className:"text-accent-danger ml-0.5","aria-hidden":"true",children:"*"})]})}function me({className:s,children:a,...l}){return e.jsx(n,{className:t("text-sm text-text-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-border-subtle hover:ring-2 transition-all duration-150","w-full max-w-[260px]","primary"===i?"hover:ring-accent-primary hover:bg-accent-primary/5":"hover:ring-accent-secondary hover:bg-accent-secondary/5"),children:[e.jsx("div",{className:t("p-3 rounded-xl","primary"===i?"bg-accent-primary/10 text-accent-primary":"bg-accent-secondary/10 text-accent-secondary"),children:s}),e.jsx("p",{className:"type-body-sm font-medium text-text-primary",children:a}),e.jsx("p",{className:"type-data-xs text-text-muted leading-relaxed",children:n})]})}function ue({onCreateRoom:s}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4",children:[e.jsx(u,{className:"w-12 h-12 text-text-muted opacity-30 mb-4"}),e.jsx("p",{className:"type-subheading text-text-secondary mb-1",children:"Add a Room Server"}),e.jsx("p",{className:"type-body-sm text-text-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(ie,{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 pe({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-text-muted hover:text-text-primary hover:bg-bg-surface/60","transition-all duration-150"),title:"Add room server",children:e.jsx(K,{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-bg-surface text-text-primary shadow-sm":"text-text-muted hover:text-text-secondary"),children:s.room_name},s.room_name)),i]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(L,{value:a??"",onChange:n,children:s.map(s=>e.jsx(z,{value:s.room_name,children:e.jsx(P,{children:s.room_name})},s.room_name))}),i]})}function he({open:s,onClose:t,mode:a,identity:n,repeaterConfig:i,onCreate:r,onUpdate:o,onDelete:c,onSendAdvert:d}){var m,x,u,p,k,C,w,_,S;const F="edit"===a&&n,M=`${s}-${(null==n?void 0:n.name)??""}-${a}`,[A,R]=l.useState(""),[T,D]=l.useState(""),[E,I]=l.useState(!1),[$,L]=l.useState(""),[z,P]=l.useState(""),[K,B]=l.useState(""),[O,U]=l.useState(""),[G,V]=l.useState(!1),[J,W]=l.useState(!1),[Y,Q]=l.useState(!1),[X,Z]=l.useState(null),[ee,se]=l.useState(M);if(M!==ee)if(se(M),Z(null),V(!1),W(!1),Q(!1),F)R((null==(m=n.settings)?void 0:m.node_name)??n.name),D(n.identity_key??""),I(!1),L((null==(x=n.settings)?void 0:x.admin_password)??""),P((null==(u=n.settings)?void 0:u.guest_password)??""),B((null==(k=null==(p=n.settings)?void 0:p.latitude)?void 0:k.toString())??""),U((null==(w=null==(C=n.settings)?void 0:C.longitude)?void 0:w.toString())??"");else{const e=i;R(""),D(""),I(!1),L(""),P(""),B(null!=(null==(_=null==e?void 0:e.repeater)?void 0:_.latitude)?e.repeater.latitude.toString():""),U(null!=(null==(S=null==e?void 0:e.repeater)?void 0:S.longitude)?e.repeater.longitude.toString():"")}const te=l.useCallback(()=>{const e={};return A&&(e.node_name=A),$&&(e.admin_password=$),z&&(e.guest_password=z),""!==K&&(e.latitude=parseFloat(K)),""!==O&&(e.longitude=parseFloat(O)),e},[A,$,z,K,O]),ae=l.useCallback(async()=>{if(!A.trim())return void Z("Room name is required");V(!0),Z(null);const e=F?n.name:function(e){if(!e)return"";const s=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return s?`${s}-room`:""}(A);let s;if(F)s=await o({name:n.name,settings:te()});else{const t={name:e,type:"room_server",settings:te()};T.trim()&&(t.identity_key=T.trim()),s=await r(t)}V(!1),s?t():Z("Failed to save. Check that the name is unique and passwords differ.")},[A,F,n,te,r,o,t]),ne=l.useCallback(async()=>{if(!F)return;W(!0);const e=await c(n.name);W(!1),e&&t()},[F,n,c,t]),ie=l.useCallback(async()=>{F&&(Q(!0),await d(n.name),Q(!1))},[F,n,d]);return e.jsxs(h,{open:s,onClose:t,size:"md",children:[e.jsx(g,{icon:F?void 0:e.jsx(le,{className:"w-5 h-5"}),title:F?"Edit Room Server":"Add Room Server"}),e.jsx(j,{children:e.jsxs("div",{className:"space-y-5",children:[F&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{color:n.registered?"green":"red",children:n.registered?"Active":"Inactive"}),n.identity_key&&e.jsxs("span",{className:"type-data-xs text-text-muted truncate",title:n.identity_key,children:["Key: ",n.identity_key.slice(0,16),"…"]})]}),e.jsxs(ce,{children:[e.jsx(de,{title:"What people see on the mesh",children:"Room Name"}),e.jsx(v,{value:A,onChange:e=>R(e.target.value),placeholder:"Room Name"})]}),!F&&e.jsxs(ce,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(de,{title:"The unique hex public ID",children:["Identity Key ",e.jsx("span",{className:"text-text-muted font-normal",children:"(Optional)"})]}),e.jsx("button",{type:"button",onClick:()=>I(e=>!e),className:"type-data-xs text-text-muted underline hover:text-text-secondary",children:E?"Hide":"Show"})]}),E&&e.jsxs(e.Fragment,{children:[e.jsx(v,{value:T,onChange:e=>D(e.target.value),placeholder:"Leave empty to auto-generate"}),e.jsx(me,{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(de,{children:[e.jsx(H,{className:"inline w-3.5 h-3.5 -mt-0.5 mr-1 text-text-muted"}),"Latitude"]}),e.jsx(v,{type:"number",step:"any",value:K,onChange:e=>B(e.target.value),placeholder:"0"})]}),e.jsxs(ce,{children:[e.jsxs(de,{children:[e.jsx(H,{className:"inline w-3.5 h-3.5 -mt-0.5 mr-1 text-text-muted"}),"Longitude"]}),e.jsx(v,{type:"number",step:"any",value:O,onChange:e=>U(e.target.value),placeholder:"0"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(ce,{children:[e.jsxs(de,{title:"Full access to room server",children:["Admin Password ",e.jsx("span",{className:"text-text-muted font-normal",children:"(Optional)"})]}),e.jsx(v,{type:"password",value:$,onChange:e=>L(e.target.value),placeholder:"None Set"})]}),e.jsxs(ce,{children:[e.jsxs(de,{title:"Can post and read, but not administer the room",children:["Guest Password ",e.jsx("span",{className:"text-text-muted font-normal",children:"(Optional)"})]}),e.jsx(v,{type:"password",value:z,onChange:e=>P(e.target.value),placeholder:"None Set"})]})]}),X&&e.jsx("p",{className:"type-data-xs text-accent-danger",children:X})]})}),e.jsxs(f,{children:[F&&e.jsxs("div",{className:"flex items-center gap-2 mr-auto",children:[e.jsxs(N,{color:"danger",plain:!0,onClick:ne,disabled:J,children:[e.jsx(q,{"data-slot":"icon"}),J?"Deleting…":"Delete"]}),e.jsxs(N,{color:"primary",plain:!0,onClick:ie,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:G,children:G?"Saving…":F?"Save Changes":"Create"})]})]})}const ge=l.createContext(null),je="room-tui";function ye({children:s}){const[t,a]=l.useState(()=>"1"===localStorage.getItem(je)),n=l.useCallback(()=>{a(e=>{const s=!e;return localStorage.setItem(je,s?"1":"0"),s})},[]);return e.jsx(ge.Provider,{value:{terminalMode:t,toggleTerminalMode:n},children:s})}function ve(){const e=l.useContext(ge);if(!e)throw new Error("useTerminalMode must be used within RoomTerminalProvider");return e}const fe=e=>"server"===e.author_pubkey||"system"===e.author_pubkey;function Ne({messages:s,onDelete:t,terminalMode:a,serverName:n}){const i=l.useRef(null),[r,o]=l.useState(!1),c=l.useMemo(()=>[...s].sort((e,s)=>e.post_timestamp-s.post_timestamp),[s]);l.useEffect(()=>{!r&&i.current&&(i.current.scrollTop=0)},[c.length,r]);const d=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===c.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-[#FF8C00]/40 text-sm font-mono",children:"> no messages in buffer_"}):e.jsxs(e.Fragment,{children:[e.jsx(u,{className:"w-10 h-10 text-text-muted opacity-20 mb-2"}),e.jsx("p",{className:"type-data-sm text-text-muted",children:"No messages yet"})]})}):a?e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:i,onScroll:d,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:c.map(s=>{const a=fe(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 hover:bg-[#1a1f2e] hover:shadow-[inset_2px_0_0_#3b82f6]",children:[e.jsxs("span",{className:"select-none shrink-0 text-[#666]",children:["[",l,"]"]}),e.jsxs("span",{className:"mx-1.5 shrink-0",children:[e.jsx("span",{className:r?"text-[#3B82F6]":"text-[#FF8C00]",children:"<"}),e.jsx("span",{className:r?"text-[#3B82F6]":"text-[#FF8C00]",children:i}),e.jsx("span",{className:r?"text-[#3B82F6]":"text-[#FF8C00]",children:">"})]}),e.jsx("span",{className:a?"text-[#888] italic":r?"text-white":"text-[#FF8C00]",children:s.message_text}),e.jsx("button",{onClick:()=>t(s.id),className:"opacity-0 group-hover:opacity-100 ml-auto pl-2 text-[#666] hover:text-[#E5484D] shrink-0",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 bg-[#1a1a1a] border border-[#333] text-[#FF8C00] hover:bg-[#222] transition-colors duration-150",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:d,className:"h-full overflow-y-auto scroll-smooth flex flex-col-reverse",children:e.jsx("div",{className:"space-y-3 p-4",children:c.map(s=>fe(s)?e.jsx(J,{text:s.message_text},s.id):e.jsx(W,{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-text-muted hover:text-accent-danger 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-bg-surface/90 backdrop-blur-sm ring-1 ring-border-subtle shadow-md text-text-secondary hover:text-text-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 be({roomName:s,onSend:t,disabled:a,terminalMode:n}){const[i,r]=l.useState(""),[o,c]=l.useState(!1),d=l.useRef(null),m=l.useCallback(async()=>{var e;const s=i.trim();if(!s||o)return;c(!0);const a=await t(s);c(!1),a&&(r(""),null==(e=d.current)||e.focus())},[i,o,t]),x=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 font-mono text-sm",children:[e.jsx("input",{ref:d,type:"text",value:i,onChange:e=>r(e.target.value),onKeyDown:x,placeholder:"type message...",disabled:a||o,className:"flex-1 bg-transparent text-white placeholder:text-[#666] outline-none ring-0 shadow-none border-none focus:outline-none focus:ring-0 font-mono"}),e.jsx("button",{onClick:m,disabled:!i.trim()||o||a,className:"text-[#FF8C00] disabled:text-[#333] hover:text-[#FFA540] transition-colors duration-100 px-1 font-mono text-xs",title:"Send",children:"[↵]"})]}):e.jsxs("div",{className:"flex items-center gap-2 p-3 border-t border-border-subtle",children:[e.jsx("input",{ref:d,type:"text",value:i,onChange:e=>r(e.target.value),onKeyDown:x,placeholder:`Message ${s}…`,disabled:a||o,className:"flex-1 surface-input radius-inner px-3 py-2 type-body-sm text-text-primary placeholder:text-text-muted outline-none ring-focus"}),e.jsx("button",{onClick:m,disabled:!i.trim()||o||a,className:"p-2 rounded-lg text-accent-primary hover:bg-accent-primary/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 ke({selectedName:s,selectedIdentity:t,messages:a,onSend:n,onDelete:r,onClear:o}){var c;const{terminalMode:d,toggleTerminalMode:m}=ve(),[x,u]=l.useState(!1),p=(null==(c=null==t?void 0:t.settings)?void 0:c.node_name)??s??void 0,h=l.useCallback(()=>{u(!1),o()},[o]);return d?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(O,{text:"chat",minChars:7,size:24})}),e.jsx("div",{className:"card-terminal-ridge flex-1"}),e.jsxs("div",{className:"keycap-well keycap-well--rounded flex items-center gap-1",children:[e.jsx(U,{icon:e.jsx(re,{className:"!w-4.5 !h-4.5"}),onClick:m,title:"Exit terminal mode"}),a.length>0&&e.jsx(U,{icon:e.jsx(q,{className:"!w-4 !h-4"}),onClick:()=>u(!0),title:"Clear all messages",iconActiveColor:"#E5484D",keycapSrc:"/assets/keycap-red.svg"})]})]}),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(Ne,{messages:a,onDelete:r,terminalMode:!0,serverName:p}),e.jsx("div",{className:"card-terminal-divider"}),s&&e.jsx(be,{roomName:s,onSend:n,disabled:!(null==t?void 0:t.registered),terminalMode:!0})]})})]}),e.jsx(B,{isOpen:x,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:()=>u(!1)})]}):e.jsxs(e.Fragment,{children:[e.jsxs(i,{noPadding:!0,className:"flex flex-col h-full overflow-hidden",children:[e.jsx(ee,{listHeader:!0,icon:e.jsx(ne,{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(re,{"data-slot":"icon",className:"!w-4 !h-4"})}),a.length>0&&e.jsx(N,{plain:!0,color:"danger",onClick:()=>u(!0),title:"Clear all messages",children:e.jsx(q,{"data-slot":"icon",className:"!w-4 !h-4"})})]})}),e.jsx(Ne,{messages:a,onDelete:r,terminalMode:!1,serverName:p}),s&&e.jsx(be,{roomName:s,onSend:n,disabled:!(null==t?void 0:t.registered),terminalMode:!1})]}),e.jsx(B,{isOpen:x,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:()=>u(!1)})]})}function Ce({name:s,onSend:t,isActive:a=!1}){const[n,i]=l.useState("idle"),r="held"===n,o="sending"===n||"sent"===n,c=l.useRef(),d=l.useCallback(()=>{o||i("held")},[o]),m=l.useCallback(async()=>{if("held"!==n)return;i("sending");const e=await t(s);i(e?"sent":"idle"),e&&(c.current=setTimeout(()=>i("idle"),2e3))},[s,t,n]),x=l.useCallback(()=>{"held"===n&&i("idle")},[n]);return l.useEffect(()=>()=>clearTimeout(c.current),[]),e.jsxs("div",{className:"keycap-group",children:[e.jsx("button",{onMouseDown:d,onMouseUp:m,onMouseLeave:x,onTouchStart:d,onTouchEnd:m,onTouchCancel:x,disabled:o,className:"keycap-btn"+(r||"sending"===n?" keycap-btn--pressed":""),title:"Send room server advert",children:e.jsx("div",{className:"keycap-well keycap-well--rounded",children:e.jsxs("div",{className:"keycap-wrap",children:[e.jsx("img",{src:"/assets/keycap-red.svg",alt:"",className:"keycap-btn__img",draggable:!1}),e.jsx("span",{className:"keycap-icon-overlay",style:{color:r||"sending"===n?"#E5484D":"#000000"},children:e.jsx(G,{})})]})})}),e.jsx("div",{className:"keycap-well keycap-well--fill",children:e.jsxs("div",{className:"indicator-key-pair",children:[e.jsxs("div",{className:`indicator-key indicator-key--${n}`,children:[e.jsx("span",{className:"indicator-key__label",children:"ADVERTISE"}),e.jsx("span",{className:"indicator-key__led"})]}),e.jsxs("div",{className:"indicator-key"+(a?" indicator-key--active":""),children:[e.jsx("span",{className:"indicator-key__label",children:"ACTIVE"}),e.jsx("span",{className:"indicator-key__led"})]})]})})]})}function we({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 font-mono text-[10px] leading-tight text-text-muted hover:text-text-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-accent-success flex-shrink-0"})]})}const _e=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:c}=l?Y(l):{emoji:null,cleanName:s.pubkey_prefix},d=l?Q(c):void 0,m=l?X(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",!d&&"bg-accent-primary/12"),style:d?{backgroundColor:d}:void 0,children:o?e.jsx("span",{className:"text-base leading-none",children:o}):e.jsx("span",{className:t("leading-none",d?"text-white text-[11px] font-bold tracking-tight":"text-accent-primary 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-bg-surface "+(i?"bg-accent-success":"bg-accent-secondary")})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[l?e.jsx("p",{className:"text-[13px] font-medium leading-tight text-text-primary truncate",children:l}):e.jsx("p",{className:"font-mono text-[13px] leading-tight text-text-primary truncate",children:s.pubkey_prefix}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[l&&e.jsx(we,{pubkey:s.pubkey}),l&&e.jsx("span",{className:"text-[10px] text-text-muted/40",children:"·"}),e.jsxs("span",{className:"text-[10px] leading-tight text-text-muted truncate",children:[!i&&e.jsxs("span",{className:"text-accent-secondary",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-text-muted hover:text-accent-danger hover:bg-accent-danger/8",title:"Remove client",children:e.jsx(oe,{className:"w-3.5 h-3.5"})})]})});function Se({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:"text-[#FF8C00] font-mono text-sm text-left px-4 py-4",children:""}):e.jsx("p",{className:"type-data-xs text-text-muted text-center py-4",children:"No clients connected"}):n?e.jsx("div",{className:"font-mono text-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 hover:bg-[#1a1f2e] hover:shadow-[inset_2px_0_0_#3b82f6]",children:[e.jsx("span",{className:n?"text-[#FF8C00]":"text-[#f59e0b]",children:"■"}),e.jsx("span",{className:"text-[#FF8C00] ml-2 shrink-0",children:a||l}),a&&e.jsxs("span",{className:"text-[#FF8C00] ml-1.5 shrink-0",children:["[",l,"]"]}),!n&&e.jsxs("span",{className:"text-[#f59e0b] ml-1.5",children:[s.unsynced_count,"unsync"]}),e.jsx("button",{onClick:()=>t(s.pubkey),className:"opacity-0 group-hover:opacity-100 ml-auto pl-2 text-[#666] hover:text-[#E5484D] shrink-0",title:"Remove",children:"×"})]},s.pubkey)})}):e.jsx("div",{className:"space-y-0.5 pt-1",children:s.map(s=>e.jsx(_e,{client:s,resolvedName:i.get(s.pubkey),onRemove:t},s.pubkey))})}function Fe({name:s,onSend:t}){const{terminalMode:a}=ve(),[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(b,{"data-slot":"icon"}),"idle"===n&&"Send Advert","sending"===n&&"Broadcasting…","sent"===n&&"Advert Sent"]})}function Me({identity:s,onSendAdvert:t}){var a,n,i,r,o,c,d,m,x,u,p,h,g,j,v,f,N,b,k,w,_,S,F,M,A,R,T,D,E,I;const{terminalMode:$}=ve(),[L,z]=l.useState(!1),P=l.useCallback(()=>{(null==s?void 0:s.identity_key)&&(navigator.clipboard.writeText(s.identity_key),z(!0),setTimeout(()=>z(!1),1500))},[null==s?void 0:s.identity_key]);return $?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",{className:"text-[#666]",children:"node"}),e.jsx("span",{className:"text-[#FF8C00]",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:"text-[#666]",children:"addr"}),e.jsx("span",{className:"text-[#FF8C00]",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",{className:"text-[#666]",children:"key"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-[#FF8C00] truncate max-w-[140px]",title:s.identity_key,children:[s.identity_key.slice(0,16),"…"]}),e.jsx("button",{type:"button",onClick:P,className:L?"text-[#666] text-xs":"text-[#666] hover:text-[#888] text-xs",children:L?"[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",{className:"text-[#666]",children:"loc"}),e.jsxs("span",{className:"text-[#FF8C00]",title:`${(null==(c=s.settings)?void 0:c.latitude)??"—"}, ${(null==(d=s.settings)?void 0:d.longitude)??"—"}`,children:[(null==(x=null==(m=s.settings)?void 0:m.latitude)?void 0:x.toFixed(4))??"—",", ",(null==(p=null==(u=s.settings)?void 0:u.longitude)?void 0:p.toFixed(4))??"—"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[#666]",children:"pass"}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:(null==(h=s.settings)?void 0:h.admin_password)?"text-[#FF8C00]":"text-[#666]",children:(null==(g=s.settings)?void 0:g.admin_password)?"[✓ admin]":"[— admin]"}),e.jsx("span",{className:(null==(j=s.settings)?void 0:j.guest_password)?"text-[#FF8C00]":"text-[#666]",children:(null==(v=s.settings)?void 0:v.guest_password)?"[✓ guest]":"[— guest]"})]})]})]}):e.jsx("span",{className:"text-[#666]",children:"no identity configured"}):e.jsxs("div",{className:"flex-shrink-0 border-t border-border-subtle",children:[e.jsx(ee,{listHeader:!0,icon:e.jsx(Z,{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-text-muted",children:"Node"}),e.jsx("span",{className:"type-data-sm text-text-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-text-muted",children:"Address"}),e.jsx("span",{className:"type-data-sm font-mono text-text-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-text-muted flex items-center gap-1",title:"The unique hex public ID",children:[e.jsx(se,{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-text-primary truncate max-w-[140px]",title:s.identity_key,children:[s.identity_key.slice(0,16),"…"]}),e.jsx("button",{type:"button",onClick:P,className:"inline-flex items-center gap-0.5",children:e.jsx(y,{color:L?"green":"zinc",children:L?e.jsxs(e.Fragment,{children:[e.jsx(C,{className:"w-3 h-3"}),"Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(te,{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-text-muted flex items-center gap-1",children:[e.jsx(H,{className:"w-3 h-3"}),"Location"]}),e.jsxs("span",{className:"type-data-sm font-mono text-text-primary",title:`${(null==(_=s.settings)?void 0:_.latitude)??"—"}, ${(null==(S=s.settings)?void 0:S.longitude)??"—"}`,children:[(null==(M=null==(F=s.settings)?void 0:F.latitude)?void 0:M.toFixed(4))??"—",", ",(null==(R=null==(A=s.settings)?void 0:A.longitude)?void 0:R.toFixed(4))??"—"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-xs text-text-muted",children:"Passwords"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs(y,{color:(null==(T=s.settings)?void 0:T.admin_password)?"green":"zinc",children:[(null==(D=s.settings)?void 0:D.admin_password)&&e.jsx(C,{className:"w-3 h-3"}),"Admin"]}),e.jsxs(y,{color:(null==(E=s.settings)?void 0:E.guest_password)?"green":"zinc",children:[(null==(I=s.settings)?void 0:I.guest_password)&&e.jsx(C,{className:"w-3 h-3"}),"Guest"]})]})]}),e.jsx("div",{className:"pt-3",children:e.jsx(Fe,{name:s.name,onSend:t})})]}):e.jsx("p",{className:"type-data-xs text-text-muted text-center py-3",children:"No identity configured"})]})}function Ae({selectedIdentity:s,clients:t,messages:a,onSendAdvert:n}){const{terminalMode:r}=ve(),o=l.useCallback(async e=>{w.setState(s=>({clients:s.clients.filter(s=>s.pubkey!==e)})),await V({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:"keycap-well keycap-well--rounded flex",style:{flex:1},children:e.jsx(Ce,{name:s.name,onSend:n,isActive:s.registered})})}),e.jsxs("div",{className:"flex flex-col flex-1 min-h-0 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(O,{text:"peers",minChars:7,size:24})}),e.jsx("div",{className:"card-terminal-ridge flex-1"}),e.jsx("span",{className:"seven-seg-panel",children:e.jsx(O,{text: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(Se,{clients:t,onRemove:o,messages:a,terminalMode:!0})})}),e.jsxs("div",{className:"card-terminal-header flex-shrink-0",children:[e.jsx("span",{className:"seven-seg-panel",children:e.jsx(O,{text:"status",minChars:8,size:24})}),e.jsx("div",{className:"card-terminal-ridge flex-1"}),e.jsx("span",{className:"seven-seg-panel",children:e.jsx(O,{text:(null==s?void 0:s.registered)?"on":"off",minChars:3,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 font-mono text-sm",children:e.jsx(Me,{identity:s,onSendAdvert:n})})})]})]}):e.jsxs(i,{compact:!0,className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsx(ee,{listHeader:!0,icon:e.jsx(ae,{className:"icon-sm"}),title:"Clients",actions:t.length>0?e.jsx("span",{className:"type-data-xs text-text-muted",children:t.length}):void 0}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsx(Se,{clients:t,onRemove:o,messages:a,terminalMode:!1})}),e.jsx(Me,{identity:s,onSendAdvert:n})]})}function Re(){const s=_(),t=S(),a=F(),n=M(),i=A(),x=R(),p=T(),h=D(),g=E(),{selectRoom:j,postMessage:v,deleteMessage:f,clearMessages:b,createRoom:k,updateRoom:C,deleteRoom:L,sendAdvert:z,markAsRead:P,startActivePolling:K}=w.getState(),[q,B]=l.useState(!1),[H,O]=l.useState("create"),[U,G]=l.useState("hybrid");l.useEffect(()=>{P()},[t,P]),l.useEffect(()=>K(),[K]);const V=l.useCallback(async e=>!!t&&v({room_name:t,message:e,author_pubkey:"server"}),[t,v]),J=l.useCallback((e="hybrid")=>{G(e),O("create"),B(!0)},[]),W=l.useCallback(()=>{O("edit"),B(!0)},[]),Y=a?e.jsxs("span",{className:"type-data-sm text-text-muted",children:[a.total_messages," messages · ",a.total_clients," clients",n&&e.jsxs(e.Fragment,{children:[" · ",e.jsx(y,{color:n.registered?"green":"red",className:"ml-0.5",children:n.registered?"Active":"Inactive"})]})]}):void 0,Q=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(pe,{rooms:s,selected:t,onSelect:j,onAdd:()=>J("hybrid")}),s.length>0&&e.jsx(N,{plain:!0,onClick:W,title:"Manage room server",children:e.jsx(I,{"data-slot":"icon"})})]});return 0!==s.length||0!==p.length||h?e.jsx(ye,{children:e.jsxs(r,{children:[e.jsx(o,{title:"Room Server",icon:e.jsx(u,{}),subtitle:Y,controls:Q}),e.jsx(c,{children:e.jsxs(d,{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(ke,{selectedName:t,selectedIdentity:n,messages:i,onSend:V,onDelete:f,onClear:b})}),e.jsx(m,{span:12,lg:4,className:"h-full",children:e.jsx(Ae,{selectedIdentity:n,clients:x,messages:i,onSendAdvert:z})})]})}),e.jsx(he,{open:q,onClose:()=>B(!1),mode:H,identity:n,repeaterConfig:null==g?void 0:g.config,onCreate:k,onUpdate:C,onDelete:L,onSendAdvert:z})]})}):e.jsx(ye,{children:e.jsxs(r,{children:[e.jsx(o,{title:"Room Server",icon:e.jsx(u,{})}),e.jsx(ue,{onCreateRoom:e=>J(e)}),e.jsx(he,{open:q,onClose:()=>B(!1),mode:"create",repeaterConfig:null==g?void 0:g.config,onCreate:async e=>{const s=await k(e);return s&&"dedicated"===U&&(await $.getState().setMode("monitor"),$.getState().clearModeMutation()),s},onUpdate:C,onDelete:L,onSendAdvert:z})]})})}export{Re as default}; diff --git a/frontend/dist/assets/SignalIndicator-JkITXu3r.js b/frontend/dist/assets/SignalIndicator-DvKCjwKG.js similarity index 98% rename from frontend/dist/assets/SignalIndicator-JkITXu3r.js rename to frontend/dist/assets/SignalIndicator-DvKCjwKG.js index c9dc8ac4..0d2ba0f1 100644 --- a/frontend/dist/assets/SignalIndicator-JkITXu3r.js +++ b/frontend/dist/assets/SignalIndicator-DvKCjwKG.js @@ -1 +1 @@ -import{c as e}from"./index-CImKXCRQ.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 n=e("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),o=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"}]]),i=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"}]]),l=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"}]]),c=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"}]]),x=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"}]]),h=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={ADVERT:"purple",ACK:"emerald",REQ:"sky",RESPONSE:"sky",TXT_MSG:"teal",GRP_TXT:"teal",FLOOD:"sky",GRP_DATA:"indigo",PATH:"amber",MULTIPART:"violet",TRACE:"orange",ANON_REQ:"pink",RAW_CUSTOM:"fuchsia"},m={FLOOD:"sky",T_FLOOD:"sky",DIRECT:"cyan",T_DIRECT:"cyan"},y={rx:"sky",forward:"teal",duplicate:"zinc",tx:"amber",dropped:"rose"},g={neighbor:"amber",hub:"purple",gateway:"indigo",backbone:"purple",repeater:"teal",room:"pink",companion:"blue",client:"indigo",mobile:"orange"},f={hub:"amber",backbone:"purple",relay:"cyan",edge:"brown"},k={high:"green",medium:"amber",low:"orange",insufficient:"brown"},j={direct:"amber",multihop:"brown"},b={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)"},w={excellent:"#4ADE80",good:"#A3E635",fair:"#FACC15",weak:"#FB923C",poor:"#EF4444"};function v(e){return e>=-90?"excellent":e>=-100?"good":e>=-110?"fair":e>=-120?"weak":"poor"}function M(e,a){return a?{backgroundColor:w[e],"--p3-color":b[e]}:{backgroundColor:"rgba(255, 255, 255, 0.1)"}}function N(e){return e?"signal-bar-active":""}function A({rssi:e,className:a="w-4 h-4"}){const s=v(e),n=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-text-muted"}}(s),o=t(n,a);switch(s){case"excellent":return r.jsx(x,{className:o});case"good":return r.jsx(l,{className:o});case"fair":return r.jsx(d,{className:o});case"weak":return r.jsx(c,{className:o});default:return r.jsx(p,{className:o})}}const T=a.memo(function({rssi:e,snr:a,compact:n=!1,showValues:o=!0,radioConfig:i,nfPenalty:l=0}){const c=void 0!==a?function(e,a,t,r=0){const n=s(a,e,t,r);return n?function(e){switch(e){case"excellent":return"excellent";case"good":return"good";case"fair":return"fair";case"poor":return"weak";case"critical":return"poor"}}(n.finalGrade):v(e)}(e,a,i,l):v(e),d={excellent:4,good:3,fair:2,weak:1,poor:0}[c];return n?r.jsxs("div",{className:"flex items-center gap-1.5",children:[o&&r.jsx("span",{className:"text-[10px] font-mono text-text-secondary tabular-nums w-[32px] text-left",children:e}),r.jsx("div",{className:"flex items-end gap-[2px] h-3 w-[14px]",children:Array.from({length:4}).map((e,a)=>r.jsx("div",{className:t("w-[3px] rounded-[1px] transition-colors",N(ar.jsx("div",{className:t("w-[3px] rounded-[1px] transition-colors",N(a=-90?"excellent":e>=-100?"good":e>=-110?"fair":e>=-120?"weak":"poor"}function M(e,a){return a?{backgroundColor:w[e],"--p3-color":b[e]}:{backgroundColor:"rgba(255, 255, 255, 0.1)"}}function N(e){return e?"signal-bar-active":""}function A({rssi:e,className:a="w-4 h-4"}){const s=v(e),n=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-text-muted"}}(s),o=t(n,a);switch(s){case"excellent":return r.jsx(x,{className:o});case"good":return r.jsx(l,{className:o});case"fair":return r.jsx(d,{className:o});case"weak":return r.jsx(c,{className:o});default:return r.jsx(p,{className:o})}}const T=a.memo(function({rssi:e,snr:a,compact:n=!1,showValues:o=!0,radioConfig:i,nfPenalty:l=0}){const c=void 0!==a?function(e,a,t,r=0){const n=s(a,e,t,r);return n?function(e){switch(e){case"excellent":return"excellent";case"good":return"good";case"fair":return"fair";case"poor":return"weak";case"critical":return"poor"}}(n.finalGrade):v(e)}(e,a,i,l):v(e),d={excellent:4,good:3,fair:2,weak:1,poor:0}[c];return n?r.jsxs("div",{className:"flex items-center gap-1.5",children:[o&&r.jsx("span",{className:"text-[10px] font-mono text-text-secondary tabular-nums w-[32px] text-left",children:e}),r.jsx("div",{className:"flex items-end gap-[2px] h-3 w-[14px]",children:Array.from({length:4}).map((e,a)=>r.jsx("div",{className:t("w-[3px] rounded-[1px] transition-colors",N(ar.jsx("div",{className:t("w-[3px] rounded-[1px] transition-colors",N(ae-t);return{median:Me(t,50),p90:Me(t,90),p95:Me(t,95),p99:Me(t,99),max:t[t.length-1],min:t[0]}}function Ce(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"}function Te({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;return t.jsx("div",{className:"flex-shrink-0 pt-3 mt-2",children:t.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1 font-mono text-xs ml-9",onMouseLeave:()=>i(null),children:a.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,x=u>1e-4,h=l===e.key,p=l&&!h||d&&o<=1e-4;return t.jsxs("div",{className:s("flex items-center gap-1.5 transition-opacity cursor-pointer hover:opacity-80",p&&"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-text-secondary whitespace-nowrap",children:e.label}),x&&t.jsxs("span",{className:s("tabular-nums",d?"text-text-primary":"text-text-muted"),children:[(100*u).toFixed(1),"%"]})]},e.key)})})})}const Ae='ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace';function Fe(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 Pe(r,i,l,t,s,a,n,o),o}function Pe(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,x=0;for(let b=0;bs?a/s:s/a,n>s?n/s:s/n);if(!(l<=u))break;u=l,x=b+1,m=t}const h=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:h,h:s,index:t[b]}:{x:a+p,y:n,w:s,h:h,index:t[b]},p+=s}const f=e.slice(x),g=t.slice(x),y=s-m;c?Pe(f,g,y,a+h,n,l-h,i,r):Pe(f,g,y,a,n+h,l,i-h,r)}function Re(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 x=n(t.typeNum),h=null!==l&&l!==r.index;e.save(),e.globalAlpha=h?.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=x,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 ${Ae}`,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 ${Ae}`,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 Le({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-border-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-text-primary",children:e.name})]}),t.jsxs("div",{className:"space-y-0.5 type-data-xs text-text-muted",children:[t.jsxs("div",{className:"flex justify-between gap-4",children:[t.jsx("span",{children:i?"Airtime":"Count"}),t.jsx("span",{className:"text-text-primary tabular-nums font-medium",children:i?De(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-text-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-text-primary tabular-nums font-medium",children:i?De(s):s.toLocaleString()})]})]})]})})}function De(e){return e>=6e4?`${(e/6e4).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`}function _e({sortedTypes:s,aggregateShares:a,mode:l="share"}){var i,r,o;const[c,d]=e.useState(null),[m,u]=e.useState(null),[x,h]=e.useState(0),[p,f]=e.useState(null),g=e.useRef(null),y=e.useRef(null),b=e.useRef([]),j="airtime"===l,v=e.useMemo(()=>s.reduce((e,t)=>e+(j?t.totalAirtime:t.totalCount),0),[s,j]),N=e.useMemo(()=>s.map((e,t)=>({name:e.label,size:j?e.totalAirtime:e.totalCount,index:t,typeNum:e.typeNum,key:e.key})),[s,j]);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=Fe(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),Re(r,i,N,v,c,l))},[N,v,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=Fe(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),Re(r,i,N,v,c,l))});return t.observe(e),()=>t.disconnect()},[N,v]);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?(h(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===v?t.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[t.jsx(I,{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(Le,{data:S,total:v,color:C,position:m,containerWidth:x,isAirtime:j})]}),t.jsx(Te,{sortedTypes:s,highlightedType:p,onTypeHover:M,aggregateShares:a})]})}function $e(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 Ee({packets:s,mode:a,startTs:n,endTs:m,radioConfig:u,bucketCount:x}){const h=e.useMemo(()=>l(),[]),p=h.blue,f=h.red,g=h.yellow,[y,b]=e.useState(null),{trendData:j,totals:v}=e.useMemo(()=>{if(0===s.length)return{trendData:[],totals:{rxBytes:0,txBytes:0,rxAirtime:0,txAirtime:0}};const e=m-n,t=Math.min(Math.ceil(e/300),x),l=e/t,o=[];let c=0,d=0,h=0,p=0;for(const a of s){const e=a.timestamp;if(e=m)continue;const t=i(a),s=r(a,{spreadingFactor:u.sf,bandwidthHz:u.bw,codingRate:u.cr,preambleLength:u.preamble}),l={timestamp:e,rxAirtime:0,txAirtime:0,rxBytes:0,txBytes:0};a.transmitted?(l.txAirtime=s,l.txBytes=t,d+=t,p+=s):(l.rxAirtime=s,l.rxBytes=t,c+=t,h+=s),o.push(l)}o.sort((e,t)=>e.timestamp-t.timestamp);const f=new Float64Array(o.length+1),g=new Float64Array(o.length+1),y=new Float64Array(o.length+1),b=new Float64Array(o.length+1),j=new Float64Array(o.length);for(let s=0;s{let t=0,s=j.length;for(;t>>1;j[a]0?t:null,tx:s>0?s:null})}else{const t=(f[r]-f[i])/w*100,s=(g[r]-g[i])/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:c,txBytes:d,rxAirtime:h,txAirtime:p}}},[s,n,m,x,a,u]),N=e.useMemo(()=>{if(0===j.length)return"share"===a?100:10;let e=0;for(const s of j){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))},[j,a]),w=e.useMemo(()=>{if(null!==y&&j[y]){const e=j[y],t=e.rx??0,s=e.tx??0;return"share"===a?{rx:$e(t),tx:$e(s),total:$e(t+s),isHovered:!0}:{rx:`${t.toFixed(2)}%`,tx:`${s.toFixed(2)}%`,total:`${(t+s).toFixed(2)}%`,isHovered:!0}}if("share"===a)return{rx:$e(v.rxBytes),tx:$e(v.txBytes),total:$e(v.rxBytes+v.txBytes),isHovered:!1};{let e=0,t=0,s=0;for(const l of j)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}}},[y,j,v,a]),k=e.useMemo(()=>{const e=m-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,m]),M=e.useCallback(e=>{b(e)},[]);return 0===j.length?t.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[t.jsx(I,{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-text-secondary",style:{height:20,paddingLeft:44,paddingRight:8},children:t.jsx("div",{className:"relative w-full h-full flex items-center",children:k.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(o,{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(c,{data:j,yAxisMode:"share"===a?"share":"airtime",yMax:N,onHover:M})})]}),t.jsxs("div",{className:"flex items-center justify-between mt-1.5 sm:mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 text-xs font-mono 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:p}}),t.jsx("span",{className:"text-text-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:f}}),t.jsx("span",{className:"text-text-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:g}}),t.jsx("span",{className:"text-text-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-text-primary",children:w.rx}),t.jsx(d,{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-text-primary",children:w.tx}),t.jsx(d,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"TX"})]})]})]})]})}const ze=m;function Be({mode:s,packets:a,startTs:n,endTs:l,radioConfig:o,sortedTypes:c,aggregateShares:d,noiseFloorAnomalies:m,showNoiseFloorOverlay:x,overlayOpacity:h=.5}){const[p,f]=e.useState(null),[g,y]=e.useState(null),b=e.useMemo(()=>(l-n)/3600,[n,l]),j=e.useCallback(e=>{y(e)},[]),v=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 o=[],c=new Map;for(const t of e){const e=t.type??t.payload_type??-1,a=i(t);let d;if(d="airtime"===n?r(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};o.push(u),c.has(m)||c.set(m,[]),c.get(m).push(u)}if(0===o.length)return null;const d=[],m=[],u=[],x=new Map;if("share"===n)for(const[,t]of c)for(const e of t)x.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;x.set(a,t)}}for(const t of o){const e=x.get(t);void 0!==e&&(d.push(e),m.push(t.timestamp),u.push(t.packetType))}let h=m[0],p=m[0];for(let t=1;tp&&(p=m[t]);const f=p-h||1,g=[...d].sort((e,t)=>e-t),y=g[0],b=g[g.length-1],j=Math.floor(.05*g.length),v=Math.floor(.5*g.length),N=Math.min(Math.ceil(.95*g.length),g.length-1),w=g[j],k=g[v],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 F=new Float32Array(2*d.length),P=new Float32Array(d.length),R=new Uint8Array(d.length),L=new Float32Array(d.length);for(let t=0;t=0?u[t]:255,L[t]=m[t]}return{points:F,rawValues:P,packetTypes:R,timestamps:L,count:d.length,minTime:h,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",o),[N,w]=e.useState(null),k=e.useCallback((e,t)=>{f(e),w(t??null)},[]),M=e.useMemo(()=>{if(null===N||!v||0===v.count)return null;const e=v.maxTime-v.minTime||1,t=v.minTime+N*e;let s;s=b>=168?75:b>=72?35:b>=24?15:b>=3?10:5;const a=60*s/2;return{start:t-a,end:t+a}},[N,v,b]),S=e.useMemo(()=>M?new Date((M.start+M.end)/2*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}):null,[M]),C=e.useMemo(()=>{if(null===p||!M)return null;const e=S??"",{start:t,end:n}=M,l=a.filter(e=>e.timestamp>=t&&e.timestamp({key:e.key,label:e.label,value:0,color:ze(e.typeNum)}))};const i=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(i.set(e,(i.get(e)??0)+1),m++,o){const t=r(s,{spreadingFactor:o.sf,bandwidthHz:o.bw,codingRate:o.cr,preambleLength:o.preamble});d.set(e,(d.get(e)??0)+t),u+=t}}const x=c.map(e=>{let t;return t="airtime"===s?u>0?(d.get(e.key)??0)/u:0:m>0?(i.get(e.key)??0)/m:0,{key:e.key,label:e.label,value:t,color:ze(e.typeNum)}});return{timestamp:(t+n)/2,timeLabel:e,items:x}},[p,M,S,a,c,s,o]);return v&&0!==v.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(u,{scatterData:v,yAxisMode:"share"===s?"share":"airtime",onHover:k,noiseFloorAnomalies:m,showNoiseFloorOverlay:x,overlayOpacity:h,highlightedType:g,timeRangeHours:b})}),S&&t.jsx("div",{className:"absolute top-1 right-1 px-2 py-0.5 bg-bg-elevated/90 rounded text-xs text-accent-secondary font-mono pointer-events-none",children:S})]}),t.jsx(Te,{sortedTypes:c,highlightedType:g,onTypeHover:j,aggregateShares:d,hoverData:C})]}):t.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[t.jsx(I,{className:"w-6 h-6 mr-2 opacity-50"}),t.jsx("span",{children:"No packet data available"})]})}function He({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 qe({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(be,{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(fe,{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(I,{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(we,{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(ye,{className:"w-3.5 h-3.5"})})]})}function Oe({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(he,{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(Y,{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-accent-danger text-white text-[10px] font-bold flex items-center justify-center pointer-events-none z-10",children:a>99?"99+":a})]})}const We={sf:10,bw:25e4,cr:5,preamble:8};function Ge(e){return p[e]??`TYPE_${e.toString(16).toUpperCase()}`}function Ie(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-k.current);if(0===e&&v.length>0)return;w.current&&clearTimeout(w.current);const t=e>100?50:500;return w.current=setTimeout(()=>{k.current=s.length,N(s)},t),()=>{w.current&&clearTimeout(w.current)}},[s,v.length]);const M=e.useMemo(()=>function(e,t){const s=new Map;for(const n of e){const e=n.type??n.payload_type??-1,a=r(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:Ge(n),totalCount:l.count,totalAirtime:l.airtime});return a.sort((e,t)=>t.totalCount-e.totalCount)}(v,o),[v,o]),S=e.useMemo(()=>{if("ema"!==d&&"ultra"!==d)return 0;const e=(l-a)/i,{handleSize:t}=Ye(d,e,i);return t},[d,a,l,i]),C=e.useMemo(()=>function(e,t,s,a,n,l,i=0){const o=s-t,c=o/a,d=1e3*c,m=o/3600,u=t-i*c,x=s+i*c,h=a+2*i,p=[];for(let r=0;r24?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=x)continue;const t=Math.min(Math.floor((e-u)/c),h-1),s=`TYPE_${f.type??f.payload_type??-1}`;p[t].counts[s]=(p[t].counts[s]??0)+1,p[t].total++;const a=r(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 r of p)for(const e of l)r.shares[e.key]=r.total>0?r.counts[e.key]/r.total*100:0;return{buckets:p,visibleStart:i,visibleEnd:i+a}}(v,a,l,i,o,M,S),[v,a,l,i,o,M,S]),T=e.useMemo(()=>M.reduce((e,t)=>e+t.totalCount,0),[M]),A=e.useMemo(()=>M.reduce((e,t)=>e+t.totalAirtime,0),[M]),{sortedTypes:F,aggregateShares:P}=e.useMemo(()=>{const e=new Map,t="share"===c?T:A;if(t>0)for(const s of M){const a="share"===c?s.totalCount:s.totalAirtime;e.set(s.key,a/t)}return{sortedTypes:[...M].sort((t,s)=>(e.get(s.key)??0)-(e.get(t.key)??0)),aggregateShares:e}},[M,T,A,c]),R=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,x=d-c;if(0===m||0===u)return[];const h=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){Ie(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(x/360):1,j=Math.ceil(x/b),v=[];for(let N=0;N0){const e=1/l;for(let t=0;ty(e),[]),D=e.useCallback(e=>j(e),[]),_=e.useCallback(e=>y(e),[]),$=e.useMemo(()=>{if(null===b||!R[b])return null;const e=R[b];return{timestamp:e.timestamp,timeLabel:e.time,items:F.map(t=>({key:t.key,label:t.label,value:e[t.key]??0,color:n(t.typeNum)}))}},[b,R,F]),E=e.useMemo(()=>({timestamps:R.map(e=>e.timestamp),series:F.map(e=>({key:e.key,label:e.label,color:n(e.typeNum),values:R.map(t=>t[e.key]??0)}))}),[R,F]);return 0===v.length?0===s.length?t.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[t.jsx(I,{className:"w-6 h-6 mr-2 opacity-50"}),t.jsx("span",{children:"No packet data available"})]}):null:"mosaic"===d?t.jsx(_e,{sortedTypes:F,aggregateShares:P,mode:c}):"stats"===d?t.jsx(Be,{mode:c,packets:v,startTs:a,endTs:l,radioConfig:o,sortedTypes:F,aggregateShares:P,noiseFloorAnomalies:m,showNoiseFloorOverlay:u,overlayOpacity:p}):"trend"===d?t.jsx(Ee,{packets:v,mode:c,startTs:a,endTs:l,radioConfig:o,bucketCount:i}):t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsx("div",{className:"flex-1 min-h-0 relative",children:t.jsx("div",{className:"absolute inset-0 rounded-lg overflow-hidden",children:t.jsx(h,{timestamps:E.timestamps,series:E.series,highlightedKey:g,cursorColor:f.cursor,onHover:D,onSeriesHover:_,overlayLine:null})})}),t.jsx(Te,{sortedTypes:F,highlightedType:g,onTypeHover:L,aggregateShares:P,hoverData:$})]})}),Qe={"1x":1,"2x":2,"4x":4,"8x":8,"16x":16,"36x":36},Ke=[1,5,10,25,50,100,150];function Ze(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 Je(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 et=[{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 tt(e,t){return t[N(e)]||"#808080"}const st=e.memo(function({neighbors:s,quickNeighbors:a,localLat:n,localLon:l,onStatsChange:i,title:r,badge:o,stats:c}){const[m,u]=e.useState(null),[x,h]=e.useState(new Set),[p,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),F=e.useRef(M);F.current=M;const P=f(),R=g(),L=y(),D=b(),_=j(),$=_?D.primary:D.secondary,E=_?.15:.4,z=_?.08:.25,B=_?R.primary:D.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 H=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:O,maxDistance:W,totalNeighbors:G,zeroHopCount:I}=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(!H.has(a))continue;const t=Ze(n,l,i.latitude,i.longitude),s=Je(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,H,q]);e.useEffect(()=>{null==i||i({zeroHopCount:I,totalCount:G,maxDistanceKm:W})},[I,G,W]),e.useEffect(()=>{const e=Qe[w],t=F.current;C.current&&cancelAnimationFrame(C.current);const s=performance.now(),a=n=>{const l=n-s,i=Math.min(l/400,1),r=V(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 Y=W/M,U=e.useMemo(()=>Ke.filter(e=>e<=1.1*Y),[Y]);e.useEffect(()=>{const e=[];for(const s of O){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(()=>{h(t=>new Set([...t,...e]))});const t=setTimeout(()=>{h(t=>{const s=new Set(t);return e.forEach(e=>s.delete(e)),s})},600);return()=>clearTimeout(t)},[O]);const Q=0!==n&&0!==l,K=e.useMemo(()=>{const{width:e,height:t}=p,s=r?22:0,a=e/2,n=t/2+s,l=t-2*s,i=Math.min(e,l),o=Math.max(10,i/2-6);return{width:e,height:t,centerX:a,centerY:n,radius:Math.max(10,o-8),labelRadius:o}},[p,r]),{width:Z,height:J,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=>{u(e)},[]),oe=e.useCallback(e=>{k(e)},[]),ce=e.useCallback(e=>W<=0?0:e/W*M,[W,M]),de=e=>`${e}km`,me=e.useMemo(()=>{const e=U.map(e=>{const t=e/W*M;return{km:e,scale:t,labelY:te-se*t*Math.SQRT1_2}}).filter(e=>e.scale<=1.05&&e.scale>=.02).sort((e,t)=>t.km-e.km),t=[];for(const s of e)t.some(e=>Math.abs(e.labelY-s.labelY)<28)||t.push(s);return t},[U,W,M,te,se]),ue=p.width>0&&p.height>0;return Q?0===G?t.jsxs("div",{ref:A,className:"flex flex-col items-center justify-center h-full text-text-secondary",children:[t.jsx(X,{className:"w-8 h-8 mb-2 opacity-50"}),t.jsx("p",{children:"No nodes with location data"})]}):t.jsxs("div",{ref:A,className:"relative h-full w-full overflow-hidden",children:[r&&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(X,{className:"w-4 h-4"})}),t.jsx("span",{className:"type-subheading text-text-primary",children:r}),o&&t.jsx(d,{color:"teal",children:o})]}),c&&t.jsx("div",{className:"pointer-events-auto hidden sm:flex items-center gap-1.5 min-w-0 overflow-hidden",children:c})]})})}),ue&&t.jsxs("svg",{width:Z,height:J,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})})]}),U.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*Math.SQRT1_2,l=te-se*s*Math.SQRT1_2;return t.jsxs("g",{children:[t.jsx("circle",{cx:ee,cy:te,r:se*s,fill:"none",stroke:$,strokeOpacity:E,strokeWidth:1}),a&&t.jsx("text",{x:n+4,y:l-2,textAnchor:"start",dominantBaseline:"auto",className:"fill-text-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:$,strokeOpacity:E,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:$,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:B,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:B,fontSize:9,fontWeight:600,fontFamily:v,"aria-hidden":"true",children:e},e)}),t.jsx("circle",{cx:ee,cy:te,r:5,fill:L.chart6,stroke:_?"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:O.map(e=>{const s=W>0?e.distance/W*M:0;if(s>1)return null;const{x:a,y:n}=le(e.bearing,s),l=null!==e.snr?tt(e.snr,P):"#808080",i=(null==m?void 0:m.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:_?"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:_?"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)})})]}),t.jsx("div",{className:"absolute z-10 flex flex-col gap-1",role:"group","aria-label":"Zoom level",style:{left:ue?ee+ae+8:void 0,top:ue?te:void 0,transform:"translateY(-50%)"},children:["1x","2x","4x","8x","16x","36x"].map(e=>t.jsx("button",{onClick:()=>oe(e),"aria-pressed":w===e,className:"flex items-center justify-center w-7 h-7 text-[10px] font-medium rounded transition-colors "+(w===e?"bg-accent-primary/20 text-accent-primary":"bg-subtle-fill/80 text-text-secondary hover:bg-subtle-fill-strong hover:text-text-primary"),children:e},e))}),m&&t.jsxs("div",{className:"absolute bg-tooltip-bg border border-border-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-text-primary",children:m.name}),t.jsx("div",{className:"text-text-secondary text-xs font-mono",children:m.hash}),null!==m.snr?t.jsx("div",{className:"flex gap-3 mt-1 text-xs",children:t.jsxs("span",{children:[t.jsx("span",{className:"text-text-secondary",children:"SNR:"})," ",t.jsxs("span",{className:"tabular-nums",style:{color:tt(m.snr,P)},children:[m.snr.toFixed(1)," dB"]}),t.jsxs("span",{className:"text-text-secondary ml-1",children:["(",(xe=m.snr,(null==(he=et.find(e=>xe>=e.min))?void 0:he.label)??"Critical"),")"]})]})}):t.jsx("div",{className:"text-xs text-text-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-text-secondary",children:"Distance:"})," ",t.jsxs("span",{className:"tabular-nums text-text-primary",children:[m.distance.toFixed(2)," km"]})]}),t.jsxs("span",{children:[t.jsx("span",{className:"text-text-secondary",children:"Bearing:"})," ",t.jsxs("span",{className:"tabular-nums text-text-primary",children:[m.bearing.toFixed(0),"°"]})]})]})]})]}):t.jsxs("div",{ref:A,className:"flex flex-col items-center justify-center h-full text-text-secondary",children:[t.jsx(X,{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 xe,he}),at={repeater:"var(--accent-primary)",companion:"var(--accent-tertiary)",room_server:"var(--accent-secondary)"};function nt(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 lt=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=nt(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:at.repeater},{label:"Companions",count:e.companion,percent:0,color:at.companion},{label:"Room Servers",count:e.room_server,percent:0,color:at.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-text-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-text-secondary",children:e.label}),t.jsxs("span",{className:"type-data-sm text-text-secondary tabular-nums",children:[e.count," ",t.jsxs("span",{className:"text-text-secondary/60",children:["(",e.percent.toFixed(0),"%)"]})]})]}),t.jsx("div",{className:"h-2.5 bg-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-border-subtle",children:[t.jsx("span",{className:"type-data-xs text-text-secondary",children:"Total Nodes"}),t.jsx("span",{className:"type-data-sm text-text-primary font-medium tabular-nums",children:a.total})]})]})});function it({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-text-muted/50",children:t.jsx("div",{className:"animate-pulse text-xs",children:"Loading chart..."})})})}const rt={excellent:"text-signal-excellent",good:"text-signal-good",fair:"text-signal-fair",poor:"text-accent-primary"},ot={excellent:"bg-signal-excellent/10",good:"bg-signal-good/10",fair:"bg-signal-fair/10",poor:"bg-accent-primary/10"};function ct(){const s=w(),a=k(),[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(K,{children:[t.jsx(ae,{icon:t.jsx(le,{}),title:"Prefix Conflicts",largeTitle:!0}),t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsxs("div",{className:"text-center text-text-secondary",children:[t.jsx(re,{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=(m=s.collisionRate)<=10?"excellent":m<=25?"good":"poor";var m;const u="poor"===o||"poor"===d?"poor":"fair"===o||"fair"===d?"fair":"good"===o||"good"===d?"good":"excellent",x="excellent"===u||"good"===u?ge:oe;return t.jsxs(K,{className:"flex flex-col overflow-hidden",children:[t.jsx(ae,{icon:t.jsx(le,{}),title:"Prefix Conflicts",largeTitle:!0,actions:t.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full ${ot[u]}`,children:[t.jsx(x,{className:`w-3.5 h-3.5 ${rt[u]}`}),t.jsx("span",{className:`type-data-xs font-medium ${rt[u]}`,children:"excellent"===u?"Excellent":"good"===u?"Good":"fair"===u?"Fair":"Needs Attention"})]})}),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(U,{value:s.totalPrefixes,className:"font-mono text-2xl sm:text-3xl font-semibold tabular-nums text-text-primary",priority:"low"}),t.jsx("span",{className:"type-data-xs sm:type-data-sm text-text-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(U,{value:s.unambiguousPrefixes,className:"font-mono text-2xl sm:text-3xl font-semibold tabular-nums text-text-primary",priority:"low"}),t.jsx("span",{className:"type-data-xs sm:type-data-sm text-text-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-accent-primary/15":"bg-subtle-fill"),title:"Prefixes matching multiple known nodes. Click a prefix below to explore candidates.",children:[t.jsx(U,{value:s.collisionPrefixes,className:"font-mono text-2xl sm:text-3xl font-semibold tabular-nums "+(s.collisionPrefixes>0?"text-accent-primary":"text-text-primary"),priority:"low"}),t.jsx("span",{className:"type-data-xs sm:type-data-sm mt-0.5 sm:mt-1 "+(s.collisionPrefixes>0?"text-accent-primary":"text-text-secondary"),children:"Conflicts"})]})]}),s.highCollisionPrefixes.length>0&&t.jsxs("div",{children:[t.jsx("div",{className:"type-data-xs text-text-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(te,{children:e}),t.jsxs("span",{className:"text-text-muted type-data-xs group-hover:text-text-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(ge,{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-text-secondary",children:"Confidence"}),t.jsxs("span",{className:`data-box ${rt[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-text-secondary",children:"Collisions"}),t.jsxs("span",{className:`data-box ${rt[d]}`,children:[s.collisionRate.toFixed(1),"%"]})]})]})]}),t.jsx(se,{isOpen:!!n,prefix:(null==n?void 0:n.prefix)||"",candidateHashes:(null==n?void 0:n.candidateHashes)||[],onClose:r})]})}function dt({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-text-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(--accent-primary)"}:void 0,children:a}),n&&t.jsx("span",{className:"type-data-xs text-text-secondary hidden sm:inline",children:n})]})]})}function mt(){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",x=a>0?(l/a*100).toFixed(1):"0",h=i+r,p=h>0||o>0,f=c>0||m>0;return t.jsxs(K,{children:[t.jsx(ae,{title:"Path Decoder",icon:t.jsx(ie,{}),largeTitle:!0,badge:s>0?`${s} hidden`:void 0}),t.jsxs(ne,{children:[t.jsxs("div",{children:[t.jsx(dt,{icon:t.jsx(je,{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(dt,{icon:t.jsx(Ne,{className:"w-3.5 h-3.5"}),label:"Learning Rate",value:`${x}%`,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(dt,{icon:t.jsx(ve,{className:"w-3.5 h-3.5"}),label:"Route Reports",value:h.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(dt,{icon:t.jsx(ce,{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(dt,{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(dt,{icon:t.jsx(T,{className:"w-3.5 h-3.5 text-accent-primary"}),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 ut=new Set(["Duplicate","Empty payload","Path too long","Unknown"]),xt={excellent:"bg-status-success",good:"bg-accent-primary",fair:"bg-status-warning",poor:"bg-status-danger"};function ht({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 x of e){if("tx_local"===x.packet_origin)continue;const e=x.timestamp;if(es)continue;o++;const t=Math.min(23,Math.floor((e-n)/l));r[t]++,x.transmitted||"tx_forward"===x.packet_origin?(c++,i[t]++):(x.is_duplicate||"Duplicate"===x.drop_reason)&&d++,x.drop_reason&&ut.has(x.drop_reason)&&m++}const u=[];for(let x=0;x<24;x++){const e=r[x],t=i[x];u.push({count:e>0?Math.round(t/e*100):0,timestamp:1e3*(n+x*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 x=r.totalRx>0;return t.jsx(K,{isLoaded:i,skeletonType:"chart",children:i&&t.jsxs(t.Fragment,{children:[t.jsx(ae,{icon:t.jsx(me,{}),title:"Packet Health",badge:l,largeTitle:!0}),t.jsx(ne,{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-text-primary",children:[x?t.jsx(U,{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-text-muted ml-0.5",children:"%"})]}),x&&t.jsx("div",{className:`w-2 h-2 rounded-full ${xt[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(de,{data:r.sparkline,width:9999,height:36,color:"var(--accent-primary)",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:x?`${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:x?`${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(oe,{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(){var s,a,n,l,i,r,o,c,d,m,u,x,h,p,f,g,y;const b=F(),j=P(),v=R(),N=L(),w=D(),k=_(),M=$(),S=E(),[C,T]=e.useState([]),[A,X]=e.useState(null),[V,Y]=e.useState(null),[U,te]=e.useState(!0),[se,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[re,oe]=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",re)},[re]);const[ce,de]=e.useState(!1),[me,he]=e.useState(!1),[fe,ge]=e.useState(ke),[ye,be]=e.useState(.5),je=e.useMemo(()=>({0:0,1:0,2:1,3:2,4:3,5:4,6:5,7:6}[M]??3),[M]),ve=z[je].hours,Ne=60*ve,we=z[je],Te=H(ve),Ae=k.isBackgroundLoading,Fe=e.useCallback(e=>{S({0:1,1:2,2:3,3:4,4:5,5:6,6:7}[e]??4)},[S]),Pe=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 B(ve);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{te(!1)}}()},[ve]);const Re=e.useMemo(()=>72===ve?6e5:168===ve?18e5:336===ve?36e5:3e5,[ve]),Le=e.useCallback(async()=>{var e;try{const t=await B(ve);t.success&&(null==(e=t.data)?void 0:e.history)&&T(t.data.history)}catch{}},[ve]);G(Le,Re,!0,!0);const De=e.useMemo(()=>0===C.length?{timestamps:[],values:[]}:{timestamps:C.map(e=>e.timestamp),values:C.map(e=>e.noise_floor_dbm)},[C]),_e=e.useMemo(()=>{if(C.length<10)return{anomalies:[],debug:void 0};const e=function(e,t={}){const s={...ke,...t};if(e.length<10)return{anomalies:[],thresholds:Se([]),totalSamples:e.length,anomalySamples:0};const a=e.map(e=>e.noise_floor_dbm),n=Se(a),l=[...a].sort((e,t)=>e-t);let i,r;s.useAbsoluteThresholds?(i=s.baselineDbm,r=s.spikeDbm):(i=Me(l,s.baselinePercentile),r=Me(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:Ce(s,i,r),sampleCount:e.values.length}}),thresholds:n,totalSamples:e.length,anomalySamples:m,debug:{baselineCutoff:i,spikeCutoff:r,midBandSamples:m}}}(C,fe);return{anomalies:e.anomalies,debug:e.debug}},[C,fe]),$e=_e.anomalies,Ee=e.useMemo(()=>{const e=(null==b?void 0:b.neighbors)??{};return Object.fromEntries(Object.entries(e).filter(([e])=>!j.has(e)))},[null==b?void 0:b.neighbors,j]),ze=e.useMemo(()=>{const e=Date.now()/1e3-3600*ve;return Object.fromEntries(Object.entries(Ee).filter(([,t])=>t.last_seen>=e))},[Ee,ve]),Be=e.useMemo(()=>{const e=60*Ne/Te,t=Math.floor(Date.now()/1e3),s=Math.floor(t/e)*e;return{start:s-60*Ne,end:s}},[Ne,Te]);return t.jsxs(Z,{children:[t.jsx(J,{title:"Statistics",icon:t.jsx(q,{}),controls:t.jsx(Q,{ranges:z,selectedIndex:je,onSelect:Fe,isPending:Ae})}),se&&t.jsx(K,{className:"border border-accent-red/50 bg-accent-red/10",children:t.jsx("p",{className:"text-accent-red",children:se})}),ce&&me&&t.jsxs(K,{className:"border border-accent-purple/30 bg-glass-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-text-muted",children:["(",we.label,")"]})]}),t.jsx("button",{onClick:()=>ge(e=>({...e,useAbsoluteThresholds:!e.useAbsoluteThresholds})),className:"type-data-xs px-2 py-1 rounded transition-colors "+(fe.useAbsoluteThresholds?"bg-accent-purple/30 text-accent-purple":"bg-glass-elevated text-text-muted hover:text-text-secondary"),children:fe.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=_e.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==(x=null==(u=_e.debug)?void 0:u.spikeCutoff)?void 0:x.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-accent-purple",children:(null==(h=_e.debug)?void 0:h.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:$e.length})]})]}),t.jsxs("div",{className:"mt-4 pt-4 border-t border-border-subtle space-y-4",children:[fe.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 (",fe.baselineDbm," dBm)"]}),t.jsx("input",{type:"range",min:"-120",max:"-60",value:fe.baselineDbm,onChange:e=>ge(t=>({...t,baselineDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Spike (",fe.spikeDbm," dBm)"]}),t.jsx("input",{type:"range",min:"-100",max:"-20",value:fe.spikeDbm,onChange:e=>ge(t=>({...t,spikeDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",fe.mergeGapSeconds,"s)"]}),t.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:fe.mergeGapSeconds,onChange:e=>ge(t=>({...t,mergeGapSeconds:Number(e.target.value)})),className:"w-full accent-accent-purple"})]})]}),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 (",fe.minSequenceLength,")"]}),t.jsx("input",{type:"range",min:"2",max:"20",value:fe.minSequenceLength,onChange:e=>ge(t=>({...t,minSequenceLength:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",fe.similarityToleranceDbm," dBm)"]}),t.jsx("input",{type:"range",min:"1",max:"15",value:fe.similarityToleranceDbm,onChange:e=>ge(t=>({...t,similarityToleranceDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(100*ye),"%)"]}),t.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:ye,onChange:e=>be(Number(e.target.value)),className:"w-full accent-accent-purple"})]})]})]}):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",fe.baselinePercentile,")"]}),t.jsx("input",{type:"range",min:"1",max:"50",value:fe.baselinePercentile,onChange:e=>ge(t=>({...t,baselinePercentile:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Spike (P",fe.spikePercentile,")"]}),t.jsx("input",{type:"range",min:"50",max:"99",value:fe.spikePercentile,onChange:e=>ge(t=>({...t,spikePercentile:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",fe.mergeGapSeconds,"s)"]}),t.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:fe.mergeGapSeconds,onChange:e=>ge(t=>({...t,mergeGapSeconds:Number(e.target.value)})),className:"w-full accent-accent-purple"})]})]}),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 (",fe.minSequenceLength,")"]}),t.jsx("input",{type:"range",min:"2",max:"20",value:fe.minSequenceLength,onChange:e=>ge(t=>({...t,minSequenceLength:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",fe.similarityToleranceDbm," dBm)"]}),t.jsx("input",{type:"range",min:"1",max:"15",value:fe.similarityToleranceDbm,onChange:e=>ge(t=>({...t,similarityToleranceDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(100*ye),"%)"]}),t.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:ye,onChange:e=>be(Number(e.target.value)),className:"w-full accent-accent-purple"})]})]})]}),t.jsxs("div",{className:"mt-4 p-3 bg-glass-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:[fe.useAbsoluteThresholds?`useAbsoluteThresholds: true, baselineDbm: ${fe.baselineDbm}, spikeDbm: ${fe.spikeDbm}`:`useAbsoluteThresholds: false, baselinePercentile: ${fe.baselinePercentile}, spikePercentile: ${fe.spikePercentile}`,", mergeGapSeconds: ",fe.mergeGapSeconds,", minSequenceLength: ",fe.minSequenceLength,", similarityToleranceDbm: ",fe.similarityToleranceDbm]})]})]})]}),t.jsxs(ee,{children:[Ae&&t.jsx(ue,{template:"auto",children:t.jsx(K,{className:"border border-accent-primary/30 bg-accent-primary/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-accent-primary opacity-75"}),t.jsx("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-accent-primary"})]}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("p",{className:"type-body-sm text-text-primary",children:["Loading ",we.label," data..."]}),k.loadProgress&&t.jsxs("p",{className:"type-data-xs text-text-muted mt-0.5",children:[k.loadProgress.loaded.toLocaleString()," packets (",k.loadProgress.percent,"%)"]})]})]})})}),U?t.jsx(ue,{template:"auto",children:t.jsx(K,{className:"text-center py-12",children:t.jsx("div",{className:"animate-pulse text-text-muted",children:"Loading statistics..."})})}):t.jsxs(t.Fragment,{children:[t.jsx(ue,{template:"hero-auto",children:t.jsx(K,{isLoaded:w,skeletonType:"chart",children:w&&t.jsxs(t.Fragment,{children:[t.jsx(ae,{icon:t.jsx(I,{}),title:"Packet Analyzer",badge:we.label,largeTitle:!0,stackActionsOnMobile:!0,actions:t.jsxs("div",{className:"flex flex-wrap items-center gap-2 justify-end",children:["stats"===re&&t.jsx(Oe,{enabled:ce,onChange:de,anomalyCount:$e.length,showTuning:me,onTuningChange:he}),t.jsx(qe,{smoothing:re,onChange:oe}),t.jsx(He,{mode:le,onChange:ie})]})}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(Ue,{packets:N,startTs:Be.start,endTs:Be.end,bucketCount:Te,radioConfig:Pe??void 0,mode:le,smoothing:re,noiseFloorAnomalies:$e,showNoiseFloorOverlay:ce,overlayOpacity:ye})})]})})}),t.jsxs(ue,{template:"panel",children:[t.jsx(xe,{span:12,md:6,children:t.jsx(K,{isLoaded:w,skeletonType:"chart",noPadding:w,children:w&&t.jsx(it,{children:t.jsx(st,{neighbors:ze,quickNeighbors:v,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:Y,title:"Link Quality",badge:we.label,stats:V?t.jsxs("span",{className:"type-data-xs text-text-muted tabular-nums whitespace-nowrap",children:[t.jsx("span",{className:"text-text-secondary font-medium",children:V.zeroHopCount}),"/",t.jsx("span",{className:"text-text-secondary font-medium",children:V.totalCount})," nbr · ",t.jsx("span",{className:"text-text-secondary font-medium",children:V.maxDistanceKm.toFixed(0)}),"km"]}):void 0})})})}),t.jsx(xe,{span:12,md:6,children:t.jsx(K,{isLoaded:w,skeletonType:"chart",children:w&&t.jsxs(t.Fragment,{children:[t.jsx(ae,{icon:t.jsx(pe,{}),title:"Network Composition",badge:we.label,largeTitle:!0}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(it,{children:t.jsx(lt,{neighbors:ze})})})]})})})]}),t.jsxs(ue,{template:"panel",children:[t.jsx(xe,{span:12,md:6,children:t.jsx(ct,{})}),t.jsx(xe,{span:12,md:6,children:t.jsx(mt,{})})]}),t.jsxs(ue,{template:"panel",children:[t.jsx(xe,{span:12,md:8,children:t.jsx(K,{isLoaded:w,skeletonType:"chart",children:w&&t.jsxs(t.Fragment,{children:[t.jsx(ae,{icon:t.jsx(O,{}),title:"RF Noise Floor",largeTitle:!0,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-text-muted whitespace-nowrap",children:["min ",t.jsx("span",{className:"text-text-secondary tabular-nums",children:A.min.toFixed(0)})]}),t.jsxs("span",{className:"type-data-xs text-text-muted whitespace-nowrap",children:["avg ",t.jsx("span",{className:"text-text-secondary tabular-nums",children:A.avg.toFixed(0)})]}),t.jsxs("span",{className:"type-data-xs text-text-muted whitespace-nowrap",children:["max ",t.jsx("span",{className:"text-text-secondary tabular-nums",children:A.max.toFixed(0)})]}),t.jsx("span",{className:"type-data-xs text-text-muted",children:"dBm"})]}):t.jsx("span",{className:"type-data-xs text-text-muted",children:"dBm"})}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(it,{children:t.jsx(W,{timestamps:De.timestamps,values:De.values,onStatsChange:X})})})]})})}),t.jsx(xe,{span:12,md:4,children:t.jsx(ht,{packets:N,rangeMinutes:Ne,rangeHours:ve,timeRangeLabel:we.label,isLoaded:w})})]})]})]})]})}export{pt as default}; +import{r as e,j as t,c as s}from"./vendor-react-j_fHog8x.js";import{c as a,b as n,aI as l,aJ as i,aK as r,ah as o,aL as c,e as d,aM as m,aN as u,u as x,aO as h,_ as p,aP as f,aQ as g,aR as y,aS as b,aT as j,aU as v,al as N,aV as w,aW as k,aw as M,aX as S,aY as C,ax as T,aZ as A,n as F,p as P,o as R,h as L,aE as D,X as _,q as $,H as E,a_ as z,r as B,a$ as H,Z as q,R as O,b0 as W}from"./index-B51aMfiH.js";import{u as G}from"./usePolling-B1kG3uqm.js";import{L as I}from"./layers-Dd_4LhZ4.js";import{C as X,e as V}from"./easing-xoQNL31J.js";import{E as Y,A as U,T as Q}from"./TimeRangeSelector-DOdtPPj_.js";import{a as K,P as Z,b as J,B as ee}from"./PageLayout-DUXmuiZg.js";import{D as te}from"./DataBox-B4su-zzA.js";import{C as se}from"./CollisionExplorerModal-COcb8LoT.js";import{C as ae,a as ne}from"./Card-BC0izdLh.js";import{H as le,R as ie}from"./route-BTnuOvzt.js";import{I as re}from"./info-DFWt9Iwg.js";import{T as oe}from"./triangle-alert-JpcXY4mr.js";import{G as ce}from"./git-branch-C_xw1lQX.js";import{L as de}from"./LightSparkline-96Ro4wc3.js";import{A as me}from"./activity-48nFba-7.js";import{R as ue,C as xe}from"./Grid-OFJ4oe0a.js";import{S as he}from"./settings-2-B0bBfCqU.js";import{N as pe}from"./network-D76gOy_X.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CDNU4oKM.js";import"./index-Ch_XDzqB.js";import"./config-CTM8_93T.js";import"./copy-jAVnwXtf.js";import"./BasemapLayer-Dkb0XoZP.js";import"./map-pin-C3ieg9t_.js";const fe=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"}]]),ge=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"}]]),ye=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"}]]),be=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"}]]),je=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"}]]),ve=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"}]]),Ne=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"}]]),we=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"}]]),ke={useAbsoluteThresholds:!0,baselinePercentile:6,spikePercentile:50,baselineDbm:-107,spikeDbm:-100,mergeGapSeconds:45,minSequenceLength:16,similarityToleranceDbm:5};function Me(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 Se(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:Me(t,50),p90:Me(t,90),p95:Me(t,95),p99:Me(t,99),max:t[t.length-1],min:t[0]}}function Ce(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"}function Te({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;return t.jsx("div",{className:"flex-shrink-0 pt-3 mt-2",children:t.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1 font-mono text-xs ml-9",onMouseLeave:()=>i(null),children:a.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,x=u>1e-4,h=l===e.key,p=l&&!h||d&&o<=1e-4;return t.jsxs("div",{className:s("flex items-center gap-1.5 transition-opacity cursor-pointer hover:opacity-80",p&&"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-text-secondary whitespace-nowrap",children:e.label}),x&&t.jsxs("span",{className:s("tabular-nums",d?"text-text-primary":"text-text-muted"),children:[(100*u).toFixed(1),"%"]})]},e.key)})})})}const Ae='ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace';function Fe(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 Pe(r,i,l,t,s,a,n,o),o}function Pe(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,x=0;for(let b=0;bs?a/s:s/a,n>s?n/s:s/n);if(!(l<=u))break;u=l,x=b+1,m=t}const h=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:h,h:s,index:t[b]}:{x:a+p,y:n,w:s,h:h,index:t[b]},p+=s}const f=e.slice(x),g=t.slice(x),y=s-m;c?Pe(f,g,y,a+h,n,l-h,i,r):Pe(f,g,y,a,n+h,l,i-h,r)}function Re(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 x=n(t.typeNum),h=null!==l&&l!==r.index;e.save(),e.globalAlpha=h?.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=x,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 ${Ae}`,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 ${Ae}`,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 Le({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-border-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-text-primary",children:e.name})]}),t.jsxs("div",{className:"space-y-0.5 type-data-xs text-text-muted",children:[t.jsxs("div",{className:"flex justify-between gap-4",children:[t.jsx("span",{children:i?"Airtime":"Count"}),t.jsx("span",{className:"text-text-primary tabular-nums font-medium",children:i?De(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-text-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-text-primary tabular-nums font-medium",children:i?De(s):s.toLocaleString()})]})]})]})})}function De(e){return e>=6e4?`${(e/6e4).toFixed(1)}m`:e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`}function _e({sortedTypes:s,aggregateShares:a,mode:l="share"}){var i,r,o;const[c,d]=e.useState(null),[m,u]=e.useState(null),[x,h]=e.useState(0),[p,f]=e.useState(null),g=e.useRef(null),y=e.useRef(null),b=e.useRef([]),j="airtime"===l,v=e.useMemo(()=>s.reduce((e,t)=>e+(j?t.totalAirtime:t.totalCount),0),[s,j]),N=e.useMemo(()=>s.map((e,t)=>({name:e.label,size:j?e.totalAirtime:e.totalCount,index:t,typeNum:e.typeNum,key:e.key})),[s,j]);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=Fe(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),Re(r,i,N,v,c,l))},[N,v,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=Fe(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),Re(r,i,N,v,c,l))});return t.observe(e),()=>t.disconnect()},[N,v]);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?(h(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===v?t.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[t.jsx(I,{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(Le,{data:S,total:v,color:C,position:m,containerWidth:x,isAirtime:j})]}),t.jsx(Te,{sortedTypes:s,highlightedType:p,onTypeHover:M,aggregateShares:a})]})}function $e(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 Ee({packets:s,mode:a,startTs:n,endTs:m,radioConfig:u,bucketCount:x}){const h=e.useMemo(()=>l(),[]),p=h.blue,f=h.red,g=h.yellow,[y,b]=e.useState(null),{trendData:j,totals:v}=e.useMemo(()=>{if(0===s.length)return{trendData:[],totals:{rxBytes:0,txBytes:0,rxAirtime:0,txAirtime:0}};const e=m-n,t=Math.min(Math.ceil(e/300),x),l=e/t,o=[];let c=0,d=0,h=0,p=0;for(const a of s){const e=a.timestamp;if(e=m)continue;const t=i(a),s=r(a,{spreadingFactor:u.sf,bandwidthHz:u.bw,codingRate:u.cr,preambleLength:u.preamble}),l={timestamp:e,rxAirtime:0,txAirtime:0,rxBytes:0,txBytes:0};a.transmitted?(l.txAirtime=s,l.txBytes=t,d+=t,p+=s):(l.rxAirtime=s,l.rxBytes=t,c+=t,h+=s),o.push(l)}o.sort((e,t)=>e.timestamp-t.timestamp);const f=new Float64Array(o.length+1),g=new Float64Array(o.length+1),y=new Float64Array(o.length+1),b=new Float64Array(o.length+1),j=new Float64Array(o.length);for(let s=0;s{let t=0,s=j.length;for(;t>>1;j[a]0?t:null,tx:s>0?s:null})}else{const t=(f[r]-f[i])/w*100,s=(g[r]-g[i])/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:c,txBytes:d,rxAirtime:h,txAirtime:p}}},[s,n,m,x,a,u]),N=e.useMemo(()=>{if(0===j.length)return"share"===a?100:10;let e=0;for(const s of j){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))},[j,a]),w=e.useMemo(()=>{if(null!==y&&j[y]){const e=j[y],t=e.rx??0,s=e.tx??0;return"share"===a?{rx:$e(t),tx:$e(s),total:$e(t+s),isHovered:!0}:{rx:`${t.toFixed(2)}%`,tx:`${s.toFixed(2)}%`,total:`${(t+s).toFixed(2)}%`,isHovered:!0}}if("share"===a)return{rx:$e(v.rxBytes),tx:$e(v.txBytes),total:$e(v.rxBytes+v.txBytes),isHovered:!1};{let e=0,t=0,s=0;for(const l of j)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}}},[y,j,v,a]),k=e.useMemo(()=>{const e=m-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,m]),M=e.useCallback(e=>{b(e)},[]);return 0===j.length?t.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[t.jsx(I,{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-text-secondary",style:{height:20,paddingLeft:44,paddingRight:8},children:t.jsx("div",{className:"relative w-full h-full flex items-center",children:k.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(o,{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(c,{data:j,yAxisMode:"share"===a?"share":"airtime",yMax:N,onHover:M})})]}),t.jsxs("div",{className:"flex items-center justify-between mt-1.5 sm:mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 text-xs font-mono 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:p}}),t.jsx("span",{className:"text-text-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:f}}),t.jsx("span",{className:"text-text-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:g}}),t.jsx("span",{className:"text-text-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-text-primary",children:w.rx}),t.jsx(d,{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-text-primary",children:w.tx}),t.jsx(d,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"TX"})]})]})]})]})}const ze=m;function Be({mode:s,packets:a,startTs:n,endTs:l,radioConfig:o,sortedTypes:c,aggregateShares:d,noiseFloorAnomalies:m,showNoiseFloorOverlay:x,overlayOpacity:h=.5}){const[p,f]=e.useState(null),[g,y]=e.useState(null),b=e.useMemo(()=>(l-n)/3600,[n,l]),j=e.useCallback(e=>{y(e)},[]),v=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 o=[],c=new Map;for(const t of e){const e=t.type??t.payload_type??-1,a=i(t);let d;if(d="airtime"===n?r(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};o.push(u),c.has(m)||c.set(m,[]),c.get(m).push(u)}if(0===o.length)return null;const d=[],m=[],u=[],x=new Map;if("share"===n)for(const[,t]of c)for(const e of t)x.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;x.set(a,t)}}for(const t of o){const e=x.get(t);void 0!==e&&(d.push(e),m.push(t.timestamp),u.push(t.packetType))}let h=m[0],p=m[0];for(let t=1;tp&&(p=m[t]);const f=p-h||1,g=[...d].sort((e,t)=>e-t),y=g[0],b=g[g.length-1],j=Math.floor(.05*g.length),v=Math.floor(.5*g.length),N=Math.min(Math.ceil(.95*g.length),g.length-1),w=g[j],k=g[v],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 F=new Float32Array(2*d.length),P=new Float32Array(d.length),R=new Uint8Array(d.length),L=new Float32Array(d.length);for(let t=0;t=0?u[t]:255,L[t]=m[t]}return{points:F,rawValues:P,packetTypes:R,timestamps:L,count:d.length,minTime:h,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",o),[N,w]=e.useState(null),k=e.useCallback((e,t)=>{f(e),w(t??null)},[]),M=e.useMemo(()=>{if(null===N||!v||0===v.count)return null;const e=v.maxTime-v.minTime||1,t=v.minTime+N*e;let s;s=b>=168?75:b>=72?35:b>=24?15:b>=3?10:5;const a=60*s/2;return{start:t-a,end:t+a}},[N,v,b]),S=e.useMemo(()=>M?new Date((M.start+M.end)/2*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}):null,[M]),C=e.useMemo(()=>{if(null===p||!M)return null;const e=S??"",{start:t,end:n}=M,l=a.filter(e=>e.timestamp>=t&&e.timestamp({key:e.key,label:e.label,value:0,color:ze(e.typeNum)}))};const i=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(i.set(e,(i.get(e)??0)+1),m++,o){const t=r(s,{spreadingFactor:o.sf,bandwidthHz:o.bw,codingRate:o.cr,preambleLength:o.preamble});d.set(e,(d.get(e)??0)+t),u+=t}}const x=c.map(e=>{let t;return t="airtime"===s?u>0?(d.get(e.key)??0)/u:0:m>0?(i.get(e.key)??0)/m:0,{key:e.key,label:e.label,value:t,color:ze(e.typeNum)}});return{timestamp:(t+n)/2,timeLabel:e,items:x}},[p,M,S,a,c,s,o]);return v&&0!==v.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(u,{scatterData:v,yAxisMode:"share"===s?"share":"airtime",onHover:k,noiseFloorAnomalies:m,showNoiseFloorOverlay:x,overlayOpacity:h,highlightedType:g,timeRangeHours:b})}),S&&t.jsx("div",{className:"absolute top-1 right-1 px-2 py-0.5 bg-bg-elevated/90 rounded text-xs text-accent-secondary font-mono pointer-events-none",children:S})]}),t.jsx(Te,{sortedTypes:c,highlightedType:g,onTypeHover:j,aggregateShares:d,hoverData:C})]}):t.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[t.jsx(I,{className:"w-6 h-6 mr-2 opacity-50"}),t.jsx("span",{children:"No packet data available"})]})}function He({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 qe({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(be,{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(fe,{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(I,{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(we,{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(ye,{className:"w-3.5 h-3.5"})})]})}function Oe({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(he,{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(Y,{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-accent-danger text-white text-[10px] font-bold flex items-center justify-center pointer-events-none z-10",children:a>99?"99+":a})]})}const We={sf:10,bw:25e4,cr:5,preamble:8};function Ge(e){return p[e]??`TYPE_${e.toString(16).toUpperCase()}`}function Ie(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-k.current);if(0===e&&v.length>0)return;w.current&&clearTimeout(w.current);const t=e>100?50:500;return w.current=setTimeout(()=>{k.current=s.length,N(s)},t),()=>{w.current&&clearTimeout(w.current)}},[s,v.length]);const M=e.useMemo(()=>function(e,t){const s=new Map;for(const n of e){const e=n.type??n.payload_type??-1,a=r(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:Ge(n),totalCount:l.count,totalAirtime:l.airtime});return a.sort((e,t)=>t.totalCount-e.totalCount)}(v,o),[v,o]),S=e.useMemo(()=>{if("ema"!==d&&"ultra"!==d)return 0;const e=(l-a)/i,{handleSize:t}=Ye(d,e,i);return t},[d,a,l,i]),C=e.useMemo(()=>function(e,t,s,a,n,l,i=0){const o=s-t,c=o/a,d=1e3*c,m=o/3600,u=t-i*c,x=s+i*c,h=a+2*i,p=[];for(let r=0;r24?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=x)continue;const t=Math.min(Math.floor((e-u)/c),h-1),s=`TYPE_${f.type??f.payload_type??-1}`;p[t].counts[s]=(p[t].counts[s]??0)+1,p[t].total++;const a=r(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 r of p)for(const e of l)r.shares[e.key]=r.total>0?r.counts[e.key]/r.total*100:0;return{buckets:p,visibleStart:i,visibleEnd:i+a}}(v,a,l,i,o,M,S),[v,a,l,i,o,M,S]),T=e.useMemo(()=>M.reduce((e,t)=>e+t.totalCount,0),[M]),A=e.useMemo(()=>M.reduce((e,t)=>e+t.totalAirtime,0),[M]),{sortedTypes:F,aggregateShares:P}=e.useMemo(()=>{const e=new Map,t="share"===c?T:A;if(t>0)for(const s of M){const a="share"===c?s.totalCount:s.totalAirtime;e.set(s.key,a/t)}return{sortedTypes:[...M].sort((t,s)=>(e.get(s.key)??0)-(e.get(t.key)??0)),aggregateShares:e}},[M,T,A,c]),R=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,x=d-c;if(0===m||0===u)return[];const h=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){Ie(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(x/360):1,j=Math.ceil(x/b),v=[];for(let N=0;N0){const e=1/l;for(let t=0;ty(e),[]),D=e.useCallback(e=>j(e),[]),_=e.useCallback(e=>y(e),[]),$=e.useMemo(()=>{if(null===b||!R[b])return null;const e=R[b];return{timestamp:e.timestamp,timeLabel:e.time,items:F.map(t=>({key:t.key,label:t.label,value:e[t.key]??0,color:n(t.typeNum)}))}},[b,R,F]),E=e.useMemo(()=>({timestamps:R.map(e=>e.timestamp),series:F.map(e=>({key:e.key,label:e.label,color:n(e.typeNum),values:R.map(t=>t[e.key]??0)}))}),[R,F]);return 0===v.length?0===s.length?t.jsxs("div",{className:"h-full flex items-center justify-center text-text-muted",children:[t.jsx(I,{className:"w-6 h-6 mr-2 opacity-50"}),t.jsx("span",{children:"No packet data available"})]}):null:"mosaic"===d?t.jsx(_e,{sortedTypes:F,aggregateShares:P,mode:c}):"stats"===d?t.jsx(Be,{mode:c,packets:v,startTs:a,endTs:l,radioConfig:o,sortedTypes:F,aggregateShares:P,noiseFloorAnomalies:m,showNoiseFloorOverlay:u,overlayOpacity:p}):"trend"===d?t.jsx(Ee,{packets:v,mode:c,startTs:a,endTs:l,radioConfig:o,bucketCount:i}):t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsx("div",{className:"flex-1 min-h-0 relative",children:t.jsx("div",{className:"absolute inset-0 rounded-lg overflow-hidden",children:t.jsx(h,{timestamps:E.timestamps,series:E.series,highlightedKey:g,cursorColor:f.cursor,onHover:D,onSeriesHover:_,overlayLine:null})})}),t.jsx(Te,{sortedTypes:F,highlightedType:g,onTypeHover:L,aggregateShares:P,hoverData:$})]})}),Qe={"1x":1,"2x":2,"4x":4,"8x":8,"16x":16,"36x":36},Ke=[1,5,10,25,50,100,150];function Ze(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 Je(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 et=[{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 tt(e,t){return t[N(e)]||"#808080"}const st=e.memo(function({neighbors:s,quickNeighbors:a,localLat:n,localLon:l,onStatsChange:i,title:r,badge:o,stats:c}){const[m,u]=e.useState(null),[x,h]=e.useState(new Set),[p,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),F=e.useRef(M);F.current=M;const P=f(),R=g(),L=y(),D=b(),_=j(),$=_?D.primary:D.secondary,E=_?.15:.4,z=_?.08:.25,B=_?R.primary:D.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 H=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:O,maxDistance:W,totalNeighbors:G,zeroHopCount:I}=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(!H.has(a))continue;const t=Ze(n,l,i.latitude,i.longitude),s=Je(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,H,q]);e.useEffect(()=>{null==i||i({zeroHopCount:I,totalCount:G,maxDistanceKm:W})},[I,G,W]),e.useEffect(()=>{const e=Qe[w],t=F.current;C.current&&cancelAnimationFrame(C.current);const s=performance.now(),a=n=>{const l=n-s,i=Math.min(l/400,1),r=V(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 Y=W/M,U=e.useMemo(()=>Ke.filter(e=>e<=1.1*Y),[Y]);e.useEffect(()=>{const e=[];for(const s of O){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(()=>{h(t=>new Set([...t,...e]))});const t=setTimeout(()=>{h(t=>{const s=new Set(t);return e.forEach(e=>s.delete(e)),s})},600);return()=>clearTimeout(t)},[O]);const Q=0!==n&&0!==l,K=e.useMemo(()=>{const{width:e,height:t}=p,s=r?22:0,a=e/2,n=t/2+s,l=t-2*s,i=Math.min(e,l),o=Math.max(10,i/2-6);return{width:e,height:t,centerX:a,centerY:n,radius:Math.max(10,o-8),labelRadius:o}},[p,r]),{width:Z,height:J,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=>{u(e)},[]),oe=e.useCallback(e=>{k(e)},[]),ce=e.useCallback(e=>W<=0?0:e/W*M,[W,M]),de=e=>`${e}km`,me=e.useMemo(()=>{const e=U.map(e=>{const t=e/W*M;return{km:e,scale:t,labelY:te-se*t*Math.SQRT1_2}}).filter(e=>e.scale<=1.05&&e.scale>=.02).sort((e,t)=>t.km-e.km),t=[];for(const s of e)t.some(e=>Math.abs(e.labelY-s.labelY)<28)||t.push(s);return t},[U,W,M,te,se]),ue=p.width>0&&p.height>0;return Q?0===G?t.jsxs("div",{ref:A,className:"flex flex-col items-center justify-center h-full text-text-secondary",children:[t.jsx(X,{className:"w-8 h-8 mb-2 opacity-50"}),t.jsx("p",{children:"No nodes with location data"})]}):t.jsxs("div",{ref:A,className:"relative h-full w-full overflow-hidden",children:[r&&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(X,{className:"w-4 h-4"})}),t.jsx("span",{className:"type-subheading text-text-primary",children:r}),o&&t.jsx(d,{color:"teal",children:o})]}),c&&t.jsx("div",{className:"pointer-events-auto hidden sm:flex items-center gap-1.5 min-w-0 overflow-hidden",children:c})]})})}),ue&&t.jsxs("svg",{width:Z,height:J,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})})]}),U.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*Math.SQRT1_2,l=te-se*s*Math.SQRT1_2;return t.jsxs("g",{children:[t.jsx("circle",{cx:ee,cy:te,r:se*s,fill:"none",stroke:$,strokeOpacity:E,strokeWidth:1}),a&&t.jsx("text",{x:n+4,y:l-2,textAnchor:"start",dominantBaseline:"auto",className:"fill-text-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:$,strokeOpacity:E,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:$,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:B,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:B,fontSize:9,fontWeight:600,fontFamily:v,"aria-hidden":"true",children:e},e)}),t.jsx("circle",{cx:ee,cy:te,r:5,fill:L.chart6,stroke:_?"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:O.map(e=>{const s=W>0?e.distance/W*M:0;if(s>1)return null;const{x:a,y:n}=le(e.bearing,s),l=null!==e.snr?tt(e.snr,P):"#808080",i=(null==m?void 0:m.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:_?"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:_?"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)})})]}),t.jsx("div",{className:"absolute z-10 flex flex-col gap-1",role:"group","aria-label":"Zoom level",style:{left:ue?ee+ae+8:void 0,top:ue?te:void 0,transform:"translateY(-50%)"},children:["1x","2x","4x","8x","16x","36x"].map(e=>t.jsx("button",{onClick:()=>oe(e),"aria-pressed":w===e,className:"flex items-center justify-center w-7 h-7 text-[10px] font-medium rounded transition-colors "+(w===e?"bg-accent-primary/20 text-accent-primary":"bg-subtle-fill/80 text-text-secondary hover:bg-subtle-fill-strong hover:text-text-primary"),children:e},e))}),m&&t.jsxs("div",{className:"absolute bg-tooltip-bg border border-border-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-text-primary",children:m.name}),t.jsx("div",{className:"text-text-secondary text-xs font-mono",children:m.hash}),null!==m.snr?t.jsx("div",{className:"flex gap-3 mt-1 text-xs",children:t.jsxs("span",{children:[t.jsx("span",{className:"text-text-secondary",children:"SNR:"})," ",t.jsxs("span",{className:"tabular-nums",style:{color:tt(m.snr,P)},children:[m.snr.toFixed(1)," dB"]}),t.jsxs("span",{className:"text-text-secondary ml-1",children:["(",(xe=m.snr,(null==(he=et.find(e=>xe>=e.min))?void 0:he.label)??"Critical"),")"]})]})}):t.jsx("div",{className:"text-xs text-text-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-text-secondary",children:"Distance:"})," ",t.jsxs("span",{className:"tabular-nums text-text-primary",children:[m.distance.toFixed(2)," km"]})]}),t.jsxs("span",{children:[t.jsx("span",{className:"text-text-secondary",children:"Bearing:"})," ",t.jsxs("span",{className:"tabular-nums text-text-primary",children:[m.bearing.toFixed(0),"°"]})]})]})]})]}):t.jsxs("div",{ref:A,className:"flex flex-col items-center justify-center h-full text-text-secondary",children:[t.jsx(X,{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 xe,he}),at={repeater:"var(--accent-primary)",companion:"var(--accent-tertiary)",room_server:"var(--accent-secondary)"};function nt(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 lt=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=nt(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:at.repeater},{label:"Companions",count:e.companion,percent:0,color:at.companion},{label:"Room Servers",count:e.room_server,percent:0,color:at.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-text-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-text-secondary",children:e.label}),t.jsxs("span",{className:"type-data-sm text-text-secondary tabular-nums",children:[e.count," ",t.jsxs("span",{className:"text-text-secondary/60",children:["(",e.percent.toFixed(0),"%)"]})]})]}),t.jsx("div",{className:"h-2.5 bg-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-border-subtle",children:[t.jsx("span",{className:"type-data-xs text-text-secondary",children:"Total Nodes"}),t.jsx("span",{className:"type-data-sm text-text-primary font-medium tabular-nums",children:a.total})]})]})});function it({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-text-muted/50",children:t.jsx("div",{className:"animate-pulse text-xs",children:"Loading chart..."})})})}const rt={excellent:"text-signal-excellent",good:"text-signal-good",fair:"text-signal-fair",poor:"text-accent-primary"},ot={excellent:"bg-signal-excellent/10",good:"bg-signal-good/10",fair:"bg-signal-fair/10",poor:"bg-accent-primary/10"};function ct(){const s=w(),a=k(),[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(K,{children:[t.jsx(ae,{icon:t.jsx(le,{}),title:"Prefix Conflicts",largeTitle:!0}),t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsxs("div",{className:"text-center text-text-secondary",children:[t.jsx(re,{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=(m=s.collisionRate)<=10?"excellent":m<=25?"good":"poor";var m;const u="poor"===o||"poor"===d?"poor":"fair"===o||"fair"===d?"fair":"good"===o||"good"===d?"good":"excellent",x="excellent"===u||"good"===u?ge:oe;return t.jsxs(K,{className:"flex flex-col overflow-hidden",children:[t.jsx(ae,{icon:t.jsx(le,{}),title:"Prefix Conflicts",largeTitle:!0,actions:t.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full ${ot[u]}`,children:[t.jsx(x,{className:`w-3.5 h-3.5 ${rt[u]}`}),t.jsx("span",{className:`type-data-xs font-medium ${rt[u]}`,children:"excellent"===u?"Excellent":"good"===u?"Good":"fair"===u?"Fair":"Needs Attention"})]})}),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(U,{value:s.totalPrefixes,className:"font-mono text-2xl sm:text-3xl font-semibold tabular-nums text-text-primary",priority:"low"}),t.jsx("span",{className:"type-data-xs sm:type-data-sm text-text-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(U,{value:s.unambiguousPrefixes,className:"font-mono text-2xl sm:text-3xl font-semibold tabular-nums text-text-primary",priority:"low"}),t.jsx("span",{className:"type-data-xs sm:type-data-sm text-text-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-accent-primary/15":"bg-subtle-fill"),title:"Prefixes matching multiple known nodes. Click a prefix below to explore candidates.",children:[t.jsx(U,{value:s.collisionPrefixes,className:"font-mono text-2xl sm:text-3xl font-semibold tabular-nums "+(s.collisionPrefixes>0?"text-accent-primary":"text-text-primary"),priority:"low"}),t.jsx("span",{className:"type-data-xs sm:type-data-sm mt-0.5 sm:mt-1 "+(s.collisionPrefixes>0?"text-accent-primary":"text-text-secondary"),children:"Conflicts"})]})]}),s.highCollisionPrefixes.length>0&&t.jsxs("div",{children:[t.jsx("div",{className:"type-data-xs text-text-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(te,{children:e}),t.jsxs("span",{className:"text-text-muted type-data-xs group-hover:text-text-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(ge,{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-text-secondary",children:"Confidence"}),t.jsxs("span",{className:`data-box ${rt[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-text-secondary",children:"Collisions"}),t.jsxs("span",{className:`data-box ${rt[d]}`,children:[s.collisionRate.toFixed(1),"%"]})]})]})]}),t.jsx(se,{isOpen:!!n,prefix:(null==n?void 0:n.prefix)||"",candidateHashes:(null==n?void 0:n.candidateHashes)||[],onClose:r})]})}function dt({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-text-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(--accent-primary)"}:void 0,children:a}),n&&t.jsx("span",{className:"type-data-xs text-text-secondary hidden sm:inline",children:n})]})]})}function mt(){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",x=a>0?(l/a*100).toFixed(1):"0",h=i+r,p=h>0||o>0,f=c>0||m>0;return t.jsxs(K,{children:[t.jsx(ae,{title:"Path Decoder",icon:t.jsx(ie,{}),largeTitle:!0,badge:s>0?`${s} hidden`:void 0}),t.jsxs(ne,{children:[t.jsxs("div",{children:[t.jsx(dt,{icon:t.jsx(je,{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(dt,{icon:t.jsx(Ne,{className:"w-3.5 h-3.5"}),label:"Learning Rate",value:`${x}%`,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(dt,{icon:t.jsx(ve,{className:"w-3.5 h-3.5"}),label:"Route Reports",value:h.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(dt,{icon:t.jsx(ce,{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(dt,{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(dt,{icon:t.jsx(T,{className:"w-3.5 h-3.5 text-accent-primary"}),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 ut=new Set(["Duplicate","Empty payload","Path too long","Unknown"]),xt={excellent:"bg-status-success",good:"bg-accent-primary",fair:"bg-status-warning",poor:"bg-status-danger"};function ht({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 x of e){if("tx_local"===x.packet_origin)continue;const e=x.timestamp;if(es)continue;o++;const t=Math.min(23,Math.floor((e-n)/l));r[t]++,x.transmitted||"tx_forward"===x.packet_origin?(c++,i[t]++):(x.is_duplicate||"Duplicate"===x.drop_reason)&&d++,x.drop_reason&&ut.has(x.drop_reason)&&m++}const u=[];for(let x=0;x<24;x++){const e=r[x],t=i[x];u.push({count:e>0?Math.round(t/e*100):0,timestamp:1e3*(n+x*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 x=r.totalRx>0;return t.jsx(K,{isLoaded:i,skeletonType:"chart",children:i&&t.jsxs(t.Fragment,{children:[t.jsx(ae,{icon:t.jsx(me,{}),title:"Packet Health",badge:l,largeTitle:!0}),t.jsx(ne,{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-text-primary",children:[x?t.jsx(U,{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-text-muted ml-0.5",children:"%"})]}),x&&t.jsx("div",{className:`w-2 h-2 rounded-full ${xt[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(de,{data:r.sparkline,width:9999,height:36,color:"var(--accent-primary)",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:x?`${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:x?`${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(oe,{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(){var s,a,n,l,i,r,o,c,d,m,u,x,h,p,f,g,y;const b=F(),j=P(),v=R(),N=L(),w=D(),k=_(),M=$(),S=E(),[C,T]=e.useState([]),[A,X]=e.useState(null),[V,Y]=e.useState(null),[U,te]=e.useState(!0),[se,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[re,oe]=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",re)},[re]);const[ce,de]=e.useState(!1),[me,he]=e.useState(!1),[fe,ge]=e.useState(ke),[ye,be]=e.useState(.5),je=e.useMemo(()=>({0:0,1:0,2:1,3:2,4:3,5:4,6:5,7:6}[M]??3),[M]),ve=z[je].hours,Ne=60*ve,we=z[je],Te=H(ve),Ae=k.isBackgroundLoading,Fe=e.useCallback(e=>{S({0:1,1:2,2:3,3:4,4:5,5:6,6:7}[e]??4)},[S]),Pe=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 B(ve);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{te(!1)}}()},[ve]);const Re=e.useMemo(()=>72===ve?6e5:168===ve?18e5:336===ve?36e5:3e5,[ve]),Le=e.useCallback(async()=>{var e;try{const t=await B(ve);t.success&&(null==(e=t.data)?void 0:e.history)&&T(t.data.history)}catch{}},[ve]);G(Le,Re,!0,!0);const De=e.useMemo(()=>0===C.length?{timestamps:[],values:[]}:{timestamps:C.map(e=>e.timestamp),values:C.map(e=>e.noise_floor_dbm)},[C]),_e=e.useMemo(()=>{if(C.length<10)return{anomalies:[],debug:void 0};const e=function(e,t={}){const s={...ke,...t};if(e.length<10)return{anomalies:[],thresholds:Se([]),totalSamples:e.length,anomalySamples:0};const a=e.map(e=>e.noise_floor_dbm),n=Se(a),l=[...a].sort((e,t)=>e-t);let i,r;s.useAbsoluteThresholds?(i=s.baselineDbm,r=s.spikeDbm):(i=Me(l,s.baselinePercentile),r=Me(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:Ce(s,i,r),sampleCount:e.values.length}}),thresholds:n,totalSamples:e.length,anomalySamples:m,debug:{baselineCutoff:i,spikeCutoff:r,midBandSamples:m}}}(C,fe);return{anomalies:e.anomalies,debug:e.debug}},[C,fe]),$e=_e.anomalies,Ee=e.useMemo(()=>{const e=(null==b?void 0:b.neighbors)??{};return Object.fromEntries(Object.entries(e).filter(([e])=>!j.has(e)))},[null==b?void 0:b.neighbors,j]),ze=e.useMemo(()=>{const e=Date.now()/1e3-3600*ve;return Object.fromEntries(Object.entries(Ee).filter(([,t])=>t.last_seen>=e))},[Ee,ve]),Be=e.useMemo(()=>{const e=60*Ne/Te,t=Math.floor(Date.now()/1e3),s=Math.floor(t/e)*e;return{start:s-60*Ne,end:s}},[Ne,Te]);return t.jsxs(Z,{children:[t.jsx(J,{title:"Statistics",icon:t.jsx(q,{}),controls:t.jsx(Q,{ranges:z,selectedIndex:je,onSelect:Fe,isPending:Ae})}),se&&t.jsx(K,{className:"border border-accent-red/50 bg-accent-red/10",children:t.jsx("p",{className:"text-accent-red",children:se})}),ce&&me&&t.jsxs(K,{className:"border border-accent-purple/30 bg-glass-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-text-muted",children:["(",we.label,")"]})]}),t.jsx("button",{onClick:()=>ge(e=>({...e,useAbsoluteThresholds:!e.useAbsoluteThresholds})),className:"type-data-xs px-2 py-1 rounded transition-colors "+(fe.useAbsoluteThresholds?"bg-accent-purple/30 text-accent-purple":"bg-glass-elevated text-text-muted hover:text-text-secondary"),children:fe.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=_e.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==(x=null==(u=_e.debug)?void 0:u.spikeCutoff)?void 0:x.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-accent-purple",children:(null==(h=_e.debug)?void 0:h.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:$e.length})]})]}),t.jsxs("div",{className:"mt-4 pt-4 border-t border-border-subtle space-y-4",children:[fe.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 (",fe.baselineDbm," dBm)"]}),t.jsx("input",{type:"range",min:"-120",max:"-60",value:fe.baselineDbm,onChange:e=>ge(t=>({...t,baselineDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Spike (",fe.spikeDbm," dBm)"]}),t.jsx("input",{type:"range",min:"-100",max:"-20",value:fe.spikeDbm,onChange:e=>ge(t=>({...t,spikeDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",fe.mergeGapSeconds,"s)"]}),t.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:fe.mergeGapSeconds,onChange:e=>ge(t=>({...t,mergeGapSeconds:Number(e.target.value)})),className:"w-full accent-accent-purple"})]})]}),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 (",fe.minSequenceLength,")"]}),t.jsx("input",{type:"range",min:"2",max:"20",value:fe.minSequenceLength,onChange:e=>ge(t=>({...t,minSequenceLength:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",fe.similarityToleranceDbm," dBm)"]}),t.jsx("input",{type:"range",min:"1",max:"15",value:fe.similarityToleranceDbm,onChange:e=>ge(t=>({...t,similarityToleranceDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(100*ye),"%)"]}),t.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:ye,onChange:e=>be(Number(e.target.value)),className:"w-full accent-accent-purple"})]})]})]}):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",fe.baselinePercentile,")"]}),t.jsx("input",{type:"range",min:"1",max:"50",value:fe.baselinePercentile,onChange:e=>ge(t=>({...t,baselinePercentile:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Spike (P",fe.spikePercentile,")"]}),t.jsx("input",{type:"range",min:"50",max:"99",value:fe.spikePercentile,onChange:e=>ge(t=>({...t,spikePercentile:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",fe.mergeGapSeconds,"s)"]}),t.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:fe.mergeGapSeconds,onChange:e=>ge(t=>({...t,mergeGapSeconds:Number(e.target.value)})),className:"w-full accent-accent-purple"})]})]}),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 (",fe.minSequenceLength,")"]}),t.jsx("input",{type:"range",min:"2",max:"20",value:fe.minSequenceLength,onChange:e=>ge(t=>({...t,minSequenceLength:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",fe.similarityToleranceDbm," dBm)"]}),t.jsx("input",{type:"range",min:"1",max:"15",value:fe.similarityToleranceDbm,onChange:e=>ge(t=>({...t,similarityToleranceDbm:Number(e.target.value)})),className:"w-full accent-accent-purple"})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(100*ye),"%)"]}),t.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:ye,onChange:e=>be(Number(e.target.value)),className:"w-full accent-accent-purple"})]})]})]}),t.jsxs("div",{className:"mt-4 p-3 bg-glass-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:[fe.useAbsoluteThresholds?`useAbsoluteThresholds: true, baselineDbm: ${fe.baselineDbm}, spikeDbm: ${fe.spikeDbm}`:`useAbsoluteThresholds: false, baselinePercentile: ${fe.baselinePercentile}, spikePercentile: ${fe.spikePercentile}`,", mergeGapSeconds: ",fe.mergeGapSeconds,", minSequenceLength: ",fe.minSequenceLength,", similarityToleranceDbm: ",fe.similarityToleranceDbm]})]})]})]}),t.jsxs(ee,{children:[Ae&&t.jsx(ue,{template:"auto",children:t.jsx(K,{className:"border border-accent-primary/30 bg-accent-primary/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-accent-primary opacity-75"}),t.jsx("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-accent-primary"})]}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("p",{className:"type-body-sm text-text-primary",children:["Loading ",we.label," data..."]}),k.loadProgress&&t.jsxs("p",{className:"type-data-xs text-text-muted mt-0.5",children:[k.loadProgress.loaded.toLocaleString()," packets (",k.loadProgress.percent,"%)"]})]})]})})}),U?t.jsx(ue,{template:"auto",children:t.jsx(K,{className:"text-center py-12",children:t.jsx("div",{className:"animate-pulse text-text-muted",children:"Loading statistics..."})})}):t.jsxs(t.Fragment,{children:[t.jsx(ue,{template:"hero-auto",children:t.jsx(K,{isLoaded:w,skeletonType:"chart",children:w&&t.jsxs(t.Fragment,{children:[t.jsx(ae,{icon:t.jsx(I,{}),title:"Packet Analyzer",badge:we.label,largeTitle:!0,stackActionsOnMobile:!0,actions:t.jsxs("div",{className:"flex flex-wrap items-center gap-2 justify-end",children:["stats"===re&&t.jsx(Oe,{enabled:ce,onChange:de,anomalyCount:$e.length,showTuning:me,onTuningChange:he}),t.jsx(qe,{smoothing:re,onChange:oe}),t.jsx(He,{mode:le,onChange:ie})]})}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(Ue,{packets:N,startTs:Be.start,endTs:Be.end,bucketCount:Te,radioConfig:Pe??void 0,mode:le,smoothing:re,noiseFloorAnomalies:$e,showNoiseFloorOverlay:ce,overlayOpacity:ye})})]})})}),t.jsxs(ue,{template:"panel",children:[t.jsx(xe,{span:12,md:6,children:t.jsx(K,{isLoaded:w,skeletonType:"chart",noPadding:w,children:w&&t.jsx(it,{children:t.jsx(st,{neighbors:ze,quickNeighbors:v,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:Y,title:"Link Quality",badge:we.label,stats:V?t.jsxs("span",{className:"type-data-xs text-text-muted tabular-nums whitespace-nowrap",children:[t.jsx("span",{className:"text-text-secondary font-medium",children:V.zeroHopCount}),"/",t.jsx("span",{className:"text-text-secondary font-medium",children:V.totalCount})," nbr · ",t.jsx("span",{className:"text-text-secondary font-medium",children:V.maxDistanceKm.toFixed(0)}),"km"]}):void 0})})})}),t.jsx(xe,{span:12,md:6,children:t.jsx(K,{isLoaded:w,skeletonType:"chart",children:w&&t.jsxs(t.Fragment,{children:[t.jsx(ae,{icon:t.jsx(pe,{}),title:"Network Composition",badge:we.label,largeTitle:!0}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(it,{children:t.jsx(lt,{neighbors:ze})})})]})})})]}),t.jsxs(ue,{template:"panel",children:[t.jsx(xe,{span:12,md:6,children:t.jsx(ct,{})}),t.jsx(xe,{span:12,md:6,children:t.jsx(mt,{})})]}),t.jsxs(ue,{template:"panel",children:[t.jsx(xe,{span:12,md:8,children:t.jsx(K,{isLoaded:w,skeletonType:"chart",children:w&&t.jsxs(t.Fragment,{children:[t.jsx(ae,{icon:t.jsx(O,{}),title:"RF Noise Floor",largeTitle:!0,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-text-muted whitespace-nowrap",children:["min ",t.jsx("span",{className:"text-text-secondary tabular-nums",children:A.min.toFixed(0)})]}),t.jsxs("span",{className:"type-data-xs text-text-muted whitespace-nowrap",children:["avg ",t.jsx("span",{className:"text-text-secondary tabular-nums",children:A.avg.toFixed(0)})]}),t.jsxs("span",{className:"type-data-xs text-text-muted whitespace-nowrap",children:["max ",t.jsx("span",{className:"text-text-secondary tabular-nums",children:A.max.toFixed(0)})]}),t.jsx("span",{className:"type-data-xs text-text-muted",children:"dBm"})]}):t.jsx("span",{className:"type-data-xs text-text-muted",children:"dBm"})}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(it,{children:t.jsx(W,{timestamps:De.timestamps,values:De.values,onStatsChange:X})})})]})})}),t.jsx(xe,{span:12,md:4,children:t.jsx(ht,{packets:N,rangeMinutes:Ne,rangeHours:ve,timeRangeLabel:we.label,isLoaded:w})})]})]})]})]})}export{pt as default}; diff --git a/frontend/dist/assets/System-BYZJTRWn.js b/frontend/dist/assets/System-DjGErvcK.js similarity index 98% rename from frontend/dist/assets/System-BYZJTRWn.js rename to frontend/dist/assets/System-DjGErvcK.js index ff9f8f04..4fa64140 100644 --- a/frontend/dist/assets/System-BYZJTRWn.js +++ b/frontend/dist/assets/System-DjGErvcK.js @@ -1 +1 @@ -import{r as e,j as t,c as s}from"./vendor-react-j_fHog8x.js";import{c as r,a,d as n,bg as o,bh as l,bi as c,bj as i,bk as m,bl as d,aQ as x,aI as u,B as h,bm as p,bn as f}from"./index-CImKXCRQ.js";import{a as g,P as y,b as j,B as b}from"./PageLayout-CBx7rIBL.js";import{T as v}from"./triangle-alert-DRA45BSe.js";import{C as w}from"./Card-DfIcRbRE.js";import{a as N,A as M}from"./arrow-up-CPFFRV-b.js";import{N as k}from"./network-CY6CQ8MF.js";import{A as R}from"./activity-3eg63twO.js";import{R as C}from"./refresh-cw-DElcO6pC.js";import{R as S,C as F}from"./Grid-OFJ4oe0a.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CDNU4oKM.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"}]]),T=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"}]]),B=r("thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]),P=n.hero;function $(){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)"}}function E(e){const t=Math.max(0,Math.min(1,e)),s=[{pos:0,color:{r:142,g:78,b:198}},{pos:.25,color:{r:91,g:91,b:214}},{pos:.5,color:{r:0,g:162,b:199}},{pos:.75,color:{r:255,g:178,b:36}},{pos:1,color:{r:229,g:72,b:77}}];let r=s[0],a=s[s.length-1];for(let l=0;l=s[l].pos&&t<=s[l+1].pos){r=s[l],a=s[l+1];break}const n=a.pos-r.pos,o=n>0?(t-r.pos)/n:0;return function(e,t,s){const r=2.2,a=1/r,n=Math.pow(e.r/255,r),o=Math.pow(e.g/255,r),l=Math.pow(e.b/255,r),c=Math.pow(t.r/255,r),i=Math.pow(t.g/255,r),m=Math.pow(t.b/255,r),d=255*Math.pow(n+s*(c-n),a),x=255*Math.pow(o+s*(i-o),a),u=255*Math.pow(l+s*(m-l),a);return{r:Math.round(Math.max(0,Math.min(255,d))),g:Math.round(Math.max(0,Math.min(255,x))),b:Math.round(Math.max(0,Math.min(255,u)))}}(r.color,a.color,o)}const A=e.memo(function({data:s,cpuColor:r,memoryColor:n}){const l=e.useRef(null),c=e.useRef(null),i=e.useRef([]),m=e.useRef(r),d=e.useRef(n),x=e.useRef(null),u=e.useRef(s.length);e.useLayoutEffect(()=>{m.current=r,d.current=n}),e.useEffect(()=>{x.current=$()},[]);const h=e.useMemo(()=>function(e){const t=[],s=Math.max(0,P-e.length),r=Date.now(),a=o.system;for(let o=0;o{i.current=h},[h]);const p=e.useMemo(()=>[h.map(e=>e.timestamp),new Array(h.length).fill(1)],[h]),f=e.useMemo(()=>({hooks:{draw:e=>{const t=x.current||$();!function(e,t,s,r,a){if(0===t.length)return;const n=e.ctx,{left:o,top:l,width:c,height:i}=e.bbox,m=window.devicePixelRatio||1;if(c<=0||i<=0)return;const d=e.data[0],x=d.length;if(0===x)return;const u=d[0],h=d[x-1]-u||1,p=e=>o+(e-u)/h*c,f=e=>{const t=Math.min(Math.max(e/100,0),1);return l+i*(1-t)};n.save(),n.strokeStyle=a.textPrimary,n.globalAlpha=.1,n.lineWidth=1*m,n.setLineDash([4*m,4*m]);for(const w of[25,50,75]){const e=Math.round(f(w))+.5;n.beginPath(),n.moveTo(Math.round(o),e),n.lineTo(Math.round(o+c),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 g=8*m;for(const w of[0,25,50,75,100]){const e=f(w),t=Math.max(l+g,Math.min(l+i-g,e));n.fillText(`${w}%`,4*m,t)}n.restore(),n.save();const y=c/x;for(let w=0;w0){const e=t[x-1],s=d[x-1];e&&(n.textAlign="right",n.fillText(e.time,p(s),l+i+6*m))}n.restore()}(e,i.current,m.current,d.current,t)}}}),[]),g=e.useMemo(()=>({width:400,height:240,padding:[8,8,24,36],cursor:{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,100]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],plugins:[f]}),[f]);return e.useEffect(()=>{const e=l.current;if(!e||0===h.length)return;const t=u.current,r=s.length,n=Math.abs(r-t);if(!(!c.current||n>50||t>0&&n/t>.2)&&c.current)return c.current.setData(p),void(u.current=r);c.current&&c.current.destroy();const o=e.getBoundingClientRect(),i=Math.floor(o.width)||400,m=Math.floor(o.height)||240,d=new a({...g,width:i,height:m},p,e);return c.current=d,u.current=r,()=>{d.destroy(),c.current=null}},[g,p,h.length,s.length]),e.useEffect(()=>{const e=l.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!c.current)return;const{width:s,height:r}=t.contentRect;s>0&&r>0&&c.current.setSize({width:Math.floor(s),height:Math.floor(r)})});return t.observe(e),()=>{t.disconnect()}},[]),e.useEffect(()=>{c.current&&c.current.redraw()},[r,n,h]),0===s.length?t.jsx("div",{className:"h-[240px] flex items-center justify-center text-text-muted",children:"Collecting data..."}):t.jsx("div",{ref:l,className:"w-full h-[240px] rounded-lg overflow-hidden"})});function D(e){const t=Math.max(0,Math.min(1,e)),s=[{pos:0,color:{r:142,g:78,b:198}},{pos:.25,color:{r:91,g:91,b:214}},{pos:.5,color:{r:0,g:162,b:199}},{pos:.75,color:{r:255,g:178,b:36}},{pos:1,color:{r:229,g:72,b:77}}];let r=s[0],a=s[s.length-1];for(let l=0;l=s[l].pos&&t<=s[l+1].pos){r=s[l],a=s[l+1];break}const n=a.pos-r.pos,o=n>0?(t-r.pos)/n:0;return function(e,t,s){const r=2.2,a=1/r,n=Math.pow(e.r/255,r),o=Math.pow(e.g/255,r),l=Math.pow(e.b/255,r),c=Math.pow(t.r/255,r),i=Math.pow(t.g/255,r),m=Math.pow(t.b/255,r),d=255*Math.pow(n+s*(c-n),a),x=255*Math.pow(o+s*(i-o),a),u=255*Math.pow(l+s*(m-l),a);return{r:Math.round(Math.max(0,Math.min(255,d))),g:Math.round(Math.max(0,Math.min(255,x))),b:Math.round(Math.max(0,Math.min(255,u)))}}(r.color,a.color,o)}const L=e.memo(function({data:s,color:r,flipped:n=!1,fixedSlots:o}){const l=e.useRef(null),c=e.useRef(null),i=e.useRef(s),m=e.useRef(r),d=e.useRef(n),x=e.useRef(o);e.useLayoutEffect(()=>{i.current=s,m.current=r,d.current=n,x.current=o});const u=e.useMemo(()=>[Array.from({length:o},(e,t)=>t),new Array(o).fill(1)],[o]),h=e.useMemo(()=>({hooks:{draw:e=>{!function(e,t,s,r,a){const n=e.ctx,{left:o,top:l,width:c,height:i}=e.bbox;if(c<=0||i<=0)return;const m=[...Array(Math.max(0,a-t.length)).fill(0),...t.slice(-a)],d=Math.max(...m,1),x=m.length,u=c/x,h=.03*i;n.save();for(let p=0;p({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:[h]}),[h]);return e.useEffect(()=>{const e=l.current;if(!e)return;c.current&&c.current.destroy();const t=e.getBoundingClientRect(),s=Math.floor(t.width)||400,r=Math.floor(t.height)||40,n=new a({...p,width:s,height:r},u,e);return c.current=n,()=>{n.destroy(),c.current=null}},[p,u]),e.useEffect(()=>{const e=l.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!c.current)return;const{width:s,height:r}=t.contentRect;s>0&&r>0&&c.current.setSize({width:Math.floor(s),height:Math.floor(r)})});return t.observe(e),()=>{t.disconnect()}},[]),e.useEffect(()=>{c.current&&c.current.redraw()},[s,r,n]),t.jsx("div",{ref:l,className:"w-full h-full"})}),z={warning:80,danger:95},H={warning:85,danger:95},U={warning:70,danger:85},G=[{threshold:30,color:"var(--accent-tertiary)"},{threshold:50,color:"var(--accent-primary)"},{threshold:65,color:"var(--accent-secondary)"},{threshold:80,color:"var(--signal-poor)"}];function O(e,t,s){const r=s-t,a={cold:(30-t)/r*100,normal:(50-t)/r*100,warm:(65-t)/r*100,hot:(80-t)/r*100};return`linear-gradient(to right, ${[{pos:0,color:"var(--accent-tertiary)"},{pos:a.cold,color:"var(--accent-tertiary)"},{pos:a.cold,color:"var(--accent-primary)"},{pos:a.normal,color:"var(--accent-primary)"},{pos:a.normal,color:"var(--accent-secondary)"},{pos:a.warm,color:"var(--accent-secondary)"},{pos:a.warm,color:"var(--signal-poor)"},{pos:a.hot,color:"var(--signal-poor)"},{pos:a.hot,color:"var(--accent-danger)"},{pos:100,color:"var(--accent-danger)"}].map(t=>{const s=e>0?t.pos/e*100:0;return`${t.color} ${Math.min(s,100)}%`}).join(", ")})`}function V(e,t){return e>=t.danger?"danger":e>=t.warning?"warning":"none"}function I(e){let t="none";for(const s of Object.values(e)){const e=V(s,U);if("danger"===e)return"danger";"warning"===e&&(t="warning")}return t}function W(e){let t,s,r;return e>=1073741824?(t=e/1073741824,s="GB/s"):e>=1048576?(t=e/1048576,s="MB/s"):e>=1024?(t=e/1024,s="KB/s"):(t=e,s="B/s"),r=t>=100?t.toFixed(0):t.toFixed(1),`${r} ${s}`}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:t.jsxs("span",{className:s("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium","danger"===e&&"bg-accent-danger/20 text-accent-danger","warning"===e&&"bg-accent-secondary/20 text-accent-secondary"),children:[t.jsx(v,{className:"w-3 h-3"}),"danger"===e?"High":"Warn"]})}),X=e.memo(function({value:e,max:s=100,width:r=10,color:a="primary"}){const n=Math.min(e/s,1),o=Math.round(n*r),l=r-o,c="■".repeat(o),i="·".repeat(l),m={primary:"text-accent-primary",secondary:"text-accent-secondary",success:"text-accent-success",danger:"text-accent-danger"}[a];return t.jsxs("span",{className:"font-mono text-[10px] tracking-tight",children:[t.jsx("span",{className:m,children:c}),t.jsx("span",{className:"text-text-muted/40",children:i})]})}),q=e.memo(function({index:e,usage:r}){const a=r>90?"danger":r>70?"secondary":"primary";return t.jsxs("div",{className:"flex items-center gap-1 text-xs font-mono",children:[t.jsxs("span",{className:"text-text-muted w-5",children:["C",e]}),t.jsx(X,{value:r,width:8,color:a}),t.jsxs("span",{className:s("w-7 text-right tabular-nums",r>90?"text-accent-danger":r>70?"text-accent-secondary":"text-accent-success"),children:[r.toFixed(0),"%"]})]})}),Q=e.memo(function({pid:e,name:r,cpu:a,mem:n,isTopCpu:o=!1,isTopMem:l=!1}){return t.jsxs("div",{className:"flex items-center gap-2 py-1 text-sm font-mono hover:bg-subtle-fill -mx-1 px-1 rounded",children:[t.jsx("span",{className:"text-text-muted w-14 tabular-nums",children:e}),t.jsx("span",{className:"flex-1 truncate text-text-primary",children:r}),t.jsx(X,{value:a,max:100,width:6,color:a>50?"danger":a>20?"secondary":"success"}),t.jsx("span",{className:s("w-12 text-right tabular-nums",o?"text-text-primary":a>50?"text-accent-danger":a>20?"text-accent-secondary":"text-text-muted"),children:a.toFixed(1)}),t.jsx("span",{className:s("w-12 text-right tabular-nums",l?"text-text-primary":n>50?"text-accent-danger":n>20?"text-accent-secondary":"text-text-muted"),children:n.toFixed(1)})]})}),Y=e.memo(function({value:e,label:s,min:r=20,max:a=100}){const n=Math.min(Math.max((e-r)/(a-r)*100,0),100),o=function(e){return e<30?{text:"Cool",color:"text-accent-tertiary"}:e<50?{text:"Normal",color:"text-accent-primary"}:e<65?{text:"Warm",color:"text-accent-secondary"}:e<80?{text:"Hot",color:"text-signal-poor"}:{text:"Danger",color:"text-accent-danger"}}(e),l=a-r;return t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:s}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:o.text}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded text-sm font-mono tabular-nums",children:[t.jsx("span",{className:o.color,children:e.toFixed(1)}),t.jsx("span",{className:"text-text-primary",children:"°C"})]})]})]}),t.jsxs("div",{className:"relative h-3 bg-subtle-fill overflow-hidden",children:[t.jsx("div",{className:"absolute inset-y-0 left-0 transition-all duration-300 ease-out",style:{background:O(n,r,a),width:`${n}%`}}),t.jsx("div",{className:"absolute inset-0 flex items-center pointer-events-none",children:G.map(({threshold:e,color:s})=>{const a=(e-r)/l*100;return a<0||a>100?null:t.jsx("div",{className:"absolute w-px h-full",style:{left:`${a}%`,backgroundColor:s}},e)})})]})]})});e.memo(function({data:e,color:s,flipped:r=!1,fixedSlots:a}){const n=[...Array(Math.max(0,a-e.length)).fill(0),...e.slice(-a)],o=Math.max(...n,1),l=n.map(e=>0===e?0:Math.max(e/o*100,3));return t.jsx("div",{className:"w-full h-full flex items-end",style:{transform:r?"scaleY(-1)":void 0},children:l.map((e,r)=>t.jsx("div",{className:"flex-1 min-w-0",style:{height:e>0?`${e}%`:"0%",backgroundColor:e>0?s:"transparent"}},r))})});const Z=e.memo(function({networkHistory:e,txRate:s,rxRate:r,totalBytesSent:a,totalBytesRecv:n,cpuColor:o,memoryColor:l,networkSlots:c}){return t.jsxs(g,{className:"flex flex-col",children:[t.jsx(w,{icon:t.jsx(k,{}),title:"Network",largeTitle:!0,actions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(N,{className:"w-3.5 h-3.5",style:{color:l}}),t.jsx("span",{className:"text-xs font-mono",style:{color:l},children:"TX"}),t.jsx("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded text-sm font-mono tabular-nums text-text-primary",children:W(s)})]})}),t.jsxs("div",{className:"flex flex-col h-[120px]",children:[t.jsx("div",{className:"h-[60px]",children:t.jsx(L,{data:e.map((e,t,s)=>{if(0===t)return 0;const r=(e.timestamp-s[t-1].timestamp)/1e3;return r>0?(e.bytesSent-s[t-1].bytesSent)/r:0}),color:l,fixedSlots:c})}),t.jsx("div",{className:"h-[60px]",children:t.jsx(L,{data:e.map((e,t,s)=>{if(0===t)return 0;const r=(e.timestamp-s[t-1].timestamp)/1e3;return r>0?(e.bytesRecv-s[t-1].bytesRecv)/r:0}),color:o,flipped:!0,fixedSlots:c})})]}),t.jsxs("div",{className:"pt-2 flex justify-between items-center text-sm font-mono",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-text-muted",children:"Total"}),t.jsxs("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded tabular-nums",children:[t.jsx("span",{className:"text-accent-tertiary",children:J(a).value})," ",t.jsx("span",{className:"text-text-muted",children:J(a).unit})]}),t.jsxs("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded tabular-nums",children:[t.jsx("span",{className:"text-accent-primary",children:J(n).value})," ",t.jsx("span",{className:"text-text-muted",children:J(n).unit})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(M,{className:"w-3.5 h-3.5",style:{color:o}}),t.jsx("span",{className:"text-xs font-mono",style:{color:o},children:"RX"}),t.jsx("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded tabular-nums text-text-primary",children:W(r)})]})]})]})}),ee=e.memo(function({temperatures:e}){return t.jsxs(g,{className:"flex flex-col",children:[t.jsx(w,{icon:t.jsx(B,{}),title:"Temperature",largeTitle:!0,actions:e&&t.jsx(K,{level:I(e)})}),t.jsx("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:e&&Object.keys(e).length>0?t.jsxs("div",{className:"space-y-3",children:[void 0!==e.cpu_thermal&&t.jsx(Y,{value:e.cpu_thermal,label:"CPU",min:20,max:100}),Object.entries(e).filter(([e])=>"cpu_thermal"!==e).slice(0,2).map(([e,s])=>t.jsx(Y,{value:s,label:e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),min:20,max:100},e))]}):t.jsxs("div",{className:"flex items-center justify-center text-text-muted text-sm",children:[t.jsx(R,{className:"w-4 h-4 mr-2"}),"No sensors"]})})]})}),te=e.memo(function({usagePercent:e,used:s,available:r,memoryColor:a}){return t.jsxs(g,{className:"flex flex-col",children:[t.jsx(w,{icon:t.jsx(R,{}),title:"Memory",largeTitle:!0,actions:t.jsxs("span",{className:"px-2 py-0.5 bg-subtle-fill-strong rounded text-base font-mono tabular-nums",style:{color:a},children:[e.toFixed(0),"%"]})}),t.jsxs("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:[t.jsxs("div",{className:"flex gap-1 h-12",children:[t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-primary",style:{width:`${e}%`}}),t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-tertiary",style:{width:100-e+"%"}})]}),t.jsxs("div",{className:"flex items-center justify-between text-xs font-mono pt-2",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-primary"}),t.jsx("span",{className:"text-text-muted",children:"Used"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-primary",children:[(s/1048576).toFixed(0)," MB"]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-tertiary"}),t.jsx("span",{className:"text-text-muted",children:"Avail"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-muted",children:[(r/1048576).toFixed(0)," MB"]})]})]})]})]})}),se=e.memo(function({usagePercent:e,used:s,free:r,cpuColor:a}){return t.jsxs(g,{className:"flex flex-col",children:[t.jsx(w,{icon:t.jsx(T,{}),title:"Disk",largeTitle:!0,actions:t.jsxs("span",{className:"px-2 py-0.5 bg-subtle-fill-strong rounded text-base font-mono tabular-nums",style:{color:a},children:[e.toFixed(0),"%"]})}),t.jsxs("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:[t.jsxs("div",{className:"flex gap-1 h-12",children:[t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-primary",style:{width:`${e}%`}}),t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-tertiary",style:{width:100-e+"%"}})]}),t.jsxs("div",{className:"flex items-center justify-between text-xs font-mono pt-2",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-primary"}),t.jsx("span",{className:"text-text-muted",children:"Used"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-primary",children:[(s/1073741824).toFixed(1)," GB"]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-tertiary"}),t.jsx("span",{className:"text-text-muted",children:"Free"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-muted",children:[(r/1073741824).toFixed(1)," GB"]})]})]})]})]})}),re=e.memo(function({processes:e}){if(0===e.length)return null;const s=e.slice(0,10),r=Math.max(...s.map(e=>e.cpu_percent)),a=Math.max(...s.map(e=>e.memory_percent));return t.jsx(g,{noPadding:!0,children:t.jsxs("div",{className:"px-4 py-3",children:[t.jsx(w,{icon:t.jsx(R,{}),title:"Processes",largeTitle:!0}),t.jsxs("div",{className:"flex items-center gap-2 py-1.5 text-sm text-text-muted border-b border-border-subtle font-mono",children:[t.jsx("span",{className:"w-14",children:"PID"}),t.jsx("span",{className:"flex-1",children:"Program"}),t.jsx("span",{className:"w-[52px]"}),t.jsx("span",{className:"w-12 text-right",children:"CPU%"}),t.jsx("span",{className:"w-12 text-right",children:"MEM%"})]}),s.map(e=>t.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=n.hero;function ne(){var r;const a=l(),o=c(),v=i(),N=m(),M=d(),[k,T]=e.useState([]),[B,P]=e.useState(!1),[$,E]=e.useState([]),[D,L]=e.useState(0),[U,G]=e.useState(0),O=e.useRef(null),I=x().primary,W=u().amber,J=function(){const[t,s]=e.useState("undefined"!=typeof window&&window.matchMedia("(max-width: 767px)").matches);return e.useEffect(()=>{const e=window.matchMedia("(max-width: 767px)");s(e.matches);const t=e=>s(e.matches);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),t?n.hero:40}();return e.useEffect(()=>{if(!a)return;const e=Date.now(),t={timestamp:e,bytesRecv:a.network.bytes_recv,bytesSent:a.network.bytes_sent};if(O.current){const s=(e-O.current.timestamp)/1e3;if(s>0){const e=(t.bytesRecv-O.current.bytesRecv)/s,r=(t.bytesSent-O.current.bytesSent)/s;e>=0&&r>=0&&(L(e),G(r))}}O.current=t,E(e=>[...e,t].slice(-ae))},[a]),e.useEffect(()=>{let e=!0;const t=async()=>{var t;const s=await f();e&&s.success&&(null==(t=s.data)?void 0:t.processes)&&T(s.data.processes)};t();const s=setInterval(t,5e3);return()=>{e=!1,clearInterval(s)}},[]),t.jsxs(y,{children:[t.jsx(j,{title:"System Stats",icon:t.jsx(_,{}),controls:t.jsxs(h,{color:"muted",onClick:async()=>{var e;P(!0),await N();const t=await f();t.success&&(null==(e=t.data)?void 0:e.processes)&&T(t.data.processes),P(!1)},disabled:B,children:[t.jsx(C,{"data-slot":"icon",className:s(B&&"animate-spin")}),"Refresh"]})}),t.jsxs(b,{children:[v&&t.jsx(g,{className:"border border-accent-danger/50 bg-accent-danger/10",children:t.jsx("p",{className:"text-accent-danger",children:v})}),o?t.jsx(g,{className:"p-12 text-center",children:t.jsx("div",{className:"animate-pulse text-text-muted",children:"Loading system stats..."})}):a?t.jsxs(t.Fragment,{children:[t.jsx(S,{template:"hero",children:t.jsxs(g,{children:[t.jsx(w,{icon:t.jsx(R,{}),title:"System Resources",largeTitle:!0,actions:t.jsxs("div",{className:"flex items-center gap-4",children:[(null==(r=a.system)?void 0:r.uptime)&&t.jsx("span",{className:"px-2 py-0.5 bg-subtle-fill rounded text-sm font-mono tabular-nums text-text-primary",children:p(a.system.uptime)}),t.jsx(K,{level:V(a.cpu.usage_percent,z)}),t.jsx(K,{level:V(a.memory.usage_percent,H)}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:"CPU"}),t.jsxs("span",{className:"text-base font-mono font-semibold tabular-nums",style:{color:I},children:[a.cpu.usage_percent.toFixed(0),"%"]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:"MEM"}),t.jsxs("span",{className:"text-base font-mono font-semibold tabular-nums",style:{color:W},children:[a.memory.usage_percent.toFixed(0),"%"]})]})]})}),t.jsx("div",{className:"flex-1 min-h-0 mt-2",children:t.jsx(A,{data:M,cpuColor:I,memoryColor:W})}),a.cpu.per_core_percent&&a.cpu.per_core_percent.length>0&&t.jsx("div",{className:"mt-3 pt-3 border-t border-border-subtle",children:t.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,s)=>t.jsx(q,{index:s,usage:e},s))})})]})}),t.jsxs(S,{template:"compact",children:[t.jsx(F,{span:12,md:6,children:t.jsx(Z,{networkHistory:$,txRate:U,rxRate:D,totalBytesSent:a.network.bytes_sent,totalBytesRecv:a.network.bytes_recv,cpuColor:I,memoryColor:W,networkSlots:J})}),t.jsx(F,{span:12,md:6,children:t.jsx(ee,{temperatures:a.temperatures})})]}),t.jsxs(S,{template:"compact",children:[t.jsx(F,{span:6,children:t.jsx(te,{usagePercent:a.memory.usage_percent,used:a.memory.used,available:a.memory.available,memoryColor:W})}),t.jsx(F,{span:6,children:t.jsx(se,{usagePercent:a.disk.usage_percent,used:a.disk.used,free:a.disk.free,cpuColor:I})})]}),t.jsx(S,{template:"auto",children:t.jsx(re,{processes:k})})]}):null]})]})}export{ne as default}; +import{r as e,j as t,c as s}from"./vendor-react-j_fHog8x.js";import{c as r,a,d as n,bg as o,bh as l,bi as c,bj as i,bk as m,bl as d,aQ as x,aI as u,B as h,bm as p,bn as f}from"./index-B51aMfiH.js";import{a as g,P as y,b as j,B as b}from"./PageLayout-DUXmuiZg.js";import{T as v}from"./triangle-alert-JpcXY4mr.js";import{C as w}from"./Card-BC0izdLh.js";import{a as N,A as M}from"./arrow-up-By-lyY8m.js";import{N as k}from"./network-D76gOy_X.js";import{A as R}from"./activity-48nFba-7.js";import{R as C}from"./refresh-cw-BcvCKflD.js";import{R as S,C as F}from"./Grid-OFJ4oe0a.js";import"./maplibre-gl-b91ci4Kr.js";import"./vendor-core-CDNU4oKM.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"}]]),T=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"}]]),B=r("thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]),P=n.hero;function $(){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)"}}function E(e){const t=Math.max(0,Math.min(1,e)),s=[{pos:0,color:{r:142,g:78,b:198}},{pos:.25,color:{r:91,g:91,b:214}},{pos:.5,color:{r:0,g:162,b:199}},{pos:.75,color:{r:255,g:178,b:36}},{pos:1,color:{r:229,g:72,b:77}}];let r=s[0],a=s[s.length-1];for(let l=0;l=s[l].pos&&t<=s[l+1].pos){r=s[l],a=s[l+1];break}const n=a.pos-r.pos,o=n>0?(t-r.pos)/n:0;return function(e,t,s){const r=2.2,a=1/r,n=Math.pow(e.r/255,r),o=Math.pow(e.g/255,r),l=Math.pow(e.b/255,r),c=Math.pow(t.r/255,r),i=Math.pow(t.g/255,r),m=Math.pow(t.b/255,r),d=255*Math.pow(n+s*(c-n),a),x=255*Math.pow(o+s*(i-o),a),u=255*Math.pow(l+s*(m-l),a);return{r:Math.round(Math.max(0,Math.min(255,d))),g:Math.round(Math.max(0,Math.min(255,x))),b:Math.round(Math.max(0,Math.min(255,u)))}}(r.color,a.color,o)}const A=e.memo(function({data:s,cpuColor:r,memoryColor:n}){const l=e.useRef(null),c=e.useRef(null),i=e.useRef([]),m=e.useRef(r),d=e.useRef(n),x=e.useRef(null),u=e.useRef(s.length);e.useLayoutEffect(()=>{m.current=r,d.current=n}),e.useEffect(()=>{x.current=$()},[]);const h=e.useMemo(()=>function(e){const t=[],s=Math.max(0,P-e.length),r=Date.now(),a=o.system;for(let o=0;o{i.current=h},[h]);const p=e.useMemo(()=>[h.map(e=>e.timestamp),new Array(h.length).fill(1)],[h]),f=e.useMemo(()=>({hooks:{draw:e=>{const t=x.current||$();!function(e,t,s,r,a){if(0===t.length)return;const n=e.ctx,{left:o,top:l,width:c,height:i}=e.bbox,m=window.devicePixelRatio||1;if(c<=0||i<=0)return;const d=e.data[0],x=d.length;if(0===x)return;const u=d[0],h=d[x-1]-u||1,p=e=>o+(e-u)/h*c,f=e=>{const t=Math.min(Math.max(e/100,0),1);return l+i*(1-t)};n.save(),n.strokeStyle=a.textPrimary,n.globalAlpha=.1,n.lineWidth=1*m,n.setLineDash([4*m,4*m]);for(const w of[25,50,75]){const e=Math.round(f(w))+.5;n.beginPath(),n.moveTo(Math.round(o),e),n.lineTo(Math.round(o+c),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 g=8*m;for(const w of[0,25,50,75,100]){const e=f(w),t=Math.max(l+g,Math.min(l+i-g,e));n.fillText(`${w}%`,4*m,t)}n.restore(),n.save();const y=c/x;for(let w=0;w0){const e=t[x-1],s=d[x-1];e&&(n.textAlign="right",n.fillText(e.time,p(s),l+i+6*m))}n.restore()}(e,i.current,m.current,d.current,t)}}}),[]),g=e.useMemo(()=>({width:400,height:240,padding:[8,8,24,36],cursor:{show:!1,x:!1,y:!1,drag:{x:!1,y:!1},points:{show:!1}},scales:{x:{time:!0},y:{range:[0,100]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],plugins:[f]}),[f]);return e.useEffect(()=>{const e=l.current;if(!e||0===h.length)return;const t=u.current,r=s.length,n=Math.abs(r-t);if(!(!c.current||n>50||t>0&&n/t>.2)&&c.current)return c.current.setData(p),void(u.current=r);c.current&&c.current.destroy();const o=e.getBoundingClientRect(),i=Math.floor(o.width)||400,m=Math.floor(o.height)||240,d=new a({...g,width:i,height:m},p,e);return c.current=d,u.current=r,()=>{d.destroy(),c.current=null}},[g,p,h.length,s.length]),e.useEffect(()=>{const e=l.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!c.current)return;const{width:s,height:r}=t.contentRect;s>0&&r>0&&c.current.setSize({width:Math.floor(s),height:Math.floor(r)})});return t.observe(e),()=>{t.disconnect()}},[]),e.useEffect(()=>{c.current&&c.current.redraw()},[r,n,h]),0===s.length?t.jsx("div",{className:"h-[240px] flex items-center justify-center text-text-muted",children:"Collecting data..."}):t.jsx("div",{ref:l,className:"w-full h-[240px] rounded-lg overflow-hidden"})});function D(e){const t=Math.max(0,Math.min(1,e)),s=[{pos:0,color:{r:142,g:78,b:198}},{pos:.25,color:{r:91,g:91,b:214}},{pos:.5,color:{r:0,g:162,b:199}},{pos:.75,color:{r:255,g:178,b:36}},{pos:1,color:{r:229,g:72,b:77}}];let r=s[0],a=s[s.length-1];for(let l=0;l=s[l].pos&&t<=s[l+1].pos){r=s[l],a=s[l+1];break}const n=a.pos-r.pos,o=n>0?(t-r.pos)/n:0;return function(e,t,s){const r=2.2,a=1/r,n=Math.pow(e.r/255,r),o=Math.pow(e.g/255,r),l=Math.pow(e.b/255,r),c=Math.pow(t.r/255,r),i=Math.pow(t.g/255,r),m=Math.pow(t.b/255,r),d=255*Math.pow(n+s*(c-n),a),x=255*Math.pow(o+s*(i-o),a),u=255*Math.pow(l+s*(m-l),a);return{r:Math.round(Math.max(0,Math.min(255,d))),g:Math.round(Math.max(0,Math.min(255,x))),b:Math.round(Math.max(0,Math.min(255,u)))}}(r.color,a.color,o)}const L=e.memo(function({data:s,color:r,flipped:n=!1,fixedSlots:o}){const l=e.useRef(null),c=e.useRef(null),i=e.useRef(s),m=e.useRef(r),d=e.useRef(n),x=e.useRef(o);e.useLayoutEffect(()=>{i.current=s,m.current=r,d.current=n,x.current=o});const u=e.useMemo(()=>[Array.from({length:o},(e,t)=>t),new Array(o).fill(1)],[o]),h=e.useMemo(()=>({hooks:{draw:e=>{!function(e,t,s,r,a){const n=e.ctx,{left:o,top:l,width:c,height:i}=e.bbox;if(c<=0||i<=0)return;const m=[...Array(Math.max(0,a-t.length)).fill(0),...t.slice(-a)],d=Math.max(...m,1),x=m.length,u=c/x,h=.03*i;n.save();for(let p=0;p({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:[h]}),[h]);return e.useEffect(()=>{const e=l.current;if(!e)return;c.current&&c.current.destroy();const t=e.getBoundingClientRect(),s=Math.floor(t.width)||400,r=Math.floor(t.height)||40,n=new a({...p,width:s,height:r},u,e);return c.current=n,()=>{n.destroy(),c.current=null}},[p,u]),e.useEffect(()=>{const e=l.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!c.current)return;const{width:s,height:r}=t.contentRect;s>0&&r>0&&c.current.setSize({width:Math.floor(s),height:Math.floor(r)})});return t.observe(e),()=>{t.disconnect()}},[]),e.useEffect(()=>{c.current&&c.current.redraw()},[s,r,n]),t.jsx("div",{ref:l,className:"w-full h-full"})}),z={warning:80,danger:95},H={warning:85,danger:95},U={warning:70,danger:85},G=[{threshold:30,color:"var(--accent-tertiary)"},{threshold:50,color:"var(--accent-primary)"},{threshold:65,color:"var(--accent-secondary)"},{threshold:80,color:"var(--signal-poor)"}];function O(e,t,s){const r=s-t,a={cold:(30-t)/r*100,normal:(50-t)/r*100,warm:(65-t)/r*100,hot:(80-t)/r*100};return`linear-gradient(to right, ${[{pos:0,color:"var(--accent-tertiary)"},{pos:a.cold,color:"var(--accent-tertiary)"},{pos:a.cold,color:"var(--accent-primary)"},{pos:a.normal,color:"var(--accent-primary)"},{pos:a.normal,color:"var(--accent-secondary)"},{pos:a.warm,color:"var(--accent-secondary)"},{pos:a.warm,color:"var(--signal-poor)"},{pos:a.hot,color:"var(--signal-poor)"},{pos:a.hot,color:"var(--accent-danger)"},{pos:100,color:"var(--accent-danger)"}].map(t=>{const s=e>0?t.pos/e*100:0;return`${t.color} ${Math.min(s,100)}%`}).join(", ")})`}function V(e,t){return e>=t.danger?"danger":e>=t.warning?"warning":"none"}function I(e){let t="none";for(const s of Object.values(e)){const e=V(s,U);if("danger"===e)return"danger";"warning"===e&&(t="warning")}return t}function W(e){let t,s,r;return e>=1073741824?(t=e/1073741824,s="GB/s"):e>=1048576?(t=e/1048576,s="MB/s"):e>=1024?(t=e/1024,s="KB/s"):(t=e,s="B/s"),r=t>=100?t.toFixed(0):t.toFixed(1),`${r} ${s}`}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:t.jsxs("span",{className:s("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium","danger"===e&&"bg-accent-danger/20 text-accent-danger","warning"===e&&"bg-accent-secondary/20 text-accent-secondary"),children:[t.jsx(v,{className:"w-3 h-3"}),"danger"===e?"High":"Warn"]})}),X=e.memo(function({value:e,max:s=100,width:r=10,color:a="primary"}){const n=Math.min(e/s,1),o=Math.round(n*r),l=r-o,c="■".repeat(o),i="·".repeat(l),m={primary:"text-accent-primary",secondary:"text-accent-secondary",success:"text-accent-success",danger:"text-accent-danger"}[a];return t.jsxs("span",{className:"font-mono text-[10px] tracking-tight",children:[t.jsx("span",{className:m,children:c}),t.jsx("span",{className:"text-text-muted/40",children:i})]})}),q=e.memo(function({index:e,usage:r}){const a=r>90?"danger":r>70?"secondary":"primary";return t.jsxs("div",{className:"flex items-center gap-1 text-xs font-mono",children:[t.jsxs("span",{className:"text-text-muted w-5",children:["C",e]}),t.jsx(X,{value:r,width:8,color:a}),t.jsxs("span",{className:s("w-7 text-right tabular-nums",r>90?"text-accent-danger":r>70?"text-accent-secondary":"text-accent-success"),children:[r.toFixed(0),"%"]})]})}),Q=e.memo(function({pid:e,name:r,cpu:a,mem:n,isTopCpu:o=!1,isTopMem:l=!1}){return t.jsxs("div",{className:"flex items-center gap-2 py-1 text-sm font-mono hover:bg-subtle-fill -mx-1 px-1 rounded",children:[t.jsx("span",{className:"text-text-muted w-14 tabular-nums",children:e}),t.jsx("span",{className:"flex-1 truncate text-text-primary",children:r}),t.jsx(X,{value:a,max:100,width:6,color:a>50?"danger":a>20?"secondary":"success"}),t.jsx("span",{className:s("w-12 text-right tabular-nums",o?"text-text-primary":a>50?"text-accent-danger":a>20?"text-accent-secondary":"text-text-muted"),children:a.toFixed(1)}),t.jsx("span",{className:s("w-12 text-right tabular-nums",l?"text-text-primary":n>50?"text-accent-danger":n>20?"text-accent-secondary":"text-text-muted"),children:n.toFixed(1)})]})}),Y=e.memo(function({value:e,label:s,min:r=20,max:a=100}){const n=Math.min(Math.max((e-r)/(a-r)*100,0),100),o=function(e){return e<30?{text:"Cool",color:"text-accent-tertiary"}:e<50?{text:"Normal",color:"text-accent-primary"}:e<65?{text:"Warm",color:"text-accent-secondary"}:e<80?{text:"Hot",color:"text-signal-poor"}:{text:"Danger",color:"text-accent-danger"}}(e),l=a-r;return t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:s}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:o.text}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded text-sm font-mono tabular-nums",children:[t.jsx("span",{className:o.color,children:e.toFixed(1)}),t.jsx("span",{className:"text-text-primary",children:"°C"})]})]})]}),t.jsxs("div",{className:"relative h-3 bg-subtle-fill overflow-hidden",children:[t.jsx("div",{className:"absolute inset-y-0 left-0 transition-all duration-300 ease-out",style:{background:O(n,r,a),width:`${n}%`}}),t.jsx("div",{className:"absolute inset-0 flex items-center pointer-events-none",children:G.map(({threshold:e,color:s})=>{const a=(e-r)/l*100;return a<0||a>100?null:t.jsx("div",{className:"absolute w-px h-full",style:{left:`${a}%`,backgroundColor:s}},e)})})]})]})});e.memo(function({data:e,color:s,flipped:r=!1,fixedSlots:a}){const n=[...Array(Math.max(0,a-e.length)).fill(0),...e.slice(-a)],o=Math.max(...n,1),l=n.map(e=>0===e?0:Math.max(e/o*100,3));return t.jsx("div",{className:"w-full h-full flex items-end",style:{transform:r?"scaleY(-1)":void 0},children:l.map((e,r)=>t.jsx("div",{className:"flex-1 min-w-0",style:{height:e>0?`${e}%`:"0%",backgroundColor:e>0?s:"transparent"}},r))})});const Z=e.memo(function({networkHistory:e,txRate:s,rxRate:r,totalBytesSent:a,totalBytesRecv:n,cpuColor:o,memoryColor:l,networkSlots:c}){return t.jsxs(g,{className:"flex flex-col",children:[t.jsx(w,{icon:t.jsx(k,{}),title:"Network",largeTitle:!0,actions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(N,{className:"w-3.5 h-3.5",style:{color:l}}),t.jsx("span",{className:"text-xs font-mono",style:{color:l},children:"TX"}),t.jsx("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded text-sm font-mono tabular-nums text-text-primary",children:W(s)})]})}),t.jsxs("div",{className:"flex flex-col h-[120px]",children:[t.jsx("div",{className:"h-[60px]",children:t.jsx(L,{data:e.map((e,t,s)=>{if(0===t)return 0;const r=(e.timestamp-s[t-1].timestamp)/1e3;return r>0?(e.bytesSent-s[t-1].bytesSent)/r:0}),color:l,fixedSlots:c})}),t.jsx("div",{className:"h-[60px]",children:t.jsx(L,{data:e.map((e,t,s)=>{if(0===t)return 0;const r=(e.timestamp-s[t-1].timestamp)/1e3;return r>0?(e.bytesRecv-s[t-1].bytesRecv)/r:0}),color:o,flipped:!0,fixedSlots:c})})]}),t.jsxs("div",{className:"pt-2 flex justify-between items-center text-sm font-mono",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-text-muted",children:"Total"}),t.jsxs("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded tabular-nums",children:[t.jsx("span",{className:"text-accent-tertiary",children:J(a).value})," ",t.jsx("span",{className:"text-text-muted",children:J(a).unit})]}),t.jsxs("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded tabular-nums",children:[t.jsx("span",{className:"text-accent-primary",children:J(n).value})," ",t.jsx("span",{className:"text-text-muted",children:J(n).unit})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(M,{className:"w-3.5 h-3.5",style:{color:o}}),t.jsx("span",{className:"text-xs font-mono",style:{color:o},children:"RX"}),t.jsx("span",{className:"px-2 py-1 bg-subtle-fill-strong rounded tabular-nums text-text-primary",children:W(r)})]})]})]})}),ee=e.memo(function({temperatures:e}){return t.jsxs(g,{className:"flex flex-col",children:[t.jsx(w,{icon:t.jsx(B,{}),title:"Temperature",largeTitle:!0,actions:e&&t.jsx(K,{level:I(e)})}),t.jsx("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:e&&Object.keys(e).length>0?t.jsxs("div",{className:"space-y-3",children:[void 0!==e.cpu_thermal&&t.jsx(Y,{value:e.cpu_thermal,label:"CPU",min:20,max:100}),Object.entries(e).filter(([e])=>"cpu_thermal"!==e).slice(0,2).map(([e,s])=>t.jsx(Y,{value:s,label:e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),min:20,max:100},e))]}):t.jsxs("div",{className:"flex items-center justify-center text-text-muted text-sm",children:[t.jsx(R,{className:"w-4 h-4 mr-2"}),"No sensors"]})})]})}),te=e.memo(function({usagePercent:e,used:s,available:r,memoryColor:a}){return t.jsxs(g,{className:"flex flex-col",children:[t.jsx(w,{icon:t.jsx(R,{}),title:"Memory",largeTitle:!0,actions:t.jsxs("span",{className:"px-2 py-0.5 bg-subtle-fill-strong rounded text-base font-mono tabular-nums",style:{color:a},children:[e.toFixed(0),"%"]})}),t.jsxs("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:[t.jsxs("div",{className:"flex gap-1 h-12",children:[t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-primary",style:{width:`${e}%`}}),t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-tertiary",style:{width:100-e+"%"}})]}),t.jsxs("div",{className:"flex items-center justify-between text-xs font-mono pt-2",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-primary"}),t.jsx("span",{className:"text-text-muted",children:"Used"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-primary",children:[(s/1048576).toFixed(0)," MB"]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-tertiary"}),t.jsx("span",{className:"text-text-muted",children:"Avail"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-muted",children:[(r/1048576).toFixed(0)," MB"]})]})]})]})]})}),se=e.memo(function({usagePercent:e,used:s,free:r,cpuColor:a}){return t.jsxs(g,{className:"flex flex-col",children:[t.jsx(w,{icon:t.jsx(T,{}),title:"Disk",largeTitle:!0,actions:t.jsxs("span",{className:"px-2 py-0.5 bg-subtle-fill-strong rounded text-base font-mono tabular-nums",style:{color:a},children:[e.toFixed(0),"%"]})}),t.jsxs("div",{className:"flex-1 flex flex-col justify-center min-h-0",children:[t.jsxs("div",{className:"flex gap-1 h-12",children:[t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-primary",style:{width:`${e}%`}}),t.jsx("div",{className:"h-full transition-all duration-300 bg-accent-tertiary",style:{width:100-e+"%"}})]}),t.jsxs("div",{className:"flex items-center justify-between text-xs font-mono pt-2",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-primary"}),t.jsx("span",{className:"text-text-muted",children:"Used"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-primary",children:[(s/1073741824).toFixed(1)," GB"]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("div",{className:"w-2.5 h-2.5 rounded-sm bg-accent-tertiary"}),t.jsx("span",{className:"text-text-muted",children:"Free"}),t.jsxs("span",{className:"px-1.5 py-0.5 bg-subtle-fill-strong rounded tabular-nums text-text-muted",children:[(r/1073741824).toFixed(1)," GB"]})]})]})]})]})}),re=e.memo(function({processes:e}){if(0===e.length)return null;const s=e.slice(0,10),r=Math.max(...s.map(e=>e.cpu_percent)),a=Math.max(...s.map(e=>e.memory_percent));return t.jsx(g,{noPadding:!0,children:t.jsxs("div",{className:"px-4 py-3",children:[t.jsx(w,{icon:t.jsx(R,{}),title:"Processes",largeTitle:!0}),t.jsxs("div",{className:"flex items-center gap-2 py-1.5 text-sm text-text-muted border-b border-border-subtle font-mono",children:[t.jsx("span",{className:"w-14",children:"PID"}),t.jsx("span",{className:"flex-1",children:"Program"}),t.jsx("span",{className:"w-[52px]"}),t.jsx("span",{className:"w-12 text-right",children:"CPU%"}),t.jsx("span",{className:"w-12 text-right",children:"MEM%"})]}),s.map(e=>t.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=n.hero;function ne(){var r;const a=l(),o=c(),v=i(),N=m(),M=d(),[k,T]=e.useState([]),[B,P]=e.useState(!1),[$,E]=e.useState([]),[D,L]=e.useState(0),[U,G]=e.useState(0),O=e.useRef(null),I=x().primary,W=u().amber,J=function(){const[t,s]=e.useState("undefined"!=typeof window&&window.matchMedia("(max-width: 767px)").matches);return e.useEffect(()=>{const e=window.matchMedia("(max-width: 767px)");s(e.matches);const t=e=>s(e.matches);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),t?n.hero:40}();return e.useEffect(()=>{if(!a)return;const e=Date.now(),t={timestamp:e,bytesRecv:a.network.bytes_recv,bytesSent:a.network.bytes_sent};if(O.current){const s=(e-O.current.timestamp)/1e3;if(s>0){const e=(t.bytesRecv-O.current.bytesRecv)/s,r=(t.bytesSent-O.current.bytesSent)/s;e>=0&&r>=0&&(L(e),G(r))}}O.current=t,E(e=>[...e,t].slice(-ae))},[a]),e.useEffect(()=>{let e=!0;const t=async()=>{var t;const s=await f();e&&s.success&&(null==(t=s.data)?void 0:t.processes)&&T(s.data.processes)};t();const s=setInterval(t,5e3);return()=>{e=!1,clearInterval(s)}},[]),t.jsxs(y,{children:[t.jsx(j,{title:"System Stats",icon:t.jsx(_,{}),controls:t.jsxs(h,{color:"muted",onClick:async()=>{var e;P(!0),await N();const t=await f();t.success&&(null==(e=t.data)?void 0:e.processes)&&T(t.data.processes),P(!1)},disabled:B,children:[t.jsx(C,{"data-slot":"icon",className:s(B&&"animate-spin")}),"Refresh"]})}),t.jsxs(b,{children:[v&&t.jsx(g,{className:"border border-accent-danger/50 bg-accent-danger/10",children:t.jsx("p",{className:"text-accent-danger",children:v})}),o?t.jsx(g,{className:"p-12 text-center",children:t.jsx("div",{className:"animate-pulse text-text-muted",children:"Loading system stats..."})}):a?t.jsxs(t.Fragment,{children:[t.jsx(S,{template:"hero",children:t.jsxs(g,{children:[t.jsx(w,{icon:t.jsx(R,{}),title:"System Resources",largeTitle:!0,actions:t.jsxs("div",{className:"flex items-center gap-4",children:[(null==(r=a.system)?void 0:r.uptime)&&t.jsx("span",{className:"px-2 py-0.5 bg-subtle-fill rounded text-sm font-mono tabular-nums text-text-primary",children:p(a.system.uptime)}),t.jsx(K,{level:V(a.cpu.usage_percent,z)}),t.jsx(K,{level:V(a.memory.usage_percent,H)}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:"CPU"}),t.jsxs("span",{className:"text-base font-mono font-semibold tabular-nums",style:{color:I},children:[a.cpu.usage_percent.toFixed(0),"%"]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-mono text-text-muted",children:"MEM"}),t.jsxs("span",{className:"text-base font-mono font-semibold tabular-nums",style:{color:W},children:[a.memory.usage_percent.toFixed(0),"%"]})]})]})}),t.jsx("div",{className:"flex-1 min-h-0 mt-2",children:t.jsx(A,{data:M,cpuColor:I,memoryColor:W})}),a.cpu.per_core_percent&&a.cpu.per_core_percent.length>0&&t.jsx("div",{className:"mt-3 pt-3 border-t border-border-subtle",children:t.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,s)=>t.jsx(q,{index:s,usage:e},s))})})]})}),t.jsxs(S,{template:"compact",children:[t.jsx(F,{span:12,md:6,children:t.jsx(Z,{networkHistory:$,txRate:U,rxRate:D,totalBytesSent:a.network.bytes_sent,totalBytesRecv:a.network.bytes_recv,cpuColor:I,memoryColor:W,networkSlots:J})}),t.jsx(F,{span:12,md:6,children:t.jsx(ee,{temperatures:a.temperatures})})]}),t.jsxs(S,{template:"compact",children:[t.jsx(F,{span:6,children:t.jsx(te,{usagePercent:a.memory.usage_percent,used:a.memory.used,available:a.memory.available,memoryColor:W})}),t.jsx(F,{span:6,children:t.jsx(se,{usagePercent:a.disk.usage_percent,used:a.disk.used,free:a.disk.free,cpuColor:I})})]}),t.jsx(S,{template:"auto",children:t.jsx(re,{processes:k})})]}):null]})]})}export{ne as default}; diff --git a/frontend/dist/assets/Terminal-DTrsKkeR.js b/frontend/dist/assets/Terminal-DTrsKkeR.js deleted file mode 100644 index abf65ada..00000000 --- a/frontend/dist/assets/Terminal-DTrsKkeR.js +++ /dev/null @@ -1 +0,0 @@ -var e=Object.defineProperty,t=(t,r,n)=>((t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n)(t,"symbol"!=typeof r?r+"":r,n);import{j as r,r as n,c as s}from"./vendor-react-j_fHog8x.js";import{D as a,o,L as i}from"./xterm-Cq-DlOOL.js";import{bu as c,bv as l,bw as u,bx as d,by as p,bz as m,bA as h,bB as f,b3 as g,a7 as y,bC as $,$ as w,_ as b,aA as v,bD as x,bE as _,bF as k,K as S,bG as C,N as j,n as N,bH as T,bI as R,bJ as E}from"./index-CImKXCRQ.js";import{s as A}from"./signal-scoring-CcBiRcks.js";import{h as I,c as L,D as F}from"./geo-utils-qEuqoaud.js";import{a as M}from"./ping-C1JzD5-V.js";import{c as O}from"./vendor-core-CDNU4oKM.js";import{P as B,d as D}from"./payload-decoders-BbTIgSA8.js";import{g as H,r as z}from"./system-nunPUnlB.js";import{g as U,K as P,F as q,S as W}from"./KeycapButton-DjJYg-26.js";import{P as K,b as X,B as G,a as V}from"./PageLayout-CBx7rIBL.js";import"./maplibre-gl-b91ci4Kr.js";class J{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 Y{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 n of r)if(t.startsWith(n))return e.trim().slice(n.length).trim();return e.trim()}}const Q="[",Z=`${Q}0m`,ee=`${Q}1m`,te=`${Q}2m`,re=`${Q}3m`,ne=`${Q}32m`,se=`${Q}31m`,ae=`${Q}33m`,oe=`${Q}36m`,ie=`${Q}34m`,ce=`${Q}90m`,le=`${Q}92m`,ue=`${Q}96m`;function de(e,t){switch(t){case"success":return`${ne}${e}${Z}`;case"error":return`${se}${e}${Z}`;case"warning":return`${ae}${e}${Z}`;case"info":return`${oe}${e}${Z}`;case"value":return`${ie}${e}${Z}`;case"system":return`${ce}${e}${Z}`;default:return e}}function pe(e){return`${ee}${e}${Z}`}function me(e){return`${te}${e}${Z}`}function he(e){return`${ne}${e}${Z}`}function fe(e){return`${ie}${e}${Z}`}function ge(e){return`${ce}${e}${Z}`}function ye(e,t){return`${ce}${e}: ${Z}${ie}${ee}${t}${Z}`}function $e(e,t,r=22){const n=e.split(" "),s=n[0];let a=oe;return"get"===s?a=ne:"set"===s&&(a=ae),` ${n.length>1?`${a}${ee}${s}${Z} ${ie}${n.slice(1).join(" ")}${Z}`:`${a}${ee}${e}${Z}`}${" ".repeat(Math.max(1,r-e.length))}${ce}${t}${Z}`}function we(e){return`${ee}${ie}${e}${Z}`}function be(e){return`${ce}${re}${e}${Z}`}const ve=`${ce}$ ${Z}`;function xe(e){return`${se}${ee}●${Z} ${ce}${e}${Z}`}function _e(e){const t=e<1e3?`${e.toFixed(0)}ms`:`${(e/1e3).toFixed(1)}s`;return`${function(e){return e<1500?le:e<4e3?ne:e<8e3?ae:e<15e3?se:`${se}${ee}`}(e)}${t}${Z}`}function ke(e,t){return`${function(e){switch(e){case"excellent":return ue;case"good":return ne;case"fair":return ae;case"poor":return se;case"critical":return`${se}${ee}`;default:return ce}}(t)}${e}${Z}`}const Se=[se,se,ae,ne,ue];function Ce(e,t){return`${Se[t]??ce}${e}${Z}`}function je(e){return e.replace(/[\p{Emoji_Presentation}\p{Extended_Pictographic}\uFE0F\u200D]/gu,"").trim()}const Ne="\r";function Te(e=1){return`[${e}A`}function Re(e,t){const r=function(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}(e);return r||t}function Ee(){const e=Re("--terminal-bg","#0d0d0d"),t=Re("--text-primary","#e0e0e0"),r=Re("--accent-primary","#3b82f6"),n=Re("--accent-primary","#3b82f6")+"40",s=Re("--accent-danger","#ef4444"),a=Re("--accent-success","#22c55e"),o=Re("--accent-secondary","#f59e0b"),i=Re("--accent-primary","#3b82f6"),c=Re("--accent-tertiary","#06b6d4"),l=Re("--text-muted","#666666"),u=Re("--text-secondary","#a0a0a0");return{background:e,foreground:t,cursor:r,cursorAccent:e,selectionBackground:n,selectionForeground:t,black:Re("--bg-surface","#1a1a1a"),red:s,green:a,yellow:o,blue:i,magenta:o,cyan:c,white:t,brightBlack:l,brightRed:s,brightGreen:a,brightYellow:o,brightBlue:i,brightMagenta:o,brightCyan:c,brightWhite:u}}const Ae="[",Ie=`${Ae}0m`,Le=`${Ae}1m`,Fe=`${Ae}2m`,Me=`${Ae}34m`,Oe=`${Ae}90m`,Be=" ",De=[{label:"INFORMATION",entries:[{cmd:"status",desc:"Repeater status summary",alias:"st"},{cmd:"uptime",desc:"System uptime"},{cmd:"board",desc:"Board / platform info"},{cmd:"packets",desc:"Packet statistics"}]},{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"}]}],He=[{cat:"Identity",params:["name","role","lat","lon","public.key"]},{cat:"Radio",params:["radio","freq","tx","bw","sf","cr"]},{cat:"Timing",params:["af","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 ze(e){return`${Oe}${"─".repeat(e)}${Ie}`}function Ue(e){const t=Math.max(3,e-12-8-6);return` ${Me}${Le}pymc console${Ie} ${ze(t)} ${Oe}terminal${Ie}`}function Pe(e){return` ${Oe}${e}${Ie}`}function qe(e,t){const r=[],n=e.alias?` ${Fe}${e.alias}${Ie}`:"";return 4+Math.max(e.cmd.length,24)+e.desc.length+(e.alias?2+e.alias.length:0)<=t?r.push(" "+$e(e.cmd,e.desc,24)+n):(r.push(" "+$e(e.cmd,"",24)),r.push(Be+ge(e.desc)+n)),e.sub&&r.push(`${Be}${me("└ "+e.sub)}`),r}function We(e){return e.split(" · ").map(e=>`${Me}${e}${Ie}`).join(`${Oe} · ${Ie}`)}function Ke(e,t){const r=[];let n=[],s=0;for(const a of e){const e=n.length>0?3+a.length:a.length;s+e>t&&n.length>0?(r.push(n),n=[a],s=a.length):(n.push(a),s+=e)}return n.length>0&&r.push(n),r}function Xe(e){const t=["",Pe("GET/SET QUALIFIERS")],r=Math.max(20,e-4-13);for(const n of He){const e=`${Oe}${n.cat.padEnd(13)}${Ie}`,s=Ke(n.params,r),a=" ".repeat(17);t.push(` ${e}${We(s[0].join(" · "))}`);for(let r=1;r help for detailed usage")}`]}(r)),e.write(s.join("\n"))}}class Ve extends Y{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([we("clear"),` ${ge("Clear all terminal output.")}`,"",$e("clear","clear the screen"),"",we("Aliases"),` ${ge("cls")}`].join("\n"))}}function Je(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),n=Math.floor(e%3600/60);return t>0?`${t}d ${r}h ${n}m`:r>0?`${r}h ${n}m`:`${n}m`}class Ye extends Y{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,n,s;if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([we("status"),` ${ge("Show a quick summary of mode, neighbor count, and uptime.")}`,"",$e("status","show summary"),"",we("Aliases"),` ${ge("st")}`].join("\n"));const a=e.write("processing...","system");try{const t=await l(),o=(null==(n=null==(r=t.config)?void 0:r.repeater)?void 0:n.mode)||"unknown",i=Object.keys(t.neighbors||{}).length,c=Object.values(t.neighbors||{}).filter(e=>e.zero_hop).length,u=(null==(s=t.config)?void 0:s.node_name)||t.node_name||"unknown",d=Je(t.uptime_seconds||0);e.update(a,[`${pe(u)} ${ge("repeater")}`,"",` ${ye("Mode",fe(o))}`,` ${ye("Neighbors",`${fe(String(c))} direct ${ge(`${i} total`)}`)}`,` ${ye("RX / TX",`${fe(String(t.rx_count??0))} / ${fe(String(t.tx_count??0))}`)}`,` ${ye("Uptime",fe(d))}`].join("\n"))}catch(o){e.update(a,`Error: ${o instanceof Error?o.message:"Command failed"}`,"error")}}}class Qe extends Y{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([we("uptime"),` ${ge("Display how long the repeater service has been running.")}`,"",$e("uptime","show uptime")].join("\n"));const r=e.write("processing...","system");try{const t=await l();e.update(r,ye("Uptime",fe(Je(t.uptime_seconds||0))))}catch(n){e.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}class Ze extends Y{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([we("packets"),` ${ge("Display packet counters (received, transmitted, forwarded, dropped).")}`,"",$e("packets","show packet stats")].join("\n"));const r=e.write("processing...","system");try{const t=await l(),n=(t.rx_count??0)+(t.tx_count??0);e.update(r,[we("Packet Stats")+` ${ge(`${n} total`)}`,"",` ${ye("Received",fe(String(t.rx_count??0)))}`,` ${ye("Transmitted",fe(String(t.tx_count??0)))}`,` ${ye("Forwarded",fe(String(t.forwarded_count??0)))}`,` ${ye("Dropped",fe(String(t.dropped_count??0)))}`].join("\n"))}catch(n){e.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}function et(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GB`:e>=1048576?`${(e/1048576).toFixed(0)} MB`:`${(e/1024).toFixed(0)} KB`}function tt(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),n=Math.floor(e%3600/60);return t>0?`${t}d ${r}h ${n}m`:r>0?`${r}h ${n}m`:`${n}m`}class rt extends Y{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([we("board"),` ${ge("Display platform and hardware information.")}`,"",$e("board","show board info")].join("\n"));const n=e.write("loading...","system");try{const[t,s]=await Promise.all([u(),l()]),a=[];if(a.push(` ${ye("Node",fe(s.node_name||"Unknown"))}`),a.push(` ${ye("Runtime",fe(`pyMC_Repeater v${s.version||"?"}`))}`),s.core_version&&a.push(` ${ye("Core",fe(s.core_version))}`),a.push(""),t.success&&t.data){const e=t.data;a.push(` ${ye("CPU",fe(`${e.cpu.usage_percent.toFixed(1)}%`))} ${ge(`${e.cpu.count} core${e.cpu.count>1?"s":""}`)}`),e.cpu.load_avg&&a.push(` ${ye("Load",fe(`${e.cpu.load_avg["1min"].toFixed(2)} / ${e.cpu.load_avg["5min"].toFixed(2)} / ${e.cpu.load_avg["15min"].toFixed(2)}`))}`);const n=Object.entries(e.temperatures||{});if(n.length>0){const e=n[0];a.push(` ${ye("Temp",fe(`${e[1].toFixed(1)}°C`))}${n.length>1?` ${ge(n.slice(1).map(([e,t])=>`${e}: ${t.toFixed(1)}°C`).join(", "))}`:""}`)}a.push(""),a.push(` ${ye("Memory",fe(`${et(e.memory.used)} / ${et(e.memory.total)}`))} ${ge(`${e.memory.usage_percent.toFixed(0)}%`)}`),a.push(` ${ye("Disk",fe(`${et(e.disk.used)} / ${et(e.disk.total)}`))} ${ge(`${e.disk.usage_percent.toFixed(0)}%`)}`),a.push(""),(null==(r=e.system)?void 0:r.uptime)&&a.push(` ${ye("System uptime",fe(tt(e.system.uptime)))}`),a.push(` ${ye("Service uptime",fe(tt(s.uptime_seconds)))}`),e.network&&a.push(` ${ye("Net TX/RX",fe(`${et(e.network.bytes_sent)} / ${et(e.network.bytes_recv)}`))}`)}else a.push(` ${ye("Platform",fe("Linux"))}`),a.push(` ${ye("Service uptime",fe(tt(s.uptime_seconds)))}`),a.push(` ${ge("Hardware stats unavailable")}`);e.update(n,a.join("\n"),"value")}catch(s){e.update(n,`Error: ${s instanceof Error?s.message:"Failed to load hardware stats"}`,"error")}}}class nt extends Y{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([we("advert"),` ${ge("Broadcast a repeater advertisement to the mesh network.")}`,"",$e("advert","send advert now"),"",be("Adverts announce this repeater's presence to neighbors.")].join("\n"));const r=e.write("processing...","system");try{const t=await d();t.success?e.update(r,`✓ ${fe("Advert sent")}`,"success"):e.update(r,`Error: ${t.error||"Failed"}`,"error")}catch(n){e.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}const st=["sig","name","rssi","snr","dist","heard"],at={excellent:5,good:4,fair:3,poor:2,critical:1};function ot(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 it(e){return e<1e3?`${Math.round(e)}m`:`${(e/1e3).toFixed(1)}km`}const ct=["▁","▃","▅","▇","█"],lt={excellent:5,good:4,fair:3,poor:2,critical:1};function ut(e){const t=lt[e]??0;return ct.slice(0,t).map((e,t)=>Ce(e,t)).join("")+ge(".".repeat(5-t))}function dt(e,t=e=>e){return{text:e,color:t}}function pt(e){return ge("+"+e.map(e=>"-".repeat(e+2)).join("+")+"+")}function mt(e,t){const r=e.map((e,r)=>{if(null!=e.rendered){const n=Math.max(0,t[r]-e.text.length);return" "+e.rendered+" ".repeat(n)+" "}return" "+e.color((n=e.text,s=t[r],n.length>=s?n.slice(0,s):n+" ".repeat(s-n.length)))+" ";var n,s});return ge("|")+r.join(ge("|"))+ge("|")}class ht extends Y{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,n=this.argsAfterName(e.rawInput).toLowerCase().trim();if("help"===n)return void this.printUsage(t);const s=st.includes(n)?n:null,a=t.write("processing...","system");try{const e=await l(),n=e.neighbors||{},o=Object.entries(n).filter(([,e])=>e.zero_hop);if(0===o.length){const e=Object.keys(n).length;return void t.update(a,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&&I(r.latitude,r.longitude)?{lat:r.latitude,lon:r.longitude}:null}(e),u=e.noise_floor_dbm;this.sortNeighbors(o,s,i,c,u);const d=s?` ${me(`sorted by ${s}`)}`:"",p=[we(`Direct Neighbors (${o.length})`)+d,""];if(r<55)for(const[t,r]of o)p.push(...this.cardLayout(t,r,i,c,u));else{const e=r>=70&&null!=c,t=o.map(([t,r])=>this.buildRow(t,r,i,c,u,e)),n=e?["SIG","NAME","RSSI","SNR","DIST","HEARD"]:["SIG","NAME","RSSI","SNR","HEARD"],s=n.slice(1).map((e,r)=>Math.max(e.length,...t.map(e=>e[r+1].text.length))),a=5,l=s.reduce((e,t)=>e+t+3,0),d=Math.max(4,r-l-a-7),m=[a,Math.min(d,Math.max(4,...t.map(e=>e[1].text.length))),...s.slice(1)];p.push(pt(m),...t.map(e=>mt(e,m)),pt(m),mt(n.map(e=>dt(e,pe)),m),pt(m)),p.push(this.footer(i,u))}t.update(a,p.join("\n"))}catch(o){t.update(a,`Error: ${o instanceof Error?o.message:"Command failed"}`,"error")}}sortNeighbors(e,t,r,n,s){switch(t){case"sig":e.sort(([,e],[,t])=>(at[this.gradeNeighbor(e,r,s)]??0)-(at[this.gradeNeighbor(t,r,s)]??0));break;case"name":e.sort(([e,t],[r,n])=>{const s=(t.name||t.node_name||e.slice(0,8)).toLowerCase(),a=(n.name||n.node_name||r.slice(0,8)).toLowerCase();return s.localeCompare(a)});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,n)??1/0)-(this.distTo(t,n)??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 n=null!=e.rssi?e.rssi-3.5:null,s=null!=r&&r>-100?1:0,a=A(e.snr??null,n,t,s);return(null==a?void 0:a.finalGrade)??"critical"}distTo(e,t){return t&&I(e.latitude,e.longitude)?L(t.lat,t.lon,e.latitude,e.longitude):null}buildRow(e,t,r,n,s,a){const o=this.gradeNeighbor(t,r,s),i=je(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`:"-",u=t.last_seen?ot(t.last_seen):"-",d=[(p=ut(o),{text:"|||||",color:e=>e,rendered:p}),dt(i,pe),dt(c,fe),dt(l,fe)];var p;if(a){const e=this.distTo(t,n);d.push(dt(null!=e?it(e):"-",me))}return d.push(dt(u,me)),d}cardLayout(e,t,r,n,s){const a=this.gradeNeighbor(t,r,s),o=je(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?ot(t.last_seen):"-",u=this.distTo(t,n),d=null!=u?` ${ge("dist")} ${fe(it(u))}`:"";return[`${ut(a)} ${pe(o)}`,` ${ge("rssi")} ${fe(i)} ${ge("snr")} ${fe(c)}${d} ${me(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`),ge(r.join(" "))}printUsage(e){const t=[we("neighbors"),` ${ge("Show direct RF neighbors with signal quality, RSSI, SNR, and distance.")}`,"",we("Usage"),$e("neighbors","default sort (most recent)"),$e("neighbors sig","sort by signal grade (weakest first)"),$e("neighbors name","sort alphabetically"),$e("neighbors rssi","sort by RSSI (weakest first)"),$e("neighbors snr","sort by SNR (lowest first)"),$e("neighbors dist","sort by distance (closest first)"),$e("neighbors heard","sort by last seen (oldest first)"),$e("neighbors help","show this help"),"",we("Aliases"),` ${ge("nb, get neighbors, get neighbor")}`,"",be("Signal bars factor radio config, noise floor, and 3.5 dBi antenna gain."),be("Only zero-hop (direct RF) neighbors are shown.")];e.write(t.join("\n"))}}class ft extends Y{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([we("get"),` ${ge("Read a repeater configuration parameter.")}`,"",we("Identity"),$e("get name","node name"),$e("get role","node role"),$e("get public.key","public key"),"",we("Location"),$e("get lat","latitude"),$e("get lon","longitude"),"",we("Radio"),$e("get radio","full radio summary"),$e("get freq","frequency (MHz)"),$e("get tx","TX power (dBm)"),$e("get bw","bandwidth (kHz)"),$e("get sf","spreading factor"),$e("get cr","coding rate"),"",we("Timing"),$e("get txdelay","TX delay factor"),$e("get direct.txdelay","direct TX delay"),$e("get rxdelay","RX delay base"),"",we("Repeater"),$e("get mode","forward or monitor"),$e("get flood.max","max flood hops"),$e("get advert.interval","advert interval"),$e("get duty","duty cycle state"),"",we("Advanced"),$e("get multi.acks","multi-ack count"),$e("get int.thresh","interference threshold (dBm)"),$e("get agc.reset.interval","AGC reset interval")].join("\n"));const n=e.write("processing...","system");try{const t=await l(),{result:s,type:a}=function(e,t){const r=t.config||{},n=r.radio||{},s=r.repeater||{},a=r.delays||{},o=r.duty_cycle||{},i=(e,t)=>({result:ye(e,fe(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",n.frequency?`${(n.frequency/1e6).toFixed(3)} MHz`:"?");case"tx":return i("tx",null!=n.tx_power?`${n.tx_power} dBm`:"?");case"bw":return i("bw",n.bandwidth?n.bandwidth/1e3+" kHz":"?");case"sf":return i("sf",String(n.spreading_factor??"?"));case"cr":return i("cr",n.coding_rate?`4/${n.coding_rate}`:"?");case"radio":return n.frequency?{result:[` ${ye("freq",fe(`${(n.frequency/1e6).toFixed(3)} MHz`))}`,` ${ye("bw",fe(n.bandwidth/1e3+" kHz"))}`,` ${ye("sf",fe(String(n.spreading_factor)))}`,` ${ye("cr",fe(`4/${n.coding_rate}`))}`,` ${ye("tx",fe(`${n.tx_power} dBm`))}`].join("\n"),type:"value"}:i("radio","?");case"af":case"txdelay":return i("txdelay",String(a.tx_delay_factor??"1.0"));case"direct.txdelay":return i("direct.txdelay",String(a.direct_tx_delay_factor??"0.5"));case"rxdelay":return i("rxdelay",String(a.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:`${ge("Private key stored in /etc/pymc_repeater/config.yaml")}\n\n ${ye("view",fe("sudo grep identity_key /etc/pymc_repeater/config.yaml"))}\n ${ye("set",fe("sudo ./convert_firmware_key.sh <64-byte-hex>"))}`,type:"info"};case"guest.password":case"allow.read.only":return{result:`${ge("Security settings not exposed via stats API.")}\n${ge("Check /etc/pymc_repeater/config.yaml")}`,type:"warning"};default:return{result:`Unknown parameter: ${fe(e)}\n${ge('Run "get help" to see available parameters.')}`,type:"error"}}}(r,t);e.update(n,s,a)}catch(s){e.update(n,`Error: ${s instanceof Error?s.message:"Command failed"}`,"error")}}}class gt extends Y{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 n=this.argsAfterName(t).split(/\s+/),s=null==(r=n[0])?void 0:r.toLowerCase(),a=n.slice(1).join(" ");if("help"===s||!s)return void e.write([we("set"),` ${ge("Write a repeater configuration parameter.")}`,"",we("Identity"),$e("set name ","node name"),$e("set lat ","latitude (-90 to 90)"),$e("set lon ","longitude (-180 to 180)"),"",we("Radio"),$e("set freq ","frequency"),$e("set tx ","TX power (2-22)"),$e("set bw ","bandwidth"),$e("set sf <5-12>","spreading factor"),$e("set cr <5-8>","coding rate"),"",we("Timing"),$e("set txdelay <0-5>","TX delay factor"),$e("set direct.txdelay <0-5>","direct TX delay"),$e("set rxdelay ","RX delay base"),"",we("Repeater"),$e("set mode ","forward or monitor"),$e("set flood.max <0-64>","max flood hops"),$e("set advert.interval ","advert interval (min)"),$e("set duty ","duty cycle enforcement"),$e("set log ","log level"),"",we("Advanced"),$e("set multi.acks ","multi-ack count"),$e("set int.thresh ","interference threshold"),$e("set agc.reset.interval ","AGC reset interval (x4)"),"",be("Some changes require a service restart.")].join("\n"));const o=e.write("processing...","system");try{const{result:r,type:n}=await async function(e,t,r){switch(e){case"mode":return async function(e){const t=e.toLowerCase();return"forward"!==t&&"monitor"!==t?_t('Mode must be "forward" or "monitor"'):(await f(t)).success?xt(`OK - Mode set to ${t}`):_t("Failed")}(t);case"duty":return async function(e){const t="on"===e.toLowerCase()||"1"===e;return(await h(t)).success?xt("OK - Duty cycle "+(t?"enabled":"disabled")):_t("Failed")}(t);case"tx":return yt("tx_power",wt(t,2,22,"TX power must be 2-22 dBm"));case"sf":return yt("spreading_factor",wt(t,5,12,"SF must be 5-12"));case"af":case"txdelay":return yt("tx_delay_factor",bt(t,0,5,"TX delay must be 0.0-5.0"));case"direct.txdelay":return yt("direct_tx_delay_factor",bt(t,0,5,"Direct TX delay must be 0.0-5.0"));case"rxdelay":return yt("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 yt("max_flood_hops",wt(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 _t("Level must be debug, info, warning, or error");const r=await m(t);return r.success?xt(`OK - Log level set to ${t}`):_t(r.error||"Failed")}(t);case"multi.acks":return yt("multi_acks",wt(t,0,255,"Multi-acks must be 0-255"));case"int.thresh":return yt("interference_threshold",wt(t,-200,0,"Interference threshold must be -200 to 0 dBm"));case"agc.reset.interval":{const e=vt(t);if(!e.ok)return _t(e.error);if(e.value<0)return _t("AGC reset interval must be >= 0");const r=4*Math.floor(e.value/4);return $t("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?yt("node_name",{ok:!0,value:e}):_t("Node name cannot be empty")}case"lat":return yt("latitude",bt(t,-90,90,"Latitude must be -90 to 90"));case"lon":return yt("longitude",bt(t,-180,180,"Longitude must be -180 to 180"));case"freq":{const e=bt(t,100,1e3,"Frequency must be 100-1000 MHz");return e.ok?yt("frequency",{ok:!0,value:1e6*e.value}):_t(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)?_t(`BW must be one of: ${e.join(", ")} kHz`):yt("bandwidth",{ok:!0,value:1e3*r})}case"cr":return yt("coding_rate",wt(t,5,8,"Coding rate must be 5-8"));case"advert.interval":{const e=vt(t);return e.ok?0!==e.value&&(e.value<1||e.value>10080)?_t("Advert interval must be 0 (off) or 1-10080 minutes"):$t("advert_interval_minutes",e.value,0===e.value?"OK - Local adverts disabled":`OK - Local advert interval set to ${e.value}m`):_t(e.error)}case"flood.advert.interval":{const e=vt(t);return e.ok?0!==e.value&&(e.value<3||e.value>48)?_t("Flood advert interval must be 0 (off) or 3-48 hours"):$t("flood_advert_interval_hours",e.value,0===e.value?"OK - Flood adverts disabled":`OK - Flood advert interval set to ${e.value}h`):_t(e.error)}case"prv.key":{const e=t.trim();return e?/^[0-9a-fA-F]+$/.test(e)?128!==e.length?_t(`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"}:_t("Private key must be a hex string"):_t("Private key cannot be empty")}default:return _t(`Unknown parameter: ${e}`)}}(s,a,t);e.update(o,r,n)}catch(i){e.update(o,`Error: ${i instanceof Error?i.message:"Command failed"}`,"error")}}}async function yt(e,t){if(!t.ok)return _t(t.error);const r=await p({[e]:t.value});if(!r.success)return _t(r.error||"Failed");let n=`OK - ${e} set to ${t.value}`;return r.restart_required&&(n+="\n⚠ Service restart required for changes to take effect\nRun: sudo systemctl restart pymc_repeater"),xt(n)}async function $t(e,t,r){const n=await p({[e]:t});if(!n.success)return _t(n.error||"Failed");let s=r;return n.restart_required&&(s+="\n⚠ Service restart required for changes to take effect\nRun: sudo systemctl restart pymc_repeater"),xt(s)}function wt(e,t,r,n){const s=parseInt(e);return isNaN(s)||sr?{ok:!1,error:`Error: ${n}`}:{ok:!0,value:s}}function bt(e,t,r,n){const s=parseFloat(e);return isNaN(s)||sr?{ok:!1,error:`Error: ${n}`}:{ok:!0,value:s}}function vt(e){const t=parseInt(e);return isNaN(t)?{ok:!1,error:"Error: Expected a number"}:{ok:!0,value:t}}function xt(e){return{result:e,type:"success"}}function _t(e){return{result:`Error: ${e}`,type:"error"}}const kt=["▁","▃","▅","▇","█"],St={excellent:5,good:4,fair:3,poor:2,critical:1};class Ct extends Y{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,n,s,a;const o=this.argsAfterName(t).trim(),i=o.split(/\s+/);if("help"===(null==(r=i[0])?void 0:r.toLowerCase()))return void e.write([we("ping"),` ${ge("Send a ping to a neighbor and measure round-trip time, signal quality, and path.")}`,"",$e("ping ","ping by node name"),$e("ping 0xAB","ping by hex prefix"),$e("ping 60","ping with custom timeout (seconds)"),"",be("Default timeout: 30s. Signal bars factor radio config and noise floor.")].join("\n"));const c=i[i.length-1],u=parseInt(c),d=i.length>1&&!isNaN(u)&&u>0,p=d?i.slice(0,-1).join(" "):o,m=d?u:30;if(!p)return void e.write([we("ping"),` ${ge("Send a ping to a neighbor and measure round-trip time.")}`,"",$e("ping ","ping by node name"),$e("ping 60","with custom timeout"),"",be('Run "ping help" for full usage.')].join("\n"));const h=e.write(`Pinging ${p}.`,"system");let f=1;const g=setInterval(()=>{f=f%3+1,e.update(h,`Pinging ${p}${".".repeat(f)}`,"system")},800);try{const[t,r]=await Promise.all([M(p,m),l()]);if(clearInterval(g),t.success&&t.data){const o=t.data,i=null==(n=r.config)?void 0:n.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,u=null!=l&&l>-100?1:0,d=o.rssi-3.5,p=A(o.snr_db,d,c,u),m=(null==p?void 0:p.finalGrade)??"critical",f=function(e){const t=St[e]??0;return kt.slice(0,t).map((e,t)=>Ce(e,t)).join("")+ge(".".repeat(5-t))}(m),g=(null==(s=o.path)?void 0:s.length)?o.path.length:0,y=(null==(a=o.path)?void 0:a.length)?o.path.join(" > "):"direct",$=m.charAt(0).toUpperCase()+m.slice(1),w=[`${f} ${pe("Reply from")} ${fe(o.target_id)}`,"",` ${ye("RTT",_e(o.rtt_ms))}`,` ${ye("RSSI",`${o.rssi} dBm`)}`,` ${ye("SNR",`${o.snr_db} dB`)}`,` ${ye("Path",y)}${g>0?ge(` (${g} hop${1!==g?"s":""})`):""}`,` ${ye("Quality",ke($,m))}`],b=[];c&&b.push(`SF${c.sf}/${c.bwHz>=1e3?c.bwHz/1e3+"kHz":c.bwHz+"Hz"}`),b.push("ant 3.5dBi"),null!=l&&b.push(`nf ${l}dBm`),w.push("",ge(b.join(" "))),e.update(h,w.join("\n"))}else e.update(h,t.error||"Ping failed","error")}catch(y){clearInterval(g),e.update(h,`Error: ${y instanceof Error?y.message:"Ping failed"}`,"error")}}}class jt extends Y{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 n=null==(r=t[1])?void 0:r.toLowerCase(),s=t.slice(2).join(" ").trim();"help"!==n&&(n||s)?"hex"===n?this.hexToBase64(e,s):"base64"===n?this.base64ToHex(e,s):e.write([we("convert"),` ${ge("Convert between hex and base64 encodings.")}`,"",$e("convert hex ","hex → base64"),$e("convert base64 ","base64 → hex")].join("\n")):e.write([we("convert"),` ${ge("Convert between hex and base64 encodings.")}`,"",$e("convert hex ","hex → base64"),$e("convert base64 ","base64 → hex"),"",be("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 n="";for(let e=0;e","error")}}function Nt(){const e=new Date;return`${e.toISOString().slice(0,10)}_${e.toTimeString().slice(0,8).replace(/:/g,"-")}`}function Tt(e,t){return`pymc-${e.toISOString().slice(0,10)}-${e.toTimeString().slice(0,5).replace(":","")}-${t}s.json`}const Rt=O((e,t)=>({isCapturing:!1,captureStartTime:null,captureStartPacketHashes:new Set,captureTimer:null,reports:[],startCapture:r=>{const{captureTimer:n}=t();n&&clearTimeout(n),e({isCapturing:!0,captureStartTime:new Date,captureStartPacketHashes:new Set(r.map(e=>e.packet_hash))})},stopCapture:r=>{const{isCapturing:n,captureStartTime:s,captureStartPacketHashes:a,captureTimer:o}=t();if(!n||!s)return null;o&&clearTimeout(o);const i=new Date,c=Math.round((i.getTime()-s.getTime())/1e3),l=s.getTime()/1e3,u=r.filter(e=>!a.has(e.packet_hash)&&e.timestamp>=l).sort((e,t)=>e.timestamp-t.timestamp),d={id:Nt(),filename:Tt(s,c),startTime:s,endTime:i,durationSec:c,packetCount:u.length,packets:u,sizeBytes:500*u.length};return e(e=>({isCapturing:!1,captureStartTime:null,captureStartPacketHashes:new Set,captureTimer:null,reports:[d,...e.reports].slice(0,10)})),d},getReport:e=>t().reports.find(t=>t.id===e),_setTimer:t=>e({captureTimer:t})})),Et=()=>Rt(e=>e.reports);function At(e){var t;return(null==(t=e.match(/.{1,2}/g))?void 0:t.join(" ").toUpperCase())||""}function It(e){return void 0===e?"UNKNOWN":b[e]??`TYPE_${e}`}function Lt(e){return void 0===e?"UNKNOWN":w[e]??`ROUTE_${e}`}function Ft(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:At($(e.slice(r,r+32))),decoded:{value:$(e.slice(r,r+32))}}),r+=32),e.length>=r+4){const n=e.slice(r,r+4),s=n[0]|n[1]<<8|n[2]<<16|n[3]<<24;t.push({name:"timestamp",offset:r,length:4,bytes:At($(n)),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:At($(e.slice(r,r+64))),decoded:{value:$(e.slice(r,r+64))}}),r+=64),e.length>r){const n=e[r],s=[];if(1&n&&s.push("CHAT_NODE"),2&n&&s.push("REPEATER"),3&n&&s.push("ROOM_SERVER"),16&n&&s.push("HAS_LOCATION"),128&n&&s.push("HAS_NAME"),t.push({name:"flags",offset:r,length:1,bytes:At($(e.slice(r,r+1))),decoded:{value:n,binary:n.toString(2).padStart(8,"0"),flags:s}}),r+=1,16&n&&e.length>=r+8){const n=e.slice(r,r+8),s=new ArrayBuffer(8);new Uint8Array(s).set(n);const a=new DataView(s),o=a.getInt32(0,!0),i=a.getInt32(4,!0);t.push({name:"location",offset:r,length:8,bytes:At($(n)),decoded:{lat_raw:o,lon_raw:i,latitude:o/1e6,longitude:i/1e6}}),r+=8}if(128&n&&e.length>r){const n=e.slice(r);let s=n.indexOf(0);-1===s&&(s=n.length);const a=(new TextDecoder).decode(n.slice(0,s));t.push({name:"name",offset:r,length:s+(0===n[s]?1:0),bytes:At($(n.slice(0,s+1))),decoded:{value:a,encoding:"utf-8",null_terminated:0===n[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:At($(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),n=r[0]|r[1]<<8|r[2]<<16|r[3]<<24;t.push({name:"trace_tag",offset:0,length:4,bytes:At($(r)),decoded:{value:n>>>0,hex:(n>>>0).toString(16).toUpperCase().padStart(8,"0")}});const s=e.slice(4,8),a=s[0]|s[1]<<8|s[2]<<16|s[3]<<24;if(t.push({name:"auth_code",offset:4,length:4,bytes:At($(s)),decoded:{value:a>>>0}}),t.push({name:"flags",offset:8,length:1,bytes:At($(e.slice(8,9))),decoded:{value:e[8],binary:e[8].toString(2).padStart(8,"0")}}),e.length>9){const r=e.slice(9),n=Array.from(r).map(e=>e.toString(16).toUpperCase().padStart(2,"0"));t.push({name:"target_path",offset:9,length:r.length,bytes:At($(r)),decoded:{hops:n,path_string:n.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:At($(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:At($(e.slice(0,1))),decoded:{value:e[0].toString(16).toUpperCase().padStart(2,"0")}}),e.length>13){const r=12,n=e.length-1-r;t.push({name:"ciphertext",offset:1,length:n,bytes:At($(e.slice(1,1+n))),decoded:{length:n,note:"Encrypted message content"}}),t.push({name:"mac",offset:1+n,length:r,bytes:At($(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:At($(e)),decoded:{length:e.length}}]}(t)}}function Mt(e){const t=e.type??e.payload_type??0,r=e.route??e.route_type??0,n=e.raw_packet||"";let s,a=null;if(n){const t=B.fromHex(n);if(t.success&&t.packet){const e=t.packet;try{a=D(e)}catch{a=null}const r=y(n);let o=0;const i={offset:0,length:1,bytes:At(n.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:At($(r.slice(o,o+1))),decoded:{value:e.pathLen}};o+=1;const l=o,u=r.slice(o,o+e.pathLen),d=Array.from(e.path).map(e=>e.toString(16).toUpperCase().padStart(2,"0")),p=9===e.payloadType,m={offset:l,length:e.pathLen,bytes:At($(u)),decoded:{hops:d,path_string:d.length>0?d.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:At(e.payloadHex),sections:Ft(e.payloadType,e.payload)}}}else s=Ot(e)}else s=Ot(e);return{timestamp:e.timestamp,packet_hash:e.packet_hash,type:t,type_name:It(t),route:r,route_name:Lt(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:n,structure:s,decoded:a}}function Ot(e){var t;const r=e.type??e.payload_type??0,n=e.route??e.route_type??0,s=e.original_path??e.forwarded_path??[];return{header:{offset:0,length:1,bytes:"??",decoded:{route_type:n,route_name:Lt(n),payload_type:r,payload_name:It(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?Ft(r,y(e.payload)):[]}}}function Bt(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:g,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(Mt)}}(e,t),n=JSON.stringify(r,null,2),s=new Blob([n],{type:"application/json"}),a=URL.createObjectURL(s),o=document.createElement("a");o.href=a,o.download=e.filename,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)}function Dt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}class Ht extends Y{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=Rt.getState(),r=t.isCapturing?`\n${xe('Recording in progress... use "end cap" to stop')}`:"",n=t.reports.length,s=n>0?` (${n} saved)`:"",a=[we("Packet Capture"),"",$e("start cap","Start capture (default: 120s)"),$e("end cap","Stop capture early"),$e("list cap",`List saved captures${s}`),$e("export cap","Download capture by ID"),"",be("Captures stored in session memory. JSON includes decoded payloads."),r].filter(Boolean);e.write(a.join("\n"))}startCapture(e,t){const r=t.slice(9).trim(),n=r?parseInt(r):120;if(isNaN(n)||n<1||n>3600)return void e.write("Error: Duration must be 1-3600 seconds","error");const s=Rt.getState();if(s.isCapturing)return void e.write('Error: Capture already in progress. Use "end cap" first.',"error");const a=v.getState().packets;s.startCapture(a);let o=n;const i=e.write(xe(`Capturing... ${o}s remaining`),"system"),c=setInterval(()=>{o--;const t=Rt.getState();if(o>=0&&t.isCapturing){const r=v.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,n=o>0?`${o}s remaining`:"finishing...";e.update(i,xe(`Capturing... ${n} (${r} captured)`),"system")}},1e3),l=setTimeout(()=>{clearInterval(c);const t=Rt.getState();if(t.isCapturing){const r=v.getState().packets,n=t.stopCapture(r);n?e.write(`✓ Capture complete!\n Captured: ${n.packetCount} packets\n Duration: ${n.durationSec}s\n Size: ~${Dt(n.sizeBytes)}\n\nRun \`export cap ${n.id}\` to download.`,"success"):e.write("Capture completed with no packets.","warning")}},1e3*n);s._setTimer(l)}endCapture(e){const t=Rt.getState();if(!t.isCapturing)return void e.write("No capture in progress.","warning");const r=v.getState().packets,n=t.stopCapture(r);n?e.write(`✓ Capture stopped!\n Captured: ${n.packetCount} packets\n Duration: ${n.durationSec}s\n Size: ~${Dt(n.sizeBytes)}\n\nRun \`export cap ${n.id}\` to download.`,"success"):e.write("Capture stopped with no packets.","warning")}listCaptures(e){const{reports:t}=Rt.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 • ~${Dt(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(),n=Rt.getState(),s=v.getState().stats;if(!r){if(0===n.reports.length)e.write("No capture reports available.\nStart a capture with: start cap [seconds]","info");else{const t=n.reports.map((e,t)=>` ${t+1}. ${e.id}`);e.write(`Usage: export cap \n\nAvailable reports:\n${t.join("\n")}`,"info")}return}let a=n.getReport(r);if(!a){const e=parseInt(r)-1;a=n.reports[e]}a?(Bt(a,s),e.write(`✓ Downloading ${a.filename}...`,"success")):e.write(`Error: Report "${r}" not found.\nUse "list cap" to see available reports.`,"error")}}class zt extends Y{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([we("identities"),` ${ge("List all configured repeater and room server identities.")}`,"",$e("identities","list identities"),"",we("Aliases"),` ${ge("id, ids")}`].join("\n"));const n=e.write("processing...","system");try{const t=await x();if(!t.success||!t.data)return void e.update(n,t.error||"Failed to fetch identities","error");const s=t.data,a=(null==(r=s.configured)?void 0:r.length)?s.configured:s.registered||[];if(0===a.length)return void e.update(n,"No identities configured.","warning");const o=[we(`Identities (${a.length})`),"",...a.map((e,t)=>{var r;const n=e.name||"Unnamed",s=e.type||"unknown",a=(null==(r=e.hash)?void 0:r.slice(0,8))||"—";return` ${ge(`${t+1}.`)} ${pe(n)} ${me(s)} ${fe(a)}`})];e.update(n,o.join("\n"))}catch(s){e.update(n,`Error: ${s instanceof Error?s.message:"Command failed"}`,"error")}}}class Ut extends Y{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([we("keys"),` ${ge("List configured transport encryption keys.")}`,"",$e("keys","list transport keys")].join("\n"));const r=e.write("processing...","system");try{const t=await H();if(!t.success||!t.data)return void e.update(r,t.error||"Failed to fetch transport keys","error");const n=t.data;if(0===n.length)return void e.update(r,"No transport keys configured.","warning");const s=[we(`Transport Keys (${n.length})`),"",...n.map(e=>{const t=e.parent_id?` ${me(`parent: ${e.parent_id}`)}`:"";return` ${pe(e.name)} ${ye("flood",fe(e.flood_policy))}${t}`})];e.update(r,s.join("\n"))}catch(n){e.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}class Pt extends Y{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([we("acl"),` ${ge("Display access control list statistics.")}`,"",$e("acl","show ACL stats")].join("\n"));const r=e.write("processing...","system");try{const t=await U();if(!t.success||!t.data)return void e.update(r,t.error||"Failed to fetch ACL stats","error");const n=t.data,s=[we("ACL Stats"),"",` ${ye("Identities",fe(String(n.total_identities)))}`,` ${ye("Total clients",fe(String(n.total_clients)))}`,` ${ye("Admin",fe(String(n.admin_clients)))}`,` ${ye("Guest",fe(String(n.guest_clients)))}`];if(n.by_identity_type){const e=n.by_identity_type.repeater,t=n.by_identity_type.room_server;e&&s.push(` ${ye("Repeater",`${fe(String(e.count))} ids ${ge(`${e.clients} clients`)}`)}`),t&&s.push(` ${ye("Room Server",`${fe(String(t.count))} ids ${ge(`${t.clients} clients`)}`)}`)}e.update(r,s.join("\n"))}catch(n){e.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}class qt extends Y{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([we("rooms"),` ${ge("Display room server statistics and sync status.")}`,"",$e("rooms","list rooms")].join("\n"));const r=e.write("processing...","system");try{const t=await _();if(!t.success||!t.data)return void e.update(r,t.error||"Failed to fetch room stats","error");const n=t.data.rooms||[];if(0===n.length)return void e.update(r,"No room servers configured.","warning");const s=[we(`Rooms (${n.length})`),"",...n.map(e=>[` ${pe(e.room_name)}`,` ${ye("msgs",fe(String(e.total_messages)))} ${ye("clients",`${fe(String(e.active_clients))}${me(`/${e.total_clients}`)}`)} ${ye("sync",e.sync_running?fe("running"):me("idle"))}`]).flat()];e.update(r,s.join("\n"))}catch(n){e.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}class Wt extends Y{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([we("restart"),` ${ge("Restart the pymc-repeater systemd service.")}`,"",$e("restart","restart the service"),"",we("Aliases"),` ${ge("reboot")}`,"",be("Requires polkit permissions for the web user."),be("The page will need a manual refresh after restart.")].join("\n"));const r=e.write("Restarting service...","system");try{const t=await z(AbortSignal.timeout(8e3));if(t.success)return e.update(r,"Service restart initiated.","success"),void this.waitForService(e);const n=t.status;if(403===n||401===n)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(n){const t=n instanceof Error?n.message:"";t.includes("ERR_NETWORK")||t.includes("ECONNRESET")||t.includes("Failed to fetch")||t.includes("abort")||t.includes("timeout")||n instanceof DOMException&&"TimeoutError"===n.name||n instanceof DOMException&&"AbortError"===n.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,n=!1;setTimeout(()=>{const s=setInterval(async()=>{if(!n){r++,e.update(t,`Waiting for service... ${r}s`,"system");try{await fetch(`${k}/api/stats`,{signal:AbortSignal.timeout(3e3)}),n=!0,clearInterval(s),e.update(t,`Service connected. (${r+4}s)`,"success")}catch{}!n&&r>=30&&(n=!0,clearInterval(s),e.update(t,"Service did not respond within 34s. Check manually.","warning"))}},1e3)},4e3)}}const Kt=O(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)}),n={...t,id:r,timestamp:Date.now()};return e(e=>({entries:[...e.entries,n]})),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 Xt({isOpen:e,onClose:t}){const n=Et(),s=v(e=>e.stats);return r.jsxs(S,{open:e,onClose:t,size:"lg",children:[r.jsx(C,{icon:r.jsx(F,{size:20}),title:"Download Captures",onClose:t}),r.jsx(j,{children:r.jsx("div",{className:"flex flex-col gap-3",children:0===n.length?r.jsx("p",{className:"text-text-secondary",children:"No captures available."}):n.map(e=>r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md bg-bg-surface-elevated",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:e.filename}),r.jsxs("p",{className:"text-sm text-text-secondary",children:[e.packetCount," packets • ",e.durationSec,"s • ~",Dt(e.sizeBytes)]})]}),r.jsx("button",{onClick:()=>(e=>{const t=n.find(t=>t.id===e);t&&Bt(t,s)})(e.id),className:"p-2 text-text-secondary hover:text-text-primary hover:bg-bg-subtle rounded-md transition-colors",title:"Download",children:r.jsx(F,{size:18})})]},e.id))})})]})}function Gt(){const e=Et(),t=e.length>0,[s,a]=n.useState(!1);return t?r.jsxs(r.Fragment,{children:[r.jsx(P,{icon:r.jsx(q,{size:20}),onClick:()=>a(!0),title:`Download captures (${e.length})`,iconActiveColor:"#E5484D",keycapSrc:"/assets/keycap-red.svg"}),r.jsx(Xt,{isOpen:s,onClose:()=>a(!1)})]}):null}const Vt=function(){const e=new J,t=new Ge(e);return e.register(t,new Ve,new Ye,new Qe,new Ze,new rt,new nt,new ht,new Ct,new ft,new gt,new jt,new Ht,new zt,new Ut,new Pt,new qt,new Wt),e}(),Jt=Vt.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}))]),Yt={"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 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"],"start cap":["30","60","120","300"]};function Qt(){return/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)||window.innerWidth<640}function Zt(){const e=N(),{addCommand:t}=Kt(),l=n.useRef(null),u=n.useRef(null),d=n.useRef(null),p=n.useRef(null),m=n.useRef(""),h=n.useRef(-1),f=n.useRef(""),g=n.useRef(!1),y=n.useRef(!1),$=n.useRef([]),w=n.useRef(()=>{}),b=T(),[v,x]=n.useState({show:!1,options:[],selectedIndex:0,input:""}),_=n.useRef([]),k=n.useRef(0);n.useEffect(()=>{(null==e?void 0:e.neighbors)&&($.current=Object.values(e.neighbors).map(e=>e.node_name||e.name).filter(e=>!!e).sort())},[null==e?void 0:e.neighbors]);const S=n.useCallback(()=>{var e;null==(e=u.current)||e.write(ve)},[]),C=n.useCallback(()=>{const e=u.current;e&&(e.write(Ne),S(),e.write(m.current))},[S]),j=n.useCallback(e=>{const t=function(e,t){const r=e.trim().toLowerCase();if(!r)return[];const n=Jt.filter(e=>e.cmd.toLowerCase().startsWith(r));if(n.length>0)return n;if(r.includes(" ")){const e=r.lastIndexOf(" "),n=r.substring(0,e),s=r.substring(e+1);if("ping"===n&&t.length>0)return t.filter(e=>e.toLowerCase().startsWith(s)).slice(0,10).map(e=>({cmd:`ping ${e}`,desc:`→ ${e}`}));const a=Jt.find(e=>e.cmd.toLowerCase()===n);if(a&&Yt[a.cmd])return Yt[a.cmd].filter(e=>e.toLowerCase().startsWith(s)).map(e=>({cmd:`${a.cmd} ${e}`,desc:`→ ${e}`}))}return[]}(e,$.current);_.current=t,k.current=0;const r=t.length>0&&e.trim().length>0;x({show:r,options:t,selectedIndex:0,input:e.trim()})},[]),A=n.useCallback(()=>{_.current=[],k.current=0,x({show:!1,options:[],selectedIndex:0,input:""})},[]),I=n.useCallback(e=>{var t;const r=_.current[e];r&&(m.current=r.required?r.cmd+" ":r.cmd,C(),r.required?j(m.current):A(),null==(t=u.current)||t.focus())},[C,j,A]),L=n.useCallback(async e=>{const r=u.current;if(!r)return;const n=e.trim();if(!n)return void S();g.current=!0,t(n),h.current=-1;let s=0;const a={write(e,t="default"){const n=("default"===t?e:de(e,t)).split("\n");for(const s of n)r.writeln(s);return s=n.length,String(s)},update(e,t,n){if(s>0)for(let o=0;o{const t=u.current;if(!t||g.current)return;const r=Kt.getState().commandHistory,n=e=>requestAnimationFrame(()=>{var t;return null==(t=document.querySelector(`[data-ac-index="${e}"]`))?void 0:t.scrollIntoView({block:"nearest"})});for(let s=0;s0){const e=_.current[k.current];e&&(m.current=e.cmd,C())}A();const e=m.current;m.current="",t.writeln(""),L(e);continue}if(127!==a&&8!==a)if(3!==a)if(12!==a)if(9!==a)if(27!==a)a>=32&&(m.current+=e[s],t.write(e[s]),h.current=-1,j(m.current));else{if(91===e.charCodeAt(s+1)){const t=e.charCodeAt(s+2);if(s+=2,65===t){if(_.current.length>0){const e=Math.max(k.current-1,0);k.current=e,x(t=>({...t,selectedIndex:e})),n(e)}else r.length>0&&(-1===h.current&&(f.current=m.current),h.current0){const e=Math.min(k.current+1,_.current.length-1);k.current=e,x(t=>({...t,selectedIndex:e})),n(e)}else h.current>0?(h.current--,m.current=r[r.length-1-h.current]||"",C()):0===h.current&&(h.current=-1,m.current=f.current,C());continue}if(67===t||68===t)continue;continue}_.current.length>0&&A()}else _.current.length>0&&I(k.current);else t.clear(),A(),C();else m.current="",A(),t.writeln("^C"),S();else m.current.length>0&&(m.current=m.current.slice(0,-1),t.write("\b \b"),j(m.current))}},[A,j,I,S,C,L]);n.useEffect(()=>{w.current=F},[F]);const M=n.useCallback(async()=>{const e=u.current;if(!e||y.current)return;y.current=!0;const t="██████ ██ ██ ███ ███ ██████\n██ ██ ██ ██ ████ ████ ██ \n██████ ████ ██ ████ ██ ██ \n██ ██ ██ ██ ██ ██ \n██ ██ ██ ██ ██████".split("\n");for(const r of t)e.writeln(fe(r));e.writeln(""),e.write(ge("● Initializing terminal...")),await new Promise(e=>setTimeout(e,300)),e.write(Ne),e.writeln(he("✓ Initializing terminal...")),e.write(ge("● Connecting to repeater...")),await new Promise(e=>setTimeout(e,500)),e.write(Ne),"connected"===R.getState().health?e.writeln(he("✓ Connected to repeater")):e.writeln(`${ae}~ Connection status unknown${Z}`),e.writeln(ge("Ready. Type 'help' for commands.")),e.writeln(""),S()},[S]);n.useEffect(()=>{const e=l.current;if(!e)return;const t=new a({theme:Ee(),fontFamily:'"JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',fontSize:13,lineHeight:1.4,cursorBlink:!1,cursorStyle:"underline",scrollback:1e4,convertEol:!0,allowTransparency:!0,rightClickSelectsWord:!1}),r=new o;t.loadAddon(r),t.loadAddon(new i),t.open(e),r.fit(),u.current=t,d.current=r;const n=t.onData(e=>w.current(e)),s=function(e){return c.subscribe(()=>{e.options.theme=Ee()})}(t),p=new ResizeObserver(()=>{requestAnimationFrame(()=>r.fit())});return p.observe(e),M(),Qt()||t.focus(),()=>{n.dispose(),s(),p.disconnect(),t.dispose(),u.current=null,d.current=null}},[]);const O=n.useCallback(e=>{const t=e.target.value;t.length>0&&(F(t),e.target.value="")},[F]),B=n.useCallback(e=>{"Enter"===e.key?(e.preventDefault(),F("\r")):"Backspace"===e.key?(e.preventDefault(),F("")):"ArrowUp"===e.key?(e.preventDefault(),F("")):"ArrowDown"===e.key&&(e.preventDefault(),F(""))},[F]),D=n.useCallback(()=>{var e,t;Qt()?null==(e=p.current)||e.focus():null==(t=u.current)||t.focus()},[]);return r.jsxs(K,{children:[r.jsx(X,{title:"Terminal",icon:r.jsx(E,{})}),r.jsx(G,{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(W,{text:"5hell",minChars:7,size:24})}),r.jsx("div",{className:"keycap-well self-stretch flex flex-col",children:r.jsxs("div",{className:"indicator-key"+("connected"===b?" indicator-key--active":"degraded"===b?" 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("div",{className:"keycap-well keycap-well--rounded flex items-center gap-1",children:r.jsx(Gt,{})})]}),r.jsx(V,{noPadding:!0,className:"flex flex-col flex-1 min-h-0 overflow-hidden card-terminal",onClick:D,children:r.jsxs("div",{className:"card-terminal-well flex-1 min-h-0 flex flex-col overflow-hidden",children:[r.jsx("div",{className:"flex-1 min-h-0 terminal-gutter",children:r.jsx("div",{ref:l,className:"h-full w-full"})}),v.show&&v.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:v.options.map((e,t)=>{const n=t===v.selectedIndex,a=v.input.length;return r.jsxs("div",{"data-ac-index":t,onClick:()=>I(t),className:s("flex items-baseline gap-2 px-3 py-0.5 cursor-pointer transition-colors",n?"text-accent-primary":"text-text-primary"),style:{background:n?"var(--terminal-autocomplete-hover)":void 0},onMouseEnter:e=>{n||(e.currentTarget.style.background="var(--terminal-autocomplete-hover)")},onMouseLeave:e=>{n||(e.currentTarget.style.background="")},children:[r.jsx("span",{className:"w-3 shrink-0 text-center text-accent-primary opacity-80",children:n?"▸":""}),r.jsxs("span",{className:"min-w-0 truncate flex-1",children:[r.jsx("span",{className:"font-semibold text-accent-primary",children:e.cmd.substring(0,a)}),e.cmd.substring(a)]}),r.jsx("span",{className:"shrink-0 text-[11px] text-text-muted pl-3",children:e.desc})]},e.cmd)})}),r.jsxs("div",{className:"flex justify-between items-center px-3 py-0.5 text-[10px] text-text-muted",style:{borderTop:"1px solid var(--terminal-border)"},children:[r.jsx("span",{children:"Tab · ↑↓ · Esc"}),r.jsxs("span",{children:[v.options.length," match",1!==v.options.length?"es":""]})]})]}),r.jsx("input",{ref:p,type:"text",className:"sr-only",onChange:O,onKeyDown:B,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-[10px] text-text-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{Zt as default}; diff --git a/frontend/dist/assets/Terminal-DYk9EjnC.js b/frontend/dist/assets/Terminal-DYk9EjnC.js new file mode 100644 index 00000000..6a830752 --- /dev/null +++ b/frontend/dist/assets/Terminal-DYk9EjnC.js @@ -0,0 +1 @@ +var e=Object.defineProperty,t=(t,r,n)=>((t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n)(t,"symbol"!=typeof r?r+"":r,n);import{j as r,r as n,c as s}from"./vendor-react-j_fHog8x.js";import{D as a,o,L as i}from"./xterm-Cq-DlOOL.js";import{bu as c,bv as l,bw as u,bx as d,by as p,bz as m,bA as h,bB as f,b3 as g,a7 as $,bC as y,$ as w,_ as v,aA as b,bD as x,bE as _,bF as k,bn as S,K as C,bG as j,N,n as T,bH as E,bI as R,bJ as A}from"./index-B51aMfiH.js";import{s as I}from"./signal-scoring-CcBiRcks.js";import{h as F,c as M,D as L}from"./geo-utils-n2lfanuR.js";import{a as D}from"./ping-DLWlYTPp.js";import{c as O}from"./vendor-core-CDNU4oKM.js";import{P as B,d as P}from"./payload-decoders-ClAu_OX0.js";import{g as H,r as U}from"./system-BlyXhV8d.js";import{g as z,K as q,F as W,S as X}from"./KeycapButton-edNKeR5-.js";import{P as K,b as G,B as J,a as V}from"./PageLayout-DUXmuiZg.js";import"./maplibre-gl-b91ci4Kr.js";class Y{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 Q{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 n of r)if(t.startsWith(n))return e.trim().slice(n.length).trim();return e.trim()}}const Z="[",ee=`${Z}0m`,te=`${Z}1m`,re=`${Z}2m`,ne=`${Z}3m`,se=`${Z}32m`,ae=`${Z}31m`,oe=`${Z}33m`,ie=`${Z}36m`,ce=`${Z}34m`,le=`${Z}90m`,ue=`${Z}92m`,de=`${Z}96m`;function pe(e,t){switch(t){case"success":return`${se}${e}${ee}`;case"error":return`${ae}${e}${ee}`;case"warning":return`${oe}${e}${ee}`;case"info":return`${ie}${e}${ee}`;case"value":return`${ce}${e}${ee}`;case"system":return`${le}${e}${ee}`;default:return e}}function me(e){return`${te}${e}${ee}`}function he(e){return`${re}${e}${ee}`}function fe(e){return`${ce}${e}${ee}`}function ge(e){return`${le}${e}${ee}`}function $e(e,t){return`${le}${e}: ${ee}${ce}${te}${t}${ee}`}function ye(e,t,r=22){const n=e.split(" "),s=n[0];let a=ie;return"get"===s?a=se:"set"===s&&(a=oe),` ${n.length>1?`${a}${te}${s}${ee} ${ce}${n.slice(1).join(" ")}${ee}`:`${a}${te}${e}${ee}`}${" ".repeat(Math.max(1,r-e.length))}${le}${t}${ee}`}function we(e){return`${te}${ce}${e}${ee}`}function ve(e){return`${le}${ne}${e}${ee}`}const be=`${le}$ ${ee}`;function xe(e){return`${ae}${te}●${ee} ${le}${e}${ee}`}function _e(e){const t=e<1e3?`${e.toFixed(0)}ms`:`${(e/1e3).toFixed(1)}s`;return`${function(e){return e<1500?ue:e<4e3?se:e<8e3?oe:e<15e3?ae:`${ae}${te}`}(e)}${t}${ee}`}function ke(e,t){return`${function(e){switch(e){case"excellent":return de;case"good":return se;case"fair":return oe;case"poor":return ae;case"critical":return`${ae}${te}`;default:return le}}(t)}${e}${ee}`}const Se=[ae,ae,oe,se,de];function Ce(e,t){return`${Se[t]??le}${e}${ee}`}function je(e){return e.replace(/[\p{Emoji_Presentation}\p{Extended_Pictographic}\uFE0F\u200D]/gu,"").trim()}const Ne="\r";function Te(e=1){return`[${e}A`}const Ee="[?1049l",Re="[?25h";function Ae(e){return e.replace(/\x1b\[[0-9;]*m/g,"")}function Ie(e){return Ae(e).length}function Fe(e,t){let r=0;for(const n of e){const e=Ae(n).length;r+=0===e?1:Math.ceil(e/t)}return r}function Me(e,t){const r=function(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}(e);return r||t}function Le(){const e=Me("--terminal-bg","#0d0d0d"),t=Me("--text-primary","#e0e0e0"),r=Me("--accent-primary","#3b82f6"),n=Me("--accent-primary","#3b82f6")+"40",s=Me("--accent-danger","#ef4444"),a=Me("--accent-success","#22c55e"),o=Me("--accent-secondary","#f59e0b"),i=Me("--accent-primary","#3b82f6"),c=Me("--accent-tertiary","#06b6d4"),l=Me("--text-muted","#666666"),u=Me("--text-secondary","#a0a0a0");return{background:e,foreground:t,cursor:r,cursorAccent:e,selectionBackground:n,selectionForeground:t,black:Me("--bg-surface","#1a1a1a"),red:s,green:a,yellow:o,blue:i,magenta:o,cyan:c,white:t,brightBlack:l,brightRed:s,brightGreen:a,brightYellow:o,brightBlue:i,brightMagenta:o,brightCyan:c,brightWhite:u}}const De="[",Oe=`${De}0m`,Be=`${De}1m`,Pe=`${De}2m`,He=`${De}34m`,Ue=`${De}90m`,ze=" ",qe=[{label:"INFORMATION",entries:[{cmd:"status",desc:"Repeater status summary",alias:"st"},{cmd:"top",desc:"Live system overview (Ctrl+C to exit)",alias:"htop"},{cmd:"uptime",desc:"System uptime"},{cmd:"board",desc:"Board / platform info"},{cmd:"packets",desc:"Packet statistics"}]},{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"}]}],We=[{cat:"Identity",params:["name","role","lat","lon","public.key"]},{cat:"Radio",params:["radio","freq","tx","bw","sf","cr"]},{cat:"Timing",params:["af","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 Xe(e){return`${Ue}${"─".repeat(e)}${Oe}`}function Ke(e){const t=Math.max(3,e-12-8-6);return` ${He}${Be}pymc console${Oe} ${Xe(t)} ${Ue}terminal${Oe}`}function Ge(e){return` ${Ue}${e}${Oe}`}function Je(e,t){const r=[],n=e.alias?` ${Pe}${e.alias}${Oe}`:"";return 4+Math.max(e.cmd.length,24)+e.desc.length+(e.alias?2+e.alias.length:0)<=t?r.push(" "+ye(e.cmd,e.desc,24)+n):(r.push(" "+ye(e.cmd,"",24)),r.push(ze+ge(e.desc)+n)),e.sub&&r.push(`${ze}${he("└ "+e.sub)}`),r}function Ve(e){return e.split(" · ").map(e=>`${He}${e}${Oe}`).join(`${Ue} · ${Oe}`)}function Ye(e,t){const r=[];let n=[],s=0;for(const a of e){const e=n.length>0?3+a.length:a.length;s+e>t&&n.length>0?(r.push(n),n=[a],s=a.length):(n.push(a),s+=e)}return n.length>0&&r.push(n),r}function Qe(e){const t=["",Ge("GET/SET QUALIFIERS")],r=Math.max(20,e-4-13);for(const n of We){const e=`${Ue}${n.cat.padEnd(13)}${Oe}`,s=Ye(n.params,r),a=" ".repeat(17);t.push(` ${e}${Ve(s[0].join(" · "))}`);for(let r=1;r help for detailed usage")}`]}(r)),e.write(s.join("\n"))}}class et extends Q{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([we("clear"),` ${ge("Clear all terminal output.")}`,"",ye("clear","clear the screen"),"",we("Aliases"),` ${ge("cls")}`].join("\n"))}}function tt(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),n=Math.floor(e%3600/60);return t>0?`${t}d ${r}h ${n}m`:r>0?`${r}h ${n}m`:`${n}m`}class rt extends Q{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,n,s;if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([we("status"),` ${ge("Show a quick summary of mode, neighbor count, and uptime.")}`,"",ye("status","show summary"),"",we("Aliases"),` ${ge("st")}`].join("\n"));const a=e.write("processing...","system");try{const t=await l(),o=(null==(n=null==(r=t.config)?void 0:r.repeater)?void 0:n.mode)||"unknown",i=Object.keys(t.neighbors||{}).length,c=Object.values(t.neighbors||{}).filter(e=>e.zero_hop).length,u=(null==(s=t.config)?void 0:s.node_name)||t.node_name||"unknown",d=tt(t.uptime_seconds||0);e.update(a,[`${me(u)} ${ge("repeater")}`,"",` ${$e("Mode",fe(o))}`,` ${$e("Neighbors",`${fe(String(c))} direct ${ge(`${i} total`)}`)}`,` ${$e("RX / TX",`${fe(String(t.rx_count??0))} / ${fe(String(t.tx_count??0))}`)}`,` ${$e("Uptime",fe(d))}`].join("\n"))}catch(o){e.update(a,`Error: ${o instanceof Error?o.message:"Command failed"}`,"error")}}}class nt extends Q{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([we("uptime"),` ${ge("Display how long the repeater service has been running.")}`,"",ye("uptime","show uptime")].join("\n"));const r=e.write("processing...","system");try{const t=await l();e.update(r,$e("Uptime",fe(tt(t.uptime_seconds||0))))}catch(n){e.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}class st extends Q{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([we("packets"),` ${ge("Display packet counters (received, transmitted, forwarded, dropped).")}`,"",ye("packets","show packet stats")].join("\n"));const r=e.write("processing...","system");try{const t=await l(),n=(t.rx_count??0)+(t.tx_count??0);e.update(r,[we("Packet Stats")+` ${ge(`${n} total`)}`,"",` ${$e("Received",fe(String(t.rx_count??0)))}`,` ${$e("Transmitted",fe(String(t.tx_count??0)))}`,` ${$e("Forwarded",fe(String(t.forwarded_count??0)))}`,` ${$e("Dropped",fe(String(t.dropped_count??0)))}`].join("\n"))}catch(n){e.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}function at(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GB`:e>=1048576?`${(e/1048576).toFixed(0)} MB`:`${(e/1024).toFixed(0)} KB`}function ot(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),n=Math.floor(e%3600/60);return t>0?`${t}d ${r}h ${n}m`:r>0?`${r}h ${n}m`:`${n}m`}class it extends Q{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([we("board"),` ${ge("Display platform and hardware information.")}`,"",ye("board","show board info")].join("\n"));const n=e.write("loading...","system");try{const[t,s]=await Promise.all([u(),l()]),a=[];if(a.push(` ${$e("Node",fe(s.node_name||"Unknown"))}`),a.push(` ${$e("Runtime",fe(`pyMC_Repeater v${s.version||"?"}`))}`),s.core_version&&a.push(` ${$e("Core",fe(s.core_version))}`),a.push(""),t.success&&t.data){const e=t.data;a.push(` ${$e("CPU",fe(`${e.cpu.usage_percent.toFixed(1)}%`))} ${ge(`${e.cpu.count} core${e.cpu.count>1?"s":""}`)}`),e.cpu.load_avg&&a.push(` ${$e("Load",fe(`${e.cpu.load_avg["1min"].toFixed(2)} / ${e.cpu.load_avg["5min"].toFixed(2)} / ${e.cpu.load_avg["15min"].toFixed(2)}`))}`);const n=Object.entries(e.temperatures||{});if(n.length>0){const e=n[0];a.push(` ${$e("Temp",fe(`${e[1].toFixed(1)}°C`))}${n.length>1?` ${ge(n.slice(1).map(([e,t])=>`${e}: ${t.toFixed(1)}°C`).join(", "))}`:""}`)}a.push(""),a.push(` ${$e("Memory",fe(`${at(e.memory.used)} / ${at(e.memory.total)}`))} ${ge(`${e.memory.usage_percent.toFixed(0)}%`)}`),a.push(` ${$e("Disk",fe(`${at(e.disk.used)} / ${at(e.disk.total)}`))} ${ge(`${e.disk.usage_percent.toFixed(0)}%`)}`),a.push(""),(null==(r=e.system)?void 0:r.uptime)&&a.push(` ${$e("System uptime",fe(ot(e.system.uptime)))}`),a.push(` ${$e("Service uptime",fe(ot(s.uptime_seconds)))}`),e.network&&a.push(` ${$e("Net TX/RX",fe(`${at(e.network.bytes_sent)} / ${at(e.network.bytes_recv)}`))}`)}else a.push(` ${$e("Platform",fe("Linux"))}`),a.push(` ${$e("Service uptime",fe(ot(s.uptime_seconds)))}`),a.push(` ${ge("Hardware stats unavailable")}`);e.update(n,a.join("\n"),"value")}catch(s){e.update(n,`Error: ${s instanceof Error?s.message:"Failed to load hardware stats"}`,"error")}}}class ct extends Q{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([we("advert"),` ${ge("Broadcast a repeater advertisement to the mesh network.")}`,"",ye("advert","send advert now"),"",ve("Adverts announce this repeater's presence to neighbors.")].join("\n"));const r=e.write("processing...","system");try{const t=await d();t.success?e.update(r,`✓ ${fe("Advert sent")}`,"success"):e.update(r,`Error: ${t.error||"Failed"}`,"error")}catch(n){e.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}const lt=["sig","name","rssi","snr","dist","heard"],ut={excellent:5,good:4,fair:3,poor:2,critical:1};function dt(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 pt(e){return e<1e3?`${Math.round(e)}m`:`${(e/1e3).toFixed(1)}km`}const mt=["▁","▃","▅","▇","█"],ht={excellent:5,good:4,fair:3,poor:2,critical:1};function ft(e){const t=ht[e]??0;return mt.slice(0,t).map((e,t)=>Ce(e,t)).join("")+ge(".".repeat(5-t))}function gt(e,t=e=>e){return{text:e,color:t}}function $t(e){return ge("+"+e.map(e=>"-".repeat(e+2)).join("+")+"+")}function yt(e,t){const r=e.map((e,r)=>{if(null!=e.rendered){const n=Math.max(0,t[r]-e.text.length);return" "+e.rendered+" ".repeat(n)+" "}return" "+e.color((n=e.text,s=t[r],n.length>=s?n.slice(0,s):n+" ".repeat(s-n.length)))+" ";var n,s});return ge("|")+r.join(ge("|"))+ge("|")}class wt extends Q{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,n=this.argsAfterName(e.rawInput).toLowerCase().trim();if("help"===n)return void this.printUsage(t);const s=lt.includes(n)?n:null,a=t.write("processing...","system");try{const e=await l(),n=e.neighbors||{},o=Object.entries(n).filter(([,e])=>e.zero_hop);if(0===o.length){const e=Object.keys(n).length;return void t.update(a,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&&F(r.latitude,r.longitude)?{lat:r.latitude,lon:r.longitude}:null}(e),u=e.noise_floor_dbm;this.sortNeighbors(o,s,i,c,u);const d=s?` ${he(`sorted by ${s}`)}`:"",p=[we(`Direct Neighbors (${o.length})`)+d,""];if(r<55)for(const[t,r]of o)p.push(...this.cardLayout(t,r,i,c,u));else{const e=r>=70&&null!=c,t=o.map(([t,r])=>this.buildRow(t,r,i,c,u,e)),n=e?["SIG","NAME","RSSI","SNR","DIST","HEARD"]:["SIG","NAME","RSSI","SNR","HEARD"],s=n.slice(1).map((e,r)=>Math.max(e.length,...t.map(e=>e[r+1].text.length))),a=5,l=s.reduce((e,t)=>e+t+3,0),d=Math.max(4,r-l-a-7),m=[a,Math.min(d,Math.max(4,...t.map(e=>e[1].text.length))),...s.slice(1)];p.push($t(m),...t.map(e=>yt(e,m)),$t(m),yt(n.map(e=>gt(e,me)),m),$t(m)),p.push(this.footer(i,u))}t.update(a,p.join("\n"))}catch(o){t.update(a,`Error: ${o instanceof Error?o.message:"Command failed"}`,"error")}}sortNeighbors(e,t,r,n,s){switch(t){case"sig":e.sort(([,e],[,t])=>(ut[this.gradeNeighbor(e,r,s)]??0)-(ut[this.gradeNeighbor(t,r,s)]??0));break;case"name":e.sort(([e,t],[r,n])=>{const s=(t.name||t.node_name||e.slice(0,8)).toLowerCase(),a=(n.name||n.node_name||r.slice(0,8)).toLowerCase();return s.localeCompare(a)});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,n)??1/0)-(this.distTo(t,n)??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 n=null!=e.rssi?e.rssi-3.5:null,s=null!=r&&r>-100?1:0,a=I(e.snr??null,n,t,s);return(null==a?void 0:a.finalGrade)??"critical"}distTo(e,t){return t&&F(e.latitude,e.longitude)?M(t.lat,t.lon,e.latitude,e.longitude):null}buildRow(e,t,r,n,s,a){const o=this.gradeNeighbor(t,r,s),i=je(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`:"-",u=t.last_seen?dt(t.last_seen):"-",d=[(p=ft(o),{text:"|||||",color:e=>e,rendered:p}),gt(i,me),gt(c,fe),gt(l,fe)];var p;if(a){const e=this.distTo(t,n);d.push(gt(null!=e?pt(e):"-",he))}return d.push(gt(u,he)),d}cardLayout(e,t,r,n,s){const a=this.gradeNeighbor(t,r,s),o=je(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?dt(t.last_seen):"-",u=this.distTo(t,n),d=null!=u?` ${ge("dist")} ${fe(pt(u))}`:"";return[`${ft(a)} ${me(o)}`,` ${ge("rssi")} ${fe(i)} ${ge("snr")} ${fe(c)}${d} ${he(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`),ge(r.join(" "))}printUsage(e){const t=[we("neighbors"),` ${ge("Show direct RF neighbors with signal quality, RSSI, SNR, and distance.")}`,"",we("Usage"),ye("neighbors","default sort (most recent)"),ye("neighbors sig","sort by signal grade (weakest first)"),ye("neighbors name","sort alphabetically"),ye("neighbors rssi","sort by RSSI (weakest first)"),ye("neighbors snr","sort by SNR (lowest first)"),ye("neighbors dist","sort by distance (closest first)"),ye("neighbors heard","sort by last seen (oldest first)"),ye("neighbors help","show this help"),"",we("Aliases"),` ${ge("nb, get neighbors, get neighbor")}`,"",ve("Signal bars factor radio config, noise floor, and 3.5 dBi antenna gain."),ve("Only zero-hop (direct RF) neighbors are shown.")];e.write(t.join("\n"))}}class vt extends Q{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([we("get"),` ${ge("Read a repeater configuration parameter.")}`,"",we("Identity"),ye("get name","node name"),ye("get role","node role"),ye("get public.key","public key"),"",we("Location"),ye("get lat","latitude"),ye("get lon","longitude"),"",we("Radio"),ye("get radio","full radio summary"),ye("get freq","frequency (MHz)"),ye("get tx","TX power (dBm)"),ye("get bw","bandwidth (kHz)"),ye("get sf","spreading factor"),ye("get cr","coding rate"),"",we("Timing"),ye("get txdelay","TX delay factor"),ye("get direct.txdelay","direct TX delay"),ye("get rxdelay","RX delay base"),"",we("Repeater"),ye("get mode","forward or monitor"),ye("get flood.max","max flood hops"),ye("get advert.interval","advert interval"),ye("get duty","duty cycle state"),"",we("Advanced"),ye("get multi.acks","multi-ack count"),ye("get int.thresh","interference threshold (dBm)"),ye("get agc.reset.interval","AGC reset interval")].join("\n"));const n=e.write("processing...","system");try{const t=await l(),{result:s,type:a}=function(e,t){const r=t.config||{},n=r.radio||{},s=r.repeater||{},a=r.delays||{},o=r.duty_cycle||{},i=(e,t)=>({result:$e(e,fe(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",n.frequency?`${(n.frequency/1e6).toFixed(3)} MHz`:"?");case"tx":return i("tx",null!=n.tx_power?`${n.tx_power} dBm`:"?");case"bw":return i("bw",n.bandwidth?n.bandwidth/1e3+" kHz":"?");case"sf":return i("sf",String(n.spreading_factor??"?"));case"cr":return i("cr",n.coding_rate?`4/${n.coding_rate}`:"?");case"radio":return n.frequency?{result:[` ${$e("freq",fe(`${(n.frequency/1e6).toFixed(3)} MHz`))}`,` ${$e("bw",fe(n.bandwidth/1e3+" kHz"))}`,` ${$e("sf",fe(String(n.spreading_factor)))}`,` ${$e("cr",fe(`4/${n.coding_rate}`))}`,` ${$e("tx",fe(`${n.tx_power} dBm`))}`].join("\n"),type:"value"}:i("radio","?");case"af":case"txdelay":return i("txdelay",String(a.tx_delay_factor??"1.0"));case"direct.txdelay":return i("direct.txdelay",String(a.direct_tx_delay_factor??"0.5"));case"rxdelay":return i("rxdelay",String(a.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:`${ge("Private key stored in /etc/pymc_repeater/config.yaml")}\n\n ${$e("view",fe("sudo grep identity_key /etc/pymc_repeater/config.yaml"))}\n ${$e("set",fe("sudo ./convert_firmware_key.sh <64-byte-hex>"))}`,type:"info"};case"guest.password":case"allow.read.only":return{result:`${ge("Security settings not exposed via stats API.")}\n${ge("Check /etc/pymc_repeater/config.yaml")}`,type:"warning"};default:return{result:`Unknown parameter: ${fe(e)}\n${ge('Run "get help" to see available parameters.')}`,type:"error"}}}(r,t);e.update(n,s,a)}catch(s){e.update(n,`Error: ${s instanceof Error?s.message:"Command failed"}`,"error")}}}class bt extends Q{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 n=this.argsAfterName(t).split(/\s+/),s=null==(r=n[0])?void 0:r.toLowerCase(),a=n.slice(1).join(" ");if("help"===s||!s)return void e.write([we("set"),` ${ge("Write a repeater configuration parameter.")}`,"",we("Identity"),ye("set name ","node name"),ye("set lat ","latitude (-90 to 90)"),ye("set lon ","longitude (-180 to 180)"),"",we("Radio"),ye("set freq ","frequency"),ye("set tx ","TX power (2-22)"),ye("set bw ","bandwidth"),ye("set sf <5-12>","spreading factor"),ye("set cr <5-8>","coding rate"),"",we("Timing"),ye("set txdelay <0-5>","TX delay factor"),ye("set direct.txdelay <0-5>","direct TX delay"),ye("set rxdelay ","RX delay base"),"",we("Repeater"),ye("set mode ","forward or monitor"),ye("set flood.max <0-64>","max flood hops"),ye("set advert.interval ","advert interval (min)"),ye("set duty ","duty cycle enforcement"),ye("set log ","log level"),"",we("Advanced"),ye("set multi.acks ","multi-ack count"),ye("set int.thresh ","interference threshold"),ye("set agc.reset.interval ","AGC reset interval (x4)"),"",ve("Some changes require a service restart.")].join("\n"));const o=e.write("processing...","system");try{const{result:r,type:n}=await async function(e,t,r){switch(e){case"mode":return async function(e){const t=e.toLowerCase();return"forward"!==t&&"monitor"!==t?Nt('Mode must be "forward" or "monitor"'):(await f(t)).success?jt(`OK - Mode set to ${t}`):Nt("Failed")}(t);case"duty":return async function(e){const t="on"===e.toLowerCase()||"1"===e;return(await h(t)).success?jt("OK - Duty cycle "+(t?"enabled":"disabled")):Nt("Failed")}(t);case"tx":return xt("tx_power",kt(t,2,22,"TX power must be 2-22 dBm"));case"sf":return xt("spreading_factor",kt(t,5,12,"SF must be 5-12"));case"af":case"txdelay":return xt("tx_delay_factor",St(t,0,5,"TX delay must be 0.0-5.0"));case"direct.txdelay":return xt("direct_tx_delay_factor",St(t,0,5,"Direct TX delay must be 0.0-5.0"));case"rxdelay":return xt("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 xt("max_flood_hops",kt(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 Nt("Level must be debug, info, warning, or error");const r=await m(t);return r.success?jt(`OK - Log level set to ${t}`):Nt(r.error||"Failed")}(t);case"multi.acks":return xt("multi_acks",kt(t,0,255,"Multi-acks must be 0-255"));case"int.thresh":return xt("interference_threshold",kt(t,-200,0,"Interference threshold must be -200 to 0 dBm"));case"agc.reset.interval":{const e=Ct(t);if(!e.ok)return Nt(e.error);if(e.value<0)return Nt("AGC reset interval must be >= 0");const r=4*Math.floor(e.value/4);return _t("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?xt("node_name",{ok:!0,value:e}):Nt("Node name cannot be empty")}case"lat":return xt("latitude",St(t,-90,90,"Latitude must be -90 to 90"));case"lon":return xt("longitude",St(t,-180,180,"Longitude must be -180 to 180"));case"freq":{const e=St(t,100,1e3,"Frequency must be 100-1000 MHz");return e.ok?xt("frequency",{ok:!0,value:1e6*e.value}):Nt(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)?Nt(`BW must be one of: ${e.join(", ")} kHz`):xt("bandwidth",{ok:!0,value:1e3*r})}case"cr":return xt("coding_rate",kt(t,5,8,"Coding rate must be 5-8"));case"advert.interval":{const e=Ct(t);return e.ok?0!==e.value&&(e.value<1||e.value>10080)?Nt("Advert interval must be 0 (off) or 1-10080 minutes"):_t("advert_interval_minutes",e.value,0===e.value?"OK - Local adverts disabled":`OK - Local advert interval set to ${e.value}m`):Nt(e.error)}case"flood.advert.interval":{const e=Ct(t);return e.ok?0!==e.value&&(e.value<3||e.value>48)?Nt("Flood advert interval must be 0 (off) or 3-48 hours"):_t("flood_advert_interval_hours",e.value,0===e.value?"OK - Flood adverts disabled":`OK - Flood advert interval set to ${e.value}h`):Nt(e.error)}case"prv.key":{const e=t.trim();return e?/^[0-9a-fA-F]+$/.test(e)?128!==e.length?Nt(`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"}:Nt("Private key must be a hex string"):Nt("Private key cannot be empty")}default:return Nt(`Unknown parameter: ${e}`)}}(s,a,t);e.update(o,r,n)}catch(i){e.update(o,`Error: ${i instanceof Error?i.message:"Command failed"}`,"error")}}}async function xt(e,t){if(!t.ok)return Nt(t.error);const r=await p({[e]:t.value});if(!r.success)return Nt(r.error||"Failed");let n=`OK - ${e} set to ${t.value}`;return r.restart_required&&(n+="\n⚠ Service restart required for changes to take effect\nRun: sudo systemctl restart pymc_repeater"),jt(n)}async function _t(e,t,r){const n=await p({[e]:t});if(!n.success)return Nt(n.error||"Failed");let s=r;return n.restart_required&&(s+="\n⚠ Service restart required for changes to take effect\nRun: sudo systemctl restart pymc_repeater"),jt(s)}function kt(e,t,r,n){const s=parseInt(e);return isNaN(s)||sr?{ok:!1,error:`Error: ${n}`}:{ok:!0,value:s}}function St(e,t,r,n){const s=parseFloat(e);return isNaN(s)||sr?{ok:!1,error:`Error: ${n}`}:{ok:!0,value:s}}function Ct(e){const t=parseInt(e);return isNaN(t)?{ok:!1,error:"Error: Expected a number"}:{ok:!0,value:t}}function jt(e){return{result:e,type:"success"}}function Nt(e){return{result:`Error: ${e}`,type:"error"}}const Tt=["▁","▃","▅","▇","█"],Et={excellent:5,good:4,fair:3,poor:2,critical:1};class Rt extends Q{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,n,s,a;const o=this.argsAfterName(t).trim(),i=o.split(/\s+/);if("help"===(null==(r=i[0])?void 0:r.toLowerCase()))return void e.write([we("ping"),` ${ge("Send a ping to a neighbor and measure round-trip time, signal quality, and path.")}`,"",ye("ping ","ping by node name"),ye("ping 0xAB","ping by hex prefix"),ye("ping 60","ping with custom timeout (seconds)"),"",ve("Default timeout: 30s. Signal bars factor radio config and noise floor.")].join("\n"));const c=i[i.length-1],u=parseInt(c),d=i.length>1&&!isNaN(u)&&u>0,p=d?i.slice(0,-1).join(" "):o,m=d?u:30;if(!p)return void e.write([we("ping"),` ${ge("Send a ping to a neighbor and measure round-trip time.")}`,"",ye("ping ","ping by node name"),ye("ping 60","with custom timeout"),"",ve('Run "ping help" for full usage.')].join("\n"));const h=e.write(`Pinging ${p}.`,"system");let f=1;const g=setInterval(()=>{f=f%3+1,e.update(h,`Pinging ${p}${".".repeat(f)}`,"system")},800);try{const[t,r]=await Promise.all([D(p,m),l()]);if(clearInterval(g),t.success&&t.data){const o=t.data,i=null==(n=r.config)?void 0:n.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,u=null!=l&&l>-100?1:0,d=o.rssi-3.5,p=I(o.snr_db,d,c,u),m=(null==p?void 0:p.finalGrade)??"critical",f=function(e){const t=Et[e]??0;return Tt.slice(0,t).map((e,t)=>Ce(e,t)).join("")+ge(".".repeat(5-t))}(m),g=(null==(s=o.path)?void 0:s.length)?o.path.length:0,$=(null==(a=o.path)?void 0:a.length)?o.path.join(" > "):"direct",y=m.charAt(0).toUpperCase()+m.slice(1),w=[`${f} ${me("Reply from")} ${fe(o.target_id)}`,"",` ${$e("RTT",_e(o.rtt_ms))}`,` ${$e("RSSI",`${o.rssi} dBm`)}`,` ${$e("SNR",`${o.snr_db} dB`)}`,` ${$e("Path",$)}${g>0?ge(` (${g} hop${1!==g?"s":""})`):""}`,` ${$e("Quality",ke(y,m))}`],v=[];c&&v.push(`SF${c.sf}/${c.bwHz>=1e3?c.bwHz/1e3+"kHz":c.bwHz+"Hz"}`),v.push("ant 3.5dBi"),null!=l&&v.push(`nf ${l}dBm`),w.push("",ge(v.join(" "))),e.update(h,w.join("\n"))}else e.update(h,t.error||"Ping failed","error")}catch($){clearInterval(g),e.update(h,`Error: ${$ instanceof Error?$.message:"Ping failed"}`,"error")}}}class At extends Q{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 n=null==(r=t[1])?void 0:r.toLowerCase(),s=t.slice(2).join(" ").trim();"help"!==n&&(n||s)?"hex"===n?this.hexToBase64(e,s):"base64"===n?this.base64ToHex(e,s):e.write([we("convert"),` ${ge("Convert between hex and base64 encodings.")}`,"",ye("convert hex ","hex → base64"),ye("convert base64 ","base64 → hex")].join("\n")):e.write([we("convert"),` ${ge("Convert between hex and base64 encodings.")}`,"",ye("convert hex ","hex → base64"),ye("convert base64 ","base64 → hex"),"",ve("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 n="";for(let e=0;e","error")}}function It(){const e=new Date;return`${e.toISOString().slice(0,10)}_${e.toTimeString().slice(0,8).replace(/:/g,"-")}`}function Ft(e,t){return`pymc-${e.toISOString().slice(0,10)}-${e.toTimeString().slice(0,5).replace(":","")}-${t}s.json`}const Mt=O((e,t)=>({isCapturing:!1,captureStartTime:null,captureStartPacketHashes:new Set,captureTimer:null,reports:[],startCapture:r=>{const{captureTimer:n}=t();n&&clearTimeout(n),e({isCapturing:!0,captureStartTime:new Date,captureStartPacketHashes:new Set(r.map(e=>e.packet_hash))})},stopCapture:r=>{const{isCapturing:n,captureStartTime:s,captureStartPacketHashes:a,captureTimer:o}=t();if(!n||!s)return null;o&&clearTimeout(o);const i=new Date,c=Math.round((i.getTime()-s.getTime())/1e3),l=s.getTime()/1e3,u=r.filter(e=>!a.has(e.packet_hash)&&e.timestamp>=l).sort((e,t)=>e.timestamp-t.timestamp),d={id:It(),filename:Ft(s,c),startTime:s,endTime:i,durationSec:c,packetCount:u.length,packets:u,sizeBytes:500*u.length};return e(e=>({isCapturing:!1,captureStartTime:null,captureStartPacketHashes:new Set,captureTimer:null,reports:[d,...e.reports].slice(0,10)})),d},getReport:e=>t().reports.find(t=>t.id===e),_setTimer:t=>e({captureTimer:t})})),Lt=()=>Mt(e=>e.reports);function Dt(e){var t;return(null==(t=e.match(/.{1,2}/g))?void 0:t.join(" ").toUpperCase())||""}function Ot(e){return void 0===e?"UNKNOWN":v[e]??`TYPE_${e}`}function Bt(e){return void 0===e?"UNKNOWN":w[e]??`ROUTE_${e}`}function Pt(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:Dt(y(e.slice(r,r+32))),decoded:{value:y(e.slice(r,r+32))}}),r+=32),e.length>=r+4){const n=e.slice(r,r+4),s=n[0]|n[1]<<8|n[2]<<16|n[3]<<24;t.push({name:"timestamp",offset:r,length:4,bytes:Dt(y(n)),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:Dt(y(e.slice(r,r+64))),decoded:{value:y(e.slice(r,r+64))}}),r+=64),e.length>r){const n=e[r],s=[];if(1&n&&s.push("CHAT_NODE"),2&n&&s.push("REPEATER"),3&n&&s.push("ROOM_SERVER"),16&n&&s.push("HAS_LOCATION"),128&n&&s.push("HAS_NAME"),t.push({name:"flags",offset:r,length:1,bytes:Dt(y(e.slice(r,r+1))),decoded:{value:n,binary:n.toString(2).padStart(8,"0"),flags:s}}),r+=1,16&n&&e.length>=r+8){const n=e.slice(r,r+8),s=new ArrayBuffer(8);new Uint8Array(s).set(n);const a=new DataView(s),o=a.getInt32(0,!0),i=a.getInt32(4,!0);t.push({name:"location",offset:r,length:8,bytes:Dt(y(n)),decoded:{lat_raw:o,lon_raw:i,latitude:o/1e6,longitude:i/1e6}}),r+=8}if(128&n&&e.length>r){const n=e.slice(r);let s=n.indexOf(0);-1===s&&(s=n.length);const a=(new TextDecoder).decode(n.slice(0,s));t.push({name:"name",offset:r,length:s+(0===n[s]?1:0),bytes:Dt(y(n.slice(0,s+1))),decoded:{value:a,encoding:"utf-8",null_terminated:0===n[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:Dt(y(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),n=r[0]|r[1]<<8|r[2]<<16|r[3]<<24;t.push({name:"trace_tag",offset:0,length:4,bytes:Dt(y(r)),decoded:{value:n>>>0,hex:(n>>>0).toString(16).toUpperCase().padStart(8,"0")}});const s=e.slice(4,8),a=s[0]|s[1]<<8|s[2]<<16|s[3]<<24;if(t.push({name:"auth_code",offset:4,length:4,bytes:Dt(y(s)),decoded:{value:a>>>0}}),t.push({name:"flags",offset:8,length:1,bytes:Dt(y(e.slice(8,9))),decoded:{value:e[8],binary:e[8].toString(2).padStart(8,"0")}}),e.length>9){const r=e.slice(9),n=Array.from(r).map(e=>e.toString(16).toUpperCase().padStart(2,"0"));t.push({name:"target_path",offset:9,length:r.length,bytes:Dt(y(r)),decoded:{hops:n,path_string:n.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:Dt(y(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:Dt(y(e.slice(0,1))),decoded:{value:e[0].toString(16).toUpperCase().padStart(2,"0")}}),e.length>13){const r=12,n=e.length-1-r;t.push({name:"ciphertext",offset:1,length:n,bytes:Dt(y(e.slice(1,1+n))),decoded:{length:n,note:"Encrypted message content"}}),t.push({name:"mac",offset:1+n,length:r,bytes:Dt(y(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:Dt(y(e)),decoded:{length:e.length}}]}(t)}}function Ht(e){const t=e.type??e.payload_type??0,r=e.route??e.route_type??0,n=e.raw_packet||"";let s,a=null;if(n){const t=B.fromHex(n);if(t.success&&t.packet){const e=t.packet;try{a=P(e)}catch{a=null}const r=$(n);let o=0;const i={offset:0,length:1,bytes:Dt(n.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:Dt(y(r.slice(o,o+1))),decoded:{value:e.pathLen}};o+=1;const l=o,u=r.slice(o,o+e.pathLen),d=Array.from(e.path).map(e=>e.toString(16).toUpperCase().padStart(2,"0")),p=9===e.payloadType,m={offset:l,length:e.pathLen,bytes:Dt(y(u)),decoded:{hops:d,path_string:d.length>0?d.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:Dt(e.payloadHex),sections:Pt(e.payloadType,e.payload)}}}else s=Ut(e)}else s=Ut(e);return{timestamp:e.timestamp,packet_hash:e.packet_hash,type:t,type_name:Ot(t),route:r,route_name:Bt(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:n,structure:s,decoded:a}}function Ut(e){var t;const r=e.type??e.payload_type??0,n=e.route??e.route_type??0,s=e.original_path??e.forwarded_path??[];return{header:{offset:0,length:1,bytes:"??",decoded:{route_type:n,route_name:Bt(n),payload_type:r,payload_name:Ot(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?Pt(r,$(e.payload)):[]}}}function zt(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:g,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(Ht)}}(e,t),n=JSON.stringify(r,null,2),s=new Blob([n],{type:"application/json"}),a=URL.createObjectURL(s),o=document.createElement("a");o.href=a,o.download=e.filename,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)}function qt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}class Wt extends Q{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=Mt.getState(),r=t.isCapturing?`\n${xe('Recording in progress... use "end cap" to stop')}`:"",n=t.reports.length,s=n>0?` (${n} saved)`:"",a=[we("Packet Capture"),"",ye("start cap","Start capture (default: 120s)"),ye("end cap","Stop capture early"),ye("list cap",`List saved captures${s}`),ye("export cap","Download capture by ID"),"",ve("Captures stored in session memory. JSON includes decoded payloads."),r].filter(Boolean);e.write(a.join("\n"))}startCapture(e,t){const r=t.slice(9).trim(),n=r?parseInt(r):120;if(isNaN(n)||n<1||n>3600)return void e.write("Error: Duration must be 1-3600 seconds","error");const s=Mt.getState();if(s.isCapturing)return void e.write('Error: Capture already in progress. Use "end cap" first.',"error");const a=b.getState().packets;s.startCapture(a);let o=n;const i=e.write(xe(`Capturing... ${o}s remaining`),"system"),c=setInterval(()=>{o--;const t=Mt.getState();if(o>=0&&t.isCapturing){const r=b.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,n=o>0?`${o}s remaining`:"finishing...";e.update(i,xe(`Capturing... ${n} (${r} captured)`),"system")}},1e3),l=setTimeout(()=>{clearInterval(c);const t=Mt.getState();if(t.isCapturing){const r=b.getState().packets,n=t.stopCapture(r);n?e.write(`✓ Capture complete!\n Captured: ${n.packetCount} packets\n Duration: ${n.durationSec}s\n Size: ~${qt(n.sizeBytes)}\n\nRun \`export cap ${n.id}\` to download.`,"success"):e.write("Capture completed with no packets.","warning")}},1e3*n);s._setTimer(l)}endCapture(e){const t=Mt.getState();if(!t.isCapturing)return void e.write("No capture in progress.","warning");const r=b.getState().packets,n=t.stopCapture(r);n?e.write(`✓ Capture stopped!\n Captured: ${n.packetCount} packets\n Duration: ${n.durationSec}s\n Size: ~${qt(n.sizeBytes)}\n\nRun \`export cap ${n.id}\` to download.`,"success"):e.write("Capture stopped with no packets.","warning")}listCaptures(e){const{reports:t}=Mt.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 • ~${qt(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(),n=Mt.getState(),s=b.getState().stats;if(!r){if(0===n.reports.length)e.write("No capture reports available.\nStart a capture with: start cap [seconds]","info");else{const t=n.reports.map((e,t)=>` ${t+1}. ${e.id}`);e.write(`Usage: export cap \n\nAvailable reports:\n${t.join("\n")}`,"info")}return}let a=n.getReport(r);if(!a){const e=parseInt(r)-1;a=n.reports[e]}a?(zt(a,s),e.write(`✓ Downloading ${a.filename}...`,"success")):e.write(`Error: Report "${r}" not found.\nUse "list cap" to see available reports.`,"error")}}class Xt extends Q{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([we("identities"),` ${ge("List all configured repeater and room server identities.")}`,"",ye("identities","list identities"),"",we("Aliases"),` ${ge("id, ids")}`].join("\n"));const n=e.write("processing...","system");try{const t=await x();if(!t.success||!t.data)return void e.update(n,t.error||"Failed to fetch identities","error");const s=t.data,a=(null==(r=s.configured)?void 0:r.length)?s.configured:s.registered||[];if(0===a.length)return void e.update(n,"No identities configured.","warning");const o=[we(`Identities (${a.length})`),"",...a.map((e,t)=>{var r;const n=e.name||"Unnamed",s=e.type||"unknown",a=(null==(r=e.hash)?void 0:r.slice(0,8))||"—";return` ${ge(`${t+1}.`)} ${me(n)} ${he(s)} ${fe(a)}`})];e.update(n,o.join("\n"))}catch(s){e.update(n,`Error: ${s instanceof Error?s.message:"Command failed"}`,"error")}}}class Kt extends Q{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([we("keys"),` ${ge("List configured transport encryption keys.")}`,"",ye("keys","list transport keys")].join("\n"));const r=e.write("processing...","system");try{const t=await H();if(!t.success||!t.data)return void e.update(r,t.error||"Failed to fetch transport keys","error");const n=t.data;if(0===n.length)return void e.update(r,"No transport keys configured.","warning");const s=[we(`Transport Keys (${n.length})`),"",...n.map(e=>{const t=e.parent_id?` ${he(`parent: ${e.parent_id}`)}`:"";return` ${me(e.name)} ${$e("flood",fe(e.flood_policy))}${t}`})];e.update(r,s.join("\n"))}catch(n){e.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}class Gt extends Q{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([we("acl"),` ${ge("Display access control list statistics.")}`,"",ye("acl","show ACL stats")].join("\n"));const r=e.write("processing...","system");try{const t=await z();if(!t.success||!t.data)return void e.update(r,t.error||"Failed to fetch ACL stats","error");const n=t.data,s=[we("ACL Stats"),"",` ${$e("Identities",fe(String(n.total_identities)))}`,` ${$e("Total clients",fe(String(n.total_clients)))}`,` ${$e("Admin",fe(String(n.admin_clients)))}`,` ${$e("Guest",fe(String(n.guest_clients)))}`];if(n.by_identity_type){const e=n.by_identity_type.repeater,t=n.by_identity_type.room_server;e&&s.push(` ${$e("Repeater",`${fe(String(e.count))} ids ${ge(`${e.clients} clients`)}`)}`),t&&s.push(` ${$e("Room Server",`${fe(String(t.count))} ids ${ge(`${t.clients} clients`)}`)}`)}e.update(r,s.join("\n"))}catch(n){e.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}class Jt extends Q{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([we("rooms"),` ${ge("Display room server statistics and sync status.")}`,"",ye("rooms","list rooms")].join("\n"));const r=e.write("processing...","system");try{const t=await _();if(!t.success||!t.data)return void e.update(r,t.error||"Failed to fetch room stats","error");const n=t.data.rooms||[];if(0===n.length)return void e.update(r,"No room servers configured.","warning");const s=[we(`Rooms (${n.length})`),"",...n.map(e=>[` ${me(e.room_name)}`,` ${$e("msgs",fe(String(e.total_messages)))} ${$e("clients",`${fe(String(e.active_clients))}${he(`/${e.total_clients}`)}`)} ${$e("sync",e.sync_running?fe("running"):he("idle"))}`]).flat()];e.update(r,s.join("\n"))}catch(n){e.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}class Vt extends Q{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([we("restart"),` ${ge("Restart the pymc-repeater systemd service.")}`,"",ye("restart","restart the service"),"",we("Aliases"),` ${ge("reboot")}`,"",ve("Requires polkit permissions for the web user."),ve("The page will need a manual refresh after restart.")].join("\n"));const r=e.write("Restarting service...","system");try{const t=await U(AbortSignal.timeout(8e3));if(t.success)return e.update(r,"Service restart initiated.","success"),void this.waitForService(e);const n=t.status;if(403===n||401===n)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(n){const t=n instanceof Error?n.message:"";t.includes("ERR_NETWORK")||t.includes("ECONNRESET")||t.includes("Failed to fetch")||t.includes("abort")||t.includes("timeout")||n instanceof DOMException&&"TimeoutError"===n.name||n instanceof DOMException&&"AbortError"===n.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,n=!1;setTimeout(()=>{const s=setInterval(async()=>{if(!n){r++,e.update(t,`Waiting for service... ${r}s`,"system");try{await fetch(`${k}/api/stats`,{signal:AbortSignal.timeout(3e3)}),n=!0,clearInterval(s),e.update(t,`Service connected. (${r+4}s)`,"success")}catch{}!n&&r>=30&&(n=!0,clearInterval(s),e.update(t,"Service did not respond within 34s. Check manually.","warning"))}},1e3)},4e3)}}const Yt="[",Qt=`${Yt}0m`,Zt=`${Yt}32m`,er=`${Yt}33m`,tr=`${Yt}31m`,rr=`${Yt}36m`,nr=`${Yt}90m`,sr=`${Yt}1m`;function ar(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 or(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),n=Math.floor(e%3600/60);return t>0?`${t}d ${r}h ${n}m`:r>0?`${r}h ${n}m`:`${n}m`}function ir(e,t){const r=" ".repeat(2),n=t-2,s=[];let a="",o=0;for(const i of e){const e=Ie(i);0===o?(a=i,o=e):o+2+e<=n?(a+=" "+i,o+=2+e):(s.push(r+a),a=i,o=e)}return o>0&&s.push(r+a),s}function cr(e,t,r){var n,s;const a=e.node_name||"unknown",o=e.version?`v${e.version}`:"",i=(null==(n=t.system)?void 0:n.uptime)?or(t.system.uptime):"?",c=or(e.uptime_seconds||0),l=Math.max(3,r-4),u=(null==(s=t.cpu.load_avg)?void 0:s["1min"].toFixed(2))??"?",d=t.cpu.load_avg?`${u} ${t.cpu.load_avg["5min"].toFixed(2)} ${t.cpu.load_avg["15min"].toFixed(2)}`:"?",p=r>=60?d:u;return[` ${rr}${sr}${a}${Qt} ${nr}${o}${Qt}`,` ${nr}${"─".repeat(l)}${Qt}`,...ir([$e("Sys",fe(i)),$e("Svc",fe(c)),$e("Load",fe(p))],r)]}function lr(e,t){const r=Math.max(6,Math.min(30,t-15)),n=t-(15+r)-2,s=[""],a=`${e.cpu.count} core${e.cpu.count>1?"s":""}`,o=`${ar(e.memory.used)}/${ar(e.memory.total)}`,i=`${ar(e.disk.used)}/${ar(e.disk.total)}`,c=(e,t,s)=>{const a=function(e,t){const r=Math.max(0,Math.min(100,e)),n=Math.round(r/100*t),s=t-n,a=r>=90?tr:r>=70?er:Zt;return`[${a}${"█".repeat(n)}${Qt}${nr}${"░".repeat(s)}${Qt}] ${a}${`${r.toFixed(1)}%`.padStart(6)}${Qt}`}(t,r),o=n>=s.length?` ${he(s)}`:"";return` ${ge(e.padEnd(4))}${a}${o}`};s.push(c("CPU",e.cpu.usage_percent,a)),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`${he(e+":")} ${r=t,r>=80?`${tr}${sr}${r.toFixed(1)}°C${Qt}`:r>=60?`${er}${r.toFixed(1)}°C${Qt}`:`${Zt}${r.toFixed(1)}°C${Qt}`}`;var r});s.push(...ir(e,t))}return s}function ur(e,t){var r,n;const s=e.neighbors||{},a=Object.keys(s).length,o=Object.values(s).filter(e=>e.zero_hop).length,i=(null==(n=null==(r=e.config)?void 0:r.repeater)?void 0:n.mode)||"?",c=null!=e.noise_floor_dbm?`${e.noise_floor_dbm}dBm`:"?",l=e.duty_cycle_percent??0,u=["",` ${nr}MESH${Qt}`];return u.push(...ir([$e("Mode",fe(i)),$e("Nbrs",`${fe(String(o))}${he(`/${a}`)}`),$e("Noise",fe(c)),$e("Air",fe(`${l.toFixed(1)}%`))],t)),u.push(...ir([$e("RX",fe(String(e.rx_count??0))),$e("TX",fe(String(e.tx_count??0))),$e("FWD",fe(String(e.forwarded_count??0))),$e("Drop",fe(String(e.dropped_count??0)))],t)),u.push(...ir([$e("RX/h",fe(String(Math.round(e.rx_per_hour??0)))),$e("FWD/h",fe(String(Math.round(e.forwarded_per_hour??0))))],t)),u}function dr(e,t){if(!e.network)return[];const r=["",` ${nr}NET${Qt}`];return r.push(...ir([$e("TX",fe(ar(e.network.bytes_sent))),$e("RX",fe(ar(e.network.bytes_recv))),$e("Pkt",`${fe(String(e.network.packets_sent))}${he("/")}${fe(String(e.network.packets_recv))}`)],t)),r}function pr(e,t){if(0===e.length)return[];const r=t>=50,n=t>=50?6:5,s=t>=50?6:5,a=r?7:0,o=Math.max(4,t-2-a-n-s-4),i=t>=50?8:5,c=["",` ${nr}PROCS${Qt}`],l=(r?"PID".padEnd(a):"")+"CPU".padStart(n)+"MEM".padStart(s)+" NAME";c.push(` ${he(l)}`);for(const u of e.slice(0,i)){const e=r?he(String(u.pid).padEnd(a)):"",i=(t>=50?u.cpu_percent.toFixed(1):u.cpu_percent.toFixed(0)).padStart(n),l=(t>=50?u.memory_percent.toFixed(1):u.memory_percent.toFixed(0)).padStart(s),d=u.name.length>o?u.name.slice(0,o-1)+"…":u.name,p=u.cpu_percent>=50?tr:u.cpu_percent>=20?er:"",m=p?`${p}${i}${Qt}`:i;c.push(` ${e}${m}${he(l)} ${d}`)}return c}function mr(e,t,r,n){return e&&t?[...cr(e,t,n),...lr(t,n),...ur(e,n),...dr(t,n),...pr(r,n),"",` ${nr}${(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})} · Ctrl+C to exit${Qt}`].join("\n"):` ${nr}Waiting for data…${Qt}`}class hr extends Q{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:n}){var s,a;if("help"===this.argsAfterName(t).toLowerCase().trim())return void e.write([we("top"),` ${ge("Live-updating system overview combining hardware")}`,` ${ge("stats, mesh metrics, and running processes.")}`,` ${ge("Refreshes every 3s. Press Ctrl+C to exit.")}`,"",ye("top","start live display"),"",we("Sections"),` ${ge("Header Node name, version, uptime, load average")}`,` ${ge("Gauges CPU, memory, disk usage with bar charts")}`,` ${ge("Mesh Mode, neighbors, packet counts, airtime")}`,` ${ge("Network TCP/IP bytes and packet counters")}`,` ${ge("Processes Top 8 processes by CPU usage")}`,"",we("Aliases"),` ${ge("htop")}`].join("\n"));let o=b.getState().hardwareStats,i=[],c=b.getState().stats;try{const[e,t]=await Promise.all([u(),S()]);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(!n.aborted){null==(s=e.enterFullscreen)||s.call(e);try{const t=e.write(mr(c,o,i,e.cols??r));await new Promise(s=>{if(n.aborted)return void s();const a=setInterval(()=>{if(n.aborted)return clearInterval(a),void s();(async()=>{c=b.getState().stats;try{const[e,t]=await Promise.all([u(),S()]);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{}n.aborted||e.update(t,mr(c,o,i,e.cols??r))})()},3e3);n.addEventListener("abort",()=>{clearInterval(a),s()},{once:!0})})}finally{null==(a=e.exitFullscreen)||a.call(e)}}}}const fr=O(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)}),n={...t,id:r,timestamp:Date.now()};return e(e=>({entries:[...e.entries,n]})),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 gr({isOpen:e,onClose:t}){const n=Lt(),s=b(e=>e.stats);return r.jsxs(C,{open:e,onClose:t,size:"lg",children:[r.jsx(j,{icon:r.jsx(L,{size:20}),title:"Download Captures",onClose:t}),r.jsx(N,{children:r.jsx("div",{className:"flex flex-col gap-3",children:0===n.length?r.jsx("p",{className:"text-text-secondary",children:"No captures available."}):n.map(e=>r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md bg-bg-surface-elevated",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:e.filename}),r.jsxs("p",{className:"text-sm text-text-secondary",children:[e.packetCount," packets • ",e.durationSec,"s • ~",qt(e.sizeBytes)]})]}),r.jsx("button",{onClick:()=>(e=>{const t=n.find(t=>t.id===e);t&&zt(t,s)})(e.id),className:"p-2 text-text-secondary hover:text-text-primary hover:bg-bg-subtle rounded-md transition-colors",title:"Download",children:r.jsx(L,{size:18})})]},e.id))})})]})}function $r(){const e=Lt(),t=e.length>0,[s,a]=n.useState(!1);return t?r.jsxs(r.Fragment,{children:[r.jsx(q,{icon:r.jsx(W,{size:20}),onClick:()=>a(!0),title:`Download captures (${e.length})`,iconActiveColor:"#E5484D",keycapSrc:"/assets/keycap-red.svg"}),r.jsx(gr,{isOpen:s,onClose:()=>a(!1)})]}):null}const yr=function(){const e=new Y,t=new Ze(e);return e.register(t,new et,new rt,new nt,new st,new it,new ct,new wt,new Rt,new vt,new bt,new At,new Wt,new Xt,new Kt,new Gt,new Jt,new Vt,new hr),e}(),wr=yr.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}))]),vr={"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 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"],"start cap":["30","60","120","300"]};function br(){return/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)||window.innerWidth<640}function xr(){const e=T(),{addCommand:t}=fr(),l=n.useRef(null),u=n.useRef(null),d=n.useRef(null),p=n.useRef(null),m=n.useRef(""),h=n.useRef(-1),f=n.useRef(""),g=n.useRef(!1),$=n.useRef(null),y=n.useRef(!1),w=n.useRef(!1),v=n.useRef([]),b=n.useRef(()=>{}),x=E(),[_,k]=n.useState({show:!1,options:[],selectedIndex:0,input:""}),S=n.useRef([]),C=n.useRef(0);n.useEffect(()=>{(null==e?void 0:e.neighbors)&&(v.current=Object.values(e.neighbors).map(e=>e.node_name||e.name).filter(e=>!!e).sort())},[null==e?void 0:e.neighbors]);const j=n.useCallback(()=>{var e;null==(e=u.current)||e.write(be)},[]),N=n.useCallback(()=>{const e=u.current;e&&(e.write(Ne),j(),e.write(m.current))},[j]),I=n.useCallback(e=>{const t=function(e,t){const r=e.trim().toLowerCase();if(!r)return[];const n=wr.filter(e=>e.cmd.toLowerCase().startsWith(r));if(n.length>0)return n;if(r.includes(" ")){const e=r.lastIndexOf(" "),n=r.substring(0,e),s=r.substring(e+1);if("ping"===n&&t.length>0)return t.filter(e=>e.toLowerCase().startsWith(s)).slice(0,10).map(e=>({cmd:`ping ${e}`,desc:`→ ${e}`}));const a=wr.find(e=>e.cmd.toLowerCase()===n);if(a&&vr[a.cmd])return vr[a.cmd].filter(e=>e.toLowerCase().startsWith(s)).map(e=>({cmd:`${a.cmd} ${e}`,desc:`→ ${e}`}))}return[]}(e,v.current);S.current=t,C.current=0;const r=t.length>0&&e.trim().length>0;k({show:r,options:t,selectedIndex:0,input:e.trim()})},[]),F=n.useCallback(()=>{S.current=[],C.current=0,k({show:!1,options:[],selectedIndex:0,input:""})},[]),M=n.useCallback(e=>{var t;const r=S.current[e];r&&(m.current=r.required?r.cmd+" ":r.cmd,N(),r.required?I(m.current):F(),null==(t=u.current)||t.focus())},[N,I,F]),L=n.useCallback(async e=>{const r=u.current;if(!r)return;const n=e.trim();if(!n)return void j();g.current=!0;const s=new AbortController;$.current=s,t(n),h.current=-1;let a=0;const o={get cols(){return r.cols},write(e,t="default"){const n=("default"===t?e:pe(e,t)).split("\n");for(const s of n)r.writeln(s);return a=Fe(n,r.cols),String(a)},update(e,t,n){if(w.current)r.write("");else if(a>0)for(let o=0;o{const t=u.current;if(!t)return;if(g.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=S.current[C.current];e&&(m.current=e.cmd,N())}F();const e=m.current;m.current="",t.writeln(""),L(e);continue}if(127!==a&&8!==a)if(3!==a)if(12!==a)if(9!==a)if(27!==a)a>=32&&(m.current+=e[s],t.write(e[s]),h.current=-1,I(m.current));else{if(91===e.charCodeAt(s+1)){const t=e.charCodeAt(s+2);if(s+=2,65===t){if(S.current.length>0){const e=Math.max(C.current-1,0);C.current=e,k(t=>({...t,selectedIndex:e})),n(e)}else r.length>0&&(-1===h.current&&(f.current=m.current),h.current0){const e=Math.min(C.current+1,S.current.length-1);C.current=e,k(t=>({...t,selectedIndex:e})),n(e)}else h.current>0?(h.current--,m.current=r[r.length-1-h.current]||"",N()):0===h.current&&(h.current=-1,m.current=f.current,N());continue}if(67===t||68===t)continue;continue}S.current.length>0&&F()}else S.current.length>0&&M(C.current);else t.clear(),F(),N();else m.current="",F(),t.writeln("^C"),j();else m.current.length>0&&(m.current=m.current.slice(0,-1),t.write("\b \b"),I(m.current))}},[F,I,M,j,N,L]);n.useEffect(()=>{b.current=D},[D]);const O=n.useCallback(async()=>{const e=u.current;if(!e||y.current)return;y.current=!0;const t="",r="",n="██████ ██ ██ ███ ███ ██████\n██ ██ ██ ██ ████ ████ ██ \n██████ ████ ██ ████ ██ ██ \n██ ██ ██ ██ ██ ██ \n██ ██ ██ ██ ██████".split("\n");for(const s of n)e.writeln(`${t}${s}${r}`);e.writeln(""),e.write(ge("● Initializing terminal...")),await new Promise(e=>setTimeout(e,300)),e.write(Ne),e.writeln(`${t}✓ Initializing terminal...${r}`),e.write(ge("● Connecting to repeater...")),await new Promise(e=>setTimeout(e,500)),e.write(Ne),"connected"===R.getState().health?e.writeln(`${t}✓ Connected to repeater${r}`):e.writeln(`${oe}~ Connection status unknown${ee}`),e.writeln(ge("Ready. Type 'help' for commands.")),e.writeln(""),j()},[j]);n.useEffect(()=>{const e=l.current;if(!e)return;const t=new a({theme:Le(),fontFamily:'"JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',fontSize:13,lineHeight:1.4,cursorBlink:!1,cursorStyle:"underline",scrollback:1e4,convertEol:!0,allowTransparency:!0,rightClickSelectsWord:!1}),r=new o;t.loadAddon(r),t.loadAddon(new i),t.open(e),r.fit(),u.current=t,d.current=r;const n=t.onData(e=>b.current(e)),s=function(e){return c.subscribe(()=>{e.options.theme=Le()})}(t),p=new ResizeObserver(()=>{requestAnimationFrame(()=>r.fit())});return p.observe(e),O(),br()||t.focus(),()=>{var e;null==(e=$.current)||e.abort(),w.current&&(t.write(Re+Ee),w.current=!1),n.dispose(),s(),p.disconnect(),t.dispose(),u.current=null,d.current=null}},[]);const B=n.useCallback(e=>{const t=e.target.value;t.length>0&&(D(t),e.target.value="")},[D]),P=n.useCallback(e=>{"Enter"===e.key?(e.preventDefault(),D("\r")):"Backspace"===e.key?(e.preventDefault(),D("")):"ArrowUp"===e.key?(e.preventDefault(),D("")):"ArrowDown"===e.key&&(e.preventDefault(),D(""))},[D]),H=n.useCallback(()=>{var e,t;br()?null==(e=p.current)||e.focus():null==(t=u.current)||t.focus()},[]);return r.jsxs(K,{children:[r.jsx(G,{title:"Terminal",icon:r.jsx(A,{})}),r.jsx(J,{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(X,{text:"5hell",minChars:7,size:24})}),r.jsx("div",{className:"keycap-well self-stretch flex flex-col",children:r.jsxs("div",{className:"indicator-key"+("connected"===x?" indicator-key--active":"degraded"===x?" 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("div",{className:"keycap-well keycap-well--rounded flex items-center gap-1",children:r.jsx($r,{})})]}),r.jsx(V,{noPadding:!0,className:"flex flex-col flex-1 min-h-0 overflow-hidden card-terminal",onClick:H,children:r.jsxs("div",{className:"card-terminal-well flex-1 min-h-0 flex flex-col overflow-hidden",children:[r.jsx("div",{className:"flex-1 min-h-0 terminal-gutter",children:r.jsx("div",{ref:l,className:"h-full w-full"})}),_.show&&_.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:_.options.map((e,t)=>{const n=t===_.selectedIndex,a=_.input.length;return r.jsxs("div",{"data-ac-index":t,onClick:()=>M(t),className:s("flex items-baseline gap-2 px-3 py-0.5 cursor-pointer transition-colors",n?"text-accent-primary":"text-text-primary"),style:{background:n?"var(--terminal-autocomplete-hover)":void 0},onMouseEnter:e=>{n||(e.currentTarget.style.background="var(--terminal-autocomplete-hover)")},onMouseLeave:e=>{n||(e.currentTarget.style.background="")},children:[r.jsx("span",{className:"w-3 shrink-0 text-center text-accent-primary opacity-80",children:n?"▸":""}),r.jsxs("span",{className:"min-w-0 truncate flex-1",children:[r.jsx("span",{className:"font-semibold text-accent-primary",children:e.cmd.substring(0,a)}),e.cmd.substring(a)]}),r.jsx("span",{className:"shrink-0 text-[11px] text-text-muted pl-3",children:e.desc})]},e.cmd)})}),r.jsxs("div",{className:"flex justify-between items-center px-3 py-0.5 text-[10px] text-text-muted",style:{borderTop:"1px solid var(--terminal-border)"},children:[r.jsx("span",{children:"Tab · ↑↓ · Esc"}),r.jsxs("span",{children:[_.options.length," match",1!==_.options.length?"es":""]})]})]}),r.jsx("input",{ref:p,type:"text",className:"sr-only",onChange:B,onKeyDown:P,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-[10px] text-text-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{xr as default}; diff --git a/frontend/dist/assets/TimeRangeSelector-B3Qt990z.js b/frontend/dist/assets/TimeRangeSelector-DOdtPPj_.js similarity index 90% rename from frontend/dist/assets/TimeRangeSelector-B3Qt990z.js rename to frontend/dist/assets/TimeRangeSelector-DOdtPPj_.js index bf9348e4..79f205bd 100644 --- a/frontend/dist/assets/TimeRangeSelector-B3Qt990z.js +++ b/frontend/dist/assets/TimeRangeSelector-DOdtPPj_.js @@ -1 +1 @@ -import{c as e,b1 as s}from"./index-CImKXCRQ.js";import{r as o,j as a,c as t}from"./vendor-react-j_fHog8x.js";import{A as r}from"./index-CGYcizrv.js";import{t as i}from"./config-CTM8_93T.js";const n=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"}]]),c=o.memo(function({value:e,format:t,prefix:n,suffix:c,className:m,priority:l="medium"}){const[f,u]=o.useState(!1),[d,p]=o.useState(e);o.useEffect(()=>s(()=>{u(!0),p(0)},l),[l]),o.useEffect(()=>{f&&p(e)},[f,e]);const g=`${n??""}${e.toLocaleString(void 0,t)}${c??""}`;return f?a.jsx(r,{className:`${m??""} overflow-hidden`,format:t,prefix:n,suffix:c,transition:i.numberTicker,children:d}):a.jsx("span",{className:m,children:g})}),m=o.memo(function({ranges:e,selectedIndex:s,onSelect:o,isPending:r,size:i="default"}){const n="sm"===i?"toggle-group-sm":"micro"===i?"toggle-group-micro":"";return a.jsx("div",{className:t("toggle-group flex-shrink-0 overflow-x-auto",n,r&&"opacity-70"),children:e.map((e,r)=>a.jsx("button",{onClick:()=>o(r),className:t("toggle-group-item",s===r&&"active"),children:e.label},e.label))})});export{c as A,n as E,m as T}; +import{c as e,b1 as s}from"./index-B51aMfiH.js";import{r as o,j as a,c as t}from"./vendor-react-j_fHog8x.js";import{A as r}from"./index-Ch_XDzqB.js";import{t as i}from"./config-CTM8_93T.js";const n=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"}]]),c=o.memo(function({value:e,format:t,prefix:n,suffix:c,className:m,priority:l="medium"}){const[f,u]=o.useState(!1),[d,p]=o.useState(e);o.useEffect(()=>s(()=>{u(!0),p(0)},l),[l]),o.useEffect(()=>{f&&p(e)},[f,e]);const g=`${n??""}${e.toLocaleString(void 0,t)}${c??""}`;return f?a.jsx(r,{className:`${m??""} overflow-hidden`,format:t,prefix:n,suffix:c,transition:i.numberTicker,children:d}):a.jsx("span",{className:m,children:g})}),m=o.memo(function({ranges:e,selectedIndex:s,onSelect:o,isPending:r,size:i="default"}){const n="sm"===i?"toggle-group-sm":"micro"===i?"toggle-group-micro":"";return a.jsx("div",{className:t("toggle-group flex-shrink-0 overflow-x-auto",n,r&&"opacity-70"),children:e.map((e,r)=>a.jsx("button",{onClick:()=>o(r),className:t("toggle-group-item",s===r&&"active"),children:e.label},e.label))})});export{c as A,n as E,m as T}; diff --git a/frontend/dist/assets/activity-3eg63twO.js b/frontend/dist/assets/activity-48nFba-7.js similarity index 72% rename from frontend/dist/assets/activity-3eg63twO.js rename to frontend/dist/assets/activity-48nFba-7.js index fb63d14f..3f7feccc 100644 --- a/frontend/dist/assets/activity-3eg63twO.js +++ b/frontend/dist/assets/activity-48nFba-7.js @@ -1 +1 @@ -import{c as a}from"./index-CImKXCRQ.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-B51aMfiH.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-CPFFRV-b.js b/frontend/dist/assets/arrow-up-By-lyY8m.js similarity index 75% rename from frontend/dist/assets/arrow-up-CPFFRV-b.js rename to frontend/dist/assets/arrow-up-By-lyY8m.js index 94fe639b..99409c7c 100644 --- a/frontend/dist/assets/arrow-up-CPFFRV-b.js +++ b/frontend/dist/assets/arrow-up-By-lyY8m.js @@ -1 +1 @@ -import{c as a}from"./index-CImKXCRQ.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-B51aMfiH.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/chevron-right-DZcqArkG.js b/frontend/dist/assets/chevron-right-DZcqArkG.js deleted file mode 100644 index 199fe6b6..00000000 --- a/frontend/dist/assets/chevron-right-DZcqArkG.js +++ /dev/null @@ -1 +0,0 @@ -import{c as t}from"./index-CImKXCRQ.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-DiVetJOJ.js b/frontend/dist/assets/chevron-right-DiVetJOJ.js new file mode 100644 index 00000000..57733c75 --- /dev/null +++ b/frontend/dist/assets/chevron-right-DiVetJOJ.js @@ -0,0 +1 @@ +import{c as t}from"./index-B51aMfiH.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-DK-UNKLb.js b/frontend/dist/assets/circle-check-DBemvAXd.js similarity index 62% rename from frontend/dist/assets/circle-check-DK-UNKLb.js rename to frontend/dist/assets/circle-check-DBemvAXd.js index 1d395bb7..12bb2b05 100644 --- a/frontend/dist/assets/circle-check-DK-UNKLb.js +++ b/frontend/dist/assets/circle-check-DBemvAXd.js @@ -1 +1 @@ -import{c}from"./index-CImKXCRQ.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-B51aMfiH.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-CfZtRqCt.js b/frontend/dist/assets/copy-jAVnwXtf.js similarity index 71% rename from frontend/dist/assets/copy-CfZtRqCt.js rename to frontend/dist/assets/copy-jAVnwXtf.js index a31684ec..b004cc4f 100644 --- a/frontend/dist/assets/copy-CfZtRqCt.js +++ b/frontend/dist/assets/copy-jAVnwXtf.js @@ -1 +1 @@ -import{c}from"./index-CImKXCRQ.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-B51aMfiH.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-1Jgt_gPe.js b/frontend/dist/assets/database-IcctMW15.js similarity index 73% rename from frontend/dist/assets/database-1Jgt_gPe.js rename to frontend/dist/assets/database-IcctMW15.js index b16d4ee6..62a4f62b 100644 --- a/frontend/dist/assets/database-1Jgt_gPe.js +++ b/frontend/dist/assets/database-IcctMW15.js @@ -1 +1 @@ -import{c as e}from"./index-CImKXCRQ.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-B51aMfiH.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-BgpNFdtT.js b/frontend/dist/assets/easing-xoQNL31J.js similarity index 81% rename from frontend/dist/assets/easing-BgpNFdtT.js rename to frontend/dist/assets/easing-xoQNL31J.js index 3f41c46b..29cce43c 100644 --- a/frontend/dist/assets/easing-BgpNFdtT.js +++ b/frontend/dist/assets/easing-xoQNL31J.js @@ -1 +1 @@ -import{c as a,cY as s}from"./index-CImKXCRQ.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,cY as s}from"./index-B51aMfiH.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-BR-9uKC6.js b/frontend/dist/assets/funnel-BWvj-vnP.js similarity index 74% rename from frontend/dist/assets/funnel-BR-9uKC6.js rename to frontend/dist/assets/funnel-BWvj-vnP.js index f4ab0436..69a28c4d 100644 --- a/frontend/dist/assets/funnel-BR-9uKC6.js +++ b/frontend/dist/assets/funnel-BWvj-vnP.js @@ -1 +1 @@ -import{c as a}from"./index-CImKXCRQ.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-B51aMfiH.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-qEuqoaud.js b/frontend/dist/assets/geo-utils-n2lfanuR.js similarity index 87% rename from frontend/dist/assets/geo-utils-qEuqoaud.js rename to frontend/dist/assets/geo-utils-n2lfanuR.js index 952ffd1a..453808f3 100644 --- a/frontend/dist/assets/geo-utils-qEuqoaud.js +++ b/frontend/dist/assets/geo-utils-n2lfanuR.js @@ -1 +1 @@ -import{c as t}from"./index-CImKXCRQ.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-B51aMfiH.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-CIWPjlTx.js b/frontend/dist/assets/git-branch-C_xw1lQX.js similarity index 76% rename from frontend/dist/assets/git-branch-CIWPjlTx.js rename to frontend/dist/assets/git-branch-C_xw1lQX.js index 635c8b9e..2682a041 100644 --- a/frontend/dist/assets/git-branch-CIWPjlTx.js +++ b/frontend/dist/assets/git-branch-C_xw1lQX.js @@ -1 +1 @@ -import{c}from"./index-CImKXCRQ.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-B51aMfiH.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-CImKXCRQ.js b/frontend/dist/assets/index-B51aMfiH.js similarity index 53% rename from frontend/dist/assets/index-CImKXCRQ.js rename to frontend/dist/assets/index-B51aMfiH.js index c0f74715..0e8dbcd2 100644 --- a/frontend/dist/assets/index-CImKXCRQ.js +++ b/frontend/dist/assets/index-B51aMfiH.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Login-CEaQVZyH.js","assets/vendor-react-j_fHog8x.js","assets/config-CTM8_93T.js","assets/vendor-core-CDNU4oKM.js","assets/maplibre-gl-B1CfjdFi.css","assets/Dashboard-D3Izm5d2.js","assets/PageLayout-CBx7rIBL.js","assets/link-scoring-B0M8cDnn.js","assets/TimeRangeSelector-B3Qt990z.js","assets/index-CGYcizrv.js","assets/PacketList-FKMq_1Wb.js","assets/payload-decoders-BbTIgSA8.js","assets/SignalIndicator-JkITXu3r.js","assets/signal-scoring-CcBiRcks.js","assets/arrow-up-CPFFRV-b.js","assets/copy-CfZtRqCt.js","assets/chevron-right-DZcqArkG.js","assets/map-pin-lRKxIpXD.js","assets/triangle-alert-DRA45BSe.js","assets/DataBox-BUgVf-3d.js","assets/layers-CTDI7uhn.js","assets/route-DJfT3Jo2.js","assets/activity-3eg63twO.js","assets/circle-check-DK-UNKLb.js","assets/database-1Jgt_gPe.js","assets/DelayedAnimateNumber-B6DSbUSU.js","assets/trending-up-BBUOgjQN.js","assets/LightSparkline-96Ro4wc3.js","assets/NodeInformationCard-DO5yOP6K.js","assets/Card-DfIcRbRE.js","assets/ChatBubble-jJzikYsj.js","assets/Grid-OFJ4oe0a.js","assets/Packets-CQBNFl_1.js","assets/users-BZZVk2mu.js","assets/funnel-BR-9uKC6.js","assets/Contacts-CATHuNF1.js","assets/ping-C1JzD5-V.js","assets/listbox-DnYSFKvT.js","assets/git-branch-CIWPjlTx.js","assets/target-BLCR6B60.js","assets/ConfirmModal-C50H21Nf.js","assets/CollisionExplorerModal-EDF-OEuX.js","assets/BasemapLayer-Dkb0XoZP.js","assets/network-CY6CQ8MF.js","assets/Statistics-Dyj9B1d4.js","assets/usePolling-B1kG3uqm.js","assets/easing-BgpNFdtT.js","assets/info-CBhRp85T.js","assets/settings-2-C32u1U6g.js","assets/MeshGraph-DCyLnsQa.js","assets/DeepAnalysisModal-C0GEcHVb.js","assets/geo-utils-qEuqoaud.js","assets/System-BYZJTRWn.js","assets/refresh-cw-DElcO6pC.js","assets/Logs-CX6fCEhO.js","assets/Terminal-DTrsKkeR.js","assets/xterm-Cq-DlOOL.js","assets/system-nunPUnlB.js","assets/KeycapButton-DjJYg-26.js","assets/xterm-6GBZ9nXN.css","assets/Configuration-Csaz7snm.js","assets/font-loader-BQzEmDrZ.js","assets/key-round-D-rRp0r8.js","assets/RoomServer-BBBzVK_B.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,W as f,t as y,Z as b,M as v,K as w,_ as C,e as x,f as k}from"./vendor-react-j_fHog8x.js";import{L as A,c as D,u as E,R as B,a as F,N as S,B as M}from"./vendor-core-CDNU4oKM.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 j={surfaces:{glass:{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:"#171717",surface:"#252525",elevated:"#333233",subtle:"#3F3F3F"},border:{subtle:"#4B4B4B",strong:"#616161"},text:{primary:"#E1E1E1",secondary:"#BFBFBF",muted:"#727272",inverse:"#171717"},accent:{primary:"#719CDF",secondary:"#DFBC72",tertiary:"#6FBCBD",success:"#719872",danger:"#E12672"},signal:{excellent:"#00FF00",good:"#8CE619",fair:"#FFD900",poor:"#FF8C26",critical:"#FF3333",unknown:"#616161"},status:{success:"#719872",warning:"#DFBC72",danger:"#E12672",info:"#6FBCBD",muted:"#616161"},chart:{c1:"#719CDF",c2:"#0074BE",c3:"#6FBCBD",c4:"#DFBC72",c5:"#719872",c6:"#E12672",c7:"#E17899",c8:"#999ABD",grid:"rgba(255, 255, 255, 0.06)",axis:"rgba(255, 255, 255, 0.4)",cursor:"rgba(255, 255, 255, 0.2)"},metric:{received:"#719872",forwarded:"#0074BE",transmitted:"#DFBC72",dropped:"#E12672"},map:{nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hub:"#8E4EC6",local:"#FFB224",neighbor:"#46A758",mobile:"#F76B15",room:"#D6409F",edge:"#4B4B4B",edgeHover:"#6FBCBD"}},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 T(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 P(){return"undefined"!=typeof window&&CSS.supports("color","color(display-p3 1 1 1)")}function R(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(r,s))}return n}function L(e){return{meta:e.meta,display:e.display,surfaces:e.surfaces?R(j.surfaces,e.surfaces):j.surfaces,colors:e.colors?R(j.colors,e.colors):j.colors,typography:e.typography?R(j.typography,e.typography):j.typography,spacing:e.spacing?R(j.spacing,e.spacing):j.spacing,motion:e.motion?R(j.motion,e.motion):j.motion}}function N(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"}function z(e){return{id:e.meta.id,colorScheme:{name:e.meta.name,dataTheme:e.meta.dataTheme,previewColor:e.meta.previewColor},background:{src:e.meta.backgroundImage,suggestedBrightness:e.meta.backgroundBrightness},display:{font:e.display.font,color:e.display.color,size:e.display.size,paletteColors:e.display.palette}}}const _="#fafafa",I="#a1a1aa",V="#71717a",O="#3f3f46",$="#27272a",q="#18181b",U="#09090b",W="#E5484D",H="#F76B15",Y="#FFB224",G="#46A758",K="#12A594",X="#00A2C7",J="#3B82F6",Z="#8E4EC6",Q="#D6409F",ee=L({meta:{id:"",name:"",dataTheme:"",previewColor:J,backgroundImage:"",backgroundBrightness:100,isDark:!0},display:{font:"Inter, sans-serif",color:I,size:1,palette:[[J,G,Y,H,W],[U,q,$,O,_]]},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:{glass:{tint:q,light:O,dark:U,reflexLight:0,reflexDark:0,blur:0,blurElevated:0,brightness:1,opacity:100,opacityElevated:100,catalystMode:!0},sidebar:{tint:`${$}80`},card:{radius:"0.5rem"},modal:{radius:"0.75rem"}},colors:{bg:{body:U,surface:q,elevated:$,subtle:$},border:{subtle:$,strong:"#52525b"},text:{primary:"#fff",secondary:I,muted:V,inverse:U},accent:{primary:J,secondary:Y,tertiary:X,success:G,danger:W},signal:{excellent:G,good:"#F5D90A",fair:Y,poor:H,critical:W,unknown:V},status:{success:G,warning:Y,danger:W,info:J,muted:V},chart:{c1:J,c2:K,c3:Y,c4:H,c5:Q,c6:Z,c7:X,c8:V,grid:`${_}0d`,axis:`${_}33`,cursor:`${J}33`},metric:{received:J,forwarded:K,transmitted:H,dropped:W},map:{nodeFill:J,nodeStroke:`${_}e6`,hub:Z,local:Y,neighbor:G,mobile:H,room:Q,edge:O,edgeHover:J}}}),te=ee;z(ee);const ne="#a1a1aa",ae="#71717a",se="#52525b",re="#18181b",oe="#E5484D",ie="#F76B15",le="#FFB224",ce="#46A758",ue="#12A594",de="#00A2C7",he="#3B82F6",me="#8E4EC6",pe="#D6409F",ge=L({meta:{id:"",name:"",dataTheme:"",previewColor:he,backgroundImage:"",backgroundColor:"#EFF0F1",backgroundBrightness:100,isDark:!1},display:{font:"Inter, sans-serif",color:se,size:1,palette:[[he,ce,le,ie,oe],["#EFF0F1","#FCFCFC","#DEE0E2",ae,re]]},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:{glass:{tint:"#FCFCFC",light:"#e4e4e7",dark:ne,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:re,secondary:se,muted:ae,inverse:"#FFFFFF"},accent:{primary:he,secondary:le,tertiary:de,success:ce,danger:oe},signal:{excellent:ce,good:"#F5D90A",fair:le,poor:ie,critical:oe,unknown:ne},status:{success:ce,warning:le,danger:oe,info:he,muted:ne},chart:{c1:he,c2:ue,c3:le,c4:ie,c5:pe,c6:me,c7:de,c8:ne,grid:`${re}0d`,axis:`${re}80`,cursor:`${he}1a`},metric:{received:he,forwarded:ue,transmitted:ie,dropped:oe},map:{nodeFill:he,nodeStroke:"rgba(255,255,255,0.9)",hub:me,local:le,neighbor:ce,mobile:ie,room:pe,edge:ne,edgeHover:he},sidebar:{bg:"rgba(0, 0, 0, 0.02)",navHoverBg:"rgba(0, 0, 0, 0.04)",navActiveBg:"rgba(59, 130, 246, 0.10)",navActiveText:he}}}),fe=ge;z(ge);const ye={"Breeze Dark":te,"Breeze Light":fe};function be(e,t){const n=e.toLowerCase();return{...t,meta:{...t.meta,id:n,name:e,dataTheme:n}}}const ve=Object.fromEntries(Object.entries(ye).map(([e,t])=>[e,be(e,t)])),we=Object.fromEntries(Object.entries(ve).map(([e,t])=>[e,z(t)])),Ce=Object.values(ve);function xe(e){return Ce.find(t=>t.meta.id===e)}new Map(Object.entries(ve));const ke=Object.values(we);new Map(Object.entries(we));const Ae=Object.entries(we).map(([e,t])=>function(e,t){return{id:e.id,name:e.colorScheme.name,displayName:t,colorScheme:e.id,backgroundImage:e.background.src,paletteColors:e.display.paletteColors,displayFont:e.display.font,displayColor:e.display.color,displaySize:e.display.size}}(t,e)),De=ke.map(function(e){return{id:e.id,name:e.colorScheme.name,dataTheme:e.colorScheme.dataTheme,previewColor:e.colorScheme.previewColor}}),Ee=ke.map(function(e){return{id:e.id,src:e.background.src,suggestedScheme:e.id,suggestedBrightness:e.background.suggestedBrightness}}),Be=ve["Breeze Dark"];we["Breeze Dark"];const Fe=Be.meta.id,Se=Be.meta.backgroundImage,Me=Be.meta.backgroundBrightness,je=De,Te=Ee,Pe=Ae,Re={colorScheme:Fe,backgroundImage:Se,brightness:Me},Le="pymc-color-scheme",Ne="pymc-background-image",ze="pymc-bg-brightness",_e="pymc-background",Ie={50:.97,100:.92,200:.84,300:.73,400:.62,500:.5,600:.4,700:.32,800:.24,900:.16},Ve=[50,100,200,300,400,500,600,700,800,900],Oe=["red","orange","yellow","green","aqua","blue","purple"];function $e(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 qe(e){const t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ue(e){const t=e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055;return Math.round(255*t)}function We(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[Ue(4.0767416621*c-3.3077115913*u+.2309699292*d),Ue(h),Ue(m)]}function He(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=qe(e),s=qe(t),r=qe(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 Ve){const e=Ie[i],t=s*(1-.3*Math.abs(e-.5)),[n,a,l]=We(e,t,r);o[i]=$e(n,a,l)}return o}function Ye(e){return"undefined"==typeof window?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function Ge(e,t){"undefined"!=typeof document&&document.documentElement.style.setProperty(e,t)}const Ke="u-off",Xe="u-label",Je="width",Ze="height",Qe="top",et="bottom",tt="left",nt="right",at="#000",st=at+"0",rt="mousemove",ot="mousedown",it="mouseup",lt="mouseenter",ct="mouseleave",ut="dblclick",dt="change",ht="dppxchange",mt="--",pt="undefined"!=typeof window,gt=pt?document:null,ft=pt?window:null,yt=pt?navigator:null;let bt,vt;function wt(e,t){if(null!=t){let n=e.classList;!n.contains(t)&&n.add(t)}}function Ct(e,t){let n=e.classList;n.contains(t)&&n.remove(t)}function xt(e,t,n){e.style[t]=n+"px"}function kt(e,t,n,a){let s=gt.createElement(e);return null!=t&&wt(s,t),null!=n&&n.insertBefore(s,a),s}function At(e,t){return kt("div",e,t)}const Dt=new WeakMap;function Et(e,t,n,a,s){let r="translate("+t+"px,"+n+"px)";r!=Dt.get(e)&&(e.style.transform=r,Dt.set(e,r),t<0||n<0||t>a||n>s?wt(e,Ke):Ct(e,Ke))}const Bt=new WeakMap;function Ft(e,t,n){let a=t+n;a!=Bt.get(e)&&(Bt.set(e,a),e.style.background=t,e.style.borderColor=n)}const St=new WeakMap;function Mt(e,t,n,a){let s=t+""+n;s!=St.get(e)&&(St.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 jt={passive:!0},Tt={...jt,capture:!0};function Pt(e,t,n,a){t.addEventListener(e,n,a?Tt:jt)}function Rt(e,t,n,a){t.removeEventListener(e,n,jt)}function Lt(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:en((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]}}pt&&function e(){let t=devicePixelRatio;bt!=t&&(bt=t,vt&&Rt(dt,vt,e),vt=matchMedia(`(min-resolution: ${bt-.001}dppx) and (max-resolution: ${bt+.001}dppx)`),Pt(dt,vt,e),ft.dispatchEvent(new CustomEvent(ht)))}();const zt=e=>null!=e,_t=e=>null!=e&&e>0,It=Nt(zt),Vt=Nt(_t);function Ot(e,t,n,a){let s=on(e),r=on(t);e==t&&(-1==s?(e*=n,t/=n):(e/=n,t*=n));let o=10==n?ln:cn,i=1==r?nn:en,l=(1==s?en:nn)(o(Qt(e))),c=i(o(Qt(t))),u=rn(n,l),d=rn(n,c);return 10==n&&(l<0&&(u=En(u,-l)),c<0&&(d=En(d,-c))),a||2==n?(e=u*s,t=d*r):(e=Dn(e,u),t=An(t,d)),[e,t]}function $t(e,t,n,a){let s=Ot(e,t,n,a);return 0==e&&(s[0]=0),0==t&&(s[1]=0),s}const qt={mode:3,pad:.1},Ut={pad:0,soft:null,mode:0},Wt={min:Ut,max:Ut};function Ht(e,t,n,a){return Nn(n)?Gt(e,t,n):(Ut.pad=n,Ut.soft=a?0:null,Ut.mode=a?3:0,Gt(e,t,Wt))}function Yt(e,t){return null==e?t:e}function Gt(e,t,n){let a=n.min,s=n.max,r=Yt(a.pad,0),o=Yt(s.pad,0),i=Yt(a.hard,-dn),l=Yt(s.hard,dn),c=Yt(a.soft,dn),u=Yt(s.soft,-dn),d=Yt(a.mode,0),h=Yt(s.mode,0),m=t-e,p=ln(m),g=sn(Qt(e),Qt(t)),f=ln(g),y=Qt(f-p);(m<1e-24||y>10)&&(m=0,0!=e&&0!=t||(m=1e-24,2==d&&c!=dn&&(r=0),2==h&&u!=-dn&&(o=0)));let b=m||g||1e3,v=ln(b),w=rn(10,en(v)),C=En(Dn(e-b*(0==m?0==e?.1:1:r),w/10),24),x=e>=c&&(1==d||3==d&&C<=c||2==d&&C>=c)?c:dn,k=sn(i,C=x?x:an(x,C)),A=En(An(t+b*(0==m?0==t?.1:1:o),w/10),24),D=t<=u&&(1==h||3==h&&A>=u||2==h&&A<=u)?u:-dn,E=an(l,A>D&&t<=D?D:sn(D,A));return k==E&&0==k&&(E=100),[k,E]}const Kt=new Intl.NumberFormat(pt?yt.language:"en-US"),Xt=e=>Kt.format(e),Jt=Math,Zt=Jt.PI,Qt=Jt.abs,en=Jt.floor,tn=Jt.round,nn=Jt.ceil,an=Jt.min,sn=Jt.max,rn=Jt.pow,on=Jt.sign,ln=Jt.log10,cn=Jt.log2,un=(e,t=1)=>Jt.asinh(e/t),dn=1/0;function hn(e){return 1+(0|ln((e^e>>31)-(e>>31)))}function mn(e,t,n){return an(sn(e,t),n)}function pn(e){return"function"==typeof e}function gn(e){return pn(e)?e:()=>e}const fn=e=>e,yn=(e,t)=>t,bn=e=>null,vn=e=>!0,wn=(e,t)=>e==t,Cn=/\.\d*?(?=9{6,}|0{6,})/gm,xn=e=>{if(Rn(e)||Bn.has(e))return e;const t=`${e}`,n=t.match(Cn);if(null==n)return e;let a=n[0].length-1;if(-1!=t.indexOf("e-")){let[e,n]=t.split("e");return+`${xn(e)}e${n}`}return En(e,a)};function kn(e,t){return xn(En(xn(e/t))*t)}function An(e,t){return xn(nn(xn(e/t))*t)}function Dn(e,t){return xn(en(xn(e/t))*t)}function En(e,t=0){if(Rn(e))return e;let n=10**t,a=e*n*(1+Number.EPSILON);return tn(a)/n}const Bn=new Map;function Fn(e){return((""+e).split(".")[1]||"").length}function Sn(e,t,n,a){let s=[],r=a.map(Fn);for(let o=t;o=0?0:t)+(o>=r[i]?0:r[i]),u=10==e?l:En(l,c);s.push(u),Bn.set(u,c)}}return s}const Mn={},jn=[],Tn=[null,null],Pn=Array.isArray,Rn=Number.isInteger;function Ln(e){return"string"==typeof e}function Nn(e){let t=!1;if(null!=e){let n=e.constructor;t=null==n||n==Object}return t}function zn(e){return null!=e&&"object"==typeof e}const _n=Object.getPrototypeOf(Uint8Array),In="__proto__";function Vn(e,t=Nn){let n;if(Pn(e)){let a=e.find(e=>null!=e);if(Pn(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,Un=["January","February","March","April","May","June","July","August","September","October","November","December"],Wn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Hn(e){return e.slice(0,3)}const Yn=Wn.map(Hn),Gn=Un.map(Hn),Kn={MMMM:Un,MMM:Gn,WWWW:Wn,WWW:Yn};function Xn(e){return(e<10?"0":"")+e}const Jn={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=>Xn(e.getMonth()+1),M:e=>e.getMonth()+1,DD:e=>Xn(e.getDate()),D:e=>e.getDate(),WWWW:(e,t)=>t.WWWW[e.getDay()],WWW:(e,t)=>t.WWW[e.getDay()],HH:e=>Xn(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=>Xn(e.getMinutes()),m:e=>e.getMinutes(),ss:e=>Xn(e.getSeconds()),s:e=>e.getSeconds(),fff:e=>{return((t=e.getMilliseconds())<10?"00":t<100?"0":"")+t;var t}};function Zn(e,t){t=t||Kn;let n,a=[],s=/\{([a-z]+)\}|[^{]+/gi;for(;n=s.exec(e);)a.push("{"==n[0][0]?Jn[n[1]]:n[0]);return e=>{let n="";for(let s=0;se%1==0,ta=[1,2,2.5,5],na=Sn(10,-32,0,ta),aa=Sn(10,0,32,ta),sa=aa.filter(ea),ra=na.concat(aa),oa="{YYYY}",ia="\n"+oa,la="{M}/{D}",ca="\n"+la,ua=ca+"/{YY}",da="{aa}",ha="{h}:{mm}"+da,ma="\n"+ha,pa=":{ss}",ga=null;function fa(e){let t=1e3*e,n=60*t,a=60*n,s=24*a,r=30*s,o=365*s;return[(1==e?Sn(10,0,3,ta).filter(ea):Sn(10,-3,0,ta)).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,oa,ga,ga,ga,ga,ga,ga,1],[28*s,"{MMM}",ia,ga,ga,ga,ga,ga,1],[s,la,ia,ga,ga,ga,ga,ga,1],[a,"{h}"+da,ua,ga,ca,ga,ga,ga,1],[n,ha,ua,ga,ca,ga,ga,ga,1],[t,pa,ua+" "+ha,ga,ca+" "+ha,ga,ma,ga,1],[e,pa+".{fff}",ua+" "+ha,ga,ca+" "+ha,ga,ma,ga,1]],function(t){return(i,l,c,u,d,h)=>{let m=[],p=d>=o,g=d>=r&&d=s?s:d,o=v+(en(c)-en(y))+An(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=En(o+d,1==e?0:3),!(o>u);)if(f>1){let e=en(En(g+f,6))%24,n=t(o).getHours()-e;n>1&&(n=-1),o-=n*a,g=(g+f)%24,En((o-m[m.length-1])/d,3)*b>=.7&&m.push(o)}else m.push(o)}return m}}]}const[ya,ba,va]=fa(1),[wa,Ca,xa]=fa(.001);function ka(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 Aa(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 Da(e,t,n){return new Date(e,t,n)}function Ea(e,t){return t(e)}function Ba(e,t){return(n,a,s,r)=>null==r?mt:t(e(a))}Sn(2,-53,53,[1]);const Fa={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:[]},Sa=[0,0];function Ma(e,t,n,a=!0){return e=>{0==e.button&&(!a||e.target==t)&&n(e)}}function ja(e,t,n,a=!0){return e=>{(!a||e.target==t)&&n(e)}}const Ta={show:!0,x:!0,y:!0,lock:!1,move:function(e,t,n){return Sa[0]=t,Sa[1]=n,Sa},points:{one:!1,show:function(e,t){let n=e.cursor.points,a=At(),s=n.size(e,t);xt(a,Je,s),xt(a,Ze,s);let r=s/-2;xt(a,"marginLeft",r),xt(a,"marginTop",r);let o=n.width(e,t,s);return o&&xt(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:Ma,mouseup:Ma,click:Ma,dblclick:Ma,mousemove:ja,mouseleave:ja,mouseenter:ja},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},Pa={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Ra=On({},Pa,{filter:yn}),La=On({},Ra,{size:10}),Na=On({},Pa,{show:!1}),za='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"',_a="bold "+za,Ia={show:!0,scale:"x",stroke:at,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:_a,side:2,grid:Ra,ticks:La,border:Na,font:za,lineGap:1.5,rotate:0},Va={show:!0,scale:"x",auto:!1,sorted:1,min:dn,max:-dn,idxs:[]};function Oa(e,t,n,a,s){return t.map(e=>null==e?"":Xt(e))}function $a(e,t,n,a,s,r,o){let i=[],l=Bn.get(s)||0;for(let c=n=o?n:En(An(n,s),l);c<=a;c=En(c+s,l))i.push(Object.is(c,-0)?0:c);return i}function qa(e,t,n,a,s,r,o){const i=[],l=e.scales[e.axes[t].scale].log,c=en((10==l?ln:cn)(n));s=rn(l,c),10==l&&(s=ra[Lt(s,ra)]);let u=n,d=s*l;10==l&&(d=ra[Lt(d,ra)]);do{i.push(u),u+=s,10!=l||Bn.has(u)||(u=En(u,Bn.get(s))),u>=d&&(d=(s=u)*l,10==l&&(d=ra[Lt(d,ra)]))}while(u<=a);return i}function Ua(e,t,n,a,s,r,o){let i=e.scales[e.axes[t].scale].asinh,l=a>i?qa(e,t,sn(i,n),a,s):[i],c=a>=0&&n<=0?[0]:[];return(n<-i?qa(e,t,sn(i,-a),-n,s):[i]).reverse().map(e=>-e).concat(c,l)}const Wa=/./,Ha=/[12357]/,Ya=/[125]/,Ga=/1/,Ka=(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 Xa(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?Wa:l(7,o)-u>=c?Ha:l(5,o)-u>=c?Ya:Ga;if(d==Ga){let e=Qt(l(1,o)-u);if(es,ns={show:!0,auto:!0,sorted:0,gaps:ts,alpha:1,facets:[On({},es,{scale:"x"}),On({},es,{scale:"y"})]},as={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:ts,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=Qt(o-r)/(e.series[t].points.space*bt);return a[1]-a[0]<=i},filter:null},values:null,min:dn,max:-dn,idxs:[],path:null,clip:null};function ss(e,t,n,a,s){return n/10}const rs={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},os=On({},rs,{time:!1,ori:1}),is={};function ls(e,t){let n=is[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?vs:ws;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)),x=g(c(t[v],i,m,d)),k=g(u(1==r?l.max:l.min,l,p,h)),A=new Path2D(s);return y(A,x,k),y(A,w,k),y(A,w,C),A})}function ms(e,t,n,a,s,r){let o=null;if(e.length>0){o=new Path2D;const i=0==t?Cs:xs;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 ps(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 gs(e){return 0==e?fn:1==e?tn:t=>kn(t,e)}function fs(e){let t=0==e?ys:bs,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=an(l,o/2,i/2),c=an(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 ys=(e,t,n)=>{e.moveTo(t,n)},bs=(e,t,n)=>{e.moveTo(n,t)},vs=(e,t,n)=>{e.lineTo(t,n)},ws=(e,t,n)=>{e.lineTo(n,t)},Cs=fs(0),xs=fs(1),ks=(e,t,n,a,s,r)=>{e.arc(t,n,a,s,r)},As=(e,t,n,a,s,r)=>{e.arc(n,t,a,s,r)},Ds=(e,t,n,a,s,r,o)=>{e.bezierCurveTo(t,n,a,s,r,o)},Es=(e,t,n,a,s,r,o)=>{e.bezierCurveTo(n,t,s,a,o,r)};function Bs(e){return(e,t,n,a,s)=>cs(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=ys,f=ks):(g=bs,f=As);const v=En(b.width*bt,3);let w=(b.size-b.width)/2*bt,C=En(2*w,3),x=new Path2D,k=new Path2D,{left:A,top:D,width:E,height:B}=e.bbox;Cs(k,A-C,D-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(x,t+w,n),f(x,t,n,w,0,2*Zt)}};if(s)s.forEach(F);else for(let e=n;e<=a;e++)F(e);return{stroke:v>0?x:null,fill:x,clip:k,flags:3}})}function Fs(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 Ss=Fs(vs),Ms=Fs(ws);function js(e){const t=Yt(null==e?void 0:e.alignGaps,0);return(e,n,a,s)=>cs(e,n,(r,o,i,l,c,u,d,h,m,p,g)=>{[a,s]=It(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=vs,y=Ss):(f=ws,y=Ms);const C=l.dir*(0==l.ori?1:-1),x={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},k=x.stroke;let A=!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(k,s,w(n)),t=u=d=n):nd&&(d=n)):null===r&&(A=!0):(null!=u&&y(k,h,w(u),w(d),w(t),w(n)),null!=r?(n=r,f(k,s,w(n)),u=d=t=n):(u=d=null,null===r&&(A=!0)),h=s,g=c(h+C))}null!=u&&u!=d&&r!=h&&y(k,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?A=!0:null!=t&&f(k,v(o[e]),w(t))}let[D,E]=us(e,n);if(null!=r.fill||0!=D){let t=x.fill=new Path2D(k),i=w(r.fillTo(e,n,r.min,r.max,D)),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=[];A&&c.push(...ps(o,i,a,s,C,v,t)),x.gaps=c=r.gaps(e,n,a,s,c),x.clip=ms(c,l.ori,h,m,p,g)}return 0!=E&&(x.band=2==E?[hs(e,n,a,s,k,-1),hs(e,n,a,s,k,1)]:hs(e,n,a,s,k,E)),x})}function Ts(e,t,n,a,s,r,o=dn){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{Ks.pxRatio=bt}));const Ns=js(),zs=Bs();function _s(e,t,n,a){return(a?[e[0],e[1]].concat(e.slice(2)):[e[0]].concat(e.slice(1))).map((e,a)=>Is(e,a,t,n))}function Is(e,t,n,a){return On({},0==t?n:a,e)}function Vs(e,t,n){return null==t?Tn:[t,n]}const Os=Vs;function $s(e,t,n){return null==t?Tn:Ht(t,n,.1,!0)}function qs(e,t,n,a){return null==t?Tn:Ot(t,n,e.scales[a].log,!1)}const Us=qs;function Ws(e,t,n,a){return null==t?Tn:$t(t,n,e.scales[a].log,!1)}const Hs=Ws;function Ys(e){let t,n;return[e=e.replace(/(\d+)px/,(e,a)=>(t=tn((n=+a)*bt))+"px"),t,n]}function Gs(e){e.show&&[e.font,e.labelFont].forEach(e=>{let t=En(e[2]*bt,1);e[0]=e[0].replace(/[0-9.]+px/,t+"px"),e[1]=t})}function Ks(e,t,n){const a={mode:Yt(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=At("uplot");null!=e.id&&(c.id=e.id),wt(c,e.class),e.title&&(At("u-title",c).textContent=e.title);const u=kt("canvas"),d=a.ctx=u.getContext("2d"),h=At("u-wrap",c);Pt("click",h,e=>{e.target===p&&(Xn!=Hn||Jn!=Yn)&&ca.click(a,e)},!0);const m=a.under=At("u-under",h);h.appendChild(u);const p=a.over=At("u-over",h),g=+Yt((e=Vn(e)).pxAlign,1),f=gs(g);(e.plugins||[]).forEach(t=>{t.opts&&(e=t.opts(a,e)||e)});const y=e.ms||.001,b=a.series=1==s?_s(e.series||[],Va,as,!1):(v=e.series||[null],w=ns,v.map((e,t)=>0==t?{}:On({},w,e)));var v,w;const C=a.axes=_s(e.axes||[],Ia,Qa,!0),x=a.scales={},k=a.bands=e.bands||[];k.forEach(e=>{e.fill=gn(e.fill||null),e.dir=Yt(e.dir,-1)});const A=2==s?b[1].facets[0].scale:b[0].scale,D={axes:function(){for(let e=0;eSt[e]):y,v=2==m.distr?St[y[1]]-St[y[0]]:u,w=t.ticks,k=t.border,A=w.show?w.size:0,D=tn(A*bt),E=tn((2==t.alignTo?t._size-A-t.gap:t.gap)*bt),B=t._rotate*-Zt/180,F=f(t._pos*bt),S=F+(D+E)*c;s=0==o?S:0,n=1==o?S:0,Wt(t.font[0],l,1==t.align?tt:2==t.align?nt:B>0?tt:B<0?nt:0==o?"center":3==r?nt:tt,B||1==o?"middle":2==r?Qe:et);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)&&Bt!=Me.alpha;e&&(d.globalAlpha=Bt=Me.alpha),b.forEach((e,n)=>{if(n>0&&e.show&&(Xt(n,!1),Xt(n,!0),null==e._paths)){let r=Bt;Bt!=e.alpha&&(d.globalAlpha=Bt=e.alpha);let o=2==s?[0,t[n][0].length-1]:function(e){let t=mn(qe-1,0,$e-1),n=mn(Ue+1,0,$e-1);for(;null==e[t]&&t>0;)t--;for(;null==e[n]&&n<$e-1;)n++;return[t,n]}(t[n]);e._paths=e.paths(a,n,o[0],o[1]),Bt!=r&&(d.globalAlpha=Bt=r)}}),b.forEach((e,t)=>{if(t>0&&e.show){let n=Bt;Bt!=e.alpha&&(d.globalAlpha=Bt=e.alpha),null!=e._paths&&en(t,!1);{let n=null!=e._paths?e._paths.gaps:null,s=e.points.show(a,t,qe,Ue,n),r=e.points.filter(a,t,s,n);(s||r)&&(e.points._paths=e.points.paths(a,t,qe,Ue,r),en(t,!0))}Bt!=n&&(d.globalAlpha=Bt=n),Cs("drawSeries",t)}}),e&&(d.globalAlpha=Bt=1)}}},E=(e.drawOrder||["axes","series"]).map(e=>D[e]);function B(e){const t=3==e.distr?t=>ln(t>0?t:e.clamp(a,t,e.min,e.max,e.key)):4==e.distr?t=>un(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=x[t];if(null==n){let a=(e.scales||Mn)[t]||Mn;if(null!=a.from){F(a.from);let e=On({},x[a.from],a,{key:t});e.valToPct=B(e),x[t]=e}else{n=x[t]=On({},t==A?rs:os,a),n.key=t;let e=n.time,r=n.range,o=Pn(r);if((t!=A||2==s&&!e)&&(!o||null!=r[0]&&null!=r[1]||(r={min:null==r[0]?qt:{mode:1,hard:r[0],soft:r[0]},max:null==r[1]?qt:{mode:1,hard:r[1],soft:r[1]}},o=!1),!o&&Nn(r))){let e=r;r=(t,n,a)=>null==n?Tn:Ht(n,a,e)}n.range=gn(r||(e?Os:t==A?3==n.distr?Us:4==n.distr?Hs:Vs:3==n.distr?qs:4==n.distr?Ws:$s)),n.auto=gn(!o&&n.auto),n.clamp=gn(n.clamp||ss),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 Ke in e.scales)F(Ke);const S=x[A],M=S.distr;let j,T;0==S.ori?(wt(c,"u-hz"),j=r,T=o):(wt(c,"u-vt"),j=o,T=r);const P={};for(let Ke in x){let e=x[Ke];null==e.min&&null==e.max||(P[Ke]={min:e.min,max:e.max},e.min=e.max=null)}const R=e.tzDate||(e=>new Date(tn(e/y))),L=e.fmtDate||Zn,N=1==y?va(R):xa(R),z=Aa(R,ka(1==y?ba:Ca,L)),_=Ba(R,Ea("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",L)),I=[],V=a.legend=On({},Fa,e.legend),O=a.cursor=On({},Ta,{drag:{y:2==s}},e.cursor),$=V.show,q=O.show,U=V.markers;let W,H,Y;V.idxs=I,U.width=gn(U.width),U.dash=gn(U.dash),U.stroke=gn(U.stroke),U.fill=gn(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]=mt}if($)if(W=kt("table","u-legend",c),Y=kt("tbody",null,W),V.mount(a,W),J){H=kt("thead",null,W,Y);let e=kt("tr",null,H);for(var Q in kt("th",null,e),G)kt("th",Xe,e).textContent=Q}else wt(W,"u-inline"),V.live&&wt(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&&(Pt(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||(Rt(s,t,a[s]),delete a[s]);null==e&&ne.delete(t)}let re=0,oe=0,ie=0,le=0,ce=0,ue=0,de=ce,he=ue,me=ie,pe=le,ge=0,fe=0,ye=0,be=0;a.bbox={};let ve=!1,we=!1,Ce=!1,xe=!1,ke=!1,Ae=!1;function De(e,t,n){(n||e!=a.width||t!=a.height)&&Ee(e,t),Sn(!1),Ce=!0,we=!0,aa()}function Ee(e,t){a.width=re=ie=e,a.height=oe=le=t,ce=ue=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?(ue+=l,e=!0):t=!0))}}),_e[0]=e,_e[1]=n,_e[2]=t,_e[3]=a,ie-=Oe[1]+Oe[3],ce+=Oe[3],le-=Oe[2]+Oe[0],ue+=Oe[0]}(),function(){let e=ce+ie,t=ue+le,n=ce,a=ue;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;ge=n.left=kn(ce*bt,.5),fe=n.top=kn(ue*bt,.5),ye=n.width=kn(ie*bt,.5),be=n.height=kn(le*bt,.5)}const Be=3;if(a.setSize=function({width:e,height:t}){De(e,t)},null==O.dataIdx){let e=O.hover,n=e.skip=new Set(e.skip??[]);n.add(void 0);let a=e.prox=gn(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)??dn,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 Fe=e=>{O.event=e};O.idxs=I,O._lock=!1;let Se=O.points;Se.show=gn(Se.show),Se.size=gn(Se.size),Se.stroke=gn(Se.stroke),Se.width=gn(Se.width),Se.fill=gn(Se.fill);const Me=a.focus=On({},e.focus||{alpha:.3},O.focus),je=Me.prox>=0,Te=je&&Se.one;let Pe=[],Re=[],Le=[];function Ne(e,t){let n=Se.show(a,t);if(n instanceof HTMLElement)return wt(n,"u-cursor-pt"),wt(n,e.class),Et(n,-10,-10,ie,le),p.insertBefore(n,Pe[t]),n}function ze(e,t){if(1==s||t>0){let t=1==s&&x[e.scale].time,n=e.value;e.value=t?Ln(n)?Ba(R,Ea(n,L)):n||_:n||Za,e.label=e.label||(t?"Time":"Value")}if(Te||t>0){e.width=null==e.width?1:e.width,e.paths=e.paths||Ns||bn,e.fillTo=gn(e.fillTo||ds),e.pxAlign=+Yt(e.pxAlign,g),e.pxRound=gs(e.pxAlign),e.stroke=gn(e.stroke||null),e.fill=gn(e.fill||null),e._stroke=e._fill=e._paths=e._focus=null;let t=En(1*(3+2*(sn(1,e.width)||1)),3),n=e.points=On({},{size:t,width:sn(1,.2*t),stroke:e.stroke,space:2*t,paths:zs,_stroke:null,_fill:null},e.points);n.show=gn(n.show),n.filter=gn(n.filter),n.fill=gn(n.fill),n.stroke=gn(n.stroke),n.paths=gn(n.paths),n.pxAlign=e.pxAlign}if($){let n=function(e,t){if(0==t&&(J||!V.live||2==s))return Tn;let n=[],r=kt("tr","u-series",Y,Y.childNodes[t]);wt(r,e.class),e.show||wt(r,Ke);let o=kt("th",null,r);if(U.show){let e=At("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=At(Xe,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;Fe(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&&fa(a,e?a==n?ee:te:ee,!0,ks.setSeries)})}else fa(n,{show:!e.show},!0,ks.setSeries)},!1),je&&ae(lt,o,t=>{O._lock||(Fe(t),fa(b.indexOf(e),ja,!0,ks.setSeries))},!1)),G){let e=kt("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;Te?0==t&&(n=Ne(e,t)):t>0&&(n=Ne(e,t)),Pe.splice(t,0,n),Re.splice(t,0,0),Le.splice(t,0,0)}Cs("addSeries",t)}a.addSeries=function(e,t){t=null==t?b.length:t,e=1==s?Is(e,t,Va,as):Is(e,t,{},ns),b.splice(t,0,e),ze(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),Pe.splice(e,1)[0].remove(),Re.splice(e,1),Le.splice(e,1)),Cs("delSeries",e)};const _e=[!1,!1,!1,!1];function Ie(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?tn(Ia.size/3):0),1==l&&(s||o)&&(c=1==t&&!r||3==t&&!i?tn(Qa.size/2):0),c}const Ve=a.padding=(e.padding||[Ie,Ie,Ie,Ie]).map(e=>gn(Yt(e,Ie))),Oe=a._padding=Ve.map((e,t)=>e(a,t,_e,0));let $e,qe=null,Ue=null;const We=1==s?b[0].idxs:null;let He,Ye,Ge,at,dt,pt,yt,vt,Dt,Bt,St=null,jt=!1;function Tt(e,n){if(t=null==e?[]:e,a.data=a._data=t,2==s){$e=0;for(let e=1;e=0,Ae=!0,aa()}}function Nt(){let e,n;jt=!0,1==s&&($e>0?(qe=We[0]=0,Ue=We[1]=$e-1,e=t[0][qe],n=t[0][Ue],2==M?(e=qe,n=Ue):e==n&&(3==M?[e,n]=Ot(e,e,S.log,!1):4==M?[e,n]=$t(e,e,S.log,!1):S.time?n=e+tn(86400/y):[e,n]=Ht(e,n,.1,!0))):(qe=We[0]=e=null,Ue=We[1]=n=null)),ga(A,e,n)}function Ut(e,t,n,a,s,r){e??(e=st),n??(n=jn),a??(a="butt"),s??(s=st),r??(r="round"),e!=He&&(d.strokeStyle=He=e),s!=Ye&&(d.fillStyle=Ye=s),t!=Ge&&(d.lineWidth=Ge=t),r!=dt&&(d.lineJoin=dt=r),a!=pt&&(d.lineCap=pt=a),n!=at&&d.setLineDash(at=n)}function Wt(e,t,n,a){t!=Ye&&(d.fillStyle=Ye=t),e!=yt&&(d.font=yt=e),n!=vt&&(d.textAlign=vt=n),a!=Dt&&(d.textBaseline=Dt=a)}function Gt(e,t,n,s,r=0){if(s.length>0&&e.auto(a,jt)&&(null==t||null==t.min)){let t=Yt(qe,0),a=Yt(Ue,s.length-1),o=null==n.min?function(e,t,n,a=0,s=!1){let r=s?Vt:It,o=s?_t:zt;[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??dn,l??-dn]}(s,t,a,r,3==e.distr):[n.min,n.max];e.min=an(e.min,n.min=o[0]),e.max=sn(e.max,n.max=o[1])}}a.setData=Tt;const Kt={min:null,max:null};function Xt(e,t){let n=t?b[e].points:b[e];n._stroke=n.stroke(a,e),n._fill=n.fill(a,e)}function en(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=En(h*bt,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=ge-h/2,t=fe-h/2,n=ye+h,a=be+h;m=new Path2D,m.rect(e,t,n,a)}n?cn(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&&k.forEach((p,g)=>{if(p.series[0]==e){let e,f=b[p.series[1]],y=t[p.series[1]],v=(f._paths||Mn).band;Pn(v)&&(v=1==p.dir?v[0]:v[1]);let w=null;f.show&&v&&function(e,t,n){for(t=Yt(t,0),n=Yt(n,e.length-1);t<=n;){if(null!=e[t])return!0;t++}return!1}(y,qe,Ue)?(w=p.fill(a,g)||i,e=f._paths.clip):v=null,cn(n,s,r,o,w,l,c,u,d,h,e,v),m=!0}}),m||cn(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 on=3;function cn(e,t,n,a,s,r,o,i,l,c,u,h){Ut(e,t,n,a,s),(l||c||h)&&(d.save(),l&&d.clip(l),c&&d.clip(c)),h?(i&on)==on?(d.clip(h),u&&d.clip(u),Cn(s,o),fn(e,r,t)):2&i?(Cn(s,o),d.clip(h),fn(e,r,t)):1&i&&(d.save(),d.clip(h),u&&d.clip(u),Cn(s,o),d.restore(),fn(e,r,t)):(Cn(s,o),fn(e,r,t)),(l||c||h)&&d.restore()}function fn(e,t,n){n>0&&(t instanceof Map?t.forEach((e,t)=>{d.strokeStyle=He=t,d.stroke(e)}):null!=t&&e&&d.stroke(t))}function Cn(e,t){t instanceof Map?t.forEach((e,t)=>{d.fillStyle=Ye=t,d.fill(e)}):null!=t&&e&&d.fill(t)}function xn(e,t,n,a,s,r,o,i,l,c){let u=o%2/2;1==g&&d.translate(u,u),Ut(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=x[n.scale];if(null==r.min)return void(n._show&&(t=!1,n._show=!1,Sn(!1)));n._show||(t=!1,n._show=!0,Sn(!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=sn(hn(e),hn(t)),o=t-e,i=Lt(s/a*o,n);do{let e=n[i],t=a*e/o;if(t>=s&&r+(e<5?Bn.get(e):0)<=17)return[e,t]}while(++iSt[e]):m,g=2==r.distr?St[m[1]]-St[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=nn(n.size(a,f,s,e)),null!=y&&n._size!=y&&(t=!1)}),t}function Dn(e){let t=!0;return Ve.forEach((n,s)=>{let r=n(a,s,_e,e);r!=Oe[s]&&(t=!1),Oe[s]=r}),t}function Sn(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 Rn,_n,In,$n,Un,Wn,Hn,Yn,Gn,Kn,Xn,Jn,Qn=!1,ea=!1,ta=[];function na(){ea=!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],qe=Lt(i.min,t[0]),Ue=Lt(i.max,t[0]),Ue-qe>1&&(t[0][qe]i.max&&Ue--),n.min=St[qe],n.max=St[Ue]}else n.show&&n.auto&&Gt(i,o,n,t[r],n.sorted);n.idxs[0]=qe,n.idxs[1]=Ue}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&&Gt(u,P[o],a,l,a.sorted),null!=d&&Gt(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==dn?null:n.min,n.max==-dn?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=x[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?ln(s.min):4==e?un(s.min,s.asinh):100==e?s.fwd(s.min):s.min,s._max=3==e?ln(s.max):4==e?un(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)Ce=!0,Cs("setScale",e);q&&O.left>=0&&(xe=Ae=!0)}for(let t in P)P[t]=null}(),ve=!1),Ce&&(function(){let e=!1,t=0;for(;!e;){t++;let n=An(t),s=Dn(t);e=t==Be||n&&s,e||(Ee(a.width,a.height),we=!0)}}(),Ce=!1),we){if(xt(m,tt,ce),xt(m,Qe,ue),xt(m,Je,ie),xt(m,Ze,le),xt(p,tt,ce),xt(p,Qe,ue),xt(p,Je,ie),xt(p,Ze,le),xt(h,Je,re),xt(h,Ze,oe),u.width=tn(re*bt),u.height=tn(oe*bt),C.forEach(({_el:e,_show:t,_size:n,_pos:a,side:s})=>{if(null!=e)if(t){let t=s%2==1;xt(e,t?"left":"top",a-(3===s||0===s?n:0)),xt(e,t?"width":"height",n),xt(e,t?"top":"left",t?ue:ce),xt(e,t?"height":"width",t?le:ie),Ct(e,Ke)}else wt(e,Ke)}),He=Ye=Ge=dt=pt=yt=vt=Dt=at=null,Bt=1,Ga(!0),ce!=de||ue!=he||ie!=me||le!=pe){Sn(!1);let e=ie/me,t=le/pe;if(q&&!xe&&O.left>=0){O.left*=e,O.top*=t,In&&Et(In,tn(O.left),0,ie,le),$n&&Et($n,0,tn(O.top),ie,le);for(let n=0;n=0&&ha.width>0){ha.left*=e,ha.width*=e,ha.top*=t,ha.height*=t;for(let e in ts)xt(ma,e,ha[e])}de=ce,he=ue,me=ie,pe=le}Cs("setSize"),we=!1}re>0&&oe>0&&(d.clearRect(0,0,u.width,u.height),Cs("drawClear"),E.forEach(e=>e()),Cs("draw")),ha.show&&ke&&(pa(ha),ke=!1),q&&xe&&(Ha(null,!0,!1),xe=!1),V.show&&V.live&&Ae&&(_a(),Ae=!1),l||(l=!0,a.status=1,Cs("ready")),jt=!1,Qn=!1}function ia(e,n){let s=x[e];if(null==s.from){if(0==$e){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($e>1&&null!=n.min&&null!=n.max&&n.max-n.min<1e-16)return;e==A&&2==s.distr&&$e>0&&(n.min=Lt(n.min,t[0]),n.max=Lt(n.max,t[0]),n.min==n.max&&n.max++),P[e]=n,ve=!0,aa()}}a.batch=function(e,t=!1){Qn=!0,ea=t,e(a),oa(),t&&ta.length>0&&queueMicrotask(na)},a.redraw=(e,t)=>{Ce=t||!1,!1!==e?ga(A,S.min,S.max):aa()},a.setScale=ia;let la=!1;const ca=O.drag;let ua=ca.x,da=ca.y;q&&(O.x&&(Rn=At("u-cursor-x",p)),O.y&&(_n=At("u-cursor-y",p)),0==S.ori?(In=Rn,$n=_n):(In=_n,$n=Rn),Xn=O.left,Jn=O.top);const ha=a.select=On({show:!0,over:!0,left:0,width:0,top:0,height:0},e.select),ma=ha.show?At("u-select",ha.over?p:m):null;function pa(e,t){if(ha.show){for(let t in e)ha[t]=e[t],t in ts&&xt(ma,t,e[t]);!1!==t&&Cs("setSelect")}}function ga(e,t,n){ia(e,{min:t,max:n})}function fa(e,t,n,r){null!=t.focus&&function(e){if(e!=Ma){let t=null==e,n=1!=Me.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!=Pe[e]&&(Pe[e].style.opacity=t),$&&K[e]&&(K[e].style.opacity=t)}(r,s?1:Me.alpha)}}),Ma=e,n&&aa()}}(e),null!=t.show&&b.forEach((n,a)=>{a>0&&(e==a||null==e)&&(n.show=t.show,function(e){if(b[e].show)$&&Ct(K[e],Ke);else if($&&wt(K[e],Ke),q){let t=Te?Pe[0]:Pe[e];null!=t&&Et(t,-10,-10,ie,le)}}(a),2==s?(ga(n.facets[0].scale,null,null),ga(n.facets[1].scale,null,null)):ga(n.scale,null,null),aa())}),!1!==n&&Cs("setSeries",e,t),r&&Es("setSeries",a,e,t)}let Da,Sa,Ma;a.setSelect=pa,a.setSeries=fa,a.addBand=function(e,t){e.fill=gn(e.fill||null),e.dir=Yt(e.dir,-1),t=null==t?k.length:t,k.splice(t,0,e)},a.setBand=function(e,t){On(k[e],t)},a.delBand=function(e){null==e?k.length=0:k.splice(e,1)};const ja={focus:!0};function Pa(e,t,n){let a=x[t];n&&(e=e/bt-(1==a.ori?ue: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?rn(10,o):4==i?((e,t=1)=>Jt.sinh(e)*t)(o,a.asinh):100==i?a.bwd(o):o}function Ra(e,t){xt(ma,tt,ha.left=e),xt(ma,Je,ha.width=t)}function La(e,t){xt(ma,Qe,ha.top=e),xt(ma,Ze,ha.height=t)}$&&je&&ae(ct,W,e=>{O._lock||(Fe(e),null!=Ma&&fa(null,ja,!0,ks.setSeries))}),a.valToIdx=e=>Lt(e,t[0]),a.posToIdx=function(e,n){return Lt(Pa(e,A,n),t[0],qe,Ue)},a.posToVal=Pa,a.valToPos=(e,t,n)=>0==x[t].ori?r(e,x[t],n?ye:ie,n?ge:0):o(e,x[t],n?be:le,n?fe:0),a.setCursor=(e,t,n)=>{Xn=e.left,Jn=e.top,Ha(null,t,n)};let Na=0==S.ori?Ra:La,za=1==S.ori?Ra:La;function _a(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)&&Wa(e,I[e]);!function(){if($&&V.live)for(let e=2==s?1:0;eUe;Da=dn,Sa=null;let l=0==S.ori?ie:le,c=1==S.ori?ie:le;if(Xn<0||0==$e||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?x[e.scale]:x[e.facets[1].scale],c,0);if(je&&null!=C){let t=1==S.ori?Xn:Jn,n=Qt(Me.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)&&(Da=n,Sa=f)}else Da=n,Sa=f}}if(Ae||Te){let e,t;0==S.ori?(e=n,t=y):(e=y,t=n);let s,r,o,l,c,b,v=!0,w=Se.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=Se.size(a,f);if(b=Se.fill(a,f),c=Se.stroke(a,f),Te)f==Sa&&Da<=Me.prox&&(i=o,u=l,d=s,h=r,m=v,p=b,g=c);else{let e=Pe[f];null!=e&&(Re[f]=o,Le[f]=l,Mt(e,s,r,v),Ft(e,b,c),Et(e,nn(o),nn(l),ie,le))}}}}if(Te){let e=Me.prox;if(Ae||(null==Ma?Da<=e:Da>e||Sa!=Ma)){let e=Pe[0];null!=e&&(Re[0]=i,Le[0]=u,Mt(e,d,h,m),Ft(e,p,g),Et(e,nn(i),nn(u),ie,le))}}}if(ha.show&&la)if(null!=e){let[t,n]=ks.scales,[a,s]=ks.match,[r,o]=e.cursor.sync.scales,i=e.cursor.drag;if(ua=i._x,da=i._y,ua||da){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&&ua?(0==b?(i=p,u=f):(i=g,u=y),d=x[t],h=j(v(i,r),d,l,0),m=j(v(i+u,r),d,l,0),Na(an(h,m),Qt(m-h))):Na(0,l),C&&da?(1==b?(i=p,u=f):(i=g,u=y),d=x[n],h=T(v(i,o),d,c,0),m=T(v(i+u,o),d,c,0),za(an(h,m),Qt(m-h))):za(0,c)}else is()}else{let e=Qt(Gn-Un),t=Qt(Kn-Wn);if(1==S.ori){let n=e;e=t,t=n}ua=ca.x&&e>=ca.dist,da=ca.y&&t>=ca.dist;let n,a,s=ca.uni;null!=s?ua&&da&&(ua=e>=s,da=t>=s,ua||da||(t>e?da=!0:ua=!0)):ca.x&&ca.y&&(ua||da)&&(ua=da=!0),ua&&(0==S.ori?(n=Hn,a=Xn):(n=Yn,a=Jn),Na(an(n,a),Qt(a-n)),da||za(0,c)),da&&(1==S.ori?(n=Hn,a=Xn):(n=Yn,a=Jn),za(an(n,a),Qt(a-n)),ua||Na(0,l)),ua||da||(Na(0,0),za(0,0))}if(ca._x=ua,ca._y=da,null==e){if(r){if(null!=As){let[e,t]=ks.scales;ks.values[0]=null!=e?Pa(0==S.ori?Xn:Jn,e):null,ks.values[1]=null!=t?Pa(1==S.ori?Xn:Jn,t):null}Es(rt,a,Xn,Jn,ie,le,o)}if(je){let e=r&&ks.setSeries,t=Me.prox;null==Ma?Da<=t&&fa(Sa,ja,!0,e):Da>t?fa(null,ja,!0,e):Sa!=Ma&&fa(Sa,ja,!0,e)}}Ae&&(V.idx=o,_a()),!1!==n&&Cs("setCursor")}a.setLegend=_a;let Ya=null;function Ga(e=!1){e?Ya=null:(Ya=p.getBoundingClientRect(),Cs("syncRect",Ya))}function Ka(e,t,n,a,s,r,o){O._lock||la&&null!=e&&0==e.movementX&&0==e.movementY||(es(e,t,n,a,s,r,0,!1,null!=e),null!=e?Ha(null,!0,!0):Ha(t,!0,!1))}function es(e,t,n,s,r,o,l,c,u){if(null==Ya&&Ga(!1),Fe(e),null!=e)n=e.clientX-Ya.left,s=e.clientY-Ya.top;else{if(n<0||s<0)return Xn=-10,void(Jn=-10);let[e,a]=ks.scales,l=t.cursor.sync,[c,u]=l.values,[d,h]=l.scales,[m,p]=ks.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,x[e],f,0):-10:f*(w/b),s=null!=h?p(a,h)?i(u,x[a],y,0):-10:y*(C/v),1==S.ori){let e=n;n=s,s=e}}!u||null!=t&&t.cursor.event.type!=rt||((n<=1||n>=ie-1)&&(n=kn(n,ie)),(s<=1||s>=le-1)&&(s=kn(s,le))),c?(Un=n,Wn=s,[Hn,Yn]=O.move(a,n,s)):(Xn=n,Jn=s)}Object.defineProperty(a,"rect",{get:()=>(null==Ya&&Ga(!1),Ya)});const ts={width:0,height:0,left:0,top:0};function is(){pa(ts,!1)}let cs,us,hs,ms;function ps(e,t,n,s,r,o,i){la=!0,ua=da=ca._x=ca._y=!1,es(e,t,n,s,r,o,0,!0,!1),null!=e&&(ae(it,gt,fs,!1),Es(ot,a,Hn,Yn,ie,le,null));let{left:l,top:c,width:u,height:d}=ha;cs=l,us=c,hs=u,ms=d}function fs(e,t,n,s,r,o,i){la=ca._x=ca._y=!1,es(e,t,n,s,r,o,0,!1,!0);let{left:l,top:c,width:u,height:d}=ha,h=u>0||d>0,m=cs!=l||us!=c||hs!=u||ms!=d;if(h&&m&&pa(ha),ca.setScale&&h&&m){let e=l,t=u,n=c,a=d;if(1==S.ori&&(e=c,t=d,n=l,a=u),ua&&ga(A,Pa(e,A),Pa(e+t,A)),da)for(let s in x){let e=x[s];s!=A&&null==e.from&&e.min!=dn&&ga(s,Pa(n+a,s),Pa(n,s))}is()}else O.lock&&(O._lock=!O._lock,Ha(t,!0,null!=e));null!=e&&(se(it,gt),Es(it,a,Xn,Jn,ie,le,null))}function ys(e,t,n,s,r,o,i){O._lock||(Fe(e),Nt(),is(),null!=e&&Es(ut,a,Xn,Jn,ie,le,null))}function bs(){C.forEach(Gs),De(a.width,a.height,!0)}Pt(ht,ft,bs);const vs={};vs.mousedown=ps,vs.mousemove=Ka,vs.mouseup=fs,vs.dblclick=ys,vs.setSeries=(e,t,n,s)=>{-1!=(n=(0,ks.match[2])(a,t,n))&&fa(n,s,!0,!1)},q&&(ae(ot,p,ps),ae(rt,p,Ka),ae(lt,p,e=>{Fe(e),Ga(!1)}),ae(ct,p,function(e,t,n,a,s,r,o){if(O._lock)return;Fe(e);let i=la;if(la){let e,t,n=!0,a=!0,s=10;0==S.ori?(e=ua,t=da):(e=da,t=ua),e&&t&&(n=Xn<=s||Xn>=ie-s,a=Jn<=s||Jn>=le-s),e&&n&&(Xn=Xn{e.call(null,a,t,n)})}(e.plugins||[]).forEach(e=>{for(let t in e.hooks)ws[t]=(ws[t]||[]).concat(e.hooks[t])});const xs=(e,t,n)=>n,ks=On({key:null,setSeries:!1,filters:{pub:vn,sub:vn},scales:[A,b[1]?b[1].scale:null],match:[wn,wn,xs],values:[null,null]},O.sync);2==ks.match.length&&ks.match.push(xs),O.sync=ks;const As=ks.key,Ds=ls(As);function Es(e,t,n,a,s,r,o){ks.filters.pub(e,t,n,a,s,r,o)&&Ds.pub(e,t,n,a,s,r,o)}function Bs(){Cs("init",e,t),Tt(t||e.data,!1),P[A]?ia(A,P[A]):Nt(),ke=ha.show&&(ha.width>0||ha.height>0),xe=Ae=!0,De(e.width,e.height)}return Ds.sub(a),a.pub=function(e,t,n,a,s,r,o){ks.filters.sub(e,t,n,a,s,r,o)&&vs[e](null,t,n,a,s,r,o)},a.destroy=function(){Ds.unsub(a),Rs.delete(a),ne.clear(),Rt(ht,ft,bs),c.remove(),null==W||W.remove(),Cs("destroy")},b.forEach(ze),C.forEach(function(e,t){if(e._show=e.show,e.show){let n=e.side%2,s=x[e.scale];null==s&&(e.scale=n?b[1].scale:A,s=x[e.scale]);let r=s.time;e.size=gn(e.size),e.space=gn(e.space),e.rotate=gn(e.rotate),Pn(e.incrs)&&e.incrs.forEach(e=>{!Bn.has(e)&&Bn.set(e,Fn(e))}),e.incrs=gn(e.incrs||(2==s.distr?sa:r?1==y?ya:wa:ra)),e.splits=gn(e.splits||(r&&1==s.distr?N:3==s.distr?qa:4==s.distr?Ua:$a)),e.stroke=gn(e.stroke),e.grid.stroke=gn(e.grid.stroke),e.ticks.stroke=gn(e.ticks.stroke),e.border.stroke=gn(e.border.stroke);let o=e.values;e.values=Pn(o)&&!Pn(o[0])?gn(o):r?Pn(o)?Aa(R,ka(o,L)):Ln(o)?function(e,t){let n=Zn(t);return(t,a,s,r,o)=>a.map(t=>n(e(t)))}(R,o):o||z:o||Oa,e.filter=gn(e.filter||(s.distr>=3&&10==s.log?Xa:3==s.distr&&2==s.log?Ja:yn)),e.font=Ys(e.font),e.labelFont=Ys(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&&(_e[t]=!0,e._el=At("u-axis",h))}}),n?n instanceof HTMLElement?(n.appendChild(c),Bs()):n(a,Bs):Bs(),a}Ks.assign=On,Ks.fmtNum=Xt,Ks.rangeNum=Ht,Ks.rangeLog=Ot,Ks.rangeAsinh=$t,Ks.orient=cs,Ks.pxRatio=bt,Ks.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=sn(1,en((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;ocs(e,r,(l,c,u,d,h,m,p,g,f,y,b)=>{[o,i]=It(u,o,i);let v=l.pxRound,{left:w,width:C}=e.bbox,x=e=>v(m(e,d,y,g)),k=e=>v(p(e,h,b,f)),A=0==d.ori?vs:ws;const D={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},E=D.stroke,B=d.dir*(0==d.ori?1:-1);let F=k(u[1==B?o:i]),S=x(c[1==B?o:i]),M=S,j=S;s&&-1==t&&(j=w,A(E,j,F)),A(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=x(c[e]),s=k(n);1==t?A(E,a,F):A(E,M,s),A(E,a,s),F=s,M=a}let T=M;s&&1==t&&(T=w+C,A(E,T,F));let[P,R]=us(e,r);if(null!=l.fill||0!=P){let t=D.fill=new Path2D(E),n=k(l.fillTo(e,r,l.min,l.max,P));A(t,T,n),A(t,j,n)}if(!l.spanGaps){let s=[];s.push(...ps(c,u,o,i,B,x,a));let h=l.width*bt/2,m=n||1==t?h:-h,p=n||-1==t?-h:h;s.forEach(e=>{e[0]+=m,e[1]+=p}),D.gaps=s=l.gaps(e,r,o,i,s),D.clip=ms(s,d.ori,g,f,y,b)}return 0!=R&&(D.band=2==R?[hs(e,r,o,i,E,-1),hs(e,r,o,i,E,1)]:hs(e,r,o,i,E,R)),D})},e.bars=function(e){const t=Yt((e=e||Mn).size,[.6,dn,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=gn(s),o=1-t[0],i=Yt(t[1],dn),l=Yt(t[2],1),c=Yt(e.disp,Mn),u=Yt(e.each,e=>{}),{fill:d,stroke:h}=c;return(e,t,s,m)=>cs(e,t,(p,g,f,y,b,v,w,C,x,k,A)=>{let D,E,B=p.pxRound,F=n,S=a*bt,M=i*bt,j=l*bt;0==y.ori?[D,E]=r(e,t):[E,D]=r(e,t);const T=y.dir*(0==y.ori?1:-1);let P,R,L,N=0==y.ori?Cs:xs,z=0==y.ori?u:(e,t,n,a,s,r,o)=>{u(e,t,n,s,a,o,r)},_=Yt(e.bands,jn).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,A,x)),$=k,q=B(p.width*bt),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*k,y.key,!0)));let n=X.values(e,t,s,m);R=2==X.unit?n[0]*k:v(n[0],y,k,C)-v(0,y,k,C),$=Ts(g,f,v,y,k,C,$),L=$-R+S}else $=Ts(g,f,v,y,k,C,$),L=$*o+S,R=$-L;L<1&&(L=0),q>=R/2&&(q=0),L<5&&(B=fn);let J=L>0;R=B(mn($-L-(J?q:0),j,M)),P=(0==F?R/2:F==T?0:R)-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=D*R,ne=E*R;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,A,x)}let s=v(2!=y.distr||null!=c?g[n]:n,y,k,C),r=w(Yt(a,V),b,A,x),o=B(s-P),i=B(sn(r,O)),l=B(an(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+en(q/2),R,sn(0,u-q),s,r),null!=W[n]&&N(H.get(W[n]),o,l+en(q/2),R,sn(0,u-q),s,r)):N(Q,o,l+en(q/2),R,sn(0,u-q),s,r),z(e,t,n,o-q/2,l,R+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=Yt(null==t?void 0:t.alignGaps,0);return(t,a,s,r)=>cs(t,a,(o,i,l,c,u,d,h,m,p,g,f)=>{[s,r]=It(l,s,r);let y,b,v,w=o.pxRound,C=e=>w(d(e,c,g,m)),x=e=>w(h(e,u,f,p));0==c.ori?(y=ys,v=vs,b=Ds):(y=bs,v=ws,b=Es);const k=c.dir*(0==c.ori?1:-1);let A=C(i[1==k?s:r]),D=A,E=[],B=[];for(let e=1==k?s:r;e>=s&&e<=r;e+=k)if(null!=l[e]){let t=C(i[e]);E.push(D=t),B.push(x(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]=us(t,a);if(null!=o.fill||0!=M){let e=F.fill=new Path2D(S),n=x(o.fillTo(t,a,o.min,o.max,M));v(e,D,n),v(e,A,n)}if(!o.spanGaps){let e=[];e.push(...ps(i,l,s,r,k,C,n)),F.gaps=e=o.gaps(t,a,s,r,e),F.clip=ms(e,c.ori,m,p,g,f)}return 0!=j&&(F.band=2==j?[hs(t,a,s,r,S,-1),hs(t,a,s,r,S,1)]:hs(t,a,s,r,S,j)),F})}(Ps,e)}}const Xs=new Map;function Js(e){var t;if(!e.startsWith("var("))return e;const n=Xs.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 Xs.set(e,o),o}function Zs(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 Qs=null,er=0;const tr=s.memo(function({timestamps:e,series:t,onHover:n,onSeriesHover:a,highlightedKey:o=null,cursorColor:i,overlayLine:l=null}){const c=s.useRef(null),u=s.useRef(null),d=s.useRef(t),h=s.useRef(o),m=s.useRef(l),p=s.useRef(n),g=s.useRef(a),f=s.useRef(null),y=s.useRef(e.length);s.useLayoutEffect(()=>{d.current=t,h.current=o,m.current=l,p.current=n,g.current=a});const b=s.useMemo(()=>{const t=new Array(e.length).fill(1);return[e,t]},[e]),v=s.useMemo(()=>({hooks:{draw:e=>{(function(e,t,n,a){if(0===t.length)return;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=8*(window.devicePixelRatio||1);s.save(),s.beginPath(),s.roundRect(o,i,l,c,u),s.clip();const d=e.data[0],h=d.length;if(0===h)return;const m=d[0],p=d[h-1]-m||1,g=h>1?d[1]-d[0]:p/h,f=e=>o+(e-m)/p*l,y=e=>i+c*(1-e);for(let b=0;b=0;t--){const e=d[t],n=y(r[t]),a=f(t0&&s.lineTo(o,y(r[t-1]))}s.closePath(),s.fill(),s.restore()}a&&a.values.length>0&&function(e,t){const n=e.ctx,a=e.bbox,s=a.left,r=a.top,o=a.width,i=a.height;if(o<=0||i<=0)return;const l=e.data[0],c=l.length,u=t.values;if(0===c||0===u.length)return;const d=window.devicePixelRatio||1,h=l[0],m=l[c-1]-h||1,p=e=>s+(e-h)/m*o,g=e=>r+i*(1-e),f=Js(t.color),y=(t.lineWidth??2)*d;n.save(),n.strokeStyle=f,n.lineWidth=y,n.lineCap="round",n.lineJoin="round",n.beginPath();let b=0;for(;b=c)return void n.restore();const v=p(l[b]),w=g(u[b]);n.moveTo(v,w);for(let x=b+1;x({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=p.current)||t.call(p,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],h=l[2];let m=null;if(l[3]>10){const e=d.current;for(const t of e){const e=Js(t.color),[n,a,s]=Zs(e),r=30;if(Math.abs(c-n)<=r&&Math.abs(u-a)<=r&&Math.abs(h-s)<=r){m=t.key;break}}}m!==f.current&&(f.current=m,null==(n=g.current)||n.call(g,m))}}else null==(a=p.current)||a.call(p,null,null),null!==f.current&&(f.current=null,null==(s=g.current)||s.call(g,null))}]},plugins:[v]}),[v]);s.useEffect(()=>{const t=c.current;if(!t||0===e.length)return;const n=y.current,a=e.length,s=Math.abs(a-n);if(!(!u.current||s>100||n>0&&s/n>.1)&&u.current)return u.current.setData(b),void(y.current=a);u.current&&u.current.destroy();const r=t.getBoundingClientRect(),o=Math.floor(r.width)||400,i=Math.floor(r.height)||200,l=new Ks({...w,width:o,height:i},b,t);return u.current=l,y.current=a,()=>{l.destroy(),u.current=null}},[w,b,e.length]),s.useEffect(()=>{const e=c.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!u.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&u.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{u.current&&u.current.redraw()},[o,t,l]);const C=s.useCallback(()=>{null==n||n(null,null),null==a||a(null),f.current=null},[n,a]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available"}):r.jsx("div",{ref:c,className:"w-full h-full overflow-hidden",onMouseLeave:C})}),nr=s.createContext(null),ar={blksand:"breeze dark",magma:"breeze dark",waves:"breeze dark",stars:"breeze dark",folds:"breeze dark","kde breeze":"breeze dark",ribbon:"breeze light"};function sr(e){const t=xe(e);t&&function(e){if("undefined"==typeof document)return;const t=function(e){var t;const n={},a=e.surfaces.glass;n["--glass-tint"]=a.tint,n["--glass-light"]=a.light,n["--glass-dark"]=a.dark,n["--glass-reflex-light"]=String(a.reflexLight),n["--glass-reflex-dark"]=String(a.reflexDark),n["--glass-blur"]=`${a.blur}px`,n["--glass-blur-elevated"]=`${a.blurElevated}px`,n["--glass-brightness"]=String(a.brightness),n["--glass-bg-opacity"]=`${a.opacity}%`,n["--glass-bg-opacity-elevated"]=`${a.opacityElevated}%`,n["--glass-stroke-only"]=a.strokeOnly?"1":"0",n["--glass-stroke-width"]=a.strokeWidth?`${a.strokeWidth}px`:"0px",n["--glass-stroke-color"]=a.strokeColor||"transparent",n["--sidebar-tint"]=e.surfaces.sidebar.tint,n["--tooltip-bg"]=e.colors.bg.surface,n["--hover-tint"]=`rgba(${N(e.colors.accent.primary)}, 0.08)`,n["--shadow-tint"]=`rgba(${N(e.colors.accent.primary)}, 0.35)`,n["--bg-body"]=e.colors.bg.body,n["--bg-surface"]=e.colors.bg.surface,n["--bg-elevated"]=e.colors.bg.elevated,n["--bg-subtle"]=e.colors.bg.subtle,n["--border-subtle"]=e.colors.border.subtle,n["--border-strong"]=e.colors.border.strong,n["--text-primary"]=e.colors.text.primary,n["--text-secondary"]=e.colors.text.secondary,n["--text-muted"]=e.colors.text.muted,n["--text-invert"]=e.colors.text.inverse,n["--accent-primary"]=e.colors.accent.primary,n["--accent-secondary"]=e.colors.accent.secondary,n["--accent-tertiary"]=e.colors.accent.tertiary,n["--accent-success"]=e.colors.accent.success,n["--accent-danger"]=e.colors.accent.danger,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"]=e.colors.accent.secondary,n["--pkt-flood"]=e.colors.accent.tertiary,n["--pkt-txt-msg"]=e.colors.accent.success,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.accent.danger,n["--pkt-path"]=s.c3,n["--pkt-anon"]=e.colors.accent.secondary,n["--pkt-unknown"]=e.colors.status.muted,n["--route-flood"]=e.colors.accent.primary,n["--route-direct"]=e.colors.accent.secondary,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.accent.danger,n["--log-critical"]=e.colors.accent.danger;const r=e.colors.map;n["--map-node-fill"]="#3B82F6",n["--map-node-stroke"]="rgba(255,255,255,0.9)",n["--map-hub-color"]="#8E4EC6",n["--map-hub-stroke"]="rgba(255,255,255,0.9)",n["--map-gateway-color"]="#5B5BD6",n["--map-gateway-stroke"]="rgba(255,255,255,0.85)",n["--map-local-color"]="#FFB224",n["--map-neighbor-color"]="#FFB224",n["--map-neighbor-stroke"]="rgba(0,0,0,0.4)",n["--map-mobile-color"]="#F76B15",n["--map-room-color"]="#D6409F",n["--map-ghost-color"]="#00A2C7",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"]="#8E4EC6",n["--map-edge-hover-standard"]=e.colors.text.muted,n["--map-edge-hover-neighbor"]="#FFB224",n["--link-strong"]=e.colors.accent.success,n["--link-medium"]=e.colors.accent.secondary,n["--link-weak"]=e.colors.accent.danger,n["--hop-0"]=e.colors.accent.tertiary,n["--hop-1"]=e.colors.accent.success,n["--hop-2"]=s.c3,n["--hop-3"]=e.colors.accent.secondary,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)??e.colors.accent.primary,n["--icon-card-title"]=(null==o?void 0:o.cardTitle)??e.colors.accent.primary,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)??e.colors.accent.primary,n["--toggle-on"]=e.colors.accent.success,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, ${e.colors.accent.primary} 15%, transparent)`,n["--sidebar-nav-active-text"]=(null==l?void 0:l.navActiveText)??e.colors.accent.primary,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.02)",n["--terminal-border"]=i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)",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["--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(!P())return e;const t={},n=/^#[0-9A-Fa-f]{3,6}$/;for(const[a,s]of Object.entries(e))t[a]=n.test(s)?T(s):s;return t}(n)}(e),n=document.documentElement;for(const[a,s]of Object.entries(t))n.style.setProperty(a,s);e.surfaces.glass.strokeOnly?n.classList.add("stroke-only"):n.classList.remove("stroke-only"),e.surfaces.glass.catalystMode?n.classList.add("catalyst-mode"):n.classList.remove("catalyst-mode"),n.dataset.mode=e.meta.isDark?"dark":"light"}(t),document.documentElement.dataset.colorScheme=e}function rr({children:e}){const[t,n]=s.useState(()=>function(){if("undefined"==typeof window)return Re;try{let n=localStorage.getItem(Le),a=localStorage.getItem(Ne);const s=localStorage.getItem(ze);if(!n&&!a){const e=localStorage.getItem(_e);if(e){const t=Pe.find(t=>t.id===e);t&&(n=t.colorScheme,a=t.backgroundImage,localStorage.setItem(Le,n),localStorage.setItem(Ne,a),localStorage.removeItem(_e))}}n&&n in ar&&(n=ar[n],a="",localStorage.setItem(Le,n),localStorage.setItem(Ne,a));const r=n&&"string"==typeof(t=n)&&je.some(e=>e.id===t)?n:Re.colorScheme;let o=Re.backgroundImage;""===a?o="":a&&"string"==typeof(e=a)&&Te.some(t=>t.src===e)&&(o=a);let i=Re.brightness;if(s){const e=parseInt(s,10);!isNaN(e)&&e>=0&&e<=100&&(i=e)}return{colorScheme:r,backgroundImage:o,brightness:i}}catch{return Re}var e,t}()),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,sr(t.colorScheme),Xs.clear(),requestAnimationFrame(()=>{!function(){if("undefined"==typeof window)return;for(const t of Oe){const e=Ye(`--palette-${t}-bright`),n=Ye(`--palette-${t}`),a=e||n;if(!a)continue;const s=He(a);for(const r of Ve)Ge(`--palette-${t}-${r}`,s[r])}const e=Ye("--palette-bg-4");if(e){const t=He(e);for(const e of Ve)Ge(`--palette-neutral-${e}`,t[e])}}()})},[t.colorScheme]),s.useEffect(()=>{!function(e){if("undefined"!=typeof window)try{localStorage.setItem(Le,e.colorScheme),localStorage.setItem(Ne,e.backgroundImage),localStorage.setItem(ze,String(e.brightness))}catch{}}(t)},[t]),s.useEffect(()=>{Te.forEach(e=>{(new Image).src=e.src})},[]);const c=s.useCallback(e=>{n(t=>({...t,colorScheme:e}))},[]),u=s.useCallback(e=>{const t=Te.find(t=>t.src===e);n(n=>({...n,backgroundImage:e,brightness:(null==t?void 0:t.suggestedBrightness)??n.brightness}))},[]),d=s.useCallback(e=>{const t=Math.max(0,Math.min(100,Math.round(e)));n(e=>({...e,brightness:t}))},[]),h=s.useCallback(e=>{const t=Pe.find(t=>t.id===e);if(t){const e=!t.backgroundImage,a=e?null:Te.find(e=>e.src===t.backgroundImage);n(n=>({...n,colorScheme:t.colorScheme,backgroundImage:t.backgroundImage,brightness:e?100:(null==a?void 0:a.suggestedBrightness)??n.brightness}))}},[]),m=s.useMemo(()=>({theme:t,setColorScheme:c,setBackgroundImage:u,setBrightness:d,setThemePreset:h}),[t,c,u,d,h]);return r.jsxs(nr.Provider,{value:m,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.colorScheme),r.jsx("style",{children:"\n @keyframes theme-crossfade {\n from { opacity: 0.35; }\n to { opacity: 0; }\n }\n "})]})}function or(){const e=s.useContext(nr);if(!e)throw new Error("useTheme must be used within a ThemeProvider. Wrap your app with in App.tsx.");return e}const ir=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(A,{...a,to:n,ref:t})})}),lr={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"},cr={0:"T_FLOOD",1:"FLOOD",2:"DIRECT",3:"T_DIRECT"},ur={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 dr(e){return 1===e||0===e}const hr={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 mr(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 pr={waves:"batlow",blksand:"tokyo",breeze:"imola",magma:"batlow",ribbon:"hawaii",stars:"batlow",folds:"imola"},gr={[ur.ADVERT]:1,[ur.TXT_MSG]:4,[ur.GRP_TXT]:2,[ur.RESPONSE]:8,[ur.REQ]:13,[ur.ANON_REQ]:7,[ur.ACK]:11,[ur.PATH]:24,[ur.TRACE]:16,[ur.GRP_DATA]:34,[ur.MULTIPART]:52,[ur.RAW_CUSTOM]:14};function fr(){let e="waves",t=!0;if("undefined"!=typeof window){e=localStorage.getItem("pymc-color-scheme")||"waves";const n=xe(e);t=(null==n?void 0:n.meta.isDark)??!0}const n=pr[e]??"batlow",a=hr[n],s=a.discrete.length,r=Math.floor(s/2);return{colormap:a,colormapName:n,isDark:t,baseIndex:t?r:0,halfSize:r}}let yr=null;function br(e){const{colormap:t,isDark:n}=fr();if("number"!=typeof e)return n?"#A5A5A5":"#666666";const a=gr[e];if(void 0===a)return n?"#A5A5A5":"#666666";const s=t.categorical;return s[Math.min(a,s.length-1)]}function vr(e){const t=br(e);return null===yr&&(yr=P()),yr?function(e){return P()?T(e):e}(t):t}function wr(e){return mr(br(e))}function Cr(e){return null==e?"UNKNOWN":lr[e]||`TYPE_${e}`}function xr(e){return null==e?"UNKNOWN":cr[e]||`ROUTE_${e}`}function kr(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function Ar(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 kr(t,1)>kr(t,0)?"light":"dark"}function Dr(e){return 1===e||!0===e}const Er=i("inline-flex items-center gap-1","radius-badge px-1.5 py-0.5","text-xs"),Br={fontFamily:"var(--font-badge)",fontWeight:"var(--font-badge-weight)",textTransform:"var(--badge-text-transform, none)"},Fr={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(--text-muted)"};function Sr(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 Mr({color:e="zinc",customColor:t,filled:n=!1,compact:a=!1,className:o,title:l,children:c}){const u=s.useMemo(()=>{const a=t??Fr[e];if(n){if(t){const e=Ar(Sr(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(Er,a&&"!px-1 !py-0 !text-[10px]",o),style:{...Br,...u},title:l,children:c})}const jr=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??Fr[e];if(n){if(t){const e=Ar(Sr(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(Er,a&&"!px-1 !py-0 !text-[10px]","interactive hover-opacity",o);return"href"in u&&void 0!==u.href?r.jsx(ir,{...u,ref:d,className:m,style:{...Br,...h},children:c}):r.jsx(l,{...u,ref:d,className:m,style:{...Br,...h},children:c})}),Tr=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"),Pr={primary:i("bg-accent-primary text-white","hover:bg-accent-primary/90","active:bg-accent-primary/80","border border-accent-primary/20"),success:i("bg-accent-success text-white","hover:bg-accent-success/90","active:bg-accent-success/80","border border-accent-success/20"),danger:i("bg-accent-danger text-white","hover:bg-accent-danger/90","active:bg-accent-danger/80","border border-accent-danger/20"),warning:i("bg-accent-secondary text-bg-body","hover:bg-accent-secondary/90","active:bg-accent-secondary/80","border border-accent-secondary/20"),muted:i("bg-bg-elevated text-text-primary","hover:bg-bg-subtle","active:bg-bg-elevated","border border-border-subtle")},Rr={primary:i("bg-transparent text-accent-primary","border border-accent-primary/30","hover:bg-accent-primary/10 hover:border-accent-primary/50","active:bg-accent-primary/20"),success:i("bg-transparent text-accent-success","border border-accent-success/30","hover:bg-accent-success/10 hover:border-accent-success/50","active:bg-accent-success/20"),danger:i("bg-transparent text-accent-danger","border border-accent-danger/30","hover:bg-accent-danger/10 hover:border-accent-danger/50","active:bg-accent-danger/20"),warning:i("bg-transparent text-accent-secondary","border border-accent-secondary/30","hover:bg-accent-secondary/10 hover:border-accent-secondary/50","active:bg-accent-secondary/20"),muted:i("bg-transparent text-text-muted","border border-border-subtle","hover:bg-bg-subtle hover:text-text-primary hover:border-border-strong","active:bg-bg-elevated")},Lr={primary:i("bg-transparent text-accent-primary border-transparent","hover:bg-accent-primary/10","active:bg-accent-primary/20"),success:i("bg-transparent text-accent-success border-transparent","hover:bg-accent-success/10","active:bg-accent-success/20"),danger:i("bg-transparent text-accent-danger border-transparent","hover:bg-accent-danger/10","active:bg-accent-danger/20"),warning:i("bg-transparent text-accent-secondary border-transparent","hover:bg-accent-secondary/10","active:bg-accent-secondary/20"),muted:i("bg-transparent text-text-muted border-transparent","hover:bg-bg-subtle hover:text-text-primary","active:bg-bg-elevated")},Nr=s.forwardRef(function({color:e="muted",outline:t=!1,plain:n=!1,className:a,children:s,...o},c){const u=i(Tr,n?Lr[e]:t?Rr[e]:Pr[e],a);return"href"in o&&void 0!==o.href?r.jsx(ir,{...o,ref:c,className:u,children:s}):r.jsx(l,{...o,ref:c,className:u,children:s})}),zr=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)},_r=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),Ir=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var Vr={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 Or=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,...Vr,width:t,height:t,stroke:e,strokeWidth:a?24*Number(n)/Number(t):n,className:_r("lucide",r),...!o&&!Ir(l)&&{"aria-hidden":"true"},...l},[...i.map(([e,t])=>s.createElement(e,t)),...Array.isArray(o)?o:[o]])),$r=(e,t)=>{const n=s.forwardRef(({className:n,...a},r)=>{return s.createElement(Or,{ref:r,iconNode:t,className:_r(`lucide-${o=zr(e),o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,n),...a});var o});return n.displayName=zr(e),n},qr=$r("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"}]]),Ur=$r("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),Wr=$r("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Hr=$r("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),Yr=$r("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"}]]),Gr=$r("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"}]]),Kr=$r("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]),Xr=$r("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"}]]),Jr=$r("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"}]]),Zr=$r("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"}]]),Qr=$r("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),eo=$r("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"}]]),to=$r("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"}]]),no=$r("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]),ao=$r("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"}]]),so=$r("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),ro=$r("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"}]]),oo=$r("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"}]]),io=$r("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"}]]),lo=$r("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"}]]),co=$r("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"}]]),uo=$r("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"}]]),ho=$r("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"}]]),mo=$r("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"}]]),po=$r("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"}]]),go=$r("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),fo=s.createContext({});function yo(e){const t=s.useRef(null);return null===t.current&&(t.current=e()),t.current}const bo="undefined"!=typeof window,vo=bo?s.useLayoutEffect:s.useEffect,wo=s.createContext(null);function Co(e,t){-1===e.indexOf(t)&&e.push(t)}function xo(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const ko=(e,t,n)=>n>t?t:n/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Eo(e){return"object"==typeof e&&null!==e}const Bo=e=>/^0[^.\s]+$/u.test(e);function Fo(e){let t;return()=>(void 0===t&&(t=e()),t)}const So=e=>e,Mo=(e,t)=>n=>t(e(n)),jo=(...e)=>e.reduce(Mo),To=(e,t,n)=>{const a=t-e;return 0===a?1:(n-e)/a};class Po{constructor(){this.subscriptions=[]}add(e){return Co(this.subscriptions,e),()=>xo(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,Lo=e=>e/1e3;function No(e,t){return t?e*(1e3/t):0}const zo=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function _o(e,t,n,a){if(e===t&&n===a)return So;return s=>0===s||1===s?s:zo(function(e,t,n,a,s){let r,o,i=0;do{o=t+(n-t)/2,r=zo(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 Io=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Vo=e=>t=>1-e(1-t),Oo=_o(.33,1.53,.69,.99),$o=Vo(Oo),qo=Io($o),Uo=e=>(e*=2)<1?.5*$o(e):.5*(2-Math.pow(2,-10*(e-1))),Wo=e=>1-Math.sin(Math.acos(e)),Ho=Vo(Wo),Yo=Io(Wo),Go=_o(.42,0,1,1),Ko=_o(0,0,.58,1),Xo=_o(.42,0,.58,1),Jo=e=>Array.isArray(e)&&"number"!=typeof e[0],Zo=e=>Array.isArray(e)&&"number"==typeof e[0],Qo={linear:So,easeIn:Go,easeInOut:Xo,easeOut:Ko,circIn:Wo,circInOut:Yo,circOut:Ho,backIn:$o,backInOut:qo,backOut:Oo,anticipate:Uo},ei=e=>{if(Zo(e)){e.length;const[t,n,a,s]=e;return _o(t,n,a,s)}return"string"==typeof e?Qo[e]:e},ti=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function ni(e,t){let n=!1,a=!0;const s={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,o=ti.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=Ao.useManualTiming?s.timestamp:performance.now();n=!1,Ao.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:ti.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===ii&&ci.set(ri.isProcessing||Ao.useManualTiming?ri.timestamp:performance.now()),ii),set:e=>{ii=e,queueMicrotask(li)}},ui=e=>t=>"string"==typeof t&&t.startsWith(e),di=ui("--"),hi=ui("var(--"),mi=e=>!!hi(e)&&pi.test(e.split("/*")[0].trim()),pi=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function gi(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}const fi={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},yi={...fi,transform:e=>ko(0,1,e)},bi={...fi,default:1},vi=e=>Math.round(1e5*e)/1e5,wi=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,Ci=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,xi=(e,t)=>n=>Boolean("string"==typeof n&&Ci.test(n)&&n.startsWith(e)||t&&!function(e){return null==e}(n)&&Object.prototype.hasOwnProperty.call(n,t)),ki=(e,t,n)=>a=>{if("string"!=typeof a)return a;const[s,r,o,i]=a.match(wi);return{[e]:parseFloat(s),[t]:parseFloat(r),[n]:parseFloat(o),alpha:void 0!==i?parseFloat(i):1}},Ai={...fi,transform:e=>Math.round((e=>ko(0,255,e))(e))},Di={test:xi("rgb","red"),parse:ki("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:a=1})=>"rgba("+Ai.transform(e)+", "+Ai.transform(t)+", "+Ai.transform(n)+", "+vi(yi.transform(a))+")"},Ei={test:xi("#"),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:Di.transform},Bi=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),Fi=Bi("deg"),Si=Bi("%"),Mi=Bi("px"),ji=Bi("vh"),Ti=Bi("vw"),Pi=(()=>({...Si,parse:e=>Si.parse(e)/100,transform:e=>Si.transform(100*e)}))(),Ri={test:xi("hsl","hue"),parse:ki("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:a=1})=>"hsla("+Math.round(e)+", "+Si.transform(vi(t))+", "+Si.transform(vi(n))+", "+vi(yi.transform(a))+")"},Li={test:e=>Di.test(e)||Ei.test(e)||Ri.test(e),parse:e=>Di.test(e)?Di.parse(e):Ri.test(e)?Ri.parse(e):Ei.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?Di.transform(e):Ri.transform(e),getAnimatableNone:e=>{const t=Li.parse(e);return t.alpha=0,Li.transform(t)}},Ni=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,zi="number",_i="color",Ii=/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 Vi(e){const t=e.toString(),n=[],a={color:[],number:[],var:[]},s=[];let r=0;const o=t.replace(Ii,e=>(Li.test(e)?(a.color.push(r),s.push(_i),n.push(Li.parse(e))):e.startsWith("var(")?(a.var.push(r),s.push("var"),n.push(e)):(a.number.push(r),s.push(zi),n.push(parseFloat(e))),++r,"${}")).split("${}");return{values:n,split:o,indexes:a,types:s}}function Oi(e){return Vi(e).values}function $i(e){const{split:t,types:n}=Vi(e),a=t.length;return e=>{let s="";for(let r=0;r"number"==typeof e?0:Li.test(e)?Li.getAnimatableNone(e):e,Ui={test:function(e){var t,n;return isNaN(e)&&"string"==typeof e&&((null==(t=e.match(wi))?void 0:t.length)||0)+((null==(n=e.match(Ni))?void 0:n.length)||0)>0},parse:Oi,createTransformer:$i,getAnimatableNone:function(e){const t=Oi(e);return $i(e)(t.map(qi))}};function Wi(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 Hi(e,t){return n=>n>0?t:e}const Yi=(e,t,n)=>e+(t-e)*n,Gi=(e,t,n)=>{const a=e*e,s=n*(t*t-a)+a;return s<0?0:Math.sqrt(s)},Ki=[Ei,Di,Ri];function Xi(e){const t=(n=e,Ki.find(e=>e.test(n)));var n;if(!Boolean(t))return!1;let a=t.parse(e);return t===Ri&&(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=Wi(i,a,e+1/3),r=Wi(i,a,e),o=Wi(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 Ji=(e,t)=>{const n=Xi(e),a=Xi(t);if(!n||!a)return Hi(e,t);const s={...n};return e=>(s.red=Gi(n.red,a.red,e),s.green=Gi(n.green,a.green,e),s.blue=Gi(n.blue,a.blue,e),s.alpha=Yi(n.alpha,a.alpha,e),Di.transform(s))},Zi=new Set(["none","hidden"]);function Qi(e,t){return n=>Yi(e,t,n)}function el(e){return"number"==typeof e?Qi:"string"==typeof e?mi(e)?Hi:Li.test(e)?Ji:al:Array.isArray(e)?tl:"object"==typeof e?Li.test(e)?Ji:nl:Hi}function tl(e,t){const n=[...e],a=n.length,s=e.map((e,n)=>el(e)(e,t[n]));return e=>{for(let t=0;t{for(const t in a)n[t]=a[t](e);return n}}const al=(e,t)=>{const n=Ui.createTransformer(t),a=Vi(e),s=Vi(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?Zi.has(e)&&!s.values.length||Zi.has(t)&&!a.values.length?function(e,t){return Zi.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}(e,t):jo(tl(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)=>ai.update(t,e),stop:()=>si(t),now:()=>ri.isProcessing?ri.timestamp:ci.now()}},ol=(e,t,n=10)=>{let a="";const s=Math.max(Math.round(t/n),2);for(let r=0;r=il?1/0:t}function cl(e,t=100,n){const a=n({...e,keyframes:[0,t]}),s=Math.min(ll(a),il);return{type:"keyframes",ease:e=>a.next(s*e).value/t,duration:Lo(s)}}function ul(e,t,n){const a=Math.max(t-5,0);return No(n-e(a),t-a)}const dl=.01,hl=2,ml=.005,pl=.5;const gl=12;function fl(e,t){return e*Math.sqrt(1-t*t)}const yl=["duration","bounce"],bl=["stiffness","damping","mass"];function vl(e,t){return t.some(t=>void 0!==e[t])}function wl(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(!vl(e,bl)&&vl(e,yl))if(e.visualDuration){const n=e.visualDuration,a=2*Math.PI/(1.2*n),s=a*a,r=2*ko(.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=ko(.05,1,o),e=ko(.01,10,Lo(e)),o<1?(s=t=>{const a=t*o,s=a*e;return.001-(a-n)/fl(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=fl(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?Ro(p):ul(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(ll(w),il),t=ol(t=>w.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return w}function Cl({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 x=e=>{var t;t=h.value,(void 0!==i&&tl)&&(w=e,C=wl({keyframes:[h.value,m(h.value)],velocity:ul(b,e,h.value),damping:s,stiffness:r,restDelta:c,restSpeed:u}))};return x(0),{calculatedDuration:null,next:e=>{let t=!1;return C||void 0!==w||(t=!0,v(e),x(e)),void 0!==w&&e>=w?C.next(e-w):(!t&&v(e),h)}}}function xl(e,t){const n=e[e.length-1];for(let a=1;a<=t;a++){const s=To(0,t,a);e.push(Yi(n,1,s))}}function kl(e){const t=[0];return xl(t,e.length-1),t}function Al({duration:e=300,keyframes:t,times:n,ease:a="easeInOut"}){const s=Jo(a)?a.map(ei):ei(a),r={done:!1,value:t[0]},o=function(e,t){return e.map(e=>e*t)}(n&&n.length===t.length?n:kl(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||Ao.mix||sl,r=e.length-1;for(let o=0;o{if(o&&n1)for(;ac(ko(e[0],e[r-1],t)):c}(o,t,{ease:Array.isArray(s)?s:(l=t,c=s,l.map(()=>c||Xo).splice(0,l.length-1))});var l,c;return{calculatedDuration:e,next:t=>(r.value=i(t),r.done=t>=e,r)}}wl.applyToOptions=e=>{const t=cl(e,100,wl);return e.ease=t.ease,e.duration=Ro(t.duration),e.type="keyframes",e};const Dl=e=>null!==e;function El(e,{repeat:t,repeatType:n="loop"},a,s=1){const r=e.filter(Dl),o=s<0||t&&"loop"!==n&&t%2==1?0:r.length-1;return o&&void 0!==a?a:r[o]}const Bl={decay:Cl,inertia:Cl,tween:Al,keyframes:Al,spring:wl};function Fl(e){"string"==typeof e.type&&(e.type=Bl[e.type])}class Sl{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 Ml=e=>e/100;class jl extends Sl{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!==ci.now()&&this.tick(ci.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;Fl(e);const{type:t=Al,repeat:n=0,repeatDelay:a=0,repeatType:s,velocity:r=0}=e;let{keyframes:o}=e;const i=t||Al;i!==Al&&"number"!=typeof o[0]&&(this.mixKeyframes=jo(Ml,sl(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=ll(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=ko(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 x=null===this.holdTime&&("finished"===this.state||"running"===this.state&&C);return x&&m!==Cl&&(w.value=El(c,this.options,g,this.speed)),p&&p(w.value),x&&this.finish(),w}then(e,t){return this.finished.then(e,t)}get duration(){return Lo(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Lo(e)}get time(){return Lo(this.currentTime)}set time(e){var t;e=Ro(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(ci.now());const t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Lo(this.currentTime))}play(){var e,t;if(this.isStopped)return;const{driver:n=rl,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(ci.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 Tl=e=>180*e/Math.PI,Pl=e=>{const t=Tl(Math.atan2(e[1],e[0]));return Ll(t)},Rl={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Pl,rotateZ:Pl,skewX:e=>Tl(Math.atan(e[1])),skewY:e=>Tl(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Ll=e=>((e%=360)<0&&(e+=360),e),Nl=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),zl=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),_l={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Nl,scaleY:zl,scale:e=>(Nl(e)+zl(e))/2,rotateX:e=>Ll(Tl(Math.atan2(e[6],e[5]))),rotateY:e=>Ll(Tl(Math.atan2(-e[2],e[0]))),rotateZ:Pl,rotate:Pl,skewX:e=>Tl(Math.atan(e[4])),skewY:e=>Tl(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Il(e){return e.includes("scale")?1:0}function Vl(e,t){if(!e||"none"===e)return Il(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,s;if(n)a=_l,s=n;else{const t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=Rl,s=t}if(!s)return Il(t);const r=a[t],o=s[1].split(",").map(Ol);return"function"==typeof r?r(o):o[r]}function Ol(e){return parseFloat(e.trim())}const $l=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ql=(()=>new Set($l))(),Ul=e=>e===fi||e===Mi,Wl=new Set(["x","y","z"]),Hl=$l.filter(e=>!Wl.has(e)),Yl={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})=>Vl(t,"x"),y:(e,{transform:t})=>Vl(t,"y")};Yl.translateX=Yl.x,Yl.translateY=Yl.y;const Gl=new Set;let Kl=!1,Xl=!1,Jl=!1;function Zl(){if(Xl){const e=Array.from(Gl).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 Hl.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)})}Xl=!1,Kl=!1,Gl.forEach(e=>e.complete(Jl)),Gl.clear()}function Ql(){Gl.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Xl=!0)})}class ec{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?(Gl.add(this),Kl||(Kl=!0,ai.read(Ql),ai.resolveKeyframes(Zl))):(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),nc={};function ac(e,t){const n=Fo(e);return()=>nc[t]??n()}const sc=ac(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),rc=([e,t,n,a])=>`cubic-bezier(${e}, ${t}, ${n}, ${a})`,oc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:rc([0,.65,.55,1]),circOut:rc([.55,0,1,.45]),backIn:rc([.31,.01,.66,-.59]),backOut:rc([.33,1.53,.69,.99])};function ic(e,t){return e?"function"==typeof e?sc()?ol(e,t):"ease-out":Zo(e)?rc(e):Array.isArray(e)?e.map(e=>ic(e,t)||oc.easeOut):oc[e]:void 0}function lc(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=ic(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 cc(e){return"function"==typeof e&&"applyToOptions"in e}class uc extends Sl{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 cc(e)&&sc()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=lc(t,n,a,l,s),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const e=El(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 Lo(Number(n))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Lo(e)}get time(){return Lo(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ro(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&&tc()?(this.animation.timeline=e,So):t(this)}}const dc={anticipate:Uo,backInOut:qo,circInOut:Yo};class hc extends uc{constructor(e){var t;"string"==typeof(t=e).ease&&t.ease in dc&&(t.ease=dc[t.ease]),Fl(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 jl({...r,autoplay:!1}),i=Math.max(10,ci.now()-this.startTime),l=ko(0,10,i-10);t.setWithVelocity(o.sample(Math.max(0,i-l)).value,o.sample(i).value,l),o.stop()}}const mc=(e,t)=>!("zIndex"===t||"number"!=typeof e&&!Array.isArray(e)&&("string"!=typeof e||!Ui.test(e)&&"0"!==e||e.startsWith("url(")));function pc(e){e.duration=0,e.type="keyframes"}const gc=new Set(["opacity","clipPath","filter","transform"]),fc=Fo(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class yc extends Sl{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=ci.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)||ec;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=ci.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=mc(s,t),i=mc(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 fc()&&a&&gc.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 hc({...h,element:p}):new jl(h);g.finished.then(()=>{this.notifyFinished()}).catch(So),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(),Jl=!0,Ql(),Zl(),Jl=!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 bc(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 vc=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function wc(e,t,n=1){const[a,s]=function(e){const t=vc.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 Do(e)?parseFloat(e):e}return mi(s)?wc(s,t,n+1):s}const Cc={type:"spring",stiffness:500,damping:25,restSpeed:10},xc={type:"keyframes",duration:.8},kc={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ac=e=>null!==e;function Dc(e,t){return(null==e?void 0:e[t])??(null==e?void 0:e.default)??e}const Ec=(e,t,n,a={},s,r)=>o=>{const i=Dc(a,e)||{},l=i.delay||a.delay||0;let{elapsed:c=0}=a;c-=Ro(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?xc:ql.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:Cc:kc)(e,u)),u.duration&&(u.duration=Ro(u.duration)),u.repeatDelay&&(u.repeatDelay=Ro(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let d=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(pc(u),0===u.delay&&(d=!0)),(Ao.instantAnimations||Ao.skipAnimations)&&(d=!0,pc(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(Ac);return a[t&&"loop"!==n&&t%2==1?0:a.length-1]}(u.keyframes,i);if(void 0!==e)return void ai.update(()=>{u.onUpdate(e),u.onComplete()})}return i.isSync?new jl(u):new yc(u)};function Bc(e){const t=[{},{}];return null==e||e.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function Fc(e,t,n,a){if("function"==typeof t){const[s,r]=Bc(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]=Bc(a);t=t(void 0!==n?n:e.custom,s,r)}return t}function Sc(e,t,n){const a=e.getProps();return Fc(a,t,void 0!==n?n:a.custom,e)}const Mc=new Set(["width","height","top","left","right","bottom",...$l]);class jc{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{var t;const n=ci.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=ci.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 Po);const n=this.events[e].add(t);return"change"===e?()=>{n(),ai.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=ci.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return No(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 Tc(e,t){return new jc(e,t)}const Pc=e=>Array.isArray(e);function Rc(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Tc(n))}function Lc(e){return Pc(e)?e[e.length-1]||0:e}function Nc(e,t){const n=Sc(e,t);let{transitionEnd:a={},transition:s={},...r}=n||{};r={...r,...a};for(const o in r)Rc(e,o,Lc(r[o]))}const zc=e=>Boolean(e&&e.getVelocity);function _c(e,t){const n=e.getValue("willChange");if(a=n,Boolean(zc(a)&&a.add))return n.add(t);if(!n&&Ao.WillChange){const n=new Ao.WillChange("auto");e.addValue("willChange",n),n.add(t)}var a}function Ic(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const Vc="data-"+Ic("framerAppearId");function Oc(e){return e.props[Vc]}function $c({protectedKeys:e,needsAnimating:t},n){const a=e.hasOwnProperty(n)&&!0!==t[n];return t[n]=!1,a}function qc(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&&$c(c,u))continue;const s={delay:n,...Dc(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=Oc(e);if(t){const e=window.MotionHandoffAnimation(t,u,ai);null!==e&&(s.startTime=e,d=!0)}}_c(e,u),t.start(Ec(u,t,a,e.shouldReduceMotion&&Mc.has(u)?{type:!1}:s,e,d));const h=t.animation;h&&l.push(h)}return o&&Promise.all(l).then(()=>{ai.update(()=>{o&&Nc(e,o)})}),l}function Uc(e,t,n={}){var a;const s=Sc(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(qc(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(Uc(l,t,{...o,delay:n+("function"==typeof a?0:a)+bc(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 Wc(e,t,n={}){let a;if(e.notify("AnimationStart",t),Array.isArray(t)){const s=t.map(t=>Uc(e,t,n));a=Promise.all(s)}else if("string"==typeof t)a=Uc(e,t,n);else{const s="function"==typeof t?Sc(e,t,n.custom):t;a=Promise.all(qc(e,s,n))}return a.then(()=>{e.notify("AnimationComplete",t)})}const Hc=e=>t=>t.test(e),Yc=[fi,Mi,Si,Fi,Ti,ji,{test:e=>"auto"===e,parse:e=>e}],Gc=e=>Yc.find(Hc(e));function Kc(e){return"number"==typeof e?0===e:null===e||"none"===e||"0"===e||Bo(e)}const Xc=new Set(["brightness","contrast","saturate","opacity"]);function Jc(e){const[t,n]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[a]=n.match(wi)||[];if(!a)return e;const s=n.replace(a,"");let r=Xc.has(t)?1:0;return a!==n&&(r*=100),t+"("+r+s+")"}const Zc=/\b([a-z-]*)\(.*?\)/gu,Qc={...Ui,getAnimatableNone:e=>{const t=e.match(Zc);return t?t.map(Jc).join(" "):e}},eu={...fi,transform:Math.round},tu={borderWidth:Mi,borderTopWidth:Mi,borderRightWidth:Mi,borderBottomWidth:Mi,borderLeftWidth:Mi,borderRadius:Mi,borderTopLeftRadius:Mi,borderTopRightRadius:Mi,borderBottomRightRadius:Mi,borderBottomLeftRadius:Mi,width:Mi,maxWidth:Mi,height:Mi,maxHeight:Mi,top:Mi,right:Mi,bottom:Mi,left:Mi,inset:Mi,insetBlock:Mi,insetBlockStart:Mi,insetBlockEnd:Mi,insetInline:Mi,insetInlineStart:Mi,insetInlineEnd:Mi,padding:Mi,paddingTop:Mi,paddingRight:Mi,paddingBottom:Mi,paddingLeft:Mi,paddingBlock:Mi,paddingBlockStart:Mi,paddingBlockEnd:Mi,paddingInline:Mi,paddingInlineStart:Mi,paddingInlineEnd:Mi,margin:Mi,marginTop:Mi,marginRight:Mi,marginBottom:Mi,marginLeft:Mi,marginBlock:Mi,marginBlockStart:Mi,marginBlockEnd:Mi,marginInline:Mi,marginInlineStart:Mi,marginInlineEnd:Mi,fontSize:Mi,backgroundPositionX:Mi,backgroundPositionY:Mi,rotate:Fi,rotateX:Fi,rotateY:Fi,rotateZ:Fi,scale:bi,scaleX:bi,scaleY:bi,scaleZ:bi,skew:Fi,skewX:Fi,skewY:Fi,distance:Mi,translateX:Mi,translateY:Mi,translateZ:Mi,x:Mi,y:Mi,z:Mi,perspective:Mi,transformPerspective:Mi,opacity:yi,originX:Pi,originY:Pi,originZ:Mi,zIndex:eu,fillOpacity:yi,strokeOpacity:yi,numOctaves:eu},nu={...tu,color:Li,backgroundColor:Li,outlineColor:Li,fill:Li,stroke:Li,borderColor:Li,borderTopColor:Li,borderRightColor:Li,borderBottomColor:Li,borderLeftColor:Li,filter:Qc,WebkitFilter:Qc},au=e=>nu[e];function su(e,t){let n=au(e);return n!==Qc&&(n=Ui),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const ru=new Set(["auto","none","0"]);class ou extends ec{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 iu(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 lu=(e,t)=>t&&"number"==typeof e?t.transform(e):e;function cu(e){return Eo(e)&&"offsetHeight"in e}const{schedule:uu}=ni(queueMicrotask,!1),du={x:!1,y:!1};function hu(){return du.x||du.y}function mu(e,t){const n=iu(e),a=new AbortController;return[n,{passive:!0,...t,signal:a.signal},()=>a.abort()]}function pu(e){return!("touch"===e.pointerType||hu())}const gu=(e,t)=>!!t&&(e===t||gu(e,t.parentElement)),fu=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary,yu=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function bu(e){return yu.has(e.tagName)||!0===e.isContentEditable}const vu=new WeakSet;function wu(e){return t=>{"Enter"===t.key&&e(t)}}function Cu(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function xu(e){return fu(e)&&!hu()}function ku(e){return Eo(e)&&"ownerSVGElement"in e}function Au(e){return ku(e)&&"svg"===e.tagName}const Du=[...Yc,Li,Ui],Eu=()=>({x:{min:0,max:0},y:{min:0,max:0}}),Bu={current:null},Fu={current:!1},Su="undefined"!=typeof window,Mu=new WeakMap;function ju(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function Tu(e){return"string"==typeof e||Array.isArray(e)}const Pu=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ru=["initial",...Pu];function Lu(e){return ju(e.animate)||Ru.some(t=>Tu(e[t]))}function Nu(e){return Boolean(Lu(e)||e.variants)}const zu=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let _u={};function Iu(e){_u=e}class Vu{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=ec,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=ci.now();this.renderScheduledAtthis.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(Fu.current||function(){if(Fu.current=!0,Su)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Bu.current=e.matches;e.addEventListener("change",t),t()}else Bu.current=!1}(),this.shouldReduceMotion=Bu.current),null==(t=this.parent)||t.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),si(this.notifyUpdate),si(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=ql.has(e);n&&this.onBindTransform&&this.onBindTransform();const a=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&ai.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 _u){const t=_u[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=Tc(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&&(Do(n)||Bo(n))?n=parseFloat(n):(a=n,!Du.find(Hc(a))&&Ui.test(t)&&(n=su(e,t))),this.setBaseTarget(e,zc(n)?n.get():n)),zc(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=Fc(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||zc(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 Po),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){uu.render(this.render)}}class Ou extends Vu{constructor(){super(...arguments),this.KeyframeResolver=ou}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;zc(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}class $u{constructor(e){this.isMounted=!1,this.node=e}update(){}}function qu({top:e,left:t,right:n,bottom:a}){return{x:{min:t,max:n},y:{min:e,max:a}}}function Uu(e){return void 0===e||1===e}function Wu({scale:e,scaleX:t,scaleY:n}){return!Uu(e)||!Uu(t)||!Uu(n)}function Hu(e){return Wu(e)||Yu(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Yu(e){return Gu(e.x)||Gu(e.y)}function Gu(e){return e&&"0%"!==e}function Ku(e,t,n){return n+t*(e-n)}function Xu(e,t,n,a,s){return void 0!==s&&(e=Ku(e,s,a)),Ku(e,n,a)+t}function Ju(e,t=0,n=1,a,s){e.min=Xu(e.min,t,n,a,s),e.max=Xu(e.max,t,n,a,s)}function Zu(e,{x:t,y:n}){Ju(e.x,t.translate,t.scale,t.originPoint),Ju(e.y,n.translate,n.scale,n.originPoint)}const Qu=.999999999999,ed=1.0000000000001;function td(e,t){e.min=e.min+t,e.max=e.max+t}function nd(e,t,n,a,s=.5){Ju(e,t,n,Yi(e.min,e.max,s),a)}function ad(e,t){nd(e.x,t.x,t.scaleX,t.scale,t.originX),nd(e.y,t.y,t.scaleY,t.scale,t.originY)}function sd(e,t){return qu(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 rd={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},od=$l.length;function id(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(ql.has(l))o=!0;else if(di(l))s[l]=e;else{const t=lu(e,tu[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(!Mi.test(e))return e;e=parseFloat(e)}return`${cd(e,t.target.x)}% ${cd(e,t.target.y)}%`}},dd={correct:(e,{treeScale:t,projectionDelta:n})=>{const a=e,s=Ui.parse(e);if(s.length>5)return a;const r=Ui.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=Yi(i,l,.5);return"number"==typeof s[2+o]&&(s[2+o]/=c),"number"==typeof s[3+o]&&(s[3+o]/=c),r(s)}},hd={borderRadius:{...ud,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ud,borderTopRightRadius:ud,borderBottomLeftRadius:ud,borderBottomRightRadius:ud,boxShadow:dd};function md(e){for(const t in e)hd[t]=e[t],di(t)&&(hd[t].isCSSVariable=!0)}function pd(e,{layout:t,layoutId:n}){return ql.has(e)||e.startsWith("origin")||(t||void 0!==n)&&(!!hd[e]||"opacity"===e)}function gd(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)(zc(s[i])||r&&zc(r[i])||pd(i,e)||void 0!==(null==(a=null==n?void 0:n.getValue(i))?void 0:a.liveStyle))&&(o[i]=s[i]);return o}class fd extends Ou{constructor(){super(...arguments),this.type="html",this.renderInstance=ld}readValueFromInstance(e,t){var n,a;if(ql.has(t))return(null==(n=this.projection)?void 0:n.isProjecting)?Il(t):((e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Vl(n,t)})(e,t);{const n=(a=e,window.getComputedStyle(a)),s=(di(t)?n.getPropertyValue(t):n[t])||0;return"string"==typeof s?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:t}){return sd(e,t)}build(e,t,n){id(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return gd(e,t,n)}}const yd={offset:"stroke-dashoffset",array:"stroke-dasharray"},bd={offset:"strokeDashoffset",array:"strokeDasharray"},vd=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function wd(e,{attrX:t,attrY:n,attrScale:a,pathLength:s,pathSpacing:r=1,pathOffset:o=0,...i},l,c,u){if(id(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 vd)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?yd:bd;e[r.offset]=""+-a,e[r.array]=`${t} ${n}`}(d,s,r,o,!1)}const Cd=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"]),xd=e=>"string"==typeof e&&"svg"===e.toLowerCase();function kd(e,t,n){const a=gd(e,t,n);for(const s in e)(zc(e[s])||zc(t[s]))&&(a[-1!==$l.indexOf(s)?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s]=e[s]);return a}class Ad extends Ou{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Eu}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(ql.has(t)){const e=au(t);return e&&e.default||0}return t=Cd.has(t)?t:Ic(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return kd(e,t,n)}build(e,t,n){wd(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,a){!function(e,t,n,a){ld(e,t,void 0,a);for(const s in t.attrs)e.setAttribute(Cd.has(s)?s:Ic(s),t.attrs[s])}(e,t,0,a)}mount(e){this.isSVGTag=xd(e.tagName),super.mount(e)}}const Dd=Ru.length;function Ed(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent&&Ed(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})=>Wc(e,t,n)))}(e),n=Pd(),a=!0;const s=t=>(n,a)=>{var s;const r=Sc(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=Ed(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 x=C.reduce(s(h),{});!1===f&&(x={});const{prevResolvedValues:k={}}=m,A={...k,...x},D=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 A){const t=x[e],n=k[e];if(u.hasOwnProperty(e))continue;let a=!1;a=Pc(t)&&Pc(n)?!Bd(t,n):t!==n,a?null!=t?D(e):c.add(e):void 0!==t&&c.has(e)?D(e):m.protectedKeys[e]=!0}m.prevProp=p,m.prevResolvedValues=x,m.isActive&&(u={...u,...x}),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=Sc(a,t);if(a.enteringChildren&&s){const{delayChildren:t}=s.transition||{};n.delay=bc(a.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(c.size){const t={};if("boolean"!=typeof o.initial){const n=Sc(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=Pd()}}}function jd(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!Bd(t,e)}function Td(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Pd(){return{animate:Td(!0),whileInView:Td(),whileHover:Td(),whileTap:Td(),whileDrag:Td(),whileFocus:Td(),exit:Td()}}function Rd(e,t){e.min=t.min,e.max=t.max}function Ld(e,t){Rd(e.x,t.x),Rd(e.y,t.y)}function Nd(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function zd(e){return e.max-e.min}function _d(e,t,n,a=.5){e.origin=a,e.originPoint=Yi(t.min,t.max,e.origin),e.scale=zd(n)/zd(t),e.translate=Yi(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 Id(e,t,n,a){_d(e.x,t.x,n.x,a?a.originX:void 0),_d(e.y,t.y,n.y,a?a.originY:void 0)}function Vd(e,t,n){e.min=n.min+t.min,e.max=e.min+zd(t)}function Od(e,t,n){e.min=t.min-n.min,e.max=e.min+zd(t)}function $d(e,t,n){Od(e.x,t.x,n.x),Od(e.y,t.y,n.y)}function qd(e,t,n,a,s){return e=Ku(e-=t,1/n,a),void 0!==s&&(e=Ku(e,1/s,a)),e}function Ud(e,t,[n,a,s],r,o){!function(e,t=0,n=1,a=.5,s,r=e,o=e){if(Si.test(t)&&(t=parseFloat(t),t=Yi(o.min,o.max,t/100)-o.min),"number"!=typeof t)return;let i=Yi(r.min,r.max,a);e===r&&(i-=t),e.min=qd(e.min,t,n,i,s),e.max=qd(e.max,t,n,i,s)}(e,t[n],t[a],t[s],t.scale,r,o)}const Wd=["x","scaleX","originX"],Hd=["y","scaleY","originY"];function Yd(e,t,n,a){Ud(e.x,t,Wd,n?n.x:void 0,a?a.x:void 0),Ud(e.y,t,Hd,n?n.y:void 0,a?a.y:void 0)}function Gd(e){return 0===e.translate&&1===e.scale}function Kd(e){return Gd(e.x)&&Gd(e.y)}function Xd(e,t){return e.min===t.min&&e.max===t.max}function Jd(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Zd(e,t){return Jd(e.x,t.x)&&Jd(e.y,t.y)}function Qd(e){return zd(e.x)/zd(e.y)}function eh(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function th(e){return[e("x"),e("y")]}const nh=["TopLeft","TopRight","BottomLeft","BottomRight"],ah=nh.length,sh=e=>"string"==typeof e?parseFloat(e):e,rh=e=>"number"==typeof e||Mi.test(e);function oh(e,t){return void 0!==e[t]?e[t]:e.borderRadius}const ih=ch(0,.5,Ho),lh=ch(.5,.95,So);function ch(e,t,n){return a=>at?1:n(To(e,t,a))}function uh(e,t,n){const a=zc(e)?e:Tc(e);return a.start(Ec("",a,t,n)),a.animation}function dh(e,t,n,a={passive:!0}){return e.addEventListener(t,n,a),()=>e.removeEventListener(t,n)}const hh=(e,t)=>e.depth-t.depth;class mh{constructor(){this.children=[],this.isDirty=!1}add(e){Co(this.children,e),this.isDirty=!0}remove(e){xo(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(hh),this.isDirty=!1,this.children.forEach(e)}}function ph(e,t){const n=ci.now(),a=({timestamp:s})=>{const r=s-n;r>=t&&(si(a),e(r-t))};return ai.setup(a,!0),()=>si(a)}function gh(e){return zc(e)?e.get():e}class fh{constructor(){this.members=[]}add(e){Co(this.members,e),e.scheduleRender()}remove(e){if(xo(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 yh={hasAnimatedSinceResize:!0,hasEverUpdated:!1},bh=["","X","Y","Z"];let vh=0;function wh(e,t,n,a){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),a&&(a[e]=0))}function Ch(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Oc(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:t,layoutId:a}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ai,!(t||a))}const{parent:a}=e;a&&!a.hasCheckedOptimisedAppear&&Ch(a)}function xh({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:a,resetTransform:s}){return class{constructor(e={},n=(null==t?void 0:t())){this.id=vh++,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(Dh),this.nodes.forEach(Th),this.nodes.forEach(Ph),this.nodes.forEach(Eh)},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;ai.read(()=>{a=window.innerWidth}),e(t,()=>{const e=window.innerWidth;e!==a&&(a=e,this.root.updateBlockedByResize=!0,n&&n(),n=ph(s,250),yh.hasAnimatedSinceResize&&(yh.hasAnimatedSinceResize=!1,this.nodes.forEach(jh)))})}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()||Ih,{onLayoutAnimationStart:o,onLayoutAnimationComplete:i}=s.getProps(),l=!this.targetLayout||!Zd(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={...Dc(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||jh(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(),si(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(Rh),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&&Ch(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||zd(this.snapshot.measuredBox.x)||zd(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;nQu&&(t.x=1),t.yQu&&(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?(Nd(this.prevProjectionDelta.x,this.projectionDelta.x),Nd(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),Id(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===o&&this.treeScale.y===i&&eh(this.projectionDelta.x,this.prevProjectionDelta.x)&&eh(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(_h));let d;this.animationProgress=0,this.mixTargetDelta=t=>{const n=t/1e3;var l,h,m,p,g,f;Nh(r.x,e.x,n),Nh(r.y,e.y,n),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&($d(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,p=this.relativeTargetOrigin,g=o,f=n,zh(m.x,p.x,g.x,f),zh(m.y,p.y,g.y,f),d&&(l=this.relativeTarget,h=d,Xd(l.x,h.x)&&Xd(l.y,h.y))&&(this.isProjectionDirty=!1),d||(d={x:{min:0,max:0},y:{min:0,max:0}}),Ld(d,this.relativeTarget)),i&&(this.animationValues=s,function(e,t,n,a,s,r){s?(e.opacity=Yi(0,n.opacity??1,ih(a)),e.opacityExit=Yi(t.opacity??1,0,lh(a))):r&&(e.opacity=Yi(t.opacity??1,n.opacity??1,a));for(let o=0;o{yh.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Tc(0)),this.currentAnimation=uh(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&&qh(this.options.animationType,this.layout.layoutBox,a.layoutBox)){n=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const t=zd(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;const a=zd(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+a}Ld(t,n),ad(t,s),Id(this.projectionDeltaWithTransform,this.layoutCorrected,t,s)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new fh),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&&wh("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(Fh),this.root.sharedNodes.clear()}}}function kh(e){e.updateLayout()}function Ah(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?th(e=>{const a=r?n.measuredBox[e]:n.layoutBox[e],s=zd(a);a.min=t[e].min,a.max=a.min+s}):qh(s,n.layoutBox,t)&&th(a=>{const s=r?n.measuredBox[a]:n.layoutBox[a],o=zd(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}};Id(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?Id(i,e.applyTransform(a,!0),n.measuredBox):Id(i,t,n.layoutBox);const l=!Kd(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}};$d(o,n.layoutBox,s.layoutBox);const i={x:{min:0,max:0},y:{min:0,max:0}};$d(i,t,r.layoutBox),Zd(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 Dh(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 Eh(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Bh(e){e.clearSnapshot()}function Fh(e){e.clearMeasurements()}function Sh(e){e.isLayoutDirty=!1}function Mh(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function jh(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Th(e){e.resolveTargetDelta()}function Ph(e){e.calcProjection()}function Rh(e){e.resetSkewAndRotation()}function Lh(e){e.removeLeadSnapshot()}function Nh(e,t,n){e.translate=Yi(t.translate,0,n),e.scale=Yi(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function zh(e,t,n,a){e.min=Yi(t.min,n.min,a),e.max=Yi(t.max,n.max,a)}function _h(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}const Ih={duration:.45,ease:[.4,0,.1,1]},Vh=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Oh=Vh("applewebkit/")&&!Vh("chrome/")?Math.round:So;function $h(e){e.min=Oh(e.min),e.max=Oh(e.max)}function qh(e,t,n){return"position"===e||"preserve-aspect"===e&&(a=Qd(t),s=Qd(n),!(Math.abs(a-s)<=.2));var a,s}function Uh(e){var t;return e!==e.root&&(null==(t=e.scroll)?void 0:t.wasRoot)}const Wh=xh({attachResizeListener:(e,t)=>dh(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}),Hh=e=>!e.isLayoutDirty&&e.willUpdate(!1);function Yh(){const e=new Set,t=new WeakMap,n=()=>e.forEach(Hh);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 Gh={current:void 0},Kh=xh({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Gh.current){const e=new Wh({});e.mount(window),e.setOptions({layoutScroll:!0}),Gh.current=e}return Gh.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),Xh=s.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function Jh(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}class Zh extends s.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){const e=t.offsetParent,n=cu(e)&&e.offsetWidth||0,a=cu(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 Qh({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(Xh),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=Jh(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(Zh,{isPresent:t,childRef:c,sizeRef:u,children:s.cloneElement(e,{ref:m})})}const em=({children:e,initial:t,isPresent:n,onExitComplete:a,custom:o,presenceAffectsLayout:i,mode:l,anchorX:c,anchorY:u,root:d})=>{const h=yo(tm),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(Qh,{isPresent:n,anchorX:c,anchorY:u,root:d,children:e})),r.jsx(wo.Provider,{value:g,children:e})};function tm(){return new Map}function nm(e=!0){const t=s.useContext(wo);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 am(){return null===(e=s.useContext(wo))||e.isPresent;var e}const sm=e=>e.key||"";function rm(e){const t=[];return s.Children.forEach(e,e=>{s.isValidElement(e)&&t.push(e)}),t}const om=({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]=nm(l),p=s.useMemo(()=>rm(e),[e]),g=l&&!h?[]:p.map(sm),f=s.useRef(!0),y=s.useRef(p),b=yo(()=>new Map),v=s.useRef(new Set),[w,C]=s.useState(p),[x,k]=s.useState(p);vo(()=>{f.current=!1,y.current=p;for(let e=0;e{const s=sm(e),w=!(l&&!h)&&(p===x||g.includes(s));return r.jsx(em,{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==D||D(),k(y.current),l&&(null==m||m()),a&&a())},anchorX:c,anchorY:u,children:e},s)})})},im=s.createContext(null);const lm=e=>!0===e,cm=({children:e,id:t,inherit:n=!0})=>{const a=s.useContext(fo),o=s.useContext(im),[i,l]=function(){const e=function(){const e=s.useRef(!1);return vo(()=>(e.current=!0,()=>{e.current=!1}),[]),e}(),[t,n]=s.useState(0),a=s.useCallback(()=>{e.current&&n(t+1)},[t]);return[s.useCallback(()=>ai.postRender(a),[a]),t]}(),c=s.useRef(null),u=a.id||o;null===c.current&&((e=>lm(!0===e)||"id"===e)(n)&&u&&(t=t?u+"-"+t:u),c.current={id:t,group:lm(n)&&a.group||Yh()});const d=s.useMemo(()=>({...c.current,forceRender:i}),[l]);return r.jsx(fo.Provider,{value:d,children:e})},um=s.createContext({strict:!1}),dm={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 hm=!1;function mm(){return function(){if(hm)return;const e={};for(const t in dm)e[t]={isEnabled:e=>dm[t].some(t=>!!e[t])};Iu(e),hm=!0}(),_u}const pm=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 gm(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||pm.has(e)}let fm=e=>!gm(e);function ym(e){"function"==typeof e&&(fm=t=>t.startsWith("on")?!gm(t):e(t))}try{ym(require("@emotion/is-prop-valid").default)}catch{}const bm=s.createContext({});function vm(e){return Array.isArray(e)?e.join(" "):e}function wm(e,t,n){for(const a in t)zc(t[a])||pd(a,n)||(e[a]=t[a])}function Cm(e,t){const n={},a=function(e,t){const n={};return wm(n,e.style||{},e),Object.assign(n,function({transformTemplate:e},t){return s.useMemo(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{}};return id(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 xm(e,t,n,a){const r=s.useMemo(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return wd(n,t,xd(a),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){const t={};wm(t,e.style,e),r.style={...t,...r.style}}return r}const km=["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 Am(e){return"string"==typeof e&&!e.includes("-")&&!!(km.indexOf(e)>-1||/[A-Z]/u.test(e))}function Dm(e,t,n,{latestValues:a},r,o=!1,i){const l=(i??Am(e)?xm:Cm)(t,a,r,e),c=function(e,t,n){const a={};for(const s in e)"values"===s&&"object"==typeof e.values||(fm(s)||!0===n&&gm(s)||!t&&!gm(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(()=>zc(d)?d.get():d,[d]);return s.createElement(e,{...u,children:h})}function Em(e,t,n,a){const s={},r=a(e,{});for(const h in r)s[h]=gh(r[h]);let{initial:o,animate:i}=e;const l=Lu(e),c=Nu(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&&!ju(d)){const t=Array.isArray(d)?d:[d];for(let n=0;n(t,n)=>{const a=s.useContext(bm),r=s.useContext(wo),o=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t},n,a,s){return{latestValues:Em(n,a,s,e),renderState:t()}}(e,t,a,r);return n?o():yo(o)},Fm=Bm({scrapeMotionValuesFromProps:gd,createRenderState:()=>({style:{},transform:{},transformOrigin:{},vars:{}})}),Sm=Bm({scrapeMotionValuesFromProps:kd,createRenderState:()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}})}),Mm=Symbol.for("motionComponentSymbol");function jm(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 Tm=s.createContext({});function Pm(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function Rm(e,t,n,a,r,o){var i,l;const{visualElement:c}=s.useContext(bm),u=s.useContext(um),d=s.useContext(wo),h=s.useContext(Xh).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(Tm);!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:Lm(e.parent)),e.projection.setOptions({layoutId:s,layout:r,alwaysMeasureLayout:Boolean(o)||i&&Pm(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[Vc],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 vo(()=>{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 Lm(e){if(e)return!1!==e.options.allowProjection?e.projection:Lm(e.parent)}function Nm(e,{forwardMotionProps:t=!1,type:n}={},a,o){a&&function(e){const t=mm();for(const n in e)t[n]={...t[n],...e[n]};Iu(t)}(a);const i=n?"svg"===n:Am(e),l=i?Sm:Fm;function c(n,a){let c;const u={...s.useContext(Xh),...n,layoutId:zm(n)},{isStatic:d}=u,h=function(e){const{initial:t,animate:n}=function(e,t){if(Lu(e)){const{initial:t,animate:n}=e;return{initial:!1===t||Tu(t)?t:void 0,animate:Tu(n)?n:void 0}}return!1!==e.inherit?t:{}}(e,s.useContext(bm));return s.useMemo(()=>({initial:t,animate:n}),[vm(t),vm(n)])}(n),m=l(n,d);if(!d&&bo){s.useContext(um).strict;const t=function(e){const t=mm(),{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=Rm(e,m,u,o,t.ProjectionNode,i)}return r.jsxs(bm.Provider,{value:h,children:[c&&h.visualElement?r.jsx(c,{visualElement:h.visualElement,...u}):null,Dm(e,n,jm(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[Mm]=e,u}function zm({layoutId:e}){const t=s.useContext(fo).id;return t&&void 0!==e?t+"-"+e:e}function _m(e,t){if("undefined"==typeof Proxy)return Nm;const n=new Map,a=(n,a)=>Nm(n,a,e,t);return new Proxy((e,t)=>a(e,t),{get:(s,r)=>"create"===r?a:(n.has(r)||n.set(r,Nm(r,void 0,e,t)),n.get(r))})}const Im=(e,t)=>t.isSVG??Am(e)?new Ad(t):new fd(t,{allowProjection:e!==s.Fragment});let Vm=0;const Om={animation:{Feature:class extends $u{constructor(e){super(e),e.animationState||(e.animationState=Md(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();ju(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 $u{constructor(){super(...arguments),this.id=Vm++}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 $m(e){return{point:{x:e.pageX,y:e.pageY}}}function qm(e,t,n,a){return dh(e,t,(e=>t=>fu(t)&&e(t,$m(t)))(n),a)}const Um=({current:e})=>e?e.ownerDocument.defaultView:null,Wm=(e,t)=>Math.abs(e-t),Hm=new Set(["auto","scroll"]);class Ym{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=Xm(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,n=function(e,t){const n=Wm(e.x,t.x),a=Wm(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}=ri;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=Gm(t,this.transformPagePoint),ai.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=Xm("pointercancel"===e.type?this.lastMoveEventInfo:Gm(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,r),a&&a(e,r)},!fu(e))return;this.dragSnapToOrigin=s,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=r,this.contextWindow=a||window;const i=Gm($m(e),this.transformPagePoint),{point:l}=i,{timestamp:c}=ri;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,Xm(i,this.history)),this.removeListeners=jo(qm(this.contextWindow,"pointermove",this.handlePointerMove),qm(this.contextWindow,"pointerup",this.handlePointerUp),qm(this.contextWindow,"pointercancel",this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){const e=getComputedStyle(t);(Hm.has(e.overflowX)||Hm.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),ai.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),si(this.updatePoint)}}function Gm(e,t){return t?{point:t(e.point)}:e}function Km(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Xm({point:e},t){return{point:e,delta:Km(e,Zm(t)),offset:Km(e,Jm(t)),velocity:Qm(t,.1)}}function Jm(e){return e[0]}function Zm(e){return e[e.length-1]}function Qm(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,a=null;const s=Zm(e);for(;n>=0&&(a=e[n],!(s.timestamp-a.timestamp>Ro(t)));)n--;if(!a)return{x:0,y:0};const r=Lo(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 ep(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 tp(e,t){let n=t.min-e.min,a=t.max-e.max;return t.max-t.min{t?(this.stopAnimation(),this.snapToCursor($m(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?du[r]?null:(du[r]=!0,()=>{du[r]=!1}):du.x||du.y?null:(du.x=du.y=!0,()=>{du.x=du.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),th(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Si.test(t)){const{projection:n}=this.visualElement;if(n&&n.layout){const a=n.layout.layoutBox[e];a&&(t=zd(a)*(parseFloat(t)/100))}}this.originPoint[e]=t}),s&&ai.postRender(()=>s(e,t)),_c(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:()=>th(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:Um(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&&ai.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||!ip(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?Yi(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&&Pm(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!a)&&function(e,{top:t,left:n,bottom:a,right:s}){return{x:ep(e.x,n,s),y:ep(e.y,t,a)}}(a.layoutBox,t),this.elastic=function(e=np){return!1===e?e=0:!0===e&&(e=np),{x:ap(e,"left","right"),y:ap(e,"top","bottom")}}(n),s!==this.constraints&&a&&this.constraints&&!this.hasMutatedConstraints&&th(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||!Pm(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=sd(e,n),{scroll:s}=t;return s&&(td(a.x,s.offset.x),td(a.y,s.offset.y)),a}(n,a.root,this.visualElement.getTransformPagePoint());let r=function(e,t){return{x:tp(e.x,t.x),y:tp(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=qu(e))}return r}startAnimation(e){const{drag:t,dragMomentum:n,dragElastic:a,dragTransition:s,dragSnapToOrigin:r,onDragTransitionEnd:o}=this.getProps(),i=this.constraints||{},l=th(o=>{if(!ip(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 _c(this.visualElement,e),n.start(Ec(e,n,0,t,this.visualElement,!1))}stopAnimation(){th(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){th(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){th(t=>{const{drag:n}=this.getProps();if(!ip(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]-Yi(n,r,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!Pm(t)||!n||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};th(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=zd(e),s=zd(t);return s>a?n=To(t.min,t.max-a,e.min):a>s&&(n=To(e.min,e.max-s,t.min)),ko(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(),th(t=>{if(!ip(t,e,null))return;const n=this.getAxisMotionValue(t),{min:s,max:r}=this.constraints[t];n.set(Yi(s,r,a[t]))})}addListeners(){if(!this.visualElement.current)return;rp.set(this.visualElement,this);const e=this.visualElement.current,t=qm(e,"pointerdown",t=>{const{drag:n,dragListener:a=!0}=this.getProps(),s=t.target,r=s!==e&&bu(s);n&&a&&!r&&this.start(t)}),n=()=>{const{dragConstraints:e}=this.getProps();Pm(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()),ai.read(n);const r=dh(window,"resize",()=>this.scalePositionWithinConstraints()),o=a.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(th(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=np,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:a,dragConstraints:s,dragElastic:r,dragMomentum:o}}}function ip(e,t,n){return!(!0!==t&&t!==e||null!==n&&n!==e)}const lp=e=>(t,n)=>{e&&ai.postRender(()=>e(t,n))};let cp=!1;class up 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),cp&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),yh.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}),cp=!0,a||e.layoutDependency!==t||void 0===t||e.isPresent!==s?r.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?r.promote():r.relegate()||ai.postRender(()=>{const e=r.getStack();e&&e.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),uu.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:a}=e;cp=!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 dp(e){const[t,n]=nm(),a=s.useContext(fo);return r.jsx(up,{...e,layoutGroup:a,switchLayoutGroup:s.useContext(Tm),isPresent:t,safeToRemove:n})}const hp={pan:{Feature:class extends $u{constructor(){super(...arguments),this.removePointerDownListener=So}onPointerDown(e){this.session=new Ym(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Um(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:a}=this.node.getProps();return{onSessionStart:lp(e),onStart:lp(t),onMove:n,onEnd:(e,t)=>{delete this.session,a&&ai.postRender(()=>a(e,t))}}}mount(){this.removePointerDownListener=qm(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 $u{constructor(e){super(e),this.removeGroupControls=So,this.removeListeners=So,this.controls=new op(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||So}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:Kh,MeasureLayout:dp}};function mp(e,t,n){const{props:a}=e;e.animationState&&a.whileHover&&e.animationState.setActive("whileHover","Start"===n);const s=a["onHover"+n];s&&ai.postRender(()=>s(t,$m(t)))}function pp(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&&ai.postRender(()=>s(t,$m(t)))}const gp=new WeakMap,fp=new WeakMap,yp=e=>{const t=gp.get(e.target);t&&t(e)},bp=e=>{e.forEach(yp)};const vp={some:0,all:1},wp=_m({...Om,inView:{Feature:class extends $u{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:vp[a]};return function(e,t,n){const a=function({root:e,...t}){const n=e||document;fp.has(n)||fp.set(n,{});const a=fp.get(n),s=JSON.stringify(t);return a[s]||(a[s]=new IntersectionObserver(bp,{root:e,...t})),a[s]}(t);return gp.set(e,n),a.observe(e),()=>{gp.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 $u{mount(){const{current:e}=this.node;e&&(this.unmount=function(e,t,n={}){const[a,s,r]=mu(e,n),o=e=>{const a=e.currentTarget;if(!xu(e))return;vu.add(a);const r=t(a,e),o=(e,t)=>{window.removeEventListener("pointerup",i),window.removeEventListener("pointercancel",l),vu.has(a)&&vu.delete(a),xu(e)&&"function"==typeof r&&r(e,{success:t})},i=e=>{o(e,a===window||a===document||n.useGlobalTarget||gu(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),cu(e)&&(e.addEventListener("focus",e=>((e,t)=>{const n=e.currentTarget;if(!n)return;const a=wu(()=>{if(vu.has(n))return;Cu(n,"down");const e=wu(()=>{Cu(n,"up")});n.addEventListener("keyup",e,t),n.addEventListener("blur",()=>Cu(n,"cancel"),t)});n.addEventListener("keydown",a,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",a),t)})(e,s)),bu(e)||e.hasAttribute("tabindex")||(e.tabIndex=0))}),r}(e,(e,t)=>(pp(this.node,t,"Start"),(e,{success:t})=>pp(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends $u{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=jo(dh(this.node.current,"focus",()=>this.onFocus()),dh(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends $u{mount(){const{current:e}=this.node;e&&(this.unmount=function(e,t,n={}){const[a,s,r]=mu(e,n),o=e=>{if(!pu(e))return;const{target:n}=e,a=t(n,e);if("function"!=typeof a||!n)return;const r=e=>{pu(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)=>(mp(this.node,t,"Start"),e=>mp(this.node,e,"End"))))}unmount(){}}},...hp,layout:{ProjectionNode:Kh,MeasureLayout:dp}},Im),Cp={duration:.15,ease:[.4,0,.2,1]},xp={type:"tween",duration:.25,ease:[.4,0,.2,1]},kp={type:"tween",duration:.3,ease:[.4,0,.2,1]},Ap=s.createContext(!1);function Dp(){return s.useContext(Ap)}const Ep=s.createContext(void 0);function Bp(){return s.useContext(Ep)}const Fp="#1A1A1A",Sp="#737373",Mp={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 jp({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?kp:xp,w=d?.98:.99,C=l?8:4;return r.jsx(om,{mode:"wait",children:e&&r.jsxs(c,{static:!0,open:e,onClose:t,className:"relative z-[10010]",children:[r.jsx(wp.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:Cp,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(wp.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-bg-surface/80 backdrop-blur-xl",!h&&m&&"bg-bg-surface",!h&&"ring-1 ring-inset ring-border-subtle",Mp[n],l?"radius-card overflow-hidden pb-safe":"radius-card overflow-hidden",a),style:h?{backgroundColor:p?"#F8F8F8":"var(--bg-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(Ep.Provider,{value:h,children:r.jsx(Ap.Provider,{value:g,children:o})})})})})})]})})}function Tp({className:e,...t}){const n=Bp(),a="light"===n;return r.jsx(d,{...t,className:i("text-base font-semibold sm:text-lg",!n&&"text-text-primary",e),style:n?{color:a?Fp:"var(--text-primary)"}:void 0})}function Pp({icon:e,title:t,onClose:n,className:a}){const s=Bp(),o="light"===s;return r.jsxs("div",{className:i("flex items-center justify-between px-6 py-4 border-b",!s&&"border-border-subtle",a),style:s?{borderColor:o?"rgba(0, 0, 0, 0.12)":"var(--border-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(Tp,{children:t})]}),n&&r.jsx("button",{onClick:n,className:i("p-2 radius-inner transition-colors",!s&&"text-text-muted hover:text-text-primary hover:bg-bg-subtle"),style:s?{color:o?Sp:"var(--text-muted)"}:void 0,onMouseEnter:e=>{s&&(e.currentTarget.style.color=o?Fp:"var(--text-primary)",e.currentTarget.style.backgroundColor=o?"rgba(0, 0, 0, 0.06)":"var(--bg-subtle)")},onMouseLeave:e=>{s&&(e.currentTarget.style.color=o?Sp:"var(--text-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 Rp({className:e,...t}){return r.jsx("div",{...t,className:i("px-6 py-5",e)})}function Lp({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)})}function Np({className:e,...t}){return r.jsx("nav",{...t,className:i(e,"flex h-full min-h-0 flex-col")})}function zp({className:e,...t}){return r.jsx("div",{...t,className:i(e,"flex flex-col border-b border-border-subtle p-4","[&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function _p({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 Ip({className:e,...t}){return r.jsx("div",{...t,className:i(e,"mt-auto flex flex-col border-t border-border-subtle","[&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function Vp({className:e,...t}){const n=s.useId();return r.jsx(cm,{id:n,children:r.jsx("div",{...t,"data-slot":"section",className:i(e,"flex flex-col gap-0.5")})})}const Op=s.forwardRef(function(e,t){const{current:n,className:a,children:s,...o}=e,c=i("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?"bg-accent-primary/15 text-accent-primary [&>svg]:text-accent-primary":"text-text-muted hover:text-text-primary hover:bg-subtle-fill [&>svg]:text-text-muted hover:[&>svg]:text-text-primary","transition-all duration-150");return r.jsxs("span",{className:i(a,"relative"),children:[n&&r.jsx(wp.span,{layoutId:"sidebar-current-indicator",className:"absolute inset-y-2 -left-3 w-0.5 rounded-full bg-accent-primary"}),"string"==typeof o.href?r.jsx(A,{to:o.href,onClick:o.onClick,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,className:c,"data-current":n?"true":void 0,ref:t,children:s}):r.jsx(l,{...o,className:i("cursor-default",c),"data-current":n?"true":void 0,ref:t,children:s})]})});function $p({className:e,...t}){return r.jsx("span",{...t,className:i(e,"truncate")})}function qp({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-bg-subtle text-text-muted",accent:"bg-accent-primary/20 text-accent-primary",success:"bg-accent-success/20 text-accent-success",warning:"bg-accent-secondary/20 text-accent-secondary",danger:"bg-accent-danger/20 text-accent-danger"}[t],e)})}const Up=s.createContext(null),Wp={type:"spring",visualDuration:.35,bounce:.15};function Hp({open:e,onClose:t,children:n}){return r.jsx(om,{children:e&&r.jsxs(c,{static:!0,open:e,onClose:t,className:"lg:hidden relative z-[10002]",children:[r.jsx(wp.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(wp.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:Wp,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-text-muted hover:text-text-primary hover:bg-subtle-fill transition-colors","aria-label":"Close navigation",children:r.jsx(go,{className:"w-5 h-5"})})}),n]})})})]})})}function Yp({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(Up.Provider,{value:d,children:r.jsxs("div",{className:"flex h-screen overflow-hidden bg-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(Hp,{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(no,{className:"w-5 h-5 text-text-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 Kp({className:e,...t}){return r.jsx("div",{...t,className:i(e,"flex items-center gap-3")})}function Xp({className:e,...t}){return r.jsx("div",{"aria-hidden":"true",...t,className:i(e,"flex-1")})}const Jp="bg-bg-surface/80 backdrop-blur-lg ring-1 ring-inset ring-border-subtle",Zp={sm:"radius-inner",md:"radius-inset",lg:"radius-card",xl:"radius-hero",full:"radius-pill",none:"radius-none"};function Qp({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,elevated:t,compact:n,noPadding:a,radius:s="lg",glass:o=!0,stroke:l=!0,shadow:c,reflex:u=!1,glow:d=!1,onClick:h,className:m,style:p,...g},f){const y=c??t??!1,b=u?{...p,"--surface-reflex":"1"}:p;return r.jsx("div",{ref:f,className:i(Zp[s],o&&(t?"bg-bg-surface/85 backdrop-blur-xl":"bg-bg-surface/80 backdrop-blur-lg"),!o&&"bg-bg-surface",l&&!d&&"ring-1 ring-inset ring-border-subtle",d&&"ring-1 ring-inset ring-accent-primary/40",y&&(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"),h&&"cursor-pointer",m),style:b,onClick:h,...g,children:e})}),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-border-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-text-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-text-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-border-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-border-subtle",n),...a,children:e})});const eg=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-text-muted","row-hover hover:text-text-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(Wr,{className:"w-4 h-4"})})]})})});function tg({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(om,{initial:!1,children:s&&r.jsx(wp.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 ng({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:"text-sm font-medium",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(om,{initial:!1,mode:"wait",children:n&&r.jsxs(wp.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-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:"text-sm font-medium text-text-primary",children:e})]}),r.jsx(m,{className:"p-1 rounded hover:bg-subtle-fill-strong transition-colors",children:r.jsx(wp.span,{initial:{rotate:0},animate:{rotate:180},exit:{rotate:0},transition:{type:"spring",stiffness:400,damping:25},children:r.jsx(Wr,{className:"w-4 h-4"})})})]}),r.jsx("div",{className:"px-3 pb-3",children:l})]})})}),r.jsx(wp.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-text-muted","row-hover hover:text-text-primary","ring-focus"),children:[u,r.jsx(wp.span,{animate:{rotate:n?180:0},transition:{type:"spring",stiffness:400,damping:25},children:r.jsx(Wr,{className:"w-4 h-4"})})]})})]})}):r.jsxs(Qp,{defaultOpen:n,className:s,children:[r.jsx(eg,{...c,children:u}),r.jsx(tg,{direction:"down",children:r.jsx("div",{className:"bg-subtle-fill radius-inset mx-1 mt-1",children:l})})]})}const ag={sm:{track:"h-5 w-9",thumb:"h-3.5 w-3.5",translate:"translate-x-4",icon:"w-3 h-3"},md:{track:"h-6 w-11",thumb:"h-4 w-4",translate:"translate-x-5",icon:"w-4 h-4"},lg:{track:"h-7 w-14",thumb:"h-5 w-5",translate:"translate-x-7",icon:"w-4 h-4"}},sg=s.forwardRef(function({enabled:e,onChange:t,label:n,description:a,size:s="md",disabled:o=!1,status:l="idle",name:c,className:u},d){const h=ag[s],m="loading"===l;return r.jsxs(f,{disabled:o||m,className:i("flex items-start gap-3",u),children:[r.jsx(y,{ref:d,checked:e,onChange:t,name:c,className:i("group relative inline-flex shrink-0 items-center rounded-full transition-colors border-2",h.track,e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","disabled:opacity-50 disabled:cursor-not-allowed","ring-focus","transition-all duration-200"),children:r.jsx("span",{className:i("inline-block transform rounded-full bg-white shadow-lg transition-transform duration-200",h.thumb,e?h.translate:"translate-x-0.5")})}),(n||a)&&r.jsxs("div",{className:"flex-1 min-w-0",children:[n&&r.jsx(b,{className:i("text-sm font-medium cursor-pointer select-none",o?"text-text-muted":"text-text-primary"),children:n}),a&&r.jsx(v,{className:"text-xs text-text-muted mt-0.5",children:a})]}),"idle"!==l&&r.jsxs("div",{className:"flex items-center shrink-0",children:["loading"===l&&r.jsx(Qr,{className:i(h.icon,"text-text-muted animate-spin")}),"success"===l&&r.jsx(Ur,{className:i(h.icon,"text-accent-success")}),"error"===l&&r.jsx(go,{className:i(h.icon,"text-accent-danger")})]})]})}),rg=s.forwardRef(function({enabled:e,onChange:t,size:n="md",disabled:a=!1,"aria-label":s,className:o},l){const c=ag[n];return r.jsx(y,{ref:l,checked:e,onChange:t,disabled:a,"aria-label":s,className:i("relative inline-flex shrink-0 items-center rounded-full transition-colors border-2",c.track,e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","disabled:opacity-50 disabled:cursor-not-allowed","ring-focus","transition-all duration-200",o),children:r.jsx("span",{className:i("inline-block transform rounded-full bg-white shadow-lg transition-transform duration-200",c.thumb,e?c.translate:"translate-x-0.5")})})}),og={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"}},ig=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=og[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-bg-subtle text-text-muted text-sm",n?"border-accent-danger":"border-border-subtle"),children:o}),r.jsx("input",{ref:h,type:e,disabled:u,className:i("flex-1 min-w-0 font-mono",m.input,"bg-bg-subtle",n?"border border-accent-danger":"border-control","text-text-primary placeholder:text-text-muted",n?"ring-focus-error":"ring-focus-inset",!u&&"hover:border-border-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-bg-subtle text-text-muted text-sm",n?"border-accent-danger":"border-border-subtle"),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-text-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-bg-subtle",n?"border border-accent-danger":"border-control","text-text-primary placeholder:text-text-muted",n?"ring-focus-error":"ring-focus-inset",!u&&"hover:border-border-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-text-muted"),children:r.jsx("span",{className:m.icon,children:s})})]})}),lg=s.forwardRef(function({label:e,description:t,errorMessage:n,required:a,invalid:s,className:o,...l},c){const u=s&&n;return r.jsxs(f,{className:i("flex flex-col gap-1.5",o),children:[e&&r.jsxs(b,{className:"text-sm font-medium text-text-primary",children:[e,a&&r.jsx("span",{className:"text-accent-danger ml-0.5",children:"*"})]}),t&&!u&&r.jsx(v,{className:"text-xs text-text-muted -mt-0.5",children:t}),r.jsx(ig,{ref:c,invalid:s,...l}),u&&r.jsx("p",{className:"text-xs text-accent-danger",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(ig,{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 cg={none:"resize-none",vertical:"resize-y",horizontal:"resize-x",both:"resize"},ug=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",cg[t],"bg-bg-subtle",n?"border border-accent-danger":"border-control","text-text-primary placeholder:text-text-muted",n?"ring-focus-error":"ring-focus-inset",!a&&"hover:border-border-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(f,{className:i("flex flex-col gap-1.5",u),children:[e&&r.jsxs(b,{className:"text-sm font-medium text-text-primary",children:[e,a&&r.jsx("span",{className:"text-accent-danger ml-0.5",children:"*"})]}),t&&!m&&r.jsx(v,{className:"text-xs text-text-muted -mt-0.5",children:t}),r.jsx(ug,{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-accent-danger flex-1",children:n}):r.jsx("span",{}),o&&l&&r.jsxs("span",{className:i("text-xs",p>l?"text-accent-danger":"text-text-muted"),children:[p,"/",l]})]})]})});const dg={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"}},hg=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=dg[o];return r.jsxs(f,{disabled:l,className:i("flex items-start gap-3",d),children:[r.jsxs(w,{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-border-subtle bg-bg-subtle",(e||n)&&"border-accent-primary bg-accent-primary",!e&&!n&&!l&&"hover:border-border-strong","ring-focus","disabled:opacity-50 disabled:cursor-not-allowed"),children:[e&&!n&&r.jsx(Ur,{className:i(m.icon,"text-white stroke-[3]")}),n&&r.jsx(so,{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(b,{className:i("text-sm font-medium cursor-pointer",l?"text-text-muted":"text-text-primary"),children:a}),s&&r.jsx(v,{className:"text-xs text-text-muted mt-0.5",children:s})]})]})});s.createContext({variant:"default",divider:"subtle",grid:!0});const mg="0.9.232",pg="'JetBrains Mono', monospace",gg=s.memo(function({height:e=16,responsive:t=!1,className:n=""}){const a="var(--accent-primary)",s="var(--text-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: ${pg};\n }\n .logo-accent {\n fill: var(--accent-primary, #719CDF);\n }\n .logo-main {\n fill: var(--text-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:pg,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"})]})}),fg="pymc_jwt_token",yg="pymc_client_id",bg="pymc_remember_me",vg=new Set;function wg(e){for(const n of vg)try{n(e)}catch(t){}}function Cg(){let e=localStorage.getItem(yg);return e||(e=`${Date.now()}-${Math.random().toString(36).substring(2,15)}`,localStorage.setItem(yg,e)),e}function xg(){return"true"===localStorage.getItem(bg)}function kg(e){e?localStorage.setItem(bg,"true"):localStorage.removeItem(bg)}function Ag(){return xg()?localStorage:sessionStorage}function Dg(){return Ag().getItem(fg)||localStorage.getItem(fg)||sessionStorage.getItem(fg)}function Eg(e){Ag().setItem(fg,e),xg()?sessionStorage.removeItem(fg):localStorage.removeItem(fg),wg(e)}function Bg(){localStorage.removeItem(fg),sessionStorage.removeItem(fg),wg(null)}function Fg(){return!(!Dg()||Mg()&&(Bg(),1))}function Sg(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 Mg(){const e=Dg();if(!e)return!0;const t=Sg(e);return!t||!t.exp||Date.now()>=1e3*t.exp-6e4}function jg(){const e=Dg();if(!e)return 0;const t=Sg(e);return t&&t.exp?Math.max(0,Math.floor((1e3*t.exp-Date.now())/1e3)):0}function Tg(){const e=Dg();if(!e)return!1;const t=Sg(e);if(!t||!t.exp)return!1;const n=1e3*t.exp-Date.now();return n>0&&n<3e5}async function Pg(e,t,n=!1){kg(n);try{const n=await fetch("/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t,client_id:Cg()})}),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?(Eg(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=Dg();if(!e)return!1;const t=Sg(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:Cg()})});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){Eg(n.token);const e=Sg(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 Lg=null;async function Ng(){const e=Dg();if(!e)return!1;const t=Sg(e);return(null==t?void 0:t.exp)&&Math.floor((1e3*t.exp-Date.now())/1e3),!Tg()||Lg||(Lg=Rg().finally(()=>{Lg=null}),Lg)}let zg=!1;const _g="",Ig=new Map;let Vg=!1;async function Og(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=Ig.get(a);if(e)return e}const s=`${e}`;!n&&Tg()&&await Rg();const r=Dg();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&&!Vg&&await Rg())return Og(e,t,!0);throw Vg||(Vg=!0,Bg(),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&&(Ig.set(a,i),i.finally(()=>{Ig.delete(a)})),i}const $g={spreadingFactor:7,bandwidthHz:125e3,codingRate:5,preambleLength:8,crcEnabled:!0,explicitHeader:!0};function qg(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 Ug(e,t={}){return void 0!==e.airtime_ms&&e.airtime_ms>0?e.airtime_ms:function(e,t={}){const n=t.spreadingFactor??$g.spreadingFactor,a=t.bandwidthHz??$g.bandwidthHz,s=t.codingRate??$g.codingRate,r=t.preambleLength??$g.preambleLength??8,o=t.crcEnabled??$g.crcEnabled?1:0,i=t.explicitHeader??$g.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}(qg(e),t)}function Wg(e){return e&&"chat node"===e.toLowerCase()?"Companion":e}async function Hg(){return function(e){if(e.neighbors)for(const t of Object.values(e.neighbors))t.contact_type=Wg(t.contact_type);return e}(await Og("/api/stats"))}async function Yg(){return Og("/api/logs")}async function Gg(e=24){return Og(`/api/noise_floor_history?hours=${e}`)}const Kg=new Map;function Xg(e=!1){if(e)Kg.clear();else for(const[t]of Kg)parseInt(t.split("-")[0],10)<=60&&Kg.delete(t)}function Jg(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)??$g.spreadingFactor,bandwidthHz:(null==n?void 0:n.bandwidth)??$g.bandwidthHz,codingRate:(null==n?void 0:n.coding_rate)??$g.codingRate,preambleLength:(null==n?void 0:n.preamble_length)??$g.preambleLength,crcEnabled:!0,explicitHeader:!0}}(a):$g,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=Ug(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 Zg(e=24){return Og(`/api/crc_count?hours=${e}`)}async function Qg(){return Og("/api/hardware_stats")}async function ef(){return Og("/api/hardware_processes")}async function tf(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),Og("/api/update_radio_config",{method:"POST",body:JSON.stringify(t)})}async function nf(){return Og("/api/send_advert",{method:"POST",body:"{}"})}async function af(e){return Og("/api/set_mode",{method:"POST",body:JSON.stringify({mode:e})})}async function sf(e){return Og("/api/set_duty_cycle",{method:"POST",body:JSON.stringify({enabled:e})})}async function rf(e){try{return await Og("/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 of(){return Og("/api/identities")}async function lf(e){const t=(new URLSearchParams).toString();return Og("/api/room_stats"+(t?"?"+t:""))}async function cf(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=Dg();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 cf(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 uf(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=>df(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 cf(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 df(e,t,n,a){let s=t,r=0,o=0;for(;s>e&&o<100;){o++;const t=await cf(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=Dg();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 hf="pymc-packet-cache",mf="pymc-packet-cache-meta",pf=36e5,gf=2592e5,ff=6048e5,yf=12096e5,bf=5e5,vf=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}),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}}getDataTier(){return this.meta.dataTier}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>pf}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 uf(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"===e?2:"7d"===e?6: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 uf(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>=gf,this.meta.threeDayLoadComplete&&(this.meta.dataTier="3d")):"7d"===e?(this.meta.sevenDayLoadComplete=t>=ff,this.meta.sevenDayLoadComplete&&(this.meta.dataTier="7d")):(this.meta.fourteenDayLoadComplete=t>=yf,this.meta.fourteenDayLoadComplete&&(this.meta.dataTier="14d")),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;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-yf)/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 uf(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},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<=bf)return;const e=this.getPackets(),t=e.length-bf;for(let n=0;nt&&(this.meta.oldestTimestamp=e[t].timestamp??0)}loadFromStorage(){if("undefined"!=typeof window)try{const e=localStorage.getItem(mf);e&&(this.meta=JSON.parse(e));const t=localStorage.getItem(hf);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>pf)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(mf,JSON.stringify(this.meta));const e=this.getPackets(),t=e.length>3e3?e.slice(-3e3):e;localStorage.setItem(hf,JSON.stringify(t))}catch(e){if(e instanceof DOMException&&"QuotaExceededError"===e.name)try{localStorage.removeItem(hf),localStorage.setItem(mf,JSON.stringify(this.meta))}catch{}}}clearStorage(){if("undefined"!=typeof window)try{localStorage.removeItem(hf),localStorage.removeItem(mf)}catch(e){}}async fetchRecentPackets(e=1e3,t=!1){const n=`/api/recent_packets?limit=${e}`,a=Dg(),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(vf,"SAVE_DEBOUNCE_MS",1e4);const wf=new vf;function Cf(e){return{paths:e.paths,byEndpoints:new Map(e.byEndpointsEntries),canonicalPaths:new Map(e.canonicalPathsEntries),totalObservations:e.totalObservations,uniquePathCount:e.uniquePathCount}}function xf(){return{paths:[],byEndpoints:new Map,canonicalPaths:new Map,totalObservations:0,uniquePathCount:0}}const kf=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:xf(),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-DXqcQ1Nq.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?Cf(t.pathRegistry):xf(),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()}},Af=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()}},Df=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=Dg(),t=Cg(),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())},vg.add(n),()=>vg.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=Dg();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=D(e=>({connectionState:"disconnected",isSupported:!0,reconnectAttempt:0,lastConnected:null,initialize:()=>{Df.onConnectionChange((t,n)=>{e(e=>({connectionState:t,reconnectAttempt:n??0,isSupported:Df.isSupported(),lastConnected:"connected"===t?Date.now():e.lastConnected}))}),Df.connect()}})),Bf=.05,Ff=1e3,Sf="terrarium";function Mf(e,t,n){try{return e.queryTerrainElevation({lng:t,lat:n})??0}catch{return 0}}const jf=D((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(Sf)||(a.addSource(Sf,{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===Sf&&t.isSourceLoaded&&(clearTimeout(n),a.off("sourcedata",s),e())};a.on("sourcedata",s)})),a.setTerrain({source:Sf}),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>Ff&&(o=Ff),i>Ff&&(i=Ff);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-Bf,maxLat:a+Bf,minLng:s-Bf,maxLng:r+Bf}}(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}})),Tf="pymc-stealth-location";function Pf(e){if("undefined"!=typeof window)try{localStorage.setItem(Tf,JSON.stringify(e))}catch{}}function Rf(e){return!isNaN(e)&&e>=-90&&e<=90}function Lf(e){return!isNaN(e)&&e>=-180&&e<=180}const Nf=function(){if("undefined"==typeof window)return{};try{const e=localStorage.getItem(Tf);if(!e)return{};const t=JSON.parse(e);if("number"==typeof t.latitude&&"number"==typeof t.longitude&&"boolean"==typeof t.enabled&&Rf(t.latitude)&&Lf(t.longitude))return t}catch{}return{}}(),zf=D((e,t)=>({latitude:Nf.latitude??null,longitude:Nf.longitude??null,enabled:Nf.enabled??!1,setLocation:(n,a)=>{Rf(n)&&Lf(a)&&(e({latitude:n,longitude:a}),Pf({latitude:n,longitude:a,enabled:t().enabled}))},enable:()=>{const{latitude:n,longitude:a}=t();null!==n&&null!==a&&(e({enabled:!0}),Pf({latitude:n,longitude:a,enabled:!0}))},disable:()=>{e({enabled:!1});const{latitude:n,longitude:a}=t();null!==n&&null!==a&&Pf({latitude:n,longitude:a,enabled:!1})},clear:()=>{e({latitude:null,longitude:null,enabled:!1}),function(){if("undefined"!=typeof window)try{localStorage.removeItem(Tf)}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 _f(e,t,n,a){return!t&&a>=3?"offline":n?"connected"!==e&&t||a>0&&a<3?"degraded":"connected":"offline"}const If=D((e,t)=>({wsState:"disconnected",wsReconnectAttempt:0,restHealthy:!0,lastSuccessfulFetch:null,consecutiveFailures:0,authValid:!0,authExpiresIn:null,health:"connected",bannerDismissed:!1,isInitializing:!0,initialize:()=>{Df.onConnectionChange((n,a)=>{const{restHealthy:s,authValid:r,consecutiveFailures:o,health:i,isInitializing:l}=t(),c=l&&"connected"===n,u=_f(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=_f(a,l,s,i);e({restHealthy:l,lastSuccessfulFetch:c,consecutiveFailures:i,health:u,bannerDismissed:"connected"!==u&&u===o&&t().bannerDismissed})},updateAuthState:()=>{const n=Fg()&&!Mg(),a=jg(),{wsState:s,restHealthy:r,consecutiveFailures:o,health:i}=t(),l=_f(s,r,n,o);e({authValid:n,authExpiresIn:a>0?a:null,health:l,bannerDismissed:l===i&&t().bannerDismissed})},dismissBanner:()=>{e({bannerDismissed:!0})}})),Vf=()=>If(e=>e.health),Of=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-Cwma4a6C.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}},$f=3,qf=2,Uf=15,Wf=6,Hf=3,Yf=0,Gf=1,Kf=2,Xf=3,Jf={[Yf]:"T_FLOOD",[Gf]:"FLOOD",[Kf]:"DIRECT",[Xf]:"T_DIRECT"},Zf=0,Qf=1,ey=2,ty=3,ny=4,ay=5,sy=6,ry=7,oy=8,iy=9,ly=10,cy=11,uy=15,dy={REQ:0,RESPONSE:1,ADVERT:4,GRP_TXT:5,GRP_DATA:6,ANON_REQ:7,TRACE:9},hy={[Zf]:"REQ",[Qf]:"RESPONSE",[ey]:"TXT_MSG",[ty]:"ACK",[ny]:"ADVERT",[ay]:"GRP_TXT",[sy]:"GRP_DATA",[ry]:"ANON_REQ",[oy]:"PATH",[iy]:"TRACE",[ly]:"MULTIPART",[cy]:"CONTROL",[uy]:"RAW_CUSTOM"},my=1,py=32,gy=64,fy=64,yy=4,by=1,vy=2,wy=3,Cy=4,xy=16,ky=128,Ay=15;function Dy(e){return 1===e||0===e}function Ey(e){return 2===e||3===e}function By(e){return 0===e||3===e}function Fy(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 Jf[e]??`UNKNOWN(${e})`}function My(e){return hy[e]??`UNKNOWN(${e})`}function jy(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 Py(e,t=!0){const n=(255&e).toString(16).padStart(2,"0");return t?n.toUpperCase():n}function Ry(e,t,n,a){if(e+t>n)throw new Error(a)}function Ly(e){if(e>256)throw new Error(`payload too large: ${e} > 256`)}function Ny(){return"undefined"!=typeof crypto&&void 0!==crypto.subtle&&"function"==typeof crypto.subtle.digest}const zy=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]),_y=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);function Iy(e,t){return(e>>>t|e<<32-t)>>>0}function Vy(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=Iy(t[u-15&15],7)^Iy(t[u-15&15],18)^t[u-15&15]>>>3,n=Iy(t[u-2&15],17)^Iy(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+(Iy(o,6)^Iy(o,11)^Iy(o,25))+(o&i^~o&l)+zy[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+((Iy(n,2)^Iy(n,13)^Iy(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 Oy(e){const t=new Uint32Array(_y),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 Yy(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 Gy(e){for(let t=0;t<16;t++)e[t]=Uy[e[t]]}function Ky(e,t){for(let n=0;n<16;n++)e[n]^=t[n]}function Xy(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]=Hy(14,a)^Hy(11,s)^Hy(13,r)^Hy(9,o),e[n+1]=Hy(9,a)^Hy(14,s)^Hy(11,r)^Hy(13,o),e[n+2]=Hy(13,a)^Hy(9,s)^Hy(14,r)^Hy(11,o),e[n+3]=Hy(11,a)^Hy(13,s)^Hy(9,r)^Hy(14,o)}}function Jy(e,t){const n=new Uint8Array(e);Ky(n,t[10]);for(let a=9;a>=1;a--)Yy(n),Gy(n),Ky(n,t[a]),Xy(n);return Yy(n),Gy(n),Ky(n,t[0]),n}function Zy(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=qy[t]^Wy[a/16-1],t=qy[s],s=qy[r],r=qy[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 nb(e,t){return e[t]|e[t+1]<<8}function ab(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function sb(e,t,n){t[n]=255&e,t[n+1]=e>>8&255}function rb(e){return(e instanceof Uint8Array?Array.from(e):e).map(e=>Py(e,!0)).join("->")}const ob={name:"Public",secret:"8b3387e9c5cdea6ac9e5edbaa115cd72"},ib=["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","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 lb(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 $y(a)).slice(0,16),r=(await $y(s))[0],o=new Uint8Array(32);return o.set(s),{name:`#${t}`,channelHash:r,aesKey:s,hmacKey:o,autoDiscovered:!0}}let cb=null,ub=null;const db=new Map;let hb=null;const mb="pymc_discovered_channels";function pb(e){db.set(e.channelHash,e),e.autoDiscovered&&function(){try{const e=[];for(const t of db.values())t.autoDiscovered&&e.push({name:t.name,hash:t.channelHash});localStorage.setItem(mb,JSON.stringify(e))}catch(e){}}()}async function gb(){cb||(ub||(ub=(async()=>{await async function(){try{const e=localStorage.getItem(mb);if(!e)return;const t=JSON.parse(e);for(const{name:n}of t)try{const e=await lb(n);db.set(e.channelHash,e)}catch{}t.length}catch(e){}}();const e=await async function(){const{default:e}=await C(async()=>{const{default:e}=await import("./generated-geo-channels-CkSMgZLG.js");return{default:e}},[]);return[...ib,...e]}(),t=new Map;for(const n of e)try{const e=await lb(n),a=t.get(e.channelHash)||[];a.push(e),t.set(e.channelHash,a)}catch{}cb=t})()),await ub)}async function fb(e,t,n){const a=await async function(e,t){if(Ny())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(Oy(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 bb(e,t,n){await gb();const a=await async function(){return hb||(hb=await async function(e,t=!1){const n=jy(e.secret),a=(await $y(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}}(ob)),hb}();if(a.channelHash===e&&await fb(a.hmacKey,t,n))return{channelName:"Public",plaintext:Zy(a.aesKey,n),keys:a};const s=db.get(e);if(s&&await fb(s.hmacKey,t,n)){const e=Zy(s.aesKey,n);return{channelName:s.name,plaintext:e,keys:s}}const r=(null==cb?void 0:cb.get(e))||[],o=[];for(const l of r){if(await fb(l.hmacKey,t,n)){pb(l);const e=Zy(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=Zy(l.aesKey,n),t=yb(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 vb(e){return await gb(),((null==cb?void 0:cb.get(e))||[]).map(e=>e.name)}async function wb(e,t,n,a){try{const s=await lb(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 fb(s.hmacKey,n,a)))return{success:!1,error:"MAC verification failed - wrong channel name or corrupted data"};const r=Zy(s.aesKey,a);return pb(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 Cb=null,xb=[];function kb(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 Ab=D((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)===dy.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(xb.map(e=>e.packet_hash)),t=l.filter(t=>!e.has(t.packet_hash));return void(t.length>0&&xb.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 Of.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,kb(e));e({messages:a}),Cb&&clearTimeout(Cb),Cb=setTimeout(()=>{e({stableMessages:new Map(t().messages),lastSnapshotUpdate:Date.now()})},500)}});Cb&&(clearTimeout(Cb),Cb=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}}),xb.length>0){const e=xb;xb=[],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 lb(e.startsWith("#")?e.slice(1):e)}(e);return{name:t.name,channelHash:t.channelHash,aesKeyHex:Ty(t.aesKey),hmacKeyHex:Ty(t.hmacKey)}}(s),l=a.filter(e=>{if((e.type??e.payload_type)!==dy.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 Of.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,kb(e));e({messages:a}),Cb&&clearTimeout(Cb),Cb=setTimeout(()=>{e({stableMessages:new Map(t().messages),lastSnapshotUpdate:Date.now()})},500)}});Cb&&(clearTimeout(Cb),Cb=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:()=>{Cb&&(clearTimeout(Cb),Cb=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 Db(e){return Ab(t=>t.messages.get(e))}function Eb(){return Ab(e=>e.progress)}function Bb(){return Ab(e=>e.initialDecodeComplete)}function Fb(){return Ab(e=>e.stableMessages)}function Sb(){return Ab(e=>e.stableMessages)}const Mb=[{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}],jb=[{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}];function Tb(e,t=12){return Math.max(t,Math.round(e/15))}const Pb={hero:Tb(1200),statsCard:Tb(380)};function Rb(e){switch(e){case 1:return 3600;case 3:case 12:return 5400;case 24:return 8640;case 72:case 168:case 336:return 720;default:{const t=3600*e,n=Math.round(t/10);return Math.min(Math.max(360,n),720)}}}const Lb="'JetBrains Mono', 'SF Mono', Monaco, monospace",Nb={stats:3e3,logs:2e3,system:3e3},zb={DEBUG:"text-sys-brown",INFO:"text-sys-cyan",WARNING:"text-sys-amber",ERROR:"text-sys-red",CRITICAL:"text-sys-pink"};function _b(e){return zb[e]??"text-text-muted border-border-subtle"}function Ib(e){return e?(e.startsWith("0x")?e.slice(2):e).slice(0,2).toUpperCase():""}function Vb(e,t){if(!e)return"expired";const n=t/1e3-e;return n<=10800?"active":n<=86400?"stale":"expired"}function Ob(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 $b={critical:0,high:150,medium:300,low:450};let qb=!1;const Ub=[],Wb=new Set;function Hb(e,t="medium"){if(qb){const n=setTimeout(()=>{e(),Wb.delete(n)},$b[t]);return Wb.add(n),()=>{clearTimeout(n),Wb.delete(n)}}{const n={callback:e,priority:t};return Ub.push(n),()=>{const e=Ub.indexOf(n);-1!==e&&Ub.splice(e,1)}}}function Yb(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2,4).toUpperCase():e.slice(0,2).toUpperCase()}function Gb(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?Yb(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 Kb(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?Yb(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 Xb(e,t){const n=e.toUpperCase();return t.startsWith("0x")||t.startsWith("0X")?t.slice(2).toUpperCase().startsWith(n):t.toUpperCase().startsWith(n)}function Jb(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:dr(n)?t.length<=1:0===t.length;var a}(e)}function Zb(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)?Yb(s)===t?null:s:null}function Qb(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 ev(e){return{hash:e,count:0,rssiSum:0,rssiCount:0,snrSum:0,snrCount:0,lastSeen:0}}function tv(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:Yb(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 nv="pymc-hidden-contacts",av="pymc-quick-neighbors",sv="pymc-local-hash",rv="pymc-global-time-range";let ov=null;function iv(){if("undefined"==typeof window)return[];try{const e=localStorage.getItem(av);if(e)return JSON.parse(e)}catch{}return[]}function lv(e){"undefined"!=typeof window&&(ov&&clearTimeout(ov),ov=setTimeout(()=>{try{localStorage.setItem(av,JSON.stringify(e))}catch{}ov=null},1e3))}function cv(){if("undefined"!=typeof window)try{const e=localStorage.getItem(sv);if(e)return e}catch{}}function uv(e){if("undefined"!=typeof window)try{localStorage.setItem(sv,e)}catch{}}function dv(){if("undefined"==typeof window)return new Set;try{const e=localStorage.getItem(nv);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function hv(){if("undefined"==typeof window)return 4;try{const e=localStorage.getItem(rv);if(e){const t=parseInt(e,10);if(!isNaN(t)&&t>=0&&t<=7)return t>4?4:t}}catch{}return 4}const mv=D((e,t)=>({stats:null,statsLoading:!1,statsError:null,packets:wf.getPackets(),packetsLoading:!1,packetsError:null,lastPacketTimestamp:wf.getNewestTimestamp(),logs:[],logsLoading:!1,liveMode:!0,flashReceived:0,flashAdvert:0,pendingAdvertLocalHash:null,pendingAdvertTimestamp:null,resourceHistory:[],lastResourceFetch:0,hardwareStats:null,hardwareStatsLoading:!1,hardwareStatsError:null,hiddenContacts:dv(),quickNeighbors:iv(),cachedLocalHash:cv(),initialized:!1,packetCacheState:wf.getState(),mutationsInFlight:new Set,globalTimeRangeIndex:hv(),initializeApp:async()=>{const{initialized:n}=t();if(n)return;e({initialized:!0,statsLoading:!0,packetsLoading:!0}),wf.subscribe(t=>{e({packetCacheState:t})});const{hiddenContacts:a}=t();let s=0;Hg().then(t=>{const n=Ob(t.neighbors,a),s=t.local_hash;e({stats:t,statsLoading:!1,quickNeighbors:n,cachedLocalHash:s}),lv(n),s&&uv(s)}).catch(t=>{e({statsError:t instanceof Error?t.message:"Failed to fetch stats",statsLoading:!1})}),wf.initialLoad(()=>{const t=Date.now();if(t-s>=50){s=t;const n=wf.getPackets();if(n.length>0){const t=wf.getNewestTimestamp();e({packets:n,lastPacketTimestamp:t})}}}).then(n=>{if(n.length>0){const a=wf.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(!qb){qb=!0;for(const e of Ub){const t=$b[e.priority],n=setTimeout(()=>{e.callback(),Wb.delete(n)},t);Wb.add(n)}Ub.length=0}}(),16),setTimeout(()=>{Ab.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(),Df.onPacket(n=>{const{lastPacketTimestamp:a,mutationsInFlight:s}=t();if(s.size>0)return;wf.mergePacketsDirectly([n]);const r=n.timestamp??0;if(r>a){const n=wf.getPackets();e({packets:n,flashReceived:t().flashReceived+1,lastPacketTimestamp:r}),Xg()}Ab.getState().queueDecryption([n])}),Df.onStats(n=>{const{mutationsInFlight:a,hiddenContacts:s}=t();if(a.size>0)return;const r=Ob(n.neighbors,s),o=n.local_hash;e({stats:n,statsLoading:!1,statsError:null,quickNeighbors:r,cachedLocalHash:o}),lv(r),o&&uv(o)}),Df.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(()=>{wf.isHeavyLoadInProgress()||e().mutationsInFlight.size>0||e().fetchStats().then(()=>{If.getState().updateRestHealth(!0)}).catch(()=>{If.getState().updateRestHealth(!1)})},Nb.stats),function t(){const n=Df.isConnected()?15e3:3e3;setTimeout(async()=>{e().liveMode&&!wf.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&&(Df.resetSupported(),Df.isConnected()?await Df.verifyConnection(3e3)||(Df.disconnect(),Df.connect()):Df.isSupported()&&Df.connect()),e().fetchStats({force:!0}),e().fetchPackets())})}}(t),t().fetchHardwareStats(),setInterval(()=>{"undefined"!=typeof document&&document.hidden||t().fetchHardwareStats()},Nb.system)},prefetchForRoute:e=>{switch(e){case"/logs":Yg().catch(()=>{});break;case"/system":Qg().catch(()=>{});break;case"/statistics":(async function(e=24){return Og(`/api/packet_type_graph_data?hours=${e}`)})(3).catch(()=>{}),Gg(3).catch(()=>{});break;case"/settings":(async function(){return Og("/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 Hg(),n=Ob(t.neighbors,r),a=t.local_hash;e({stats:t,statsLoading:!1,quickNeighbors:n,cachedLocalHash:a}),lv(n),a&&uv(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 wf.poll(),r=wf.getNewestTimestamp(),o=r>s&&s>0,i=n.length!==a.length||o;o&&(e({flashReceived:t().flashReceived+1}),Xg()),i?(e({packets:n,packetsLoading:!1,lastPacketTimestamp:r||s}),Ab.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 Yg();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 af(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 sf(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 Og("/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 nf();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 Qg();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(nv,JSON.stringify([...e]))}catch{}}(s)},clearPacketCache:()=>{wf.clear(),e({packets:[],lastPacketTimestamp:0}),wf.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=zf.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=jf.getState().getTerrainGridForDisambiguation();kf.compute(r,c,u,d,h,void 0,m,p??void 0)},triggerDeepAnalysis:async()=>{await wf.forceDeepLoad();const n=wf.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=Yb(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=Yb(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(!Jb(c))continue;const e=Zb(c.src_hash,s,o,r);if(!e)continue;let t=i.get(e);t||(t=ev(e),i.set(e,t)),Qb(t,c)}for(const[c,u]of Object.entries(t))Yb(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=tv(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}),lv(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&&Af.compute(e,r)},requestSevenDayData:async()=>{let n=0;await wf.loadSevenDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:wf.getPackets()}))});const a=wf.getPackets();e({packets:a,lastPacketTimestamp:wf.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Ab.getState().queueDecryption(a)},{timeout:2e3})},requestThreeDayData:async()=>{let n=0;await wf.loadThreeDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:wf.getPackets()}))});const a=wf.getPackets();e({packets:a,lastPacketTimestamp:wf.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Ab.getState().queueDecryption(a)},{timeout:2e3})},requestFourteenDayData:async()=>{let n=0;await wf.loadFourteenDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:wf.getPackets()}))});const a=wf.getPackets();e({packets:a,lastPacketTimestamp:wf.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Ab.getState().queueDecryption(a)},{timeout:5e3})},setGlobalTimeRange:n=>{e({globalTimeRangeIndex:n}),function(e){if("undefined"!=typeof window)try{localStorage.setItem(rv,e.toString())}catch{}}(n);const{packetCacheState:a,requestThreeDayData:s,requestSevenDayData:r,requestFourteenDayData:o,triggerTopologyCompute:i,triggerSparklineCompute:l}=t();let c=!1;if(5!==n||a.threeDayLoadComplete||a.isBackgroundLoading||(s(),c=!0),6!==n||a.sevenDayLoadComplete||a.isBackgroundLoading||(r(),c=!0),7!==n||a.fourteenDayLoadComplete||a.isBackgroundLoading||(o(),c=!0),!c&&n>=5&&(i(),l()),!c){const{packets:e}=t();Ab.getState().queueDecryption(e)}}})),pv=mv,gv=()=>mv(e=>e.stats),fv=()=>mv(e=>e.statsError),yv=()=>mv(e=>e.packets),bv=()=>mv(e=>e.packetsLoading),vv=()=>mv(e=>e.logs),wv=()=>mv(e=>e.logsLoading),Cv=()=>mv(e=>e.liveMode),xv=()=>mv(e=>e.fetchLogs),kv=()=>mv(e=>e.setLiveMode),Av=()=>mv(e=>e.resourceHistory),Dv=()=>mv(e=>e.hardwareStats),Ev=()=>mv(e=>e.hardwareStatsLoading),Bv=()=>mv(e=>e.hardwareStatsError),Fv=()=>mv(e=>e.fetchHardwareStats),Sv=()=>mv(e=>e.hiddenContacts),Mv=()=>mv(e=>e.hideContact),jv=()=>mv(e=>e.packetCacheState),Tv=()=>mv(e=>e.quickNeighbors),Pv=()=>mv(e=>e.cachedLocalHash),Rv=()=>mv(e=>e.lastPacketTimestamp),Lv=()=>mv(e=>e.globalTimeRangeIndex),Nv=()=>mv(e=>e.setGlobalTimeRange),zv=()=>mv(e=>null!==e.stats&&e.packetCacheState.backgroundLoadComplete),_v=()=>mv(e=>e.packets.length>0);function Iv(){const e=mv(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=mv(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=mv(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=zf(e=>e.latitude),s=zf(e=>e.longitude),r=zf(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 Vv={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 Ov({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 $v({showLabel:e=!1,className:t}){const n=mv(e=>e.flashReceived),a=mv(e=>e.flashAdvert),o=Ef(e=>"connected"===e.connectionState),l=Vf(),c=If(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=Vv.healthy,g=!1,f="LIVE",y="Real-time (WebSocket)";c?(p=Vv.connecting,g=!0,f="WAIT",y="Connecting..."):"offline"===l?(p=Vv.offline,g=!0,f="DOWN",y="Cannot reach server"):"degraded"===l?(p=Vv.degraded,f="POLL",y="Real-time unavailable, using REST polling"):o?(p=Vv.healthy,f="LIVE",y="Real-time (WebSocket)"):(p=Vv.healthy,f="POLL",y="Database polling");const b="rx"===u?Vv.rx:"tx"===u?Vv.tx:Vv.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-bg-body border border-border-subtle",children:[r.jsx(Ov,{color:p,pulse:g}),r.jsx(Ov,{color:b})]}),e&&r.jsx("span",{className:i("font-mono text-[10px] tracking-wider","DOWN"===f?"text-status-danger":"WAIT"===f?"text-accent-primary":"POLL"===f?"text-status-warning":"text-text-muted"),children:f})]})}function qv({borderRadius:e}){return r.jsx(wp.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(--accent-primary) 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 Uv({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(om,{children:t&&r.jsx(qv,{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-bg-elevated",e),children:r.jsx(wp.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(--accent-primary) 50%,\n transparent 100%\n )",backgroundSize:"200% 100%"}})})}const Hv=D(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(()=>{Af.subscribe((e,t)=>{const n=Hv.getState();t&&!n.isComputing?n.setComputing(!0):!t&&e.size>0?n.setSparklines(e):!t&&n.isComputing&&n.setComputing(!1)})},0);const Yv=()=>Hv(e=>e.sparklines),Gv=()=>Hv(e=>e.isComputing),Kv=[],Xv=new Map;function Jv(e){return Hv(t=>{const n=t.sparklines.get(e);if(!n||0===n.length)return Kv;const a=Xv.get(e);return a===n?a:(Xv.set(e,n),n)})}const Zv="pymc_room_seen_",Qv="pymc_room_selected";function ew(e){try{const t=localStorage.getItem(`${Zv}${e}`);return t?Number(t):0}catch{return 0}}function tw(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([lf(),of()]),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,ew(e.room_name));const c=aw(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(Qv)}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(Qv,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()),Og(`/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:tw([...s,...a])})}else e({messages:tw(t.data.messages)})}catch(o){}},postMessage:async e=>{try{return!!(await async function(e){return Og("/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()),Og(`/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),Og(`/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),Og(`/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(`${Zv}${e}`,String(t))}catch{}}(n,r);const o=new Map(s);o.set(n,r),e({lastSeenMap:o,unreadCount:aw(a,o)})},createRoom:async e=>{try{return!!(await async function(e){return Og("/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 Og("/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 Og(`/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 Og("/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)}}}),rw=()=>sw(e=>e.rooms),ow=()=>sw(e=>e.selectedRoom),iw=()=>sw(e=>e.messages),lw=()=>sw(e=>e.clients),cw=()=>sw(e=>e.identities),uw=()=>sw(e=>e.isLoading),dw=()=>sw(e=>e.rooms.find(t=>t.room_name===e.selectedRoom)??null),hw=()=>sw(e=>e.identities.find(t=>{var n;return t.name===e.selectedRoom||(null==(n=t.settings)?void 0:n.node_name)===e.selectedRoom})??null),mw=D(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:xf(),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&&kf.subscribe((e,t)=>{mw.getState().setTopology(e,t)});const pw=()=>mw(e=>e.topology),gw=()=>mw(e=>e.topology.hubNodes),fw=()=>mw(e=>e.topology.centrality),yw=()=>mw(e=>e.topology.fullAffinity),bw=()=>mw(e=>e.isComputing),vw=()=>mw(e=>e.lastUpdated);let ww=null,Cw=null,xw=null,kw=null;const Aw=()=>mw(e=>(e.topology.hubNodes!==Cw&&(Cw=e.topology.hubNodes,ww=new Set(e.topology.hubNodes)),ww)),Dw=()=>mw(e=>e.topology.pathHealth),Ew=()=>mw(e=>e.topology.disambiguationStats),Bw=()=>mw(e=>e.topology.disambiguationStats.highCollisionPrefixes),Fw=()=>mw(e=>e.topology.disambiguationStats.totalPrefixes>0),Sw=()=>mw(e=>e.topology.discoveredNodes),Mw=()=>mw(e=>e.topology.viterbiStats),jw=()=>mw(e=>(e.topology.discoveredNodes!==kw&&(kw=e.topology.discoveredNodes,xw=e.topology.discoveredNodes.filter(e=>e.isLikelyReal)),xw)),Tw=()=>mw(e=>e.topology.nodeMetrics),Pw=()=>mw(e=>e.topology.communityCount);let Rw=null,Lw=null;const Nw=()=>mw(e=>{if(e.topology.nodeMetrics!==Lw){Lw=e.topology.nodeMetrics,Rw={local:0,hub:0,gateway:0,backbone:0,neighbor:0,mobile:0,ghost:0,standard:0};for(const t of e.topology.nodeMetrics.values())Rw[t.nodeClass]++}return Rw});function zw(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 _w(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 Iw(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 Vw(e){return new Date(1e3*e).toLocaleString()}function Ow(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 $w(e){return new Date(1e3*e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function qw(e){return`${(e/1e6).toFixed(3)} MHz`}function Uw(e){return`${(e/1e3).toFixed(1)} kHz`}function Ww(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 Hw(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 Yw(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 Ks({...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 Gw=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-text-secondary whitespace-nowrap",children:e.label}),void 0!==e.value&&r.jsx("span",{className:"text-text-muted tabular-nums",children:e.formatValue?e.formatValue(e.value):e.value})]},e.key)})})}),Kw="#AD7F58",Xw={4:"#3B82F6",5:"#5B5BD6",6:"#8E4EC6",0:"#00A2C7",2:"#12A594",7:"#46A758",1:"#F5D90A",10:"#FFB224",8:"#F76B15",9:"#E5484D",3:"#D6409F",15:Kw},Jw=Kw;function Zw(e){return Xw[e]??Jw}let Qw=null,eC=0;const tC=1e3;function nC({activeTypes:e,totalByType:t}){const n=[...e].reverse().map(e=>({key:String(e),label:lr[e]??`TYPE_${e}`,color:Zw(e),value:t[e]??0,formatValue:e=>Yw(e)}));return r.jsx(Gw,{items:n})}const aC=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(Qw&&e-eC{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-text-muted",children:"No data available"}):r.jsx("div",{ref:i,className:"w-full h-full",onMouseMove:y,onMouseLeave:b})}),sC=new Map;function rC(e){var t;if(!e.startsWith("var("))return e;const n=sC.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 sC.set(e,o),o}const oC="undefined"!=typeof document&&"light"!==document.documentElement.dataset.mode?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.3)";function iC(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)}))},x=(e,t)=>i?i===e?Math.min(1,1.5*t):"minMax"===i||"p5p95"===i||"p25p75"===i?.3*t:t:t,k=e=>i?i===e?1:"mean"===i||"median"===i||"average"===i?.3:1:1,A={band:rC(l.band),innerBand:rC(l.innerBand),mean:rC(l.mean),median:rC(l.median),average:rC(l.average)};c.save(),c.strokeStyle=A.average,c.lineWidth=4,c.globalAlpha=k("average"),iC(c,C.average),c.stroke(),c.globalAlpha=x("minMax",.15),c.fillStyle=A.band,c.beginPath(),iC(c,C.max);const D=[...C.min].reverse();for(const e of D)c.lineTo(e.x,e.y);c.closePath(),c.fill(),c.globalAlpha=x("p5p95",.3),c.fillStyle=A.band,c.beginPath(),iC(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=x("p25p75",.55),c.fillStyle=A.innerBand,c.beginPath(),iC(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=A.median,c.lineWidth=1.5,c.globalAlpha=k("median"),c.setLineDash([4,4]),iC(c,C.median),c.stroke(),c.strokeStyle=A.mean,c.lineWidth=1.5,c.globalAlpha=k("mean"),c.setLineDash([]),iC(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 Ks({...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 x=s.useCallback(()=>{null==n||n(null)},[n]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available"}):r.jsx("div",{ref:h,className:"w-full h-full rounded-2xl overflow-hidden",onMouseLeave:x})});const lC="undefined"!=typeof window&&(null==(t=null==(e=window.matchMedia)?void 0:e.call(window,"(color-gamut: p3)"))?void 0:t.matches);let cC=null,uC=0;function dC(){const e=performance.now();if(cC&&e-uC<1e3)return cC;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 cC={fontFamily:n,axisColor:s,gridColor:r,textMuted:o,textPrimary:i,signalCritical:l,bgBody:c},uC=e,cC}const hC=["min","max","p75","p95","p99","mean","median","average","midpoint"];function mC(e){const t=mr(function(e){const{colormap:t,baseIndex:n,halfSize:a}=fr(),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 pC(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],x=C.length;if(0===x)return;const k=C[0],A=C[x-1],D=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)}(D):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&&D>=20){g.save();const e=y+v*(1-20/D);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 L=B;Ln+s)return;const i=dC().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)}}(dC().signalCritical);e.save(),e.globalAlpha=u,e.fillStyle=lC?`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,k,A,w,u?Math.max(.03,.03*p):p)}s.memo(function({data:e,maxValue:t,visibleLines:n=hC,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),x=s.useRef(i),k=s.useRef(l),A=s.useRef(c),D=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,x.current=i,k.current=l,A.current=c,D.current=d,E.current=h,T.current=j,S.current=p,M.current=u}),s.useEffect(()=>{B.current=dC()},[]);const R=s.useMemo(()=>[e.map(e=>e.timestamp),new Array(e.length).fill(1)],[e]),L=s.useMemo(()=>({hooks:{draw:e=>{const t=B.current||dC();pC(e,y.current,b.current,v.current,w.current,t,x.current,k.current,A.current,D.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:[L]}),[L]);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(R),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 Ks({...N,width:o,height:i},R,t);return f.current=l,P.current=a,()=>{l.destroy(),f.current=null}},[N,R,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-text-muted",children:"No data available"}):r.jsx("div",{ref:g,className:"w-full h-full rounded-lg overflow-hidden",onMouseMove:z,onMouseLeave:_})});const gC=-70;let fC=null,yC=0;function bC(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 vC(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 wC(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 CC(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 xC=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<=gC);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:bC(r,5),p95:bC(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<=gC);if(0===e.length)return{heatmapData:null,xLabels:[],yLabels:[]};const a=[...e].sort((e,t)=>e-t),r=bC(a,5),o=bC(a,95),i=.1*(o-r||1);n=r-i,s=o+i}else{const e=t.filter(e=>e<=gC);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;agC)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 x=[];for(let e=0;e{g.current=v,f.current=a});const x=s.useMemo(()=>{if(0===e.length)return[[],[]];const t=new Array(e.length).fill(1);return[e,t]},[e]),k=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(fC&&e-yC<1e3)return fC;const t=getComputedStyle(document.documentElement);return fC={heatGradient:[vC(t.getPropertyValue("--sys-purple").trim()),vC(t.getPropertyValue("--sys-blue").trim()),vC(t.getPropertyValue("--sys-teal").trim()),vC(t.getPropertyValue("--sys-amber").trim()),vC(t.getPropertyValue("--sys-orange").trim())],trendLineColor:vC(t.getPropertyValue("--accent-secondary").trim()),stabilityHot:vC(t.getPropertyValue("--sys-amber").trim()),stabilityCool:vC(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)"}},yC=e,fC}();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`}}}}),[]),A=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:[k]}),[k,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 Ks({...A,width:a,height:s},x,t);return h.current=r,()=>{r.destroy(),h.current=null}},[A,x,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-text-secondary tabular-nums 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-border-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-text-muted"}),r.jsx("div",{className:"type-data-xs text-text-primary tabular-nums"}),r.jsx("div",{className:"type-data-xs text-text-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(Yr,{className:"w-3.5 h-3.5 text-text-muted","aria-hidden":"true"}):r.jsx(uo,{className:"w-3.5 h-3.5 text-text-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-text-secondary tabular-nums absolute top-1",style:{left:`${e.pos}%`,transform:"translateX(-50%)"},children:e.label},t))})]}):a?r.jsx("div",{className:"w-full rounded bg-bg-subtle/50",style:{height:o??28},"aria-hidden":"true"}):r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No noise floor data available"})});let kC=null,AC=0;function DC(){const e=performance.now();if(kC&&e-AC<1e3)return kC;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 kC={fontFamily:n,axisColor:s,gridColor:r,textMuted:o,textPrimary:i,signalCritical:l,bgBody:c},AC=e,kC}function EC(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 BC(e){return EC(Zw(e))}const FC=s.memo(function({scatterData:e,yAxisMode:t,onHover:n,noiseFloorAnomalies:a=null,showNoiseFloorOverlay:o=!1,overlayOpacity:i=.5,highlightedType:l=null,timeRangeHours:c=24}){const u=s.useRef(null),d=s.useRef(null),h=s.useRef(e),m=s.useRef(t),p=s.useRef(n),g=s.useRef(a),f=s.useRef(o),y=s.useRef(i),b=s.useRef(l),v=s.useRef(null),w=s.useRef(null),C=c<=12?1.2:1,x=s.useRef(C),k=(null==e?void 0:e.maxValue)??("share"===t?200:10),A=s.useRef(k);s.useLayoutEffect(()=>{h.current=e,m.current=t,p.current=n,g.current=a,f.current=o,y.current=i,b.current=l,x.current=C,A.current=k}),s.useEffect(()=>{v.current=DC()},[]);const D=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]),E=s.useMemo(()=>({hooks:{draw:e=>{const t=v.current||DC();!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,x=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 A=x;An+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=1*i*(window.devicePixelRatio||1);e.globalCompositeOperation="source-over";const p=o?parseInt(o.replace("TYPE_",""),10):null;for(let g=0;g0&&function(e,t,n,a,s,r,o,i,l,c,u){if(0===t.length)return;const d=i-o||1,h=EC(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,h.current,A.current,m.current,t,g.current,f.current,y.current,b.current,x.current,w.current)}}}),[]),B=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:[E]}),[E]);s.useEffect(()=>{const t=u.current;if(!t||!e||0===e.count)return;d.current&&d.current.destroy();const n=t.getBoundingClientRect(),a=Math.floor(n.width)||400,s=Math.floor(n.height)||200,r=new Ks({...B,width:a,height:s},D,t);return d.current=r,()=>{r.destroy(),d.current=null}},[B,D,null==e?void 0:e.count]),s.useEffect(()=>{const e=u.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!d.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&d.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{d.current&&d.current.redraw()},[e,a,o,i,l,C,t]);const F=s.useCallback(t=>{var n,a;const s=u.current,r=d.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,h=c.left/l,m=c.width/l;if(ih+m)return w.current=null,r.redraw(),void(null==(n=p.current)||n.call(p,null,void 0));w.current=i*l;const g=(i-h)/m,f=Math.floor(g*e.count),y=Math.max(0,Math.min(e.count-1,f));r.redraw(),null==(a=p.current)||a.call(p,y,g)},[null==e?void 0:e.count]),S=s.useCallback(()=>{var e;w.current=null,d.current&&d.current.redraw(),null==(e=p.current)||e.call(p,null,void 0)},[]);return e&&0!==e.count?r.jsx("div",{ref:u,className:"w-full h-full rounded-lg overflow-hidden",onMouseMove:F,onMouseLeave:S}):r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available"})}),SC=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 MC(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 jC(e){return"undefined"==typeof window?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function TC(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}(jC(e))}function PC(e,t){const[n,a]=s.useState(t),r=s.useCallback(()=>{a(e())},[e]);return s.useEffect(()=>(r(),SC.subscribe(r)),[r]),n}const RC={chart1:"#719CDF",chart2:"#0074BE",chart3:"#6FBCBD",chart4:"#DFBC72",chart5:"#719872",chart6:"#E12672",chart7:"#E17899",chart8:"#999ABD"},LC="#00FF00",NC="#8CE619",zC="#FFD900",_C="#FF8C26",IC="#FF3333",VC={primary:"#719CDF",secondary:"#DFBC72",tertiary:"#6FBCBD",success:"#719872",danger:"#E12672"},OC={primary:"#E4E4E4",secondary:"#BFBFBF",muted:"#727272"},$C={nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hubColor:"#8E4EC6",hubStroke:"rgba(255,255,255,0.9)",gatewayColor:"#5B5BD6",gatewayStroke:"rgba(255,255,255,0.85)",localColor:"#FFB224",neighborColor:"#FFB224",neighborStroke:"rgba(0,0,0,0.4)",mobileColor:"#F76B15",roomColor:"#D6409F",ghostColor:"#00A2C7"};function qC(){return"undefined"==typeof window?RC:{chart1:jC("--chart-1")||RC.chart1,chart2:jC("--chart-2")||RC.chart2,chart3:jC("--chart-3")||RC.chart3,chart4:jC("--chart-4")||RC.chart4,chart5:jC("--chart-5")||RC.chart5,chart6:jC("--chart-6")||RC.chart6,chart7:jC("--chart-7")||RC.chart7,chart8:jC("--chart-8")||RC.chart8}}function UC(){return"undefined"==typeof window?OC:{primary:jC("--text-primary")||OC.primary,secondary:jC("--text-secondary")||OC.secondary,muted:jC("--text-muted")||OC.muted}}function WC(){return"undefined"==typeof window?VC:{primary:jC("--accent-primary")||VC.primary,secondary:jC("--accent-secondary")||VC.secondary,tertiary:jC("--accent-tertiary")||VC.tertiary,success:jC("--accent-success")||VC.success,danger:jC("--accent-danger")||VC.danger}}function HC(){return PC(qC,RC)}function YC(){return PC(UC,OC)}function GC(){return PC(WC,VC)}function KC(){return"undefined"==typeof window?$C:{nodeFill:jC("--map-node-fill")||$C.nodeFill,nodeStroke:jC("--map-node-stroke")||$C.nodeStroke,hubColor:jC("--map-hub-color")||$C.hubColor,hubStroke:jC("--map-hub-stroke")||$C.hubStroke,gatewayColor:jC("--map-gateway-color")||$C.gatewayColor,gatewayStroke:jC("--map-gateway-stroke")||$C.gatewayStroke,localColor:jC("--map-local-color")||$C.localColor,neighborColor:jC("--map-neighbor-color")||$C.neighborColor,neighborStroke:jC("--map-neighbor-stroke")||$C.neighborStroke,mobileColor:jC("--map-mobile-color")||$C.mobileColor,roomColor:jC("--map-room-color")||$C.roomColor,ghostColor:jC("--map-ghost-color")||$C.ghostColor}}function XC(){return PC(KC,$C)}const JC={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)"},ZC={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 QC(e){if("undefined"==typeof window)return $C;const t="light"===function(){if("undefined"==typeof window)return"dark";const e=document.querySelector("[data-basemap]");return e&&e.getAttribute("data-basemap")||"dark"}()?JC:ZC;return{nodeFill:TC("--map-node-fill")||$C.nodeFill,nodeStroke:t.nodeStroke,hubColor:TC("--map-hub-color")||$C.hubColor,hubStroke:t.hubStroke,gatewayColor:TC("--map-gateway-color")||$C.gatewayColor,gatewayStroke:t.gatewayStroke,localColor:TC("--map-local-color")||$C.localColor,neighborColor:TC("--map-neighbor-color")||$C.neighborColor,neighborStroke:t.neighborStroke,mobileColor:TC("--map-mobile-color")||$C.mobileColor,roomColor:TC("--map-room-color")||$C.roomColor,ghostColor:TC("--map-ghost-color")||$C.ghostColor}}const ex={rest:"#4B4B4B",restBright:"#616161",restDim:"#3F3F3F",hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:"#8A8A8A",hoverNeighbor:"#FBBF24",highlight:"#FFD700"},tx={rest:"rgba(0, 0, 0, 0.20)",restBright:"rgba(0, 0, 0, 0.30)",restDim:"rgba(0, 0, 0, 0.12)"},nx={rest:"rgba(255, 255, 255, 0.25)",restBright:"rgba(255, 255, 255, 0.35)",restDim:"rgba(255, 255, 255, 0.15)"};function ax(e){if("undefined"==typeof window)return ex;const t="light"===e?tx:nx;return{rest:t.rest,restBright:t.restBright,restDim:t.restDim,hoverDirect:TC("--map-edge-hover-direct")||ex.hoverDirect,hoverLoop:TC("--map-edge-hover-loop")||ex.hoverLoop,hoverStandard:TC("--map-edge-hover-standard")||ex.hoverStandard,hoverNeighbor:TC("--map-edge-hover-neighbor")||ex.hoverNeighbor,highlight:TC("--map-edge-highlight")||ex.highlight}}const sx={grid:"rgba(128, 128, 128, 0.15)",axisTick:"#808080",cursor:"rgba(128, 128, 128, 0.3)"};function rx(){return"undefined"==typeof window?sx:{grid:jC("--chart-grid")||sx.grid,axisTick:jC("--chart-axis-tick")||sx.axisTick,cursor:jC("--chart-cursor")||sx.cursor}}function ox(){return PC(rx,sx)}function ix(e,t){return jC(`--palette-${e}-${t}`)||""}function lx(){const e=[];for(let t=0;t<24;t++){const n=t/23,a=1-n,s=ix("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 cx(){const e=jC("--signal-excellent")||LC,t=jC("--signal-good")||NC,n=jC("--signal-fair")||zC,a=jC("--signal-poor")||_C,s=jC("--signal-critical")||IC,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 ux(){const e=TC("--signal-excellent")||LC,t=TC("--signal-good")||NC,n=TC("--signal-fair")||zC,a=TC("--signal-poor")||_C,s=TC("--signal-critical")||IC,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 dx(){const[e,t]=s.useState(()=>cx());return s.useEffect(()=>{const e=()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t(cx())})})};return e(),SC.subscribe(e)},[]),e}function hx(e){const t=(Math.max(-12,Math.min(12,e))- -12)/24;return Math.round(23*(1-t))}const mx={red:"#E5484D",orange:"#F76B15",amber:"#FFB224",yellow:"#F5D90A",brown:"#AD7F58",green:"#46A758",teal:"#12A594",cyan:"#00A2C7",blue:"#3B82F6",indigo:"#5B5BD6",purple:"#8E4EC6",pink:"#D6409F"};function px(){return"undefined"==typeof window?mx:{red:TC("--sys-red")||mx.red,orange:TC("--sys-orange")||mx.orange,amber:TC("--sys-amber")||mx.amber,yellow:TC("--sys-yellow")||mx.yellow,brown:TC("--sys-brown")||mx.brown,green:TC("--sys-green")||mx.green,teal:TC("--sys-teal")||mx.teal,cyan:TC("--sys-cyan")||mx.cyan,blue:TC("--sys-blue")||mx.blue,indigo:TC("--sys-indigo")||mx.indigo,purple:TC("--sys-purple")||mx.purple,pink:TC("--sys-pink")||mx.pink}}function gx(){const e=s.useCallback(()=>"undefined"==typeof document||"light"!==document.documentElement.dataset.mode,[]),[t,n]=s.useState(e);return s.useEffect(()=>(n(e()),SC.subscribe(()=>n(e()))),[e]),t}function fx(){return"undefined"==typeof document||"light"!==document.documentElement.dataset.mode}let yx=null,bx=0;function vx(){const e=performance.now();if(yx&&e-bx<1e3)return yx;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 yx={fontFamily:n,textPrimary:s,textSecondary:r,gridColor:o},bx=e,yx}function wx(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 Cx=null,xx=0;function kx(e,t){return"airtime"===t?`${e}%`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function Ax(e,t,n,a,s,r,o,i,l,c,u,d=.9,h=!1){if(0===t.length)return;const m=t[0].timestamp,p=t[t.length-1].timestamp-m||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{l.current=e,c.current=t,u.current=n,d.current=a}),s.useEffect(()=>{h.current=vx()},[]);const p=s.useMemo(()=>0===e.length?[[0],[0]]:[e.map(e=>e.timestamp),e.map(()=>1)],[e]),g=s.useMemo(()=>({hooks:{draw:e=>{const t=h.current||vx();!function(e,t,n,a,s,r){if(0===t.length)return;const o=e.ctx,{left:i,top:l,width:c,height:u}=e.bbox,d=window.devicePixelRatio||1;if(c<=0||u<=0)return;const h=function(){const e=performance.now();return Cx&&e-xx<1e3||(Cx=px(),xx=e),Cx}(),m=wx(h.blue),p=wx(h.red),g=wx(h.yellow),f=(y=n,"airtime"===a?y<=5?1:y<=10?2:y<=20?5:Math.ceil(y/5):y<=100?25:y<=500?100:y<=1e3?200:y<=5e3?1e3:y<=1e4?2e3:1e3*Math.ceil(y/5e3));var y;o.save(),o.strokeStyle=s.textSecondary,o.globalAlpha=.3,o.lineWidth=1*d,o.setLineDash([3*d,3*d]);for(let v=f;vn+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()))}(o,r,i,l,c,u,d,s),Ax(o,t,"rxSmooth",g,i,l,c,u,n,d,2,1,!0),Ax(o,t,"tx",p,i,l,c,u,n,d,2.5,.9,!1),Ax(o,t,"rx",m,i,l,c,u,n,d,2.5,.9,!1)}(e,l.current,u.current,c.current,t,m.current)}}}),[]),f=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:[g]}),[g]);s.useEffect(()=>{const t=o.current;if(!t||0===e.length)return;i.current&&i.current.destroy();const n=t.getBoundingClientRect(),a=Math.floor(n.width)||400,s=Math.floor(n.height)||200,r=new Ks({...f,width:a,height:s},p,t);return i.current=r,()=>{r.destroy(),i.current=null}},[f,p,e.length]),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()}},[]),s.useEffect(()=>{i.current&&i.current.redraw()},[e,n,t]);const y=s.useCallback(t=>{var n,a;const s=o.current,r=i.current;if(!s||!r||0===e.length)return;const l=s.getBoundingClientRect(),c=t.clientX-l.left,u=window.devicePixelRatio||1,h=r.bbox,p=h.left/u,g=h.width/u;if(cp+g)return m.current=null,r.redraw(),void(null==(n=d.current)||n.call(d,null));m.current=c*u;const f=(c-p)/g,y=Math.floor(f*e.length),b=Math.max(0,Math.min(e.length-1,y));r.redraw(),null==(a=d.current)||a.call(d,b)},[e.length]),b=s.useCallback(()=>{var e;m.current=null,i.current&&i.current.redraw(),null==(e=d.current)||e.call(d,null)},[]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available"}):r.jsx("div",{ref:o,className:"w-full h-full rounded-lg overflow-hidden",onMouseMove:y,onMouseLeave:b})}),Ex=[{name:"Dashboard",to:"/",icon:Jr},{name:"Contacts",to:"/contacts",icon:to},{name:"Packets",to:"/packets",icon:Zr},{name:"Room Server",to:"/room-server",icon:ao},{name:"Statistics",to:"/statistics",icon:qr},{name:"MeshGraph",to:"/meshgraph",icon:po},{name:"System",to:"/system",icon:Kr},{name:"Logs",to:"/logs",icon:Gr},{name:"Terminal",to:"/terminal",icon:mo},{name:"Configuration",to:"/configuration",icon:co}];function Bx(){var e,t,n,a,o,l;const{pathname:c}=E(),{stats:u,setMode:d,setDutyCycle:h,sendAdvert:m}=pv(),p=function(){const e=Dg();if(!e)return null;const t=Sg(e);return t&&t.sub?t.sub:null}(),g=mv(e=>e.prefetchForRoute),f=jv(),y=mv(e=>e.packetCacheState.dataTier),b=Lv(),v=Math.max(1,Math.ceil(Mb[b].minutes/60)),w=Gv(),C=bw(),x=jw(),k=sw(e=>e.unreadCount);let A=null;try{A=function(){const e=s.useContext(Up);if(!e)throw new Error("useSidebar must be used within a SidebarLayout");return e}()}catch{}const[D,B]=s.useState(!1),[F,S]=s.useState("idle"),[M,j]=s.useState(null),[T,P]=s.useState([]),R=s.useRef(null),L=s.useCallback(e=>{e!==c&&(R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{g(e)},100))},[c,g]),N=s.useCallback(()=>{R.current&&(clearTimeout(R.current),R.current=null)},[]);s.useEffect(()=>{const e=async()=>{var e;try{const t=await Gg(v);t.success&&(null==(e=t.data)?void 0:e.history)&&P(t.data.history)}catch{}};e();const t=setInterval(e,6e4);return()=>clearInterval(t)},[v]);const z=null==u?void 0:u.noise_floor_dbm,_=(null==(t=null==(e=null==u?void 0:u.config)?void 0:e.repeater)?void 0:t.mode)??"forward",I=(null==(a=null==(n=null==u?void 0:u.config)?void 0:n.duty_cycle)?void 0:a.enforcement_enabled)??!1,V=(null==(l=null==(o=null==u?void 0:u.config)?void 0:o.duty_cycle)?void 0:l.max_airtime_percent)??10,O=f.isLoading||f.isBackgroundLoading||f.isTopologyLoading,$=O||w||C,q=f.loadProgress,U=()=>{null==A||A.close()};return r.jsxs(Np,{children:[r.jsxs(zp,{className:"px-5 py-6",children:[r.jsx("h1",{className:"sr-only",children:"pyMC Console"}),r.jsx(gg,{responsive:!0,className:"block"}),r.jsxs("p",{className:"type-data-xs text-text-muted mt-1.5",children:["v",mg]})]}),r.jsxs(_p,{className:"py-4",children:[r.jsx(Vp,{children:Ex.map(e=>{const t=c===e.to;return r.jsxs(Op,{href:e.to,current:t,onClick:U,onMouseEnter:()=>L(e.to),onMouseLeave:N,children:[r.jsxs("span",{className:"relative",children:[r.jsx(e.icon,{}),"/room-server"===e.to&&k>0&&r.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-accent-danger ring-2 ring-bg-body"})]}),r.jsx($p,{children:e.name}),"/contacts"===e.to&&x.length>0&&r.jsxs(qp,{variant:"accent",children:[r.jsx(Xr,{className:"w-3 h-3"}),r.jsx("span",{children:x.length})]}),"/meshgraph"===e.to&&r.jsx(qp,{variant:"default",children:"Beta"})]},e.name)})}),$&&r.jsx("div",{className:"px-0 py-3",children:r.jsx(Uv,{isLoading:O,borderRadius:12,children:r.jsxs("div",{className:"bg-glass-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-accent-primary opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-accent-primary"})]}),r.jsx("span",{className:"type-data-xs text-text-muted flex-1 truncate",children:f.isLoading&&q?"Loading 24h history...":f.isBackgroundLoading&&q?f.statusMessage||`Loading ${y} history...`:f.isTopologyLoading?"Loading topology data...":w?"Computing sparklines":C?"Building topology":"Analyzing database"}),null!==(null==q?void 0:q.percent)&&void 0!==(null==q?void 0:q.percent)&&O&&r.jsxs("span",{className:"type-data-xs text-text-muted tabular-nums",children:[q.percent,"%"]})]}),r.jsx("div",{className:"mt-1.5 h-1 bg-subtle-fill rounded-full overflow-hidden",children:null!==(null==q?void 0:q.percent)&&void 0!==(null==q?void 0:q.percent)&&O?r.jsx("div",{className:"h-full bg-accent-primary/60 rounded-full transition-all duration-300 ease-out",style:{width:`${q.percent}%`}}):r.jsx("div",{className:"h-full bg-accent-primary/40 rounded-full w-full"})}),!O&&r.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 px-1",children:[r.jsx("span",{className:"type-micro text-text-muted",children:"Data:"}),r.jsx("span",{className:"type-data-xs text-accent-primary",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}})(y)})]})]})})}),r.jsx("div",{className:"flex-1"}),r.jsx(ng,{label:"Controls",icon:r.jsx(ho,{className:"w-5 h-5 text-accent-primary"}),defaultOpen:!1,direction:"up",dataId:"controls",children:r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(Nr,{color:"success"===F?"success":"error"===F?"danger":"primary",onClick:async()=>{B(!0),S("idle"),j(null);const e=await m();B(!1),e.success?(S("success"),setTimeout(()=>S("idle"),1500)):(S("error"),j(e.error||"Failed to send"),setTimeout(()=>{S("idle"),j(null)},3e3))},disabled:D,className:"w-full justify-center",children:D?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"===F?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"===F?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(lo,{"data-slot":"icon"}),"Send Advert"]})}),M&&r.jsx("p",{className:"text-accent-danger text-xs text-center",children:M}),r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-xs text-text-muted",children:"Repeat"}),r.jsx("span",{className:i("text-xs font-medium","forward"===_?"text-accent-success":"text-accent-secondary"),children:"forward"===_?"ON":"OFF"})]}),r.jsx(Nr,{color:"forward"===_?"success":"warning",onClick:()=>{d("forward"===_?"monitor":"forward")},className:"w-full justify-center",children:"forward"===_?r.jsxs(r.Fragment,{children:[r.jsx(oo,{"data-slot":"icon"}),"Repeating"]}):r.jsxs(r.Fragment,{children:[r.jsx(ro,{"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-text-muted",children:"Duty Cycle"}),r.jsx("span",{className:i("text-xs font-medium tabular-nums",I?"text-accent-secondary":"text-text-muted"),children:I?`${V}%`:"OFF"})]}),r.jsxs(Nr,{color:I?"warning":"muted",onClick:()=>{h(!I)},className:"w-full justify-center",children:[r.jsx(Kr,{"data-slot":"icon"}),I?`Limited to ${V}%`:"Disabled"]})]})})]}),r.jsx(Ip,{children:r.jsxs("div",{className:"p-3 flex flex-col gap-1",children:[void 0!==(null==u?void 0:u.uptime_seconds)&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[r.jsx(Hr,{className:"w-5 h-5 text-text-muted flex-shrink-0"}),r.jsxs("span",{className:"type-data-xs text-text-secondary tabular-nums",children:[zw(u.uptime_seconds)," uptime"]})]}),r.jsxs("div",{className:"flex items-center gap-3 px-3 pt-2 pb-0.5",children:[r.jsx(io,{className:"w-5 h-5 text-accent-primary flex-shrink-0"}),r.jsx("span",{className:"type-data-xs text-text-muted",children:"Noise Floor"}),r.jsx("span",{className:"ml-auto type-data text-text-primary tabular-nums",children:null!=z?`${z.toFixed(0)} dBm`:"—"})]}),T.length>0&&r.jsx("div",{className:"px-3 pt-1 pb-1",children:r.jsxs("div",{className:"relative rounded-sm border-x border-border-strong bg-transparent overflow-hidden py-2",children:[r.jsx("div",{className:"absolute inset-y-0 left-0 w-2 bg-gradient-to-r from-sys-amber/15 to-transparent pointer-events-none"}),r.jsx("div",{className:"absolute inset-y-0 right-0 w-2 bg-gradient-to-l from-sys-amber/15 to-transparent pointer-events-none"}),r.jsx(xC,{timestamps:T.map(e=>e.timestamp),values:T.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($v,{showLabel:!0}),(null==u?void 0:u.version)&&r.jsxs("span",{className:"type-data-xs text-text-muted truncate",title:`v${u.version}`,children:["v",u.version]})]}),r.jsxs("button",{onClick:()=>{Bg(),window.location.href="/login"},className:"flex items-center gap-3 px-3 py-2 rounded-xl text-text-muted hover:text-accent-danger hover:bg-accent-danger/10 transition-all duration-150",children:[r.jsx(eo,{className:"w-5 h-5 flex-shrink-0"}),r.jsx("span",{className:"type-body-sm",children:"Sign Out"}),p&&r.jsxs("span",{className:"ml-auto type-data-xs",children:["(",p,")"]})]})]})})]})}function Fx(){const e=jv(),t=e.isLoading||e.isBackgroundLoading||e.isTopologyLoading;return r.jsxs(Gp,{children:[r.jsxs(Kp,{children:[r.jsx("h1",{className:"sr-only",children:"pyMC Console"}),r.jsx(gg,{height:26,className:"block"}),t&&r.jsx(Wv,{className:"ml-2"})]}),r.jsx(Xp,{}),r.jsxs(Kp,{children:[r.jsxs("p",{className:"type-data-xs text-text-muted",children:["v",mg]}),r.jsx($v,{})]})]})}const Sx=s.memo(function(){const{theme:e}=or(),{backgroundImage:t,brightness:n,colorScheme:a}=e,s=xe(a),o=(null==s?void 0:s.meta.backgroundImage)||null==s?void 0:s.meta.backgroundColor,i=(100-n)/100;return r.jsxs(r.Fragment,{children:[t?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(${t})`}})}):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"})]})}),Mx=20,jx=12,Tx=s.createContext(null);function Px({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+Mx+e.width+jx>r?n-Mx-e.width:n+Mx,l=Math.max(jx,Math.min(l,r-e.width-jx)),c=s-Mx-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 Lx({label:e}){return r.jsx("div",{className:"min-h-[50vh]","aria-label":`Loading ${e}`,"aria-busy":"true"})}function Nx(){return r.jsx(Lx,{label:"dashboard"})}function zx(){return r.jsx(Lx,{label:"list"})}function _x(){return r.jsx(Lx,{label:"map"})}function Ix(){return r.jsx(Lx,{label:"charts"})}function Vx(){return r.jsx(Lx,{label:"settings"})}function Ox(){return r.jsx(Lx,{label:"system"})}function $x({children:e}){return r.jsx(r.Fragment,{children:e})}const qx=s.lazy(()=>C(()=>import("./Login-CEaQVZyH.js"),__vite__mapDeps([0,1,2,3,4]))),Ux=s.lazy(()=>C(()=>import("./Dashboard-D3Izm5d2.js"),__vite__mapDeps([5,1,6,7,8,9,2,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,3,27,28,29,30,31,4]))),Wx=s.lazy(()=>C(()=>import("./Packets-CQBNFl_1.js"),__vite__mapDeps([32,1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,9,2,33,6,34,29,3,4]))),Hx=s.lazy(()=>C(()=>import("./Contacts-CATHuNF1.js").then(e=>e.C),__vite__mapDeps([35,1,36,6,37,2,38,18,26,12,13,39,22,19,15,34,40,33,17,23,27,41,42,3,43,4]))),Yx=s.lazy(()=>C(()=>import("./Statistics-Dyj9B1d4.js"),__vite__mapDeps([44,1,45,20,46,8,9,2,6,19,15,41,42,3,18,17,29,21,47,38,27,22,31,48,43,4]))),Gx=s.lazy(()=>C(()=>import("./MeshGraph-DCyLnsQa.js"),__vite__mapDeps([49,1,50,51,2,38,24,19,15,39,20,48,16,43,3,4]))),Kx=s.lazy(()=>C(()=>import("./System-BYZJTRWn.js"),__vite__mapDeps([52,1,6,18,29,14,43,22,53,31,3,4]))),Xx=s.lazy(()=>C(()=>import("./Logs-CX6fCEhO.js"),__vite__mapDeps([54,1,45,6,29,3,4]))),Jx=s.lazy(()=>C(()=>import("./Terminal-DTrsKkeR.js"),__vite__mapDeps([55,1,56,13,51,36,3,11,57,58,6,4,59]))),Zx=s.lazy(()=>C(()=>import("./Configuration-Csaz7snm.js"),__vite__mapDeps([60,1,57,40,18,61,28,6,19,15,29,47,31,62,23,53,16,3,4]))),Qx=s.lazy(()=>C(()=>import("./RoomServer-BBBzVK_B.js"),__vite__mapDeps([63,1,6,31,37,2,40,18,17,58,30,29,62,15,33,3,4])));function ek({children:e}){const t=E();return Fg()?r.jsx(r.Fragment,{children:e}):r.jsx(S,{to:"/login",state:{from:t},replace:!0})}class tk 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-accent-red mb-2",children:"Page failed to render"}),r.jsx("p",{className:"type-body text-text-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-accent-primary/20 text-accent-primary rounded-lg hover:bg-accent-primary/30 transition-colors",children:"Try Again"})]}):this.props.children}}function nk(){const e=mv(e=>e.initializeApp),t=Fg();return s.useEffect(()=>{if(!t)return;e(),If.getState().initialize(),sw.getState().initialize();const n=setInterval(()=>{Ng()},3e4);return Ng(),function(){if(zg)return;if("undefined"==typeof document)return;const e=async()=>{if("visible"!==document.visibilityState)return;if(!Dg())return;if(Mg())return Bg(),void("undefined"==typeof window||window.location.pathname.includes("/login")||(window.location.href="/login"));const e=jg();e>0&&e<300&&await Rg()};document.addEventListener("visibilitychange",e),zg=!0,"visible"===document.visibilityState&&e()}(),()=>clearInterval(n)},[e,t]),r.jsxs(Px,{children:[r.jsx(Sx,{}),r.jsxs(B,{children:[r.jsx(F,{path:"/login",element:r.jsx(s.Suspense,{fallback:r.jsx("div",{className:"min-h-screen bg-bg-body"}),children:r.jsx(qx,{})})}),r.jsx(F,{path:"/*",element:r.jsx(ek,{children:r.jsx(Yp,{sidebar:r.jsx(Bx,{}),navbar:r.jsx(Fx,{}),children:r.jsx("div",{className:"px-4 sm:px-6 lg:px-8 pt-5 pb-4 sm:pb-6 lg:pb-8 max-w-7xl mx-auto",children:r.jsx(tk,{children:r.jsxs(B,{children:[r.jsx(F,{path:"/",element:r.jsx(s.Suspense,{fallback:r.jsx(Nx,{}),children:r.jsx($x,{children:r.jsx(Ux,{})})})}),r.jsx(F,{path:"/packets",element:r.jsx(s.Suspense,{fallback:r.jsx(zx,{}),children:r.jsx($x,{children:r.jsx(Wx,{})})})}),r.jsx(F,{path:"/contacts",element:r.jsx(s.Suspense,{fallback:r.jsx(_x,{}),children:r.jsx($x,{children:r.jsx(Hx,{})})})}),r.jsx(F,{path:"/statistics",element:r.jsx(s.Suspense,{fallback:r.jsx(Ix,{}),children:r.jsx($x,{children:r.jsx(Yx,{})})})}),r.jsx(F,{path:"/meshgraph",element:r.jsx(s.Suspense,{fallback:r.jsx(Ix,{}),children:r.jsx($x,{children:r.jsx(Gx,{})})})}),r.jsx(F,{path:"/system",element:r.jsx(s.Suspense,{fallback:r.jsx(Ox,{}),children:r.jsx($x,{children:r.jsx(Kx,{})})})}),r.jsx(F,{path:"/logs",element:r.jsx(s.Suspense,{fallback:r.jsx(zx,{}),children:r.jsx($x,{children:r.jsx(Xx,{})})})}),r.jsx(F,{path:"/terminal",element:r.jsx(s.Suspense,{fallback:r.jsx(zx,{}),children:r.jsx($x,{children:r.jsx(Jx,{})})})}),r.jsx(F,{path:"/room-server",element:r.jsx(s.Suspense,{fallback:r.jsx(zx,{}),children:r.jsx($x,{children:r.jsx(Qx,{})})})}),r.jsx(F,{path:"/configuration",element:r.jsx(s.Suspense,{fallback:r.jsx(Vx,{}),children:r.jsx($x,{children:r.jsx(Zx,{})})})})]})})})})})})]})]})}const ak=console.warn;console.warn=(...e)=>{const t=e[0];"string"==typeof t&&t.includes("Unable to load glyph range")||ak.apply(console,e)},k.createRoot(document.getElementById("root")).render(r.jsx(s.StrictMode,{children:r.jsx(rr,{children:r.jsx(M,{children:r.jsx(nk,{})})})}));export{cr as $,om as A,Nr as B,hg as C,Mb as D,dy as E,Sb as F,_w as G,Nv as H,ig as I,Of as J,jp as K,$v as L,so as M,Rp as N,Wr as O,gg as P,Qr as Q,io as R,nC as S,Rx as T,aC as U,fv as V,_v as W,jv as X,Jg as Y,qr as Z,lr as _,Ks as a,Rb as a$,go as a0,Wc as a1,Nc as a2,yo as a3,vo as a4,Sy as a5,My as a6,jy as a7,Dr as a8,$w as a9,pv as aA,Mv as aB,gw as aC,fw as aD,zv as aE,Yv as aF,Gv as aG,Iv as aH,px as aI,qg as aJ,Ug as aK,Dx as aL,vr as aM,FC as aN,tr as aO,dx as aP,GC as aQ,HC as aR,YC as aS,gx as aT,Lb as aU,Ew as aV,Fw as aW,jw as aX,po as aY,Zg as aZ,jb as a_,Cr as aa,xr as ab,Xb as ac,Dp as ad,cm as ae,hy as af,Vw as ag,Hr as ah,wb as ai,lo as aj,cx as ak,hx as al,Aw as am,yw as an,Sw as ao,Db as ap,jr as aq,Hw as ar,Ow as as,ur as at,Jp as au,Dw as av,Mw as aw,Xr as ax,Ww as ay,Bw as az,Zw as b,Qy as b$,xC as b0,Hb as b1,ao as b2,mg as b3,Kb as b4,dr as b5,pw as b6,Tw as b7,Nw as b8,Pw as b9,sf as bA,af as bB,Ty as bC,of as bD,lf as bE,_g as bF,Pp as bG,Vf as bH,If as bI,mo as bJ,$f as bK,Jf as bL,qf as bM,Uf as bN,Wf as bO,Hf as bP,By as bQ,Dy as bR,Ey as bS,rb as bT,Py as bU,Ry as bV,my as bW,nb as bX,fy as bY,Ly as bZ,sb as b_,ro as ba,oo as bb,Iw as bc,rg as bd,fx as be,Yr as bf,Nb as bg,Dv as bh,Ev as bi,Bv as bj,Fv as bk,Av as bl,zw as bm,ef as bn,vv as bo,wv as bp,xv as bq,kv as br,Gr as bs,_b as bt,SC as bu,Hg as bv,Qg as bw,nf as bx,tf as by,rf as bz,$r as c,Eu as c$,eb as c0,tb as c1,py as c2,yy as c3,gy as c4,ab as c5,Fy as c6,xy as c7,ky as c8,bb as c9,Uw as cA,sg as cB,lg as cC,Lp as cD,sw as cE,rw as cF,ow as cG,dw as cH,hw as cI,iw as cJ,lw as cK,cw as cL,uw as cM,ux as cN,MC as cO,QC as cP,ax as cQ,XC as cR,lx as cS,wf as cT,Gb as cU,Jv as cV,Pv as cW,jf as cX,_o as cY,Jo as cZ,Vu as c_,vb as ca,uy as cb,cy as cc,ry as cd,Qf as ce,Zf as cf,ly as cg,sy as ch,ay as ci,ey as cj,iy as ck,oy as cl,ty as cm,ny as cn,Cy as co,wy as cp,vy as cq,by as cr,Ay as cs,Og as ct,or as cu,Pe as cv,zf as cw,co as cx,ho as cy,qw as cz,Pb as d,ym as d0,Xh as d1,Tc as d2,iu as d3,Yi as d4,xo as d5,zc as d6,kl as d7,cl as d8,xl as d9,cc as da,Ro as db,To as dc,ku as dd,Au as de,Ad as df,fd as dg,Mu as dh,uh as di,qc as dj,wl as dk,md as dl,am as dm,Ko as dn,ph as dp,bw as dq,vw as dr,Uv as ds,Mr as e,Ur as f,xg as g,yv as h,Fg as i,bv as j,Cv as k,Pg as l,wp as m,gv as n,Tv as o,Sv as p,Lv as q,Gg as r,kg as s,Rv as t,ox as u,Yb as v,Ab as w,Fb as x,Eb as y,Bb as z}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Login-DbpkJTe5.js","assets/vendor-react-j_fHog8x.js","assets/config-CTM8_93T.js","assets/vendor-core-CDNU4oKM.js","assets/maplibre-gl-B1CfjdFi.css","assets/Dashboard-BwRsG8HD.js","assets/PageLayout-DUXmuiZg.js","assets/link-scoring-DtQvFOcN.js","assets/TimeRangeSelector-DOdtPPj_.js","assets/index-Ch_XDzqB.js","assets/PacketList-XLhbtedS.js","assets/payload-decoders-ClAu_OX0.js","assets/SignalIndicator-DvKCjwKG.js","assets/signal-scoring-CcBiRcks.js","assets/arrow-up-By-lyY8m.js","assets/copy-jAVnwXtf.js","assets/chevron-right-DiVetJOJ.js","assets/map-pin-C3ieg9t_.js","assets/triangle-alert-JpcXY4mr.js","assets/DataBox-B4su-zzA.js","assets/layers-Dd_4LhZ4.js","assets/route-BTnuOvzt.js","assets/activity-48nFba-7.js","assets/circle-check-DBemvAXd.js","assets/database-IcctMW15.js","assets/DelayedAnimateNumber-BXZBlojL.js","assets/trending-up-CsysmbvI.js","assets/LightSparkline-96Ro4wc3.js","assets/NodeInformationCard-y7LNSCha.js","assets/Card-BC0izdLh.js","assets/ChatBubble-D6wREMt8.js","assets/Grid-OFJ4oe0a.js","assets/Packets-lSdRKAGr.js","assets/users-cobitl86.js","assets/funnel-BWvj-vnP.js","assets/Contacts-CJ7zcVr1.js","assets/ping-DLWlYTPp.js","assets/listbox-D8VLFZST.js","assets/git-branch-C_xw1lQX.js","assets/target-CE6nI9QD.js","assets/ConfirmModal-ptKJzd5A.js","assets/CollisionExplorerModal-COcb8LoT.js","assets/BasemapLayer-Dkb0XoZP.js","assets/network-D76gOy_X.js","assets/Statistics-Dkaqbily.js","assets/usePolling-B1kG3uqm.js","assets/easing-xoQNL31J.js","assets/info-DFWt9Iwg.js","assets/settings-2-B0bBfCqU.js","assets/MeshGraph-Duci9p1U.js","assets/DeepAnalysisModal-gcjnHw1P.js","assets/geo-utils-n2lfanuR.js","assets/System-DjGErvcK.js","assets/refresh-cw-BcvCKflD.js","assets/Logs-ClX8uzox.js","assets/Terminal-DYk9EjnC.js","assets/xterm-Cq-DlOOL.js","assets/system-BlyXhV8d.js","assets/KeycapButton-edNKeR5-.js","assets/xterm-6GBZ9nXN.css","assets/Configuration-CoqoluHU.js","assets/font-loader-BQzEmDrZ.js","assets/key-round-DyppBhTK.js","assets/RoomServer-bASTDJzO.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,W as f,t as y,Z as b,M as v,K as w,_ as C,e as x,f as k}from"./vendor-react-j_fHog8x.js";import{L as A,c as D,u as E,R as B,a as F,N as S,B as M}from"./vendor-core-CDNU4oKM.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 j={surfaces:{glass:{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:"#171717",surface:"#252525",elevated:"#333233",subtle:"#3F3F3F"},border:{subtle:"#4B4B4B",strong:"#616161"},text:{primary:"#E1E1E1",secondary:"#BFBFBF",muted:"#727272",inverse:"#171717"},accent:{primary:"#719CDF",secondary:"#DFBC72",tertiary:"#6FBCBD",success:"#719872",danger:"#E12672"},signal:{excellent:"#00FF00",good:"#8CE619",fair:"#FFD900",poor:"#FF8C26",critical:"#FF3333",unknown:"#616161"},status:{success:"#719872",warning:"#DFBC72",danger:"#E12672",info:"#6FBCBD",muted:"#616161"},chart:{c1:"#719CDF",c2:"#0074BE",c3:"#6FBCBD",c4:"#DFBC72",c5:"#719872",c6:"#E12672",c7:"#E17899",c8:"#999ABD",grid:"rgba(255, 255, 255, 0.06)",axis:"rgba(255, 255, 255, 0.4)",cursor:"rgba(255, 255, 255, 0.2)"},metric:{received:"#719872",forwarded:"#0074BE",transmitted:"#DFBC72",dropped:"#E12672"},map:{nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hub:"#8E4EC6",local:"#FFB224",neighbor:"#46A758",mobile:"#F76B15",room:"#D6409F",edge:"#4B4B4B",edgeHover:"#6FBCBD"}},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 T(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 P(){return"undefined"!=typeof window&&CSS.supports("color","color(display-p3 1 1 1)")}function R(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(r,s))}return n}function L(e){return{meta:e.meta,display:e.display,surfaces:e.surfaces?R(j.surfaces,e.surfaces):j.surfaces,colors:e.colors?R(j.colors,e.colors):j.colors,typography:e.typography?R(j.typography,e.typography):j.typography,spacing:e.spacing?R(j.spacing,e.spacing):j.spacing,motion:e.motion?R(j.motion,e.motion):j.motion}}function N(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"}function z(e){return{id:e.meta.id,colorScheme:{name:e.meta.name,dataTheme:e.meta.dataTheme,previewColor:e.meta.previewColor},background:{src:e.meta.backgroundImage,suggestedBrightness:e.meta.backgroundBrightness},display:{font:e.display.font,color:e.display.color,size:e.display.size,paletteColors:e.display.palette}}}const _="#fafafa",I="#a1a1aa",V="#71717a",O="#3f3f46",$="#27272a",q="#18181b",U="#09090b",W="#E5484D",H="#F76B15",Y="#FFB224",G="#46A758",K="#12A594",X="#00A2C7",J="#3B82F6",Z="#8E4EC6",Q="#D6409F",ee=L({meta:{id:"",name:"",dataTheme:"",previewColor:J,backgroundImage:"",backgroundBrightness:100,isDark:!0},display:{font:"Inter, sans-serif",color:I,size:1,palette:[[J,G,Y,H,W],[U,q,$,O,_]]},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:{glass:{tint:q,light:O,dark:U,reflexLight:0,reflexDark:0,blur:0,blurElevated:0,brightness:1,opacity:100,opacityElevated:100,catalystMode:!0},sidebar:{tint:`${$}80`},card:{radius:"0.5rem"},modal:{radius:"0.75rem"}},colors:{bg:{body:U,surface:q,elevated:$,subtle:$},border:{subtle:$,strong:"#52525b"},text:{primary:"#fff",secondary:I,muted:V,inverse:U},accent:{primary:J,secondary:Y,tertiary:X,success:G,danger:W},signal:{excellent:G,good:"#F5D90A",fair:Y,poor:H,critical:W,unknown:V},status:{success:G,warning:Y,danger:W,info:J,muted:V},chart:{c1:J,c2:K,c3:Y,c4:H,c5:Q,c6:Z,c7:X,c8:V,grid:`${_}0d`,axis:`${_}33`,cursor:`${J}33`},metric:{received:J,forwarded:K,transmitted:H,dropped:W},map:{nodeFill:J,nodeStroke:`${_}e6`,hub:Z,local:Y,neighbor:G,mobile:H,room:Q,edge:O,edgeHover:J}}}),te=ee;z(ee);const ne="#a1a1aa",ae="#71717a",se="#52525b",re="#18181b",oe="#E5484D",ie="#F76B15",le="#FFB224",ce="#46A758",ue="#12A594",de="#00A2C7",he="#3B82F6",me="#8E4EC6",pe="#D6409F",ge=L({meta:{id:"",name:"",dataTheme:"",previewColor:he,backgroundImage:"",backgroundColor:"#EFF0F1",backgroundBrightness:100,isDark:!1},display:{font:"Inter, sans-serif",color:se,size:1,palette:[[he,ce,le,ie,oe],["#EFF0F1","#FCFCFC","#DEE0E2",ae,re]]},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:{glass:{tint:"#FCFCFC",light:"#e4e4e7",dark:ne,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:re,secondary:se,muted:ae,inverse:"#FFFFFF"},accent:{primary:he,secondary:le,tertiary:de,success:ce,danger:oe},signal:{excellent:ce,good:"#F5D90A",fair:le,poor:ie,critical:oe,unknown:ne},status:{success:ce,warning:le,danger:oe,info:he,muted:ne},chart:{c1:he,c2:ue,c3:le,c4:ie,c5:pe,c6:me,c7:de,c8:ne,grid:`${re}0d`,axis:`${re}80`,cursor:`${he}1a`},metric:{received:he,forwarded:ue,transmitted:ie,dropped:oe},map:{nodeFill:he,nodeStroke:"rgba(255,255,255,0.9)",hub:me,local:le,neighbor:ce,mobile:ie,room:pe,edge:ne,edgeHover:he},sidebar:{bg:"rgba(0, 0, 0, 0.02)",navHoverBg:"rgba(0, 0, 0, 0.04)",navActiveBg:"rgba(59, 130, 246, 0.10)",navActiveText:he}}}),fe=ge;z(ge);const ye={"Breeze Dark":te,"Breeze Light":fe};function be(e,t){const n=e.toLowerCase();return{...t,meta:{...t.meta,id:n,name:e,dataTheme:n}}}const ve=Object.fromEntries(Object.entries(ye).map(([e,t])=>[e,be(e,t)])),we=Object.fromEntries(Object.entries(ve).map(([e,t])=>[e,z(t)])),Ce=Object.values(ve);function xe(e){return Ce.find(t=>t.meta.id===e)}new Map(Object.entries(ve));const ke=Object.values(we);new Map(Object.entries(we));const Ae=Object.entries(we).map(([e,t])=>function(e,t){return{id:e.id,name:e.colorScheme.name,displayName:t,colorScheme:e.id,backgroundImage:e.background.src,paletteColors:e.display.paletteColors,displayFont:e.display.font,displayColor:e.display.color,displaySize:e.display.size}}(t,e)),De=ke.map(function(e){return{id:e.id,name:e.colorScheme.name,dataTheme:e.colorScheme.dataTheme,previewColor:e.colorScheme.previewColor}}),Ee=ke.map(function(e){return{id:e.id,src:e.background.src,suggestedScheme:e.id,suggestedBrightness:e.background.suggestedBrightness}}),Be=ve["Breeze Dark"];we["Breeze Dark"];const Fe=Be.meta.id,Se=Be.meta.backgroundImage,Me=Be.meta.backgroundBrightness,je=De,Te=Ee,Pe=Ae,Re={colorScheme:Fe,backgroundImage:Se,brightness:Me},Le="pymc-color-scheme",Ne="pymc-background-image",ze="pymc-bg-brightness",_e="pymc-background",Ie={50:.97,100:.92,200:.84,300:.73,400:.62,500:.5,600:.4,700:.32,800:.24,900:.16},Ve=[50,100,200,300,400,500,600,700,800,900],Oe=["red","orange","yellow","green","aqua","blue","purple"];function $e(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 qe(e){const t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ue(e){const t=e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055;return Math.round(255*t)}function We(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[Ue(4.0767416621*c-3.3077115913*u+.2309699292*d),Ue(h),Ue(m)]}function He(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=qe(e),s=qe(t),r=qe(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 Ve){const e=Ie[i],t=s*(1-.3*Math.abs(e-.5)),[n,a,l]=We(e,t,r);o[i]=$e(n,a,l)}return o}function Ye(e){return"undefined"==typeof window?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function Ge(e,t){"undefined"!=typeof document&&document.documentElement.style.setProperty(e,t)}const Ke="u-off",Xe="u-label",Je="width",Ze="height",Qe="top",et="bottom",tt="left",nt="right",at="#000",st=at+"0",rt="mousemove",ot="mousedown",it="mouseup",lt="mouseenter",ct="mouseleave",ut="dblclick",dt="change",ht="dppxchange",mt="--",pt="undefined"!=typeof window,gt=pt?document:null,ft=pt?window:null,yt=pt?navigator:null;let bt,vt;function wt(e,t){if(null!=t){let n=e.classList;!n.contains(t)&&n.add(t)}}function Ct(e,t){let n=e.classList;n.contains(t)&&n.remove(t)}function xt(e,t,n){e.style[t]=n+"px"}function kt(e,t,n,a){let s=gt.createElement(e);return null!=t&&wt(s,t),null!=n&&n.insertBefore(s,a),s}function At(e,t){return kt("div",e,t)}const Dt=new WeakMap;function Et(e,t,n,a,s){let r="translate("+t+"px,"+n+"px)";r!=Dt.get(e)&&(e.style.transform=r,Dt.set(e,r),t<0||n<0||t>a||n>s?wt(e,Ke):Ct(e,Ke))}const Bt=new WeakMap;function Ft(e,t,n){let a=t+n;a!=Bt.get(e)&&(Bt.set(e,a),e.style.background=t,e.style.borderColor=n)}const St=new WeakMap;function Mt(e,t,n,a){let s=t+""+n;s!=St.get(e)&&(St.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 jt={passive:!0},Tt={...jt,capture:!0};function Pt(e,t,n,a){t.addEventListener(e,n,a?Tt:jt)}function Rt(e,t,n,a){t.removeEventListener(e,n,jt)}function Lt(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:en((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]}}pt&&function e(){let t=devicePixelRatio;bt!=t&&(bt=t,vt&&Rt(dt,vt,e),vt=matchMedia(`(min-resolution: ${bt-.001}dppx) and (max-resolution: ${bt+.001}dppx)`),Pt(dt,vt,e),ft.dispatchEvent(new CustomEvent(ht)))}();const zt=e=>null!=e,_t=e=>null!=e&&e>0,It=Nt(zt),Vt=Nt(_t);function Ot(e,t,n,a){let s=on(e),r=on(t);e==t&&(-1==s?(e*=n,t/=n):(e/=n,t*=n));let o=10==n?ln:cn,i=1==r?nn:en,l=(1==s?en:nn)(o(Qt(e))),c=i(o(Qt(t))),u=rn(n,l),d=rn(n,c);return 10==n&&(l<0&&(u=En(u,-l)),c<0&&(d=En(d,-c))),a||2==n?(e=u*s,t=d*r):(e=Dn(e,u),t=An(t,d)),[e,t]}function $t(e,t,n,a){let s=Ot(e,t,n,a);return 0==e&&(s[0]=0),0==t&&(s[1]=0),s}const qt={mode:3,pad:.1},Ut={pad:0,soft:null,mode:0},Wt={min:Ut,max:Ut};function Ht(e,t,n,a){return Nn(n)?Gt(e,t,n):(Ut.pad=n,Ut.soft=a?0:null,Ut.mode=a?3:0,Gt(e,t,Wt))}function Yt(e,t){return null==e?t:e}function Gt(e,t,n){let a=n.min,s=n.max,r=Yt(a.pad,0),o=Yt(s.pad,0),i=Yt(a.hard,-dn),l=Yt(s.hard,dn),c=Yt(a.soft,dn),u=Yt(s.soft,-dn),d=Yt(a.mode,0),h=Yt(s.mode,0),m=t-e,p=ln(m),g=sn(Qt(e),Qt(t)),f=ln(g),y=Qt(f-p);(m<1e-24||y>10)&&(m=0,0!=e&&0!=t||(m=1e-24,2==d&&c!=dn&&(r=0),2==h&&u!=-dn&&(o=0)));let b=m||g||1e3,v=ln(b),w=rn(10,en(v)),C=En(Dn(e-b*(0==m?0==e?.1:1:r),w/10),24),x=e>=c&&(1==d||3==d&&C<=c||2==d&&C>=c)?c:dn,k=sn(i,C=x?x:an(x,C)),A=En(An(t+b*(0==m?0==t?.1:1:o),w/10),24),D=t<=u&&(1==h||3==h&&A>=u||2==h&&A<=u)?u:-dn,E=an(l,A>D&&t<=D?D:sn(D,A));return k==E&&0==k&&(E=100),[k,E]}const Kt=new Intl.NumberFormat(pt?yt.language:"en-US"),Xt=e=>Kt.format(e),Jt=Math,Zt=Jt.PI,Qt=Jt.abs,en=Jt.floor,tn=Jt.round,nn=Jt.ceil,an=Jt.min,sn=Jt.max,rn=Jt.pow,on=Jt.sign,ln=Jt.log10,cn=Jt.log2,un=(e,t=1)=>Jt.asinh(e/t),dn=1/0;function hn(e){return 1+(0|ln((e^e>>31)-(e>>31)))}function mn(e,t,n){return an(sn(e,t),n)}function pn(e){return"function"==typeof e}function gn(e){return pn(e)?e:()=>e}const fn=e=>e,yn=(e,t)=>t,bn=e=>null,vn=e=>!0,wn=(e,t)=>e==t,Cn=/\.\d*?(?=9{6,}|0{6,})/gm,xn=e=>{if(Rn(e)||Bn.has(e))return e;const t=`${e}`,n=t.match(Cn);if(null==n)return e;let a=n[0].length-1;if(-1!=t.indexOf("e-")){let[e,n]=t.split("e");return+`${xn(e)}e${n}`}return En(e,a)};function kn(e,t){return xn(En(xn(e/t))*t)}function An(e,t){return xn(nn(xn(e/t))*t)}function Dn(e,t){return xn(en(xn(e/t))*t)}function En(e,t=0){if(Rn(e))return e;let n=10**t,a=e*n*(1+Number.EPSILON);return tn(a)/n}const Bn=new Map;function Fn(e){return((""+e).split(".")[1]||"").length}function Sn(e,t,n,a){let s=[],r=a.map(Fn);for(let o=t;o=0?0:t)+(o>=r[i]?0:r[i]),u=10==e?l:En(l,c);s.push(u),Bn.set(u,c)}}return s}const Mn={},jn=[],Tn=[null,null],Pn=Array.isArray,Rn=Number.isInteger;function Ln(e){return"string"==typeof e}function Nn(e){let t=!1;if(null!=e){let n=e.constructor;t=null==n||n==Object}return t}function zn(e){return null!=e&&"object"==typeof e}const _n=Object.getPrototypeOf(Uint8Array),In="__proto__";function Vn(e,t=Nn){let n;if(Pn(e)){let a=e.find(e=>null!=e);if(Pn(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,Un=["January","February","March","April","May","June","July","August","September","October","November","December"],Wn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Hn(e){return e.slice(0,3)}const Yn=Wn.map(Hn),Gn=Un.map(Hn),Kn={MMMM:Un,MMM:Gn,WWWW:Wn,WWW:Yn};function Xn(e){return(e<10?"0":"")+e}const Jn={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=>Xn(e.getMonth()+1),M:e=>e.getMonth()+1,DD:e=>Xn(e.getDate()),D:e=>e.getDate(),WWWW:(e,t)=>t.WWWW[e.getDay()],WWW:(e,t)=>t.WWW[e.getDay()],HH:e=>Xn(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=>Xn(e.getMinutes()),m:e=>e.getMinutes(),ss:e=>Xn(e.getSeconds()),s:e=>e.getSeconds(),fff:e=>{return((t=e.getMilliseconds())<10?"00":t<100?"0":"")+t;var t}};function Zn(e,t){t=t||Kn;let n,a=[],s=/\{([a-z]+)\}|[^{]+/gi;for(;n=s.exec(e);)a.push("{"==n[0][0]?Jn[n[1]]:n[0]);return e=>{let n="";for(let s=0;se%1==0,ta=[1,2,2.5,5],na=Sn(10,-32,0,ta),aa=Sn(10,0,32,ta),sa=aa.filter(ea),ra=na.concat(aa),oa="{YYYY}",ia="\n"+oa,la="{M}/{D}",ca="\n"+la,ua=ca+"/{YY}",da="{aa}",ha="{h}:{mm}"+da,ma="\n"+ha,pa=":{ss}",ga=null;function fa(e){let t=1e3*e,n=60*t,a=60*n,s=24*a,r=30*s,o=365*s;return[(1==e?Sn(10,0,3,ta).filter(ea):Sn(10,-3,0,ta)).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,oa,ga,ga,ga,ga,ga,ga,1],[28*s,"{MMM}",ia,ga,ga,ga,ga,ga,1],[s,la,ia,ga,ga,ga,ga,ga,1],[a,"{h}"+da,ua,ga,ca,ga,ga,ga,1],[n,ha,ua,ga,ca,ga,ga,ga,1],[t,pa,ua+" "+ha,ga,ca+" "+ha,ga,ma,ga,1],[e,pa+".{fff}",ua+" "+ha,ga,ca+" "+ha,ga,ma,ga,1]],function(t){return(i,l,c,u,d,h)=>{let m=[],p=d>=o,g=d>=r&&d=s?s:d,o=v+(en(c)-en(y))+An(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=En(o+d,1==e?0:3),!(o>u);)if(f>1){let e=en(En(g+f,6))%24,n=t(o).getHours()-e;n>1&&(n=-1),o-=n*a,g=(g+f)%24,En((o-m[m.length-1])/d,3)*b>=.7&&m.push(o)}else m.push(o)}return m}}]}const[ya,ba,va]=fa(1),[wa,Ca,xa]=fa(.001);function ka(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 Aa(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 Da(e,t,n){return new Date(e,t,n)}function Ea(e,t){return t(e)}function Ba(e,t){return(n,a,s,r)=>null==r?mt:t(e(a))}Sn(2,-53,53,[1]);const Fa={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:[]},Sa=[0,0];function Ma(e,t,n,a=!0){return e=>{0==e.button&&(!a||e.target==t)&&n(e)}}function ja(e,t,n,a=!0){return e=>{(!a||e.target==t)&&n(e)}}const Ta={show:!0,x:!0,y:!0,lock:!1,move:function(e,t,n){return Sa[0]=t,Sa[1]=n,Sa},points:{one:!1,show:function(e,t){let n=e.cursor.points,a=At(),s=n.size(e,t);xt(a,Je,s),xt(a,Ze,s);let r=s/-2;xt(a,"marginLeft",r),xt(a,"marginTop",r);let o=n.width(e,t,s);return o&&xt(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:Ma,mouseup:Ma,click:Ma,dblclick:Ma,mousemove:ja,mouseleave:ja,mouseenter:ja},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},Pa={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Ra=On({},Pa,{filter:yn}),La=On({},Ra,{size:10}),Na=On({},Pa,{show:!1}),za='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"',_a="bold "+za,Ia={show:!0,scale:"x",stroke:at,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:_a,side:2,grid:Ra,ticks:La,border:Na,font:za,lineGap:1.5,rotate:0},Va={show:!0,scale:"x",auto:!1,sorted:1,min:dn,max:-dn,idxs:[]};function Oa(e,t,n,a,s){return t.map(e=>null==e?"":Xt(e))}function $a(e,t,n,a,s,r,o){let i=[],l=Bn.get(s)||0;for(let c=n=o?n:En(An(n,s),l);c<=a;c=En(c+s,l))i.push(Object.is(c,-0)?0:c);return i}function qa(e,t,n,a,s,r,o){const i=[],l=e.scales[e.axes[t].scale].log,c=en((10==l?ln:cn)(n));s=rn(l,c),10==l&&(s=ra[Lt(s,ra)]);let u=n,d=s*l;10==l&&(d=ra[Lt(d,ra)]);do{i.push(u),u+=s,10!=l||Bn.has(u)||(u=En(u,Bn.get(s))),u>=d&&(d=(s=u)*l,10==l&&(d=ra[Lt(d,ra)]))}while(u<=a);return i}function Ua(e,t,n,a,s,r,o){let i=e.scales[e.axes[t].scale].asinh,l=a>i?qa(e,t,sn(i,n),a,s):[i],c=a>=0&&n<=0?[0]:[];return(n<-i?qa(e,t,sn(i,-a),-n,s):[i]).reverse().map(e=>-e).concat(c,l)}const Wa=/./,Ha=/[12357]/,Ya=/[125]/,Ga=/1/,Ka=(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 Xa(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?Wa:l(7,o)-u>=c?Ha:l(5,o)-u>=c?Ya:Ga;if(d==Ga){let e=Qt(l(1,o)-u);if(es,ns={show:!0,auto:!0,sorted:0,gaps:ts,alpha:1,facets:[On({},es,{scale:"x"}),On({},es,{scale:"y"})]},as={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:ts,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=Qt(o-r)/(e.series[t].points.space*bt);return a[1]-a[0]<=i},filter:null},values:null,min:dn,max:-dn,idxs:[],path:null,clip:null};function ss(e,t,n,a,s){return n/10}const rs={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},os=On({},rs,{time:!1,ori:1}),is={};function ls(e,t){let n=is[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?vs:ws;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)),x=g(c(t[v],i,m,d)),k=g(u(1==r?l.max:l.min,l,p,h)),A=new Path2D(s);return y(A,x,k),y(A,w,k),y(A,w,C),A})}function ms(e,t,n,a,s,r){let o=null;if(e.length>0){o=new Path2D;const i=0==t?Cs:xs;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 ps(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 gs(e){return 0==e?fn:1==e?tn:t=>kn(t,e)}function fs(e){let t=0==e?ys:bs,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=an(l,o/2,i/2),c=an(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 ys=(e,t,n)=>{e.moveTo(t,n)},bs=(e,t,n)=>{e.moveTo(n,t)},vs=(e,t,n)=>{e.lineTo(t,n)},ws=(e,t,n)=>{e.lineTo(n,t)},Cs=fs(0),xs=fs(1),ks=(e,t,n,a,s,r)=>{e.arc(t,n,a,s,r)},As=(e,t,n,a,s,r)=>{e.arc(n,t,a,s,r)},Ds=(e,t,n,a,s,r,o)=>{e.bezierCurveTo(t,n,a,s,r,o)},Es=(e,t,n,a,s,r,o)=>{e.bezierCurveTo(n,t,s,a,o,r)};function Bs(e){return(e,t,n,a,s)=>cs(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=ys,f=ks):(g=bs,f=As);const v=En(b.width*bt,3);let w=(b.size-b.width)/2*bt,C=En(2*w,3),x=new Path2D,k=new Path2D,{left:A,top:D,width:E,height:B}=e.bbox;Cs(k,A-C,D-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(x,t+w,n),f(x,t,n,w,0,2*Zt)}};if(s)s.forEach(F);else for(let e=n;e<=a;e++)F(e);return{stroke:v>0?x:null,fill:x,clip:k,flags:3}})}function Fs(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 Ss=Fs(vs),Ms=Fs(ws);function js(e){const t=Yt(null==e?void 0:e.alignGaps,0);return(e,n,a,s)=>cs(e,n,(r,o,i,l,c,u,d,h,m,p,g)=>{[a,s]=It(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=vs,y=Ss):(f=ws,y=Ms);const C=l.dir*(0==l.ori?1:-1),x={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},k=x.stroke;let A=!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(k,s,w(n)),t=u=d=n):nd&&(d=n)):null===r&&(A=!0):(null!=u&&y(k,h,w(u),w(d),w(t),w(n)),null!=r?(n=r,f(k,s,w(n)),u=d=t=n):(u=d=null,null===r&&(A=!0)),h=s,g=c(h+C))}null!=u&&u!=d&&r!=h&&y(k,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?A=!0:null!=t&&f(k,v(o[e]),w(t))}let[D,E]=us(e,n);if(null!=r.fill||0!=D){let t=x.fill=new Path2D(k),i=w(r.fillTo(e,n,r.min,r.max,D)),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=[];A&&c.push(...ps(o,i,a,s,C,v,t)),x.gaps=c=r.gaps(e,n,a,s,c),x.clip=ms(c,l.ori,h,m,p,g)}return 0!=E&&(x.band=2==E?[hs(e,n,a,s,k,-1),hs(e,n,a,s,k,1)]:hs(e,n,a,s,k,E)),x})}function Ts(e,t,n,a,s,r,o=dn){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{Ks.pxRatio=bt}));const Ns=js(),zs=Bs();function _s(e,t,n,a){return(a?[e[0],e[1]].concat(e.slice(2)):[e[0]].concat(e.slice(1))).map((e,a)=>Is(e,a,t,n))}function Is(e,t,n,a){return On({},0==t?n:a,e)}function Vs(e,t,n){return null==t?Tn:[t,n]}const Os=Vs;function $s(e,t,n){return null==t?Tn:Ht(t,n,.1,!0)}function qs(e,t,n,a){return null==t?Tn:Ot(t,n,e.scales[a].log,!1)}const Us=qs;function Ws(e,t,n,a){return null==t?Tn:$t(t,n,e.scales[a].log,!1)}const Hs=Ws;function Ys(e){let t,n;return[e=e.replace(/(\d+)px/,(e,a)=>(t=tn((n=+a)*bt))+"px"),t,n]}function Gs(e){e.show&&[e.font,e.labelFont].forEach(e=>{let t=En(e[2]*bt,1);e[0]=e[0].replace(/[0-9.]+px/,t+"px"),e[1]=t})}function Ks(e,t,n){const a={mode:Yt(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=At("uplot");null!=e.id&&(c.id=e.id),wt(c,e.class),e.title&&(At("u-title",c).textContent=e.title);const u=kt("canvas"),d=a.ctx=u.getContext("2d"),h=At("u-wrap",c);Pt("click",h,e=>{e.target===p&&(Xn!=Hn||Jn!=Yn)&&ca.click(a,e)},!0);const m=a.under=At("u-under",h);h.appendChild(u);const p=a.over=At("u-over",h),g=+Yt((e=Vn(e)).pxAlign,1),f=gs(g);(e.plugins||[]).forEach(t=>{t.opts&&(e=t.opts(a,e)||e)});const y=e.ms||.001,b=a.series=1==s?_s(e.series||[],Va,as,!1):(v=e.series||[null],w=ns,v.map((e,t)=>0==t?{}:On({},w,e)));var v,w;const C=a.axes=_s(e.axes||[],Ia,Qa,!0),x=a.scales={},k=a.bands=e.bands||[];k.forEach(e=>{e.fill=gn(e.fill||null),e.dir=Yt(e.dir,-1)});const A=2==s?b[1].facets[0].scale:b[0].scale,D={axes:function(){for(let e=0;eSt[e]):y,v=2==m.distr?St[y[1]]-St[y[0]]:u,w=t.ticks,k=t.border,A=w.show?w.size:0,D=tn(A*bt),E=tn((2==t.alignTo?t._size-A-t.gap:t.gap)*bt),B=t._rotate*-Zt/180,F=f(t._pos*bt),S=F+(D+E)*c;s=0==o?S:0,n=1==o?S:0,Wt(t.font[0],l,1==t.align?tt:2==t.align?nt:B>0?tt:B<0?nt:0==o?"center":3==r?nt:tt,B||1==o?"middle":2==r?Qe:et);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)&&Bt!=Me.alpha;e&&(d.globalAlpha=Bt=Me.alpha),b.forEach((e,n)=>{if(n>0&&e.show&&(Xt(n,!1),Xt(n,!0),null==e._paths)){let r=Bt;Bt!=e.alpha&&(d.globalAlpha=Bt=e.alpha);let o=2==s?[0,t[n][0].length-1]:function(e){let t=mn(qe-1,0,$e-1),n=mn(Ue+1,0,$e-1);for(;null==e[t]&&t>0;)t--;for(;null==e[n]&&n<$e-1;)n++;return[t,n]}(t[n]);e._paths=e.paths(a,n,o[0],o[1]),Bt!=r&&(d.globalAlpha=Bt=r)}}),b.forEach((e,t)=>{if(t>0&&e.show){let n=Bt;Bt!=e.alpha&&(d.globalAlpha=Bt=e.alpha),null!=e._paths&&en(t,!1);{let n=null!=e._paths?e._paths.gaps:null,s=e.points.show(a,t,qe,Ue,n),r=e.points.filter(a,t,s,n);(s||r)&&(e.points._paths=e.points.paths(a,t,qe,Ue,r),en(t,!0))}Bt!=n&&(d.globalAlpha=Bt=n),Cs("drawSeries",t)}}),e&&(d.globalAlpha=Bt=1)}}},E=(e.drawOrder||["axes","series"]).map(e=>D[e]);function B(e){const t=3==e.distr?t=>ln(t>0?t:e.clamp(a,t,e.min,e.max,e.key)):4==e.distr?t=>un(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=x[t];if(null==n){let a=(e.scales||Mn)[t]||Mn;if(null!=a.from){F(a.from);let e=On({},x[a.from],a,{key:t});e.valToPct=B(e),x[t]=e}else{n=x[t]=On({},t==A?rs:os,a),n.key=t;let e=n.time,r=n.range,o=Pn(r);if((t!=A||2==s&&!e)&&(!o||null!=r[0]&&null!=r[1]||(r={min:null==r[0]?qt:{mode:1,hard:r[0],soft:r[0]},max:null==r[1]?qt:{mode:1,hard:r[1],soft:r[1]}},o=!1),!o&&Nn(r))){let e=r;r=(t,n,a)=>null==n?Tn:Ht(n,a,e)}n.range=gn(r||(e?Os:t==A?3==n.distr?Us:4==n.distr?Hs:Vs:3==n.distr?qs:4==n.distr?Ws:$s)),n.auto=gn(!o&&n.auto),n.clamp=gn(n.clamp||ss),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 Ke in e.scales)F(Ke);const S=x[A],M=S.distr;let j,T;0==S.ori?(wt(c,"u-hz"),j=r,T=o):(wt(c,"u-vt"),j=o,T=r);const P={};for(let Ke in x){let e=x[Ke];null==e.min&&null==e.max||(P[Ke]={min:e.min,max:e.max},e.min=e.max=null)}const R=e.tzDate||(e=>new Date(tn(e/y))),L=e.fmtDate||Zn,N=1==y?va(R):xa(R),z=Aa(R,ka(1==y?ba:Ca,L)),_=Ba(R,Ea("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",L)),I=[],V=a.legend=On({},Fa,e.legend),O=a.cursor=On({},Ta,{drag:{y:2==s}},e.cursor),$=V.show,q=O.show,U=V.markers;let W,H,Y;V.idxs=I,U.width=gn(U.width),U.dash=gn(U.dash),U.stroke=gn(U.stroke),U.fill=gn(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]=mt}if($)if(W=kt("table","u-legend",c),Y=kt("tbody",null,W),V.mount(a,W),J){H=kt("thead",null,W,Y);let e=kt("tr",null,H);for(var Q in kt("th",null,e),G)kt("th",Xe,e).textContent=Q}else wt(W,"u-inline"),V.live&&wt(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&&(Pt(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||(Rt(s,t,a[s]),delete a[s]);null==e&&ne.delete(t)}let re=0,oe=0,ie=0,le=0,ce=0,ue=0,de=ce,he=ue,me=ie,pe=le,ge=0,fe=0,ye=0,be=0;a.bbox={};let ve=!1,we=!1,Ce=!1,xe=!1,ke=!1,Ae=!1;function De(e,t,n){(n||e!=a.width||t!=a.height)&&Ee(e,t),Sn(!1),Ce=!0,we=!0,aa()}function Ee(e,t){a.width=re=ie=e,a.height=oe=le=t,ce=ue=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?(ue+=l,e=!0):t=!0))}}),_e[0]=e,_e[1]=n,_e[2]=t,_e[3]=a,ie-=Oe[1]+Oe[3],ce+=Oe[3],le-=Oe[2]+Oe[0],ue+=Oe[0]}(),function(){let e=ce+ie,t=ue+le,n=ce,a=ue;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;ge=n.left=kn(ce*bt,.5),fe=n.top=kn(ue*bt,.5),ye=n.width=kn(ie*bt,.5),be=n.height=kn(le*bt,.5)}const Be=3;if(a.setSize=function({width:e,height:t}){De(e,t)},null==O.dataIdx){let e=O.hover,n=e.skip=new Set(e.skip??[]);n.add(void 0);let a=e.prox=gn(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)??dn,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 Fe=e=>{O.event=e};O.idxs=I,O._lock=!1;let Se=O.points;Se.show=gn(Se.show),Se.size=gn(Se.size),Se.stroke=gn(Se.stroke),Se.width=gn(Se.width),Se.fill=gn(Se.fill);const Me=a.focus=On({},e.focus||{alpha:.3},O.focus),je=Me.prox>=0,Te=je&&Se.one;let Pe=[],Re=[],Le=[];function Ne(e,t){let n=Se.show(a,t);if(n instanceof HTMLElement)return wt(n,"u-cursor-pt"),wt(n,e.class),Et(n,-10,-10,ie,le),p.insertBefore(n,Pe[t]),n}function ze(e,t){if(1==s||t>0){let t=1==s&&x[e.scale].time,n=e.value;e.value=t?Ln(n)?Ba(R,Ea(n,L)):n||_:n||Za,e.label=e.label||(t?"Time":"Value")}if(Te||t>0){e.width=null==e.width?1:e.width,e.paths=e.paths||Ns||bn,e.fillTo=gn(e.fillTo||ds),e.pxAlign=+Yt(e.pxAlign,g),e.pxRound=gs(e.pxAlign),e.stroke=gn(e.stroke||null),e.fill=gn(e.fill||null),e._stroke=e._fill=e._paths=e._focus=null;let t=En(1*(3+2*(sn(1,e.width)||1)),3),n=e.points=On({},{size:t,width:sn(1,.2*t),stroke:e.stroke,space:2*t,paths:zs,_stroke:null,_fill:null},e.points);n.show=gn(n.show),n.filter=gn(n.filter),n.fill=gn(n.fill),n.stroke=gn(n.stroke),n.paths=gn(n.paths),n.pxAlign=e.pxAlign}if($){let n=function(e,t){if(0==t&&(J||!V.live||2==s))return Tn;let n=[],r=kt("tr","u-series",Y,Y.childNodes[t]);wt(r,e.class),e.show||wt(r,Ke);let o=kt("th",null,r);if(U.show){let e=At("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=At(Xe,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;Fe(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&&fa(a,e?a==n?ee:te:ee,!0,ks.setSeries)})}else fa(n,{show:!e.show},!0,ks.setSeries)},!1),je&&ae(lt,o,t=>{O._lock||(Fe(t),fa(b.indexOf(e),ja,!0,ks.setSeries))},!1)),G){let e=kt("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;Te?0==t&&(n=Ne(e,t)):t>0&&(n=Ne(e,t)),Pe.splice(t,0,n),Re.splice(t,0,0),Le.splice(t,0,0)}Cs("addSeries",t)}a.addSeries=function(e,t){t=null==t?b.length:t,e=1==s?Is(e,t,Va,as):Is(e,t,{},ns),b.splice(t,0,e),ze(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),Pe.splice(e,1)[0].remove(),Re.splice(e,1),Le.splice(e,1)),Cs("delSeries",e)};const _e=[!1,!1,!1,!1];function Ie(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?tn(Ia.size/3):0),1==l&&(s||o)&&(c=1==t&&!r||3==t&&!i?tn(Qa.size/2):0),c}const Ve=a.padding=(e.padding||[Ie,Ie,Ie,Ie]).map(e=>gn(Yt(e,Ie))),Oe=a._padding=Ve.map((e,t)=>e(a,t,_e,0));let $e,qe=null,Ue=null;const We=1==s?b[0].idxs:null;let He,Ye,Ge,at,dt,pt,yt,vt,Dt,Bt,St=null,jt=!1;function Tt(e,n){if(t=null==e?[]:e,a.data=a._data=t,2==s){$e=0;for(let e=1;e=0,Ae=!0,aa()}}function Nt(){let e,n;jt=!0,1==s&&($e>0?(qe=We[0]=0,Ue=We[1]=$e-1,e=t[0][qe],n=t[0][Ue],2==M?(e=qe,n=Ue):e==n&&(3==M?[e,n]=Ot(e,e,S.log,!1):4==M?[e,n]=$t(e,e,S.log,!1):S.time?n=e+tn(86400/y):[e,n]=Ht(e,n,.1,!0))):(qe=We[0]=e=null,Ue=We[1]=n=null)),ga(A,e,n)}function Ut(e,t,n,a,s,r){e??(e=st),n??(n=jn),a??(a="butt"),s??(s=st),r??(r="round"),e!=He&&(d.strokeStyle=He=e),s!=Ye&&(d.fillStyle=Ye=s),t!=Ge&&(d.lineWidth=Ge=t),r!=dt&&(d.lineJoin=dt=r),a!=pt&&(d.lineCap=pt=a),n!=at&&d.setLineDash(at=n)}function Wt(e,t,n,a){t!=Ye&&(d.fillStyle=Ye=t),e!=yt&&(d.font=yt=e),n!=vt&&(d.textAlign=vt=n),a!=Dt&&(d.textBaseline=Dt=a)}function Gt(e,t,n,s,r=0){if(s.length>0&&e.auto(a,jt)&&(null==t||null==t.min)){let t=Yt(qe,0),a=Yt(Ue,s.length-1),o=null==n.min?function(e,t,n,a=0,s=!1){let r=s?Vt:It,o=s?_t:zt;[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??dn,l??-dn]}(s,t,a,r,3==e.distr):[n.min,n.max];e.min=an(e.min,n.min=o[0]),e.max=sn(e.max,n.max=o[1])}}a.setData=Tt;const Kt={min:null,max:null};function Xt(e,t){let n=t?b[e].points:b[e];n._stroke=n.stroke(a,e),n._fill=n.fill(a,e)}function en(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=En(h*bt,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=ge-h/2,t=fe-h/2,n=ye+h,a=be+h;m=new Path2D,m.rect(e,t,n,a)}n?cn(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&&k.forEach((p,g)=>{if(p.series[0]==e){let e,f=b[p.series[1]],y=t[p.series[1]],v=(f._paths||Mn).band;Pn(v)&&(v=1==p.dir?v[0]:v[1]);let w=null;f.show&&v&&function(e,t,n){for(t=Yt(t,0),n=Yt(n,e.length-1);t<=n;){if(null!=e[t])return!0;t++}return!1}(y,qe,Ue)?(w=p.fill(a,g)||i,e=f._paths.clip):v=null,cn(n,s,r,o,w,l,c,u,d,h,e,v),m=!0}}),m||cn(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 on=3;function cn(e,t,n,a,s,r,o,i,l,c,u,h){Ut(e,t,n,a,s),(l||c||h)&&(d.save(),l&&d.clip(l),c&&d.clip(c)),h?(i&on)==on?(d.clip(h),u&&d.clip(u),Cn(s,o),fn(e,r,t)):2&i?(Cn(s,o),d.clip(h),fn(e,r,t)):1&i&&(d.save(),d.clip(h),u&&d.clip(u),Cn(s,o),d.restore(),fn(e,r,t)):(Cn(s,o),fn(e,r,t)),(l||c||h)&&d.restore()}function fn(e,t,n){n>0&&(t instanceof Map?t.forEach((e,t)=>{d.strokeStyle=He=t,d.stroke(e)}):null!=t&&e&&d.stroke(t))}function Cn(e,t){t instanceof Map?t.forEach((e,t)=>{d.fillStyle=Ye=t,d.fill(e)}):null!=t&&e&&d.fill(t)}function xn(e,t,n,a,s,r,o,i,l,c){let u=o%2/2;1==g&&d.translate(u,u),Ut(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=x[n.scale];if(null==r.min)return void(n._show&&(t=!1,n._show=!1,Sn(!1)));n._show||(t=!1,n._show=!0,Sn(!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=sn(hn(e),hn(t)),o=t-e,i=Lt(s/a*o,n);do{let e=n[i],t=a*e/o;if(t>=s&&r+(e<5?Bn.get(e):0)<=17)return[e,t]}while(++iSt[e]):m,g=2==r.distr?St[m[1]]-St[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=nn(n.size(a,f,s,e)),null!=y&&n._size!=y&&(t=!1)}),t}function Dn(e){let t=!0;return Ve.forEach((n,s)=>{let r=n(a,s,_e,e);r!=Oe[s]&&(t=!1),Oe[s]=r}),t}function Sn(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 Rn,_n,In,$n,Un,Wn,Hn,Yn,Gn,Kn,Xn,Jn,Qn=!1,ea=!1,ta=[];function na(){ea=!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],qe=Lt(i.min,t[0]),Ue=Lt(i.max,t[0]),Ue-qe>1&&(t[0][qe]i.max&&Ue--),n.min=St[qe],n.max=St[Ue]}else n.show&&n.auto&&Gt(i,o,n,t[r],n.sorted);n.idxs[0]=qe,n.idxs[1]=Ue}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&&Gt(u,P[o],a,l,a.sorted),null!=d&&Gt(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==dn?null:n.min,n.max==-dn?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=x[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?ln(s.min):4==e?un(s.min,s.asinh):100==e?s.fwd(s.min):s.min,s._max=3==e?ln(s.max):4==e?un(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)Ce=!0,Cs("setScale",e);q&&O.left>=0&&(xe=Ae=!0)}for(let t in P)P[t]=null}(),ve=!1),Ce&&(function(){let e=!1,t=0;for(;!e;){t++;let n=An(t),s=Dn(t);e=t==Be||n&&s,e||(Ee(a.width,a.height),we=!0)}}(),Ce=!1),we){if(xt(m,tt,ce),xt(m,Qe,ue),xt(m,Je,ie),xt(m,Ze,le),xt(p,tt,ce),xt(p,Qe,ue),xt(p,Je,ie),xt(p,Ze,le),xt(h,Je,re),xt(h,Ze,oe),u.width=tn(re*bt),u.height=tn(oe*bt),C.forEach(({_el:e,_show:t,_size:n,_pos:a,side:s})=>{if(null!=e)if(t){let t=s%2==1;xt(e,t?"left":"top",a-(3===s||0===s?n:0)),xt(e,t?"width":"height",n),xt(e,t?"top":"left",t?ue:ce),xt(e,t?"height":"width",t?le:ie),Ct(e,Ke)}else wt(e,Ke)}),He=Ye=Ge=dt=pt=yt=vt=Dt=at=null,Bt=1,Ga(!0),ce!=de||ue!=he||ie!=me||le!=pe){Sn(!1);let e=ie/me,t=le/pe;if(q&&!xe&&O.left>=0){O.left*=e,O.top*=t,In&&Et(In,tn(O.left),0,ie,le),$n&&Et($n,0,tn(O.top),ie,le);for(let n=0;n=0&&ha.width>0){ha.left*=e,ha.width*=e,ha.top*=t,ha.height*=t;for(let e in ts)xt(ma,e,ha[e])}de=ce,he=ue,me=ie,pe=le}Cs("setSize"),we=!1}re>0&&oe>0&&(d.clearRect(0,0,u.width,u.height),Cs("drawClear"),E.forEach(e=>e()),Cs("draw")),ha.show&&ke&&(pa(ha),ke=!1),q&&xe&&(Ha(null,!0,!1),xe=!1),V.show&&V.live&&Ae&&(_a(),Ae=!1),l||(l=!0,a.status=1,Cs("ready")),jt=!1,Qn=!1}function ia(e,n){let s=x[e];if(null==s.from){if(0==$e){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($e>1&&null!=n.min&&null!=n.max&&n.max-n.min<1e-16)return;e==A&&2==s.distr&&$e>0&&(n.min=Lt(n.min,t[0]),n.max=Lt(n.max,t[0]),n.min==n.max&&n.max++),P[e]=n,ve=!0,aa()}}a.batch=function(e,t=!1){Qn=!0,ea=t,e(a),oa(),t&&ta.length>0&&queueMicrotask(na)},a.redraw=(e,t)=>{Ce=t||!1,!1!==e?ga(A,S.min,S.max):aa()},a.setScale=ia;let la=!1;const ca=O.drag;let ua=ca.x,da=ca.y;q&&(O.x&&(Rn=At("u-cursor-x",p)),O.y&&(_n=At("u-cursor-y",p)),0==S.ori?(In=Rn,$n=_n):(In=_n,$n=Rn),Xn=O.left,Jn=O.top);const ha=a.select=On({show:!0,over:!0,left:0,width:0,top:0,height:0},e.select),ma=ha.show?At("u-select",ha.over?p:m):null;function pa(e,t){if(ha.show){for(let t in e)ha[t]=e[t],t in ts&&xt(ma,t,e[t]);!1!==t&&Cs("setSelect")}}function ga(e,t,n){ia(e,{min:t,max:n})}function fa(e,t,n,r){null!=t.focus&&function(e){if(e!=Ma){let t=null==e,n=1!=Me.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!=Pe[e]&&(Pe[e].style.opacity=t),$&&K[e]&&(K[e].style.opacity=t)}(r,s?1:Me.alpha)}}),Ma=e,n&&aa()}}(e),null!=t.show&&b.forEach((n,a)=>{a>0&&(e==a||null==e)&&(n.show=t.show,function(e){if(b[e].show)$&&Ct(K[e],Ke);else if($&&wt(K[e],Ke),q){let t=Te?Pe[0]:Pe[e];null!=t&&Et(t,-10,-10,ie,le)}}(a),2==s?(ga(n.facets[0].scale,null,null),ga(n.facets[1].scale,null,null)):ga(n.scale,null,null),aa())}),!1!==n&&Cs("setSeries",e,t),r&&Es("setSeries",a,e,t)}let Da,Sa,Ma;a.setSelect=pa,a.setSeries=fa,a.addBand=function(e,t){e.fill=gn(e.fill||null),e.dir=Yt(e.dir,-1),t=null==t?k.length:t,k.splice(t,0,e)},a.setBand=function(e,t){On(k[e],t)},a.delBand=function(e){null==e?k.length=0:k.splice(e,1)};const ja={focus:!0};function Pa(e,t,n){let a=x[t];n&&(e=e/bt-(1==a.ori?ue: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?rn(10,o):4==i?((e,t=1)=>Jt.sinh(e)*t)(o,a.asinh):100==i?a.bwd(o):o}function Ra(e,t){xt(ma,tt,ha.left=e),xt(ma,Je,ha.width=t)}function La(e,t){xt(ma,Qe,ha.top=e),xt(ma,Ze,ha.height=t)}$&&je&&ae(ct,W,e=>{O._lock||(Fe(e),null!=Ma&&fa(null,ja,!0,ks.setSeries))}),a.valToIdx=e=>Lt(e,t[0]),a.posToIdx=function(e,n){return Lt(Pa(e,A,n),t[0],qe,Ue)},a.posToVal=Pa,a.valToPos=(e,t,n)=>0==x[t].ori?r(e,x[t],n?ye:ie,n?ge:0):o(e,x[t],n?be:le,n?fe:0),a.setCursor=(e,t,n)=>{Xn=e.left,Jn=e.top,Ha(null,t,n)};let Na=0==S.ori?Ra:La,za=1==S.ori?Ra:La;function _a(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)&&Wa(e,I[e]);!function(){if($&&V.live)for(let e=2==s?1:0;eUe;Da=dn,Sa=null;let l=0==S.ori?ie:le,c=1==S.ori?ie:le;if(Xn<0||0==$e||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?x[e.scale]:x[e.facets[1].scale],c,0);if(je&&null!=C){let t=1==S.ori?Xn:Jn,n=Qt(Me.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)&&(Da=n,Sa=f)}else Da=n,Sa=f}}if(Ae||Te){let e,t;0==S.ori?(e=n,t=y):(e=y,t=n);let s,r,o,l,c,b,v=!0,w=Se.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=Se.size(a,f);if(b=Se.fill(a,f),c=Se.stroke(a,f),Te)f==Sa&&Da<=Me.prox&&(i=o,u=l,d=s,h=r,m=v,p=b,g=c);else{let e=Pe[f];null!=e&&(Re[f]=o,Le[f]=l,Mt(e,s,r,v),Ft(e,b,c),Et(e,nn(o),nn(l),ie,le))}}}}if(Te){let e=Me.prox;if(Ae||(null==Ma?Da<=e:Da>e||Sa!=Ma)){let e=Pe[0];null!=e&&(Re[0]=i,Le[0]=u,Mt(e,d,h,m),Ft(e,p,g),Et(e,nn(i),nn(u),ie,le))}}}if(ha.show&&la)if(null!=e){let[t,n]=ks.scales,[a,s]=ks.match,[r,o]=e.cursor.sync.scales,i=e.cursor.drag;if(ua=i._x,da=i._y,ua||da){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&&ua?(0==b?(i=p,u=f):(i=g,u=y),d=x[t],h=j(v(i,r),d,l,0),m=j(v(i+u,r),d,l,0),Na(an(h,m),Qt(m-h))):Na(0,l),C&&da?(1==b?(i=p,u=f):(i=g,u=y),d=x[n],h=T(v(i,o),d,c,0),m=T(v(i+u,o),d,c,0),za(an(h,m),Qt(m-h))):za(0,c)}else is()}else{let e=Qt(Gn-Un),t=Qt(Kn-Wn);if(1==S.ori){let n=e;e=t,t=n}ua=ca.x&&e>=ca.dist,da=ca.y&&t>=ca.dist;let n,a,s=ca.uni;null!=s?ua&&da&&(ua=e>=s,da=t>=s,ua||da||(t>e?da=!0:ua=!0)):ca.x&&ca.y&&(ua||da)&&(ua=da=!0),ua&&(0==S.ori?(n=Hn,a=Xn):(n=Yn,a=Jn),Na(an(n,a),Qt(a-n)),da||za(0,c)),da&&(1==S.ori?(n=Hn,a=Xn):(n=Yn,a=Jn),za(an(n,a),Qt(a-n)),ua||Na(0,l)),ua||da||(Na(0,0),za(0,0))}if(ca._x=ua,ca._y=da,null==e){if(r){if(null!=As){let[e,t]=ks.scales;ks.values[0]=null!=e?Pa(0==S.ori?Xn:Jn,e):null,ks.values[1]=null!=t?Pa(1==S.ori?Xn:Jn,t):null}Es(rt,a,Xn,Jn,ie,le,o)}if(je){let e=r&&ks.setSeries,t=Me.prox;null==Ma?Da<=t&&fa(Sa,ja,!0,e):Da>t?fa(null,ja,!0,e):Sa!=Ma&&fa(Sa,ja,!0,e)}}Ae&&(V.idx=o,_a()),!1!==n&&Cs("setCursor")}a.setLegend=_a;let Ya=null;function Ga(e=!1){e?Ya=null:(Ya=p.getBoundingClientRect(),Cs("syncRect",Ya))}function Ka(e,t,n,a,s,r,o){O._lock||la&&null!=e&&0==e.movementX&&0==e.movementY||(es(e,t,n,a,s,r,0,!1,null!=e),null!=e?Ha(null,!0,!0):Ha(t,!0,!1))}function es(e,t,n,s,r,o,l,c,u){if(null==Ya&&Ga(!1),Fe(e),null!=e)n=e.clientX-Ya.left,s=e.clientY-Ya.top;else{if(n<0||s<0)return Xn=-10,void(Jn=-10);let[e,a]=ks.scales,l=t.cursor.sync,[c,u]=l.values,[d,h]=l.scales,[m,p]=ks.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,x[e],f,0):-10:f*(w/b),s=null!=h?p(a,h)?i(u,x[a],y,0):-10:y*(C/v),1==S.ori){let e=n;n=s,s=e}}!u||null!=t&&t.cursor.event.type!=rt||((n<=1||n>=ie-1)&&(n=kn(n,ie)),(s<=1||s>=le-1)&&(s=kn(s,le))),c?(Un=n,Wn=s,[Hn,Yn]=O.move(a,n,s)):(Xn=n,Jn=s)}Object.defineProperty(a,"rect",{get:()=>(null==Ya&&Ga(!1),Ya)});const ts={width:0,height:0,left:0,top:0};function is(){pa(ts,!1)}let cs,us,hs,ms;function ps(e,t,n,s,r,o,i){la=!0,ua=da=ca._x=ca._y=!1,es(e,t,n,s,r,o,0,!0,!1),null!=e&&(ae(it,gt,fs,!1),Es(ot,a,Hn,Yn,ie,le,null));let{left:l,top:c,width:u,height:d}=ha;cs=l,us=c,hs=u,ms=d}function fs(e,t,n,s,r,o,i){la=ca._x=ca._y=!1,es(e,t,n,s,r,o,0,!1,!0);let{left:l,top:c,width:u,height:d}=ha,h=u>0||d>0,m=cs!=l||us!=c||hs!=u||ms!=d;if(h&&m&&pa(ha),ca.setScale&&h&&m){let e=l,t=u,n=c,a=d;if(1==S.ori&&(e=c,t=d,n=l,a=u),ua&&ga(A,Pa(e,A),Pa(e+t,A)),da)for(let s in x){let e=x[s];s!=A&&null==e.from&&e.min!=dn&&ga(s,Pa(n+a,s),Pa(n,s))}is()}else O.lock&&(O._lock=!O._lock,Ha(t,!0,null!=e));null!=e&&(se(it,gt),Es(it,a,Xn,Jn,ie,le,null))}function ys(e,t,n,s,r,o,i){O._lock||(Fe(e),Nt(),is(),null!=e&&Es(ut,a,Xn,Jn,ie,le,null))}function bs(){C.forEach(Gs),De(a.width,a.height,!0)}Pt(ht,ft,bs);const vs={};vs.mousedown=ps,vs.mousemove=Ka,vs.mouseup=fs,vs.dblclick=ys,vs.setSeries=(e,t,n,s)=>{-1!=(n=(0,ks.match[2])(a,t,n))&&fa(n,s,!0,!1)},q&&(ae(ot,p,ps),ae(rt,p,Ka),ae(lt,p,e=>{Fe(e),Ga(!1)}),ae(ct,p,function(e,t,n,a,s,r,o){if(O._lock)return;Fe(e);let i=la;if(la){let e,t,n=!0,a=!0,s=10;0==S.ori?(e=ua,t=da):(e=da,t=ua),e&&t&&(n=Xn<=s||Xn>=ie-s,a=Jn<=s||Jn>=le-s),e&&n&&(Xn=Xn{e.call(null,a,t,n)})}(e.plugins||[]).forEach(e=>{for(let t in e.hooks)ws[t]=(ws[t]||[]).concat(e.hooks[t])});const xs=(e,t,n)=>n,ks=On({key:null,setSeries:!1,filters:{pub:vn,sub:vn},scales:[A,b[1]?b[1].scale:null],match:[wn,wn,xs],values:[null,null]},O.sync);2==ks.match.length&&ks.match.push(xs),O.sync=ks;const As=ks.key,Ds=ls(As);function Es(e,t,n,a,s,r,o){ks.filters.pub(e,t,n,a,s,r,o)&&Ds.pub(e,t,n,a,s,r,o)}function Bs(){Cs("init",e,t),Tt(t||e.data,!1),P[A]?ia(A,P[A]):Nt(),ke=ha.show&&(ha.width>0||ha.height>0),xe=Ae=!0,De(e.width,e.height)}return Ds.sub(a),a.pub=function(e,t,n,a,s,r,o){ks.filters.sub(e,t,n,a,s,r,o)&&vs[e](null,t,n,a,s,r,o)},a.destroy=function(){Ds.unsub(a),Rs.delete(a),ne.clear(),Rt(ht,ft,bs),c.remove(),null==W||W.remove(),Cs("destroy")},b.forEach(ze),C.forEach(function(e,t){if(e._show=e.show,e.show){let n=e.side%2,s=x[e.scale];null==s&&(e.scale=n?b[1].scale:A,s=x[e.scale]);let r=s.time;e.size=gn(e.size),e.space=gn(e.space),e.rotate=gn(e.rotate),Pn(e.incrs)&&e.incrs.forEach(e=>{!Bn.has(e)&&Bn.set(e,Fn(e))}),e.incrs=gn(e.incrs||(2==s.distr?sa:r?1==y?ya:wa:ra)),e.splits=gn(e.splits||(r&&1==s.distr?N:3==s.distr?qa:4==s.distr?Ua:$a)),e.stroke=gn(e.stroke),e.grid.stroke=gn(e.grid.stroke),e.ticks.stroke=gn(e.ticks.stroke),e.border.stroke=gn(e.border.stroke);let o=e.values;e.values=Pn(o)&&!Pn(o[0])?gn(o):r?Pn(o)?Aa(R,ka(o,L)):Ln(o)?function(e,t){let n=Zn(t);return(t,a,s,r,o)=>a.map(t=>n(e(t)))}(R,o):o||z:o||Oa,e.filter=gn(e.filter||(s.distr>=3&&10==s.log?Xa:3==s.distr&&2==s.log?Ja:yn)),e.font=Ys(e.font),e.labelFont=Ys(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&&(_e[t]=!0,e._el=At("u-axis",h))}}),n?n instanceof HTMLElement?(n.appendChild(c),Bs()):n(a,Bs):Bs(),a}Ks.assign=On,Ks.fmtNum=Xt,Ks.rangeNum=Ht,Ks.rangeLog=Ot,Ks.rangeAsinh=$t,Ks.orient=cs,Ks.pxRatio=bt,Ks.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=sn(1,en((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;ocs(e,r,(l,c,u,d,h,m,p,g,f,y,b)=>{[o,i]=It(u,o,i);let v=l.pxRound,{left:w,width:C}=e.bbox,x=e=>v(m(e,d,y,g)),k=e=>v(p(e,h,b,f)),A=0==d.ori?vs:ws;const D={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},E=D.stroke,B=d.dir*(0==d.ori?1:-1);let F=k(u[1==B?o:i]),S=x(c[1==B?o:i]),M=S,j=S;s&&-1==t&&(j=w,A(E,j,F)),A(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=x(c[e]),s=k(n);1==t?A(E,a,F):A(E,M,s),A(E,a,s),F=s,M=a}let T=M;s&&1==t&&(T=w+C,A(E,T,F));let[P,R]=us(e,r);if(null!=l.fill||0!=P){let t=D.fill=new Path2D(E),n=k(l.fillTo(e,r,l.min,l.max,P));A(t,T,n),A(t,j,n)}if(!l.spanGaps){let s=[];s.push(...ps(c,u,o,i,B,x,a));let h=l.width*bt/2,m=n||1==t?h:-h,p=n||-1==t?-h:h;s.forEach(e=>{e[0]+=m,e[1]+=p}),D.gaps=s=l.gaps(e,r,o,i,s),D.clip=ms(s,d.ori,g,f,y,b)}return 0!=R&&(D.band=2==R?[hs(e,r,o,i,E,-1),hs(e,r,o,i,E,1)]:hs(e,r,o,i,E,R)),D})},e.bars=function(e){const t=Yt((e=e||Mn).size,[.6,dn,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=gn(s),o=1-t[0],i=Yt(t[1],dn),l=Yt(t[2],1),c=Yt(e.disp,Mn),u=Yt(e.each,e=>{}),{fill:d,stroke:h}=c;return(e,t,s,m)=>cs(e,t,(p,g,f,y,b,v,w,C,x,k,A)=>{let D,E,B=p.pxRound,F=n,S=a*bt,M=i*bt,j=l*bt;0==y.ori?[D,E]=r(e,t):[E,D]=r(e,t);const T=y.dir*(0==y.ori?1:-1);let P,R,L,N=0==y.ori?Cs:xs,z=0==y.ori?u:(e,t,n,a,s,r,o)=>{u(e,t,n,s,a,o,r)},_=Yt(e.bands,jn).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,A,x)),$=k,q=B(p.width*bt),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*k,y.key,!0)));let n=X.values(e,t,s,m);R=2==X.unit?n[0]*k:v(n[0],y,k,C)-v(0,y,k,C),$=Ts(g,f,v,y,k,C,$),L=$-R+S}else $=Ts(g,f,v,y,k,C,$),L=$*o+S,R=$-L;L<1&&(L=0),q>=R/2&&(q=0),L<5&&(B=fn);let J=L>0;R=B(mn($-L-(J?q:0),j,M)),P=(0==F?R/2:F==T?0:R)-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=D*R,ne=E*R;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,A,x)}let s=v(2!=y.distr||null!=c?g[n]:n,y,k,C),r=w(Yt(a,V),b,A,x),o=B(s-P),i=B(sn(r,O)),l=B(an(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+en(q/2),R,sn(0,u-q),s,r),null!=W[n]&&N(H.get(W[n]),o,l+en(q/2),R,sn(0,u-q),s,r)):N(Q,o,l+en(q/2),R,sn(0,u-q),s,r),z(e,t,n,o-q/2,l,R+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=Yt(null==t?void 0:t.alignGaps,0);return(t,a,s,r)=>cs(t,a,(o,i,l,c,u,d,h,m,p,g,f)=>{[s,r]=It(l,s,r);let y,b,v,w=o.pxRound,C=e=>w(d(e,c,g,m)),x=e=>w(h(e,u,f,p));0==c.ori?(y=ys,v=vs,b=Ds):(y=bs,v=ws,b=Es);const k=c.dir*(0==c.ori?1:-1);let A=C(i[1==k?s:r]),D=A,E=[],B=[];for(let e=1==k?s:r;e>=s&&e<=r;e+=k)if(null!=l[e]){let t=C(i[e]);E.push(D=t),B.push(x(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]=us(t,a);if(null!=o.fill||0!=M){let e=F.fill=new Path2D(S),n=x(o.fillTo(t,a,o.min,o.max,M));v(e,D,n),v(e,A,n)}if(!o.spanGaps){let e=[];e.push(...ps(i,l,s,r,k,C,n)),F.gaps=e=o.gaps(t,a,s,r,e),F.clip=ms(e,c.ori,m,p,g,f)}return 0!=j&&(F.band=2==j?[hs(t,a,s,r,S,-1),hs(t,a,s,r,S,1)]:hs(t,a,s,r,S,j)),F})}(Ps,e)}}const Xs=new Map;function Js(e){var t;if(!e.startsWith("var("))return e;const n=Xs.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 Xs.set(e,o),o}function Zs(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 Qs=null,er=0;const tr=s.memo(function({timestamps:e,series:t,onHover:n,onSeriesHover:a,highlightedKey:o=null,cursorColor:i,overlayLine:l=null}){const c=s.useRef(null),u=s.useRef(null),d=s.useRef(t),h=s.useRef(o),m=s.useRef(l),p=s.useRef(n),g=s.useRef(a),f=s.useRef(null),y=s.useRef(e.length);s.useLayoutEffect(()=>{d.current=t,h.current=o,m.current=l,p.current=n,g.current=a});const b=s.useMemo(()=>{const t=new Array(e.length).fill(1);return[e,t]},[e]),v=s.useMemo(()=>({hooks:{draw:e=>{(function(e,t,n,a){if(0===t.length)return;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=8*(window.devicePixelRatio||1);s.save(),s.beginPath(),s.roundRect(o,i,l,c,u),s.clip();const d=e.data[0],h=d.length;if(0===h)return;const m=d[0],p=d[h-1]-m||1,g=h>1?d[1]-d[0]:p/h,f=e=>o+(e-m)/p*l,y=e=>i+c*(1-e);for(let b=0;b=0;t--){const e=d[t],n=y(r[t]),a=f(t0&&s.lineTo(o,y(r[t-1]))}s.closePath(),s.fill(),s.restore()}a&&a.values.length>0&&function(e,t){const n=e.ctx,a=e.bbox,s=a.left,r=a.top,o=a.width,i=a.height;if(o<=0||i<=0)return;const l=e.data[0],c=l.length,u=t.values;if(0===c||0===u.length)return;const d=window.devicePixelRatio||1,h=l[0],m=l[c-1]-h||1,p=e=>s+(e-h)/m*o,g=e=>r+i*(1-e),f=Js(t.color),y=(t.lineWidth??2)*d;n.save(),n.strokeStyle=f,n.lineWidth=y,n.lineCap="round",n.lineJoin="round",n.beginPath();let b=0;for(;b=c)return void n.restore();const v=p(l[b]),w=g(u[b]);n.moveTo(v,w);for(let x=b+1;x({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=p.current)||t.call(p,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],h=l[2];let m=null;if(l[3]>10){const e=d.current;for(const t of e){const e=Js(t.color),[n,a,s]=Zs(e),r=30;if(Math.abs(c-n)<=r&&Math.abs(u-a)<=r&&Math.abs(h-s)<=r){m=t.key;break}}}m!==f.current&&(f.current=m,null==(n=g.current)||n.call(g,m))}}else null==(a=p.current)||a.call(p,null,null),null!==f.current&&(f.current=null,null==(s=g.current)||s.call(g,null))}]},plugins:[v]}),[v]);s.useEffect(()=>{const t=c.current;if(!t||0===e.length)return;const n=y.current,a=e.length,s=Math.abs(a-n);if(!(!u.current||s>100||n>0&&s/n>.1)&&u.current)return u.current.setData(b),void(y.current=a);u.current&&u.current.destroy();const r=t.getBoundingClientRect(),o=Math.floor(r.width)||400,i=Math.floor(r.height)||200,l=new Ks({...w,width:o,height:i},b,t);return u.current=l,y.current=a,()=>{l.destroy(),u.current=null}},[w,b,e.length]),s.useEffect(()=>{const e=c.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!u.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&u.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{u.current&&u.current.redraw()},[o,t,l]);const C=s.useCallback(()=>{null==n||n(null,null),null==a||a(null),f.current=null},[n,a]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available"}):r.jsx("div",{ref:c,className:"w-full h-full overflow-hidden",onMouseLeave:C})}),nr=s.createContext(null),ar={blksand:"breeze dark",magma:"breeze dark",waves:"breeze dark",stars:"breeze dark",folds:"breeze dark","kde breeze":"breeze dark",ribbon:"breeze light"};function sr(e){const t=xe(e);t&&function(e){if("undefined"==typeof document)return;const t=function(e){var t;const n={},a=e.surfaces.glass;n["--glass-tint"]=a.tint,n["--glass-light"]=a.light,n["--glass-dark"]=a.dark,n["--glass-reflex-light"]=String(a.reflexLight),n["--glass-reflex-dark"]=String(a.reflexDark),n["--glass-blur"]=`${a.blur}px`,n["--glass-blur-elevated"]=`${a.blurElevated}px`,n["--glass-brightness"]=String(a.brightness),n["--glass-bg-opacity"]=`${a.opacity}%`,n["--glass-bg-opacity-elevated"]=`${a.opacityElevated}%`,n["--glass-stroke-only"]=a.strokeOnly?"1":"0",n["--glass-stroke-width"]=a.strokeWidth?`${a.strokeWidth}px`:"0px",n["--glass-stroke-color"]=a.strokeColor||"transparent",n["--sidebar-tint"]=e.surfaces.sidebar.tint,n["--tooltip-bg"]=e.colors.bg.surface,n["--hover-tint"]=`rgba(${N(e.colors.accent.primary)}, 0.08)`,n["--shadow-tint"]=`rgba(${N(e.colors.accent.primary)}, 0.35)`,n["--bg-body"]=e.colors.bg.body,n["--bg-surface"]=e.colors.bg.surface,n["--bg-elevated"]=e.colors.bg.elevated,n["--bg-subtle"]=e.colors.bg.subtle,n["--border-subtle"]=e.colors.border.subtle,n["--border-strong"]=e.colors.border.strong,n["--text-primary"]=e.colors.text.primary,n["--text-secondary"]=e.colors.text.secondary,n["--text-muted"]=e.colors.text.muted,n["--text-invert"]=e.colors.text.inverse,n["--accent-primary"]=e.colors.accent.primary,n["--accent-secondary"]=e.colors.accent.secondary,n["--accent-tertiary"]=e.colors.accent.tertiary,n["--accent-success"]=e.colors.accent.success,n["--accent-danger"]=e.colors.accent.danger,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"]=e.colors.accent.secondary,n["--pkt-flood"]=e.colors.accent.tertiary,n["--pkt-txt-msg"]=e.colors.accent.success,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.accent.danger,n["--pkt-path"]=s.c3,n["--pkt-anon"]=e.colors.accent.secondary,n["--pkt-unknown"]=e.colors.status.muted,n["--route-flood"]=e.colors.accent.primary,n["--route-direct"]=e.colors.accent.secondary,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.accent.danger,n["--log-critical"]=e.colors.accent.danger;const r=e.colors.map;n["--map-node-fill"]="#3B82F6",n["--map-node-stroke"]="rgba(255,255,255,0.9)",n["--map-hub-color"]="#8E4EC6",n["--map-hub-stroke"]="rgba(255,255,255,0.9)",n["--map-gateway-color"]="#5B5BD6",n["--map-gateway-stroke"]="rgba(255,255,255,0.85)",n["--map-local-color"]="#FFB224",n["--map-neighbor-color"]="#FFB224",n["--map-neighbor-stroke"]="rgba(0,0,0,0.4)",n["--map-mobile-color"]="#F76B15",n["--map-room-color"]="#D6409F",n["--map-ghost-color"]="#00A2C7",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"]="#8E4EC6",n["--map-edge-hover-standard"]=e.colors.text.muted,n["--map-edge-hover-neighbor"]="#FFB224",n["--link-strong"]=e.colors.accent.success,n["--link-medium"]=e.colors.accent.secondary,n["--link-weak"]=e.colors.accent.danger,n["--hop-0"]=e.colors.accent.tertiary,n["--hop-1"]=e.colors.accent.success,n["--hop-2"]=s.c3,n["--hop-3"]=e.colors.accent.secondary,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)??e.colors.accent.primary,n["--icon-card-title"]=(null==o?void 0:o.cardTitle)??e.colors.accent.primary,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)??e.colors.accent.primary,n["--toggle-on"]=e.colors.accent.success,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, ${e.colors.accent.primary} 15%, transparent)`,n["--sidebar-nav-active-text"]=(null==l?void 0:l.navActiveText)??e.colors.accent.primary,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.02)",n["--terminal-border"]=i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)",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["--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(!P())return e;const t={},n=/^#[0-9A-Fa-f]{3,6}$/;for(const[a,s]of Object.entries(e))t[a]=n.test(s)?T(s):s;return t}(n)}(e),n=document.documentElement;for(const[a,s]of Object.entries(t))n.style.setProperty(a,s);e.surfaces.glass.strokeOnly?n.classList.add("stroke-only"):n.classList.remove("stroke-only"),e.surfaces.glass.catalystMode?n.classList.add("catalyst-mode"):n.classList.remove("catalyst-mode"),n.dataset.mode=e.meta.isDark?"dark":"light"}(t),document.documentElement.dataset.colorScheme=e}function rr({children:e}){const[t,n]=s.useState(()=>function(){if("undefined"==typeof window)return Re;try{let n=localStorage.getItem(Le),a=localStorage.getItem(Ne);const s=localStorage.getItem(ze);if(!n&&!a){const e=localStorage.getItem(_e);if(e){const t=Pe.find(t=>t.id===e);t&&(n=t.colorScheme,a=t.backgroundImage,localStorage.setItem(Le,n),localStorage.setItem(Ne,a),localStorage.removeItem(_e))}}n&&n in ar&&(n=ar[n],a="",localStorage.setItem(Le,n),localStorage.setItem(Ne,a));const r=n&&"string"==typeof(t=n)&&je.some(e=>e.id===t)?n:Re.colorScheme;let o=Re.backgroundImage;""===a?o="":a&&"string"==typeof(e=a)&&Te.some(t=>t.src===e)&&(o=a);let i=Re.brightness;if(s){const e=parseInt(s,10);!isNaN(e)&&e>=0&&e<=100&&(i=e)}return{colorScheme:r,backgroundImage:o,brightness:i}}catch{return Re}var e,t}()),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,sr(t.colorScheme),Xs.clear(),requestAnimationFrame(()=>{!function(){if("undefined"==typeof window)return;for(const t of Oe){const e=Ye(`--palette-${t}-bright`),n=Ye(`--palette-${t}`),a=e||n;if(!a)continue;const s=He(a);for(const r of Ve)Ge(`--palette-${t}-${r}`,s[r])}const e=Ye("--palette-bg-4");if(e){const t=He(e);for(const e of Ve)Ge(`--palette-neutral-${e}`,t[e])}}()})},[t.colorScheme]),s.useEffect(()=>{!function(e){if("undefined"!=typeof window)try{localStorage.setItem(Le,e.colorScheme),localStorage.setItem(Ne,e.backgroundImage),localStorage.setItem(ze,String(e.brightness))}catch{}}(t)},[t]),s.useEffect(()=>{Te.forEach(e=>{(new Image).src=e.src})},[]);const c=s.useCallback(e=>{n(t=>({...t,colorScheme:e}))},[]),u=s.useCallback(e=>{const t=Te.find(t=>t.src===e);n(n=>({...n,backgroundImage:e,brightness:(null==t?void 0:t.suggestedBrightness)??n.brightness}))},[]),d=s.useCallback(e=>{const t=Math.max(0,Math.min(100,Math.round(e)));n(e=>({...e,brightness:t}))},[]),h=s.useCallback(e=>{const t=Pe.find(t=>t.id===e);if(t){const e=!t.backgroundImage,a=e?null:Te.find(e=>e.src===t.backgroundImage);n(n=>({...n,colorScheme:t.colorScheme,backgroundImage:t.backgroundImage,brightness:e?100:(null==a?void 0:a.suggestedBrightness)??n.brightness}))}},[]),m=s.useMemo(()=>({theme:t,setColorScheme:c,setBackgroundImage:u,setBrightness:d,setThemePreset:h}),[t,c,u,d,h]);return r.jsxs(nr.Provider,{value:m,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.colorScheme),r.jsx("style",{children:"\n @keyframes theme-crossfade {\n from { opacity: 0.35; }\n to { opacity: 0; }\n }\n "})]})}function or(){const e=s.useContext(nr);if(!e)throw new Error("useTheme must be used within a ThemeProvider. Wrap your app with in App.tsx.");return e}const ir=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(A,{...a,to:n,ref:t})})}),lr={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"},cr={0:"T_FLOOD",1:"FLOOD",2:"DIRECT",3:"T_DIRECT"},ur={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 dr(e){return 1===e||0===e}const hr={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 mr(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 pr={waves:"batlow",blksand:"tokyo",breeze:"imola",magma:"batlow",ribbon:"hawaii",stars:"batlow",folds:"imola"},gr={[ur.ADVERT]:1,[ur.TXT_MSG]:4,[ur.GRP_TXT]:2,[ur.RESPONSE]:8,[ur.REQ]:13,[ur.ANON_REQ]:7,[ur.ACK]:11,[ur.PATH]:24,[ur.TRACE]:16,[ur.GRP_DATA]:34,[ur.MULTIPART]:52,[ur.RAW_CUSTOM]:14};function fr(){let e="waves",t=!0;if("undefined"!=typeof window){e=localStorage.getItem("pymc-color-scheme")||"waves";const n=xe(e);t=(null==n?void 0:n.meta.isDark)??!0}const n=pr[e]??"batlow",a=hr[n],s=a.discrete.length,r=Math.floor(s/2);return{colormap:a,colormapName:n,isDark:t,baseIndex:t?r:0,halfSize:r}}let yr=null;function br(e){const{colormap:t,isDark:n}=fr();if("number"!=typeof e)return n?"#A5A5A5":"#666666";const a=gr[e];if(void 0===a)return n?"#A5A5A5":"#666666";const s=t.categorical;return s[Math.min(a,s.length-1)]}function vr(e){const t=br(e);return null===yr&&(yr=P()),yr?function(e){return P()?T(e):e}(t):t}function wr(e){return mr(br(e))}function Cr(e){return null==e?"UNKNOWN":lr[e]||`TYPE_${e}`}function xr(e){return null==e?"UNKNOWN":cr[e]||`ROUTE_${e}`}function kr(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function Ar(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 kr(t,1)>kr(t,0)?"light":"dark"}function Dr(e){return 1===e||!0===e}const Er=i("inline-flex items-center gap-1","radius-badge px-1.5 py-0.5","text-xs"),Br={fontFamily:"var(--font-badge)",fontWeight:"var(--font-badge-weight)",textTransform:"var(--badge-text-transform, none)"},Fr={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(--text-muted)"};function Sr(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 Mr({color:e="zinc",customColor:t,filled:n=!1,compact:a=!1,className:o,title:l,children:c}){const u=s.useMemo(()=>{const a=t??Fr[e];if(n){if(t){const e=Ar(Sr(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(Er,a&&"!px-1 !py-0 !text-[10px]",o),style:{...Br,...u},title:l,children:c})}const jr=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??Fr[e];if(n){if(t){const e=Ar(Sr(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(Er,a&&"!px-1 !py-0 !text-[10px]","interactive hover-opacity",o);return"href"in u&&void 0!==u.href?r.jsx(ir,{...u,ref:d,className:m,style:{...Br,...h},children:c}):r.jsx(l,{...u,ref:d,className:m,style:{...Br,...h},children:c})}),Tr=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"),Pr={primary:i("bg-accent-primary text-white","hover:bg-accent-primary/90","active:bg-accent-primary/80","border border-accent-primary/20"),success:i("bg-accent-success text-white","hover:bg-accent-success/90","active:bg-accent-success/80","border border-accent-success/20"),danger:i("bg-accent-danger text-white","hover:bg-accent-danger/90","active:bg-accent-danger/80","border border-accent-danger/20"),warning:i("bg-accent-secondary text-bg-body","hover:bg-accent-secondary/90","active:bg-accent-secondary/80","border border-accent-secondary/20"),muted:i("bg-bg-elevated text-text-primary","hover:bg-bg-subtle","active:bg-bg-elevated","border border-border-subtle")},Rr={primary:i("bg-transparent text-accent-primary","border border-accent-primary/30","hover:bg-accent-primary/10 hover:border-accent-primary/50","active:bg-accent-primary/20"),success:i("bg-transparent text-accent-success","border border-accent-success/30","hover:bg-accent-success/10 hover:border-accent-success/50","active:bg-accent-success/20"),danger:i("bg-transparent text-accent-danger","border border-accent-danger/30","hover:bg-accent-danger/10 hover:border-accent-danger/50","active:bg-accent-danger/20"),warning:i("bg-transparent text-accent-secondary","border border-accent-secondary/30","hover:bg-accent-secondary/10 hover:border-accent-secondary/50","active:bg-accent-secondary/20"),muted:i("bg-transparent text-text-muted","border border-border-subtle","hover:bg-bg-subtle hover:text-text-primary hover:border-border-strong","active:bg-bg-elevated")},Lr={primary:i("bg-transparent text-accent-primary border-transparent","hover:bg-accent-primary/10","active:bg-accent-primary/20"),success:i("bg-transparent text-accent-success border-transparent","hover:bg-accent-success/10","active:bg-accent-success/20"),danger:i("bg-transparent text-accent-danger border-transparent","hover:bg-accent-danger/10","active:bg-accent-danger/20"),warning:i("bg-transparent text-accent-secondary border-transparent","hover:bg-accent-secondary/10","active:bg-accent-secondary/20"),muted:i("bg-transparent text-text-muted border-transparent","hover:bg-bg-subtle hover:text-text-primary","active:bg-bg-elevated")},Nr=s.forwardRef(function({color:e="muted",outline:t=!1,plain:n=!1,className:a,children:s,...o},c){const u=i(Tr,n?Lr[e]:t?Rr[e]:Pr[e],a);return"href"in o&&void 0!==o.href?r.jsx(ir,{...o,ref:c,className:u,children:s}):r.jsx(l,{...o,ref:c,className:u,children:s})}),zr=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)},_r=(...e)=>e.filter((e,t,n)=>Boolean(e)&&""!==e.trim()&&n.indexOf(e)===t).join(" ").trim(),Ir=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var Vr={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 Or=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,...Vr,width:t,height:t,stroke:e,strokeWidth:a?24*Number(n)/Number(t):n,className:_r("lucide",r),...!o&&!Ir(l)&&{"aria-hidden":"true"},...l},[...i.map(([e,t])=>s.createElement(e,t)),...Array.isArray(o)?o:[o]])),$r=(e,t)=>{const n=s.forwardRef(({className:n,...a},r)=>{return s.createElement(Or,{ref:r,iconNode:t,className:_r(`lucide-${o=zr(e),o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,n),...a});var o});return n.displayName=zr(e),n},qr=$r("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"}]]),Ur=$r("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),Wr=$r("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),Hr=$r("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),Yr=$r("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"}]]),Gr=$r("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"}]]),Kr=$r("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]),Xr=$r("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"}]]),Jr=$r("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"}]]),Zr=$r("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"}]]),Qr=$r("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),eo=$r("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"}]]),to=$r("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"}]]),no=$r("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]),ao=$r("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"}]]),so=$r("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),ro=$r("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"}]]),oo=$r("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"}]]),io=$r("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"}]]),lo=$r("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"}]]),co=$r("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"}]]),uo=$r("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"}]]),ho=$r("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"}]]),mo=$r("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"}]]),po=$r("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"}]]),go=$r("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),fo=s.createContext({});function yo(e){const t=s.useRef(null);return null===t.current&&(t.current=e()),t.current}const bo="undefined"!=typeof window,vo=bo?s.useLayoutEffect:s.useEffect,wo=s.createContext(null);function Co(e,t){-1===e.indexOf(t)&&e.push(t)}function xo(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const ko=(e,t,n)=>n>t?t:n/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Eo(e){return"object"==typeof e&&null!==e}const Bo=e=>/^0[^.\s]+$/u.test(e);function Fo(e){let t;return()=>(void 0===t&&(t=e()),t)}const So=e=>e,Mo=(e,t)=>n=>t(e(n)),jo=(...e)=>e.reduce(Mo),To=(e,t,n)=>{const a=t-e;return 0===a?1:(n-e)/a};class Po{constructor(){this.subscriptions=[]}add(e){return Co(this.subscriptions,e),()=>xo(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,Lo=e=>e/1e3;function No(e,t){return t?e*(1e3/t):0}const zo=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function _o(e,t,n,a){if(e===t&&n===a)return So;return s=>0===s||1===s?s:zo(function(e,t,n,a,s){let r,o,i=0;do{o=t+(n-t)/2,r=zo(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 Io=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Vo=e=>t=>1-e(1-t),Oo=_o(.33,1.53,.69,.99),$o=Vo(Oo),qo=Io($o),Uo=e=>(e*=2)<1?.5*$o(e):.5*(2-Math.pow(2,-10*(e-1))),Wo=e=>1-Math.sin(Math.acos(e)),Ho=Vo(Wo),Yo=Io(Wo),Go=_o(.42,0,1,1),Ko=_o(0,0,.58,1),Xo=_o(.42,0,.58,1),Jo=e=>Array.isArray(e)&&"number"!=typeof e[0],Zo=e=>Array.isArray(e)&&"number"==typeof e[0],Qo={linear:So,easeIn:Go,easeInOut:Xo,easeOut:Ko,circIn:Wo,circInOut:Yo,circOut:Ho,backIn:$o,backInOut:qo,backOut:Oo,anticipate:Uo},ei=e=>{if(Zo(e)){e.length;const[t,n,a,s]=e;return _o(t,n,a,s)}return"string"==typeof e?Qo[e]:e},ti=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function ni(e,t){let n=!1,a=!0;const s={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,o=ti.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=Ao.useManualTiming?s.timestamp:performance.now();n=!1,Ao.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:ti.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===ii&&ci.set(ri.isProcessing||Ao.useManualTiming?ri.timestamp:performance.now()),ii),set:e=>{ii=e,queueMicrotask(li)}},ui=e=>t=>"string"==typeof t&&t.startsWith(e),di=ui("--"),hi=ui("var(--"),mi=e=>!!hi(e)&&pi.test(e.split("/*")[0].trim()),pi=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function gi(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}const fi={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},yi={...fi,transform:e=>ko(0,1,e)},bi={...fi,default:1},vi=e=>Math.round(1e5*e)/1e5,wi=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,Ci=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,xi=(e,t)=>n=>Boolean("string"==typeof n&&Ci.test(n)&&n.startsWith(e)||t&&!function(e){return null==e}(n)&&Object.prototype.hasOwnProperty.call(n,t)),ki=(e,t,n)=>a=>{if("string"!=typeof a)return a;const[s,r,o,i]=a.match(wi);return{[e]:parseFloat(s),[t]:parseFloat(r),[n]:parseFloat(o),alpha:void 0!==i?parseFloat(i):1}},Ai={...fi,transform:e=>Math.round((e=>ko(0,255,e))(e))},Di={test:xi("rgb","red"),parse:ki("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:a=1})=>"rgba("+Ai.transform(e)+", "+Ai.transform(t)+", "+Ai.transform(n)+", "+vi(yi.transform(a))+")"},Ei={test:xi("#"),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:Di.transform},Bi=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),Fi=Bi("deg"),Si=Bi("%"),Mi=Bi("px"),ji=Bi("vh"),Ti=Bi("vw"),Pi=(()=>({...Si,parse:e=>Si.parse(e)/100,transform:e=>Si.transform(100*e)}))(),Ri={test:xi("hsl","hue"),parse:ki("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:a=1})=>"hsla("+Math.round(e)+", "+Si.transform(vi(t))+", "+Si.transform(vi(n))+", "+vi(yi.transform(a))+")"},Li={test:e=>Di.test(e)||Ei.test(e)||Ri.test(e),parse:e=>Di.test(e)?Di.parse(e):Ri.test(e)?Ri.parse(e):Ei.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?Di.transform(e):Ri.transform(e),getAnimatableNone:e=>{const t=Li.parse(e);return t.alpha=0,Li.transform(t)}},Ni=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,zi="number",_i="color",Ii=/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 Vi(e){const t=e.toString(),n=[],a={color:[],number:[],var:[]},s=[];let r=0;const o=t.replace(Ii,e=>(Li.test(e)?(a.color.push(r),s.push(_i),n.push(Li.parse(e))):e.startsWith("var(")?(a.var.push(r),s.push("var"),n.push(e)):(a.number.push(r),s.push(zi),n.push(parseFloat(e))),++r,"${}")).split("${}");return{values:n,split:o,indexes:a,types:s}}function Oi(e){return Vi(e).values}function $i(e){const{split:t,types:n}=Vi(e),a=t.length;return e=>{let s="";for(let r=0;r"number"==typeof e?0:Li.test(e)?Li.getAnimatableNone(e):e,Ui={test:function(e){var t,n;return isNaN(e)&&"string"==typeof e&&((null==(t=e.match(wi))?void 0:t.length)||0)+((null==(n=e.match(Ni))?void 0:n.length)||0)>0},parse:Oi,createTransformer:$i,getAnimatableNone:function(e){const t=Oi(e);return $i(e)(t.map(qi))}};function Wi(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 Hi(e,t){return n=>n>0?t:e}const Yi=(e,t,n)=>e+(t-e)*n,Gi=(e,t,n)=>{const a=e*e,s=n*(t*t-a)+a;return s<0?0:Math.sqrt(s)},Ki=[Ei,Di,Ri];function Xi(e){const t=(n=e,Ki.find(e=>e.test(n)));var n;if(!Boolean(t))return!1;let a=t.parse(e);return t===Ri&&(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=Wi(i,a,e+1/3),r=Wi(i,a,e),o=Wi(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 Ji=(e,t)=>{const n=Xi(e),a=Xi(t);if(!n||!a)return Hi(e,t);const s={...n};return e=>(s.red=Gi(n.red,a.red,e),s.green=Gi(n.green,a.green,e),s.blue=Gi(n.blue,a.blue,e),s.alpha=Yi(n.alpha,a.alpha,e),Di.transform(s))},Zi=new Set(["none","hidden"]);function Qi(e,t){return n=>Yi(e,t,n)}function el(e){return"number"==typeof e?Qi:"string"==typeof e?mi(e)?Hi:Li.test(e)?Ji:al:Array.isArray(e)?tl:"object"==typeof e?Li.test(e)?Ji:nl:Hi}function tl(e,t){const n=[...e],a=n.length,s=e.map((e,n)=>el(e)(e,t[n]));return e=>{for(let t=0;t{for(const t in a)n[t]=a[t](e);return n}}const al=(e,t)=>{const n=Ui.createTransformer(t),a=Vi(e),s=Vi(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?Zi.has(e)&&!s.values.length||Zi.has(t)&&!a.values.length?function(e,t){return Zi.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}(e,t):jo(tl(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)=>ai.update(t,e),stop:()=>si(t),now:()=>ri.isProcessing?ri.timestamp:ci.now()}},ol=(e,t,n=10)=>{let a="";const s=Math.max(Math.round(t/n),2);for(let r=0;r=il?1/0:t}function cl(e,t=100,n){const a=n({...e,keyframes:[0,t]}),s=Math.min(ll(a),il);return{type:"keyframes",ease:e=>a.next(s*e).value/t,duration:Lo(s)}}function ul(e,t,n){const a=Math.max(t-5,0);return No(n-e(a),t-a)}const dl=.01,hl=2,ml=.005,pl=.5;const gl=12;function fl(e,t){return e*Math.sqrt(1-t*t)}const yl=["duration","bounce"],bl=["stiffness","damping","mass"];function vl(e,t){return t.some(t=>void 0!==e[t])}function wl(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(!vl(e,bl)&&vl(e,yl))if(e.visualDuration){const n=e.visualDuration,a=2*Math.PI/(1.2*n),s=a*a,r=2*ko(.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=ko(.05,1,o),e=ko(.01,10,Lo(e)),o<1?(s=t=>{const a=t*o,s=a*e;return.001-(a-n)/fl(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=fl(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?Ro(p):ul(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(ll(w),il),t=ol(t=>w.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return w}function Cl({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 x=e=>{var t;t=h.value,(void 0!==i&&tl)&&(w=e,C=wl({keyframes:[h.value,m(h.value)],velocity:ul(b,e,h.value),damping:s,stiffness:r,restDelta:c,restSpeed:u}))};return x(0),{calculatedDuration:null,next:e=>{let t=!1;return C||void 0!==w||(t=!0,v(e),x(e)),void 0!==w&&e>=w?C.next(e-w):(!t&&v(e),h)}}}function xl(e,t){const n=e[e.length-1];for(let a=1;a<=t;a++){const s=To(0,t,a);e.push(Yi(n,1,s))}}function kl(e){const t=[0];return xl(t,e.length-1),t}function Al({duration:e=300,keyframes:t,times:n,ease:a="easeInOut"}){const s=Jo(a)?a.map(ei):ei(a),r={done:!1,value:t[0]},o=function(e,t){return e.map(e=>e*t)}(n&&n.length===t.length?n:kl(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||Ao.mix||sl,r=e.length-1;for(let o=0;o{if(o&&n1)for(;ac(ko(e[0],e[r-1],t)):c}(o,t,{ease:Array.isArray(s)?s:(l=t,c=s,l.map(()=>c||Xo).splice(0,l.length-1))});var l,c;return{calculatedDuration:e,next:t=>(r.value=i(t),r.done=t>=e,r)}}wl.applyToOptions=e=>{const t=cl(e,100,wl);return e.ease=t.ease,e.duration=Ro(t.duration),e.type="keyframes",e};const Dl=e=>null!==e;function El(e,{repeat:t,repeatType:n="loop"},a,s=1){const r=e.filter(Dl),o=s<0||t&&"loop"!==n&&t%2==1?0:r.length-1;return o&&void 0!==a?a:r[o]}const Bl={decay:Cl,inertia:Cl,tween:Al,keyframes:Al,spring:wl};function Fl(e){"string"==typeof e.type&&(e.type=Bl[e.type])}class Sl{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 Ml=e=>e/100;class jl extends Sl{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!==ci.now()&&this.tick(ci.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;Fl(e);const{type:t=Al,repeat:n=0,repeatDelay:a=0,repeatType:s,velocity:r=0}=e;let{keyframes:o}=e;const i=t||Al;i!==Al&&"number"!=typeof o[0]&&(this.mixKeyframes=jo(Ml,sl(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=ll(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=ko(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 x=null===this.holdTime&&("finished"===this.state||"running"===this.state&&C);return x&&m!==Cl&&(w.value=El(c,this.options,g,this.speed)),p&&p(w.value),x&&this.finish(),w}then(e,t){return this.finished.then(e,t)}get duration(){return Lo(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Lo(e)}get time(){return Lo(this.currentTime)}set time(e){var t;e=Ro(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(ci.now());const t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Lo(this.currentTime))}play(){var e,t;if(this.isStopped)return;const{driver:n=rl,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(ci.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 Tl=e=>180*e/Math.PI,Pl=e=>{const t=Tl(Math.atan2(e[1],e[0]));return Ll(t)},Rl={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Pl,rotateZ:Pl,skewX:e=>Tl(Math.atan(e[1])),skewY:e=>Tl(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Ll=e=>((e%=360)<0&&(e+=360),e),Nl=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),zl=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),_l={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Nl,scaleY:zl,scale:e=>(Nl(e)+zl(e))/2,rotateX:e=>Ll(Tl(Math.atan2(e[6],e[5]))),rotateY:e=>Ll(Tl(Math.atan2(-e[2],e[0]))),rotateZ:Pl,rotate:Pl,skewX:e=>Tl(Math.atan(e[4])),skewY:e=>Tl(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Il(e){return e.includes("scale")?1:0}function Vl(e,t){if(!e||"none"===e)return Il(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,s;if(n)a=_l,s=n;else{const t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=Rl,s=t}if(!s)return Il(t);const r=a[t],o=s[1].split(",").map(Ol);return"function"==typeof r?r(o):o[r]}function Ol(e){return parseFloat(e.trim())}const $l=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ql=(()=>new Set($l))(),Ul=e=>e===fi||e===Mi,Wl=new Set(["x","y","z"]),Hl=$l.filter(e=>!Wl.has(e)),Yl={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})=>Vl(t,"x"),y:(e,{transform:t})=>Vl(t,"y")};Yl.translateX=Yl.x,Yl.translateY=Yl.y;const Gl=new Set;let Kl=!1,Xl=!1,Jl=!1;function Zl(){if(Xl){const e=Array.from(Gl).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 Hl.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)})}Xl=!1,Kl=!1,Gl.forEach(e=>e.complete(Jl)),Gl.clear()}function Ql(){Gl.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Xl=!0)})}class ec{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?(Gl.add(this),Kl||(Kl=!0,ai.read(Ql),ai.resolveKeyframes(Zl))):(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),nc={};function ac(e,t){const n=Fo(e);return()=>nc[t]??n()}const sc=ac(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),rc=([e,t,n,a])=>`cubic-bezier(${e}, ${t}, ${n}, ${a})`,oc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:rc([0,.65,.55,1]),circOut:rc([.55,0,1,.45]),backIn:rc([.31,.01,.66,-.59]),backOut:rc([.33,1.53,.69,.99])};function ic(e,t){return e?"function"==typeof e?sc()?ol(e,t):"ease-out":Zo(e)?rc(e):Array.isArray(e)?e.map(e=>ic(e,t)||oc.easeOut):oc[e]:void 0}function lc(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=ic(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 cc(e){return"function"==typeof e&&"applyToOptions"in e}class uc extends Sl{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 cc(e)&&sc()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=lc(t,n,a,l,s),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const e=El(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 Lo(Number(n))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Lo(e)}get time(){return Lo(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ro(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&&tc()?(this.animation.timeline=e,So):t(this)}}const dc={anticipate:Uo,backInOut:qo,circInOut:Yo};class hc extends uc{constructor(e){var t;"string"==typeof(t=e).ease&&t.ease in dc&&(t.ease=dc[t.ease]),Fl(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 jl({...r,autoplay:!1}),i=Math.max(10,ci.now()-this.startTime),l=ko(0,10,i-10);t.setWithVelocity(o.sample(Math.max(0,i-l)).value,o.sample(i).value,l),o.stop()}}const mc=(e,t)=>!("zIndex"===t||"number"!=typeof e&&!Array.isArray(e)&&("string"!=typeof e||!Ui.test(e)&&"0"!==e||e.startsWith("url(")));function pc(e){e.duration=0,e.type="keyframes"}const gc=new Set(["opacity","clipPath","filter","transform"]),fc=Fo(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class yc extends Sl{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=ci.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)||ec;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=ci.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=mc(s,t),i=mc(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 fc()&&a&&gc.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 hc({...h,element:p}):new jl(h);g.finished.then(()=>{this.notifyFinished()}).catch(So),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(),Jl=!0,Ql(),Zl(),Jl=!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 bc(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 vc=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function wc(e,t,n=1){const[a,s]=function(e){const t=vc.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 Do(e)?parseFloat(e):e}return mi(s)?wc(s,t,n+1):s}const Cc={type:"spring",stiffness:500,damping:25,restSpeed:10},xc={type:"keyframes",duration:.8},kc={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ac=e=>null!==e;function Dc(e,t){return(null==e?void 0:e[t])??(null==e?void 0:e.default)??e}const Ec=(e,t,n,a={},s,r)=>o=>{const i=Dc(a,e)||{},l=i.delay||a.delay||0;let{elapsed:c=0}=a;c-=Ro(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?xc:ql.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:Cc:kc)(e,u)),u.duration&&(u.duration=Ro(u.duration)),u.repeatDelay&&(u.repeatDelay=Ro(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let d=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(pc(u),0===u.delay&&(d=!0)),(Ao.instantAnimations||Ao.skipAnimations)&&(d=!0,pc(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(Ac);return a[t&&"loop"!==n&&t%2==1?0:a.length-1]}(u.keyframes,i);if(void 0!==e)return void ai.update(()=>{u.onUpdate(e),u.onComplete()})}return i.isSync?new jl(u):new yc(u)};function Bc(e){const t=[{},{}];return null==e||e.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function Fc(e,t,n,a){if("function"==typeof t){const[s,r]=Bc(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]=Bc(a);t=t(void 0!==n?n:e.custom,s,r)}return t}function Sc(e,t,n){const a=e.getProps();return Fc(a,t,void 0!==n?n:a.custom,e)}const Mc=new Set(["width","height","top","left","right","bottom",...$l]);class jc{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{var t;const n=ci.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=ci.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 Po);const n=this.events[e].add(t);return"change"===e?()=>{n(),ai.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=ci.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return No(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 Tc(e,t){return new jc(e,t)}const Pc=e=>Array.isArray(e);function Rc(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Tc(n))}function Lc(e){return Pc(e)?e[e.length-1]||0:e}function Nc(e,t){const n=Sc(e,t);let{transitionEnd:a={},transition:s={},...r}=n||{};r={...r,...a};for(const o in r)Rc(e,o,Lc(r[o]))}const zc=e=>Boolean(e&&e.getVelocity);function _c(e,t){const n=e.getValue("willChange");if(a=n,Boolean(zc(a)&&a.add))return n.add(t);if(!n&&Ao.WillChange){const n=new Ao.WillChange("auto");e.addValue("willChange",n),n.add(t)}var a}function Ic(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const Vc="data-"+Ic("framerAppearId");function Oc(e){return e.props[Vc]}function $c({protectedKeys:e,needsAnimating:t},n){const a=e.hasOwnProperty(n)&&!0!==t[n];return t[n]=!1,a}function qc(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&&$c(c,u))continue;const s={delay:n,...Dc(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=Oc(e);if(t){const e=window.MotionHandoffAnimation(t,u,ai);null!==e&&(s.startTime=e,d=!0)}}_c(e,u),t.start(Ec(u,t,a,e.shouldReduceMotion&&Mc.has(u)?{type:!1}:s,e,d));const h=t.animation;h&&l.push(h)}return o&&Promise.all(l).then(()=>{ai.update(()=>{o&&Nc(e,o)})}),l}function Uc(e,t,n={}){var a;const s=Sc(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(qc(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(Uc(l,t,{...o,delay:n+("function"==typeof a?0:a)+bc(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 Wc(e,t,n={}){let a;if(e.notify("AnimationStart",t),Array.isArray(t)){const s=t.map(t=>Uc(e,t,n));a=Promise.all(s)}else if("string"==typeof t)a=Uc(e,t,n);else{const s="function"==typeof t?Sc(e,t,n.custom):t;a=Promise.all(qc(e,s,n))}return a.then(()=>{e.notify("AnimationComplete",t)})}const Hc=e=>t=>t.test(e),Yc=[fi,Mi,Si,Fi,Ti,ji,{test:e=>"auto"===e,parse:e=>e}],Gc=e=>Yc.find(Hc(e));function Kc(e){return"number"==typeof e?0===e:null===e||"none"===e||"0"===e||Bo(e)}const Xc=new Set(["brightness","contrast","saturate","opacity"]);function Jc(e){const[t,n]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[a]=n.match(wi)||[];if(!a)return e;const s=n.replace(a,"");let r=Xc.has(t)?1:0;return a!==n&&(r*=100),t+"("+r+s+")"}const Zc=/\b([a-z-]*)\(.*?\)/gu,Qc={...Ui,getAnimatableNone:e=>{const t=e.match(Zc);return t?t.map(Jc).join(" "):e}},eu={...fi,transform:Math.round},tu={borderWidth:Mi,borderTopWidth:Mi,borderRightWidth:Mi,borderBottomWidth:Mi,borderLeftWidth:Mi,borderRadius:Mi,borderTopLeftRadius:Mi,borderTopRightRadius:Mi,borderBottomRightRadius:Mi,borderBottomLeftRadius:Mi,width:Mi,maxWidth:Mi,height:Mi,maxHeight:Mi,top:Mi,right:Mi,bottom:Mi,left:Mi,inset:Mi,insetBlock:Mi,insetBlockStart:Mi,insetBlockEnd:Mi,insetInline:Mi,insetInlineStart:Mi,insetInlineEnd:Mi,padding:Mi,paddingTop:Mi,paddingRight:Mi,paddingBottom:Mi,paddingLeft:Mi,paddingBlock:Mi,paddingBlockStart:Mi,paddingBlockEnd:Mi,paddingInline:Mi,paddingInlineStart:Mi,paddingInlineEnd:Mi,margin:Mi,marginTop:Mi,marginRight:Mi,marginBottom:Mi,marginLeft:Mi,marginBlock:Mi,marginBlockStart:Mi,marginBlockEnd:Mi,marginInline:Mi,marginInlineStart:Mi,marginInlineEnd:Mi,fontSize:Mi,backgroundPositionX:Mi,backgroundPositionY:Mi,rotate:Fi,rotateX:Fi,rotateY:Fi,rotateZ:Fi,scale:bi,scaleX:bi,scaleY:bi,scaleZ:bi,skew:Fi,skewX:Fi,skewY:Fi,distance:Mi,translateX:Mi,translateY:Mi,translateZ:Mi,x:Mi,y:Mi,z:Mi,perspective:Mi,transformPerspective:Mi,opacity:yi,originX:Pi,originY:Pi,originZ:Mi,zIndex:eu,fillOpacity:yi,strokeOpacity:yi,numOctaves:eu},nu={...tu,color:Li,backgroundColor:Li,outlineColor:Li,fill:Li,stroke:Li,borderColor:Li,borderTopColor:Li,borderRightColor:Li,borderBottomColor:Li,borderLeftColor:Li,filter:Qc,WebkitFilter:Qc},au=e=>nu[e];function su(e,t){let n=au(e);return n!==Qc&&(n=Ui),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const ru=new Set(["auto","none","0"]);class ou extends ec{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 iu(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 lu=(e,t)=>t&&"number"==typeof e?t.transform(e):e;function cu(e){return Eo(e)&&"offsetHeight"in e}const{schedule:uu}=ni(queueMicrotask,!1),du={x:!1,y:!1};function hu(){return du.x||du.y}function mu(e,t){const n=iu(e),a=new AbortController;return[n,{passive:!0,...t,signal:a.signal},()=>a.abort()]}function pu(e){return!("touch"===e.pointerType||hu())}const gu=(e,t)=>!!t&&(e===t||gu(e,t.parentElement)),fu=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary,yu=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function bu(e){return yu.has(e.tagName)||!0===e.isContentEditable}const vu=new WeakSet;function wu(e){return t=>{"Enter"===t.key&&e(t)}}function Cu(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function xu(e){return fu(e)&&!hu()}function ku(e){return Eo(e)&&"ownerSVGElement"in e}function Au(e){return ku(e)&&"svg"===e.tagName}const Du=[...Yc,Li,Ui],Eu=()=>({x:{min:0,max:0},y:{min:0,max:0}}),Bu={current:null},Fu={current:!1},Su="undefined"!=typeof window,Mu=new WeakMap;function ju(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function Tu(e){return"string"==typeof e||Array.isArray(e)}const Pu=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ru=["initial",...Pu];function Lu(e){return ju(e.animate)||Ru.some(t=>Tu(e[t]))}function Nu(e){return Boolean(Lu(e)||e.variants)}const zu=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let _u={};function Iu(e){_u=e}class Vu{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=ec,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=ci.now();this.renderScheduledAtthis.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(Fu.current||function(){if(Fu.current=!0,Su)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Bu.current=e.matches;e.addEventListener("change",t),t()}else Bu.current=!1}(),this.shouldReduceMotion=Bu.current),null==(t=this.parent)||t.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var e;this.projection&&this.projection.unmount(),si(this.notifyUpdate),si(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=ql.has(e);n&&this.onBindTransform&&this.onBindTransform();const a=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&ai.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 _u){const t=_u[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=Tc(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&&(Do(n)||Bo(n))?n=parseFloat(n):(a=n,!Du.find(Hc(a))&&Ui.test(t)&&(n=su(e,t))),this.setBaseTarget(e,zc(n)?n.get():n)),zc(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=Fc(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||zc(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 Po),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){uu.render(this.render)}}class Ou extends Vu{constructor(){super(...arguments),this.KeyframeResolver=ou}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;zc(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}class $u{constructor(e){this.isMounted=!1,this.node=e}update(){}}function qu({top:e,left:t,right:n,bottom:a}){return{x:{min:t,max:n},y:{min:e,max:a}}}function Uu(e){return void 0===e||1===e}function Wu({scale:e,scaleX:t,scaleY:n}){return!Uu(e)||!Uu(t)||!Uu(n)}function Hu(e){return Wu(e)||Yu(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Yu(e){return Gu(e.x)||Gu(e.y)}function Gu(e){return e&&"0%"!==e}function Ku(e,t,n){return n+t*(e-n)}function Xu(e,t,n,a,s){return void 0!==s&&(e=Ku(e,s,a)),Ku(e,n,a)+t}function Ju(e,t=0,n=1,a,s){e.min=Xu(e.min,t,n,a,s),e.max=Xu(e.max,t,n,a,s)}function Zu(e,{x:t,y:n}){Ju(e.x,t.translate,t.scale,t.originPoint),Ju(e.y,n.translate,n.scale,n.originPoint)}const Qu=.999999999999,ed=1.0000000000001;function td(e,t){e.min=e.min+t,e.max=e.max+t}function nd(e,t,n,a,s=.5){Ju(e,t,n,Yi(e.min,e.max,s),a)}function ad(e,t){nd(e.x,t.x,t.scaleX,t.scale,t.originX),nd(e.y,t.y,t.scaleY,t.scale,t.originY)}function sd(e,t){return qu(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 rd={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},od=$l.length;function id(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(ql.has(l))o=!0;else if(di(l))s[l]=e;else{const t=lu(e,tu[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(!Mi.test(e))return e;e=parseFloat(e)}return`${cd(e,t.target.x)}% ${cd(e,t.target.y)}%`}},dd={correct:(e,{treeScale:t,projectionDelta:n})=>{const a=e,s=Ui.parse(e);if(s.length>5)return a;const r=Ui.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=Yi(i,l,.5);return"number"==typeof s[2+o]&&(s[2+o]/=c),"number"==typeof s[3+o]&&(s[3+o]/=c),r(s)}},hd={borderRadius:{...ud,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ud,borderTopRightRadius:ud,borderBottomLeftRadius:ud,borderBottomRightRadius:ud,boxShadow:dd};function md(e){for(const t in e)hd[t]=e[t],di(t)&&(hd[t].isCSSVariable=!0)}function pd(e,{layout:t,layoutId:n}){return ql.has(e)||e.startsWith("origin")||(t||void 0!==n)&&(!!hd[e]||"opacity"===e)}function gd(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)(zc(s[i])||r&&zc(r[i])||pd(i,e)||void 0!==(null==(a=null==n?void 0:n.getValue(i))?void 0:a.liveStyle))&&(o[i]=s[i]);return o}class fd extends Ou{constructor(){super(...arguments),this.type="html",this.renderInstance=ld}readValueFromInstance(e,t){var n,a;if(ql.has(t))return(null==(n=this.projection)?void 0:n.isProjecting)?Il(t):((e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Vl(n,t)})(e,t);{const n=(a=e,window.getComputedStyle(a)),s=(di(t)?n.getPropertyValue(t):n[t])||0;return"string"==typeof s?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:t}){return sd(e,t)}build(e,t,n){id(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return gd(e,t,n)}}const yd={offset:"stroke-dashoffset",array:"stroke-dasharray"},bd={offset:"strokeDashoffset",array:"strokeDasharray"},vd=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function wd(e,{attrX:t,attrY:n,attrScale:a,pathLength:s,pathSpacing:r=1,pathOffset:o=0,...i},l,c,u){if(id(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 vd)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?yd:bd;e[r.offset]=""+-a,e[r.array]=`${t} ${n}`}(d,s,r,o,!1)}const Cd=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"]),xd=e=>"string"==typeof e&&"svg"===e.toLowerCase();function kd(e,t,n){const a=gd(e,t,n);for(const s in e)(zc(e[s])||zc(t[s]))&&(a[-1!==$l.indexOf(s)?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s]=e[s]);return a}class Ad extends Ou{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Eu}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(ql.has(t)){const e=au(t);return e&&e.default||0}return t=Cd.has(t)?t:Ic(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return kd(e,t,n)}build(e,t,n){wd(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,a){!function(e,t,n,a){ld(e,t,void 0,a);for(const s in t.attrs)e.setAttribute(Cd.has(s)?s:Ic(s),t.attrs[s])}(e,t,0,a)}mount(e){this.isSVGTag=xd(e.tagName),super.mount(e)}}const Dd=Ru.length;function Ed(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent&&Ed(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})=>Wc(e,t,n)))}(e),n=Pd(),a=!0;const s=t=>(n,a)=>{var s;const r=Sc(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=Ed(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 x=C.reduce(s(h),{});!1===f&&(x={});const{prevResolvedValues:k={}}=m,A={...k,...x},D=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 A){const t=x[e],n=k[e];if(u.hasOwnProperty(e))continue;let a=!1;a=Pc(t)&&Pc(n)?!Bd(t,n):t!==n,a?null!=t?D(e):c.add(e):void 0!==t&&c.has(e)?D(e):m.protectedKeys[e]=!0}m.prevProp=p,m.prevResolvedValues=x,m.isActive&&(u={...u,...x}),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=Sc(a,t);if(a.enteringChildren&&s){const{delayChildren:t}=s.transition||{};n.delay=bc(a.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(c.size){const t={};if("boolean"!=typeof o.initial){const n=Sc(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=Pd()}}}function jd(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!Bd(t,e)}function Td(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Pd(){return{animate:Td(!0),whileInView:Td(),whileHover:Td(),whileTap:Td(),whileDrag:Td(),whileFocus:Td(),exit:Td()}}function Rd(e,t){e.min=t.min,e.max=t.max}function Ld(e,t){Rd(e.x,t.x),Rd(e.y,t.y)}function Nd(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function zd(e){return e.max-e.min}function _d(e,t,n,a=.5){e.origin=a,e.originPoint=Yi(t.min,t.max,e.origin),e.scale=zd(n)/zd(t),e.translate=Yi(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 Id(e,t,n,a){_d(e.x,t.x,n.x,a?a.originX:void 0),_d(e.y,t.y,n.y,a?a.originY:void 0)}function Vd(e,t,n){e.min=n.min+t.min,e.max=e.min+zd(t)}function Od(e,t,n){e.min=t.min-n.min,e.max=e.min+zd(t)}function $d(e,t,n){Od(e.x,t.x,n.x),Od(e.y,t.y,n.y)}function qd(e,t,n,a,s){return e=Ku(e-=t,1/n,a),void 0!==s&&(e=Ku(e,1/s,a)),e}function Ud(e,t,[n,a,s],r,o){!function(e,t=0,n=1,a=.5,s,r=e,o=e){if(Si.test(t)&&(t=parseFloat(t),t=Yi(o.min,o.max,t/100)-o.min),"number"!=typeof t)return;let i=Yi(r.min,r.max,a);e===r&&(i-=t),e.min=qd(e.min,t,n,i,s),e.max=qd(e.max,t,n,i,s)}(e,t[n],t[a],t[s],t.scale,r,o)}const Wd=["x","scaleX","originX"],Hd=["y","scaleY","originY"];function Yd(e,t,n,a){Ud(e.x,t,Wd,n?n.x:void 0,a?a.x:void 0),Ud(e.y,t,Hd,n?n.y:void 0,a?a.y:void 0)}function Gd(e){return 0===e.translate&&1===e.scale}function Kd(e){return Gd(e.x)&&Gd(e.y)}function Xd(e,t){return e.min===t.min&&e.max===t.max}function Jd(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Zd(e,t){return Jd(e.x,t.x)&&Jd(e.y,t.y)}function Qd(e){return zd(e.x)/zd(e.y)}function eh(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function th(e){return[e("x"),e("y")]}const nh=["TopLeft","TopRight","BottomLeft","BottomRight"],ah=nh.length,sh=e=>"string"==typeof e?parseFloat(e):e,rh=e=>"number"==typeof e||Mi.test(e);function oh(e,t){return void 0!==e[t]?e[t]:e.borderRadius}const ih=ch(0,.5,Ho),lh=ch(.5,.95,So);function ch(e,t,n){return a=>at?1:n(To(e,t,a))}function uh(e,t,n){const a=zc(e)?e:Tc(e);return a.start(Ec("",a,t,n)),a.animation}function dh(e,t,n,a={passive:!0}){return e.addEventListener(t,n,a),()=>e.removeEventListener(t,n)}const hh=(e,t)=>e.depth-t.depth;class mh{constructor(){this.children=[],this.isDirty=!1}add(e){Co(this.children,e),this.isDirty=!0}remove(e){xo(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(hh),this.isDirty=!1,this.children.forEach(e)}}function ph(e,t){const n=ci.now(),a=({timestamp:s})=>{const r=s-n;r>=t&&(si(a),e(r-t))};return ai.setup(a,!0),()=>si(a)}function gh(e){return zc(e)?e.get():e}class fh{constructor(){this.members=[]}add(e){Co(this.members,e),e.scheduleRender()}remove(e){if(xo(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 yh={hasAnimatedSinceResize:!0,hasEverUpdated:!1},bh=["","X","Y","Z"];let vh=0;function wh(e,t,n,a){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),a&&(a[e]=0))}function Ch(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=Oc(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:t,layoutId:a}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",ai,!(t||a))}const{parent:a}=e;a&&!a.hasCheckedOptimisedAppear&&Ch(a)}function xh({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:a,resetTransform:s}){return class{constructor(e={},n=(null==t?void 0:t())){this.id=vh++,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(Dh),this.nodes.forEach(Th),this.nodes.forEach(Ph),this.nodes.forEach(Eh)},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;ai.read(()=>{a=window.innerWidth}),e(t,()=>{const e=window.innerWidth;e!==a&&(a=e,this.root.updateBlockedByResize=!0,n&&n(),n=ph(s,250),yh.hasAnimatedSinceResize&&(yh.hasAnimatedSinceResize=!1,this.nodes.forEach(jh)))})}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()||Ih,{onLayoutAnimationStart:o,onLayoutAnimationComplete:i}=s.getProps(),l=!this.targetLayout||!Zd(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={...Dc(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||jh(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(),si(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(Rh),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&&Ch(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||zd(this.snapshot.measuredBox.x)||zd(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;nQu&&(t.x=1),t.yQu&&(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?(Nd(this.prevProjectionDelta.x,this.projectionDelta.x),Nd(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),Id(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===o&&this.treeScale.y===i&&eh(this.projectionDelta.x,this.prevProjectionDelta.x)&&eh(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(_h));let d;this.animationProgress=0,this.mixTargetDelta=t=>{const n=t/1e3;var l,h,m,p,g,f;Nh(r.x,e.x,n),Nh(r.y,e.y,n),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&($d(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,p=this.relativeTargetOrigin,g=o,f=n,zh(m.x,p.x,g.x,f),zh(m.y,p.y,g.y,f),d&&(l=this.relativeTarget,h=d,Xd(l.x,h.x)&&Xd(l.y,h.y))&&(this.isProjectionDirty=!1),d||(d={x:{min:0,max:0},y:{min:0,max:0}}),Ld(d,this.relativeTarget)),i&&(this.animationValues=s,function(e,t,n,a,s,r){s?(e.opacity=Yi(0,n.opacity??1,ih(a)),e.opacityExit=Yi(t.opacity??1,0,lh(a))):r&&(e.opacity=Yi(t.opacity??1,n.opacity??1,a));for(let o=0;o{yh.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Tc(0)),this.currentAnimation=uh(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&&qh(this.options.animationType,this.layout.layoutBox,a.layoutBox)){n=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const t=zd(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;const a=zd(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+a}Ld(t,n),ad(t,s),Id(this.projectionDeltaWithTransform,this.layoutCorrected,t,s)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new fh),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&&wh("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(Fh),this.root.sharedNodes.clear()}}}function kh(e){e.updateLayout()}function Ah(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?th(e=>{const a=r?n.measuredBox[e]:n.layoutBox[e],s=zd(a);a.min=t[e].min,a.max=a.min+s}):qh(s,n.layoutBox,t)&&th(a=>{const s=r?n.measuredBox[a]:n.layoutBox[a],o=zd(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}};Id(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?Id(i,e.applyTransform(a,!0),n.measuredBox):Id(i,t,n.layoutBox);const l=!Kd(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}};$d(o,n.layoutBox,s.layoutBox);const i={x:{min:0,max:0},y:{min:0,max:0}};$d(i,t,r.layoutBox),Zd(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 Dh(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 Eh(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Bh(e){e.clearSnapshot()}function Fh(e){e.clearMeasurements()}function Sh(e){e.isLayoutDirty=!1}function Mh(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function jh(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Th(e){e.resolveTargetDelta()}function Ph(e){e.calcProjection()}function Rh(e){e.resetSkewAndRotation()}function Lh(e){e.removeLeadSnapshot()}function Nh(e,t,n){e.translate=Yi(t.translate,0,n),e.scale=Yi(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function zh(e,t,n,a){e.min=Yi(t.min,n.min,a),e.max=Yi(t.max,n.max,a)}function _h(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}const Ih={duration:.45,ease:[.4,0,.1,1]},Vh=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),Oh=Vh("applewebkit/")&&!Vh("chrome/")?Math.round:So;function $h(e){e.min=Oh(e.min),e.max=Oh(e.max)}function qh(e,t,n){return"position"===e||"preserve-aspect"===e&&(a=Qd(t),s=Qd(n),!(Math.abs(a-s)<=.2));var a,s}function Uh(e){var t;return e!==e.root&&(null==(t=e.scroll)?void 0:t.wasRoot)}const Wh=xh({attachResizeListener:(e,t)=>dh(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}),Hh=e=>!e.isLayoutDirty&&e.willUpdate(!1);function Yh(){const e=new Set,t=new WeakMap,n=()=>e.forEach(Hh);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 Gh={current:void 0},Kh=xh({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Gh.current){const e=new Wh({});e.mount(window),e.setOptions({layoutScroll:!0}),Gh.current=e}return Gh.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),Xh=s.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function Jh(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}class Zh extends s.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){const e=t.offsetParent,n=cu(e)&&e.offsetWidth||0,a=cu(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 Qh({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(Xh),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=Jh(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(Zh,{isPresent:t,childRef:c,sizeRef:u,children:s.cloneElement(e,{ref:m})})}const em=({children:e,initial:t,isPresent:n,onExitComplete:a,custom:o,presenceAffectsLayout:i,mode:l,anchorX:c,anchorY:u,root:d})=>{const h=yo(tm),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(Qh,{isPresent:n,anchorX:c,anchorY:u,root:d,children:e})),r.jsx(wo.Provider,{value:g,children:e})};function tm(){return new Map}function nm(e=!0){const t=s.useContext(wo);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 am(){return null===(e=s.useContext(wo))||e.isPresent;var e}const sm=e=>e.key||"";function rm(e){const t=[];return s.Children.forEach(e,e=>{s.isValidElement(e)&&t.push(e)}),t}const om=({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]=nm(l),p=s.useMemo(()=>rm(e),[e]),g=l&&!h?[]:p.map(sm),f=s.useRef(!0),y=s.useRef(p),b=yo(()=>new Map),v=s.useRef(new Set),[w,C]=s.useState(p),[x,k]=s.useState(p);vo(()=>{f.current=!1,y.current=p;for(let e=0;e{const s=sm(e),w=!(l&&!h)&&(p===x||g.includes(s));return r.jsx(em,{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==D||D(),k(y.current),l&&(null==m||m()),a&&a())},anchorX:c,anchorY:u,children:e},s)})})},im=s.createContext(null);const lm=e=>!0===e,cm=({children:e,id:t,inherit:n=!0})=>{const a=s.useContext(fo),o=s.useContext(im),[i,l]=function(){const e=function(){const e=s.useRef(!1);return vo(()=>(e.current=!0,()=>{e.current=!1}),[]),e}(),[t,n]=s.useState(0),a=s.useCallback(()=>{e.current&&n(t+1)},[t]);return[s.useCallback(()=>ai.postRender(a),[a]),t]}(),c=s.useRef(null),u=a.id||o;null===c.current&&((e=>lm(!0===e)||"id"===e)(n)&&u&&(t=t?u+"-"+t:u),c.current={id:t,group:lm(n)&&a.group||Yh()});const d=s.useMemo(()=>({...c.current,forceRender:i}),[l]);return r.jsx(fo.Provider,{value:d,children:e})},um=s.createContext({strict:!1}),dm={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 hm=!1;function mm(){return function(){if(hm)return;const e={};for(const t in dm)e[t]={isEnabled:e=>dm[t].some(t=>!!e[t])};Iu(e),hm=!0}(),_u}const pm=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 gm(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||pm.has(e)}let fm=e=>!gm(e);function ym(e){"function"==typeof e&&(fm=t=>t.startsWith("on")?!gm(t):e(t))}try{ym(require("@emotion/is-prop-valid").default)}catch{}const bm=s.createContext({});function vm(e){return Array.isArray(e)?e.join(" "):e}function wm(e,t,n){for(const a in t)zc(t[a])||pd(a,n)||(e[a]=t[a])}function Cm(e,t){const n={},a=function(e,t){const n={};return wm(n,e.style||{},e),Object.assign(n,function({transformTemplate:e},t){return s.useMemo(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{}};return id(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 xm(e,t,n,a){const r=s.useMemo(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return wd(n,t,xd(a),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){const t={};wm(t,e.style,e),r.style={...t,...r.style}}return r}const km=["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 Am(e){return"string"==typeof e&&!e.includes("-")&&!!(km.indexOf(e)>-1||/[A-Z]/u.test(e))}function Dm(e,t,n,{latestValues:a},r,o=!1,i){const l=(i??Am(e)?xm:Cm)(t,a,r,e),c=function(e,t,n){const a={};for(const s in e)"values"===s&&"object"==typeof e.values||(fm(s)||!0===n&&gm(s)||!t&&!gm(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(()=>zc(d)?d.get():d,[d]);return s.createElement(e,{...u,children:h})}function Em(e,t,n,a){const s={},r=a(e,{});for(const h in r)s[h]=gh(r[h]);let{initial:o,animate:i}=e;const l=Lu(e),c=Nu(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&&!ju(d)){const t=Array.isArray(d)?d:[d];for(let n=0;n(t,n)=>{const a=s.useContext(bm),r=s.useContext(wo),o=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t},n,a,s){return{latestValues:Em(n,a,s,e),renderState:t()}}(e,t,a,r);return n?o():yo(o)},Fm=Bm({scrapeMotionValuesFromProps:gd,createRenderState:()=>({style:{},transform:{},transformOrigin:{},vars:{}})}),Sm=Bm({scrapeMotionValuesFromProps:kd,createRenderState:()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}})}),Mm=Symbol.for("motionComponentSymbol");function jm(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 Tm=s.createContext({});function Pm(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function Rm(e,t,n,a,r,o){var i,l;const{visualElement:c}=s.useContext(bm),u=s.useContext(um),d=s.useContext(wo),h=s.useContext(Xh).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(Tm);!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:Lm(e.parent)),e.projection.setOptions({layoutId:s,layout:r,alwaysMeasureLayout:Boolean(o)||i&&Pm(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[Vc],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 vo(()=>{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 Lm(e){if(e)return!1!==e.options.allowProjection?e.projection:Lm(e.parent)}function Nm(e,{forwardMotionProps:t=!1,type:n}={},a,o){a&&function(e){const t=mm();for(const n in e)t[n]={...t[n],...e[n]};Iu(t)}(a);const i=n?"svg"===n:Am(e),l=i?Sm:Fm;function c(n,a){let c;const u={...s.useContext(Xh),...n,layoutId:zm(n)},{isStatic:d}=u,h=function(e){const{initial:t,animate:n}=function(e,t){if(Lu(e)){const{initial:t,animate:n}=e;return{initial:!1===t||Tu(t)?t:void 0,animate:Tu(n)?n:void 0}}return!1!==e.inherit?t:{}}(e,s.useContext(bm));return s.useMemo(()=>({initial:t,animate:n}),[vm(t),vm(n)])}(n),m=l(n,d);if(!d&&bo){s.useContext(um).strict;const t=function(e){const t=mm(),{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=Rm(e,m,u,o,t.ProjectionNode,i)}return r.jsxs(bm.Provider,{value:h,children:[c&&h.visualElement?r.jsx(c,{visualElement:h.visualElement,...u}):null,Dm(e,n,jm(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[Mm]=e,u}function zm({layoutId:e}){const t=s.useContext(fo).id;return t&&void 0!==e?t+"-"+e:e}function _m(e,t){if("undefined"==typeof Proxy)return Nm;const n=new Map,a=(n,a)=>Nm(n,a,e,t);return new Proxy((e,t)=>a(e,t),{get:(s,r)=>"create"===r?a:(n.has(r)||n.set(r,Nm(r,void 0,e,t)),n.get(r))})}const Im=(e,t)=>t.isSVG??Am(e)?new Ad(t):new fd(t,{allowProjection:e!==s.Fragment});let Vm=0;const Om={animation:{Feature:class extends $u{constructor(e){super(e),e.animationState||(e.animationState=Md(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();ju(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 $u{constructor(){super(...arguments),this.id=Vm++}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 $m(e){return{point:{x:e.pageX,y:e.pageY}}}function qm(e,t,n,a){return dh(e,t,(e=>t=>fu(t)&&e(t,$m(t)))(n),a)}const Um=({current:e})=>e?e.ownerDocument.defaultView:null,Wm=(e,t)=>Math.abs(e-t),Hm=new Set(["auto","scroll"]);class Ym{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=Xm(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,n=function(e,t){const n=Wm(e.x,t.x),a=Wm(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}=ri;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=Gm(t,this.transformPagePoint),ai.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=Xm("pointercancel"===e.type?this.lastMoveEventInfo:Gm(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,r),a&&a(e,r)},!fu(e))return;this.dragSnapToOrigin=s,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=r,this.contextWindow=a||window;const i=Gm($m(e),this.transformPagePoint),{point:l}=i,{timestamp:c}=ri;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,Xm(i,this.history)),this.removeListeners=jo(qm(this.contextWindow,"pointermove",this.handlePointerMove),qm(this.contextWindow,"pointerup",this.handlePointerUp),qm(this.contextWindow,"pointercancel",this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){const e=getComputedStyle(t);(Hm.has(e.overflowX)||Hm.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),ai.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),si(this.updatePoint)}}function Gm(e,t){return t?{point:t(e.point)}:e}function Km(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Xm({point:e},t){return{point:e,delta:Km(e,Zm(t)),offset:Km(e,Jm(t)),velocity:Qm(t,.1)}}function Jm(e){return e[0]}function Zm(e){return e[e.length-1]}function Qm(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,a=null;const s=Zm(e);for(;n>=0&&(a=e[n],!(s.timestamp-a.timestamp>Ro(t)));)n--;if(!a)return{x:0,y:0};const r=Lo(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 ep(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 tp(e,t){let n=t.min-e.min,a=t.max-e.max;return t.max-t.min{t?(this.stopAnimation(),this.snapToCursor($m(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?du[r]?null:(du[r]=!0,()=>{du[r]=!1}):du.x||du.y?null:(du.x=du.y=!0,()=>{du.x=du.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),th(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Si.test(t)){const{projection:n}=this.visualElement;if(n&&n.layout){const a=n.layout.layoutBox[e];a&&(t=zd(a)*(parseFloat(t)/100))}}this.originPoint[e]=t}),s&&ai.postRender(()=>s(e,t)),_c(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:()=>th(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:Um(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&&ai.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||!ip(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?Yi(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&&Pm(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!a)&&function(e,{top:t,left:n,bottom:a,right:s}){return{x:ep(e.x,n,s),y:ep(e.y,t,a)}}(a.layoutBox,t),this.elastic=function(e=np){return!1===e?e=0:!0===e&&(e=np),{x:ap(e,"left","right"),y:ap(e,"top","bottom")}}(n),s!==this.constraints&&a&&this.constraints&&!this.hasMutatedConstraints&&th(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||!Pm(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=sd(e,n),{scroll:s}=t;return s&&(td(a.x,s.offset.x),td(a.y,s.offset.y)),a}(n,a.root,this.visualElement.getTransformPagePoint());let r=function(e,t){return{x:tp(e.x,t.x),y:tp(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=qu(e))}return r}startAnimation(e){const{drag:t,dragMomentum:n,dragElastic:a,dragTransition:s,dragSnapToOrigin:r,onDragTransitionEnd:o}=this.getProps(),i=this.constraints||{},l=th(o=>{if(!ip(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 _c(this.visualElement,e),n.start(Ec(e,n,0,t,this.visualElement,!1))}stopAnimation(){th(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){th(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){th(t=>{const{drag:n}=this.getProps();if(!ip(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]-Yi(n,r,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!Pm(t)||!n||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};th(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=zd(e),s=zd(t);return s>a?n=To(t.min,t.max-a,e.min):a>s&&(n=To(e.min,e.max-s,t.min)),ko(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(),th(t=>{if(!ip(t,e,null))return;const n=this.getAxisMotionValue(t),{min:s,max:r}=this.constraints[t];n.set(Yi(s,r,a[t]))})}addListeners(){if(!this.visualElement.current)return;rp.set(this.visualElement,this);const e=this.visualElement.current,t=qm(e,"pointerdown",t=>{const{drag:n,dragListener:a=!0}=this.getProps(),s=t.target,r=s!==e&&bu(s);n&&a&&!r&&this.start(t)}),n=()=>{const{dragConstraints:e}=this.getProps();Pm(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()),ai.read(n);const r=dh(window,"resize",()=>this.scalePositionWithinConstraints()),o=a.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(th(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=np,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:a,dragConstraints:s,dragElastic:r,dragMomentum:o}}}function ip(e,t,n){return!(!0!==t&&t!==e||null!==n&&n!==e)}const lp=e=>(t,n)=>{e&&ai.postRender(()=>e(t,n))};let cp=!1;class up 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),cp&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),yh.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}),cp=!0,a||e.layoutDependency!==t||void 0===t||e.isPresent!==s?r.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?r.promote():r.relegate()||ai.postRender(()=>{const e=r.getStack();e&&e.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),uu.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:a}=e;cp=!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 dp(e){const[t,n]=nm(),a=s.useContext(fo);return r.jsx(up,{...e,layoutGroup:a,switchLayoutGroup:s.useContext(Tm),isPresent:t,safeToRemove:n})}const hp={pan:{Feature:class extends $u{constructor(){super(...arguments),this.removePointerDownListener=So}onPointerDown(e){this.session=new Ym(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Um(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:a}=this.node.getProps();return{onSessionStart:lp(e),onStart:lp(t),onMove:n,onEnd:(e,t)=>{delete this.session,a&&ai.postRender(()=>a(e,t))}}}mount(){this.removePointerDownListener=qm(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 $u{constructor(e){super(e),this.removeGroupControls=So,this.removeListeners=So,this.controls=new op(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||So}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:Kh,MeasureLayout:dp}};function mp(e,t,n){const{props:a}=e;e.animationState&&a.whileHover&&e.animationState.setActive("whileHover","Start"===n);const s=a["onHover"+n];s&&ai.postRender(()=>s(t,$m(t)))}function pp(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&&ai.postRender(()=>s(t,$m(t)))}const gp=new WeakMap,fp=new WeakMap,yp=e=>{const t=gp.get(e.target);t&&t(e)},bp=e=>{e.forEach(yp)};const vp={some:0,all:1},wp=_m({...Om,inView:{Feature:class extends $u{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:vp[a]};return function(e,t,n){const a=function({root:e,...t}){const n=e||document;fp.has(n)||fp.set(n,{});const a=fp.get(n),s=JSON.stringify(t);return a[s]||(a[s]=new IntersectionObserver(bp,{root:e,...t})),a[s]}(t);return gp.set(e,n),a.observe(e),()=>{gp.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 $u{mount(){const{current:e}=this.node;e&&(this.unmount=function(e,t,n={}){const[a,s,r]=mu(e,n),o=e=>{const a=e.currentTarget;if(!xu(e))return;vu.add(a);const r=t(a,e),o=(e,t)=>{window.removeEventListener("pointerup",i),window.removeEventListener("pointercancel",l),vu.has(a)&&vu.delete(a),xu(e)&&"function"==typeof r&&r(e,{success:t})},i=e=>{o(e,a===window||a===document||n.useGlobalTarget||gu(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),cu(e)&&(e.addEventListener("focus",e=>((e,t)=>{const n=e.currentTarget;if(!n)return;const a=wu(()=>{if(vu.has(n))return;Cu(n,"down");const e=wu(()=>{Cu(n,"up")});n.addEventListener("keyup",e,t),n.addEventListener("blur",()=>Cu(n,"cancel"),t)});n.addEventListener("keydown",a,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",a),t)})(e,s)),bu(e)||e.hasAttribute("tabindex")||(e.tabIndex=0))}),r}(e,(e,t)=>(pp(this.node,t,"Start"),(e,{success:t})=>pp(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends $u{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=jo(dh(this.node.current,"focus",()=>this.onFocus()),dh(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends $u{mount(){const{current:e}=this.node;e&&(this.unmount=function(e,t,n={}){const[a,s,r]=mu(e,n),o=e=>{if(!pu(e))return;const{target:n}=e,a=t(n,e);if("function"!=typeof a||!n)return;const r=e=>{pu(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)=>(mp(this.node,t,"Start"),e=>mp(this.node,e,"End"))))}unmount(){}}},...hp,layout:{ProjectionNode:Kh,MeasureLayout:dp}},Im),Cp={duration:.15,ease:[.4,0,.2,1]},xp={type:"tween",duration:.25,ease:[.4,0,.2,1]},kp={type:"tween",duration:.3,ease:[.4,0,.2,1]},Ap=s.createContext(!1);function Dp(){return s.useContext(Ap)}const Ep=s.createContext(void 0);function Bp(){return s.useContext(Ep)}const Fp="#1A1A1A",Sp="#737373",Mp={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 jp({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?kp:xp,w=d?.98:.99,C=l?8:4;return r.jsx(om,{mode:"wait",children:e&&r.jsxs(c,{static:!0,open:e,onClose:t,className:"relative z-[10010]",children:[r.jsx(wp.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:Cp,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(wp.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-bg-surface/80 backdrop-blur-xl",!h&&m&&"bg-bg-surface",!h&&"ring-1 ring-inset ring-border-subtle",Mp[n],l?"radius-card overflow-hidden pb-safe":"radius-card overflow-hidden",a),style:h?{backgroundColor:p?"#F8F8F8":"var(--bg-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(Ep.Provider,{value:h,children:r.jsx(Ap.Provider,{value:g,children:o})})})})})})]})})}function Tp({className:e,...t}){const n=Bp(),a="light"===n;return r.jsx(d,{...t,className:i("text-base font-semibold sm:text-lg",!n&&"text-text-primary",e),style:n?{color:a?Fp:"var(--text-primary)"}:void 0})}function Pp({icon:e,title:t,onClose:n,className:a}){const s=Bp(),o="light"===s;return r.jsxs("div",{className:i("flex items-center justify-between px-6 py-4 border-b",!s&&"border-border-subtle",a),style:s?{borderColor:o?"rgba(0, 0, 0, 0.12)":"var(--border-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(Tp,{children:t})]}),n&&r.jsx("button",{onClick:n,className:i("p-2 radius-inner transition-colors",!s&&"text-text-muted hover:text-text-primary hover:bg-bg-subtle"),style:s?{color:o?Sp:"var(--text-muted)"}:void 0,onMouseEnter:e=>{s&&(e.currentTarget.style.color=o?Fp:"var(--text-primary)",e.currentTarget.style.backgroundColor=o?"rgba(0, 0, 0, 0.06)":"var(--bg-subtle)")},onMouseLeave:e=>{s&&(e.currentTarget.style.color=o?Sp:"var(--text-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 Rp({className:e,...t}){return r.jsx("div",{...t,className:i("px-6 py-5",e)})}function Lp({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)})}function Np({className:e,...t}){return r.jsx("nav",{...t,className:i(e,"flex h-full min-h-0 flex-col")})}function zp({className:e,...t}){return r.jsx("div",{...t,className:i(e,"flex flex-col border-b border-border-subtle p-4","[&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function _p({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 Ip({className:e,...t}){return r.jsx("div",{...t,className:i(e,"mt-auto flex flex-col border-t border-border-subtle","[&>[data-slot=section]+[data-slot=section]]:mt-2.5")})}function Vp({className:e,...t}){const n=s.useId();return r.jsx(cm,{id:n,children:r.jsx("div",{...t,"data-slot":"section",className:i(e,"flex flex-col gap-0.5")})})}const Op=s.forwardRef(function(e,t){const{current:n,className:a,children:s,...o}=e,c=i("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?"bg-accent-primary/15 text-accent-primary [&>svg]:text-accent-primary":"text-text-muted hover:text-text-primary hover:bg-subtle-fill [&>svg]:text-text-muted hover:[&>svg]:text-text-primary","transition-all duration-150");return r.jsxs("span",{className:i(a,"relative"),children:[n&&r.jsx(wp.span,{layoutId:"sidebar-current-indicator",className:"absolute inset-y-2 -left-3 w-0.5 rounded-full bg-accent-primary"}),"string"==typeof o.href?r.jsx(A,{to:o.href,onClick:o.onClick,onMouseEnter:o.onMouseEnter,onMouseLeave:o.onMouseLeave,className:c,"data-current":n?"true":void 0,ref:t,children:s}):r.jsx(l,{...o,className:i("cursor-default",c),"data-current":n?"true":void 0,ref:t,children:s})]})});function $p({className:e,...t}){return r.jsx("span",{...t,className:i(e,"truncate")})}function qp({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-bg-subtle text-text-muted",accent:"bg-accent-primary/20 text-accent-primary",success:"bg-accent-success/20 text-accent-success",warning:"bg-accent-secondary/20 text-accent-secondary",danger:"bg-accent-danger/20 text-accent-danger"}[t],e)})}const Up=s.createContext(null),Wp={type:"spring",visualDuration:.35,bounce:.15};function Hp({open:e,onClose:t,children:n}){return r.jsx(om,{children:e&&r.jsxs(c,{static:!0,open:e,onClose:t,className:"lg:hidden relative z-[10002]",children:[r.jsx(wp.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(wp.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:Wp,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-text-muted hover:text-text-primary hover:bg-subtle-fill transition-colors","aria-label":"Close navigation",children:r.jsx(go,{className:"w-5 h-5"})})}),n]})})})]})})}function Yp({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(Up.Provider,{value:d,children:r.jsxs("div",{className:"flex h-screen overflow-hidden bg-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(Hp,{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(no,{className:"w-5 h-5 text-text-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 Kp({className:e,...t}){return r.jsx("div",{...t,className:i(e,"flex items-center gap-3")})}function Xp({className:e,...t}){return r.jsx("div",{"aria-hidden":"true",...t,className:i(e,"flex-1")})}const Jp="bg-bg-surface/80 backdrop-blur-lg ring-1 ring-inset ring-border-subtle",Zp={sm:"radius-inner",md:"radius-inset",lg:"radius-card",xl:"radius-hero",full:"radius-pill",none:"radius-none"};function Qp({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,elevated:t,compact:n,noPadding:a,radius:s="lg",glass:o=!0,stroke:l=!0,shadow:c,reflex:u=!1,glow:d=!1,onClick:h,className:m,style:p,...g},f){const y=c??t??!1,b=u?{...p,"--surface-reflex":"1"}:p;return r.jsx("div",{ref:f,className:i(Zp[s],o&&(t?"bg-bg-surface/85 backdrop-blur-xl":"bg-bg-surface/80 backdrop-blur-lg"),!o&&"bg-bg-surface",l&&!d&&"ring-1 ring-inset ring-border-subtle",d&&"ring-1 ring-inset ring-accent-primary/40",y&&(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"),h&&"cursor-pointer",m),style:b,onClick:h,...g,children:e})}),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-border-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-text-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-text-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-border-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-border-subtle",n),...a,children:e})});const eg=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-text-muted","row-hover hover:text-text-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(Wr,{className:"w-4 h-4"})})]})})});function tg({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(om,{initial:!1,children:s&&r.jsx(wp.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 ng({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:"text-sm font-medium",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(om,{initial:!1,mode:"wait",children:n&&r.jsxs(wp.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-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:"text-sm font-medium text-text-primary",children:e})]}),r.jsx(m,{className:"p-1 rounded hover:bg-subtle-fill-strong transition-colors",children:r.jsx(wp.span,{initial:{rotate:0},animate:{rotate:180},exit:{rotate:0},transition:{type:"spring",stiffness:400,damping:25},children:r.jsx(Wr,{className:"w-4 h-4"})})})]}),r.jsx("div",{className:"px-3 pb-3",children:l})]})})}),r.jsx(wp.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-text-muted","row-hover hover:text-text-primary","ring-focus"),children:[u,r.jsx(wp.span,{animate:{rotate:n?180:0},transition:{type:"spring",stiffness:400,damping:25},children:r.jsx(Wr,{className:"w-4 h-4"})})]})})]})}):r.jsxs(Qp,{defaultOpen:n,className:s,children:[r.jsx(eg,{...c,children:u}),r.jsx(tg,{direction:"down",children:r.jsx("div",{className:"bg-subtle-fill radius-inset mx-1 mt-1",children:l})})]})}const ag={sm:{track:"h-5 w-9",thumb:"h-3.5 w-3.5",translate:"translate-x-4",icon:"w-3 h-3"},md:{track:"h-6 w-11",thumb:"h-4 w-4",translate:"translate-x-5",icon:"w-4 h-4"},lg:{track:"h-7 w-14",thumb:"h-5 w-5",translate:"translate-x-7",icon:"w-4 h-4"}},sg=s.forwardRef(function({enabled:e,onChange:t,label:n,description:a,size:s="md",disabled:o=!1,status:l="idle",name:c,className:u},d){const h=ag[s],m="loading"===l;return r.jsxs(f,{disabled:o||m,className:i("flex items-start gap-3",u),children:[r.jsx(y,{ref:d,checked:e,onChange:t,name:c,className:i("group relative inline-flex shrink-0 items-center rounded-full transition-colors border-2",h.track,e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","disabled:opacity-50 disabled:cursor-not-allowed","ring-focus","transition-all duration-200"),children:r.jsx("span",{className:i("inline-block transform rounded-full bg-white shadow-lg transition-transform duration-200",h.thumb,e?h.translate:"translate-x-0.5")})}),(n||a)&&r.jsxs("div",{className:"flex-1 min-w-0",children:[n&&r.jsx(b,{className:i("text-sm font-medium cursor-pointer select-none",o?"text-text-muted":"text-text-primary"),children:n}),a&&r.jsx(v,{className:"text-xs text-text-muted mt-0.5",children:a})]}),"idle"!==l&&r.jsxs("div",{className:"flex items-center shrink-0",children:["loading"===l&&r.jsx(Qr,{className:i(h.icon,"text-text-muted animate-spin")}),"success"===l&&r.jsx(Ur,{className:i(h.icon,"text-accent-success")}),"error"===l&&r.jsx(go,{className:i(h.icon,"text-accent-danger")})]})]})}),rg=s.forwardRef(function({enabled:e,onChange:t,size:n="md",disabled:a=!1,"aria-label":s,className:o},l){const c=ag[n];return r.jsx(y,{ref:l,checked:e,onChange:t,disabled:a,"aria-label":s,className:i("relative inline-flex shrink-0 items-center rounded-full transition-colors border-2",c.track,e?"bg-toggle-on border-toggle-on":"bg-toggle-off border-border-subtle","disabled:opacity-50 disabled:cursor-not-allowed","ring-focus","transition-all duration-200",o),children:r.jsx("span",{className:i("inline-block transform rounded-full bg-white shadow-lg transition-transform duration-200",c.thumb,e?c.translate:"translate-x-0.5")})})}),og={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"}},ig=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=og[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-bg-subtle text-text-muted text-sm",n?"border-accent-danger":"border-border-subtle"),children:o}),r.jsx("input",{ref:h,type:e,disabled:u,className:i("flex-1 min-w-0 font-mono",m.input,"bg-bg-subtle",n?"border border-accent-danger":"border-control","text-text-primary placeholder:text-text-muted",n?"ring-focus-error":"ring-focus-inset",!u&&"hover:border-border-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-bg-subtle text-text-muted text-sm",n?"border-accent-danger":"border-border-subtle"),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-text-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-bg-subtle",n?"border border-accent-danger":"border-control","text-text-primary placeholder:text-text-muted",n?"ring-focus-error":"ring-focus-inset",!u&&"hover:border-border-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-text-muted"),children:r.jsx("span",{className:m.icon,children:s})})]})}),lg=s.forwardRef(function({label:e,description:t,errorMessage:n,required:a,invalid:s,className:o,...l},c){const u=s&&n;return r.jsxs(f,{className:i("flex flex-col gap-1.5",o),children:[e&&r.jsxs(b,{className:"text-sm font-medium text-text-primary",children:[e,a&&r.jsx("span",{className:"text-accent-danger ml-0.5",children:"*"})]}),t&&!u&&r.jsx(v,{className:"text-xs text-text-muted -mt-0.5",children:t}),r.jsx(ig,{ref:c,invalid:s,...l}),u&&r.jsx("p",{className:"text-xs text-accent-danger",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(ig,{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 cg={none:"resize-none",vertical:"resize-y",horizontal:"resize-x",both:"resize"},ug=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",cg[t],"bg-bg-subtle",n?"border border-accent-danger":"border-control","text-text-primary placeholder:text-text-muted",n?"ring-focus-error":"ring-focus-inset",!a&&"hover:border-border-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(f,{className:i("flex flex-col gap-1.5",u),children:[e&&r.jsxs(b,{className:"text-sm font-medium text-text-primary",children:[e,a&&r.jsx("span",{className:"text-accent-danger ml-0.5",children:"*"})]}),t&&!m&&r.jsx(v,{className:"text-xs text-text-muted -mt-0.5",children:t}),r.jsx(ug,{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-accent-danger flex-1",children:n}):r.jsx("span",{}),o&&l&&r.jsxs("span",{className:i("text-xs",p>l?"text-accent-danger":"text-text-muted"),children:[p,"/",l]})]})]})});const dg={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"}},hg=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=dg[o];return r.jsxs(f,{disabled:l,className:i("flex items-start gap-3",d),children:[r.jsxs(w,{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-border-subtle bg-bg-subtle",(e||n)&&"border-accent-primary bg-accent-primary",!e&&!n&&!l&&"hover:border-border-strong","ring-focus","disabled:opacity-50 disabled:cursor-not-allowed"),children:[e&&!n&&r.jsx(Ur,{className:i(m.icon,"text-white stroke-[3]")}),n&&r.jsx(so,{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(b,{className:i("text-sm font-medium cursor-pointer",l?"text-text-muted":"text-text-primary"),children:a}),s&&r.jsx(v,{className:"text-xs text-text-muted mt-0.5",children:s})]})]})});s.createContext({variant:"default",divider:"subtle",grid:!0});const mg="0.9.233",pg="'JetBrains Mono', monospace",gg=s.memo(function({height:e=16,responsive:t=!1,className:n=""}){const a="var(--accent-primary)",s="var(--text-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: ${pg};\n }\n .logo-accent {\n fill: var(--accent-primary, #719CDF);\n }\n .logo-main {\n fill: var(--text-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:pg,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"})]})}),fg="pymc_jwt_token",yg="pymc_client_id",bg="pymc_remember_me",vg=new Set;function wg(e){for(const n of vg)try{n(e)}catch(t){}}function Cg(){let e=localStorage.getItem(yg);return e||(e=`${Date.now()}-${Math.random().toString(36).substring(2,15)}`,localStorage.setItem(yg,e)),e}function xg(){return"true"===localStorage.getItem(bg)}function kg(e){e?localStorage.setItem(bg,"true"):localStorage.removeItem(bg)}function Ag(){return xg()?localStorage:sessionStorage}function Dg(){return Ag().getItem(fg)||localStorage.getItem(fg)||sessionStorage.getItem(fg)}function Eg(e){Ag().setItem(fg,e),xg()?sessionStorage.removeItem(fg):localStorage.removeItem(fg),wg(e)}function Bg(){localStorage.removeItem(fg),sessionStorage.removeItem(fg),wg(null)}function Fg(){return!(!Dg()||Mg()&&(Bg(),1))}function Sg(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 Mg(){const e=Dg();if(!e)return!0;const t=Sg(e);return!t||!t.exp||Date.now()>=1e3*t.exp-6e4}function jg(){const e=Dg();if(!e)return 0;const t=Sg(e);return t&&t.exp?Math.max(0,Math.floor((1e3*t.exp-Date.now())/1e3)):0}function Tg(){const e=Dg();if(!e)return!1;const t=Sg(e);if(!t||!t.exp)return!1;const n=1e3*t.exp-Date.now();return n>0&&n<3e5}async function Pg(e,t,n=!1){kg(n);try{const n=await fetch("/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t,client_id:Cg()})}),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?(Eg(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=Dg();if(!e)return!1;const t=Sg(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:Cg()})});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){Eg(n.token);const e=Sg(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 Lg=null;async function Ng(){const e=Dg();if(!e)return!1;const t=Sg(e);return(null==t?void 0:t.exp)&&Math.floor((1e3*t.exp-Date.now())/1e3),!Tg()||Lg||(Lg=Rg().finally(()=>{Lg=null}),Lg)}let zg=!1;const _g="",Ig=new Map;let Vg=!1;async function Og(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=Ig.get(a);if(e)return e}const s=`${e}`;!n&&Tg()&&await Rg();const r=Dg();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&&!Vg&&await Rg())return Og(e,t,!0);throw Vg||(Vg=!0,Bg(),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&&(Ig.set(a,i),i.finally(()=>{Ig.delete(a)})),i}const $g={spreadingFactor:7,bandwidthHz:125e3,codingRate:5,preambleLength:8,crcEnabled:!0,explicitHeader:!0};function qg(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 Ug(e,t={}){return void 0!==e.airtime_ms&&e.airtime_ms>0?e.airtime_ms:function(e,t={}){const n=t.spreadingFactor??$g.spreadingFactor,a=t.bandwidthHz??$g.bandwidthHz,s=t.codingRate??$g.codingRate,r=t.preambleLength??$g.preambleLength??8,o=t.crcEnabled??$g.crcEnabled?1:0,i=t.explicitHeader??$g.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}(qg(e),t)}function Wg(e){return e&&"chat node"===e.toLowerCase()?"Companion":e}async function Hg(){return function(e){if(e.neighbors)for(const t of Object.values(e.neighbors))t.contact_type=Wg(t.contact_type);return e}(await Og("/api/stats"))}async function Yg(){return Og("/api/logs")}async function Gg(e=24){return Og(`/api/noise_floor_history?hours=${e}`)}const Kg=new Map;function Xg(e=!1){if(e)Kg.clear();else for(const[t]of Kg)parseInt(t.split("-")[0],10)<=60&&Kg.delete(t)}function Jg(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)??$g.spreadingFactor,bandwidthHz:(null==n?void 0:n.bandwidth)??$g.bandwidthHz,codingRate:(null==n?void 0:n.coding_rate)??$g.codingRate,preambleLength:(null==n?void 0:n.preamble_length)??$g.preambleLength,crcEnabled:!0,explicitHeader:!0}}(a):$g,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=Ug(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 Zg(e=24){return Og(`/api/crc_count?hours=${e}`)}let Qg=1;async function ef(){var e,t;const n=await Og("/api/hardware_stats");return n.success&&(null==(t=null==(e=n.data)?void 0:e.cpu)?void 0:t.count)&&(Qg=n.data.cpu.count),n}async function tf(){var e;const t=await Og("/api/hardware_processes");if(t.success&&(null==(e=t.data)?void 0:e.processes)&&Qg>1)for(const n of t.data.processes)n.cpu_percent=n.cpu_percent/Qg;return t}async function nf(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),Og("/api/update_radio_config",{method:"POST",body:JSON.stringify(t)})}async function af(){return Og("/api/send_advert",{method:"POST",body:"{}"})}async function sf(e){return Og("/api/set_mode",{method:"POST",body:JSON.stringify({mode:e})})}async function rf(e){return Og("/api/set_duty_cycle",{method:"POST",body:JSON.stringify({enabled:e})})}async function of(e){try{return await Og("/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 lf(){return Og("/api/identities")}async function cf(e){const t=(new URLSearchParams).toString();return Og("/api/room_stats"+(t?"?"+t:""))}async function uf(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=Dg();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 uf(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 df(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=>hf(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 uf(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 hf(e,t,n,a){let s=t,r=0,o=0;for(;s>e&&o<100;){o++;const t=await uf(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=Dg();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 mf="pymc-packet-cache",pf="pymc-packet-cache-meta",gf=36e5,ff=2592e5,yf=6048e5,bf=12096e5,vf=5e5,wf=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}),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}}getDataTier(){return this.meta.dataTier}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>gf}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 df(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"===e?2:"7d"===e?6: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 df(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>=ff,this.meta.threeDayLoadComplete&&(this.meta.dataTier="3d")):"7d"===e?(this.meta.sevenDayLoadComplete=t>=yf,this.meta.sevenDayLoadComplete&&(this.meta.dataTier="7d")):(this.meta.fourteenDayLoadComplete=t>=bf,this.meta.fourteenDayLoadComplete&&(this.meta.dataTier="14d")),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;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-bf)/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 df(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},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<=vf)return;const e=this.getPackets(),t=e.length-vf;for(let n=0;nt&&(this.meta.oldestTimestamp=e[t].timestamp??0)}loadFromStorage(){if("undefined"!=typeof window)try{const e=localStorage.getItem(pf);e&&(this.meta=JSON.parse(e));const t=localStorage.getItem(mf);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>gf)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(pf,JSON.stringify(this.meta));const e=this.getPackets(),t=e.length>3e3?e.slice(-3e3):e;localStorage.setItem(mf,JSON.stringify(t))}catch(e){if(e instanceof DOMException&&"QuotaExceededError"===e.name)try{localStorage.removeItem(mf),localStorage.setItem(pf,JSON.stringify(this.meta))}catch{}}}clearStorage(){if("undefined"!=typeof window)try{localStorage.removeItem(mf),localStorage.removeItem(pf)}catch(e){}}async fetchRecentPackets(e=1e3,t=!1){const n=`/api/recent_packets?limit=${e}`,a=Dg(),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(wf,"SAVE_DEBOUNCE_MS",1e4);const Cf=new wf;function xf(e){return{paths:e.paths,byEndpoints:new Map(e.byEndpointsEntries),canonicalPaths:new Map(e.canonicalPathsEntries),totalObservations:e.totalObservations,uniquePathCount:e.uniquePathCount}}function kf(){return{paths:[],byEndpoints:new Map,canonicalPaths:new Map,totalObservations:0,uniquePathCount:0}}const Af=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:kf(),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-DXqcQ1Nq.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?xf(t.pathRegistry):kf(),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()}},Df=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()}},Ef=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=Dg(),t=Cg(),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())},vg.add(n),()=>vg.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=Dg();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()}},Bf=D(e=>({connectionState:"disconnected",isSupported:!0,reconnectAttempt:0,lastConnected:null,initialize:()=>{Ef.onConnectionChange((t,n)=>{e(e=>({connectionState:t,reconnectAttempt:n??0,isSupported:Ef.isSupported(),lastConnected:"connected"===t?Date.now():e.lastConnected}))}),Ef.connect()}})),Ff=.05,Sf=1e3,Mf="terrarium";function jf(e,t,n){try{return e.queryTerrainElevation({lng:t,lat:n})??0}catch{return 0}}const Tf=D((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(Mf)||(a.addSource(Mf,{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===Mf&&t.isSourceLoaded&&(clearTimeout(n),a.off("sourcedata",s),e())};a.on("sourcedata",s)})),a.setTerrain({source:Mf}),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>Sf&&(o=Sf),i>Sf&&(i=Sf);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-Ff,maxLat:a+Ff,minLng:s-Ff,maxLng:r+Ff}}(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}})),Pf="pymc-stealth-location";function Rf(e){if("undefined"!=typeof window)try{localStorage.setItem(Pf,JSON.stringify(e))}catch{}}function Lf(e){return!isNaN(e)&&e>=-90&&e<=90}function Nf(e){return!isNaN(e)&&e>=-180&&e<=180}const zf=function(){if("undefined"==typeof window)return{};try{const e=localStorage.getItem(Pf);if(!e)return{};const t=JSON.parse(e);if("number"==typeof t.latitude&&"number"==typeof t.longitude&&"boolean"==typeof t.enabled&&Lf(t.latitude)&&Nf(t.longitude))return t}catch{}return{}}(),_f=D((e,t)=>({latitude:zf.latitude??null,longitude:zf.longitude??null,enabled:zf.enabled??!1,setLocation:(n,a)=>{Lf(n)&&Nf(a)&&(e({latitude:n,longitude:a}),Rf({latitude:n,longitude:a,enabled:t().enabled}))},enable:()=>{const{latitude:n,longitude:a}=t();null!==n&&null!==a&&(e({enabled:!0}),Rf({latitude:n,longitude:a,enabled:!0}))},disable:()=>{e({enabled:!1});const{latitude:n,longitude:a}=t();null!==n&&null!==a&&Rf({latitude:n,longitude:a,enabled:!1})},clear:()=>{e({latitude:null,longitude:null,enabled:!1}),function(){if("undefined"!=typeof window)try{localStorage.removeItem(Pf)}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 If(e,t,n,a){return!t&&a>=3?"offline":n?"connected"!==e&&t||a>0&&a<3?"degraded":"connected":"offline"}const Vf=D((e,t)=>({wsState:"disconnected",wsReconnectAttempt:0,restHealthy:!0,lastSuccessfulFetch:null,consecutiveFailures:0,authValid:!0,authExpiresIn:null,health:"connected",bannerDismissed:!1,isInitializing:!0,initialize:()=>{Ef.onConnectionChange((n,a)=>{const{restHealthy:s,authValid:r,consecutiveFailures:o,health:i,isInitializing:l}=t(),c=l&&"connected"===n,u=If(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=If(a,l,s,i);e({restHealthy:l,lastSuccessfulFetch:c,consecutiveFailures:i,health:u,bannerDismissed:"connected"!==u&&u===o&&t().bannerDismissed})},updateAuthState:()=>{const n=Fg()&&!Mg(),a=jg(),{wsState:s,restHealthy:r,consecutiveFailures:o,health:i}=t(),l=If(s,r,n,o);e({authValid:n,authExpiresIn:a>0?a:null,health:l,bannerDismissed:l===i&&t().bannerDismissed})},dismissBanner:()=>{e({bannerDismissed:!0})}})),Of=()=>Vf(e=>e.health),$f=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-Cwma4a6C.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}},qf=3,Uf=2,Wf=15,Hf=6,Yf=3,Gf=0,Kf=1,Xf=2,Jf=3,Zf={[Gf]:"T_FLOOD",[Kf]:"FLOOD",[Xf]:"DIRECT",[Jf]:"T_DIRECT"},Qf=0,ey=1,ty=2,ny=3,ay=4,sy=5,ry=6,oy=7,iy=8,ly=9,cy=10,uy=11,dy=15,hy={REQ:0,RESPONSE:1,ADVERT:4,GRP_TXT:5,GRP_DATA:6,ANON_REQ:7,TRACE:9},my={[Qf]:"REQ",[ey]:"RESPONSE",[ty]:"TXT_MSG",[ny]:"ACK",[ay]:"ADVERT",[sy]:"GRP_TXT",[ry]:"GRP_DATA",[oy]:"ANON_REQ",[iy]:"PATH",[ly]:"TRACE",[cy]:"MULTIPART",[uy]:"CONTROL",[dy]:"RAW_CUSTOM"},py=1,gy=32,fy=64,yy=64,by=4,vy=1,wy=2,Cy=3,xy=4,ky=16,Ay=128,Dy=15;function Ey(e){return 1===e||0===e}function By(e){return 2===e||3===e}function Fy(e){return 0===e||3===e}function Sy(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 My(e){return Zf[e]??`UNKNOWN(${e})`}function jy(e){return my[e]??`UNKNOWN(${e})`}function Ty(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 Ry(e,t=!0){const n=(255&e).toString(16).padStart(2,"0");return t?n.toUpperCase():n}function Ly(e,t,n,a){if(e+t>n)throw new Error(a)}function Ny(e){if(e>256)throw new Error(`payload too large: ${e} > 256`)}function zy(){return"undefined"!=typeof crypto&&void 0!==crypto.subtle&&"function"==typeof crypto.subtle.digest}const _y=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]),Iy=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);function Vy(e,t){return(e>>>t|e<<32-t)>>>0}function Oy(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=Vy(t[u-15&15],7)^Vy(t[u-15&15],18)^t[u-15&15]>>>3,n=Vy(t[u-2&15],17)^Vy(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+(Vy(o,6)^Vy(o,11)^Vy(o,25))+(o&i^~o&l)+_y[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+((Vy(n,2)^Vy(n,13)^Vy(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 $y(e){const t=new Uint32Array(Iy),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 Gy(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 Ky(e){for(let t=0;t<16;t++)e[t]=Wy[e[t]]}function Xy(e,t){for(let n=0;n<16;n++)e[n]^=t[n]}function Jy(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]=Yy(14,a)^Yy(11,s)^Yy(13,r)^Yy(9,o),e[n+1]=Yy(9,a)^Yy(14,s)^Yy(11,r)^Yy(13,o),e[n+2]=Yy(13,a)^Yy(9,s)^Yy(14,r)^Yy(11,o),e[n+3]=Yy(11,a)^Yy(13,s)^Yy(9,r)^Yy(14,o)}}function Zy(e,t){const n=new Uint8Array(e);Xy(n,t[10]);for(let a=9;a>=1;a--)Gy(n),Ky(n),Xy(n,t[a]),Jy(n);return Gy(n),Ky(n),Xy(n,t[0]),n}function Qy(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=Uy[t]^Hy[a/16-1],t=Uy[s],s=Uy[r],r=Uy[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 ab(e,t){return e[t]|e[t+1]<<8}function sb(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function rb(e,t,n){t[n]=255&e,t[n+1]=e>>8&255}function ob(e){return(e instanceof Uint8Array?Array.from(e):e).map(e=>Ry(e,!0)).join("->")}const ib={name:"Public",secret:"8b3387e9c5cdea6ac9e5edbaa115cd72"},lb=["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","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 cb(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 qy(a)).slice(0,16),r=(await qy(s))[0],o=new Uint8Array(32);return o.set(s),{name:`#${t}`,channelHash:r,aesKey:s,hmacKey:o,autoDiscovered:!0}}let ub=null,db=null;const hb=new Map;let mb=null;const pb="pymc_discovered_channels";function gb(e){hb.set(e.channelHash,e),e.autoDiscovered&&function(){try{const e=[];for(const t of hb.values())t.autoDiscovered&&e.push({name:t.name,hash:t.channelHash});localStorage.setItem(pb,JSON.stringify(e))}catch(e){}}()}async function fb(){ub||(db||(db=(async()=>{await async function(){try{const e=localStorage.getItem(pb);if(!e)return;const t=JSON.parse(e);for(const{name:n}of t)try{const e=await cb(n);hb.set(e.channelHash,e)}catch{}t.length}catch(e){}}();const e=await async function(){const{default:e}=await C(async()=>{const{default:e}=await import("./generated-geo-channels-CkSMgZLG.js");return{default:e}},[]);return[...lb,...e]}(),t=new Map;for(const n of e)try{const e=await cb(n),a=t.get(e.channelHash)||[];a.push(e),t.set(e.channelHash,a)}catch{}ub=t})()),await db)}async function yb(e,t,n){const a=await async function(e,t){if(zy())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($y(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 vb(e,t,n){await fb();const a=await async function(){return mb||(mb=await async function(e,t=!1){const n=Ty(e.secret),a=(await qy(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}}(ib)),mb}();if(a.channelHash===e&&await yb(a.hmacKey,t,n))return{channelName:"Public",plaintext:Qy(a.aesKey,n),keys:a};const s=hb.get(e);if(s&&await yb(s.hmacKey,t,n)){const e=Qy(s.aesKey,n);return{channelName:s.name,plaintext:e,keys:s}}const r=(null==ub?void 0:ub.get(e))||[],o=[];for(const l of r){if(await yb(l.hmacKey,t,n)){gb(l);const e=Qy(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=Qy(l.aesKey,n),t=bb(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 wb(e){return await fb(),((null==ub?void 0:ub.get(e))||[]).map(e=>e.name)}async function Cb(e,t,n,a){try{const s=await cb(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 yb(s.hmacKey,n,a)))return{success:!1,error:"MAC verification failed - wrong channel name or corrupted data"};const r=Qy(s.aesKey,a);return gb(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 xb=null,kb=[];function Ab(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 Db=D((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)===hy.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(kb.map(e=>e.packet_hash)),t=l.filter(t=>!e.has(t.packet_hash));return void(t.length>0&&kb.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 $f.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,Ab(e));e({messages:a}),xb&&clearTimeout(xb),xb=setTimeout(()=>{e({stableMessages:new Map(t().messages),lastSnapshotUpdate:Date.now()})},500)}});xb&&(clearTimeout(xb),xb=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}}),kb.length>0){const e=kb;kb=[],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 cb(e.startsWith("#")?e.slice(1):e)}(e);return{name:t.name,channelHash:t.channelHash,aesKeyHex:Py(t.aesKey),hmacKeyHex:Py(t.hmacKey)}}(s),l=a.filter(e=>{if((e.type??e.payload_type)!==hy.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 $f.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,Ab(e));e({messages:a}),xb&&clearTimeout(xb),xb=setTimeout(()=>{e({stableMessages:new Map(t().messages),lastSnapshotUpdate:Date.now()})},500)}});xb&&(clearTimeout(xb),xb=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:()=>{xb&&(clearTimeout(xb),xb=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 Db(t=>t.messages.get(e))}function Bb(){return Db(e=>e.progress)}function Fb(){return Db(e=>e.initialDecodeComplete)}function Sb(){return Db(e=>e.stableMessages)}function Mb(){return Db(e=>e.stableMessages)}const jb=[{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}],Tb=[{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}];function Pb(e,t=12){return Math.max(t,Math.round(e/15))}const Rb={hero:Pb(1200),statsCard:Pb(380)};function Lb(e){switch(e){case 1:return 3600;case 3:case 12:return 5400;case 24:return 8640;case 72:case 168:case 336:return 720;default:{const t=3600*e,n=Math.round(t/10);return Math.min(Math.max(360,n),720)}}}const Nb="'JetBrains Mono', 'SF Mono', Monaco, monospace",zb={stats:3e3,logs:2e3,system:3e3},_b={DEBUG:"text-sys-brown",INFO:"text-sys-cyan",WARNING:"text-sys-amber",ERROR:"text-sys-red",CRITICAL:"text-sys-pink"};function Ib(e){return _b[e]??"text-text-muted border-border-subtle"}function Vb(e){return e?(e.startsWith("0x")?e.slice(2):e).slice(0,2).toUpperCase():""}function Ob(e,t){if(!e)return"expired";const n=t/1e3-e;return n<=10800?"active":n<=86400?"stale":"expired"}function $b(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 qb={critical:0,high:150,medium:300,low:450};let Ub=!1;const Wb=[],Hb=new Set;function Yb(e,t="medium"){if(Ub){const n=setTimeout(()=>{e(),Hb.delete(n)},qb[t]);return Hb.add(n),()=>{clearTimeout(n),Hb.delete(n)}}{const n={callback:e,priority:t};return Wb.push(n),()=>{const e=Wb.indexOf(n);-1!==e&&Wb.splice(e,1)}}}function Gb(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2,4).toUpperCase():e.slice(0,2).toUpperCase()}function Kb(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?Gb(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 Xb(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?Gb(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 Jb(e,t){const n=e.toUpperCase();return t.startsWith("0x")||t.startsWith("0X")?t.slice(2).toUpperCase().startsWith(n):t.toUpperCase().startsWith(n)}function Zb(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:dr(n)?t.length<=1:0===t.length;var a}(e)}function Qb(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)?Gb(s)===t?null:s:null}function ev(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 tv(e){return{hash:e,count:0,rssiSum:0,rssiCount:0,snrSum:0,snrCount:0,lastSeen:0}}function nv(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:Gb(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 av="pymc-hidden-contacts",sv="pymc-quick-neighbors",rv="pymc-local-hash",ov="pymc-global-time-range";let iv=null;function lv(){if("undefined"==typeof window)return[];try{const e=localStorage.getItem(sv);if(e)return JSON.parse(e)}catch{}return[]}function cv(e){"undefined"!=typeof window&&(iv&&clearTimeout(iv),iv=setTimeout(()=>{try{localStorage.setItem(sv,JSON.stringify(e))}catch{}iv=null},1e3))}function uv(){if("undefined"!=typeof window)try{const e=localStorage.getItem(rv);if(e)return e}catch{}}function dv(e){if("undefined"!=typeof window)try{localStorage.setItem(rv,e)}catch{}}function hv(){if("undefined"==typeof window)return new Set;try{const e=localStorage.getItem(av);if(e)return new Set(JSON.parse(e))}catch{}return new Set}function mv(){if("undefined"==typeof window)return 4;try{const e=localStorage.getItem(ov);if(e){const t=parseInt(e,10);if(!isNaN(t)&&t>=0&&t<=7)return t>4?4:t}}catch{}return 4}const pv=D((e,t)=>({stats:null,statsLoading:!1,statsError:null,packets:Cf.getPackets(),packetsLoading:!1,packetsError:null,lastPacketTimestamp:Cf.getNewestTimestamp(),logs:[],logsLoading:!1,liveMode:!0,flashReceived:0,flashAdvert:0,pendingAdvertLocalHash:null,pendingAdvertTimestamp:null,resourceHistory:[],lastResourceFetch:0,hardwareStats:null,hardwareStatsLoading:!1,hardwareStatsError:null,hiddenContacts:hv(),quickNeighbors:lv(),cachedLocalHash:uv(),initialized:!1,packetCacheState:Cf.getState(),mutationsInFlight:new Set,globalTimeRangeIndex:mv(),initializeApp:async()=>{const{initialized:n}=t();if(n)return;e({initialized:!0,statsLoading:!0,packetsLoading:!0}),Cf.subscribe(t=>{e({packetCacheState:t})});const{hiddenContacts:a}=t();let s=0;Hg().then(t=>{const n=$b(t.neighbors,a),s=t.local_hash;e({stats:t,statsLoading:!1,quickNeighbors:n,cachedLocalHash:s}),cv(n),s&&dv(s)}).catch(t=>{e({statsError:t instanceof Error?t.message:"Failed to fetch stats",statsLoading:!1})}),Cf.initialLoad(()=>{const t=Date.now();if(t-s>=50){s=t;const n=Cf.getPackets();if(n.length>0){const t=Cf.getNewestTimestamp();e({packets:n,lastPacketTimestamp:t})}}}).then(n=>{if(n.length>0){const a=Cf.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(!Ub){Ub=!0;for(const e of Wb){const t=qb[e.priority],n=setTimeout(()=>{e.callback(),Hb.delete(n)},t);Hb.add(n)}Wb.length=0}}(),16),setTimeout(()=>{Db.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})}),Bf.getState().initialize(),Ef.onPacket(n=>{const{lastPacketTimestamp:a,mutationsInFlight:s}=t();if(s.size>0)return;Cf.mergePacketsDirectly([n]);const r=n.timestamp??0;if(r>a){const n=Cf.getPackets();e({packets:n,flashReceived:t().flashReceived+1,lastPacketTimestamp:r}),Xg()}Db.getState().queueDecryption([n])}),Ef.onStats(n=>{const{mutationsInFlight:a,hiddenContacts:s}=t();if(a.size>0)return;const r=$b(n.neighbors,s),o=n.local_hash;e({stats:n,statsLoading:!1,statsError:null,quickNeighbors:r,cachedLocalHash:o}),cv(r),o&&dv(o)}),Ef.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(()=>{Cf.isHeavyLoadInProgress()||e().mutationsInFlight.size>0||e().fetchStats().then(()=>{Vf.getState().updateRestHealth(!0)}).catch(()=>{Vf.getState().updateRestHealth(!1)})},zb.stats),function t(){const n=Ef.isConnected()?15e3:3e3;setTimeout(async()=>{e().liveMode&&!Cf.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&&(Ef.resetSupported(),Ef.isConnected()?await Ef.verifyConnection(3e3)||(Ef.disconnect(),Ef.connect()):Ef.isSupported()&&Ef.connect()),e().fetchStats({force:!0}),e().fetchPackets())})}}(t),t().fetchHardwareStats(),setInterval(()=>{"undefined"!=typeof document&&document.hidden||t().fetchHardwareStats()},zb.system)},prefetchForRoute:e=>{switch(e){case"/logs":Yg().catch(()=>{});break;case"/system":ef().catch(()=>{});break;case"/statistics":(async function(e=24){return Og(`/api/packet_type_graph_data?hours=${e}`)})(3).catch(()=>{}),Gg(3).catch(()=>{});break;case"/settings":(async function(){return Og("/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 Hg(),n=$b(t.neighbors,r),a=t.local_hash;e({stats:t,statsLoading:!1,quickNeighbors:n,cachedLocalHash:a}),cv(n),a&&dv(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 Cf.poll(),r=Cf.getNewestTimestamp(),o=r>s&&s>0,i=n.length!==a.length||o;o&&(e({flashReceived:t().flashReceived+1}),Xg()),i?(e({packets:n,packetsLoading:!1,lastPacketTimestamp:r||s}),Db.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 Yg();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 sf(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 rf(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 Og("/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 af();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 ef();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(av,JSON.stringify([...e]))}catch{}}(s)},clearPacketCache:()=>{Cf.clear(),e({packets:[],lastPacketTimestamp:0}),Cf.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=_f.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=Tf.getState().getTerrainGridForDisambiguation();Af.compute(r,c,u,d,h,void 0,m,p??void 0)},triggerDeepAnalysis:async()=>{await Cf.forceDeepLoad();const n=Cf.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=Gb(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=Gb(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(!Zb(c))continue;const e=Qb(c.src_hash,s,o,r);if(!e)continue;let t=i.get(e);t||(t=tv(e),i.set(e,t)),ev(t,c)}for(const[c,u]of Object.entries(t))Gb(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=nv(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}),cv(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&&Df.compute(e,r)},requestSevenDayData:async()=>{let n=0;await Cf.loadSevenDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:Cf.getPackets()}))});const a=Cf.getPackets();e({packets:a,lastPacketTimestamp:Cf.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Db.getState().queueDecryption(a)},{timeout:2e3})},requestThreeDayData:async()=>{let n=0;await Cf.loadThreeDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:Cf.getPackets()}))});const a=Cf.getPackets();e({packets:a,lastPacketTimestamp:Cf.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Db.getState().queueDecryption(a)},{timeout:2e3})},requestFourteenDayData:async()=>{let n=0;await Cf.loadFourteenDays(()=>{const t=Date.now();t-n<200||(n=t,e({packets:Cf.getPackets()}))});const a=Cf.getPackets();e({packets:a,lastPacketTimestamp:Cf.getNewestTimestamp()}),requestIdleCallback(()=>{t().triggerTopologyCompute(),t().triggerSparklineCompute(),Db.getState().queueDecryption(a)},{timeout:5e3})},setGlobalTimeRange:n=>{e({globalTimeRangeIndex:n}),function(e){if("undefined"!=typeof window)try{localStorage.setItem(ov,e.toString())}catch{}}(n);const{packetCacheState:a,requestThreeDayData:s,requestSevenDayData:r,requestFourteenDayData:o,triggerTopologyCompute:i,triggerSparklineCompute:l}=t();let c=!1;if(5!==n||a.threeDayLoadComplete||a.isBackgroundLoading||(s(),c=!0),6!==n||a.sevenDayLoadComplete||a.isBackgroundLoading||(r(),c=!0),7!==n||a.fourteenDayLoadComplete||a.isBackgroundLoading||(o(),c=!0),!c&&n>=5&&(i(),l()),!c){const{packets:e}=t();Db.getState().queueDecryption(e)}}})),gv=pv,fv=()=>pv(e=>e.stats),yv=()=>pv(e=>e.statsError),bv=()=>pv(e=>e.packets),vv=()=>pv(e=>e.packetsLoading),wv=()=>pv(e=>e.logs),Cv=()=>pv(e=>e.logsLoading),xv=()=>pv(e=>e.liveMode),kv=()=>pv(e=>e.fetchLogs),Av=()=>pv(e=>e.setLiveMode),Dv=()=>pv(e=>e.resourceHistory),Ev=()=>pv(e=>e.hardwareStats),Bv=()=>pv(e=>e.hardwareStatsLoading),Fv=()=>pv(e=>e.hardwareStatsError),Sv=()=>pv(e=>e.fetchHardwareStats),Mv=()=>pv(e=>e.hiddenContacts),jv=()=>pv(e=>e.hideContact),Tv=()=>pv(e=>e.packetCacheState),Pv=()=>pv(e=>e.quickNeighbors),Rv=()=>pv(e=>e.cachedLocalHash),Lv=()=>pv(e=>e.lastPacketTimestamp),Nv=()=>pv(e=>e.globalTimeRangeIndex),zv=()=>pv(e=>e.setGlobalTimeRange),_v=()=>pv(e=>null!==e.stats&&e.packetCacheState.backgroundLoadComplete),Iv=()=>pv(e=>e.packets.length>0);function Vv(){const e=pv(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=pv(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=pv(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=_f(e=>e.latitude),s=_f(e=>e.longitude),r=_f(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 Ov={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 $v({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 qv({showLabel:e=!1,className:t}){const n=pv(e=>e.flashReceived),a=pv(e=>e.flashAdvert),o=Bf(e=>"connected"===e.connectionState),l=Of(),c=Vf(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=Ov.healthy,g=!1,f="LIVE",y="Real-time (WebSocket)";c?(p=Ov.connecting,g=!0,f="WAIT",y="Connecting..."):"offline"===l?(p=Ov.offline,g=!0,f="DOWN",y="Cannot reach server"):"degraded"===l?(p=Ov.degraded,f="POLL",y="Real-time unavailable, using REST polling"):o?(p=Ov.healthy,f="LIVE",y="Real-time (WebSocket)"):(p=Ov.healthy,f="POLL",y="Database polling");const b="rx"===u?Ov.rx:"tx"===u?Ov.tx:Ov.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-bg-body border border-border-subtle",children:[r.jsx($v,{color:p,pulse:g}),r.jsx($v,{color:b})]}),e&&r.jsx("span",{className:i("font-mono text-[10px] tracking-wider","DOWN"===f?"text-status-danger":"WAIT"===f?"text-accent-primary":"POLL"===f?"text-status-warning":"text-text-muted"),children:f})]})}function Uv({borderRadius:e}){return r.jsx(wp.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(--accent-primary) 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 Wv({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(om,{children:t&&r.jsx(Uv,{borderRadius:a})}),r.jsx("div",{className:"relative z-10",children:e})]})}function Hv({className:e}){return r.jsx("div",{className:i("relative w-10 h-1 rounded-sm overflow-hidden","bg-bg-elevated",e),children:r.jsx(wp.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(--accent-primary) 50%,\n transparent 100%\n )",backgroundSize:"200% 100%"}})})}const Yv=D(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(()=>{Df.subscribe((e,t)=>{const n=Yv.getState();t&&!n.isComputing?n.setComputing(!0):!t&&e.size>0?n.setSparklines(e):!t&&n.isComputing&&n.setComputing(!1)})},0);const Gv=()=>Yv(e=>e.sparklines),Kv=()=>Yv(e=>e.isComputing),Xv=[],Jv=new Map;function Zv(e){return Yv(t=>{const n=t.sparklines.get(e);if(!n||0===n.length)return Xv;const a=Jv.get(e);return a===n?a:(Jv.set(e,n),n)})}const Qv="pymc_room_seen_",ew="pymc_room_selected";function tw(e){try{const t=localStorage.getItem(`${Qv}${e}`);return t?Number(t):0}catch{return 0}}function nw(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([cf(),lf()]),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,tw(e.room_name));const c=sw(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(ew)}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(ew,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()),Og(`/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:nw([...s,...a])})}else e({messages:nw(t.data.messages)})}catch(o){}},postMessage:async e=>{try{return!!(await async function(e){return Og("/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()),Og(`/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),Og(`/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),Og(`/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(`${Qv}${e}`,String(t))}catch{}}(n,r);const o=new Map(s);o.set(n,r),e({lastSeenMap:o,unreadCount:sw(a,o)})},createRoom:async e=>{try{return!!(await async function(e){return Og("/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 Og("/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 Og(`/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 Og("/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)}}}),ow=()=>rw(e=>e.rooms),iw=()=>rw(e=>e.selectedRoom),lw=()=>rw(e=>e.messages),cw=()=>rw(e=>e.clients),uw=()=>rw(e=>e.identities),dw=()=>rw(e=>e.isLoading),hw=()=>rw(e=>e.rooms.find(t=>t.room_name===e.selectedRoom)??null),mw=()=>rw(e=>e.identities.find(t=>{var n;return t.name===e.selectedRoom||(null==(n=t.settings)?void 0:n.node_name)===e.selectedRoom})??null),pw=D(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:kf(),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&&Af.subscribe((e,t)=>{pw.getState().setTopology(e,t)});const gw=()=>pw(e=>e.topology),fw=()=>pw(e=>e.topology.hubNodes),yw=()=>pw(e=>e.topology.centrality),bw=()=>pw(e=>e.topology.fullAffinity),vw=()=>pw(e=>e.isComputing),ww=()=>pw(e=>e.lastUpdated);let Cw=null,xw=null,kw=null,Aw=null;const Dw=()=>pw(e=>(e.topology.hubNodes!==xw&&(xw=e.topology.hubNodes,Cw=new Set(e.topology.hubNodes)),Cw)),Ew=()=>pw(e=>e.topology.pathHealth),Bw=()=>pw(e=>e.topology.disambiguationStats),Fw=()=>pw(e=>e.topology.disambiguationStats.highCollisionPrefixes),Sw=()=>pw(e=>e.topology.disambiguationStats.totalPrefixes>0),Mw=()=>pw(e=>e.topology.discoveredNodes),jw=()=>pw(e=>e.topology.viterbiStats),Tw=()=>pw(e=>(e.topology.discoveredNodes!==Aw&&(Aw=e.topology.discoveredNodes,kw=e.topology.discoveredNodes.filter(e=>e.isLikelyReal)),kw)),Pw=()=>pw(e=>e.topology.nodeMetrics),Rw=()=>pw(e=>e.topology.communityCount);let Lw=null,Nw=null;const zw=()=>pw(e=>{if(e.topology.nodeMetrics!==Nw){Nw=e.topology.nodeMetrics,Lw={local:0,hub:0,gateway:0,backbone:0,neighbor:0,mobile:0,ghost:0,standard:0};for(const t of e.topology.nodeMetrics.values())Lw[t.nodeClass]++}return Lw});function _w(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 Iw(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 Vw(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 Ow(e){return new Date(1e3*e).toLocaleString()}function $w(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 qw(e){return new Date(1e3*e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function Uw(e){return`${(e/1e6).toFixed(3)} MHz`}function Ww(e){return`${(e/1e3).toFixed(1)} kHz`}function Hw(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 Yw(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 Gw(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 Ks({...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 Kw=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-text-secondary whitespace-nowrap",children:e.label}),void 0!==e.value&&r.jsx("span",{className:"text-text-muted tabular-nums",children:e.formatValue?e.formatValue(e.value):e.value})]},e.key)})})}),Xw="#AD7F58",Jw={4:"#3B82F6",5:"#5B5BD6",6:"#8E4EC6",0:"#00A2C7",2:"#12A594",7:"#46A758",1:"#F5D90A",10:"#FFB224",8:"#F76B15",9:"#E5484D",3:"#D6409F",15:Xw},Zw=Xw;function Qw(e){return Jw[e]??Zw}let eC=null,tC=0;const nC=1e3;function aC({activeTypes:e,totalByType:t}){const n=[...e].reverse().map(e=>({key:String(e),label:lr[e]??`TYPE_${e}`,color:Qw(e),value:t[e]??0,formatValue:e=>Gw(e)}));return r.jsx(Kw,{items:n})}const sC=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(eC&&e-tC{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-text-muted",children:"No data available"}):r.jsx("div",{ref:i,className:"w-full h-full",onMouseMove:y,onMouseLeave:b})}),rC=new Map;function oC(e){var t;if(!e.startsWith("var("))return e;const n=rC.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 rC.set(e,o),o}const iC="undefined"!=typeof document&&"light"!==document.documentElement.dataset.mode?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.3)";function lC(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)}))},x=(e,t)=>i?i===e?Math.min(1,1.5*t):"minMax"===i||"p5p95"===i||"p25p75"===i?.3*t:t:t,k=e=>i?i===e?1:"mean"===i||"median"===i||"average"===i?.3:1:1,A={band:oC(l.band),innerBand:oC(l.innerBand),mean:oC(l.mean),median:oC(l.median),average:oC(l.average)};c.save(),c.strokeStyle=A.average,c.lineWidth=4,c.globalAlpha=k("average"),lC(c,C.average),c.stroke(),c.globalAlpha=x("minMax",.15),c.fillStyle=A.band,c.beginPath(),lC(c,C.max);const D=[...C.min].reverse();for(const e of D)c.lineTo(e.x,e.y);c.closePath(),c.fill(),c.globalAlpha=x("p5p95",.3),c.fillStyle=A.band,c.beginPath(),lC(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=x("p25p75",.55),c.fillStyle=A.innerBand,c.beginPath(),lC(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=A.median,c.lineWidth=1.5,c.globalAlpha=k("median"),c.setLineDash([4,4]),lC(c,C.median),c.stroke(),c.strokeStyle=A.mean,c.lineWidth=1.5,c.globalAlpha=k("mean"),c.setLineDash([]),lC(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 Ks({...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 x=s.useCallback(()=>{null==n||n(null)},[n]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available"}):r.jsx("div",{ref:h,className:"w-full h-full rounded-2xl overflow-hidden",onMouseLeave:x})});const cC="undefined"!=typeof window&&(null==(t=null==(e=window.matchMedia)?void 0:e.call(window,"(color-gamut: p3)"))?void 0:t.matches);let uC=null,dC=0;function hC(){const e=performance.now();if(uC&&e-dC<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("--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 uC={fontFamily:n,axisColor:s,gridColor:r,textMuted:o,textPrimary:i,signalCritical:l,bgBody:c},dC=e,uC}const mC=["min","max","p75","p95","p99","mean","median","average","midpoint"];function pC(e){const t=mr(function(e){const{colormap:t,baseIndex:n,halfSize:a}=fr(),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 gC(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],x=C.length;if(0===x)return;const k=C[0],A=C[x-1],D=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)}(D):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&&D>=20){g.save();const e=y+v*(1-20/D);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 L=B;Ln+s)return;const i=hC().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)}}(hC().signalCritical);e.save(),e.globalAlpha=u,e.fillStyle=cC?`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,k,A,w,u?Math.max(.03,.03*p):p)}s.memo(function({data:e,maxValue:t,visibleLines:n=mC,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),x=s.useRef(i),k=s.useRef(l),A=s.useRef(c),D=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,x.current=i,k.current=l,A.current=c,D.current=d,E.current=h,T.current=j,S.current=p,M.current=u}),s.useEffect(()=>{B.current=hC()},[]);const R=s.useMemo(()=>[e.map(e=>e.timestamp),new Array(e.length).fill(1)],[e]),L=s.useMemo(()=>({hooks:{draw:e=>{const t=B.current||hC();gC(e,y.current,b.current,v.current,w.current,t,x.current,k.current,A.current,D.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:[L]}),[L]);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(R),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 Ks({...N,width:o,height:i},R,t);return f.current=l,P.current=a,()=>{l.destroy(),f.current=null}},[N,R,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-text-muted",children:"No data available"}):r.jsx("div",{ref:g,className:"w-full h-full rounded-lg overflow-hidden",onMouseMove:z,onMouseLeave:_})});const fC=-70;let yC=null,bC=0;function vC(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 wC(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 CC(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 xC(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 kC=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<=fC);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:vC(r,5),p95:vC(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<=fC);if(0===e.length)return{heatmapData:null,xLabels:[],yLabels:[]};const a=[...e].sort((e,t)=>e-t),r=vC(a,5),o=vC(a,95),i=.1*(o-r||1);n=r-i,s=o+i}else{const e=t.filter(e=>e<=fC);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;afC)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 x=[];for(let e=0;e{g.current=v,f.current=a});const x=s.useMemo(()=>{if(0===e.length)return[[],[]];const t=new Array(e.length).fill(1);return[e,t]},[e]),k=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(yC&&e-bC<1e3)return yC;const t=getComputedStyle(document.documentElement);return yC={heatGradient:[wC(t.getPropertyValue("--sys-purple").trim()),wC(t.getPropertyValue("--sys-blue").trim()),wC(t.getPropertyValue("--sys-teal").trim()),wC(t.getPropertyValue("--sys-amber").trim()),wC(t.getPropertyValue("--sys-orange").trim())],trendLineColor:wC(t.getPropertyValue("--accent-secondary").trim()),stabilityHot:wC(t.getPropertyValue("--sys-amber").trim()),stabilityCool:wC(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)"}},bC=e,yC}();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`}}}}),[]),A=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:[k]}),[k,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 Ks({...A,width:a,height:s},x,t);return h.current=r,()=>{r.destroy(),h.current=null}},[A,x,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-text-secondary tabular-nums 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-border-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-text-muted"}),r.jsx("div",{className:"type-data-xs text-text-primary tabular-nums"}),r.jsx("div",{className:"type-data-xs text-text-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(Yr,{className:"w-3.5 h-3.5 text-text-muted","aria-hidden":"true"}):r.jsx(uo,{className:"w-3.5 h-3.5 text-text-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-text-secondary tabular-nums absolute top-1",style:{left:`${e.pos}%`,transform:"translateX(-50%)"},children:e.label},t))})]}):a?r.jsx("div",{className:"w-full rounded bg-bg-subtle/50",style:{height:o??28},"aria-hidden":"true"}):r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No noise floor data available"})});let AC=null,DC=0;function EC(){const e=performance.now();if(AC&&e-DC<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},DC=e,AC}function BC(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 FC(e){return BC(Qw(e))}const SC=s.memo(function({scatterData:e,yAxisMode:t,onHover:n,noiseFloorAnomalies:a=null,showNoiseFloorOverlay:o=!1,overlayOpacity:i=.5,highlightedType:l=null,timeRangeHours:c=24}){const u=s.useRef(null),d=s.useRef(null),h=s.useRef(e),m=s.useRef(t),p=s.useRef(n),g=s.useRef(a),f=s.useRef(o),y=s.useRef(i),b=s.useRef(l),v=s.useRef(null),w=s.useRef(null),C=c<=12?1.2:1,x=s.useRef(C),k=(null==e?void 0:e.maxValue)??("share"===t?200:10),A=s.useRef(k);s.useLayoutEffect(()=>{h.current=e,m.current=t,p.current=n,g.current=a,f.current=o,y.current=i,b.current=l,x.current=C,A.current=k}),s.useEffect(()=>{v.current=EC()},[]);const D=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]),E=s.useMemo(()=>({hooks:{draw:e=>{const t=v.current||EC();!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,x=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 A=x;An+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=1*i*(window.devicePixelRatio||1);e.globalCompositeOperation="source-over";const p=o?parseInt(o.replace("TYPE_",""),10):null;for(let g=0;g0&&function(e,t,n,a,s,r,o,i,l,c,u){if(0===t.length)return;const d=i-o||1,h=BC(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,h.current,A.current,m.current,t,g.current,f.current,y.current,b.current,x.current,w.current)}}}),[]),B=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:[E]}),[E]);s.useEffect(()=>{const t=u.current;if(!t||!e||0===e.count)return;d.current&&d.current.destroy();const n=t.getBoundingClientRect(),a=Math.floor(n.width)||400,s=Math.floor(n.height)||200,r=new Ks({...B,width:a,height:s},D,t);return d.current=r,()=>{r.destroy(),d.current=null}},[B,D,null==e?void 0:e.count]),s.useEffect(()=>{const e=u.current;if(!e)return;const t=new ResizeObserver(e=>{const t=e[0];if(!t||!d.current)return;const{width:n,height:a}=t.contentRect;n>0&&a>0&&d.current.setSize({width:Math.floor(n),height:Math.floor(a)})});return t.observe(e),()=>{t.disconnect()}},[]),s.useEffect(()=>{d.current&&d.current.redraw()},[e,a,o,i,l,C,t]);const F=s.useCallback(t=>{var n,a;const s=u.current,r=d.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,h=c.left/l,m=c.width/l;if(ih+m)return w.current=null,r.redraw(),void(null==(n=p.current)||n.call(p,null,void 0));w.current=i*l;const g=(i-h)/m,f=Math.floor(g*e.count),y=Math.max(0,Math.min(e.count-1,f));r.redraw(),null==(a=p.current)||a.call(p,y,g)},[null==e?void 0:e.count]),S=s.useCallback(()=>{var e;w.current=null,d.current&&d.current.redraw(),null==(e=p.current)||e.call(p,null,void 0)},[]);return e&&0!==e.count?r.jsx("div",{ref:u,className:"w-full h-full rounded-lg overflow-hidden",onMouseMove:F,onMouseLeave:S}):r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available"})}),MC=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 jC(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 TC(e){return"undefined"==typeof window?"":getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function PC(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}(TC(e))}function RC(e,t){const[n,a]=s.useState(t),r=s.useCallback(()=>{a(e())},[e]);return s.useEffect(()=>(r(),MC.subscribe(r)),[r]),n}const LC={chart1:"#719CDF",chart2:"#0074BE",chart3:"#6FBCBD",chart4:"#DFBC72",chart5:"#719872",chart6:"#E12672",chart7:"#E17899",chart8:"#999ABD"},NC="#00FF00",zC="#8CE619",_C="#FFD900",IC="#FF8C26",VC="#FF3333",OC={primary:"#719CDF",secondary:"#DFBC72",tertiary:"#6FBCBD",success:"#719872",danger:"#E12672"},$C={primary:"#E4E4E4",secondary:"#BFBFBF",muted:"#727272"},qC={nodeFill:"#3B82F6",nodeStroke:"rgba(255,255,255,0.9)",hubColor:"#8E4EC6",hubStroke:"rgba(255,255,255,0.9)",gatewayColor:"#5B5BD6",gatewayStroke:"rgba(255,255,255,0.85)",localColor:"#FFB224",neighborColor:"#FFB224",neighborStroke:"rgba(0,0,0,0.4)",mobileColor:"#F76B15",roomColor:"#D6409F",ghostColor:"#00A2C7"};function UC(){return"undefined"==typeof window?LC:{chart1:TC("--chart-1")||LC.chart1,chart2:TC("--chart-2")||LC.chart2,chart3:TC("--chart-3")||LC.chart3,chart4:TC("--chart-4")||LC.chart4,chart5:TC("--chart-5")||LC.chart5,chart6:TC("--chart-6")||LC.chart6,chart7:TC("--chart-7")||LC.chart7,chart8:TC("--chart-8")||LC.chart8}}function WC(){return"undefined"==typeof window?$C:{primary:TC("--text-primary")||$C.primary,secondary:TC("--text-secondary")||$C.secondary,muted:TC("--text-muted")||$C.muted}}function HC(){return"undefined"==typeof window?OC:{primary:TC("--accent-primary")||OC.primary,secondary:TC("--accent-secondary")||OC.secondary,tertiary:TC("--accent-tertiary")||OC.tertiary,success:TC("--accent-success")||OC.success,danger:TC("--accent-danger")||OC.danger}}function YC(){return RC(UC,LC)}function GC(){return RC(WC,$C)}function KC(){return RC(HC,OC)}function XC(){return"undefined"==typeof window?qC:{nodeFill:TC("--map-node-fill")||qC.nodeFill,nodeStroke:TC("--map-node-stroke")||qC.nodeStroke,hubColor:TC("--map-hub-color")||qC.hubColor,hubStroke:TC("--map-hub-stroke")||qC.hubStroke,gatewayColor:TC("--map-gateway-color")||qC.gatewayColor,gatewayStroke:TC("--map-gateway-stroke")||qC.gatewayStroke,localColor:TC("--map-local-color")||qC.localColor,neighborColor:TC("--map-neighbor-color")||qC.neighborColor,neighborStroke:TC("--map-neighbor-stroke")||qC.neighborStroke,mobileColor:TC("--map-mobile-color")||qC.mobileColor,roomColor:TC("--map-room-color")||qC.roomColor,ghostColor:TC("--map-ghost-color")||qC.ghostColor}}function JC(){return RC(XC,qC)}const ZC={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)"},QC={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 ex(e){if("undefined"==typeof window)return qC;const t="light"===function(){if("undefined"==typeof window)return"dark";const e=document.querySelector("[data-basemap]");return e&&e.getAttribute("data-basemap")||"dark"}()?ZC:QC;return{nodeFill:PC("--map-node-fill")||qC.nodeFill,nodeStroke:t.nodeStroke,hubColor:PC("--map-hub-color")||qC.hubColor,hubStroke:t.hubStroke,gatewayColor:PC("--map-gateway-color")||qC.gatewayColor,gatewayStroke:t.gatewayStroke,localColor:PC("--map-local-color")||qC.localColor,neighborColor:PC("--map-neighbor-color")||qC.neighborColor,neighborStroke:t.neighborStroke,mobileColor:PC("--map-mobile-color")||qC.mobileColor,roomColor:PC("--map-room-color")||qC.roomColor,ghostColor:PC("--map-ghost-color")||qC.ghostColor}}const tx={rest:"#4B4B4B",restBright:"#616161",restDim:"#3F3F3F",hoverDirect:"#6FBCBD",hoverLoop:"#8B7BAD",hoverStandard:"#8A8A8A",hoverNeighbor:"#FBBF24",highlight:"#FFD700"},nx={rest:"rgba(0, 0, 0, 0.20)",restBright:"rgba(0, 0, 0, 0.30)",restDim:"rgba(0, 0, 0, 0.12)"},ax={rest:"rgba(255, 255, 255, 0.25)",restBright:"rgba(255, 255, 255, 0.35)",restDim:"rgba(255, 255, 255, 0.15)"};function sx(e){if("undefined"==typeof window)return tx;const t="light"===e?nx:ax;return{rest:t.rest,restBright:t.restBright,restDim:t.restDim,hoverDirect:PC("--map-edge-hover-direct")||tx.hoverDirect,hoverLoop:PC("--map-edge-hover-loop")||tx.hoverLoop,hoverStandard:PC("--map-edge-hover-standard")||tx.hoverStandard,hoverNeighbor:PC("--map-edge-hover-neighbor")||tx.hoverNeighbor,highlight:PC("--map-edge-highlight")||tx.highlight}}const rx={grid:"rgba(128, 128, 128, 0.15)",axisTick:"#808080",cursor:"rgba(128, 128, 128, 0.3)"};function ox(){return"undefined"==typeof window?rx:{grid:TC("--chart-grid")||rx.grid,axisTick:TC("--chart-axis-tick")||rx.axisTick,cursor:TC("--chart-cursor")||rx.cursor}}function ix(){return RC(ox,rx)}function lx(e,t){return TC(`--palette-${e}-${t}`)||""}function cx(){const e=[];for(let t=0;t<24;t++){const n=t/23,a=1-n,s=lx("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 ux(){const e=TC("--signal-excellent")||NC,t=TC("--signal-good")||zC,n=TC("--signal-fair")||_C,a=TC("--signal-poor")||IC,s=TC("--signal-critical")||VC,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 dx(){const e=PC("--signal-excellent")||NC,t=PC("--signal-good")||zC,n=PC("--signal-fair")||_C,a=PC("--signal-poor")||IC,s=PC("--signal-critical")||VC,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 hx(){const[e,t]=s.useState(()=>ux());return s.useEffect(()=>{const e=()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t(ux())})})};return e(),MC.subscribe(e)},[]),e}function mx(e){const t=(Math.max(-12,Math.min(12,e))- -12)/24;return Math.round(23*(1-t))}const px={red:"#E5484D",orange:"#F76B15",amber:"#FFB224",yellow:"#F5D90A",brown:"#AD7F58",green:"#46A758",teal:"#12A594",cyan:"#00A2C7",blue:"#3B82F6",indigo:"#5B5BD6",purple:"#8E4EC6",pink:"#D6409F"};function gx(){return"undefined"==typeof window?px:{red:PC("--sys-red")||px.red,orange:PC("--sys-orange")||px.orange,amber:PC("--sys-amber")||px.amber,yellow:PC("--sys-yellow")||px.yellow,brown:PC("--sys-brown")||px.brown,green:PC("--sys-green")||px.green,teal:PC("--sys-teal")||px.teal,cyan:PC("--sys-cyan")||px.cyan,blue:PC("--sys-blue")||px.blue,indigo:PC("--sys-indigo")||px.indigo,purple:PC("--sys-purple")||px.purple,pink:PC("--sys-pink")||px.pink}}function fx(){const e=s.useCallback(()=>"undefined"==typeof document||"light"!==document.documentElement.dataset.mode,[]),[t,n]=s.useState(e);return s.useEffect(()=>(n(e()),MC.subscribe(()=>n(e()))),[e]),t}function yx(){return"undefined"==typeof document||"light"!==document.documentElement.dataset.mode}let bx=null,vx=0;function wx(){const e=performance.now();if(bx&&e-vx<1e3)return bx;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 bx={fontFamily:n,textPrimary:s,textSecondary:r,gridColor:o},vx=e,bx}function Cx(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 xx=null,kx=0;function Ax(e,t){return"airtime"===t?`${e}%`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${e}`}function Dx(e,t,n,a,s,r,o,i,l,c,u,d=.9,h=!1){if(0===t.length)return;const m=t[0].timestamp,p=t[t.length-1].timestamp-m||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{l.current=e,c.current=t,u.current=n,d.current=a}),s.useEffect(()=>{h.current=wx()},[]);const p=s.useMemo(()=>0===e.length?[[0],[0]]:[e.map(e=>e.timestamp),e.map(()=>1)],[e]),g=s.useMemo(()=>({hooks:{draw:e=>{const t=h.current||wx();!function(e,t,n,a,s,r){if(0===t.length)return;const o=e.ctx,{left:i,top:l,width:c,height:u}=e.bbox,d=window.devicePixelRatio||1;if(c<=0||u<=0)return;const h=function(){const e=performance.now();return xx&&e-kx<1e3||(xx=gx(),kx=e),xx}(),m=Cx(h.blue),p=Cx(h.red),g=Cx(h.yellow),f=(y=n,"airtime"===a?y<=5?1:y<=10?2:y<=20?5:Math.ceil(y/5):y<=100?25:y<=500?100:y<=1e3?200:y<=5e3?1e3:y<=1e4?2e3:1e3*Math.ceil(y/5e3));var y;o.save(),o.strokeStyle=s.textSecondary,o.globalAlpha=.3,o.lineWidth=1*d,o.setLineDash([3*d,3*d]);for(let v=f;vn+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()))}(o,r,i,l,c,u,d,s),Dx(o,t,"rxSmooth",g,i,l,c,u,n,d,2,1,!0),Dx(o,t,"tx",p,i,l,c,u,n,d,2.5,.9,!1),Dx(o,t,"rx",m,i,l,c,u,n,d,2.5,.9,!1)}(e,l.current,u.current,c.current,t,m.current)}}}),[]),f=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:[g]}),[g]);s.useEffect(()=>{const t=o.current;if(!t||0===e.length)return;i.current&&i.current.destroy();const n=t.getBoundingClientRect(),a=Math.floor(n.width)||400,s=Math.floor(n.height)||200,r=new Ks({...f,width:a,height:s},p,t);return i.current=r,()=>{r.destroy(),i.current=null}},[f,p,e.length]),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()}},[]),s.useEffect(()=>{i.current&&i.current.redraw()},[e,n,t]);const y=s.useCallback(t=>{var n,a;const s=o.current,r=i.current;if(!s||!r||0===e.length)return;const l=s.getBoundingClientRect(),c=t.clientX-l.left,u=window.devicePixelRatio||1,h=r.bbox,p=h.left/u,g=h.width/u;if(cp+g)return m.current=null,r.redraw(),void(null==(n=d.current)||n.call(d,null));m.current=c*u;const f=(c-p)/g,y=Math.floor(f*e.length),b=Math.max(0,Math.min(e.length-1,y));r.redraw(),null==(a=d.current)||a.call(d,b)},[e.length]),b=s.useCallback(()=>{var e;m.current=null,i.current&&i.current.redraw(),null==(e=d.current)||e.call(d,null)},[]);return 0===e.length?r.jsx("div",{className:"h-full flex items-center justify-center text-text-muted",children:"No data available"}):r.jsx("div",{ref:o,className:"w-full h-full rounded-lg overflow-hidden",onMouseMove:y,onMouseLeave:b})}),Bx=[{name:"Dashboard",to:"/",icon:Jr},{name:"Contacts",to:"/contacts",icon:to},{name:"Packets",to:"/packets",icon:Zr},{name:"Room Server",to:"/room-server",icon:ao},{name:"Statistics",to:"/statistics",icon:qr},{name:"MeshGraph",to:"/meshgraph",icon:po},{name:"System",to:"/system",icon:Kr},{name:"Logs",to:"/logs",icon:Gr},{name:"Terminal",to:"/terminal",icon:mo},{name:"Configuration",to:"/configuration",icon:co}];function Fx(){var e,t,n,a,o,l;const{pathname:c}=E(),{stats:u,setMode:d,setDutyCycle:h,sendAdvert:m}=gv(),p=function(){const e=Dg();if(!e)return null;const t=Sg(e);return t&&t.sub?t.sub:null}(),g=pv(e=>e.prefetchForRoute),f=Tv(),y=pv(e=>e.packetCacheState.dataTier),b=Nv(),v=Math.max(1,Math.ceil(jb[b].minutes/60)),w=Kv(),C=vw(),x=Tw(),k=rw(e=>e.unreadCount);let A=null;try{A=function(){const e=s.useContext(Up);if(!e)throw new Error("useSidebar must be used within a SidebarLayout");return e}()}catch{}const[D,B]=s.useState(!1),[F,S]=s.useState("idle"),[M,j]=s.useState(null),[T,P]=s.useState([]),R=s.useRef(null),L=s.useCallback(e=>{e!==c&&(R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{g(e)},100))},[c,g]),N=s.useCallback(()=>{R.current&&(clearTimeout(R.current),R.current=null)},[]);s.useEffect(()=>{const e=async()=>{var e;try{const t=await Gg(v);t.success&&(null==(e=t.data)?void 0:e.history)&&P(t.data.history)}catch{}};e();const t=setInterval(e,6e4);return()=>clearInterval(t)},[v]);const z=null==u?void 0:u.noise_floor_dbm,_=(null==(t=null==(e=null==u?void 0:u.config)?void 0:e.repeater)?void 0:t.mode)??"forward",I=(null==(a=null==(n=null==u?void 0:u.config)?void 0:n.duty_cycle)?void 0:a.enforcement_enabled)??!1,V=(null==(l=null==(o=null==u?void 0:u.config)?void 0:o.duty_cycle)?void 0:l.max_airtime_percent)??10,O=f.isLoading||f.isBackgroundLoading||f.isTopologyLoading,$=O||w||C,q=f.loadProgress,U=()=>{null==A||A.close()};return r.jsxs(Np,{children:[r.jsxs(zp,{className:"px-5 py-6",children:[r.jsx("h1",{className:"sr-only",children:"pyMC Console"}),r.jsx(gg,{responsive:!0,className:"block"}),r.jsxs("p",{className:"type-data-xs text-text-muted mt-1.5",children:["v",mg]})]}),r.jsxs(_p,{className:"py-4",children:[r.jsx(Vp,{children:Bx.map(e=>{const t=c===e.to;return r.jsxs(Op,{href:e.to,current:t,onClick:U,onMouseEnter:()=>L(e.to),onMouseLeave:N,children:[r.jsxs("span",{className:"relative",children:[r.jsx(e.icon,{}),"/room-server"===e.to&&k>0&&r.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-accent-danger ring-2 ring-bg-body"})]}),r.jsx($p,{children:e.name}),"/contacts"===e.to&&x.length>0&&r.jsxs(qp,{variant:"accent",children:[r.jsx(Xr,{className:"w-3 h-3"}),r.jsx("span",{children:x.length})]}),"/meshgraph"===e.to&&r.jsx(qp,{variant:"default",children:"Beta"})]},e.name)})}),$&&r.jsx("div",{className:"px-0 py-3",children:r.jsx(Wv,{isLoading:O,borderRadius:12,children:r.jsxs("div",{className:"bg-glass-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-accent-primary opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-accent-primary"})]}),r.jsx("span",{className:"type-data-xs text-text-muted flex-1 truncate",children:f.isLoading&&q?"Loading 24h history...":f.isBackgroundLoading&&q?f.statusMessage||`Loading ${y} history...`:f.isTopologyLoading?"Loading topology data...":w?"Computing sparklines":C?"Building topology":"Analyzing database"}),null!==(null==q?void 0:q.percent)&&void 0!==(null==q?void 0:q.percent)&&O&&r.jsxs("span",{className:"type-data-xs text-text-muted tabular-nums",children:[q.percent,"%"]})]}),r.jsx("div",{className:"mt-1.5 h-1 bg-subtle-fill rounded-full overflow-hidden",children:null!==(null==q?void 0:q.percent)&&void 0!==(null==q?void 0:q.percent)&&O?r.jsx("div",{className:"h-full bg-accent-primary/60 rounded-full transition-all duration-300 ease-out",style:{width:`${q.percent}%`}}):r.jsx("div",{className:"h-full bg-accent-primary/40 rounded-full w-full"})}),!O&&r.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 px-1",children:[r.jsx("span",{className:"type-micro text-text-muted",children:"Data:"}),r.jsx("span",{className:"type-data-xs text-accent-primary",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}})(y)})]})]})})}),r.jsx("div",{className:"flex-1"}),r.jsx(ng,{label:"Controls",icon:r.jsx(ho,{className:"w-5 h-5 text-accent-primary"}),defaultOpen:!1,direction:"up",dataId:"controls",children:r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(Nr,{color:"success"===F?"success":"error"===F?"danger":"primary",onClick:async()=>{B(!0),S("idle"),j(null);const e=await m();B(!1),e.success?(S("success"),setTimeout(()=>S("idle"),1500)):(S("error"),j(e.error||"Failed to send"),setTimeout(()=>{S("idle"),j(null)},3e3))},disabled:D,className:"w-full justify-center",children:D?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"===F?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"===F?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(lo,{"data-slot":"icon"}),"Send Advert"]})}),M&&r.jsx("p",{className:"text-accent-danger text-xs text-center",children:M}),r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-xs text-text-muted",children:"Repeat"}),r.jsx("span",{className:i("text-xs font-medium","forward"===_?"text-accent-success":"text-accent-secondary"),children:"forward"===_?"ON":"OFF"})]}),r.jsx(Nr,{color:"forward"===_?"success":"warning",onClick:()=>{d("forward"===_?"monitor":"forward")},className:"w-full justify-center",children:"forward"===_?r.jsxs(r.Fragment,{children:[r.jsx(oo,{"data-slot":"icon"}),"Repeating"]}):r.jsxs(r.Fragment,{children:[r.jsx(ro,{"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-text-muted",children:"Duty Cycle"}),r.jsx("span",{className:i("text-xs font-medium tabular-nums",I?"text-accent-secondary":"text-text-muted"),children:I?`${V}%`:"OFF"})]}),r.jsxs(Nr,{color:I?"warning":"muted",onClick:()=>{h(!I)},className:"w-full justify-center",children:[r.jsx(Kr,{"data-slot":"icon"}),I?`Limited to ${V}%`:"Disabled"]})]})})]}),r.jsx(Ip,{children:r.jsxs("div",{className:"p-3 flex flex-col gap-1",children:[void 0!==(null==u?void 0:u.uptime_seconds)&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-2",children:[r.jsx(Hr,{className:"w-5 h-5 text-text-muted flex-shrink-0"}),r.jsxs("span",{className:"type-data-xs text-text-secondary tabular-nums",children:[_w(u.uptime_seconds)," uptime"]})]}),r.jsxs("div",{className:"flex items-center gap-3 px-3 pt-2 pb-0.5",children:[r.jsx(io,{className:"w-5 h-5 text-accent-primary flex-shrink-0"}),r.jsx("span",{className:"type-data-xs text-text-muted",children:"Noise Floor"}),r.jsx("span",{className:"ml-auto type-data text-text-primary tabular-nums",children:null!=z?`${z.toFixed(0)} dBm`:"—"})]}),T.length>0&&r.jsx("div",{className:"px-3 pt-1 pb-1",children:r.jsxs("div",{className:"relative rounded-sm border-x border-border-strong bg-transparent overflow-hidden py-2",children:[r.jsx("div",{className:"absolute inset-y-0 left-0 w-2 bg-gradient-to-r from-sys-amber/15 to-transparent pointer-events-none"}),r.jsx("div",{className:"absolute inset-y-0 right-0 w-2 bg-gradient-to-l from-sys-amber/15 to-transparent pointer-events-none"}),r.jsx(kC,{timestamps:T.map(e=>e.timestamp),values:T.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(qv,{showLabel:!0}),(null==u?void 0:u.version)&&r.jsxs("span",{className:"type-data-xs text-text-muted truncate",title:`v${u.version}`,children:["v",u.version]})]}),r.jsxs("button",{onClick:()=>{Bg(),window.location.href="/login"},className:"flex items-center gap-3 px-3 py-2 rounded-xl text-text-muted hover:text-accent-danger hover:bg-accent-danger/10 transition-all duration-150",children:[r.jsx(eo,{className:"w-5 h-5 flex-shrink-0"}),r.jsx("span",{className:"type-body-sm",children:"Sign Out"}),p&&r.jsxs("span",{className:"ml-auto type-data-xs",children:["(",p,")"]})]})]})})]})}function Sx(){const e=Tv(),t=e.isLoading||e.isBackgroundLoading||e.isTopologyLoading;return r.jsxs(Gp,{children:[r.jsxs(Kp,{children:[r.jsx("h1",{className:"sr-only",children:"pyMC Console"}),r.jsx(gg,{height:26,className:"block"}),t&&r.jsx(Hv,{className:"ml-2"})]}),r.jsx(Xp,{}),r.jsxs(Kp,{children:[r.jsxs("p",{className:"type-data-xs text-text-muted",children:["v",mg]}),r.jsx(qv,{})]})]})}const Mx=s.memo(function(){const{theme:e}=or(),{backgroundImage:t,brightness:n,colorScheme:a}=e,s=xe(a),o=(null==s?void 0:s.meta.backgroundImage)||null==s?void 0:s.meta.backgroundColor,i=(100-n)/100;return r.jsxs(r.Fragment,{children:[t?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(${t})`}})}):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"})]})}),jx=20,Tx=12,Px=s.createContext(null);function Rx({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+jx+e.width+Tx>r?n-jx-e.width:n+jx,l=Math.max(Tx,Math.min(l,r-e.width-Tx)),c=s-jx-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 Nx({label:e}){return r.jsx("div",{className:"min-h-[50vh]","aria-label":`Loading ${e}`,"aria-busy":"true"})}function zx(){return r.jsx(Nx,{label:"dashboard"})}function _x(){return r.jsx(Nx,{label:"list"})}function Ix(){return r.jsx(Nx,{label:"map"})}function Vx(){return r.jsx(Nx,{label:"charts"})}function Ox(){return r.jsx(Nx,{label:"settings"})}function $x(){return r.jsx(Nx,{label:"system"})}function qx({children:e}){return r.jsx(r.Fragment,{children:e})}const Ux=s.lazy(()=>C(()=>import("./Login-DbpkJTe5.js"),__vite__mapDeps([0,1,2,3,4]))),Wx=s.lazy(()=>C(()=>import("./Dashboard-BwRsG8HD.js"),__vite__mapDeps([5,1,6,7,8,9,2,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,3,27,28,29,30,31,4]))),Hx=s.lazy(()=>C(()=>import("./Packets-lSdRKAGr.js"),__vite__mapDeps([32,1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,9,2,33,6,34,29,3,4]))),Yx=s.lazy(()=>C(()=>import("./Contacts-CJ7zcVr1.js").then(e=>e.C),__vite__mapDeps([35,1,36,6,37,2,38,18,26,12,13,39,22,19,15,34,40,33,17,23,27,41,42,3,43,4]))),Gx=s.lazy(()=>C(()=>import("./Statistics-Dkaqbily.js"),__vite__mapDeps([44,1,45,20,46,8,9,2,6,19,15,41,42,3,18,17,29,21,47,38,27,22,31,48,43,4]))),Kx=s.lazy(()=>C(()=>import("./MeshGraph-Duci9p1U.js"),__vite__mapDeps([49,1,50,51,2,38,24,19,15,39,20,48,16,43,3,4]))),Xx=s.lazy(()=>C(()=>import("./System-DjGErvcK.js"),__vite__mapDeps([52,1,6,18,29,14,43,22,53,31,3,4]))),Jx=s.lazy(()=>C(()=>import("./Logs-ClX8uzox.js"),__vite__mapDeps([54,1,45,6,29,3,4]))),Zx=s.lazy(()=>C(()=>import("./Terminal-DYk9EjnC.js"),__vite__mapDeps([55,1,56,13,51,36,3,11,57,58,6,4,59]))),Qx=s.lazy(()=>C(()=>import("./Configuration-CoqoluHU.js"),__vite__mapDeps([60,1,57,40,18,61,28,6,19,15,29,47,31,62,23,53,16,3,4]))),ek=s.lazy(()=>C(()=>import("./RoomServer-bASTDJzO.js"),__vite__mapDeps([63,1,6,31,37,2,40,18,17,58,30,29,62,15,33,3,4])));function tk({children:e}){const t=E();return Fg()?r.jsx(r.Fragment,{children:e}):r.jsx(S,{to:"/login",state:{from:t},replace:!0})}class nk 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-accent-red mb-2",children:"Page failed to render"}),r.jsx("p",{className:"type-body text-text-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-accent-primary/20 text-accent-primary rounded-lg hover:bg-accent-primary/30 transition-colors",children:"Try Again"})]}):this.props.children}}function ak(){const e=pv(e=>e.initializeApp),t=Fg();return s.useEffect(()=>{if(!t)return;e(),Vf.getState().initialize(),rw.getState().initialize();const n=setInterval(()=>{Ng()},3e4);return Ng(),function(){if(zg)return;if("undefined"==typeof document)return;const e=async()=>{if("visible"!==document.visibilityState)return;if(!Dg())return;if(Mg())return Bg(),void("undefined"==typeof window||window.location.pathname.includes("/login")||(window.location.href="/login"));const e=jg();e>0&&e<300&&await Rg()};document.addEventListener("visibilitychange",e),zg=!0,"visible"===document.visibilityState&&e()}(),()=>clearInterval(n)},[e,t]),r.jsxs(Rx,{children:[r.jsx(Mx,{}),r.jsxs(B,{children:[r.jsx(F,{path:"/login",element:r.jsx(s.Suspense,{fallback:r.jsx("div",{className:"min-h-screen bg-bg-body"}),children:r.jsx(Ux,{})})}),r.jsx(F,{path:"/*",element:r.jsx(tk,{children:r.jsx(Yp,{sidebar:r.jsx(Fx,{}),navbar:r.jsx(Sx,{}),children:r.jsx("div",{className:"px-4 sm:px-6 lg:px-8 pt-5 pb-4 sm:pb-6 lg:pb-8 max-w-7xl mx-auto",children:r.jsx(nk,{children:r.jsxs(B,{children:[r.jsx(F,{path:"/",element:r.jsx(s.Suspense,{fallback:r.jsx(zx,{}),children:r.jsx(qx,{children:r.jsx(Wx,{})})})}),r.jsx(F,{path:"/packets",element:r.jsx(s.Suspense,{fallback:r.jsx(_x,{}),children:r.jsx(qx,{children:r.jsx(Hx,{})})})}),r.jsx(F,{path:"/contacts",element:r.jsx(s.Suspense,{fallback:r.jsx(Ix,{}),children:r.jsx(qx,{children:r.jsx(Yx,{})})})}),r.jsx(F,{path:"/statistics",element:r.jsx(s.Suspense,{fallback:r.jsx(Vx,{}),children:r.jsx(qx,{children:r.jsx(Gx,{})})})}),r.jsx(F,{path:"/meshgraph",element:r.jsx(s.Suspense,{fallback:r.jsx(Vx,{}),children:r.jsx(qx,{children:r.jsx(Kx,{})})})}),r.jsx(F,{path:"/system",element:r.jsx(s.Suspense,{fallback:r.jsx($x,{}),children:r.jsx(qx,{children:r.jsx(Xx,{})})})}),r.jsx(F,{path:"/logs",element:r.jsx(s.Suspense,{fallback:r.jsx(_x,{}),children:r.jsx(qx,{children:r.jsx(Jx,{})})})}),r.jsx(F,{path:"/terminal",element:r.jsx(s.Suspense,{fallback:r.jsx(_x,{}),children:r.jsx(qx,{children:r.jsx(Zx,{})})})}),r.jsx(F,{path:"/room-server",element:r.jsx(s.Suspense,{fallback:r.jsx(_x,{}),children:r.jsx(qx,{children:r.jsx(ek,{})})})}),r.jsx(F,{path:"/configuration",element:r.jsx(s.Suspense,{fallback:r.jsx(Ox,{}),children:r.jsx(qx,{children:r.jsx(Qx,{})})})})]})})})})})})]})]})}const sk=console.warn;console.warn=(...e)=>{const t=e[0];"string"==typeof t&&t.includes("Unable to load glyph range")||sk.apply(console,e)},k.createRoot(document.getElementById("root")).render(r.jsx(s.StrictMode,{children:r.jsx(rr,{children:r.jsx(M,{children:r.jsx(ak,{})})})}));export{cr as $,om as A,Nr as B,hg as C,jb as D,hy as E,Mb as F,Iw as G,zv as H,ig as I,$f as J,jp as K,qv as L,so as M,Rp as N,Wr as O,gg as P,Qr as Q,io as R,aC as S,Lx as T,sC as U,yv as V,Iv as W,Tv as X,Jg as Y,qr as Z,lr as _,Ks as a,Lb as a$,go as a0,Wc as a1,Nc as a2,yo as a3,vo as a4,My as a5,jy as a6,Ty as a7,Dr as a8,qw as a9,gv as aA,jv as aB,fw as aC,yw as aD,_v as aE,Gv as aF,Kv as aG,Vv as aH,gx as aI,qg as aJ,Ug as aK,Ex as aL,vr as aM,SC as aN,tr as aO,hx as aP,KC as aQ,YC as aR,GC as aS,fx as aT,Nb as aU,Bw as aV,Sw as aW,Tw as aX,po as aY,Zg as aZ,Tb as a_,Cr as aa,xr as ab,Jb as ac,Dp as ad,cm as ae,my as af,Ow as ag,Hr as ah,Cb as ai,lo as aj,ux as ak,mx as al,Dw as am,bw as an,Mw as ao,Eb as ap,jr as aq,Yw as ar,$w as as,ur as at,Jp as au,Ew as av,jw as aw,Xr as ax,Hw as ay,Fw as az,Qw as b,eb as b$,kC as b0,Yb as b1,ao as b2,mg as b3,Xb as b4,dr as b5,gw as b6,Pw as b7,zw as b8,Rw as b9,rf as bA,sf as bB,Py as bC,lf as bD,cf as bE,_g as bF,Pp as bG,Of as bH,Vf as bI,mo as bJ,qf as bK,Zf as bL,Uf as bM,Wf as bN,Hf as bO,Yf as bP,Fy as bQ,Ey as bR,By as bS,ob as bT,Ry as bU,Ly as bV,py as bW,ab as bX,yy as bY,Ny as bZ,rb as b_,ro as ba,oo as bb,Vw as bc,rg as bd,yx as be,Yr as bf,zb as bg,Ev as bh,Bv as bi,Fv as bj,Sv as bk,Dv as bl,_w as bm,tf as bn,wv as bo,Cv as bp,kv as bq,Av as br,Gr as bs,Ib as bt,MC as bu,Hg as bv,ef as bw,af as bx,nf as by,of as bz,$r as c,Eu as c$,tb as c0,nb as c1,gy as c2,by as c3,fy as c4,sb as c5,Sy as c6,ky as c7,Ay as c8,vb as c9,Ww as cA,sg as cB,lg as cC,Lp as cD,rw as cE,ow as cF,iw as cG,hw as cH,mw as cI,lw as cJ,cw as cK,uw as cL,dw as cM,dx as cN,jC as cO,ex as cP,sx as cQ,JC as cR,cx as cS,Cf as cT,Kb as cU,Zv as cV,Rv as cW,Tf as cX,_o as cY,Jo as cZ,Vu as c_,wb as ca,dy as cb,uy as cc,oy as cd,ey as ce,Qf as cf,cy as cg,ry as ch,sy as ci,ty as cj,ly as ck,iy as cl,ny as cm,ay as cn,xy as co,Cy as cp,wy as cq,vy as cr,Dy as cs,Og as ct,or as cu,Pe as cv,_f as cw,co as cx,ho as cy,Uw as cz,Rb as d,ym as d0,Xh as d1,Tc as d2,iu as d3,Yi as d4,xo as d5,zc as d6,kl as d7,cl as d8,xl as d9,cc as da,Ro as db,To as dc,ku as dd,Au as de,Ad as df,fd as dg,Mu as dh,uh as di,qc as dj,wl as dk,md as dl,am as dm,Ko as dn,ph as dp,vw as dq,ww as dr,Wv as ds,Mr as e,Ur as f,xg as g,bv as h,Fg as i,vv as j,xv as k,Pg as l,wp as m,fv as n,Pv as o,Mv as p,Nv as q,Gg as r,kg as s,Lv as t,ix as u,Gb as v,Db as w,Sb as x,Bb as y,Fb as z}; diff --git a/frontend/dist/assets/index-CGYcizrv.js b/frontend/dist/assets/index-Ch_XDzqB.js similarity index 99% rename from frontend/dist/assets/index-CGYcizrv.js rename to frontend/dist/assets/index-Ch_XDzqB.js index 2b9b77eb..fe7e9c14 100644 --- a/frontend/dist/assets/index-CGYcizrv.js +++ b/frontend/dist/assets/index-Ch_XDzqB.js @@ -1 +1 @@ -import{r as t,j as e}from"./vendor-react-j_fHog8x.js";import{cZ as n,c_ as r,c$ as a,d0 as s,d1 as i,a3 as o,d2 as l,d3 as u,d4 as c,d5 as f,d6 as p,d7 as d,d8 as y,d9 as h,da as m,db as g,dc as x,dd as v,de as j,df as b,dg as w,dh as k,di as A,dj as $,dk as M,m as D,dl as S,dm as C,A as R,ae as I,dn as E,dp as F}from"./index-CImKXCRQ.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 L({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 V(t){return"object"==typeof t&&!Array.isArray(t)}function B(t,e,n,r){return null==t?[]:"string"==typeof t&&V(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,U=t=>t.every(Q);function Y(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&&!V(e)}(t,e))a.push(A(t,V(e)&&e.default||e,n&&n.default||n));else{if(null==t)return a;const s=B(t,e,r),i=s.length;for(let t=0;t{const l=q(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 M="function"==typeof u?u(i,o):u,D=l.length,S=m(p)?p:null==a?void 0:a[p||"keyframes"];if(D<=2&&S){let t=100;if(2===D&&U(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+M;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(_);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(D.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(D.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(D.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(D.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(D.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(L,{transition:s,children:e.jsx(D.div,{...c,ref:f,layout:!0,layoutDependency:j,style:{lineHeight:1,...o,display:"inline-flex",isolation:"isolate",whiteSpace:"nowrap"},children:e.jsxs(D.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}D.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),M=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=()=>{M.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=M.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(D.span,{className:h,style:m,children:A}),e.jsx(D.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{cZ as n,c_ as r,c$ as a,d0 as s,d1 as i,a3 as o,d2 as l,d3 as u,d4 as c,d5 as f,d6 as p,d7 as d,d8 as y,d9 as h,da as m,db as g,dc as x,dd as v,de as j,df as b,dg as w,dh as k,di as A,dj as $,dk as M,m as D,dl as S,dm as C,A as R,ae as I,dn as E,dp as F}from"./index-B51aMfiH.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 L({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 V(t){return"object"==typeof t&&!Array.isArray(t)}function B(t,e,n,r){return null==t?[]:"string"==typeof t&&V(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,U=t=>t.every(Q);function Y(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&&!V(e)}(t,e))a.push(A(t,V(e)&&e.default||e,n&&n.default||n));else{if(null==t)return a;const s=B(t,e,r),i=s.length;for(let t=0;t{const l=q(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 M="function"==typeof u?u(i,o):u,D=l.length,S=m(p)?p:null==a?void 0:a[p||"keyframes"];if(D<=2&&S){let t=100;if(2===D&&U(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+M;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(_);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(D.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(D.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(D.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(D.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(D.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(L,{transition:s,children:e.jsx(D.div,{...c,ref:f,layout:!0,layoutDependency:j,style:{lineHeight:1,...o,display:"inline-flex",isolation:"isolate",whiteSpace:"nowrap"},children:e.jsxs(D.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}D.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),M=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=()=>{M.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=M.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(D.span,{className:h,style:m,children:A}),e.jsx(D.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/info-CBhRp85T.js b/frontend/dist/assets/info-DFWt9Iwg.js similarity index 68% rename from frontend/dist/assets/info-CBhRp85T.js rename to frontend/dist/assets/info-DFWt9Iwg.js index b0a243fe..9aa4eb55 100644 --- a/frontend/dist/assets/info-CBhRp85T.js +++ b/frontend/dist/assets/info-DFWt9Iwg.js @@ -1 +1 @@ -import{c as e}from"./index-CImKXCRQ.js";const c=e("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);export{c as I}; +import{c as e}from"./index-B51aMfiH.js";const c=e("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);export{c as I}; diff --git a/frontend/dist/assets/key-round-D-rRp0r8.js b/frontend/dist/assets/key-round-DyppBhTK.js similarity index 81% rename from frontend/dist/assets/key-round-D-rRp0r8.js rename to frontend/dist/assets/key-round-DyppBhTK.js index 0df17db7..c6c06328 100644 --- a/frontend/dist/assets/key-round-D-rRp0r8.js +++ b/frontend/dist/assets/key-round-DyppBhTK.js @@ -1 +1 @@ -import{c as a}from"./index-CImKXCRQ.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-B51aMfiH.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-CTDI7uhn.js b/frontend/dist/assets/layers-Dd_4LhZ4.js similarity index 84% rename from frontend/dist/assets/layers-CTDI7uhn.js rename to frontend/dist/assets/layers-Dd_4LhZ4.js index 6f2335d1..7ec98ef7 100644 --- a/frontend/dist/assets/layers-CTDI7uhn.js +++ b/frontend/dist/assets/layers-Dd_4LhZ4.js @@ -1 +1 @@ -import{c as a}from"./index-CImKXCRQ.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-B51aMfiH.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-B0M8cDnn.js b/frontend/dist/assets/link-scoring-DtQvFOcN.js similarity index 96% rename from frontend/dist/assets/link-scoring-B0M8cDnn.js rename to frontend/dist/assets/link-scoring-DtQvFOcN.js index 7e38f6e1..ae85e6b2 100644 --- a/frontend/dist/assets/link-scoring-B0M8cDnn.js +++ b/frontend/dist/assets/link-scoring-DtQvFOcN.js @@ -1 +1 @@ -import{c as t,v as e,b5 as n}from"./index-CImKXCRQ.js";const o=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"}]]),a=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"}]]);function s(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(t,o,a){const r=new Map;for(const n of o){const t=e(n);r.has(t)||r.set(t,n)}const c=new Map,h=new Map;for(const e of t){const t=e.route??e.route_type;if(!n(t))continue;const o=s(e.original_path);if(0===o.length)continue;const i=o.map(t=>t.toUpperCase());if(!e.transmitted&&i.length>=2){const t=i[i.length-2];if(t){const e=r.get(t);e&&h.set(e,(h.get(e)??0)+1)}}if(i.includes(a))for(const e of i){if(e===a)continue;const t=r.get(e);t&&c.set(t,(c.get(t)??0)+1)}}let i=0,f=0;for(const e of o)i=Math.max(i,c.get(e)??0),f=Math.max(f,h.get(e)??0);const p=new Map;let u=0,d=0,m=0;for(const e of o){const t=c.get(e)??0,n=h.get(e)??0,o=i>0?Math.round(t/i*100):0,a=f>0?Math.round(n/f*100):0,s=o+a;p.set(e,{hash:e,listenerCount:t,loudCount:n,listenerScore:o,loudScore:a,blendedScore:s}),u=Math.max(u,o),d=Math.max(d,a),m=Math.max(m,s)}return{scores:p,maxListenerScore:u,maxLoudScore:d,maxBlendedScore:m}}const c={YELLOW:"#FFB224",GREEN:"#46A758",RED:"#E5484D",GRAY:"#505050"};export{c as L,o as M,a as S,r as c}; +import{c as t,v as e,b5 as n}from"./index-B51aMfiH.js";const o=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"}]]),a=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"}]]);function s(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(t,o,a){const r=new Map;for(const n of o){const t=e(n);r.has(t)||r.set(t,n)}const c=new Map,h=new Map;for(const e of t){const t=e.route??e.route_type;if(!n(t))continue;const o=s(e.original_path);if(0===o.length)continue;const i=o.map(t=>t.toUpperCase());if(!e.transmitted&&i.length>=2){const t=i[i.length-2];if(t){const e=r.get(t);e&&h.set(e,(h.get(e)??0)+1)}}if(i.includes(a))for(const e of i){if(e===a)continue;const t=r.get(e);t&&c.set(t,(c.get(t)??0)+1)}}let i=0,f=0;for(const e of o)i=Math.max(i,c.get(e)??0),f=Math.max(f,h.get(e)??0);const p=new Map;let u=0,d=0,m=0;for(const e of o){const t=c.get(e)??0,n=h.get(e)??0,o=i>0?Math.round(t/i*100):0,a=f>0?Math.round(n/f*100):0,s=o+a;p.set(e,{hash:e,listenerCount:t,loudCount:n,listenerScore:o,loudScore:a,blendedScore:s}),u=Math.max(u,o),d=Math.max(d,a),m=Math.max(m,s)}return{scores:p,maxListenerScore:u,maxLoudScore:d,maxBlendedScore:m}}const c={YELLOW:"#FFB224",GREEN:"#46A758",RED:"#E5484D",GRAY:"#505050"};export{c as L,o as M,a as S,r as c}; diff --git a/frontend/dist/assets/listbox-DnYSFKvT.js b/frontend/dist/assets/listbox-D8VLFZST.js similarity index 96% rename from frontend/dist/assets/listbox-DnYSFKvT.js rename to frontend/dist/assets/listbox-D8VLFZST.js index 1dd68513..406cb4a9 100644 --- a/frontend/dist/assets/listbox-DnYSFKvT.js +++ b/frontend/dist/assets/listbox-D8VLFZST.js @@ -1 +1 @@ -import{j as e,l as a,c as s,n as t,o as r,p as n,I as l,r as i}from"./vendor-react-j_fHog8x.js";import{t as o}from"./config-CTM8_93T.js";import{O as c,A as d,m,f as x}from"./index-CImKXCRQ.js";function p({value:l,onChange:i,className:x,placeholder:p,disabled:u,"aria-label":h,children:b}){return e.jsx(a,{value:l,onChange:i,disabled:u,children:({open:a})=>e.jsxs("div",{className:s("relative",x),children:[e.jsxs(t,{"aria-label":h,className:s(["relative flex w-full items-center justify-between gap-2","radius-inner px-3 py-2","text-left text-sm text-text-primary","bg-bg-subtle border-control","ring-focus-inset","hover:border-border-strong","disabled:opacity-40 disabled:pointer-events-none disabled:cursor-not-allowed","transition-colors"]),children:[e.jsx(r,{as:"span",options:b,placeholder:p&&e.jsx("span",{className:"text-text-muted",children:p}),className:"block truncate"}),e.jsx(c,{className:s("w-4 h-4 text-text-muted transition-transform duration-200",a&&"rotate-180")})]}),e.jsx(d,{children:a&&e.jsx(m.div,{initial:{opacity:0,y:-4,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.98},transition:o.dropdown,className:"absolute z-50 mt-1",children:e.jsx(n,{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:b})})})]})})}function u({value:a,disabled:t,className:r,children:n}){return e.jsx(l,{as:i.Fragment,value:a,disabled:t,children:({selected:a,focus:l})=>e.jsxs("div",{className:s("flex items-center gap-2 px-3 py-2 radius-control cursor-default","text-sm",l&&"bg-accent-primary text-white",!l&&"text-text-primary",a&&!l&&"text-accent-primary",t&&"opacity-50 cursor-not-allowed",r),children:[e.jsx("span",{className:"w-4 flex-shrink-0",children:a&&e.jsx(x,{className:"w-4 h-4"})}),e.jsx("span",{className:"truncate",children:n})]})})}function h({className:a,...t}){return e.jsx("span",{...t,className:s("truncate",a)})}export{p as L,u as a,h as b}; +import{j as e,l as a,c as s,n as t,o as r,p as n,I as l,r as i}from"./vendor-react-j_fHog8x.js";import{t as o}from"./config-CTM8_93T.js";import{O as c,A as d,m,f as x}from"./index-B51aMfiH.js";function p({value:l,onChange:i,className:x,placeholder:p,disabled:u,"aria-label":h,children:b}){return e.jsx(a,{value:l,onChange:i,disabled:u,children:({open:a})=>e.jsxs("div",{className:s("relative",x),children:[e.jsxs(t,{"aria-label":h,className:s(["relative flex w-full items-center justify-between gap-2","radius-inner px-3 py-2","text-left text-sm text-text-primary","bg-bg-subtle border-control","ring-focus-inset","hover:border-border-strong","disabled:opacity-40 disabled:pointer-events-none disabled:cursor-not-allowed","transition-colors"]),children:[e.jsx(r,{as:"span",options:b,placeholder:p&&e.jsx("span",{className:"text-text-muted",children:p}),className:"block truncate"}),e.jsx(c,{className:s("w-4 h-4 text-text-muted transition-transform duration-200",a&&"rotate-180")})]}),e.jsx(d,{children:a&&e.jsx(m.div,{initial:{opacity:0,y:-4,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.98},transition:o.dropdown,className:"absolute z-50 mt-1",children:e.jsx(n,{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:b})})})]})})}function u({value:a,disabled:t,className:r,children:n}){return e.jsx(l,{as:i.Fragment,value:a,disabled:t,children:({selected:a,focus:l})=>e.jsxs("div",{className:s("flex items-center gap-2 px-3 py-2 radius-control cursor-default","text-sm",l&&"bg-accent-primary text-white",!l&&"text-text-primary",a&&!l&&"text-accent-primary",t&&"opacity-50 cursor-not-allowed",r),children:[e.jsx("span",{className:"w-4 flex-shrink-0",children:a&&e.jsx(x,{className:"w-4 h-4"})}),e.jsx("span",{className:"truncate",children:n})]})})}function h({className:a,...t}){return e.jsx("span",{...t,className:s("truncate",a)})}export{p as L,u as a,h as b}; diff --git a/frontend/dist/assets/map-pin-lRKxIpXD.js b/frontend/dist/assets/map-pin-C3ieg9t_.js similarity index 74% rename from frontend/dist/assets/map-pin-lRKxIpXD.js rename to frontend/dist/assets/map-pin-C3ieg9t_.js index 9eb532de..28e1ef94 100644 --- a/frontend/dist/assets/map-pin-lRKxIpXD.js +++ b/frontend/dist/assets/map-pin-C3ieg9t_.js @@ -1 +1 @@ -import{c}from"./index-CImKXCRQ.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-B51aMfiH.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/network-CY6CQ8MF.js b/frontend/dist/assets/network-D76gOy_X.js similarity index 83% rename from frontend/dist/assets/network-CY6CQ8MF.js rename to frontend/dist/assets/network-D76gOy_X.js index 507f57de..4a799b05 100644 --- a/frontend/dist/assets/network-CY6CQ8MF.js +++ b/frontend/dist/assets/network-D76gOy_X.js @@ -1 +1 @@ -import{c as e}from"./index-CImKXCRQ.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-B51aMfiH.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/payload-decoders-BbTIgSA8.js b/frontend/dist/assets/payload-decoders-ClAu_OX0.js similarity index 98% rename from frontend/dist/assets/payload-decoders-BbTIgSA8.js rename to frontend/dist/assets/payload-decoders-ClAu_OX0.js index 81aefb56..dd74fec3 100644 --- a/frontend/dist/assets/payload-decoders-BbTIgSA8.js +++ b/frontend/dist/assets/payload-decoders-ClAu_OX0.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{a7 as a,bK as s,bL as r,bM as n,bN as h,af as i,bO as o,bP as p,bQ as c,bR as l,bS as u,bT as d,bU as y,bC as g,bV as f,bW as m,bX as x,bY as T,bZ as b,b_ as C,b$ as H,c0 as w,c1 as S,c2 as L,c3 as N,c4 as A,c5 as $,c6 as _,c7 as U,c8 as F,c9 as V,ca as D,cb as k,cc as v,cd as P,ce as j,cf as B,cg as E,ch as O,ci as K,cj as M,ck as R,cl as I,cm as W,cn as q,co as Q,cp as X,cq as Y,cr as Z,cs as z}from"./index-CImKXCRQ.js";class G{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 G;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 G.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>>o&p}hasTransportCodes(){return c(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+N+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),b(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()&&(C(this.transportCodes[0],e,a),C(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 H(this.payloadType,this.pathLen,this.payload)}async calculateHashString(t){return w(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 J(t){const e=L+N+A+1;if(t.lengtha&&(p.name=(new TextDecoder).decode(t.slice(a,e)))}return p}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}}async function et(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 V(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 D(e);n.isPublicHashChannel=t.length>0}}catch{}return 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_data",channelHash:a,dataHex:g(r),dataLength:r.length,decrypted:!1,macHex:g(s)};try{const t=await V(e,s,r);t&&(n.channelName=t.channelName,n.decrypted=!0,n.decryptedHex=g(t.plaintext))}catch{}return n}function st(t,e,a){return{type:"generic",payloadType:e,payloadTypeName:a,rawHex:g(t),length:t.length}}function rt(t){const{payload:e,payloadType:a,payloadTypeName:s}=t;switch(a){case q:return J(e)??st(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)??st(e,a,s);case I: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)??st(e,a,s);case R:return tt(e,t.path)??st(e,a,s);case M:return function(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}}(e)??st(e,a,s);case K: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)??st(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)??st(e,a,s);case E: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)??st(e,a,s);default:return st(e,a,s)}}export{G as P,tt as a,et as b,at as c,rt as d,J as e}; +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{a7 as a,bK as s,bL as r,bM as n,bN as h,af as i,bO as o,bP as p,bQ as c,bR as l,bS as u,bT as d,bU as y,bC as g,bV as f,bW as m,bX as x,bY as T,bZ as b,b_ as C,b$ as H,c0 as w,c1 as S,c2 as L,c3 as N,c4 as A,c5 as $,c6 as _,c7 as U,c8 as F,c9 as V,ca as D,cb as k,cc as v,cd as P,ce as j,cf as B,cg as E,ch as O,ci as K,cj as M,ck as R,cl as I,cm as W,cn as q,co as Q,cp as X,cq as Y,cr as Z,cs as z}from"./index-B51aMfiH.js";class G{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 G;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 G.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>>o&p}hasTransportCodes(){return c(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+N+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),b(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()&&(C(this.transportCodes[0],e,a),C(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 H(this.payloadType,this.pathLen,this.payload)}async calculateHashString(t){return w(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 J(t){const e=L+N+A+1;if(t.lengtha&&(p.name=(new TextDecoder).decode(t.slice(a,e)))}return p}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}}async function et(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 V(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 D(e);n.isPublicHashChannel=t.length>0}}catch{}return 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_data",channelHash:a,dataHex:g(r),dataLength:r.length,decrypted:!1,macHex:g(s)};try{const t=await V(e,s,r);t&&(n.channelName=t.channelName,n.decrypted=!0,n.decryptedHex=g(t.plaintext))}catch{}return n}function st(t,e,a){return{type:"generic",payloadType:e,payloadTypeName:a,rawHex:g(t),length:t.length}}function rt(t){const{payload:e,payloadType:a,payloadTypeName:s}=t;switch(a){case q:return J(e)??st(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)??st(e,a,s);case I: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)??st(e,a,s);case R:return tt(e,t.path)??st(e,a,s);case M:return function(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}}(e)??st(e,a,s);case K: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)??st(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)??st(e,a,s);case E: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)??st(e,a,s);default:return st(e,a,s)}}export{G as P,tt as a,et as b,at as c,rt as d,J as e}; diff --git a/frontend/dist/assets/ping-C1JzD5-V.js b/frontend/dist/assets/ping-DLWlYTPp.js similarity index 94% rename from frontend/dist/assets/ping-C1JzD5-V.js rename to frontend/dist/assets/ping-DLWlYTPp.js index 48f30072..754e9dd5 100644 --- a/frontend/dist/assets/ping-C1JzD5-V.js +++ b/frontend/dist/assets/ping-DLWlYTPp.js @@ -1 +1 @@ -import{ct as t}from"./index-CImKXCRQ.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{ct as t}from"./index-B51aMfiH.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-DElcO6pC.js b/frontend/dist/assets/refresh-cw-BcvCKflD.js similarity index 79% rename from frontend/dist/assets/refresh-cw-DElcO6pC.js rename to frontend/dist/assets/refresh-cw-BcvCKflD.js index 2afdf27c..14955280 100644 --- a/frontend/dist/assets/refresh-cw-DElcO6pC.js +++ b/frontend/dist/assets/refresh-cw-BcvCKflD.js @@ -1 +1 @@ -import{c as a}from"./index-CImKXCRQ.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-B51aMfiH.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-DJfT3Jo2.js b/frontend/dist/assets/route-BTnuOvzt.js similarity index 86% rename from frontend/dist/assets/route-DJfT3Jo2.js rename to frontend/dist/assets/route-BTnuOvzt.js index 04c4b416..7471e189 100644 --- a/frontend/dist/assets/route-DJfT3Jo2.js +++ b/frontend/dist/assets/route-BTnuOvzt.js @@ -1 +1 @@ -import{c as y}from"./index-CImKXCRQ.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-B51aMfiH.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/settings-2-C32u1U6g.js b/frontend/dist/assets/settings-2-B0bBfCqU.js similarity index 73% rename from frontend/dist/assets/settings-2-C32u1U6g.js rename to frontend/dist/assets/settings-2-B0bBfCqU.js index ac62b84e..1584fb6b 100644 --- a/frontend/dist/assets/settings-2-C32u1U6g.js +++ b/frontend/dist/assets/settings-2-B0bBfCqU.js @@ -1 +1 @@ -import{c}from"./index-CImKXCRQ.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-B51aMfiH.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/system-nunPUnlB.js b/frontend/dist/assets/system-BlyXhV8d.js similarity index 90% rename from frontend/dist/assets/system-nunPUnlB.js rename to frontend/dist/assets/system-BlyXhV8d.js index 183811eb..203cd166 100644 --- a/frontend/dist/assets/system-nunPUnlB.js +++ b/frontend/dist/assets/system-BlyXhV8d.js @@ -1 +1 @@ -import{ct as n}from"./index-CImKXCRQ.js";async function t(){return n("/api/transport_keys")}async function o(t){return n("/api/transport_keys",{method:"POST",body:JSON.stringify(t)})}async function a(t,o){return n(`/api/transport_key/${t}`,{method:"PUT",body:JSON.stringify(o)})}async function r(t){return n(`/api/transport_key/${t}`,{method:"DELETE"})}async function s(t){return n("/api/global_flood_policy",{method:"POST",body:JSON.stringify({global_flood_allow:t})})}async function i(t){return n("/api/restart_service",{method:"POST",body:"{}",signal:t})}async function e(){return n("/api/check_pymc_console")}export{o as a,e as c,r as d,t as g,i as r,s,a as u}; +import{ct as n}from"./index-B51aMfiH.js";async function t(){return n("/api/transport_keys")}async function o(t){return n("/api/transport_keys",{method:"POST",body:JSON.stringify(t)})}async function a(t,o){return n(`/api/transport_key/${t}`,{method:"PUT",body:JSON.stringify(o)})}async function r(t){return n(`/api/transport_key/${t}`,{method:"DELETE"})}async function s(t){return n("/api/global_flood_policy",{method:"POST",body:JSON.stringify({global_flood_allow:t})})}async function i(t){return n("/api/restart_service",{method:"POST",body:"{}",signal:t})}async function e(){return n("/api/check_pymc_console")}export{o as a,e as c,r as d,t as g,i as r,s,a as u}; diff --git a/frontend/dist/assets/target-BLCR6B60.js b/frontend/dist/assets/target-CE6nI9QD.js similarity index 92% rename from frontend/dist/assets/target-BLCR6B60.js rename to frontend/dist/assets/target-CE6nI9QD.js index 6787d54c..7b885374 100644 --- a/frontend/dist/assets/target-BLCR6B60.js +++ b/frontend/dist/assets/target-CE6nI9QD.js @@ -1 +1 @@ -import{c}from"./index-CImKXCRQ.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("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),r=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"}]]),y=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,r as S,y as T,a}; +import{c}from"./index-B51aMfiH.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("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),r=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"}]]),y=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,r as S,y as T,a}; diff --git a/frontend/dist/assets/trending-up-BBUOgjQN.js b/frontend/dist/assets/trending-up-CsysmbvI.js similarity index 86% rename from frontend/dist/assets/trending-up-BBUOgjQN.js rename to frontend/dist/assets/trending-up-CsysmbvI.js index 705267c8..f0ca2a0c 100644 --- a/frontend/dist/assets/trending-up-BBUOgjQN.js +++ b/frontend/dist/assets/trending-up-CsysmbvI.js @@ -1 +1 @@ -import{c as a}from"./index-CImKXCRQ.js";const t=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"}]]),e=a("trending-down",[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]]),p=a("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);export{t as M,p as T,e as a}; +import{c as a}from"./index-B51aMfiH.js";const t=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"}]]),e=a("trending-down",[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]]),p=a("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);export{t as M,p as T,e as a}; diff --git a/frontend/dist/assets/triangle-alert-DRA45BSe.js b/frontend/dist/assets/triangle-alert-JpcXY4mr.js similarity index 75% rename from frontend/dist/assets/triangle-alert-DRA45BSe.js rename to frontend/dist/assets/triangle-alert-JpcXY4mr.js index f5121e57..90a144b3 100644 --- a/frontend/dist/assets/triangle-alert-DRA45BSe.js +++ b/frontend/dist/assets/triangle-alert-JpcXY4mr.js @@ -1 +1 @@ -import{c as a}from"./index-CImKXCRQ.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-B51aMfiH.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-BZZVk2mu.js b/frontend/dist/assets/users-cobitl86.js similarity index 78% rename from frontend/dist/assets/users-BZZVk2mu.js rename to frontend/dist/assets/users-cobitl86.js index 0036bdb5..4f5ae7a3 100644 --- a/frontend/dist/assets/users-BZZVk2mu.js +++ b/frontend/dist/assets/users-cobitl86.js @@ -1 +1 @@ -import{c as a}from"./index-CImKXCRQ.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-B51aMfiH.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/index.html b/frontend/dist/index.html index f542cb29..73f0e3a6 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 46fb4e69..2cc9381e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "pymc_console", - "version": "0.9.232", + "version": "0.9.233", "description": "Vite + React Dashboard for pyMC_Repeater", "private": true, "type": "module",