module.exports=[14747,(e,t,a)=>{t.exports=e.x("path",()=>require("path"))},93695,(e,t,a)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},18622,(e,t,a)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,a)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,a)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,a)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},70406,(e,t,a)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},85148,(e,t,a)=>{t.exports=e.x("better-sqlite3-90e2652d1716b047",()=>require("better-sqlite3-90e2652d1716b047"))},22734,(e,t,a)=>{t.exports=e.x("fs",()=>require("fs"))},43793,77930,e=>{"use strict";var t=e.i(85148),a=e.i(14747),r=e.i(22734);function s(){return process.env.VIBEMETER_DATA_DIR??a.default.join(process.cwd(),".data")}e.s(["dataDir",0,s],77930);let n=null;e.s(["getDb",0,function(){var e;let o;if(n)return n;let i=s();return r.default.mkdirSync(i,{recursive:!0}),(n=new t.default(a.default.join(i,"continuity.sqlite"))).pragma("journal_mode = WAL"),(e=n).exec(`
    CREATE TABLE IF NOT EXISTS sessions (
      id TEXT PRIMARY KEY,
      tool TEXT NOT NULL,
      started_at INTEGER NOT NULL,
      ended_at INTEGER,
      exit_code INTEGER,
      cwd TEXT,
      cli_args TEXT,
      summary TEXT,
      confidence TEXT NOT NULL DEFAULT 'medium'
    );

    CREATE TABLE IF NOT EXISTS usage_snapshots (
      id INTEGER PRIMARY KEY AUTOINCREMENT,
      captured_at INTEGER NOT NULL,
      source TEXT NOT NULL,
      account_id TEXT,
      window_5h_used_pct REAL,
      window_weekly_used_pct REAL,
      reset_at_5h INTEGER,
      reset_at_weekly INTEGER,
      raw_output TEXT,
      confidence TEXT NOT NULL
    );

    CREATE TABLE IF NOT EXISTS file_changes (
      id INTEGER PRIMARY KEY AUTOINCREMENT,
      session_id TEXT NOT NULL,
      path TEXT NOT NULL,
      change_type TEXT NOT NULL,
      detected_at INTEGER NOT NULL,
      FOREIGN KEY (session_id) REFERENCES sessions(id)
    );
  `),(o=(t,a,r)=>{try{e.exec(`ALTER TABLE ${t} ADD COLUMN ${a} ${r}`)}catch{}})("sessions","ai_title","TEXT"),o("sessions","tags",'TEXT DEFAULT "[]"'),o("sessions","codex_category","TEXT"),o("sessions","tokens_used","INTEGER"),o("usage_snapshots","account_id","TEXT"),e.exec(`
    CREATE INDEX IF NOT EXISTS idx_sessions_started ON sessions(started_at DESC);
    CREATE INDEX IF NOT EXISTS idx_usage_captured ON usage_snapshots(captured_at DESC);
    CREATE INDEX IF NOT EXISTS idx_usage_source_account_captured ON usage_snapshots(source, account_id, captured_at DESC);
  `),n}],43793)},81149,e=>{"use strict";e.s(["getLatestUsageSnapshot",0,function(e,t,a){return(null!=a?e.prepare(`
        SELECT id, captured_at, source, account_id, window_5h_used_pct, window_weekly_used_pct,
               reset_at_5h, reset_at_weekly, raw_output, confidence
        FROM usage_snapshots
        WHERE source = ? AND account_id = ?
        ORDER BY captured_at DESC
        LIMIT 1
      `).get(t,a):e.prepare(`
        SELECT id, captured_at, source, account_id, window_5h_used_pct, window_weekly_used_pct,
               reset_at_5h, reset_at_weekly, raw_output, confidence
        FROM usage_snapshots
        WHERE source = ?
        ORDER BY captured_at DESC
        LIMIT 1
      `).get(t))??null},"insertUsageSnapshot",0,function(e,t){e.prepare(`
    INSERT INTO usage_snapshots
      (captured_at, source, account_id, window_5h_used_pct, window_weekly_used_pct,
       reset_at_5h, reset_at_weekly, raw_output, confidence)
    VALUES
      (@captured_at, @source, @account_id, @window_5h_used_pct, @window_weekly_used_pct,
       @reset_at_5h, @reset_at_weekly, @raw_output, @confidence)
  `).run({captured_at:t.capturedAt,source:t.source,account_id:t.accountId,window_5h_used_pct:t.window5hUsedPct,window_weekly_used_pct:t.windowWeeklyUsedPct,reset_at_5h:t.resetAt5h,reset_at_weekly:t.resetAtWeekly,raw_output:t.rawOutput,confidence:t.confidence})}])},62043,e=>{"use strict";var t=e.i(47909),a=e.i(74017),r=e.i(96250),s=e.i(59756),n=e.i(61916),o=e.i(74677),i=e.i(69741),u=e.i(16795),d=e.i(87718),c=e.i(95169),l=e.i(47587),p=e.i(66012),E=e.i(70101),_=e.i(26937),T=e.i(10372),R=e.i(93695);e.i(52474);var h=e.i(220),w=e.i(89171),x=e.i(43793),g=e.i(81149);let N=new Set(["claude_usage_cmd","statusline","manual","codex"]);e.s(["GET",0,function(e){let t=new URL(e.url),a=t.searchParams.get("source"),r=a&&N.has(a)?a:null,s=t.searchParams.get("accountId"),n=(0,x.getDb)();if(r)return w.NextResponse.json({snapshot:(0,g.getLatestUsageSnapshot)(n,r,"codex"===r&&s?s:null)});let o=n.prepare("SELECT * FROM usage_snapshots ORDER BY captured_at DESC LIMIT 1").get();return w.NextResponse.json({snapshot:o??null})}],51548);var f=e.i(51548);let v=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/usage/route",pathname:"/api/usage",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/usage/route.ts",nextConfigOutput:"",userland:f,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:I,serverHooks:C}=v;async function y(e,t,r){r.requestMeta&&(0,s.setRequestMeta)(e,r.requestMeta),v.isDev&&(0,s.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/usage/route";w=w.replace(/\/index$/,"")||"/";let x=await v.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!x)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:g,deploymentId:N,params:f,nextConfig:A,parsedUrl:I,isDraftMode:C,prerenderManifest:y,routerServerContext:m,isOnDemandRevalidate:O,revalidateOnlyGenerated:S,resolvedPathname:L,clientReferenceManifest:U,serverActionsManifest:k}=x,b=(0,i.normalizeAppPath)(w),D=!!(y.dynamicRoutes[b]||y.routes[L]),P=async()=>((null==m?void 0:m.render404)?await m.render404(e,t,I,!1):t.end("This page could not be found"),null);if(D&&!C){let e=!!y.routes[L],t=y.dynamicRoutes[b];if(t&&!1===t.fallback&&!e){if(A.adapterPath)return await P();throw new R.NoFallbackError}}let q=null;!D||v.isDev||C||(q="/index"===(q=L)?"/":q);let X=!0===v.isDev||!D,M=D&&!X;k&&U&&(0,o.setManifestsSingleton)({page:w,clientReferenceManifest:U,serverActionsManifest:k});let j=e.method||"GET",F=(0,n.getTracer)(),H=F.getActiveScopeSpan(),G=!!(null==m?void 0:m.isWrappedByNextServer),B=!!(0,s.getRequestMeta)(e,"minimalMode"),K=(0,s.getRequestMeta)(e,"incrementalCache")||await v.getIncrementalCache(e,A,y,B);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let $={params:f,previewProps:y.preview,renderOpts:{experimental:{authInterrupts:!!A.experimental.authInterrupts},cacheComponents:!!A.cacheComponents,supportsDynamicResponse:X,incrementalCache:K,cacheLifeProfiles:A.cacheLife,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r,s)=>v.onRequestError(e,t,r,s,m)},sharedContext:{buildId:g,deploymentId:N}},Y=new u.NodeNextRequest(e),W=new u.NodeNextResponse(t),V=d.NextRequestAdapter.fromNodeNextRequest(Y,(0,d.signalFromNodeResponse)(t));try{let s,o=async e=>v.handle(V,$).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let a=F.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==c.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let r=a.get("next.route");if(r){let t=`${j} ${r}`;e.setAttributes({"next.route":r,"http.route":r,"next.span_name":t}),e.updateName(t),s&&s!==e&&(s.setAttribute("http.route",r),s.updateName(t))}else e.updateName(`${j} ${w}`)}),i=async s=>{var n,i;let u=async({previousCacheEntry:a})=>{try{if(!B&&O&&S&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await o(s);e.fetchMetrics=$.renderOpts.fetchMetrics;let i=$.renderOpts.pendingWaitUntil;i&&r.waitUntil&&(r.waitUntil(i),i=void 0);let u=$.renderOpts.collectedTags;if(!D)return await (0,p.sendResponse)(Y,W,n,$.renderOpts.pendingWaitUntil),null;{let e=await n.blob(),t=(0,E.toNodeOutgoingHttpHeaders)(n.headers);u&&(t[T.NEXT_CACHE_TAGS_HEADER]=u),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==$.renderOpts.collectedRevalidate&&!($.renderOpts.collectedRevalidate>=T.INFINITE_CACHE)&&$.renderOpts.collectedRevalidate,r=void 0===$.renderOpts.collectedExpire||$.renderOpts.collectedExpire>=T.INFINITE_CACHE?void 0:$.renderOpts.collectedExpire;return{value:{kind:h.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:r}}}}catch(t){throw(null==a?void 0:a.isStale)&&await v.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,l.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:O})},!1,m),t}},d=await v.handleResponse({req:e,nextConfig:A,cacheKey:q,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:y,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:S,responseGenerator:u,waitUntil:r.waitUntil,isMinimalMode:B});if(!D)return null;if((null==d||null==(n=d.value)?void 0:n.kind)!==h.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});B||t.setHeader("x-nextjs-cache",O?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let c=(0,E.fromNodeOutgoingHttpHeaders)(d.value.headers);return B&&D||c.delete(T.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||t.getHeader("Cache-Control")||c.get("Cache-Control")||c.set("Cache-Control",(0,_.getCacheControlHeader)(d.cacheControl)),await (0,p.sendResponse)(Y,W,new Response(d.value.body,{headers:c,status:d.value.status||200})),null};G&&H?await i(H):(s=F.getActiveScopeSpan(),await F.withPropagatedContext(e.headers,()=>F.trace(c.BaseServerSpan.handleRequest,{spanName:`${j} ${w}`,kind:n.SpanKind.SERVER,attributes:{"http.method":j,"http.target":e.url}},i),void 0,!G))}catch(t){if(t instanceof R.NoFallbackError||await v.onRequestError(e,t,{routerKind:"App Router",routePath:b,routeType:"route",revalidateReason:(0,l.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:O})},!1,m),D)throw t;return await (0,p.sendResponse)(Y,W,new Response(null,{status:500})),null}}e.s(["handler",0,y,"patchFetch",0,function(){return(0,r.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:I})},"routeModule",0,v,"serverHooks",0,C,"workAsyncStorage",0,A,"workUnitAsyncStorage",0,I],62043)}];

//# sourceMappingURL=%5Broot-of-the-server%5D__0g0u0lm._.js.map