{"version":3,"sources":["../../../../src/server/app-render/instant-test-bootstrap.ts"],"sourcesContent":["import {\n  RSC_HEADER,\n  NEXT_ROUTER_PREFETCH_HEADER,\n  NEXT_ROUTER_SEGMENT_PREFETCH_HEADER,\n  NEXT_RSC_UNION_QUERY,\n  NEXT_INSTANT_TEST_COOKIE,\n} from '../../client/components/app-router-headers'\nimport { computeCacheBustingSearchParam } from '../../shared/lib/router/utils/cache-busting-search-param'\n\n/**\n * Builds the inline bootstrap script content for the Instant Navigation Testing\n * API. It is embedded via React's `bootstrapScriptContent` into the prerendered\n * shell (and dynamic renders) so that it ends up in the cached static prelude\n * and runs before the client bootstrap module (app-index) reads\n * self.__next_instant_test as its hydration source.\n *\n * The script is cookie-guarded so it is inert unless the instant test cookie is\n * present (the prelude is shared across all requests). The fetch mirrors the\n * __NEXT_CLIENT_RESUME prefetch used for fallback routes; the instant test\n * cookie rides along on the same-origin request, so the server returns\n * static-only data, which doubles as the feature flag (truthy = instant mode).\n */\nexport async function getInstantTestBootstrapScriptContent(): Promise<string> {\n  const segmentPath = '/_full'\n  const cacheBustingHeader = await computeCacheBustingSearchParam(\n    '1',\n    segmentPath,\n    undefined,\n    undefined\n  )\n  const searchStr = `${NEXT_RSC_UNION_QUERY}=${cacheBustingHeader}`\n  return `if(document.cookie.indexOf('${NEXT_INSTANT_TEST_COOKIE}=')>-1){self.__next_instant_test=fetch(location.pathname+'?${searchStr}',{credentials:'same-origin',headers:{'${RSC_HEADER}':'1','${NEXT_ROUTER_PREFETCH_HEADER}':'1','${NEXT_ROUTER_SEGMENT_PREFETCH_HEADER}':'${segmentPath}'}})}`\n}\n"],"names":["RSC_HEADER","NEXT_ROUTER_PREFETCH_HEADER","NEXT_ROUTER_SEGMENT_PREFETCH_HEADER","NEXT_RSC_UNION_QUERY","NEXT_INSTANT_TEST_COOKIE","computeCacheBustingSearchParam","getInstantTestBootstrapScriptContent","segmentPath","cacheBustingHeader","undefined","searchStr"],"mappings":"AAAA,SACEA,UAAU,EACVC,2BAA2B,EAC3BC,mCAAmC,EACnCC,oBAAoB,EACpBC,wBAAwB,QACnB,6CAA4C;AACnD,SAASC,8BAA8B,QAAQ,2DAA0D;AAEzG;;;;;;;;;;;;CAYC,GACD,OAAO,eAAeC;IACpB,MAAMC,cAAc;IACpB,MAAMC,qBAAqB,MAAMH,+BAC/B,KACAE,aACAE,WACAA;IAEF,MAAMC,YAAY,GAAGP,qBAAqB,CAAC,EAAEK,oBAAoB;IACjE,OAAO,CAAC,4BAA4B,EAAEJ,yBAAyB,2DAA2D,EAAEM,UAAU,uCAAuC,EAAEV,WAAW,OAAO,EAAEC,4BAA4B,OAAO,EAAEC,oCAAoC,GAAG,EAAEK,YAAY,KAAK,CAAC;AACrS","ignoreList":[0]}