import{A as e,D as t,E as n,L as r,R as i,S as a,g as o,v as s,x as c,y as l}from"./cookie-serialize-CgV1qMZJ.js";import{D as u,Y as d}from"./implicit-tags-BJP8ZwY0.js";function f(){}var p=`_rsc`,m=`X-Vinext-RSC-Compatibility-Id`,h=`text/x-component`,g=[`RSC`,c,s,l,a,n,t,e,r,i].join(`, `),_=12,v=new TextEncoder;function y(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/,``)}function b(e){return e??`0`}function x(e){return e&&e.length>0?e:null}function S(){return x(`afbb082d-b9e1-442e-9847-f366f22dfd81`)}function C(e,t=S()){let n=x(t);n?e.set(m,n):e.delete(m)}function w(e){e.delete(o)}function T(e){let t=u(e);return t===`navigation`?null:t}function E(o,u={}){let d=[o.get(s),o.get(l),o.get(c),o.get(a),o.get(n),...u.includeInterceptionIdHeader===!1?[]:[o.get(t)],o.get(e),...u.includeRenderModeHeader===!1?[]:[T(o.get(r))]],f=o.get(i);return u.includeStateFingerprintHeader!==!1&&f!==null&&d.push(f),d.every(e=>e===null)?null:d.map(b).join(`,`)}async function D(e){let t=globalThis.crypto?.subtle;if(!t)return d(e);let n=await t.digest(`SHA-256`,v.encode(e));return y(new Uint8Array(n).subarray(0,_))}function O(e){let t=E(e);return t===null?``:d(t)}function k(e){return(e.search.startsWith(`?`)?e.search.slice(1):e.search).split(`&`).filter(e=>e.length>0&&!A(e))}function A(e){let t=e.indexOf(`=`),n=t===-1?e:e.slice(0,t);try{return decodeURIComponent(n.replaceAll(`+`,` `))===p}catch{return n===p}}function j(e){return(e.search.startsWith(`?`)?e.search.slice(1):e.search).split(`&`).some(e=>e.length>0&&A(e))}async function M(e){let t=E(e);return t===null?``:D(t)}function N(e,t){let n=k(e);n.push(t.length>0?`${p}=${t}`:p),e.search=`?${n.join(`&`)}`}function P(e){let t=k(e);e.search=t.length>0?`?${t.join(`&`)}`:``}function F(e){return e.endsWith(`.rsc`)?e.slice(0,-4):e}function I(e){let t=e.indexOf(`#`);return t===-1?e:e.slice(0,t)}async function L(e,t){let n=new URL(I(e),`http://vinext.local`);return N(n,await M(t)),`${n.pathname}${n.search}`}async function R(e,t){let n=new URL(t.url),r=new URL(e,n);if(r.origin!==n.origin)return r.toString();let i=await L(`${r.pathname}${r.search}`,t.headers);return`${r.origin}${i}`}async function z(e){if(!e.isRscRequest||e.request.method!==`GET`&&e.request.method!==`HEAD`)return null;let n=new URL(e.request.url),a=n.searchParams.get(p),o=await M(e.request.headers);if(a===null&&o===``&&n.pathname.endsWith(`.rsc`))return null;let s=new Set([o]);if(a!==null&&a!==o){s.add(O(e.request.headers));let n=[],a=e.request.headers.has(t),o=e.request.headers.has(i),c=T(e.request.headers.get(r))===null;a||n.push({includeInterceptionIdHeader:!1}),o&&(n.push({includeStateFingerprintHeader:!1}),a||n.push({includeInterceptionIdHeader:!1,includeStateFingerprintHeader:!1})),c&&(n.push({includeRenderModeHeader:!1}),a||n.push({includeInterceptionIdHeader:!1,includeRenderModeHeader:!1})),o&&c&&(n.push({includeRenderModeHeader:!1,includeStateFingerprintHeader:!1}),a||n.push({includeInterceptionIdHeader:!1,includeRenderModeHeader:!1,includeStateFingerprintHeader:!1}));for(let t of n){let n=E(e.request.headers,t);n===null?s.add(``):(s.add(await D(n)),s.add(d(n)))}}return a!==null&&s.has(a)?null:(N(n,o),new Response(null,{status:307,headers:{Location:`${n.pathname}${n.search}`}}))}export{w as a,z as c,f as d,C as i,P as l,h as n,R as o,g as r,j as s,p as t,F as u};