export function routeRow({variant,format,url,status,contentType,body,after}) {
 const flight=format==='flight'?body:[...body.matchAll(/self\.__next_f\.push\(([\s\S]*?)\)<\/script>/g)].map(match=>JSON.parse(match[1])).filter(row=>row[0]===1).map(row=>row[1]).join('')
 const htmlValue=format==='html'?body.match(/<div id="auth-values">([^<]+)<\/div>/):null
 const flightValue=flight.match(/"id":"auth-values","children":("(?:[^"\\]|\\.)*")/)
 if(!htmlValue&&!flightValue)throw Error('Missing actual HTML or serialized Flight fallback/healthy values')
 const subject=htmlValue?JSON.parse(htmlValue[1].replaceAll('&quot;','"').replaceAll('&amp;','&')):JSON.parse(JSON.parse(flightValue[1]))
 const field=(html,wire)=>format==='html'?body.includes(html):flight.includes(wire)
 const client=flight.match(/\["\$","\$L([^"]+)",null,\{"outcome":"(?:forbidden|unauthorized|healthy)"\}/)
 return {variant,format,pathname:url.pathname,search:url.search,status,contentType,subject,subjectTransport:htmlValue?'html':format==='html'?'embedded-flight':'flight',
  rootLayout:field('data-root-layout="acme"','"data-root-layout":"acme"'),
  nestedLayout:field('data-nested-layout="acme"','"data-nested-layout":"acme"'),
  rootProvider:field('data-provider="acme"','"label":"acme"'),
  nestedProvider:field('data-provider="nested:acme"','"label":"nested:acme"'),
  providerContext:format==='html'?(body.match(/data-provider-context="([^"]*)"/)?.[1]??null):null,
  clientReference:!!client&&new RegExp('(?:^|\\n)'+client[1]+':I\\[').test(flight),
  robotsNoIndex:field('name="robots" content="noindex"','"name":"robots","content":"noindex"'),
  forbiddenDigest:flight.includes('NEXT_HTTP_ERROR_FALLBACK;403'),unauthorizedDigest:flight.includes('NEXT_HTTP_ERROR_FALLBACK;401'),after}
}
