tokentracker-cli 0.65.2 → 0.67.0
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/README.de.md +4 -0
- package/README.ja.md +4 -0
- package/README.ko.md +4 -0
- package/README.md +4 -0
- package/README.zh-CN.md +4 -0
- package/dashboard/dist/assets/ActivityHeatmap-BLL6xjLG.js +42 -0
- package/dashboard/dist/assets/{Card-5au9t9nC.js → Card-BB6LiYM8.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-DdczuiTm.js → ConfirmModal-CX5gv4tk.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-DMvTS8wX.js +19 -0
- package/dashboard/dist/assets/{DevicePage-DQJlqpU3.js → DevicePage-vyJEBiMw.js} +1 -1
- package/dashboard/dist/assets/{DialogTitle-DR64sBQk.js → DialogTitle-R2g9r9PR.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-CGzcyAaJ.js → FadeIn-CQUbHzNN.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-DiJi3EYZ.js → HeaderGithubStar-FwJX-pXB.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-CoGzED0h.js → IpCheckPage-D_-1u2LS.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-D_h4MI77.js → LandingPage-C-lWMwXP.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-BuSHrfaq.js → LeaderboardAvatar-DskcTB9C.js} +1 -1
- package/dashboard/dist/assets/LeaderboardPage-BjS-vLBW.js +2 -0
- package/dashboard/dist/assets/{LeaderboardProfileModal-zWSPrjXm.js → LeaderboardProfileModal-C6k4VVFS.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfilePage-BNR__NEp.js → LeaderboardProfilePage-o4fbDnzy.js} +1 -1
- package/dashboard/dist/assets/LimitsPage-qv3ovWi8.js +4 -0
- package/dashboard/dist/assets/{LocalOnlyNotice-DFxhTdeP.js → LocalOnlyNotice-C1qyMDpn.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-6m5w2iay.js → LoginPage-BKNFuYEQ.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-6bH8WcTu.js → PopoverPopup-leUqNKuk.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-ByOumS6-.js → ResetPasswordPage-D5yP5dZa.js} +1 -1
- package/dashboard/dist/assets/{Select-DrNJJE2o.js → Select-Bq8XjKo9.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-BTHh_2vw.js → SelectItemText-BUE4AAIY.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-BIxrrxUF.js → SettingsPage-DXTRXh8r.js} +1 -1
- package/dashboard/dist/assets/{SkillsPage-Cg8iXYaS.js → SkillsPage-Cz17a9ep.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-Bi8d2YwV.js → WidgetsPage-CSYCzAMh.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-Cc2kLDpE.js → WrappedPage-BM2BvUUN.js} +1 -1
- package/dashboard/dist/assets/{agent-logos-CzNQ3IaQ.js → agent-logos-DfysM5Ft.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-FgMhJ3Pu.js → arrow-up-right-KJ5nNRaR.js} +1 -1
- package/dashboard/dist/assets/{download-Bo9t1yfc.js → download-DPMzNjm9.js} +1 -1
- package/dashboard/dist/assets/{main-BHwig9Um.css → main-B6BudUsC.css} +1 -1
- package/dashboard/dist/assets/{main-6K89gDOX.js → main-V7ji8RkP.js} +5 -3
- package/dashboard/dist/assets/{use-limits-display-prefs-DN1nv1HE.js → use-limits-display-prefs-BhRZ2Vbm.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-6ygLVyJu.js → use-native-settings-CUwxJneK.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-li19cWJh.js → use-ordered-list-Cg8uqKy8.js} +1 -1
- package/dashboard/dist/assets/{use-quality-per-dollar-pref-rNMT2kff.js → use-quality-per-dollar-pref-DFYl9bWd.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-kVHyIhp3.js → use-usage-limits-TD09WmDE.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-g0G5pwGx.js → useCurrency-mDQb_32d.js} +1 -1
- package/dashboard/dist/assets/{useScrollLock-Dg7JyjFK.js → useScrollLock-CP5GKZtC.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +1 -1
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/dashboard/dist/assets/ActivityHeatmap-CggJI8SR.js +0 -42
- package/dashboard/dist/assets/DashboardPage-VAYxz_kf.js +0 -19
- package/dashboard/dist/assets/LeaderboardPage-aP0oQNBq.js +0 -2
- package/dashboard/dist/assets/LimitsPage-CbwEV4tL.js +0 -3
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{c as Jn,j as o,L as fl,r as m,u as ml,a as hl,b as gl,d as yl,e as nr,m as Fe,g as pl,i as Yt,f as nn,h as ze,k as bl,l as xl,n as Ir,o as Ln,p as ar,q as rr,s as Zn,t as kl,v as wl,w as vl,x as _l,y as Nl,z as ea,A as en,B as jl,C as Sl,D as Ml,E as Cl,F as $e,G as g,R as P,X as or,H as ta,I as an,J as Ae,K as Uo,M as Ya,N as qo,O as Dl,P as Vo,Q as Go,S as sr,T as Tl,U as Ko,V as Ie,W as Pl,Y as Xo,Z as Ol,_ as Wl,$ as Lr,a0 as El,a1 as Rr,a2 as $l,a3 as Br,a4 as Al,a5 as Fl,a6 as Il,a7 as Ll,a8 as Rl,a9 as Bl,aa as Yl,ab as zl,ac as Hl,ad as Ul,ae as ql,af as Vl,ag as bt,ah as Yr,ai as Gl}from"./main-V7ji8RkP.js";import{u as zr,a as Kl,C as Xl,b as Ql,c as Hr,D as Jl,S as Zl,v as ec,s as tc,K as nc,P as ac}from"./use-ordered-list-Cg8uqKy8.js";import{u as rc}from"./use-usage-limits-TD09WmDE.js";import{u as rn}from"./useCurrency-mDQb_32d.js";import{T as oc,M as sc,A as ic}from"./ActivityHeatmap-BLL6xjLG.js";import{u as lc,D as cc,a as dc,b as uc,c as fc,d as mc,e as hc,I as Qo}from"./DialogTitle-R2g9r9PR.js";import{C as et}from"./Card-BB6LiYM8.js";import{S as Jo}from"./Select-Bq8XjKo9.js";import{u as gc,a as yc,b as pc,L as bc,A as xc}from"./agent-logos-DfysM5Ft.js";import{C as Zo,P as za,a as Ha,b as Ua,c as qa,d as Va,L as kc}from"./PopoverPopup-leUqNKuk.js";import{F as Et}from"./FadeIn-CQUbHzNN.js";import{u as wc,P as vc}from"./use-quality-per-dollar-pref-DFYl9bWd.js";import{C as _c}from"./useScrollLock-CP5GKZtC.js";import"./SelectItemText-BUE4AAIY.js";const Nc=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],jc=Jn("chevron-left",Nc);const Sc=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],Mc=Jn("laptop",Sc);const Cc=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]],es=Jn("monitor-smartphone",Cc);const Dc=[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]],Tc=Jn("square-arrow-out-up-right",Dc);function Pc(){return o.jsxs(fl,{to:"/landing",className:"flex items-center gap-2.5 no-underline hover:opacity-80 transition-opacity",children:[o.jsx("img",{src:"/app-icon.png",alt:"Token Tracker",width:28,height:28,className:"rounded-md"}),o.jsx("span",{className:"text-base font-semibold text-oai-black dark:text-oai-white leading-tight",children:"Token Tracker"})]})}function Oc({children:e,header:t,footer:n,className:a="",hideHeader:r=!1,hideFooter:s=!1,bare:i=!1}){return i?o.jsxs("div",{className:`flex flex-col flex-1 min-h-0 ${a}`,children:[o.jsx("main",{className:"flex-1 px-6 py-6",children:e}),!s&&n&&o.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 mt-auto transition-colors duration-200",children:n})]}):o.jsxs("div",{className:`min-h-screen bg-oai-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-sans flex flex-col transition-colors duration-200 ${a}`,children:[!r&&o.jsxs("header",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 flex items-center justify-between transition-colors duration-200",children:[o.jsx(Pc,{}),o.jsx("div",{className:"flex-1 flex justify-center",children:t})]}),o.jsx("main",{className:"flex-1 px-6 py-6",children:e}),!s&&n&&o.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 mt-auto transition-colors duration-200",children:n})]})}function Wc({children:e,variant:t="info",size:n="md",className:a=""}){const r="inline-flex items-center font-medium",s={success:"bg-oai-brand-100 dark:bg-oai-brand-900/30 text-oai-brand-700 dark:text-oai-brand-400 rounded-full",warning:"bg-oai-amber-50 dark:bg-oai-amber-900/30 text-oai-amber-dark dark:text-oai-amber-400 rounded-full",error:"bg-red-50 dark:bg-red-900/30 text-red-600 dark:text-red-400 rounded-full",info:"bg-oai-gray-100 dark:bg-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-300 rounded-full",secondary:"bg-oai-gray-100 dark:bg-oai-gray-800 text-oai-gray-500 dark:text-oai-gray-300 rounded-md"},i={sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-sm"},l=`${r} ${s[t]} ${i[n]} ${a}`.trim();return o.jsx("span",{className:l,children:e})}const Ec=m.forwardRef(function(t,n){const{render:a,className:r,style:s,disabled:i=!1,nativeButton:l=!0,...c}=t,{store:d}=lc(),u=d.useState("open"),{getButtonProps:f,buttonRef:h}=ml({disabled:i,native:l}),y={disabled:i};function p(x){u&&d.setOpen(!1,gl(yl,x.nativeEvent))}return hl("button",t,{state:y,ref:[n,h],props:[{onClick:p},c,f]})});var $c={};function Ac(e,t){return e==="."?{width:"0.34ch",justifyContent:"center",marginInline:"-0.04ch"}:e===","?{width:"0.08ch",justifyContent:"center",marginInline:"-0.30ch"}:{width:"0.72ch",justifyContent:"flex-start",paddingLeft:"0.04ch",height:t}}function Fc({mv:e,digit:t,height:n}){const a=pc(e,r=>{const s=(r%10+10)%10,i=(10+t-s)%10;let l=i*n;return i>5&&(l-=10*n),l});return o.jsx(Fe.span,{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",y:a},children:t})}function Ic(e){const t=Math.round(e),n=1e-9*Math.max(1,Math.abs(e));return Math.abs(e-t)<n?t:e}function Lc(e,t){const n=e/t;return Math.floor(Ic(n))}function Rc(e){const t=String(e??""),n=Array.from(t),a=n.indexOf(".");let r=n.filter((l,c)=>/\d/.test(l)&&(a===-1||c<a)).length,s=0,i=!1;return n.map(l=>{if(!/\d/.test(l))return l==="."&&(i=!0),l;if(!i){const c=10**Math.max(r-1,0);return r-=1,c}return s+=1,10**-s})}function Bc({place:e,value:t,height:n,digitStyle:a,shouldReduceMotion:r}){if(typeof e!="number"){const c=Ac(e,n),d=e!=="."&&e!==",",u=e===".";return o.jsx("span",{"data-counter-token":"static",className:"relative inline-flex items-center justify-center",style:{height:n,...c,...a,...d?{width:"auto",paddingInline:"0.06ch",justifyContent:"center"}:null,...u?{width:c.width}:null},children:e})}const s=Lc(t,e),i=gc(0),l=yc(i,{stiffness:220,damping:26,mass:.8});return m.useEffect(()=>{i.set(s)},[i,s]),r?o.jsx("span",{"data-counter-token":"digit",className:"relative inline-flex items-center justify-center overflow-hidden",style:{height:n,position:"relative",width:"0.9ch",fontVariantNumeric:"tabular-nums",...a},children:Math.abs(s)%10}):o.jsx("span",{"data-counter-token":"digit",className:"relative inline-flex overflow-hidden",style:{height:n,position:"relative",width:"0.9ch",fontVariantNumeric:"tabular-nums",...a},children:Array.from({length:10},(c,d)=>o.jsx(Fc,{mv:l,digit:d,height:n},d))})}function Yc({value:e,displayValue:t,fontSize:n=72,padding:a=0,places:r,gap:s=6,borderRadius:i=4,horizontalPadding:l=0,textColor:c="inherit",fontWeight:d="inherit",containerStyle:u,counterStyle:f,digitStyle:h,gradientHeight:y=14,gradientFrom:p="rgba(255,255,255,0.95)",gradientTo:x="rgba(255,255,255,0)",topGradientStyle:k,bottomGradientStyle:w}){const b=String(t??e??""),_=m.useMemo(()=>Array.isArray(r)&&r.length?r:Rc(b),[r,b]),v=typeof navigator<"u"&&/jsdom/i.test(navigator.userAgent||"")||typeof process<"u"&&$c?.VITEST==="true",j=nr()||v,N=Number.isFinite(Number(e))?Math.abs(Number(e)):0,E=n+a;return j?o.jsx("span",{"data-counter-root":"true",style:{display:"inline-flex",alignItems:"center",color:c,fontSize:n,fontWeight:d,lineHeight:1,...u,...f},children:b}):o.jsxs("span",{"data-counter-root":"true",style:{position:"relative",display:"inline-block",...u},children:[o.jsx("span",{style:{fontSize:n,display:"flex",gap:s,overflow:"hidden",borderRadius:i,paddingLeft:l,paddingRight:l,lineHeight:1,color:c,fontWeight:d,...f},children:_.map((M,T)=>o.jsx(Bc,{place:M,value:N,height:E,digitStyle:h,shouldReduceMotion:j},`${String(M)}-${T}`))}),o.jsxs("span",{style:{pointerEvents:"none",position:"absolute",inset:0,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[o.jsx("span",{style:k??{height:y,background:`linear-gradient(to bottom, ${p}, ${x})`}}),o.jsx("span",{style:w??{height:y,background:`linear-gradient(to top, ${p}, ${x})`}})]})]})}function zc({baseUrl:e,accessToken:t,guestAllowed:n=!1,weeks:a=52,weekStartsOn:r="sun",cacheKey:s,timeZone:i,tzOffsetMinutes:l,now:c,accountView:d=!1,accountAccessToken:u=null,accountRevision:f=0,accountViewResolving:h=!1,deviceId:y=null}={}){const p=!!(d&&u),x=p?"cloud":"local",k=m.useMemo(()=>pl({weeks:a,weekStartsOn:r,now:c}),[c,a,r]),[w,b]=m.useState([]),[_,v]=m.useState(null),[j,N]=m.useState("edge"),[E,M]=m.useState(!1),[T,O]=m.useState(null),$=Yt(),V=nn(t),C=!n,A=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),I=m.useMemo(()=>{if(!s)return null;const z=Zn({timeZone:i,offsetMinutes:l});return`tokentracker.heatmap.${s}.${x}.${a}.${r}.${z}.${y||"all"}`},[s,y,x,i,l,a,r]),D=m.useCallback(()=>{if(!I||typeof window>"u")return null;try{const z=window.localStorage.getItem(I);if(!z)return null;const J=JSON.parse(z);return!J||!J.heatmap?null:J}catch{return null}},[I]),Y=m.useCallback(z=>{if(!(!I||typeof window>"u"))try{window.localStorage.setItem(I,JSON.stringify(z))}catch{}},[I]),U=m.useCallback(()=>{if(!(!I||typeof window>"u"))try{window.localStorage.removeItem(I)}catch{}},[I]),W=m.useRef(x);m.useEffect(()=>{W.current!==x&&(W.current=x,b([]),v(null),N("edge"),O(null),M(!0))},[x]);const ee=m.useCallback(async()=>{const z=await ze(t),J=p?await ze(u):null;if(!z&&!$&&!A&&!p)return;if(p&&!J){O("Your session expired. Please sign in again to view account data."),M(!1);return}const de=p?J:z,me=p?bl:xl,F=p?ar:rr;M(!0),O(null);try{try{const X=await me({baseUrl:e,accessToken:de,weeks:a,to:k.to,weekStartsOn:r,device:y,timeZone:i,tzOffsetMinutes:l}),Q=Array.isArray(X?.weeks)?X.weeks:[];if(!Q.length&&C){const G=D();if(G?.heatmap){v(G.heatmap),b(G.daily||[]),N("cache");return}}if(!Q.some(G=>(Array.isArray(G)?G:[]).some(le=>le&&Number.isFinite(Number(le.level))))&&Q.length){const G=[];for(const be of Q)for(const _e of Array.isArray(be)?be:[])_e?.day&&G.push({day:_e.day,total_tokens:_e.total_tokens??_e.value??0,billable_total_tokens:_e.billable_total_tokens??_e.value??_e.total_tokens??0});const le=Ir({dailyRows:G,weeks:a,to:X?.to||k.to,weekStartsOn:r});b(G),v({...le,week_starts_on:r,active_days:G.filter(be=>Number(be?.billable_total_tokens??be?.total_tokens)>0).length,streak_days:Ln({dailyRows:G,to:X?.to||k.to})}),N("client"),C?Y({heatmap:{...le,week_starts_on:r,active_days:G.filter(be=>Number(be?.billable_total_tokens??be?.total_tokens)>0).length,streak_days:Ln({dailyRows:G,to:X?.to||k.to})},daily:G,fetchedAt:new Date().toISOString()}):U();return}v(X||null),b([]),N("edge"),X&&C?Y({heatmap:X,daily:[],fetchedAt:new Date().toISOString()}):C||U();return}catch(X){const Q=X,se=Q?.status??Q?.statusCode;if(se===401||se===403)throw X}const H=await F({baseUrl:e,accessToken:de,from:k.from,to:k.to,device:y,timeZone:i,tzOffsetMinutes:l}),L=Array.isArray(H?.data)?H.data:[];b(L);const re=Ir({dailyRows:L,weeks:a,to:k.to,weekStartsOn:r});v({...re,week_starts_on:r,active_days:L.filter(X=>Number(X?.billable_total_tokens??X?.total_tokens)>0).length,streak_days:Ln({dailyRows:L,to:k.to})}),N("client"),C?Y({heatmap:{...re,week_starts_on:r,active_days:L.filter(X=>Number(X?.billable_total_tokens??X?.total_tokens)>0).length,streak_days:Ln({dailyRows:L,to:k.to})},daily:L,fetchedAt:new Date().toISOString()}):U()}catch(H){if(C){const L=D();if(L?.heatmap)v(L.heatmap),b(L.daily||[]),N("cache"),O(null);else{const re=H;O(re?.message||String(re)),b([]),v(null),N("edge")}}else{const L=H;O(L?.message||String(L)),b([]),v(null),N("edge")}}finally{M(!1)}},[t,e,$,n,C,k.from,k.to,D,V,i,l,r,a,U,Y,A,p,u,f,y]);return m.useEffect(()=>{if(h){M(!0);return}if(!V&&!n&&!$&&!A&&!p){b([]),M(!1),O(null),v(null),N("edge");return}if(!C)U(),b([]),O(null),v(null),N("edge");else{const z=D();z?.heatmap&&(v(z.heatmap),b(z.daily||[]),N("cache"))}ee()},[t,$,D,ee,V,n,C,U,A,h]),{range:k,daily:w,heatmap:_,source:$?"mock":j==="client"?"edge":j,loading:E,error:T,refresh:ee}}const Hc="tokentracker.dashboard.leftCardOrder.v1",Uc="tokentracker.dashboard.rightCardOrder.v1";function qc(e,t){const n=zr(Hc,e),a=zr(Uc,t),r=n.order.join("|")!==e.join("|")||a.order.join("|")!==t.join("|"),s=m.useCallback(()=>{n.reset(),a.reset()},[n,a]);return{left:n,right:a,isCustomized:r,resetAll:s}}function Vc({baseUrl:e,accessToken:t,limit:n=3,from:a,to:r,source:s,timeZone:i,tzOffsetMinutes:l}={}){const[c,d]=m.useState([]),[u,f]=m.useState(!1),[h,y]=m.useState(null),p=Yt(),x=nn(t),k=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),w=m.useCallback(async()=>{const b=await ze(t);if(!b&&!p&&!k){d([]),y(null),f(!1);return}f(!0),y(null);try{const _=await kl({baseUrl:e,accessToken:b,limit:n,from:a,to:r,source:s,timeZone:i,tzOffsetMinutes:l});d(Array.isArray(_?.entries)?_.entries:[])}catch(_){const v=_?.message||String(_);y(v),d([])}finally{f(!1)}},[t,e,a,n,p,s,i,r,l,k]);return m.useEffect(()=>{if(!x&&!p&&!k){d([]),y(null),f(!1);return}w()},[p,w,x,k]),{entries:c,loading:u,error:h,refresh:w}}const Gc=24;function ts({baseUrl:e,accessToken:t,guestAllowed:n=!1,period:a,from:r,to:s,months:i=Gc,cacheKey:l,timeZone:c,tzOffsetMinutes:d,now:u,sharedRows:f,sharedRange:h,accountView:y=!1,accountAccessToken:p=null,accountRevision:x=0,accountViewResolving:k=!1,deviceId:w=null}={}){const b=!!(y&&p),_=b?"cloud":"local",[v,j]=m.useState([]),[N,E]=m.useState(()=>({from:r,to:s})),[M,T]=m.useState("edge"),[O,$]=m.useState(null),[V,C]=m.useState(!1),[A,I]=m.useState(null),D=Yt(),Y=nn(t),U=!n&&!D,W=Array.isArray(f),ee=h?.from||r,ie=h?.to||s,z=m.useMemo(()=>a==="day"?"hourly":a==="total"?"monthly":"daily",[a]),J=(()=>{if(!l)return null;const Q=Kc(e)||"default",se=Zn({timeZone:c,offsetMinutes:d}),G=w||"all";if(z==="hourly")return`tokentracker.trend.${l}.${_}.${Q}.hourly.${s||r||"day"}.${se}.${G}`;if(z==="monthly")return`tokentracker.trend.${l}.${_}.${Q}.monthly.${i}.${s||"today"}.${se}.${G}`;const le=`${r||""}.${s||""}`;return`tokentracker.trend.${l}.${_}.${Q}.daily.${le}.${se}.${G}`})(),de=m.useCallback(()=>{if(!J||typeof window>"u")return null;try{const Q=window.localStorage.getItem(J);if(!Q)return null;const se=JSON.parse(Q);return!se||!Array.isArray(se.rows)?null:se}catch{return null}},[J]),me=m.useCallback(Q=>{if(!(!J||typeof window>"u"))try{window.localStorage.setItem(J,JSON.stringify(Q))}catch{}},[J]),F=m.useCallback(()=>{if(!(!J||typeof window>"u"))try{window.localStorage.removeItem(J)}catch{}},[J]),H=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),L=m.useRef(_);m.useEffect(()=>{L.current!==_&&(L.current=_,j([]),E({from:r,to:s}),T("edge"),$(null),I(null),C(!0))},[_]);const re=m.useCallback(async()=>{if(W){j(Array.isArray(f)?f:[]),E({from:ee,to:ie}),T("shared"),$(null),C(!1),I(null);return}const Q=await ze(t),se=b?await ze(p):null;if(!Q&&!D&&!H&&!b)return;if(b&&!se){I("Your session expired. Please sign in again to view account data."),C(!1);return}const G=b?se:Q,le=b?wl:vl,be=b?_l:Nl,_e=b?ar:rr;C(!0),I(null);try{let he;z==="hourly"?he=await le({baseUrl:e,accessToken:G,day:s||r,device:w,timeZone:c,tzOffsetMinutes:d}):z==="monthly"?he=await be({baseUrl:e,accessToken:G,months:i,to:s,device:w,timeZone:c,tzOffsetMinutes:d}):he=await _e({baseUrl:e,accessToken:G,from:r,to:s,device:w,timeZone:c,tzOffsetMinutes:d});const ce=he?.from||r||he?.day||null,ge=he?.to||s||he?.day||null;let Oe=Array.isArray(he?.data)?he.data:[];z==="daily"?Oe=_a(Oe,ce||r,ge||s,{timeZone:c,offsetMinutes:d,now:u}):z==="hourly"?(Oe=Na(Oe,ce||r||he?.day,{timeZone:c,offsetMinutes:d,now:u}),Oe=ja(Oe,{timeZone:c,offsetMinutes:d,now:u})):z==="monthly"&&(Oe=Sa(Oe,{timeZone:c,offsetMinutes:d,now:u}));const De=new Date().toISOString();j(Oe),E({from:ce,to:ge}),T("edge"),$(De),U?me({rows:Oe,from:ce,to:ge,mode:z,fetchedAt:De}):F()}catch(he){if(U){const ce=de();if(ce?.rows){let ge=z==="daily"?_a(ce.rows||[],ce.from||r,ce.to||s,{timeZone:c,offsetMinutes:d,now:u}):z==="hourly"?Na(ce.rows||[],ce.from||r||ce.day||s,{timeZone:c,offsetMinutes:d,now:u}):Array.isArray(ce.rows)?ce.rows:[];z==="hourly"?ge=ja(ge,{timeZone:c,offsetMinutes:d,now:u}):z==="monthly"&&(ge=Sa(ge,{timeZone:c,offsetMinutes:d,now:u})),j(ge),E({from:ce.from||r,to:ce.to||s}),T("cache"),$(ce.fetchedAt||null),I(null)}else{j([]),E({from:r,to:s}),T("edge"),$(null);const ge=he;I(ge?.message||String(ge))}}else{j([]),E({from:r,to:s}),T("edge"),$(null);const ce=he;I(ce?.message||String(ce))}}finally{C(!1)}},[t,e,r,D,n,U,z,i,de,Y,W,ee,f,ie,c,s,d,u,F,me,H,b,p,x,w]);m.useEffect(()=>{if(k){C(!0);return}if(W){j(Array.isArray(f)?f:[]),E({from:ee,to:ie}),T("shared"),$(null),C(!1),I(null);return}if(!Y&&!n&&!D&&!H&&!b){j([]),E({from:r,to:s}),I(null),C(!1),T("edge"),$(null);return}if(!U)F(),j([]),E({from:r,to:s}),I(null),T("edge"),$(null);else{const Q=de();if(Q?.rows){let se=z==="daily"?_a(Q.rows||[],Q.from||r,Q.to||s,{timeZone:c,offsetMinutes:d,now:u}):z==="hourly"?Na(Q.rows||[],Q.from||r||Q.day||s,{timeZone:c,offsetMinutes:d,now:u}):Array.isArray(Q.rows)?Q.rows:[];z==="hourly"?se=ja(se,{timeZone:c,offsetMinutes:d,now:u}):z==="monthly"&&(se=Sa(se,{timeZone:c,offsetMinutes:d,now:u})),j(se),E({from:Q.from||r,to:Q.to||s}),T("cache"),$(Q.fetchedAt||null)}}re()},[t,D,de,re,W,ee,f,ie,Y,n,U,F,H,k]);const X=D?"mock":M;return{rows:v,from:N.from||r,to:N.to||s,source:X,fetchedAt:O,loading:V,error:A,refresh:re}}function Kc(e){try{return new URL(e).host}catch{return null}}function qn(e){if(!e)return null;const t=String(e).trim(),n=t.split("-");if(n.length!==3)return null;const a=Number(n[0]),r=Number(n[1])-1,s=Number(n[2]);if(!Number.isFinite(a)||!Number.isFinite(r)||!Number.isFinite(s))return null;const i=new Date(Date.UTC(a,r,s));return Number.isFinite(i.getTime())&&en(i)===t?i:null}function ns(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}const as=["total_tokens","billable_total_tokens","input_tokens","cached_input_tokens","cache_creation_input_tokens","output_tokens","reasoning_output_tokens","conversation_count"];function _a(e,t,n,{timeZone:a,offsetMinutes:r,now:s}={}){const i=qn(t),l=qn(n);if(!i||!l||l<i)return Array.isArray(e)?e:[];const c=s instanceof Date&&Number.isFinite(s.getTime())?s:new Date,d=ea({timeZone:a,offsetMinutes:r,date:c}),u=qn(d),f=u?u.getTime():c.getTime(),h=new Map;for(const p of e||[])p?.day&&h.set(p.day,p);const y=[];for(let p=i;p<=l;p=ns(p,1)){const x=en(p),k=h.get(x),w=p.getTime()>f;if(k){y.push({...k,missing:!1,future:w});continue}y.push({day:x,total_tokens:null,billable_total_tokens:null,input_tokens:null,cached_input_tokens:null,output_tokens:null,reasoning_output_tokens:null,missing:!w,future:w})}return y}function Xc(e,t){const n=t?null:0;return{hour:e,total_tokens:n,billable_total_tokens:n,input_tokens:n,cached_input_tokens:n,cache_creation_input_tokens:n,output_tokens:n,reasoning_output_tokens:n,conversation_count:n,missing:!1,future:t}}function Qc(e){if(!e||typeof e!="object")return!1;const t=e.models;return t&&typeof t=="object"&&Object.keys(t).length>0?!1:as.every(n=>e[n]==null)}function Jc(e,t,n){const a={...e,hour:t,missing:!1,future:n};if(!n&&Qc(e))for(const r of as)a[r]=0;return a}function Zc(e,t){const n=t===30?48:24,a=[];for(let r=0;r<n;r++){const s=Math.floor(r*t/60),i=r*t%60;a.push(`${e}T${String(s).padStart(2,"0")}:${String(i).padStart(2,"0")}:00`)}return a}function ed(e,t,{timeZone:n,offsetMinutes:a}={}){const r=Zc(e,t);if(!n||typeof Intl>"u"||!Intl.DateTimeFormat)return r;const s=qn(e);if(!s)return r;const i=s.getUTCFullYear()*1e4+(s.getUTCMonth()+1)*100+s.getUTCDate(),l=s.getTime()-2160*60*1e3,c=ns(s,2).getTime()+2160*60*1e3,d=[],u=new Set;for(let f=l;f<=c;f+=1800*1e3){const h=na({timeZone:n,offsetMinutes:a,now:new Date(f)});if(!h||h.dayNum!==i||t===60&&h.minute!==0||t===30&&h.minute!==0&&h.minute!==30)continue;const y=`${e}T${String(h.hour).padStart(2,"0")}:${String(h.minute).padStart(2,"0")}:00`;u.has(y)||(u.add(y),d.push(y))}return d.length>0?d:r}function Na(e,t,{timeZone:n,offsetMinutes:a,now:r}={}){if(!t)return Array.isArray(e)?e:[];const s=t.trim().slice(0,10),i=na({timeZone:n,offsetMinutes:a,now:r}),l=i?i.dayNum:void 0;let c=!1;for(const y of e||[]){const p=y?.hour||y?.label||"",x=Vn(p,l);if(x&&x.slot%2!==0){c=!0;break}}const d=c?30:60,u=new Map;for(const y of e||[]){const p=y?.hour||y?.label||"",x=Vn(p,l);x&&u.set(x.slot,y)}const f=[],h=ed(s,d,{timeZone:n,offsetMinutes:a});for(let y=0;y<h.length;y++){const p=h[y],x=Vn(p,l),k=x?x.slot:c?y:y*2,w=u.get(k);let b=!1;if(i){const _=i.year*1e4+i.month*100+i.day,v=x?.dayNum??Number(s.replace(/-/g,""));if(v>_)b=!0;else if(v===_){const j=i.hour*2+(i.minute>=30?1:0);b=k>j}}w?f.push(Jc(w,p,b)):f.push(Xc(p,b))}return f}function ja(e,{timeZone:t,offsetMinutes:n,now:a}={}){if(!Array.isArray(e))return[];const r=na({timeZone:t,offsetMinutes:n,now:a});return r?e.map(s=>{const i=s?.hour||s?.label||"",l=Vn(i,r.dayNum);if(!l)return{...s,future:!1};const c=l.dayNum!==null&&l.dayNum>r.dayNum||(l.dayNum===null||l.dayNum===r.dayNum)&&l.slot>r.slot;return{...s,future:!!c}}):e}function Sa(e,{timeZone:t,offsetMinutes:n,now:a}={}){if(!Array.isArray(e))return[];const r=na({timeZone:t,offsetMinutes:n,now:a});return r?e.map(s=>{const i=s?.month||s?.label||"",l=td(i);if(!l)return{...s,future:!1};const c=l.year>r.year||l.year===r.year&&l.month>r.month;return{...s,future:c}}):e}function na({timeZone:e,offsetMinutes:t,now:n}={}){const a=n instanceof Date&&Number.isFinite(n.getTime())?n:new Date;if(e&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const h=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(a).reduce((b,_)=>(_.type&&_.value&&(b[_.type]=_.value),b),{}),y=Number(h.year),p=Number(h.month),x=Number(h.day),k=Number(h.hour),w=Number(h.minute);if(Number.isFinite(y)&&Number.isFinite(p)&&Number.isFinite(x)&&Number.isFinite(k)&&Number.isFinite(w)){const b=k*2+(w>=30?1:0);return{year:y,month:p,day:x,hour:k,minute:w,dayNum:y*1e4+p*100+x,slot:b}}}catch{}if(Number.isFinite(t)){const u=new Date(a.getTime()+t*60*1e3),f=u.getUTCFullYear(),h=u.getUTCMonth()+1,y=u.getUTCDate(),p=u.getUTCHours(),x=u.getUTCMinutes(),k=p*2+(x>=30?1:0);return{year:f,month:h,day:y,hour:p,minute:x,dayNum:f*1e4+h*100+y,slot:k}}const r=a.getFullYear(),s=a.getMonth()+1,i=a.getDate(),l=a.getHours(),c=a.getMinutes(),d=l*2+(c>=30?1:0);return{year:r,month:s,day:i,hour:l,minute:c,dayNum:r*1e4+s*100+i,slot:d}}function Vn(e,t){if(!e)return null;const n=String(e).trim();if(n.includes("T")){const[a,r]=n.split("T");if(!a||!r)return null;const s=a.split("-");if(s.length!==3)return null;const i=Number(s[0]),l=Number(s[1]),c=Number(s[2]);if(!Number.isFinite(i)||!Number.isFinite(l)||!Number.isFinite(c))return null;const d=r.split(":"),u=Number(d[0]),f=Number(d[1]);if(!Number.isFinite(u)||u<0||u>23||!Number.isFinite(f)||f<0||f>59)return null;const h=u*2+(f>=30?1:0);return{dayNum:i*1e4+l*100+c,slot:h}}else{let a=NaN,r=0;if(/^\d{1,2}$/.test(n))a=Number(n);else if(/^\d{1,2}:\d{2}(:\d{2})?$/.test(n)){const i=n.split(":");a=Number(i[0]),r=Number(i[1])}if(!Number.isFinite(a)||a<0||a>23||!Number.isFinite(r)||r<0||r>59)return null;const s=a*2+(r>=30?1:0);return{dayNum:t||null,slot:s}}}function td(e){if(!e)return null;const n=String(e).trim().split("-");if(n.length!==2)return null;const a=Number(n[0]),r=Number(n[1]);return!Number.isFinite(a)||!Number.isFinite(r)||r<1||r>12?null:{year:a,month:r}}function Ur({baseUrl:e,accessToken:t,guestAllowed:n=!1,from:a,to:r,includeDaily:s=!0,cacheKey:i,timeZone:l,tzOffsetMinutes:c,now:d,accountView:u=!1,accountAccessToken:f=null,accountRevision:h=0,accountViewResolving:y=!1,deviceId:p=null}={}){const x=!!(u&&f),k=x?"cloud":"local",[w,b]=m.useState([]),[_,v]=m.useState(null),[j,N]=m.useState(null),[E,M]=m.useState("edge"),[T,O]=m.useState(null),[$,V]=m.useState(!1),[C,A]=m.useState(null),I=Yt(),D=nn(t),Y=!n&&!I,U=p||"all",W=(()=>{if(!i)return null;const H=nd(e)||"default",L=s?"daily":"summary",re=Zn({timeZone:l,offsetMinutes:c});return`tokentracker.usage.${i}.${k}.${H}.${a}.${r}.${L}.${re}.${U}`})(),ee=m.useRef(k);m.useEffect(()=>{ee.current!==k&&(ee.current=k,b([]),v(null),N(null),M("edge"),O(null),A(null),V(!0))},[k]);const ie=m.useCallback(()=>{if(!W||typeof window>"u")return null;try{const H=window.localStorage.getItem(W);if(!H)return null;const L=JSON.parse(H);return!L||!L.summary?null:L}catch{return null}},[W]),z=m.useCallback(H=>{if(!(!W||typeof window>"u"))try{window.localStorage.setItem(W,JSON.stringify(H))}catch{}},[W]),J=m.useCallback(()=>{if(!(!W||typeof window>"u"))try{window.localStorage.removeItem(W)}catch{}},[W]),de=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),me=m.useCallback(async()=>{const H=await ze(t),L=x?await ze(f):null;if(!H&&!I&&!de&&!x)return;if(x&&!L){A("Your session expired. Please sign in again to view account data."),V(!1);return}const re=x?ar:rr,X=x?jl:Sl,Q=x?L:H;V(!0),A(null);try{let se=null,G=null;if(s){const[ce,ge]=await Promise.allSettled([re({baseUrl:e,accessToken:Q,from:a,to:r,device:p,timeZone:l,tzOffsetMinutes:c}),X({baseUrl:e,accessToken:Q,from:a,to:r,device:p,timeZone:l,tzOffsetMinutes:c,rolling:!0})]);if(ce.status==="rejected")throw ce.reason;se=ce.value,G=ge.status==="fulfilled"?ge.value:null}else G=await X({baseUrl:e,accessToken:Q,from:a,to:r,device:p,timeZone:l,tzOffsetMinutes:c,rolling:!0});let le=s&&Array.isArray(se?.data)?se.data:[];s&&(le=Ca(le,a,r,{timeZone:l,offsetMinutes:c,now:d}));let be=G?.totals||se?.summary?.totals||null,_e=G?.rolling||se?.summary?.rolling||null;if(s&&!be&&!G)try{const ce=await X({baseUrl:e,accessToken:Q,from:a,to:r,device:p,timeZone:l,tzOffsetMinutes:c,rolling:!0});be=ce?.totals||null,_e=ce?.rolling||_e}catch{}const he=new Date().toISOString();b(le),v(be),N(_e),M("edge"),O(he),be&&Y?z({summary:be,rolling:_e,daily:le,from:a,to:r,includeDaily:s,fetchedAt:he}):Y||J()}catch(se){if(Y){const G=ie();if(G?.summary){v(G.summary),N(G.rolling||null);const le=Array.isArray(G.daily)?G.daily:[],be=s?Ca(le,G.from||a,G.to||r,{timeZone:l,offsetMinutes:c,now:d}):le;b(be),M("cache"),O(G.fetchedAt||null),A(null)}else{const le=se;A(le?.message||String(le)),b([]),v(null),N(null),M("edge"),O(null)}}else{const G=se;A(G?.message||String(G)),b([]),v(null),N(null),M("edge"),O(null)}}finally{V(!1)}},[t,e,a,s,I,n,Y,d,ie,D,l,r,c,J,z,de,x,f,h,p]);return m.useEffect(()=>{if(y){V(!0);return}const H=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");if(!D&&!n&&!I&&!H&&!x){b([]),v(null),N(null),A(null),V(!1),M("edge"),O(null);return}if(!Y)J(),b([]),v(null),N(null),A(null),M("edge"),O(null);else{const L=ie();if(L?.summary){v(L.summary),N(L.rolling||null);const re=Array.isArray(L.daily)?L.daily:[],X=s?Ca(re,L.from||a,L.to||r,{timeZone:l,offsetMinutes:c,now:d}):re;b(X),M("cache"),O(L.fetchedAt||null)}}me()},[t,I,ie,me,D,n,Y,J,de,y]),m.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const H=15e3;let L=Date.now();const re=()=>{if(document.visibilityState!=="visible")return;const X=Date.now();X-L<H||(L=X,me())};return window.addEventListener("focus",re),document.addEventListener("visibilitychange",re),()=>{window.removeEventListener("focus",re),document.removeEventListener("visibilitychange",re)}},[me]),{daily:w,summary:_,rolling:j,source:I?"mock":E,fetchedAt:T,loading:$,error:C,refresh:me}}function nd(e){try{return new URL(e).host}catch{return null}}function Ma(e){if(!e)return null;const t=String(e).trim(),n=t.split("-");if(n.length!==3)return null;const a=Number(n[0]),r=Number(n[1])-1,s=Number(n[2]);if(!Number.isFinite(a)||!Number.isFinite(r)||!Number.isFinite(s))return null;const i=new Date(Date.UTC(a,r,s));return Number.isFinite(i.getTime())&&en(i)===t?i:null}function ad(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function Ca(e,t,n,{timeZone:a,offsetMinutes:r,now:s}={}){const i=Ma(t),l=Ma(n);if(!i||!l||l<i)return Array.isArray(e)?e:[];const c=s instanceof Date&&Number.isFinite(s.getTime())?s:new Date,d=ea({timeZone:a,offsetMinutes:r,date:c}),u=Ma(d),f=u?u.getTime():c.getTime(),h=new Map;for(const p of e||[])p?.day&&h.set(p.day,p);const y=[];for(let p=i;p<=l;p=ad(p,1)){const x=en(p),k=h.get(x),w=p.getTime()>f;if(k){y.push({...k,missing:!1,future:w});continue}y.push({day:x,total_tokens:null,billable_total_tokens:null,input_tokens:null,cached_input_tokens:null,output_tokens:null,reasoning_output_tokens:null,missing:!w,future:w})}return y}function rd({baseUrl:e,accessToken:t,guestAllowed:n=!1,from:a,to:r,cacheKey:s,timeZone:i,tzOffsetMinutes:l,accountView:c=!1,accountAccessToken:d=null,accountRevision:u=0,accountViewResolving:f=!1,deviceId:h=null}={}){const y=!!(c&&d),p=y?"cloud":"local",[x,k]=m.useState(null),[w,b]=m.useState("edge"),[_,v]=m.useState(!1),[j,N]=m.useState(null),E=Yt(),M=nn(t),T=!n,O=m.useMemo(()=>{if(!s)return null;const U=od(e)||"default",W=Zn({timeZone:i,offsetMinutes:l});return`tokentracker.modelBreakdown.${s}.${p}.${U}.${a}.${r}.${W}.${h||"all"}`},[e,s,h,a,p,i,r,l]),$=m.useCallback(()=>{if(!O||typeof window>"u")return null;try{const U=window.localStorage.getItem(O);if(!U)return null;const W=JSON.parse(U);return!W||!W.breakdown?null:W}catch{return null}},[O]),V=m.useCallback(U=>{if(!(!O||typeof window>"u"))try{window.localStorage.setItem(O,JSON.stringify(U))}catch{}},[O]),C=m.useCallback(()=>{if(!(!O||typeof window>"u"))try{window.localStorage.removeItem(O)}catch{}},[O]),A=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),I=m.useRef(p);m.useEffect(()=>{I.current!==p&&(I.current=p,k(null),b("edge"),N(null),v(!0))},[p]);const D=m.useCallback(async()=>{const U=await ze(t),W=y?await ze(d):null;if(!U&&!E&&!A&&!y)return;if(y&&!W){N("Your session expired. Please sign in again to view account data."),v(!1);return}const ee=y?W:U,ie=y?Ml:Cl;v(!0),N(null);try{const z=await ie({baseUrl:e,accessToken:ee,from:a,to:r,device:h,timeZone:i,tzOffsetMinutes:l});k(z||null),b("edge"),z&&T?V({breakdown:z,fetchedAt:new Date().toISOString()}):T||C()}catch(z){if(T){const J=$();if(J?.breakdown)k(J.breakdown),b("cache"),N(null);else{k(null),b("edge");const de=z;N(de?.message||String(de))}}else{k(null),b("edge");const J=z;N(J?.message||String(J))}}finally{v(!1)}},[t,e,a,E,n,T,$,i,r,M,l,C,V,A,y,d,u,h]);return m.useEffect(()=>{if(f){v(!0);return}if(!M&&!n&&!E&&!A&&!y){k(null),b("edge"),N(null),v(!1);return}if(!T)C(),k(null),b("edge"),N(null);else{const U=$();U?.breakdown&&(k(U.breakdown),b("cache"))}D()},[t,E,$,D,M,n,T,C,A,f]),{breakdown:x,source:E?"mock":w,loading:_,error:j,refresh:D}}function od(e){try{return new URL(e).host}catch{return null}}const rs=new Set(["day","hour","month"]);function sd(e){return rs.has(e)}function qr(e){if(e==null)return null;const t=String(e).trim();if(!/^[0-9]+$/.test(t))return null;const n=t.replace(/^0+/,"");return n.length===0?"0":n}function id(e,t){const n=qr(e),a=qr(t);if(n&&a)return n.length!==a.length?n.length<a.length?-1:1:n===a?0:n<a?-1:1;const r=$e(e),s=$e(t);return r==null&&s==null?0:r==null?1:s==null?-1:r===s?0:r<s?-1:1}function ld(e,t){const n=typeof e=="string"?e:String(e||""),a=typeof t=="string"?t:String(t||"");return n===a?0:n<a?-1:1}function cd(e){if(!e)return null;const n=String(e).trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!n)return null;const a=Number(n[1]),r=Number(n[2]),s=Number(n[3]);if(!Number.isFinite(a)||!Number.isFinite(r)||!Number.isFinite(s))return null;const i=new Date(Date.UTC(a,r-1,s));return!Number.isFinite(i.getTime())||i.getUTCFullYear()!==a||i.getUTCMonth()+1!==r||i.getUTCDate()!==s?null:i.getTime()}function dd(e){if(!e)return null;const n=String(e).trim().match(/^(\d{4})-(\d{2})$/);if(!n)return null;const a=Number(n[1]),r=Number(n[2]);if(!Number.isFinite(a)||!Number.isFinite(r)||r<1||r>12)return null;const s=new Date(Date.UTC(a,r-1,1));return Number.isFinite(s.getTime())?s.getTime():null}function ud(e){if(!e)return null;const n=String(e).trim().match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?Z?$/);if(!n)return null;const a=Number(n[1]),r=Number(n[2]),s=Number(n[3]),i=Number(n[4]),l=Number(n[5]),c=Number(n[6]||0);if(!Number.isFinite(a)||!Number.isFinite(r)||!Number.isFinite(s)||!Number.isFinite(i)||!Number.isFinite(l)||!Number.isFinite(c)||r<1||r>12||s<1||s>31||i<0||i>23||l<0||l>59||c<0||c>59)return null;const d=new Date(Date.UTC(a,r-1,s,i,l,c));return Number.isFinite(d.getTime())?d.getTime():null}function fd(e,t,n){const a=n==="hour"?ud:n==="month"?dd:cd,r=a(e),s=a(t);return r!=null&&s!=null?r===s?0:r<s?-1:1:ld(e,t)}function os(e,{key:t,dir:n}){const a=n==="asc"?1:-1,r=Array.isArray(e)?e:[],s=rs.has(t)?(l,c)=>fd(l,c,t):id,i=l=>t==="total_tokens"&&l?.billable_total_tokens!=null?l.billable_total_tokens:l?.[t];return r.map((l,c)=>({row:l,index:c})).sort((l,c)=>{const d=i(l.row),u=i(c.row),f=d==null,h=u==null;if(f&&h)return l.index-c.index;if(f)return 1;if(h)return-1;const y=s(d,u);return y!==0?y*a:l.index-c.index}).map(l=>l.row)}function md(){return[{key:"day",label:g("daily.sort.date.label"),title:g("daily.sort.date.title")},{key:"total_tokens",label:g("daily.sort.total.label"),title:g("daily.sort.total.title")},{key:"input_tokens",label:g("daily.sort.input.label"),title:g("daily.sort.input.title")},{key:"output_tokens",label:g("daily.sort.output.label"),title:g("daily.sort.output.title")},{key:"cached_input_tokens",label:g("daily.sort.cached.label"),title:g("daily.sort.cached.title")},{key:"reasoning_output_tokens",label:g("daily.sort.reasoning.label"),title:g("daily.sort.reasoning.title")},{key:"conversation_count",label:g("daily.sort.conversations.label"),title:g("daily.sort.conversations.title")}]}function Vr(e){const t=sd(e)?e:"day";return md().map((n,a)=>a===0?{...n,key:t}:n)}function Gr(e,{key:t,dir:n}){return os(e,{key:t,dir:n})}const Xn=12,hd=["total_tokens","billable_total_tokens","input_tokens","cached_input_tokens","cache_creation_input_tokens","output_tokens","reasoning_output_tokens"];function gd(e){if(typeof e=="bigint")return e!==0n;if(typeof e=="number")return Number.isFinite(e)&&e!==0;if(e==null)return!1;const t=String(e).trim();if(!t||!/^-?\d+$/.test(t))return!1;const n=t.startsWith("-")?t.slice(1):t;return/[1-9]/.test(n)}function yd(e){return hd.some(t=>gd(e?.[t]))}function pd(e){const t=Array.isArray(e)?e:[];if(!t.length)return[];const n=os(t,{key:"month",dir:"asc"}),a=n.findIndex(r=>r?.month&&yd(r));return a===-1?t:n.slice(a)}function bd(e,t,n=Xn){const a=Array.isArray(e)?e:[],r=Number.isFinite(n)&&n>0?n:Xn,i=(Number.isFinite(t)&&t>=0?Math.floor(t):0)*r;return a.slice(i,i+r)}function xd({publicMode:e,screenshotMode:t,forceInstall:n,accessEnabled:a,heatmapLoading:r,activeDays:s,hasActiveDeviceToken:i}={}){return e||t?!1:n?!0:a&&!r&&s===0&&!i}function ss(e){if(typeof e!="string")return null;const t=e.trim();return t?t.toLowerCase():null}function kd(e){const t=ss(e?.model_id);return t||null}function is(e,t){return e?.model?String(e.model):t}function tn(e,t=0){const n=$e(e?.billable_total_tokens),a=$e(e?.total_tokens);return n!=null&&n>0?n:a!=null&&a>0?a:n??a??t}function wd(e,{copyFn:t}={}){const n=typeof t=="function"?t:i=>i,r=(Array.isArray(e?.sources)?e.sources:[]).map(i=>{const l=tn(i?.totals),c=$e(i?.totals?.total_cost_usd)??0;return{source:i?.source,totalTokens:Number.isFinite(l)?l:0,totalCost:Number.isFinite(c)?c:0,inputTokens:Math.max(0,$e(i?.totals?.input_tokens)??0),cacheRead:Math.max(0,$e(i?.totals?.cached_input_tokens)??0),cacheCreate:Math.max(0,$e(i?.totals?.cache_creation_input_tokens)??0),models:Array.isArray(i?.models)?i.models:[]}}).filter(i=>i.totalTokens>0);if(!r.length)return[];const s=r.reduce((i,l)=>i+l.totalTokens,0);return typeof e?.pricing?.pricing_mode=="string"&&e.pricing.pricing_mode.toUpperCase(),r.slice().sort((i,l)=>l.totalTokens-i.totalTokens).map(i=>{const l=i.source?String(i.source).toUpperCase():n("shared.placeholder.short"),c=s>0?i.totalTokens/s*100:0,d=Number.isFinite(c)?c.toFixed(1):"0.0",u=i.models.map(p=>{const x=tn(p?.totals);if(!Number.isFinite(x)||x<=0)return null;const k=i.totalTokens>0?Math.round(x/i.totalTokens*1e3)/10:0,w=is(p,n("shared.placeholder.short")),b=kd(p),_=$e(p?.totals?.total_cost_usd),v=_??(i.totalCost>0&&i.totalTokens>0?x/i.totalTokens*i.totalCost:null);return{id:b,name:w,share:k,usage:x,cost:v}}).filter(Boolean),f=i.inputTokens+i.cacheRead+i.cacheCreate,y=i.cacheRead+i.cacheCreate>0&&f>0?Math.round(i.cacheRead/f*100):null;return{source:i.source,label:l,totalPercent:String(d),usd:i.totalCost,usage:i.totalTokens,cacheHitRate:y,cacheReusedTokens:i.cacheRead,cacheInputTokens:f,models:u}})}function vd(e,{limit:t=3,copyFn:n}={}){const a=typeof n=="function"?n:h=>h,r=Array.isArray(e?.sources)?e.sources:[];if(!r.length)return[];const s=new Map,i=new Map,l=new Map;let c=0;for(const h of r){const y=Array.isArray(h?.models)?h.models:[];for(const p of y){const x=tn(p?.totals);if(!Number.isFinite(x)||x<=0)continue;c+=x;const k=is(p,a("shared.placeholder.short")),w=ss(k);if(!w)continue;s.set(w,(s.get(w)||0)+x);const b=l.get(w)||0;x>=b&&(l.set(w,x),i.set(w,k))}}if(!s.size)return[];const d=Array.from(s.values()).reduce((h,y)=>h+y,0),u=c>0?c:d,f=Number.isFinite(t)?Math.max(0,Math.floor(t)):3;return Array.from(s.entries()).map(([h,y])=>{const p=u>0?(y/u*100).toFixed(1):"0.0";return{id:h,name:i.get(h)||a("shared.placeholder.short"),tokens:y,percent:String(p)}}).sort((h,y)=>y.tokens!==h.tokens?y.tokens-h.tokens:String(h.name).localeCompare(String(y.name))).slice(0,f)}function _d(e,t,n){if(!Number.isFinite(e))return g("shared.placeholder.short");const a=an(e,{decimals:2,currency:t,rate:n});return a==="-"?g("shared.placeholder.short"):a}function Kr(e,t,n){if(!Number.isFinite(e)||e<=0)return null;const a=ta(t);return(t===Uo?e:e*n)<.01?`<${a}0.01`:an(e,{decimals:2,currency:t,rate:n})}function Xr(e){const t=Number(e);return!Number.isFinite(t)||t<=0?null:Ae(t,{decimals:1})}const Nd=P.memo(function({isOpen:t,onClose:n,fleetData:a=[]}){const{currency:r,rate:s}=rn(),i=m.useMemo(()=>(Array.isArray(a)?a:[]).map(c=>{const d=$e(c?.usd)??0,u=$e(c?.usage)??0,f=Array.isArray(c?.models)?c.models:[];return{label:c?.label?String(c.label):"",usdValue:d,costLabel:Kr(d,r,s),tokensLabel:Xr(u),models:f.map(h=>{const y=$e(h?.usage)??0,p=$e(h?.cost)??0;return{id:h?.id?String(h.id):"",name:h?.name?String(h.name):"",tokensLabel:Xr(y),costLabel:Kr(p,r,s),sortCost:p}}).filter(h=>h.costLabel||h.tokensLabel).sort((h,y)=>y.sortCost-h.sortCost)}}).filter(c=>c.usdValue>0||c.models.length>0).sort((c,d)=>d.usdValue-c.usdValue),[a,r,s]),l=m.useMemo(()=>{const c=i.reduce((d,u)=>d+u.usdValue,0);return _d(c,r,s)},[i,r,s]);return o.jsx(cc,{open:t,onOpenChange:c=>{c||n?.()},children:o.jsxs(dc,{children:[o.jsx(uc,{className:"cost-modal-backdrop","data-cost-analysis-backdrop":"true"}),o.jsx(fc,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:o.jsxs(mc,{className:"cost-modal-popup relative w-full max-w-[460px] max-h-[calc(100vh-2rem)] flex flex-col rounded-2xl bg-white dark:bg-oai-gray-950 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden",children:[o.jsx(hc,{render:o.jsx("h2",{className:"sr-only"}),children:g("dashboard.cost_breakdown.title")}),o.jsx(Ec,{type:"button",className:"absolute top-3 right-3 flex h-9 w-9 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-100 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/50 transition-colors z-10","aria-label":g("dashboard.cost_breakdown.close"),children:o.jsx(or,{size:16,strokeWidth:2,"aria-hidden":!0})}),o.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto oai-scrollbar",children:o.jsxs("div",{className:"px-3 py-6",children:[o.jsx("p",{className:"text-label uppercase tracking-[0.12em] text-oai-gray-500 dark:text-oai-gray-400 mb-2",children:g("dashboard.cost_breakdown.total_label")}),o.jsx("p",{className:"font-bold text-oai-brand tabular-nums tracking-tight leading-none mb-6",style:{fontSize:"clamp(24px, 6.5vw, 32px)"},children:l}),i.length===0?o.jsx("p",{className:"text-body-sm text-oai-gray-500 dark:text-oai-gray-400",children:"No spend recorded."}):o.jsxs("div",{role:"table","aria-label":g("dashboard.cost_breakdown.title"),children:[o.jsxs("div",{role:"row",className:"flex items-center justify-between gap-4 py-2 mb-2 border-b border-oai-gray-200 dark:border-oai-gray-800 text-label uppercase text-oai-gray-500 dark:text-oai-gray-400",children:[o.jsx("span",{role:"columnheader",children:"Model"}),o.jsx("span",{role:"columnheader",children:"Cost"})]}),i.map((c,d)=>{const u=`fleet-${d}`;return o.jsxs("div",{role:"rowgroup","aria-labelledby":u,className:d>0?"mt-5":"mt-2",children:[o.jsxs("div",{role:"row",className:"flex items-center justify-between gap-4 py-2",children:[o.jsx("span",{id:u,role:"rowheader",className:"flex-1 min-w-0 text-body-sm font-semibold text-oai-black dark:text-oai-white truncate leading-none",children:c.label}),o.jsx("span",{role:"cell",className:"shrink-0 text-body-sm font-semibold text-oai-black dark:text-oai-white tabular-nums leading-none",children:c.costLabel||"—"})]}),c.models.map((f,h)=>o.jsxs("div",{role:"row",className:"flex items-center justify-between gap-4 py-[5px]",children:[o.jsx("span",{role:"cell",className:"flex-1 min-w-0 text-caption text-oai-gray-500 dark:text-oai-gray-400 truncate leading-none",title:f.name,children:f.name}),o.jsx("span",{role:"cell",className:"shrink-0 text-caption text-oai-gray-700 dark:text-oai-gray-300 tabular-nums leading-none",children:f.costLabel||""})]},f.id||`${f.name}-${h}`))]},`${c.label}-${d}`)})]})]})})]})})]})})});function jd({projectEntries:e=[],projectLimit:t=3,onProjectLimitChange:n,copy:a,hasDetailsActual:r,dailyEmptyPrefix:s,installSyncCmd:i,dailyEmptySuffix:l,detailsColumns:c,ariaSortFor:d,toggleSort:u,sortIconFor:f,pagedDetails:h,dailyBreakdownRows:y=[],dailyBreakdownColumns:p=[],dailyBreakdownAriaSortFor:x,dailyBreakdownSortIconFor:k,dailyBreakdownDateKey:w="day",detailsDateKey:b,renderDetailDate:_,renderDailyBreakdownDate:v,renderDetailCell:j,DETAILS_PAGED_PERIODS:N,period:E,detailsPageCount:M,detailsPage:T,setDetailsPage:O}){const[$,V]=m.useState("daily");return o.jsxs(et,{children:[o.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[o.jsxs("div",{role:"tablist","aria-label":"Data view",className:"flex gap-1",children:[o.jsx("button",{role:"tab","aria-selected":$==="daily",type:"button",onClick:()=>V("daily"),className:`text-xs font-medium px-3 py-1.5 rounded transition-colors ${$==="daily"?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/50"}`,children:a("dashboard.daily.title")}),o.jsx("button",{role:"tab","aria-selected":$==="projects",type:"button",onClick:()=>V("projects"),className:`text-xs font-medium px-3 py-1.5 rounded transition-colors ${$==="projects"?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/50"}`,children:a("dashboard.projects.title")})]}),$==="projects"&&o.jsx(Jo,{ariaLabel:a("dashboard.projects.limit_aria"),value:t,onValueChange:C=>n?.(Number(C)),options:[{value:3,label:a("dashboard.projects.limit_top_3")},{value:6,label:a("dashboard.projects.limit_top_6")},{value:10,label:a("dashboard.projects.limit_top_10")}],align:"end",className:"px-2 py-1 text-xs text-oai-gray-600 dark:text-oai-gray-300"})]}),$==="projects"&&o.jsx("div",{className:"space-y-1",children:e.slice(0,t).map((C,A)=>{const I=typeof C?.project_ref=="string"?C.project_ref:"",D=C?.project_key||I||`entry-${A}`,Y=C?.billable_total_tokens??C?.total_tokens,U=Number(Y),W=Number.isFinite(U)?U.toLocaleString():"—",ee=C?.project_key||I.split("/").pop()||"—";return o.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg",children:[o.jsx("div",{className:"w-8 h-8 rounded-md oai-bg-elevated flex items-center justify-center oai-text-caption font-medium text-oai-gray-500 dark:text-oai-gray-300",children:(C?.project_key?.[0]||"?").toUpperCase()}),o.jsx("div",{className:"min-w-0 flex-1",children:o.jsx("div",{className:"oai-text-body-sm font-medium text-oai-black dark:text-oai-white truncate",children:ee})}),o.jsx("div",{className:"oai-text-body-sm font-medium text-oai-black dark:text-oai-white tabular-nums",children:W})]},D)})}),$==="daily"&&o.jsxs("div",{children:[y?.length===0?o.jsxs("div",{className:"oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300 mb-4",children:[s,o.jsx("code",{className:"mx-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 oai-bg-elevated px-1.5 py-0.5 font-mono oai-text-caption",children:i}),l]}):o.jsx("div",{className:"overflow-auto max-h-[384px] -mx-4 oai-scrollbar",children:o.jsxs("table",{className:"w-full border-collapse",children:[o.jsx("thead",{className:"sticky top-0 z-10",children:o.jsx("tr",{className:"border-b border-oai-gray-200 dark:border-oai-gray-700",children:p.map(C=>o.jsx("th",{"aria-sort":x?.(C.key)||"none",className:"text-left p-0 bg-white dark:bg-oai-gray-900",children:o.jsx("button",{type:"button",onClick:()=>u(C.key),className:"flex w-full items-center justify-start px-2.5 sm:px-4 py-2 text-left oai-text-caption font-semibold text-oai-gray-600 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white transition-colors",children:o.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.jsx("span",{children:C.label}),o.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-400",children:k?.(C.key)||""})]})})},C.key))})}),o.jsx("tbody",{children:y.map(C=>o.jsxs("tr",{className:`border-b border-oai-gray-100 dark:border-oai-gray-800 last:border-b-0 hover:bg-oai-gray-50/50 dark:hover:bg-oai-gray-800/50 transition-colors ${C.missing?"text-oai-gray-400 dark:text-oai-gray-400":C.future?"text-oai-gray-300 dark:text-oai-gray-600":"text-oai-black dark:text-oai-white"}`,children:[o.jsx("td",{className:"px-2.5 sm:px-4 py-2 oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300 whitespace-nowrap",children:v?v(C):_(C)}),o.jsx("td",{className:"px-2.5 sm:px-4 py-2 oai-text-body-sm font-medium text-oai-black dark:text-oai-white tabular-nums",children:j(C,"total_tokens")}),o.jsx("td",{className:"px-2.5 sm:px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:j(C,"input_tokens")}),o.jsx("td",{className:"px-2.5 sm:px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:j(C,"output_tokens")}),o.jsx("td",{className:"px-2.5 sm:px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:j(C,"cached_input_tokens")}),o.jsx("td",{className:"px-2.5 sm:px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:j(C,"reasoning_output_tokens")}),o.jsx("td",{className:"px-2.5 sm:px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:j(C,"conversation_count")})]},String(C?.[w]||C?.day||C?.hour||C?.month||"")))})]})}),$!=="daily"&&N.has(E)&&M>1?o.jsxs("div",{className:"mt-3 flex items-center justify-between oai-text-caption",children:[o.jsx("button",{type:"button",onClick:()=>O(C=>Math.max(0,C-1)),disabled:T===0,className:"px-3 py-1.5 text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 rounded-md disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:a("details.pagination.prev")}),o.jsxs("span",{className:"oai-text-muted",children:[T+1," / ",M]}),o.jsx("button",{type:"button",onClick:()=>O(C=>Math.min(M-1,C+1)),disabled:T+1>=M,className:"px-3 py-1.5 text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 rounded-md disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:a("details.pagination.next")})]}):null]})]})}function Gn(e){return typeof e!="string"?"":e.trim()}function Qr(e){const t=Gn(e);return t?t.split(/[_\-\s]+/).filter(Boolean).map(n=>n.slice(0,1).toUpperCase()+n.slice(1).toLowerCase()).join(" "):""}function Sd(e){if(!Array.isArray(e))return[];const t=new Map;for(const n of e){if(!n||typeof n!="object")continue;const a=Gn(n.tool),r=Gn(n.planType)||Gn(n.plan_type);if(!a||!r)continue;const s=Qr(a)||a,i=Qr(r)||r;t.set(`${a.toLowerCase()}::${r.toLowerCase()}`,{tool:s,plan:i})}return Array.from(t.values())}function Md({rankLabel:e,streakDays:t,subscriptions:n=[],periodConversations:a,rolling:r,topModels:s=[],className:i=""}){const l=g("shared.placeholder.short"),c=g("shared.unit.percent"),d=e??g("identity_card.rank_placeholder"),u=Number.isFinite(Number(t))?Number(t):0,f=u?g("identity_card.streak_value",{days:u}):g("identity_card.rank_placeholder"),h=Sd(n),y={thousandSuffix:g("shared.unit.thousand_abbrev"),millionSuffix:g("shared.unit.million_abbrev"),billionSuffix:g("shared.unit.billion_abbrev")},p=w=>{if(w==null)return l;const b=Ae(w,y);return b==="-"?l:b},x={last7d:g("stats.period.last_7d"),last30d:g("stats.period.last_30d"),avg:g("stats.period.avg"),convs:g("stats.period.convs")},k=s.slice(0,3);return o.jsxs(et,{className:`h-full ${i}`,children:[o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[o.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[o.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:p(r?.last_7d?.totals?.billable_total_tokens)}),o.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:x.last7d})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[o.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:p(r?.last_30d?.totals?.billable_total_tokens)}),o.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:x.last30d})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[o.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:p(r?.last_30d?.avg_per_active_day)}),o.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:x.avg})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[o.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:p(a)}),o.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:x.convs})]})]}),k.length>0&&o.jsx("div",{className:"mt-4 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800",children:k.map((w,b)=>{const _=w?.name?String(w.name):l,v=w?.percent?String(w.percent):"",j=b===k.length-1,N=b+1;return o.jsxs("div",{className:`flex items-center py-2 ${j?"":"border-b border-oai-gray-50 dark:border-oai-gray-800"}`,children:[o.jsx("span",{className:"w-5 h-5 flex items-center justify-center rounded-full bg-oai-gray-100 dark:bg-oai-gray-800 text-[10px] font-semibold text-oai-gray-500 dark:text-oai-gray-300 flex-shrink-0",children:N}),o.jsx("span",{className:"flex-1 text-sm text-oai-gray-700 dark:text-oai-gray-300 truncate px-2.5",title:_,children:_}),o.jsxs("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums flex-shrink-0",children:[v,c]})]},w.id||_)})}),h.length>0&&o.jsx("div",{className:"mt-3 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800 flex flex-wrap gap-1.5",children:h.map((w,b)=>o.jsxs(Wc,{variant:"secondary",size:"sm",children:[w.tool," ",w.plan]},`${w.tool}:${w.plan}:${b}`))}),o.jsxs("div",{className:"mt-4 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800 flex items-center justify-between text-xs text-oai-gray-400 dark:text-oai-gray-400",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{children:g("identity_card.rank_label")}),o.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-300 tabular-nums",children:d})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{children:g("identity_card.streak_label")}),o.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-300 tabular-nums",children:f})]})]})]})}function Cd(e,t,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(" ")}const Dd={},bn={};function Lt(e,t){try{const a=(Dd[e]||=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format)(t).split("GMT")[1];return a in bn?bn[a]:Jr(a,a.split(":"))}catch{if(e in bn)return bn[e];const n=e?.match(Td);return n?Jr(e,n.slice(1)):NaN}}const Td=/([+-]\d\d):?(\d\d)?/;function Jr(e,t){const n=+(t[0]||0),a=+(t[1]||0),r=+(t[2]||0)/60;return bn[e]=n*60+a>0?n*60+a+r:n*60-a-r}class dt extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(Lt(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),ls(this),Ga(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new dt(...n,t):new dt(Date.now(),t)}withTimeZone(t){return new dt(+this,t)}getTimezoneOffset(){const t=-Lt(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),Ga(this),+this}[Symbol.for("constructDateFrom")](t){return new dt(+new Date(t),this.timeZone)}}const Zr=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!Zr.test(e))return;const t=e.replace(Zr,"$1UTC");dt.prototype[t]&&(e.startsWith("get")?dt.prototype[e]=function(){return this.internal[t]()}:(dt.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),Pd(this),+this},dt.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Ga(this),+this}))});function Ga(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-Lt(e.timeZone,e)*60))}function Pd(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),ls(e)}function ls(e){const t=Lt(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),a=new Date(+e);a.setUTCHours(a.getUTCHours()-1);const r=-new Date(+e).getTimezoneOffset(),s=-new Date(+a).getTimezoneOffset(),i=r-s,l=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();i&&l&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+i);const c=r-n;c&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+c);const d=new Date(+e);d.setUTCSeconds(0);const u=r>0?d.getSeconds():(d.getSeconds()-60)%60,f=Math.round(-(Lt(e.timeZone,e)*60))%60;(f||u)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+f),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+f+u));const h=Lt(e.timeZone,e),y=h>0?Math.floor(h):Math.ceil(h),x=-new Date(+e).getTimezoneOffset()-y,k=y!==n,w=x-c;if(k&&w){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+w);const b=Lt(e.timeZone,e),_=b>0?Math.floor(b):Math.ceil(b),v=y-_;v&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+v),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+v))}}class Ee extends dt{static tz(t,...n){return n.length?new Ee(...n,t):new Ee(Date.now(),t)}toISOString(){const[t,n,a]=this.tzComponents(),r=`${t}${n}:${a}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,n,a,r]=this.internal.toUTCString().split(" ");return`${t?.slice(0,-1)} ${a} ${n} ${r}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[n,a,r]=this.tzComponents();return`${t} GMT${n}${a}${r} (${Cd(this.timeZone,this)})`}toLocaleString(t,n){return Date.prototype.toLocaleString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(t,n){return Date.prototype.toLocaleDateString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(t,n){return Date.prototype.toLocaleTimeString.call(this,t,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),n=t>0?"-":"+",a=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),r=String(Math.abs(t)%60).padStart(2,"0");return[n,a,r]}withTimeZone(t){return new Ee(+this,t)}[Symbol.for("constructDateFrom")](t){return new Ee(+new Date(t),this.timeZone)}}const cs=6048e5,Od=864e5,eo=Symbol.for("constructDateFrom");function Se(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&eo in e?e[eo](t):e instanceof Date?new e.constructor(t):new Date(t)}function pe(e,t){return Se(t||e,e)}function ds(e,t,n){const a=pe(e,n?.in);return isNaN(t)?Se(e,NaN):(t&&a.setDate(a.getDate()+t),a)}function us(e,t,n){const a=pe(e,n?.in);if(isNaN(t))return Se(e,NaN);if(!t)return a;const r=a.getDate(),s=Se(e,a.getTime());s.setMonth(a.getMonth()+t+1,0);const i=s.getDate();return r>=i?s:(a.setFullYear(s.getFullYear(),s.getMonth(),r),a)}let Wd={};function wn(){return Wd}function Dt(e,t){const n=wn(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=pe(e,t?.in),s=r.getDay(),i=(s<a?7:0)+s-a;return r.setDate(r.getDate()-i),r.setHours(0,0,0,0),r}function xn(e,t){return Dt(e,{...t,weekStartsOn:1})}function fs(e,t){const n=pe(e,t?.in),a=n.getFullYear(),r=Se(n,0);r.setFullYear(a+1,0,4),r.setHours(0,0,0,0);const s=xn(r),i=Se(n,0);i.setFullYear(a,0,4),i.setHours(0,0,0,0);const l=xn(i);return n.getTime()>=s.getTime()?a+1:n.getTime()>=l.getTime()?a:a-1}function to(e){const t=pe(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function zt(e,...t){const n=Se.bind(null,e||t.find(a=>typeof a=="object"));return t.map(n)}function kn(e,t){const n=pe(e,t?.in);return n.setHours(0,0,0,0),n}function ir(e,t,n){const[a,r]=zt(n?.in,e,t),s=kn(a),i=kn(r),l=+s-to(s),c=+i-to(i);return Math.round((l-c)/Od)}function Ed(e,t){const n=fs(e,t),a=Se(e,0);return a.setFullYear(n,0,4),a.setHours(0,0,0,0),xn(a)}function $d(e,t,n){return ds(e,t*7,n)}function Ad(e,t,n){return us(e,t*12,n)}function Fd(e,t){let n,a=t?.in;return e.forEach(r=>{!a&&typeof r=="object"&&(a=Se.bind(null,r));const s=pe(r,a);(!n||n<s||isNaN(+s))&&(n=s)}),Se(a,n||NaN)}function Id(e,t){let n,a=t?.in;return e.forEach(r=>{!a&&typeof r=="object"&&(a=Se.bind(null,r));const s=pe(r,a);(!n||n>s||isNaN(+s))&&(n=s)}),Se(a,n||NaN)}function Ld(e,t,n){const[a,r]=zt(n?.in,e,t);return+kn(a)==+kn(r)}function ms(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Rd(e){return!(!ms(e)&&typeof e!="number"||isNaN(+pe(e)))}function hs(e,t,n){const[a,r]=zt(n?.in,e,t),s=a.getFullYear()-r.getFullYear(),i=a.getMonth()-r.getMonth();return s*12+i}function Bd(e,t){const n=pe(e,t?.in),a=n.getMonth();return n.setFullYear(n.getFullYear(),a+1,0),n.setHours(23,59,59,999),n}function gs(e,t){const[n,a]=zt(e,t.start,t.end);return{start:n,end:a}}function Yd(e,t){const{start:n,end:a}=gs(t?.in,e);let r=+n>+a;const s=r?+n:+a,i=r?a:n;i.setHours(0,0,0,0),i.setDate(1);let l=1;const c=[];for(;+i<=s;)c.push(Se(n,i)),i.setMonth(i.getMonth()+l);return r?c.reverse():c}function zd(e,t){const n=pe(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Hd(e,t){const n=pe(e,t?.in),a=n.getFullYear();return n.setFullYear(a+1,0,0),n.setHours(23,59,59,999),n}function ys(e,t){const n=pe(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Ud(e,t){const{start:n,end:a}=gs(t?.in,e);let r=+n>+a;const s=r?+n:+a,i=r?a:n;i.setHours(0,0,0,0),i.setMonth(0,1);let l=1;const c=[];for(;+i<=s;)c.push(Se(n,i)),i.setFullYear(i.getFullYear()+l);return r?c.reverse():c}function ps(e,t){const n=wn(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,r=pe(e,t?.in),s=r.getDay(),i=(s<a?-7:0)+6-(s-a);return r.setDate(r.getDate()+i),r.setHours(23,59,59,999),r}function qd(e,t){return ps(e,{...t,weekStartsOn:1})}const Vd={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Gd=(e,t,n)=>{let a;const r=Vd[e];return typeof r=="string"?a=r:t===1?a=r.one:a=r.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a};function Le(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Kd={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Xd={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Qd={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Jd={date:Le({formats:Kd,defaultWidth:"full"}),time:Le({formats:Xd,defaultWidth:"full"}),dateTime:Le({formats:Qd,defaultWidth:"full"})},Zd={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},eu=(e,t,n,a)=>Zd[e];function ke(e){return(t,n)=>{const a=n?.context?String(n.context):"standalone";let r;if(a==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,l=n?.width?String(n.width):i;r=e.formattingValues[l]||e.formattingValues[i]}else{const i=e.defaultWidth,l=n?.width?String(n.width):e.defaultWidth;r=e.values[l]||e.values[i]}const s=e.argumentCallback?e.argumentCallback(t):t;return r[s]}}const tu={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},nu={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},au={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},ru={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},ou={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},su={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},iu=(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},lu={ordinalNumber:iu,era:ke({values:tu,defaultWidth:"wide"}),quarter:ke({values:nu,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ke({values:au,defaultWidth:"wide"}),day:ke({values:ru,defaultWidth:"wide"}),dayPeriod:ke({values:ou,defaultWidth:"wide",formattingValues:su,defaultFormattingWidth:"wide"})};function we(e){return(t,n={})=>{const a=n.width,r=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],s=t.match(r);if(!s)return null;const i=s[0],l=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?du(l,f=>f.test(i)):cu(l,f=>f.test(i));let d;d=e.valueCallback?e.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const u=t.slice(i.length);return{value:d,rest:u}}}function cu(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function du(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function vn(e){return(t,n={})=>{const a=t.match(e.matchPattern);if(!a)return null;const r=a[0],s=t.match(e.parsePattern);if(!s)return null;let i=e.valueCallback?e.valueCallback(s[0]):s[0];i=n.valueCallback?n.valueCallback(i):i;const l=t.slice(r.length);return{value:i,rest:l}}}const uu=/^(\d+)(th|st|nd|rd)?/i,fu=/\d+/i,mu={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},hu={any:[/^b/i,/^(a|c)/i]},gu={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},yu={any:[/1/i,/2/i,/3/i,/4/i]},pu={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},bu={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},xu={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},ku={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},wu={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},vu={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},_u={ordinalNumber:vn({matchPattern:uu,parsePattern:fu,valueCallback:e=>parseInt(e,10)}),era:we({matchPatterns:mu,defaultMatchWidth:"wide",parsePatterns:hu,defaultParseWidth:"any"}),quarter:we({matchPatterns:gu,defaultMatchWidth:"wide",parsePatterns:yu,defaultParseWidth:"any",valueCallback:e=>e+1}),month:we({matchPatterns:pu,defaultMatchWidth:"wide",parsePatterns:bu,defaultParseWidth:"any"}),day:we({matchPatterns:xu,defaultMatchWidth:"wide",parsePatterns:ku,defaultParseWidth:"any"}),dayPeriod:we({matchPatterns:wu,defaultMatchWidth:"any",parsePatterns:vu,defaultParseWidth:"any"})},Ct={code:"en-US",formatDistance:Gd,formatLong:Jd,formatRelative:eu,localize:lu,match:_u,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Nu(e,t){const n=pe(e,t?.in);return ir(n,ys(n))+1}function lr(e,t){const n=pe(e,t?.in),a=+xn(n)-+Ed(n);return Math.round(a/cs)+1}function bs(e,t){const n=pe(e,t?.in),a=n.getFullYear(),r=wn(),s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,i=Se(t?.in||e,0);i.setFullYear(a+1,0,s),i.setHours(0,0,0,0);const l=Dt(i,t),c=Se(t?.in||e,0);c.setFullYear(a,0,s),c.setHours(0,0,0,0);const d=Dt(c,t);return+n>=+l?a+1:+n>=+d?a:a-1}function ju(e,t){const n=wn(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,r=bs(e,t),s=Se(t?.in||e,0);return s.setFullYear(r,0,a),s.setHours(0,0,0,0),Dt(s,t)}function cr(e,t){const n=pe(e,t?.in),a=+Dt(n,t)-+ju(n,t);return Math.round(a/cs)+1}function ye(e,t){const n=e<0?"-":"",a=Math.abs(e).toString().padStart(t,"0");return n+a}const jt={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return ye(t==="yy"?a%100:a,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):ye(n+1,2)},d(e,t){return ye(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(e,t){return ye(e.getHours()%12||12,t.length)},H(e,t){return ye(e.getHours(),t.length)},m(e,t){return ye(e.getMinutes(),t.length)},s(e,t){return ye(e.getSeconds(),t.length)},S(e,t){const n=t.length,a=e.getMilliseconds(),r=Math.trunc(a*Math.pow(10,n-3));return ye(r,t.length)}},Qt={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},no={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const a=e.getFullYear(),r=a>0?a:1-a;return n.ordinalNumber(r,{unit:"year"})}return jt.y(e,t)},Y:function(e,t,n,a){const r=bs(e,a),s=r>0?r:1-r;if(t==="YY"){const i=s%100;return ye(i,2)}return t==="Yo"?n.ordinalNumber(s,{unit:"year"}):ye(s,t.length)},R:function(e,t){const n=fs(e);return ye(n,t.length)},u:function(e,t){const n=e.getFullYear();return ye(n,t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return ye(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return ye(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return jt.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return ye(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const r=cr(e,a);return t==="wo"?n.ordinalNumber(r,{unit:"week"}):ye(r,t.length)},I:function(e,t,n){const a=lr(e);return t==="Io"?n.ordinalNumber(a,{unit:"week"}):ye(a,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):jt.d(e,t)},D:function(e,t,n){const a=Nu(e);return t==="Do"?n.ordinalNumber(a,{unit:"dayOfYear"}):ye(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const r=e.getDay(),s=(r-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return ye(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const r=e.getDay(),s=(r-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return ye(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),r=a===0?7:a;switch(t){case"i":return String(r);case"ii":return ye(r,t.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let r;switch(a===12?r=Qt.noon:a===0?r=Qt.midnight:r=a/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let r;switch(a>=17?r=Qt.evening:a>=12?r=Qt.afternoon:a>=4?r=Qt.morning:r=Qt.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let a=e.getHours()%12;return a===0&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return jt.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):jt.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return t==="Ko"?n.ordinalNumber(a,{unit:"hour"}):ye(a,t.length)},k:function(e,t,n){let a=e.getHours();return a===0&&(a=24),t==="ko"?n.ordinalNumber(a,{unit:"hour"}):ye(a,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):jt.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):jt.s(e,t)},S:function(e,t){return jt.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(a===0)return"Z";switch(t){case"X":return ro(a);case"XXXX":case"XX":return Ft(a);default:return Ft(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return ro(a);case"xxxx":case"xx":return Ft(a);default:return Ft(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+ao(a,":");default:return"GMT"+Ft(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+ao(a,":");default:return"GMT"+Ft(a,":")}},t:function(e,t,n){const a=Math.trunc(+e/1e3);return ye(a,t.length)},T:function(e,t,n){return ye(+e,t.length)}};function ao(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),r=Math.trunc(a/60),s=a%60;return s===0?n+String(r):n+String(r)+t+ye(s,2)}function ro(e,t){return e%60===0?(e>0?"-":"+")+ye(Math.abs(e)/60,2):Ft(e,t)}function Ft(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),r=ye(Math.trunc(a/60),2),s=ye(a%60,2);return n+r+t+s}const oo=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},xs=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Su=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],r=n[2];if(!r)return oo(e,t);let s;switch(a){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",oo(a,t)).replace("{{time}}",xs(r,t))},Mu={p:xs,P:Su},Cu=/^D+$/,Du=/^Y+$/,Tu=["D","DD","YY","YYYY"];function Pu(e){return Cu.test(e)}function Ou(e){return Du.test(e)}function Wu(e,t,n){const a=Eu(e,t,n);if(console.warn(a),Tu.includes(e))throw new RangeError(a)}function Eu(e,t,n){const a=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const $u=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Au=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Fu=/^'([^]*?)'?$/,Iu=/''/g,Lu=/[a-zA-Z]/;function ut(e,t,n){const a=wn(),r=n?.locale??a.locale??Ct,s=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,l=pe(e,n?.in);if(!Rd(l))throw new RangeError("Invalid time value");let c=t.match(Au).map(u=>{const f=u[0];if(f==="p"||f==="P"){const h=Mu[f];return h(u,r.formatLong)}return u}).join("").match($u).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const f=u[0];if(f==="'")return{isToken:!1,value:Ru(u)};if(no[f])return{isToken:!0,value:u};if(f.match(Lu))throw new RangeError("Format string contains an unescaped latin alphabet character `"+f+"`");return{isToken:!1,value:u}});r.localize.preprocessor&&(c=r.localize.preprocessor(l,c));const d={firstWeekContainsDate:s,weekStartsOn:i,locale:r};return c.map(u=>{if(!u.isToken)return u.value;const f=u.value;(!n?.useAdditionalWeekYearTokens&&Ou(f)||!n?.useAdditionalDayOfYearTokens&&Pu(f))&&Wu(f,t,String(e));const h=no[f[0]];return h(l,f,r.localize,d)}).join("")}function Ru(e){const t=e.match(Fu);return t?t[1].replace(Iu,"'"):e}function Bu(e,t){const n=pe(e,t?.in),a=n.getFullYear(),r=n.getMonth(),s=Se(n,0);return s.setFullYear(a,r+1,0),s.setHours(0,0,0,0),s.getDate()}function Yu(e,t){return pe(e,t?.in).getMonth()}function zu(e,t){return pe(e,t?.in).getFullYear()}function Hu(e,t){return+pe(e)>+pe(t)}function Uu(e,t){return+pe(e)<+pe(t)}function qu(e,t,n){const[a,r]=zt(n?.in,e,t);return+Dt(a,n)==+Dt(r,n)}function Vu(e,t,n){const[a,r]=zt(n?.in,e,t);return a.getFullYear()===r.getFullYear()&&a.getMonth()===r.getMonth()}function Gu(e,t,n){const[a,r]=zt(n?.in,e,t);return a.getFullYear()===r.getFullYear()}function Ku(e,t,n){const a=pe(e,n?.in),r=a.getFullYear(),s=a.getDate(),i=Se(e,0);i.setFullYear(r,t,15),i.setHours(0,0,0,0);const l=Bu(i);return a.setMonth(t,Math.min(s,l)),a}function Xu(e,t,n){const a=pe(e,n?.in);return isNaN(+a)?Se(e,NaN):(a.setFullYear(t),a)}const so=5,Qu=4;function Ju(e,t){const n=t.startOfMonth(e),a=n.getDay()>0?n.getDay():7,r=t.addDays(e,-a+1),s=t.addDays(r,so*7-1);return t.getMonth(e)===t.getMonth(s)?so:Qu}function ks(e,t){const n=t.startOfMonth(e),a=n.getDay();return a===1?n:a===0?t.addDays(n,-6):t.addDays(n,-1*(a-1))}function Zu(e,t){const n=ks(e,t),a=Ju(e,t);return t.addDays(n,a*7-1)}const ef={lessThanXSeconds:{one:"1秒未満",other:"{{count}}秒未満",oneWithSuffix:"約1秒",otherWithSuffix:"約{{count}}秒"},xSeconds:{one:"1秒",other:"{{count}}秒"},halfAMinute:"30秒",lessThanXMinutes:{one:"1分未満",other:"{{count}}分未満",oneWithSuffix:"約1分",otherWithSuffix:"約{{count}}分"},xMinutes:{one:"1分",other:"{{count}}分"},aboutXHours:{one:"約1時間",other:"約{{count}}時間"},xHours:{one:"1時間",other:"{{count}}時間"},xDays:{one:"1日",other:"{{count}}日"},aboutXWeeks:{one:"約1週間",other:"約{{count}}週間"},xWeeks:{one:"1週間",other:"{{count}}週間"},aboutXMonths:{one:"約1か月",other:"約{{count}}か月"},xMonths:{one:"1か月",other:"{{count}}か月"},aboutXYears:{one:"約1年",other:"約{{count}}年"},xYears:{one:"1年",other:"{{count}}年"},overXYears:{one:"1年以上",other:"{{count}}年以上"},almostXYears:{one:"1年近く",other:"{{count}}年近く"}},tf=(e,t,n)=>{n=n||{};let a;const r=ef[e];return typeof r=="string"?a=r:t===1?n.addSuffix&&r.oneWithSuffix?a=r.oneWithSuffix:a=r.one:n.addSuffix&&r.otherWithSuffix?a=r.otherWithSuffix.replace("{{count}}",String(t)):a=r.other.replace("{{count}}",String(t)),n.addSuffix?n.comparison&&n.comparison>0?a+"後":a+"前":a},nf={full:"y年M月d日EEEE",long:"y年M月d日",medium:"y/MM/dd",short:"y/MM/dd"},af={full:"H時mm分ss秒 zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},rf={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},of={date:Le({formats:nf,defaultWidth:"full"}),time:Le({formats:af,defaultWidth:"full"}),dateTime:Le({formats:rf,defaultWidth:"full"})},sf={lastWeek:"先週のeeeeのp",yesterday:"昨日のp",today:"今日のp",tomorrow:"明日のp",nextWeek:"翌週のeeeeのp",other:"P"},lf=(e,t,n,a)=>sf[e],cf={narrow:["BC","AC"],abbreviated:["紀元前","西暦"],wide:["紀元前","西暦"]},df={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["第1四半期","第2四半期","第3四半期","第4四半期"]},uf={narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},ff={narrow:["日","月","火","水","木","金","土"],short:["日","月","火","水","木","金","土"],abbreviated:["日","月","火","水","木","金","土"],wide:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},mf={narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},hf={narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},gf=(e,t)=>{const n=Number(e);switch(String(t?.unit)){case"year":return`${n}年`;case"quarter":return`第${n}四半期`;case"month":return`${n}月`;case"week":return`第${n}週`;case"date":return`${n}日`;case"hour":return`${n}時`;case"minute":return`${n}分`;case"second":return`${n}秒`;default:return`${n}`}},yf={ordinalNumber:gf,era:ke({values:cf,defaultWidth:"wide"}),quarter:ke({values:df,defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:ke({values:uf,defaultWidth:"wide"}),day:ke({values:ff,defaultWidth:"wide"}),dayPeriod:ke({values:mf,defaultWidth:"wide",formattingValues:hf,defaultFormattingWidth:"wide"})},pf=/^第?\d+(年|四半期|月|週|日|時|分|秒)?/i,bf=/\d+/i,xf={narrow:/^(B\.?C\.?|A\.?D\.?)/i,abbreviated:/^(紀元[前後]|西暦)/i,wide:/^(紀元[前後]|西暦)/i},kf={narrow:[/^B/i,/^A/i],any:[/^(紀元前)/i,/^(西暦|紀元後)/i]},wf={narrow:/^[1234]/i,abbreviated:/^Q[1234]/i,wide:/^第[1234一二三四1234]四半期/i},vf={any:[/(1|一|1)/i,/(2|二|2)/i,/(3|三|3)/i,/(4|四|4)/i]},_f={narrow:/^([123456789]|1[012])/,abbreviated:/^([123456789]|1[012])月/i,wide:/^([123456789]|1[012])月/i},Nf={any:[/^1\D/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},jf={narrow:/^[日月火水木金土]/,short:/^[日月火水木金土]/,abbreviated:/^[日月火水木金土]/,wide:/^[日月火水木金土]曜日/},Sf={any:[/^日/,/^月/,/^火/,/^水/,/^木/,/^金/,/^土/]},Mf={any:/^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i},Cf={any:{am:/^(A|午前)/i,pm:/^(P|午後)/i,midnight:/^深夜|真夜中/i,noon:/^正午/i,morning:/^朝/i,afternoon:/^午後/i,evening:/^夜/i,night:/^深夜/i}},Df={ordinalNumber:vn({matchPattern:pf,parsePattern:bf,valueCallback:function(e){return parseInt(e,10)}}),era:we({matchPatterns:xf,defaultMatchWidth:"wide",parsePatterns:kf,defaultParseWidth:"any"}),quarter:we({matchPatterns:wf,defaultMatchWidth:"wide",parsePatterns:vf,defaultParseWidth:"any",valueCallback:e=>e+1}),month:we({matchPatterns:_f,defaultMatchWidth:"wide",parsePatterns:Nf,defaultParseWidth:"any"}),day:we({matchPatterns:jf,defaultMatchWidth:"wide",parsePatterns:Sf,defaultParseWidth:"any"}),dayPeriod:we({matchPatterns:Mf,defaultMatchWidth:"any",parsePatterns:Cf,defaultParseWidth:"any"})},Tf={code:"ja",formatDistance:tf,formatLong:of,formatRelative:lf,localize:yf,match:Df,options:{weekStartsOn:0,firstWeekContainsDate:1}},Pf={lessThanXSeconds:{one:"1초 미만",other:"{{count}}초 미만"},xSeconds:{one:"1초",other:"{{count}}초"},halfAMinute:"30초",lessThanXMinutes:{one:"1분 미만",other:"{{count}}분 미만"},xMinutes:{one:"1분",other:"{{count}}분"},aboutXHours:{one:"약 1시간",other:"약 {{count}}시간"},xHours:{one:"1시간",other:"{{count}}시간"},xDays:{one:"1일",other:"{{count}}일"},aboutXWeeks:{one:"약 1주",other:"약 {{count}}주"},xWeeks:{one:"1주",other:"{{count}}주"},aboutXMonths:{one:"약 1개월",other:"약 {{count}}개월"},xMonths:{one:"1개월",other:"{{count}}개월"},aboutXYears:{one:"약 1년",other:"약 {{count}}년"},xYears:{one:"1년",other:"{{count}}년"},overXYears:{one:"1년 이상",other:"{{count}}년 이상"},almostXYears:{one:"거의 1년",other:"거의 {{count}}년"}},Of=(e,t,n)=>{let a;const r=Pf[e];return typeof r=="string"?a=r:t===1?a=r.one:a=r.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?a+" 후":a+" 전":a},Wf={full:"y년 M월 d일 EEEE",long:"y년 M월 d일",medium:"y.MM.dd",short:"y.MM.dd"},Ef={full:"a H시 mm분 ss초 zzzz",long:"a H:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},$f={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Af={date:Le({formats:Wf,defaultWidth:"full"}),time:Le({formats:Ef,defaultWidth:"full"}),dateTime:Le({formats:$f,defaultWidth:"full"})},Ff={lastWeek:"'지난' eeee p",yesterday:"'어제' p",today:"'오늘' p",tomorrow:"'내일' p",nextWeek:"'다음' eeee p",other:"P"},If=(e,t,n,a)=>Ff[e],Lf={narrow:["BC","AD"],abbreviated:["BC","AD"],wide:["기원전","서기"]},Rf={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1분기","2분기","3분기","4분기"]},Bf={narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],wide:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"]},Yf={narrow:["일","월","화","수","목","금","토"],short:["일","월","화","수","목","금","토"],abbreviated:["일","월","화","수","목","금","토"],wide:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"]},zf={narrow:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"},abbreviated:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"},wide:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"}},Hf={narrow:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"},abbreviated:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"},wide:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"}},Uf=(e,t)=>{const n=Number(e);switch(String(t?.unit)){case"minute":case"second":return String(n);case"date":return n+"일";default:return n+"번째"}},qf={ordinalNumber:Uf,era:ke({values:Lf,defaultWidth:"wide"}),quarter:ke({values:Rf,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ke({values:Bf,defaultWidth:"wide"}),day:ke({values:Yf,defaultWidth:"wide"}),dayPeriod:ke({values:zf,defaultWidth:"wide",formattingValues:Hf,defaultFormattingWidth:"wide"})},Vf=/^(\d+)(일|번째)?/i,Gf=/\d+/i,Kf={narrow:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(기원전|서기)/i},Xf={any:[/^(bc|기원전)/i,/^(ad|서기)/i]},Qf={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234]사?분기/i},Jf={any:[/1/i,/2/i,/3/i,/4/i]},Zf={narrow:/^(1[012]|[123456789])/,abbreviated:/^(1[012]|[123456789])월/i,wide:/^(1[012]|[123456789])월/i},em={any:[/^1월?$/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},tm={narrow:/^[일월화수목금토]/,short:/^[일월화수목금토]/,abbreviated:/^[일월화수목금토]/,wide:/^[일월화수목금토]요일/},nm={any:[/^일/,/^월/,/^화/,/^수/,/^목/,/^금/,/^토/]},am={any:/^(am|pm|오전|오후|자정|정오|아침|저녁|밤)/i},rm={any:{am:/^(am|오전)/i,pm:/^(pm|오후)/i,midnight:/^자정/i,noon:/^정오/i,morning:/^아침/i,afternoon:/^오후/i,evening:/^저녁/i,night:/^밤/i}},om={ordinalNumber:vn({matchPattern:Vf,parsePattern:Gf,valueCallback:e=>parseInt(e,10)}),era:we({matchPatterns:Kf,defaultMatchWidth:"wide",parsePatterns:Xf,defaultParseWidth:"any"}),quarter:we({matchPatterns:Qf,defaultMatchWidth:"wide",parsePatterns:Jf,defaultParseWidth:"any",valueCallback:e=>e+1}),month:we({matchPatterns:Zf,defaultMatchWidth:"wide",parsePatterns:em,defaultParseWidth:"any"}),day:we({matchPatterns:tm,defaultMatchWidth:"wide",parsePatterns:nm,defaultParseWidth:"any"}),dayPeriod:we({matchPatterns:am,defaultMatchWidth:"any",parsePatterns:rm,defaultParseWidth:"any"})},sm={code:"ko",formatDistance:Of,formatLong:Af,formatRelative:If,localize:qf,match:om,options:{weekStartsOn:0,firstWeekContainsDate:1}},im={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},lm=(e,t,n)=>{let a;const r=im[e];return typeof r=="string"?a=r:t===1?a=r.one:a=r.other.replace("{{count}}",String(t)),n?.addSuffix?n.comparison&&n.comparison>0?a+"内":a+"前":a},cm={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},dm={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},um={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},fm={date:Le({formats:cm,defaultWidth:"full"}),time:Le({formats:dm,defaultWidth:"full"}),dateTime:Le({formats:um,defaultWidth:"full"})};function io(e,t,n){const a="eeee p";return qu(e,t,n)?a:e.getTime()>t.getTime()?"'下个'"+a:"'上个'"+a}const mm={lastWeek:io,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:io,other:"PP p"},hm=(e,t,n,a)=>{const r=mm[e];return typeof r=="function"?r(t,n,a):r},gm={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},ym={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},pm={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},bm={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},xm={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},km={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},wm=(e,t)=>{const n=Number(e);switch(t?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},vm={ordinalNumber:wm,era:ke({values:gm,defaultWidth:"wide"}),quarter:ke({values:ym,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ke({values:pm,defaultWidth:"wide"}),day:ke({values:bm,defaultWidth:"wide"}),dayPeriod:ke({values:xm,defaultWidth:"wide",formattingValues:km,defaultFormattingWidth:"wide"})},_m=/^(第\s*)?\d+(日|时|分|秒)?/i,Nm=/\d+/i,jm={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},Sm={any:[/^(前)/i,/^(公元)/i]},Mm={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},Cm={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},Dm={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一]?)/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]?|\d|1[0-2])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一]?)月/i},Tm={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^(一|1(?!\d))/i,/^(二|2)/i,/^(三|3)/i,/^(四|4)/i,/^(五|5)/i,/^(六|6)/i,/^(七|7)/i,/^(八|8)/i,/^(九|9)/i,/^(十(?!(一|二))|10)/i,/^(十一|11)/i,/^(十二|12)/i]},Pm={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},Om={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},Wm={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},Em={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},$m={ordinalNumber:vn({matchPattern:_m,parsePattern:Nm,valueCallback:e=>parseInt(e,10)}),era:we({matchPatterns:jm,defaultMatchWidth:"wide",parsePatterns:Sm,defaultParseWidth:"any"}),quarter:we({matchPatterns:Mm,defaultMatchWidth:"wide",parsePatterns:Cm,defaultParseWidth:"any",valueCallback:e=>e+1}),month:we({matchPatterns:Dm,defaultMatchWidth:"wide",parsePatterns:Tm,defaultParseWidth:"any"}),day:we({matchPatterns:Pm,defaultMatchWidth:"wide",parsePatterns:Om,defaultParseWidth:"any"}),dayPeriod:we({matchPatterns:Wm,defaultMatchWidth:"any",parsePatterns:Em,defaultParseWidth:"any"})},Am={code:"zh-CN",formatDistance:lm,formatLong:fm,formatRelative:hm,localize:vm,match:$m,options:{weekStartsOn:1,firstWeekContainsDate:4}},Fm={lessThanXSeconds:{one:"少於 1 秒",other:"少於 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分鐘",lessThanXMinutes:{one:"少於 1 分鐘",other:"少於 {{count}} 分鐘"},xMinutes:{one:"1 分鐘",other:"{{count}} 分鐘"},xHours:{one:"1 小時",other:"{{count}} 小時"},aboutXHours:{one:"大約 1 小時",other:"大約 {{count}} 小時"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大約 1 個星期",other:"大約 {{count}} 個星期"},xWeeks:{one:"1 個星期",other:"{{count}} 個星期"},aboutXMonths:{one:"大約 1 個月",other:"大約 {{count}} 個月"},xMonths:{one:"1 個月",other:"{{count}} 個月"},aboutXYears:{one:"大約 1 年",other:"大約 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超過 1 年",other:"超過 {{count}} 年"},almostXYears:{one:"將近 1 年",other:"將近 {{count}} 年"}},Im=(e,t,n)=>{let a;const r=Fm[e];return typeof r=="string"?a=r:t===1?a=r.one:a=r.other.replace("{{count}}",String(t)),n?.addSuffix?n.comparison&&n.comparison>0?a+"內":a+"前":a},Lm={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},Rm={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},Bm={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Ym={date:Le({formats:Lm,defaultWidth:"full"}),time:Le({formats:Rm,defaultWidth:"full"}),dateTime:Le({formats:Bm,defaultWidth:"full"})},zm={lastWeek:"'上個'eeee p",yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:"'下個'eeee p",other:"P"},Hm=(e,t,n,a)=>zm[e],Um={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},qm={narrow:["1","2","3","4"],abbreviated:["第一刻","第二刻","第三刻","第四刻"],wide:["第一刻鐘","第二刻鐘","第三刻鐘","第四刻鐘"]},Vm={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},Gm={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["週日","週一","週二","週三","週四","週五","週六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},Km={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜間"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜間"}},Xm={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜間"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜間"}},Qm=(e,t)=>{const n=Number(e);switch(t?.unit){case"date":return n+"日";case"hour":return n+"時";case"minute":return n+"分";case"second":return n+"秒";default:return"第 "+n}},Jm={ordinalNumber:Qm,era:ke({values:Um,defaultWidth:"wide"}),quarter:ke({values:qm,defaultWidth:"wide",argumentCallback:e=>e-1}),month:ke({values:Vm,defaultWidth:"wide"}),day:ke({values:Gm,defaultWidth:"wide"}),dayPeriod:ke({values:Km,defaultWidth:"wide",formattingValues:Xm,defaultFormattingWidth:"wide"})},Zm=/^(第\s*)?\d+(日|時|分|秒)?/i,eh=/\d+/i,th={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},nh={any:[/^(前)/i,/^(公元)/i]},ah={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻鐘/i},rh={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},oh={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一]?)/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]?|\d|1[0-2])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一]?)月/i},sh={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^(一|1(?!\d))/i,/^(二|2)/i,/^(三|3)/i,/^(四|4)/i,/^(五|5)/i,/^(六|6)/i,/^(七|7)/i,/^(八|8)/i,/^(九|9)/i,/^(十(?!(一|二))|10)/i,/^(十一|11)/i,/^(十二|12)/i]},ih={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^週[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},lh={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},ch={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨)/i},dh={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},uh={ordinalNumber:vn({matchPattern:Zm,parsePattern:eh,valueCallback:e=>parseInt(e,10)}),era:we({matchPatterns:th,defaultMatchWidth:"wide",parsePatterns:nh,defaultParseWidth:"any"}),quarter:we({matchPatterns:ah,defaultMatchWidth:"wide",parsePatterns:rh,defaultParseWidth:"any",valueCallback:e=>e+1}),month:we({matchPatterns:oh,defaultMatchWidth:"wide",parsePatterns:sh,defaultParseWidth:"any"}),day:we({matchPatterns:ih,defaultMatchWidth:"wide",parsePatterns:lh,defaultParseWidth:"any"}),dayPeriod:we({matchPatterns:ch,defaultMatchWidth:"any",parsePatterns:dh,defaultParseWidth:"any"})},fh={code:"zh-TW",formatDistance:Im,formatLong:Ym,formatRelative:Hm,localize:Jm,match:uh,options:{weekStartsOn:1,firstWeekContainsDate:4}},ws={...Ct,labels:{labelDayButton:(e,t,n,a)=>{let r;a&&typeof a.format=="function"?r=a.format.bind(a):r=(i,l)=>ut(i,l,{locale:Ct,...n});let s=r(e,"PPPP");return t.today&&(s=`Today, ${s}`),t.selected&&(s=`${s}, selected`),s},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:"Choose the Year",labelGrid:(e,t,n)=>{let a;return n&&typeof n.format=="function"?a=n.format.bind(n):a=(r,s)=>ut(r,s,{locale:Ct,...t}),a(e,"LLLL yyyy")},labelGridcell:(e,t,n,a)=>{let r;a&&typeof a.format=="function"?r=a.format.bind(a):r=(i,l)=>ut(i,l,{locale:Ct,...n});let s=r(e,"PPPP");return t?.today&&(s=`Today, ${s}`),s},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,t,n)=>{let a;return n&&typeof n.format=="function"?a=n.format.bind(n):a=(r,s)=>ut(r,s,{locale:Ct,...t}),a(e,"cccc")}}};class Ke{constructor(t,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Ee.tz(this.options.timeZone):new this.Date,this.newDate=(a,r,s)=>this.overrides?.newDate?this.overrides.newDate(a,r,s):this.options.timeZone?new Ee(a,r,s,this.options.timeZone):new Date(a,r,s),this.addDays=(a,r)=>this.overrides?.addDays?this.overrides.addDays(a,r):ds(a,r),this.addMonths=(a,r)=>this.overrides?.addMonths?this.overrides.addMonths(a,r):us(a,r),this.addWeeks=(a,r)=>this.overrides?.addWeeks?this.overrides.addWeeks(a,r):$d(a,r),this.addYears=(a,r)=>this.overrides?.addYears?this.overrides.addYears(a,r):Ad(a,r),this.differenceInCalendarDays=(a,r)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(a,r):ir(a,r),this.differenceInCalendarMonths=(a,r)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(a,r):hs(a,r),this.eachMonthOfInterval=a=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(a):Yd(a),this.eachYearOfInterval=a=>{const r=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(a):Ud(a),s=new Set(r.map(l=>this.getYear(l)));if(s.size===r.length)return r;const i=[];return s.forEach(l=>{i.push(new Date(l,0,1))}),i},this.endOfBroadcastWeek=a=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(a):Zu(a,this),this.endOfISOWeek=a=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(a):qd(a),this.endOfMonth=a=>this.overrides?.endOfMonth?this.overrides.endOfMonth(a):Bd(a),this.endOfWeek=(a,r)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(a,r):ps(a,this.options),this.endOfYear=a=>this.overrides?.endOfYear?this.overrides.endOfYear(a):Hd(a),this.format=(a,r,s)=>{const i=this.overrides?.format?this.overrides.format(a,r,this.options):ut(a,r,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(i):i},this.getISOWeek=a=>this.overrides?.getISOWeek?this.overrides.getISOWeek(a):lr(a),this.getMonth=(a,r)=>this.overrides?.getMonth?this.overrides.getMonth(a,this.options):Yu(a,this.options),this.getYear=(a,r)=>this.overrides?.getYear?this.overrides.getYear(a,this.options):zu(a,this.options),this.getWeek=(a,r)=>this.overrides?.getWeek?this.overrides.getWeek(a,this.options):cr(a,this.options),this.isAfter=(a,r)=>this.overrides?.isAfter?this.overrides.isAfter(a,r):Hu(a,r),this.isBefore=(a,r)=>this.overrides?.isBefore?this.overrides.isBefore(a,r):Uu(a,r),this.isDate=a=>this.overrides?.isDate?this.overrides.isDate(a):ms(a),this.isSameDay=(a,r)=>this.overrides?.isSameDay?this.overrides.isSameDay(a,r):Ld(a,r),this.isSameMonth=(a,r)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(a,r):Vu(a,r),this.isSameYear=(a,r)=>this.overrides?.isSameYear?this.overrides.isSameYear(a,r):Gu(a,r),this.max=a=>this.overrides?.max?this.overrides.max(a):Fd(a),this.min=a=>this.overrides?.min?this.overrides.min(a):Id(a),this.setMonth=(a,r)=>this.overrides?.setMonth?this.overrides.setMonth(a,r):Ku(a,r),this.setYear=(a,r)=>this.overrides?.setYear?this.overrides.setYear(a,r):Xu(a,r),this.startOfBroadcastWeek=(a,r)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(a,this):ks(a,this),this.startOfDay=a=>this.overrides?.startOfDay?this.overrides.startOfDay(a):kn(a),this.startOfISOWeek=a=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(a):xn(a),this.startOfMonth=a=>this.overrides?.startOfMonth?this.overrides.startOfMonth(a):zd(a),this.startOfWeek=(a,r)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(a,this.options):Dt(a,this.options),this.startOfYear=a=>this.overrides?.startOfYear?this.overrides.startOfYear(a):ys(a),this.options={locale:ws,...t},this.overrides=n}getDigitMap(){const{numerals:t="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:t}),a={};for(let r=0;r<10;r++)a[r.toString()]=n.format(r);return a}replaceDigits(t){const n=this.getDigitMap();return t.replace(/\d/g,a=>n[a]||a)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){const t=this.options.locale?.code;return t&&Ke.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:n,timeZone:a,numerals:r}=this.options,s=n?.code;if(s&&Ke.yearFirstLocales.has(s))try{return new Intl.DateTimeFormat(s,{month:"long",year:"numeric",timeZone:a,numberingSystem:r}).format(t)}catch{}const i=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,i)}}Ke.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const ft=new Ke;class vs{constructor(t,n,a=ft){this.date=t,this.displayMonth=n,this.outside=!!(n&&!a.isSameMonth(t,n)),this.dateLib=a,this.isoDate=a.format(t,"yyyy-MM-dd"),this.displayMonthId=a.format(n,"yyyy-MM"),this.dateMonthId=a.format(t,"yyyy-MM")}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class mh{constructor(t,n){this.date=t,this.weeks=n}}class hh{constructor(t,n){this.days=n,this.weekNumber=t}}function gh(e){return P.createElement("button",{...e})}function yh(e){return P.createElement("span",{...e})}function ph(e){const{size:t=24,orientation:n="left",className:a}=e;return P.createElement("svg",{className:a,width:t,height:t,viewBox:"0 0 24 24"},n==="up"&&P.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&P.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&P.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&P.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function bh(e){const{day:t,modifiers:n,...a}=e;return P.createElement("td",{...a})}function xh(e){const{day:t,modifiers:n,...a}=e,r=P.useRef(null);return P.useEffect(()=>{n.focused&&r.current?.focus()},[n.focused]),P.createElement("button",{ref:r,...a})}var q;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(q||(q={}));var Ne;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(Ne||(Ne={}));var rt;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(rt||(rt={}));var Ge;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(Ge||(Ge={}));function kh(e){const{options:t,className:n,components:a,classNames:r,...s}=e,i=[r[q.Dropdown],n].join(" "),l=t?.find(({value:c})=>c===s.value);return P.createElement("span",{"data-disabled":s.disabled,className:r[q.DropdownRoot]},P.createElement(a.Select,{className:i,...s},t?.map(({value:c,label:d,disabled:u})=>P.createElement(a.Option,{key:c,value:c,disabled:u},d))),P.createElement("span",{className:r[q.CaptionLabel],"aria-hidden":!0},l?.label,P.createElement(a.Chevron,{orientation:"down",size:18,className:r[q.Chevron]})))}function wh(e){return P.createElement("div",{...e})}function vh(e){return P.createElement("div",{...e})}function _h(e){const{calendarMonth:t,displayIndex:n,...a}=e;return P.createElement("div",{...a},e.children)}function Nh(e){const{calendarMonth:t,displayIndex:n,...a}=e;return P.createElement("div",{...a})}function jh(e){return P.createElement("table",{...e})}function Sh(e){return P.createElement("div",{...e})}const _s=m.createContext(void 0);function _n(){const e=m.useContext(_s);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function Mh(e){const{components:t}=_n();return P.createElement(t.Dropdown,{...e})}function Ch(e){const{onPreviousClick:t,onNextClick:n,previousMonth:a,nextMonth:r,...s}=e,{components:i,classNames:l,labels:{labelPrevious:c,labelNext:d}}=_n(),u=m.useCallback(h=>{r&&n?.(h)},[r,n]),f=m.useCallback(h=>{a&&t?.(h)},[a,t]);return P.createElement("nav",{...s},P.createElement(i.PreviousMonthButton,{type:"button",className:l[q.PreviousMonthButton],tabIndex:a?void 0:-1,"aria-disabled":a?void 0:!0,"aria-label":c(a),onClick:f},P.createElement(i.Chevron,{disabled:a?void 0:!0,className:l[q.Chevron],orientation:"left"})),P.createElement(i.NextMonthButton,{type:"button",className:l[q.NextMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:u},P.createElement(i.Chevron,{disabled:r?void 0:!0,orientation:"right",className:l[q.Chevron]})))}function Dh(e){const{components:t}=_n();return P.createElement(t.Button,{...e})}function Th(e){return P.createElement("option",{...e})}function Ph(e){const{components:t}=_n();return P.createElement(t.Button,{...e})}function Oh(e){const{rootRef:t,...n}=e;return P.createElement("div",{...n,ref:t})}function Wh(e){return P.createElement("select",{...e})}function Eh(e){const{week:t,...n}=e;return P.createElement("tr",{...n})}function $h(e){return P.createElement("th",{...e})}function Ah(e){return P.createElement("thead",{"aria-hidden":!0},P.createElement("tr",{...e}))}function Fh(e){const{week:t,...n}=e;return P.createElement("th",{...n})}function Ih(e){return P.createElement("th",{...e})}function Lh(e){return P.createElement("tbody",{...e})}function Rh(e){const{components:t}=_n();return P.createElement(t.Dropdown,{...e})}const Bh=Object.freeze(Object.defineProperty({__proto__:null,Button:gh,CaptionLabel:yh,Chevron:ph,Day:bh,DayButton:xh,Dropdown:kh,DropdownNav:wh,Footer:vh,Month:_h,MonthCaption:Nh,MonthGrid:jh,Months:Sh,MonthsDropdown:Mh,Nav:Ch,NextMonthButton:Dh,Option:Th,PreviousMonthButton:Ph,Root:Oh,Select:Wh,Week:Eh,WeekNumber:Fh,WeekNumberHeader:Ih,Weekday:$h,Weekdays:Ah,Weeks:Lh,YearsDropdown:Rh},Symbol.toStringTag,{value:"Module"}));function kt(e,t,n=!1,a=ft){let{from:r,to:s}=e;const{differenceInCalendarDays:i,isSameDay:l}=a;return r&&s?(i(s,r)<0&&([r,s]=[s,r]),i(t,r)>=(n?1:0)&&i(s,t)>=(n?1:0)):!n&&s?l(s,t):!n&&r?l(r,t):!1}function dr(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function aa(e){return!!(e&&typeof e=="object"&&"from"in e)}function ur(e){return!!(e&&typeof e=="object"&&"after"in e)}function fr(e){return!!(e&&typeof e=="object"&&"before"in e)}function Ns(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function js(e,t){return Array.isArray(e)&&e.every(t.isDate)}function wt(e,t,n=ft){const a=Array.isArray(t)?t:[t],{isSameDay:r,differenceInCalendarDays:s,isAfter:i}=n;return a.some(l=>{if(typeof l=="boolean")return l;if(n.isDate(l))return r(e,l);if(js(l,n))return l.some(c=>r(e,c));if(aa(l))return kt(l,e,!1,n);if(Ns(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(e.getDay()):l.dayOfWeek===e.getDay();if(dr(l)){const c=s(l.before,e),d=s(l.after,e),u=c>0,f=d<0;return i(l.before,l.after)?f&&u:u||f}return ur(l)?s(e,l.after)>0:fr(l)?s(l.before,e)>0:typeof l=="function"?l(e):!1})}function Yh(e,t,n,a,r){const{disabled:s,hidden:i,modifiers:l,showOutsideDays:c,broadcastCalendar:d,today:u=r.today()}=t,{isSameDay:f,isSameMonth:h,startOfMonth:y,isBefore:p,endOfMonth:x,isAfter:k}=r,w=n&&y(n),b=a&&x(a),_={[Ne.focused]:[],[Ne.outside]:[],[Ne.disabled]:[],[Ne.hidden]:[],[Ne.today]:[]},v={};for(const j of e){const{date:N,displayMonth:E}=j,M=!!(E&&!h(N,E)),T=!!(w&&p(N,w)),O=!!(b&&k(N,b)),$=!!(s&&wt(N,s,r)),V=!!(i&&wt(N,i,r))||T||O||!d&&!c&&M||d&&c===!1&&M,C=f(N,u);M&&_.outside.push(j),$&&_.disabled.push(j),V&&_.hidden.push(j),C&&_.today.push(j),l&&Object.keys(l).forEach(A=>{const I=l?.[A];I&&wt(N,I,r)&&(v[A]?v[A].push(j):v[A]=[j])})}return j=>{const N={[Ne.focused]:!1,[Ne.disabled]:!1,[Ne.hidden]:!1,[Ne.outside]:!1,[Ne.today]:!1},E={};for(const M in _){const T=_[M];N[M]=T.some(O=>O===j)}for(const M in v)E[M]=v[M].some(T=>T===j);return{...N,...E}}}function zh(e,t,n={}){return Object.entries(e).filter(([,r])=>r===!0).reduce((r,[s])=>(n[s]?r.push(n[s]):t[Ne[s]]?r.push(t[Ne[s]]):t[rt[s]]&&r.push(t[rt[s]]),r),[t[q.Day]])}function Hh(e){return{...Bh,...e}}function Uh(e){const t={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,a])=>{n.startsWith("data-")&&(t[n]=a)}),t}function qh(){const e={};for(const t in q)e[q[t]]=`rdp-${q[t]}`;for(const t in Ne)e[Ne[t]]=`rdp-${Ne[t]}`;for(const t in rt)e[rt[t]]=`rdp-${rt[t]}`;for(const t in Ge)e[Ge[t]]=`rdp-${Ge[t]}`;return e}function Ss(e,t,n){return(n??new Ke(t)).formatMonthYear(e)}const Vh=Ss;function Gh(e,t,n){return(n??new Ke(t)).format(e,"d")}function Kh(e,t=ft){return t.format(e,"LLLL")}function Xh(e,t,n){return(n??new Ke(t)).format(e,"cccccc")}function Qh(e,t=ft){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function Jh(){return""}function Ms(e,t=ft){return t.format(e,"yyyy")}const Zh=Ms,eg=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Ss,formatDay:Gh,formatMonthCaption:Vh,formatMonthDropdown:Kh,formatWeekNumber:Qh,formatWeekNumberHeader:Jh,formatWeekdayName:Xh,formatYearCaption:Zh,formatYearDropdown:Ms},Symbol.toStringTag,{value:"Module"}));function tg(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...eg,...e}}function mr(e,t,n,a){let r=(a??new Ke(n)).format(e,"PPPP");return t.today&&(r=`Today, ${r}`),t.selected&&(r=`${r}, selected`),r}const ng=mr;function hr(e,t,n){return(n??new Ke(t)).formatMonthYear(e)}const ag=hr;function Cs(e,t,n,a){let r=(a??new Ke(n)).format(e,"PPPP");return t?.today&&(r=`Today, ${r}`),r}function Ds(e){return"Choose the Month"}function Ts(){return""}const rg="Go to the Next Month";function Ps(e,t){return rg}function Os(e){return"Go to the Previous Month"}function Ws(e,t,n){return(n??new Ke(t)).format(e,"cccc")}function Es(e,t){return`Week ${e}`}function $s(e){return"Week Number"}function As(e){return"Choose the Year"}const og=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:ag,labelDay:ng,labelDayButton:mr,labelGrid:hr,labelGridcell:Cs,labelMonthDropdown:Ds,labelNav:Ts,labelNext:Ps,labelPrevious:Os,labelWeekNumber:Es,labelWeekNumberHeader:$s,labelWeekday:Ws,labelYearDropdown:As},Symbol.toStringTag,{value:"Module"})),at=(e,t,n)=>t||(n?typeof n=="function"?n:(...a)=>n:e);function sg(e,t){const n=t.locale?.labels??{};return{...og,...e??{},labelDayButton:at(mr,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:at(Ds,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:at(Ps,e?.labelNext,n.labelNext),labelPrevious:at(Os,e?.labelPrevious,n.labelPrevious),labelWeekNumber:at(Es,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:at(As,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:at(hr,e?.labelGrid,n.labelGrid),labelGridcell:at(Cs,e?.labelGridcell,n.labelGridcell),labelNav:at(Ts,e?.labelNav,n.labelNav),labelWeekNumberHeader:at($s,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:at(Ws,e?.labelWeekday,n.labelWeekday)}}function ig(e,t,n,a,r){const{startOfMonth:s,startOfYear:i,endOfYear:l,eachMonthOfInterval:c,getMonth:d}=r;return c({start:i(e),end:l(e)}).map(h=>{const y=a.formatMonthDropdown(h,r),p=d(h),x=t&&h<s(t)||n&&h>s(n)||!1;return{value:p,label:y,disabled:x}})}function lg(e,t={},n={}){let a={...t?.[q.Day]};return Object.entries(e).filter(([,r])=>r===!0).forEach(([r])=>{a={...a,...n?.[r]}}),a}function cg(e,t,n,a){const r=a??e.today(),s=n?e.startOfBroadcastWeek(r,e):t?e.startOfISOWeek(r):e.startOfWeek(r),i=[];for(let l=0;l<7;l++){const c=e.addDays(s,l);i.push(c)}return i}function dg(e,t,n,a,r=!1){if(!e||!t)return;const{startOfYear:s,endOfYear:i,eachYearOfInterval:l,getYear:c}=a,d=s(e),u=i(t),f=l({start:d,end:u});return r&&f.reverse(),f.map(h=>{const y=n.formatYearDropdown(h,a);return{value:c(h),label:y,disabled:!1}})}function ug(e,t={}){const{weekStartsOn:n,locale:a}=t,r=n??a?.options?.weekStartsOn??0,s=l=>{const c=typeof l=="number"||typeof l=="string"?new Date(l):l;return new Ee(c.getFullYear(),c.getMonth(),c.getDate(),12,0,0,e)},i=l=>{const c=s(l);return new Date(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0,0)};return{today:()=>s(Ee.tz(e)),newDate:(l,c,d)=>new Ee(l,c,d,12,0,0,e),startOfDay:l=>s(l),startOfWeek:(l,c)=>{const d=s(l),u=c?.weekStartsOn??r,f=(d.getDay()-u+7)%7;return d.setDate(d.getDate()-f),d},startOfISOWeek:l=>{const c=s(l),d=(c.getDay()-1+7)%7;return c.setDate(c.getDate()-d),c},startOfMonth:l=>{const c=s(l);return c.setDate(1),c},startOfYear:l=>{const c=s(l);return c.setMonth(0,1),c},endOfWeek:(l,c)=>{const d=s(l),h=(((c?.weekStartsOn??r)+6)%7-d.getDay()+7)%7;return d.setDate(d.getDate()+h),d},endOfISOWeek:l=>{const c=s(l),d=(7-c.getDay())%7;return c.setDate(c.getDate()+d),c},endOfMonth:l=>{const c=s(l);return c.setMonth(c.getMonth()+1,0),c},endOfYear:l=>{const c=s(l);return c.setMonth(11,31),c},eachMonthOfInterval:l=>{const c=s(l.start),d=s(l.end),u=[],f=new Ee(c.getFullYear(),c.getMonth(),1,12,0,0,e),h=d.getFullYear()*12+d.getMonth();for(;f.getFullYear()*12+f.getMonth()<=h;)u.push(new Ee(f,e)),f.setMonth(f.getMonth()+1,1);return u},addDays:(l,c)=>{const d=s(l);return d.setDate(d.getDate()+c),d},addWeeks:(l,c)=>{const d=s(l);return d.setDate(d.getDate()+c*7),d},addMonths:(l,c)=>{const d=s(l);return d.setMonth(d.getMonth()+c),d},addYears:(l,c)=>{const d=s(l);return d.setFullYear(d.getFullYear()+c),d},eachYearOfInterval:l=>{const c=s(l.start),d=s(l.end),u=[],f=new Ee(c.getFullYear(),0,1,12,0,0,e);for(;f.getFullYear()<=d.getFullYear();)u.push(new Ee(f,e)),f.setFullYear(f.getFullYear()+1,0,1);return u},getWeek:(l,c)=>{const d=i(l);return cr(d,{weekStartsOn:c?.weekStartsOn??r,firstWeekContainsDate:c?.firstWeekContainsDate??a?.options?.firstWeekContainsDate??1})},getISOWeek:l=>{const c=i(l);return lr(c)},differenceInCalendarDays:(l,c)=>{const d=i(l),u=i(c);return ir(d,u)},differenceInCalendarMonths:(l,c)=>{const d=i(l),u=i(c);return hs(d,u)}}}const Nn=e=>e instanceof HTMLElement?e:null,Da=e=>[...e.querySelectorAll("[data-animated-month]")??[]],fg=e=>Nn(e.querySelector("[data-animated-month]")),Ta=e=>Nn(e.querySelector("[data-animated-caption]")),Pa=e=>Nn(e.querySelector("[data-animated-weeks]")),mg=e=>Nn(e.querySelector("[data-animated-nav]")),hg=e=>Nn(e.querySelector("[data-animated-weekdays]"));function gg(e,t,{classNames:n,months:a,focused:r,dateLib:s}){const i=m.useRef(null),l=m.useRef(a),c=m.useRef(!1);m.useLayoutEffect(()=>{const d=l.current;if(l.current=a,!t||!e.current||!(e.current instanceof HTMLElement)||a.length===0||d.length===0||a.length!==d.length)return;const u=s.isSameMonth(a[0].date,d[0].date),f=s.isAfter(a[0].date,d[0].date),h=f?n[Ge.caption_after_enter]:n[Ge.caption_before_enter],y=f?n[Ge.weeks_after_enter]:n[Ge.weeks_before_enter],p=i.current,x=e.current.cloneNode(!0);if(x instanceof HTMLElement?(Da(x).forEach(_=>{if(!(_ instanceof HTMLElement))return;const v=fg(_);v&&_.contains(v)&&_.removeChild(v);const j=Ta(_);j&&j.classList.remove(h);const N=Pa(_);N&&N.classList.remove(y)}),i.current=x):i.current=null,c.current||u||r)return;const k=p instanceof HTMLElement?Da(p):[],w=Da(e.current);if(w?.every(b=>b instanceof HTMLElement)&&k&&k.every(b=>b instanceof HTMLElement)){c.current=!0,e.current.style.isolation="isolate";const b=mg(e.current);b&&(b.style.zIndex="1"),w.forEach((_,v)=>{const j=k[v];if(!j)return;_.style.position="relative",_.style.overflow="hidden";const N=Ta(_);N&&N.classList.add(h);const E=Pa(_);E&&E.classList.add(y);const M=()=>{c.current=!1,e.current&&(e.current.style.isolation=""),b&&(b.style.zIndex=""),N&&N.classList.remove(h),E&&E.classList.remove(y),_.style.position="",_.style.overflow="",_.contains(j)&&_.removeChild(j)};j.style.pointerEvents="none",j.style.position="absolute",j.style.overflow="hidden",j.setAttribute("aria-hidden","true");const T=hg(j);T&&(T.style.opacity="0");const O=Ta(j);O&&(O.classList.add(f?n[Ge.caption_before_exit]:n[Ge.caption_after_exit]),O.addEventListener("animationend",M));const $=Pa(j);$&&$.classList.add(f?n[Ge.weeks_before_exit]:n[Ge.weeks_after_exit]),_.insertBefore(j,_.firstChild)})}})}function yg(e,t,n,a){const r=e[0],s=e[e.length-1],{ISOWeek:i,fixedWeeks:l,broadcastCalendar:c}=n??{},{addDays:d,differenceInCalendarDays:u,differenceInCalendarMonths:f,endOfBroadcastWeek:h,endOfISOWeek:y,endOfMonth:p,endOfWeek:x,isAfter:k,startOfBroadcastWeek:w,startOfISOWeek:b,startOfWeek:_}=a,v=c?w(r,a):i?b(r):_(r),j=c?h(s):i?y(p(s)):x(p(s)),N=t&&(c?h(t):i?y(t):x(t)),E=N&&k(j,N)?N:j,M=u(E,v),T=f(s,r)+1,O=[];for(let C=0;C<=M;C++){const A=d(v,C);O.push(A)}const V=(c?35:42)*T;if(l&&O.length<V){const C=V-O.length;for(let A=0;A<C;A++){const I=d(O[O.length-1],1);O.push(I)}}return O}function pg(e){const t=[];return e.reduce((n,a)=>{const r=a.weeks.reduce((s,i)=>s.concat(i.days.slice()),t.slice());return n.concat(r.slice())},t.slice())}function bg(e,t,n,a){const{numberOfMonths:r=1}=n,s=[];for(let i=0;i<r;i++){const l=a.addMonths(e,i);if(t&&l>t)break;s.push(l)}return s}function lo(e,t,n,a){const{month:r,defaultMonth:s,today:i=a.today(),numberOfMonths:l=1}=e;let c=r||s||i;const{differenceInCalendarMonths:d,addMonths:u,startOfMonth:f}=a;if(n&&d(n,c)<l-1){const h=-1*(l-1);c=u(n,h)}return t&&d(c,t)<0&&(c=t),f(c)}function xg(e,t,n,a){const{addDays:r,endOfBroadcastWeek:s,endOfISOWeek:i,endOfMonth:l,endOfWeek:c,getISOWeek:d,getWeek:u,startOfBroadcastWeek:f,startOfISOWeek:h,startOfWeek:y}=a,p=e.reduce((x,k)=>{const w=n.broadcastCalendar?f(k,a):n.ISOWeek?h(k):y(k),b=n.broadcastCalendar?s(k):n.ISOWeek?i(l(k)):c(l(k)),_=t.filter(E=>E>=w&&E<=b),v=n.broadcastCalendar?35:42;if(n.fixedWeeks&&_.length<v){const E=t.filter(M=>{const T=v-_.length;return M>b&&M<=r(b,T)});_.push(...E)}const j=_.reduce((E,M)=>{const T=n.ISOWeek?d(M):u(M),O=E.find(V=>V.weekNumber===T),$=new vs(M,k,a);return O?O.days.push($):E.push(new hh(T,[$])),E},[]),N=new mh(k,j);return x.push(N),x},[]);return n.reverseMonths?p.reverse():p}function kg(e,t){let{startMonth:n,endMonth:a}=e;const{startOfYear:r,startOfDay:s,startOfMonth:i,endOfMonth:l,addYears:c,endOfYear:d,newDate:u,today:f}=t,{fromYear:h,toYear:y,fromMonth:p,toMonth:x}=e;!n&&p&&(n=p),!n&&h&&(n=t.newDate(h,0,1)),!a&&x&&(a=x),!a&&y&&(a=u(y,11,31));const k=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=i(n):h?n=u(h,0,1):!n&&k&&(n=r(c(e.today??f(),-100))),a?a=l(a):y?a=u(y,11,31):!a&&k&&(a=d(e.today??f())),[n&&s(n),a&&s(a)]}function wg(e,t,n,a){if(n.disableNavigation)return;const{pagedNavigation:r,numberOfMonths:s=1}=n,{startOfMonth:i,addMonths:l,differenceInCalendarMonths:c}=a,d=r?s:1,u=i(e);if(!t)return l(u,d);if(!(c(t,e)<s))return l(u,d)}function vg(e,t,n,a){if(n.disableNavigation)return;const{pagedNavigation:r,numberOfMonths:s}=n,{startOfMonth:i,addMonths:l,differenceInCalendarMonths:c}=a,d=r?s??1:1,u=i(e);if(!t)return l(u,-d);if(!(c(u,t)<=0))return l(u,-d)}function _g(e){const t=[];return e.reduce((n,a)=>n.concat(a.weeks.slice()),t.slice())}function ra(e,t){const[n,a]=m.useState(e);return[t===void 0?n:t,a]}function Ng(e,t){const[n,a]=kg(e,t),{startOfMonth:r,endOfMonth:s}=t,i=lo(e,n,a,t),[l,c]=ra(i,e.month?i:void 0);m.useEffect(()=>{const v=lo(e,n,a,t);c(v)},[e.timeZone]);const{months:d,weeks:u,days:f,previousMonth:h,nextMonth:y}=m.useMemo(()=>{const v=bg(l,a,{numberOfMonths:e.numberOfMonths},t),j=yg(v,e.endMonth?s(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),N=xg(v,j,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),E=_g(N),M=pg(N),T=vg(l,n,e,t),O=wg(l,a,e,t);return{months:N,weeks:E,days:M,previousMonth:T,nextMonth:O}},[t,l.getTime(),a?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:p,onMonthChange:x}=e,k=v=>u.some(j=>j.days.some(N=>N.isEqualTo(v))),w=v=>{if(p)return;let j=r(v);n&&j<r(n)&&(j=r(n)),a&&j>r(a)&&(j=r(a)),c(j),x?.(j)};return{months:d,weeks:u,days:f,navStart:n,navEnd:a,previousMonth:h,nextMonth:y,goToMonth:w,goToDay:v=>{k(v)||w(v.date)}}}var lt;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(lt||(lt={}));function co(e){return!e[Ne.disabled]&&!e[Ne.hidden]&&!e[Ne.outside]}function jg(e,t,n,a){let r,s=-1;for(const i of e){const l=t(i);co(l)&&(l[Ne.focused]&&s<lt.FocusedModifier?(r=i,s=lt.FocusedModifier):a?.isEqualTo(i)&&s<lt.LastFocused?(r=i,s=lt.LastFocused):n(i.date)&&s<lt.Selected?(r=i,s=lt.Selected):l[Ne.today]&&s<lt.Today&&(r=i,s=lt.Today))}return r||(r=e.find(i=>co(t(i)))),r}function Sg(e,t,n,a,r,s,i){const{ISOWeek:l,broadcastCalendar:c}=s,{addDays:d,addMonths:u,addWeeks:f,addYears:h,endOfBroadcastWeek:y,endOfISOWeek:p,endOfWeek:x,max:k,min:w,startOfBroadcastWeek:b,startOfISOWeek:_,startOfWeek:v}=i;let N={day:d,week:f,month:u,year:h,startOfWeek:E=>c?b(E,i):l?_(E):v(E),endOfWeek:E=>c?y(E):l?p(E):x(E)}[e](n,t==="after"?1:-1);return t==="before"&&a?N=k([a,N]):t==="after"&&r&&(N=w([r,N])),N}function Fs(e,t,n,a,r,s,i,l=0){if(l>365)return;const c=Sg(e,t,n.date,a,r,s,i),d=!!(s.disabled&&wt(c,s.disabled,i)),u=!!(s.hidden&&wt(c,s.hidden,i)),f=c,h=new vs(c,f,i);return!d&&!u?h:Fs(e,t,h,a,r,s,i,l+1)}function Mg(e,t,n,a,r){const{autoFocus:s}=e,[i,l]=m.useState(),c=jg(t.days,n,a||(()=>!1),i),[d,u]=m.useState(s?c:void 0);return{isFocusTarget:x=>!!c?.isEqualTo(x),setFocused:u,focused:d,blur:()=>{l(d),u(void 0)},moveFocus:(x,k)=>{if(!d)return;const w=Fs(x,k,d,t.navStart,t.navEnd,e,r);w&&(e.disableNavigation&&!t.days.some(_=>_.isEqualTo(w))||(t.goToDay(w),u(w)))}}}function Cg(e,t){const{selected:n,required:a,onSelect:r}=e,[s,i]=ra(n,r?n:void 0),l=r?n:s,{isSameDay:c}=t,d=y=>l?.some(p=>c(p,y))??!1,{min:u,max:f}=e;return{selected:l,select:(y,p,x)=>{let k=[...l??[]];if(d(y)){if(l?.length===u||a&&l?.length===1)return;k=l?.filter(w=>!c(w,y))}else l?.length===f?k=[y]:k=[...k,y];return r||i(k),r?.(k,y,p,x),k},isSelected:d}}function Dg(e,t,n=0,a=0,r=!1,s=ft){const{from:i,to:l}=t||{},{isSameDay:c,isAfter:d,isBefore:u}=s;let f;if(!i&&!l)f={from:e,to:n>0?void 0:e};else if(i&&!l)c(i,e)?n===0?f={from:i,to:e}:r?f={from:i,to:void 0}:f=void 0:u(e,i)?f={from:e,to:i}:f={from:i,to:e};else if(i&&l)if(c(i,e)&&c(l,e))r?f={from:i,to:l}:f=void 0;else if(c(i,e))f={from:i,to:n>0?void 0:e};else if(c(l,e))f={from:e,to:n>0?void 0:e};else if(u(e,i))f={from:e,to:l};else if(d(e,i))f={from:i,to:e};else if(d(e,l))f={from:i,to:e};else throw new Error("Invalid range");if(f?.from&&f?.to){const h=s.differenceInCalendarDays(f.to,f.from);a>0&&h>a?f={from:e,to:void 0}:n>1&&h<n&&(f={from:e,to:void 0})}return f}function Tg(e,t,n=ft){const a=Array.isArray(t)?t:[t];let r=e.from;const s=n.differenceInCalendarDays(e.to,e.from),i=Math.min(s,6);for(let l=0;l<=i;l++){if(a.includes(r.getDay()))return!0;r=n.addDays(r,1)}return!1}function uo(e,t,n=ft){return kt(e,t.from,!1,n)||kt(e,t.to,!1,n)||kt(t,e.from,!1,n)||kt(t,e.to,!1,n)}function Pg(e,t,n=ft){const a=Array.isArray(t)?t:[t];if(a.filter(l=>typeof l!="function").some(l=>typeof l=="boolean"?l:n.isDate(l)?kt(e,l,!1,n):js(l,n)?l.some(c=>kt(e,c,!1,n)):aa(l)?l.from&&l.to?uo(e,{from:l.from,to:l.to},n):!1:Ns(l)?Tg(e,l.dayOfWeek,n):dr(l)?n.isAfter(l.before,l.after)?uo(e,{from:n.addDays(l.after,1),to:n.addDays(l.before,-1)},n):wt(e.from,l,n)||wt(e.to,l,n):ur(l)||fr(l)?wt(e.from,l,n)||wt(e.to,l,n):!1))return!0;const i=a.filter(l=>typeof l=="function");if(i.length){let l=e.from;const c=n.differenceInCalendarDays(e.to,e.from);for(let d=0;d<=c;d++){if(i.some(u=>u(l)))return!0;l=n.addDays(l,1)}}return!1}function Og(e,t){const{disabled:n,excludeDisabled:a,resetOnSelect:r,selected:s,required:i,onSelect:l}=e,[c,d]=ra(s,l?s:void 0),u=l?s:c;return{selected:u,select:(y,p,x)=>{const{min:k,max:w}=e;let b;if(y){const _=u?.from,v=u?.to,j=!!_&&!!v,N=!!_&&!!v&&t.isSameDay(_,v)&&t.isSameDay(y,_);r&&(j||!u?.from)?!i&&N?b=void 0:b={from:y,to:void 0}:b=Dg(y,u,k,w,i,t)}return a&&n&&b?.from&&b.to&&Pg({from:b.from,to:b.to},n,t)&&(b.from=y,b.to=void 0),l||d(b),l?.(b,y,p,x),b},isSelected:y=>u&&kt(u,y,!1,t)}}function Wg(e,t){const{selected:n,required:a,onSelect:r}=e,[s,i]=ra(n,r?n:void 0),l=r?n:s,{isSameDay:c}=t;return{selected:l,select:(f,h,y)=>{let p=f;return!a&&l&&l&&c(f,l)&&(p=void 0),r||i(p),r?.(p,f,h,y),p},isSelected:f=>l?c(l,f):!1}}function Eg(e,t){const n=Wg(e,t),a=Cg(e,t),r=Og(e,t);switch(e.mode){case"single":return n;case"multiple":return a;case"range":return r;default:return}}function Ze(e,t){return e instanceof Ee&&e.timeZone===t?e:new Ee(e,t)}function Jt(e,t,n){return Ze(e,t)}function fo(e,t,n){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?Jt(e,t):Array.isArray(e)?e.map(a=>a instanceof Date?Jt(a,t):a):aa(e)?{...e,from:e.from?Ze(e.from,t):e.from,to:e.to?Ze(e.to,t):e.to}:dr(e)?{before:Jt(e.before,t),after:Jt(e.after,t)}:ur(e)?{after:Jt(e.after,t)}:fr(e)?{before:Jt(e.before,t)}:e}function Oa(e,t,n){return e&&(Array.isArray(e)?e.map(a=>fo(a,t)):fo(e,t))}function $g(e){let t=e;const n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&(t.today=Ze(t.today,n)),t.month&&(t.month=Ze(t.month,n)),t.defaultMonth&&(t.defaultMonth=Ze(t.defaultMonth,n)),t.startMonth&&(t.startMonth=Ze(t.startMonth,n)),t.endMonth&&(t.endMonth=Ze(t.endMonth,n)),t.mode==="single"&&t.selected?t.selected=Ze(t.selected,n):t.mode==="multiple"&&t.selected?t.selected=t.selected?.map(Z=>Ze(Z,n)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?Ze(t.selected.from,n):t.selected.from,to:t.selected.to?Ze(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=Oa(t.disabled,n)),t.hidden!==void 0&&(t.hidden=Oa(t.hidden,n)),t.modifiers)){const Z={};Object.keys(t.modifiers).forEach(te=>{Z[te]=Oa(t.modifiers?.[te],n)}),t.modifiers=Z}const{components:a,formatters:r,labels:s,dateLib:i,locale:l,classNames:c}=m.useMemo(()=>{const Z={...ws,...t.locale},te=t.broadcastCalendar?1:t.weekStartsOn,R=t.noonSafe&&t.timeZone?ug(t.timeZone,{weekStartsOn:te,locale:Z}):void 0,ne=t.dateLib&&R?{...R,...t.dateLib}:t.dateLib??R,je=new Ke({locale:Z,weekStartsOn:te,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},ne);return{dateLib:je,components:Hh(t.components),formatters:tg(t.formatters),labels:sg(t.labels,je.options),locale:Z,classNames:{...qh(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:i.today()});const{captionLayout:d,mode:u,navLayout:f,numberOfMonths:h=1,onDayBlur:y,onDayClick:p,onDayFocus:x,onDayKeyDown:k,onDayMouseEnter:w,onDayMouseLeave:b,onNextClick:_,onPrevClick:v,showWeekNumber:j,styles:N}=t,{formatCaption:E,formatDay:M,formatMonthDropdown:T,formatWeekNumber:O,formatWeekNumberHeader:$,formatWeekdayName:V,formatYearDropdown:C}=r,A=Ng(t,i),{days:I,months:D,navStart:Y,navEnd:U,previousMonth:W,nextMonth:ee,goToMonth:ie}=A,z=Yh(I,t,Y,U,i),{isSelected:J,select:de,selected:me}=Eg(t,i)??{},{blur:F,focused:H,isFocusTarget:L,moveFocus:re,setFocused:X}=Mg(t,A,z,J??(()=>!1),i),{labelDayButton:Q,labelGridcell:se,labelGrid:G,labelMonthDropdown:le,labelNav:be,labelPrevious:_e,labelNext:he,labelWeekday:ce,labelWeekNumber:ge,labelWeekNumberHeader:Oe,labelYearDropdown:De}=s,Re=m.useMemo(()=>cg(i,t.ISOWeek,t.broadcastCalendar,t.today),[i,t.ISOWeek,t.broadcastCalendar,t.today]),He=u!==void 0||p!==void 0,Be=m.useCallback(()=>{W&&(ie(W),v?.(W))},[W,ie,v]),mt=m.useCallback(()=>{ee&&(ie(ee),_?.(ee))},[ie,ee,_]),Me=m.useCallback((Z,te)=>R=>{R.preventDefault(),R.stopPropagation(),X(Z),!te.disabled&&(de?.(Z.date,te,R),p?.(Z.date,te,R))},[de,p,X]),Ce=m.useCallback((Z,te)=>R=>{X(Z),x?.(Z.date,te,R)},[x,X]),Ye=m.useCallback((Z,te)=>R=>{F(),y?.(Z.date,te,R)},[F,y]),Xe=m.useCallback((Z,te)=>R=>{const ne={ArrowLeft:[R.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[R.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[R.shiftKey?"year":"week","after"],ArrowUp:[R.shiftKey?"year":"week","before"],PageUp:[R.shiftKey?"year":"month","before"],PageDown:[R.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(ne[R.key]){R.preventDefault(),R.stopPropagation();const[je,ae]=ne[R.key];re(je,ae)}k?.(Z.date,te,R)},[re,k,t.dir]),Tt=m.useCallback((Z,te)=>R=>{w?.(Z.date,te,R)},[w]),vt=m.useCallback((Z,te)=>R=>{b?.(Z.date,te,R)},[b]),Qe=m.useCallback(Z=>te=>{const R=Number(te.target.value),ne=i.setMonth(i.startOfMonth(Z),R);ie(ne)},[i,ie]),sn=m.useCallback(Z=>te=>{const R=Number(te.target.value),ne=i.setYear(i.startOfMonth(Z),R);ie(ne)},[i,ie]),{className:ot,style:ln}=m.useMemo(()=>({className:[c[q.Root],t.className].filter(Boolean).join(" "),style:{...N?.[q.Root],...t.style}}),[c,t.className,t.style,N]),cn=Uh(t),ht=m.useRef(null);gg(ht,!!t.animate,{classNames:c,months:D,focused:H,dateLib:i});const ue={dayPickerProps:t,selected:me,select:de,isSelected:J,months:D,nextMonth:ee,previousMonth:W,goToMonth:ie,getModifiers:z,components:a,classNames:c,styles:N,labels:s,formatters:r};return P.createElement(_s.Provider,{value:ue},P.createElement(a.Root,{rootRef:t.animate?ht:void 0,className:ot,style:ln,dir:t.dir,id:t.id,lang:t.lang??l.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...cn},P.createElement(a.Months,{className:c[q.Months],style:N?.[q.Months]},!t.hideNavigation&&!f&&P.createElement(a.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[q.Nav],style:N?.[q.Nav],"aria-label":be(),onPreviousClick:Be,onNextClick:mt,previousMonth:W,nextMonth:ee}),D.map((Z,te)=>P.createElement(a.Month,{"data-animated-month":t.animate?"true":void 0,className:c[q.Month],style:N?.[q.Month],key:te,displayIndex:te,calendarMonth:Z},f==="around"&&!t.hideNavigation&&te===0&&P.createElement(a.PreviousMonthButton,{type:"button",className:c[q.PreviousMonthButton],tabIndex:W?void 0:-1,"aria-disabled":W?void 0:!0,"aria-label":_e(W),onClick:Be,"data-animated-button":t.animate?"true":void 0},P.createElement(a.Chevron,{disabled:W?void 0:!0,className:c[q.Chevron],orientation:t.dir==="rtl"?"right":"left"})),P.createElement(a.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:c[q.MonthCaption],style:N?.[q.MonthCaption],calendarMonth:Z,displayIndex:te},d?.startsWith("dropdown")?P.createElement(a.DropdownNav,{className:c[q.Dropdowns],style:N?.[q.Dropdowns]},(()=>{const R=d==="dropdown"||d==="dropdown-months"?P.createElement(a.MonthsDropdown,{key:"month",className:c[q.MonthsDropdown],"aria-label":le(),classNames:c,components:a,disabled:!!t.disableNavigation,onChange:Qe(Z.date),options:ig(Z.date,Y,U,r,i),style:N?.[q.Dropdown],value:i.getMonth(Z.date)}):P.createElement("span",{key:"month"},T(Z.date,i)),ne=d==="dropdown"||d==="dropdown-years"?P.createElement(a.YearsDropdown,{key:"year",className:c[q.YearsDropdown],"aria-label":De(i.options),classNames:c,components:a,disabled:!!t.disableNavigation,onChange:sn(Z.date),options:dg(Y,U,r,i,!!t.reverseYears),style:N?.[q.Dropdown],value:i.getYear(Z.date)}):P.createElement("span",{key:"year"},C(Z.date,i));return i.getMonthYearOrder()==="year-first"?[ne,R]:[R,ne]})(),P.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(Z.date,i.options,i))):P.createElement(a.CaptionLabel,{className:c[q.CaptionLabel],role:"status","aria-live":"polite"},E(Z.date,i.options,i))),f==="around"&&!t.hideNavigation&&te===h-1&&P.createElement(a.NextMonthButton,{type:"button",className:c[q.NextMonthButton],tabIndex:ee?void 0:-1,"aria-disabled":ee?void 0:!0,"aria-label":he(ee),onClick:mt,"data-animated-button":t.animate?"true":void 0},P.createElement(a.Chevron,{disabled:ee?void 0:!0,className:c[q.Chevron],orientation:t.dir==="rtl"?"left":"right"})),te===h-1&&f==="after"&&!t.hideNavigation&&P.createElement(a.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[q.Nav],style:N?.[q.Nav],"aria-label":be(),onPreviousClick:Be,onNextClick:mt,previousMonth:W,nextMonth:ee}),P.createElement(a.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":G(Z.date,i.options,i)||void 0,className:c[q.MonthGrid],style:N?.[q.MonthGrid]},!t.hideWeekdays&&P.createElement(a.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:c[q.Weekdays],style:N?.[q.Weekdays]},j&&P.createElement(a.WeekNumberHeader,{"aria-label":Oe(i.options),className:c[q.WeekNumberHeader],style:N?.[q.WeekNumberHeader],scope:"col"},$()),Re.map(R=>P.createElement(a.Weekday,{"aria-label":ce(R,i.options,i),className:c[q.Weekday],key:String(R),style:N?.[q.Weekday],scope:"col"},V(R,i.options,i)))),P.createElement(a.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:c[q.Weeks],style:N?.[q.Weeks]},Z.weeks.map(R=>P.createElement(a.Week,{className:c[q.Week],key:R.weekNumber,style:N?.[q.Week],week:R},j&&P.createElement(a.WeekNumber,{week:R,style:N?.[q.WeekNumber],"aria-label":ge(R.weekNumber,{locale:l}),className:c[q.WeekNumber],scope:"row",role:"rowheader"},O(R.weekNumber,i)),R.days.map(ne=>{const{date:je}=ne,ae=z(ne);if(ae[Ne.focused]=!ae.hidden&&!!H?.isEqualTo(ne),ae[rt.selected]=J?.(je)||ae.selected,aa(me)){const{from:Pt,to:yt}=me;ae[rt.range_start]=!!(Pt&&yt&&i.isSameDay(je,Pt)),ae[rt.range_end]=!!(Pt&&yt&&i.isSameDay(je,yt)),ae[rt.range_middle]=kt(me,je,!0,i)}const Ht=lg(ae,N,t.modifiersStyles),gt=zh(ae,c,t.modifiersClassNames),Ut=!He&&!ae.hidden?se(je,ae,i.options,i):void 0;return P.createElement(a.Day,{key:`${ne.isoDate}_${ne.displayMonthId}`,day:ne,modifiers:ae,className:gt.join(" "),style:Ht,role:"gridcell","aria-selected":ae.selected||void 0,"aria-label":Ut,"data-day":ne.isoDate,"data-month":ne.outside?ne.dateMonthId:void 0,"data-selected":ae.selected||void 0,"data-disabled":ae.disabled||void 0,"data-hidden":ae.hidden||void 0,"data-outside":ne.outside||void 0,"data-focused":ae.focused||void 0,"data-today":ae.today||void 0},!ae.hidden&&He?P.createElement(a.DayButton,{className:c[q.DayButton],style:N?.[q.DayButton],type:"button",day:ne,modifiers:ae,disabled:!ae.focused&&ae.disabled||void 0,"aria-disabled":ae.focused&&ae.disabled||void 0,tabIndex:L(ne)?0:-1,"aria-label":Q(je,ae,i.options,i),onClick:Me(ne,ae),onBlur:Ye(ne,ae),onFocus:Ce(ne,ae),onKeyDown:Xe(ne,ae),onMouseEnter:Tt(ne,ae),onMouseLeave:vt(ne,ae)},M(je,i.options,i)):!ae.hidden&&M(ne.date,i.options,i))})))))))),t.footer&&P.createElement(a.Footer,{className:c[q.Footer],style:N?.[q.Footer],role:"status","aria-live":"polite"},t.footer)))}const Ag={en:Ct,"zh-CN":Am,"zh-TW":fh,ja:Tf,ko:sm};function Is(e){return Ag[e]||Ct}function mo(e,t){if(!e)return"";const n=e.split("-");if(n.length!==3)return e;const a=new Date(Number(n[0]),Number(n[1])-1,Number(n[2]));return Number.isFinite(a.getTime())?ut(a,"MMM d",t?{locale:t}:void 0):e}function Ka({from:e,to:t,onApply:n,onCancel:a}){const r=m.useMemo(()=>{const u={from:void 0,to:void 0};if(e){const f=e.split("-");u.from=new Date(Number(f[0]),Number(f[1])-1,Number(f[2]))}if(t){const f=t.split("-");u.to=new Date(Number(f[0]),Number(f[1])-1,Number(f[2]))}return u},[e,t]),[s,i]=m.useState(r),l=Is(qo()),c=()=>{if(!s?.from)return;const u=ut(s.from,"yyyy-MM-dd"),f=s.to?ut(s.to,"yyyy-MM-dd"):u;n?.(u,f)},d=!!s?.from;return o.jsxs("div",{className:"p-4",children:[o.jsx($g,{mode:"range",locale:l,selected:s,onSelect:i,numberOfMonths:2,showOutsideDays:!1,classNames:{root:"rdp-oai",months:"flex gap-4",month:"space-y-3",month_caption:"flex justify-center items-center h-8",caption_label:"text-sm font-medium text-oai-black dark:text-oai-white",nav:"flex items-center justify-between absolute inset-x-0 top-0 px-2",button_previous:"inline-flex items-center justify-center w-7 h-7 rounded-md text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-oai-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",button_next:"inline-flex items-center justify-center w-7 h-7 rounded-md text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-oai-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",chevron:"w-4 h-4 fill-current",month_grid:"border-collapse",weekdays:"flex",weekday:"w-9 text-center text-xs font-medium text-oai-gray-400 dark:text-oai-gray-500 py-1",week:"flex",day:"w-9 h-9 text-center text-sm p-0 relative",day_button:"w-full h-full inline-flex items-center justify-center rounded-md transition-colors hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 text-oai-black dark:text-oai-white cursor-pointer rdp-day-btn",today:"font-bold",selected:"rdp-selected",range_start:"rdp-selected rdp-range-start",range_end:"rdp-selected rdp-range-end",range_middle:"rdp-range-mid",outside:"text-oai-gray-300 dark:text-oai-gray-600",disabled:"text-oai-gray-300 dark:text-oai-gray-600 cursor-not-allowed",hidden:"invisible"},styles:{months:{position:"relative"}}}),o.jsxs("div",{className:"flex items-center justify-end gap-2 mt-4 pt-3 border-t border-oai-gray-200 dark:border-oai-gray-700",children:[d&&s.from&&o.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mr-auto",children:[ut(s.from,"MMM d, yyyy",{locale:l}),s.to&&s.to.getTime()!==s.from.getTime()?` — ${ut(s.to,"MMM d, yyyy",{locale:l})}`:""]}),o.jsx(Ya,{variant:"secondary",size:"sm",onClick:a,children:g("shared.action.cancel")}),o.jsx(Ya,{variant:"primary",size:"sm",onClick:c,disabled:!d,children:g("shared.action.apply")})]})]})}let Rn=null;function Fg(){if(Rn===null)try{Rn=typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("color","oklch(0 0 0)")}catch{Rn=!1}return Rn}function Ig(e,t,n){const a=n*Math.PI/180,r=t*Math.cos(a),s=t*Math.sin(a),i=e+.3963377774*r+.2158037573*s,l=e-.1055613458*r-.0638541728*s,c=e-.0894841775*r-1.291485548*s,d=i*i*i,u=l*l*l,f=c*c*c;return[4.0767416621*d-3.3077115913*u+.2309699292*f,-1.2684380046*d+2.6097574011*u-.3413193965*f,-.0041960863*d-.7034186147*u+1.707614701*f].map(y=>{const p=Math.min(1,Math.max(0,y)),x=p<=.0031308?12.92*p:1.055*Math.pow(p,1/2.4)-.055;return Math.round(x*255)})}function Ls(e,t,n,a){if(Fg())return a==null?`oklch(${e} ${t} ${n})`:`oklch(${e} ${t} ${n} / ${a})`;const[r,s,i]=Ig(e,t,n);return a==null?`rgb(${r} ${s} ${i})`:`rgb(${r} ${s} ${i} / ${a})`}function on(e){const t=/^oklch\(\s*([0-9.]+)\s+([0-9.]+)\s+([0-9.]+)\s*\)$/.exec(e);return t?Ls(Number(t[1]),Number(t[2]),Number(t[3])):e}const ho={claude:35,codex:250},go={system_prompt:{l:.55,c:.05},messages:{l:.65,c:.18},tool_calls:{l:.6,c:.14},custom_agents:{l:.55,c:.1},reasoning:{l:.7,c:.08}};function Lg(e,t){const n=ho[t]??ho.claude,a=go[e]||go.system_prompt;return Ls(a.l,a.c,n)}const Rg=[{key:"system_prompt",from:["system_prefix"]},{key:"messages",from:["user_input","conversation_history","assistant_response"]},{key:"tool_calls",from:["tool_calls"]},{key:"custom_agents",from:["subagents"]},{key:"reasoning",from:["reasoning"]}],Bg=[["by_type","dashboard.context_breakdown.exec_details.group_by_type"],["by_executable","dashboard.context_breakdown.exec_details.group_by_executable"],["by_command","dashboard.context_breakdown.exec_details.group_by_command"],["by_duration","dashboard.context_breakdown.exec_details.group_by_duration"],["by_output","dashboard.context_breakdown.exec_details.group_by_output"],["by_exit","dashboard.context_breakdown.exec_details.group_by_exit"]],Yg={duration:.18,ease:[.4,0,.2,1]},zg={height:0,opacity:0},Hg={height:"auto",opacity:1},Ug={height:0,opacity:0};function qg(e){const t=Number(e||0);return Number.isFinite(t)&&t>0?t:0}function Vg(e,t){const n={};for(const a of["input_tokens","cached_input_tokens","cache_creation_input_tokens","output_tokens","reasoning_output_tokens","total_tokens"])n[a]=Math.round(Number(e?.[a]||0)*t);return n}function Rs(e,t=null){const n=e.reduce((i,l)=>i+Number(l.totals.total_tokens||0),0),a=qg(t),r=a||n,s=a&&n>0?a/n:1;return e.map(i=>{const l=s===1?i.totals:Vg(i.totals,s);return{...i,totals:l,percent:r>0?Number((l.total_tokens/r*100).toFixed(2)):0}}).sort((i,l)=>l.totals.total_tokens-i.totals.total_tokens)}function Gg(e,t=null){const n=new Map;for(const r of e||[])n.set(r.key,r);const a=Rg.map(r=>{const s={input_tokens:0,cached_input_tokens:0,cache_creation_input_tokens:0,output_tokens:0,reasoning_output_tokens:0,total_tokens:0};for(const i of r.from){const l=n.get(i);if(!l)continue;const c=l.totals||{};s.input_tokens+=c.input_tokens||0,s.cached_input_tokens+=c.cached_input_tokens||0,s.cache_creation_input_tokens+=c.cache_creation_input_tokens||0,s.output_tokens+=c.output_tokens||0,s.reasoning_output_tokens+=c.reasoning_output_tokens||0,s.total_tokens+=c.total_tokens||0}return{key:r.key,totals:s}});return Rs(a,t)}function Kg(e,t=null){const n=e?.totals||{},a=Number(n.reasoning_output_tokens||0),r=(e?.tool_calls_breakdown?.categories||[]).reduce((d,u)=>u?.name==="Text Response"?d:d+Number(u?.totals?.total_tokens||0),0),s=Number(n.total_tokens||0),i=Math.min(Math.max(0,r),Math.max(0,s-a)),c=[{key:"messages",totals:{total_tokens:Math.max(0,s-a-i)}},{key:"tool_calls",totals:{total_tokens:i}},{key:"reasoning",totals:{total_tokens:a}}];return Rs(c,t)}const yo="MCP: ";function Xg(e){if(!e?.categories?.length)return{mcpSet:null,residualSet:e,mcpTotalTokens:0};const t=[],n=[];let a=0;for(const r of e.categories){const s=String(r?.name||"");s.startsWith(yo)?(t.push({...r,name:s.slice(yo.length)}),a+=Number(r?.totals?.total_tokens||0)):n.push(r)}return t.length===0?{mcpSet:null,residualSet:e,mcpTotalTokens:0}:(t.sort((r,s)=>(s.totals?.total_tokens||0)-(r.totals?.total_tokens||0)),{mcpSet:{...e,categories:t},residualSet:{...e,categories:n},mcpTotalTokens:a})}function po(e){return g(`dashboard.context_breakdown.category.${e}`)}function ct(e){return!Number.isFinite(Number(e))||Number(e)<=0?"0":Ae(Number(e),{decimals:1})}function Qg(e){return typeof e!="string"?"":e.startsWith("mcp__")?e.split("__").slice(2).join("__")||e:e.includes("/")&&e.split("/").pop()||e}function Jg(e){return(Array.isArray(e)?e:[]).map(t=>{const n=t?.totals||null,a=Number(n?n.input_tokens||0:t?.input_tokens||0),r=Number(n?n.output_tokens||0:t?.output_tokens||0),s=Number(n?n.cached_input_tokens||0:t?.cache_read||0),i=Number(n?n.cache_creation_input_tokens||0:t?.cache_creation||0),l=Number(n?n.total_tokens||a+r:t?.total_tokens||r);return{name:Qg(t?.name?String(t.name):""),calls:Number(t?.calls||0),input_tokens:a,output_tokens:r,cache_read:s,cache_creation:i,total_tokens:Number(l||0)}}).filter(t=>t.name).sort((t,n)=>(n.total_tokens||0)-(t.total_tokens||0))}function Zg(e){return(Array.isArray(e)?e:[]).map(t=>{const n=t?.totals||{},a=Array.isArray(t?.tools)?t.tools:[],r=Number(n.input_tokens||0),s=Number(n.output_tokens||0),i=Number(n.cached_input_tokens||0),l=Number(n.cache_creation_input_tokens||0);return{name:t?.name?String(t.name):"",calls:Number(t?.calls||0),totals:{input_tokens:r,output_tokens:s,cached_input_tokens:i,cache_creation_input_tokens:l,total_tokens:Number(n.total_tokens||r+s)},tools:Jg(a),toolCount:a.length}}).filter(t=>t.name).sort((t,n)=>(n.totals.total_tokens||0)-(t.totals.total_tokens||0))}function e0(e){return(Array.isArray(e)?e:[]).map(t=>{const n=t?.totals||{},a=Number(n.input_tokens||0),r=Number(n.output_tokens||0),s=Number(n.cached_input_tokens||0),i=Number(n.cache_creation_input_tokens||0);return{key:t?.key?String(t.key):"",name:t?.name?String(t.name):"",totals:{input_tokens:a,output_tokens:r,cached_input_tokens:s,cache_creation_input_tokens:i,total_tokens:Number(n.total_tokens||a+r+s+i)}}}).filter(t=>t.key||t.name).sort((t,n)=>(n.totals.total_tokens||0)-(t.totals.total_tokens||0))}function t0(e){return(Array.isArray(e)?e:[]).map(t=>{const n=t?.totals||{};return{name:t?.name?String(t.name):"",calls:Number(t?.calls||0),total_tokens:Number(n.total_tokens||0)}}).filter(t=>t.name).sort((t,n)=>Number(n.total_tokens||0)-Number(t.total_tokens||0))}function n0(e){if(e?.key){const t=g(`dashboard.context_breakdown.message_details.${e.key}`);if(t&&!t.includes("dashboard.context_breakdown"))return t}return e?.name||""}function a0(e){return(Array.isArray(e)?e:[]).map(t=>{const n=t?.totals||{},a=Number(n.input_tokens||0),r=Number(n.output_tokens||0),s=Number(n.cached_input_tokens||0),i=Number(n.cache_creation_input_tokens||0);return{name:t?.name?String(t.name):"",calls:Number(t?.calls||0),failures:Number(t?.failures||0),duration_ms:Number(t?.duration_ms||0),max_duration_ms:Number(t?.max_duration_ms||0),output_chars:Number(t?.output_chars||0),output_lines:Number(t?.output_lines||0),totals:{input_tokens:a,output_tokens:r,cached_input_tokens:s,cache_creation_input_tokens:i,total_tokens:Number(n.total_tokens||a+r)}}}).filter(t=>t.name).sort((t,n)=>Number(n.totals.total_tokens||0)-Number(t.totals.total_tokens||0))}function bo(e){const t=Number(e||0);return!Number.isFinite(t)||t<=0?"0ms":t<1e3?`${Math.round(t)}ms`:t<6e4?`${(t/1e3).toFixed(1)}s`:`${Math.round(t/1e3)}s`}function r0(e,t){return e?t==="by_executable"?e.by_executable||[]:t==="by_command"?e.by_command||[]:t==="by_duration"?e.by_duration||[]:t==="by_output"?e.by_output||[]:t==="by_exit"?e.by_exit||[]:e.by_type||[]:[]}function xo(e){return e==="exec_command"||e==="Bash"}function Bs(e){return e==="codex"?"dashboard.context_breakdown.empty_codex":"dashboard.context_breakdown.empty"}function o0(e){return e==="codex"?"dashboard.context_breakdown.error_codex":"dashboard.context_breakdown.error"}function s0(e){return e==="codex"?"dashboard.context_breakdown.footnote_codex":"dashboard.context_breakdown.footnote"}const i0=10;function xt({level:e=0,colorSquare:t=null,label:n,labelSuffix:a=null,labelTone:r="default",hasChevron:s=!1,open:i=!1,onToggle:l,tokens:c,percent:d=null,children:u,share:f=null,fillColor:h=null}){const y=r==="accent"?"text-oai-brand truncate":r==="muted"?"text-oai-gray-500 dark:text-oai-gray-400 truncate":r==="strong"?"font-medium text-oai-black dark:text-oai-white truncate":"text-oai-gray-700 dark:text-oai-gray-300 truncate",p=o.jsx("span",{className:"shrink-0 flex items-center justify-start",style:{width:i0},"aria-hidden":!t,children:t}),x=o.jsxs(o.Fragment,{children:[p,o.jsx("span",{className:y,children:n}),a,s&&o.jsx(Fe.span,{animate:{rotate:i?90:0},transition:{duration:.15},className:"shrink-0 text-oai-gray-400 dark:text-oai-gray-500 flex items-center","aria-hidden":"true",children:o.jsx(Zo,{size:11})})]}),k=h&&f!=null&&f>0,w=k?Math.max(0,Math.min(100,f)):0;return o.jsxs("li",{className:"min-w-0 group/row",children:[o.jsxs("div",{className:"relative grid grid-cols-[minmax(0,1fr)_64px_48px] items-center gap-2 text-xs py-1 px-1 rounded-sm transition-colors duration-150",style:k?{backgroundImage:`linear-gradient(to right, ${h.replace(/\)\s*$/," / 0.10)")} 0%, ${h.replace(/\)\s*$/," / 0.10)")} ${w}%, transparent ${w}%)`}:void 0,children:[s?o.jsx("button",{type:"button",onClick:l,"aria-expanded":i,className:"relative flex items-center gap-1.5 min-w-0 text-left cursor-pointer focus-visible:outline-none focus-visible:ring-inset focus-visible:ring-2 focus-visible:ring-oai-brand/40 rounded-sm",children:x}):o.jsx("div",{className:"relative flex items-center gap-1.5 min-w-0",children:x}),o.jsx("span",{className:"relative text-right tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:c||""}),o.jsx("span",{className:"relative text-right tabular-nums text-[10px] text-oai-gray-400 dark:text-oai-gray-500 font-normal",children:d||""})]}),s&&u?o.jsx(sr,{initial:!1,children:i&&o.jsx(Fe.div,{initial:zg,animate:Hg,exit:Ug,transition:Yg,style:{overflow:"hidden"},children:u},"content")}):null]})}function ko({execDetails:e,source:t="claude"}){const[n,a]=m.useState("by_type"),r=a0(r0(e,n)),s=t==="codex",i=s?"grid-cols-[minmax(0,1fr)_48px_48px_72px_72px_60px_60px]":"grid-cols-[minmax(0,1fr)_56px_60px]";return o.jsxs("div",{className:"mt-2 ml-4",children:[o.jsx("div",{className:"flex flex-wrap items-center gap-1 rounded-md bg-oai-gray-100 dark:bg-oai-gray-900 p-1 w-fit max-w-full",children:Bg.map(([l,c])=>o.jsx("button",{type:"button",onClick:()=>a(l),className:"h-7 px-2 rounded-md text-[10px] font-medium transition-colors "+(n===l?"bg-oai-white dark:bg-oai-gray-800 text-oai-black dark:text-oai-white shadow-sm":"text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-white/70 dark:hover:bg-oai-gray-800/70"),children:g(c)},l))}),r.length===0?o.jsx("p",{className:"mt-2 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:"—"}):o.jsx("div",{className:"mt-2 overflow-x-auto",children:o.jsxs("div",{role:"table","aria-label":g("dashboard.context_breakdown.exec_details.title"),className:s?"min-w-[420px]":"min-w-[260px]",children:[o.jsxs("div",{role:"row",className:`grid ${i} gap-2 py-1.5 mb-1 border-b border-oai-gray-200 dark:border-oai-gray-800 text-label uppercase text-oai-gray-500 dark:text-oai-gray-400`,children:[o.jsx("span",{role:"columnheader",children:g("dashboard.context_breakdown.exec_details.kind_column")}),o.jsx("span",{role:"columnheader",className:"text-right",children:g("dashboard.context_breakdown.exec_details.calls_column")}),s&&o.jsxs(o.Fragment,{children:[o.jsx("span",{role:"columnheader",className:"text-right",children:g("dashboard.context_breakdown.exec_details.failures_column")}),o.jsx("span",{role:"columnheader",className:"text-right",children:g("dashboard.context_breakdown.exec_details.duration_column")}),o.jsx("span",{role:"columnheader",className:"text-right",children:g("dashboard.context_breakdown.exec_details.max_duration_column")})]}),o.jsx("span",{role:"columnheader",className:"text-right",children:g("dashboard.context_breakdown.tool_details.total_column")}),s&&o.jsx("span",{role:"columnheader",className:"text-right",children:g("dashboard.context_breakdown.exec_details.output_column")})]}),r.map((l,c)=>o.jsxs(Fe.div,{role:"row",className:`grid ${i} gap-2 py-1.5`,title:l.name,initial:{opacity:0},animate:{opacity:1},transition:{duration:.18,delay:c*.02},children:[o.jsx("span",{role:"cell",className:"min-w-0 text-body-sm font-medium text-oai-black dark:text-oai-white truncate",children:l.name}),o.jsx("span",{role:"cell",className:"text-right text-body-sm tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:Ae(l.calls||0)}),s&&o.jsxs(o.Fragment,{children:[o.jsx("span",{role:"cell",className:"text-right text-body-sm tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:Ae(l.failures||0)}),o.jsx("span",{role:"cell",className:"text-right text-body-sm tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:bo(l.duration_ms||0)}),o.jsx("span",{role:"cell",className:"text-right text-body-sm tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:bo(l.max_duration_ms||0)})]}),o.jsx("span",{role:"cell",className:"text-right text-body-sm tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:ct(l.totals.total_tokens||0)}),s&&o.jsx("span",{role:"cell",className:"text-right text-body-sm tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:Ae(l.output_lines||0)})]},l.name))]})})]})}function yn({toolSet:e,execDetails:t,source:n,codexQueueFallback:a}){const[r,s]=m.useState({}),[i,l]=m.useState(!1),c=Zg(e?.categories||[]);function d(u){s(f=>({...f,[u]:!f[u]}))}return c.length===0?o.jsx("p",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500 py-0.5",children:n==="codex"&&a?g("dashboard.context_breakdown.tool_details.unavailable_codex"):g(Bs(n))}):o.jsx("ul",{className:"mt-0.5 mb-0.5 space-y-0.5",children:c.map(u=>{const f=u.toolCount>0,h=u.name==="Execution"&&t,y=h&&u.tools.some(x=>xo(x.name)),p=!!r[u.name];return o.jsxs(xt,{level:1,label:u.name,labelTone:"strong",hasChevron:f||h&&!y,open:p||h&&!y&&i,onToggle:()=>{f?d(u.name):h&&!y&&l(x=>!x)},tokens:ct(u.totals.total_tokens||0),percent:null,children:[f&&o.jsx("ul",{className:"space-y-0.5",children:u.tools.map(x=>{const k=h&&xo(x.name);return o.jsx(xt,{level:2,label:x.name,labelTone:k?"accent":"default",hasChevron:k,open:i,onToggle:()=>l(w=>!w),tokens:ct(x.total_tokens||0),percent:null,children:k&&o.jsx(ko,{execDetails:t,source:n})},x.name)})}),h&&!y&&o.jsx(ko,{execDetails:t,source:n})]},u.name)})})}function l0({from:e,to:t,source:n="claude",referenceTotalTokens:a=null,onLoadingChange:r=null}){const[s,i]=m.useState(null),[l,c]=m.useState(!1),[d,u]=m.useState(null),[f,h]=m.useState({});function y(D){h(Y=>({...Y,[D]:!Y[D]}))}if(m.useEffect(()=>{let D=!1;return c(!0),r?.(!0),u(null),Dl({from:e,to:t,source:n,timeZone:Go(),tzOffsetMinutes:Vo()}).then(Y=>{D||i(Y)}).catch(Y=>{D||u(Y?.message||String(Y))}).finally(()=>{D||(c(!1),r?.(!1))}),()=>{D=!0}},[e,t,n]),l&&!s)return o.jsxs("div",{children:[o.jsx("div",{className:"h-1 w-full bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden animate-pulse"}),o.jsx("div",{className:"mt-3 grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-2",children:[0,1,2,3,4].map(D=>o.jsx("div",{className:"h-3 rounded bg-oai-gray-100 dark:bg-oai-gray-800 animate-pulse",style:{animationDelay:`${D*80}ms`}},D))}),o.jsx("p",{className:"mt-3 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:g("dashboard.context_breakdown.loading_hint")})]});if(d)return o.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:g(o0(n))});if(!s||s.scope!=="supported"||!s.totals?.total_tokens)return o.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:g(Bs(n))});const p=n==="claude"?Gg(s.categories||[],a):Kg(s,a),x=s.tool_calls_breakdown||null,k=s.skills_breakdown||null,w=s.message_breakdown||null,b=s.configured_resources||null,_=s.exec_command_breakdown||null,v=t0(k?.skills||[]),j=e0(w?.categories||[]),N=n==="codex"&&(s?.breakdown_status==="queue_fallback"||s?.fallback==="queue_totals"),E=n==="claude"?x?.tool_calls||null:x||null,{mcpSet:M,residualSet:T,mcpTotalTokens:O}=Xg(E),$=n==="claude"&&x?.subagents||null,V=$?.categories?.length>0||(b?.custom_agents_count||0)>0,C=n==="claude"?(T?.categories||[]).reduce((D,Y)=>D+Number(Y?.totals?.total_tokens||0),0):0,A=n==="claude"?($?.categories||[]).reduce((D,Y)=>D+Number(Y?.totals?.total_tokens||0),0):0,I=[...p].sort((D,Y)=>(Y.totals?.total_tokens||0)-(D.totals?.total_tokens||0));return o.jsxs("div",{role:"region","aria-label":g("dashboard.context_breakdown.bar_aria",{summary:p.filter(D=>D.percent>0).filter(D=>!(n==="claude"&&(D.key==="tool_calls"||D.key==="custom_agents"))).map(D=>`${po(D.key)} ${D.percent}%`).join(",")}),children:[o.jsxs("ul",{className:"space-y-0.5",children:[I.map(D=>{const Y=D.key==="system_prompt",U=D.key==="messages",W=D.key==="tool_calls",ee=D.key==="custom_agents";if(D.key,n==="claude"&&(W||ee))return null;const ie=U&&j.length>0||W&&(T?.categories?.length>0||N)||ee&&V&&$,z=!!f[D.key],J=Lg(D.key,n),de=o.jsx("span",{className:"h-2 w-2 rounded-sm shrink-0",style:{backgroundColor:J},"aria-hidden":"true"}),me=Y?o.jsxs("span",{className:"relative inline-flex shrink-0 group",children:[o.jsx(Qo,{size:11,className:"text-oai-gray-400 dark:text-oai-gray-500 cursor-help","aria-hidden":"true"}),o.jsx("span",{role:"tooltip",className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-1.5 -translate-x-1/2 w-64 rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-white dark:bg-oai-gray-900 px-2.5 py-1.5 text-[11px] leading-snug text-oai-gray-700 dark:text-oai-gray-200 shadow-md opacity-0 group-hover:opacity-100 transition-opacity",children:g("dashboard.context_breakdown.system_prefix_tooltip")})]}):null,F=D.percent>0?`${D.percent.toFixed(D.percent<.1&&D.percent>0?2:1)}%`:"0.0%";return o.jsxs(xt,{level:0,colorSquare:de,label:po(D.key),labelSuffix:me,tokens:ct(D.totals?.total_tokens||0),percent:F,hasChevron:ie,open:z,onToggle:()=>y(D.key),share:D.percent,fillColor:J,children:[U&&o.jsx("ul",{className:"space-y-0.5",children:j.map(H=>o.jsx(xt,{level:1,label:n0(H),tokens:ct(H.totals.total_tokens||0),percent:null},H.key||H.name))}),W&&T&&o.jsx(yn,{toolSet:T,execDetails:_,source:n,codexQueueFallback:N}),W&&N&&!T&&o.jsx("p",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500 py-0.5",children:g("dashboard.context_breakdown.tool_details.unavailable_codex")}),ee&&$&&o.jsx(yn,{toolSet:$,execDetails:null,source:n,codexQueueFallback:!1})]},D.key)}),n==="claude"&&T?.categories?.length>0&&o.jsx(xt,{level:0,colorSquare:o.jsx("span",{className:"h-2 w-2 rounded-sm shrink-0 bg-oai-gray-300 dark:bg-oai-gray-600","aria-hidden":"true"}),label:g("dashboard.context_breakdown.category.tool_calls"),tokens:ct(C),percent:null,hasChevron:!0,open:!!f.tool_calls_aux,onToggle:()=>y("tool_calls_aux"),children:o.jsx(yn,{toolSet:T,execDetails:_,source:n,codexQueueFallback:!1})}),n==="claude"&&$?.categories?.length>0&&o.jsx(xt,{level:0,colorSquare:o.jsx("span",{className:"h-2 w-2 rounded-sm shrink-0 bg-oai-gray-300 dark:bg-oai-gray-600","aria-hidden":"true"}),label:g("dashboard.context_breakdown.category.custom_agents"),tokens:ct(A),percent:null,hasChevron:!0,open:!!f.custom_agents_aux,onToggle:()=>y("custom_agents_aux"),children:o.jsx(yn,{toolSet:$,execDetails:null,source:n,codexQueueFallback:!1})}),M?.categories?.length>0&&o.jsx(xt,{level:0,colorSquare:o.jsx("span",{className:"h-2 w-2 rounded-sm shrink-0 bg-oai-gray-300 dark:bg-oai-gray-600","aria-hidden":"true"}),label:g("dashboard.context_breakdown.category.mcp_servers"),tokens:ct(O),percent:null,hasChevron:!0,open:!!f.mcp_servers,onToggle:()=>y("mcp_servers"),children:o.jsx(yn,{toolSet:M,execDetails:null,source:n,codexQueueFallback:!1})}),v.length>0&&o.jsx(xt,{level:0,colorSquare:o.jsx("span",{className:"h-2 w-2 rounded-sm shrink-0 bg-oai-gray-300 dark:bg-oai-gray-600","aria-hidden":"true"}),label:g("dashboard.context_breakdown.category.skills"),tokens:ct(v.reduce((D,Y)=>D+(Y.total_tokens||0),0)),percent:null,hasChevron:!0,open:!!f.skills,onToggle:()=>y("skills"),children:o.jsx("ul",{className:"space-y-0.5",children:v.slice(0,12).map(D=>o.jsx(xt,{level:1,label:D.name,tokens:ct(D.total_tokens),percent:null},D.name))})})]}),o.jsx("p",{className:"mt-2 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:g(s0(n))}),N?o.jsx("p",{className:"mt-2 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:g("dashboard.context_breakdown.tool_details.unavailable_codex")}):null,b?o.jsxs("p",{className:"mt-2 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:[Ae(b.skills_count||0)," skills ·"," ",Ae(b.mcp_servers_count||0)," MCP servers ·"," ",Ae(b.custom_agents_count||0)," agents ·"," ",Ae(b.memory_files_count||0)," memory files"]}):null]})}function Kn(e){if(!Number.isFinite(Number(e)))return null;const t=Number(e);return t<=0?null:Ae(t,{decimals:1})}function Ys(e,t,n){const a=Number(e);if(!Number.isFinite(a)||a<=0)return null;const r=ta(t);return(t===Uo?a:a*n)<.01?`<${r}0.01`:an(a,{decimals:2,currency:t,rate:n})}function c0(e){return Array.isArray(e)?e.map(t=>typeof t=="string"?{key:t,label:wo(t)}:{key:t.key,label:t.label||wo(t.key)}):[]}function d0(e){if(typeof e!="string")return null;const t=e.replace(/,/g,"").match(/-?\d+(?:\.\d+)?/);if(!t)return null;const n=Number(t[0]);return Number.isFinite(n)?n:null}const u0={CODEX:"#3b82f6",CLAUDE:"#d97757",OPENCODE:"#f59e0b",GEMINI:"#2196f3",KIMI:"#a78bfa","KILO-CLI":"#facc15","KILO-CODE":"#facc15",MIMO:"#ff6900",DROID:"#ef4444",ZCODE:"#14b8a6"};function Wa(e,t){const n=e?.toUpperCase?.()||"";return u0[n]||`hsl(${150+t*40}, 60%, 45%)`}function f0(e){const t=String(e?.source||"").trim().toLowerCase(),n=String(e?.label||"").trim().toLowerCase();return t==="claude"||n==="claude"?"claude":t==="codex"||n==="codex"?"codex":null}const m0={day:"usage.period.day",week:"usage.period.week",month:"usage.period.month",total:"usage.period.total",custom:"usage.period.custom"};function wo(e){const t=m0[e];return t?g(t):String(e).toUpperCase()}function h0({loading:e,onClick:t}){const n=nr();return o.jsx(Ya,{variant:"secondary",size:"sm",disabled:e,onClick:t,"aria-label":g("usage.button.refresh"),className:"w-8 p-0",children:o.jsx(Fe.span,{"aria-hidden":"true",animate:e?{rotate:360}:{rotate:0},transition:e&&!n?{duration:1,repeat:1/0,ease:"linear"}:{duration:.3},style:{display:"inline-block"},children:"↻"})})}function g0({period:e,periods:t,onPeriodChange:n,summaryValue:a,summaryFullValue:r,onToggleSummaryFormat:s,summaryLabel:i,summaryCostValue:l,onCostInfo:c,fleetData:d=[],onRefresh:u,loading:f,className:h="",customFrom:y,customTo:p,onCustomRangeApply:x,customRangeOpen:k,onCustomRangeOpenChange:w,onOpenShare:b,from:_,to:v,deviceOptions:j=[],selectedDevice:N="",onDeviceChange:E}){const M=c0(t),T=Is(qo()),O=d0(String(a??"")),$=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 639px)").matches,[V,C]=m.useState($);m.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const F=window.matchMedia("(max-width: 639px)"),H=L=>C(L.matches);return F.addEventListener("change",H),()=>F.removeEventListener("change",H)},[]);const A=O!=null&&!V,I=m.useRef(null);m.useEffect(()=>{const F=I.current?.querySelector('[aria-selected="true"]');F&&typeof F.scrollIntoView=="function"&&F.scrollIntoView({block:"nearest",inline:"center"})},[e]);const[D,Y]=m.useState(null),{resolvedTheme:U}=Tl(),{currency:W,rate:ee}=rn(),ie=U==="dark",z=ie?"rgba(10,10,10,0.98)":"rgba(255,255,255,0.96)",J=ie?"rgba(10,10,10,0)":"rgba(255,255,255,0)",de=A?o.jsx(Yc,{value:O,displayValue:a,fontSize:72,padding:6,gap:1,textColor:"var(--oai-black, #111827)",fontWeight:700,gradientHeight:ie?0:8,gradientFrom:z,gradientTo:J,counterStyle:{paddingLeft:0,paddingRight:0,gap:0},digitStyle:{width:"0.88ch"}}):a,me=d.filter(F=>F.models?.length>0);return o.jsxs(et,{className:h,children:[o.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[o.jsx("div",{ref:I,role:"tablist","aria-label":g("usage.overview.tablist_aria"),className:"flex flex-1 min-w-0 gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:M.map(F=>{const H=e===F.key,L=`shrink-0 whitespace-nowrap text-xs font-medium px-3 py-1.5 rounded-md transition-colors ${H?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800"}`;if(F.key==="custom"){const re=H&&y&&p?`${mo(y,T)} — ${mo(p,T)}`:F.label;return o.jsxs(za,{open:k,onOpenChange:X=>{X?n?.("custom"):w?.(X)},children:[o.jsx(Ha,{render:o.jsx("button",{role:"tab","aria-selected":H,type:"button",className:L}),children:re}),o.jsx(Ua,{children:o.jsx(qa,{sideOffset:8,side:"bottom",align:"start",className:"!z-[9999]",children:o.jsx(Va,{className:"bg-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-700 rounded-xl shadow-lg",children:o.jsx(Ka,{from:y,to:p,onApply:x,onCancel:()=>w?.(!1)})})})})]},"custom")}return o.jsx("button",{role:"tab","aria-selected":H,type:"button",className:L,onClick:()=>n?.(F.key),children:F.label},F.key)})}),o.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[j.length>1?o.jsx(Jo,{value:N,onValueChange:E,options:j,ariaLabel:g("dashboard.device_filter.aria"),matchTriggerWidth:!0,className:"h-8 px-3 text-xs font-medium rounded-md border-oai-gray-300 dark:border-oai-gray-700 bg-oai-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white hover:border-oai-brand hover:text-oai-brand hover:[&_svg]:text-oai-brand transition-colors duration-200"}):null,b?o.jsxs("button",{type:"button",onClick:b,"aria-label":g("share.button.aria"),className:"inline-flex items-center justify-center gap-1.5 h-8 px-3 text-xs font-medium rounded-md border border-oai-gray-300 dark:border-oai-gray-700 bg-oai-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white hover:border-oai-brand hover:text-oai-brand transition-colors duration-200",children:[o.jsx(Tc,{className:"h-3.5 w-3.5",strokeWidth:2}),g("share.button.label")]}):null,u&&o.jsx(h0,{loading:f,onClick:u})]})]}),o.jsxs("div",{className:"text-center mb-8",children:[o.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wider mb-3",children:i}),o.jsx("div",{className:"text-5xl sm:text-6xl md:text-7xl font-bold text-oai-black dark:text-oai-white tracking-tight tabular-nums",children:s?o.jsx("button",{type:"button",onClick:s,title:r||void 0,"aria-label":g("usage.summary.toggle_aria"),className:"cursor-pointer rounded-lg leading-none transition-opacity hover:opacity-80 focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand",children:de}):de}),l&&o.jsx("div",{className:"flex items-center justify-center gap-2 mt-4",children:c?o.jsxs("button",{type:"button",onClick:c,className:"inline-flex items-center gap-1.5 text-xl font-bold text-oai-brand hover:text-oai-brand-dark dark:hover:text-oai-brand-light transition-colors cursor-pointer","aria-label":g("usage.overview.cost_breakdown_aria"),children:[l,o.jsx(Qo,{size:16,strokeWidth:2,className:"opacity-80"})]}):o.jsx("span",{className:"text-xl font-bold text-oai-brand",children:l})})]}),me.length>0&&o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{role:"img","aria-label":g("usage.overview.distribution_aria",{items:me.map(F=>g("usage.overview.distribution_item",{label:F.label,percent:F.totalPercent})).join(",")}),className:"h-1.5 w-full bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden flex",children:me.map((F,H)=>{const L=Wa(F.label,H);return o.jsx(Fe.div,{initial:{width:0},animate:{width:`${F.totalPercent}%`},transition:{duration:.5,delay:.45+H*.04,ease:[.16,1,.3,1]},className:"h-full",style:{backgroundColor:L},title:`${F.label}: ${F.totalPercent}%`},F.label)})}),o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 xl:grid-cols-5 gap-3",children:me.map((F,H)=>{const L=Wa(F.label,H),re=D===F.label;return o.jsxs("button",{"aria-expanded":re,"aria-controls":`provider-details-${F.label}`,"aria-label":g("usage.overview.provider_card_aria",{provider:F.label,percent:F.totalPercent,tokens:Kn(F.usage)||"0",cost:Ys(F.usd,W,ee)||`${ta(W)}0`,action:g(re?"usage.overview.collapse":"usage.overview.expand")}),onClick:()=>Y(re?null:F.label),className:`min-w-0 text-left p-3 rounded-lg border transition-colors duration-200 ${re?"border-oai-gray-300 dark:border-oai-gray-600 bg-oai-gray-50 dark:bg-oai-gray-800":"border-oai-gray-200 dark:border-oai-gray-700 hover:border-oai-gray-300 dark:hover:border-oai-gray-600"}`,children:[o.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[o.jsx(Ko,{provider:F.label,size:15,color:L,className:"text-oai-gray-700 dark:text-oai-gray-300 shrink-0"}),o.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:F.label})]}),o.jsxs("div",{className:"text-lg font-semibold text-oai-black dark:text-oai-white tabular-nums",children:[F.totalPercent,"%"]}),o.jsx("div",{className:"mt-0.5 text-[11px] text-oai-gray-400 dark:text-oai-gray-400 tabular-nums",children:g("usage.overview.model_count",{count:F.models.length})})]},F.label)})}),D&&o.jsx("div",{id:`provider-details-${D}`,role:"region","aria-label":g("usage.overview.model_details_aria",{provider:D}),className:"mt-2",children:me.filter(F=>F.label===D).map(F=>{const H=Wa(F.label,0),L=f0(F),re=[...F.models].sort((Q,se)=>(se.share||0)-(Q.share||0)),X=L?`${L==="claude"?"Claude":"Codex"} Context Breakdown`:F.label;return o.jsx(y0,{provider:F,color:H,providerHeading:X,contextSource:L,from:_,to:v,sortedModels:re},F.label)})})]})]})}function y0({provider:e,color:t,providerHeading:n,contextSource:a,from:r,to:s,sortedModels:i}){const{currency:l,rate:c}=rn(),[d,u]=m.useState(!1),f=String(e?.source||e?.label||"").trim().toLowerCase()==="antigravity";return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-1.5 mb-3",children:[o.jsx(Ko,{provider:e.label,size:14,color:t,className:"shrink-0"}),o.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:n}),a&&d&&o.jsx(kc,{size:12,className:"text-oai-gray-400 dark:text-oai-gray-500 animate-spin shrink-0","aria-label":g("dashboard.context_breakdown.loading_aria")})]}),e.cacheHitRate!=null&&o.jsxs("p",{className:"mb-3 text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400 tabular-nums",children:[o.jsx("span",{className:"font-medium text-oai-gray-600 dark:text-oai-gray-300",children:g("usage.overview.cache_hit_rate_label")})," ",o.jsxs("span",{className:"text-oai-black dark:text-oai-white",children:[e.cacheHitRate,"%"]})," · ",g("usage.overview.cache_hit_rate_detail",{reused:Kn(e.cacheReusedTokens)||"0",input:Kn(e.cacheInputTokens)||"0"})]}),f&&o.jsxs("p",{className:"mb-3 text-[10px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:[o.jsxs("span",{className:"font-medium text-oai-gray-500 dark:text-oai-gray-400",children:[g("usage.overview.antigravity_notice_title"),"."]})," ",g("usage.overview.antigravity_notice_body")]}),a?o.jsx("div",{className:"mb-4 pb-4 border-b border-oai-gray-200 dark:border-oai-gray-700",children:o.jsx(l0,{from:r,to:s,source:a,referenceTotalTokens:e.usage,onLoadingChange:u})}):null,o.jsx("div",{className:"space-y-3",children:i.map(h=>{const y=Kn(h.usage),p=Ys(h.cost,l,c),x=Math.max(0,Math.min(100,Number(h.share)||0));return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-baseline gap-4 mb-1.5",children:[o.jsx("span",{className:"flex-1 min-w-0 text-sm text-oai-gray-700 dark:text-oai-gray-300 truncate",title:h.name,children:h.name}),o.jsx("span",{className:"shrink-0 w-16 text-right text-sm text-oai-gray-500 dark:text-oai-gray-400 tabular-nums",children:y}),o.jsx("span",{className:"shrink-0 w-16 text-right text-sm text-oai-gray-500 dark:text-oai-gray-400 tabular-nums",children:p}),o.jsxs("span",{className:"shrink-0 w-12 text-right text-sm text-oai-black dark:text-oai-white tabular-nums",children:[h.share,"%"]})]}),o.jsx("div",{className:"h-[3px] bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden",role:"progressbar","aria-valuenow":x,"aria-valuemin":0,"aria-valuemax":100,children:o.jsx("div",{className:"h-full transition-[width] duration-500 ease-out",style:{width:`${x}%`,backgroundColor:t,opacity:.45}})})]},h.id||h.name)})})]})}function p0(e){return e==="day"?"hourly":e==="total"?"monthly":"daily"}function b0(e){return!!e&&!e.missing&&!e.future}function x0(e){const t=e?.billable_total_tokens??e?.total_tokens??e?.value,n=Number(t);return Number.isFinite(n)&&n>=0?n:0}function k0(e){const t=e?.total_tokens??e?.billable_total_tokens??e?.value,n=Number(t);return Number.isFinite(n)&&n>=0?n:0}function w0(e){const t=Array.isArray(e)?e.filter(b0):[];let n=0,a=0,r=0,s=0,i=!1,l=0,c=-1,d=null;for(const u of t){const f=k0(u),h=x0(u);n+=f,a+=h;const y=Number(u?.conversation_count);Number.isFinite(y)&&y>0&&(r+=y);const p=Number(u?.total_cost_usd);Number.isFinite(p)&&(i=!0,s+=p),h>0&&(l+=1),h>c&&(c=h,d=u)}return{totalTokens:n,billableTokens:a,conversationCount:r,totalCostUsd:i?s:null,bucketCount:t.length,activeBuckets:l,peak:d&&c>0?{value:c,label:d.hour||d.day||d.month||""}:null}}function vo(e){return String(e).padStart(2,"0")}function v0(e,t){if(!e)return"";if(t==="hourly"){const n=String(e.hour||e.label||""),a=/^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2})/.exec(n);if(!a)return n;const[,r,s,i]=a,c=Number(s)*60+Number(i)+30,d=Math.floor(c/60)%24,u=c%60;return`${r} ${s}:${i}–${vo(d)}:${vo(u)}`}return String(t==="monthly"?e.month||e.label||"":e.day||e.label||"")}function _0(e){if(!e||e.activeBuckets===0)return"trend.zoom.insight.empty";const t=e.totalTokens||0;return t<1e7?"trend.zoom.insight.calm":t<5e8?"trend.zoom.insight.steady":t<5e9?"trend.zoom.insight.heavy":"trend.zoom.insight.massive"}function N0(e,t){if(!e)return"";if(t==="hourly"){const r=/T(\d{2}:\d{2})/.exec(String(e.hour||e.label||""));return r?r[1]:""}if(t==="monthly")return String(e.month||e.label||"");const n=String(e.day||e.label||""),a=/^\d{4}-(\d{2}-\d{2})$/.exec(n);return a?a[1]:n}const j0=[{period:"day",labelKey:"trend.zoom.gran.30min"},{period:"month",labelKey:"trend.zoom.gran.day"},{period:"total",labelKey:"trend.zoom.gran.month"}],S0=24,Zt="#10b981";function _o(e){return e==="day"?"day":e==="total"?"total":"month"}function Xa(e,t){const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e||""));if(!n)return e;const a=new Date(Date.UTC(Number(n[1]),Number(n[2])-1,Number(n[3])));a.setUTCDate(a.getUTCDate()+t);const r=a.getUTCFullYear(),s=String(a.getUTCMonth()+1).padStart(2,"0"),i=String(a.getUTCDate()).padStart(2,"0");return`${r}-${s}-${i}`}function M0(e,t){const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e||""));if(!n)return e;const a=new Date(Date.UTC(Number(n[1]),Number(n[2])-1+t,Number(n[3]))),r=a.getUTCFullYear(),s=String(a.getUTCMonth()+1).padStart(2,"0"),i=String(a.getUTCDate()).padStart(2,"0");return`${r}-${s}-${i}`}function C0(e,t){const n=/^(\d{4})-(\d{2})/.exec(String(e||"")),a=/^(\d{4})-(\d{2})/.exec(String(t||""));if(!n||!a)return S0;const r=Number(a[1])*12+Number(a[2])-(Number(n[1])*12+Number(n[2]))+1;return Math.max(1,r)}function No(e,t){return t?e==="total"?{from:M0(t,-23),to:t}:{from:Xa(t,-29),to:t}:{from:null,to:null}}function D0(e){const t=/^\d{4}-(\d{2}-\d{2})T(\d{2}:\d{2})/.exec(String(e||""));return t?`${t[1]} ${t[2]}`:e||""}function Bn({label:e,value:t,sub:n}){return o.jsxs("div",{className:"flex flex-col gap-1.5 group",children:[o.jsx("span",{className:"text-[9px] font-bold uppercase tracking-widest font-mono text-zinc-400 dark:text-zinc-500",children:e}),o.jsx("span",{className:"text-xl font-black font-mono text-zinc-900 dark:text-zinc-50 tracking-tight leading-none tabular-nums transition-transform duration-200 group-hover:-translate-y-[1px]",children:t}),n?o.jsx("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono tabular-nums",children:n}):null]})}function T0({zoomConfig:e,period:t,from:n,to:a,timeZoneLabel:r,onClose:s,renderChart:i}){const{currency:l,rate:c}=rn(),d=P.useMemo(()=>ea({timeZone:e?.timeZone,offsetMinutes:e?.tzOffsetMinutes,date:e?.now||new Date})||a||n||null,[e?.timeZone,e?.tzOffsetMinutes,e?.now,a,n]),[u,f]=P.useState(()=>_o(t)),[h,y]=P.useState(d),[p,x]=P.useState(()=>No(_o(t),d)),[k,w]=P.useState(!1),[b,_]=P.useState(!1),[v,j]=P.useState(!1),N=d,E=W=>{f(W),W!=="day"&&x(No(W,d))},M=P.useMemo(()=>u==="day"?{from:h,to:h,months:void 0}:u==="total"?{from:void 0,to:p.to,months:C0(p.from,p.to)}:{from:p.from,to:p.to,months:void 0},[u,h,p]),{rows:T,from:O,to:$,loading:V}=ts({...e,period:u,from:M.from,to:M.to,months:M.months}),C=P.useMemo(()=>w0(T),[T]),A=P.useCallback(()=>j(!0),[]),I=W=>{W.target===W.currentTarget&&v&&s()};if(P.useEffect(()=>{const W=ee=>{ee.key==="Escape"&&A()};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[A]),typeof document>"u")return null;const D=u==="day"&&!!h,Y=u==="day"&&!!h&&(!N||h<N),U=C.totalCostUsd!=null?an(C.totalCostUsd,{currency:l,rate:c}):null;return o.jsxs("div",{onAnimationEnd:I,onClick:W=>{W.target===W.currentTarget&&A()},className:Ie("fixed inset-0 z-50 flex items-center justify-center p-3 md:p-6 backdrop-blur-md bg-black/15 dark:bg-black/40",v?"animate-tt-fade-out":"animate-tt-fade-in"),children:[o.jsx("style",{children:`
|
|
2
|
+
@keyframes tt-fade-in { from { opacity: 0; } to { opacity: 1; } }
|
|
3
|
+
@keyframes tt-fade-out { from { opacity: 1; } to { opacity: 0; } }
|
|
4
|
+
@keyframes tt-modal-entrance {
|
|
5
|
+
from { opacity: 0; transform: scale(0.96) translateY(10px); }
|
|
6
|
+
to { opacity: 1; transform: scale(1) translateY(0); }
|
|
7
|
+
}
|
|
8
|
+
@keyframes tt-modal-exit {
|
|
9
|
+
from { opacity: 1; transform: scale(1) translateY(0); }
|
|
10
|
+
to { opacity: 0; transform: scale(0.96) translateY(10px); }
|
|
11
|
+
}
|
|
12
|
+
.animate-tt-fade-in { animation: tt-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
|
|
13
|
+
.animate-tt-fade-out { animation: tt-fade-out 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
|
|
14
|
+
.animate-tt-modal { animation: tt-modal-entrance 0.3s cubic-bezier(0.34, 1.3, 0.64, 1) forwards; }
|
|
15
|
+
.animate-tt-modal-exit { animation: tt-modal-exit 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
|
|
16
|
+
@media (prefers-reduced-motion: reduce) {
|
|
17
|
+
.animate-tt-fade-in, .animate-tt-fade-out, .animate-tt-modal, .animate-tt-modal-exit { animation: none; }
|
|
18
|
+
}
|
|
19
|
+
`}),o.jsxs("div",{className:Ie("relative w-full max-w-6xl h-[88vh] backdrop-blur-2xl bg-white/90 dark:bg-oai-gray-900/90 border border-oai-gray-200/50 dark:border-white/10 shadow-2xl rounded-2xl flex flex-col md:flex-row overflow-hidden",v?"animate-tt-modal-exit":"animate-tt-modal"),children:[o.jsx("button",{type:"button",onClick:A,"aria-label":g("trend.zoom.close_aria"),className:"absolute top-4 right-4 z-50 p-2 rounded-full border border-oai-gray-200/60 dark:border-oai-gray-800/60 bg-white/50 dark:bg-oai-gray-900/50 text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white hover:rotate-90 hover:scale-105 active:scale-95 transition-all duration-300",children:o.jsx(or,{size:16})}),o.jsxs("div",{className:"w-full md:w-[320px] shrink-0 border-b md:border-b-0 md:border-r border-zinc-200/50 dark:border-zinc-800/40 p-5 md:p-6 flex flex-col gap-6 overflow-y-auto backdrop-blur-md bg-zinc-50/50 dark:bg-zinc-950/50",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[o.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[o.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:Zt}}),o.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5",style:{backgroundColor:Zt}})]}),o.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono text-zinc-400 dark:text-zinc-500",children:g("trend.zoom.badge")})]}),o.jsx("h4",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight leading-none mt-2 select-none",children:g("trend.monitor.label")}),r?o.jsx("p",{className:"text-[10px] text-zinc-400 dark:text-zinc-500 mt-1.5 font-mono select-none",children:r}):null,o.jsx("p",{className:"text-[11px] leading-relaxed text-zinc-400 dark:text-zinc-500 mt-2 font-normal select-none",children:g("trend.zoom.desc")})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-x-5 gap-y-5 border-y border-zinc-200/50 dark:border-zinc-800/50 py-5 select-none",children:[o.jsx(Bn,{label:g("trend.zoom.stats.tokens"),value:Ae(C.totalTokens)}),U?o.jsx(Bn,{label:g("trend.zoom.stats.cost"),value:U}):null,o.jsx(Bn,{label:g("trend.zoom.stats.conversations"),value:C.conversationCount.toLocaleString()}),C.peak?o.jsx(Bn,{label:g("trend.zoom.stats.peak"),value:Ae(C.peak.value),sub:D0(C.peak.label)}):null]}),o.jsxs("div",{className:"flex flex-col gap-2 select-none",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(oc,{size:11,style:{color:Zt}}),o.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono",style:{color:Zt},children:g("trend.zoom.insight_badge")})]}),o.jsxs("div",{className:"pl-3.5 border-l-2 relative",style:{borderColor:Zt},children:[o.jsx("div",{className:"absolute inset-y-0 left-0 w-[3px] blur-[2px] opacity-15 pointer-events-none rounded-full",style:{backgroundColor:Zt}}),o.jsx("p",{className:"text-[11px] leading-relaxed text-zinc-600 dark:text-zinc-400 font-normal",children:g(_0(C),{active:C.activeBuckets,peak:Ae(C.peak?.value||0)})})]})]})]}),o.jsxs("div",{className:"flex-1 min-w-0 flex flex-col p-5 md:p-6 overflow-y-auto",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3 mb-6 pr-10",children:[o.jsx("div",{role:"tablist","aria-label":g("trend.zoom.gran.aria"),className:"flex rounded-md border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 text-[11px]",children:j0.map(W=>o.jsx("button",{type:"button",role:"tab","aria-selected":u===W.period,onClick:()=>E(W.period),className:Ie("px-2.5 py-1 rounded transition-colors",u===W.period?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-oai-white font-medium":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200"),children:g(W.labelKey)},W.period))}),u==="day"?o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("button",{type:"button",onClick:()=>D&&y(W=>Xa(W,-1)),disabled:!D,"aria-label":g("trend.zoom.prev_day"),className:"p-1 rounded-md text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 disabled:opacity-30 disabled:pointer-events-none transition-colors",children:o.jsx(jc,{size:16})}),o.jsxs(za,{open:k,onOpenChange:w,children:[o.jsx(Ha,{"aria-label":g("trend.zoom.pick_day"),className:"text-[12px] font-medium text-oai-gray-700 dark:text-oai-gray-200 tabular-nums min-w-[100px] text-center px-2 py-0.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:h||"—"}),o.jsx(Ua,{children:o.jsx(qa,{sideOffset:8,side:"bottom",align:"center",className:"!z-[9999]",children:o.jsx(Va,{className:"bg-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-700 rounded-xl shadow-lg",children:o.jsx(Ka,{from:h,to:h,onApply:W=>{W&&y(W),w(!1)},onCancel:()=>w(!1)})})})})]}),o.jsx("button",{type:"button",onClick:()=>Y&&y(W=>Xa(W,1)),disabled:!Y,"aria-label":g("trend.zoom.next_day"),className:"p-1 rounded-md text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 disabled:opacity-30 disabled:pointer-events-none transition-colors",children:o.jsx(Zo,{size:16})})]}):o.jsxs(za,{open:b,onOpenChange:_,children:[o.jsx(Ha,{"aria-label":g("trend.zoom.pick_range"),className:"text-xs font-medium text-oai-gray-600 dark:text-oai-gray-300 tabular-nums px-2.5 py-1 rounded-md border border-oai-gray-200 dark:border-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors select-none",children:p.from&&p.to?p.from===p.to?p.from:`${p.from} → ${p.to}`:"—"}),o.jsx(Ua,{children:o.jsx(qa,{sideOffset:8,side:"bottom",align:"end",className:"!z-[9999]",children:o.jsx(Va,{className:"bg-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-700 rounded-xl shadow-lg",children:o.jsx(Ka,{from:p.from,to:p.to,onApply:(W,ee)=>{W&&x({from:W,to:ee||W}),_(!1)},onCancel:()=>_(!1)})})})})]})]}),o.jsx("div",{className:"flex-1 min-h-0 flex flex-col",children:V&&(!T||T.length===0)?o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx("p",{className:"text-sm text-oai-gray-400 dark:text-oai-gray-400",children:g("trend.zoom.loading")})}):i({rows:T,from:O,to:$,period:u,timeZoneLabel:r})})]})]})]})}function jo(e,t){if(!Array.isArray(e)||e.length===0)return 0;if(e.length===1)return e[0];const n=(e.length-1)*t,a=Math.floor(n),r=Math.ceil(n);if(a===r)return e[a];const s=n-a;return e[a]+(e[r]-e[a])*s}function P0(e){const t=Array.isArray(e)?e.filter(r=>Number.isFinite(r)&&r>0).sort((r,s)=>r-s):[];if(t.length===0)return{rawMax:0,effectiveMax:1,clippedValues:Array.isArray(e)?e.map(()=>0):[]};const n=t.at(-1)??0;let a=n;if(t.length>=4){const r=jo(t,.25),s=jo(t,.75),i=Math.max(s-r,0),l=s+i*1.5;n>l&&(a=Math.max(l,s,1))}return{rawMax:n,effectiveMax:Math.max(a,1),clippedValues:Array.isArray(e)?e.map(r=>!Number.isFinite(r)||r<=0?0:Math.min(r,Math.max(a,1))):[]}}const So=["#f472b6","#38bdf8","#34d399","#fbbf24","#a78bfa","#fb7185","#2dd4bf","#f97316","#6366f1","#ec4899","#14b8a6","#f59e0b"],zs={Input:"#38bdf8","Cached Input":"#14b8a6",Output:"#a78bfa","Reasoning Output":"#fb7185"},O0={codex:"#3b82f6",gpt:"#10b981",openai:"#10b981",claude:"#d97757",anthropic:"#d97757",gemini:"#2196f3",google:"#2196f3",kimi:"#a78bfa",moonshot:"#a78bfa",opencode:"#f59e0b",deepseek:"#f59e0b",droid:"#ef4444",kilo:"#facc15"};function Hs(e){const t=e.toLowerCase();for(const[r,s]of Object.entries(O0))if(t.includes(r))return s;let n=0;for(let r=0;r<e.length;r++)n=e.charCodeAt(r)+((n<<5)-n);const a=Math.abs(n)%So.length;return So[a]}function W0(e){if(!e)return[];const t=[];if(e.models&&typeof e.models=="object")for(const[n,a]of Object.entries(e.models)){const r=Number(a);Number.isFinite(r)&&r>0&&t.push({type:"model",name:n,value:r})}if(t.length===0){const n=[{name:"Input",key:"input_tokens"},{name:"Cached Input",key:"cached_input_tokens"},{name:"Output",key:"output_tokens"},{name:"Reasoning Output",key:"reasoning_output_tokens"}];for(const a of n){const r=Number(e[a.key]);Number.isFinite(r)&&r>0&&t.push({type:"token_type",name:a.name,value:r})}}return t.sort((n,a)=>a.value-n.value)}function E0(e,t){return e?.future?"predicted":e?.missing?"unsynced":t>0?"real":"real_zero"}const $0=.35,Mo=2,Co=4;function A0({value:e,displayValue:t,scale:n,index:a,row:r,totalBars:s,onMouseEnter:i,onMouseLeave:l}){const c=nr(),d=E0(r,e),u=d==="predicted"||d==="unsynced",f=n.effectiveMax>0?t/n.effectiveMax*100:0;let h,y;d==="real"?(h=`${Math.max(f,2)}%`,y=`${Co}px`):u&&f>0?(h=`${f}%`,y=`${Co}px`):(h=`${Mo}px`,y=`${Mo}px`);const p=d==="real"?W0(r):[],x=p.reduce((w,b)=>w+b.value,0),k=d!=="real"||x<=0;return o.jsxs(Fe.div,{className:"group relative flex-1 self-stretch",initial:{opacity:0,scaleY:0},animate:{opacity:1,scaleY:1},transition:{duration:c?0:.3,delay:c?0:.4+a*.008,ease:[.16,1,.3,1]},style:{originY:1},onMouseEnter:w=>i(w,r,e,p,d,t),onMouseLeave:l,children:[o.jsx("div",{className:"absolute inset-x-0 top-0 bottom-0 bg-oai-gray-100/70 dark:bg-white/[0.08] opacity-0 group-hover:opacity-100 transition-opacity duration-150 pointer-events-none"}),o.jsx("div",{className:"absolute inset-x-0 bottom-0 flex flex-col-reverse justify-start overflow-hidden cursor-pointer transition-all duration-200",style:{height:h,minHeight:y},children:k?o.jsx("div",{"data-trend-bar":"true",className:Ie("h-full w-full group-hover:brightness-110 transition-all",d==="real"?"":"bg-oai-gray-100 dark:bg-oai-gray-800"),style:{opacity:u?$0:1,background:d==="real"?"#10b981":void 0}}):p.map((w,b)=>{const _=w.type==="token_type"?zs[w.name]:Hs(w.name),v=`${w.value/x*100}%`;return o.jsx("div",{"data-trend-bar":b===0?"true":void 0,className:"w-full group-hover:brightness-110 transition-all",style:{height:v,background:_}},b)})})]})}function F0(e){if(e?.missing||e?.future)return null;const t=e?.billable_total_tokens??e?.total_tokens??e?.value;if(t==null)return null;const n=Number(t);return Number.isFinite(n)&&n>=0?n:null}const Do=.98;function I0(e){if(!Array.isArray(e))return[];const t=new Array(e.length);for(let n=0;n<e.length;n++){if(e[n]!==null){t[n]=e[n];continue}let a=null,r=-1;for(let l=n-1;l>=0;l--)if(e[l]!==null){a=e[l],r=l;break}let s=null,i=-1;for(let l=n+1;l<e.length;l++)if(e[l]!==null){s=e[l],i=l;break}if(a!==null&&s!==null){const l=(n-r)/(i-r);t[n]=a+(s-a)*l}else if(a!==null){let l=0,c=0;for(let u=0;u<=r;u++)e[u]!==null&&(l+=e[u],c+=1);const d=c>0?l/c:a;t[n]=d*Math.pow(Do,n-r)}else if(s!==null){let l=0,c=0;for(let u=i;u<e.length;u++)e[u]!==null&&(l+=e[u],c+=1);const d=c>0?l/c:s;t[n]=d*Math.pow(Do,i-n)}else t[n]=0}return t}function Us({rows:e,from:t,to:n,period:a,timeZoneLabel:r,showTimeZoneLabel:s=!0,className:i="",embedded:l=!1,chartHeightClass:c="h-40",isZoom:d=!1,zoomConfig:u=null}){const f=P.useMemo(()=>Array.isArray(e)&&e.length?e:[],[e]),{rawValues:h,seriesValues:y,scale:p,interpolatedValues:x}=P.useMemo(()=>{const C=f.map(F0),A=C.map(I=>I??0);return{rawValues:C,seriesValues:A,scale:P0(A),interpolatedValues:I0(C)}},[f]),{currency:k,rate:w}=rn(),b=p0(a),[_,v]=P.useState(null),[j,N]=P.useState({x:0,y:0,shiftX:0,flipDown:!1}),[E,M]=P.useState(!1),T=P.useRef(null),O=P.useRef(null),$=(C,A,I,D,Y,U)=>{O.current&&(clearTimeout(O.current),O.current=null);const W=d?v0(A,b):A?.day||A?.hour||A?.month||"";v({row:A,value:I,segments:D,timeLabel:W,kind:Y,displayValue:U});const ee=C.currentTarget.querySelector('[data-trend-bar="true"]'),ie=ee&&ee.parentElement?ee.parentElement.getBoundingClientRect():C.currentTarget.getBoundingClientRect(),z=T.current;if(!z)return;const J=z.getBoundingClientRect(),de=ie.left-J.left+ie.width/2,me=ie.top-J.top,F=140;let H=0;de<F?H=F-de:de>J.width-F&&(H=J.width-F-de);const L=96+(d?22:0)+(D.length?Math.min(D.length*30+24,174):0),re=me<L+12;N({x:de,y:me,shiftX:H,flipDown:re})},V=()=>{O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{v(null)},150)};return o.jsxs("div",{ref:T,className:Ie("relative",!l&&"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5",d&&"flex h-full flex-col",i),children:[!l&&o.jsxs("div",{className:"mb-3 flex items-start justify-between gap-2",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:g("trend.monitor.label")}),s&&r&&o.jsx("p",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:r})]}),u&&o.jsx("button",{type:"button",onClick:()=>M(!0),"aria-label":g("trend.zoom.open_aria"),title:g("trend.zoom.open_aria"),className:"shrink-0 p-1.5 rounded-md text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:o.jsx(sc,{size:14})})]}),o.jsxs("div",{className:Ie("space-y-3",d&&"flex flex-1 flex-col min-h-0 !space-y-0 gap-3"),children:[o.jsxs("div",{className:Ie("relative",d&&"flex-1 min-h-0"),children:[o.jsx("div",{className:"absolute inset-0 flex flex-col justify-between pointer-events-none",children:[0,25,50,75,100].map(C=>o.jsx("div",{className:"w-full border-t border-oai-gray-100 dark:border-oai-gray-800",style:{top:`${100-C}%`}},C))}),o.jsx("div",{className:Ie("flex items-end gap-0.5 relative z-0",c),children:y.length>0?y.map((C,A)=>{const I=f[A],Y=I?.missing||I?.future?Math.min(x[A]??0,p.effectiveMax):p.clippedValues[A]??0;return o.jsx(A0,{value:C,displayValue:Y,scale:p,index:A,row:I,totalBars:y.length,onMouseEnter:$,onMouseLeave:V},A)}):o.jsx("div",{className:"flex-1 h-full flex items-center justify-center",children:o.jsx("p",{className:"text-sm text-oai-gray-400 dark:text-oai-gray-400",children:"No data yet"})})})]}),d&&y.length>0&&o.jsx("div",{className:"flex gap-0.5 select-none",children:f.map((C,A)=>{const I=y.length-1,D=Math.max(1,Math.ceil(y.length/8)),Y=A%D===0||A===I,U=A===0?"justify-start":A===I?"justify-end":"justify-center";return o.jsx("div",{className:Ie("flex-1 min-w-0 flex",U),children:Y&&o.jsx("span",{className:"text-[9px] text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap font-mono",children:N0(C,b)})},A)})}),t&&n&&o.jsxs("div",{className:"flex justify-between text-xs text-oai-gray-500 dark:text-oai-gray-300 font-medium pt-2 border-t border-oai-gray-100 dark:border-oai-gray-800",children:[o.jsx("span",{children:t===n?`${t} 00:00`:t}),o.jsx("span",{children:t===n?`${n} 24:00`:n})]})]}),_&&o.jsxs("div",{className:"absolute z-[9999] w-0 h-0 transition-all duration-100 ease-out pointer-events-none",style:{left:`${j.x}px`,top:`${j.y}px`},children:[o.jsxs("div",{className:Ie("absolute left-0 backdrop-blur-md bg-white/95 dark:bg-oai-gray-900/95 border border-oai-gray-200/50 dark:border-oai-gray-800/50 shadow-xl rounded-xl p-3.5 max-w-[280px] min-w-[220px] flex flex-col gap-2 animate-in fade-in zoom-in-95 duration-100",j.flipDown?"top-[10px]":"bottom-[10px]"),style:{transform:`translateX(calc(-50% + ${j.shiftX}px))`},children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-oai-gray-100 dark:border-oai-gray-800/80 pb-1.5",children:[o.jsx("span",{className:"text-[11px] font-semibold text-oai-gray-500 dark:text-oai-gray-400",children:_.timeLabel}),_.kind==="predicted"&&o.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500",children:"Predicted"}),_.kind==="unsynced"&&o.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500",children:"Unsynced"})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-baseline gap-1",children:[o.jsx("span",{className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:_.kind==="predicted"||_.kind==="unsynced"?`~${Math.round(_.displayValue??0).toLocaleString()}`:_.value.toLocaleString()}),o.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:"Tokens"})]}),d&&(_.row?.total_cost_usd!=null||Number(_.row?.conversation_count)>0)&&o.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:[_.row?.total_cost_usd!=null&&o.jsxs("span",{children:[o.jsx("span",{className:"font-semibold text-oai-gray-700 dark:text-oai-gray-200",children:an(_.row.total_cost_usd,{currency:k,rate:w})})," ",g("trend.zoom.tooltip.cost")]}),Number(_.row?.conversation_count)>0&&o.jsxs("span",{children:[o.jsx("span",{className:"font-semibold text-oai-gray-700 dark:text-oai-gray-200",children:Number(_.row.conversation_count).toLocaleString()})," ",g("trend.zoom.tooltip.conversations")]})]}),_.segments&&_.segments.length>0?o.jsxs("div",{className:"mt-1.5 border-t border-oai-gray-100 dark:border-oai-gray-800/60 pt-2 flex flex-col gap-1.5",children:[o.jsx("div",{className:"text-[10px] font-semibold text-oai-gray-400 dark:text-oai-gray-500 uppercase tracking-wider",children:_.segments[0].type==="model"?"Model Breakdown":"Token Breakdown"}),o.jsx("div",{className:"flex flex-col gap-2 max-h-[150px] overflow-y-auto pr-1.5 oai-scrollbar",children:_.segments.map(({name:C,value:A,type:I})=>{const D=_.value||1,Y=Math.round(A/D*100),U=I==="token_type"?zs[C]:Hs(C);return o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsxs("div",{className:"flex items-center justify-between text-[11px] gap-3",children:[o.jsx("span",{className:"font-medium text-oai-gray-750 dark:text-oai-gray-200 truncate max-w-[130px]",title:C,children:C}),o.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[o.jsx("span",{className:"font-mono text-oai-gray-900 dark:text-oai-gray-100 font-semibold",children:A.toLocaleString()}),o.jsxs("span",{className:"text-[9px] text-oai-gray-450 dark:text-oai-gray-500 min-w-[28px] text-right font-medium",children:[Y,"%"]})]})]}),o.jsx("div",{className:"w-full h-1 bg-oai-gray-100 dark:bg-oai-gray-800/85 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Y}%`,backgroundColor:U,boxShadow:`0 0 4px ${U}55`}})})]},C)})})]}):null]})]}),o.jsx("div",{className:Ie("absolute left-0 -translate-x-1/2 w-2.5 h-2.5 rotate-45 bg-white dark:bg-oai-gray-900 border-oai-gray-200/50 dark:border-oai-gray-800/50 shadow-sm",j.flipDown?"top-[6px] border-l border-t":"bottom-[6px] border-r border-b"),style:j.flipDown?{marginTop:"1px"}:{marginBottom:"1px"}})]}),E&&u&&o.jsx(T0,{zoomConfig:u,period:a,from:t,to:n,timeZoneLabel:r,onClose:()=>M(!1),renderChart:C=>o.jsx(Us,{embedded:!0,isZoom:!0,chartHeightClass:"h-full",...C})})]})}function L0({id:e,children:t,onEmptyChange:n}){const{attributes:a,listeners:r,setNodeRef:s,transform:i,transition:l,isDragging:c}=Kl({id:e}),d=m.useRef(null),u=m.useRef(null);m.useLayoutEffect(()=>{if(!n)return;const h=d.current?d.current.childNodes.length===0:!0;u.current!==h&&(u.current=h,n(e,h))});const f={transform:Xl.Transform.toString(i)||void 0,transition:l,zIndex:c?20:void 0};return o.jsxs("div",{ref:s,style:f,className:Ie("group/sortable relative has-[[data-sortable-body]:empty]:hidden",c&&"opacity-90"),children:[o.jsx("button",{type:"button","aria-label":g("dashboard.overview.layout.drag_handle"),className:Ie("peer absolute left-1/2 top-1 z-10 flex h-5 w-6 -translate-x-1/2 items-center justify-center rounded-md","cursor-grab active:cursor-grabbing touch-none select-none","text-oai-gray-400 dark:text-oai-gray-600 opacity-0 transition-colors duration-150","hover:text-oai-gray-600 dark:hover:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800","group-hover/sortable:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/50",c&&"opacity-100 bg-oai-gray-100 dark:bg-oai-gray-800"),...a,...r,children:o.jsxs("svg",{viewBox:"0 0 14 8",width:"14",height:"8",fill:"currentColor","aria-hidden":"true",children:[o.jsx("circle",{cx:"2",cy:"2",r:"1"}),o.jsx("circle",{cx:"2",cy:"6",r:"1"}),o.jsx("circle",{cx:"7",cy:"2",r:"1"}),o.jsx("circle",{cx:"7",cy:"6",r:"1"}),o.jsx("circle",{cx:"12",cy:"2",r:"1"}),o.jsx("circle",{cx:"12",cy:"6",r:"1"})]})}),o.jsx("div",{ref:d,"data-sortable-body":!0,className:Ie("rounded-xl transition-shadow duration-200 ease-out","peer-hover:shadow-[0_12px_28px_-14px_rgba(15,23,42,0.22)] dark:peer-hover:shadow-[0_12px_28px_-12px_rgba(0,0,0,0.6)]","peer-focus-visible:shadow-[0_12px_28px_-14px_rgba(15,23,42,0.22)] dark:peer-focus-visible:shadow-[0_12px_28px_-12px_rgba(0,0,0,0.6)]",c&&"shadow-[0_12px_28px_-14px_rgba(15,23,42,0.22)] dark:shadow-[0_12px_28px_-12px_rgba(0,0,0,0.6)]"),children:t})]})}const To={"idle-living":"idle/living.svg","idle-doze":"idle/doze.svg","idle-follow":"idle/follow.svg","idle-look":"idle/look.svg","idle-yawn":"idle/yawn.svg","idle-collapse":"idle/collapse.svg","working-building":"working/building.svg","working-carrying":"working/carrying.svg","working-conducting":"working/conducting.svg","working-confused":"working/confused.svg","working-debugger":"working/debugger.svg","working-juggling":"working/juggling.svg","working-overheated":"working/overheated.svg","working-pushing":"working/pushing.svg","working-sweeping":"working/sweeping.svg","working-thinking":"working/thinking.svg","working-typing":"working/typing.svg","working-ultrathink":"working/ultrathink.svg","working-wizard":"working/wizard.svg","mini-alert":"mini/alert.svg","mini-crabwalk":"mini/crabwalk.svg","mini-enter":"mini/enter.svg","mini-enter-sleep":"mini/enter-sleep.svg","mini-happy":"mini/happy.svg","mini-idle":"mini/idle.svg","mini-peek":"mini/peek.svg","mini-sleep":"mini/sleep.svg","react-double":"react/double.svg","react-drag":"react/drag.svg","react-left":"react/left.svg","react-right":"react/right.svg","collapse-sleep":"sleep/collapse-sleep.svg",sleeping:"sleep/sleeping.svg",wake:"sleep/wake.svg",disconnected:"status/disconnected.svg",error:"status/error.svg",notification:"status/notification.svg",happy:"happy.svg","static-base":"static-base.svg"},Ea=new Map;async function R0(e){if(Ea.has(e))return Ea.get(e);const t=await fetch(`/clawd/${e}`);if(!t.ok)return null;const a=(await t.text()).replace(/<svg([^>]*)>/,(r,s)=>`<svg${s.replace(/\s+width="[^"]*"/g,"").replace(/\s+height="[^"]*"/g,"")} width="100%" height="100%">`);return Ea.set(e,a),a}function B0({state:e="idle-living",size:t=48,className:n=""}){const[a,r]=m.useState(""),s=m.useRef(null),l=Y0()?"static-base":e,c=To[l]||To["static-base"];return m.useEffect(()=>{let d=!1;return R0(c).then(u=>{!d&&u&&r(u)}),()=>{d=!0}},[c]),m.useEffect(()=>{const d=s.current?.querySelector("svg");if(d)try{const u=d.getBBox();u.width>0&&u.height>0&&d.setAttribute("viewBox",`${u.x-2} ${u.y-2} ${u.width+4} ${u.height+4}`)}catch{}},[a]),o.jsx("div",{ref:s,className:`clawd-animated ${n}`,style:{width:t,height:t,display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},dangerouslySetInnerHTML:{__html:a}})}function Y0(){const[e,t]=m.useState(()=>typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return m.useEffect(()=>{const n=window.matchMedia("(prefers-reduced-motion: reduce)"),a=r=>t(r.matches);return n.addEventListener("change",a),()=>n.removeEventListener("change",a)},[]),e}function z0({todayTokens:e=0,isSyncing:t=!1,hasError:n=!1,isDisconnected:a=!1}={}){return m.useMemo(()=>n?"error":a?"disconnected":t?"working-typing":e===0?"sleeping":e<5e4?"idle-living":e<2e5?"idle-look":e<5e5?"working-ultrathink":e<2e6?"working-typing":"working-ultrathink",[e,t,n,a])}const Po="macAppBannerDismissed",H0="leaderboardBannerDismissed",U0="https://github.com/mm7894215/TokenTracker/releases/latest",Oo="tokentracker_native_app",Yn=(()=>{try{return new URLSearchParams(window.location.search).get("app")==="1"?(localStorage.setItem(Oo,"1"),!0):localStorage.getItem(Oo)==="1"}catch{return!1}})();function q0({todayTokens:e=0,isSyncing:t=!1,enterDelay:n=0}){const{openLoginModal:a}=Pl(),{signedIn:r}=Xo(),s=z0({todayTokens:e,isSyncing:t}),i=Yn?H0:Po,[l,c]=m.useState(()=>{try{return localStorage.getItem(i)==="1"?!0:!Yn&&new URLSearchParams(window.location.search).get("from")==="menubar"?(localStorage.setItem(Po,"1"),!0):!1}catch{return!1}}),d=m.useCallback(()=>{c(!0);try{localStorage.setItem(i,"1")}catch{}},[i]);if(l)return null;let u,f,h,y,p,x;Yn&&r?(u="View the Leaderboard",f="Compare your usage globally",h="Leaderboard",y=o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"opacity-70",children:o.jsx("path",{d:"M2 8.5V10h8V8.5M6 1.5v6m0 0L3.5 5M6 7.5l2.5-2.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",transform:"rotate(180 6 6)"})}),p=()=>{window.location.pathname="/leaderboard"}):Yn?(u="Join the Leaderboard",f="Log in to compare your usage with others",h="Log In",y=o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"opacity-70",children:o.jsx("path",{d:"M6.5 1.5h3a1 1 0 011 1v7a1 1 0 01-1 1h-3M5 8.5L7.5 6 5 3.5M7.5 6H1.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),p=a):(u="Try the Menu Bar App",f="Always-on stats with Clawd companion",h="Download",y=o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"opacity-70",children:o.jsx("path",{d:"M6 2v6m0 0L3.5 5.5M6 8l2.5-2.5M2 10h8",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),x=U0);const k=x?Fe.a:Fe.button,w=x?{href:x,target:"_blank",rel:"noopener noreferrer"}:{onClick:p};return o.jsx(Fe.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.35,delay:n,ease:[.16,1,.3,1]},className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-4",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"flex-shrink-0",children:o.jsx(B0,{state:s,size:56})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-sm font-medium text-oai-gray-900 dark:text-oai-white",children:u}),o.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-0.5",children:f})]}),o.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[o.jsxs(k,{...w,whileHover:{scale:1.03},whileTap:{scale:.97},className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-white bg-oai-gray-900 dark:bg-oai-white dark:text-oai-gray-900 rounded-md hover:opacity-90 transition-opacity",children:[h,y]}),o.jsx("button",{onClick:d,className:"p-1 text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-300 transition-colors","aria-label":"Dismiss",children:o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:o.jsx("path",{d:"M4 4l6 6m0-6L4 10",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})})})]})]})})}const Wo="widgetOnboardingDismissed",Eo="tokentracker_native_app",V0=(()=>{try{return new URLSearchParams(window.location.search).get("app")==="1"?(localStorage.setItem(Eo,"1"),!0):localStorage.getItem(Eo)==="1"}catch{return!1}})();function G0({enterDelay:e=0}){const[t,n]=m.useState(()=>{try{return localStorage.getItem(Wo)==="1"}catch{return!1}}),a=m.useCallback(()=>{n(!0);try{localStorage.setItem(Wo,"1")}catch{}},[]);return!V0||Ol()?null:o.jsx(sr,{initial:!1,children:!t&&o.jsxs(Fe.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-8,transition:{duration:.2,ease:[.4,0,.2,1]}},transition:{duration:.35,delay:e,ease:[.16,1,.3,1]},className:"relative rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-4",children:[o.jsx("button",{type:"button",onClick:a,"aria-label":g("dashboard.widgets.dismiss_aria"),className:"absolute top-2.5 right-2.5 z-10 inline-flex items-center justify-center w-7 h-7 rounded-md text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-300 dark:focus-visible:ring-oai-gray-600 transition-colors",children:o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"M4 4l6 6m0-6L4 10",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}),o.jsx("div",{className:"rounded-lg overflow-hidden ring-1 ring-black/5 dark:ring-white/10 shadow-sm",children:o.jsx("img",{src:"/widgets-overview.png",alt:g("dashboard.widgets.title"),width:734,height:552,className:"w-full h-auto block",loading:"lazy",decoding:"async"})}),o.jsxs("div",{className:"mt-4",children:[o.jsx("div",{className:"text-sm font-medium tracking-tight text-oai-gray-900 dark:text-oai-white",children:g("dashboard.widgets.title")}),o.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1 leading-snug",children:g("dashboard.widgets.hint")})]})]},"widget-onboarding-card")})}function K0({enabled:e=!1,from:t,to:n,accessToken:a,deviceId:r=null}={}){const[s,i]=m.useState(null),[l,c]=m.useState(!1),[d,u]=m.useState(null),f=m.useCallback(async()=>{if(e){c(!0),u(null);try{const h=await ze(a),y=await Wl({from:t,to:n,device:r,accessToken:h});i(y||null)}catch(h){u(h?.message||String(h)),i(null)}finally{c(!1)}}},[e,t,n,a,r]);return m.useEffect(()=>{if(!e){i(null),u(null),c(!1);return}f()},[e,f]),{data:s,loading:l,error:d,refresh:f}}function qs(e){return e==null?"—":e===0?"$0":e<1?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function X0(e){return e==null?"—":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function Vs(e){return e==null?"—":`${Math.round(e*100)}%`}function Q0(e,t){if(t==null||t===0||e==null||e===0)return"—";const n=e/t;return n<1?`$${n.toFixed(4)}`:`$${n.toFixed(2)}`}function J0({row:e}){return o.jsxs("tr",{className:"border-t border-oai-gray-100 dark:border-oai-gray-800/60 hover:bg-oai-gray-50/40 dark:hover:bg-oai-gray-800/10 transition-colors",children:[o.jsx("td",{className:"py-2.5 pr-2 font-mono text-[11px] text-oai-gray-700 dark:text-oai-gray-300 truncate max-w-[80px] xs:max-w-[110px] sm:max-w-[140px]",title:e.key,children:e.key}),o.jsx("td",{className:"py-2.5 px-1.5 text-right tabular-nums text-oai-gray-600 dark:text-oai-gray-400",children:qs(e.cost_usd)}),o.jsxs("td",{className:"py-2.5 px-1.5 text-right tabular-nums text-oai-gray-600 dark:text-oai-gray-400",children:[e.accepted,"/",e.outcomes]}),o.jsx("td",{className:"py-2.5 px-1.5 text-right tabular-nums text-oai-gray-600 dark:text-oai-gray-400",children:Vs(e.acceptance_rate)}),o.jsx("td",{className:"py-2.5 pl-2 pr-2 text-right tabular-nums font-semibold text-oai-black dark:text-oai-white",children:Q0(e.cost_usd,e.accepted)})]})}function Z0({from:e,to:t,deviceId:n=null}){const{enabled:a}=wc(),{data:r,loading:s}=K0({enabled:a,from:e,to:t,deviceId:n});if(!a)return null;const i=(r&&r.available&&Array.isArray(r.by_model)?r.by_model:[]).filter(u=>u.outcomes>0&&u.key!=="unknown");if(!i.length)return null;const l=i.slice(0,6),c=r.totals||{},d=`${g("qpd.card.subtitle")}${s?` ${g("qpd.card.updating")}`:""}`;return o.jsxs(et,{children:[o.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[o.jsx("h3",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:g("qpd.card.title")}),o.jsx("span",{className:"px-1.5 py-0.5 text-[9px] font-semibold tracking-wider text-oai-gray-500 bg-oai-gray-100 dark:text-oai-gray-400 dark:bg-oai-gray-800/80 rounded uppercase",children:g("qpd.card.badge")})]}),o.jsx("p",{className:"mb-3 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:d}),o.jsx("div",{className:"w-full overflow-x-auto oai-scrollbar",children:o.jsxs("table",{className:"w-full text-xs min-w-[340px] sm:min-w-0",children:[o.jsx("thead",{children:o.jsxs("tr",{className:"text-[10px] uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:[o.jsx("th",{className:"pb-1.5 pr-2 text-left font-medium",children:g("qpd.card.col_model")}),o.jsx("th",{className:"pb-1.5 px-1.5 text-right font-medium",children:g("qpd.card.col_cost")}),o.jsx("th",{className:"pb-1.5 px-1.5 text-right font-medium",children:g("qpd.card.col_accepted")}),o.jsx("th",{className:"pb-1.5 px-1.5 text-right font-medium",children:g("qpd.card.col_rate")}),o.jsx("th",{className:"pb-1.5 pl-2 pr-2 text-right font-medium",title:g("qpd.card.qpd_tooltip"),children:g("qpd.card.col_qpd")})]})}),o.jsx("tbody",{children:l.map(u=>o.jsx(J0,{row:u},u.key))})]})}),o.jsxs("div",{className:"mt-3 flex items-center justify-between border-t border-oai-gray-200 dark:border-oai-gray-800 pt-2.5 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:[o.jsx("span",{children:g("qpd.card.totals",{accepted:c.accepted??0,outcomes:c.outcomes??0,cost:qs(c.cost_usd)})}),o.jsx("span",{title:g("qpd.card.et_tooltip"),children:g("qpd.card.et",{tokens:X0(c.effective_tokens),rate:Vs(c.acceptance_rate)})})]}),c.outcomes<15&&o.jsxs("p",{className:"mt-3 text-[10px] text-oai-gray-400 dark:text-oai-gray-500 italic border-t border-oai-gray-100 dark:border-oai-gray-800/40 pt-2",children:["* ",g("qpd.card.sparse_notice","Tip: Spark outcomes dataset might skew Quality/$ ratios. For precise metrics, select a narrower time window.")]})]})}function xe({className:e}){return o.jsx("div",{className:Ie("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function ey(){return o.jsx("div",{className:"flex gap-1 overflow-hidden",children:Array.from({length:20},(e,t)=>o.jsx("div",{className:"flex flex-col gap-1",children:Array.from({length:7},(n,a)=>o.jsx(xe,{className:"h-2.5 w-2.5 rounded-[2px]"},a))},t))})}function ty(){return o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-4",children:[o.jsxs("div",{className:"lg:col-span-4 flex flex-col gap-4 min-w-0 order-2 lg:order-1",children:[o.jsx(et,{children:o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsx(xe,{className:"h-4 w-32"}),o.jsx(xe,{className:"h-6 w-24"})]})}),o.jsx(et,{children:o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(xe,{className:"h-3.5 w-24"}),Array.from({length:4},(e,t)=>o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(xe,{className:"h-3 w-20"}),o.jsx(xe,{className:"h-3 w-12"})]},t))]})}),o.jsx(et,{children:o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(xe,{className:"h-3.5 w-20"}),o.jsx(ey,{})]})}),o.jsx(et,{children:o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(xe,{className:"h-3.5 w-28"}),o.jsx(xe,{className:"h-32 w-full"})]})})]}),o.jsxs("div",{className:"lg:col-span-8 flex flex-col gap-4 min-w-0 order-1 lg:order-2",children:[o.jsxs(et,{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[o.jsx("div",{className:"flex flex-1 min-w-0 gap-1",children:Array.from({length:5},(e,t)=>o.jsx(xe,{className:"h-7 w-14 rounded-md shrink-0"},t))}),o.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[o.jsx(xe,{className:"h-8 w-20 rounded-md"}),o.jsx(xe,{className:"h-8 w-8 rounded-md"})]})]}),o.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[o.jsx(xe,{className:"h-3 w-28"}),o.jsx(xe,{className:"h-14 w-3/5 max-w-xs"}),o.jsx(xe,{className:"h-6 w-24"})]}),o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsx(xe,{className:"h-1.5 w-full rounded-full"}),o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 xl:grid-cols-5 gap-3",children:Array.from({length:5},(e,t)=>o.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 p-3",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(xe,{className:"h-[15px] w-[15px] rounded-sm shrink-0"}),o.jsx(xe,{className:"h-3 w-12"})]}),o.jsx(xe,{className:"h-5 w-10"}),o.jsx(xe,{className:"h-2.5 w-14"})]},t))})]})]}),o.jsxs(et,{children:[o.jsxs("div",{className:"flex items-center gap-1 mb-4",children:[o.jsx(xe,{className:"h-7 w-16 rounded"}),o.jsx(xe,{className:"h-7 w-20 rounded"})]}),o.jsxs("div",{className:"flex items-center gap-3 border-b border-oai-gray-200 dark:border-oai-gray-700 pb-2",children:[o.jsx(xe,{className:"h-3 w-20 shrink-0"}),Array.from({length:5},(e,t)=>o.jsx(xe,{className:"h-3 flex-1"},t))]}),o.jsx("div",{className:"flex flex-col",children:Array.from({length:8},(e,t)=>o.jsxs("div",{className:"flex items-center gap-3 border-b border-oai-gray-100 dark:border-oai-gray-800 py-2.5 last:border-b-0",children:[o.jsx(xe,{className:"h-3.5 w-20 shrink-0"}),Array.from({length:5},(n,a)=>o.jsx(xe,{className:"h-3.5 flex-1"},a))]},t))})]})]})]})}const ny=xc.slice(0,10),$o=.06,ay=.11,ry=.05,oy=new Set(["macAppBanner","widgetOnboarding"]);function Ao({title:e,subtitle:t,desc:n,loginCard:a,copy:r}){return o.jsxs("div",{className:"min-h-[85vh] w-full flex items-center justify-center text-oai-black dark:text-white relative overflow-hidden px-4 md:px-8 py-8 md:py-16 transition-colors duration-200 bg-[linear-gradient(to_right,#80808007_1px,transparent_1px),linear-gradient(to_bottom,#80808007_1px,transparent_1px)] bg-[size:40px_40px]",children:[o.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_50%_0%,rgba(59,130,246,0.03),transparent_50%)] dark:bg-[radial-gradient(circle_at_50%_0%,rgba(99,102,241,0.05),transparent_50%)] pointer-events-none"}),o.jsxs("div",{className:"w-full max-w-5xl grid grid-cols-1 lg:grid-cols-12 gap-8 lg:gap-16 items-start relative z-10",children:[o.jsxs("div",{className:"lg:col-span-7 flex flex-col justify-center space-y-8 text-left pr-0 lg:pr-6",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx("img",{src:"/app-icon.png",alt:"",width:32,height:32,className:"rounded-md shadow-md border border-oai-gray-200/50 dark:border-oai-gray-800 shadow-black/10 dark:shadow-black/30"}),o.jsx("span",{className:"text-xl font-bold tracking-tight bg-gradient-to-r from-oai-black to-oai-gray-600 dark:from-white dark:to-oai-gray-400 bg-clip-text text-transparent font-oai",children:r("shared.app_name")})]}),o.jsxs("div",{className:"space-y-5",children:[o.jsxs("div",{className:"space-y-4",children:[o.jsx("h1",{className:"text-3xl md:text-4xl lg:text-4.5xl font-black tracking-tight leading-[1.15] text-oai-black dark:text-white",children:e}),o.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm md:text-base max-w-xl leading-relaxed",children:n})]}),o.jsx("div",{className:"w-full max-w-[280px] sm:max-w-md opacity-85 hover:opacity-100 transition-opacity duration-200",children:o.jsx("div",{className:"flex justify-start",children:o.jsx(bc,{logos:ny,columnCount:6})})})]})]}),o.jsx("div",{className:"lg:col-span-5 flex justify-center",children:o.jsxs(Fe.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.3},className:"w-full max-w-[400px] rounded-2xl border border-oai-gray-200/80 dark:border-oai-gray-800 bg-white/70 dark:bg-oai-gray-950/40 backdrop-blur-md shadow-2xl p-1 relative overflow-hidden",children:[o.jsx("div",{className:"absolute -inset-px bg-gradient-to-b from-white/10 dark:from-white/5 to-transparent pointer-events-none rounded-2xl"}),a]})})]})]})}function sy(e){const{copy:t,onOpenShare:n,screenshotMode:a,showExpiredGate:r,showAuthGate:s,identityDisplayName:i,identityStartDate:l,activeDays:c,identitySubscriptions:d,identityScrambleDurationMs:u,projectUsageEntries:f,projectUsageLimit:h,setProjectUsageLimit:y,topModels:p,signedIn:x,publicMode:k,isLocalMode:w,shouldShowInstall:b,installPrompt:_,handleCopyInstall:v,installCopied:j,installInitCmdDisplay:N,trendRowsForDisplay:E,trendFromForDisplay:M,trendToForDisplay:T,trendZoomConfig:O,usageFrom:$,usageTo:V,period:C,trendTimeZoneLabel:A,activityHeatmapBlock:I,periodsForDisplay:D,setSelectedPeriod:Y,customFrom:U,customTo:W,onCustomRangeApply:ee,customRangeOpen:ie,onCustomRangeOpenChange:z,summaryLabel:J,summaryValue:de,summaryFullValue:me,onToggleSummaryFormat:F,summaryTotalTokensRaw:H,summaryCostValue:L,summaryConversationsValue:re,rollingUsage:X,costInfoEnabled:Q,openCostModal:se,costModalOpen:G,closeCostModal:le,allowBreakdownToggle:be,refreshAll:_e,usageLoadingState:he,initialDashboardLoading:ce,fleetData:ge,hasDetailsActual:Oe,dailyEmptyPrefix:De,installSyncCmd:Re,dailyEmptySuffix:He,detailsColumns:Be,ariaSortFor:mt,toggleSort:Me,sortIconFor:Ce,pagedDetails:Ye,dailyBreakdownRows:Xe,dailyBreakdownColumns:Tt,dailyBreakdownAriaSortFor:vt,dailyBreakdownSortIconFor:Qe,dailyBreakdownDateKey:sn,detailsDateKey:ot,renderDetailDate:ln,renderDailyBreakdownDate:cn,renderDetailCell:ht,DETAILS_PAGED_PERIODS:ue,detailsPageCount:Z,detailsPage:te,setDetailsPage:R,deviceOptions:ne,selectedDevice:je,onDeviceChange:ae,deviceUsageBlock:Ht,leftCardOrder:gt,onLeftReorder:Ut,rightCardOrder:Pt,onRightReorder:yt}=e,dn=null,oa=null,[qt,un]=m.useState(()=>new Set),sa=m.useCallback((fe,ve)=>{oy.has(fe)&&un(Pe=>{if(Pe.has(fe)===ve)return Pe;const _t=new Set(Pe);return ve?_t.add(fe):_t.delete(fe),_t})},[]),Ot={macAppBanner:w,statsPanel:!0,widgetOnboarding:w,installCopy:b,activityHeatmap:!!I,deviceUsage:!!Ht,trendMonitor:!a,qualityPerDollar:!a},jn=(gt||[]).filter(fe=>Ot[fe]&&!qt.has(fe)),st={usageOverview:!0,dataDetails:!a},We=(Pt||[]).filter(fe=>st[fe]&&!qt.has(fe));function ia(fe,ve){switch(fe){case"macAppBanner":return o.jsx(q0,{todayTokens:H,isSyncing:he,enterDelay:ve});case"statsPanel":return o.jsx(Et,{delay:ve,children:o.jsx(Md,{title:t("dashboard.identity.title"),subtitle:t("dashboard.identity.subtitle"),period:C,rankLabel:l??t("identity_card.rank_placeholder"),streakDays:c,subscriptions:d,periodConversations:re,rolling:X,topModels:p})});case"widgetOnboarding":return o.jsx(G0,{enterDelay:ve});case"installCopy":return o.jsx(Et,{delay:ve,children:o.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-3",children:[o.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-300 mb-1.5",children:_}),o.jsxs(Fe.button,{onClick:v,whileHover:{scale:1.01},whileTap:{scale:.99},className:"w-full flex items-center justify-between px-3 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 rounded-lg transition-colors",children:[o.jsx("code",{className:"text-xs font-mono text-oai-gray-700 dark:text-oai-gray-300",children:N}),o.jsx(Fe.span,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"text-xs text-oai-brand",children:j?"Copied ✓":"Copy"},j?"copied":"copy")]})]})});case"activityHeatmap":return o.jsx(Et,{delay:ve,children:I});case"deviceUsage":return o.jsx(Et,{delay:ve,children:Ht});case"trendMonitor":return o.jsx(Et,{delay:ve,children:o.jsx(Us,{rows:E,from:M,to:T,period:C,timeZoneLabel:A,showTimeZoneLabel:!1,zoomConfig:O})});case"qualityPerDollar":return o.jsx(Z0,{from:$,to:V,deviceId:je});default:return null}}function Sn(fe,ve){switch(fe){case"usageOverview":return o.jsx(Et,{delay:ve,children:o.jsx(g0,{period:C,periods:D,onPeriodChange:Y,summaryLabel:J,summaryValue:de,summaryFullValue:me,onToggleSummaryFormat:F,summaryCostValue:L,onCostInfo:Q?se:null,fleetData:ge,onRefresh:a?null:_e,loading:he,onOpenShare:a?null:n,customFrom:U,customTo:W,onCustomRangeApply:ee,customRangeOpen:ie,onCustomRangeOpenChange:z,from:$,to:V,deviceOptions:ne,selectedDevice:je,onDeviceChange:ae})});case"dataDetails":return o.jsx(Et,{delay:ve,children:o.jsx(jd,{projectEntries:f,projectLimit:h,onProjectLimitChange:y,copy:t,hasDetailsActual:Oe,dailyEmptyPrefix:De,installSyncCmd:Re,dailyEmptySuffix:He,detailsColumns:Be,ariaSortFor:mt,toggleSort:Me,sortIconFor:Ce,pagedDetails:Ye,dailyBreakdownRows:Xe,dailyBreakdownColumns:Tt,dailyBreakdownAriaSortFor:vt,dailyBreakdownSortIconFor:Qe,dailyBreakdownDateKey:sn,detailsDateKey:ot,renderDetailDate:ln,renderDailyBreakdownDate:cn,renderDetailCell:ht,DETAILS_PAGED_PERIODS:ue,period:C,detailsPageCount:Z,detailsPage:te,setDetailsPage:R})});default:return null}}const la=Ql(Hr(ac,{activationConstraint:{distance:6}}),Hr(nc,{coordinateGetter:tc})),ca=m.useCallback(fe=>{const{active:ve,over:Pe}=fe;!Pe||ve.id===Pe.id||Ut?.(String(ve.id),String(Pe.id))},[Ut]),Mn=m.useCallback(fe=>{const{active:ve,over:Pe}=fe;!Pe||ve.id===Pe.id||yt?.(String(ve.id),String(Pe.id))},[yt]);function fn(fe,ve,Pe,_t){return a?o.jsx(o.Fragment,{children:fe.map((Nt,mn)=>o.jsx(P.Fragment,{children:ve(Nt,Pe+$o*mn)},Nt))}):o.jsx(Jl,{sensors:la,onDragEnd:_t,children:o.jsx(Zl,{items:fe,strategy:ec,children:fe.map((Nt,mn)=>o.jsx(L0,{id:Nt,onEmptyChange:sa,children:ve(Nt,Pe+$o*mn)},Nt))})})}const da=fn(jn,ia,ay,ca),Cn=fn(We,Sn,ry,Mn);return o.jsxs(o.Fragment,{children:[o.jsxs(Oc,{bare:!a,hideHeader:a,header:dn,footer:a?null:oa,className:a?"screenshot-mode":"",children:[s&&o.jsx(Ao,{title:t("dashboard.auth_gate.hero_title"),desc:t("dashboard.auth_gate.desc"),copy:t,loginCard:o.jsx(Lr,{title:t("dashboard.auth_gate.title"),subtitle:t("dashboard.auth_gate.subtitle"),hideLogo:!0,className:"bg-transparent rounded-xl"})}),r&&o.jsx(Ao,{title:t("dashboard.expired_gate.hero_title"),desc:t("dashboard.expired_gate.desc"),copy:t,loginCard:o.jsx(Lr,{title:t("dashboard.expired_gate.title"),subtitle:t("dashboard.expired_gate.subtitle"),hideLogo:!0,className:"bg-transparent rounded-xl"})}),!s&&!r&&ce&&o.jsx(ty,{}),!s&&!r&&!ce&&o.jsx(o.Fragment,{children:o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-4",children:[o.jsx("div",{className:"lg:col-span-4 flex flex-col gap-4 min-w-0 order-2 lg:order-1",children:da}),o.jsx("div",{className:"lg:col-span-8 flex flex-col gap-4 min-w-0 order-1 lg:order-2",children:Cn})]})})]}),o.jsx(Nd,{isOpen:G,onClose:le,fleetData:ge})]})}function iy({from:e,to:t,timeZone:n,tzOffsetMinutes:a,accountView:r=!1,accountAccessToken:s=null,accountRevision:i=0}={}){const l=!!(r&&s),[c,d]=m.useState([]),[u,f]=m.useState(!1),[h,y]=m.useState(null),p=m.useCallback(async()=>{if(!l){d([]),f(!1),y(null);return}f(!0),y(null);try{const x=await ze(s),k=await El({from:e,to:t,timeZone:n,tzOffsetMinutes:a,accessToken:x});d(Array.isArray(k?.devices)?k.devices:[])}catch(x){y(x?.message||String(x)),d([])}finally{f(!1)}},[l,s,e,t,n,a,i]);return m.useEffect(()=>{p()},[p]),{devices:c,loading:u,error:h,refresh:p}}const ly=/^Token Tracker \(dashboard\)(?: #([0-9a-fA-F]+))?$/;function Fo(e){const t=String(e||"").toLowerCase();return/iphone|ipad|ios/.test(t)?"iOS":/android/.test(t)?"Android":/mac|darwin/.test(t)?"Mac":/win/.test(t)?"Windows":/linux/.test(t)?"Linux":"Web"}function Qa(e){if(!e)return null;const t=typeof e.device_name=="string"?e.device_name.trim():"",n=t.match(ly);if(!n)return t||null;const a=(n[1]||String(e.id||"")).slice(0,8).toLowerCase();return a?`${Fo(e.platform)} · ${a}`:Fo(e.platform)}const cy=" · ",dy="%";function Io({platform:e,className:t}){const n=String(e||"").toLowerCase();return n.includes("darwin")||n.includes("mac")?o.jsx(Mc,{className:t,"aria-hidden":!0}):n.includes("win")?o.jsx(Rr,{className:t,"aria-hidden":!0}):n.includes("linux")?o.jsx(Rr,{className:t,"aria-hidden":!0}):o.jsx(es,{className:t,"aria-hidden":!0})}function uy({devices:e=[],selectedDeviceId:t="",onSelectDevice:n,onRenameDevice:a}){const[r,s]=m.useState(""),[i,l]=m.useState(""),[c,d]=m.useState(!1),[u,f]=m.useState(""),h=typeof a=="function",y=typeof n=="function",p=!!t,x=e.reduce((v,j)=>v+(Number(j.total_tokens)||0),0),k=m.useMemo(()=>[...e].sort((v,j)=>(Number(j.total_tokens)||0)-(Number(v.total_tokens)||0)),[e]);function w(v){f(""),s(v.id);const j=typeof v.device_name=="string"?v.device_name:"";l(Qa(v)===j?j:"")}function b(){s(""),l(""),f("")}async function _(v){const j=i.trim();if(!(!j||c)){d(!0),f("");try{await a(v.id,j),s(""),l("")}catch{f(v.id)}finally{d(!1)}}}return e.length===0?o.jsxs(et,{bodyClassName:"!px-3 !py-3.5",children:[o.jsx("div",{className:"flex items-center justify-between gap-2 mb-2 px-2",children:o.jsx("div",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide px-2",children:g("dashboard.device_card.title")})}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-6 text-center",children:[o.jsx(es,{className:"h-7 w-7 text-oai-gray-300 dark:text-oai-gray-600 mb-2 stroke-[1.5]"}),o.jsx("p",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 font-medium",children:g("dashboard.device_card.empty")})]})]}):o.jsxs(et,{bodyClassName:"!px-3 !py-3.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2 px-2",children:[o.jsx("div",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:g("dashboard.device_card.title")}),y&&p&&o.jsx("button",{type:"button",onClick:()=>n(""),className:"text-xs text-oai-gray-400 hover:text-oai-brand focus:outline-none transition-colors",children:g("dashboard.device_card.clear")})]}),o.jsx("div",{className:"space-y-[2px]",children:k.map(v=>{const j=Number(v.total_tokens)||0,N=x>0?(j/x*100).toFixed(1):"0.0",E=t===v.id,M=Qa(v)||g("dashboard.device_card.unnamed"),T=r===v.id,O=E?"bg-oai-brand":p?"bg-oai-gray-300 dark:bg-oai-gray-600":"bg-oai-brand/50",$=p&&!E?"opacity-40 hover:opacity-80":"opacity-100";return o.jsxs("div",{className:"group relative",children:[T?o.jsxs("div",{className:"w-full rounded-md px-2 py-1.5 bg-oai-gray-50/50 dark:bg-oai-gray-900/40",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[o.jsx(Io,{platform:v.platform,className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400"}),o.jsx("input",{autoFocus:!0,value:i,disabled:c,maxLength:60,placeholder:g("dashboard.device_card.rename_placeholder"),onChange:V=>l(V.target.value),onKeyDown:V=>{V.key==="Enter"?_(v):V.key==="Escape"&&b()},className:"flex-1 min-w-0 bg-transparent text-xs font-medium text-oai-black dark:text-oai-white border-b border-oai-gray-300 dark:border-oai-gray-700 focus:outline-none focus:border-oai-brand py-0"})]}),o.jsxs("div",{className:"shrink-0 flex items-center gap-0.5",children:[o.jsx("button",{type:"button","aria-label":g("dashboard.device_card.rename_save"),disabled:c||!i.trim(),onClick:()=>_(v),className:"text-oai-gray-400 hover:text-oai-brand dark:hover:text-white disabled:opacity-30 transition-colors p-0.5",children:o.jsx(_c,{className:"h-3.5 w-3.5"})}),o.jsx("button",{type:"button","aria-label":g("dashboard.device_card.rename_cancel"),disabled:c,onClick:b,className:"text-oai-gray-400 hover:text-oai-black dark:hover:text-white disabled:opacity-30 transition-colors p-0.5",children:o.jsx(or,{className:"h-3.5 w-3.5"})})]})]}),o.jsx("div",{className:"mt-1.5 h-[2px] bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden opacity-40 select-none",children:o.jsx("div",{className:`h-full rounded-full transition-[width,background-color] duration-700 ease-out ${O}`,style:{width:`${N}%`}})})]}):o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button","aria-pressed":E,"aria-label":`${g("dashboard.device_filter.aria")}: ${M}`,onClick:()=>n?.(E?"":v.id),className:`w-full text-left rounded-md px-2 py-1.5 transition-all duration-200 focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-oai-brand/50 ${$} ${E?"bg-oai-gray-100/70 dark:bg-oai-gray-800/80 text-oai-black dark:text-oai-white":"bg-transparent hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 text-oai-black dark:text-oai-white"}`,children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[o.jsx(Io,{platform:v.platform,className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400"}),o.jsx("span",{className:"block truncate text-[13px] font-medium text-oai-black dark:text-oai-white",title:M,children:M})]}),o.jsxs("span",{className:`shrink-0 text-[13px] font-semibold tabular-nums text-oai-black dark:text-oai-white transition-opacity duration-150 ${h?"group-hover:opacity-0":""}`,children:[Ae(j),o.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500 font-normal",children:[cy,N,dy]})]})]}),o.jsx("div",{className:"mt-1.5 h-[2px] bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden",children:o.jsx("div",{className:`h-full rounded-full transition-[width,background-color] duration-700 ease-out ${O}`,style:{width:`${N}%`}})})]}),h&&o.jsx("button",{type:"button","aria-label":g("dashboard.device_card.rename_aria"),onClick:()=>w(v),className:"absolute right-2 top-1.5 flex h-4 items-center text-oai-gray-400 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 hover:text-oai-brand focus:outline-none transition-opacity duration-150",children:o.jsx(vc,{className:"h-3 w-3"})})]}),u===v.id&&o.jsx("div",{className:"px-2 mt-1 text-xs text-red-500 font-medium",children:g("dashboard.device_card.rename_error")})]},v.id)})})]})}function Gs(){return typeof window>"u"?!1:!!window?.webkit?.messageHandlers?.nativeBridge}const Rt=new Map,Bt=new Map;function Ks(){typeof window>"u"||window.__tokentrackerNativeSaveListener||(window.__tokentrackerNativeSaveListener=!0,window.addEventListener("native:saveImageResult",e=>{const t=e?.detail||{},n=typeof t.requestId=="string"?t.requestId:null;if(!n||!Rt.has(n))return;const a=Rt.get(n);Rt.delete(n),a({ok:!!t.ok,path:typeof t.path=="string"?t.path:void 0,error:typeof t.error=="string"?t.error:void 0})}),window.addEventListener("native:copyImageResult",e=>{const t=e?.detail||{},n=typeof t.requestId=="string"?t.requestId:null;if(!n||!Bt.has(n))return;const a=Bt.get(n);Bt.delete(n),a({ok:!!t.ok,error:typeof t.error=="string"?t.error:void 0})}))}async function fy(e){if(!Gs()||typeof window>"u")return{ok:!1,error:"native bridge unavailable"};const t=window?.webkit?.messageHandlers?.nativeBridge;if(!t)return{ok:!1,error:"native bridge unavailable"};Ks();const n=`copy_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return new Promise(a=>{const r=window.setTimeout(()=>{Bt.has(n)&&(Bt.delete(n),a({ok:!1,error:"timeout"}))},8e3);Bt.set(n,s=>{window.clearTimeout(r),a(s)});try{t.postMessage({type:"action",name:"copyImageToClipboard",requestId:n,dataUrl:e})}catch(s){Bt.delete(n),window.clearTimeout(r),a({ok:!1,error:s?.message||String(s)})}})}async function Lo(e,t){if(!Gs()||typeof window>"u")return{ok:!1,error:"native bridge unavailable"};const n=window?.webkit?.messageHandlers?.nativeBridge;if(!n)return{ok:!1,error:"native bridge unavailable"};Ks();const a=`save_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return new Promise(r=>{const s=window.setTimeout(()=>{Rt.has(a)&&(Rt.delete(a),r({ok:!1,error:"timeout"}))},8e3);Rt.set(a,i=>{window.clearTimeout(s),r(i)});try{n.postMessage({type:"action",name:"saveImageToDownloads",requestId:a,filename:t,dataUrl:e})}catch(i){Rt.delete(a),window.clearTimeout(s),r({ok:!1,error:i?.message||String(i)})}})}const Xs=1200,Qs=1630,Js={broadsheet:{width:1200,height:1630},"annual-report":{width:1080,height:1865}},my="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter+Tight:wght@400;500;600;700&family=IBM+Plex+Serif:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Mono:wght@400;500&family=Space+Grotesk:wght@500;600;700&display=swap";let $a=!1;function hy(){if(typeof document>"u"||$a)return;if(document.querySelector('link[data-share-card-fonts="true"]')){$a=!0;return}const t=document.createElement("link");t.rel="stylesheet",t.href=my,t.dataset.shareCardFonts="true",t.crossOrigin="anonymous",document.head.appendChild(t),$a=!0}async function gy(){if(typeof document>"u")return;const e=document.fonts;if(!(!e||typeof e.ready?.then!="function"))try{await e.ready}catch{}}async function yy(e,t={}){if(typeof window>"u"||!e)return null;hy(),await gy(),await new Promise(c=>requestAnimationFrame(()=>c(null)));const{toBlob:n,toPng:a}=await $l(async()=>{const{toBlob:c,toPng:d}=await import("./index-BFIcLxb4.js");return{toBlob:c,toPng:d}},[]),r=t.pixelRatio??2,s=e.offsetWidth||Xs,i=e.offsetHeight||Qs,l={pixelRatio:r,cacheBust:!0,width:s,height:i,style:{width:`${s}px`,height:`${i}px`},skipFonts:!1,filter:c=>!(c instanceof HTMLElement)||c.dataset?.screenshotExclude!=="true"};try{const c=await n(e,l);if(c)return c}catch{}try{const c=await a(e,l);return c?await(await fetch(c)).blob():null}catch{return null}}async function Aa(e){return new Promise(t=>{const n=new FileReader;n.onload=()=>{const a=typeof n.result=="string"?n.result:null;t(a)},n.onerror=()=>t(null),n.readAsDataURL(e)})}function Ro(e,t){if(typeof window>"u"||!e)return!1;try{const n=URL.createObjectURL(e),a=document.createElement("a");return a.href=n,a.download=t,document.body.appendChild(a),a.click(),a.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e3),!0}catch{return!1}}function Ja(e){const t=$e(e);return Number.isFinite(t)?t:0}function py(e){return e?Ja(e.billable_total_tokens??e.total_tokens):0}function by(e){const t=Array.isArray(e?.weeks)?e.weeks:[];if(!t.length)return{weeks:[],totalDays:0,activeDays:0};let n=0,a=0;return{weeks:t.map(s=>(Array.isArray(s)?s:[]).slice(0,7).map(l=>{const c=!!l?.future,d=Number.isFinite(l?.level)?Math.max(0,Math.min(4,Math.round(l.level))):0;l?.day&&!c&&(n+=1,d>0&&(a+=1));const u=l?.billable_total_tokens??l?.total_tokens??l?.value??0,f=Number.isFinite(u)?Math.max(0,u):0;return{day:typeof l?.day=="string"?l.day:"",level:d,value:f,future:c}})),totalDays:n,activeDays:a}}function xy(e){const{handle:t,startDate:n,activeDays:a,summary:r,topModels:s,rank:i,period:l,periodFrom:c,periodTo:d,heatmap:u,capturedAt:f,currency:h,exchangeRate:y}=e,p=py(r),x=Ja(r?.total_cost_usd),k=Array.isArray(s)?s.slice(0,3).map(b=>({id:b?.id??null,name:typeof b?.name=="string"&&b.name?b.name:"—",tokens:Ja(b?.tokens),percent:typeof b?.percent=="string"&&b.percent?b.percent:"0.0"})):[],w=by(u);return{handle:t||"—",startDate:n||null,activeDays:Number.isFinite(a)&&a>0?Math.floor(a):0,totalTokens:p,totalCost:x,period:l,periodFrom:c,periodTo:d,topModels:k,rank:typeof i=="number"&&Number.isFinite(i)&&i>0?Math.floor(i):null,heatmapWeeks:w.weeks,heatmapTotalDays:w.totalDays,heatmapActiveDays:w.activeDays,capturedAt:f||new Date().toISOString(),currency:typeof h=="string"&&h.length>0?h.toUpperCase():"USD",exchangeRate:Number.isFinite(y)&&y>0?y:1}}const ky=["share.month_short.jan","share.month_short.feb","share.month_short.mar","share.month_short.apr","share.month_short.may","share.month_short.jun","share.month_short.jul","share.month_short.aug","share.month_short.sep","share.month_short.oct","share.month_short.nov","share.month_short.dec"];function wy(e){const t=ky[e];return t?g(t):"—"}function Zs(e,t){return g("share.date.month_year",{month:wy(e),year:t})}function vy(e){if(!e)return"—";const t=e.split("-");if(t.length!==3)return e;const[n,a]=t,r=Number(a)-1;return r<0||r>11?e:Zs(r,n)}function _y(e){if(e.period==="total")return g("share.issue.all_time");if(e.period==="day"&&e.periodTo)return e.periodTo.replace(/-/g,".");if(e.period==="custom"&&e.periodFrom&&e.periodTo)return`${e.periodFrom.replace(/-/g,".")} — ${e.periodTo.replace(/-/g,".")}`;if(e.periodTo){const t=new Date(`${e.periodTo}T00:00:00Z`);if(!Number.isNaN(t.getTime()))return Zs(t.getUTCMonth(),t.getUTCFullYear())}return g(`usage.period.${e.period}`)}function Za(e){return Number.isFinite(e)?Math.round(e).toLocaleString("en-US"):"—"}function ei(e,t={}){const{currency:n="USD",rate:a=1}=t,r=ta(n);if(!Number.isFinite(e)||e<=0)return`${r}0.00`;const s=n!=="USD"&&Number.isFinite(a)&&a>0?e*a:e;return s>=1e3?`${r}${Math.round(s).toLocaleString("en-US")}`:`${r}${s.toFixed(2)}`}function Ny(e){const t=e.topModels[0];if(t){const n=parseFloat(t.percent);return Number.isFinite(n)&&n>=60?g("share.hook.top_loyal",{percent:Math.round(n),name:t.name}):e.activeDays>=60?g("share.hook.days_record",{days:e.activeDays}):Number.isFinite(n)&&n>=30?g("share.hook.top_led",{name:t.name,percent:Math.round(n)}):e.topModels.length>1?g("share.hook.multi_models",{count:e.topModels.length,days:e.activeDays}):g("share.hook.days_with_model",{days:e.activeDays,name:t.name})}return e.activeDays>0?g("share.hook.days_record",{days:e.activeDays}):g("share.hook.new_chapter")}function jy(e,t){const n=(e||"").length;if(n<=t.baseChars)return t.baseSize;const a=t.baseSize-(n-t.baseChars)*t.shrinkPerChar;return Math.max(t.minSize,a)}function Sy(e){if(!e||e.future)return null;const t=typeof e.level=="number"?e.level:0;return t<0?0:t>4?4:Math.round(t)}function My({weeks:e,palette:t,width:n,gap:a=3,radius:r=2,emptyColor:s}){if(!Array.isArray(e)||e.length===0||!n||n<=0)return null;const i=t||["#eee","#ccc","#999","#666","#333"],l=s||i[0],c=e.length,d=(c-1)*a,u=Math.max(4,(n-d)/c),f=7*u+6*a;return o.jsx("svg",{width:n,height:f,viewBox:`0 0 ${n} ${f}`,xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,style:{display:"block"},children:e.map((h,y)=>(Array.isArray(h)?h:[]).map((x,k)=>{if(k>=7)return null;const w=Sy(x),b=y*(u+a),_=k*(u+a),v=w===null?l:i[w];return o.jsx("rect",{x:b,y:_,width:u,height:u,rx:r,ry:r,fill:v},`${y}-${k}`)}))})}const Cy=on("oklch(0.97 0.01 85)"),Ve=on("oklch(0.18 0.02 85)"),St=on("oklch(0.38 0.015 85)"),Bo=on("oklch(0.55 0.012 85)"),$t=on("oklch(0.55 0.22 25)"),At='"Instrument Serif", "Times New Roman", Georgia, serif',Dy='"Inter Tight", "Helvetica Neue", Arial, sans-serif',Ty=["oklch(0.93 0.013 80)","oklch(0.87 0.04 55)","oklch(0.78 0.09 45)","oklch(0.67 0.16 35)","oklch(0.55 0.22 25)"].map(on);function ti({data:e}){const t=_y(e),n=Za(e.totalTokens),a=ei(e.totalCost,{currency:e.currency,rate:e.exchangeRate}),r=vy(e.startDate),s=jy(n,{baseSize:188,baseChars:9,shrinkPerChar:14,minSize:104}),i=Ny(e),l=Array.isArray(e.heatmapWeeks)&&e.heatmapWeeks.length>0;return o.jsxs("div",{style:{width:"100%",height:"100%",background:Cy,color:Ve,fontFamily:Dy,padding:"80px 88px 68px 88px",boxSizing:"border-box",display:"flex",flexDirection:"column",position:"relative"},children:[o.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:24,paddingBottom:14,borderBottom:`1px solid ${Bo}`},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,fontSize:14,fontWeight:500,letterSpacing:"0.22em",textTransform:"uppercase",color:Ve},children:[o.jsx("div",{style:{width:10,height:10,borderRadius:"50%",background:$t}}),"The Token Tracker"]}),o.jsxs("div",{style:{fontSize:12,letterSpacing:"0.22em",textTransform:"uppercase",color:St,textAlign:"right"},children:[g("share.card.broadsheet.issue")," № ",t]})]}),o.jsxs("div",{style:{marginTop:24,display:"flex",justifyContent:"space-between",alignItems:"flex-end",gap:24},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:12,letterSpacing:"0.2em",textTransform:"uppercase",color:St,marginBottom:6},children:g("share.card.broadsheet.by")}),o.jsx("div",{style:{fontFamily:At,fontSize:52,fontStyle:"italic",lineHeight:1,color:Ve,letterSpacing:"-0.01em"},children:e.handle})]}),o.jsxs("div",{style:{fontSize:12,letterSpacing:"0.18em",textTransform:"uppercase",color:St,textAlign:"right",lineHeight:1.6},children:[g("share.card.broadsheet.tracked_since"),o.jsx("br",{}),o.jsx("span",{style:{color:Ve},children:r})]})]}),o.jsxs("div",{style:{marginTop:40,display:"flex",flexDirection:"column"},children:[o.jsx("div",{style:{fontSize:13,letterSpacing:"0.3em",textTransform:"uppercase",color:$t,marginBottom:10},children:g("share.card.broadsheet.total_tokens")}),o.jsx("div",{style:{fontFamily:At,fontSize:s,fontWeight:400,lineHeight:.86,letterSpacing:"-0.032em",color:Ve,fontFeatureSettings:'"lnum" 1, "tnum" 1',whiteSpace:"nowrap",overflow:"hidden"},children:n}),o.jsxs("div",{style:{marginTop:14,fontFamily:At,fontStyle:"italic",fontSize:34,lineHeight:1.15,color:Ve,letterSpacing:"-0.005em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:["“",i,"”"]}),o.jsx("div",{style:{marginTop:14,height:1,background:$t,width:"100%"}}),o.jsxs("div",{style:{marginTop:10,display:"flex",justifyContent:"space-between",fontSize:13,letterSpacing:"0.16em",textTransform:"uppercase",color:St},children:[o.jsxs("span",{children:[g("share.card.broadsheet.estimated_spend")," · ",a]}),o.jsx("span",{children:g("share.card.broadsheet.billable_days",{days:e.activeDays})})]})]}),l?o.jsxs("section",{style:{marginTop:40},children:[o.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",marginBottom:12},children:[o.jsx("div",{style:{fontSize:12,letterSpacing:"0.3em",textTransform:"uppercase",color:Ve,fontWeight:600},children:g("share.card.broadsheet.heatmap_title")}),o.jsx("div",{style:{fontSize:11,letterSpacing:"0.18em",textTransform:"uppercase",color:St},children:g("share.card.broadsheet.heatmap_days_on_record",{active:e.heatmapActiveDays,total:e.heatmapTotalDays})})]}),o.jsx(My,{weeks:e.heatmapWeeks,palette:Ty,width:1024,gap:3,radius:2})]}):null,o.jsxs("section",{style:{marginTop:30,flex:1},children:[o.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",borderBottom:`1px solid ${Ve}`,paddingBottom:10,marginBottom:6},children:[o.jsx("div",{style:{fontSize:12,letterSpacing:"0.3em",textTransform:"uppercase",color:Ve,fontWeight:600},children:g("share.card.broadsheet.roster_title")}),o.jsx("div",{style:{fontSize:11,letterSpacing:"0.18em",textTransform:"uppercase",color:St},children:g("share.card.broadsheet.roster_subtitle")})]}),e.topModels.length===0?o.jsx("div",{style:{fontFamily:At,fontStyle:"italic",fontSize:26,color:St,paddingTop:14},children:g("share.card.broadsheet.empty")}):e.topModels.map((c,d)=>o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"52px 1fr auto 68px",alignItems:"baseline",gap:16,padding:"13px 0",borderBottom:`1px solid ${Bo}`},children:[o.jsx("div",{style:{fontFamily:At,fontSize:34,fontStyle:"italic",color:$t,lineHeight:1},children:String(d+1).padStart(2,"0")}),o.jsx("div",{style:{fontFamily:At,fontSize:32,color:Ve,lineHeight:1.1,letterSpacing:"-0.01em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:c.name}),o.jsx("div",{style:{fontFamily:At,fontSize:28,color:Ve,fontFeatureSettings:'"lnum" 1, "tnum" 1',whiteSpace:"nowrap"},children:Za(c.tokens)}),o.jsxs("div",{style:{fontSize:13,letterSpacing:"0.1em",color:St,textAlign:"right",fontFeatureSettings:'"tnum" 1'},children:[c.percent,"%"]})]},c.id||c.name))]}),o.jsxs("footer",{style:{marginTop:18,paddingTop:12,borderTop:`1px solid ${Ve}`,display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:12,letterSpacing:"0.22em",textTransform:"uppercase",color:Ve},children:[o.jsxs("div",{style:{display:"flex",gap:28},children:[o.jsxs("span",{children:[g("share.card.broadsheet.global_rank")," ",o.jsxs("span",{style:{color:$t},children:["№ ",e.rank!=null?e.rank:"—"]})]}),o.jsxs("span",{children:[g("share.card.broadsheet.active_days")," ",o.jsx("span",{style:{color:$t},children:g("share.card.broadsheet.days_count",{days:e.activeDays})})]})]}),o.jsxs("div",{children:[g("share.card.broadsheet.track_yours")," ",o.jsx("span",{style:{color:$t},children:"→ tokentracker.cc"})]})]})]})}const Py=Js["annual-report"].width,Oy="#0a0820",Mt="#ffffffee",It="rgba(255,255,255,0.45)",Fa="#a78bfa",Wy={background:"rgba(20,15,50,0.38)",backdropFilter:"blur(40px)",WebkitBackdropFilter:"blur(40px)",border:"1px solid rgba(255,255,255,0.05)",boxShadow:["0 39px 56px -36px rgba(255,255,255,0.10) inset","0 7px 11px -4px rgba(255,255,255,0.06) inset","0 -82px 68px -64px rgba(101,67,149,0.08) inset","0 98px 100px -48px rgba(208,171,255,0.06) inset","0 4px 18px 0 rgba(156,146,215,0.06) inset","0 1px 40px 0 rgba(228,222,255,0.04) inset"].join(", ")},zn={background:"rgba(20,15,50,0.38)",backdropFilter:"blur(32px)",WebkitBackdropFilter:"blur(32px)",border:"1px solid rgba(255,255,255,0.06)",boxShadow:"0 1px 8px 0 rgba(228,222,255,0.06) inset"},er='"Space Grotesk", "Inter Tight", sans-serif',Ia='"Inter Tight", sans-serif',Ey="rgba(255,255,255,0.06)",ni=[Ey,"#4a3d8f","#6b5cbe","#9060e0","#d946ef"],ai=48,ri=28,Qn=4,oi=20,$y=Py-ai*2-ri*2,Ay=($y-oi*2)/3,tr=Math.min(Math.floor((Ay-Qn*6)/7),40),Fy=tr*7+Qn*6;function Iy(e){if(!Array.isArray(e))return e;const t=[];for(const l of e)if(Array.isArray(l))for(const c of l)c?.day&&!c.future&&c.value>0&&t.push(c.value);if(!t.length)return e;t.sort((l,c)=>l-c);const n=l=>{const c=t.length,d=(c-1)*l,u=Math.floor(d);return Math.round((t[u]??0)+((t[Math.min(c-1,u+1)]??0)-(t[u]??0))*(d-u))},a=n(.5),r=n(.75),s=n(.9),i=l=>!l||l<=0?0:l<=a?1:l<=r?2:l<=s?3:4;return e.map(l=>Array.isArray(l)?l.map(c=>c?.day&&!c.future&&typeof c.value=="number"?{...c,level:i(c.value)}:c):l)}function Ly(e){if(!Array.isArray(e))return[];const t={},n=Iy(e);for(const a of n)if(Array.isArray(a))for(const r of a){if(!r?.day||r.future)continue;const s=r.day.split("-");if(s.length<2)continue;const i=`${s[0]}-${s[1]}`;(t[i]??=[]).push(r)}return Object.entries(t).sort(([a],[r])=>a.localeCompare(r)).slice(-12).map(([a,r])=>({month:parseInt(a.split("-")[1],10),cells:r}))}function Ry(e){if(!e.length)return[];const t=[...e].sort((i,l)=>i.day.localeCompare(l.day));let n=new Date(`${t[0].day}T00:00:00Z`).getUTCDay();const a=Array(n).fill(null).concat(t),r=[];for(let i=0;i<a.length;i+=7)r.push(a.slice(i,i+7));const s=r[r.length-1];for(;s&&s.length<7;)s.push(null);return r.slice(0,6)}const By=["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Yy(e){if(!Array.isArray(e))return 0;const t=[];for(const r of e)if(Array.isArray(r))for(const s of r)s?.day&&!s.future&&t.push(s);t.sort((r,s)=>r.day.localeCompare(s.day));let n=0,a=0;for(const r of t)(r.level||0)>0?(a++,a>n&&(n=a)):a=0;return n}function Yo(e){const[t,n]=m.useState(null);return m.useEffect(()=>{if(!e){n(null);return}let a=!1;const r=new Image;return r.crossOrigin="anonymous",r.onload=()=>{if(!a)try{const s=document.createElement("canvas");s.width=r.naturalWidth,s.height=r.naturalHeight,s.getContext("2d").drawImage(r,0,0),n(s.toDataURL("image/png"))}catch{n(null)}},r.onerror=()=>{a||n(null)},r.src=e,()=>{a=!0}},[e]),t}function zy({data:e}){const t=Ry(e.cells);return o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:16,fontWeight:600,color:It,fontFamily:er,marginBottom:4},children:By[e.month]}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:Qn},children:t.map((n,a)=>o.jsx("div",{style:{display:"flex",gap:Qn},children:n.map((r,s)=>{const i=r?Math.min(4,Math.max(0,r.level||0)):-1;return o.jsx("div",{style:{width:tr,height:tr,borderRadius:4,background:i<0?"transparent":ni[i]}},s)})},a))})]})}function Hy({data:e}){const t=Ly(e.heatmapWeeks),n=Yy(e.heatmapWeeks),a=e.topModels[0],r=e.avatarUrl||null,s=Yo(r),i=Yo("/neon_bg.png"),l=(e.handle||"?")[0].toUpperCase(),c=16;return o.jsxs("div",{style:{width:"100%",height:"100%",background:Oy,fontFamily:er,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:[o.jsx("img",{src:i||"/neon_bg.png",alt:"",style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",pointerEvents:"none"}}),o.jsxs("div",{style:{position:"relative",zIndex:1,display:"flex",flexDirection:"column",height:"100%",padding:ai,boxSizing:"border-box"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:c*3},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[o.jsx("img",{src:"/app-icon.png",alt:"",width:64,height:64,style:{width:64,height:64,borderRadius:16,display:"block"}}),o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:20,fontWeight:500,color:It,lineHeight:1.2},children:"Token Tracker"}),o.jsx("div",{style:{fontSize:36,fontWeight:700,lineHeight:1.15,color:Mt},children:g("share.card.annual.report_title")})]})]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[o.jsx("div",{style:{width:48,height:48,borderRadius:"50%",background:"linear-gradient(135deg,#4c1d95,#7c3aed)",display:"flex",alignItems:"center",justifyContent:"center",border:"2px solid rgba(255,255,255,0.15)",overflow:"hidden",flexShrink:0},children:s?o.jsx("img",{src:s,alt:"",width:48,height:48,style:{width:48,height:48,objectFit:"cover",display:"block"},crossOrigin:"anonymous",referrerPolicy:"no-referrer"}):o.jsx("span",{style:{fontSize:20,fontWeight:700,color:Mt},children:l})}),o.jsx("div",{style:{fontSize:32,fontWeight:700,color:Mt},children:e.handle})]})]}),o.jsxs("div",{style:{...Wy,borderRadius:22,padding:ri,marginBottom:c},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:14,color:It},children:[o.jsx("span",{children:g("share.card.annual.less")}),ni.map((d,u)=>o.jsx("div",{style:{width:16,height:16,borderRadius:3,background:d}},u)),o.jsx("span",{children:g("share.card.annual.more")})]}),o.jsx("div",{style:{fontSize:16,fontWeight:700,letterSpacing:"0.14em",color:"rgba(255,255,255,0.22)",textTransform:"uppercase"},children:g("share.card.annual.heatmap_title")})]}),o.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(3,${Fy}px)`,gap:`8px ${oi}px`,justifyContent:"center"},children:t.map(d=>o.jsx(zy,{data:d},d.month))})]}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:c,marginBottom:c},children:[o.jsxs("div",{style:{...zn,borderRadius:22,padding:"28px 16px",textAlign:"center"},children:[o.jsx("div",{style:{fontFamily:Ia,fontSize:52,fontWeight:700,color:Mt,letterSpacing:"-0.02em",lineHeight:1},children:Za(e.totalTokens)}),o.jsx("div",{style:{fontSize:22,color:It,marginTop:12},children:g("share.card.annual.total_tokens")})]}),o.jsxs("div",{style:{...zn,borderRadius:22,padding:"28px 16px",textAlign:"center"},children:[o.jsx("div",{style:{fontFamily:Ia,fontSize:52,fontWeight:700,color:Mt,letterSpacing:"-0.02em",lineHeight:1},children:ei(e.totalCost,{currency:e.currency,rate:e.exchangeRate})}),o.jsx("div",{style:{fontSize:22,color:It,marginTop:12},children:g("share.card.annual.estimated_cost")})]})]}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:c},children:[o.jsxs("div",{style:{...zn,borderRadius:22,padding:"18px 24px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[o.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:Fa,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48 2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48 2.83-2.83"}),o.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),o.jsx("span",{style:{fontSize:20,color:It},children:g("share.card.annual.longest_streak")})]}),o.jsx("span",{style:{fontFamily:Ia,fontSize:28,fontWeight:700,color:Mt},children:g("share.card.annual.days_count",{days:n})})]}),o.jsxs("div",{style:{...zn,borderRadius:22,padding:"18px 24px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[o.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:Fa,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),o.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),o.jsx("span",{style:{fontSize:20,color:It},children:g("share.card.annual.top_model")})]}),o.jsx("span",{style:{fontFamily:er,fontSize:28,fontWeight:700,color:Mt},children:a?a.name:"—"})]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"auto"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[o.jsx("img",{src:"/app-icon.png",alt:"",width:44,height:44,style:{width:44,height:44,borderRadius:8,display:"block"}}),o.jsx("span",{style:{fontSize:22,fontWeight:600,color:Mt},children:"Token Tracker"})]}),o.jsx("span",{style:{fontSize:22,fontWeight:600,color:Fa},children:"tokentracker.cc"})]})]})]})}const si=[{id:"annual-report",labelKey:"share.variant.neon"},{id:"broadsheet",labelKey:"share.variant.broadsheet"}],Uy={broadsheet:ti,"annual-report":Hy};function ii(e){return Js[e]||{width:Xs,height:Qs}}function qy(e){const t=si.find(n=>n.id===e);return t?.labelKey?g(t.labelKey):e}const zo=m.forwardRef(function({data:t,variant:n},a){const r=Uy[n]||ti,{width:s,height:i}=ii(n);return o.jsx("div",{ref:a,"data-share-card":"true",style:{width:s,height:i,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:o.jsx(r,{data:t})})});function Hn(){return typeof window>"u"?!1:!!window?.webkit?.messageHandlers?.nativeBridge}const Vy=440;function Gy(){const[e,t]=m.useState(null),n=m.useRef(null),a=m.useCallback((r,s="info")=>{n.current&&window.clearTimeout(n.current),t({id:Date.now(),kind:s,text:r}),n.current=window.setTimeout(()=>t(null),2800)},[]);return m.useEffect(()=>()=>{n.current&&window.clearTimeout(n.current)},[]),{toast:e,push:a}}function La({onClick:e,disabled:t,children:n,emphasis:a,ariaLabel:r}){return o.jsx("button",{type:"button",onClick:e,disabled:t,"aria-label":r,className:["group relative flex items-center justify-between gap-3 w-full px-4 py-3 text-left","rounded-lg border transition-colors",a?"border-oai-black dark:border-oai-white bg-oai-black dark:bg-oai-white text-oai-white dark:text-oai-black hover:opacity-90":"border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600",t?"opacity-60 cursor-not-allowed":"cursor-pointer"].join(" "),children:n})}function Ky({open:e,onClose:t,data:n,twitterText:a}){const[r,s]=m.useState(null),[i,l]=m.useState(""),[c,d]=m.useState("annual-report"),u=m.useRef(null),{toast:f,push:h}=Gy(),y=Xo(),p=m.useMemo(()=>{const M=y?.user;if(!M||typeof M!="object")return null;const T=M.user_metadata||{},O=M.profile||{},$=T.avatar_url||T.picture||O.avatar_url||M.avatar_url;return typeof $=="string"&&$.trim()?$.trim():null},[y?.user]);m.useEffect(()=>{e&&(s(null),l(n?.handle||""))},[e,n?.handle]);const x=n&&{...n,handle:i||n.handle,avatarUrl:p},{width:k,height:w}=ii(c),b=Vy/k;m.useEffect(()=>{if(!e)return;const M=T=>{T.key==="Escape"&&t?.()};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[e,t]);const _=m.useCallback(async()=>{const M=u.current;if(!M)return null;try{return await yy(M)}catch(T){return console.warn("[share] capture failed",T),null}},[]),v=m.useCallback(async()=>{if(r)return;s("copy");const M=await _();if(!M){h(g("share.toast.failed"),"error"),s(null);return}let T=!1;if(Hn()){const O=await Aa(M);O&&(T=(await fy(O)).ok)}else T=await Br(M);h(T?g("share.toast.copied"):g("share.toast.failed"),T?"success":"error"),s(null)},[r,_,h]),j=m.useCallback(()=>`tokentracker-share-${Date.now()}.png`,[]),N=m.useCallback(async()=>{if(r)return;s("download");const M=await _();if(!M){h(g("share.toast.failed"),"error"),s(null);return}if(Hn()){const O=await Aa(M);if(O&&(await Lo(O,j())).ok){h(g("share.toast.downloaded"),"success"),s(null);return}}const T=Ro(M,j());h(T?g("share.toast.downloaded"):g("share.toast.failed"),T?"success":"error"),s(null)},[r,_,j,h]),E=m.useCallback(async()=>{if(r)return;s("x");const M=await _();if(!M){h(g("share.toast.failed"),"error"),s(null);return}if(Hn()){const V=await Aa(M);V&&(await Lo(V,j()),h(g("share.toast.downloaded"),"success"))}else await Br(M)?h(g("share.toast.copied"),"success"):Ro(M,j());const T=new URL("https://twitter.com/intent/tweet");a&&T.searchParams.set("text",a);const O=y?.user?.id,$=typeof O=="string"&&O?`/u/${O}`:"/";if(T.searchParams.set("url",`https://www.tokentracker.cc${$}?ref=share`),Hn())try{window.webkit?.messageHandlers?.nativeBridge?.postMessage({type:"action",name:"openURL",value:T.toString()})}catch{window.open(T.toString(),"_blank","noopener,noreferrer")}else window.open(T.toString(),"_blank","noopener,noreferrer");s(null)},[r,_,h,a,j,y]);return e?o.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":g("share.modal.title"),"data-screenshot-exclude":"true",className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 sm:p-6",style:{background:"rgba(10,10,10,0.72)"},onClick:M=>{M.target===M.currentTarget&&t?.()},children:[o.jsx("div",{"aria-hidden":!0,style:{position:"fixed",left:0,top:0,width:k,height:w,pointerEvents:"none",opacity:0,zIndex:-1,clip:"rect(0,0,0,0)",overflow:"hidden"},children:o.jsx(zo,{ref:u,data:x,variant:c})}),o.jsxs(Fe.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},transition:{duration:.18,ease:[.2,.8,.2,1]},className:"relative w-full max-w-[1040px] max-h-[92vh] overflow-hidden rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-black shadow-oai-lg",children:[o.jsxs("div",{className:"flex flex-col lg:flex-row max-h-[92vh]",children:[o.jsx("div",{className:"flex-1 min-w-0 p-4 sm:p-7 bg-oai-gray-50 dark:bg-oai-gray-950 flex items-center justify-center overflow-auto",children:o.jsxs("div",{style:{width:k*b,height:w*b,flexShrink:0,position:"relative"},className:"rounded-xl overflow-hidden shadow-oai-md ring-1 ring-black/5",children:[r?o.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-white/70 dark:bg-black/50",children:o.jsxs("svg",{className:"animate-spin h-6 w-6 text-oai-gray-500",viewBox:"0 0 24 24",fill:"none",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}):null,o.jsx("div",{style:{width:k,height:w,transform:`scale(${b})`,transformOrigin:"top left"},children:o.jsx(zo,{data:x,variant:c})})]})}),o.jsxs("div",{className:"w-full lg:w-[340px] flex-shrink-0 border-t lg:border-t-0 lg:border-l border-oai-gray-200 dark:border-oai-gray-800 p-5 sm:p-6 flex flex-col gap-5 overflow-y-auto",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-oai-white",children:g("share.modal.title")}),o.jsx("p",{className:"mt-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:g("share.modal.subtitle")})]}),o.jsx("button",{type:"button",onClick:t,"aria-label":g("share.modal.close"),className:"p-1.5 -mt-1 -mr-1 rounded-md text-oai-gray-500 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:o.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),o.jsxs("div",{children:[o.jsx("label",{htmlFor:"share-handle",className:"text-[11px] tracking-[0.18em] uppercase text-oai-gray-500 dark:text-oai-gray-400 mb-1.5 block",children:g("share.modal.name_label")}),o.jsx("input",{id:"share-handle",type:"text",value:i,onChange:M=>l(M.target.value),placeholder:g("share.modal.name_placeholder"),className:"w-full px-3 py-2 text-sm rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white placeholder:text-oai-gray-400 dark:placeholder:text-oai-gray-600 focus:outline-none focus:ring-1 focus:ring-inset focus:ring-oai-brand transition-colors"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-[11px] tracking-[0.18em] uppercase text-oai-gray-500 dark:text-oai-gray-400 mb-1.5 block",children:g("share.modal.style_label")}),o.jsx("div",{className:"flex gap-2",children:si.map(M=>o.jsx("button",{type:"button",onClick:()=>d(M.id),className:["flex-1 px-3 py-2 text-sm rounded-lg border transition-colors",c===M.id?"border-oai-black dark:border-oai-white bg-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white font-medium":"border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 text-oai-gray-500 dark:text-oai-gray-400 hover:border-oai-gray-400 dark:hover:border-oai-gray-600"].join(" "),children:qy(M.id)},M.id))})]}),o.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[o.jsxs(La,{onClick:E,disabled:!!r,emphasis:!0,children:[o.jsxs("span",{className:"flex items-center gap-3",children:[o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:o.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),o.jsx("span",{className:"font-medium text-sm",children:g("share.modal.action.x")})]}),o.jsx("span",{className:"text-[11px] opacity-70",children:r==="x"?g("share.toast.working"):g("share.modal.hint.x")})]}),o.jsxs(La,{onClick:N,disabled:!!r,children:[o.jsxs("span",{className:"flex items-center gap-3",children:[o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),o.jsx("polyline",{points:"7 10 12 15 17 10"}),o.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),o.jsx("span",{className:"font-medium text-sm",children:g("share.modal.action.download")})]}),o.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:"PNG"})]}),o.jsxs(La,{onClick:v,disabled:!!r,children:[o.jsxs("span",{className:"flex items-center gap-3",children:[o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),o.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),o.jsx("span",{className:"font-medium text-sm",children:g("share.modal.action.copy")})]}),o.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:g("share.modal.hint.copy")})]})]}),o.jsx("div",{className:"mt-auto pt-4 border-t border-oai-gray-200 dark:border-oai-gray-800",children:o.jsx("p",{className:"text-[11px] leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:g("share.modal.footer")})})]})]}),o.jsx(sr,{children:f?o.jsx(Fe.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},className:"pointer-events-none absolute left-1/2 bottom-4 -translate-x-1/2",children:o.jsx("div",{className:["px-4 py-2 rounded-full text-xs font-medium shadow-oai-md",f.kind==="error"?"bg-red-600 text-white":f.kind==="success"?"bg-oai-black dark:bg-oai-white text-oai-white dark:text-oai-black":"bg-oai-gray-800 text-white"].join(" "),children:f.text})},f.id):null})]})]}):null}function Xy(e){const{enabled:t,handle:n,startDate:a,activeDays:r,summary:s,topModels:i,period:l,periodFrom:c,periodTo:d,heatmap:u,accessToken:f,userId:h,currency:y,exchangeRate:p}=e,[x,k]=m.useState(null),w=p;return m.useEffect(()=>{if(!t||!h&&!Yt())return;let b=!1;return(async()=>{try{const v=await Al({accessToken:f,userId:h,period:l==="day"||l==="custom"?"week":l,metric:"all",limit:100,offset:0});if(b)return;const N=(Array.isArray(v?.entries)?v.entries:Array.isArray(v)?v:[]).find(M=>M?.is_me===!0),E=typeof N?.rank=="number"?N.rank:null;k(E)}catch{b||k(null)}})(),()=>{b=!0}},[t,f,h,l]),m.useMemo(()=>xy({handle:n,startDate:a,activeDays:r,summary:s,topModels:i,rank:x,period:l,periodFrom:c,periodTo:d,heatmap:u,currency:y,exchangeRate:typeof w=="number"?w:void 0}),[n,a,r,s,i,x,l,c,d,u,y,w])}const Qy=["day","week","month","total","custom"],Ra=new Set(["day","hour","month"]),pn=new Set(["day","total","custom"]),Jy=["macAppBanner","statsPanel","widgetOnboarding","installCopy","activityHeatmap","deviceUsage","trendMonitor","qualityPerDollar"],Zy=["usageOverview","dataDetails"],li="tt.summaryFormat";function ep(){if(typeof window>"u")return null;try{const e=window.localStorage?.getItem(li);return e==="compact"?!0:e==="full"?!1:null}catch{return null}}function tp(e){if(!(typeof window>"u"))try{window.localStorage?.setItem(li,e?"compact":"full")}catch{}}function Ba(e,t){if(typeof t=="number"&&t>0)return!0;if(typeof e=="bigint")return e>0n;if(typeof e=="number")return Number.isFinite(e)&&e>0;if(typeof e=="string"){const n=e.trim();if(!n)return!1;if(/^[0-9]+$/.test(n))try{return BigInt(n)>0n}catch{return!1}const a=Number(n);return Number.isFinite(a)&&a>0}return!1}function Un(e){return e?tn(e,null):null}function Ho(e){return e?e?.billable_total_tokens??e?.value??e?.total_tokens:null}function np(e){if(typeof e!="string"||!e)return null;const t=e.split("-");if(t.length!==3)return null;const n=Number(t[0]),a=Number(t[1])-1,r=Number(t[2]);if(!Number.isFinite(n)||!Number.isFinite(a)||!Number.isFinite(r))return null;const s=new Date(Date.UTC(n,a,r));return Number.isFinite(s.getTime())?s:null}function ap(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function rp(e){return e?e==="www.tokentracker.cc"||e==="tokentracker.cc":!1}function op(){if(typeof window>"u")return!1;const e=new URLSearchParams(window.location.search),t=String(e.get("force_install")||"").toLowerCase();return t!=="1"&&t!=="true"?!1:!rp(window.location.hostname)}function vp({baseUrl:e,auth:t,signedIn:n,sessionSoftExpired:a,signOut:r,publicMode:s=!1,publicToken:i=null,signInUrl:l="/sign-in",signUpUrl:c="/sign-up",onMainContentVisible:d}){const{resolvedLocale:u}=Fl(),{currency:f,rate:h}=rn(),[y,p]=m.useState(!1),[x,k]=m.useState(null),[w,b]=m.useState(null),[_,v]=m.useState(!1),[j,N]=m.useState(null),[E,M]=m.useState(0),[T,O]=m.useState(0),[$,V]=m.useState(null),[C,A]=m.useState(()=>{const S=ep();return S??(typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(max-width: 640px)").matches)}),I=m.useCallback(()=>{A(S=>{const B=!S;return tp(B),B})},[]),D=m.useMemo(()=>typeof window>"u"?!1:Il(window.location.search),[]),Y=m.useMemo(()=>op(),[]),[U,W]=m.useState(!1),ee=2200,[ie,z]=m.useState(!0),[J,de]=m.useState(!1),[me,F]=m.useState(!1),[H,L]=m.useState(!1),re=m.useRef(!1),X=Yt(),Q=n&&!a,se=m.useMemo(()=>Q&&(typeof t=="function"||typeof t=="string"||t&&typeof t=="object")?t:null,[t,Q]),G=Q?se:null,le=s?Ll(i):G,be=n||X||s,_e=Q&&nn(G),he=n&&a&&!s,{accountView:ce,revision:ge,resolving:Oe}=Rl(),De=ce&&!s,Re=De?G:null,He=Oe&&!s;m.useEffect(()=>{if(!n||X){k(null),b(null),v(!1),N(null);return}if(s)return;if(!_e){k(null),b(null),v(!1),N(null);return}let S=!0;const B=()=>{k(null),b(null),v(!1),N(null)};return v(!0),N(null),(async()=>{let K=null;try{K=await ze(G)}catch{K=null}if(S){if(!K){B();return}try{const oe={link_code:null,expires_at:null};if(!S)return;k(typeof oe?.link_code=="string"?oe.link_code:null),b(typeof oe?.expires_at=="string"?oe.expires_at:null)}catch(oe){if(!S)return;k(null),b(null),N(oe?.message||"Failed to load link code")}finally{if(!S)return;v(!1)}}})(),()=>{S=!1}},[e,X,n,s,_e,G,T]);const Be=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");m.useEffect(()=>{if(!Be&&(!n||X||s)){V(null);return}if(!Be&&!_e){V(null);return}let S=!0;return(async()=>{let B=null;try{B=await ze(G)}catch{B=null}if(S){if(!B&&!Be){V(null);return}try{const K=await Bl({baseUrl:e,accessToken:B});if(!S)return;V(K&&typeof K=="object"?K:null)}catch{if(!S)return;V(null)}}})(),()=>{S=!1}},[_e,e,G,X,s,n]);const mt=m.useMemo(()=>{if(!w)return!1;const S=Date.parse(w);if(!Number.isFinite(S))return!1;const B=E||Date.now();return S<=B},[w,E]);m.useEffect(()=>{!n||X||s||!w||!mt||_||(k(null),b(null),N(null),O(S=>S+1))},[mt,w,_,X,n]),m.useEffect(()=>{if(!w||s)return;const S=Date.parse(w);if(!Number.isFinite(S))return;const B=Date.now();if(M(B),S<=B)return;const K=window.setTimeout(()=>M(Date.now()),S-B),oe=()=>{typeof document>"u"||document.visibilityState==="visible"&&M(Date.now())};return typeof document<"u"&&document.addEventListener("visibilitychange",oe),window.addEventListener("focus",oe),()=>{window.clearTimeout(K),typeof document<"u"&&document.removeEventListener("visibilitychange",oe),window.removeEventListener("focus",oe)}},[w]),m.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const S=window.matchMedia("(max-width: 640px)"),B=()=>A(S.matches);return B(),S.addEventListener?(S.addEventListener("change",B),()=>S.removeEventListener("change",B)):(S.addListener(B),()=>S.removeListener(B))},[]);const Me=m.useMemo(()=>Go(),[]),Ce=m.useMemo(()=>Vo(),[]),Ye=m.useMemo(()=>Yl(),[]),Xe=s?null:t?.userId||t?.email||"default",[Tt,vt]=m.useState("month"),[Qe,sn]=m.useState(null),[ot,ln]=m.useState(null),[cn,ht]=m.useState(!1),ue=D?"total":Tt,Z=m.useMemo(()=>ue==="custom"&&Qe&&ot?{from:Qe,to:ot}:zl(ue,{timeZone:Me,offsetMinutes:Ce,now:Ye}),[Ye,ue,Me,Ce,Qe,ot]),te=Z.from,R=Z.to,[ne,je]=m.useState(null),{devices:ae,refresh:Ht}=iy({from:te,to:R,timeZone:Me,tzOffsetMinutes:Ce,accountView:De,accountAccessToken:Re,accountRevision:ge}),gt=De&&ae.length>=2;m.useEffect(()=>{if(!gt){ne!==null&&je(null);return}ne&&!ae.some(S=>S.id===ne)&&je(null)},[gt,ae,ne]);const Ut=m.useMemo(()=>gt?[{value:"",label:g("dashboard.device_filter.all")},...ae.map(S=>({value:S.id,label:Qa(S)||g("dashboard.device_card.unnamed")}))]:[],[gt,ae,u]),Pt=gt?o.jsx(uy,{devices:ae,selectedDeviceId:ne||"",onSelectDevice:S=>je(S||null),onRenameDevice:async(S,B)=>{const K=await ze(Re);await Gl({deviceId:S,name:B,accessToken:K}),await Ht()}}):null,yt=m.useMemo(()=>Hl({timeZone:Me,offsetMinutes:Ce}),[Me,Ce]),dn=m.useMemo(()=>Ul({timeZone:Me,offsetMinutes:Ce}),[Me,Ce]),oa=m.useMemo(()=>`Local time (${dn})`,[dn]),qt=Me,un=Ce,sa=yt,Ot=m.useMemo(()=>ea({timeZone:Me,offsetMinutes:Ce,date:Ye||new Date}),[Ye,Me,Ce]),jn=m.useMemo(()=>{const S=np(Ot)||new Date,B=ap(S,-29);return{from:en(B),to:en(S)}},[Ot]),{daily:st,summary:We,rolling:ia,source:Sn,loading:la,error:ca,refresh:Mn}=Ur({baseUrl:e,accessToken:le,guestAllowed:he,from:te,to:R,includeDaily:ue!=="total",cacheKey:Xe,timeZone:Me,tzOffsetMinutes:Ce,now:Ye,accountView:De,accountAccessToken:Re,accountRevision:ge,accountViewResolving:He,deviceId:ne}),{daily:fn,loading:da,refresh:Cn}=Ur({baseUrl:e,accessToken:le,guestAllowed:he,from:jn.from,to:jn.to,includeDaily:!0,cacheKey:Xe?`${Xe}.daily-breakdown`:"daily-breakdown",timeZone:Me,tzOffsetMinutes:Ce,now:Ye,accountView:De,accountAccessToken:Re,accountRevision:ge,accountViewResolving:He}),{breakdown:fe,loading:ve,refresh:Pe}=rd({baseUrl:e,accessToken:le,guestAllowed:he,from:te,to:R,cacheKey:Xe,timeZone:Me,tzOffsetMinutes:Ce,accountView:De,accountAccessToken:Re,accountRevision:ge,accountViewResolving:He,deviceId:ne}),[_t,Nt]=m.useState(3),{entries:mn,loading:ci,refresh:gr}=Vc({baseUrl:e,accessToken:le,limit:_t,from:te,to:R,timeZone:Me,tzOffsetMinutes:Ce}),yr=ue==="week"||ue==="month",Dn=ue==="week"||ue==="month",pr=m.useMemo(()=>st.filter(S=>S?.future?!1:!S?.day||!Ot?!0:String(S.day)<=String(Ot)),[st,Ot]),{rows:pt,from:di,to:ui,loading:fi,refresh:br}=ts({baseUrl:e,accessToken:le,guestAllowed:he,period:ue,from:te,to:R,months:24,cacheKey:Xe,timeZone:qt,tzOffsetMinutes:un,now:Ye,sharedRows:yr?st:null,sharedRange:yr?{from:te,to:R}:null,accountView:De,accountAccessToken:Re,accountRevision:ge,accountViewResolving:He,deviceId:ne}),mi=m.useMemo(()=>({baseUrl:e,accessToken:le,guestAllowed:he,cacheKey:Xe,timeZone:qt,tzOffsetMinutes:un,now:Ye,accountView:De,accountAccessToken:Re,accountRevision:ge,accountViewResolving:He}),[e,le,he,Xe,qt,un,Ye,De,Re,ge,He]),{daily:Vt,heatmap:it,loading:xr,refresh:kr}=zc({baseUrl:e,accessToken:le,guestAllowed:he,weeks:52,cacheKey:Xe,timeZone:Me,tzOffsetMinutes:Ce,now:Ye,accountView:De,accountAccessToken:Re,accountRevision:ge,accountViewResolving:He,deviceId:ne}),{data:Tn,refresh:wr}=rc();m.useEffect(()=>{Tn&&typeof Tn=="object"&&ql(Tn)},[Tn]);const tt=m.useMemo(()=>ue==="day"?"hour":ue==="total"?"month":"day",[ue]),hi=m.useMemo(()=>Vr(tt),[tt]),Pn="day",gi=m.useMemo(()=>Vr(Pn),[]),[nt,vr]=m.useState(()=>({key:"day",dir:"desc"}));m.useEffect(()=>{vr(S=>!Ra.has(S.key)||S.key===tt?S:{key:tt,dir:S.dir})},[tt]);const Gt=m.useMemo(()=>Ra.has(nt.key)&&nt.key!==tt?{...nt,key:tt}:nt,[tt,nt]),On=m.useMemo(()=>{if(ue==="day")return Array.isArray(pt)?pt.filter(K=>K?.hour&&!K?.future):[];if(ue==="total"){const K=Array.isArray(pt)?pt.filter(oe=>oe?.month&&!oe?.future):[];return pd(K)}const S=pr;return!S.some(K=>!K?.missing&&!K?.future)&&st.length>0?st.filter(K=>!K?.future).slice(-30).filter(K=>K?.day):S},[ue,pt,pr,st]),hn=m.useMemo(()=>Gr(On,Gt),[On,Gt]),_r=m.useMemo(()=>On.some(S=>!S?.missing&&!S?.future),[On]),ua=m.useMemo(()=>{if(!pn.has(ue))return 1;const S=Math.ceil(hn.length/Xn);return S>0?S:1},[ue,hn.length]),[fa,Wn]=m.useState(0);m.useEffect(()=>{if(!pn.has(ue)){Wn(0);return}Wn(S=>Math.min(S,ua-1))},[ua,ue]),m.useEffect(()=>{pn.has(ue)&&Wn(0)},[ue,nt.dir,nt.key]);const yi=m.useMemo(()=>pn.has(ue)?bd(hn,fa,Xn):hn,[fa,ue,hn]),Nr=m.useMemo(()=>fn.filter(S=>!S?.future&&S?.day).slice(-30),[fn]),Kt=m.useMemo(()=>Ra.has(nt.key)?{...nt,key:Pn}:nt,[nt]),pi=m.useMemo(()=>Gr(Nr,Kt),[Nr,Kt]),bi=m.useMemo(()=>Dn?st:ue==="day"?Array.isArray(pt)?pt.filter(S=>S?.hour):[]:pt,[st,ue,pt,Dn]),xi=Dn?te:di,ki=Dn?R:ui;function wi(S,B){return S?.future?"—":S?.missing?g("shared.status.unsynced"):B==="total_tokens"?bt(Un(S)):bt(S?.[B])}function vi(S){const B=S?.[tt];if(B==null)return"";const K=String(B);if(tt==="hour"){const[oe,Ue]=K.split("T");if(oe&&Ue)return`${oe} ${Ue.slice(0,5)}`}return K}function _i(S){const B=S?.[Pn];return B==null?"":String(B)}function Ni(S){vr(B=>B.key===S?{key:S,dir:B.dir==="asc"?"desc":"asc"}:{key:S,dir:"desc"})}function ji(S){return Gt.key!==S?"none":Gt.dir==="asc"?"ascending":"descending"}function Si(S){return Gt.key!==S?"":Gt.dir==="asc"?"▲":"▼"}function Mi(S){return Kt.key!==S?"none":Kt.dir==="asc"?"ascending":"descending"}function Ci(S){return Kt.key!==S?"":Kt.dir==="asc"?"▲":"▼"}const ma=m.useMemo(()=>{if(!n&&!X&&!s&&!Be)return 0;const S=Number(it?.active_days);if(Number.isFinite(S))return S;let B=0;const K=new Set,oe=(Te,Je,qe)=>{typeof Te!="string"||!Te||K.has(Te)||Ba(Je,qe)&&(K.add(Te),B+=1)};if(Array.isArray(Vt))for(const Te of Vt)oe(Te?.day,Un(Te));const Ue=Array.isArray(it?.weeks)?it.weeks:[];for(const Te of Ue)for(const Je of Array.isArray(Te)?Te:[]){const qe=Ho(Je);oe(Je?.day,qe,Je?.level)}return B},[n,X,it?.active_days,it?.weeks,Vt]),[jr,Sr]=m.useState("month"),Di=m.useCallback(S=>{S==="custom"?(Sr(B=>B==="custom"?"month":B),vt(B=>Qe&&ot?"custom":B),ht(!0)):(vt(S),Sr(S),ht(!1))},[Qe,ot]),Ti=m.useCallback((S,B)=>{sn(S),ln(B),vt("custom"),ht(!1)},[]),Pi=m.useCallback(S=>{ht(S),!S&&Tt==="custom"&&!Qe&&vt(jr)},[Tt,Qe,jr]),Mr=m.useCallback(async()=>{await Promise.all([Mn(),kr(),br(),Pe(),gr(),Cn(),wr()])},[Cn,kr,Pe,gr,br,Mn,wr]),Oi=m.useCallback(async()=>{L(!0);try{Be&&await Vl(),await Mr()}catch(S){console.error("[DashboardPage] Refresh failed:",S)}finally{L(!1)}},[Be,Mr]),En=H||la||da||xr||fi||ve||ci,Wi=He||De&&En&&!_r,Ei=m.useMemo(()=>g("shared.data_source",{source:String(Sn||"edge").toUpperCase()}),[Sn,u]),$n=m.useMemo(()=>typeof t?.name!="string"?"":t.name.trim(),[t?.name]),$i="",Cr=m.useMemo(()=>!$n||$n.includes("@")?g("dashboard.identity.fallback"):$n,[$n]),Dr=m.useMemo(()=>Cr.replace(/[^a-zA-Z0-9._-]/g,"_"),[Cr]),Tr=m.useMemo(()=>s?g("dashboard.identity.fallback"):Dr,[Dr,$i,s]),Pr=m.useMemo(()=>{let S=null;const B=oe=>{typeof oe!="string"||!oe||(!S||oe<S)&&(S=oe)};if(Array.isArray(Vt))for(const oe of Vt)oe?.day&&Ba(Un(oe))&&B(oe.day);const K=Array.isArray(it?.weeks)?it.weeks:[];for(const oe of K)for(const Ue of Array.isArray(oe)?oe:[]){if(!Ue?.day)continue;const Te=Ho(Ue),Je=Ue?.level;Ba(Te,Je)&&B(Ue.day)}return S},[it?.weeks,Vt]),Ai=m.useMemo(()=>s?[]:(Array.isArray($?.subscriptions?.items)?$.subscriptions.items:[]).map(K=>{const oe=typeof K?.tool=="string"?K.tool.trim():"",Te=(typeof K?.plan_type=="string"?K.plan_type:typeof K?.planType=="string"?K.planType:"").trim();return!oe||!Te?null:{tool:oe,planType:Te,provider:typeof K?.provider=="string"?K.provider.trim():"",product:typeof K?.product=="string"?K.product.trim():"",rateLimitTier:typeof K?.rate_limit_tier=="string"?K.rate_limit_tier.trim():typeof K?.rateLimitTier=="string"?K.rateLimitTier.trim():""}}).filter(Boolean).slice(0,6),[s,$]),Fi=o.jsx(ic,{heatmap:it,timeZoneLabel:yt,timeZoneShortLabel:dn,hideLegend:D,defaultToLatestMonth:D}),Ii=m.useMemo(()=>`${te}..${R}`,[te,ue,R]),Li=g("usage.summary.total"),Wt=Un(We),Or=g("shared.unit.thousand_abbrev"),Wr=g("shared.unit.million_abbrev"),Er=g("shared.unit.billion_abbrev"),An=$e(Wt),$r=C&&An!=null,Ri=m.useMemo(()=>$r?Ae(An,{thousandSuffix:Or,millionSuffix:Wr,billionSuffix:Er,decimals:1}):bt(Wt),[Er,Wr,Wt,An,Or,$r]),Bi=g("dashboard.core_index.collapse_label"),Yi=g("dashboard.core_index.expand_label"),zi=g("dashboard.core_index.collapse_aria"),Hi=g("dashboard.core_index.expand_aria"),Ui=!D,Xt=g("shared.placeholder.short"),ha=m.useMemo(()=>{const S=Array.isArray(fe?.sources)?fe.sources:[];let B=null,K=0;for(const Je of S){const qe=tn(Je?.totals);!Number.isFinite(qe)||qe<=0||qe>K&&(K=qe,B=Je)}let oe=Xt,Ue=Xt,Te="0.0";if(B&&K>0){oe=B?.source?String(B.source).toUpperCase():Xt;const Je=Array.isArray(B?.models)?B.models:[];let qe=0;for(const va of Je){const In=tn(va?.totals);!Number.isFinite(In)||In<=0||In>qe&&(qe=In,Ue=va?.model?String(va.model):Xt)}qe>0&&(Te=(qe/K*100).toFixed(1))}return{agentName:oe,modelName:Ue,modelPercent:Te}},[fe,Xt]),ga=bt(Wt),qi=g("dashboard.screenshot.twitter_text",{total_tokens:ga==="-"?Xt:ga,agent_name:ha.agentName,model_name:ha.modelName,model_percent:ha.modelPercent}),Vi=m.useMemo(()=>D?[]:Qy,[D]),Gi=m.useMemo(()=>[{label:g("usage.metric.total"),value:bt(Wt),valueClassName:"text-white"},{label:g("usage.metric.input"),value:bt(We?.input_tokens)},{label:g("usage.metric.output"),value:bt(We?.output_tokens)},{label:g("usage.metric.cached_input"),value:bt(We?.cached_input_tokens)},{label:g("usage.metric.reasoning_output"),value:bt(We?.reasoning_output_tokens)}],[We?.cached_input_tokens,We?.input_tokens,We?.output_tokens,We?.reasoning_output_tokens,Wt]),ya=m.useMemo(()=>an(We?.total_cost_usd,{currency:f,rate:h}),[We?.total_cost_usd,f,h]),Ki=m.useMemo(()=>We?.conversation_count??null,[We?.conversation_count]),Ar=m.useMemo(()=>wd(fe,{copyFn:g}),[fe]),Fr=m.useMemo(()=>vd(fe,{limit:3,copyFn:g}),[fe]),Xi=Xy({enabled:U,handle:Tr,startDate:Pr,activeDays:ma,summary:We,topModels:Fr,period:ue,periodFrom:te,periodTo:R,heatmap:it,accessToken:typeof le=="string"?le:null,userId:t?.userId||null,currency:f,exchangeRate:h}),Qi=m.useCallback(()=>W(!0),[]),Ji=m.useCallback(()=>W(!1),[]),Zi=m.useCallback(()=>p(!0),[]),el=m.useCallback(()=>p(!1),[]),tl=ya&&ya!=="-"&&Ar.length>0,gn=g("dashboard.install.cmd.init"),pa=mt?null:x,ba=pa?g("dashboard.install.cmd.init_link_code",{link_code:pa}):gn,nl=gn,al=g("dashboard.install.cmd.sync"),rl=pa?g("dashboard.install.copy"):g("dashboard.install.copy_base"),ol=g("dashboard.install.copied");g("dashboard.session_expired.copy_label"),g("dashboard.session_expired.copied");const sl=!!($?.install?.has_active_device_token??$?.install?.hasActiveDeviceToken),il=xd({publicMode:s,screenshotMode:D,forceInstall:Y,accessEnabled:be,heatmapLoading:xr,activeDays:ma,hasActiveDeviceToken:sl}),ll=g("dashboard.install.prompt"),cl=m.useCallback(async()=>{!ba||!await Yr(ba)||(de(!0),window.setTimeout(()=>de(!1),2e3))},[ba]);m.useCallback(async()=>{!gn||!await Yr(gn)||(F(!0),window.setTimeout(()=>F(!1),2e3))},[gn]);const xa=m.useMemo(()=>g("dashboard.daily.empty",{cmd:"{{cmd}}"}),[u]),[dl,ul]=m.useMemo(()=>{const S=xa.split("{{cmd}}");return S.length===1?[xa,""]:[S[0],S.slice(1).join("{{cmd}}")]},[xa]),ka=a&&!s,wa=!n&&!X&&!a&&!Be&&!s,Fn=qc(Jy,Zy);return m.useEffect(()=>{re.current||ka||wa||En||(re.current=!0,d?.())},[d,wa,ka,En]),o.jsxs(o.Fragment,{children:[o.jsx(sy,{copy:g,onOpenShare:Qi,screenshotMode:D,showExpiredGate:ka,showAuthGate:wa,identityDisplayName:Tr,identityStartDate:Pr,activeDays:ma,identitySubscriptions:Ai,identityScrambleDurationMs:ee,projectUsageEntries:mn,projectUsageLimit:_t,setProjectUsageLimit:Nt,topModels:Fr,signedIn:n,publicMode:s,isLocalMode:Be,shouldShowInstall:il,installPrompt:ll,handleCopyInstall:cl,installCopied:J,installCopiedLabel:ol,installCopyLabel:rl,installInitCmdDisplay:nl,linkCodeLoading:_,linkCodeError:j,trendRowsForDisplay:bi,trendFromForDisplay:xi,trendToForDisplay:ki,trendZoomConfig:mi,usageFrom:te,usageTo:R,period:ue,trendTimeZoneLabel:sa,activityHeatmapBlock:Fi,periodsForDisplay:Vi,setSelectedPeriod:Di,customFrom:Qe,customTo:ot,onCustomRangeApply:Ti,customRangeOpen:cn,onCustomRangeOpenChange:Pi,metricsRows:Gi,summaryLabel:Li,summaryValue:Ri,summaryFullValue:ga,onToggleSummaryFormat:!D&&An!=null?I:null,summaryTotalTokensRaw:$e(Wt)||0,summaryCostValue:ya,summaryConversationsValue:Ki,rollingUsage:ia,costInfoEnabled:tl,openCostModal:Zi,allowBreakdownToggle:Ui,coreIndexCollapsed:ie,setCoreIndexCollapsed:z,coreIndexCollapseLabel:Bi,coreIndexExpandLabel:Yi,coreIndexCollapseAria:zi,coreIndexExpandAria:Hi,refreshAll:Oi,usageLoadingState:En,initialDashboardLoading:Wi,usageError:ca,rangeLabel:Ii,timeZoneRangeLabel:oa,usageSourceLabel:Ei,fleetData:Ar,hasDetailsActual:_r,dailyEmptyPrefix:dl,installSyncCmd:al,dailyEmptySuffix:ul,detailsColumns:hi,ariaSortFor:ji,toggleSort:Ni,sortIconFor:Si,pagedDetails:yi,dailyBreakdownRows:pi,dailyBreakdownColumns:gi,dailyBreakdownAriaSortFor:Mi,dailyBreakdownSortIconFor:Ci,dailyBreakdownDateKey:Pn,detailsDateKey:tt,renderDetailDate:vi,renderDailyBreakdownDate:_i,renderDetailCell:wi,DETAILS_PAGED_PERIODS:pn,detailsPageCount:ua,detailsPage:fa,setDetailsPage:Wn,costModalOpen:y,closeCostModal:el,deviceOptions:Ut,selectedDevice:ne||"",onDeviceChange:S=>je(S||null),deviceUsageBlock:Pt,leftCardOrder:Fn.left.order,onLeftReorder:Fn.left.reorder,rightCardOrder:Fn.right.order,onRightReorder:Fn.right.reorder}),o.jsx(Ky,{open:U,onClose:Ji,data:Xi,twitterText:qi})]})}export{vp as DashboardPage};
|