mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-08-07 01:13:11 +02:00
2 lines
44 KiB
JavaScript
2 lines
44 KiB
JavaScript
import{D as e,N as t,T as n,U as r,X as i,_t as a,c as o,gt as s,h as c,ht as l,i as u,j as d,l as f,m as p,o as m,p as h,r as g,s as _,u as v}from"./runtime-core.esm-bundler-CINEgm0a.js";import{l as ee,t as te}from"./runtime-dom.esm-bundler-B3VeUO8l.js";import{t as y}from"./api-GPpxWKdp.js";import{d as b}from"./index-DF7On1cp.js";import{n as ne,t as re}from"./SignalBars-DPqSedo4.js";var ie={class:`bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[16px] sm:rounded-[20px] shadow-2xl border border-stroke-subtle dark:border-white/opacity-medium flex flex-col h-full overflow-hidden`},ae={class:`flex flex-col sm:flex-row sm:items-start sm:justify-between p-4 sm:p-6 lg:p-8 pb-3 sm:pb-4 shrink-0 gap-3 sm:gap-4`},oe={class:`min-w-0 flex-1`},se={class:`flex flex-wrap gap-2 mt-2`},ce={class:`inline-flex items-center rounded-full bg-accent-cyan/opacity-light text-accent-cyan px-2 py-0.5 text-[11px] sm:text-xs font-medium max-w-full truncate`},le={class:`inline-flex items-center rounded-full bg-accent-orange/opacity-light text-accent-orange px-2 py-0.5 text-[11px] sm:text-xs font-medium max-w-full truncate`},ue={class:`w-full sm:w-auto flex flex-wrap items-center justify-between sm:justify-end gap-2 pt-1 sm:pt-0`},de={key:0,class:`flex items-center gap-2`},fe={class:`flex items-center rounded-lg border border-stroke-subtle dark:border-stroke/opacity-medium overflow-hidden bg-background-mute dark:bg-white/opacity-subtle`},pe=[`disabled`],me=[`disabled`],he={class:`text-xs text-content-secondary dark:text-content-muted font-medium`},ge=[`title`],_e={class:`flex-1 overflow-y-auto custom-scrollbar px-4 sm:px-6 lg:px-8`},ve={class:`mb-6`},ye={class:`glass-card bg-background-mute/opacity-heavy dark:bg-white/opacity-subtle rounded-[15px] p-4`},be={class:`grid grid-cols-1 sm:grid-cols-2 gap-4`},xe={class:`space-y-3`},Se={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/opacity-light`},Ce={class:`text-content-primary font-mono text-sm`},we={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/opacity-light`},Te={class:`text-content-primary font-mono text-xs break-all`},Ee={key:0,class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/opacity-light`},De={class:`text-content-primary font-mono text-xs`},Oe={class:`space-y-3`},ke={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/opacity-light`},Ae={class:`text-content-primary font-semibold`},je={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/opacity-light`},Me={class:`text-content-primary font-semibold`},x={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/opacity-light`},Ne={key:0,class:`mb-6`},Pe={class:`text-base sm:text-lg font-semibold text-content-primary mb-4 flex items-center`},Fe={class:`bg-background-mute/opacity-heavy dark:bg-white/opacity-subtle rounded-[15px] p-4 border border-stroke-subtle dark:border-stroke/opacity-light space-y-3`},Ie={class:`flex items-center justify-between gap-2 mb-2`},Le={class:`text-content-primary text-sm font-semibold`},Re={class:`text-content-secondary dark:text-content-muted text-xs font-mono`},ze={class:`mb-2 flex flex-wrap items-start justify-between gap-2 py-1 border-b border-stroke-subtle/60 dark:border-stroke/opacity-light`},Be={class:`text-content-primary text-xs font-mono break-all text-right`},Ve={key:0,class:`space-y-1`},He={class:`text-content-secondary dark:text-content-muted text-xs`},Ue={class:`text-content-primary text-xs font-mono break-all text-right`},We={key:1,class:`text-content-secondary dark:text-content-muted text-xs italic`},Ge={class:`mb-6`},Ke={class:`bg-background-mute/opacity-heavy dark:bg-white/opacity-subtle rounded-[15px] p-4 border border-stroke-subtle dark:border-stroke/opacity-light`},qe={class:`space-y-3`},Je={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/opacity-light`},Ye={class:`text-content-primary`},Xe={key:0,class:`pt-2`},Ze={class:`glass-card bg-background-mute dark:bg-white/opacity-subtle rounded-[10px] p-4 mb-4`},Qe={class:`w-full overflow-x-auto`},$e={class:`text-content-primary/opacity-heavy text-xs font-mono whitespace-pre leading-relaxed min-w-full`},et={class:`flex items-center justify-between mb-3`},tt={class:`text-content-secondary dark:text-content-primary/opacity-heavy text-sm font-semibold`},nt={class:`text-content-muted text-xs`},rt={class:`bg-background-mute dark:bg-white/opacity-subtle rounded-[8px] p-3 mb-3`},it={class:`font-mono text-xs text-content-primary break-all whitespace-pre-wrap leading-relaxed`},at={class:`bg-background-mute/opacity-heavy dark:bg-white/opacity-subtle rounded-[10px] overflow-hidden`},ot={key:0,class:`min-w-0`},st={class:`text-accent-cyan text-sm font-mono break-words min-w-0`},ct={class:`text-content-primary text-sm break-words min-w-0`},lt={class:`text-content-primary text-sm font-semibold break-all min-w-0 overflow-hidden`},ut=[`title`],dt={key:0,class:`text-accent-orange text-xs font-mono break-all min-w-0 overflow-hidden`},ft=[`title`],pt={class:`grid grid-cols-2 gap-2`},mt={class:`text-accent-cyan text-sm font-mono break-words`},ht={class:`text-content-primary text-sm break-words`},gt=[`title`],_t={key:0},vt=[`title`],yt={key:0,class:`text-content-muted text-xs italic mt-2 px-1`},bt={key:1,class:`py-2`},xt={class:`mb-6`},St={class:`bg-background-mute/opacity-heavy dark:bg-white/opacity-subtle rounded-[15px] p-4 border border-stroke-subtle dark:border-stroke/opacity-light`},Ct={class:`space-y-4`},wt={class:`grid grid-cols-1 sm:grid-cols-2 gap-4`},Tt={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/opacity-light`},Et={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/opacity-light`},Dt={key:0,class:`py-2`},Ot={class:`flex flex-wrap items-center gap-2 mb-3`},kt={class:`text-xs px-2 py-0.5 rounded-full bg-accent-cyan/opacity-light text-accent-cyan`},At={key:0,class:`text-xs px-2 py-0.5 rounded-full bg-accent-amber/opacity-medium text-accent-amber`},jt={key:1,class:`text-xs px-2 py-0.5 rounded-full bg-accent-red/opacity-medium text-accent-red`},Mt={key:2,class:`text-xs px-2 py-0.5 rounded-full bg-background-mute text-content-muted`},Nt={class:`bg-background-mute dark:bg-white/opacity-subtle rounded-[10px] border border-stroke-subtle dark:border-stroke/opacity-light p-3 sm:p-4`},Pt={class:`relative space-y-3`},Ft={class:`relative flex items-center justify-center self-stretch`},It={key:0,class:`absolute left-1/2 -translate-x-1/2 top-[-6px] bottom-[calc(50%+18px)] sm:bottom-[calc(50%+20px)] w-px bg-primary/opacity-medium`},Lt={key:1,class:`absolute left-1/2 -translate-x-1/2 top-[calc(50%+18px)] sm:top-[calc(50%+20px)] bottom-[-6px] w-px bg-primary/opacity-medium`},Rt={class:`glass-card bg-background-mute dark:bg-white/opacity-subtle rounded-[10px] p-3 border border-stroke-subtle dark:border-stroke/opacity-light`},zt={class:`flex items-start justify-between gap-3`},Bt={class:`min-w-0 flex-1`},Vt=[`title`],Ht=[`onClick`],Ut={key:2,class:`text-[10px] sm:text-[11px] leading-tight mt-0.5 text-accent-cyan`},Wt={key:3,class:`mt-2 space-y-1`},Gt={class:`text-content-secondary dark:text-content-muted truncate`},Kt={class:`font-mono text-content-muted`},qt=[`title`],Jt={class:`mt-2`},Yt={class:`h-1.5 rounded-full bg-background-mute dark:bg-stroke/opacity-subtle overflow-hidden border border-stroke-subtle/60 dark:border-stroke/opacity-light`},Xt={class:`mb-6`},Zt={class:`glass-card bg-background-mute/opacity-heavy dark:bg-white/opacity-subtle rounded-[15px] p-4`},Qt={class:`grid grid-cols-2 md:grid-cols-3 gap-3 sm:gap-4 mb-4`},$t={class:`text-center p-3 glass-card bg-background-mute dark:bg-white/opacity-subtle rounded-[10px]`},en={class:`text-lg font-bold text-content-primary`},tn={class:`text-center p-3 glass-card bg-background-mute dark:bg-white/opacity-subtle rounded-[10px]`},nn={class:`text-center p-3 glass-card bg-background-mute dark:bg-white/opacity-subtle rounded-[10px] col-span-2 md:col-span-1`},rn={class:`text-lg font-bold text-content-primary`},an={key:0,class:`mb-4`},on={class:`flex items-center gap-2`},sn={key:1,class:`mb-4`},cn={key:2,class:`mb-4`},ln={class:`text-content-secondary dark:text-content-muted text-sm mb-3`},un={class:`space-y-2`},dn={class:`flex items-center gap-3`},fn={class:`text-content-muted text-sm`},S={key:3,class:`mt-6 pt-4 border-t border-stroke-subtle dark:border-stroke/opacity-light`},pn={class:`grid grid-cols-2 md:grid-cols-3 gap-3 mb-4`},mn={class:`text-center p-3 glass-card bg-background-mute dark:bg-white/opacity-subtle rounded-[10px] col-span-2 md:col-span-1`},hn={class:`text-2xl font-bold text-content-primary`},gn={class:`text-center p-3 glass-card bg-background-mute dark:bg-white/opacity-subtle rounded-[10px]`},_n={class:`text-2xl font-bold text-content-primary`},vn={class:`text-content-muted text-xs mt-1`},yn={class:`text-center p-3 glass-card bg-background-mute dark:bg-white/opacity-subtle rounded-[10px]`},bn={class:`text-content-muted text-xs mt-1`},xn={key:0,class:`glass-card bg-background-mute dark:bg-white/opacity-subtle rounded-[10px] p-4`},Sn={class:`space-y-3`},Cn={class:`flex-shrink-0 w-16 text-right`},wn={class:`text-content-secondary dark:text-content-muted text-xs`},Tn={class:`flex-1 relative`},En={class:`h-8 rounded-lg overflow-hidden bg-background-mute dark:bg-stroke/opacity-subtle relative`},Dn={class:`absolute inset-0 flex items-center px-3`},On={class:`text-content-primary text-xs font-mono font-semibold`},kn={class:`flex-shrink-0 w-12 text-left`},An={class:`text-content-muted text-xs`},jn={class:`grid grid-cols-1 sm:grid-cols-2 gap-4`},Mn={class:`space-y-2`},Nn={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/opacity-light`},Pn={class:`text-content-primary`},Fn={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/opacity-light`},In={class:`space-y-2`},Ln={class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/opacity-light`},Rn={key:0,class:`flex justify-between py-2 border-b border-stroke-subtle dark:border-stroke/opacity-light`},zn={class:`text-accent-red text-sm`},Bn={class:`p-4 sm:p-6 lg:p-8 pt-3 sm:pt-4 border-t border-stroke-subtle dark:border-stroke/opacity-light flex justify-end flex-shrink-0`},Vn=300*1e3,C=b(c({name:`PacketDetailsModal`,__name:`PacketDetailsModal`,props:{packet:{},packets:{},linkedDuplicatePackets:{},currentIndex:{},canGoPrevious:{type:Boolean},canGoNext:{type:Boolean},isOpen:{type:Boolean},localHash:{}},emits:[`close`,`previous`,`next`],setup(c,{emit:b}){let{getSignalQuality:C}=ne(),w=c,T=b,E=r(!1),D=r([]),O=r(!1),k=r(null),Hn=[`Unknown`,`Chat Node`,`Repeater`,`Room Server`,`Hybrid Node`],A=e=>typeof e==`object`&&!!e&&!Array.isArray(e),j=e=>typeof e==`string`?e.replace(/^0x/i,``).replace(/[^0-9a-fA-F]/g,``).toUpperCase():``,Un=(e,t)=>{for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t.trim()}return``},M=e=>{if(Array.isArray(e))return e.filter(e=>A(e));if(!A(e))return[];let t=e.data;return Array.isArray(t)?t.filter(e=>A(e)):A(t)&&Array.isArray(t.data)?t.data.filter(e=>A(e)):[]},N=(e,t)=>e.map(e=>{let n=j(e.pub_key??e.pubkey??e.public_key),r=Un(e,[`name`,`node_name`,`display_name`,`alias`]);return!n||!r?null:{pubkey:n,name:r,source:t}}).filter(e=>e!==null),Wn=()=>k.value==null?!0:Date.now()-k.value>Vn,Gn=async()=>{if(!O.value){O.value=!0;try{let[e,t]=await Promise.all([y.get(`/companion/contacts`),Promise.all(Hn.map(e=>y.get(`/adverts_by_contact_type`,{contact_type:e,hours:168,limit:500}).catch(()=>null)))]),n=N(M(e),`contact`),r=t.flatMap(e=>e?N(M(e),`advert`):[]),i=new Map;[...n,...r].forEach(e=>{i.has(e.pubkey)||i.set(e.pubkey,e)}),D.value=Array.from(i.values()),k.value=Date.now()}catch{}finally{O.value=!1}}},P=r([]),F=e=>P.value.includes(e),Kn=e=>{if(F(e)){P.value=P.value.filter(t=>t!==e);return}P.value=[...P.value,e]},qn=e=>e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`,I=e=>{let t=j(e);if(!t)return null;let n=D.value.filter(e=>e.pubkey.startsWith(t));if(n.length===0)return null;let r=n[0],i=new Set(n.map(e=>e.pubkey)),a=Math.max(1,Math.round(100/i.size));return{name:r.name,confidencePercent:a,candidates:n.slice(0,8)}},L=e=>new Date(e*1e3).toLocaleString(),Jn=e=>e.transmitted?e.is_duplicate?`text-accent-amber`:e.drop_reason?`text-accent-red`:`text-accent-green`:`text-accent-red`,R=e=>e.transmitted?e.is_duplicate?`Duplicate`:e.drop_reason?`Dropped`:`Forwarded`:`Dropped`,Yn=m(()=>(w.packets?.length??0)>1),z=m(()=>!!w.canGoPrevious),B=m(()=>!!w.canGoNext),Xn=m(()=>{let e=w.packets?.length??0;return e===0?``:w.currentIndex==null||w.currentIndex<0?`- / ${e}`:`${w.currentIndex+1} / ${e}`}),Zn=(e,t)=>e.id!=null&&t.id!=null?e.id===t.id:e.packet_hash===t.packet_hash&&e.timestamp===t.timestamp&&e.type===t.type&&e.route===t.route&&e.src_hash===t.src_hash&&e.dst_hash===t.dst_hash&&e.length===t.length,V=(e,t=``,n=null)=>e==null?`N/A`:typeof e==`number`?Number.isFinite(e)?`${n==null?e.toString():e.toFixed(n)}${t}`:`N/A`:typeof e==`boolean`?e?`Yes`:`No`:e||`N/A`,Qn=e=>{let t=q(e);return t.length===0?`None`:t.join(` → `).toUpperCase()},$n=e=>{let t=q(e.original_path),n=q(e.forwarded_path);return e.transmitted&&n.length>0?n:t.length>0?t:n},er=e=>Qn($n(e)),tr=(e,t)=>{let n=[],r=(e,t,r)=>{t!==r&&n.push({label:e,currentValue:t,duplicateValue:r})};return r(`Type`,U(e.type),U(t.type)),r(`Route`,W(e.route),W(t.route)),r(`Status`,R(e),R(t)),r(`Length`,`${e.length}B`,`${t.length}B`),r(`RSSI`,V(e.rssi,` dBm`,0),V(t.rssi,` dBm`,0)),r(`SNR`,V(e.snr,` dB`,1),V(t.snr,` dB`,1)),r(`Score`,V(e.score,``,2),V(t.score,``,2)),r(`TX Delay`,V(e.tx_delay_ms,` ms`,1),V(t.tx_delay_ms,` ms`,1)),r(`Source`,V(e.src_hash),V(t.src_hash)),r(`Destination`,V(e.dst_hash||`Broadcast`),V(t.dst_hash||`Broadcast`)),r(`Drop Reason`,V(e.drop_reason||`None`),V(t.drop_reason||`None`)),n},H=m(()=>{let e=w.packet,t=w.linkedDuplicatePackets??[];return!e||t.length===0?[]:t.filter(t=>!Zn(t,e)).map(t=>({packet:t,effectivePath:er(t),differences:tr(e,t)})).sort((e,t)=>t.packet.timestamp-e.packet.timestamp)}),nr=()=>{z.value&&T(`previous`)},rr=()=>{B.value&&T(`next`)},U=e=>({0:`Request`,1:`Response`,2:`Plain Text Message`,3:`Acknowledgment`,4:`Node Advertisement`,5:`Group Text Message`,6:`Group Datagram`,7:`Anonymous Request`,8:`Returned Path`,9:`Trace`,10:`Multi-part Packet`,15:`Custom Packet`})[e]||`Unknown Type (${e})`,W=e=>({0:`Transport Flood`,1:`Flood`,2:`Direct`,3:`Transport Direct`})[e]||`Unknown Route (${e})`,ir=e=>{if(!e)return`None`;let t=e.replace(/\s+/g,``).toUpperCase().match(/.{2}/g)||[],n=[];for(let e=0;e<t.length;e+=32){let r=t.slice(e,e+32).join(` `);n.push(r)}return n.join(`
|
||
`)||e},G=(e,t,n)=>{try{let r=0,i=t.length/2;if(i>=100){if(t.length>=r+64){let i=t.slice(r,r+64);e.push({name:`Public Key`,byteRange:`${(n+r)/2}-${(n+r+63)/2}`,hexData:i.match(/.{8}/g)?.join(` `)||i,description:`Ed25519 public key of the node (32 bytes)`,fields:[{bits:`0-255`,name:`Ed25519 Public Key`,value:`${i.slice(0,16)}...${i.slice(-16)}`,binary:`32 bytes (256 bits)`}]}),r+=64}if(t.length>=r+8){let i=t.slice(r,r+8),a=parseInt(i,16),o=new Date(a*1e3);e.push({name:`Timestamp`,byteRange:`${(n+r)/2}-${(n+r+7)/2}`,hexData:i.match(/.{2}/g)?.join(` `)||i,description:`Unix timestamp of advertisement`,fields:[{bits:`0-31`,name:`Unix Timestamp`,value:`${a} (${o.toLocaleString()})`,binary:a.toString(2).padStart(32,`0`)}]}),r+=8}if(t.length>=r+128){let i=t.slice(r,r+128);e.push({name:`Signature`,byteRange:`${(n+r)/2}-${(n+r+127)/2}`,hexData:i.match(/.{8}/g)?.join(` `)||i,description:`Ed25519 signature of public key, timestamp, and appdata`,fields:[{bits:`0-511`,name:`Ed25519 Signature`,value:`${i.slice(0,16)}...${i.slice(-16)}`,binary:`64 bytes (512 bits)`}]}),r+=128}t.length>r&&K(e,t.slice(r),n+r)}else e.push({name:`ADVERT AppData (Partial)`,byteRange:`${n/2}-${n/2+i-1}`,hexData:t.match(/.{2}/g)?.join(` `)||t,description:`Partial ADVERT data - appears to be just AppData portion (${i} bytes)`,fields:[{bits:`0-${i*8-1}`,name:`Partial Data`,value:`${i} bytes - attempting to decode as AppData`,binary:`${i} bytes (${i*8} bits)`}]}),K(e,t,n)}catch(n){e.push({name:`ADVERT Parse Error`,byteRange:`N/A`,hexData:t.slice(0,32)+`...`,description:`Failed to parse ADVERT payload structure`,fields:[{bits:`N/A`,name:`Error`,value:`Parse error: ${n instanceof Error?n.message:`Unknown error`}`,binary:`Invalid`}]})}},K=(e,t,n)=>{try{let r=t.length/2;e.push({name:`AppData`,byteRange:`${n/2}-${n/2+r-1}`,hexData:t.match(/.{2}/g)?.join(` `)||t,description:`Node advertisement application data (${r} bytes)`,fields:[{bits:`0-${r*8-1}`,name:`Application Data`,value:`${r} bytes (contains flags, location, name, etc.)`,binary:`${r} bytes (${r*8} bits)`}]});let i=0;if(t.length>=2){let r=parseInt(t.slice(i,i+2),16),a=[],o=!!(r&16),s=!!(r&32),c=!!(r&64),l=!!(r&128);if(r&1&&a.push(`is chat node`),r&2&&a.push(`is repeater`),r&4&&a.push(`is room server`),r&8&&a.push(`is sensor`),o&&a.push(`has location`),s&&a.push(`has feature 1`),c&&a.push(`has feature 2`),l&&a.push(`has name`),e.push({name:`AppData Flags`,byteRange:`${(n+i)/2}`,hexData:`0x${t.slice(i,i+2)}`,description:`Flags indicating which optional fields are present`,fields:[{bits:`0-7`,name:`Flags`,value:a.join(`, `)||`none`,binary:r.toString(2).padStart(8,`0`)}]}),i+=2,o&&t.length>=i+16){let r=t.slice(i,i+8),a=[];for(let e=6;e>=0;e-=2)a.push(r.slice(e,e+2));let o=parseInt(a.join(``),16),s=o>2147483647?o-4294967296:o,c=s/1e6,l=t.slice(i+8,i+16),u=[];for(let e=6;e>=0;e-=2)u.push(l.slice(e,e+2));let d=parseInt(u.join(``),16),f=d>2147483647?d-4294967296:d,p=f/1e6;e.push({name:`Location Data`,byteRange:`${(n+i)/2}-${(n+i+15)/2}`,hexData:`${r.match(/.{2}/g)?.join(` `)||r} ${l.match(/.{2}/g)?.join(` `)||l}`,description:`GPS coordinates (latitude and longitude)`,fields:[{bits:`0-31`,name:`Latitude`,value:`${c.toFixed(6)}° (raw: ${s})`,binary:s.toString(2).padStart(32,`0`)},{bits:`32-63`,name:`Longitude`,value:`${p.toFixed(6)}° (raw: ${f})`,binary:f.toString(2).padStart(32,`0`)}]}),i+=16}if(s&&t.length>=i+4){let r=t.slice(i,i+4),a=parseInt(r,16);e.push({name:`Feature 1`,byteRange:`${(n+i)/2}-${(n+i+3)/2}`,hexData:r.match(/.{2}/g)?.join(` `)||r,description:`Reserved feature 1 (2 bytes)`,fields:[{bits:`0-15`,name:`Feature 1 Value`,value:`${a}`,binary:a.toString(2).padStart(16,`0`)}]}),i+=4}if(c&&t.length>=i+4){let r=t.slice(i,i+4),a=parseInt(r,16);e.push({name:`Feature 2`,byteRange:`${(n+i)/2}-${(n+i+3)/2}`,hexData:r.match(/.{2}/g)?.join(` `)||r,description:`Reserved feature 2 (2 bytes)`,fields:[{bits:`0-15`,name:`Feature 2 Value`,value:`${a}`,binary:a.toString(2).padStart(16,`0`)}]}),i+=4}if(l&&t.length>i){let r=t.slice(i),a=r.match(/.{2}/g)||[],o=a.map(e=>{let t=parseInt(e,16);return t>=32&&t<=126?String.fromCharCode(t):`.`}).join(``).replace(/\.+$/,``);e.push({name:`Node Name`,byteRange:`${(n+i)/2}-${(n+t.length-1)/2}`,hexData:r.match(/.{2}/g)?.join(` `)||r,description:`Node name string (${a.length} bytes)`,fields:[{bits:`0-${a.length*8-1}`,name:`Node Name`,value:`"${o}"`,binary:`ASCII text (${a.length} bytes)`}]})}}}catch(n){e.push({name:`AppData Parse Error`,byteRange:`N/A`,hexData:t.slice(0,Math.min(32,t.length)),description:`Failed to parse AppData structure`,fields:[{bits:`N/A`,name:`Error`,value:`Parse error: ${n instanceof Error?n.message:`Unknown error`}`,binary:`Invalid`}]})}},q=e=>{if(!e)return[];if(Array.isArray(e))return e;if(typeof e==`string`)try{return JSON.parse(e)}catch{return[]}return[]},ar=e=>{let t=j(e),n=j(w.localHash);return!t||!n?!1:n.startsWith(t)||t.startsWith(n)},or=(e,t,n)=>n?{name:`This repeater`,matchDetail:``,matchConfidence:null,matchCandidates:[]}:t?{name:t.name,matchDetail:`${t.confidencePercent}% key match`,matchConfidence:t.confidencePercent,matchCandidates:t.candidates}:{name:`Unknown contact`,matchDetail:``,matchConfidence:null,matchCandidates:[]},J=e=>{let t=q(e.original_path),n=q(e.forwarded_path),r=Math.max(t.length,n.length);return Array.from({length:r},(r,i)=>{let a=t[i]||``,o=n[i]||``,s=a.toUpperCase(),c=o.toUpperCase(),l=!!s,u=!!c,d=l&&u&&s===c,f=c||s,p=e.transmitted&&u&&n.length>0&&i===n.length-1,m=ar(f)||p,h=or(f,I(f),m);return{hop:i+1,hash:f,name:h.name,matchDetail:h.matchDetail,matchConfidence:h.matchConfidence,matchCandidates:h.matchCandidates,seen:s,relayed:c,seenName:I(s)?.name??null,relayedName:I(c)?.name??null,isUnchanged:d,changedFromSeen:l&&u&&!d,status:l&&u?d?`unchanged`:`rewritten`:l?`seen-only`:`relayed-only`,localMatch:m}})},Y=(e,t)=>e!=null&&e<100&&t.length>1,X=e=>{let t=J(e).map(e=>e.matchConfidence).filter(e=>e!=null);return t.length===0?null:Math.max(...t)},sr=e=>J(e).some(e=>e.matchConfidence!=null&&e.matchConfidence<50),cr=(e,t)=>t?`text-accent-cyan`:e==null?`text-content-muted`:e>=80?`text-accent-green`:e>=50?`text-accent-amber`:`text-accent-red`,lr=(e,t)=>t?`bg-accent-cyan/opacity-heavy`:e==null?`bg-stroke-subtle`:e>=80?`bg-accent-green/opacity-heavy`:e>=50?`bg-accent-amber/opacity-heavy`:`bg-accent-red/opacity-heavy`,ur=(e,t)=>t?`100%`:e==null?`20%`:`${Math.max(8,e)}%`,dr=(e,t)=>t?`border-accent-cyan text-accent-cyan`:e==null?`border-stroke-subtle text-content-muted`:e>=80?`border-accent-green text-accent-green`:e>=50?`border-accent-amber text-accent-amber`:`border-accent-red text-accent-red`,fr=e=>{let t=[];if(!e)return t;try{let n=e.raw_packet;if(n){let e=n.replace(/\s+/g,``).toUpperCase(),r=0;if(e.length>=2){let n=e.slice(r,r+2),i=parseInt(n,16),a=i&3,o=(i&60)>>2,s=(i&192)>>6;if(t.push({name:`Header`,byteRange:`0`,hexData:`0x${n}`,description:`Contains routing type, payload type, and payload version`,fields:[{bits:`0-1`,name:`Route Type`,value:{0:`Transport Flood`,1:`Flood`,2:`Direct`,3:`Transport Direct`}[a]||`Unknown`,binary:a.toString(2).padStart(2,`0`)},{bits:`2-5`,name:`Payload Type`,value:{0:`REQ`,1:`RESPONSE`,2:`TXT_MSG`,3:`ACK`,4:`ADVERT`,5:`GRP_TXT`,6:`GRP_DATA`,7:`ANON_REQ`,8:`PATH`,9:`TRACE`,10:`MULTIPART`,15:`RAW_CUSTOM`}[o]||`Unknown`,binary:o.toString(2).padStart(4,`0`)},{bits:`6-7`,name:`Version`,value:s.toString(),binary:s.toString(2).padStart(2,`0`)}]}),r+=2,(a===0||a===3)&&e.length>=r+8){let n=e.slice(r,r+8),i=parseInt(n.slice(0,4),16),a=parseInt(n.slice(4,8),16);t.push({name:`Transport Codes`,byteRange:`1-4`,hexData:`${n.slice(0,4)} ${n.slice(4,8)}`,description:`2x 16-bit transport codes for routing optimization`,fields:[{bits:`0-15`,name:`Code 1`,value:i.toString(),binary:i.toString(2).padStart(16,`0`)},{bits:`16-31`,name:`Code 2`,value:a.toString(),binary:a.toString(2).padStart(16,`0`)}]}),r+=8}if(e.length>=r+2){let n=e.slice(r,r+2),i=parseInt(n,16),a=(i>>6)+1,o=i&63,s=o*a;if(t.push({name:`Path Length`,byteRange:`${r/2}`,hexData:`0x${n}`,description:`${o} hop${o===1?``:`s`}, ${a}-byte hash${a>1?`es`:``} (${s} bytes)`,fields:[{bits:`6-7`,name:`Hash Size`,value:`${a}-byte`,binary:(i>>6&3).toString(2).padStart(2,`0`)},{bits:`0-5`,name:`Hop Count`,value:`${o}`,binary:(i&63).toString(2).padStart(6,`0`)}]}),r+=2,s>0&&e.length>=r+s*2){let n=e.slice(r,r+s*2),i=RegExp(`.{${a*2}}`,`g`),c=n.match(i)||[];t.push({name:`Path Data`,byteRange:`${r/2}-${(r+s*2-2)/2}`,hexData:c.join(` `)||n,description:`${o} × ${a}-byte routing hash${o===1?``:`es`}`,fields:c.map((e,t)=>({bits:`${t*a*8}-${(t+1)*a*8-1}`,name:`Hop ${t+1}`,value:e.toUpperCase(),binary:`${a} byte${a>1?`s`:``}`}))}),r+=s*2}}if(e.length>r){let n=e.slice(r),i=n.length/2;o===4?G(t,n,r):t.push({name:`Payload Data`,byteRange:`${r/2}-${r/2+i-1}`,hexData:n.match(/.{2}/g)?.join(` `)||n,description:`Application data content`,fields:[{bits:`0-${i*8-1}`,name:`Application Data`,value:`${i} bytes`,binary:`${i} bytes (${i*8} bits)`}]})}}}else{if(e.header){let n=e.header.replace(/0x/gi,``).replace(/\s+/g,``).toUpperCase(),r=parseInt(n,16),i=r&3,a=(r&60)>>2,o=(r&192)>>6;t.push({name:`Header`,byteRange:`0`,hexData:`0x${n}`,description:`Contains routing type, payload type, and payload version`,fields:[{bits:`0-1`,name:`Route Type`,value:{0:`Transport Flood`,1:`Flood`,2:`Direct`,3:`Transport Direct`}[i]||`Unknown`,binary:i.toString(2).padStart(2,`0`)},{bits:`2-5`,name:`Payload Type`,value:{0:`REQ`,1:`RESPONSE`,2:`TXT_MSG`,3:`ACK`,4:`ADVERT`,5:`GRP_TXT`,6:`GRP_DATA`,7:`ANON_REQ`,8:`PATH`,9:`TRACE`,10:`MULTIPART`,15:`RAW_CUSTOM`}[a]||`Unknown`,binary:a.toString(2).padStart(4,`0`)},{bits:`6-7`,name:`Version`,value:o.toString(),binary:o.toString(2).padStart(2,`0`)}]}),e.transport_codes&&t.push({name:`Transport Codes`,byteRange:`1-4`,hexData:e.transport_codes,description:`2x 16-bit transport codes for routing optimization`,fields:[{bits:`0-31`,name:`Transport Codes`,value:e.transport_codes,binary:`Available in separate field`}]}),e.original_path&&e.original_path.length>0&&t.push({name:`Original Path`,byteRange:`?`,hexData:e.original_path.join(` `),description:`Original routing path (${e.original_path.length} nodes)`,fields:[{bits:`0-?`,name:`Path Nodes`,value:`${e.original_path.length} nodes`,binary:`Available as node list`}]}),e.forwarded_path&&e.forwarded_path.length>0&&t.push({name:`Forwarded Path`,byteRange:`?`,hexData:e.forwarded_path.join(` `),description:`Forwarded routing path (${e.forwarded_path.length} nodes)`,fields:[{bits:`0-?`,name:`Path Nodes`,value:`${e.forwarded_path.length} nodes`,binary:`Available as node list`}]})}if(e.payload){let n=e.payload.replace(/\s+/g,``).toUpperCase(),r=n.length/2;e.type===4?G(t,n,0):t.push({name:`Payload Data`,byteRange:`0-${r-1}`,hexData:n.match(/.{2}/g)?.join(` `)||n,description:`Application data content (${r} bytes)`,fields:[{bits:`0-${r*8-1}`,name:`Application Data`,value:`${r} bytes`,binary:`${r} bytes (${r*8} bits)`}]})}}}catch{t.push({name:`Parse Error`,byteRange:`N/A`,hexData:`Error`,description:`Unable to parse packet structure`,fields:[{bits:`N/A`,name:`Error`,value:`Parse failed`,binary:`Invalid`}]})}return t},Z=(e,t)=>e==null||t==null?`text-content-muted`:C(t).color,Q=e=>{if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}},$=e=>e>=1e3?`${(e/1e3).toFixed(2)}s`:`${Math.round(e)}ms`,pr=e=>{if(e.key===`Escape`){T(`close`);return}if(e.key===`ArrowUp`){z.value&&(e.preventDefault(),T(`previous`));return}e.key===`ArrowDown`&&B.value&&(e.preventDefault(),T(`next`))},mr=e=>{e.target===e.currentTarget&&T(`close`)};return d(()=>w.isOpen,e=>{e?(document.body.style.overflow=`hidden`,Wn()&&Gn()):document.body.style.overflow=``},{immediate:!0}),d(()=>w.packet?.packet_hash,()=>{P.value=[]}),(r,d)=>(n(),o(u,{to:`body`},[p(te,{name:`modal`,appear:``},{default:t(()=>[c.isOpen&&c.packet?(n(),v(`div`,{key:0,class:`modal-backdrop overflow-hidden !p-2 sm:!p-4`,onClick:mr,onKeydown:pr,tabindex:`0`},[_(`div`,{class:`relative w-full max-w-4xl max-h-[95vh] sm:max-h-[90vh] flex flex-col`,onClick:d[3]||=ee(()=>{},[`stop`])},[_(`div`,ie,[_(`div`,ae,[_(`div`,oe,[d[4]||=_(`h2`,{class:`text-lg sm:text-2xl font-bold text-content-primary mb-1`},` Packet Details `,-1),_(`div`,se,[_(`span`,ce,a(U(c.packet.type)),1),_(`span`,le,a(W(c.packet.route)),1)])]),_(`div`,ue,[Yn.value?(n(),v(`div`,de,[_(`div`,fe,[_(`button`,{type:`button`,class:`w-8 h-8 flex items-center justify-center text-content-secondary dark:text-content-muted hover:text-primary hover:bg-primary/opacity-light transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,disabled:!z.value,title:`Previous packet (↑)`,onClick:nr},[...d[5]||=[_(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M5 15l7-7 7 7`})],-1)]],8,pe),_(`button`,{type:`button`,class:`w-8 h-8 flex items-center justify-center text-content-secondary dark:text-content-muted hover:text-primary hover:bg-primary/opacity-light transition-colors border-l border-stroke-subtle dark:border-stroke/opacity-medium disabled:opacity-40 disabled:cursor-not-allowed`,disabled:!B.value,title:`Next packet (↓)`,onClick:rr},[...d[6]||=[_(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M19 9l-7 7-7-7`})],-1)]],8,me)]),_(`span`,he,a(Xn.value),1)])):f(``,!0),_(`button`,{onClick:d[0]||=e=>E.value=!E.value,class:l([`flex-1 sm:flex-none flex items-center justify-center gap-2 px-3 py-2 rounded-lg transition-all duration-200`,E.value?`bg-accent-cyan/opacity-medium border border-accent-cyan/opacity-medium text-accent-cyan`:`bg-background-mute dark:bg-white/opacity-subtle border border-stroke-subtle dark:border-stroke/opacity-medium text-content-secondary dark:text-content-muted`]),title:E.value?`Hide binary values`:`Show binary values`},[...d[7]||=[_(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4`})],-1),_(`span`,{class:`text-xs font-medium`},`Binary`,-1)]],10,ge),_(`button`,{type:`button`,onClick:d[1]||=e=>T(`close`),"aria-label":`Close packet details`,title:`Close`,class:`w-9 h-9 flex items-center justify-center rounded-lg bg-background-mute dark:bg-white/opacity-light hover:bg-stroke-subtle dark:hover:bg-white/opacity-medium transition-colors duration-200 text-content-secondary dark:text-content-primary hover:text-content-primary dark:hover:text-content-primary`},[...d[8]||=[_(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])])]),_(`div`,_e,[_(`div`,ve,[d[15]||=_(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary mb-4 flex items-center`},[_(`div`,{class:`w-2 h-2 rounded-full bg-accent-cyan/opacity-light mr-3`}),h(` Basic Information `)],-1),_(`div`,ye,[_(`div`,be,[_(`div`,xe,[_(`div`,Se,[d[9]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Timestamp`,-1),_(`span`,Ce,a(L(c.packet.timestamp)),1)]),_(`div`,we,[d[10]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Packet Hash`,-1),_(`span`,Te,a(c.packet.packet_hash),1)]),c.packet.header?(n(),v(`div`,Ee,[d[11]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Header`,-1),_(`span`,De,a(c.packet.header),1)])):f(``,!0)]),_(`div`,Oe,[_(`div`,ke,[d[12]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Type`,-1),_(`span`,Ae,a(c.packet.type)+` (`+a(U(c.packet.type))+`)`,1)]),_(`div`,je,[d[13]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Route`,-1),_(`span`,Me,a(c.packet.route)+` (`+a(W(c.packet.route))+`)`,1)]),_(`div`,x,[d[14]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Status`,-1),_(`span`,{class:l([`font-semibold`,Jn(c.packet)])},a(R(c.packet)),3)])])])])]),H.value.length>0?(n(),v(`div`,Ne,[_(`h3`,Pe,[d[16]||=_(`div`,{class:`w-2 h-2 rounded-full bg-accent-amber/opacity-heavy mr-3`},null,-1),h(` Linked Duplicates (`+a(H.value.length)+`) `,1)]),_(`div`,Fe,[(n(!0),v(g,null,e(H.value,(t,r)=>(n(),v(`div`,{key:`${t.packet.packet_hash}_${t.packet.timestamp}_${r}`,class:`glass-card bg-background-mute dark:bg-white/opacity-subtle rounded-[10px] p-3 border border-stroke-subtle dark:border-stroke/opacity-light`},[_(`div`,Ie,[_(`span`,Le,` Duplicate #`+a(r+1),1),_(`span`,Re,a(L(t.packet.timestamp)),1)]),_(`div`,ze,[d[17]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-xs`},` Path `,-1),_(`span`,Be,a(t.effectivePath),1)]),t.differences.length>0?(n(),v(`div`,Ve,[(n(!0),v(g,null,e(t.differences,e=>(n(),v(`div`,{key:`${t.packet.timestamp}_${e.label}`,class:`flex flex-wrap items-start justify-between gap-2 py-1 border-b border-stroke-subtle/60 dark:border-stroke/opacity-light last:border-b-0`},[_(`span`,He,a(e.label),1),_(`span`,Ue,a(e.currentValue)+` → `+a(e.duplicateValue),1)]))),128))])):(n(),v(`p`,We,` No additional field differences beyond timestamp. `))]))),128))])])):f(``,!0),_(`div`,Ge,[d[29]||=_(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary mb-4 flex items-center`},[_(`div`,{class:`w-2 h-2 rounded-full bg-accent-orange/opacity-light mr-3`}),h(` Payload Data `)],-1),_(`div`,Ke,[_(`div`,qe,[_(`div`,Je,[d[18]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Payload Length`,-1),_(`span`,Ye,a(c.packet.payload_length||c.packet.length)+` bytes`,1)]),c.packet.payload?(n(),v(`div`,Xe,[d[27]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-3`},` Payload Analysis `,-1),_(`div`,Ze,[d[19]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-2 font-semibold`},` Raw Hex Data `,-1),_(`div`,Qe,[_(`pre`,$e,a(ir(c.packet.payload)),1)])]),(n(!0),v(g,null,e(fr(c.packet).filter(e=>!e.name.includes(`Parse Error`)&&![`Path Length`,`Path Data`,`Original Path`,`Forwarded Path`].includes(e.name)),(t,r)=>(n(),v(`div`,{key:r,class:`mb-4`},[_(`div`,et,[_(`h4`,tt,a(t.name),1),_(`span`,nt,`Bytes `+a(t.byteRange),1)]),_(`div`,rt,[_(`div`,it,a(t.hexData),1)]),_(`div`,at,[_(`div`,{class:l([`hidden md:grid gap-3 p-3 bg-background-mute dark:bg-white/opacity-subtle text-content-secondary dark:text-content-muted text-xs font-semibold uppercase tracking-wide`,E.value?`grid-cols-4`:`grid-cols-3`])},[d[20]||=_(`div`,{class:`min-w-0`},`Bits`,-1),d[21]||=_(`div`,{class:`min-w-0`},`Field`,-1),d[22]||=_(`div`,{class:`min-w-0`},`Value`,-1),E.value?(n(),v(`div`,ot,`Binary`)):f(``,!0)],2),(n(!0),v(g,null,e(t.fields,(e,t)=>(n(),v(`div`,{key:t,class:l([`hidden md:grid gap-3 p-3 border-b border-stroke-subtle dark:border-stroke/opacity-light last:border-b-0 hover:bg-background-mute dark:hover:bg-stroke/opacity-subtle transition-colors`,E.value?`grid-cols-4`:`grid-cols-3`])},[_(`div`,st,a(e.bits),1),_(`div`,ct,a(e.name),1),_(`div`,lt,[_(`span`,{class:`block`,title:e.value},a(e.value),9,ut)]),E.value?(n(),v(`div`,dt,[_(`span`,{class:`block`,title:e.binary},a(e.binary),9,ft)])):f(``,!0)],2))),128)),(n(!0),v(g,null,e(t.fields,(e,t)=>(n(),v(`div`,{key:`mobile-${t}`,class:`md:hidden p-3 border-b border-stroke-subtle dark:border-stroke/opacity-light last:border-b-0 space-y-2`},[_(`div`,pt,[_(`div`,null,[d[23]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide`},`Bits:`,-1),_(`div`,mt,a(e.bits),1)]),_(`div`,null,[d[24]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide`},`Field:`,-1),_(`div`,ht,a(e.name),1)])]),_(`div`,null,[d[25]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide`},`Value:`,-1),_(`div`,{class:`text-content-primary text-sm font-semibold break-all`,title:e.value},a(e.value),9,gt)]),E.value?(n(),v(`div`,_t,[d[26]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-xs uppercase tracking-wide`},`Binary:`,-1),_(`div`,{class:`text-accent-orange text-xs font-mono break-all`,title:e.binary},a(e.binary),9,vt)])):f(``,!0)]))),128))]),t.description?(n(),v(`div`,yt,a(t.description),1)):f(``,!0)]))),128))])):(n(),v(`div`,bt,[...d[28]||=[_(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Payload:`,-1),_(`span`,{class:`text-content-muted ml-2`},`None`,-1)]]))])])]),_(`div`,xt,[d[33]||=_(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary mb-4 flex items-center`},[_(`div`,{class:`w-2 h-2 rounded-full status-dot-secondary mr-3`}),h(` Path Information `)],-1),_(`div`,St,[_(`div`,Ct,[_(`div`,wt,[_(`div`,Tt,[d[30]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Source Hash`,-1),_(`span`,{class:l([`text-content-primary font-mono text-xs`,w.localHash&&c.packet.src_hash===w.localHash?`bg-accent-cyan/opacity-medium text-accent-cyan px-1 rounded`:``])},a(c.packet.src_hash||`Unknown`),3)]),_(`div`,Et,[d[31]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Destination Hash`,-1),_(`span`,{class:l([`text-content-primary font-mono text-xs`,w.localHash&&c.packet.dst_hash===w.localHash?`bg-accent-cyan/opacity-medium text-accent-cyan px-1 rounded`:``])},a(c.packet.dst_hash||`Broadcast`),3)])]),J(c.packet).length>0?(n(),v(`div`,Dt,[_(`div`,Ot,[d[32]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-sm font-medium`},` Repeater Path View `,-1),_(`span`,kt,a(J(c.packet).length)+` hops `,1),X(c.packet)==null?f(``,!0):(n(),v(`span`,At,` Best match `+a(X(c.packet))+`% `,1)),sr(c.packet)?(n(),v(`span`,jt,` Low confidence `)):f(``,!0),O.value?(n(),v(`span`,Mt,` Resolving names... `)):f(``,!0)]),_(`div`,Nt,[_(`div`,Pt,[(n(!0),v(g,null,e(J(c.packet),(t,r)=>(n(),v(`div`,{key:`timeline-${t.hop}`,class:`relative z-10 grid grid-cols-[42px_1fr] sm:grid-cols-[52px_1fr] gap-3 items-center`},[_(`div`,Ft,[r>0?(n(),v(`div`,It)):f(``,!0),r<J(c.packet).length-1?(n(),v(`div`,Lt)):f(``,!0),_(`div`,{class:l([`relative z-10 w-9 h-9 sm:w-10 sm:h-10 rounded-full border-2 bg-background-mute dark:bg-surface-elevated flex items-center justify-center font-mono text-xs sm:text-sm font-semibold`,dr(t.matchConfidence,t.localMatch)])},` #`+a(t.hop),3)]),_(`div`,Rt,[_(`div`,zt,[_(`div`,Bt,[_(`div`,{class:`text-xs sm:text-sm font-bold text-content-primary truncate`,title:t.name||`Unknown contact`},a(t.name||`Unknown contact`),9,Vt),t.matchDetail?(n(),v(`div`,{key:0,class:l([`text-[10px] sm:text-[11px] leading-tight mt-0.5`,cr(t.matchConfidence,t.localMatch)])},a(t.matchDetail),3)):f(``,!0),Y(t.matchConfidence,t.matchCandidates)?(n(),v(`button`,{key:1,type:`button`,class:`mt-1 text-[10px] sm:text-[11px] text-accent-cyan hover:text-primary transition-colors`,onClick:e=>Kn(t.hop)},a(F(t.hop)?`Hide possible matches`:`Show ${t.matchCandidates.length-1} possible matches`),9,Ht)):t.localMatch?(n(),v(`div`,Ut,` current repeater `)):f(``,!0),Y(t.matchConfidence,t.matchCandidates)&&F(t.hop)?(n(),v(`div`,Wt,[(n(!0),v(g,null,e(t.matchCandidates.slice(1),(e,r)=>(n(),v(`div`,{key:`${t.hop}-${e.pubkey}-${r}`,class:`flex items-center justify-between gap-2 text-[10px] sm:text-[11px] rounded-md px-2 py-1 bg-background-mute/opacity-heavy dark:bg-white/opacity-subtle border border-stroke-subtle dark:border-stroke/opacity-light`},[_(`span`,Gt,a(e.name),1),_(`span`,Kt,a(qn(e.pubkey)),1)]))),128))])):f(``,!0)]),_(`div`,{class:l([`font-mono text-sm sm:text-lg rounded-[10px] px-3 sm:px-4 py-1.5 sm:py-2 border min-w-[64px] sm:min-w-[84px] text-center`,t.hash?t.localMatch?`bg-accent-cyan/opacity-medium border-accent-cyan/opacity-heavy text-accent-cyan`:`bg-background-mute dark:bg-white/opacity-subtle border-primary/opacity-heavy text-content-primary`:`bg-background-mute/opacity-heavy border-stroke-subtle text-content-muted`]),title:t.hash||`No hop`},a(t.hash||`-`),11,qt)]),_(`div`,Jt,[_(`div`,Yt,[_(`div`,{class:l([`h-full rounded-full transition-all duration-300`,lr(t.matchConfidence,t.localMatch)]),style:s({width:ur(t.matchConfidence,t.localMatch)})},null,6)])])])]))),128))])])])):f(``,!0)])])]),_(`div`,Xt,[d[50]||=_(`h3`,{class:`text-base sm:text-lg font-semibold text-content-primary mb-4 flex items-center`},[_(`div`,{class:`w-2 h-2 rounded-full bg-accent-green/opacity-light mr-3`}),h(` Signal & Processing `)],-1),_(`div`,Zt,[_(`div`,Qt,[_(`div`,$t,[d[34]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` RSSI `,-1),_(`div`,en,a(typeof c.packet.rssi==`number`?c.packet.rssi:`N/A`),1),d[35]||=_(`div`,{class:`text-content-muted text-xs`},`dBm`,-1)]),_(`div`,tn,[d[36]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` SNR `,-1),_(`div`,{class:l([`text-lg font-bold`,Z(c.packet.snr,c.packet.rssi)])},a(typeof c.packet.snr==`number`?c.packet.snr.toFixed(1):`N/A`),3),d[37]||=_(`div`,{class:`text-content-muted text-xs`},`dB`,-1)]),_(`div`,nn,[d[38]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` Score `,-1),_(`div`,rn,a(typeof c.packet.score==`number`?c.packet.score.toFixed(3):`N/A`),1)])]),c.packet.rssi==null?(n(),v(`div`,sn,[...d[40]||=[_(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-2`},` Signal Quality `,-1),_(`div`,{class:`text-content-muted text-sm italic`},` N/A (TX Packet) `,-1)]])):(n(),v(`div`,an,[d[39]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-2`},` Signal Quality `,-1),_(`div`,on,[p(re,{bars:i(C)(c.packet.rssi).bars,color:i(C)(c.packet.rssi).color},null,8,[`bars`,`color`]),_(`span`,{class:l([`text-sm font-medium`,i(C)(c.packet.rssi).color])},a(i(C)(c.packet.rssi).quality),3)])])),c.packet.is_trace&&c.packet.path_snr_details&&c.packet.path_snr_details.length>0?(n(),v(`div`,cn,[_(`div`,ln,` Path SNR Details (`+a(c.packet.path_snr_details.length)+` hops) `,1),_(`div`,un,[(n(!0),v(g,null,e(c.packet.path_snr_details,(e,t)=>(n(),v(`div`,{key:t,class:`flex items-center justify-between p-2 glass-card bg-background-mute dark:bg-white/opacity-subtle rounded-[8px]`},[_(`div`,dn,[_(`span`,fn,a(t+1)+`.`,1),_(`span`,{class:l([`font-mono text-xs text-content-primary`,w.localHash&&e.hash===w.localHash?`bg-accent-cyan/opacity-medium text-accent-cyan px-1 rounded`:``])},a(e.hash.toUpperCase()),3)]),_(`span`,{class:l([`text-sm font-bold`,Z(e.snr_db,null)])},a(e.snr_db.toFixed(1))+`dB `,3)]))),128))])])):f(``,!0),c.packet.transmitted&&c.packet.lbt_attempts!==void 0?(n(),v(`div`,S,[d[45]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-3 flex items-center`},[_(`svg`,{class:`w-4 h-4 mr-2`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[_(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z`})]),h(` Listen Before Talk (LBT) Metrics `)],-1),_(`div`,pn,[_(`div`,mn,[d[41]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` CAD Attempts `,-1),_(`div`,hn,a(c.packet.lbt_attempts),1)]),_(`div`,gn,[d[42]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` Total LBT Delay `,-1),_(`div`,_n,a($(Q(c.packet.lbt_backoff_delays_ms).reduce((e,t)=>e+t,0))),1),_(`div`,vn,a(Q(c.packet.lbt_backoff_delays_ms).length)+` backoffs `,1)]),_(`div`,yn,[d[43]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-1`},` Channel Status `,-1),_(`div`,{class:l([`text-lg font-bold`,c.packet.lbt_channel_busy?`text-accent-amber`:`text-accent-green`])},a(c.packet.lbt_channel_busy?`BUSY`:`CLEAR`),3),_(`div`,bn,a(c.packet.lbt_channel_busy?`Waited for clear`:`Immediate TX`),1)])]),Q(c.packet.lbt_backoff_delays_ms).length>0?(n(),v(`div`,xn,[d[44]||=_(`div`,{class:`text-content-secondary dark:text-content-muted text-xs mb-3 font-semibold`},` Backoff Pattern (Exponential with Jitter) `,-1),_(`div`,Sn,[(n(!0),v(g,null,e(Q(c.packet.lbt_backoff_delays_ms),(e,t)=>(n(),v(`div`,{key:t,class:`flex items-center gap-3`},[_(`div`,Cn,[_(`span`,wn,`Attempt `+a(t+1),1)]),_(`div`,Tn,[_(`div`,En,[_(`div`,{class:l([`h-full rounded-lg transition-all duration-300`,[t===0?`bg-gradient-to-r from-cyan-500/50 to-cyan-600/50`:t===1?`bg-gradient-to-r from-yellow-500/50 to-yellow-600/50`:t===2?`bg-gradient-to-r from-orange-500/50 to-orange-600/50`:`bg-gradient-to-r from-red-500/50 to-red-600/50`]]),style:s({width:`${Math.min(100,e/Math.max(...Q(c.packet.lbt_backoff_delays_ms))*100)}%`})},[_(`div`,Dn,[_(`span`,On,a($(e)),1)])],6)])]),_(`div`,kn,[_(`span`,An,a(Math.round(e/Q(c.packet.lbt_backoff_delays_ms).reduce((e,t)=>e+t,0)*100))+`% `,1)])]))),128))])])):f(``,!0)])):f(``,!0),_(`div`,jn,[_(`div`,Mn,[_(`div`,Nn,[d[46]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`TX Delay`,-1),_(`span`,Pn,a(Number(c.packet.tx_delay_ms)>0?Number(c.packet.tx_delay_ms).toFixed(1)+`ms`:`-`),1)]),_(`div`,Fn,[d[47]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Transmitted`,-1),_(`span`,{class:l(c.packet.transmitted?`text-accent-green`:`text-accent-red`)},a(c.packet.transmitted?`Yes`:`No`),3)])]),_(`div`,In,[_(`div`,Ln,[d[48]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Is Duplicate`,-1),_(`span`,{class:l(c.packet.is_duplicate?`text-accent-amber`:`text-content-muted`)},a(c.packet.is_duplicate?`Yes`:`No`),3)]),c.packet.drop_reason?(n(),v(`div`,Rn,[d[49]||=_(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Drop Reason`,-1),_(`span`,zn,a(c.packet.drop_reason),1)])):f(``,!0)])])])])]),_(`div`,Bn,[_(`button`,{type:`button`,onClick:d[2]||=e=>T(`close`),"aria-label":`Close packet details`,class:`w-full sm:w-auto px-6 py-2 bg-gradient-to-r from-cyan-500/20 to-cyan-400/20 hover:from-cyan-500/30 hover:to-cyan-400/30 border border-accent-cyan/opacity-medium rounded-[10px] text-content-primary transition-all duration-200 backdrop-blur-sm`},` Close `)])])])],32)):f(``,!0)]),_:1})]))}}),[[`__scopeId`,`data-v-e95d3629`]]);export{C as t}; |