Files
pymc_console-dist/frontend/dist/assets/usePipelineStore-CLEA3Bev.js
GitHub Actions Bot c8c3f164ee Sync build v0.9.286
Automated sync from private repository.
Commit: fad7f9633de61427bfc2c672b7ddecaa0952d717
2026-02-27 07:48:08 +00:00

3 lines
22 KiB
JavaScript

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-react-alRNW2nb.js","assets/vendor-core-FtpmsTnh.js","assets/vendor-charts-D1GxaB_c.css","assets/vendor-fonts-hkYiuhFD.css","assets/index-BawBpZYt.css"])))=>i.map(i=>d[i]);
import{_ as e}from"./cosmograph-DqYT4sUA.js";import{r as t}from"./vendor-react-alRNW2nb.js";import{c as n,m as o,i as s}from"./node-types-DRVunROD.js";import{H as a,ar as r,cs as i,ct as c,cp as l,cu as d}from"./index-CkRTgHHA.js";import{c as u,P as h}from"./geo-utils-DJn8DnxF.js";import{a as f}from"./vendor-core-FtpmsTnh.js";function p(e){if(e.contact_type){const t=e.contact_type.toLowerCase();if("repeater"===t||"rep"===t)return!0;if("companion"===t||"client"===t||"cli"===t)return!1;if("room server"===t||"room_server"===t||"room"===t||"server"===t)return!1}return!0===e.is_repeater||(e.is_repeater,!1)}function g(e){const t={};for(const[n,o]of Object.entries(e))p(o)&&(t[n]=o);return t}function m(e,t){if(!e||e<=0)return.1;const n=(Math.floor(Date.now()/1e3)-e)/3600;return n<0?1:Math.exp(-n/12)}function v(e){return!(!e||e<=0)&&(Math.floor(Date.now()/1e3)-e)/3600>336}function y(e,t,n,o,s){const r=new Map,l=g(t),d=new Map,f=void 0!==o&&void 0!==s&&(0!==o||0!==s);if(n){const e=a(n),t={hash:n,prefix:e,positionCounts:new Array(5).fill(0),totalAppearances:0,typicalPosition:0,positionConsistency:0,adjacentPrefixCounts:new Map,totalAdjacentObservations:0,latitude:o,longitude:s,distanceToLocal:0,srcGeoEvidenceScore:0,srcGeoEvidenceCount:0,lastSeenTimestamp:Math.floor(Date.now()/1e3),recencyScore:1,positionScore:0,cooccurrenceScore:0,geographicScore:1,combinedScore:0};d.set(e,[t])}for(const[i,c]of Object.entries(l)){const e=a(i),t=c.last_seen??0;if(v(t))continue;let n;const r=!0===c.zero_hop;f&&c.latitude&&c.longitude&&(0!==c.latitude||0!==c.longitude)&&(n=u(o,s,c.latitude,c.longitude));let l=.2;void 0!==n?l=n<h.VERY_CLOSE?1:n<h.CLOSE?.8:n<h.MEDIUM?.6:n<h.FAR?.4:n<h.VERY_FAR?.2:.1:c.latitude&&c.longitude&&(l=.5);const p=m(t);if(r&&p>.01){const e=t>0?(Math.floor(Date.now()/1e3)-t)/3600:1/0,n=Math.exp(-e/72);l=Math.max(l,.95*n)}const g={hash:i,prefix:e,name:c.name||c.node_name,positionCounts:new Array(5).fill(0),totalAppearances:0,typicalPosition:0,positionConsistency:0,adjacentPrefixCounts:new Map,totalAdjacentObservations:0,latitude:c.latitude,longitude:c.longitude,distanceToLocal:n,srcGeoEvidenceScore:0,srcGeoEvidenceCount:0,lastSeenTimestamp:t,recencyScore:p,positionScore:0,cooccurrenceScore:0,geographicScore:l,combinedScore:0},y=d.get(e)||[];y.push(g),d.set(e,y)}for(const a of e){const e=i(a,n);if(!e||0===e.effectiveLength)continue;const o=e.effective,s=a.src_hash,r=s?t[s]:void 0,l=(null==r?void 0:r.latitude)&&(null==r?void 0:r.longitude)&&(0!==r.latitude||0!==r.longitude);for(let t=0;t<o.length;t++){const n=o[t],s=d.get(n);if(!s)continue;const a=c(t,e.effectiveLength),i=Math.min(a-1,4);for(const e of s){if(e.positionCounts[i]++,e.totalAppearances++,1===a&&s.length>1&&l&&e.latitude&&e.longitude){const t=u(r.latitude,r.longitude,e.latitude,e.longitude);let n=0;n=t<500?1:t<2e3?.8:t<5e3?.5:t<1e4?.3:.1,void 0!==e.distanceToLocal&&(e.distanceToLocal<500?n*=1.2:e.distanceToLocal<2e3?n*=1:n*=.8),e.srcGeoEvidenceScore+=n,e.srcGeoEvidenceCount++}if(t>0&&s.length>1&&e.latitude&&e.longitude){const n=o[t-1],s=d.get(n);if(s&&s.length>0){let t,n,o=0;if(1===s.length){const e=s[0];e.latitude&&e.longitude&&(t=e.latitude,n=e.longitude,o=1)}else{const e=[...s].sort((e,t)=>t.combinedScore-e.combinedScore),a=e[0],r=e[1];if(a.latitude&&a.longitude&&a.combinedScore>0){const e=r?(a.combinedScore-r.combinedScore)/a.combinedScore:1;o=Math.min(1,e+.3),o>.4&&(t=a.latitude,n=a.longitude)}}if(void 0!==t&&void 0!==n){const s=u(e.latitude,e.longitude,t,n);let a=0;a=s<500?1:s<2e3?.8:s<5e3?.5:s<1e4?.3:.1,a*=o,e.srcGeoEvidenceScore+=a,e.srcGeoEvidenceCount++}}}if(a>1&&s.length>1&&e.latitude&&e.longitude){const n=t+1;if(n<o.length){const t=o[n],s=d.get(t);if(s&&s.length>0){let t,n,o=0;if(1===s.length){const e=s[0];e.latitude&&e.longitude&&(t=e.latitude,n=e.longitude,o=1)}else{const e=[...s].sort((e,t)=>t.combinedScore-e.combinedScore),a=e[0],r=e[1];if(a.latitude&&a.longitude&&a.combinedScore>0){const e=r?(a.combinedScore-r.combinedScore)/a.combinedScore:1;o=Math.min(1,e+.3),o>.4&&(t=a.latitude,n=a.longitude)}}if(void 0!==t&&void 0!==n){const s=u(e.latitude,e.longitude,t,n);let a=0;a=s<500?1:s<2e3?.8:s<5e3?.5:s<1e4?.3:.1,a*=o,e.srcGeoEvidenceScore+=a,e.srcGeoEvidenceCount++}}}}if(t>0){const n=o[t-1];e.adjacentPrefixCounts.set(n,(e.adjacentPrefixCounts.get(n)||0)+1),e.totalAdjacentObservations++}if(t<o.length-1){const n=o[t+1];e.adjacentPrefixCounts.set(n,(e.adjacentPrefixCounts.get(n)||0)+1),e.totalAdjacentObservations++}}}}let p=1,y=1;for(const a of d.values())for(const e of a)p=Math.max(p,e.totalAppearances),y=Math.max(y,e.totalAdjacentObservations);for(const a of d.values())for(const e of a){if(e.totalAppearances>0){let t=0,n=1;for(let s=0;s<5;s++)e.positionCounts[s]>t&&(t=e.positionCounts[s],n=s+1);e.typicalPosition=n,e.positionConsistency=t/e.totalAppearances;const o=e.totalAppearances/p;e.positionScore=.6*e.positionConsistency+.4*o}if(e.totalAdjacentObservations>0&&(e.cooccurrenceScore=e.totalAdjacentObservations/y),e.combinedScore=.15*e.positionScore+.15*e.cooccurrenceScore+.35*e.geographicScore+.35*e.recencyScore,e.srcGeoEvidenceCount>0){const t=e.srcGeoEvidenceScore/e.srcGeoEvidenceCount*Math.min(e.srcGeoEvidenceCount/50,1)*.3;e.combinedScore+=t}}for(const[a,i]of d){i.sort((e,t)=>t.combinedScore-e.combinedScore);const e=i.length>0?i[0].hash:null;let t=0;if(1===i.length)t=1;else if(i.length>1){const e=i[0].combinedScore,n=i[1].combinedScore;e>0&&(t=Math.min(1,(e-n)/e)),i[0].totalAppearances>2*i[1].totalAppearances&&(t=Math.min(1,t+.2));const o=0,s=i[0].positionCounts[o]||0,a=s+(i[1].positionCounts[o]||0);if(a>=20&&s>=10){const e=s/a;if(e>=.8){const n=.3+1.5*(e-.8);t=Math.min(1,t+n)}}const r=i.reduce((e,t)=>e+t.combinedScore,0);if(r>0){const e=[],n=i.reduce((e,t)=>e+(t.positionCounts[0]||0),0);for(const t of i){const o=n*(t.combinedScore/r);e.push(o)}const o=e[0],s=o+(e[1]||0);if(s>=20&&o>=10){const e=o/s;if(e>=.6){const n=.2+1*(e-.6);t=Math.min(1,t+n)}}}const c=i[0].srcGeoEvidenceScore,l=i[1].srcGeoEvidenceScore;if(i[0].srcGeoEvidenceCount>=10&&c>1.5*l){const e=l>0?c/(c+l):1,n=Math.min(.3,.6*(e-.5));t=Math.min(1,t+n)}}const n=new Map;for(let s=1;s<=5;s++){const e=[...i].sort((e,t)=>{const n=e.positionCounts[s-1]||0;return(t.positionCounts[s-1]||0)-n});if(e.length>0&&e[0].positionCounts[s-1]>0){const t=e[0];let o=1;if(e.length>1){const n=t.positionCounts[s-1],a=n+(e[1].positionCounts[s-1]||0);o=a>0?n/a:0}n.set(s,{hash:t.hash,confidence:o})}}const o={prefix:a,candidates:i,bestMatch:e,confidence:t,isUnambiguous:1===i.length,bestMatchForPosition:n};r.set(a,o)}return r}function w(e,t,n){const o=t.toUpperCase(),s=e.get(o);if(!s||0===s.candidates.length)return{hash:null,confidence:0};if(null==n?void 0:n.isLastHop)return{hash:s.bestMatch,confidence:s.confidence};if(1===(null==n?void 0:n.position))return{hash:s.bestMatch,confidence:s.confidence};if((null==n?void 0:n.position)&&s.bestMatchForPosition.has(n.position)){const e=s.bestMatchForPosition.get(n.position),t=Math.max(e.confidence,s.confidence);return{hash:e.hash,confidence:t}}if((null==n?void 0:n.adjacentPrefixes)&&n.adjacentPrefixes.length>0){let e=s.bestMatch,t=0;for(const o of s.candidates){let s=0;for(const e of n.adjacentPrefixes)s+=o.adjacentPrefixCounts.get(e.toUpperCase())||0;const a=o.combinedScore+s/Math.max(1,o.totalAdjacentObservations)*.3;a>t&&(t=a,e=o.hash)}return{hash:e,confidence:s.confidence}}return{hash:s.bestMatch,confidence:s.confidence}}function _(e){if(!e||e.length<6)return null;const t=e,n=parseInt(t.slice(0,2),16);if(isNaN(n))return null;const o=3&n;let s=2;if(0!==o&&3!==o||(s=10),s+2>t.length)return null;const a=parseInt(t.slice(s,s+2),16);if(isNaN(a))return null;if(s+=2+2*a,s>=t.length)return null;const r=t.slice(s);return r.length>=38?r.slice(0,38):r}function M(e,t="name-only"){const n=e.decoded;if(!n||!n.decrypted)return null;if(n.macCorrupted)switch(t){case"strict":return null;case"name-only":return{senderName:n.senderName||null,channelName:n.channelName||null,channelHash:n.channelHash||null,text:null,corrupted:!0,decrypted:!0}}return{senderName:n.senderName||null,channelName:n.channelName||null,channelHash:n.channelHash||null,text:n.text||null,corrupted:!!n.macCorrupted,decrypted:!0}}function b(e){return e.name||e.node_name||null}function C(e,t,n,o,s,a,r){return{hash:e,type:t,name:n,isRepeater:"repeater"===t,isCompanion:"companion"===t,confident:o,advertObservations:s,topologyNeighborCount:a,topologyAffinity:r}}const S=Object.freeze(C(null,"unknown",null,!1,0,0,0)),T={disambiguationEnabled:!0,recencyDecayHours:12,zeroHopDecayHours:72,confidenceThreshold:.6,macCorruptedPolicy:"name-only"},x={hashToType:new Map,pubKeyMap:new Map,prefixIndex:new Map,crossClassPrefixes:new Set,sameClassAmbiguous:new Set,nameToHash:new Map,hashToName:new Map},N={byPayload:new Map,byApprox:new Map},H=f((e,t)=>({config:T,neighborContext:x,extendedHashToType:new Map,advertNameToHash:new Map,advertHashToName:new Map,resolverMap:new Map,topologyProfiles:new Map,decryptedNameToHash:new Map,decryptedHashToName:new Map,srcHashResolverMap:new Map,contentInheritanceIndex:N,_cache:new Map,_neighborFingerprint:"",_resolverFingerprint:"",_advertScanFingerprint:"",_decodedNameFingerprint:"",_inheritanceFingerprint:"",_decodedContentVersion:0,resolveSource:e=>{const n=t();return n.config.disambiguationEnabled?function(e,t,n,r,i,c,l,d,u,h,f){var p,g,m,v,y,w;const _=e.src_hash,M=null==d?void 0:d.get(e.packet_hash),b=(null==(p=null==M?void 0:M.decoded)?void 0:p.senderName)??null,{nameToHash:T}=t;if(!_){const t=e.type??e.payload_type,a=s(t),i=e._advertName??null;if(b){const e=b.toLowerCase(),t=T.get(e)??r.get(e)??u.get(e);return t?C(t,n.get(t)??a,b,!0):C(null,"unknown"!==a?a:"companion",b,!1)}if("unknown"!==a)return C(null,a,i,!1);if(null!=e._advertNodeType){const t=o(e._advertNodeType);if("unknown"!==t)return C(null,t,i,!1)}return i?C(null,"unknown",i,!1):S}const x=e.type??e.payload_type??-1,N=e._advertSender?`${_}\0${e._advertSender}`:`${_}\0${x}\0${b??""}`,H=f.get(N);if(H)return H;const P=a(_),{pubKeyMap:A,prefixIndex:j,crossClassPrefixes:E,sameClassAmbiguous:k}=t;let O;if(e._advertSender){const t=A.get(e._advertSender);if(t){const e=n.get(t)??"unknown",o=null==(g=j.get(P))?void 0:g.find(e=>e.hash===t);O=C(t,e,(null==o?void 0:o.name)??null,!0)}}if(!O&&b){const e=j.get(P),t=null==e?void 0:e.find(e=>{var t;return(null==(t=e.name)?void 0:t.toLowerCase())===b.toLowerCase()});if(t){const e=n.get(t.hash)??t.type;O=C(t.hash,e,t.name,!0)}else{const e=b.toLowerCase(),t=T.get(e)??r.get(e)??u.get(e);if(t){const e=n.get(t)??"unknown",o=null==(m=j.get(a(t)))?void 0:m.find(e=>e.hash===t);O=C(t,e,(null==o?void 0:o.name)??b,!0)}}}if(!O&&E.has(P)){const t=s(e.type??e.payload_type);if("unknown"!==t){const e=null==(v=j.get(P))?void 0:v.find(e=>e.type===t);e&&(O=C(e.hash,t,e.name,!0))}if(!O){const e=j.get(P),t=c.get(P),o=t?null==e?void 0:e.find(e=>e.hash===t):null==e?void 0:e[0],s=o?n.get(o.hash)??o.type:"unknown",a=!!t&&!!o&&o.hash===t;O=C((null==o?void 0:o.hash)??null,s,(null==o?void 0:o.name)??null,a)}}if(!O){const e=c.get(P);if(e){const t=n.get(e)??"unknown",o=null==(y=j.get(P))?void 0:y.find(t=>t.hash===e);O=C(e,t,(null==o?void 0:o.name)??null,!0)}}if(!O&&k.has(P)){const e=null==(w=j.get(P))?void 0:w[0];O=C((null==e?void 0:e.hash)??null,(null==e?void 0:e.type)??"unknown",(null==e?void 0:e.name)??null,!1)}if(!O){const e=j.get(P);if(1===(null==e?void 0:e.length)){const t=e[0];O=C(t.hash,t.type,t.name,!0)}else O=C(null,s(x),null,!1)}const L=s(x);if("unknown"!==L&&L!==O.type&&(O=C(O.hash,L,O.name,O.confident)),"unknown"===O.type&&null!=e._advertNodeType){const t=o(e._advertNodeType);"unknown"!==t&&(O=C(O.hash,t,O.name,O.confident))}if(O.hash){const t=l.get(P);if(t){const n=t.find(e=>e.hash===O.hash);if(n){let t=0;const o=e.original_path??e.forwarded_path;if(o&&Array.isArray(o)&&o.length>0&&n.totalForwarderObservations>0){const e=new Set;for(const t of o){const n=String(t).toUpperCase().slice(0,2);n.length>=2&&n!==P&&e.add(n)}if(e.size>0){let o=0;for(const t of e)n.forwarderPrefixes.has(t)&&o++;t=o/e.size}}O=C(O.hash,O.type,O.name,O.confident,n.advertCount,n.forwarderPrefixes.size,t)}}}if(null===O.name&&O.hash){const e=t.hashToName.get(O.hash)??i.get(O.hash)??h.get(O.hash)??null;e&&(O=C(O.hash,O.type,e,O.confident,O.advertObservations,O.topologyNeighborCount,O.topologyAffinity))}return f.set(N,O),O}(e,n.neighborContext,n.extendedHashToType,n.advertNameToHash,n.advertHashToName,n.resolverMap,n.topologyProfiles,P,n.decryptedNameToHash,n.decryptedHashToName,n._cache):S},getDecodedContent:e=>{const n=t();return function(e,t,n,o="name-only"){const s=e.payload_type??e.type;if(s!==r.GRP_TXT)return null;const a=t.get(e.packet_hash);if(a)return M(a,o);const i=e._payloadHexPrefix??_(e.raw_packet),c=(i?n.byPayload.get(i):null)??n.byApprox.get(`${s}:${e.payload_length??e.length??0}:${Math.floor((e.timestamp??0)/60)}`);return c?M(c,o):null}(e,P,n.contentInheritanceIndex,n.config.macCorruptedPolicy)},setConfig:n=>{const o={...t().config,...n};e({config:o,_cache:new Map}),null==A||A()},recompute:(s,i,c)=>{const f=t(),{config:p}=f,g=`${Object.keys(i).length}`;let m=f.neighborContext;g!==f._neighborFingerprint&&(m=function(e){const t=new Map,o=new Map,s=new Map,r=new Map,i=new Map,c=new Map,l=new Map;for(const[h,f]of Object.entries(e)){const e=n(f).type;t.set(h,e);const d=(h.startsWith("0x")?h.slice(2):h).toLowerCase();o.set(d,h);const u=a(h),p=b(f);let g=s.get(u);g||(g=[],s.set(u,g)),g.push({hash:h,name:p,type:e});const m=r.get(u)||{repeaters:0,others:0};if("repeater"===e?m.repeaters++:m.others++,r.set(u,m),p){c.set(h,p);const e=p.toLowerCase(),t=l.get(e)??0,n=f.last_seen??0;(!i.has(e)||n>t)&&(i.set(e,h),l.set(e,n))}}const d=new Set,u=new Set;for(const[n,a]of r)a.repeaters>0&&a.others>0&&d.add(n),(a.repeaters>=2||a.others>=2)&&u.add(n);return{hashToType:t,pubKeyMap:o,prefixIndex:s,crossClassPrefixes:d,sameClassAmbiguous:u,nameToHash:i,hashToName:c}}(i));const v=50*Math.floor(s.length/50),y=`${g}:${v}`;let w=f.extendedHashToType,M=f.advertNameToHash,C=f.advertHashToName;if(y!==f._advertScanFingerprint||g!==f._neighborFingerprint){const e=function(e,t,n,s){const a=new Map(t),r=new Map,i=new Map,c=new Map,l=new Map;for(const d of e){if(null==d._advertNodeType&&!d._advertName)continue;const e=d._advertSender;if(null!=d._advertNodeType){let t;if(e&&(t=n.get(e)),!t&&d.src_hash&&a.has(d.src_hash)&&(t=d.src_hash),t){const e=a.get(t);if(!e||"unknown"===e){const e=o(d._advertNodeType);"unknown"!==e&&a.set(t,e)}}}if(d._advertName&&e){const t=n.get(e)??e,o=d.timestamp??0,a=d._advertName.toLowerCase();if(!s.has(a)){const e=c.get(a)??0;(!r.has(a)||o>e)&&(r.set(a,t),c.set(a,o))}const u=l.get(t)??0;(!i.has(t)||o>u)&&(i.set(t,d._advertName),l.set(t,o))}}return{extendedHashToType:a,advertNameToHash:r,advertHashToName:i}}(s,m.hashToType,m.pubKeyMap,m.nameToHash);w=e.extendedHashToType,M=e.advertNameToHash,C=e.advertHashToName}const S=`${Object.keys(i).length}:${v}:${m.crossClassPrefixes.size}:${p.recencyDecayHours}:${p.zeroHopDecayHours}`;let T=f.resolverMap,x=f.topologyProfiles;if(S!==f._resolverFingerprint){const e=function(e,t,n){const o=(null==n?void 0:n.recencyDecayHours)??12,s=(null==n?void 0:n.zeroHopDecayHours)??72,i=new Map,c=new Map;for(const a of Object.keys(t)){const e=(a.startsWith("0x")?a.slice(2):a).toLowerCase();c.set(e,a)}const l=new Map;for(const[r,u]of Object.entries(t)){const e=a(r),t=l.get(e)||[];t.push({hash:r,info:u}),l.set(e,t)}const d=new Set;for(const[a,r]of l)1===r.length?i.set(a,r[0].hash):d.add(a);if(0===d.size)return{resolver:i,topologyProfiles:new Map};const f=new Map,p=Math.floor(Date.now()/1e3);for(const a of d){const e=new Map;for(const t of l.get(a)){let n=0;const a=t.info.last_seen??0;if(t.info.zero_hop&&a>0){const e=(p-a)/3600;n+=50*Math.exp(-e/s)}if(a>0){const e=(p-a)/3600;n+=20*Math.exp(-e/o)}t.info.latitude&&t.info.longitude&&(0!==t.info.latitude||0!==t.info.longitude)&&(n+=5),e.set(t.hash,n)}f.set(a,e)}for(const m of e){if((m.type??m.payload_type)!==r.ADVERT)continue;if(!m.src_hash)continue;const e=a(m.src_hash);if(!d.has(e))continue;const t=m._advertLatitude,n=m._advertLongitude;if(null!=t&&null!=n&&(0!==t||0!==n)){const o=l.get(e),s=f.get(e);for(const e of o){if(!e.info.latitude||!e.info.longitude)continue;if(0===e.info.latitude&&0===e.info.longitude)continue;const o=u(t,n,e.info.latitude,e.info.longitude);o<h.VERY_CLOSE?s.set(e.hash,(s.get(e.hash)||0)+10):o<h.CLOSE?s.set(e.hash,(s.get(e.hash)||0)+5):o<h.FAR&&s.set(e.hash,(s.get(e.hash)||0)+1)}}if(m._advertName){const t=m._advertName.trim().toLowerCase();if(t){const n=l.get(e),o=f.get(e);for(const e of n){const n=(e.info.name||e.info.node_name||"").trim().toLowerCase();n&&n===t&&o.set(e.hash,(o.get(e.hash)||0)+15)}}}}const g=function(e,t,n){const o=new Map;for(const r of e){if(!r._advertSender)continue;const e=t.get(r._advertSender);if(!e)continue;const s=a(e);if(!n.has(s))continue;let i=o.get(e);i||(i={hash:e,advertCount:0,forwarderPrefixes:new Map,totalForwarderObservations:0},o.set(e,i)),i.advertCount++;const c=r.original_path??r.forwarded_path;if(c&&Array.isArray(c))for(const t of c){const e=String(t).toUpperCase().slice(0,2);if(e.length<2)continue;if(e===s)continue;const n=i.forwarderPrefixes.get(e)||0;i.forwarderPrefixes.set(e,n+1),i.totalForwarderObservations++}}const s=new Map;for(const r of o.values()){const e=a(r.hash),t=s.get(e)||[];t.push(r),s.set(e,t)}return s}(e,c,d);for(const a of d){const e=g.get(a);if(!e)continue;const t=f.get(a);for(const n of e){let e=0;e+=Math.min(2*n.advertCount,30),e+=Math.min(3*n.forwarderPrefixes.size,15),t.set(n.hash,(t.get(n.hash)||0)+e)}}for(const u of e){if((u.type??u.payload_type)===r.ADVERT)continue;if(!u.src_hash)continue;const e=a(u.src_hash);if(!d.has(e))continue;const t=g.get(e);if(!t||t.length<2)continue;const n=u.original_path??u.forwarded_path;if(!n||!Array.isArray(n)||0===n.length)continue;const o=new Set;for(const a of n){const t=String(a).toUpperCase().slice(0,2);t.length>=2&&t!==e&&o.add(t)}if(0===o.size)continue;const s=f.get(e);for(const a of t){if(0===a.totalForwarderObservations)continue;let e=0;for(const t of o)a.forwarderPrefixes.has(t)&&e++;if(e>0){const t=e/o.size*3;s.set(a.hash,(s.get(a.hash)||0)+t)}}}for(const a of d){const e=f.get(a);let t=null,n=-1/0;for(const[o,s]of e)s>n&&(n=s,t=o);t&&i.set(a,t)}return{resolver:i,topologyProfiles:g}}(s,i,{recencyDecayHours:p.recencyDecayHours,zeroHopDecayHours:p.zeroHopDecayHours});T=e.resolver,x=e.topologyProfiles}const N=20*Math.floor(c.size/20),H=`${v}:${N}:${S}`;let P=f.decryptedNameToHash,A=f.decryptedHashToName;if(H!==f._decodedNameFingerprint){const e=function(e,t,n,o,s){var r;const i=new Map,c=new Map;if(0===t.size)return{decryptedNameToHash:i,decryptedHashToName:c};const{prefixIndex:l,nameToHash:d}=n;for(const u of e){if(5!==(u.type??u.payload_type))continue;const e=t.get(u.packet_hash);if(!(null==(r=null==e?void 0:e.decoded)?void 0:r.decrypted)||e.decoded.macCorrupted)continue;const n=e.decoded.senderName;if(!n)continue;const h=u.src_hash;if(!h)continue;const f=a(h);let p=s.get(f);if(!p){const e=l.get(f);1===(null==e?void 0:e.length)&&(p=e[0].hash)}if(!p&&h.length>4&&(p=h),!p)continue;const g=n.toLowerCase();d.has(g)||o.has(g)||i.set(g,p),c.has(p)||c.set(p,n)}return{decryptedNameToHash:i,decryptedHashToName:c}}(s,c,m,M,T);P=e.decryptedNameToHash,A=e.decryptedHashToName}const j=new Map(T);for(const[e,t]of P){const n=a(t),o=m.prefixIndex.get(n);if(!o||o.length<=1)continue;const s=o.find(t=>{var n;return(null==(n=t.name)?void 0:n.toLowerCase())===e});s&&j.get(n)!==s.hash&&j.set(n,s.hash)}for(const[e,t]of M){const n=a(t),o=m.prefixIndex.get(n);if(!o||o.length<=1)continue;const s=o.find(t=>{var n;return(null==(n=t.name)?void 0:n.toLowerCase())===e});s&&j.get(n)!==s.hash&&j.set(n,s.hash)}const E=`${v}:${N}`;let k=f.contentInheritanceIndex;E!==f._inheritanceFingerprint&&(k=function(e,t){var n;const o=new Map,s=new Map;for(const a of e){const e=a.payload_type??a.type;if(e!==r.GRP_TXT)continue;const i=t.get(a.packet_hash);if(!(null==(n=null==i?void 0:i.decoded)?void 0:n.decrypted)||i.decoded.macCorrupted)continue;const c=a._payloadHexPrefix??_(a.raw_packet);c&&!o.has(c)&&o.set(c,i);const l=`${e}:${a.payload_length??a.length??0}:${Math.floor((a.timestamp??0)/60)}`;s.has(l)||s.set(l,i)}return{byPayload:o,byApprox:s}}(s,c)),d(j),l.active&&l.emit("pipeline:disambig:recompute",{packets:s.length,neighbors:Object.keys(i).length,decoded:c.size}),e({neighborContext:m,extendedHashToType:w,advertNameToHash:M,advertHashToName:C,resolverMap:T,topologyProfiles:x,decryptedNameToHash:P,decryptedHashToName:A,srcHashResolverMap:j,contentInheritanceIndex:k,_cache:new Map,_neighborFingerprint:g,_resolverFingerprint:S,_advertScanFingerprint:y,_decodedNameFingerprint:H,_inheritanceFingerprint:E,_decodedContentVersion:f._decodedContentVersion+1})}}));let P=new Map,A=null;if("undefined"!=typeof window){let t,n=function(){i&&clearTimeout(i),i=setTimeout(()=>{var e;if(i=null,!o||!s)return;const t=o.useStore.getState(),n=s.useDecodedMessagesStore.getState(),a=t.packets,r=(null==(e=t.stats)?void 0:e.neighbors)??{},c=n.stableMessages;H.getState().recompute(a,r,c)},c)},o=null,s=null,a=[],r=new Map,i=null;const c=150;A=n,setTimeout(()=>{e(()=>import("./index-CkRTgHHA.js").then(e=>e.dv),__vite__mapDeps([0,1,2,3,4])).then(e=>{var s,r;o=e,e.useStore.subscribe(e=>{var o,s;const r=e.packets!==a,i=(null==(o=e.stats)?void 0:o.neighbors)!==t;(r||i)&&(a=e.packets,t=null==(s=e.stats)?void 0:s.neighbors,n())});const i=e.useStore.getState();a=i.packets,t=null==(s=i.stats)?void 0:s.neighbors;const c=(null==(r=i.stats)?void 0:r.neighbors)??{};(a.length>0||Object.keys(c).length>0)&&H.getState().recompute(a,c,new Map)}),e(()=>import("./index-CkRTgHHA.js").then(e=>e.du),__vite__mapDeps([0,1,2,3,4])).then(e=>{s=e,P=e.useDecodedMessagesStore.getState().messages,e.useDecodedMessagesStore.subscribe(e=>{e.messages!==P&&(P=e.messages),e.stableMessages!==r&&(r=e.stableMessages,n())})})},0)}const j=H;function E(){return H(e=>e.resolveSource)}function k(){const e=H(e=>e.getDecodedContent),n=H(e=>e._decodedContentVersion);return t.useCallback(t=>e(t),[e,n])}const O=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_PIPELINE_CONFIG:T,useAdvertNameToHash:function(){return H(e=>e.advertNameToHash)},useGetDecodedContent:k,useNeighborContext:function(){return H(e=>e.neighborContext)},usePipelineConfig:function(){return H(e=>e.config)},usePipelineStore:j,useResolveSource:E,useSrcHashResolverMap:function(){return H(e=>e.srcHashResolverMap)},useTopologyProfiles:function(){return H(e=>e.topologyProfiles)}},Symbol.toStringTag,{value:"Module"}));export{E as a,y as b,j as c,O as d,g as f,w as r,k as u};