import type { Reroute } from "@sveltejs/kit"; // small hack to support raw at-uri as path segment: // `/issues/at://did:example:repo/org.tangled.repo.ticket/123` const RAW_ATURI = /\/(pulls|issues)\/at:\/\/?([^/]+)\/([^/]+)\/([^/]+)/; export const reroute: Reroute = ({ url }) => url.pathname.replace( RAW_ATURI, (_match, section, authority, collection, rkey) => `/${section}/${encodeURIComponent(`at://${authority}/${collection}/${rkey}`)}` );