ccgauge 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-build-manifest.json +42 -42
- package/.next/standalone/.next/app-path-routes-manifest.json +6 -6
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/blocks/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/export/usage/route.js +1 -1
- package/.next/standalone/.next/server/app/api/export/usage/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/scan/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/usage/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/models/page.js +1 -1
- package/.next/standalone/.next/server/app/models/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/page.js +2 -2
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page.js +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/sessions/page.js +1 -1
- package/.next/standalone/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page.js +2 -2
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/usage/page.js +1 -1
- package/.next/standalone/.next/server/app/usage/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +6 -6
- package/.next/standalone/.next/server/chunks/125.js +1 -1
- package/.next/standalone/.next/server/chunks/567.js +3 -3
- package/.next/standalone/.next/server/chunks/716.js +1 -1
- package/.next/standalone/.next/server/chunks/98.js +1 -1
- package/.next/standalone/.next/server/functions-config-manifest.json +1 -1
- package/.next/standalone/.next/server/middleware-manifest.json +5 -5
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/148-edf90b0918345dc2.js +1 -0
- package/.next/standalone/.next/static/chunks/app/layout-af71188a257674b5.js +1 -0
- package/.next/standalone/.next/static/chunks/app/page-1a147d12fca0b184.js +1 -0
- package/.next/standalone/.next/static/chunks/app/usage/{page-7fcc2a2d931307d5.js → page-051223f62647aadc.js} +1 -1
- package/.next/standalone/.next/static/css/fabb40b2545c70dd.css +5 -0
- package/.next/standalone/package.json +8 -2
- package/.next/standalone/public/codex-logo.webp +0 -0
- package/CHANGELOG.md +160 -0
- package/README.md +136 -384
- package/README.zh-CN.md +146 -398
- package/bin/cli.mjs +30 -190
- package/dist/mcp/server.mjs +11 -11
- package/dist/report/index.mjs +36 -3127
- package/package.json +8 -2
- package/.next/standalone/.next/static/chunks/148-f2cba0b76260b8d3.js +0 -1
- package/.next/standalone/.next/static/chunks/app/layout-0adb4fc0305adf29.js +0 -1
- package/.next/standalone/.next/static/chunks/app/page-3cda7f70ecf5017a.js +0 -1
- package/.next/standalone/.next/static/css/bde47638beb0c717.css +0 -3
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/constants.js +0 -10
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/fontkit/index.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/format-available-values.js +0 -9
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/fetch-css-from-google-fonts.js +0 -28
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/fetch-font-file.js +0 -24
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/fetch-resource.js +0 -46
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/find-font-files-in-css.js +0 -34
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/font-data.json +0 -17669
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/get-fallback-font-override-metrics.js +0 -62
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/get-font-axes.js +0 -66
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/get-google-fonts-url.js +0 -55
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/get-proxy-agent.js +0 -23
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/google-fonts-metadata.js +0 -8
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/loader.js +0 -175
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/retry.js +0 -18
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/sort-fonts-variant-values.js +0 -26
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/google/validate-google-font-function-call.js +0 -101
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/local/get-fallback-metrics-from-font-file.js +0 -85
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/local/loader.js +0 -78
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/local/pick-font-file-for-fallback-generation.js +0 -85
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/local/validate-local-font-function-call.js +0 -66
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/dist/next-font-error.js +0 -11
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/google/loader.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/local/loader.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/@next/font/package.json +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/amphtml-validator/index.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/amphtml-validator/package.json +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/amphtml-validator/validator_wasm.js +0 -2672
- package/.next/standalone/node_modules/next/dist/compiled/babel/bundle.js +0 -227
- package/.next/standalone/node_modules/next/dist/compiled/babel/code-frame.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core-lib-block-hoist-plugin.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core-lib-config.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core-lib-normalize-file.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core-lib-normalize-opts.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core-lib-plugin-pass.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/core.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/generator.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/package.json +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/parser.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/plugin-syntax-jsx.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/plugin-transform-define.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/plugin-transform-modules-commonjs.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/preset-typescript.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/traverse.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel/types.js +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel-packages/package.json +0 -1
- package/.next/standalone/node_modules/next/dist/compiled/babel-packages/packages-bundle.js +0 -335
- package/.next/standalone/node_modules/next/dist/server/capsize-font-metrics.json +0 -181516
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-darwin-arm64/LICENSE +0 -191
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-darwin-arm64/lib/sharp-darwin-arm64.node +0 -0
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-darwin-arm64/package.json +0 -40
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-libvips-darwin-arm64/lib/index.js +0 -1
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-libvips-darwin-arm64/lib/libvips-cpp.8.17.3.dylib +0 -0
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-libvips-darwin-arm64/package.json +0 -36
- package/.next/standalone/node_modules/next/node_modules/@img/sharp-libvips-darwin-arm64/versions.json +0 -30
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/channel.js +0 -177
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/colour.js +0 -195
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/composite.js +0 -212
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/constructor.js +0 -499
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/index.js +0 -16
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/input.js +0 -809
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/is.js +0 -143
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/libvips.js +0 -207
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/operation.js +0 -1016
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/output.js +0 -1666
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/resize.js +0 -595
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/sharp.js +0 -121
- package/.next/standalone/node_modules/next/node_modules/sharp/lib/utility.js +0 -291
- package/.next/standalone/node_modules/next/node_modules/sharp/package.json +0 -202
- package/.next/standalone/public/codex-logo.png +0 -0
- /package/.next/standalone/.next/static/{jncTEohJB76Iq9TUm3G21 → EQqRlXV5HyaCYSZWOVllH}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{jncTEohJB76Iq9TUm3G21 → EQqRlXV5HyaCYSZWOVllH}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.id=98,exports.ids=[98],exports.modules={49098:(a,b,c)=>{c.d(b,{So:()=>s,mo:()=>u,TF:()=>t});var d=c(60704),e=c(73024),f=c(76760),g=c.n(f),h=c(48161),i=c.n(h);let j="default";function k(a){let b=a===j?"index-v2.json":`index-${a}-v2.json`;return g().join(process.env.CCGAUGE_STATE_DIR?process.env.CCGAUGE_STATE_DIR:g().join(i().homedir(),".ccgauge"),"cache",b)}async function l(a=j){let b=k(a);try{let a=await e.promises.readFile(b,"utf8"),c=JSON.parse(a);if(2!==c.schemaVersion||!Array.isArray(c.files))return null;return c}catch{return null}}async function m(a,b=j){let c=k(b),d=g().dirname(c);await e.promises.mkdir(d,{recursive:!0});let f={schemaVersion:2,savedAt:a.savedAt,files:a.files},h=`${c}.tmp-${process.pid}`;await e.promises.writeFile(h,JSON.stringify(f)),await e.promises.rename(h,c)}let n=/\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\/subagents\/agent-[^/]+\.jsonl$/i;class o{constructor(a=j){this.files=new Map,this.snapshot=null,this.watchers=new Map,this.pollTimer=null,this.snapshotRebuildTimer=null,this.persistTimer=null,this.fileDebouncers=new Map,this.initPromise=null,this.isIndexing=!1,this.lastIndexedAt=null,this.indexDurationMs=null,this.existingDirs=[],this.dirToProvider=new Map,this.errors=[],this.loadedFromDisk=!1,this.lastWorkStart=null,this.rescanPromise=null,this.cacheName=a}init(){return this.initPromise||(this.initPromise=this.doInit()),this.initPromise}async doInit(){let a=Date.now();this.isIndexing=!0,this.lastWorkStart=a;try{await this.detectProviderDirs();let b=await l(this.cacheName);this.loadedFromDisk=null!==b;let c=new Map;if(b)for(let a of b.files)c.set(a.filePath,a);await this.fullScan(c),this.rebuildSnapshotNow(),this.indexDurationMs=Date.now()-a,this.lastIndexedAt=new Date().toISOString(),this.syncWatchersToDirs(),this.setupPolling(),this.schedulePersist()}finally{this.isIndexing=!1}}async detectProviderDirs(){let a=new Map,b=[];for(let c of(0,d.R0)())for(let d of c.getDirs())await p(d)&&!a.has(d)&&(a.set(d,c),b.push(d));let c=[],e=[];for(let b of a.keys())this.dirToProvider.has(b)||c.push(b);for(let b of this.dirToProvider.keys())a.has(b)||e.push(b);return this.dirToProvider=a,this.existingDirs=b,{added:c,removed:e}}async fullScan(a){let b=[];for(let[a,c]of this.dirToProvider)for(let d of(await q(a,c)))b.push({file:d,provider:c});let c=new Set(b.map(a=>a.file));for(let d of(await Promise.all(b.map(async({file:b,provider:c})=>{try{let d=await e.promises.stat(b),f=a.get(b);if(f&&f.source===c.id&&f.parserVersion===c.parserVersion&&f.mtimeMs===d.mtimeMs&&f.size===d.size)return void this.files.set(b,{source:c.id,parserVersion:c.parserVersion,mtimeMs:d.mtimeMs,size:d.size,assistantRecords:f.assistantRecords,userRecords:f.userRecords,parentLinks:f.parentLinks});let g=await c.parseFile(b);this.files.set(b,{source:c.id,parserVersion:c.parserVersion,mtimeMs:d.mtimeMs,size:d.size,assistantRecords:g.assistant,userRecords:g.user,parentLinks:g.parentLinks})}catch(a){this.recordError(`parse ${b}: ${a.message}`)}})),Array.from(this.files.keys())))c.has(d)||this.files.delete(d)}syncWatchersToDirs(){for(let[a,b]of this.watchers)if(!this.dirToProvider.has(a)){try{b.close()}catch{}this.watchers.delete(a)}for(let[a,b]of this.dirToProvider)if(!this.watchers.has(a))try{let c=(0,e.watch)(a,{recursive:!0},(c,d)=>{if(!d||"string"!=typeof d||!d.endsWith(".jsonl"))return;let e=g().join(a,d);this.scheduleFileReconcile(e,b)});c.on("error",b=>{this.recordError(`watcher ${a}: ${b.message}`)}),this.watchers.set(a,c)}catch(b){this.recordError(`watch ${a}: ${b.message}`)}}setupPolling(){this.pollTimer&&clearInterval(this.pollTimer);let a="mcp"===this.cacheName,b=process.env.CCGAUGE_POLL_FALLBACK;"1"!==b&&("0"===b||a)||(this.pollTimer=setInterval(()=>{this.pollOnce().catch(a=>this.recordError(`poll: ${a.message}`))},3e4),this.pollTimer.unref?.())}async pollOnce(){let a=Date.now(),b=await this.detectProviderDirs(),c=b.added.length>0||b.removed.length>0;c&&this.syncWatchersToDirs();let d=[];for(let[a,b]of this.dirToProvider)for(let c of(await q(a,b)))d.push({file:c,provider:b});let f=new Set(d.map(a=>a.file));for(let a of(await Promise.all(d.map(async({file:a,provider:b})=>{try{let d=await e.promises.stat(a),f=this.files.get(a);if(f&&f.mtimeMs===d.mtimeMs&&f.size===d.size)return;let g=await b.parseFile(a);this.files.set(a,{source:b.id,parserVersion:b.parserVersion,mtimeMs:d.mtimeMs,size:d.size,assistantRecords:g.assistant,userRecords:g.user,parentLinks:g.parentLinks}),c=!0}catch(b){this.recordError(`poll-parse ${a}: ${b.message}`)}})),Array.from(this.files.keys())))f.has(a)||(this.files.delete(a),c=!0);c&&(this.lastWorkStart=a,this.scheduleSnapshotRebuild(),this.schedulePersist())}scheduleFileReconcile(a,b){let c=this.fileDebouncers.get(a);c&&clearTimeout(c);let d=setTimeout(()=>{this.fileDebouncers.delete(a),this.reconcileFile(a,b).catch(b=>this.recordError(`reconcile ${a}: ${b.message}`))},200);d.unref?.(),this.fileDebouncers.set(a,d)}async reconcileFile(a,b){let c=Date.now(),d=null;try{d=await e.promises.stat(a)}catch{}if(!d||!d.isFile()){this.files.has(a)&&(this.files.delete(a),this.lastWorkStart=c,this.scheduleSnapshotRebuild(),this.schedulePersist());return}let f=this.files.get(a);if(!f||f.mtimeMs!==d.mtimeMs||f.size!==d.size)try{let e=await b.parseFile(a);this.files.set(a,{source:b.id,parserVersion:b.parserVersion,mtimeMs:d.mtimeMs,size:d.size,assistantRecords:e.assistant,userRecords:e.user,parentLinks:e.parentLinks}),this.lastWorkStart=c,this.scheduleSnapshotRebuild(),this.schedulePersist()}catch(b){this.recordError(`parse ${a}: ${b.message}`)}}scheduleSnapshotRebuild(){this.snapshotRebuildTimer&&clearTimeout(this.snapshotRebuildTimer),this.snapshotRebuildTimer=setTimeout(()=>{this.snapshotRebuildTimer=null,this.rebuildSnapshotNow()},100),this.snapshotRebuildTimer.unref?.()}rebuildSnapshotNow(){let a=Date.now(),b=this.lastWorkStart??a,c=[],d=[],e={},f=0,g={claude:{source:"claude",filesScanned:0,recordsParsed:0,assistantRecords:0,scannedDirs:[]},codex:{source:"codex",filesScanned:0,recordsParsed:0,assistantRecords:0,scannedDirs:[]}};for(let[a,b]of this.dirToProvider)g[b.id].scannedDirs.push(a);for(let a of this.files.values()){for(let[b,f]of(c.push(...a.assistantRecords),d.push(...a.userRecords),a.parentLinks))e[b]=f;f+=a.assistantRecords.length+a.userRecords.length,g[a.source].filesScanned+=1,g[a.source].recordsParsed+=a.assistantRecords.length+a.userRecords.length}let h=(function(a){let b=new Map;for(let c of a){let a=function(a){let b=`${a.source}:`;return a.messageId&&a.requestId?`${b}${a.messageId}::${a.requestId}`:a.messageId?`${b}mid:${a.messageId}`:a.requestId?`${b}req:${a.requestId}`:`${b}uuid:${a.uuid}`}(c),d=b.get(a);if(!d){b.set(a,c);continue}c.timestamp<d.timestamp&&b.set(a,c)}return Array.from(b.values())})(c).sort((a,b)=>a.timestamp.localeCompare(b.timestamp)),i=(function(a){let b=new Set;return a.filter(a=>{let c=a.uuid;return!c||!b.has(c)&&(b.add(c),!0)})})(d).sort((a,b)=>a.timestamp.localeCompare(b.timestamp));for(let a of(!function({assistantRecords:a,userRecords:b,parentMap:c}){let d=new Map;for(let b of a){if(b.isSidechain||!b.sessionId)continue;let a=d.get(b.sessionId);a||(a=[],d.set(b.sessionId,a)),a.push(b)}for(let a of d.values())a.sort((a,b)=>a.timestamp<b.timestamp?-1:+(a.timestamp>b.timestamp));let e=new Map;for(let a of b){if(!a.isSidechain)continue;let b=e.get(a.filePath);(!b||a.timestamp<b.timestamp)&&e.set(a.filePath,a)}let f={subagentFiles:0,relinked:0,orphans:0,alreadyLinked:0};for(let[a,b]of e){let e,g=function(a){let b=n.exec(a);return b?b[1]:null}(a);if(!g)continue;if(f.subagentFiles+=1,null!=c[b.uuid]){f.alreadyLinked+=1;continue}let h=d.get(g);if(!h||0===h.length){f.orphans+=1;continue}let i=b.timestamp;for(let a=h.length-1;a>=0;a-=1)if(h[a].timestamp<=i){e=h[a];break}e||(e=h[0]),c[b.uuid]=e.uuid,f.relinked+=1}}({assistantRecords:h,userRecords:i,parentMap:e}),h))g[a.source].assistantRecords+=1;let j={filesScanned:this.files.size,recordsParsed:f,assistantRecords:h.length,durationMs:Date.now()-b,scannedDirs:this.existingDirs};this.snapshot={records:h,userRecords:i,parentMap:e,stats:j,bySource:Object.values(g)},this.lastWorkStart=null}getSnapshot(){if(!this.snapshot)throw Error("Indexer not initialized — call init() first.");return this.snapshot}async forceRescan(){if(!this.initPromise)return await this.init(),this.snapshot;if(this.rescanPromise)return this.rescanPromise;this.rescanPromise=this.runRescan();try{return await this.rescanPromise}finally{this.rescanPromise=null}}async runRescan(){let a=Date.now();this.isIndexing=!0,this.lastWorkStart=a;try{return this.files.clear(),await this.detectProviderDirs(),await this.fullScan(new Map),this.rebuildSnapshotNow(),this.indexDurationMs=Date.now()-a,this.lastIndexedAt=new Date().toISOString(),this.syncWatchersToDirs(),this.schedulePersist(),this.snapshot}finally{this.isIndexing=!1}}getStatus(){let a=this.snapshot;return{initialized:null!==a,isIndexing:this.isIndexing,lastIndexedAt:this.lastIndexedAt,indexDurationMs:this.indexDurationMs,filesIndexed:this.files.size,recordsIndexed:a?.stats.assistantRecords??0,bySource:a?.bySource??[],watchers:this.watchers.size,errors:this.errors.slice(-20),pendingReconciles:this.fileDebouncers.size,loadedFromDisk:this.loadedFromDisk}}schedulePersist(){this.persistTimer&&clearTimeout(this.persistTimer),this.persistTimer=setTimeout(()=>{this.persistTimer=null;let a=[];for(let[b,c]of this.files)a.push({filePath:b,source:c.source,parserVersion:c.parserVersion,mtimeMs:c.mtimeMs,size:c.size,assistantRecords:c.assistantRecords,userRecords:c.userRecords,parentLinks:c.parentLinks});m({savedAt:new Date().toISOString(),files:a},this.cacheName).catch(a=>this.recordError(`persist: ${a.message}`))},2e3),this.persistTimer.unref?.()}recordError(a){let b=`${new Date().toISOString()} ${function(a){let b=(0,h.homedir)();if(!b)return a;let c=new Set([b]);"win32"===process.platform&&(c.add(b.replace(/\\/g,"/")),c.add(b.replace(/\\/g,"\\\\")),c.add("\\\\?\\"+b),c.add("\\\\?\\"+b.replace(/\\/g,"/")));let d=a;for(let a of c){let b=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");d=d.replace(RegExp(b,"g"),"~")}return d}(a)}`;this.errors.push(b),this.errors.length>40&&this.errors.splice(0,this.errors.length-20),process.env.CCGAUGE_DEBUG&&console.error(`[ccgauge:indexer] ${new Date().toISOString()} ${a}`)}disposeWatchers(){for(let a of this.watchers.values())try{a.close()}catch{}this.watchers.clear()}dispose(){for(let a of(this.disposeWatchers(),this.pollTimer&&clearInterval(this.pollTimer),this.snapshotRebuildTimer&&clearTimeout(this.snapshotRebuildTimer),this.persistTimer&&clearTimeout(this.persistTimer),this.fileDebouncers.values()))clearTimeout(a);this.fileDebouncers.clear()}}async function p(a){try{return(await e.promises.stat(a)).isDirectory()}catch{return!1}}async function q(a,b){let c=[];async function d(a,f){let h;if(!(f>8)){try{h=await e.promises.readdir(a,{withFileTypes:!0})}catch{return}for(let e of h){let h=g().join(a,e.name);if(e.isDirectory()){if(b.shouldSkipDir(e.name))continue;await d(h,f+1)}else e.isFile()&&e.name.endsWith(".jsonl")&&c.push(h)}}}return await d(a,0),c}let r=function(a=j){let b=(globalThis.__ccgaugeIndexers||(globalThis.__ccgaugeIndexers=new Map),globalThis.__ccgaugeIndexers),c=b.get(a);return c||(c=new o(a),b.set(a,c)),c}();async function s(a={}){return a.force?r.forceRescan():(await r.init(),r.getSnapshot())}function t(){return(0,d.R0)().map(a=>({source:a.id,dirs:a.getDirs()}))}function u(){return r.getStatus()}}};
|
|
1
|
+
"use strict";exports.id=98,exports.ids=[98],exports.modules={49098:(a,b,c)=>{c.d(b,{So:()=>s,mo:()=>u,TF:()=>t});var d=c(60704),e=c(73024),f=c(76760),g=c.n(f),h=c(48161),i=c.n(h);let j="default";function k(a){let b=a===j?"index-v2.json":`index-${a}-v2.json`;return g().join(process.env.CCGAUGE_STATE_DIR?process.env.CCGAUGE_STATE_DIR:g().join(i().homedir(),".ccgauge"),"cache",b)}async function l(a=j){let b=k(a);try{let a=await e.promises.readFile(b,"utf8"),c=JSON.parse(a);if(2!==c.schemaVersion||!Array.isArray(c.files))return null;return c}catch{return null}}async function m(a,b=j){let c=k(b),d=g().dirname(c);await e.promises.mkdir(d,{recursive:!0});let f={schemaVersion:2,savedAt:a.savedAt,files:a.files},h=`${c}.tmp-${process.pid}`;await e.promises.writeFile(h,JSON.stringify(f)),await e.promises.rename(h,c)}let n=/\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\/subagents\/agent-[^/]+\.jsonl$/i;class o{constructor(a=j){this.files=new Map,this.snapshot=null,this.watchers=new Map,this.pollTimer=null,this.snapshotRebuildTimer=null,this.persistTimer=null,this.fileDebouncers=new Map,this.initPromise=null,this.isIndexing=!1,this.lastIndexedAt=null,this.indexDurationMs=null,this.existingDirs=[],this.dirToProvider=new Map,this.errors=[],this.loadedFromDisk=!1,this.lastWorkStart=null,this.rescanPromise=null,this.mutationTail=Promise.resolve(),this.cacheName=a}runExclusive(a){let b=this.mutationTail.then(a,a);return this.mutationTail=b.then(()=>void 0,()=>void 0),b}init(){return this.initPromise||(this.initPromise=this.doInit()),this.initPromise}async doInit(){let a=Date.now();this.isIndexing=!0,this.lastWorkStart=a;try{await this.detectProviderDirs();let b=await l(this.cacheName);this.loadedFromDisk=null!==b;let c=new Map;if(b)for(let a of b.files)c.set(a.filePath,a);await this.runExclusive(async()=>{await this.fullScan(c),this.rebuildSnapshotNow(),this.indexDurationMs=Date.now()-a,this.lastIndexedAt=new Date().toISOString(),this.schedulePersist()}),this.syncWatchersToDirs(),this.setupPolling()}finally{this.isIndexing=!1}}async detectProviderDirs(){let a=new Map,b=[];for(let c of(0,d.R0)())for(let d of c.getDirs())await p(d)&&!a.has(d)&&(a.set(d,c),b.push(d));let c=[],e=[];for(let b of a.keys())this.dirToProvider.has(b)||c.push(b);for(let b of this.dirToProvider.keys())a.has(b)||e.push(b);return this.dirToProvider=a,this.existingDirs=b,{added:c,removed:e}}async fullScan(a){let b=[];for(let[a,c]of this.dirToProvider)for(let d of(await q(a,c)))b.push({file:d,provider:c});let c=new Set(b.map(a=>a.file));for(let d of(await Promise.all(b.map(async({file:b,provider:c})=>{try{let d=await e.promises.stat(b),f=a.get(b);if(f&&f.source===c.id&&f.parserVersion===c.parserVersion&&f.mtimeMs===d.mtimeMs&&f.size===d.size)return void this.files.set(b,{source:c.id,parserVersion:c.parserVersion,mtimeMs:d.mtimeMs,size:d.size,assistantRecords:f.assistantRecords,userRecords:f.userRecords,parentLinks:f.parentLinks});let g=await c.parseFile(b);this.files.set(b,{source:c.id,parserVersion:c.parserVersion,mtimeMs:d.mtimeMs,size:d.size,assistantRecords:g.assistant,userRecords:g.user,parentLinks:g.parentLinks})}catch(a){this.recordError(`parse ${b}: ${a.message}`)}})),Array.from(this.files.keys())))c.has(d)||this.files.delete(d)}syncWatchersToDirs(){for(let[a,b]of this.watchers)if(!this.dirToProvider.has(a)){try{b.close()}catch{}this.watchers.delete(a)}for(let[a,b]of this.dirToProvider)if(!this.watchers.has(a))try{let c=(0,e.watch)(a,{recursive:!0},(c,d)=>{if(!d||"string"!=typeof d||!d.endsWith(".jsonl"))return;let e=g().join(a,d);this.scheduleFileReconcile(e,b)});c.on("error",b=>{this.recordError(`watcher ${a}: ${b.message}`)}),this.watchers.set(a,c)}catch(b){this.recordError(`watch ${a}: ${b.message}`)}}setupPolling(){this.pollTimer&&clearInterval(this.pollTimer);let a="mcp"===this.cacheName,b=process.env.CCGAUGE_POLL_FALLBACK;"1"!==b&&("0"===b||a)||(this.pollTimer=setInterval(()=>{this.pollOnce().catch(a=>this.recordError(`poll: ${a.message}`))},3e4),this.pollTimer.unref?.())}async pollOnce(){await this.runExclusive(async()=>{let a=Date.now(),b=await this.detectProviderDirs(),c=b.added.length>0||b.removed.length>0;c&&this.syncWatchersToDirs();let d=[];for(let[a,b]of this.dirToProvider)for(let c of(await q(a,b)))d.push({file:c,provider:b});let f=new Set(d.map(a=>a.file));for(let a of(await Promise.all(d.map(async({file:a,provider:b})=>{try{let d=await e.promises.stat(a),f=this.files.get(a);if(f&&f.mtimeMs===d.mtimeMs&&f.size===d.size)return;let g=await b.parseFile(a);this.files.set(a,{source:b.id,parserVersion:b.parserVersion,mtimeMs:d.mtimeMs,size:d.size,assistantRecords:g.assistant,userRecords:g.user,parentLinks:g.parentLinks}),c=!0}catch(b){this.recordError(`poll-parse ${a}: ${b.message}`)}})),Array.from(this.files.keys())))f.has(a)||(this.files.delete(a),c=!0);c&&(this.lastWorkStart=a,this.scheduleSnapshotRebuild(),this.schedulePersist())})}scheduleFileReconcile(a,b){let c=this.fileDebouncers.get(a);c&&clearTimeout(c);let d=setTimeout(()=>{this.fileDebouncers.delete(a),this.reconcileFile(a,b).catch(b=>this.recordError(`reconcile ${a}: ${b.message}`))},200);d.unref?.(),this.fileDebouncers.set(a,d)}async reconcileFile(a,b){await this.runExclusive(async()=>{let c=Date.now(),d=null;try{d=await e.promises.stat(a)}catch{}if(!d||!d.isFile()){this.files.has(a)&&(this.files.delete(a),this.lastWorkStart=c,this.scheduleSnapshotRebuild(),this.schedulePersist());return}let f=this.files.get(a);if(!f||f.mtimeMs!==d.mtimeMs||f.size!==d.size)try{let e=await b.parseFile(a);this.files.set(a,{source:b.id,parserVersion:b.parserVersion,mtimeMs:d.mtimeMs,size:d.size,assistantRecords:e.assistant,userRecords:e.user,parentLinks:e.parentLinks}),this.lastWorkStart=c,this.scheduleSnapshotRebuild(),this.schedulePersist()}catch(b){this.recordError(`parse ${a}: ${b.message}`)}})}scheduleSnapshotRebuild(){this.snapshotRebuildTimer&&clearTimeout(this.snapshotRebuildTimer),this.snapshotRebuildTimer=setTimeout(()=>{this.snapshotRebuildTimer=null,this.rebuildSnapshotNow()},100),this.snapshotRebuildTimer.unref?.()}rebuildSnapshotNow(){let a=Date.now(),b=this.lastWorkStart??a,c=[],d=[],e={},f=0,g={claude:{source:"claude",filesScanned:0,recordsParsed:0,assistantRecords:0,scannedDirs:[]},codex:{source:"codex",filesScanned:0,recordsParsed:0,assistantRecords:0,scannedDirs:[]}};for(let[a,b]of this.dirToProvider)g[b.id].scannedDirs.push(a);for(let a of this.files.values()){for(let[b,f]of(c.push(...a.assistantRecords),d.push(...a.userRecords),a.parentLinks))e[b]=f;f+=a.assistantRecords.length+a.userRecords.length,g[a.source].filesScanned+=1,g[a.source].recordsParsed+=a.assistantRecords.length+a.userRecords.length}let h=(function(a){let b=new Map;for(let c of a){let a=function(a){let b=`${a.source}:`;return a.messageId&&a.requestId?`${b}${a.messageId}::${a.requestId}`:a.messageId?`${b}mid:${a.messageId}`:a.requestId?`${b}req:${a.requestId}`:`${b}uuid:${a.uuid}`}(c),d=b.get(a);if(!d){b.set(a,c);continue}c.timestamp<d.timestamp&&b.set(a,c)}return Array.from(b.values())})(c).sort((a,b)=>a.timestamp.localeCompare(b.timestamp)),i=(function(a){let b=new Set;return a.filter(a=>{let c=a.uuid;return!c||!b.has(c)&&(b.add(c),!0)})})(d).sort((a,b)=>a.timestamp.localeCompare(b.timestamp));for(let a of(!function({assistantRecords:a,userRecords:b,parentMap:c}){let d=new Map;for(let b of a){if(b.isSidechain||!b.sessionId)continue;let a=d.get(b.sessionId);a||(a=[],d.set(b.sessionId,a)),a.push(b)}for(let a of d.values())a.sort((a,b)=>a.timestamp<b.timestamp?-1:+(a.timestamp>b.timestamp));let e=new Map;for(let a of b){if(!a.isSidechain)continue;let b=e.get(a.filePath);(!b||a.timestamp<b.timestamp)&&e.set(a.filePath,a)}let f={subagentFiles:0,relinked:0,orphans:0,alreadyLinked:0};for(let[a,b]of e){let e,g=function(a){let b=n.exec(a);return b?b[1]:null}(a);if(!g)continue;if(f.subagentFiles+=1,null!=c[b.uuid]){f.alreadyLinked+=1;continue}let h=d.get(g);if(!h||0===h.length){f.orphans+=1;continue}let i=b.timestamp;for(let a=h.length-1;a>=0;a-=1)if(h[a].timestamp<=i){e=h[a];break}e||(e=h[0]),c[b.uuid]=e.uuid,f.relinked+=1}}({assistantRecords:h,userRecords:i,parentMap:e}),h))g[a.source].assistantRecords+=1;let j={filesScanned:this.files.size,recordsParsed:f,assistantRecords:h.length,durationMs:Date.now()-b,scannedDirs:this.existingDirs};this.snapshot={records:h,userRecords:i,parentMap:e,stats:j,bySource:Object.values(g)},this.lastWorkStart=null}getSnapshot(){if(!this.snapshot)throw Error("Indexer not initialized — call init() first.");return this.snapshot}async forceRescan(){let a=!this.initPromise;if(await this.init(),a)return this.snapshot;if(this.rescanPromise)return this.rescanPromise;this.rescanPromise=this.runRescan();try{return await this.rescanPromise}finally{this.rescanPromise=null}}async runRescan(){this.isIndexing=!0;try{return await this.runExclusive(async()=>{let a=Date.now();return this.lastWorkStart=a,this.snapshotRebuildTimer&&(clearTimeout(this.snapshotRebuildTimer),this.snapshotRebuildTimer=null),this.persistTimer&&(clearTimeout(this.persistTimer),this.persistTimer=null),this.files.clear(),await this.detectProviderDirs(),await this.fullScan(new Map),this.rebuildSnapshotNow(),this.indexDurationMs=Date.now()-a,this.lastIndexedAt=new Date().toISOString(),this.syncWatchersToDirs(),this.schedulePersist(),this.snapshot})}finally{this.isIndexing=!1}}getStatus(){let a=this.snapshot;return{initialized:null!==a,isIndexing:this.isIndexing,lastIndexedAt:this.lastIndexedAt,indexDurationMs:this.indexDurationMs,filesIndexed:this.files.size,recordsIndexed:a?.stats.assistantRecords??0,bySource:a?.bySource??[],watchers:this.watchers.size,errors:this.errors.slice(-20),pendingReconciles:this.fileDebouncers.size,loadedFromDisk:this.loadedFromDisk}}schedulePersist(){this.persistTimer&&clearTimeout(this.persistTimer),this.persistTimer=setTimeout(()=>{this.persistTimer=null;let a=[];for(let[b,c]of this.files)a.push({filePath:b,source:c.source,parserVersion:c.parserVersion,mtimeMs:c.mtimeMs,size:c.size,assistantRecords:c.assistantRecords,userRecords:c.userRecords,parentLinks:c.parentLinks});m({savedAt:new Date().toISOString(),files:a},this.cacheName).catch(a=>this.recordError(`persist: ${a.message}`))},2e3),this.persistTimer.unref?.()}recordError(a){let b=`${new Date().toISOString()} ${function(a){let b=(0,h.homedir)();if(!b)return a;let c=new Set([b]);"win32"===process.platform&&(c.add(b.replace(/\\/g,"/")),c.add(b.replace(/\\/g,"\\\\")),c.add("\\\\?\\"+b),c.add("\\\\?\\"+b.replace(/\\/g,"/")));let d=a;for(let a of c){let b=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");d=d.replace(RegExp(b,"g"),"~")}return d}(a)}`;this.errors.push(b),this.errors.length>40&&this.errors.splice(0,this.errors.length-20),process.env.CCGAUGE_DEBUG&&console.error(`[ccgauge:indexer] ${new Date().toISOString()} ${a}`)}disposeWatchers(){for(let a of this.watchers.values())try{a.close()}catch{}this.watchers.clear()}dispose(){for(let a of(this.disposeWatchers(),this.pollTimer&&clearInterval(this.pollTimer),this.snapshotRebuildTimer&&clearTimeout(this.snapshotRebuildTimer),this.persistTimer&&clearTimeout(this.persistTimer),this.fileDebouncers.values()))clearTimeout(a);this.fileDebouncers.clear()}}async function p(a){try{return(await e.promises.stat(a)).isDirectory()}catch{return!1}}async function q(a,b){let c=[];async function d(a,f){let h;if(!(f>8)){try{h=await e.promises.readdir(a,{withFileTypes:!0})}catch{return}for(let e of h){let h=g().join(a,e.name);if(e.isDirectory()){if(b.shouldSkipDir(e.name))continue;await d(h,f+1)}else e.isFile()&&e.name.endsWith(".jsonl")&&c.push(h)}}}return await d(a,0),c}function r(a=j){let b=(globalThis.__ccgaugeIndexers||(globalThis.__ccgaugeIndexers=new Map),globalThis.__ccgaugeIndexers),c=b.get(a);return c||(c=new o(a),b.set(a,c)),c}async function s(a={}){let b=r();return a.force?b.forceRescan():(await b.init(),b.getSnapshot())}function t(){return(0,d.R0)().map(a=>({source:a.id,dirs:a.getDirs()}))}function u(){return r().getStatus()}}};
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"wasm": [],
|
|
18
18
|
"assets": [],
|
|
19
19
|
"env": {
|
|
20
|
-
"__NEXT_BUILD_ID": "
|
|
21
|
-
"NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "
|
|
22
|
-
"__NEXT_PREVIEW_MODE_ID": "
|
|
23
|
-
"__NEXT_PREVIEW_MODE_SIGNING_KEY": "
|
|
24
|
-
"__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "
|
|
20
|
+
"__NEXT_BUILD_ID": "EQqRlXV5HyaCYSZWOVllH",
|
|
21
|
+
"NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "fxBP6Etf8lFbgJKurwCAcN8sP/B1u3Fma5aWVU9LqBs=",
|
|
22
|
+
"__NEXT_PREVIEW_MODE_ID": "749380e988338c5f297fb78ad8cf3132",
|
|
23
|
+
"__NEXT_PREVIEW_MODE_SIGNING_KEY": "0c6dbd4c759f115f6f21acd74c748a8331ff88146c12414ced16a22258f93d7a",
|
|
24
|
+
"__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "62421c0c0bb17aacc52970bdb8ddf5a5c0ef1f8714a123e1a07f7475f20bb672"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><title data-next-head="">500: Internal Server Error</title><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-73dfee69c0ddc58e.js" defer=""></script><script src="/_next/static/chunks/framework-1a308e28e19f1a97.js" defer=""></script><script src="/_next/static/chunks/main-2cb79280eaf22774.js" defer=""></script><script src="/_next/static/chunks/pages/_app-5addca2b3b969fde.js" defer=""></script><script src="/_next/static/chunks/pages/_error-022e4ac7bbb9914f.js" defer=""></script><script src="/_next/static/
|
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><title data-next-head="">500: Internal Server Error</title><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-73dfee69c0ddc58e.js" defer=""></script><script src="/_next/static/chunks/framework-1a308e28e19f1a97.js" defer=""></script><script src="/_next/static/chunks/main-2cb79280eaf22774.js" defer=""></script><script src="/_next/static/chunks/pages/_app-5addca2b3b969fde.js" defer=""></script><script src="/_next/static/chunks/pages/_error-022e4ac7bbb9914f.js" defer=""></script><script src="/_next/static/EQqRlXV5HyaCYSZWOVllH/_buildManifest.js" defer=""></script><script src="/_next/static/EQqRlXV5HyaCYSZWOVllH/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":500}},"page":"/_error","query":{},"buildId":"EQqRlXV5HyaCYSZWOVllH","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"node":{},"edge":{},"encryptionKey":"
|
|
1
|
+
{"node":{},"edge":{},"encryptionKey":"fxBP6Etf8lFbgJKurwCAcN8sP/B1u3Fma5aWVU9LqBs="}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[148],{51148:(e,t,s)=>{s.d(t,{CY:()=>d,s9:()=>u,kj:()=>m});var o=s(95155),i=s(12115),n=s(20063),a=s(79808);let c="ccgauge_locale",r=(0,i.createContext)({locale:a.Xn,setLocale:()=>{},t:e=>e}),l="ccgauge.locale";function d(e){let{initialLocale:t,children:s}=e,d=(0,n.useRouter)();(0,i.useEffect)(()=>{try{let e=localStorage.getItem(l);e&&e!==t&&("en"===e||"zh"===e)&&(document.cookie="".concat(c,"=").concat(e,"; path=/; max-age=").concat(31536e3,"; SameSite=Lax"),d.refresh())}catch(e){}},[]);let u=(0,i.useCallback)(e=>{try{localStorage.setItem(l,e)}catch(e){}document.cookie="".concat(c,"=").concat(e,"; path=/; max-age=").concat(31536e3,"; SameSite=Lax"),d.refresh()},[d]),m=(0,i.useCallback)((e,s)=>(0,a.nA)(t,e,s),[t]),g=(0,i.useMemo)(()=>({locale:t,setLocale:u,t:m}),[t,u,m]);return(0,o.jsx)(r.Provider,{value:g,children:s})}function u(){return(0,i.useContext)(r)}function m(){return(0,i.useContext)(r).t}},79808:(e,t,s)=>{s.d(t,{Xn:()=>i,YZ:()=>o,nA:()=>a});let o=["en","zh"],i="en",n={en:{"brand.tagline":"usage dashboard for AI coding CLIs","nav.overview":"Overview","nav.usage":"Usage","nav.sessions":"Sessions","nav.projects":"Projects","nav.models":"Models","nav.settings":"Settings","nav.docs":"Docs","nav.localBadge":"local","nav.source":"Data source","source.claude":"Claude","source.codex":"Codex","source.all":"All","cost.footnote.codex":"Cost shown is the OpenAI API equivalent (subscription plans pay differently).","common.requests":"requests","common.tokens":"tokens","common.cost":"Cost","common.savedViaCache":"Saved {amount} via cache","common.savedTodayViaCache":"Saved {amount} today","common.live":"live","common.allModels":"All","common.allProjects":"All","common.unknown":"(unknown)","common.session":"Session","common.sessions":"sessions","common.projects":"projects","common.req":"req","common.day":"day","common.days":"days","common.activity":"activity","common.fallbackPrice":"fallback price","common.thinking":"thinking","common.lastActivity":"last activity","common.empty.title":"No usage data yet","common.empty.desc":"Open Claude Code, send a message, then refresh.","common.refresh":"Refresh","common.search":"Search…","common.searchPlaceholder":"Search model, project, session, tool…","common.exportCsv":"Export CSV","common.rows":"{count} rows","common.prev":"‹ Prev","common.next":"Next ›","common.first":"\xab","common.last":"\xbb","common.pageOf":"Page {page} of {total}","common.allSessions":"← All sessions","common.allProjectsLink":"← All projects","common.noMatchingRows":"No matching rows","range.label":"Date range","range.today":"Today","range.7d":"7d","range.30d":"30d","range.90d":"90d","range.all":"All","range.custom":"Custom","range.customApply":"Apply","range.from":"From","range.to":"To","range.cancel":"Cancel","gran.label":"Granularity","gran.hour":"Hour","gran.day":"Day","gran.week":"Week","gran.month":"Month","overview.title":"Overview","overview.subtitle":"{count} requests across {files} files \xb7 scan in {ms}ms","overview.subtitle.empty":"Scanned {dirs} directory(ies). Open Claude Code, send a message, then refresh.","overview.empty.title":"No usage data yet","overview.kpi.tokensToday":"Tokens today","overview.kpi.costToday":"Cost today","overview.kpi.thisMonth":"This month","overview.kpi.cacheHit":"Cache hit rate","overview.kpi.topModel":"Top model","overview.kpi.activeSessions":"Sessions today","overview.kpi.activeSessions.hint":"{count} project(s)","overview.kpi.thisMonth.hint":"{tokens} tokens \xb7 {req} req","overview.kpi.tokensToday.hint":"{count} requests","overview.kpi.topModel.hint":"{pct} of cost this month","overview.kpi.cacheHit.hint":"Saved {amount} today","overview.delta.title":"vs yesterday","overview.delta.firstTime":"NEW","common.loading":"Loading…","common.error.title":"Something went wrong","common.error.desc":"Failed to load this page. Try again.","common.error.retry":"Retry","overview.trend.title":"Usage trend","overview.trend.desc":"Last 30 days \xb7 {metric}","overview.trend.desc.tokens":"stacked by token type","overview.trend.desc.conversations":"conversations per day","overview.trend.metric.tokens":"Tokens","overview.trend.metric.conversations":"Conversations","overview.trend.activeDays":"{n} day with activity","overview.trend.activeDays.plural":"{n} days with activity","overview.costByModel.title":"Cost by model","overview.costByModel.desc":"This month, sorted by spend","activity.title":"Activity","activity.subtitle":"Lifetime stats and when you usually code","activity.sessions":"Sessions","activity.messages":"Messages","activity.totalTokens":"Total tokens","activity.activeDays":"Active days","activity.currentStreak":"Current streak","activity.longestStreak":"Longest streak","activity.streakCombinedLabel":"Streak (cur / max)","activity.streakCombinedValue":"{current} / {longest} d","activity.peakHour":"Peak hour","activity.favoriteModel":"Favorite model","activity.streakValue":"{n}d","activity.dow.0":"Sun","activity.dow.1":"Mon","activity.dow.2":"Tue","activity.dow.3":"Wed","activity.dow.4":"Thu","activity.dow.5":"Fri","activity.dow.6":"Sat","activity.heatmap.tooltip":"{dow} \xb7 {hour} \xb7 {count} messages","activity.heatmap.messages":"Messages","activity.heatmap.tokens":"Tokens","activity.heatmap.shareLabel":"Share","activity.heatmap.intensityLabel":"Of peak","activity.heatmap.empty":"No activity","activity.comparison":"You've used ~{multiplier}\xd7 more tokens than {ref}.","activity.ref.haiku":"a haiku","activity.ref.tweet":"a tweet","activity.ref.littlePrince":"The Little Prince","activity.ref.gatsby":"The Great Gatsby","activity.ref.hobbit":"The Hobbit","activity.ref.lotrTrilogy":"the Lord of the Rings trilogy","activity.ref.warAndPeace":"War and Peace","activity.ref.harryPotterAll":"all 7 Harry Potter books","activity.ref.encyclopediaBritannica":"the Encyclopedia Britannica","activity.ref.wikipediaEn":"all of English Wikipedia","block.title":"Active 5h block","block.remaining":"remaining","block.elapsed":"Time elapsed {pct}%","block.tokensSuffix":"tokens","block.spentSoFar":"Spent so far","block.burnPerMin":"Burn / min","block.projectedTotal":"Projected total","block.requests":"Requests","block.empty":"No active block","block.emptyDesc":"Send a message in {cli} to start one.","block.disclaimer":"Wall-clock progress of the 5h window — not your plan quota.","chart.legend.input":"Input","chart.legend.output":"Output","chart.legend.cacheRead":"Cache read","chart.legend.cacheWrite":"Cache write","chart.tooltip.total":"Total","chart.tooltip.cost":"Cost","chart.tooltip.requests":"Requests","chart.tooltip.conversations":"Conversations","chart.empty":"No data in this range","chart.empty.short":"No data","usage.title":"Usage","usage.subtitle":"{count} turns in selected range","usage.col.calls":"Calls","usage.col.userMessage":"Prompt","usage.overview.label":"Overview","usage.overview.show":"Show overview (KPIs + trend)","usage.overview.hide":"Hide overview (KPIs + trend)","usage.turn.expand":"Expand","usage.turn.collapse":"Collapse","usage.turn.callsCount":"{count} calls","usage.turn.noPrompt":"(no user text)","usage.requests.desc":"One row per turn (user message + tool calls); click ▸ to expand","usage.kpi.totalTokens":"Total tokens","usage.kpi.totalCost":"Total cost","usage.kpi.cacheSaved":"Cache saved","usage.kpi.cacheHit":"Cache hit","usage.trend":"Trend","usage.trend.gran":"Granularity: {gran}","usage.requests.title":"Requests","usage.col.time":"Time","usage.col.duration":"Duration","usage.col.model":"Model","usage.col.project":"Project","usage.col.session":"Session","usage.col.input":"Input","usage.col.output":"Output","usage.col.cacheRead":"Cache R","usage.col.cacheWrite":"Cache W","usage.col.cost":"Cost","usage.col.tools":"Tools","usage.col.total":"Total","usage.columns.button":"Columns","usage.columns.title":"Visible columns","usage.columns.reset":"Reset","usage.breakdown.title":"Token breakdown","usage.breakdown.headerTokens":"Tokens","usage.breakdown.headerCost":"Cost","usage.breakdown.total":"Total","usage.breakdown.reasoning":"reasoning","usage.breakdown.reasoningNote":"incl. above","filter.modelLabel":"Model","filter.projectLabel":"Project","filter.modelAll":"Model: All","filter.projectAll":"Project: All","filter.modelSingle":"Model: {value}","filter.projectSingle":"Project: {value}","filter.modelMulti":"Model: {count}","filter.projectMulti":"Project: {count}","filter.clearAll":"Clear all","filter.noOptions":"No options","sessions.title":"Sessions","sessions.subtitle":"{count} sessions \xb7 sorted by most recent activity","sessions.col.session":"Session","sessions.col.project":"Project","sessions.col.models":"Model(s)","sessions.col.requests":"Requests","sessions.col.tokens":"Tokens","sessions.col.cost":"Cost","sessions.col.duration":"Duration","sessions.col.lastActivity":"Last activity","sessions.untitled":"Session {hash}","sessions.empty":"No sessions yet","session.kpi.requests":"Requests","session.kpi.totalTokens":"Total tokens","session.kpi.cost":"Cost","session.kpi.duration":"Duration","session.timeline.title":"Message timeline","session.timeline.desc":"In order; newest at the bottom","session.perMessage.title":"Per-message tokens","session.modelsInSession":"Models in this session","session.modelLine":"{requests} req \xb7 {tokens} tokens","session.token.in":"in","session.token.out":"out","session.token.cacheR":"cache r","session.token.cacheW":"cache w","projects.title":"Projects","projects.subtitle":"{count} projects \xb7 sorted by spend","projects.empty":"No projects yet","projects.stat.sessions":"Sessions","projects.stat.requests":"Requests","projects.stat.tokens":"Tokens","project.activity":"Activity (last 30 days)","project.sessions.title":"Sessions ({count})","models.title":"Models","models.subtitle":"{count} model(s) used in total","models.empty":"No model usage yet","models.share.cost":"Cost share","models.share.tokens":"Tokens share","models.share.cacheHit":"Cache hit","models.field.requests":"Requests","models.field.savedByCache":"Saved by cache","models.field.input1M":"Input / 1M","models.field.output1M":"Output / 1M","models.field.cacheRead1M":"Cache read / 1M","models.field.pctOfTotal":"{pct} of total spend \xb7 {tokens} tokens","models.eachTrend":"Combined trend (last 30 days)","settings.title":"Settings","settings.subtitle":"Data sources, pricing, and behavior","settings.dataSources.title":"Data sources","settings.dataSources.desc":"ccgauge scans these locations for JSONL files","settings.dataSources.active":"active","settings.dataSources.notPresent":"not present","settings.dataSources.envHint":"Override with {env1} or {env2} environment variables (the dashboard appends {appendix}).","settings.rescan":"Rescan now","settings.rescanning":"Rescanning…","settings.scanStats.title":"Scan stats","settings.scanStats.files":"Files scanned","settings.scanStats.records":"Records parsed","settings.scanStats.assistant":"Assistant records (deduped)","settings.scanStats.duration":"Scan duration","settings.pricing.title":"Pricing table","settings.pricing.desc":"USD per 1M tokens \xb7 built-in snapshot, fuzzy match for date-suffixed model names","settings.pricing.col.model":"Model","settings.pricing.col.input":"Input","settings.pricing.col.output":"Output","settings.pricing.col.write5m":"Cache write 5m","settings.pricing.col.write1h":"Cache write 1h","settings.pricing.col.read":"Cache read","settings.preferences.title":"Preferences","settings.preferences.language":"Language","settings.preferences.theme":"Theme","settings.theme.light":"Light","settings.theme.dark":"Dark","settings.theme.system":"System","settings.about.title":"About","settings.about.subtitle":"Version {version} \xb7 MIT licensed","settings.about.line1":"Fully local: data never leaves your machine; no telemetry, no network calls.","settings.about.line2":"Read-only: ccgauge only reads JSONL files, never writes back to ~/.claude.","settings.about.line3":'Cache: scan results are memoized for 5s; click "Rescan" to force a fresh read.',"settings.about.line4":"Stop with Ctrl+C in the terminal that started ccgauge.","settings.indexer.desc":"Background indexer keeps the cache fresh via file watchers.","settings.indexer.lastIndexedAt":"Last indexed","settings.indexer.indexDuration":"Last index time","settings.indexer.watchers":"Active watchers","settings.indexer.loadedFromDisk":"Loaded from disk","settings.indexer.status":"Status","settings.indexer.indexing":"indexing…","settings.indexer.idle":"idle","settings.indexer.recentErrors":"Recent indexer errors","common.yes":"yes","common.no":"no","lang.label":"Language","lang.en":"English","lang.zh":"中文","theme.label":"Theme"},zh:{"brand.tagline":"AI 编程 CLI 的本地用量看板","nav.overview":"概览","nav.usage":"用量","nav.sessions":"会话","nav.projects":"项目","nav.models":"模型","nav.settings":"设置","nav.docs":"文档","nav.localBadge":"本地","nav.source":"数据源","source.claude":"Claude","source.codex":"Codex","source.all":"全部","cost.footnote.codex":"按 OpenAI API 单价折算估值(订阅计划实际计费不同)","common.requests":"次请求","common.tokens":"tokens","common.cost":"花费","common.savedViaCache":"通过缓存节省 {amount}","common.savedTodayViaCache":"今日缓存节省 {amount}","common.live":"进行中","common.allModels":"全部","common.allProjects":"全部","common.unknown":"(未知)","common.session":"会话","common.sessions":"个会话","common.projects":"个项目","common.req":"请求","common.day":"天","common.days":"天","common.activity":"活跃","common.fallbackPrice":"使用兜底单价","common.thinking":"思考","common.lastActivity":"最近活跃","common.empty.title":"暂无用量数据","common.empty.desc":"打开 Claude Code 发送一条消息后刷新本页。","common.refresh":"刷新","common.search":"搜索…","common.searchPlaceholder":"搜索模型 / 项目 / 会话 / 工具…","common.exportCsv":"导出 CSV","common.rows":"{count} 行","common.prev":"‹ 上一页","common.next":"下一页 ›","common.first":"\xab","common.last":"\xbb","common.pageOf":"第 {page} / {total} 页","common.allSessions":"← 返回会话列表","common.allProjectsLink":"← 返回项目列表","common.noMatchingRows":"没有匹配的记录","range.label":"时间范围","range.today":"今天","range.7d":"7 天","range.30d":"30 天","range.90d":"90 天","range.all":"全部","range.custom":"自定义","range.customApply":"应用","range.from":"开始","range.to":"结束","range.cancel":"取消","gran.label":"粒度","gran.hour":"小时","gran.day":"天","gran.week":"周","gran.month":"月","overview.title":"概览","overview.subtitle":"{count} 次请求,覆盖 {files} 个文件 \xb7 扫描耗时 {ms}ms","overview.subtitle.empty":"已扫描 {dirs} 个目录。打开 Claude Code 发一条消息后刷新本页。","overview.empty.title":"暂无用量数据","overview.kpi.tokensToday":"今日 tokens","overview.kpi.costToday":"今日花费","overview.kpi.thisMonth":"本月累计","overview.kpi.cacheHit":"缓存命中率","overview.kpi.topModel":"主力模型","overview.kpi.activeSessions":"今日会话","overview.kpi.activeSessions.hint":"涉及 {count} 个项目","overview.kpi.thisMonth.hint":"{tokens} tokens \xb7 {req} 次请求","overview.kpi.tokensToday.hint":"{count} 次请求","overview.kpi.topModel.hint":"本月成本占比 {pct}","overview.kpi.cacheHit.hint":"今日缓存节省 {amount}","overview.delta.title":"相比昨日","overview.delta.firstTime":"首次","common.loading":"加载中…","common.error.title":"出错了","common.error.desc":"加载失败,请重试。","common.error.retry":"重试","overview.trend.title":"用量趋势","overview.trend.desc":"近 30 天 \xb7 {metric}","overview.trend.desc.tokens":"按 token 类型堆叠","overview.trend.desc.conversations":"每日对话次数","overview.trend.metric.tokens":"Token","overview.trend.metric.conversations":"对话次数","overview.trend.activeDays":"{n} 天有数据","overview.trend.activeDays.plural":"{n} 天有数据","overview.costByModel.title":"按模型成本分布","overview.costByModel.desc":"本月,按花费排序","activity.title":"活动统计","activity.subtitle":"总览数据 + 每天什么时段最忙","activity.sessions":"会话","activity.messages":"消息","activity.totalTokens":"总 tokens","activity.activeDays":"活跃天数","activity.currentStreak":"当前连续","activity.longestStreak":"最长连续","activity.streakCombinedLabel":"当前 / 最长连续","activity.streakCombinedValue":"{current} / {longest} 天","activity.peakHour":"高峰小时","activity.favoriteModel":"最常用模型","activity.streakValue":"{n} 天","activity.dow.0":"周日","activity.dow.1":"周一","activity.dow.2":"周二","activity.dow.3":"周三","activity.dow.4":"周四","activity.dow.5":"周五","activity.dow.6":"周六","activity.heatmap.tooltip":"周{dow} \xb7 {hour} \xb7 {count} 条消息","activity.heatmap.messages":"消息数","activity.heatmap.tokens":"Tokens","activity.heatmap.shareLabel":"占总数","activity.heatmap.intensityLabel":"占峰值","activity.heatmap.empty":"无活动","activity.comparison":"你用掉的 token 大约是 {ref} 的 {multiplier}\xd7。","activity.ref.haiku":"一首俳句","activity.ref.tweet":"一条推文","activity.ref.littlePrince":"《小王子》","activity.ref.gatsby":"《了不起的盖茨比》","activity.ref.hobbit":"《霍比特人》","activity.ref.lotrTrilogy":"《魔戒》三部曲","activity.ref.warAndPeace":"《战争与和平》","activity.ref.harryPotterAll":"《哈利\xb7波特》全 7 册","activity.ref.encyclopediaBritannica":"《大英百科全书》","activity.ref.wikipediaEn":"英文维基百科全部","block.title":"当前 5h block","block.remaining":"剩余","block.elapsed":"时间进度 {pct}%","block.tokensSuffix":"tokens","block.spentSoFar":"已花费","block.burnPerMin":"每分钟消耗","block.projectedTotal":"预计总花费","block.requests":"请求数","block.empty":"当前无活跃 block","block.emptyDesc":"在 {cli} 中发送消息会启动一个新 block。","block.disclaimer":"仅是 5h 窗口的钟表进度,不是你的套餐配额。","chart.legend.input":"输入","chart.legend.output":"输出","chart.legend.cacheRead":"缓存读取","chart.legend.cacheWrite":"缓存写入","chart.tooltip.total":"合计","chart.tooltip.cost":"花费","chart.tooltip.requests":"请求数","chart.tooltip.conversations":"对话次数","chart.empty":"区间内无数据","chart.empty.short":"暂无数据","usage.title":"用量明细","usage.subtitle":"当前筛选范围内 {count} 轮对话","usage.kpi.totalTokens":"总 tokens","usage.kpi.totalCost":"总花费","usage.kpi.cacheSaved":"缓存节省","usage.kpi.cacheHit":"缓存命中","usage.trend":"趋势","usage.trend.gran":"粒度:{gran}","usage.requests.title":"对话轮次","usage.requests.desc":"每轮对话一行(用户消息 + 工具调用),点击 ▸ 展开明细","usage.col.calls":"调用","usage.col.userMessage":"提示","usage.overview.label":"概览","usage.overview.show":"显示概览(KPI + 趋势)","usage.overview.hide":"隐藏概览(KPI + 趋势)","usage.turn.expand":"展开","usage.turn.collapse":"收起","usage.turn.callsCount":"{count} 次调用","usage.turn.noPrompt":"(无用户文本)","usage.col.time":"时间","usage.col.duration":"耗时","usage.col.model":"模型","usage.col.project":"项目","usage.col.session":"会话","usage.col.input":"输入","usage.col.output":"输出","usage.col.cacheRead":"缓存读","usage.col.cacheWrite":"缓存写","usage.col.cost":"花费","usage.col.tools":"工具","usage.col.total":"总量","usage.columns.button":"列","usage.columns.title":"显示列","usage.columns.reset":"重置","usage.breakdown.title":"总量明细","usage.breakdown.headerTokens":"Token","usage.breakdown.headerCost":"花费","usage.breakdown.total":"合计","usage.breakdown.reasoning":"其中推理","usage.breakdown.reasoningNote":"已含在 output","filter.modelLabel":"模型","filter.projectLabel":"项目","filter.modelAll":"模型:全部","filter.projectAll":"项目:全部","filter.modelSingle":"模型:{value}","filter.projectSingle":"项目:{value}","filter.modelMulti":"模型:{count} 个","filter.projectMulti":"项目:{count} 个","filter.clearAll":"清除筛选","filter.noOptions":"没有可选项","sessions.title":"会话","sessions.subtitle":"共 {count} 个会话 \xb7 按最近活跃排序","sessions.col.session":"会话","sessions.col.project":"项目","sessions.col.models":"模型","sessions.col.requests":"请求数","sessions.col.tokens":"Tokens","sessions.col.cost":"花费","sessions.col.duration":"时长","sessions.col.lastActivity":"最近活跃","sessions.untitled":"会话 {hash}","sessions.empty":"暂无会话","session.kpi.requests":"请求数","session.kpi.totalTokens":"总 tokens","session.kpi.cost":"花费","session.kpi.duration":"时长","session.timeline.title":"消息时间线","session.timeline.desc":"按时间正序,最新的在最下方","session.perMessage.title":"逐条消息 tokens","session.modelsInSession":"本会话使用的模型","session.modelLine":"{requests} 次 \xb7 {tokens} tokens","session.token.in":"输入","session.token.out":"输出","session.token.cacheR":"缓存读","session.token.cacheW":"缓存写","projects.title":"项目","projects.subtitle":"共 {count} 个项目 \xb7 按花费排序","projects.empty":"暂无项目","projects.stat.sessions":"会话","projects.stat.requests":"请求","projects.stat.tokens":"Tokens","project.activity":"活跃情况(近 30 天)","project.sessions.title":"会话({count})","models.title":"模型","models.subtitle":"共使用过 {count} 个模型","models.empty":"暂无模型用量","models.share.cost":"成本占比","models.share.tokens":"Tokens 占比","models.share.cacheHit":"缓存命中","models.field.requests":"请求数","models.field.savedByCache":"缓存节省","models.field.input1M":"输入 / 1M","models.field.output1M":"输出 / 1M","models.field.cacheRead1M":"缓存读 / 1M","models.field.pctOfTotal":"占总花费 {pct} \xb7 {tokens} tokens","models.eachTrend":"整体趋势(近 30 天)","settings.title":"设置","settings.subtitle":"数据源、价格表与行为偏好","settings.dataSources.title":"数据源","settings.dataSources.desc":"ccgauge 会扫描以下路径的 JSONL 文件","settings.dataSources.active":"已启用","settings.dataSources.notPresent":"不存在","settings.dataSources.envHint":"可以通过环境变量 {env1} 或 {env2} 自定义路径(看板会自动追加 {appendix})。","settings.rescan":"立即重新扫描","settings.rescanning":"扫描中…","settings.scanStats.title":"扫描统计","settings.scanStats.files":"扫描文件数","settings.scanStats.records":"解析记录数","settings.scanStats.assistant":"去重后 assistant 记录","settings.scanStats.duration":"扫描耗时","settings.pricing.title":"价格表","settings.pricing.desc":"美元 / 1M tokens \xb7 内置快照,对带日期后缀的模型名做 fuzzy 匹配","settings.pricing.col.model":"模型","settings.pricing.col.input":"输入","settings.pricing.col.output":"输出","settings.pricing.col.write5m":"缓存写入 5 分钟","settings.pricing.col.write1h":"缓存写入 1 小时","settings.pricing.col.read":"缓存读取","settings.preferences.title":"偏好设置","settings.preferences.language":"语言","settings.preferences.theme":"主题","settings.theme.light":"亮色","settings.theme.dark":"暗色","settings.theme.system":"跟随系统","settings.about.title":"关于","settings.about.subtitle":"版本 {version} \xb7 MIT 协议","settings.about.line1":"完全本地:数据从不离开你的机器,没有任何遥测、没有任何网络调用。","settings.about.line2":"只读:ccgauge 只读取 JSONL,绝不会写回 ~/.claude。","settings.about.line3":'缓存:扫描结果会缓存 5 秒;点击"重新扫描"可强制刷新。',"settings.about.line4":"在启动 ccgauge 的终端按 Ctrl+C 即可停止。","settings.indexer.desc":"后台 indexer 通过文件监听增量维护缓存。","settings.indexer.lastIndexedAt":"最近索引时间","settings.indexer.indexDuration":"最近索引耗时","settings.indexer.watchers":"活跃 watcher 数","settings.indexer.loadedFromDisk":"从磁盘恢复","settings.indexer.status":"状态","settings.indexer.indexing":"索引中…","settings.indexer.idle":"空闲","settings.indexer.recentErrors":"最近的索引错误","common.yes":"是","common.no":"否","lang.label":"语言","lang.en":"English","lang.zh":"中文","theme.label":"主题"}};function a(e,t,s){var o;let i=null==(o=n[e])?void 0:o[t];if(void 0===i&&(i=n.en[t]),void 0===i&&(i=t),s)for(let[e,t]of Object.entries(s))i=i.replace(RegExp("\\{".concat(e,"\\}"),"g"),String(t));return i}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{12112:(e,t,r)=>{"use strict";r.d(t,{Providers:()=>s});var n=r(95155),i=r(51148),a=r(84479);function s(e){let{locale:t,theme:r,children:s}=e;return(0,n.jsx)(i.CY,{initialLocale:t,children:(0,n.jsx)(a.N,{initialTheme:r,children:s})})}},21264:(e,t,r)=>{"use strict";r.d(t,{LanguageSwitcher:()=>c});var n=r(95155),i=r(51148),a=r(79808);let s={en:"EN",zh:"中"},o={en:"English",zh:"中文"};function c(){let{locale:e,setLocale:t,t:r}=(0,i.s9)();return(0,n.jsx)("div",{role:"group",className:"inline-flex items-center rounded-md border border-border bg-bg-surface p-0.5 text-xs",title:r("lang.label"),"aria-label":r("lang.label"),children:a.YZ.map(r=>{let i=r===e;return(0,n.jsx)("button",{type:"button",onClick:()=>{i||t(r)},className:"px-2 py-1 rounded transition-colors ".concat(i?"bg-brand-strong text-white font-semibold":"text-text-tertiary hover:text-text-primary hover:bg-bg-surface-hi"),title:o[r],"aria-pressed":i,children:s[r]},r)})})}},25016:(e,t,r)=>{"use strict";r.d(t,{BC:()=>m,P6:()=>f,PJ:()=>x,R8:()=>d,a3:()=>h,az:()=>c,cn:()=>a,jh:()=>o,l7:()=>l,r6:()=>u});var n=r(2821),i=r(75889);function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,i.QP)((0,n.$)(t))}function s(e,t){var r;return new Intl.NumberFormat("en-US",{maximumFractionDigits:null!=(r=null==t?void 0:t.maxFrac)?r:0}).format(e)}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en";return Number.isFinite(e)?"zh"===t?e>=1e8?(e/1e8).toFixed(2)+"亿":e>=1e4?(e/1e4).toFixed(1)+"万":s(e):e>=1e9?(e/1e9).toFixed(2)+"B":e>=1e6?(e/1e6).toFixed(2)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":s(e):"0"}function c(e,t){var r,n;return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:null!=(r=null==t?void 0:t.minFrac)?r:2,maximumFractionDigits:null!=(n=null==t?void 0:t.maxFrac)?n:2}).format(e)}function l(e){return 0===e?"$0":e<.01?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:6}).format(e):c(e)}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Number.isFinite(e)?"".concat((100*e).toFixed(t),"%"):"0%"}function h(e){if(e<1e3)return"".concat(e,"ms");let t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");let r=Math.floor(t/60);if(r<60){let e=t%60;return e?"".concat(r,"m ").concat(e,"s"):"".concat(r,"m")}let n=Math.floor(r/60),i=r%60;return i?"".concat(n,"h ").concat(i,"m"):"".concat(n,"h")}function u(e){let t="string"==typeof e||"number"==typeof e?new Date(e):e;if(Number.isNaN(t.getTime()))return"";let r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),a=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0");return"".concat(r,"-").concat(n,"-").concat(i," ").concat(a,":").concat(s,":").concat(o)}function x(e){if(!e)return"(unknown)";let t=e.replace(/[/\\]+$/,"").split(/[/\\]+/);return t[t.length-1]||e}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e?e.replace(/-/g,"").slice(0,t):""}let g={mini:"Mini",nano:"Nano",pro:"Pro",turbo:"Turbo",preview:"Preview"};function f(e){if(!e)return"(unknown)";let t=e.replace(/^(vertex_ai|bedrock|anthropic|openai)\//,""),r=t.toLowerCase();if(r.startsWith("gpt-")||/^o\d/.test(r))return r.startsWith("gpt-")?"GPT-"+t.slice(4).split("-").map(e=>{var t;return null!=(t=g[e.toLowerCase()])?t:e}).join(" "):t.toUpperCase();let n=t.replace(/-(\d{8})$/,""),i=(n=n.replace(/^claude-/,"")).split("-");if(i.length>=2){let e=i[0],t=i.slice(1).join(".");return p(e)+" "+t}return p(n.replace(/-/g," "))}function p(e){return e.replace(/\b\w/g,e=>e.toUpperCase())}},41290:()=>{},44703:(e,t,r)=>{"use strict";r.d(t,{ThemeSwitcher:()=>o});var n=r(95155),i=r(84479),a=r(51148);let s={light:"dark",dark:"system",system:"light"};function o(){let{theme:e,resolved:t,setTheme:r}=(0,i.D)(),{t:o}=(0,a.s9)(),l=s[e];return(0,n.jsx)("button",{onClick:()=>r(l),className:"h-7 w-9 inline-flex items-center justify-center rounded-md border border-border bg-bg-surface text-text-secondary hover:text-text-primary hover:bg-bg-surface-hi hover:border-border-hi transition-colors",title:"".concat(o("theme.label"),": ").concat(o("settings.theme.".concat(e))," (").concat(t,") → ").concat(o("settings.theme.".concat(l))),"aria-label":o("theme.label"),children:(0,n.jsx)(c,{theme:e})})}function c(e){let{theme:t}=e;return"light"===t?(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,n.jsx)("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}):"dark"===t?(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:(0,n.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,n.jsx)("path",{d:"M12 3v18"}),(0,n.jsx)("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]})}},57581:(e,t,r)=>{"use strict";r.d(t,{Nav:()=>v});var n=r(95155),i=r(52619),a=r.n(i),s=r(20063),o=r(25016),c=r(51148),l=r(76669),d=r(63847),h=r(21264),u=r(44703);function x(e){let{className:t,withBackground:r=!0}=e,i=r?"#FFFFFF":"currentColor",a=r?"#FFFFFF":"currentColor",s=r?"#FFFFFF":"currentColor";return(0,n.jsxs)("svg",{viewBox:"0 0 64 64",fill:"none","aria-hidden":!0,className:(0,o.cn)("block",!r&&"text-brand",t),children:[r&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("rect",{x:"3",y:"3",width:"58",height:"58",rx:"16",fill:"rgb(var(--brand-strong))"}),(0,n.jsx)("rect",{x:"3.75",y:"3.75",width:"56.5",height:"56.5",rx:"15.25",stroke:"#FFFFFF",strokeOpacity:"0.18",strokeWidth:"1.5"})]}),(0,n.jsx)("path",{d:"M15 39.5 A17 17 0 0 1 49 39.5",stroke:i,strokeOpacity:r?.24:.22,strokeWidth:"5",strokeLinecap:"round"}),(0,n.jsx)("path",{d:"M20.8 39.5 A11.2 11.2 0 0 1 43.2 39.5",stroke:i,strokeOpacity:r?.2:.18,strokeWidth:"1.8",strokeLinecap:"round"}),(0,n.jsx)("path",{d:"M15 39.5 A17 17 0 0 1 42.8 26",stroke:a,strokeWidth:"5",strokeLinecap:"round"}),(0,n.jsxs)("g",{stroke:i,strokeLinecap:"round",strokeWidth:"2",strokeOpacity:r?.54:.34,children:[(0,n.jsx)("path",{d:"M18.1 34.2 L15 32.4"}),(0,n.jsx)("path",{d:"M24 28.5 L22.3 25.5"}),(0,n.jsx)("path",{d:"M32 26.2 L32 22.8"}),(0,n.jsx)("path",{d:"M40 28.5 L41.7 25.5"}),(0,n.jsx)("path",{d:"M45.9 34.2 L49 32.4"})]}),(0,n.jsx)("path",{d:"M32 39.5 L42.8 26",stroke:s,strokeWidth:"3.4",strokeLinecap:"round"}),(0,n.jsx)("circle",{cx:"32",cy:"39.5",r:"4.8",fill:r?"#FFFFFF":"currentColor"}),r&&(0,n.jsx)("circle",{cx:"32",cy:"39.5",r:"2",fill:"#4F46E5"}),(0,n.jsxs)("g",{opacity:r?1:.68,children:[(0,n.jsx)("rect",{x:"17",y:"46",width:"7",height:"5",rx:"2",fill:r?"#34D399":"currentColor"}),(0,n.jsx)("rect",{x:"28.5",y:"43",width:"7",height:"8",rx:"2",fill:r?"#FBBF24":"currentColor"}),(0,n.jsx)("rect",{x:"40",y:"45",width:"7",height:"6",rx:"2",fill:r?"#93C5FD":"currentColor"})]})]})}var m=r(12115);function g(e){let{available:t,initial:r,providers:i}=e,a=(0,s.useRouter)(),o=(0,s.usePathname)(),l=(0,s.useSearchParams)(),d=(0,c.kj)(),{locale:h}=(0,c.s9)(),[u,x]=(0,m.useTransition)(),g=l.get("source"),b=g&&("all"===g?t.length>=2:t.includes(g))?g:null,[v,j]=(0,m.useState)(null!=b?b:r);if((0,m.useEffect)(()=>{b&&b!==v&&j(b)},[b,v]),t.length<2)return null;let k=e=>{var t;if(e===v)return;j(e),t=e,"undefined"!=typeof document&&(document.cookie="".concat("ccgauge_source","=").concat(encodeURIComponent(t),"; path=/; max-age=").concat(31536e3,"; SameSite=Lax"));let r=new URLSearchParams(l.toString());r.set("source",e);let n=/^\/sessions\/[^/]+|^\/projects\/[^/]+/.test(o)?"/".concat(o.split("/")[1],"?").concat(r.toString()):"".concat(o,"?").concat(r.toString());x(()=>{a.push(n)})},w=i.filter(e=>t.includes(e.id));return(0,n.jsxs)("div",{role:"group","aria-label":d("nav.source"),className:"inline-flex items-center rounded-md border border-border bg-bg-surface p-0.5 gap-0.5",title:d("nav.source"),children:[(0,n.jsx)(p,{active:"all"===v,label:d("source.all"),onSelect:()=>k("all"),disabled:u,providers:w}),w.map(e=>{let t=e.id===v,r="zh"===h?e.displayZh:e.displayEn;return(0,n.jsxs)("button",{type:"button",onClick:()=>k(e.id),"aria-pressed":t,disabled:u,className:"px-2.5 h-6 text-xs font-medium inline-flex items-center gap-1.5 rounded transition-colors ".concat(t?"bg-brand-strong text-white shadow-sm":"text-text-tertiary hover:text-text-primary hover:bg-bg-surface-hi"),children:[(0,n.jsx)(f,{provider:e}),(0,n.jsx)("span",{children:r})]},e.id)})]})}function f(e){let{provider:t}=e;return t.logoSrc?(0,n.jsx)("img",{src:t.logoSrc,alt:"","aria-hidden":!0,className:"w-4 h-4 rounded-[3px] object-contain shrink-0"}):(0,n.jsx)("span",{className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-full text-[9px] font-bold leading-none",style:{background:t.bg,color:t.fg},children:t.shortLabel})}function p(e){let{active:t,label:r,onSelect:i,disabled:a,providers:s}=e;return(0,n.jsxs)("button",{type:"button",onClick:i,"aria-pressed":t,disabled:a,className:"px-2.5 h-6 text-xs font-medium inline-flex items-center gap-1.5 rounded transition-colors ".concat(t?"bg-brand-strong text-white shadow-sm":"text-text-tertiary hover:text-text-primary hover:bg-bg-surface-hi"),children:[(0,n.jsx)("span",{className:"relative inline-flex items-center w-[26px] h-4 shrink-0","aria-hidden":!0,children:s.slice(0,2).map((e,t)=>{let r=10*(0!==t);return e.logoSrc?(0,n.jsx)("img",{src:e.logoSrc,alt:"",className:"absolute w-4 h-4 rounded-[3px] object-contain",style:{left:r,zIndex:s.length-t}},e.id):(0,n.jsx)("span",{className:"absolute inline-flex items-center justify-center w-3.5 h-3.5 rounded-full text-[9px] font-bold leading-none",style:{background:e.bg,color:e.fg,left:r,zIndex:s.length-t},children:e.shortLabel},e.id)})}),(0,n.jsx)("span",{children:r})]})}let b=[{href:"/",tk:"nav.overview",exact:!0},{href:"/usage",tk:"nav.usage"},{href:"/sessions",tk:"nav.sessions"},{href:"/projects",tk:"nav.projects"},{href:"/models",tk:"nav.models"},{href:"/settings",tk:"nav.settings"}];function v(e){var t;let{availableProviders:r,initialSource:i,providerInfos:m}=e,f=(0,s.usePathname)(),{t:p,locale:v}=(0,c.s9)(),j=b.find(e=>e.exact?f===e.href:f===e.href||f.startsWith(e.href+"/")),k=null!=(t=null==j?void 0:j.href)?t:"",{containerRef:w,rect:y}=(0,l.S)(k);return(0,n.jsx)("header",{className:"sticky top-0 z-30 border-b border-border bg-bg-base/85 backdrop-blur-md supports-[backdrop-filter]:bg-bg-base/70",children:(0,n.jsxs)("div",{className:"max-w-7xl mx-auto px-3 sm:px-6 h-14 flex items-center gap-2 sm:gap-4",children:[(0,n.jsxs)(a(),{href:"/",className:"flex items-center gap-2 font-semibold tracking-tight whitespace-nowrap shrink-0 text-text-primary hover:opacity-90 transition-opacity","aria-label":"ccgauge home",children:[(0,n.jsx)(x,{className:"w-7 h-7"}),(0,n.jsx)("span",{className:"hidden xs:inline sm:inline",children:"ccgauge"})]}),(0,n.jsxs)("nav",{ref:w,className:"relative flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto nav-scroller","aria-label":"Primary",children:[(0,n.jsx)(d.j,{rect:y,variant:"underline"}),b.map(e=>{let t=e.exact?f===e.href:f===e.href||f.startsWith(e.href+"/");return(0,n.jsx)(a(),{href:e.href,prefetch:!1,"data-tab":e.href,"aria-current":t?"page":void 0,className:(0,o.cn)("relative px-2.5 sm:px-3 py-1.5 text-sm rounded-button font-medium whitespace-nowrap shrink-0","transition-colors duration-150",t?"text-text-primary":"text-text-secondary hover:text-text-primary hover:bg-bg-surface-hi/60"),children:p(e.tk)},e.href)}),(0,n.jsxs)("a",{href:"zh"===v?"https://chengzuopeng.github.io/ccgauge/zh/":"https://chengzuopeng.github.io/ccgauge/",target:"_blank",rel:"noopener noreferrer",className:(0,o.cn)("relative inline-flex items-center gap-1 px-2.5 sm:px-3 py-1.5 text-sm rounded-button font-medium whitespace-nowrap shrink-0","transition-colors duration-150","text-text-secondary hover:text-text-primary hover:bg-bg-surface-hi/60"),children:[p("nav.docs"),(0,n.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"opacity-70",children:[(0,n.jsx)("path",{d:"M7 17 17 7"}),(0,n.jsx)("path",{d:"M8 7h9v9"})]})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,n.jsx)(g,{available:r,initial:i,providers:m}),(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(h.LanguageSwitcher,{}),(0,n.jsx)(u.ThemeSwitcher,{}),(0,n.jsx)("a",{href:"https://github.com/chengzuopeng/ccgauge",target:"_blank",rel:"noopener noreferrer",className:"h-7 w-9 inline-flex items-center justify-center rounded-md border border-border bg-bg-surface text-text-secondary hover:text-text-primary hover:bg-bg-surface-hi hover:border-border-hi transition-colors",title:"GitHub","aria-label":"GitHub",children:(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:(0,n.jsx)("path",{d:"M12 .5C5.65.5.5 5.65.5 12c0 5.09 3.29 9.4 7.86 10.93.58.1.79-.25.79-.55v-2.1c-3.2.7-3.87-1.36-3.87-1.36-.52-1.33-1.27-1.69-1.27-1.69-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.18 1.76 1.18 1.02 1.75 2.68 1.25 3.34.96.1-.74.4-1.25.73-1.54-2.55-.29-5.23-1.28-5.23-5.69 0-1.26.45-2.29 1.18-3.1-.12-.29-.51-1.45.11-3.03 0 0 .96-.31 3.15 1.18a10.94 10.94 0 0 1 5.74 0c2.19-1.49 3.15-1.18 3.15-1.18.63 1.58.24 2.74.12 3.03.73.81 1.18 1.84 1.18 3.1 0 4.43-2.69 5.4-5.25 5.68.41.36.78 1.06.78 2.14v3.18c0 .31.21.66.8.55A11.5 11.5 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z"})})})]})]})]})})}},63847:(e,t,r)=>{"use strict";r.d(t,{j:()=>a});var n=r(95155),i=r(25016);function a(e){let{rect:t,variant:r="pill",className:a}=e;if(!t)return null;let s=8*("underline"===r);return(0,n.jsx)("span",{"aria-hidden":!0,className:(0,i.cn)("pointer-events-none absolute transition-[transform,width] duration-200 ease-out-soft","pill"===r?"inset-y-0 rounded bg-brand-strong shadow-sm":"-bottom-[12px] h-[2px] rounded-full bg-brand",a),style:{transform:"translateX(".concat(t.left+s,"px)"),width:Math.max(0,t.width-2*s)}})}},76669:(e,t,r)=>{"use strict";r.d(t,{S:()=>a});var n=r(12115);let i=n.useLayoutEffect;function a(e){let t=(0,n.useRef)(null),[r,a]=(0,n.useState)(null),s=(0,n.useCallback)(()=>{let r=t.current;if(!r)return;let n=r.querySelector('[data-tab="'.concat(e,'"]'));if(!n)return void a(null);a(e=>{let t={left:n.offsetLeft,width:n.offsetWidth};return e&&e.left===t.left&&e.width===t.width?e:t})},[e]);return i(()=>{s()},[s]),(0,n.useEffect)(()=>{let e=t.current;if(!e||"undefined"==typeof ResizeObserver)return;let r=new ResizeObserver(()=>s());for(let t of(r.observe(e),Array.from(e.children)))r.observe(t);return window.addEventListener("resize",s),()=>{r.disconnect(),window.removeEventListener("resize",s)}},[s]),{containerRef:t,rect:r}}},79076:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,41290,23)),Promise.resolve().then(r.bind(r,57581)),Promise.resolve().then(r.bind(r,12112))},84479:(e,t,r)=>{"use strict";r.d(t,{N:()=>d,D:()=>h});var n=r(95155),i=r(12115);let a="ccgauge_theme",s=(0,i.createContext)({theme:"dark",resolved:"dark",setTheme:()=>{}}),o="ccgauge.theme";function c(e){return"light"===e?"light":"dark"===e?"dark":window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function l(e){if("undefined"==typeof document)return;let t=document.documentElement,r=c(e);t.classList.remove("theme-light","theme-dark"),t.classList.add("light"===r?"theme-light":"theme-dark"),t.setAttribute("data-theme",r)}function d(e){let{initialTheme:t,children:r}=e,[d,h]=(0,i.useState)(t),[u,x]=(0,i.useState)(()=>"system"===t?"dark":t);(0,i.useEffect)(()=>{try{let e=localStorage.getItem(o);if("light"===e||"dark"===e||"system"===e){e!==t&&(document.cookie="".concat(a,"=").concat(e,"; path=/; max-age=").concat(31536e3,"; SameSite=Lax")),h(e);let r=c(e);x(r),l(e)}else{let e=c(t);x(e),l(t)}}catch(e){x(c(t)),l(t)}},[]),(0,i.useEffect)(()=>{if("system"!==d)return;let e=window.matchMedia("(prefers-color-scheme: light)"),t=()=>{x(e.matches?"light":"dark"),l("system")};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[d]);let m=(0,i.useCallback)(e=>{try{localStorage.setItem(o,e)}catch(e){}document.cookie="".concat(a,"=").concat(e,"; path=/; max-age=").concat(31536e3,"; SameSite=Lax"),h(e),x(c(e)),l(e)},[]);return(0,n.jsx)(s.Provider,{value:{theme:d,resolved:u,setTheme:m},children:r})}function h(){return(0,i.useContext)(s)}}},e=>{e.O(0,[410,760,619,148,441,255,358],()=>e(e.s=79076)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{7331:(e,t,a)=>{"use strict";a.d(t,{wn:()=>n});var r=a(95155),s=a(25016);function n(e){let{title:t,desc:a,right:n,children:i,className:l,inlineDesc:c,fillBody:o}=e;return(0,r.jsxs)("section",{className:(0,s.cn)("card overflow-hidden",o&&"flex flex-col",l),children:[(t||n)&&(0,r.jsxs)("header",{className:(0,s.cn)("section-header","flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4","px-5 sm:px-6 pt-4 sm:pt-5 pb-3 border-b border-border"),children:[(0,r.jsxs)("div",{className:(0,s.cn)("min-w-0",c&&"sm:flex sm:items-baseline sm:gap-2.5"),children:[t&&(0,r.jsx)("h2",{className:"text-[15px] font-semibold text-text-primary tracking-tight leading-tight",children:t}),a&&(0,r.jsx)("p",{className:(0,s.cn)("text-xs text-text-secondary leading-relaxed",c?"mt-1 sm:mt-0":"mt-1.5"),children:a})]}),n&&(0,r.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:n})]}),(0,r.jsx)("div",{className:(0,s.cn)("p-5 sm:p-6",o&&"flex-1 flex flex-col"),children:i})]})}},8608:(e,t,a)=>{"use strict";a.d(t,{ModelBarChart:()=>l});var r=a(95155),s=a(25016),n=a(51148);let i={opus:"rgb(var(--chart-output))",sonnet:"rgb(var(--chart-input))",haiku:"rgb(var(--chart-cache-read))"};function l(e){let{models:t}=e,a=(0,n.kj)(),{locale:l}=(0,n.s9)();if(!t.length)return(0,r.jsx)("div",{className:"text-sm text-text-tertiary",children:a("chart.empty")});let c=Math.max(...t.map(e=>e.cost),1e-4),o=t.reduce((e,t)=>e+t.cost,0);return(0,r.jsx)("div",{className:"space-y-3.5",children:t.map(e=>{let t=o>0?e.cost/o:0;return(0,r.jsxs)("div",{className:"space-y-1.5 group",children:[(0,r.jsxs)("div",{className:"flex items-baseline justify-between gap-3 text-sm",children:[(0,r.jsx)("span",{className:"font-medium text-text-primary truncate",children:(0,s.P6)(e.model)}),(0,r.jsxs)("span",{className:"text-xs text-text-tertiary tabular-nums flex-1 text-right",children:[(0,s.jh)(e.totalTokens,l)," \xb7 ",(0,s.R8)(t)]}),(0,r.jsx)("span",{className:"num-mono font-medium text-text-primary min-w-[80px] text-right",children:(0,s.az)(e.cost)})]}),(0,r.jsx)("div",{className:"h-2 w-full bg-bg-surface-hi rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"bar-grow h-full rounded-full transition-all duration-500 ease-out-soft group-hover:brightness-110",style:{width:"".concat(e.cost/c*100,"%"),background:function(e){for(let t of Object.keys(i))if(e.toLowerCase().includes(t))return i[t];return"rgb(var(--chart-cache-create))"}(e.model)}})})]},e.model)})})}},11721:(e,t,a)=>{Promise.resolve().then(a.bind(a,12623)),Promise.resolve().then(a.bind(a,77549)),Promise.resolve().then(a.bind(a,30633)),Promise.resolve().then(a.bind(a,25763)),Promise.resolve().then(a.bind(a,8608)),Promise.resolve().then(a.bind(a,74387))},12623:(e,t,a)=>{"use strict";a.d(t,{ActivityStatsSection:()=>c});var r=a(95155),s=a(12115),n=a(25016),i=a(7331),l=a(79808);function c(e){var t;let{stats:a,comparison:n,locale:c,className:x}=e,m=(0,s.useCallback)((e,t)=>(0,l.nA)(c,e,t),[c]),u=[{label:m("activity.activeDays"),value:a.activeDays.toLocaleString()},{label:m("activity.streakCombinedLabel"),value:m("activity.streakCombinedValue",{current:a.currentStreak,longest:a.longestStreak})},{label:m("activity.peakHour"),value:a.peakHour<0?"—":h(a.peakHour,c)}];return(0,r.jsx)(i.wn,{title:m("activity.title"),desc:m("activity.subtitle"),inlineDesc:!0,fillBody:!0,className:x,children:(0,r.jsxs)("div",{className:"flex flex-col md:flex-row gap-5 md:gap-8 items-stretch flex-1",children:[(0,r.jsx)("div",{className:"grid grid-cols-3 md:flex md:flex-col md:w-[170px] md:shrink-0 gap-2.5",children:u.map(e=>(0,r.jsx)(o,{label:e.label,value:e.value},e.label))}),(0,r.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col",children:[(0,r.jsx)(d,{data:a.heatmap,tokens:a.tokenHeatmap,max:a.heatmapMax,locale:c}),n&&(0,r.jsx)("div",{className:"mt-auto pt-4 text-xs text-text-tertiary leading-relaxed",children:m("activity.comparison",{multiplier:(t=n.multiplier)<10?t.toFixed(1):t<1e3?Math.round(t).toString():t<1e6?(t/1e3).toFixed(1)+"K":(t/1e6).toFixed(1)+"M",ref:m("activity.ref.".concat(n.refKey))})})]})]})})}function o(e){let{label:t,value:a}=e;return(0,r.jsxs)("div",{className:"rounded-button bg-bg-surface-hi/60 border border-border px-3.5 py-3 flex-1 flex flex-col justify-center min-h-[64px]",children:[(0,r.jsx)("div",{className:"text-[11px] uppercase tracking-[0.06em] text-text-tertiary font-semibold truncate",children:t}),(0,r.jsx)("div",{className:"num-mono text-xl font-semibold text-text-primary mt-1 leading-none truncate",children:a})]})}function d(e){let{data:t,tokens:a,max:n,locale:i}=e,c=(0,s.useCallback)((e,t)=>(0,l.nA)(i,e,t),[i]),o=[0,3,6,9,12,15,18,21],[d,m]=(0,s.useState)(null),h=(0,s.useMemo)(()=>{let e=0,r=0,s=0;for(let a of t)for(let t of a)e+=t;for(let e of a)for(let t of e)r+=t,t>s&&(s=t);return{messages:e,tokens:r,maxTokens:s}},[t,a]);function p(e,r,s){let n=e.currentTarget.getBoundingClientRect();m({dow:r,hour:s,count:t[r][s],tokens:a[r][s],rect:{left:n.left,top:n.top,width:n.width,height:n.height}})}return(0,r.jsxs)("div",{className:"w-full",children:[(0,r.jsxs)("div",{className:"grid gap-y-[3px] [grid-template-columns:auto_1fr] items-center",children:[t.map((e,t)=>(0,r.jsx)(x,{dow:t,row:e,max:n,t:c,onCellHover:p,onLeave:()=>m(null)},t)),(0,r.jsx)("div",{className:"text-[10px] text-text-tertiary opacity-0 select-none pr-2",children:"."}),(0,r.jsx)("div",{className:"grid [grid-template-columns:repeat(24,minmax(0,1fr))] text-[10px] text-text-tertiary tabular-nums gap-[3px] mt-1",children:Array.from({length:24}).map((e,t)=>{var a;return(0,r.jsx)("div",{className:"text-center leading-none",children:o.includes(t)?(a=t,"zh"===i?"".concat(a):0===a?"12a":a<12?"".concat(a,"a"):12===a?"12p":"".concat(a-12,"p")):""},t)})})]}),d&&(0,r.jsx)(u,{hover:d,locale:i,totalMessages:h.messages,totalTokens:h.tokens,maxCount:n,maxTokens:h.maxTokens,t:c})]})}function x(e){let{dow:t,row:a,max:s,t:n,onCellHover:i,onLeave:l}=e,c=n("activity.dow.".concat(t));return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"text-[11px] text-text-tertiary tabular-nums pr-2.5 leading-none whitespace-nowrap",children:c}),(0,r.jsx)("div",{className:"grid [grid-template-columns:repeat(24,minmax(0,1fr))] gap-[3px]",onMouseLeave:l,children:a.map((e,a)=>(0,r.jsx)(m,{count:e,max:s,onHover:e=>i(e,t,a)},a))})]})}function m(e){let{count:t,max:a,onHover:s}=e,i=a>0&&t>0?Math.sqrt(t/a):0,l=t?{backgroundColor:"rgb(var(--brand) / ".concat((.18+.82*i).toFixed(2),")")}:{};return(0,r.jsx)("div",{onMouseEnter:s,className:(0,n.cn)("aspect-square rounded-[3px] transition-transform duration-100","hover:scale-125 hover:ring-1 hover:ring-brand/60 hover:z-10 relative",!t&&"bg-bg-surface-hi"),style:l})}function u(e){let{hover:t,locale:a,totalMessages:s,totalTokens:i,maxCount:l,maxTokens:c,t:o}=e,d=t.rect.left+t.rect.width/2,x=t.rect.top<96,m=x?t.rect.top+t.rect.height+8:t.rect.top-8,u=o("activity.dow.".concat(t.dow)),p=function(e,t){let a=(e+1)%24;return"zh"===t?"".concat(e.toString().padStart(2,"0"),":00 – ").concat(a.toString().padStart(2,"0"),":00"):"".concat(h(e,t)," – ").concat(h(a,t))}(t.hour,a),f=s>0?t.count/s*100:0,v=l>0?t.count/l*100:0,b=i>0?t.tokens/i*100:0,g=c>0?t.tokens/c*100:0;return(0,r.jsx)("div",{role:"tooltip",className:"pointer-events-none fixed z-50",style:{left:d,top:m,transform:"translate(-50%, ".concat(x?"0%":"-100%",")")},children:(0,r.jsxs)("div",{className:"card-elevated rounded-button px-3 py-2 text-xs whitespace-nowrap shadow-xl border border-border-hi bg-bg-elevated min-w-[180px]",children:[(0,r.jsxs)("div",{className:"font-semibold text-text-primary mb-1",children:[u," \xb7 ",p]}),t.count>0?(0,r.jsxs)("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-text-secondary tabular-nums",children:[(0,r.jsx)("span",{className:"text-text-tertiary",children:o("activity.heatmap.messages")}),(0,r.jsxs)("span",{className:"text-right",children:[t.count.toLocaleString(),(0,r.jsxs)("span",{className:"text-text-tertiary ml-1.5",children:["\xb7"," ",(0,r.jsxs)("span",{title:o("activity.heatmap.shareLabel"),children:[f.toFixed(1),"%"]})," / ",(0,r.jsxs)("span",{title:o("activity.heatmap.intensityLabel"),children:[v.toFixed(0),"%"]})]})]}),(0,r.jsx)("span",{className:"text-text-tertiary",children:o("activity.heatmap.tokens")}),(0,r.jsxs)("span",{className:"text-right",children:[(0,n.jh)(t.tokens,a),(0,r.jsxs)("span",{className:"text-text-tertiary ml-1.5",children:["\xb7"," ",(0,r.jsxs)("span",{title:o("activity.heatmap.shareLabel"),children:[b.toFixed(1),"%"]})," / ",(0,r.jsxs)("span",{title:o("activity.heatmap.intensityLabel"),children:[g.toFixed(0),"%"]})]})]}),(0,r.jsx)("span",{}),(0,r.jsxs)("span",{className:"text-[10px] text-text-tertiary text-right pt-1 leading-none",children:[o("activity.heatmap.shareLabel")," / ",o("activity.heatmap.intensityLabel")]})]}):(0,r.jsx)("div",{className:"text-text-tertiary",children:o("activity.heatmap.empty")})]})})}function h(e,t){return"zh"===t?"".concat(e,":00"):0===e?"12 AM":e<12?"".concat(e," AM"):12===e?"12 PM":"".concat(e-12," PM")}},25016:(e,t,a)=>{"use strict";a.d(t,{BC:()=>h,P6:()=>f,PJ:()=>u,R8:()=>d,a3:()=>x,az:()=>c,cn:()=>n,jh:()=>l,l7:()=>o,r6:()=>m});var r=a(2821),s=a(75889);function n(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,s.QP)((0,r.$)(t))}function i(e,t){var a;return new Intl.NumberFormat("en-US",{maximumFractionDigits:null!=(a=null==t?void 0:t.maxFrac)?a:0}).format(e)}function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en";return Number.isFinite(e)?"zh"===t?e>=1e8?(e/1e8).toFixed(2)+"亿":e>=1e4?(e/1e4).toFixed(1)+"万":i(e):e>=1e9?(e/1e9).toFixed(2)+"B":e>=1e6?(e/1e6).toFixed(2)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":i(e):"0"}function c(e,t){var a,r;return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:null!=(a=null==t?void 0:t.minFrac)?a:2,maximumFractionDigits:null!=(r=null==t?void 0:t.maxFrac)?r:2}).format(e)}function o(e){return 0===e?"$0":e<.01?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:6}).format(e):c(e)}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Number.isFinite(e)?"".concat((100*e).toFixed(t),"%"):"0%"}function x(e){if(e<1e3)return"".concat(e,"ms");let t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");let a=Math.floor(t/60);if(a<60){let e=t%60;return e?"".concat(a,"m ").concat(e,"s"):"".concat(a,"m")}let r=Math.floor(a/60),s=a%60;return s?"".concat(r,"h ").concat(s,"m"):"".concat(r,"h")}function m(e){let t="string"==typeof e||"number"==typeof e?new Date(e):e;if(Number.isNaN(t.getTime()))return"";let a=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0"),n=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),l=String(t.getSeconds()).padStart(2,"0");return"".concat(a,"-").concat(r,"-").concat(s," ").concat(n,":").concat(i,":").concat(l)}function u(e){if(!e)return"(unknown)";let t=e.replace(/[/\\]+$/,"").split(/[/\\]+/);return t[t.length-1]||e}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e?e.replace(/-/g,"").slice(0,t):""}let p={mini:"Mini",nano:"Nano",pro:"Pro",turbo:"Turbo",preview:"Preview"};function f(e){if(!e)return"(unknown)";let t=e.replace(/^(vertex_ai|bedrock|anthropic|openai)\//,""),a=t.toLowerCase();if(a.startsWith("gpt-")||/^o\d/.test(a))return a.startsWith("gpt-")?"GPT-"+t.slice(4).split("-").map(e=>{var t;return null!=(t=p[e.toLowerCase()])?t:e}).join(" "):t.toUpperCase();let r=t.replace(/-(\d{8})$/,""),s=(r=r.replace(/^claude-/,"")).split("-");if(s.length>=2){let e=s[0],t=s.slice(1).join(".");return v(e)+" "+t}return v(r.replace(/-/g," "))}function v(e){return e.replace(/\b\w/g,e=>e.toUpperCase())}},25763:(e,t,a)=>{"use strict";a.d(t,{BlockProgress:()=>l});var r=a(95155),s=a(12115),n=a(25016),i=a(51148);function l(e){let{initial:t,className:a,sourceLabel:s,compact:l,headerRight:o,cliName:d="Claude Code"}=e,x=(0,i.kj)(),{locale:m}=(0,i.s9)(),u=e=>(0,n.jh)(e,m),h=(0,n.cn)("card flex flex-col",l?"p-4 min-h-[160px]":"card-pad min-h-[180px]",a),p=(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("div",{className:"label whitespace-nowrap",children:x("block.title")}),s&&(0,r.jsxs)("span",{className:"text-[10px] uppercase tracking-wide text-text-tertiary font-medium whitespace-nowrap",children:["\xb7 ",s]})]});if(!t.hasBlock||!t.endTime||!t.startTime)return(0,r.jsxs)("div",{className:h,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[p,o]}),(0,r.jsx)("div",{className:"text-sm text-text-tertiary mt-4",children:x("block.empty")}),(0,r.jsx)("div",{className:"text-xs text-text-tertiary mt-1",children:x("block.emptyDesc",{cli:d})})]});let f=(0,r.jsxs)("span",{className:"pill bg-success/10 text-success border border-success/20 whitespace-nowrap",children:[(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-success mr-1 animate-pulse"}),x("common.live")]});return(0,r.jsxs)("div",{className:h,children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[p,null!=o?o:f]}),(0,r.jsx)(c,{startTime:t.startTime,endTime:t.endTime,totalTokens:t.totalTokens,remainingLabel:x("block.remaining"),renderElapsed:e=>x("block.elapsed",{pct:e}),tokensSuffix:x("block.tokensSuffix"),fmtTokens:u}),(0,r.jsxs)("div",{className:"mt-4 pt-4 border-t border-border grid grid-cols-2 gap-3 text-xs",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-text-tertiary",children:x("block.spentSoFar")}),(0,r.jsx)("div",{className:"num-mono text-text-primary mt-0.5 text-base",children:(0,n.az)(t.cost)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-text-tertiary",children:x("block.burnPerMin")}),(0,r.jsx)("div",{className:"num-mono text-text-primary mt-0.5 text-base",children:u(t.burnRatePerMin)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-text-tertiary",children:x("block.projectedTotal")}),(0,r.jsx)("div",{className:"num-mono text-text-secondary mt-0.5",children:(0,n.az)(t.projectedCost)})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-text-tertiary",children:x("block.requests")}),(0,r.jsx)("div",{className:"num-mono text-text-secondary mt-0.5",children:t.requests})]})]}),(0,r.jsx)("div",{className:"mt-auto pt-3 text-[11px] leading-relaxed text-text-tertiary",children:x("block.disclaimer")})]})}function c(e){let{startTime:t,endTime:a,totalTokens:n,remainingLabel:i,renderElapsed:l,tokensSuffix:c,fmtTokens:o}=e,[d,x]=(0,s.useState)(()=>Date.now());(0,s.useEffect)(()=>{let e=setInterval(()=>x(Date.now()),1e3);return()=>clearInterval(e)},[]);let m=new Date(t).getTime(),u=new Date(a).getTime(),h=Math.max(0,d-m),p=Math.max(0,u-d),f=Math.min(1,h/(u-m)),v=l((100*f).toFixed(1));return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"mt-3 flex items-baseline gap-2",children:[(0,r.jsx)("div",{className:"num-hero",children:function(e){if(e<=0)return"0s";let t=Math.floor(e/1e3),a=Math.floor(t/3600),r=Math.floor(t%3600/60),s=t%60;return a>0?"".concat(a,"h ").concat(String(r).padStart(2,"0"),"m"):r>0?"".concat(r,"m ").concat(String(s).padStart(2,"0"),"s"):"".concat(s,"s")}(p)}),(0,r.jsx)("div",{className:"text-xs text-text-secondary",children:i})]}),(0,r.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs text-text-secondary",children:[(0,r.jsx)("span",{children:v}),(0,r.jsxs)("span",{className:"num-mono",children:[o(n)," ",c]})]}),(0,r.jsx)("div",{className:"h-1.5 bg-bg-surface-hi rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-gradient-to-r from-brand to-brand-hover transition-all",style:{width:"".concat(100*f,"%")},suppressHydrationWarning:!0})})]})]})}},30633:(e,t,a)=>{"use strict";a.d(t,{BlockProgressSwitcher:()=>i});var r=a(95155),s=a(12115),n=a(25763);function i(e){var t;let{slots:a,defaultSource:i,className:l}=e,c=Math.max(0,a.findIndex(e=>e.source===i)),[o,d]=(0,s.useState)(c),x=null!=(t=a[o])?t:a[0];return(0,r.jsx)(n.BlockProgress,{initial:x.initial,sourceLabel:x.label,cliName:x.cliName,className:l,headerRight:(0,r.jsx)("div",{role:"tablist","aria-label":"Active 5h block source",className:"inline-flex items-center rounded-md border border-border bg-bg-surface p-0.5 gap-0.5",children:a.map((e,t)=>{let a=t===o;return(0,r.jsx)("button",{type:"button",role:"tab","aria-selected":a,onClick:()=>d(t),className:"px-2 h-5 text-[11px] inline-flex items-center rounded transition-all ".concat(a?"bg-brand-strong text-white font-semibold shadow-sm":"text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:e.label},e.source)})})})}},38059:(e,t,a)=>{"use strict";a.d(t,{TokenStackChart:()=>h});var r=a(95155),s=a(26991),n=a(94632),i=a(68425),l=a(47734),c=a(73697),o=a(23508),d=a(26736),x=a(25016),m=a(51148);let u={input:"rgb(var(--chart-input))",output:"rgb(var(--chart-output))",cacheRead:"rgb(var(--chart-cache-read))",cacheCreation:"rgb(var(--chart-cache-create))"};function h(e){let{data:t,height:a="h-72"}=e,h=(0,m.kj)(),{locale:v}=(0,m.s9)();return t.length?(0,r.jsxs)("div",{className:"".concat(a," w-full"),children:[(0,r.jsx)(s.u,{width:"100%",height:"100%",children:(0,r.jsxs)(n.E,{data:t,margin:{top:12,right:8,bottom:4,left:8},barCategoryGap:"22%",children:[(0,r.jsx)(i.d,{stroke:"rgb(var(--chart-grid))",strokeOpacity:.6,strokeDasharray:"3 3",vertical:!1}),(0,r.jsx)(l.W,{dataKey:"label",tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,interval:"preserveStartEnd",minTickGap:32,tickMargin:8}),(0,r.jsx)(c.h,{tickFormatter:e=>(0,x.jh)(Number(e),v),tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,width:56,tickMargin:4}),(0,r.jsx)(o.m,{content:(0,r.jsx)(f,{}),cursor:{fill:"rgb(var(--text-primary) / 0.05)",radius:4}}),(0,r.jsx)(d.y,{dataKey:"input",stackId:"a",fill:u.input,isAnimationActive:!1}),(0,r.jsx)(d.y,{dataKey:"cacheCreation",stackId:"a",fill:u.cacheCreation,isAnimationActive:!1}),(0,r.jsx)(d.y,{dataKey:"cacheRead",stackId:"a",fill:u.cacheRead,isAnimationActive:!1}),(0,r.jsx)(d.y,{dataKey:"output",stackId:"a",fill:u.output,radius:[4,4,0,0],isAnimationActive:!1})]})}),(0,r.jsxs)("div",{className:"flex items-center flex-wrap justify-center gap-4 text-xs text-text-secondary mt-2",children:[(0,r.jsx)(p,{color:u.input,label:h("chart.legend.input")}),(0,r.jsx)(p,{color:u.cacheCreation,label:h("chart.legend.cacheWrite")}),(0,r.jsx)(p,{color:u.cacheRead,label:h("chart.legend.cacheRead")}),(0,r.jsx)(p,{color:u.output,label:h("chart.legend.output")})]})]}):(0,r.jsx)("div",{className:"".concat(a," flex items-center justify-center text-text-tertiary text-sm"),children:h("chart.empty")})}function p(e){let{color:t,label:a}=e;return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"w-2.5 h-2.5 rounded-sm",style:{background:t}}),(0,r.jsx)("span",{children:a})]})}function f(e){let t=(0,m.kj)(),{locale:a}=(0,m.s9)();if(!e.active||!e.payload||!e.payload.length)return null;let s=e.payload[0].payload,n=s.input+s.output+s.cacheRead+s.cacheCreation;return(0,r.jsxs)("div",{className:"card-elevated border border-border-hi rounded-card p-3 text-xs min-w-[200px]",children:[(0,r.jsx)("div",{className:"font-medium text-text-primary mb-2",children:e.label}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(v,{color:u.input,label:t("chart.legend.input"),value:s.input,locale:a}),(0,r.jsx)(v,{color:u.cacheCreation,label:t("chart.legend.cacheWrite"),value:s.cacheCreation,locale:a}),(0,r.jsx)(v,{color:u.cacheRead,label:t("chart.legend.cacheRead"),value:s.cacheRead,locale:a}),(0,r.jsx)(v,{color:u.output,label:t("chart.legend.output"),value:s.output,locale:a})]}),(0,r.jsxs)("div",{className:"mt-2 pt-2 border-t border-border flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.total")}),(0,r.jsx)("span",{className:"num-mono text-text-primary",children:(0,x.jh)(n,a)})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,r.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.cost")}),(0,r.jsx)("span",{className:"num-mono text-brand",children:(0,x.az)(s.cost)})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,r.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.requests")}),(0,r.jsx)("span",{className:"num-mono text-text-primary",children:s.requests})]})]})}function v(e){let{color:t,label:a,value:s,locale:n}=e;return(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-text-secondary",children:[(0,r.jsx)("span",{className:"w-2 h-2 rounded-sm",style:{background:t}}),a]}),(0,r.jsx)("span",{className:"num-mono text-text-primary",children:(0,x.jh)(s,n)})]})}},63847:(e,t,a)=>{"use strict";a.d(t,{j:()=>n});var r=a(95155),s=a(25016);function n(e){let{rect:t,variant:a="pill",className:n}=e;if(!t)return null;let i=8*("underline"===a);return(0,r.jsx)("span",{"aria-hidden":!0,className:(0,s.cn)("pointer-events-none absolute transition-[transform,width] duration-200 ease-out-soft","pill"===a?"inset-y-0 rounded bg-brand-strong shadow-sm":"-bottom-[12px] h-[2px] rounded-full bg-brand",n),style:{transform:"translateX(".concat(t.left+i,"px)"),width:Math.max(0,t.width-2*i)}})}},74387:(e,t,a)=>{"use strict";a.d(t,{OverviewTrendCard:()=>g});var r=a(95155),s=a(12115),n=a(7331),i=a(38059),l=a(26991),c=a(94632),o=a(68425),d=a(47734),x=a(73697),m=a(23508),u=a(26736),h=a(51148);function p(e){let{data:t,height:a="h-72"}=e,s=(0,h.kj)(),{locale:n}=(0,h.s9)();return t.length?(0,r.jsx)("div",{className:"".concat(a," w-full"),children:(0,r.jsx)(l.u,{width:"100%",height:"100%",children:(0,r.jsxs)(c.E,{data:t,margin:{top:12,right:8,bottom:4,left:8},barCategoryGap:"22%",children:[(0,r.jsx)("defs",{children:(0,r.jsxs)("linearGradient",{id:"convBarGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,r.jsx)("stop",{offset:"0%",stopColor:"rgb(var(--brand))",stopOpacity:.95}),(0,r.jsx)("stop",{offset:"100%",stopColor:"rgb(var(--brand))",stopOpacity:.5})]})}),(0,r.jsx)(o.d,{stroke:"rgb(var(--chart-grid))",strokeOpacity:.6,strokeDasharray:"3 3",vertical:!1}),(0,r.jsx)(d.W,{dataKey:"label",tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,interval:"preserveStartEnd",minTickGap:32,tickMargin:8}),(0,r.jsx)(x.h,{tickFormatter:e=>{let t;return t=Number(e),"zh"===n&&t>=1e4?"".concat((t/1e4).toFixed(1),"万"):t.toLocaleString()},tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,width:56,tickMargin:4}),(0,r.jsx)(m.m,{content:(0,r.jsx)(f,{}),cursor:{fill:"rgb(var(--text-primary) / 0.05)",radius:4}}),(0,r.jsx)(u.y,{dataKey:"turns",fill:"url(#convBarGrad)",radius:[4,4,0,0],isAnimationActive:!1})]})})}):(0,r.jsx)("div",{className:"".concat(a," flex items-center justify-center text-text-tertiary text-sm"),children:s("chart.empty")})}function f(e){var t;let a=(0,h.kj)();if(!e.active||!e.payload||!e.payload.length)return null;let s=e.payload[0].payload;return(0,r.jsxs)("div",{className:"card-elevated border border-border-hi rounded-card p-3 text-xs min-w-[180px]",children:[(0,r.jsx)("div",{className:"font-medium text-text-primary mb-2",children:e.label}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-text-secondary",children:a("chart.tooltip.conversations")}),(0,r.jsx)("span",{className:"num-mono text-text-primary",children:(null!=(t=s.turns)?t:0).toLocaleString()})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-1 text-text-tertiary",children:[(0,r.jsx)("span",{children:a("chart.tooltip.requests")}),(0,r.jsx)("span",{className:"num-mono",children:s.requests.toLocaleString()})]})]})}var v=a(76669),b=a(63847);function g(e){let{data:t,activeDaysHint:a}=e,l=(0,h.kj)(),[c,o]=(0,s.useState)("tokens"),d=l("tokens"===c?"overview.trend.desc.tokens":"overview.trend.desc.conversations");return(0,r.jsx)(n.wn,{title:l("overview.trend.title"),desc:l("overview.trend.desc",{metric:d}),right:(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(j,{value:c,onChange:o}),(0,r.jsx)("span",{className:"text-xs text-text-tertiary whitespace-nowrap",children:a})]}),children:"tokens"===c?(0,r.jsx)(i.TokenStackChart,{data:t}):(0,r.jsx)(p,{data:t})})}function j(e){let{value:t,onChange:a}=e,s=(0,h.kj)(),{containerRef:n,rect:i}=(0,v.S)(t),l=null===i;return(0,r.jsx)("div",{className:"inline-flex items-center rounded-md border border-border bg-bg-surface p-0.5",children:(0,r.jsxs)("div",{ref:n,role:"tablist","aria-label":s("overview.trend.title"),className:"relative flex gap-0.5",children:[(0,r.jsx)(b.j,{rect:i}),[{id:"tokens",labelKey:"overview.trend.metric.tokens"},{id:"conversations",labelKey:"overview.trend.metric.conversations"}].map(e=>{let n=e.id===t;return(0,r.jsx)("button",{type:"button",role:"tab","data-tab":e.id,"aria-selected":n,onClick:()=>a(e.id),className:"relative z-10 px-2.5 h-6 text-xs inline-flex items-center rounded transition-colors ".concat(n?"text-white font-semibold ".concat(l?"bg-brand-strong shadow-sm":""):"text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:s(e.labelKey)},e.id)})]})})}},76669:(e,t,a)=>{"use strict";a.d(t,{S:()=>n});var r=a(12115);let s=r.useLayoutEffect;function n(e){let t=(0,r.useRef)(null),[a,n]=(0,r.useState)(null),i=(0,r.useCallback)(()=>{let a=t.current;if(!a)return;let r=a.querySelector('[data-tab="'.concat(e,'"]'));if(!r)return void n(null);n(e=>{let t={left:r.offsetLeft,width:r.offsetWidth};return e&&e.left===t.left&&e.width===t.width?e:t})},[e]);return s(()=>{i()},[i]),(0,r.useEffect)(()=>{let e=t.current;if(!e||"undefined"==typeof ResizeObserver)return;let a=new ResizeObserver(()=>i());for(let t of(a.observe(e),Array.from(e.children)))a.observe(t);return window.addEventListener("resize",i),()=>{a.disconnect(),window.removeEventListener("resize",i)}},[i]),{containerRef:t,rect:a}}},77549:(e,t,a)=>{"use strict";a.d(t,{AutoRefresh:()=>n});var r=a(12115),s=a(20063);function n(e){let{intervalMs:t=15e3}=e,a=(0,s.useRouter)(),n=(0,r.useRef)(!1);return(0,r.useEffect)(()=>{if(t<=0)return;let e=null;function r(){if(!document.hidden&&!n.current){n.current=!0;try{a.refresh()}finally{Promise.resolve().then(()=>{n.current=!1})}}}return e=window.setInterval(r,t),document.addEventListener("visibilitychange",r),()=>{null!==e&&window.clearInterval(e),document.removeEventListener("visibilitychange",r)}},[a,t]),null}}},e=>{e.O(0,[760,930,148,441,255,358],()=>e(e.s=11721)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[430],{8336:(e,t,r)=>{"use strict";r.d(t,{ModelFilter:()=>i});var n=r(95155),a=r(35850),s=r(25016),o=r(51148);function i(e){let{all:t,selected:r}=e,i=(0,o.kj)();return(0,n.jsx)(a.K,{paramKey:"models",all:t,selected:r,render:s.P6,labelAllKey:"filter.modelAll",labelSingleKey:"filter.modelSingle",labelMultiKey:"filter.modelMulti",ariaLabel:i("filter.modelLabel")})}},14920:(e,t,r)=>{"use strict";r.d(t,{ProjectFilter:()=>i});var n=r(95155),a=r(35850),s=r(25016),o=r(51148);function i(e){let{all:t,selected:r}=e,i=(0,o.kj)();return(0,n.jsx)(a.K,{paramKey:"projects",all:t,selected:r,render:s.PJ,labelAllKey:"filter.projectAll",labelSingleKey:"filter.projectSingle",labelMultiKey:"filter.projectMulti",ariaLabel:i("filter.projectLabel")})}},20857:(e,t,r)=>{"use strict";r.d(t,{H:()=>o});var n=r(95155),a=r(12115),s=r(25016);function o(e){let{children:t,className:r}=e,o=(0,a.useRef)(null),[i,l]=(0,a.useState)(!1),[c,d]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=o.current;if(!e)return;function t(){if(!e)return;let{scrollLeft:t,scrollWidth:r,clientWidth:n}=e;l(t>4),d(t+n<r-4)}t(),e.addEventListener("scroll",t,{passive:!0});let r=new ResizeObserver(t);return r.observe(e),()=>{e.removeEventListener("scroll",t),r.disconnect()}},[]),(0,n.jsxs)("div",{className:(0,s.cn)("relative",r),children:[(0,n.jsx)("div",{ref:o,className:"overflow-x-auto",children:t}),(0,n.jsx)("div",{"aria-hidden":!0,className:(0,s.cn)("pointer-events-none absolute left-0 top-0 bottom-0 w-8 bg-gradient-to-r from-bg-surface to-transparent transition-opacity duration-150",i?"opacity-100":"opacity-0")}),(0,n.jsx)("div",{"aria-hidden":!0,className:(0,s.cn)("pointer-events-none absolute right-0 top-0 bottom-0 w-8 bg-gradient-to-l from-bg-surface to-transparent transition-opacity duration-150",c?"opacity-100":"opacity-0")})]})}},25016:(e,t,r)=>{"use strict";r.d(t,{BC:()=>h,P6:()=>b,PJ:()=>x,R8:()=>d,a3:()=>u,az:()=>l,cn:()=>s,jh:()=>i,l7:()=>c,r6:()=>m});var n=r(2821),a=r(75889);function s(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,a.QP)((0,n.$)(t))}function o(e,t){var r;return new Intl.NumberFormat("en-US",{maximumFractionDigits:null!=(r=null==t?void 0:t.maxFrac)?r:0}).format(e)}function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en";return Number.isFinite(e)?"zh"===t?e>=1e8?(e/1e8).toFixed(2)+"亿":e>=1e4?(e/1e4).toFixed(1)+"万":o(e):e>=1e9?(e/1e9).toFixed(2)+"B":e>=1e6?(e/1e6).toFixed(2)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":o(e):"0"}function l(e,t){var r,n;return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:null!=(r=null==t?void 0:t.minFrac)?r:2,maximumFractionDigits:null!=(n=null==t?void 0:t.maxFrac)?n:2}).format(e)}function c(e){return 0===e?"$0":e<.01?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:6}).format(e):l(e)}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Number.isFinite(e)?"".concat((100*e).toFixed(t),"%"):"0%"}function u(e){if(e<1e3)return"".concat(e,"ms");let t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");let r=Math.floor(t/60);if(r<60){let e=t%60;return e?"".concat(r,"m ").concat(e,"s"):"".concat(r,"m")}let n=Math.floor(r/60),a=r%60;return a?"".concat(n,"h ").concat(a,"m"):"".concat(n,"h")}function m(e){let t="string"==typeof e||"number"==typeof e?new Date(e):e;if(Number.isNaN(t.getTime()))return"";let r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),o=String(t.getMinutes()).padStart(2,"0"),i=String(t.getSeconds()).padStart(2,"0");return"".concat(r,"-").concat(n,"-").concat(a," ").concat(s,":").concat(o,":").concat(i)}function x(e){if(!e)return"(unknown)";let t=e.replace(/[/\\]+$/,"").split(/[/\\]+/);return t[t.length-1]||e}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e?e.replace(/-/g,"").slice(0,t):""}let p={mini:"Mini",nano:"Nano",pro:"Pro",turbo:"Turbo",preview:"Preview"};function b(e){if(!e)return"(unknown)";let t=e.replace(/^(vertex_ai|bedrock|anthropic|openai)\//,""),r=t.toLowerCase();if(r.startsWith("gpt-")||/^o\d/.test(r))return r.startsWith("gpt-")?"GPT-"+t.slice(4).split("-").map(e=>{var t;return null!=(t=p[e.toLowerCase()])?t:e}).join(" "):t.toUpperCase();let n=t.replace(/-(\d{8})$/,""),a=(n=n.replace(/^claude-/,"")).split("-");if(a.length>=2){let e=a[0],t=a.slice(1).join(".");return g(e)+" "+t}return g(n.replace(/-/g," "))}function g(e){return e.replace(/\b\w/g,e=>e.toUpperCase())}},25577:(e,t,r)=>{"use strict";r.d(t,{UsageTable:()=>h});var n=r(95155),a=r(12115),s=r(20063),o=r(25016),i=r(51148),l=r(47650);function c(e){let{children:t,content:r,className:s,panelClassName:i,align:c="left",delay:d=100,maxWidth:u=360}=e,m=(0,a.useRef)(null),x=(0,a.useRef)(null),h=(0,a.useRef)(null),[p,b]=(0,a.useState)(null),[g,f]=(0,a.useState)(!1),[v,j]=(0,a.useState)(!1);function y(){h.current&&(window.clearTimeout(h.current),h.current=null),v||(x.current=window.setTimeout(()=>{let e=function(){let e,t=m.current;if(!t)return null;let r=t.getBoundingClientRect(),n=Math.min(u,window.innerWidth-16),a=window.innerHeight-r.bottom<200?"top":"bottom";return"right"===c?(e=Math.min(r.right,window.innerWidth-8))-n<8&&(e=n+8):(e=Math.max(r.left,8))+n>window.innerWidth-8&&(e=window.innerWidth-n-8),{x:e,y:"bottom"===a?r.bottom+8:r.top-8,placement:a,align:c}}();e&&(b(e),j(!0))},d))}function w(){x.current&&(window.clearTimeout(x.current),x.current=null),h.current=window.setTimeout(()=>j(!1),80)}return(0,a.useEffect)(()=>f(!0),[]),(0,a.useEffect)(()=>()=>{x.current&&window.clearTimeout(x.current),h.current&&window.clearTimeout(h.current)},[]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{ref:m,onMouseEnter:y,onMouseLeave:w,onFocus:y,onBlur:w,className:(0,o.cn)("inline-block",s),children:t}),g&&p&&(0,l.createPortal)((0,n.jsx)("div",{onMouseEnter:()=>{h.current&&(window.clearTimeout(h.current),h.current=null)},onMouseLeave:w,style:{position:"fixed",left:"right"===p.align?void 0:p.x,right:"right"===p.align?window.innerWidth-p.x:void 0,top:"bottom"===p.placement?p.y:void 0,bottom:"top"===p.placement?window.innerHeight-p.y:void 0,maxWidth:u,transform:v?"translateY(0) scale(1)":"bottom"===p.placement?"translateY(-4px) scale(0.98)":"translateY(4px) scale(0.98)",opacity:+!!v,transitionProperty:"opacity, transform",transitionDuration:"120ms",transitionTimingFunction:"cubic-bezier(0.16, 1, 0.3, 1)",transformOrigin:"bottom"===p.placement?"top":"bottom",pointerEvents:v?"auto":"none"},className:(0,o.cn)("z-50 card border-border-hi shadow-xl rounded-button",i),children:r}),document.body)]})}var d=r(20857);let u=[{id:"time",labelKey:"usage.col.time",sortKey:"timestamp",defaultVisible:!0},{id:"duration",labelKey:"usage.col.duration",align:"right",sortKey:"durationMs",defaultVisible:!1},{id:"prompt",labelKey:"usage.col.userMessage",defaultVisible:!0},{id:"model",labelKey:"usage.col.model",defaultVisible:!0},{id:"project",labelKey:"usage.col.project",defaultVisible:!0},{id:"session",labelKey:"usage.col.session",defaultVisible:!1},{id:"calls",labelKey:"usage.col.calls",align:"right",sortKey:"callCount",defaultVisible:!1},{id:"input",labelKey:"usage.col.input",align:"right",sortKey:"inputTokens",defaultVisible:!1},{id:"output",labelKey:"usage.col.output",align:"right",sortKey:"outputTokens",defaultVisible:!1},{id:"cacheRead",labelKey:"usage.col.cacheRead",align:"right",sortKey:"cacheReadTokens",defaultVisible:!1},{id:"cacheWrite",labelKey:"usage.col.cacheWrite",align:"right",sortKey:"cacheCreationTokens",defaultVisible:!1},{id:"total",labelKey:"usage.col.total",align:"right",sortKey:"totalTokens",defaultVisible:!0},{id:"cost",labelKey:"usage.col.cost",align:"right",sortKey:"cost",defaultVisible:!1},{id:"tools",labelKey:"usage.col.tools",defaultVisible:!1}],m="ccgauge.usage.cols.v4";function x(){return u.reduce((e,t)=>(e[t.id]=t.defaultVisible,e),{})}function h(e){let{rows:t,totalCount:r,page:o,pageCount:l,sort:c,query:h}=e,b=(0,i.kj)(),{locale:f}=(0,i.s9)(),v=(0,s.useRouter)(),j=(0,s.usePathname)(),y=(0,s.useSearchParams)(),[w,N]=(0,a.useState)(new Set),[k,S]=(0,a.useState)(x),[C,R]=(0,a.useState)(!1),[T,K]=(0,a.useState)(h),E=(0,a.useRef)(null),P=(0,a.useRef)(null);function L(e){let t=new URLSearchParams(y.toString());for(let[r,n]of Object.entries(e))void 0===n||""===n?t.delete(r):t.set(r,n);let r=t.toString();v.push(r?"".concat(j,"?").concat(r):j)}function F(e){L({page:e>0?String(e+1):void 0})}(0,a.useEffect)(()=>{S(function(){try{let e=window.localStorage.getItem(m);if(!e)return x();let t=JSON.parse(e),r=x();for(let e of u)"boolean"==typeof t[e.id]&&(r[e.id]=t[e.id]);return r}catch(e){return x()}}())},[]),(0,a.useEffect)(()=>{window.localStorage.setItem(m,JSON.stringify(k))},[k]),(0,a.useEffect)(()=>{K(h)},[h]),(0,a.useEffect)(()=>{function e(e){E.current&&!E.current.contains(e.target)&&R(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,a.useEffect)(()=>()=>{P.current&&(window.clearTimeout(P.current),P.current=null)},[]);let M=u.filter(e=>k[e.id]),A=M.length+1,D=M.length;return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 mb-3 flex-wrap",children:[(0,n.jsx)("input",{value:T,onChange:e=>{var t;K(t=e.target.value),P.current&&window.clearTimeout(P.current),P.current=window.setTimeout(()=>{L({q:t.trim()||void 0,page:void 0})},300)},placeholder:b("common.searchPlaceholder"),className:"px-3 py-1.5 text-sm rounded-button border border-border bg-bg-surface focus:outline-none focus:border-border-hi w-72 placeholder:text-text-tertiary text-text-primary"}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("span",{className:"text-xs text-text-tertiary tabular-nums",children:b("common.rows",{count:r.toLocaleString()})}),(0,n.jsxs)("div",{ref:E,className:"relative",children:[(0,n.jsxs)("button",{onClick:()=>R(e=>!e),className:"btn",children:[b("usage.columns.button"),(0,n.jsx)("span",{className:"ml-1 text-text-tertiary tabular-nums",children:D})]}),C&&(0,n.jsxs)("div",{className:"absolute right-0 mt-1 w-56 card border-border-hi shadow-lg p-2 z-30",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-1.5 pb-1.5 mb-1 border-b border-border",children:[(0,n.jsx)("span",{className:"text-xs text-text-tertiary uppercase tracking-wide",children:b("usage.columns.title")}),(0,n.jsx)("button",{onClick:()=>S(x()),className:"text-xs text-text-tertiary hover:text-text-primary",children:b("usage.columns.reset")})]}),(0,n.jsx)("div",{className:"max-h-72 overflow-auto",children:u.map(e=>(0,n.jsxs)("label",{className:"flex items-center gap-2 px-1.5 py-1.5 text-sm rounded hover:bg-bg-surface-hi cursor-pointer",children:[(0,n.jsx)("input",{type:"checkbox",checked:!!k[e.id],onChange:t=>S(r=>({...r,[e.id]:t.target.checked})),className:"accent-brand"}),(0,n.jsx)("span",{className:"text-text-secondary",children:b(e.labelKey)})]},e.id))})]})]}),(0,n.jsx)("button",{onClick:function(){let e=new URLSearchParams(y.toString());window.location.href="/api/export/usage?".concat(e.toString())},className:"btn",children:b("common.exportCsv")})]})]}),(0,n.jsx)("div",{className:"card overflow-hidden",children:(0,n.jsx)(d.H,{children:(0,n.jsxs)("table",{className:"w-full text-sm",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{className:"border-b border-border bg-bg-surface-hi/30",children:[(0,n.jsx)(g,{children:(0,n.jsx)("span",{className:"sr-only",children:"expand"})}),M.map(e=>(0,n.jsx)(g,{align:e.align,sorted:!!e.sortKey&&c.key===e.sortKey,dir:c.dir,onClick:e.sortKey?()=>{var t;let r;return t=e.sortKey,r="desc",void(c.key===t&&(r="asc"===c.dir?"desc":"asc"),L({sort:"timestamp"===t?void 0:t,dir:"desc"===r?void 0:r,page:void 0}))}:void 0,children:b(e.labelKey)},e.id))]})}),(0,n.jsxs)("tbody",{children:[t.map(e=>{let t=w.has(e.turnId),r=e.userText.trim()||b("usage.turn.noPrompt");return(0,n.jsx)(p,{turn:e,isOpen:t,onToggle:()=>{var t;return t=e.turnId,void N(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})},userText:r,expandLabel:b("usage.turn.expand"),collapseLabel:b("usage.turn.collapse"),activeColumns:M,locale:f,t:b},e.turnId)}),0===t.length&&(0,n.jsx)("tr",{children:(0,n.jsx)("td",{colSpan:A,className:"px-3 py-8 text-center text-text-tertiary text-sm",children:b("common.noMatchingRows")})})]})]})})}),l>1&&(0,n.jsxs)("div",{className:"flex items-center justify-between mt-3 text-xs text-text-secondary",children:[(0,n.jsx)("span",{children:b("common.pageOf",{page:o+1,total:l})}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("button",{onClick:()=>F(0),disabled:0===o,className:"btn-ghost disabled:opacity-40",children:b("common.first")}),(0,n.jsx)("button",{onClick:()=>F(o-1),disabled:0===o,className:"btn-ghost disabled:opacity-40",children:b("common.prev")}),(0,n.jsx)("button",{onClick:()=>F(o+1),disabled:o>=l-1,className:"btn-ghost disabled:opacity-40",children:b("common.next")}),(0,n.jsx)("button",{onClick:()=>F(l-1),disabled:o>=l-1,className:"btn-ghost disabled:opacity-40",children:b("common.last")})]})]})]})}function p(e){let{turn:t,isOpen:r,onToggle:a,userText:s,expandLabel:i,collapseLabel:l,activeColumns:d,locale:u,t:m}=e,x=(1===t.models.length?(0,o.P6)(t.models[0]):"".concat((0,o.P6)(t.models[0])," +").concat(t.models.length-1))+(t.efforts.length?1===t.efforts.length?" \xb7 ".concat(t.efforts[0]):" \xb7 ".concat(t.efforts[0],"+").concat(t.efforts.length-1):""),h=t.toolNames.length?t.toolNames.slice(0,3).join(", ")+(t.toolNames.length>3?"…":""):"—";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("tr",{className:"border-b border-border last:border-b-0 hover:bg-bg-surface-hi/40 cursor-pointer",onClick:a,children:[(0,n.jsx)("td",{className:"px-2 py-2 text-text-tertiary w-6 text-center select-none",children:(0,n.jsx)("span",{title:r?l:i,className:"inline-block w-4",children:r?"▾":"▸"})}),d.map(e=>(0,n.jsx)("td",{className:(0,o.cn)("px-3 py-2","right"===e.align?"text-right":"text-left"),children:function(e,t,r,a,s,i,l){switch(e){case"time":return(0,n.jsx)("span",{className:"num-mono text-text-secondary whitespace-nowrap text-xs",title:"started ".concat((0,o.r6)(t.timestamp),"\nended ").concat((0,o.r6)(t.endTimestamp)),children:(0,o.r6)(t.timestamp)});case"duration":return(0,n.jsx)("span",{className:"num-mono text-text-secondary whitespace-nowrap text-xs",title:"".concat((0,o.r6)(t.timestamp)," → ").concat((0,o.r6)(t.endTimestamp)),children:(0,o.a3)(t.durationMs)});case"prompt":return(0,n.jsx)(c,{maxWidth:460,panelClassName:"p-3 text-sm text-text-secondary leading-relaxed",content:(0,n.jsx)("div",{className:"whitespace-pre-wrap break-words",children:s}),children:(0,n.jsx)("span",{className:"block text-text-secondary truncate max-w-[280px]",children:s})});case"model":return(0,n.jsx)("span",{className:"text-text-primary whitespace-nowrap",children:r});case"project":return(0,n.jsx)("span",{className:"block text-text-secondary truncate max-w-[180px]",title:t.cwd,children:t.projectLabel||(0,o.PJ)(t.cwd)});case"session":return(0,n.jsx)("span",{className:"num-mono text-text-tertiary text-xs",title:t.sessionId,children:(0,o.BC)(t.sessionId)});case"calls":return(0,n.jsx)("span",{className:"num-mono text-text-secondary",children:t.callCount});case"input":return(0,n.jsx)("span",{className:"num-mono text-text-secondary",children:(0,o.jh)(t.inputTokens,i)});case"output":return(0,n.jsx)("span",{className:"num-mono text-text-secondary",children:(0,o.jh)(t.outputTokens,i)});case"cacheRead":return(0,n.jsx)("span",{className:"num-mono text-success",children:(0,o.jh)(t.cacheReadTokens,i)});case"cacheWrite":return(0,n.jsx)("span",{className:"num-mono text-text-secondary",children:(0,o.jh)(t.cacheCreationTokens,i)});case"total":return(0,n.jsx)(c,{align:"right",maxWidth:300,panelClassName:"p-0 overflow-hidden",content:(0,n.jsx)(b,{row:t,locale:i,t:l}),children:(0,n.jsx)("span",{className:"num-mono text-text-primary font-medium border-b border-dashed border-border hover:border-text-tertiary cursor-help",children:(0,o.jh)(t.totalTokens,i)})});case"cost":return(0,n.jsx)("span",{className:"num-mono text-text-primary font-medium",children:(0,o.l7)(t.cost)});case"tools":return(0,n.jsx)("span",{className:"block text-xs text-text-tertiary truncate max-w-[160px]",title:t.toolNames.join(", "),children:a})}}(e.id,t,x,h,s,u,m)},e.id))]}),r&&t.children.map(e=>(0,n.jsxs)("tr",{className:"border-b border-border last:border-b-0 bg-bg-surface-hi/20 text-text-tertiary",children:[(0,n.jsx)("td",{className:"px-2 py-1.5 w-6"}),d.map(r=>(0,n.jsx)("td",{className:(0,o.cn)("px-3 py-1.5","right"===r.align?"text-right":"text-left"),children:function(e,t,r,a,s){switch(e){case"time":return(0,n.jsx)("span",{className:"num-mono whitespace-nowrap text-xs inline-block translate-x-5",children:(0,o.r6)(t.timestamp)});case"duration":return(0,n.jsx)("span",{className:"text-xs text-text-tertiary",children:"—"});case"prompt":{var i;let e=(null!=(i=t.directPrompt)?i:"").trim();if(e&&e!==r.trim())return(0,n.jsx)("span",{className:"block text-xs text-text-secondary truncate max-w-[320px]",title:e,children:e});if(!t.toolNames.length)return(0,n.jsx)("span",{className:"text-xs text-text-tertiary",children:"—"});let a=t.toolNames.join(", "),s=t.toolNames.slice(0,3).join(", ")+(t.toolNames.length>3?"…":"");return(0,n.jsx)("span",{className:"block text-xs text-text-secondary truncate max-w-[280px]",title:a,children:s})}case"model":return(0,n.jsxs)("span",{className:"whitespace-nowrap",children:[(0,o.P6)(t.model),t.effort?" \xb7 ".concat(t.effort):""]});case"project":return(0,n.jsx)("span",{className:"block truncate max-w-[180px]",title:t.cwd,children:t.projectLabel||(0,o.PJ)(t.cwd)});case"session":return(0,n.jsx)("span",{className:"num-mono text-xs",title:t.sessionId,children:(0,o.BC)(t.sessionId)});case"calls":return(0,n.jsx)("span",{className:"num-mono",children:"1"});case"input":return(0,n.jsx)("span",{className:"num-mono",children:(0,o.jh)(t.inputTokens,a)});case"output":return(0,n.jsx)("span",{className:"num-mono",children:(0,o.jh)(t.outputTokens,a)});case"cacheRead":return(0,n.jsx)("span",{className:"num-mono text-success",children:(0,o.jh)(t.cacheReadTokens,a)});case"cacheWrite":return(0,n.jsx)("span",{className:"num-mono",children:(0,o.jh)(t.cacheCreationTokens,a)});case"total":return(0,n.jsx)(c,{align:"right",maxWidth:300,panelClassName:"p-0 overflow-hidden",content:(0,n.jsx)(b,{row:t,locale:a,t:s}),children:(0,n.jsx)("span",{className:"num-mono border-b border-dashed border-border/60 hover:border-text-tertiary cursor-help",children:(0,o.jh)(t.totalTokens,a)})});case"cost":return(0,n.jsx)("span",{className:"num-mono",children:(0,o.l7)(t.cost)});case"tools":return(0,n.jsx)("span",{className:"block text-xs truncate max-w-[160px]",title:t.toolNames.join(", "),children:t.toolNames.length?t.toolNames.join(", "):"—"})}}(r.id,e,t.userText,u,m)},r.id))]},e.uuid))]})}function b(e){let{row:t,locale:r,t:s}=e,i=[{key:"input",label:s("usage.col.input"),tokens:t.inputTokens,cost:t.costInput,tone:"text-text-primary",dot:"bg-chart-input"},{key:"output",label:s("usage.col.output"),tokens:t.outputTokens,cost:t.costOutput,tone:"text-text-primary",dot:"bg-chart-output"},{key:"cacheRead",label:s("usage.col.cacheRead"),tokens:t.cacheReadTokens,cost:t.costCacheRead,tone:"text-success",dot:"bg-chart-cache-read"},{key:"cacheWrite",label:s("usage.col.cacheWrite"),tokens:t.cacheCreationTokens,cost:t.costCacheWrite,tone:"text-text-primary",dot:"bg-chart-cache-create"}];return(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsx)("div",{className:"px-3 py-2 border-b border-border bg-bg-surface-hi/40 text-text-tertiary uppercase tracking-wide font-medium",children:s("usage.breakdown.title")}),(0,n.jsxs)("div",{className:"px-3 py-2",children:[(0,n.jsxs)("div",{className:"grid grid-cols-[auto_1fr_auto] gap-x-3 gap-y-1.5 items-center",children:[(0,n.jsx)("span",{}),(0,n.jsx)("span",{className:"text-text-tertiary text-[10px] uppercase tracking-wide text-right",children:s("usage.breakdown.headerTokens")}),(0,n.jsx)("span",{className:"text-text-tertiary text-[10px] uppercase tracking-wide text-right",children:s("usage.breakdown.headerCost")}),i.map(e=>(0,n.jsxs)(a.Fragment,{children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-2 text-text-secondary",children:[(0,n.jsx)("span",{className:(0,o.cn)("w-2 h-2 rounded-sm",e.dot)}),e.label]}),(0,n.jsx)("span",{className:(0,o.cn)("num-mono text-right",e.tone),children:(0,o.jh)(e.tokens,r)}),(0,n.jsx)("span",{className:"num-mono text-right text-text-secondary",children:(0,o.l7)(e.cost)}),"output"===e.key&&t.reasoningTokens>0&&(0,n.jsxs)(a.Fragment,{children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-2 text-text-tertiary pl-4 text-[11px]",children:[(0,n.jsx)("span",{className:"text-text-tertiary",children:"↳"}),s("usage.breakdown.reasoning")]}),(0,n.jsx)("span",{className:"num-mono text-right text-text-tertiary text-[11px]",children:(0,o.jh)(t.reasoningTokens,r)}),(0,n.jsx)("span",{className:"text-right text-text-tertiary text-[11px]",children:s("usage.breakdown.reasoningNote")})]},"reasoning-detail")]},e.key))]}),(0,n.jsxs)("div",{className:"mt-2 pt-2 border-t border-border grid grid-cols-[auto_1fr_auto] gap-x-3 items-center",children:[(0,n.jsx)("span",{className:"text-text-secondary font-medium",children:s("usage.breakdown.total")}),(0,n.jsx)("span",{className:"num-mono text-right text-text-primary font-medium",children:(0,o.jh)(t.totalTokens,r)}),(0,n.jsx)("span",{className:"num-mono text-right text-text-primary font-medium",children:(0,o.l7)(t.cost)})]})]})]})}function g(e){let{children:t,align:r="left",sorted:a,dir:s,onClick:i}=e;return(0,n.jsx)("th",{className:(0,o.cn)("px-3 py-2 text-xs font-medium text-text-tertiary uppercase tracking-wide whitespace-nowrap","right"===r?"text-right":"text-left",i&&"cursor-pointer hover:text-text-primary select-none"),onClick:i,children:(0,n.jsxs)("span",{className:"inline-flex items-center gap-1",children:[t,a&&(0,n.jsx)("span",{className:"text-[10px]",children:"asc"===s?"▲":"▼"})]})})}},35850:(e,t,r)=>{"use strict";r.d(t,{K:()=>l});var n=r(95155),a=r(20063),s=r(12115),o=r(25016),i=r(51148);function l(e){let t,{paramKey:r,all:l,selected:c,render:d=e=>e,labelAllKey:u,labelSingleKey:m,labelMultiKey:x,ariaLabel:h,searchThreshold:p=6}=e,b=(0,a.useRouter)(),g=(0,a.usePathname)(),f=(0,a.useSearchParams)(),v=(0,i.kj)(),[j,y]=(0,s.useState)(!1),[w,N]=(0,s.useState)(""),[k,S]=(0,s.useState)(0),C=(0,s.useRef)(null),R=(0,s.useRef)(null),T=(0,s.useRef)(null),K=(0,s.useRef)(null),E=(0,s.useId)(),P=(0,s.useId)();(0,s.useEffect)(()=>{if(j)return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)};function e(e){C.current&&!C.current.contains(e.target)&&y(!1)}function t(e){if("Escape"===e.key){var t;y(!1),null==(t=R.current)||t.focus()}}},[j]),(0,s.useEffect)(()=>{j&&l.length>=p&&requestAnimationFrame(()=>{var e;return null==(e=T.current)?void 0:e.focus()}),j||(N(""),S(0))},[j,l.length,p]);let L=(0,s.useMemo)(()=>{let e=w.trim().toLowerCase();return e?l.filter(t=>d(t).toLowerCase().includes(e)||t.toLowerCase().includes(e)):l},[l,w,d]);function F(e){let t=new URLSearchParams(f.toString());0===e.size?t.delete(r):t.set(r,Array.from(e).join(","));let n=t.toString();b.push(n?"".concat(g,"?").concat(n):g)}function M(e){let t=new Set(c);t.has(e)?t.delete(e):t.add(e),F(t)}function A(e){if("ArrowDown"===e.key)e.preventDefault(),S(e=>Math.min(L.length-1,e+1));else if("ArrowUp"===e.key)e.preventDefault(),S(e=>Math.max(0,e-1));else if("Enter"===e.key){e.preventDefault();let t=L[k];t&&M(t)}else"Home"===e.key?(e.preventDefault(),S(0)):"End"===e.key&&(e.preventDefault(),S(L.length-1))}t=0===c.length?v(u):1===c.length?v(m,{value:d(c[0])}):v(x,{count:c.length});let D=l.length>=p;return(0,n.jsxs)("div",{ref:C,className:"relative",children:[(0,n.jsxs)("button",{ref:R,id:E,onClick:()=>y(e=>!e),className:"btn focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40","aria-haspopup":"listbox","aria-expanded":j,"aria-controls":P,"aria-label":h,children:[t,(0,n.jsx)("span",{className:"text-text-tertiary ml-1","aria-hidden":!0,children:"▾"})]}),j&&(0,n.jsxs)("div",{id:P,role:"listbox","aria-multiselectable":"true","aria-labelledby":E,className:"absolute right-0 mt-1 w-72 card border-border-hi shadow-lg z-20 overflow-hidden",children:[c.length>0&&(0,n.jsxs)("div",{className:"px-2 pt-2 pb-1.5 border-b border-border flex flex-wrap gap-1 items-center",children:[c.slice(0,6).map(e=>(0,n.jsxs)("button",{onClick:()=>M(e),className:"inline-flex items-center gap-1 max-w-[160px] pl-2 pr-1.5 py-0.5 text-[11px] rounded-full bg-brand/10 text-brand border border-brand/20 hover:bg-brand/15","aria-label":"Remove ".concat(d(e)),title:d(e),children:[(0,n.jsx)("span",{className:"truncate",children:d(e)}),(0,n.jsx)("span",{"aria-hidden":!0,className:"text-brand/70",children:"\xd7"})]},e)),c.length>6&&(0,n.jsxs)("span",{className:"text-[11px] text-text-tertiary px-1",children:["+",c.length-6]}),(0,n.jsx)("button",{onClick:function(){F(new Set)},className:"ml-auto text-[11px] text-text-tertiary hover:text-text-primary px-1.5 py-0.5",children:v("filter.clearAll")})]}),D&&(0,n.jsx)("div",{className:"p-2 border-b border-border",children:(0,n.jsx)("input",{ref:T,value:w,onChange:e=>{N(e.target.value),S(0)},onKeyDown:e=>{("ArrowDown"===e.key||"ArrowUp"===e.key||"Enter"===e.key||"Home"===e.key||"End"===e.key)&&A(e)},placeholder:v("common.searchPlaceholder"),className:"w-full px-2 py-1 text-sm rounded border border-border bg-bg-surface focus:outline-none focus:border-border-hi placeholder:text-text-tertiary text-text-primary"})}),(0,n.jsxs)("div",{ref:K,onKeyDown:A,className:"max-h-64 overflow-y-auto p-1 outline-none",tabIndex:-1,children:[0===L.length&&(0,n.jsx)("div",{className:"text-xs text-text-tertiary px-2 py-3 text-center",children:v("filter.noOptions")}),L.map((e,t)=>{let r=c.includes(e),a=t===k;return(0,n.jsxs)("button",{role:"option","aria-selected":r,onMouseEnter:()=>S(t),onClick:()=>M(e),className:(0,o.cn)("w-full text-left text-sm px-2 py-1.5 rounded flex items-center gap-2 transition-colors",a?"bg-bg-surface-hi":"hover:bg-bg-surface-hi",r&&"text-text-primary"),children:[(0,n.jsx)("span",{className:(0,o.cn)("w-3.5 h-3.5 rounded-sm border flex items-center justify-center text-[10px] flex-shrink-0",r?"bg-brand border-brand text-white":"border-border-hi"),"aria-hidden":!0,children:r?"✓":""}),(0,n.jsx)("span",{className:"truncate",children:d(e)})]},e)})]})]})]})}},36392:(e,t,r)=>{Promise.resolve().then(r.bind(r,77549)),Promise.resolve().then(r.bind(r,38059)),Promise.resolve().then(r.bind(r,86384)),Promise.resolve().then(r.bind(r,8336)),Promise.resolve().then(r.bind(r,44512)),Promise.resolve().then(r.bind(r,14920)),Promise.resolve().then(r.bind(r,73896)),Promise.resolve().then(r.bind(r,25577))},38059:(e,t,r)=>{"use strict";r.d(t,{TokenStackChart:()=>h});var n=r(95155),a=r(26991),s=r(94632),o=r(68425),i=r(47734),l=r(73697),c=r(23508),d=r(26736),u=r(25016),m=r(51148);let x={input:"rgb(var(--chart-input))",output:"rgb(var(--chart-output))",cacheRead:"rgb(var(--chart-cache-read))",cacheCreation:"rgb(var(--chart-cache-create))"};function h(e){let{data:t,height:r="h-72"}=e,h=(0,m.kj)(),{locale:g}=(0,m.s9)();return t.length?(0,n.jsxs)("div",{className:"".concat(r," w-full"),children:[(0,n.jsx)(a.u,{width:"100%",height:"100%",children:(0,n.jsxs)(s.E,{data:t,margin:{top:12,right:8,bottom:4,left:8},barCategoryGap:"22%",children:[(0,n.jsx)(o.d,{stroke:"rgb(var(--chart-grid))",strokeOpacity:.6,strokeDasharray:"3 3",vertical:!1}),(0,n.jsx)(i.W,{dataKey:"label",tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,interval:"preserveStartEnd",minTickGap:32,tickMargin:8}),(0,n.jsx)(l.h,{tickFormatter:e=>(0,u.jh)(Number(e),g),tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,width:56,tickMargin:4}),(0,n.jsx)(c.m,{content:(0,n.jsx)(b,{}),cursor:{fill:"rgb(var(--text-primary) / 0.05)",radius:4}}),(0,n.jsx)(d.y,{dataKey:"input",stackId:"a",fill:x.input,isAnimationActive:!1}),(0,n.jsx)(d.y,{dataKey:"cacheCreation",stackId:"a",fill:x.cacheCreation,isAnimationActive:!1}),(0,n.jsx)(d.y,{dataKey:"cacheRead",stackId:"a",fill:x.cacheRead,isAnimationActive:!1}),(0,n.jsx)(d.y,{dataKey:"output",stackId:"a",fill:x.output,radius:[4,4,0,0],isAnimationActive:!1})]})}),(0,n.jsxs)("div",{className:"flex items-center flex-wrap justify-center gap-4 text-xs text-text-secondary mt-2",children:[(0,n.jsx)(p,{color:x.input,label:h("chart.legend.input")}),(0,n.jsx)(p,{color:x.cacheCreation,label:h("chart.legend.cacheWrite")}),(0,n.jsx)(p,{color:x.cacheRead,label:h("chart.legend.cacheRead")}),(0,n.jsx)(p,{color:x.output,label:h("chart.legend.output")})]})]}):(0,n.jsx)("div",{className:"".concat(r," flex items-center justify-center text-text-tertiary text-sm"),children:h("chart.empty")})}function p(e){let{color:t,label:r}=e;return(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"w-2.5 h-2.5 rounded-sm",style:{background:t}}),(0,n.jsx)("span",{children:r})]})}function b(e){let t=(0,m.kj)(),{locale:r}=(0,m.s9)();if(!e.active||!e.payload||!e.payload.length)return null;let a=e.payload[0].payload,s=a.input+a.output+a.cacheRead+a.cacheCreation;return(0,n.jsxs)("div",{className:"card-elevated border border-border-hi rounded-card p-3 text-xs min-w-[200px]",children:[(0,n.jsx)("div",{className:"font-medium text-text-primary mb-2",children:e.label}),(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)(g,{color:x.input,label:t("chart.legend.input"),value:a.input,locale:r}),(0,n.jsx)(g,{color:x.cacheCreation,label:t("chart.legend.cacheWrite"),value:a.cacheCreation,locale:r}),(0,n.jsx)(g,{color:x.cacheRead,label:t("chart.legend.cacheRead"),value:a.cacheRead,locale:r}),(0,n.jsx)(g,{color:x.output,label:t("chart.legend.output"),value:a.output,locale:r})]}),(0,n.jsxs)("div",{className:"mt-2 pt-2 border-t border-border flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.total")}),(0,n.jsx)("span",{className:"num-mono text-text-primary",children:(0,u.jh)(s,r)})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,n.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.cost")}),(0,n.jsx)("span",{className:"num-mono text-brand",children:(0,u.az)(a.cost)})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,n.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.requests")}),(0,n.jsx)("span",{className:"num-mono text-text-primary",children:a.requests})]})]})}function g(e){let{color:t,label:r,value:a,locale:s}=e;return(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-text-secondary",children:[(0,n.jsx)("span",{className:"w-2 h-2 rounded-sm",style:{background:t}}),r]}),(0,n.jsx)("span",{className:"num-mono text-text-primary",children:(0,u.jh)(a,s)})]})}},44512:(e,t,r)=>{"use strict";r.d(t,{OverviewToggle:()=>c});var n=r(95155),a=r(12115),s=r(25016),o=r(51148);let i="data-usage-overview",l="hidden";function c(){let e=(0,o.kj)(),[t,r]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{r(document.documentElement.getAttribute(i)===l)},[]),(0,n.jsxs)("button",{type:"button",onClick:function(){let e=!t;r(e);try{localStorage.setItem("ccgauge.usage.overview.hidden",e?"1":"0")}catch(e){}e?document.documentElement.setAttribute(i,l):document.documentElement.removeAttribute(i)},"aria-pressed":!t,title:e(t?"usage.overview.show":"usage.overview.hide"),className:(0,s.cn)("inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-button text-xs font-medium","border transition-colors duration-150",t?"border-border bg-bg-surface text-text-secondary hover:text-text-primary hover:bg-bg-surface-hi":"border-brand/40 bg-brand/12 text-brand hover:bg-brand/20 hover:border-brand/60"),children:[(0,n.jsx)(d,{open:!t}),(0,n.jsx)("span",{className:"hidden sm:inline",children:e("usage.overview.label")})]})}function d(e){let{open:t}=e;return(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:t?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z"}),(0,n.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("path",{d:"M9.88 9.88a3 3 0 0 0 4.24 4.24"}),(0,n.jsx)("path",{d:"M10.73 5.08A11 11 0 0 1 12 5c6.5 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),(0,n.jsx)("path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3.5 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),(0,n.jsx)("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]})})}},73896:(e,t,r)=>{"use strict";r.d(t,{RangePicker:()=>f});var n=r(95155),a=r(20063),s=r(12115),o=r(25016),i=r(51148),l=r(76243),c=r(76043),d=r(82006);function u(e){let{selected:t,onSelect:r,toDate:a}=e,{locale:s}=(0,i.s9)(),o="zh"===s?c.g:d.c,u=null!=a?a:new Date;return(0,n.jsx)(l.h,{mode:"range",locale:o,selected:t,onSelect:r,endMonth:u,disabled:{after:u},numberOfMonths:1})}let m=[{value:"1d",tk:"range.today"},{value:"7d",tk:"range.7d"},{value:"30d",tk:"range.30d"},{value:"90d",tk:"range.90d"},{value:"all",tk:"range.all"}],x=/^\d{4}-\d{2}-\d{2}$/;function h(e){if(!x.test(e)||!x.exec(e))return!1;let t=Number(e.slice(0,4)),r=Number(e.slice(5,7)),n=Number(e.slice(8,10)),a=new Date(t,r-1,n);return!Number.isNaN(a.getTime())&&a.getFullYear()===t&&a.getMonth()===r-1&&a.getDate()===n}function p(e){if(!h(e))return;let t=Number(e.slice(0,4));return new Date(t,Number(e.slice(5,7))-1,Number(e.slice(8,10)))}function b(e){let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(r,"-").concat(n)}function g(e,t){if(!h(e))return e;let r=new Date(e+"T00:00:00");return new Intl.DateTimeFormat(t,{month:"short",day:"numeric"}).format(r)}function f(e){let{defaultValue:t="7d"}=e,r=(0,a.useRouter)(),l=(0,a.usePathname)(),c=(0,a.useSearchParams)(),{t:d,locale:x}=(0,i.s9)(),h=c.get("range")||t,f=m.some(e=>e.value===h),v="custom"===h,j=f?h:v?"custom":t,y=c.get("from")||"",w=c.get("to")||"",[N,k]=(0,s.useState)(!1),[S,C]=(0,s.useState)(()=>({from:p(y),to:p(w)})),R=(0,s.useRef)(null);(0,s.useEffect)(()=>{C({from:p(y),to:p(w)})},[y,w,N]),(0,s.useEffect)(()=>{if(N)return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)};function e(e){R.current&&!R.current.contains(e.target)&&k(!1)}function t(e){"Escape"===e.key&&k(!1)}},[N]);let T=v&&y?w?"".concat(g(y,x)," – ").concat(g(w,x)):"".concat(g(y,x)," →"):d("range.custom"),K=(null==S?void 0:S.from)?new Intl.DateTimeFormat(x,{year:"numeric",month:"short",day:"numeric"}).format(S.from):"",E=(null==S?void 0:S.to)?new Intl.DateTimeFormat(x,{year:"numeric",month:"short",day:"numeric"}).format(S.to):"";return(0,n.jsxs)("div",{ref:R,className:"flex items-center gap-1",children:[(0,n.jsx)("div",{role:"radiogroup","aria-label":d("range.label"),className:"inline-flex rounded-button border border-border bg-bg-surface p-0.5 gap-0.5",children:m.map(e=>{let t=j===e.value;return(0,n.jsx)("button",{role:"radio","aria-checked":t,tabIndex:t?0:-1,onClick:()=>(function(e){let t=new URLSearchParams(c.toString());t.set("range",e),t.delete("from"),t.delete("to"),r.push("".concat(l,"?").concat(t.toString())),k(!1)})(e.value),className:(0,o.cn)("px-2.5 py-1 text-xs rounded transition-all","focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40",t?"bg-brand-strong text-white font-semibold shadow-sm ring-1 ring-brand/40":"text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:d(e.tk)},e.value)})}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsxs)("button",{type:"button","aria-haspopup":"dialog","aria-expanded":N,onClick:()=>k(e=>!e),className:(0,o.cn)("px-2.5 py-1 text-xs rounded-button border transition-all inline-flex items-center gap-1","focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40",v?"bg-brand-strong text-white font-semibold shadow-sm ring-1 ring-brand/40 border-transparent":"border-border bg-bg-surface text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:[(0,n.jsx)("span",{children:T}),(0,n.jsx)("span",{"aria-hidden":!0,className:(0,o.cn)(v?"text-white/80":"text-text-tertiary"),children:"▾"})]}),N&&(0,n.jsxs)("div",{role:"dialog","aria-label":d("range.custom"),className:"absolute right-0 mt-1.5 z-20 w-[324px] rounded-card border border-border-hi bg-bg-elevated shadow-popover",children:[(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-3 px-4 pt-4 pb-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("div",{className:"label",children:d("range.from")}),(0,n.jsx)("div",{className:(0,o.cn)("mt-1 text-sm tabular-nums truncate",(null==S?void 0:S.from)?"text-text-primary font-semibold":"text-text-tertiary"),children:(null==S?void 0:S.from)?K:"—"})]}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("div",{className:"label",children:d("range.to")}),(0,n.jsx)("div",{className:(0,o.cn)("mt-1 text-sm tabular-nums truncate",(null==S?void 0:S.to)?"text-text-primary font-semibold":"text-text-tertiary"),children:(null==S?void 0:S.to)?E:"—"})]})]}),(0,n.jsx)("div",{className:"divider-soft"}),(0,n.jsx)("div",{className:"px-3 pt-3 pb-2 flex justify-center",children:(0,n.jsx)(u,{selected:S,onSelect:C})}),(0,n.jsx)("div",{className:"divider-soft"}),(0,n.jsxs)("div",{className:"flex justify-end gap-2 px-4 py-3",children:[(0,n.jsx)("button",{type:"button",onClick:()=>k(!1),className:"btn-ghost text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40",children:d("range.cancel")}),(0,n.jsx)("button",{type:"button",onClick:function(){let e=null==S?void 0:S.from;if(!e)return;let t=null==S?void 0:S.to,n=new URLSearchParams(c.toString());n.set("range","custom"),n.set("from",b(e)),t?n.set("to",b(t)):n.delete("to"),r.push("".concat(l,"?").concat(n.toString())),k(!1)},disabled:!(null==S?void 0:S.from),className:(0,o.cn)("inline-flex items-center justify-center px-3 py-1.5 rounded-button text-sm font-semibold transition-colors","bg-brand-strong text-white","hover:bg-brand-hover","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-brand-strong","focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40"),children:d("range.customApply")})]})]})]})]})}},77549:(e,t,r)=>{"use strict";r.d(t,{AutoRefresh:()=>s});var n=r(12115),a=r(20063);function s(e){let{intervalMs:t=15e3}=e,r=(0,a.useRouter)(),s=(0,n.useRef)(!1);return(0,n.useEffect)(()=>{if(t<=0)return;let e=null;function n(){if(!document.hidden&&!s.current){s.current=!0;try{r.refresh()}finally{Promise.resolve().then(()=>{s.current=!1})}}}return e=window.setInterval(n,t),document.addEventListener("visibilitychange",n),()=>{null!==e&&window.clearInterval(e),document.removeEventListener("visibilitychange",n)}},[r,t]),null}},86384:(e,t,r)=>{"use strict";r.d(t,{GranularityPicker:()=>d});var n=r(95155),a=r(20063),s=r(12115),o=r(25016),i=r(51148);function l(e){let{paramKey:t,defaultValue:r,options:l,ariaLabel:c}=e,d=(0,a.useRouter)(),u=(0,a.usePathname)(),m=(0,a.useSearchParams)(),x=(0,i.kj)(),h=m.get(t)||r,p=l.some(e=>e.value===h)?h:r,b=(0,s.useRef)(null);function g(e){let r=new URLSearchParams(m.toString());r.set(t,e),d.push("".concat(u,"?").concat(r.toString()))}return(0,n.jsx)("div",{ref:b,role:"radiogroup","aria-label":c,onKeyDown:function(e){var t,r;if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();let n=(l.findIndex(e=>e.value===p)+("ArrowRight"===e.key?1:-1)+l.length)%l.length;g(l[n].value);let a=null==(t=b.current)?void 0:t.querySelectorAll('button[role="radio"]');null==a||null==(r=a[n])||r.focus()},className:"inline-flex rounded-button border border-border bg-bg-surface p-0.5 gap-0.5",children:l.map(e=>{let t=p===e.value;return(0,n.jsx)("button",{role:"radio","aria-checked":t,tabIndex:t?0:-1,onClick:()=>g(e.value),className:(0,o.cn)("px-2.5 py-1 text-xs rounded transition-all","focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40",t?"bg-brand-strong text-white font-semibold shadow-sm ring-1 ring-brand/40":"text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:x(e.tk)},e.value)})})}let c=[{value:"hour",tk:"gran.hour"},{value:"day",tk:"gran.day"},{value:"week",tk:"gran.week"},{value:"month",tk:"gran.month"}];function d(e){let{defaultValue:t="day"}=e,r=(0,i.kj)();return(0,n.jsx)(l,{paramKey:"gran",defaultValue:t,options:c,ariaLabel:r("gran.label")})}}},e=>{e.O(0,[760,930,253,148,441,255,358],()=>e(e.s=36392)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[430],{8336:(e,t,r)=>{"use strict";r.d(t,{ModelFilter:()=>o});var n=r(95155),a=r(35850),s=r(25016),i=r(51148);function o(e){let{all:t,selected:r}=e,o=(0,i.kj)();return(0,n.jsx)(a.K,{paramKey:"models",all:t,selected:r,render:s.P6,labelAllKey:"filter.modelAll",labelSingleKey:"filter.modelSingle",labelMultiKey:"filter.modelMulti",ariaLabel:o("filter.modelLabel")})}},14920:(e,t,r)=>{"use strict";r.d(t,{ProjectFilter:()=>o});var n=r(95155),a=r(35850),s=r(25016),i=r(51148);function o(e){let{all:t,selected:r}=e,o=(0,i.kj)();return(0,n.jsx)(a.K,{paramKey:"projects",all:t,selected:r,render:s.PJ,labelAllKey:"filter.projectAll",labelSingleKey:"filter.projectSingle",labelMultiKey:"filter.projectMulti",ariaLabel:o("filter.projectLabel")})}},20857:(e,t,r)=>{"use strict";r.d(t,{H:()=>i});var n=r(95155),a=r(12115),s=r(25016);function i(e){let{children:t,className:r}=e,i=(0,a.useRef)(null),[o,l]=(0,a.useState)(!1),[c,d]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=i.current;if(!e)return;function t(){if(!e)return;let{scrollLeft:t,scrollWidth:r,clientWidth:n}=e;l(t>4),d(t+n<r-4)}t(),e.addEventListener("scroll",t,{passive:!0});let r=new ResizeObserver(t);return r.observe(e),()=>{e.removeEventListener("scroll",t),r.disconnect()}},[]),(0,n.jsxs)("div",{className:(0,s.cn)("relative",r),children:[(0,n.jsx)("div",{ref:i,className:"overflow-x-auto",children:t}),(0,n.jsx)("div",{"aria-hidden":!0,className:(0,s.cn)("pointer-events-none absolute left-0 top-0 bottom-0 w-8 bg-gradient-to-r from-bg-surface to-transparent transition-opacity duration-150",o?"opacity-100":"opacity-0")}),(0,n.jsx)("div",{"aria-hidden":!0,className:(0,s.cn)("pointer-events-none absolute right-0 top-0 bottom-0 w-8 bg-gradient-to-l from-bg-surface to-transparent transition-opacity duration-150",c?"opacity-100":"opacity-0")})]})}},25016:(e,t,r)=>{"use strict";r.d(t,{BC:()=>h,P6:()=>b,PJ:()=>x,R8:()=>d,a3:()=>u,az:()=>l,cn:()=>s,jh:()=>o,l7:()=>c,r6:()=>m});var n=r(2821),a=r(75889);function s(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,a.QP)((0,n.$)(t))}function i(e,t){var r;return new Intl.NumberFormat("en-US",{maximumFractionDigits:null!=(r=null==t?void 0:t.maxFrac)?r:0}).format(e)}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en";return Number.isFinite(e)?"zh"===t?e>=1e8?(e/1e8).toFixed(2)+"亿":e>=1e4?(e/1e4).toFixed(1)+"万":i(e):e>=1e9?(e/1e9).toFixed(2)+"B":e>=1e6?(e/1e6).toFixed(2)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":i(e):"0"}function l(e,t){var r,n;return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:null!=(r=null==t?void 0:t.minFrac)?r:2,maximumFractionDigits:null!=(n=null==t?void 0:t.maxFrac)?n:2}).format(e)}function c(e){return 0===e?"$0":e<.01?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:6}).format(e):l(e)}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Number.isFinite(e)?"".concat((100*e).toFixed(t),"%"):"0%"}function u(e){if(e<1e3)return"".concat(e,"ms");let t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");let r=Math.floor(t/60);if(r<60){let e=t%60;return e?"".concat(r,"m ").concat(e,"s"):"".concat(r,"m")}let n=Math.floor(r/60),a=r%60;return a?"".concat(n,"h ").concat(a,"m"):"".concat(n,"h")}function m(e){let t="string"==typeof e||"number"==typeof e?new Date(e):e;if(Number.isNaN(t.getTime()))return"";let r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0");return"".concat(r,"-").concat(n,"-").concat(a," ").concat(s,":").concat(i,":").concat(o)}function x(e){if(!e)return"(unknown)";let t=e.replace(/[/\\]+$/,"").split(/[/\\]+/);return t[t.length-1]||e}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e?e.replace(/-/g,"").slice(0,t):""}let p={mini:"Mini",nano:"Nano",pro:"Pro",turbo:"Turbo",preview:"Preview"};function b(e){if(!e)return"(unknown)";let t=e.replace(/^(vertex_ai|bedrock|anthropic|openai)\//,""),r=t.toLowerCase();if(r.startsWith("gpt-")||/^o\d/.test(r))return r.startsWith("gpt-")?"GPT-"+t.slice(4).split("-").map(e=>{var t;return null!=(t=p[e.toLowerCase()])?t:e}).join(" "):t.toUpperCase();let n=t.replace(/-(\d{8})$/,""),a=(n=n.replace(/^claude-/,"")).split("-");if(a.length>=2){let e=a[0],t=a.slice(1).join(".");return f(e)+" "+t}return f(n.replace(/-/g," "))}function f(e){return e.replace(/\b\w/g,e=>e.toUpperCase())}},25577:(e,t,r)=>{"use strict";r.d(t,{UsageTable:()=>h});var n=r(95155),a=r(12115),s=r(20063),i=r(25016),o=r(51148),l=r(47650);function c(e){let{children:t,content:r,className:s,panelClassName:o,align:c="left",delay:d=100,maxWidth:u=360}=e,m=(0,a.useRef)(null),x=(0,a.useRef)(null),h=(0,a.useRef)(null),[p,b]=(0,a.useState)(null),[f,g]=(0,a.useState)(!1),[v,j]=(0,a.useState)(!1);function y(){h.current&&(window.clearTimeout(h.current),h.current=null),v||(x.current=window.setTimeout(()=>{let e=function(){let e,t=m.current;if(!t)return null;let r=t.getBoundingClientRect(),n=Math.min(u,window.innerWidth-16),a=window.innerHeight-r.bottom<200?"top":"bottom";return"right"===c?(e=Math.min(r.right,window.innerWidth-8))-n<8&&(e=n+8):(e=Math.max(r.left,8))+n>window.innerWidth-8&&(e=window.innerWidth-n-8),{x:e,y:"bottom"===a?r.bottom+8:r.top-8,placement:a,align:c}}();e&&(b(e),j(!0))},d))}function w(){x.current&&(window.clearTimeout(x.current),x.current=null),h.current=window.setTimeout(()=>j(!1),80)}return(0,a.useEffect)(()=>g(!0),[]),(0,a.useEffect)(()=>()=>{x.current&&window.clearTimeout(x.current),h.current&&window.clearTimeout(h.current)},[]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{ref:m,onMouseEnter:y,onMouseLeave:w,onFocus:y,onBlur:w,className:(0,i.cn)("inline-block",s),children:t}),f&&p&&(0,l.createPortal)((0,n.jsx)("div",{onMouseEnter:()=>{h.current&&(window.clearTimeout(h.current),h.current=null)},onMouseLeave:w,style:{position:"fixed",left:"right"===p.align?void 0:p.x,right:"right"===p.align?window.innerWidth-p.x:void 0,top:"bottom"===p.placement?p.y:void 0,bottom:"top"===p.placement?window.innerHeight-p.y:void 0,maxWidth:u,transform:v?"translateY(0) scale(1)":"bottom"===p.placement?"translateY(-4px) scale(0.98)":"translateY(4px) scale(0.98)",opacity:+!!v,transitionProperty:"opacity, transform",transitionDuration:"120ms",transitionTimingFunction:"cubic-bezier(0.16, 1, 0.3, 1)",transformOrigin:"bottom"===p.placement?"top":"bottom",pointerEvents:v?"auto":"none"},className:(0,i.cn)("z-50 card border-border-hi shadow-xl rounded-button",o),children:r}),document.body)]})}var d=r(20857);let u=[{id:"time",labelKey:"usage.col.time",sortKey:"timestamp",defaultVisible:!0},{id:"duration",labelKey:"usage.col.duration",align:"right",sortKey:"durationMs",defaultVisible:!1},{id:"prompt",labelKey:"usage.col.userMessage",defaultVisible:!0},{id:"model",labelKey:"usage.col.model",defaultVisible:!0},{id:"project",labelKey:"usage.col.project",defaultVisible:!0},{id:"session",labelKey:"usage.col.session",defaultVisible:!1},{id:"calls",labelKey:"usage.col.calls",align:"right",sortKey:"callCount",defaultVisible:!1},{id:"input",labelKey:"usage.col.input",align:"right",sortKey:"inputTokens",defaultVisible:!1},{id:"output",labelKey:"usage.col.output",align:"right",sortKey:"outputTokens",defaultVisible:!1},{id:"cacheRead",labelKey:"usage.col.cacheRead",align:"right",sortKey:"cacheReadTokens",defaultVisible:!1},{id:"cacheWrite",labelKey:"usage.col.cacheWrite",align:"right",sortKey:"cacheCreationTokens",defaultVisible:!1},{id:"total",labelKey:"usage.col.total",align:"right",sortKey:"totalTokens",defaultVisible:!0},{id:"cost",labelKey:"usage.col.cost",align:"right",sortKey:"cost",defaultVisible:!1},{id:"tools",labelKey:"usage.col.tools",defaultVisible:!1}],m="ccgauge.usage.cols.v4";function x(){return u.reduce((e,t)=>(e[t.id]=t.defaultVisible,e),{})}function h(e){let{rows:t,totalCount:r,page:i,pageCount:l,sort:c,query:h}=e,b=(0,o.kj)(),{locale:g}=(0,o.s9)(),v=(0,s.useRouter)(),j=(0,s.usePathname)(),y=(0,s.useSearchParams)(),[w,N]=(0,a.useState)(new Set),[k,S]=(0,a.useState)(x),[C,R]=(0,a.useState)(!1),[T,E]=(0,a.useState)(h),K=(0,a.useRef)(null),L=(0,a.useRef)(null);function P(e){let t=new URLSearchParams(y.toString());for(let[r,n]of Object.entries(e))void 0===n||""===n?t.delete(r):t.set(r,n);let r=t.toString();v.push(r?"".concat(j,"?").concat(r):j)}function M(e){P({page:e>0?String(e+1):void 0})}(0,a.useEffect)(()=>{S(function(){try{let e=window.localStorage.getItem(m);if(!e)return x();let t=JSON.parse(e),r=x();for(let e of u)"boolean"==typeof t[e.id]&&(r[e.id]=t[e.id]);return r}catch(e){return x()}}())},[]),(0,a.useEffect)(()=>{window.localStorage.setItem(m,JSON.stringify(k))},[k]),(0,a.useEffect)(()=>{E(h)},[h]),(0,a.useEffect)(()=>{function e(e){K.current&&!K.current.contains(e.target)&&R(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,a.useEffect)(()=>()=>{L.current&&(window.clearTimeout(L.current),L.current=null)},[]);let F=u.filter(e=>k[e.id]),A=F.length+1,D=F.length;return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 mb-3 flex-wrap",children:[(0,n.jsx)("input",{value:T,onChange:e=>{var t;E(t=e.target.value),L.current&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>{P({q:t.trim()||void 0,page:void 0})},300)},placeholder:b("common.searchPlaceholder"),className:"px-3 py-1.5 text-sm rounded-button border border-border bg-bg-surface focus:outline-none focus:border-border-hi w-72 placeholder:text-text-tertiary text-text-primary"}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("span",{className:"text-xs text-text-tertiary tabular-nums",children:b("common.rows",{count:r.toLocaleString()})}),(0,n.jsxs)("div",{ref:K,className:"relative",children:[(0,n.jsxs)("button",{onClick:()=>R(e=>!e),className:"btn",children:[b("usage.columns.button"),(0,n.jsx)("span",{className:"ml-1 text-text-tertiary tabular-nums",children:D})]}),C&&(0,n.jsxs)("div",{className:"absolute right-0 mt-1 w-56 card border-border-hi shadow-lg p-2 z-30",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-1.5 pb-1.5 mb-1 border-b border-border",children:[(0,n.jsx)("span",{className:"text-xs text-text-tertiary uppercase tracking-wide",children:b("usage.columns.title")}),(0,n.jsx)("button",{onClick:()=>S(x()),className:"text-xs text-text-tertiary hover:text-text-primary",children:b("usage.columns.reset")})]}),(0,n.jsx)("div",{className:"max-h-72 overflow-auto",children:u.map(e=>(0,n.jsxs)("label",{className:"flex items-center gap-2 px-1.5 py-1.5 text-sm rounded hover:bg-bg-surface-hi cursor-pointer",children:[(0,n.jsx)("input",{type:"checkbox",checked:!!k[e.id],onChange:t=>S(r=>({...r,[e.id]:t.target.checked})),className:"accent-brand"}),(0,n.jsx)("span",{className:"text-text-secondary",children:b(e.labelKey)})]},e.id))})]})]}),(0,n.jsx)("button",{onClick:function(){let e=new URLSearchParams(y.toString());window.location.href="/api/export/usage?".concat(e.toString())},className:"btn",children:b("common.exportCsv")})]})]}),(0,n.jsx)("div",{className:"card overflow-hidden",children:(0,n.jsx)(d.H,{children:(0,n.jsxs)("table",{className:"w-full text-sm",children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{className:"border-b border-border bg-bg-surface-hi/30",children:[(0,n.jsx)(f,{children:(0,n.jsx)("span",{className:"sr-only",children:"expand"})}),F.map(e=>(0,n.jsx)(f,{align:e.align,sorted:!!e.sortKey&&c.key===e.sortKey,dir:c.dir,onClick:e.sortKey?()=>{var t;let r;return t=e.sortKey,r="desc",void(c.key===t&&(r="asc"===c.dir?"desc":"asc"),P({sort:"timestamp"===t?void 0:t,dir:"desc"===r?void 0:r,page:void 0}))}:void 0,children:b(e.labelKey)},e.id))]})}),(0,n.jsxs)("tbody",{children:[t.map(e=>{let t=w.has(e.turnId),r=e.userText.trim()||b("usage.turn.noPrompt");return(0,n.jsx)(p,{turn:e,isOpen:t,onToggle:()=>{var t;return t=e.turnId,void N(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})},userText:r,expandLabel:b("usage.turn.expand"),collapseLabel:b("usage.turn.collapse"),activeColumns:F,locale:g,t:b},e.turnId)}),0===t.length&&(0,n.jsx)("tr",{children:(0,n.jsx)("td",{colSpan:A,className:"px-3 py-8 text-center text-text-tertiary text-sm",children:b("common.noMatchingRows")})})]})]})})}),l>1&&(0,n.jsxs)("div",{className:"flex items-center justify-between mt-3 text-xs text-text-secondary",children:[(0,n.jsx)("span",{children:b("common.pageOf",{page:i+1,total:l})}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("button",{onClick:()=>M(0),disabled:0===i,className:"btn-ghost disabled:opacity-40",children:b("common.first")}),(0,n.jsx)("button",{onClick:()=>M(i-1),disabled:0===i,className:"btn-ghost disabled:opacity-40",children:b("common.prev")}),(0,n.jsx)("button",{onClick:()=>M(i+1),disabled:i>=l-1,className:"btn-ghost disabled:opacity-40",children:b("common.next")}),(0,n.jsx)("button",{onClick:()=>M(l-1),disabled:i>=l-1,className:"btn-ghost disabled:opacity-40",children:b("common.last")})]})]})]})}function p(e){let{turn:t,isOpen:r,onToggle:a,userText:s,expandLabel:o,collapseLabel:l,activeColumns:d,locale:u,t:m}=e,x=(1===t.models.length?(0,i.P6)(t.models[0]):"".concat((0,i.P6)(t.models[0])," +").concat(t.models.length-1))+(t.efforts.length?1===t.efforts.length?" \xb7 ".concat(t.efforts[0]):" \xb7 ".concat(t.efforts[0],"+").concat(t.efforts.length-1):""),h=t.toolNames.length?t.toolNames.slice(0,3).join(", ")+(t.toolNames.length>3?"…":""):"—";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("tr",{className:"border-b border-border last:border-b-0 hover:bg-bg-surface-hi/40 cursor-pointer",onClick:a,children:[(0,n.jsx)("td",{className:"px-2 py-2 text-text-tertiary w-6 text-center select-none",children:(0,n.jsx)("span",{title:r?l:o,className:"inline-block w-4",children:r?"▾":"▸"})}),d.map(e=>(0,n.jsx)("td",{className:(0,i.cn)("px-3 py-2","right"===e.align?"text-right":"text-left"),children:function(e,t,r,a,s,o,l){switch(e){case"time":return(0,n.jsx)("span",{className:"num-mono text-text-secondary whitespace-nowrap text-xs",title:"started ".concat((0,i.r6)(t.timestamp),"\nended ").concat((0,i.r6)(t.endTimestamp)),children:(0,i.r6)(t.timestamp)});case"duration":return(0,n.jsx)("span",{className:"num-mono text-text-secondary whitespace-nowrap text-xs",title:"".concat((0,i.r6)(t.timestamp)," → ").concat((0,i.r6)(t.endTimestamp)),children:(0,i.a3)(t.durationMs)});case"prompt":return(0,n.jsx)(c,{maxWidth:460,panelClassName:"p-3 text-sm text-text-secondary leading-relaxed",content:(0,n.jsx)("div",{className:"whitespace-pre-wrap break-words",children:s}),children:(0,n.jsx)("span",{className:"block text-text-secondary truncate max-w-[280px]",children:s})});case"model":return(0,n.jsx)("span",{className:"text-text-primary whitespace-nowrap",children:r});case"project":return(0,n.jsx)("span",{className:"block text-text-secondary truncate max-w-[180px]",title:t.cwd,children:t.projectLabel||(0,i.PJ)(t.cwd)});case"session":return(0,n.jsx)("span",{className:"num-mono text-text-tertiary text-xs",title:t.sessionId,children:(0,i.BC)(t.sessionId)});case"calls":return(0,n.jsx)("span",{className:"num-mono text-text-secondary",children:t.callCount});case"input":return(0,n.jsx)("span",{className:"num-mono text-text-secondary",children:(0,i.jh)(t.inputTokens,o)});case"output":return(0,n.jsx)("span",{className:"num-mono text-text-secondary",children:(0,i.jh)(t.outputTokens,o)});case"cacheRead":return(0,n.jsx)("span",{className:"num-mono text-success",children:(0,i.jh)(t.cacheReadTokens,o)});case"cacheWrite":return(0,n.jsx)("span",{className:"num-mono text-text-secondary",children:(0,i.jh)(t.cacheCreationTokens,o)});case"total":return(0,n.jsx)(c,{align:"right",maxWidth:300,panelClassName:"p-0 overflow-hidden",content:(0,n.jsx)(b,{row:t,locale:o,t:l}),children:(0,n.jsx)("span",{className:"num-mono text-text-primary font-medium border-b border-dashed border-border hover:border-text-tertiary cursor-help",children:(0,i.jh)(t.totalTokens,o)})});case"cost":return(0,n.jsx)("span",{className:"num-mono text-text-primary font-medium",children:(0,i.l7)(t.cost)});case"tools":return(0,n.jsx)("span",{className:"block text-xs text-text-tertiary truncate max-w-[160px]",title:t.toolNames.join(", "),children:a})}}(e.id,t,x,h,s,u,m)},e.id))]}),r&&t.children.map(e=>(0,n.jsxs)("tr",{className:"border-b border-border last:border-b-0 bg-bg-surface-hi/20 text-text-tertiary",children:[(0,n.jsx)("td",{className:"px-2 py-1.5 w-6"}),d.map(r=>(0,n.jsx)("td",{className:(0,i.cn)("px-3 py-1.5","right"===r.align?"text-right":"text-left"),children:function(e,t,r,a,s){switch(e){case"time":return(0,n.jsx)("span",{className:"num-mono whitespace-nowrap text-xs inline-block translate-x-5",children:(0,i.r6)(t.timestamp)});case"duration":return(0,n.jsx)("span",{className:"text-xs text-text-tertiary",children:"—"});case"prompt":{var o;let e=(null!=(o=t.directPrompt)?o:"").trim();if(e&&e!==r.trim())return(0,n.jsx)("span",{className:"block text-xs text-text-secondary truncate max-w-[320px]",title:e,children:e});if(!t.toolNames.length)return(0,n.jsx)("span",{className:"text-xs text-text-tertiary",children:"—"});let a=t.toolNames.join(", "),s=t.toolNames.slice(0,3).join(", ")+(t.toolNames.length>3?"…":"");return(0,n.jsx)("span",{className:"block text-xs text-text-secondary truncate max-w-[280px]",title:a,children:s})}case"model":return(0,n.jsxs)("span",{className:"whitespace-nowrap",children:[(0,i.P6)(t.model),t.effort?" \xb7 ".concat(t.effort):""]});case"project":return(0,n.jsx)("span",{className:"block truncate max-w-[180px]",title:t.cwd,children:t.projectLabel||(0,i.PJ)(t.cwd)});case"session":return(0,n.jsx)("span",{className:"num-mono text-xs",title:t.sessionId,children:(0,i.BC)(t.sessionId)});case"calls":return(0,n.jsx)("span",{className:"num-mono",children:"1"});case"input":return(0,n.jsx)("span",{className:"num-mono",children:(0,i.jh)(t.inputTokens,a)});case"output":return(0,n.jsx)("span",{className:"num-mono",children:(0,i.jh)(t.outputTokens,a)});case"cacheRead":return(0,n.jsx)("span",{className:"num-mono text-success",children:(0,i.jh)(t.cacheReadTokens,a)});case"cacheWrite":return(0,n.jsx)("span",{className:"num-mono",children:(0,i.jh)(t.cacheCreationTokens,a)});case"total":return(0,n.jsx)(c,{align:"right",maxWidth:300,panelClassName:"p-0 overflow-hidden",content:(0,n.jsx)(b,{row:t,locale:a,t:s}),children:(0,n.jsx)("span",{className:"num-mono border-b border-dashed border-border/60 hover:border-text-tertiary cursor-help",children:(0,i.jh)(t.totalTokens,a)})});case"cost":return(0,n.jsx)("span",{className:"num-mono",children:(0,i.l7)(t.cost)});case"tools":return(0,n.jsx)("span",{className:"block text-xs truncate max-w-[160px]",title:t.toolNames.join(", "),children:t.toolNames.length?t.toolNames.join(", "):"—"})}}(r.id,e,t.userText,u,m)},r.id))]},e.uuid))]})}function b(e){let{row:t,locale:r,t:s}=e,o=[{key:"input",label:s("usage.col.input"),tokens:t.inputTokens,cost:t.costInput,tone:"text-text-primary",dot:"bg-chart-input"},{key:"output",label:s("usage.col.output"),tokens:t.outputTokens,cost:t.costOutput,tone:"text-text-primary",dot:"bg-chart-output"},{key:"cacheRead",label:s("usage.col.cacheRead"),tokens:t.cacheReadTokens,cost:t.costCacheRead,tone:"text-success",dot:"bg-chart-cache-read"},{key:"cacheWrite",label:s("usage.col.cacheWrite"),tokens:t.cacheCreationTokens,cost:t.costCacheWrite,tone:"text-text-primary",dot:"bg-chart-cache-create"}];return(0,n.jsxs)("div",{className:"text-xs",children:[(0,n.jsx)("div",{className:"px-3 py-2 border-b border-border bg-bg-surface-hi/40 text-text-tertiary uppercase tracking-wide font-medium",children:s("usage.breakdown.title")}),(0,n.jsxs)("div",{className:"px-3 py-2",children:[(0,n.jsxs)("div",{className:"grid grid-cols-[auto_1fr_auto] gap-x-3 gap-y-1.5 items-center",children:[(0,n.jsx)("span",{}),(0,n.jsx)("span",{className:"text-text-tertiary text-[10px] uppercase tracking-wide text-right",children:s("usage.breakdown.headerTokens")}),(0,n.jsx)("span",{className:"text-text-tertiary text-[10px] uppercase tracking-wide text-right",children:s("usage.breakdown.headerCost")}),o.map(e=>(0,n.jsxs)(a.Fragment,{children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-2 text-text-secondary",children:[(0,n.jsx)("span",{className:(0,i.cn)("w-2 h-2 rounded-sm",e.dot)}),e.label]}),(0,n.jsx)("span",{className:(0,i.cn)("num-mono text-right",e.tone),children:(0,i.jh)(e.tokens,r)}),(0,n.jsx)("span",{className:"num-mono text-right text-text-secondary",children:(0,i.l7)(e.cost)}),"output"===e.key&&t.reasoningTokens>0&&(0,n.jsxs)(a.Fragment,{children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-2 text-text-tertiary pl-4 text-[11px]",children:[(0,n.jsx)("span",{className:"text-text-tertiary",children:"↳"}),s("usage.breakdown.reasoning")]}),(0,n.jsx)("span",{className:"num-mono text-right text-text-tertiary text-[11px]",children:(0,i.jh)(t.reasoningTokens,r)}),(0,n.jsx)("span",{className:"text-right text-text-tertiary text-[11px]",children:s("usage.breakdown.reasoningNote")})]},"reasoning-detail")]},e.key))]}),(0,n.jsxs)("div",{className:"mt-2 pt-2 border-t border-border grid grid-cols-[auto_1fr_auto] gap-x-3 items-center",children:[(0,n.jsx)("span",{className:"text-text-secondary font-medium",children:s("usage.breakdown.total")}),(0,n.jsx)("span",{className:"num-mono text-right text-text-primary font-medium",children:(0,i.jh)(t.totalTokens,r)}),(0,n.jsx)("span",{className:"num-mono text-right text-text-primary font-medium",children:(0,i.l7)(t.cost)})]})]})]})}function f(e){let{children:t,align:r="left",sorted:a,dir:s,onClick:o}=e;return(0,n.jsx)("th",{className:(0,i.cn)("px-3 py-2 text-xs font-medium text-text-tertiary uppercase tracking-wide whitespace-nowrap","right"===r?"text-right":"text-left",o&&"cursor-pointer hover:text-text-primary select-none"),onClick:o,children:(0,n.jsxs)("span",{className:"inline-flex items-center gap-1",children:[t,a&&(0,n.jsx)("span",{className:"text-[10px]",children:"asc"===s?"▲":"▼"})]})})}},35850:(e,t,r)=>{"use strict";r.d(t,{K:()=>l});var n=r(95155),a=r(20063),s=r(12115),i=r(25016),o=r(51148);function l(e){let t,{paramKey:r,all:l,selected:c,render:d=e=>e,labelAllKey:u,labelSingleKey:m,labelMultiKey:x,ariaLabel:h,searchThreshold:p=6}=e,b=(0,a.useRouter)(),f=(0,a.usePathname)(),g=(0,a.useSearchParams)(),v=(0,o.kj)(),[j,y]=(0,s.useState)(!1),[w,N]=(0,s.useState)(""),[k,S]=(0,s.useState)(0),C=(0,s.useRef)(null),R=(0,s.useRef)(null),T=(0,s.useRef)(null),E=(0,s.useRef)(null),K=(0,s.useId)(),L=(0,s.useId)();(0,s.useEffect)(()=>{if(j)return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)};function e(e){C.current&&!C.current.contains(e.target)&&y(!1)}function t(e){if("Escape"===e.key){var t;y(!1),null==(t=R.current)||t.focus()}}},[j]),(0,s.useEffect)(()=>{j&&l.length>=p&&requestAnimationFrame(()=>{var e;return null==(e=T.current)?void 0:e.focus()}),j||(N(""),S(0))},[j,l.length,p]);let P=(0,s.useMemo)(()=>{let e=w.trim().toLowerCase();return e?l.filter(t=>d(t).toLowerCase().includes(e)||t.toLowerCase().includes(e)):l},[l,w,d]);function M(e){let t=new URLSearchParams(g.toString());0===e.size?t.delete(r):t.set(r,Array.from(e).join(","));let n=t.toString();b.push(n?"".concat(f,"?").concat(n):f)}function F(e){let t=new Set(c);t.has(e)?t.delete(e):t.add(e),M(t)}function A(e){if("ArrowDown"===e.key)e.preventDefault(),S(e=>Math.min(P.length-1,e+1));else if("ArrowUp"===e.key)e.preventDefault(),S(e=>Math.max(0,e-1));else if("Enter"===e.key){e.preventDefault();let t=P[k];t&&F(t)}else"Home"===e.key?(e.preventDefault(),S(0)):"End"===e.key&&(e.preventDefault(),S(P.length-1))}t=0===c.length?v(u):1===c.length?v(m,{value:d(c[0])}):v(x,{count:c.length});let D=l.length>=p;return(0,n.jsxs)("div",{ref:C,className:"relative",children:[(0,n.jsxs)("button",{ref:R,id:K,onClick:()=>y(e=>!e),className:"btn focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40","aria-haspopup":"listbox","aria-expanded":j,"aria-controls":L,"aria-label":h,children:[t,(0,n.jsx)("span",{className:"text-text-tertiary ml-1","aria-hidden":!0,children:"▾"})]}),j&&(0,n.jsxs)("div",{id:L,role:"listbox","aria-multiselectable":"true","aria-labelledby":K,className:"absolute right-0 mt-1 w-72 card border-border-hi shadow-lg z-20 overflow-hidden",children:[c.length>0&&(0,n.jsxs)("div",{className:"px-2 pt-2 pb-1.5 border-b border-border flex flex-wrap gap-1 items-center",children:[c.slice(0,6).map(e=>(0,n.jsxs)("button",{onClick:()=>F(e),className:"inline-flex items-center gap-1 max-w-[160px] pl-2 pr-1.5 py-0.5 text-[11px] rounded-full bg-brand/10 text-brand border border-brand/20 hover:bg-brand/15","aria-label":"Remove ".concat(d(e)),title:d(e),children:[(0,n.jsx)("span",{className:"truncate",children:d(e)}),(0,n.jsx)("span",{"aria-hidden":!0,className:"text-brand/70",children:"\xd7"})]},e)),c.length>6&&(0,n.jsxs)("span",{className:"text-[11px] text-text-tertiary px-1",children:["+",c.length-6]}),(0,n.jsx)("button",{onClick:function(){M(new Set)},className:"ml-auto text-[11px] text-text-tertiary hover:text-text-primary px-1.5 py-0.5",children:v("filter.clearAll")})]}),D&&(0,n.jsx)("div",{className:"p-2 border-b border-border",children:(0,n.jsx)("input",{ref:T,value:w,onChange:e=>{N(e.target.value),S(0)},onKeyDown:e=>{("ArrowDown"===e.key||"ArrowUp"===e.key||"Enter"===e.key||"Home"===e.key||"End"===e.key)&&A(e)},placeholder:v("common.searchPlaceholder"),className:"w-full px-2 py-1 text-sm rounded border border-border bg-bg-surface focus:outline-none focus:border-border-hi placeholder:text-text-tertiary text-text-primary"})}),(0,n.jsxs)("div",{ref:E,onKeyDown:A,className:"max-h-64 overflow-y-auto p-1 outline-none",tabIndex:-1,children:[0===P.length&&(0,n.jsx)("div",{className:"text-xs text-text-tertiary px-2 py-3 text-center",children:v("filter.noOptions")}),P.map((e,t)=>{let r=c.includes(e),a=t===k;return(0,n.jsxs)("button",{role:"option","aria-selected":r,onMouseEnter:()=>S(t),onClick:()=>F(e),className:(0,i.cn)("w-full text-left text-sm px-2 py-1.5 rounded flex items-center gap-2 transition-colors",a?"bg-bg-surface-hi":"hover:bg-bg-surface-hi",r&&"text-text-primary"),children:[(0,n.jsx)("span",{className:(0,i.cn)("w-3.5 h-3.5 rounded-sm border flex items-center justify-center text-[10px] flex-shrink-0",r?"bg-brand border-brand text-white":"border-border-hi"),"aria-hidden":!0,children:r?"✓":""}),(0,n.jsx)("span",{className:"truncate",children:d(e)})]},e)})]})]})]})}},36392:(e,t,r)=>{Promise.resolve().then(r.bind(r,77549)),Promise.resolve().then(r.bind(r,38059)),Promise.resolve().then(r.bind(r,86384)),Promise.resolve().then(r.bind(r,8336)),Promise.resolve().then(r.bind(r,44512)),Promise.resolve().then(r.bind(r,14920)),Promise.resolve().then(r.bind(r,73896)),Promise.resolve().then(r.bind(r,25577))},38059:(e,t,r)=>{"use strict";r.d(t,{TokenStackChart:()=>h});var n=r(95155),a=r(26991),s=r(94632),i=r(68425),o=r(47734),l=r(73697),c=r(23508),d=r(26736),u=r(25016),m=r(51148);let x={input:"rgb(var(--chart-input))",output:"rgb(var(--chart-output))",cacheRead:"rgb(var(--chart-cache-read))",cacheCreation:"rgb(var(--chart-cache-create))"};function h(e){let{data:t,height:r="h-72"}=e,h=(0,m.kj)(),{locale:f}=(0,m.s9)();return t.length?(0,n.jsxs)("div",{className:"".concat(r," w-full"),children:[(0,n.jsx)(a.u,{width:"100%",height:"100%",children:(0,n.jsxs)(s.E,{data:t,margin:{top:12,right:8,bottom:4,left:8},barCategoryGap:"22%",children:[(0,n.jsx)(i.d,{stroke:"rgb(var(--chart-grid))",strokeOpacity:.6,strokeDasharray:"3 3",vertical:!1}),(0,n.jsx)(o.W,{dataKey:"label",tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,interval:"preserveStartEnd",minTickGap:32,tickMargin:8}),(0,n.jsx)(l.h,{tickFormatter:e=>(0,u.jh)(Number(e),f),tick:{fill:"rgb(var(--chart-axis))",fontSize:11},tickLine:!1,axisLine:!1,width:56,tickMargin:4}),(0,n.jsx)(c.m,{content:(0,n.jsx)(b,{}),cursor:{fill:"rgb(var(--text-primary) / 0.05)",radius:4}}),(0,n.jsx)(d.y,{dataKey:"input",stackId:"a",fill:x.input,isAnimationActive:!1}),(0,n.jsx)(d.y,{dataKey:"cacheCreation",stackId:"a",fill:x.cacheCreation,isAnimationActive:!1}),(0,n.jsx)(d.y,{dataKey:"cacheRead",stackId:"a",fill:x.cacheRead,isAnimationActive:!1}),(0,n.jsx)(d.y,{dataKey:"output",stackId:"a",fill:x.output,radius:[4,4,0,0],isAnimationActive:!1})]})}),(0,n.jsxs)("div",{className:"flex items-center flex-wrap justify-center gap-4 text-xs text-text-secondary mt-2",children:[(0,n.jsx)(p,{color:x.input,label:h("chart.legend.input")}),(0,n.jsx)(p,{color:x.cacheCreation,label:h("chart.legend.cacheWrite")}),(0,n.jsx)(p,{color:x.cacheRead,label:h("chart.legend.cacheRead")}),(0,n.jsx)(p,{color:x.output,label:h("chart.legend.output")})]})]}):(0,n.jsx)("div",{className:"".concat(r," flex items-center justify-center text-text-tertiary text-sm"),children:h("chart.empty")})}function p(e){let{color:t,label:r}=e;return(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"w-2.5 h-2.5 rounded-sm",style:{background:t}}),(0,n.jsx)("span",{children:r})]})}function b(e){let t=(0,m.kj)(),{locale:r}=(0,m.s9)();if(!e.active||!e.payload||!e.payload.length)return null;let a=e.payload[0].payload,s=a.input+a.output+a.cacheRead+a.cacheCreation;return(0,n.jsxs)("div",{className:"card-elevated border border-border-hi rounded-card p-3 text-xs min-w-[200px]",children:[(0,n.jsx)("div",{className:"font-medium text-text-primary mb-2",children:e.label}),(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)(f,{color:x.input,label:t("chart.legend.input"),value:a.input,locale:r}),(0,n.jsx)(f,{color:x.cacheCreation,label:t("chart.legend.cacheWrite"),value:a.cacheCreation,locale:r}),(0,n.jsx)(f,{color:x.cacheRead,label:t("chart.legend.cacheRead"),value:a.cacheRead,locale:r}),(0,n.jsx)(f,{color:x.output,label:t("chart.legend.output"),value:a.output,locale:r})]}),(0,n.jsxs)("div",{className:"mt-2 pt-2 border-t border-border flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.total")}),(0,n.jsx)("span",{className:"num-mono text-text-primary",children:(0,u.jh)(s,r)})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,n.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.cost")}),(0,n.jsx)("span",{className:"num-mono text-brand",children:(0,u.az)(a.cost)})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,n.jsx)("span",{className:"text-text-secondary",children:t("chart.tooltip.requests")}),(0,n.jsx)("span",{className:"num-mono text-text-primary",children:a.requests})]})]})}function f(e){let{color:t,label:r,value:a,locale:s}=e;return(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-text-secondary",children:[(0,n.jsx)("span",{className:"w-2 h-2 rounded-sm",style:{background:t}}),r]}),(0,n.jsx)("span",{className:"num-mono text-text-primary",children:(0,u.jh)(a,s)})]})}},44512:(e,t,r)=>{"use strict";r.d(t,{OverviewToggle:()=>c});var n=r(95155),a=r(12115),s=r(25016),i=r(51148);let o="data-usage-overview",l="hidden";function c(){let e=(0,i.kj)(),[t,r]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{r(document.documentElement.getAttribute(o)===l)},[]),(0,n.jsxs)("button",{type:"button",onClick:function(){let e=!t;r(e);try{localStorage.setItem("ccgauge.usage.overview.hidden",e?"1":"0")}catch(e){}e?document.documentElement.setAttribute(o,l):document.documentElement.removeAttribute(o)},"aria-pressed":!t,title:e(t?"usage.overview.show":"usage.overview.hide"),className:(0,s.cn)("inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-button text-xs font-medium","border transition-colors duration-150",t?"border-border bg-bg-surface text-text-secondary hover:text-text-primary hover:bg-bg-surface-hi":"border-brand/40 bg-brand/12 text-brand hover:bg-brand/20 hover:border-brand/60"),children:[(0,n.jsx)(d,{open:!t}),(0,n.jsx)("span",{className:"hidden sm:inline",children:e("usage.overview.label")})]})}function d(e){let{open:t}=e;return(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:t?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z"}),(0,n.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("path",{d:"M9.88 9.88a3 3 0 0 0 4.24 4.24"}),(0,n.jsx)("path",{d:"M10.73 5.08A11 11 0 0 1 12 5c6.5 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),(0,n.jsx)("path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3.5 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),(0,n.jsx)("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]})})}},63847:(e,t,r)=>{"use strict";r.d(t,{j:()=>s});var n=r(95155),a=r(25016);function s(e){let{rect:t,variant:r="pill",className:s}=e;if(!t)return null;let i=8*("underline"===r);return(0,n.jsx)("span",{"aria-hidden":!0,className:(0,a.cn)("pointer-events-none absolute transition-[transform,width] duration-200 ease-out-soft","pill"===r?"inset-y-0 rounded bg-brand-strong shadow-sm":"-bottom-[12px] h-[2px] rounded-full bg-brand",s),style:{transform:"translateX(".concat(t.left+i,"px)"),width:Math.max(0,t.width-2*i)}})}},73896:(e,t,r)=>{"use strict";r.d(t,{RangePicker:()=>g});var n=r(95155),a=r(20063),s=r(12115),i=r(25016),o=r(51148),l=r(76243),c=r(76043),d=r(82006);function u(e){let{selected:t,onSelect:r,toDate:a}=e,{locale:s}=(0,o.s9)(),i="zh"===s?c.g:d.c,u=null!=a?a:new Date;return(0,n.jsx)(l.h,{mode:"range",locale:i,selected:t,onSelect:r,endMonth:u,disabled:{after:u},numberOfMonths:1})}let m=[{value:"1d",tk:"range.today"},{value:"7d",tk:"range.7d"},{value:"30d",tk:"range.30d"},{value:"90d",tk:"range.90d"},{value:"all",tk:"range.all"}],x=/^\d{4}-\d{2}-\d{2}$/;function h(e){if(!x.test(e)||!x.exec(e))return!1;let t=Number(e.slice(0,4)),r=Number(e.slice(5,7)),n=Number(e.slice(8,10)),a=new Date(t,r-1,n);return!Number.isNaN(a.getTime())&&a.getFullYear()===t&&a.getMonth()===r-1&&a.getDate()===n}function p(e){if(!h(e))return;let t=Number(e.slice(0,4));return new Date(t,Number(e.slice(5,7))-1,Number(e.slice(8,10)))}function b(e){let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(r,"-").concat(n)}function f(e,t){if(!h(e))return e;let r=new Date(e+"T00:00:00");return new Intl.DateTimeFormat(t,{month:"short",day:"numeric"}).format(r)}function g(e){let{defaultValue:t="7d"}=e,r=(0,a.useRouter)(),l=(0,a.usePathname)(),c=(0,a.useSearchParams)(),{t:d,locale:x}=(0,o.s9)(),h=c.get("range")||t,g=m.some(e=>e.value===h),v="custom"===h,j=g?h:v?"custom":t,y=c.get("from")||"",w=c.get("to")||"",[N,k]=(0,s.useState)(!1),[S,C]=(0,s.useState)(()=>({from:p(y),to:p(w)})),R=(0,s.useRef)(null);(0,s.useEffect)(()=>{C({from:p(y),to:p(w)})},[y,w,N]),(0,s.useEffect)(()=>{if(N)return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)};function e(e){R.current&&!R.current.contains(e.target)&&k(!1)}function t(e){"Escape"===e.key&&k(!1)}},[N]);let T=v&&y?w?"".concat(f(y,x)," – ").concat(f(w,x)):"".concat(f(y,x)," →"):d("range.custom"),E=(null==S?void 0:S.from)?new Intl.DateTimeFormat(x,{year:"numeric",month:"short",day:"numeric"}).format(S.from):"",K=(null==S?void 0:S.to)?new Intl.DateTimeFormat(x,{year:"numeric",month:"short",day:"numeric"}).format(S.to):"";return(0,n.jsxs)("div",{ref:R,className:"flex items-center gap-1",children:[(0,n.jsx)("div",{role:"radiogroup","aria-label":d("range.label"),className:"inline-flex rounded-button border border-border bg-bg-surface p-0.5 gap-0.5",children:m.map(e=>{let t=j===e.value;return(0,n.jsx)("button",{role:"radio","aria-checked":t,tabIndex:t?0:-1,onClick:()=>(function(e){let t=new URLSearchParams(c.toString());t.set("range",e),t.delete("from"),t.delete("to"),r.push("".concat(l,"?").concat(t.toString())),k(!1)})(e.value),className:(0,i.cn)("px-2.5 py-1 text-xs rounded transition-all","focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40",t?"bg-brand-strong text-white font-semibold shadow-sm ring-1 ring-brand/40":"text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:d(e.tk)},e.value)})}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsxs)("button",{type:"button","aria-haspopup":"dialog","aria-expanded":N,onClick:()=>k(e=>!e),className:(0,i.cn)("px-2.5 py-1 text-xs rounded-button border transition-all inline-flex items-center gap-1","focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40",v?"bg-brand-strong text-white font-semibold shadow-sm ring-1 ring-brand/40 border-transparent":"border-border bg-bg-surface text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:[(0,n.jsx)("span",{children:T}),(0,n.jsx)("span",{"aria-hidden":!0,className:(0,i.cn)(v?"text-white/80":"text-text-tertiary"),children:"▾"})]}),N&&(0,n.jsxs)("div",{role:"dialog","aria-label":d("range.custom"),className:"absolute right-0 mt-1.5 z-20 w-[324px] rounded-card border border-border-hi bg-bg-elevated shadow-popover",children:[(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-3 px-4 pt-4 pb-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("div",{className:"label",children:d("range.from")}),(0,n.jsx)("div",{className:(0,i.cn)("mt-1 text-sm tabular-nums truncate",(null==S?void 0:S.from)?"text-text-primary font-semibold":"text-text-tertiary"),children:(null==S?void 0:S.from)?E:"—"})]}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("div",{className:"label",children:d("range.to")}),(0,n.jsx)("div",{className:(0,i.cn)("mt-1 text-sm tabular-nums truncate",(null==S?void 0:S.to)?"text-text-primary font-semibold":"text-text-tertiary"),children:(null==S?void 0:S.to)?K:"—"})]})]}),(0,n.jsx)("div",{className:"divider-soft"}),(0,n.jsx)("div",{className:"px-3 pt-3 pb-2 flex justify-center",children:(0,n.jsx)(u,{selected:S,onSelect:C})}),(0,n.jsx)("div",{className:"divider-soft"}),(0,n.jsxs)("div",{className:"flex justify-end gap-2 px-4 py-3",children:[(0,n.jsx)("button",{type:"button",onClick:()=>k(!1),className:"btn-ghost text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40",children:d("range.cancel")}),(0,n.jsx)("button",{type:"button",onClick:function(){let e=null==S?void 0:S.from;if(!e)return;let t=null==S?void 0:S.to,n=new URLSearchParams(c.toString());n.set("range","custom"),n.set("from",b(e)),t?n.set("to",b(t)):n.delete("to"),r.push("".concat(l,"?").concat(n.toString())),k(!1)},disabled:!(null==S?void 0:S.from),className:(0,i.cn)("inline-flex items-center justify-center px-3 py-1.5 rounded-button text-sm font-semibold transition-colors","bg-brand-strong text-white","hover:bg-brand-hover","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-brand-strong","focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40"),children:d("range.customApply")})]})]})]})]})}},76669:(e,t,r)=>{"use strict";r.d(t,{S:()=>s});var n=r(12115);let a=n.useLayoutEffect;function s(e){let t=(0,n.useRef)(null),[r,s]=(0,n.useState)(null),i=(0,n.useCallback)(()=>{let r=t.current;if(!r)return;let n=r.querySelector('[data-tab="'.concat(e,'"]'));if(!n)return void s(null);s(e=>{let t={left:n.offsetLeft,width:n.offsetWidth};return e&&e.left===t.left&&e.width===t.width?e:t})},[e]);return a(()=>{i()},[i]),(0,n.useEffect)(()=>{let e=t.current;if(!e||"undefined"==typeof ResizeObserver)return;let r=new ResizeObserver(()=>i());for(let t of(r.observe(e),Array.from(e.children)))r.observe(t);return window.addEventListener("resize",i),()=>{r.disconnect(),window.removeEventListener("resize",i)}},[i]),{containerRef:t,rect:r}}},77549:(e,t,r)=>{"use strict";r.d(t,{AutoRefresh:()=>s});var n=r(12115),a=r(20063);function s(e){let{intervalMs:t=15e3}=e,r=(0,a.useRouter)(),s=(0,n.useRef)(!1);return(0,n.useEffect)(()=>{if(t<=0)return;let e=null;function n(){if(!document.hidden&&!s.current){s.current=!0;try{r.refresh()}finally{Promise.resolve().then(()=>{s.current=!1})}}}return e=window.setInterval(n,t),document.addEventListener("visibilitychange",n),()=>{null!==e&&window.clearInterval(e),document.removeEventListener("visibilitychange",n)}},[r,t]),null}},86384:(e,t,r)=>{"use strict";r.d(t,{GranularityPicker:()=>u});var n=r(95155),a=r(20063),s=r(25016),i=r(51148),o=r(76669),l=r(63847);function c(e){let{paramKey:t,defaultValue:r,options:c,ariaLabel:d}=e,u=(0,a.useRouter)(),m=(0,a.usePathname)(),x=(0,a.useSearchParams)(),h=(0,i.kj)(),p=x.get(t)||r,b=c.some(e=>e.value===p)?p:r,{containerRef:f,rect:g}=(0,o.S)(b),v=null===g;function j(e){let r=new URLSearchParams(x.toString());r.set(t,e),u.push("".concat(m,"?").concat(r.toString()))}return(0,n.jsx)("div",{className:"inline-flex rounded-button border border-border bg-bg-surface p-0.5",children:(0,n.jsxs)("div",{ref:f,role:"radiogroup","aria-label":d,onKeyDown:function(e){var t,r;if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();let n=(c.findIndex(e=>e.value===b)+("ArrowRight"===e.key?1:-1)+c.length)%c.length;j(c[n].value);let a=null==(t=f.current)?void 0:t.querySelectorAll('button[role="radio"]');null==a||null==(r=a[n])||r.focus()},className:"relative flex gap-0.5",children:[(0,n.jsx)(l.j,{rect:g,className:"ring-1 ring-brand/40"}),c.map(e=>{let t=b===e.value;return(0,n.jsx)("button",{role:"radio","data-tab":e.value,"aria-checked":t,tabIndex:t?0:-1,onClick:()=>j(e.value),className:(0,s.cn)("relative z-10 px-2.5 py-1 text-xs rounded transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-brand/40",t?(0,s.cn)("text-white font-semibold",v&&"bg-brand-strong shadow-sm ring-1 ring-brand/40"):"text-text-tertiary font-medium hover:text-text-primary hover:bg-bg-surface-hi"),children:h(e.tk)},e.value)})]})})}let d=[{value:"hour",tk:"gran.hour"},{value:"day",tk:"gran.day"},{value:"week",tk:"gran.week"},{value:"month",tk:"gran.month"}];function u(e){let{defaultValue:t="day"}=e,r=(0,i.kj)();return(0,n.jsx)(c,{paramKey:"gran",defaultValue:t,options:d,ariaLabel:r("gran.label")})}}},e=>{e.O(0,[760,930,253,148,441,255,358],()=>e(e.s=36392)),_N_E=e.O()}]);
|