tokentracker-cli 0.82.0 → 0.82.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dashboard/dist/assets/{AchievementBadge-D6iPEEbz.js → AchievementBadge-Dz8bedOl.js} +1 -1
  2. package/dashboard/dist/assets/{AchievementsPage-Jry355YE.js → AchievementsPage-DYeOB_b5.js} +2 -2
  3. package/dashboard/dist/assets/{AchievementsSection-ah-kG00E.js → AchievementsSection-ByvPCFbJ.js} +1 -1
  4. package/dashboard/dist/assets/{BadgeDetailModal-FyvUrVvF.js → BadgeDetailModal-CyfdVn-N.js} +1 -1
  5. package/dashboard/dist/assets/{Card-C3nLScju.js → Card-C-9AAzrt.js} +1 -1
  6. package/dashboard/dist/assets/{ClawdAnimated-CLHhE26z.js → ClawdAnimated-85mtsgNG.js} +1 -1
  7. package/dashboard/dist/assets/CommunityStatsModal-BcY_bUKs.js +1 -0
  8. package/dashboard/dist/assets/{ConfirmModal-CTDarLrD.js → ConfirmModal-1F-oKSQV.js} +1 -1
  9. package/dashboard/dist/assets/DashboardPage-ClasFW2f.js +1 -0
  10. package/dashboard/dist/assets/{DevicePage-CyXjUO8W.js → DevicePage-Dz6nuSzK.js} +1 -1
  11. package/dashboard/dist/assets/DialogClose-DoAFJvy1.js +1 -0
  12. package/dashboard/dist/assets/DialogDescription-DHznQh6m.js +1 -0
  13. package/dashboard/dist/assets/DialogTitle-DXvcoQzl.js +1 -0
  14. package/dashboard/dist/assets/{FadeIn-BDWtfIsO.js → FadeIn-C8JjNrTO.js} +1 -1
  15. package/dashboard/dist/assets/{HeaderGithubStar-DE1USQbb.js → HeaderGithubStar-xAchQaWn.js} +1 -1
  16. package/dashboard/dist/assets/{IpCheckPage-B2SkgT0P.js → IpCheckPage-BMAw8ydi.js} +1 -1
  17. package/dashboard/dist/assets/{LandingPage-PU5gxsfY.js → LandingPage-DHQemdKQ.js} +1 -1
  18. package/dashboard/dist/assets/{LeaderboardAvatar-CaOV_hFE.js → LeaderboardAvatar-BJULUEGJ.js} +1 -1
  19. package/dashboard/dist/assets/LeaderboardPage-CwIJH5cz.js +2 -0
  20. package/dashboard/dist/assets/{LeaderboardProfileModal-DtNEbVH8.js → LeaderboardProfileModal-B2gmyvsz.js} +4 -4
  21. package/dashboard/dist/assets/{LeaderboardProfilePage-DRklax3-.js → LeaderboardProfilePage-CcPzqTDF.js} +3 -3
  22. package/dashboard/dist/assets/LimitsPage-BahJx6CU.js +4 -0
  23. package/dashboard/dist/assets/{LocalOnlyNotice-si9PMKya.js → LocalOnlyNotice-tbkd3Hic.js} +1 -1
  24. package/dashboard/dist/assets/{LoginPage-DgLwhXKo.js → LoginPage-DH94HwWF.js} +1 -1
  25. package/dashboard/dist/assets/PetPage-Bgha7egO.js +1 -0
  26. package/dashboard/dist/assets/PopoverPopup-kRGuXnS1.js +1 -0
  27. package/dashboard/dist/assets/{ResetPasswordPage-C6NvRO-Q.js → ResetPasswordPage-DDJBMz-A.js} +1 -1
  28. package/dashboard/dist/assets/{Select-CH2xVU8X.js → Select-DbPDNra5.js} +1 -1
  29. package/dashboard/dist/assets/SelectItemText-D5FrEa78.js +1 -0
  30. package/dashboard/dist/assets/{SettingsPage-Cm3uT11D.js → SettingsPage-DC3zR4gl.js} +1 -1
  31. package/dashboard/dist/assets/SkillsPage-CnmtS3f-.js +1 -0
  32. package/dashboard/dist/assets/TrendMonitor-DixWn0Ji.js +19 -0
  33. package/dashboard/dist/assets/WidgetsPage-9TJfxcmr.js +1 -0
  34. package/dashboard/dist/assets/{WrappedPage-Dz71ln4t.js → WrappedPage-DiEg9GtQ.js} +1 -1
  35. package/dashboard/dist/assets/{__vite-browser-external-Eoyj4eG-.js → __vite-browser-external-BQjn-jcg.js} +23 -10
  36. package/dashboard/dist/assets/__vite-browser-external-DWSIu6d0.css +1 -0
  37. package/dashboard/dist/assets/{agent-logos-D3K_ZRUj.js → agent-logos-9DPVn5O-.js} +1 -1
  38. package/dashboard/dist/assets/{arrow-up-right-CT4-gmOS.js → arrow-up-right-DRXKp-g8.js} +1 -1
  39. package/dashboard/dist/assets/{check-B87_qvAg.js → check-Bp-cxir1.js} +1 -1
  40. package/dashboard/dist/assets/{copy-Dtr68epm.js → copy-eRWKRZgV.js} +1 -1
  41. package/dashboard/dist/assets/{download-DaWsA_Gj.js → download-BYBgztAF.js} +1 -1
  42. package/dashboard/dist/assets/{flame-vLBOq0X0.js → flame-Dn3di8Oc.js} +1 -1
  43. package/dashboard/dist/assets/{format-tokens-C6Pidz3s.js → format-tokens-CUBOjHb3.js} +1 -1
  44. package/dashboard/dist/assets/{icons-BaaYJxUN.js → icons-DGmKoYrQ.js} +1 -1
  45. package/dashboard/dist/assets/{info-B46Qt16h.js → info-hNxx3heq.js} +1 -1
  46. package/dashboard/dist/assets/{limits-providers-13af4PEg.js → limits-providers-DbDbUJlS.js} +1 -1
  47. package/dashboard/dist/assets/{link-2-DeN6MJpT.js → link-2-DLpasKnO.js} +1 -1
  48. package/dashboard/dist/assets/{loader-circle-ByEuaaSw.js → loader-circle-Dr8XBEwL.js} +1 -1
  49. package/dashboard/dist/assets/provider-display-BaIvawBI.js +42 -0
  50. package/dashboard/dist/assets/{terminal-DyicX7lG.js → terminal-XHI11uAB.js} +1 -1
  51. package/dashboard/dist/assets/{trash-2-CVCC3DtQ.js → trash-2-B_iuyhQd.js} +1 -1
  52. package/dashboard/dist/assets/{use-community-stats-CExk3D6G.js → use-community-stats-DXyHOYbX.js} +1 -1
  53. package/dashboard/dist/assets/{use-limits-display-prefs-CRl4uU95.js → use-limits-display-prefs-BdFQf_ea.js} +1 -1
  54. package/dashboard/dist/assets/{use-native-settings-Bi6E9dsE.js → use-native-settings-Gia9MO-Y.js} +1 -1
  55. package/dashboard/dist/assets/{use-ordered-list-Dk0p2otw.js → use-ordered-list-m5UXCO_e.js} +1 -1
  56. package/dashboard/dist/assets/{use-session-efficiency-pref-YAG-OYIh.js → use-session-efficiency-pref-wCgbduxT.js} +1 -1
  57. package/dashboard/dist/assets/{use-transform-lflyghWN.js → use-transform-CqiRAEK5.js} +1 -1
  58. package/dashboard/dist/assets/use-usage-limits-B-zrEGe6.js +1 -0
  59. package/dashboard/dist/assets/{useCurrency-BtHtcsO5.js → useCurrency-ko1kI_y1.js} +1 -1
  60. package/dashboard/dist/assets/useScrollLock-C24aFA2G.js +1 -0
  61. package/dashboard/dist/assets/{useTokenFormat-BdD057ih.js → useTokenFormat-CNxtNtIi.js} +1 -1
  62. package/dashboard/dist/assets/{zap-DWWma29E.js → zap-Dqpw2hFM.js} +1 -1
  63. package/dashboard/dist/index.html +2 -2
  64. package/dashboard/dist/share.html +2 -2
  65. package/package.json +1 -1
  66. package/src/lib/grok-limits.js +203 -25
  67. package/src/lib/local-api.js +34 -0
  68. package/src/lib/pet-packages.js +268 -5
  69. package/src/lib/pricing/seed-snapshot.json +1 -1
  70. package/src/lib/usage-limits.js +9 -1
  71. package/dashboard/dist/assets/CommunityStatsModal-DA3PHLV5.js +0 -1
  72. package/dashboard/dist/assets/DashboardPage-DZIiWc3Y.js +0 -1
  73. package/dashboard/dist/assets/DialogDescription-ahxSNUcB.js +0 -1
  74. package/dashboard/dist/assets/DialogTitle-z86PHHyk.js +0 -1
  75. package/dashboard/dist/assets/LeaderboardPage-B0JtEyRP.js +0 -2
  76. package/dashboard/dist/assets/LimitsPage-Dg0cJa40.js +0 -4
  77. package/dashboard/dist/assets/PetPage-DEZbjk99.js +0 -1
  78. package/dashboard/dist/assets/PopoverPopup-DX7v1XfE.js +0 -1
  79. package/dashboard/dist/assets/SelectItemText-CCW6JeeN.js +0 -1
  80. package/dashboard/dist/assets/SkillsPage-CljRL6yF.js +0 -1
  81. package/dashboard/dist/assets/TrendMonitor-DM1_WNfw.js +0 -19
  82. package/dashboard/dist/assets/WidgetsPage-mJ1j6hly.js +0 -1
  83. package/dashboard/dist/assets/__vite-browser-external-C7JwykID.css +0 -1
  84. package/dashboard/dist/assets/provider-display-CKbOKeV4.js +0 -42
  85. package/dashboard/dist/assets/use-usage-limits-DJXvJ25Q.js +0 -1
  86. package/dashboard/dist/assets/useScrollLock-C2C-Yazq.js +0 -1
@@ -1,42 +0,0 @@
1
- import{k as Ne,r as i,j as e,c as n,S as Ie,ae as He,af as Ge,X as Oe,Y as qe}from"./__vite-browser-external-Eoyj4eG-.js";import{u as Ke}from"./useCurrency-BtHtcsO5.js";import{u as Ee}from"./useTokenFormat-BdD057ih.js";import{M as Ze,T as Ve}from"./terminal-DyicX7lG.js";import{I as Je}from"./info-B46Qt16h.js";const Qe=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],et=Ne("pause",Qe);const tt=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],at=Ne("play",tt);const rt=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],ot=Ne("rotate-ccw",rt),te={emerald:{light:["#ebedf0","#a7f3d0","#6ee7b7","#34d399","#10b981"],dark:["#2d333b","#065f46","#059669","#10b981","#34d399"],gridColor:{light:"rgba(16, 185, 129, 0.12)",dark:"rgba(52, 211, 153, 0.08)"}},ocean:{light:["#f1f5f9","#93c5fd","#60a5fa","#3b82f6","#1d4ed8"],dark:["#1e293b","#1e3a8a","#2563eb","#3b82f6","#60a5fa"],gridColor:{light:"rgba(59, 130, 246, 0.12)",dark:"rgba(96, 165, 250, 0.08)"}},neon:{light:["#faf5ff","#ebd5ff","#c084fc","#a855f7","#7e22ce"],dark:["#2e1065","#581c87","#8b5cf6","#a855f7","#c084fc"],gridColor:{light:"rgba(168, 85, 247, 0.12)",dark:"rgba(192, 132, 252, 0.08)"}},amber:{light:["#fffbeb","#fde68a","#f59e0b","#d97706","#b45309"],dark:["#451a03","#78350f","#b45309","#d97706","#f59e0b"],gridColor:{light:"rgba(245, 158, 11, 0.12)",dark:"rgba(245, 158, 11, 0.08)"}}};function nt(s,x){const h=/^#([0-9a-f]{6})$/i.exec(s);if(!h)return s;const c=parseInt(h[1],16),v=c>>16&255,D=c>>8&255,Y=c&255,R=T=>Math.max(0,Math.min(255,Math.round(T*x)));return`rgb(${R(v)}, ${R(D)}, ${R(Y)})`}function O(s,x,h,c,v){const D=Math.cos(c),Y=Math.sin(c),R=s*D-x*Y,T=s*Y+x*D,E=h,S=Math.cos(v),$=Math.sin(v),q=R,p=T*S-E*$,k=T*$+E*S;return{x:q,y:p,z:k}}function st(s,x,h,c,v){return O(s,x,h,c,v)}function Ae(s,x,h=c=>Number(c).toLocaleString()){const c=h(x);if(s>=4){const v=Math.floor(Math.random()*3)+1;return n(`heatmap.3d.voxel.joke.${v}`,{value:c})}else return s===3?n("heatmap.3d.voxel.level3",{value:c}):s===2?n("heatmap.3d.voxel.level2",{value:c}):s===1?n("heatmap.3d.voxel.level1",{value:c}):n("heatmap.3d.voxel.level0")}function Se({weeks:s,palette:x="auto",isDark:h=!1,interactive:c=!1,autoRotateInit:v=!1,onResetViewRef:D=null}){const{formatTokens:Y,formatTokensTooltip:R}=Ee(),T=te[x]||(x==="auto"?te.emerald:null),E=T?h?T.dark:T.light:Array.isArray(x)?x:h?te.emerald.dark:te.emerald.light,S=T?h?T.gridColor.dark:T.gridColor.light:h?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",$=-.2,q=.88,[p,k]=i.useState({yaw:$,pitch:q}),[ce,K]=i.useState(v),[he,L]=i.useState(1),C=c?13:10.5,fe=i.useMemo(()=>{const t=[],r=s.length;if(r===0||!c)return[];for(let l=0;l<=7;l++){const o=(l-3.5)*C,d=O(-r/2*C,o,0,p.yaw,p.pitch),u=O(r/2*C,o,0,p.yaw,p.pitch);t.push({d:`M${d.x},${d.y} L${u.x},${u.y}`,key:`horiz-${l}`})}for(let l=0;l<=r;l+=4){const o=(l-r/2)*C,d=O(o,-3.5*C,0,p.yaw,p.pitch),u=O(o,3.5*C,0,p.yaw,p.pitch);t.push({d:`M${d.x},${d.y} L${u.x},${u.y}`,key:`vert-${l}`})}if(r%4!==0){const l=(r-r/2)*C,o=O(l,-3.5*C,0,p.yaw,p.pitch),d=O(l,3.5*C,0,p.yaw,p.pitch);t.push({d:`M${o.x},${o.y} L${d.x},${d.y}`,key:"vert-last"})}return t},[s.length,p,C,c]);i.useEffect(()=>{D&&(D.current={reset:()=>{k({yaw:$,pitch:q}),K(!1),L(1),be()},toggleAutoRotate:t=>{K(t)}})},[D]);const Z=i.useRef(null),I=i.useRef(null),F=i.useRef(!1),de=i.useRef({x:0,y:0}),V=i.useRef({yaw:$,pitch:q}),U=i.useRef({x:0,y:0}),oe=i.useRef({x:0,y:0,time:0}),ne=i.useRef(null),[ge,ye]=i.useState(0),J=i.useRef(null),se=i.useRef(!0);i.useEffect(()=>(se.current=!0,()=>{se.current=!1}),[]);const be=()=>{J.current&&cancelAnimationFrame(J.current),ye(0);const t=performance.now(),r=1200,l=o=>{if(!se.current)return;const d=o-t,u=Math.min(1,d/r),j=1-Math.pow(1-u,3);ye(j),u<1?J.current=requestAnimationFrame(l):J.current=null};J.current=requestAnimationFrame(l)};i.useEffect(()=>(be(),()=>{J.current&&cancelAnimationFrame(J.current)}),[c]),i.useEffect(()=>{if(!ce||F.current||typeof window>"u"||typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let r;const l=()=>{if(typeof document<"u"&&document.visibilityState==="hidden"){r=requestAnimationFrame(l);return}k(o=>({yaw:o.yaw+.002,pitch:o.pitch})),r=requestAnimationFrame(l)};return r=requestAnimationFrame(l),()=>cancelAnimationFrame(r)},[ce]);const me=(t,r)=>{c&&(F.current=!0,de.current={x:t,y:r},V.current={yaw:p.yaw,pitch:p.pitch},U.current={x:0,y:0},oe.current={x:t,y:r,time:performance.now()},ne.current&&cancelAnimationFrame(ne.current))},X=(t,r)=>{if(!F.current)return;const l=t-de.current.x,o=r-de.current.y,d=performance.now(),u=d-oe.current.time;u>0&&(U.current={x:(t-oe.current.x)/u,y:(r-oe.current.y)/u}),oe.current={x:t,y:r,time:d};const j=.005,f=V.current.yaw-l*j,g=Math.PI/2.3,P=Math.max(-g,Math.min(g,V.current.pitch-o*j));k({yaw:f,pitch:P})},ve=()=>{if(!F.current)return;F.current=!1;let t=-U.current.x*12,r=-U.current.y*12;const l=.95,o=()=>{F.current||(t*=l,r*=l,!(Math.abs(t)<.01&&Math.abs(r)<.01)&&(k(d=>{const u=d.yaw+t*.005,j=Math.PI/2.3,f=Math.max(-j,Math.min(j,d.pitch+r*.005));return{yaw:u,pitch:f}}),ne.current=requestAnimationFrame(o)))};ne.current=requestAnimationFrame(o)},[y,xe]=i.useState(null),[Q,pe]=i.useState({x:0,y:0,shiftX:0}),b=i.useRef(null);i.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[]),i.useEffect(()=>{if(!c||!I.current)return;const t=l=>{l.preventDefault();const o=-l.deltaY*.0025;L(d=>{const u=d+o;return Math.max(.5,Math.min(3,u))})},r=I.current;return r.addEventListener("wheel",t,{passive:!1}),()=>{r.removeEventListener("wheel",t)}},[c]);const z=i.useMemo(()=>{const t=[];return s.forEach((r,l)=>{(Array.isArray(r)?r:[]).forEach((o,d)=>{o&&t.push({key:o.day||`${l}-${d}`,col:l,row:d,level:o.level||0,value:o.value||0,day:o.day,models:o.models||null})})}),t},[s]),ke=C-(c?1.8:1.5),we=c?38:28,ee=t=>Math.max(1.8,Number(t)/4*we),ae=i.useMemo(()=>{if(z.length===0)return[];const t=s.length;return z.map(r=>{const l=ee(r.level),o=Math.sqrt(Math.pow(r.col-t/2,2)+Math.pow(r.row-3.5,2)),d=Math.sqrt(Math.pow(t/2,2)+Math.pow(3.5,2)),u=o/d*.4,j=Math.min(1,Math.max(0,(ge-u)*(1/.6))),f=l*j,g=(r.col-t/2)*C,P=(r.row-3.5)*C,N=ke/2,G=[{x:g-N,y:P-N,z:0},{x:g+N,y:P-N,z:0},{x:g+N,y:P+N,z:0},{x:g-N,y:P+N,z:0},{x:g-N,y:P-N,z:f},{x:g+N,y:P-N,z:f},{x:g+N,y:P+N,z:f},{x:g-N,y:P+N,z:f}].map(W=>O(W.x,W.y,W.z,p.yaw,p.pitch)),ue=O(g,P,f/2,p.yaw,p.pitch),Le=[{name:"top",indices:[4,5,6,7],scale:1,normal:[0,0,1]},{name:"bottom",indices:[3,2,1,0],scale:.4,normal:[0,0,-1]},{name:"left",indices:[3,0,4,7],scale:.55,normal:[-1,0,0]},{name:"right",indices:[1,2,6,5],scale:.75,normal:[1,0,0]},{name:"front",indices:[0,1,5,4],scale:.85,normal:[0,-1,0]},{name:"back",indices:[2,3,7,6],scale:.65,normal:[0,1,0]}],Pe=E[Math.min(4,Math.max(0,Number(r.level)||0))],ze=[],De=.35,Ye=-.4,Ue=.83;return Le.forEach(W=>{const je=st(W.normal[0],W.normal[1],W.normal[2],p.yaw,p.pitch);if(je.z>.001){const Me=G[W.indices[0]],Te=G[W.indices[1]],_e=G[W.indices[2]],$e=G[W.indices[3]],Xe=`M${Me.x},${Me.y} L${Te.x},${Te.y} L${_e.x},${_e.y} L${$e.x},${$e.y} Z`,Be=je.x*De+je.y*Ye+je.z*Ue,We=h?.18:0,Fe=W.scale*(.82+.28*Math.max(0,Be))+We;ze.push({name:W.name,d:Xe,fill:nt(Pe,Fe)})}}),{...r,centerProj:ue,renderedFaces:ze}})},[z,p,E,s.length,ge,C,ke,we]),le=i.useMemo(()=>[...ae].sort((t,r)=>t.centerProj.z-r.centerProj.z),[ae]),_=i.useMemo(()=>{if(le.length===0)return{minX:-100,minY:-100,maxX:100,maxY:100};let t=1/0,r=1/0,l=-1/0,o=-1/0;return le.forEach(d=>{const u=C*2,j=d.centerProj.x,f=d.centerProj.y;j-u<t&&(t=j-u),j+u>l&&(l=j+u),f-u<r&&(r=f-u),f+u>o&&(o=f+u)}),{minX:t,minY:r,maxX:l,maxY:o}},[le,C]),A=12,a=_.maxX-_.minX+A*2,m=_.maxY-_.minY+A*2,M=a/he,w=m/he,B=_.minX-A+(a-M)/2,H=_.minY-A+(m-w)/2,ie=`${B} ${H} ${M} ${w}`;return z.length===0?e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:n("heatmap.empty")}):e.jsxs("div",{ref:I,className:`relative select-none outline-none ${c?"cursor-grab active:cursor-grabbing w-full h-full flex items-center justify-center":"w-full overflow-hidden flex justify-center"}`,onMouseDown:t=>{if(!c)return;me(t.clientX,t.clientY);const r=o=>X(o.clientX,o.clientY),l=()=>{ve(),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",l)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",l)},onTouchStart:t=>{!c||t.touches.length===0||me(t.touches[0].clientX,t.touches[0].clientY)},onTouchMove:t=>{!c||t.touches.length===0||X(t.touches[0].clientX,t.touches[0].clientY)},onTouchEnd:()=>{c&&ve()},children:[e.jsxs("svg",{ref:Z,viewBox:ie,width:c?"95%":"100%",height:c?"95%":"auto",role:"img","aria-label":n("heatmap.iso.aria")||"3D interactive activity heatmap",style:{display:"block",width:"100%",height:"auto",maxWidth:c?"none":`${a}px`,maxHeight:c?"78vh":"none"},className:"transition-transform duration-300 ease-out",children:[c&&fe.map(t=>e.jsx("path",{d:t.d,fill:"none",stroke:S,strokeWidth:.25,strokeDasharray:"1.5 2.5",strokeLinecap:"round"},t.key)),le.map(t=>{const r=y&&y.key===t.key;return e.jsxs("g",{onMouseEnter:l=>{if(b.current&&(clearTimeout(b.current),b.current=null),xe(t),c&&Z.current){const o=O((t.col-s.length/2)*C,(t.row-3.5)*C,ee(t.level),p.yaw,p.pitch);let d=0,u=0;const j=Z.current;if(I.current&&typeof j.createSVGPoint=="function"&&typeof j.getScreenCTM=="function")try{const N=j.createSVGPoint();N.x=o.x,N.y=o.y;const re=j.getScreenCTM();if(re){const G=N.matrixTransform(re),ue=I.current.getBoundingClientRect();d=G.x-ue.left,u=G.y-ue.top}}catch{const re=j.getBoundingClientRect(),G=_.maxX-_.minX+A*2,ue=_.maxY-_.minY+A*2;d=(o.x-(_.minX-A))/G*re.width,u=(o.y-(_.minY-A))/ue*re.height}else{const N=j.getBoundingClientRect(),re=_.maxX-_.minX+A*2,G=_.maxY-_.minY+A*2;d=(o.x-(_.minX-A))/re*N.width,u=(o.y-(_.minY-A))/G*N.height}const f=140;let g=0;const P=I.current?I.current.getBoundingClientRect().width:j.getBoundingClientRect().width;d<f?g=f-d:d>P-f&&(g=P-f-d),pe({x:d,y:u,shiftX:g})}},onMouseLeave:()=>{b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{xe(null)},150)},className:"transition-all duration-200",style:{filter:r?"brightness(1.15) drop-shadow(0 4px 6px rgba(0,0,0,0.15))":"none",cursor:c?"pointer":"default"},children:[!c&&t.day&&e.jsx("title",{children:`${t.day}: ${R(t.value)} tokens`}),t.renderedFaces.map((l,o)=>e.jsx("path",{d:l.d,fill:l.fill,stroke:l.fill,strokeWidth:.25,strokeLinejoin:"round"},o))]},t.key)})]}),c&&y&&e.jsxs("div",{onMouseEnter:()=>{b.current&&(clearTimeout(b.current),b.current=null)},onMouseLeave:()=>{b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{xe(null)},150)},className:"absolute z-[9999] w-0 h-0 transition-all duration-100 ease-out",style:{left:`${Q.x}px`,top:`${Q.y}px`},children:[e.jsxs("div",{className:"absolute left-0 bottom-[10px] backdrop-blur-md bg-white/90 dark:bg-oai-gray-900/90 border border-oai-gray-200/50 dark:border-oai-gray-800/50 shadow-xl rounded-xl p-3.5 max-w-[280px] min-w-[200px] flex flex-col gap-2 animate-in fade-in zoom-in-95 duration-100",style:{transform:`translateX(calc(-50% + ${Q.shiftX}px))`},children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-oai-gray-100 dark:border-oai-gray-800/80 pb-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold text-oai-gray-500 dark:text-oai-gray-400",children:y.day}),(()=>{const t=y.level===0?h?"#9ca3af":"#6b7280":E[y.level];return e.jsxs("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-medium",style:{backgroundColor:t+"22",color:t,border:`1px solid ${t}44`},children:["Level ",y.level]})})()]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{title:R(y.value),className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:Y(y.value)}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:"Tokens"})]}),y.models&&Object.keys(y.models).length>0?e.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:[e.jsx("div",{className:"text-[10px] font-semibold text-oai-gray-400 dark:text-oai-gray-500 uppercase tracking-wider",children:"Model Breakdown"}),e.jsx("div",{className:"flex flex-col gap-2 max-h-[150px] overflow-y-auto pr-1.5 scrollbar-thin",children:Object.entries(y.models).map(([t,r])=>({name:t,val:Number(r)})).sort((t,r)=>r.val-t.val).map(({name:t,val:r})=>{const l=Number(y.value)||1,o=Math.round(r/l*100);return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] gap-3",children:[e.jsx("span",{className:"font-medium text-oai-gray-750 dark:text-oai-gray-200 truncate max-w-[120px]",title:t,children:t}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("span",{title:R(r),className:"font-mono text-oai-gray-900 dark:text-oai-gray-100 font-semibold",children:Y(r)}),e.jsxs("span",{className:"text-[9px] text-oai-gray-450 dark:text-oai-gray-500 min-w-[28px] text-right font-medium",children:[o,"%"]})]})]}),e.jsx("div",{className:"w-full h-1 bg-oai-gray-100 dark:bg-oai-gray-800/85 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${o}%`,backgroundColor:E[4],boxShadow:`0 0 4px ${E[4]}55`}})})]},t)})})]}):e.jsx("p",{className:"text-[11px] text-oai-gray-600 dark:text-oai-gray-300 leading-relaxed font-normal mt-1 border-t border-dashed border-oai-gray-100 dark:border-oai-gray-800/60 pt-1.5",children:Ae(y.level,y.value,Y)})]})]}),e.jsx("div",{className:"absolute bottom-[6px] left-0 -translate-x-1/2 w-2.5 h-2.5 rotate-45 bg-white dark:bg-oai-gray-900 border-r border-b border-oai-gray-200/50 dark:border-oai-gray-800/50 shadow-sm",style:{marginBottom:"1px"}})]})]})}const lt=12,it=3,ct=26,dt=["#ebedf0","#a7f3d0","#6ee7b7","#34d399","#10b981"],mt=["#121212","#065f46","#059669","#10b981","#34d399"];function xt(s){if(typeof s!="string")return null;const x=/^(\d{4})-(\d{2})-(\d{2})$/.exec(s.trim());if(!x)return null;const h=new Date(Date.UTC(Number(x[1]),Number(x[2])-1,Number(x[3])));return Number.isFinite(h.getTime())?h:null}function Re(s,x){return new Date(Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()+x))}function ut(s,x){return Math.floor((Date.UTC(x.getUTCFullYear(),x.getUTCMonth(),x.getUTCDate())-Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()))/864e5)}function pt(s,x){const h=x==="mon"?1:0,c=s.getUTCDay();return Re(s,-((c-h+7)%7))}function ht(s,x,h,c){if(!s)return[];const v=xt(x)||new Date,D=[];for(let S=11;S>=0;S-=1)D.push(new Date(Date.UTC(v.getUTCFullYear(),v.getUTCMonth()-S,1)));const Y=pt(v,h),R=Re(Y,-(s-1)*7),T=[],E=new Set;for(const S of D){const $=Math.floor(ut(R,S)/7);$<0||$>=s||E.has($)||(E.add($),T.push({label:c[S.getUTCMonth()],index:$}))}return T}function jt({heatmap:s,timeZoneLabel:x,timeZoneShortLabel:h,hideLegend:c=!1,embedded:v=!1}){const{resolvedTheme:D}=Ie(),{currency:Y,rate:R}=Ke(),{formatTokens:T,formatTokensTooltip:E}=Ee(),S=D==="dark",$=S?mt:dt,q=i.useRef(null),p=i.useRef(null),[k,ce]=i.useState(null),[K,he]=i.useState({x:0,y:0,shiftX:0,flipY:!1}),L=i.useRef(null);i.useEffect(()=>()=>{L.current&&clearTimeout(L.current)},[]);const[C,fe]=i.useState(!1),[Z,I]=i.useState(!1),[F,de]=i.useState(!1),V=i.useRef(null),[U,oe]=i.useState("emerald"),ne=[n("heatmap.month.jan"),n("heatmap.month.feb"),n("heatmap.month.mar"),n("heatmap.month.apr"),n("heatmap.month.may"),n("heatmap.month.jun"),n("heatmap.month.jul"),n("heatmap.month.aug"),n("heatmap.month.sep"),n("heatmap.month.oct"),n("heatmap.month.nov"),n("heatmap.month.dec")],ge=(a,m)=>{if(!m||!m.day)return;L.current&&(clearTimeout(L.current),L.current=null),ce(m);const M=a.currentTarget.getBoundingClientRect(),w=typeof window<"u"?window.innerWidth:1024,B=M.left+M.width/2,H=M.top<300,ie=H?M.bottom:M.top,t=140;let r=0;B<t?r=t-B:B>w-t&&(r=w-t-B),he({x:B,y:ie,shiftX:r,flipY:H})},ye=()=>{L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{ce(null)},150)},J=()=>{I(!1),fe(!0)},se=()=>{I(!0)},be=a=>{a.target===a.currentTarget&&Z&&(fe(!1),I(!1))};i.useEffect(()=>{if(!C||Z)return;const a=m=>{m.key==="Escape"&&se()};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[C,Z]);const me=i.useMemo(()=>({emerald:{accentText:"text-emerald-500 dark:text-emerald-400",accentBg:"bg-emerald-500/10 dark:bg-emerald-400/10",accentBorder:"border-emerald-500/20 dark:border-emerald-400/15",hoverBorder:"hover:border-emerald-500/30 dark:hover:border-emerald-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(16,185,129,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(52,211,153,0.25)]",rawColor:"#10b981"},ocean:{accentText:"text-blue-500 dark:text-blue-400",accentBg:"bg-blue-500/10 dark:bg-blue-400/10",accentBorder:"border-blue-500/20 dark:border-blue-400/15",hoverBorder:"hover:border-blue-500/30 dark:hover:border-blue-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(59,130,246,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(96,165,250,0.25)]",rawColor:"#3b82f6"},neon:{accentText:"text-purple-500 dark:text-purple-400",accentBg:"bg-purple-500/10 dark:bg-purple-400/10",accentBorder:"border-purple-500/20 dark:border-purple-400/15",hoverBorder:"hover:border-purple-500/30 dark:hover:border-purple-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(168,85,247,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(192,132,252,0.25)]",rawColor:"#a855f7"},amber:{accentText:"text-amber-500 dark:text-amber-400",accentBg:"bg-amber-500/10 dark:bg-amber-400/10",accentBorder:"border-amber-500/20 dark:border-amber-400/15",hoverBorder:"hover:border-amber-500/30 dark:hover:border-amber-400/30",hoverGlow:"hover:shadow-[0_0_20px_-3px_rgba(245,158,11,0.15)] hover:dark:shadow-[0_0_20px_-3px_rgba(245,158,11,0.25)]",rawColor:"#f59e0b"}}),[]),X=me[U]||me.emerald,ve=te[U]?S?te[U].dark:te[U].light:S?te.emerald.dark:te.emerald.light,[y,xe]=i.useState(()=>{if(v)return"2d";try{return window.localStorage?.getItem("tt:heatmap-view")==="3d"?"3d":"2d"}catch{return"2d"}});i.useEffect(()=>{if(!v)try{window.localStorage?.setItem("tt:heatmap-view",y)}catch{}},[y,v]),i.useEffect(()=>{if(y!=="2d")return;const a=q.current;a&&(a.scrollLeft=a.scrollWidth)},[s?.weeks,y]),i.useEffect(()=>{const a=q.current;if(!a)return;const m=()=>{L.current&&(clearTimeout(L.current),L.current=null),ce(null)};return a.addEventListener("scroll",m),()=>a.removeEventListener("scroll",m)},[]);const Q=s?.week_starts_on==="mon"?"mon":"sun",pe=i.useMemo(()=>{const a=Array.isArray(s?.weeks)?s.weeks:[];if(!a.length)return{weeks:[]};const m=[];for(const M of a)for(const w of Array.isArray(M)?M:[])w?.day&&m.push({day:w.day,total_tokens:w.total_tokens??w.value??0,billable_total_tokens:w.billable_total_tokens??w.value??w.total_tokens??0,models:w.models??null});return He({dailyRows:m,weeks:Math.max(52,a.length),to:s?.to,weekStartsOn:Q})},[s?.to,s?.weeks,Q]),b=pe?.weeks||[],z=i.useMemo(()=>{let a=0,m=0,M={day:"无数据",value:0},w=0,B=0;const H=[];b.forEach(f=>{(Array.isArray(f)?f:[]).forEach(g=>{g&&g.day&&H.push(g)})}),H.sort((f,g)=>f.day.localeCompare(g.day)),H.forEach(f=>{const g=Number(f.value)||0;a+=g,g>0?(m++,w++,w>B&&(B=w)):w=0,g>M.value&&(M={day:f.day,value:g})});const ie=H.length||365,t=(m/ie*100).toFixed(1);let r="heatmap.3d.modal.ai.eval.default",l="heatmap.3d.modal.ai.title.default";a>=15e6?(l="heatmap.3d.modal.ai.title.peak",r="heatmap.3d.modal.ai.eval.peak"):a>=5e6?(l="heatmap.3d.modal.ai.title.heavy",r="heatmap.3d.modal.ai.eval.heavy"):a>=1e6?(l="heatmap.3d.modal.ai.title.core",r="heatmap.3d.modal.ai.eval.core"):a>=2e4&&(l="heatmap.3d.modal.ai.title.steady",r="heatmap.3d.modal.ai.eval.steady");const o=s?.total_cost_usd,d=Number(o),j=o!=null&&(typeof o!="string"||o.trim()!=="")&&Number.isFinite(d)?d:a/15e5;return{totalTokens:a,activeDays:m,activeRate:t,maxSingleDay:M,maxStreak:B,aiEvaluationTitleKey:l,aiEvaluationKey:r,totalCostUsd:j}},[b,s?.total_cost_usd]),Ce=i.useMemo(()=>Ge(z.totalCostUsd,{currency:Y,rate:R}),[z.totalCostUsd,Y,R]),ke=Q==="mon"?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map(a=>n(`heatmap.day.${a.toLowerCase()}`)):["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(a=>n(`heatmap.day.${a.toLowerCase()}`)),we=i.useMemo(()=>ht(b.length,pe?.to,Q,ne),[pe?.to,b.length,Q,ne]);if(!b.length)return e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:n("heatmap.empty")});const ee=v?10:lt,ae=v?2:it,le=v?22:ct,_=le+b.length*ee+Math.max(0,b.length-1)*ae,A=`${le}px repeat(${b.length}, ${ee}px)`;return e.jsxs("div",{ref:p,className:v?"relative":"relative rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5",children:[!v&&e.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:n("heatmap.title")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{role:"tablist","aria-label":"Heatmap view",className:"flex rounded-md border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 text-[10px]",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":y==="2d",onClick:()=>xe("2d"),className:y==="2d"?"px-2 py-0.5 rounded bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-oai-white font-medium":"px-2 py-0.5 rounded text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200",children:n("heatmap.view.2d")}),e.jsx("button",{type:"button",role:"tab","aria-selected":y==="3d",onClick:()=>xe("3d"),className:y==="3d"?"px-2 py-0.5 rounded bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-oai-white font-medium":"px-2 py-0.5 rounded text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200",children:n("heatmap.view.3d")})]}),e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-450",children:h||n("heatmap.legend.utc")})]})]}),y==="3d"&&e.jsxs("div",{onClick:J,className:"cursor-pointer group relative overflow-hidden rounded-lg hover:border-oai-gray-350 dark:hover:border-oai-gray-700 border border-transparent transition-all",title:n("heatmap.3d.hover_tip"),children:[e.jsx(Se,{weeks:b,isDark:S,palette:U}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-oai-gray-900/5 to-transparent pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity flex items-end justify-center pb-2",children:e.jsxs("span",{className:"text-[10px] bg-white/95 dark:bg-oai-gray-900/95 shadow border border-oai-gray-200/60 dark:border-oai-gray-800/80 px-2.5 py-1 rounded-full font-medium text-oai-gray-500 dark:text-oai-gray-400 flex items-center gap-1 transform translate-y-2 group-hover:translate-y-0 transition-transform duration-200",children:[e.jsx(Ze,{size:9}),n("heatmap.3d.hover_tip")]})})]}),y==="2d"&&e.jsx("div",{ref:q,className:`overflow-x-auto overflow-y-hidden heatmap-scroll-thin${v?"":" pb-1"}`,children:e.jsxs("div",{style:{minWidth:_},children:[e.jsxs("div",{className:"grid text-[10px] uppercase text-oai-gray-400 dark:text-oai-gray-400 mb-1",style:{gridTemplateColumns:A,columnGap:ae},children:[e.jsx("span",{}),we.map(a=>e.jsx("span",{style:{gridColumnStart:a.index+2},className:"whitespace-nowrap",children:a.label},`${a.label}-${a.index}`))]}),e.jsxs("div",{className:"grid",style:{gridTemplateColumns:A,columnGap:ae},children:[e.jsx("div",{className:"grid text-[10px] text-oai-gray-400 dark:text-oai-gray-400 sticky left-0 bg-white dark:bg-oai-gray-900 pr-2",style:{gridTemplateRows:`repeat(7, ${ee}px)`,rowGap:ae},children:ke.map(a=>e.jsx("span",{className:"leading-none",children:a},a))}),e.jsx("div",{className:"grid",style:{gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${ee}px)`,gap:ae},children:b.map((a,m)=>(Array.isArray(a)?a:[]).map((M,w)=>{if(!M)return null;const B=M.day||`e-${m}-${w}`,H=Number(M.level)||0,ie=$[H]||$[0];return e.jsx("span",{onMouseEnter:t=>ge(t,M),onMouseLeave:ye,className:"rounded-[2px] transition-transform hover:scale-125 hover:z-10 cursor-pointer",style:{width:ee,height:ee,background:ie}},B)}))})]})]})}),!c&&e.jsxs("div",{className:"flex items-center justify-center gap-2 mt-3",children:[e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:n("heatmap.legend.less")}),e.jsx("div",{className:"flex gap-0.5",children:$.map((a,m)=>e.jsx("span",{className:"rounded-[1px]",style:{width:10,height:10,background:a}},m))}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:n("heatmap.legend.more")})]}),C&&e.jsx("div",{onAnimationEnd:be,onClick:a=>{a.target===a.currentTarget&&se()},className:`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 ${Z?"animate-tt-fade-out":"animate-tt-fade-in"}`,children:e.jsxs("div",{className:`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 ${Z?"animate-tt-modal-exit":"animate-tt-modal"}`,children:[e.jsx("button",{type:"button",onClick:se,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:e.jsx(Oe,{size:16})}),e.jsxs("div",{className:"w-full md:w-[340px] 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:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:X.rawColor}}),e.jsx("span",{className:"relative inline-flex rounded-full h-1.5 w-1.5",style:{backgroundColor:X.rawColor}})]}),e.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono text-zinc-400 dark:text-zinc-500",children:"3D Insight"})]}),e.jsx("h4",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight leading-none mt-2 select-none",children:n("heatmap.3d.modal.title")}),e.jsx("p",{className:"text-[11px] leading-relaxed text-zinc-400 dark:text-zinc-500 mt-2 font-normal select-none",children:n("heatmap.3d.modal.desc")})]}),e.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:[e.jsxs("div",{className:"flex flex-col gap-1 relative group cursor-help",children:[e.jsx("div",{className:"absolute left-0 bottom-full mb-2 pointer-events-none opacity-0 translate-y-1 group-hover:opacity-100 group-hover:translate-y-0 transition-all duration-200 z-50",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-950 text-zinc-900 dark:text-zinc-50 text-[10px] font-semibold font-mono rounded-lg px-2.5 py-1.5 shadow-xl border border-zinc-200 dark:border-zinc-800/80 whitespace-nowrap flex flex-col",children:[e.jsx("span",{className:"text-[9px] text-zinc-400 dark:text-zinc-500",children:n("heatmap.3d.modal.stats.precision_total_tokens")}),e.jsxs("span",{className:"mt-0.5 font-bold text-zinc-900 dark:text-zinc-50",children:[E(z.totalTokens)," Tokens"]})]})}),e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.stats.total_tokens")}),e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:T(z.totalTokens,{decimals:2})}),e.jsx("div",{className:"opacity-30 group-hover:opacity-60 transition-opacity",children:e.jsx("svg",{width:"24",height:"10",viewBox:"0 0 24 10",fill:"none",children:e.jsx("path",{d:"M1 9C3 7 5 7 7 4C9 1 11 0 13 2C15 4 17 0 23 0",stroke:X.rawColor,strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 group cursor-default",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.stats.estimated_cost")}),e.jsx("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:Ce})]}),e.jsxs("div",{className:"flex flex-col gap-1 group cursor-default",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.stats.active_rate_days")}),e.jsxs("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:[z.activeRate,"% ",e.jsxs("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono",children:["(",z.activeDays,"D)"]})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 group cursor-default",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.stats.max_streak")}),e.jsxs("span",{className:"text-xl font-black text-amber-500 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:[z.maxStreak," ",e.jsx("span",{className:"text-[10px] font-bold text-amber-500/80 font-mono",children:n("heatmap.3d.modal.stats.days_suffix")})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 col-span-2 relative group cursor-help",children:[e.jsx("div",{className:"absolute left-0 bottom-full mb-2 pointer-events-none opacity-0 translate-y-1 group-hover:opacity-100 group-hover:translate-y-0 transition-all duration-200 z-50",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-950 text-zinc-900 dark:text-zinc-50 text-[10px] font-semibold font-mono rounded-lg px-2.5 py-1.5 shadow-xl border border-zinc-200 dark:border-zinc-800/80 whitespace-nowrap flex flex-col",children:[e.jsx("span",{className:"text-[9px] text-zinc-400 dark:text-zinc-500",children:n("heatmap.3d.modal.stats.precision_peak_value")}),e.jsxs("span",{className:"mt-0.5 font-bold text-zinc-900 dark:text-zinc-50",children:[z.maxSingleDay.value>0?E(z.maxSingleDay.value):n("heatmap.3d.modal.stats.no_data")," Tokens"]}),e.jsx("span",{className:"text-[8px] text-zinc-400 dark:text-zinc-500 mt-0.5",children:z.maxSingleDay.day!=="无数据"?z.maxSingleDay.day:n("heatmap.3d.modal.stats.no_data")})]})}),e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.stats.peak_day")}),e.jsxs("span",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight font-mono transition-transform duration-200 group-hover:-translate-y-[1px]",children:[z.maxSingleDay.value>0?T(z.maxSingleDay.value,{decimals:2}):n("heatmap.3d.modal.stats.no_data")," ",e.jsxs("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono",children:["(",z.maxSingleDay.day!=="无数据"?z.maxSingleDay.day:n("heatmap.3d.modal.stats.no_data"),")"]})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-2.5 py-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[e.jsx(Ve,{size:11,style:{color:X.rawColor}}),e.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono",style:{color:X.rawColor},children:n(z.aiEvaluationTitleKey)})]}),e.jsxs("div",{className:"pl-3.5 border-l-2 relative transition-all duration-300 group",style:{borderColor:X.rawColor},children:[e.jsx("div",{className:"absolute inset-y-0 left-0 w-[3px] blur-[2px] opacity-15 pointer-events-none rounded-full",style:{backgroundColor:X.rawColor}}),e.jsx("p",{className:"text-[11px] leading-relaxed text-zinc-600 dark:text-zinc-400 font-normal",children:n(z.aiEvaluationKey)})]})]}),e.jsx("div",{className:"mt-auto border-t border-zinc-200/50 dark:border-zinc-800/50 pt-4 select-none",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:n("heatmap.3d.modal.legend.title")}),e.jsx("span",{className:"text-[10px] font-medium text-zinc-500 dark:text-zinc-400",children:n(`heatmap.3d.modal.palette.${U}`)})]}),e.jsx("div",{className:"flex gap-1",children:ve.map((a,m)=>e.jsx("div",{className:"flex-1 h-1 rounded-[2px]",style:{backgroundColor:a},title:`Level ${m}`},m))})]})})]}),e.jsxs("div",{className:"flex-1 h-full relative flex items-center justify-center overflow-hidden p-4",children:[e.jsx("div",{className:"absolute top-1/4 left-1/3 w-96 h-96 rounded-full blur-[130px] pointer-events-none -translate-x-1/2 -translate-y-1/2 transition-all duration-500",style:{backgroundColor:X.rawColor+"15"}}),e.jsx("div",{className:"absolute bottom-1/4 right-1/3 w-80 h-80 rounded-full blur-[120px] pointer-events-none translate-x-1/2 translate-y-1/2 bg-purple-500/[0.04] dark:bg-purple-500/[0.08]"}),e.jsxs("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 flex items-center gap-3 p-1.5 backdrop-blur-md bg-white/70 dark:bg-oai-gray-900/75 border border-oai-gray-200/60 dark:border-oai-gray-800/80 rounded-full shadow-lg z-30 select-none",children:[e.jsx("div",{className:"flex items-center gap-1.5 px-2",children:Object.keys(me).map(a=>{const m=U===a;return e.jsx("button",{type:"button",onClick:()=>oe(a),title:n(`heatmap.3d.modal.palette.${a}`),className:`w-3.5 h-3.5 rounded-full transition-all duration-200 relative hover:scale-125 ${a==="emerald"?"bg-[#10b981]":a==="ocean"?"bg-[#3b82f6]":a==="neon"?"bg-[#a855f7]":"bg-[#f59e0b]"}`,children:m&&e.jsx("span",{className:"absolute inset-0 rounded-full ring-2 ring-offset-1 ring-offset-white dark:ring-offset-oai-gray-900 ring-oai-gray-900 dark:ring-white scale-110"})},a)})}),e.jsx("div",{className:"w-[1px] h-4 bg-oai-gray-200 dark:bg-oai-gray-800"}),e.jsxs("div",{className:"flex items-center gap-1 pr-1",children:[e.jsx("button",{type:"button",onClick:()=>{const a=!F;de(a),V.current&&V.current.toggleAutoRotate(a)},title:F?n("heatmap.3d.modal.control.pause"):n("heatmap.3d.modal.control.play"),className:`p-1.5 rounded-full transition-all duration-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 ${F?X.accentText:"text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-250"}`,children:F?e.jsx(et,{size:12}):e.jsx(at,{size:12})}),e.jsx("button",{type:"button",onClick:()=>{de(!1),V.current&&V.current.reset()},title:n("heatmap.3d.modal.control.reset"),className:"p-1.5 rounded-full text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-250 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-all duration-200",children:e.jsx(ot,{size:12})})]})]}),e.jsx(Se,{weeks:b,isDark:S,interactive:!0,palette:U,autoRotateInit:F,onResetViewRef:V}),e.jsxs("div",{className:"absolute bottom-4 right-4 flex items-center gap-1.5 text-[9px] font-bold text-oai-gray-400 bg-white/80 dark:bg-oai-gray-900/80 border border-oai-gray-200/50 dark:border-oai-gray-800/80 rounded-md px-2.5 py-1.5 select-none pointer-events-none backdrop-blur-md shadow-sm",children:[e.jsx(Je,{size:10,className:X.accentText}),e.jsx("span",{children:n("heatmap.3d.modal.footer.tip")})]})]})]})}),k&&!C&&typeof document<"u"&&qe.createPortal(e.jsxs("div",{className:"fixed z-[9999] w-0 h-0 transition-all duration-100 ease-out pointer-events-none",style:{position:"fixed",left:`${K.x}px`,top:`${K.y}px`},children:[e.jsxs("div",{className:`absolute left-0 ${K.flipY?"top-[10px]":"bottom-[10px]"} 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-[200px] flex flex-col gap-2 animate-in fade-in zoom-in-95 duration-100`,style:{transform:`translateX(calc(-50% + ${K.shiftX}px))`},children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-oai-gray-100 dark:border-oai-gray-800/80 pb-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold text-oai-gray-500 dark:text-oai-gray-400",children:k.day}),(()=>{const a=k.level===0?S?"#9ca3af":"#6b7280":$[k.level];return e.jsxs("span",{className:"text-[10px] px-2 py-0.5 rounded-full font-medium",style:{backgroundColor:a+"22",color:a,border:`1px solid ${a}44`},children:["Level ",k.level]})})()]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{title:E(k.total_tokens??k.value),className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:T(k.total_tokens??k.value)}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:"Tokens"})]}),k.models&&Object.keys(k.models).length>0?e.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:[e.jsx("div",{className:"text-[10px] font-semibold text-oai-gray-400 dark:text-oai-gray-500 uppercase tracking-wider",children:"Model Breakdown"}),e.jsx("div",{className:"flex flex-col gap-2 max-h-[150px] overflow-y-auto pr-1.5 oai-scrollbar",children:Object.entries(k.models).map(([a,m])=>({name:a,val:Number(m)})).sort((a,m)=>m.val-a.val).map(({name:a,val:m})=>{const M=Number(k.total_tokens??k.value)||1,w=Math.round(m/M*100);return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] gap-3",children:[e.jsx("span",{className:"font-medium text-oai-gray-750 dark:text-oai-gray-200 truncate max-w-[120px]",title:a,children:a}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("span",{title:E(m),className:"font-mono text-oai-gray-900 dark:text-oai-gray-100 font-semibold",children:T(m)}),e.jsxs("span",{className:"text-[9px] text-oai-gray-450 dark:text-oai-gray-500 min-w-[28px] text-right font-medium",children:[w,"%"]})]})]}),e.jsx("div",{className:"w-full h-1 bg-oai-gray-100 dark:bg-oai-gray-800/85 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${w}%`,backgroundColor:$[4],boxShadow:`0 0 4px ${$[4]}55`}})})]},a)})})]}):e.jsx("p",{className:"text-[11px] text-oai-gray-600 dark:text-oai-gray-300 leading-relaxed font-normal mt-1 border-t border-dashed border-oai-gray-100 dark:border-oai-gray-800/60 pt-1.5",children:Ae(k.level,k.total_tokens??k.value,T)})]})]}),e.jsx("div",{className:`absolute left-0 -translate-x-1/2 w-2.5 h-2.5 rotate-45 bg-white dark:bg-oai-gray-900 shadow-sm ${K.flipY?"top-[6px] border-l border-t":"bottom-[6px] border-r border-b"} border-oai-gray-200/50 dark:border-oai-gray-800/50`,style:K.flipY?{marginTop:"1px"}:{marginBottom:"1px"}})]}),document.body),e.jsx("style",{children:`
2
- @keyframes tt-fade-in {
3
- from { opacity: 0; }
4
- to { opacity: 1; }
5
- }
6
- @keyframes tt-fade-out {
7
- from { opacity: 1; }
8
- to { opacity: 0; }
9
- }
10
- @keyframes tt-modal-entrance {
11
- from {
12
- opacity: 0;
13
- transform: scale(0.96) translateY(10px);
14
- }
15
- to {
16
- opacity: 1;
17
- transform: scale(1) translateY(0);
18
- }
19
- }
20
- @keyframes tt-modal-exit {
21
- from {
22
- opacity: 1;
23
- transform: scale(1) translateY(0);
24
- }
25
- to {
26
- opacity: 0;
27
- transform: scale(0.96) translateY(10px);
28
- }
29
- }
30
- .animate-tt-fade-in {
31
- animation: tt-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
32
- }
33
- .animate-tt-fade-out {
34
- animation: tt-fade-out 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
35
- }
36
- .animate-tt-modal {
37
- animation: tt-modal-entrance 0.3s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
38
- }
39
- .animate-tt-modal-exit {
40
- animation: tt-modal-exit 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
41
- }
42
- `})]})}const ft={anythingllm:"AnythingLLM"};function gt(s){return String(s||"").trim().toLowerCase().replace(/[\s_-]+/g,"")}function Nt(s){const x=String(s||"").trim();if(!x)return"";const h=ft[gt(x)];return h||x.charAt(0).toUpperCase()+x.slice(1)}export{jt as A,Nt as f};
@@ -1 +0,0 @@
1
- import{r as y,c as h,Z as S,$ as K,a0 as _}from"./__vite-browser-external-Eoyj4eG-.js";import{l as v}from"./limits-providers-13af4PEg.js";const f="tt.limitAlerts.enabled";function E(){try{return window.localStorage.getItem(f)==="1"}catch{return!1}}function R(){const[e,t]=y.useState(E),i=y.useCallback(async w=>{const c=!!w;c&&typeof Notification<"u"&&Notification.permission==="default"&&await Notification.requestPermission().catch(()=>"denied");try{window.localStorage.setItem(f,c?"1":"0")}catch{}t(c)},[]);return{enabled:e,setEnabled:i}}function F(e,t){if(!(e>0))return null;const i=(e-t)/e;return Number.isFinite(i)?Math.min(Math.max(i,0),1):null}function P(e,t,i=.03){return e>t+i}function M(e){const t=Math.max(0,Math.floor(e)),i=Math.floor(t/3600);return i>24?`${Math.floor(i/24)}d`:i>0?`${i}h`:`${Math.floor(t/60)}m`}function x(e,t){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&t){const i=t[e.windowSecondsField];return typeof i=="number"&&i>0?i:null}return null}function N(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function I({usedPercent:e,windowSeconds:t,resetMs:i,mode:w,now:c=Date.now()}){const n=Math.min(Math.max(Number(e)||0,0),100)/100,s={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(t>0)||!Number.isFinite(i))return s;const l=Math.max(0,(i-c)/1e3),r=F(t,l);if(r==null)return s;if(s.expectedPercent=Math.round(r*100),s.paceOver=P(n,r),n>=.05){const u=w==="remaining"?1-r:r;s.pacePercent=u*100}if(r>.02&&n>0){const u=t*r,d=n/u,m=n/r;m>=1&&d>0?s.runsOutEta=M((1-n)/d):s.projectedEnd=Math.round(Math.min(m,1)*100)}return s}const L={claude:{windows(e){const t=Array.isArray(e.weekly_scoped)?e.weekly_scoped.map(i=>({key:`scoped-${i.label}`,label:i.label,window:i,pctField:"utilization",resetField:"resets_at",windowSeconds:604800})):[];return[{key:"5h",labelKey:"limits.label.claude_5h",window:e.five_hour,pctField:"utilization",resetField:"resets_at",windowSeconds:5*3600},{key:"7d",labelKey:"limits.label.claude_7d",window:e.seven_day,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},{key:"opus",labelKey:"limits.label.claude_opus",window:e.seven_day_opus,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},...t]}},codex:{extra:"codex_meta",windows(e){return[{key:"5h",labelKey:"limits.label.codex_5h",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"7d",labelKey:"limits.label.codex_7d",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"credits",labelKey:"limits.label.codex_credits",window:e.credit_window},{key:"spark-5h",labelKey:"limits.label.codex_spark_5h",window:e.spark_primary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-7d",labelKey:"limits.label.codex_spark_7d",window:e.spark_secondary_window,windowSecondsField:"limit_window_seconds"}]}},cursor:{windows(e){return[{key:"plan",labelKey:"limits.label.cursor_plan",window:e.primary_window},{key:"auto",labelKey:"limits.label.cursor_auto",window:e.secondary_window},{key:"api",labelKey:"limits.label.cursor_api",window:e.tertiary_window}]}},gemini:{windows(e){return[{key:"pro",labelKey:"limits.label.gemini_pro",window:e.primary_window},{key:"flash",labelKey:"limits.label.gemini_flash",window:e.secondary_window},{key:"lite",labelKey:"limits.label.gemini_lite",window:e.tertiary_window}]}},kimi:{extra:"kimi_parallel",windows(e){return[{key:"weekly",labelKey:"limits.label.kimi_weekly",window:e.primary_window,windowSeconds:7*86400},{key:"5h",labelKey:"limits.label.kimi_5h",window:e.secondary_window,windowSeconds:5*3600},{key:"total",labelKey:"limits.label.kimi_total",window:e.tertiary_window}]}},kiro:{windows(e){return[{key:"month",labelKey:"limits.label.kiro_month",window:e.primary_window},{key:"bonus",labelKey:"limits.label.kiro_bonus",window:e.secondary_window}]}},grok:{windows(e){return[{key:"month",labelKey:"limits.label.grok_month",window:e.primary_window},{key:"ondemand",labelKey:"limits.label.grok_ondemand",window:e.secondary_window}]}},antigravity:{windows(e){return[{key:"claude-weekly",labelKey:"limits.label.antigravity_claude_weekly",window:e.primary_window},{key:"claude-5h",labelKey:"limits.label.antigravity_claude_5h",window:e.secondary_window},{key:"gemini-weekly",labelKey:"limits.label.antigravity_gemini_weekly",window:e.tertiary_window},{key:"gemini-5h",labelKey:"limits.label.antigravity_gemini_5h",window:e.quaternary_window}]}},copilot:{extra:"copilot_otel",windows(e){return[{key:"premium",labelKey:"limits.label.copilot_premium",window:e.primary_window},{key:"chat",labelKey:"limits.label.copilot_chat",window:e.secondary_window}]}},zcode:{windows(e){return e.plan_kind==="coding-plan"?[{key:"5h",labelKey:"limits.label.zcode_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.zcode_weekly",window:e.secondary_window},{key:"tools",labelKey:"limits.label.zcode_tools",window:e.tertiary_window}]:[{key:"glm52",labelKey:"limits.label.zcode_glm52",window:e.primary_window},{key:"glm5t",labelKey:"limits.label.zcode_glm5t",window:e.secondary_window}]}},opencodeGo:{windows(e){return[{key:"5h",labelKey:"limits.label.opencode_go_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.opencode_go_weekly",window:e.secondary_window},{key:"monthly",labelKey:"limits.label.opencode_go_monthly",window:e.tertiary_window}]}}},g="tt.limitAlerts.cycles.v1";function O(){try{return JSON.parse(window.localStorage.getItem(g)||"{}")}catch{return{}}}function z(e){try{window.localStorage.setItem(g,JSON.stringify(e))}catch{}}function A(e,{now:t=Date.now()}={}){const i=[],w=L;for(const[c,n]of Object.entries(e||{})){const s=w[c];if(!(!n?.configured||n.error||!s))for(const l of s.windows(n)){if(!l.window)continue;const r=Number(l.pctField==="utilization"?l.window.utilization:l.window.used_percent),u=l.resetField==="resets_at"?l.window.resets_at:l.window.reset_at,d=N(u),m=I({usedPercent:r,windowSeconds:x(l,l.window),resetMs:d,mode:"used",now:t});!m.runsOutEta||!m.paceOver||r<20||!(d>t)||i.push({id:`${c}:${l.key}:${d}`,providerId:c,windowKey:l.key,resetMs:d,usedPercent:r,runsOutEta:m.runsOutEta})}}return i}function D(e){const t=O(),i=A(e);for(const n of i){if(t[n.id])continue;const s=v(n.providerId),l=h("limits.alert.title",{provider:s}),r=h("limits.alert.body",{eta:n.runsOutEta,percent:Math.round(n.usedPercent)});let u=S({title:l,body:r,id:n.id});!u&&typeof Notification<"u"&&Notification.permission==="granted"&&(new Notification(l,{body:r,tag:n.id}),u=!0),u&&(t[n.id]=Date.now())}const w=Date.now()-864e5,c=Object.fromEntries(Object.entries(t).filter(([n,s])=>{const l=Number(n.split(":").at(-1));return Number.isFinite(l)?l>=w:Number(s)>=w}).slice(-100));return z(c),i.length}function $(e){const t=!!e?.initialState,[i,w]=y.useState(()=>t?e?.initialState?.data??null:null),[c,n]=y.useState(()=>t?e?.initialState?.error??null:null),[s,l]=y.useState(!t),r=!!e?.initialRefresh,u=!!e?.publishToPreloadCache;y.useEffect(()=>{if(!(!i||typeof window>"u"))try{window.localStorage.getItem(f)==="1"&&D(i)}catch{}},[i]);const d=y.useCallback((o,a)=>{!u||!o||typeof o!="object"||K(o,{source:a})},[u]),m=y.useCallback(async()=>{try{const o=await _({refresh:!0}),a=o&&typeof o=="object"?o:null;w(a),n(null),d(a,"manual-refresh")}catch(o){n(o?.message||String(o))}},[d]),p=y.useCallback(async()=>{try{const o=await _(),a=o&&typeof o=="object"?o:null;w(a),n(null),d(a,"page-load")}catch(o){n(o?.message||String(o))}},[d]);return y.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const o=15e3;let a=Date.now();const b=()=>{if(document.visibilityState!=="visible")return;const k=Date.now();k-a<o||(a=k,p())};return window.addEventListener("focus",b),document.addEventListener("visibilitychange",b),()=>{window.removeEventListener("focus",b),document.removeEventListener("visibilitychange",b)}},[p]),y.useEffect(()=>{if(t&&!r)return;let o=!1;return(async()=>{try{const a=await _();if(o)return;const b=a&&typeof a=="object"?a:null;w(b),n(null),d(b,"page-load")}catch(a){if(o)return;n(a?.message||String(a))}finally{o||l(!1)}})(),()=>{o=!0}},[t,r,d]),{data:i,error:c,isLoading:s,refresh:m}}export{L as P,x as a,R as b,I as c,N as r,D as s,$ as u};
@@ -1 +0,0 @@
1
- import{cc as Xe,cd as _t,aO as Ot,aN as Y,aQ as wt,bx as U,ce as Ct,cf as $e,j as Se,cg as ze,r as g,K as V,ch as ot,ci as Dt,aR as it,bv as We,cj as Gt,ck as ct,cl as xt,bz as x,by as ke,bQ as he,cm as Ve,cn as le,co as ae,aL as C,bC as Kt,cp as It,cq as Je,cr as Ut,bN as ut,bI as lt,bK as Xt,cs as Vt,aK as be,bM as qt,ct as jt,aI as Pe,bH as $t,cu as Qe,aT as Be,cv as zt,cw as Ye,bD as Jt,bu as Le,bE as Qt,bw as Ie,cx as _e,cy as Zt,cz as en,cA as tn,aM as nn,aB as Te,cB as me,cC as rn,aW as sn,aF as on,aC as De,cD as at,cE as cn,cF as Ze}from"./__vite-browser-external-Eoyj4eG-.js";function Fe(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>[...!n||s.context?.open?[s]:[],...Fe(e,s.id,n)])}function ft(e,t){let n=[],r=e.find(s=>s.id===t)?.parentId;for(;r;){const s=e.find(o=>o.id===r);r=s?.parentId,s&&(n=n.concat(s))}return n}function un(e){e.preventDefault(),e.stopPropagation()}function ln(e){return"nativeEvent"in e}function an(e){return e.pointerType===""&&e.isTrusted?!0:Xe&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function fn(e){return _t?!1:!Xe&&e.width===0&&e.height===0||Xe&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function jn(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function dn(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Ae(e){const t=Ot(pn,e).current;return t.next=e,Y(t.effect),t}function pn(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}let Ne=0;function Ge(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:s}=t;cancelAnimationFrame(Ne);function o(){s&&!s()||e?.focus({preventScroll:n})}if(r)return o(),wt;const i=requestAnimationFrame(o);return Ne=i,()=>{Ne===i&&(cancelAnimationFrame(i),Ne=0)}}const Ke={inert:new WeakMap,"aria-hidden":new WeakMap},dt="data-base-ui-inert",qe={inert:new WeakSet,"aria-hidden":new WeakSet};let xe=new WeakMap,Ue=0;function gn(e){return qe[e]}function kt(e){return e?Ct(e)?e.host:kt(e.parentNode):null}const pt=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=kt(n);return e.contains(r)?r:null}).filter(n=>n!=null),gt=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},ht=(e,t,n)=>{const r=[],s=o=>{!o||n.has(o)||Array.from(o.children).forEach(i=>{$e(i)!=="script"&&(t.has(i)?s(i):r.push(i))})};return s(e),r};function hn(e,t,n,r,{mark:s=!0}){let o=null;r?o="inert":n&&(o="aria-hidden");let i=null,u=null;const h=pt(t,e),f=s?ht(t,gt(h),new Set(h)):[],k=[],L=[];if(o){const b=Ke[o],T=gn(o);u=T,i=b;const A=pt(t,Array.from(t.querySelectorAll("[aria-live]"))),P=h.concat(A);ht(t,gt(P),new Set(P)).forEach(y=>{const E=y.getAttribute(o),Q=E!==null&&E!=="false",H=(b.get(y)||0)+1;b.set(y,H),k.push(y),H===1&&Q&&T.add(y),Q||y.setAttribute(o,o==="inert"?"":"true")})}return s&&f.forEach(b=>{const T=(xe.get(b)||0)+1;xe.set(b,T),L.push(b),T===1&&b.setAttribute(dt,"")}),Ue+=1,()=>{i&&k.forEach(b=>{const A=(i.get(b)||0)-1;i.set(b,A),A||(!u?.has(b)&&o&&b.removeAttribute(o),u?.delete(b))}),s&&L.forEach(b=>{const T=(xe.get(b)||0)-1;xe.set(b,T),T||b.removeAttribute(dt)}),Ue-=1,Ue||(Ke.inert=new WeakMap,Ke["aria-hidden"]=new WeakMap,qe.inert=new WeakSet,qe["aria-hidden"]=new WeakSet,xe=new WeakMap)}}function mt(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0}=t,o=U(e[0]).body;return hn(e,o,n,r,{mark:s})}function Pt(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class mn{nodesRef={current:[]};events=Pt();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Ft=g.createContext(null),Mt=g.createContext(null),et=()=>g.useContext(Ft)?.id||null,tt=e=>{const t=g.useContext(Mt);return e??t};function $n(e){const t=ze(),n=tt(e),r=et();return Y(()=>{if(!t)return;const s={id:t,parentId:r};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,t,r]),t}function zn(e){const{children:t,id:n}=e,r=et();return Se.jsx(Ft.Provider,{value:g.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Jn(e){const{children:t,externalTree:n}=e,r=Ot(()=>n??new mn).current;return Se.jsx(Mt.Provider,{value:r,children:t})}function bn(e,t){const n=Be(be(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const bt=20;let fe=[];function nt(){fe=fe.filter(e=>e.deref()?.isConnected)}function Et(e){nt(),e&&$e(e)!=="body"&&(fe.push(new WeakRef(e)),fe.length>bt&&(fe=fe.slice(-bt)))}function yt(){return nt(),fe[fe.length-1]?.deref()}function En(e){return e?Qe(e)?e:xt(e)[0]||e:null}function Rt(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=zt(e).filter(s=>{const o=s.getAttribute("data-tabindex")||"";return Qe(s)||s.hasAttribute("data-tabindex")&&!o.startsWith("-")}),r=e.getAttribute("tabindex");n.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Qn(e){const{context:t,children:n,disabled:r=!1,initialFocus:s=!0,returnFocus:o=!0,restoreFocus:i=!1,modal:u=!0,closeOnFocusOut:h=!0,openInteractionType:f="",nextFocusableElement:k,previousFocusableElement:L,beforeContentFocusGuardRef:b,externalTree:T,getInsideElements:A}=e,P="rootStore"in t?t.rootStore:t,_=P.useState("open"),y=P.useState("domReferenceElement"),E=P.useState("floatingElement"),{events:Q,dataRef:H}=P.context,q=V(()=>H.current.floatingContext?.nodeId),J=s===!1,D=ot(y)&&J,se=Ae(s),F=Ae(o),j=Ae(f),ve=Ae(_),N=tt(T),R=Dt(),B=g.useRef(!1),oe=g.useRef(!1),ee=g.useRef(!1),te=g.useRef(null),Ee=g.useRef(""),de=g.useRef(""),pe=g.useRef(null),ye=g.useRef(null),S=it(pe,b,R?.beforeInsideRef),$=it(ye,R?.afterInsideRef),ie=We(),ce=We(),Oe=Gt(),Me=R!=null,p=ct(E),ne=V((m=p)=>m?xt(m):[]),Z=V(()=>A?.().filter(m=>m!=null)??[]);g.useEffect(()=>{if(r||!u)return;function m(W){W.key==="Tab"&&C(p,ae(U(p)))&&ne().length===0&&!D&&un(W)}const I=U(p);return x(I,"keydown",m)},[r,p,u,D,ne]),g.useEffect(()=>{if(r||!_)return;const m=U(p);function I(){ee.current=!1}function W(z){const a=be(z),O=Z(),d=C(E,a)||C(y,a)||C(R?.portalNode,a)||O.some(M=>M===a||C(M,a));ee.current=!d,de.current=z.pointerType||"keyboard",a?.closest(`[${qt}]`)&&(oe.current=!0,ce.start(0,()=>{oe.current=!1}))}function G(){de.current="keyboard"}return ke(x(m,"pointerdown",W,!0),x(m,"pointerup",I,!0),x(m,"pointercancel",I,!0),x(m,"keydown",G,!0),I)},[r,E,y,p,_,R,ce,Z]),g.useEffect(()=>{if(r||!h)return;const m=U(p);function I(){oe.current=!0,ce.start(0,()=>{oe.current=!1})}function W(O){const d=be(O);Qe(d)&&(te.current=d)}function G(O){const d=O.relatedTarget,M=O.currentTarget,K=be(O);u&&d==null&&K!=null&&C(E,K)&&Et(K),queueMicrotask(()=>{const w=q(),Re=P.context.triggerElements,c=Z(),l=d?.hasAttribute(Ve("focus-guard"))&&[pe.current,ye.current,R?.beforeInsideRef.current,R?.afterInsideRef.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,le(L),le(k)].includes(d),X=!(C(y,d)||C(E,d)||C(d,E)||C(R?.portalNode,d)||c.some(v=>v===d||C(v,d))||d!=null&&Re.hasElement(d)||Re.hasMatchingElement(v=>C(v,d))||l||N&&(Fe(N.nodesRef.current,w).find(v=>C(v.context?.elements.floating,d)||C(v.context?.elements.domReference,d))||ft(N.nodesRef.current,w).find(v=>[v.context?.elements.floating,ct(v.context?.elements.floating)].includes(d)||v.context?.elements.domReference===d)));if(M===y&&p&&Rt(p),i&&M!==y&&!jt(K)&&ae(m)===m.body){if(he(p)&&(p.focus(),i==="popup")){Oe.request(()=>{p.focus()});return}const v=ne(),ue=te.current,we=(ue&&v.includes(ue)?ue:null)||v[v.length-1]||p;he(we)&&we.focus()}if(H.current.insideReactTree){H.current.insideReactTree=!1;return}(D||!u)&&d&&X&&!oe.current&&(D||d!==yt())&&(B.current=!0,P.setOpen(!1,Pe($t,O)))})}function z(){ee.current||(H.current.insideReactTree=!0,ie.start(0,()=>{H.current.insideReactTree=!1}))}const a=he(y)?y:null;if(!(!E&&!a))return ke(a&&x(a,"focusout",G),a&&x(a,"pointerdown",I),E&&x(E,"focusin",W),E&&x(E,"focusout",G),E&&R&&x(E,"focusout",z,!0))},[r,y,E,p,u,N,R,P,h,i,ne,D,q,H,ie,ce,Oe,k,L,Z]),g.useEffect(()=>{if(r||!E||!_)return;const m=Array.from(R?.portalNode?.querySelectorAll(`[${Ve("portal")}]`)||[]),W=(N?ft(N.nodesRef.current,q()):[]).find(M=>ot(M.context?.elements.domReference||null))?.context?.elements.domReference,z=[...[E,...m,pe.current,ye.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,...Z()],W,le(L),le(k),D?y:null].filter(M=>M!=null),a=mt(z,{ariaHidden:u||D,mark:!1}),O=[E,...m].filter(M=>M!=null),d=mt(O);return()=>{d(),a()}},[_,r,y,E,u,R,D,N,q,k,L,Z]),Y(()=>{if(!_||r||!he(p))return;const m=U(p),I=ae(m);queueMicrotask(()=>{const W=se.current,G=typeof W=="function"?W(j.current||""):W;if(G===void 0||G===!1||C(p,I))return;let a=null;const O=()=>(a==null&&(a=ne(p)),a[0]||p);let d;G===!0||G===null?d=O():d=le(G),d=d||O();const M=C(p,ae(m));Ge(d,{preventScroll:d===p,shouldFocus(){if(!ve.current)return!1;if(M)return!0;const K=ae(m);return!(K!==d&&C(p,K))}})})},[r,_,p,ne,se,j,ve]),Y(()=>{if(r||!p)return;const m=U(p),I=ae(m),W=j.current==null;Et(I);function G(a){if(a.open||(Ee.current=bn(a.nativeEvent,de.current)),a.reason===Kt&&a.nativeEvent.type==="mouseleave"&&(B.current=!0),a.reason===It)if(a.nested)B.current=!1;else if(an(a.nativeEvent)||fn(a.nativeEvent))B.current=!1;else{let O=!1;U(p).createElement("div").focus({get preventScroll(){return O=!0,!1}}),O?B.current=!1:B.current=!0}}Q.on("openchange",G);function z(){const a=F.current;let O=typeof a=="function"?a(Ee.current):a;if(O===void 0||O===!1)return null;O===null&&(O=!0);const d=y?.isConnected?y:null,M=I?.isConnected&&$e(I)!=="body"?I:null;let K=W?M||d:d||M;return K||(K=yt()||null),typeof O=="boolean"?K:le(O)||K||null}return()=>{Q.off("openchange",G);const a=ae(m),O=Z(),d=C(E,a)||O.some(w=>w===a||C(w,a))||N&&Fe(N.nodesRef.current,q(),!1).some(w=>C(w.context?.elements.floating,a)),M=F.current,K=z();queueMicrotask(()=>{const w=En(K),Re=typeof M!="boolean";M&&!B.current&&he(w)&&(!(!Re&&w!==a&&a!==m.body)||d)&&w.focus({preventScroll:!0}),B.current=!1})}},[r,E,p,F,j,Q,N,y,q,Z]),Y(()=>{if(!Je||_||!E)return;const m=ae(U(E));!he(m)||!Ut(m)||C(E,m)&&m.blur()},[_,E]),Y(()=>{if(!(r||!R))return R.setFocusManagerState({modal:u,closeOnFocusOut:h,open:_,onOpenChange:P.setOpen,domReference:y}),()=>{R.setFocusManagerState(null)}},[r,R,u,_,P,h,y]),Y(()=>{if(!(r||!p))return Rt(p),()=>{queueMicrotask(nt)}},[r,p]);const ge=!r&&(u?!D:!0)&&(Me||u);return Se.jsxs(g.Fragment,{children:[ge&&Se.jsx(ut,{"data-type":"inside",ref:S,onFocus:m=>{if(u){const I=ne();Ge(I[I.length-1])}else R?.portalNode&&(B.current=!1,lt(m,R.portalNode)?Xt(y)?.focus():le(L??R.beforeOutsideRef)?.focus())}}),n,ge&&Se.jsx(ut,{"data-type":"inside",ref:$,onFocus:m=>{u?Ge(ne()[0]):R?.portalNode&&(h&&(B.current=!0),lt(m,R.portalNode)?Vt(y)?.focus():le(k??R.afterOutsideRef)?.focus())}})]})}function yn(){return!1}function Rn(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Zn(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:s=!0,outsidePressEvent:o="sloppy",referencePress:i=yn,bubbles:u,externalTree:h}=t,f="rootStore"in e?e.rootStore:e,k=f.useState("open"),L=f.useState("floatingElement"),{dataRef:b}=f.context,T=tt(h),A=V(typeof s=="function"?s:()=>!1),P=typeof s=="function"?A:s,_=P!==!1,y=V(()=>o),{escapeKey:E,outsidePress:Q}=Rn(u),H=g.useRef(!1),q=g.useRef(!1),J=g.useRef(!1),D=g.useRef(!1),se=g.useRef(""),F=g.useRef(null),j=We(),ve=We(),N=V(()=>{ve.clear(),b.current.insideReactTree=!1}),R=V(S=>{const $=b.current.floatingContext?.nodeId;return(T?Fe(T.nodesRef.current,$):[]).some(ce=>ce.context?.open&&!ce.context.dataRef.current[S])}),B=V(S=>Ye(S,f.select("floatingElement"))||Ye(S,f.select("domReferenceElement"))),oe=V(S=>{i()&&f.setOpen(!1,Pe(Jt,S.nativeEvent))}),ee=V(S=>{if(!k||!n||!r||S.key!=="Escape"||D.current||!E&&R("__escapeKeyBubbles"))return;const $=ln(S)?S.nativeEvent:S,ie=Pe(Qt,$);f.setOpen(!1,ie),ie.isCanceled||S.preventDefault(),!E&&!ie.isPropagationAllowed&&S.stopPropagation()}),te=V(()=>{b.current.insideReactTree=!0,ve.start(0,N)}),Ee=V(S=>{if(!k||!n||S.button!==0)return;const $=be(S.nativeEvent);C(f.select("floatingElement"),$)&&(H.current||(H.current=!0,q.current=!1))}),de=V(S=>{!k||!n||(S.defaultPrevented||S.nativeEvent.defaultPrevented)&&H.current&&(q.current=!0)});g.useEffect(()=>{if(!k||!n)return;b.current.__escapeKeyBubbles=E,b.current.__outsidePressBubbles=Q;const S=new Le,$=new Le;function ie(){S.clear(),D.current=!0}function ce(){S.start(Je?5:0,()=>{D.current=!1})}function Oe(){J.current=!0,$.start(0,()=>{J.current=!1})}function Me(){H.current=!1,q.current=!1}function p(){const c=se.current,l=c==="pen"||!c?"mouse":c,X=y(),v=typeof X=="function"?X():X;return typeof v=="string"?v:v[l]}function ne(c){const l=p();return l==="intentional"&&c.type!=="click"||l==="sloppy"&&c.type==="click"}function Z(c){const l=b.current.floatingContext?.nodeId,X=T&&Fe(T.nodesRef.current,l).some(v=>Ye(c,v.context?.elements.floating));return B(c)||X}function ge(c){if(ne(c)){c.type!=="click"&&!B(c)&&($.clear(),J.current=!1),N();return}if(b.current.insideReactTree){N();return}const l=be(c),X=`[${Ve("inert")}]`,v=Ie(l)?l.getRootNode():null,ue=Array.from((Ct(v)?v:U(f.select("floatingElement"))).querySelectorAll(X)),we=f.context.triggerElements;if(l&&(we.hasElement(l)||we.hasMatchingElement(re=>C(re,l))))return;let Ce=Ie(l)?l:null;for(;Ce&&!_e(Ce);){const re=Zt(Ce);if(_e(re)||!Ie(re))break;Ce=re}if(!(ue.length&&Ie(l)&&!en(l)&&!C(l,f.select("floatingElement"))&&ue.every(re=>!C(Ce,re)))){if(he(l)&&!("touches"in c)){const re=_e(l),He=tn(l),st=/auto|scroll/,At=re||st.test(He.overflowX),Nt=re||st.test(He.overflowY),Wt=At&&l.clientWidth>0&&l.scrollWidth>l.clientWidth,Lt=Nt&&l.clientHeight>0&&l.scrollHeight>l.clientHeight,Bt=He.direction==="rtl",Ht=Lt&&(Bt?c.offsetX<=l.offsetWidth-l.clientWidth:c.offsetX>l.clientWidth),Yt=Wt&&c.offsetY>l.clientHeight;if(Ht||Yt)return}if(!Z(c)){if(p()==="intentional"&&J.current){$.clear(),J.current=!1;return}typeof P=="function"&&!P(c)||R("__outsidePressBubbles")||(f.setOpen(!1,Pe(It,c)),N())}}}function m(c){p()!=="sloppy"||c.pointerType==="touch"||!f.select("open")||!n||B(c)||ge(c)}function I(c){if(p()!=="sloppy"||!f.select("open")||!n||B(c))return;const l=c.touches[0];l&&(F.current={startTime:Date.now(),startX:l.clientX,startY:l.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},j.start(1e3,()=>{F.current&&(F.current.dismissOnTouchEnd=!1,F.current.dismissOnMouseDown=!1)}))}function W(c,l){const X=be(c);if(!X)return;const v=x(X,c.type,()=>{l(c),v()})}function G(c){se.current="touch",W(c,I)}function z(c){j.clear(),c.type==="pointerdown"&&(se.current=c.pointerType),!(c.type==="mousedown"&&F.current&&!F.current.dismissOnMouseDown)&&W(c,l=>{l.type==="pointerdown"?m(l):ge(l)})}function a(c){if(!H.current)return;const l=q.current;if(Me(),p()==="intentional"){if(c.type==="pointercancel"){l&&Oe();return}if(!Z(c)){if(l){Oe();return}typeof P=="function"&&!P(c)||($.clear(),J.current=!0,N())}}}function O(c){if(p()!=="sloppy"||!F.current||B(c))return;const l=c.touches[0];if(!l)return;const X=Math.abs(l.clientX-F.current.startX),v=Math.abs(l.clientY-F.current.startY),ue=Math.sqrt(X*X+v*v);ue>5&&(F.current.dismissOnTouchEnd=!0),ue>10&&(ge(c),j.clear(),F.current=null)}function d(c){W(c,O)}function M(c){p()!=="sloppy"||!F.current||B(c)||(F.current.dismissOnTouchEnd&&ge(c),j.clear(),F.current=null)}function K(c){W(c,M)}const w=U(L),Re=ke(r&&ke(x(w,"keydown",ee),x(w,"compositionstart",ie),x(w,"compositionend",ce)),_&&ke(x(w,"click",z,!0),x(w,"pointerdown",z,!0),x(w,"pointerup",a,!0),x(w,"pointercancel",a,!0),x(w,"mousedown",z,!0),x(w,"mouseup",a,!0),x(w,"touchstart",G,!0),x(w,"touchmove",d,!0),x(w,"touchend",K,!0)));return()=>{Re(),S.clear(),$.clear(),Me(),J.current=!1}},[b,L,r,_,P,k,n,E,Q,ee,N,y,R,B,T,f,j]),g.useEffect(N,[P,N]);const pe=g.useMemo(()=>({onKeyDown:ee,onPointerDown:oe,onClick:oe}),[ee,oe]),ye=g.useMemo(()=>({onKeyDown:ee,onPointerDown:de,onMouseDown:de,onClickCapture:te,onMouseDownCapture(S){te(),Ee(S)},onPointerDownCapture(S){te(),Ee(S)},onMouseUpCapture:te,onTouchEndCapture:te,onTouchMoveCapture:te}),[ee,te,Ee,de]);return g.useMemo(()=>n?{reference:pe,floating:ye,trigger:pe}:{},[n,pe,ye])}function Tn(e){const t=g.useRef(!0);t.current&&(t.current=!1,e())}const Sn={open:Te(e=>e.open),transitionStatus:Te(e=>e.transitionStatus),domReferenceElement:Te(e=>e.domReferenceElement),referenceElement:Te(e=>e.positionReference??e.referenceElement),floatingElement:Te(e=>e.floatingElement),floatingId:Te(e=>e.floatingId)};class vn extends nn{constructor(t){const{syncOnly:n,nested:r,onOpenChange:s,triggerElements:o,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:Pt(),nested:r,triggerElements:o},Sn),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&dn(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function On(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:s,nested:o,onOpenChange:i}=e,u=t.useState("open"),h=t.useState("activeTriggerElement"),f=t.useState(n?"popupElement":"positionerElement"),k=t.context.triggerElements,L=i,b=g.useRef(null);r===void 0&&b.current===null&&(b.current=new vn({open:u,transitionStatus:void 0,referenceElement:h,floatingElement:f,triggerElements:k,onOpenChange:L,floatingId:s,syncOnly:!0,nested:o}));const T=r??b.current;return t.useSyncedValue("floatingId",s),Y(()=>{const A={open:u,floatingId:s,referenceElement:h,floatingElement:f};Ie(h)&&(A.domReferenceElement=h),T.state.positionReference===T.state.referenceElement&&(A.positionReference=h),T.update(A)},[u,s,h,f,T]),T.context.onOpenChange=L,T.context.nested=o,T}function wn(e,t=!1,n=!1){const[r,s]=g.useState(e&&t?"idle":void 0),[o,i]=g.useState(e);return e&&!o&&(i(!0),s("starting")),!e&&o&&r!=="ending"&&!n&&s("ending"),!e&&!o&&r==="ending"&&s(void 0),Y(()=>{if(!e&&o&&r!=="ending"&&n){const u=me.request(()=>{s("ending")});return()=>{me.cancel(u)}}},[e,o,r,n]),Y(()=>{if(!e||t)return;const u=me.request(()=>{s(void 0)});return()=>{me.cancel(u)}},[t,e]),Y(()=>{if(!e||!t)return;e&&o&&r!=="idle"&&s("starting");const u=me.request(()=>{s("idle")});return()=>{me.cancel(u)}},[t,e,o,r]),{mounted:o,setMounted:i,transitionStatus:r}}const er={tabIndex:-1,[rn]:""};function tr(e){return t=>t==="touch"?e.current:!0}function nr(e,t,n=!1){const r=ze(),s=et()!=null,o=g.useRef(null);e===void 0&&o.current===null&&(o.current=t(r,s));const i=e??o.current;return On({popupStore:i,treatPopupAsFloatingElement:n,floatingRootContext:i.state.floatingRootContext,floatingId:r,nested:s,onOpenChange:i.setOpen}),{store:i,internalStore:o.current}}function Cn(e,t){const n=g.useRef(null),r=g.useRef(null);return g.useCallback(s=>{if(e===void 0)return;let o=!1;if(n.current!==null){const i=n.current,u=r.current,h=t.context.triggerElements.getById(i);u&&h===u&&(t.context.triggerElements.delete(i),o=!0),n.current=null,r.current=null}if(s!==null&&(n.current=e,r.current=s,t.context.triggerElements.add(e,s),o=!0),o){const i=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==i&&t.set("triggerCount",i)}},[t,e])}function rr(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);const s=n?.id??null;(s||t)&&(e.activeTriggerId=s,e.activeTriggerElement=n??null)}function sr(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function or(e,t,n,r){Tn(()=>{t===void 0&&e.state.open===!1&&n&&(e.state={...e.state,open:!0,activeTriggerId:r,preventUnmountingOnClose:!1})})}function ir(e,t,n,r){const s=n.useState("isMountedByTrigger",e),o=Cn(e,n),i=V(u=>{if(o(u),!u)return;const h=n.select("open"),f=n.select("activeTriggerId");if(f===e){n.update({activeTriggerElement:u,...h?r:null});return}f==null&&h&&n.update({activeTriggerId:e,activeTriggerElement:u,...r})});return Y(()=>{s&&n.update({activeTriggerElement:t.current,...r})},[s,n,t,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:s}}function cr(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=e.useState("open"),s=e.useState("triggerCount");Y(()=>{if(!r){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const o=e.context.triggerElements.size,i={};e.state.triggerCount!==o&&(i.triggerCount=o);const u=e.select("activeTriggerId");let h=null;if(u){const f=e.context.triggerElements.getById(u);f?f!==e.state.activeTriggerElement&&(i.activeTriggerElement=f):h=u}if(!h&&!u&&o===1){const f=e.context.triggerElements.entries().next();if(!f.done){const[k,L]=f.value;i.activeTriggerId=k,i.activeTriggerElement=L}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0||i.activeTriggerElement!==void 0)&&e.update(i),h&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===h&&!e.context.triggerElements.getById(h)){const f=Pe(sn);e.setOpen(!1,f),f.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,s,n])}function ur(e,t,n){const{mounted:r,setMounted:s,transitionStatus:o}=wn(e),i=t.useState("preventUnmountingOnClose"),u=e?!1:i;t.useSyncedValues({mounted:r,transitionStatus:o,preventUnmountingOnClose:u});const h=V(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return on({enabled:r&&!e&&!u,open:e,ref:t.context.popupRef,onComplete(){e||h()}}),{forceUnmount:h,transitionStatus:o}}function lr(e,t){e.useSyncedValues(t),Y(()=>()=>{e.update({activeTriggerProps:De,inactiveTriggerProps:De,popupProps:De})},[e])}function ar(e,t){Y(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),Y(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class fr{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}let rt=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=at.startingStyle]="startingStyle",e[e.endingStyle=at.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),je=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const xn={[je.popupOpen]:""},In={[je.popupOpen]:"",[je.pressed]:""},kn={[rt.open]:""},Pn={[rt.closed]:""},Fn={[rt.anchorHidden]:""},dr={open(e){return e?xn:null}},pr={open(e){return e?In:null}},gr={open(e){return e?kn:Pn},anchorHidden(e){return e?Fn:null}};function hr(e){return ze(e,"base-ui")}const Mn="ArrowUp",An="ArrowDown",Nn="ArrowLeft",Wn="ArrowRight",Ln="Home",Bn="End",Hn=new Set([Nn,Wn]),Yn=new Set([Mn,An]),_n=new Set([...Hn,...Yn]),mr=new Set([..._n,Ln,Bn]),br=g.forwardRef(function(t,n){const{cutout:r,...s}=t;let o;if(r){const i=r.getBoundingClientRect();o=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return Se.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})});let Tt={},St={},vt="";function Dn(e){if(typeof document>"u")return!1;const t=U(e);return Be(t).innerWidth-t.documentElement.clientWidth>0}function Gn(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=U(e),r=n.documentElement,s=n.body,o=Ze(r)?r:s,i=o.style.overflowY,u=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",o.style.overflowY="scroll";const h=o.offsetWidth;o.style.overflowY="hidden";const f=o.offsetWidth;return o.style.overflowY=i,r.style.scrollbarGutter=u,h===f}function Kn(e){const t=U(e),n=t.documentElement,r=t.body,s=Ze(n)?n:r,o={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,o)}}function Un(e){const t=U(e),n=t.documentElement,r=t.body,s=Be(n);let o=0,i=0,u=!1;const h=me.create();if(Je&&(s.visualViewport?.scale??1)!==1)return()=>{};function f(){const T=s.getComputedStyle(n),A=s.getComputedStyle(r),y=(T.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,i=n.scrollLeft,Tt={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},vt=n.style.scrollBehavior,St={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const E=n.scrollHeight>n.clientHeight,Q=n.scrollWidth>n.clientWidth,H=T.overflowY==="scroll"||A.overflowY==="scroll",q=T.overflowX==="scroll"||A.overflowX==="scroll",J=Math.max(0,s.innerWidth-r.clientWidth),D=Math.max(0,s.innerHeight-r.clientHeight),se=parseFloat(A.marginTop)+parseFloat(A.marginBottom),F=parseFloat(A.marginLeft)+parseFloat(A.marginRight),j=Ze(n)?n:r;if(u=Gn(e),u){n.style.scrollbarGutter=y,j.style.overflowY="hidden",j.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:y,overflowY:"hidden",overflowX:"hidden"}),(E||H)&&(n.style.overflowY="scroll"),(Q||q)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:se||D?`calc(100dvh - ${se+D}px)`:"100dvh",width:F||J?`calc(100vw - ${F+J}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function k(){Object.assign(n.style,Tt),Object.assign(r.style,St),u||(n.scrollTop=o,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=vt)}function L(){k(),h.request(f)}f();const b=x(s,"resize",L);return()=>{h.cancel(),k(),typeof s.removeEventListener=="function"&&b()}}class Xn{lockCount=0;restore=null;timeoutLock=Le.create();timeoutUnlock=Le.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const r=U(t).documentElement,s=Be(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=wt;return}const o=cn||!Dn(t);this.restore=o?Kn(t):Un(t)}}const Vn=new Xn;function Er(e=!0,t=null){Y(()=>{if(e)return Vn.acquire(t)},[e,t])}export{pr as A,$n as B,rt as C,zn as D,Ge as E,vn as F,un as G,an as H,br as I,fn as J,fr as P,er as a,mr as b,tr as c,Qn as d,ar as e,cr as f,ur as g,Zn as h,Er as i,lr as j,nr as k,Tn as l,wn as m,jn as n,tt as o,gr as p,et as q,Fe as r,rr as s,dr as t,hr as u,Ae as v,sr as w,Jn as x,or as y,ir as z};