const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PathMapMapLibre-D2KjWch9.js","assets/index-C4inJ1rU.js","assets/layer-D6BnwDKL.js","assets/BasemapLayer-zAPrA2Lm.js","assets/car-MLbhYELo.js","assets/useMapViewStore-MJt-JUde.js","assets/index-BXWmGYBj.js","assets/index-CLVX1WuQ.js","assets/index-DuWodFP7.css","assets/maplibre-gl-B1CfjdFi.css"])))=>i.map(i=>d[i]);
import{e as Be,bL as lt,bM as Bs,v as it,p as ct,j as e,c as F,B as rs,w as ot,r as u,a5 as ls,$ as B,aq as Se,bN as dt,bO as Ms,bP as Ls,bQ as Rs,R as me,bR as Hs,bS as Fs,bT as Ds,bU as xt,bV as pe,bW as Ze,bX as mt,bY as Je,_ as ht,bZ as ut,b_ as pt,b$ as ft,c0 as gt,c1 as yt,c2 as jt,m as xe,c3 as oe,a7 as bt,a4 as Nt,c4 as Z,c5 as vt,c6 as de,c7 as wt,c8 as kt,c9 as us,ca as Ct,cb as _t,cc as St,cd as Tt,ce as Pt,cf as Bt,cg as Mt,ch as es,ci as Lt,cj as Rt,aa as As,ck as Ht,cl as Ft,cm as Dt,cn as At,ay as zs,az as Es,d as Ke,co as zt,aB as Et,cp as It,cq as is,cr as $t}from"./index-C4inJ1rU.js";import{C as Ut,u as Ot}from"./chevron-up-DRV4Id7V.js";import{p as Vt,e as Is,g as Gt,b as Qt}from"./primitives-DQOaSDoo.js";import{u as qt,r as Wt,a as Kt,b as Yt,c as Xt,d as Zt,i as Jt}from"./consumer-registry-BEMotsU4.js";import{D as Me,R as Ie,P as Le,g as ea}from"./badge-colors-Dl76Mz8m.js";import{g as $s,e as Te,a as Us}from"./chat-utils-C6kvX8nY.js";import{S as $e,i as Ue,a as sa,g as ps}from"./SignalIndicator-BTMFmuDD.js";import{A as ta}from"./arrow-up-BNlEstyM.js";import{A as fe}from"./arrow-right-CKEtkWtu.js";import{A as Os}from"./arrow-down-B1116rTz.js";import{C as cs}from"./chevron-right-CU8UihKL.js";import{d as aa}from"./payload-detail-BWRHeO7M.js";import{M as Oe}from"./map-pin-DlTTkXK_.js";import{L as na}from"./layers-B_54Ow0Q.js";import{H as Vs}from"./hash-v3bMIFKt.js";import{C as he}from"./clock-BOSF_clE.js";import{L as os,R as ra}from"./route-CoO8LxNT.js";import{A as la}from"./activity-Q-NGsRUt.js";import{H as ia,D as ss,u as ca}from"./useMapViewStore-MJt-JUde.js";import{S as ke}from"./shield-rLi3RwxU.js";import{C as Gs}from"./TimeRangeStepper-DNUdgVzA.js";import{Z as fs}from"./zap-NBmxZJvi.js";/**
 * @license lucide-react v0.559.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oa=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],da=Be("corner-down-right",oa);/**
 * @license lucide-react v0.559.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xa=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Qs=Be("message-circle-question-mark",xa);/**
 * @license lucide-react v0.559.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ma=[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]],ha=Be("reply",ma);/**
 * @license lucide-react v0.559.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ua=[["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"}]],gs=Be("stethoscope",ua);/**
 * @license lucide-react v0.559.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pa=[["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"}]],ys=Be("trophy",pa);/**
 * @license lucide-react v0.559.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fa=[["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"}]],Ce=Be("user",fa);function ga(s){s.values.forEach(a=>a.stop())}function ts(s,a){[...a].reverse().forEach(n=>{const l=s.getVariant(n);l&&Bs(s,l),s.variantChildren&&s.variantChildren.forEach(i=>{ts(i,a)})})}function ya(s,a){if(Array.isArray(a))return ts(s,a);if(typeof a=="string")return ts(s,[a]);Bs(s,a)}function ja(){const s=new Set,a={subscribe(t){return s.add(t),()=>void s.delete(t)},start(t,n){const l=[];return s.forEach(i=>{l.push(lt(i,t,{transitionOverride:n}))}),Promise.all(l)},set(t){return s.forEach(n=>{ya(n,t)})},stop(){s.forEach(t=>{ga(t)})},mount(){return()=>{a.stop()}}};return a}function ba(){const s=it(ja);return ct(s.mount,[]),s}function Na({"aria-label":s="Page navigation",className:a,...t}){return e.jsx("nav",{"aria-label":s,...t,className:F("flex gap-x-2",a)})}function va({onClick:s,disabled:a=!1,className:t,children:n="Previous"}){return e.jsx("span",{className:F("grow basis-0",t),children:e.jsxs(rs,{plain:!0,onClick:s,disabled:a,"aria-label":"Previous page",className:F("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"})}),n]})})}function wa({onClick:s,disabled:a=!1,className:t,children:n="Next"}){return e.jsx("span",{className:F("flex grow basis-0 justify-end",t),children:e.jsxs(rs,{plain:!0,onClick:s,disabled:a,"aria-label":"Next page",className:F("gap-1",a&&"invisible"),children:[n,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 ka({className:s,...a}){return e.jsx("span",{...a,className:F("hidden items-baseline gap-x-2 sm:flex",s)})}function Ca({page:s,current:a=!1,onClick:t,className:n,children:l}){return e.jsx(rs,{plain:!a,outline:a,onClick:()=>t==null?void 0:t(s),"aria-label":`Page ${s}`,"aria-current":a?"page":void 0,className:F("min-w-[2.25rem] before:absolute before:-inset-px before:rounded-lg",a&&"before:bg-subtle-fill",n),children:l??s})}function _a({className:s,...a}){return e.jsx("span",{"aria-hidden":"true",...a,className:F("w-[2.25rem] select-none text-center text-sm text-fg-muted",s),children:"…"})}function Sa(s,a,t=1){if(a<=7)return Array.from({length:a},(x,g)=>g+1);const n=Math.max(s-t,1),l=Math.min(s+t,a),i=n>2,r=l<a-1;if(!i&&r){const x=3+2*t;return[...Array.from({length:x},(h,f)=>f+1),"gap",a]}if(i&&!r){const x=3+2*t;return[1,"gap",...Array.from({length:x},(h,f)=>a-x+f+1)]}return[1,"gap",...Array.from({length:l-n+1},(x,g)=>n+g),"gap",a]}const pr=ot(s=>({requestedHash:null,requestChannel:a=>s({requestedHash:a}),clearRequest:()=>s({requestedHash:null})}));function Ta(s){if(s.length===0)return[];const a=[];let t=0;for(;t<s.length;){const n=s[t],l=n.packet_hash;let i=1,r=n;if(l)for(;t+i<s.length&&s[t+i].packet_hash===l;)s[t+i].packet_origin==="tx_local"&&(r=s[t+i]),i++;a.push({packet:r,dupeCount:i}),t+=i}return a}const Pa={rx:{icon:Os,label:"Rx",badgeColor:Me.rx,avatarBg:"bg-sys-green/15",avatarText:"text-sys-green"},forward:{icon:fe,label:"Fwd",badgeColor:Me.forward,avatarBg:"bg-sys-cyan/15",avatarText:"text-sys-cyan"},duplicate:{icon:ls,label:"Dupe",badgeColor:Me.duplicate,avatarBg:"bg-fg-muted/15",avatarText:"text-fg-secondary"},tx:{icon:ta,label:"Tx",badgeColor:Me.tx,avatarBg:"bg-sys-indigo/15",avatarText:"text-sys-indigo"},dropped:{icon:da,label:"Drop",badgeColor:Me.dropped,avatarBg:"bg-sys-amber/15",avatarText:"text-sys-amber"}},js={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},Ba={sm:"w-8 h-8",md:"w-9 h-9",lg:"w-10 h-10"};function Ma(s){return s.packet_origin==="tx_local"?"tx":s.packet_origin==="tx_forward"?"forward":s.is_duplicate?"duplicate":s.transmitted?"forward":s.drop_reason?"dropped":"rx"}function La({packet:s,showLabel:a=!0,variant:t="avatar",size:n="sm"}){const l=Ma(s),i=Pa[l],r=i.icon;return t==="avatar"?e.jsx("div",{className:F("flex items-center justify-center rounded-full flex-shrink-0",i.avatarBg,Ba[n]),children:e.jsx(r,{className:F(js[n],i.avatarText)})}):e.jsxs(B,{color:i.badgeColor,children:[e.jsx(r,{className:js[n]}),a&&i.label]})}const qs=u.memo(La);function Ra({path:s,localHash:a,className:t}){if(!s||s.length===0)return e.jsx("span",{className:F("text-fg-muted text-xs",t),children:"—"});const n=a?Se(a):null;return e.jsx("span",{className:F("flex items-center gap-0.5 type-data-xs overflow-hidden",t),children:s.map((l,i)=>{const r=i===s.length-1,c=n!==null&&dt(l.toUpperCase(),n);return e.jsxs("span",{className:"flex items-center flex-shrink-0",children:[c?e.jsx("span",{className:"px-1 py-0.5 rounded bg-sys-amber/20 text-sys-amber text-[9px] font-medium",children:"You"}):e.jsx("span",{className:"px-1 py-0.5 rounded bg-subtle-fill-hover text-fg-secondary",children:l.toUpperCase()}),!r&&e.jsx(cs,{className:"w-2.5 h-2.5 text-fg-muted mx-0.5 flex-shrink-0"})]},`${l}-${i}`)})})}const Ws=u.memo(Ra);function Ks({channelName:s,onClick:a,active:t,compact:n,className:l}){const i=s.startsWith("#")?s:`#${s}`,r=F("inline-flex items-center flex-shrink-0","font-medium",n?"px-1.5 h-4 leading-4 rounded text-[10px]":"px-2 h-5 leading-5 rounded text-xs",t?"bg-sys-blue/20 text-sys-blue":"bg-sys-blue/10 text-sys-blue",a&&!t&&"hover:bg-sys-blue/20 cursor-pointer",l);return a?e.jsx("button",{type:"button",onClick:a,className:r,children:i}):e.jsx("span",{className:r,children:i})}function Ys({packet:s}){return s._remoteSource?e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:je("teal"),children:"HTTP"}):s._mqttSource&&!s._remoteSource?e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:je("purple"),children:"MQTT"}):null}function je(s){return{"--data-box-accent":pe[s]}}function Xs(s){const a=s.payload_type_name||Fs(s.payload_type??s.type),t=s.route_type_name||Ds(s.route_type??s.route),n=Le[a]??"zinc",l=Ie[t]??"zinc";return{payloadType:a,routeType:t,payloadColor:n,routeColor:l}}function Ve(s){if(!s)return[];if(Array.isArray(s))return s;try{const a=JSON.parse(s);return Array.isArray(a)?a:[]}catch{return[]}}function Zs(s,a){if(a){const t=a(s);return{name:t.name,hash:t.hash,isCompanion:t.isCompanion,isRepeater:t.isRepeater}}return{name:null,hash:null,isCompanion:!1,isRepeater:!1}}function Js(s,a,t,n){const l=a||s.src_hash_full||s.src_hash;if(!l)return null;const i=s.path_hash_size===1||s.path_hash_size===2||s.path_hash_size===3?s.path_hash_size:null,r=n.length>0?xt(n[0]):null;return Se(l,i??r??t)}function Ha({packet:s,onClick:a,localHash:t,pathHashSize:n=1,neighbors:l,resolveSource:i,isFlashing:r=!1,isTraceHighlighted:c,onTraceHover:x,traceTag:g,onViewTraceReport:h,dupeGroupPosition:f,isDupeGroupHovered:C=!1,onDupeGroupHover:b,dupeCount:o,getDecodedContent:_,onChannelClick:P}){const d=o?!1:Ms(s.is_duplicate),w=f!==void 0,{payloadType:m,routeType:v,payloadColor:N,routeColor:y}=Xs(s),I=s.packet_origin==="tx_local",A=m==="TRACE",V=Ve(s.original_path),W=Ve(s.forwarded_path),G=W.length>0?W:V,{name:Y,hash:D,isRepeater:J}=Zs(s,i),L=Js(s,D,n,G);let X=null,U=null,ne=null,T=null;if(m==="GRP_TXT"&&_){const $=_(s);$!=null&&$.decrypted&&(U=$.senderName,ne=$.channelName,T=$.channelHash,$.text&&(X=$.text))}else if(m==="TXT_MSG"&&s.raw_packet)try{const $=Ls.fromHex(s.raw_packet);if($.success&&$.packet){const ie=Rs($.packet.payload);ie&&!ie.encrypted&&(X=ie.text)}}catch{}const z=U||(J?null:Y),ee=!!z,M=!ee&&J&&!!Y,p=!ee&&!M&&m==="GRP_TXT"&&!X,ae=s.payload_length??s.length??0;s.lbt_attempts;const se=u.useCallback(()=>{A&&g&&h?h(g):a(s)},[A,g,h,a,s]),le=u.useCallback(()=>{A&&g&&x&&x(g),w&&b&&s.packet_hash&&b(s.packet_hash)},[A,g,x,w,b,s.packet_hash]),te=u.useCallback(()=>{x&&x(null),b&&b(null)},[x,b]),S=pe[N]||pe.zinc,K=C,R=()=>{const $={pointerEvents:"none"};return f==="first"?{...$,borderTop:`2px solid ${S}`,borderLeft:`2px solid ${S}`,borderRight:`2px solid ${S}`,borderBottom:"none",borderRadius:"8px 8px 0 0",inset:"-2px -2px 0 -2px"}:f==="middle"?{...$,borderTop:"none",borderLeft:`2px solid ${S}`,borderRight:`2px solid ${S}`,borderBottom:"none",borderRadius:0,inset:"0 -2px"}:f==="last"?{...$,borderTop:"none",borderLeft:`2px solid ${S}`,borderRight:`2px solid ${S}`,borderBottom:`2px solid ${S}`,borderRadius:"0 0 8px 8px",inset:"0 -2px -2px -2px"}:{...$,border:`2px solid ${S}`,borderRadius:"8px",inset:"-2px"}};return e.jsxs("div",{onClick:se,onMouseEnter:le,onMouseLeave:te,className:F("group relative cursor-pointer","hover:bg-subtle-fill",d&&!C&&"opacity-40",r&&"flash-row",I&&"bg-sys-indigo/5",c&&"bg-sys-teal/10"),children:[e.jsx("div",{className:F("absolute pointer-events-none transition-opacity duration-75",w?K?"opacity-100":"opacity-0":"opacity-0 group-hover:opacity-100"),style:R()}),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:ee?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-1 ring-edge-subtle",style:{backgroundColor:$s(Te(z).cleanName)},children:Te(z).emoji?e.jsx("span",{className:"text-base leading-none",children:Te(z).emoji}):e.jsx("span",{className:"text-white text-[10px] font-bold tracking-tighter",children:Us(z)})}):M?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(me,{className:"size-5 text-sys-blue"})}):p?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-zinc-500/20 ring-1 ring-edge-subtle",children:e.jsx(Qs,{className:"size-4 text-fg-muted"})}):e.jsx(qs,{packet:s,variant:"avatar",size:"sm"})}),e.jsx("div",{className:"min-w-0",children:ee?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-semibold text-[13px] text-fg-primary font-sans truncate max-w-[90px]",children:z}),L&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate",children:L})]}):M?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-semibold text-[13px] text-fg-primary font-sans truncate max-w-[90px]",children:Y}),L&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate",children:L})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-bold text-[13px] text-fg-primary font-sans truncate",children:L||"—"}),Y&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate max-w-[70px]",children:Y})]})})]}),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:"data-box data-box-compact data-box-outlined flex-shrink-0",style:je(N),children:m}),I&&e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:je("indigo"),children:"LOCAL"}),e.jsx(Ys,{packet:s}),o&&o>1&&e.jsxs("span",{className:"data-box data-box-compact flex-shrink-0",children:["×",o]}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:je(y),children:v}),e.jsxs("span",{className:"hidden min-[520px]:inline type-data-xs text-fg-muted flex-shrink-0",children:[ae,"B"]}),e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:X||ne?e.jsxs("span",{className:"text-[11px] text-fg-secondary truncate block flex items-center gap-1",children:[ne&&e.jsx(Ks,{channelName:ne,compact:!0,onClick:P&&T?$=>{$.stopPropagation(),P(T)}:void 0}),X&&e.jsx("span",{className:"italic truncate",children:X})]}):e.jsx(Ws,{path:G,localHash:t})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e.jsx("span",{className:"data-box data-box-compact",children:Hs(s.timestamp)}),e.jsx($e,{rssi:s.rssi,snr:s.snr,compact:!0,showValues:!0,validated:Ue(s)})]})]})]})}function Fa({packet:s,onClick:a,localHash:t,pathHashSize:n=1,neighbors:l,resolveSource:i,isFlashing:r=!1,isTraceHighlighted:c,traceTag:x,onViewTraceReport:g,dupeGroupPosition:h,isDupeGroupHovered:f=!1,onDupeGroupHover:C,dupeCount:b,getDecodedContent:o,onChannelClick:_}){const{payloadType:P,routeType:d,payloadColor:w,routeColor:m}=Xs(s),v=s.packet_origin==="tx_local",N=P==="TRACE",y=b?!1:Ms(s.is_duplicate),I=Ve(s.original_path),A=Ve(s.forwarded_path),V=A.length>0?A:I,W=s._hopCount??V.length,{name:G,hash:Y,isRepeater:D}=Zs(s,i),J=Js(s,Y,n,V);let L=null,X=null,U=null,ne=null;if(P==="GRP_TXT"&&o){const S=o(s);S!=null&&S.decrypted&&(X=S.senderName,U=S.channelName,ne=S.channelHash,S.text&&(L=S.text))}else if(P==="TXT_MSG"&&s.raw_packet)try{const S=Ls.fromHex(s.raw_packet);if(S.success&&S.packet){const K=Rs(S.packet.payload);K&&!K.encrypted&&(L=K.text)}}catch{}const T=X||(D?null:G),z=!!T,ee=!z&&D&&!!G,M=!z&&!ee&&P==="GRP_TXT"&&!L,p=s.payload_length??s.length??0,ae=s.lbt_attempts??0,se=()=>{N&&x&&g?g(x):a(s)},le=pe[w]||pe.zinc,te=()=>{if(!h)return{opacity:0};const S=f?1:.4,K=f?"3px":"2px";return h==="first"?{backgroundColor:le,opacity:S,width:K,top:"6px",bottom:0,borderRadius:"0 9999px 0 0"}:h==="middle"?{backgroundColor:le,opacity:S,width:K,top:0,bottom:0,borderRadius:0}:h==="last"?{backgroundColor:le,opacity:S,width:K,top:0,bottom:"6px",borderRadius:"0 0 9999px 0"}:{backgroundColor:le,opacity:S,width:K,top:"6px",bottom:"6px",borderRadius:"9999px"}};return e.jsxs("div",{onClick:se,className:F("relative pl-3 pr-2.5 py-2 cursor-pointer","active:bg-subtle-fill-hover",y&&"opacity-40",r&&"flash-row",v&&"bg-sys-indigo/5",c&&"bg-sys-teal/10"),children:[e.jsx("div",{className:"absolute left-0 transition-all",style:te()}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"relative flex-shrink-0 mt-0.5",children:z?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-1 ring-edge-subtle",style:{backgroundColor:$s(Te(T).cleanName)},children:Te(T).emoji?e.jsx("span",{className:"text-base leading-none",children:Te(T).emoji}):e.jsx("span",{className:"text-white text-[10px] font-bold tracking-tighter",children:Us(T)})}):ee?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(me,{className:"size-5 text-sys-blue"})}):M?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-zinc-500/20 ring-1 ring-edge-subtle",children:e.jsx(Qs,{className:"size-4 text-fg-muted"})}):e.jsx(qs,{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:[z?e.jsx("span",{className:"font-medium text-[14px] text-fg-primary tracking-tight truncate min-w-0",children:T}):ee?e.jsx("span",{className:"font-medium text-[14px] text-fg-primary tracking-tight truncate min-w-0",children:G}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-semibold text-[14px] text-fg-primary tracking-tight flex-shrink-0",children:J||"—"}),G&&e.jsx("span",{className:"text-[12px] text-fg-muted truncate min-w-0",children:G})]}),e.jsx("div",{className:"flex-1"}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:je(w),children:P}),v&&e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:je("indigo"),children:"LOCAL"}),e.jsx(Ys,{packet:s}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:je(m),children:d}),b&&b>1&&e.jsxs("span",{className:"data-box data-box-compact flex-shrink-0",children:["×",b]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("span",{className:"type-data-xs text-fg-muted w-[28px] text-right",children:s.rssi}),e.jsx($e,{rssi:s.rssi,compact:!0,showValues:!1,validated:Ue(s)})]})]}),e.jsxs("div",{className:"flex items-center gap-1 type-data-xs text-fg-muted",children:[e.jsx("span",{className:"data-box data-box-compact flex-shrink-0",children:Hs(s.timestamp)}),p>0&&e.jsxs("span",{children:[p,"B"]}),ae>0&&e.jsxs("span",{className:ae>1?"text-sys-amber/60":void 0,children:["LBT:",ae]}),s.snr!=null&&e.jsxs("span",{children:[s.snr.toFixed(0),"dB"]}),L||U?e.jsxs("span",{className:"text-[11px] text-fg-secondary truncate flex items-center gap-1 min-w-0",children:[U&&e.jsx(Ks,{channelName:U,compact:!0,onClick:_&&ne?S=>{S.stopPropagation(),_(ne)}:void 0}),L&&e.jsx("span",{className:"italic truncate",children:L})]}):W>0?e.jsx(Ws,{path:V,localHash:t}):null]})]})]})]})}const Da=u.memo(Ha),Aa=u.memo(Fa);function za(s,a,t,n,l=!1){const i=s.toUpperCase(),r=[],c=t&&Ze(i,t);c&&r.push(t);for(const b of Object.keys(a))Ze(i,b)&&r.push(b);if(l&&c&&t&&r.length===1)return{matches:r,probability:1,bestMatch:t};if(l&&c&&r.length>1){const b=r.filter(o=>o!==t);if(b.length===1)return{matches:r,probability:1,bestMatch:b[0]}}const x=r.length>0?1/r.length:0,g=[...r].sort();let h=null,f=-1;if(g.length===1)h=g[0];else if(g.length>1&&n){for(const b of g){const o=n.get(b),_=o?typeof o=="number"?o:o.combinedScore:0;_>f&&(f=_,h=b)}h||(h=g[0])}else g.length>0&&(h=g[0]);let C=x;if(r.length>1&&n&&f>0){let b=0;for(const o of r){const _=n.get(o);b+=_?typeof _=="number"?_:_.combinedScore:0}b>0&&(C=Math.min(.95,f/b))}return{matches:r,probability:C,bestMatch:h}}function Ea(s,a,t,n){const i=(t-s)*Math.PI/180,r=(n-a)*Math.PI/180,c=Math.sin(i/2)*Math.sin(i/2)+Math.cos(s*Math.PI/180)*Math.cos(t*Math.PI/180)*Math.sin(r/2)*Math.sin(r/2);return 6371e3*(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)))}function Ia(s){return s<100?1:s<500?.9:s<1e3?.7:s<5e3?.5:s<1e4?.3:.1}const $a=u.lazy(()=>ht(()=>import("./PathMapMapLibre-D2KjWch9.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])));function Ua(s,a,t,n,l=!1,i,r,c){const x=ut(a);let g;r&&(g=pt(r,s,{position:c,isLastHop:l}).confidence);const{matches:h,probability:f}=za(s,x,n,i,l),C=h.length,b=[],o=s.toUpperCase(),_=t&&t.latitude!==void 0&&t.longitude!==void 0&&(t.latitude!==0||t.longitude!==0);for(const d of h){if(n&&Ze(o,n)&&d===n&&_&&t){b.push({hash:d,name:t.name||"Local Node",latitude:t.latitude,longitude:t.longitude,probability:l?1:f,isLocal:!0});continue}const w=x[d];w!=null&&w.latitude&&(w!=null&&w.longitude)&&!(w.latitude===0&&w.longitude===0)&&b.push({hash:d,name:w.node_name||w.name||"Unknown",latitude:w.latitude,longitude:w.longitude,probability:f,isLocal:!1,isDirectNeighbor:w.zero_hop===!0})}const P=b.length;if(P===1)b[0].probability=g??1;else if(P>1)if(g!==void 0&&g>0){const d=b[0];d.probability=g;const w=1-g,m=P-1;b.slice(1).forEach(v=>{v.probability=w/m})}else{let d=0;const w=b.map(m=>{if(m.isLocal)return{candidate:m,score:1};const v=i==null?void 0:i.get(m.hash);let N=.5;if(_&&t){const I=Ea(t.latitude,t.longitude,m.latitude,m.longitude);N=Ia(I)}let y;return v?y=N*.3+v.hopConsistencyScore*.3+v.frequencyScore*.4:(y=N,m.isDirectNeighbor&&(y=Math.max(y,.8))),d+=y,{candidate:m,score:y}});if(d>0)w.forEach(({candidate:m,score:v})=>{m.probability=Math.min(.95,v/d)});else{const m=1/P;b.forEach(v=>v.probability=m)}}return{candidates:b,totalMatches:C}}function Oa(s,a,t,n,l,i){if(!s||s.length===0)return{hops:[],overallConfidence:0,hasValidPath:!1};const r=s.length-1,c=s.map((h,f)=>{const C=f===r,b=s.length-f,{candidates:o,totalMatches:_}=Ua(h,a,t,n,C,l,i,b),P=o.length>0?Math.max(...o.map(d=>d.probability)):0;return{prefix:h,candidates:o,confidence:P,totalMatches:_}}),x=c.reduce((h,f)=>f.confidence===0?0:h*f.confidence,1),g=c.some(h=>h.candidates.length>0);return{hops:c,overallConfidence:x,hasValidPath:g}}function Va(s){return`${(s*100).toFixed(0)}%`}function Ga(s){return s>=1?"text-sys-green":s>=.5?"text-sys-indigo":s>=.25?"text-signal-poor":s>0?"text-sys-red":"text-fg-muted"}function Qa(s,a,t){let n;return a===0?n=t.muted:s>=1?n=t.success:s>=.5?n=t.secondary:s>=.25?n=t.poor:s>0?n=t.danger:n=t.muted,{color:n}}class qa extends u.Component{constructor(a){super(a),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-fg-muted",children:[e.jsx(Je,{className:"w-4 h-4 mr-2"}),"Map failed to load"]}):this.props.children}}function Ge({path:s,neighbors:a,localNode:t,localHash:n,srcHash:l,dstHash:i,neighborAffinity:r,prefixLookup:c,hubNodes:x,traceSnr:g,advertiserSource:h}){const[f,C]=u.useState(null),b=u.useMemo(()=>{if(!h)return null;const m=h.nodeType==="wardrive";return{prefix:h.prefix||"??",candidates:[{hash:h.publicKey||h.prefix||"source",name:h.name,latitude:h.latitude,longitude:h.longitude,probability:1,isLocal:!1,isWardrive:m}],confidence:1,totalMatches:1,isSource:!0}},[h]),o=u.useMemo(()=>{if(h||!l)return null;const m=Se(l),v=a[l];if((v==null?void 0:v.latitude)&&(v==null?void 0:v.longitude)&&!(v.latitude===0&&v.longitude===0))return{prefix:m,candidates:[{hash:l,name:v.node_name||v.name||"Source",latitude:v.latitude,longitude:v.longitude,probability:1,isLocal:!1,isDirectNeighbor:v.zero_hop===!0}],confidence:1,totalMatches:1,isSource:!0};const y=(v==null?void 0:v.node_name)||(v==null?void 0:v.name)||l.slice(0,8);return{prefix:m,candidates:[{hash:l,name:y,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isSource:!0}},[h,l,a]),_=u.useMemo(()=>{const m=i!=null&&i.startsWith("0x")?i.slice(2):i;if((!m||m==="00"||m==="0000000000000000")&&t&&n){const V=Se(n),W=t.latitude!==0||t.longitude!==0;return{prefix:V,candidates:[{hash:n,name:t.name||"Local Node",latitude:W?t.latitude:0,longitude:W?t.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}if(!i)return null;const N=Se(i);if(n&&i===n&&t){const V=t.latitude!==0||t.longitude!==0;return{prefix:N,candidates:[{hash:i,name:t.name||"Local Node",latitude:V?t.latitude:0,longitude:V?t.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}const y=a[i];if((y==null?void 0:y.latitude)&&(y==null?void 0:y.longitude)&&!(y.latitude===0&&y.longitude===0))return{prefix:N,candidates:[{hash:i,name:y.node_name||y.name||"Destination",latitude:y.latitude,longitude:y.longitude,probability:1,isLocal:!1,isDirectNeighbor:y.zero_hop===!0}],confidence:1,totalMatches:1,isDestination:!0};const A=(y==null?void 0:y.node_name)||(y==null?void 0:y.name)||i.slice(0,8);return{prefix:N,candidates:[{hash:i,name:A,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isDestination:!0}},[i,a,t,n]),P=u.useMemo(()=>Oa(s,a,t,n,r,c),[s,a,t,n,r,c]),d=u.useMemo(()=>{const m=[];b?m.push(b):o&&m.push(o),m.push(...P.hops),_&&m.push(_);const v=m.reduce((y,I)=>I.confidence===0?0:y*I.confidence,1),N=m.some(y=>y.candidates.some(I=>I.latitude!==0||I.longitude!==0));return{hops:m,overallConfidence:v,hasValidPath:N}},[b,o,P,_]),w=u.useMemo(()=>{const m=getComputedStyle(document.documentElement);return{success:m.getPropertyValue("--sys-green").trim()||"#39D98A",secondary:m.getPropertyValue("--sys-indigo").trim()||"#F9D26F",poor:m.getPropertyValue("--signal-poor").trim()||"#FF8A5C",danger:m.getPropertyValue("--sys-red").trim()||"#FF5C7A",muted:m.getPropertyValue("--text-muted").trim()||"#767688"}},[]);return d.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-fg-muted",children:"Path Confidence:"}),e.jsx("span",{className:Ga(d.overallConfidence),children:Va(d.overallConfidence)}),e.jsx("button",{className:"text-fg-muted hover:text-fg-secondary transition-colors",title:"Confidence is calculated based on how many known nodes match each path prefix. Multiple matches reduce confidence due to collision probability.",children:e.jsx(mt,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-sys-green"}),e.jsx("span",{className:"text-fg-muted",children:"Exact"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-sys-indigo"}),e.jsx("span",{className:"text-fg-muted",children:"Multi"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-fg-muted"}),e.jsx("span",{className:"text-fg-muted",children:"Unknown"})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(qa,{children:e.jsx(u.Suspense,{fallback:e.jsx("div",{className:"h-full bg-elevated flex items-center justify-center text-fg-muted text-sm",children:"Loading map..."}),children:e.jsx($a,{resolvedPath:d,localNode:t,hubNodes:x,hoveredHopIndex:f,onHoverHop:C,traceSnr:g})})})}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:d.hops.map((m,v)=>{var V,W,G;const N=m.isSource===!0,y=m.isDestination===!0,I=f===v;let A;return N?A=`Source: ${((V=m.candidates[0])==null?void 0:V.name)||"Unknown"}`:y?A=`Destination: ${((W=m.candidates[0])==null?void 0:W.name)||"Unknown"}`:m.totalMatches===0?A="No matching nodes found":m.totalMatches===1?A=`Exact match: ${((G=m.candidates[0])==null?void 0:G.name)||"Unknown"}`:A=`${m.totalMatches} possible matches (${(m.confidence*100).toFixed(0)}% confidence)`,e.jsxs("div",{className:F("flex items-center gap-1 px-1.5 py-0.5 rounded type-data-xs cursor-pointer transition-all",I?"bg-sys-blue/20 ring-1 ring-sys-blue/50":"bg-elevated hover:bg-subtle",N&&"border border-sys-green/30",y&&"border border-sys-blue/30"),title:A,onMouseEnter:()=>C(v),onMouseLeave:()=>C(null),children:[N&&e.jsx("span",{className:"text-sys-green text-[8px] mr-0.5",children:"SRC"}),y&&e.jsx("span",{className:"text-sys-blue text-[8px] mr-0.5",children:"DST"}),e.jsx("span",{style:Qa(m.confidence,m.totalMatches,w),children:m.prefix}),!N&&!y&&m.totalMatches>1&&e.jsxs("span",{className:"text-fg-muted",children:["×",m.totalMatches]}),!N&&!y&&m.totalMatches===0&&e.jsx("span",{className:"text-fg-muted",children:"?"})]},v)})})]}):e.jsxs("div",{className:"flex items-center justify-center text-fg-muted text-xs py-4",children:[e.jsx(Oe,{className:"w-3.5 h-3.5 mr-1.5 opacity-50"}),"No location data available for path nodes"]})}const Ye=16;function Qe(s){return s.match(/.{1,2}/g)||[]}function be(s){return s!==null&&s.startsWith("payload:")}const Pe={hexRestOpacity:15,cardRestBg:"color-mix(in srgb, var(--elevated) 60%, var(--body))",cardRestShadow:`
    var(--depth-stroke-tl),
    var(--depth-stroke-br)
  `,selectionBorderWidth:2},as={type:"tween",duration:.25,ease:[.25,.1,.25,1]};function Wa(s,a){return s?`inset 0 0 0 ${Pe.selectionBorderWidth}px ${pe[a]}`:Pe.cardRestShadow}function Ka(s,a){return s?a:`color-mix(in srgb, ${a} ${Pe.hexRestOpacity}%, transparent)`}function Ya({segments:s,selectedSegment:a,onSegmentClick:t}){const[n,l]=u.useState(null),[i,r]=u.useState(null),c=s.some(h=>h.id!==void 0)&&t,x=[];for(const h of s){const f=Qe(h.hex);for(const C of f)x.push({byte:C.toUpperCase(),color:h.color,id:h.id})}const g=[];for(let h=0;h<x.length;h+=Ye)g.push(x.slice(h,h+Ye));return e.jsx("div",{className:"space-y-1",children:g.map((h,f)=>{const C=h.length<Ye;return e.jsx("div",{className:"flex rounded-md overflow-hidden",children:h.map(({byte:b,color:o,id:_},P)=>{const d=P===h.length-1,w=C&&d,m=pe[o],y=(_?n===_:i===o)||!!(_&&a===_);return e.jsx("span",{className:`w-[1.75rem] text-xs text-center py-0.5 font-mono select-text ${c?"cursor-pointer":""}`,style:{backgroundColor:Ka(y,m),color:y?"rgba(255,255,255,0.95)":m,transition:y?"none":"background-color 0.15s ease-out, color 0.15s ease-out",touchAction:"manipulation",...w?{borderRadius:"0 0.375rem 0.375rem 0"}:{}},onMouseEnter:()=>{_?l(_):r(o)},onMouseLeave:()=>{l(null),r(null)},onClick:()=>_&&(t==null?void 0:t(_)),onTouchStart:()=>{_?l(_):r(o)},onTouchEnd:()=>{l(null),r(null)},children:b},P)})},f)})})}function Xa({rawHex:s,hexSegments:a,selectedSegment:t,onSegmentClick:n}){const[l,i]=u.useState(!1),r=u.useCallback(async()=>{await bt(s.toUpperCase()),i(!0),setTimeout(()=>i(!1),2e3)},[s]);return e.jsxs("div",{className:"bg-inset radius-inner p-6 relative depth-stroke-inset",children:[e.jsx(Ya,{segments:a,selectedSegment:t,onSegmentClick:n}),e.jsx("button",{onClick:r,className:"absolute bottom-3 right-3 flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-subtle-fill-hover hover:bg-subtle-fill-strong text-fg-muted hover:text-fg-secondary transition-all text-xs font-sans",title:"Copy raw packet hex",children:l?e.jsxs(e.Fragment,{children:[e.jsx(Nt,{className:"w-3.5 h-3.5 text-sys-green"}),e.jsx("span",{className:"text-sys-green",children:"Copied"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ls,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Copy"})]})})]})}function Za(s,a){const t=[];let n=0;const l=a.slice(0,64);t.push({id:"payload:publicKey",title:"Public Key",color:"pink",hex:l,startByte:n,endByte:n+31,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:s.publicKey.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Ed25519 public key (32 bytes)"})]})}),n+=32;const i=a.slice(64,72);t.push({id:"payload:timestamp",title:"Timestamp",color:"orange",hex:i,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(Z,{size:"standard",copy:!0,children:i.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:[s.timestamp," (",de(s.timestamp),")"]})]})}),n+=4;const r=a.slice(72,200);t.push({id:"payload:signature",title:"Signature",color:"teal",hex:r,startByte:n,endByte:n+63,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:s.signature.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Ed25519 signature (64 bytes)"})]})}),n+=64;const c=a.slice(200,202);if(t.push({id:"payload:flags",title:"Flags",color:"blue",hex:c,startByte:n,endByte:n,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(Z,{size:"standard",copy:!0,children:["0x",s.flags.toString(16).padStart(2,"0").toUpperCase()]}),e.jsx("p",{className:"text-xs text-fg-primary mt-1",children:s.flagsDescription}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Node Type: ",s.nodeType]})]})}),n+=1,s.latitude!==void 0){const x=a.slice(n*2,n*2+8);t.push({id:"payload:latitude",title:"Latitude",color:"green",hex:x,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(Z,{size:"standard",copy:!0,children:x.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:[s.latitude.toFixed(6),"°"]})]})}),n+=4}if(s.longitude!==void 0){const x=a.slice(n*2,n*2+8);t.push({id:"payload:longitude",title:"Longitude",color:"indigo",hex:x,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(Z,{size:"standard",copy:!0,children:x.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:[s.longitude.toFixed(6),"°"]})]})}),n+=4}if(s.name){const x=a.slice(n*2),g=x.length/2;t.push({id:"payload:name",title:"Name",color:"amber",hex:x,startByte:n,endByte:n+g-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx(Z,{size:"standard",copy:!0,children:x.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:['"',s.name,'"']})]})})}return t}function Ja(s,a){return[{id:"payload:crc",title:"CRC",color:"green",hex:a.slice(0,8),startByte:0,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(Z,{size:"standard",copy:!0,children:["0x",s.crc]}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"CRC32 of acknowledged packet"})]})}]}function en(s,a){const t=[];t.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:a.slice(0,2),startByte:0,endByte:0,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(Z,{size:"standard",copy:!0,children:["0x",s.channelHash]}),s.channelName&&e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:["Channel: ",s.channelName]})]})}),s.macHex&&t.push({id:"payload:mac",title:"MAC",color:"indigo",hex:a.slice(2,6),startByte:1,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(Z,{size:"standard",copy:!0,children:s.macHex.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=a.slice(6);return n&&t.push({id:"payload:ciphertext",title:s.decrypted?"Message":"Ciphertext",color:s.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:s.decrypted?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-fg-primary",children:['"',s.text,'"']}),s.senderName&&e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:["From: ",s.senderName]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:n.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"AES-128-ECB encrypted"})]})}),t}function sn(s,a){const t=[];t.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:a.slice(0,2),startByte:0,endByte:0,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(Z,{size:"standard",copy:!0,children:["0x",s.channelHash]}),s.channelName&&e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:["Channel: ",s.channelName]})]})}),s.macHex&&t.push({id:"payload:mac",title:"MAC",color:"indigo",hex:a.slice(2,6),startByte:1,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(Z,{size:"standard",copy:!0,children:s.macHex.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=a.slice(6);return n&&t.push({id:"payload:ciphertext",title:s.decrypted?"Decrypted Data":"Encrypted Data",color:s.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-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:(s.decryptedHex||n).toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[s.dataLength," bytes",s.decrypted?"":" (AES-128-ECB encrypted)"]})]})}),t}function tn(s,a){const t=[],n=parseInt(a.slice(0,2),16),l=isNaN(n)?{hashSize:1,hopCount:s.pathLength}:wt(n),i=l.hopCount*l.hashSize;if(t.push({id:"payload:pathLength",title:"Path Length",color:"blue",hex:a.slice(0,2),startByte:0,endByte:0,decoded:e.jsxs(e.Fragment,{children:[e.jsx(Z,{size:"standard",children:l.hopCount}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[l.hopCount," hop",l.hopCount!==1?"s":"",l.hashSize>1&&` × ${l.hashSize}B hashes`]})]})}),s.path.length>0){const r=a.slice(2,2+i*2);t.push({id:"payload:path",title:"Path Hops",color:"amber",hex:r,startByte:1,endByte:i,decoded:e.jsx(e.Fragment,{children:e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:s.path.map((c,x)=>e.jsxs("span",{className:"flex items-center gap-1",children:[x>0&&e.jsx(fe,{className:"w-3 h-3 text-fg-muted"}),e.jsx(B,{color:"amber",className:"font-mono",children:c})]},x))})})})}if(s.extraType!=null){const r=1+i;t.push({id:"payload:extraType",title:"Extra Type",color:"indigo",hex:a.slice(r*2,r*2+2),startByte:r,endByte:r,decoded:e.jsxs(e.Fragment,{children:[e.jsx(Z,{size:"standard",children:s.extraTypeName??`0x${s.extraType.toString(16).padStart(2,"0")}`}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Bundled payload type"})]})})}if(s.extraData){const r=1+i+1,c=a.slice(r*2);c&&t.push({id:"payload:extraData",title:"Extra Data",color:"indigo",hex:c,startByte:r,endByte:r+c.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:c.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[c.length/2," bytes"]})]})})}return t}function an(s,a){const t=[];t.push({id:"payload:crc",title:"Trace Tag",color:"blue",hex:a.slice(0,8),startByte:0,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(Z,{size:"standard",copy:!0,children:["0x",s.traceTag]}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Unique trace request identifier"})]})}),t.push({id:"payload:mac",title:"Auth Code",color:"indigo",hex:a.slice(8,16),startByte:4,endByte:7,decoded:e.jsxs(e.Fragment,{children:[e.jsx(Z,{size:"standard",copy:!0,children:s.authCode}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Authentication/verification code"})]})});const n=1<<(s.flags&3);t.push({id:"payload:flags",title:"Flags",color:"amber",hex:a.slice(16,18),startByte:8,endByte:8,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(Z,{size:"standard",copy:!0,children:["0x",s.flags.toString(16).toUpperCase().padStart(2,"0")]}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:s.flags===0?"No flags set (1B hashes)":`Bits 0-1: ${n}B per hash • ${s.flags.toString(2).padStart(8,"0")}b`})]})});const l=a.slice(18);return l&&t.push({id:"payload:path",title:"Target Path",color:"indigo",hex:l,startByte:9,endByte:9+l.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:s.pathHashes.map((i,r)=>{const c=s.snrValues[r],x=c!==void 0?ea(c):"zinc";return e.jsxs("span",{className:"flex items-center gap-1",children:[r>0&&e.jsx(fe,{className:"w-3 h-3 text-fg-muted"}),e.jsx(B,{color:"indigo",className:"font-mono",children:i}),c!==void 0&&e.jsxs(B,{color:x,className:"font-mono",children:[c>=0?"+":"",Number.isInteger(c)?c:c.toFixed(1),"dB"]})]},r)})}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[s.pathHashes.length," target ",s.pathHashes.length===1?"hop":"hops",n>1&&` × ${n}B hashes`,s.snrValues.length>0&&` • ${s.snrValues.length} SNR ${s.snrValues.length===1?"value":"values"} collected`,s.isComplete&&" • ✓ Complete"]})]})}),t}function nn(s,a){const t=[];t.push({id:"payload:msgId",title:"Message ID",color:"blue",hex:a.slice(0,4),startByte:0,endByte:1,decoded:e.jsxs(e.Fragment,{children:[e.jsx(Z,{size:"standard",copy:!0,children:s.messageId.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Unique message identifier"})]})}),t.push({id:"payload:partNum",title:"Part Number",color:"amber",hex:a.slice(4,6),startByte:2,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(Z,{size:"standard",copy:!0,children:s.partNumber}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"0-indexed part number"})]})}),t.push({id:"payload:totalParts",title:"Total Parts",color:"orange",hex:a.slice(6,8),startByte:3,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(Z,{size:"standard",copy:!0,children:s.totalParts}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:["Part ",s.partNumber+1," of ",s.totalParts]})]})});const n=a.slice(8);return n&&t.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-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:n.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[n.length/2," bytes"]})]})}),t}function rn(s,a){switch(s.type){case"advert":return Za(s,a);case"ack":return Ja(s,a);case"grp_txt":return en(s,a);case"grp_data":return sn(s,a);case"path":return tn(s,a);case"trace":return an(s,a);case"multipart":return nn(s,a);default:return[{id:"payload:ciphertext",title:"Raw Data",color:"zinc",hex:a,startByte:0,endByte:a.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:a.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[a.length/2," bytes"]})]})}]}}function ln(s){return s.map(a=>({id:a.id,hex:a.hex,color:a.color}))}function cn({bits:s,field:a,value:t,binary:n}){const l=()=>{if(a==="Payload Type"){const i=Le[t]||"zinc";return e.jsx(B,{color:i,children:t})}if(a==="Route Type"){const i=Ie[t]||"zinc";return e.jsx(B,{color:i,children:t})}return e.jsx("span",{className:"text-sm text-fg-primary",children:t})};return e.jsxs("tr",{children:[e.jsx("td",{className:"py-1.5 text-xs text-fg-muted tabular-nums",children:s}),e.jsx("td",{className:"py-1.5 text-sm text-fg-secondary",children:a}),e.jsx("td",{className:"py-1.5",children:l()}),e.jsx("td",{className:"py-1.5 type-data-xs text-sys-cyan",children:n})]})}function bs({id:s,title:a,color:t,hexBytes:n,startByte:l,endByte:i,isSelected:r,children:c}){const x=n?Qe(n):[];return e.jsxs(xe.div,{layout:"position",layoutId:s,transition:as,className:"w-full min-w-0 overflow-hidden radius-inner p-4 sm:p-5 space-y-4",style:{backgroundColor:Pe.cardRestBg,boxShadow:Wa(r,t)},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(B,{color:t,children:a}),x.length>0&&x.length<=16&&x.map((g,h)=>e.jsx(B,{color:t,className:"font-mono",children:g.toUpperCase()},h))]}),e.jsxs("span",{className:"type-data-xs text-fg-muted flex-shrink-0",children:["Bytes ",l,"-",i]})]}),e.jsx("div",{className:"min-w-0 overflow-hidden",children:c})]})}function on({advert:s,timestamp:a}){const t=a?de(a):de(s.timestamp);return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-indigo/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-indigo) 0%, var(--sys-blue) 100%)"},children:e.jsx(me,{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-fg-primary font-sans truncate leading-tight",children:s.name||"Unknown Node"}),e.jsx("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:s.nodeType})]})]}),e.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-2",children:[s.latitude!==void 0&&s.longitude!==void 0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Oe,{className:"w-4 h-4 text-sys-indigo flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-fg-secondary font-mono",children:[s.latitude.toFixed(5),"°, ",s.longitude.toFixed(5),"°"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(he,{className:"w-4 h-4 text-sys-indigo flex-shrink-0"}),e.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:t})]})]})]})})}function dn({decoded:s,timestamp:a}){const t=a?de(a):"Unknown";return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-teal/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(_t,{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-fg-primary font-sans truncate leading-tight",children:s.channelName||"Channel Data"}),e.jsxs("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:[s.dataLength," bytes • ",s.decrypted?"Decrypted":"Encrypted"]})]})]}),e.jsx("div",{className:"mx-4 border-t border-edge-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(Vs,{className:"w-4 h-4 text-sys-teal flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-fg-secondary font-sans",children:["Channel: ",e.jsxs("span",{className:"font-mono",children:["0x",s.channelHash]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(he,{className:"w-4 h-4 text-sys-teal flex-shrink-0"}),e.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:t})]}),s.decrypted&&s.decryptedHex&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-edge-subtle",children:[e.jsx("p",{className:"type-micro text-fg-muted mb-1 font-sans",children:"Decrypted Data"}),e.jsx("div",{className:"max-w-full overflow-x-auto",children:e.jsx(Z,{size:"compact",copy:!0,className:"inline-block",children:e.jsx("span",{className:"break-all text-xs",children:s.decryptedHex.toUpperCase()})})})]})]})]})})}function xn({decoded:s,timestamp:a,isLoading:t=!1,onDecrypted:n}){const l=a?de(a):"Unknown",[i,r]=u.useState(""),[c,x]=u.useState(!1),[g,h]=u.useState(null),[f,C]=u.useState(!1),b=u.useCallback(async()=>{if(!(!i.trim()||!s.ciphertextHex||!s.macHex)){x(!0),h(null);try{const o=parseInt(s.channelHash,16),_=us(s.macHex),P=us(s.ciphertextHex),d=await Ct(i.trim(),o,_,P);if(d.success){const w=d.result.plaintext,m=new TextDecoder("utf-8",{fatal:!1}).decode(w.slice(5)),v=m.indexOf(": "),N={...s,channelName:d.result.channelName,decrypted:!0,timestamp:w[0]|w[1]<<8|w[2]<<16|w[3]<<24,flags:w[4],senderName:v>0?m.slice(0,v):void 0,text:v>0?m.slice(v+2):m};n==null||n(N),r(""),C(!1)}else h(d.error)}catch(o){h(o instanceof Error?o.message:"Unknown error")}finally{x(!1)}}},[i,s,n]);return t?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(--elevated) 60%, var(--body))",boxShadow:`
              inset 0 0 0 1px color-mix(in srgb, var(--fg-primary) 6%, transparent),
              inset 0 1px 0 color-mix(in srgb, white 3%, transparent),
              0 1px 2px color-mix(in srgb, black 5%, transparent)
            `},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"})]})})]})}):s.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(--elevated) 60%, var(--body))",boxShadow:`
              inset 0 0 0 1px color-mix(in srgb, var(--fg-primary) 6%, transparent),
              inset 0 1px 0 color-mix(in srgb, white 3%, transparent),
              0 1px 2px color-mix(in srgb, black 5%, transparent)
            `},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.senderName&&e.jsxs("span",{className:"text-[11px] text-fg-muted font-sans",children:["From ",e.jsx("span",{className:"text-fg-secondary font-medium",children:s.senderName})]}),s.channelName&&e.jsxs("span",{className:"text-[11px] text-fg-muted font-sans",children:["in ",e.jsx("span",{className:"text-sys-cyan font-medium",children:s.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:s.text})})]})}):e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-zinc-500/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(--zinc-500) 0%, color-mix(in srgb, var(--zinc-500) 70%, black) 100%)"},children:e.jsx(os,{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-fg-primary font-sans truncate leading-tight",children:s.isPublicHashChannel?"Public Hash Channel":"Encrypted Message"}),e.jsxs("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:["Channel hash: ",e.jsxs("span",{className:"font-mono",children:["0x",s.channelHash]})]})]})]}),e.jsx("div",{className:"mx-4 border-t border-edge-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(he,{className:"w-4 h-4 text-zinc-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:l})]}),s.ciphertextHex&&s.macHex&&e.jsx("div",{className:"space-y-2",children:f?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:i,onChange:o=>r(o.target.value),placeholder:"Channel name (e.g. south-bay)",className:"flex-1 px-3 py-1.5 text-sm rounded-lg bg-subtle-fill-strong border border-edge-subtle text-fg-primary placeholder:text-fg-muted focus:outline-none focus:border-zinc-500",onKeyDown:o=>o.key==="Enter"&&b(),disabled:c}),e.jsx("button",{onClick:b,disabled:c||!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:c?"Testing...":"Try"}),e.jsx("button",{onClick:()=>{C(!1),h(null),r("")},className:"px-2 py-1.5 text-sm rounded-lg hover:bg-subtle-fill-strong text-fg-muted transition-colors",children:"×"})]}),g&&e.jsx("p",{className:"text-xs text-sys-red",children:g})]}):e.jsx("button",{onClick:()=>C(!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"})}),!f&&e.jsx("p",{className:"text-xs text-fg-muted",children:s.isPublicHashChannel?"Public hash channel message. Key not in common channel list.":"Unknown hash channel. Channel name required for decryption."})]})]})})}function mn({decoded:s,timestamp:a}){const t=a?de(a):"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(kt,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-fg-primary font-sans",children:"Acknowledgment"}),e.jsxs("p",{className:"text-xs text-fg-muted font-sans mt-0.5",children:["CRC: ",e.jsxs("span",{className:"font-mono text-sys-green",children:["0x",s.crc]})," · ",t]})]})]})}function hn({decoded:s,timestamp:a}){const t=a?de(a):"Unknown",n=s.path.length;return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-amber/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(ra,{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-fg-primary font-sans truncate leading-tight",children:"Path Response"}),e.jsxs("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:[n," ",n===1?"hop":"hops"]})]})]}),e.jsx("div",{className:"mx-4 border-t border-edge-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(he,{className:"w-4 h-4 text-sys-amber flex-shrink-0"}),e.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:t})]}),s.path.length>0&&e.jsx("div",{className:"mt-2 pt-2 border-t border-edge-subtle",children:e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:s.path.map((l,i)=>e.jsxs("div",{className:"flex items-center gap-2",children:[i>0&&e.jsx(fe,{className:"w-4 h-4 text-sys-amber"}),e.jsx(B,{color:"amber",className:"font-mono",children:l})]},i))})})]})]})})}function un({decoded:s,timestamp:a}){const t=a?de(a):"Unknown",n=s.pathHashes.length,l=s.snrValues.length,i=r=>r>=7?"green":r>=0?"yellow":r>=-5?"orange":"red";return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-blue/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(la,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:["Trace ",s.isComplete?"Complete":"In Progress"]}),e.jsxs("p",{className:"text-sm text-fg-muted mt-0.5",children:["Tag: 0x",s.traceTag.slice(0,8),s.isComplete&&" • ✓"]})]})]}),e.jsx("div",{className:"mx-4 border-t border-edge-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(he,{className:"w-4 h-4 text-sys-blue flex-shrink-0"}),e.jsx("span",{className:"text-sm text-fg-secondary",children:t})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-fg-muted",children:[e.jsxs("span",{children:[n," target ",n===1?"hop":"hops"]}),e.jsx("span",{children:"•"}),e.jsxs("span",{children:[l," SNR ",l===1?"sample":"samples"]}),s.authCode!==0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsxs("span",{children:["Auth: ",s.authCode]})]})]}),s.pathHashes.length>0&&e.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:s.pathHashes.map((r,c)=>{const x=s.snrValues[c],g=x!==void 0?i(x):"zinc",h=x!==void 0;return e.jsxs("div",{className:"flex items-center gap-2",children:[c>0&&e.jsx(fe,{className:"w-4 h-4 text-sys-blue flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(B,{color:h?"blue":"zinc",className:"font-mono",children:r}),h&&e.jsxs(B,{color:g,className:"font-mono",children:[x>=0?"+":"",Number.isInteger(x)?x:x.toFixed(1),"dB"]})]})]},c)})})]})]})})}function pn({decoded:s,timestamp:a}){const t=a?de(a):"Unknown";return s.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-indigo) 0%, var(--sys-blue) 100%)"},children:e.jsx(os,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-fg-primary font-sans",children:"Encrypted Message"}),e.jsxs("p",{className:"text-xs text-fg-muted font-sans mt-0.5",children:[s.srcHash," → ",s.destHash," · ",t]})]})]}):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-fg-muted font-sans",children:[e.jsx("span",{className:"font-mono text-fg-secondary",children:s.srcHash})," → ",e.jsx("span",{className:"font-mono text-fg-secondary",children:s.destHash})]}),e.jsxs("span",{className:"text-[11px] text-fg-muted font-sans",children:["· ",t]})]}),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:s.text})})]})}function fn({decoded:s,timestamp:a}){const t=a?de(a):"Unknown",n=(s.partNumber+1)/s.totalParts*100;return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-yellow/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(na,{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-fg-primary font-sans truncate leading-tight",children:"Multipart Segment"}),e.jsxs("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:["Part ",s.partNumber+1," of ",s.totalParts]})]})]}),e.jsx("div",{className:"mx-4 border-t border-edge-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(Vs,{className:"w-4 h-4 text-sys-yellow flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-fg-secondary font-sans",children:["Message ID: ",e.jsx("span",{className:"font-mono",children:s.messageId})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(he,{className:"w-4 h-4 text-sys-yellow flex-shrink-0"}),e.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:t})]})]})]})})}function gn({decoded:s,timestamp:a,payloadType:t}){const n=a?de(a):"Unknown",i=(()=>{switch(t){case oe.REQ:return{icon:St,gradient:"var(--sys-orange), var(--sys-red)",bg:"rgba(249, 115, 22, 0.15)",label:"Request"};case oe.RESPONSE:return{icon:ha,gradient:"var(--sys-green), var(--sys-teal)",bg:"rgba(34, 197, 94, 0.15)",label:"Response"};case oe.ANON_REQ:return{icon:os,gradient:"var(--sys-indigo), var(--sys-pink)",bg:"rgba(91, 91, 214, 0.15)",label:"Anonymous Request"};default:return{icon:sa,gradient:"var(--sys-gray), var(--sys-slate)",bg:"rgba(107, 114, 128, 0.15)",label:s.payloadTypeName}}})(),r=i.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, ${i.gradient})`},children:e.jsx(r,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-fg-primary font-sans",children:i.label}),e.jsxs("p",{className:"text-xs text-fg-muted font-sans mt-0.5",children:[s.length," bytes · ",n]})]})]})}function yn({pathHex:s}){if(!s)return null;const a=Qe(s);return e.jsx("div",{className:"flex flex-wrap items-center gap-2 py-2",children:a.map((t,n)=>e.jsxs("div",{className:"flex items-center gap-2",children:[n>0&&e.jsx(fe,{className:"w-4 h-4 text-sys-amber flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Z,{size:"compact",copy:!0,children:t.toUpperCase()}),e.jsx("span",{className:"text-xs text-fg-muted font-sans tabular-nums w-4 text-left",children:n+1})]})]},n))})}function jn({decoded:s,payloadType:a}){const t=vt[a]||`TYPE_${a}`;switch(s.type){case"advert":{const n=s.nodeType==="chat"?"companion":s.nodeType.replace("_"," "),l=s.latitude!==void 0&&s.longitude!==void 0&&!(s.latitude===0&&s.longitude===0);return e.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Role:"})," ",n]}),s.name&&e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Name:"})," ",s.name]}),l&&e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Location:"})," ",s.latitude.toFixed(4),"°, ",s.longitude.toFixed(4),"°"]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Time:"})," ",de(s.timestamp)]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Flags:"})," ",s.flagsDescription]})]})}case"ack":return e.jsx("div",{className:"text-xs text-fg-primary space-y-0.5",children:e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"CRC:"})," 0x",s.crc]})});case"path":return e.jsx("div",{className:"text-xs text-fg-primary space-y-1",children:e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Path:"})," ",s.pathString||"(empty)"]})});case"trace":return e.jsxs("div",{className:"text-xs text-fg-primary space-y-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Tag:"})," 0x",s.traceTag]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Target Path:"})," ",s.pathString||"(empty)"]}),s.snrValues.length>0&&e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"SNR:"})," ",s.snrValues.map(n=>`${n>=0?"+":""}${Number.isInteger(n)?n:n.toFixed(1)}dB`).join(" → ")]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Status:"})," ",s.isComplete?"✓ Complete":`In progress (${s.snrValues.length}/${s.pathHashes.length})`]})]});case"txt_msg":return e.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Dest:"})," ",s.destHash]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Src:"})," ",s.srcHash]}),s.encrypted?e.jsx("p",{className:"text-fg-muted italic",children:"Encrypted content"}):e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Text:"})," ",s.text]})]});case"grp_txt":return e.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Channel:"})," ",s.channelName?e.jsx("span",{className:"text-sys-green",children:s.channelName}):s.isPublicHashChannel?e.jsx("span",{className:"text-sys-indigo",children:"Public Hash Channel"}):e.jsxs("span",{className:"font-mono",children:["0x",s.channelHash]})]}),s.decrypted?e.jsxs(e.Fragment,{children:[s.senderName&&e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"From:"})," ",s.senderName]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Text:"})," ",s.text]})]}):s.isPublicHashChannel?e.jsx("p",{className:"text-fg-muted italic",children:"Encrypted (public hash channel)"}):e.jsx("p",{className:"text-fg-muted italic",children:"Encrypted (unknown channel)"})]});case"grp_data":return e.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Channel:"})," ",s.channelName?e.jsx("span",{className:"text-sys-teal",children:s.channelName}):e.jsxs("span",{className:"font-mono",children:["0x",s.channelHash]})]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Data:"})," ",s.dataLength," bytes ",s.decrypted?"(decrypted)":"(encrypted)"]})]});case"multipart":return e.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Part:"})," ",s.partNumber+1,"/",s.totalParts]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Message ID:"})," ",s.messageId]})]});case"control":return e.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Control:"})," ",s.subtypeName]}),s.dataLength>0&&e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Data:"})," ",s.dataLength," bytes"]})]});case"req":case"response":return e.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Dest:"})," ",s.destHash]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Src:"})," ",s.srcHash]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Ciphertext:"})," ",s.ciphertextLength," bytes"]})]});case"anon_req":return e.jsxs("div",{className:"text-xs text-fg-primary space-y-0.5",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Dest:"})," ",s.destHash]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Pub Key:"})," ",e.jsxs("span",{className:"font-mono break-all",children:[s.senderPublicKey.slice(0,16),"…"]})]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-muted",children:"Ciphertext:"})," ",s.ciphertextLength," bytes"]})]});default:return e.jsxs("p",{className:"text-xs text-fg-secondary",children:[t," (","length"in s?s.length:0," bytes)"]})}}function bn({packet:s,decodedGrpTxt:a}){var G,Y;const t=s.raw_packet||"",n=t.length/2,l=ft(),[i,r]=u.useState(null),[c,x]=u.useState(null),[g,h]=u.useState(!1),[f,C]=u.useState(null),b=u.useCallback(D=>{C(J=>J===D?null:D)},[]),o=u.useMemo(()=>Vt(t),[t]),_=(G=o==null?void 0:o.packet)==null?void 0:G.payloadType,P=(o==null?void 0:o.payloadHex)||"",d=(Y=o==null?void 0:o.packet)==null?void 0:Y.payload,w=_===oe.GRP_TXT,m=_===oe.GRP_DATA,v=w&&!a&&(!l||g);if(u.useEffect(()=>{if(r(null),h(!1),a||!w||!d||d.length<4)return;if(!l){h(!0);return}h(!0);let D=!1;return gt(d).then(J=>{D||(r(J),h(!1))}),()=>{D=!0}},[P,w,l,a]),u.useEffect(()=>{if(x(null),!m||!d||d.length<4||!l)return;let D=!1;return yt(d).then(J=>{D||x(J)}),()=>{D=!0}},[P,m,l]),!o||t.length===0)return e.jsx("div",{className:"p-4 text-center text-fg-muted",children:e.jsx("p",{className:"text-sm",children:"No raw packet data available"})});const{packet:N}=o;let y=o.decoded;a&&o.decoded.type==="grp_txt"?y=a:i&&o.decoded.type==="grp_txt"?y=i:c&&o.decoded.type==="grp_data"&&(y=c);const I=()=>{switch(y.type){case"advert":return e.jsx(on,{advert:y,timestamp:s.timestamp});case"grp_data":return e.jsx(dn,{decoded:y,timestamp:s.timestamp});case"grp_txt":return e.jsx(xn,{decoded:y,timestamp:s.timestamp,isLoading:v,onDecrypted:r});case"ack":return e.jsx(mn,{decoded:y,timestamp:s.timestamp});case"path":return e.jsx(hn,{decoded:y,timestamp:s.timestamp});case"trace":return e.jsx(un,{decoded:y,timestamp:s.timestamp});case"txt_msg":return e.jsx(pn,{decoded:y,timestamp:s.timestamp});case"multipart":return e.jsx(fn,{decoded:y,timestamp:s.timestamp});case"generic":return N.payloadType===oe.REQ||N.payloadType===oe.RESPONSE||N.payloadType===oe.ANON_REQ?e.jsx(gn,{decoded:y,timestamp:s.timestamp,payloadType:N.payloadType}):null;default:return null}},A=u.useMemo(()=>rn(y,o.payloadHex),[y,o.payloadHex]),V=f==="payload"||be(f),W=u.useMemo(()=>{const D=[{id:"header",hex:o.headerHex,color:"red"},...o.transportCodesHex?[{id:"transportCodes",hex:o.transportCodesHex,color:"indigo"}]:[],{id:"pathLength",hex:o.pathLengthHex,color:"green"},...o.pathDataHex?[{id:"pathData",hex:o.pathDataHex,color:"amber"}]:[]];return V?[...D,...ln(A)]:[...D,{id:"payload",hex:o.payloadHex,color:"cyan"}]},[o,V,A]);return e.jsxs("div",{className:"font-mono space-y-2 min-w-0 overflow-hidden",children:[I(),e.jsx(Xa,{rawHex:t,hexSegments:W,selectedSegment:f,onSegmentClick:b}),e.jsx(jt,{children:e.jsx(xe.div,{layout:!0,transition:as,className:"space-y-2 min-w-0",children:(()=>{var ne,T,z,ee;const J=[{id:"header",title:"Header",color:"red",startByte:0,endByte:0,hexBytes:`0x${o.headerHex.toUpperCase()}`,condition:!0,content:e.jsxs("table",{className:"w-full text-left",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"type-micro text-fg-muted font-sans",children:[e.jsx("th",{className:"py-1 font-medium",children:e.jsx("span",{className:"underline underline-offset-4 decoration-edge-subtle",children:"Bits"})}),e.jsx("th",{className:"py-1 font-medium",children:e.jsx("span",{className:"underline underline-offset-4 decoration-edge-subtle",children:"Field"})}),e.jsx("th",{className:"py-1 font-medium",children:e.jsx("span",{className:"underline underline-offset-4 decoration-edge-subtle",children:"Value"})}),e.jsx("th",{className:"py-1 font-medium",children:e.jsx("span",{className:"underline underline-offset-4 decoration-edge-subtle",children:"Binary"})})]})}),e.jsx("tbody",{children:o.headerFields.map(M=>e.jsx(cn,{...M},M.bits))})]})},{id:"transportCodes",title:"Transport Codes",color:"indigo",startByte:1,endByte:4,hexBytes:((ne=o.transportCodesHex)==null?void 0:ne.toUpperCase())||"",condition:!!o.transportCodesHex,content:e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-fg-muted",children:"Two 16-bit transport codes for encrypted routing"}),e.jsxs("div",{className:"mt-1 text-xs text-fg-secondary",children:["Code 1: 0x",(T=o.transportCodesHex)==null?void 0:T.slice(0,4).toUpperCase()," | Code 2: 0x",(z=o.transportCodesHex)==null?void 0:z.slice(4,8).toUpperCase()]})]})},{id:"pathLength",title:"Path Length",color:"green",startByte:o.transportCodesHex?5:1,endByte:o.transportCodesHex?5:1,hexBytes:`0x${o.pathLengthHex.toUpperCase()}`,condition:!0,content:e.jsxs("p",{className:"text-xs text-fg-muted pt-1",children:[N.pathLen," bytes showing route taken (increases as packet floods)"]})},{id:"pathData",title:"Path Data",color:"amber",startByte:o.transportCodesHex?6:2,endByte:(o.transportCodesHex?5:1)+N.pathLen,hexBytes:((ee=o.pathDataHex)==null?void 0:ee.toUpperCase())||"",condition:N.pathLen>0,content:e.jsxs("div",{className:"space-y-3",children:[e.jsx(yn,{pathHex:o.pathDataHex}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Historical route taken (bytes are added as packet floods through network)"})]})},{id:"payload",title:"Payload",color:"cyan",startByte:o.payloadStartByte,endByte:n-1,hexBytes:o.payloadHex.toUpperCase(),condition:!0,content:e.jsxs(e.Fragment,{children:[!be(f)&&e.jsxs("div",{className:"p-3 radius-inner bg-inset depth-stroke-inset",children:[e.jsx("p",{className:"type-micro text-fg-muted mb-1.5 font-sans",children:"Decoded"}),e.jsx(jn,{decoded:y,payloadType:N.payloadType})]}),!be(f)&&A.length>0&&e.jsx("p",{className:"type-micro text-fg-muted mt-3 font-sans",children:"Click a field below to highlight its bytes"}),be(f)&&e.jsx("p",{className:"type-micro text-fg-muted font-sans",children:"↑ Selected field above • Other fields below ↓"})]})}].filter(M=>M.condition),L=be(f)?A.find(M=>M.id===f):null,X=be(f)?[...J].sort((M,p)=>M.id==="payload"?-1:p.id==="payload"?1:0):[...J].sort((M,p)=>M.id===f?-1:p.id===f?1:0),U=be(f)?A.filter(M=>M.id!==f):[];return e.jsxs(e.Fragment,{children:[L&&e.jsx(bs,{id:`subfield-${L.id}`,title:L.title,color:L.color,startByte:o.payloadStartByte+L.startByte,endByte:o.payloadStartByte+L.endByte,hexBytes:L.hex.toUpperCase(),isSelected:!0,children:L.decoded},L.id),X.map(M=>e.jsx(bs,{id:`section-${M.id}`,title:M.title,color:M.color,startByte:M.startByte,endByte:M.endByte,hexBytes:M.hexBytes,isSelected:M.id===f,children:M.content},M.id)),U.map(M=>e.jsxs(xe.div,{layout:"position",layoutId:`subfield-${M.id}`,transition:as,className:"w-full min-w-0 overflow-hidden radius-inner p-4 sm:p-5 space-y-4",style:{backgroundColor:Pe.cardRestBg,boxShadow:Pe.cardRestShadow},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(B,{color:M.color,children:M.title}),M.hex.length<=32&&Qe(M.hex).map((p,ae)=>e.jsx(B,{color:M.color,className:"font-mono",children:p.toUpperCase()},ae))]}),e.jsxs("span",{className:"type-data-xs text-fg-muted flex-shrink-0",children:["Bytes ",o.payloadStartByte+M.startByte,"-",o.payloadStartByte+M.endByte]})]}),e.jsx("div",{className:"min-w-0 overflow-hidden p-3 radius-inner bg-inset depth-stroke-inset",children:M.decoded})]},M.id))]})})()})})]})}const Ns=u.memo(bn);function vs(s){if(!s)return[];if(Array.isArray(s))return s;try{const a=JSON.parse(s);return Array.isArray(a)?a:[]}catch{return[]}}function ns({hop:s,compact:a=!1,index:t=0,highlightIndex:n=-1,isTrace:l=!1}){var c;const i=t===n,r=ba();return u.useEffect(()=>{i&&l&&r.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"}})},[i,l,r]),e.jsxs(xe.div,{className:F("flex items-center gap-1.5",a?"flex-row":"flex-col"),animate:{scale:i?1.05:1,opacity:i?1:.85},transition:{duration:.3,ease:"easeInOut"},children:[e.jsxs(xe.div,{className:F("flex items-center gap-1.5 px-2.5 py-1 rounded-md","font-mono text-xs font-semibold",s.isLocal?"bg-sys-amber/20 text-sys-amber ring-1 ring-sys-amber/30":"bg-elevated/50 text-fg-primary ring-1 ring-edge-strong/50"),animate:r,initial:{boxShadow:"0 0 0 0px rgba(113, 156, 223, 0)"},children:[s.isLocal&&e.jsx(ia,{className:"w-3 h-3"}),e.jsx("span",{children:s.prefix}),s.confidence!==void 0&&s.confidence<.9&&e.jsxs("span",{className:"text-[9px] opacity-70",children:[(s.confidence*100).toFixed(0),"%"]})]}),!a&&((c=s.neighborInfo)==null?void 0:c.name)&&e.jsx("span",{className:"text-xs text-fg-muted truncate max-w-[80px]",children:s.neighborInfo.name})]})}function Nn({snr:s,sf:a}){const t=Mt(s,a),l=Bt()[t]||"#6b7280",i=Number.isInteger(s)?s.toString():s.toFixed(1);return e.jsxs(B,{customColor:l,compact:!0,className:"font-mono",children:[s>=0?"+":"",i,"dB"]})}function vn({hops:s,compact:a,isTrace:t=!1,sf:n}){const[l,i]=u.useState(-1);return u.useEffect(()=>{if(s.length===0)return;const r=setTimeout(()=>{i(0)},400),c=setInterval(()=>{i(x=>{const g=x+1;return g>=s.length?(clearInterval(c),-1):g})},t?500:600);return()=>{clearTimeout(r),clearInterval(c)}},[s.length,t]),e.jsx("div",{className:"p-6",style:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"4px 8px"},children:s.map((r,c)=>{const x=c%2===0,g=c===s.length-1;return e.jsxs("div",{className:"contents",children:[e.jsx("div",{className:F("flex items-center","justify-end"),children:x&&e.jsx(ns,{hop:r,compact:a,index:c,highlightIndex:l,isTrace:t})}),e.jsx("div",{className:"flex flex-col items-center justify-center min-h-[28px]",children:!g&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px flex-1 bg-border-strong/40 min-h-[8px]"}),r.snr!==void 0&&e.jsx(Nn,{snr:r.snr,sf:n}),e.jsx("svg",{className:"w-3 h-3 text-fg-muted 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:F("flex items-center","justify-start"),children:!x&&e.jsx(ns,{hop:r,compact:a,index:c,highlightIndex:l,isTrace:t})})]},`${r.prefix}-${c}`)})})}function wn({packet:s,neighbors:a,localHash:t,neighborAffinity:n,ghostPrefixes:l,direction:i="horizontal",compact:r=!1,traceSnr:c,overridePath:x}){const g=c!==void 0&&c.length>0,h=Tt(),f=vs(s.original_path),C=vs(s.forwarded_path),b=x??(C.length>0?C:f),o=t?Se(t):"",_=u.useMemo(()=>b.map((d,w)=>{const m=d.toUpperCase(),v=m===o,N=(l==null?void 0:l.has(m))??!1,y=Pt(m,a,n);return{prefix:m,fullHash:y==null?void 0:y.hash,neighborInfo:y==null?void 0:y.info,isLocal:v,isGhost:N,confidence:y==null?void 0:y.confidence,snr:c==null?void 0:c[w]}}),[b,a,n,o,l,c]);if(_.length===0)return e.jsxs("div",{className:"flex items-center gap-2 text-fg-muted text-xs",children:[e.jsx(me,{className:"w-4 h-4 opacity-50"}),e.jsx("span",{children:"Direct / No path data"})]});if(i==="flowchart")return e.jsx(vn,{hops:_,compact:r,isTrace:g,sf:h});const P=i==="horizontal"?fe:Os;return e.jsx("div",{className:F("flex gap-1.5",i==="horizontal"?"flex-row flex-wrap items-center":"flex-col items-start"),children:_.map((d,w)=>e.jsxs("div",{className:F("flex items-center gap-1.5",i==="vertical"&&"flex-col"),children:[e.jsx(ns,{hop:d,compact:r}),w<_.length-1&&e.jsx(P,{className:"w-3 h-3 text-fg-muted flex-shrink-0"})]},`${d.prefix}-${w}`))})}const _e=u.memo(wn);function re(s,a){if(s!=null)return typeof s=="boolean"?String(s):typeof s=="number"&&a?`${s} ${a}`:String(s)}const O=()=>"blue",kn=[{fn:"id",group:"identity",fmt:"int",read:s=>re(s.id),color:O},{fn:"packet_hash",group:"identity",fmt:"hex<sha256>",read:s=>s.packet_hash||void 0,color:O},{fn:"timestamp",group:"identity",fmt:"epoch<s>",read:s=>s.timestamp?String(s.timestamp):void 0,color:O,annotate:s=>s.timestamp>0?es(s.timestamp):void 0},{fn:"type",group:"classification",fmt:"enum<payload_type>",read:s=>re(s.type??s.payload_type),color:O},{fn:"route",group:"classification",fmt:"enum<route_type>",read:s=>re(s.route??s.route_type),color:O},{fn:"rssi",group:"signal",fmt:"int<dBm>",read:s=>re(s.rssi,"dBm"),color:O},{fn:"snr",group:"signal",fmt:"float<dB>",read:s=>re(s.snr,"dB"),color:O},{fn:"path_length",group:"size",fmt:"int<hops>",read:s=>{if(s.path_length!=null)return s.path_length===0?"zero-hop":`${s.path_length} hops`},color:O},{fn:"payload_length",group:"size",fmt:"int<B>",read:s=>re(s.payload_length,"B"),color:O},{fn:"airtime",group:"size",fmt:"float<ms>",read:s=>re(s.airtime_ms,"ms"),color:O},{fn:"src_hash",group:"addressing",fmt:"hex<2>",read:s=>s.src_hash??void 0,color:O},{fn:"dst_hash",group:"addressing",fmt:"hex<2>",read:s=>s.dst_hash??void 0,color:O},{fn:"path_hash",group:"addressing",fmt:"hex[]|hex",read:s=>Array.isArray(s.path_hash)?`[${s.path_hash.join(", ")}]`:re(s.path_hash),color:O,renderValue:s=>Array.isArray(s.path_hash)?Xe(s.path_hash):null},{fn:"score",group:"addressing",fmt:"int",read:s=>re(s.score),color:O},{fn:"original_path",group:"paths",fmt:"hex[]",read:s=>Array.isArray(s.original_path)?`[${s.original_path.join(", ")}]`:void 0,color:O,renderValue:s=>Array.isArray(s.original_path)&&s.original_path.length>0?Xe(s.original_path,s.src_hash||void 0,s.dst_hash||void 0,!0):null},{fn:"forwarded_path",group:"paths",fmt:"hex[]",read:s=>Array.isArray(s.forwarded_path)?`[${s.forwarded_path.join(", ")}]`:void 0,color:O,renderValue:s=>Array.isArray(s.forwarded_path)&&s.forwarded_path.length>0?Xe(s.forwarded_path):null},{fn:"transmitted",group:"status",fmt:"bool",read:s=>re(s.transmitted),color:O},{fn:"is_duplicate",group:"status",fmt:"bool",read:s=>re(s.is_duplicate),color:O},{fn:"drop_reason",group:"status",fmt:"string|null",read:s=>s.drop_reason??void 0,color:O},{fn:"tx_delay",group:"status",fmt:"int<ms>",read:s=>re(s.tx_delay_ms,"ms"),color:O},{fn:"origin",group:"status",fmt:"enum<rx|tx_local|tx_forward>",read:s=>s.packet_origin??void 0,color:O},{fn:"duplicates",group:"status",fmt:"PacketDuplicate[]",read:s=>s.duplicates!=null&&s.duplicates.length>0?`${s.duplicates.length}`:re(s.duplicates),color:O},{fn:"lbt_attempts",group:"lbt",fmt:"int",read:s=>re(s.lbt_attempts),color:O},{fn:"lbt_backoff",group:"lbt",fmt:"json<float[]>",read:s=>re(s.lbt_backoff_delays_ms),color:O},{fn:"lbt_busy",group:"lbt",fmt:"bool|int",read:s=>re(s.lbt_channel_busy),color:O}];function Xe(s,a,t,n){const l=s.length>0,i=a||n,r=t||n;return e.jsxs("span",{className:"inline-flex items-center gap-1 flex-wrap",children:[i&&e.jsxs(e.Fragment,{children:[a?e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-1.5 py-0.5 font-mono text-[11px] text-sys-blue",children:a}):e.jsx("span",{className:"inline-block border border-edge-subtle/50 rounded px-1.5 py-0.5 font-mono text-[11px] text-fg-muted/30",children:"XX"}),(l||r)&&e.jsx("span",{className:"text-fg-muted/40 text-[10px]",children:"→"})]}),s.map((c,x)=>e.jsxs(u.Fragment,{children:[x>0&&e.jsx("span",{className:"text-fg-muted/40 text-[10px]",children:"→"}),e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-1.5 py-0.5 font-mono text-[11px] text-sys-blue",children:c})]},x)),r&&e.jsxs(e.Fragment,{children:[l&&e.jsx("span",{className:"text-fg-muted/40 text-[10px]",children:"→"}),t?e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-1.5 py-0.5 font-mono text-[11px] text-sys-blue",children:t}):e.jsx("span",{className:"inline-block border border-edge-subtle/50 rounded px-1.5 py-0.5 font-mono text-[11px] text-fg-muted/30",children:"XX"})]})]})}let ze=null;function Cn(){if(!ze){ze=new Map;for(const s of kn)ze.set(s.fn,s)}return ze}function ws(s,a){var r;const t=Cn().get(a);if(!t)return null;const n=t.read(s);if(n===void 0)return null;const l=t.color(s),i=(r=t.annotate)==null?void 0:r.call(t,s);return i?{text:n,color:l,annotation:i}:{text:n,color:l}}function ks(s){if(!s)return[];if(Array.isArray(s))return s;try{const a=JSON.parse(s);return Array.isArray(a)?a:[]}catch{return[]}}function Cs({packets:s,selectedIndex:a,onSelect:t,compact:n=!1}){if(s.length<=1)return null;const l=a>0,i=a<s.length-1;return e.jsxs("div",{className:F("flex items-center gap-1",n?"gap-0.5":"gap-1"),children:[e.jsx("button",{onClick:()=>l&&t(a-1),disabled:!l,className:F("p-0.5 radius-badge transition-base",l?"text-fg-muted hover:text-fg-primary hover-bg":"text-fg-muted cursor-not-allowed"),"aria-label":"Previous observation",children:e.jsx(Gs,{className:n?"size-3":"size-4"})}),e.jsx("div",{className:"flex items-center gap-0.5",children:s.map((r,c)=>{const x=c===a,h=new Date(r.timestamp*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});return e.jsx(zt,{color:x?"cyan":"zinc",filled:x,compact:n,onClick:()=>t(c),title:`Observation ${c+1} at ${h}`,className:F("transition-all duration-150",!x&&"opacity-60 hover:opacity-100"),children:n?e.jsx("span",{className:"tabular-nums",children:c+1}):e.jsxs("span",{className:"tabular-nums text-xs",children:["#",c+1,r.rssi!=null&&e.jsx("span",{className:"ml-1 opacity-70",children:r.rssi})]})},`${r.timestamp}_${c}`)})}),e.jsx("button",{onClick:()=>i&&t(a+1),disabled:!i,className:F("p-0.5 radius-badge transition-base",i?"text-fg-muted hover:text-fg-primary hover-bg":"text-fg-muted cursor-not-allowed"),"aria-label":"Next observation",children:e.jsx(cs,{className:n?"size-3":"size-4"})}),e.jsxs("span",{className:F("text-fg-muted ml-1",n?"text-[9px]":"text-xs"),children:[e.jsx(ls,{className:"inline size-3 mr-0.5 opacity-50"}),s.length]})]})}function Ee({icon:s,label:a,disabled:t=!1}){return e.jsx(xe.div,{className:"flex items-center gap-1 text-xs",title:a,animate:{opacity:t?.25:.6},transition:{duration:.15,ease:[.4,0,.2,1]},children:e.jsx("span",{className:F("flex items-center justify-center size-5 radius-badge border-control transition-base",t?"bg-subtle-fill border-edge-subtle":"bg-subtle-fill"),children:s})})}function _n({hasDuplicates:s,hasPrev:a,hasNext:t,canPrevDupe:n,canNextDupe:l}){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(Ee,{icon:e.jsx(Ut,{className:"size-3"}),label:"Previous packet (↑)",disabled:!a}),e.jsx(Ee,{icon:e.jsx(Et,{className:"size-3"}),label:"Next packet (↓)",disabled:!t})]}),s&&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(Ee,{icon:e.jsx(Gs,{className:"size-3"}),label:"Previous observation (←)",disabled:!n}),e.jsx(Ee,{icon:e.jsx(cs,{className:"size-3"}),label:"Next observation (→)",disabled:!l})]})]})]})}function Sn({packets:s,initialIndex:a=0,onClose:t,onNavigatePrev:n,onNavigateNext:l,hasPrev:i=!1,hasNext:r=!1,resolveSource:c,getDecodedContent:x}){var De;const[g,h]=u.useState(a),f=s[g]??s[0],C=s.length>1,[b,o]=u.useState(null),[_,P]=u.useState(!1);u.useEffect(()=>{if(!f._stripped){o(null);return}let Q=!1;P(!0);const j=f.packet_hash;if(!j){P(!1);return}return Lt(j).then(k=>{Q||(k.success&&k.data&&(o(k.data),(k.data.type??k.data.payload_type)===oe.GRP_TXT&&k.data.raw_packet&&Rt.getState().queueDecryption([k.data])),P(!1))}).catch(()=>{Q||P(!1)}),()=>{Q=!0}},[f]);const d=b??f,w=g>0,m=g<s.length-1,v=u.useCallback(Q=>{h(Math.max(0,Math.min(Q,s.length-1)))},[s.length]);u.useEffect(()=>{const Q=j=>{if(!(j.target instanceof HTMLInputElement||j.target instanceof HTMLTextAreaElement))switch(j.key){case"ArrowUp":j.preventDefault(),n==null||n();break;case"ArrowDown":j.preventDefault(),l==null||l();break;case"ArrowLeft":j.preventDefault(),w&&h(k=>k-1);break;case"ArrowRight":j.preventDefault(),m&&h(k=>k+1);break}};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[n,l,w,m]);const N=As(),y=Ht(),I=Ft(),A=Dt(),V=u.useMemo(()=>new Set(A.map(Q=>Q.prefix.toUpperCase())),[A]),W=d.payload_type_name||Fs(d.payload_type??d.type),G=d.route_type_name||Ds(d.route_type??d.route),Y=d.payload_length??d.length??0,D=d.path_hash_size,J=ks(d.original_path),L=ks(d.forwarded_path),X=J.length>0||L.length>0,U=L.length>0?L:J,ne=u.useMemo(()=>{var Q;if((Q=N==null?void 0:N.config)!=null&&Q.repeater)return{latitude:N.config.repeater.latitude,longitude:N.config.repeater.longitude,name:N.config.node_name||"Local Node"}},[N]),T=(N==null?void 0:N.neighbors)??{},z=I.size>0?I:void 0,ee=d.raw_packet&&d.raw_packet.length>0,M=f._stripped&&_,p=u.useMemo(()=>c?c(d):null,[c,d]),ae=At(d.packet_hash),se=u.useMemo(()=>!x||(d.payload_type??d.type)!==oe.GRP_TXT?null:x(d),[x,d]),le=u.useMemo(()=>{if((d.payload_type??d.type)!==oe.GRP_TXT)return null;if(ae!=null&&ae.decoded){const j=ae.decoded;return{type:"grp_txt",channelHash:j.channelHash,channelName:j.channelName,text:j.text??"",decrypted:j.decrypted,senderName:j.senderName,timestamp:j.timestamp,flags:j.flags,macCorrupted:j.macCorrupted}}return se!=null&&se.decrypted?{type:"grp_txt",channelHash:se.channelHash??"",channelName:se.channelName??"",text:se.text??"",decrypted:!0,senderName:se.senderName??"",timestamp:0,flags:0,macCorrupted:se.corrupted}:null},[d,ae,se]),te=u.useMemo(()=>aa(d,le),[d,le]),S=te.kind==="trace"?te.data:null,K=te.kind==="trace"?te.snrValues:void 0,R=te.kind==="advert"?te.data:null,$=te.kind==="advert"?te.sourceNode:void 0,ie=te.kind==="grp_txt"?te.wardriveSourceNode??void 0:void 0,ce=te.kind==="anon_req"?te.data:null,Re=Q=>!Q||Q===0?"Unknown":new Date(Q*1e3).toLocaleString(),Ne=(d.payload_type??d.type)===oe.ADVERT&&($!==void 0||X),He=ie!==void 0,ve=$??ie,We=Le[W]??"zinc",Fe=pe[We]||pe.zinc;return e.jsxs(zs,{open:!0,onClose:t,size:"5xl",motionPlus:!0,solid:!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-fg-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(B,{color:Le[W]??"zinc",className:"!text-[9px] !px-1.5 !py-0",children:W}),e.jsx(B,{color:Ie[G]??"zinc",className:"!text-[9px] !px-1.5 !py-0",children:G}),e.jsxs(B,{color:"zinc",className:"!text-[9px] !px-1.5 !py-0",children:[Y,"B"]}),D!=null&&D>1&&e.jsxs(B,{color:"orange",className:"!text-[9px] !px-1.5 !py-0",children:[D,"B hashes"]})]}),e.jsx("button",{onClick:t,className:"px-3 py-1.5 text-[15px] font-medium text-sys-blue active:text-sys-blue/80 transition-base flex-shrink-0 radius-inner active:bg-subtle-fill",children:"Done"})]}),C&&e.jsx("div",{className:"px-3 pb-2",children:e.jsx(Cs,{packets:s,selectedIndex:g,onSelect:v,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(B,{color:Le[W]??"zinc",children:W}),e.jsx(B,{color:Ie[G]??"zinc",children:G}),e.jsxs(B,{color:"zinc",children:[Y,"B"]}),D!=null&&D>1&&e.jsxs(B,{color:"orange",children:[D,"B hashes"]}),C&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-4 bg-subtle-fill-strong"}),e.jsx(Cs,{packets:s,selectedIndex:g,onSelect:v})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_n,{hasDuplicates:C,hasPrev:i,hasNext:r,canPrevDupe:w,canNextDupe:m}),e.jsx("button",{onClick:t,className:"p-1.5 -m-1.5 text-fg-muted hover:text-fg-primary transition-base radius-inner hover:bg-elevated flex-shrink-0",children: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:Fe,opacity:.6}}),e.jsxs(Es,{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:"px-2 pt-2 space-y-2",children:[(d.rssi!=null||d.snr!=null)&&e.jsxs("div",{className:"relative flex items-center justify-between px-2 py-1.5 radius-inner bg-subtle-fill depth-stroke",children:[e.jsx(Ke,{mode:"popLayout",initial:!1,children:e.jsxs(xe.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($e,{rssi:d.rssi,snr:d.snr,compact:!0,showValues:!0,validated:Ue(d)}),e.jsx("span",{className:"text-[11px] text-fg-muted",children:ps(d.rssi)})]},g)}),U.length>0&&e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[U.length," hop",U.length!==1?"s":""]})]}),(X&&U.length>0||Ne||He)&&e.jsx("div",{className:"overflow-hidden",children:e.jsx("div",{className:"aspect-[4/3] w-full",children:e.jsx(Ge,{path:U,neighbors:T,localNode:ne,localHash:N==null?void 0:N.local_hash,srcHash:d.src_hash,dstHash:d.dst_hash,neighborAffinity:z,hubNodes:[...y],traceSnr:K,advertiserSource:ve})})}),S&&S.pathHashes.length>0&&e.jsxs("div",{className:"radius-inner bg-inset overflow-hidden depth-stroke-inset",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:"type-micro text-fg-muted",children:"Trace Route"}),e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx(B,{color:S.isComplete?"green":"amber",compact:!0,children:S.isComplete?"Complete":"In Progress"})})]})}),e.jsx(_e,{packet:d,neighbors:T,localHash:N==null?void 0:N.local_hash,neighborAffinity:z,ghostPrefixes:V,direction:"flowchart",compact:!0,overridePath:S.pathHashes,traceSnr:S.snrValues})]}),X&&!S&&e.jsxs("div",{className:"radius-inner bg-inset overflow-hidden depth-stroke-inset",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[e.jsx("span",{className:"type-micro text-fg-muted",children:"Path"}),e.jsxs(B,{color:"zinc",compact:!0,children:[U.length," hop",U.length!==1?"s":""]})]}),e.jsx(_e,{packet:d,neighbors:T,localHash:N==null?void 0:N.local_hash,neighborAffinity:z,ghostPrefixes:V,direction:"flowchart",compact:!0,traceSnr:K})]}),p&&(p.name||p.hash)&&!R&&!ce&&e.jsxs("div",{className:"radius-inner bg-subtle-fill overflow-hidden depth-stroke",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[e.jsx("span",{className:"type-micro text-fg-muted",children:"Source"}),e.jsx(B,{color:p.isRepeater?"blue":p.isCompanion?"violet":p.type==="room_server"?"lime":"zinc",compact:!0,children:p.type==="room_server"?"room server":p.type})]}),e.jsxs("div",{className:"p-3 space-y-1.5",children:[p.name&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"type-label text-fg-primary truncate",children:p.name}),!p.confident&&e.jsx("span",{className:"text-[9px] text-fg-muted/60 italic",children:"ambiguous"})]}),p.hash&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"type-data-xs text-fg-muted truncate font-mono",children:p.hash.length>16?`${p.hash.slice(0,16)}…${p.hash.slice(-8)}`:p.hash.startsWith("0x")?p.hash.slice(2,10)+"…":p.hash.slice(0,8)+"…"})]})]})]}),ce&&e.jsxs("div",{className:"radius-inner bg-subtle-fill overflow-hidden depth-stroke",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[e.jsx("span",{className:"type-micro text-fg-muted",children:"Sender Identity"}),e.jsx(B,{color:p!=null&&p.isRepeater?"blue":p!=null&&p.isCompanion?"violet":(p==null?void 0:p.type)==="room_server"?"lime":"amber",compact:!0,children:p!=null&&p.type&&p.type!=="unknown"?p.type==="room_server"?"room server":p.type:"companion"})]}),e.jsxs("div",{className:"p-3 space-y-2",children:[(p==null?void 0:p.name)&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"type-label text-fg-primary truncate",children:p.name}),!p.confident&&e.jsx("span",{className:"text-[9px] text-fg-muted/60 italic",children:"ambiguous"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsxs("span",{className:"text-xs text-fg-muted",children:["Dest: ",e.jsx("span",{className:"font-mono",children:ce.destHash})]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ke,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0 mt-0.5"}),e.jsx("span",{className:"type-data-xs text-fg-muted break-all font-mono leading-relaxed",children:ce.senderPublicKey})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsxs("span",{className:"text-xs text-fg-muted",children:[ce.ciphertextLength,"B encrypted payload"]})]})]})]}),R&&e.jsxs("div",{className:"radius-inner bg-subtle-fill overflow-hidden depth-stroke",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[e.jsx("span",{className:"type-micro text-fg-muted",children:"Advertiser Info"}),e.jsx(B,{color:"lime",compact:!0,children:R.nodeType})]}),e.jsxs("div",{className:"p-3 space-y-2",children:[R.name&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"type-label text-fg-primary truncate",children:R.name})]}),R.latitude&&R.longitude&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Oe,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsxs("span",{className:"type-data-xs text-fg-secondary",children:[R.latitude.toFixed(5),", ",R.longitude.toFixed(5)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsxs("span",{className:"type-data-xs text-fg-muted truncate",children:[R.publicKey.slice(0,16),"...",R.publicKey.slice(-8)]})]}),R.timestamp>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"text-xs text-fg-muted",children:Re(R.timestamp)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{className:"w-3.5 h-3.5 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"text-xs text-fg-muted",children:R.flagsDescription||`Flags: 0x${R.flags.toString(16).padStart(2,"0")}`})]})]})]}),M?e.jsx("div",{className:"pt-1 px-3 py-6 text-center",children:e.jsx("span",{className:"text-xs text-fg-muted animate-pulse",children:"Loading packet details…"})}):ee?e.jsx("div",{className:"pt-1",children:e.jsx(Ns,{packet:d,decodedGrpTxt:le})}):null]})}),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 px-4 pt-4",children:M?e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("span",{className:"text-sm text-fg-muted animate-pulse",children:"Loading packet details…"})}):ee?e.jsx(Ns,{packet:d,decodedGrpTxt:le}):null}),e.jsxs("div",{className:"grid overflow-hidden",style:{gridTemplateRows:"minmax(280px, 1fr) auto"},children:[e.jsx("div",{className:"overflow-hidden p-2",children:X&&U.length>0||Ne||He?e.jsx("div",{className:"h-full w-full overflow-hidden",children:e.jsx(Ge,{path:U,neighbors:T,localNode:ne,localHash:N==null?void 0:N.local_hash,srcHash:d.src_hash,dstHash:d.dst_hash,neighborAffinity:z,hubNodes:[...y],traceSnr:K,advertiserSource:ve})}):e.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center text-center px-4",children:[e.jsx(me,{className:"w-8 h-8 text-fg-muted/50 mb-2"}),e.jsx("span",{className:"text-sm text-fg-muted",children:"Direct Reception"}),e.jsx("span",{className:"text-xs text-fg-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:[!S&&U.length<=1&&(d.rssi!=null||d.snr!=null)&&e.jsx("div",{className:"surface-base radius-inner p-4 depth-stroke",children:e.jsxs("dl",{className:"text-xs grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-fg-muted mb-1",children:"Signal"}),e.jsx(Ke,{mode:"popLayout",initial:!1,children:e.jsxs(xe.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($e,{rssi:d.rssi,snr:d.snr,validated:Ue(d)}),e.jsx("span",{className:"font-medium text-fg-primary",children:ps(d.rssi)})]},g)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-fg-muted mb-1",children:"RF"}),e.jsx(Ke,{mode:"popLayout",initial:!1,children:e.jsxs(xe.dd,{className:"type-data text-fg-secondary",initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:{duration:.15,ease:[.4,0,.2,1]},children:[(De=ws(d,"rssi"))==null?void 0:De.text,(()=>{const Q=ws(d,"snr");return Q?` · ${Q.text}`:null})()]},g)})]})]})}),p&&(p.name||p.hash)&&!R&&!ce&&e.jsxs("div",{className:"radius-inner bg-subtle-fill overflow-hidden depth-stroke",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2",children:[e.jsx("span",{className:"type-micro text-fg-muted",children:"Source"}),e.jsx(B,{color:p.isRepeater?"blue":p.isCompanion?"violet":p.type==="room_server"?"lime":"zinc",compact:!0,children:p.type==="room_server"?"room server":p.type})]}),e.jsxs("div",{className:"p-4 space-y-2",children:[p.name&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"type-label text-fg-primary truncate",children:p.name}),!p.confident&&e.jsx("span",{className:"text-[10px] text-fg-muted/60 italic",children:"ambiguous"})]}),p.hash&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"text-[11px] font-mono text-fg-muted truncate",children:p.hash.length>16?`${p.hash.slice(0,16)}…${p.hash.slice(-8)}`:p.hash.startsWith("0x")?p.hash.slice(2,10)+"…":p.hash.slice(0,8)+"…"})]})]})]}),ce&&e.jsxs("div",{className:"radius-inner bg-subtle-fill overflow-hidden depth-stroke",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2",children:[e.jsx("span",{className:"type-micro text-fg-muted",children:"Sender Identity"}),e.jsx(B,{color:p!=null&&p.isRepeater?"blue":p!=null&&p.isCompanion?"violet":(p==null?void 0:p.type)==="room_server"?"lime":"amber",compact:!0,children:p!=null&&p.type&&p.type!=="unknown"?p.type==="room_server"?"room server":p.type:"companion"})]}),e.jsxs("div",{className:"p-4 space-y-2.5",children:[(p==null?void 0:p.name)&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"type-label text-fg-primary truncate",children:p.name}),!p.confident&&e.jsx("span",{className:"text-[10px] text-fg-muted/60 italic",children:"ambiguous"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),e.jsxs("span",{className:"text-xs text-fg-muted",children:["Dest: ",e.jsx("span",{className:"font-mono",children:ce.destHash})]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ke,{className:"w-4 h-4 text-fg-muted flex-shrink-0 mt-0.5"}),e.jsx("span",{className:"text-[11px] font-mono text-fg-muted break-all leading-relaxed",children:ce.senderPublicKey})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),e.jsxs("span",{className:"text-xs text-fg-muted",children:[ce.ciphertextLength,"B encrypted payload"]})]})]})]}),R&&e.jsxs("div",{className:"radius-inner bg-subtle-fill overflow-hidden depth-stroke",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2",children:[e.jsx("span",{className:"type-micro text-fg-muted",children:"Advertiser"}),e.jsx(B,{color:"lime",compact:!0,children:R.nodeType})]}),e.jsxs("div",{className:"p-4 space-y-2.5",children:[R.name&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ce,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"type-label text-fg-primary truncate",children:R.name})]}),R.latitude&&R.longitude&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Oe,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),e.jsxs("span",{className:"type-data-xs text-fg-secondary",children:[R.latitude.toFixed(5),", ",R.longitude.toFixed(5)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),e.jsxs("span",{className:"text-[11px] font-mono text-fg-muted truncate",children:[R.publicKey.slice(0,16),"...",R.publicKey.slice(-8)]})]}),R.timestamp>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"text-xs text-fg-muted",children:Re(R.timestamp)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{className:"w-4 h-4 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"text-[11px] text-fg-muted",children:R.flagsDescription||`Flags: 0x${R.flags.toString(16).padStart(2,"0")}`})]})]})]}),S&&S.pathHashes.length>0&&e.jsxs("div",{className:"radius-inner bg-inset overflow-hidden depth-stroke-inset",children:[e.jsxs("div",{className:"px-4 py-2 flex items-center justify-between",children:[e.jsx("span",{className:"type-micro text-fg-muted",children:"Trace Route"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(B,{color:S.isComplete?"green":"amber",compact:!0,children:S.isComplete?"Complete":"In Progress"}),e.jsxs(B,{color:"teal",compact:!0,children:[S.pathHashes.length,"h"]})]})]}),e.jsx(_e,{packet:d,neighbors:T,localHash:N==null?void 0:N.local_hash,neighborAffinity:z,ghostPrefixes:V,direction:"flowchart",compact:!0,overridePath:S.pathHashes,traceSnr:S.snrValues})]}),X&&!S&&e.jsxs("div",{className:"radius-inner bg-inset overflow-hidden depth-stroke-inset",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2",children:[e.jsx("span",{className:"type-micro text-fg-muted",children:"Path"}),e.jsxs(B,{color:"zinc",compact:!0,children:[U.length,"h"]})]}),e.jsx(_e,{packet:d,neighbors:T,localHash:N==null?void 0:N.local_hash,neighborAffinity:z,ghostPrefixes:V,direction:"flowchart",compact:!0,traceSnr:K})]})]})]})]})]})]})}const Tn=u.memo(Sn);function _s({label:s,numericValue:a,unit:t,icon:n,subtext:l,showSign:i=!1}){return e.jsxs("div",{className:"radius-inner p-3 sm:radius-inset sm:p-4 bg-subtle-fill ring-1 ring-inset ring-edge-subtle",children:[e.jsx("div",{className:"mb-1.5 sm:mb-2",children:e.jsx("span",{className:"text-xs sm:type-micro text-fg-muted",children:s})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ss,{value:a,format:{minimumFractionDigits:1,maximumFractionDigits:1,signDisplay:i?"always":"auto"},className:"type-data-hero tracking-tight text-fg-primary"}),e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsx(n,{className:"w-[14px] h-[14px] text-fg-muted"}),t&&e.jsx("span",{className:"text-xs font-medium leading-tight text-fg-muted",children:t})]})]}),l&&e.jsx("p",{className:"mt-1.5 sm:mt-2 type-data-xs sm:text-[11px] text-fg-muted/80 truncate",children:l})]})}function Pn({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:F("w-1.5 h-1.5 rounded-full flex-shrink-0",a),title:`SNR: ${s.toFixed(1)} dB`})}function Ss({fromPrefix:s,toPrefix:a,fromName:t,toName:n,snr:l,maxSnr:i,isWeakest:r,isStrongest:c,index:x=0}){const h=Math.max(i+5,15),f=Math.max(0,Math.min(100,(l- -20)/(h- -20)*100)),C="bg-[#0074BE]",b=l>=5?"bg-sys-teal":l>=0?"bg-sys-green":l>=-5?"bg-sys-amber":l>=-10?"bg-sys-orange":"bg-sys-red",o=.3+x*.15;return e.jsxs("div",{className:"relative p-3 pl-5 radius-inner bg-subtle-fill ring-1 ring-inset ring-edge-subtle",children:[e.jsx("span",{className:F("absolute left-0 top-1/2 -translate-y-1/2 h-4 w-0.5 rounded-full",b)}),e.jsx("span",{className:"absolute -top-0.5 -right-0.5",children:e.jsx(Pn,{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-fg-secondary truncate",children:t||s}),e.jsx(fe,{className:"w-3 h-3 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"text-[13px] font-semibold text-fg-primary truncate",children:n||a})]}),e.jsxs("div",{className:"flex items-center gap-1.5 ml-2 flex-shrink-0",children:[r&&e.jsx(B,{color:"red",compact:!0,children:"Low"}),c&&!r&&e.jsxs(B,{color:"amber",compact:!0,children:[e.jsx(ys,{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-fg-primary ring-1 ring-inset ring-edge-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(xe.div,{className:F("h-full rounded-full",C),initial:{width:0},animate:{width:`${f}%`},transition:{duration:1.5,delay:o,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:"type-data-xs text-fg-muted",children:s}),t&&e.jsx("span",{className:"text-xs text-fg-secondary truncate max-w-[100px]",children:t})]}),e.jsx(fe,{className:"w-3 h-3 text-fg-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-fg-primary",children:a}),n&&e.jsx("span",{className:"text-xs text-fg-secondary truncate max-w-[100px]",children:n})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[r&&e.jsx(B,{color:"red",compact:!0,children:"Bottleneck"}),c&&!r&&e.jsxs(B,{color:"amber",compact:!0,children:[e.jsx(ys,{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-fg-primary ring-1 ring-inset ring-edge-subtle",children:[l>=0?"+":"−",Math.abs(l).toFixed(1)]})]})]}),e.jsx("div",{className:"h-1.5 bg-elevated rounded-full overflow-hidden",children:e.jsx(xe.div,{className:F("h-full rounded-full",C),initial:{width:0},animate:{width:`${f}%`},transition:{duration:1.5,delay:o,ease:[.25,.1,.25,1]}})})]})]})}function ye(s,a){if(s==="You")return"You";const t=s.toUpperCase();for(const[n,l]of Object.entries(a))if((n.startsWith("0x")?n.slice(2,4):n.slice(0,2)).toUpperCase()===t)return l.name||l.node_name||void 0}function Bn({report:s,onClose:a}){var g,h;const t=As(),n=(t==null?void 0:t.neighbors)??{},l=(g=t==null?void 0:t.config)!=null&&g.repeater?{latitude:t.config.repeater.latitude,longitude:t.config.repeater.longitude,name:t.config.node_name||"Local Node"}:void 0,i=(h=s.bestObservation)==null?void 0:h.decoded.snrValues,r=s.linkQuality?s.linkQuality.avgSnr>=5?"excellent":s.linkQuality.avgSnr>=0?"good":s.linkQuality.avgSnr>=-5?"fair":"poor":"unknown",x={excellent:"var(--signal-excellent)",good:"var(--signal-good)",fair:"var(--signal-fair)",poor:"var(--signal-poor)",unknown:"var(--fg-muted)"}[r];return e.jsxs(zs,{open:!0,onClose:a,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-fg-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-fg-primary",children:"Trace Report"}),e.jsx("button",{onClick:a,className:"text-[17px] font-medium text-sys-blue active:text-sys-blue/80",children:"Done"})]})]}),e.jsx("div",{className:"sm:hidden h-[2px]",style:{backgroundColor:x,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:"type-micro",children:"Trace Report"}),e.jsxs(B,{color:r==="excellent"||r==="good"?"green":r==="fair"?"amber":"red",children:[e.jsx(gs,{className:"w-3 h-3 mr-1"}),r==="excellent"?"Excellent":r==="good"?"Good":r==="fair"?"Fair":"Poor"]})]}),e.jsx("p",{className:"mt-1 text-xs sm:text-sm font-mono text-fg-muted tabular-nums",children:s.traceTag})]}),e.jsx("button",{onClick:a,className:"p-1.5 -m-1.5 text-fg-muted hover:text-fg-primary transition-base radius-inner hover:bg-elevated flex-shrink-0",children: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-edge-subtle",children:[e.jsxs(B,{color:"teal",children:[e.jsx("span",{className:"font-mono tabular-nums",children:s.targetHopCount}),e.jsxs("span",{className:"ml-1",children:["hop",s.targetHopCount!==1?"s":""]})]}),e.jsxs(B,{color:"zinc",children:[e.jsx("span",{className:"font-mono tabular-nums",children:s.observationCount}),e.jsx("span",{className:"ml-1",children:"obs"})]}),s.linkQuality&&e.jsxs(B,{color:"indigo",children:[e.jsx("span",{className:"font-mono tabular-nums",children:s.linkQuality.avgSnr.toFixed(1)}),e.jsx("span",{className:"ml-1",children:"dB avg"})]}),e.jsx("span",{className:"type-data-xs text-fg-muted",children:It(s.duration)}),s.linkQuality&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-fg-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-xs 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:s.linkQuality.minSnr.toFixed(1)})]}),e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium bg-sys-teal/15 text-sys-teal ring-1 ring-inset ring-sys-teal/25",children:[e.jsx("span",{className:"opacity-70",children:"Max"}),e.jsx("span",{className:"font-mono tabular-nums",children:s.linkQuality.maxSnr.toFixed(1)})]})]})]})]}),e.jsxs(Es,{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:[s.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-edge-subtle p-2.5 text-center",children:[e.jsx(ss,{value:Math.abs(s.linkQuality.minSnr),format:{maximumFractionDigits:0,signDisplay:"never"},prefix:s.linkQuality.minSnr<0?"-":"",className:"text-[20px] font-bold font-mono tabular-nums flex items-center justify-center text-fg-primary"}),e.jsxs("div",{className:"flex items-center justify-center gap-1 mt-1",children:[e.jsx(Je,{className:"w-2.5 h-2.5 text-fg-muted"}),e.jsx("span",{className:"text-xs text-fg-muted",children:"Min dB"})]})]}),e.jsxs("div",{className:"radius-inner bg-subtle-fill ring-1 ring-inset ring-edge-subtle p-2.5 text-center",children:[e.jsx(ss,{value:s.linkQuality.maxSnr,format:{maximumFractionDigits:0,signDisplay:"always"},className:"text-[20px] font-bold font-mono text-fg-primary tabular-nums flex items-center justify-center"}),e.jsxs("div",{className:"flex items-center justify-center gap-1 mt-1",children:[e.jsx(fs,{className:"w-2.5 h-2.5 text-fg-muted"}),e.jsx("span",{className:"text-xs text-fg-muted",children:"Max dB"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(B,{color:r==="excellent"||r==="good"?"green":r==="fair"?"amber":"red",compact:!0,children:[e.jsx(gs,{className:"w-2.5 h-2.5 mr-0.5"}),r==="excellent"?"Excellent":r==="good"?"Good":r==="fair"?"Fair":"Poor"]}),e.jsxs(B,{color:"teal",compact:!0,children:[s.targetHopCount," hops"]}),e.jsxs(B,{color:"zinc",compact:!0,children:[s.observationCount," obs"]}),e.jsx("span",{className:"type-data-xs text-fg-muted ml-auto",children:s.traceTag.slice(0,8)})]}),s.targetPath.length>0&&e.jsx("div",{className:"overflow-hidden radius-inset",children:e.jsx("div",{className:"aspect-[4/3] w-full",children:e.jsx(Ge,{path:s.targetPath,neighbors:n,localNode:l,localHash:t==null?void 0:t.local_hash,srcHash:s.srcHash,dstHash:s.dstHash,traceSnr:i})})}),e.jsxs("div",{className:"radius-inset bg-body overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-edge-subtle",children:[e.jsx("span",{className:"text-[11px] font-medium text-fg-secondary",children:"Route Path"}),s.linkQuality&&e.jsxs("span",{className:"type-data-xs text-fg-muted",children:["SNR ",s.linkQuality.minSnr.toFixed(1)," → ",s.linkQuality.maxSnr.toFixed(1)," dB"]})]}),s.bestObservation?e.jsx(_e,{packet:s.bestObservation.packet,neighbors:n,localHash:t==null?void 0:t.local_hash,direction:"flowchart",compact:!0,overridePath:s.targetPath,traceSnr:s.bestObservation.decoded.snrValues}):e.jsx("div",{className:"p-6 text-center text-fg-muted text-xs",children:"No path data available"})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"type-micro text-fg-muted mb-2",children:["Link Quality · ",s.hopStats.length," hops"]}),e.jsx("div",{className:"space-y-1.5",children:s.hopStats.length>0?s.hopStats.map((f,C)=>{var P,d,w;const b=C<s.targetPath.length-1?s.targetPath[C+1]:"You",o=ye(f.prefix,n),_=ye(b,n);return e.jsx(Ss,{fromPrefix:f.prefix,toPrefix:b,fromName:o,toName:_,snr:f.snr,maxSnr:((P=s.linkQuality)==null?void 0:P.maxSnr)??10,isWeakest:((d=s.linkQuality)==null?void 0:d.weakestLinkPosition)===C,isStrongest:((w=s.linkQuality)==null?void 0:w.strongestLinkPosition)===C,index:C},`${f.prefix}-${C}`)}):e.jsx("div",{className:"text-xs text-fg-muted py-6 text-center",children:"No link data collected"})})]}),e.jsx("div",{className:"pt-1 pb-2 text-center",children:e.jsxs("span",{className:"text-xs text-fg-muted",children:["Traced ",es(s.firstSeen)]})})]})}),e.jsxs("div",{className:"hidden md:flex md:flex-row h-[70vh] max-h-[calc(100vh-200px)] overflow-hidden",children:[e.jsx("div",{className:"w-1/2 flex flex-col min-w-0 min-h-0 overflow-hidden border-r border-edge-subtle",children:e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[s.linkQuality&&(()=>{const f=s.targetPath[s.linkQuality.weakestLinkPosition],C=s.targetPath[s.linkQuality.weakestLinkPosition+1]||"You",b=ye(f,n),o=ye(C,n),_=s.targetPath[s.linkQuality.strongestLinkPosition],P=s.targetPath[s.linkQuality.strongestLinkPosition+1]||"You",d=ye(_,n),w=ye(P,n);return e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(_s,{label:"Weakest Link",numericValue:s.linkQuality.minSnr,unit:"dB",icon:Je,subtext:`${b||f} → ${o||C}`}),e.jsx(_s,{label:"Best Link",numericValue:s.linkQuality.maxSnr,showSign:!0,unit:"dB",icon:fs,subtext:`${d||_} → ${w||P}`})]})})(),e.jsxs("div",{children:[e.jsx("h3",{className:"type-micro text-fg-muted mb-3",children:"Link Details"}),e.jsx("div",{className:"space-y-2",children:s.hopStats.length>0?s.hopStats.map((f,C)=>{var P,d,w;const b=C<s.targetPath.length-1?s.targetPath[C+1]:"You",o=ye(f.prefix,n),_=ye(b,n);return e.jsx(Ss,{fromPrefix:f.prefix,toPrefix:b,fromName:o,toName:_,snr:f.snr,maxSnr:((P=s.linkQuality)==null?void 0:P.maxSnr)??10,isWeakest:((d=s.linkQuality)==null?void 0:d.weakestLinkPosition)===C,isStrongest:((w=s.linkQuality)==null?void 0:w.strongestLinkPosition)===C,index:C},`${f.prefix}-${C}`)}):e.jsx("div",{className:"text-xs text-fg-muted py-8 text-center",children:"No link data collected"})})]}),e.jsxs("div",{className:"pt-2 text-center",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Traced "}),e.jsx("span",{className:"type-data-xs text-fg-muted",children:es(s.firstSeen)})]})]})}),e.jsxs("div",{className:"w-1/2 min-w-0 overflow-y-auto p-3 space-y-2",children:[s.targetPath.length>0&&e.jsx("div",{className:"overflow-hidden",children:e.jsx("div",{className:"aspect-square w-full",children:e.jsx(Ge,{path:s.targetPath,neighbors:n,localNode:l,localHash:t==null?void 0:t.local_hash,srcHash:s.srcHash,dstHash:s.dstHash,traceSnr:i})})}),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:"type-micro text-fg-muted",children:"Trace Route"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(B,{color:s.isComplete?"green":"amber",compact:!0,children:s.isComplete?"Complete":`${s.maxHopsObserved}/${s.targetHopCount}`}),e.jsxs(B,{color:"teal",compact:!0,children:[s.targetHopCount," hop",s.targetHopCount!==1?"s":""]})]})]}),s.linkQuality&&s.bestObservation&&e.jsxs("div",{className:"flex items-center gap-4 px-4 pb-2 type-data-xs text-fg-muted",children:[e.jsxs("span",{children:[e.jsx("span",{className:"opacity-60",children:"Tag"})," ",e.jsx("code",{className:"text-sys-teal tabular-nums",children:s.traceTag.slice(0,8)})]}),e.jsxs("span",{children:[e.jsx("span",{className:"opacity-60",children:"SNR"})," ",e.jsxs("code",{className:"text-sys-indigo tabular-nums",children:[s.linkQuality.minSnr.toFixed(1),"–",s.linkQuality.maxSnr.toFixed(1)]}),e.jsx("span",{className:"opacity-60",children:" dB"})]})]}),s.bestObservation?e.jsx(_e,{packet:s.bestObservation.packet,neighbors:n,localHash:t==null?void 0:t.local_hash,direction:"flowchart",compact:!0,overridePath:s.targetPath,traceSnr:s.bestObservation.decoded.snrValues}):e.jsx("div",{className:"p-8 text-center text-fg-muted text-xs",children:"No path data available"})]})]})]})]})]})}const Mn=u.memo(Bn),et=[{target:"PacketList",fn:"type",minStage:1},{target:"PacketList",fn:"route",minStage:1},{target:"PacketList",fn:"rssi",minStage:1},{target:"PacketList",fn:"snr",minStage:1},{target:"PacketList",fn:"path",minStage:1,when:Kt},{target:"PacketList",fn:"src_hash",minStage:1,when:Yt},{target:"PacketList",fn:"text",minStage:1,when:Xt},{target:"PacketList",fn:"ack",minStage:1,when:Zt},{target:"PacketList",fn:"decrypt",minStage:2,when:Jt},{target:"PacketList",fn:"duplicates",minStage:1}];Wt(et);const Ln=48,Rn=72,Hn=100,Fn=5,Dn=600,st="(min-width: 640px)";let ue=null;function An(s){return typeof window>"u"?()=>{}:(ue||(ue=window.matchMedia(st)),ue.addEventListener("change",s),()=>ue==null?void 0:ue.removeEventListener("change",s))}function zn(){return typeof window>"u"?!0:(ue||(ue=window.matchMedia(st)),ue.matches)}function En(){return u.useSyncExternalStore(An,zn,()=>!0)}function In(s,a,t){const[n,l]=u.useState(1),i=t?Math.ceil(s/a):1;u.useEffect(()=>{n>i&&i>0&&queueMicrotask(()=>l(1))},[i,n]);const r=u.useCallback(x=>l(Math.max(1,Math.min(x,i))),[i]),c=u.useMemo(()=>Sa(n,i),[n,i]);return{currentPage:n,totalPages:i,goToPage:r,pageRange:c}}function $n(s,a){const[t,n]=u.useState(null),l=u.useRef(0);return u.useEffect(()=>{var h,f;if(!a||!s.length)return;const i=((h=s[0])==null?void 0:h.timestamp)??0,r=i>l.current&&l.current>0;if(l.current=i,!r)return;const c=(f=s[0])==null?void 0:f.packet_hash;if(!c)return;const x=requestAnimationFrame(()=>n(c)),g=setTimeout(()=>n(null),600);return()=>{cancelAnimationFrame(x),clearTimeout(g)}},[s,a]),t}function Un(s){if(!s||s.length<6)return null;const a=$t(s);if(!a||a.offset>=s.length)return null;const t=s.slice(a.offset);return t.length>=38?t.slice(0,38):t}function On(s){if(s.length<=1)return s;const a=new Map,t=new Map,n=new Map;for(let r=0;r<s.length;r++){const{packet:c}=s[r],x=c.payload_type??c.type;if(x!==is.GRP_TXT)continue;const g=c._payloadHexPrefix??Un(c.raw_packet);if(g){const b=a.get(g);if(b!==void 0){n.set(r,b);continue}a.set(g,r)}const h=c.payload_length??c.length??0,f=Math.floor((c.timestamp??0)/60),C=`${x}:${h}:${f}`;if(!g){const b=t.get(C);if(b!==void 0){n.set(r,b);continue}}t.has(C)||t.set(C,r)}if(n.size===0)return s;const l=new Map;for(const[r,c]of n)l.set(c,(l.get(c)??0)+s[r].dupeCount);const i=[];for(let r=0;r<s.length;r++){if(n.has(r))continue;const c=l.get(r)??0;i.push(c>0?{packet:s[r].packet,dupeCount:s[r].dupeCount+c}:s[r])}return i}function Vn(s){const a=new Map;for(const t of s)if((t.payload_type??t.type)===is.TRACE&&t.packet_hash){const l=t._traceTag??(t.payload?Is(t.payload):null);l&&a.set(t.packet_hash,l)}return a}function Gn(s){const a=new Map;if(s.length===0)return a;for(let t=0;t<s.length;t++){const n=s[t].packet_hash;if(!n)continue;const l=s[t-1],i=s[t+1],r=(l==null?void 0:l.packet_hash)===n,c=(i==null?void 0:i.packet_hash)===n;(r||c)&&(r&&c?a.set(t,"middle"):r?a.set(t,"last"):c&&a.set(t,"first"))}return a}function Ts({message:s}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-14 text-center",children:[e.jsx(me,{className:"size-6 text-fg-muted mb-2"}),e.jsx("p",{className:"text-sm text-fg-primary",children:s}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Packets will appear here"})]})}function Ps(){return e.jsx("div",{className:"py-14 text-center text-sm text-fg-muted",children:"Loading packets…"})}function Qn({showPagination:s,currentPage:a,perPage:t,displayCount:n,totalCount:l,action:i}){const r=s?(a-1)*t+1:1,c=s?Math.min(a*t,l):n;return e.jsxs("div",{className:"flex items-center justify-between gap-4 border-t border-edge-subtle px-4 py-3 text-xs text-fg-muted sm:px-6",children:[e.jsxs("span",{children:["Showing"," ",e.jsx("span",{className:"font-medium text-fg-secondary",children:s?`${r}–${c}`:n})," ","of"," ",e.jsx("span",{className:"font-medium text-fg-secondary",children:l})," ","packets"]}),i]})}function fr({packets:s,allPackets:a,localHash:t,pathHashSize:n=1,neighbors:l,loading:i=!1,maxPackets:r,perPage:c=50,showPagination:x=!1,onPacketSelect:g,flashNewest:h=!1,emptyMessage:f="No packets found",className:C,footerAction:b,hideDupes:o=!1,getDecodedContent:_,onChannelClick:P,resolveSource:d,virtualized:w=!0}){qt(et);const[m,v]=u.useState(null),[N,y]=u.useState(null),[I,A]=u.useState({traceTag:null,dupeGroup:null}),V=u.useRef(null),W=ca(j=>j.setModalMapOpen);u.useEffect(()=>(W(!!m),()=>W(!1)),[m,W]),u.useLayoutEffect(()=>{A({traceTag:null,dupeGroup:null})},[s]);const G=a??s,Y=u.useMemo(()=>r&&r>0&&!o?s.slice(0,r):s,[s,r,o]),D=u.useMemo(()=>{if(!o)return null;const j=Ta(Y),k=On(j);return r&&r>0?k.slice(0,r):k},[Y,o,r]),J=D?D.length:Y.length,{currentPage:L,totalPages:X,goToPage:U,pageRange:ne}=In(J,c,x),T=u.useMemo(()=>{if(o||!x)return Y;const j=(L-1)*c;return Y.slice(j,j+c)},[Y,x,L,c,o]),z=u.useMemo(()=>{if(!D)return null;if(!x)return D;const j=(L-1)*c;return D.slice(j,j+c)},[D,x,L,c]),ee=u.useMemo(()=>Vn(T),[T]),M=u.useMemo(()=>Gn(T),[T]),p=$n(s,h),ae=En(),se=u.useMemo(()=>o&&z?z:T,[o,z,T]),le=w&&se.length>Hn,te=ae?Ln:Rn,S=Ot({count:le?se.length:0,getScrollElement:()=>V.current,estimateSize:()=>te,overscan:Fn}),K=u.useCallback((j,k)=>{var we,Ae;const H=j.packet_hash;if(!H)return[j];let E=k;for(;E>0&&((we=T[E-1])==null?void 0:we.packet_hash)===H;)E--;let q=k;for(;q<T.length-1&&((Ae=T[q+1])==null?void 0:Ae.packet_hash)===H;)q++;return E===q?[j]:T.slice(E,q+1)},[T]),R=u.useCallback(j=>{var E,q;const k=(E=T[j])==null?void 0:E.packet_hash;if(!k)return j;let H=j;for(;H>0&&((q=T[H-1])==null?void 0:q.packet_hash)===k;)H--;return H},[T]),$=u.useCallback(j=>{var E,q;const k=(E=T[j])==null?void 0:E.packet_hash;if(!k)return j;let H=j;for(;H<T.length-1&&((q=T[H+1])==null?void 0:q.packet_hash)===k;)H++;return H},[T]),ie=u.useCallback((j,k)=>{if(g){g(j);return}if(k!==void 0){const H=K(j,k),E=H.indexOf(j);v({packets:H,initialIndex:E>=0?E:0,rowIndex:k})}else v({packets:[j],initialIndex:0,rowIndex:0})},[g,K]),ce=u.useCallback(()=>{if(!m)return;const k=R(m.rowIndex)-1;if(k<0)return;const H=T[k];if(!H)return;const E=K(H,k);v({packets:E,initialIndex:0,rowIndex:k})},[m,T,R,K]),Re=u.useCallback(()=>{if(!m)return;const k=$(m.rowIndex)+1;if(k>=T.length)return;const H=T[k];if(!H)return;const E=K(H,k);v({packets:E,initialIndex:0,rowIndex:k})},[m,T,$,K]),ds=u.useMemo(()=>m?R(m.rowIndex)>0:!1,[m,R]),xs=u.useMemo(()=>m?$(m.rowIndex)<T.length-1:!1,[m,$,T.length]),Ne=u.useCallback(j=>A(k=>({...k,traceTag:j})),[]),qe=u.useCallback(j=>A(k=>({...k,dupeGroup:j})),[]),He=u.useCallback(()=>{A({traceTag:null,dupeGroup:null})},[]),ve=u.useCallback(j=>{const k=G.filter(q=>(q.payload_type??q.type)===is.TRACE&&q.payload&&Is(q.payload)===j);if(k.length===0)return;const E=Gt(k).get(j);E!=null&&E.length&&y(Qt(j,E))},[G]),We=u.useCallback(j=>{const k=G.find(H=>H.packet_hash===j);k&&(y(null),ie(k))},[G,ie]),Fe=u.useCallback((j,k,H)=>{const E=ae?Da:Aa;if(H){const{packet:ge,dupeCount:at}=j,hs=ge.packet_hash?ee.get(ge.packet_hash):void 0,nt=I.traceTag!==null&&hs===I.traceTag;return e.jsx(E,{packet:ge,onClick:rt=>ie(rt,k),localHash:t,pathHashSize:n,neighbors:l,resolveSource:d,isFlashing:h&&p===ge.packet_hash,traceTag:hs,isTraceHighlighted:nt,onTraceHover:Ne,onViewTraceReport:ve,dupeCount:at,getDecodedContent:_,onChannelClick:P},`${ge.packet_hash}_${ge.timestamp}_${k}`)}const q=j,we=q.packet_hash?ee.get(q.packet_hash):void 0,Ae=I.traceTag!==null&&we===I.traceTag,ms=M.get(k),tt=ms!==void 0&&I.dupeGroup!==null&&q.packet_hash===I.dupeGroup;return e.jsx(E,{packet:q,onClick:ge=>ie(ge,k),localHash:t,pathHashSize:n,neighbors:l,resolveSource:d,isFlashing:h&&p===q.packet_hash,traceTag:we,isTraceHighlighted:Ae,onTraceHover:Ne,onViewTraceReport:ve,dupeGroupPosition:ms,isDupeGroupHovered:tt,onDupeGroupHover:qe,getDecodedContent:_,onChannelClick:P},`${q.packet_hash}_${q.timestamp}_${k}`)},[ae,ee,I.traceTag,I.dupeGroup,ie,t,n,l,d,h,p,Ne,ve,M,qe,_,P]),De=()=>{if(i&&s.length===0)return e.jsx(Ps,{});if(T.length===0)return e.jsx(Ts,{message:f});const j=o&&z!==null;return(j?z:T).map((H,E)=>Fe(H,E,j))},Q=()=>{if(i&&s.length===0)return e.jsx(Ps,{});if(se.length===0)return e.jsx(Ts,{message:f});const j=o&&z!==null,k=S.getVirtualItems();return e.jsx("div",{style:{height:`${S.getTotalSize()}px`,width:"100%",position:"relative"},children:k.map(H=>{const E=se[H.index];return e.jsx("div",{"data-index":H.index,ref:S.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${H.start}px)`},children:Fe(E,H.index,j)},H.key)})})};return e.jsxs("div",{className:F("flex flex-col",C),onMouseLeave:He,children:[le?e.jsx("div",{ref:V,className:"divide-y divide-edge-subtle overflow-auto",style:{maxHeight:Dn},children:Q()}):e.jsx("div",{className:"divide-y divide-edge-subtle py-1",children:De()}),x&&X>1&&e.jsx("nav",{className:"border-t border-edge-subtle px-4 py-3",children:e.jsxs(Na,{className:"justify-center",children:[e.jsx(va,{onClick:()=>U(L-1),disabled:L===1}),e.jsx(ka,{children:ne.map((j,k)=>j==="gap"?e.jsx(_a,{},`gap-${k}`):e.jsx(Ca,{page:j,current:j===L,onClick:U},j))}),e.jsx(wa,{onClick:()=>U(L+1),disabled:L===X})]})}),e.jsx(Qn,{showPagination:x,currentPage:L,perPage:c,displayCount:z?z.length:T.length,totalCount:x?J:s.length,action:b}),!g&&m&&e.jsx(Tn,{packets:m.packets,initialIndex:m.initialIndex,onClose:()=>v(null),onNavigatePrev:ce,onNavigateNext:Re,hasPrev:ds,hasNext:xs,resolveSource:d,getDecodedContent:_}),N&&e.jsx(Mn,{report:N,onClose:()=>y(null),onViewPacket:We})]})}export{Ks as C,fr as P,gs as S,ys as T,Ma as g,pr as u};
