(()=>{var a={};a.id=407,a.ids=[407],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3421:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(71237),e=c(55088),f=c(17679);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},22446:(a,b,c)=>{"use strict";c.d(b,{L:()=>w,x:()=>x});var d={};c.r(d),c.d(d,{daySummaries:()=>s,ingestState:()=>q,messages:()=>p,projectSummaries:()=>t,projects:()=>n,sessions:()=>o,settings:()=>r});var e=c(87550),f=c.n(e),g=c(65127),h=c(48211),i=c(95417),j=c(58040),k=c(20377),l=c(4035),m=c(19643);let n=(0,i.D)("projects",{id:(0,j.Qq)("id").primaryKey(),name:(0,j.Qq)("name").notNull(),rootPath:(0,j.Qq)("root_path").notNull(),gitRemote:(0,j.Qq)("git_remote"),firstSeen:(0,k.nd)("first_seen").notNull(),lastActive:(0,k.nd)("last_active").notNull()},a=>({rootIdx:(0,l.GL)("projects_root_idx").on(a.rootPath)})),o=(0,i.D)("sessions",{id:(0,j.Qq)("id").primaryKey(),provider:(0,j.Qq)("provider").notNull(),projectId:(0,j.Qq)("project_id").notNull(),cwd:(0,j.Qq)("cwd").notNull(),startedAt:(0,k.nd)("started_at").notNull(),endedAt:(0,k.nd)("ended_at").notNull(),durationMs:(0,k.nd)("duration_ms").notNull(),model:(0,j.Qq)("model"),messageCount:(0,k.nd)("message_count").notNull().default(0),userMessageCount:(0,k.nd)("user_message_count").notNull().default(0),inputTokens:(0,k.nd)("input_tokens").notNull().default(0),outputTokens:(0,k.nd)("output_tokens").notNull().default(0),cacheReadTokens:(0,k.nd)("cache_read_tokens").notNull().default(0),cacheWriteTokens:(0,k.nd)("cache_write_tokens").notNull().default(0),estCostUsd:(0,m.x)("est_cost_usd").notNull().default(0),firstPrompt:(0,j.Qq)("first_prompt"),summary:(0,j.Qq)("summary"),summaryGenerated:(0,k.nd)("summary_generated").notNull().default(0),heuristicTitle:(0,j.Qq)("heuristic_title"),category:(0,j.Qq)("category"),keywords:(0,j.Qq)("keywords"),gitBranch:(0,j.Qq)("git_branch"),sourcePath:(0,j.Qq)("source_path").notNull()},a=>({projectIdx:(0,l.Pe)("sessions_project_idx").on(a.projectId),startedIdx:(0,l.Pe)("sessions_started_idx").on(a.startedAt),providerIdx:(0,l.Pe)("sessions_provider_idx").on(a.provider),modelIdx:(0,l.Pe)("sessions_model_idx").on(a.model)})),p=(0,i.D)("messages",{id:(0,j.Qq)("id").primaryKey(),sessionId:(0,j.Qq)("session_id").notNull(),role:(0,j.Qq)("role").notNull(),content:(0,j.Qq)("content").notNull(),timestamp:(0,k.nd)("timestamp").notNull(),model:(0,j.Qq)("model")},a=>({sessionIdx:(0,l.Pe)("messages_session_idx").on(a.sessionId),timestampIdx:(0,l.Pe)("messages_timestamp_idx").on(a.timestamp)})),q=(0,i.D)("ingest_state",{sourcePath:(0,j.Qq)("source_path").primaryKey(),mtime:(0,k.nd)("mtime").notNull(),size:(0,k.nd)("size").notNull(),sessionId:(0,j.Qq)("session_id").notNull(),ingestedAt:(0,k.nd)("ingested_at").notNull()}),r=(0,i.D)("settings",{key:(0,j.Qq)("key").primaryKey(),value:(0,j.Qq)("value").notNull()}),s=(0,i.D)("day_summaries",{day:(0,j.Qq)("day").primaryKey(),summary:(0,j.Qq)("summary").notNull(),generatedAt:(0,k.nd)("generated_at").notNull()}),t=(0,i.D)("project_summaries",{projectId:(0,j.Qq)("project_id").primaryKey(),summary:(0,j.Qq)("summary").notNull(),generatedAt:(0,k.nd)("generated_at").notNull()}),u=null,v=null;function w(){return u||((v=new(f())((0,h.W)())).pragma("journal_mode = WAL"),v.pragma("synchronous = NORMAL"),function(a){a.exec(`
    CREATE TABLE IF NOT EXISTS projects (
      id TEXT PRIMARY KEY,
      name TEXT NOT NULL,
      root_path TEXT NOT NULL,
      git_remote TEXT,
      first_seen INTEGER NOT NULL,
      last_active INTEGER NOT NULL
    );
    CREATE UNIQUE INDEX IF NOT EXISTS projects_root_idx ON projects(root_path);

    CREATE TABLE IF NOT EXISTS sessions (
      id TEXT PRIMARY KEY,
      provider TEXT NOT NULL,
      project_id TEXT NOT NULL,
      cwd TEXT NOT NULL,
      started_at INTEGER NOT NULL,
      ended_at INTEGER NOT NULL,
      duration_ms INTEGER NOT NULL,
      model TEXT,
      message_count INTEGER NOT NULL DEFAULT 0,
      user_message_count INTEGER NOT NULL DEFAULT 0,
      input_tokens INTEGER NOT NULL DEFAULT 0,
      output_tokens INTEGER NOT NULL DEFAULT 0,
      cache_read_tokens INTEGER NOT NULL DEFAULT 0,
      cache_write_tokens INTEGER NOT NULL DEFAULT 0,
      est_cost_usd REAL NOT NULL DEFAULT 0,
      first_prompt TEXT,
      summary TEXT,
      summary_generated INTEGER NOT NULL DEFAULT 0,
      heuristic_title TEXT,
      category TEXT,
      keywords TEXT,
      git_branch TEXT,
      source_path TEXT NOT NULL
    );
    CREATE INDEX IF NOT EXISTS sessions_project_idx ON sessions(project_id);
    CREATE INDEX IF NOT EXISTS sessions_started_idx ON sessions(started_at);
    CREATE INDEX IF NOT EXISTS sessions_provider_idx ON sessions(provider);
    CREATE INDEX IF NOT EXISTS sessions_model_idx ON sessions(model);

    CREATE TABLE IF NOT EXISTS messages (
      id TEXT PRIMARY KEY,
      session_id TEXT NOT NULL,
      role TEXT NOT NULL,
      content TEXT NOT NULL,
      timestamp INTEGER NOT NULL,
      model TEXT
    );
    CREATE INDEX IF NOT EXISTS messages_session_idx ON messages(session_id);
    CREATE INDEX IF NOT EXISTS messages_timestamp_idx ON messages(timestamp);

    CREATE TABLE IF NOT EXISTS ingest_state (
      source_path TEXT PRIMARY KEY,
      mtime INTEGER NOT NULL,
      size INTEGER NOT NULL,
      session_id TEXT NOT NULL,
      ingested_at INTEGER NOT NULL
    );

    CREATE TABLE IF NOT EXISTS settings (
      key TEXT PRIMARY KEY,
      value TEXT NOT NULL
    );

    CREATE TABLE IF NOT EXISTS day_summaries (
      day TEXT PRIMARY KEY,
      summary TEXT NOT NULL,
      generated_at INTEGER NOT NULL
    );

    CREATE TABLE IF NOT EXISTS project_summaries (
      project_id TEXT PRIMARY KEY,
      summary TEXT NOT NULL,
      generated_at INTEGER NOT NULL
    );

    CREATE TABLE IF NOT EXISTS session_contexts (
      session_id TEXT PRIMARY KEY,
      context TEXT NOT NULL,
      generated_at INTEGER NOT NULL,
      model TEXT
    );

    CREATE TABLE IF NOT EXISTS quota_snapshots (
      provider TEXT PRIMARY KEY,
      observed_at INTEGER NOT NULL,
      plan_type TEXT,
      primary_pct REAL,
      primary_window_minutes INTEGER,
      primary_resets_at INTEGER,
      secondary_pct REAL,
      secondary_window_minutes INTEGER,
      secondary_resets_at INTEGER
    );

    CREATE TABLE IF NOT EXISTS claude_limit_events (
      id INTEGER PRIMARY KEY AUTOINCREMENT,
      session_id TEXT NOT NULL,
      observed_at INTEGER NOT NULL,
      reset_at INTEGER,
      kind TEXT NOT NULL,
      raw TEXT
    );
    CREATE INDEX IF NOT EXISTS claude_limit_events_observed_idx ON claude_limit_events(observed_at);
    CREATE INDEX IF NOT EXISTS claude_limit_events_session_idx ON claude_limit_events(session_id);
  `);let b=new Set(a.prepare("PRAGMA table_info(sessions)").all().map(a=>a.name));b.has("heuristic_title")||a.exec("ALTER TABLE sessions ADD COLUMN heuristic_title TEXT"),b.has("category")||a.exec("ALTER TABLE sessions ADD COLUMN category TEXT"),b.has("keywords")||a.exec("ALTER TABLE sessions ADD COLUMN keywords TEXT"),a.exec("CREATE INDEX IF NOT EXISTS sessions_category_idx ON sessions(category)"),b.has("categories")||(a.exec("ALTER TABLE sessions ADD COLUMN categories TEXT"),a.exec(`UPDATE sessions
             SET categories = json_array(category)
             WHERE category IS NOT NULL AND categories IS NULL`))}(v),u=(0,g.f)(v,{schema:d}))}function x(){return v||w(),v}},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48161:a=>{"use strict";a.exports=require("node:os")},48211:(a,b,c)=>{"use strict";c.d(b,{K:()=>g,W:()=>h});var d=c(48161),e=c(76760),f=c(73024);function g(){let a=process.env.AGENTGRAPHED_DATA_DIR||(0,e.join)((0,d.homedir)(),".agentgraphed");return(0,f.existsSync)(a)||(0,f.mkdirSync)(a,{recursive:!0}),a}function h(){return(0,e.join)(g(),"agentgraphed.sqlite")}},51455:a=>{"use strict";a.exports=require("node:fs/promises")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66226:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>Q,patchFetch:()=>P,routeModule:()=>L,serverHooks:()=>O,workAsyncStorage:()=>M,workUnitAsyncStorage:()=>N});var d={};c.r(d),c.d(d,{POST:()=>K,dynamic:()=>J,runtime:()=>I});var e=c(95736),f=c(9117),g=c(4044),h=c(39326),i=c(32324),j=c(261),k=c(54290),l=c(85328),m=c(38928),n=c(46595),o=c(3421),p=c(17679),q=c(41681),r=c(63446),s=c(86439),t=c(51356),u=c(51455),v=c(48161),w=c(76760);let x=(0,w.join)((0,v.homedir)(),".claude",".credentials.json");async function y(){let a,b,c;try{a=await (0,u.readFile)(x,"utf8")}catch(a){return{ok:!1,error:"ENOENT"===a.code?"Claude Code credentials not found. Sign into Claude Code first.":`Could not read credentials: ${a.message}`}}try{b=JSON.parse(a)}catch{return{ok:!1,error:"credentials.json is not valid JSON"}}let d=b.claudeAiOauth;if(!d?.accessToken||!d.refreshToken||!d.expiresAt)return{ok:!1,error:"credentials.json is missing claudeAiOauth fields"};try{let a=await (0,u.stat)(x),b=511&a.mode;384!==b&&"win32"!==process.platform&&(c=`~/.claude/.credentials.json has mode ${b.toString(8)}; expected 600.`)}catch{}return{ok:!0,creds:{accessToken:d.accessToken,refreshToken:d.refreshToken,expiresAt:d.expiresAt,subscriptionType:d.subscriptionType??null,rateLimitTier:d.rateLimitTier??null},warning:c}}let z=(0,w.join)((0,v.homedir)(),".claude",".credentials.json");async function A(a){let b,c,d;try{b=await (0,u.readFile)(z,"utf8")}catch(a){return{ok:!1,error:`Cannot read credentials: ${a.message}`}}let e=0;try{let b=await fetch("https://console.anthropic.com/v1/oauth/token",{method:"POST",headers:{"Content-Type":"application/json","User-Agent":"anthropic"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:a.refreshToken,client_id:"9d1c250a-e61b-44d9-88ed-5944d1962f5e"})});if(e=b.status,429===b.status)return{ok:!1,error:"Rate limited by token endpoint",httpStatus:e};if(!b.ok)return{ok:!1,error:`Refresh rejected (HTTP ${b.status}); re-login with Claude Code may be needed`,httpStatus:e};c=await b.json()}catch(a){return{ok:!1,error:`Refresh request failed: ${a.message}`}}if(!c.access_token||"number"!=typeof c.expires_in)return{ok:!1,error:"Unexpected refresh response shape",httpStatus:e};let f=Date.now()+1e3*c.expires_in,g=c.access_token,h=c.refresh_token??a.refreshToken;try{d=JSON.parse(b)}catch{return{ok:!1,error:"credentials.json became unparseable mid-flight"}}d.claudeAiOauth={...d.claudeAiOauth??{},accessToken:g,refreshToken:h,expiresAt:f};let i=JSON.stringify(d,null,2),j=`${z}.agentgraphed-tmp-${process.pid}-${Date.now()}`;try{await (0,u.writeFile)(j,i,{encoding:"utf8",mode:384}),await (0,u.rename)(j,z)}catch(a){try{await (0,u.writeFile)(z,b,{encoding:"utf8",mode:384})}catch{}return{ok:!1,error:`Could not persist refreshed token: ${a.message}`,reverted:!0}}try{let a=await (0,u.readFile)(z,"utf8"),b=JSON.parse(a);if(b.claudeAiOauth?.accessToken!==g)throw Error("post-write token mismatch")}catch(a){try{await (0,u.writeFile)(z,b,{encoding:"utf8",mode:384})}catch{}return{ok:!1,error:`Verification failed: ${a.message}`,reverted:!0}}return{ok:!0,expiresAt:f}}let B={"anthropic-version":"2023-06-01","anthropic-beta":"oauth-2025-04-20","content-type":"application/json","user-agent":"claude-code/2.1.5"},C=JSON.stringify({model:"claude-haiku-4-5-20251001",max_tokens:1,messages:[{role:"user",content:"hi"}]});function D(a,b){let c=a.get(b);if(null===c)return null;let d=Number(c);return Number.isFinite(d)?d:null}function E(a,b){let c=a.get(b);if(null===c)return null;let d=Number(c);return Number.isFinite(d)?Math.floor(1e3*d):null}async function F(a){let b=await fetch("https://api.anthropic.com/v1/messages",{method:"POST",headers:{...B,authorization:`Bearer ${a}`},body:C});try{await b.text()}catch{}return{status:b.status,headers:b.headers}}async function G(){let a,b=await y();if(!b.ok)return{ok:!1,error:b.error};let c=b.creds,d=!1;if(function(a,b=Date.now()){return b+12e4>=a}(c.expiresAt)){let a=await A(c);if(!a.ok)return{ok:!1,error:429===a.httpStatus||400===a.httpStatus||401===a.httpStatus?"Stored token cannot be refreshed. Run `claude /login` in your terminal to rewrite ~/.claude/.credentials.json, then try again.":`Token expired and refresh failed: ${a.error}`};let b=await y();if(!b.ok)return{ok:!1,error:b.error};c=b.creds,d=!0}try{a=await F(c.accessToken)}catch(a){return{ok:!1,error:`Probe request failed: ${a.message}`}}if(401===a.status&&!d){let b=await A(c);if(!b.ok)return{ok:!1,error:`401 from API and refresh failed: ${b.error}`,httpStatus:401};let e=await y();if(!e.ok)return{ok:!1,error:e.error};c=e.creds,d=!0;try{a=await F(c.accessToken)}catch(a){return{ok:!1,error:`Retry probe failed: ${a.message}`}}}if(401===a.status)return{ok:!1,error:"Still unauthorized after refresh — re-login with `claude /login`",httpStatus:401};if(429===a.status)return{ok:!1,error:"Rate-limited by Anthropic — slow down polling",httpStatus:429};if(a.status>=500)return{ok:!1,error:`Anthropic returned ${a.status}`,httpStatus:a.status};let e=a.headers,f=D(e,"anthropic-ratelimit-unified-5h-utilization"),g=E(e,"anthropic-ratelimit-unified-5h-reset"),h=e.get("anthropic-ratelimit-unified-5h-status"),i=D(e,"anthropic-ratelimit-unified-7d-utilization"),j=E(e,"anthropic-ratelimit-unified-7d-reset"),k=e.get("anthropic-ratelimit-unified-7d-status");return{ok:!0,observedAt:Date.now(),planType:c.subscriptionType,primary:null!==f&&null!==g?{utilization:f,resetsAt:g,status:h}:null,secondary:null!==i&&null!==j?{utilization:i,resetsAt:j,status:k}:null,tokenWasRefreshed:d}}var H=c(22446);let I="nodejs",J="force-dynamic";async function K(){let a=await G();return a.ok?((0,H.x)().prepare(`INSERT OR REPLACE INTO quota_snapshots (
       provider, observed_at, plan_type,
       primary_pct, primary_window_minutes, primary_resets_at,
       secondary_pct, secondary_window_minutes, secondary_resets_at
     ) VALUES ('claude', ?, ?, ?, ?, ?, ?, ?, ?)`).run(a.observedAt,a.planType,a.primary?Math.round(1e3*a.primary.utilization)/10:null,a.primary?300:null,a.primary?a.primary.resetsAt:null,a.secondary?Math.round(1e3*a.secondary.utilization)/10:null,a.secondary?10080:null,a.secondary?a.secondary.resetsAt:null),new Response(JSON.stringify({ok:!0,snapshot:{observedAt:a.observedAt,planType:a.planType,primary:a.primary?{pct:100*a.primary.utilization,resetsAt:a.primary.resetsAt,status:a.primary.status}:null,secondary:a.secondary?{pct:100*a.secondary.utilization,resetsAt:a.secondary.resetsAt,status:a.secondary.status}:null,tokenWasRefreshed:a.tokenWasRefreshed}}),{status:200,headers:{"content-type":"application/json"}})):new Response(JSON.stringify({ok:!1,error:a.error,httpStatus:a.httpStatus}),{status:200,headers:{"content-type":"application/json"}})}let L=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/quota-probe/route",pathname:"/api/quota-probe",filename:"route",bundlePath:"app/api/quota-probe/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Users/mikekuehn/devProjects/agentgraphed/oss/src/app/api/quota-probe/route.ts",nextConfigOutput:"standalone",userland:d}),{workAsyncStorage:M,workUnitAsyncStorage:N,serverHooks:O}=L;function P(){return(0,g.patchFetch)({workAsyncStorage:M,workUnitAsyncStorage:N})}async function Q(a,b,c){var d;let e="/api/quota-probe/route";"/index"===e&&(e="/");let g=await L.prepare(a,b,{srcPage:e,multiZoneDraftMode:!1});if(!g)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:u,params:v,nextConfig:w,isDraftMode:x,prerenderManifest:y,routerServerContext:z,isOnDemandRevalidate:A,revalidateOnlyGenerated:B,resolvedPathname:C}=g,D=(0,j.normalizeAppPath)(e),E=!!(y.dynamicRoutes[D]||y.routes[C]);if(E&&!x){let a=!!y.routes[C],b=y.dynamicRoutes[D];if(b&&!1===b.fallback&&!a)throw new s.NoFallbackError}let F=null;!E||L.isDev||x||(F="/index"===(F=C)?"/":F);let G=!0===L.isDev||!E,H=E&&!G,I=a.method||"GET",J=(0,i.getTracer)(),K=J.getActiveScopeSpan(),M={params:v,prerenderManifest:y,renderOpts:{experimental:{cacheComponents:!!w.experimental.cacheComponents,authInterrupts:!!w.experimental.authInterrupts},supportsDynamicResponse:G,incrementalCache:(0,h.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:null==(d=w.experimental)?void 0:d.cacheLife,isRevalidate:H,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d)=>L.onRequestError(a,b,d,z)},sharedContext:{buildId:u}},N=new k.NodeNextRequest(a),O=new k.NodeNextResponse(b),P=l.NextRequestAdapter.fromNodeNextRequest(N,(0,l.signalFromNodeResponse)(b));try{let d=async c=>L.handle(P,M).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let d=J.getRootSpanAttributes();if(!d)return;if(d.get("next.span_type")!==m.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${d.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=d.get("next.route");if(e){let a=`${I} ${e}`;c.setAttributes({"next.route":e,"http.route":e,"next.span_name":a}),c.updateName(a)}else c.updateName(`${I} ${a.url}`)}),g=async g=>{var i,j;let k=async({previousCacheEntry:f})=>{try{if(!(0,h.getRequestMeta)(a,"minimalMode")&&A&&B&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let e=await d(g);a.fetchMetrics=M.renderOpts.fetchMetrics;let i=M.renderOpts.pendingWaitUntil;i&&c.waitUntil&&(c.waitUntil(i),i=void 0);let j=M.renderOpts.collectedTags;if(!E)return await (0,o.I)(N,O,e,M.renderOpts.pendingWaitUntil),null;{let a=await e.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(e.headers);j&&(b[r.NEXT_CACHE_TAGS_HEADER]=j),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==M.renderOpts.collectedRevalidate&&!(M.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&M.renderOpts.collectedRevalidate,d=void 0===M.renderOpts.collectedExpire||M.renderOpts.collectedExpire>=r.INFINITE_CACHE?void 0:M.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:e.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:d}}}}catch(b){throw(null==f?void 0:f.isStale)&&await L.onRequestError(a,b,{routerKind:"App Router",routePath:e,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:H,isOnDemandRevalidate:A})},z),b}},l=await L.handleResponse({req:a,nextConfig:w,cacheKey:F,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:y,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:B,responseGenerator:k,waitUntil:c.waitUntil});if(!E)return null;if((null==l||null==(i=l.value)?void 0:i.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==l||null==(j=l.value)?void 0:j.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});(0,h.getRequestMeta)(a,"minimalMode")||b.setHeader("x-nextjs-cache",A?"REVALIDATED":l.isMiss?"MISS":l.isStale?"STALE":"HIT"),x&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let m=(0,p.fromNodeOutgoingHttpHeaders)(l.value.headers);return(0,h.getRequestMeta)(a,"minimalMode")&&E||m.delete(r.NEXT_CACHE_TAGS_HEADER),!l.cacheControl||b.getHeader("Cache-Control")||m.get("Cache-Control")||m.set("Cache-Control",(0,q.getCacheControlHeader)(l.cacheControl)),await (0,o.I)(N,O,new Response(l.value.body,{headers:m,status:l.value.status||200})),null};K?await g(K):await J.withPropagatedContext(a.headers,()=>J.trace(m.BaseServerSpan.handleRequest,{spanName:`${I} ${a.url}`,kind:i.SpanKind.SERVER,attributes:{"http.method":I,"http.target":a.url}},g))}catch(b){if(b instanceof s.NoFallbackError||await L.onRequestError(a,b,{routerKind:"App Router",routePath:D,routeType:"route",revalidateReason:(0,n.c)({isRevalidate:H,isOnDemandRevalidate:A})}),E)throw b;return await (0,o.I)(N,O,new Response(null,{status:500})),null}}},73024:a=>{"use strict";a.exports=require("node:fs")},76760:a=>{"use strict";a.exports=require("node:path")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87550:a=>{"use strict";a.exports=require("better-sqlite3")},95736:(a,b,c)=>{"use strict";a.exports=c(44870)},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[873,609],()=>b(b.s=66226));module.exports=c})();