export function prettyPrintPeerId(peerId) {
    return prettyPrintPeerIdStr(peerId.toString());
}
export function prettyPrintPeerIdStr(id) {
    return `${id.slice(0, 2)}...${id.slice(id.length - 6, id.length)}`;
}
/**
 * Get the connections map from a connection manager
 */
// Compat function for efficiency reasons
export function getConnectionsMap(libp2p) {
    // biome-ignore lint/complexity/useLiteralKeys: access of private property
    return libp2p.services.components.connectionManager.getConnectionsMap()["map"];
}
export function getConnection(libp2p, peerIdStr) {
    return getConnectionsMap(libp2p).get(peerIdStr)?.value[0] ?? undefined;
}
// https://github.com/ChainSafe/js-libp2p-gossipsub/blob/3475242ed254f7647798ab7f36b21909f6cb61da/src/index.ts#L2009
export function isPublishToZeroPeersError(e) {
    return e.message.includes("PublishError.InsufficientPeers");
}
//# sourceMappingURL=util.js.map